utils: Drop updateXTime()

remotes/origin/work/adrien/hightresolutionrebased
Vlad Zahorodnii 3 years ago
parent f950cbd3d1
commit eedbde464e
  1. 8
      autotests/test_x11_timestamp_update.cpp
  2. 6
      src/activation.cpp
  3. 8
      src/events.cpp
  4. 2
      src/netinfo.cpp
  5. 2
      src/screenedge.cpp
  6. 4
      src/tabbox/tabbox.cpp
  7. 10
      src/utils/common.cpp
  8. 1
      src/utils/common.h
  9. 2
      src/workspace.cpp
  10. 6
      src/x11window.cpp

@ -61,7 +61,7 @@ void X11TimestampUpdateTest::testGrabAfterServerTime()
// this test tries to grab the X keyboard with a timestamp in future
// that should fail, but after updating the X11 timestamp, it should
// work again
KWin::updateXTime();
KWin::kwinApp()->updateXTime();
QCOMPARE(KWin::grabXKeyboard(), true);
KWin::ungrabXKeyboard();
@ -72,7 +72,7 @@ void X11TimestampUpdateTest::testGrabAfterServerTime()
QCOMPARE(KWin::grabXKeyboard(), false);
// let's update timestamp, now it should work again
KWin::updateXTime();
KWin::kwinApp()->updateXTime();
QCOMPARE(KWin::grabXKeyboard(), true);
KWin::ungrabXKeyboard();
}
@ -84,7 +84,7 @@ void X11TimestampUpdateTest::testBeforeLastGrabTime()
// timestamp it should work again
// first set the grab timestamp
KWin::updateXTime();
KWin::kwinApp()->updateXTime();
QCOMPARE(KWin::grabXKeyboard(), true);
KWin::ungrabXKeyboard();
@ -97,7 +97,7 @@ void X11TimestampUpdateTest::testBeforeLastGrabTime()
QCOMPARE(KWin::grabXKeyboard(), false);
// let's update timestamp, now it should work again
KWin::updateXTime();
KWin::kwinApp()->updateXTime();
QVERIFY(KWin::xTime() >= timestamp);
QCOMPARE(KWin::grabXKeyboard(), true);
KWin::ungrabXKeyboard();

@ -602,7 +602,7 @@ bool Workspace::restoreFocus()
// a timestamp *sigh*, kwin's timestamp would be older than the timestamp
// that was used by whoever caused the focus change, and therefore
// the attempt to restore the focus would fail due to old timestamp
updateXTime();
kwinApp()->updateXTime();
if (should_get_focus.count() > 0) {
return requestFocus(should_get_focus.last());
} else if (m_lastActiveWindow) {
@ -636,7 +636,7 @@ void X11Window::updateUserTime(xcb_timestamp_t time)
{
// copied in Group::updateUserTime
if (time == XCB_TIME_CURRENT_TIME) {
updateXTime();
kwinApp()->updateXTime();
time = xTime();
}
if (time != -1U
@ -930,7 +930,7 @@ void Group::updateUserTime(xcb_timestamp_t time)
{
// copy of X11Window::updateUserTime
if (time == XCB_CURRENT_TIME) {
updateXTime();
kwinApp()->updateXTime();
time = xTime();
}
if (time != -1U

@ -179,7 +179,7 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e)
const auto *event = reinterpret_cast<xcb_create_notify_event_t *>(e);
if (event->parent == kwinApp()->x11RootWindow() && !QWidget::find(event->window) && !event->override_redirect) {
// see comments for allowWindowActivation()
updateXTime();
kwinApp()->updateXTime();
const xcb_timestamp_t t = xTime();
xcb_change_property(kwinApp()->x11Connection(), XCB_PROP_MODE_REPLACE, event->window, atoms->kde_net_wm_user_creation_time, XCB_ATOM_CARDINAL, 32, 1, &t);
}
@ -195,7 +195,7 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e)
return true;
}
case XCB_MAP_REQUEST: {
updateXTime();
kwinApp()->updateXTime();
const auto *event = reinterpret_cast<xcb_map_request_event_t *>(e);
if (X11Window *window = findClient(Predicate::WindowMatch, event->window)) {
@ -281,7 +281,7 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e)
if (event->event == kwinApp()->x11RootWindow()
&& (event->detail == XCB_NOTIFY_DETAIL_NONE || event->detail == XCB_NOTIFY_DETAIL_POINTER_ROOT || event->detail == XCB_NOTIFY_DETAIL_INFERIOR)) {
Xcb::CurrentInput currentInput;
updateXTime(); // focusToNull() uses xTime(), which is old now (FocusIn has no timestamp)
kwinApp()->updateXTime(); // focusToNull() uses xTime(), which is old now (FocusIn has no timestamp)
// it seems we can "loose" focus reversions when the closing window hold a grab
// => catch the typical pattern (though we don't want the focus on the root anyway) #348935
const bool lostFocusPointerToRoot = currentInput->focus == kwinApp()->x11RootWindow() && event->detail == XCB_NOTIFY_DETAIL_INFERIOR;
@ -1251,7 +1251,7 @@ bool Unmanaged::windowEvent(xcb_generic_event_t *e)
// To not run into these errors we try to wait for the destroy notify. For this we
// generate a round trip to the X server and wait a very short time span before
// handling the release.
updateXTime();
kwinApp()->updateXTime();
// using 1 msec to not just move it at the end of the event loop but add an very short
// timespan to cover cases like unmap() followed by destroy(). The only other way to
// ensure that the window is not destroyed when we do the release handling is to grab

@ -202,7 +202,7 @@ void RootInfo::moveResize(xcb_window_t w, int x_root, int y_root, unsigned long
{
X11Window *c = Workspace::self()->findClient(Predicate::WindowMatch, w);
if (c) {
updateXTime(); // otherwise grabbing may have old timestamp - this message should include timestamp
kwinApp()->updateXTime(); // otherwise grabbing may have old timestamp - this message should include timestamp
c->NETMoveResize(Xcb::fromXNative(x_root), Xcb::fromXNative(y_root), (Direction)direction);
}
}

@ -1514,7 +1514,7 @@ bool ScreenEdges::handleDndNotify(xcb_window_t window, const QPoint &point)
continue;
}
if (edge->isReserved() && edge->window() == window) {
updateXTime();
kwinApp()->updateXTime();
edge->check(point, QDateTime::fromMSecsSinceEpoch(xTime(), Qt::UTC), true);
return true;
}

@ -1534,7 +1534,7 @@ bool TabBox::establishTabBoxGrab()
m_forcedGlobalMouseGrab = true;
return true;
}
updateXTime();
kwinApp()->updateXTime();
if (!grabXKeyboard()) {
return false;
}
@ -1558,7 +1558,7 @@ void TabBox::removeTabBoxGrab()
m_forcedGlobalMouseGrab = false;
return;
}
updateXTime();
kwinApp()->updateXTime();
ungrabXKeyboard();
Q_ASSERT(m_forcedGlobalMouseGrab);
m_forcedGlobalMouseGrab = false;

@ -24,11 +24,6 @@
#ifndef KCMRULES
#include <QApplication>
#include <QDebug>
#include "main.h"
#include <cstdio>
#endif
Q_LOGGING_CATEGORY(KWIN_CORE, "kwin_core", QtWarningMsg)
@ -71,11 +66,6 @@ StrutRect &StrutRect::operator=(const StrutRect &other)
return *this;
}
void updateXTime()
{
kwinApp()->updateXTime();
}
static int server_grab_count = 0;
void grabXServer()

@ -115,7 +115,6 @@ enum class QuickTileFlag {
};
Q_DECLARE_FLAGS(QuickTileMode, QuickTileFlag)
void KWIN_EXPORT updateXTime();
void KWIN_EXPORT grabXServer();
void KWIN_EXPORT ungrabXServer();
bool KWIN_EXPORT grabXKeyboard(xcb_window_t w = XCB_WINDOW_NONE);

@ -325,7 +325,7 @@ void Workspace::initializeX11()
if (Xcb::Extensions::self()->isSyncAvailable()) {
m_syncAlarmFilter.reset(new SyncAlarmX11Filter);
}
updateXTime(); // Needed for proper initialization of user_time in Client ctor
kwinApp()->updateXTime(); // Needed for proper initialization of user_time in Client ctor
const uint32_t nullFocusValues[] = {true};
m_nullFocus.reset(new Xcb::Window(QRect(-1, -1, 1, 1), XCB_WINDOW_CLASS_INPUT_ONLY, XCB_CW_OVERRIDE_REDIRECT, nullFocusValues));

@ -2038,7 +2038,7 @@ bool X11Window::takeFocus()
demandAttention(false); // window cannot take input, at least withdraw urgency
}
if (info->supportsProtocol(NET::TakeFocusProtocol)) {
updateXTime();
kwinApp()->updateXTime();
sendClientMessage(window(), atoms->wm_protocols, atoms->wm_take_focus);
}
workspace()->setShouldGetFocus(this);
@ -2378,7 +2378,7 @@ void X11Window::sendSyncRequest()
m_syncRequest.value.hi++;
}
if (m_syncRequest.lastTimestamp >= xTime()) {
updateXTime();
kwinApp()->updateXTime();
}
// Send the message to client
@ -4656,7 +4656,7 @@ bool X11Window::doStartInteractiveMoveResize()
m_moveResizeGrabWindow.create(Xcb::toXNative(r), XCB_WINDOW_CLASS_INPUT_ONLY, 0, nullptr, kwinApp()->x11RootWindow());
m_moveResizeGrabWindow.map();
m_moveResizeGrabWindow.raise();
updateXTime();
kwinApp()->updateXTime();
const xcb_grab_pointer_cookie_t cookie = xcb_grab_pointer_unchecked(kwinApp()->x11Connection(), false, m_moveResizeGrabWindow,
XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW,
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, m_moveResizeGrabWindow, Cursors::self()->mouse()->x11Cursor(cursor()), xTime());

Loading…
Cancel
Save