CommonHostInterface: Simplify fullscreen toggle
This commit is contained in:
parent
bf6c1c4866
commit
11e8a91e30
|
@ -278,7 +278,7 @@ void QtHostInterface::toggleFullscreen()
|
|||
return;
|
||||
}
|
||||
|
||||
ToggleFullscreen();
|
||||
SetFullscreen(!m_is_fullscreen);
|
||||
}
|
||||
|
||||
bool QtHostInterface::AcquireHostDisplay()
|
||||
|
@ -317,19 +317,19 @@ void QtHostInterface::ReleaseHostDisplay()
|
|||
emit destroyDisplayWindowRequested();
|
||||
}
|
||||
|
||||
void QtHostInterface::SetFullscreen(bool enabled)
|
||||
bool QtHostInterface::IsFullscreen() const
|
||||
{
|
||||
return m_is_fullscreen;
|
||||
}
|
||||
|
||||
bool QtHostInterface::SetFullscreen(bool enabled)
|
||||
{
|
||||
if (m_is_fullscreen == enabled)
|
||||
return;
|
||||
return true;
|
||||
|
||||
m_is_fullscreen = enabled;
|
||||
emit updateDisplayWindowRequested(m_is_fullscreen, m_is_rendering_to_main);
|
||||
}
|
||||
|
||||
void QtHostInterface::ToggleFullscreen()
|
||||
{
|
||||
m_is_fullscreen = !m_is_fullscreen;
|
||||
emit updateDisplayWindowRequested(m_is_fullscreen, m_is_rendering_to_main);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<CommonHostInterface::HostKeyCode> QtHostInterface::GetHostKeyCode(const std::string_view key_code) const
|
||||
|
|
|
@ -120,8 +120,8 @@ private Q_SLOTS:
|
|||
protected:
|
||||
bool AcquireHostDisplay() override;
|
||||
void ReleaseHostDisplay() override;
|
||||
void SetFullscreen(bool enabled) override;
|
||||
void ToggleFullscreen() override;
|
||||
bool IsFullscreen() const override;
|
||||
bool SetFullscreen(bool enabled) override;
|
||||
|
||||
std::optional<HostKeyCode> GetHostKeyCode(const std::string_view key_code) const override;
|
||||
|
||||
|
|
|
@ -51,9 +51,15 @@ void CommonHostInterface::Shutdown()
|
|||
}
|
||||
}
|
||||
|
||||
void CommonHostInterface::SetFullscreen(bool enabled) {}
|
||||
bool CommonHostInterface::IsFullscreen() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void CommonHostInterface::ToggleFullscreen() {}
|
||||
bool CommonHostInterface::SetFullscreen(bool enabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::unique_ptr<AudioStream> CommonHostInterface::CreateAudioStream(AudioBackend backend)
|
||||
{
|
||||
|
@ -88,19 +94,14 @@ std::unique_ptr<ControllerInterface> CommonHostInterface::CreateControllerInterf
|
|||
void CommonHostInterface::OnSystemCreated()
|
||||
{
|
||||
HostInterface::OnSystemCreated();
|
||||
|
||||
if (m_settings.start_fullscreen)
|
||||
SetFullscreen(true);
|
||||
}
|
||||
|
||||
void CommonHostInterface::OnSystemPaused(bool paused)
|
||||
{
|
||||
HostInterface::OnSystemPaused(paused);
|
||||
|
||||
if (paused)
|
||||
if (paused && IsFullscreen())
|
||||
SetFullscreen(false);
|
||||
else if (m_settings.start_fullscreen)
|
||||
SetFullscreen(true);
|
||||
}
|
||||
|
||||
void CommonHostInterface::OnControllerTypeChanged(u32 slot)
|
||||
|
@ -375,7 +376,7 @@ void CommonHostInterface::RegisterGeneralHotkeys()
|
|||
RegisterHotkey(StaticString("General"), StaticString("ToggleFullscreen"), StaticString("Toggle Fullscreen"),
|
||||
[this](bool pressed) {
|
||||
if (!pressed)
|
||||
ToggleFullscreen();
|
||||
SetFullscreen(!IsFullscreen());
|
||||
});
|
||||
|
||||
RegisterHotkey(StaticString("General"), StaticString("TogglePause"), StaticString("Toggle Pause"),
|
||||
|
|
|
@ -46,8 +46,8 @@ protected:
|
|||
CommonHostInterface();
|
||||
~CommonHostInterface();
|
||||
|
||||
virtual void SetFullscreen(bool enabled);
|
||||
virtual void ToggleFullscreen();
|
||||
virtual bool IsFullscreen() const;
|
||||
virtual bool SetFullscreen(bool enabled);
|
||||
|
||||
virtual std::unique_ptr<AudioStream> CreateAudioStream(AudioBackend backend) override;
|
||||
virtual std::unique_ptr<ControllerInterface> CreateControllerInterface();
|
||||
|
|
Loading…
Reference in New Issue