diff options
author | Uli Schlachter <psychon@znc.in> | 2010-10-25 09:11:05 +0200 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-11-07 12:51:56 +0000 |
commit | 6383e1442cf3918ea71378ce46144e1bb5707882 (patch) | |
tree | 3f5554f5db4b493256d32446aa157fa30293fff2 /boilerplate/cairo-boilerplate-xcb.c | |
parent | daaef055b57a5cd91c0bd9ef2b774e0bce41043d (diff) |
XCB: Check screen size in boilerplate
Trying to create a window for drawing that is larger than the available screen
space is a bad idea. When the test finishes and tries to grab the resulting
image from the X server, the window's area that is outside of the screen will
have undefined content.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'boilerplate/cairo-boilerplate-xcb.c')
-rw-r--r-- | boilerplate/cairo-boilerplate-xcb.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/boilerplate/cairo-boilerplate-xcb.c b/boilerplate/cairo-boilerplate-xcb.c index 0cac82b1..c3b059c1 100644 --- a/boilerplate/cairo-boilerplate-xcb.c +++ b/boilerplate/cairo-boilerplate-xcb.c @@ -248,6 +248,12 @@ _cairo_boilerplate_xcb_create_window (const char *name, xtc->surface = NULL; s = xcb_setup_roots_iterator (xcb_get_setup (c)).data; + if (width > s->width_in_pixels || height > s->height_in_pixels) { + xcb_disconnect (c); + free (xtc); + return NULL; + } + xtc->is_pixmap = FALSE; xtc->drawable = xcb_generate_id (c); cookie = xcb_create_window_checked (c, @@ -319,6 +325,12 @@ _cairo_boilerplate_xcb_create_window_db (const char *name, xtc->surface = NULL; s = xcb_setup_roots_iterator (xcb_get_setup (c)).data; + if (width > s->width_in_pixels || height > s->height_in_pixels) { + xcb_disconnect (c); + free (xtc); + return NULL; + } + xtc->is_pixmap = FALSE; xtc->drawable = xcb_generate_id (c); cookie = xcb_create_window_checked (c, |