CVS: rdesktop ewmhints.c,1.10.2.1,1.10.2.2 xproto.h,1.4.2.1,1.4.2.2 xwin.c,1.205.2.8,1.205.2.9

Peter Åstrand <[email protected]>
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9353

Modified Files:
      Tag: seamlessrdp-branch
	ewmhints.c xproto.h xwin.c 
Log Message:
When a seamless window is moved to a new desktop, move all other seamless windows as well.

Index: ewmhints.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/ewmhints.c,v
retrieving revision 1.10.2.1
retrieving revision 1.10.2.2
diff -C2 -d -r1.10.2.1 -r1.10.2.2
*** ewmhints.c	14 Mar 2006 13:56:50 -0000	1.10.2.1
--- ewmhints.c	15 Mar 2006 06:42:57 -0000	1.10.2.2
***************
*** 32,36 ****
  static Atom g_net_wm_state_maximized_vert_atom, g_net_wm_state_maximized_horz_atom,
  	g_net_wm_state_hidden_atom;
! Atom g_net_wm_state_atom;
  
  /* 
--- 32,36 ----
  static Atom g_net_wm_state_maximized_vert_atom, g_net_wm_state_maximized_horz_atom,
  	g_net_wm_state_hidden_atom;
! Atom g_net_wm_state_atom, g_net_wm_desktop_atom;
  
  /* 
***************
*** 175,178 ****
--- 175,179 ----
  	g_net_wm_state_hidden_atom = XInternAtom(g_display, "_NET_WM_STATE_HIDDEN", False);
  	g_net_wm_state_atom = XInternAtom(g_display, "_NET_WM_STATE", False);
+ 	g_net_wm_desktop_atom = XInternAtom(g_display, "_NET_WM_DESKTOP", False);
  }
  
***************
*** 272,275 ****
--- 273,322 ----
  }
  
+ 
+ int
+ ewmh_get_window_desktop(Window wnd)
+ {
+ 	unsigned long nitems_return;
+ 	unsigned char *prop_return;
+ 	int desktop;
+ 
+ 	if (get_property_value(wnd, "_NET_WM_DESKTOP", 1, &nitems_return, &prop_return) < 0)
+ 		return (-1);
+ 
+ 	if (nitems_return != 1)
+ 	{
+ 		fprintf(stderr, "_NET_WM_DESKTOP has bad length\n");
+ 		return (-1);
+ 	}
+ 
+ 	desktop = *prop_return;
+ 	XFree(prop_return);
+ 	return desktop;
+ }
+ 
+ 
+ int
+ ewmh_move_to_desktop(Window wnd, unsigned int desktop)
+ {
+ 	Status status;
+ 	XEvent xevent;
+ 
+ 	xevent.type = ClientMessage;
+ 	xevent.xclient.window = wnd;
+ 	xevent.xclient.message_type = g_net_wm_desktop_atom;
+ 	xevent.xclient.format = 32;
+ 	xevent.xclient.data.l[0] = desktop;
+ 	xevent.xclient.data.l[1] = 0;
+ 	xevent.xclient.data.l[2] = 0;
+ 	xevent.xclient.data.l[3] = 0;
+ 	xevent.xclient.data.l[4] = 0;
+ 	status = XSendEvent(g_display, DefaultRootWindow(g_display), False,
+ 			    SubstructureNotifyMask | SubstructureRedirectMask, &xevent);
+ 	if (!status)
+ 		return -1;
+ 
+ 	return 0;
+ }
+ 
  #endif /* MAKE_PROTO */
  

Index: xproto.h
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/xproto.h,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -C2 -d -r1.4.2.1 -r1.4.2.2
*** xproto.h	14 Mar 2006 13:56:50 -0000	1.4.2.1
--- xproto.h	15 Mar 2006 06:42:57 -0000	1.4.2.2
***************
*** 5,6 ****
--- 5,8 ----
  int ewmh_get_window_state(Window w);
  int ewmh_change_state(Window wnd, int state);
+ int ewmh_move_to_desktop(Window wnd, unsigned int desktop);
+ int ewmh_get_window_desktop(Window wnd);

Index: xwin.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/xwin.c,v
retrieving revision 1.205.2.8
retrieving revision 1.205.2.9
diff -C2 -d -r1.205.2.8 -r1.205.2.9
*** xwin.c	14 Mar 2006 13:56:50 -0000	1.205.2.8
--- xwin.c	15 Mar 2006 06:42:57 -0000	1.205.2.9
***************
*** 58,61 ****
--- 58,62 ----
  	int width, height;
  	unsigned int state;	/* normal/minimized/maximized */
+ 	unsigned int desktop;
  	struct _seamless_window *next;
  } seamless_window;
***************
*** 86,89 ****
--- 87,91 ----
  static Atom g_protocol_atom, g_kill_atom;
  extern Atom g_net_wm_state_atom;
+ extern Atom g_net_wm_desktop_atom;
  static BOOL g_focused;
  static BOOL g_mouse_in_wnd;
***************
*** 301,304 ****
--- 303,324 ----
  
  
+ /* Move all windows except wnd to new desktop */
+ static void
+ seamless_all_to_desktop(Window wnd, unsigned int desktop)
+ {
+ 	seamless_window *sw;
+ 	for (sw = g_seamless_windows; sw; sw = sw->next)
+ 	{
+ 		if (sw->wnd == wnd)
+ 			continue;
+ 		if (sw->desktop != desktop)
+ 		{
+ 			ewmh_move_to_desktop(sw->wnd, desktop);
+ 			sw->desktop = desktop;
+ 		}
+ 	}
+ }
+ 
+ 
  static void
  mwm_hide_decorations(Window wnd)
***************
*** 1958,1961 ****
--- 1978,1989 ----
  					seamless_send_state(sw->id, sw->state, 0);
  				}
+ 
+ 				if ((xevent.xproperty.atom == g_net_wm_desktop_atom)
+ 				    && (xevent.xproperty.state == PropertyNewValue))
+ 				{
+ 					sw->desktop = ewmh_get_window_desktop(sw->wnd);
+ 					seamless_all_to_desktop(sw->wnd, sw->desktop);
+ 				}
+ 
  				break;
  			case MapNotify:



-------------------------------------------------------
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.