mirror of https://github.com/snes9xgit/snes9x.git
Qt/Wayland: Fix case when window is reparented for server-side decoration.
Apparently the top-level window surface can start at negative coordinates, so the subsurface needs to be offset by that much more.
This commit is contained in:
parent
953de52465
commit
bd918f60fb
|
@ -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
|
||||
|
|
|
@ -100,7 +100,7 @@ bool EmuCanvasVulkan::createContext()
|
|||
wayland_surface = std::make_unique<WaylandSurface>();
|
||||
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<int>(devicePixelRatio()) });
|
||||
wayland_surface->attach(display, surface, { parent->x() - main_window->x(), parent->y() - main_window->y(), width(), height(), static_cast<int>(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.
|
||||
|
|
Loading…
Reference in New Issue