mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
data-device: Store the current drag grab
And bail out if any further start_drag() is attempted.
This commit is contained in:
parent
c061e26da5
commit
18db5d0799
@ -162,7 +162,7 @@ static struct wl_data_source_interface data_source_interface = {
|
|||||||
data_source_destroy
|
data_source_destroy
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
struct _MetaWaylandDragGrab {
|
||||||
MetaWaylandPointerGrab generic;
|
MetaWaylandPointerGrab generic;
|
||||||
|
|
||||||
MetaWaylandSeat *seat;
|
MetaWaylandSeat *seat;
|
||||||
@ -177,7 +177,7 @@ typedef struct {
|
|||||||
|
|
||||||
MetaWaylandDataSource *drag_data_source;
|
MetaWaylandDataSource *drag_data_source;
|
||||||
struct wl_listener drag_data_source_listener;
|
struct wl_listener drag_data_source_listener;
|
||||||
} MetaWaylandDragGrab;
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
destroy_drag_focus (struct wl_listener *listener, void *data)
|
destroy_drag_focus (struct wl_listener *listener, void *data)
|
||||||
@ -271,6 +271,8 @@ data_device_end_drag_grab (MetaWaylandDragGrab *drag_grab)
|
|||||||
if (drag_grab->drag_data_source)
|
if (drag_grab->drag_data_source)
|
||||||
wl_list_remove (&drag_grab->drag_data_source_listener.link);
|
wl_list_remove (&drag_grab->drag_data_source_listener.link);
|
||||||
|
|
||||||
|
drag_grab->seat->data_device.current_grab = NULL;
|
||||||
|
|
||||||
drag_grab_focus (&drag_grab->generic, NULL);
|
drag_grab_focus (&drag_grab->generic, NULL);
|
||||||
|
|
||||||
meta_wayland_pointer_end_grab (drag_grab->generic.pointer);
|
meta_wayland_pointer_end_grab (drag_grab->generic.pointer);
|
||||||
@ -339,10 +341,11 @@ data_device_start_drag (struct wl_client *client,
|
|||||||
|
|
||||||
/* FIXME: Check that the data source type array isn't empty. */
|
/* FIXME: Check that the data source type array isn't empty. */
|
||||||
|
|
||||||
if (seat->pointer.grab != &seat->pointer.default_grab)
|
if (data_device->current_grab ||
|
||||||
|
seat->pointer.grab != &seat->pointer.default_grab)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
drag_grab = g_slice_new0 (MetaWaylandDragGrab);
|
data_device->current_grab = drag_grab = g_slice_new0 (MetaWaylandDragGrab);
|
||||||
|
|
||||||
drag_grab->generic.interface = &drag_grab_interface;
|
drag_grab->generic.interface = &drag_grab_interface;
|
||||||
drag_grab->generic.pointer = &seat->pointer;
|
drag_grab->generic.pointer = &seat->pointer;
|
||||||
|
@ -27,12 +27,15 @@
|
|||||||
|
|
||||||
#include "meta-wayland-types.h"
|
#include "meta-wayland-types.h"
|
||||||
|
|
||||||
|
typedef struct _MetaWaylandDragGrab MetaWaylandDragGrab;
|
||||||
|
|
||||||
struct _MetaWaylandDataDevice
|
struct _MetaWaylandDataDevice
|
||||||
{
|
{
|
||||||
uint32_t selection_serial;
|
uint32_t selection_serial;
|
||||||
MetaWaylandDataSource *selection_data_source;
|
MetaWaylandDataSource *selection_data_source;
|
||||||
struct wl_listener selection_data_source_listener;
|
struct wl_listener selection_data_source_listener;
|
||||||
struct wl_list resource_list;
|
struct wl_list resource_list;
|
||||||
|
MetaWaylandDragGrab *current_grab;
|
||||||
};
|
};
|
||||||
|
|
||||||
void meta_wayland_data_device_manager_init (MetaWaylandCompositor *compositor);
|
void meta_wayland_data_device_manager_init (MetaWaylandCompositor *compositor);
|
||||||
|
Loading…
Reference in New Issue
Block a user