diff --git a/client/X11/xf_cliprdr.c b/client/X11/xf_cliprdr.c index 94838e3b2..f8d003d52 100644 --- a/client/X11/xf_cliprdr.c +++ b/client/X11/xf_cliprdr.c @@ -861,6 +861,7 @@ static void xf_cliprdr_process_cb_format_list_event(xfInfo* xfi, RDP_CB_FORMAT_L event->num_formats = 0; cb->num_targets = 2; + for (i = 0; i < cb->num_formats; i++) { for (j = 0; j < cb->num_format_mappings; j++) @@ -874,6 +875,7 @@ static void xf_cliprdr_process_cb_format_list_event(xfInfo* xfi, RDP_CB_FORMAT_L } XSetSelectionOwner(xfi->display, cb->clipboard_atom, xfi->drawable, CurrentTime); + if (event->raw_format_data) { XChangeProperty(xfi->display, cb->root_window, cb->property_atom, diff --git a/client/X11/xf_event.c b/client/X11/xf_event.c index 836116ab3..5c9ba42ba 100644 --- a/client/X11/xf_event.c +++ b/client/X11/xf_event.c @@ -134,6 +134,7 @@ static BOOL xf_event_MotionNotify(xfInfo* xfi, XEvent* event, BOOL app) { return TRUE; } + /* Translate to desktop coordinates */ XTranslateCoordinates(xfi->display, event->xmotion.window, RootWindowOfScreen(xfi->screen), @@ -597,7 +598,7 @@ static BOOL xf_event_MapNotify(xfInfo* xfi, XEvent* event, BOOL app) */ //xf_rail_send_client_system_command(xfi, window->windowId, SC_RESTORE); - xfWindow *xfw = (xfWindow*) window->extra; + xfWindow* xfw = (xfWindow*) window->extra; xfw->is_mapped = TRUE; } } @@ -681,9 +682,10 @@ static BOOL xf_event_PropertyNotify(xfInfo* xfi, XEvent* event, BOOL app) if (window == NULL) return TRUE; - if ((((Atom)event->xproperty.atom == xfi->_NET_WM_STATE) && (event->xproperty.state != PropertyDelete)) || - (((Atom)event->xproperty.atom == xfi->WM_STATE) && (event->xproperty.state != PropertyDelete))) + if ((((Atom) event->xproperty.atom == xfi->_NET_WM_STATE) && (event->xproperty.state != PropertyDelete)) || + (((Atom) event->xproperty.atom == xfi->WM_STATE) && (event->xproperty.state != PropertyDelete))) { + int i; BOOL status; BOOL maxVert = FALSE; BOOL maxHorz = FALSE; @@ -691,68 +693,72 @@ static BOOL xf_event_PropertyNotify(xfInfo* xfi, XEvent* event, BOOL app) unsigned long nitems; unsigned long bytes; unsigned char* prop; - int i; - status = xf_GetWindowProperty(xfi, event->xproperty.window, - xfi->_NET_WM_STATE, 12, &nitems, &bytes, &prop); - - if (!status) + if ((Atom) event->xproperty.atom == xfi->_NET_WM_STATE) { - DEBUG_X11_LMS("No return _NET_WM_STATE, window is not maximized"); - } - - for (i = 0; i < nitems; i++) - { - if ((Atom) ((UINT16 **) prop)[i] == XInternAtom(xfi->display, "_NET_WM_STATE_MAXIMIZED_VERT", False)) - { - maxVert = TRUE; - } + status = xf_GetWindowProperty(xfi, event->xproperty.window, + xfi->_NET_WM_STATE, 12, &nitems, &bytes, &prop); - if ((Atom) ((UINT16 **)prop)[i] == XInternAtom(xfi->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False)) - { - maxHorz = TRUE; - } + if (!status) + { + DEBUG_X11_LMS("No return _NET_WM_STATE, window is not maximized"); + } + + for (i = 0; i < nitems; i++) + { + if ((Atom) ((UINT16**) prop)[i] == XInternAtom(xfi->display, "_NET_WM_STATE_MAXIMIZED_VERT", False)) + { + maxVert = TRUE; + } + + if ((Atom) ((UINT16**) prop)[i] == XInternAtom(xfi->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False)) + { + maxHorz = TRUE; + } + } + + XFree(prop); } - - XFree(prop); - status = xf_GetWindowProperty(xfi, event->xproperty.window, - xfi->WM_STATE, 1, &nitems, &bytes, &prop); - - if (!status) + if ((Atom) event->xproperty.atom == xfi->WM_STATE) { - DEBUG_X11_LMS("No return WM_STATE, window is not minimized"); + status = xf_GetWindowProperty(xfi, event->xproperty.window, xfi->WM_STATE, 1, &nitems, &bytes, &prop); + + if (!status) + { + DEBUG_X11_LMS("No return WM_STATE, window is not minimized"); + } + else + { + /* If the window is in the iconic state */ + if (((UINT32) *prop == 3)) + minimized = TRUE; + else + minimized = FALSE; + + XFree(prop); + } } - else - { - /* If the window is in the iconic state */ - if (((UINT32) *prop == 3)) - minimized = TRUE; - else - minimized = FALSE; - - XFree(prop); - } - if (maxVert && maxHorz && !minimized && (xfi->window->rail_state != WINDOW_SHOW_MAXIMIZED)) - { - DEBUG_X11_LMS("Send SC_MAXIMIZE command to rail server."); - xfi->window->rail_state = WINDOW_SHOW_MAXIMIZED; - xf_rail_send_client_system_command(xfi, window->windowId, SC_MAXIMIZE); - } - else if (minimized && (xfi->window->rail_state != WINDOW_SHOW_MINIMIZED)) - { - DEBUG_X11_LMS("Send SC_MINIMIZE command to rail server."); - xfi->window->rail_state = WINDOW_SHOW_MINIMIZED; - xf_rail_send_client_system_command(xfi, window->windowId, SC_MINIMIZE); - } - else if (!minimized && !maxVert && !maxHorz && (xfi->window->rail_state != WINDOW_SHOW)) - { - DEBUG_X11_LMS("Send SC_RESTORE command to rail server"); - xfi->window->rail_state = WINDOW_SHOW; - xf_rail_send_client_system_command(xfi, window->windowId, SC_RESTORE); - } + if (maxVert && maxHorz && !minimized && (xfi->window->rail_state != WINDOW_SHOW_MAXIMIZED)) + { + DEBUG_X11_LMS("Send SC_MAXIMIZE command to rail server."); + xfi->window->rail_state = WINDOW_SHOW_MAXIMIZED; + xf_rail_send_client_system_command(xfi, window->windowId, SC_MAXIMIZE); + } + else if (minimized && (xfi->window->rail_state != WINDOW_SHOW_MINIMIZED)) + { + DEBUG_X11_LMS("Send SC_MINIMIZE command to rail server."); + xfi->window->rail_state = WINDOW_SHOW_MINIMIZED; + xf_rail_send_client_system_command(xfi, window->windowId, SC_MINIMIZE); + } + else if (!minimized && !maxVert && !maxHorz && (xfi->window->rail_state != WINDOW_SHOW)) + { + DEBUG_X11_LMS("Send SC_RESTORE command to rail server"); + xfi->window->rail_state = WINDOW_SHOW; + xf_rail_send_client_system_command(xfi, window->windowId, SC_RESTORE); + } } } else diff --git a/client/X11/xf_window.c b/client/X11/xf_window.c index 96e3a8258..e7a144783 100644 --- a/client/X11/xf_window.c +++ b/client/X11/xf_window.c @@ -171,7 +171,7 @@ BOOL xf_GetCurrentDesktop(xfInfo* xfi) status = xf_GetWindowProperty(xfi, DefaultRootWindow(xfi->display), xfi->_NET_CURRENT_DESKTOP, 1, &nitems, &bytes, &prop); - if (status != TRUE) + if (!status) return FALSE; xfi->current_desktop = (int) *prop; @@ -490,10 +490,17 @@ xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width, window->width = width; window->height = height; - /* this window need decorations - the WS_EX_APPWINDOW is used to tell the client to use local decorations - only sent from xrdp */ - window->decorations = (wnd->extendedStyle & WS_EX_APPWINDOW) ? TRUE : FALSE; + /* + * this window need decorations the WS_EX_APPWINDOW is used to + * tell the client to use local decorations only sent from xrdp + * + * Marc: we need to find another value than WS_EX_APPWINDOW for XRDP + * since it is used by the Microsoft RDP server for programs like cmd.exe + */ + + window->decorations = FALSE; + //window->decorations = (wnd->extendedStyle & WS_EX_APPWINDOW) ? TRUE : FALSE; + window->fullscreen = FALSE; window->window = wnd; window->local_move.state = LMS_NOT_ACTIVE; diff --git a/client/X11/xfreerdp.c b/client/X11/xfreerdp.c index 52849d5e2..88c0f5e3e 100644 --- a/client/X11/xfreerdp.c +++ b/client/X11/xfreerdp.c @@ -389,16 +389,16 @@ void xf_create_window(xfInfo* xfi) width = xfi->width; height = xfi->height; - xfi->attribs.background_pixel = BlackPixelOfScreen(xfi->screen); - xfi->attribs.border_pixel = WhitePixelOfScreen(xfi->screen); - xfi->attribs.backing_store = xfi->primary ? NotUseful : Always; - xfi->attribs.override_redirect = xfi->grab_keyboard ? xfi->fullscreen : False; - xfi->attribs.colormap = xfi->colormap; - xfi->attribs.bit_gravity = NorthWestGravity; - xfi->attribs.win_gravity = NorthWestGravity; - if (!xfi->remote_app) { + xfi->attribs.background_pixel = BlackPixelOfScreen(xfi->screen); + xfi->attribs.border_pixel = WhitePixelOfScreen(xfi->screen); + xfi->attribs.backing_store = xfi->primary ? NotUseful : Always; + xfi->attribs.override_redirect = xfi->grab_keyboard ? xfi->fullscreen : False; + xfi->attribs.colormap = xfi->colormap; + xfi->attribs.bit_gravity = NorthWestGravity; + xfi->attribs.win_gravity = NorthWestGravity; + if (xfi->instance->settings->WindowTitle != NULL) { win_title = _strdup(xfi->instance->settings->WindowTitle); @@ -732,7 +732,7 @@ BOOL xf_pre_connect(freerdp* instance) xfi->_NET_WM_WINDOW_TYPE_NORMAL = XInternAtom(xfi->display, "_NET_WM_WINDOW_TYPE_NORMAL", False); xfi->_NET_WM_WINDOW_TYPE_DIALOG = XInternAtom(xfi->display, "_NET_WM_WINDOW_TYPE_DIALOG", False); - xfi->_NET_WM_WINDOW_TYPE_POPUP= XInternAtom(xfi->display, "_NET_WM_WINDOW_TYPE_POPUP", False); + xfi->_NET_WM_WINDOW_TYPE_POPUP = XInternAtom(xfi->display, "_NET_WM_WINDOW_TYPE_POPUP", False); xfi->_NET_WM_WINDOW_TYPE_UTILITY = XInternAtom(xfi->display, "_NET_WM_WINDOW_TYPE_UTILITY", False); xfi->_NET_WM_WINDOW_TYPE_DROPDOWN_MENU = XInternAtom(xfi->display, "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU", False); xfi->_NET_WM_STATE_SKIP_TASKBAR = XInternAtom(xfi->display, "_NET_WM_STATE_SKIP_TASKBAR", False);