GTK4: GdkSurface configured to 0x0 after repeated xdg_surface.configure with empty sequence
Steps to reproduce
I am seeing incorrect behaviour of GTK4 with the Google Chrome OS Wayland compositor (exo). Apologies in advance if this is actually a compositor bug and not a GTK bug.
- Install the Linux Development Environment (Crostini) on a device running Chrome OS.
- Install any GTK4 application from Flathub, or upgrade the guest OS to Debian testing to install any GTK4 application using apt.
- Run any GTK4 application (e.g. gtk4-demo or gnome-text-editor) and try to open a GtkPopover.
Current behavior
The popover does not render, either at all in plain GTK4, or only the tail renders in libadwaita apps. This issue was reported on our issue tracker with a screen recording at https://bugs.chromium.org/p/chromium/issues/detail?id=1312909.
Expected outcome
The popover renders correctly.
Version information
- GTK 4.6.2
- Both of:
- Flathub GNOME 42 runtime
- Debian testing
- The host is Google Chrome OS
Additional information
I tracked this down to the interaction of two behaviours:
- Our Wayland compositor sends a second
xdg_surface.configure
after the first has been acked, but this configure sequence lacksxdg_popover.configure
(see the log below). - For a GdkWaylandSurface, the pending struct is cleared following
xdg_surface.configure
. The second configure is also acked, afterwards, the GtkPopover is sized to 0x0.
I'm interested to know if it could be clarified whether this is allowed according to the xdg-shell spec or if we have a bug in our compositor. For comparison, I found that GTK3 is not affected by this issue.
stderr log (WAYLAND_DEBUG=1 gnome-text-editor):
[1602003.088] wl_pointer@8.button(2527, 25353391, 272, 0)
[1602003.203] wl_pointer@8.frame()
[1602004.994] -> wl_compositor@4.create_surface(new id wl_surface@33)
[1602015.813] -> xdg_wm_base@14.create_positioner(new id xdg_positioner@34)
[1602015.868] -> xdg_positioner@34.set_size(200, 541)
[1602015.880] -> xdg_positioner@34.set_anchor_rect(319, 6, 34, 34)
[1602015.913] -> xdg_positioner@34.set_offset(0, 0)
[1602015.936] -> xdg_positioner@34.set_anchor(2)
[1602015.952] -> xdg_positioner@34.set_gravity(2)
[1602015.972] -> xdg_positioner@34.set_constraint_adjustment(57)
[1602016.001] -> xdg_wm_base@14.get_xdg_surface(new id xdg_surface@35, wl_surface@33)
[1602016.022] -> xdg_surface@35.get_popup(new id xdg_popup@36, xdg_surface@19, xdg_positioner@34)
[1602016.093] -> xdg_positioner@34.destroy()
[1602016.114] -> xdg_popup@36.grab(wl_seat@11, 2526)
[1602016.169] -> wl_surface@33.commit()
[1602016.209] -> wl_pointer@8.set_cursor(2524, wl_surface@13, 3, 3)
[1602016.277] -> wl_surface@13.attach(wl_buffer@27, 0, 0)
[1602016.315] -> wl_surface@13.set_buffer_scale(2)
[1602016.337] -> wl_surface@13.damage(0, 0, 24, 24)
[1602016.404] -> wl_surface@13.commit()
[1602017.082] wl_display@1.delete_id(34)
[1602017.139] wl_surface@33.enter(wl_output@7)
[1602017.738] xdg_popup@36.configure(236, 40, 200, 419)
[1602017.778] xdg_surface@35.configure(2528)
[1602017.846] -> xdg_surface@35.ack_configure(2528)
[1602017.875] xdg_surface@35.configure(2529)
[1602017.882] -> xdg_surface@35.ack_configure(2529)
[1602022.293] wl_surface@33.enter(wl_output@7)
[1602026.144] -> wl_surface@33.set_buffer_scale(2)
(gnome-text-editor:2): Gtk-WARNING **: 16:43:05.060: gtk_widget_size_allocate(): attempt to allocate GtkPopoverContent contents 0x5cc268b0ecd0 with width 0 and height -12
(gnome-text-editor:2): Gtk-WARNING **: 16:43:05.060: gtk_widget_size_allocate(): attempt to allocate GtkScrolledWindow scrolledwindow 0x5cc268b25480 with width -2 and height -2
*** BUG ***
In pixman_region32_init_rect: Invalid rectangle passed
Set a breakpoint on '_pixman_log_error' to debug
[1602029.893] -> wl_surface@33.set_buffer_scale(2)
[1602033.724] -> xdg_surface@35.set_window_geometry(23, 21, 0, 0)