Page MenuHome

UI: Outliner - Remove Hover Highlight When Losing Focus
ClosedPublic

Authored by Harley Acheson (harley) on May 7 2019, 11:41 PM.

Details

Summary

When hovering your mouse over Outliner items the rows will become highlighted. Unfortunately that highlight will quite often remain after you move your mouse entirely out of that editor.

This patch fixes that, but I'm not certain this is the best way. But it is the only way I could find to do so reliably.

Blender does a good job of only directing messages to the Editor that is currently active (under the mouse), but that means there is good notification of "enter" but no reliable way to detect "leave". However, we do draw headers with an inactive color when losing focus. So this patch adds to the Outliner's header "draw" function. It checks that it is not currently active, and if not clears the TSE_HIGHLIGHTED flags from the tree and then tags the main region for redraw.

Diff Detail

Repository
rB Blender

Event Timeline

Brecht Van Lommel (brecht) requested changes to this revision.May 8 2019, 6:36 PM

This is inefficient, it's going to cause an additional redraw every time the outliner header is redrawn.

I suggest to add a void (*deactivate)(struct ScrArea *sa); callback to SpaceType. This would then be called from ED_screen_set_active_region whenever the active area changes.

The outliner would then use this callback and do the same outliner_flag_set and ED_region_tag_redraw.

The file browser has a similar issue by the way (when used as in the Texture Paint workspace), so the same mechanism could be used there.

This revision now requires changes to proceed.May 8 2019, 6:36 PM

I suggest to add a void (*deactivate)(struct ScrArea *sa); callback to SpaceType. This would then be called from ED_screen_set_active_region whenever the active area changes.

Thanks! That is exactly what I want: a "deactivate" event. Will do...

This is inefficient, it's going to cause an additional redraw every time the outliner header is redrawn.

I was careful to only do so when the header was drawn in an inactive state, which happens basically only at deactivation. But I hated that it was dealing with one area's state in a different area's handler.

Your suggestion above is perfect. Thanks again.

This now works as @Brecht Van Lommel (brecht) suggested:

It adds a "deactivate" callback to SpaceType that is called when the active region changes. And it is in there that any leftover hover highlights are removed.

There was one other change needed too though. The code that highlights rows on hover also has to be told not to do so once you drag out of the area. This is because it is highlighting based on the y-position alone so does not take into account that you might have left the area. But this and the above are both required for this to behave as expected.

Looks good, just add static before committing.

source/blender/editors/space_outliner/space_outliner.c
387

This must be static void

This revision is now accepted and ready to land.May 18 2019, 9:57 PM
This revision was automatically updated to reflect the committed changes.