From 9a99a80710921105f1c316b4da0eafda04a720b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 12 Feb 2015 11:20:52 +0800 Subject: wayland: Fail clients who try to create or destroy a not-top-most popup If a client creates an xdg_popup given a parent that is a xdg_popup that is not the most top one in the grab chain, send the not_the_topmost_popup error. Also fail a client who destroys a popup that is not the top most one. https://bugzilla.gnome.org/show_bug.cgi?id=744452 --- src/wayland/meta-wayland-popup.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/wayland/meta-wayland-popup.c') diff --git a/src/wayland/meta-wayland-popup.c b/src/wayland/meta-wayland-popup.c index cc8b4bd8d..f3d47aef7 100644 --- a/src/wayland/meta-wayland-popup.c +++ b/src/wayland/meta-wayland-popup.c @@ -172,6 +172,17 @@ meta_wayland_popup_grab_end (MetaWaylandPopupGrab *grab) meta_wayland_pointer_end_grab (grab->generic.pointer); } +MetaWaylandSurface * +meta_wayland_popup_grab_get_top_popup (MetaWaylandPopupGrab *grab) +{ + MetaWaylandPopup *popup; + + g_assert (!wl_list_empty (&grab->all_popups)); + popup = wl_container_of (grab->all_popups.next, popup, link); + + return popup->surface; +} + gboolean meta_wayland_pointer_grab_is_popup_grab (MetaWaylandPointerGrab *grab) { @@ -199,6 +210,12 @@ meta_wayland_popup_dismiss (MetaWaylandPopup *popup) meta_wayland_pointer_end_popup_grab (popup_grab->generic.pointer); } +MetaWaylandSurface * +meta_wayland_popup_get_top_popup (MetaWaylandPopup *popup) +{ + return meta_wayland_popup_grab_get_top_popup (popup->grab); +} + struct wl_signal * meta_wayland_popup_get_destroy_signal (MetaWaylandPopup *popup) { -- cgit v1.2.1