Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qwindowskeymapper.cpp File Reference
#include "qwindowskeymapper.h"
#include "qwindowscontext.h"
#include "qwindowsintegration.h"
#include "qwindowswindow.h"
#include "qwindowsinputcontext.h"
#include <QtGui/qguiapplication.h>
#include <QtGui/qwindow.h>
#include <qpa/qwindowsysteminterface.h>
#include <private/qguiapplication_p.h>
#include <private/qhighdpiscaling_p.h>
#include <QtGui/qevent.h>
#include <QtGui/private/qwindowsguieventdispatcher_p.h>
#include <QtCore/private/qdebug_p.h>
#include <QtCore/private/qtools_p.h>
+ Include dependency graph for qwindowskeymapper.cpp:

Go to the source code of this file.

Classes

struct  KeyRecord
 
struct  KeyRecorder
 
class  formatKeys
 

Macros

#define LANG_PASHTO   0x63
 
#define LANG_SYRIAC   0x5a
 
#define LANG_DIVEHI   0x65
 
#define VK_OEM_PLUS   0xBB
 
#define VK_OEM_3   0xC0
 
#define enabled   (MF_BYCOMMAND | MFS_ENABLED)
 
#define disabled   (MF_BYCOMMAND | MFS_GRAYED)
 

Enumerations

enum  { scancodeBitmask = 0x1ff }
 

Functions

static void clearKeyRecorderOnApplicationInActive (Qt::ApplicationState state)
 
QDebug operator<< (QDebug d, const KeyboardLayoutItem &k)
 
QDebug operator<< (QDebug d, const formatKeys &k)
 
quint32 winceKeyBend (quint32 keyCode)
 
static quint32 toKeyOrUnicode (quint32 vk, quint32 scancode, unsigned char *kbdBuffer, bool *isDeadkey=nullptr)
 
static int asciiToKeycode (char a, int state)
 
void setKbdState (unsigned char *kbd, bool shift, bool ctrl, bool alt)
 
static QString messageKeyText (const MSG &msg)
 
static int getTitleBarHeight (const HWND hwnd)
 
static bool isSystemMenuOffsetNeeded (const Qt::WindowFlags flags)
 
static void showSystemMenu (QWindow *w)
 
static void sendExtendedPressRelease (QWindow *w, int k, Qt::KeyboardModifiers mods, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString &text=QString(), bool autorep=false, ushort count=1)
 
static bool isAltGr (MSG *msg)
 

Variables

static const int QT_MAX_KEY_RECORDINGS = 64
 
static KeyRecorder key_recorder
 
static const uint KeyTbl []
 
static const uint CmdTbl []
 
static const Qt::KeyboardModifiers ModsTbl []
 
static const size_t NumMods = sizeof ModsTbl / sizeof *ModsTbl
 

Macro Definition Documentation

◆ disabled

#define disabled   (MF_BYCOMMAND | MFS_GRAYED)

◆ enabled

typedef GLenum GLsizei const GLuint GLboolean enabled   (MF_BYCOMMAND | MFS_ENABLED)

Definition at line 3098 of file qopenglext.h.

Referenced by QQuickContext2DCommandBuffer::clip(), BreakPointHandler::enableBreakPoint(), isHostExcluded(), macQueryInternal(), QV4DebugServiceImpl::messageReceived(), QQmlProfilerServiceImpl::messageReceived(), QXcbIntegration::nativePaintingEnabled(), QInputMethodPrivate::objectAcceptsInputMethod(), QSSGRhiContextStats::profilingEnabled(), QCocoaMenu::propagateEnabledState(), proxyFromDictionary(), QSSGRhiContextStats::rendererDebugEnabled(), QWaylandSeat::sendFullKeyEvent(), QQuick3DLightmapper::setAdaptiveBiasEnabled(), QXcbWindow::setAlertState(), QtWaylandClient::QWaylandXdgSurface::setAlertState(), QImageReader::setAutoDetectImageFormat(), QOpenGLTexture::setAutoMipMapGenerationEnabled(), QQuickMultiEffectPrivate::setAutoPaddingEnabled(), QApplication::setAutoSipEnabled(), QQuickMultiEffectPrivate::setBlurEnabled(), QFutureSynchronizer< T >::setCancelOnWait(), QPlainTextEdit::setCenterOnScroll(), QQuick3DInstancing::setDepthSortingEnabled(), QSaveFile::setDirectWriteFallback(), QSGDefaultContext::setDistanceFieldEnabled(), QWidgetTextControl::setDragEnabled(), QWasmCompositor::setEnabled(), QQuickLabsPlatformIconLoader::setEnabled(), QQmlBoundSignal::setEnabled(), QQuickKeysAttached::setEnabled(), QDBusPlatformMenuItem::setEnabled(), QDBusPlatformMenu::setEnabled(), QAndroidPlatformMenu::setEnabled(), QAndroidPlatformMenuItem::setEnabled(), QCocoaMenu::setEnabled(), QIOSMenuItem::setEnabled(), QIOSMenu::setEnabled(), QWindowsMenuItem::setEnabled(), QWindowsMenu::setEnabled(), QGtk3MenuItem::setEnabled(), QCocoaMenuItem::setEnabled(), QSignalDumper::setEnabled(), QGraphicsItem::setFiltersChildEvents(), QGraphicsScene::setFocusOnTouch(), QCocoaWindow::setFrameStrutEventsEnabled(), QGraphicsItem::setHandlesChildEvents(), QQmlTestMessageHandler::setIncludeCategoriesEnabled(), QQuick3DLightmapper::setIndirectLightEnabled(), QQuickScrollBarPrivate::setInteractive(), QQuickMultiEffectPrivate::setMaskEnabled(), QOpenGLFramebufferObjectFormat::setMipmap(), QSslConfiguration::setOcspStaplingEnabled(), QQmlEngine::setOutputWarningsToStandardError(), QCocoaMenuItem::setParentEnabled(), QCoreApplication::setQuitLockEnabled(), QAudioEngine::setRoomEffectsEnabled(), QGraphicsScenePrivate::setScenePosItemEnabled(), QQuickMultiEffectPrivate::setShadowEnabled(), QUnifiedTimer::setSlowModeEnabled(), QGraphicsScene::setStickyFocus(), QNetworkAccessManager::setStrictTransportSecurityEnabled(), QOpenGL2PaintEngineExPrivate::setVertexAttribArrayEnabled(), QWidgetTextControl::setWordSelectionEnabled(), QQuickTextControl::setWordSelectionEnabled(), showSystemMenu(), QPicturePaintEngine::updateClipEnabled(), and QCocoaWindow::updateTitleBarButtons().

◆ LANG_DIVEHI

#define LANG_DIVEHI   0x65

Definition at line 82 of file qwindowskeymapper.cpp.

◆ LANG_PASHTO

#define LANG_PASHTO   0x63

Definition at line 76 of file qwindowskeymapper.cpp.

◆ LANG_SYRIAC

#define LANG_SYRIAC   0x5a

Definition at line 79 of file qwindowskeymapper.cpp.

◆ VK_OEM_3

#define VK_OEM_3   0xC0

Definition at line 88 of file qwindowskeymapper.cpp.

◆ VK_OEM_PLUS

#define VK_OEM_PLUS   0xBB

Definition at line 85 of file qwindowskeymapper.cpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
scancodeBitmask 

Definition at line 93 of file qwindowskeymapper.cpp.

Function Documentation

◆ asciiToKeycode()

static int asciiToKeycode ( char  a,
int  state 
)
inlinestatic

Definition at line 601 of file qwindowskeymapper.cpp.

References Qt::ControlModifier, state, and QtMiscUtils::toAsciiUpper().

+ Here is the call graph for this function:

◆ clearKeyRecorderOnApplicationInActive()

static void clearKeyRecorderOnApplicationInActive ( Qt::ApplicationState  state)
static

Definition at line 121 of file qwindowskeymapper.cpp.

References Qt::ApplicationInactive, KeyRecorder::clearKeys(), key_recorder, and state.

Referenced by QWindowsKeyMapper::QWindowsKeyMapper().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTitleBarHeight()

static int getTitleBarHeight ( const HWND  hwnd)
inlinestatic

Definition at line 752 of file qwindowskeymapper.cpp.

Referenced by showSystemMenu().

+ Here is the caller graph for this function:

◆ isAltGr()

static bool isAltGr ( MSG msg)
static

Definition at line 917 of file qwindowskeymapper.cpp.

◆ isSystemMenuOffsetNeeded()

static bool isSystemMenuOffsetNeeded ( const Qt::WindowFlags  flags)
inlinestatic

Definition at line 765 of file qwindowskeymapper.cpp.

References Qt::CustomizeWindowHint, Qt::FramelessWindowHint, Qt::WindowCloseButtonHint, Qt::WindowContextHelpButtonHint, Qt::WindowMinMaxButtonsHint, Qt::WindowSystemMenuHint, and Qt::WindowTitleHint.

Referenced by showSystemMenu().

+ Here is the caller graph for this function:

◆ messageKeyText()

static QString messageKeyText ( const MSG msg)
inlinestatic

Definition at line 746 of file qwindowskeymapper.cpp.

References ch.

◆ operator<<() [1/2]

QDebug operator<< ( QDebug  d,
const formatKeys k 
)

Definition at line 547 of file qwindowskeymapper.cpp.

◆ operator<<() [2/2]

QDebug operator<< ( QDebug  d,
const KeyboardLayoutItem k 
)

Definition at line 512 of file qwindowskeymapper.cpp.

References d, KeyboardLayoutItem::deadkeys, Qt::dec(), KeyboardLayoutItem::exists, QtDebugUtils::formatQEnum(), QtDebugUtils::formatQFlags(), Qt::hex(), i, ModsTbl, Qt::noshowbase(), NumMods, qtKey(), KeyboardLayoutItem::qtKey, and Qt::showbase().

+ Here is the call graph for this function:

◆ sendExtendedPressRelease()

static void sendExtendedPressRelease ( QWindow w,
int  k,
Qt::KeyboardModifiers  mods,
quint32  nativeScanCode,
quint32  nativeVirtualKey,
quint32  nativeModifiers,
const QString text = QString(),
bool  autorep = false,
ushort  count = 1 
)
inlinestatic

Definition at line 823 of file qwindowskeymapper.cpp.

References QWindowSystemInterface::handleExtendedKeyEvent(), QEvent::KeyPress, QEvent::KeyRelease, and text.

+ Here is the call graph for this function:

◆ setKbdState()

void setKbdState ( unsigned char *  kbd,
bool  shift,
bool  ctrl,
bool  alt 
)
inline

Definition at line 644 of file qwindowskeymapper.cpp.

References shift().

+ Here is the call graph for this function:

◆ showSystemMenu()

static void showSystemMenu ( QWindow w)
static

Definition at line 773 of file qwindowskeymapper.cpp.

References disabled, enabled, QWindow::flags, getTitleBarHeight(), QWindowsBaseWindow::handleOf(), isSystemMenuOffsetNeeded(), menu, Qt::MSWindowsFixedSizeDialogHint, pos, qWindowsWndProc(), ret, QHighDpi::toNativePixels(), QRect::topLeft(), QWindowsWindow::topLevelOf(), Qt::WindowMaximizeButtonHint, and Qt::WindowMinimizeButtonHint.

Referenced by QMdi::ControlContainer::ControlContainer(), and QMdiSubWindow::mousePressEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toKeyOrUnicode()

static quint32 toKeyOrUnicode ( quint32  vk,
quint32  scancode,
unsigned char *  kbdBuffer,
bool *  isDeadkey = nullptr 
)
inlinestatic

Definition at line 573 of file qwindowskeymapper.cpp.

References Qt::Key_unknown, Q_ASSERT, QChar::toUpper(), QChar::unicode(), and winceKeyBend().

+ Here is the call graph for this function:

◆ winceKeyBend()

quint32 winceKeyBend ( quint32  keyCode)
inline

Remap return or action key to select key for windows mobile.

Definition at line 567 of file qwindowskeymapper.cpp.

References KeyTbl.

Referenced by toKeyOrUnicode().

+ Here is the caller graph for this function:

Variable Documentation

◆ CmdTbl

const uint CmdTbl[]
static

Definition at line 438 of file qwindowskeymapper.cpp.

◆ key_recorder

KeyRecorder key_recorder
static

Definition at line 119 of file qwindowskeymapper.cpp.

Referenced by clearKeyRecorderOnApplicationInActive().

◆ KeyTbl

const uint KeyTbl[]
static

Definition at line 174 of file qwindowskeymapper.cpp.

Referenced by winceKeyBend().

◆ ModsTbl

◆ NumMods

const size_t NumMods = sizeof ModsTbl / sizeof *ModsTbl
static

Definition at line 508 of file qwindowskeymapper.cpp.

Referenced by operator<<(), and QWindowsKeyMapper::possibleKeys().

◆ QT_MAX_KEY_RECORDINGS

const int QT_MAX_KEY_RECORDINGS = 64
static

Definition at line 108 of file qwindowskeymapper.cpp.

Referenced by KeyRecorder::storeKey().