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.
This commit is contained in:
José Fonseca
2009-07-03 14:21:55 +01:00
parent 2a2236606f
commit cffe7c8bd0
@@ -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;