Alexandre Julliard : winex11: Add support for performing GL calls on a top-level window DC.

Alexandre Julliard julliard at winehq.org
Wed May 28 14:45:50 CDT 2008


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed May 28 17:52:06 2008 +0200

winex11: Add support for performing GL calls on a top-level window DC.

---

 dlls/winex11.drv/init.c   |    1 +
 dlls/winex11.drv/opengl.c |    2 +-
 dlls/winex11.drv/window.c |   12 ++++++++++--
 dlls/winex11.drv/x11drv.h |    2 ++
 4 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c
index 5e549b9..cc95057 100644
--- a/dlls/winex11.drv/init.c
+++ b/dlls/winex11.drv/init.c
@@ -342,6 +342,7 @@ INT X11DRV_ExtEscape( X11DRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID
                     physDev->current_pf = pixelformat_from_fbconfig_id( data->fbconfig_id );
                     physDev->gl_drawable = data->gl_drawable;
                     physDev->pixmap = data->pixmap;
+                    physDev->gl_copy = data->gl_copy;
                     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 fa81e2e..393c11a 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -2112,7 +2112,7 @@ void flush_gl_drawable(X11DRV_PDEVICE *physDev)
 {
     int w, h;
 
-    if(!physDev->gl_drawable)
+    if (!physDev->gl_copy)
         return;
 
     w = physDev->dc_rect.right - physDev->dc_rect.left;
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 6a5cc6f..e8535bc 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -1747,14 +1747,21 @@ void X11DRV_GetDC( HDC hdc, HWND hwnd, HWND top, const RECT *win_rect,
     escape.fbconfig_id = 0;
     escape.gl_drawable = 0;
     escape.pixmap      = 0;
+    escape.gl_copy     = FALSE;
 
     if (top == hwnd && data && IsIconic( hwnd ) && data->icon_window)
     {
         escape.drawable = data->icon_window;
     }
-    else if (top == hwnd && (flags & DCX_WINDOW))
+    else if (top == hwnd)
     {
-        escape.drawable = data ? data->whole_window : X11DRV_get_whole_window( hwnd );
+        escape.fbconfig_id = data ? data->fbconfig_id : (XID)GetPropA( hwnd, fbconfig_id_prop );
+        /* GL draws to the client area even for window DCs */
+        escape.gl_drawable = data ? data->client_window : X11DRV_get_client_window( hwnd );
+        if (flags & DCX_WINDOW)
+            escape.drawable = data ? data->whole_window : X11DRV_get_whole_window( hwnd );
+        else
+            escape.drawable = escape.gl_drawable;
     }
     else
     {
@@ -1762,6 +1769,7 @@ void X11DRV_GetDC( HDC hdc, HWND hwnd, HWND top, const RECT *win_rect,
         escape.fbconfig_id = data ? data->fbconfig_id : (XID)GetPropA( hwnd, fbconfig_id_prop );
         escape.gl_drawable = data ? data->gl_drawable : (Drawable)GetPropA( hwnd, gl_drawable_prop );
         escape.pixmap      = data ? data->pixmap : (Pixmap)GetPropA( hwnd, pixmap_prop );
+        escape.gl_copy     = (escape.gl_drawable != 0);
         if (flags & DCX_CLIPCHILDREN) escape.mode = ClipByChildren;
     }
 
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 862ac8d..3bfe118 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -139,6 +139,7 @@ typedef struct
     int           current_pf;
     Drawable      gl_drawable;
     Pixmap        pixmap;      /* Pixmap for a GLXPixmap gl_drawable */
+    int           gl_copy;
     XRENDERINFO   xrender;
 } X11DRV_PDEVICE;
 
@@ -497,6 +498,7 @@ struct x11drv_escape_set_drawable
     XID                      fbconfig_id;  /* fbconfig id used by the GL drawable */
     Drawable                 gl_drawable;  /* GL drawable */
     Pixmap                   pixmap;       /* Pixmap for a GLXPixmap gl_drawable */
+    int                      gl_copy;      /* whether the GL contents need explicit copying */
 };
 
 /**************************************************************************




More information about the wine-cvs mailing list