Chris Robinson : winex11: Store a GL-specific drawable with the window.

Alexandre Julliard julliard at winehq.org
Wed Oct 3 06:08:18 CDT 2007


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

Author: Chris Robinson <chris.kcat at gmail.com>
Date:   Tue Sep 25 10:20:58 2007 -0700

winex11: Store a GL-specific drawable with the window.

---

 dlls/winex11.drv/dce.c    |    3 +++
 dlls/winex11.drv/init.c   |    1 +
 dlls/winex11.drv/opengl.c |    2 ++
 dlls/winex11.drv/window.c |   15 +++++++++++++++
 dlls/winex11.drv/x11drv.h |    4 ++++
 5 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/dlls/winex11.drv/dce.c b/dlls/winex11.drv/dce.c
index aa37a4a..222a4d6 100644
--- a/dlls/winex11.drv/dce.c
+++ b/dlls/winex11.drv/dce.c
@@ -151,11 +151,13 @@ static void update_visible_region( struct dce *dce )
     {
         escape.drawable = data->icon_window;
         escape.fbconfig_id = 0;
+        escape.gl_drawable = 0;
     }
     else
     {
         escape.drawable = X11DRV_get_whole_window( top );
         escape.fbconfig_id = X11DRV_get_fbconfig_id( dce->hwnd );
+        escape.gl_drawable = X11DRV_get_gl_drawable( dce->hwnd );
     }
 
     escape.code = X11DRV_SET_DRAWABLE;
@@ -192,6 +194,7 @@ static void release_dce( struct dce *dce )
     SetRect( &escape.dc_rect, 0, 0, virtual_screen_rect.right - virtual_screen_rect.left,
              virtual_screen_rect.bottom - virtual_screen_rect.top );
     escape.fbconfig_id = 0;
+    escape.gl_drawable = 0;
     ExtEscape( dce->hdc, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL );
 }
 
diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c
index 9000d0a..d6c538a 100644
--- a/dlls/winex11.drv/init.c
+++ b/dlls/winex11.drv/init.c
@@ -341,6 +341,7 @@ INT X11DRV_ExtEscape( X11DRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID
                     physDev->drawable = data->drawable;
                     physDev->drawable_rect = data->drawable_rect;
                     physDev->current_pf = pixelformat_from_fbconfig_id( data->fbconfig_id );
+                    physDev->gl_drawable = data->gl_drawable;
                     wine_tsx11_lock();
                     XSetSubwindowMode( gdi_display, physDev->gc, data->mode );
                     wine_tsx11_unlock();
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index e3d3285..14b5a81 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -3308,6 +3308,8 @@ Drawable get_glxdrawable(X11DRV_PDEVICE *physDev)
             ret = physDev->bitmap->glxpixmap;
         }
     }
+    else if(physDev->gl_drawable)
+        ret = physDev->gl_drawable;
     else
         ret = physDev->drawable;
     return ret;
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 122370f..f4be4a5 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -56,6 +56,7 @@ static XContext win_data_context;
 static const char whole_window_prop[] = "__wine_x11_whole_window";
 static const char icon_window_prop[]  = "__wine_x11_icon_window";
 static const char fbconfig_id_prop[]  = "__wine_x11_fbconfig_id";
+static const char gl_drawable_prop[]  = "__wine_x11_gl_drawable";
 static const char managed_prop[]      = "__wine_x11_managed";
 static const char visual_id_prop[]    = "__wine_x11_visual_id";
 
@@ -955,6 +956,7 @@ static struct x11drv_win_data *alloc_win_data( Display *display, HWND hwnd )
         data->whole_window  = 0;
         data->icon_window   = 0;
         data->fbconfig_id   = 0;
+        data->gl_drawable   = 0;
         data->xic           = 0;
         data->managed       = FALSE;
         data->dce           = NULL;
@@ -1260,6 +1262,19 @@ XID X11DRV_get_fbconfig_id( HWND hwnd )
     return data->fbconfig_id;
 }
 
+/***********************************************************************
+ *              X11DRV_get_gl_drawable
+ *
+ * Return the GL drawable for this window.
+ */
+Drawable X11DRV_get_gl_drawable( HWND hwnd )
+{
+    struct x11drv_win_data *data = X11DRV_get_win_data( hwnd );
+
+    if (!data) return (Drawable)GetPropA( hwnd, gl_drawable_prop );
+    return data->gl_drawable;
+}
+
 
 /***********************************************************************
  *		X11DRV_get_ic
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index f61dc98..e26835d 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -139,6 +139,7 @@ typedef struct
     int           exposures;   /* count of graphics exposures operations */
     struct dce   *dce;         /* opaque pointer to DCE */
     int           current_pf;
+    Drawable      gl_drawable;
     XRENDERINFO   xrender;
 } X11DRV_PDEVICE;
 
@@ -486,6 +487,7 @@ struct x11drv_escape_set_drawable
     RECT                     dc_rect;      /* DC rectangle relative to drawable */
     RECT                     drawable_rect;/* Drawable rectangle relative to screen */
     XID                      fbconfig_id;  /* fbconfig id used by the GL drawable */
+    Drawable                 gl_drawable;  /* GL drawable */
 };
 
 struct x11drv_escape_set_dce
@@ -645,6 +647,7 @@ struct x11drv_win_data
     Window      whole_window;   /* X window for the complete window */
     Window      icon_window;    /* X window for the icon */
     XID         fbconfig_id;    /* fbconfig id for the GL drawable this hwnd uses */
+    Drawable    gl_drawable;    /* Optional GL drawable for rendering the client area */
     RECT        window_rect;    /* USER window rectangle relative to parent */
     RECT        whole_rect;     /* X window rectangle for the whole window relative to parent */
     RECT        client_rect;    /* client area relative to whole window */
@@ -660,6 +663,7 @@ struct x11drv_win_data
 extern struct x11drv_win_data *X11DRV_get_win_data( HWND hwnd );
 extern Window X11DRV_get_whole_window( HWND hwnd );
 extern XID X11DRV_get_fbconfig_id( HWND hwnd );
+extern Drawable X11DRV_get_gl_drawable( HWND hwnd );
 extern BOOL X11DRV_is_window_rect_mapped( const RECT *rect );
 extern XIC X11DRV_get_ic( HWND hwnd );
 extern BOOL X11DRV_set_win_format( HWND hwnd, XID fbconfig );




More information about the wine-cvs mailing list