[Xfce4-commits] [xfce/xfwm4] 01/01: poswin: Fix position with scale
noreply at xfce.org
noreply at xfce.org
Sat May 4 10:40:55 CEST 2019
This is an automated email from the git hooks/post-receive script.
o l i v i e r 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/xfwm4.
commit 1d82c6b1a1423a3313bbb6f151df4174fd08d2cc
Author: Olivier Fourdan <fourdan at xfce.org>
Date: Sat May 4 10:39:23 2019 +0200
poswin: Fix position with scale
The position/size indicator would be misplaced when a scale is applied.
Take the scale into account to place the indicator on screen.
Signed-off-by: Olivier Fourdan <fourdan at xfce.org>
---
src/poswin.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/poswin.c b/src/poswin.c
index 064eea6..f262e24 100644
--- a/src/poswin.c
+++ b/src/poswin.c
@@ -112,6 +112,7 @@ poswinSetPosition (Poswin * poswin, Client *c)
gchar label[32];
gint x, y, px, py, pw, ph;
gint wsize, hsize;
+ guint scale;
g_return_if_fail (poswin != NULL);
g_return_if_fail (c != NULL);
@@ -141,8 +142,9 @@ poswinSetPosition (Poswin * poswin, Client *c)
gtk_label_set_text (GTK_LABEL (poswin->label), label);
gtk_widget_queue_draw (GTK_WIDGET(poswin));
gtk_window_get_size (GTK_WINDOW (poswin), &pw, &ph);
- px = x + (frameWidth (c) - pw) / 2;
- py = y + (frameHeight (c) - ph) / 2;
+ scale = gdk_window_get_scale_factor (gtk_widget_get_window (GTK_WIDGET (poswin)));
+ px = (x + (frameWidth (c) - pw * scale) / 2) / scale;
+ py = (y + (frameHeight (c) - ph * scale) / 2) / scale;
gtk_window_move (GTK_WINDOW (poswin), px, py);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list