2017-09-18 14:33:44 +08:00
|
|
|
|
/*
|
2018-02-07 11:52:47 +08:00
|
|
|
|
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
2017-09-18 14:33:44 +08:00
|
|
|
|
*
|
|
|
|
|
* Author: sbw <sbw@sbw.so>
|
|
|
|
|
*
|
|
|
|
|
* Maintainer: sbw <sbw@sbw.so>
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2016-06-02 09:46:43 +08:00
|
|
|
|
#include "mainwindow.h"
|
2019-08-16 17:44:57 +08:00
|
|
|
|
#include "panel/mainpanelcontrol.h"
|
2019-08-19 13:40:06 +08:00
|
|
|
|
#include "controller/dockitemmanager.h"
|
2019-04-23 14:28:09 +08:00
|
|
|
|
#include "util/utils.h"
|
2016-06-02 09:46:43 +08:00
|
|
|
|
|
|
|
|
|
#include <QDebug>
|
2017-12-11 12:02:54 +08:00
|
|
|
|
#include <QEvent>
|
2016-06-02 15:43:57 +08:00
|
|
|
|
#include <QResizeEvent>
|
2017-02-28 11:31:48 +08:00
|
|
|
|
#include <QScreen>
|
|
|
|
|
#include <QGuiApplication>
|
2018-02-22 11:44:57 +08:00
|
|
|
|
#include <QX11Info>
|
2017-11-13 21:17:56 +08:00
|
|
|
|
#include <qpa/qplatformwindow.h>
|
2019-09-03 09:36:33 +08:00
|
|
|
|
#include <DStyle>
|
2017-03-21 15:40:52 +08:00
|
|
|
|
#include <DPlatformWindowHandle>
|
2016-06-02 09:46:43 +08:00
|
|
|
|
|
2017-06-08 15:38:11 +08:00
|
|
|
|
#include <X11/X.h>
|
|
|
|
|
#include <X11/Xutil.h>
|
|
|
|
|
|
2019-01-15 19:54:13 +08:00
|
|
|
|
#define SNI_WATCHER_SERVICE "org.kde.StatusNotifierWatcher"
|
|
|
|
|
#define SNI_WATCHER_PATH "/StatusNotifierWatcher"
|
|
|
|
|
|
2019-08-26 16:15:50 +08:00
|
|
|
|
#define MAINWINDOW_MAX_SIZE (100)
|
|
|
|
|
#define MAINWINDOW_MIN_SIZE (40)
|
2019-09-05 11:19:11 +08:00
|
|
|
|
#define DRAG_AREA_SIZE (5)
|
2019-08-26 16:15:50 +08:00
|
|
|
|
|
2019-01-15 19:54:13 +08:00
|
|
|
|
using org::kde::StatusNotifierWatcher;
|
|
|
|
|
|
2019-09-05 11:19:11 +08:00
|
|
|
|
class DragWidget : public QWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool m_dragStatus;
|
|
|
|
|
QPoint m_resizePoint;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
DragWidget(QWidget *parent) : QWidget(parent)
|
|
|
|
|
{
|
|
|
|
|
m_dragStatus = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void dragPointOffset(QPoint);
|
|
|
|
|
void dragFinished();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void mousePressEvent(QMouseEvent *event) override
|
|
|
|
|
{
|
|
|
|
|
if (event->button() == Qt::LeftButton) {
|
|
|
|
|
m_resizePoint = event->globalPos();
|
|
|
|
|
m_dragStatus = true;
|
|
|
|
|
this->grabMouse();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mouseMoveEvent(QMouseEvent *event) override
|
|
|
|
|
{
|
|
|
|
|
if (m_dragStatus) {
|
|
|
|
|
QPoint offset = QPoint(QCursor::pos() - m_resizePoint);
|
|
|
|
|
emit dragPointOffset(offset);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mouseReleaseEvent(QMouseEvent *event) override
|
|
|
|
|
{
|
|
|
|
|
if (!m_dragStatus)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
m_dragStatus = false;
|
|
|
|
|
releaseMouse();
|
|
|
|
|
emit dragFinished();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2017-11-14 14:20:04 +08:00
|
|
|
|
const QPoint rawXPosition(const QPoint &scaledPos)
|
|
|
|
|
{
|
2019-08-19 13:40:06 +08:00
|
|
|
|
QScreen const *screen = Utils::screenAtByScaled(scaledPos);
|
2019-04-23 14:28:09 +08:00
|
|
|
|
|
|
|
|
|
return screen ? screen->geometry().topLeft() +
|
2019-08-19 13:40:06 +08:00
|
|
|
|
(scaledPos - screen->geometry().topLeft()) *
|
|
|
|
|
screen->devicePixelRatio()
|
|
|
|
|
: scaledPos;
|
2017-11-14 14:20:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-12-29 15:54:46 +08:00
|
|
|
|
const QPoint scaledPos(const QPoint &rawXPos)
|
|
|
|
|
{
|
2019-08-19 13:40:06 +08:00
|
|
|
|
QScreen const *screen = Utils::screenAt(rawXPos);
|
2019-04-23 14:28:09 +08:00
|
|
|
|
|
|
|
|
|
return screen
|
2019-08-19 13:40:06 +08:00
|
|
|
|
? screen->geometry().topLeft() +
|
|
|
|
|
(rawXPos - screen->geometry().topLeft()) / screen->devicePixelRatio()
|
|
|
|
|
: rawXPos;
|
2017-12-29 15:54:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-02 09:46:43 +08:00
|
|
|
|
MainWindow::MainWindow(QWidget *parent)
|
2019-08-22 13:52:02 +08:00
|
|
|
|
: DBlurEffectWidget(parent),
|
2016-08-12 14:28:35 +08:00
|
|
|
|
|
2017-12-05 13:08:17 +08:00
|
|
|
|
m_launched(false),
|
|
|
|
|
m_updatePanelVisible(false),
|
2016-08-12 14:28:35 +08:00
|
|
|
|
|
2019-08-30 11:41:52 +08:00
|
|
|
|
m_mainPanel(new MainPanelControl(this)),
|
|
|
|
|
|
2017-03-27 15:36:37 +08:00
|
|
|
|
m_platformWindowHandle(this),
|
2017-05-11 10:10:32 +08:00
|
|
|
|
m_wmHelper(DWindowManagerHelper::instance()),
|
2017-03-21 15:40:52 +08:00
|
|
|
|
|
2016-06-23 20:05:03 +08:00
|
|
|
|
m_positionUpdateTimer(new QTimer(this)),
|
2016-08-18 16:06:40 +08:00
|
|
|
|
m_expandDelayTimer(new QTimer(this)),
|
2018-01-02 16:48:01 +08:00
|
|
|
|
m_leaveDelayTimer(new QTimer(this)),
|
2017-12-05 13:08:17 +08:00
|
|
|
|
m_shadowMaskOptimizeTimer(new QTimer(this)),
|
|
|
|
|
|
2017-07-04 14:58:11 +08:00
|
|
|
|
m_sizeChangeAni(new QVariantAnimation(this)),
|
2017-11-13 21:17:56 +08:00
|
|
|
|
m_posChangeAni(new QVariantAnimation(this)),
|
2019-08-23 16:18:21 +08:00
|
|
|
|
m_panelShowAni(new QPropertyAnimation(this, "pos")),
|
|
|
|
|
m_panelHideAni(new QPropertyAnimation(this, "pos")),
|
2019-01-15 19:54:13 +08:00
|
|
|
|
m_xcbMisc(XcbMisc::instance()),
|
|
|
|
|
m_dbusDaemonInterface(QDBusConnection::sessionBus().interface()),
|
2019-08-26 16:15:50 +08:00
|
|
|
|
m_sniWatcher(new StatusNotifierWatcher(SNI_WATCHER_SERVICE, SNI_WATCHER_PATH, QDBusConnection::sessionBus(), this)),
|
2019-09-05 11:19:11 +08:00
|
|
|
|
m_dragWidget(new DragWidget(this))
|
2016-06-02 09:46:43 +08:00
|
|
|
|
{
|
2016-08-01 13:40:48 +08:00
|
|
|
|
setAccessibleName("dock-mainwindow");
|
2016-06-03 16:06:11 +08:00
|
|
|
|
setAttribute(Qt::WA_TranslucentBackground);
|
2018-10-31 11:34:25 +08:00
|
|
|
|
setMouseTracking(true);
|
2017-07-04 14:34:38 +08:00
|
|
|
|
setAcceptDrops(true);
|
2016-06-03 16:06:11 +08:00
|
|
|
|
|
2018-03-15 11:14:24 +08:00
|
|
|
|
DPlatformWindowHandle::enableDXcbForWindow(this, true);
|
2019-08-23 16:18:21 +08:00
|
|
|
|
m_platformWindowHandle.setEnableBlurWindow(true);
|
2017-03-27 15:36:37 +08:00
|
|
|
|
m_platformWindowHandle.setTranslucentBackground(true);
|
|
|
|
|
m_platformWindowHandle.setWindowRadius(0);
|
|
|
|
|
m_platformWindowHandle.setBorderWidth(0);
|
|
|
|
|
m_platformWindowHandle.setShadowOffset(QPoint(0, 0));
|
2017-12-05 18:49:48 +08:00
|
|
|
|
m_platformWindowHandle.setShadowRadius(0);
|
2017-03-21 15:40:52 +08:00
|
|
|
|
|
2018-07-30 15:12:51 +08:00
|
|
|
|
m_settings = &DockSettings::Instance();
|
2016-06-15 11:09:34 +08:00
|
|
|
|
m_xcbMisc->set_window_type(winId(), XcbMisc::Dock);
|
2019-08-26 16:15:50 +08:00
|
|
|
|
m_size = m_settings->m_mainWindowSize;
|
2019-08-30 11:41:52 +08:00
|
|
|
|
m_mainPanel->setDisplayMode(m_settings->displayMode());
|
2019-01-15 19:54:13 +08:00
|
|
|
|
initSNIHost();
|
2016-06-06 10:59:29 +08:00
|
|
|
|
initComponents();
|
|
|
|
|
initConnections();
|
2016-06-23 10:24:51 +08:00
|
|
|
|
|
2019-08-26 16:15:50 +08:00
|
|
|
|
resizeMainPanelWindow();
|
2019-08-19 13:40:06 +08:00
|
|
|
|
|
2019-08-29 20:21:36 +08:00
|
|
|
|
m_mainPanel->setDelegate(this);
|
2019-08-19 13:40:06 +08:00
|
|
|
|
for (auto item : DockItemManager::instance()->itemList())
|
2019-08-19 15:17:56 +08:00
|
|
|
|
m_mainPanel->insertItem(-1, item);
|
2019-09-05 11:19:11 +08:00
|
|
|
|
|
|
|
|
|
m_dragWidget->setMouseTracking(true);
|
|
|
|
|
m_dragWidget->setFocusPolicy(Qt::NoFocus);
|
|
|
|
|
|
|
|
|
|
if ((Top == m_settings->position()) || (Bottom == m_settings->position())) {
|
|
|
|
|
m_dragWidget->setCursor(Qt::SizeVerCursor);
|
|
|
|
|
} else {
|
|
|
|
|
m_dragWidget->setCursor(Qt::SizeHorCursor);
|
|
|
|
|
}
|
2016-06-02 09:46:43 +08:00
|
|
|
|
}
|
2016-06-02 15:43:57 +08:00
|
|
|
|
|
2016-06-15 11:09:34 +08:00
|
|
|
|
MainWindow::~MainWindow()
|
|
|
|
|
{
|
|
|
|
|
delete m_xcbMisc;
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-05 13:08:17 +08:00
|
|
|
|
void MainWindow::launch()
|
|
|
|
|
{
|
2017-12-12 15:03:02 +08:00
|
|
|
|
m_updatePanelVisible = false;
|
2017-12-13 16:34:39 +08:00
|
|
|
|
m_mainPanel->setVisible(false);
|
|
|
|
|
resetPanelEnvironment(false);
|
2017-12-12 15:03:02 +08:00
|
|
|
|
setVisible(false);
|
2017-12-05 13:08:17 +08:00
|
|
|
|
|
|
|
|
|
QTimer::singleShot(400, this, [&] {
|
|
|
|
|
m_launched = true;
|
2017-12-13 16:34:39 +08:00
|
|
|
|
m_mainPanel->setVisible(true);
|
2017-12-05 13:08:17 +08:00
|
|
|
|
resetPanelEnvironment(false);
|
|
|
|
|
updateGeometry();
|
|
|
|
|
expand();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// set strut
|
|
|
|
|
QTimer::singleShot(600, this, [&] {
|
|
|
|
|
setStrutPartial();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// reset to right environment when animation finished
|
|
|
|
|
QTimer::singleShot(800, this, [&] {
|
|
|
|
|
m_updatePanelVisible = true;
|
|
|
|
|
updatePanelVisible();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
qApp->processEvents();
|
2019-06-28 16:58:31 +08:00
|
|
|
|
QTimer::singleShot(300, this, &MainWindow::show);
|
2017-12-05 13:08:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-12-11 12:02:54 +08:00
|
|
|
|
bool MainWindow::event(QEvent *e)
|
|
|
|
|
{
|
2019-08-19 13:40:06 +08:00
|
|
|
|
switch (e->type()) {
|
2017-12-11 12:02:54 +08:00
|
|
|
|
case QEvent::Move:
|
|
|
|
|
if (!e->spontaneous())
|
|
|
|
|
QTimer::singleShot(1, this, &MainWindow::positionCheck);
|
|
|
|
|
break;
|
|
|
|
|
default:;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return QWidget::event(e);
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-01 14:23:53 +08:00
|
|
|
|
void MainWindow::showEvent(QShowEvent *e)
|
|
|
|
|
{
|
|
|
|
|
QWidget::showEvent(e);
|
|
|
|
|
|
2019-08-23 16:18:21 +08:00
|
|
|
|
// m_platformWindowHandle.setEnableBlurWindow(false);
|
2018-02-01 14:23:53 +08:00
|
|
|
|
m_platformWindowHandle.setShadowOffset(QPoint());
|
|
|
|
|
m_platformWindowHandle.setShadowRadius(0);
|
2019-03-29 14:38:12 +08:00
|
|
|
|
|
|
|
|
|
connect(qGuiApp, &QGuiApplication::primaryScreenChanged,
|
2019-08-19 13:40:06 +08:00
|
|
|
|
windowHandle(), [this](QScreen * new_screen) {
|
2019-03-29 14:38:12 +08:00
|
|
|
|
QScreen *old_screen = windowHandle()->screen();
|
|
|
|
|
windowHandle()->setScreen(new_screen);
|
|
|
|
|
// 屏幕变化后可能导致控件缩放比变化,此时应该重设控件位置大小
|
|
|
|
|
// 比如:窗口大小为 100 x 100, 显示在缩放比为 1.0 的屏幕上,此时窗口的真实大小 = 100x100
|
|
|
|
|
// 随后窗口被移动到了缩放比为 2.0 的屏幕上,应该将真实大小改为 200x200。另外,只能使用
|
|
|
|
|
// QPlatformWindow直接设置大小来绕过QWidget和QWindow对新旧geometry的比较。
|
|
|
|
|
const qreal scale = devicePixelRatioF();
|
|
|
|
|
const QPoint screenPos = new_screen->geometry().topLeft();
|
|
|
|
|
const QPoint posInScreen = this->pos() - old_screen->geometry().topLeft();
|
|
|
|
|
const QPoint pos = screenPos + posInScreen * scale;
|
|
|
|
|
const QSize size = this->size() * scale;
|
|
|
|
|
|
|
|
|
|
windowHandle()->handle()->setGeometry(QRect(pos, size));
|
|
|
|
|
}, Qt::UniqueConnection);
|
|
|
|
|
|
|
|
|
|
windowHandle()->setScreen(qGuiApp->primaryScreen());
|
2018-02-01 14:23:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-21 14:02:51 +08:00
|
|
|
|
void MainWindow::mousePressEvent(QMouseEvent *e)
|
|
|
|
|
{
|
|
|
|
|
e->ignore();
|
2019-08-30 15:54:19 +08:00
|
|
|
|
if (e->button() == Qt::RightButton) {
|
2016-06-21 14:02:51 +08:00
|
|
|
|
m_settings->showDockSettingsMenu();
|
2019-08-30 15:54:19 +08:00
|
|
|
|
return;
|
|
|
|
|
}
|
2016-06-21 14:02:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-03 16:06:11 +08:00
|
|
|
|
void MainWindow::keyPressEvent(QKeyEvent *e)
|
|
|
|
|
{
|
2019-08-19 13:40:06 +08:00
|
|
|
|
switch (e->key()) {
|
2016-06-03 16:06:11 +08:00
|
|
|
|
#ifdef QT_DEBUG
|
|
|
|
|
case Qt::Key_Escape: qApp->quit(); break;
|
|
|
|
|
#endif
|
|
|
|
|
default:;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-29 16:53:37 +08:00
|
|
|
|
void MainWindow::enterEvent(QEvent *e)
|
|
|
|
|
{
|
|
|
|
|
QWidget::enterEvent(e);
|
|
|
|
|
|
2018-01-02 16:48:01 +08:00
|
|
|
|
m_leaveDelayTimer->stop();
|
|
|
|
|
if (m_settings->hideState() != Show && m_panelShowAni->state() != QPropertyAnimation::Running)
|
2016-08-18 16:06:40 +08:00
|
|
|
|
m_expandDelayTimer->start();
|
2016-06-29 16:53:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::leaveEvent(QEvent *e)
|
|
|
|
|
{
|
|
|
|
|
QWidget::leaveEvent(e);
|
2016-08-18 16:06:40 +08:00
|
|
|
|
m_expandDelayTimer->stop();
|
2018-01-02 16:48:01 +08:00
|
|
|
|
m_leaveDelayTimer->start();
|
2016-06-29 16:53:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-07-04 14:34:38 +08:00
|
|
|
|
void MainWindow::dragEnterEvent(QDragEnterEvent *e)
|
|
|
|
|
{
|
|
|
|
|
QWidget::dragEnterEvent(e);
|
|
|
|
|
|
2018-11-05 11:26:20 +08:00
|
|
|
|
if (m_settings->hideState() != Show) {
|
2017-07-04 14:34:38 +08:00
|
|
|
|
m_expandDelayTimer->start();
|
2018-11-05 11:26:20 +08:00
|
|
|
|
}
|
2017-07-04 14:34:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-23 20:05:03 +08:00
|
|
|
|
void MainWindow::setFixedSize(const QSize &size)
|
|
|
|
|
{
|
2017-06-15 09:10:29 +08:00
|
|
|
|
const QPropertyAnimation::State state = m_sizeChangeAni->state();
|
2016-07-18 17:10:15 +08:00
|
|
|
|
|
|
|
|
|
if (state == QPropertyAnimation::Stopped && this->size() == size)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (state == QPropertyAnimation::Running)
|
2016-06-23 20:05:03 +08:00
|
|
|
|
return m_sizeChangeAni->setEndValue(size);
|
|
|
|
|
|
|
|
|
|
m_sizeChangeAni->setStartValue(this->size());
|
|
|
|
|
m_sizeChangeAni->setEndValue(size);
|
|
|
|
|
m_sizeChangeAni->start();
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-13 21:17:56 +08:00
|
|
|
|
void MainWindow::internalAnimationMove(int x, int y)
|
2016-06-23 20:05:03 +08:00
|
|
|
|
{
|
2016-07-18 17:10:15 +08:00
|
|
|
|
const QPropertyAnimation::State state = m_posChangeAni->state();
|
2017-07-14 14:05:35 +08:00
|
|
|
|
const QPoint p = m_posChangeAni->endValue().toPoint();
|
2017-06-08 15:38:11 +08:00
|
|
|
|
const QPoint tp = QPoint(x, y);
|
2016-07-18 17:10:15 +08:00
|
|
|
|
|
2017-06-08 15:38:11 +08:00
|
|
|
|
if (state == QPropertyAnimation::Stopped && p == tp)
|
2016-06-29 18:30:25 +08:00
|
|
|
|
return;
|
|
|
|
|
|
2018-10-29 18:07:15 +08:00
|
|
|
|
if (state == QPropertyAnimation::Running && p != tp)
|
2017-11-13 21:17:56 +08:00
|
|
|
|
return m_posChangeAni->setEndValue(QPoint(x, y));
|
2016-06-23 20:05:03 +08:00
|
|
|
|
|
2017-07-14 14:05:35 +08:00
|
|
|
|
m_posChangeAni->setStartValue(pos());
|
2017-06-08 15:38:11 +08:00
|
|
|
|
m_posChangeAni->setEndValue(tp);
|
2016-06-23 20:05:03 +08:00
|
|
|
|
m_posChangeAni->start();
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-15 19:54:13 +08:00
|
|
|
|
void MainWindow::initSNIHost()
|
|
|
|
|
{
|
|
|
|
|
// registor dock as SNI Host on dbus
|
|
|
|
|
QDBusConnection dbusConn = QDBusConnection::sessionBus();
|
|
|
|
|
m_sniHostService = QString("org.kde.StatusNotifierHost-") + QString::number(qApp->applicationPid());
|
|
|
|
|
dbusConn.registerService(m_sniHostService);
|
|
|
|
|
dbusConn.registerObject("/StatusNotifierHost", this);
|
|
|
|
|
|
|
|
|
|
if (m_sniWatcher->isValid()) {
|
|
|
|
|
m_sniWatcher->RegisterStatusNotifierHost(m_sniHostService);
|
|
|
|
|
} else {
|
|
|
|
|
qDebug() << SNI_WATCHER_SERVICE << "SNI watcher daemon is not exist for now!";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-06 10:59:29 +08:00
|
|
|
|
void MainWindow::initComponents()
|
|
|
|
|
{
|
|
|
|
|
m_positionUpdateTimer->setSingleShot(true);
|
2016-06-30 18:02:09 +08:00
|
|
|
|
m_positionUpdateTimer->setInterval(20);
|
2016-06-06 10:59:29 +08:00
|
|
|
|
m_positionUpdateTimer->start();
|
2016-06-23 20:05:03 +08:00
|
|
|
|
|
2016-08-18 16:06:40 +08:00
|
|
|
|
m_expandDelayTimer->setSingleShot(true);
|
2016-09-06 11:31:03 +08:00
|
|
|
|
m_expandDelayTimer->setInterval(m_settings->expandTimeout());
|
2016-08-18 16:06:40 +08:00
|
|
|
|
|
2018-01-02 16:48:01 +08:00
|
|
|
|
m_leaveDelayTimer->setSingleShot(true);
|
|
|
|
|
m_leaveDelayTimer->setInterval(m_settings->narrowTimeout());
|
|
|
|
|
|
2017-12-05 13:08:17 +08:00
|
|
|
|
m_shadowMaskOptimizeTimer->setSingleShot(true);
|
|
|
|
|
m_shadowMaskOptimizeTimer->setInterval(100);
|
|
|
|
|
|
2016-06-30 19:32:52 +08:00
|
|
|
|
m_sizeChangeAni->setEasingCurve(QEasingCurve::InOutCubic);
|
|
|
|
|
m_posChangeAni->setEasingCurve(QEasingCurve::InOutCubic);
|
|
|
|
|
m_panelShowAni->setEasingCurve(QEasingCurve::InOutCubic);
|
|
|
|
|
m_panelHideAni->setEasingCurve(QEasingCurve::InOutCubic);
|
2017-05-22 10:38:49 +08:00
|
|
|
|
|
|
|
|
|
QTimer::singleShot(1, this, &MainWindow::compositeChanged);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::compositeChanged()
|
|
|
|
|
{
|
2018-01-12 14:32:57 +08:00
|
|
|
|
const bool composite = m_wmHelper->hasComposite();
|
2019-06-25 15:13:44 +08:00
|
|
|
|
|
|
|
|
|
// NOTE(justforlxz): On the sw platform, there is an unstable
|
|
|
|
|
// display position error, disable animation solution
|
|
|
|
|
#ifndef DISABLE_SHOW_ANIMATION
|
2018-01-12 14:32:57 +08:00
|
|
|
|
const int duration = composite ? 300 : 0;
|
2019-06-25 15:13:44 +08:00
|
|
|
|
#else
|
|
|
|
|
const int duration = 0;
|
|
|
|
|
#endif
|
2017-05-22 10:38:49 +08:00
|
|
|
|
|
|
|
|
|
m_sizeChangeAni->setDuration(duration);
|
|
|
|
|
m_posChangeAni->setDuration(duration);
|
|
|
|
|
m_panelShowAni->setDuration(duration);
|
|
|
|
|
m_panelHideAni->setDuration(duration);
|
2018-11-15 17:06:51 +08:00
|
|
|
|
|
2019-08-22 13:52:02 +08:00
|
|
|
|
setComposite(composite);
|
2017-07-07 10:26:27 +08:00
|
|
|
|
|
2018-01-12 14:32:57 +08:00
|
|
|
|
m_shadowMaskOptimizeTimer->start();
|
2018-02-05 17:03:02 +08:00
|
|
|
|
m_positionUpdateTimer->start();
|
2016-06-06 10:59:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-11-23 12:21:00 +08:00
|
|
|
|
void MainWindow::internalMove(const QPoint &p)
|
2017-11-13 21:17:56 +08:00
|
|
|
|
{
|
2018-10-31 11:34:25 +08:00
|
|
|
|
const bool isHide = m_settings->hideState() == HideState::Hide && !testAttribute(Qt::WA_UnderMouse);
|
2017-11-23 17:49:37 +08:00
|
|
|
|
const bool pos_adjust = m_settings->hideMode() != HideMode::KeepShowing &&
|
2019-08-19 13:40:06 +08:00
|
|
|
|
isHide &&
|
|
|
|
|
m_posChangeAni->state() == QVariantAnimation::Stopped;
|
2017-11-23 17:49:37 +08:00
|
|
|
|
if (!pos_adjust)
|
|
|
|
|
return QWidget::move(p);
|
|
|
|
|
|
2017-11-14 14:20:04 +08:00
|
|
|
|
QPoint rp = rawXPosition(p);
|
2017-11-23 17:49:37 +08:00
|
|
|
|
const auto ratio = devicePixelRatioF();
|
2017-11-13 21:17:56 +08:00
|
|
|
|
|
2017-11-23 17:49:37 +08:00
|
|
|
|
const QRect &r = m_settings->primaryRawRect();
|
2019-08-19 13:40:06 +08:00
|
|
|
|
switch (m_settings->position()) {
|
2017-11-23 17:49:37 +08:00
|
|
|
|
case Left: rp.setX(r.x()); break;
|
|
|
|
|
case Top: rp.setY(r.y()); break;
|
|
|
|
|
case Right: rp.setX(r.right() - 1); break;
|
|
|
|
|
case Bottom: rp.setY(r.bottom() - 1); break;
|
2017-11-13 21:17:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-11-17 10:58:18 +08:00
|
|
|
|
int hx = height() * ratio, wx = width() * ratio;
|
2017-11-13 21:17:56 +08:00
|
|
|
|
if (m_settings->hideMode() != HideMode::KeepShowing &&
|
2019-08-19 13:40:06 +08:00
|
|
|
|
isHide &&
|
|
|
|
|
m_panelHideAni->state() == QVariantAnimation::Stopped &&
|
|
|
|
|
m_panelShowAni->state() == QVariantAnimation::Stopped) {
|
|
|
|
|
switch (m_settings->position()) {
|
2017-11-16 16:04:59 +08:00
|
|
|
|
case Top:
|
|
|
|
|
case Bottom:
|
2017-11-17 10:58:18 +08:00
|
|
|
|
hx = 2;
|
2017-11-16 16:04:59 +08:00
|
|
|
|
break;
|
|
|
|
|
case Left:
|
|
|
|
|
case Right:
|
2017-11-17 10:58:18 +08:00
|
|
|
|
wx = 2;
|
2017-11-16 16:04:59 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-11-13 21:17:56 +08:00
|
|
|
|
|
2018-03-19 11:33:16 +08:00
|
|
|
|
// using platform window to set real window position
|
2017-11-16 16:04:59 +08:00
|
|
|
|
windowHandle()->handle()->setGeometry(QRect(rp.x(), rp.y(), wx, hx));
|
2017-11-13 21:17:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-06 10:59:29 +08:00
|
|
|
|
void MainWindow::initConnections()
|
|
|
|
|
{
|
2016-06-21 15:11:32 +08:00
|
|
|
|
connect(m_settings, &DockSettings::dataChanged, m_positionUpdateTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
|
2017-12-11 12:02:54 +08:00
|
|
|
|
connect(m_settings, &DockSettings::positionChanged, this, &MainWindow::positionChanged);
|
2018-11-09 14:45:57 +08:00
|
|
|
|
connect(m_settings, &DockSettings::autoHideChanged, m_leaveDelayTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
|
2018-11-22 16:50:22 +08:00
|
|
|
|
connect(m_settings, &DockSettings::windowGeometryChanged, this, &MainWindow::updateGeometry, Qt::DirectConnection);
|
2016-06-29 18:30:25 +08:00
|
|
|
|
connect(m_settings, &DockSettings::windowHideModeChanged, this, &MainWindow::setStrutPartial, Qt::QueuedConnection);
|
2017-01-12 18:38:06 +08:00
|
|
|
|
connect(m_settings, &DockSettings::windowHideModeChanged, [this] { resetPanelEnvironment(true); });
|
2018-11-09 14:45:57 +08:00
|
|
|
|
connect(m_settings, &DockSettings::windowHideModeChanged, m_leaveDelayTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
|
2017-02-07 00:18:00 +08:00
|
|
|
|
connect(m_settings, &DockSettings::windowVisibleChanged, this, &MainWindow::updatePanelVisible, Qt::QueuedConnection);
|
2018-03-06 14:30:23 +08:00
|
|
|
|
connect(m_settings, &DockSettings::displayModeChanegd, m_positionUpdateTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
|
2019-08-22 13:52:02 +08:00
|
|
|
|
connect(&DockSettings::Instance(), &DockSettings::opacityChanged, this, &MainWindow::setMaskAlpha);
|
2019-08-28 11:37:19 +08:00
|
|
|
|
connect(m_settings, &DockSettings::displayModeChanegd, this, &MainWindow::updateDisplayMode, Qt::QueuedConnection);
|
2019-08-16 17:44:57 +08:00
|
|
|
|
// connect(m_mainPanel, &MainPanelControl::requestRefershWindowVisible, this, &MainWindow::updatePanelVisible, Qt::QueuedConnection);
|
|
|
|
|
// connect(m_mainPanel, &MainPanelControl::requestWindowAutoHide, m_settings, &DockSettings::setAutoHide);
|
|
|
|
|
// connect(m_mainPanel, &MainPanelControl::geometryChanged, this, &MainWindow::panelGeometryChanged);
|
2016-06-30 15:32:18 +08:00
|
|
|
|
|
2016-06-29 18:30:25 +08:00
|
|
|
|
connect(m_positionUpdateTimer, &QTimer::timeout, this, &MainWindow::updatePosition, Qt::QueuedConnection);
|
2016-08-18 16:06:40 +08:00
|
|
|
|
connect(m_expandDelayTimer, &QTimer::timeout, this, &MainWindow::expand, Qt::QueuedConnection);
|
2018-01-02 16:48:01 +08:00
|
|
|
|
connect(m_leaveDelayTimer, &QTimer::timeout, this, &MainWindow::updatePanelVisible, Qt::QueuedConnection);
|
2017-12-14 15:25:54 +08:00
|
|
|
|
connect(m_shadowMaskOptimizeTimer, &QTimer::timeout, this, &MainWindow::adjustShadowMask, Qt::QueuedConnection);
|
2016-06-30 09:37:13 +08:00
|
|
|
|
|
2016-06-30 18:02:09 +08:00
|
|
|
|
connect(m_panelHideAni, &QPropertyAnimation::finished, this, &MainWindow::updateGeometry, Qt::QueuedConnection);
|
2017-12-14 15:25:54 +08:00
|
|
|
|
connect(m_panelHideAni, &QPropertyAnimation::finished, m_shadowMaskOptimizeTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
|
|
|
|
|
connect(m_panelShowAni, &QPropertyAnimation::finished, m_shadowMaskOptimizeTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
|
2017-11-23 12:21:00 +08:00
|
|
|
|
connect(m_posChangeAni, &QVariantAnimation::valueChanged, this, static_cast<void (MainWindow::*)()>(&MainWindow::internalMove));
|
|
|
|
|
connect(m_posChangeAni, &QVariantAnimation::finished, this, static_cast<void (MainWindow::*)()>(&MainWindow::internalMove), Qt::QueuedConnection);
|
2016-06-30 18:02:09 +08:00
|
|
|
|
|
2018-11-15 17:06:51 +08:00
|
|
|
|
// to fix qt animation bug, sometimes window size not change
|
2019-08-19 13:40:06 +08:00
|
|
|
|
connect(m_sizeChangeAni, &QVariantAnimation::valueChanged, [ = ](const QVariant & value) {
|
2018-11-15 17:06:51 +08:00
|
|
|
|
QWidget::setFixedSize(value.toSize());
|
2016-06-30 09:37:13 +08:00
|
|
|
|
});
|
2016-10-14 15:47:43 +08:00
|
|
|
|
|
2017-11-13 21:17:56 +08:00
|
|
|
|
connect(m_wmHelper, &DWindowManagerHelper::hasCompositeChanged, this, &MainWindow::compositeChanged, Qt::QueuedConnection);
|
2017-12-14 15:25:54 +08:00
|
|
|
|
connect(&m_platformWindowHandle, &DPlatformWindowHandle::frameMarginsChanged, m_shadowMaskOptimizeTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
|
2019-01-15 19:54:13 +08:00
|
|
|
|
|
|
|
|
|
connect(m_dbusDaemonInterface, &QDBusConnectionInterface::serviceOwnerChanged, this, &MainWindow::onDbusNameOwnerChanged);
|
2019-08-19 13:40:06 +08:00
|
|
|
|
|
2019-08-19 15:17:56 +08:00
|
|
|
|
connect(DockItemManager::instance(), &DockItemManager::itemInserted, m_mainPanel, &MainPanelControl::insertItem, Qt::DirectConnection);
|
|
|
|
|
connect(DockItemManager::instance(), &DockItemManager::itemRemoved, m_mainPanel, &MainPanelControl::removeItem, Qt::DirectConnection);
|
2019-08-21 14:07:24 +08:00
|
|
|
|
connect(DockItemManager::instance(), &DockItemManager::requestRefershWindowVisible, this, &MainWindow::updatePanelVisible, Qt::QueuedConnection);
|
|
|
|
|
connect(DockItemManager::instance(), &DockItemManager::requestWindowAutoHide, m_settings, &DockSettings::setAutoHide);
|
2019-08-21 12:52:53 +08:00
|
|
|
|
connect(m_mainPanel, &MainPanelControl::itemMoved, DockItemManager::instance(), &DockItemManager::itemMoved, Qt::DirectConnection);
|
2019-08-29 20:21:36 +08:00
|
|
|
|
connect(m_mainPanel, &MainPanelControl::itemAdded, DockItemManager::instance(), &DockItemManager::itemAdded, Qt::DirectConnection);
|
2019-09-05 11:19:11 +08:00
|
|
|
|
connect(m_dragWidget, &DragWidget::dragPointOffset, this, &MainWindow::onMainWindowSizeChanged);
|
|
|
|
|
connect(m_dragWidget, &DragWidget::dragFinished, this, &MainWindow::onDragFinished);
|
2017-06-08 15:38:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const QPoint MainWindow::x11GetWindowPos()
|
|
|
|
|
{
|
|
|
|
|
const auto disp = QX11Info::display();
|
|
|
|
|
|
|
|
|
|
unsigned int unused;
|
|
|
|
|
int x;
|
|
|
|
|
int y;
|
|
|
|
|
Window unused_window;
|
|
|
|
|
|
|
|
|
|
XGetGeometry(disp, winId(), &unused_window, &x, &y, &unused, &unused, &unused, &unused);
|
|
|
|
|
XFlush(disp);
|
|
|
|
|
|
|
|
|
|
return QPoint(x, y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::x11MoveWindow(const int x, const int y)
|
|
|
|
|
{
|
|
|
|
|
const auto disp = QX11Info::display();
|
|
|
|
|
|
|
|
|
|
XMoveWindow(disp, winId(), x, y);
|
|
|
|
|
XFlush(disp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::x11MoveResizeWindow(const int x, const int y, const int w, const int h)
|
|
|
|
|
{
|
|
|
|
|
const auto disp = QX11Info::display();
|
2016-10-14 15:47:43 +08:00
|
|
|
|
|
2017-06-08 15:38:11 +08:00
|
|
|
|
XMoveResizeWindow(disp, winId(), x, y, w, h);
|
|
|
|
|
XFlush(disp);
|
2016-06-06 10:59:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
2016-08-12 14:28:35 +08:00
|
|
|
|
void MainWindow::positionChanged(const Position prevPos)
|
|
|
|
|
{
|
|
|
|
|
// paly hide animation and disable other animation
|
|
|
|
|
m_updatePanelVisible = false;
|
|
|
|
|
clearStrutPartial();
|
|
|
|
|
narrow(prevPos);
|
|
|
|
|
|
|
|
|
|
// reset position & layout and slide out
|
2018-01-04 17:22:37 +08:00
|
|
|
|
QTimer::singleShot(200, this, [&] {
|
2018-01-03 13:24:20 +08:00
|
|
|
|
resetPanelEnvironment(false, true);
|
2016-08-12 14:28:35 +08:00
|
|
|
|
updateGeometry();
|
2019-08-23 16:18:21 +08:00
|
|
|
|
// expand();
|
2016-08-12 14:28:35 +08:00
|
|
|
|
});
|
|
|
|
|
|
2016-08-12 16:32:03 +08:00
|
|
|
|
// set strut
|
2016-08-12 14:28:35 +08:00
|
|
|
|
QTimer::singleShot(400, this, [&] {
|
|
|
|
|
setStrutPartial();
|
2016-08-12 16:32:03 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// reset to right environment when animation finished
|
|
|
|
|
QTimer::singleShot(600, this, [&] {
|
|
|
|
|
m_updatePanelVisible = true;
|
2016-08-12 14:28:35 +08:00
|
|
|
|
updatePanelVisible();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-03 16:06:11 +08:00
|
|
|
|
void MainWindow::updatePosition()
|
|
|
|
|
{
|
2016-06-22 10:28:47 +08:00
|
|
|
|
// all update operation need pass by timer
|
2016-06-16 16:56:21 +08:00
|
|
|
|
Q_ASSERT(sender() == m_positionUpdateTimer);
|
|
|
|
|
|
2016-06-15 11:09:34 +08:00
|
|
|
|
clearStrutPartial();
|
2016-06-22 10:28:47 +08:00
|
|
|
|
updateGeometry();
|
2017-06-15 09:10:29 +08:00
|
|
|
|
|
|
|
|
|
// make sure strut partial is set after the size/position animation;
|
2018-03-14 16:08:42 +08:00
|
|
|
|
const int duration = qMax(m_sizeChangeAni->duration(), m_posChangeAni->duration());
|
|
|
|
|
|
|
|
|
|
QTimer::singleShot(duration, this, &MainWindow::setStrutPartial);
|
|
|
|
|
QTimer::singleShot(duration, this, &MainWindow::updatePanelVisible);
|
2016-06-22 10:28:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::updateGeometry()
|
|
|
|
|
{
|
2016-06-29 16:53:37 +08:00
|
|
|
|
const Position position = m_settings->position();
|
2016-07-18 17:10:15 +08:00
|
|
|
|
QSize size = m_settings->windowSize();
|
2016-06-23 20:05:03 +08:00
|
|
|
|
|
2018-11-19 17:40:29 +08:00
|
|
|
|
// DockDisplayMode and DockPosition MUST be set before invoke setFixedSize method of MainPanel
|
2019-08-16 17:44:57 +08:00
|
|
|
|
// m_mainPanel->updateDockDisplayMode(m_settings->displayMode());
|
2019-09-03 10:22:27 +08:00
|
|
|
|
m_mainPanel->setPositonValue(position);
|
2019-02-23 00:42:41 +08:00
|
|
|
|
// this->setFixedSize has been overridden for size animation
|
2019-08-26 16:15:50 +08:00
|
|
|
|
resizeMainPanelWindow();
|
2018-10-31 18:03:56 +08:00
|
|
|
|
|
2017-11-13 21:17:56 +08:00
|
|
|
|
bool animation = true;
|
2018-10-31 11:34:25 +08:00
|
|
|
|
bool isHide = m_settings->hideState() == Hide && !testAttribute(Qt::WA_UnderMouse);
|
2017-11-13 21:17:56 +08:00
|
|
|
|
|
2018-11-15 17:06:51 +08:00
|
|
|
|
if (isHide) {
|
2016-06-29 16:53:37 +08:00
|
|
|
|
m_sizeChangeAni->stop();
|
2016-06-30 18:02:09 +08:00
|
|
|
|
m_posChangeAni->stop();
|
2018-11-15 17:06:51 +08:00
|
|
|
|
switch (position) {
|
2016-06-29 16:53:37 +08:00
|
|
|
|
case Top:
|
2017-11-13 21:17:56 +08:00
|
|
|
|
case Bottom: size.setHeight(2); break;
|
2016-06-29 16:53:37 +08:00
|
|
|
|
case Left:
|
2017-11-13 21:17:56 +08:00
|
|
|
|
case Right: size.setWidth(2); break;
|
2016-06-29 16:53:37 +08:00
|
|
|
|
}
|
2017-11-13 21:17:56 +08:00
|
|
|
|
animation = false;
|
|
|
|
|
m_sizeChangeAni->setEndValue(size);
|
2016-06-29 16:53:37 +08:00
|
|
|
|
QWidget::setFixedSize(size);
|
2018-11-15 17:06:51 +08:00
|
|
|
|
} else {
|
2019-02-23 00:42:41 +08:00
|
|
|
|
// this->setFixedSize has been overridden for size animation
|
2018-11-22 16:50:22 +08:00
|
|
|
|
setFixedSize(size);
|
2016-06-30 09:37:13 +08:00
|
|
|
|
}
|
2016-06-29 16:53:37 +08:00
|
|
|
|
|
2018-10-31 11:34:25 +08:00
|
|
|
|
const QRect windowRect = m_settings->windowRect(position, isHide);
|
2017-12-11 12:02:54 +08:00
|
|
|
|
|
2017-11-13 21:17:56 +08:00
|
|
|
|
if (animation)
|
|
|
|
|
internalAnimationMove(windowRect.x(), windowRect.y());
|
|
|
|
|
else
|
2017-11-23 12:21:00 +08:00
|
|
|
|
internalMove(windowRect.topLeft());
|
2017-11-13 21:17:56 +08:00
|
|
|
|
|
2019-08-30 10:41:39 +08:00
|
|
|
|
m_size = m_settings->m_mainWindowSize;
|
|
|
|
|
|
2016-06-30 09:37:13 +08:00
|
|
|
|
m_mainPanel->update();
|
2018-03-06 14:30:23 +08:00
|
|
|
|
m_shadowMaskOptimizeTimer->start();
|
2019-09-05 11:19:11 +08:00
|
|
|
|
|
|
|
|
|
if ((Top == m_settings->position()) || (Bottom == m_settings->position())) {
|
|
|
|
|
m_dragWidget->setCursor(Qt::SizeVerCursor);
|
|
|
|
|
} else {
|
|
|
|
|
m_dragWidget->setCursor(Qt::SizeHorCursor);
|
|
|
|
|
}
|
2016-06-15 11:09:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::clearStrutPartial()
|
|
|
|
|
{
|
|
|
|
|
m_xcbMisc->clear_strut_partial(winId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::setStrutPartial()
|
|
|
|
|
{
|
2016-06-15 11:20:05 +08:00
|
|
|
|
// first, clear old strut partial
|
|
|
|
|
clearStrutPartial();
|
|
|
|
|
|
2017-07-14 14:05:35 +08:00
|
|
|
|
// reset env
|
|
|
|
|
resetPanelEnvironment(true);
|
|
|
|
|
|
2016-06-29 16:53:37 +08:00
|
|
|
|
if (m_settings->hideMode() != Dock::KeepShowing)
|
|
|
|
|
return;
|
|
|
|
|
|
2017-11-14 14:20:04 +08:00
|
|
|
|
const auto ratio = devicePixelRatioF();
|
|
|
|
|
const int maxScreenHeight = m_settings->screenRawHeight();
|
|
|
|
|
const int maxScreenWidth = m_settings->screenRawWidth();
|
2016-06-21 10:12:43 +08:00
|
|
|
|
const Position side = m_settings->position();
|
2017-11-28 14:27:16 +08:00
|
|
|
|
const QPoint &p = rawXPosition(m_posChangeAni->endValue().toPoint());
|
|
|
|
|
const QSize &s = m_settings->windowSize();
|
|
|
|
|
const QRect &primaryRawRect = m_settings->primaryRawRect();
|
2016-06-15 11:09:34 +08:00
|
|
|
|
|
2016-06-29 16:53:37 +08:00
|
|
|
|
XcbMisc::Orientation orientation = XcbMisc::OrientationTop;
|
|
|
|
|
uint strut = 0;
|
|
|
|
|
uint strutStart = 0;
|
|
|
|
|
uint strutEnd = 0;
|
2016-06-15 11:09:34 +08:00
|
|
|
|
|
2017-02-28 11:31:48 +08:00
|
|
|
|
QRect strutArea(0, 0, maxScreenWidth, maxScreenHeight);
|
2019-08-19 13:40:06 +08:00
|
|
|
|
switch (side) {
|
2016-06-21 10:12:43 +08:00
|
|
|
|
case Position::Top:
|
2016-06-15 11:09:34 +08:00
|
|
|
|
orientation = XcbMisc::OrientationTop;
|
2017-11-14 14:20:04 +08:00
|
|
|
|
strut = p.y() + s.height() * ratio;
|
|
|
|
|
strutStart = p.x();
|
2017-11-28 14:27:16 +08:00
|
|
|
|
strutEnd = qMin(qRound(p.x() + s.width() * ratio), primaryRawRect.right());
|
2017-02-28 11:31:48 +08:00
|
|
|
|
strutArea.setLeft(strutStart);
|
|
|
|
|
strutArea.setRight(strutEnd);
|
2017-11-14 14:20:04 +08:00
|
|
|
|
strutArea.setBottom(strut);
|
2016-06-15 11:09:34 +08:00
|
|
|
|
break;
|
2016-06-21 10:12:43 +08:00
|
|
|
|
case Position::Bottom:
|
2016-06-15 11:09:34 +08:00
|
|
|
|
orientation = XcbMisc::OrientationBottom;
|
|
|
|
|
strut = maxScreenHeight - p.y();
|
2017-11-14 14:20:04 +08:00
|
|
|
|
strutStart = p.x();
|
2017-11-28 14:27:16 +08:00
|
|
|
|
strutEnd = qMin(qRound(p.x() + s.width() * ratio), primaryRawRect.right());
|
2017-02-28 11:31:48 +08:00
|
|
|
|
strutArea.setLeft(strutStart);
|
|
|
|
|
strutArea.setRight(strutEnd);
|
|
|
|
|
strutArea.setTop(p.y());
|
2016-06-15 11:09:34 +08:00
|
|
|
|
break;
|
2016-06-21 10:12:43 +08:00
|
|
|
|
case Position::Left:
|
2016-06-15 11:09:34 +08:00
|
|
|
|
orientation = XcbMisc::OrientationLeft;
|
2017-11-14 14:20:04 +08:00
|
|
|
|
strut = p.x() + s.width() * ratio;
|
|
|
|
|
strutStart = p.y();
|
2017-11-28 14:27:16 +08:00
|
|
|
|
strutEnd = qMin(qRound(p.y() + s.height() * ratio), primaryRawRect.bottom());
|
2017-11-14 14:20:04 +08:00
|
|
|
|
strutArea.setTop(strutStart);
|
|
|
|
|
strutArea.setBottom(strutEnd);
|
|
|
|
|
strutArea.setRight(strut);
|
2016-06-15 11:09:34 +08:00
|
|
|
|
break;
|
2016-06-21 10:12:43 +08:00
|
|
|
|
case Position::Right:
|
2016-06-15 11:09:34 +08:00
|
|
|
|
orientation = XcbMisc::OrientationRight;
|
2017-11-14 14:20:04 +08:00
|
|
|
|
strut = maxScreenWidth - p.x();
|
|
|
|
|
strutStart = p.y();
|
2017-11-28 14:27:16 +08:00
|
|
|
|
strutEnd = qMin(qRound(p.y() + s.height() * ratio), primaryRawRect.bottom());
|
2017-11-14 14:20:04 +08:00
|
|
|
|
strutArea.setTop(strutStart);
|
|
|
|
|
strutArea.setBottom(strutEnd);
|
|
|
|
|
strutArea.setLeft(p.x());
|
2016-06-15 11:09:34 +08:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
Q_ASSERT(false);
|
|
|
|
|
}
|
2017-02-28 11:31:48 +08:00
|
|
|
|
|
2017-11-14 14:20:04 +08:00
|
|
|
|
qDebug() << "screen info: " << p << strutArea;
|
|
|
|
|
|
2017-02-28 11:31:48 +08:00
|
|
|
|
// pass if strut area is intersect with other screen
|
|
|
|
|
int count = 0;
|
2017-03-03 17:30:11 +08:00
|
|
|
|
const QRect pr = m_settings->primaryRect();
|
2019-08-19 13:40:06 +08:00
|
|
|
|
for (auto *screen : qApp->screens()) {
|
2017-03-03 17:30:11 +08:00
|
|
|
|
const QRect sr = screen->geometry();
|
|
|
|
|
if (sr == pr)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (sr.intersects(strutArea))
|
2017-02-28 11:31:48 +08:00
|
|
|
|
++count;
|
2017-03-03 17:30:11 +08:00
|
|
|
|
}
|
2019-08-19 13:40:06 +08:00
|
|
|
|
if (count > 0) {
|
2017-11-28 14:27:16 +08:00
|
|
|
|
qWarning() << "strutArea is intersects with another screen.";
|
|
|
|
|
qWarning() << maxScreenHeight << maxScreenWidth << side << p << s;
|
2017-02-28 11:31:48 +08:00
|
|
|
|
return;
|
2017-11-28 14:27:16 +08:00
|
|
|
|
}
|
2017-02-28 11:31:48 +08:00
|
|
|
|
|
2019-08-23 16:58:13 +08:00
|
|
|
|
m_xcbMisc->set_strut_partial(winId(), orientation, strut + m_settings->dockMargin(), strutStart, strutEnd);
|
2016-06-03 16:06:11 +08:00
|
|
|
|
}
|
2016-06-29 16:53:37 +08:00
|
|
|
|
|
|
|
|
|
void MainWindow::expand()
|
|
|
|
|
{
|
2018-01-02 16:48:01 +08:00
|
|
|
|
qApp->processEvents();
|
|
|
|
|
|
|
|
|
|
const auto showAniState = m_panelShowAni->state();
|
|
|
|
|
m_panelHideAni->stop();
|
|
|
|
|
|
2019-08-23 16:18:21 +08:00
|
|
|
|
QPoint finishPos = pos();
|
|
|
|
|
QPoint startPos = pos();
|
2016-06-29 18:30:25 +08:00
|
|
|
|
|
2018-01-02 16:48:01 +08:00
|
|
|
|
resetPanelEnvironment(true, false);
|
2017-11-07 11:53:39 +08:00
|
|
|
|
|
2019-08-23 16:18:21 +08:00
|
|
|
|
if (showAniState != QPropertyAnimation::Running && pos() != m_panelShowAni->currentValue()) {
|
|
|
|
|
const Position position = m_settings->position();
|
|
|
|
|
const QRectF windowRect = m_settings->windowRect(position, true);
|
|
|
|
|
|
2019-08-19 13:40:06 +08:00
|
|
|
|
switch (m_settings->position()) {
|
2019-08-23 16:18:21 +08:00
|
|
|
|
case Top:
|
|
|
|
|
startPos.setY(-size().height());
|
|
|
|
|
finishPos.setY(windowRect.top());
|
|
|
|
|
break;
|
|
|
|
|
case Bottom:
|
|
|
|
|
startPos.setY(windowRect.bottom());
|
|
|
|
|
finishPos.setY(windowRect.bottom() - size().height());
|
|
|
|
|
break;
|
|
|
|
|
case Left:
|
|
|
|
|
startPos.setX(-size().width());
|
|
|
|
|
finishPos.setX(windowRect.left());
|
|
|
|
|
break;
|
|
|
|
|
case Right:
|
|
|
|
|
startPos.setX(windowRect.right());
|
|
|
|
|
finishPos.setX(windowRect.right() - size().width());
|
|
|
|
|
break;
|
2017-11-13 21:17:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_panelShowAni->setStartValue(startPos);
|
2018-01-02 16:48:01 +08:00
|
|
|
|
m_panelShowAni->setEndValue(finishPos);
|
|
|
|
|
m_panelShowAni->start();
|
2018-01-04 16:56:25 +08:00
|
|
|
|
m_shadowMaskOptimizeTimer->start();
|
|
|
|
|
m_platformWindowHandle.setShadowRadius(0);
|
2016-06-29 16:53:37 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-12 14:28:35 +08:00
|
|
|
|
void MainWindow::narrow(const Position prevPos)
|
2016-06-29 16:53:37 +08:00
|
|
|
|
{
|
2019-08-23 16:18:21 +08:00
|
|
|
|
QPoint finishPos = pos();
|
2019-08-19 13:40:06 +08:00
|
|
|
|
switch (prevPos) {
|
2019-08-23 16:18:21 +08:00
|
|
|
|
case Top: finishPos.setY(pos().y() - size().height()); break;
|
|
|
|
|
case Bottom: finishPos.setY(pos().y() + size().height()); break;
|
|
|
|
|
case Left: finishPos.setX(pos().x() - size().width()); break;
|
|
|
|
|
case Right: finishPos.setX(pos().x() + size().width()); break;
|
2016-06-29 16:53:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_panelShowAni->stop();
|
2019-08-23 16:18:21 +08:00
|
|
|
|
m_panelHideAni->setStartValue(pos());
|
2016-06-29 16:53:37 +08:00
|
|
|
|
m_panelHideAni->setEndValue(finishPos);
|
|
|
|
|
m_panelHideAni->start();
|
2018-01-04 16:56:25 +08:00
|
|
|
|
m_platformWindowHandle.setShadowRadius(0);
|
2016-06-29 16:53:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-02 16:48:01 +08:00
|
|
|
|
void MainWindow::resetPanelEnvironment(const bool visible, const bool resetPosition)
|
2016-06-30 18:02:09 +08:00
|
|
|
|
{
|
2017-12-05 13:08:17 +08:00
|
|
|
|
if (!m_launched)
|
|
|
|
|
return;
|
|
|
|
|
|
2016-06-30 18:02:09 +08:00
|
|
|
|
// reset environment
|
|
|
|
|
m_sizeChangeAni->stop();
|
|
|
|
|
m_posChangeAni->stop();
|
|
|
|
|
|
2016-08-12 14:28:35 +08:00
|
|
|
|
const Position position = m_settings->position();
|
|
|
|
|
const QRect r(m_settings->windowRect(position));
|
2016-08-04 10:20:55 +08:00
|
|
|
|
|
2016-08-12 14:28:35 +08:00
|
|
|
|
m_sizeChangeAni->setEndValue(r.size());
|
2019-08-26 16:15:50 +08:00
|
|
|
|
resizeMainPanelWindow();
|
2016-08-12 14:28:35 +08:00
|
|
|
|
QWidget::setFixedSize(r.size());
|
|
|
|
|
m_posChangeAni->setEndValue(r.topLeft());
|
|
|
|
|
|
2018-01-02 16:48:01 +08:00
|
|
|
|
if (!resetPosition)
|
|
|
|
|
return;
|
2019-08-23 16:18:21 +08:00
|
|
|
|
|
|
|
|
|
QWidget::move(r.topLeft());
|
|
|
|
|
|
2016-08-12 14:28:35 +08:00
|
|
|
|
QPoint finishPos(0, 0);
|
2019-08-19 13:40:06 +08:00
|
|
|
|
switch (position) {
|
2019-05-06 15:26:49 +08:00
|
|
|
|
case Top: finishPos.setY((visible ? 0 : -r.height())); break;
|
2019-08-30 15:54:19 +08:00
|
|
|
|
case Bottom: finishPos.setY(visible ? 0 : r.height()); break;
|
2019-05-06 15:26:49 +08:00
|
|
|
|
case Left: finishPos.setX((visible ? 0 : -r.width())); break;
|
2019-08-30 15:54:19 +08:00
|
|
|
|
case Right: finishPos.setX(visible ? 0 : r.width()); break;
|
2016-06-30 18:02:09 +08:00
|
|
|
|
}
|
2016-08-12 14:28:35 +08:00
|
|
|
|
|
|
|
|
|
m_mainPanel->move(finishPos);
|
2019-08-16 17:44:57 +08:00
|
|
|
|
// m_mainPanel->updateDockPosition(position);
|
2016-06-30 18:02:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-29 16:53:37 +08:00
|
|
|
|
void MainWindow::updatePanelVisible()
|
|
|
|
|
{
|
2016-08-12 14:28:35 +08:00
|
|
|
|
if (!m_updatePanelVisible)
|
|
|
|
|
return;
|
2019-08-23 16:18:21 +08:00
|
|
|
|
if (m_settings->hideMode() == KeepShowing) {
|
2017-01-12 18:38:06 +08:00
|
|
|
|
return expand();
|
2019-08-23 16:18:21 +08:00
|
|
|
|
}
|
2016-06-30 11:15:06 +08:00
|
|
|
|
|
2016-06-29 16:53:37 +08:00
|
|
|
|
const Dock::HideState state = m_settings->hideState();
|
|
|
|
|
|
2019-08-19 13:40:06 +08:00
|
|
|
|
do {
|
2016-06-30 14:44:55 +08:00
|
|
|
|
if (state != Hide)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (!m_settings->autoHide())
|
|
|
|
|
break;
|
|
|
|
|
|
2019-08-23 16:18:21 +08:00
|
|
|
|
QRectF r(pos(), size());
|
2019-08-23 16:58:13 +08:00
|
|
|
|
const int margin = m_settings->dockMargin();
|
2019-08-23 16:18:21 +08:00
|
|
|
|
switch (m_settings->position()) {
|
|
|
|
|
case Dock::Top:
|
|
|
|
|
r.setY(r.y() - margin);
|
|
|
|
|
break;
|
|
|
|
|
case Dock::Bottom:
|
|
|
|
|
r.setHeight(r.height() + margin);
|
|
|
|
|
break;
|
|
|
|
|
case Dock::Left:
|
|
|
|
|
r.setX(r.x() - margin);
|
2016-06-30 14:44:55 +08:00
|
|
|
|
break;
|
2019-08-23 16:18:21 +08:00
|
|
|
|
case Dock::Right:
|
|
|
|
|
r.setWidth(r.width() + margin);
|
|
|
|
|
}
|
|
|
|
|
if (r.contains(QCursor::pos())) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
2016-06-30 14:44:55 +08:00
|
|
|
|
|
2016-08-12 14:28:35 +08:00
|
|
|
|
return narrow(m_settings->position());
|
2016-06-30 14:44:55 +08:00
|
|
|
|
|
|
|
|
|
} while (false);
|
|
|
|
|
|
|
|
|
|
return expand();
|
2016-06-29 16:53:37 +08:00
|
|
|
|
}
|
2017-03-21 15:40:52 +08:00
|
|
|
|
|
|
|
|
|
void MainWindow::adjustShadowMask()
|
|
|
|
|
{
|
2017-12-05 13:08:17 +08:00
|
|
|
|
if (!m_launched)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (m_shadowMaskOptimizeTimer->isActive())
|
|
|
|
|
return;
|
|
|
|
|
|
2018-01-04 16:56:25 +08:00
|
|
|
|
const bool composite = m_wmHelper->hasComposite();
|
2018-01-04 17:22:37 +08:00
|
|
|
|
const bool isFasion = m_settings->displayMode() == Fashion;
|
2018-01-04 16:56:25 +08:00
|
|
|
|
|
2019-09-03 09:36:33 +08:00
|
|
|
|
DStyleHelper dstyle(style());
|
|
|
|
|
const int radius = dstyle.pixelMetric(DStyle::PM_TopLevelWindowRadius);
|
|
|
|
|
|
|
|
|
|
m_platformWindowHandle.setWindowRadius(composite && isFasion ? radius : 0);
|
2017-03-21 15:40:52 +08:00
|
|
|
|
}
|
2017-12-11 12:02:54 +08:00
|
|
|
|
|
|
|
|
|
void MainWindow::positionCheck()
|
|
|
|
|
{
|
|
|
|
|
if (m_posChangeAni->state() == QPropertyAnimation::Running)
|
|
|
|
|
return;
|
|
|
|
|
if (m_positionUpdateTimer->isActive())
|
|
|
|
|
return;
|
|
|
|
|
|
2017-12-29 15:54:46 +08:00
|
|
|
|
const QPoint scaledFrontPos = scaledPos(m_settings->frontendWindowRect().topLeft());
|
|
|
|
|
|
|
|
|
|
if (QPoint(pos() - scaledFrontPos).manhattanLength() < 2)
|
2017-12-13 13:07:39 +08:00
|
|
|
|
return;
|
|
|
|
|
|
2018-07-23 14:49:01 +08:00
|
|
|
|
// this may cause some position error and animation caton
|
|
|
|
|
//internalMove();
|
2017-12-11 12:02:54 +08:00
|
|
|
|
}
|
2019-01-15 19:54:13 +08:00
|
|
|
|
|
|
|
|
|
void MainWindow::onDbusNameOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner)
|
|
|
|
|
{
|
|
|
|
|
Q_UNUSED(oldOwner);
|
|
|
|
|
|
|
|
|
|
if (name == SNI_WATCHER_SERVICE && !newOwner.isEmpty()) {
|
|
|
|
|
qDebug() << SNI_WATCHER_SERVICE << "SNI watcher daemon started, register dock to watcher as SNI Host";
|
|
|
|
|
m_sniWatcher->RegisterStatusNotifierHost(m_sniHostService);
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-08-22 13:52:02 +08:00
|
|
|
|
|
|
|
|
|
void MainWindow::setEffectEnabled(const bool enabled)
|
|
|
|
|
{
|
|
|
|
|
if (enabled)
|
2019-09-03 20:07:12 +08:00
|
|
|
|
setMaskColor(LightColor);
|
2019-08-22 13:52:02 +08:00
|
|
|
|
else
|
|
|
|
|
setMaskColor(QColor(55, 63, 71));
|
|
|
|
|
|
|
|
|
|
setMaskAlpha(DockSettings::Instance().Opacity());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::setComposite(const bool hasComposite)
|
|
|
|
|
{
|
|
|
|
|
setEffectEnabled(hasComposite);
|
|
|
|
|
|
|
|
|
|
m_sizeChangeAni->setDuration(hasComposite ? 300 : 0);
|
|
|
|
|
}
|
2019-08-26 16:15:50 +08:00
|
|
|
|
|
2019-08-29 20:21:36 +08:00
|
|
|
|
bool MainWindow::appIsOnDock(const QString &appDesktop)
|
|
|
|
|
{
|
|
|
|
|
return DockItemManager::instance()->appIsOnDock(appDesktop);
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-26 16:15:50 +08:00
|
|
|
|
void MainWindow::resizeMainWindow()
|
|
|
|
|
{
|
|
|
|
|
const Position position = m_settings->position();
|
|
|
|
|
QSize size = m_settings->windowSize();
|
|
|
|
|
const QRect windowRect = m_settings->windowRect(position, false);
|
|
|
|
|
internalMove(windowRect.topLeft());
|
2019-09-05 11:19:11 +08:00
|
|
|
|
resizeMainPanelWindow();
|
2019-08-26 16:15:50 +08:00
|
|
|
|
QWidget::setFixedSize(size);
|
2019-08-30 17:55:44 +08:00
|
|
|
|
m_panelShowAni->setEndValue(pos());
|
2019-08-26 16:15:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::resizeMainPanelWindow()
|
|
|
|
|
{
|
|
|
|
|
switch (m_settings->position()) {
|
|
|
|
|
case Dock::Top:
|
2019-09-05 11:19:11 +08:00
|
|
|
|
m_mainPanel->setFixedSize(m_settings->panelSize());
|
|
|
|
|
m_dragWidget->setGeometry(0, this->height() - DRAG_AREA_SIZE, m_settings->panelSize().width(), DRAG_AREA_SIZE);
|
|
|
|
|
break;
|
2019-08-26 16:15:50 +08:00
|
|
|
|
case Dock::Bottom:
|
2019-08-30 15:54:19 +08:00
|
|
|
|
m_mainPanel->setFixedSize(m_settings->panelSize());
|
2019-09-05 11:19:11 +08:00
|
|
|
|
m_dragWidget->setGeometry(0, 0, m_settings->panelSize().width(), DRAG_AREA_SIZE);
|
2019-08-26 16:15:50 +08:00
|
|
|
|
break;
|
|
|
|
|
case Dock::Left:
|
2019-09-05 11:19:11 +08:00
|
|
|
|
m_mainPanel->setFixedSize(m_settings->panelSize());
|
|
|
|
|
m_dragWidget->setGeometry(this->width() - DRAG_AREA_SIZE, 0, DRAG_AREA_SIZE, m_settings->panelSize().height());
|
|
|
|
|
break;
|
2019-08-26 16:15:50 +08:00
|
|
|
|
case Dock::Right:
|
2019-08-30 15:54:19 +08:00
|
|
|
|
m_mainPanel->setFixedSize(m_settings->panelSize());
|
2019-09-05 11:19:11 +08:00
|
|
|
|
m_dragWidget->setGeometry(0, 0, DRAG_AREA_SIZE, m_settings->panelSize().height());
|
2019-08-26 16:15:50 +08:00
|
|
|
|
break;
|
|
|
|
|
default: break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-08-28 11:37:19 +08:00
|
|
|
|
|
|
|
|
|
void MainWindow::updateDisplayMode()
|
|
|
|
|
{
|
2019-08-30 11:41:52 +08:00
|
|
|
|
m_mainPanel->setDisplayMode(m_settings->displayMode());
|
2019-08-28 11:37:19 +08:00
|
|
|
|
}
|
2019-09-05 11:19:11 +08:00
|
|
|
|
|
|
|
|
|
void MainWindow::onMainWindowSizeChanged(QPoint offset)
|
|
|
|
|
{
|
|
|
|
|
if (Dock::Top == m_settings->position()) {
|
|
|
|
|
m_settings->m_mainWindowSize.setHeight(qBound(MAINWINDOW_MIN_SIZE, m_size.height() + offset.y(), MAINWINDOW_MAX_SIZE));
|
|
|
|
|
m_settings->m_mainWindowSize.setWidth(width());
|
|
|
|
|
} else if (Dock::Bottom == m_settings->position()) {
|
|
|
|
|
m_settings->m_mainWindowSize.setHeight(qBound(MAINWINDOW_MIN_SIZE, m_size.height() - offset.y(), MAINWINDOW_MAX_SIZE));
|
|
|
|
|
m_settings->m_mainWindowSize.setWidth(width());
|
|
|
|
|
} else if (Dock::Left == m_settings->position()) {
|
|
|
|
|
m_settings->m_mainWindowSize.setHeight(height());
|
|
|
|
|
m_settings->m_mainWindowSize.setWidth(qBound(MAINWINDOW_MIN_SIZE, m_size.width() + offset.x(), MAINWINDOW_MAX_SIZE));
|
|
|
|
|
} else {
|
|
|
|
|
m_settings->m_mainWindowSize.setHeight(height());
|
|
|
|
|
m_settings->m_mainWindowSize.setWidth(qBound(MAINWINDOW_MIN_SIZE, m_size.width() - offset.x(), MAINWINDOW_MAX_SIZE));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resizeMainWindow();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::onDragFinished()
|
|
|
|
|
{
|
|
|
|
|
if (m_size == m_settings->m_mainWindowSize)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
m_size = m_settings->m_mainWindowSize;
|
|
|
|
|
if (Dock::Top == m_settings->position() || Dock::Bottom == m_settings->position()) {
|
|
|
|
|
m_settings->m_dockInter ->setWindowSize(m_settings->m_mainWindowSize.height());
|
|
|
|
|
} else {
|
|
|
|
|
m_settings->m_dockInter->setWindowSize(m_settings->m_mainWindowSize.width());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setStrutPartial();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#include "mainwindow.moc"
|