summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2010-12-08 11:07:57 -0500
committerKristian Høgsberg <krh@bitplanet.net>2010-12-08 11:07:57 -0500
commitb3fc757cd8a18633057634e7bedc2a91c950b09c (patch)
tree7de542c627842733fb5b762058708c24b4dcec18
parent9c3e8d734ef0e7cb24281a55e4c384985a5ba5f8 (diff)
Handle buttons in grab objects too
-rw-r--r--compositor/compositor.c39
-rw-r--r--wayland/wayland-server.h2
2 files changed, 36 insertions, 5 deletions
diff --git a/compositor/compositor.c b/compositor/compositor.c
index 8cfa394..e10404d 100644
--- a/compositor/compositor.c
+++ b/compositor/compositor.c
@@ -572,6 +572,12 @@ move_grab_motion(struct wl_grab *grab,
}
static void
+move_grab_button(struct wl_grab *grab,
+ uint32_t time, int32_t button, int32_t state)
+{
+}
+
+static void
move_grab_end(struct wl_grab *grab, uint32_t time)
{
free(grab);
@@ -579,6 +585,7 @@ move_grab_end(struct wl_grab *grab, uint32_t time)
static const struct wl_grab_interface move_grab_interface = {
move_grab_motion,
+ move_grab_button,
move_grab_end
};
@@ -653,6 +660,12 @@ resize_grab_motion(struct wl_grab *grab,
}
static void
+resize_grab_button(struct wl_grab *grab,
+ uint32_t time, int32_t button, int32_t state)
+{
+}
+
+static void
resize_grab_end(struct wl_grab *grab, uint32_t time)
{
free(grab);
@@ -660,6 +673,7 @@ resize_grab_end(struct wl_grab *grab, uint32_t time)
static const struct wl_grab_interface resize_grab_interface = {
resize_grab_motion,
+ resize_grab_button,
resize_grab_end
};
@@ -863,12 +877,23 @@ motion_grab_motion(struct wl_grab *grab,
}
static void
+motion_grab_button(struct wl_grab *grab,
+ uint32_t time, int32_t button, int32_t state)
+{
+ wl_client_post_event(grab->input_device->pointer_focus->client,
+ &grab->input_device->object,
+ WL_INPUT_DEVICE_BUTTON,
+ time, button, state);
+}
+
+static void
motion_grab_end(struct wl_grab *grab, uint32_t time)
{
}
static const struct wl_grab_interface motion_grab_interface = {
motion_grab_motion,
+ motion_grab_button,
motion_grab_end
};
@@ -973,11 +998,8 @@ notify_button(struct wl_input_device *device,
(struct wl_shell *) &compositor->shell,
&surface->surface, device, time,
WLSC_DEVICE_GRAB_RESIZE_BOTTOM_RIGHT);
- else if (device->grab == NULL || device->grab == &device->motion_grab)
- wl_client_post_event(surface->surface.client,
- &device->object,
- WL_INPUT_DEVICE_BUTTON,
- time, button, state);
+
+ device->grab->interface->button(device->grab, time, button, state);
if (!state && device->grab && device->grab_button == button)
wl_input_device_end_grab(device, time);
@@ -1204,6 +1226,12 @@ drag_grab_motion(struct wl_grab *grab,
}
static void
+drag_grab_button(struct wl_grab *grab,
+ uint32_t time, int32_t button, int32_t state)
+{
+}
+
+static void
drag_grab_end(struct wl_grab *grab, uint32_t time)
{
struct wl_drag *drag = container_of(grab, struct wl_drag, grab);
@@ -1218,6 +1246,7 @@ drag_grab_end(struct wl_grab *grab, uint32_t time)
static const struct wl_grab_interface drag_grab_interface = {
drag_grab_motion,
+ drag_grab_button,
drag_grab_end
};
diff --git a/wayland/wayland-server.h b/wayland/wayland-server.h
index 4e632a2..b911f1b 100644
--- a/wayland/wayland-server.h
+++ b/wayland/wayland-server.h
@@ -137,6 +137,8 @@ struct wl_grab;
struct wl_grab_interface {
void (*motion)(struct wl_grab *grab,
uint32_t time, int32_t x, int32_t y);
+ void (*button)(struct wl_grab *grab,
+ uint32_t time, int32_t button, int32_t state);
void (*end)(struct wl_grab *grab, uint32_t time);
};