delegate port-connections to low priority thread.
[ardour.git] / libs / gtkmm2ext / gtkapplication_quartz.mm
index f244bd9eb04a3f6b6fa546acda171dbd594013e0..5809355ad9fa9c8d0a53f396ca72a03f45bb81e0 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
+#include <sigc++/signal.h>
+#include <sigc++/slot.h>
+
+#include <string.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+#include <gtkmm2ext/gtkapplication.h>
+#include <gtkmm2ext/gtkapplication-private.h>
+
 #import <AppKit/NSMenu.h>
 #import <AppKit/NSMenuItem.h>
 #import <AppKit/NSCell.h>
 #import <Foundation/NSString.h>
 #import <Foundation/NSNotification.h>
 
-#include <string.h>
-#include <gtk/gtk.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtkmm2ext/gtkapplication.h>
-#include <gtkmm2ext/gtkapplication-private.h>
-
 #define UNUSED_PARAMETER(a) (void) (a)
 
 // #define DEBUG(format, ...) g_printerr ("%s: " format, G_STRFUNC, ## __VA_ARGS__)
@@ -570,7 +573,9 @@ idle_call_activate (gpointer data)
 - (void) activate:(id) sender
 {
        UNUSED_PARAMETER(sender);
-       g_idle_add (idle_call_activate, gtk_menu_item);
+    // Hot Fix. Increase Priority.
+       g_idle_add_full (G_PRIORITY_HIGH_IDLE, idle_call_activate, gtk_menu_item, NULL);
+//    g_idle_add (idle_call_activate, gtk_menu_item);
 }
 @end
 
@@ -804,7 +809,9 @@ cocoa_menu_item_update_accelerator (NSMenuItem *cocoa_item,
      is still done by GTK, so this is more cosmetic than it may 
      appear.
   */
-  
+
+  get_menu_label_text (widget, &label);  
+
   if (GTK_IS_ACCEL_LABEL (label) &&
            GTK_ACCEL_LABEL (label)->accel_closure)
        {
@@ -1216,7 +1223,7 @@ create_apple_menu ()
        [menuitem release];
        [_app_menu addItem: [NSMenuItem separatorItem]];
        menuitem = [[NSMenuItem alloc] initWithTitle:@"Hide"
-                   action:@selector(hide:) keyEquivalent:@""];
+                   action:@selector(hide:) keyEquivalent:@"h"];
        [menuitem setTarget: NSApp];
        [_app_menu addItem: menuitem];
        [menuitem release];
@@ -1419,11 +1426,14 @@ namespace Gtk {
 
 @end
 
-@interface GtkApplicationDelegate : NSObject {}
+@interface GtkApplicationDelegate : NSObject
+-(BOOL) application:(NSApplication*) app openFile:(NSString*) file;
+- (NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication *) app;
+- (void) startApp;
 @end
 
 @implementation GtkApplicationDelegate
--(BOOL) application:(NSApplication*) app :(NSString*) file
+-(BOOL) application:(NSApplication*) app openFile:(NSString*) file
 {
        UNUSED_PARAMETER(app);
        Glib::ustring utf8_path ([file UTF8String]);
@@ -1465,6 +1475,13 @@ extern "C" void
 gtk_application_ready ()
 {
        [ NSApp finishLaunching ];
+        [[NSApplication sharedApplication] activateIgnoringOtherApps : YES];
+}
+
+extern "C" void
+gtk_application_hide ()
+{
+    [NSApp performSelector:@selector(hide:)];
 }
 
 extern "C" void