diff --git a/docs/README-migration.md b/docs/README-migration.md index 236af3de9..82f6cdc4f 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -1983,6 +1983,7 @@ The following functions have been removed: * SDL_GetWindowData() - use SDL_GetWindowProperties() instead * SDL_SetWindowData() - use SDL_GetWindowProperties() instead * SDL_CreateWindowFrom() - use SDL_CreateWindowWithProperties() with the properties that allow you to wrap an existing window +* SDL_SetWindowInputFocus() - use SDL_RaiseWindow() instead The SDL_Window id type is named SDL_WindowID diff --git a/include/SDL3/SDL_video.h b/include/SDL3/SDL_video.h index a64ff6431..cdb911f71 100644 --- a/include/SDL3/SDL_video.h +++ b/include/SDL3/SDL_video.h @@ -2177,23 +2177,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetWindowOpacity(SDL_Window *window, float * */ extern SDL_DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window *modal_window, SDL_Window *parent_window); -/** - * Explicitly set input focus to the window. - * - * You almost certainly want SDL_RaiseWindow() instead of this function. Use - * this with caution, as you might give focus to a window that is completely - * obscured by other windows. - * - * \param window the window that should get the input focus. - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 3.0.0. - * - * \sa SDL_RaiseWindow - */ -extern SDL_DECLSPEC int SDLCALL SDL_SetWindowInputFocus(SDL_Window *window); - /** * Set whether the window may have input focus. * diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index b54b9fd05..40d7177a8 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -762,7 +762,6 @@ SDL3_0.0.0 { SDL_SetWindowFullscreenMode; SDL_SetWindowHitTest; SDL_SetWindowIcon; - SDL_SetWindowInputFocus; SDL_SetWindowKeyboardGrab; SDL_SetWindowMaximumSize; SDL_SetWindowMinimumSize; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index b8c98467b..76f69d781 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -787,7 +787,6 @@ #define SDL_SetWindowFullscreenMode SDL_SetWindowFullscreenMode_REAL #define SDL_SetWindowHitTest SDL_SetWindowHitTest_REAL #define SDL_SetWindowIcon SDL_SetWindowIcon_REAL -#define SDL_SetWindowInputFocus SDL_SetWindowInputFocus_REAL #define SDL_SetWindowKeyboardGrab SDL_SetWindowKeyboardGrab_REAL #define SDL_SetWindowMaximumSize SDL_SetWindowMaximumSize_REAL #define SDL_SetWindowMinimumSize SDL_SetWindowMinimumSize_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 740da8cf6..50613fd99 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -797,7 +797,6 @@ SDL_DYNAPI_PROC(int,SDL_SetWindowFullscreen,(SDL_Window *a, SDL_bool b),(a,b),re SDL_DYNAPI_PROC(int,SDL_SetWindowFullscreenMode,(SDL_Window *a, const SDL_DisplayMode *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SetWindowHitTest,(SDL_Window *a, SDL_HitTest b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_SetWindowIcon,(SDL_Window *a, SDL_Surface *b),(a,b),return) -SDL_DYNAPI_PROC(int,SDL_SetWindowInputFocus,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_SetWindowKeyboardGrab,(SDL_Window *a, SDL_bool b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SetWindowMaximumSize,(SDL_Window *a, int b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_SetWindowMinimumSize,(SDL_Window *a, int b, int c),(a,b,c),return) diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h index 5437a838a..0a5e7b56b 100644 --- a/src/video/SDL_sysvideo.h +++ b/src/video/SDL_sysvideo.h @@ -252,7 +252,6 @@ struct SDL_VideoDevice void (*GetWindowSizeInPixels)(SDL_VideoDevice *_this, SDL_Window *window, int *w, int *h); int (*SetWindowOpacity)(SDL_VideoDevice *_this, SDL_Window *window, float opacity); int (*SetWindowModalFor)(SDL_VideoDevice *_this, SDL_Window *modal_window, SDL_Window *parent_window); - int (*SetWindowInputFocus)(SDL_VideoDevice *_this, SDL_Window *window); void (*ShowWindow)(SDL_VideoDevice *_this, SDL_Window *window); void (*HideWindow)(SDL_VideoDevice *_this, SDL_Window *window); void (*RaiseWindow)(SDL_VideoDevice *_this, SDL_Window *window); diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 5b67b6d4f..9363a46ff 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -3511,18 +3511,6 @@ int SDL_SetWindowModalFor(SDL_Window *modal_window, SDL_Window *parent_window) return ret; } -int SDL_SetWindowInputFocus(SDL_Window *window) -{ - CHECK_WINDOW_MAGIC(window, -1); - CHECK_WINDOW_NOT_POPUP(window, -1); - - if (!_this->SetWindowInputFocus) { - return SDL_Unsupported(); - } - - return _this->SetWindowInputFocus(_this, window); -} - int SDL_SetWindowFocusable(SDL_Window *window, SDL_bool focusable) { CHECK_WINDOW_MAGIC(window, -1); diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c index 4f59aaeda..2f87933f1 100644 --- a/src/video/x11/SDL_x11video.c +++ b/src/video/x11/SDL_x11video.c @@ -198,7 +198,6 @@ static SDL_VideoDevice *X11_CreateDevice(void) device->GetWindowBordersSize = X11_GetWindowBordersSize; device->SetWindowOpacity = X11_SetWindowOpacity; device->SetWindowModalFor = X11_SetWindowModalFor; - device->SetWindowInputFocus = X11_SetWindowInputFocus; device->ShowWindow = X11_ShowWindow; device->HideWindow = X11_HideWindow; device->RaiseWindow = X11_RaiseWindow; diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index 60e5a3281..85818db8d 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -1267,18 +1267,6 @@ int X11_SetWindowModalFor(SDL_VideoDevice *_this, SDL_Window *modal_window, SDL_ return 0; } -int X11_SetWindowInputFocus(SDL_VideoDevice *_this, SDL_Window *window) -{ - if (X11_IsWindowMapped(_this, window)) { - SDL_WindowData *data = window->driverdata; - Display *display = data->videodata->display; - X11_XSetInputFocus(display, data->xwindow, RevertToNone, CurrentTime); - X11_XFlush(display); - return 0; - } - return -1; -} - void X11_SetWindowBordered(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool bordered) { const SDL_bool focused = (window->flags & SDL_WINDOW_INPUT_FOCUS) ? SDL_TRUE : SDL_FALSE; diff --git a/src/video/x11/SDL_x11window.h b/src/video/x11/SDL_x11window.h index 0681bf7df..5e4866766 100644 --- a/src/video/x11/SDL_x11window.h +++ b/src/video/x11/SDL_x11window.h @@ -119,7 +119,6 @@ extern void X11_SetWindowAspectRatio(SDL_VideoDevice *_this, SDL_Window *window) extern int X11_GetWindowBordersSize(SDL_VideoDevice *_this, SDL_Window *window, int *top, int *left, int *bottom, int *right); extern int X11_SetWindowOpacity(SDL_VideoDevice *_this, SDL_Window *window, float opacity); extern int X11_SetWindowModalFor(SDL_VideoDevice *_this, SDL_Window *modal_window, SDL_Window *parent_window); -extern int X11_SetWindowInputFocus(SDL_VideoDevice *_this, SDL_Window *window); extern void X11_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window); extern void X11_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window); extern void X11_HideWindow(SDL_VideoDevice *_this, SDL_Window *window);