Remove SDL_SetWindowInputFocus
This was added to SDL2 for the Unreal Engine's implementation of menus and dialogs on X11, window types for which SDL3 has added built-in, cross-platform support. Remove this function, as it was only ever implemented for X11 and is now basically useless aside from allowing annoying or malicious client apps to discretely steal focus. As the documentation states: "You almost certainly want SDL_RaiseWindow() instead of this function."
This commit is contained in:
parent
0f8054cf87
commit
be13328cb1
@ -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
|
||||
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -762,7 +762,6 @@ SDL3_0.0.0 {
|
||||
SDL_SetWindowFullscreenMode;
|
||||
SDL_SetWindowHitTest;
|
||||
SDL_SetWindowIcon;
|
||||
SDL_SetWindowInputFocus;
|
||||
SDL_SetWindowKeyboardGrab;
|
||||
SDL_SetWindowMaximumSize;
|
||||
SDL_SetWindowMinimumSize;
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user