fixed dpi not initializing when the window shows
This commit is contained in:
@@ -51,6 +51,17 @@ void BaseWidget::init()
|
||||
});
|
||||
}
|
||||
|
||||
void BaseWidget::initAsWindow()
|
||||
{
|
||||
#ifdef USEWINSDK
|
||||
auto dpi = util::getWindowDpi(this->winId());
|
||||
|
||||
if (dpi) {
|
||||
this->dpiMultiplier = dpi.value() / 96.f;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void BaseWidget::refreshTheme()
|
||||
{
|
||||
// Do any color scheme updates here
|
||||
|
||||
@@ -32,6 +32,7 @@ protected:
|
||||
#ifdef USEWINSDK
|
||||
virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
|
||||
#endif
|
||||
void initAsWindow();
|
||||
|
||||
private:
|
||||
float dpiMultiplier = 1.f;
|
||||
|
||||
@@ -16,6 +16,8 @@ EmotePopup::EmotePopup(ColorScheme &colorScheme, EmoteManager &emoteManager,
|
||||
: BaseWidget(colorScheme, 0)
|
||||
, emoteManager(emoteManager)
|
||||
{
|
||||
this->initAsWindow();
|
||||
|
||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||
this->setLayout(layout);
|
||||
layout->setMargin(0);
|
||||
@@ -69,5 +71,5 @@ void EmotePopup::loadChannel(std::shared_ptr<Channel> _channel)
|
||||
|
||||
this->view->setChannel(emoteChannel);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace widgets
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -26,6 +26,8 @@ MainWindow::MainWindow(ChannelManager &_channelManager, ColorScheme &_colorSchem
|
||||
, dpi(this->getDpiMultiplier())
|
||||
// , windowGeometry("/windows/0/geometry")
|
||||
{
|
||||
this->initAsWindow();
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
|
||||
// add titlebar
|
||||
|
||||
Reference in New Issue
Block a user