[gtk/event-signal: 1/4] widget: Connect to GdkSurface::event



commit d633beaccd98f7be5a175902385900f1c54611a9
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Feb 23 13:49:28 2019 -0500

    widget: Connect to GdkSurface::event
    
    This lets us handle input events the same way
    we do expose events.

 gtk/gtkwidget.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index a3a46f739f..ce60607a16 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -11426,6 +11426,16 @@ surface_expose (GdkSurface     *surface,
   return TRUE;
 }
 
+static gboolean
+surface_event (GdkSurface *surface,
+               GdkEvent   *event,
+               GtkWidget  *widget)
+{
+  gtk_main_do_event (event);
+
+  return TRUE;
+}
+
 /**
  * gtk_widget_register_surface:
  * @widget: a #GtkWidget
@@ -11455,6 +11465,7 @@ gtk_widget_register_surface (GtkWidget    *widget,
   gdk_surface_set_user_data (surface, widget);
 
   g_signal_connect (surface, "render", G_CALLBACK (surface_expose), widget);
+  g_signal_connect (surface, "event", G_CALLBACK (surface_event), widget);
 }
 
 /**
@@ -11480,6 +11491,7 @@ gtk_widget_unregister_surface (GtkWidget    *widget,
   gdk_surface_set_user_data (surface, NULL);
 
   g_signal_handlers_disconnect_by_func (surface, surface_expose, widget);
+  g_signal_handlers_disconnect_by_func (surface, surface_event, widget);
 }
 
 /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]