CVS: seamlessrdp/ServerExe/HookDll hookdll.c,1.30,1.31

Pierre Ossman <[email protected]> Mon, 20 Mar 2006 06:35:06 -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-serv19607/ServerExe/HookDll

Modified Files:
	hookdll.c 
Log Message:
Restructure ACK:s of POSITION a bit since Windows can ignore some requests.


Index: hookdll.c
===================================================================
RCS file: /cvsroot/rdesktop/seamlessrdp/ServerExe/HookDll/hookdll.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** hookdll.c	20 Mar 2006 12:28:03 -0000	1.30
--- hookdll.c	20 Mar 2006 14:35:02 -0000	1.31
***************
*** 82,91 ****
  	unsigned int serial;
  
- 	if (!GetWindowRect(hwnd, &rect))
- 	{
- 		debug("GetWindowRect failed!\n");
- 		return;
- 	}
- 
  	WaitForSingleObject(g_mutex, INFINITE);
  	blocked_hwnd = g_block_move_hwnd;
--- 82,85 ----
***************
*** 94,105 ****
  	ReleaseMutex(g_mutex);
  
  	if ((hwnd == blocked_hwnd) && (rect.left == blocked.left) && (rect.top == blocked.top)
  	    && (rect.right == blocked.right) && (rect.bottom == blocked.bottom))
! 		vchannel_write("ACK", "%u", serial);
! 	else
! 		vchannel_write("POSITION", "0x%p,%d,%d,%d,%d,0x%x",
! 			       hwnd,
! 			       rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
! 			       0);
  }
  
--- 88,109 ----
  	ReleaseMutex(g_mutex);
  
+ 	vchannel_block();
+ 
+ 	if (!GetWindowRect(hwnd, &rect))
+ 	{
+ 		debug("GetWindowRect failed!\n");
+ 		goto end;
+ 	}
+ 
  	if ((hwnd == blocked_hwnd) && (rect.left == blocked.left) && (rect.top == blocked.top)
  	    && (rect.right == blocked.right) && (rect.bottom == blocked.bottom))
! 		goto end;
! 
! 	vchannel_write("POSITION", "0x%p,%d,%d,%d,%d,0x%x",
! 		       hwnd,
! 		       rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, 0);
! 
!       end:
! 	vchannel_unblock();
  }
  
***************
*** 117,120 ****
--- 121,126 ----
  	ReleaseMutex(g_mutex);
  
+ 	vchannel_block();
+ 
  	behind = GetNextWindow(hwnd, GW_HWNDPREV);
  	while (behind)
***************
*** 134,137 ****
--- 140,145 ----
  	else
  		vchannel_write("ZCHANGE", "0x%p,0x%p,0x%x", hwnd, behind, 0);
+ 
+ 	vchannel_unblock();
  }
  
***************
*** 403,422 ****
  	RECT rect;
  
- 	vchannel_block();
- 
- 	if (!GetWindowRect(hwnd, &rect))
- 	{
- 		vchannel_unblock();
- 		debug("GetWindowRect failed!\n");
- 		return;
- 	}
- 
- 	if ((rect.left == x) && (rect.top == y) && (rect.right == x + width)
- 	    && (rect.bottom == y + height))
- 	{
- 		vchannel_write("ACK", "%u", serial);
- 		vchannel_unblock();
- 	}
- 
  	WaitForSingleObject(g_mutex, INFINITE);
  	g_block_move_hwnd = hwnd;
--- 411,414 ----
***************
*** 428,435 ****
  	ReleaseMutex(g_mutex);
  
- 	vchannel_unblock();
- 
  	SetWindowPos(hwnd, NULL, x, y, width, height, SWP_NOACTIVATE | SWP_NOZORDER);
  
  	WaitForSingleObject(g_mutex, INFINITE);
  	g_block_move_hwnd = NULL;
--- 420,433 ----
  	ReleaseMutex(g_mutex);
  
  	SetWindowPos(hwnd, NULL, x, y, width, height, SWP_NOACTIVATE | SWP_NOZORDER);
  
+ 	vchannel_write("ACK", "%u", serial);
+ 
+ 	if (!GetWindowRect(hwnd, &rect))
+ 		debug("GetWindowRect failed!\n");
+ 	else if ((rect.left != x) || (rect.top != y) || (rect.right != x + width)
+ 		 || (rect.bottom != y + height))
+ 		update_position(hwnd);
+ 
  	WaitForSingleObject(g_mutex, INFINITE);
  	g_block_move_hwnd = NULL;
***************
*** 494,497 ****
--- 492,496 ----
  		vchannel_write("ACK", "%u", serial);
  		vchannel_unblock();
+ 		return;
  	}
  



-------------------------------------------------------
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