From 46d40cd4bd2887e17329cf1dd2840c4292dfc1d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Sun, 16 Feb 2020 16:42:52 +0100 Subject: [PATCH] wayland: Simplify logic deciding whether to use xdg_popup From a handful of hueristics and guess-work, to a single `surface->surface_type == GDK_SURFACE_POPUP`. --- gdk/wayland/gdksurface-wayland.c | 37 +------------------------------- 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index 267943799e..d9302c75e8 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -2356,42 +2356,7 @@ should_be_mapped (GdkSurface *surface) static gboolean should_map_as_popup (GdkSurface *surface) { - GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface); - - if (GDK_SURFACE_TYPE (surface) == GDK_SURFACE_POPUP) - return TRUE; - - /* Ideally, popup would be temp surfaces with a parent and grab */ - if (GDK_SURFACE_TYPE (surface) == GDK_SURFACE_TEMP) - { - /* If a temp surface has a parent and a grab, we can use a popup */ - if (impl->transient_for) - { - if (impl->grab_input_seat) - return TRUE; - } - else - g_message ("Surface %p is a temporary surface without parent, " - "application will not be able to position it on screen.", - surface); - } - - /* Yet we need to keep the surface type hint tests for compatibility */ - switch ((guint) impl->hint) - { - case GDK_SURFACE_TYPE_HINT_POPUP_MENU: - case GDK_SURFACE_TYPE_HINT_DROPDOWN_MENU: - case GDK_SURFACE_TYPE_HINT_COMBO: - return TRUE; - - default: - break; - } - - if (impl->has_layout_data) - return TRUE; - - return FALSE; + return GDK_SURFACE_TYPE (surface) == GDK_SURFACE_POPUP; } static void