Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/InternalUtils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -350,5 +350,11 @@ namespace Gala {
Clutter.get_default_backend ().get_default_seat ().bell_notify ();
#endif
}

public static bool get_x11_in_fullscreen (Meta.Display display) {
var primary_monitor = display.get_primary_monitor ();
var is_in_fullscreen = display.get_monitor_in_fullscreen (primary_monitor);
return !Meta.Util.is_wayland_compositor () && is_in_fullscreen;
}
}
}
27 changes: 21 additions & 6 deletions src/ShellClients/HideTracker.vala
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ public class Gala.HideTracker : Object {

public Meta.Display display { get; construct; }
public unowned PanelWindow panel { get; construct; }

public Pantheon.Desktop.HideMode hide_mode { get; set; }

private static GLib.Settings behavior_settings;

private Clutter.PanAction pan_action;

private bool hovered = false;

private bool overlap = false;
private bool focus_overlap = false;
private bool focus_maximized_overlap = false;
private bool fullscreen_overlap = false;

private Meta.Window current_focus_window;

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

static construct {
behavior_settings = new GLib.Settings ("io.elementary.desktop.wm.behavior");
}

construct {
panel.window.unmanaging.connect_after (() => {
// The timeouts hold refs on us so we stay connected to signal handlers that might
Expand Down Expand Up @@ -145,6 +151,7 @@ public class Gala.HideTracker : Object {
overlap = false;
focus_overlap = false;
focus_maximized_overlap = false;
fullscreen_overlap = display.get_monitor_in_fullscreen (panel.window.get_monitor ());

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

default:
warning ("HideTracker: unsupported hide mode.");
case NEVER:
toggle_display (fullscreen_overlap);
break;
}
}

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

if (should_hide && !hovered && !panel.window.has_focus ()) {
// Showing panels in fullscreen is broken in X11
if (should_hide && !hovered && !panel.window.has_focus () || InternalUtils.get_x11_in_fullscreen (display)) {
trigger_hide ();
} else {
trigger_show ();
Expand Down Expand Up @@ -331,7 +339,14 @@ public class Gala.HideTracker : Object {
}

private void on_barrier_triggered () {
trigger_show ();
schedule_update ();
// Showing panels in fullscreen is broken in X11
if (InternalUtils.get_x11_in_fullscreen (display)) {
return;
}

if (hide_mode != NEVER || behavior_settings.get_boolean ("enable-hotcorners-in-fullscreen")) {
trigger_show ();
schedule_update ();
}
}
}
33 changes: 8 additions & 25 deletions src/ShellClients/PanelWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,21 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {

public Pantheon.Desktop.HideMode hide_mode {
get {
return hide_tracker == null ? Pantheon.Desktop.HideMode.NEVER : hide_tracker.hide_mode;
return hide_tracker.hide_mode;
}
set {
hide_tracker.hide_mode = value;

if (value == NEVER) {
hide_tracker = null;
show ();
make_exclusive ();
return;
} else if (hide_tracker == null) {
} else {
unmake_exclusive ();

hide_tracker = new HideTracker (wm.get_display (), this);
hide_tracker.hide.connect (hide);
hide_tracker.show.connect (show);
}

hide_tracker.hide_mode = value;
}
}

private GestureController gesture_controller;
private HideTracker? hide_tracker;
private HideTracker hide_tracker;

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

window.display.in_fullscreen_changed.connect (() => {
if (wm.get_display ().get_monitor_in_fullscreen (window.get_monitor ())) {
hide ();
} else if (hide_mode == NEVER) {
show ();
} else {
hide_tracker.update_overlap ();
}
});
hide_tracker = new HideTracker (wm.get_display (), this);
hide_tracker.hide.connect (hide);
hide_tracker.show.connect (show);
}

public Mtk.Rectangle get_custom_window_rect () {
Expand Down Expand Up @@ -106,10 +93,6 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
}

private void show () {
if (window.display.get_monitor_in_fullscreen (window.get_monitor ())) {
return;
}

gesture_controller.goto (0);
}

Expand Down
8 changes: 8 additions & 0 deletions src/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
namespace Gala {
public class WindowManagerGala : Meta.Plugin, WindowManager {
private const string OPEN_MULTITASKING_VIEW = "dbus-send --session --dest=org.pantheon.gala --print-reply /org/pantheon/gala org.pantheon.gala.PerformAction int32:1";
private const string OPEN_APPLICATIONS_MENU = "io.elementary.wingpanel --toggle-indicator=app-launcher";

/**
* {@inheritDoc}
Expand Down Expand Up @@ -329,6 +330,13 @@ namespace Gala {
});

display.overlay_key.connect (() => {
// Showing panels in fullscreen is broken in X11
if (InternalUtils.get_x11_in_fullscreen (display) &&
behavior_settings.get_string ("overlay-action") == OPEN_APPLICATIONS_MENU
) {
return;
}

launch_action (ActionKeys.OVERLAY_ACTION);
});

Expand Down