diff options
Diffstat (limited to 'source/blender/windowmanager/intern/wm_window.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 501d448011b..04a236e5d66 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -102,8 +102,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 ************ */ @@ -624,7 +625,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); @@ -809,7 +812,7 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i sizex /= native_pixel_size; sizey /= native_pixel_size; - /* calculate postition */ + /* calculate position */ rcti rect; rect.xmin = x + win_prev->posx - sizex / 2; rect.ymin = y + win_prev->posy - sizey / 2; @@ -1468,7 +1471,7 @@ static int wm_window_timer(const bContext *C) else if (wt->event_type == TIMERAUTOSAVE) wm_autosave_timer(C, wm, wt); else if (wt->event_type == TIMERNOTIFIER) - WM_main_add_notifier(GET_UINT_FROM_POINTER(wt->customdata), NULL); + WM_main_add_notifier(POINTER_AS_UINT(wt->customdata), NULL); else if (win) { wmEvent event; wm_event_init_from_window(win, &event); @@ -1546,6 +1549,8 @@ void wm_ghost_init(bContext *C) if (wm_init_state.native_pixels) { GHOST_UseNativePixels(); } + + GHOST_UseWindowFocus(wm_init_state.window_focus); } } @@ -1598,7 +1603,7 @@ wmTimer *WM_event_add_timer_notifier(wmWindowManager *wm, wmWindow *win, unsigne wt->stime = wt->ltime; wt->timestep = timestep; wt->win = win; - wt->customdata = SET_UINT_IN_POINTER(type); + wt->customdata = POINTER_FROM_UINT(type); wt->flags |= WM_TIMER_NO_FREE_CUSTOM_DATA; BLI_addtail(&wm->timers, wt); @@ -1832,6 +1837,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; |