fix: 适配WindowProxy

This commit is contained in:
hewenfei 2024-05-16 15:09:42 +08:00
parent 19e4af733c
commit b355c27af6
1 changed files with 5 additions and 6 deletions

View File

@ -239,8 +239,8 @@ void MenuWindow::init()
//setWindowState(Qt::WindowMaximized); //setWindowState(Qt::WindowMaximized);
setFlags(flags() | Qt::Window | Qt::FramelessWindowHint); setFlags(flags() | Qt::Window | Qt::FramelessWindowHint);
m_windowProxy = new UkuiQuick::WindowProxy(this, UkuiQuick::WindowProxy::SkipSwitcher | UkuiQuick::WindowProxy::SkipTaskBar); m_windowProxy = new UkuiQuick::WindowProxy(this);
KWindowSystem::setType(winId(), NET::SystemWindow); m_windowProxy->setWindowType(UkuiQuick::WindowType::SystemWindow);
// 访问窗口api // 访问窗口api
rootContext()->setContextProperty("mainWindow", this); rootContext()->setContextProperty("mainWindow", this);
@ -295,9 +295,9 @@ void MenuWindow::initPanelSetting()
void MenuWindow::updateGeometry() void MenuWindow::updateGeometry()
{ {
updateCurrentScreenGeometry(); updateCurrentScreenGeometry();
setMinimumSize(m_fullScreenGeometry.size());
setMaximumSize(m_fullScreenGeometry.size());
m_windowProxy->setGeometry(m_fullScreenGeometry); m_windowProxy->setGeometry(m_fullScreenGeometry);
setMinimumSize(geometry().size());
setMaximumSize(geometry().size());
updateGeometryOfMask(); updateGeometryOfMask();
WindowHelper::setRegion(this, m_maskGeometry.x(), m_maskGeometry.y(), m_maskGeometry.width(), m_maskGeometry.height(), 16); WindowHelper::setRegion(this, m_maskGeometry.x(), m_maskGeometry.y(), m_maskGeometry.width(), m_maskGeometry.height(), 16);
@ -354,8 +354,6 @@ void MenuWindow::focusOutEvent(QFocusEvent *event)
bool MenuWindow::event(QEvent *event) bool MenuWindow::event(QEvent *event)
{ {
if (event->type() == QEvent::Show) { if (event->type() == QEvent::Show) {
KWindowSystem::setType(winId(), NET::SystemWindow);
updateGeometry();
if (QX11Info::isPlatformX11()) { if (QX11Info::isPlatformX11()) {
requestActivate(); requestActivate();
} }
@ -485,6 +483,7 @@ void MenuWindow::activeMenuWindow(bool active)
} }
} }
this->setScreen(currrentScreen ? currrentScreen : QGuiApplication::primaryScreen()); this->setScreen(currrentScreen ? currrentScreen : QGuiApplication::primaryScreen());
updateGeometry();
} }
setVisible(active); setVisible(active);