Merge pull request #4891 from akallabeth/rail_fixes

Rail fixes #4846 and a crash
This commit is contained in:
akallabeth 2018-10-17 11:32:56 +02:00 committed by GitHub
commit 5778bf102b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 39 additions and 21 deletions

View File

@ -1873,6 +1873,8 @@ static BOOL xfreerdp_client_new(freerdp* instance, rdpContext* context)
"_NET_WM_WINDOW_TYPE_DIALOG", False);
xfc->_NET_WM_WINDOW_TYPE_POPUP = XInternAtom(xfc->display,
"_NET_WM_WINDOW_TYPE_POPUP", False);
xfc->_NET_WM_WINDOW_TYPE_POPUP_MENU = XInternAtom(xfc->display,
"_NET_WM_WINDOW_TYPE_POPUP_MENU", False);
xfc->_NET_WM_WINDOW_TYPE_UTILITY = XInternAtom(xfc->display,
"_NET_WM_WINDOW_TYPE_UTILITY", False);
xfc->_NET_WM_WINDOW_TYPE_DROPDOWN_MENU = XInternAtom(xfc->display,

View File

@ -110,7 +110,6 @@ void xf_floatbar_set_root_y(xfContext* xfc, int y)
{
xfFloatbar* floatbar;
floatbar = xfc->window->floatbar;
floatbar->last_motion_y_root = y;
}
@ -209,12 +208,11 @@ xfFloatbar* xf_floatbar_new(xfContext* xfc, Window window)
floatbar = (xfFloatbar*) calloc(1, sizeof(xfFloatbar));
floatbar->locked = TRUE;
XGetWindowAttributes(xfc->display, window, &attr);
for(i = 0; i < xfc->vscreen.nmonitors; i++)
for (i = 0; i < xfc->vscreen.nmonitors; i++)
{
if(attr.x >= xfc->vscreen.monitors[i].area.left && attr.x <= xfc->vscreen.monitors[i].area.right)
if (attr.x >= xfc->vscreen.monitors[i].area.left && attr.x <= xfc->vscreen.monitors[i].area.right)
{
width = xfc->vscreen.monitors[i].area.right - xfc->vscreen.monitors[i].area.left;
floatbar->x = width / 2 + xfc->vscreen.monitors[i].area.left - FLOATBAR_DEFAULT_WIDTH / 2;
@ -586,7 +584,11 @@ BOOL xf_floatbar_check_event(xfContext* xfc, XEvent* event)
{
xfFloatbar* floatbar;
xfFloatbarButton* button;
int i, size;
size_t i, size;
if (!xfc || !event || !xfc->window)
return FALSE;
floatbar = xfc->window->floatbar;
if (event->xany.window == floatbar->handle)
@ -608,6 +610,10 @@ BOOL xf_floatbar_check_event(xfContext* xfc, XEvent* event)
BOOL xf_floatbar_event_process(xfContext* xfc, XEvent* event)
{
xfFloatbar* floatbar;
if (!xfc || !xfc->window || !event)
return FALSE;
floatbar = xfc->window->floatbar;
switch (event->type)
@ -691,7 +697,7 @@ static void xf_floatbar_button_free(xfContext* xfc, xfFloatbarButton* button)
void xf_floatbar_free(xfContext* xfc, xfWindow* window, xfFloatbar* floatbar)
{
int i, size;
size_t i, size;
size = ARRAYSIZE(floatbar->buttons);
if (!floatbar)

View 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);

View File

@ -616,7 +616,6 @@ void xf_ResizeDesktopWindow(xfContext* xfc, xfWindow* window, int width,
}
XSetWMNormalHints(xfc->display, window->handle, size_hints);
XFree(size_hints);
}
@ -656,25 +655,14 @@ 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))
{
/*
* 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 = True;
XChangeWindowAttributes(xfc->display, appWindow->handle, CWOverrideRedirect,
&attrs);
redirect = TRUE;
appWindow->is_transient = TRUE;
xf_SetWindowUnlisted(xfc, appWindow->handle);
window_type = xfc->_NET_WM_WINDOW_TYPE_POPUP;
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).
@ -696,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);
}

View File

@ -204,6 +204,7 @@ struct xf_context
Atom _NET_WM_WINDOW_TYPE_DIALOG;
Atom _NET_WM_WINDOW_TYPE_UTILITY;
Atom _NET_WM_WINDOW_TYPE_POPUP;
Atom _NET_WM_WINDOW_TYPE_POPUP_MENU;
Atom _NET_WM_WINDOW_TYPE_DROPDOWN_MENU;
Atom _NET_WM_MOVERESIZE;