KWindowSystem

kusertimestamp.cpp
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(time, QX11Info::appUserTime()) > 0) { // time > appUserTime
41 QX11Info::setAppUserTime(time);
42 }
43 if (QX11Info::appTime() == 0 || NET::timestampCompare(time, QX11Info::appTime()) > 0) { // time > appTime
44 QX11Info::setAppTime(time);
45 }
46#else
47 Q_UNUSED(time)
48#endif
49}
static int timestampCompare(unsigned long time1, unsigned long time2)
Compares two X timestamps, taking into account wrapping and 64bit architectures.
Definition netwm.cpp:4925
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:10:18 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.