Commit Graph

918 Commits

Author SHA1 Message Date
Sam Lantinga fe4bc5ab25 Fixed Linux build 2014-08-23 11:00:16 -07:00
Sam Lantinga 059579e48f Fixed bug 2696 - Mac: fix display mode refresh rate calculation
Alex Szpakowski

SDL's Cocoa backend uses the CGDisplayMode API to get refresh rate information about a display mode, but CGDisplayModeGetRefreshRate will return 0 on most non-CRT monitors.

The only way I know of to get correct refresh rate information in OS X is via the CoreVideo DisplayLink API.
I have attached a patch which tries to use the CVDisplayLinkGetNominalOutputVideoRefreshPeriod function if CGDisplayModeGetRefreshRate fails, which fixes display mode refresh rate information on the monitors I tested.

The CVDisplayLink API requires linking with the CoreVideo framework, and the patch updates the various build files to do so.
2014-08-23 10:47:50 -07:00
Ryan C. Gordon a79ed6cea2 Fix declaration-after-statement errors in ibus code. 2014-08-21 23:22:46 -04:00
Ryan C. Gordon 5e1f15892f Adjusted code style slightly for SDL_ibus.c 2014-08-21 23:15:17 -04:00
Sam Lantinga 38b49c30e1 Changed the name of the IME hint to match the naming convention in SDL 2014-08-19 21:59:56 -07:00
Alex Baines 90bc642fa8 Add a SDL_IM_INTERNAL_EDITING event to make IMs like iBus render editing text in its own UI instead of sending TEXTEDITING events.
This is useful for applications that handle TEXTINPUT events but not TEXTEDITING events.
2014-08-19 23:31:50 +01:00
Alex Baines f4ddacf425 Improvements to the IBus related code:
+ Handle HidePreeditText IBus signal.
+ Use SDL_GetKeyboardFocus instead of SDL_GetFocusWindow.
+ Move the X11 IBus SetFocus calls to the X11_DispatchFocus functions.
+ Simplify the IBus ifdefs when handling X11 KeyEvents.
+ Remove inotify watch when SDL_IBus_Quit is called.
2014-08-19 23:17:28 +01:00
Alex Baines 6f84f37c0a Take the window border size into account when positioning the IBus candidate list. 2014-08-19 22:28:53 +01:00
Sam Lantinga bbab38552a SDL - fix fullscreen desktop windows not restoring to fullscreen state if focus changes happen due to programtic window changes (and not user alt-tabbing) 2014-08-18 18:16:45 -07:00
Sam Lantinga 877666e237 Fixed UV texture coordinate scale when using GL_ARB_texture_non_power_of_two 2014-08-18 11:28:16 -07:00
Sam Lantinga d1cc47b337 Fixed 2680 - OSX: Replace NSAutoreleasePool with @autoreleasepool
Tim McDaniel

This patch replaces all use of NSAutoreleasePool with the Apple recommended @autoreleasepool.  @autoreleasepool is supposedly more efficient, and since it is scope based it can't be accidentally not released.
2014-08-17 15:07:00 -07:00
Sam Lantinga 5e50180415 Fixed bug 2655 - OSX: Window position and global mouse coord spaces are different
Tim McDaniel

On OSX, with revision 8729, the coordinate space for window position and the coordinate space for global mouse position don't match.  For a non-fullscreen window, the window position is global relative to the bottom of the menubar.  The global mouse position is relative to the top of the screen.  This affects Cocoa_WarpMouse and potentially other things as well.  Further, the coordinate system for window position is now affected by what screen it is on.  For example, if I have two equal size screens oriented side by side such that the tops of the screens are equal in global space, with the menubar on one screen, and a window straddles the two screens, the window's y position makes no sense.  The window's y position depends on what screen "most" of the window is on.  So if I move the window horizontally just a bit, the y position of my window is now different by the size of the menubar, even though the window was not moved vertically.

I'd like to reiterate that this was a fairly fundamental change (and a breaking change for us).  If SDL OSX is to really support multi-display configurations, this is especially problematic.

If the real concern is preventing windows from going under the menubar, then perhaps a solution involving something like overriding [NSWindow constrainFrameRect] would be less problematic than redefining the global window coord space for the main display.
2014-08-17 14:57:52 -07:00
Sam Lantinga de3d381cb6 Fixed bug 2685 - SDL_RenderReadPixels() doesn't work with offscreen targets
Andreas Falkenhahn

SDL_RenderReadPixels() doesn't seem to work when trying to read pixels from a texture that has been created using SDL_TEXTUREACCESS_TARGET and has been selected as the render target using SDL_SetRenderTarget().

I am attaching a small program that demonstrates the issue. I get the following result here:

READ PIXEL RETURN: 0 --- COLOR CHECK: ff000000

But it should be:

READ PIXEL RETURN: 0 --- COLOR CHECK: ffff0000

Tested with SDL 2.0.3 on Windows 7.
2014-08-17 14:44:53 -07:00
Sam Lantinga 2e3c778ef5 Fixed bug where the render target is updated instead of the default output when the window is resized. 2014-08-17 14:34:41 -07:00
Sam Lantinga 1ea8697894 Removed SDL_round() because the license wasn't compatible with zlib 2014-08-17 13:11:55 -07:00
Sam Lantinga 529ed53b16 Fixed bug 2681 - dereference a NULL pointer dst_fmt in SDL_CreateTextureFromSurface function
Nitz

In SDL_CreateTextureFromSurface:

SDL_PixelFormat *dst_fmt;
/* Set up a destination surface for the texture update */
         dst_fmt = SDL_AllocFormat(format);
            temp = SDL_ConvertSurface(surface, dst_fmt, 0);

Here is need of NULL check for dst_fmt because there are chances of NULL return from SDL_AllocFormat(format);
2014-08-16 23:30:44 -07:00
Sam Lantinga 8272ed1819 Fixed bug 2687 - SDL_BlitScaled does not handle clipping correctly
Patch from Benoit Pierre:

video: fix clipping handling in SDL_UpperBlitScaled

- honor destination clipping rectangle
- update both destination and source rectangles when clipping source
  rectangle to source surface and destination rectangle to destination
  clip rectangle
- don't change scaling factors when clipping

N.B.:

- when no scaling is involved (source and destination width/height are
  the same), SDL_UpperBlit is used (so SDL_BlitScaled behaves like
  SDL_BlitSurface)
- the final destination rectangle after all clipping is performed is
  saved back to dstrect (like for SDL_UpperBlit)
2014-08-16 23:25:02 -07:00
Sam Lantinga 4e7db78ed9 Added SDL_round(), contributed by Benoit Pierre - thanks! 2014-08-16 23:23:15 -07:00
Sam Lantinga d673d8c389 Fixed bugs 2677 and 2625, made it possible to lock render targets in D3D 2014-08-16 23:17:47 -07:00
Ryan C. Gordon e2bbc17d11 Haptic: Fix clamping bugs on Windows, by using the Darwin haptics code.
Thanks, Elias!

Partially fixes Bugzilla #2686.
2014-08-16 16:49:00 -04:00
Ryan C. Gordon 57db27909b Haptic: Fix the saturation and deadband parameters' available range.
There was a misconception that Linux's saturation and deadband parameters -
on which the corresponding SDL parameters were based - use only half of the
possible range.

Thanks, Elias!

Partially fixes Bugzilla #2686.
2014-08-16 16:47:42 -04:00
Ryan C. Gordon a2622ce6e0 Haptic: Explicitly avoid floating point arithmetic if it's not needed.
Thanks, Elias!

Partially fixes Bugzilla #2686.
2014-08-16 16:42:55 -04:00
Ryan C. Gordon 1db581b4ca Haptic: DInput's POLAR direction actually matches Linux's direction.
Thanks, Elias!

Partially fixes Bugzilla #2686.
2014-08-16 16:41:25 -04:00
Ryan C. Gordon 3e27013b98 Haptic: Don't interpret a direction of polar 35999 as "unsupported type".
(or linux-direction 0xFFFF)

Thanks, Elias!

Partially fixes Bugzilla #2686.
2014-08-16 16:40:01 -04:00
Sam Lantinga c6a2382c66 Take advantage of GL_ARB_texture_non_power_of_two when it's available 2014-08-14 21:31:50 -07:00
Philipp Wiesemann 2c1faa40eb Fixed warnings about unused local variables. 2014-08-12 23:37:12 +02:00
Sam Lantinga 05d8780022 Implemented SDL_GetPrefPath() on Android - it returns the path used by SDL_AndroidGetInternalStoragePath() 2014-08-11 17:25:53 -07:00
Sam Lantinga 4fe43f408b Added an entry for the new Steam controller XInput emulation mode 2014-08-11 17:24:54 -07:00
Philipp Wiesemann a9d4a6b81a Fixed typo in source comment. 2014-08-11 23:18:35 +02:00
David Ludwig ff5caa1721 WinRT build fix for ARM platforms
The _xgetbv intrinsic was being used in ARM builds of SDL/WinRT, which was
leading to linker errors.  This commit limits _xgetbv use to the platforms on
which it is available, x86 and x64.
2014-08-10 22:21:21 -04:00
Sam Lantinga 6fef39d6b8 Added NV12 and NV21 texture support for OpenGL and OpenGL ES 2.0 renderers 2014-08-06 11:34:54 -07:00
Sam Lantinga 6299daecba The OpenGL context returned by the UIKit backend is now an actual OpenGL context instead of the OpenGL view we created.
This allows you to use the returned context in functions like CVOpenGLESTextureCacheCreate()
2014-08-06 00:28:02 -07:00
Alfred Reynolds 87b8c8d108 SDL - when raising the window under OSX also force the app to activate. This fixes a fullscreen window on a separate space not coming front when raisewindow is called. 2014-07-31 12:46:23 -07:00
Alfred Reynolds 7552947654 SDL - fix re-entrancy into SDL_UpdateFullscreenMode under OSX. During HideWindow we get a RESTORED event which then turns fullscreen back on causing a hang in Cocoa_SetWindowFullscreenSpace waiting for the fullscreen transition to finish. 2014-07-30 17:45:52 -07:00
Ryan C. Gordon c0f9a57f71 Fixed comment typo. 2014-07-30 14:12:54 -04:00
Ryan C. Gordon c5b21ea6c1 SDL_GetQueuedAudioSize() shouldn't grab lock when not set up for queueing. 2014-07-30 11:11:48 -04:00
Ryan C. Gordon e5d49c2033 Added a GetPendingBytes method to the audio backend.
This will (eventually) make SDL_GetQueuedAudioSize() more accurate, and thus
reduce latency. Right now this isn't implemented anywhere, so we assume data
fed to the audio callback is consumed by the hardware and immediately played
to completion.
2014-07-30 11:08:31 -04:00
Ryan C. Gordon db1dd7560e XAudio2: Use XAUDIO2_VOICE_NOSAMPLESPLAYED when possible.
For versions of XAudio2 with an IXAudio2SourceVoice::GetState() that offers a
flags parameter, we can use XAUDIO2_VOICE_NOSAMPLESPLAYED, since we don't
need this information in our current calls. According to MSDN, this makes the
the call about 3x faster.
2014-07-30 09:54:01 -04:00
Ryan C. Gordon 2230df5525 Remove dependency on C runtime from Windows SDLmain. 2014-07-27 19:52:52 -04:00
Sam Lantinga a0b68e817d Fixed bug 2537 - _allmul in SDL_lib.c is not working properly 2014-07-27 17:44:10 -07:00
Sam Lantinga 5c6c86912d Fixed uninitialized variable in some cases 2014-07-27 17:43:36 -07:00
Ryan C. Gordon f30e120aa9 Added audio device buffer queueing API. 2014-07-22 21:41:49 -04:00
Sam Lantinga dfc7535ff7 Fixed bug 2657 - Memory leak in GL_CreateTexture function
Nitz

In GL_CreateTexture function:

if (GL_CheckError("glGenTexures()", renderer) < 0) {
        SDL_free(data);
        return -1;
    }

Here only data is getting free but data->pixels getting leak.
So have to free data->pixels before free data.
2014-07-26 16:52:26 -07:00
Ryan C. Gordon 987c335551 Clarifying hard-to-understand piece of code. 2014-07-22 23:12:21 -04:00
Brandon Schaefer 75dacdb99b Dont redeclare DBusMessage* msg; 2014-07-18 14:10:45 -07:00
Sam Lantinga 96b613eab3 Fixed bug 2640 - Unable to SDL_SetRenderTarget to original surface for software renderer without a window
Damian Kaczmarek

Basically this bug is probably not a common use case. My goal is to allow rendering totally without a window, for example to a screenshot and I need to rely on SDL_SetRenderTarget to properly work for a purely software renderer created by SDL_CreateSoftwareRenderer.
2014-07-13 09:04:55 -07:00
Sam Lantinga fd1da994fa Fixed bug 2639 - SDL_BLENDMODE_BLEND not working properly for software renderer, thanks to Melker Narikka 2014-07-12 16:21:56 -07:00
Sam Lantinga d1ca658c45 Fixed bug 2638 - (Signed) Can't create signed apps in Android
Pablo Mayobre

When generating a signed app with SDL 2.0.3 an issue comes up, watching at the Error Log points out that the issue lies in the src/main/android/SDL_android_main.c where the process name is defined as "SDL_app", this name turns into an erroneous name so it should be changed to "app_process"
2014-07-12 13:05:41 -07:00
Sam Lantinga 454c4a019f Fixed Visual Studio 2010 build 2014-07-11 22:15:34 -07:00
Sam Lantinga 6a1011ae6d Fixed build for arm platforms 2014-07-11 22:14:14 -07:00