CVS: rdesktop proto.h,1.87.2.6,1.87.2.7 seamless.c,1.1.2.12,1.1.2.13 xwin.c,1.205.2.20,1.205.2.21

Pierre Ossman <[email protected]> Fri, 17 Mar 2006 00:52:32 -0800
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17290

Modified Files:
      Tag: seamlessrdp-branch
	proto.h seamless.c xwin.c 
Log Message:
Support for seamless window restacking (ZCHANGE).


Index: proto.h
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/proto.h,v
retrieving revision 1.87.2.6
retrieving revision 1.87.2.7
diff -C2 -d -r1.87.2.6 -r1.87.2.7
*** proto.h	16 Mar 2006 15:27:59 -0000	1.87.2.6
--- proto.h	17 Mar 2006 08:52:29 -0000	1.87.2.7
***************
*** 279,282 ****
--- 279,283 ----
  void ui_seamless_move_window(unsigned long id, int x, int y, int width, int height,
  			     unsigned long flags);
+ void ui_seamless_restack_window(unsigned long id, unsigned long behind, unsigned long flags);
  void ui_seamless_settitle(unsigned long id, const char *title, unsigned long flags);
  void ui_seamless_setstate(unsigned long id, unsigned int state, unsigned long flags);
***************
*** 288,291 ****
--- 289,293 ----
  void seamless_send_sync(void);
  void seamless_send_state(unsigned long id, unsigned int state, unsigned long flags);
+ void seamless_send_zchange(unsigned long id, unsigned long below, unsigned long flags);
  
  /* *INDENT-OFF* */

Index: seamless.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/Attic/seamless.c,v
retrieving revision 1.1.2.12
retrieving revision 1.1.2.13
diff -C2 -d -r1.1.2.12 -r1.1.2.13
*** seamless.c	16 Mar 2006 15:27:59 -0000	1.1.2.12
--- seamless.c	17 Mar 2006 08:52:29 -0000	1.1.2.13
***************
*** 152,156 ****
  	else if (!strcmp("ZCHANGE", tok1))
  	{
! 		unimpl("SeamlessRDP ZCHANGE1\n");
  	}
  	else if (!strcmp("TITLE", tok1))
--- 152,170 ----
  	else if (!strcmp("ZCHANGE", tok1))
  	{
! 		unsigned long behind;
! 
! 		id = strtoul(tok2, &endptr, 0);
! 		if (*endptr)
! 			return False;
! 
! 		behind = strtoul(tok3, &endptr, 0);
! 		if (*endptr)
! 			return False;
! 
! 		flags = strtoul(tok4, &endptr, 0);
! 		if (*endptr)
! 			return False;
! 
! 		ui_seamless_restack_window(id, behind, flags);
  	}
  	else if (!strcmp("TITLE", tok1))
***************
*** 324,325 ****
--- 338,349 ----
  	seamless_send("STATE,0x%08lx,0x%x,0x%lx\n", id, state, flags);
  }
+ 
+ 
+ void
+ seamless_send_zchange(unsigned long id, unsigned long below, unsigned long flags)
+ {
+ 	if (!g_seamless_rdp)
+ 		return;
+ 
+ 	seamless_send("ZCHANGE,0x%08lx,0x%08lx,0x%lx\n", id, below, flags);
+ }

Index: xwin.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/xwin.c,v
retrieving revision 1.205.2.20
retrieving revision 1.205.2.21
diff -C2 -d -r1.205.2.20 -r1.205.2.21
*** xwin.c	16 Mar 2006 15:27:59 -0000	1.205.2.20
--- xwin.c	17 Mar 2006 08:52:29 -0000	1.205.2.21
***************
*** 1745,1748 ****
--- 1745,1784 ----
  }
  
+ static void
+ ui_seamless_handle_restack(seamless_window * sw)
+ {
+ 	Status status;
+ 	Window root, parent, *children;
+ 	unsigned int nchildren, i;
+ 	seamless_window *sw_below;
+ 
+ 	status = XQueryTree(g_display, RootWindowOfScreen(g_screen),
+ 			    &root, &parent, &children, &nchildren);
+ 	if (!status || !nchildren)
+ 		return;
+ 
+ 	sw_below = NULL;
+ 
+ 	i = 0;
+ 	while (children[i] != sw->wnd)
+ 	{
+ 		i++;
+ 		if (i >= nchildren)
+ 			return;
+ 	}
+ 
+ 	for (i++; i < nchildren; i++)
+ 	{
+ 		sw_below = seamless_get_window_by_wnd(children[i]);
+ 		if (sw_below)
+ 			break;
+ 	}
+ 
+ 	if (sw_below)
+ 		seamless_send_zchange(sw->id, sw_below->id, 0);
+ 	else
+ 		seamless_send_zchange(sw->id, 0, 0);
+ }
+ 
  /* Process events in Xlib queue
     Returns 0 after user quit, 1 otherwise */
***************
*** 1996,1999 ****
--- 2032,2042 ----
  					rdp_send_client_window_status(0);
  				break;
+ 			case ConfigureNotify:
+ 				/* seamless */
+ 				sw = seamless_get_window_by_wnd(xevent.xconfigure.window);
+ 				if (!sw)
+ 					break;
+ 
+ 				ui_seamless_handle_restack(sw);
  		}
  	}
***************
*** 3199,3202 ****
--- 3242,3283 ----
  }
  
+ void
+ ui_seamless_restack_window(unsigned long id, unsigned long behind, unsigned long flags)
+ {
+ 	seamless_window *sw;
+ 
+ 	if (!g_seamless_active)
+ 		return;
+ 
+ 	sw = seamless_get_window_by_id(id);
+ 	if (!sw)
+ 	{
+ 		warning("ui_seamless_restack_window: No information for window 0x%lx\n", id);
+ 		return;
+ 	}
+ 
+ 	if (behind)
+ 	{
+ 		seamless_window *sw_behind;
+ 		Window wnds[2];
+ 
+ 		sw_behind = seamless_get_window_by_id(behind);
+ 		if (!sw_behind)
+ 		{
+ 			warning("ui_seamless_restack_window: No information for window 0x%lx\n",
+ 				behind);
+ 			return;
+ 		}
+ 
+ 		wnds[1] = sw_behind->wnd;
+ 		wnds[0] = sw->wnd;
+ 
+ 		XRestackWindows(g_display, wnds, 2);
+ 	}
+ 	else
+ 	{
+ 		XRaiseWindow(g_display, sw->wnd);
+ 	}
+ }
  
  void



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