KKeyServer Namespace
A collection of functions for the conversion of key presses and their modifiers from the window system specific format to the generic format and vice-versa. More...
Header: | #include <KKeyServer> |
CMake: | find_package(KF6 REQUIRED COMPONENTS KWindowSystem) target_link_libraries(mytarget PRIVATE KF6::KWindowSystem) |
Functions
uint | accelModMaskX() |
bool | initializeMods() |
(since 4.7.1) bool | isShiftAsModifierAllowed(int keyQt) |
QList<int> | keyQtToCodeXs(int keyQt) |
bool | keyQtToModX(int keyQt, uint *mod) |
QList<int> | keyQtToSymXs(int keyQt) |
bool | keyboardHasMetaKey() |
QString | modToStringUser(uint mod) |
uint | modXAlt() |
uint | modXCtrl() |
uint | modXLock() |
uint | modXMeta() |
uint | modXModeSwitch() |
uint | modXNumLock() |
uint | modXScrollLock() |
uint | modXShift() |
bool | modXToQt(uint modX, int *modQt) |
bool | symXModXToKeyQt(uint32_t keySym, uint16_t modX, int *keyQt) |
bool | xEventToQt(XEvent *e, int *keyModQt) |
bool | xcbKeyPressEventToQt(xcb_generic_event_t *e, int *keyModQt) |
bool | xcbKeyPressEventToQt(xcb_key_press_event_t *e, int *keyModQt) |
Detailed Description
Function Documentation
uint KKeyServer::accelModMaskX()
Returns bitwise OR'ed mask containing Shift, Ctrl, Alt, and Win (if available).
See also modXShift(), modXLock(), modXCtrl(), modXAlt(), modXNumLock(), modXWin(), and modXScrollLock().
bool KKeyServer::initializeMods()
Initialises the values to return for the mod*() functions below. Called automatically by those functions if not already initialized.
[since 4.7.1]
bool KKeyServer::isShiftAsModifierAllowed(int keyQt)
Test if the shift modifier should be recorded for a given key.
For example, if shift+5 produces '%' Qt wants ctrl+shift+5 recorded as ctrl+% and in that case this function would return false.
This function was introduced in 4.7.1.
QList<int> KKeyServer::keyQtToCodeXs(int keyQt)
Extracts the codes from the given Qt key.
keyQt the qt key code
return the codes; empty if unsuccessful
bool KKeyServer::keyQtToModX(int keyQt, uint *mod)
Extracts the modifiers from the given Qt key and converts them in a mask of X11 modifiers.
keyQt the qt key code
mod if successful, the modifiers will be written here
Returns true if successful, false otherwise
QList<int> KKeyServer::keyQtToSymXs(int keyQt)
Extracts the symbols from the given Qt key and converts it to an X11 symbol + modifiers.
keyQt the qt key code
Returns the symbols; emtpy if unsuccessful
bool KKeyServer::keyboardHasMetaKey()
Returns true if the current keyboard layout supports the Meta key. Specifically, whether the Super or Meta keys are assigned to an X modifier. Returns true if the keyboard has a Meta key
See also modXMeta().
QString KKeyServer::modToStringUser(uint mod)
Converts the mask of ORed KKey::ModFlag modifiers to a user-readable string.
mod the mask of ORed KKey::ModFlag modifiers
Returns the user-readable string (in English)
uint KKeyServer::modXAlt()
Returns the X11 Alt (Mod1) modifier mask/flag.
See also accelModMaskX().
uint KKeyServer::modXCtrl()
Returns the X11 Ctrl modifier mask/flag.
See also accelModMaskX().
uint KKeyServer::modXLock()
Returns the X11 Lock modifier mask/flag.
See also accelModMaskX().
uint KKeyServer::modXMeta()
Returns the X11 Win (Mod3) modifier mask/flag.
See also keyboardHasWinKey() and accelModMaskX().
uint KKeyServer::modXModeSwitch()
Returns the X11 Mode_switch modifier mask/flag.
See also accelModMaskX().
uint KKeyServer::modXNumLock()
Returns the X11 NumLock modifier mask/flag.
See also accelModMaskX().
uint KKeyServer::modXScrollLock()
Returns the X11 ScrollLock modifier mask/flag.
See also accelModMaskX().
uint KKeyServer::modXShift()
Returns the X11 Shift modifier mask/flag.
See also accelModMaskX().
bool KKeyServer::modXToQt(uint modX, int *modQt)
Converts the mask of ORed X11 modifiers to a mask of ORed Qt key code modifiers.
modX the mask of X11 modifiers
modQt the mask of Qt key code modifiers will be written here if successful
Returns true if successful, false otherwise
bool KKeyServer::symXModXToKeyQt(uint32_t keySym, uint16_t modX, int *keyQt)
Converts the given symbol and modifier combination to a Qt key code.
keySym the X key symbol
modX the mask of X11 modifiers
keyQt if successful, the qt key code will be written here
Returns true if successful, false otherwise
bool KKeyServer::xEventToQt(XEvent *e, int *keyModQt)
Converts an X keypress event into a Qt key + modifier code
e the X11 keypress event
keyModQt the Qt keycode and mask of Qt key code modifiers will be written here if successful
Returns true if successful, false otherwise
bool KKeyServer::xcbKeyPressEventToQt(xcb_generic_event_t *e, int *keyModQt)
Converts an XCB keypress event into a Qt key + modifier code
e the XCB keypress event
keyModQt the Qt keycode and mask of Qt key code modifiers will be written here if successful
Returns true if successful, false otherwise
bool KKeyServer::xcbKeyPressEventToQt(xcb_key_press_event_t *e, int *keyModQt)
Overloaded method for convenience.