[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - vcl/unx

Caolán McNamara caolanm at redhat.com
Wed Dec 2 05:46:29 PST 2015


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

New commits:
commit 8b36af7e35fda4b639ba3f77dd1fc9b81b25502d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Dec 1 20:51:06 2015 +0000

    gtk3: gtk_gesture_get_point may return false
    
    Change-Id: Ibd175c65babdde48132692fd1979a00929356bb4
    (cherry picked from commit 23d5775ecf04c001ecf86b6012aef4d1a3f2f063)

diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index 3b39a3c..eeda042 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -3259,22 +3259,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)


More information about the Libreoffice-commits mailing list