forked from AuroraMiddleware/gtk
gtkeventcontrollerlegacy: Make public
And move ::event into it, dropping the GtkWidget::event signal.
This commit is contained in:
parent
f252bbc02c
commit
0f4a6bfbf8
@ -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>
|
||||
|
@ -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
|
||||
|
@ -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__ */
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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',
|
||||
|
Loading…
Reference in New Issue
Block a user