!8 解决wayland窗口状态错误导致开始菜单单例显示隐藏失败问题

This commit is contained in:
lixueman 2022-07-12 08:54:54 +00:00 committed by handsome_feng
parent fd51a285e0
commit fc64d52106
5 changed files with 33 additions and 16 deletions

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
ukui-menu (3.1.1-ok4~0712) yangtze; urgency=medium
* close-cd #128498
修复【wayland】【开始菜单】多次点击tab键和回车键后开始菜单点不开问题
-- lixueman <lixueman@kylinos.cn> Tue, 12 Jul 2022 16:11:49 +0800
ukui-menu (3.1.1-ok4~0708) yangtze; urgency=medium ukui-menu (3.1.1-ok4~0708) yangtze; urgency=medium
* 调整全屏窗口初始化代码结构 * 调整全屏窗口初始化代码结构

View File

@ -350,19 +350,17 @@ void QtSingleApplication::activateWindow()
myDebug() << "单例触发activateWindow"; myDebug() << "单例触发activateWindow";
if (!g_projectCodeName.contains("V10SP1-edu")) { if (!g_projectCodeName.contains("V10SP1-edu")) {
MainWindow *w = qobject_cast<MainWindow *>(actWin); MainWindow *w = qobject_cast<MainWindow *>(actWin);
w->windowOption();
if (this->applicationState() & Qt::ApplicationInactive) { // if (this->applicationState() & Qt::ApplicationInactive) {
myDebug() << "单例内触发开始菜单显示"; // myDebug() << "单例内触发开始菜单显示";
actWin->setWindowState(actWin->windowState() & ~Qt::WindowMinimized); // actWin->setWindowState(actWin->windowState() & ~Qt::WindowMinimized);
// actWin->raise(); // w->showWindow();
// actWin->showNormal(); // } else {
// actWin->activateWindow(); // myDebug() << "单例内触发开始菜单隐藏";
w->showWindow(); // actWin->setWindowState(actWin->windowState() & Qt::WindowMinimized);
} else { // w->hideWindow();
myDebug() << "单例内触发开始菜单隐藏"; // }
actWin->setWindowState(actWin->windowState() & Qt::WindowMinimized);
w->hideWindow();
}
} else { } else {
TabletWindow *w = qobject_cast<TabletWindow *>(actWin); TabletWindow *w = qobject_cast<TabletWindow *>(actWin);
w->showPCMenu(); w->showPCMenu();

View File

@ -63,6 +63,7 @@ void KListView::paintEvent(QPaintEvent *e)
void KListView::mouseMoveEvent(QMouseEvent *e) void KListView::mouseMoveEvent(QMouseEvent *e)
{ {
this->clearFocus(); this->clearFocus();
return QListView::mouseMoveEvent(e);
} }
void KListView::mousePressEvent(QMouseEvent *event) void KListView::mousePressEvent(QMouseEvent *event)

View File

@ -181,7 +181,7 @@ void MainWindow::registDbusServer()
} else { } else {
m_fullWindow->show(); m_fullWindow->show();
setMaxWindowPos(); setMaxWindowPos();
// fullWindow->raise(); m_fullWindow->raise();
m_fullWindow->activateWindow(); m_fullWindow->activateWindow();
} }
} }
@ -506,6 +506,15 @@ void MainWindow::initTabOrder()
setTabOrder(m_minMaxChangeButton, m_powerOffButton); setTabOrder(m_minMaxChangeButton, m_powerOffButton);
} }
void MainWindow::windowOption()
{
if (this->isVisible() || m_fullWindow->isVisible()) {
hideWindow();
} else {
showWindow();
}
}
void MainWindow::initUi() void MainWindow::initUi()
{ {
qDebug() << "init UI"; qDebug() << "init UI";
@ -684,6 +693,7 @@ bool MainWindow::event(QEvent *event)
if (QEvent::WindowDeactivate == event->type()) { //窗口停用 if (QEvent::WindowDeactivate == event->type()) { //窗口停用
if (QApplication::activeWindow() != this) { if (QApplication::activeWindow() != this) {
qDebug() << " * 鼠标点击窗口外部事件"; qDebug() << " * 鼠标点击窗口外部事件";
this->setWindowState(this->windowState() & Qt::WindowMinimized);
this->hide(); this->hide();
m_topStackedWidget->setCurrentIndex(0); m_topStackedWidget->setCurrentIndex(0);
m_lineEdit->clear(); m_lineEdit->clear();
@ -1340,6 +1350,7 @@ void MainWindow::repaintWidget()
m_fullWindow->setFixedSize(width, height); m_fullWindow->setFixedSize(width, height);
m_fullWindow->repaintWidget(); m_fullWindow->repaintWidget();
} }
void MainWindow::showNormalWindowSlot() void MainWindow::showNormalWindowSlot()
{ {
myDebug() << "Style::m_availableScreenWidth" << Style::m_availableScreenWidth << "Style::m_availableScreenHeight" << Style::m_availableScreenHeight; myDebug() << "Style::m_availableScreenWidth" << Style::m_availableScreenWidth << "Style::m_availableScreenHeight" << Style::m_availableScreenHeight;

View File

@ -65,9 +65,7 @@ public:
explicit MainWindow(QWidget *parent = nullptr); explicit MainWindow(QWidget *parent = nullptr);
~MainWindow(); ~MainWindow();
void showWindow(); void windowOption();
void hideWindow();
protected: protected:
void initSearchUi(); void initSearchUi();
@ -81,6 +79,8 @@ protected:
void registDbusServer(); void registDbusServer();
void setTabletModeFlag(); void setTabletModeFlag();
void initUi(); void initUi();
void showWindow();
void hideWindow();
/** /**
* @brief * @brief
* @param event * @param event