summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-12-01 20:51:06 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-12-02 13:45:31 +0000
commit8b36af7e35fda4b639ba3f77dd1fc9b81b25502d (patch)
treea44a0cb9ff882819c800ce6fc6dd77c1e8f1e5be /vcl
parent9bd618740ea5da9d5077f755530de56f1e913bea (diff)
gtk3: gtk_gesture_get_point may return false
Change-Id: Ibd175c65babdde48132692fd1979a00929356bb4 (cherry picked from commit 23d5775ecf04c001ecf86b6012aef4d1a3f2f063)
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/gtk/gtksalframe.cxx21
1 files changed, 11 insertions, 10 deletions
diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index 3b39a3cea09c..eeda0425c755 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)