Merge branch 'gtk-3-24-issue2128' into 'gtk-3-24'

[gtk3] wayland: Fix xdg-output v3 support

See merge request GNOME/gtk!1081
This commit is contained in:
Matthias Clasen 2019-09-03 14:32:07 +00:00
commit eaf0e54074

View File

@ -1445,12 +1445,21 @@ should_update_monitor (GdkWaylandMonitor *monitor)
monitor->version < OUTPUT_VERSION_WITH_DONE);
}
static gboolean
should_expect_xdg_output_done (GdkWaylandMonitor *monitor)
{
GdkDisplay *display = GDK_MONITOR (monitor)->display;
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
return (monitor_has_xdg_output (monitor) &&
display_wayland->xdg_output_version < NO_XDG_OUTPUT_DONE_SINCE_VERSION);
}
static void
apply_monitor_change (GdkWaylandMonitor *monitor)
{
GdkDisplay *display = GDK_MONITOR (monitor)->display;
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (gdk_display_get_default_screen (display));
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
GDK_NOTE (MISC,
g_message ("monitor %d changed position %d %d, size %d %d",
@ -1462,11 +1471,7 @@ apply_monitor_change (GdkWaylandMonitor *monitor)
gdk_monitor_set_size (GDK_MONITOR (monitor), monitor->width, monitor->height);
gdk_monitor_set_connector (GDK_MONITOR (monitor), monitor->name);
monitor->wl_output_done = FALSE;
/* xdg_output v3 marks xdg_output.done as deprecated, so if using
* that version, no need to wait for xdg-output.done event.
*/
monitor->xdg_output_done =
(display_wayland->xdg_output_version >= NO_XDG_OUTPUT_DONE_SINCE_VERSION);
monitor->xdg_output_done = FALSE;
g_signal_emit_by_name (screen_wayland, "monitors-changed");
update_screen_size (screen_wayland);
@ -1512,7 +1517,7 @@ xdg_output_handle_done (void *data,
g_message ("handle done xdg-output %d", monitor->id));
monitor->xdg_output_done = TRUE;
if (monitor->wl_output_done)
if (monitor->wl_output_done && should_expect_xdg_output_done (monitor))
apply_monitor_change (monitor);
}
@ -1606,7 +1611,7 @@ output_handle_done (void *data,
monitor->wl_output_done = TRUE;
if (!monitor_has_xdg_output (monitor) || monitor->xdg_output_done)
if (!should_expect_xdg_output_done (monitor) || monitor->xdg_output_done)
apply_monitor_change (monitor);
}