|
903301c6
|
2022-11-16T02:04:59
|
|
wayland: Always use integer scaling for cursors.
Cursors don't get fractionally scaled, so always scale system cursor sizes to the next whole integer.
|
|
c8551847
|
2022-11-04T12:41:46
|
|
wayland: Handle virtual keyboards that don't fit the X mapping
SDL is built around the concept of keyboards having a fixed layout with scancodes that correspond to physical keys no matter what linguistic layout is used. Virtual keyboards don't have this concept and can present an arbitrary layout of keys with arbitrary scancodes and names, which don't fit the SDL model. When one of these keyboards is encountered, it requires special handling: use the keysym of the pressed keys to derive their ANSI keyboard scancode equivalents for control keys and ASCII characters. All other characters are passed through as text events only.
|
|
eef4d3c8
|
2022-11-13T16:56:04
|
|
wayland: Clamp wl_seat version on older versions of libwayland
Clamp the wl_seat max version to 5 if being built against a version of libwayland below 1.21.0, or containers that bundle newer versions of SDL with older versions of libwayland can break if the compositor advertises support for a protocol version above 5.
|
|
5dc93451
|
2022-11-06T20:49:37
|
|
JANITORIAL : Correct some more spelling mistakes (#6489)
|
|
689218eb
|
2022-11-04T12:07:20
|
|
Fix wayland reconnection paths
Most of this code is disabled out for now.
- For mouse cursors we have a wl_surface for both system and custom
cursors which needs recreating.
- The other patch is about nullification after deletions
|
|
70a41f9b
|
2022-11-01T09:59:16
|
|
wayland: Read `window` data only if `window` is valid
|
|
33a43005
|
2022-10-31T12:23:51
|
|
wayland: Don't modify the mouse capture flag in relative mode
If relative mouse mode is explicitly enabled, don't modify the capture flag on button events or the window might report having lost mouse focus if a button is pressed while moving the cursor.
|
|
571ff1a3
|
2022-10-30T00:19:09
|
|
wayland: Prepare cursor implementation for reconnect support
Co-authored-by: David Edmundson <kde@davidedmundson.co.uk>
|
|
9c8b1fd8
|
2022-10-29T22:34:05
|
|
wayland: Cleanup work to aid reconnect support
Co-authored-by: David Edmundson <kde@davidedmundson.co.uk>
|
|
4223e6ac
|
2022-10-26T13:14:50
|
|
wayland: Early-out sooner when requesting fullscreen on a popup
Exit the fullscreen sequence sooner if it is requested that a popup window be fullscreen.
The surface commit formerly in this path is irrelevant and can be removed as previous changes made it so that SetFullscreen() is no longer called from anywhere except Wayland_SetWindowFullscreen().
|
|
30c2dac7
|
2022-10-25T20:00:38
|
|
wayland: Remove duplicate #include statement
|
|
7c7cd2a6
|
2022-10-17T14:04:29
|
|
Fix issue #6037 (incorrect modifier flags on Wayland)
|
|
ed412c13
|
2022-10-15T14:05:35
|
|
wayland: Cleanup event source comments, headers, and error reporting
Replace instances of fprintf(stderr, ...) with SDL_SetError(), replace C++ comments with C style, use a uniform format for multi-line comments, and remove unused headers as poll and select aren't used in this file (the SDL function which calls them is used instead).
|
|
62047686
|
2022-10-13T16:24:13
|
|
wayland: Don't block on libdecor_dispatch()
libdecor_dispatch() needs to be called, as libdecor plugins might do some required internal processing within, however care must be taken to avoid double-blocking in the case of a timeout, which can occur if libdecor_dispatch() and the SDL event processing both work on the main Wayland queue. Additionally, assumptions that libdecor will always dispatch the main queue or not process zero-length queues (can occur if a wait is interrupted by the application queueing an event) should not be made, as this behavior is outside the control of SDL and can change.
SDL handles polling for Wayland events and then calls libdecor to do its internal processing and dispatch. If libdecor operates on the main queue, it will dispatch the queued events and the additional wl_display_dispatch_pending() call will be a NOP. If a libdecor plugin uses its own, separate queue, then the wl_display_dispatch_pending() call will ensure that the main queue is always dispatched.
|
|
e89389ba
|
2022-10-14T20:41:10
|
|
wayland: Use MAP_PRIVATE when mapping the keyboard keymap file descriptor
Per the Wayland spec, this must be mapped with MAP_PRIVATE in version 7 of the protocol and higher.
|
|
99f2a503
|
2022-10-13T22:40:24
|
|
X11 scancode mapping cleanup
* Consolidated scancode mapping tables into a single location for all backends
* Verified that the xfree86_scancode_table2 is largely identical to the Linux scancode table
* Updated the Linux scancode table with the latest kernel keycodes (still unmapped)
* Route X11 keysym -> scancode mapping through the linux scancode table (which a few hand-written exceptions), which will allow mappings to automatically get picked up as they are added in the Linux scancode table
* Disabled verbose reporting of missing keysym mappings, we have enough data for now
|
|
be2cb000
|
2022-10-11T11:16:52
|
|
wayland: Check for the input handle before checking the keyboard handle
|
|
0b88e609
|
2022-10-11T07:40:35
|
|
wayland: Raise wl_seat maximum version to 8
Version 8 is required for supporting axis_value120 high-resolution scroll events.
|
|
6391ad97
|
2022-10-09T11:11:55
|
|
wayland: Factor out common libdecor frame commit code
The pattern of:
libdecor_state_new()
libdecor_frame_commit()
libdecor_state_free()
was used in several places. Factor it out into a common function.
|
|
b0a9396b
|
2022-10-09T11:06:20
|
|
wayland: Remove XDG surface geometry calls
These were needed to fix some buggy behavior regarding committing old buffer sizes when entering fullscreen that has since been corrected. Remove them.
|
|
b91ddbc3
|
2022-10-09T06:15:18
|
|
wayland: null-terminate drop data
|
|
914a65e0
|
2022-10-06T12:39:36
|
|
wayland: Don't unset min/max values when entering fullscreen via a compositor event
If the compositor is entering fullscreen and hasn't removed any constraints itself, it's already too late at this point. Remove the unnecessary call.
Restoring the limits when exiting fullscreen is still required, though, as they may have been removed when entering fullscreen via an SDL request.
|
|
69cf5fb0
|
2022-10-04T13:09:35
|
|
wayland: Remove surface type helpers
These were remnants of a time before the surface type was explicitly stored, so they can be removed per the TODO note.
|
|
c2b0c41c
|
2022-10-04T12:59:26
|
|
wayland: Set/unset the opaque regions on surfaces when transparency is toggled
Caches the SDL_HINT_VIDEO_EGL_ALLOW_TRANSPARENCY hint at init time and registers a callback, which is fired when the hint is changed during runtime and toggles the opaque region for existing surfaces.
|
|
ea595800
|
2022-10-03T18:31:15
|
|
wayland: Set the damage buffer size when supported
The preferred method for setting the damage region on compositor protocol versions 4 and above is to use wl_surface.damage_buffer. Use this when available and only fall back to wl_surface.damage on older versions.
Bumps the highest supported version of wl_compositor to version 4.
|
|
a8cb7bbe
|
2022-10-01T11:31:26
|
|
wayland: Add dedupe logic to window geometry configuration
Adds deduplication logic to ConfigureWindowGeometry() to avoid setting redundant backbuffer, viewport and surface opaque region dimensions. State is now only set when the window and/or backbuffer dimensions change.
This repurposes the viewport rect to always hold the actual size of the window, which can differ from the SDL size if things are being scaled. The SDL_Rect was removed in favor of two ints, as the x/y members of the struct were never used, so they just wasted space.
Since the internal variables always have the true window size, the width/height getter functions are no longer required and can be removed.
|
|
ad29875e
|
2022-04-18T17:03:05
|
|
Wayland: Emulate mouse warp using relative mouse mode
Several games (including Source and GoldSrc games, and Bioshock
Infinite) attempt to "fake" relative mouse mode by repeatedly warping
the cursor to the centre of the screen. Since mouse warping is not
supported under Wayland, the viewport ends up "stuck" in a rectangular
area.
Detect this case (mouse warp while the cursor is not visible), and
enable relative mouse mode, which tracks the cursor position
independently, and so can Warp successfully.
This is behind the SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP hint, which
is enabled by default, unless the application enables relative mouse
mode itself using SDL_SetRelativeMouseMode(SDL_TRUE).
Note that there is a behavoural difference, in that relative mouse mode
typically doesn't take mouse accelleration into account, but the
repeated-warping technique does, so mouse movement can seem very slow
with this (unless the game has its own mouse accelleration option, such
as in Portal 2).
|
|
e17f0c28
|
2022-09-27T10:59:28
|
|
wayland: Call the Wayland hide/show functions directly when changing decoration modes
Calling SDL_HideWindow() to destroy the window is a NOP if the SDL_WINDOW_SHOWN flag was never set. Bypass it and call the Wayland-specific function directly to ensure that the window is always destroyed before switching from server-side to client-side decorations, even if it hasn't been shown yet.
Likewise, call Wayland_ShowWindow() directly when the window isn't explicitly hidden to ensure that it is always recreated since the SDL_WINDOW_SHOWN flag won't be cleared, which, when set, renders SDL_ShowWindow() a NOP.
|
|
4a06cc0f
|
2022-09-22T13:03:09
|
|
wayland: Apply modifier changes to the text of repeated keys
The text component of a repeated keystroke is initially set when a key is first pressed and the cached value remains static until the repeated key is released and another repeatable key is pressed. If the state of a modifier such as shift or capslock is changed while a key is being repeated, the text emitted will not have the modifier applied to it until the repeated key is released and pressed again.
Update the text to be repeated by a key if a modifier is changed while a key is actively being repeated.
|
|
467c82c7
|
2022-09-23T12:31:40
|
|
wayland: Add mappings for the Escape and NumLock keys
The XKB keysym to SDL keycode mappings were missing for the Escape and NumLock keys, which prevented them from being remapped. Add them to the table so that the remapping of these keys will work.
|
|
399cb2f0
|
2022-09-21T13:20:39
|
|
wayland: Only clear the key repeat flag when the repeated key is released
If multiple keys were simultaneously depressed and one was being repeated, the repeat flag was being cleared when any of the pressed keys were released, even if the released key wasn't the one being repeated.
This tracks the key currently being repeated and only clears the repeat flag when the particular key being repeated is released.
|
|
ac5b9bc4
|
2022-09-14T18:28:35
|
|
Add support for X11 primary selection (#6132)
X11 has a so-called primary selection, which you can use by marking text and middle-clicking elsewhere to copy the marked text.
There are 3 new API functions in `SDL_clipboard.h`, which work exactly like their clipboard equivalents.
## Test Instructions
* Run the tests (just a copy of the clipboard tests): `$ ./test/testautomation --filter Clipboard`
* Build and run this small application:
<details>
```C
#include <SDL.h>
#include <unistd.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void print_error(const char *where)
{
const char *errstr = SDL_GetError();
if (errstr == NULL || errstr[0] == '\0')
return;
fprintf(stderr, "SDL Error after '%s': %s\n", where, errstr);
SDL_ClearError();
}
int main()
{
char text_buf[256];
srand(time(NULL));
SDL_Init(SDL_INIT_VIDEO);
print_error("SDL_INIT()");
SDL_Window *window = SDL_CreateWindow("Primary Selection Test", SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED, 400, 400, SDL_WINDOW_SHOWN);
print_error("SDL_CreateWindow()");
SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
print_error("SDL_CreateRenderer()");
bool quit = false;
unsigned int do_render = 0;
while (!quit) {
SDL_Event event;
while (SDL_PollEvent(&event)) {
print_error("SDL_PollEvent()");
switch (event.type) {
case SDL_QUIT: {
quit = true;
break;
} case SDL_KEYDOWN: {
switch (event.key.keysym.sym) {
case SDLK_ESCAPE:
case SDLK_q:
quit = true;
break;
case SDLK_c:
snprintf(text_buf, sizeof(text_buf), "foo%d", rand());
SDL_SetClipboardText(text_buf);
print_error("SDL_SetClipboardText()");
printf("clipboard: set_to=\"%s\"\n", text_buf);
break;
case SDLK_v: {
printf("clipboard: has=%d, ", SDL_HasClipboardText());
print_error("SDL_HasClipboardText()");
char *text = SDL_GetClipboardText();
print_error("SDL_GetClipboardText()");
printf("text=\"%s\"\n", text);
SDL_free(text);
break;
} case SDLK_d:
snprintf(text_buf, sizeof(text_buf), "bar%d", rand());
SDL_SetPrimarySelectionText(text_buf);
print_error("SDL_SetPrimarySelectionText()");
printf("primselec: set_to=\"%s\"\n", text_buf);
break;
case SDLK_f: {
printf("primselec: has=%d, ", SDL_HasPrimarySelectionText());
print_error("SDL_HasPrimarySelectionText()");
char *text = SDL_GetPrimarySelectionText();
print_error("SDL_GetPrimarySelectionText()");
printf("text=\"%s\"\n", text);
SDL_free(text);
break;
} default:
break;
}
break;
} default: {
break;
}}
}
// create less noise with WAYLAND_DEBUG=1
if (do_render == 0) {
SDL_RenderPresent(renderer);
print_error("SDL_RenderPresent()");
}
do_render += 1;
usleep(12000);
}
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
SDL_Quit();
print_error("quit");
return 0;
}
```
</details>
* Use c,v,d,f to get and set the clipboard and primary selection.
* Mark text and middle-click also in other applications.
* For wayland under x:
* `$ mutter --wayland --no-x11 --nested`
* `$ XDG_SESSION_TYPE=wayland SDL_VIDEODRIVER=wayland ./<path_to_test_appl_binary>`
|
|
929d5b80
|
2022-09-12T22:39:44
|
|
wayland: Use the backbuffer size for determining if a resize event is required
In some cases, a backbuffer size update may not be accompanied by a resize event if the window size and/or scale were updated before the new backbuffer size was recomputed. Instead of the scale, use the old/new backbuffer sizes to determine if a resize event is required so that a backbuffer size change will always be followed by a resize event.
|
|
edfb00c2
|
2022-09-09T14:26:44
|
|
wayland: Only commit on move if the display was changed
Only commit on a move event if the display was changed for a fullscreen window and the compositor has returned bad dimensions.
|
|
97a5e744
|
2022-09-06T17:08:27
|
|
wayland: Remove duplicate code
Wayland_SetWindowSize() can be simplified with the common CommitWindowGeometry() function.
|
|
78f843f7
|
2022-09-06T13:19:23
|
|
wayland: Remove unnecessary function parameter
SetFullscreen() is never called in a case where the commit parameter is false anymore, so the parameter is unnecessary.
|
|
768b6728
|
2022-09-04T23:39:05
|
|
wayland: Compare against the old scale when resizing
Compare against the old scale instead of the new or the conditional will always be true.
|
|
07aea476
|
2022-09-03T13:30:49
|
|
wayland: Ignore content sizes from libdecor when hiding a window
When hiding a window, libdecor can report bogus content region sizes that are +/- the height of the title bar. Ignore any size values from libdecor when hiding a window, or the size may be incorrect when restored.
|
|
6de12b4a
|
2022-09-06T13:30:19
|
|
wayland: Update the internal state when the compositor moves a fullscreen window
The compositor can arbitrarily move windows between displays, including fullscreen windows. Update the internal state when a fullscreen window is moved so the internal SDL state accurately reflects the window location, and resize the window to fit the new display.
This also fixes an edge case where the compositor can make a window fullscreen on a different display than SDL thinks it will be on (usually when a window is made fullscreen by the compositor while straddling multiple displays), which can result in the window being incorrectly sized.
|
|
a7d34595
|
2022-09-03T13:11:29
|
|
wayland: Trigger a commit on fullscreen update
If additional fullscreen requests are received when the window is already fullscreen, it is typically due to the fullscreen flags or emulated video mode being changed. A commit must be explicitly triggered or the requested changes won't take effect until some other event, such as a resize or focus change, causes the changes to be committed.
|
|
707b561f
|
2022-09-03T12:37:02
|
|
wayland: Enable compositor fullscreen toggling
The compositor can toggle the fullscreen state (via a hotkey or otherwise), so the internal SDL state must be updated accordingly when it does.
When toggling fullscreen via the compositor, SDL will attempt to use the last fullscreen flag explicitly set. If no flag was previously set, SDL_WINDOW_FULLSCREEN will be used if a window video mode was set, otherwise SDL_WINDOW_FULLSCREEN_DESKTOP will be used. If the previous flag was SDL_WINDOW_FULLSCREEN and the window video mode was cleared, it will revert to SDL_WINDOW_FULLSCREEN_DESKTOP.
|
|
31979e2d
|
2022-09-02T18:41:21
|
|
wayland: Add missing static qualifiers
|
|
1c88a052
|
2022-09-09T16:03:17
|
|
Update Wayland cursors to match X11 cursors
|
|
ce227aa6
|
2022-08-26T01:57:09
|
|
wayland: fix build with SDL_WAYLAND_SHARED=OFF/--enable-wayland-shared=no
|
|
00452e47
|
2022-08-24T11:25:13
|
|
Adding SDL_GetWindowSizeInPixels for window size in pixels (#6112)
|
|
d166f5ef
|
2022-08-22T14:10:54
|
|
Fixed uninitialized variable warning
|
|
057086e3
|
2022-07-15T13:44:49
|
|
wayland: Add high resolution scroll wheel support
Update the Wayland core protocol spec file and add support for the new axis_value120 event to handle high resolution scroll wheels.
The axis_value120 replaces the axis_discrete event, which is no longer sent as of version 8 of the protocol. Note that unlike the axis_discrete event, no mention in the spec is made regarding how many axis_value120 events may occur per-axis per-frame, so the values are accumulated and committed when the pointer frame event occurs.
|
|
d731ad76
|
2022-07-15T10:44:38
|
|
wayland: Fix include order when building with libdecor
The libdecor header internally includes wayland-client.h, which pulls in the wayland-client-protocol.h file from the system include path and overrides the local one generated from the included Wayland protocol spec files. Move the Wayland protocol header inclusion above the libdecor header inclusion to ensure that the locally generated protocol header is used instead.
|
|
6e007c36
|
2022-08-18T19:05:55
|
|
Add null termination to Wayland_data_source_get_data() if requested
Fixes https://github.com/libsdl-org/SDL/issues/6083
|
|
948dbe7d
|
2022-08-18T16:24:20
|
|
Don't include the null terminator in Wayland clipboard text
Fixes https://github.com/libsdl-org/SDL/issues/6083
|
|
3bae2d57
|
2022-08-18T12:39:47
|
|
wayland: Set the libdecor app ID after visibility calls
Set the frame app ID after toggling visibility or the name displayed in window manager task switchers may not display correctly.
|
|
7da74eb5
|
2022-08-17T14:59:23
|
|
wayland: Never commit with an undefined window title
If libdecor performs a commit with the frame title being undefined, a crash can occur within the library or its plugins. Always ensure that the title is set to a valid string to avoid this.
|
|
650612fd
|
2022-08-13T16:54:27
|
|
wayland: Eliminate excessive calls to SetFullscreen
Eliminate excessive calls to SetFullscreen by removing the calls in the libdecor and xdg-toplevel config callbacks.
These calls were being made there in case something explicitly called the window minimization function from within SDL, which unsets fullscreen, and as minimizing a window in Wayland is just a suggestion to the compositor and doesn't actually change the window state or communicate anything back to the application, it was necessary to call SetFullscreen in every call to the config functions just in case something minimized a window via SDL_MinimizeWindow() and later needed to restore it. GNOME in particular had issues when fullscreen set/unset operations were being hammered, leading to overlapping acks and commits when switching to fullscreen.
With the new video system flag to disable unsetting fullscreen when minimizing a window, these calls in the configuration functions are no longer needed and can be removed. This significantly reduces calls to the SetFullscreen() function, reverts #6044 while fixing the issue, and fixes a similar problem when hiding and showing a window initially created with fullscreen flags.
|
|
cc9cc202
|
2022-08-13T16:43:15
|
|
video: Add video device quirk flags and apply them to the video subsystem
Add quirk flags to the video device struct and add flags to allow video backend drivers to disable mode switching and disable unsetting the fullscreen mode when minimizing a window. As certain platforms can have multiple video backends compiled in at once, #ifdefs, as used by other platforms, aren't suitable as different backends on the same platform may not need the same quirks.
This replaces the formerly dedicated 'disable_display_mode_switching' boolean as additional quirks are needed by the Wayland backend. Helper functions have also been added to simplify reading the flag states.
|
|
74bdb211
|
2022-08-12T22:01:12
|
|
wayland: Don't roundtrip in ShowWindow unless restoring a hidden window
Don't call the roundtrip in ShowWindow unless restoring a previously hidden window. This fixes a regression in GNOME when creating a window with the fullscreen flag set, as the fullscreen window will be positioned down the screen by the height of the top bar if the window is made fullscreen on the primary display and the roundtrip is called when initially displaying the window.
|
|
1b08cd20
|
2022-08-12T18:55:05
|
|
wayland: Add roundtrip in SetWindowFullscreen() to get new size
The video core assumes that window->w/h will be updated before returning
from SetWindowFullscreen(). This is needed to generate a resize event
with the correct window size when exiting fullscreen.
The roundtrip allows us to receive the configure callback that informs
us of the new window size before returning.
Fixes #6043
|
|
780b031b
|
2022-08-12T16:39:39
|
|
wayland: Avoid duplicate resize events when entering fullscreen
|
|
5f682e77
|
2022-08-10T20:01:15
|
|
wayland: Remove freed display from `SDL_WaylandOutputData->output_list`
|
|
dd2e3182
|
2022-08-06T12:31:06
|
|
wayland: Use libdecor visibility toggle for hiding/showing the window
The current method of toggling the libdecor window visibility by destroying and recreating the frame results in a race where a use-after-free bug can manifest itself within libdecor when window visibility is toggled quickly. Instead, use the libdecor function for toggling visibility instead of destroying and recreating the frame every time.
|
|
f600364b
|
2022-08-06T09:19:52
|
|
wayland: Mark window as MOUSE_CAPTURE while a mouse button is down.
Wayland works like SDL's "auto capture" feature already, tracking the mouse
globally only while a drag is occuring, and this is the only way to get mouse
input outside the window.
Setting this flag ourselves lets SDL_CaptureMouse() work in the most common
use case without actually implementing CaptureMouse for the backend, including
SDL's auto capture feature.
Fixes #6010.
|
|
a6179e85
|
2022-08-05T21:23:39
|
|
wayland: Don't double-free clipboard sources if ours gets cancelled.
Fixes #6007.
|
|
3685c64e
|
2022-08-05T16:16:31
|
|
wayland: Round trip after window show/hide operations.
Perform a round trip after showing/hiding the window to avoid protocol errors when ShowWindow() is called immediately after HideWindow().
|
|
0b9868b0
|
2022-08-02T12:56:56
|
|
wayland: Use D-Bus to retrieve the cursor size and theme on GNOME
GNOME exposes the cursor size and theme via the org.freedesktop.portal.Settings interface of the xdg-desktop portal, so query these values via D-Bus, if available.
The XCURSOR_SIZE/XCURSOR_THEME envvars will be tried first, so as not to override any user specified sizes or themes, then D-Bus, then, failing that, it will fall back to default values.
|
|
8b438f7b
|
2022-07-31T15:34:03
|
|
keyboard: Only send SDL_KEYMAPCHANGED when the keymap actually changes
|
|
21100006
|
2022-07-30T16:22:24
|
|
Don't conflict with usage of stdout as a stdio macro
Patch inspired by http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/pkgsrc/devel/SDL2/patches/patch-src_video_wayland_SDL__waylandmessagebox.c?rev=1.1&content-type=text/plain
|
|
20a76b0e
|
2022-07-25T23:06:58
|
|
video: removed unused devindex argument from bootstrap's create method.
|
|
041666e6
|
2022-07-24T05:45:59
|
|
video: wayland: Don't switch to libdecor path for borderless windows
We actually request CSD mode with xdg-decoration for borderless
windows, so we get what we wanted there and there's no point in going
into fallback paths.
|
|
405d1f65
|
2022-07-24T10:16:20
|
|
video: wayland: Roundtrip after falling back to libdecor in xdg-decoration handler
Otherwise libdecor doesn't have a chance to acquire xdg-toplevel after
libdecor_new before we attempt to use it in Wayland_ShowWindow.
Fixes #5952
|
|
78bad667
|
2022-07-16T22:12:08
|
|
video: wayland: Resize the window before sending the SDL_RESIZE event
Currently, the SDL_WINDOWEVENT_RESIZED event is sent before the actual
window is resized (and various internal state, such as the desired
GL/Vulkan backbuffer size, are updated). This makes sense, as SDL will
discard a no-op resize, which would be the case if we had resized before
sending the event (indeed, there are existing hacks to prevent this).
However, this means that SDL_{GL,Vulkan}_GetDrawableSize() will still
use the old size in the SDL_WINDOWEVENT_RESIZED handler. In the case of
SDL_Renderer, this means the drawable size it uses will be wrong, and
the viewport will get "updated" to the old value.
This then results in bug #5899.
|
|
b085c182
|
2022-07-04T16:38:05
|
|
make SDL_SetTextInputRect take a pointer to const
The documentation doesn't state that the argument is ever modified,
and no implementation does so currently.
This is a non-breaking change to guarantee as much to callers.
|
|
78089e65
|
2022-07-01T13:08:31
|
|
Remove unused internal header SDL_sysevents.h
|
|
c11bdeeb
|
2022-06-21T13:28:14
|
|
wayland: Round fractional backbuffer sizes halfway away from zero
Use SDL_lroundf() to round fractional backbuffer sizes halfway away from zero, as this is the rounding method recommended by the forthcoming Wayland fractional scaling protocol.
|
|
5f6d0abe
|
2022-06-18T12:57:27
|
|
SDL_SendEditingText() has int parameters, so use that type for parameter calculation
We might want to use ssize_t as @Guldoman suggested, but that's a larger internal API change, and still requires casting of the SDL_utf8strnlen() result.
Fixes https://github.com/libsdl-org/SDL/pull/5821
|
|
adc68758
|
2022-06-17T10:22:28
|
|
Added SDL_copyp to avoid size mismatch when copying values (thanks @1bsyl!)
Closes https://github.com/libsdl-org/SDL/pull/5811
|
|
f8ae3ef1
|
2022-06-15T22:01:59
|
|
wayland: use libdecor resize edge enums for libdecor
|
|
e427e80b
|
2022-06-14T10:41:18
|
|
wayland: Use the output descriptions from xdg-output when available
Some compositors will provide 'nicer' / 'human readable' output descriptions via the xdg-output protocol. Use these description strings, when available, instead of the model name provided by wl-output. On compositors such as GNOME where this is provided, the display names provided to applications by SDL will now match those in the desktop display settings panel. On compositors where this data isn't provided, the old behavior of using the model string provided by wl-output will remain unchanged.
Additionally, per the protocol spec, output data provided by xdg-output should supersede wl-output data, so this is the recommended behavior in general.
|
|
4a3277b0
|
2022-05-19T15:13:02
|
|
wayland: Always commit window constraints before entering fullscreen
XDG-toplevel min/max size values are double-buffered data and must be committed before entering the fullscreen state, or a max window size value smaller than the display dimensions may cause the compositor to incorrectly configure the fullscreen window size. This fixes windowed->fullscreen transitions on GNOME, where, previously, certain combinations of window flags and min/max size values could cause entering fullscreen mode to fail with odd window sizes and/or offsets due to the new max size values not being committed before entering fullscreen, causing the compositor to clamp to the old values.
In the case of libdecor, it has its own layer of buffering on top of the xdg-toplevel surface for the min/max window dimensions, so both a frame commit and surface commit are required to set the state properly.
|
|
78698a0b
|
2022-05-17T12:37:16
|
|
wayland: Use a separate frame callback for setting the surface damage region
Previously, the surface damage region was being set in the same callback used for preventing render hangs in the GL backend when the surface was not visible. This was not ideal, as the callback was never fired in the case of using a different render backend or having a swap interval of 0. Use a separate frame callback for setting the surface damage region to ensure that it fires reliably, regardless of the backend being used or swap interval.
|
|
146ea9b0
|
2022-05-16T18:18:55
|
|
wayland: Only set the surface opaque region if EGL transparency is disabled
Check if the "SDL_VIDEO_EGL_ALLOW_TRANSPARENCY" hint is enabled and don't mark surfaces as opqaue if it is.
|
|
a20516d4
|
2022-05-16T10:35:56
|
|
wayland: Swap emulated mode dimensions in more cases
Some compositors (GNOME for example) don't set the transform flag when dealing with portrait mode displays, so the video modes won't have the width/height swapped in all cases where they should be. Check for both the 90/270 degree transform flag and if the display is taller than it is wide when determining whether to swap the width and height of the emulated video modes, and adjust the comparison logic when size testing against the native mode to account for this.
|
|
e1c83504
|
2022-05-15T10:35:59
|
|
wayland: Add a hint to disable video mode emulation under Wayland
Add the hint "SDL_VIDEO_WAYLAND_MODE_EMULATION", which can be used to disable mode emulation under Wayland. When disabled, only the desktop and/or native display resolution is exposed.
|
|
e9d3dcea
|
2022-05-14T18:32:05
|
|
wayland: Unify integer and fractional output scaling
Previously, scale values used by the displays and surfaces were always integers, with fractional scale values only being calculated when the backbuffer and viewport sizes were being determined. Now, if xdg-output is available, the fractional scale of output displays is calculated when the displays are enumerated and the true scale values of the output devices are used whenever possible.
This unifies the integer and fractional scaling systems, allows for the use of more accurate scale values that minimize overdraw when windows straddle multiple outputs, and lays the groundwork for the pending Wayland scaling protocols that will report the preferred scale values per-surface instead of per-output.
|
|
4fde7dd8
|
2022-05-14T14:42:52
|
|
wayland: Refactor the Wayland mode emulation and viewport logic
Compartmentalize the fullscreen mode emulation code blocks, unify the windowed/fullscreen viewport logic, consolidate all window geometry code into a central function to eliminate blocks of duplicate code and rename related variables and functions to more explicitly reflect their purpose.
|
|
d11702ce
|
2022-05-05T02:34:16
|
|
ime: wayland: Make use of `SDL_TEXTEDITING_EXT`
Because we were sending multiple chunks of preedit strings,
`SDL_SendEditingText` was using the old `SDL_TEXTEDITING` event only.
Now if `SDL_HINT_IME_SUPPORT_EXTENDED_TEXT` is enabled, we send the full
string and correctly set the cursor position and selection size.
|
|
847539af
|
2022-06-01T23:06:19
|
|
wayland: Only call libdecor_dispatch() if we've loaded libdecor
As of #5703, we call libdecor_dispatch() in Wayland_WaitEventTimeout(),
but this will crash if we don't load libdecor, as
SDL_VideoData::shell.libdecor will be NULL.
Since we don't load libdecor if we don't intend to use it (i.e., if
should_use_libdecor returns false), this results in a crash under KDE in
almost all circumstances.
|
|
e59cba95
|
2022-05-21T13:50:56
|
|
add libdecor_dispatch
|
|
501a4991
|
2022-05-05T18:44:32
|
|
Add clang-format on/off comments where necessary.
Comments were added in places where INDENT-ON/OFF comments are. Places
like stdlib's asm don't need it as clang-format doesn't try to indent it.
|
|
e4bb3c86
|
2022-05-11T18:13:44
|
|
wayland: Fix build for configs without libdecor
|
|
6222bd31
|
2022-05-11T16:26:43
|
|
wayland: Don't create a new libdecor context if one already exists
|
|
6f88cbe4
|
2022-05-11T16:04:34
|
|
wayland: Support xdg_decoration requesting client-side decorations.
Don't be fooled by the diff size - this ended up being a big refactor of the
shell surface management, masked only by some helper macros I wrote for the
popup support.
This change makes it so when xdg_decoration is supported, but CSD is requested,
the system bails on xdg support entirely and resets all the windows to use
libdecor instead. This transition isn't pretty, but once it's done it will be
smooth if decorations are an OS toggle since libdecor will take things from
there.
In hindsight, we really should have designed libdecor to be passed a toplevel,
having it manage that for us keeps causing major refactors for _every_ change.
|
|
aeadbdd7
|
2022-04-20T09:00:00
|
|
Remove an unused function prototype
|
|
c8c59a21
|
2022-04-20T08:58:58
|
|
Fix a -Wshadow warning
|
|
c37090f9
|
2022-04-18T12:30:08
|
|
wayland: Add support for TOOLTIP/POPUP_MENU
|
|
edb473cf
|
2022-04-15T15:03:28
|
|
video: Wayland: Always round scaled pointer coordinates down
Rounding up can cause the pointer coordinates to exceed the window boundaries at the right and bottom edges.
|
|
13393a1c
|
2022-04-15T14:28:07
|
|
video: Wayland: Clamp fullscreen window dimensions to desktop
A scaled fullscreen window may exceed the bounds of the desktop. Clamp the window size to the desktop dimensions in fullscreen mode.
|
|
9c2f46b0
|
2022-04-12T15:23:22
|
|
Wayland: Add SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR
This hint allows libdecor to be used even when xdg-decoration is
available. It's mostly useful for debugging libdecor, but could in
theory be used by applications which want to (for example) bundle their
own libdecor plugins.
|
|
c2093fab
|
2022-04-08T13:58:45
|
|
video: wayland: Set the surface damage region when using fullscreen viewports
When using emulated display modes, the output size is often larger than the drawable buffer. As the surface damage region is automatically calculated from the smaller drawable buffer size, the damage region needs to be manually set to cover the entire viewport region or visual repaint artifacts can result.
|
|
d1f7f9e3
|
2022-04-06T11:18:46
|
|
wayland: Pin the fake window position at (0, 0).
I kind of thought it'd be nice to have it in the center, but this is an issue
for applications that still assume global mouse and window positions are
accessible. For example, this fixes cursor offset issues in UE5.
|
|
279aeb59
|
2022-04-06T01:32:57
|
|
wayland: Add a bug link for the detach FIXME
|
|
3ada694e
|
2022-04-06T01:18:03
|
|
wayland: Try to detach at the beginning of ShowWindow, just in case.
It's possible that an external component (probably a GL/VK context) committed, so we need to cover our bases and detach in both HideWindow and ShowWindow.
Fixes a crash in UE5 editor's pop-ups.
|