Updated SDL_syswm.h for SDL 3.0

* The header is no longer dependent on SDL build configuration
* The structures are versioned separately from the rest of SDL
* SDL_GetWindowWMInfo() now returns a standard result code and is passed the version expected by the application
* Updated WhatsNew.txt and docs/README-migration.md with the first API changes in SDL 3.0
This commit is contained in:
Sam Lantinga 2022-11-23 13:33:48 -08:00
parent 53ca1f7702
commit b0840eb32e
57 changed files with 349 additions and 1411 deletions

View file

@ -23,15 +23,18 @@
#include <unistd.h>
#include "SDL_fcitx.h"
#include "SDL_hints.h"
#include "SDL_keycode.h"
#include "SDL_keyboard.h"
#include "../../events/SDL_keyboard_c.h"
#include "SDL_dbus.h"
#include "SDL_syswm.h"
#if SDL_VIDEO_DRIVER_X11
# include "../../video/x11/SDL_x11video.h"
#ifdef SDL_VIDEO_DRIVER_X11
#include "../../video/x11/SDL_x11video.h"
#define SDL_ENABLE_SYSWM_X11
#endif
#include "SDL_hints.h"
#include "SDL_syswm.h"
#define FCITX_DBUS_SERVICE "org.freedesktop.portal.Fcitx"
@ -440,24 +443,19 @@ SDL_Fcitx_UpdateTextRect(const SDL_Rect *rect)
return ;
}
SDL_VERSION(&info.version);
if (!SDL_GetWindowWMInfo(focused_win, &info)) {
return;
}
SDL_GetWindowPosition(focused_win, &x, &y);
#if SDL_VIDEO_DRIVER_X11
if (info.subsystem == SDL_SYSWM_X11) {
SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata;
Display *x_disp = info.info.x11.display;
Window x_win = info.info.x11.window;
int x_screen = displaydata->screen;
Window unused;
X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), 0, 0, &x, &y, &unused);
}
if (SDL_GetWindowWMInfo(focused_win, &info, SDL_SYSWM_CURRENT_VERSION) == 0) {
#ifdef SDL_ENABLE_SYSWM_X11
if (info.subsystem == SDL_SYSWM_X11) {
Display *x_disp = info.info.x11.display;
int x_screen = info.info.x11.screen;
Window x_win = info.info.x11.window;
Window unused;
X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), 0, 0, &x, &y, &unused);
}
#endif
}
if (cursor->x == -1 && cursor->y == -1 && cursor->w == 0 && cursor->h == 0) {
/* move to bottom left */