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_,
|
GRenderWindow::GRenderWindow(GMainWindow* parent, EmuThread* emu_thread_,
|
||||||
std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_,
|
std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_,
|
||||||
Core::System& system_)
|
Core::System& system_)
|
||||||
: QWidget(parent),
|
: QWidget(parent), emu_thread(emu_thread_), input_subsystem{std::move(input_subsystem_)},
|
||||||
emu_thread(emu_thread_), input_subsystem{std::move(input_subsystem_)}, system{system_} {
|
system{system_} {
|
||||||
setWindowTitle(QStringLiteral("eden %1 | %2-%3")
|
setWindowTitle(QStringLiteral("eden %1 | %2-%3")
|
||||||
.arg(QString::fromUtf8(Common::g_build_name),
|
.arg(QString::fromUtf8(Common::g_build_name),
|
||||||
QString::fromUtf8(Common::g_scm_branch),
|
QString::fromUtf8(Common::g_scm_branch),
|
||||||
|
@ -1122,10 +1122,22 @@ void GRenderWindow::OnEmulationStopping() {
|
||||||
void GRenderWindow::showEvent(QShowEvent* event) {
|
void GRenderWindow::showEvent(QShowEvent* event) {
|
||||||
QWidget::showEvent(event);
|
QWidget::showEvent(event);
|
||||||
|
|
||||||
|
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.
|
// windowHandle() is not initialized until the Window is shown, so we connect it here.
|
||||||
connect(windowHandle(), &QWindow::screenChanged, this, &GRenderWindow::OnFramebufferSizeChanged,
|
connect(window, &QWindow::screenChanged, this, &GRenderWindow::OnFramebufferSizeChanged,
|
||||||
Qt::UniqueConnection);
|
Qt::UniqueConnection);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool GRenderWindow::eventFilter(QObject* object, QEvent* event) {
|
bool GRenderWindow::eventFilter(QObject* object, QEvent* event) {
|
||||||
if (event->type() == QEvent::HoverMove) {
|
if (event->type() == QEvent::HoverMove) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue