Added support for Set Keyboard IME Status

This commit is contained in:
Armin Novak 2017-05-12 09:43:58 +02:00
parent 1e3d4d62a4
commit b1d631f1e5
9 changed files with 79 additions and 11 deletions

View File

@ -1276,6 +1276,8 @@ static BOOL xf_post_connect(freerdp* instance)
pointer_cache_register_callbacks(update);
update->PlaySound = xf_play_sound;
update->SetKeyboardIndicators = xf_keyboard_set_indicators;
update->SetKeyboardImeStatus = xf_keyboard_set_ime_status;
if (!(xfc->clipboard = xf_clipboard_new(xfc)))
return FALSE;
@ -1284,6 +1286,7 @@ static BOOL xf_post_connect(freerdp* instance)
e.width = settings->DesktopWidth;
e.height = settings->DesktopHeight;
PubSub_OnResizeWindow(context->pubSub, xfc, &e);
return TRUE;
}

View File

@ -613,3 +613,14 @@ BOOL xf_keyboard_set_indicators(rdpContext* context, UINT16 led_flags)
xf_keyboard_set_key_state(xfc, led_flags & KBD_SYNC_KANA_LOCK, XK_Kana_Lock);
return TRUE;
}
BOOL xf_keyboard_set_ime_status(rdpContext* context, UINT16 imeId, UINT32 imeState, UINT32 imeConvMode)
{
if (!context)
return FALSE;
WLog_WARN(TAG, "KeyboardSetImeStatus(unitId=%04"PRIx16", imeState=%08"PRIx32", imeConvMode=%08"PRIx32") ignored",
imeId, imeState, imeConvMode);
return TRUE;
}

View File

@ -17,8 +17,8 @@
* limitations under the License.
*/
#ifndef __XF_KEYBOARD_H
#define __XF_KEYBOARD_H
#ifndef XF_KEYBOARD_H
#define XF_KEYBOARD_H
#include <freerdp/locale/keyboard.h>
@ -57,5 +57,6 @@ void xf_keyboard_focus_in(xfContext* xfc);
BOOL xf_keyboard_handle_special_keys(xfContext* xfc, KeySym keysym);
void xf_keyboard_handle_special_keys_release(xfContext* xfc, KeySym keysym);
BOOL xf_keyboard_set_indicators(rdpContext* context, UINT16 led_flags);
BOOL xf_keyboard_set_ime_status(rdpContext* context, UINT16 imeId, UINT32 imeState, UINT32 imeConvMode);
#endif /* __XF_KEYBOARD_H */

View File

@ -55,6 +55,7 @@
#define Update_SurfaceFrameMarker 13
#define Update_SurfaceFrameAcknowledge 14
#define Update_SetKeyboardIndicators 15
#define Update_SetKeyboardImeStatus 16
#define FREERDP_UPDATE_BEGIN_PAINT MakeMessageId(Update, BeginPaint)
#define FREERDP_UPDATE_ END_PAINT MakeMessageId(Update, EndPaint)

View File

@ -161,6 +161,7 @@ typedef BOOL (*pSurfaceFrameBits)(rdpContext* context,
typedef BOOL (*pSurfaceFrameAcknowledge)(rdpContext* context, UINT32 frameId);
typedef BOOL (*pSaveSessionInfo)(rdpContext *context, UINT32 type, void *data);
typedef BOOL (*pSetKeyboardImeStatus)(rdpContext* context, UINT16 imeId, UINT32 imeState, UINT32 imeConvMode);
struct rdp_update
{
@ -176,7 +177,8 @@ struct rdp_update
pPalette Palette; /* 22 */
pPlaySound PlaySound; /* 23 */
pSetKeyboardIndicators SetKeyboardIndicators; /* 24 */
UINT32 paddingB[32 - 25]; /* 25 */
pSetKeyboardImeStatus SetKeyboardImeStatus; /* 25 */
UINT32 paddingB[32 - 26]; /* 26 */
rdpPointerUpdate* pointer; /* 32 */
rdpPrimaryUpdate* primary; /* 33 */

View File

@ -196,6 +196,15 @@ static BOOL update_message_SetKeyboardIndicators(rdpContext* context, UINT16 led
MakeMessageId(Update, SetKeyboardIndicators), (void*)(size_t)led_flags, NULL);
}
static BOOL update_message_SetKeyboardImeStatus(rdpContext* context, UINT16 imeId, UINT32 imeState, UINT32 imeConvMode)
{
if (!context || !context->update)
return FALSE;
return MessageQueue_Post(context->update->queue, (void*) context,
MakeMessageId(Update, SetKeyboardImeStatus), (void*)(size_t)((imeId << 16UL) | imeState), (void*)(size_t) imeConvMode);
}
static BOOL update_message_RefreshRect(rdpContext* context, BYTE count,
const RECTANGLE_16* areas)
{
@ -1706,6 +1715,7 @@ static int update_message_free_update_class(wMessage* msg, int type)
case Update_SurfaceFrameAcknowledge:
case Update_SetKeyboardIndicators:
case Update_SetKeyboardImeStatus:
break;
default:
@ -1788,6 +1798,15 @@ static int update_message_process_update_class(rdpUpdateProxy* proxy, wMessage*
IFCALL(proxy->SetKeyboardIndicators, msg->context, (UINT16)(size_t) msg->wParam);
break;
case Update_SetKeyboardImeStatus:
{
const UINT16 imeId = ((size_t)msg->wParam) >> 16 & 0xFFFF;
const UINT32 imeState = ((size_t)msg->wParam) & 0xFFFF;
const UINT32 imeConvMode = ((size_t)msg->lParam);
IFCALL(proxy->SetKeyboardImeStatus, msg->context, imeId, imeState, imeConvMode);
}
break;
default:
status = -1;
break;
@ -2687,6 +2706,7 @@ static BOOL update_message_register_interface(rdpUpdateProxy* message, rdpUpdate
message->Palette = update->Palette;
message->PlaySound = update->PlaySound;
message->SetKeyboardIndicators = update->SetKeyboardIndicators;
message->SetKeyboardImeStatus = update->SetKeyboardImeStatus;
message->RefreshRect = update->RefreshRect;
message->SuppressOutput = update->SuppressOutput;
message->SurfaceCommand = update->SurfaceCommand;
@ -2702,6 +2722,7 @@ static BOOL update_message_register_interface(rdpUpdateProxy* message, rdpUpdate
update->Palette = update_message_Palette;
update->PlaySound = update_message_PlaySound;
update->SetKeyboardIndicators = update_message_SetKeyboardIndicators;
update->SetKeyboardImeStatus = update_message_SetKeyboardImeStatus;
update->RefreshRect = update_message_RefreshRect;
update->SuppressOutput = update_message_SuppressOutput;
update->SurfaceCommand = update_message_SurfaceCommand;

View File

@ -45,6 +45,7 @@ struct rdp_update_proxy
pPalette Palette;
pPlaySound PlaySound;
pSetKeyboardIndicators SetKeyboardIndicators;
pSetKeyboardImeStatus SetKeyboardImeStatus;
pRefreshRect RefreshRect;
pSuppressOutput SuppressOutput;
pSurfaceCommand SurfaceCommand;

View File

@ -34,7 +34,7 @@
#define TAG FREERDP_TAG("core.rdp")
const char* DATA_PDU_TYPE_STRINGS[80] =
static const char* DATA_PDU_TYPE_STRINGS[80] =
{
"?", "?", /* 0x00 - 0x01 */
"Update", /* 0x02 */
@ -626,12 +626,12 @@ BOOL rdp_send_message_channel_pdu(rdpRdp* rdp, wStream* s, UINT16 sec_flags)
return TRUE;
}
BOOL rdp_recv_server_shutdown_denied_pdu(rdpRdp* rdp, wStream* s)
static BOOL rdp_recv_server_shutdown_denied_pdu(rdpRdp* rdp, wStream* s)
{
return TRUE;
}
BOOL rdp_recv_server_set_keyboard_indicators_pdu(rdpRdp* rdp, wStream* s)
static BOOL rdp_recv_server_set_keyboard_indicators_pdu(rdpRdp* rdp, wStream* s)
{
UINT16 unitId;
UINT16 ledFlags;
@ -648,22 +648,28 @@ BOOL rdp_recv_server_set_keyboard_indicators_pdu(rdpRdp* rdp, wStream* s)
return TRUE;
}
BOOL rdp_recv_server_set_keyboard_ime_status_pdu(rdpRdp* rdp, wStream* s)
static BOOL rdp_recv_server_set_keyboard_ime_status_pdu(rdpRdp* rdp, wStream* s)
{
UINT16 unitId;
UINT32 imeState;
UINT32 imeConvMode;
if (!rdp || !rdp->input)
return FALSE;
if (Stream_GetRemainingLength(s) < 10)
return FALSE;
Stream_Read_UINT16(s, unitId); /* unitId (2 bytes) */
Stream_Read_UINT32(s, imeState); /* imeState (4 bytes) */
Stream_Read_UINT32(s, imeConvMode); /* imeConvMode (4 bytes) */
IFCALL(rdp->update->SetKeyboardImeStatus, rdp->context, unitId, imeState, imeConvMode);
return TRUE;
}
BOOL rdp_recv_set_error_info_data_pdu(rdpRdp* rdp, wStream* s)
static BOOL rdp_recv_set_error_info_data_pdu(rdpRdp* rdp, wStream* s)
{
UINT32 errorInfo;
@ -674,7 +680,7 @@ BOOL rdp_recv_set_error_info_data_pdu(rdpRdp* rdp, wStream* s)
return rdp_set_error_info(rdp, errorInfo);
}
BOOL rdp_recv_server_auto_reconnect_status_pdu(rdpRdp* rdp, wStream* s)
static BOOL rdp_recv_server_auto_reconnect_status_pdu(rdpRdp* rdp, wStream* s)
{
UINT32 arcStatus;
@ -688,7 +694,7 @@ BOOL rdp_recv_server_auto_reconnect_status_pdu(rdpRdp* rdp, wStream* s)
return TRUE;
}
BOOL rdp_recv_server_status_info_pdu(rdpRdp* rdp, wStream* s)
static BOOL rdp_recv_server_status_info_pdu(rdpRdp* rdp, wStream* s)
{
UINT32 statusCode;
@ -699,7 +705,7 @@ BOOL rdp_recv_server_status_info_pdu(rdpRdp* rdp, wStream* s)
return TRUE;
}
BOOL rdp_recv_monitor_layout_pdu(rdpRdp* rdp, wStream* s)
static BOOL rdp_recv_monitor_layout_pdu(rdpRdp* rdp, wStream* s)
{
UINT32 index;
UINT32 monitorCount;

View File

@ -1955,6 +1955,27 @@ static BOOL update_send_set_keyboard_indicators(rdpContext* context,
return ret;
}
static BOOL update_send_set_keyboard_ime_status(rdpContext* context,
UINT16 imeId, UINT32 imeState, UINT32 imeConvMode)
{
wStream* s;
rdpRdp* rdp = context->rdp;
BOOL ret;
s = rdp_data_pdu_init(rdp);
if (!s)
return FALSE;
/* unitId should be 0 according to MS-RDPBCGR 2.2.8.2.2.1 */
Stream_Write_UINT16(s, imeId);
Stream_Write_UINT32(s, imeState);
Stream_Write_UINT32(s, imeConvMode);
ret = rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_SET_KEYBOARD_IME_STATUS,
rdp->mcs->userId);
Stream_Release(s);
return ret;
}
void update_register_server_callbacks(rdpUpdate* update)
{
update->BeginPaint = update_begin_paint;
@ -1969,6 +1990,7 @@ void update_register_server_callbacks(rdpUpdate* update)
update->SurfaceFrameBits = update_send_surface_frame_bits;
update->PlaySound = update_send_play_sound;
update->SetKeyboardIndicators = update_send_set_keyboard_indicators;
update->SetKeyboardImeStatus = update_send_set_keyboard_ime_status;
update->SaveSessionInfo = rdp_send_save_session_info;
update->primary->DstBlt = update_send_dstblt;
update->primary->PatBlt = update_send_patblt;