summaryrefslogtreecommitdiff
path: root/mate-panel
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2023-10-03 07:35:41 -0400
committerraveit65 <[email protected]>2023-10-05 10:19:47 +0200
commit170842ce7a4aada7730830f75507bd29d1dcc03f (patch)
tree23b1262a9742446658bc51a6f268bffe6e504a68 /mate-panel
parentcf544b717345dc405b2e2f189d53d69a79120e8b (diff)
downloadmate-panel-170842ce7a4aada7730830f75507bd29d1dcc03f.tar.bz2
mate-panel-170842ce7a4aada7730830f75507bd29d1dcc03f.tar.xz
Force-quit/x11: Fix misalignment of popup with multimonitors
*Compute the size of the monitor we are actually showing the popup on *by getting the monitor it is shown on and running gdk_monitor_get_geometry() *This returns application (scaled) pixels not device pixels
Diffstat (limited to 'mate-panel')
-rw-r--r--mate-panel/panel-force-quit.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/mate-panel/panel-force-quit.c b/mate-panel/panel-force-quit.c
index cf9580b1..13b0139f 100644
--- a/mate-panel/panel-force-quit.c
+++ b/mate-panel/panel-force-quit.c
@@ -58,8 +58,12 @@ display_popup_window (GdkScreen *screen)
GtkWidget *image;
GtkWidget *frame;
GtkWidget *label;
- int screen_width, screen_height, scale;
+ int monitor_width, monitor_height;
GtkAllocation allocation;
+ GdkWindow *window;
+ GdkDisplay *display;
+ GdkMonitor *monitor;
+ GdkRectangle geometry;
retval = gtk_window_new (GTK_WINDOW_POPUP);
atk_object_set_role (gtk_widget_get_accessible (retval), ATK_ROLE_ALERT);
@@ -93,15 +97,18 @@ display_popup_window (GdkScreen *screen)
gtk_widget_realize (retval);
- scale = gtk_widget_get_scale_factor (retval);
- screen_width = WidthOfScreen (gdk_x11_screen_get_xscreen (screen));
- screen_height = HeightOfScreen (gdk_x11_screen_get_xscreen (screen));
+ display = gdk_display_get_default();
+ window = gtk_widget_get_window (retval);
+ monitor = gdk_display_get_monitor_at_window (display, window);
+ gdk_monitor_get_geometry (monitor, &geometry);
+ monitor_width = geometry.width;
+ monitor_height = geometry.height;
gtk_widget_get_allocation (retval, &allocation);
gtk_window_move (GTK_WINDOW (retval),
- (screen_width - (allocation.width * scale)) / (2 * scale),
- (screen_height - (allocation.height * scale)) / (2 * scale));
+ monitor_width / 2 - (allocation.width / 2 ),
+ monitor_height / 2 - (allocation.height / 2));
gtk_widget_show (GTK_WIDGET (retval));