#include <freerdp/log.h>
#define TAG CLIENT_TAG("x11")
-static BOOL firstPressRightCtrl = TRUE;
-static BOOL ungrabKeyboardWithRightCtrl = TRUE;
+static BOOL xf_sync_kbd_state(xfContext* xfc)
+{
+ const UINT32 syncFlags = xf_keyboard_get_toggle_keys_state(xfc);
+ return freerdp_input_send_synchronize_event(xfc->context.input, syncFlags);
+}
+
+static void xf_keyboard_clear(xfContext* xfc)
+{
+ ZeroMemory(xfc->KeyboardState, 256 * sizeof(BOOL));
+}
static BOOL xf_keyboard_action_script_init(xfContext* xfc)
{
xf_keyboard_action_script_free(xfc);
}
-void xf_keyboard_clear(xfContext* xfc)
-{
- ZeroMemory(xfc->KeyboardState, 256 * sizeof(BOOL));
-}
-
void xf_keyboard_key_press(xfContext* xfc, BYTE keycode, KeySym keysym)
{
if (keycode < 8)
xfc->KeyboardState[keycode] = FALSE;
}
}
+ xf_sync_kbd_state(xfc);
}
BOOL xf_keyboard_key_pressed(xfContext* xfc, KeySym keysym)
if ((rdp_scancode == RDP_SCANCODE_CAPSLOCK) && (down == FALSE))
{
- UINT32 syncFlags;
- syncFlags = xf_keyboard_get_toggle_keys_state(xfc);
- input->SynchronizeEvent(input, syncFlags);
+ xf_sync_kbd_state(xfc);
}
}
}
input = xfc->context.input;
syncFlags = xf_keyboard_get_toggle_keys_state(xfc);
- input->FocusInEvent(input, syncFlags);
+ freerdp_input_send_focus_in_event(input, syncFlags);
xk_keyboard_update_modifier_keys(xfc);
/* finish with a mouse pointer position like mstsc.exe if required */
if (x >= 0 && x < xfc->window->width && y >= 0 && y < xfc->window->height)
{
xf_event_adjust_coordinates(xfc, &x, &y);
- input->MouseEvent(input, PTR_FLAGS_MOVE, x, y);
+ freerdp_input_send_mouse_event(input, PTR_FLAGS_MOVE, x, y);
}
}
}
// do not return anything such that the key could be used by client if ungrab is not the goal
if (keysym == XK_Control_R)
{
- if (mod.RightCtrl && firstPressRightCtrl)
+ if (mod.RightCtrl && xfc->firstPressRightCtrl)
{
// Right Ctrl is pressed, getting ready to ungrab
- ungrabKeyboardWithRightCtrl = TRUE;
- firstPressRightCtrl = FALSE;
+ xfc->ungrabKeyboardWithRightCtrl = TRUE;
+ xfc->firstPressRightCtrl = FALSE;
}
}
else
{
// some other key has been pressed, abort ungrabbing
- if (ungrabKeyboardWithRightCtrl)
- ungrabKeyboardWithRightCtrl = FALSE;
+ if (xfc->ungrabKeyboardWithRightCtrl)
+ xfc->ungrabKeyboardWithRightCtrl = FALSE;
}
if (!xf_keyboard_execute_action_script(xfc, &mod, keysym))
if (keysym != XK_Control_R)
return;
- firstPressRightCtrl = TRUE;
+ xfc->firstPressRightCtrl = TRUE;
- if (!ungrabKeyboardWithRightCtrl)
+ if (!xfc->ungrabKeyboardWithRightCtrl)
return;
// all requirements for ungrab are fulfilled, ungrabbing now
}
// ungrabbed
- ungrabKeyboardWithRightCtrl = FALSE;
+ xfc->ungrabKeyboardWithRightCtrl = FALSE;
}
BOOL xf_keyboard_set_indicators(rdpContext* context, UINT16 led_flags)