CVS: seamlessrdp/ServerExe/HookDll hookdll.c, 1.43, 1.44

Peter Åstrand <[email protected]> Tue, 11 Mar 2008 01:21:35 -0700
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/seamlessrdp/ServerExe/HookDll
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv16920/HookDll

Modified Files:
	hookdll.c 
Log Message:
Cleaner solution for the problem with menus disappearing on
SetForegroundWindow.



Index: hookdll.c
===================================================================
RCS file: /cvsroot/rdesktop/seamlessrdp/ServerExe/HookDll/hookdll.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** hookdll.c	6 Mar 2008 15:41:11 -0000	1.43
--- hookdll.c	11 Mar 2008 08:21:33 -0000	1.44
***************
*** 90,93 ****
--- 90,103 ----
  }
  
+ /* Returns true if a window is a menu window. */
+ static BOOL
+ is_menu(HWND hwnd)
+ {
+ 	HWND owner = GetWindow(hwnd, GW_OWNER);
+ 	LONG exstyle = GetWindowLong(hwnd, GWL_EXSTYLE);
+ 	return (exstyle & (WS_EX_TOOLWINDOW | WS_EX_TOPMOST)) && owner;
+ 
+ }
+ 
  /* Determine the "parent" field for the CREATE response. */
  static HWND
***************
*** 590,596 ****
  	if (msg == g_wm_seamless_focus)
  	{
! 		/* FIXME: SetForegroundWindow() kills menus. Need to find a
! 		   clean way to solve this. */
! 		if ((GetForegroundWindow() != hwnd) && !get_parent(hwnd))
  			SetForegroundWindow(hwnd);
  
--- 600,606 ----
  	if (msg == g_wm_seamless_focus)
  	{
! 		/* For some reason, SetForegroundWindow() on menus
! 		   closes them. Ignore focus requests for menu windows. */
! 		if ((GetForegroundWindow() != hwnd) && !is_menu(hwnd))
  			SetForegroundWindow(hwnd);
  


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/