update sdl Merge commit '644725478f4de0f074a6834e8423ac36dce3974f'

This commit is contained in:
2023-09-23 18:53:11 +02:00
172 changed files with 7495 additions and 4062 deletions

View File

@@ -1740,7 +1740,7 @@ Uint32 SDL_GetWindowPixelFormat(SDL_Window *window)
}
#define CREATE_FLAGS \
(SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_VULKAN | SDL_WINDOW_MINIMIZED | SDL_WINDOW_METAL | SDL_WINDOW_TRANSPARENT)
(SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_VULKAN | SDL_WINDOW_MINIMIZED | SDL_WINDOW_METAL | SDL_WINDOW_TRANSPARENT | SDL_WINDOW_NOT_FOCUSABLE)
static SDL_INLINE SDL_bool IsAcceptingDragAndDrop(void)
{
@@ -3205,6 +3205,24 @@ int SDL_SetWindowInputFocus(SDL_Window *window)
return _this->SetWindowInputFocus(_this, window);
}
int SDL_SetWindowFocusable(SDL_Window *window, SDL_bool focusable)
{
CHECK_WINDOW_MAGIC(window, -1);
const int want = (focusable != SDL_FALSE); /* normalize the flag. */
const int have = !(window->flags & SDL_WINDOW_NOT_FOCUSABLE);
if ((want != have) && (_this->SetWindowFocusable)) {
if (want) {
window->flags &= ~SDL_WINDOW_NOT_FOCUSABLE;
} else {
window->flags |= SDL_WINDOW_NOT_FOCUSABLE;
}
_this->SetWindowFocusable(_this, window, (SDL_bool)want);
}
return 0;
}
void SDL_UpdateWindowGrab(SDL_Window *window)
{
SDL_bool keyboard_grabbed, mouse_grabbed;
@@ -3543,21 +3561,18 @@ void SDL_OnWindowFocusLost(SDL_Window *window)
}
}
/* !!! FIXME: is this different than SDL_GetKeyboardFocus()?
!!! FIXME: Also, SDL_GetKeyboardFocus() is O(1), this isn't. */
SDL_Window *SDL_GetFocusWindow(void)
SDL_Window *SDL_GetToplevelForKeyboardFocus(void)
{
SDL_Window *window;
SDL_Window *focus = SDL_GetKeyboardFocus();
if (_this == NULL) {
return NULL;
}
for (window = _this->windows; window; window = window->next) {
if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
return window;
if (focus) {
/* Get the toplevel parent window. */
while (focus->parent) {
focus = focus->parent;
}
}
return NULL;
return focus;
}
void SDL_DestroyWindow(SDL_Window *window)
@@ -4741,7 +4756,7 @@ void SDL_StartTextInput(void)
/* Then show the on-screen keyboard, if any */
if (SDL_GetHintBoolean(SDL_HINT_ENABLE_SCREEN_KEYBOARD, SDL_TRUE)) {
window = SDL_GetFocusWindow();
window = SDL_GetKeyboardFocus();
if (window && _this && _this->ShowScreenKeyboard) {
_this->ShowScreenKeyboard(_this, window);
}
@@ -4785,7 +4800,7 @@ void SDL_StopTextInput(void)
/* Hide the on-screen keyboard, if any */
if (SDL_GetHintBoolean(SDL_HINT_ENABLE_SCREEN_KEYBOARD, SDL_TRUE)) {
window = SDL_GetFocusWindow();
window = SDL_GetKeyboardFocus();
if (window && _this && _this->HideScreenKeyboard) {
_this->HideScreenKeyboard(_this, window);
}
@@ -5101,9 +5116,9 @@ void SDL_OnApplicationWillResignActive(void)
if (_this) {
SDL_Window *window;
for (window = _this->windows; window != NULL; window = window->next) {
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_FOCUS_LOST, 0, 0);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MINIMIZED, 0, 0);
}
SDL_SetKeyboardFocus(NULL);
}
SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_BACKGROUND);
}
@@ -5125,7 +5140,7 @@ void SDL_OnApplicationDidBecomeActive(void)
if (_this) {
SDL_Window *window;
for (window = _this->windows; window != NULL; window = window->next) {
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_FOCUS_GAINED, 0, 0);
SDL_SetKeyboardFocus(window);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
}
}