docs: Add Wayland to the SysWM migration example
Wayland will be increasingly encountered going forward and needs to be handled by applications requesting window handles to initialize the Vulkan WSI and such, so include it in the migration example to reflect current best practices.main
parent
c03c01e9b2
commit
73d02184d7
|
@ -1219,14 +1219,20 @@ The information previously available in SDL_GetWindowWMInfo() is now available a
|
|||
...
|
||||
}
|
||||
#elif defined(__LINUX__)
|
||||
Display *xdisplay = NULL;
|
||||
Window xwindow = 0;
|
||||
if (SDL_GetWindowWMInfo(window, &info) && info.subsystem == SDL_SYSWM_X11) {
|
||||
xdisplay = info.info.x11.display;
|
||||
xwindow = info.info.x11.window;
|
||||
}
|
||||
if (xdisplay && xwindow) {
|
||||
...
|
||||
if (SDL_GetWindowWMInfo(window, &info)) {
|
||||
if (info.subsystem == SDL_SYSWM_X11) {
|
||||
Display *xdisplay = info.info.x11.display;
|
||||
Window xwindow = info.info.x11.window;
|
||||
if (xdisplay && xwindow) {
|
||||
...
|
||||
}
|
||||
} else if (info.subsystem == SDL_SYSWM_WAYLAND) {
|
||||
struct wl_display *display = info.info.wl.display;
|
||||
struct wl_surface *surface = info.info.wl.surface;
|
||||
if (display && surface) {
|
||||
...
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
```
|
||||
|
@ -1243,10 +1249,18 @@ becomes:
|
|||
...
|
||||
}
|
||||
#elif defined(__LINUX__)
|
||||
Display *xdisplay = (Display *)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.x11.display", NULL);
|
||||
Window xwindow = (Window)SDL_GetNumberProperty(SDL_GetWindowProperties(window), "SDL.window.x11.window", 0);
|
||||
if (xdisplay && xwindow) {
|
||||
...
|
||||
if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "x11") == 0) {
|
||||
Display *xdisplay = (Display *)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.x11.display", NULL);
|
||||
Window xwindow = (Window)SDL_GetNumberProperty(SDL_GetWindowProperties(window), "SDL.window.x11.window", 0);
|
||||
if (xdisplay && xwindow) {
|
||||
...
|
||||
}
|
||||
} else if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0) {
|
||||
struct wl_display *display = (struct wl_display *)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.wayland.display", NULL);
|
||||
struct wl_surface *surface = (struct wl_surface *)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.wayland.surface", NULL);
|
||||
if (display && surface) {
|
||||
...
|
||||
}
|
||||
}
|
||||
#endif
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue