Don't allow native window > 65535 pixels

This commit is contained in:
Alexander Larsson 2009-01-22 14:10:19 +01:00
parent 89f1cb5178
commit 7da48afcaa
2 changed files with 30 additions and 14 deletions

View File

@ -165,14 +165,6 @@ struct _GdkWindowQueueItem
} u;
};
static void
move_resize (GdkWindow *window, GdkRectangle *pos)
{
XMoveResizeWindow (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
pos->x, pos->y, pos->width, pos->height);
}
void
_gdk_window_move_resize_child (GdkWindow *window,
gint x,
@ -182,7 +174,6 @@ _gdk_window_move_resize_child (GdkWindow *window,
{
GdkWindowImplX11 *impl;
GdkWindowObject *obj;
GdkRectangle new_info;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
@ -190,18 +181,32 @@ _gdk_window_move_resize_child (GdkWindow *window,
impl = GDK_WINDOW_IMPL_X11 (GDK_WINDOW_OBJECT (window)->impl);
obj = GDK_WINDOW_OBJECT (window);
if (width > 65535 ||
height > 65535)
{
g_warning ("Native children wider or taller than 65535 pixels are not supported");
if (width > 65535)
width = 65535;
if (height > 65535)
height = 65535;
}
obj->x = x;
obj->y = y;
obj->width = width;
obj->height = height;
new_info.x = obj->x + obj->parent->abs_x;
new_info.y = obj->y + obj->parent->abs_y;
new_info.width = obj->width;
new_info.height = obj->height;
/* We don't really care about origin overflow, because on overflow
the window won't be visible anyway and thus it will be shaped
to nothing */
_gdk_x11_window_tmp_unset_parent_bg (window, TRUE);
move_resize (window, &new_info);
XMoveResizeWindow (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
obj->x + obj->parent->abs_x,
obj->y + obj->parent->abs_y,
width, height);
_gdk_x11_window_tmp_reset_parent_bg (window, TRUE);
}

View File

@ -778,6 +778,17 @@ _gdk_window_impl_new (GdkWindow *window,
g_object_ref (draw_impl->colormap);
}
if (private->width > 65535 ||
private->height > 65535)
{
g_warning ("Native Windows wider or taller than 65535 pixels are not supported");
if (private->width > 65535)
private->width = 65535;
if (private->height > 65535)
private->height = 65535;
}
xid = draw_impl->xid = XCreateWindow (xdisplay, xparent,
private->x + private->parent->abs_x,
private->y + private->parent->abs_y,