From: Jason Francis Date: Wed, 24 May 2023 21:34:34 +0000 (-0400) Subject: win32: Invalidate inactive monitors X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~3^2~1^2~20 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=6a172090aa860eb5c1823b10964a91e982ed9ad0;p=gtk4.git win32: Invalidate inactive monitors Without this, there are still GdkMonitors present for displays that are present but disconnected (such as when a laptop disables the internal display to connect to an external monitor). --- diff --git a/gdk/win32/gdkmonitor-win32.c b/gdk/win32/gdkmonitor-win32.c index 93fd2a489f..3702820c98 100644 --- a/gdk/win32/gdkmonitor-win32.c +++ b/gdk/win32/gdkmonitor-win32.c @@ -443,9 +443,6 @@ populate_monitor_devices_from_display_config (GPtrArray *monitors) char *path, *path_lower; DISPLAYCONFIG_RATIONAL *refresh; - if ((dispconf_paths[path_index].flags & DISPLAYCONFIG_PATH_ACTIVE) == 0) - continue; - tdn.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME; tdn.header.size = sizeof (tdn); tdn.header.adapterId = dispconf_paths[path_index].targetInfo.adapterId; @@ -481,6 +478,12 @@ populate_monitor_devices_from_display_config (GPtrArray *monitors) if (w32mon == NULL) continue; + if ((dispconf_paths[path_index].flags & DISPLAYCONFIG_PATH_ACTIVE) == 0) + { + w32mon->remove = TRUE; + continue; + } + mon = GDK_MONITOR (w32mon); if (!tdn.flags.friendlyNameForced)