[gtk/wip/carlosg/public-legacy-controller: 1/8] gtkeventcontrollerlegacy: Make public
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/carlosg/public-legacy-controller: 1/8] gtkeventcontrollerlegacy: Make public
- Date: Mon, 15 Oct 2018 15:40:43 +0000 (UTC)
commit 0f4a6bfbf8795b1821266eced0f38059283980ac
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Oct 12 17:30:59 2018 +0200
gtkeventcontrollerlegacy: Make public
And move ::event into it, dropping the GtkWidget::event signal.
gtk/gtk.h | 1 +
gtk/gtkeventcontrollerlegacy.c | 52 ++++++++++++++++++++--
...rlegacyprivate.h => gtkeventcontrollerlegacy.h} | 22 +++++----
gtk/gtkwidget.c | 40 -----------------
gtk/gtkwidgetprivate.h | 5 ---
gtk/meson.build | 3 +-
6 files changed, 61 insertions(+), 62 deletions(-)
---
diff --git a/gtk/gtk.h b/gtk/gtk.h
index 823c079e6e..cf89eca9ab 100644
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -94,6 +94,7 @@
#include <gtk/gtkenums.h>
#include <gtk/gtkeventcontroller.h>
#include <gtk/gtkeventcontrollerkey.h>
+#include <gtk/gtkeventcontrollerlegacy.h>
#include <gtk/gtkeventcontrollermotion.h>
#include <gtk/gtkeventcontrollerscroll.h>
#include <gtk/gtkexpander.h>
diff --git a/gtk/gtkeventcontrollerlegacy.c b/gtk/gtkeventcontrollerlegacy.c
index ebe852249b..33b38203f5 100644
--- a/gtk/gtkeventcontrollerlegacy.c
+++ b/gtk/gtkeventcontrollerlegacy.c
@@ -18,7 +18,28 @@
*/
#include "config.h"
-#include "gtkeventcontrollerlegacyprivate.h"
+#include "gtkeventcontrollerlegacy.h"
+#include "gtkeventcontrollerprivate.h"
+#include "gtkmarshalers.h"
+#include "gtkintl.h"
+#include "gtkprivate.h"
+
+struct _GtkEventControllerLegacy
+{
+ GtkEventController parent_instance;
+};
+
+struct _GtkEventControllerLegacyClass
+{
+ GtkEventControllerClass parent_class;
+};
+
+enum {
+ EVENT,
+ N_SIGNALS
+};
+
+static guint signals[N_SIGNALS] = { 0, };
G_DEFINE_TYPE (GtkEventControllerLegacy, gtk_event_controller_legacy,
GTK_TYPE_EVENT_CONTROLLER)
@@ -27,9 +48,11 @@ static gboolean
gtk_event_controller_legacy_handle_event (GtkEventController *controller,
const GdkEvent *event)
{
- GtkWidget *widget = gtk_event_controller_get_widget (controller);
+ gboolean handled;
- return gtk_widget_emit_event_signals (widget, event);
+ g_signal_emit (controller, signals[EVENT], 0, event, &handled);
+
+ return handled;
}
static void
@@ -38,6 +61,29 @@ gtk_event_controller_legacy_class_init (GtkEventControllerLegacyClass *klass)
GtkEventControllerClass *controller_class = GTK_EVENT_CONTROLLER_CLASS (klass);
controller_class->handle_event = gtk_event_controller_legacy_handle_event;
+
+ /**
+ * GtkEventController::event:
+ * @controller: the object which received the signal.
+ * @event: the #GdkEvent which triggered this signal
+ *
+ * The GTK+ main loop will emit this signal for each GDK event delivered
+ * to @controller.
+ *
+ * Returns: %TRUE to stop other handlers from being invoked for the event
+ * and to cancel the emission of the second specific ::event signal.
+ * %FALSE to propagate the event further.
+ */
+ signals[EVENT] =
+ g_signal_new (I_("event"),
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0, _gtk_boolean_handled_accumulator, NULL,
+ _gtk_marshal_BOOLEAN__OBJECT,
+ G_TYPE_BOOLEAN, 1,
+ GDK_TYPE_EVENT);
+ g_signal_set_va_marshaller (signals[EVENT], G_TYPE_FROM_CLASS (klass),
+ _gtk_marshal_BOOLEAN__OBJECTv);
}
static void
diff --git a/gtk/gtkeventcontrollerlegacyprivate.h b/gtk/gtkeventcontrollerlegacy.h
similarity index 89%
rename from gtk/gtkeventcontrollerlegacyprivate.h
rename to gtk/gtkeventcontrollerlegacy.h
index 61059a0f5e..748bebb59a 100644
--- a/gtk/gtkeventcontrollerlegacyprivate.h
+++ b/gtk/gtkeventcontrollerlegacy.h
@@ -20,8 +20,11 @@
#ifndef __GTK_EVENT_CONTROLLER_LEGACY_H__
#define __GTK_EVENT_CONTROLLER_LEGACY_H__
-#include "gtkeventcontrollerprivate.h"
-#include "gtkwidgetprivate.h"
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#include <gtk/gtkeventcontroller.h>
G_BEGIN_DECLS
@@ -35,17 +38,12 @@ G_BEGIN_DECLS
typedef struct _GtkEventControllerLegacy GtkEventControllerLegacy;
typedef struct _GtkEventControllerLegacyClass GtkEventControllerLegacyClass;
-struct _GtkEventControllerLegacy
-{
- GtkEventController parent_instance;
-};
-
-struct _GtkEventControllerLegacyClass
-{
- GtkEventControllerClass parent_class;
-};
-
+GDK_AVAILABLE_IN_ALL
GType gtk_event_controller_legacy_get_type (void) G_GNUC_CONST;
+
+GDK_AVAILABLE_IN_ALL
GtkEventController *gtk_event_controller_legacy_new (void);
+G_END_DECLS
+
#endif /* __GTK_EVENT_CONTROLLER_LEGACY_H__ */
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 3044231eab..a61de0dd99 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -1689,30 +1689,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
G_TYPE_BOOLEAN, 1,
GTK_TYPE_DIRECTION_TYPE);
- /**
- * GtkWidget::event:
- * @widget: the object which received the signal.
- * @event: the #GdkEvent which triggered this signal
- *
- * The GTK+ main loop will emit this signal for each GDK event delivered
- * to a widget.
- *
- * Returns: %TRUE to stop other handlers from being invoked for the event
- * and to cancel the emission of the second specific ::event signal.
- * %FALSE to propagate the event further.
- */
- widget_signals[EVENT] =
- g_signal_new (I_("event"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_DEPRECATED,
- G_STRUCT_OFFSET (GtkWidgetClass, event),
- _gtk_boolean_handled_accumulator, NULL,
- _gtk_marshal_BOOLEAN__OBJECT,
- G_TYPE_BOOLEAN, 1,
- GDK_TYPE_EVENT);
- g_signal_set_va_marshaller (widget_signals[EVENT], G_TYPE_FROM_CLASS (klass),
- _gtk_marshal_BOOLEAN__OBJECTv);
-
/**
* GtkWidget::drag-leave:
* @widget: the object which received the signal.
@@ -5306,22 +5282,6 @@ gtk_widget_event_internal (GtkWidget *widget,
return return_val;
}
-gboolean
-gtk_widget_emit_event_signals (GtkWidget *widget,
- const GdkEvent *event)
-{
- gboolean return_val = FALSE, handled;
-
- g_object_ref (widget);
-
- g_signal_emit (widget, widget_signals[EVENT], 0, event, &handled);
- return_val |= handled | !WIDGET_REALIZED_FOR_EVENT (widget, event);
-
- g_object_unref (widget);
-
- return return_val;
-}
-
/**
* gtk_widget_activate:
* @widget: a #GtkWidget that’s activatable
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index 0cadb237fb..f658811358 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -324,11 +324,6 @@ void gtk_widget_set_pass_through (GtkWidget *widget,
gboolean pass_through);
gboolean gtk_widget_get_pass_through (GtkWidget *widget);
-gboolean gtk_widget_emit_event_signals (GtkWidget *widget,
- const GdkEvent *event);
-
-void gtk_widget_init_legacy_controller (GtkWidget *widget);
-
void gtk_widget_get_origin_relative_to_parent (GtkWidget *widget,
int *origin_x,
int *origin_y);
diff --git a/gtk/meson.build b/gtk/meson.build
index 96a0c4283f..8559ed0f7c 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -101,7 +101,6 @@ gtk_private_sources = files([
'gtkcssvalue.c',
'gtkcsswidgetnode.c',
'gtkcsswin32sizevalue.c',
- 'gtkeventcontrollerlegacy.c',
'gtkfilechooserembed.c',
'gtkfilechooserentry.c',
'gtkfilechoosererrorstack.c',
@@ -399,7 +398,6 @@ gtk_public_sources = files([
gtk_private_type_headers = files([
'gtkcsstypesprivate.h',
'gtktexthandleprivate.h',
- 'gtkeventcontrollerlegacyprivate.h',
])
gtk_public_headers = files([
@@ -471,6 +469,7 @@ gtk_public_headers = files([
'gtkeventcontrollerkey.h',
'gtkeventcontrollerscroll.h',
'gtkeventcontrollermotion.h',
+ 'gtkeventcontrollerlegacy.h',
'gtkexpander.h',
'gtkfilechooser.h',
'gtkfilechooserbutton.h',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]