From aa5138bc1d829cbf6429bfe7642937d348f0a043 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 14 Mar 2008 13:14:21 +0100 Subject: [PATCH] Store phys_screen in SimpleWindow, and resize drawable on window resize --- common/swindow.c | 6 ++++++ common/swindow.h | 1 + 2 files changed, 7 insertions(+) diff --git a/common/swindow.c b/common/swindow.c index 61fe9300a..cd0fa2675 100644 --- a/common/swindow.c +++ b/common/swindow.c @@ -48,6 +48,7 @@ simplewindow_new(Display *disp, int phys_screen, int x, int y, sw->geometry.width = w; sw->geometry.height = h; sw->display = disp; + sw->phys_screen = phys_screen; wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask | EnterWindowMask | LeaveWindowMask | StructureNotifyMask; @@ -107,6 +108,11 @@ simplewindow_resize(SimpleWindow *sw, unsigned int w, unsigned int h) { sw->geometry.width = w; sw->geometry.height = h; + XFreePixmap(sw->display, sw->drawable); + sw->drawable = XCreatePixmap(sw->display, + RootWindow(sw->display, sw->phys_screen), + w, h, + DefaultDepth(sw->display, sw->phys_screen)); return XResizeWindow(sw->display, sw->window, w, h); } diff --git a/common/swindow.h b/common/swindow.h index 8ed6564bc..f0dcc5d2e 100644 --- a/common/swindow.h +++ b/common/swindow.h @@ -28,6 +28,7 @@ typedef struct SimpleWindow { Display *display; + int phys_screen; Window window; Drawable drawable; area_t geometry;