forked from AuroraMiddleware/gtk
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>
This commit is contained in:
parent
d354000680
commit
c8b0a0dea5
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user