[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25029] trunk/blender/source: better not process events early, could cause troubles later.
Campbell Barton
ideasman42 at gmail.com
Mon Nov 30 15:10:46 CET 2009
Revision: 25029
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25029
Author: campbellbarton
Date: 2009-11-30 15:10:46 +0100 (Mon, 30 Nov 2009)
Log Message:
-----------
better not process events early, could cause troubles later.
added a function - wm_window_get_size_ghost(), which looks into the ghost window directly so events dont need processing first.
Modified Paths:
--------------
trunk/blender/source/blender/editors/interface/interface.c
trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c
trunk/blender/source/blender/windowmanager/intern/wm_window.c
trunk/blender/source/blender/windowmanager/wm_window.h
trunk/blender/source/creator/creator.c
Modified: trunk/blender/source/blender/editors/interface/interface.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface.c 2009-11-30 13:58:27 UTC (rev 25028)
+++ trunk/blender/source/blender/editors/interface/interface.c 2009-11-30 14:10:46 UTC (rev 25029)
@@ -320,7 +320,11 @@
int startx, starty;
int width, height;
- wm_window_get_size(window, &xmax, &ymax);
+ /* note: this is used for the splash where window bounds event has not been
+ * updated by ghost, get the window bounds from ghost directly */
+
+ // wm_window_get_size(window, &xmax, &ymax);
+ wm_window_get_size_ghost(window, &xmax, &ymax);
ui_bounds_block(block);
Modified: trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c 2009-11-30 13:58:27 UTC (rev 25028)
+++ trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c 2009-11-30 14:10:46 UTC (rev 25029)
@@ -161,10 +161,6 @@
if(wm->windows.first) {
CTX_wm_window_set(C, wm->windows.first);
-
- /* needed to get the right screen size for centering the splash */
- wm_window_process_events(C);
-
WM_operator_name_call(C, "WM_OT_splash", WM_OP_INVOKE_DEFAULT, NULL);
CTX_wm_window_set(C, prevwin);
}
Modified: trunk/blender/source/blender/windowmanager/intern/wm_window.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_window.c 2009-11-30 13:58:27 UTC (rev 25028)
+++ trunk/blender/source/blender/windowmanager/intern/wm_window.c 2009-11-30 14:10:46 UTC (rev 25029)
@@ -936,6 +936,15 @@
*height_r= win->sizey;
}
+/* exceptional case: - splash is called before events are processed
+ * this means we dont actually know the window size so get this from GHOST */
+void wm_window_get_size_ghost(wmWindow *win, int *width_r, int *height_r)
+{
+ GHOST_RectangleHandle bounds= GHOST_GetClientBounds(win->ghostwin);
+ *width_r= GHOST_GetWidthRectangle(bounds);
+ *height_r= GHOST_GetHeightRectangle(bounds);
+}
+
void wm_window_set_size(wmWindow *win, int width, int height)
{
GHOST_SetClientSize(win->ghostwin, width, height);
Modified: trunk/blender/source/blender/windowmanager/wm_window.h
===================================================================
--- trunk/blender/source/blender/windowmanager/wm_window.h 2009-11-30 13:58:27 UTC (rev 25028)
+++ trunk/blender/source/blender/windowmanager/wm_window.h 2009-11-30 14:10:46 UTC (rev 25029)
@@ -50,6 +50,7 @@
void wm_window_lower (wmWindow *win);
void wm_window_set_size (wmWindow *win, int width, int height);
void wm_window_get_size (wmWindow *win, int *width_r, int *height_r);
+void wm_window_get_size_ghost (wmWindow *win, int *width_r, int *height_r);
void wm_window_get_position (wmWindow *win, int *posx_r, int *posy_r);
void wm_window_set_title (wmWindow *win, char *title);
void wm_window_swap_buffers (wmWindow *win);
Modified: trunk/blender/source/creator/creator.c
===================================================================
--- trunk/blender/source/creator/creator.c 2009-11-30 13:58:27 UTC (rev 25028)
+++ trunk/blender/source/creator/creator.c 2009-11-30 14:10:46 UTC (rev 25029)
@@ -890,11 +890,8 @@
WM_exit(C);
}
- if(!G.background && !file_loaded) {
- /* careful, calls wm_window_process_events but seems safe
- * since its called first in WM_main */
+ if(!G.background && !file_loaded)
WM_init_splash(C);
- }
WM_main(C);
More information about the Bf-blender-cvs
mailing list