From 9ca992a329cb5b1ad4ecb367762a542204466eda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 26 Feb 2015 16:23:25 +0100 Subject: [PATCH] [wayland] Drop methods on Toplevel to send input events No longer needed as InputRedirection sends input events directly through the SeatInterface. In addition this drops the dependency on xtest. --- CMakeLists.txt | 3 --- client.cpp | 35 ----------------------------------- client.h | 4 ---- toplevel.cpp | 33 --------------------------------- toplevel.h | 7 ------- unmanaged.cpp | 35 ----------------------------------- unmanaged.h | 3 --- wayland_backend.cpp | 1 - 8 files changed, 121 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c3ff3f0aa2..4ef0dd187d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -170,7 +170,6 @@ find_package(XCB KEYSYMS IMAGE SHM - XTEST GLX OPTIONAL_COMPONENTS ICCCM @@ -494,14 +493,12 @@ set(kwin_XCB_LIBS XCB::RANDR XCB::KEYSYMS XCB::SHM - XCB::XTEST XCB::GLX ) set(kwin_WAYLAND_LIBS Wayland::Client Wayland::Cursor - XCB::XTEST XKB::XKB KF5::WaylandClient KF5::WaylandServer diff --git a/client.cpp b/client.cpp index 2c42de992c..a395cd0181 100644 --- a/client.cpp +++ b/client.cpp @@ -59,7 +59,6 @@ along with this program. If not, see . // XLib #include #include -#include // system #include #include @@ -2399,40 +2398,6 @@ void Client::showOnScreenEdge() xcb_delete_property(connection(), window(), atoms->kde_screen_edge_show); } -void Client::sendPointerButtonEvent(uint32_t button, InputRedirection::PointerButtonState state) -{ - // TODO: don't use xtest - uint8_t type = XCB_BUTTON_PRESS; - if (state == KWin::InputRedirection::PointerButtonReleased) { - type = XCB_BUTTON_RELEASE; - } - xcb_test_fake_input(connection(), type, InputRedirection::toXPointerButton(button), XCB_TIME_CURRENT_TIME, frameId(), 0, 0, 0); -} - -void Client::sendPointerAxisEvent(InputRedirection::PointerAxis axis, qreal delta) -{ - // TODO: don't use xtest - const int val = qRound(delta); - if (val == 0) { - return; - } - const uint8_t button = InputRedirection::toXPointerButton(axis, delta); - for (int i = 0; i < qAbs(val); ++i) { - xcb_test_fake_input(connection(), XCB_BUTTON_PRESS, button, XCB_TIME_CURRENT_TIME, frameId(), 0, 0, 0); - xcb_test_fake_input(connection(), XCB_BUTTON_RELEASE, button, XCB_TIME_CURRENT_TIME, frameId(), 0, 0, 0); - } -} - -void Client::sendKeybordKeyEvent(uint32_t key, InputRedirection::KeyboardKeyState state) -{ - // TODO: don't use xtest - uint8_t type = XCB_KEY_PRESS; - if (state == InputRedirection::KeyboardKeyReleased) { - type = XCB_KEY_RELEASE; - } - xcb_test_fake_input(connection(), type, key + 8, XCB_TIME_CURRENT_TIME, frameId(), 0, 0, 0); -} - #define BORDER(which) \ int Client::border##which() const \ { \ diff --git a/client.h b/client.h index 1346947af3..f0829b7df5 100644 --- a/client.h +++ b/client.h @@ -694,10 +694,6 @@ public: **/ void showOnScreenEdge(); - void sendPointerButtonEvent(uint32_t button, InputRedirection::PointerButtonState state) override; - void sendPointerAxisEvent(InputRedirection::PointerAxis axis, qreal delta) override; - void sendKeybordKeyEvent(uint32_t key, InputRedirection::KeyboardKeyState state) override; - public Q_SLOTS: void closeWindow(); void updateCaption(); diff --git a/toplevel.cpp b/toplevel.cpp index 1423be82c4..b358921a4e 100644 --- a/toplevel.cpp +++ b/toplevel.cpp @@ -445,39 +445,6 @@ void Toplevel::setSkipCloseAnimation(bool set) emit skipCloseAnimationChanged(); } -void Toplevel::sendPointerEnterEvent(const QPointF &globalPos) -{ - Q_UNUSED(globalPos) -} - -void Toplevel::sendPointerLeaveEvent(const QPointF &globalPos) -{ - Q_UNUSED(globalPos) -} - -void Toplevel::sendPointerMoveEvent(const QPointF &globalPos) -{ - Q_UNUSED(globalPos) -} - -void Toplevel::sendPointerButtonEvent(uint32_t button, InputRedirection::PointerButtonState state) -{ - Q_UNUSED(button) - Q_UNUSED(state) -} - -void Toplevel::sendPointerAxisEvent(InputRedirection::PointerAxis axis, qreal delta) -{ - Q_UNUSED(axis) - Q_UNUSED(delta) -} - -void Toplevel::sendKeybordKeyEvent(uint32_t key, InputRedirection::KeyboardKeyState state) -{ - Q_UNUSED(key) - Q_UNUSED(state) -} - #if HAVE_WAYLAND void Toplevel::setSurface(KWayland::Server::SurfaceInterface *surface) { diff --git a/toplevel.h b/toplevel.h index 78f7ae786d..675d37e9b8 100644 --- a/toplevel.h +++ b/toplevel.h @@ -359,13 +359,6 @@ public: void setSurface(KWayland::Server::SurfaceInterface *surface); #endif - virtual void sendPointerMoveEvent(const QPointF &globalPos); - virtual void sendPointerEnterEvent(const QPointF &globalPos); - virtual void sendPointerLeaveEvent(const QPointF &globalPos); - virtual void sendPointerButtonEvent(uint32_t button, InputRedirection::PointerButtonState state); - virtual void sendPointerAxisEvent(InputRedirection::PointerAxis axis, qreal delta); - virtual void sendKeybordKeyEvent(uint32_t key, InputRedirection::KeyboardKeyState state); - /** * @brief Finds the Toplevel matching the condition expressed in @p func in @p list. * diff --git a/unmanaged.cpp b/unmanaged.cpp index 689cd76004..9c9060b4a6 100644 --- a/unmanaged.cpp +++ b/unmanaged.cpp @@ -30,7 +30,6 @@ along with this program. If not, see . #include #include -#include namespace KWin { @@ -155,40 +154,6 @@ NET::WindowType Unmanaged::windowType(bool direct, int supportedTypes) const return info->windowType(NET::WindowTypes(supportedTypes)); } -void Unmanaged::sendPointerButtonEvent(uint32_t button, InputRedirection::PointerButtonState state) -{ - // TODO: don't use xtest - uint8_t type = XCB_BUTTON_PRESS; - if (state == KWin::InputRedirection::PointerButtonReleased) { - type = XCB_BUTTON_RELEASE; - } - xcb_test_fake_input(connection(), type, InputRedirection::toXPointerButton(button), XCB_TIME_CURRENT_TIME, window(), 0, 0, 0); -} - -void Unmanaged::sendPointerAxisEvent(InputRedirection::PointerAxis axis, qreal delta) -{ - // TODO: don't use xtest - const int val = qRound(delta); - if (val == 0) { - return; - } - const uint8_t button = InputRedirection::toXPointerButton(axis, delta); - for (int i = 0; i < qAbs(val); ++i) { - xcb_test_fake_input(connection(), XCB_BUTTON_PRESS, button, XCB_TIME_CURRENT_TIME, window(), 0, 0, 0); - xcb_test_fake_input(connection(), XCB_BUTTON_RELEASE, button, XCB_TIME_CURRENT_TIME, window(), 0, 0, 0); - } -} - -void Unmanaged::sendKeybordKeyEvent(uint32_t key, InputRedirection::KeyboardKeyState state) -{ - // TODO: don't use xtest - uint8_t type = XCB_KEY_PRESS; - if (state == InputRedirection::KeyboardKeyReleased) { - type = XCB_KEY_RELEASE; - } - xcb_test_fake_input(connection(), type, key + 8, XCB_TIME_CURRENT_TIME, window(), 0, 0, 0); -} - } // namespace #include "unmanaged.moc" diff --git a/unmanaged.h b/unmanaged.h index 6e63e69a5d..31aea047e2 100644 --- a/unmanaged.h +++ b/unmanaged.h @@ -47,9 +47,6 @@ public: } NET::WindowType windowType(bool direct = false, int supported_types = 0) const; - void sendPointerButtonEvent(uint32_t button, InputRedirection::PointerButtonState state) override; - void sendPointerAxisEvent(InputRedirection::PointerAxis axis, qreal delta) override; - void sendKeybordKeyEvent(uint32_t key, InputRedirection::KeyboardKeyState state) override; public Q_SLOTS: void release(ReleaseReason releaseReason = ReleaseReason::Release); protected: diff --git a/wayland_backend.cpp b/wayland_backend.cpp index ddf6e9f767..1c36a6a986 100644 --- a/wayland_backend.cpp +++ b/wayland_backend.cpp @@ -49,7 +49,6 @@ along with this program. If not, see . #include #include // xcb -#include #include // Wayland #include