Blob Blame History Raw
From a645619a5740b1eb43795f07fd80f25e240821b5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Tue, 1 Dec 2015 20:51:06 +0000
Subject: [PATCH] gtk3: gtk_gesture_get_point may return false

(cherry picked from commit 23d5775ecf04c001ecf86b6012aef4d1a3f2f063)

Change-Id: Ibd175c65babdde48132692fd1979a00929356bb4
---
 vcl/unx/gtk/window/gtksalframe.cxx | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx
index 616f73f..9e03f14 100644
--- a/vcl/unx/gtk/window/gtksalframe.cxx
+++ b/vcl/unx/gtk/window/gtksalframe.cxx
@@ -3611,22 +3611,23 @@ gboolean GtkSalFrame::signalScroll( GtkWidget*, GdkEvent* pEvent, gpointer frame
 #if GTK_CHECK_VERSION(3,14,0)
 void GtkSalFrame::gestureSwipe(GtkGestureSwipe* gesture, gdouble velocity_x, gdouble velocity_y, gpointer frame)
 {
-    GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
-
-    SalSwipeEvent aEvent;
-    aEvent.mnVelocityX = velocity_x;
-    aEvent.mnVelocityY = velocity_y;
-
     gdouble x, y;
     GdkEventSequence *sequence = gtk_gesture_single_get_current_sequence(GTK_GESTURE_SINGLE(gesture));
     //I feel I want the first point of the sequence, not the last point which
     //the docs say this gives, but for the moment assume we start and end
     //within the same vcl window
-    gtk_gesture_get_point(GTK_GESTURE(gesture), sequence, &x, &y);
-    aEvent.mnX = x;
-    aEvent.mnY = y;
+    if (gtk_gesture_get_point(GTK_GESTURE(gesture), sequence, &x, &y))
+    {
+        GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
 
-    pThis->CallCallback(SALEVENT_SWIPE, &aEvent);
+        SalSwipeEvent aEvent;
+        aEvent.mnVelocityX = velocity_x;
+        aEvent.mnVelocityY = velocity_y;
+        aEvent.mnX = x;
+        aEvent.mnY = y;
+
+        pThis->CallCallback(SALEVENT_SWIPE, &aEvent);
+    }
 }
 
 void GtkSalFrame::gestureLongPress(GtkGestureLongPress* gesture, gpointer frame)
-- 
2.5.0