[gedit/wip/3.14-osx: 22/69] [osx] Still need to process app events



commit a55dc883059765bd6ffdc281480d0672fba0a993
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Fri Aug 22 13:57:11 2014 +0200

    [osx] Still need to process app events

 gedit/gedit-app-osx.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/gedit/gedit-app-osx.c b/gedit/gedit-app-osx.c
index 079a737..de5fbf2 100644
--- a/gedit/gedit-app-osx.c
+++ b/gedit/gedit-app-osx.c
@@ -202,6 +202,25 @@ gedit_app_osx_create_window_impl (GeditApp *app)
        return window;
 }
 
+static gboolean
+gedit_app_osx_process_window_event_impl (GeditApp    *app,
+                                         GeditWindow *window,
+                                         GdkEvent    *event)
+{
+       NSEvent *nsevent;
+
+       /* For OS X we will propagate the event to NSApp, which handles some OS X
+       * specific keybindings and the accelerators for the menu
+       */
+       nsevent = gdk_quartz_event_get_nsevent (event);
+       [NSApp sendEvent:nsevent];
+
+       /* It does not really matter what we return here since it's the last thing
+       * in the chain. Also we can't get from sendEvent whether the event was
+       * actually handled by NSApp anyway
+       */
+       return TRUE;
+}
 
 static void
 gedit_app_osx_class_init (GeditAppOSXClass *klass)
@@ -216,6 +235,7 @@ gedit_app_osx_class_init (GeditAppOSXClass *klass)
        app_class->show_help = gedit_app_osx_show_help_impl;
        app_class->set_window_title = gedit_app_osx_set_window_title_impl;
        app_class->create_window = gedit_app_osx_create_window_impl;
+       app_class->process_window_event = gedit_app_osx_process_window_event_impl;
 }
 
 static void


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