From cda88db77ce59e5d4f56a9be3d773cdb35406191 Mon Sep 17 00:00:00 2001 From: evgenyzinoviev Date: Fri, 15 Jan 2016 03:45:19 +0100 Subject: [PATCH 1/2] Added option to prevent a window from being moved on OS X --- atom/browser/native_window_mac.mm | 5 +++++ atom/common/options_switches.cc | 1 + atom/common/options_switches.h | 1 + docs/api/browser-window.md | 1 + 4 files changed, 8 insertions(+) diff --git a/atom/browser/native_window_mac.mm b/atom/browser/native_window_mac.mm index 2d75a682c653..8f7699140474 100644 --- a/atom/browser/native_window_mac.mm +++ b/atom/browser/native_window_mac.mm @@ -452,6 +452,11 @@ NativeWindowMac::NativeWindowMac( set_force_using_draggable_region(true); } + bool movable; + if (options.Get(options::kMovable, &movable)) { + [window_ setMovable:movable]; + } + // On OS X the initial window size doesn't include window frame. bool use_content_size = false; options.Get(options::kUseContentSize, &use_content_size); diff --git a/atom/common/options_switches.cc b/atom/common/options_switches.cc index 6c4e8477cc4a..477fe6755faf 100644 --- a/atom/common/options_switches.cc +++ b/atom/common/options_switches.cc @@ -22,6 +22,7 @@ const char kMinHeight[] = "minHeight"; const char kMaxWidth[] = "maxWidth"; const char kMaxHeight[] = "maxHeight"; const char kResizable[] = "resizable"; +const char kMovable[] = "movable"; const char kFullscreen[] = "fullscreen"; // Whether the window should show in taskbar. diff --git a/atom/common/options_switches.h b/atom/common/options_switches.h index f038521673a0..78de53b825f9 100644 --- a/atom/common/options_switches.h +++ b/atom/common/options_switches.h @@ -23,6 +23,7 @@ extern const char kMinHeight[]; extern const char kMaxWidth[]; extern const char kMaxHeight[]; extern const char kResizable[]; +extern const char kMovable[]; extern const char kFullscreen[]; extern const char kSkipTaskbar[]; extern const char kKiosk[]; diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 61180d5b89a9..211b23a5eb9e 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -47,6 +47,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`. * `maxWidth` Integer - Window's maximum width. Default is no limit. * `maxHeight` Integer - Window's maximum height. Default is no limit. * `resizable` Boolean - Whether window is resizable. Default is `true`. + * `movable` Boolean - Whether window is movable. Default is `true`. * `alwaysOnTop` Boolean - Whether the window should always stay on top of other windows. Default is `false`. * `fullscreen` Boolean - Whether the window should show in fullscreen. When From 4b0119f9962657aa170cee832b23cccdb46ca29f Mon Sep 17 00:00:00 2001 From: evgenyzinoviev Date: Fri, 15 Jan 2016 16:02:23 +0100 Subject: [PATCH 2/2] added a note that this option is only implemented on osx --- docs/api/browser-window.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 211b23a5eb9e..422b3cfddeb2 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -47,7 +47,8 @@ It creates a new `BrowserWindow` with native properties as set by the `options`. * `maxWidth` Integer - Window's maximum width. Default is no limit. * `maxHeight` Integer - Window's maximum height. Default is no limit. * `resizable` Boolean - Whether window is resizable. Default is `true`. - * `movable` Boolean - Whether window is movable. Default is `true`. + * `movable` Boolean - Whether window is movable. This is only implemented + on OS X. Default is `true`. * `alwaysOnTop` Boolean - Whether the window should always stay on top of other windows. Default is `false`. * `fullscreen` Boolean - Whether the window should show in fullscreen. When