Commit Graph

2777 Commits

Author SHA1 Message Date
Sam Lantinga
7905254087 Updated debug print with new SDL_DisplayMode fields 2023-03-06 09:50:12 -08:00
Sylvain
a946a34452 Add Drag and drop position, for x11, wayland and MACOSX 2023-03-06 08:44:05 -08:00
Sylvain
813c586edb Change local (void*) to SDL_FunctionPointer 2023-03-06 12:38:38 +01:00
Sylvain
9b065bf54b Fix various warnings: static /void / comma 2023-03-06 12:37:37 +01:00
Sam Lantinga
6b87d1938f Added SDL_EVENT_DISPLAY_SCALE_CHANGED 2023-03-03 11:16:31 -08:00
Eddy Jansson
91b9ba8c54 Correct typo GetSlectionText -> GetSelectionText 2023-03-02 16:29:18 -05:00
Sam Lantinga
3bba33932f Fixed testshape on high DPI displays
Since the shape is set based on the pixels in the image, we want the window to have the same number of pixels.
2023-03-02 10:15:14 -08:00
Sam Lantinga
ebdb320651 Follow the same pattern for releasing the window data in the UIKit driver
Possible fix for https://github.com/libsdl-org/SDL/issues/7361
2023-02-28 15:56:49 -08:00
Sam Lantinga
6aeb07d4c2 Fixed SDL windows getting the maximized state after leaving fullscreen on macOS 2023-02-28 09:03:28 -08:00
Sam Lantinga
c824060503 Fixed missing line 2023-02-27 21:08:50 -08:00
Sam Lantinga
a6d8cdf186 Setting a window to non-fullscreen when it's not fullscreen is a no-op
Also explicitly reset fullscreen mode when destroying a window, eliminating the need for doing that in SDL_HideWindow(), as that's already taken care of in SDL_OnWindowHidden() normally.
2023-02-27 21:06:05 -08:00
Sam Lantinga
fcc9deb365 Only restore desktop mode when hiding a window if that window was fullscreen 2023-02-27 15:38:48 -08:00
Torge Matthies
f18b5656f6 x11: Fix duplicate Xinput2 event reception
Passing True for owner_events in the XGrabPointer call makes all
XI_RawMotion events appear in the queue twice, with the only difference
between them being the value of XGenericEventCookie::cookie. These have
always been filtered out by a check in the XI_RawMotion handler,
however with a mouse that polls at more than 1 kHz frequency, there
also exist legitimate events that appear indistinguishable from these
duplicated events. These must not be filtered out, otherwise the
pointer may move at an inconsistent speed, appearing like a bad pointer
acceleration implementation.

Change owner_events to False in the XGrabPointer and remove the
duplicate event detection code to fix this.

Signed-off-by: Torge Matthies <openglfreak@googlemail.com>
2023-02-25 10:04:46 -08:00
David Carlier
d73f2d76a0 Haiku modernizing a bit the C++ code with C++11 heuristics
with BApplication
2023-02-24 20:54:41 -08:00
Sam Lantinga
2897de9efc Clear the undefined position state when the window is placed
This allows the window to be recreated in the same location if needed, for example if recreated because of switching to OpenGL rendering.
2023-02-24 18:04:54 -08:00
Sam Lantinga
4d9d343662 Added handling for undefined window position on X11 2023-02-24 17:49:45 -08:00
Sam Lantinga
3bfd596608 Added handling for undefined window position on Windows 2023-02-24 17:06:47 -08:00
Sam Lantinga
daffe02b11 Fixed relative mouse motion over remote desktop
Setting the cursor clip area to a single pixel prevents the relative mouse motion remote desktop warping from working, so the mouse is never recentered.
2023-02-24 09:20:38 -08:00
Anonymous Maarten
f2a277414f raspberry: SDL_DisplayMode's w/h members have been renamed to screen_w/screen_h
Found by running the coccinelle script on SDL's source tree.
2023-02-24 06:55:28 -08:00
Sam Lantinga
b2d913883c Fixed view frame from flipping back and forth between landscape and portrait on iOS 2023-02-23 09:14:53 -08:00
Frank Praznik
e8fd7f74bd windows: Track the window display ID locally
Track the current window display ID locally so as not to depend on specific behavior of the video layer, which may change the value at times when it isn't expected.
2023-02-23 07:39:16 -08:00
Frank Praznik
9f1a7bb94c wayland: Track the window display ID locally
Track the current window display ID locally so as not to depend on specific behavior of the video layer, which may change the value at times when it isn't expected.
2023-02-23 07:39:16 -08:00
Frank Praznik
d9fadb8b47 video: Update the current display when moving a window programmatically
When moving a window programmatically, the move event will be deduplicated due to the window x and y coordinates already being updated, so the window's current display ID needs to be explicitly updated.
2023-02-23 07:39:16 -08:00
Frank Praznik
e8076b78ef video: Move fullscreen windows via SDL_UpdateFullscreenMode()
Update the target display ID and use SDL_UpdateFullscreenMode() when moving a fullscreen window to handle the case where the target display has an existing fullscreen window.
2023-02-23 07:39:16 -08:00
Sam Lantinga
6c9e199f73 Use bridged pointers to Objective C objects in C structures
Fixes https://github.com/libsdl-org/SDL/issues/7244
2023-02-22 22:03:25 -08:00
Sam Lantinga
9eb19d2bf2 SDL_CheckWindowDisplayChanged() is a static function 2023-02-22 15:34:44 -08:00
Sam Lantinga
756921a049 Fixed float conversion warning 2023-02-22 15:33:47 -08:00
Sam Lantinga
e8091b8983 cocoa/gles: do not unload EGL when context is destroyed 2023-02-20 10:40:54 -08:00
Marc-André Lureau
93861e1de0 windows/gles: do not unload EGL when context is destroyed
It's legitimate to have multiple contexts.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-02-20 10:40:19 -08:00
Marc-André Lureau
654965a628 windows/gles: correct indentation
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-02-20 10:40:19 -08:00
Sam Lantinga
5d3cf61e8b Don't call SDL_GetDisplayIndex(0) when creating or positioning a window
Fixes https://github.com/libsdl-org/SDL/issues/7354
2023-02-20 10:38:13 -08:00
Anonymous Maarten
efdc92802f Fix -Wunused-function warning when configuring with -DSDL_X11_XINPUT2=OFF 2023-02-19 09:59:12 -08:00
Anonymous Maarten
0e2866f846 Fix -Wunused-variable warning when configuring with -DSDL_X11_XRANDR=OFF 2023-02-19 09:59:12 -08:00
Anonymous Maarten
cfadb4c106 Fix -Wunused-variable warning when configuring with -DSDL_X11_XSHAPE=OFF 2023-02-19 09:59:12 -08:00
Sam Lantinga
ced02319a6 Fixed typo (thanks @Iniquitatis!) 2023-02-19 09:57:35 -08:00
Lauri Kasanen
0123d6311d Fix GetGlobalMouseState when xi2 is not available at runtime 2023-02-19 09:56:08 -08:00
Ozkan Sezer
964a877eb3 SDL_x11dyn.h: include XInput2.h also for Xfixes
Fixes https://github.com/libsdl-org/SDL/issues/7343
2023-02-11 23:51:28 +03:00
Anonymous Maarten
18f38bef03 Remove include/SDL3/SDL_name.h 2023-02-18 12:33:54 -08:00
Le Philousophe
a67ae8eed5 Fix window size in X11 when window manager refuses to resize 2023-02-18 12:31:46 -08:00
Ozkan Sezer
b5a7bd72df minor tidy-up. 2023-02-18 11:29:10 +03:00
Sylvain
c88becc87a Fix kmsdrm build 2023-02-18 08:12:52 +01:00
Alexandros Koutroulis
a2251d1093 SDL_SetWindowIcon now reports errors. (#7081) 2023-02-17 16:17:27 -08:00
Frank Praznik
39e6d4a891 Set the window width and height when moving 2023-02-17 09:25:01 -05:00
Sam Lantinga
630c23ce17 You can move fullscreen desktop windows between displays using SDL_SetWindowPosition() 2023-02-16 17:28:56 -08:00
Sam Lantinga
64b88115ec SDL_SetWindowFullscreen() now takes a boolean value 2023-02-16 17:28:35 -08:00
Sam Lantinga
6c04c6f090 Fixed SDL_SetWindowSize() and SDL_SetWindowPosition()
The backend code expected window->x,y,w,h to be set when updating size and position
2023-02-16 16:59:15 -08:00
Frank Praznik
4187c6c08c video: Select the closest mode for the target refresh rate accounting for small variations
Use the delta of the target refresh rate and the refresh rate of the mode to select the closest matching display mode, as the actual closest mode may have a slightly lower rate than the target by a small fraction of a hz (e.g 59.98 vs 60.0).
2023-02-15 10:07:46 -05:00
Frank Praznik
3f5ef7dd42 video: Handle moving exclusive fullscreen windows between displays
Desktops can move windows, even exclusive fullscreen windows, from one display to another. To handle this, windows now hold two fullscreen modes: the desired mode, which is considered mutable only to the application, and the current mode. When a fullscreen request is made, the current mode is initially set to the desired mode for the initial fullscreen transition. If an exclusive fullscreen window is moved to a new display, the new display is checked to see if it has a mode compatible with the desired mode. If it does, the compatible mode is used so the windows will have the same properties on the new display. If no compatible mode is found, the window becomes desktop fullscreen. This occurs whenever the window is moved to ensure that an attempt will always be made to use the application's requested mode, if possible.

Exiting and reentering fullscreen results in the desired mode being restored on the display specified by it.
2023-02-15 10:07:46 -05:00
Frank Praznik
9370f9ca85 wayland: Deduplicate calls to position fullscreen windows already on the correct output 2023-02-13 13:25:16 -05:00
Frank Praznik
4a6f3cf47e x11: Set the window position when entering fullscreen
Set the window position when entering fullscreen as both real Xorg and XWayland need this in order for the window to be on the correct display.
2023-02-11 14:44:02 -05:00