Skip to content

Commit f8de74d

Browse files
committed
Keep panel usable over fullscreened window when...
...menu applet is opened by shortcut key until fullscreened window is refocused by user. remove force-show-panel option from menu@cinnamon.org
1 parent 5438bd7 commit f8de74d

File tree

3 files changed

+58
-61
lines changed

3 files changed

+58
-61
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,7 +1280,6 @@ class CinnamonMenuApplet extends Applet.TextIconApplet {
12801280
this.settings.bind("search-filesystem", "searchFilesystem");
12811281
this.contextMenu = null;
12821282
this.lastSelectedCategory = null;
1283-
this.settings.bind("force-show-panel", "forceShowPanel");
12841283

12851284
this.orderDirty = false;
12861285

@@ -1323,9 +1322,6 @@ class CinnamonMenuApplet extends Applet.TextIconApplet {
13231322
_updateKeybinding() {
13241323
Main.keybindingManager.addHotKey("overlay-key-" + this.instance_id, this.overlayKey, Lang.bind(this, function() {
13251324
if (!Main.overview.visible && !Main.expo.visible) {
1326-
if (this.forceShowPanel && !this.isOpen) {
1327-
this.panel.peekPanel();
1328-
}
13291325
this.menu.toggle_with_options(this.enableAnimation);
13301326
}
13311327
}));

files/usr/share/cinnamon/applets/menu@cinnamon.org/settings-schema.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"panel-behave" : {
2121
"type" : "section",
2222
"title" : "Behavior",
23-
"keys" : ["overlay-key", "activate-on-hover", "hover-delay", "force-show-panel", "enable-animation"]
23+
"keys" : ["overlay-key", "activate-on-hover", "hover-delay", "enable-animation"]
2424
},
2525
"menu-layout" : {
2626
"type" : "section",
@@ -155,12 +155,6 @@
155155
"description": "Enable filesystem path entry in search box",
156156
"tooltip": "Allows path entry in the menu search box."
157157
},
158-
"force-show-panel" : {
159-
"type" : "switch",
160-
"default" : true,
161-
"description": "Force the panel to be visible when opening the menu",
162-
"tooltip": "Opening the menu will also show the main panel (which may be auto-hidden)."
163-
},
164158
"activate-on-hover" : {
165159
"type" : "switch",
166160
"default" : false,

js/ui/panel.js

Lines changed: 57 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ const TIME_DELTA = 1500;
3939

4040
const APPLETS_DROP_ANIMATION_TIME = 0.2;
4141

42-
const PANEL_PEEK_TIME = 1500;
43-
4442
const EDIT_MODE_MIN_BOX_SIZE = 25;
4543
const VALID_ICON_SIZE_VALUES = [-1, 0, 16, 22, 24, 32, 48];
4644

@@ -2091,6 +2089,7 @@ Panel.prototype = {
20912089
this._destroyed = false;
20922090
this._positionChanged = false;
20932091
this._monitorsChanged = false;
2092+
this._mouseEntered = null;
20942093
this._signalManager = new SignalManager.SignalManager(null);
20952094
this.height = 0;
20962095
this.margin_top = 0;
@@ -2103,7 +2102,6 @@ Panel.prototype = {
21032102
this._bottomPanelBarrier = 0;
21042103
this._shadowBox = null;
21052104
this._panelZoneSizes = this._createEmptyZoneSizes();
2106-
this._peeking = false;
21072105

21082106
this.themeSettings = new Gio.Settings({ schema_id: 'org.cinnamon.theme' });
21092107

@@ -2373,24 +2371,8 @@ Panel.prototype = {
23732371
return;
23742372
},
23752373

2376-
2374+
/* deprecated */
23772375
peekPanel: function() {
2378-
if (!this._hidden || this._peeking)
2379-
return;
2380-
2381-
if (this._showHideTimer > 0) {
2382-
Mainloop.source_remove(this._showHideTimer);
2383-
this._showHideTimer = 0;
2384-
}
2385-
2386-
this._peeking = true;
2387-
this._showPanel();
2388-
2389-
Mainloop.timeout_add(PANEL_PEEK_TIME, () => {
2390-
this._peeking = false;
2391-
this._updatePanelVisibility();
2392-
return false;
2393-
});
23942376
},
23952377

23962378
/**
@@ -2973,7 +2955,7 @@ Panel.prototype = {
29732955
if (this._positionChanged) {
29742956
panelChanged = true;
29752957
this._positionChanged = false;
2976-
this._hidden = false;
2958+
this._showPanel();
29772959
}
29782960

29792961
// if the monitors changed, force update in case the position needs updating
@@ -3667,6 +3649,8 @@ Panel.prototype = {
36673649

36683650
for (let i = 0; i < global.menuStack.length; i++) {
36693651
let menu = global.menuStack[i];
3652+
if (menu.customStyleClass && menu.customStyleClass.includes("thumbnail"))
3653+
continue;
36703654
if (menu.getPanel() === this.actor) {
36713655
return true;
36723656
}
@@ -3685,7 +3669,8 @@ Panel.prototype = {
36853669
* true = autohide, false = always show, intel = Intelligent
36863670
*/
36873671
_updatePanelVisibility: function() {
3688-
if (this._panelEditMode || this._peeking || this._panelHasOpenMenus())
3672+
this._mouseEntered = this._mouseOnPanel();
3673+
if (this._panelEditMode || this._highlighted || this._panelHasOpenMenus())
36893674
this._shouldShow = true;
36903675
else {
36913676
switch (this._autohideSettings) {
@@ -3742,6 +3727,20 @@ Panel.prototype = {
37423727
} // end of switch on autohidesettings
37433728
}
37443729

3730+
const focusedWindow = global.display.get_focus_window();
3731+
if (focusedWindow && focusedWindow.is_fullscreen() && focusedWindow.get_monitor() === this.monitorIndex
3732+
&& this._panelHasOpenMenus()) {
3733+
// An applet has been opened by shortcut key over a fullscreened window so remove
3734+
// focus from fullscreened window so that chrome remains visible until fullscreened
3735+
// window is focused again by user.
3736+
this._focusDesktop();
3737+
} else if (focusedWindow && focusedWindow.get_monitor() !== this.monitorIndex
3738+
&& global.display.get_monitor_in_fullscreen(this.monitorIndex) && this._panelHasOpenMenus()) {
3739+
// Focused window is on other monitor but this monitor has a fullscreened window so
3740+
// remove focus from other window so that chrome remains visible until a window is focused
3741+
this._focusDesktop();
3742+
}
3743+
37453744
this._queueShowHidePanel();
37463745
},
37473746

@@ -3774,30 +3773,43 @@ Panel.prototype = {
37743773
}
37753774
},
37763775

3777-
_enterPanel: function(actor=null, event=null) {
3778-
this._mouseEntered = true;
3779-
this._updatePanelVisibility();
3780-
},
3776+
_focusDesktop: function() {
3777+
const windows = global.display.list_windows(0);
37813778

3782-
_leavePanel:function(actor=null, event=null) {
3783-
if (event !== null && this._eventOnPanelStrip(...event.get_coords())) {
3784-
return;
3779+
for (let i = 0; i < windows.length; i++) {
3780+
let window = windows[i];
3781+
if (window.get_window_type() === Meta.WindowType.DESKTOP && window.get_monitor() === this.monitorIndex) {
3782+
window.activate(global.display.get_current_time());
3783+
return;
3784+
}
37853785
}
3786+
},
37863787

3787-
this._mouseEntered = false;
3788-
this._updatePanelVisibility();
3788+
_mouseOnPanel: function() {
3789+
this.actor.sync_hover();
3790+
const [x, y] = global.get_pointer();
3791+
3792+
return (this.actor.x <= x && x <= this.actor.x + this.actor.width &&
3793+
this.actor.y <= y && y <= this.actor.y + this.actor.height);
37893794
},
37903795

3791-
_eventOnPanelStrip: function(x, y) {
3792-
switch (this.panelPosition) {
3793-
case PanelLoc.top:
3794-
return y === this.monitor.y;
3795-
case PanelLoc.bottom:
3796-
return y === this.monitor.y + this.monitor.height - 1;
3797-
case PanelLoc.left:
3798-
return x === this.monitor.x;
3799-
case PanelLoc.right:
3800-
return x === this.monitor.x + this.monitor.width - 1;
3796+
_enterPanel: function(actor=null, event=null) {
3797+
if (!this._mouseEntered) {
3798+
this._updatePanelVisibility();
3799+
}
3800+
},
3801+
3802+
_leavePanel:function(actor=null, event=null) {
3803+
// Panel gives false leave-event's when mouse is still on panel so we determine this._mouseEntered
3804+
// manually with this._mouseOnPanel() in this._updatePanelVisibility()
3805+
3806+
if (this._mouseEntered) {
3807+
this._updatePanelVisibility();
3808+
if (this.isHideable() && event !== null && this._mouseOnPanel()) {
3809+
// Since we get false leave-event's and reported mouse position is often still
3810+
// on panel even if left, we check again a short while later to make sure.
3811+
setTimeout(this._updatePanelVisibility.bind(this), 250);
3812+
}
38013813
}
38023814
},
38033815

@@ -3809,7 +3821,6 @@ Panel.prototype = {
38093821
*/
38103822
disable: function() {
38113823
this._disabled = true;
3812-
this._leavePanel();
38133824
this.actor.ease({
38143825
opacity: 0,
38153826
duration: AUTOHIDE_ANIMATION_TIME * 1000,
@@ -3904,18 +3915,14 @@ Panel.prototype = {
39043915

39053916
/**
39063917
* _hidePanel:
3907-
* @force (boolean): whether or not to force the hide.
39083918
*
3909-
* This hides the panel unless this._shouldShow is false. This behaviour is
3910-
* overridden if the @force argument is set to true. However, the panel
3911-
* will always not be hidden if a menu is open, regardless of the value of
3912-
* @force.
3919+
* This hides the panel.
39133920
*/
3914-
_hidePanel: function(force) {
3921+
_hidePanel: function() {
39153922
if (this._destroyed) return;
39163923
this._showHideTimer = 0;
39173924

3918-
if ((this._shouldShow && !force) || this._panelHasOpenMenus()) return;
3925+
if (this._hidden) return;
39193926

39203927
// setup panel tween - slide out the monitor edge leaving one pixel
39213928
// if horizontal panel, animation on y. if vertical, animation on x.
@@ -3973,7 +3980,7 @@ Panel.prototype = {
39733980
},
39743981

39753982
getIsVisible: function() {
3976-
return !this._hidden;
3983+
return !this._hidden || this._shouldShow;
39773984
},
39783985

39793986
resetDNDZones: function() {

0 commit comments

Comments
 (0)