update sdl Merge commit '644725478f4de0f074a6834e8423ac36dce3974f'
This commit is contained in:
4
external/sdl/SDL/src/video/SDL_bmp.c
vendored
4
external/sdl/SDL/src/video/SDL_bmp.c
vendored
@ -560,7 +560,7 @@ SDL_Surface *SDL_LoadBMP_RW(SDL_RWops *src, SDL_bool freesrc)
|
||||
} break;
|
||||
|
||||
default:
|
||||
if (SDL_RWread(src, bits, surface->pitch) != surface->pitch) {
|
||||
if (SDL_RWread(src, bits, surface->pitch) != (size_t)surface->pitch) {
|
||||
goto done;
|
||||
}
|
||||
if (biBitCount == 8 && palette && biClrUsed < (1u << biBitCount)) {
|
||||
@ -743,7 +743,7 @@ int SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst, SDL_bool freedst)
|
||||
}
|
||||
|
||||
if (SDL_LockSurface(intermediate_surface) == 0) {
|
||||
const int bw = intermediate_surface->w * intermediate_surface->format->BytesPerPixel;
|
||||
const size_t bw = intermediate_surface->w * intermediate_surface->format->BytesPerPixel;
|
||||
|
||||
/* Set the BMP file header values */
|
||||
bfSize = 0; /* We'll write this when we're done */
|
||||
|
9
external/sdl/SDL/src/video/SDL_sysvideo.h
vendored
9
external/sdl/SDL/src/video/SDL_sysvideo.h
vendored
@ -23,7 +23,7 @@
|
||||
#ifndef SDL_sysvideo_h_
|
||||
#define SDL_sysvideo_h_
|
||||
|
||||
#include "SDL_vulkan_internal.h"
|
||||
#include <SDL3/SDL_vulkan.h>
|
||||
|
||||
/* The SDL video driver */
|
||||
|
||||
@ -264,6 +264,7 @@ struct SDL_VideoDevice
|
||||
void (*DestroyWindowFramebuffer)(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
void (*OnWindowEnter)(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
int (*FlashWindow)(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOperation operation);
|
||||
int (*SetWindowFocusable)(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool focusable);
|
||||
|
||||
/* * * */
|
||||
/*
|
||||
@ -442,8 +443,8 @@ struct SDL_VideoDevice
|
||||
/* Data used by the Vulkan drivers */
|
||||
struct
|
||||
{
|
||||
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
|
||||
PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties;
|
||||
SDL_FunctionPointer vkGetInstanceProcAddr;
|
||||
SDL_FunctionPointer vkEnumerateInstanceExtensionProperties;
|
||||
int loader_loaded;
|
||||
char loader_path[256];
|
||||
void *loader_handle;
|
||||
@ -543,7 +544,7 @@ extern void SDL_OnWindowFocusGained(SDL_Window *window);
|
||||
extern void SDL_OnWindowFocusLost(SDL_Window *window);
|
||||
extern void SDL_OnWindowDisplayChanged(SDL_Window *window);
|
||||
extern void SDL_UpdateWindowGrab(SDL_Window *window);
|
||||
extern SDL_Window *SDL_GetFocusWindow(void);
|
||||
extern SDL_Window *SDL_GetToplevelForKeyboardFocus(void);
|
||||
|
||||
extern SDL_bool SDL_ShouldAllowTopmost(void);
|
||||
|
||||
|
47
external/sdl/SDL/src/video/SDL_video.c
vendored
47
external/sdl/SDL/src/video/SDL_video.c
vendored
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,8 @@
|
||||
|
||||
#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_ANDROID)
|
||||
|
||||
#include "../SDL_vulkan_internal.h"
|
||||
|
||||
#include "SDL_androidvideo.h"
|
||||
#include "SDL_androidwindow.h"
|
||||
|
||||
|
@ -119,6 +119,7 @@ static SDL_VideoDevice *Cocoa_CreateDevice(void)
|
||||
device->SetWindowHitTest = Cocoa_SetWindowHitTest;
|
||||
device->AcceptDragAndDrop = Cocoa_AcceptDragAndDrop;
|
||||
device->FlashWindow = Cocoa_FlashWindow;
|
||||
device->SetWindowFocusable = Cocoa_SetWindowFocusable;
|
||||
|
||||
device->shape_driver.CreateShaper = Cocoa_CreateShaper;
|
||||
device->shape_driver.SetWindowShape = Cocoa_SetWindowShape;
|
||||
|
@ -169,5 +169,6 @@ extern int Cocoa_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, str
|
||||
extern int Cocoa_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
|
||||
extern void Cocoa_AcceptDragAndDrop(SDL_Window *window, SDL_bool accept);
|
||||
extern int Cocoa_FlashWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOperation operation);
|
||||
extern int Cocoa_SetWindowFocusable(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool focusable);
|
||||
|
||||
#endif /* SDL_cocoawindow_h_ */
|
||||
|
@ -116,7 +116,7 @@
|
||||
- (BOOL)canBecomeKeyWindow
|
||||
{
|
||||
SDL_Window *window = [self findSDLWindow];
|
||||
if (window && !(window->flags & SDL_WINDOW_TOOLTIP)) {
|
||||
if (window && !(window->flags & (SDL_WINDOW_TOOLTIP | SDL_WINDOW_NOT_FOCUSABLE))) {
|
||||
return YES;
|
||||
} else {
|
||||
return NO;
|
||||
@ -643,7 +643,7 @@ static void Cocoa_SendExposedEventIfVisible(SDL_Window *window)
|
||||
int newVisibility = [[change objectForKey:@"new"] intValue];
|
||||
if (newVisibility) {
|
||||
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_SHOWN, 0, 0);
|
||||
} else {
|
||||
} else if (![_data.nswindow isMiniaturized]) {
|
||||
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_HIDDEN, 0, 0);
|
||||
}
|
||||
}
|
||||
@ -662,7 +662,7 @@ static void Cocoa_SendExposedEventIfVisible(SDL_Window *window)
|
||||
if (wasVisible != isVisible) {
|
||||
if (isVisible) {
|
||||
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_SHOWN, 0, 0);
|
||||
} else {
|
||||
} else if (![_data.nswindow isMiniaturized]) {
|
||||
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_HIDDEN, 0, 0);
|
||||
}
|
||||
|
||||
@ -955,7 +955,12 @@ static void Cocoa_SendExposedEventIfVisible(SDL_Window *window)
|
||||
|
||||
- (void)windowDidDeminiaturize:(NSNotification *)aNotification
|
||||
{
|
||||
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
|
||||
/* isZoomed always returns true if the window is not resizable */
|
||||
if ((_data.window->flags & SDL_WINDOW_RESIZABLE) && [_data.nswindow isZoomed]) {
|
||||
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_MAXIMIZED, 0, 0);
|
||||
} else {
|
||||
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)windowDidBecomeKey:(NSNotification *)aNotification
|
||||
@ -2165,16 +2170,17 @@ void Cocoa_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
if (SDL_WINDOW_IS_POPUP(window)) {
|
||||
NSWindow *nsparent = ((__bridge SDL_CocoaWindowData *)window->parent->driverdata).nswindow;
|
||||
[nsparent addChildWindow:nswindow ordered:NSWindowAbove];
|
||||
}
|
||||
if (bActivate) {
|
||||
[nswindow makeKeyAndOrderFront:nil];
|
||||
} else {
|
||||
/* Order this window below the key window if we're not activating it */
|
||||
if ([NSApp keyWindow]) {
|
||||
[nswindow orderWindow:NSWindowBelow relativeTo:[[NSApp keyWindow] windowNumber]];
|
||||
if (bActivate) {
|
||||
[nswindow makeKeyAndOrderFront:nil];
|
||||
} else {
|
||||
/* Order this window below the key window if we're not activating it */
|
||||
if ([NSApp keyWindow]) {
|
||||
[nswindow orderWindow:NSWindowBelow relativeTo:[[NSApp keyWindow] windowNumber]];
|
||||
}
|
||||
}
|
||||
[nswindow setIsVisible:YES];
|
||||
}
|
||||
[nswindow setIsVisible:YES];
|
||||
[windowData.listener resumeVisibleObservation];
|
||||
}
|
||||
}
|
||||
@ -2185,7 +2191,18 @@ void Cocoa_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
@autoreleasepool {
|
||||
NSWindow *nswindow = ((__bridge SDL_CocoaWindowData *)window->driverdata).nswindow;
|
||||
|
||||
[nswindow orderOut:nil];
|
||||
/* orderOut has no effect on miniaturized windows, so close must be used to remove
|
||||
* the window from the desktop and window list in this case.
|
||||
*
|
||||
* SDL holds a strong reference to the window (oneShot/releasedWhenClosed are 'NO'),
|
||||
* and calling 'close' doesn't send a 'windowShouldClose' message, so it's safe to
|
||||
* use for this purpose as nothing is implicitly released.
|
||||
*/
|
||||
if (![nswindow isMiniaturized]) {
|
||||
[nswindow orderOut:nil];
|
||||
} else {
|
||||
[nswindow close];
|
||||
}
|
||||
|
||||
/* Transfer keyboard focus back to the parent */
|
||||
if (window->flags & SDL_WINDOW_POPUP_MENU) {
|
||||
@ -2218,13 +2235,13 @@ void Cocoa_RaiseWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
if (SDL_WINDOW_IS_POPUP(window)) {
|
||||
NSWindow *nsparent = ((__bridge SDL_CocoaWindowData *)window->parent->driverdata).nswindow;
|
||||
[nsparent addChildWindow:nswindow ordered:NSWindowAbove];
|
||||
}
|
||||
|
||||
if (bActivate) {
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
[nswindow makeKeyAndOrderFront:nil];
|
||||
} else {
|
||||
[nswindow orderFront:nil];
|
||||
if (bActivate) {
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
[nswindow makeKeyAndOrderFront:nil];
|
||||
} else {
|
||||
[nswindow orderFront:nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
[windowData.listener resumeVisibleObservation];
|
||||
@ -2662,6 +2679,11 @@ int Cocoa_FlashWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOpera
|
||||
}
|
||||
}
|
||||
|
||||
int Cocoa_SetWindowFocusable(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool focusable)
|
||||
{
|
||||
return 0; /* just succeed, the real work is done elsewhere. */
|
||||
}
|
||||
|
||||
int Cocoa_SetWindowOpacity(SDL_VideoDevice *_this, SDL_Window *window, float opacity)
|
||||
{
|
||||
@autoreleasepool {
|
||||
|
@ -732,7 +732,7 @@ static EM_BOOL Emscripten_HandleFocus(int eventType, const EmscriptenFocusEvent
|
||||
}
|
||||
|
||||
sdl_event_type = (eventType == EMSCRIPTEN_EVENT_FOCUS) ? SDL_EVENT_WINDOW_FOCUS_GAINED : SDL_EVENT_WINDOW_FOCUS_LOST;
|
||||
SDL_SendWindowEvent(window_data->window, sdl_event_type, 0, 0);
|
||||
SDL_SetKeyboardFocus(sdl_event_type == SDL_EVENT_WINDOW_FOCUS_GAINED ? window_data->window : NULL);
|
||||
return SDL_EventEnabled(sdl_event_type);
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,15 @@
|
||||
|
||||
#include "../../events/SDL_mouse_c.h"
|
||||
|
||||
/* older Emscriptens don't have this, but we need to for wasm64 compatibility. */
|
||||
#ifndef MAIN_THREAD_EM_ASM_PTR
|
||||
#ifdef __wasm64__
|
||||
#error You need to upgrade your Emscripten compiler to support wasm64
|
||||
#else
|
||||
#define MAIN_THREAD_EM_ASM_PTR MAIN_THREAD_EM_ASM_INT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static SDL_Cursor *Emscripten_CreateCursorFromString(const char *cursor_str, SDL_bool is_custom)
|
||||
{
|
||||
SDL_Cursor *cursor;
|
||||
@ -74,7 +83,7 @@ static SDL_Cursor *Emscripten_CreateCursor(SDL_Surface *surface, int hot_x, int
|
||||
}
|
||||
|
||||
/* *INDENT-OFF* */ /* clang-format off */
|
||||
cursor_url = (const char *)MAIN_THREAD_EM_ASM_INT({
|
||||
cursor_url = (const char *)MAIN_THREAD_EM_ASM_PTR({
|
||||
var w = $0;
|
||||
var h = $1;
|
||||
var hot_x = $2;
|
||||
|
@ -28,6 +28,8 @@
|
||||
|
||||
#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_KMSDRM)
|
||||
|
||||
#include "../SDL_vulkan_internal.h"
|
||||
|
||||
#include "SDL_kmsdrmvideo.h"
|
||||
#include "SDL_kmsdrmdyn.h"
|
||||
#include "SDL_kmsdrmvulkan.h"
|
||||
|
@ -249,7 +249,7 @@ void UIKit_ForceUpdateHomeIndicator(void)
|
||||
{
|
||||
#if !TARGET_OS_TV
|
||||
/* Force the main SDL window to re-evaluate home indicator state */
|
||||
SDL_Window *focus = SDL_GetFocusWindow();
|
||||
SDL_Window *focus = SDL_GetKeyboardFocus();
|
||||
if (focus) {
|
||||
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)focus->driverdata;
|
||||
if (data != nil) {
|
||||
|
@ -624,7 +624,7 @@ SDL_bool UIKit_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
int UIKit_SetTextInputRect(SDL_VideoDevice *_this, const SDL_Rect *rect)
|
||||
{
|
||||
@autoreleasepool {
|
||||
SDL_uikitviewcontroller *vc = GetWindowViewController(SDL_GetFocusWindow());
|
||||
SDL_uikitviewcontroller *vc = GetWindowViewController(SDL_GetKeyboardFocus());
|
||||
if (vc != nil) {
|
||||
vc.textInputRect = *rect;
|
||||
|
||||
|
@ -28,6 +28,8 @@
|
||||
|
||||
#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_VIVANTE)
|
||||
|
||||
#include "../SDL_vulkan_internal.h"
|
||||
|
||||
#include "SDL_vivantevideo.h"
|
||||
|
||||
#include "SDL_vivantevulkan.h"
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
#define TEXT_MIME "text/plain;charset=utf-8"
|
||||
#define FILE_MIME "text/uri-list"
|
||||
#define FILE_PORTAL_MIME "application/vnd.portal.filetransfer"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -34,34 +34,30 @@ typedef struct
|
||||
const char *libname;
|
||||
} waylanddynlib;
|
||||
|
||||
#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL
|
||||
#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL NULL
|
||||
#endif
|
||||
#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
|
||||
#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR NULL
|
||||
#endif
|
||||
#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
|
||||
#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON NULL
|
||||
#endif
|
||||
#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR
|
||||
#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR NULL
|
||||
#endif
|
||||
|
||||
static waylanddynlib waylandlibs[] = {
|
||||
{ NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC },
|
||||
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL
|
||||
{ NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL },
|
||||
#endif
|
||||
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
|
||||
{ NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR },
|
||||
#endif
|
||||
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
|
||||
{ NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON },
|
||||
{ NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR }
|
||||
#endif
|
||||
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR
|
||||
{ NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR },
|
||||
#endif
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static void *WAYLAND_GetSym(const char *fnname, int *pHasModule, SDL_bool required)
|
||||
{
|
||||
int i;
|
||||
void *fn = NULL;
|
||||
for (i = 0; i < SDL_TABLESIZE(waylandlibs); i++) {
|
||||
if (waylandlibs[i].lib != NULL) {
|
||||
fn = SDL_LoadFunction(waylandlibs[i].lib, fnname);
|
||||
waylanddynlib *dynlib;
|
||||
for (dynlib = waylandlibs; dynlib->libname; dynlib++) {
|
||||
if (dynlib->lib != NULL) {
|
||||
fn = SDL_LoadFunction(dynlib->lib, fnname);
|
||||
if (fn != NULL) {
|
||||
break;
|
||||
}
|
||||
@ -69,10 +65,11 @@ static void *WAYLAND_GetSym(const char *fnname, int *pHasModule, SDL_bool requir
|
||||
}
|
||||
|
||||
#if DEBUG_DYNAMIC_WAYLAND
|
||||
if (fn != NULL)
|
||||
SDL_Log("WAYLAND: Found '%s' in %s (%p)\n", fnname, waylandlibs[i].libname, fn);
|
||||
else
|
||||
if (fn != NULL) {
|
||||
SDL_Log("WAYLAND: Found '%s' in %s (%p)\n", fnname, dynlib->libname, fn);
|
||||
} else {
|
||||
SDL_Log("WAYLAND: Symbol '%s' NOT FOUND!\n", fnname);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (fn == NULL && required) {
|
||||
|
@ -823,7 +823,7 @@ static void pointer_handle_axis(void *data, struct wl_pointer *pointer,
|
||||
{
|
||||
struct SDL_WaylandInput *input = data;
|
||||
|
||||
if (wl_seat_get_version(input->seat) >= 5) {
|
||||
if (wl_seat_get_version(input->seat) >= WL_POINTER_FRAME_SINCE_VERSION) {
|
||||
input->pointer_curr_axis_info.timestamp_ns = Wayland_GetPointerTimestamp(input, time);
|
||||
pointer_handle_axis_common(input, AXIS_EVENT_CONTINUOUS, axis, value);
|
||||
} else {
|
||||
@ -1848,28 +1848,40 @@ static void data_device_handle_enter(void *data, struct wl_data_device *wl_data_
|
||||
data_device->drag_offer = wl_data_offer_get_user_data(id);
|
||||
|
||||
/* TODO: SDL Support more mime types */
|
||||
has_mime = Wayland_data_offer_has_mime(
|
||||
data_device->drag_offer, FILE_MIME);
|
||||
|
||||
/* If drag_mime is NULL this will decline the offer */
|
||||
wl_data_offer_accept(id, serial,
|
||||
(has_mime == SDL_TRUE) ? FILE_MIME : NULL);
|
||||
#ifdef SDL_USE_LIBDBUS
|
||||
if (Wayland_data_offer_has_mime(data_device->drag_offer, FILE_PORTAL_MIME)) {
|
||||
has_mime = SDL_TRUE;
|
||||
wl_data_offer_accept(id, serial, FILE_PORTAL_MIME);
|
||||
}
|
||||
#endif
|
||||
if (Wayland_data_offer_has_mime(data_device->drag_offer, FILE_MIME)) {
|
||||
has_mime = SDL_TRUE;
|
||||
wl_data_offer_accept(id, serial, FILE_MIME);
|
||||
}
|
||||
|
||||
/* SDL only supports "copy" style drag and drop */
|
||||
if (has_mime == SDL_TRUE) {
|
||||
if (has_mime) {
|
||||
dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY;
|
||||
} else {
|
||||
/* drag_mime is NULL this will decline the offer */
|
||||
wl_data_offer_accept(id, serial, NULL);
|
||||
}
|
||||
if (wl_data_offer_get_version(data_device->drag_offer->offer) >= 3) {
|
||||
if (wl_data_offer_get_version(data_device->drag_offer->offer) >=
|
||||
WL_DATA_OFFER_SET_ACTIONS_SINCE_VERSION) {
|
||||
wl_data_offer_set_actions(data_device->drag_offer->offer,
|
||||
dnd_action, dnd_action);
|
||||
}
|
||||
|
||||
/* find the current window */
|
||||
if (surface && SDL_WAYLAND_own_surface(surface)) {
|
||||
SDL_WindowData *window = (SDL_WindowData *)wl_surface_get_user_data(surface);
|
||||
if (window) {
|
||||
data_device->dnd_window = window->sdlwindow;
|
||||
}
|
||||
if (surface) {
|
||||
if (SDL_WAYLAND_own_surface(surface)) {
|
||||
SDL_WindowData *window = (SDL_WindowData *)wl_surface_get_user_data(surface);
|
||||
if (window) {
|
||||
data_device->dnd_window = window->sdlwindow;
|
||||
}
|
||||
} else {
|
||||
data_device->dnd_window = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1877,11 +1889,10 @@ static void data_device_handle_enter(void *data, struct wl_data_device *wl_data_
|
||||
static void data_device_handle_leave(void *data, struct wl_data_device *wl_data_device)
|
||||
{
|
||||
SDL_WaylandDataDevice *data_device = data;
|
||||
SDL_WaylandDataOffer *offer = NULL;
|
||||
|
||||
if (data_device->selection_offer != NULL) {
|
||||
data_device->selection_offer = NULL;
|
||||
Wayland_data_offer_destroy(offer);
|
||||
if (data_device->drag_offer != NULL) {
|
||||
Wayland_data_offer_destroy(data_device->drag_offer);
|
||||
data_device->drag_offer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1890,27 +1901,15 @@ static void data_device_handle_motion(void *data, struct wl_data_device *wl_data
|
||||
{
|
||||
SDL_WaylandDataDevice *data_device = data;
|
||||
|
||||
if (data_device->drag_offer != NULL) {
|
||||
/* TODO: SDL Support more mime types */
|
||||
size_t length;
|
||||
void *buffer = Wayland_data_offer_receive(data_device->drag_offer,
|
||||
FILE_MIME, &length);
|
||||
if (buffer) {
|
||||
char *saveptr = NULL;
|
||||
char *token = SDL_strtok_r((char *)buffer, "\r\n", &saveptr);
|
||||
while (token != NULL) {
|
||||
char *fn = Wayland_URIToLocal(token);
|
||||
if (fn) {
|
||||
double dx;
|
||||
double dy;
|
||||
dx = wl_fixed_to_double(x);
|
||||
dy = wl_fixed_to_double(y);
|
||||
SDL_SendDropPosition(data_device->dnd_window, fn, (float)dx, (float)dy);
|
||||
}
|
||||
token = SDL_strtok_r(NULL, "\r\n", &saveptr);
|
||||
}
|
||||
SDL_free(buffer);
|
||||
}
|
||||
if (data_device->drag_offer != NULL && data_device->dnd_window) {
|
||||
const float dx = (float)wl_fixed_to_double(x);
|
||||
const float dy = (float)wl_fixed_to_double(y);
|
||||
|
||||
/* XXX: Send the filename here if the event system ever starts passing it though.
|
||||
* Any future implementation should cache the filenames, as otherwise this could
|
||||
* hammer the DBus interface hundreds or even thousands of times per second.
|
||||
*/
|
||||
SDL_SendDropPosition(data_device->dnd_window, NULL, dx, dy);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2039,25 +2038,66 @@ static void data_device_handle_drop(void *data, struct wl_data_device *wl_data_d
|
||||
{
|
||||
SDL_WaylandDataDevice *data_device = data;
|
||||
|
||||
if (data_device->drag_offer != NULL) {
|
||||
if (data_device->drag_offer != NULL && data_device->dnd_window) {
|
||||
/* TODO: SDL Support more mime types */
|
||||
size_t length;
|
||||
void *buffer = Wayland_data_offer_receive(data_device->drag_offer,
|
||||
FILE_MIME, &length);
|
||||
if (buffer) {
|
||||
char *saveptr = NULL;
|
||||
char *token = SDL_strtok_r((char *)buffer, "\r\n", &saveptr);
|
||||
while (token != NULL) {
|
||||
char *fn = Wayland_URIToLocal(token);
|
||||
if (fn) {
|
||||
SDL_SendDropFile(data_device->dnd_window, fn);
|
||||
SDL_bool drop_handled = SDL_FALSE;
|
||||
#ifdef SDL_USE_LIBDBUS
|
||||
if (Wayland_data_offer_has_mime(
|
||||
data_device->drag_offer, FILE_PORTAL_MIME)) {
|
||||
void *buffer = Wayland_data_offer_receive(data_device->drag_offer,
|
||||
FILE_PORTAL_MIME, &length);
|
||||
if (buffer) {
|
||||
SDL_DBusContext *dbus = SDL_DBus_GetContext();
|
||||
if (dbus) {
|
||||
int path_count = 0;
|
||||
char **paths = SDL_DBus_DocumentsPortalRetrieveFiles(buffer, &path_count);
|
||||
/* If dropped files contain a directory the list is empty */
|
||||
if (paths && path_count > 0) {
|
||||
for (int i = 0; i < path_count; i++) {
|
||||
SDL_SendDropFile(data_device->dnd_window, paths[i]);
|
||||
}
|
||||
dbus->free_string_array(paths);
|
||||
SDL_SendDropComplete(data_device->dnd_window);
|
||||
drop_handled = SDL_TRUE;
|
||||
}
|
||||
}
|
||||
token = SDL_strtok_r(NULL, "\r\n", &saveptr);
|
||||
SDL_free(buffer);
|
||||
}
|
||||
SDL_SendDropComplete(data_device->dnd_window);
|
||||
SDL_free(buffer);
|
||||
}
|
||||
#endif
|
||||
/* If XDG document portal fails fallback.
|
||||
* When running a flatpak sandbox this will most likely be a list of
|
||||
* non paths that are not visible to the application
|
||||
*/
|
||||
if (!drop_handled && Wayland_data_offer_has_mime(
|
||||
data_device->drag_offer, FILE_MIME)) {
|
||||
void *buffer = Wayland_data_offer_receive(data_device->drag_offer,
|
||||
FILE_MIME, &length);
|
||||
if (buffer) {
|
||||
char *saveptr = NULL;
|
||||
char *token = SDL_strtok_r((char *)buffer, "\r\n", &saveptr);
|
||||
while (token != NULL) {
|
||||
char *fn = Wayland_URIToLocal(token);
|
||||
if (fn) {
|
||||
SDL_SendDropFile(data_device->dnd_window, fn);
|
||||
}
|
||||
token = SDL_strtok_r(NULL, "\r\n", &saveptr);
|
||||
}
|
||||
SDL_SendDropComplete(data_device->dnd_window);
|
||||
SDL_free(buffer);
|
||||
drop_handled = SDL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (drop_handled && wl_data_offer_get_version(data_device->drag_offer->offer) >=
|
||||
WL_DATA_OFFER_FINISH_SINCE_VERSION) {
|
||||
wl_data_offer_finish(data_device->drag_offer->offer);
|
||||
}
|
||||
}
|
||||
|
||||
Wayland_data_offer_destroy(data_device->drag_offer);
|
||||
data_device->drag_offer = NULL;
|
||||
}
|
||||
|
||||
static void data_device_handle_selection(void *data, struct wl_data_device *wl_data_device,
|
||||
|
@ -916,7 +916,7 @@ static int Wayland_GetDisplayBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *di
|
||||
/* When an emulated, exclusive fullscreen window has focus, treat the mode dimensions as the display bounds. */
|
||||
if (display->fullscreen_window &&
|
||||
display->fullscreen_window->fullscreen_exclusive &&
|
||||
display->fullscreen_window == SDL_GetFocusWindow() &&
|
||||
display->fullscreen_window->driverdata->active &&
|
||||
display->fullscreen_window->current_fullscreen_mode.w != 0 &&
|
||||
display->fullscreen_window->current_fullscreen_mode.h != 0) {
|
||||
rect->w = display->fullscreen_window->current_fullscreen_mode.w;
|
||||
|
@ -28,9 +28,12 @@
|
||||
|
||||
#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_WAYLAND)
|
||||
|
||||
#include "../SDL_vulkan_internal.h"
|
||||
|
||||
#include "SDL_waylandvideo.h"
|
||||
#include "SDL_waylandwindow.h"
|
||||
|
||||
#include "../SDL_vulkan_internal.h"
|
||||
#include "SDL_waylandvulkan.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
@ -29,7 +29,7 @@
|
||||
#ifndef SDL_waylandvulkan_h_
|
||||
#define SDL_waylandvulkan_h_
|
||||
|
||||
#include "../SDL_vulkan_internal.h"
|
||||
#include <SDL3/SDL_vulkan.h>
|
||||
#include "../SDL_sysvideo.h"
|
||||
|
||||
#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_WAYLAND)
|
||||
|
@ -639,7 +639,7 @@ static void handle_configure_xdg_toplevel(void *data,
|
||||
SDL_bool fullscreen = SDL_FALSE;
|
||||
SDL_bool maximized = SDL_FALSE;
|
||||
SDL_bool floating = SDL_TRUE;
|
||||
SDL_bool focused = SDL_FALSE;
|
||||
SDL_bool active = SDL_FALSE;
|
||||
SDL_bool suspended = SDL_FALSE;
|
||||
wl_array_for_each (state, states) {
|
||||
switch (*state) {
|
||||
@ -652,7 +652,7 @@ static void handle_configure_xdg_toplevel(void *data,
|
||||
floating = SDL_FALSE;
|
||||
break;
|
||||
case XDG_TOPLEVEL_STATE_ACTIVATED:
|
||||
focused = SDL_TRUE;
|
||||
active = SDL_TRUE;
|
||||
break;
|
||||
case XDG_TOPLEVEL_STATE_TILED_LEFT:
|
||||
case XDG_TOPLEVEL_STATE_TILED_RIGHT:
|
||||
@ -715,7 +715,7 @@ static void handle_configure_xdg_toplevel(void *data,
|
||||
* dependent, but in general, we can assume that the flag should remain set until
|
||||
* the next focused configure event occurs.
|
||||
*/
|
||||
if (focused || !(window->flags & SDL_WINDOW_MINIMIZED)) {
|
||||
if (active || !(window->flags & SDL_WINDOW_MINIMIZED)) {
|
||||
SDL_SendWindowEvent(window,
|
||||
maximized ? SDL_EVENT_WINDOW_MAXIMIZED : SDL_EVENT_WINDOW_RESTORED,
|
||||
0, 0);
|
||||
@ -745,15 +745,11 @@ static void handle_configure_xdg_toplevel(void *data,
|
||||
}
|
||||
}
|
||||
|
||||
/* Similar to maximized/restore events above, send focus events too! */
|
||||
SDL_SendWindowEvent(window,
|
||||
focused ? SDL_EVENT_WINDOW_FOCUS_GAINED : SDL_EVENT_WINDOW_FOCUS_LOST,
|
||||
0, 0);
|
||||
|
||||
wind->requested_window_width = width;
|
||||
wind->requested_window_height = height;
|
||||
wind->floating = floating;
|
||||
wind->suspended = suspended;
|
||||
wind->active = active;
|
||||
if (wind->surface_status == WAYLAND_SURFACE_STATUS_WAITING_FOR_CONFIGURE) {
|
||||
wind->surface_status = WAYLAND_SURFACE_STATUS_WAITING_FOR_FRAME;
|
||||
}
|
||||
@ -855,11 +851,10 @@ static void handle_configure_zxdg_decoration(void *data,
|
||||
WAYLAND_wl_display_roundtrip(driverdata->waylandData->display);
|
||||
|
||||
Wayland_HideWindow(device, window);
|
||||
SDL_zero(driverdata->shell_surface);
|
||||
driverdata->shell_surface_type = WAYLAND_SURFACE_LIBDECOR;
|
||||
|
||||
if (!window->is_hiding && !(window->flags & SDL_WINDOW_HIDDEN)) {
|
||||
Wayland_ShowWindow(device, window);
|
||||
}
|
||||
Wayland_ShowWindow(device, window);
|
||||
}
|
||||
}
|
||||
|
||||
@ -921,7 +916,7 @@ static void decoration_frame_configure(struct libdecor_frame *frame,
|
||||
int width, height;
|
||||
|
||||
SDL_bool prev_fullscreen = wind->is_fullscreen;
|
||||
SDL_bool focused = SDL_FALSE;
|
||||
SDL_bool active = SDL_FALSE;
|
||||
SDL_bool fullscreen = SDL_FALSE;
|
||||
SDL_bool maximized = SDL_FALSE;
|
||||
SDL_bool tiled = SDL_FALSE;
|
||||
@ -935,7 +930,7 @@ static void decoration_frame_configure(struct libdecor_frame *frame,
|
||||
if (libdecor_configuration_get_window_state(configuration, &window_state)) {
|
||||
fullscreen = (window_state & LIBDECOR_WINDOW_STATE_FULLSCREEN) != 0;
|
||||
maximized = (window_state & LIBDECOR_WINDOW_STATE_MAXIMIZED) != 0;
|
||||
focused = (window_state & LIBDECOR_WINDOW_STATE_ACTIVE) != 0;
|
||||
active = (window_state & LIBDECOR_WINDOW_STATE_ACTIVE) != 0;
|
||||
tiled = (window_state & tiled_states) != 0;
|
||||
#ifdef SDL_HAVE_LIBDECOR_VER_0_1_2
|
||||
suspended = (window_state & LIBDECOR_WINDOW_STATE_SUSPENDED) != 0;
|
||||
@ -954,18 +949,13 @@ static void decoration_frame_configure(struct libdecor_frame *frame,
|
||||
* dependent, but in general, we can assume that the flag should remain set until
|
||||
* the next focused configure event occurs.
|
||||
*/
|
||||
if (focused || !(window->flags & SDL_WINDOW_MINIMIZED)) {
|
||||
if (active || !(window->flags & SDL_WINDOW_MINIMIZED)) {
|
||||
SDL_SendWindowEvent(window,
|
||||
maximized ? SDL_EVENT_WINDOW_MAXIMIZED : SDL_EVENT_WINDOW_RESTORED,
|
||||
0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Similar to maximized/restore events above, send focus events too! */
|
||||
SDL_SendWindowEvent(window,
|
||||
focused ? SDL_EVENT_WINDOW_FOCUS_GAINED : SDL_EVENT_WINDOW_FOCUS_LOST,
|
||||
0, 0);
|
||||
|
||||
/* For fullscreen or fixed-size windows we know our size.
|
||||
* Always assume the configure is wrong.
|
||||
*/
|
||||
@ -1055,6 +1045,7 @@ static void decoration_frame_configure(struct libdecor_frame *frame,
|
||||
/* Store the new state. */
|
||||
wind->floating = floating;
|
||||
wind->suspended = suspended;
|
||||
wind->active = active;
|
||||
|
||||
/* Calculate the new window geometry */
|
||||
wind->requested_window_width = width;
|
||||
@ -1529,12 +1520,6 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
|
||||
/* Restore state that was set prior to this call */
|
||||
Wayland_SetWindowTitle(_this, window);
|
||||
if (window->flags & SDL_WINDOW_MAXIMIZED) {
|
||||
Wayland_MaximizeWindow(_this, window);
|
||||
}
|
||||
if (window->flags & SDL_WINDOW_MINIMIZED) {
|
||||
Wayland_MinimizeWindow(_this, window);
|
||||
}
|
||||
|
||||
/* We have to wait until the surface gets a "configure" event, or use of
|
||||
* this surface will fail. This is a new rule for xdg_shell.
|
||||
@ -1940,11 +1925,6 @@ void Wayland_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set this flag now even if we never actually maximized, eventually
|
||||
* ShowWindow will take care of it along with the other window state.
|
||||
*/
|
||||
window->flags &= ~SDL_WINDOW_MAXIMIZED;
|
||||
|
||||
#ifdef HAVE_LIBDECOR_H
|
||||
if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) {
|
||||
if (wind->shell_surface.libdecor.frame == NULL) {
|
||||
@ -2025,11 +2005,6 @@ void Wayland_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set this flag now even if we don't actually maximize yet, eventually
|
||||
* ShowWindow will take care of it along with the other window state.
|
||||
*/
|
||||
window->flags |= SDL_WINDOW_MAXIMIZED;
|
||||
|
||||
#ifdef HAVE_LIBDECOR_H
|
||||
if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) {
|
||||
if (wind->shell_surface.libdecor.frame == NULL) {
|
||||
@ -2057,6 +2032,8 @@ void Wayland_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
SDL_VideoData *viddata = _this->driverdata;
|
||||
SDL_WindowData *wind = window->driverdata;
|
||||
|
||||
/* Maximized and minimized flags are mutually exclusive */
|
||||
window->flags &= ~SDL_WINDOW_MAXIMIZED;
|
||||
window->flags |= SDL_WINDOW_MINIMIZED;
|
||||
|
||||
#ifdef HAVE_LIBDECOR_H
|
||||
|
@ -123,6 +123,7 @@ struct SDL_WindowData
|
||||
SDL_DisplayID last_displayID;
|
||||
SDL_bool floating;
|
||||
SDL_bool suspended;
|
||||
SDL_bool active;
|
||||
SDL_bool is_fullscreen;
|
||||
SDL_bool in_fullscreen_transition;
|
||||
SDL_bool fullscreen_was_positioned;
|
||||
|
@ -22,6 +22,9 @@
|
||||
|
||||
#ifdef SDL_VIDEO_DRIVER_WINDOWS
|
||||
|
||||
#ifdef SDL_VIDEO_VULKAN
|
||||
#include "../SDL_vulkan_internal.h"
|
||||
#endif
|
||||
#include "../SDL_sysvideo.h"
|
||||
#include "../SDL_pixels_c.h"
|
||||
#include "../../SDL_hints_c.h"
|
||||
@ -208,6 +211,7 @@ static SDL_VideoDevice *WIN_CreateDevice(void)
|
||||
device->AcceptDragAndDrop = WIN_AcceptDragAndDrop;
|
||||
device->FlashWindow = WIN_FlashWindow;
|
||||
device->ShowWindowSystemMenu = WIN_ShowWindowSystemMenu;
|
||||
device->SetWindowFocusable = WIN_SetWindowFocusable;
|
||||
|
||||
device->shape_driver.CreateShaper = Win32_CreateShaper;
|
||||
device->shape_driver.SetWindowShape = Win32_SetWindowShape;
|
||||
|
@ -28,6 +28,8 @@
|
||||
|
||||
#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_WINDOWS)
|
||||
|
||||
#include "../SDL_vulkan_internal.h"
|
||||
|
||||
#include "SDL_windowsvideo.h"
|
||||
#include "SDL_windowswindow.h"
|
||||
|
||||
|
@ -29,11 +29,11 @@
|
||||
#ifndef SDL_windowsvulkan_h_
|
||||
#define SDL_windowsvulkan_h_
|
||||
|
||||
#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_WINDOWS)
|
||||
|
||||
#include "../SDL_vulkan_internal.h"
|
||||
#include "../SDL_sysvideo.h"
|
||||
|
||||
#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_WINDOWS)
|
||||
|
||||
int WIN_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path);
|
||||
void WIN_Vulkan_UnloadLibrary(SDL_VideoDevice *_this);
|
||||
SDL_bool WIN_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||
|
@ -46,6 +46,22 @@
|
||||
#endif
|
||||
typedef HRESULT (WINAPI *DwmSetWindowAttribute_t)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute);
|
||||
|
||||
/* Transparent window support */
|
||||
#ifndef DWM_BB_ENABLE
|
||||
#define DWM_BB_ENABLE 0x00000001
|
||||
#endif
|
||||
#ifndef DWM_BB_BLURREGION
|
||||
#define DWM_BB_BLURREGION 0x00000002
|
||||
#endif
|
||||
typedef struct
|
||||
{
|
||||
DWORD flags;
|
||||
BOOL enable;
|
||||
HRGN blur_region;
|
||||
BOOL transition_on_maxed;
|
||||
} DWM_BLURBEHIND;
|
||||
typedef HRESULT(WINAPI *DwmEnableBlurBehindWindow_t)(HWND hwnd, const DWM_BLURBEHIND *pBlurBehind);
|
||||
|
||||
/* Windows CE compatibility */
|
||||
#ifndef SWP_NOCOPYBITS
|
||||
#define SWP_NOCOPYBITS 0
|
||||
@ -128,10 +144,11 @@ static DWORD GetWindowStyleEx(SDL_Window *window)
|
||||
{
|
||||
DWORD style = 0;
|
||||
|
||||
if (SDL_WINDOW_IS_POPUP(window)) {
|
||||
style = WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE;
|
||||
} else if (window->flags & SDL_WINDOW_UTILITY) {
|
||||
style = WS_EX_TOOLWINDOW;
|
||||
if (SDL_WINDOW_IS_POPUP(window) || (window->flags & SDL_WINDOW_UTILITY)) {
|
||||
style |= WS_EX_TOOLWINDOW;
|
||||
}
|
||||
if (SDL_WINDOW_IS_POPUP(window) || (window->flags & SDL_WINDOW_NOT_FOCUSABLE)) {
|
||||
style |= WS_EX_NOACTIVATE;
|
||||
}
|
||||
return style;
|
||||
}
|
||||
@ -173,23 +190,9 @@ static int WIN_AdjustWindowRectWithStyle(SDL_Window *window, DWORD style, BOOL m
|
||||
if (WIN_IsPerMonitorV2DPIAware(SDL_GetVideoDevice())) {
|
||||
/* With per-monitor v2, the window border/titlebar size depend on the DPI, so we need to call AdjustWindowRectExForDpi instead of
|
||||
AdjustWindowRectEx. */
|
||||
UINT unused;
|
||||
RECT screen_rect;
|
||||
HMONITOR mon;
|
||||
|
||||
screen_rect.left = *x;
|
||||
screen_rect.top = *y;
|
||||
screen_rect.right = (LONG)*x + *width;
|
||||
screen_rect.bottom = (LONG)*y + *height;
|
||||
|
||||
mon = MonitorFromRect(&screen_rect, MONITOR_DEFAULTTONEAREST);
|
||||
|
||||
if (videodata != NULL) {
|
||||
/* GetDpiForMonitor docs promise to return the same hdpi / vdpi */
|
||||
if (videodata->GetDpiForMonitor(mon, MDT_EFFECTIVE_DPI, &frame_dpi, &unused) != S_OK) {
|
||||
frame_dpi = 96;
|
||||
}
|
||||
|
||||
SDL_WindowData *data = window->driverdata;
|
||||
frame_dpi = (data && videodata->GetDpiForWindow) ? videodata->GetDpiForWindow(data->hwnd) : 96;
|
||||
if (videodata->AdjustWindowRectExForDpi(&rect, style, menu, 0, frame_dpi) == 0) {
|
||||
return WIN_SetError("AdjustWindowRectExForDpi()");
|
||||
}
|
||||
@ -583,6 +586,25 @@ int WIN_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
ShowWindow(hwnd, SW_SHOWMINNOACTIVE);
|
||||
}
|
||||
|
||||
/* FIXME: does not work on all hardware configurations with different renders (i.e. hybrid GPUs) */
|
||||
if (window->flags & SDL_WINDOW_TRANSPARENT) {
|
||||
void *handle = SDL_LoadObject("dwmapi.dll");
|
||||
if (handle) {
|
||||
DwmEnableBlurBehindWindow_t DwmEnableBlurBehindWindowFunc = (DwmEnableBlurBehindWindow_t)SDL_LoadFunction(handle, "DwmEnableBlurBehindWindow");
|
||||
if (DwmEnableBlurBehindWindowFunc) {
|
||||
/* The region indicates which part of the window will be blurred and rest will be transparent. This
|
||||
is because the alpha value of the window will be used for non-blurred areas
|
||||
We can use (-1, -1, 0, 0) boundary to make sure no pixels are being blurred
|
||||
*/
|
||||
HRGN rgn = CreateRectRgn(-1, -1, 0, 0);
|
||||
DWM_BLURBEHIND bb = {DWM_BB_ENABLE | DWM_BB_BLURREGION, TRUE, rgn, FALSE};
|
||||
DwmEnableBlurBehindWindowFunc(hwnd, &bb);
|
||||
DeleteObject(rgn);
|
||||
}
|
||||
SDL_UnloadObject(handle);
|
||||
}
|
||||
}
|
||||
|
||||
if (!(window->flags & SDL_WINDOW_OPENGL)) {
|
||||
return 0;
|
||||
}
|
||||
@ -1504,6 +1526,31 @@ void WIN_ShowWindowSystemMenu(SDL_Window *window, int x, int y)
|
||||
ClientToScreen(data->hwnd, &pt);
|
||||
SendMessage(data->hwnd, WM_POPUPSYSTEMMENU, 0, MAKELPARAM(pt.x, pt.y));
|
||||
}
|
||||
|
||||
int WIN_SetWindowFocusable(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool focusable)
|
||||
{
|
||||
SDL_WindowData *data = window->driverdata;
|
||||
HWND hwnd = data->hwnd;
|
||||
const LONG style = GetWindowLong(hwnd, GWL_EXSTYLE);
|
||||
|
||||
SDL_assert(style != 0);
|
||||
|
||||
if (focusable) {
|
||||
if (style & WS_EX_NOACTIVATE) {
|
||||
if (SetWindowLong(hwnd, GWL_EXSTYLE, style & ~WS_EX_NOACTIVATE) == 0) {
|
||||
return WIN_SetError("SetWindowLong()");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!(style & WS_EX_NOACTIVATE)) {
|
||||
if (SetWindowLong(hwnd, GWL_EXSTYLE, style | WS_EX_NOACTIVATE) == 0) {
|
||||
return WIN_SetError("SetWindowLong()");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
|
||||
|
||||
void WIN_UpdateDarkModeForHWND(HWND hwnd)
|
||||
|
@ -109,6 +109,7 @@ extern int WIN_FlashWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Flash
|
||||
extern void WIN_UpdateDarkModeForHWND(HWND hwnd);
|
||||
extern int WIN_SetWindowPositionInternal(SDL_Window *window, UINT flags);
|
||||
extern void WIN_ShowWindowSystemMenu(SDL_Window *window, int x, int y);
|
||||
extern int WIN_SetWindowFocusable(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool focusable);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
|
@ -92,9 +92,7 @@ static int SetSelectionData(SDL_VideoDevice *_this, Atom selection, SDL_Clipboar
|
||||
clipboard->mime_count = mime_count;
|
||||
clipboard->sequence = sequence;
|
||||
|
||||
if (!clipboard_owner) {
|
||||
X11_XSetSelectionOwner(display, selection, window, CurrentTime);
|
||||
}
|
||||
X11_XSetSelectionOwner(display, selection, window, CurrentTime);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
19
external/sdl/SDL/src/video/x11/SDL_x11events.c
vendored
19
external/sdl/SDL/src/video/x11/SDL_x11events.c
vendored
@ -1579,12 +1579,19 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
|
||||
}
|
||||
}
|
||||
|
||||
if (changed & SDL_WINDOW_MAXIMIZED) {
|
||||
if (flags & SDL_WINDOW_MAXIMIZED) {
|
||||
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MAXIMIZED, 0, 0);
|
||||
} else {
|
||||
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
|
||||
}
|
||||
if ((changed & SDL_WINDOW_MAXIMIZED) && ((flags & SDL_WINDOW_MAXIMIZED) && !(flags & SDL_WINDOW_MINIMIZED))) {
|
||||
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MAXIMIZED, 0, 0);
|
||||
}
|
||||
if ((changed & SDL_WINDOW_MINIMIZED) && (flags & SDL_WINDOW_MINIMIZED)) {
|
||||
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MINIMIZED, 0, 0);
|
||||
}
|
||||
if (((changed & SDL_WINDOW_MAXIMIZED) || (changed & SDL_WINDOW_MINIMIZED)) &&
|
||||
(!(flags & SDL_WINDOW_MAXIMIZED) && !(flags & SDL_WINDOW_MINIMIZED))) {
|
||||
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
|
||||
}
|
||||
|
||||
if (changed & SDL_WINDOW_OCCLUDED) {
|
||||
SDL_SendWindowEvent(data->window, (flags & SDL_WINDOW_OCCLUDED) ? SDL_EVENT_WINDOW_OCCLUDED : SDL_EVENT_WINDOW_EXPOSED, 0, 0);
|
||||
}
|
||||
} else if (xevent->xproperty.atom == videodata->XKLAVIER_STATE) {
|
||||
/* Hack for Ubuntu 12.04 (etc) that doesn't send MappingNotify
|
||||
|
@ -39,8 +39,6 @@
|
||||
#include "SDL_x11opengles.h"
|
||||
#endif
|
||||
|
||||
#include "SDL_x11vulkan.h"
|
||||
|
||||
/* Initialization/Query functions */
|
||||
static int X11_VideoInit(SDL_VideoDevice *_this);
|
||||
static void X11_VideoQuit(SDL_VideoDevice *_this);
|
||||
@ -214,6 +212,7 @@ static SDL_VideoDevice *X11_CreateDevice(void)
|
||||
device->AcceptDragAndDrop = X11_AcceptDragAndDrop;
|
||||
device->FlashWindow = X11_FlashWindow;
|
||||
device->ShowWindowSystemMenu = X11_ShowWindowSystemMenu;
|
||||
device->SetWindowFocusable = X11_SetWindowFocusable;
|
||||
|
||||
#ifdef SDL_VIDEO_DRIVER_X11_XFIXES
|
||||
device->SetWindowMouseRect = X11_SetWindowMouseRect;
|
||||
|
24
external/sdl/SDL/src/video/x11/SDL_x11video.h
vendored
24
external/sdl/SDL/src/video/x11/SDL_x11video.h
vendored
@ -25,30 +25,6 @@
|
||||
|
||||
#include "../SDL_sysvideo.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xresource.h>
|
||||
|
||||
#ifdef SDL_VIDEO_DRIVER_X11_XCURSOR
|
||||
#include <X11/Xcursor/Xcursor.h>
|
||||
#endif
|
||||
#ifdef SDL_VIDEO_DRIVER_X11_XDBE
|
||||
#include <X11/extensions/Xdbe.h>
|
||||
#endif
|
||||
#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2
|
||||
#include <X11/extensions/XInput2.h>
|
||||
#endif
|
||||
#ifdef SDL_VIDEO_DRIVER_X11_XRANDR
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
#endif
|
||||
#ifdef SDL_VIDEO_DRIVER_X11_XSCRNSAVER
|
||||
#include <X11/extensions/scrnsaver.h>
|
||||
#endif
|
||||
#ifdef SDL_VIDEO_DRIVER_X11_XSHAPE
|
||||
#include <X11/extensions/shape.h>
|
||||
#endif
|
||||
|
||||
#include "../../core/linux/SDL_dbus.h"
|
||||
#include "../../core/linux/SDL_ime.h"
|
||||
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_X11)
|
||||
|
||||
#include "../SDL_vulkan_internal.h"
|
||||
|
||||
#include "SDL_x11video.h"
|
||||
|
||||
#include "SDL_x11vulkan.h"
|
||||
|
@ -23,11 +23,11 @@
|
||||
#ifndef SDL_x11vulkan_h_
|
||||
#define SDL_x11vulkan_h_
|
||||
|
||||
#include "../SDL_vulkan_internal.h"
|
||||
#include <SDL3/SDL_vulkan.h>
|
||||
|
||||
#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_X11)
|
||||
|
||||
/*typedef struct xcb_connection_t xcb_connection_t;*/
|
||||
typedef struct xcb_connection_t xcb_connection_t;
|
||||
typedef xcb_connection_t *(*PFN_XGetXCBConnection)(Display *dpy);
|
||||
|
||||
int X11_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path);
|
||||
|
34
external/sdl/SDL/src/video/x11/SDL_x11window.c
vendored
34
external/sdl/SDL/src/video/x11/SDL_x11window.c
vendored
@ -238,7 +238,7 @@ Uint32 X11_GetNetWMState(SDL_VideoDevice *_this, SDL_Window *window, Window xwin
|
||||
|
||||
for (i = 0; i < numItems; ++i) {
|
||||
if (atoms[i] == _NET_WM_STATE_HIDDEN) {
|
||||
flags |= SDL_WINDOW_HIDDEN;
|
||||
flags |= SDL_WINDOW_MINIMIZED | SDL_WINDOW_OCCLUDED;
|
||||
} else if (atoms[i] == _NET_WM_STATE_FOCUSED) {
|
||||
flags |= SDL_WINDOW_INPUT_FOCUS;
|
||||
} else if (atoms[i] == _NET_WM_STATE_MAXIMIZED_VERT) {
|
||||
@ -604,8 +604,14 @@ int X11_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
return SDL_SetError("Couldn't create window");
|
||||
}
|
||||
|
||||
SetWindowBordered(display, screen, w,
|
||||
!(window->flags & SDL_WINDOW_BORDERLESS));
|
||||
/* Do not set borderless window if in desktop fullscreen, this causes
|
||||
flickering in multi-monitor setups */
|
||||
if (!((window->pending_flags & SDL_WINDOW_FULLSCREEN) &&
|
||||
(window->flags & SDL_WINDOW_BORDERLESS) &&
|
||||
!window->fullscreen_exclusive)) {
|
||||
SetWindowBordered(display, screen, w,
|
||||
!(window->flags & SDL_WINDOW_BORDERLESS));
|
||||
}
|
||||
|
||||
sizehints = X11_XAllocSizeHints();
|
||||
/* Setup the normal size hints */
|
||||
@ -623,7 +629,7 @@ int X11_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
|
||||
/* Setup the input hints so we get keyboard input */
|
||||
wmhints = X11_XAllocWMHints();
|
||||
wmhints->input = True;
|
||||
wmhints->input = !(window->flags & SDL_WINDOW_NOT_FOCUSABLE) ? True : False;
|
||||
wmhints->window_group = data->window_group;
|
||||
wmhints->flags = InputHint | WindowGroupHint;
|
||||
|
||||
@ -1982,4 +1988,24 @@ void X11_ShowWindowSystemMenu(SDL_Window *window, int x, int y)
|
||||
X11_XFlush(display);
|
||||
}
|
||||
|
||||
int X11_SetWindowFocusable(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool focusable)
|
||||
{
|
||||
SDL_WindowData *data = window->driverdata;
|
||||
Display *display = data->videodata->display;
|
||||
XWMHints *wmhints;
|
||||
|
||||
wmhints = X11_XGetWMHints(display, data->xwindow);
|
||||
if (wmhints == NULL) {
|
||||
return SDL_SetError("Couldn't get WM hints");
|
||||
}
|
||||
|
||||
wmhints->input = focusable ? True : False;
|
||||
wmhints->flags |= InputHint;
|
||||
|
||||
X11_XSetWMHints(display, data->xwindow, wmhints);
|
||||
X11_XFree(wmhints);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_X11 */
|
||||
|
@ -116,6 +116,7 @@ extern int X11_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
|
||||
extern void X11_AcceptDragAndDrop(SDL_Window *window, SDL_bool accept);
|
||||
extern int X11_FlashWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOperation operation);
|
||||
extern void X11_ShowWindowSystemMenu(SDL_Window *window, int x, int y);
|
||||
extern int X11_SetWindowFocusable(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool focusable);
|
||||
|
||||
int SDL_X11_SetWindowTitle(Display *display, Window xwindow, char *title);
|
||||
void X11_UpdateWindowPosition(SDL_Window *window);
|
||||
|
213
external/sdl/SDL/src/video/yuv2rgb/yuv_rgb.c
vendored
213
external/sdl/SDL/src/video/yuv2rgb/yuv_rgb.c
vendored
@ -241,6 +241,7 @@ void rgb24_yuv420_std(
|
||||
|
||||
#ifdef SDL_SSE2_INTRINSICS
|
||||
|
||||
/* SDL doesn't use these atm and compiling them adds seconds onto the build. --ryan.
|
||||
#define SSE_FUNCTION_NAME yuv420_rgb565_sse
|
||||
#define STD_FUNCTION_NAME yuv420_rgb565_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
@ -248,12 +249,6 @@ void rgb24_yuv420_std(
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_rgb565_sseu
|
||||
#define STD_FUNCTION_NAME yuv420_rgb565_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB565
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_rgb24_sse
|
||||
#define STD_FUNCTION_NAME yuv420_rgb24_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
@ -261,12 +256,6 @@ void rgb24_yuv420_std(
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_rgb24_sseu
|
||||
#define STD_FUNCTION_NAME yuv420_rgb24_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB24
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_rgba_sse
|
||||
#define STD_FUNCTION_NAME yuv420_rgba_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
@ -274,12 +263,6 @@ void rgb24_yuv420_std(
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_rgba_sseu
|
||||
#define STD_FUNCTION_NAME yuv420_rgba_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_RGBA
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_bgra_sse
|
||||
#define STD_FUNCTION_NAME yuv420_bgra_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
@ -287,12 +270,6 @@ void rgb24_yuv420_std(
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_bgra_sseu
|
||||
#define STD_FUNCTION_NAME yuv420_bgra_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_BGRA
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_argb_sse
|
||||
#define STD_FUNCTION_NAME yuv420_argb_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
@ -300,12 +277,6 @@ void rgb24_yuv420_std(
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_argb_sseu
|
||||
#define STD_FUNCTION_NAME yuv420_argb_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_ARGB
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_abgr_sse
|
||||
#define STD_FUNCTION_NAME yuv420_abgr_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
@ -313,12 +284,6 @@ void rgb24_yuv420_std(
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_abgr_sseu
|
||||
#define STD_FUNCTION_NAME yuv420_abgr_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_ABGR
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_rgb565_sse
|
||||
#define STD_FUNCTION_NAME yuv422_rgb565_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
@ -326,12 +291,6 @@ void rgb24_yuv420_std(
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_rgb565_sseu
|
||||
#define STD_FUNCTION_NAME yuv422_rgb565_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB565
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_rgb24_sse
|
||||
#define STD_FUNCTION_NAME yuv422_rgb24_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
@ -339,12 +298,6 @@ void rgb24_yuv420_std(
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_rgb24_sseu
|
||||
#define STD_FUNCTION_NAME yuv422_rgb24_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB24
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_rgba_sse
|
||||
#define STD_FUNCTION_NAME yuv422_rgba_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
@ -352,12 +305,6 @@ void rgb24_yuv420_std(
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_rgba_sseu
|
||||
#define STD_FUNCTION_NAME yuv422_rgba_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_RGBA
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_bgra_sse
|
||||
#define STD_FUNCTION_NAME yuv422_bgra_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
@ -365,12 +312,6 @@ void rgb24_yuv420_std(
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_bgra_sseu
|
||||
#define STD_FUNCTION_NAME yuv422_bgra_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_BGRA
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_argb_sse
|
||||
#define STD_FUNCTION_NAME yuv422_argb_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
@ -378,12 +319,6 @@ void rgb24_yuv420_std(
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_argb_sseu
|
||||
#define STD_FUNCTION_NAME yuv422_argb_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_ARGB
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_abgr_sse
|
||||
#define STD_FUNCTION_NAME yuv422_abgr_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
@ -391,12 +326,6 @@ void rgb24_yuv420_std(
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_abgr_sseu
|
||||
#define STD_FUNCTION_NAME yuv422_abgr_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_ABGR
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_rgb565_sse
|
||||
#define STD_FUNCTION_NAME yuvnv12_rgb565_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
@ -404,12 +333,6 @@ void rgb24_yuv420_std(
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_rgb565_sseu
|
||||
#define STD_FUNCTION_NAME yuvnv12_rgb565_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB565
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_rgb24_sse
|
||||
#define STD_FUNCTION_NAME yuvnv12_rgb24_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
@ -417,12 +340,6 @@ void rgb24_yuv420_std(
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_rgb24_sseu
|
||||
#define STD_FUNCTION_NAME yuvnv12_rgb24_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB24
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_rgba_sse
|
||||
#define STD_FUNCTION_NAME yuvnv12_rgba_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
@ -430,12 +347,6 @@ void rgb24_yuv420_std(
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_rgba_sseu
|
||||
#define STD_FUNCTION_NAME yuvnv12_rgba_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_RGBA
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_bgra_sse
|
||||
#define STD_FUNCTION_NAME yuvnv12_bgra_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
@ -443,12 +354,6 @@ void rgb24_yuv420_std(
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_bgra_sseu
|
||||
#define STD_FUNCTION_NAME yuvnv12_bgra_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_BGRA
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_argb_sse
|
||||
#define STD_FUNCTION_NAME yuvnv12_argb_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
@ -456,18 +361,115 @@ void rgb24_yuv420_std(
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_argb_sseu
|
||||
#define STD_FUNCTION_NAME yuvnv12_argb_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_ARGB
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_abgr_sse
|
||||
#define STD_FUNCTION_NAME yuvnv12_abgr_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_ABGR
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
*/
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_rgb565_sseu
|
||||
#define STD_FUNCTION_NAME yuv420_rgb565_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB565
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_rgb24_sseu
|
||||
#define STD_FUNCTION_NAME yuv420_rgb24_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB24
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_rgba_sseu
|
||||
#define STD_FUNCTION_NAME yuv420_rgba_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_RGBA
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_bgra_sseu
|
||||
#define STD_FUNCTION_NAME yuv420_bgra_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_BGRA
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_argb_sseu
|
||||
#define STD_FUNCTION_NAME yuv420_argb_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_ARGB
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_abgr_sseu
|
||||
#define STD_FUNCTION_NAME yuv420_abgr_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_ABGR
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_rgb565_sseu
|
||||
#define STD_FUNCTION_NAME yuv422_rgb565_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB565
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_rgb24_sseu
|
||||
#define STD_FUNCTION_NAME yuv422_rgb24_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB24
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_rgba_sseu
|
||||
#define STD_FUNCTION_NAME yuv422_rgba_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_RGBA
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_bgra_sseu
|
||||
#define STD_FUNCTION_NAME yuv422_bgra_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_BGRA
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_argb_sseu
|
||||
#define STD_FUNCTION_NAME yuv422_argb_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_ARGB
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_abgr_sseu
|
||||
#define STD_FUNCTION_NAME yuv422_abgr_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_ABGR
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_rgb565_sseu
|
||||
#define STD_FUNCTION_NAME yuvnv12_rgb565_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB565
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_rgb24_sseu
|
||||
#define STD_FUNCTION_NAME yuvnv12_rgb24_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB24
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_rgba_sseu
|
||||
#define STD_FUNCTION_NAME yuvnv12_rgba_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_RGBA
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_bgra_sseu
|
||||
#define STD_FUNCTION_NAME yuvnv12_bgra_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_BGRA
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_argb_sseu
|
||||
#define STD_FUNCTION_NAME yuvnv12_argb_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_ARGB
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_abgr_sseu
|
||||
#define STD_FUNCTION_NAME yuvnv12_abgr_std
|
||||
@ -476,6 +478,7 @@ void rgb24_yuv420_std(
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
|
||||
/* SDL doesn't use these atm and compiling them adds seconds onto the build. --ryan.
|
||||
#define UNPACK_RGB24_32_STEP1(RGB1, RGB2, RGB3, RGB4, RGB5, RGB6, R1, R2, G1, G2, B1, B2) \
|
||||
R1 = _mm_unpacklo_epi8(RGB1, RGB4); \
|
||||
R2 = _mm_unpackhi_epi8(RGB1, RGB4); \
|
||||
@ -515,7 +518,9 @@ V = _mm_add_epi16(_mm_mullo_epi16(R, _mm_set1_epi16(param->matrix[2][0])), \
|
||||
V = _mm_add_epi16(V, _mm_mullo_epi16(B, _mm_set1_epi16(param->matrix[2][2]))); \
|
||||
V = _mm_add_epi16(V, _mm_set1_epi16(128<<PRECISION)); \
|
||||
V = _mm_srai_epi16(V, PRECISION);
|
||||
*/
|
||||
|
||||
#if 0 // SDL doesn't use these atm and compiling them adds seconds onto the build. --ryan.
|
||||
#define RGB2YUV_32 \
|
||||
__m128i r1, r2, b1, b2, g1, g2; \
|
||||
__m128i r_16, g_16, b_16; \
|
||||
@ -608,7 +613,9 @@ V = _mm_srai_epi16(V, PRECISION);
|
||||
v1 = _mm_avg_epu8(v1, v2); \
|
||||
SAVE_SI128((__m128i*)(u_ptr), u1); \
|
||||
SAVE_SI128((__m128i*)(v_ptr), v1);
|
||||
#endif
|
||||
|
||||
/* SDL doesn't use these atm and compiling them adds seconds onto the build. --ryan.
|
||||
void SDL_TARGETING("sse2") rgb24_yuv420_sse(uint32_t width, uint32_t height,
|
||||
const uint8_t *RGB, uint32_t RGB_stride,
|
||||
uint8_t *Y, uint8_t *U, uint8_t *V, uint32_t Y_stride, uint32_t UV_stride,
|
||||
@ -680,7 +687,7 @@ void SDL_TARGETING("sse2") rgb24_yuv420_sseu(uint32_t width, uint32_t height,
|
||||
#undef LOAD_SI128
|
||||
#undef SAVE_SI128
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
#endif //SDL_SSE2_INTRINSICS
|
||||
|
||||
|
Reference in New Issue
Block a user