Fixes #538 multiple window frames on windows
This commit is contained in:
+2
-1
@@ -392,7 +392,8 @@ HEADERS += \
|
|||||||
src/singletons/NativeMessaging.hpp \
|
src/singletons/NativeMessaging.hpp \
|
||||||
src/singletons/Theme.hpp \
|
src/singletons/Theme.hpp \
|
||||||
src/common/SimpleSignalVector.hpp \
|
src/common/SimpleSignalVector.hpp \
|
||||||
src/common/SignalVector.hpp
|
src/common/SignalVector.hpp \
|
||||||
|
src/common/Singleton.hpp
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
resources/resources.qrc \
|
resources/resources.qrc \
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <boost/noncopyable.hpp>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
|
class Application;
|
||||||
|
|
||||||
|
class Singleton : boost::noncopyable
|
||||||
|
{
|
||||||
|
virtual ~Singleton() = default;
|
||||||
|
|
||||||
|
virtual void initialize(Application &application)
|
||||||
|
{
|
||||||
|
(void)(application);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void finalize()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace chatterino
|
||||||
+14
-19
@@ -249,11 +249,11 @@ void BaseWindow::wheelEvent(QWheelEvent *event)
|
|||||||
|
|
||||||
if (event->modifiers() & Qt::ControlModifier) {
|
if (event->modifiers() & Qt::ControlModifier) {
|
||||||
if (event->delta() > 0) {
|
if (event->delta() > 0) {
|
||||||
getApp()->settings->uiScale.setValue(WindowManager::clampUiScale(
|
getApp()->settings->uiScale.setValue(
|
||||||
getApp()->settings->uiScale.getValue() + 1));
|
WindowManager::clampUiScale(getApp()->settings->uiScale.getValue() + 1));
|
||||||
} else {
|
} else {
|
||||||
getApp()->settings->uiScale.setValue(WindowManager::clampUiScale(
|
getApp()->settings->uiScale.setValue(
|
||||||
getApp()->settings->uiScale.getValue() - 1));
|
WindowManager::clampUiScale(getApp()->settings->uiScale.getValue() - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -443,6 +443,16 @@ bool BaseWindow::nativeEvent(const QByteArray &eventType, void *message, long *r
|
|||||||
this->updateScale();
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
case WM_NCCALCSIZE: {
|
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)
|
void BaseWindow::scaleChangedEvent(float)
|
||||||
{
|
{
|
||||||
this->calcButtonsSizes();
|
this->calcButtonsSizes();
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
#ifdef USEWINSDK
|
#ifdef USEWINSDK
|
||||||
virtual void showEvent(QShowEvent *) override;
|
|
||||||
virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
|
virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
|
||||||
virtual void scaleChangedEvent(float) override;
|
virtual void scaleChangedEvent(float) override;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user