mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2024-11-27 11:54:44 +08:00
libuwac: Add UwacKeyboardModifiersEvent
This commit is contained in:
parent
e2620f0faa
commit
aaefe18f98
@ -62,6 +62,8 @@ enum
|
||||
UWAC_MOD_SHIFT_MASK = 0x01,
|
||||
UWAC_MOD_ALT_MASK = 0x02,
|
||||
UWAC_MOD_CONTROL_MASK = 0x04,
|
||||
UWAC_MOD_CAPS_MASK = 0x08,
|
||||
UWAC_MOD_NUM_MASK = 0x10,
|
||||
};
|
||||
|
||||
/** @brief a position */
|
||||
@ -91,6 +93,7 @@ enum
|
||||
UWAC_EVENT_POINTER_BUTTONS,
|
||||
UWAC_EVENT_POINTER_AXIS,
|
||||
UWAC_EVENT_KEYBOARD_ENTER,
|
||||
UWAC_EVENT_KEYBOARD_MODIFIERS,
|
||||
UWAC_EVENT_KEY,
|
||||
UWAC_EVENT_TOUCH_FRAME_BEGIN,
|
||||
UWAC_EVENT_TOUCH_UP,
|
||||
@ -144,6 +147,13 @@ struct uwac_keyboard_enter_event
|
||||
};
|
||||
typedef struct uwac_keyboard_enter_event UwacKeyboardEnterLeaveEvent;
|
||||
|
||||
struct uwac_keyboard_modifiers_event
|
||||
{
|
||||
int type;
|
||||
uint32_t modifiers;
|
||||
};
|
||||
typedef struct uwac_keyboard_modifiers_event UwacKeyboardModifiersEvent;
|
||||
|
||||
struct uwac_pointer_enter_event
|
||||
{
|
||||
int type;
|
||||
@ -276,6 +286,7 @@ union uwac_event {
|
||||
UwacPointerButtonEvent mouse_button;
|
||||
UwacPointerAxisEvent mouse_axis;
|
||||
UwacKeyboardEnterLeaveEvent keyboard_enter_leave;
|
||||
UwacKeyboardModifiersEvent keyboard_modifiers;
|
||||
UwacClipboardEvent clipboard;
|
||||
UwacKeyEvent key;
|
||||
UwacTouchFrameBegin touchFrameBegin;
|
||||
|
@ -231,6 +231,8 @@ static void keyboard_handle_keymap(void* data, struct wl_keyboard* keyboard, uin
|
||||
input->xkb.control_mask = 1 << xkb_keymap_mod_get_index(input->xkb.keymap, "Control");
|
||||
input->xkb.alt_mask = 1 << xkb_keymap_mod_get_index(input->xkb.keymap, "Mod1");
|
||||
input->xkb.shift_mask = 1 << xkb_keymap_mod_get_index(input->xkb.keymap, "Shift");
|
||||
input->xkb.caps_mask = 1 << xkb_keymap_mod_get_index(input->xkb.keymap, "Lock");
|
||||
input->xkb.num_mask = 1 << xkb_keymap_mod_get_index(input->xkb.keymap, "Mod2");
|
||||
}
|
||||
|
||||
static void keyboard_handle_key(void* data, struct wl_keyboard* keyboard, uint32_t serial,
|
||||
@ -425,6 +427,7 @@ static void keyboard_handle_modifiers(void* data, struct wl_keyboard* keyboard,
|
||||
uint32_t mods_locked, uint32_t group)
|
||||
{
|
||||
UwacSeat* input = data;
|
||||
UwacKeyboardModifiersEvent *event;
|
||||
xkb_mod_mask_t mask;
|
||||
|
||||
/* If we're not using a keymap, then we don't handle PC-style modifiers */
|
||||
@ -433,7 +436,7 @@ static void keyboard_handle_modifiers(void* data, struct wl_keyboard* keyboard,
|
||||
|
||||
xkb_state_update_mask(input->xkb.state, mods_depressed, mods_latched, mods_locked, 0, 0, group);
|
||||
mask = xkb_state_serialize_mods(input->xkb.state,
|
||||
XKB_STATE_MODS_DEPRESSED | XKB_STATE_MODS_LATCHED);
|
||||
XKB_STATE_MODS_DEPRESSED | XKB_STATE_MODS_LATCHED | XKB_STATE_MODS_LOCKED);
|
||||
input->modifiers = 0;
|
||||
if (mask & input->xkb.control_mask)
|
||||
input->modifiers |= UWAC_MOD_CONTROL_MASK;
|
||||
@ -441,6 +444,17 @@ static void keyboard_handle_modifiers(void* data, struct wl_keyboard* keyboard,
|
||||
input->modifiers |= UWAC_MOD_ALT_MASK;
|
||||
if (mask & input->xkb.shift_mask)
|
||||
input->modifiers |= UWAC_MOD_SHIFT_MASK;
|
||||
if (mask & input->xkb.caps_mask)
|
||||
input->modifiers |= UWAC_MOD_CAPS_MASK;
|
||||
if (mask & input->xkb.num_mask)
|
||||
input->modifiers |= UWAC_MOD_NUM_MASK;
|
||||
|
||||
event = (UwacKeyboardModifiersEvent*)UwacDisplayNewEvent(input->display,
|
||||
UWAC_EVENT_KEYBOARD_MODIFIERS);
|
||||
if (!event)
|
||||
return;
|
||||
|
||||
event->modifiers = input->modifiers;
|
||||
}
|
||||
|
||||
static void set_repeat_info(UwacSeat* input, int32_t rate, int32_t delay)
|
||||
|
@ -180,6 +180,8 @@ struct uwac_seat
|
||||
xkb_mod_mask_t control_mask;
|
||||
xkb_mod_mask_t alt_mask;
|
||||
xkb_mod_mask_t shift_mask;
|
||||
xkb_mod_mask_t caps_mask;
|
||||
xkb_mod_mask_t num_mask;
|
||||
} xkb;
|
||||
uint32_t modifiers;
|
||||
int32_t repeat_rate_sec, repeat_rate_nsec;
|
||||
|
Loading…
Reference in New Issue
Block a user