aboutsummaryrefslogtreecommitdiff
path: root/zola-static/content/blog/sdl-native-wayland/index.md
diff options
context:
space:
mode:
authorJack Jamison <jackqjamison@gmail.com>2025-12-26 18:48:58 -0500
committerJack Jamison <jackqjamison@gmail.com>2025-12-26 18:48:58 -0500
commitfad3843b2ba6176a4c0834b66e27584fcf7aed17 (patch)
tree5e53bf449392605d78912b620b22273a950c1516 /zola-static/content/blog/sdl-native-wayland/index.md
parentbe3a5f44a4eba7ca68839e1456553d5cc7399395 (diff)
move articles to directories
Diffstat (limited to 'zola-static/content/blog/sdl-native-wayland/index.md')
-rw-r--r--zola-static/content/blog/sdl-native-wayland/index.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/zola-static/content/blog/sdl-native-wayland/index.md b/zola-static/content/blog/sdl-native-wayland/index.md
new file mode 100644
index 0000000..1f163f7
--- /dev/null
+++ b/zola-static/content/blog/sdl-native-wayland/index.md
@@ -0,0 +1,19 @@
++++
+title = "Why SDL3 doesn't use Wayland on Wayland."
+date = 2025-08-06
+updated = 2025-08-08
++++
+
+[SDL3](https://wiki.libsdl.org/SDL3/FrontPage) is a great platform abstraction layer. On Linux, it compiles with support for both [X Window System](https://www.x.org/wiki/) and [Wayland](https://wayland.freedesktop.org/). This is great because it makes your app compatible with just about any desktop environment or window manager. In the [SDL3 documentation](https://wiki.libsdl.org/SDL3/README-wayland) it says that
+> Wayland is a replacement for the X11 window system protocol and architecture and is favored over X11 by default in SDL3
+
+However, if your compositor does not implement the `wp_fifo_manager_v1` protocol SDL will fall back to XWayland. My compositor doesn't have it, and here's how I forced SDL to use Wayland anyway (for c++).
+```c++
+for (int i = 0; i < SDL_GetNumVideoDrivers(); i++) {
+ if (std::string(SDL_GetVideoDriver(i)) == "wayland") {
+ SDL_SetHintWithPriority(SDL_HINT_VIDEO_DRIVER, "wayland", SDL_HINT_OVERRIDE);
+ break;
+ }
+}
+```
+This code will explicitly enable Wayland if it is available.