Commit 536a6676 authored by Alexander Larsson's avatar Alexander Larsson
Browse files

x11: Also change size & pos on child windows when scale changes

Any native windows need to also change size and position.
We don't change the size of any foreign windows since we
don't generally control these.
parent a0fb6c83
......@@ -1889,34 +1889,71 @@ gdk_window_x11_move_resize (GdkWindow *window,
}
}
static void
set_scale_recursive (GdkWindow *window, int scale)
{
GdkWindow *child;
GList *l;
for (l = window->children; l; l = l->next)
{
child = l->data;
if (child->impl != window->impl)
_gdk_x11_window_set_window_scale (child, scale);
else
set_scale_recursive (child, scale);
}
}
void
_gdk_x11_window_set_window_scale (GdkWindow *window,
int scale)
{
GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
gboolean was_mapped;
GdkWindowImplX11 *impl;
GdkToplevelX11 *toplevel;
GdkWindowHints geom_mask;
was_mapped = GDK_WINDOW_IS_MAPPED (window);
if (was_mapped)
gdk_window_hide (window);
if (window->window_type == GDK_WINDOW_OFFSCREEN)
return;
impl = GDK_WINDOW_IMPL_X11 (window->impl);
impl->window_scale = scale;
toplevel = _gdk_x11_window_get_toplevel (window);
/* These are affected by window scale: */
geom_mask = toplevel->last_geometry_hints_mask &
(GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_BASE_SIZE | GDK_HINT_RESIZE_INC);
if (geom_mask)
gdk_window_set_geometry_hints (window,
&toplevel->last_geometry_hints,
geom_mask);
XResizeWindow (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
window->width * impl->window_scale,
window->height * impl->window_scale);
if (was_mapped)
gdk_window_show (window);
if (toplevel && window->window_type != GDK_WINDOW_FOREIGN)
{
/* These are affected by window scale: */
geom_mask = toplevel->last_geometry_hints_mask &
(GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_BASE_SIZE | GDK_HINT_RESIZE_INC);
if (geom_mask)
gdk_window_set_geometry_hints (window,
&toplevel->last_geometry_hints,
geom_mask);
}
if (window->window_type == GDK_WINDOW_FOREIGN)
XMoveWindow (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
(window->x + window->parent->abs_x) * impl->window_scale,
(window->y + window->parent->abs_y) * impl->window_scale);
else if (WINDOW_IS_TOPLEVEL(window))
XResizeWindow (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
window->width * impl->window_scale,
window->height * impl->window_scale);
else
XMoveResizeWindow (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
(window->x + window->parent->abs_x) * impl->window_scale,
(window->y + window->parent->abs_y) * impl->window_scale,
window->width * impl->window_scale,
window->height * impl->window_scale);
gdk_window_invalidate_rect (window, NULL, TRUE);
set_scale_recursive (window, scale);
}
static gboolean
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment