From b85c964a049cdb88dda934f98ef49da2c985c7fa Mon Sep 17 00:00:00 2001 From: iaom <18504285112@163.com> Date: Fri, 26 Mar 2021 11:39:08 +0800 Subject: [PATCH] [Fix] Title bar will appear if open mainwindow which closed in panel. --- src/main.cpp | 14 +++++++------- src/mainwindow.cpp | 8 ++++++++ src/mainwindow.h | 2 ++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 4759246..a0c35ac 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -35,7 +35,6 @@ //#include "inotify-manager.h" #include "libsearch.h" #include "global-settings.h" -#include "xatom-helper.h" //void handler(int){ @@ -248,17 +247,18 @@ int main(int argc, char *argv[]) w->moveToPanel(); //使用窗管的无边框策略 - w->setProperty("useStyleWindowManager", false); //禁用拖动 - MotifWmHints hints; - hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS; - hints.functions = MWM_FUNC_ALL; - hints.decorations = MWM_DECOR_BORDER; - XAtomHelper::getInstance()->setWindowMotifHint(w->winId(), hints); +// w->setProperty("useStyleWindowManager", false); //禁用拖动 +// MotifWmHints hints; +// hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS; +// hints.functions = MWM_FUNC_ALL; +// hints.decorations = MWM_DECOR_BORDER; +// XAtomHelper::getInstance()->setWindowMotifHint(w->winId(), hints); app.setActivationWindow(w); if (QString::compare(QString("-s"), QString(QLatin1String(argv[1]))) == 0) { w->moveToPanel(); + XAtomHelper::getInstance()->setWindowMotifHint(w->winId(), w->m_hints); w->show(); } // if(arguments.size()>1) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 3af87c9..1df0d8d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -75,6 +75,12 @@ MainWindow::MainWindow(QWidget *parent) : this->setWindowTitle(tr("ukui-search")); initUi(); + setProperty("useStyleWindowManager", false); + m_hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS; + m_hints.functions = MWM_FUNC_ALL; + m_hints.decorations = MWM_DECOR_BORDER; + XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); + QPainterPath path; auto rect = this->rect(); rect.adjust(1, 1, -1, -1); @@ -131,6 +137,7 @@ MainWindow::MainWindow(QWidget *parent) : if (!this->isVisible()) { clearSearchResult(); this->moveToPanel(); + XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); this->show(); this->m_searchLayout->focusIn(); //打开主界面时输入框夺焦,可直接输入 this->raise(); @@ -266,6 +273,7 @@ void MainWindow::bootOptionsFilter(QString opt) if (opt == "-s" || opt == "--show") { clearSearchResult(); this->moveToPanel(); + XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); this->show(); this->m_searchLayout->focusIn(); this->raise(); diff --git a/src/mainwindow.h b/src/mainwindow.h index 19d0a9a..33a565b 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -49,6 +49,7 @@ #include "settings-widget.h" #include "libsearch.h" #include "search-app-thread.h" +#include "xatom-helper.h" class SearchResult; class MainWindow : public QMainWindow @@ -64,6 +65,7 @@ public: */ void searchContent(QString searchcontent); void moveToPanel(); + MotifWmHints m_hints; private: bool nativeEvent(const QByteArray&, void *, long *);