Skip to content

Commit e589d6a

Browse files
committed
menu@cinnamon.org: Handle another condition in the key-press-event
handler. If the search has no results, _setKeyFocusToCurrentCategoryButton() will not do anything useful, leaving this._activeContainer still null. In this case the handler should just return, letting the search entry have the event. This eliminates this warning when using the search feature: Gjs-CRITICAL **: 11:56:45.550: JS ERROR: TypeError: this._activeContainer is null _onMenuKeyPress@/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js:1721:20 Other changes: - Use Clutter.EVENT_STOP/PROPAGATE instead of true/false
1 parent af5f736 commit e589d6a

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

  • files/usr/share/cinnamon/applets/menu@cinnamon.org

files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,7 +1677,7 @@ class CinnamonMenuApplet extends Applet.TextIconApplet {
16771677
let action = global.display.get_keybinding_action(keyCode, modifierState);
16781678

16791679
if (action == Meta.KeyBindingAction.CUSTOM) {
1680-
return true;
1680+
return Clutter.EVENT_STOP;
16811681
}
16821682

16831683
let ctrlKey = modifierState & Clutter.ModifierType.CONTROL_MASK;
@@ -1709,13 +1709,19 @@ class CinnamonMenuApplet extends Applet.TextIconApplet {
17091709
break;
17101710
}
17111711
if (!continueNavigation)
1712-
return true;
1712+
return Clutter.EVENT_STOP;
17131713
}
17141714

17151715
if (this._activeContainer === null) {
17161716
this._setKeyFocusToCurrentCategoryButton();
17171717
}
17181718

1719+
if (this._activeContainer === null) {
1720+
// Likely there are no categories or apps visible due to a bad search, let the key event
1721+
// event continue to the search entry.
1722+
return Clutter.EVENT_PROPAGATE;
1723+
}
1724+
17191725
let iter = this._activeContainer._vis_iter;
17201726
let active = this._activeActor;
17211727
switch (symbol) {
@@ -1771,24 +1777,24 @@ class CinnamonMenuApplet extends Applet.TextIconApplet {
17711777
case Clutter.KEY_KP_Enter:
17721778
if (ctrlKey && this._activeContainer === this.applicationsBox) {
17731779
this.toggleContextMenu(active._delegate);
1774-
return true;
1780+
return Clutter.EVENT_STOP;
17751781
}
17761782
else {
17771783
active._delegate.activate();
1778-
return true;
1784+
return Clutter.EVENT_STOP;
17791785
}
17801786
break;
17811787
case Clutter.KEY_Menu:
17821788
if (this._activeContainer === this.applicationsBox) {
17831789
this.toggleContextMenu(active._delegate);
1784-
return true;
1790+
return Clutter.EVENT_STOP;
17851791
}
17861792
default:
17871793
break;
17881794
}
17891795

17901796
if (!item_actor || item_actor === this.searchEntry) {
1791-
return false;
1797+
return Clutter.EVENT_PROPAGATE;
17921798
}
17931799

17941800
if (item_actor._delegate instanceof CategoryButton)
@@ -1799,7 +1805,7 @@ class CinnamonMenuApplet extends Applet.TextIconApplet {
17991805
this._scrollToButton(item_actor._delegate, this.applicationsScrollView);
18001806

18011807
this._buttonEnterEvent(item_actor._delegate);
1802-
return true;
1808+
return Clutter.EVENT_STOP;
18031809
}
18041810

18051811
_buttonEnterEvent(button) {

0 commit comments

Comments
 (0)