Merge remote-tracking branch 'origin/master' into blender2.8
[blender.git] / source / blender / editors / screen / screen_edit.c
index 5cd0d33c3652951e2bc8d237ebaa007981844f0e..8f9ce329231a5beabffbb8a8b673b7c25154a606 100644 (file)
@@ -1069,6 +1069,9 @@ static void region_cursor_set(wmWindow *win, int swinid, int swin_changed)
                for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
                        if (ar->swinid == swinid) {
                                if (swin_changed || (ar->type && ar->type->event_cursor)) {
+                                       if (WM_manipulatormap_cursor_set(ar->manipulator_map, win)) {
+                                               return;
+                                       }
                                        ED_region_cursor_set(win, sa, ar);
                                }
                                return;
@@ -1274,25 +1277,28 @@ void ED_screens_initialize(wmWindowManager *wm)
 void ED_region_exit(bContext *C, ARegion *ar)
 {
        wmWindowManager *wm = CTX_wm_manager(C);
+       wmWindow *win = CTX_wm_window(C);
        ARegion *prevar = CTX_wm_region(C);
 
        if (ar->type && ar->type->exit)
                ar->type->exit(wm, ar);
 
        CTX_wm_region_set(C, ar);
+
        WM_event_remove_handlers(C, &ar->handlers);
+       WM_event_modal_handler_region_replace(win, ar, NULL);
        if (ar->swinid) {
-               wm_subwindow_close(CTX_wm_window(C), ar->swinid);
+               wm_subwindow_close(win, ar->swinid);
                ar->swinid = 0;
        }
-       
+
        if (ar->headerstr) {
                MEM_freeN(ar->headerstr);
                ar->headerstr = NULL;
        }
        
        if (ar->regiontimer) {
-               WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), ar->regiontimer);
+               WM_event_remove_timer(wm, win, ar->regiontimer);
                ar->regiontimer = NULL;
        }
 
@@ -1302,6 +1308,7 @@ void ED_region_exit(bContext *C, ARegion *ar)
 void ED_area_exit(bContext *C, ScrArea *sa)
 {
        wmWindowManager *wm = CTX_wm_manager(C);
+       wmWindow *win = CTX_wm_window(C);
        ScrArea *prevsa = CTX_wm_area(C);
        ARegion *ar;
 
@@ -1309,10 +1316,13 @@ void ED_area_exit(bContext *C, ScrArea *sa)
                sa->type->exit(wm, sa);
 
        CTX_wm_area_set(C, sa);
+
        for (ar = sa->regionbase.first; ar; ar = ar->next)
                ED_region_exit(C, ar);
 
        WM_event_remove_handlers(C, &sa->handlers);
+       WM_event_modal_handler_area_replace(win, sa, NULL);
+
        CTX_wm_area_set(C, prevsa);
 }