Browse Source

Merge pull request #2530 from jonasschnelli/mac_win_reopen_fix

fixes #1522: GUI Disappearing (Mac OSX)
0.8
Wladimir J. van der Laan 12 years ago
parent
commit
63888d43be
  1. 2
      src/qt/bitcoingui.cpp
  2. 4
      src/qt/macdockiconhandler.h
  3. 11
      src/qt/macdockiconhandler.mm

2
src/qt/bitcoingui.cpp

@ -153,6 +153,7 @@ BitcoinGUI::~BitcoinGUI() @@ -153,6 +153,7 @@ BitcoinGUI::~BitcoinGUI()
trayIcon->hide();
#ifdef Q_OS_MAC
delete appMenuBar;
MacDockIconHandler::instance()->setMainWindow(NULL);
#endif
}
@ -380,6 +381,7 @@ void BitcoinGUI::createTrayIconMenu() @@ -380,6 +381,7 @@ void BitcoinGUI::createTrayIconMenu()
#else
// Note: On Mac, the dock icon is used to provide the tray's functionality.
MacDockIconHandler *dockIconHandler = MacDockIconHandler::instance();
dockIconHandler->setMainWindow((QMainWindow *)this);
trayIconMenu = dockIconHandler->dockMenu();
#endif

4
src/qt/macdockiconhandler.h

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
#define MACDOCKICONHANDLER_H
#include <QObject>
#include <QMainWindow>
QT_BEGIN_NAMESPACE
class QMenu;
@ -26,7 +27,7 @@ public: @@ -26,7 +27,7 @@ public:
QMenu *dockMenu();
void setIcon(const QIcon &icon);
void setMainWindow(QMainWindow *window);
static MacDockIconHandler *instance();
void handleDockIconClickEvent();
@ -40,6 +41,7 @@ private: @@ -40,6 +41,7 @@ private:
DockIconClickEventHandler *m_dockIconClickEventHandler;
QWidget *m_dummyWidget;
QMenu *m_dockMenu;
QMainWindow *mainWindow;
};
#endif // MACDOCKICONCLICKHANDLER_H

11
src/qt/macdockiconhandler.mm

@ -37,8 +37,9 @@ extern void qt_mac_set_dock_menu(QMenu*); @@ -37,8 +37,9 @@ extern void qt_mac_set_dock_menu(QMenu*);
Q_UNUSED(event)
Q_UNUSED(replyEvent)
if (dockIconHandler)
if (dockIconHandler) {
dockIconHandler->handleDockIconClickEvent();
}
}
@end
@ -54,10 +55,15 @@ MacDockIconHandler::MacDockIconHandler() : QObject() @@ -54,10 +55,15 @@ MacDockIconHandler::MacDockIconHandler() : QObject()
[pool release];
}
void MacDockIconHandler::setMainWindow(QMainWindow *window) {
this->mainWindow = window;
}
MacDockIconHandler::~MacDockIconHandler()
{
[this->m_dockIconClickEventHandler release];
delete this->m_dummyWidget;
this->setMainWindow(NULL);
}
QMenu *MacDockIconHandler::dockMenu()
@ -94,5 +100,8 @@ MacDockIconHandler *MacDockIconHandler::instance() @@ -94,5 +100,8 @@ MacDockIconHandler *MacDockIconHandler::instance()
void MacDockIconHandler::handleDockIconClickEvent()
{
this->mainWindow->activateWindow();
this->mainWindow->show();
emit this->dockIconClicked();
}

Loading…
Cancel
Save