[Xfce4-commits] [xfce/xfce4-panel] 03/04: Fix struts on the bottom and right of the screen
noreply at xfce.org
noreply at xfce.org
Sun Dec 2 23:59:39 CET 2018
This is an automated email from the git hooks/post-receive script.
o c h o s i p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/xfce4-panel.
commit 5de1be8280cca97a19f25a85049170bf6e757b4c
Author: Alistair Buxton <a.j.buxton at gmail.com>
Date: Mon Nov 19 04:06:03 2018 +0000
Fix struts on the bottom and right of the screen
We can't use the monitor geometry of a single monitor to calculate
this for two reasons. Both reasons are caused because the struts
are relative to the bottom and right edges of the X11 screen.
If we try to use a single monitor geometry by saying something like
geometry.y + geometry.height, this will fail on at least one monitor
if the bottom edges of the monitors are not aligned.
If we try to calculate the rectangle containing all monitors this
will also fail because the logical X11 screen size can be even larger.
The only way to get this information is to go to raw X11 calls, or
just use the deprecated functions.
Also switch to using alloc instead of base coordinates. When this
function is called, base_x and base_y do not contain correct values.
This has no effect on the code since scale factor is the same for
all monitors under X11, and if it weren't the rest of the code would
likely break anyway.
Fixes bug #14886
---
panel/panel-window.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/panel/panel-window.c b/panel/panel-window.c
index 5b2f26e..cddc94b 100644
--- a/panel/panel-window.c
+++ b/panel/panel-window.c
@@ -1673,11 +1673,10 @@ panel_window_screen_struts_set (PanelWindow *window)
gulong struts[N_STRUTS] = { 0, };
GdkRectangle *alloc = &window->alloc;
GdkMonitor *monitor;
- GdkRectangle geometry;
guint i;
gboolean update_struts = FALSE;
gint n;
- gint scale_factor;
+ gint scale_factor = 1;
const gchar *strut_border[] = { "left", "right", "top", "bottom" };
const gchar *strut_xy[] = { "y", "y", "x", "x" };
@@ -1689,9 +1688,9 @@ panel_window_screen_struts_set (PanelWindow *window)
if (!gtk_widget_get_realized (GTK_WIDGET (window)))
return;
- monitor = gdk_display_get_monitor_at_point (window->display, window->base_x, window->base_y);
- scale_factor = gdk_monitor_get_scale_factor(monitor);
- gdk_monitor_get_geometry(monitor, &geometry);
+ monitor = gdk_display_get_monitor_at_point (window->display, alloc->x, alloc->y);
+ if (monitor)
+ scale_factor = gdk_monitor_get_scale_factor(monitor);
/* set the struts */
/* note that struts are relative to the screen edge! */
@@ -1705,7 +1704,7 @@ panel_window_screen_struts_set (PanelWindow *window)
else if (window->struts_edge == STRUTS_EDGE_BOTTOM)
{
/* the window is snapped on the bottom screen edge */
- struts[STRUT_BOTTOM] = (geometry.height - alloc->y) * scale_factor;
+ struts[STRUT_BOTTOM] = (gdk_screen_get_height(window->screen) - alloc->y) * scale_factor;
struts[STRUT_BOTTOM_START_X] = alloc->x * scale_factor;
struts[STRUT_BOTTOM_END_X] = (alloc->x + alloc->width - 1) * scale_factor;
}
@@ -1719,7 +1718,7 @@ panel_window_screen_struts_set (PanelWindow *window)
else if (window->struts_edge == STRUTS_EDGE_RIGHT)
{
/* the window is snapped on the right screen edge */
- struts[STRUT_RIGHT] = (geometry.width - alloc->x) * scale_factor;
+ struts[STRUT_RIGHT] = (gdk_screen_get_width(window->screen) - alloc->x) * scale_factor;
struts[STRUT_RIGHT_START_Y] = alloc->y * scale_factor;
struts[STRUT_RIGHT_END_Y] = (alloc->y + alloc->height - 1) * scale_factor;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list