Skip to content
Merged
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
24 changes: 22 additions & 2 deletions src/ShellClients/HideTracker.vala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class Gala.HideTracker : Object {
public signal void show ();

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

private static GLib.Settings behavior_settings;

Expand All @@ -37,6 +37,10 @@ public class Gala.HideTracker : Object {

construct {
panel.window.unmanaging.connect_after (() => {
/* The window was unmanaged so the panel will be freed because we only hold a weak reference,
therefore set it to null to avoid a dangling pointer */
panel = null;

// The timeouts hold refs on us so we stay connected to signal handlers that might
// access the panel which was already freed. To prevent that make sure we reset
// the timeouts so that we get freed immediately
Expand All @@ -49,6 +53,10 @@ public class Gala.HideTracker : Object {
unowned var cursor_tracker = display.get_cursor_tracker ();
#endif
cursor_tracker.position_invalidated.connect (() => {
if (panel == null) {
return;
}

var has_pointer = panel.window.has_pointer ();

if (hovered != has_pointer) {
Expand All @@ -72,6 +80,10 @@ public class Gala.HideTracker : Object {

private void on_window_created (Meta.Window new_window) {
InternalUtils.wait_for_window_actor (new_window, (new_window_actor) => {
if (panel == null) {
return;
}

if (!panel.window.is_ancestor_of_transient (new_window_actor.meta_window)) {
return;
}
Expand All @@ -87,6 +99,10 @@ public class Gala.HideTracker : Object {
}

private void check_trigger_conditions () {
if (panel == null) {
return;
}

if (hovered || has_transients || panel.window.has_focus ()) {
trigger_show ();
} else {
Expand Down Expand Up @@ -119,6 +135,10 @@ public class Gala.HideTracker : Object {
}

private void setup_barrier () {
if (panel == null) {
return;
}

var monitor_geom = display.get_monitor_geometry (display.get_primary_monitor ());
var scale = Utils.get_ui_scaling_factor (display, display.get_primary_monitor ());
var offset = Utils.scale_to_int (BARRIER_OFFSET, scale);
Expand Down Expand Up @@ -174,7 +194,7 @@ public class Gala.HideTracker : Object {

private void on_barrier_triggered () {
// Showing panels in fullscreen is broken in X11
if (InternalUtils.get_x11_in_fullscreen (display)) {
if (InternalUtils.get_x11_in_fullscreen (display) || panel == null) {
return;
}

Expand Down