Module: wine Branch: master Commit: 4ac1a5ac608bad7111f7cb99170a3be99b5059f0 URL: http://source.winehq.org/git/wine.git/?a=commit;h=4ac1a5ac608bad7111f7cb9917...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Oct 3 11:19:10 2012 +0200
winex11: Allow changing the pixel format of a window from a different thread.
---
dlls/winex11.drv/opengl.c | 47 ++++++-------------------------------------- dlls/winex11.drv/window.c | 2 - dlls/winex11.drv/x11drv.h | 2 - 3 files changed, 7 insertions(+), 44 deletions(-)
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 3e68131..20591e2 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1062,20 +1062,6 @@ static const struct wgl_pixel_format *get_pixel_format(Display *display, int iPi return NULL; }
-static int pixelformat_from_fbconfig_id(XID fbconfig_id) -{ - int i; - - if (!fbconfig_id) return 0; - - for (i = 0; i < nb_pixel_formats; i++) - if (pixel_formats[i].fmt_id == fbconfig_id) return i + 1; - - /* This will happen on hwnds without a pixel format set; it's ok */ - return 0; -} - - /* Mark any allocated context using the glx drawable 'old' to use 'new' */ static void mark_drawable_dirty(Drawable old, Drawable new) { @@ -1182,18 +1168,15 @@ static void free_gl_drawable( struct gl_drawable *gl ) /*********************************************************************** * set_win_format */ -BOOL set_win_format( HWND hwnd, XID fbconfig_id ) +static BOOL set_win_format( HWND hwnd, const struct wgl_pixel_format *format ) { HWND parent = GetAncestor( hwnd, GA_PARENT ); XSetWindowAttributes attrib; struct gl_drawable *gl, *prev; - int format; - - if (!(format = pixelformat_from_fbconfig_id( fbconfig_id ))) return FALSE;
gl = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*gl) ); - gl->format = &pixel_formats[format - 1]; - gl->visual = pglXGetVisualFromFBConfig( gdi_display, gl->format->fbconfig ); + gl->format = format; + gl->visual = pglXGetVisualFromFBConfig( gdi_display, format->fbconfig ); if (!gl->visual) { HeapFree( GetProcessHeap(), 0, gl ); @@ -1289,7 +1272,7 @@ BOOL set_win_format( HWND hwnd, XID fbconfig_id ) return FALSE; }
- TRACE("Created GL drawable 0x%lx, using FBConfigID 0x%lx\n", gl->drawable, fbconfig_id); + TRACE("created GL drawable %lx for win %p format %x\n", gl->drawable, hwnd, format->fmt_id );
XFlush( gdi_display );
@@ -1298,11 +1281,6 @@ BOOL set_win_format( HWND hwnd, XID fbconfig_id ) free_gl_drawable( prev ); XSaveContext( gdi_display, (XID)hwnd, gl_hwnd_context, (char *)gl ); LeaveCriticalSection( &context_section ); - - /* force DCE invalidation */ - SetWindowPos( hwnd, 0, 0, 0, 0, 0, - SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE | - SWP_NOREDRAW | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_STATECHANGED); return TRUE; }
@@ -1577,12 +1555,6 @@ static BOOL glxdrv_wglSetPixelFormat( HDC hdc, int iPixelFormat, const PIXELFORM return prev == iPixelFormat; /* cannot change it if already set */ }
- if(!SendMessageW(hwnd, WM_X11DRV_SET_WIN_FORMAT, fmt->fmt_id, 0)) { - ERR("Couldn't set format of the window, returning failure\n"); - return FALSE; - } - /* physDev->current_pf will be set by the DCE update */ - if (TRACE_ON(wgl)) { int gl_test = 0;
@@ -1598,7 +1570,8 @@ static BOOL glxdrv_wglSetPixelFormat( HDC hdc, int iPixelFormat, const PIXELFORM TRACE(" - DRAWABLE_TYPE 0x%x\n", value); } } - return TRUE; + + return set_win_format( hwnd, fmt ); }
/*********************************************************************** @@ -2879,8 +2852,7 @@ static BOOL X11DRV_wglSetPixelFormatWINE(HDC hdc, int format) return FALSE; }
- return SendMessageW(hwnd, WM_X11DRV_SET_WIN_FORMAT, fmt->fmt_id, 0); - /* DC pixel format will be set by the DCE update */ + return set_win_format( hwnd, fmt ); }
/** @@ -3102,11 +3074,6 @@ struct opengl_funcs *get_glx_driver( UINT version ) return NULL; }
-BOOL set_win_format( HWND hwnd, XID fbconfig_id ) -{ - return FALSE; -} - BOOL has_gl_drawable( HWND hwnd ) { return FALSE; diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index ea9adae..5d7e315 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2430,8 +2430,6 @@ LRESULT CDECL X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) { case WM_X11DRV_ACQUIRE_SELECTION: return X11DRV_AcquireClipboard( hwnd ); - case WM_X11DRV_SET_WIN_FORMAT: - return set_win_format( hwnd, (XID)wp ); case WM_X11DRV_SET_WIN_REGION: if ((data = get_win_data( hwnd ))) { diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index a13d25c..8e114a2 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -517,7 +517,6 @@ extern DWORD EVENT_x11_time_to_win32_time(Time time) DECLSPEC_HIDDEN; enum x11drv_window_messages { WM_X11DRV_ACQUIRE_SELECTION = 0x80001000, - WM_X11DRV_SET_WIN_FORMAT, WM_X11DRV_SET_WIN_REGION, WM_X11DRV_RESIZE_DESKTOP, WM_X11DRV_SET_CURSOR, @@ -568,7 +567,6 @@ extern void release_win_data( struct x11drv_win_data *data ) DECLSPEC_HIDDEN; extern Window X11DRV_get_whole_window( HWND hwnd ) DECLSPEC_HIDDEN; extern XIC X11DRV_get_ic( HWND hwnd ) DECLSPEC_HIDDEN;
-extern BOOL set_win_format( HWND hwnd, XID fbconfig_id ) DECLSPEC_HIDDEN; extern BOOL has_gl_drawable( HWND hwnd ) DECLSPEC_HIDDEN; extern void sync_gl_drawable( HWND hwnd, const RECT *visible_rect, const RECT *client_rect ) DECLSPEC_HIDDEN; extern void destroy_gl_drawable( HWND hwnd ) DECLSPEC_HIDDEN;