[host] windows: plumb guest activation request to host

This commit is contained in:
Tudor Brindus
2022-02-06 22:39:42 -05:00
committed by Geoffrey McRae
parent fd28d0604e
commit 809e1095bd
5 changed files with 29 additions and 2 deletions

View File

@@ -81,6 +81,12 @@ const char * os_getDataPath(void)
return app.dataPath;
}
bool os_getAndClearPendingActivationRequest(void)
{
// TODO
return false;
}
bool os_blockScreensaver()
{
return false;

View File

@@ -59,11 +59,14 @@ struct AppState
char systemLogDir[MAX_PATH];
char * osVersion;
HWND messageWnd;
UINT shellHookMsg;
NOTIFYICONDATA iconData;
UINT trayRestartMsg;
HMENU trayMenu;
HANDLE exitWait;
HANDLE taskHandle;
_Atomic(bool) hasPendingActivationRequest;
};
static struct AppState app = {0};
@@ -254,6 +257,14 @@ LRESULT CALLBACK DummyWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
default:
if (msg == app.trayRestartMsg)
RegisterTrayIcon();
else if (msg == app.shellHookMsg)
{
switch (LOWORD(wParam))
{
case HSHELL_FLASH:
atomic_store(&app.hasPendingActivationRequest, true);
}
}
break;
}
@@ -403,6 +414,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
// set the global
MessageHWND = app.messageWnd;
// get shell events (e.g., for activation requests)
app.shellHookMsg = RegisterWindowMessage(TEXT("SHELLHOOK"));
RegisterShellHookWindow(app.messageWnd);
app.trayMenu = CreatePopupMenu();
AppendMenu(app.trayMenu, MF_STRING , ID_MENU_SHOW_LOG, "Open Log File");
AppendMenu(app.trayMenu, MF_SEPARATOR, 0 , NULL );
@@ -573,6 +588,11 @@ HWND os_getMessageWnd(void)
return app.messageWnd;
}
bool os_getAndClearPendingActivationRequest(void)
{
return atomic_exchange(&app.hasPendingActivationRequest, false);
}
bool os_blockScreensaver()
{
static bool lastResult = false;