File indexing completed on 2024-04-14 14:29:50

0001 /*
0002     SPDX-FileCopyrightText: 2001 Ellis Whitehead <ellis@kde.org>
0003 
0004     Win32 port:
0005     SPDX-FileCopyrightText: 2004 Jarosław Staniek <staniek@kde.org>
0006 
0007     SPDX-License-Identifier: LGPL-2.1-or-later
0008 */
0009 
0010 #ifndef _KKEYSERVER_H
0011 #define _KKEYSERVER_H
0012 
0013 #include <kwindowsystem_export.h>
0014 
0015 #include <qglobal.h>
0016 
0017 #include <config-kwindowsystem.h>
0018 #if KWINDOWSYSTEM_HAVE_X11 /*or defined Q_OS_WIN*/
0019 #include "kkeyserver_x11.h"
0020 #elif defined Q_OS_MAC
0021 #include "kkeyserver_mac.h"
0022 #elif defined Q_OS_WIN
0023 #include "kkeyserver_win.h"
0024 #endif
0025 
0026 class QString;
0027 
0028 /**
0029  * A collection of functions for the conversion of key presses and
0030  * their modifiers from the window system specific format
0031  * to the generic format and vice-versa.
0032  */
0033 namespace KKeyServer
0034 {
0035 /**
0036  * Converts the mask of ORed KKey::ModFlag modifiers to a
0037  * user-readable string.
0038  * @param mod the mask of ORed KKey::ModFlag modifiers
0039  * @return the user-readable string (in English)
0040  */
0041 KWINDOWSYSTEM_EXPORT QString modToStringUser(uint mod);
0042 
0043 /**
0044  * Converts the modifier given as user-readable string (in English)
0045  * to KKey::ModFlag modifier, or 0.
0046  * @internal
0047  */
0048 KWINDOWSYSTEM_EXPORT uint stringUserToMod(const QString &mod);
0049 
0050 /**
0051  * Test if the shift modifier should be recorded for a given key.
0052  *
0053  * For example, if shift+5 produces '%' Qt wants ctrl+shift+5 recorded as ctrl+% and
0054  * in that case this function would return false.
0055  *
0056  * @since 4.7.1
0057  */
0058 KWINDOWSYSTEM_EXPORT bool isShiftAsModifierAllowed(int keyQt);
0059 
0060 } // namespace KKeyServer
0061 
0062 #endif // !_KKEYSERVER_H