Merge pull request #2361 from bmiklautz/set_pointer_fix

xfreerdp: fix problem with SetPosition
This commit is contained in:
Norbert Federa 2015-02-04 10:03:21 +01:00
commit 0f8fc29dfa

View File

@ -322,16 +322,30 @@ void xf_Pointer_SetDefault(rdpContext* context)
void xf_Pointer_SetPosition(rdpContext* context, UINT32 x, UINT32 y)
{
xfContext* xfc = (xfContext*) context;
XWindowAttributes current;
XSetWindowAttributes tmp;
if (!xfc->focused)
if (!xfc->focused || !xfc->window)
return;
xf_lock_x11(xfc, FALSE);
if (xfc->window)
XWarpPointer(xfc->display, None, xfc->window->handle, 0, 0, 0, 0, x, y);
if (XGetWindowAttributes(xfc->display, xfc->window->handle, &current) == 0)
goto out;
tmp.event_mask = (current.your_event_mask & ~(PointerMotionMask));
if (XChangeWindowAttributes(xfc->display, xfc->window->handle, CWEventMask, &tmp) == 0)
goto out;
XWarpPointer(xfc->display, None, xfc->window->handle, 0, 0, 0, 0, x, y);
tmp.event_mask = current.your_event_mask;
XChangeWindowAttributes(xfc->display, xfc->window->handle, CWEventMask, &tmp);
out:
xf_unlock_x11(xfc, FALSE);
return;
xf_unlock_x11(xfc, FALSE);
}
/* Glyph Class */