wayland: Don't inhibit premature resize for popups

So now we essentially only inhibit the premature resize for toplevel
windows, where it is most crucial. For popups, this didn't work for two
reasons: we relied on the owner of the popup (application) to resize
according to the configured size. For custom popup operators like
Epiphany and LibreOffice, this didn't work out well, since they simply
didn't.

Making gdk do it for them in case they didn't themself did make the
popups show up properly, but there were still some weirdness in
LibreOffice where tooltips didn't still didn't get the right size. So,
even though the size set by application may be different from the one
later configured by the display server, let the applications have their
way and see their resize result immediately. It's fairly likely to be
what they eventually get anyway.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2583
This commit is contained in:
Jonas Ådahl 2020-04-06 21:53:00 +02:00
parent 92aa63c203
commit f06ee688fe

View File

@ -273,6 +273,7 @@ static void gdk_wayland_window_unexport (GdkWindow *window);
static void gdk_wayland_window_announce_decoration_mode (GdkWindow *window);
static gboolean should_map_as_subsurface (GdkWindow *window);
static gboolean should_map_as_popup (GdkWindow *window);
GType _gdk_window_impl_wayland_get_type (void);
@ -1122,7 +1123,7 @@ is_realized_popup (GdkWindow *window)
}
static gboolean
needs_initial_configure (GdkWindow *window)
should_inhibit_resize (GdkWindow *window)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
@ -1132,12 +1133,17 @@ needs_initial_configure (GdkWindow *window)
return FALSE;
else if (impl->hint == GDK_WINDOW_TYPE_HINT_DND)
return FALSE;
else if (is_realized_toplevel (window))
return TRUE;
else if (is_realized_popup (window))
return TRUE;
else
return !should_map_as_subsurface (window);
return FALSE;
else if (should_map_as_popup (window))
return FALSE;
else if (should_map_as_subsurface (window))
return FALSE;
/* This should now either be, or eventually be, a toplevel window,
* and we should wait for the initial configure to really configure it.
*/
return !impl->initial_configure_received;
}
static void
@ -1151,15 +1157,8 @@ gdk_wayland_window_maybe_configure (GdkWindow *window,
gboolean is_visible;
if (needs_initial_configure (window) &&
!impl->initial_configure_received)
{
impl->unconfigured_width = calculate_width_without_margin (window,
width);
impl->unconfigured_height = calculate_height_without_margin (window,
height);
return;
}
if (should_inhibit_resize (window))
return;
if (window->width == width &&
window->height == height &&