diff options
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbcursor.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbcursor.cpp | 70 |
1 files changed, 30 insertions, 40 deletions
diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp index bfa3eccdf8..34b7d0d236 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.cpp +++ b/src/plugins/platforms/xcb/qxcbcursor.cpp @@ -255,29 +255,29 @@ static const uint8_t * const cursor_bits20[] = { forbidden_bits, forbiddenm_bits }; -static const char * const cursorNames[] = { - "left_ptr", - "up_arrow", - "cross", - "wait", - "ibeam", - "size_ver", - "size_hor", - "size_bdiag", - "size_fdiag", - "size_all", - "blank", - "split_v", - "split_h", - "pointing_hand", - "forbidden", - "whats_this", - "left_ptr_watch", - "openhand", - "closedhand", - "copy", - "move", - "link" +static const std::vector<const char *> cursorNames[] = { + { "left_ptr", "default", "top_left_arrow", "left_arrow" }, + { "up_arrow" }, + { "cross" }, + { "wait", "watch", "0426c94ea35c87780ff01dc239897213" }, + { "ibeam", "text", "xterm" }, + { "size_ver", "ns-resize", "v_double_arrow", "00008160000006810000408080010102" }, + { "size_hor", "ew-resize", "h_double_arrow", "028006030e0e7ebffc7f7070c0600140" }, + { "size_bdiag", "nesw-resize", "50585d75b494802d0151028115016902", "fcf1c3c7cd4491d801f1e1c78f100000" }, + { "size_fdiag", "nwse-resize", "38c5dff7c7b8962045400281044508d2", "c7088f0f3e6c8088236ef8e1e3e70000" }, + { "size_all" }, + { "blank" }, + { "split_v", "row-resize", "sb_v_double_arrow", "2870a09082c103050810ffdffffe0204", "c07385c7190e701020ff7ffffd08103c" }, + { "split_h", "col-resize", "sb_h_double_arrow", "043a9f68147c53184671403ffa811cc5", "14fef782d02440884392942c11205230" }, + { "pointing_hand", "pointer", "hand1", "e29285e634086352946a0e7090d73106" }, + { "forbidden", "not-allowed", "crossed_circle", "circle", "03b6e0fcb3499374a867c041f52298f0" }, + { "whats_this", "help", "question_arrow", "5c6cd98b3f3ebcb1f9c7f1c204630408", "d9ce0ab605698f320427677b458ad60b" }, + { "left_ptr_watch", "half-busy", "progress", "00000000000000020006000e7e9ffc3f", "08e8e1c95fe2fc01f976f1e063a24ccd" }, + { "openhand", "fleur", "5aca4d189052212118709018842178c0", "9d800788f1b08800ae810202380a0822" }, + { "closedhand", "grabbing", "208530c400c041818281048008011002" }, + { "dnd-copy", "copy" }, + { "dnd-move", "move" }, + { "dnd-link", "link" } }; QXcbCursorCacheKey::QXcbCursorCacheKey(const QCursor &c) @@ -535,22 +535,13 @@ static xcb_cursor_t loadCursor(void *dpy, int cshape) xcb_cursor_t cursor = XCB_NONE; if (!ptrXcursorLibraryLoadCursor || !dpy) return cursor; - switch (cshape) { - case Qt::DragCopyCursor: - cursor = ptrXcursorLibraryLoadCursor(dpy, "dnd-copy"); - break; - case Qt::DragMoveCursor: - cursor = ptrXcursorLibraryLoadCursor(dpy, "dnd-move"); - break; - case Qt::DragLinkCursor: - cursor = ptrXcursorLibraryLoadCursor(dpy, "dnd-link"); - break; - default: - break; - } - if (!cursor) { - cursor = ptrXcursorLibraryLoadCursor(dpy, cursorNames[cshape]); + + for (const char *cursorName: cursorNames[cshape]) { + cursor = ptrXcursorLibraryLoadCursor(dpy, cursorName); + if (cursor != XCB_NONE) + break; } + return cursor; } #endif // QT_CONFIG(xcb_xlib) / QT_CONFIG(library) @@ -565,7 +556,6 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape) #if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) if (cshape >= 0 && cshape <= Qt::LastCursor) { void *dpy = connection()->xlib_display(); - // special case for non-standard dnd-* cursors cursor = loadCursor(dpy, cshape); if (!cursor && !m_gtkCursorThemeInitialized && m_screen->xSettings()->initialized()) { QByteArray gtkCursorTheme = m_screen->xSettings()->setting("Gtk/CursorThemeName").toByteArray(); @@ -598,7 +588,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape) } if (cursor && cshape >= 0 && cshape < Qt::LastCursor && connection()->hasXFixes()) { - const char *name = cursorNames[cshape]; + const char *name = cursorNames[cshape].front(); xcb_xfixes_set_cursor_name(conn, cursor, strlen(name), name); } |