Skip to content

Commit 73bfb73

Browse files
authored
BackgroundManager: fix interaction with show-desktop shortcut (#630)
1 parent ed9bd59 commit 73bfb73

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

wingpanel-interface/BackgroundManager.vala

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
11
/*
2-
* Copyright (c) 2011-2015 Wingpanel Developers (http://launchpad.net/wingpanel)
3-
*
4-
* This program is free software; you can redistribute it and/or
5-
* modify it under the terms of the GNU General Public
6-
* License as published by the Free Software Foundation; either
7-
* version 2 of the License, or (at your option) any later version.
8-
*
9-
* This program is distributed in the hope that it will be useful,
10-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12-
* General Public License for more details.
13-
*
14-
* You should have received a copy of the GNU General Public
15-
* License along with this program; if not, write to the
16-
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17-
* Boston, MA 02110-1301 USA.
2+
* SPDX-License-Identifier: GPL-2-or-later
3+
* SPDX-FileCopyrightText: 2011-2015 Wingpanel Developers (http://launchpad.net/wingpanel)
4+
* 2025 elementary, Inc. (https://elementary.io)
185
*/
196

207
public enum BackgroundState {
@@ -39,11 +26,9 @@ public class WingpanelInterface.BackgroundManager : Object {
3926
public int panel_height { private get; construct; }
4027

4128
private ulong wallpaper_hook_id;
42-
29+
private bool showing_desktop = false;
4330
private unowned Meta.Workspace? current_workspace = null;
44-
4531
private BackgroundState current_state = BackgroundState.LIGHT;
46-
4732
private Utils.ColorInformation? bk_color_info = null;
4833

4934
public BackgroundManager (int panel_height) {
@@ -63,8 +48,10 @@ public class WingpanelInterface.BackgroundManager : Object {
6348

6449
private void connect_signals () {
6550
unowned Meta.WorkspaceManager manager = Main.display.get_workspace_manager ();
66-
manager.workspace_switched.connect (() => {
67-
update_current_workspace ();
51+
manager.workspace_switched.connect (() => update_current_workspace ());
52+
manager.showing_desktop_changed.connect (() => {
53+
showing_desktop = !showing_desktop;
54+
check_for_state_change (WALLPAPER_TRANSITION_DURATION);
6855
});
6956

7057
var signal_id = GLib.Signal.lookup ("changed", Main.wm.background_group.get_type ());
@@ -167,6 +154,11 @@ public class WingpanelInterface.BackgroundManager : Object {
167154
* - Else it should be LIGHT.
168155
*/
169156
private void check_for_state_change (uint animation_duration) {
157+
if (showing_desktop && current_state != LIGHT) {
158+
state_changed (current_state = LIGHT, animation_duration);
159+
return;
160+
}
161+
170162
bool has_fullscreen_window = false;
171163
bool has_maximized_window = false;
172164

0 commit comments

Comments
 (0)