From fe06c5c91a3e5339c71422581e7cfbd156903927 Mon Sep 17 00:00:00 2001 From: donghualin Date: Mon, 28 Nov 2022 15:58:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dwayland=E4=B8=8B?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=8B=96=E5=8A=A8=E4=BB=BB=E5=8A=A1=E6=A0=8F?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 调用系统的拖动光标的设置 Log: Influence: 进入wayland,鼠标移动到任务栏边缘,观察鼠标形状是否改变,能否正常调整任务栏尺寸 Task: https://pms.uniontech.com/task-view-220523.html Change-Id: Ife47a0d22b62342d10a4ee5113bceef5f0494328 --- frame/window/components/dragwidget.cpp | 31 +------------------------- frame/window/components/dragwidget.h | 3 --- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/frame/window/components/dragwidget.cpp b/frame/window/components/dragwidget.cpp index 38aef59c9..baafb055a 100644 --- a/frame/window/components/dragwidget.cpp +++ b/frame/window/components/dragwidget.cpp @@ -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(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; - } -} diff --git a/frame/window/components/dragwidget.h b/frame/window/components/dragwidget.h index d19f9a2af..81e1f85c1 100644 --- a/frame/window/components/dragwidget.h +++ b/frame/window/components/dragwidget.h @@ -46,9 +46,6 @@ protected: void enterEvent(QEvent *) override; void leaveEvent(QEvent *) override; -private: - void updateCursor(); - private: bool m_dragStatus; QPoint m_resizePoint;