void MoveResizeWindow(QWidget *widget, int x, int y, int border_width) { const CornerEdge ce = GetCornerEdge(widget, x, y, border_width); if (ce != CornerEdge::kInvalid) { const int action = CornerEdge2WmGravity(ce); SendMoveResizeMessage(widget, action, Button1); } }
void ResizeWindow(QWidget *widget, QMouseEvent *event, int border_inner_size) { const CornerEdge ce = GetCornerEdge(widget, event->x(), event->y(), border_inner_size); if (ce != CornerEdge::kInvalid) { const int action = CornerEdge2WmGravity(ce); SendMoveResizeMessage(widget, action, Button1); } }
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; } }
bool IsCornerEdget(QWidget *widget, int x, int y, int border_width) { return GetCornerEdge(widget, x, y, border_width) != CornerEdge::kInvalid; }