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 | /** |
21 | * Namespace with various generic X11-related functionality. |
22 | */ |
23 | namespace KXUtils |
24 | { |
25 | |
26 | /** |
27 | * Creates a QPixmap that contains a copy of the pixmap given by the X handle @p pixmap |
28 | * and optionally also mask given as another X handle @mask. This function tries to |
29 | * also handle the case when the depth of the pixmap differs from the native QPixmap depth. |
30 | * @since 4.0.2 |
31 | */ |
32 | QPixmap createPixmapFromHandle(WId pixmap, WId mask = 0); |
33 | QPixmap createPixmapFromHandle(xcb_connection_t *c, WId pixmap, WId mask = 0); |
34 | |
35 | /** |
36 | * Compares two X timestamps, taking into account wrapping and 64bit architectures. |
37 | * Return value is like with strcmp(), 0 for equal, -1 for time1 < time2, 1 for time1 > time2. |
38 | * @since 4.1.0 |
39 | */ |
40 | int timestampCompare(unsigned long time1, unsigned long time2); |
41 | /** |
42 | * Returns a difference of two X timestamps, time2 - time1, where time2 must be later than time1, |
43 | * as returned by timestampCompare(). |
44 | * @since 4.1.0 |
45 | */ |
46 | int timestampDiff(unsigned long time1, unsigned long time2); |
47 | |
48 | } // namespace |
49 | |
50 | #endif // KWINDOWSYSTEM_HAVE_X11 |
51 | |
52 | #endif |
53 | |