mirror of https://github.com/BOINC/boinc.git
Mac: Refine big fix for menubar icon menu not working after changing skin
svn path=/trunk/boinc/; revision=23819
This commit is contained in:
parent
f60700cff4
commit
3e0055cbe0
|
@ -3960,3 +3960,11 @@ David 7 July 2011
|
||||||
|
|
||||||
client/
|
client/
|
||||||
client_types.cpp
|
client_types.cpp
|
||||||
|
|
||||||
|
Charlie 8 July 2011
|
||||||
|
- Mac: Refine big fix for menubar icon menu not working after changing skin.
|
||||||
|
|
||||||
|
clientgui/
|
||||||
|
BOINCTaskBar.cpp
|
||||||
|
mac/
|
||||||
|
MacSysMenu.cpp, .h
|
||||||
|
|
|
@ -325,7 +325,8 @@ void CTaskBarIcon::OnReloadSkin(CTaskbarEvent& WXUNUSED(event)) {
|
||||||
m_iconTaskBarSnooze = *pSkinAdvanced->GetApplicationSnoozeIcon();
|
m_iconTaskBarSnooze = *pSkinAdvanced->GetApplicationSnoozeIcon();
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
wxGetApp().GetMacSystemMenu()->BuildMenu();
|
// For unknown reasons, menus won't work if we call BuildMenu() here
|
||||||
|
wxGetApp().GetMacSystemMenu()->SetNeedToRebuildMenu();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,8 @@ CMacSystemMenu::CMacSystemMenu(wxString title, wxIcon* icon, wxIcon* iconDisconn
|
||||||
: CTaskBarIcon(title, icon, iconDisconnected, iconSnooze) {
|
: CTaskBarIcon(title, icon, iconDisconnected, iconSnooze) {
|
||||||
CFBundleRef SysMenuBundle = NULL;
|
CFBundleRef SysMenuBundle = NULL;
|
||||||
|
|
||||||
m_OpeningAboutDlg = false;
|
m_bOpeningAboutDlg = false;
|
||||||
|
m_bNeedRebuildMenu = false;
|
||||||
|
|
||||||
LoadPrivateFrameworkBundle( CFSTR("SystemMenu.bundle"), &SysMenuBundle );
|
LoadPrivateFrameworkBundle( CFSTR("SystemMenu.bundle"), &SysMenuBundle );
|
||||||
if ( SysMenuBundle != NULL )
|
if ( SysMenuBundle != NULL )
|
||||||
|
@ -163,17 +164,23 @@ CMacSystemMenu::~CMacSystemMenu() {
|
||||||
// Set the System Menu Icon from XPM data
|
// Set the System Menu Icon from XPM data
|
||||||
bool CMacSystemMenu::SetIcon(const wxIcon& icon) {
|
bool CMacSystemMenu::SetIcon(const wxIcon& icon) {
|
||||||
wxBitmap theBits;
|
wxBitmap theBits;
|
||||||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
||||||
wxASSERT(pDoc);
|
|
||||||
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
||||||
|
|
||||||
theBits.CopyFromIcon(icon);
|
// For unknown reasons, menus won't work if we call BuildMenu() directly
|
||||||
CGImageRef imageRef = (CGImageRef)theBits.CGImageCreate();
|
// from CTaskBarIcon::OnReloadSkin(), so it sets a flag to call it here
|
||||||
if ( (SetSystemMenuIcon != NULL ) && (imageRef != NULL) ) {
|
if (m_bNeedRebuildMenu) {
|
||||||
if (pDoc->IsConnected()) {
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||||
|
wxASSERT(pDoc);
|
||||||
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
||||||
|
if (pDoc->IsConnected() && m_bNeedRebuildMenu) {
|
||||||
// For unknown reasons, Menubar Icon menu doesn't work without this
|
// For unknown reasons, Menubar Icon menu doesn't work without this
|
||||||
BuildMenu();
|
BuildMenu();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
m_bNeedRebuildMenu = false;
|
||||||
|
|
||||||
|
theBits.CopyFromIcon(icon);
|
||||||
|
CGImageRef imageRef = (CGImageRef)theBits.CGImageCreate();
|
||||||
|
if ( (SetSystemMenuIcon != NULL) && (imageRef != NULL) ) {
|
||||||
SetSystemMenuIcon(imageRef);
|
SetSystemMenuIcon(imageRef);
|
||||||
CGImageRelease( imageRef );
|
CGImageRelease( imageRef );
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -42,8 +42,9 @@ public:
|
||||||
SetUpSystemMenuProc SetUpSystemMenu;
|
SetUpSystemMenuProc SetUpSystemMenu;
|
||||||
SetSystemMenuIconProc SetSystemMenuIcon;
|
SetSystemMenuIconProc SetSystemMenuIcon;
|
||||||
|
|
||||||
bool IsOpeningAboutDlg() { return m_OpeningAboutDlg; }
|
bool IsOpeningAboutDlg() { return m_bOpeningAboutDlg; }
|
||||||
void SetOpeningAboutDlg(bool b) { m_OpeningAboutDlg = b; }
|
void SetOpeningAboutDlg(bool b) { m_bOpeningAboutDlg = b; }
|
||||||
|
void SetNeedToRebuildMenu() { m_bNeedRebuildMenu = true; }
|
||||||
void BuildMenu(void);
|
void BuildMenu(void);
|
||||||
#if wxCHECK_VERSION(2,8,0)
|
#if wxCHECK_VERSION(2,8,0)
|
||||||
wxMenu *GetCurrentMenu();
|
wxMenu *GetCurrentMenu();
|
||||||
|
@ -51,7 +52,8 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool m_OpeningAboutDlg;
|
bool m_bOpeningAboutDlg;
|
||||||
|
bool m_bNeedRebuildMenu;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue