Readded override redirect but reset on focus loss.
authorArmin Novak <armin.novak@thincast.com>
Wed, 26 Sep 2018 09:27:57 +0000 (11:27 +0200)
committerArmin Novak <armin.novak@thincast.com>
Wed, 26 Sep 2018 10:38:16 +0000 (12:38 +0200)
client/X11/xf_rail.c
client/X11/xf_window.c

index d03c9fb..a39f636 100644 (file)
@@ -91,6 +91,11 @@ void xf_rail_send_activate(xfContext* xfc, Window xwindow, BOOL enabled)
        if (!appWindow)
                return;
 
+       if (enabled)
+               xf_SetWindowStyle(xfc, appWindow, appWindow->dwStyle, appWindow->dwExStyle);
+       else
+               xf_SetWindowStyle(xfc, appWindow, 0, 0);
+
        activate.windowId = appWindow->windowId;
        activate.enabled = enabled;
        xfc->rail->ClientActivate(xfc->rail, &activate);
index 2aa9f6b..2b639f5 100644 (file)
@@ -655,9 +655,11 @@ 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;
@@ -682,6 +684,22 @@ void xf_SetWindowStyle(xfContext* xfc, xfAppWindow* appWindow, UINT32 style,
                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);
 }