mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-06-07 07:14:27 +00:00
[idd] helper: defer no GPU notification when needed
No GPU notifications are not possible before the notification icon is created. Since the helper could start before explorer.exe (and often does on reboot), the notification would fail. This commit adds logic to refer the notification and we send it immediately when successfully creating the notification icon.
This commit is contained in:
@@ -48,8 +48,8 @@ bool CNotifyWindow::registerClass()
|
|||||||
return s_atom;
|
return s_atom;
|
||||||
}
|
}
|
||||||
|
|
||||||
CNotifyWindow::CNotifyWindow() : m_iconData({ 0 }), m_menu(CreatePopupMenu()),
|
CNotifyWindow::CNotifyWindow() : m_iconData({ 0 }), m_iconRegistered(false),
|
||||||
closeRequested(false)
|
m_noGPUQueued(false), m_menu(CreatePopupMenu()), closeRequested(false)
|
||||||
{
|
{
|
||||||
CreateWindowEx(0, MAKEINTATOM(s_atom), NULL,
|
CreateWindowEx(0, MAKEINTATOM(s_atom), NULL,
|
||||||
0, 0, 0, 0, 0, NULL, NULL, hInstance, this);
|
0, 0, 0, 0, 0, NULL, NULL, hInstance, this);
|
||||||
@@ -164,13 +164,23 @@ void CNotifyWindow::registerIcon()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_iconRegistered = true;
|
||||||
if (!Shell_NotifyIcon(NIM_SETVERSION, &m_iconData))
|
if (!Shell_NotifyIcon(NIM_SETVERSION, &m_iconData))
|
||||||
DEBUG_ERROR_HR(GetLastError(), "Shell_NotifyIcon(NIM_SETVERSION)");
|
DEBUG_ERROR_HR(GetLastError(), "Shell_NotifyIcon(NIM_SETVERSION)");
|
||||||
|
|
||||||
|
if (m_noGPUQueued)
|
||||||
|
{
|
||||||
|
m_noGPUQueued = false;
|
||||||
|
handleNoGPUNotification();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CNotifyWindow::noGPUNotification()
|
void CNotifyWindow::noGPUNotification()
|
||||||
{
|
{
|
||||||
PostMessage(m_hwnd, WM_NO_GPU, 0, 0);
|
if (m_iconRegistered)
|
||||||
|
PostMessage(m_hwnd, WM_NO_GPU, 0, 0);
|
||||||
|
else
|
||||||
|
m_noGPUQueued = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CNotifyWindow::handleNoGPUNotification()
|
void CNotifyWindow::handleNoGPUNotification()
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ class CNotifyWindow : public CWindow
|
|||||||
static ATOM s_atom;
|
static ATOM s_atom;
|
||||||
|
|
||||||
NOTIFYICONDATA m_iconData;
|
NOTIFYICONDATA m_iconData;
|
||||||
|
bool m_iconRegistered;
|
||||||
|
bool m_noGPUQueued;
|
||||||
HMENU m_menu;
|
HMENU m_menu;
|
||||||
bool closeRequested;
|
bool closeRequested;
|
||||||
std::unique_ptr<CConfigWindow> m_config;
|
std::unique_ptr<CConfigWindow> m_config;
|
||||||
|
|||||||
Reference in New Issue
Block a user