mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
[client,x11] update MappingNotify handling
This commit is contained in:
@@ -1204,6 +1204,8 @@ static BOOL xf_pre_connect(freerdp* instance)
|
||||
{
|
||||
if (!xf_keyboard_init(xfc))
|
||||
return FALSE;
|
||||
if (!xf_keyboard_action_script_init(xfc))
|
||||
return FALSE;
|
||||
if (!xf_detect_monitors(xfc, &maxWidth, &maxHeight))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -196,6 +196,8 @@ BOOL xf_event_action_script_init(xfContext* xfc)
|
||||
{
|
||||
WINPR_ASSERT(xfc);
|
||||
|
||||
xf_event_action_script_free(xfc);
|
||||
|
||||
xfc->xevents = ArrayList_New(TRUE);
|
||||
|
||||
if (!xfc->xevents)
|
||||
@@ -723,10 +725,23 @@ static BOOL xf_event_MappingNotify(xfContext* xfc, const XMappingEvent* event, B
|
||||
{
|
||||
WINPR_UNUSED(app);
|
||||
|
||||
if (event->request == MappingModifier)
|
||||
return xf_keyboard_update_modifier_map(xfc);
|
||||
|
||||
return TRUE;
|
||||
switch (event->request)
|
||||
{
|
||||
case MappingModifier:
|
||||
return xf_keyboard_update_modifier_map(xfc);
|
||||
case MappingKeyboard:
|
||||
WLog_VRB(TAG, "[%d] MappingKeyboard", event->request);
|
||||
return xf_keyboard_init(xfc);
|
||||
case MappingPointer:
|
||||
WLog_VRB(TAG, "[%d] MappingPointer", event->request);
|
||||
return TRUE;
|
||||
default:
|
||||
WLog_WARN(TAG,
|
||||
"[%d] Unsupported MappingNotify::request, must be one "
|
||||
"of[MappingModifier(%d), MappingKeyboard(%d), MappingPointer(%d)]",
|
||||
event->request, MappingModifier, MappingKeyboard, MappingPointer);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL xf_event_ClientMessage(xfContext* xfc, const XClientMessageEvent* event, BOOL app)
|
||||
|
||||
@@ -115,10 +115,23 @@ static BOOL xf_action_script_append(xfContext* xfc, const char* buffer, size_t s
|
||||
return ArrayList_Append(xfc->keyCombinations, buffer);
|
||||
}
|
||||
|
||||
static BOOL xf_keyboard_action_script_init(xfContext* xfc)
|
||||
static void xf_keyboard_action_script_free(xfContext* xfc)
|
||||
{
|
||||
xf_event_action_script_free(xfc);
|
||||
|
||||
if (xfc->keyCombinations)
|
||||
{
|
||||
ArrayList_Free(xfc->keyCombinations);
|
||||
xfc->keyCombinations = NULL;
|
||||
xfc->actionScriptExists = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL xf_keyboard_action_script_init(xfContext* xfc)
|
||||
{
|
||||
WINPR_ASSERT(xfc);
|
||||
|
||||
xf_keyboard_action_script_free(xfc);
|
||||
xfc->keyCombinations = ArrayList_New(TRUE);
|
||||
|
||||
if (!xfc->keyCombinations)
|
||||
@@ -135,18 +148,6 @@ static BOOL xf_keyboard_action_script_init(xfContext* xfc)
|
||||
return xf_event_action_script_init(xfc);
|
||||
}
|
||||
|
||||
static void xf_keyboard_action_script_free(xfContext* xfc)
|
||||
{
|
||||
xf_event_action_script_free(xfc);
|
||||
|
||||
if (xfc->keyCombinations)
|
||||
{
|
||||
ArrayList_Free(xfc->keyCombinations);
|
||||
xfc->keyCombinations = NULL;
|
||||
xfc->actionScriptExists = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL xf_keyboard_init(xfContext* xfc)
|
||||
{
|
||||
rdpSettings* settings = NULL;
|
||||
@@ -163,11 +164,7 @@ BOOL xf_keyboard_init(xfContext* xfc)
|
||||
if (!freerdp_settings_set_uint32(settings, FreeRDP_KeyboardLayout, xfc->KeyboardLayout))
|
||||
return FALSE;
|
||||
|
||||
if (!xf_keyboard_update_modifier_map(xfc))
|
||||
return FALSE;
|
||||
|
||||
xf_keyboard_action_script_init(xfc);
|
||||
return TRUE;
|
||||
return xf_keyboard_update_modifier_map(xfc);
|
||||
}
|
||||
|
||||
void xf_keyboard_free(xfContext* xfc)
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
BOOL xf_keyboard_init(xfContext* xfc);
|
||||
void xf_keyboard_free(xfContext* xfc);
|
||||
|
||||
BOOL xf_keyboard_action_script_init(xfContext* xfc);
|
||||
|
||||
void xf_keyboard_key_press(xfContext* xfc, const XKeyEvent* event, KeySym keysym);
|
||||
void xf_keyboard_key_release(xfContext* xfc, const XKeyEvent* event, KeySym keysym);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user