[gtk/event-signal: 1/5] surface: Introduce an ::event signal
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/event-signal: 1/5] surface: Introduce an ::event signal
- Date: Sat, 23 Feb 2019 19:00:51 +0000 (UTC)
commit 23fb77af43bb6b05451333cc76d673f0baed828e
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Feb 23 13:45:10 2019 -0500
surface: Introduce an ::event signal
This will eventually replace the event handler
as the method to get events over the gdk/gtk
boundary.
gdk/gdksurface.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 286a5985c0..acff6d6933 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -99,6 +99,7 @@ enum {
MOVED_TO_RECT,
SIZE_CHANGED,
RENDER,
+ EVENT,
LAST_SIGNAL
};
@@ -345,6 +346,18 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
G_TYPE_BOOLEAN,
1,
CAIRO_GOBJECT_TYPE_REGION);
+
+ signals[EVENT] =
+ g_signal_new (g_intern_static_string ("event"),
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ g_signal_accumulator_true_handled,
+ NULL,
+ NULL,
+ G_TYPE_BOOLEAN,
+ 1,
+ GDK_TYPE_EVENT);
}
static void
@@ -5462,12 +5475,17 @@ gdk_synthesize_surface_state (GdkSurface *surface,
gboolean
gdk_surface_handle_event (GdkEvent *event)
{
+ gboolean handled = FALSE;
if (gdk_event_get_event_type (event) == GDK_CONFIGURE)
{
g_signal_emit (gdk_event_get_surface (event), signals[SIZE_CHANGED], 0,
event->configure.width, event->configure.height);
- return TRUE;
+ handled = TRUE;
+ }
+ else
+ {
+ g_signal_emit (gdk_event_get_surface (event), signals[EVENT], 0, event, &handled);
}
- return FALSE;
+ return handled;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]