CVS: seamlessrdp/ServerExe main.c,1.19,1.20

Pierre Ossman <[email protected]> Fri, 17 Mar 2006 01:55:38 -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-serv12354/ServerExe

Modified Files:
	main.c 
Log Message:
Handle FOCUS. We need to do this via an extra message because a process is
only allowed to focus its own windows.


Index: main.c
===================================================================
RCS file: /cvsroot/rdesktop/seamlessrdp/ServerExe/main.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** main.c	16 Mar 2006 15:42:32 -0000	1.19
--- main.c	17 Mar 2006 09:55:35 -0000	1.20
***************
*** 34,37 ****
--- 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
***************
*** 171,174 ****
--- 174,190 ----
  
  static void
+ do_focus(HWND hwnd)
+ {
+ /*	if (!AttachThreadInput(GetCurrentThreadId(), GetWindowThreadProcessId(hwnd, NULL), TRUE))
+ 	{
+ 		debug("Failed to attach");
+ 		return;
+ 	}
+ 	SetFocus(hwnd);
+ 	AttachThreadInput(GetCurrentThreadId(), GetWindowThreadProcessId(hwnd, NULL), FALSE)*/
+ 	SendMessage(hwnd, g_wm_seamless_focus, 0, 0);
+ }
+ 
+ static void
  process_cmds(void)
  {
***************
*** 201,204 ****
--- 217,222 ----
  		else if (strcmp(tok1, "ZCHANGE") == 0)
  			do_zchange((HWND) strtoul(tok2, NULL, 0), (HWND) strtoul(tok3, NULL, 0));
+ 		else if (strcmp(tok1, "FOCUS") == 0)
+ 			do_focus((HWND) strtoul(tok2, NULL, 0));
  	}
  }
***************
*** 301,304 ****
--- 319,324 ----
  	}
  
+ 	g_wm_seamless_focus = RegisterWindowMessage(FOCUS_MSG_NAME);
+ 
  	WTSRegisterSessionNotification(g_hwnd, NOTIFY_FOR_THIS_SESSION);
  



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