Global hot-key registration moved as late as possible to avoid non-effective registration at auto start-up

This commit is contained in:
Simon Rozman 2016-06-13 15:38:19 +02:00
parent 689c72e7e7
commit 213425fd11

View File

@ -106,12 +106,6 @@ wxZRColaFrame::wxZRColaFrame() :
// Set focus.
m_panel->m_decomposed->SetFocus();
// Register global hotkey(s).
if (!RegisterHotKey(wxZRColaHKID_INVOKE_COMPOSE, wxMOD_WIN, VK_F5))
wxMessageBox(_("ZRCola keyboard shortcut Win+F5 could not be registered. Some functionality will not be available."), _("Warning"), wxOK | wxICON_WARNING);
if (!RegisterHotKey(wxZRColaHKID_INVOKE_DECOMPOSE, wxMOD_WIN, VK_F6))
wxMessageBox(_("ZRCola keyboard shortcut Win+F6 could not be registered. Some functionality will not be available."), _("Warning"), wxOK | wxICON_WARNING);
#if defined(__WXMSW__)
// Register notification sink for language detection.
m_ulRefCount = 1;
@ -141,11 +135,21 @@ wxZRColaFrame::wxZRColaFrame() :
// Restore persistent state of wxAuiManager manually, since m_mgr is not on the heap.
wxPersistentAuiManager(&m_mgr).Restore();
// Register global hotkey(s).
if (!RegisterHotKey(wxZRColaHKID_INVOKE_COMPOSE, wxMOD_WIN, VK_F5))
wxMessageBox(_("ZRCola keyboard shortcut Win+F5 could not be registered. Some functionality will not be available."), _("Warning"), wxOK | wxICON_WARNING);
if (!RegisterHotKey(wxZRColaHKID_INVOKE_DECOMPOSE, wxMOD_WIN, VK_F6))
wxMessageBox(_("ZRCola keyboard shortcut Win+F6 could not be registered. Some functionality will not be available."), _("Warning"), wxOK | wxICON_WARNING);
}
wxZRColaFrame::~wxZRColaFrame()
{
// Unregister global hotkey(s).
UnregisterHotKey(wxZRColaHKID_INVOKE_DECOMPOSE);
UnregisterHotKey(wxZRColaHKID_INVOKE_COMPOSE);
#if defined(__WXMSW__)
if (m_tfSource) {
m_tfSource->UnadviseSink(m_dwCookie);
@ -153,10 +157,6 @@ wxZRColaFrame::~wxZRColaFrame()
}
#endif
// Unregister global hotkey(s).
UnregisterHotKey(wxZRColaHKID_INVOKE_DECOMPOSE);
UnregisterHotKey(wxZRColaHKID_INVOKE_COMPOSE);
if (m_chrReq)
delete m_chrReq;