File indexing completed on 2024-04-21 03:59:27
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 2003 Luboš Luňák <l.lunak@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.1-or-later 0006 */ 0007 0008 #include "kusertimestamp.h" 0009 0010 #include "config-kwindowsystem.h" 0011 #include "kwindowsystem.h" 0012 0013 #if KWINDOWSYSTEM_HAVE_X11 0014 0015 #include <private/qtx11extras_p.h> 0016 0017 #include <netwm.h> 0018 #endif 0019 0020 unsigned long KUserTimestamp::userTimestamp() 0021 { 0022 if (KWindowSystem::isPlatformX11()) { 0023 #if KWINDOWSYSTEM_HAVE_X11 0024 return QX11Info::appUserTime(); 0025 #endif 0026 } 0027 return 0; 0028 } 0029 0030 void KUserTimestamp::updateUserTimestamp(unsigned long time) 0031 { 0032 #if KWINDOWSYSTEM_HAVE_X11 0033 if (!KWindowSystem::isPlatformX11()) { 0034 return; 0035 } 0036 if (time == 0) { // get current X timestamp 0037 time = QX11Info::getTimestamp(); 0038 } 0039 0040 if (QX11Info::appUserTime() == 0 || NET::timestampCompare(time, QX11Info::appUserTime()) > 0) { // time > appUserTime 0041 QX11Info::setAppUserTime(time); 0042 } 0043 if (QX11Info::appTime() == 0 || NET::timestampCompare(time, QX11Info::appTime()) > 0) { // time > appTime 0044 QX11Info::setAppTime(time); 0045 } 0046 #else 0047 Q_UNUSED(time) 0048 #endif 0049 }