[client,x11] update MappingNotify handling

This commit is contained in:
akallabeth
2025-02-11 13:05:07 +01:00
parent bc6f6255b3
commit 67877d5e7c
4 changed files with 38 additions and 22 deletions

View File

@@ -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;
}

View File

@@ -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)

View File

@@ -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)

View File

@@ -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);