| 1 | /* |
| 2 | This file is part of the KDE libraries |
| 3 | SPDX-FileCopyrightText: 2008 Lubos Lunak <l.lunak@kde.org> |
| 4 | |
| 5 | SPDX-License-Identifier: LGPL-2.1-or-later |
| 6 | */ |
| 7 | |
| 8 | #ifndef KXUTILS_H |
| 9 | #define KXUTILS_H |
| 10 | |
| 11 | #include <QPixmap> |
| 12 | #include <config-kwindowsystem.h> |
| 13 | |
| 14 | #if KWINDOWSYSTEM_HAVE_X11 |
| 15 | |
| 16 | #include <kwindowsystem_export.h> |
| 17 | |
| 18 | struct xcb_connection_t; |
| 19 | |
| 20 | namespace KXUtils |
| 21 | { |
| 22 | |
| 23 | /*! |
| 24 | * Creates a QPixmap that contains a copy of the pixmap given by the X handle pixmap |
| 25 | * and optionally also mask given as another X handle mask. This function tries to |
| 26 | * also handle the case when the depth of the pixmap differs from the native QPixmap depth. |
| 27 | * \since 4.0.2 |
| 28 | * \internal |
| 29 | */ |
| 30 | QPixmap createPixmapFromHandle(WId pixmap, WId mask = 0); |
| 31 | QPixmap createPixmapFromHandle(xcb_connection_t *c, WId pixmap, WId mask = 0); |
| 32 | |
| 33 | /*! |
| 34 | * Compares two X timestamps, taking into account wrapping and 64bit architectures. |
| 35 | * Return value is like with strcmp(), 0 for equal, -1 for time1 < time2, 1 for time1 > time2. |
| 36 | * \since 4.1.0 |
| 37 | * \internal |
| 38 | */ |
| 39 | int timestampCompare(unsigned long time1, unsigned long time2); |
| 40 | /*! |
| 41 | * Returns a difference of two X timestamps, time2 - time1, where time2 must be later than time1, |
| 42 | * as returned by timestampCompare(). |
| 43 | * \since 4.1.0 |
| 44 | * \internal |
| 45 | */ |
| 46 | int timestampDiff(unsigned long time1, unsigned long time2); |
| 47 | |
| 48 | } // namespace |
| 49 | |
| 50 | #endif // KWINDOWSYSTEM_HAVE_X11 |
| 51 | |
| 52 | #endif |
| 53 | |