1/*
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 2003 Luboš Luňák <l.lunak@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.1-or-later
6*/
7
8#include "kusertimestamp.h"
9
10#include "config-kwindowsystem.h"
11#include "kwindowsystem.h"
12
13#if KWINDOWSYSTEM_HAVE_X11
14
15#include <private/qtx11extras_p.h>
16
17#include <netwm.h>
18#endif
19
20unsigned long KUserTimestamp::userTimestamp()
21{
22 if (KWindowSystem::isPlatformX11()) {
23#if KWINDOWSYSTEM_HAVE_X11
24 return QX11Info::appUserTime();
25#endif
26 }
27 return 0;
28}
29
30void KUserTimestamp::updateUserTimestamp(unsigned long time)
31{
32#if KWINDOWSYSTEM_HAVE_X11
33 if (!KWindowSystem::isPlatformX11()) {
34 return;
35 }
36 if (time == 0) { // get current X timestamp
37 time = QX11Info::getTimestamp();
38 }
39
40 if (QX11Info::appUserTime() == 0 || NET::timestampCompare(time1: time, time2: QX11Info::appUserTime()) > 0) { // time > appUserTime
41 QX11Info::setAppUserTime(time);
42 }
43 if (QX11Info::appTime() == 0 || NET::timestampCompare(time1: time, time2: QX11Info::appTime()) > 0) { // time > appTime
44 QX11Info::setAppTime(time);
45 }
46#else
47 Q_UNUSED(time)
48#endif
49}
50

source code of kwindowsystem/src/kusertimestamp.cpp