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,16 @@
#ifdef HAVE_IBUS_IBUS_H
#include "SDL.h"
#include "SDL_hints.h"
#include "SDL_syswm.h"
#include "SDL_ibus.h"
#include "SDL_dbus.h"
#include "../../video/SDL_sysvideo.h"
#include "../../events/SDL_keyboard_c.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_syswm.h"
#include <sys/inotify.h>
#include <unistd.h>
@@ -704,25 +705,20 @@ SDL_IBus_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
}
x += ibus_cursor_rect.x;
y += ibus_cursor_rect.y;