2.5
authorTon Roosendaal <ton@blender.org>
Mon, 15 Dec 2008 18:43:18 +0000 (18:43 +0000)
committerTon Roosendaal <ton@blender.org>
Mon, 15 Dec 2008 18:43:18 +0000 (18:43 +0000)
Small improvements;

- switch spacedata now doesn't cause full screen refresh and draw
- cursor switching is not part of SCREEN_CHANGED notifier, this
  makes area dragging ugly.

source/blender/editors/include/ED_screen.h
source/blender/editors/screen/area.c
source/blender/editors/screen/screen_edit.c
source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/intern/wm_window.c

index 2cb394d..8be027d 100644 (file)
@@ -36,6 +36,7 @@
 struct wmWindowManager;
 struct wmWindow;
 struct wmNotifier;
+struct wmEvent;
 struct SpaceType;
 struct AreagionType;
 struct uiBlock;
@@ -65,7 +66,7 @@ void  ED_screen_draw(struct wmWindow *win);
 void   ED_screen_refresh(struct wmWindowManager *wm, struct wmWindow *win);
 void   ED_screen_do_listen(struct wmWindow *win, struct wmNotifier *note);
 bScreen *ED_screen_duplicate(struct wmWindow *win, struct bScreen *sc);
-void   ED_screen_set_subwinactive(struct wmWindow *win);
+void   ED_screen_set_subwinactive(struct wmWindow *win, struct wmEvent *event);
 void   ED_screen_exit(struct bContext *C, struct wmWindow *window, struct bScreen *screen);
 
 void   ED_operatortypes_screen(void);
index 81bb67b..fb1390b 100644 (file)
@@ -538,9 +538,13 @@ static void newspace(bContext *C, ScrArea *sa, int type)
                                slold->regionbase= sa->regionbase;
                                sa->regionbase= sl->regionbase;
                                sl->regionbase.first= sl->regionbase.last= NULL;
+                               
+                               ED_area_initialize(C->wm, C->window, sa);
                        }
                }
                
+               /* tell WM to refresh, cursor types etc */
+               WM_event_add_mousemove(C);
        }
 }
 
@@ -586,7 +590,7 @@ static char *windowtype_pup(void)
 static void spacefunc(struct bContext *C, void *arg1, void *arg2)
 {
        newspace(C, C->area, C->area->butspacetype);
-       WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
+       WM_event_add_notifier(C, WM_NOTE_AREA_REDRAW, 0, NULL);
 }
 
 /* returns offset for next button in header */
index 2cf480d..a05ee3d 100644 (file)
@@ -994,9 +994,6 @@ void ED_screen_refresh(wmWindowManager *wm, wmWindow *win)
 
        if(G.f & G_DEBUG) printf("set screen\n");
        win->screen->do_refresh= 0;
-
-       /* cursor types too */
-       ED_screen_set_subwinactive(win);
 }
 
 /* file read, set all screens, ... */
@@ -1077,15 +1074,15 @@ static void screen_cursor_set(wmWindow *win, wmEvent *event)
 
 
 /* called in wm_event_system.c. sets state var in screen */
-void ED_screen_set_subwinactive(wmWindow *win)
+void ED_screen_set_subwinactive(wmWindow *win, wmEvent *event)
 {
        if(win->screen) {
-               wmEvent *event= win->eventstate;
+               bScreen *scr= win->screen;
                ScrArea *sa;
                ARegion *ar;
-               int oldswin= win->screen->subwinactive;
-               
-               for(sa= win->screen->areabase.first; sa; sa= sa->next) {
+               int oldswin= scr->subwinactive;
+
+               for(sa= scr->areabase.first; sa; sa= sa->next) {
                        if(event->x > sa->totrct.xmin && event->x < sa->totrct.xmax)
                                if(event->y > sa->totrct.ymin && event->y < sa->totrct.ymax)
                                        if(NULL==is_in_area_actionzone(sa, event->x, event->y))
@@ -1094,20 +1091,20 @@ void ED_screen_set_subwinactive(wmWindow *win)
                if(sa) {
                        for(ar= sa->regionbase.first; ar; ar= ar->next) {
                                if(BLI_in_rcti(&ar->winrct, event->x, event->y))
-                                       win->screen->subwinactive= ar->swinid;
+                                       scr->subwinactive= ar->swinid;
                        }
                }
                else
-                       win->screen->subwinactive= win->screen->mainwin;
+                       scr->subwinactive= scr->mainwin;
                
                /* check for redraw headers */
-               if(oldswin!=win->screen->subwinactive) {
+               if(oldswin!=scr->subwinactive) {
 
-                       for(sa= win->screen->areabase.first; sa; sa= sa->next) {
+                       for(sa= scr->areabase.first; sa; sa= sa->next) {
                                int do_draw= 0;
                                
                                for(ar= sa->regionbase.first; ar; ar= ar->next)
-                                       if(ar->swinid==oldswin || ar->swinid==win->screen->subwinactive)
+                                       if(ar->swinid==oldswin || ar->swinid==scr->subwinactive)
                                                do_draw= 1;
                                
                                if(do_draw) {
@@ -1119,14 +1116,14 @@ void ED_screen_set_subwinactive(wmWindow *win)
                }
                
                /* cursors, for time being set always on edges, otherwise aregion doesnt switch */
-               if(win->screen->subwinactive==win->screen->mainwin) {
+               if(scr->subwinactive==scr->mainwin) {
                        screen_cursor_set(win, event);
                }
-               else if(oldswin!=win->screen->subwinactive) {
+               else if(oldswin!=scr->subwinactive) {
                        /* cursor space type switching */
-                       for(sa= win->screen->areabase.first; sa; sa= sa->next) {
+                       for(sa= scr->areabase.first; sa; sa= sa->next) {
                                for(ar= sa->regionbase.first; ar; ar= ar->next) {
-                                       if(ar->swinid==win->screen->subwinactive) {
+                                       if(ar->swinid==scr->subwinactive) {
                                                if(sa->type->cursor)
                                                        sa->type->cursor(win, ar);
                                                else 
index 605d076..aeb3899 100644 (file)
@@ -649,7 +649,7 @@ void wm_event_do_handlers(bContext *C)
                                
                                /* XXX to solve, here screen handlers? */
                                if(!wm_event_always_pass(event))
-                                       ED_screen_set_subwinactive(win);        /* state variables in screen */
+                                       ED_screen_set_subwinactive(win, event); /* state variables in screen */
                                
                                for(sa= win->screen->areabase.first; sa; sa= sa->next) {
                                        if(wm_event_always_pass(event) || wm_event_prev_inside_i(event, &sa->totrct)) {
index 644f1a9..6f723d0 100644 (file)
@@ -413,8 +413,6 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
                                win->eventstate->x= cx;
                                win->eventstate->y= (win->sizey-1) - cy;
                                
-                               ED_screen_set_subwinactive(win);        /* active subwindow in screen */
-                               
                                wm_window_make_drawable(C, win);
                                break;
                        }