| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||||||||||||||
| 2 | ** | - | ||||||||||||||||||||||||
| 3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||||||||||||||||||||
| 4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||||||||||||||||||||
| 5 | ** | - | ||||||||||||||||||||||||
| 6 | ** This file is part of the plugins of the Qt Toolkit. | - | ||||||||||||||||||||||||
| 7 | ** | - | ||||||||||||||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||||||||||||||||||||
| 9 | ** Commercial License Usage | - | ||||||||||||||||||||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||||||||||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||||||||||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||||||||||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||||||||||||||
| 14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||||||||
| 15 | ** information use the contact form at http://www.qt.io/contact-us. | - | ||||||||||||||||||||||||
| 16 | ** | - | ||||||||||||||||||||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||||||||||||||||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||||||||||||||
| 19 | ** General Public License version 2.1 or version 3 as published by the Free | - | ||||||||||||||||||||||||
| 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||||||||||||||||||||
| 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||||||||||||||||||||
| 22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||||||||||||||||||||
| 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||||||||||||||||||||
| 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||||||||||||||||||||
| 25 | ** | - | ||||||||||||||||||||||||
| 26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||||||||||||||||||||
| 27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||||||||||||||||||||
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||||||||||||||||||||
| 29 | ** | - | ||||||||||||||||||||||||
| 30 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||||||||
| 31 | ** | - | ||||||||||||||||||||||||
| 32 | ****************************************************************************/ | - | ||||||||||||||||||||||||
| 33 | - | |||||||||||||||||||||||||
| 34 | #include "qxcbcursor.h" | - | ||||||||||||||||||||||||
| 35 | #include "qxcbconnection.h" | - | ||||||||||||||||||||||||
| 36 | #include "qxcbwindow.h" | - | ||||||||||||||||||||||||
| 37 | #include "qxcbimage.h" | - | ||||||||||||||||||||||||
| 38 | #include "qxcbxsettings.h" | - | ||||||||||||||||||||||||
| 39 | - | |||||||||||||||||||||||||
| 40 | #include <QtCore/QLibrary> | - | ||||||||||||||||||||||||
| 41 | #include <QtGui/QWindow> | - | ||||||||||||||||||||||||
| 42 | #include <QtGui/QBitmap> | - | ||||||||||||||||||||||||
| 43 | #include <QtGui/private/qguiapplication_p.h> | - | ||||||||||||||||||||||||
| 44 | #include <X11/cursorfont.h> | - | ||||||||||||||||||||||||
| 45 | #include <xcb/xfixes.h> | - | ||||||||||||||||||||||||
| 46 | #include <xcb/xcb_image.h> | - | ||||||||||||||||||||||||
| 47 | - | |||||||||||||||||||||||||
| 48 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||||||||
| 49 | - | |||||||||||||||||||||||||
| 50 | typedef int (*PtrXcursorLibraryLoadCursor)(void *, const char *); | - | ||||||||||||||||||||||||
| 51 | typedef char *(*PtrXcursorLibraryGetTheme)(void *); | - | ||||||||||||||||||||||||
| 52 | typedef int (*PtrXcursorLibrarySetTheme)(void *, const char *); | - | ||||||||||||||||||||||||
| 53 | typedef int (*PtrXcursorLibraryGetDefaultSize)(void *); | - | ||||||||||||||||||||||||
| 54 | - | |||||||||||||||||||||||||
| 55 | #if defined(XCB_USE_XLIB) && !defined(QT_NO_LIBRARY) | - | ||||||||||||||||||||||||
| 56 | #include <X11/Xlib.h> | - | ||||||||||||||||||||||||
| 57 | enum { | - | ||||||||||||||||||||||||
| 58 | XCursorShape = CursorShape | - | ||||||||||||||||||||||||
| 59 | }; | - | ||||||||||||||||||||||||
| 60 | #undef CursorShape | - | ||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||
| 62 | static PtrXcursorLibraryLoadCursor ptrXcursorLibraryLoadCursor = 0; | - | ||||||||||||||||||||||||
| 63 | static PtrXcursorLibraryGetTheme ptrXcursorLibraryGetTheme = 0; | - | ||||||||||||||||||||||||
| 64 | static PtrXcursorLibrarySetTheme ptrXcursorLibrarySetTheme = 0; | - | ||||||||||||||||||||||||
| 65 | static PtrXcursorLibraryGetDefaultSize ptrXcursorLibraryGetDefaultSize = 0; | - | ||||||||||||||||||||||||
| 66 | #endif | - | ||||||||||||||||||||||||
| 67 | - | |||||||||||||||||||||||||
| 68 | static xcb_font_t cursorFont = 0; | - | ||||||||||||||||||||||||
| 69 | static int cursorCount = 0; | - | ||||||||||||||||||||||||
| 70 | - | |||||||||||||||||||||||||
| 71 | static uint8_t cur_blank_bits[] = { | - | ||||||||||||||||||||||||
| 72 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 73 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 74 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | - | ||||||||||||||||||||||||
| 75 | - | |||||||||||||||||||||||||
| 76 | static const uint8_t cur_ver_bits[] = { | - | ||||||||||||||||||||||||
| 77 | 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, | - | ||||||||||||||||||||||||
| 78 | 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, | - | ||||||||||||||||||||||||
| 79 | 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00 }; | - | ||||||||||||||||||||||||
| 80 | static const uint8_t mcur_ver_bits[] = { | - | ||||||||||||||||||||||||
| 81 | 0x00, 0x00, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xf8, 0x3f, | - | ||||||||||||||||||||||||
| 82 | 0xfc, 0x7f, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xfc, 0x7f, 0xf8, 0x3f, | - | ||||||||||||||||||||||||
| 83 | 0xf0, 0x1f, 0xe0, 0x0f, 0xc0, 0x07, 0x80, 0x03 }; | - | ||||||||||||||||||||||||
| 84 | static const uint8_t cur_hor_bits[] = { | - | ||||||||||||||||||||||||
| 85 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x30, 0x18, | - | ||||||||||||||||||||||||
| 86 | 0x38, 0x38, 0xfc, 0x7f, 0xfc, 0x7f, 0x38, 0x38, 0x30, 0x18, 0x20, 0x08, | - | ||||||||||||||||||||||||
| 87 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | - | ||||||||||||||||||||||||
| 88 | static const uint8_t mcur_hor_bits[] = { | - | ||||||||||||||||||||||||
| 89 | 0x00, 0x00, 0x00, 0x00, 0x40, 0x04, 0x60, 0x0c, 0x70, 0x1c, 0x78, 0x3c, | - | ||||||||||||||||||||||||
| 90 | 0xfc, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfc, 0x7f, 0x78, 0x3c, | - | ||||||||||||||||||||||||
| 91 | 0x70, 0x1c, 0x60, 0x0c, 0x40, 0x04, 0x00, 0x00 }; | - | ||||||||||||||||||||||||
| 92 | static const uint8_t cur_bdiag_bits[] = { | - | ||||||||||||||||||||||||
| 93 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x3e, 0x00, 0x3c, 0x00, 0x3e, | - | ||||||||||||||||||||||||
| 94 | 0x00, 0x37, 0x88, 0x23, 0xd8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0xf8, 0x00, | - | ||||||||||||||||||||||||
| 95 | 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | - | ||||||||||||||||||||||||
| 96 | static const uint8_t mcur_bdiag_bits[] = { | - | ||||||||||||||||||||||||
| 97 | 0x00, 0x00, 0xc0, 0x7f, 0x80, 0x7f, 0x00, 0x7f, 0x00, 0x7e, 0x04, 0x7f, | - | ||||||||||||||||||||||||
| 98 | 0x8c, 0x7f, 0xdc, 0x77, 0xfc, 0x63, 0xfc, 0x41, 0xfc, 0x00, 0xfc, 0x01, | - | ||||||||||||||||||||||||
| 99 | 0xfc, 0x03, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00 }; | - | ||||||||||||||||||||||||
| 100 | static const uint8_t cur_fdiag_bits[] = { | - | ||||||||||||||||||||||||
| 101 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0xf8, 0x00, 0x78, 0x00, | - | ||||||||||||||||||||||||
| 102 | 0xf8, 0x00, 0xd8, 0x01, 0x88, 0x23, 0x00, 0x37, 0x00, 0x3e, 0x00, 0x3c, | - | ||||||||||||||||||||||||
| 103 | 0x00, 0x3e, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00 }; | - | ||||||||||||||||||||||||
| 104 | static const uint8_t mcur_fdiag_bits[] = { | - | ||||||||||||||||||||||||
| 105 | 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x01, 0xfc, 0x00, | - | ||||||||||||||||||||||||
| 106 | 0xfc, 0x41, 0xfc, 0x63, 0xdc, 0x77, 0x8c, 0x7f, 0x04, 0x7f, 0x00, 0x7e, | - | ||||||||||||||||||||||||
| 107 | 0x00, 0x7f, 0x80, 0x7f, 0xc0, 0x7f, 0x00, 0x00 }; | - | ||||||||||||||||||||||||
| 108 | static const uint8_t *cursor_bits16[] = { | - | ||||||||||||||||||||||||
| 109 | cur_ver_bits, mcur_ver_bits, cur_hor_bits, mcur_hor_bits, | - | ||||||||||||||||||||||||
| 110 | cur_bdiag_bits, mcur_bdiag_bits, cur_fdiag_bits, mcur_fdiag_bits, | - | ||||||||||||||||||||||||
| 111 | 0, 0, cur_blank_bits, cur_blank_bits }; | - | ||||||||||||||||||||||||
| 112 | - | |||||||||||||||||||||||||
| 113 | static const uint8_t vsplit_bits[] = { | - | ||||||||||||||||||||||||
| 114 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 115 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 116 | 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, | - | ||||||||||||||||||||||||
| 117 | 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 118 | 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, | - | ||||||||||||||||||||||||
| 119 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, | - | ||||||||||||||||||||||||
| 120 | 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 121 | 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, | - | ||||||||||||||||||||||||
| 122 | 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 123 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 124 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | - | ||||||||||||||||||||||||
| 125 | static const uint8_t vsplitm_bits[] = { | - | ||||||||||||||||||||||||
| 126 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 127 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 128 | 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, | - | ||||||||||||||||||||||||
| 129 | 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, | - | ||||||||||||||||||||||||
| 130 | 0x00, 0xc0, 0x01, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, | - | ||||||||||||||||||||||||
| 131 | 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, | - | ||||||||||||||||||||||||
| 132 | 0x80, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, | - | ||||||||||||||||||||||||
| 133 | 0x00, 0xc0, 0x01, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, | - | ||||||||||||||||||||||||
| 134 | 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 135 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 136 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | - | ||||||||||||||||||||||||
| 137 | static const uint8_t hsplit_bits[] = { | - | ||||||||||||||||||||||||
| 138 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 139 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 140 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, | - | ||||||||||||||||||||||||
| 141 | 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, | - | ||||||||||||||||||||||||
| 142 | 0x00, 0x41, 0x82, 0x00, 0x80, 0x41, 0x82, 0x01, 0xc0, 0x7f, 0xfe, 0x03, | - | ||||||||||||||||||||||||
| 143 | 0x80, 0x41, 0x82, 0x01, 0x00, 0x41, 0x82, 0x00, 0x00, 0x40, 0x02, 0x00, | - | ||||||||||||||||||||||||
| 144 | 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, | - | ||||||||||||||||||||||||
| 145 | 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 146 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 147 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 148 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | - | ||||||||||||||||||||||||
| 149 | static const uint8_t hsplitm_bits[] = { | - | ||||||||||||||||||||||||
| 150 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 151 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 152 | 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, | - | ||||||||||||||||||||||||
| 153 | 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe3, 0xc7, 0x00, | - | ||||||||||||||||||||||||
| 154 | 0x80, 0xe3, 0xc7, 0x01, 0xc0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07, | - | ||||||||||||||||||||||||
| 155 | 0xc0, 0xff, 0xff, 0x03, 0x80, 0xe3, 0xc7, 0x01, 0x00, 0xe3, 0xc7, 0x00, | - | ||||||||||||||||||||||||
| 156 | 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, | - | ||||||||||||||||||||||||
| 157 | 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 158 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 159 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 160 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | - | ||||||||||||||||||||||||
| 161 | static const uint8_t whatsthis_bits[] = { | - | ||||||||||||||||||||||||
| 162 | 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0xf0, 0x07, 0x00, | - | ||||||||||||||||||||||||
| 163 | 0x09, 0x18, 0x0e, 0x00, 0x11, 0x1c, 0x0e, 0x00, 0x21, 0x1c, 0x0e, 0x00, | - | ||||||||||||||||||||||||
| 164 | 0x41, 0x1c, 0x0e, 0x00, 0x81, 0x1c, 0x0e, 0x00, 0x01, 0x01, 0x07, 0x00, | - | ||||||||||||||||||||||||
| 165 | 0x01, 0x82, 0x03, 0x00, 0xc1, 0xc7, 0x01, 0x00, 0x49, 0xc0, 0x01, 0x00, | - | ||||||||||||||||||||||||
| 166 | 0x95, 0xc0, 0x01, 0x00, 0x93, 0xc0, 0x01, 0x00, 0x21, 0x01, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 167 | 0x20, 0xc1, 0x01, 0x00, 0x40, 0xc2, 0x01, 0x00, 0x40, 0x02, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 168 | 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 169 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 170 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 171 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 172 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; | - | ||||||||||||||||||||||||
| 173 | static const uint8_t whatsthism_bits[] = { | - | ||||||||||||||||||||||||
| 174 | 0x01, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x07, 0x00, 0x07, 0xf8, 0x0f, 0x00, | - | ||||||||||||||||||||||||
| 175 | 0x0f, 0xfc, 0x1f, 0x00, 0x1f, 0x3e, 0x1f, 0x00, 0x3f, 0x3e, 0x1f, 0x00, | - | ||||||||||||||||||||||||
| 176 | 0x7f, 0x3e, 0x1f, 0x00, 0xff, 0x3e, 0x1f, 0x00, 0xff, 0x9d, 0x0f, 0x00, | - | ||||||||||||||||||||||||
| 177 | 0xff, 0xc3, 0x07, 0x00, 0xff, 0xe7, 0x03, 0x00, 0x7f, 0xe0, 0x03, 0x00, | - | ||||||||||||||||||||||||
| 178 | 0xf7, 0xe0, 0x03, 0x00, 0xf3, 0xe0, 0x03, 0x00, 0xe1, 0xe1, 0x03, 0x00, | - | ||||||||||||||||||||||||
| 179 | 0xe0, 0xe1, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, | - | ||||||||||||||||||||||||
| 180 | 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 181 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 182 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 183 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 184 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; | - | ||||||||||||||||||||||||
| 185 | static const uint8_t busy_bits[] = { | - | ||||||||||||||||||||||||
| 186 | 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 187 | 0x09, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 188 | 0x41, 0xe0, 0xff, 0x00, 0x81, 0x20, 0x80, 0x00, 0x01, 0xe1, 0xff, 0x00, | - | ||||||||||||||||||||||||
| 189 | 0x01, 0x42, 0x40, 0x00, 0xc1, 0x47, 0x40, 0x00, 0x49, 0x40, 0x55, 0x00, | - | ||||||||||||||||||||||||
| 190 | 0x95, 0x80, 0x2a, 0x00, 0x93, 0x00, 0x15, 0x00, 0x21, 0x01, 0x0a, 0x00, | - | ||||||||||||||||||||||||
| 191 | 0x20, 0x01, 0x11, 0x00, 0x40, 0x82, 0x20, 0x00, 0x40, 0x42, 0x44, 0x00, | - | ||||||||||||||||||||||||
| 192 | 0x80, 0x41, 0x4a, 0x00, 0x00, 0x40, 0x55, 0x00, 0x00, 0xe0, 0xff, 0x00, | - | ||||||||||||||||||||||||
| 193 | 0x00, 0x20, 0x80, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 194 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 195 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 196 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; | - | ||||||||||||||||||||||||
| 197 | static const uint8_t busym_bits[] = { | - | ||||||||||||||||||||||||
| 198 | 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 199 | 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 200 | 0x7f, 0xe0, 0xff, 0x00, 0xff, 0xe0, 0xff, 0x00, 0xff, 0xe1, 0xff, 0x00, | - | ||||||||||||||||||||||||
| 201 | 0xff, 0xc3, 0x7f, 0x00, 0xff, 0xc7, 0x7f, 0x00, 0x7f, 0xc0, 0x7f, 0x00, | - | ||||||||||||||||||||||||
| 202 | 0xf7, 0x80, 0x3f, 0x00, 0xf3, 0x00, 0x1f, 0x00, 0xe1, 0x01, 0x0e, 0x00, | - | ||||||||||||||||||||||||
| 203 | 0xe0, 0x01, 0x1f, 0x00, 0xc0, 0x83, 0x3f, 0x00, 0xc0, 0xc3, 0x7f, 0x00, | - | ||||||||||||||||||||||||
| 204 | 0x80, 0xc1, 0x7f, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0xe0, 0xff, 0x00, | - | ||||||||||||||||||||||||
| 205 | 0x00, 0xe0, 0xff, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 206 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 207 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||||||||||||||
| 208 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; | - | ||||||||||||||||||||||||
| 209 | - | |||||||||||||||||||||||||
| 210 | static const uint8_t * const cursor_bits32[] = { | - | ||||||||||||||||||||||||
| 211 | vsplit_bits, vsplitm_bits, hsplit_bits, hsplitm_bits, | - | ||||||||||||||||||||||||
| 212 | 0, 0, 0, 0, whatsthis_bits, whatsthism_bits, busy_bits, busym_bits | - | ||||||||||||||||||||||||
| 213 | }; | - | ||||||||||||||||||||||||
| 214 | - | |||||||||||||||||||||||||
| 215 | static const uint8_t forbidden_bits[] = { | - | ||||||||||||||||||||||||
| 216 | 0x00,0x00,0x00,0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xf0,0x00,0x38,0xc0,0x01, | - | ||||||||||||||||||||||||
| 217 | 0x7c,0x80,0x03,0xec,0x00,0x03,0xce,0x01,0x07,0x86,0x03,0x06,0x06,0x07,0x06, | - | ||||||||||||||||||||||||
| 218 | 0x06,0x0e,0x06,0x06,0x1c,0x06,0x0e,0x38,0x07,0x0c,0x70,0x03,0x1c,0xe0,0x03, | - | ||||||||||||||||||||||||
| 219 | 0x38,0xc0,0x01,0xf0,0xe0,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00,0x00,0x00,0x00 }; | - | ||||||||||||||||||||||||
| 220 | - | |||||||||||||||||||||||||
| 221 | static const uint8_t forbiddenm_bits[] = { | - | ||||||||||||||||||||||||
| 222 | 0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xff,0x00,0xf8,0xff,0x01,0xfc,0xf0,0x03, | - | ||||||||||||||||||||||||
| 223 | 0xfe,0xc0,0x07,0xfe,0x81,0x07,0xff,0x83,0x0f,0xcf,0x07,0x0f,0x8f,0x0f,0x0f, | - | ||||||||||||||||||||||||
| 224 | 0x0f,0x1f,0x0f,0x0f,0x3e,0x0f,0x1f,0xfc,0x0f,0x1e,0xf8,0x07,0x3e,0xf0,0x07, | - | ||||||||||||||||||||||||
| 225 | 0xfc,0xe0,0x03,0xf8,0xff,0x01,0xf0,0xff,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00}; | - | ||||||||||||||||||||||||
| 226 | - | |||||||||||||||||||||||||
| 227 | static const uint8_t openhand_bits[] = { | - | ||||||||||||||||||||||||
| 228 | 0x80,0x01,0x58,0x0e,0x64,0x12,0x64,0x52,0x48,0xb2,0x48,0x92, | - | ||||||||||||||||||||||||
| 229 | 0x16,0x90,0x19,0x80,0x11,0x40,0x02,0x40,0x04,0x40,0x04,0x20, | - | ||||||||||||||||||||||||
| 230 | 0x08,0x20,0x10,0x10,0x20,0x10,0x00,0x00}; | - | ||||||||||||||||||||||||
| 231 | static const uint8_t openhandm_bits[] = { | - | ||||||||||||||||||||||||
| 232 | 0x80,0x01,0xd8,0x0f,0xfc,0x1f,0xfc,0x5f,0xf8,0xff,0xf8,0xff, | - | ||||||||||||||||||||||||
| 233 | 0xf6,0xff,0xff,0xff,0xff,0x7f,0xfe,0x7f,0xfc,0x7f,0xfc,0x3f, | - | ||||||||||||||||||||||||
| 234 | 0xf8,0x3f,0xf0,0x1f,0xe0,0x1f,0x00,0x00}; | - | ||||||||||||||||||||||||
| 235 | static const uint8_t closedhand_bits[] = { | - | ||||||||||||||||||||||||
| 236 | 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0x48,0x32,0x08,0x50, | - | ||||||||||||||||||||||||
| 237 | 0x10,0x40,0x18,0x40,0x04,0x40,0x04,0x20,0x08,0x20,0x10,0x10, | - | ||||||||||||||||||||||||
| 238 | 0x20,0x10,0x20,0x10,0x00,0x00,0x00,0x00}; | - | ||||||||||||||||||||||||
| 239 | static const uint8_t closedhandm_bits[] = { | - | ||||||||||||||||||||||||
| 240 | 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0xf8,0x3f,0xf8,0x7f, | - | ||||||||||||||||||||||||
| 241 | 0xf0,0x7f,0xf8,0x7f,0xfc,0x7f,0xfc,0x3f,0xf8,0x3f,0xf0,0x1f, | - | ||||||||||||||||||||||||
| 242 | 0xe0,0x1f,0xe0,0x1f,0x00,0x00,0x00,0x00}; | - | ||||||||||||||||||||||||
| 243 | - | |||||||||||||||||||||||||
| 244 | static const uint8_t * const cursor_bits20[] = { | - | ||||||||||||||||||||||||
| 245 | forbidden_bits, forbiddenm_bits | - | ||||||||||||||||||||||||
| 246 | }; | - | ||||||||||||||||||||||||
| 247 | - | |||||||||||||||||||||||||
| 248 | static const char * const cursorNames[] = { | - | ||||||||||||||||||||||||
| 249 | "left_ptr", | - | ||||||||||||||||||||||||
| 250 | "up_arrow", | - | ||||||||||||||||||||||||
| 251 | "cross", | - | ||||||||||||||||||||||||
| 252 | "wait", | - | ||||||||||||||||||||||||
| 253 | "ibeam", | - | ||||||||||||||||||||||||
| 254 | "size_ver", | - | ||||||||||||||||||||||||
| 255 | "size_hor", | - | ||||||||||||||||||||||||
| 256 | "size_bdiag", | - | ||||||||||||||||||||||||
| 257 | "size_fdiag", | - | ||||||||||||||||||||||||
| 258 | "size_all", | - | ||||||||||||||||||||||||
| 259 | "blank", | - | ||||||||||||||||||||||||
| 260 | "split_v", | - | ||||||||||||||||||||||||
| 261 | "split_h", | - | ||||||||||||||||||||||||
| 262 | "pointing_hand", | - | ||||||||||||||||||||||||
| 263 | "forbidden", | - | ||||||||||||||||||||||||
| 264 | "whats_this", | - | ||||||||||||||||||||||||
| 265 | "left_ptr_watch", | - | ||||||||||||||||||||||||
| 266 | "openhand", | - | ||||||||||||||||||||||||
| 267 | "closedhand", | - | ||||||||||||||||||||||||
| 268 | "copy", | - | ||||||||||||||||||||||||
| 269 | "move", | - | ||||||||||||||||||||||||
| 270 | "link" | - | ||||||||||||||||||||||||
| 271 | }; | - | ||||||||||||||||||||||||
| 272 | - | |||||||||||||||||||||||||
| 273 | #ifndef QT_NO_CURSOR | - | ||||||||||||||||||||||||
| 274 | - | |||||||||||||||||||||||||
| 275 | QXcbCursorCacheKey::QXcbCursorCacheKey(const QCursor &c) | - | ||||||||||||||||||||||||
| 276 | : shape(c.shape()), bitmapCacheKey(0), maskCacheKey(0) | - | ||||||||||||||||||||||||
| 277 | { | - | ||||||||||||||||||||||||
| 278 | if (shape == Qt::BitmapCursor) {
| 0-7945 | ||||||||||||||||||||||||
| 279 | const qint64 pixmapCacheKey = c.pixmap().cacheKey(); | - | ||||||||||||||||||||||||
| 280 | if (pixmapCacheKey) {
| 0 | ||||||||||||||||||||||||
| 281 | bitmapCacheKey = pixmapCacheKey; | - | ||||||||||||||||||||||||
| 282 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 283 | Q_ASSERT(c.bitmap()); | - | ||||||||||||||||||||||||
| 284 | Q_ASSERT(c.mask()); | - | ||||||||||||||||||||||||
| 285 | bitmapCacheKey = c.bitmap()->cacheKey(); | - | ||||||||||||||||||||||||
| 286 | maskCacheKey = c.mask()->cacheKey(); | - | ||||||||||||||||||||||||
| 287 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 288 | } | - | ||||||||||||||||||||||||
| 289 | } executed 7945 times by 114 tests: end of blockExecuted by:
| 7945 | ||||||||||||||||||||||||
| 290 | - | |||||||||||||||||||||||||
| 291 | #endif // !QT_NO_CURSOR | - | ||||||||||||||||||||||||
| 292 | - | |||||||||||||||||||||||||
| 293 | QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen) | - | ||||||||||||||||||||||||
| 294 | : QXcbObject(conn), m_screen(screen), m_gtkCursorThemeInitialized(false) | - | ||||||||||||||||||||||||
| 295 | { | - | ||||||||||||||||||||||||
| 296 | if (cursorCount++)
| 0-129 | ||||||||||||||||||||||||
| 297 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 298 | - | |||||||||||||||||||||||||
| 299 | cursorFont = xcb_generate_id(xcb_connection()); | - | ||||||||||||||||||||||||
| 300 | const char *cursorStr = "cursor"; | - | ||||||||||||||||||||||||
| 301 | xcb_open_font(xcb_connection(), cursorFont, strlen(cursorStr), cursorStr); | - | ||||||||||||||||||||||||
| 302 | - | |||||||||||||||||||||||||
| 303 | #if defined(XCB_USE_XLIB) && !defined(QT_NO_LIBRARY) | - | ||||||||||||||||||||||||
| 304 | static bool function_ptrs_not_initialized = true; | - | ||||||||||||||||||||||||
| 305 | if (function_ptrs_not_initialized) {
| 28-101 | ||||||||||||||||||||||||
| 306 | QLibrary xcursorLib(QLatin1String("Xcursor"), 1); | - | ||||||||||||||||||||||||
| 307 | bool xcursorFound = xcursorLib.load(); | - | ||||||||||||||||||||||||
| 308 | if (!xcursorFound) { // try without the version number
| 0-28 | ||||||||||||||||||||||||
| 309 | xcursorLib.setFileName(QLatin1String("Xcursor")); | - | ||||||||||||||||||||||||
| 310 | xcursorFound = xcursorLib.load(); | - | ||||||||||||||||||||||||
| 311 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 312 | if (xcursorFound) {
| 0-28 | ||||||||||||||||||||||||
| 313 | ptrXcursorLibraryLoadCursor = | - | ||||||||||||||||||||||||
| 314 | (PtrXcursorLibraryLoadCursor) xcursorLib.resolve("XcursorLibraryLoadCursor"); | - | ||||||||||||||||||||||||
| 315 | ptrXcursorLibraryGetTheme = | - | ||||||||||||||||||||||||
| 316 | (PtrXcursorLibraryGetTheme) xcursorLib.resolve("XcursorGetTheme"); | - | ||||||||||||||||||||||||
| 317 | ptrXcursorLibrarySetTheme = | - | ||||||||||||||||||||||||
| 318 | (PtrXcursorLibrarySetTheme) xcursorLib.resolve("XcursorSetTheme"); | - | ||||||||||||||||||||||||
| 319 | ptrXcursorLibraryGetDefaultSize = | - | ||||||||||||||||||||||||
| 320 | (PtrXcursorLibraryGetDefaultSize) xcursorLib.resolve("XcursorGetDefaultSize"); | - | ||||||||||||||||||||||||
| 321 | } executed 28 times by 5 tests: end of blockExecuted by:
| 28 | ||||||||||||||||||||||||
| 322 | function_ptrs_not_initialized = false; | - | ||||||||||||||||||||||||
| 323 | } executed 28 times by 5 tests: end of blockExecuted by:
| 28 | ||||||||||||||||||||||||
| 324 | - | |||||||||||||||||||||||||
| 325 | #endif | - | ||||||||||||||||||||||||
| 326 | } executed 129 times by 5 tests: end of blockExecuted by:
| 129 | ||||||||||||||||||||||||
| 327 | - | |||||||||||||||||||||||||
| 328 | QXcbCursor::~QXcbCursor() | - | ||||||||||||||||||||||||
| 329 | { | - | ||||||||||||||||||||||||
| 330 | xcb_connection_t *conn = xcb_connection(); | - | ||||||||||||||||||||||||
| 331 | - | |||||||||||||||||||||||||
| 332 | if (m_gtkCursorThemeInitialized) {
| 19-322 | ||||||||||||||||||||||||
| 333 | m_screen->xSettings()->removeCallbackForHandle(this); | - | ||||||||||||||||||||||||
| 334 | } executed 19 times by 19 tests: end of blockExecuted by:
| 19 | ||||||||||||||||||||||||
| 335 | - | |||||||||||||||||||||||||
| 336 | if (!--cursorCount)
| 0-341 | ||||||||||||||||||||||||
| 337 | xcb_close_font(conn, cursorFont); executed 341 times by 220 tests: xcb_close_font(conn, cursorFont);Executed by:
| 341 | ||||||||||||||||||||||||
| 338 | - | |||||||||||||||||||||||||
| 339 | #ifndef QT_NO_CURSOR | - | ||||||||||||||||||||||||
| 340 | foreach (xcb_cursor_t cursor, m_cursorHash) | - | ||||||||||||||||||||||||
| 341 | xcb_free_cursor(conn, cursor); executed 162 times by 114 tests: xcb_free_cursor(conn, cursor);Executed by:
| 162 | ||||||||||||||||||||||||
| 342 | #endif | - | ||||||||||||||||||||||||
| 343 | } executed 341 times by 220 tests: end of blockExecuted by:
| 341 | ||||||||||||||||||||||||
| 344 | - | |||||||||||||||||||||||||
| 345 | #ifndef QT_NO_CURSOR | - | ||||||||||||||||||||||||
| 346 | void QXcbCursor::changeCursor(QCursor *cursor, QWindow *widget) | - | ||||||||||||||||||||||||
| 347 | { | - | ||||||||||||||||||||||||
| 348 | QXcbWindow *w = 0; | - | ||||||||||||||||||||||||
| 349 | if (widget && widget->handle())
| 0-7958 | ||||||||||||||||||||||||
| 350 | w = static_cast<QXcbWindow *>(widget->handle()); executed 7958 times by 114 tests: w = static_cast<QXcbWindow *>(widget->handle());Executed by:
| 7958 | ||||||||||||||||||||||||
| 351 | else | - | ||||||||||||||||||||||||
| 352 | // No X11 cursor control when there is no widget under the cursor | - | ||||||||||||||||||||||||
| 353 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 354 | - | |||||||||||||||||||||||||
| 355 | xcb_cursor_t c = XCB_CURSOR_NONE; | - | ||||||||||||||||||||||||
| 356 | bool isBitmapCursor = false; | - | ||||||||||||||||||||||||
| 357 | - | |||||||||||||||||||||||||
| 358 | if (cursor) {
| 13-7945 | ||||||||||||||||||||||||
| 359 | const Qt::CursorShape shape = cursor->shape(); | - | ||||||||||||||||||||||||
| 360 | isBitmapCursor = shape == Qt::BitmapCursor; | - | ||||||||||||||||||||||||
| 361 | - | |||||||||||||||||||||||||
| 362 | if (!isBitmapCursor) {
| 0-7945 | ||||||||||||||||||||||||
| 363 | const QXcbCursorCacheKey key(*cursor); | - | ||||||||||||||||||||||||
| 364 | CursorHash::iterator it = m_cursorHash.find(key); | - | ||||||||||||||||||||||||
| 365 | if (it == m_cursorHash.end()) {
| 164-7781 | ||||||||||||||||||||||||
| 366 | it = m_cursorHash.insert(key, createFontCursor(shape)); | - | ||||||||||||||||||||||||
| 367 | } executed 164 times by 114 tests: end of blockExecuted by:
| 164 | ||||||||||||||||||||||||
| 368 | c = it.value(); | - | ||||||||||||||||||||||||
| 369 | } else { executed 7945 times by 114 tests: end of blockExecuted by:
| 7945 | ||||||||||||||||||||||||
| 370 | // Do not cache bitmap cursors, as otherwise they have unclear | - | ||||||||||||||||||||||||
| 371 | // lifetime (we effectively leak xcb_cursor_t). | - | ||||||||||||||||||||||||
| 372 | c = createBitmapCursor(cursor); | - | ||||||||||||||||||||||||
| 373 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 374 | } | - | ||||||||||||||||||||||||
| 375 | - | |||||||||||||||||||||||||
| 376 | w->setCursor(c, isBitmapCursor); | - | ||||||||||||||||||||||||
| 377 | } executed 7958 times by 114 tests: end of blockExecuted by:
| 7958 | ||||||||||||||||||||||||
| 378 | - | |||||||||||||||||||||||||
| 379 | static int cursorIdForShape(int cshape) | - | ||||||||||||||||||||||||
| 380 | { | - | ||||||||||||||||||||||||
| 381 | int cursorId = 0; | - | ||||||||||||||||||||||||
| 382 | switch (cshape) { | - | ||||||||||||||||||||||||
| 383 | case Qt::ArrowCursor: executed 135 times by 114 tests: case Qt::ArrowCursor:Executed by:
| 135 | ||||||||||||||||||||||||
| 384 | cursorId = XC_left_ptr; | - | ||||||||||||||||||||||||
| 385 | break; executed 135 times by 114 tests: break;Executed by:
| 135 | ||||||||||||||||||||||||
| 386 | case Qt::UpArrowCursor: never executed: case Qt::UpArrowCursor: | 0 | ||||||||||||||||||||||||
| 387 | cursorId = XC_center_ptr; | - | ||||||||||||||||||||||||
| 388 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 389 | case Qt::CrossCursor: never executed: case Qt::CrossCursor: | 0 | ||||||||||||||||||||||||
| 390 | cursorId = XC_crosshair; | - | ||||||||||||||||||||||||
| 391 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 392 | case Qt::WaitCursor: executed 3 times by 3 tests: case Qt::WaitCursor:Executed by:
| 3 | ||||||||||||||||||||||||
| 393 | cursorId = XC_watch; | - | ||||||||||||||||||||||||
| 394 | break; executed 3 times by 3 tests: break;Executed by:
| 3 | ||||||||||||||||||||||||
| 395 | case Qt::IBeamCursor: executed 14 times by 14 tests: case Qt::IBeamCursor:Executed by:
| 14 | ||||||||||||||||||||||||
| 396 | cursorId = XC_xterm; | - | ||||||||||||||||||||||||
| 397 | break; executed 14 times by 14 tests: break;Executed by:
| 14 | ||||||||||||||||||||||||
| 398 | case Qt::SizeAllCursor: executed 2 times by 2 tests: case Qt::SizeAllCursor:Executed by:
| 2 | ||||||||||||||||||||||||
| 399 | cursorId = XC_fleur; | - | ||||||||||||||||||||||||
| 400 | break; executed 2 times by 2 tests: break;Executed by:
| 2 | ||||||||||||||||||||||||
| 401 | case Qt::PointingHandCursor: executed 2 times by 2 tests: case Qt::PointingHandCursor:Executed by:
| 2 | ||||||||||||||||||||||||
| 402 | cursorId = XC_hand2; | - | ||||||||||||||||||||||||
| 403 | break; executed 2 times by 2 tests: break;Executed by:
| 2 | ||||||||||||||||||||||||
| 404 | case Qt::SizeBDiagCursor: never executed: case Qt::SizeBDiagCursor: | 0 | ||||||||||||||||||||||||
| 405 | cursorId = XC_top_right_corner; | - | ||||||||||||||||||||||||
| 406 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 407 | case Qt::SizeFDiagCursor: executed 2 times by 2 tests: case Qt::SizeFDiagCursor:Executed by:
| 2 | ||||||||||||||||||||||||
| 408 | cursorId = XC_bottom_right_corner; | - | ||||||||||||||||||||||||
| 409 | break; executed 2 times by 2 tests: break;Executed by:
| 2 | ||||||||||||||||||||||||
| 410 | case Qt::SizeVerCursor: never executed: case Qt::SizeVerCursor: | 0 | ||||||||||||||||||||||||
| 411 | case Qt::SplitVCursor: executed 1 time by 1 test: case Qt::SplitVCursor:Executed by:
| 1 | ||||||||||||||||||||||||
| 412 | cursorId = XC_sb_v_double_arrow; | - | ||||||||||||||||||||||||
| 413 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||||||||||||||||||||
| 414 | case Qt::SizeHorCursor: never executed: case Qt::SizeHorCursor: | 0 | ||||||||||||||||||||||||
| 415 | case Qt::SplitHCursor: executed 1 time by 1 test: case Qt::SplitHCursor:Executed by:
| 1 | ||||||||||||||||||||||||
| 416 | cursorId = XC_sb_h_double_arrow; | - | ||||||||||||||||||||||||
| 417 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||||||||||||||||||||
| 418 | case Qt::WhatsThisCursor: never executed: case Qt::WhatsThisCursor: | 0 | ||||||||||||||||||||||||
| 419 | cursorId = XC_question_arrow; | - | ||||||||||||||||||||||||
| 420 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 421 | case Qt::ForbiddenCursor: never executed: case Qt::ForbiddenCursor: | 0 | ||||||||||||||||||||||||
| 422 | cursorId = XC_circle; | - | ||||||||||||||||||||||||
| 423 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 424 | case Qt::BusyCursor: never executed: case Qt::BusyCursor: | 0 | ||||||||||||||||||||||||
| 425 | cursorId = XC_watch; | - | ||||||||||||||||||||||||
| 426 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 427 | default: executed 4 times by 3 tests: default:Executed by:
| 4 | ||||||||||||||||||||||||
| 428 | break; executed 4 times by 3 tests: break;Executed by:
| 4 | ||||||||||||||||||||||||
| 429 | } | - | ||||||||||||||||||||||||
| 430 | return cursorId; executed 164 times by 114 tests: return cursorId;Executed by:
| 164 | ||||||||||||||||||||||||
| 431 | } | - | ||||||||||||||||||||||||
| 432 | - | |||||||||||||||||||||||||
| 433 | xcb_cursor_t QXcbCursor::createNonStandardCursor(int cshape) | - | ||||||||||||||||||||||||
| 434 | { | - | ||||||||||||||||||||||||
| 435 | xcb_cursor_t cursor = 0; | - | ||||||||||||||||||||||||
| 436 | xcb_connection_t *conn = xcb_connection(); | - | ||||||||||||||||||||||||
| 437 | - | |||||||||||||||||||||||||
| 438 | if (cshape == Qt::BlankCursor) {
| 1-3 | ||||||||||||||||||||||||
| 439 | xcb_pixmap_t cp = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), cur_blank_bits, 16, 16, | - | ||||||||||||||||||||||||
| 440 | 1, 0, 0, 0); | - | ||||||||||||||||||||||||
| 441 | xcb_pixmap_t mp = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), cur_blank_bits, 16, 16, | - | ||||||||||||||||||||||||
| 442 | 1, 0, 0, 0); | - | ||||||||||||||||||||||||
| 443 | cursor = xcb_generate_id(conn); | - | ||||||||||||||||||||||||
| 444 | xcb_create_cursor(conn, cursor, cp, mp, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, 8, 8); | - | ||||||||||||||||||||||||
| 445 | } else if (cshape >= Qt::SizeVerCursor && cshape < Qt::SizeAllCursor) { executed 1 time by 1 test: end of blockExecuted by:
| 0-3 | ||||||||||||||||||||||||
| 446 | int i = (cshape - Qt::SizeVerCursor) * 2; | - | ||||||||||||||||||||||||
| 447 | xcb_pixmap_t pm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), | - | ||||||||||||||||||||||||
| 448 | const_cast<uint8_t*>(cursor_bits16[i]), | - | ||||||||||||||||||||||||
| 449 | 16, 16, 1, 0, 0, 0); | - | ||||||||||||||||||||||||
| 450 | xcb_pixmap_t pmm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), | - | ||||||||||||||||||||||||
| 451 | const_cast<uint8_t*>(cursor_bits16[i + 1]), | - | ||||||||||||||||||||||||
| 452 | 16, 16, 1, 0, 0, 0); | - | ||||||||||||||||||||||||
| 453 | cursor = xcb_generate_id(conn); | - | ||||||||||||||||||||||||
| 454 | xcb_create_cursor(conn, cursor, pm, pmm, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, 8, 8); | - | ||||||||||||||||||||||||
| 455 | } else if ((cshape >= Qt::SplitVCursor && cshape <= Qt::SplitHCursor) never executed: end of block
| 0-3 | ||||||||||||||||||||||||
| 456 | || cshape == Qt::WhatsThisCursor || cshape == Qt::BusyCursor) {
| 0-3 | ||||||||||||||||||||||||
| 457 | int i = (cshape - Qt::SplitVCursor) * 2; | - | ||||||||||||||||||||||||
| 458 | xcb_pixmap_t pm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), | - | ||||||||||||||||||||||||
| 459 | const_cast<uint8_t*>(cursor_bits32[i]), | - | ||||||||||||||||||||||||
| 460 | 32, 32, 1, 0, 0, 0); | - | ||||||||||||||||||||||||
| 461 | xcb_pixmap_t pmm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), | - | ||||||||||||||||||||||||
| 462 | const_cast<uint8_t*>(cursor_bits32[i + 1]), | - | ||||||||||||||||||||||||
| 463 | 32, 32, 1, 0, 0, 0); | - | ||||||||||||||||||||||||
| 464 | int hs = (cshape == Qt::PointingHandCursor || cshape == Qt::WhatsThisCursor
| 0 | ||||||||||||||||||||||||
| 465 | || cshape == Qt::BusyCursor) ? 0 : 16;
| 0 | ||||||||||||||||||||||||
| 466 | cursor = xcb_generate_id(conn); | - | ||||||||||||||||||||||||
| 467 | xcb_create_cursor(conn, cursor, pm, pmm, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, hs, hs); | - | ||||||||||||||||||||||||
| 468 | } else if (cshape == Qt::ForbiddenCursor) { never executed: end of block
| 0-3 | ||||||||||||||||||||||||
| 469 | int i = (cshape - Qt::ForbiddenCursor) * 2; | - | ||||||||||||||||||||||||
| 470 | xcb_pixmap_t pm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), | - | ||||||||||||||||||||||||
| 471 | const_cast<uint8_t*>(cursor_bits20[i]), | - | ||||||||||||||||||||||||
| 472 | 20, 20, 1, 0, 0, 0); | - | ||||||||||||||||||||||||
| 473 | xcb_pixmap_t pmm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), | - | ||||||||||||||||||||||||
| 474 | const_cast<uint8_t*>(cursor_bits20[i + 1]), | - | ||||||||||||||||||||||||
| 475 | 20, 20, 1, 0, 0, 0); | - | ||||||||||||||||||||||||
| 476 | cursor = xcb_generate_id(conn); | - | ||||||||||||||||||||||||
| 477 | xcb_create_cursor(conn, cursor, pm, pmm, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, 10, 10); | - | ||||||||||||||||||||||||
| 478 | } else if (cshape == Qt::OpenHandCursor || cshape == Qt::ClosedHandCursor) { never executed: end of block
| 0-3 | ||||||||||||||||||||||||
| 479 | bool open = cshape == Qt::OpenHandCursor; | - | ||||||||||||||||||||||||
| 480 | xcb_pixmap_t pm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), | - | ||||||||||||||||||||||||
| 481 | const_cast<uint8_t*>(open ? openhand_bits : closedhand_bits), | - | ||||||||||||||||||||||||
| 482 | 16, 16, 1, 0, 0, 0); | - | ||||||||||||||||||||||||
| 483 | xcb_pixmap_t pmm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), | - | ||||||||||||||||||||||||
| 484 | const_cast<uint8_t*>(open ? openhandm_bits : closedhandm_bits), | - | ||||||||||||||||||||||||
| 485 | 16, 16, 1, 0, 0, 0); | - | ||||||||||||||||||||||||
| 486 | cursor = xcb_generate_id(conn); | - | ||||||||||||||||||||||||
| 487 | xcb_create_cursor(conn, cursor, pm, pmm, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, 8, 8); | - | ||||||||||||||||||||||||
| 488 | } else if (cshape == Qt::DragCopyCursor || cshape == Qt::DragMoveCursor executed 3 times by 3 tests: end of blockExecuted by:
| 0-3 | ||||||||||||||||||||||||
| 489 | || cshape == Qt::DragLinkCursor) {
| 0 | ||||||||||||||||||||||||
| 490 | QImage image = QGuiApplicationPrivate::instance()->getPixmapCursor(static_cast<Qt::CursorShape>(cshape)).toImage(); | - | ||||||||||||||||||||||||
| 491 | if (!image.isNull()) {
| 0 | ||||||||||||||||||||||||
| 492 | xcb_pixmap_t pm = qt_xcb_XPixmapFromBitmap(m_screen, image); | - | ||||||||||||||||||||||||
| 493 | xcb_pixmap_t pmm = qt_xcb_XPixmapFromBitmap(m_screen, image.createAlphaMask()); | - | ||||||||||||||||||||||||
| 494 | cursor = xcb_generate_id(conn); | - | ||||||||||||||||||||||||
| 495 | xcb_create_cursor(conn, cursor, pm, pmm, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, 8, 8); | - | ||||||||||||||||||||||||
| 496 | xcb_free_pixmap(conn, pm); | - | ||||||||||||||||||||||||
| 497 | xcb_free_pixmap(conn, pmm); | - | ||||||||||||||||||||||||
| 498 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 499 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 500 | - | |||||||||||||||||||||||||
| 501 | return cursor; executed 4 times by 3 tests: return cursor;Executed by:
| 4 | ||||||||||||||||||||||||
| 502 | } | - | ||||||||||||||||||||||||
| 503 | - | |||||||||||||||||||||||||
| 504 | #if defined(XCB_USE_XLIB) && !defined(QT_NO_LIBRARY) | - | ||||||||||||||||||||||||
| 505 | bool updateCursorTheme(void *dpy, const QByteArray &theme) { | - | ||||||||||||||||||||||||
| 506 | if (!ptrXcursorLibraryGetTheme
| 0-19 | ||||||||||||||||||||||||
| 507 | || !ptrXcursorLibrarySetTheme)
| 0-19 | ||||||||||||||||||||||||
| 508 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 509 | QByteArray oldTheme = ptrXcursorLibraryGetTheme(dpy); | - | ||||||||||||||||||||||||
| 510 | if (oldTheme == theme)
| 0-19 | ||||||||||||||||||||||||
| 511 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 512 | - | |||||||||||||||||||||||||
| 513 | int setTheme = ptrXcursorLibrarySetTheme(dpy,theme.constData()); | - | ||||||||||||||||||||||||
| 514 | return setTheme; executed 19 times by 19 tests: return setTheme;Executed by:
| 19 | ||||||||||||||||||||||||
| 515 | } | - | ||||||||||||||||||||||||
| 516 | - | |||||||||||||||||||||||||
| 517 | void QXcbCursor::cursorThemePropertyChanged(QXcbVirtualDesktop *screen, const QByteArray &name, const QVariant &property, void *handle) | - | ||||||||||||||||||||||||
| 518 | { | - | ||||||||||||||||||||||||
| 519 | Q_UNUSED(screen); | - | ||||||||||||||||||||||||
| 520 | Q_UNUSED(name); | - | ||||||||||||||||||||||||
| 521 | QXcbCursor *self = static_cast<QXcbCursor *>(handle); | - | ||||||||||||||||||||||||
| 522 | updateCursorTheme(self->connection()->xlib_display(),property.toByteArray()); | - | ||||||||||||||||||||||||
| 523 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 524 | - | |||||||||||||||||||||||||
| 525 | static xcb_cursor_t loadCursor(void *dpy, int cshape) | - | ||||||||||||||||||||||||
| 526 | { | - | ||||||||||||||||||||||||
| 527 | xcb_cursor_t cursor = XCB_NONE; | - | ||||||||||||||||||||||||
| 528 | if (!ptrXcursorLibraryLoadCursor || !dpy)
| 0-183 | ||||||||||||||||||||||||
| 529 | return cursor; never executed: return cursor; | 0 | ||||||||||||||||||||||||
| 530 | switch (cshape) { | - | ||||||||||||||||||||||||
| 531 | case Qt::DragCopyCursor: never executed: case Qt::DragCopyCursor: | 0 | ||||||||||||||||||||||||
| 532 | cursor = ptrXcursorLibraryLoadCursor(dpy, "dnd-copy"); | - | ||||||||||||||||||||||||
| 533 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 534 | case Qt::DragMoveCursor: never executed: case Qt::DragMoveCursor: | 0 | ||||||||||||||||||||||||
| 535 | cursor = ptrXcursorLibraryLoadCursor(dpy, "dnd-move"); | - | ||||||||||||||||||||||||
| 536 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 537 | case Qt::DragLinkCursor: never executed: case Qt::DragLinkCursor: | 0 | ||||||||||||||||||||||||
| 538 | cursor = ptrXcursorLibraryLoadCursor(dpy, "dnd-link"); | - | ||||||||||||||||||||||||
| 539 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 540 | default: executed 183 times by 114 tests: default:Executed by:
| 183 | ||||||||||||||||||||||||
| 541 | break; executed 183 times by 114 tests: break;Executed by:
| 183 | ||||||||||||||||||||||||
| 542 | } | - | ||||||||||||||||||||||||
| 543 | if (!cursor) {
| 0-183 | ||||||||||||||||||||||||
| 544 | cursor = ptrXcursorLibraryLoadCursor(dpy, cursorNames[cshape]); | - | ||||||||||||||||||||||||
| 545 | } executed 183 times by 114 tests: end of blockExecuted by:
| 183 | ||||||||||||||||||||||||
| 546 | return cursor; executed 183 times by 114 tests: return cursor;Executed by:
| 183 | ||||||||||||||||||||||||
| 547 | } | - | ||||||||||||||||||||||||
| 548 | #endif //XCB_USE_XLIB / QT_NO_LIBRARY | - | ||||||||||||||||||||||||
| 549 | - | |||||||||||||||||||||||||
| 550 | xcb_cursor_t QXcbCursor::createFontCursor(int cshape) | - | ||||||||||||||||||||||||
| 551 | { | - | ||||||||||||||||||||||||
| 552 | xcb_connection_t *conn = xcb_connection(); | - | ||||||||||||||||||||||||
| 553 | int cursorId = cursorIdForShape(cshape); | - | ||||||||||||||||||||||||
| 554 | xcb_cursor_t cursor = XCB_NONE; | - | ||||||||||||||||||||||||
| 555 | - | |||||||||||||||||||||||||
| 556 | // Try Xcursor first | - | ||||||||||||||||||||||||
| 557 | #if defined(XCB_USE_XLIB) && !defined(QT_NO_LIBRARY) | - | ||||||||||||||||||||||||
| 558 | if (cshape >= 0 && cshape <= Qt::LastCursor) {
| 0-164 | ||||||||||||||||||||||||
| 559 | void *dpy = connection()->xlib_display(); | - | ||||||||||||||||||||||||
| 560 | // special case for non-standard dnd-* cursors | - | ||||||||||||||||||||||||
| 561 | cursor = loadCursor(dpy, cshape); | - | ||||||||||||||||||||||||
| 562 | if (!cursor && !m_gtkCursorThemeInitialized && m_screen->xSettings()->initialized()) {
| 0-135 | ||||||||||||||||||||||||
| 563 | QByteArray gtkCursorTheme = m_screen->xSettings()->setting("Gtk/CursorThemeName").toByteArray(); | - | ||||||||||||||||||||||||
| 564 | m_screen->xSettings()->registerCallbackForProperty("Gtk/CursorThemeName",cursorThemePropertyChanged,this); | - | ||||||||||||||||||||||||
| 565 | if (updateCursorTheme(dpy,gtkCursorTheme)) {
| 0-19 | ||||||||||||||||||||||||
| 566 | cursor = loadCursor(dpy, cshape); | - | ||||||||||||||||||||||||
| 567 | } executed 19 times by 19 tests: end of blockExecuted by:
| 19 | ||||||||||||||||||||||||
| 568 | m_gtkCursorThemeInitialized = true; | - | ||||||||||||||||||||||||
| 569 | } executed 19 times by 19 tests: end of blockExecuted by:
| 19 | ||||||||||||||||||||||||
| 570 | } executed 164 times by 114 tests: end of blockExecuted by:
| 164 | ||||||||||||||||||||||||
| 571 | if (cursor)
| 29-135 | ||||||||||||||||||||||||
| 572 | return cursor; executed 135 times by 114 tests: return cursor;Executed by:
| 135 | ||||||||||||||||||||||||
| 573 | if (!cursor && cursorId) {
| 0-29 | ||||||||||||||||||||||||
| 574 | cursor = XCreateFontCursor(DISPLAY_FROM_XCB(this), cursorId); | - | ||||||||||||||||||||||||
| 575 | if (cursor)
| 0-25 | ||||||||||||||||||||||||
| 576 | return cursor; executed 25 times by 18 tests: return cursor;Executed by:
| 25 | ||||||||||||||||||||||||
| 577 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 578 | - | |||||||||||||||||||||||||
| 579 | #endif | - | ||||||||||||||||||||||||
| 580 | - | |||||||||||||||||||||||||
| 581 | // Non-standard X11 cursors are created from bitmaps | - | ||||||||||||||||||||||||
| 582 | cursor = createNonStandardCursor(cshape); | - | ||||||||||||||||||||||||
| 583 | - | |||||||||||||||||||||||||
| 584 | // Create a glpyh cursor if everything else failed | - | ||||||||||||||||||||||||
| 585 | if (!cursor && cursorId) {
| 0-4 | ||||||||||||||||||||||||
| 586 | cursor = xcb_generate_id(conn); | - | ||||||||||||||||||||||||
| 587 | xcb_create_glyph_cursor(conn, cursor, cursorFont, cursorFont, | - | ||||||||||||||||||||||||
| 588 | cursorId, cursorId + 1, | - | ||||||||||||||||||||||||
| 589 | 0xFFFF, 0xFFFF, 0xFFFF, 0, 0, 0); | - | ||||||||||||||||||||||||
| 590 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 591 | - | |||||||||||||||||||||||||
| 592 | if (cursor && cshape >= 0 && cshape < Qt::LastCursor && connection()->hasXFixes()) {
| 0-4 | ||||||||||||||||||||||||
| 593 | const char *name = cursorNames[cshape]; | - | ||||||||||||||||||||||||
| 594 | xcb_xfixes_set_cursor_name(conn, cursor, strlen(name), name); | - | ||||||||||||||||||||||||
| 595 | } executed 4 times by 3 tests: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 596 | - | |||||||||||||||||||||||||
| 597 | return cursor; executed 4 times by 3 tests: return cursor;Executed by:
| 4 | ||||||||||||||||||||||||
| 598 | } | - | ||||||||||||||||||||||||
| 599 | - | |||||||||||||||||||||||||
| 600 | xcb_cursor_t QXcbCursor::createBitmapCursor(QCursor *cursor) | - | ||||||||||||||||||||||||
| 601 | { | - | ||||||||||||||||||||||||
| 602 | xcb_connection_t *conn = xcb_connection(); | - | ||||||||||||||||||||||||
| 603 | QPoint spot = cursor->hotSpot(); | - | ||||||||||||||||||||||||
| 604 | xcb_cursor_t c = XCB_NONE; | - | ||||||||||||||||||||||||
| 605 | if (cursor->pixmap().depth() > 1)
| 0 | ||||||||||||||||||||||||
| 606 | c = qt_xcb_createCursorXRender(m_screen, cursor->pixmap().toImage(), spot); never executed: c = qt_xcb_createCursorXRender(m_screen, cursor->pixmap().toImage(), spot); | 0 | ||||||||||||||||||||||||
| 607 | if (!c) {
| 0 | ||||||||||||||||||||||||
| 608 | xcb_pixmap_t cp = qt_xcb_XPixmapFromBitmap(m_screen, cursor->bitmap()->toImage()); | - | ||||||||||||||||||||||||
| 609 | xcb_pixmap_t mp = qt_xcb_XPixmapFromBitmap(m_screen, cursor->mask()->toImage()); | - | ||||||||||||||||||||||||
| 610 | c = xcb_generate_id(conn); | - | ||||||||||||||||||||||||
| 611 | xcb_create_cursor(conn, c, cp, mp, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, | - | ||||||||||||||||||||||||
| 612 | spot.x(), spot.y()); | - | ||||||||||||||||||||||||
| 613 | xcb_free_pixmap(conn, cp); | - | ||||||||||||||||||||||||
| 614 | xcb_free_pixmap(conn, mp); | - | ||||||||||||||||||||||||
| 615 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 616 | return c; never executed: return c; | 0 | ||||||||||||||||||||||||
| 617 | } | - | ||||||||||||||||||||||||
| 618 | #endif | - | ||||||||||||||||||||||||
| 619 | - | |||||||||||||||||||||||||
| 620 | void QXcbCursor::queryPointer(QXcbConnection *c, QXcbVirtualDesktop **virtualDesktop, QPoint *pos, int *keybMask) | - | ||||||||||||||||||||||||
| 621 | { | - | ||||||||||||||||||||||||
| 622 | if (pos)
| 716-15580 | ||||||||||||||||||||||||
| 623 | *pos = QPoint(); executed 15580 times by 79 tests: *pos = QPoint();Executed by:
| 15580 | ||||||||||||||||||||||||
| 624 | - | |||||||||||||||||||||||||
| 625 | xcb_window_t root = c->primaryVirtualDesktop()->root(); | - | ||||||||||||||||||||||||
| 626 | xcb_query_pointer_cookie_t cookie = xcb_query_pointer(c->xcb_connection(), root); | - | ||||||||||||||||||||||||
| 627 | xcb_generic_error_t *err = 0; | - | ||||||||||||||||||||||||
| 628 | xcb_query_pointer_reply_t *reply = xcb_query_pointer_reply(c->xcb_connection(), cookie, &err); | - | ||||||||||||||||||||||||
| 629 | if (!err && reply) {
| 0-16296 | ||||||||||||||||||||||||
| 630 | if (virtualDesktop) {
| 716-15580 | ||||||||||||||||||||||||
| 631 | foreach (QXcbVirtualDesktop *vd, c->virtualDesktops()) { | - | ||||||||||||||||||||||||
| 632 | if (vd->root() == reply->root) {
| 0-716 | ||||||||||||||||||||||||
| 633 | *virtualDesktop = vd; | - | ||||||||||||||||||||||||
| 634 | break; executed 716 times by 27 tests: break;Executed by:
| 716 | ||||||||||||||||||||||||
| 635 | } | - | ||||||||||||||||||||||||
| 636 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 637 | } executed 716 times by 27 tests: end of blockExecuted by:
| 716 | ||||||||||||||||||||||||
| 638 | if (pos)
| 716-15580 | ||||||||||||||||||||||||
| 639 | *pos = QPoint(reply->root_x, reply->root_y); executed 15580 times by 79 tests: *pos = QPoint(reply->root_x, reply->root_y);Executed by:
| 15580 | ||||||||||||||||||||||||
| 640 | if (keybMask)
| 0-16296 | ||||||||||||||||||||||||
| 641 | *keybMask = reply->mask; never executed: *keybMask = reply->mask; | 0 | ||||||||||||||||||||||||
| 642 | free(reply); | - | ||||||||||||||||||||||||
| 643 | return; executed 16296 times by 82 tests: return;Executed by:
| 16296 | ||||||||||||||||||||||||
| 644 | } | - | ||||||||||||||||||||||||
| 645 | free(err); | - | ||||||||||||||||||||||||
| 646 | free(reply); | - | ||||||||||||||||||||||||
| 647 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 648 | - | |||||||||||||||||||||||||
| 649 | QPoint QXcbCursor::pos() const | - | ||||||||||||||||||||||||
| 650 | { | - | ||||||||||||||||||||||||
| 651 | QPoint p; | - | ||||||||||||||||||||||||
| 652 | queryPointer(connection(), 0, &p); | - | ||||||||||||||||||||||||
| 653 | return p; executed 15580 times by 79 tests: return p;Executed by:
| 15580 | ||||||||||||||||||||||||
| 654 | } | - | ||||||||||||||||||||||||
| 655 | - | |||||||||||||||||||||||||
| 656 | void QXcbCursor::setPos(const QPoint &pos) | - | ||||||||||||||||||||||||
| 657 | { | - | ||||||||||||||||||||||||
| 658 | QXcbVirtualDesktop *virtualDesktop = Q_NULLPTR; | - | ||||||||||||||||||||||||
| 659 | queryPointer(connection(), &virtualDesktop, 0); | - | ||||||||||||||||||||||||
| 660 | xcb_warp_pointer(xcb_connection(), XCB_NONE, virtualDesktop->root(), 0, 0, 0, 0, pos.x(), pos.y()); | - | ||||||||||||||||||||||||
| 661 | xcb_flush(xcb_connection()); | - | ||||||||||||||||||||||||
| 662 | } executed 587 times by 23 tests: end of blockExecuted by:
| 587 | ||||||||||||||||||||||||
| 663 | - | |||||||||||||||||||||||||
| 664 | QT_END_NAMESPACE | - | ||||||||||||||||||||||||
| Source code | Switch to Preprocessed file |