diff --git a/qt/src/EmuCanvasOpenGL.cpp b/qt/src/EmuCanvasOpenGL.cpp index 4a3a0668..ee3f61a5 100644 --- a/qt/src/EmuCanvasOpenGL.cpp +++ b/qt/src/EmuCanvasOpenGL.cpp @@ -138,7 +138,7 @@ bool EmuCanvasOpenGL::createContext() auto wayland_egl_context = new WaylandEGLContext(); int s = devicePixelRatio(); - if (!wayland_egl_context->attach(display, surface, { parent->x(), parent->y(), parent->width(), parent->height(), s })) + if (!wayland_egl_context->attach(display, surface, { parent->x() - main_window->x(), parent->y() - main_window->y(), parent->width(), parent->height(), s })) { printf("Couldn't attach context to wayland surface.\n"); context.reset(); @@ -311,7 +311,7 @@ void EmuCanvasOpenGL::resizeEvent(QResizeEvent *event) auto platform = QGuiApplication::platformName(); #ifndef _WIN32 if (QGuiApplication::platformName() == "wayland") - ((WaylandEGLContext *)context.get())->resize({ g.x(), g.y(), g.width(), g.height(), s }); + ((WaylandEGLContext *)context.get())->resize({ g.x() - main_window->x(), g.y() - main_window->y(), g.width(), g.height(), s }); else if (platform == "xcb") ((GTKGLXContext *)context.get())->resize(); #else diff --git a/qt/src/EmuCanvasVulkan.cpp b/qt/src/EmuCanvasVulkan.cpp index 2e43948f..d4c49c60 100644 --- a/qt/src/EmuCanvasVulkan.cpp +++ b/qt/src/EmuCanvasVulkan.cpp @@ -100,7 +100,7 @@ bool EmuCanvasVulkan::createContext() wayland_surface = std::make_unique(); auto display = (wl_display *)pni->nativeResourceForWindow("display", window); auto surface = (wl_surface *)pni->nativeResourceForWindow("surface", main_window->windowHandle()); - wayland_surface->attach(display, surface, { parent->x(), parent->y(), width(), height(), static_cast(devicePixelRatio()) }); + wayland_surface->attach(display, surface, { parent->x() - main_window->x(), parent->y() - main_window->y(), width(), height(), static_cast(devicePixelRatio()) }); auto [scaled_width, scaled_height] = wayland_surface->get_size(); if (!context->init_wayland(display, wayland_surface->child, scaled_width, scaled_height, config->display_device_index)) { @@ -228,7 +228,7 @@ void EmuCanvasVulkan::resizeEvent(QResizeEvent *event) #ifndef _WIN32 if (platform == "wayland") { - wayland_surface->resize({ parent->x(), parent->y(), width, height, (int)devicePixelRatio() }); + wayland_surface->resize({ parent->x() - main_window->x(), parent->y() - main_window->y(), width, height, (int)devicePixelRatio() }); std::tie(width, height) = wayland_surface->get_size(); // On Wayland, Vulkan WSI provides the buffer for the subsurface, // so we have to specify a width and height instead of polling the parent.