Skip to content

Commit

Permalink
fix: Info widget flicking on wayland
Browse files Browse the repository at this point in the history
Wayland 下默认动画和应用动画重叠,同时可能导致
wayland 未正确取得控件信息,显示花屏,调整应用
动画在 wayland 动画后.
* 尝试首次展示降低动画时间,或展示后show()刷新
  效果不佳,控件重叠

Log: Info widget flicking on wayland
Bug: https://pms.uniontech.com/bug-view-242125.html
  • Loading branch information
rb-union committed Feb 6, 2024
1 parent a874ed0 commit 0421c68
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 137 deletions.
3 changes: 3 additions & 0 deletions libimageviewer/imageviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ ImageViewerPrivate::ImageViewerPrivate(imageViewerSpace::ImgViewerType imgViewer
ImageViewer *parent)
: q_ptr(parent)
{
// 初始化检测wayland环境
Libutils::base::initCheckWaylandEnv();

// 在界面前初始化授权配置
if (!qApp) {
qWarning() << qPrintable("Must init authorise config after QApplication initialized!");
Expand Down
18 changes: 14 additions & 4 deletions libimageviewer/unionimage/baseutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,22 +491,32 @@ bool checkCommandExist(const QString &command)
}
}

static bool g_IsWaylandEnv = false;
/**
@brief 判断当前是否为 wayland 环境
@brief 初始化判断当前是否为 wayland 环境,并缓存状态
*/
bool checkWayland()
bool initCheckWaylandEnv()
{
auto e = QProcessEnvironment::systemEnvironment();
QString XDG_SESSION_TYPE = e.value(QStringLiteral("XDG_SESSION_TYPE"));
QString WAYLAND_DISPLAY = e.value(QStringLiteral("WAYLAND_DISPLAY"));

if (XDG_SESSION_TYPE == QLatin1String("wayland") || WAYLAND_DISPLAY.contains(QLatin1String("wayland"), Qt::CaseInsensitive))
if (XDG_SESSION_TYPE == QLatin1String("wayland") || WAYLAND_DISPLAY.contains(QLatin1String("wayland"), Qt::CaseInsensitive)) {
g_IsWaylandEnv = true;
return true;
else {
} else {
return false;
}
}

/**
@return 返回当前是否为 wayland 环境
*/
bool checkWayland()
{
return g_IsWaylandEnv;
}

} // namespace base

} // namespace utils
1 change: 1 addition & 0 deletions libimageviewer/unionimage/baseutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ bool mountDeviceExist(const QString &path);
bool checkCommandExist(const QString &command);
//bool isCommandExist(const QString &command);

bool initCheckWaylandEnv();
bool checkWayland();
} // namespace base

Expand Down
Loading

0 comments on commit 0421c68

Please sign in to comment.