[mutter/wip/wayland-work: 38/54] MetaWaylandSeat: don't use use events to count pressed buttons
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/wayland-work: 38/54] MetaWaylandSeat: don't use use events to count pressed buttons
- Date: Tue, 3 Sep 2013 14:11:47 +0000 (UTC)
commit ae0eca30bf787f56239c06651372f727f63563e1
Author: Giovanni Campagna <gcampagn redhat com>
Date: Fri Aug 16 12:13:26 2013 +0200
MetaWaylandSeat: don't use use events to count pressed buttons
Use the modifier mask instead, as events can get lost if there
is a clutter grab or if some other actor is capturing events.
https://bugzilla.gnome.org/show_bug.cgi?id=706124
src/wayland/meta-wayland-seat.c | 62 +++++++++++++++++++++++++--------------
1 files changed, 40 insertions(+), 22 deletions(-)
---
diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c
index 3720919..5a1d588 100644
--- a/src/wayland/meta-wayland-seat.c
+++ b/src/wayland/meta-wayland-seat.c
@@ -357,30 +357,24 @@ handle_button_event (MetaWaylandSeat *seat,
break;
}
- if (state)
+ /* FIXME: synth a XI2 event and handle in display.c */
+ if (state && pointer->button_count == 1)
{
- if (pointer->button_count == 0)
- {
- MetaWaylandSurface *surface = pointer->current;
-
- pointer->grab_button = button;
- pointer->grab_time = event->time;
- pointer->grab_x = pointer->x;
- pointer->grab_y = pointer->y;
-
- if (button == BTN_LEFT &&
- surface &&
- surface->window &&
- surface->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND)
- {
- meta_window_raise (surface->window);
- }
- }
-
- pointer->button_count++;
+ MetaWaylandSurface *surface = pointer->current;
+
+ pointer->grab_button = button;
+ pointer->grab_time = event->time;
+ pointer->grab_x = pointer->x;
+ pointer->grab_y = pointer->y;
+
+ if (button == BTN_LEFT &&
+ surface &&
+ surface->window &&
+ surface->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND)
+ {
+ meta_window_raise (surface->window);
+ }
}
- else
- pointer->button_count--;
pointer->grab->interface->button (pointer->grab, event->time, button, state);
@@ -430,10 +424,34 @@ handle_scroll_event (MetaWaylandSeat *seat,
value);
}
+static int
+count_buttons (const ClutterEvent *event)
+{
+ static gint maskmap[5] =
+ {
+ CLUTTER_BUTTON1_MASK, CLUTTER_BUTTON2_MASK, CLUTTER_BUTTON3_MASK,
+ CLUTTER_BUTTON4_MASK, CLUTTER_BUTTON5_MASK
+ };
+ ClutterModifierType mod_mask;
+ int i, count;
+
+ mod_mask = clutter_event_get_state (event);
+ count = 0;
+ for (i = 0; i < 5; i++)
+ {
+ if (mod_mask & maskmap[i])
+ count++;
+ }
+
+ return count;
+}
+
void
meta_wayland_seat_handle_event (MetaWaylandSeat *seat,
const ClutterEvent *event)
{
+ seat->pointer.button_count = count_buttons (event);
+
switch (event->type)
{
case CLUTTER_MOTION:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]