mirror of
				https://github.com/gnif/LookingGlass.git
				synced 2025-10-31 20:52:09 +00:00 
			
		
		
		
	[host] windows: plumb guest activation request to host
This commit is contained in:
		 Tudor Brindus
					Tudor Brindus
				
			
				
					committed by
					
						 Geoffrey McRae
						Geoffrey McRae
					
				
			
			
				
	
			
			
			 Geoffrey McRae
						Geoffrey McRae
					
				
			
						parent
						
							fd28d0604e
						
					
				
				
					commit
					809e1095bd
				
			| @@ -28,7 +28,7 @@ | ||||
| #include "types.h" | ||||
|  | ||||
| #define KVMFR_MAGIC   "KVMFR---" | ||||
| #define KVMFR_VERSION 16 | ||||
| #define KVMFR_VERSION 17 | ||||
|  | ||||
| #define KVMFR_MAX_DAMAGE_RECTS 64 | ||||
|  | ||||
|   | ||||
| @@ -44,6 +44,7 @@ const char * os_getExecutable(); | ||||
| const char * os_getDataPath(); | ||||
| void os_showMessage(const char * caption, const char * msg); | ||||
|  | ||||
| bool os_getAndClearPendingActivationRequest(void); | ||||
| bool os_blockScreensaver(); | ||||
| bool os_hasSetCursorPos(void); | ||||
| void os_setCursorPos(int x, int y); | ||||
|   | ||||
| @@ -81,6 +81,12 @@ const char * os_getDataPath(void) | ||||
|   return app.dataPath; | ||||
| } | ||||
|  | ||||
| bool os_getAndClearPendingActivationRequest(void) | ||||
| { | ||||
|   // TODO | ||||
|   return false; | ||||
| } | ||||
|  | ||||
| bool os_blockScreensaver() | ||||
| { | ||||
|   return false; | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -276,7 +276,7 @@ static bool sendFrame(void) | ||||
|   fi->pitch             = frame.pitch; | ||||
|   fi->offset            = app.pageSize - FrameBufferStructSize; | ||||
|   fi->blockScreensaver  = os_blockScreensaver(); | ||||
|   fi->requestActivation = true; // TODO | ||||
|   fi->requestActivation = os_getAndClearPendingActivationRequest(); | ||||
|   app.frameValid        = true; | ||||
|  | ||||
|   fi->damageRectsCount  = frame.damageRectsCount; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user