[Bf-blender-cvs] [0b626703f99] master: Cleanup: internal changes to cursor resetting

Campbell Barton noreply at git.blender.org
Sat Feb 22 00:51:18 CET 2020


Commit: 0b626703f99fb7146915f4be9e7013bae0c64c61
Author: Campbell Barton
Date:   Sat Feb 22 10:41:19 2020 +1100
Branches: master
https://developer.blender.org/rB0b626703f99fb7146915f4be9e7013bae0c64c61

Cleanup: internal changes to cursor resetting

- Move gizmo cursor check into ED_region_cursor_set so the result of
  calling this function is the same as flagging for cursor update.

- Use tagging in ui_popup_block_remove which avoids adding a
  mouse-move event in case the cursor needs to be changed again.

===================================================================

M	source/blender/editors/interface/interface_region_popup.c
M	source/blender/editors/screen/area.c
M	source/blender/editors/screen/screen_edit.c

===================================================================

diff --git a/source/blender/editors/interface/interface_region_popup.c b/source/blender/editors/interface/interface_region_popup.c
index 867ac652505..dee462e929a 100644
--- a/source/blender/editors/interface/interface_region_popup.c
+++ b/source/blender/editors/interface/interface_region_popup.c
@@ -555,9 +555,7 @@ static void ui_popup_block_remove(bContext *C, uiPopupBlockHandle *handle)
 
   /* reset to region cursor (only if there's not another menu open) */
   if (BLI_listbase_is_empty(&sc->regionbase)) {
-    ED_region_cursor_set(win, ctx_sa, ctx_ar);
-    /* in case cursor needs to be changed again */
-    WM_event_add_mousemove(C);
+    ctx_sa->flag |= AREA_FLAG_CURSOR_UPDATE;
   }
 
   if (handle->scrolltimer) {
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index c9e6cd24ac0..26240482e6d 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1869,15 +1869,21 @@ void ED_region_floating_initialize(ARegion *ar)
 
 void ED_region_cursor_set(wmWindow *win, ScrArea *sa, ARegion *ar)
 {
-  if (ar && sa && ar->type && ar->type->cursor) {
-    ar->type->cursor(win, sa, ar);
-  }
-  else {
-    if (WM_cursor_set_from_tool(win, sa, ar)) {
+  if (ar != NULL) {
+    if ((ar->gizmo_map != NULL) && WM_gizmomap_cursor_set(ar->gizmo_map, win)) {
+      return;
+    }
+    if (sa && ar->type && ar->type->cursor) {
+      ar->type->cursor(win, sa, ar);
       return;
     }
-    WM_cursor_set(win, WM_CURSOR_DEFAULT);
   }
+
+  if (WM_cursor_set_from_tool(win, sa, ar)) {
+    return;
+  }
+
+  WM_cursor_set(win, WM_CURSOR_DEFAULT);
 }
 
 /* for use after changing visibility of regions */
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 8e0e8116da2..23a6704a617 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -403,11 +403,6 @@ static void region_cursor_set_ex(wmWindow *win, ScrArea *sa, ARegion *ar, bool s
   BLI_assert(WM_window_get_active_screen(win)->active_region == ar);
   if (sa->flag & AREA_FLAG_CURSOR_UPDATE || swin_changed || (ar->type && ar->type->event_cursor)) {
     sa->flag &= ~AREA_FLAG_CURSOR_UPDATE;
-    if (ar->gizmo_map != NULL) {
-      if (WM_gizmomap_cursor_set(ar->gizmo_map, win)) {
-        return;
-      }
-    }
     ED_region_cursor_set(win, sa, ar);
   }
 }



More information about the Bf-blender-cvs mailing list