Added lock key synchronization to wfreerdp

This commit is contained in:
erbth 2014-10-03 16:27:47 +02:00
parent ee2626b670
commit 58c392e72e
4 changed files with 47 additions and 2 deletions

View File

@ -738,6 +738,12 @@ DWORD WINAPI wf_client_thread(LPVOID lpParam)
rcount = 0;
wcount = 0;
if (freerdp_focus_required(instance))
{
wf_event_focus_in(wfc);
wf_event_focus_in(wfc);
}
if (!async_transport)
{
if (freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE)

View File

@ -132,8 +132,8 @@ LRESULT CALLBACK wf_ll_kbd_proc(int nCode, WPARAM wParam, LPARAM lParam)
freerdp_input_send_keyboard_event_ex(input, !(p->flags & LLKHF_UP), rdp_scancode);
if (p->vkCode == VK_CAPITAL)
DEBUG_KBD("caps lock is processed on client side too to toggle caps lock indicator");
if (p->vkCode == VK_NUMLOCK || p->vkCode == VK_CAPITAL || p->vkCode == VK_SCROLL || p->vkCode == VK_KANA)
DEBUG_KBD("lock keys are processed on client side too to toggle their indicators");
else
return 1;
@ -153,6 +153,34 @@ LRESULT CALLBACK wf_ll_kbd_proc(int nCode, WPARAM wParam, LPARAM lParam)
return CallNextHookEx(NULL, nCode, wParam, lParam);
}
void wf_event_focus_in(wfContext* wfc)
{
UINT16 syncFlags;
rdpInput* input;
UINT16 mouseX, mouseY;
input = wfc->instance->input;
syncFlags = 0;
if (GetKeyState(VK_NUMLOCK))
syncFlags |= KBD_SYNC_NUM_LOCK;
if (GetKeyState(VK_CAPITAL))
syncFlags |= KBD_SYNC_CAPS_LOCK;
if (GetKeyState(VK_SCROLL))
syncFlags |= KBD_SYNC_SCROLL_LOCK;
if (GetKeyState(VK_KANA))
syncFlags |= KBD_SYNC_KANA_LOCK;
mouseX = 0;
mouseY = 0;
input->FocusInEvent(input, syncFlags, mouseX, mouseY);
}
static int wf_event_process_WM_MOUSEWHEEL(wfContext* wfc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
int delta;
@ -230,6 +258,7 @@ LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam
ptr = GetWindowLongPtr(hWnd, GWLP_USERDATA);
wfc = (wfContext*) ptr;
if (wfc != NULL)
{
input = wfc->instance->input;
@ -540,6 +569,7 @@ LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam
if (alt_ctrl_down())
g_flipping_in = TRUE;
g_focus_hWnd = hWnd;
freerdp_set_focus(wfc->instance);
break;
case WM_KILLFOCUS:

View File

@ -254,6 +254,7 @@ FREERDP_API freerdp* freerdp_new(void);
FREERDP_API void freerdp_free(freerdp* instance);
FREERDP_API BOOL freerdp_focus_required(freerdp* instance);
FREERDP_API void freerdp_set_focus(freerdp* instance);
FREERDP_API UINT32 freerdp_get_last_error(rdpContext* context);
FREERDP_API void freerdp_set_last_error(rdpContext* context, UINT32 lastError);

View File

@ -358,6 +358,14 @@ FREERDP_API BOOL freerdp_focus_required(freerdp* instance)
return bRetCode;
}
void freerdp_set_focus(freerdp* instance)
{
rdpRdp* rdp;
rdp = instance->context->rdp;
rdp->resendFocus = TRUE;
}
void freerdp_get_version(int* major, int* minor, int* revision)
{
if (major != NULL)