Skip to content

Instantly share code, notes, and snippets.

@samm-git
Created January 2, 2020 14:35
Show Gist options
  • Save samm-git/d2d51ee88491ff0c42ba923a0ee9b8f0 to your computer and use it in GitHub Desktop.
Save samm-git/d2d51ee88491ff0c42ba923a0ee9b8f0 to your computer and use it in GitHub Desktop.
diff --git a/src/main.c b/src/main.c
index 8d10ad0..6d493ec 100644
--- a/src/main.c
+++ b/src/main.c
@@ -53,7 +53,9 @@
#include "gui/progress_and_log.h"
#include "registration/registration.h"
#include "stacking/stacking.h"
-
+#ifdef PLATFORM_OSX
+#import <AppKit/AppKit.h>
+#endif
/* the global variables of the whole project */
cominfo com; // the main data struct
fits gfit; // currently loaded image
@@ -337,6 +339,24 @@ static void siril_app_activate(GApplication *application) {
gtk_window_set_application(GTK_WINDOW(lookup_widget("control_window")), GTK_APPLICATION(application));
/* Load state of the main windows (position and mximized) */
load_main_window_state();
+
+#ifdef PLATFORM_OSX
+ /* see https://gitlab.gnome.org/GNOME/gtk/issues/2342 */
+ NSEvent *focusevent;
+ g_warning("workaround for the GTK3 #2342 bug");
+ focusevent = [NSEvent
+ otherEventWithType: NSEventTypeAppKitDefined
+ location: NSZeroPoint
+ modifierFlags: 0x40
+ timestamp: 0
+ windowNumber: 0
+ context: nil
+ subtype: NSEventSubtypeApplicationActivated
+ data1: 0
+ data2: 0];
+
+ [NSApp postEvent:focusevent atStart:YES];
+#endif
}
if (changedir(com.wd, NULL))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment