Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qxcbkeyboard.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QXCBKEYBOARD_H
5#define QXCBKEYBOARD_H
6
7#include "qxcbobject.h"
8
9#include <xcb/xcb_keysyms.h>
10#define explicit dont_use_cxx_explicit
11#include <xcb/xkb.h>
12#undef explicit
13
14#include <QtGui/private/qxkbcommon_p.h>
15#include <xkbcommon/xkbcommon-x11.h>
16
17#include <QEvent>
18
20
22{
23public:
25
27
28 void initialize();
29 void selectEvents();
30
31 void handleKeyPressEvent(const xcb_key_press_event_t *event);
32 void handleKeyReleaseEvent(const xcb_key_release_event_t *event);
33
34 Qt::KeyboardModifiers translateModifiers(int s) const;
35 void updateKeymap(xcb_mapping_notify_event_t *event);
36 void updateKeymap();
38
39 void updateXKBMods();
40 xkb_mod_mask_t xkbModMask(quint16 state);
42 void updateXKBStateFromXI(void *modInfo, void *groupInfo);
43
44 int coreDeviceId() const { return core_device_id; }
45 void updateXKBState(xcb_xkb_state_notify_event_t *state);
46
47 void handleStateChanges(xkb_state_component changedComponents);
48
49protected:
50 void handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type, xcb_keycode_t code,
51 quint16 state, xcb_timestamp_t time, bool fromSendEvent);
52
54
56 struct xkb_keymap *keymapFromCore(const KeysymModifierMap &keysymMods);
57
58 void updateModifiers(const KeysymModifierMap &keysymMods);
60
61 void updateVModMapping();
63
64private:
65 bool m_config = false;
66 bool m_isAutoRepeat = false;
67 xcb_keycode_t m_autoRepeatCode = 0;
68
69 struct _mod_masks {
70 uint alt;
71 uint altgr;
72 uint meta;
73 uint super;
74 uint hyper;
75 };
76
77 _mod_masks rmod_masks;
78
79 xcb_key_symbols_t *m_key_symbols = nullptr;
80 struct _xkb_mods {
81 xkb_mod_index_t shift;
82 xkb_mod_index_t lock;
83 xkb_mod_index_t control;
84 xkb_mod_index_t mod1;
85 xkb_mod_index_t mod2;
86 xkb_mod_index_t mod3;
87 xkb_mod_index_t mod4;
88 xkb_mod_index_t mod5;
89 };
90 _xkb_mods xkb_mods;
91
92 _mod_masks vmod_masks;
93 int core_device_id;
94
98
99 bool m_superAsMeta = false;
100 bool m_hyperAsMeta = false;
101};
102
104
105#endif
Type
This enum type defines the valid event types in Qt.
Definition qcoreevent.h:51
The QKeyEvent class describes a key event.
Definition qevent.h:423
Definition qlist.h:74
Definition qmap.h:186
void handleKeyPressEvent(const xcb_key_press_event_t *event)
void handleKeyReleaseEvent(const xcb_key_release_event_t *event)
void resolveMaskConflicts()
QList< int > possibleKeys(const QKeyEvent *event) const
void handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time, bool fromSendEvent)
xkb_mod_mask_t xkbModMask(quint16 state)
void updateXKBState(xcb_xkb_state_notify_event_t *state)
void updateVModToRModMapping()
QMap< xcb_keysym_t, int > KeysymModifierMap
Qt::KeyboardModifiers translateModifiers(int s) const
int coreDeviceId() const
void updateXKBStateFromCore(quint16 state)
void handleStateChanges(xkb_state_component changedComponents)
void updateVModMapping()
KeysymModifierMap keysymsToModifiers()
void updateXKBStateFromXI(void *modInfo, void *groupInfo)
void updateModifiers(const KeysymModifierMap &keysymMods)
struct xkb_keymap * keymapFromCore(const KeysymModifierMap &keysymMods)
QXcbConnection * connection() const
Definition qxcbobject.h:17
std::unique_ptr< struct xkb_context, XKBContextDeleter > ScopedXKBContext
std::unique_ptr< struct xkb_keymap, XKBKeymapDeleter > ScopedXKBKeymap
std::unique_ptr< struct xkb_state, XKBStateDeleter > ScopedXKBState
else opt state
[0]
Combined button and popup list for selecting options.
GLenum type
struct _cl_event * event
GLdouble s
[6]
Definition qopenglext.h:235
unsigned short quint16
Definition qtypes.h:43
unsigned int uint
Definition qtypes.h:29
static bool fromSendEvent(const void *event)
QReadWriteLock lock
[0]