2.5
authorTon Roosendaal <ton@blender.org>
Sun, 11 Jan 2009 18:35:16 +0000 (18:35 +0000)
committerTon Roosendaal <ton@blender.org>
Sun, 11 Jan 2009 18:35:16 +0000 (18:35 +0000)
Testing commit; this puts back support for swap-exchange graphics
cards, which I had hoped to have faded out... but it appears it
still does it for intel and some atis.

This only swap-exchanges properly for areas/regions, not for
menus or the 'action zone triange'. Let's see if it works!

You enable it with starting with commandline option -E

source/blender/blenkernel/BKE_global.h
source/blender/blenkernel/intern/blender.c
source/blender/editors/screen/area.c
source/blender/editors/screen/screen_edit.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/makesdna/DNA_screen_types.h
source/blender/windowmanager/intern/wm_event_system.c
source/creator/creator.c

index 1803e9ff7dba34bdafd57b533d1ff33a1fe5e41f..c0604a2b213ade79a43c81c0b1a96b334cba7dc3 100644 (file)
@@ -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)
index 6f88d3381a9d750ee2d068d44760557847a6454a..ae18a75daa0c20a35f2a115e91961bfcfa6a8044 100644 (file)
@@ -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;
 
index 5aa8a5b466bf9cd08a99f5bcdc48006627c30aa0..d6235384e6e8e011f31d4dfe9eef96f726c40696 100644 (file)
@@ -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;
 }
 
 /* **********************************
index d78fdbbae6e21092f964bd4a3f99c3b940d19bd7..da03ba135547b13f9f72f75014fc3b9a87fcfeee 100644 (file)
@@ -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 */
index 4fc64782fe891c687723a441e6914ffc29c410e5..d828c0c35d5d7beb82d93b8b29e32f5b78751bdc 100644 (file)
@@ -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    
index 454ebd4873e0b7b33509b41c9ccd4869efff6505..5f49e0ffeee7aa36b4e1d39e3af10061d8bc5b70 100644 (file)
@@ -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
index 161ab66f3fdc31ff59c3035523818afa434817c2..6a8895f2f677301a8bcccd66cc065b70e68f1f89 100644 (file)
@@ -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);
                }
index 1c1b5c3f2409a23125aa240dbae93c8c4befaf61..5a70b033f848e9e1b74c36dbea15ec63e7ae070e 100644 (file)
@@ -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;