diff --git a/client/SDL/SDL2/sdl_kbd.cpp b/client/SDL/SDL2/sdl_kbd.cpp index 7648a4dd0..a80e37c1c 100644 --- a/client/SDL/SDL2/sdl_kbd.cpp +++ b/client/SDL/SDL2/sdl_kbd.cpp @@ -24,6 +24,7 @@ #include "sdl_freerdp.hpp" #include "sdl_utils.hpp" #include "sdl_prefs.hpp" +#include "sdl_touch.hpp" #include @@ -329,20 +330,24 @@ BOOL sdlInput::keyboard_focus_in() freerdp_input_send_focus_in_event(input, WINPR_ASSERTING_INT_CAST(UINT16, syncFlags)); /* finish with a mouse pointer position like mstsc.exe if required */ -#if 0 - if (xfc->remote_app) - return; - - if (XQueryPointer(xfc->display, xfc->window->handle, &w, &w, &d, &d, &x, &y, &state)) - { - if ((x >= 0) && (x < xfc->window->width) && (y >= 0) && (y < xfc->window->height)) - { - xf_event_adjust_coordinates(xfc, &x, &y); - freerdp_client_send_button_event(&xfc->common, FALSE, PTR_FLAGS_MOVE, x, y); - } - } -#endif - return TRUE; + // TODO: fullscreen/remote app + int x = 0; + int y = 0; + if (_sdl->fullscreen) + { + SDL_GetGlobalMouseState(&x, &y); + } + else + { + SDL_GetMouseState(&x, &y); + } + 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 */ diff --git a/client/SDL/SDL3/sdl_kbd.cpp b/client/SDL/SDL3/sdl_kbd.cpp index edd99784a..25f4a7965 100644 --- a/client/SDL/SDL3/sdl_kbd.cpp +++ b/client/SDL/SDL3/sdl_kbd.cpp @@ -22,6 +22,7 @@ #include "sdl_freerdp.hpp" #include "sdl_utils.hpp" #include "sdl_prefs.hpp" +#include "sdl_touch.hpp" #include @@ -313,20 +314,26 @@ BOOL sdlInput::keyboard_focus_in() 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 */ -#if 0 - if (xfc->remote_app) - return; - - if (XQueryPointer(xfc->display, xfc->window->handle, &w, &w, &d, &d, &x, &y, &state)) - { - if ((x >= 0) && (x < xfc->window->width) && (y >= 0) && (y < xfc->window->height)) - { - xf_event_adjust_coordinates(xfc, &x, &y); - freerdp_client_send_button_event(&xfc->common, FALSE, PTR_FLAGS_MOVE, x, y); - } - } -#endif - return TRUE; + // TODO: fullscreen/remote app + float fx = 0.0f; + float fy = 0.0f; + if (_sdl->fullscreen) + { + SDL_GetGlobalMouseState(&fx, &fy); + } + else + { + SDL_GetMouseState(&fx, &fy); + } + auto x = static_cast(fx); + auto y = static_cast(fy); + 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 */