Commit e08adb03 authored by Jesse van den Kieboom's avatar Jesse van den Kieboom

Added "ready" vfunc for gedit app

This is needed for OS X to signal the NSApp that
we are ready to receive events. This needs to be
done after the main gedit window has been created
because those events contain things like OpenFile
parent 918cd51c
......@@ -308,12 +308,11 @@ static GeditWindow *
gedit_app_osx_create_window_impl (GeditApp *app)
{
GeditWindow *window;
window = GEDIT_APP_CLASS (gedit_app_osx_parent_class)->create_window (app);
setup_mac_menu (window);
return window;
}
......@@ -323,13 +322,13 @@ gedit_app_osx_process_window_event_impl (GeditApp *app,
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
......@@ -337,6 +336,17 @@ gedit_app_osx_process_window_event_impl (GeditApp *app,
return TRUE;
}
static void
gedit_app_osx_ready_impl (GeditApp *app)
{
GtkOSXApplication *osxapp;
osxapp = g_object_new (GTK_TYPE_OSX_APPLICATION, NULL);
gtk_osxapplication_ready (osxapp);
GEDIT_APP_CLASS (gedit_app_osx_parent_class)->ready (app);
}
static void
gedit_app_osx_class_init (GeditAppOSXClass *klass)
{
......@@ -352,6 +362,7 @@ gedit_app_osx_class_init (GeditAppOSXClass *klass)
app_class->quit = gedit_app_osx_quit_impl;
app_class->create_window = gedit_app_osx_create_window_impl;
app_class->process_window_event = gedit_app_osx_process_window_event_impl;
app_class->ready = gedit_app_osx_ready_impl;
}
static void
......@@ -444,7 +455,6 @@ gedit_app_osx_init (GeditAppOSX *app)
app);
gtk_osxapplication_set_use_quartz_accelerators (osxapp, FALSE);
gtk_osxapplication_ready (osxapp);
}
/* ex:set ts=8 noet: */
......@@ -545,6 +545,11 @@ gedit_app_create_window_impl (GeditApp *app)
return window;
}
static void
gedit_app_ready_impl (GeditApp *app)
{
}
static void
gedit_app_class_init (GeditAppClass *klass)
{
......@@ -562,6 +567,7 @@ gedit_app_class_init (GeditAppClass *klass)
klass->set_window_title = gedit_app_set_window_title_impl;
klass->quit = gedit_app_quit_impl;
klass->create_window = gedit_app_create_window_impl;
klass->ready = gedit_app_ready_impl;
g_object_class_install_property (object_class,
PROP_LOCKDOWN,
......@@ -1190,4 +1196,12 @@ _gedit_app_get_settings (GeditApp *app)
return app->priv->settings;
}
void
_gedit_app_ready (GeditApp *app)
{
g_return_if_fail (GEDIT_IS_APP (app));
GEDIT_APP_GET_CLASS (app)->ready (app);
}
/* ex:set ts=8 noet: */
......@@ -95,6 +95,8 @@ struct _GeditAppClass
gboolean (*process_window_event) (GeditApp *app,
GeditWindow *window,
GdkEvent *event);
void (*ready) (GeditApp *app);
};
/*
......@@ -177,6 +179,7 @@ void _gedit_app_set_default_print_settings (GeditApp *app,
GObject *_gedit_app_get_settings (GeditApp *app);
void _gedit_app_quit (GeditApp *app);
void _gedit_app_ready (GeditApp *app);
G_END_DECLS
......
......@@ -199,6 +199,8 @@ gedit_main (gboolean service)
}
}
_gedit_app_ready (app);
gedit_debug_message (DEBUG_APP, "Start gtk-main");
gtk_main ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment