Commit Graph

3114 Commits

Author SHA1 Message Date
ilyas-taouaou
9224a0a2d8 Fix emscripten, android, uikit and windows 2023-11-02 14:27:36 -04:00
ilyas-taouaou
d0d8b28df1 Change SDL_Vulkan_GetInstanceExtensions 2023-11-02 14:27:36 -04:00
Frank Praznik
875e45e70b wayland: Sanity check pointers and protocols before confining 2023-10-29 14:24:47 -04:00
Frank Praznik
0e87b71d08 wayland: Check the relative pointer handle before destroying
If the relative protocol is unsupported, this will always be null and the destroy function won't be called.
2023-10-29 14:15:23 -04:00
Sam Lantinga
552bee47cb Clear any previous errors if we successfully show a message box 2023-10-27 10:11:23 -07:00
Sam Lantinga
343da852a6 Don't try to use the Wayland messagebox if we're not in Wayland
Also cleaned up some potential file handle leaks when querying the zenity version
2023-10-27 10:11:23 -07:00
Sam Lantinga
8b6da3c701 Fixed making the EGL context current when resuming on Android
Make sure that we don't have the context cached as current on the current thread.
2023-10-26 17:07:40 -07:00
Sam Lantinga
38afd48daf Added a single source of SDL object IDs
This ensures that we don't accidentally interpret an ID from one system as an ID in another system.
Audio device IDs are not covered here, since they have a unique numbering system.
2023-10-23 10:49:37 -07:00
Sam Lantinga
c98a14fdeb Renamed display added/removed events for consistency with the rest of the API
Fixes https://github.com/libsdl-org/SDL/issues/8425
2023-10-23 09:14:54 -07:00
Ryan C. Gordon
0ff67dc21b video: Fix compiler warning about SDL_ReadSurfacePixel not being declared.
(this was legal before, but the Android NDK wants to make sure we didn't mean
for this function to be marked `static` since it didn't have a formal
declaration before its definition and might only be used in the one source
file.)
2023-10-18 15:02:01 -04:00
Ryan C. Gordon
81c77396af opensles: Patched to compile. 2023-10-18 14:56:32 -04:00
Frank Praznik
72034b9a07 wayland: Fix primary selection handling when the protocol isn't supported
The primary selection protocol is optional, so the function pointers to the internal Wayland functions should only be set if the protocol is supported. This allows graceful fall-back to the generic SDL implementation in other cases.

Fixes the clipboard tests under Weston.
2023-10-12 12:32:27 -04:00
kanjitalk755
e152129787 Fixes #8190.
From #7249, reverted the hunks other than #7239.
2023-10-12 07:17:32 -07:00
Anonymous Maarten
25ce87979d Always provide an implementation for all SDL3 symbols 2023-10-12 14:00:47 +02:00
Sam Lantinga
4368f70ff9 Added properties to various SDL objects
The following objects now have properties that can be user modified:
* SDL_AudioStream
* SDL_Gamepad
* SDL_Joystick
* SDL_RWops
* SDL_Renderer
* SDL_Sensor
* SDL_Surface
* SDL_Texture
* SDL_Window
2023-10-11 22:38:00 -07:00
Sam Lantinga
0b71898cb1 Make it clear that the string comparison isn't a boolean check 2023-10-11 10:18:12 -07:00
Frank Praznik
9a5f7b17c6 Use SDL wrapped getenv function 2023-10-11 11:23:24 -04:00
Ryan C. Gordon
82f54af617 x11: Properly check for XInput2 support before using it.
This specifically fixes a crash in X11_WarpMouseInternal if XInput2 was
missing at runtime, but also cleans up a few other existing checks.

Fixes #8378.
2023-10-11 01:01:07 -04:00
Sam Lantinga
dc2a5f6ab2 Fixed error C2054: expected '(' to follow 'inline' 2023-10-10 16:38:12 -07:00
Simon McVittie
04edb38cdf shape: Use SDL[Test]_ReadSurfacePixel
This avoids assuming that the pixels are suitably aligned for direct
access, which there's no guarantee that they are; in particular,
3-bytes-per-pixel RGB images are likely to have 3 out of 4 pixels
misaligned. On x86, dereferencing a misaligned pointer does what you
would expect, but on other architectures it's undefined whether it will
work, crash with SIGBUS, or silently give a wrong answer.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-10-10 03:23:20 -07:00
Simon McVittie
f5745c3a67 surface: Add a private SDL_ReadSurfacePixel
This shares its implementation with SDLTest_ReadSurfacePixel: the same
code is compiled twice, to get it into the static test library and also
the public shared library.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-10-10 03:23:20 -07:00
Simon McVittie
0d68f45879 test: Extract SDLTest_ReadSurfacePixel
This is essentially the same as was added in d95d2d70, but with clearer
error handling. It's implemented in a private header file so that it
can be shared with SDL_shape, which also wants this functionality.

Resolves: https://github.com/libsdl-org/SDL/issues/8319
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-10-10 03:23:20 -07:00
Frank Praznik
836927edf8 wayland: Try to skip the Wayland driver if not connecting to or in a Wayland session
When initializing the Wayland driver, check if the application is being started in, or trying to connect to, a Wayland session and skip to another driver if not. If neither WAYLAND_DISPLAY nor XDG_SESSION_TYPE are set, try to start anyway, and if the Wayland library is missing or no Wayland sessions are started, initialization will fail later in the process as it previously did.

This fixes the case where a Wayland session is running on a different VT, but an application wishes to run via KMSDRM on the current VT.
2023-10-09 12:47:11 -04:00
Etaash Mathamsetty
2a9480c815 wayland: Add null check for zenity version string 2023-10-06 14:51:55 -07:00
Anonymous Maarten
4cd0c13823 blit_slow: don't read destination pixel when you're going to discard it anyways 2023-10-04 19:41:50 -07:00
Sam Lantinga
ea5f59c234 Removed unused code
It looks like we don't need to watch for hanging writes now that we're using the callback mechanism.
2023-09-27 10:18:34 -07:00
Frank Praznik
9667aa18e6 wayland: Check that the data device supports the release method before calling it 2023-09-26 11:22:33 -04:00
Frank Praznik
4454dc400b wayland: Null all Wayland manager objects after freeing 2023-09-26 11:22:33 -04:00
Ryan C. Gordon
e1789b320e video: Streamline a little deinit code.
Fixes #8290.
2023-09-25 16:26:14 -04:00
Frank Praznik
2a1058713c Bump libdecor feature check to look for 0.2.0
The version of libdecor tagged with support for the suspended event and min/max getters is 0.2.0, so update the checks to reflect this.
2023-09-25 12:07:54 -04:00
Frank Praznik
752f14e5a6 wayland: Convert some memcpy calls to copyp 2023-09-24 11:44:35 -04:00
Frank Praznik
9284a03053 wayland: Remove some unnecessary helper functions 2023-09-24 11:44:35 -04:00
Frank Praznik
9964e5c5b0 wayland: Don't retrieve the drag offer strings with every pointer motion event
Querying the drag offer with every pointer movement would require refactoring to work with the portal implementation, however, there is little point, as the event layer just discards the file name. Remove the existing code and note that a new implementation is needed if the name ever starts to be passed though.

In the event that this is reimplemented, it should cache the filenames, as otherwise, this could potentially hammer the DBus interface hundreds or even thousands of times per second.
2023-09-21 14:05:16 -04:00
Frank Praznik
2f3deec245 wayland: Don't process drag & drop events from surfaces not owned by SDL
Libdecor creates subsurfaces of the primary SDL surface, but events from these surfaces should be ignored, or applications will get drag & drop events when dragged over drop shadows and such.
2023-09-20 15:00:40 -04:00
Frank Praznik
c10d93d3a0 wayland: Replace magic constant with define 2023-09-20 15:00:40 -04:00
Ryan C. Gordon
5008521538 emscripten: Restore compatibility with existing emsdk releases. 2023-09-20 14:32:41 -04:00
Jaswant Panchumarti
953b55dd6d Use EM_ASM_PTR when the return value is a pointer
- closes https://github.com/libsdl-org/SDL/issues/8241
2023-09-20 14:25:35 -04:00
Colin Kinloch
99421b64d0 linux: Add portal drag and drop 2023-09-20 11:41:48 -04:00
Sam Lantinga
fca2f53189 Fixed warning: this function declaration is not a prototype 2023-09-18 13:09:28 -07:00
Frank Praznik
e5739d7d1f video: Remove SDL_GetFocusWindow()
It was rarely used and performed an identical function to SDL_GetKeyboardFocus(), but with worse time complexity.
2023-09-18 11:14:42 -04:00
Guldoman
65aaf3a9ab x11: Always update clipboard owner
This allows utilities like clipboard managers to keep track of the 
changes.
2023-09-15 05:21:14 -07:00
Dan Ginsburg
2de2e9d031 Fix flickering of window when using desktop-fullscreen and borderless window on multiple monitors on Linux. Closes #8186. 2023-09-12 07:37:39 -07:00
danginsburg
723835d16a Windows: fix for client rect resizing larger each time we came from exclusive fullscreen -> windowed on a monitor with HiDPI set. The problem was we were using the monitor DPI rather than the window DPI so AdjustWindowRectExForDpi was giving us an incorrect size which would be too large for the client rect. Closes #8237. 2023-09-12 07:36:55 -07:00
Frank Praznik
52efefca04 wayland: Fix drag offer leak
The data device leave function is intended for drag offers, not selections, and the function as was previously written was a no-op.
2023-09-09 18:49:47 -04:00
Frank Praznik
37e1fc3b58 wayland: Ensure that the toplevel window is recreated when switching decoration modes
If a compositor tries to change the decoration mode when initially creating a window, the hidden flag might not yet be unset if the decoration mode is changed during the initial roundtrip in Wayland_ShowWindow(). As hiding the window destroys the decoration manager object, the hidden flag check is unnecessary, as the decoration configuration listener will never be entered when the window is hidden.
2023-09-06 13:35:44 -04:00
Sam Lantinga
a7eea9997d macOS: Don't raise the parent top-level window when raising a child window, only raise the child window to the top of the parent 2023-08-30 20:29:57 -07:00
Sam Lantinga
a5e7214795 Add SDL_WINDOW_NOT_FOCUSABLE flag to set that the window should not be able to gain key focus
- Also adds SDL_SetWindowFocusable() to set/clear flag on existing windows
2023-08-30 20:29:51 -07:00
Anonymous Maarten
a94d724f17 wayland: add SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL 2023-08-30 23:03:03 +02:00
Anonymous Maarten
da5d93d3da wayland: don't define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_* macro's
They mess with #ifdef conditional in headers.
2023-08-30 13:43:50 -07:00
Sam Huang
c191d6c306 Better Win32 transparent window support 2023-08-27 13:06:42 -07:00