fa8cdad
From a645619a5740b1eb43795f07fd80f25e240821b5 Mon Sep 17 00:00:00 2001
fa8cdad
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
fa8cdad
Date: Tue, 1 Dec 2015 20:51:06 +0000
fa8cdad
Subject: [PATCH] gtk3: gtk_gesture_get_point may return false
fa8cdad
fa8cdad
(cherry picked from commit 23d5775ecf04c001ecf86b6012aef4d1a3f2f063)
fa8cdad
fa8cdad
Change-Id: Ibd175c65babdde48132692fd1979a00929356bb4
fa8cdad
---
fa8cdad
 vcl/unx/gtk/window/gtksalframe.cxx | 21 +++++++++++----------
fa8cdad
 1 file changed, 11 insertions(+), 10 deletions(-)
fa8cdad
fa8cdad
diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx
fa8cdad
index 616f73f..9e03f14 100644
fa8cdad
--- a/vcl/unx/gtk/window/gtksalframe.cxx
fa8cdad
+++ b/vcl/unx/gtk/window/gtksalframe.cxx
fa8cdad
@@ -3611,22 +3611,23 @@ gboolean GtkSalFrame::signalScroll( GtkWidget*, GdkEvent* pEvent, gpointer frame
fa8cdad
 #if GTK_CHECK_VERSION(3,14,0)
fa8cdad
 void GtkSalFrame::gestureSwipe(GtkGestureSwipe* gesture, gdouble velocity_x, gdouble velocity_y, gpointer frame)
fa8cdad
 {
fa8cdad
-    GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
fa8cdad
-
fa8cdad
-    SalSwipeEvent aEvent;
fa8cdad
-    aEvent.mnVelocityX = velocity_x;
fa8cdad
-    aEvent.mnVelocityY = velocity_y;
fa8cdad
-
fa8cdad
     gdouble x, y;
fa8cdad
     GdkEventSequence *sequence = gtk_gesture_single_get_current_sequence(GTK_GESTURE_SINGLE(gesture));
fa8cdad
     //I feel I want the first point of the sequence, not the last point which
fa8cdad
     //the docs say this gives, but for the moment assume we start and end
fa8cdad
     //within the same vcl window
fa8cdad
-    gtk_gesture_get_point(GTK_GESTURE(gesture), sequence, &x, &y);
fa8cdad
-    aEvent.mnX = x;
fa8cdad
-    aEvent.mnY = y;
fa8cdad
+    if (gtk_gesture_get_point(GTK_GESTURE(gesture), sequence, &x, &y))
fa8cdad
+    {
fa8cdad
+        GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
fa8cdad
 
fa8cdad
-    pThis->CallCallback(SALEVENT_SWIPE, &aEvent);
fa8cdad
+        SalSwipeEvent aEvent;
fa8cdad
+        aEvent.mnVelocityX = velocity_x;
fa8cdad
+        aEvent.mnVelocityY = velocity_y;
fa8cdad
+        aEvent.mnX = x;
fa8cdad
+        aEvent.mnY = y;
fa8cdad
+
fa8cdad
+        pThis->CallCallback(SALEVENT_SWIPE, &aEvent);
fa8cdad
+    }
fa8cdad
 }
fa8cdad
 
fa8cdad
 void GtkSalFrame::gestureLongPress(GtkGestureLongPress* gesture, gpointer frame)
fa8cdad
-- 
fa8cdad
2.5.0
fa8cdad