forked from eden-emu/eden
[frontend] Detect windowHandle properly when GRenderWindow
is not native.
This commit is contained in:
parent
b6a5462faf
commit
78c138d35f
1 changed files with 17 additions and 5 deletions
|
@ -284,8 +284,8 @@ struct NullRenderWidget : public RenderWidget {
|
|||
GRenderWindow::GRenderWindow(GMainWindow* parent, EmuThread* emu_thread_,
|
||||
std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_,
|
||||
Core::System& system_)
|
||||
: QWidget(parent),
|
||||
emu_thread(emu_thread_), input_subsystem{std::move(input_subsystem_)}, system{system_} {
|
||||
: QWidget(parent), emu_thread(emu_thread_), input_subsystem{std::move(input_subsystem_)},
|
||||
system{system_} {
|
||||
setWindowTitle(QStringLiteral("eden %1 | %2-%3")
|
||||
.arg(QString::fromUtf8(Common::g_build_name),
|
||||
QString::fromUtf8(Common::g_scm_branch),
|
||||
|
@ -1122,9 +1122,21 @@ void GRenderWindow::OnEmulationStopping() {
|
|||
void GRenderWindow::showEvent(QShowEvent* event) {
|
||||
QWidget::showEvent(event);
|
||||
|
||||
// windowHandle() is not initialized until the Window is shown, so we connect it here.
|
||||
connect(windowHandle(), &QWindow::screenChanged, this, &GRenderWindow::OnFramebufferSizeChanged,
|
||||
Qt::UniqueConnection);
|
||||
QWindow* window = windowHandle();
|
||||
if (!window) {
|
||||
QWidget* nativeParent = nativeParentWidget();
|
||||
if (nativeParent) {
|
||||
window = nativeParent->windowHandle();
|
||||
}
|
||||
}
|
||||
if (!window) {
|
||||
LOG_ERROR(Frontend, "Failed to acquire QWindow pointer of GRenderWindow. ScreenChanged "
|
||||
"signal not connected.");
|
||||
} else {
|
||||
// windowHandle() is not initialized until the Window is shown, so we connect it here.
|
||||
connect(window, &QWindow::screenChanged, this, &GRenderWindow::OnFramebufferSizeChanged,
|
||||
Qt::UniqueConnection);
|
||||
}
|
||||
}
|
||||
|
||||
bool GRenderWindow::eventFilter(QObject* object, QEvent* event) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue