src/test/SDL_test_common.c


Log

Author Commit Date CI Message
Sam Lantinga 3f1fd5ab 2023-05-23T10:59:03 Updated source to match SDL function prototype style
Sam Lantinga 0d763800 2023-03-09T15:10:00 Code style: changed "sizeof foo" to "sizeof(foo)" (thanks @sezero!) (cherry picked from commit c6443d86c92e962683a1efe5f123a144988875b5)
Frank Praznik 8f7427c1 2023-03-08T19:19:15 tests: Always set valid dimensions for the fullscreen mode
Sylvain 17515f4a 2023-02-04T15:51:37 Backport simplify flags PR #7220
Sam Lantinga 0479df53 2023-01-09T09:48:21 Updated copyright for 2023
Sam Lantinga f5777683 2022-12-09T10:22:18 Fixed build
Sam Lantinga 569fa3f5 2022-12-09T10:13:18 Added test event logging for SDL_WINDOWEVENT_ICCPROF_CHANGED and SDL_WINDOWEVENT_DISPLAY_CHANGED
Sam Lantinga be3b1cff 2022-12-08T17:03:29 Added logging for SDL_DISPLAYEVENT_MOVED
Pierre Wendling d0bbfdbf 2022-12-01T16:07:03 Clang-Tidy fixes (#6725) (cherry picked from commit 3c501b963dd8f0605a6ce7978882df39ba76f9cd)
Sam Lantinga b8d85c69 2022-11-30T12:51:59 Update for SDL3 coding style (#6717) I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base. In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted. The script I ran for the src directory is added as build-scripts/clang-format-src.sh This fixes: #6592 #6593 #6594 (cherry picked from commit 5750bcb174300011b91d1de20edb288fcca70f8c)
Sylvain Becker fb0ce375 2022-11-27T17:38:43 Cleanup add brace (#6545) * Add braces after if conditions * More add braces after if conditions * Add braces after while() conditions * Fix compilation because of macro being modified * Add braces to for loop * Add braces after if/goto * Move comments up * Remove extra () in the 'return ...;' statements * More remove extra () in the 'return ...;' statements * More remove extra () in the 'return ...;' statements after merge * Fix inconsistent patterns are xxx == NULL vs !xxx * More "{}" for "if() break;" and "if() continue;" * More "{}" after if() short statement * More "{}" after "if () return;" statement * More fix inconsistent patterns are xxx == NULL vs !xxx * Revert some modificaion on SDL_RLEaccel.c * SDL_RLEaccel: no short statement * Cleanup 'if' where the bracket is in a new line * Cleanup 'while' where the bracket is in a new line * Cleanup 'for' where the bracket is in a new line * Cleanup 'else' where the bracket is in a new line (cherry picked from commit 6a2200823c66e53bd3cda4a25f0206b834392652 to reduce conflicts merging between SDL2 and SDL3)
Ryan C. Gordon 2dd76598 2022-08-09T09:29:30 test: Fixed wrong arguments to SDL_SetWindowFullscreen.
Sam Lantinga 2241bd66 2022-07-29T20:37:38 Added a command line option `--info event_motion` to show mouse and finger motion events
chalonverse f317d619 2022-07-01T13:59:14 Xbox GDKX support (#5869) * Xbox GDK support (14 squashed commits) * Added basic keyboard testing * Update readme * Code review fixes * Fixed issue where controller add/removal wasn't working (since the device notification events don't work on Xbox, have to use the joystick thread to poll XInput)
Sam Lantinga 0e198a87 2022-04-05T15:03:18 Added a define VERBOSE_MOTION_EVENTS to show mouse and finger motion events
Sam Lantinga 120c76c8 2022-01-03T09:40:00 Updated copyright for 2022
Ozkan Sezer ced442cd 2021-12-17T07:33:10 SDL_test_common.c: (unsigned char) cast to SDL_isdigit() parameter.
Ozkan Sezer a887b8e2 2021-12-03T20:03:10 SDL_test_common.c: replaced all printf() calls with SDL_Log() Otherwise, if one builds libSDL2_test using a new mingw but builds the test programs using an older mingw, a link failure happens: /opt/local/x86_64-w64-mingw32/lib/libSDL2_test.a(SDL_test_common.o): In function `printf': /opt/local/x86_64-w64-mingw32/include/stdio.h:372: undefined reference to `__imp___acrt_iob_func' collect2: ld returned 1 exit status
Sam Lantinga a3c05d2f 2021-11-23T19:43:01 Added debug output for display connect/disconnect events
Eric Wasylishen 0d987936 2021-11-09T22:03:42 testwm2: Fix video modes menu hit detection when highdpi or logical size used (#4936) * SDLTest_CommonDrawWindowInfo: log SDL_RenderGetScale, SDL_RenderGetLogicalSize * testwm2: fix video modes menu hit detection in High DPI cases - also when logical size is specified, e.g. `--logical 640x480 --resizable --allow-highdpi` * add function to determine logical coordinates of renderer point when given window point * change since to the targeted milestone * fix typo * rename for consistency * Change logical coordinate type to float, since we can render with floating point precision. * add function to convert logical to window coordinates * testwm2: use new SDL_RenderWindowToLogical * SDL_render.c: alternate SDL_RenderWindowToLogical/SDL_RenderLogicalToWindow Co-authored-by: John Blat <johnblat64@protonmail.com> Co-authored-by: John Blat <47202511+johnblat64@users.noreply.github.com>
Ethan Lee 4b42c05b 2021-11-08T13:52:48 video: Add SDL_SetWindowMouseRect. This API and implementation comes from the Unreal Engine branch of SDL, which originally called this "SDL_ConfineCursor". Some minor cleanup and changes for consistency with the rest of SDL_video, but there are two major changes: 1. The coordinate system has been changed so that `rect` is _window_ relative and not _screen_ relative, making it easier to implement without having global access to the display. 2. The UE version unset all rects when passing `NULL` as a parameter for `window`, this has been removed as it was an unused feature anyhow. Currently this is only implemented for X, but can be supported on Wayland and Windows at minimum too.
Eric Wasylishen a0e055a7 2021-11-07T02:48:29 testwm2: add mode menu, click on a mode to call SDL_SetWindowDisplayMode
Sam Lantinga b5e5c1ef 2021-08-13T17:53:39 Added Ctrl-T to toggle topmost mode in test programs
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
Eric Wasylishen c33e3c15 2021-06-07T18:24:57 testwm2: draw various debug logging into the window itself Renderer output size, window position/size, display bounds, etc. Uses new SDLTest_CommonDrawWindowInfo function in test_common.
Sylvain 9727655b 2021-04-26T14:22:19 SDL_test_common: add other window flags: --shown, --hidden, --input-focus, --mouse-focus
Sylvain d62ebec2 2021-04-26T14:10:39 SDL_test_common: replace 'resize' by 'resizable'
Alex Szpakowski 09231c42 2021-02-15T11:51:00 Fix flags check in test code
Jay Petacat f443a6fc 2021-02-11T02:05:02 Fix format string warnings for width-based integers The DJGPP compiler emits many warnings for conflicts between print format specifiers and argument types. To fix the warnings, I added `SDL_PRIx32` macros for use with `Sint32` and `Uint32` types. The macros alias those found in <inttypes.h> or fallback to a reasonable default. As an alternative, print arguments could be cast to plain old integers. I opted slightly for the current solution as it felt more technically correct, despite making the format strings more verbose.
Sam Lantinga ef2f13e1 2021-02-01T22:30:31 Added test command line options to force different window types
Cameron Gutman 6b057c67 2021-01-26T19:16:17 Expose separate keyboard and mouse grab support This adds SDL_SetWindowKeyboardGrab(), SDL_GetWindowKeyboardGrab(), SDL_SetWindowMouseGrab(), SDL_GetWindowMouseGrab(), and new SDL_WINDOW_KEYBOARD_GRABBED flag. It also updates the test harness to exercise this functionality and makes a minor fix to X11 that I missed in https://hg.libsdl.org/SDL/rev/02a2d609369b To fit in with this new support, SDL_WINDOW_INPUT_CAPTURE has been renamed to SDL_WINDOW_MOUSE_CAPTURE with the old name remaining as an alias for backwards compatibility with older code.
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Ozkan Sezer 16389654 2020-06-14T12:05:56 fix watcom build of SDL_test_common.c
Ryan C. Gordon afb70f26 2020-02-12T13:09:38 test: Reimplemented SDLTest_CommonUsage() to restore binary compatibility. Fixes Bugzilla #4975.
Ryan C. Gordon 66579dbd 2020-01-30T13:47:48 test: Common framework now accepts --usable-bounds command line argument.
Ryan C. Gordon 80e7e2eb 2020-01-30T13:47:19 test: change path in a comment from '\\' to '/' char. Nothing serious here.
Sam Lantinga a8780c6a 2020-01-16T20:49:25 Updated copyright date for 2020
Cameron Cawley 20ddf45e 2019-11-02T22:58:52 Added SDL_PIXELFORMAT_BGR444
Ryan C. Gordon e9c1e126 2019-10-15T12:02:19 test: Fixed wrong verbose flag check (thanks, watcom.hecht!). Fixes Bugzilla #4826.
Ryan C. Gordon b5d3b6fc 2019-05-28T17:39:13 test: unify all the command line usage logging.
Ryan C. Gordon 00e5eeb4 2019-05-19T01:45:15 test: added SDLTest_CommonDefaultArgs() This is for test apps that don't need custom command line arguments; it lets us reduce the boilerplate code a tiny bit.
Sam Lantinga 5e13087b 2019-01-04T22:01:14 Updated copyright for 2019
Sylvain Becker 252dc85e 2018-12-06T09:22:00 Fix warnings detected on Android build
Sam Lantinga f225af0c 2018-08-22T21:48:28 Added SDL_GetDisplayOrientation() to get the display orientation, and added a new event SDL_DISPLAYEVENT to notify the application when the orientation changes. Documented the values returned by the accelerometer and gyroscope sensors
Ryan C. Gordon e061a92d 2018-08-02T16:03:47 Some drag'and'drop improvements. First: disable d'n'd events by default; most apps don't need these at all, and if an app doesn't explicitly handle these, each drop on the window will cause a memory leak if the events are enabled. This follows the guidelines we have for SDL_TEXTINPUT events already. Second: when events are enabled or disabled, signal the video layer, as it might be able to inform the OS, causing UI changes or optimizations (for example, dropping a file icon on a Cocoa app that isn't accepting drops will cause macOS to show a rejection animation instead of the drop operation just vanishing into the ether, X11 might show a different cursor when dragging onto an accepting window, etc). Third: fill in the drop event details in the test library and enable the events in testwm.c for making sure this all works as expected.
Sam Lantinga e3cc5b2c 2018-01-03T10:03:25 Updated copyright for 2018
Sam Lantinga 5fc20176 2017-10-12T14:25:07 Fixed bug 3877 - missing SDLCALL in SDLTest_ExampleHitTestCallback Ozkan Sezer Following trivial patch adds missing SDLCALL to SDLTest_ExampleHitTestCallback()
Sam Lantinga 9c580e14 2017-10-12T13:44:28 Added functions to query and set the SDL memory allocation functions: SDL_GetMemoryFunctions() SDL_SetMemoryFunctions() SDL_GetNumAllocations()
Sam Lantinga f4f9e39f 2017-10-12T08:41:11 Fixed bug 3874 - Compiler warnings SDL_Surface.c and SDL_cocoakeyboard.m
Sam Lantinga 0fea9164 2017-09-22T17:29:32 Added an example for SDL_SetWindowHitTest() when you create a borderless resizable window.
Sam Lantinga 9ca62923 2017-08-29T23:14:39 Added some missing render capability flags
Sam Lantinga c3d428d4 2017-08-29T23:12:26 Fixed line breaks in verbose test logging output
Sam Lantinga 94e0f3e9 2017-08-29T22:52:17 Added some debug messaging for previously unhandled events
Sam Lantinga ded5b3a4 2017-08-27T21:05:18 Fixed crash at shutdown if the window couldn't be created
Ryan C. Gordon 25e3a1ec 2017-08-27T22:15:57 vulkan: Initial Vulkan support! This work was done by Jacob Lifshay and Mark Callow; I'm just merging it into revision control.
Sam Lantinga b2e2bcc2 2017-08-12T20:21:34 Added test debug logs for additional event types
Sam Lantinga 3c852360 2017-08-11T10:42:26 Fixed bug 3646 - SDL_test_common.c: Add key bindings for testing SDL_SetWindowPosition Eric Wasylishen Alt-Up/Down/Left/Right switches between displays using SDL_WINDOWPOS_CENTERED_DISPLAY Shift-Up/Down/Left/Right shifts the window by 100px
Ryan C. Gordon cff9e5a8 2017-05-18T16:29:10 test: info now reports usable display bounds and DPI (thanks, Eric!). Fixes Bugzilla #3652.
Philipp Wiesemann 33ff5bd1 2017-02-03T23:30:29 Fixed typo in log message.
Sam Lantinga 800a72eb 2017-01-31T10:19:56 Switch stderr output to SDL_Log() so it shows up on Windows and mobile devices
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
Ryan C. Gordon 232ae688 2016-11-23T17:20:28 Still more compiler warning fixes for various platforms.
Ryan C. Gordon 40c2a6fb 2016-11-23T11:49:26 Fixed more compiler warnings.
Sam Lantinga f1e0b9af 2016-09-29T16:10:08 Added debug output for new window events
Ryan C. Gordon 3bdaf4c6 2016-01-05T02:46:10 Added SDL_SetWindowOpacity() and SDL_GetWindowOpacity(). This is currently implemented for X11, Cocoa, Windows, and DirectFB. This patch is based on work in Unreal Engine 4's fork of SDL, compliments of Epic Games.
Sam Lantinga 42065e78 2016-01-02T10:10:34 Updated copyright to 2016
Philipp Wiesemann 0e45984f 2015-06-21T17:33:46 Fixed crash if initialization of EGL failed but was tried again later. The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly uninitialized data structure if loading the library first failed. A later try to use EGL then skipped initialization and assumed it was previously successful because the data structure now already existed. This led to at least one crash in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was dereferenced to make a call to eglBindAPI().
Sam Lantinga 2c4a6ea0 2015-05-26T06:27:46 Updated the copyright year to 2015
Ryan C. Gordon b72938c8 2015-04-20T12:22:44 Windows: Always set the system timer resolution to 1ms by default. An existing hint lets apps that don't need the timer resolution changed avoid this, to save battery, etc, but this fixes several problems in timing, audio callbacks not firing fast enough, etc. Fixes Bugzilla #2944.
Alex Szpakowski fe6c797c 2015-04-10T23:30:31 Fixed an iOS view orientation issue when SDL_GL_CreateContext or SDL_CreateRenderer is called.
Ryan C. Gordon 73feb8c0 2015-03-18T00:56:33 Fixed a compiler warning.
Edward Rudd b88ca1b4 2015-02-10T16:28:56 the last parameter of XChangeProperty is the number of elements.. and when the element format is 32.. the element is "long" so we have 5 long elements here. Yes this seems confusing as on mac+linux Long is either 32 or 64bits depending on the architecture, but this is how the X11 protocol is defined. Thus 5 is the correct value for the nelts here. Not 5 or 10 depending on the architecture. More info on the confusion https://bugs.freedesktop.org/show_bug.cgi?id=16802
Philipp Wiesemann b48e54aa 2015-01-26T22:00:29 Fixed bug 2802 - [patch] Fix android build compiling in wrong filesystem implementation Jonas Kulla The configure script didn't differentiate between Linux and Android, unconditionally compiling in the unix implementation of SDL_sysfilesystem.c. I'm probably one of the very few people building SDL for android using classic configure + standalone toolchain, so this has gone undetected all along.
Ryan C. Gordon 16f3cbfc 2014-12-26T23:16:54 Cleaned up some compiler warnings.
Edward Rudd 73daadb7 2014-12-03T12:23:17 switch to use SDL_PRI* macros for long long formatting everywhere.
Edward Rudd 7810d198 2014-12-03T11:04:07 fix incorrect struct member name in test code for wheel direction
David Ludwig 70438be2 2014-12-03T10:55:23 WinRT: fixed bug whereby SDL would override an app's default orientation WinRT apps can set a default, preferred orientation via a .appxmanifest file. SDL was overriding this on app startup, and making the app use all possible orientations (landscape and portrait). Thanks to Eric Wing for the heads up on this!
Edward Rudd bd4dd2b5 2014-11-23T21:10:55 update logging of events in test core - log unknown as HEX instead of int (makes it easier to identify) - add dollar gesture and multi gesture events - add scroll reverse for mouse wheel
Philipp Wiesemann 9c398852 2014-11-22T22:20:40 Corrected header file documentation comment.
Pierre-Loup A. Griffais 24c86b55 2014-09-11T19:24:42 [X11] Reconcile logical keyboard state with physical state on FocusIn since the window system doesn't do it for us like other platforms. This prevents sticky keys and missed keys when going in and out of focus, for example Alt would appear to stick if switching away from an SDL app with Alt-Tab and had to be pressed again. CR: Sam
Sam Lantinga 6fef39d6 2014-08-06T11:34:54 Added NV12 and NV21 texture support for OpenGL and OpenGL ES 2.0 renderers
Ryan C. Gordon b29740b8 2014-06-25T17:06:12 Merged Ryan's SDL-gui-backend branch. Adds three APIs, and implements them on X11, Cocoa, and Windows: - SDL_CaptureMouse() - SDL_GetGlobalMouseState() - SDL_SetWindowHitTest()
Ryan C. Gordon 84369567 2014-06-25T16:16:55 Changed SDL_GetAbsoluteMouseState() to SDL_GetGlobalMouseState(). This matches naming conventions in the main repository, between SDL_GetRelativeMouseState() and SDL_WarpMouseGlobal().
Ryan C. Gordon b861efde 2014-06-05T00:03:33 Implemented SDL_GetAbsoluteMouseState(). X11 only for now, but this should be doable on every platform, I think.
Ryan C. Gordon 4ef6edda 2014-05-30T01:48:08 Make some printf() calls into SDL_Log() so I can see them on Windows. :)
Ryan C. Gordon b7d2c0e9 2014-05-24T01:30:37 Implemented SDL_CaptureMouse().
David Ludwig 3dcb451f 2014-04-09T21:29:19 Added a README file regarding WinRT support To note, this file is currently formatted with CRLF line endings, rather than LF, to allow the file to be viewed with Notepad.
Sam Lantinga d5c109b2 2014-04-05T16:25:30 Fail if we couldn't create the specified renderer
Sam Lantinga 26823b1b 2014-03-23T23:09:22 Added an event SDL_RENDER_DEVICE_RESET, which is triggered on Direct3D 11 when the device has been lost and all textures need to be recreated.
Sam Lantinga e663b4eb 2014-03-01T09:50:52 Fixed bug 2423 - timeBeginPeriod & timeEndPeriod mismatch Coriiander In src\timer\windows\SDL_systimer.c there is an error with regards to timeBeginPeriod and timeEndPeriod. These functions typically get called when no high resolution timer is available, and GetTickCount is not used. According to MSDN (link: http://msdn.microsoft.com/en-us/library/windows/desktop/dd757624(v=vs.85).aspx), for every call to timeBeginPeriod a subsequent call to timeEndPeriod is required. While SDL is currently doing this, it fails to call timeEndPeriod when cleaning up/shutting down SDL. Please note that these functions affect things on a system level. Failing to call timeEndPeriod, disables applications for using WINMM-timers after usage&shutdown of SDL, as effectively they the mechanism is now broken. Solution: Ensure this code gets called when shutting down the timer subsystem: #ifndef USE_GETTICKCOUNT if (!hires_timer_available) { timeSetPeriod(0); } #endif
Sam Lantinga c52c9105 2014-02-13T11:05:30 Added SDL_DXGIGetOutputInfo which returns the adapter and output indices that are used to create DX10 and DX11 devices and swap chains on a particular display. CR: SamL
Sam Lantinga 58edac3e 2014-02-02T00:53:27 Fixed bug 2374 - Update copyright for 2014... Is it that time already??
Sam Lantinga 9e90acdf 2014-01-18T11:47:03 Make sure you clean up the associated renderer when destroying a window.
J?rgen P. Tjern? a442f121 2014-01-15T11:08:55 Test: Add Shift-Enter to switch between FS and desktop FS.
J?rgen P. Tjern? a6a56af9 2014-01-15T10:40:14 Tests: Refactor key modifier checking.
Sam Lantinga 8e0dfef1 2013-12-23T15:55:47 Print events with SDL_Log() so they show up in Visual Studio debug output Added some joystick and controller events to the set that are printed out.
Sam Lantinga 74692835 2013-12-23T12:17:52 Added support for double-clicks, through a new "clicks" field in the mouse button event.
Gabriel Jacobo f848adff 2013-11-29T10:06:08 Improve Android pause/resume behavior.
Sam Lantinga 48954ba1 2013-11-18T20:22:36 Accidentally committed debug code