From: Ken Thomases Subject: Re: [PATCH 2/2] winemac: Don't pump messages in ChangeDisplaySettings. Message-Id: Date: Thu, 16 Apr 2015 14:46:23 -0500 This hoists some of the knock-on effects of WM_MACDRV_UPDATE_DESKTOP_RECT to the place where it is sent. However, it only does so for one of the two places where it is sent. It is also sent in macdrv_displays_changed() On Apr 16, 2015, at 5:18 AM, Stefan Dösinger wrote: > Same as the previous patch, just for winemac.drv. > > The message ping-pong between the ChangeDisplaySettings calling thread > and the desktop thread is more complicated here than in winex11. The > problem again is that sendMessageTimeout(SMTO_BLOCK) will not process > messages sent by the desktop, leading to a deadlock. Replacing > SendMessageTimeout in the desktop with PostMessage is not an option > either because then messages will be executed in a different order in > the thread that called ChangeDisplaySettings. > > This patch will lead to DISPLAYCHANGE messages being sent on redundant > changes. This matches the behavior of winex11 and happens to fix the > user32/sysparam.ok test, but it fixes it for the wrong reason (the real > problem afaics is that OSX only supports 32 bpp, so no change takes > place although one was requested). I think redundant changes should be > intercepted in user32 before the display driver is called. > --- > dlls/winemac.drv/display.c | 8 ++++++-- > dlls/winemac.drv/window.c | 4 ---- > 2 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/dlls/winemac.drv/display.c b/dlls/winemac.drv/display.c > index 10ecf67..f7ce163 100644 > --- a/dlls/winemac.drv/display.c > +++ b/dlls/winemac.drv/display.c > @@ -564,8 +564,12 @@ better: > size_t width = CGDisplayModeGetWidth(best_display_mode); > size_t height = CGDisplayModeGetHeight(best_display_mode); > > - SendMessageW(GetDesktopWindow(), WM_MACDRV_UPDATE_DESKTOP_RECT, mode_bpp, > - MAKELPARAM(width, height)); > + SendMessageTimeoutW(HWND_BROADCAST, WM_MACDRV_RESET_DEVICE_METRICS, 0, 0, > + SMTO_BLOCK | SMTO_ABORTIFHUNG, 2000, NULL); > + SendMessageTimeoutW(GetDesktopWindow(), WM_MACDRV_UPDATE_DESKTOP_RECT, mode_bpp, > + MAKELPARAM(width, height), SMTO_BLOCK, ~0U, NULL); > + SendMessageTimeoutW(HWND_BROADCAST, WM_MACDRV_DISPLAYCHANGE, mode_bpp, > + MAKELPARAM(width, height), SMTO_BLOCK | SMTO_ABORTIFHUNG, 2000, NULL); > ret = DISP_CHANGE_SUCCESSFUL; > } > else > diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c > index 7a777e6..fa12af5 100644 > --- a/dlls/winemac.drv/window.c > +++ b/dlls/winemac.drv/window.c > @@ -1666,13 +1666,9 @@ LRESULT CDECL macdrv_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) > if (!GetWindowRect(hwnd, ¤t_desktop_rect) || > !CGRectEqualToRect(cgrect_from_rect(current_desktop_rect), new_desktop_rect)) > { > - SendMessageTimeoutW(HWND_BROADCAST, WM_MACDRV_RESET_DEVICE_METRICS, 0, 0, > - SMTO_ABORTIFHUNG, 2000, NULL); > SetWindowPos(hwnd, 0, CGRectGetMinX(new_desktop_rect), CGRectGetMinY(new_desktop_rect), > CGRectGetWidth(new_desktop_rect), CGRectGetHeight(new_desktop_rect), > SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE); > - SendMessageTimeoutW(HWND_BROADCAST, WM_MACDRV_DISPLAYCHANGE, wp, lp, > - SMTO_ABORTIFHUNG, 2000, NULL); > } > } > return 0; > -- > 2.3.4 > > >