2016-02-15 12:42:48 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2013, 2016 Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
|
|
|
#ifndef KWIN_KEYBOARD_INPUT_H
|
|
|
|
#define KWIN_KEYBOARD_INPUT_H
|
|
|
|
|
|
|
|
#include "input.h"
|
2017-02-15 16:47:38 +00:00
|
|
|
#include "xkb.h"
|
2016-02-15 12:42:48 +00:00
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QPointer>
|
|
|
|
#include <QPointF>
|
|
|
|
|
2017-01-27 16:15:32 +00:00
|
|
|
#include <KSharedConfig>
|
|
|
|
|
2016-02-15 12:42:48 +00:00
|
|
|
class QWindow;
|
|
|
|
struct xkb_context;
|
|
|
|
struct xkb_keymap;
|
|
|
|
struct xkb_state;
|
2016-08-29 15:04:13 +00:00
|
|
|
struct xkb_compose_table;
|
|
|
|
struct xkb_compose_state;
|
2016-02-15 12:42:48 +00:00
|
|
|
typedef uint32_t xkb_mod_index_t;
|
2016-10-05 09:50:20 +00:00
|
|
|
typedef uint32_t xkb_led_index_t;
|
2016-02-15 12:42:48 +00:00
|
|
|
typedef uint32_t xkb_keysym_t;
|
2017-01-20 06:15:27 +00:00
|
|
|
typedef uint32_t xkb_layout_index_t;
|
2016-02-15 12:42:48 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
class InputRedirection;
|
2017-01-14 17:06:41 +00:00
|
|
|
class KeyboardLayout;
|
2017-01-13 19:41:21 +00:00
|
|
|
class ModifiersChangedSpy;
|
2016-02-15 12:42:48 +00:00
|
|
|
class Toplevel;
|
|
|
|
|
2016-05-24 08:57:57 +00:00
|
|
|
namespace LibInput
|
|
|
|
{
|
|
|
|
class Device;
|
|
|
|
}
|
|
|
|
|
2016-11-15 13:23:51 +00:00
|
|
|
class KWIN_EXPORT KeyboardInputRedirection : public QObject
|
2016-02-15 12:42:48 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit KeyboardInputRedirection(InputRedirection *parent);
|
|
|
|
virtual ~KeyboardInputRedirection();
|
|
|
|
|
|
|
|
void init();
|
|
|
|
|
|
|
|
void update();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2019-02-02 18:17:44 +00:00
|
|
|
**/
|
2016-05-24 08:57:57 +00:00
|
|
|
void processKey(uint32_t key, InputRedirection::KeyboardKeyState state, uint32_t time, LibInput::Device *device = nullptr);
|
2016-02-15 12:42:48 +00:00
|
|
|
/**
|
|
|
|
* @internal
|
2019-02-02 18:17:44 +00:00
|
|
|
**/
|
2016-02-15 12:42:48 +00:00
|
|
|
void processModifiers(uint32_t modsDepressed, uint32_t modsLatched, uint32_t modsLocked, uint32_t group);
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
**/
|
|
|
|
void processKeymapChange(int fd, uint32_t size);
|
|
|
|
|
|
|
|
Xkb *xkb() const {
|
|
|
|
return m_xkb.data();
|
|
|
|
}
|
|
|
|
Qt::KeyboardModifiers modifiers() const {
|
|
|
|
return m_xkb->modifiers();
|
|
|
|
}
|
2016-12-26 13:19:56 +00:00
|
|
|
Qt::KeyboardModifiers modifiersRelevantForGlobalShortcuts() const {
|
|
|
|
return m_xkb->modifiersRelevantForGlobalShortcuts();
|
|
|
|
}
|
2016-02-15 12:42:48 +00:00
|
|
|
|
2016-10-05 09:50:20 +00:00
|
|
|
Q_SIGNALS:
|
|
|
|
void ledsChanged(KWin::Xkb::LEDs);
|
|
|
|
|
2016-02-15 12:42:48 +00:00
|
|
|
private:
|
|
|
|
InputRedirection *m_input;
|
|
|
|
bool m_inited = false;
|
|
|
|
QScopedPointer<Xkb> m_xkb;
|
2016-06-26 13:57:38 +00:00
|
|
|
QMetaObject::Connection m_activeClientSurfaceChangedConnection;
|
2017-01-13 19:41:21 +00:00
|
|
|
ModifiersChangedSpy *m_modifiersChangedSpy = nullptr;
|
2017-01-14 17:06:41 +00:00
|
|
|
KeyboardLayout *m_keyboardLayout = nullptr;
|
2016-02-15 12:42:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|