Deve
When I'm trying to close on-screen keyboard using SDL_StopTextInput() function by touching the screen (SDL_FINGERUP or SDL_FINGERDOWN event), the screen is flickering. It is white for a while.
Note that it usually works without problems when I use phone's "back" button. I noticed flickering occasionally too, but not that often.
Philipp Wiesemann
The attached patch maybe fixes the flicker but not the actual fault causing it.
Timo Gurr
On cross hosts running autotools for SDL2_gfx-1.0.1 fails to find sdl2.m4:
eautoreconf: running in /var/tmp/paludis/build/media-libs-SDL2_gfx-1.0.1/work/SDL2_gfx-1.0.1 ...
aclocal
aclocal-1.13: warning: autoconf input should be named 'configure.ac', not 'configure.in'
configure.in:128: warning: macro 'AM_PATH_SDL2' not found in library
libtoolize --copy --force --automake
aclocal
aclocal-1.13: warning: autoconf input should be named 'configure.ac', not 'configure.in'
configure.in:128: warning: macro 'AM_PATH_SDL2' not found in library
autoconf
configure.in:128: error: possibly undefined macro: AM_PATH_SDL2
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
* Failed Running autoconf !
SDL2 installs it to /usr/x86_64-pc-linux-gnu/share/aclocal on cross hosts, attached patch makes use of CMAKE_INSTALL_FULL_DATAROOTDIR to support correctly installing to the arch independent location /usr/share/aclocal.
John Wordsworth
While attempting to integrate CEF (Browser) into an SDL application, we noticed that there were problems on OS X where approximately 50% of the input events were essentially being lost - even when we were using off-screen rendering in CEF and passing through input events manually.
It appears that this problem has been around for a while (see: http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=11141).
Please consider the following patch that fixes this issue. Instead of processing events directly after calling [NSApp nextEventMatchingMask:...] we now pass these events down to NSApp, for processing by an overloaded sendEvent: method. Chromium also forwards events to NSApp in the same way, which means we don't miss events, even if they were originally dequeued by CEF.
Daniel
Seems like check of the visibility of renderer (renderer->hidden) is missing in SDL_RenderCopyEx.
In SDL_RenderCopy it should be done much earlier (after checking support for RenderCopyEx, line 1750).
Michael
In SDL_x11modes.c the CalculateXRandRRefreshRate() function performs integer math on values that may return fractional results. This causes a value that would be calculated as 59.99972... to be returned as 59. In Linux the xrandr command returns 60Hz for this particular display mode yet SDL returns 59Hz.
I suggest this function be updated to correctly round the result of the calculation instead of truncating the result.
Machiel van Hooren
In SDL_dxjoystick.c line 349 there is a constant c_dfDIJoystick2.
However, this constant is aparently also defined in dinput8.lib.
I encountered a linking error when statically linking to SDL:
SDL2_static.lib(SDL_dxjoystick.obj) : error LNK2005: _c_dfDIJoystick2 already defined in dinput8.lib
My application is also linking to dinput8.lib because we rolled our own joystick input and are not using the joystick functionality from SDL.
Patrick Gutlich
The mouse cursor gets corrupted when the mouse moves over the screen edges (right and bottom) a weird type of scaling seems to occur and you end up with a blank square.
tvc
I've spent the last few days implementing touchscreen support in core/linux/SDL_evdev.c. It's fairly rudimentary at the moment, as can be seen from the multiple TODO's and FIXME's littered throughout, but I'm mainly submitting this patch for review. I've tested this patch on my Raspberry Pi 2 with the official touchscreen and it works fantastically, reporting all 10 multitouch points. I'm happy to work on this further, the evdev logic also needs a bit of a cleanup I think (I may have included a few changes). But if it's good enough in its current state to be committed then I'm sure there'd be plenty of people pleased, as currently the only other framework/library that supports touchscreens on the Raspberry Pi is Kivy.
Fritzor
Source Suface is ABGR and Destination Surface is ABGR. We use software blending. In the Switch-Case statement for SDL_COPY_BLEND (Line 126) the alpha-channel is not calculated like in every SDL_blit_auto - function. So if the destination Surface has alpha - channel of zero the resulting surface has zero as well.
Add: ?dstA = srcA + ((255 - srcA) * dstA) / 255;? to code and everything is okay.
Marcel Bakker
Observed when resizing or moving a window in Windows 7.
Depending on how you resize/move your window
, you may receive none or a lot of SDL_WINDOWEVENT_EXPOSED events
, at the moment you release the mouse button.
Maybe add this event to an already existing list of overflow candidates ?
C.W. Betts
Swift is very strict with types, so much that those of different signedness/size must be cast. Most of the defines are imported as 32-bit signed integers, while the corresponding field in a struct is a 32-bit unsigned integer. Appending a "u" would cause the defined types to be imported as 32-bit unsigned integers.
Yann Dirson
When attempting to force use of opengles2 renderer with:
int wanted_renderer = -1;
for (int i = 0; i < numrenderers; i++) {
SDL_RendererInfo renderer_info;
if (SDL_GetRenderDriverInfo(i, &renderer_info) != 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't get renderer driver info: %s\n",
SDL_GetError());
quit(2);
}
std::cerr << "Renderer " << i << " '" << renderer_info.name << "': flags=0x"
<< std::hex << renderer_info.flags << std::dec
<< ", " << renderer_info.num_texture_formats << " texture formats, max="
<< renderer_info.max_texture_width << "x"
<< renderer_info.max_texture_height << "\n";
if (!strcmp(renderer_info.name, "opengles2")) {
std::cerr << " selecting!\n";
wanted_renderer = i;
}
}
renderer = SDL_CreateRenderer(window, wanted_renderer, 0);
... on banana pi or raspberry pi I get an error like the following (the actual
context profile value varies, being used uninitialized)
ERROR: Couldn't create renderer: Unknown OpenGL context profile 900
With this patch I get the following, which should help more pointing to a real problem:
ERROR: Couldn't create renderer: Failed getting OpenGL glGetString entry point
I pushed a patch (based on master branch of unofficial git mirror):
550389c89f
I'll be opening a different bug for the underlying issue.
Evgeny Vrublevsky
Original code in the video/windows/SDL_windowsevents.c registers obsolete WNDCLASS (not WNDCLASSEX). As the result only one icon size is used as the small and normal icons. Also original code doesn't specify required size of an icon. As the result when 256x256 icon is available, the program uses it as a default icon, and it looks ugly.
We have to use WNDCLASSEX and load icons with proper sizes which we can get using GetSystemMetrics.
Better idea. We could use the first icon from resources, like the Explorer does. Patch is included. It also correctly loads large and small icons, so it will look nice everywhere.
ny00
Using the OpenGL ES 1.1 renderer, after updating a texture with SDL_UpdateTexture (or SDL_UnlockTexture), a following call to SDL_RenderFillRect draws a rectangle with the wrong color (which appears to be the same as the texture's top-left pixel).
Comparing SDL_render_gles.c:GLES_UpdateTexture to SDL_render_gl.c:GL_UpdateTexture, a missing call to glDisable appears to be the cause. After adding it back, the bug is resolved.
ny00
On Android, the keycodes KEYCODE_BUTTON_1..16 (actual values 188-203) are translated to SDL_Joystick buttons no. 20-35. These are currently ignored in SDL_gamecontroller.c.
The attached patch fixes this, by increasing k_nMaxReverseEntries from 20 to another arbitrary bound of 48.
Side-note: Maybe some log should be emitted in case of going over any such bound?
jfverdon
Genie (https://github.com/bkaradzic/genie) is a well known premake fork which uses internally Lua 5.3 (as opposed to version 5.1 used in premake4).
As there is some Lua's API breaks in Lua 5.2, SDL premake scripts do not works with premake.
The two incompatibilities I noticed were:
* unhandle modes "rt" and "wt" for io.open. Has io.open opens files in text mode by default, the "t" flag is not needed (this flag is not supported in Genie).
* os.execute signature change, the return value is a tuple from Lua 5.2, before it was just the called program exit code.
winterknight
The showrev.sh script shows the tip, instead of the current hg revision. This can be mismatched if one were to use hg update -r ??? to revert to a previous revision.
Patch uses parents instead of tip, which will show the revision that the source is compiled with, instead of the latest revision that the user who is compiling has downloaded.
joe.gsoc16
I recently looked into Unicode support in SDL2 and realized that
SDL_TEXTEDITING doesn't get triggered at all (Japanese IME).
According to others on IRC it works fine on Windows/Mac but not
for me on (arch)Linux.
When compiling SDL with autotools, IBus support is enabled by
default but not so with CMake.
I never used CMake before but got it working and also included
that pkg-config determines flags for dbus (FIXME in CMakeLists).
Diego
The keyboard on iPads has a dismiss button that hides the keyboard. When the keyboard was hidden using that button, instead of the return key, SDL was still reporting IsTextInputActive as true. This patch adds an extra SDL_StopTextInput when iOS reports the keyboard will hide.
Simon Hug
I'm proposing some changes to the IME test program test/testime.c. The patch includes support for the GNU Unifont hex file, making the SDL_ttf dependency optional. There were also one or two bugs that prevented the text and underline from showing up poperly.
Simon Hug
There's a call to the POSIX function random in test/testqsort.c. Naturally, Windows doesn't do that. The attached patch changes the call to the SDLtest framework random functions and adds some seed control.
Looking at SDLTest_RandomInitTime, I just want to say that 'srand((unsigned int)time(NULL)); a=rand(); srand(clock()); b=rand();' is an absolutely terrible way to initialize a seed on Windows because of its terrible LCG.
Simon Hug
The SDLmain file src/main/windows/SDL_windows_main.c defines both entry points for console applications, main and wmain. This seems to confuse MSVC. It outputs a LNK4067 warning and then chooses main, which is a shame because only wmain has the unicode handling. Using SDLmain.lib provided on libsdl.org, the linker also goes for main.
I'm proposing to not define the main entry point at all. wmain should be supported well enough with MSVC.
Simon Hug
The two tests test/testaudioinfo.c and test/testaudiohotplug.c are missing error checking when they call SDL_GetAudioDeviceName. This function can return NULL which the tests pass straight to SDL_Log.
Eric Wasylishen
The bug here is that a dead keys pressed before calling SDL_StartTextInput() carries over into future text input, so the next key pressed will have the deadkey applied to it.
This in undesirable, imho, and doesn't occur on OS X (haven't check Linux or elsewhere). It's causing a problem for Quakespasm on German keyboard layouts, where we use the ^ deadkey to toggle the console (which enables/disables text input), and ^ characters are showing up in the TEXTINPUT events.
Simon Hug
The function console_wmain in src/main/windows/SDL_windows_main.c does not null terminate the argument list it is creating. As specified by the C standard, "argv[argc] shall be a null pointer."
The SDLTest framework makes use of that null pointer and some test programs can cause an access violation because it's missing.
Simon Hug
The description of the SDL_RenderClear function in the SDL_render.h header says the following:
"This function clears the entire rendering target, ignoring the viewport."
The word "entire" implies that the clipping rectangle set with SDL_RenderSetClipRect also gets ignored. This is left somewhat ambiguous if only the viewport is mentioned. Minor thing, but let's see what the implementations actually do.
The software renderer ignores the clipping rectangle when clearing. It even has a comment on this: /* By definition the clear ignores the clip rect */
Most other render drivers (opengl, opengles, opengles2, direct3d, and psp [I assume. Can't test it.]) use the scissor test for the ClipRect and don't disable it when clearing. Clearing will only happen within the clipping rectangle for these drivers.
An exception is direct3d11 which uses a clear function that ignores the scissor test.
Simon Hug
When updating the viewport in GLES_UpdateViewport, the OpenGL ES renderer doesn't flip the projection matrix for target textures. The lines, rectangles and textures (if drawn with glDrawArrays) are upside down when drawing to target textures.
Simon Hug
The OpenGL ES 2 renderer does not check the target texture format when using SDL_RenderReadPixels and just always uses ABGR8888. This can result in swapped or wrong colors.
The attached patch adds a check and selects the target texture format, if a texture is set as the target.
Simon Hug
All OpenGL renderers always flip the rows of the pixels that come from glReadPixels. This is unnecessary for target textures since these are already top down.
Also, the rect->y value can be used directly for target textures for the same reason. I don't see any code that would handle the logical render size for target textures. Or am I missing something?
The attached patch makes the renderers only the flip rows if the data comes from the default framebuffer.
Simon Hug
The current SDL_SaveBMP_RW function that saves surfaces to a BMP uses an old bitmap header which doesn't officially support alpha channels. Applications just ignore the byte where the alpha is stored. This can easily be extended by using a newer header version and setting the alpha mask.
The attached patch has these changes:
- Extending the description of the function in the SDL_surface.h header with the supported formats.
- Refining when surfaces get stored to a 32-bit BMP. (Must have bit depth of 8 or higher and must have an alpha mask or colorkey.)
- Fixing a small bug that saves 24-bit BGR surfaces with a colorkey in a 24-bit BMP.
- Adding code that switches to the bitmap header version 4 if the surface has an alpha mask or colorkey. (I chose version 4 because Microsoft didn't lose its documentation behind a file cabinet like they did with version 3.)
- Adding a hint that can disable the use of the version 4 header. This is for people that need the legacy header or like the old behavior better. (I'm not sure about the hint name, though. May need changing if there are any rules to that.)
Simon Hug
The GL_SetBlendMode and GLES_SetBlendMode functions of the opengl and opengles renderers call the glTexEnvf to set the texture env mode to either GL_MODULATE (the default) or GL_REPLACE for the NONE blend mode. Using GL_REPLACE disables color and alpha modulation for textures.
These glTexEnv calls were put in the SetBlendMode function back in 2006 [1], but there the NONE code still used the GL_DECAL mode. The GL_REPLACE mode came in 2008 [2]. I'm a bit confused why that wasn't always GL_MODULATE and a bit surprised nobody reported that yet (unless I missed it). I guess only a few use the gles renderer and the newish shaders mask the issue.
Simon Hug
The GL_CreateTexture function doesn't have any checks for the case where the driver doesn't support the framebuffer object extension. It will call into GL_GetFBO which will call the non-existent glGenFramebuffersEXT.
Also, for some reason GL_CreateContext always sets the SDL_RENDERER_TARGETTEXTURE info flag, even if it is not supported. Changeset cc226dce7536 [1] makes this change, but doesn't explain why. It seems to me like the code would already have taken care of this [2].
The attached patch adds some checks and stops SDL from reporting render target support if there is none. The application can then properly inform the user instead of just crashing.