diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2024-06-18 12:59:30 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2024-06-18 13:00:30 +0200 |
commit | 141a1820c7ed9af360a40b065c1493c53263b5e4 (patch) | |
tree | 96a397492d931e1cf51a8480f67d32a97a7a130b /src | |
parent | 5ced7b5858c935dc6f00a238298bb35b945ad2d7 (diff) | |
download | arctica-greeter-141a1820c7ed9af360a40b065c1493c53263b5e4.tar.gz arctica-greeter-141a1820c7ed9af360a40b065c1493c53263b5e4.tar.bz2 arctica-greeter-141a1820c7ed9af360a40b065c1493c53263b5e4.zip |
src/: In set_struts(), use already discovered geometry of the primary monitor.
Diffstat (limited to 'src')
-rw-r--r-- | src/main-window.vala | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/src/main-window.vala b/src/main-window.vala index f1d3be8..dff1fa2 100644 --- a/src/main-window.vala +++ b/src/main-window.vala @@ -250,40 +250,43 @@ public class MainWindow : Gtk.Window set_struts (this, MenubarPositions.TOP, ArcticaGreeter.MENUBAR_HEIGHT); } - public static void set_struts(Gtk.Window? window, uint position, long menubar_size) + public void set_struts(Gtk.Window? window, uint position, long menubar_size) { - Gdk.Atom atom; - long struts[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - var screen = window.screen; - Gdk.Monitor mon = screen.get_display().get_primary_monitor(); - Gdk.Rectangle primary_monitor_rect = mon.get_geometry(); - if (!window.get_realized()) { return; } + var screen = window.screen; + + if (primary_monitor == null) { + return; + } + + Gdk.Atom atom; + long struts[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + // Struts dependent on position switch (position) { case MenubarPositions.TOP: - struts[Struts.TOP] = (menubar_size + primary_monitor_rect.y); - struts[Struts.TOP_START] = primary_monitor_rect.x; - struts[Struts.TOP_END] = (primary_monitor_rect.x + primary_monitor_rect.width) - 1; + struts[Struts.TOP] = (menubar_size + primary_monitor.y); + struts[Struts.TOP_START] = primary_monitor.x; + struts[Struts.TOP_END] = (primary_monitor.x + primary_monitor.width) - 1; break; case MenubarPositions.LEFT: - struts[Struts.LEFT] = (primary_monitor_rect.x + menubar_size); - struts[Struts.LEFT_START] = primary_monitor_rect.y; - struts[Struts.LEFT_END] = (primary_monitor_rect.y + primary_monitor_rect.height) - 1; + struts[Struts.LEFT] = (primary_monitor.x + menubar_size); + struts[Struts.LEFT_START] = primary_monitor.y; + struts[Struts.LEFT_END] = (primary_monitor.y + primary_monitor.height) - 1; break; case MenubarPositions.RIGHT: - struts[Struts.RIGHT] = (menubar_size + screen.get_width() - primary_monitor_rect.x - primary_monitor_rect.width); - struts[Struts.RIGHT_START] = primary_monitor_rect.y; - struts[Struts.RIGHT_END] = (primary_monitor_rect.y + primary_monitor_rect.height) - 1; + struts[Struts.RIGHT] = (menubar_size + screen.get_width() - primary_monitor.x - primary_monitor.width); + struts[Struts.RIGHT_START] = primary_monitor.y; + struts[Struts.RIGHT_END] = (primary_monitor.y + primary_monitor.height) - 1; break; case MenubarPositions.BOTTOM: default: - struts[Struts.BOTTOM] = (menubar_size + screen.get_height() - primary_monitor_rect.y - primary_monitor_rect.height); - struts[Struts.BOTTOM_START] = primary_monitor_rect.x; - struts[Struts.BOTTOM_END] = (primary_monitor_rect.x + primary_monitor_rect.width) - 1; + struts[Struts.BOTTOM] = (menubar_size + screen.get_height() - primary_monitor.y - primary_monitor.height); + struts[Struts.BOTTOM_START] = primary_monitor.x; + struts[Struts.BOTTOM_END] = (primary_monitor.x + primary_monitor.width) - 1; break; } |