Re: [PATCH 2/2] winemac: Don't pump messages in ChangeDisplaySettings.
Sorry for the double post. Sent by accident before I was finished. 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() which is called when something external to the process (may have) changed the display configuration. You would need to duplicate the hoisted code to that function, too, or find some other way to make sure the same work gets done. -Ken On Apr 16, 2015, at 5:18 AM, Stefan Dösinger <stefan(a)codeweavers.com> 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
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 2015-04-16 um 21:49 schrieb Ken Thomases:
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() which is called when something external to the process (may have) changed the display configuration. You would need to duplicate the hoisted code to that function, too, or find some other way to make sure the same work gets done. Thanks. Looks like I did a terrible grep job. I sent an updated patch and made sure Wine draws its windows fine after a mode change done with the OSX system settings.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJVMM59AAoJEN0/YqbEcdMwHMkP/j9CYEnUxfWpr9ILokgD3lQp gg+bnyNKfxcmilY+7LKjAqG1p2dUR/VhRGaI7ZEUTvcUlwc7MCaOtI42Fmw7R+4d 9B9X0lo5F3J5I2j5+nZoqZQkRaYDbUO4u2cfeSPab1xOfYchUN148DstpoiCJx2W lJYpS8WYRFgarSYTOdNK1qfUS/SIfchqNbO9Mu0UAJt+g18BEUf5jMOvakncyuZu tQLQ6ch/J4MYhN9eaEnG+xdQhObDMzWOrIkDysgYZOeJ1kxh7K66V+llI30ky4Se Ep7oTfNerbPGHXlYE0dZWPhNgsQgwgA2/m8qS5VAzpSvtl7xz79E49fc88mA+gn7 jYmj18uiKYcWMPMrupbyTXDOSBpx5zHUIcasktGnH0gTTKjw1BPOI1XyEzbegXuW EQXYfWW4UT/hNnlCsSdgJZlhsrhfMAeHxQTVz5NHiW6UyXiwM+gCfeund4OJVkkC fvgrL2SbTOhGVwF+ZchBfqF1Kztxm6gFlambEGdE8f3qyLSJZbU39TnHR0m/GCVe ERFDG5iBFO78YQMq35bw+GCZjPOFpEbU7HdkIbuzs2es329ZU354NK9yYO1mkScp pkoCG3pl9ou4MAKsVqXNqfJLmabssePc9E8HowsW5OL9NxRE0bOEaCIQ7P+Jk4KZ jFn6MEPcRj675ijXROz7 =wx1l -----END PGP SIGNATURE-----
participants (2)
-
Ken Thomases -
Stefan Dösinger