From: Zhiyi Zhang Subject: [PATCH 7/7] winemac.drv: Handle display device change events. Message-Id: <5bbee73a-ffba-376e-3943-34a7c658e2cd@codeweavers.com> Date: Mon, 22 Apr 2019 20:14:11 +0800 Signed-off-by: Zhiyi Zhang --- dlls/winemac.drv/display.c | 6 ++++-- dlls/winemac.drv/macdrv.h | 2 +- dlls/winemac.drv/macdrv_main.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dlls/winemac.drv/display.c b/dlls/winemac.drv/display.c index 8b1ae523ee..2b6f671140 100644 --- a/dlls/winemac.drv/display.c +++ b/dlls/winemac.drv/display.c @@ -1460,6 +1460,8 @@ void macdrv_displays_changed(const macdrv_event *event) free_display_mode_descriptor(desc); CGDisplayModeRelease(mode); + macdrv_init_display_devices(TRUE); + if (is_original && retina_enabled) { width *= 2; @@ -1759,7 +1761,7 @@ static void cleanup_devices(void) * * Return FALSE on failure and TRUE on success. */ -BOOL macdrv_init_display_devices(void) +BOOL macdrv_init_display_devices(BOOL force) { struct macdrv_gpu *gpus = NULL; struct macdrv_adapter *adapters = NULL; @@ -1781,7 +1783,7 @@ BOOL macdrv_init_display_devices(void) goto fail; /* Ensure only one thread is initializing the registry and avoid unnecessary reinit */ - if (disposition != REG_CREATED_NEW_KEY) + if (!force && disposition != REG_CREATED_NEW_KEY) { ret = TRUE; goto fail; diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index dca89b04f0..8519a1607f 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -223,7 +223,7 @@ extern CGImageRef create_cgimage_from_icon_bitmaps(HDC hdc, HANDLE icon, HBITMAP extern void macdrv_status_item_mouse_move(const macdrv_event *event) DECLSPEC_HIDDEN; extern void check_retina_status(void) DECLSPEC_HIDDEN; -extern BOOL macdrv_init_display_devices(void) DECLSPEC_HIDDEN; +extern BOOL macdrv_init_display_devices(BOOL force) DECLSPEC_HIDDEN; /************************************************************************** * Mac IME driver diff --git a/dlls/winemac.drv/macdrv_main.c b/dlls/winemac.drv/macdrv_main.c index 0779952e9a..7d82e6fd3f 100644 --- a/dlls/winemac.drv/macdrv_main.c +++ b/dlls/winemac.drv/macdrv_main.c @@ -299,7 +299,7 @@ static BOOL process_attach(void) return FALSE; } - if (!macdrv_init_display_devices()) + if (!macdrv_init_display_devices(FALSE)) return FALSE; return TRUE; -- 2.15.2 (Apple Git-101.1)