diff options
-rw-r--r-- | source/blender/blenkernel/BKE_global.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/blender.c | 2 | ||||
-rw-r--r-- | source/blender/editors/screen/area.c | 1 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_edit.c | 1 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 1 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_screen_types.h | 15 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 84 | ||||
-rw-r--r-- | source/creator/creator.c | 4 |
8 files changed, 82 insertions, 28 deletions
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 1803e9ff7db..c0604a2b213 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -124,7 +124,7 @@ typedef struct Global { /* G.f */ #define G_RENDER_OGL (1 << 0) -#define G_PLAYANIM (1 << 1) +#define G_SWAP_EXCHANGE (1 << 1) /* also uses G_FILE_AUTOPLAY */ #define G_RENDER_SHADOW (1 << 3) #define G_BACKBUFSEL (1 << 4) diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 6f88d3381a9..ae18a75daa0 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -360,6 +360,8 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename) /* special cases, override loaded flags: */ if (G.f & G_DEBUG) bfd->globalf |= G_DEBUG; else bfd->globalf &= ~G_DEBUG; + if (G.f & G_SWAP_EXCHANGE) bfd->globalf |= G_SWAP_EXCHANGE; + else bfd->globalf &= ~G_SWAP_EXCHANGE; if ((U.flag & USER_DONT_DOSCRIPTLINKS)) bfd->globalf &= ~G_DOSCRIPTLINKS; diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 5aa8a5b466b..d6235384e6e 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -233,6 +233,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar) ED_region_pixelspace(ar); ar->do_draw= 0; + ar->swap= WIN_BACK_OK; } /* ********************************** diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index d78fdbbae6e..da03ba13554 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -990,6 +990,7 @@ void ED_screen_draw(wmWindow *win) if(G.f & G_DEBUG) printf("draw screen\n"); win->screen->do_draw= 0; + win->screen->swap= WIN_BACK_OK; } /* make this screen usable */ diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 4fc64782fe8..d828c0c35d5 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -2048,7 +2048,6 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) // if (v3d->flag2 & V3D_DISPGP) // draw_gpencil_3dview(ar, 0); - if(!(G.f & G_PLAYANIM)) drawcursor(scene, ar, v3d); if(U.uiflag & USER_SHOW_ROTVIEWICON) draw_view_axis(v3d); else diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index 454ebd4873e..5f49e0ffeee 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -55,7 +55,8 @@ typedef struct bScreen { short do_draw; /* notifier for drawing edges */ short do_refresh; /* notifier for scale screen, changed screen, etc */ short do_gesture; /* notifier for gesture draw. */ - short pad[3]; + short swap; /* indicator to survive swap-exchange systems */ + short pad[2]; short mainwin; /* screensize subwindow, for screenedges and global menus */ short subwinactive; /* active subwindow */ @@ -136,7 +137,7 @@ typedef struct ARegion { float fsize; /* current split size in float */ short do_draw; /* private, cached notifier events */ - short pad; + short swap; /* private, indicator to survive swap-exchange */ int pad1; struct ARegionType *type; /* callbacks for this region type */ @@ -149,6 +150,11 @@ typedef struct ARegion { void *regiondata; /* XXX 2.50, need spacedata equivalent? */ } ARegion; +/* swap */ +#define WIN_BACK_OK 1 +#define WIN_FRONT_OK 2 +#define WIN_EQUAL 3 + /* area->flag */ #define HEADER_NO_PULLDOWN 1 #define AREA_FLAG_DRAWJOINTO 2 @@ -168,11 +174,6 @@ typedef struct ARegion { #define SCREENFULL 1 #define SCREENAUTOPLAY 2 -/* sa->win_swap */ -#define WIN_FRONT_OK 1 -#define WIN_BACK_OK 2 -#define WIN_EQUAL 3 - /* Panel->snap - for snapping to screen edges */ #define PNL_SNAP_NONE 0 #define PNL_SNAP_TOP 1 diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 161ab66f3fd..6a8895f2f67 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -199,6 +199,68 @@ void wm_event_do_notifiers(bContext *C) CTX_wm_window_set(C, NULL); } +/* ********************* drawing, swap ****************** */ + +static void wm_paintcursor_draw(bContext *C) +{ + wmWindowManager *wm= CTX_wm_manager(C); + + if(wm->paintcursors.first) { + wmWindow *win= CTX_wm_window(C); + wmPaintCursor *pc; + + for(pc= wm->paintcursors.first; pc; pc= pc->next) { + if(pc->poll(C)) { + ARegion *ar= CTX_wm_region(C); + pc->draw(C, win->eventstate->x - ar->winrct.xmin, win->eventstate->y - ar->winrct.ymin); + } + } + } +} + +static void wm_window_swap_exchange(bContext *C, wmWindow *win) +{ + ARegion *ar; + ScrArea *sa; + + if(win->screen->swap==WIN_FRONT_OK) { + ED_screen_draw(win); + win->screen->swap= WIN_EQUAL; + } + else if(win->screen->swap==WIN_BACK_OK) { + win->screen->swap= WIN_FRONT_OK; + } + + for(sa= win->screen->areabase.first; sa; sa= sa->next) { + + CTX_wm_area_set(C, sa); + + for(ar=sa->regionbase.first; ar; ar= ar->next) { + if(ar->swinid) { + if(ar->swap == WIN_BACK_OK) { + ar->swap = WIN_FRONT_OK; + } + else if(ar->swap == WIN_FRONT_OK) { + CTX_wm_region_set(C, ar); + + ED_region_do_draw(C, ar); + if(win->screen->subwinactive==ar->swinid) + wm_paintcursor_draw(C); + + ar->swap = WIN_EQUAL; + + CTX_wm_region_set(C, NULL); + printf("draws swap exchange %d\n", ar->swinid); + } + } + } + + CTX_wm_area_set(C, NULL); + } + + wm_window_swap_buffers(win); +} + /* mark area-regions to redraw if overlapped with rect */ static void wm_flush_regions_down(bScreen *screen, rcti *dirty) { @@ -277,23 +339,6 @@ static int wm_draw_update_test_window(wmWindow *win) return 0; } -static void wm_paintcursor_draw(bContext *C) -{ - wmWindowManager *wm= CTX_wm_manager(C); - - if(wm->paintcursors.first) { - wmWindow *win= CTX_wm_window(C); - wmPaintCursor *pc; - - for(pc= wm->paintcursors.first; pc; pc= pc->next) { - if(pc->poll(C)) { - ARegion *ar= CTX_wm_region(C); - pc->draw(C, win->eventstate->x - ar->winrct.xmin, win->eventstate->y - ar->winrct.ymin); - } - } - } -} - void wm_draw_update(bContext *C) { wmWindowManager *wm= CTX_wm_manager(C); @@ -355,7 +400,10 @@ void wm_draw_update(bContext *C) if(win->screen->do_gesture) wm_gesture_draw(win); - wm_window_swap_buffers(win); + if(G.f & G_SWAP_EXCHANGE) + wm_window_swap_exchange(C, win); + else + wm_window_swap_buffers(win); CTX_wm_window_set(C, NULL); } diff --git a/source/creator/creator.c b/source/creator/creator.c index 1c1b5c3f240..5a70b033f84 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -439,7 +439,9 @@ int main(int argc, char **argv) printf("argv[%d] = %s\n", i, argv[i]); } break; - + case 'E': + G.f |= G_SWAP_EXCHANGE; + break; case 'w': /* with borders XXX OLD CRUFT!*/ break; |