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>2015-06-08 18:25:34 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-06-08 18:27:40 +0300
commit962f764d58847614d083dc382285d997652d6992 (patch)
treef76e59ebafff75b19db8c8ed3ffd2b5ee3e4bdd8 /source/blender/windowmanager/intern/wm_stereo.c
parentf8385de5edd67becf91f09e4974e102450a69238 (diff)
WM: refactor window code for stereo3d
Window copy code made it hard to test fixes.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_stereo.c')
-rw-r--r--source/blender/windowmanager/intern/wm_stereo.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/source/blender/windowmanager/intern/wm_stereo.c b/source/blender/windowmanager/intern/wm_stereo.c
index 60863515dd1..3f80570dd7b 100644
--- a/source/blender/windowmanager/intern/wm_stereo.c
+++ b/source/blender/windowmanager/intern/wm_stereo.c
@@ -448,9 +448,10 @@ static void wm_stereo3d_set_init(bContext *C, wmOperator *op)
int wm_stereo3d_set_exec(bContext *C, wmOperator *op)
{
wmWindowManager *wm = CTX_wm_manager(C);
- wmWindow *win = CTX_wm_window(C);
- const bool is_fullscreen = WM_window_is_fullscreen(win);
- char prev_display_mode = win->stereo3d_format->display_mode;
+ wmWindow *win_src = CTX_wm_window(C);
+ wmWindow *win_dst = NULL;
+ const bool is_fullscreen = WM_window_is_fullscreen(win_src);
+ char prev_display_mode = win_src->stereo3d_format->display_mode;
Stereo3dData *s3dd;
bool ok = true;
@@ -464,14 +465,14 @@ int wm_stereo3d_set_exec(bContext *C, wmOperator *op)
}
s3dd = op->customdata;
- *win->stereo3d_format = s3dd->stereo3d_format;
+ *win_src->stereo3d_format = s3dd->stereo3d_format;
if (prev_display_mode == S3D_DISPLAY_PAGEFLIP &&
- prev_display_mode != win->stereo3d_format->display_mode)
+ prev_display_mode != win_src->stereo3d_format->display_mode)
{
/* in case the hardward supports pageflip but not the display */
- if (wm_window_duplicate_exec(C, op) == OPERATOR_FINISHED) {
- wm_window_close(C, wm, win);
+ if ((win_dst = wm_window_copy_test(C, win_src))) {
+ /* pass */
}
else {
BKE_report(op->reports, RPT_ERROR,
@@ -479,23 +480,22 @@ int wm_stereo3d_set_exec(bContext *C, wmOperator *op)
ok = false;
}
}
- else if (win->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP) {
+ else if (win_src->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP) {
/* pageflip requires a new window to be created with the proper OS flags */
- if (wm_window_duplicate_exec(C, op) == OPERATOR_FINISHED) {
+ if ((win_dst = wm_window_copy_test(C, win_src))) {
if (wm_stereo3d_quadbuffer_supported()) {
- wm_window_close(C, wm, win);
BKE_report(op->reports, RPT_INFO, "Quad-buffer window successfully created");
}
else {
- wmWindow *win_new = wm->windows.last;
- wm_window_close(C, wm, win_new);
- win->stereo3d_format->display_mode = prev_display_mode;
+ wm_window_close(C, wm, win_dst);
+ win_dst = NULL;
+ win_src->stereo3d_format->display_mode = prev_display_mode;
BKE_report(op->reports, RPT_ERROR, "Quad-buffer not supported by the system");
ok = false;
}
}
else {
- win->stereo3d_format->display_mode = prev_display_mode;
+ win_src->stereo3d_format->display_mode = prev_display_mode;
BKE_report(op->reports, RPT_ERROR,
"Failed to create a window compatible with the time sequential display method");
ok = false;
@@ -511,12 +511,16 @@ int wm_stereo3d_set_exec(bContext *C, wmOperator *op)
MEM_freeN(op->customdata);
if (ok) {
+ if (win_dst) {
+ wm_window_close(C, wm, win_src);
+ }
+
WM_event_add_notifier(C, NC_WINDOW, NULL);
return OPERATOR_FINISHED;
}
else {
/* without this, the popup won't be freed freed properly T44688 */
- CTX_wm_window_set(C, win);
+ CTX_wm_window_set(C, win_src);
return OPERATOR_CANCELLED;
}
}