diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-09-27 15:51:33 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-09-27 15:51:33 +0300 |
commit | 4de1e673a411d14c5ab980d37cc3e1bb8b3d99ea (patch) | |
tree | f4f84a3813247e9b8ba07ade7fbce3e52fd4d48d /source | |
parent | 1472550ba195a3278ee3eb2977515c2c3b62c9ce (diff) | |
parent | 8f9a6b1bab89b9af821b3996514af7de7c8cce7c (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 1 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 14 | ||||
-rw-r--r-- | source/creator/creator_args.c | 11 |
3 files changed, 24 insertions, 2 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 65cb0f956a5..7f97831c6b7 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -88,6 +88,7 @@ const char *WM_init_state_app_template_get(void); void WM_init_state_size_set (int stax, int stay, int sizx, int sizy); void WM_init_state_fullscreen_set(void); void WM_init_state_normal_set(void); +void WM_init_window_focus_set(bool do_it); void WM_init_native_pixels(bool do_it); void WM_init (struct bContext *C, int argc, const char **argv); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index c460ea88474..4363591299e 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -117,8 +117,9 @@ static struct WMInitStruct { int windowstate; WinOverrideFlag override_flag; + bool window_focus; bool native_pixels; -} wm_init_state = {0, 0, 0, 0, GHOST_kWindowStateNormal, 0, true}; +} wm_init_state = {0, 0, 0, 0, GHOST_kWindowStateNormal, 0, true, true}; /* ******** win open & close ************ */ @@ -671,7 +672,9 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm #ifndef __APPLE__ /* set the state here, so minimized state comes up correct on windows */ - GHOST_SetWindowState(ghostwin, (GHOST_TWindowState)win->windowstate); + if (wm_init_state.window_focus) { + GHOST_SetWindowState(ghostwin, (GHOST_TWindowState)win->windowstate); + } #endif /* until screens get drawn, make it nice gray */ glClearColor(0.55, 0.55, 0.55, 0.0); @@ -1682,6 +1685,8 @@ void wm_ghost_init(bContext *C) if (wm_init_state.native_pixels) { GHOST_UseNativePixels(); } + + GHOST_UseWindowFocus(wm_init_state.window_focus); } } @@ -1961,6 +1966,11 @@ void WM_init_state_normal_set(void) wm_init_state.override_flag |= WIN_OVERRIDE_WINSTATE; } +void WM_init_window_focus_set(bool do_it) +{ + wm_init_state.window_focus = do_it; +} + void WM_init_native_pixels(bool do_it) { wm_init_state.native_pixels = do_it; diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c index 863a88aeb2a..2c80d0205f1 100644 --- a/source/creator/creator_args.c +++ b/source/creator/creator_args.c @@ -504,6 +504,7 @@ static int arg_handle_print_help(int UNUSED(argc), const char **UNUSED(argv), vo BLI_argsPrintArgDoc(ba, "--window-geometry"); BLI_argsPrintArgDoc(ba, "--start-console"); BLI_argsPrintArgDoc(ba, "--no-native-pixels"); + BLI_argsPrintArgDoc(ba, "--no-window-focus"); printf("\n"); printf("Python Options:\n"); @@ -1115,6 +1116,15 @@ static int arg_handle_without_borders(int UNUSED(argc), const char **UNUSED(argv return 0; } +static const char arg_handle_no_window_focus_doc[] = +"\n\tOpen behind other windows and without taking focus." +; +static int arg_handle_no_window_focus(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data)) +{ + WM_init_window_focus_set(false); + return 0; +} + extern bool wm_start_with_console; /* wm_init_exit.c */ static const char arg_handle_start_with_console_doc[] = @@ -1927,6 +1937,7 @@ void main_args_setup(bContext *C, bArgs *ba) BLI_argsAdd(ba, 2, "-p", "--window-geometry", CB(arg_handle_window_geometry), NULL); BLI_argsAdd(ba, 2, "-w", "--window-border", CB(arg_handle_with_borders), NULL); BLI_argsAdd(ba, 2, "-W", "--window-fullscreen", CB(arg_handle_without_borders), NULL); + BLI_argsAdd(ba, 2, NULL, "--no-window-focus", CB(arg_handle_no_window_focus), NULL); BLI_argsAdd(ba, 2, "-con", "--start-console", CB(arg_handle_start_with_console), NULL); BLI_argsAdd(ba, 2, "-R", NULL, CB(arg_handle_register_extension), NULL); BLI_argsAdd(ba, 2, "-r", NULL, CB_EX(arg_handle_register_extension, silent), ba); |