Make sure wayland surface is created for OpenGL, too.

This commit is contained in:
BearOso 2023-07-16 13:28:44 -05:00
parent 6d71430806
commit 61bafc329d
2 changed files with 3 additions and 5 deletions

View File

@ -94,11 +94,6 @@ void EmuCanvasVulkan::createContext()
if (platform == "wayland") if (platform == "wayland")
{ {
wayland_surface = std::make_unique<WaylandSurface>(); wayland_surface = std::make_unique<WaylandSurface>();
if (!main_window->isVisible())
{
main_window->setVisible(true);
QGuiApplication::processEvents();
}
auto display = (wl_display *)pni->nativeResourceForWindow("display", window); auto display = (wl_display *)pni->nativeResourceForWindow("display", window);
auto surface = (wl_surface *)pni->nativeResourceForWindow("surface", main_window->windowHandle()); auto surface = (wl_surface *)pni->nativeResourceForWindow("surface", main_window->windowHandle());
wayland_surface->attach(display, surface, { parent->x(), parent->y(), width(), height(), static_cast<int>(devicePixelRatio()) }); wayland_surface->attach(display, surface, { parent->x(), parent->y(), width(), height(), static_cast<int>(devicePixelRatio()) });

View File

@ -6,6 +6,7 @@
#include <QtEvents> #include <QtEvents>
#include <QGuiApplication> #include <QGuiApplication>
#include <QStackedWidget> #include <QStackedWidget>
#include <qguiapplication.h>
#include <qnamespace.h> #include <qnamespace.h>
#include <qpa/qplatformnativeinterface.h> #include <qpa/qplatformnativeinterface.h>
@ -82,6 +83,8 @@ void EmuMainWindow::createCanvas()
if (QGuiApplication::platformName() == "wayland" && app->config->display_driver != "qt") if (QGuiApplication::platformName() == "wayland" && app->config->display_driver != "qt")
{ {
auto central_widget = new QStackedWidget(); auto central_widget = new QStackedWidget();
setVisible(true);
QGuiApplication::processEvents();
if (app->config->display_driver == "vulkan") if (app->config->display_driver == "vulkan")
{ {