Skip to content

wxWidgets not initialized properly on macOS causing unfocusable window #2102

@mohd-akram

Description

@mohd-akram

On macOS (15.7.1), the app does not show an icon in the dock, and the window opens in the background. When trying to select it via Mission Control, it cannot be focused. It seems this issue is due to wxEntry not being called in initialization. When initializing the standard way, it works as expected, eg:

diff --git a/src/gdl.cpp b/src/gdl.cpp
index e581a7a7..0c6dd7a7 100644
--- a/src/gdl.cpp
+++ b/src/gdl.cpp
@@ -222,7 +222,22 @@ namespace MyPaths {
 }
 }
 
+#ifdef HAVE_LIBWXWIDGETS
+class MyApp : public wxApp
+{
+public:
+    virtual bool OnInit();
+};
+wxIMPLEMENT_APP(MyApp);
+int mymain(int argc, char *argv[]);
+bool MyApp::OnInit()
+{
+  return !mymain(argc, argv);
+}
+int mymain(int argc, char *argv[])
+#else
 int main(int argc, char *argv[])
+#endif
 {
 
   // indicates if the user wants to see the welcome message
diff --git a/src/gdlwidget.cpp b/src/gdlwidget.cpp
index 3794922d..d30958f2 100644
--- a/src/gdlwidget.cpp
+++ b/src/gdlwidget.cpp
@@ -653,7 +653,7 @@ extern "C" { void CPSEnableForegroundOperation( ProcessSerialNumber* psn ); }
         return new wxAppGDL;
     }
     wxAppInitializer  wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp);
-#else
+#elif 0
     wxApp& wxGetApp() { return *static_cast<wxApp*>(wxApp::GetInstance()); }
     wxAppConsole *wxCreateApp()
     {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions