Fixes #538 multiple window frames on windows

This commit is contained in:
fourtf
2018-07-03 12:07:57 +02:00
parent 978931bcfc
commit eb809d1572
4 changed files with 39 additions and 21 deletions
+14 -19
View File
@@ -249,11 +249,11 @@ void BaseWindow::wheelEvent(QWheelEvent *event)
if (event->modifiers() & Qt::ControlModifier) {
if (event->delta() > 0) {
getApp()->settings->uiScale.setValue(WindowManager::clampUiScale(
getApp()->settings->uiScale.getValue() + 1));
getApp()->settings->uiScale.setValue(
WindowManager::clampUiScale(getApp()->settings->uiScale.getValue() + 1));
} else {
getApp()->settings->uiScale.setValue(WindowManager::clampUiScale(
getApp()->settings->uiScale.getValue() - 1));
getApp()->settings->uiScale.setValue(
WindowManager::clampUiScale(getApp()->settings->uiScale.getValue() - 1));
}
}
}
@@ -443,6 +443,16 @@ bool BaseWindow::nativeEvent(const QByteArray &eventType, void *message, long *r
this->updateScale();
}
if (!this->shown_ && this->isVisible() && this->hasCustomWindowFrame()) {
this->shown_ = true;
// SetWindowLongPtr((HWND)this->winId(), GWL_STYLE,
// WS_POPUP | WS_CAPTION | WS_THICKFRAME | WS_MAXIMIZEBOX |
// WS_MINIMIZEBOX);
const MARGINS shadow = {8, 8, 8, 8};
DwmExtendFrameIntoClientArea(HWND(this->winId()), &shadow);
}
return true;
}
case WM_NCCALCSIZE: {
@@ -609,21 +619,6 @@ bool BaseWindow::nativeEvent(const QByteArray &eventType, void *message, long *r
}
}
void BaseWindow::showEvent(QShowEvent *event)
{
if (!this->shown_ && this->isVisible() && this->hasCustomWindowFrame()) {
this->shown_ = true;
// SetWindowLongPtr((HWND)this->winId(), GWL_STYLE,
// WS_POPUP | WS_CAPTION | WS_THICKFRAME | WS_MAXIMIZEBOX |
// WS_MINIMIZEBOX);
const MARGINS shadow = {8, 8, 8, 8};
DwmExtendFrameIntoClientArea(HWND(this->winId()), &shadow);
}
BaseWidget::showEvent(event);
}
void BaseWindow::scaleChangedEvent(float)
{
this->calcButtonsSizes();