Commit 83dd050a authored by Carlos Garnacho's avatar Carlos Garnacho

gesture: Add private getter to know whether a touch begin was handled

If GDK_TOUCH_BEGIN was handled/consumed for a sequence, or GDK_BUTTON_PRESS was
handled for the mouse gesture, this function will return TRUE.
parent a9fa0151
......@@ -509,6 +509,7 @@ gtk_private_h_sources = \
gtkfilesystemmodel.h \
gtkfontchooserprivate.h \
gtkfontchooserutils.h \
gtkgestureprivate.h \
gtkheaderbarprivate.h \
gtkhslaprivate.h \
gtkiconcache.h \
......
......@@ -45,6 +45,7 @@ enum {
struct _PointData
{
GdkEvent *event;
guint press_handled : 1;
guint state : 2;
};
......@@ -301,8 +302,14 @@ gtk_gesture_handle_event (GtkEventController *controller,
break;
/* Fall through */
case GDK_TOUCH_BEGIN:
if (_gtk_gesture_update_point (gesture, event, TRUE))
_gtk_gesture_check_recognized (gesture, sequence);
if (_gtk_gesture_update_point (gesture, event, TRUE) &&
_gtk_gesture_check_recognized (gesture, sequence))
{
PointData *data;
data = g_hash_table_lookup (priv->points, sequence);
data->press_handled = TRUE;
}
break;
case GDK_BUTTON_RELEASE:
if (priv->touch_only)
......@@ -1021,3 +1028,21 @@ gtk_gesture_cancel_sequence (GtkGesture *gesture,
_gtk_gesture_remove_point (gesture, data->event);
return TRUE;
}
gboolean
_gtk_gesture_handled_sequence_press (GtkGesture *gesture,
GdkEventSequence *sequence)
{
GtkGesturePrivate *priv;
PointData *data;
g_return_val_if_fail (GTK_IS_GESTURE (gesture), FALSE);
priv = gtk_gesture_get_instance_private (gesture);
data = g_hash_table_lookup (priv->points, sequence);
if (!data)
return FALSE;
return data->press_handled;
}
/* GTK - The GIMP Toolkit
* Copyright (C) 2014, Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author(s): Carlos Garnacho <carlosg@gnome.org>
*/
#ifndef __GTK_GESTURE_PRIVATE_H__
#define __GTK_GESTURE_PRIVATE_H__
#include "gtkgesture.h"
G_BEGIN_DECLS
gboolean _gtk_gesture_handled_sequence_press (GtkGesture *gesture,
GdkEventSequence *sequence);
G_END_DECLS
#endif /* __GTK_GESTURE_PRIVATE_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment