[Fix] Title bar will appear if open mainwindow which closed in panel.

This commit is contained in:
iaom 2021-03-26 11:39:08 +08:00
parent 5745682bb0
commit b85c964a04
3 changed files with 17 additions and 7 deletions

View File

@ -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)

View File

@ -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();

View File

@ -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 *);