mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +00:00
fix: 修复wayland下无法拖动任务栏的问题
调用系统的拖动光标的设置 Log: Influence: 进入wayland,鼠标移动到任务栏边缘,观察鼠标形状是否改变,能否正常调整任务栏尺寸 Task: https://pms.uniontech.com/task-view-220523.html Change-Id: Ife47a0d22b62342d10a4ee5113bceef5f0494328
This commit is contained in:
parent
7ad0475c6d
commit
fe06c5c91a
@ -86,10 +86,7 @@ void DragWidget::mouseReleaseEvent(QMouseEvent *)
|
||||
|
||||
void DragWidget::enterEvent(QEvent *)
|
||||
{
|
||||
if (Utils::IS_WAYLAND_DISPLAY)
|
||||
updateCursor();
|
||||
else
|
||||
QApplication::setOverrideCursor(cursor());
|
||||
QApplication::setOverrideCursor(cursor());
|
||||
}
|
||||
|
||||
void DragWidget::leaveEvent(QEvent *)
|
||||
@ -97,29 +94,3 @@ void DragWidget::leaveEvent(QEvent *)
|
||||
QApplication::setOverrideCursor(Qt::ArrowCursor);
|
||||
}
|
||||
|
||||
void DragWidget::updateCursor()
|
||||
{
|
||||
QString theme = Utils::SettingValue("com.deepin.xsettings", "/com/deepin/xsettings/", "gtk-cursor-theme-name", "bloom").toString();
|
||||
int cursorSize = Utils::SettingValue("com.deepin.xsettings", "/com/deepin/xsettings/", "gtk-cursor-theme-size", 24).toInt();
|
||||
Dock::Position position = static_cast<Dock::Position>(qApp->property("position").toInt());
|
||||
|
||||
static QString lastTheme;
|
||||
static int lastPosition = -1;
|
||||
static int lastCursorSize = -1;
|
||||
if (theme != lastTheme || position != lastPosition || cursorSize != lastCursorSize) {
|
||||
lastTheme = theme;
|
||||
lastPosition = position;
|
||||
lastCursorSize = cursorSize;
|
||||
const char* cursorName = (position == Dock::Position::Bottom || position == Dock::Position::Top) ? "v_double_arrow" : "h_double_arrow";
|
||||
QCursor *newCursor = ImageUtil::loadQCursorFromX11Cursor(theme.toStdString().c_str(), cursorName, cursorSize);
|
||||
if (!newCursor)
|
||||
return;
|
||||
|
||||
setCursor(*newCursor);
|
||||
static QCursor *lastCursor = nullptr;
|
||||
if (lastCursor)
|
||||
delete lastCursor;
|
||||
|
||||
lastCursor = newCursor;
|
||||
}
|
||||
}
|
||||
|
@ -46,9 +46,6 @@ protected:
|
||||
void enterEvent(QEvent *) override;
|
||||
void leaveEvent(QEvent *) override;
|
||||
|
||||
private:
|
||||
void updateCursor();
|
||||
|
||||
private:
|
||||
bool m_dragStatus;
|
||||
QPoint m_resizePoint;
|
||||
|
Loading…
x
Reference in New Issue
Block a user