switcherPopup: Use this._highlighted to check for reentrancy

Since this._highlighted is always set to the currently highlighted
index, there's no need to save the index to a separate variable. This
obviously depends on getting the new item highlighted as a result of the
item-entered event.

This fixes bugs in situations where the highlighted element changes
after an event that is not calling _onItemEnter, for example after
scrolling or pressing a key. In those cases the _currentItemEntered
variable wouldn't be updated and the old item couldn't be entered
anymore without entering another one before.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/167
This commit is contained in:
Jonas Dreßler 2018-04-25 22:14:57 +02:00 committed by Florian Müllner
parent 07369125b6
commit 5c8f3a65f7

View File

@ -440,10 +440,9 @@ var SwitcherList = GObject.registerClass({
_onItemEnter(index) { _onItemEnter(index) {
// Avoid reentrancy // Avoid reentrancy
if (index != this._currentItemEntered) { if (index !== this._highlighted)
this._currentItemEntered = index;
this._itemEntered(index); this._itemEntered(index);
}
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
} }