From 213425fd11ac2fceeda65ea0a638b4011e6163d5 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Mon, 13 Jun 2016 15:38:19 +0200 Subject: [PATCH] Global hot-key registration moved as late as possible to avoid non-effective registration at auto start-up --- ZRCola/zrcolafrm.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ZRCola/zrcolafrm.cpp b/ZRCola/zrcolafrm.cpp index 3b823bf..68386b8 100644 --- a/ZRCola/zrcolafrm.cpp +++ b/ZRCola/zrcolafrm.cpp @@ -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;