forked from openkylin/ukui-search
使用kysdk接口以解决wayland环境下窗口位置异常问题双标题栏问题.
This commit is contained in:
parent
f346317308
commit
6e0c0d6e73
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include "create-index-ask-dialog.h"
|
#include "create-index-ask-dialog.h"
|
||||||
#include <QPainterPath>
|
#include <QPainterPath>
|
||||||
#include "kwindowsystem.h"
|
#include <KWindowSystem>
|
||||||
|
|
||||||
#define MAIN_SIZE QSize(380, 202)
|
#define MAIN_SIZE QSize(380, 202)
|
||||||
#define MAIN_SPACING 0
|
#define MAIN_SPACING 0
|
||||||
|
|
|
@ -7,7 +7,7 @@ DEFINES += VERSION='\\"$${VERSION}\\"'
|
||||||
TARGET = ukui-search
|
TARGET = ukui-search
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
PKGCONFIG += gio-2.0 glib-2.0 gio-unix-2.0
|
PKGCONFIG += gio-2.0 glib-2.0 gio-unix-2.0 kysdk-waylandhelper
|
||||||
CONFIG += c++11 link_pkgconfig no_keywords lrelease
|
CONFIG += c++11 link_pkgconfig no_keywords lrelease
|
||||||
LIBS += -lxapian -lgsettings-qt -lquazip5 -lX11
|
LIBS += -lxapian -lgsettings-qt -lquazip5 -lX11
|
||||||
#LIBS += -lukui-log4qt
|
#LIBS += -lukui-log4qt
|
||||||
|
|
|
@ -31,10 +31,12 @@
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
||||||
#include <KWindowEffects>
|
#include <KWindowEffects>
|
||||||
#include "kwindowsystem.h"
|
#include <KWindowSystem>
|
||||||
#endif
|
#endif
|
||||||
#include "global-settings.h"
|
|
||||||
#include <QtX11Extras/QX11Info>
|
#include <QtX11Extras/QX11Info>
|
||||||
|
#include "ukuistylehelper/ukuistylehelper.h"
|
||||||
|
#include "windowmanager/windowmanager.h"
|
||||||
|
#include "global-settings.h"
|
||||||
|
|
||||||
#define MAIN_MARGINS 0, 0, 0, 0
|
#define MAIN_MARGINS 0, 0, 0, 0
|
||||||
#define TITLE_MARGINS 0,0,0,0
|
#define TITLE_MARGINS 0,0,0,0
|
||||||
|
@ -150,11 +152,11 @@ void MainWindow::initUi() {
|
||||||
//创建索引询问弹窗
|
//创建索引询问弹窗
|
||||||
m_askDialog = new CreateIndexAskDialog(this);
|
m_askDialog = new CreateIndexAskDialog(this);
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
||||||
MotifWmHints ask_dialog_hints;
|
// MotifWmHints ask_dialog_hints;
|
||||||
ask_dialog_hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
|
// ask_dialog_hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
|
||||||
ask_dialog_hints.functions = MWM_FUNC_ALL;
|
// ask_dialog_hints.functions = MWM_FUNC_ALL;
|
||||||
ask_dialog_hints.decorations = MWM_DECOR_BORDER;
|
// ask_dialog_hints.decorations = MWM_DECOR_BORDER;
|
||||||
XAtomHelper::getInstance()->setWindowMotifHint(m_askDialog->winId(), ask_dialog_hints);
|
// XAtomHelper::getInstance()->setWindowMotifHint(m_askDialog->winId(), ask_dialog_hints);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +194,6 @@ void MainWindow::bootOptionsFilter(QString opt) {
|
||||||
if (this->isHidden()) {
|
if (this->isHidden()) {
|
||||||
clearSearchResult();
|
clearSearchResult();
|
||||||
centerToScreen(this);
|
centerToScreen(this);
|
||||||
this->show();
|
|
||||||
this->m_searchBarWidget->setFocus();
|
this->m_searchBarWidget->setFocus();
|
||||||
this->activateWindow();
|
this->activateWindow();
|
||||||
}
|
}
|
||||||
|
@ -217,7 +218,6 @@ void MainWindow::trayIconActivatedSlot(QSystemTrayIcon::ActivationReason reason)
|
||||||
if(!this->isVisible()) {
|
if(!this->isVisible()) {
|
||||||
clearSearchResult();
|
clearSearchResult();
|
||||||
centerToScreen(this);
|
centerToScreen(this);
|
||||||
this->show();
|
|
||||||
// this->m_searchLineEdit->focusIn(); //打开主界面时输入框夺焦,可直接输入
|
// this->m_searchLineEdit->focusIn(); //打开主界面时输入框夺焦,可直接输入
|
||||||
this->raise();
|
this->raise();
|
||||||
this->activateWindow();
|
this->activateWindow();
|
||||||
|
@ -426,7 +426,12 @@ void MainWindow::centerToScreen(QWidget* widget) {
|
||||||
// desk_x = width;
|
// desk_x = width;
|
||||||
// desk_y = height;
|
// desk_y = height;
|
||||||
// }
|
// }
|
||||||
widget->move(desk_x / 2 - x / 2 + desk_rect.left(), desk_y / 3 + desk_rect.top());
|
widget->show();
|
||||||
|
kdk::WindowManager::setGeometry(this->windowHandle(),QRect(desk_x / 2 - x / 2 + desk_rect.left(),
|
||||||
|
desk_y / 3 + desk_rect.top(),
|
||||||
|
this->width(),
|
||||||
|
this->height()));
|
||||||
|
// widget->move(desk_x / 2 - x / 2 + desk_rect.left(), desk_y / 3 + desk_rect.top());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::initGsettings() {
|
void MainWindow::initGsettings() {
|
||||||
|
@ -465,6 +470,7 @@ void MainWindow::initTimer() {
|
||||||
connect(m_askTimer, &QTimer::timeout, this, [ = ]() {
|
connect(m_askTimer, &QTimer::timeout, this, [ = ]() {
|
||||||
if(this->isVisible()) {
|
if(this->isVisible()) {
|
||||||
m_isAskDialogVisible = true;
|
m_isAskDialogVisible = true;
|
||||||
|
kdk::UkuiStyleHelper::self()->removeHeader(m_askDialog);
|
||||||
m_askDialog->show();
|
m_askDialog->show();
|
||||||
m_currentSearchAsked = true;
|
m_currentSearchAsked = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue