Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/winex11.drv/xrandr.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c
index fd3bfd8b87..c07fe703be 100644
--- a/dlls/winex11.drv/xrandr.c
+++ b/dlls/winex11.drv/xrandr.c
@@ -68,6 +68,7 @@ static int primary_crtc;
#endif
#ifdef HAVE_XRRGETPROVIDERREDOURCES
+MAKE_FUNCPTR(XRRSelectInput)
MAKE_FUNCPTR(XRRGetOutputPrimary)
MAKE_FUNCPTR(XRRGetProviderResources)
MAKE_FUNCPTR(XRRFreeProviderResources)
@@ -119,6 +120,7 @@ static int load_xrandr(void)
#endif
#ifdef HAVE_XRRGETPROVIDERREDOURCES
+ LOAD_FUNCPTR(XRRSelectInput)
LOAD_FUNCPTR(XRRGetOutputPrimary)
LOAD_FUNCPTR(XRRGetProviderResources)
LOAD_FUNCPTR(XRRFreeProviderResources)
@@ -963,6 +965,12 @@ static void xrandr14_free_monitors( struct x11drv_monitor *monitors )
heap_free( monitors );
}
+static BOOL xrandr14_device_change_event( HWND hwnd, XEvent *event )
+{
+ X11DRV_DisplayDevices_Init( TRUE );
+ return TRUE;
+}
+
#endif
void X11DRV_XRandR_Init(void)
@@ -1010,6 +1018,15 @@ void X11DRV_XRandR_Init(void)
handler.pGetMonitors = xrandr14_get_monitors;
handler.pFreeMonitors = xrandr14_free_monitors;
X11DRV_DisplayDevices_SetHandler( &handler );
+
+ pXRRSelectInput( thread_init_display(), root_window,
+ RRCrtcChangeNotifyMask | RROutputChangeNotifyMask | RRProviderChangeNotifyMask);
+ X11DRV_register_event_handler( event_base + RRNotify_CrtcChange, xrandr14_device_change_event,
+ "XRandR CrtcChange" );
+ X11DRV_register_event_handler( event_base + RRNotify_OutputChange, xrandr14_device_change_event,
+ "XRandR OutputChange" );
+ X11DRV_register_event_handler( event_base + RRNotify_ProviderChange, xrandr14_device_change_event,
+ "XRandR ProviderChange" );
}
#endif
}
--
2.23.0