diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-03-26 10:20:34 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-03-26 14:48:13 +0000 |
commit | 873141fb5be5fa49b56ea413bc912af33f758a0b (patch) | |
tree | e996d17f50a08c82bb469448886d0198a065d2b4 /vcl/unx | |
parent | 1c78277801f377458e8cb1d04fae0578a60c69b7 (diff) |
add GtkLongPressGesture support and implement long-press in slideshow
so a long press shows the context menu to e.g. allow switching on/off
draw-on-slide mode
Change-Id: Icd6ea52d2172217794f4fc802246ccf13020e134
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/gtk/window/gtksalframe.cxx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx index 36a780b850d1..aa94c26e924c 100644 --- a/vcl/unx/gtk/window/gtksalframe.cxx +++ b/vcl/unx/gtk/window/gtksalframe.cxx @@ -994,6 +994,12 @@ void GtkSalFrame::InitCommon() g_signal_connect(pSwipe, "swipe", G_CALLBACK(gestureSwipe), this); gtk_event_controller_set_propagation_phase(GTK_EVENT_CONTROLLER (pSwipe), GTK_PHASE_TARGET); g_object_weak_ref(G_OBJECT(m_pWindow), reinterpret_cast<GWeakNotify>(g_object_unref), pSwipe); + + GtkGesture *pLongPress = gtk_gesture_long_press_new(m_pWindow); + g_signal_connect(pLongPress, "pressed", G_CALLBACK(gestureLongPress), this); + gtk_event_controller_set_propagation_phase(GTK_EVENT_CONTROLLER (pLongPress), GTK_PHASE_TARGET); + g_object_weak_ref(G_OBJECT(m_pWindow), reinterpret_cast<GWeakNotify>(g_object_unref), pLongPress); + #endif #else @@ -3325,6 +3331,22 @@ void GtkSalFrame::gestureSwipe(GtkGestureSwipe* gesture, gdouble velocity_x, gdo pThis->CallCallback(SALEVENT_SWIPE, &aEvent); } + +void GtkSalFrame::gestureLongPress(GtkGestureLongPress* gesture, gpointer frame) +{ + GtkSalFrame* pThis = (GtkSalFrame*)frame; + + SalLongPressEvent aEvent; + + gdouble x, y; + GdkEventSequence *sequence = gtk_gesture_single_get_current_sequence(GTK_GESTURE_SINGLE(gesture)); + gtk_gesture_get_point(GTK_GESTURE(gesture), sequence, &x, &y); + aEvent.mnX = x; + aEvent.mnY = y; + + pThis->CallCallback(SALEVENT_LONGPRESS, &aEvent); +} + #endif gboolean GtkSalFrame::signalMotion( GtkWidget*, GdkEventMotion* pEvent, gpointer frame ) |