mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
fixed maximized mode margin on windows
This commit is contained in:
parent
63c213a36a
commit
0d499313e2
2 changed files with 15 additions and 0 deletions
|
@ -83,6 +83,7 @@ void BaseWindow::init()
|
||||||
if (this->hasCustomWindowFrame()) {
|
if (this->hasCustomWindowFrame()) {
|
||||||
// CUSTOM WINDOW FRAME
|
// CUSTOM WINDOW FRAME
|
||||||
QVBoxLayout *layout = new QVBoxLayout();
|
QVBoxLayout *layout = new QVBoxLayout();
|
||||||
|
this->ui_.windowLayout = layout;
|
||||||
layout->setContentsMargins(0, 1, 0, 0);
|
layout->setContentsMargins(0, 1, 0, 0);
|
||||||
layout->setSpacing(0);
|
layout->setSpacing(0);
|
||||||
this->setLayout(layout);
|
this->setLayout(layout);
|
||||||
|
@ -464,6 +465,19 @@ bool BaseWindow::nativeEvent(const QByteArray &eventType, void *message, long *r
|
||||||
return QWidget::nativeEvent(eventType, message, result);
|
return QWidget::nativeEvent(eventType, message, result);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
case WM_SIZE: {
|
||||||
|
if (this->ui_.windowLayout) {
|
||||||
|
if (msg->wParam == SIZE_MAXIMIZED) {
|
||||||
|
auto offset = int(this->getScale() * 8);
|
||||||
|
|
||||||
|
this->ui_.windowLayout->setContentsMargins(offset, offset, offset, offset);
|
||||||
|
} else {
|
||||||
|
this->ui_.windowLayout->setContentsMargins(0, 1, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return QWidget::nativeEvent(eventType, message, result);
|
||||||
|
}
|
||||||
case WM_NCHITTEST: {
|
case WM_NCHITTEST: {
|
||||||
const LONG border_width = 8; // in pixels
|
const LONG border_width = 8; // in pixels
|
||||||
RECT winrect;
|
RECT winrect;
|
||||||
|
|
|
@ -84,6 +84,7 @@ private:
|
||||||
float nativeScale_ = 1;
|
float nativeScale_ = 1;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
QLayout *windowLayout = nullptr;
|
||||||
QHBoxLayout *titlebarBox = nullptr;
|
QHBoxLayout *titlebarBox = nullptr;
|
||||||
QWidget *titleLabel = nullptr;
|
QWidget *titleLabel = nullptr;
|
||||||
TitleBarButton *minButton = nullptr;
|
TitleBarButton *minButton = nullptr;
|
||||||
|
|
Loading…
Reference in a new issue