-
-
Notifications
You must be signed in to change notification settings - Fork 981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Wayland support #3142
Add Wayland support #3142
Conversation
- This is WIP and is largely incomplete - It marginally works in case of SDL and has not been tested for Qt or barebones `SDK_VIDEODRIVER=wayland ./SampleBrowser` is able to start a wayland window with contents, but there is several issues. - The [Bites] WindowEventUtilities only has X11 impl and needs a wayland alternative - No implementation of getVideoModes (resolution and refresh rates)
- Link to wayland stuff in OgreBites also if SDL2 is not found
RenderSystems/GLSupport/src/EGL/Wayland/OgreWaylandEGLSupport.cpp
Outdated
Show resolved
Hide resolved
RenderSystems/GLSupport/src/EGL/Wayland/OgreWaylandEGLWindow.cpp
Outdated
Show resolved
Hide resolved
- This removes dependency on wayland-protocols since xdg_shell is not used - Also removes other unneeded implementations as suggested by reviewer
Regarding loosing mouse motion events: It is lost if the user clicks on the window title line (or moves the window) and then clicks somewhere inside the window. |
RenderSystems/GLSupport/src/EGL/Wayland/OgreWaylandEGLWindow.cpp
Outdated
Show resolved
Hide resolved
- Remove externalWindowHandle from application contexts, unused - Add suggestions regarding assert if wayland and where - Remove unused render target variables, such as WINDOW - Do not override getCustomAttributes, since no additions are made - Rename externalDisplay to externalWlDisplay
This comment was marked as resolved.
This comment was marked as resolved.
RenderSystems/GLSupport/src/EGL/Wayland/OgreWaylandEGLWindow.cpp
Outdated
Show resolved
Hide resolved
RenderSystems/GLSupport/src/EGL/Wayland/OgreWaylandEGLWindow.cpp
Outdated
Show resolved
Hide resolved
RenderSystems/GLSupport/src/EGL/Wayland/OgreWaylandEGLWindow.cpp
Outdated
Show resolved
Hide resolved
I think this is in a pretty good shape for merging now. The comment spam is mostly a checklist for myself as it might take me a few weeks until I can fix this up. Of course you can do the remaining fixes yourself too :) other things to watch out:
|
RenderSystems/GLSupport/src/EGL/Wayland/OgreWaylandEGLSupport.cpp
Outdated
Show resolved
Hide resolved
- Also move location for checking of X11 window handle in wayland code
|
ApplicationContextQt is still not functional. An error similar to: https://bugreports.qt.io/browse/QTBUG-123866 |
it would be totally fine by me if Wayland support would be only available with Qt >= 6.5 |
Ok. I will investigate further to see if a newer Qt version is beneficial |
@@ -129,7 +135,27 @@ namespace OgreBites | |||
p.width = window->width(); | |||
p.height= window->height(); | |||
|
|||
p.miscParams["externalWindowHandle"] = std::to_string(size_t(window->winId())); | |||
if (QGuiApplication::platformName() != "wayland") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to investigate whether other platform names may be relevant too.
https://github.com/qt/qtwayland/blob/dev/README
I guess the problem is that it does not pass any miscParams:
which is a nice test case actually. We should assert instead of segfaulting in this case as on Vulkan:
but yeah.. for merging we should either revert the CI to X11 or fix that I think maintaining CI with X11 could be advantageous since X11 will likely stay prevalent for a few more years. For now, we could modify the "custombuild" target to just compile-test Wayland. |
+ This commit also removes wayland from the regular build + Add wayland to custombuild to test build it
Some of the interface is nicer for Qt 6.5+, but there will still be a need for including a private header, even at Qt 6.7. Specifically the Since an implementation need to use QtGui::Private and deal with version-specific includes anyways, I do not see the point of restricting Ogre with Wayland to 6.5+ (unless there are other features unknown to me). |
- This also configures a qt version-specific include for native interface
tested this locally on Ubuntu 22.04 and added some final fixes. I would merge this next, if it is done from your side. Out of curiosity as I did not test: does Wayland on Qt work in the current state? |
No it does not. I suspect there is something missing regarding handling of the wl_surface but I do not know what. Maybe somehow initalise xdg_surface or indicate that it is a parent window. But these are guesses. I don't have time to look more into this for the time being. |
I just tested it on Ubuntu 22.04 & Qt 6.2.4 and I get an undecorated window with the wrong resolution. However input is already working. So likely not much is missing. |
This PR fixes issue #2432
Implement support for Wayland with EGL in GLSupport.
The functionality is enabled at compile type by cmake option
OGRE_GLSUPPORT_USE_WAYLAND
, provided that EGL headers are found. Note that when Wayland is enabled, X11 is unavailable.Some new packages will need to be installed to compile it (tested on Debian 12):
libwayland-dev libwayland-egl wayland-protocols pkg-config
For Qt (in addition to default Core and Gui): At least also
qtwayland5
andqttools5-private-dev
. Tested with Qt 5.15.8.Once compiled and installed, the feature can be tested with the sample browser.
It is important to explicitly select wayland when starting the application as follows:
SDL_VIDEODRIVER=wayland ./SampleBrowser
Likewise when using ApplicationContextQt:
./MyOgreQt -platform wayland
orQT_QPA_PLATFORM=wayland ./MyOgreQt
. Note: Ogre Qt and Wayland does not work yet.This new feature has been tested on Debian 12 on WSL2. There are several things that should be tested and fixed before merging.
bgfx
to be able to create egl surface external to SDL (see link to issue inApplicationContextSDL.cpp
below).