[Development] Setting custom buffer size with Wayland

Ilya Fedin fedin-ilja2010 at ya.ru
Wed Aug 3 23:08:17 CEST 2022

I'm trying to force my window to follow aspect ratio. On other systems
this is possible by changing position/size progrmatically, but Wayland
doesn't let to change window position. I heard that it's possible to
achieve what I want by passing a buffer less than surface size. I
tracked QWaylandShmBuffer size up to QWidgetRepaintManager that just
sets QWidget size. Indeed, if I use private API and change the
data->crect directly, I can change buffer size without changing surface
size. The problem is it works only with raster widgets, I can't find a
way to do the same with OpenGL widgets. I tried to change
QPlatformBackingStoreOpenGLSupport::composeAndFlush so it uses QWidget
size (thanks god I can override the implementation with
QPlatformBackingStoreOpenGLSupportBase::setFactoryFunction), but it
seems this changes only the texture size, but not the buffer size as the
content moved from top left corner to the bottom left corner. Anyway,
even if I found how to change buffer size with it, it won't be valid
with Qt 6.4 anymore due to RHI. Can anyone give a light of how can I
achieve that with OpenGL with both 6.3/6.4 (even if with patching Qt, I
want to see that it's possible at least)? Can we have a
(semi-)public API for that?

More information about the Development mailing list