CVS: rdesktop seamless.c,1.1,1.2 seamless.h,1.1,1.2 Makefile.in,1.13,1.14 channels.c,1.15,1.16 configure.ac,1.19,1.20 constants.h,1.45,1.46 ewmhints.c,1.10,1.11 proto.h,1.87,1.88 rdesktop.c,1.144,1.145 rdesktop.h,1.32,1.33 secure.c,1.55,1.56 xkeymap.c,1.88,1.89 xproto.h,1.4,1.5 xwin.c,1.205,1.206

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

Modified Files:
	Makefile.in channels.c configure.ac constants.h ewmhints.c 
	proto.h rdesktop.c rdesktop.h secure.c xkeymap.c xproto.h 
	xwin.c 
Added Files:
	seamless.c seamless.h 
Log Message:
Added SeamlessRDP support: Merged seamlessrdp-branch



Index: Makefile.in
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/Makefile.in,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** Makefile.in	2 Mar 2006 15:22:25 -0000	1.13
--- Makefile.in	27 Mar 2006 08:17:33 -0000	1.14
***************
*** 26,30 ****
  SOUNDOBJ    = @SOUNDOBJ@
  
! RDPOBJ   = tcp.o iso.o mcs.o secure.o licence.o rdp.o orders.o bitmap.o cache.o rdp5.o channels.o rdpdr.o serial.o printer.o disk.o parallel.o printercache.o mppc.o pstcache.o lspci.o
  X11OBJ   = rdesktop.o xwin.o xkeymap.o ewmhints.o xclip.o cliprdr.o
  VNCOBJ   = vnc/rdp2vnc.o vnc/vnc.o vnc/xkeymap.o vnc/x11stubs.o
--- 26,30 ----
  SOUNDOBJ    = @SOUNDOBJ@
  
! RDPOBJ   = tcp.o iso.o mcs.o secure.o licence.o rdp.o orders.o bitmap.o cache.o rdp5.o channels.o rdpdr.o serial.o printer.o disk.o parallel.o printercache.o mppc.o pstcache.o lspci.o seamless.o
  X11OBJ   = rdesktop.o xwin.o xkeymap.o ewmhints.o xclip.o cliprdr.o
  VNCOBJ   = vnc/rdp2vnc.o vnc/vnc.o vnc/xkeymap.o vnc/x11stubs.o
***************
*** 83,87 ****
  	iso.c licence.c mcs.c orders.c parallel.c printer.c printercache.c \
  	pstcache.c rdesktop.c rdp5.c rdp.c rdpdr.c rdpsnd.c rdpsnd_oss.c \
! 	secure.c serial.c tcp.c xclip.c xkeymap.c xwin.c lspci.c >> proto.h
  	cat proto.tail >> proto.h
  
--- 83,87 ----
  	iso.c licence.c mcs.c orders.c parallel.c printer.c printercache.c \
  	pstcache.c rdesktop.c rdp5.c rdp.c rdpdr.c rdpsnd.c rdpsnd_oss.c \
! 	secure.c serial.c tcp.c xclip.c xkeymap.c xwin.c lspci.c seamless.c >> proto.h
  	cat proto.tail >> proto.h
  

Index: channels.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/channels.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** channels.c	2 Mar 2006 15:22:25 -0000	1.15
--- channels.c	27 Mar 2006 08:17:33 -0000	1.16
***************
*** 22,26 ****
  #include "rdesktop.h"
  
! #define MAX_CHANNELS			5
  #define CHANNEL_CHUNK_LENGTH		1600
  #define CHANNEL_FLAG_FIRST		0x01
--- 22,26 ----
  #include "rdesktop.h"
  
! #define MAX_CHANNELS			6
  #define CHANNEL_CHUNK_LENGTH		1600
  #define CHANNEL_FLAG_FIRST		0x01
***************
*** 88,92 ****
  	length = s->end - s->p - 8;
  
! 	DEBUG_CLIPBOARD(("channel_send, length = %d\n", length));
  
  	thislength = MIN(length, CHANNEL_CHUNK_LENGTH);
--- 88,92 ----
  	length = s->end - s->p - 8;
  
! 	DEBUG_CHANNEL(("channel_send, length = %d\n", length));
  
  	thislength = MIN(length, CHANNEL_CHUNK_LENGTH);
***************
*** 103,107 ****
  	out_uint32_le(s, flags);
  	data = s->end = s->p + thislength;
! 	DEBUG_CLIPBOARD(("Sending %d bytes with FLAG_FIRST\n", thislength));
  	sec_send_to_channel(s, g_encryption ? SEC_ENCRYPT : 0, channel->mcs_id);
  
--- 103,107 ----
  	out_uint32_le(s, flags);
  	data = s->end = s->p + thislength;
! 	DEBUG_CHANNEL(("Sending %d bytes with FLAG_FIRST\n", thislength));
  	sec_send_to_channel(s, g_encryption ? SEC_ENCRYPT : 0, channel->mcs_id);
  
***************
*** 115,119 ****
  			flags |= CHANNEL_FLAG_SHOW_PROTOCOL;
  
! 		DEBUG_CLIPBOARD(("Sending %d bytes with flags %d\n", thislength, flags));
  
  		s = sec_init(g_encryption ? SEC_ENCRYPT : 0, thislength + 8);
--- 115,119 ----
  			flags |= CHANNEL_FLAG_SHOW_PROTOCOL;
  
! 		DEBUG_CHANNEL(("Sending %d bytes with flags %d\n", thislength, flags));
  
  		s = sec_init(g_encryption ? SEC_ENCRYPT : 0, thislength + 8);

Index: configure.ac
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/configure.ac,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** configure.ac	13 Mar 2006 09:27:10 -0000	1.19
--- configure.ac	27 Mar 2006 08:17:33 -0000	1.20
***************
*** 685,688 ****
--- 685,697 ----
      ])
  
+ AC_ARG_WITH(debug-channel,
+     [  --with-debug-channel  enable debugging of virtual channel code],
+     [
+         if test $withval != "no";
+         then 
+             AC_DEFINE(WITH_DEBUG_CHANNEL,1)
+ 	fi
+     ])
+ 
  
  #

Index: constants.h
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/constants.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** constants.h	8 Aug 2005 19:15:53 -0000	1.45
--- constants.h	27 Mar 2006 08:17:33 -0000	1.46
***************
*** 413,414 ****
--- 413,426 ----
  #define exDiscReasonLicenseCantUpgradeLicense		0x0109
  #define exDiscReasonLicenseNoRemoteConnections		0x010a
+ 
+ /* SeamlessRDP constants */
+ #define SEAMLESSRDP_NOTYETMAPPED -1
+ #define SEAMLESSRDP_NORMAL 0
+ #define SEAMLESSRDP_MINIMIZED 1
+ #define SEAMLESSRDP_MAXIMIZED 2
+ #define SEAMLESSRDP_POSITION_TIMER 200000
+ 
+ #define SEAMLESSRDP_CREATE_MODAL	0x0001
+ 
+ #define SEAMLESSRDP_HELLO_RECONNECT	0x0001
+ #define SEAMLESSRDP_HELLO_HIDDEN	0x0002

Index: ewmhints.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/ewmhints.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** ewmhints.c	12 Sep 2005 12:36:45 -0000	1.10
--- ewmhints.c	27 Mar 2006 08:17:33 -0000	1.11
***************
*** 23,30 ****
--- 23,42 ----
  
  #include <X11/Xlib.h>
+ #include <X11/Xatom.h>
+ #include <X11/Xutil.h>
  #include "rdesktop.h"
  
+ #define _NET_WM_STATE_REMOVE        0	/* remove/unset property */
+ #define _NET_WM_STATE_ADD           1	/* add/set property */
+ #define _NET_WM_STATE_TOGGLE        2	/* toggle property  */
+ 
  extern Display *g_display;
  
+ static Atom g_net_wm_state_maximized_vert_atom, g_net_wm_state_maximized_horz_atom,
+ 	g_net_wm_state_hidden_atom, g_net_wm_name_atom, g_utf8_string_atom,
+ 	g_net_wm_state_skip_taskbar_atom, g_net_wm_state_skip_pager_atom, g_net_wm_state_modal_atom;
+ 
+ Atom g_net_wm_state_atom, g_net_wm_desktop_atom;
+ 
  /* 
     Get window property value (32 bit format) 
***************
*** 32,37 ****
  */
  static int
! get_property_value(char *propname, long max_length,
! 		   unsigned long *nitems_return, unsigned char **prop_return)
  {
  	int result;
--- 44,49 ----
  */
  static int
! get_property_value(Window wnd, char *propname, long max_length,
! 		   unsigned long *nitems_return, unsigned char **prop_return, int nowarn)
  {
  	int result;
***************
*** 48,52 ****
  	}
  
! 	result = XGetWindowProperty(g_display, DefaultRootWindow(g_display), property, 0,	/* long_offset */
  				    max_length,	/* long_length */
  				    False,	/* delete */
--- 60,64 ----
  	}
  
! 	result = XGetWindowProperty(g_display, wnd, property, 0,	/* long_offset */
  				    max_length,	/* long_length */
  				    False,	/* delete */
***************
*** 64,68 ****
  	if (actual_type_return == None || actual_format_return == 0)
  	{
! 		fprintf(stderr, "Root window is missing property %s\n", propname);
  		return (-1);
  	}
--- 76,81 ----
  	if (actual_type_return == None || actual_format_return == 0)
  	{
! 		if (!nowarn)
! 			fprintf(stderr, "Window is missing property %s\n", propname);
  		return (-1);
  	}
***************
*** 94,98 ****
  	int current_desktop;
  
! 	if (get_property_value("_NET_CURRENT_DESKTOP", 1, &nitems_return, &prop_return) < 0)
  		return (-1);
  
--- 107,113 ----
  	int current_desktop;
  
! 	if (get_property_value
! 	    (DefaultRootWindow(g_display), "_NET_CURRENT_DESKTOP", 1, &nitems_return,
! 	     &prop_return, 0) < 0)
  		return (-1);
  
***************
*** 126,130 ****
  	const uint32 max_prop_length = 32 * 4;	/* Max 32 desktops */
  
! 	if (get_property_value("_NET_WORKAREA", max_prop_length, &nitems_return, &prop_return) < 0)
  		return (-1);
  
--- 141,147 ----
  	const uint32 max_prop_length = 32 * 4;	/* Max 32 desktops */
  
! 	if (get_property_value
! 	    (DefaultRootWindow(g_display), "_NET_WORKAREA", max_prop_length, &nitems_return,
! 	     &prop_return, 0) < 0)
  		return (-1);
  
***************
*** 154,157 ****
--- 171,430 ----
  
  
+ 
+ void
+ ewmh_init()
+ {
+ 	/* FIXME: Use XInternAtoms */
+ 	g_net_wm_state_maximized_vert_atom =
+ 		XInternAtom(g_display, "_NET_WM_STATE_MAXIMIZED_VERT", False);
+ 	g_net_wm_state_maximized_horz_atom =
+ 		XInternAtom(g_display, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
+ 	g_net_wm_state_hidden_atom = XInternAtom(g_display, "_NET_WM_STATE_HIDDEN", False);
+ 	g_net_wm_state_skip_taskbar_atom =
+ 		XInternAtom(g_display, "_NET_WM_STATE_SKIP_TASKBAR", False);
+ 	g_net_wm_state_skip_pager_atom = XInternAtom(g_display, "_NET_WM_STATE_SKIP_PAGER", False);
+ 	g_net_wm_state_modal_atom = XInternAtom(g_display, "_NET_WM_STATE_MODAL", 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);
+ 	g_net_wm_name_atom = XInternAtom(g_display, "_NET_WM_NAME", False);
+ 	g_utf8_string_atom = XInternAtom(g_display, "UTF8_STRING", False);
+ }
+ 
+ 
+ /* 
+    Get the window state: normal/minimized/maximized. 
+ */
+ #ifndef MAKE_PROTO
+ int
+ ewmh_get_window_state(Window w)
+ {
+ 	unsigned long nitems_return;
+ 	unsigned char *prop_return;
+ 	uint32 *return_words;
+ 	unsigned long item;
+ 	BOOL maximized_vert, maximized_horz, hidden;
+ 
+ 	maximized_vert = maximized_horz = hidden = False;
+ 
+ 	if (get_property_value(w, "_NET_WM_STATE", 64, &nitems_return, &prop_return, 0) < 0)
+ 		return SEAMLESSRDP_NORMAL;
+ 
+ 	return_words = (uint32 *) prop_return;
+ 
+ 	for (item = 0; item < nitems_return; item++)
+ 	{
+ 		if (return_words[item] == g_net_wm_state_maximized_vert_atom)
+ 			maximized_vert = True;
+ 		if (return_words[item] == g_net_wm_state_maximized_horz_atom)
+ 			maximized_horz = True;
+ 		if (return_words[item] == g_net_wm_state_hidden_atom)
+ 			hidden = True;
+ 	}
+ 
+ 	XFree(prop_return);
+ 
+ 	if (maximized_vert && maximized_horz)
+ 		return SEAMLESSRDP_MAXIMIZED;
+ 	else if (hidden)
+ 		return SEAMLESSRDP_MINIMIZED;
+ 	else
+ 		return SEAMLESSRDP_NORMAL;
+ }
+ 
+ static int
+ ewmh_modify_state(Window wnd, int add, Atom atom1, Atom atom2)
+ {
+ 	Status status;
+ 	XEvent xevent;
+ 
+ 	int result;
+ 	unsigned long nitems;
+ 	unsigned char *props;
+ 	uint32 state;
+ 
+ 	/* The spec states that the window manager must respect any
+ 	   _NET_WM_STATE attributes on a withdrawn window. In order words, we
+ 	   modify the attributes directly for withdrawn windows and ask the WM
+ 	   to do it for active windows. */
+ 	result = get_property_value(wnd, "WM_STATE", 64, &nitems, &props, 1);
+ 	if ((result >= 0) && nitems)
+ 	{
+ 		state = *(uint32 *) props;
+ 		XFree(props);
+ 	}
+ 
+ 	if ((result < 0) || !nitems || (state == WithdrawnState))
+ 	{
+ 		if (add)
+ 		{
+ 			Atom atoms[2];
+ 
+ 			atoms[0] = atom1;
+ 			nitems = 1;
+ 			if (atom2)
+ 			{
+ 				atoms[1] = atom2;
+ 				nitems = 2;
+ 			}
+ 
+ 			XChangeProperty(g_display, wnd, g_net_wm_state_atom, XA_ATOM,
+ 					32, PropModeAppend, (unsigned char *) atoms, nitems);
+ 		}
+ 		else
+ 		{
+ 			Atom *atoms;
+ 			int i;
+ 
+ 			if (get_property_value(wnd, "_NET_WM_STATE", 64, &nitems, &props, 1) < 0)
+ 				return 0;
+ 
+ 			atoms = (Atom *) props;
+ 
+ 			for (i = 0; i < nitems; i++)
+ 			{
+ 				if ((atoms[i] == atom1) || (atom2 && (atoms[i] == atom2)))
+ 				{
+ 					if (i != (nitems - 1))
+ 						memmove(&atoms[i], &atoms[i + 1],
+ 							sizeof(Atom) * (nitems - i - 1));
+ 					nitems--;
+ 					i--;
+ 				}
+ 			}
+ 
+ 			XChangeProperty(g_display, wnd, g_net_wm_state_atom, XA_ATOM,
+ 					32, PropModeReplace, (unsigned char *) atoms, nitems);
+ 
+ 			XFree(props);
+ 		}
+ 
+ 		return 0;
+ 	}
+ 
+ 	xevent.type = ClientMessage;
+ 	xevent.xclient.window = wnd;
+ 	xevent.xclient.message_type = g_net_wm_state_atom;
+ 	xevent.xclient.format = 32;
+ 	if (add)
+ 		xevent.xclient.data.l[0] = _NET_WM_STATE_ADD;
+ 	else
+ 		xevent.xclient.data.l[0] = _NET_WM_STATE_REMOVE;
+ 	xevent.xclient.data.l[1] = atom1;
+ 	xevent.xclient.data.l[2] = atom2;
+ 	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;
+ }
+ 
+ /* 
+    Set the window state: normal/minimized/maximized. 
+    Returns -1 on failure. 
+ */
+ int
+ ewmh_change_state(Window wnd, int state)
+ {
+ 	/*
+ 	 * Deal with the max atoms
+ 	 */
+ 	if (state == SEAMLESSRDP_MAXIMIZED)
+ 	{
+ 		if (ewmh_modify_state
+ 		    (wnd, 1, g_net_wm_state_maximized_vert_atom,
+ 		     g_net_wm_state_maximized_horz_atom) < 0)
+ 			return -1;
+ 	}
+ 	else
+ 	{
+ 		if (ewmh_modify_state
+ 		    (wnd, 0, g_net_wm_state_maximized_vert_atom,
+ 		     g_net_wm_state_maximized_horz_atom) < 0)
+ 			return -1;
+ 	}
+ 
+ 	return 0;
+ }
+ 
+ 
+ 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) < 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;
+ }
+ 
+ void
+ ewmh_set_wm_name(Window wnd, const char *title)
+ {
+ 	int len;
+ 
+ 	len = strlen(title);
+ 	XChangeProperty(g_display, wnd, g_net_wm_name_atom, g_utf8_string_atom,
+ 			8, PropModeReplace, (unsigned char *) title, len);
+ }
+ 
+ 
+ int
+ ewmh_set_window_popup(Window wnd)
+ {
+ 	if (ewmh_modify_state
+ 	    (wnd, 1, g_net_wm_state_skip_taskbar_atom, g_net_wm_state_skip_pager_atom) < 0)
+ 		return -1;
+ 	return 0;
+ }
+ 
+ int
+ ewmh_set_window_modal(Window wnd)
+ {
+ 	if (ewmh_modify_state(wnd, 1, g_net_wm_state_modal_atom, 0) < 0)
+ 		return -1;
+ 	return 0;
+ }
+ 
+ #endif /* MAKE_PROTO */
+ 
+ 
  #if 0
  

Index: proto.h
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/proto.h,v
retrieving revision 1.87
retrieving revision 1.88
diff -C2 -d -r1.87 -r1.88
*** proto.h	2 Mar 2006 15:22:25 -0000	1.87
--- proto.h	27 Mar 2006 08:17:33 -0000	1.88
***************
*** 68,71 ****
--- 68,72 ----
  /* ewmhints.c */
  int get_current_workarea(uint32 * x, uint32 * y, uint32 * width, uint32 * height);
+ void ewmh_init(void);
  /* iso.c */
  STREAM iso_init(int length);
***************
*** 272,277 ****
--- 273,301 ----
  void ui_begin_update(void);
  void ui_end_update(void);
+ void ui_seamless_begin(BOOL hidden);
+ void ui_seamless_hide_desktop(void);
+ void ui_seamless_unhide_desktop(void);
+ void ui_seamless_toggle(void);
+ void ui_seamless_create_window(unsigned long id, unsigned long group, unsigned long parent,
+ 			       unsigned long flags);
+ void ui_seamless_destroy_window(unsigned long id, unsigned long flags);
+ 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);
+ void ui_seamless_syncbegin(unsigned long flags);
+ void ui_seamless_ack(unsigned int serial);
  /* lspci.c */
  BOOL lspci_init(void);
+ /* seamless.c */
+ BOOL seamless_init(void);
+ unsigned int seamless_send_sync(void);
+ unsigned int seamless_send_state(unsigned long id, unsigned int state, unsigned long flags);
+ unsigned int seamless_send_position(unsigned long id, int x, int y, int width, int height,
+ 				    unsigned long flags);
+ void seamless_select_timeout(struct timeval *tv);
+ unsigned int seamless_send_zchange(unsigned long id, unsigned long below, unsigned long flags);
+ unsigned int seamless_send_focus(unsigned long id, unsigned long flags);
  
  /* *INDENT-OFF* */

Index: rdesktop.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdesktop.c,v
retrieving revision 1.144
retrieving revision 1.145
diff -C2 -d -r1.144 -r1.145
*** rdesktop.c	2 Mar 2006 15:22:25 -0000	1.144
--- rdesktop.c	27 Mar 2006 08:17:33 -0000	1.145
***************
*** 90,93 ****
--- 90,94 ----
  BOOL g_owncolmap = False;
  BOOL g_ownbackstore = True;	/* We can't rely on external BackingStore */
+ BOOL g_seamless_rdp = False;
  uint32 g_embed_wnd;
  uint32 g_rdp5_performanceflags =
***************
*** 147,150 ****
--- 148,152 ----
  	fprintf(stderr, "   -L: local codepage\n");
  #endif
+ 	fprintf(stderr, "   -A: enable SeamlessRDP mode\n");
  	fprintf(stderr, "   -B: use BackingStore of X-server (if available)\n");
  	fprintf(stderr, "   -e: disable encryption (French TS)\n");
***************
*** 391,394 ****
--- 393,397 ----
  	char *locale = NULL;
  	int username_option = 0;
+ 	BOOL geometry_option = False;
  	int run_count = 0;	/* Session Directory support */
  	BOOL continue_connect = True;	/* Session Directory support */
***************
*** 417,421 ****
  
  	while ((c = getopt(argc, argv,
! 			   VNCOPT "u:L:d:s:c:p:n:k:g:fbBeEmzCDKS:T:NX:a:x:Pr:045h?")) != -1)
  	{
  		switch (c)
--- 420,424 ----
  
  	while ((c = getopt(argc, argv,
! 			   VNCOPT "Au:L:d:s:c:p:n:k:g:fbBeEmzCDKS:T:NX:a:x:Pr:045h?")) != -1)
  	{
  		switch (c)
***************
*** 435,438 ****
--- 438,445 ----
  #endif
  
+ 			case 'A':
+ 				g_seamless_rdp = True;
+ 				break;
+ 
  			case 'u':
  				STRNCPY(g_username, optarg, sizeof(g_username));
***************
*** 485,488 ****
--- 492,496 ----
  
  			case 'g':
+ 				geometry_option = True;
  				g_fullscreen = False;
  				if (!strcmp(optarg, "workarea"))
***************
*** 733,736 ****
--- 741,781 ----
  	parse_server_and_port(server);
  
+ 	if (g_seamless_rdp)
+ 	{
+ 		if (g_win_button_size)
+ 		{
+ 			error("You cannot use -S and -A at the same time\n");
+ 			return 1;
+ 		}
+ 		g_rdp5_performanceflags &= ~RDP5_NO_FULLWINDOWDRAG;
+ 		if (geometry_option)
+ 		{
+ 			error("You cannot use -g and -A at the same time\n");
+ 			return 1;
+ 		}
+ 		if (g_fullscreen)
+ 		{
+ 			error("You cannot use -f and -A at the same time\n");
+ 			return 1;
+ 		}
+ 		if (g_hide_decorations)
+ 		{
+ 			error("You cannot use -D and -A at the same time\n");
+ 			return 1;
+ 		}
+ 		if (g_embed_wnd)
+ 		{
+ 			error("You cannot use -X and -A at the same time\n");
+ 			return 1;
+ 		}
+ 		if (!g_use_rdp5)
+ 		{
+ 			error("You cannot use -4 and -A at the same time\n");
+ 			return 1;
+ 		}
+ 		g_width = -100;
+ 		g_grab_keyboard = False;
+ 	}
+ 
  	if (!username_option)
  	{

Index: rdesktop.h
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdesktop.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** rdesktop.h	15 Aug 2005 12:06:58 -0000	1.32
--- rdesktop.h	27 Mar 2006 08:17:33 -0000	1.33
***************
*** 58,61 ****
--- 58,67 ----
  #endif
  
+ #ifdef WITH_DEBUG_CHANNEL
+ #define DEBUG_CHANNEL(args) printf args;
+ #else
+ #define DEBUG_CHANNEL(args)
+ #endif
+ 
  #define STRNCPY(dst,src,n)	{ strncpy(dst,src,n-1); dst[n-1] = 0; }
  
***************
*** 68,71 ****
--- 74,93 ----
  #endif
  
+ /* timeval macros */
+ #ifndef timerisset
+ #define timerisset(tvp)\
+          ((tvp)->tv_sec || (tvp)->tv_usec)
+ #endif
+ #ifndef timercmp
+ #define timercmp(tvp, uvp, cmp)\
+         ((tvp)->tv_sec cmp (uvp)->tv_sec ||\
+         (tvp)->tv_sec == (uvp)->tv_sec &&\
+         (tvp)->tv_usec cmp (uvp)->tv_usec)
+ #endif
+ #ifndef timerclear
+ #define timerclear(tvp)\
+         ((tvp)->tv_sec = (tvp)->tv_usec = 0)
+ #endif
+ 
  /* If configure does not define the endianess, try
     to find it out */

Index: secure.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/secure.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -C2 -d -r1.55 -r1.56
*** secure.c	24 Jan 2006 12:40:24 -0000	1.55
--- secure.c	27 Mar 2006 08:17:33 -0000	1.56
***************
*** 534,537 ****
--- 534,538 ----
  	{
  		DEBUG_RDP5(("Re-setting algorithm type to RSA in server certificate\n"));
+ 		ASN1_OBJECT_free(cert->cert_info->key->algor->algorithm);
  		cert->cert_info->key->algor->algorithm = OBJ_nid2obj(NID_rsaEncryption);
  	}
***************
*** 543,547 ****
  	}
  
! 	server_public_key = (RSA *) epk->pkey.ptr;
  
  	return True;
--- 544,550 ----
  	}
  
! 	server_public_key = RSAPublicKey_dup((RSA *) epk->pkey.ptr);
! 
! 	EVP_PKEY_free(epk);
  
  	return True;
***************
*** 681,684 ****
--- 684,689 ----
  		 */
  
+ 		X509_free(cacert);
+ 
  		in_uint32_le(s, cert_len);
  		DEBUG_RDP5(("Certificate length is %d\n", cert_len));
***************
*** 699,704 ****
--- 704,711 ----
  		{
  			DEBUG_RDP5(("Didn't parse X509 correctly\n"));
+ 			X509_free(server_cert);
  			return False;
  		}
+ 		X509_free(server_cert);
  		return True;	/* There's some garbage here we don't care about */
  	}
***************
*** 746,749 ****
--- 753,758 ----
  		reverse(sec_crypted_random, SEC_MODULUS_SIZE);
  
+ 		RSA_free(server_public_key);
+ 		server_public_key = NULL;
  	}
  	else

Index: xkeymap.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/xkeymap.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -C2 -d -r1.88 -r1.89
*** xkeymap.c	30 Dec 2005 20:32:06 -0000	1.88
--- xkeymap.c	27 Mar 2006 08:17:33 -0000	1.89
***************
*** 590,593 ****
--- 590,598 ----
  			return True;
  			break;
+ 		case XK_Overlay1_Enable:
+ 			/* Toggle SeamlessRDP */
+ 			if (pressed)
+ 				ui_seamless_toggle();
+ 			break;
  
  	}

Index: xproto.h
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/xproto.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** xproto.h	9 Jul 2003 09:18:20 -0000	1.4
--- xproto.h	27 Mar 2006 08:17:33 -0000	1.5
***************
*** 3,4 ****
--- 3,11 ----
  void xclip_handle_SelectionClear(void);
  void xclip_handle_PropertyNotify(XPropertyEvent * xev);
+ 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);
+ void ewmh_set_wm_name(Window wnd, const char *title);
+ int ewmh_set_window_popup(Window wnd);
+ int ewmh_set_window_modal(Window wnd);

Index: xwin.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/xwin.c,v
retrieving revision 1.205
retrieving revision 1.206
diff -C2 -d -r1.205 -r1.206
*** xwin.c	7 Mar 2006 08:17:40 -0000	1.205
--- xwin.c	27 Mar 2006 08:17:33 -0000	1.206
***************
*** 29,32 ****
--- 29,35 ----
  #include "xproto.h"
  
+ /* We can't include Xproto.h because of conflicting defines for BOOL */
+ #define X_ConfigureWindow              12
+ 
  extern int g_width;
  extern int g_height;
***************
*** 49,52 ****
[...1381 lines suppressed...]
+ 	{
+ 		if (sw->outstanding_position && (sw->outpos_serial == serial))
+ 		{
+ 			sw->xoffset = sw->outpos_xoffset;
+ 			sw->yoffset = sw->outpos_yoffset;
+ 			sw->width = sw->outpos_width;
+ 			sw->height = sw->outpos_height;
+ 			sw->outstanding_position = False;
+ 
+ 			/* Do a complete redraw of the window as part of the
+ 			   completion of the move. This is to remove any
+ 			   artifacts caused by our lack of synchronization. */
+ 			XCopyArea(g_display, g_backstore,
+ 				  sw->wnd, g_gc,
+ 				  sw->xoffset, sw->yoffset, sw->width, sw->height, 0, 0);
+ 
+ 			break;
+ 		}
+ 	}
+ }



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