Mesa (mesa_7_5_branch): wgl: Lookup framebuffers by HWND whenever possible.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Fri Jul 3 13:23:01 UTC 2009


Module: Mesa
Branch: mesa_7_5_branch
Commit: cffe7c8bd0397f8d54e2da16a21c7db4345766b8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cffe7c8bd0397f8d54e2da16a21c7db4345766b8

Author: José Fonseca <jfonseca at vmware.com>
Date:   Fri Jul  3 14:21:55 2009 +0100

wgl: Lookup framebuffers by HWND whenever possible.

Some applications create several HDCs for the same window, so spite the WGL
API is geared towards HDCs it is not reliable searching by HDC.

---

 .../state_trackers/wgl/shared/stw_framebuffer.c    |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c
index 7d0e8f4..78a2dbc 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c
@@ -300,8 +300,18 @@ struct stw_framebuffer *
 stw_framebuffer_from_hdc_locked(
    HDC hdc )
 {
+   HWND hwnd;
    struct stw_framebuffer *fb;
 
+   /* 
+    * Some applications create and use several HDCs for the same window, so 
+    * looking up the framebuffer by the HDC is not reliable. Use HWND whenever
+    * possible.
+    */ 
+   hwnd = WindowFromDC(hdc);
+   if(hwnd)
+      return stw_framebuffer_from_hwnd_locked(hwnd);
+   
    for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next)
       if (fb->hDC == hdc)
          break;




More information about the mesa-commit mailing list