CVS: seamlessrdp/ServerExe main.c,1.21,1.22

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

Modified Files:
	main.c 
Log Message:
Encapsulate ZCHANGE and FOCUS requests into safe wrappers to avoid loops.
Setting focus also needed a hack because it killed off menus.


Index: main.c
===================================================================
RCS file: /cvsroot/rdesktop/seamlessrdp/ServerExe/main.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** main.c	17 Mar 2006 10:48:55 -0000	1.21
--- main.c	17 Mar 2006 13:11:20 -0000	1.22
***************
*** 34,40 ****
  #define APP_NAME "SeamlessRDP Shell"
  
- #define FOCUS_MSG_NAME "WM_SEAMLESS_FOCUS"
- static UINT g_wm_seamless_focus;
- 
  #ifndef WM_WTSSESSION_CHANGE
  #define WM_WTSSESSION_CHANGE 0x02B1
--- 34,37 ----
***************
*** 53,58 ****
--- 50,59 ----
  
  typedef void (*move_window_proc_t) (HWND hwnd, int x, int y, int width, int height);
+ typedef void (*zchange_proc_t) (HWND hwnd, HWND behind);
+ typedef void (*focus_proc_t) (HWND hwnd);
  
  static move_window_proc_t g_move_window_fn = NULL;
+ static zchange_proc_t g_zchange_fn = NULL;
+ static focus_proc_t g_focus_fn = NULL;
  
  static void
***************
*** 168,174 ****
  do_zchange(HWND hwnd, HWND behind)
  {
! 	if (behind == NULL)
! 		behind = HWND_TOP;
! 	SetWindowPos(hwnd, behind, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
  }
  
--- 169,173 ----
  do_zchange(HWND hwnd, HWND behind)
  {
! 	g_zchange_fn(hwnd, behind);
  }
  
***************
*** 176,180 ****
  do_focus(HWND hwnd)
  {
! 	SendMessage(hwnd, g_wm_seamless_focus, 0, 0);
  }
  
--- 175,179 ----
  do_focus(HWND hwnd)
  {
! 	g_focus_fn(hwnd);
  }
  
***************
*** 289,294 ****
  	instance_count_fn = (get_instance_count_proc_t) GetProcAddress(hookdll, "GetInstanceCount");
  	g_move_window_fn = (move_window_proc_t) GetProcAddress(hookdll, "SafeMoveWindow");
  
! 	if (!set_hooks_fn || !remove_hooks_fn || !instance_count_fn || !g_move_window_fn)
  	{
  		FreeLibrary(hookdll);
--- 288,296 ----
  	instance_count_fn = (get_instance_count_proc_t) GetProcAddress(hookdll, "GetInstanceCount");
  	g_move_window_fn = (move_window_proc_t) GetProcAddress(hookdll, "SafeMoveWindow");
+ 	g_zchange_fn = (zchange_proc_t) GetProcAddress(hookdll, "SafeZChange");
+ 	g_focus_fn = (focus_proc_t) GetProcAddress(hookdll, "SafeFocus");
  
! 	if (!set_hooks_fn || !remove_hooks_fn || !instance_count_fn || !g_move_window_fn
! 	    || !g_zchange_fn || !g_focus_fn)
  	{
  		FreeLibrary(hookdll);
***************
*** 312,317 ****
  	}
  
- 	g_wm_seamless_focus = RegisterWindowMessage(FOCUS_MSG_NAME);
- 
  	WTSRegisterSessionNotification(g_hwnd, NOTIFY_FOR_THIS_SESSION);
  
--- 314,317 ----



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