Skip to content

Commit

Permalink
Revert "SNIProxy: use Qt Private headers to get Xcb timestamp"
Browse files Browse the repository at this point in the history
This reverts commit 82bcd4b.
  • Loading branch information
gfgit committed Apr 3, 2024
1 parent e7f3140 commit ae5ff03
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
1 change: 0 additions & 1 deletion plugin-tray/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ qt_add_dbus_adaptor(SOURCES org.kde.StatusNotifierItem.xml sniproxy.h SNIProxy)
qt_add_dbus_interface(SOURCES org.kde.StatusNotifierWatcher.xml statusnotifierwatcher_interface)

set(LIBRARIES
Qt6::GuiPrivate
${XCB_LIBRARIES}
${xtst_LDFLAGS}
)
Expand Down
9 changes: 2 additions & 7 deletions plugin-tray/sniproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@

#include <KWindowSystem>
#include <netwm.h>
#include <qpa/qplatformnativeinterface.h> //For "gettimestamp" Xcb integration resource

#include "kwindowinfo.h"
#include "statusnotifieritemadaptor.h"
Expand Down Expand Up @@ -591,17 +590,13 @@ void SNIProxy::sendClick(uint8_t mouseButton, int x, int y)
auto *x11Application = qGuiApp->nativeInterface<QNativeInterface::QX11Application>();
WId appRootWindow = XDefaultRootWindow(x11Application->display());

// Qt private access
void *ptr = qGuiApp->platformNativeInterface()->nativeResourceForScreen("gettimestamp", qGuiApp->primaryScreen());
xcb_timestamp_t timeStamp = reinterpret_cast<quintptr>(ptr);

// mouse down
if (m_injectMode == Direct) {
xcb_button_press_event_t *event = new xcb_button_press_event_t;
memset(event, 0x00, sizeof(xcb_button_press_event_t));
event->response_type = XCB_BUTTON_PRESS;
event->event = m_windowId;
event->time = timeStamp;
event->time = XCB_CURRENT_TIME; //NOTE: to get proper timestamp we would need Qt Private APIs
event->same_screen = 1;
event->root = appRootWindow;
event->root_x = x;
Expand All @@ -624,7 +619,7 @@ void SNIProxy::sendClick(uint8_t mouseButton, int x, int y)
memset(event, 0x00, sizeof(xcb_button_release_event_t));
event->response_type = XCB_BUTTON_RELEASE;
event->event = m_windowId;
event->time = timeStamp;
event->time = XCB_CURRENT_TIME; //NOTE: to get proper timestamp we would need Qt Private APIs
event->same_screen = 1;
event->root = appRootWindow;
event->root_x = x;
Expand Down

0 comments on commit ae5ff03

Please sign in to comment.