Skip to content

Commit 628eaa9

Browse files
lenemterdanirabbit
andauthored
Show Wingpanel in fullscreen (#2429)
Co-authored-by: Danielle Foré <[email protected]>
1 parent 5d82ce2 commit 628eaa9

File tree

4 files changed

+43
-31
lines changed

4 files changed

+43
-31
lines changed

src/InternalUtils.vala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,5 +350,11 @@ namespace Gala {
350350
Clutter.get_default_backend ().get_default_seat ().bell_notify ();
351351
#endif
352352
}
353+
354+
public static bool get_x11_in_fullscreen (Meta.Display display) {
355+
var primary_monitor = display.get_primary_monitor ();
356+
var is_in_fullscreen = display.get_monitor_in_fullscreen (primary_monitor);
357+
return !Meta.Util.is_wayland_compositor () && is_in_fullscreen;
358+
}
353359
}
354360
}

src/ShellClients/HideTracker.vala

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,18 @@ public class Gala.HideTracker : Object {
1515

1616
public Meta.Display display { get; construct; }
1717
public unowned PanelWindow panel { get; construct; }
18-
1918
public Pantheon.Desktop.HideMode hide_mode { get; set; }
2019

20+
private static GLib.Settings behavior_settings;
21+
2122
private Clutter.PanAction pan_action;
2223

2324
private bool hovered = false;
2425

2526
private bool overlap = false;
2627
private bool focus_overlap = false;
2728
private bool focus_maximized_overlap = false;
29+
private bool fullscreen_overlap = false;
2830

2931
private Meta.Window current_focus_window;
3032

@@ -37,6 +39,10 @@ public class Gala.HideTracker : Object {
3739
Object (display: display, panel: panel);
3840
}
3941

42+
static construct {
43+
behavior_settings = new GLib.Settings ("io.elementary.desktop.wm.behavior");
44+
}
45+
4046
construct {
4147
panel.window.unmanaging.connect_after (() => {
4248
// The timeouts hold refs on us so we stay connected to signal handlers that might
@@ -145,6 +151,7 @@ public class Gala.HideTracker : Object {
145151
overlap = false;
146152
focus_overlap = false;
147153
focus_maximized_overlap = false;
154+
fullscreen_overlap = display.get_monitor_in_fullscreen (panel.window.get_monitor ());
148155

149156
foreach (var window in display.get_workspace_manager ().get_active_workspace ().list_windows ()) {
150157
if (window == panel.window) {
@@ -195,16 +202,17 @@ public class Gala.HideTracker : Object {
195202
toggle_display (true);
196203
break;
197204

198-
default:
199-
warning ("HideTracker: unsupported hide mode.");
205+
case NEVER:
206+
toggle_display (fullscreen_overlap);
200207
break;
201208
}
202209
}
203210

204211
private void toggle_display (bool should_hide) {
205212
hovered = panel.window.has_pointer ();
206213

207-
if (should_hide && !hovered && !panel.window.has_focus ()) {
214+
// Showing panels in fullscreen is broken in X11
215+
if (should_hide && !hovered && !panel.window.has_focus () || InternalUtils.get_x11_in_fullscreen (display)) {
208216
trigger_hide ();
209217
} else {
210218
trigger_show ();
@@ -331,7 +339,14 @@ public class Gala.HideTracker : Object {
331339
}
332340

333341
private void on_barrier_triggered () {
334-
trigger_show ();
335-
schedule_update ();
342+
// Showing panels in fullscreen is broken in X11
343+
if (InternalUtils.get_x11_in_fullscreen (display)) {
344+
return;
345+
}
346+
347+
if (hide_mode != NEVER || behavior_settings.get_boolean ("enable-hotcorners-in-fullscreen")) {
348+
trigger_show ();
349+
schedule_update ();
350+
}
336351
}
337352
}

src/ShellClients/PanelWindow.vala

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,21 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
1515

1616
public Pantheon.Desktop.HideMode hide_mode {
1717
get {
18-
return hide_tracker == null ? Pantheon.Desktop.HideMode.NEVER : hide_tracker.hide_mode;
18+
return hide_tracker.hide_mode;
1919
}
2020
set {
21+
hide_tracker.hide_mode = value;
22+
2123
if (value == NEVER) {
22-
hide_tracker = null;
23-
show ();
2424
make_exclusive ();
25-
return;
26-
} else if (hide_tracker == null) {
25+
} else {
2726
unmake_exclusive ();
28-
29-
hide_tracker = new HideTracker (wm.get_display (), this);
30-
hide_tracker.hide.connect (hide);
31-
hide_tracker.show.connect (show);
3227
}
33-
34-
hide_tracker.hide_mode = value;
3528
}
3629
}
3730

3831
private GestureController gesture_controller;
39-
private HideTracker? hide_tracker;
32+
private HideTracker hide_tracker;
4033

4134
private int width = -1;
4235
private int height = -1;
@@ -64,15 +57,9 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
6457
gesture_controller = new GestureController (DOCK, wm);
6558
add_gesture_controller (gesture_controller);
6659

67-
window.display.in_fullscreen_changed.connect (() => {
68-
if (wm.get_display ().get_monitor_in_fullscreen (window.get_monitor ())) {
69-
hide ();
70-
} else if (hide_mode == NEVER) {
71-
show ();
72-
} else {
73-
hide_tracker.update_overlap ();
74-
}
75-
});
60+
hide_tracker = new HideTracker (wm.get_display (), this);
61+
hide_tracker.hide.connect (hide);
62+
hide_tracker.show.connect (show);
7663
}
7764

7865
public Mtk.Rectangle get_custom_window_rect () {
@@ -106,10 +93,6 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
10693
}
10794

10895
private void show () {
109-
if (window.display.get_monitor_in_fullscreen (window.get_monitor ())) {
110-
return;
111-
}
112-
11396
gesture_controller.goto (0);
11497
}
11598

src/WindowManager.vala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
namespace Gala {
2020
public class WindowManagerGala : Meta.Plugin, WindowManager {
2121
private const string OPEN_MULTITASKING_VIEW = "dbus-send --session --dest=org.pantheon.gala --print-reply /org/pantheon/gala org.pantheon.gala.PerformAction int32:1";
22+
private const string OPEN_APPLICATIONS_MENU = "io.elementary.wingpanel --toggle-indicator=app-launcher";
2223

2324
/**
2425
* {@inheritDoc}
@@ -329,6 +330,13 @@ namespace Gala {
329330
});
330331

331332
display.overlay_key.connect (() => {
333+
// Showing panels in fullscreen is broken in X11
334+
if (InternalUtils.get_x11_in_fullscreen (display) &&
335+
behavior_settings.get_string ("overlay-action") == OPEN_APPLICATIONS_MENU
336+
) {
337+
return;
338+
}
339+
332340
launch_action (ActionKeys.OVERLAY_ACTION);
333341
});
334342

0 commit comments

Comments
 (0)