Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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 <qpa/qplatformkeymapper.h>
18
19#include <QEvent>
20
22
24{
25public:
27
29
30 void initialize();
31 void selectEvents();
32
33 void handleKeyPressEvent(const xcb_key_press_event_t *event);
34 void handleKeyReleaseEvent(const xcb_key_release_event_t *event);
35
36 Qt::KeyboardModifiers translateModifiers(int s) const;
37 void updateKeymap(xcb_mapping_notify_event_t *event);
38 void updateKeymap();
39
40 QList<QKeyCombination> possibleKeyCombinations(const QKeyEvent *event) const override;
41 Qt::KeyboardModifiers queryKeyboardModifiers() const override;
42
43 void updateXKBMods();
44 xkb_mod_mask_t xkbModMask(quint16 state);
46 void updateXKBStateFromXI(void *modInfo, void *groupInfo);
47
48 int coreDeviceId() const { return core_device_id; }
49 void updateXKBState(xcb_xkb_state_notify_event_t *state);
50
51 void handleStateChanges(xkb_state_component changedComponents);
52
53protected:
54 void handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type, xcb_keycode_t code,
55 quint16 state, xcb_timestamp_t time, bool fromSendEvent);
56
58
59 typedef QMap<xcb_keysym_t, int> KeysymModifierMap;
60 struct xkb_keymap *keymapFromCore(const KeysymModifierMap &keysymMods);
61
62 void updateModifiers(const KeysymModifierMap &keysymMods);
64
65 void updateVModMapping();
67
68private:
69 bool m_config = false;
70 bool m_isAutoRepeat = false;
71 xcb_keycode_t m_autoRepeatCode = 0;
72
73 struct _mod_masks {
74 uint alt;
75 uint altgr;
76 uint meta;
77 uint super;
78 uint hyper;
79 };
80
81 _mod_masks rmod_masks;
82
83 xcb_key_symbols_t *m_key_symbols = nullptr;
84 struct _xkb_mods {
85 xkb_mod_index_t shift;
86 xkb_mod_index_t lock;
87 xkb_mod_index_t control;
88 xkb_mod_index_t mod1;
89 xkb_mod_index_t mod2;
90 xkb_mod_index_t mod3;
91 xkb_mod_index_t mod4;
92 xkb_mod_index_t mod5;
93 };
94 _xkb_mods xkb_mods;
95
96 _mod_masks vmod_masks;
97 int core_device_id;
98
100 QXkbCommon::ScopedXKBKeymap m_xkbKeymap;
101 QXkbCommon::ScopedXKBContext m_xkbContext;
102
103 bool m_superAsMeta = false;
104 bool m_hyperAsMeta = false;
105};
106
108
109#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:424
Definition qmap.h:187
void handleKeyPressEvent(const xcb_key_press_event_t *event)
void handleKeyReleaseEvent(const xcb_key_release_event_t *event)
Qt::KeyboardModifiers queryKeyboardModifiers() const override
void resolveMaskConflicts()
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)
QList< QKeyCombination > possibleKeyCombinations(const QKeyEvent *event) const override
void updateVModToRModMapping()
QMap< xcb_keysym_t, int > KeysymModifierMap
Qt::KeyboardModifiers translateModifiers(int s) const
QXcbKeyboard(QXcbConnection *connection)
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:48
unsigned int uint
Definition qtypes.h:34
static bool fromSendEvent(const void *event)