Alexandre Julliard : winex11: Keep track of the window colormap and free it on destroy.

Alexandre Julliard julliard at winehq.org
Fri Feb 22 05:49:32 CST 2008


Module: wine
Branch: master
Commit: e9307d09a65c36a76835bd41b3ef2823a9df2bd4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e9307d09a65c36a76835bd41b3ef2823a9df2bd4

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Feb 21 20:23:32 2008 +0100

winex11: Keep track of the window colormap and free it on destroy.

---

 dlls/winex11.drv/window.c |   18 +++++++++++++-----
 dlls/winex11.drv/x11drv.h |    1 +
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 2fc8660..2d93104 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -360,12 +360,13 @@ BOOL X11DRV_set_win_format( HWND hwnd, XID fbconfig_id )
     {
         XSetWindowAttributes attrib;
 
+        data->colormap = XCreateColormap(display, parent, vis->visual,
+                                         (vis->class == PseudoColor ||
+                                          vis->class == GrayScale ||
+                                          vis->class == DirectColor) ?
+                                         AllocAll : AllocNone);
         attrib.override_redirect = True;
-        attrib.colormap = XCreateColormap(display, parent, vis->visual,
-                                          (vis->class == PseudoColor ||
-                                           vis->class == GrayScale ||
-                                           vis->class == DirectColor) ?
-                                          AllocAll : AllocNone);
+        attrib.colormap = data->colormap;
         XInstallColormap(gdi_display, attrib.colormap);
 
         data->gl_drawable = XCreateWindow(display, parent, -w, 0, w, h, 0,
@@ -1294,6 +1295,13 @@ void X11DRV_DestroyWindow( HWND hwnd )
     destroy_whole_window( display, data );
     destroy_icon_window( display, data );
 
+    if (data->colormap)
+    {
+        wine_tsx11_lock();
+        XFreeColormap( display, data->colormap );
+        wine_tsx11_unlock();
+    }
+
     if (thread_data->last_focus == hwnd) thread_data->last_focus = 0;
     if (data->hWMIconBitmap) DeleteObject( data->hWMIconBitmap );
     if (data->hWMIconMask) DeleteObject( data->hWMIconMask);
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 9f60624..ee2cac7 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -665,6 +665,7 @@ struct x11drv_win_data
     Window      whole_window;   /* X window for the complete window */
     Window      client_window;  /* X window for the client area */
     Window      icon_window;    /* X window for the icon */
+    Colormap    colormap;       /* Colormap for this window */
     XID         fbconfig_id;    /* fbconfig id for the GL drawable this hwnd uses */
     Drawable    gl_drawable;    /* Optional GL drawable for rendering the client area */
     Pixmap      pixmap;         /* Base pixmap for if gl_drawable is a GLXPixmap */




More information about the wine-cvs mailing list