Page MenuHome

UI: Fix Hover Flickering on Selected Items
ClosedPublic

Authored by Harley Acheson (harley) on Tue, Dec 31, 7:29 PM.

Details

Summary

With https://developer.blender.org/D6098 I made some changes to hover behavior. One change was that it showed a hover highlight on items that are also selected. Although I prefer this look, this unfortunately can cause some flickering in some situations:

This because we quite often (necessarily) create, place, and draw buttons without respect to mouse position. So the initial state of buttons might be selected or not, but it is only later that we might determine that it is being hovered by the mouse. In between these times the button could be drawn and will therefore briefly flicker.

The following is an extreme example. While hovering over a selected item, a long press and drag will lose UI_ACTIVE state, without ever leaving the bounds of the control:

There just isn't a way to ensure that UI_ACTIVE and UI_SELECT are always in sync when they should be, throughout the lifetime of a button. This patch changes the behavior back to how it was before D6098 with hover highlight only shown if the button does not also have UI_SELECT.

Diff Detail

Repository
rB Blender

Event Timeline

Indeed - the flickering was annoying. The more stable buttons are nicer, and also have a usability benefit - it only highlights the buttons that are applicable.

This revision is now accepted and ready to land.Wed, Jan 1, 12:24 PM

While the flicker could be resolved, it's a recent change which caused the issue, so reverting seems OK too.

source/blender/editors/interface/interface_widgets.c
2665

It would be good to add a note that active+selected could be supported, if the flickering issue is resolved (referencing this diff).

Just adding a comment and reference to this diff.

@Campbell Barton (campbellbarton) - While the flicker could be resolved, it's a recent change which caused the issue, so reverting seems OK too.

Yes, I'm sure it will turn out to be some simple thing, but I've looked at this until my eyes bled. We set UI_SELECT early and often, but UI_ACTIVE is set so much later and there are lots of times in between when a redraw can occur. Hopefully I (or someone else) will figure it out later though.

I don't consider the occasional flickering to be more than a small annoyance and curiosity. But I'm away from Jan 7th until the 22 and wanted this patch around so that it could be committed afterward, while I am gone, or even now if it is considered important. This way I can think about it less. LOL

@William Reynish (billreynish) - ...and also have a usability benefit - it only highlights the buttons that are applicable.

That could be a way to look at it. My own thoughts on what should be highlighted:

I want to see NO hover highlight if the item is disabled or not applicable, regardless of whether on or off. So no matter what their state they are unchangeable and therefore interactively dead. But I'd like to see hover highlight in other cases. So in the case of a group of on/off toggles I still want to see hover on the items that are "enabled". This is because they are still alive in that they can be turned off again and therefore are interactive.

In the end it is about indicating states that are overlapping: applicable/not applicable, true/false, and hover/not hover. I prefer that hover treat applicable/not applicable as more important than true/false.