2019-09-08 22:27:57 +02:00
|
|
|
#include "BaseWindow.hpp"
|
|
|
|
|
|
|
|
#include "BaseSettings.hpp"
|
|
|
|
#include "BaseTheme.hpp"
|
|
|
|
#include "boost/algorithm/algorithm.hpp"
|
2020-08-22 22:53:31 +02:00
|
|
|
#include "util/DebugCount.hpp"
|
2019-09-08 22:27:57 +02:00
|
|
|
#include "util/PostToThread.hpp"
|
|
|
|
#include "util/WindowsHelper.hpp"
|
|
|
|
#include "widgets/Label.hpp"
|
|
|
|
#include "widgets/TooltipWidget.hpp"
|
|
|
|
#include "widgets/helper/EffectLabel.hpp"
|
|
|
|
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QDebug>
|
|
|
|
#include <QDesktopWidget>
|
|
|
|
#include <QFont>
|
|
|
|
#include <QIcon>
|
|
|
|
#include <functional>
|
|
|
|
|
|
|
|
#ifdef CHATTERINO
|
|
|
|
# include "Application.hpp"
|
|
|
|
# include "singletons/WindowManager.hpp"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USEWINSDK
|
|
|
|
# include <ObjIdl.h>
|
|
|
|
# include <VersionHelpers.h>
|
|
|
|
# include <Windows.h>
|
|
|
|
# include <dwmapi.h>
|
|
|
|
# include <gdiplus.h>
|
|
|
|
# include <windowsx.h>
|
|
|
|
|
|
|
|
//#include <ShellScalingApi.h>
|
|
|
|
# pragma comment(lib, "Dwmapi.lib")
|
|
|
|
|
|
|
|
# include <QHBoxLayout>
|
|
|
|
# include <QVBoxLayout>
|
|
|
|
|
|
|
|
# define WM_DPICHANGED 0x02E0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "widgets/helper/TitlebarButton.hpp"
|
|
|
|
|
2019-10-07 15:46:08 +02:00
|
|
|
namespace chatterino {
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2019-09-08 22:58:17 +02:00
|
|
|
BaseWindow::BaseWindow(FlagsEnum<Flags> _flags, QWidget *parent)
|
2020-10-31 16:42:48 +01:00
|
|
|
: BaseWidget(parent, (_flags.has(Dialog) ? Qt::Dialog : Qt::Window) |
|
|
|
|
(_flags.has(TopMost) ? Qt::WindowStaysOnTopHint
|
|
|
|
: Qt::WindowFlags()))
|
2019-09-08 22:58:17 +02:00
|
|
|
, enableCustomFrame_(_flags.has(EnableCustomFrame))
|
|
|
|
, frameless_(_flags.has(Frameless))
|
2019-09-08 22:27:57 +02:00
|
|
|
, flags_(_flags)
|
|
|
|
{
|
|
|
|
if (this->frameless_)
|
|
|
|
{
|
|
|
|
this->enableCustomFrame_ = false;
|
|
|
|
this->setWindowFlag(Qt::FramelessWindowHint);
|
|
|
|
}
|
|
|
|
|
2020-08-15 18:59:17 +02:00
|
|
|
if (_flags.has(DontFocus))
|
|
|
|
{
|
|
|
|
this->setAttribute(Qt::WA_ShowWithoutActivating);
|
|
|
|
#ifdef Q_OS_LINUX
|
|
|
|
this->setWindowFlags(Qt::ToolTip);
|
|
|
|
#else
|
|
|
|
this->setWindowFlags(Qt::Tool | Qt::FramelessWindowHint |
|
|
|
|
Qt::X11BypassWindowManagerHint |
|
|
|
|
Qt::BypassWindowManagerHint);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2019-09-08 22:27:57 +02:00
|
|
|
this->init();
|
|
|
|
|
|
|
|
getSettings()->uiScale.connect(
|
|
|
|
[this]() {
|
|
|
|
postToThread([this] {
|
|
|
|
this->updateScale();
|
|
|
|
this->updateScale();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
this->connections_);
|
|
|
|
|
|
|
|
this->updateScale();
|
|
|
|
|
|
|
|
this->resize(300, 150);
|
|
|
|
|
|
|
|
#ifdef USEWINSDK
|
|
|
|
this->useNextBounds_.setSingleShot(true);
|
2020-11-08 12:02:19 +01:00
|
|
|
QObject::connect(&this->useNextBounds_, &QTimer::timeout, this, [this]() {
|
|
|
|
this->currentBounds_ = this->nextBounds_;
|
|
|
|
});
|
2019-09-08 22:27:57 +02:00
|
|
|
#endif
|
2019-09-25 23:54:56 +02:00
|
|
|
|
|
|
|
this->themeChangedEvent();
|
2020-08-22 22:53:31 +02:00
|
|
|
DebugCount::increase("BaseWindow");
|
|
|
|
}
|
|
|
|
|
|
|
|
BaseWindow::~BaseWindow()
|
|
|
|
{
|
|
|
|
DebugCount::decrease("BaseWindow");
|
2019-09-08 22:27:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::setInitialBounds(const QRect &bounds)
|
|
|
|
{
|
|
|
|
#ifdef USEWINSDK
|
|
|
|
this->initalBounds_ = bounds;
|
|
|
|
#else
|
|
|
|
this->setGeometry(bounds);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
QRect BaseWindow::getBounds()
|
|
|
|
{
|
|
|
|
#ifdef USEWINSDK
|
|
|
|
return this->currentBounds_;
|
|
|
|
#else
|
|
|
|
return this->geometry();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
float BaseWindow::scale() const
|
|
|
|
{
|
2020-04-19 21:05:40 +02:00
|
|
|
return std::max<float>(0.01f, this->overrideScale().value_or(this->scale_));
|
2019-09-08 22:27:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
float BaseWindow::qtFontScale() const
|
|
|
|
{
|
2020-04-19 21:05:40 +02:00
|
|
|
return this->scale() / std::max<float>(0.01, this->nativeScale_);
|
2019-09-08 22:27:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::init()
|
|
|
|
{
|
|
|
|
this->setWindowIcon(QIcon(":/images/icon.png"));
|
|
|
|
|
|
|
|
#ifdef USEWINSDK
|
|
|
|
if (this->hasCustomWindowFrame())
|
|
|
|
{
|
|
|
|
// CUSTOM WINDOW FRAME
|
|
|
|
QVBoxLayout *layout = new QVBoxLayout();
|
|
|
|
this->ui_.windowLayout = layout;
|
|
|
|
layout->setContentsMargins(1, 1, 1, 1);
|
|
|
|
layout->setSpacing(0);
|
|
|
|
this->setLayout(layout);
|
|
|
|
{
|
|
|
|
if (!this->frameless_)
|
|
|
|
{
|
|
|
|
QHBoxLayout *buttonLayout = this->ui_.titlebarBox =
|
|
|
|
new QHBoxLayout();
|
|
|
|
buttonLayout->setMargin(0);
|
|
|
|
layout->addLayout(buttonLayout);
|
|
|
|
|
|
|
|
// title
|
|
|
|
Label *title = new Label;
|
2020-11-08 12:02:19 +01:00
|
|
|
QObject::connect(this, &QWidget::windowTitleChanged,
|
|
|
|
[title](const QString &text) {
|
|
|
|
title->setText(text);
|
|
|
|
});
|
2019-09-08 22:27:57 +02:00
|
|
|
|
|
|
|
QSizePolicy policy(QSizePolicy::Ignored,
|
|
|
|
QSizePolicy::Preferred);
|
|
|
|
policy.setHorizontalStretch(1);
|
|
|
|
title->setSizePolicy(policy);
|
|
|
|
buttonLayout->addWidget(title);
|
|
|
|
this->ui_.titleLabel = title;
|
|
|
|
|
|
|
|
// buttons
|
|
|
|
TitleBarButton *_minButton = new TitleBarButton;
|
|
|
|
_minButton->setButtonStyle(TitleBarButtonStyle::Minimize);
|
|
|
|
TitleBarButton *_maxButton = new TitleBarButton;
|
|
|
|
_maxButton->setButtonStyle(TitleBarButtonStyle::Maximize);
|
|
|
|
TitleBarButton *_exitButton = new TitleBarButton;
|
|
|
|
_exitButton->setButtonStyle(TitleBarButtonStyle::Close);
|
|
|
|
|
|
|
|
QObject::connect(_minButton, &TitleBarButton::leftClicked, this,
|
|
|
|
[this] {
|
|
|
|
this->setWindowState(Qt::WindowMinimized |
|
|
|
|
this->windowState());
|
|
|
|
});
|
|
|
|
QObject::connect(_maxButton, &TitleBarButton::leftClicked, this,
|
|
|
|
[this, _maxButton] {
|
|
|
|
this->setWindowState(
|
|
|
|
_maxButton->getButtonStyle() !=
|
|
|
|
TitleBarButtonStyle::Maximize
|
|
|
|
? Qt::WindowActive
|
|
|
|
: Qt::WindowMaximized);
|
|
|
|
});
|
|
|
|
QObject::connect(_exitButton, &TitleBarButton::leftClicked,
|
2020-11-08 12:02:19 +01:00
|
|
|
this, [this] {
|
|
|
|
this->close();
|
|
|
|
});
|
2019-09-08 22:27:57 +02:00
|
|
|
|
|
|
|
this->ui_.minButton = _minButton;
|
|
|
|
this->ui_.maxButton = _maxButton;
|
|
|
|
this->ui_.exitButton = _exitButton;
|
|
|
|
|
|
|
|
this->ui_.buttons.push_back(_minButton);
|
|
|
|
this->ui_.buttons.push_back(_maxButton);
|
|
|
|
this->ui_.buttons.push_back(_exitButton);
|
|
|
|
|
|
|
|
// buttonLayout->addStretch(1);
|
|
|
|
buttonLayout->addWidget(_minButton);
|
|
|
|
buttonLayout->addWidget(_maxButton);
|
|
|
|
buttonLayout->addWidget(_exitButton);
|
|
|
|
buttonLayout->setSpacing(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this->ui_.layoutBase = new BaseWidget(this);
|
|
|
|
this->ui_.layoutBase->setContentsMargins(1, 0, 1, 1);
|
|
|
|
layout->addWidget(this->ui_.layoutBase);
|
|
|
|
}
|
|
|
|
|
|
|
|
// DPI
|
|
|
|
// auto dpi = getWindowDpi(this->winId());
|
|
|
|
|
|
|
|
// if (dpi) {
|
|
|
|
// this->scale = dpi.value() / 96.f;
|
|
|
|
// }
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USEWINSDK
|
|
|
|
// fourtf: don't ask me why we need to delay this
|
2019-09-08 22:58:17 +02:00
|
|
|
if (!this->flags_.has(TopMost))
|
2019-09-08 22:27:57 +02:00
|
|
|
{
|
|
|
|
QTimer::singleShot(1, this, [this] {
|
|
|
|
getSettings()->windowTopMost.connect(
|
|
|
|
[this](bool topMost, auto) {
|
|
|
|
::SetWindowPos(HWND(this->winId()),
|
|
|
|
topMost ? HWND_TOPMOST : HWND_NOTOPMOST, 0,
|
|
|
|
0, 0, 0,
|
|
|
|
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
|
|
|
},
|
|
|
|
this->managedConnections_);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
#else
|
2020-05-30 11:32:25 +02:00
|
|
|
// TopMost flag overrides setting
|
|
|
|
if (!this->flags_.has(TopMost))
|
|
|
|
{
|
2020-06-14 12:26:23 +02:00
|
|
|
getSettings()->windowTopMost.connect(
|
|
|
|
[this](bool topMost, auto) {
|
2021-12-05 13:38:21 +01:00
|
|
|
auto isVisible = this->isVisible();
|
2020-06-14 12:26:23 +02:00
|
|
|
this->setWindowFlag(Qt::WindowStaysOnTopHint, topMost);
|
2021-12-05 13:38:21 +01:00
|
|
|
if (isVisible)
|
2021-04-11 16:22:32 +02:00
|
|
|
{
|
|
|
|
this->show();
|
|
|
|
}
|
2020-06-14 12:26:23 +02:00
|
|
|
},
|
|
|
|
this->managedConnections_);
|
2020-05-30 11:32:25 +02:00
|
|
|
}
|
2019-09-08 22:27:57 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::setStayInScreenRect(bool value)
|
|
|
|
{
|
|
|
|
this->stayInScreenRect_ = value;
|
|
|
|
|
2020-05-24 11:51:16 +02:00
|
|
|
this->moveIntoDesktopRect(this, this->pos());
|
2019-09-08 22:27:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool BaseWindow::getStayInScreenRect() const
|
|
|
|
{
|
|
|
|
return this->stayInScreenRect_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::setActionOnFocusLoss(ActionOnFocusLoss value)
|
|
|
|
{
|
|
|
|
this->actionOnFocusLoss_ = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
BaseWindow::ActionOnFocusLoss BaseWindow::getActionOnFocusLoss() const
|
|
|
|
{
|
|
|
|
return this->actionOnFocusLoss_;
|
|
|
|
}
|
|
|
|
|
|
|
|
QWidget *BaseWindow::getLayoutContainer()
|
|
|
|
{
|
|
|
|
if (this->hasCustomWindowFrame())
|
|
|
|
{
|
|
|
|
return this->ui_.layoutBase;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BaseWindow::hasCustomWindowFrame()
|
|
|
|
{
|
|
|
|
return BaseWindow::supportsCustomWindowFrame() && this->enableCustomFrame_;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BaseWindow::supportsCustomWindowFrame()
|
|
|
|
{
|
|
|
|
#ifdef USEWINSDK
|
|
|
|
static bool isWin8 = IsWindows8OrGreater();
|
|
|
|
|
|
|
|
return isWin8;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::themeChangedEvent()
|
|
|
|
{
|
|
|
|
if (this->hasCustomWindowFrame())
|
|
|
|
{
|
|
|
|
QPalette palette;
|
|
|
|
palette.setColor(QPalette::Window, QColor(80, 80, 80, 255));
|
|
|
|
palette.setColor(QPalette::WindowText, this->theme->window.text);
|
|
|
|
this->setPalette(palette);
|
|
|
|
|
|
|
|
if (this->ui_.titleLabel)
|
|
|
|
{
|
|
|
|
QPalette palette_title;
|
|
|
|
palette_title.setColor(
|
|
|
|
QPalette::WindowText,
|
|
|
|
this->theme->isLightTheme() ? "#333" : "#ccc");
|
|
|
|
this->ui_.titleLabel->setPalette(palette_title);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (Button *button : this->ui_.buttons)
|
|
|
|
{
|
|
|
|
button->setMouseEffectColor(this->theme->window.text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
QPalette palette;
|
2021-03-13 16:03:16 +01:00
|
|
|
palette.setColor(QPalette::Window, this->theme->window.background);
|
|
|
|
palette.setColor(QPalette::WindowText, this->theme->window.text);
|
2019-09-08 22:27:57 +02:00
|
|
|
this->setPalette(palette);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BaseWindow::event(QEvent *event)
|
|
|
|
{
|
|
|
|
if (event->type() ==
|
|
|
|
QEvent::WindowDeactivate /*|| event->type() == QEvent::FocusOut*/)
|
|
|
|
{
|
|
|
|
this->onFocusLost();
|
|
|
|
}
|
|
|
|
|
|
|
|
return QWidget::event(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::wheelEvent(QWheelEvent *event)
|
|
|
|
{
|
|
|
|
if (event->orientation() != Qt::Vertical)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (event->modifiers() & Qt::ControlModifier)
|
|
|
|
{
|
|
|
|
if (event->delta() > 0)
|
|
|
|
{
|
|
|
|
getSettings()->setClampedUiScale(
|
|
|
|
getSettings()->getClampedUiScale() + 0.1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
getSettings()->setClampedUiScale(
|
|
|
|
getSettings()->getClampedUiScale() - 0.1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::onFocusLost()
|
|
|
|
{
|
|
|
|
switch (this->getActionOnFocusLoss())
|
|
|
|
{
|
2019-11-02 12:36:42 +01:00
|
|
|
case Delete: {
|
2019-09-08 22:27:57 +02:00
|
|
|
this->deleteLater();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2019-11-02 12:36:42 +01:00
|
|
|
case Close: {
|
2019-09-08 22:27:57 +02:00
|
|
|
this->close();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2019-11-02 12:36:42 +01:00
|
|
|
case Hide: {
|
2019-09-08 22:27:57 +02:00
|
|
|
this->hide();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::mousePressEvent(QMouseEvent *event)
|
|
|
|
{
|
|
|
|
#ifndef Q_OS_WIN
|
2019-09-08 22:58:17 +02:00
|
|
|
if (this->flags_.has(FramelessDraggable))
|
2019-09-08 22:27:57 +02:00
|
|
|
{
|
|
|
|
this->movingRelativePos = event->localPos();
|
|
|
|
if (auto widget =
|
|
|
|
this->childAt(event->localPos().x(), event->localPos().y()))
|
|
|
|
{
|
|
|
|
std::function<bool(QWidget *)> recursiveCheckMouseTracking;
|
|
|
|
recursiveCheckMouseTracking = [&](QWidget *widget) {
|
|
|
|
if (widget == nullptr)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (widget->hasMouseTracking())
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return recursiveCheckMouseTracking(widget->parentWidget());
|
|
|
|
};
|
|
|
|
|
|
|
|
if (!recursiveCheckMouseTracking(widget))
|
|
|
|
{
|
|
|
|
this->moving = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
BaseWidget::mousePressEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::mouseReleaseEvent(QMouseEvent *event)
|
|
|
|
{
|
|
|
|
#ifndef Q_OS_WIN
|
2019-09-08 22:58:17 +02:00
|
|
|
if (this->flags_.has(FramelessDraggable))
|
2019-09-08 22:27:57 +02:00
|
|
|
{
|
|
|
|
if (this->moving)
|
|
|
|
{
|
|
|
|
this->moving = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
BaseWidget::mouseReleaseEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::mouseMoveEvent(QMouseEvent *event)
|
|
|
|
{
|
|
|
|
#ifndef Q_OS_WIN
|
2019-09-08 22:58:17 +02:00
|
|
|
if (this->flags_.has(FramelessDraggable))
|
2019-09-08 22:27:57 +02:00
|
|
|
{
|
|
|
|
if (this->moving)
|
|
|
|
{
|
|
|
|
const auto &newPos = event->screenPos() - this->movingRelativePos;
|
|
|
|
this->move(newPos.x(), newPos.y());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
BaseWidget::mouseMoveEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
TitleBarButton *BaseWindow::addTitleBarButton(const TitleBarButtonStyle &style,
|
|
|
|
std::function<void()> onClicked)
|
|
|
|
{
|
|
|
|
TitleBarButton *button = new TitleBarButton;
|
|
|
|
button->setScaleIndependantSize(30, 30);
|
|
|
|
|
|
|
|
this->ui_.buttons.push_back(button);
|
|
|
|
this->ui_.titlebarBox->insertWidget(1, button);
|
|
|
|
button->setButtonStyle(style);
|
|
|
|
|
2020-11-08 12:02:19 +01:00
|
|
|
QObject::connect(button, &TitleBarButton::leftClicked, this, [onClicked] {
|
|
|
|
onClicked();
|
|
|
|
});
|
2019-09-08 22:27:57 +02:00
|
|
|
|
|
|
|
return button;
|
|
|
|
}
|
|
|
|
|
|
|
|
EffectLabel *BaseWindow::addTitleBarLabel(std::function<void()> onClicked)
|
|
|
|
{
|
|
|
|
EffectLabel *button = new EffectLabel;
|
|
|
|
button->setScaleIndependantHeight(30);
|
|
|
|
|
|
|
|
this->ui_.buttons.push_back(button);
|
|
|
|
this->ui_.titlebarBox->insertWidget(1, button);
|
|
|
|
|
2020-11-08 12:02:19 +01:00
|
|
|
QObject::connect(button, &EffectLabel::leftClicked, this, [onClicked] {
|
|
|
|
onClicked();
|
|
|
|
});
|
2019-09-08 22:27:57 +02:00
|
|
|
|
|
|
|
return button;
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::changeEvent(QEvent *)
|
|
|
|
{
|
|
|
|
if (this->isVisible())
|
|
|
|
{
|
2019-10-07 22:42:34 +02:00
|
|
|
TooltipWidget::instance()->hide();
|
2019-09-08 22:27:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef USEWINSDK
|
|
|
|
if (this->ui_.maxButton)
|
|
|
|
{
|
|
|
|
this->ui_.maxButton->setButtonStyle(
|
|
|
|
this->windowState() & Qt::WindowMaximized
|
|
|
|
? TitleBarButtonStyle::Unmaximize
|
|
|
|
: TitleBarButtonStyle::Maximize);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this->isVisible() && this->hasCustomWindowFrame())
|
|
|
|
{
|
|
|
|
auto palette = this->palette();
|
|
|
|
palette.setColor(QPalette::Window,
|
|
|
|
GetForegroundWindow() == HWND(this->winId())
|
|
|
|
? QColor(90, 90, 90)
|
|
|
|
: QColor(50, 50, 50));
|
|
|
|
this->setPalette(palette);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef Q_OS_WIN
|
|
|
|
this->update();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::leaveEvent(QEvent *)
|
|
|
|
{
|
2019-10-07 22:42:34 +02:00
|
|
|
TooltipWidget::instance()->hide();
|
2019-09-08 22:27:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::moveTo(QWidget *parent, QPoint point, bool offset)
|
|
|
|
{
|
|
|
|
if (offset)
|
|
|
|
{
|
|
|
|
point.rx() += 16;
|
|
|
|
point.ry() += 16;
|
|
|
|
}
|
|
|
|
|
2020-05-24 11:51:16 +02:00
|
|
|
this->moveIntoDesktopRect(parent, point);
|
2019-09-08 22:27:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::resizeEvent(QResizeEvent *)
|
|
|
|
{
|
|
|
|
// Queue up save because: Window resized
|
|
|
|
#ifdef CHATTERINO
|
|
|
|
getApp()->windows->queueSave();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//this->moveIntoDesktopRect(this);
|
|
|
|
|
2019-12-26 23:23:59 +01:00
|
|
|
#ifdef USEWINSDK
|
2019-12-29 11:14:26 +01:00
|
|
|
if (this->hasCustomWindowFrame() && !this->isResizeFixing_)
|
2019-12-26 23:23:59 +01:00
|
|
|
{
|
|
|
|
this->isResizeFixing_ = true;
|
|
|
|
QTimer::singleShot(50, this, [this] {
|
|
|
|
RECT rect;
|
|
|
|
::GetWindowRect((HWND)this->winId(), &rect);
|
|
|
|
::SetWindowPos((HWND)this->winId(), nullptr, 0, 0,
|
|
|
|
rect.right - rect.left + 1, rect.bottom - rect.top,
|
|
|
|
SWP_NOMOVE | SWP_NOZORDER);
|
|
|
|
::SetWindowPos((HWND)this->winId(), nullptr, 0, 0,
|
|
|
|
rect.right - rect.left, rect.bottom - rect.top,
|
|
|
|
SWP_NOMOVE | SWP_NOZORDER);
|
2020-11-08 12:02:19 +01:00
|
|
|
QTimer::singleShot(10, this, [this] {
|
|
|
|
this->isResizeFixing_ = false;
|
|
|
|
});
|
2019-12-26 23:23:59 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-09-08 22:27:57 +02:00
|
|
|
this->calcButtonsSizes();
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::moveEvent(QMoveEvent *event)
|
|
|
|
{
|
|
|
|
// Queue up save because: Window position changed
|
|
|
|
#ifdef CHATTERINO
|
|
|
|
getApp()->windows->queueSave();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
BaseWidget::moveEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::closeEvent(QCloseEvent *)
|
|
|
|
{
|
|
|
|
this->closing.invoke();
|
|
|
|
}
|
|
|
|
|
2019-09-08 22:58:17 +02:00
|
|
|
void BaseWindow::showEvent(QShowEvent *)
|
|
|
|
{
|
2020-05-24 11:51:16 +02:00
|
|
|
this->moveIntoDesktopRect(this, this->pos());
|
2019-09-08 22:58:17 +02:00
|
|
|
if (this->frameless_)
|
|
|
|
{
|
2020-11-08 12:02:19 +01:00
|
|
|
QTimer::singleShot(30, this, [this] {
|
|
|
|
this->moveIntoDesktopRect(this, this->pos());
|
|
|
|
});
|
2019-09-08 22:58:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-24 11:51:16 +02:00
|
|
|
void BaseWindow::moveIntoDesktopRect(QWidget *parent, QPoint point)
|
2019-09-08 22:27:57 +02:00
|
|
|
{
|
|
|
|
if (!this->stayInScreenRect_)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// move the widget into the screen geometry if it's not already in there
|
|
|
|
QDesktopWidget *desktop = QApplication::desktop();
|
2020-05-16 12:16:17 +02:00
|
|
|
QPoint globalCursorPos = QCursor::pos();
|
2019-09-08 22:27:57 +02:00
|
|
|
|
|
|
|
QRect s = desktop->availableGeometry(parent);
|
|
|
|
|
2020-05-16 12:16:17 +02:00
|
|
|
bool stickRight = false;
|
|
|
|
bool stickBottom = false;
|
|
|
|
|
2020-05-24 11:51:16 +02:00
|
|
|
if (point.x() < s.left())
|
2019-09-08 22:27:57 +02:00
|
|
|
{
|
2020-05-24 11:51:16 +02:00
|
|
|
point.setX(s.left());
|
2019-09-08 22:27:57 +02:00
|
|
|
}
|
2020-05-24 11:51:16 +02:00
|
|
|
if (point.y() < s.top())
|
2019-09-08 22:27:57 +02:00
|
|
|
{
|
2020-05-24 11:51:16 +02:00
|
|
|
point.setY(s.top());
|
2019-09-08 22:27:57 +02:00
|
|
|
}
|
2020-05-24 11:51:16 +02:00
|
|
|
if (point.x() + this->width() > s.right())
|
2019-09-08 22:27:57 +02:00
|
|
|
{
|
2020-05-16 12:16:17 +02:00
|
|
|
stickRight = true;
|
2020-05-24 11:51:16 +02:00
|
|
|
point.setX(s.right() - this->width());
|
2019-09-08 22:27:57 +02:00
|
|
|
}
|
2020-05-24 11:51:16 +02:00
|
|
|
if (point.y() + this->height() > s.bottom())
|
2019-09-08 22:27:57 +02:00
|
|
|
{
|
2020-05-16 12:16:17 +02:00
|
|
|
stickBottom = true;
|
2020-05-24 11:51:16 +02:00
|
|
|
point.setY(s.bottom() - this->height());
|
2019-09-08 22:27:57 +02:00
|
|
|
}
|
|
|
|
|
2020-05-16 12:16:17 +02:00
|
|
|
if (stickRight && stickBottom)
|
|
|
|
{
|
2020-05-24 11:51:16 +02:00
|
|
|
point.setY(globalCursorPos.y() - this->height() - 16);
|
2020-05-16 12:16:17 +02:00
|
|
|
}
|
|
|
|
|
2020-05-24 11:51:16 +02:00
|
|
|
this->move(point);
|
2019-09-08 22:27:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool BaseWindow::nativeEvent(const QByteArray &eventType, void *message,
|
|
|
|
long *result)
|
|
|
|
{
|
|
|
|
#ifdef USEWINSDK
|
|
|
|
MSG *msg = reinterpret_cast<MSG *>(message);
|
|
|
|
|
|
|
|
bool returnValue = false;
|
|
|
|
|
|
|
|
switch (msg->message)
|
|
|
|
{
|
|
|
|
case WM_DPICHANGED:
|
|
|
|
returnValue = this->handleDPICHANGED(msg);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_SHOWWINDOW:
|
|
|
|
returnValue = this->handleSHOWWINDOW(msg);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_NCCALCSIZE:
|
|
|
|
returnValue = this->handleNCCALCSIZE(msg, result);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_SIZE:
|
|
|
|
returnValue = this->handleSIZE(msg);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_MOVE:
|
|
|
|
returnValue = this->handleMOVE(msg);
|
|
|
|
*result = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_NCHITTEST:
|
|
|
|
returnValue = this->handleNCHITTEST(msg, result);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return QWidget::nativeEvent(eventType, message, result);
|
|
|
|
}
|
|
|
|
|
|
|
|
QWidget::nativeEvent(eventType, message, result);
|
|
|
|
|
|
|
|
return returnValue;
|
|
|
|
#else
|
|
|
|
return QWidget::nativeEvent(eventType, message, result);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::scaleChangedEvent(float scale)
|
|
|
|
{
|
|
|
|
#ifdef USEWINSDK
|
|
|
|
this->calcButtonsSizes();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
this->setFont(getFonts()->getFont(FontStyle::UiTabs, this->qtFontScale()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::paintEvent(QPaintEvent *)
|
|
|
|
{
|
|
|
|
QPainter painter(this);
|
|
|
|
|
|
|
|
if (this->frameless_)
|
|
|
|
{
|
|
|
|
painter.setPen(QColor("#999"));
|
|
|
|
painter.drawRect(0, 0, this->width() - 1, this->height() - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
this->drawCustomWindowFrame(painter);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::updateScale()
|
|
|
|
{
|
|
|
|
auto scale =
|
2019-09-08 22:58:17 +02:00
|
|
|
this->nativeScale_ * (this->flags_.has(DisableCustomScaling)
|
2019-09-08 22:27:57 +02:00
|
|
|
? 1
|
|
|
|
: getABSettings()->getClampedUiScale());
|
|
|
|
|
|
|
|
this->setScale(scale);
|
|
|
|
|
|
|
|
for (auto child : this->findChildren<BaseWidget *>())
|
|
|
|
{
|
|
|
|
child->setScale(scale);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::calcButtonsSizes()
|
|
|
|
{
|
|
|
|
if (!this->shown_)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((this->width() / this->scale()) < 300)
|
|
|
|
{
|
|
|
|
if (this->ui_.minButton)
|
|
|
|
this->ui_.minButton->setScaleIndependantSize(30, 30);
|
|
|
|
if (this->ui_.maxButton)
|
|
|
|
this->ui_.maxButton->setScaleIndependantSize(30, 30);
|
|
|
|
if (this->ui_.exitButton)
|
|
|
|
this->ui_.exitButton->setScaleIndependantSize(30, 30);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (this->ui_.minButton)
|
|
|
|
this->ui_.minButton->setScaleIndependantSize(46, 30);
|
|
|
|
if (this->ui_.maxButton)
|
|
|
|
this->ui_.maxButton->setScaleIndependantSize(46, 30);
|
|
|
|
if (this->ui_.exitButton)
|
|
|
|
this->ui_.exitButton->setScaleIndependantSize(46, 30);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseWindow::drawCustomWindowFrame(QPainter &painter)
|
|
|
|
{
|
|
|
|
#ifdef USEWINSDK
|
|
|
|
if (this->hasCustomWindowFrame())
|
|
|
|
{
|
|
|
|
QColor bg = this->overrideBackgroundColor_.value_or(
|
|
|
|
this->theme->window.background);
|
|
|
|
painter.fillRect(QRect(1, 2, this->width() - 2, this->height() - 3),
|
|
|
|
bg);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BaseWindow::handleDPICHANGED(MSG *msg)
|
|
|
|
{
|
|
|
|
#ifdef USEWINSDK
|
|
|
|
int dpi = HIWORD(msg->wParam);
|
|
|
|
|
|
|
|
float _scale = dpi / 96.f;
|
|
|
|
|
2019-09-08 22:58:17 +02:00
|
|
|
auto *prcNewWindow = reinterpret_cast<RECT *>(msg->lParam);
|
|
|
|
SetWindowPos(msg->hwnd, nullptr, prcNewWindow->left, prcNewWindow->top,
|
|
|
|
prcNewWindow->right - prcNewWindow->left,
|
|
|
|
prcNewWindow->bottom - prcNewWindow->top,
|
|
|
|
SWP_NOZORDER | SWP_NOACTIVATE);
|
2019-09-08 22:27:57 +02:00
|
|
|
|
|
|
|
this->nativeScale_ = _scale;
|
|
|
|
this->updateScale();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BaseWindow::handleSHOWWINDOW(MSG *msg)
|
|
|
|
{
|
|
|
|
#ifdef USEWINSDK
|
|
|
|
if (auto dpi = getWindowDpi(msg->hwnd))
|
|
|
|
{
|
|
|
|
this->nativeScale_ = dpi.get() / 96.f;
|
|
|
|
this->updateScale();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!this->shown_ && this->isVisible())
|
|
|
|
{
|
|
|
|
if (this->hasCustomWindowFrame())
|
|
|
|
{
|
|
|
|
this->shown_ = true;
|
|
|
|
|
|
|
|
const MARGINS shadow = {8, 8, 8, 8};
|
|
|
|
DwmExtendFrameIntoClientArea(HWND(this->winId()), &shadow);
|
|
|
|
}
|
|
|
|
if (!this->initalBounds_.isNull())
|
|
|
|
{
|
|
|
|
::SetWindowPos(msg->hwnd, nullptr, this->initalBounds_.x(),
|
|
|
|
this->initalBounds_.y(), this->initalBounds_.width(),
|
|
|
|
this->initalBounds_.height(),
|
|
|
|
SWP_NOZORDER | SWP_NOACTIVATE);
|
|
|
|
this->currentBounds_ = this->initalBounds_;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this->calcButtonsSizes();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BaseWindow::handleNCCALCSIZE(MSG *msg, long *result)
|
|
|
|
{
|
|
|
|
#ifdef USEWINSDK
|
|
|
|
if (this->hasCustomWindowFrame())
|
|
|
|
{
|
|
|
|
// int cx = GetSystemMetrics(SM_CXSIZEFRAME);
|
|
|
|
// int cy = GetSystemMetrics(SM_CYSIZEFRAME);
|
|
|
|
|
|
|
|
if (msg->wParam == TRUE)
|
|
|
|
{
|
|
|
|
NCCALCSIZE_PARAMS *ncp =
|
|
|
|
(reinterpret_cast<NCCALCSIZE_PARAMS *>(msg->lParam));
|
|
|
|
ncp->lppos->flags |= SWP_NOREDRAW;
|
|
|
|
RECT *clientRect = &ncp->rgrc[0];
|
|
|
|
|
|
|
|
clientRect->top -= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
*result = 0;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BaseWindow::handleSIZE(MSG *msg)
|
|
|
|
{
|
|
|
|
#ifdef USEWINSDK
|
|
|
|
if (this->ui_.windowLayout)
|
|
|
|
{
|
|
|
|
if (this->frameless_)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
else if (this->hasCustomWindowFrame())
|
|
|
|
{
|
|
|
|
if (msg->wParam == SIZE_MAXIMIZED)
|
|
|
|
{
|
|
|
|
auto offset = int(
|
|
|
|
getWindowDpi(HWND(this->winId())).value_or(96) * 8 / 96);
|
|
|
|
|
|
|
|
this->ui_.windowLayout->setContentsMargins(offset, offset,
|
|
|
|
offset, offset);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this->ui_.windowLayout->setContentsMargins(0, 1, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
this->isNotMinimizedOrMaximized_ = msg->wParam == SIZE_RESTORED;
|
|
|
|
|
|
|
|
if (this->isNotMinimizedOrMaximized_)
|
|
|
|
{
|
|
|
|
RECT rect;
|
|
|
|
::GetWindowRect(msg->hwnd, &rect);
|
|
|
|
this->currentBounds_ =
|
|
|
|
QRect(QPoint(rect.left, rect.top),
|
|
|
|
QPoint(rect.right - 1, rect.bottom - 1));
|
|
|
|
}
|
|
|
|
this->useNextBounds_.stop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BaseWindow::handleMOVE(MSG *msg)
|
|
|
|
{
|
|
|
|
#ifdef USEWINSDK
|
|
|
|
if (this->isNotMinimizedOrMaximized_)
|
|
|
|
{
|
|
|
|
RECT rect;
|
|
|
|
::GetWindowRect(msg->hwnd, &rect);
|
|
|
|
this->nextBounds_ = QRect(QPoint(rect.left, rect.top),
|
|
|
|
QPoint(rect.right - 1, rect.bottom - 1));
|
|
|
|
|
|
|
|
this->useNextBounds_.start(10);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BaseWindow::handleNCHITTEST(MSG *msg, long *result)
|
|
|
|
{
|
|
|
|
#ifdef USEWINSDK
|
|
|
|
const LONG border_width = 8; // in pixels
|
|
|
|
RECT winrect;
|
|
|
|
GetWindowRect(HWND(winId()), &winrect);
|
|
|
|
|
|
|
|
long x = GET_X_LPARAM(msg->lParam);
|
|
|
|
long y = GET_Y_LPARAM(msg->lParam);
|
|
|
|
|
|
|
|
QPoint point(x - winrect.left, y - winrect.top);
|
|
|
|
|
|
|
|
if (this->hasCustomWindowFrame())
|
|
|
|
{
|
|
|
|
*result = 0;
|
|
|
|
|
|
|
|
bool resizeWidth = minimumWidth() != maximumWidth();
|
|
|
|
bool resizeHeight = minimumHeight() != maximumHeight();
|
|
|
|
|
|
|
|
if (resizeWidth)
|
|
|
|
{
|
|
|
|
// left border
|
|
|
|
if (x < winrect.left + border_width)
|
|
|
|
{
|
|
|
|
*result = HTLEFT;
|
|
|
|
}
|
|
|
|
// right border
|
|
|
|
if (x >= winrect.right - border_width)
|
|
|
|
{
|
|
|
|
*result = HTRIGHT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (resizeHeight)
|
|
|
|
{
|
|
|
|
// bottom border
|
|
|
|
if (y >= winrect.bottom - border_width)
|
|
|
|
{
|
|
|
|
*result = HTBOTTOM;
|
|
|
|
}
|
|
|
|
// top border
|
|
|
|
if (y < winrect.top + border_width)
|
|
|
|
{
|
|
|
|
*result = HTTOP;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (resizeWidth && resizeHeight)
|
|
|
|
{
|
|
|
|
// bottom left corner
|
|
|
|
if (x >= winrect.left && x < winrect.left + border_width &&
|
|
|
|
y < winrect.bottom && y >= winrect.bottom - border_width)
|
|
|
|
{
|
|
|
|
*result = HTBOTTOMLEFT;
|
|
|
|
}
|
|
|
|
// bottom right corner
|
|
|
|
if (x < winrect.right && x >= winrect.right - border_width &&
|
|
|
|
y < winrect.bottom && y >= winrect.bottom - border_width)
|
|
|
|
{
|
|
|
|
*result = HTBOTTOMRIGHT;
|
|
|
|
}
|
|
|
|
// top left corner
|
|
|
|
if (x >= winrect.left && x < winrect.left + border_width &&
|
|
|
|
y >= winrect.top && y < winrect.top + border_width)
|
|
|
|
{
|
|
|
|
*result = HTTOPLEFT;
|
|
|
|
}
|
|
|
|
// top right corner
|
|
|
|
if (x < winrect.right && x >= winrect.right - border_width &&
|
|
|
|
y >= winrect.top && y < winrect.top + border_width)
|
|
|
|
{
|
|
|
|
*result = HTTOPRIGHT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*result == 0)
|
|
|
|
{
|
|
|
|
bool client = false;
|
|
|
|
|
|
|
|
for (QWidget *widget : this->ui_.buttons)
|
|
|
|
{
|
|
|
|
if (widget->geometry().contains(point))
|
|
|
|
{
|
|
|
|
client = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this->ui_.layoutBase->geometry().contains(point))
|
|
|
|
{
|
|
|
|
client = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (client)
|
|
|
|
{
|
|
|
|
*result = HTCLIENT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*result = HTCAPTION;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2019-09-08 22:58:17 +02:00
|
|
|
else if (this->flags_.has(FramelessDraggable))
|
2019-09-08 22:27:57 +02:00
|
|
|
{
|
|
|
|
*result = 0;
|
|
|
|
bool client = false;
|
|
|
|
|
|
|
|
if (auto widget = this->childAt(point))
|
|
|
|
{
|
|
|
|
std::function<bool(QWidget *)> recursiveCheckMouseTracking;
|
|
|
|
recursiveCheckMouseTracking = [&](QWidget *widget) {
|
|
|
|
if (widget == nullptr)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (widget->hasMouseTracking())
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return recursiveCheckMouseTracking(widget->parentWidget());
|
|
|
|
};
|
|
|
|
|
|
|
|
if (recursiveCheckMouseTracking(widget))
|
|
|
|
{
|
|
|
|
client = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (client)
|
|
|
|
{
|
|
|
|
*result = HTCLIENT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*result = HTCAPTION;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2019-10-07 15:46:08 +02:00
|
|
|
} // namespace chatterino
|