fix(frontend):wlcom环境适配多屏显示功能

This commit is contained in:
iaom 2024-07-24 16:25:27 +08:00
parent f1bff2d584
commit 7153aee119
2 changed files with 6 additions and 3 deletions

View File

@ -15,6 +15,7 @@ find_package(QT NAMES Qt6 Qt5 COMPONENTS Core DBus Widgets Xml Concurrent Sql Li
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core DBus Widgets Xml Concurrent Sql LinguistTools X11Extras REQUIRED)
find_package(PkgConfig REQUIRED)
find_package(KF5WindowSystem)
find_package(ukui-quick COMPONENTS platform REQUIRED)
set(UKUI_SEARCH_EXTERNAL_LIBS "")
set(UKUI_SEARCH_PC_PKGS gio-2.0 glib-2.0 gio-unix-2.0 kysdk-waylandhelper xapian-core gsettings-qt)
@ -97,6 +98,7 @@ target_link_libraries(frontend PRIVATE
kysdk-waylandhelper
qtsingleapplication
tcmalloc_minimal
ukui-quick::platform
)
target_include_directories(frontend PRIVATE

View File

@ -33,8 +33,9 @@
#include <KWindowSystem>
#include <QtX11Extras/QX11Info>
#include <gperftools/malloc_extension.h>
#include "ukuistylehelper/ukuistylehelper.h"
#include "windowmanager/windowmanager.h"
#include <ukuistylehelper/ukuistylehelper.h>
#include <windowmanager/windowmanager.h>
#include <window-helper.h>
#include "global-settings.h"
#include "action-transmiter.h"
#include "icon-loader.h"
@ -268,7 +269,7 @@ void MainWindow::centerToScreen(QWidget* widget) {
if(!widget)
return;
KWindowSystem::setState(this->winId(),NET::SkipTaskbar | NET::SkipPager | NET::SkipSwitcher);
QRect desk_rect = qApp->screenAt(QCursor::pos())->geometry();
QRect desk_rect = UkuiQuick::WindowProxy::currentScreen()->geometry();
int desk_x = desk_rect.width();
int desk_y = desk_rect.height();
int x = widget->width();