Update scaled pointer on FocusIn
This commit is contained in:
parent
2c814138cc
commit
b8f3743e82
@ -33,6 +33,7 @@
|
||||
#include "xf_disp.h"
|
||||
#include "xf_input.h"
|
||||
#include "xf_gfx.h"
|
||||
#include "xf_graphics.h"
|
||||
|
||||
#include "xf_event.h"
|
||||
#include "xf_input.h"
|
||||
@ -615,6 +616,7 @@ static BOOL xf_event_FocusIn(xfContext* xfc, const XFocusInEvent* event, BOOL ap
|
||||
/* Release all keys, should already be done at FocusOut but might be missed
|
||||
* if the WM decided to use an alternate event order */
|
||||
xf_keyboard_release_all_keypress(xfc);
|
||||
xf_pointer_update_scale(xfc);
|
||||
|
||||
if (app)
|
||||
{
|
||||
@ -784,43 +786,42 @@ static BOOL xf_event_ConfigureNotify(xfContext* xfc, const XConfigureEvent* even
|
||||
/* ask the server to resize using the display channel */
|
||||
xf_disp_handle_configureNotify(xfc, alignedWidth, alignedHeight);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
appWindow = xf_AppWindowFromX11Window(xfc, event->window);
|
||||
|
||||
if (appWindow)
|
||||
else
|
||||
{
|
||||
/*
|
||||
* ConfigureNotify coordinates are expressed relative to the window parent.
|
||||
* Translate these to root window coordinates.
|
||||
*/
|
||||
XTranslateCoordinates(xfc->display, appWindow->handle, RootWindowOfScreen(xfc->screen), 0,
|
||||
0, &appWindow->x, &appWindow->y, &childWindow);
|
||||
appWindow->width = event->width;
|
||||
appWindow->height = event->height;
|
||||
appWindow = xf_AppWindowFromX11Window(xfc, event->window);
|
||||
|
||||
/*
|
||||
* Additional checks for not in a local move and not ignoring configure to send
|
||||
* position update to server, also should the window not be focused then do not
|
||||
* send to server yet (i.e. resizing using window decoration).
|
||||
* The server will be updated when the window gets refocused.
|
||||
*/
|
||||
if (appWindow->decorations)
|
||||
if (appWindow)
|
||||
{
|
||||
/* moving resizing using window decoration */
|
||||
xf_rail_adjust_position(xfc, appWindow);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((!event->send_event || appWindow->local_move.state == LMS_NOT_ACTIVE) &&
|
||||
!appWindow->rail_ignore_configure && xfc->focused)
|
||||
/*
|
||||
* ConfigureNotify coordinates are expressed relative to the window parent.
|
||||
* Translate these to root window coordinates.
|
||||
*/
|
||||
XTranslateCoordinates(xfc->display, appWindow->handle, RootWindowOfScreen(xfc->screen),
|
||||
0, 0, &appWindow->x, &appWindow->y, &childWindow);
|
||||
appWindow->width = event->width;
|
||||
appWindow->height = event->height;
|
||||
|
||||
/*
|
||||
* Additional checks for not in a local move and not ignoring configure to send
|
||||
* position update to server, also should the window not be focused then do not
|
||||
* send to server yet (i.e. resizing using window decoration).
|
||||
* The server will be updated when the window gets refocused.
|
||||
*/
|
||||
if (appWindow->decorations)
|
||||
{
|
||||
/* moving resizing using window decoration */
|
||||
xf_rail_adjust_position(xfc, appWindow);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((!event->send_event || appWindow->local_move.state == LMS_NOT_ACTIVE) &&
|
||||
!appWindow->rail_ignore_configure && xfc->focused)
|
||||
xf_rail_adjust_position(xfc, appWindow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return xf_pointer_update_scale(xfc);
|
||||
}
|
||||
|
||||
static BOOL xf_event_MapNotify(xfContext* xfc, const XMapEvent* event, BOOL app)
|
||||
|
@ -44,6 +44,8 @@
|
||||
#include <freerdp/log.h>
|
||||
#define TAG CLIENT_TAG("x11")
|
||||
|
||||
static BOOL xf_Pointer_Set(rdpContext* context, rdpPointer* pointer);
|
||||
|
||||
BOOL xf_decode_color(xfContext* xfc, const UINT32 srcColor, XColor* color)
|
||||
{
|
||||
rdpGdi* gdi;
|
||||
@ -229,8 +231,8 @@ static BOOL xf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL pr
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL _xf_Pointer_GetCursorForCurrentScale(rdpContext* context, rdpPointer* pointer,
|
||||
Cursor* cursor)
|
||||
static BOOL xf_Pointer_GetCursorForCurrentScale(rdpContext* context, rdpPointer* pointer,
|
||||
Cursor* cursor)
|
||||
{
|
||||
#ifdef WITH_XCURSOR
|
||||
UINT32 CursorFormat;
|
||||
@ -262,7 +264,8 @@ static BOOL _xf_Pointer_GetCursorForCurrentScale(rdpContext* context, rdpPointer
|
||||
|
||||
for (i = 0; i < xpointer->nCursors; i++)
|
||||
{
|
||||
if (xpointer->cursorWidths[i] == xTargetSize && xpointer->cursorHeights[i] == yTargetSize)
|
||||
if ((xpointer->cursorWidths[i] == xTargetSize) &&
|
||||
(xpointer->cursorHeights[i] == yTargetSize))
|
||||
{
|
||||
cursorIndex = i;
|
||||
}
|
||||
@ -385,6 +388,18 @@ static Window xf_Pointer_get_window(xfContext* xfc)
|
||||
}
|
||||
}
|
||||
|
||||
BOOL xf_pointer_update_scale(xfContext* xfc)
|
||||
{
|
||||
xfPointer* pointer;
|
||||
WINPR_ASSERT(xfc);
|
||||
|
||||
pointer = xfc->pointer;
|
||||
if (!pointer)
|
||||
return TRUE;
|
||||
|
||||
return xf_Pointer_Set(&xfc->common.context, &xfc->pointer->pointer);
|
||||
}
|
||||
|
||||
static BOOL xf_Pointer_New(rdpContext* context, rdpPointer* pointer)
|
||||
{
|
||||
#ifdef WITH_XCURSOR
|
||||
@ -418,8 +433,6 @@ static BOOL xf_Pointer_New(rdpContext* context, rdpPointer* pointer)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!_xf_Pointer_GetCursorForCurrentScale(context, pointer, &(xpointer->cursor)))
|
||||
return FALSE;
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
@ -456,13 +469,16 @@ static BOOL xf_Pointer_Set(rdpContext* context, rdpPointer* pointer)
|
||||
xfContext* xfc = (xfContext*)context;
|
||||
Window handle = xf_Pointer_get_window(xfc);
|
||||
|
||||
WINPR_ASSERT(xfc);
|
||||
WINPR_ASSERT(pointer);
|
||||
|
||||
xfc->pointer = (xfPointer*)pointer;
|
||||
|
||||
/* in RemoteApp mode, window can be null if none has had focus */
|
||||
|
||||
if (handle)
|
||||
{
|
||||
if (!_xf_Pointer_GetCursorForCurrentScale(context, pointer, &(xfc->pointer->cursor)))
|
||||
if (!xf_Pointer_GetCursorForCurrentScale(context, pointer, &(xfc->pointer->cursor)))
|
||||
return FALSE;
|
||||
xf_lock_x11(xfc);
|
||||
XDefineCursor(xfc->display, handle, xfc->pointer->cursor);
|
||||
|
@ -29,4 +29,6 @@ BOOL xf_register_graphics(rdpGraphics* graphics);
|
||||
BOOL xf_decode_color(xfContext* xfc, const UINT32 srcColor, XColor* color);
|
||||
UINT32 xf_get_local_color_format(xfContext* xfc, BOOL aligned);
|
||||
|
||||
BOOL xf_pointer_update_scale(xfContext* xfc);
|
||||
|
||||
#endif /* FREERDP_CLIENT_X11_GRAPHICS_H */
|
||||
|
Loading…
Reference in New Issue
Block a user