CVS: seamlessrdp/ServerExe/HookDll hookdll.c,1.25,1.26

Pierre Ossman <[email protected]> Fri, 17 Mar 2006 08:23:11 -0800
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/seamlessrdp/ServerExe/HookDll
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18287/ServerExe/HookDll

Modified Files:
	hookdll.c 
Log Message:
Break loops caused by STATE.


Index: hookdll.c
===================================================================
RCS file: /cvsroot/rdesktop/seamlessrdp/ServerExe/HookDll/hookdll.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** hookdll.c	17 Mar 2006 13:11:20 -0000	1.25
--- hookdll.c	17 Mar 2006 16:23:08 -0000	1.26
***************
*** 49,52 ****
--- 49,53 ----
  HWND g_blocked_zchange[2] SHARED = { NULL, NULL };
  HWND g_blocked_focus SHARED = NULL;
+ int g_blocked_state SHARED = -1;
  
  #pragma data_seg ()
***************
*** 125,129 ****
  	switch (msg)
  	{
- 
  		case WM_WINDOWPOSCHANGED:
  			{
--- 126,129 ----
***************
*** 285,289 ****
  		case HCBT_MINMAX:
  			{
! 				int show, state;
  
  				show = LOWORD(lparam);
--- 285,293 ----
  		case HCBT_MINMAX:
  			{
! 				int show, state, blocked;
! 
! 				WaitForSingleObject(g_mutex, INFINITE);
! 				blocked = g_blocked_state;
! 				ReleaseMutex(g_mutex);
  
  				show = LOWORD(lparam);
***************
*** 301,305 ****
  					break;
  				}
! 				vchannel_write("STATE,0x%p,0x%x,0x%x", (HWND) wparam, state, 0);
  				break;
  			}
--- 305,313 ----
  					break;
  				}
! 
! 				if (blocked != state)
! 					vchannel_write("STATE,0x%p,0x%x,0x%x", (HWND) wparam, state,
! 						       0);
! 
  				break;
  			}
***************
*** 390,393 ****
--- 398,422 ----
  }
  
+ DLL_EXPORT void
+ SafeSetState(HWND hwnd, int state)
+ {
+ 	WaitForSingleObject(g_mutex, INFINITE);
+ 	g_blocked_state = state;
+ 	ReleaseMutex(g_mutex);
+ 
+ 	if (state == 0)
+ 		ShowWindow(hwnd, SW_RESTORE);
+ 	else if (state == 1)
+ 		ShowWindow(hwnd, SW_MINIMIZE);
+ 	else if (state == 2)
+ 		ShowWindow(hwnd, SW_MAXIMIZE);
+ 	else
+ 		debug("Invalid state %d sent.", state);
+ 
+ 	WaitForSingleObject(g_mutex, INFINITE);
+ 	g_blocked_state = -1;
+ 	ReleaseMutex(g_mutex);
+ }
+ 
  DLL_EXPORT int
  GetInstanceCount()



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642