mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2025-06-03 00:00:20 +00:00
[client,sdl] implement mouse move on focus
Send current mouse position move event when focus is gained.
This commit is contained in:
parent
9b1c016371
commit
764753af31
@ -24,6 +24,7 @@
|
|||||||
#include "sdl_freerdp.hpp"
|
#include "sdl_freerdp.hpp"
|
||||||
#include "sdl_utils.hpp"
|
#include "sdl_utils.hpp"
|
||||||
#include "sdl_prefs.hpp"
|
#include "sdl_prefs.hpp"
|
||||||
|
#include "sdl_touch.hpp"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
@ -329,20 +330,24 @@ BOOL sdlInput::keyboard_focus_in()
|
|||||||
freerdp_input_send_focus_in_event(input, WINPR_ASSERTING_INT_CAST(UINT16, syncFlags));
|
freerdp_input_send_focus_in_event(input, WINPR_ASSERTING_INT_CAST(UINT16, syncFlags));
|
||||||
|
|
||||||
/* finish with a mouse pointer position like mstsc.exe if required */
|
/* finish with a mouse pointer position like mstsc.exe if required */
|
||||||
#if 0
|
// TODO: fullscreen/remote app
|
||||||
if (xfc->remote_app)
|
int x = 0;
|
||||||
return;
|
int y = 0;
|
||||||
|
if (_sdl->fullscreen)
|
||||||
if (XQueryPointer(xfc->display, xfc->window->handle, &w, &w, &d, &d, &x, &y, &state))
|
{
|
||||||
{
|
SDL_GetGlobalMouseState(&x, &y);
|
||||||
if ((x >= 0) && (x < xfc->window->width) && (y >= 0) && (y < xfc->window->height))
|
}
|
||||||
{
|
else
|
||||||
xf_event_adjust_coordinates(xfc, &x, &y);
|
{
|
||||||
freerdp_client_send_button_event(&xfc->common, FALSE, PTR_FLAGS_MOVE, x, y);
|
SDL_GetMouseState(&x, &y);
|
||||||
}
|
}
|
||||||
}
|
auto w = SDL_GetMouseFocus();
|
||||||
#endif
|
if (w)
|
||||||
return TRUE;
|
{
|
||||||
|
auto id = SDL_GetWindowID(w);
|
||||||
|
sdl_scale_coordinates(_sdl, id, &x, &y, TRUE, TRUE);
|
||||||
|
}
|
||||||
|
return freerdp_client_send_button_event(_sdl->common(), FALSE, PTR_FLAGS_MOVE, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function is called to update the keyboard indicator LED */
|
/* This function is called to update the keyboard indicator LED */
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "sdl_freerdp.hpp"
|
#include "sdl_freerdp.hpp"
|
||||||
#include "sdl_utils.hpp"
|
#include "sdl_utils.hpp"
|
||||||
#include "sdl_prefs.hpp"
|
#include "sdl_prefs.hpp"
|
||||||
|
#include "sdl_touch.hpp"
|
||||||
|
|
||||||
#include <SDL3/SDL_oldnames.h>
|
#include <SDL3/SDL_oldnames.h>
|
||||||
|
|
||||||
@ -313,20 +314,26 @@ BOOL sdlInput::keyboard_focus_in()
|
|||||||
freerdp_input_send_focus_in_event(input, WINPR_ASSERTING_INT_CAST(uint16_t, syncFlags));
|
freerdp_input_send_focus_in_event(input, WINPR_ASSERTING_INT_CAST(uint16_t, syncFlags));
|
||||||
|
|
||||||
/* finish with a mouse pointer position like mstsc.exe if required */
|
/* finish with a mouse pointer position like mstsc.exe if required */
|
||||||
#if 0
|
// TODO: fullscreen/remote app
|
||||||
if (xfc->remote_app)
|
float fx = 0.0f;
|
||||||
return;
|
float fy = 0.0f;
|
||||||
|
if (_sdl->fullscreen)
|
||||||
if (XQueryPointer(xfc->display, xfc->window->handle, &w, &w, &d, &d, &x, &y, &state))
|
{
|
||||||
{
|
SDL_GetGlobalMouseState(&fx, &fy);
|
||||||
if ((x >= 0) && (x < xfc->window->width) && (y >= 0) && (y < xfc->window->height))
|
}
|
||||||
{
|
else
|
||||||
xf_event_adjust_coordinates(xfc, &x, &y);
|
{
|
||||||
freerdp_client_send_button_event(&xfc->common, FALSE, PTR_FLAGS_MOVE, x, y);
|
SDL_GetMouseState(&fx, &fy);
|
||||||
}
|
}
|
||||||
}
|
auto x = static_cast<int32_t>(fx);
|
||||||
#endif
|
auto y = static_cast<int32_t>(fy);
|
||||||
return TRUE;
|
auto w = SDL_GetMouseFocus();
|
||||||
|
if (w)
|
||||||
|
{
|
||||||
|
auto id = SDL_GetWindowID(w);
|
||||||
|
sdl_scale_coordinates(_sdl, id, &x, &y, TRUE, TRUE);
|
||||||
|
}
|
||||||
|
return freerdp_client_send_button_event(_sdl->common(), FALSE, PTR_FLAGS_MOVE, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function is called to update the keyboard indicator LED */
|
/* This function is called to update the keyboard indicator LED */
|
||||||
|
Loading…
Reference in New Issue
Block a user