Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-11-30 17:10:46 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-11-30 17:10:46 +0300
commitb911d83091f607f56f34b0f4e72655f2b6ebbc6b (patch)
tree8166e42cb7ca48b778df9afff49bd79387f85119
parentab4a141560a221860cfce00c878d8fd0cff47b9c (diff)
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.
-rw-r--r--source/blender/editors/interface/interface.c6
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c4
-rw-r--r--source/blender/windowmanager/intern/wm_window.c9
-rw-r--r--source/blender/windowmanager/wm_window.h1
-rw-r--r--source/creator/creator.c5
5 files changed, 16 insertions, 9 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 23ad50d448b..70bef5534a1 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -320,7 +320,11 @@ static void ui_centered_bounds_block(const bContext *C, uiBlock *block)
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);
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index d62ed7dd13a..09eecf2f425 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -161,10 +161,6 @@ void WM_init_splash(bContext *C)
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);
}
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 78d70c96ad6..75325a1d9f9 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -936,6 +936,15 @@ void wm_window_get_size(wmWindow *win, int *width_r, int *height_r)
*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);
diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h
index f0a2c0ec9a9..4328f915101 100644
--- a/source/blender/windowmanager/wm_window.h
+++ b/source/blender/windowmanager/wm_window.h
@@ -50,6 +50,7 @@ void wm_window_raise (wmWindow *win);
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);
diff --git a/source/creator/creator.c b/source/creator/creator.c
index f17cb95fe3f..3a9ee9859e8 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -890,11 +890,8 @@ int main(int argc, char **argv)
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);