mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
[locale,keyboard] deprecate keyboard mapping
* deprecate keyboard mapping functions: * not context sensitive bug app global * only work reliable with XKB files * expose functions to parse and remap RDP scancodes
This commit is contained in:
@@ -324,19 +324,20 @@ BOOL wlf_handle_pointer_source(freerdp* instance, const UwacPointerSourceEvent*
|
||||
|
||||
BOOL wlf_handle_key(freerdp* instance, const UwacKeyEvent* ev)
|
||||
{
|
||||
rdpInput* input = NULL;
|
||||
DWORD rdp_scancode = 0;
|
||||
|
||||
if (!instance || !ev)
|
||||
return FALSE;
|
||||
|
||||
WINPR_ASSERT(instance->context);
|
||||
wlfContext* ctx = (wlfContext*)instance->context;
|
||||
if (freerdp_settings_get_bool(instance->context->settings, FreeRDP_GrabKeyboard) &&
|
||||
ev->raw_key == KEY_RIGHTCTRL)
|
||||
wlf_handle_ungrab_key(instance, ev);
|
||||
|
||||
input = instance->context->input;
|
||||
rdp_scancode = freerdp_keyboard_get_rdp_scancode_from_x11_keycode(ev->raw_key + 8);
|
||||
rdpInput* input = instance->context->input;
|
||||
|
||||
const DWORD vc = GetVirtualKeyCodeFromKeycode(ev->raw_key, WINPR_KEYCODE_TYPE_EVDEV);
|
||||
const DWORD sc = GetVirtualScanCodeFromVirtualKeyCode(vc, WINPR_KBD_TYPE_IBM_ENHANCED);
|
||||
const DWORD rdp_scancode = freerdp_keyboard_remap_key(ctx->remap_table, sc);
|
||||
|
||||
if (rdp_scancode == RDP_SCANCODE_UNKNOWN)
|
||||
return TRUE;
|
||||
|
||||
@@ -284,12 +284,12 @@ static BOOL wl_post_connect(freerdp* instance)
|
||||
UwacWindowSetOpaqueRegion(context->window, 0, 0, w, h);
|
||||
instance->context->update->EndPaint = wl_end_paint;
|
||||
instance->context->update->DesktopResize = wl_resize_display;
|
||||
UINT32 KeyboardLayout =
|
||||
freerdp_settings_get_uint32(instance->context->settings, FreeRDP_KeyboardLayout);
|
||||
const char* KeyboardRemappingList =
|
||||
freerdp_settings_get_string(instance->context->settings, FreeRDP_KeyboardRemappingList);
|
||||
|
||||
freerdp_keyboard_init_ex(KeyboardLayout, KeyboardRemappingList);
|
||||
context->remap_table = freerdp_keyboard_remap_string_to_list(KeyboardRemappingList);
|
||||
if (!context->remap_table)
|
||||
return FALSE;
|
||||
|
||||
if (!(context->disp = wlf_disp_new(context)))
|
||||
return FALSE;
|
||||
@@ -304,21 +304,21 @@ static BOOL wl_post_connect(freerdp* instance)
|
||||
|
||||
static void wl_post_disconnect(freerdp* instance)
|
||||
{
|
||||
wlfContext* context = NULL;
|
||||
|
||||
if (!instance)
|
||||
return;
|
||||
|
||||
if (!instance->context)
|
||||
return;
|
||||
|
||||
context = (wlfContext*)instance->context;
|
||||
wlfContext* context = (wlfContext*)instance->context;
|
||||
gdi_free(instance);
|
||||
wlf_clipboard_free(context->clipboard);
|
||||
wlf_disp_free(context->disp);
|
||||
|
||||
if (context->window)
|
||||
UwacDestroyWindow(&context->window);
|
||||
freerdp_keyboard_remap_free(context->remap_table);
|
||||
context->remap_table = NULL;
|
||||
}
|
||||
|
||||
static BOOL handle_uwac_events(freerdp* instance, UwacDisplay* display)
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <freerdp/gdi/gfx.h>
|
||||
#include <freerdp/freerdp.h>
|
||||
#include <freerdp/log.h>
|
||||
#include <freerdp/locale/keyboard.h>
|
||||
#include <winpr/wtypes.h>
|
||||
#include <uwac/uwac.h>
|
||||
|
||||
@@ -49,6 +50,7 @@ typedef struct
|
||||
wLog* log;
|
||||
CRITICAL_SECTION critical;
|
||||
wArrayList* events;
|
||||
FREERDP_REMAP_TABLE* remap_table;
|
||||
} wlfContext;
|
||||
|
||||
BOOL wlf_scale_coordinates(rdpContext* context, UINT32* px, UINT32* py, BOOL fromLocalToRDP);
|
||||
|
||||
Reference in New Issue
Block a user