From 49303c8969f56b8b381ec9917bdb4febb665201b Mon Sep 17 00:00:00 2001 From: David Sundstrom Date: Fri, 16 Dec 2011 15:09:21 -0600 Subject: [PATCH] Fix compile error on Solaris Fix few small issues with local move race conditions Add missing --gdi option to command-line help --- client/X11/xf_event.c | 9 ++++--- client/X11/xf_rail.c | 8 +++--- client/X11/xf_window.c | 57 +++++++++++++++++++---------------------- client/X11/xf_window.h | 2 +- libfreerdp-core/tcp.c | 2 ++ libfreerdp-utils/args.c | 1 + 6 files changed, 42 insertions(+), 37 deletions(-) diff --git a/client/X11/xf_event.c b/client/X11/xf_event.c index 40099745b..1d2a58fde 100644 --- a/client/X11/xf_event.c +++ b/client/X11/xf_event.c @@ -463,9 +463,13 @@ boolean xf_event_ConfigureNotify(xfInfo* xfi, XEvent* event, boolean app) xfw->right = xfw->left + xfw->width - 1; xfw->bottom = xfw->top + xfw->height - 1; - if (app) - xf_rail_adjust_position(xfi, window); + DEBUG_X11_LMS("window=0x%X rc={l=%d t=%d r=%d b=%d} w=%u h=%u send_event=%d", + (uint32) xfw->handle, + xfw->left, xfw->top, xfw->right, xfw->bottom, + xfw->width, xfw->height, event->xconfigure.send_event); + if (app && ! event->xconfigure.send_event) + xf_rail_adjust_position(xfi, window); } return True; @@ -590,7 +594,6 @@ boolean xf_event_suppress_events(xfInfo *xfi, rdpWindow *window, XEvent*event) // In this case we must cancel the // local move. The event will be // processed below as normal, below. - xf_rail_end_local_move(xfi, window); break; case VisibilityNotify: case PropertyNotify: diff --git a/client/X11/xf_rail.c b/client/X11/xf_rail.c index 4b4baaf17..edd5a74cf 100644 --- a/client/X11/xf_rail.c +++ b/client/X11/xf_rail.c @@ -306,8 +306,10 @@ void xf_rail_end_local_move(xfInfo* xfi, rdpWindow *window) window_move.right = xfw->right + 1; // In the update to RDP the position is one past the window window_move.bottom = xfw->bottom + 1; - DEBUG_X11_LMS("window=0x%X rc={l=%d t=%d r=%d b=%d}", - (uint32) xfw->handle, xfw->left, xfw->top, xfw->right, xfw->bottom); + DEBUG_X11_LMS("window=0x%X rc={l=%d t=%d r=%d b=%d} w=%d h=%d", + (uint32) xfw->handle, + xfw->left, xfw->top, xfw->right, xfw->bottom, + xfw->width, xfw->height); xf_send_rail_client_event(channels, RDP_EVENT_TYPE_RAIL_CLIENT_WINDOW_MOVE, &window_move); @@ -507,7 +509,7 @@ void xf_process_rail_server_localmovesize_event(xfInfo* xfi, rdpChannels* channe { xf_StartLocalMoveSize(xfi, xfw, direction, x, y); } else { - xf_EndLocalMoveSize(xfi, xfw, false); + xf_EndLocalMoveSize(xfi, xfw); } } } diff --git a/client/X11/xf_window.c b/client/X11/xf_window.c index 188e85543..a159c6b8a 100644 --- a/client/X11/xf_window.c +++ b/client/X11/xf_window.c @@ -473,17 +473,16 @@ void xf_StartLocalMoveSize(xfInfo* xfi, xfWindow* window, int direction, int x, { Window child_window; -#ifdef WITH_DEBUG_X11_LOCAL_MOVESIZE - rdpWindow* wnd = window->window; -#endif + if (window->local_move.state != LMS_NOT_ACTIVE) + return; DEBUG_X11_LMS("direction=%d window=0x%X rc={l=%d t=%d r=%d b=%d} w=%d h=%d " "RDP=0x%X rc={l=%d t=%d} w=%d h=%d mouse_x=%d mouse_y=%d", direction, (uint32) window->handle, window->left, window->top, window->right, window->bottom, - window->width, window->height, wnd->windowId, - wnd->windowOffsetX, wnd->windowOffsetY, - wnd->windowWidth, wnd->windowHeight, x, y); + window->width, window->height, window->window->windowId, + window->window->windowOffsetX, window->window->windowOffsetY, + window->window->windowWidth, window->window->windowHeight, x, y); window->local_move.root_x = x; window->local_move.root_y = y; @@ -508,30 +507,28 @@ void xf_StartLocalMoveSize(xfInfo* xfi, xfWindow* window, int direction, int x, 1); /* 1 == application request per extended ICCM */ } -void xf_EndLocalMoveSize(xfInfo *xfi, xfWindow *window, boolean cancel) +void xf_EndLocalMoveSize(xfInfo *xfi, xfWindow *window) { -#ifdef WITH_DEBUG_X11_LOCAL_MOVESIZE - rdpWindow* wnd = window->window; -#endif - DEBUG_X11_LMS("state=%d cancel=%d window=0x%X rc={l=%d t=%d r=%d b=%d} w=%d h=%d " + DEBUG_X11_LMS("state=%d window=0x%X rc={l=%d t=%d r=%d b=%d} w=%d h=%d " "RDP=0x%X rc={l=%d t=%d} w=%d h=%d", - window->local_move.state, cancel, + window->local_move.state, (uint32) window->handle, window->left, window->top, window->right, window->bottom, - window->width, window->height, wnd->windowId, - wnd->windowOffsetX, wnd->windowOffsetY, - wnd->windowWidth, wnd->windowHeight); + window->width, window->height, window->window->windowId, + window->window->windowOffsetX, window->window->windowOffsetY, + window->window->windowWidth, window->window->windowHeight); if (window->local_move.state == LMS_NOT_ACTIVE) return; - if (cancel) + if (window->local_move.state == LMS_STARTING) { /* - * Per ICCM, the X client can ask to cancel an active move. Do this if we - * receive a local move stop from RDP while a local move is in progress + * The move never was property started. This can happen due to race + * conditions between the mouse button up and the communications to the + * RDP server for local moves. We must cancel the X window manager move. + * Per ICCM, the X client can ask to cancel an active move. */ - xf_SendClientEvent(xfi, window, xfi->_NET_WM_MOVERESIZE, /* request X window manager to abort a local move */ 5, /* 5 arguments to follow */ @@ -549,27 +546,25 @@ void xf_MoveWindow(xfInfo* xfi, xfWindow* window, int x, int y, int width, int h { boolean resize = false; -#ifdef WITH_DEBUG_X11_LOCAL_MOVESIZE - rdpWindow* wnd = window->window; -#endif - if ((width * height) < 1) return; - if (window->local_move.state != LMS_NOT_ACTIVE) - return; - if ((window->width != width) || (window->height != height)) resize = true; - DEBUG_X11_LMS("window=0x%X current rc={l=%d t=%d r=%d b=%d} w=%u h=%u " + if (window->local_move.state == LMS_STARTING || + window->local_move.state == LMS_ACTIVE) + return; + + DEBUG_X11_LMS("window=0x%X rc={l=%d t=%d r=%d b=%d} w=%u h=%u " "new rc={l=%d t=%d r=%d b=%d} w=%u h=%u" " RDP=0x%X rc={l=%d t=%d} w=%d h=%d", (uint32) window->handle, window->left, window->top, window->right, window->bottom, window->width, window->height, - x, y, x + width -1, y + height -1, width, height, wnd->windowId, - wnd->windowOffsetX, wnd->windowOffsetY, - wnd->windowWidth, wnd->windowHeight); + x, y, x + width -1, y + height -1, width, height, + window->window->windowId, + window->window->windowOffsetX, window->window->windowOffsetY, + window->window->windowWidth, window->window->windowHeight); window->left = x; window->top = y; @@ -582,6 +577,8 @@ void xf_MoveWindow(xfInfo* xfi, xfWindow* window, int x, int y, int width, int h XMoveResizeWindow(xfi->display, window->handle, x, y, width, height); else XMoveWindow(xfi->display, window->handle, x, y); + + xf_UpdateWindowArea(xfi, window, 0, 0, width, height); } void xf_ShowWindow(xfInfo* xfi, xfWindow* window, uint8 state) diff --git a/client/X11/xf_window.h b/client/X11/xf_window.h index b59cf4dce..15a2c86d6 100644 --- a/client/X11/xf_window.h +++ b/client/X11/xf_window.h @@ -106,7 +106,7 @@ void xf_SetWindowMinMaxInfo(xfInfo* xfi, xfWindow* window, int maxWidth, int max void xf_StartLocalMoveSize(xfInfo* xfi, xfWindow* window, int direction, int x, int y); -void xf_EndLocalMoveSize(xfInfo *xfi, xfWindow *window, boolean cancel); +void xf_EndLocalMoveSize(xfInfo *xfi, xfWindow *window); void xf_SendClientEvent(xfInfo *xfi, xfWindow* window, Atom atom, unsigned int numArgs, ...); #endif /* __XF_WINDOW_H */ diff --git a/libfreerdp-core/tcp.c b/libfreerdp-core/tcp.c index 925e38a74..d4e6fc8e7 100644 --- a/libfreerdp-core/tcp.c +++ b/libfreerdp-core/tcp.c @@ -282,6 +282,7 @@ boolean tcp_set_keep_alive_mode(rdpTcp* tcp) return false; } +#ifdef TCP_KEEPIDLE option_value = 5; option_len = sizeof(option_value); @@ -290,6 +291,7 @@ boolean tcp_set_keep_alive_mode(rdpTcp* tcp) perror("setsockopt() IPPROTO_TCP, SO_KEEPIDLE:"); return false; } +#endif #endif return true; diff --git a/libfreerdp-utils/args.c b/libfreerdp-utils/args.c index 0baa42892..6b35d8031 100644 --- a/libfreerdp-utils/args.c +++ b/libfreerdp-utils/args.c @@ -83,6 +83,7 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, " --ext: load an extension\n" " --no-auth: disable authentication\n" " --no-fastpath: disable fast-path\n" + " --gdi: graphics rendering (hw, sw)\n" " --no-osb: disable offscreen bitmaps\n" " --no-bmp-cache: disable bitmap cache\n" " --plugin: load a virtual channel plugin\n"