[gtk+/events-refactor: 780/1085] GdkEventTranslator: add methods for selecting events on a window.



commit aef890e113ac90e7519d5525f54baea5d97d102c
Author: Carlos Garnacho <carlos lanedo com>
Date:   Sun Aug 23 00:35:59 2009 +0200

    GdkEventTranslator: add methods for selecting events on a window.

 gdk/x11/gdkeventtranslator.c |   30 ++++++++++++++++++++++++++++++
 gdk/x11/gdkeventtranslator.h |   10 ++++++++++
 2 files changed, 40 insertions(+), 0 deletions(-)
---
diff --git a/gdk/x11/gdkeventtranslator.c b/gdk/x11/gdkeventtranslator.c
index 66f45dd..de3dc08 100644
--- a/gdk/x11/gdkeventtranslator.c
+++ b/gdk/x11/gdkeventtranslator.c
@@ -141,3 +141,33 @@ gdk_event_translator_get_event_window (GdkEventTranslator *translator,
 
   return get_gdk_window (display, xwindow);
 }
+
+GdkEventMask
+gdk_event_translator_get_handled_events (GdkEventTranslator *translator)
+{
+  GdkEventTranslatorIface *iface;
+
+  g_return_val_if_fail (GDK_IS_EVENT_TRANSLATOR (translator), 0);
+
+  iface = GDK_EVENT_TRANSLATOR_GET_IFACE (translator);
+
+  if (iface->get_handled_events)
+    return iface->get_handled_events (translator);
+
+  return 0;
+}
+
+void
+gdk_event_translator_select_window_events (GdkEventTranslator *translator,
+                                           Window              window,
+                                           GdkEventMask        event_mask)
+{
+  GdkEventTranslatorIface *iface;
+
+  g_return_if_fail (GDK_IS_EVENT_TRANSLATOR (translator));
+
+  iface = GDK_EVENT_TRANSLATOR_GET_IFACE (translator);
+
+  if (iface->select_window_events)
+    iface->select_window_events (translator, window, event_mask);
+}
diff --git a/gdk/x11/gdkeventtranslator.h b/gdk/x11/gdkeventtranslator.h
index 2077922..d0ef324 100644
--- a/gdk/x11/gdkeventtranslator.h
+++ b/gdk/x11/gdkeventtranslator.h
@@ -46,6 +46,11 @@ struct _GdkEventTranslatorIface
 
   Window (* get_event_window)  (GdkEventTranslator *translator,
                                 XEvent             *xevent);
+
+  GdkEventMask (* get_handled_events)   (GdkEventTranslator *translator);
+  void         (* select_window_events) (GdkEventTranslator *translator,
+                                         Window              window,
+                                         GdkEventMask        event_mask);
 };
 
 GType      gdk_event_translator_get_type (void) G_GNUC_CONST;
@@ -58,6 +63,11 @@ GdkWindow * gdk_event_translator_get_event_window  (GdkEventTranslator *translat
                                                     GdkDisplay         *display,
                                                     XEvent             *xevent);
 
+GdkEventMask gdk_event_translator_get_handled_events   (GdkEventTranslator *translator);
+void         gdk_event_translator_select_window_events (GdkEventTranslator *translator,
+                                                        Window              window,
+                                                        GdkEventMask        event_mask);
+
 G_END_DECLS
 
 #endif /* __GDK_EVENT_TRANSLATOR_H__ */



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