void xf_SetWindowStyle(xfContext* xfc, xfAppWindow* appWindow, UINT32 style, UINT32 ex_style) { Atom window_type; BOOL redirect = FALSE; if ((ex_style & WS_EX_NOACTIVATE) || (ex_style & WS_EX_TOOLWINDOW)) { redirect = TRUE; appWindow->is_transient = TRUE; xf_SetWindowUnlisted(xfc, appWindow->handle); window_type = xfc->_NET_WM_WINDOW_TYPE_DROPDOWN_MENU; } /* * TOPMOST window that is not a tool window is treated like a regular window (i.e. task manager). * Want to do this here, since the window may have type WS_POPUP */ else if (ex_style & WS_EX_TOPMOST) { window_type = xfc->_NET_WM_WINDOW_TYPE_NORMAL; } else if (style & WS_POPUP) { /* this includes dialogs, popups, etc, that need to be full-fledged windows */ appWindow->is_transient = TRUE; window_type = xfc->_NET_WM_WINDOW_TYPE_DIALOG; xf_SetWindowUnlisted(xfc, appWindow->handle); } else { window_type = xfc->_NET_WM_WINDOW_TYPE_NORMAL; } { /* * Tooltips and menu items should be unmanaged windows * (called "override redirect" in X windows parlance) * If they are managed, there are issues with window focus that * cause the windows to behave improperly. For example, a mouse * press will dismiss a drop-down menu because the RDP server * sees that as a focus out event from the window owning the * dropdown. */ XSetWindowAttributes attrs; attrs.override_redirect = redirect ? True : False; XChangeWindowAttributes(xfc->display, appWindow->handle, CWOverrideRedirect, &attrs); } XChangeProperty(xfc->display, appWindow->handle, xfc->_NET_WM_WINDOW_TYPE, XA_ATOM, 32, PropModeReplace, (BYTE*) &window_type, 1); }
void xf_SetWindowStyle(xfInfo* xfi, xfWindow* window, uint32 style, uint32 ex_style) { Atom window_type; window_type = xfi->_NET_WM_WINDOW_TYPE_NORMAL; if ((style & WS_POPUP) || (style & WS_DLGFRAME) || (ex_style & WS_EX_DLGMODALFRAME)) { window_type = xfi->_NET_WM_WINDOW_TYPE_DIALOG; } if (ex_style & WS_EX_TOOLWINDOW) { xf_SetWindowUnlisted(xfi, window); window_type = xfi->_NET_WM_WINDOW_TYPE_UTILITY; } XChangeProperty(xfi->display, window->handle, xfi->_NET_WM_WINDOW_TYPE, XA_ATOM, 32, PropModeReplace, (uint8*) &window_type, 1); }
void xf_ShowWindow(xfContext* xfc, xfAppWindow* appWindow, BYTE state) { switch (state) { case WINDOW_HIDE: XWithdrawWindow(xfc->display, appWindow->handle, xfc->screen_number); break; case WINDOW_SHOW_MINIMIZED: XIconifyWindow(xfc->display, appWindow->handle, xfc->screen_number); break; case WINDOW_SHOW_MAXIMIZED: /* Set the window as maximized */ xf_SendClientEvent(xfc, appWindow->handle, xfc->_NET_WM_STATE, 4, _NET_WM_STATE_ADD, xfc->_NET_WM_STATE_MAXIMIZED_VERT, xfc->_NET_WM_STATE_MAXIMIZED_HORZ, 0); /* * This is a workaround for the case where the window is maximized locally before the rail server is told to maximize * the window, this appears to be a race condition where the local window with incomplete data and once the window is * actually maximized on the server - an update of the new areas may not happen. So, we simply to do a full update of * the entire window once the rail server notifies us that the window is now maximized. */ if (appWindow->rail_state == WINDOW_SHOW_MAXIMIZED) { xf_UpdateWindowArea(xfc, appWindow, 0, 0, appWindow->windowWidth, appWindow->windowHeight); } break; case WINDOW_SHOW: /* Ensure the window is not maximized */ xf_SendClientEvent(xfc, appWindow->handle, xfc->_NET_WM_STATE, 4, _NET_WM_STATE_REMOVE, xfc->_NET_WM_STATE_MAXIMIZED_VERT, xfc->_NET_WM_STATE_MAXIMIZED_HORZ, 0); /* * Ignore configure requests until both the Maximized properties have been processed * to prevent condition where WM overrides size of request due to one or both of these properties * still being set - which causes a position adjustment to be sent back to the server * thus causing the window to not return to its original size */ if (appWindow->rail_state == WINDOW_SHOW_MAXIMIZED) appWindow->rail_ignore_configure = TRUE; if (appWindow->is_transient) xf_SetWindowUnlisted(xfc, appWindow->handle); XMapWindow(xfc->display, appWindow->handle); break; } /* Save the current rail state of this window */ appWindow->rail_state = state; XFlush(xfc->display); }