summaryrefslogtreecommitdiffstats
path: root/vcl/unx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-03-26 10:20:34 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-03-26 14:48:13 +0000
commit873141fb5be5fa49b56ea413bc912af33f758a0b (patch)
treee996d17f50a08c82bb469448886d0198a065d2b4 /vcl/unx
parentconst_cast: convert some C-style casts and remove some redundant ones (diff)
downloadcore-873141fb5be5fa49b56ea413bc912af33f758a0b.tar.gz
core-873141fb5be5fa49b56ea413bc912af33f758a0b.zip
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.cxx22
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 )