File indexing completed on 2024-12-01 05:01:41
0001 /* 0002 KWin - the KDE window manager 0003 This file is part of the KDE project. 0004 0005 SPDX-FileCopyrightText: 2013, 2016 Martin Gräßlin <mgraesslin@kde.org> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 #pragma once 0010 0011 #include "input.h" 0012 0013 #include <QObject> 0014 #include <QPointF> 0015 #include <QPointer> 0016 0017 #include <KSharedConfig> 0018 0019 class QWindow; 0020 struct xkb_context; 0021 struct xkb_keymap; 0022 struct xkb_state; 0023 struct xkb_compose_table; 0024 struct xkb_compose_state; 0025 typedef uint32_t xkb_mod_index_t; 0026 typedef uint32_t xkb_led_index_t; 0027 typedef uint32_t xkb_keysym_t; 0028 typedef uint32_t xkb_layout_index_t; 0029 0030 namespace KWin 0031 { 0032 0033 class Window; 0034 class InputDevice; 0035 class InputRedirection; 0036 class KeyboardLayout; 0037 class ModifiersChangedSpy; 0038 class Xkb; 0039 0040 class KWIN_EXPORT KeyboardInputRedirection : public QObject 0041 { 0042 Q_OBJECT 0043 public: 0044 explicit KeyboardInputRedirection(InputRedirection *parent); 0045 ~KeyboardInputRedirection() override; 0046 0047 void init(); 0048 void reconfigure(); 0049 0050 void update(); 0051 0052 /** 0053 * @internal 0054 */ 0055 void processKey(uint32_t key, InputRedirection::KeyboardKeyState state, std::chrono::microseconds time, InputDevice *device = nullptr); 0056 0057 Xkb *xkb() const; 0058 Qt::KeyboardModifiers modifiers() const; 0059 Qt::KeyboardModifiers modifiersRelevantForGlobalShortcuts() const; 0060 0061 Q_SIGNALS: 0062 void ledsChanged(KWin::LEDs); 0063 0064 private: 0065 InputRedirection *m_input; 0066 bool m_inited = false; 0067 const std::unique_ptr<Xkb> m_xkb; 0068 QMetaObject::Connection m_activeWindowSurfaceChangedConnection; 0069 ModifiersChangedSpy *m_modifiersChangedSpy = nullptr; 0070 KeyboardLayout *m_keyboardLayout = nullptr; 0071 }; 0072 0073 }