From ad84aef7663b982a14223e8a4d254a920ae797b9 Mon Sep 17 00:00:00 2001
From: "Jasper St. Pierre" <jstpierre@mecheye.net>
Date: Tue, 12 Nov 2013 15:42:31 -0500
Subject: [PATCH] wayland-seat: Fix updating the grab serial

We shouldn't update the grab serial if we go from 2 buttons => 1.
---
 src/wayland/meta-wayland-seat.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c
index 17544b353..2a0b16f1f 100644
--- a/src/wayland/meta-wayland-seat.c
+++ b/src/wayland/meta-wayland-seat.c
@@ -280,13 +280,14 @@ handle_button_event (MetaWaylandSeat    *seat,
                      const ClutterEvent *event)
 {
   MetaWaylandPointer *pointer = &seat->pointer;
-  gboolean state = event->type == CLUTTER_BUTTON_PRESS;
+  gboolean implicit_grab;
   uint32_t button;
   MetaWaylandSurface *surface;
 
   notify_motion (seat, event);
 
-  if (state && pointer->button_count == 1)
+  implicit_grab = (event->type == CLUTTER_BUTTON_PRESS) && (pointer->button_count == 1);
+  if (implicit_grab)
     {
       button = clutter_event_get_button (event);
       pointer->grab_button = button;
@@ -307,7 +308,7 @@ handle_button_event (MetaWaylandSeat    *seat,
 
   pointer->grab->interface->button (pointer->grab, event);
 
-  if (pointer->button_count == 1)
+  if (implicit_grab)
     pointer->grab_serial = wl_display_get_serial (seat->display);
 }