wayland: Simplify popup grabbing API
meta_wayland_popup_grab_create() creates and begins the grab and meta_wayland_popup_grab_destroy() both ends and destroys the grab. https://bugzilla.gnome.org/show_bug.cgi?id=763431
This commit is contained in:
parent
19f7e310d9
commit
e68b5f6655
@ -885,7 +885,6 @@ meta_wayland_pointer_end_popup_grab (MetaWaylandPointer *pointer)
|
|||||||
{
|
{
|
||||||
MetaWaylandPopupGrab *popup_grab = (MetaWaylandPopupGrab*)pointer->grab;
|
MetaWaylandPopupGrab *popup_grab = (MetaWaylandPopupGrab*)pointer->grab;
|
||||||
|
|
||||||
meta_wayland_popup_grab_end (popup_grab);
|
|
||||||
meta_wayland_popup_grab_destroy (popup_grab);
|
meta_wayland_popup_grab_destroy (popup_grab);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -900,12 +899,7 @@ meta_wayland_pointer_start_popup_grab (MetaWaylandPointer *pointer,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (pointer->grab == &pointer->default_grab)
|
if (pointer->grab == &pointer->default_grab)
|
||||||
{
|
grab = meta_wayland_popup_grab_create (pointer, surface);
|
||||||
struct wl_client *client = wl_resource_get_client (surface->resource);
|
|
||||||
|
|
||||||
grab = meta_wayland_popup_grab_create (pointer, client);
|
|
||||||
meta_wayland_popup_grab_begin (grab, surface);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
grab = (MetaWaylandPopupGrab*)pointer->grab;
|
grab = (MetaWaylandPopupGrab*)pointer->grab;
|
||||||
|
|
||||||
|
@ -66,6 +66,13 @@ struct _MetaWaylandPopup
|
|||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_wayland_popup_grab_begin (MetaWaylandPopupGrab *grab,
|
||||||
|
MetaWaylandSurface *surface);
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_wayland_popup_grab_end (MetaWaylandPopupGrab *grab);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
popup_grab_focus (MetaWaylandPointerGrab *grab,
|
popup_grab_focus (MetaWaylandPointerGrab *grab,
|
||||||
MetaWaylandSurface *surface)
|
MetaWaylandSurface *surface)
|
||||||
@ -109,8 +116,9 @@ static MetaWaylandPointerGrabInterface popup_grab_interface = {
|
|||||||
|
|
||||||
MetaWaylandPopupGrab *
|
MetaWaylandPopupGrab *
|
||||||
meta_wayland_popup_grab_create (MetaWaylandPointer *pointer,
|
meta_wayland_popup_grab_create (MetaWaylandPointer *pointer,
|
||||||
struct wl_client *client)
|
MetaWaylandSurface *surface)
|
||||||
{
|
{
|
||||||
|
struct wl_client *client = wl_resource_get_client (surface->resource);
|
||||||
MetaWaylandPopupGrab *grab;
|
MetaWaylandPopupGrab *grab;
|
||||||
|
|
||||||
grab = g_slice_new0 (MetaWaylandPopupGrab);
|
grab = g_slice_new0 (MetaWaylandPopupGrab);
|
||||||
@ -119,16 +127,19 @@ meta_wayland_popup_grab_create (MetaWaylandPointer *pointer,
|
|||||||
grab->grab_client = client;
|
grab->grab_client = client;
|
||||||
wl_list_init (&grab->all_popups);
|
wl_list_init (&grab->all_popups);
|
||||||
|
|
||||||
|
meta_wayland_popup_grab_begin (grab, surface);
|
||||||
|
|
||||||
return grab;
|
return grab;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_wayland_popup_grab_destroy (MetaWaylandPopupGrab *grab)
|
meta_wayland_popup_grab_destroy (MetaWaylandPopupGrab *grab)
|
||||||
{
|
{
|
||||||
|
meta_wayland_popup_grab_end (grab);
|
||||||
g_slice_free (MetaWaylandPopupGrab, grab);
|
g_slice_free (MetaWaylandPopupGrab, grab);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
meta_wayland_popup_grab_begin (MetaWaylandPopupGrab *grab,
|
meta_wayland_popup_grab_begin (MetaWaylandPopupGrab *grab,
|
||||||
MetaWaylandSurface *surface)
|
MetaWaylandSurface *surface)
|
||||||
{
|
{
|
||||||
|
@ -28,15 +28,10 @@
|
|||||||
#include "meta-wayland-pointer.h"
|
#include "meta-wayland-pointer.h"
|
||||||
|
|
||||||
MetaWaylandPopupGrab *meta_wayland_popup_grab_create (MetaWaylandPointer *pointer,
|
MetaWaylandPopupGrab *meta_wayland_popup_grab_create (MetaWaylandPointer *pointer,
|
||||||
struct wl_client *client);
|
MetaWaylandSurface *surface);
|
||||||
|
|
||||||
void meta_wayland_popup_grab_destroy (MetaWaylandPopupGrab *grab);
|
void meta_wayland_popup_grab_destroy (MetaWaylandPopupGrab *grab);
|
||||||
|
|
||||||
void meta_wayland_popup_grab_begin (MetaWaylandPopupGrab *grab,
|
|
||||||
MetaWaylandSurface *surface);
|
|
||||||
|
|
||||||
void meta_wayland_popup_grab_end (MetaWaylandPopupGrab *grab);
|
|
||||||
|
|
||||||
MetaWaylandSurface *meta_wayland_popup_grab_get_top_popup (MetaWaylandPopupGrab *grab);
|
MetaWaylandSurface *meta_wayland_popup_grab_get_top_popup (MetaWaylandPopupGrab *grab);
|
||||||
|
|
||||||
gboolean meta_wayland_pointer_grab_is_popup_grab (MetaWaylandPointerGrab *grab);
|
gboolean meta_wayland_pointer_grab_is_popup_grab (MetaWaylandPointerGrab *grab);
|
||||||
|
Loading…
Reference in New Issue
Block a user