CVS: rdesktop seamless.c,1.1.2.18,1.1.2.19 xwin.c,1.205.2.27,1.205.2.28

Peter Åstrand <[email protected]> Mon, 20 Mar 2006 07:43:20 -0800
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20912

Modified Files:
      Tag: seamlessrdp-branch
	seamless.c xwin.c 
Log Message:
Cleaned up SeamlessRDP functions: All utility functions are prefixed with sw_.

Index: seamless.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/Attic/seamless.c,v
retrieving revision 1.1.2.18
retrieving revision 1.1.2.19
diff -C2 -d -r1.1.2.18 -r1.1.2.19
*** seamless.c	20 Mar 2006 12:36:14 -0000	1.1.2.18
--- seamless.c	20 Mar 2006 15:43:14 -0000	1.1.2.19
***************
*** 391,394 ****
--- 391,395 ----
  }
  
+ 
  unsigned int
  seamless_send_zchange(unsigned long id, unsigned long below, unsigned long flags)
***************
*** 401,404 ****
--- 402,406 ----
  
  
+ 
  unsigned int
  seamless_send_focus(unsigned long id, unsigned long flags)

Index: xwin.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/xwin.c,v
retrieving revision 1.205.2.27
retrieving revision 1.205.2.28
diff -C2 -d -r1.205.2.27 -r1.205.2.28
*** xwin.c	20 Mar 2006 14:39:00 -0000	1.205.2.27
--- xwin.c	20 Mar 2006 15:43:15 -0000	1.205.2.28
***************
*** 271,275 ****
  
  static seamless_window *
! seamless_get_window_by_id(unsigned long id)
  {
  	seamless_window *sw;
--- 271,275 ----
  
  static seamless_window *
! sw_get_window_by_id(unsigned long id)
  {
  	seamless_window *sw;
***************
*** 284,288 ****
  
  static seamless_window *
! seamless_get_window_by_wnd(Window wnd)
  {
  	seamless_window *sw;
--- 284,288 ----
  
  static seamless_window *
! sw_get_window_by_wnd(Window wnd)
  {
  	seamless_window *sw;
***************
*** 297,301 ****
  
  static void
! seamless_remove_window(seamless_window * win)
  {
  	seamless_window *sw, **prevnext = &g_seamless_windows;
--- 297,301 ----
  
  static void
! sw_remove_window(seamless_window * win)
  {
  	seamless_window *sw, **prevnext = &g_seamless_windows;
***************
*** 316,320 ****
  /* Move all windows except wnd to new desktop */
  static void
! seamless_all_to_desktop(Window wnd, unsigned int desktop)
  {
  	seamless_window *sw;
--- 316,320 ----
  /* Move all windows except wnd to new desktop */
  static void
! sw_all_to_desktop(Window wnd, unsigned int desktop)
  {
  	seamless_window *sw;
***************
*** 334,338 ****
  /* Send our position */
  static void
! seamless_update_position(seamless_window * sw)
  {
  	XWindowAttributes wa;
--- 334,338 ----
  /* Send our position */
  static void
! sw_update_position(seamless_window * sw)
  {
  	XWindowAttributes wa;
***************
*** 359,363 ****
  /* Check if it's time to send our position */
  static void
! seamless_check_timers()
  {
  	seamless_window *sw;
--- 359,363 ----
  /* Check if it's time to send our position */
  static void
! sw_check_timers()
  {
  	seamless_window *sw;
***************
*** 370,374 ****
  		{
  			timerclear(sw->position_timer);
! 			seamless_update_position(sw);
  		}
  	}
--- 370,374 ----
  		{
  			timerclear(sw->position_timer);
! 			sw_update_position(sw);
  		}
  	}
***************
*** 377,381 ****
  
  static void
! seamless_restack_window(seamless_window * sw, unsigned long behind)
  {
  	seamless_window *sw_above;
--- 377,381 ----
  
  static void
! sw_restack_window(seamless_window * sw, unsigned long behind)
  {
  	seamless_window *sw_above;
***************
*** 407,410 ****
--- 407,458 ----
  
  static void
+ sw_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 = sw_get_window_by_wnd(children[i]);
+ 		if (sw_below)
+ 			break;
+ 	}
+ 
+ 	if (!sw_below && !sw->behind)
+ 		return;
+ 	if (sw_below && (sw_below->id == sw->behind))
+ 		return;
+ 
+ 	if (sw_below)
+ 	{
+ 		seamless_send_zchange(sw->id, sw_below->id, 0);
+ 		sw_restack_window(sw, sw_below->id);
+ 	}
+ 	else
+ 	{
+ 		seamless_send_zchange(sw->id, 0, 0);
+ 		sw_restack_window(sw, 0);
+ 	}
+ }
+ 
+ 
+ static void
  mwm_hide_decorations(Window wnd)
  {
***************
*** 1827,1876 ****
  }
  
- 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 && !sw->behind)
- 		return;
- 	if (sw_below && (sw_below->id == sw->behind))
- 		return;
- 
- 	if (sw_below)
- 	{
- 		seamless_send_zchange(sw->id, sw_below->id, 0);
- 		seamless_restack_window(sw, sw_below->id);
- 	}
- 	else
- 	{
- 		seamless_send_zchange(sw->id, 0, 0);
- 		seamless_restack_window(sw, 0);
- 	}
- }
  
  /* Process events in Xlib queue
--- 1875,1878 ----
***************
*** 2007,2011 ****
  						      GrabModeAsync, GrabModeAsync, CurrentTime);
  
! 				sw = seamless_get_window_by_wnd(xevent.xfocus.window);
  				if (!sw)
  					break;
--- 2009,2013 ----
  						      GrabModeAsync, GrabModeAsync, CurrentTime);
  
! 				sw = sw_get_window_by_wnd(xevent.xfocus.window);
  				if (!sw)
  					break;
***************
*** 2058,2062 ****
  				else
  				{
! 					sw = seamless_get_window_by_wnd(xevent.xexpose.window);
  					if (sw)
  						XCopyArea(g_display, g_backstore,
--- 2060,2064 ----
  				else
  				{
! 					sw = sw_get_window_by_wnd(xevent.xexpose.window);
  					if (sw)
  						XCopyArea(g_display, g_backstore,
***************
*** 2108,2112 ****
  
  				/* seamless */
! 				sw = seamless_get_window_by_wnd(xevent.xproperty.window);
  				if (!sw)
  					break;
--- 2110,2114 ----
  
  				/* seamless */
! 				sw = sw_get_window_by_wnd(xevent.xproperty.window);
  				if (!sw)
  					break;
***************
*** 2123,2127 ****
  				{
  					sw->desktop = ewmh_get_window_desktop(sw->wnd);
! 					seamless_all_to_desktop(sw->wnd, sw->desktop);
  				}
  
--- 2125,2129 ----
  				{
  					sw->desktop = ewmh_get_window_desktop(sw->wnd);
! 					sw_all_to_desktop(sw->wnd, sw->desktop);
  				}
  
***************
*** 2139,2143 ****
  					break;
  
! 				sw = seamless_get_window_by_wnd(xevent.xconfigure.window);
  				if (!sw)
  				{
--- 2141,2145 ----
  					break;
  
! 				sw = sw_get_window_by_wnd(xevent.xconfigure.window);
  				if (!sw)
  				{
***************
*** 2159,2163 ****
  				}
  
! 				ui_seamless_handle_restack(sw);
  				break;
  		}
--- 2161,2165 ----
  				}
  
! 				sw_handle_restack(sw);
  				break;
  		}
***************
*** 2185,2189 ****
  
  		if (g_seamless_active)
! 			seamless_check_timers();
  
  		FD_ZERO(&rfds);
--- 2187,2191 ----
  
  		if (g_seamless_active)
! 			sw_check_timers();
  
  		FD_ZERO(&rfds);
***************
*** 3175,3178 ****
--- 3177,3181 ----
  }
  
+ 
  void
  ui_seamless_begin()
***************
*** 3185,3192 ****
  
  	g_seamless_started = True;
- 
  	ui_seamless_toggle();
  }
  
  void
  ui_seamless_toggle()
--- 3188,3195 ----
  
  	g_seamless_started = True;
  	ui_seamless_toggle();
  }
  
+ 
  void
  ui_seamless_toggle()
***************
*** 3204,3208 ****
  		{
  			XDestroyWindow(g_display, g_seamless_windows->wnd);
! 			seamless_remove_window(g_seamless_windows);
  		}
  		XMapWindow(g_display, g_wnd);
--- 3207,3211 ----
  		{
  			XDestroyWindow(g_display, g_seamless_windows->wnd);
! 			sw_remove_window(g_seamless_windows);
  		}
  		XMapWindow(g_display, g_wnd);
***************
*** 3218,3221 ****
--- 3221,3225 ----
  }
  
+ 
  void
  ui_seamless_create_window(unsigned long id, unsigned long parent, unsigned long flags)
***************
*** 3232,3236 ****
  
  	/* Ignore CREATEs for existing windows */
! 	sw = seamless_get_window_by_id(id);
  	if (sw)
  		return;
--- 3236,3240 ----
  
  	/* Ignore CREATEs for existing windows */
! 	sw = sw_get_window_by_id(id);
  	if (sw)
  		return;
***************
*** 3273,3277 ****
  	else if (parent != 0x00000000)
  	{
! 		sw_parent = seamless_get_window_by_id(parent);
  		if (sw_parent)
  			XSetTransientForHint(g_display, wnd, sw_parent->wnd);
--- 3277,3281 ----
  	else if (parent != 0x00000000)
  	{
! 		sw_parent = sw_get_window_by_id(parent);
  		if (sw_parent)
  			XSetTransientForHint(g_display, wnd, sw_parent->wnd);
***************
*** 3319,3323 ****
  		return;
  
! 	sw = seamless_get_window_by_id(id);
  	if (!sw)
  	{
--- 3323,3327 ----
  		return;
  
! 	sw = sw_get_window_by_id(id);
  	if (!sw)
  	{
***************
*** 3327,3331 ****
  
  	XDestroyWindow(g_display, sw->wnd);
! 	seamless_remove_window(sw);
  }
  
--- 3331,3335 ----
  
  	XDestroyWindow(g_display, sw->wnd);
! 	sw_remove_window(sw);
  }
  
***************
*** 3339,3343 ****
  		return;
  
! 	sw = seamless_get_window_by_id(id);
  	if (!sw)
  	{
--- 3343,3347 ----
  		return;
  
! 	sw = sw_get_window_by_id(id);
  	if (!sw)
  	{
***************
*** 3372,3375 ****
--- 3376,3380 ----
  }
  
+ 
  void
  ui_seamless_restack_window(unsigned long id, unsigned long behind, unsigned long flags)
***************
*** 3380,3384 ****
  		return;
  
! 	sw = seamless_get_window_by_id(id);
  	if (!sw)
  	{
--- 3385,3389 ----
  		return;
  
! 	sw = sw_get_window_by_id(id);
  	if (!sw)
  	{
***************
*** 3392,3396 ****
  		Window wnds[2];
  
! 		sw_behind = seamless_get_window_by_id(behind);
  		if (!sw_behind)
  		{
--- 3397,3401 ----
  		Window wnds[2];
  
! 		sw_behind = sw_get_window_by_id(behind);
  		if (!sw_behind)
  		{
***************
*** 3410,3416 ****
  	}
  
! 	seamless_restack_window(sw, behind);
  }
  
  void
  ui_seamless_settitle(unsigned long id, const char *title, unsigned long flags)
--- 3415,3422 ----
  	}
  
! 	sw_restack_window(sw, behind);
  }
  
+ 
  void
  ui_seamless_settitle(unsigned long id, const char *title, unsigned long flags)
***************
*** 3421,3425 ****
  		return;
  
! 	sw = seamless_get_window_by_id(id);
  	if (!sw)
  	{
--- 3427,3431 ----
  		return;
  
! 	sw = sw_get_window_by_id(id);
  	if (!sw)
  	{
***************
*** 3442,3446 ****
  		return;
  
! 	sw = seamless_get_window_by_id(id);
  	if (!sw)
  	{
--- 3448,3452 ----
  		return;
  
! 	sw = sw_get_window_by_id(id);
  	if (!sw)
  	{
***************
*** 3494,3501 ****
  	{
  		XDestroyWindow(g_display, g_seamless_windows->wnd);
! 		seamless_remove_window(g_seamless_windows);
  	}
  }
  
  void
  ui_seamless_ack(unsigned int serial)
--- 3500,3508 ----
  	{
  		XDestroyWindow(g_display, g_seamless_windows->wnd);
! 		sw_remove_window(g_seamless_windows);
  	}
  }
  
+ 
  void
  ui_seamless_ack(unsigned int serial)
***************
*** 3510,3516 ****
  			sw->width = sw->outpos_width;
  			sw->height = sw->outpos_height;
- 
  			sw->outstanding_position = False;
- 
  			break;
  		}
--- 3517,3521 ----



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