mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-22 05:45:38 +00:00
Qt: Fix returning from fullscreen on MacOS
This commit is contained in:
parent
fffde62e3e
commit
546f73e36a
|
@ -5,10 +5,10 @@
|
|||
#include "common/assert.h"
|
||||
#include "common/bitutils.h"
|
||||
#include "common/log.h"
|
||||
#include "util/imgui_manager.h"
|
||||
#include "mainwindow.h"
|
||||
#include "qthost.h"
|
||||
#include "qtutils.h"
|
||||
#include "util/imgui_manager.h"
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QKeyEvent>
|
||||
|
@ -148,6 +148,20 @@ void DisplayWidget::handleCloseEvent(QCloseEvent* event)
|
|||
event->ignore();
|
||||
}
|
||||
|
||||
void DisplayWidget::destroy()
|
||||
{
|
||||
m_destroying = true;
|
||||
|
||||
#ifdef __APPLE__
|
||||
// See Qt documentation, entire application is in full screen state, and the main
|
||||
// window will get reopened fullscreen instead of windowed if we don't close the
|
||||
// fullscreen window first.
|
||||
if (isFullScreen())
|
||||
close();
|
||||
#endif
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
void DisplayWidget::updateCenterPos()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
@ -339,6 +353,9 @@ bool DisplayWidget::event(QEvent* event)
|
|||
|
||||
case QEvent::Close:
|
||||
{
|
||||
if (m_destroying)
|
||||
return QWidget::event(event);
|
||||
|
||||
handleCloseEvent(static_cast<QCloseEvent*>(event));
|
||||
return true;
|
||||
}
|
||||
|
@ -358,7 +375,9 @@ bool DisplayWidget::event(QEvent* event)
|
|||
}
|
||||
}
|
||||
|
||||
DisplayContainer::DisplayContainer() : QStackedWidget(nullptr) {}
|
||||
DisplayContainer::DisplayContainer() : QStackedWidget(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
DisplayContainer::~DisplayContainer() = default;
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
void updateCursor(bool hidden);
|
||||
|
||||
void handleCloseEvent(QCloseEvent* event);
|
||||
void destroy();
|
||||
|
||||
Q_SIGNALS:
|
||||
void windowResizedEvent(int width, int height, float scale);
|
||||
|
@ -54,6 +55,7 @@ private:
|
|||
bool m_clip_mouse_enabled = false;
|
||||
#endif
|
||||
bool m_cursor_hidden = false;
|
||||
bool m_destroying = false;
|
||||
|
||||
std::vector<u32> m_keys_pressed_with_modifiers;
|
||||
|
||||
|
|
|
@ -277,9 +277,6 @@ std::optional<WindowInfo> MainWindow::acquireRenderWindow(bool recreate_window,
|
|||
|
||||
createDisplayWidget(fullscreen, render_to_main, use_main_window_pos);
|
||||
|
||||
// we need the surface visible.. this might be able to be replaced with something else
|
||||
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
|
||||
std::optional<WindowInfo> wi = m_display_widget->getWindowInfo();
|
||||
if (!wi.has_value())
|
||||
{
|
||||
|
@ -447,7 +444,7 @@ void MainWindow::destroyDisplayWidget(bool show_game_list)
|
|||
|
||||
if (m_display_widget)
|
||||
{
|
||||
m_display_widget->deleteLater();
|
||||
m_display_widget->destroy();
|
||||
m_display_widget = nullptr;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue