|
1 | 1 | // This file is part of BOINC. |
2 | 2 | // http://boinc.berkeley.edu |
3 | | -// Copyright (C) 2024 University of California |
| 3 | +// Copyright (C) 2025 University of California |
4 | 4 | // |
5 | 5 | // BOINC is free software; you can redistribute it and/or modify it |
6 | 6 | // under the terms of the GNU Lesser General Public License |
@@ -69,33 +69,7 @@ BEGIN_EVENT_TABLE (CBOINCGUIApp, wxApp) |
69 | 69 | #endif |
70 | 70 | END_EVENT_TABLE () |
71 | 71 |
|
72 | | -#if defined(__WXGTK__) && defined(BUILD_WITH_VCPKG) |
73 | | -extern "C" { |
74 | | - void _gdk_pixbuf__svg_fill_info (void*); |
75 | | - void _gdk_pixbuf__svg_fill_vtable (void*); |
76 | | - unsigned int rsvg_error_quark (void); |
77 | | - void rsvg_handle_get_pixbuf (void*); |
78 | | -} |
79 | | - |
80 | | -typedef void (*GdkPixbufFillInfo) (void*); |
81 | | -typedef void (*GdkPixbufFillVtable) (void*); |
82 | | -typedef unsigned int (*RsvgErrorQuark) (void); |
83 | | -typedef void (*RsvgHandleGetPixbuf) (void*); |
84 | | -#endif |
85 | | - |
86 | 72 | bool CBOINCGUIApp::OnInit() { |
87 | | -#if defined(__WXGTK__) && defined(BUILD_WITH_VCPKG) |
88 | | - try { |
89 | | - GdkPixbufFillInfo fi = _gdk_pixbuf__svg_fill_info; |
90 | | - GdkPixbufFillVtable fv = _gdk_pixbuf__svg_fill_vtable; |
91 | | - RsvgErrorQuark eq = rsvg_error_quark; |
92 | | - RsvgHandleGetPixbuf hp = rsvg_handle_get_pixbuf; |
93 | | - fi(NULL); |
94 | | - fv(NULL); |
95 | | - eq(); |
96 | | - hp(NULL); |
97 | | - } catch (...) {} |
98 | | -#endif |
99 | 73 | // Initialize globals |
100 | 74 | #ifdef SANDBOX |
101 | 75 | g_use_sandbox = true; |
@@ -149,6 +123,7 @@ bool CBOINCGUIApp::OnInit() { |
149 | 123 | m_iDisplayAnotherInstanceRunningDialog = 1; |
150 | 124 | #ifdef __WXMAC__ |
151 | 125 | m_iHideMenuBarIcon = 0; |
| 126 | + m_iWasShutDownBySystem = 0; |
152 | 127 | #endif |
153 | 128 | m_iGUISelected = BOINC_SIMPLEGUI; |
154 | 129 | m_bSafeMessageBoxDisplayed = 0; |
@@ -232,6 +207,18 @@ bool CBOINCGUIApp::OnInit() { |
232 | 207 | m_pConfig->Read(wxT("DisplayAnotherInstanceRunningDialog"), &m_iDisplayAnotherInstanceRunningDialog, 1L); |
233 | 208 | #ifdef __WXMAC__ |
234 | 209 | m_pConfig->Read(wxT("HideMenuBarIcon"), &m_iHideMenuBarIcon, 0L); |
| 210 | + m_pConfig->Read(wxT("WasShutDownBySystem"), &m_iWasShutDownBySystem, 0L); |
| 211 | + // If Manager was hidden and was shut down by system when user last logged |
| 212 | + // out, MacOS's "Reopen windows when logging in" functionality may relaunch |
| 213 | + // us visible before our LaunchAgent launches us with the "autostart" arg. |
| 214 | + // QuitAppleEventHandler() set m_iWasShutDownBySystem to 1, causing |
| 215 | + // CBOINCGUIApp::SaveState to set WasShutDownBySystem in our configuraiton |
| 216 | + // file to tell us to treat this as an autostart and launch hidden. |
| 217 | + if (m_iWasShutDownBySystem) { |
| 218 | + m_iWasShutDownBySystem = 0; |
| 219 | + m_bBOINCMGRAutoStarted = true; |
| 220 | + m_bGUIVisible = false; |
| 221 | + } |
235 | 222 | #endif |
236 | 223 | m_pConfig->Read(wxT("DisableAutoStart"), &m_iBOINCMGRDisableAutoStart, 0L); |
237 | 224 | m_pConfig->Read(wxT("LanguageISO"), &m_strISOLanguageCode, wxT("")); |
@@ -490,6 +477,10 @@ bool CBOINCGUIApp::OnInit() { |
490 | 477 | // Detect if BOINC Manager is already running, if so, bring it into the |
491 | 478 | // foreground and then exit. |
492 | 479 | if (DetectDuplicateInstance()) { |
| 480 | +#ifdef __WXMAC__ |
| 481 | + // Hack to work around an issue with the Mac Installer |
| 482 | + if (m_bBOINCMGRAutoStarted) return false; |
| 483 | +#endif |
493 | 484 | if (GetBOINCMGRDisplayAnotherInstanceRunningMessage()) { |
494 | 485 | wxString appName = m_pSkinManager->GetAdvanced()->GetApplicationName(); |
495 | 486 | wxString message; |
@@ -686,6 +677,7 @@ void CBOINCGUIApp::SaveState() { |
686 | 677 | m_pConfig->Write(wxT("DisplayAnotherInstanceRunningDialog"), m_iDisplayAnotherInstanceRunningDialog); |
687 | 678 | #ifdef __WXMAC__ |
688 | 679 | m_pConfig->Write(wxT("HideMenuBarIcon"), m_iHideMenuBarIcon); |
| 680 | + m_pConfig->Write(wxT("WasShutDownBySystem"), m_iWasShutDownBySystem); |
689 | 681 | #endif |
690 | 682 | m_pConfig->Write(wxT("DisableAutoStart"), m_iBOINCMGRDisableAutoStart); |
691 | 683 | m_pConfig->Write(wxT("RunDaemon"), m_bRunDaemon); |
@@ -1105,19 +1097,17 @@ int CBOINCGUIApp::IdleTrackerDetach() { |
1105 | 1097 | void CBOINCGUIApp::OnActivateApp(wxActivateEvent& event) { |
1106 | 1098 | m_bProcessingActivateAppEvent = true; |
1107 | 1099 |
|
1108 | | - |
1109 | | -#ifndef __WXMSW__ // On Win, the following raises the wrong window |
1110 | | - if (event.GetActive()) |
1111 | | -#endif |
1112 | | - { |
| 1100 | + if (event.GetActive()) { |
1113 | 1101 | #ifdef __WXMAC__ |
1114 | 1102 | ShowInterface(); |
1115 | | -#elif defined(__WXGTK__) |
| 1103 | +#else |
| 1104 | +#ifdef __WXGTK__ |
1116 | 1105 | // Linux allows the Event Log to be brought forward and made active |
1117 | 1106 | // even if we have a modal dialog displayed (associated with our |
1118 | 1107 | // main frame.) This test is needed to allow bringing the modal |
1119 | 1108 | // dialog forward again by clicking on its title bar. |
1120 | 1109 | if (!IsModalDialogDisplayed()) |
| 1110 | +#endif |
1121 | 1111 | { |
1122 | 1112 | bool keepEventLogInFront = m_bEventLogWasActive; |
1123 | 1113 |
|
|
0 commit comments