diff --git a/idd/LGIddHelper/CNotifyWindow.cpp b/idd/LGIddHelper/CNotifyWindow.cpp index 34b90526..50c3490a 100644 --- a/idd/LGIddHelper/CNotifyWindow.cpp +++ b/idd/LGIddHelper/CNotifyWindow.cpp @@ -169,7 +169,35 @@ void CNotifyWindow::registerIcon() else if (hasGPU) DEBUG_INFO("GPU identified"); else + { DEBUG_INFO("System has no GPU"); + noGPUNotification(); + } +} + +void CNotifyWindow::noGPUNotification() +{ + CRegistrySettings settings; + LSTATUS error = settings.open(); + if (error != ERROR_SUCCESS) + DEBUG_ERROR_HR(error, "Failed to load settings"); + + auto noGPU = settings.getNoGPU(); + if (noGPU.has_value() && noGPU.value()) + return; + + NOTIFYICONDATA nid; + memcpy(&nid, &m_iconData, sizeof nid); + + nid.uFlags = NIF_INFO; + nid.dwInfoFlags = NIIF_WARNING; + StringCbCopy(nid.szInfoTitle, sizeof nid.szInfoTitle, L"No GPU found!"); + StringCbCopy(nid.szInfo, sizeof nid.szInfo, + L"GPU acceleration will not be available. " + L"Looking Glass will use software rendering."); + + if (!Shell_NotifyIcon(NIM_MODIFY, &nid)) + DEBUG_ERROR_HR(GetLastError(), "Shell_NotifyIcon(NIM_MODIFY)"); } HWND CNotifyWindow::hwndDialog() diff --git a/idd/LGIddHelper/CNotifyWindow.h b/idd/LGIddHelper/CNotifyWindow.h index 3f8c3ad1..3f30c1fd 100644 --- a/idd/LGIddHelper/CNotifyWindow.h +++ b/idd/LGIddHelper/CNotifyWindow.h @@ -36,6 +36,7 @@ class CNotifyWindow : public CWindow LRESULT onNotifyIcon(UINT uEvent, WORD wIconId, int x, int y); void registerIcon(); + void noGPUNotification(); virtual LRESULT handleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) override; virtual LRESULT onCreate() override;