Commit Graph

1523 Commits

Author SHA1 Message Date
Manuel Alfayate Corchete
d079130c24 [KMS/DRM] Don't use primary plane for scaling because that's unsupported on most LEGACY-only HW. 2021-01-07 18:44:34 +01:00
Manuel Alfayate Corchete
e168d1138c [KMS/DRM] Correct drmModeSetCursor() dimensions. 2021-01-07 14:40:24 +01:00
Manuel Alfayate Corchete
335d78ff86 [KMS/DRM] Add the missing files for Vulkan support to the KMSDRM_LEGACY backend, had forgotted to do -hg add-. 2021-01-07 11:30:33 +01:00
Manuel Alfayate Corchete
661bacfe27 [KMS/DRM] Add Vulkan suport to the KMSDRM_LEGACY backend.Minor text spacing tweaks for better readability. Comment out unused function. 2021-01-07 00:47:21 +01:00
Ozkan Sezer
dfb0afe36a fix build after commit 5730b2005da1 2021-01-07 00:41:32 +03:00
Manuel Alfayate Corchete
67e0b1dd4e [KMS/DRM] Rewrite KMSDRM_LEGACY backend to accomodate Vulkan compatibility. Fix several bugs on that backend. 2021-01-06 22:15:26 +01:00
Ozkan Sezer
76295cecf3 video/windows: ANSI/UNICODE updates (cf. bug 5435):
- explicitly use UNICODE versions of DrawText, EnumDisplaySettings,
  EnumDisplayDevices, and CreateDC: the underlying structures have
  WCHAR strings.
- change WIN_UpdateDisplayMode and WIN_GetDisplayMode() to accept
  LPCWSTR instead of LPCTSTR for the same reason.
- change WIN_StringToUTF8 and WIN_UTF8ToString to the explicit 'W'
  versions where appropriate.
2021-01-05 15:50:10 +03:00
Ozkan Sezer
31751bdcce wmmsg.h: constified wmtab 2021-01-05 15:15:37 +03:00
Ozkan Sezer
390fd14f54 SDL_windowswindow.c (SDL_HelperWindowCreate): adjust for ANSI/UNICODE:
change SDL_HelperWindowClassName and SDL_HelperWindowName from WCHAR *
to be const TCHAR*

cf. bug #5435.
2021-01-04 01:23:50 +03:00
Ozkan Sezer
01a2f27679 consistently use TEXT() macro with LoadLibrary() and GetModuleHandle()
cf. bug #5435.
2021-01-04 01:23:50 +03:00
Sam Lantinga
393c8c1f16 Fixed bug 5440 - MacCatalyst build failures
C.W. Betts

I tested building commit http://hg.libsdl.org/SDL/rev/7adf3fdc19f3 on Mac Catalyst and found some issues:

* MTLFeatureSet_iOS_* enums aren't available under Mac Catalyst.
* OpenGL ES is unavailable under Mac Catalyst.
* Some Metal features are available under Catalyst but not iOS, such as displaySyncEnabled.
* Set Metal as the default renderer on Mac Catalyst

Attaching a patch that will make SDL2 build for Mac Catalyst.
2021-01-03 10:32:55 -08:00
Cameron Gutman
6cbd4417f0 Add a hint for D3D9Ex to avoid having to choose at compile-time 2021-01-02 14:45:15 -06:00
Sylvain Becker
fea49a3e2f SDL_stretch.c: compilation NEON on Windows 10 2021-01-03 15:24:47 +01:00
Sylvain Becker
acccc71f27 Fixed bug 5436 - MSVC 2019 ARM64 build fails to compile SDL_stretch.c 2021-01-02 22:31:44 +01:00
Sam Lantinga
9130f7c377 Updated copyright for 2021 2021-01-02 10:25:38 -08:00
Sam Lantinga
963c9495d3 Fixed bug 5431 - SDL_Metal_GetDrawableSize is inaccurate for high dpi displays if a Metal view has not already been created
Caleb Cornett

For a window created with SDL_WINDOW_ALLOW_HIGHDPI, SDL_GL_GetDrawableSize will return the high-dpi drawable size even before any GL context creation happens. But SDL_Metal_GetDrawableSize will return the size of the window if the Metal view has not been created. This is confusing and inconsistent behavior.

An easy way to test this is to build testgl2 and testvulkan on macOS with the SDL_WINDOW_ALLOW_HIGHDPI flag enabled during window creation. The GL2 program will report a drawable size of 2x window width and 2x window height, while the Vulkan program will report the window size.

This patch addresses the issue by falling back to using the content view dimensions if no Metal view exists in the window. (The code for this was taken directly from Cocoa_GL_GetDrawableSize.) With this change, the testvulkan behavior matches that of testgl2.

Note that I haven't tested for this issue on UIKit. It's possible a similar change will need to be made there too.
2021-01-02 10:11:08 -08:00
Sylvain Becker
c005267fb1 SDL_BlitScaled: better and safer fix clipping bug #2687
And re-use SDL_round(), since it's been re-added
(remove in https://hg.libsdl.org/SDL/rev/34043108b7e4 )
2021-01-02 09:38:19 +01:00
Sylvain Becker
2127ed2574 SDL_SoftStretch: add a check for input pixel format
and function re-naming
2021-01-02 09:28:16 +01:00
Manuel Alfayate Corchete
21003b7db2 [KMS/DRM] Small refactoring on the SwapWindow function. 2020-12-31 14:31:29 +01:00
Manuel Alfayate Corchete
e1fb969b76 [KMS/DRM] Correct comments about last bugfix. 2020-12-31 01:40:15 +01:00
Manuel Alfayate Corchete
e34caa9779 [KMS/DRM] Correct EGL/GL library loading on window creation, thus saving window re-creation. 2020-12-31 01:31:57 +01:00
Sylvain Becker
d81fe9239f SDL_BlitScaled: remove un needed -1 +1 offset in calculation 2020-12-30 22:03:32 +01:00
Sylvain Becker
80cf8a8b76 SDL_BlitScaled: also prevent crash if dest width or height is negative 2020-12-29 17:29:31 +01:00
Sylvain Becker
f08b9a5b6b SDL_BlitScaled: prevent crash if dest width or height is 0 2020-12-29 16:02:52 +01:00
Manuel Alfayate Corchete
427c96ec11 [KMS/DRM] Rework some functions. 2020-12-29 14:24:38 +01:00
Sam Lantinga
3cb0e840e6 Fixed bug 5422 - KMSDRM_LEGACY: Add OpenBSD support
wahil1976

This patch adds support for OpenBSD to KMSDRM_LEGACY. Note that the patch won't be ported to the atomic KMSDRM backend because OpenBSD does not support atomic KMS properly yet.
2020-12-28 11:47:53 -08:00
Manuel Alfayate Corchete
7539ac8087 [KMS/DRM] Restore hacky code to point to TTY buffer on surface destruction b/c I lack alternatives. 2020-12-28 18:22:07 +01:00
Manuel Alfayate Corchete
86b81abea6 [KMS/DRM_LEGACY] Prevent mouse cursor from staying onscreen after window destruction. Patch by Ozkan Sezer. 2020-12-28 16:19:19 +01:00
Manuel Alfayate Corchete
0feaf7d196 [KMS/DRM][Vulkan] Correct non-existing property. Remove hacky surface destruction code (TTY buffer isn't there after a Vulkan window is created). 2020-12-28 14:37:58 +01:00
Sylvain Becker
7186584b8d fix indentation (bug 5313) 2020-12-28 10:41:37 +01:00
Sylvain Becker
c2735c0bb9 Better scaling fallbacks for the SW renderer (bug 5313) 2020-12-27 23:53:28 +01:00
Ozkan Sezer
a6beb2d264 SDL_PrivateLowerBlitScaled: remove unused local var 'a' 2020-12-28 01:10:02 +03:00
Sylvain Becker
30df2e4e36 Scaling fallbacks for the SW renderer (bug 5313) 2020-12-27 23:00:11 +01:00
Sylvain Becker
f9b5f6cc0f Forward scale mode to SW renderer (Bug 5313) 2020-12-27 20:28:24 +01:00
Manuel Alfayate Corchete
46d31d570d [KMS/DRM][Vulkan] Fix segfault when changing fullscren mode and permanent cursor when changing between Vulkan and GL renderers in vkQuake3. Tidy up window destruction code. 2020-12-27 00:43:06 +01:00
Sam Lantinga
9838611a8b Fixed compiler crash building for iOS with clang 11.0.3 2020-12-23 15:52:12 -08:00
Sylvain Becker
4aebad77bd SDL_SoftStretchLowerLinear: try to make xcode buildbot compile (Bug 5313) 2020-12-23 22:50:50 +01:00
Sam Lantinga
93ccdee8c1 Fixed bug 5404 - stdlib: Added SDL_round, SDL_roundf, SDL_lround and SDL_lroundf
Cameron Cawley

stdlib: Added SDL_round, SDL_roundf, SDL_lround and SDL_lroundf

The default implementation is based on the one used in the Windows RT video driver.
2020-12-23 13:47:49 -08:00
Sylvain Becker
8e20376f1a SDL_SoftStretchLinear: use SDL_INLINE (bug 5313) 2020-12-23 22:09:01 +01:00
Sylvain Becker
7b8d5b7dc3 SDL_SoftStretchLinear: fix implicit conversion (bug 5313) 2020-12-23 22:02:28 +01:00
Sylvain Becker
ae8a270f61 Add SDL_SoftStretchLowerLinear() (Bug 5313) 2020-12-23 21:37:40 +01:00
Sylvain Becker
050ee9a410 Split SDL_SoftStretch in Lower and Uppler functions (Bug 5313) 2020-12-23 21:32:01 +01:00
Manuel Alfayate Corchete
09fcc9ed17 [KMS/DRM][Vulkan] Fix small warning, thanks to Ozkan Sezer for spotting it. 2020-12-23 16:45:23 +01:00
Manuel Alfayate Corchete
a6dc838d52 [KMS/DRM][Vulkan] Only try to create a display mode when no suitable mode is found. 2020-12-23 16:22:46 +01:00
Manuel Alfayate Corchete
2fc987c28f [Buildsystem] Add guards for not building with KMSDRM support if EGL is not available. 2020-12-22 14:15:33 +01:00
Sam Lantinga
4cd981609b Fixed whitespace 2020-12-21 09:44:25 -08:00
Manuel Alfayate Corchete
8766d6040b [Video/KMSDRM] Fix potetial access to freed structure and complete errorchecks. 2020-12-21 17:29:24 +01:00
Manuel Alfayate Corchete
b06ef3a18c [Video/KMSDRM] Manually re-show the cursor on window creation, if needed. 2020-12-21 01:53:11 +01:00
Ozkan Sezer
4198f0e52c fix uninitialized warnings in KMSDRM_CreateCursor() 2020-12-21 01:20:30 +03:00
Manuel Alfayate Corchete
a8dbcab132 [Video/KMSDRM] Don't copy the cursor bitmap to the cursor GBM BO until we're showing it. 2020-12-20 21:48:05 +01:00
Manuel Alfayate Corchete
2756b0f337 [Video/KMSDRM] Init and deinit mouse stuff at the same time that GBM stuff. 2020-12-20 14:29:58 +01:00
Manuel Alfayate Corchete
cf71e01734 [Video/KMSDRM] Remove auxiliary AMDGPU compatibility workarounds not needed anymore. 2020-12-19 23:32:09 +01:00
Manuel Alfayate Corchete
af1f91cb36 [Video/KMSDRM] Correct typo. 2020-12-19 20:21:07 +01:00
Manuel Alfayate Corchete
cf48955680 [Video/KMSDRM] Honor the device index in Vulkan. Add notes about the display index. 2020-12-19 20:15:50 +01:00
Manuel Alfayate Corchete
ab3a390e26 [Video/KMSDRM] Better ATOMIC caps testing: patch by Oskan Sezer. 2020-12-19 17:35:04 +01:00
Manuel Alfayate Corchete
436499f3ec [Video/KMSDRM] Comment out some debug info, adjust comments for future work. 2020-12-19 02:08:59 +01:00
Ozkan Sezer
6b81cac420 remove duplicated SDL_SetError after calling check_atomic_modesetting() 2020-12-19 01:25:50 +03:00
Manuel Alfayate Corchete
8952a61324 [Video/KMSDRM] Re-arrange display members setup. 2020-12-18 23:17:42 +01:00
Manuel Alfayate Corchete
f60f8d5d84 [Video/KMSDRM]: Add Vulkan support to the KMSDRM backend. 2020-12-18 22:53:51 +01:00
Ozkan Sezer
6ac0b23d3a SDL_DirectFB_video.c: DSPF_ABGR requires directfb >= 1.5.0 -- add guard. 2020-12-18 21:37:20 +03:00
Ozkan Sezer
6c4ab48471 SDL_kmsdrmvideo.c: check atomic modesetting in check_modesetting()
.. so that KMSDRM_CreateDevice() can fail and SDL_VideoInit() would
move on to next bootstrap member which is kmsdrm_legacy.  hopefully
fixes bug #5393.
2020-12-18 17:50:02 +03:00
Ozkan Sezer
10625f9d89 SDL_windowsmessagebox.c: go back to hg rev 14458 state.
encountering a NULL caption in AddDialogString() is intended, i.e.
AddDialogStaticIcon() sends it as NULL on purpose.
2020-12-17 23:50:00 +03:00
Ozkan Sezer
4d6eb30523 SDL_windowsmessagebox.c (AddDialogControl): add back NULL caption check.
because AddDialogStaticIcon() sends a NULL caption -- fixes bug #5401.
2020-12-17 23:28:20 +03:00
Ozkan Sezer
90456670b5 more "'for' loop initial declarations are only allowed in C99 mode" fixes 2020-12-17 14:11:00 +03:00
Ozkan Sezer
ed4fcb2cfc kmsdrm_legacy build fixes:
- add missing '_LEGACY' to symbol names
- perform missing 2.0.14 portage
- fix 'for' loop initial declarations are only allowed in C99 mode errors
2020-12-16 03:24:10 +03:00
Ozkan Sezer
9940e71088 Import two post-2.0.12 fixes to kmsdrm_legacy:
Fix build breakage without EGL:
https://hg.libsdl.org/SDL/rev/f2606fe53654e305ab9badb821d9d3afb7f92f49

Fix KMSDRM_CreateWindow segfault when starting L?VE2D engine (bug 5199)
https://hg.libsdl.org/SDL/rev/d2e69a78939463d9ff9448a5f4efd1e208bb97b0
2020-12-16 00:10:30 +03:00
Sam Lantinga
f8839289b0 Potential fix for bug 5393 - KMSDRM: using atomic mode setting breaks GPU compatibility
Substring

I was trying the KMSDRM video backend with some very simple programs that were working ok on 2.0.12. The same code won?t work on the current dev branch and I get:

DEBUG: check_modesetting: probing ?/dev/dri/card0?
DEBUG: /dev/dri/card0 connector, encoder and CRTC counts are: 4 5 6
DEBUG: check_modesetting: probing ?/dev/dri/card0?
DEBUG: /dev/dri/card0 connector, encoder and CRTC counts are: 4 5 6
DEBUG: KMSDRM_VideoInit()
DEBUG: Opening device /dev/dri/card0
DEBUG: Opened DRM FD (3)
DEBUG: no atomic modesetting support.
DEBUG: Video subsystem has not been initialized
INFO: Using SDL video driver: (null)
DEBUG: Video subsystem has not been initialized

After carefully checking, the radeon driver doesn?t support atomic modesetting. That?s not the only problem : the same happens with the amdgpu driver if we disable Display Core (kernel parameter amdgpu.dc=0, which is required to get analogue outputs working).

This is a major regression in the KMSDRM driver.

Using atomic mode setting is great, but having no fallback to the "standard KMS" is bad.
2020-12-15 12:22:48 -08:00
Sam Lantinga
ee85a41a32 Fixed compile warning 2020-12-13 02:10:46 -08:00
Ozkan Sezer
5c212cb0c5 remove a few stale NULL message/title checks after commit e2b729b1756a
top-level guarantees non-NULL message / title passed in messageboxdata
2020-12-10 12:24:24 +03:00
Ozkan Sezer
f1cab8aea6 fix bug #5253: handle NULL title or message fields in SDL_MessageBoxData
- SDL_video.c (SDL_ShowMessageBox): replace messageboxdata, set title
  or message field to "" if either of them is NULL.
- SDL_video.c (SDL_ShowSimpleMessageBox):  set title or message to ""
  if either of them is NULL for EMSCRIPTEN builds.
- SDL_bmessagebox.cc: add empty string check along with NULL check for
  title and message fields.
- SDL_windowsmessagebox.c (AddDialogString): remove NULL string check
- SDL_windowsmessagebox.c (AddDialogControl):  add empty string check
  along with the NULL check.
- SDL_x11messagebox.c: revert commit 677c4cd68069
- SDL_os2messagebox.c: revert commit 2c2a489d76e7
- test/testmessage.c: Add NULL title and NULL message tests.
2020-12-10 11:20:56 +03:00
Sam Lantinga
d46dd103d9 Fixed typo in Vulkan load logic 2020-12-09 07:49:07 -08:00
Sam Lantinga
cb36189692 Fixed bug 5235 - All internal sources should include SDL_assert.h
Ryan C. Gordon

We should really stick this in SDL_internal.h or something so it's always available.
2020-12-09 07:16:22 -08:00
Sam Lantinga
50203d58b3 Fixed bug 5329 - SDL_SetWindowGrab(SDL_FALSE) fails to unlock cursor if window is partially offscreen
Ivan Mogilko

With SDL 2.0.12 under MS Windows, if the window is partially offscreen calling SDL_SetWindowGrab(w, SDL_TRUE) works, but subsequent call to SDL_SetWindowGrab(w, SDL_FALSE) does not work.

I tested this in both real program, and a small test app, where unlocking cursor worked perfectly while window is fully in desktop bounds, but did not work if it was at least few pixels outside.

For the reference, following code is enough to reproduce the issue:

#include <windows.h>
#include <SDL.h>

int WinMain(
    HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR     lpCmdLine,
    int       nShowCmd)
{
    SDL_Init(SDL_INIT_VIDEO);
    SDL_Window* w = SDL_CreateWindow("", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 400, 0);

    bool grabbed = false;
    bool want_quit = false;
    while (!want_quit)
    {
        SDL_Event event;
        while (SDL_PollEvent(&event))
        {
            switch (event.type)
            {
            case SDL_QUIT: want_quit = true; break;
            case SDL_KEYDOWN:
                if (event.key.keysym.scancode == SDL_SCANCODE_SPACE)
                {
                    SDL_SetWindowGrab(w, static_cast<SDL_bool>(!grabbed));
                    grabbed = !grabbed;
                }
            }
        }
    }

    SDL_DestroyWindow(w);
    SDL_Quit();
    return 0;
}
2020-12-08 22:00:06 -08:00
Sylvain Becker
035f8f2391 SDL_RecreateWindow: allow clearing VULKAN when recreating the window 2020-12-02 13:37:59 +01:00
Sylvain Becker
93fbab0fac SDL_ReCreateWindow: allow to unload METAL window and switch back to OpenGL.
On older mac, where METAL Renderer METAL fails to create, it allows to switch back to OpenGL SDL_Renderer
by re-creating the window (METAL flags was previously persistent).
2020-12-02 11:04:53 +01:00
Sam Lantinga
a0c5bfa3bd Moved raw input event processing from the main thread to the joystick thread
This allows fast joystick event delivery regardless of what the main thread is doing.
2020-11-27 13:08:40 -08:00
Sylvain Becker
2c079a2f6c SDL_FillRects: prevent empty SDL_surface from raising an error message
It's legitimate to have a surface with 0 width or height (null 'pixels' pointer).
But calling SDL_FillRects would wrongly set the error "You must lock the surface".
2020-11-27 09:42:14 +01:00
Sam Lantinga
4121ab6200 Fixed bug 5354 - DirectFB: Add Vulkan support
Nicolas Caramelli

This patch adds Vulkan support for the DirectFB video driver.
A screenshot with SDL tests running on DirectFB is available on the HiGFXback project:

https://github.com/caramelli/higfxback/wiki/DirectFB#sdl
2020-11-23 21:25:07 -08:00
Ryan C. Gordon
0ff5d55a07 x11: Don't try to grab the pointer on an unmapped window (thanks, Lee!)
Fixes Bugzilla #5352.
2020-11-23 21:07:28 -05:00
Ozkan Sezer
082558db33 SDL_os2messagebox.c (_makeDlg): fix crash if title and/or message is NULL.
c.f.: bug #5253.
2020-11-20 12:20:02 +03:00
Ryan C. Gordon
335cfa107b x11: Don't crash if a messagebox has a NULL title string.
Fixes Bugzilla #5253.
2020-11-18 11:24:08 -05:00
Cameron Gutman
72379ba510 windows: Fix handling of swapped mouse buttons
GetAsyncKeyState() and GetRawInputData() report the state of the physical
buttons without applying the user's primary/secondary mouse button swap
preference. Swap the buttons returned from these functions, so we expose a
consistent view of the buttons to SDL callers. This new behavior also matches
the behavior of macOS and X11 backends.

See the Remarks section of the GetAsyncKeyState() function on MSDN.
2020-08-25 21:22:00 -07:00
Cameron Gutman
771732ed32 windows: Fix numpad arrow key scancodes with numlock off
We should only perform the VK_LEFT, VK_UP, etc. mapping if none of the other
special mappings apply. This allows the scancode normalization for the number
pad to take place as intended.
2020-08-27 17:54:52 -07:00
Ozkan Sezer
53b166797d SIZE_MAX need not be defined in limits.h
it can be in limits.h (windows) or stdint.h.
2020-11-11 12:33:55 +03:00
Ryan C. Gordon
7b5a0a9f97 uikit: Don't implement main() twice for iOS static libs.
I think this was a leftover from before the two Xcode projects were merged.
2020-11-10 13:12:10 -05:00
Sam Lantinga
1ef45c1801 Fixed bug 5339 - Minor memory leak in SDL_x11events.c
wcodelyokoyt

The atom name that X11_GetAtomName() returns never gets freed, which result in a minor memory leak (14 bytes?) every time the user drops a file on a window.
You can see the line in question here:
6b6170caf6/src/video/x11/SDL_x11events.c (L1350)

Fix: call XFree on name after the while loop.
2020-11-08 23:40:17 -08:00
Sam Lantinga
723d76c8ec Fixed bug 5333 - Replace character of legacy code page with utf-8 one.
Joel Linn

This patch fixes a MSVC warning, which is dependent on the regional settings of the build system. Although the character is inside a comment and harmless, it is undesirable to disable the warning for this.
2020-11-08 23:34:59 -08:00
Ryan C. Gordon
de6d0ac55a uikit: Patched to compile on older iOS SDKs. 2020-11-08 18:11:42 -05:00
Ryan C. Gordon
010d5fba93 kmsdrm: Make this build with significantly older system libraries.
This allows one to build Raspberry Pi versions on an ancient version of
Raspbian and get both the KMSDRM and RPI video targets built into SDL, giving
maximum binary compatibility from linking against an older glibc, etc, but
also making one library that can access video on all RPi models and OS
releases.
2020-10-26 09:49:09 -04:00
Ozkan Sezer
f0c5841714 SDL_shape_internals.h: forward-declare struct SDL_ShapeTree. 2020-10-25 10:10:10 +03:00
Ozkan Sezer
bfc80d83c2 minor coding style cleanup 2020-10-25 03:55:02 +03:00
Sam Lantinga
5dc6c3c951 Updated Vulkan headers to version 1.2.158
https://github.com/KhronosGroup/Vulkan-Headers
2020-10-24 10:46:18 -07:00
Manuel Alfayate Corchete
5682b066e9 kmsdrm: Add comment about KMSDRM_VideoQuit() changes. 2020-10-22 19:51:57 +02:00
Manuel Alfayate Corchete
63b7827709 kmsdrm: properly exit with an error when ATOMIC interface is not yet available, instead of just segfaulting. 2020-10-22 19:44:38 +02:00
Manuel Alfayate Corchete
a3262205b5 kmsdrm: rearrange init function so we try ATOMIC compatibility first. 2020-10-22 17:55:45 +02:00
Manuel Alfayate Corchete
b1ea0be865 kmsdrm: Add missing checks after SDL_calloc() calls. 2020-10-22 17:06:34 +02:00
Manuel Alfayate Corchete
ad9ec8b363 kmsdrm: Small fix, missing bracket. 2020-10-22 16:15:34 +02:00
Manuel Alfayate Corchete
87a86675ed kmsdrm: Always use spaces for indentation. Always use SDL_calloc() for calloc. 2020-10-22 16:01:51 +02:00
Ozkan Sezer
cfc1362011 os2 video: updates to my_gradd.h 2020-10-21 23:28:02 +03:00
Sam Lantinga
f1b603ac6a Fixed bug 5323 - SDL_SetWindowMaximumSize fails if Width or Height is equal to minimum Height or Width
batyastudios

Basicly there is problem and somewhat a solution: https://discourse.libsdl.org/t/setwindowmaximumsize-bug/28267

If you SDL_SetWindowMaximumSize() after SDL_SetWindowMinimumSize() with one of axes have the same value, function will have no effect.

This: (line 2144@SDL_video.c)
if (max_w <= window->min_w || max_h <= window->min_h) {
    SDL_SetError("SDL_SetWindowMaximumSize(): Tried to set maximum size smaller than minimum size");
    return;
}

May be changed to this:
if (max_w < window->min_w || max_h < window->min_h) {
    SDL_SetError("SDL_SetWindowMaximumSize(): Tried to set maximum size smaller than minimum size");
    return;
}
2020-10-20 11:51:23 -07:00
Sam Lantinga
f311e0a826 Removed debug log message 2020-10-19 17:29:16 -07:00
Yiding Jia
f31ad57fde Implement keyboard repeat in wayland video driver 2020-10-05 19:17:52 -07:00
Alberts Muktup?vels
73010da4dc x11events: ignore UnmapNotify events from XReparentWindow
UnmapNotify event does not mean that window has been iconified. It
just reports that window changed state from mapped to unmapped.

XReparentWindow can unmap and remap window if it was mapped. This
causes unnecessary events - HIDDEN, MINIMIZED, RESTORED and SHOW.

These events are problematic with Metacity 3.36+ which started to
remove window decorations from fullscreen windows.

- SDL makes decorated window fullscreen
- Metacity removes decorations
- SDL gets UnmapNotify and exits from fullscreen
- Metacity re-adds decorations

As SDL will also get MapNotify event it will try to restore
window state causing above steps to repeat.

https://bugzilla.libsdl.org/show_bug.cgi?id=5314
2020-10-19 17:26:33 -07:00
Sylvain Becker
ffb307e4dc Fixed bug 5304 - add SDL_HasSurfaceRLE() (Thanks Rene Dudfield and Dan Lawrence) 2020-10-18 09:52:56 +02:00
Sylvain Becker
19a65a46a6 Fixed bug 5321 - crash in SDL_ConvertSurface with RLE surfaces
keep RLE information in flags when converting the surface
2020-10-17 21:47:05 +02:00
Ozkan Sezer
c70191d2b7 SDL_os2video.c (OS2_CreateDevice): remove duplicated assignment. 2020-10-17 07:37:00 +03:00
Ozkan Sezer
77d0f043e5 os2video.c: add missing FOURCC_R666 define, enable FOURCC_R666 case in _getSDLPixelFormatData(). 2020-10-16 23:50:00 +03:00
Sam Lantinga
58976bda31 Allow more than one window on iOS as long as they're on different displays 2020-10-15 12:00:15 -07:00
Ozkan Sezer
a90f0400a5 os2: a _lot_ of coding style cleanup, sot that they match the SDL style.
also renamed the 'debug' macro to debug_os2: the former was dangerously
a common name.

the binary (dll) output is precisely the same as before.
2020-10-15 21:37:30 +03:00
Sam Lantinga
bdc5129f13 Use a high priority dispatch queue for GCKeyboard and GCMouse events for the lowest latency possible
This appears to reduce latency between 1-4 ms on an iPad Pro.
2020-10-15 10:13:46 -07:00
Sam Lantinga
a3a0ef7527 Added support for low latency mouse and keyboard handling in iOS 14
The mouse support in iOS 14.0 has a bug with accumulating duplicate mouse deltas that won't be fixed until iOS 14.1, so we don't enable it until then.
2020-10-15 10:13:44 -07:00
Manuel Alfayate Corchete
cca16c9cb1 kmsdrm: merge GetDisplayDPI implementation by bms20 <brett@mynah-software.com> 2020-10-15 17:56:19 +02:00
Ozkan Sezer
d27238751f os2: integrate the port into main tree. 2020-10-14 23:01:06 +03:00
Ozkan Sezer
5807cb3d31 os2: remove dependency to gradd.h from IBM's ddk which is non-free:
Add a minimal my_gradd.h containing structures and constants only used
by SDL_os2vman.c -- based on public knowledge from around the internet
including pages from http://www.osfree.org and http://www.edm2.com .
2020-10-14 23:01:06 +03:00
Ozkan Sezer
1d9cf23e4c os2: updated copyright dates for 2020. header guard fixes. 2020-10-14 23:01:05 +03:00
Ozkan Sezer
fe2cc8d86c OS2_VideoQuit(): avoid double free()ing of displays.
Our caller SDL_VideoQuit() already frees display_modes, driverdata, etc.
Noticed in bitwiseworks' version at https://github.com/bitwiseworks/SDL2-os2
2020-10-14 23:01:04 +03:00
Ozkan Sezer
fba32ee21f OS2_VideoInit: zero the stSDLDisplay and stSDLDisplayMode variables
Fixes testdisplayinfo.exe crashing in SDL2-2.0.13.  (How it did work before?..)
2020-10-14 23:01:04 +03:00
Ozkan Sezer
54ced668c4 port from 2.0.12 to 2.0.13 / current SDL-hg repository.
- video:  VideoBootStrap->available() is gone.
- thread: all important SDL_CreateThread internal data now put into
          struct SDL_Thread: changes to SDL_SYS_CreateThread().
2020-10-14 23:01:04 +03:00
Ozkan Sezer
5da796fe52 os/2: port from SDL2-2.0.5 to SDL2-2.0.12
- events / video: SDL_SetDoubleClickTime() removed -- functionality
         moved to SDL_mouse.c:SDL_MouseDoubleClickTimeChanged().
- video: struct SDL_VideoDevice-> CreateWindow and CreateWindowFrom
         members renamed to CreateSDLWindow and CreateSDLWindowFrom
2020-10-14 23:01:03 +03:00
Ozkan Sezer
222f026899 os/2: port from SDL2-2.0.4 to SDL2-2.0.5:
changes to SDL_os2audio.c, SDL_os2video.c, os2/SDL_systhread.c in order
to accomodate SDL2-2.0.5 changes.
- audio:  WaitDone() is gone, CloseDevice() interface changes.
- events / video:  DropFile() changes:
          SDL_DROPBEGIN and SDL_DROPCOMPLETE events, window IDs for drops.
- thread: struct SDL_Thread->stacksize
2020-10-14 23:01:03 +03:00
Ozkan Sezer
1b99d805db os2: updates from Andrey Vasilkin's 2020-09-07 sources. 2020-10-14 23:01:02 +03:00
Ozkan Sezer
aa790837eb os2: several warning fixes.
mostly those "W007: '&array' may not produce intended result" warnings
from Watcom, visible only in C++ mode.  one or two others here & there.
2020-10-14 23:01:02 +03:00
Ozkan Sezer
110a0f7bb1 os2: update include paths. add missing libc includes to geniconv. 2020-10-14 23:01:01 +03:00
Ozkan Sezer
74cfb81dbb os2: add port files for SDL2-2.0.4 from Andrey Vasilkin
only geniconv/iconv.h (was from LGPL libiconv) is replaced with a generic
minimal iconv.h based on public knowledge.
2020-10-14 23:01:00 +03:00
Ozkan Sezer
93e1449764 SDL_waylanddatamanager.c (mime_data_list_add): constify the buffer param
Fixes -Wdiscarded-qualifiers warnings from Wayland_data_source_add_data()
2020-10-14 15:50:04 +03:00
Sam Lantinga
b9cbea354f video: Refresh Windows display list on WM_DISPLAYCHANGE
- Displays may have been added, removed or changed and all cached monitor
  handles are invalidated as a result.

- Display events are handled in three steps:
  1. Mark all currently know displays as invalid
  2. Enumerate all displays, adding new ones and marking known displays as valid
  3. Remove all displays still invalid after enumeration

- Display connect/disconnect events are sent when displays are added or removed
  after initial setup
2020-10-13 21:08:20 -07:00
Sam Lantinga
b546db2f85 Only watch for display connect/disconnect events while the video subsystem is initialized 2020-10-09 12:58:28 -07:00
Ryan C. Gordon
b79832ba11 cocoa: Cut and paste from HTML strikes again! 2020-10-08 21:11:09 -04:00
Ozkan Sezer
19aaa2944d Fix https://bugzilla.libsdl.org/show_bug.cgi?id=5306
(Also see: https://bugzilla.libsdl.org/show_bug.cgi?id=4822)

Building the current tree against 10.8 SDK, clang emits the following warning:
src/video/cocoa/SDL_cocoawindow.m:1846:27: warning: instance method '-isOperatingSystemAtLeastVersion:' not found (return type defaults to 'id') [-Wobjc-method-access]
            ![processInfo isOperatingSystemAtLeastVersion:version]) {
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/MacOSX10.8.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSProcessInfo.h:20:12: note: receiver is instance of class declared here
@interface NSProcessInfo : NSObject {
           ^
1 warning generated.

isOperatingSystemAtLeastVersion is an 10.10 thing.
2020-10-09 04:00:00 +03:00
Ozkan Sezer
69fbd60d25 Fix https://bugzilla.libsdl.org/show_bug.cgi?id=4877#c2
loadNibNamed:owner:topLevelObjects is available on 10.8 and newer.
There is an issue report here about an app failing to function on
10.7 and earlier: https://discourse.libsdl.org/t/28179
2020-10-09 04:00:00 +03:00
Sam Lantinga
bd14f2676c Removed unused variable 2020-10-08 16:58:34 -07:00
Ozkan Sezer
d86a746542 SDL_video.c: fix whitespace 2020-10-09 02:55:00 +03:00
Sam Lantinga
76980e30f2 Added events for dynamically connecting and disconnecting displays, with an iOS implementation 2020-10-08 16:42:20 -07:00
Sam Lantinga
cd703b5628 Fixed whitespace 2020-10-08 16:41:48 -07:00
Ryan C. Gordon
77c9d73b63 Removed SDL_AndroidOpenURL, added SDL_OpenURL.
Still needs to be wired into Xcode and Visual Studio projects.
2020-10-05 11:30:33 -04:00
Sylvain Becker
cd6670bff3 SDL_Surface refcount: fix memory leak when blitting between stack'ed surfaces
(see bug 5226)
2020-10-02 10:48:27 +02:00
Manuel Alfayate Corchete
78c274cb5d kmsdrm: merge patches from Ozkan Sezer for removing c-99'isms and raising libgbm version reqeriments. 2020-09-26 19:18:09 +02:00
Sylvain Becker
955f3184f9 Fixed bug 5239 - Play audio on Android while backgrounded (Thanks Superfury)
Add hint SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO not to pause audio when
the app goes to background.
(It requires SDL_ANDROID_BLOCK_ON_PAUSE as "Non blocking")
2020-09-25 10:14:42 +02:00
Cameron Gutman
9a769da04a X11: Remove our X11 error callback in X11_DeleteDevice()
If we don't remove it, we will infinitely recurse if X11_CreateDevice() is
called again and orig_x11_errhandler becomes X11_SafetyNetErrHandler().
2020-09-07 20:10:50 -07:00
Manuel Alfayate Corchete
9c342e76dd kmsdrm: merge heap buffer overflow and cursor creation patches from meyraud705. 2020-09-13 21:41:10 +02:00
Manuel Alfayate Corchete
0cb9bfa502 kmsdrm: less excessive error checkhing 2020-09-12 15:58:47 +02:00
Manuel Alfayate Corchete
5bed30dd61 kmsdrm: also do pending modeseting in SwapWindowDoubleBuffered(). 2020-09-12 04:56:55 +02:00
Manuel Alfayate Corchete
9e9227add3 kmsdrm: reimplement modesetting for fullscreen window scaling and AR-correction. 2020-09-12 04:52:56 +02:00
Manuel Alfayate Corchete
4575c6942a kmsdrm: delete ununsed variable. 2020-09-12 02:36:02 +02:00
Manuel Alfayate Corchete
01b0cf1c90 Backed out changeset 4a45d1a30d25
kmsdrm: Fake KMSDRM_SetDisplayMode() is needed for some programs after all.
2020-09-12 00:47:00 +02:00
Manuel Alfayate Corchete
7b67654872 kmsdrm: don't fool SDL into thinking that changing the physical videomode is done. 2020-09-12 00:16:08 +02:00
Manuel Alfayate Corchete
a6d182d326 kmsdrm: no need to reconnect/reactivate things in SwapWindowDoubleBuffered(). 2020-09-11 23:47:26 +02:00
Manuel Alfayate Corchete
47e2d0304e kmsdrm: greatly improve comments in SwapBuffersFenced() for future reference. 2020-09-10 23:26:02 +02:00
Ryan C. Gordon
3c6004feb7 kmsdrm: Choose how to swap buffers based on EGL extension availability. 2020-09-10 15:07:23 -04:00
Ryan C. Gordon
c7e761f872 kmsdrm: Patched to compile if EGL headers lack EGL_ANDROID_native_fence_sync. 2020-09-10 15:05:55 -04:00