diff options
author | Emmanuele Bassi <ebassi@gmail.com> | 2018-05-30 10:18:56 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gmail.com> | 2018-05-30 10:18:56 +0000 |
commit | 9ac7f906aae7f9f252988a5a7f294123b622c8c1 (patch) | |
tree | 6bb2e8474200842e0104a30cf51883f95fc57196 | |
parent | e0206cafcdf3c2378c79503f88a156b0a410a9a9 (diff) | |
parent | c8b0a0dea5cd129d8e023443dde5e44319d4631d (diff) | |
download | gtk+-9ac7f906aae7f9f252988a5a7f294123b622c8c1.tar.gz |
Merge branch 'gtksocket-scale-3-22' into 'gtk-3-22'
gtksocket: Adjust X sizes by scale-factor
See merge request GNOME/gtk!164
-rw-r--r-- | gtk/gtksocket.c | 23 |
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; |