Commit 42df9eda authored by Matthias Clasen's avatar Matthias Clasen Committed by Carlos Garnacho
Browse files

Prevent subclassing of gestures

For now, at least. We do this by hiding the instance and
class structures in private headers.
parent 93b78833
...@@ -503,6 +503,7 @@ gtk_private_h_sources = \ ...@@ -503,6 +503,7 @@ gtk_private_h_sources = \
gtkcustompaperunixdialog.h \ gtkcustompaperunixdialog.h \
gtkdialogprivate.h \ gtkdialogprivate.h \
gtkentryprivate.h \ gtkentryprivate.h \
gtkeventcontrollerprivate.h \
gtkfilechooserembed.h \ gtkfilechooserembed.h \
gtkfilechooserentry.h \ gtkfilechooserentry.h \
gtkfilechooserprivate.h \ gtkfilechooserprivate.h \
...@@ -512,6 +513,13 @@ gtk_private_h_sources = \ ...@@ -512,6 +513,13 @@ gtk_private_h_sources = \
gtkfontchooserprivate.h \ gtkfontchooserprivate.h \
gtkfontchooserutils.h \ gtkfontchooserutils.h \
gtkgestureprivate.h \ gtkgestureprivate.h \
gtkgesturedragprivate.h \
gtkgesturelongpressprivate.h \
gtkgesturemultipressprivate.h \
gtkgesturepanprivate.h \
gtkgesturerotateprivate.h \
gtkgestureswipeprivate.h \
gtkgesturezoomprivate.h \
gtkheaderbarprivate.h \ gtkheaderbarprivate.h \
gtkhslaprivate.h \ gtkhslaprivate.h \
gtkiconcache.h \ gtkiconcache.h \
......
...@@ -39,7 +39,8 @@ ...@@ -39,7 +39,8 @@
*/ */
#include "config.h" #include "config.h"
#include <gtk/gtkeventcontroller.h> #include "gtkeventcontroller.h"
#include "gtkeventcontrollerprivate.h"
#include "gtktypebuiltins.h" #include "gtktypebuiltins.h"
#include "gtkmarshalers.h" #include "gtkmarshalers.h"
#include "gtkprivate.h" #include "gtkprivate.h"
......
...@@ -40,22 +40,6 @@ G_BEGIN_DECLS ...@@ -40,22 +40,6 @@ G_BEGIN_DECLS
#define GTK_IS_EVENT_CONTROLLER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GTK_TYPE_EVENT_CONTROLLER)) #define GTK_IS_EVENT_CONTROLLER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GTK_TYPE_EVENT_CONTROLLER))
#define GTK_EVENT_CONTROLLER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_EVENT_CONTROLLER, GtkEventControllerClass)) #define GTK_EVENT_CONTROLLER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_EVENT_CONTROLLER, GtkEventControllerClass))
struct _GtkEventController
{
GObject parent_instance;
};
struct _GtkEventControllerClass
{
GObjectClass parent_class;
gboolean (* handle_event) (GtkEventController *controller,
const GdkEvent *event);
void (* reset) (GtkEventController *controller);
/*<private>*/
gpointer padding[10];
};
GDK_AVAILABLE_IN_3_14 GDK_AVAILABLE_IN_3_14
GType gtk_event_controller_get_type (void) G_GNUC_CONST; GType gtk_event_controller_get_type (void) G_GNUC_CONST;
......
/* GTK - The GIMP Toolkit
* Copyright (C) 2012, One Laptop Per Child.
* 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_EVENT_CONTROLLER_PRIVATE_H__
#define __GTK_EVENT_CONTROLLER_PRIVATE_H__
#include "gtkeventcontroller.h"
struct _GtkEventController
{
GObject parent_instance;
};
struct _GtkEventControllerClass
{
GObjectClass parent_class;
gboolean (* handle_event) (GtkEventController *controller,
const GdkEvent *event);
void (* reset) (GtkEventController *controller);
/*<private>*/
gpointer padding[10];
};
#endif /* __GTK_EVENT_CONTROLLER_PRIVATE_H__ */
...@@ -87,7 +87,8 @@ ...@@ -87,7 +87,8 @@
*/ */
#include "config.h" #include "config.h"
#include <gtk/gtkgesture.h> #include "gtkgesture.h"
#include "gtkgestureprivate.h"
#include "gtktypebuiltins.h" #include "gtktypebuiltins.h"
#include "gtkprivate.h" #include "gtkprivate.h"
#include "gtkmain.h" #include "gtkmain.h"
......
...@@ -39,35 +39,6 @@ G_BEGIN_DECLS ...@@ -39,35 +39,6 @@ G_BEGIN_DECLS
typedef struct _GtkGesture GtkGesture; typedef struct _GtkGesture GtkGesture;
typedef struct _GtkGestureClass GtkGestureClass; typedef struct _GtkGestureClass GtkGestureClass;
struct _GtkGesture
{
GtkEventController parent_instance;
};
struct _GtkGestureClass
{
GtkEventControllerClass parent_class;
gboolean (* check) (GtkGesture *gesture);
void (* begin) (GtkGesture *gesture,
GdkEventSequence *sequence);
void (* update) (GtkGesture *gesture,
GdkEventSequence *sequence);
void (* end) (GtkGesture *gesture,
GdkEventSequence *sequence);
void (* cancel) (GtkGesture *gesture,
GdkEventSequence *sequence);
void (* sequence_state_changed) (GtkGesture *gesture,
GdkEventSequence *sequence,
GtkEventSequenceState state);
/*< private >*/
gpointer padding[10];
};
GDK_AVAILABLE_IN_3_14 GDK_AVAILABLE_IN_3_14
GType gtk_gesture_get_type (void) G_GNUC_CONST; GType gtk_gesture_get_type (void) G_GNUC_CONST;
......
...@@ -31,7 +31,8 @@ ...@@ -31,7 +31,8 @@
* gtk_gesture_drag_get_start_point(). * gtk_gesture_drag_get_start_point().
*/ */
#include "config.h" #include "config.h"
#include <gtk/gtkgesturedrag.h> #include "gtkgesturedrag.h"
#include "gtkgesturedragprivate.h"
typedef struct _GtkGestureDragPrivate GtkGestureDragPrivate; typedef struct _GtkGestureDragPrivate GtkGestureDragPrivate;
typedef struct _EventData EventData; typedef struct _EventData EventData;
......
...@@ -38,28 +38,6 @@ G_BEGIN_DECLS ...@@ -38,28 +38,6 @@ G_BEGIN_DECLS
typedef struct _GtkGestureDrag GtkGestureDrag; typedef struct _GtkGestureDrag GtkGestureDrag;
typedef struct _GtkGestureDragClass GtkGestureDragClass; typedef struct _GtkGestureDragClass GtkGestureDragClass;
struct _GtkGestureDrag
{
GtkGestureSingle parent_instance;
};
struct _GtkGestureDragClass
{
GtkGestureSingleClass parent_class;
void (* drag_begin) (GtkGestureDrag *gesture,
gdouble start_x,
gdouble start_y);
void (* drag_update) (GtkGestureDrag *gesture,
gdouble offset_x,
gdouble offset_y);
void (* drag_end) (GtkGestureDrag *gesture,
gdouble offset_x,
gdouble offset_y);
/*<private>*/
gpointer padding[10];
};
GDK_AVAILABLE_IN_3_14 GDK_AVAILABLE_IN_3_14
GType gtk_gesture_drag_get_type (void) G_GNUC_CONST; GType gtk_gesture_drag_get_type (void) G_GNUC_CONST;
......
/* 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_DRAG_PRIVATE_H__
#define __GTK_GESTURE_DRAG_PRIVATE_H__
#include "gtkgesturesingleprivate.h"
#include "gtkgesturedrag.h"
struct _GtkGestureDrag
{
GtkGestureSingle parent_instance;
};
struct _GtkGestureDragClass
{
GtkGestureSingleClass parent_class;
void (* drag_begin) (GtkGestureDrag *gesture,
gdouble start_x,
gdouble start_y);
void (* drag_update) (GtkGestureDrag *gesture,
gdouble offset_x,
gdouble offset_y);
void (* drag_end) (GtkGestureDrag *gesture,
gdouble offset_x,
gdouble offset_y);
/*<private>*/
gpointer padding[10];
};
#endif /* __GTK_GESTURE_DRAG_PRIVATE_H__ */
...@@ -33,9 +33,10 @@ ...@@ -33,9 +33,10 @@
*/ */
#include "config.h" #include "config.h"
#include <gtk/gtk.h> #include "gtkgesturelongpress.h"
#include <gtk/gtkgesturelongpress.h> #include "gtkgesturelongpressprivate.h"
#include "gtkmarshalers.h" #include "gtkmarshalers.h"
#include "gtkdnd.h"
#include "gtkprivate.h" #include "gtkprivate.h"
#include "gtkintl.h" #include "gtkintl.h"
......
...@@ -38,24 +38,6 @@ G_BEGIN_DECLS ...@@ -38,24 +38,6 @@ G_BEGIN_DECLS
typedef struct _GtkGestureLongPress GtkGestureLongPress; typedef struct _GtkGestureLongPress GtkGestureLongPress;
typedef struct _GtkGestureLongPressClass GtkGestureLongPressClass; typedef struct _GtkGestureLongPressClass GtkGestureLongPressClass;
struct _GtkGestureLongPress
{
GtkGestureSingle parent_instance;
};
struct _GtkGestureLongPressClass
{
GtkGestureSingleClass parent_class;
void (* pressed) (GtkGestureLongPress *gesture,
gdouble x,
gdouble y);
void (* cancelled) (GtkGestureLongPress *gesture);
/*< private >*/
gpointer padding[10];
};
GDK_AVAILABLE_IN_3_14 GDK_AVAILABLE_IN_3_14
GType gtk_gesture_long_press_get_type (void) G_GNUC_CONST; GType gtk_gesture_long_press_get_type (void) G_GNUC_CONST;
......
/* GTK - The GIMP Toolkit
* Copyright (C) 2012, One Laptop Per Child.
* 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_LONG_PRESS_PRIVATE_H__
#define __GTK_GESTURE_LONG_PRESS_PRIVATE_H__
#include "gtkgesturesingleprivate.h"
#include "gtkgesturelongpress.h"
struct _GtkGestureLongPress
{
GtkGestureSingle parent_instance;
};
struct _GtkGestureLongPressClass
{
GtkGestureSingleClass parent_class;
void (* pressed) (GtkGestureLongPress *gesture,
gdouble x,
gdouble y);
void (* cancelled) (GtkGestureLongPress *gesture);
/*< private >*/
gpointer padding[10];
};
#endif /* __GTK_GESTURE_LONG_PRESS_PRIVATE_H__ */
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "config.h" #include "config.h"
#include "gtkgesturemultipress.h" #include "gtkgesturemultipress.h"
#include "gtkgesturemultipressprivate.h"
#include "gtkprivate.h" #include "gtkprivate.h"
#include "gtkintl.h" #include "gtkintl.h"
......
...@@ -38,25 +38,6 @@ G_BEGIN_DECLS ...@@ -38,25 +38,6 @@ G_BEGIN_DECLS
typedef struct _GtkGestureMultiPress GtkGestureMultiPress; typedef struct _GtkGestureMultiPress GtkGestureMultiPress;
typedef struct _GtkGestureMultiPressClass GtkGestureMultiPressClass; typedef struct _GtkGestureMultiPressClass GtkGestureMultiPressClass;
struct _GtkGestureMultiPress
{
GtkGestureSingle parent_instance;
};
struct _GtkGestureMultiPressClass
{
GtkGestureSingleClass parent_class;
gboolean (* pressed) (GtkGestureMultiPress *gesture,
gint n_press,
gdouble x,
gdouble y);
void (* stopped) (GtkGestureMultiPress *gesture);
/*<private>*/
gpointer padding[10];
};
GDK_AVAILABLE_IN_3_14 GDK_AVAILABLE_IN_3_14
GType gtk_gesture_multi_press_get_type (void) G_GNUC_CONST; GType gtk_gesture_multi_press_get_type (void) G_GNUC_CONST;
......
/* 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_MULTI_PRESS_PRIVATE_H__
#define __GTK_GESTURE_MULTI_PRESS_PRIVATE_H__
#include "gtkgesturesingleprivate.h"
#include "gtkgesturemultipress.h"
struct _GtkGestureMultiPress
{
GtkGestureSingle parent_instance;
};
struct _GtkGestureMultiPressClass
{
GtkGestureSingleClass parent_class;
gboolean (* pressed) (GtkGestureMultiPress *gesture,
gint n_press,
gdouble x,
gdouble y);
void (* stopped) (GtkGestureMultiPress *gesture);
/*<private>*/
gpointer padding[10];
};
#endif /* __GTK_GESTURE_MULTI_PRESS_PRIVATE_H__ */
...@@ -39,7 +39,8 @@ ...@@ -39,7 +39,8 @@
*/ */
#include "config.h" #include "config.h"
#include <gtk/gtkgesturepan.h> #include "gtkgesturepan.h"
#include "gtkgesturepanprivate.h"
#include "gtktypebuiltins.h" #include "gtktypebuiltins.h"
#include "gtkprivate.h" #include "gtkprivate.h"
#include "gtkintl.h" #include "gtkintl.h"
......
...@@ -38,23 +38,6 @@ G_BEGIN_DECLS ...@@ -38,23 +38,6 @@ G_BEGIN_DECLS
typedef struct _GtkGesturePan GtkGesturePan; typedef struct _GtkGesturePan GtkGesturePan;
typedef struct _GtkGesturePanClass GtkGesturePanClass; typedef struct _GtkGesturePanClass GtkGesturePanClass;
struct _GtkGesturePan
{
GtkGestureDrag parent_instance;
};
struct _GtkGesturePanClass
{
GtkGestureDragClass parent_class;
void (* pan) (GtkGesturePan *gesture,
GtkPanDirection direction,
gdouble offset);
/*< private >*/
gpointer padding[10];
};
GDK_AVAILABLE_IN_3_14 GDK_AVAILABLE_IN_3_14
GType gtk_gesture_pan_get_type (void) G_GNUC_CONST; GType gtk_gesture_pan_get_type (void) G_GNUC_CONST;
......
/* 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_PAN_PRIVATE_H__
#define __GTK_GESTURE_PAN_PRIVATE_H__
#include "gtkgesturedragprivate.h"
#include "gtkgesturepan.h"
struct _GtkGesturePan
{
GtkGestureDrag parent_instance;
};
struct _GtkGesturePanClass
{
GtkGestureDragClass parent_class;
void (* pan) (GtkGesturePan *gesture,
GtkPanDirection direction,
gdouble offset);
/*< private >*/
gpointer padding[10];
};
#endif /* __GTK_GESTURE_PAN_PRIVATE_H__ */
...@@ -16,20 +16,50 @@ ...@@ -16,20 +16,50 @@
* *
* Author(s): Carlos Garnacho <carlosg@gnome.org> * Author(s): Carlos Garnacho <carlosg@gnome.org>
*/ */
#ifndef __GTK_GESTURE_PRIVATE_H__ #ifndef __GTK_GESTURE_PRIVATE_H__
#define __GTK_GESTURE_PRIVATE_H__ #define __GTK_GESTURE_PRIVATE_H__
#include "gtkeventcontrollerprivate.h"
#include "gtkgesture.h" #include "gtkgesture.h"
struct _GtkGesture
{
GtkEventController parent_instance;
};
struct _GtkGestureClass
{
GtkEventControllerClass parent_class;
gboolean (* check) (GtkGesture *gesture);
void (* begin) (GtkGesture *gesture,
GdkEventSequence *sequence);
void (* update) (GtkGesture *gesture,
GdkEventSequence *sequence);
void (* end) (GtkGesture *gesture,
GdkEventSequence *sequence);
void (* cancel) (GtkGesture *gesture,
GdkEventSequence *sequence);
void (* sequence_state_changed) (GtkGesture *gesture,
GdkEventSequence *sequence,
GtkEventSequenceState state);
/*< private >*/
gpointer padding[10];
};
G_BEGIN_DECLS G_BEGIN_DECLS
gboolean _gtk_gesture_handled_sequence_press (GtkGesture *gesture, gboolean _gtk_gesture_handled_sequence_press (GtkGesture *gesture,
GdkEventSequence *sequence); GdkEventSequence *sequence);
gboolean _gtk_gesture_get_pointer_emulating_sequence gboolean _gtk_gesture_get_pointer_emulating_sequence
(GtkGesture *gesture, (GtkGesture *gesture,
GdkEventSequence **sequence); GdkEventSequence **sequence);
G_END_DECLS G_END_DECLS
......
...@@ -31,7 +31,8 @@ ...@@ -31,7 +31,8 @@
#include "config.h" #include "config.h"
#include <math.h> #include <math.h>
#include <gtk/gtkgesturerotate.h> #include "gtkgesturerotate.h"
#include "gtkgesturerotateprivate.h"
#include "gtkmarshalers.h" #include "gtkmarshalers.h"