CVS: seamlessrdp/ServerExe/HookDll hookdll.c,1.32,1.33

Pierre Ossman <[email protected]> Tue, 21 Mar 2006 06:58:35 -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-serv22668/ServerExe/HookDll

Modified Files:
	hookdll.c 
Log Message:
Also check window owner since it fall into our definition of "parent".


Index: hookdll.c
===================================================================
RCS file: /cvsroot/rdesktop/seamlessrdp/ServerExe/HookDll/hookdll.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** hookdll.c	21 Mar 2006 14:38:38 -0000	1.32
--- hookdll.c	21 Mar 2006 14:58:29 -0000	1.33
***************
*** 144,147 ****
--- 144,185 ----
  }
  
+ static HWND
+ get_parent(HWND hwnd)
+ {
+ 	LONG style;
+ 	HWND parent;
+ 
+ 	style = GetWindowLong(hwnd, GWL_STYLE);
+ 
+ 	if (style & (WS_POPUP | DS_MODALFRAME))
+ 	{
+ 		parent = (HWND) GetWindowLong(hwnd, GWL_HWNDPARENT);
+ 
+ 		if (parent)
+ 		{
+ 			style = GetWindowLong(parent, GWL_STYLE);
+ 			if (((style & WS_CHILD) && !(style & WS_POPUP)) || !(style & WS_VISIBLE))
+ 				parent = NULL;
+ 		}
+ 
+ 		if (!parent)
+ 			parent = GetWindow(hwnd, GW_OWNER);
+ 
+ 		if (parent)
+ 		{
+ 			style = GetWindowLong(parent, GWL_STYLE);
+ 			if (((style & WS_CHILD) && !(style & WS_POPUP)) || !(style & WS_VISIBLE))
+ 				parent = NULL;
+ 		}
+ 
+ 		if (!parent)
+ 			parent = (HWND) - 1;
+ 	}
+ 	else
+ 		parent = NULL;
+ 
+ 	return parent;
+ }
+ 
  static LRESULT CALLBACK
  wndproc_hook_proc(int code, WPARAM cur_thread, LPARAM details)
***************
*** 169,180 ****
  		goto end;
  
! 	if (style & WS_POPUP)
! 	{
! 		parent = (HWND) GetWindowLong(hwnd, GWL_HWNDPARENT);
! 		if (!parent)
! 			parent = (HWND) - 1;
! 	}
! 	else
! 		parent = NULL;
  
  	switch (msg)
--- 207,211 ----
  		goto end;
  
! 	parent = get_parent(hwnd);
  
  	switch (msg)
***************
*** 281,292 ****
  		goto end;
  
! 	if (style & WS_POPUP)
! 	{
! 		parent = (HWND) GetWindowLong(hwnd, GWL_HWNDPARENT);
! 		if (!parent)
! 			parent = (HWND) - 1;
! 	}
! 	else
! 		parent = NULL;
  
  	switch (msg)
--- 312,316 ----
  		goto end;
  
! 	parent = get_parent(hwnd);
  
  	switch (msg)



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