Module: wine Branch: master Commit: c24e48d937cfd0000a22af555a920ea7fab71d7b URL: http://source.winehq.org/git/wine.git/?a=commit;h=c24e48d937cfd0000a22af555a...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Mon Dec 14 20:49:53 2009 +0100
wined3d: Filter window messages generated by switching to fullscreen and back.
---
dlls/wined3d/swapchain.c | 22 ++++++++++++++++++++-- dlls/wined3d/wined3d_private.h | 1 + 2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 705a002..91791de 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -580,6 +580,7 @@ void swapchain_setup_fullscreen_window(IWineD3DSwapChainImpl *swapchain, UINT w, { IWineD3DDeviceImpl *device = swapchain->device; HWND window = swapchain->win_handle; + BOOL filter_messages; LONG style, exstyle;
TRACE("Setting up window %p for fullscreen mode.\n", window); @@ -599,15 +600,21 @@ void swapchain_setup_fullscreen_window(IWineD3DSwapChainImpl *swapchain, UINT w, TRACE("Old style was %08x, %08x, setting to %08x, %08x.\n", device->style, device->exStyle, style, exstyle);
+ filter_messages = swapchain->filter_messages; + swapchain->filter_messages = TRUE; + SetWindowLongW(window, GWL_STYLE, style); SetWindowLongW(window, GWL_EXSTYLE, exstyle); SetWindowPos(window, HWND_TOP, 0, 0, w, h, SWP_FRAMECHANGED | SWP_SHOWWINDOW); + + swapchain->filter_messages = filter_messages; }
void swapchain_restore_fullscreen_window(IWineD3DSwapChainImpl *swapchain) { IWineD3DDeviceImpl *device = swapchain->device; HWND window = swapchain->win_handle; + BOOL filter_messages; LONG style, exstyle;
if (!device->style && !device->exStyle) return; @@ -618,6 +625,9 @@ void swapchain_restore_fullscreen_window(IWineD3DSwapChainImpl *swapchain) style = GetWindowLongW(window, GWL_STYLE); exstyle = GetWindowLongW(window, GWL_EXSTYLE);
+ filter_messages = swapchain->filter_messages; + swapchain->filter_messages = TRUE; + /* Only restore the style if the application didn't modify it during the * fullscreen phase. Some applications change it before calling Reset() * when switching between windowed and fullscreen modes (HL2), some @@ -627,12 +637,13 @@ void swapchain_restore_fullscreen_window(IWineD3DSwapChainImpl *swapchain) SetWindowLongW(window, GWL_STYLE, device->style); SetWindowLongW(window, GWL_EXSTYLE, device->exStyle); } + SetWindowPos(window, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER); + + swapchain->filter_messages = filter_messages;
/* Delete the old values. */ device->style = 0; device->exStyle = 0; - - SetWindowPos(window, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER); }
@@ -965,6 +976,13 @@ void get_drawable_size_swapchain(struct wined3d_context *context, UINT *width, U LRESULT swapchain_process_message(IWineD3DSwapChainImpl *swapchain, HWND window, UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc) { + if (swapchain->filter_messages) + { + TRACE("Filtering message: window %p, message %#x, wparam %#lx, lparam %#lx.\n", + window, message, wparam, lparam); + return DefWindowProcW(window, message, wparam, lparam); + } + if (message == WM_DESTROY) { TRACE("unregister window %p.\n", window); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index cd4cf6f..1834c77 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2417,6 +2417,7 @@ struct IWineD3DSwapChainImpl WINED3DFORMAT orig_fmt; WINED3DGAMMARAMP orig_gamma; BOOL render_to_fbo; + BOOL filter_messages;
long prev_time, frames; /* Performance tracking */ unsigned int vSyncCounter;