bool UpdateCursorShape(QWidget *widget, int x, int y, int border_width) { const CornerEdge ce = GetCornerEdge(widget, x, y, border_width); const XCursorType x_cursor = CornerEdge2XCursor(ce); if (x_cursor != XCursorType::kInvalid) { return SetCursorShape(widget, static_cast<unsigned int>(x_cursor)); } else { ResetCursorShape(widget); return false; } }
bool UpdateCursorShape(QWidget* widget, int x, int y, int border_inner_size) { const CornerEdge ce = GetCornerEdge(widget, x, y, border_inner_size); const auto display = QX11Info::display(); const WId window_id = widget->winId(); const XCursorType x_cursor = CornerEdge2XCursor(ce); const Cursor cursor = XCreateFontCursor(display, static_cast<unsigned int>(x_cursor)); if (!cursor) { return false; qWarning() << "[ui]::UpdateCursorShape() call XCreateFontCursor() " << "failed!"; } const int result = XDefineCursor(display, window_id, cursor); if (result){ if (ce != CornerEdge::kInvalid){ return true; }else{ return false; } }else{ return false; } }