diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -532,7 +532,6 @@ Qt5::DBus Qt5::Quick Qt5::Script - Qt5::X11Extras ) set(kwin_KDE_LIBS @@ -614,7 +613,7 @@ target_link_libraries(kwin kwinglutils ${epoxy_LIBRARY}) kf5_add_kdeinit_executable(kwin_x11 main_x11.cpp) -target_link_libraries(kdeinit_kwin_x11 kwin KF5::Crash) +target_link_libraries(kdeinit_kwin_x11 kwin KF5::Crash Qt5::X11Extras) install(TARGETS kwin ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP ) install(TARGETS kdeinit_kwin_x11 ${INSTALL_TARGETS_DEFAULT_ARGS} ) diff --git a/platform.h b/platform.h --- a/platform.h +++ b/platform.h @@ -308,6 +308,15 @@ **/ virtual OverlayWindow *createOverlayWindow(); + /** + * Allows a platform to update the X11 timestamp. + * Mostly for the X11 standalone platform to interact with QX11Info. + * + * Default implementation does nothing. This means code relying on the X timestamp being up to date, + * might not be working. E.g. synced X11 window resizing + **/ + virtual void updateXTime(); + public Q_SLOTS: void pointerMotion(const QPointF &position, quint32 time); void pointerButtonPressed(quint32 button, quint32 time); diff --git a/platform.cpp b/platform.cpp --- a/platform.cpp +++ b/platform.cpp @@ -466,4 +466,8 @@ return nullptr; } +void Platform::updateXTime() +{ +} + } diff --git a/plugins/platforms/x11/standalone/x11_platform.h b/plugins/platforms/x11/standalone/x11_platform.h --- a/plugins/platforms/x11/standalone/x11_platform.h +++ b/plugins/platforms/x11/standalone/x11_platform.h @@ -57,6 +57,8 @@ OverlayWindow *createOverlayWindow() override; + void updateXTime() override; + protected: void doHideCursor() override; void doShowCursor() override; diff --git a/plugins/platforms/x11/standalone/x11_platform.cpp b/plugins/platforms/x11/standalone/x11_platform.cpp --- a/plugins/platforms/x11/standalone/x11_platform.cpp +++ b/plugins/platforms/x11/standalone/x11_platform.cpp @@ -315,4 +315,21 @@ return new OverlayWindowX11(); } +/* + Updates xTime(). This used to simply fetch current timestamp from the server, + but that can cause xTime() to be newer than timestamp of events that are + still in our events queue, thus e.g. making XSetInputFocus() caused by such + event to be ignored. Therefore events queue is searched for first + event with timestamp, and extra PropertyNotify is generated in order to make + sure such event is found. +*/ +void X11StandalonePlatform::updateXTime() +{ + // NOTE: QX11Info::getTimestamp does not yet search the event queue as the old + // solution did. This means there might be regressions currently. See the + // documentation above on how it should be done properly. + kwinApp()->setX11Time(QX11Info::getTimestamp(), Application::TimestampUpdate::Always); +} + + } diff --git a/utils.cpp b/utils.cpp --- a/utils.cpp +++ b/utils.cpp @@ -35,12 +35,12 @@ #include #include -#include #include #include #include "atoms.h" +#include "platform.h" #include "workspace.h" #include @@ -72,20 +72,9 @@ #endif #ifndef KCMRULES -/* - Updates xTime(). This used to simply fetch current timestamp from the server, - but that can cause xTime() to be newer than timestamp of events that are - still in our events queue, thus e.g. making XSetInputFocus() caused by such - event to be ignored. Therefore events queue is searched for first - event with timestamp, and extra PropertyNotify is generated in order to make - sure such event is found. -*/ void updateXTime() { - // NOTE: QX11Info::getTimestamp does not yet search the event queue as the old - // solution did. This means there might be regressions currently. See the - // documentation above on how it should be done properly. - kwinApp()->setX11Time(QX11Info::getTimestamp(), Application::TimestampUpdate::Always); + kwinApp()->platform()->updateXTime(); } static int server_grab_count = 0;