src/video


Log

Author Commit Date CI Message
Sam Lantinga 41e1a236 2021-07-27T16:50:06 Correct the maximized size and position for borderless resizable windows This fixes bug https://github.com/libsdl-org/SDL/issues/4043
Ethan Lee 03185e74 2021-07-27T18:35:00 wayland: Tag/Check wl_output objects as well, fixes crashes when libdecor is in use
Ryan C. Gordon 871c1119 2021-07-27T18:24:09 wayland: handle pending resizes immediately, not on SwapWindow. This was originally a workaround for an old Mesa bug, since fixed, apparently, and causes other problems. Fixes #4326.
Sam Lantinga 51c61d7c 2021-07-27T14:57:18 Run the entire Cocoa messagebox function on the main thread. This fixes bug https://github.com/libsdl-org/SDL/issues/4420
Sam Lantinga dfd3f30e 2021-07-27T14:27:37 Make Cocoa_HandleTitleButtonEvent() static since it's not used anywhere else
Ethan Lee a3eb297e 2021-07-27T17:17:19 wayland: Rework enter/leave and update_scale_factor to avoid bogus wl_output data. Also remove get_window_scale_factor() which was just pointless indirection.
Simon Zeni 6aae5b44 2021-07-27T17:12:26 Remove wl-shell and xdg-shell-unstable-v6 support (#4323) * wayland-protocol: update wayland.xml to 1.19.0 * wayland: remove shell_surface field from SDL_SysWMinfo * wayland: remove wl_shell support * waypand-protocols: update xdg-shell.xml to 1.20 * wayland: remove xdg-shell-unstable-v6 support * wayland: deprecate wl shell surface syswm info, add xdg surface
Sam Lantinga 88e4755c 2021-07-27T12:43:00 Make sure we don't try to turn on relative mouse mode while clicking on the window title bar. This fixes bug https://github.com/libsdl-org/SDL/issues/4469
Ozkan Sezer d80ef3e5 2021-07-26T22:51:24 SDL_VideoInit: silence 'may be used uninitialized' warning src/video/SDL_video.c:475: warning: 'i' may be used uninitialized in this function
Luis Cáceres 5ec69285 2021-04-02T06:16:09 Support comma-separated lists in SDL_VIDEODRIVER
Christian Rauch ac904b8e 2021-06-21T01:25:25 wayland: ignore resize in fullscreen or maximised mode
Christian Rauch ee062c64 2021-05-19T00:13:39 wayland: implement toggling decorations
Christian Rauch 2b3cf36f 2021-05-22T00:49:10 wayland: forward window events
Christian Rauch 48066984 2021-04-05T14:09:03 wayland: enable/disable ACTION_RESIZE for fullscreen
Christian Rauch 9e6fcbe7 2020-06-11T22:10:28 wayland: client-side decoration
Christian Rauch e5f9fae0 2021-05-16T23:19:45 wayland: don't flush after setting fullscreen
Mathieu Eyraud 8e604a5f 2021-07-25T18:44:33 Fix error handling in X11_SetWindowTitle X11_XChangeProperty return 1 on success.
Jaylon Gowie bc3b98f3 2021-07-25T03:33:44 Replace with SDL_SendKeyboardKeyAutoRelease
Jaylon Gowie 5cd37c0a 2021-07-25T01:04:51 Add Enter Key support to PSVita IME keyboard
Sam Lantinga 3b85e3fd 2021-07-24T15:47:11 Fixed internal Windows key state when using Windows+Space or Windows+G shortcuts This fixes bugs: https://github.com/libsdl-org/SDL/issues/4369 https://github.com/libsdl-org/SDL/issues/4500
Sam Lantinga 03c19efb 2021-07-24T15:25:50 Added support for multiple seats with touch input on Wayland This fixes bug https://github.com/libsdl-org/SDL/issues/4517
Sam Lantinga ff1b5e1b 2021-07-24T15:10:57 Implemented the window flash operations for X11
Sam Lantinga f1633127 2021-07-24T13:41:55 Added a window flash operation to be explicit about window flash behavior
Sam Lantinga e1c3a250 2021-07-24T12:11:27 Changed SDL_FlashWindow() so it doesn't take a flash count, and added the hint SDL_HINT_WINDOW_FLASH_COUNT to control behavior on Windows
Sebastian Krzyszkowiak 7b0092db 2021-07-23T18:58:25 vita: touch: Mark the back panel as an indirect absolute touch device It's not a touchscreen, but an additional touch panel on the back of the device.
Jaylon Gowie 48bbe31b 2021-07-20T21:45:21 Add PreSwapCallback for updating SceCommonDialog
Jaylon Gowie 9c1306bc 2021-07-20T21:44:16 Add elgext.h header
meyraud705 4ada14a2 2021-07-21T13:39:10 Replace libc functions to SDL equivalent in wayland video subsystem Wayland video subsystem uses a mix of libc and SDL function. This patch switches libc functions to SDL ones and fixes a mismatch in memory allocation/dealoccation of SDL_Cursor in SDL_waylandmouse.c (calloc on line 201 and SDL_free on line 313) which caused memory corruption if custom memory allocator where provided to SDL.
Niklas Haas d6641d71 2021-07-19T11:52:57 kmsdrm: Explicitly set the surface transform and alpha mode This is required by the specification. Set these to sensible defaults. Fixes a validation layer error that occurs otherwise.
Niklas Haas 76007427 2021-07-19T11:26:54 kmsdrm: Properly zero-initialize CreateInfo structs As written, these contain undefined stack contents, which in practice causes crashes/hangs and/or triggers the validation layers (they complain about `pNext` and `flags` not being NULL).
Brick 7fe6dbaf 2021-07-11T15:25:24 Reset rawInputEnableCount when RawInput is not supported
Hanseul Jun 557d0f82 2021-03-11T13:36:56 Commenting a false alarm in WIN_GLES_SetupWindow. When hint SDL_HINT_OPENGL_ES_DRIVER is set to "1" (e.g. for ANGLE support), assertion due to !_this->gl_config.driver_loaded can be causes while EGL is available.
Dean Herbert 4359a47b 2021-04-02T12:48:16 Simplify ClipCursor behaviour when RelativeMouseMode is enabled The implementation of clip logic for relative mode seemed to unnecessarily limit the usable area to the middle of the window, in a 2x2 pixel region. This has the adverse side effect of moving the operating system cursor to that location, even if it is in a valid location in the window. While in most scenarios this is handled correctly (by storing the original position of the cursor in the window and restoring when leaving relative mode), there are edge cases where this clip operation can cause WM_MOUSEMOVE to fire at a point in time where it counts as a relative delta from SDL's perspective.
Dean Herbert 3720e254 2021-04-02T12:48:02 Trim some stray whitespace
Austin Shafer 16e3bfe8 2021-06-28T11:29:16 SetDisplayMode: Call XRRSetScreenSize before setting CRTC config X11_SetDisplayMode currently calls X11_XRRSetCrtcConfig alone. This results in the monitor's viewport getting changed, but the underlying screen dimensions stay the same. The spec indicates that RRSetCrtcConfig only changes the crtc mode and has no effect on the screen dimensions, only mentioning that the new crtc must fit entirely within the screen size. For the size to change, RRSetScreenSize also needs to be called. This affects Metro Exodus on Linux, when changing the resolution in the in-game settings Metro gets stuck in a loop waiting for the size of its vulkan surface to change. Because XRRSetScreenSize is not called the screen size is never changed, the vulkan surface dimensions do not change, and Metro hangs forever watching for a surface size update that will never come. This change disables the CRTC, calls XRRSetScreenSize, and then updates the CRTC configuration. This fixes changing the resolution from the Metro settings. Tested with: Metro Exodus, Portal 2
Sam Lantinga 46f19c31 2021-07-08T07:23:29 Implemented mouse relative mode for iOS 14.1 and newer
Ivan Epifanov 0994a758 2021-07-01T20:36:49 Don't hardcode message length
Ivan Epifanov 9d452719 2021-06-21T15:42:47 Vita: append messagebox title
Ozkan Sezer 33b84c8d 2021-06-24T23:10:56 s/memcmp/SDL_memcmp/ for conistency
Ethan Lee 56b77b12 2021-06-04T19:51:58 cocoa: Implement FlashWindow
scribam c2e8a791 2021-06-12T16:20:47 SDL_windowsevents: add support for multiple mice
Anthony Pesch c262569c 2021-06-22T00:03:18 kmsdrm: fix KMSDRM_SetDisplayMode being called for the default desktop mode doing nothing
Anthony Pesch 98bda391 2021-06-23T00:21:31 kmsdrm: sync the display's current mode with what's set in KMSDRM_CreateSurfaces
Anthony Pesch d031a24e 2021-06-08T00:39:04 kmsdrm: defer surface recreation inside of KMSDRM_SetWindowSize and KMSDRM_SetWindowFullscreen as is done in KMSDRM_SetWindowDisplayMode
Anthony Pesch 5a296e25 2021-06-08T20:48:24 kmsdrm: avoid overriding the mode requested by SDL_SetWindowDisplayMode when recreating surfaces
Ryan C. Gordon 839387ed 2021-06-17T22:09:13 video/dummy: Don't zero out the fake display mode before adding it. The SDL_zero call was in the wrong place as a historical accident, I think.
Sam Lantinga 268fbcd4 2021-06-17T11:23:47 Fixed compiler warning on Visual Studio
Ethan Lee 7f261d3b 2021-06-15T00:35:13 wayland: Fix returning to a window from fullscreen without calling SetWindowSize
Ozkan Sezer bc9888c9 2021-06-12T14:55:24 OS2_GetDisplayModes: malloc a new copy of mode's driver data. Based on a patch by Jochen Schäfer <josch1710@live.de> : The problem is, that in the initialization code uses the same structure for desktop_mode and current_mode. See SDL_os2video.c:OS2_VideoInit(): stSDLDisplay.desktop_mode = stSDLDisplayMode; stSDLDisplay.current_mode = stSDLDisplayMode; ... stSDLDisplayMode.driverdata = pDisplayData; Then, if you call GetDisplayModes, current_mode will added to the modes list, with the same driverdata pointer to desktop_mode. SDL_AddDisplayMode( display, &display->current_mode ); When VideoQuit gets called, first the modes list gets freed including the driverdata, the desktop_mode gets freed. See SDL_video.c:SDL_VideoQuit(): for (j = display->num_display_modes; j--;) { SDL_free(display->display_modes[j].driverdata); display->display_modes[j].driverdata = NULL; } SDL_free(display->display_modes); display->display_modes = NULL; SDL_free(display->desktop_mode.driverdata); display->desktop_mode.driverdata = NULL; So, the display_modes[j].driverdata gets freed, but desktop_mode->driverdata points to the same memory, but is not NULL'ed. When desktop_mode->driverdata gets freed the memory is already freed, and libcx crashes the application on SDL_Quit.
Ethan Lee eb15b4e9 2021-06-11T23:40:09 wayland: Drop SwapWindow calls for hidden windows
Ryan C. Gordon 37d35a3e 2021-06-11T21:02:49 kmsdrm: hook up KMSDRM_GLES_DefaultProfileConfig for use. Fixes #3678.
Ivan Epifanov bbdd08e0 2021-06-10T13:20:39 Build without PIB support by default and add flag to enable it
Ivan Epifanov c2b8b556 2021-06-10T12:06:28 Older api, not needed
Ozkan Sezer 2f248a2a 2021-06-11T04:00:32 SDL_cocoaevents.m: fix build against SDK < 10.12 after commit 0dd7024d.
Ryan C. Gordon e65a6583 2021-06-09T22:10:20 x11: Add a hint to force override-redirect. Fixes #3776.
Cameron Gutman e13b43ac 2021-06-05T12:44:08 Don't skip sending wakeups for the current thread We can be in a situation where we receive a win32 hook callback on the same thread that is currently waiting. In that case, we do still need to trigger a wakeup when an event is pushed because the hook itself won't necessarily do that (depending on what we return from the hook).
Cameron Gutman 85b51e6c 2021-06-05T11:46:47 Fall back to polling normally if not operating the win32 message loop In this condition, we cannot safely wait/wake on events.
Ethan Lee d956636c 2021-06-04T18:39:47 wayland: Implement FlashWindow
Jupeyy 64724db0 2021-06-04T19:55:30 Implement bare minimum for SDL_FlashWindow
Francesco Abbate 0dd7024d 2021-03-12T21:58:20 Modifies WaitEvent and WaitEventTimeout to actually wait instead of polling When possible use native os functions to make a blocking call waiting for an incoming event. Previous behavior was to continuously poll the event queue with a small delay between each poll. The blocking call uses a new optional video driver event, WaitEventTimeout, if available. It is called only if an window already shown is available. If present the window is designated using the variable wakeup_window to receive a wakeup event if needed. The WaitEventTimeout function accept a timeout parameter. If positive the call will wait for an event or return if the timeout expired without any event. If the timeout is zero it will implement a polling behavior. If the timeout is negative the function will block indefinetely waiting for an event. To let the main thread sees events sent form a different thread a "wake-up" signal is sent to the main thread if the main thread is in a blocking state. The wake-up event is sent to the designated wakeup_window if present. The wake-up event is sent only if the PushEvent call is coming from a different thread. Before sending the wake-up event the ID of the thread making the blocking call is saved using the variable blocking_thread_id and it is compared to the current thread's id to decide if the wake-up event should be sent. Two new optional video device methods are introduced: WaitEventTimeout SendWakeupEvent in addition the mutex wakeup_lock which is defined and initialized but only for the drivers supporting the methods above. If the methods are not present the system behaves as previously performing a periodic polling of the events queue. The blocking call is disabled if a joystick or sensor is detected and falls back to previous behavior.
Ethan Lee 2af3f64e 2021-06-02T14:37:09 wayland: Activate the window on first ShowWindow, if possible
Ethan Lee 151f9538 2021-06-02T11:41:44 wayland: Implement RaiseWindow with xdg-activation
Kyle Schaefer 4522cb1d 2021-05-25T03:17:03 Changing variable from float to int, this way we can check it's value without having to do an unnecessary conversion. Then do explicit conversions later on if we need.
Kyle Schaefer c289bad9 2021-03-22T11:22:31 In x11, GetDisplayDPI can give incorrect or unusable DPI information. Using XGetDefaults to get the Xft DPI if it's available and returning that. This could allow you to figure out DPI scale.
Ethan Lee d3244035 2021-05-17T01:24:35 wayland: Add support for maximized/restored events
Anthony Pesch fc508eab 2021-05-23T15:59:20 kmsdrm: remove redundant modeset_pending flag this variable was added in commit 2067a7db8e4a36ba40ab34a55b3166ca28638a60 and ultimately tracks if this is a surface's first present. checking if the current bo is NULL provides the same functionality and cuts down on a redundant piece of state potentially getting out of sync in the future
Anthony Pesch 4c965b7a 2021-05-23T16:09:27 kmsdrm: fix SetDisplayMode binding the the wrong surface / context SetDisplayMode needs to recreate the EGL surfaces, which then need to be bound along with the correct context in each rendering thread commit 3a1d7d9c9ac670bf35cfa8ebf3706a1e2a3e5de4 removed this behavior which has broken using SetDisplayMode when rendering with multiple contexts the commit message was rather vague, but if the surfaces do need to be created immediately, this process probably needs to be split such that surface is created immediately, but the binding is deferred
Anthony Pesch 0219928d 2021-05-23T16:06:40 kmsdrm: honor mode previously set by SDL_SetWindowDisplayMode when enabling fullscreen and remove duplicate SDL_WINDOWEVENT_RESIZED event commit 2067a7db8e4a36ba40ab34a55b3166ca28638a60 made SDL_SetWindowSize and SDL_SetWindowFullscreen modify the display mode previously set by a call to SDL_SetWindowDisplayMode as far as I understand the SDL API, calling SDL_SetWindowDisplayMode followed by calling SDL_SetWindowFullscreen(..., SDL_WINDOW_FULLSCREEN) is the correct way to mode set / switch to fullscreen this change restores that functionaliy when switching to SDL_WINDOW_FULLSCREEN, but other cases are still modifying the display mode set by the user. rather than modifying the display mode set by the user, it seems this logic inside of KMSDRM_ReconfigureWindow should be pushed further down into KMSDRM_CreateSurfaces (as it was originally) to only modify the final mode that's set (based on the fullscreen flags), but not override the mode requested by the user
Anthony Pesch fd5de93a 2021-05-23T16:05:39 kmsdrm: fix gbm surface dimensions not matching the mode being set commit 2067a7db8e4a36ba40ab34a55b3166ca28638a60 introduced new surface_w and surface_h variables which were passed to gbm_surface_create rather than the dimensions from the drmModeModeInfo structure. commit 5105ecf8b1b37ab4e4b8344550c90dd69f49909e further refactored this code and no longer synchronized these variables inside KMSDRM_SetDisplayMode, breaking it this change removes the variables since they're seemingly redundant to begin with
Ryan C. Gordon fed84650 2021-05-27T10:40:41 loadbmp: Attempt to handle small palettes better. Only adjust the biClrUsed field if it is set to zero in the bitmap, and make some effort to make sure we don't overflow a buffer in any case. This was triggering an issue with the sailboat bmp used for testpalette.c in SDL 1.2, which is an 8-bit paletted image with 66 palette entries instead of 256. See discussion at https://github.com/libsdl-org/sdl12-compat/issues/63 This change might be a problem, but there's no indication this code, which originally landed in SDL_image 17 years ago with a large rewrite, is actually fixing a specific issue. I'm also not sure we should actually make an effort to accept a bmp that has a biClrUsed field that is both non-zero and _also_ incorrect.
Sam Lantinga 157c3f80 2021-05-21T09:45:08 [SDL] Minimize number of system calls when handling WM_INPUT raw input messages. Details: Currently doing 4 system calls per WM_INPUT message, which can cause the thread handling the message loop to be swapped out several times: * GetProp - to get window data from the window handle * GetRawInputData - to retrieve the raw input data * 2 calls to GetMessageExtraInfo - to ignore synthetic mouse events generated for touchscreens In this change: * Replaced GetProp by iterating the list of windows maintained by SDL (with a fallback to GetProp). Note that this will affect all messages and not just WM_INPUT * only calling GetMessageExtraInfo if a touchscreen has been detected Fix for https://jira.valve.org/browse/CSGO-4855 @saml
Ethan Lee be5356af 2021-05-14T14:44:13 winrt: Fix support for multiple simultaneous mouse button presses
Sylvain 62a562de 2021-05-12T23:37:18 X11: use x11sym loaded functions (see bug #3978)
Sylvain 531d83bf 2021-05-12T23:13:48 X11: allow using touchscreen, while pointer is grabbed (see bug #3978)
Ryan C. Gordon e1db4b82 2021-05-11T14:08:17 egl: Don't crash if we failed halfway through SDL_CreateWindow.
Ethan Lee f2f451a5 2021-05-10T13:29:54 wayland: Call SetWindowBordered at the end of ShowWindow
Fredrick Brennan c5dd9964 2021-04-07T12:14:16 Copied X11 error handler code from SDL_x11opengl.c Avoids needing to malloc to hold the error string.
Fredrick Brennan b3b4677e 2021-04-07T11:17:52 (X11) Set _NET_WM_NAME properly, fixes Unicode window titles Removes deprecated code meant to support extremely ancient, pre-UTF-8 versions of Xorg. Uses new xlib API's for doing this same thing. Closes #4288.
Ethan Lee efbb6ff9 2021-05-10T12:42:28 wayland: Create the server decorations after the toplevel has been configured
Ryan C. Gordon 9dc97afa 2021-05-08T12:39:50 cocoa: Report an error if SDL_SetClipboardText() isn't using UTF-8 encoding. Fixes #4110.
Henk Kalkwater 889cebb7 2021-05-05T14:08:30 Wayland touch inputs send normalized coords Resolves #4361
Nicolas Caramelli 31637dde 2021-05-04T14:59:29 Generic check for desktop GL and EGL on Linux systems
Ethan Lee c69fde34 2021-05-02T16:43:01 wayland: Maximize/Restore should set the relevant window flags. Also, Maximize should be ignored for fixed-size windows.
Christian Rauch 006378b9 2021-05-02T18:30:32 fix NULL frame_callback access
Christian Rauch 424bbaec 2021-05-01T18:53:12 wayland: destroy frame callback when window is destroyed
Ethan Lee 20928550 2021-05-01T09:00:24 wayland: Guard surface_frame_listener for OpenGL, document why it exists
Ethan Lee 3d47ddc4 2021-05-01T08:57:37 wayland: Use refresh_rate to calculate max_wait in SwapWindow
Sylvain 7b284dbb 2021-04-30T22:01:48 EglChooseConfig: choose an accelerated configuration - especially because we can be promoted to true color 888 make sure we don't select a potentially software implementation - hopefully fix bug #1482 (EGL ChooseConfig selects software renderer on Android)
Ethan Lee 9161f951 2021-04-27T02:25:57 egl: Reject attempts to set negative swap intervals
Ryan C. Gordon c54c16d3 2021-04-30T13:19:36 wayland: don't hang in SDL_GL_SwapBuffers if the compositor is ghosting us. If you hide a window on Mutter, for example, the compositor never requests new frames, which will cause Mesa to block forever in eglSwapBuffers to satisfy the swap interval. We now always set the swap interval to 0 and manage this ourselves, handing the frame to Wayland when it requests a new one, and timing out at 10fps just to keep apps moving if the compositor wants no frames at all. My understanding is that other protocols are coming that might improve upon this solution, but for now it solves the total hang. Fixes #4335.
Ozkan Sezer 227021b6 2021-04-30T11:25:20 SDL_windowsmessagebox.c (MessageBoxDialogProc): fix calling convention.
Sylvain a74f888f 2021-04-29T22:25:00 Fixed bug #4337 - compilation of 'SDL_vulkan_utils' fails with 'VK_ERROR_INCOMPATIBLE_VERSION_KHR' undeclared
Sylvain 1f3df900 2021-04-28T23:40:26 Error missing 'flags' initialization (see bug #2881)
Sylvain c93e3b36 2021-04-28T10:43:28 Fixed bug #2881 - SDL_RLEsurface may encode RGB888 if it has no color key (Thanks Simon Hug) To encode with BLEND mode, it needs a valid alpha channel
Ryan C. Gordon 8527c583 2021-04-27T01:36:23 cocoa: Fix recreated windows that are both borderless and resizable. These would accidentally get a titlebar because the "borderless" style mask is zero but the resizable attribute adds a bit. I assume this happens because you used to need window decoration to resize a window in macOS, but this changed in later releases. This only caused problems when recreating a window (you had an SDL_WINDOW_OPENGL window and tried to create a Metal SDL_Renderer on it, etc). Fixes #4324.
Ryan C. Gordon 2fdbae22 2021-04-26T18:43:28 cocoa: Remove mouse event tap. It doesn't appear to work anymore, and was disabled by default anyhow, since the needed APIs are forbidden on the Mac App Store. A better solution to lock the mouse to the window on macOS would still be welcome. CGAssociateMouseAndMouseCursorPosition() works fine for relative mouse mode, this was just a question of SDL_SetWindowGrab(). As it stands now, a grabbed mouse can briefly break out of the window, causing varying degrees of chaos.
Ryan C. Gordon 1f482174 2021-04-25T12:44:35 x11: Mark backing_store as NotUseful when creating windows. This can give some performance boost, and save some resources, as there's no reason to keep a copy of an SDL window's contents on the server: most SDL apps are redrawing completely every frame, and the API allows for expose events to tell an app a redraw is needed anyhow. (And compositors are free to ignore this setting if it makes sense to do so, according to the Xlib docs.) Reference Issue #3776.
Ryan C. Gordon 9c063468 2021-04-24T19:47:10 x11: call XSync before XSetInputFocus during SDL_ShowWindow. This only happens when using a non-NET_WM window manager, as we might try to set the focus before the window is mapped. Fixes #3949.
Sylvain cf05a5eb 2021-04-22T21:40:57 eglChooseConfig: only add EGL_DEPTH_SIZE if non 0 and fix static / shadowed variables warnings for dump configs
Sylvain 98a966d1 2021-04-22T18:06:17 Android: don't need to set the SurfaceHolder format from java code It's already set with ANativeWindow_setGeometry, and eventually set/changed also by eglCreateWindowSurface. - avoid issues with older device where SurfaceView cycle create/changed/destroy appears broken: calling create/changed/changed, and leading to "deuqueBuffer failed at server side, error: -19", with black screen. - re-read the format after egl window surface is created, to report the correct one (sometimes, changed from RGBA8888 to RGB24)