summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Zaman <jason@perfinion.com>2018-05-25 11:37:45 +0800
committerJason Zaman <jason@perfinion.com>2018-05-25 23:48:01 +0800
commitc8b0a0dea5cd129d8e023443dde5e44319d4631d (patch)
tree82dbdd8a5467fd7c74b3b7b96c4124c4ee75ebc3
parentd35400068086b89c3841a527824c7da8e663284c (diff)
downloadgtk+-c8b0a0dea5cd129d8e023443dde5e44319d4631d.tar.gz
gtksocket: Adjust X sizes by scale-factor
X uses unscaled sizes, so they must be scaled properly. Otherwise GtkSockets end up twice as big as they should be. Closes: https://bugzilla.gnome.org/show_bug.cgi?id=765327 Signed-off-by: Jason Zaman <jason@perfinion.com>
-rw-r--r--gtk/gtksocket.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/gtk/gtksocket.c b/gtk/gtksocket.c
index 03cbf02543..91abb6a706 100644
--- a/gtk/gtksocket.c
+++ b/gtk/gtksocket.c
@@ -492,26 +492,28 @@ gtk_socket_size_request (GtkSocket *socket)
GdkDisplay *display;
XSizeHints hints;
long supplied;
+ int scale;
display = gtk_widget_get_display (GTK_WIDGET (socket));
gdk_x11_display_error_trap_push (display);
private->request_width = 1;
private->request_height = 1;
-
+ scale = gtk_widget_get_scale_factor (GTK_WIDGET(socket));
+
if (XGetWMNormalHints (GDK_WINDOW_XDISPLAY (private->plug_window),
GDK_WINDOW_XID (private->plug_window),
&hints, &supplied))
{
if (hints.flags & PMinSize)
{
- private->request_width = MAX (hints.min_width, 1);
- private->request_height = MAX (hints.min_height, 1);
+ private->request_width = MAX (hints.min_width / scale, 1);
+ private->request_height = MAX (hints.min_height / scale, 1);
}
else if (hints.flags & PBaseSize)
{
- private->request_width = MAX (hints.base_width, 1);
- private->request_height = MAX (hints.base_height, 1);
+ private->request_width = MAX (hints.base_width / scale, 1);
+ private->request_height = MAX (hints.base_height / scale, 1);
}
}
private->have_size = TRUE;
@@ -573,7 +575,7 @@ gtk_socket_send_configure_event (GtkSocket *socket)
GtkAllocation allocation;
XConfigureEvent xconfigure;
GdkDisplay *display;
- gint x, y;
+ int x, y, scale;
g_return_if_fail (socket->priv->plug_window != NULL);
@@ -593,10 +595,11 @@ gtk_socket_send_configure_event (GtkSocket *socket)
gdk_x11_display_error_trap_pop_ignored (display);
gtk_widget_get_allocation (GTK_WIDGET(socket), &allocation);
- xconfigure.x = x;
- xconfigure.y = y;
- xconfigure.width = allocation.width;
- xconfigure.height = allocation.height;
+ scale = gtk_widget_get_scale_factor (GTK_WIDGET(socket));
+ xconfigure.x = x * scale;
+ xconfigure.y = y * scale;
+ xconfigure.width = allocation.width * scale;
+ xconfigure.height = allocation.height * scale;
xconfigure.border_width = 0;
xconfigure.above = None;