| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | - | |||||||||||||
| 8 | typedef int (*PtrXcursorLibraryLoadCursor)(void *, const char *); | - | ||||||||||||
| 9 | typedef char *(*PtrXcursorLibraryGetTheme)(void *); | - | ||||||||||||
| 10 | typedef int (*PtrXcursorLibrarySetTheme)(void *, const char *); | - | ||||||||||||
| 11 | typedef int (*PtrXcursorLibraryGetDefaultSize)(void *); | - | ||||||||||||
| 12 | - | |||||||||||||
| 13 | - | |||||||||||||
| 14 | enum { | - | ||||||||||||
| 15 | XCursorShape = 0 | - | ||||||||||||
| 16 | }; | - | ||||||||||||
| 17 | - | |||||||||||||
| 18 | - | |||||||||||||
| 19 | static PtrXcursorLibraryLoadCursor ptrXcursorLibraryLoadCursor = 0; | - | ||||||||||||
| 20 | static PtrXcursorLibraryGetTheme ptrXcursorLibraryGetTheme = 0; | - | ||||||||||||
| 21 | static PtrXcursorLibrarySetTheme ptrXcursorLibrarySetTheme = 0; | - | ||||||||||||
| 22 | static PtrXcursorLibraryGetDefaultSize ptrXcursorLibraryGetDefaultSize = 0; | - | ||||||||||||
| 23 | - | |||||||||||||
| 24 | - | |||||||||||||
| 25 | static xcb_font_t cursorFont = 0; | - | ||||||||||||
| 26 | static int cursorCount = 0; | - | ||||||||||||
| 27 | - | |||||||||||||
| 28 | static uint8_t cur_blank_bits[] = { | - | ||||||||||||
| 29 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 30 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 31 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | - | ||||||||||||
| 32 | - | |||||||||||||
| 33 | static const uint8_t cur_ver_bits[] = { | - | ||||||||||||
| 34 | 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, | - | ||||||||||||
| 35 | 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, | - | ||||||||||||
| 36 | 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00 }; | - | ||||||||||||
| 37 | static const uint8_t mcur_ver_bits[] = { | - | ||||||||||||
| 38 | 0x00, 0x00, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xf8, 0x3f, | - | ||||||||||||
| 39 | 0xfc, 0x7f, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xfc, 0x7f, 0xf8, 0x3f, | - | ||||||||||||
| 40 | 0xf0, 0x1f, 0xe0, 0x0f, 0xc0, 0x07, 0x80, 0x03 }; | - | ||||||||||||
| 41 | static const uint8_t cur_hor_bits[] = { | - | ||||||||||||
| 42 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x30, 0x18, | - | ||||||||||||
| 43 | 0x38, 0x38, 0xfc, 0x7f, 0xfc, 0x7f, 0x38, 0x38, 0x30, 0x18, 0x20, 0x08, | - | ||||||||||||
| 44 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | - | ||||||||||||
| 45 | static const uint8_t mcur_hor_bits[] = { | - | ||||||||||||
| 46 | 0x00, 0x00, 0x00, 0x00, 0x40, 0x04, 0x60, 0x0c, 0x70, 0x1c, 0x78, 0x3c, | - | ||||||||||||
| 47 | 0xfc, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfc, 0x7f, 0x78, 0x3c, | - | ||||||||||||
| 48 | 0x70, 0x1c, 0x60, 0x0c, 0x40, 0x04, 0x00, 0x00 }; | - | ||||||||||||
| 49 | static const uint8_t cur_bdiag_bits[] = { | - | ||||||||||||
| 50 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x3e, 0x00, 0x3c, 0x00, 0x3e, | - | ||||||||||||
| 51 | 0x00, 0x37, 0x88, 0x23, 0xd8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0xf8, 0x00, | - | ||||||||||||
| 52 | 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | - | ||||||||||||
| 53 | static const uint8_t mcur_bdiag_bits[] = { | - | ||||||||||||
| 54 | 0x00, 0x00, 0xc0, 0x7f, 0x80, 0x7f, 0x00, 0x7f, 0x00, 0x7e, 0x04, 0x7f, | - | ||||||||||||
| 55 | 0x8c, 0x7f, 0xdc, 0x77, 0xfc, 0x63, 0xfc, 0x41, 0xfc, 0x00, 0xfc, 0x01, | - | ||||||||||||
| 56 | 0xfc, 0x03, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00 }; | - | ||||||||||||
| 57 | static const uint8_t cur_fdiag_bits[] = { | - | ||||||||||||
| 58 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0xf8, 0x00, 0x78, 0x00, | - | ||||||||||||
| 59 | 0xf8, 0x00, 0xd8, 0x01, 0x88, 0x23, 0x00, 0x37, 0x00, 0x3e, 0x00, 0x3c, | - | ||||||||||||
| 60 | 0x00, 0x3e, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00 }; | - | ||||||||||||
| 61 | static const uint8_t mcur_fdiag_bits[] = { | - | ||||||||||||
| 62 | 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x01, 0xfc, 0x00, | - | ||||||||||||
| 63 | 0xfc, 0x41, 0xfc, 0x63, 0xdc, 0x77, 0x8c, 0x7f, 0x04, 0x7f, 0x00, 0x7e, | - | ||||||||||||
| 64 | 0x00, 0x7f, 0x80, 0x7f, 0xc0, 0x7f, 0x00, 0x00 }; | - | ||||||||||||
| 65 | static const uint8_t *cursor_bits16[] = { | - | ||||||||||||
| 66 | cur_ver_bits, mcur_ver_bits, cur_hor_bits, mcur_hor_bits, | - | ||||||||||||
| 67 | cur_bdiag_bits, mcur_bdiag_bits, cur_fdiag_bits, mcur_fdiag_bits, | - | ||||||||||||
| 68 | 0, 0, cur_blank_bits, cur_blank_bits }; | - | ||||||||||||
| 69 | - | |||||||||||||
| 70 | static const uint8_t vsplit_bits[] = { | - | ||||||||||||
| 71 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 72 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 73 | 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, | - | ||||||||||||
| 74 | 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, | - | ||||||||||||
| 75 | 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, | - | ||||||||||||
| 76 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, | - | ||||||||||||
| 77 | 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, | - | ||||||||||||
| 78 | 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, | - | ||||||||||||
| 79 | 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 80 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 81 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | - | ||||||||||||
| 82 | static const uint8_t vsplitm_bits[] = { | - | ||||||||||||
| 83 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 84 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, | - | ||||||||||||
| 85 | 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, | - | ||||||||||||
| 86 | 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, | - | ||||||||||||
| 87 | 0x00, 0xc0, 0x01, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, | - | ||||||||||||
| 88 | 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, | - | ||||||||||||
| 89 | 0x80, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, | - | ||||||||||||
| 90 | 0x00, 0xc0, 0x01, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, | - | ||||||||||||
| 91 | 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, | - | ||||||||||||
| 92 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 93 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | - | ||||||||||||
| 94 | static const uint8_t hsplit_bits[] = { | - | ||||||||||||
| 95 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 96 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 97 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, | - | ||||||||||||
| 98 | 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, | - | ||||||||||||
| 99 | 0x00, 0x41, 0x82, 0x00, 0x80, 0x41, 0x82, 0x01, 0xc0, 0x7f, 0xfe, 0x03, | - | ||||||||||||
| 100 | 0x80, 0x41, 0x82, 0x01, 0x00, 0x41, 0x82, 0x00, 0x00, 0x40, 0x02, 0x00, | - | ||||||||||||
| 101 | 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, | - | ||||||||||||
| 102 | 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 103 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 104 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 105 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | - | ||||||||||||
| 106 | static const uint8_t hsplitm_bits[] = { | - | ||||||||||||
| 107 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 108 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 109 | 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, | - | ||||||||||||
| 110 | 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe3, 0xc7, 0x00, | - | ||||||||||||
| 111 | 0x80, 0xe3, 0xc7, 0x01, 0xc0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07, | - | ||||||||||||
| 112 | 0xc0, 0xff, 0xff, 0x03, 0x80, 0xe3, 0xc7, 0x01, 0x00, 0xe3, 0xc7, 0x00, | - | ||||||||||||
| 113 | 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, | - | ||||||||||||
| 114 | 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 115 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 116 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 117 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | - | ||||||||||||
| 118 | static const uint8_t whatsthis_bits[] = { | - | ||||||||||||
| 119 | 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0xf0, 0x07, 0x00, | - | ||||||||||||
| 120 | 0x09, 0x18, 0x0e, 0x00, 0x11, 0x1c, 0x0e, 0x00, 0x21, 0x1c, 0x0e, 0x00, | - | ||||||||||||
| 121 | 0x41, 0x1c, 0x0e, 0x00, 0x81, 0x1c, 0x0e, 0x00, 0x01, 0x01, 0x07, 0x00, | - | ||||||||||||
| 122 | 0x01, 0x82, 0x03, 0x00, 0xc1, 0xc7, 0x01, 0x00, 0x49, 0xc0, 0x01, 0x00, | - | ||||||||||||
| 123 | 0x95, 0xc0, 0x01, 0x00, 0x93, 0xc0, 0x01, 0x00, 0x21, 0x01, 0x00, 0x00, | - | ||||||||||||
| 124 | 0x20, 0xc1, 0x01, 0x00, 0x40, 0xc2, 0x01, 0x00, 0x40, 0x02, 0x00, 0x00, | - | ||||||||||||
| 125 | 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 126 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 127 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 128 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 129 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; | - | ||||||||||||
| 130 | static const uint8_t whatsthism_bits[] = { | - | ||||||||||||
| 131 | 0x01, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x07, 0x00, 0x07, 0xf8, 0x0f, 0x00, | - | ||||||||||||
| 132 | 0x0f, 0xfc, 0x1f, 0x00, 0x1f, 0x3e, 0x1f, 0x00, 0x3f, 0x3e, 0x1f, 0x00, | - | ||||||||||||
| 133 | 0x7f, 0x3e, 0x1f, 0x00, 0xff, 0x3e, 0x1f, 0x00, 0xff, 0x9d, 0x0f, 0x00, | - | ||||||||||||
| 134 | 0xff, 0xc3, 0x07, 0x00, 0xff, 0xe7, 0x03, 0x00, 0x7f, 0xe0, 0x03, 0x00, | - | ||||||||||||
| 135 | 0xf7, 0xe0, 0x03, 0x00, 0xf3, 0xe0, 0x03, 0x00, 0xe1, 0xe1, 0x03, 0x00, | - | ||||||||||||
| 136 | 0xe0, 0xe1, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, | - | ||||||||||||
| 137 | 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 141 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; | - | ||||||||||||
| 142 | static const uint8_t busy_bits[] = { | - | ||||||||||||
| 143 | 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, | - | ||||||||||||
| 144 | 0x09, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, | - | ||||||||||||
| 145 | 0x41, 0xe0, 0xff, 0x00, 0x81, 0x20, 0x80, 0x00, 0x01, 0xe1, 0xff, 0x00, | - | ||||||||||||
| 146 | 0x01, 0x42, 0x40, 0x00, 0xc1, 0x47, 0x40, 0x00, 0x49, 0x40, 0x55, 0x00, | - | ||||||||||||
| 147 | 0x95, 0x80, 0x2a, 0x00, 0x93, 0x00, 0x15, 0x00, 0x21, 0x01, 0x0a, 0x00, | - | ||||||||||||
| 148 | 0x20, 0x01, 0x11, 0x00, 0x40, 0x82, 0x20, 0x00, 0x40, 0x42, 0x44, 0x00, | - | ||||||||||||
| 149 | 0x80, 0x41, 0x4a, 0x00, 0x00, 0x40, 0x55, 0x00, 0x00, 0xe0, 0xff, 0x00, | - | ||||||||||||
| 150 | 0x00, 0x20, 0x80, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 151 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 152 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 153 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; | - | ||||||||||||
| 154 | static const uint8_t busym_bits[] = { | - | ||||||||||||
| 155 | 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, | - | ||||||||||||
| 156 | 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, | - | ||||||||||||
| 157 | 0x7f, 0xe0, 0xff, 0x00, 0xff, 0xe0, 0xff, 0x00, 0xff, 0xe1, 0xff, 0x00, | - | ||||||||||||
| 158 | 0xff, 0xc3, 0x7f, 0x00, 0xff, 0xc7, 0x7f, 0x00, 0x7f, 0xc0, 0x7f, 0x00, | - | ||||||||||||
| 159 | 0xf7, 0x80, 0x3f, 0x00, 0xf3, 0x00, 0x1f, 0x00, 0xe1, 0x01, 0x0e, 0x00, | - | ||||||||||||
| 160 | 0xe0, 0x01, 0x1f, 0x00, 0xc0, 0x83, 0x3f, 0x00, 0xc0, 0xc3, 0x7f, 0x00, | - | ||||||||||||
| 161 | 0x80, 0xc1, 0x7f, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0xe0, 0xff, 0x00, | - | ||||||||||||
| 162 | 0x00, 0xe0, 0xff, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 163 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 164 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||||||||
| 165 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; | - | ||||||||||||
| 166 | - | |||||||||||||
| 167 | static const uint8_t * const cursor_bits32[] = { | - | ||||||||||||
| 168 | vsplit_bits, vsplitm_bits, hsplit_bits, hsplitm_bits, | - | ||||||||||||
| 169 | 0, 0, 0, 0, whatsthis_bits, whatsthism_bits, busy_bits, busym_bits | - | ||||||||||||
| 170 | }; | - | ||||||||||||
| 171 | - | |||||||||||||
| 172 | static const uint8_t forbidden_bits[] = { | - | ||||||||||||
| 173 | 0x00,0x00,0x00,0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xf0,0x00,0x38,0xc0,0x01, | - | ||||||||||||
| 174 | 0x7c,0x80,0x03,0xec,0x00,0x03,0xce,0x01,0x07,0x86,0x03,0x06,0x06,0x07,0x06, | - | ||||||||||||
| 175 | 0x06,0x0e,0x06,0x06,0x1c,0x06,0x0e,0x38,0x07,0x0c,0x70,0x03,0x1c,0xe0,0x03, | - | ||||||||||||
| 176 | 0x38,0xc0,0x01,0xf0,0xe0,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00,0x00,0x00,0x00 }; | - | ||||||||||||
| 177 | - | |||||||||||||
| 178 | static const uint8_t forbiddenm_bits[] = { | - | ||||||||||||
| 179 | 0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xff,0x00,0xf8,0xff,0x01,0xfc,0xf0,0x03, | - | ||||||||||||
| 180 | 0xfe,0xc0,0x07,0xfe,0x81,0x07,0xff,0x83,0x0f,0xcf,0x07,0x0f,0x8f,0x0f,0x0f, | - | ||||||||||||
| 181 | 0x0f,0x1f,0x0f,0x0f,0x3e,0x0f,0x1f,0xfc,0x0f,0x1e,0xf8,0x07,0x3e,0xf0,0x07, | - | ||||||||||||
| 182 | 0xfc,0xe0,0x03,0xf8,0xff,0x01,0xf0,0xff,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00}; | - | ||||||||||||
| 183 | - | |||||||||||||
| 184 | static const uint8_t openhand_bits[] = { | - | ||||||||||||
| 185 | 0x80,0x01,0x58,0x0e,0x64,0x12,0x64,0x52,0x48,0xb2,0x48,0x92, | - | ||||||||||||
| 186 | 0x16,0x90,0x19,0x80,0x11,0x40,0x02,0x40,0x04,0x40,0x04,0x20, | - | ||||||||||||
| 187 | 0x08,0x20,0x10,0x10,0x20,0x10,0x00,0x00}; | - | ||||||||||||
| 188 | static const uint8_t openhandm_bits[] = { | - | ||||||||||||
| 189 | 0x80,0x01,0xd8,0x0f,0xfc,0x1f,0xfc,0x5f,0xf8,0xff,0xf8,0xff, | - | ||||||||||||
| 190 | 0xf6,0xff,0xff,0xff,0xff,0x7f,0xfe,0x7f,0xfc,0x7f,0xfc,0x3f, | - | ||||||||||||
| 191 | 0xf8,0x3f,0xf0,0x1f,0xe0,0x1f,0x00,0x00}; | - | ||||||||||||
| 192 | static const uint8_t closedhand_bits[] = { | - | ||||||||||||
| 193 | 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0x48,0x32,0x08,0x50, | - | ||||||||||||
| 194 | 0x10,0x40,0x18,0x40,0x04,0x40,0x04,0x20,0x08,0x20,0x10,0x10, | - | ||||||||||||
| 195 | 0x20,0x10,0x20,0x10,0x00,0x00,0x00,0x00}; | - | ||||||||||||
| 196 | static const uint8_t closedhandm_bits[] = { | - | ||||||||||||
| 197 | 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0xf8,0x3f,0xf8,0x7f, | - | ||||||||||||
| 198 | 0xf0,0x7f,0xf8,0x7f,0xfc,0x7f,0xfc,0x3f,0xf8,0x3f,0xf0,0x1f, | - | ||||||||||||
| 199 | 0xe0,0x1f,0xe0,0x1f,0x00,0x00,0x00,0x00}; | - | ||||||||||||
| 200 | - | |||||||||||||
| 201 | static const uint8_t * const cursor_bits20[] = { | - | ||||||||||||
| 202 | forbidden_bits, forbiddenm_bits | - | ||||||||||||
| 203 | }; | - | ||||||||||||
| 204 | - | |||||||||||||
| 205 | static const char * const cursorNames[] = { | - | ||||||||||||
| 206 | "left_ptr", | - | ||||||||||||
| 207 | "up_arrow", | - | ||||||||||||
| 208 | "cross", | - | ||||||||||||
| 209 | "wait", | - | ||||||||||||
| 210 | "ibeam", | - | ||||||||||||
| 211 | "size_ver", | - | ||||||||||||
| 212 | "size_hor", | - | ||||||||||||
| 213 | "size_bdiag", | - | ||||||||||||
| 214 | "size_fdiag", | - | ||||||||||||
| 215 | "size_all", | - | ||||||||||||
| 216 | "blank", | - | ||||||||||||
| 217 | "split_v", | - | ||||||||||||
| 218 | "split_h", | - | ||||||||||||
| 219 | "pointing_hand", | - | ||||||||||||
| 220 | "forbidden", | - | ||||||||||||
| 221 | "whats_this", | - | ||||||||||||
| 222 | "left_ptr_watch", | - | ||||||||||||
| 223 | "openhand", | - | ||||||||||||
| 224 | "closedhand", | - | ||||||||||||
| 225 | "copy", | - | ||||||||||||
| 226 | "move", | - | ||||||||||||
| 227 | "link" | - | ||||||||||||
| 228 | }; | - | ||||||||||||
| 229 | - | |||||||||||||
| 230 | - | |||||||||||||
| 231 | - | |||||||||||||
| 232 | QXcbCursorCacheKey::QXcbCursorCacheKey(const QCursor &c) | - | ||||||||||||
| 233 | : shape(c.shape()), bitmapCacheKey(0), maskCacheKey(0) | - | ||||||||||||
| 234 | { | - | ||||||||||||
| 235 | if (shape == Qt::BitmapCursor) { | - | ||||||||||||
| 236 | const qint64 pixmapCacheKey = c.pixmap().cacheKey(); | - | ||||||||||||
| 237 | if (pixmapCacheKey) { | - | ||||||||||||
| 238 | bitmapCacheKey = pixmapCacheKey; | - | ||||||||||||
| 239 | } else { | - | ||||||||||||
| 240 | ((!(c.bitmap())) ? qt_assert("c.bitmap()",__FILE__,283289) : qt_noop()); | - | ||||||||||||
| 241 | ((!(c.mask())) ? qt_assert("c.mask()",__FILE__,284290) : qt_noop()); | - | ||||||||||||
| 242 | bitmapCacheKey = c.bitmap()->cacheKey(); | - | ||||||||||||
| 243 | maskCacheKey = c.mask()->cacheKey(); | - | ||||||||||||
| 244 | } | - | ||||||||||||
| 245 | } | - | ||||||||||||
| 246 | } | - | ||||||||||||
| 247 | - | |||||||||||||
| 248 | - | |||||||||||||
| 249 | - | |||||||||||||
| 250 | QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen) | - | ||||||||||||
| 251 | : QXcbObject(conn), m_screen(screen), m_gtkCursorThemeInitialized(false) | - | ||||||||||||
| 252 | { | - | ||||||||||||
| 253 | if (cursorCount++) | - | ||||||||||||
| 254 | return; | - | ||||||||||||
| 255 | - | |||||||||||||
| 256 | cursorFont = xcb_generate_id(xcb_connection()); | - | ||||||||||||
| 257 | const char *cursorStr = "cursor"; | - | ||||||||||||
| 258 | xcb_open_font(xcb_connection(), cursorFont, strlen(cursorStr), cursorStr); | - | ||||||||||||
| 259 | - | |||||||||||||
| 260 | - | |||||||||||||
| 261 | static bool function_ptrs_not_initialized = true; | - | ||||||||||||
| 262 | if (function_ptrs_not_initialized) { | - | ||||||||||||
| 263 | QLibrary xcursorLib(QLatin1String("Xcursor"), 1); | - | ||||||||||||
| 264 | bool xcursorFound = xcursorLib.load(); | - | ||||||||||||
| 265 | if (!xcursorFound) { | - | ||||||||||||
| 266 | xcursorLib.setFileName(QLatin1String("Xcursor")); | - | ||||||||||||
| 267 | xcursorFound = xcursorLib.load(); | - | ||||||||||||
| 268 | } | - | ||||||||||||
| 269 | if (xcursorFound) { | - | ||||||||||||
| 270 | ptrXcursorLibraryLoadCursor = | - | ||||||||||||
| 271 | (PtrXcursorLibraryLoadCursor) xcursorLib.resolve("XcursorLibraryLoadCursor"); | - | ||||||||||||
| 272 | ptrXcursorLibraryGetTheme = | - | ||||||||||||
| 273 | (PtrXcursorLibraryGetTheme) xcursorLib.resolve("XcursorGetTheme"); | - | ||||||||||||
| 274 | ptrXcursorLibrarySetTheme = | - | ||||||||||||
| 275 | (PtrXcursorLibrarySetTheme) xcursorLib.resolve("XcursorSetTheme"); | - | ||||||||||||
| 276 | ptrXcursorLibraryGetDefaultSize = | - | ||||||||||||
| 277 | (PtrXcursorLibraryGetDefaultSize) xcursorLib.resolve("XcursorGetDefaultSize"); | - | ||||||||||||
| 278 | } | - | ||||||||||||
| 279 | function_ptrs_not_initialized = false; | - | ||||||||||||
| 280 | } | - | ||||||||||||
| 281 | - | |||||||||||||
| 282 | - | |||||||||||||
| 283 | } | - | ||||||||||||
| 284 | - | |||||||||||||
| 285 | QXcbCursor::~QXcbCursor() | - | ||||||||||||
| 286 | { | - | ||||||||||||
| 287 | xcb_connection_t *conn = xcb_connection(); | - | ||||||||||||
| 288 | - | |||||||||||||
| 289 |     if (m_gtkCursorThemeInitialized
  | 19-328 | ||||||||||||
| 290 | m_screen->xSettings()->removeCallbackForHandle(this); | - | ||||||||||||
| 291 |     } executed 19 times by 19 tests:  end of blockExecuted by: 
  | 19 | ||||||||||||
| 292 | - | |||||||||||||
| 293 |     if (!--cursorCount
  | 0-347 | ||||||||||||
| 294 |         xcb_close_font(conn, cursorFont); executed 347 times by 219 tests:  xcb_close_font(conn, cursorFont);Executed by: 
  | 347 | ||||||||||||
| 295 | - | |||||||||||||
| 296 | - | |||||||||||||
| 297 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(m_cursorHash)>::type> _container_((m_cursorHash)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)for (xcb_cursor_t cursor = *_container_.i; _container_.control; _container_.control = 0): qAsConst(m_cursorHash)) | - | ||||||||||||
| 298 |         xcb_free_cursor(conn, cursor); executed 164 times by 114 tests:  xcb_free_cursor(conn, cursor);Executed by: 
  | 164 | ||||||||||||
| 299 | - | |||||||||||||
| 300 | } executed 347 times by 219 tests:  end of blockExecuted by: 
  | 347 | ||||||||||||
| 301 | - | |||||||||||||
| 302 | - | |||||||||||||
| 303 | void QXcbCursor::changeCursor(QCursor *cursor, QWindow *widget) | - | ||||||||||||
| 304 | { | - | ||||||||||||
| 305 | QXcbWindow *w = 0; | - | ||||||||||||
| 306 | if (widget && widget->handle()) | - | ||||||||||||
| 307 | w = static_cast<QXcbWindow *>(widget->handle()); | - | ||||||||||||
| 308 | else | - | ||||||||||||
| 309 | - | |||||||||||||
| 310 | return; | - | ||||||||||||
| 311 | - | |||||||||||||
| 312 | xcb_cursor_t c = XCB_CURSOR_NONE; | - | ||||||||||||
| 313 | bool isBitmapCursor = false; | - | ||||||||||||
| 314 | - | |||||||||||||
| 315 | if (cursor) { | - | ||||||||||||
| 316 | const Qt::CursorShape shape = cursor->shape(); | - | ||||||||||||
| 317 | isBitmapCursor = shape == Qt::BitmapCursor; | - | ||||||||||||
| 318 | - | |||||||||||||
| 319 | if (!isBitmapCursor) { | - | ||||||||||||
| 320 | const QXcbCursorCacheKey key(*cursor); | - | ||||||||||||
| 321 | CursorHash::iterator it = m_cursorHash.find(key); | - | ||||||||||||
| 322 | if (it == m_cursorHash.end()) { | - | ||||||||||||
| 323 | it = m_cursorHash.insert(key, createFontCursor(shape)); | - | ||||||||||||
| 324 | } | - | ||||||||||||
| 325 | c = it.value(); | - | ||||||||||||
| 326 | } else { | - | ||||||||||||
| 327 | - | |||||||||||||
| 328 | - | |||||||||||||
| 329 | c = createBitmapCursor(cursor); | - | ||||||||||||
| 330 | } | - | ||||||||||||
| 331 | } | - | ||||||||||||
| 332 | - | |||||||||||||
| 333 | w->setCursor(c, isBitmapCursor); | - | ||||||||||||
| 334 | } | - | ||||||||||||
| 335 | - | |||||||||||||
| 336 | static int cursorIdForShape(int cshape) | - | ||||||||||||
| 337 | { | - | ||||||||||||
| 338 | int cursorId = 0; | - | ||||||||||||
| 339 | switch (cshape) { | - | ||||||||||||
| 340 | case Qt::ArrowCursor: | - | ||||||||||||
| 341 | cursorId = 68; | - | ||||||||||||
| 342 | break; | - | ||||||||||||
| 343 | case Qt::UpArrowCursor: | - | ||||||||||||
| 344 | cursorId = 22; | - | ||||||||||||
| 345 | break; | - | ||||||||||||
| 346 | case Qt::CrossCursor: | - | ||||||||||||
| 347 | cursorId = 34; | - | ||||||||||||
| 348 | break; | - | ||||||||||||
| 349 | case Qt::WaitCursor: | - | ||||||||||||
| 350 | cursorId = 150; | - | ||||||||||||
| 351 | break; | - | ||||||||||||
| 352 | case Qt::IBeamCursor: | - | ||||||||||||
| 353 | cursorId = 152; | - | ||||||||||||
| 354 | break; | - | ||||||||||||
| 355 | case Qt::SizeAllCursor: | - | ||||||||||||
| 356 | cursorId = 52; | - | ||||||||||||
| 357 | break; | - | ||||||||||||
| 358 | case Qt::PointingHandCursor: | - | ||||||||||||
| 359 | cursorId = 60; | - | ||||||||||||
| 360 | break; | - | ||||||||||||
| 361 | case Qt::SizeBDiagCursor: | - | ||||||||||||
| 362 | cursorId = 136; | - | ||||||||||||
| 363 | break; | - | ||||||||||||
| 364 | case Qt::SizeFDiagCursor: | - | ||||||||||||
| 365 | cursorId = 14; | - | ||||||||||||
| 366 | break; | - | ||||||||||||
| 367 | case Qt::SizeVerCursor: | - | ||||||||||||
| 368 | case Qt::SplitVCursor: | - | ||||||||||||
| 369 | cursorId = 116; | - | ||||||||||||
| 370 | break; | - | ||||||||||||
| 371 | case Qt::SizeHorCursor: | - | ||||||||||||
| 372 | case Qt::SplitHCursor: | - | ||||||||||||
| 373 | cursorId = 108; | - | ||||||||||||
| 374 | break; | - | ||||||||||||
| 375 | case Qt::WhatsThisCursor: | - | ||||||||||||
| 376 | cursorId = 92; | - | ||||||||||||
| 377 | break; | - | ||||||||||||
| 378 | case Qt::ForbiddenCursor: | - | ||||||||||||
| 379 | cursorId = 24; | - | ||||||||||||
| 380 | break; | - | ||||||||||||
| 381 | case Qt::BusyCursor: | - | ||||||||||||
| 382 | cursorId = 150; | - | ||||||||||||
| 383 | break; | - | ||||||||||||
| 384 | default: | - | ||||||||||||
| 385 | break; | - | ||||||||||||
| 386 | } | - | ||||||||||||
| 387 | return cursorId; | - | ||||||||||||
| 388 | } | - | ||||||||||||
| 389 | - | |||||||||||||
| 390 | xcb_cursor_t QXcbCursor::createNonStandardCursor(int cshape) | - | ||||||||||||
| 391 | { | - | ||||||||||||
| 392 | xcb_cursor_t cursor = 0; | - | ||||||||||||
| 393 | xcb_connection_t *conn = xcb_connection(); | - | ||||||||||||
| 394 | - | |||||||||||||
| 395 | if (cshape == Qt::BlankCursor) { | - | ||||||||||||
| 396 | xcb_pixmap_t cp = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), cur_blank_bits, 16, 16, | - | ||||||||||||
| 397 | 1, 0, 0, 0); | - | ||||||||||||
| 398 | xcb_pixmap_t mp = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), cur_blank_bits, 16, 16, | - | ||||||||||||
| 399 | 1, 0, 0, 0); | - | ||||||||||||
| 400 | cursor = xcb_generate_id(conn); | - | ||||||||||||
| 401 | xcb_create_cursor(conn, cursor, cp, mp, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, 8, 8); | - | ||||||||||||
| 402 | } else if (cshape >= Qt::SizeVerCursor && cshape < Qt::SizeAllCursor) { | - | ||||||||||||
| 403 | int i = (cshape - Qt::SizeVerCursor) * 2; | - | ||||||||||||
| 404 | xcb_pixmap_t pm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), | - | ||||||||||||
| 405 | const_cast<uint8_t*>(cursor_bits16[i]), | - | ||||||||||||
| 406 | 16, 16, 1, 0, 0, 0); | - | ||||||||||||
| 407 | xcb_pixmap_t pmm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), | - | ||||||||||||
| 408 | const_cast<uint8_t*>(cursor_bits16[i + 1]), | - | ||||||||||||
| 409 | 16, 16, 1, 0, 0, 0); | - | ||||||||||||
| 410 | cursor = xcb_generate_id(conn); | - | ||||||||||||
| 411 | xcb_create_cursor(conn, cursor, pm, pmm, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, 8, 8); | - | ||||||||||||
| 412 | } else if ((cshape >= Qt::SplitVCursor && cshape <= Qt::SplitHCursor) | - | ||||||||||||
| 413 | || cshape == Qt::WhatsThisCursor || cshape == Qt::BusyCursor) { | - | ||||||||||||
| 414 | int i = (cshape - Qt::SplitVCursor) * 2; | - | ||||||||||||
| 415 | xcb_pixmap_t pm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), | - | ||||||||||||
| 416 | const_cast<uint8_t*>(cursor_bits32[i]), | - | ||||||||||||
| 417 | 32, 32, 1, 0, 0, 0); | - | ||||||||||||
| 418 | xcb_pixmap_t pmm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), | - | ||||||||||||
| 419 | const_cast<uint8_t*>(cursor_bits32[i + 1]), | - | ||||||||||||
| 420 | 32, 32, 1, 0, 0, 0); | - | ||||||||||||
| 421 | int hs = (cshape == Qt::PointingHandCursor || cshape == Qt::WhatsThisCursor | - | ||||||||||||
| 422 | || cshape == Qt::BusyCursor) ? 0 : 16; | - | ||||||||||||
| 423 | cursor = xcb_generate_id(conn); | - | ||||||||||||
| 424 | xcb_create_cursor(conn, cursor, pm, pmm, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, hs, hs); | - | ||||||||||||
| 425 | } else if (cshape == Qt::ForbiddenCursor) { | - | ||||||||||||
| 426 | int i = (cshape - Qt::ForbiddenCursor) * 2; | - | ||||||||||||
| 427 | xcb_pixmap_t pm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), | - | ||||||||||||
| 428 | const_cast<uint8_t*>(cursor_bits20[i]), | - | ||||||||||||
| 429 | 20, 20, 1, 0, 0, 0); | - | ||||||||||||
| 430 | xcb_pixmap_t pmm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), | - | ||||||||||||
| 431 | const_cast<uint8_t*>(cursor_bits20[i + 1]), | - | ||||||||||||
| 432 | 20, 20, 1, 0, 0, 0); | - | ||||||||||||
| 433 | cursor = xcb_generate_id(conn); | - | ||||||||||||
| 434 | xcb_create_cursor(conn, cursor, pm, pmm, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, 10, 10); | - | ||||||||||||
| 435 | } else if (cshape == Qt::OpenHandCursor || cshape == Qt::ClosedHandCursor) { | - | ||||||||||||
| 436 | bool open = cshape == Qt::OpenHandCursor; | - | ||||||||||||
| 437 | xcb_pixmap_t pm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), | - | ||||||||||||
| 438 | const_cast<uint8_t*>(open ? openhand_bits : closedhand_bits), | - | ||||||||||||
| 439 | 16, 16, 1, 0, 0, 0); | - | ||||||||||||
| 440 | xcb_pixmap_t pmm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), | - | ||||||||||||
| 441 | const_cast<uint8_t*>(open ? openhandm_bits : closedhandm_bits), | - | ||||||||||||
| 442 | 16, 16, 1, 0, 0, 0); | - | ||||||||||||
| 443 | cursor = xcb_generate_id(conn); | - | ||||||||||||
| 444 | xcb_create_cursor(conn, cursor, pm, pmm, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, 8, 8); | - | ||||||||||||
| 445 | } else if (cshape == Qt::DragCopyCursor || cshape == Qt::DragMoveCursor | - | ||||||||||||
| 446 | || cshape == Qt::DragLinkCursor) { | - | ||||||||||||
| 447 | QImage image = QGuiApplicationPrivate::instance()->getPixmapCursor(static_cast<Qt::CursorShape>(cshape)).toImage(); | - | ||||||||||||
| 448 | if (!image.isNull()) { | - | ||||||||||||
| 449 | xcb_pixmap_t pm = qt_xcb_XPixmapFromBitmap(m_screen, image); | - | ||||||||||||
| 450 | xcb_pixmap_t pmm = qt_xcb_XPixmapFromBitmap(m_screen, image.createAlphaMask()); | - | ||||||||||||
| 451 | cursor = xcb_generate_id(conn); | - | ||||||||||||
| 452 | xcb_create_cursor(conn, cursor, pm, pmm, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, 8, 8); | - | ||||||||||||
| 453 | xcb_free_pixmap(conn, pm); | - | ||||||||||||
| 454 | xcb_free_pixmap(conn, pmm); | - | ||||||||||||
| 455 | } | - | ||||||||||||
| 456 | } | - | ||||||||||||
| 457 | - | |||||||||||||
| 458 | return cursor; | - | ||||||||||||
| 459 | } | - | ||||||||||||
| 460 | - | |||||||||||||
| 461 | - | |||||||||||||
| 462 | bool updateCursorTheme(void *dpy, const QByteArray &theme) { | - | ||||||||||||
| 463 | if (!ptrXcursorLibraryGetTheme | - | ||||||||||||
| 464 | || !ptrXcursorLibrarySetTheme) | - | ||||||||||||
| 465 | return false; | - | ||||||||||||
| 466 | QByteArray oldTheme = ptrXcursorLibraryGetTheme(dpy); | - | ||||||||||||
| 467 | if (oldTheme == theme) | - | ||||||||||||
| 468 | return false; | - | ||||||||||||
| 469 | - | |||||||||||||
| 470 | int setTheme = ptrXcursorLibrarySetTheme(dpy,theme.constData()); | - | ||||||||||||
| 471 | return setTheme; | - | ||||||||||||
| 472 | } | - | ||||||||||||
| 473 | - | |||||||||||||
| 474 | void QXcbCursor::cursorThemePropertyChanged(QXcbVirtualDesktop *screen, const QByteArray &name, const QVariant &property, void *handle) | - | ||||||||||||
| 475 | { | - | ||||||||||||
| 476 | (void)screen;; | - | ||||||||||||
| 477 | (void)name;; | - | ||||||||||||
| 478 | QXcbCursor *self = static_cast<QXcbCursor *>(handle); | - | ||||||||||||
| 479 | updateCursorTheme(self->connection()->xlib_display(),property.toByteArray()); | - | ||||||||||||
| 480 | } | - | ||||||||||||
| 481 | - | |||||||||||||
| 482 | static xcb_cursor_t loadCursor(void *dpy, int cshape) | - | ||||||||||||
| 483 | { | - | ||||||||||||
| 484 | xcb_cursor_t cursor = 0L; | - | ||||||||||||
| 485 | if (!ptrXcursorLibraryLoadCursor || !dpy) | - | ||||||||||||
| 486 | return cursor; | - | ||||||||||||
| 487 | switch (cshape) { | - | ||||||||||||
| 488 | case Qt::DragCopyCursor: | - | ||||||||||||
| 489 | cursor = ptrXcursorLibraryLoadCursor(dpy, "dnd-copy"); | - | ||||||||||||
| 490 | break; | - | ||||||||||||
| 491 | case Qt::DragMoveCursor: | - | ||||||||||||
| 492 | cursor = ptrXcursorLibraryLoadCursor(dpy, "dnd-move"); | - | ||||||||||||
| 493 | break; | - | ||||||||||||
| 494 | case Qt::DragLinkCursor: | - | ||||||||||||
| 495 | cursor = ptrXcursorLibraryLoadCursor(dpy, "dnd-link"); | - | ||||||||||||
| 496 | break; | - | ||||||||||||
| 497 | default: | - | ||||||||||||
| 498 | break; | - | ||||||||||||
| 499 | } | - | ||||||||||||
| 500 | if (!cursor) { | - | ||||||||||||
| 501 | cursor = ptrXcursorLibraryLoadCursor(dpy, cursorNames[cshape]); | - | ||||||||||||
| 502 | } | - | ||||||||||||
| 503 | return cursor; | - | ||||||||||||
| 504 | } | - | ||||||||||||
| 505 | - | |||||||||||||
| 506 | - | |||||||||||||
| 507 | xcb_cursor_t QXcbCursor::createFontCursor(int cshape) | - | ||||||||||||
| 508 | { | - | ||||||||||||
| 509 | xcb_connection_t *conn = xcb_connection(); | - | ||||||||||||
| 510 | int cursorId = cursorIdForShape(cshape); | - | ||||||||||||
| 511 | xcb_cursor_t cursor = 0L; | - | ||||||||||||
| 512 | - | |||||||||||||
| 513 | - | |||||||||||||
| 514 | - | |||||||||||||
| 515 | if (cshape >= 0 && cshape <= Qt::LastCursor) { | - | ||||||||||||
| 516 | void *dpy = connection()->xlib_display(); | - | ||||||||||||
| 517 | - | |||||||||||||
| 518 | cursor = loadCursor(dpy, cshape); | - | ||||||||||||
| 519 | if (!cursor && !m_gtkCursorThemeInitialized && m_screen->xSettings()->initialized()) { | - | ||||||||||||
| 520 | QByteArray gtkCursorTheme = m_screen->xSettings()->setting("Gtk/CursorThemeName").toByteArray(); | - | ||||||||||||
| 521 | m_screen->xSettings()->registerCallbackForProperty("Gtk/CursorThemeName",cursorThemePropertyChanged,this); | - | ||||||||||||
| 522 | if (updateCursorTheme(dpy,gtkCursorTheme)) { | - | ||||||||||||
| 523 | cursor = loadCursor(dpy, cshape); | - | ||||||||||||
| 524 | } | - | ||||||||||||
| 525 | m_gtkCursorThemeInitialized = true; | - | ||||||||||||
| 526 | } | - | ||||||||||||
| 527 | } | - | ||||||||||||
| 528 | if (cursor) | - | ||||||||||||
| 529 | return cursor; | - | ||||||||||||
| 530 | if (!cursor && cursorId) { | - | ||||||||||||
| 531 | cursor = XCreateFontCursor(((Display *)(this->connection()->xlib_display())), cursorId); | - | ||||||||||||
| 532 | if (cursor) | - | ||||||||||||
| 533 | return cursor; | - | ||||||||||||
| 534 | } | - | ||||||||||||
| 535 | - | |||||||||||||
| 536 | - | |||||||||||||
| 537 | - | |||||||||||||
| 538 | - | |||||||||||||
| 539 | cursor = createNonStandardCursor(cshape); | - | ||||||||||||
| 540 | - | |||||||||||||
| 541 | - | |||||||||||||
| 542 | if (!cursor && cursorId) { | - | ||||||||||||
| 543 | cursor = xcb_generate_id(conn); | - | ||||||||||||
| 544 | xcb_create_glyph_cursor(conn, cursor, cursorFont, cursorFont, | - | ||||||||||||
| 545 | cursorId, cursorId + 1, | - | ||||||||||||
| 546 | 0xFFFF, 0xFFFF, 0xFFFF, 0, 0, 0); | - | ||||||||||||
| 547 | } | - | ||||||||||||
| 548 | - | |||||||||||||
| 549 | if (cursor && cshape >= 0 && cshape < Qt::LastCursor && connection()->hasXFixes()) { | - | ||||||||||||
| 550 | const char *name = cursorNames[cshape]; | - | ||||||||||||
| 551 | xcb_xfixes_set_cursor_name(conn, cursor, strlen(name), name); | - | ||||||||||||
| 552 | } | - | ||||||||||||
| 553 | - | |||||||||||||
| 554 | return cursor; | - | ||||||||||||
| 555 | } | - | ||||||||||||
| 556 | - | |||||||||||||
| 557 | xcb_cursor_t QXcbCursor::createBitmapCursor(QCursor *cursor) | - | ||||||||||||
| 558 | { | - | ||||||||||||
| 559 | xcb_connection_t *conn = xcb_connection(); | - | ||||||||||||
| 560 | QPoint spot = cursor->hotSpot(); | - | ||||||||||||
| 561 | xcb_cursor_t c = 0L; | - | ||||||||||||
| 562 | if (cursor->pixmap().depth() > 1) | - | ||||||||||||
| 563 | c = qt_xcb_createCursorXRender(m_screen, cursor->pixmap().toImage(), spot); | - | ||||||||||||
| 564 | if (!c) { | - | ||||||||||||
| 565 | xcb_pixmap_t cp = qt_xcb_XPixmapFromBitmap(m_screen, cursor->bitmap()->toImage()); | - | ||||||||||||
| 566 | xcb_pixmap_t mp = qt_xcb_XPixmapFromBitmap(m_screen, cursor->mask()->toImage()); | - | ||||||||||||
| 567 | c = xcb_generate_id(conn); | - | ||||||||||||
| 568 | xcb_create_cursor(conn, c, cp, mp, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, | - | ||||||||||||
| 569 | spot.x(), spot.y()); | - | ||||||||||||
| 570 | xcb_free_pixmap(conn, cp); | - | ||||||||||||
| 571 | xcb_free_pixmap(conn, mp); | - | ||||||||||||
| 572 | } | - | ||||||||||||
| 573 | return c; | - | ||||||||||||
| 574 | } | - | ||||||||||||
| 575 | - | |||||||||||||
| 576 | - | |||||||||||||
| 577 | void QXcbCursor::queryPointer(QXcbConnection *c, QXcbVirtualDesktop **virtualDesktop, QPoint *pos, int *keybMask) | - | ||||||||||||
| 578 | { | - | ||||||||||||
| 579 |     if (pos
  | 722-15518 | ||||||||||||
| 580 |         * executed 15518 times by 80 tests:  pos = QPoint();*pos = QPoint();Executed by: 
 executed 15518 times by 80 tests:  *pos = QPoint();Executed by: 
  | 15518 | ||||||||||||
| 581 | - | |||||||||||||
| 582 | xcb_window_t root = c->primaryVirtualDesktop()->root(); | - | ||||||||||||
| 583 | xcb_query_pointer_cookie_t cookie = xcb_query_pointer(c->xcb_connection(), root); | - | ||||||||||||
| 584 | xcb_generic_error_t *err = 0; | - | ||||||||||||
| 585 | xcb_query_pointer_reply_t *reply = xcb_query_pointer_reply(c->xcb_connection(), cookie, &err); | - | ||||||||||||
| 586 |     if (!err
 
  | 0-16240 | ||||||||||||
| 587 |         if (virtualDesktop
  | 722-15518 | ||||||||||||
| 588 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(c->const auto virtualDesktops ())>::type> _container_((= c->virtualDesktops())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)(); | - | ||||||||||||
| 589 | for (QXcbVirtualDesktop *vd = *_container_.i; _container_.control; _container_.control = 0: virtualDesktops) { | - | ||||||||||||
| 590 |                 if (vd->root() == reply->root
  | 0-722 | ||||||||||||
| 591 | *virtualDesktop = vd; | - | ||||||||||||
| 592 |                     break; executed 722 times by 27 tests:  break;Executed by: 
  | 722 | ||||||||||||
| 593 | } | - | ||||||||||||
| 594 |             } never executed:  end of block | 0 | ||||||||||||
| 595 |         } executed 722 times by 27 tests:  end of blockExecuted by: 
  | 722 | ||||||||||||
| 596 |         if (pos
  | 722-15518 | ||||||||||||
| 597 |             * executed 15518 times by 80 tests:  pos = QPoint(reply->root_x, reply->root_y);*pos = QPoint(reply->root_x, reply->root_y);Executed by: 
 executed 15518 times by 80 tests:  *pos = QPoint(reply->root_x, reply->root_y);Executed by: 
  | 15518 | ||||||||||||
| 598 |         if (keybMask
  | 0-16240 | ||||||||||||
| 599 |             * never executed:  keybMask = reply->mask;*keybMask = reply->mask;never executed:  *keybMask = reply->mask; | 0 | ||||||||||||
| 600 | free(reply); | - | ||||||||||||
| 601 |         return; executed 16240 times by 83 tests:  return;Executed by: 
  | 16240 | ||||||||||||
| 602 | } | - | ||||||||||||
| 603 | free(err); | - | ||||||||||||
| 604 | free(reply); | - | ||||||||||||
| 605 | } never executed:  end of block | 0 | ||||||||||||
| 606 | - | |||||||||||||
| 607 | QPoint QXcbCursor::pos() const | - | ||||||||||||
| 608 | { | - | ||||||||||||
| 609 | QPoint p; | - | ||||||||||||
| 610 | queryPointer(connection(), 0, &p); | - | ||||||||||||
| 611 | return p; | - | ||||||||||||
| 612 | } | - | ||||||||||||
| 613 | - | |||||||||||||
| 614 | void QXcbCursor::setPos(const QPoint &pos) | - | ||||||||||||
| 615 | { | - | ||||||||||||
| 616 | QXcbVirtualDesktop *virtualDesktop = nullptr; | - | ||||||||||||
| 617 | queryPointer(connection(), &virtualDesktop, 0); | - | ||||||||||||
| 618 | xcb_warp_pointer(xcb_connection(), 0L, virtualDesktop->root(), 0, 0, 0, 0, pos.x(), pos.y()); | - | ||||||||||||
| 619 | xcb_flush(xcb_connection()); | - | ||||||||||||
| 620 | } | - | ||||||||||||
| 621 | - | |||||||||||||
| 622 | - | |||||||||||||
| Switch to Source code | Preprocessed file |