Added KeyboardCodePage option

Thanks to @byteboon for the hint.
This commit is contained in:
Armin Novak 2019-11-07 19:31:26 +01:00
parent 02614cce49
commit da87247d61
6 changed files with 28 additions and 3 deletions

View File

@ -2003,6 +2003,19 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
settings->KeyboardLayout = (UINT32)val;
}
CommandLineSwitchCase(arg, "kbd-lang")
{
LONGLONG val;
if (!value_to_int(arg->Value, &val, 1, UINT32_MAX))
{
WLog_ERR(TAG, "Could not identify keyboard active language %s", arg->Value);
WLog_ERR(TAG, "Use /kbd-list to list available layouts");
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
}
settings->KeyboardCodePage = (UINT32)val;
}
CommandLineSwitchCase(arg, "kbd-type")
{
LONGLONG val;

View File

@ -172,6 +172,8 @@ static const COMMAND_LINE_ARGUMENT_A args[] = {
#endif
{ "kbd", COMMAND_LINE_VALUE_REQUIRED, "0x<id> or <name>", NULL, NULL, -1, NULL,
"Keyboard layout" },
{ "kbd-lang", COMMAND_LINE_VALUE_REQUIRED, "0x<id>", NULL, NULL, -1, NULL,
"Keyboard active language identifier" },
{ "kbd-fn-key", COMMAND_LINE_VALUE_REQUIRED, "<value>", NULL, NULL, -1, NULL,
"Function key value" },
{ "kbd-list", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT, NULL, NULL, NULL, -1, NULL,

View File

@ -796,6 +796,7 @@ typedef struct _RDPDR_PARALLEL RDPDR_PARALLEL;
#define FreeRDP_BitmapCacheV2CellInfo (2502)
#define FreeRDP_ColorPointerFlag (2560)
#define FreeRDP_PointerCacheSize (2561)
#define FreeRDP_KeyboardCodePage (2623)
#define FreeRDP_KeyboardLayout (2624)
#define FreeRDP_KeyboardType (2625)
#define FreeRDP_KeyboardSubType (2626)
@ -1320,9 +1321,10 @@ struct rdp_settings
/* Pointer Capabilities */
ALIGN64 BOOL ColorPointerFlag; /* 2560 */
ALIGN64 UINT32 PointerCacheSize; /* 2561 */
UINT64 padding2624[2624 - 2562]; /* 2562 */
UINT64 padding2624[2623 - 2562]; /* 2562 */
/* Input Capabilities */
ALIGN64 UINT32 KeyboardCodePage; /* 2623 */
ALIGN64 UINT32 KeyboardLayout; /* 2624 */
ALIGN64 UINT32 KeyboardType; /* 2625 */
ALIGN64 UINT32 KeyboardSubType; /* 2626 */

View File

@ -1453,6 +1453,9 @@ UINT32 freerdp_settings_get_uint32(rdpSettings* settings, size_t id)
case FreeRDP_PointerCacheSize:
return settings->PointerCacheSize;
case FreeRDP_KeyboardCodePage:
return settings->KeyboardCodePage;
case FreeRDP_KeyboardLayout:
return settings->KeyboardLayout;
@ -1857,6 +1860,10 @@ BOOL freerdp_settings_set_uint32(rdpSettings* settings, size_t id, UINT32 val)
settings->PointerCacheSize = val;
break;
case FreeRDP_KeyboardCodePage:
settings->KeyboardCodePage = val;
break;
case FreeRDP_KeyboardLayout:
settings->KeyboardLayout = val;
break;

View File

@ -491,7 +491,7 @@ static BOOL rdp_read_info_packet(rdpRdp* rdp, wStream* s)
if (Stream_GetRemainingLength(s) < 18)
return FALSE;
Stream_Seek_UINT32(s); /* CodePage (4 bytes ) */
Stream_Read_UINT32(s, settings->KeyboardCodePage); /* CodePage (4 bytes ) */
Stream_Read_UINT32(s, flags); /* flags (4 bytes) */
settings->AudioCapture = ((flags & INFO_AUDIOCAPTURE) ? TRUE : FALSE);
settings->AudioPlayback = ((flags & INFO_NOAUDIOPLAYBACK) ? FALSE : TRUE);
@ -891,7 +891,7 @@ static BOOL rdp_write_info_packet(rdpRdp* rdp, wStream* s)
/* excludes (!) the length of the mandatory null terminator */
cbWorkingDir = cbWorkingDir >= 2 ? cbWorkingDir - 2 : cbWorkingDir;
Stream_Write_UINT32(s, 0); /* CodePage (4 bytes) */
Stream_Write_UINT32(s, settings->KeyboardCodePage); /* CodePage (4 bytes) */
Stream_Write_UINT32(s, flags); /* flags (4 bytes) */
Stream_Write_UINT16(s, cbDomain); /* cbDomain (2 bytes) */
Stream_Write_UINT16(s, cbUserName); /* cbUserName (2 bytes) */

View File

@ -247,6 +247,7 @@ static const size_t uint32_list_indices[] = {
FreeRDP_BitmapCacheVersion,
FreeRDP_BitmapCacheV2NumCells,
FreeRDP_PointerCacheSize,
FreeRDP_KeyboardCodePage,
FreeRDP_KeyboardLayout,
FreeRDP_KeyboardType,
FreeRDP_KeyboardSubType,