diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt index 573543f497..a20fa534a7 100644 --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -316,6 +316,8 @@ target_link_libraries(testXkb Plasma::KWaylandServer KF5::WindowSystem + kwineffects + XKB::XKB Qt5::XkbCommonSupportPrivate ) diff --git a/autotests/integration/globalshortcuts_test.cpp b/autotests/integration/globalshortcuts_test.cpp index 18e5b09976..334f75162f 100644 --- a/autotests/integration/globalshortcuts_test.cpp +++ b/autotests/integration/globalshortcuts_test.cpp @@ -11,6 +11,7 @@ #include "cursor.h" #include "input.h" #include "internal_client.h" +#include "keyboard_input.h" #include "platform.h" #include "screens.h" #include "useractions.h" diff --git a/autotests/integration/keyboard_layout_test.cpp b/autotests/integration/keyboard_layout_test.cpp index 7172f1894e..aca60e7b5d 100644 --- a/autotests/integration/keyboard_layout_test.cpp +++ b/autotests/integration/keyboard_layout_test.cpp @@ -503,16 +503,16 @@ void KeyboardLayoutTest::testNumLock() QCOMPARE(xkb->layoutName(), QStringLiteral("English (US)")); // by default not set - QVERIFY(!xkb->leds().testFlag(Xkb::LED::NumLock)); + QVERIFY(!xkb->leds().testFlag(LED::NumLock)); quint32 timestamp = 0; kwinApp()->platform()->keyboardKeyPressed(KEY_NUMLOCK, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_NUMLOCK, timestamp++); // now it should be on - QVERIFY(xkb->leds().testFlag(Xkb::LED::NumLock)); + QVERIFY(xkb->leds().testFlag(LED::NumLock)); // and back to off kwinApp()->platform()->keyboardKeyPressed(KEY_NUMLOCK, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_NUMLOCK, timestamp++); - QVERIFY(!xkb->leds().testFlag(Xkb::LED::NumLock)); + QVERIFY(!xkb->leds().testFlag(LED::NumLock)); // let's reconfigure to enable through config auto group = InputConfig::self()->inputConfig()->group("Keyboard"); @@ -520,22 +520,22 @@ void KeyboardLayoutTest::testNumLock() group.sync(); xkb->reconfigure(); // now it should be on - QVERIFY(xkb->leds().testFlag(Xkb::LED::NumLock)); + QVERIFY(xkb->leds().testFlag(LED::NumLock)); // pressing should result in it being off kwinApp()->platform()->keyboardKeyPressed(KEY_NUMLOCK, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_NUMLOCK, timestamp++); - QVERIFY(!xkb->leds().testFlag(Xkb::LED::NumLock)); + QVERIFY(!xkb->leds().testFlag(LED::NumLock)); // pressing again should enable it kwinApp()->platform()->keyboardKeyPressed(KEY_NUMLOCK, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_NUMLOCK, timestamp++); - QVERIFY(xkb->leds().testFlag(Xkb::LED::NumLock)); + QVERIFY(xkb->leds().testFlag(LED::NumLock)); // now reconfigure to disable on load group.writeEntry("NumLock", 1); group.sync(); xkb->reconfigure(); - QVERIFY(!xkb->leds().testFlag(Xkb::LED::NumLock)); + QVERIFY(!xkb->leds().testFlag(LED::NumLock)); } WAYLANDTEST_MAIN(KeyboardLayoutTest) diff --git a/src/keyboard_input.h b/src/keyboard_input.h index cbc26e97b5..b439760a32 100644 --- a/src/keyboard_input.h +++ b/src/keyboard_input.h @@ -77,7 +77,7 @@ public: } Q_SIGNALS: - void ledsChanged(KWin::Xkb::LEDs); + void ledsChanged(KWin::LEDs); private: InputRedirection *m_input; diff --git a/src/libinput/connection.cpp b/src/libinput/connection.cpp index e4c6cdb94c..f2ed2adecf 100644 --- a/src/libinput/connection.cpp +++ b/src/libinput/connection.cpp @@ -81,16 +81,16 @@ Connection *Connection::s_self = nullptr; static ConnectionAdaptor *s_adaptor = nullptr; static Context *s_context = nullptr; -static quint32 toLibinputLEDS(Xkb::LEDs leds) +static quint32 toLibinputLEDS(LEDs leds) { quint32 libinputLeds = 0; - if (leds.testFlag(Xkb::LED::NumLock)) { + if (leds.testFlag(LED::NumLock)) { libinputLeds = libinputLeds | LIBINPUT_LED_NUM_LOCK; } - if (leds.testFlag(Xkb::LED::CapsLock)) { + if (leds.testFlag(LED::CapsLock)) { libinputLeds = libinputLeds | LIBINPUT_LED_CAPS_LOCK; } - if (leds.testFlag(Xkb::LED::ScrollLock)) { + if (leds.testFlag(LED::ScrollLock)) { libinputLeds = libinputLeds | LIBINPUT_LED_SCROLL_LOCK; } return libinputLeds; @@ -775,7 +775,7 @@ void Connection::disableTouchpads() toggleTouchpads(); } -void Connection::updateLEDs(Xkb::LEDs leds) +void Connection::updateLEDs(LEDs leds) { if (m_leds == leds) { return; diff --git a/src/libinput/connection.h b/src/libinput/connection.h index f4f1d523c9..2a65ad4bb9 100644 --- a/src/libinput/connection.h +++ b/src/libinput/connection.h @@ -12,7 +12,6 @@ #include #include "input.h" -#include "keyboard_input.h" #include #include @@ -85,7 +84,7 @@ public: QStringList devicesSysNames() const; - void updateLEDs(KWin::Xkb::LEDs leds); + void updateLEDs(KWin::LEDs leds); Q_SIGNALS: void keyChanged(quint32 key, KWin::InputRedirection::KeyboardKeyState, quint32 time, KWin::LibInput::Device *device); @@ -158,7 +157,7 @@ private: QVector m_devices; KSharedConfigPtr m_config; bool m_touchpadsEnabled = true; - Xkb::LEDs m_leds; + LEDs m_leds; KWIN_SINGLETON(Connection) }; diff --git a/src/libkwineffects/kwinglobals.h b/src/libkwineffects/kwinglobals.h index 133d0ec4fa..281477cfb4 100644 --- a/src/libkwineffects/kwinglobals.h +++ b/src/libkwineffects/kwinglobals.h @@ -137,6 +137,14 @@ enum class SessionState { }; Q_ENUM_NS(SessionState) +enum class LED { + NumLock = 1 << 0, + CapsLock = 1 << 1, + ScrollLock = 1 << 2 +}; +Q_DECLARE_FLAGS(LEDs, LED) +Q_FLAG_NS(LEDs) + inline KWIN_EXPORT xcb_connection_t *connection() { diff --git a/src/platformsupport/scenes/opengl/CMakeLists.txt b/src/platformsupport/scenes/opengl/CMakeLists.txt index e677113cbb..cb4d8d3cf5 100644 --- a/src/platformsupport/scenes/opengl/CMakeLists.txt +++ b/src/platformsupport/scenes/opengl/CMakeLists.txt @@ -23,5 +23,5 @@ ecm_qt_declare_logging_category(SCENE_OPENGL_BACKEND_SRCS ) add_library(SceneOpenGLBackend STATIC ${SCENE_OPENGL_BACKEND_SRCS}) -target_link_libraries(SceneOpenGLBackend Qt::Core Qt::Widgets KF5::CoreAddons KF5::ConfigCore KF5::WindowSystem Plasma::KWaylandServer) +target_link_libraries(SceneOpenGLBackend Qt::Core KF5::CoreAddons KF5::ConfigCore KF5::WindowSystem Plasma::KWaylandServer) target_include_directories(SceneOpenGLBackend PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src) diff --git a/src/platformsupport/scenes/opengl/egl_dmabuf.cpp b/src/platformsupport/scenes/opengl/egl_dmabuf.cpp index d794b344f5..bd847831ae 100644 --- a/src/platformsupport/scenes/opengl/egl_dmabuf.cpp +++ b/src/platformsupport/scenes/opengl/egl_dmabuf.cpp @@ -10,6 +10,7 @@ #include "egl_dmabuf.h" #include "drm_fourcc.h" #include "kwineglext.h" +#include "logging.h" #include "wayland_server.h" @@ -384,7 +385,7 @@ void filterFormatsWithMultiplePlanes(QVector &formats) while (it != formats.end()) { for (auto linuxFormat : s_multiPlaneFormats) { if (*it == linuxFormat) { - qDebug() << "Filter multi-plane format" << *it; + qCDebug(KWIN_OPENGL) << "Filter multi-plane format" << *it; it = formats.erase(it); it--; break; diff --git a/src/platformsupport/scenes/qpainter/CMakeLists.txt b/src/platformsupport/scenes/qpainter/CMakeLists.txt index bcdbd058c2..d9d105bf58 100644 --- a/src/platformsupport/scenes/qpainter/CMakeLists.txt +++ b/src/platformsupport/scenes/qpainter/CMakeLists.txt @@ -18,5 +18,5 @@ ecm_qt_declare_logging_category(SCENE_QPAINTER_BACKEND_SRCS ) add_library(SceneQPainterBackend STATIC ${SCENE_QPAINTER_BACKEND_SRCS}) -target_link_libraries(SceneQPainterBackend Qt::Core Qt::Widgets KF5::CoreAddons KF5::ConfigCore KF5::WindowSystem Plasma::KWaylandServer) +target_link_libraries(SceneQPainterBackend Qt::Core KF5::CoreAddons KF5::ConfigCore KF5::WindowSystem Plasma::KWaylandServer) target_include_directories(SceneQPainterBackend PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src) diff --git a/src/wayland_server.cpp b/src/wayland_server.cpp index 33ca6a5062..9079ada182 100644 --- a/src/wayland_server.cpp +++ b/src/wayland_server.cpp @@ -763,14 +763,14 @@ void WaylandServer::simulateUserActivity() } } -void WaylandServer::updateKeyState(KWin::Xkb::LEDs leds) +void WaylandServer::updateKeyState(KWin::LEDs leds) { if (!m_keyState) return; - m_keyState->setState(KeyStateInterface::Key::CapsLock, leds & KWin::Xkb::LED::CapsLock ? KeyStateInterface::State::Locked : KeyStateInterface::State::Unlocked); - m_keyState->setState(KeyStateInterface::Key::NumLock, leds & KWin::Xkb::LED::NumLock ? KeyStateInterface::State::Locked : KeyStateInterface::State::Unlocked); - m_keyState->setState(KeyStateInterface::Key::ScrollLock, leds & KWin::Xkb::LED::ScrollLock ? KeyStateInterface::State::Locked : KeyStateInterface::State::Unlocked); + m_keyState->setState(KeyStateInterface::Key::CapsLock, leds & KWin::LED::CapsLock ? KeyStateInterface::State::Locked : KeyStateInterface::State::Unlocked); + m_keyState->setState(KeyStateInterface::Key::NumLock, leds & KWin::LED::NumLock ? KeyStateInterface::State::Locked : KeyStateInterface::State::Unlocked); + m_keyState->setState(KeyStateInterface::Key::ScrollLock, leds & KWin::LED::ScrollLock ? KeyStateInterface::State::Locked : KeyStateInterface::State::Unlocked); } bool WaylandServer::isKeyboardShortcutsInhibited() const diff --git a/src/wayland_server.h b/src/wayland_server.h index 80055a02ee..1b2eb04c02 100644 --- a/src/wayland_server.h +++ b/src/wayland_server.h @@ -10,9 +10,10 @@ #define KWIN_WAYLAND_SERVER_H #include -#include "keyboard_input.h" #include +#include +#include class QThread; class QProcess; @@ -206,7 +207,7 @@ public: SocketPairConnection createConnection(); void simulateUserActivity(); - void updateKeyState(KWin::Xkb::LEDs leds); + void updateKeyState(KWin::LEDs leds); QSet linuxDmabufBuffers() const { return m_linuxDmabufBuffers; diff --git a/src/xkb.cpp b/src/xkb.cpp index cb96207ba7..ed6d827a62 100644 --- a/src/xkb.cpp +++ b/src/xkb.cpp @@ -78,7 +78,7 @@ Xkb::Xkb(QObject *parent) , m_keysym(XKB_KEY_NoSymbol) , m_leds() { - qRegisterMetaType(); + qRegisterMetaType(); if (!m_context) { qCDebug(KWIN_XKB) << "Could not create xkb context"; } else { diff --git a/src/xkb.h b/src/xkb.h index 11524cc028..8d5b8e504b 100644 --- a/src/xkb.h +++ b/src/xkb.h @@ -66,12 +66,6 @@ public: void switchToPreviousLayout(); bool switchToLayout(xkb_layout_index_t layout); - enum class LED { - NumLock = 1 << 0, - CapsLock = 1 << 1, - ScrollLock = 1 << 2 - }; - Q_DECLARE_FLAGS(LEDs, LED) LEDs leds() const { return m_leds; } @@ -160,7 +154,4 @@ Qt::KeyboardModifiers Xkb::modifiers() const } -Q_DECLARE_METATYPE(KWin::Xkb::LED) -Q_DECLARE_METATYPE(KWin::Xkb::LEDs) - #endif