KWindowSystem

kusertimestamp.cpp
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 2003 Luboš Luňák <[email protected]>
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 #include <QX11Info>
15 #include <netwm.h>
16 #endif
17 
18 unsigned long KUserTimestamp::userTimestamp()
19 {
21 #if KWINDOWSYSTEM_HAVE_X11
22  return QX11Info::appUserTime();
23 #endif
24  }
25  return 0;
26 }
27 
28 void KUserTimestamp::updateUserTimestamp(unsigned long time)
29 {
30 #if KWINDOWSYSTEM_HAVE_X11
32  return;
33  }
34  if (time == 0) { // get current X timestamp
35  time = QX11Info::getTimestamp();
36  }
37 
38  if (QX11Info::appUserTime() == 0 || NET::timestampCompare(time, QX11Info::appUserTime()) > 0) { // time > appUserTime
39  QX11Info::setAppUserTime(time);
40  }
41  if (QX11Info::appTime() == 0 || NET::timestampCompare(time, QX11Info::appTime()) > 0) { // time > appTime
42  QX11Info::setAppTime(time);
43  }
44 #else
45  Q_UNUSED(time)
46 #endif
47 }
static int timestampCompare(unsigned long time1, unsigned long time2)
Compares two X timestamps, taking into account wrapping and 64bit architectures.
Definition: netwm.cpp:4938
static bool isPlatformX11()
Convenience method to check whether the Platform is X11.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Oct 15 2021 22:41:50 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.