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:
Diffstat (limited to 'source/blender/windowmanager/intern/wm_window.c')
-rw-r--r--source/blender/windowmanager/intern/wm_window.c124
1 files changed, 78 insertions, 46 deletions
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 4f7e5ab75b3..d11d88db147 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -107,25 +107,25 @@ static struct WMInitStruct {
/* XXX this one should correctly check for apple top header...
* done for Cocoa : returns window contents (and not frame) max size*/
-void wm_get_screensize(int *width_r, int *height_r)
+void wm_get_screensize(int *r_width, int *r_height)
{
unsigned int uiwidth;
unsigned int uiheight;
GHOST_GetMainDisplayDimensions(g_system, &uiwidth, &uiheight);
- *width_r = uiwidth;
- *height_r = uiheight;
+ *r_width = uiwidth;
+ *r_height = uiheight;
}
/* size of all screens (desktop), useful since the mouse is bound by this */
-void wm_get_desktopsize(int *width_r, int *height_r)
+void wm_get_desktopsize(int *r_width, int *r_height)
{
unsigned int uiwidth;
unsigned int uiheight;
GHOST_GetAllDisplayDimensions(g_system, &uiwidth, &uiheight);
- *width_r = uiwidth;
- *height_r = uiheight;
+ *r_width = uiwidth;
+ *r_height = uiheight;
}
/* keeps offset and size within monitor bounds */
@@ -206,12 +206,13 @@ void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
wm_event_free_all(win);
wm_subwindows_free(win);
-
- if (win->drawdata)
- MEM_freeN(win->drawdata);
-
+
+ wm_draw_data_free(win);
+
wm_ghostwindow_destroy(win);
-
+
+ MEM_freeN(win->stereo3d_format);
+
MEM_freeN(win);
}
@@ -236,32 +237,60 @@ wmWindow *wm_window_new(bContext *C)
BLI_addtail(&wm->windows, win);
win->winid = find_free_winid(wm);
+ win->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Stereo 3D Format (window)");
+
return win;
}
/* part of wm_window.c api */
-wmWindow *wm_window_copy(bContext *C, wmWindow *winorig)
+wmWindow *wm_window_copy(bContext *C, wmWindow *win_src)
{
- wmWindow *win = wm_window_new(C);
+ wmWindow *win_dst = wm_window_new(C);
- win->posx = winorig->posx + 10;
- win->posy = winorig->posy;
- win->sizex = winorig->sizex;
- win->sizey = winorig->sizey;
+ win_dst->posx = win_src->posx + 10;
+ win_dst->posy = win_src->posy;
+ win_dst->sizex = win_src->sizex;
+ win_dst->sizey = win_src->sizey;
/* duplicate assigns to window */
- win->screen = ED_screen_duplicate(win, winorig->screen);
- BLI_strncpy(win->screenname, win->screen->id.name + 2, sizeof(win->screenname));
- win->screen->winid = win->winid;
+ win_dst->screen = ED_screen_duplicate(win_dst, win_src->screen);
+ BLI_strncpy(win_dst->screenname, win_dst->screen->id.name + 2, sizeof(win_dst->screenname));
+ win_dst->screen->winid = win_dst->winid;
- win->screen->do_refresh = true;
- win->screen->do_draw = true;
+ win_dst->screen->do_refresh = true;
+ win_dst->screen->do_draw = true;
- win->drawmethod = U.wmdrawmethod;
- win->drawdata = NULL;
-
- return win;
+ win_dst->drawmethod = U.wmdrawmethod;
+
+ BLI_listbase_clear(&win_dst->drawdata);
+
+ *win_dst->stereo3d_format = *win_src->stereo3d_format;
+
+ return win_dst;
+}
+
+/**
+ * A higher level version of copy that tests the new window can be added.
+ * (called from the operator directly)
+ */
+wmWindow *wm_window_copy_test(bContext *C, wmWindow *win_src)
+{
+ wmWindowManager *wm = CTX_wm_manager(C);
+ wmWindow *win_dst;
+
+ win_dst = wm_window_copy(C, win_src);
+
+ WM_check(C);
+
+ if (win_dst->ghostwin) {
+ WM_event_add_notifier(C, NC_WINDOW | NA_ADDED, NULL);
+ return win_dst;
+ }
+ else {
+ wm_window_close(C, wm, win_dst);
+ return NULL;
+ }
}
/* this is event from ghost, or exit-blender op */
@@ -367,6 +396,10 @@ static void wm_window_add_ghostwindow(wmWindowManager *wm, const char *title, wm
glSettings.numOfAASamples = multisamples;
+ /* a new window is created when pageflip mode is required for a window */
+ if (win->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP)
+ glSettings.flags |= GHOST_glStereoVisual;
+
if (!(U.uiflag2 & USER_OPENGL_NO_WARN_SUPPORT))
glSettings.flags |= GHOST_glWarnSupport;
@@ -446,11 +479,11 @@ void wm_window_add_ghostwindows(wmWindowManager *wm)
if (wm_init_state.size_x == 0) {
wm_get_screensize(&wm_init_state.size_x, &wm_init_state.size_y);
- /* note!, this isnt quite correct, active screen maybe offset 1000s if PX,
- * we'd need a wm_get_screensize like function that gives offset,
- * in practice the window manager will likely move to the correct monitor */
- wm_init_state.start_x = 0;
- wm_init_state.start_y = 0;
+ /* note!, this isnt quite correct, active screen maybe offset 1000s if PX,
+ * we'd need a wm_get_screensize like function that gives offset,
+ * in practice the window manager will likely move to the correct monitor */
+ wm_init_state.start_x = 0;
+ wm_init_state.start_y = 0;
#ifdef WITH_X11 /* X11 */
/* X11, start maximized but use default sane size */
@@ -519,8 +552,7 @@ wmWindow *WM_window_open(bContext *C, const rcti *rect)
win->sizey = BLI_rcti_size_y(rect);
win->drawmethod = U.wmdrawmethod;
- win->drawdata = NULL;
-
+
WM_check(C);
return win;
@@ -606,12 +638,12 @@ void WM_window_open_temp(bContext *C, rcti *position, int type)
/* operator callback */
int wm_window_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
{
- wm_window_copy(C, CTX_wm_window(C));
- WM_check(C);
-
- WM_event_add_notifier(C, NC_WINDOW | NA_ADDED, NULL);
-
- return OPERATOR_FINISHED;
+ wmWindow *win_src = CTX_wm_window(C);
+ bool ok;
+
+ ok = (wm_window_copy_test(C, win_src) != NULL);
+
+ return ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
@@ -1098,10 +1130,10 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
}
-/* This timer system only gives maximum 1 timer event per redraw cycle,
+/**
+ * This timer system only gives maximum 1 timer event per redraw cycle,
* to prevent queues to get overloaded.
- * Timer handlers should check for delta to decide if they just
- * update, or follow real time.
+ * Timer handlers should check for delta to decide if they just update, or follow real time.
* Timer handlers can also set duration to match frames passed
*/
static int wm_window_timer(const bContext *C)
@@ -1132,7 +1164,7 @@ static int wm_window_timer(const bContext *C)
wm_event_init_from_window(win, &event);
event.type = wt->event_type;
- event.val = 0;
+ event.val = KM_NOTHING;
event.keymodifier = 0;
event.custom = EVT_DATA_TIMER;
event.customdata = wt;
@@ -1395,10 +1427,10 @@ void WM_progress_clear(wmWindow *win)
/* ************************************ */
-void wm_window_get_position(wmWindow *win, int *posx_r, int *posy_r)
+void wm_window_get_position(wmWindow *win, int *r_pos_x, int *r_pos_y)
{
- *posx_r = win->posx;
- *posy_r = win->posy;
+ *r_pos_x = win->posx;
+ *r_pos_y = win->posy;
}
void wm_window_set_size(wmWindow *win, int width, int height)