[Bf-blender-cvs] [06c4139a683] master: UI: Remove Hover Highlight When Outliner Loses Focus

Harley Acheson noreply at git.blender.org
Sun May 19 02:12:25 CEST 2019


Commit: 06c4139a68330dc74ec4e87f6b5c5f2b7a25ad74
Author: Harley Acheson
Date:   Sat May 18 17:09:45 2019 -0700
Branches: master
https://developer.blender.org/rB06c4139a68330dc74ec4e87f6b5c5f2b7a25ad74

UI: Remove Hover Highlight When Outliner Loses Focus

This patch removes the hover highlight that can sometimes remain after moving out of the Outliner space

Differential Revision: https://developer.blender.org/D4822

Reviewed by Brecht Van Lommel

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

M	source/blender/blenkernel/BKE_screen.h
M	source/blender/editors/screen/screen_edit.c
M	source/blender/editors/space_outliner/outliner_edit.c
M	source/blender/editors/space_outliner/space_outliner.c

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

diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h
index 93c9c41e482..167fce4406c 100644
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@ -84,6 +84,9 @@ typedef struct SpaceType {
                    struct wmNotifier *wmn,
                    struct Scene *scene);
 
+  /* called when the mouse moves out of the area */
+  void (*deactivate)(struct ScrArea *sa);
+
   /* refresh context, called after filereads, ED_area_tag_refresh() */
   void (*refresh)(const struct bContext *C, struct ScrArea *sa);
 
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 07a87982890..3a90532aa56 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -675,6 +675,12 @@ void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2])
         bool do_draw = false;
 
         for (ar = area_iter->regionbase.first; ar; ar = ar->next) {
+
+          /* call old area's deactivate if assigned */
+          if (ar == old_ar && area_iter->type->deactivate) {
+            area_iter->type->deactivate(area_iter);
+          }
+
           if (ar == old_ar || ar == scr->active_region) {
             do_draw = true;
           }
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 90180c4ea47..c32b2b051f8 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -88,6 +88,11 @@
 
 static int outliner_highlight_update(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
 {
+  /* stop highlighting if out of area */
+  if (!ED_screen_area_active(C)) {
+    return OPERATOR_PASS_THROUGH;
+  }
+
   /* Drag and drop does own highlighting. */
   wmWindowManager *wm = CTX_wm_manager(C);
   if (wm->drags.first) {
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index 4c591a61f67..313e6014b88 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -384,6 +384,14 @@ static void outliner_id_remap(ScrArea *UNUSED(sa), SpaceLink *slink, ID *old_id,
   }
 }
 
+static void outliner_deactivate(struct ScrArea *sa)
+{
+  /* Remove hover highlights */
+  SpaceOutliner *soops = sa->spacedata.first;
+  outliner_flag_set(&soops->tree, TSE_HIGHLIGHTED, false);
+  ED_region_tag_redraw(BKE_area_find_region_type(sa, RGN_TYPE_WINDOW));
+}
+
 /* only called once, from space_api/spacetypes.c */
 void ED_spacetype_outliner(void)
 {
@@ -401,6 +409,7 @@ void ED_spacetype_outliner(void)
   st->keymap = outliner_keymap;
   st->dropboxes = outliner_dropboxes;
   st->id_remap = outliner_id_remap;
+  st->deactivate = outliner_deactivate;
 
   /* regions: main window */
   art = MEM_callocN(sizeof(ARegionType), "spacetype outliner region");



More information about the Bf-blender-cvs mailing list