Skip to content

Commit

Permalink
Merge pull request #6510 from spycrab/qt_autoadjust
Browse files Browse the repository at this point in the history
Qt: Implement "Auto-Adjust Window Size"
  • Loading branch information
leoetlino committed Mar 24, 2018
2 parents a838d13 + 8069909 commit 304aeaa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Source/Core/DolphinQt2/Host.cpp
Expand Up @@ -115,9 +115,12 @@ void Host_UpdateProgressDialog(const char* caption, int position, int total)
void Host_UpdateMainFrame()
{
}

void Host_RequestRenderWindowSize(int w, int h)
{
emit Host::GetInstance()->RequestRenderSize(w, h);
}

bool Host_UINeedsControllerState()
{
return Settings::Instance().IsControllerStateNeeded();
Expand Down
7 changes: 7 additions & 0 deletions Source/Core/DolphinQt2/RenderWidget.cpp
Expand Up @@ -5,6 +5,7 @@
#include <QKeyEvent>
#include <QTimer>

#include "Core/ConfigManager.h"
#include "DolphinQt2/Host.h"
#include "DolphinQt2/RenderWidget.h"
#include "DolphinQt2/Settings.h"
Expand All @@ -15,6 +16,12 @@ RenderWidget::RenderWidget(QWidget* parent) : QWidget(parent)
setAttribute(Qt::WA_NoSystemBackground, true);

connect(Host::GetInstance(), &Host::RequestTitle, this, &RenderWidget::setWindowTitle);
connect(Host::GetInstance(), &Host::RequestRenderSize, this, [this](int w, int h) {
if (!SConfig::GetInstance().bRenderWindowAutoSize || isFullScreen() || isMaximized())
return;

resize(w, h);
});

// We have to use Qt::DirectConnection here because we don't want those signals to get queued
// (which results in them not getting called)
Expand Down

0 comments on commit 304aeaa

Please sign in to comment.