Get rid of _nativeFrame variable, _title->isHidden is enough
This commit is contained in:
parent
381bfc43c5
commit
98c7979e67
4 changed files with 11 additions and 15 deletions
|
|
@ -146,7 +146,7 @@ DefaultWindowHelper::DefaultWindowHelper(not_null<RpWidget*> window)
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefaultWindowHelper::init() {
|
void DefaultWindowHelper::init() {
|
||||||
_title->show(); // Be consistent with _nativeFrame == false.
|
_title->show();
|
||||||
window()->setWindowFlag(Qt::FramelessWindowHint);
|
window()->setWindowFlag(Qt::FramelessWindowHint);
|
||||||
|
|
||||||
if (WindowExtentsSupported()) {
|
if (WindowExtentsSupported()) {
|
||||||
|
|
@ -251,7 +251,7 @@ bool DefaultWindowHelper::hasShadow() const {
|
||||||
QMargins DefaultWindowHelper::resizeArea() const {
|
QMargins DefaultWindowHelper::resizeArea() const {
|
||||||
if (window()->isMaximized()
|
if (window()->isMaximized()
|
||||||
|| window()->isFullScreen()
|
|| window()->isFullScreen()
|
||||||
|| _nativeFrame) {
|
|| _title->isHidden()) {
|
||||||
return QMargins();
|
return QMargins();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -329,7 +329,6 @@ void DefaultWindowHelper::setTitleStyle(const style::WindowTitle &st) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefaultWindowHelper::setNativeFrame(bool enabled) {
|
void DefaultWindowHelper::setNativeFrame(bool enabled) {
|
||||||
_nativeFrame = enabled;
|
|
||||||
window()->windowHandle()->setFlag(Qt::FramelessWindowHint, !enabled);
|
window()->windowHandle()->setFlag(Qt::FramelessWindowHint, !enabled);
|
||||||
_title->setVisible(!enabled);
|
_title->setVisible(!enabled);
|
||||||
updateWindowExtents();
|
updateWindowExtents();
|
||||||
|
|
@ -395,7 +394,7 @@ void DefaultWindowHelper::paintBorders(QPainter &p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefaultWindowHelper::updateWindowExtents() {
|
void DefaultWindowHelper::updateWindowExtents() {
|
||||||
if (hasShadow() && !_nativeFrame) {
|
if (hasShadow() && !_title->isHidden()) {
|
||||||
Platform::SetWindowExtents(
|
Platform::SetWindowExtents(
|
||||||
window()->windowHandle(),
|
window()->windowHandle(),
|
||||||
resizeArea());
|
resizeArea());
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,6 @@ private:
|
||||||
const not_null<DefaultTitleWidget*> _title;
|
const not_null<DefaultTitleWidget*> _title;
|
||||||
const not_null<RpWidget*> _body;
|
const not_null<RpWidget*> _body;
|
||||||
bool _extentsSet = false;
|
bool _extentsSet = false;
|
||||||
bool _nativeFrame = false;
|
|
||||||
rpl::variable<Qt::WindowStates> _windowState = Qt::WindowNoState;
|
rpl::variable<Qt::WindowStates> _windowState = Qt::WindowNoState;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,6 @@ void WindowHelper::setTitleStyle(const style::WindowTitle &st) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowHelper::setNativeFrame(bool enabled) {
|
void WindowHelper::setNativeFrame(bool enabled) {
|
||||||
_nativeFrame = enabled;
|
|
||||||
_title->setVisible(!enabled);
|
_title->setVisible(!enabled);
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
_shadow.reset();
|
_shadow.reset();
|
||||||
|
|
@ -217,7 +216,7 @@ void WindowHelper::showNormal() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowHelper::init() {
|
void WindowHelper::init() {
|
||||||
_title->show(); // Be consistent with _nativeFrame == false.
|
_title->show();
|
||||||
GetNativeFilter()->registerWindow(_handle, this);
|
GetNativeFilter()->registerWindow(_handle, this);
|
||||||
|
|
||||||
style::PaletteChanged(
|
style::PaletteChanged(
|
||||||
|
|
@ -290,14 +289,14 @@ bool WindowHelper::handleNativeEvent(
|
||||||
} return false;
|
} return false;
|
||||||
|
|
||||||
case WM_NCPAINT: {
|
case WM_NCPAINT: {
|
||||||
if (::Platform::IsWindows8OrGreater() || _nativeFrame) {
|
if (::Platform::IsWindows8OrGreater() || _title->isHidden()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (result) *result = 0;
|
if (result) *result = 0;
|
||||||
} return true;
|
} return true;
|
||||||
|
|
||||||
case WM_NCCALCSIZE: {
|
case WM_NCCALCSIZE: {
|
||||||
if (_nativeFrame) {
|
if (_title->isHidden()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
WINDOWPLACEMENT wp;
|
WINDOWPLACEMENT wp;
|
||||||
|
|
@ -343,7 +342,7 @@ bool WindowHelper::handleNativeEvent(
|
||||||
} return true;
|
} return true;
|
||||||
|
|
||||||
case WM_NCACTIVATE: {
|
case WM_NCACTIVATE: {
|
||||||
if (_nativeFrame) {
|
if (_title->isHidden()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (IsCompositionEnabled()) {
|
if (IsCompositionEnabled()) {
|
||||||
|
|
@ -416,7 +415,7 @@ bool WindowHelper::handleNativeEvent(
|
||||||
} return false;
|
} return false;
|
||||||
|
|
||||||
case WM_NCHITTEST: {
|
case WM_NCHITTEST: {
|
||||||
if (!result || _nativeFrame) {
|
if (!result || _title->isHidden()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -449,7 +448,7 @@ bool WindowHelper::handleNativeEvent(
|
||||||
} return true;
|
} return true;
|
||||||
|
|
||||||
case WM_NCRBUTTONUP: {
|
case WM_NCRBUTTONUP: {
|
||||||
if (_nativeFrame) {
|
if (_title->isHidden()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
SendMessage(_handle, WM_SYSCOMMAND, SC_MOUSEMENU, lParam);
|
SendMessage(_handle, WM_SYSCOMMAND, SC_MOUSEMENU, lParam);
|
||||||
|
|
@ -566,9 +565,9 @@ void WindowHelper::updateMargins() {
|
||||||
_marginsDelta = QMargins();
|
_marginsDelta = QMargins();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_isFullScreen || _nativeFrame) {
|
if (_isFullScreen || _title->isHidden()) {
|
||||||
margins = QMargins();
|
margins = QMargins();
|
||||||
if (_nativeFrame) {
|
if (_title->isHidden()) {
|
||||||
_marginsDelta = QMargins();
|
_marginsDelta = QMargins();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,6 @@ private:
|
||||||
QMargins _marginsDelta;
|
QMargins _marginsDelta;
|
||||||
HMENU _menu = nullptr;
|
HMENU _menu = nullptr;
|
||||||
bool _isFullScreen = false;
|
bool _isFullScreen = false;
|
||||||
bool _nativeFrame = false;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue