From f91914c0cf264f6b3d31f93e1ed92064d0547d30 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Fri, 18 Mar 2016 22:33:50 -0300 Subject: [PATCH] Updated SDL to the latest hg revision. --- CMakeLists.txt | 2 +- libs/SDL2/.hg_archival.txt | 6 +- libs/SDL2/.hgignore | 2 + libs/SDL2/.hgtags | 1 + libs/SDL2/CMakeLists.txt | 87 ++- libs/SDL2/COPYING.txt | 2 +- libs/SDL2/Makefile.psp | 1 + libs/SDL2/README-SDL.txt | 4 +- libs/SDL2/VisualC.html | 4 +- libs/SDL2/WhatsNew.txt | 6 +- .../SDL/SDL.xcodeproj/project.pbxproj | 10 +- libs/SDL2/Xcode-iOS/Test/README | 11 - .../SDL/pkg-support/resources/License.txt | 2 +- .../src/org/libsdl/app/SDLActivity.java | 19 +- libs/SDL2/build-scripts/checker-buildbot.sh | 6 +- libs/SDL2/build-scripts/update-copyright.sh | 2 +- libs/SDL2/cmake/sdlchecks.cmake | 1 - libs/SDL2/configure | 77 ++- libs/SDL2/configure.in | 53 +- libs/SDL2/debian/changelog | 6 + libs/SDL2/debian/copyright | 23 +- libs/SDL2/debian/libsdl2-dev.install | 1 + libs/SDL2/docs/README-android.md | 12 +- libs/SDL2/docs/README-ios.md | 42 +- libs/SDL2/docs/README-macosx.md | 2 +- libs/SDL2/docs/README-raspberrypi.md | 2 +- libs/SDL2/include/SDL.h | 2 +- libs/SDL2/include/SDL_assert.h | 2 +- libs/SDL2/include/SDL_atomic.h | 2 +- libs/SDL2/include/SDL_audio.h | 2 +- libs/SDL2/include/SDL_bits.h | 2 +- libs/SDL2/include/SDL_blendmode.h | 2 +- libs/SDL2/include/SDL_clipboard.h | 2 +- libs/SDL2/include/SDL_config.h | 2 +- libs/SDL2/include/SDL_config.h.cmake | 2 +- libs/SDL2/include/SDL_config.h.in | 2 +- libs/SDL2/include/SDL_config_android.h | 2 +- libs/SDL2/include/SDL_config_iphoneos.h | 2 +- libs/SDL2/include/SDL_config_macosx.h | 2 +- libs/SDL2/include/SDL_config_minimal.h | 2 +- libs/SDL2/include/SDL_config_pandora.h | 2 +- libs/SDL2/include/SDL_config_psp.h | 2 +- libs/SDL2/include/SDL_config_windows.h | 2 +- libs/SDL2/include/SDL_config_winrt.h | 2 +- libs/SDL2/include/SDL_config_wiz.h | 2 +- libs/SDL2/include/SDL_copying.h | 2 +- libs/SDL2/include/SDL_cpuinfo.h | 2 +- libs/SDL2/include/SDL_egl.h | 2 +- libs/SDL2/include/SDL_endian.h | 2 +- libs/SDL2/include/SDL_error.h | 2 +- libs/SDL2/include/SDL_events.h | 10 +- libs/SDL2/include/SDL_filesystem.h | 2 +- libs/SDL2/include/SDL_gamecontroller.h | 2 +- libs/SDL2/include/SDL_gesture.h | 2 +- libs/SDL2/include/SDL_haptic.h | 2 +- libs/SDL2/include/SDL_hints.h | 2 +- libs/SDL2/include/SDL_joystick.h | 2 +- libs/SDL2/include/SDL_keyboard.h | 2 +- libs/SDL2/include/SDL_keycode.h | 2 +- libs/SDL2/include/SDL_loadso.h | 2 +- libs/SDL2/include/SDL_log.h | 2 +- libs/SDL2/include/SDL_main.h | 2 +- libs/SDL2/include/SDL_messagebox.h | 2 +- libs/SDL2/include/SDL_mouse.h | 2 +- libs/SDL2/include/SDL_mutex.h | 2 +- libs/SDL2/include/SDL_name.h | 2 +- libs/SDL2/include/SDL_opengl.h | 2 +- libs/SDL2/include/SDL_opengles.h | 2 +- libs/SDL2/include/SDL_opengles2.h | 2 +- libs/SDL2/include/SDL_pixels.h | 2 +- libs/SDL2/include/SDL_platform.h | 2 +- libs/SDL2/include/SDL_power.h | 2 +- libs/SDL2/include/SDL_quit.h | 2 +- libs/SDL2/include/SDL_rect.h | 2 +- libs/SDL2/include/SDL_render.h | 28 +- libs/SDL2/include/SDL_rwops.h | 2 +- libs/SDL2/include/SDL_scancode.h | 2 +- libs/SDL2/include/SDL_shape.h | 2 +- libs/SDL2/include/SDL_stdinc.h | 2 +- libs/SDL2/include/SDL_surface.h | 2 +- libs/SDL2/include/SDL_system.h | 2 +- libs/SDL2/include/SDL_syswm.h | 24 +- libs/SDL2/include/SDL_test.h | 2 +- libs/SDL2/include/SDL_test_assert.h | 2 +- libs/SDL2/include/SDL_test_common.h | 2 +- libs/SDL2/include/SDL_test_compare.h | 2 +- libs/SDL2/include/SDL_test_crc32.h | 2 +- libs/SDL2/include/SDL_test_font.h | 2 +- libs/SDL2/include/SDL_test_fuzzer.h | 2 +- libs/SDL2/include/SDL_test_harness.h | 2 +- libs/SDL2/include/SDL_test_images.h | 2 +- libs/SDL2/include/SDL_test_log.h | 2 +- libs/SDL2/include/SDL_test_md5.h | 2 +- libs/SDL2/include/SDL_test_random.h | 2 +- libs/SDL2/include/SDL_thread.h | 2 +- libs/SDL2/include/SDL_timer.h | 2 +- libs/SDL2/include/SDL_touch.h | 2 +- libs/SDL2/include/SDL_types.h | 2 +- libs/SDL2/include/SDL_version.h | 2 +- libs/SDL2/include/SDL_video.h | 164 +++++- libs/SDL2/include/begin_code.h | 2 +- libs/SDL2/include/close_code.h | 2 +- libs/SDL2/premake/Linux/SDL_config_premake.h | 2 +- libs/SDL2/premake/MinGW/SDL_config_premake.h | 2 +- .../VisualC/VS2008/SDL_config_premake.h | 2 +- .../VisualC/VS2010/SDL_config_premake.h | 2 +- .../VisualC/VS2012/SDL_config_premake.h | 2 +- .../premake/Xcode-iOS/SDL_config_premake.h | 2 +- .../premake/Xcode/Xcode3/SDL_config_premake.h | 2 +- .../premake/Xcode/Xcode4/SDL_config_premake.h | 2 +- .../config/SDL_config_cygwin.template.h | 2 +- .../config/SDL_config_iphoneos.template.h | 2 +- .../config/SDL_config_linux.template.h | 2 +- .../config/SDL_config_macosx.template.h | 2 +- .../config/SDL_config_minimal.template.h | 2 +- .../config/SDL_config_windows.template.h | 2 +- libs/SDL2/premake/premake4.lua | 2 +- libs/SDL2/premake/projects/SDL2.lua | 2 +- libs/SDL2/premake/projects/SDL2main.lua | 2 +- libs/SDL2/premake/projects/SDL2test.lua | 2 +- libs/SDL2/premake/projects/accelerometer.lua | 2 +- libs/SDL2/premake/projects/checkkeys.lua | 2 +- libs/SDL2/premake/projects/fireworks.lua | 2 +- libs/SDL2/premake/projects/happy.lua | 2 +- libs/SDL2/premake/projects/keyboard.lua | 2 +- libs/SDL2/premake/projects/loopwave.lua | 2 +- libs/SDL2/premake/projects/mixer.lua | 2 +- libs/SDL2/premake/projects/rectangles.lua | 2 +- libs/SDL2/premake/projects/testatomic.lua | 2 +- libs/SDL2/premake/projects/testaudioinfo.lua | 2 +- libs/SDL2/premake/projects/testautomation.lua | 2 +- libs/SDL2/premake/projects/testdraw2.lua | 2 +- .../premake/projects/testdrawchessboard.lua | 2 +- libs/SDL2/premake/projects/testerror.lua | 2 +- libs/SDL2/premake/projects/testfile.lua | 2 +- libs/SDL2/premake/projects/testfilesystem.lua | 2 +- .../premake/projects/testgamecontroller.lua | 2 +- libs/SDL2/premake/projects/testgesture.lua | 2 +- libs/SDL2/premake/projects/testgl2.lua | 2 +- libs/SDL2/premake/projects/testgles.lua | 2 +- libs/SDL2/premake/projects/testhaptic.lua | 2 +- libs/SDL2/premake/projects/testiconv.lua | 2 +- libs/SDL2/premake/projects/testime.lua | 2 +- .../premake/projects/testintersection.lua | 2 +- libs/SDL2/premake/projects/testjoystick.lua | 2 +- libs/SDL2/premake/projects/testkeys.lua | 2 +- libs/SDL2/premake/projects/testloadso.lua | 2 +- libs/SDL2/premake/projects/testlock.lua | 2 +- libs/SDL2/premake/projects/testmessage.lua | 2 +- libs/SDL2/premake/projects/testmultiaudio.lua | 2 +- libs/SDL2/premake/projects/testnative.lua | 2 +- libs/SDL2/premake/projects/testoverlay2.lua | 2 +- libs/SDL2/premake/projects/testplatform.lua | 2 +- libs/SDL2/premake/projects/testpower.lua | 2 +- libs/SDL2/premake/projects/testrelative.lua | 2 +- .../premake/projects/testrendercopyex.lua | 2 +- .../premake/projects/testrendertarget.lua | 2 +- libs/SDL2/premake/projects/testresample.lua | 2 +- libs/SDL2/premake/projects/testrumble.lua | 2 +- libs/SDL2/premake/projects/testscale.lua | 2 +- libs/SDL2/premake/projects/testsem.lua | 2 +- libs/SDL2/premake/projects/testshader.lua | 2 +- libs/SDL2/premake/projects/testshape.lua | 2 +- libs/SDL2/premake/projects/testsprite2.lua | 2 +- .../premake/projects/testspriteminimal.lua | 2 +- libs/SDL2/premake/projects/teststreaming.lua | 2 +- libs/SDL2/premake/projects/testthread.lua | 2 +- libs/SDL2/premake/projects/testtimer.lua | 2 +- libs/SDL2/premake/projects/testver.lua | 2 +- libs/SDL2/premake/projects/testwm2.lua | 2 +- libs/SDL2/premake/projects/torturethread.lua | 2 +- libs/SDL2/premake/projects/touch.lua | 2 +- libs/SDL2/premake/util/sdl_check_compile.lua | 2 +- .../premake/util/sdl_dependency_checkers.lua | 2 +- libs/SDL2/premake/util/sdl_depends.lua | 2 +- libs/SDL2/premake/util/sdl_file.lua | 2 +- libs/SDL2/premake/util/sdl_gen_config.lua | 2 +- libs/SDL2/premake/util/sdl_projects.lua | 2 +- libs/SDL2/premake/util/sdl_string.lua | 2 +- libs/SDL2/src/SDL.c | 2 +- libs/SDL2/src/SDL_assert.c | 2 +- libs/SDL2/src/SDL_assert_c.h | 2 +- libs/SDL2/src/SDL_error.c | 2 +- libs/SDL2/src/SDL_error_c.h | 2 +- libs/SDL2/src/SDL_hints.c | 2 +- libs/SDL2/src/SDL_internal.h | 2 +- libs/SDL2/src/SDL_log.c | 2 +- libs/SDL2/src/atomic/SDL_atomic.c | 2 +- libs/SDL2/src/atomic/SDL_spinlock.c | 2 +- libs/SDL2/src/audio/SDL_audio.c | 2 +- libs/SDL2/src/audio/SDL_audio_c.h | 2 +- libs/SDL2/src/audio/SDL_audiocvt.c | 2 +- libs/SDL2/src/audio/SDL_audiodev.c | 2 +- libs/SDL2/src/audio/SDL_audiodev_c.h | 2 +- libs/SDL2/src/audio/SDL_audiomem.h | 2 +- libs/SDL2/src/audio/SDL_audiotypecvt.c | 2 +- libs/SDL2/src/audio/SDL_mixer.c | 2 +- libs/SDL2/src/audio/SDL_sysaudio.h | 2 +- libs/SDL2/src/audio/SDL_wave.c | 2 +- libs/SDL2/src/audio/SDL_wave.h | 2 +- libs/SDL2/src/audio/alsa/SDL_alsa_audio.c | 119 ++++- libs/SDL2/src/audio/alsa/SDL_alsa_audio.h | 2 +- .../SDL2/src/audio/android/SDL_androidaudio.c | 2 +- .../SDL2/src/audio/android/SDL_androidaudio.h | 2 +- libs/SDL2/src/audio/arts/SDL_artsaudio.c | 2 +- libs/SDL2/src/audio/arts/SDL_artsaudio.h | 2 +- libs/SDL2/src/audio/bsd/SDL_bsdaudio.c | 2 +- libs/SDL2/src/audio/bsd/SDL_bsdaudio.h | 2 +- libs/SDL2/src/audio/coreaudio/SDL_coreaudio.c | 2 +- libs/SDL2/src/audio/coreaudio/SDL_coreaudio.h | 2 +- .../src/audio/directsound/SDL_directsound.c | 2 +- .../src/audio/directsound/SDL_directsound.h | 2 +- libs/SDL2/src/audio/disk/SDL_diskaudio.c | 2 +- libs/SDL2/src/audio/disk/SDL_diskaudio.h | 2 +- libs/SDL2/src/audio/dsp/SDL_dspaudio.c | 2 +- libs/SDL2/src/audio/dsp/SDL_dspaudio.h | 2 +- libs/SDL2/src/audio/dummy/SDL_dummyaudio.c | 2 +- libs/SDL2/src/audio/dummy/SDL_dummyaudio.h | 2 +- .../audio/emscripten/SDL_emscriptenaudio.c | 2 +- .../audio/emscripten/SDL_emscriptenaudio.h | 2 +- libs/SDL2/src/audio/esd/SDL_esdaudio.c | 2 +- libs/SDL2/src/audio/esd/SDL_esdaudio.h | 2 +- libs/SDL2/src/audio/fusionsound/SDL_fsaudio.c | 2 +- libs/SDL2/src/audio/fusionsound/SDL_fsaudio.h | 2 +- libs/SDL2/src/audio/haiku/SDL_haikuaudio.cc | 2 +- libs/SDL2/src/audio/haiku/SDL_haikuaudio.h | 2 +- libs/SDL2/src/audio/nacl/SDL_naclaudio.c | 2 +- libs/SDL2/src/audio/nacl/SDL_naclaudio.h | 2 +- libs/SDL2/src/audio/nas/SDL_nasaudio.c | 2 +- libs/SDL2/src/audio/nas/SDL_nasaudio.h | 2 +- libs/SDL2/src/audio/paudio/SDL_paudio.c | 2 +- libs/SDL2/src/audio/paudio/SDL_paudio.h | 2 +- libs/SDL2/src/audio/psp/SDL_pspaudio.c | 17 +- libs/SDL2/src/audio/psp/SDL_pspaudio.h | 2 +- .../src/audio/pulseaudio/SDL_pulseaudio.c | 2 +- .../src/audio/pulseaudio/SDL_pulseaudio.h | 2 +- libs/SDL2/src/audio/qsa/SDL_qsa_audio.c | 2 +- libs/SDL2/src/audio/qsa/SDL_qsa_audio.h | 2 +- libs/SDL2/src/audio/sdlgenaudiocvt.pl | 2 +- libs/SDL2/src/audio/sndio/SDL_sndioaudio.c | 2 +- libs/SDL2/src/audio/sndio/SDL_sndioaudio.h | 2 +- libs/SDL2/src/audio/sun/SDL_sunaudio.c | 2 +- libs/SDL2/src/audio/sun/SDL_sunaudio.h | 2 +- libs/SDL2/src/audio/winmm/SDL_winmm.c | 2 +- libs/SDL2/src/audio/winmm/SDL_winmm.h | 2 +- libs/SDL2/src/audio/xaudio2/SDL_xaudio2.c | 2 +- libs/SDL2/src/audio/xaudio2/SDL_xaudio2.h | 2 +- .../xaudio2/SDL_xaudio2_winrthelpers.cpp | 2 +- .../audio/xaudio2/SDL_xaudio2_winrthelpers.h | 2 +- libs/SDL2/src/core/android/SDL_android.c | 180 ++++--- libs/SDL2/src/core/android/SDL_android.h | 2 +- libs/SDL2/src/core/linux/SDL_dbus.c | 2 +- libs/SDL2/src/core/linux/SDL_dbus.h | 2 +- libs/SDL2/src/core/linux/SDL_evdev.c | 2 +- libs/SDL2/src/core/linux/SDL_evdev.h | 2 +- libs/SDL2/src/core/linux/SDL_ibus.c | 2 +- libs/SDL2/src/core/linux/SDL_ibus.h | 2 +- libs/SDL2/src/core/linux/SDL_udev.c | 2 +- libs/SDL2/src/core/linux/SDL_udev.h | 2 +- libs/SDL2/src/core/windows/SDL_directx.h | 2 +- libs/SDL2/src/core/windows/SDL_windows.c | 2 +- libs/SDL2/src/core/windows/SDL_windows.h | 2 +- libs/SDL2/src/core/windows/SDL_xinput.c | 2 +- libs/SDL2/src/core/windows/SDL_xinput.h | 2 +- .../src/core/winrt/SDL_winrtapp_common.cpp | 2 +- .../SDL2/src/core/winrt/SDL_winrtapp_common.h | 2 +- .../src/core/winrt/SDL_winrtapp_direct3d.cpp | 2 +- .../src/core/winrt/SDL_winrtapp_direct3d.h | 2 +- .../SDL2/src/core/winrt/SDL_winrtapp_xaml.cpp | 2 +- libs/SDL2/src/core/winrt/SDL_winrtapp_xaml.h | 2 +- libs/SDL2/src/cpuinfo/SDL_cpuinfo.c | 2 +- libs/SDL2/src/dynapi/SDL_dynapi.c | 4 +- libs/SDL2/src/dynapi/SDL_dynapi.h | 4 +- libs/SDL2/src/dynapi/SDL_dynapi_overrides.h | 10 +- libs/SDL2/src/dynapi/SDL_dynapi_procs.h | 10 +- libs/SDL2/src/dynapi/gendynapi.pl | 2 +- libs/SDL2/src/events/SDL_clipboardevents.c | 2 +- libs/SDL2/src/events/SDL_clipboardevents_c.h | 2 +- libs/SDL2/src/events/SDL_dropevents.c | 70 ++- libs/SDL2/src/events/SDL_dropevents_c.h | 6 +- libs/SDL2/src/events/SDL_events.c | 113 ++-- libs/SDL2/src/events/SDL_events_c.h | 2 +- libs/SDL2/src/events/SDL_gesture.c | 2 +- libs/SDL2/src/events/SDL_gesture_c.h | 2 +- libs/SDL2/src/events/SDL_keyboard.c | 2 +- libs/SDL2/src/events/SDL_keyboard_c.h | 2 +- libs/SDL2/src/events/SDL_mouse.c | 2 +- libs/SDL2/src/events/SDL_mouse_c.h | 2 +- libs/SDL2/src/events/SDL_quit.c | 2 +- libs/SDL2/src/events/SDL_sysevents.h | 2 +- libs/SDL2/src/events/SDL_touch.c | 2 +- libs/SDL2/src/events/SDL_touch_c.h | 2 +- libs/SDL2/src/events/SDL_windowevents.c | 2 +- libs/SDL2/src/events/SDL_windowevents_c.h | 2 +- libs/SDL2/src/events/blank_cursor.h | 2 +- libs/SDL2/src/events/default_cursor.h | 2 +- libs/SDL2/src/events/scancodes_darwin.h | 2 +- libs/SDL2/src/events/scancodes_linux.h | 2 +- libs/SDL2/src/events/scancodes_windows.h | 2 +- libs/SDL2/src/events/scancodes_xfree86.h | 2 +- libs/SDL2/src/file/SDL_rwops.c | 2 +- .../src/file/cocoa/SDL_rwopsbundlesupport.h | 2 +- .../src/file/cocoa/SDL_rwopsbundlesupport.m | 2 +- .../filesystem/android/SDL_sysfilesystem.c | 2 +- .../src/filesystem/cocoa/SDL_sysfilesystem.m | 2 +- .../src/filesystem/dummy/SDL_sysfilesystem.c | 2 +- .../filesystem/emscripten/SDL_sysfilesystem.c | 2 +- .../src/filesystem/haiku/SDL_sysfilesystem.cc | 2 +- .../src/filesystem/nacl/SDL_sysfilesystem.c | 2 +- .../src/filesystem/unix/SDL_sysfilesystem.c | 25 +- .../filesystem/windows/SDL_sysfilesystem.c | 2 +- .../filesystem/winrt/SDL_sysfilesystem.cpp | 2 +- libs/SDL2/src/haptic/SDL_haptic.c | 2 +- libs/SDL2/src/haptic/SDL_haptic_c.h | 2 +- libs/SDL2/src/haptic/SDL_syshaptic.h | 2 +- libs/SDL2/src/haptic/darwin/SDL_syshaptic.c | 2 +- libs/SDL2/src/haptic/darwin/SDL_syshaptic_c.h | 2 +- libs/SDL2/src/haptic/dummy/SDL_syshaptic.c | 2 +- libs/SDL2/src/haptic/linux/SDL_syshaptic.c | 4 +- .../src/haptic/windows/SDL_dinputhaptic.c | 2 +- .../src/haptic/windows/SDL_dinputhaptic_c.h | 2 +- .../src/haptic/windows/SDL_windowshaptic.c | 4 +- .../src/haptic/windows/SDL_windowshaptic_c.h | 6 +- .../src/haptic/windows/SDL_xinputhaptic.c | 6 +- .../src/haptic/windows/SDL_xinputhaptic_c.h | 2 +- libs/SDL2/src/joystick/SDL_gamecontroller.c | 3 +- libs/SDL2/src/joystick/SDL_gamecontrollerdb.h | 9 +- libs/SDL2/src/joystick/SDL_joystick.c | 2 +- libs/SDL2/src/joystick/SDL_joystick_c.h | 2 +- libs/SDL2/src/joystick/SDL_sysjoystick.h | 2 +- .../src/joystick/android/SDL_sysjoystick.c | 5 +- .../src/joystick/android/SDL_sysjoystick_c.h | 38 +- libs/SDL2/src/joystick/bsd/SDL_sysjoystick.c | 2 +- .../src/joystick/darwin/SDL_sysjoystick.c | 2 +- .../src/joystick/darwin/SDL_sysjoystick_c.h | 2 +- .../SDL2/src/joystick/dummy/SDL_sysjoystick.c | 2 +- .../src/joystick/emscripten/SDL_sysjoystick.c | 2 +- .../joystick/emscripten/SDL_sysjoystick_c.h | 32 +- .../src/joystick/haiku/SDL_haikujoystick.cc | 2 +- .../src/joystick/iphoneos/SDL_sysjoystick.m | 2 +- .../src/joystick/iphoneos/SDL_sysjoystick_c.h | 2 +- .../SDL2/src/joystick/linux/SDL_sysjoystick.c | 2 +- .../src/joystick/linux/SDL_sysjoystick_c.h | 2 +- libs/SDL2/src/joystick/psp/SDL_sysjoystick.c | 2 +- .../src/joystick/windows/SDL_dinputjoystick.c | 2 +- .../joystick/windows/SDL_dinputjoystick_c.h | 2 +- .../src/joystick/windows/SDL_mmjoystick.c | 2 +- .../joystick/windows/SDL_windowsjoystick.c | 2 +- .../joystick/windows/SDL_windowsjoystick_c.h | 2 +- .../src/joystick/windows/SDL_xinputjoystick.c | 4 +- .../joystick/windows/SDL_xinputjoystick_c.h | 2 +- libs/SDL2/src/libm/math_libm.h | 2 +- libs/SDL2/src/loadso/dlopen/SDL_sysloadso.c | 2 +- libs/SDL2/src/loadso/dummy/SDL_sysloadso.c | 2 +- libs/SDL2/src/loadso/haiku/SDL_sysloadso.c | 2 +- libs/SDL2/src/loadso/windows/SDL_sysloadso.c | 2 +- libs/SDL2/src/main/android/SDL_android_main.c | 8 +- libs/SDL2/src/main/haiku/SDL_BApp.h | 2 +- libs/SDL2/src/main/haiku/SDL_BeApp.cc | 2 +- libs/SDL2/src/main/haiku/SDL_BeApp.h | 2 +- libs/SDL2/src/main/nacl/SDL_nacl_main.c | 2 +- libs/SDL2/src/main/windows/version.rc | 2 +- libs/SDL2/src/power/SDL_power.c | 2 +- libs/SDL2/src/power/android/SDL_syspower.c | 2 +- libs/SDL2/src/power/emscripten/SDL_syspower.c | 2 +- libs/SDL2/src/power/haiku/SDL_syspower.c | 2 +- libs/SDL2/src/power/linux/SDL_syspower.c | 2 +- libs/SDL2/src/power/macosx/SDL_syspower.c | 2 +- libs/SDL2/src/power/psp/SDL_syspower.c | 2 +- libs/SDL2/src/power/uikit/SDL_syspower.h | 2 +- libs/SDL2/src/power/uikit/SDL_syspower.m | 2 +- libs/SDL2/src/power/windows/SDL_syspower.c | 2 +- libs/SDL2/src/power/winrt/SDL_syspower.cpp | 2 +- libs/SDL2/src/render/SDL_d3dmath.c | 2 +- libs/SDL2/src/render/SDL_d3dmath.h | 2 +- libs/SDL2/src/render/SDL_render.c | 34 +- libs/SDL2/src/render/SDL_sysrender.h | 5 +- libs/SDL2/src/render/SDL_yuv_mmx.c | 2 +- libs/SDL2/src/render/SDL_yuv_sw.c | 2 +- libs/SDL2/src/render/SDL_yuv_sw_c.h | 2 +- .../SDL2/src/render/direct3d/SDL_render_d3d.c | 2 +- .../src/render/direct3d11/SDL_render_d3d11.c | 2 +- .../render/direct3d11/SDL_render_winrt.cpp | 2 +- .../src/render/direct3d11/SDL_render_winrt.h | 2 +- libs/SDL2/src/render/opengl/SDL_glfuncs.h | 2 +- libs/SDL2/src/render/opengl/SDL_render_gl.c | 2 +- libs/SDL2/src/render/opengl/SDL_shaders_gl.c | 2 +- libs/SDL2/src/render/opengl/SDL_shaders_gl.h | 2 +- libs/SDL2/src/render/opengles/SDL_glesfuncs.h | 2 +- .../src/render/opengles/SDL_render_gles.c | 2 +- .../src/render/opengles2/SDL_gles2funcs.h | 2 +- .../src/render/opengles2/SDL_render_gles2.c | 2 +- .../src/render/opengles2/SDL_shaders_gles2.c | 2 +- .../src/render/opengles2/SDL_shaders_gles2.h | 2 +- libs/SDL2/src/render/psp/SDL_render_psp.c | 2 +- .../src/render/software/SDL_blendfillrect.c | 2 +- .../src/render/software/SDL_blendfillrect.h | 2 +- libs/SDL2/src/render/software/SDL_blendline.c | 2 +- libs/SDL2/src/render/software/SDL_blendline.h | 2 +- .../SDL2/src/render/software/SDL_blendpoint.c | 2 +- .../SDL2/src/render/software/SDL_blendpoint.h | 2 +- libs/SDL2/src/render/software/SDL_draw.h | 2 +- libs/SDL2/src/render/software/SDL_drawline.c | 2 +- libs/SDL2/src/render/software/SDL_drawline.h | 2 +- libs/SDL2/src/render/software/SDL_drawpoint.c | 2 +- libs/SDL2/src/render/software/SDL_drawpoint.h | 2 +- libs/SDL2/src/render/software/SDL_render_sw.c | 2 +- .../src/render/software/SDL_render_sw_c.h | 2 +- libs/SDL2/src/render/software/SDL_rotate.h | 2 +- libs/SDL2/src/stdlib/SDL_getenv.c | 2 +- libs/SDL2/src/stdlib/SDL_iconv.c | 2 +- libs/SDL2/src/stdlib/SDL_malloc.c | 2 +- libs/SDL2/src/stdlib/SDL_qsort.c | 481 +++++++++-------- libs/SDL2/src/stdlib/SDL_stdlib.c | 2 +- libs/SDL2/src/stdlib/SDL_string.c | 2 +- libs/SDL2/src/test/SDL_test_assert.c | 2 +- libs/SDL2/src/test/SDL_test_common.c | 20 +- libs/SDL2/src/test/SDL_test_compare.c | 4 +- libs/SDL2/src/test/SDL_test_crc32.c | 2 +- libs/SDL2/src/test/SDL_test_font.c | 2 +- libs/SDL2/src/test/SDL_test_fuzzer.c | 2 +- libs/SDL2/src/test/SDL_test_harness.c | 2 +- libs/SDL2/src/test/SDL_test_imageBlit.c | 2 +- libs/SDL2/src/test/SDL_test_imageBlitBlend.c | 2 +- libs/SDL2/src/test/SDL_test_imageFace.c | 2 +- libs/SDL2/src/test/SDL_test_imagePrimitives.c | 2 +- .../src/test/SDL_test_imagePrimitivesBlend.c | 2 +- libs/SDL2/src/test/SDL_test_log.c | 2 +- libs/SDL2/src/test/SDL_test_md5.c | 2 +- libs/SDL2/src/test/SDL_test_random.c | 2 +- libs/SDL2/src/thread/SDL_systhread.h | 2 +- libs/SDL2/src/thread/SDL_thread.c | 2 +- libs/SDL2/src/thread/SDL_thread_c.h | 2 +- libs/SDL2/src/thread/generic/SDL_syscond.c | 2 +- libs/SDL2/src/thread/generic/SDL_sysmutex.c | 2 +- libs/SDL2/src/thread/generic/SDL_sysmutex_c.h | 2 +- libs/SDL2/src/thread/generic/SDL_syssem.c | 2 +- libs/SDL2/src/thread/generic/SDL_systhread.c | 2 +- .../SDL2/src/thread/generic/SDL_systhread_c.h | 2 +- libs/SDL2/src/thread/generic/SDL_systls.c | 2 +- libs/SDL2/src/thread/psp/SDL_syscond.c | 2 +- libs/SDL2/src/thread/psp/SDL_sysmutex.c | 2 +- libs/SDL2/src/thread/psp/SDL_sysmutex_c.h | 2 +- libs/SDL2/src/thread/psp/SDL_syssem.c | 2 +- libs/SDL2/src/thread/psp/SDL_systhread.c | 2 +- libs/SDL2/src/thread/psp/SDL_systhread_c.h | 2 +- libs/SDL2/src/thread/pthread/SDL_syscond.c | 2 +- libs/SDL2/src/thread/pthread/SDL_sysmutex.c | 2 +- libs/SDL2/src/thread/pthread/SDL_sysmutex_c.h | 2 +- libs/SDL2/src/thread/pthread/SDL_syssem.c | 2 +- libs/SDL2/src/thread/pthread/SDL_systhread.c | 2 +- .../SDL2/src/thread/pthread/SDL_systhread_c.h | 2 +- libs/SDL2/src/thread/pthread/SDL_systls.c | 2 +- libs/SDL2/src/thread/stdcpp/SDL_syscond.cpp | 2 +- libs/SDL2/src/thread/stdcpp/SDL_sysmutex.cpp | 2 +- libs/SDL2/src/thread/stdcpp/SDL_sysmutex_c.h | 2 +- libs/SDL2/src/thread/stdcpp/SDL_systhread.cpp | 2 +- libs/SDL2/src/thread/stdcpp/SDL_systhread_c.h | 2 +- libs/SDL2/src/thread/windows/SDL_sysmutex.c | 2 +- libs/SDL2/src/thread/windows/SDL_syssem.c | 2 +- libs/SDL2/src/thread/windows/SDL_systhread.c | 47 +- .../SDL2/src/thread/windows/SDL_systhread_c.h | 2 +- libs/SDL2/src/thread/windows/SDL_systls.c | 2 +- libs/SDL2/src/timer/SDL_timer.c | 45 +- libs/SDL2/src/timer/SDL_timer_c.h | 2 +- libs/SDL2/src/timer/dummy/SDL_systimer.c | 2 +- libs/SDL2/src/timer/haiku/SDL_systimer.c | 2 +- libs/SDL2/src/timer/psp/SDL_systimer.c | 2 +- libs/SDL2/src/timer/unix/SDL_systimer.c | 2 +- libs/SDL2/src/timer/windows/SDL_systimer.c | 6 +- libs/SDL2/src/video/SDL_RLEaccel.c | 2 +- libs/SDL2/src/video/SDL_RLEaccel_c.h | 2 +- libs/SDL2/src/video/SDL_blit.c | 2 +- libs/SDL2/src/video/SDL_blit.h | 2 +- libs/SDL2/src/video/SDL_blit_0.c | 2 +- libs/SDL2/src/video/SDL_blit_1.c | 2 +- libs/SDL2/src/video/SDL_blit_A.c | 2 +- libs/SDL2/src/video/SDL_blit_N.c | 2 +- libs/SDL2/src/video/SDL_blit_auto.c | 2 +- libs/SDL2/src/video/SDL_blit_auto.h | 2 +- libs/SDL2/src/video/SDL_blit_copy.c | 2 +- libs/SDL2/src/video/SDL_blit_copy.h | 2 +- libs/SDL2/src/video/SDL_blit_slow.c | 2 +- libs/SDL2/src/video/SDL_blit_slow.h | 2 +- libs/SDL2/src/video/SDL_bmp.c | 2 +- libs/SDL2/src/video/SDL_clipboard.c | 2 +- libs/SDL2/src/video/SDL_egl.c | 2 +- libs/SDL2/src/video/SDL_egl_c.h | 2 +- libs/SDL2/src/video/SDL_fillrect.c | 2 +- libs/SDL2/src/video/SDL_pixels.c | 2 +- libs/SDL2/src/video/SDL_pixels_c.h | 2 +- libs/SDL2/src/video/SDL_rect.c | 2 +- libs/SDL2/src/video/SDL_rect_c.h | 2 +- libs/SDL2/src/video/SDL_shape.c | 2 +- libs/SDL2/src/video/SDL_shape_internals.h | 2 +- libs/SDL2/src/video/SDL_stretch.c | 2 +- libs/SDL2/src/video/SDL_surface.c | 2 +- libs/SDL2/src/video/SDL_sysvideo.h | 14 +- libs/SDL2/src/video/SDL_video.c | 140 ++++- .../src/video/android/SDL_androidclipboard.c | 2 +- .../src/video/android/SDL_androidclipboard.h | 2 +- .../src/video/android/SDL_androidevents.c | 2 +- .../src/video/android/SDL_androidevents.h | 2 +- libs/SDL2/src/video/android/SDL_androidgl.c | 2 +- .../src/video/android/SDL_androidkeyboard.c | 2 +- .../src/video/android/SDL_androidkeyboard.h | 2 +- .../src/video/android/SDL_androidmessagebox.c | 2 +- .../src/video/android/SDL_androidmessagebox.h | 2 +- .../SDL2/src/video/android/SDL_androidmouse.c | 18 +- .../SDL2/src/video/android/SDL_androidmouse.h | 3 +- .../SDL2/src/video/android/SDL_androidtouch.c | 4 +- .../SDL2/src/video/android/SDL_androidtouch.h | 2 +- .../SDL2/src/video/android/SDL_androidvideo.c | 5 +- .../SDL2/src/video/android/SDL_androidvideo.h | 2 +- .../src/video/android/SDL_androidwindow.c | 2 +- .../src/video/android/SDL_androidwindow.h | 2 +- .../SDL2/src/video/cocoa/SDL_cocoaclipboard.h | 2 +- .../SDL2/src/video/cocoa/SDL_cocoaclipboard.m | 2 +- libs/SDL2/src/video/cocoa/SDL_cocoaevents.h | 2 +- libs/SDL2/src/video/cocoa/SDL_cocoaevents.m | 4 +- libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.h | 2 +- libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.m | 2 +- .../src/video/cocoa/SDL_cocoamessagebox.h | 2 +- .../src/video/cocoa/SDL_cocoamessagebox.m | 2 +- libs/SDL2/src/video/cocoa/SDL_cocoamodes.h | 4 +- libs/SDL2/src/video/cocoa/SDL_cocoamodes.m | 56 +- libs/SDL2/src/video/cocoa/SDL_cocoamouse.h | 2 +- libs/SDL2/src/video/cocoa/SDL_cocoamouse.m | 2 +- libs/SDL2/src/video/cocoa/SDL_cocoamousetap.h | 2 +- libs/SDL2/src/video/cocoa/SDL_cocoamousetap.m | 2 +- libs/SDL2/src/video/cocoa/SDL_cocoaopengl.h | 2 +- libs/SDL2/src/video/cocoa/SDL_cocoaopengl.m | 4 +- libs/SDL2/src/video/cocoa/SDL_cocoashape.h | 2 +- libs/SDL2/src/video/cocoa/SDL_cocoashape.m | 2 +- libs/SDL2/src/video/cocoa/SDL_cocoavideo.h | 2 +- libs/SDL2/src/video/cocoa/SDL_cocoavideo.m | 5 +- libs/SDL2/src/video/cocoa/SDL_cocoawindow.h | 3 +- libs/SDL2/src/video/cocoa/SDL_cocoawindow.m | 30 +- .../SDL2/src/video/directfb/SDL_DirectFB_WM.c | 2 +- .../SDL2/src/video/directfb/SDL_DirectFB_WM.h | 2 +- .../src/video/directfb/SDL_DirectFB_dyn.c | 2 +- .../src/video/directfb/SDL_DirectFB_dyn.h | 2 +- .../src/video/directfb/SDL_DirectFB_events.c | 2 +- .../src/video/directfb/SDL_DirectFB_events.h | 2 +- .../src/video/directfb/SDL_DirectFB_modes.c | 2 +- .../src/video/directfb/SDL_DirectFB_modes.h | 2 +- .../src/video/directfb/SDL_DirectFB_mouse.c | 2 +- .../src/video/directfb/SDL_DirectFB_mouse.h | 2 +- .../src/video/directfb/SDL_DirectFB_opengl.c | 2 +- .../src/video/directfb/SDL_DirectFB_opengl.h | 2 +- .../src/video/directfb/SDL_DirectFB_render.c | 2 +- .../src/video/directfb/SDL_DirectFB_render.h | 2 +- .../src/video/directfb/SDL_DirectFB_shape.c | 2 +- .../src/video/directfb/SDL_DirectFB_shape.h | 2 +- .../src/video/directfb/SDL_DirectFB_video.c | 3 +- .../src/video/directfb/SDL_DirectFB_video.h | 2 +- .../src/video/directfb/SDL_DirectFB_window.c | 15 +- .../src/video/directfb/SDL_DirectFB_window.h | 3 +- libs/SDL2/src/video/dummy/SDL_nullevents.c | 2 +- libs/SDL2/src/video/dummy/SDL_nullevents_c.h | 2 +- .../src/video/dummy/SDL_nullframebuffer.c | 2 +- .../src/video/dummy/SDL_nullframebuffer_c.h | 2 +- libs/SDL2/src/video/dummy/SDL_nullvideo.c | 2 +- libs/SDL2/src/video/dummy/SDL_nullvideo.h | 2 +- .../video/emscripten/SDL_emscriptenevents.c | 2 +- .../video/emscripten/SDL_emscriptenevents.h | 2 +- .../emscripten/SDL_emscriptenframebuffer.c | 2 +- .../emscripten/SDL_emscriptenframebuffer.h | 2 +- .../video/emscripten/SDL_emscriptenmouse.c | 6 +- .../video/emscripten/SDL_emscriptenmouse.h | 2 +- .../video/emscripten/SDL_emscriptenopengles.c | 2 +- .../video/emscripten/SDL_emscriptenopengles.h | 2 +- .../video/emscripten/SDL_emscriptenvideo.c | 2 +- .../video/emscripten/SDL_emscriptenvideo.h | 2 +- libs/SDL2/src/video/haiku/SDL_BWin.h | 2 +- libs/SDL2/src/video/haiku/SDL_bclipboard.cc | 2 +- libs/SDL2/src/video/haiku/SDL_bclipboard.h | 2 +- libs/SDL2/src/video/haiku/SDL_bevents.cc | 2 +- libs/SDL2/src/video/haiku/SDL_bevents.h | 2 +- libs/SDL2/src/video/haiku/SDL_bframebuffer.cc | 2 +- libs/SDL2/src/video/haiku/SDL_bframebuffer.h | 2 +- libs/SDL2/src/video/haiku/SDL_bkeyboard.cc | 2 +- libs/SDL2/src/video/haiku/SDL_bkeyboard.h | 2 +- libs/SDL2/src/video/haiku/SDL_bmodes.cc | 2 +- libs/SDL2/src/video/haiku/SDL_bmodes.h | 2 +- libs/SDL2/src/video/haiku/SDL_bopengl.cc | 2 +- libs/SDL2/src/video/haiku/SDL_bopengl.h | 2 +- libs/SDL2/src/video/haiku/SDL_bvideo.cc | 2 +- libs/SDL2/src/video/haiku/SDL_bvideo.h | 2 +- libs/SDL2/src/video/haiku/SDL_bwindow.cc | 2 +- libs/SDL2/src/video/haiku/SDL_bwindow.h | 2 +- libs/SDL2/src/video/mir/SDL_mirdyn.c | 17 +- libs/SDL2/src/video/mir/SDL_mirdyn.h | 8 +- libs/SDL2/src/video/mir/SDL_mirevents.c | 216 ++++---- libs/SDL2/src/video/mir/SDL_mirevents.h | 4 +- libs/SDL2/src/video/mir/SDL_mirframebuffer.c | 30 +- libs/SDL2/src/video/mir/SDL_mirframebuffer.h | 2 +- libs/SDL2/src/video/mir/SDL_mirmouse.c | 151 +++++- libs/SDL2/src/video/mir/SDL_mirmouse.h | 2 +- libs/SDL2/src/video/mir/SDL_miropengl.c | 2 +- libs/SDL2/src/video/mir/SDL_miropengl.h | 2 +- libs/SDL2/src/video/mir/SDL_mirsym.h | 89 +++- libs/SDL2/src/video/mir/SDL_mirvideo.c | 38 +- libs/SDL2/src/video/mir/SDL_mirvideo.h | 9 +- libs/SDL2/src/video/mir/SDL_mirwindow.c | 191 +++++-- libs/SDL2/src/video/mir/SDL_mirwindow.h | 25 +- libs/SDL2/src/video/nacl/SDL_naclevents.c | 2 +- libs/SDL2/src/video/nacl/SDL_naclevents_c.h | 2 +- libs/SDL2/src/video/nacl/SDL_naclglue.c | 2 +- libs/SDL2/src/video/nacl/SDL_naclopengles.c | 2 +- libs/SDL2/src/video/nacl/SDL_naclopengles.h | 2 +- libs/SDL2/src/video/nacl/SDL_naclvideo.c | 2 +- libs/SDL2/src/video/nacl/SDL_naclvideo.h | 2 +- libs/SDL2/src/video/nacl/SDL_naclwindow.c | 2 +- libs/SDL2/src/video/nacl/SDL_naclwindow.h | 2 +- libs/SDL2/src/video/pandora/SDL_pandora.c | 2 +- libs/SDL2/src/video/pandora/SDL_pandora.h | 2 +- .../src/video/pandora/SDL_pandora_events.c | 2 +- .../src/video/pandora/SDL_pandora_events.h | 2 +- libs/SDL2/src/video/psp/SDL_pspevents.c | 2 +- libs/SDL2/src/video/psp/SDL_pspevents_c.h | 2 +- libs/SDL2/src/video/psp/SDL_pspgl.c | 2 +- libs/SDL2/src/video/psp/SDL_pspgl_c.h | 2 +- libs/SDL2/src/video/psp/SDL_pspmouse.c | 2 +- libs/SDL2/src/video/psp/SDL_pspmouse_c.h | 2 +- libs/SDL2/src/video/psp/SDL_pspvideo.c | 2 +- libs/SDL2/src/video/psp/SDL_pspvideo.h | 2 +- libs/SDL2/src/video/raspberry/SDL_rpievents.c | 2 +- .../src/video/raspberry/SDL_rpievents_c.h | 2 +- libs/SDL2/src/video/raspberry/SDL_rpimouse.c | 11 +- libs/SDL2/src/video/raspberry/SDL_rpimouse.h | 2 +- .../src/video/raspberry/SDL_rpiopengles.c | 2 +- .../src/video/raspberry/SDL_rpiopengles.h | 2 +- libs/SDL2/src/video/raspberry/SDL_rpivideo.c | 2 +- libs/SDL2/src/video/raspberry/SDL_rpivideo.h | 2 +- libs/SDL2/src/video/sdlgenblit.pl | 2 +- .../src/video/uikit/SDL_uikitappdelegate.h | 2 +- .../src/video/uikit/SDL_uikitappdelegate.m | 8 +- .../SDL2/src/video/uikit/SDL_uikitclipboard.h | 35 ++ .../SDL2/src/video/uikit/SDL_uikitclipboard.m | 99 ++++ libs/SDL2/src/video/uikit/SDL_uikitevents.h | 2 +- libs/SDL2/src/video/uikit/SDL_uikitevents.m | 2 +- .../src/video/uikit/SDL_uikitmessagebox.h | 2 +- .../src/video/uikit/SDL_uikitmessagebox.m | 2 +- libs/SDL2/src/video/uikit/SDL_uikitmodes.h | 3 +- libs/SDL2/src/video/uikit/SDL_uikitmodes.m | 22 +- libs/SDL2/src/video/uikit/SDL_uikitopengles.h | 2 +- libs/SDL2/src/video/uikit/SDL_uikitopengles.m | 2 +- .../src/video/uikit/SDL_uikitopenglview.h | 2 +- .../src/video/uikit/SDL_uikitopenglview.m | 2 +- libs/SDL2/src/video/uikit/SDL_uikitvideo.h | 8 +- libs/SDL2/src/video/uikit/SDL_uikitvideo.m | 116 ++-- libs/SDL2/src/video/uikit/SDL_uikitview.h | 2 +- libs/SDL2/src/video/uikit/SDL_uikitview.m | 2 +- .../src/video/uikit/SDL_uikitviewcontroller.h | 32 +- .../src/video/uikit/SDL_uikitviewcontroller.m | 2 +- libs/SDL2/src/video/uikit/SDL_uikitwindow.h | 2 +- libs/SDL2/src/video/uikit/SDL_uikitwindow.m | 2 +- libs/SDL2/src/video/uikit/keyinfotable.h | 2 +- .../src/video/vivante/SDL_vivanteopengles.c | 2 +- .../src/video/vivante/SDL_vivanteopengles.h | 2 +- .../src/video/vivante/SDL_vivanteplatform.c | 2 +- .../src/video/vivante/SDL_vivanteplatform.h | 2 +- .../SDL2/src/video/vivante/SDL_vivantevideo.c | 8 +- .../SDL2/src/video/vivante/SDL_vivantevideo.h | 2 +- libs/SDL2/src/video/wayland/SDL_waylanddyn.c | 19 +- libs/SDL2/src/video/wayland/SDL_waylanddyn.h | 8 +- .../src/video/wayland/SDL_waylandevents.c | 6 +- .../src/video/wayland/SDL_waylandevents_c.h | 2 +- .../SDL2/src/video/wayland/SDL_waylandmouse.c | 23 +- .../SDL2/src/video/wayland/SDL_waylandmouse.h | 2 +- .../src/video/wayland/SDL_waylandopengles.c | 2 +- .../src/video/wayland/SDL_waylandopengles.h | 2 +- libs/SDL2/src/video/wayland/SDL_waylandsym.h | 21 +- .../SDL2/src/video/wayland/SDL_waylandtouch.c | 2 +- .../SDL2/src/video/wayland/SDL_waylandtouch.h | 2 +- .../SDL2/src/video/wayland/SDL_waylandvideo.c | 3 +- .../SDL2/src/video/wayland/SDL_waylandvideo.h | 3 +- .../src/video/wayland/SDL_waylandwindow.c | 2 +- .../src/video/wayland/SDL_waylandwindow.h | 2 +- libs/SDL2/src/video/windows/SDL_msctf.h | 2 +- libs/SDL2/src/video/windows/SDL_vkeys.h | 2 +- .../src/video/windows/SDL_windowsclipboard.c | 2 +- .../src/video/windows/SDL_windowsclipboard.h | 2 +- .../src/video/windows/SDL_windowsevents.c | 25 +- .../src/video/windows/SDL_windowsevents.h | 2 +- .../video/windows/SDL_windowsframebuffer.c | 2 +- .../video/windows/SDL_windowsframebuffer.h | 2 +- .../src/video/windows/SDL_windowskeyboard.c | 2 +- .../src/video/windows/SDL_windowskeyboard.h | 2 +- .../src/video/windows/SDL_windowsmessagebox.c | 2 +- .../src/video/windows/SDL_windowsmessagebox.h | 2 +- .../SDL2/src/video/windows/SDL_windowsmodes.c | 121 +++-- .../SDL2/src/video/windows/SDL_windowsmodes.h | 3 +- .../SDL2/src/video/windows/SDL_windowsmouse.c | 2 +- .../SDL2/src/video/windows/SDL_windowsmouse.h | 2 +- .../src/video/windows/SDL_windowsopengl.c | 2 +- .../src/video/windows/SDL_windowsopengl.h | 2 +- .../src/video/windows/SDL_windowsopengles.c | 2 +- .../src/video/windows/SDL_windowsopengles.h | 2 +- .../SDL2/src/video/windows/SDL_windowsshape.c | 2 +- .../SDL2/src/video/windows/SDL_windowsshape.h | 2 +- .../SDL2/src/video/windows/SDL_windowsvideo.c | 4 +- .../SDL2/src/video/windows/SDL_windowsvideo.h | 2 +- .../src/video/windows/SDL_windowswindow.c | 35 +- .../src/video/windows/SDL_windowswindow.h | 3 +- libs/SDL2/src/video/windows/wmmsg.h | 2 +- libs/SDL2/src/video/winrt/SDL_winrtevents.cpp | 2 +- libs/SDL2/src/video/winrt/SDL_winrtevents_c.h | 2 +- .../src/video/winrt/SDL_winrtkeyboard.cpp | 2 +- .../src/video/winrt/SDL_winrtmessagebox.cpp | 2 +- .../src/video/winrt/SDL_winrtmessagebox.h | 2 +- libs/SDL2/src/video/winrt/SDL_winrtmouse.cpp | 2 +- libs/SDL2/src/video/winrt/SDL_winrtmouse_c.h | 2 +- .../src/video/winrt/SDL_winrtopengles.cpp | 2 +- libs/SDL2/src/video/winrt/SDL_winrtopengles.h | 2 +- .../src/video/winrt/SDL_winrtpointerinput.cpp | 2 +- libs/SDL2/src/video/winrt/SDL_winrtvideo.cpp | 6 +- .../SDL2/src/video/winrt/SDL_winrtvideo_cpp.h | 2 +- libs/SDL2/src/video/x11/SDL_x11clipboard.c | 2 +- libs/SDL2/src/video/x11/SDL_x11clipboard.h | 2 +- libs/SDL2/src/video/x11/SDL_x11dyn.c | 17 +- libs/SDL2/src/video/x11/SDL_x11dyn.h | 8 +- libs/SDL2/src/video/x11/SDL_x11events.c | 141 +++-- libs/SDL2/src/video/x11/SDL_x11events.h | 2 +- libs/SDL2/src/video/x11/SDL_x11framebuffer.c | 2 +- libs/SDL2/src/video/x11/SDL_x11framebuffer.h | 2 +- libs/SDL2/src/video/x11/SDL_x11keyboard.c | 3 +- libs/SDL2/src/video/x11/SDL_x11keyboard.h | 2 +- libs/SDL2/src/video/x11/SDL_x11messagebox.c | 2 +- libs/SDL2/src/video/x11/SDL_x11messagebox.h | 2 +- libs/SDL2/src/video/x11/SDL_x11modes.c | 55 +- libs/SDL2/src/video/x11/SDL_x11modes.h | 3 +- libs/SDL2/src/video/x11/SDL_x11mouse.c | 59 ++- libs/SDL2/src/video/x11/SDL_x11mouse.h | 2 +- libs/SDL2/src/video/x11/SDL_x11opengl.c | 2 +- libs/SDL2/src/video/x11/SDL_x11opengl.h | 2 +- libs/SDL2/src/video/x11/SDL_x11opengles.c | 2 +- libs/SDL2/src/video/x11/SDL_x11opengles.h | 2 +- libs/SDL2/src/video/x11/SDL_x11shape.c | 2 +- libs/SDL2/src/video/x11/SDL_x11shape.h | 2 +- libs/SDL2/src/video/x11/SDL_x11sym.h | 13 +- libs/SDL2/src/video/x11/SDL_x11touch.c | 2 +- libs/SDL2/src/video/x11/SDL_x11touch.h | 2 +- libs/SDL2/src/video/x11/SDL_x11video.c | 19 +- libs/SDL2/src/video/x11/SDL_x11video.h | 14 +- libs/SDL2/src/video/x11/SDL_x11window.c | 154 +++++- libs/SDL2/src/video/x11/SDL_x11window.h | 11 +- libs/SDL2/src/video/x11/SDL_x11xinput2.c | 12 +- libs/SDL2/src/video/x11/SDL_x11xinput2.h | 2 +- libs/SDL2/src/video/x11/edid-parse.c | 4 +- libs/SDL2/src/video/x11/imKStoUCS.c | 496 +++++++++--------- libs/SDL2/src/video/x11/imKStoUCS.h | 39 +- libs/SDL2/test/Makefile.in | 8 + libs/SDL2/test/checkkeys.c | 2 +- libs/SDL2/test/controllermap.c | 2 +- libs/SDL2/test/loopwave.c | 2 +- libs/SDL2/test/loopwavequeue.c | 2 +- libs/SDL2/test/testatomic.c | 14 +- libs/SDL2/test/testaudiohotplug.c | 2 +- libs/SDL2/test/testaudioinfo.c | 2 +- libs/SDL2/test/testautomation.c | 2 +- libs/SDL2/test/testbounds.c | 39 ++ libs/SDL2/test/testdisplayinfo.c | 9 +- libs/SDL2/test/testdraw2.c | 2 +- libs/SDL2/test/testdrawchessboard.c | 2 +- libs/SDL2/test/testdropfile.c | 11 +- libs/SDL2/test/testerror.c | 2 +- libs/SDL2/test/testfile.c | 2 +- libs/SDL2/test/testfilesystem.c | 2 +- libs/SDL2/test/testgamecontroller.c | 2 +- libs/SDL2/test/testgesture.c | 2 +- libs/SDL2/test/testgl2.c | 2 +- libs/SDL2/test/testgles.c | 2 +- libs/SDL2/test/testgles2.c | 2 +- libs/SDL2/test/testhotplug.c | 2 +- libs/SDL2/test/testiconv.c | 2 +- libs/SDL2/test/testime.c | 38 +- libs/SDL2/test/testintersections.c | 2 +- libs/SDL2/test/testjoystick.c | 2 +- libs/SDL2/test/testkeys.c | 2 +- libs/SDL2/test/testloadso.c | 2 +- libs/SDL2/test/testlock.c | 14 +- libs/SDL2/test/testmessage.c | 2 +- libs/SDL2/test/testmultiaudio.c | 13 +- libs/SDL2/test/testnative.c | 2 +- libs/SDL2/test/testnative.h | 2 +- libs/SDL2/test/testnativew32.c | 2 +- libs/SDL2/test/testnativex11.c | 2 +- libs/SDL2/test/testoverlay2.c | 2 +- libs/SDL2/test/testplatform.c | 2 +- libs/SDL2/test/testpower.c | 2 +- libs/SDL2/test/testqsort.c | 84 +++ libs/SDL2/test/testrelative.c | 2 +- libs/SDL2/test/testrendercopyex.c | 2 +- libs/SDL2/test/testrendertarget.c | 2 +- libs/SDL2/test/testresample.c | 2 +- libs/SDL2/test/testrumble.c | 2 +- libs/SDL2/test/testscale.c | 2 +- libs/SDL2/test/testsem.c | 2 +- libs/SDL2/test/testshader.c | 2 +- libs/SDL2/test/testshape.c | 2 +- libs/SDL2/test/testsprite2.c | 2 +- libs/SDL2/test/testspriteminimal.c | 2 +- libs/SDL2/test/teststreaming.c | 2 +- libs/SDL2/test/testthread.c | 2 +- libs/SDL2/test/testtimer.c | 2 +- libs/SDL2/test/testver.c | 2 +- libs/SDL2/test/testviewport.c | 2 +- libs/SDL2/test/testwm2.c | 2 +- libs/SDL2/test/torturethread.c | 10 +- 811 files changed, 4116 insertions(+), 2164 deletions(-) mode change 100755 => 100644 libs/SDL2/CMakeLists.txt create mode 100644 libs/SDL2/src/video/uikit/SDL_uikitclipboard.h create mode 100644 libs/SDL2/src/video/uikit/SDL_uikitclipboard.m create mode 100644 libs/SDL2/test/testbounds.c create mode 100644 libs/SDL2/test/testqsort.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 68fce08e..5eb234ab 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,7 +137,7 @@ set(MEGA_LIBVORBIS_VER "1.3.5") set(MEGA_LIBTHEORA_VER "1.1.1") set(MEGA_MPG123_VER "1.15.3") set(MEGA_FREETYPE_VER "2.6.2") -set(MEGA_SDL2_VER "2.0.3-e05d46c27ce3") +set(MEGA_SDL2_VER "2.0.4-6b6ded44e6e0") set(MEGA_OPENAL_VER "1.17.0") set(MEGA_MODPLUG_VER "0.8.8.4") diff --git a/libs/SDL2/.hg_archival.txt b/libs/SDL2/.hg_archival.txt index a7783adb..362f7ee4 100644 --- a/libs/SDL2/.hg_archival.txt +++ b/libs/SDL2/.hg_archival.txt @@ -1,5 +1,5 @@ repo: 74212992fb0868a6929180cd74dd67e38507340a -node: e05d46c27ce3d91d427f74ae0ca8d900d83cbcad +node: 6b6ded44e6e00c90fa941ab89ad4c15ed47f819a branch: default -latesttag: release-2.0.3 -latesttagdistance: 1235 +latesttag: release-2.0.4 +latesttagdistance: 117 diff --git a/libs/SDL2/.hgignore b/libs/SDL2/.hgignore index 55c06679..84122f80 100644 --- a/libs/SDL2/.hgignore +++ b/libs/SDL2/.hgignore @@ -116,8 +116,10 @@ test/testtimer test/testver test/testviewport test/testwm2 +test/testbounds test/torturethread test/testdisplayinfo +test/testqsort test/*.exe test/*.dSYM buildbot diff --git a/libs/SDL2/.hgtags b/libs/SDL2/.hgtags index 21648b7f..899f4f77 100644 --- a/libs/SDL2/.hgtags +++ b/libs/SDL2/.hgtags @@ -28,3 +28,4 @@ be2102f000d0d2d9bab75e9703a1d503d0f6bb33 release-2.0.2 f285b9487756ff681f76c85644222c03a7bfa1c7 release-2.0.3 f285b9487756ff681f76c85644222c03a7bfa1c7 release-2.0.3 704a0bfecf754e4e1383f83c7d5118b00cae26ea release-2.0.3 +e12c387305129c847b3928a123300b113782fe3f release-2.0.4 diff --git a/libs/SDL2/CMakeLists.txt b/libs/SDL2/CMakeLists.txt old mode 100755 new mode 100644 index d4b2804e..54571ff0 --- a/libs/SDL2/CMakeLists.txt +++ b/libs/SDL2/CMakeLists.txt @@ -4,6 +4,17 @@ endif() cmake_minimum_required(VERSION 2.8) project(SDL2 C) + +# !!! FIXME: this should probably do "MACOSX_RPATH ON" as a target property +# !!! FIXME: for the SDL2 shared library (so you get an +# !!! FIXME: install_name ("soname") of "@rpath/libSDL-whatever.dylib" +# !!! FIXME: instead of "/usr/local/lib/libSDL-whatever.dylib"), but I'm +# !!! FIXME: punting for now and leaving the existing behavior. Until this +# !!! FIXME: properly resolved, this line silences a warning in CMake 3.0+. +# !!! FIXME: remove it and this comment entirely once the problem is +# !!! FIXME: properly resolved. +#cmake_policy(SET CMP0042 OLD) + include(CheckFunctionExists) include(CheckLibraryExists) include(CheckIncludeFiles) @@ -147,8 +158,10 @@ endif() # Default flags, if not set otherwise if("$ENV{CFLAGS}" STREQUAL "") - if(USE_GCC OR USE_CLANG) - set(CMAKE_C_FLAGS "-g -O3") + if(CMAKE_BUILD_TYPE STREQUAL "") + if(USE_GCC OR USE_CLANG) + set(CMAKE_C_FLAGS "-g -O3") + endif() endif() else() set(CMAKE_C_FLAGS "$ENV{CFLAGS}") @@ -296,8 +309,10 @@ set_option(VIDEO_VIVANTE "Use Vivante EGL video driver" ${UNIX_SYS}) # TODO: We should (should we?) respect cmake's ${BUILD_SHARED_LIBS} flag here # The options below are for compatibility to configure's default behaviour. -set(SDL_SHARED ON CACHE BOOL "Build a shared version of the library") -set(SDL_STATIC OFF CACHE BOOL "Build a static version of the library") +set(SDL_SHARED ${SDL_SHARED_ENABLED_BY_DEFAULT} CACHE BOOL "Build a shared version of the library") +set(SDL_STATIC ON CACHE BOOL "Build a static version of the library") + +dep_option(SDL_STATIC_PIC "Static version of the library should be built with Position Independent Code" OFF "SDL_STATIC" OFF) # General source files file(GLOB SOURCE_FILES @@ -334,6 +349,24 @@ set(HAVE_ASSERTIONS ${ASSERTIONS}) # Compiler option evaluation if(USE_GCC OR USE_CLANG) + # Check for -Wall first, so later things can override pieces of it. + check_c_compiler_flag(-Wall HAVE_GCC_WALL) + if(HAVE_GCC_WALL) + list(APPEND EXTRA_CFLAGS "-Wall") + if(HAIKU) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-multichar") + endif() + endif() + + check_c_compiler_flag(-Wdeclaration-after-statement HAVE_GCC_WDECLARATION_AFTER_STATEMENT) + if(HAVE_GCC_WDECLARATION_AFTER_STATEMENT) + check_c_compiler_flag(-Werror=declaration-after-statement HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT) + if(HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT) + list(APPEND EXTRA_CFLAGS "-Werror=declaration-after-statement") + endif() + list(APPEND EXTRA_CFLAGS "-Wdeclaration-after-statement") + endif() + if(DEPENDENCY_TRACKING) check_c_source_compiles(" #if !defined(__GNUC__) || __GNUC__ < 3 @@ -375,13 +408,6 @@ if(USE_GCC OR USE_CLANG) endif() set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) - check_c_compiler_flag(-Wall HAVE_GCC_WALL) - if(HAVE_GCC_WALL) - list(APPEND EXTRA_CFLAGS "-Wall") - if(HAIKU) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-multichar") - endif() - endif() check_c_compiler_flag(-Wshadow HAVE_GCC_WSHADOW) if(HAVE_GCC_WSHADOW) list(APPEND EXTRA_CFLAGS "-Wshadow") @@ -933,7 +959,14 @@ elseif(UNIX AND NOT APPLE) if(RPATH) set(SDL_RLD_FLAGS "") if(BSDI OR FREEBSD OR LINUX OR NETBSD) - set(SDL_RLD_FLAGS "-Wl,-rpath,\${libdir}") + set(CMAKE_REQUIRED_FLAGS "-Wl,--enable-new-dtags") + check_c_compiler_flag("" HAVE_ENABLE_NEW_DTAGS) + set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) + if(HAVE_ENABLE_NEW_DTAGS) + set(SDL_RLD_FLAGS "-Wl,-rpath,\${libdir} -Wl,--enable-new-dtags") + else() + set(SDL_RLD_FLAGS "-Wl,-rpath,\${libdir}") + endif() elseif(SOLARIS) set(SDL_RLD_FLAGS "-R\${libdir}") endif() @@ -959,8 +992,6 @@ elseif(WINDOWS) endif() endif() - set(SDL_LINK_DIR ${PARENT_SCOPE}) - # Check for DirectX if(DIRECTX) if(DEFINED MSVC_VERSION AND NOT ${MSVC_VERSION} LESS 1700) @@ -994,15 +1025,13 @@ elseif(WINDOWS) set(HAVE_DIRECTX TRUE) if(NOT CMAKE_COMPILER_IS_MINGW AND NOT USE_WINSDK_DIRECTX) # TODO: change $ENV{DXSDL_DIR} to get the path from the include checks - set(SDL_LINK_DIR $ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH} ${SDL_LINK_DIR}) + link_directories($ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH}) include_directories($ENV{DXSDK_DIR}\\Include) endif() endif() set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) endif() - link_directories(${SDL_LINK_DIR}) - if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_WINMM 1) file(GLOB WINMM_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/winmm/*.c) @@ -1109,7 +1138,7 @@ elseif(WINDOWS) set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) if(HAVE_DINPUT_H) set(SDL_JOYSTICK_DINPUT 1) - list(APPEND EXTRA_LIBS dinput8 dxguid) + list(APPEND EXTRA_LIBS dinput8) if(CMAKE_COMPILER_IS_MINGW) list(APPEND EXTRA_LIBS dxerr8) elseif (NOT USE_WINSDK_DIRECTX) @@ -1443,6 +1472,9 @@ message(STATUS " EXTRA_LIBS: ${EXTRA_LIBS}") message(STATUS "") message(STATUS " Build Shared Library: ${SDL_SHARED}") message(STATUS " Build Static Library: ${SDL_STATIC}") +if(SDL_STATIC) + message(STATUS " Build Static Library with Position Independent Code: ${SDL_STATIC_PIC}") +endif() message(STATUS "") if(UNIX) message(STATUS "If something was not detected, although the libraries") @@ -1460,7 +1492,6 @@ set(_INSTALL_LIBS "SDL2main") if(SDL_SHARED) add_library(SDL2 SHARED ${SOURCE_FILES}) - install(TARGETS SDL2 RUNTIME DESTINATION . LIBRARY DESTINATION .) if(UNIX) set_target_properties(SDL2 PROPERTIES VERSION ${LT_VERSION} @@ -1480,13 +1511,13 @@ if(SDL_SHARED) endif() set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS}) target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) - target_include_directories(SDL2 PUBLIC include) endif() if(SDL_STATIC) set (BUILD_SHARED_LIBS FALSE) add_library(SDL2-static STATIC ${SOURCE_FILES}) set_target_properties(SDL2-static PROPERTIES OUTPUT_NAME "SDL2") + set_target_properties(SDL2-static PROPERTIES POSITION_INDEPENDENT_CODE ${SDL_STATIC_PIC}) if(MSVC) set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB") set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB") @@ -1499,11 +1530,6 @@ if(SDL_STATIC) endif() ##### Installation targets ##### - -if(MEGA) - return() -endif() - install(TARGETS ${_INSTALL_LIBS} LIBRARY DESTINATION "lib${LIB_SUFFIX}" ARCHIVE DESTINATION "lib${LIB_SUFFIX}" @@ -1518,12 +1544,17 @@ endforeach() list(APPEND INCLUDE_FILES ${BIN_INCLUDE_FILES}) install(FILES ${INCLUDE_FILES} DESTINATION include/SDL2) -if(NOT WINDOWS OR CYGWIN) +if(NOT (WINDOWS OR CYGWIN)) if(SDL_SHARED) + if (APPLE) + set(SOEXT "dylib") + else() + set(SOEXT "so") + endif() install(CODE " execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink - \"libSDL2-2.0.so\" \"libSDL2.so\")") - install(FILES ${SDL2_BINARY_DIR}/libSDL2.so DESTINATION "lib${LIB_SUFFIX}") + \"libSDL2-2.0.${SOEXT}\" \"libSDL2.${SOEXT}\")") + install(FILES ${SDL2_BINARY_DIR}/libSDL2.${SOEXT} DESTINATION "lib${LIB_SUFFIX}") endif() if(FREEBSD) # FreeBSD uses ${PREFIX}/libdata/pkgconfig diff --git a/libs/SDL2/COPYING.txt b/libs/SDL2/COPYING.txt index 5873af74..04f14eed 100644 --- a/libs/SDL2/COPYING.txt +++ b/libs/SDL2/COPYING.txt @@ -1,6 +1,6 @@ Simple DirectMedia Layer -Copyright (C) 1997-2015 Sam Lantinga +Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/Makefile.psp b/libs/SDL2/Makefile.psp index 5e7dcd29..93fb9e44 100644 --- a/libs/SDL2/Makefile.psp +++ b/libs/SDL2/Makefile.psp @@ -49,6 +49,7 @@ OBJS= src/SDL.o \ src/stdlib/SDL_stdlib.o \ src/stdlib/SDL_string.o \ src/thread/SDL_thread.o \ + src/thread/generic/SDL_systls.o \ src/thread/psp/SDL_syssem.o \ src/thread/psp/SDL_systhread.o \ src/thread/psp/SDL_sysmutex.o \ diff --git a/libs/SDL2/README-SDL.txt b/libs/SDL2/README-SDL.txt index 0630395e..c3d2d37e 100644 --- a/libs/SDL2/README-SDL.txt +++ b/libs/SDL2/README-SDL.txt @@ -2,8 +2,8 @@ Please distribute this file with the SDL runtime environment: The Simple DirectMedia Layer (SDL for short) is a cross-platform library -designed to make it easy to write multi-media software, such as games and -emulators. +designed to make it easy to write multi-media software, such as games +and emulators. The Simple DirectMedia Layer library source code is available from: http://www.libsdl.org/ diff --git a/libs/SDL2/VisualC.html b/libs/SDL2/VisualC.html index 89035d67..0631832e 100644 --- a/libs/SDL2/VisualC.html +++ b/libs/SDL2/VisualC.html @@ -21,7 +21,7 @@

There are different solution files for the various - versions of the IDE. Please use the appropiate version + versions of the IDE. Please use the appropriate version 2008, 2010, 2012 or 2013.

@@ -101,7 +101,7 @@ files to project")

Instead of adding the files to your project it is more - desireable to add them to the linker options: Project|Properties|Linker|Command + desirable to add them to the linker options: Project|Properties|Linker|Command Line and type the names of the libraries to link with in the "Additional Options:" box.  Note: This must be done for each build configuration (e.g. Release,Debug).

diff --git a/libs/SDL2/WhatsNew.txt b/libs/SDL2/WhatsNew.txt index b37591d8..698ebf7d 100644 --- a/libs/SDL2/WhatsNew.txt +++ b/libs/SDL2/WhatsNew.txt @@ -71,13 +71,13 @@ Linux: iOS: * Added support for iOS 8 +* The SDL_WINDOW_ALLOW_HIGHDPI window flag now enables high-dpi support, and SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() gets the window resolution in pixels +* SDL_GetWindowSize() and display mode sizes are in the "DPI-independent points" / "screen coordinates" coordinate space rather than pixels (matches OS X behavior) +* Added native resolution support for the iPhone 6 Plus * Added support for MFi game controllers * Added support for the hint SDL_HINT_ACCELEROMETER_AS_JOYSTICK * Added sRGB OpenGL ES context support on iOS 7+ -* Added native resolution support for the iPhone 6 Plus * Added support for SDL_DisableScreenSaver(), SDL_EnableScreenSaver() and the hint SDL_HINT_VIDEO_ALLOW_SCREENSAVER -* The SDL_WINDOW_ALLOW_HIGHDPI window flag now enables high-dpi support, and SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() gets the window resolution in pixels -* SDL_GetWindowSize() and display mode sizes are in the "DPI-independent points" coordinate space rather than pixels (matches OS X behavior) * SDL_SysWMinfo now contains the OpenGL ES framebuffer and color renderbuffer objects used by the window's active GLES view * Fixed various rotation and orientation issues * Fixed memory leaks diff --git a/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj b/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj index 9f0d62e8..b0830bf4 100755 --- a/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj +++ b/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj @@ -143,7 +143,9 @@ AABCC3941640643D00AB8930 /* SDL_uikitmessagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = AABCC3921640643D00AB8930 /* SDL_uikitmessagebox.h */; }; AABCC3951640643D00AB8930 /* SDL_uikitmessagebox.m in Sources */ = {isa = PBXBuildFile; fileRef = AABCC3931640643D00AB8930 /* SDL_uikitmessagebox.m */; }; AADA5B8F16CCAB7C00107CF7 /* SDL_bits.h in Headers */ = {isa = PBXBuildFile; fileRef = AADA5B8E16CCAB7C00107CF7 /* SDL_bits.h */; }; - FAD4F7021BA3C4E8008346CE /* SDL_sysjoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = FAD4F7011BA3C4E8008346CE /* SDL_sysjoystick_c.h */; settings = {ASSET_TAGS = (); }; }; + FA1DC2721C62BE65008F99A0 /* SDL_uikitclipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = FA1DC2701C62BE65008F99A0 /* SDL_uikitclipboard.h */; }; + FA1DC2731C62BE65008F99A0 /* SDL_uikitclipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = FA1DC2711C62BE65008F99A0 /* SDL_uikitclipboard.m */; }; + FAD4F7021BA3C4E8008346CE /* SDL_sysjoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = FAD4F7011BA3C4E8008346CE /* SDL_sysjoystick_c.h */; }; FD3F4A760DEA620800C5B771 /* SDL_getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A700DEA620800C5B771 /* SDL_getenv.c */; }; FD3F4A770DEA620800C5B771 /* SDL_iconv.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A710DEA620800C5B771 /* SDL_iconv.c */; }; FD3F4A780DEA620800C5B771 /* SDL_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A720DEA620800C5B771 /* SDL_malloc.c */; }; @@ -340,6 +342,8 @@ AABCC3921640643D00AB8930 /* SDL_uikitmessagebox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitmessagebox.h; sourceTree = ""; }; AABCC3931640643D00AB8930 /* SDL_uikitmessagebox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitmessagebox.m; sourceTree = ""; }; AADA5B8E16CCAB7C00107CF7 /* SDL_bits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_bits.h; sourceTree = ""; }; + FA1DC2701C62BE65008F99A0 /* SDL_uikitclipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitclipboard.h; sourceTree = ""; }; + FA1DC2711C62BE65008F99A0 /* SDL_uikitclipboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitclipboard.m; sourceTree = ""; }; FAD4F7011BA3C4E8008346CE /* SDL_sysjoystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysjoystick_c.h; sourceTree = ""; }; FD0BBFEF0E3933DD00D833B1 /* SDL_uikitview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitview.h; sourceTree = ""; }; FD3F4A700DEA620800C5B771 /* SDL_getenv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_getenv.c; sourceTree = ""; }; @@ -648,6 +652,8 @@ FDC261780E3A3FC8001C4554 /* keyinfotable.h */, FD689FCD0E26E9D400F90B21 /* SDL_uikitappdelegate.h */, FD689FCC0E26E9D400F90B21 /* SDL_uikitappdelegate.m */, + FA1DC2701C62BE65008F99A0 /* SDL_uikitclipboard.h */, + FA1DC2711C62BE65008F99A0 /* SDL_uikitclipboard.m */, FD689F0C0E26E5D900F90B21 /* SDL_uikitevents.h */, FD689F0D0E26E5D900F90B21 /* SDL_uikitevents.m */, AABCC3921640643D00AB8930 /* SDL_uikitmessagebox.h */, @@ -994,6 +1000,7 @@ 04F7808012FB751400FC43C0 /* SDL_drawpoint.h in Headers */, 04F7808412FB753F00FC43C0 /* SDL_nullframebuffer_c.h in Headers */, 0442EC5012FE1C1E004C9285 /* SDL_render_sw_c.h in Headers */, + FA1DC2721C62BE65008F99A0 /* SDL_uikitclipboard.h in Headers */, 0402A85A12FE70C600CECEE3 /* SDL_shaders_gles2.h in Headers */, 04BAC09C1300C1290055DE28 /* SDL_assert_c.h in Headers */, 56EA86FC13E9EC2B002E47EB /* SDL_coreaudio.h in Headers */, @@ -1139,6 +1146,7 @@ FD65266A0DE8FCDD002AD96B /* SDL_audiotypecvt.c in Sources */, FD65266B0DE8FCDD002AD96B /* SDL_mixer.c in Sources */, FD65266F0DE8FCDD002AD96B /* SDL_wave.c in Sources */, + FA1DC2731C62BE65008F99A0 /* SDL_uikitclipboard.m in Sources */, FD6526700DE8FCDD002AD96B /* SDL_cpuinfo.c in Sources */, FD6526710DE8FCDD002AD96B /* SDL_events.c in Sources */, FD6526720DE8FCDD002AD96B /* SDL_keyboard.c in Sources */, diff --git a/libs/SDL2/Xcode-iOS/Test/README b/libs/SDL2/Xcode-iOS/Test/README index b16ff7c0..b8d9ed3b 100644 --- a/libs/SDL2/Xcode-iOS/Test/README +++ b/libs/SDL2/Xcode-iOS/Test/README @@ -1,22 +1,11 @@ TestiPhoneOS.xcodeproj contains targets to compile many of the SDL test programs for iPhone OS. Most of these test programs work fine, with the following exceptions: -testalpha: - Program crashes. Problem appears to effect Mac OS X as well. - testthread: SIGTERM kills the process immediately without executing the 'kill' function. The posix standard says this shouldn't happen. Apple seems intent on having iPhone apps exit promptly when the user requests it, so maybe that's why(?) testlock: Locks appear to work, but there doesn't appear to be a simple way to send the process SIGINT. -testpalette: - "SDL error: blitting boat: Blit combination not supported." Happens on Mac OS X as well. - testsprite2: SDL_CreateTextureFromSurface requests an ARGB pixel format, but iPhone's SDL video driver only supports ABGR. -testwin: - Behaves as it does under Mac OS X ... not sure if that is correctly or not. - -threadwin: - Works if -threaded is not on. Otherwise it doesn't work, but this is true under Mac OS X as well. diff --git a/libs/SDL2/Xcode/SDL/pkg-support/resources/License.txt b/libs/SDL2/Xcode/SDL/pkg-support/resources/License.txt index e6a9ef84..3c7724df 100644 --- a/libs/SDL2/Xcode/SDL/pkg-support/resources/License.txt +++ b/libs/SDL2/Xcode/SDL/pkg-support/resources/License.txt @@ -1,6 +1,6 @@ Simple DirectMedia Layer -Copyright (C) 1997-2015 Sam Lantinga +Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/android-project/src/org/libsdl/app/SDLActivity.java b/libs/SDL2/android-project/src/org/libsdl/app/SDLActivity.java index 0a2e5d87..bc81b03e 100644 --- a/libs/SDL2/android-project/src/org/libsdl/app/SDLActivity.java +++ b/libs/SDL2/android-project/src/org/libsdl/app/SDLActivity.java @@ -1196,6 +1196,20 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, } } + if ((event.getSource() & InputDevice.SOURCE_MOUSE) != 0) { + // on some devices key events are sent for mouse BUTTON_BACK/FORWARD presses + // they are ignored here because sending them as mouse input to SDL is messy + if ((keyCode == KeyEvent.KEYCODE_BACK) || (keyCode == KeyEvent.KEYCODE_FORWARD)) { + switch (event.getAction()) { + case KeyEvent.ACTION_DOWN: + case KeyEvent.ACTION_UP: + // mark the event as handled or it will be handled by system + // handling KEYCODE_BACK by system will call onBackPressed() + return true; + } + } + } + return false; } @@ -1214,7 +1228,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, // !!! FIXME: dump this SDK check after 2.0.4 ships and require API14. if (event.getSource() == InputDevice.SOURCE_MOUSE && SDLActivity.mSeparateMouseAndTouch) { if (Build.VERSION.SDK_INT < 14) { - mouseButton = 1; // For Android==12 all mouse buttons are the left button + mouseButton = 1; // all mouse buttons are the left button } else { try { mouseButton = (Integer) event.getClass().getMethod("getButtonState").invoke(event); @@ -1627,8 +1641,7 @@ class SDLGenericMotionListener_API12 implements View.OnGenericMotionListener { case InputDevice.SOURCE_JOYSTICK: case InputDevice.SOURCE_GAMEPAD: case InputDevice.SOURCE_DPAD: - SDLActivity.handleJoystickMotionEvent(event); - return true; + return SDLActivity.handleJoystickMotionEvent(event); case InputDevice.SOURCE_MOUSE: action = event.getActionMasked(); diff --git a/libs/SDL2/build-scripts/checker-buildbot.sh b/libs/SDL2/build-scripts/checker-buildbot.sh index 682e7fbb..eb014311 100755 --- a/libs/SDL2/build-scripts/checker-buildbot.sh +++ b/libs/SDL2/build-scripts/checker-buildbot.sh @@ -61,13 +61,13 @@ mkdir checker-buildbot cd checker-buildbot # You might want to do this for CMake-backed builds instead... -PATH="$CHECKERDIR:$PATH" scan-build -o analysis cmake -DCMAKE_BUILD_TYPE=Debug .. +PATH="$CHECKERDIR:$PATH" scan-build -o analysis cmake -DCMAKE_BUILD_TYPE=Debug -DASSERTIONS=enabled .. # ...or run configure without the scan-build wrapper... -#CC="$CHECKERDIR/libexec/ccc-analyzer" CFLAGS="-O0" ../configure +#CC="$CHECKERDIR/libexec/ccc-analyzer" CFLAGS="-O0" ../configure --enable-assertions=enabled # ...but this works for our buildbots just fine (EXCEPT ON LATEST MAC OS X). -#CFLAGS="-O0" PATH="$CHECKERDIR:$PATH" scan-build -o analysis ../configure +#CFLAGS="-O0" PATH="$CHECKERDIR:$PATH" scan-build -o analysis ../configure --enable-assertions=enabled rm -rf analysis PATH="$CHECKERDIR:$PATH" scan-build -o analysis $MAKE diff --git a/libs/SDL2/build-scripts/update-copyright.sh b/libs/SDL2/build-scripts/update-copyright.sh index fdfb5ca9..34864bc9 100755 --- a/libs/SDL2/build-scripts/update-copyright.sh +++ b/libs/SDL2/build-scripts/update-copyright.sh @@ -4,6 +4,6 @@ find . -type f -exec grep -Il "Copyright" {} \; \ | grep -v \.hg \ | while read i; \ do \ - sed -ie "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$i"; \ + LC_ALL=C sed -ie "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$i"; \ rm "${i}e"; \ done diff --git a/libs/SDL2/cmake/sdlchecks.cmake b/libs/SDL2/cmake/sdlchecks.cmake index 7ff0985f..c4616cca 100644 --- a/libs/SDL2/cmake/sdlchecks.cmake +++ b/libs/SDL2/cmake/sdlchecks.cmake @@ -679,7 +679,6 @@ macro(CheckOpenGLX11) set(SDL_VIDEO_OPENGL 1) set(SDL_VIDEO_OPENGL_GLX 1) set(SDL_VIDEO_RENDER_OGL 1) - list(APPEND EXTRA_LIBS GL) endif() endif() endmacro() diff --git a/libs/SDL2/configure b/libs/SDL2/configure index a41f0259..b73ea4d9 100755 --- a/libs/SDL2/configure +++ b/libs/SDL2/configure @@ -18650,6 +18650,43 @@ $as_echo "$have_gcc_preferred_stack_boundary" >&6; } fi } +CheckDeclarationAfterStatement() +{ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -Wdeclaration-after-statement option" >&5 +$as_echo_n "checking for GCC -Wdeclaration-after-statement option... " >&6; } + have_gcc_declaration_after_statement=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + int x = 0; + +int +main () +{ + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + have_gcc_declaration_after_statement=yes + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_declaration_after_statement" >&5 +$as_echo "$have_gcc_declaration_after_statement" >&6; } + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_declaration_after_statement = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement" + fi +} + CheckWarnAll() { { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -Wall option" >&5 @@ -18928,7 +18965,7 @@ int main () { - MirMotionToolType tool = mir_motion_tool_type_mouse; + MirPointerButton button = mir_pointer_button_primary; ; return 0; @@ -22894,6 +22931,8 @@ fi } +CheckWarnAll + case "$host" in *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*) case "$host" in @@ -22962,6 +23001,7 @@ case "$host" in *-*-minix*) ARCH=minix ;; esac CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio @@ -23392,6 +23432,7 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h ARCH=ios CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio @@ -23461,6 +23502,7 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX" CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio @@ -23581,6 +23623,7 @@ $as_echo "#define SDL_AUDIO_DRIVER_EMSCRIPTEN 1" >>confdefs.h fi CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio @@ -23630,8 +23673,6 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h ;; esac -CheckWarnAll - # Verify that we have all the platform specific files we need if test x$have_joystick != xyes; then @@ -23722,6 +23763,36 @@ SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([^ ]*\\)/\\([^ ]*\\)\\.c,\\ if test "x$enable_rpath" = "xyes"; then if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker option --enable-new-dtags" >&5 +$as_echo_n "checking for linker option --enable-new-dtags... " >&6; } + have_enable_new_dtags=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int +main () +{ + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + have_enable_new_dtags=yes + SDL_RLD_FLAGS="$SDL_RLD_FLAGS -Wl,--enable-new-dtags" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_enable_new_dtags" >&5 +$as_echo "$have_enable_new_dtags" >&6; } fi if test $ARCH = solaris; then SDL_RLD_FLAGS="-R\${libdir}" diff --git a/libs/SDL2/configure.in b/libs/SDL2/configure.in index f585d01a..424e3e5e 100644 --- a/libs/SDL2/configure.in +++ b/libs/SDL2/configure.in @@ -1124,6 +1124,30 @@ CheckStackBoundary() fi } +dnl See if GCC's -Wdeclaration-after-statement is supported. +dnl This lets us catch things that would fail on a C89 compiler when using +dnl a modern GCC. +CheckDeclarationAfterStatement() +{ + AC_MSG_CHECKING(for GCC -Wdeclaration-after-statement option) + have_gcc_declaration_after_statement=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement" + AC_TRY_COMPILE([ + int x = 0; + ],[ + ],[ + have_gcc_declaration_after_statement=yes + ]) + AC_MSG_RESULT($have_gcc_declaration_after_statement) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_declaration_after_statement = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement" + fi +} + dnl See if GCC's -Wall is supported. CheckWarnAll() { @@ -1260,12 +1284,12 @@ AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=yes]]]), MIR_LIBS=`$PKG_CONFIG --libs mirclient egl xkbcommon` save_CFLAGS="$CFLAGS" CFLAGS="$save_CFLAGS $MIR_CFLAGS" - - dnl This will disable Mir on Ubuntu < 14.04 + + dnl This will disable Mir on Ubuntu < 15.04 (Mir should be 0.14 at this point) AC_TRY_COMPILE([ #include ],[ - MirMotionToolType tool = mir_motion_tool_type_mouse; + MirPointerButton button = mir_pointer_button_primary; ],[ video_mir=yes ]) @@ -2801,6 +2825,9 @@ AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]] , enable_rpath=yes) } +dnl Do this on all platforms, before everything else (other things might want to override it). +CheckWarnAll + dnl Set up the configuration based on the host platform! case "$host" in *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*) @@ -2870,6 +2897,7 @@ case "$host" in *-*-minix*) ARCH=minix ;; esac CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio @@ -3196,6 +3224,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau ARCH=ios CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio @@ -3265,6 +3294,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX" CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio @@ -3366,6 +3396,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau fi CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio @@ -3407,9 +3438,6 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau ;; esac -dnl Do this on all platforms, after everything else. -CheckWarnAll - # Verify that we have all the platform specific files we need if test x$have_joystick != xyes; then @@ -3488,6 +3516,19 @@ SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\. if test "x$enable_rpath" = "xyes"; then if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}" + + AC_MSG_CHECKING(for linker option --enable-new-dtags) + have_enable_new_dtags=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags" + AC_TRY_LINK([ + ],[ + ],[ + have_enable_new_dtags=yes + SDL_RLD_FLAGS="$SDL_RLD_FLAGS -Wl,--enable-new-dtags" + ]) + LDFLAGS="$save_LDFLAGS" + AC_MSG_RESULT($have_enable_new_dtags) fi if test $ARCH = solaris; then SDL_RLD_FLAGS="-R\${libdir}" diff --git a/libs/SDL2/debian/changelog b/libs/SDL2/debian/changelog index 84d1b878..6a88d247 100644 --- a/libs/SDL2/debian/changelog +++ b/libs/SDL2/debian/changelog @@ -1,3 +1,9 @@ +libsdl2 (2.0.4) UNRELEASED; urgency=low + + * Updated SDL to version 2.0.4 + + -- Sam Lantinga Thu, 07 Jan 2016 11:02:39 -0800 + libsdl2 (2.0.3) UNRELEASED; urgency=low * Updated SDL to version 2.0.3 diff --git a/libs/SDL2/debian/copyright b/libs/SDL2/debian/copyright index 31860bbe..99c3d449 100644 --- a/libs/SDL2/debian/copyright +++ b/libs/SDL2/debian/copyright @@ -4,7 +4,7 @@ Upstream-Contact: Sam Lantinga Source: http://www.libsdl.org/ Files: * -Copyright: 1997-2015 Sam Lantinga +Copyright: 1997-2016 Sam Lantinga License: zlib/libpng Files: src/libm/* @@ -12,7 +12,7 @@ Copyright: 1993 by Sun Microsystems, Inc. All rights reserved. License: SunPro Files: src/main/windows/SDL_windows_main.c -Copyright: 2015 Sam Lantinga +Copyright: 2016 Sam Lantinga License: PublicDomain_Sam_Lantinga Comment: SDL_main.c, placed in the public domain by Sam Lantinga 4/13/98 @@ -31,12 +31,8 @@ Copyright: 1995 Erik Corry 1995 Brown University License: BrownUn_UnCalifornia_ErikCorry -Files: src/stdlib/SDL_qsort.c -Copyright: 1998 Gareth McCaughan -License: Gareth_McCaughan - Files: src/test/SDL_test_md5.c -Copyright: 1997-2015 Sam Lantinga +Copyright: 1997-2016 Sam Lantinga 1990 RSA Data Security, Inc. License: zlib/libpng and RSA_Data_Security @@ -50,12 +46,12 @@ Copyright: 1994-2003 The XFree86 Project, Inc. License: MIT/X11 Files: test/testhaptic.c -Copyright: 1997-2015 Sam Lantinga +Copyright: 1997-2016 Sam Lantinga 2008 Edgar Simo Serra License: BSD_3_clause Files: test/testrumble.c -Copyright: 1997-2015 Sam Lantinga +Copyright: 1997-2016 Sam Lantinga 2011 Edgar Simo Serra License: BSD_3_clause @@ -173,7 +169,7 @@ License: BSD_3_clause (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Comment: - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga . This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -270,13 +266,6 @@ License: BrownUn_UnCalifornia_ErikCorry * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ -License: Gareth_McCaughan - You may use it in anything you like; you may make money - out of it; you may distribute it in object form or as - part of an executable without including source code; - you don't have to credit me. (But it would be nice if - you did.) - License: Johnson_M._Hart Permission is granted for any and all use providing that this copyright is properly acknowledged. diff --git a/libs/SDL2/debian/libsdl2-dev.install b/libs/SDL2/debian/libsdl2-dev.install index 7f99ff42..af2c5b19 100644 --- a/libs/SDL2/debian/libsdl2-dev.install +++ b/libs/SDL2/debian/libsdl2-dev.install @@ -5,4 +5,5 @@ usr/lib/*/libSDL2.a usr/lib/*/libSDL2main.a usr/lib/*/libSDL2_test.a usr/lib/*/pkgconfig/sdl2.pc +usr/lib/*/cmake/SDL2/sdl2-config.cmake usr/share/aclocal/sdl2.m4 diff --git a/libs/SDL2/docs/README-android.md b/libs/SDL2/docs/README-android.md index a4b38210..bf7b1cdc 100644 --- a/libs/SDL2/docs/README-android.md +++ b/libs/SDL2/docs/README-android.md @@ -67,13 +67,13 @@ For more complex projects, follow these instructions: 1. Copy the android-project directory wherever you want to keep your projects and rename it to the name of your project. -2. Move or symlink this SDL directory into the /jni directory -3. Edit /jni/src/Android.mk to include your source files +2. Move or symlink this SDL directory into the "/jni" directory +3. Edit "/jni/src/Android.mk" to include your source files 4. Run 'ndk-build' (a script provided by the NDK). This compiles the C source If you want to use the Eclipse IDE, skip to the Eclipse section below. -5. Create /local.properties and use that to point to the Android SDK directory, by writing a line with the following form: +5. Create "/local.properties" and use that to point to the Android SDK directory, by writing a line with the following form: sdk.dir=PATH_TO_ANDROID_SDK @@ -121,15 +121,15 @@ This build uses the Android NDK module system. Instructions: 1. Copy the android-project directory wherever you want to keep your projects and rename it to the name of your project. -2. Rename /jni/src/Android_static.mk to /jni/src/Android.mk +2. Rename "/jni/src/Android_static.mk" to "/jni/src/Android.mk" (overwrite the existing one) -3. Edit /jni/src/Android.mk to include your source files +3. Edit "/jni/src/Android.mk" to include your source files 4. create and export an environment variable named NDK_MODULE_PATH that points to the parent directory of this SDL directory. e.g.: export NDK_MODULE_PATH="$PWD"/.. -5. Edit /src/org/libsdl/app/SDLActivity.java and remove the call to +5. Edit "/src/org/libsdl/app/SDLActivity.java" and remove the call to System.loadLibrary("SDL2"). 6. Run 'ndk-build' (a script provided by the NDK). This compiles the C source diff --git a/libs/SDL2/docs/README-ios.md b/libs/SDL2/docs/README-ios.md index 69c35d6f..a0afffb1 100644 --- a/libs/SDL2/docs/README-ios.md +++ b/libs/SDL2/docs/README-ios.md @@ -47,17 +47,45 @@ Using the Simple DirectMedia Layer for iOS FIXME: This needs to be updated for the latest methods Here is the easiest method: -1. Build the SDL libraries (libSDL.a and libSDLSimulator.a) and the iPhone SDL Application template. -2. Install the iPhone SDL Application template by copying it to one of XCode's template directories. I recommend creating a directory called "SDL" in "/Developer/Platforms/iOS.platform/Developer/Library/XCode/Project Templates/" and placing it there. +1. Build the SDL library (libSDL2.a) and the iPhone SDL Application template. +2. Install the iPhone SDL Application template by copying it to one of Xcode's template directories. I recommend creating a directory called "SDL" in "/Developer/Platforms/iOS.platform/Developer/Library/Xcode/Project Templates/" and placing it there. 3. Start a new project using the template. The project should be immediately ready for use with SDL. Here is a more manual method: -1. Create a new iPhone view based application. -2. Build the SDL static libraries (libSDL.a and libSDLSimulator.a) for iPhone and include them in your project. XCode will ignore the library that is not currently of the correct architecture, hence your app will work both on iPhone and in the iPhone Simulator. +1. Create a new iOS view based application. +2. Build the SDL static library (libSDL2.a) for iOS and include them in your project. Xcode will ignore the library that is not currently of the correct architecture, hence your app will work both on iOS and in the iOS Simulator. 3. Include the SDL header files in your project. -4. Remove the ApplicationDelegate.h and ApplicationDelegate.m files -- SDL for iPhone provides its own UIApplicationDelegate. Remove MainWindow.xib -- SDL for iPhone produces its user interface programmatically. -5. Delete the contents of main.m and program your app as a regular SDL program instead. You may replace main.m with your own main.c, but you must tell XCode not to use the project prefix file, as it includes Objective-C code. +4. Remove the ApplicationDelegate.h and ApplicationDelegate.m files -- SDL for iOS provides its own UIApplicationDelegate. Remove MainWindow.xib -- SDL for iOS produces its user interface programmatically. +5. Delete the contents of main.m and program your app as a regular SDL program instead. You may replace main.m with your own main.c, but you must tell Xcode not to use the project prefix file, as it includes Objective-C code. +============================================================================== +Notes -- Retina / High-DPI and window sizes +============================================================================== + +Window and display mode sizes in SDL are in "screen coordinates" (or "points", +in Apple's terminology) rather than in pixels. On iOS this means that a window +created on an iPhone 6 will have a size in screen coordinates of 375 x 667, +rather than a size in pixels of 750 x 1334. All iOS apps are expected to +size their content based on screen coordinates / points rather than pixels, +as this allows different iOS devices to have different pixel densities +(Retina versus non-Retina screens, etc.) without apps caring too much. + +By default SDL will not use the full pixel density of the screen on +Retina/high-dpi capable devices. Use the SDL_WINDOW_ALLOW_HIGHDPI flag when +creating your window to enable high-dpi support. + +When high-dpi support is enabled, SDL_GetWindowSize and display mode sizes +will still be in "screen coordinates" rather than pixels, but the window will +have a much greater pixel density when the device supports it, and the +SDL_GL_GetDrawableSize or SDL_GetRendererOutputSize functions (depending on +whether raw OpenGL or the SDL_Render API is used) can be queried to determine +the size in pixels of the drawable screen framebuffer. + +Some OpenGL ES functions such as glViewport expect sizes in pixels rather than +sizes in screen coordinates. When doing 2D rendering with OpenGL ES, an +orthographic projection matrix using the size in screen coordinates +(SDL_GetWindowSize) can be used in order to display content at the same scale +no matter whether a Retina device is used or not. ============================================================================== Notes -- Application events @@ -203,7 +231,7 @@ Loading Shared Objects: Game Center ============================================================================== -Game Center integration requires that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using: +Game Center integration might require that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using: int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam); diff --git a/libs/SDL2/docs/README-macosx.md b/libs/SDL2/docs/README-macosx.md index 747e1e60..693e1947 100644 --- a/libs/SDL2/docs/README-macosx.md +++ b/libs/SDL2/docs/README-macosx.md @@ -96,7 +96,7 @@ APP_NAME_bundle: EXE_NAME You should replace EXE_NAME with the name of the executable. APP_NAME is what will be visible to the user in the Finder. Usually it will be the same as EXE_NAME but capitalized. E.g. if EXE_NAME is "testgame" then APP_NAME -usually is "TestGame". You might also want to use @PACKAGE@ to use the package +usually is "TestGame". You might also want to use `@PACKAGE@` to use the package name as specified in your configure.in file. If your project builds more than one application, you will have to do a bit diff --git a/libs/SDL2/docs/README-raspberrypi.md b/libs/SDL2/docs/README-raspberrypi.md index ade3c81c..6b6b785f 100644 --- a/libs/SDL2/docs/README-raspberrypi.md +++ b/libs/SDL2/docs/README-raspberrypi.md @@ -39,7 +39,7 @@ will be placed in /opt/rpi-tools You'll also need a Rasbian binary image. Get it from: http://downloads.raspberrypi.org/raspbian_latest -After unzipping, you'll get file with a name like: -wheezy-raspbian.img +After unzipping, you'll get file with a name like: "-wheezy-raspbian.img" Let's assume the sysroot will be built in /opt/rpi-sysroot. export SYSROOT=/opt/rpi-sysroot diff --git a/libs/SDL2/include/SDL.h b/libs/SDL2/include/SDL.h index 9d1ede33..7647b511 100644 --- a/libs/SDL2/include/SDL.h +++ b/libs/SDL2/include/SDL.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_assert.h b/libs/SDL2/include/SDL_assert.h index 6889514d..402981f9 100644 --- a/libs/SDL2/include/SDL_assert.h +++ b/libs/SDL2/include/SDL_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_atomic.h b/libs/SDL2/include/SDL_atomic.h index bb01eb9e..56aa81df 100644 --- a/libs/SDL2/include/SDL_atomic.h +++ b/libs/SDL2/include/SDL_atomic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_audio.h b/libs/SDL2/include/SDL_audio.h index 359005d0..4f655214 100644 --- a/libs/SDL2/include/SDL_audio.h +++ b/libs/SDL2/include/SDL_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_bits.h b/libs/SDL2/include/SDL_bits.h index c62766d9..528da2ea 100644 --- a/libs/SDL2/include/SDL_bits.h +++ b/libs/SDL2/include/SDL_bits.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_blendmode.h b/libs/SDL2/include/SDL_blendmode.h index c7fa09f7..56d8ad66 100644 --- a/libs/SDL2/include/SDL_blendmode.h +++ b/libs/SDL2/include/SDL_blendmode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_clipboard.h b/libs/SDL2/include/SDL_clipboard.h index 3ad20548..a5556f21 100644 --- a/libs/SDL2/include/SDL_clipboard.h +++ b/libs/SDL2/include/SDL_clipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_config.h b/libs/SDL2/include/SDL_config.h index eda76602..4270c78b 100644 --- a/libs/SDL2/include/SDL_config.h +++ b/libs/SDL2/include/SDL_config.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_config.h.cmake b/libs/SDL2/include/SDL_config.h.cmake index 7ddfb604..44173a05 100644 --- a/libs/SDL2/include/SDL_config.h.cmake +++ b/libs/SDL2/include/SDL_config.h.cmake @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_config.h.in b/libs/SDL2/include/SDL_config.h.in index 2c74868b..2071be4e 100644 --- a/libs/SDL2/include/SDL_config.h.in +++ b/libs/SDL2/include/SDL_config.h.in @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_config_android.h b/libs/SDL2/include/SDL_config_android.h index 8d5f1e5f..a388ba8d 100644 --- a/libs/SDL2/include/SDL_config_android.h +++ b/libs/SDL2/include/SDL_config_android.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_config_iphoneos.h b/libs/SDL2/include/SDL_config_iphoneos.h index 2d741c38..304c8920 100644 --- a/libs/SDL2/include/SDL_config_iphoneos.h +++ b/libs/SDL2/include/SDL_config_iphoneos.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_config_macosx.h b/libs/SDL2/include/SDL_config_macosx.h index e4ce82fc..5c8b7e03 100644 --- a/libs/SDL2/include/SDL_config_macosx.h +++ b/libs/SDL2/include/SDL_config_macosx.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_config_minimal.h b/libs/SDL2/include/SDL_config_minimal.h index 7721abc9..3c9d09af 100644 --- a/libs/SDL2/include/SDL_config_minimal.h +++ b/libs/SDL2/include/SDL_config_minimal.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_config_pandora.h b/libs/SDL2/include/SDL_config_pandora.h index 530e78f1..7b51e571 100644 --- a/libs/SDL2/include/SDL_config_pandora.h +++ b/libs/SDL2/include/SDL_config_pandora.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_config_psp.h b/libs/SDL2/include/SDL_config_psp.h index 26bf9d1a..a6e49609 100644 --- a/libs/SDL2/include/SDL_config_psp.h +++ b/libs/SDL2/include/SDL_config_psp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_config_windows.h b/libs/SDL2/include/SDL_config_windows.h index 067d7f31..890986cc 100644 --- a/libs/SDL2/include/SDL_config_windows.h +++ b/libs/SDL2/include/SDL_config_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_config_winrt.h b/libs/SDL2/include/SDL_config_winrt.h index 29bf79fe..e392f773 100644 --- a/libs/SDL2/include/SDL_config_winrt.h +++ b/libs/SDL2/include/SDL_config_winrt.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_config_wiz.h b/libs/SDL2/include/SDL_config_wiz.h index a5063ba7..e090a1a9 100644 --- a/libs/SDL2/include/SDL_config_wiz.h +++ b/libs/SDL2/include/SDL_config_wiz.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_copying.h b/libs/SDL2/include/SDL_copying.h index 6fd65219..212da0ee 100644 --- a/libs/SDL2/include/SDL_copying.h +++ b/libs/SDL2/include/SDL_copying.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_cpuinfo.h b/libs/SDL2/include/SDL_cpuinfo.h index 30d09cce..d0ba47bf 100644 --- a/libs/SDL2/include/SDL_cpuinfo.h +++ b/libs/SDL2/include/SDL_cpuinfo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_egl.h b/libs/SDL2/include/SDL_egl.h index 358d869b..bea2a6c0 100644 --- a/libs/SDL2/include/SDL_egl.h +++ b/libs/SDL2/include/SDL_egl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_endian.h b/libs/SDL2/include/SDL_endian.h index ec7841c4..9100b103 100644 --- a/libs/SDL2/include/SDL_endian.h +++ b/libs/SDL2/include/SDL_endian.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_error.h b/libs/SDL2/include/SDL_error.h index 1720c43f..2f3b4b50 100644 --- a/libs/SDL2/include/SDL_error.h +++ b/libs/SDL2/include/SDL_error.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_events.h b/libs/SDL2/include/SDL_events.h index 8a364c2a..edb89ef4 100644 --- a/libs/SDL2/include/SDL_events.h +++ b/libs/SDL2/include/SDL_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -136,6 +136,9 @@ typedef enum /* Drag and drop events */ SDL_DROPFILE = 0x1000, /**< The system requests a file open */ + SDL_DROPTEXT, /**< text/plain drag-and-drop event */ + SDL_DROPBEGIN, /**< A new set of drops is beginning (NULL filename) */ + SDL_DROPCOMPLETE, /**< Current set of drops is now complete (NULL filename) */ /* Audio hotplug events */ SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */ @@ -461,9 +464,10 @@ typedef struct SDL_DollarGestureEvent */ typedef struct SDL_DropEvent { - Uint32 type; /**< ::SDL_DROPFILE */ + Uint32 type; /**< ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE */ Uint32 timestamp; - char *file; /**< The file name, which should be freed with SDL_free() */ + char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */ + Uint32 windowID; /**< The window that was dropped on, if any */ } SDL_DropEvent; diff --git a/libs/SDL2/include/SDL_filesystem.h b/libs/SDL2/include/SDL_filesystem.h index 15bda498..02999ed2 100644 --- a/libs/SDL2/include/SDL_filesystem.h +++ b/libs/SDL2/include/SDL_filesystem.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_gamecontroller.h b/libs/SDL2/include/SDL_gamecontroller.h index 5459387b..42087eea 100644 --- a/libs/SDL2/include/SDL_gamecontroller.h +++ b/libs/SDL2/include/SDL_gamecontroller.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_gesture.h b/libs/SDL2/include/SDL_gesture.h index 44983486..3c29ca7a 100644 --- a/libs/SDL2/include/SDL_gesture.h +++ b/libs/SDL2/include/SDL_gesture.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_haptic.h b/libs/SDL2/include/SDL_haptic.h index 0e6f523b..b36d78b1 100644 --- a/libs/SDL2/include/SDL_haptic.h +++ b/libs/SDL2/include/SDL_haptic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_hints.h b/libs/SDL2/include/SDL_hints.h index c28cbad8..3bd5435f 100644 --- a/libs/SDL2/include/SDL_hints.h +++ b/libs/SDL2/include/SDL_hints.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_joystick.h b/libs/SDL2/include/SDL_joystick.h index 78176321..266f3b38 100644 --- a/libs/SDL2/include/SDL_joystick.h +++ b/libs/SDL2/include/SDL_joystick.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_keyboard.h b/libs/SDL2/include/SDL_keyboard.h index 1ad58ee3..bbba0f07 100644 --- a/libs/SDL2/include/SDL_keyboard.h +++ b/libs/SDL2/include/SDL_keyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_keycode.h b/libs/SDL2/include/SDL_keycode.h index 66980cef..7be96357 100644 --- a/libs/SDL2/include/SDL_keycode.h +++ b/libs/SDL2/include/SDL_keycode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_loadso.h b/libs/SDL2/include/SDL_loadso.h index db7493ad..3d540bd7 100644 --- a/libs/SDL2/include/SDL_loadso.h +++ b/libs/SDL2/include/SDL_loadso.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_log.h b/libs/SDL2/include/SDL_log.h index 6ffbfc99..09be1104 100644 --- a/libs/SDL2/include/SDL_log.h +++ b/libs/SDL2/include/SDL_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_main.h b/libs/SDL2/include/SDL_main.h index c5168ba6..9ce3754e 100644 --- a/libs/SDL2/include/SDL_main.h +++ b/libs/SDL2/include/SDL_main.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_messagebox.h b/libs/SDL2/include/SDL_messagebox.h index 44d458f4..ec370dbb 100644 --- a/libs/SDL2/include/SDL_messagebox.h +++ b/libs/SDL2/include/SDL_messagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_mouse.h b/libs/SDL2/include/SDL_mouse.h index 1ae31269..ea9622f0 100644 --- a/libs/SDL2/include/SDL_mouse.h +++ b/libs/SDL2/include/SDL_mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_mutex.h b/libs/SDL2/include/SDL_mutex.h index 2765210a..b7e39734 100644 --- a/libs/SDL2/include/SDL_mutex.h +++ b/libs/SDL2/include/SDL_mutex.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_name.h b/libs/SDL2/include/SDL_name.h index b6a413a2..06cd4a5e 100644 --- a/libs/SDL2/include/SDL_name.h +++ b/libs/SDL2/include/SDL_name.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_opengl.h b/libs/SDL2/include/SDL_opengl.h index aebe30eb..780919bc 100644 --- a/libs/SDL2/include/SDL_opengl.h +++ b/libs/SDL2/include/SDL_opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_opengles.h b/libs/SDL2/include/SDL_opengles.h index 49c709c1..bcc12777 100644 --- a/libs/SDL2/include/SDL_opengles.h +++ b/libs/SDL2/include/SDL_opengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_opengles2.h b/libs/SDL2/include/SDL_opengles2.h index 13ebd9dc..edcd1a24 100644 --- a/libs/SDL2/include/SDL_opengles2.h +++ b/libs/SDL2/include/SDL_opengles2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_pixels.h b/libs/SDL2/include/SDL_pixels.h index ba24a47d..8499c328 100644 --- a/libs/SDL2/include/SDL_pixels.h +++ b/libs/SDL2/include/SDL_pixels.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_platform.h b/libs/SDL2/include/SDL_platform.h index 75e4c653..c6c21398 100644 --- a/libs/SDL2/include/SDL_platform.h +++ b/libs/SDL2/include/SDL_platform.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_power.h b/libs/SDL2/include/SDL_power.h index 89eb1718..24c05011 100644 --- a/libs/SDL2/include/SDL_power.h +++ b/libs/SDL2/include/SDL_power.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_quit.h b/libs/SDL2/include/SDL_quit.h index 0108ff04..cc06f28d 100644 --- a/libs/SDL2/include/SDL_quit.h +++ b/libs/SDL2/include/SDL_quit.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_rect.h b/libs/SDL2/include/SDL_rect.h index ebe51674..bbcb9a3b 100644 --- a/libs/SDL2/include/SDL_rect.h +++ b/libs/SDL2/include/SDL_rect.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_render.h b/libs/SDL2/include/SDL_render.h index de2749cc..6e3daf52 100644 --- a/libs/SDL2/include/SDL_render.h +++ b/libs/SDL2/include/SDL_render.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -215,7 +215,7 @@ extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer, SDL_RendererInfo * info); /** - * \brief Get the output size of a rendering context. + * \brief Get the output size in pixels of a rendering context. */ extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer, int *w, int *h); @@ -499,6 +499,30 @@ extern DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer * renderer, in */ extern DECLSPEC void SDLCALL SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *h); +/** + * \brief Set whether to force integer scales for resolution-independent rendering + * + * \param renderer The renderer for which integer scaling should be set. + * \param enable Enable or disable integer scaling + * + * This function restricts the logical viewport to integer values - that is, when + * a resolution is between two multiples of a logical size, the viewport size is + * rounded down to the lower multiple. + * + * \sa SDL_RenderSetLogicalSize() + */ +extern DECLSPEC int SDLCALL SDL_RenderSetIntegerScale(SDL_Renderer * renderer, + SDL_bool enable); + +/** + * \brief Get whether integer scales are forced for resolution-independent rendering + * + * \param renderer The renderer from which integer scaling should be queried. + * + * \sa SDL_RenderSetIntegerScale() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_RenderGetIntegerScale(SDL_Renderer * renderer); + /** * \brief Set the drawing area for rendering on the current target. * diff --git a/libs/SDL2/include/SDL_rwops.h b/libs/SDL2/include/SDL_rwops.h index c8b024be..f460ae7d 100644 --- a/libs/SDL2/include/SDL_rwops.h +++ b/libs/SDL2/include/SDL_rwops.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_scancode.h b/libs/SDL2/include/SDL_scancode.h index 4bf86180..0af1dd59 100644 --- a/libs/SDL2/include/SDL_scancode.h +++ b/libs/SDL2/include/SDL_scancode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_shape.h b/libs/SDL2/include/SDL_shape.h index 157d6127..db10a8f0 100644 --- a/libs/SDL2/include/SDL_shape.h +++ b/libs/SDL2/include/SDL_shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_stdinc.h b/libs/SDL2/include/SDL_stdinc.h index c1f2b6dd..887bcd2d 100644 --- a/libs/SDL2/include/SDL_stdinc.h +++ b/libs/SDL2/include/SDL_stdinc.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_surface.h b/libs/SDL2/include/SDL_surface.h index 3634f7d3..e63ca890 100644 --- a/libs/SDL2/include/SDL_surface.h +++ b/libs/SDL2/include/SDL_surface.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_system.h b/libs/SDL2/include/SDL_system.h index bdc4f968..5da9adb4 100644 --- a/libs/SDL2/include/SDL_system.h +++ b/libs/SDL2/include/SDL_system.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_syswm.h b/libs/SDL2/include/SDL_syswm.h index a3441fdc..71ba5f1f 100644 --- a/libs/SDL2/include/SDL_syswm.h +++ b/libs/SDL2/include/SDL_syswm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -106,6 +106,10 @@ typedef struct ANativeWindow ANativeWindow; typedef void *EGLSurface; #endif +#if defined(SDL_VIDEO_DRIVER_VIVANTE) +#include "SDL_egl.h" +#endif + /** * These are the various supported windowing subsystems */ @@ -120,7 +124,8 @@ typedef enum SDL_SYSWM_WAYLAND, SDL_SYSWM_MIR, SDL_SYSWM_WINRT, - SDL_SYSWM_ANDROID + SDL_SYSWM_ANDROID, + SDL_SYSWM_VIVANTE } SDL_SYSWM_TYPE; /** @@ -166,6 +171,13 @@ struct SDL_SysWMmsg int dummy; /* No UIKit window events yet */ } uikit; +#endif +#if defined(SDL_VIDEO_DRIVER_VIVANTE) + struct + { + int dummy; + /* No Vivante window events yet */ + } vivante; #endif /* Can't have an empty union */ int dummy; @@ -259,6 +271,14 @@ struct SDL_SysWMinfo } android; #endif +#if defined(SDL_VIDEO_DRIVER_VIVANTE) + struct + { + EGLNativeDisplayType display; + EGLNativeWindowType window; + } vivante; +#endif + /* Can't have an empty union */ int dummy; } info; diff --git a/libs/SDL2/include/SDL_test.h b/libs/SDL2/include/SDL_test.h index 77b350bd..217847bf 100644 --- a/libs/SDL2/include/SDL_test.h +++ b/libs/SDL2/include/SDL_test.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_assert.h b/libs/SDL2/include/SDL_test_assert.h index a800a384..29277e12 100644 --- a/libs/SDL2/include/SDL_test_assert.h +++ b/libs/SDL2/include/SDL_test_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_common.h b/libs/SDL2/include/SDL_test_common.h index bb671fa5..0ebf31cb 100644 --- a/libs/SDL2/include/SDL_test_common.h +++ b/libs/SDL2/include/SDL_test_common.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_compare.h b/libs/SDL2/include/SDL_test_compare.h index bc121336..772cf9fb 100644 --- a/libs/SDL2/include/SDL_test_compare.h +++ b/libs/SDL2/include/SDL_test_compare.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_crc32.h b/libs/SDL2/include/SDL_test_crc32.h index cf9ea23d..572a3d95 100644 --- a/libs/SDL2/include/SDL_test_crc32.h +++ b/libs/SDL2/include/SDL_test_crc32.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_font.h b/libs/SDL2/include/SDL_test_font.h index 42696d74..3378ea85 100644 --- a/libs/SDL2/include/SDL_test_font.h +++ b/libs/SDL2/include/SDL_test_font.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_fuzzer.h b/libs/SDL2/include/SDL_test_fuzzer.h index 59c89a50..9603652b 100644 --- a/libs/SDL2/include/SDL_test_fuzzer.h +++ b/libs/SDL2/include/SDL_test_fuzzer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_harness.h b/libs/SDL2/include/SDL_test_harness.h index b3389315..74c0950c 100644 --- a/libs/SDL2/include/SDL_test_harness.h +++ b/libs/SDL2/include/SDL_test_harness.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_images.h b/libs/SDL2/include/SDL_test_images.h index 9b9f979b..8c64b4fe 100644 --- a/libs/SDL2/include/SDL_test_images.h +++ b/libs/SDL2/include/SDL_test_images.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_log.h b/libs/SDL2/include/SDL_test_log.h index 968d9b32..73a5c016 100644 --- a/libs/SDL2/include/SDL_test_log.h +++ b/libs/SDL2/include/SDL_test_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_md5.h b/libs/SDL2/include/SDL_test_md5.h index 52ea2c9a..f2d9a7d7 100644 --- a/libs/SDL2/include/SDL_test_md5.h +++ b/libs/SDL2/include/SDL_test_md5.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_random.h b/libs/SDL2/include/SDL_test_random.h index 925205df..91c36526 100644 --- a/libs/SDL2/include/SDL_test_random.h +++ b/libs/SDL2/include/SDL_test_random.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_thread.h b/libs/SDL2/include/SDL_thread.h index 797767f8..377e6c73 100644 --- a/libs/SDL2/include/SDL_thread.h +++ b/libs/SDL2/include/SDL_thread.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_timer.h b/libs/SDL2/include/SDL_timer.h index 1f2a0206..e0d3785e 100644 --- a/libs/SDL2/include/SDL_timer.h +++ b/libs/SDL2/include/SDL_timer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_touch.h b/libs/SDL2/include/SDL_touch.h index 68ff1714..2643e367 100644 --- a/libs/SDL2/include/SDL_touch.h +++ b/libs/SDL2/include/SDL_touch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_types.h b/libs/SDL2/include/SDL_types.h index 1a1877fa..5118af21 100644 --- a/libs/SDL2/include/SDL_types.h +++ b/libs/SDL2/include/SDL_types.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_version.h b/libs/SDL2/include/SDL_version.h index 0b364d07..de1f1605 100644 --- a/libs/SDL2/include/SDL_version.h +++ b/libs/SDL2/include/SDL_version.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_video.h b/libs/SDL2/include/SDL_video.h index f466165b..52179f3c 100644 --- a/libs/SDL2/include/SDL_video.h +++ b/libs/SDL2/include/SDL_video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -53,8 +53,8 @@ extern "C" { typedef struct { Uint32 format; /**< pixel format */ - int w; /**< width */ - int h; /**< height */ + int w; /**< width, in screen coordinates */ + int h; /**< height, in screen coordinates */ int refresh_rate; /**< refresh rate (or zero for unspecified) */ void *driverdata; /**< driver-specific data, initialize to 0 */ } SDL_DisplayMode; @@ -95,6 +95,7 @@ typedef struct SDL_Window SDL_Window; */ typedef enum { + /* !!! FIXME: change this to name = (1<0 - * \param h The height of the window, must be >0 + * \param w The width of the window, in screen coordinates. Must be >0. + * \param h The height of the window, in screen coordinates. Must be >0. * * \note You can't change the size of a fullscreen window, it automatically * matches the size of the display mode. * + * The window size in screen coordinates may differ from the size in pixels, if + * the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with + * high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or + * SDL_GetRendererOutputSize() to get the real client area size in pixels. + * * \sa SDL_GetWindowSize() */ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w, @@ -556,14 +597,40 @@ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w, * \brief Get the size of a window's client area. * * \param window The window to query. - * \param w Pointer to variable for storing the width, may be NULL - * \param h Pointer to variable for storing the height, may be NULL + * \param w Pointer to variable for storing the width, in screen + * coordinates. May be NULL. + * \param h Pointer to variable for storing the height, in screen + * coordinates. May be NULL. + * + * The window size in screen coordinates may differ from the size in pixels, if + * the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with + * high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or + * SDL_GetRendererOutputSize() to get the real client area size in pixels. * * \sa SDL_SetWindowSize() */ extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w, int *h); +/** + * \brief Get the size of a window's borders (decorations) around the client area. + * + * \param window The window to query. + * \param top Pointer to variable for storing the size of the top border. NULL is permitted. + * \param left Pointer to variable for storing the size of the left border. NULL is permitted. + * \param bottom Pointer to variable for storing the size of the bottom border. NULL is permitted. + * \param right Pointer to variable for storing the size of the right border. NULL is permitted. + * + * \return 0 on success, or -1 if getting this information is not supported. + * + * \note if this function fails (returns -1), the size values will be + * initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as + * if the window in question was borderless. + */ +extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window * window, + int *top, int *left, + int *bottom, int *right); + /** * \brief Set the minimum size of a window's client area. * @@ -779,6 +846,58 @@ extern DECLSPEC int SDLCALL SDL_SetWindowBrightness(SDL_Window * window, float b */ extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window); +/** + * \brief Set the opacity for a window + * + * \param window The window which will be made transparent or opaque + * \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be + * clamped internally between 0.0f and 1.0f. + * + * \return 0 on success, or -1 if setting the opacity isn't supported. + * + * \sa SDL_GetWindowOpacity() + */ +extern DECLSPEC int SDLCALL SDL_SetWindowOpacity(SDL_Window * window, float opacity); + +/** + * \brief Get the opacity of a window. + * + * If transparency isn't supported on this platform, opacity will be reported + * as 1.0f without error. + * + * \param window The window in question. + * \param out_opacity Opacity (0.0f - transparent, 1.0f - opaque) + * + * \return 0 on success, or -1 on error (invalid window, etc). + * + * \sa SDL_SetWindowOpacity() + */ +extern DECLSPEC int SDLCALL SDL_GetWindowOpacity(SDL_Window * window, float * out_opacity); + +/** + * \brief Sets the window as a modal for another window (TODO: reconsider this function and/or its name) + * + * \param modal_window The window that should be modal + * \param parent_window The parent window + * + * \return 0 on success, or -1 otherwise. + */ +extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window); + +/** + * \brief Explicitly sets input focus to the window. + * + * You almost certainly want SDL_RaiseWindow() instead of this function. Use + * this with caution, as you might give focus to a window that's completely + * obscured by other windows. + * + * \param window The window that should get the input focus + * + * \return 0 on success, or -1 otherwise. + * \sa SDL_RaiseWindow() + */ +extern DECLSPEC int SDLCALL SDL_SetWindowInputFocus(SDL_Window * window); + /** * \brief Set the gamma ramp for a window. * @@ -1009,11 +1128,12 @@ extern DECLSPEC SDL_Window* SDLCALL SDL_GL_GetCurrentWindow(void); extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void); /** - * \brief Get the size of a window's underlying drawable (for use with glViewport). + * \brief Get the size of a window's underlying drawable in pixels (for use + * with glViewport). * * \param window Window from which the drawable size should be queried - * \param w Pointer to variable for storing the width, may be NULL - * \param h Pointer to variable for storing the height, may be NULL + * \param w Pointer to variable for storing the width in pixels, may be NULL + * \param h Pointer to variable for storing the height in pixels, may be NULL * * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a diff --git a/libs/SDL2/include/begin_code.h b/libs/SDL2/include/begin_code.h index c032400f..04e78c64 100644 --- a/libs/SDL2/include/begin_code.h +++ b/libs/SDL2/include/begin_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/close_code.h b/libs/SDL2/include/close_code.h index 73f6c818..d908b00e 100644 --- a/libs/SDL2/include/close_code.h +++ b/libs/SDL2/include/close_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/Linux/SDL_config_premake.h b/libs/SDL2/premake/Linux/SDL_config_premake.h index c865684b..1bc2e4d7 100644 --- a/libs/SDL2/premake/Linux/SDL_config_premake.h +++ b/libs/SDL2/premake/Linux/SDL_config_premake.h @@ -1,7 +1,7 @@ /* include/SDL_config.h. Generated from SDL_config.h.in by configure. */ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/MinGW/SDL_config_premake.h b/libs/SDL2/premake/MinGW/SDL_config_premake.h index 7ec79a3b..cf8c1651 100644 --- a/libs/SDL2/premake/MinGW/SDL_config_premake.h +++ b/libs/SDL2/premake/MinGW/SDL_config_premake.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/VisualC/VS2008/SDL_config_premake.h b/libs/SDL2/premake/VisualC/VS2008/SDL_config_premake.h index 7139c23c..8d1d31d9 100644 --- a/libs/SDL2/premake/VisualC/VS2008/SDL_config_premake.h +++ b/libs/SDL2/premake/VisualC/VS2008/SDL_config_premake.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/VisualC/VS2010/SDL_config_premake.h b/libs/SDL2/premake/VisualC/VS2010/SDL_config_premake.h index 7139c23c..8d1d31d9 100644 --- a/libs/SDL2/premake/VisualC/VS2010/SDL_config_premake.h +++ b/libs/SDL2/premake/VisualC/VS2010/SDL_config_premake.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/VisualC/VS2012/SDL_config_premake.h b/libs/SDL2/premake/VisualC/VS2012/SDL_config_premake.h index 7139c23c..8d1d31d9 100644 --- a/libs/SDL2/premake/VisualC/VS2012/SDL_config_premake.h +++ b/libs/SDL2/premake/VisualC/VS2012/SDL_config_premake.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/Xcode-iOS/SDL_config_premake.h b/libs/SDL2/premake/Xcode-iOS/SDL_config_premake.h index 47b47ef7..c4a8a1bf 100644 --- a/libs/SDL2/premake/Xcode-iOS/SDL_config_premake.h +++ b/libs/SDL2/premake/Xcode-iOS/SDL_config_premake.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/Xcode/Xcode3/SDL_config_premake.h b/libs/SDL2/premake/Xcode/Xcode3/SDL_config_premake.h index 878b3c20..35da85c7 100644 --- a/libs/SDL2/premake/Xcode/Xcode3/SDL_config_premake.h +++ b/libs/SDL2/premake/Xcode/Xcode3/SDL_config_premake.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/Xcode/Xcode4/SDL_config_premake.h b/libs/SDL2/premake/Xcode/Xcode4/SDL_config_premake.h index 878b3c20..35da85c7 100644 --- a/libs/SDL2/premake/Xcode/Xcode4/SDL_config_premake.h +++ b/libs/SDL2/premake/Xcode/Xcode4/SDL_config_premake.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/config/SDL_config_cygwin.template.h b/libs/SDL2/premake/config/SDL_config_cygwin.template.h index 8f38d44c..b5886707 100644 --- a/libs/SDL2/premake/config/SDL_config_cygwin.template.h +++ b/libs/SDL2/premake/config/SDL_config_cygwin.template.h @@ -1,7 +1,7 @@ /* include/SDL_config.h. Generated from SDL_config.h.in by configure. */ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/config/SDL_config_iphoneos.template.h b/libs/SDL2/premake/config/SDL_config_iphoneos.template.h index 2a965947..956e40a7 100644 --- a/libs/SDL2/premake/config/SDL_config_iphoneos.template.h +++ b/libs/SDL2/premake/config/SDL_config_iphoneos.template.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/config/SDL_config_linux.template.h b/libs/SDL2/premake/config/SDL_config_linux.template.h index d35037cf..9b530c9d 100644 --- a/libs/SDL2/premake/config/SDL_config_linux.template.h +++ b/libs/SDL2/premake/config/SDL_config_linux.template.h @@ -1,7 +1,7 @@ /* include/SDL_config.h. Generated from SDL_config.h.in by configure. */ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/config/SDL_config_macosx.template.h b/libs/SDL2/premake/config/SDL_config_macosx.template.h index 1a4d8d56..7c25d9bc 100644 --- a/libs/SDL2/premake/config/SDL_config_macosx.template.h +++ b/libs/SDL2/premake/config/SDL_config_macosx.template.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/config/SDL_config_minimal.template.h b/libs/SDL2/premake/config/SDL_config_minimal.template.h index adf60ed9..f209a09f 100644 --- a/libs/SDL2/premake/config/SDL_config_minimal.template.h +++ b/libs/SDL2/premake/config/SDL_config_minimal.template.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/config/SDL_config_windows.template.h b/libs/SDL2/premake/config/SDL_config_windows.template.h index 9274f620..25b68a55 100644 --- a/libs/SDL2/premake/config/SDL_config_windows.template.h +++ b/libs/SDL2/premake/config/SDL_config_windows.template.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/premake4.lua b/libs/SDL2/premake/premake4.lua index eb2dfcd1..1202c0e9 100755 --- a/libs/SDL2/premake/premake4.lua +++ b/libs/SDL2/premake/premake4.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/SDL2.lua b/libs/SDL2/premake/projects/SDL2.lua index 923f953a..ef946f4e 100755 --- a/libs/SDL2/premake/projects/SDL2.lua +++ b/libs/SDL2/premake/projects/SDL2.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/SDL2main.lua b/libs/SDL2/premake/projects/SDL2main.lua index 771a169c..3dffb52a 100755 --- a/libs/SDL2/premake/projects/SDL2main.lua +++ b/libs/SDL2/premake/projects/SDL2main.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/SDL2test.lua b/libs/SDL2/premake/projects/SDL2test.lua index 0ac6382c..9bf9664c 100755 --- a/libs/SDL2/premake/projects/SDL2test.lua +++ b/libs/SDL2/premake/projects/SDL2test.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/accelerometer.lua b/libs/SDL2/premake/projects/accelerometer.lua index df24a7ba..d5cb18ea 100755 --- a/libs/SDL2/premake/projects/accelerometer.lua +++ b/libs/SDL2/premake/projects/accelerometer.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/checkkeys.lua b/libs/SDL2/premake/projects/checkkeys.lua index e1709403..0711d33d 100755 --- a/libs/SDL2/premake/projects/checkkeys.lua +++ b/libs/SDL2/premake/projects/checkkeys.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/fireworks.lua b/libs/SDL2/premake/projects/fireworks.lua index 110c6547..dd0b84a6 100755 --- a/libs/SDL2/premake/projects/fireworks.lua +++ b/libs/SDL2/premake/projects/fireworks.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/happy.lua b/libs/SDL2/premake/projects/happy.lua index b2764801..37839ae7 100755 --- a/libs/SDL2/premake/projects/happy.lua +++ b/libs/SDL2/premake/projects/happy.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/keyboard.lua b/libs/SDL2/premake/projects/keyboard.lua index 6cd31d1b..22d6f8fb 100755 --- a/libs/SDL2/premake/projects/keyboard.lua +++ b/libs/SDL2/premake/projects/keyboard.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/loopwave.lua b/libs/SDL2/premake/projects/loopwave.lua index 391dbdad..cf02865b 100755 --- a/libs/SDL2/premake/projects/loopwave.lua +++ b/libs/SDL2/premake/projects/loopwave.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/mixer.lua b/libs/SDL2/premake/projects/mixer.lua index bfcd5e64..af571829 100755 --- a/libs/SDL2/premake/projects/mixer.lua +++ b/libs/SDL2/premake/projects/mixer.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/rectangles.lua b/libs/SDL2/premake/projects/rectangles.lua index 071f8383..0721d32e 100755 --- a/libs/SDL2/premake/projects/rectangles.lua +++ b/libs/SDL2/premake/projects/rectangles.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testatomic.lua b/libs/SDL2/premake/projects/testatomic.lua index ecf5adb4..5b039b81 100755 --- a/libs/SDL2/premake/projects/testatomic.lua +++ b/libs/SDL2/premake/projects/testatomic.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testaudioinfo.lua b/libs/SDL2/premake/projects/testaudioinfo.lua index 9ee89f48..cee89424 100755 --- a/libs/SDL2/premake/projects/testaudioinfo.lua +++ b/libs/SDL2/premake/projects/testaudioinfo.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testautomation.lua b/libs/SDL2/premake/projects/testautomation.lua index 43e6dd83..ebaece77 100755 --- a/libs/SDL2/premake/projects/testautomation.lua +++ b/libs/SDL2/premake/projects/testautomation.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testdraw2.lua b/libs/SDL2/premake/projects/testdraw2.lua index 2431484f..29ab2909 100755 --- a/libs/SDL2/premake/projects/testdraw2.lua +++ b/libs/SDL2/premake/projects/testdraw2.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testdrawchessboard.lua b/libs/SDL2/premake/projects/testdrawchessboard.lua index b074d7f4..90b8b654 100755 --- a/libs/SDL2/premake/projects/testdrawchessboard.lua +++ b/libs/SDL2/premake/projects/testdrawchessboard.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testerror.lua b/libs/SDL2/premake/projects/testerror.lua index 17b7638f..cfea1e1f 100755 --- a/libs/SDL2/premake/projects/testerror.lua +++ b/libs/SDL2/premake/projects/testerror.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testfile.lua b/libs/SDL2/premake/projects/testfile.lua index 8ed28188..6c53c047 100755 --- a/libs/SDL2/premake/projects/testfile.lua +++ b/libs/SDL2/premake/projects/testfile.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testfilesystem.lua b/libs/SDL2/premake/projects/testfilesystem.lua index f135bbd4..f152c2e4 100755 --- a/libs/SDL2/premake/projects/testfilesystem.lua +++ b/libs/SDL2/premake/projects/testfilesystem.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testgamecontroller.lua b/libs/SDL2/premake/projects/testgamecontroller.lua index 322654f6..248f8f84 100755 --- a/libs/SDL2/premake/projects/testgamecontroller.lua +++ b/libs/SDL2/premake/projects/testgamecontroller.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testgesture.lua b/libs/SDL2/premake/projects/testgesture.lua index 2a8ca3dc..7d53d4bc 100755 --- a/libs/SDL2/premake/projects/testgesture.lua +++ b/libs/SDL2/premake/projects/testgesture.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testgl2.lua b/libs/SDL2/premake/projects/testgl2.lua index b2a4e64a..ba0bd257 100755 --- a/libs/SDL2/premake/projects/testgl2.lua +++ b/libs/SDL2/premake/projects/testgl2.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testgles.lua b/libs/SDL2/premake/projects/testgles.lua index de180d47..a5794a41 100755 --- a/libs/SDL2/premake/projects/testgles.lua +++ b/libs/SDL2/premake/projects/testgles.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testhaptic.lua b/libs/SDL2/premake/projects/testhaptic.lua index a230f923..8d7d2ca9 100755 --- a/libs/SDL2/premake/projects/testhaptic.lua +++ b/libs/SDL2/premake/projects/testhaptic.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testiconv.lua b/libs/SDL2/premake/projects/testiconv.lua index db4ca57c..be13254f 100755 --- a/libs/SDL2/premake/projects/testiconv.lua +++ b/libs/SDL2/premake/projects/testiconv.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testime.lua b/libs/SDL2/premake/projects/testime.lua index dbcc7d18..5e026092 100755 --- a/libs/SDL2/premake/projects/testime.lua +++ b/libs/SDL2/premake/projects/testime.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testintersection.lua b/libs/SDL2/premake/projects/testintersection.lua index 0e910285..2252ea64 100755 --- a/libs/SDL2/premake/projects/testintersection.lua +++ b/libs/SDL2/premake/projects/testintersection.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testjoystick.lua b/libs/SDL2/premake/projects/testjoystick.lua index d6c6ca3c..c93efc84 100755 --- a/libs/SDL2/premake/projects/testjoystick.lua +++ b/libs/SDL2/premake/projects/testjoystick.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testkeys.lua b/libs/SDL2/premake/projects/testkeys.lua index 33753f2e..67175978 100755 --- a/libs/SDL2/premake/projects/testkeys.lua +++ b/libs/SDL2/premake/projects/testkeys.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testloadso.lua b/libs/SDL2/premake/projects/testloadso.lua index cc38996c..1ce3a069 100755 --- a/libs/SDL2/premake/projects/testloadso.lua +++ b/libs/SDL2/premake/projects/testloadso.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testlock.lua b/libs/SDL2/premake/projects/testlock.lua index 22afa3ef..0a7a9046 100755 --- a/libs/SDL2/premake/projects/testlock.lua +++ b/libs/SDL2/premake/projects/testlock.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testmessage.lua b/libs/SDL2/premake/projects/testmessage.lua index 4bcc976a..ac505fd4 100755 --- a/libs/SDL2/premake/projects/testmessage.lua +++ b/libs/SDL2/premake/projects/testmessage.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testmultiaudio.lua b/libs/SDL2/premake/projects/testmultiaudio.lua index ef7c86df..ed756cee 100755 --- a/libs/SDL2/premake/projects/testmultiaudio.lua +++ b/libs/SDL2/premake/projects/testmultiaudio.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testnative.lua b/libs/SDL2/premake/projects/testnative.lua index b9b22d74..346bf88a 100755 --- a/libs/SDL2/premake/projects/testnative.lua +++ b/libs/SDL2/premake/projects/testnative.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testoverlay2.lua b/libs/SDL2/premake/projects/testoverlay2.lua index 00d1c4e2..c9ef4ab9 100755 --- a/libs/SDL2/premake/projects/testoverlay2.lua +++ b/libs/SDL2/premake/projects/testoverlay2.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testplatform.lua b/libs/SDL2/premake/projects/testplatform.lua index 4715fd75..8fc2c316 100755 --- a/libs/SDL2/premake/projects/testplatform.lua +++ b/libs/SDL2/premake/projects/testplatform.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testpower.lua b/libs/SDL2/premake/projects/testpower.lua index 391f9503..45f07a9f 100755 --- a/libs/SDL2/premake/projects/testpower.lua +++ b/libs/SDL2/premake/projects/testpower.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testrelative.lua b/libs/SDL2/premake/projects/testrelative.lua index c72c5e1a..83f076c9 100755 --- a/libs/SDL2/premake/projects/testrelative.lua +++ b/libs/SDL2/premake/projects/testrelative.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testrendercopyex.lua b/libs/SDL2/premake/projects/testrendercopyex.lua index 768e7ff0..7717d6cc 100755 --- a/libs/SDL2/premake/projects/testrendercopyex.lua +++ b/libs/SDL2/premake/projects/testrendercopyex.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testrendertarget.lua b/libs/SDL2/premake/projects/testrendertarget.lua index 4a2968e4..605f99e0 100755 --- a/libs/SDL2/premake/projects/testrendertarget.lua +++ b/libs/SDL2/premake/projects/testrendertarget.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testresample.lua b/libs/SDL2/premake/projects/testresample.lua index beb379ce..25bbcd81 100755 --- a/libs/SDL2/premake/projects/testresample.lua +++ b/libs/SDL2/premake/projects/testresample.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testrumble.lua b/libs/SDL2/premake/projects/testrumble.lua index 30eecf7e..865a8324 100755 --- a/libs/SDL2/premake/projects/testrumble.lua +++ b/libs/SDL2/premake/projects/testrumble.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testscale.lua b/libs/SDL2/premake/projects/testscale.lua index 7508e5b1..09268749 100755 --- a/libs/SDL2/premake/projects/testscale.lua +++ b/libs/SDL2/premake/projects/testscale.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testsem.lua b/libs/SDL2/premake/projects/testsem.lua index b53a68ea..2f723c52 100755 --- a/libs/SDL2/premake/projects/testsem.lua +++ b/libs/SDL2/premake/projects/testsem.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testshader.lua b/libs/SDL2/premake/projects/testshader.lua index cda0baaa..9e0c92e4 100755 --- a/libs/SDL2/premake/projects/testshader.lua +++ b/libs/SDL2/premake/projects/testshader.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testshape.lua b/libs/SDL2/premake/projects/testshape.lua index b78de30a..fd57e674 100755 --- a/libs/SDL2/premake/projects/testshape.lua +++ b/libs/SDL2/premake/projects/testshape.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testsprite2.lua b/libs/SDL2/premake/projects/testsprite2.lua index 5096f3f3..05bab7ce 100755 --- a/libs/SDL2/premake/projects/testsprite2.lua +++ b/libs/SDL2/premake/projects/testsprite2.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testspriteminimal.lua b/libs/SDL2/premake/projects/testspriteminimal.lua index 847d8bb4..0a21e462 100755 --- a/libs/SDL2/premake/projects/testspriteminimal.lua +++ b/libs/SDL2/premake/projects/testspriteminimal.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/teststreaming.lua b/libs/SDL2/premake/projects/teststreaming.lua index a3410134..99c77a06 100755 --- a/libs/SDL2/premake/projects/teststreaming.lua +++ b/libs/SDL2/premake/projects/teststreaming.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testthread.lua b/libs/SDL2/premake/projects/testthread.lua index f1404f99..59ae45d3 100755 --- a/libs/SDL2/premake/projects/testthread.lua +++ b/libs/SDL2/premake/projects/testthread.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testtimer.lua b/libs/SDL2/premake/projects/testtimer.lua index 039dff96..22d89a75 100755 --- a/libs/SDL2/premake/projects/testtimer.lua +++ b/libs/SDL2/premake/projects/testtimer.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testver.lua b/libs/SDL2/premake/projects/testver.lua index 70aba2dd..653d0e6e 100755 --- a/libs/SDL2/premake/projects/testver.lua +++ b/libs/SDL2/premake/projects/testver.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/testwm2.lua b/libs/SDL2/premake/projects/testwm2.lua index 12e62457..502f7a11 100755 --- a/libs/SDL2/premake/projects/testwm2.lua +++ b/libs/SDL2/premake/projects/testwm2.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/torturethread.lua b/libs/SDL2/premake/projects/torturethread.lua index eca1b044..bb7202a8 100755 --- a/libs/SDL2/premake/projects/torturethread.lua +++ b/libs/SDL2/premake/projects/torturethread.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/projects/touch.lua b/libs/SDL2/premake/projects/touch.lua index da9f98dc..85c04282 100755 --- a/libs/SDL2/premake/projects/touch.lua +++ b/libs/SDL2/premake/projects/touch.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/util/sdl_check_compile.lua b/libs/SDL2/premake/util/sdl_check_compile.lua index 668754a5..c3733355 100755 --- a/libs/SDL2/premake/util/sdl_check_compile.lua +++ b/libs/SDL2/premake/util/sdl_check_compile.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/util/sdl_dependency_checkers.lua b/libs/SDL2/premake/util/sdl_dependency_checkers.lua index 2e8e7fcd..0ebbc2dd 100755 --- a/libs/SDL2/premake/util/sdl_dependency_checkers.lua +++ b/libs/SDL2/premake/util/sdl_dependency_checkers.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/util/sdl_depends.lua b/libs/SDL2/premake/util/sdl_depends.lua index c7367971..af595436 100755 --- a/libs/SDL2/premake/util/sdl_depends.lua +++ b/libs/SDL2/premake/util/sdl_depends.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/util/sdl_file.lua b/libs/SDL2/premake/util/sdl_file.lua index 74a15e57..2fe1b924 100755 --- a/libs/SDL2/premake/util/sdl_file.lua +++ b/libs/SDL2/premake/util/sdl_file.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/util/sdl_gen_config.lua b/libs/SDL2/premake/util/sdl_gen_config.lua index 0e030c46..f0873e52 100755 --- a/libs/SDL2/premake/util/sdl_gen_config.lua +++ b/libs/SDL2/premake/util/sdl_gen_config.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/util/sdl_projects.lua b/libs/SDL2/premake/util/sdl_projects.lua index ec26fbf3..6e94019f 100755 --- a/libs/SDL2/premake/util/sdl_projects.lua +++ b/libs/SDL2/premake/util/sdl_projects.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/premake/util/sdl_string.lua b/libs/SDL2/premake/util/sdl_string.lua index aa3b5895..d2b9a583 100755 --- a/libs/SDL2/premake/util/sdl_string.lua +++ b/libs/SDL2/premake/util/sdl_string.lua @@ -1,4 +1,4 @@ --- Copyright (C) 1997-2015 Sam Lantinga +-- Copyright (C) 1997-2016 Sam Lantinga -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/SDL.c b/libs/SDL2/src/SDL.c index 6318bbe6..5d310021 100644 --- a/libs/SDL2/src/SDL.c +++ b/libs/SDL2/src/SDL.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/SDL_assert.c b/libs/SDL2/src/SDL_assert.c index e1d267a9..a21f70b6 100644 --- a/libs/SDL2/src/SDL_assert.c +++ b/libs/SDL2/src/SDL_assert.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/SDL_assert_c.h b/libs/SDL2/src/SDL_assert_c.h index 6f05c925..bc3b631e 100644 --- a/libs/SDL2/src/SDL_assert_c.h +++ b/libs/SDL2/src/SDL_assert_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/SDL_error.c b/libs/SDL2/src/SDL_error.c index 79e9347a..ace5cc39 100644 --- a/libs/SDL2/src/SDL_error.c +++ b/libs/SDL2/src/SDL_error.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/SDL_error_c.h b/libs/SDL2/src/SDL_error_c.h index 946281d2..76ccf2b9 100644 --- a/libs/SDL2/src/SDL_error_c.h +++ b/libs/SDL2/src/SDL_error_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/SDL_hints.c b/libs/SDL2/src/SDL_hints.c index 7026ac5d..04523327 100644 --- a/libs/SDL2/src/SDL_hints.c +++ b/libs/SDL2/src/SDL_hints.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/SDL_internal.h b/libs/SDL2/src/SDL_internal.h index a3ccb363..7e928501 100644 --- a/libs/SDL2/src/SDL_internal.h +++ b/libs/SDL2/src/SDL_internal.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/SDL_log.c b/libs/SDL2/src/SDL_log.c index b5ab601e..60bac9f6 100644 --- a/libs/SDL2/src/SDL_log.c +++ b/libs/SDL2/src/SDL_log.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/atomic/SDL_atomic.c b/libs/SDL2/src/atomic/SDL_atomic.c index 30b4ccca..db86d6ed 100644 --- a/libs/SDL2/src/atomic/SDL_atomic.c +++ b/libs/SDL2/src/atomic/SDL_atomic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/atomic/SDL_spinlock.c b/libs/SDL2/src/atomic/SDL_spinlock.c index 1681aa78..f582afb4 100644 --- a/libs/SDL2/src/atomic/SDL_spinlock.c +++ b/libs/SDL2/src/atomic/SDL_spinlock.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/SDL_audio.c b/libs/SDL2/src/audio/SDL_audio.c index 04f1e7ec..2ffd216c 100644 --- a/libs/SDL2/src/audio/SDL_audio.c +++ b/libs/SDL2/src/audio/SDL_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/SDL_audio_c.h b/libs/SDL2/src/audio/SDL_audio_c.h index b1fab65f..b03a9156 100644 --- a/libs/SDL2/src/audio/SDL_audio_c.h +++ b/libs/SDL2/src/audio/SDL_audio_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/SDL_audiocvt.c b/libs/SDL2/src/audio/SDL_audiocvt.c index 092839b8..3b47c4cb 100644 --- a/libs/SDL2/src/audio/SDL_audiocvt.c +++ b/libs/SDL2/src/audio/SDL_audiocvt.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/SDL_audiodev.c b/libs/SDL2/src/audio/SDL_audiodev.c index dd89af74..5c392cfb 100644 --- a/libs/SDL2/src/audio/SDL_audiodev.c +++ b/libs/SDL2/src/audio/SDL_audiodev.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/SDL_audiodev_c.h b/libs/SDL2/src/audio/SDL_audiodev_c.h index 2208d9c4..fa60bcdb 100644 --- a/libs/SDL2/src/audio/SDL_audiodev_c.h +++ b/libs/SDL2/src/audio/SDL_audiodev_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/SDL_audiomem.h b/libs/SDL2/src/audio/SDL_audiomem.h index a65b44b7..091d15c2 100644 --- a/libs/SDL2/src/audio/SDL_audiomem.h +++ b/libs/SDL2/src/audio/SDL_audiomem.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/SDL_audiotypecvt.c b/libs/SDL2/src/audio/SDL_audiotypecvt.c index 1e3a6447..be3b7430 100644 --- a/libs/SDL2/src/audio/SDL_audiotypecvt.c +++ b/libs/SDL2/src/audio/SDL_audiotypecvt.c @@ -1,7 +1,7 @@ /* DO NOT EDIT! This file is generated by sdlgenaudiocvt.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/SDL_mixer.c b/libs/SDL2/src/audio/SDL_mixer.c index 38fda0bf..b49c73da 100644 --- a/libs/SDL2/src/audio/SDL_mixer.c +++ b/libs/SDL2/src/audio/SDL_mixer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/SDL_sysaudio.h b/libs/SDL2/src/audio/SDL_sysaudio.h index c220f582..426a190f 100644 --- a/libs/SDL2/src/audio/SDL_sysaudio.h +++ b/libs/SDL2/src/audio/SDL_sysaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/SDL_wave.c b/libs/SDL2/src/audio/SDL_wave.c index e898115c..99daac64 100644 --- a/libs/SDL2/src/audio/SDL_wave.c +++ b/libs/SDL2/src/audio/SDL_wave.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/SDL_wave.h b/libs/SDL2/src/audio/SDL_wave.h index ccfa0448..f2f93986 100644 --- a/libs/SDL2/src/audio/SDL_wave.h +++ b/libs/SDL2/src/audio/SDL_wave.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/alsa/SDL_alsa_audio.c b/libs/SDL2/src/audio/alsa/SDL_alsa_audio.c index fac51978..d0735957 100644 --- a/libs/SDL2/src/audio/alsa/SDL_alsa_audio.c +++ b/libs/SDL2/src/audio/alsa/SDL_alsa_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -85,6 +85,9 @@ static int (*ALSA_snd_pcm_nonblock) (snd_pcm_t *, int); static int (*ALSA_snd_pcm_wait)(snd_pcm_t *, int); static int (*ALSA_snd_pcm_sw_params_set_avail_min) (snd_pcm_t *, snd_pcm_sw_params_t *, snd_pcm_uframes_t); +static int (*ALSA_snd_device_name_hint) (int, const char *, void ***); +static char* (*ALSA_snd_device_name_get_hint) (const void *, const char *); +static int (*ALSA_snd_device_name_free_hint) (void **); #ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC #define snd_pcm_hw_params_sizeof ALSA_snd_pcm_hw_params_sizeof @@ -144,6 +147,10 @@ load_alsa_syms(void) SDL_ALSA_SYM(snd_pcm_nonblock); SDL_ALSA_SYM(snd_pcm_wait); SDL_ALSA_SYM(snd_pcm_sw_params_set_avail_min); + SDL_ALSA_SYM(snd_device_name_hint); + SDL_ALSA_SYM(snd_device_name_get_hint); + SDL_ALSA_SYM(snd_device_name_free_hint); + return 0; } @@ -196,25 +203,27 @@ LoadALSALibrary(void) #endif /* SDL_AUDIO_DRIVER_ALSA_DYNAMIC */ static const char * -get_audio_device(int channels) +get_audio_device(void *handle, const int channels) { const char *device; - device = SDL_getenv("AUDIODEV"); /* Is there a standard variable name? */ - if (device == NULL) { - switch (channels) { - case 6: - device = "plug:surround51"; - break; - case 4: - device = "plug:surround40"; - break; - default: - device = "default"; - break; - } + if (handle != NULL) { + return (const char *) handle; } - return device; + + /* !!! FIXME: we also check "SDL_AUDIO_DEVICE_NAME" at the higher level. */ + device = SDL_getenv("AUDIODEV"); /* Is there a standard variable name? */ + if (device != NULL) { + return device; + } + + if (channels == 6) { + return "plug:surround51"; + } else if (channels == 4) { + return "plug:surround40"; + } + + return "default"; } @@ -487,7 +496,7 @@ ALSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) /* Open the audio device */ /* Name of device should depend on # channels in spec */ status = ALSA_snd_pcm_open(&pcm_handle, - get_audio_device(this->spec.channels), + get_audio_device(handle, this->spec.channels), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); if (status < 0) { @@ -656,6 +665,79 @@ ALSA_Deinitialize(void) UnloadALSALibrary(); } +static void +add_device(const int iscapture, const char *name, const char *_desc) +{ + char *desc = SDL_strdup(_desc); + char *handle = NULL; + char *ptr; + + if (!desc) { + return; + } + + /* some strings have newlines, like "HDA NVidia, HDMI 0\nHDMI Audio Output" */ + for (ptr = strchr(desc, '\n'); ptr; ptr = strchr(ptr + 1, '\n')) { + *ptr = ' '; + } + + handle = SDL_strdup(name); + if (handle != NULL) { + SDL_AddAudioDevice(iscapture, desc, handle); + } + + SDL_free(desc); +} + +static void +ALSA_DetectDevices(void) +{ + void **hints = NULL; + int i; + + /* !!! FIXME: use udev instead. */ + /* We won't deal with disconnects and hotplugs without udev, but at least + you'll get a reasonable device list at startup. */ +#if 1 /*!SDL_USE_LIBUDEV */ + if (ALSA_snd_device_name_hint(-1, "pcm", &hints) == -1) { + return; /* oh well. */ + } + + for (i = 0; hints[i]; i++) { + char *name = ALSA_snd_device_name_get_hint(hints[i], "NAME"); + char *desc = ALSA_snd_device_name_get_hint(hints[i], "DESC"); + char *ioid = ALSA_snd_device_name_get_hint(hints[i], "IOID"); + + if ((ioid == NULL) || (SDL_strcmp(ioid, "Output") == 0)) { + add_device(SDL_FALSE, name, desc); + } + + if ((ioid == NULL) || (SDL_strcmp(ioid, "Input") == 0)) { + add_device(SDL_TRUE, name, desc); + } + + free(name); + free(desc); + free(ioid); + } + + ALSA_snd_device_name_free_hint(hints); +#else +#error Fill in udev support here. +#endif +} + +static void +ALSA_FreeDeviceHandle(void *handle) +{ +#if 1 /*!SDL_USE_LIBUDEV*/ + SDL_free(handle); +#else +#error Fill in udev support here. +#endif +} + + static int ALSA_Init(SDL_AudioDriverImpl * impl) { @@ -664,13 +746,14 @@ ALSA_Init(SDL_AudioDriverImpl * impl) } /* Set the function pointers */ + impl->DetectDevices = ALSA_DetectDevices; impl->OpenDevice = ALSA_OpenDevice; impl->WaitDevice = ALSA_WaitDevice; impl->GetDeviceBuf = ALSA_GetDeviceBuf; impl->PlayDevice = ALSA_PlayDevice; impl->CloseDevice = ALSA_CloseDevice; impl->Deinitialize = ALSA_Deinitialize; - impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: Add device enum! */ + impl->FreeDeviceHandle = ALSA_FreeDeviceHandle; return 1; /* this audio target is available. */ } diff --git a/libs/SDL2/src/audio/alsa/SDL_alsa_audio.h b/libs/SDL2/src/audio/alsa/SDL_alsa_audio.h index c5d3aeee..3080aea2 100644 --- a/libs/SDL2/src/audio/alsa/SDL_alsa_audio.h +++ b/libs/SDL2/src/audio/alsa/SDL_alsa_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/android/SDL_androidaudio.c b/libs/SDL2/src/audio/android/SDL_androidaudio.c index f35878cd..4a4faadc 100644 --- a/libs/SDL2/src/audio/android/SDL_androidaudio.c +++ b/libs/SDL2/src/audio/android/SDL_androidaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/android/SDL_androidaudio.h b/libs/SDL2/src/audio/android/SDL_androidaudio.h index 38bb1905..639be9c0 100644 --- a/libs/SDL2/src/audio/android/SDL_androidaudio.h +++ b/libs/SDL2/src/audio/android/SDL_androidaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/arts/SDL_artsaudio.c b/libs/SDL2/src/audio/arts/SDL_artsaudio.c index ca97c0af..5d40cd14 100644 --- a/libs/SDL2/src/audio/arts/SDL_artsaudio.c +++ b/libs/SDL2/src/audio/arts/SDL_artsaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/arts/SDL_artsaudio.h b/libs/SDL2/src/audio/arts/SDL_artsaudio.h index 54b86f6b..6b9bf303 100644 --- a/libs/SDL2/src/audio/arts/SDL_artsaudio.h +++ b/libs/SDL2/src/audio/arts/SDL_artsaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/bsd/SDL_bsdaudio.c b/libs/SDL2/src/audio/bsd/SDL_bsdaudio.c index b684f9eb..eeb25737 100644 --- a/libs/SDL2/src/audio/bsd/SDL_bsdaudio.c +++ b/libs/SDL2/src/audio/bsd/SDL_bsdaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/bsd/SDL_bsdaudio.h b/libs/SDL2/src/audio/bsd/SDL_bsdaudio.h index 7eee944f..7fe141b1 100644 --- a/libs/SDL2/src/audio/bsd/SDL_bsdaudio.h +++ b/libs/SDL2/src/audio/bsd/SDL_bsdaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/coreaudio/SDL_coreaudio.c b/libs/SDL2/src/audio/coreaudio/SDL_coreaudio.c index f75bc784..46b617dc 100644 --- a/libs/SDL2/src/audio/coreaudio/SDL_coreaudio.c +++ b/libs/SDL2/src/audio/coreaudio/SDL_coreaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/coreaudio/SDL_coreaudio.h b/libs/SDL2/src/audio/coreaudio/SDL_coreaudio.h index 119d2582..577f9fb3 100644 --- a/libs/SDL2/src/audio/coreaudio/SDL_coreaudio.h +++ b/libs/SDL2/src/audio/coreaudio/SDL_coreaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/directsound/SDL_directsound.c b/libs/SDL2/src/audio/directsound/SDL_directsound.c index 10c32f83..065e163a 100644 --- a/libs/SDL2/src/audio/directsound/SDL_directsound.c +++ b/libs/SDL2/src/audio/directsound/SDL_directsound.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/directsound/SDL_directsound.h b/libs/SDL2/src/audio/directsound/SDL_directsound.h index 718cbab3..0d5f6bd7 100644 --- a/libs/SDL2/src/audio/directsound/SDL_directsound.h +++ b/libs/SDL2/src/audio/directsound/SDL_directsound.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/disk/SDL_diskaudio.c b/libs/SDL2/src/audio/disk/SDL_diskaudio.c index ef8bc0dc..28745f9d 100644 --- a/libs/SDL2/src/audio/disk/SDL_diskaudio.c +++ b/libs/SDL2/src/audio/disk/SDL_diskaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/disk/SDL_diskaudio.h b/libs/SDL2/src/audio/disk/SDL_diskaudio.h index 0c1af3a5..b5666f7f 100644 --- a/libs/SDL2/src/audio/disk/SDL_diskaudio.h +++ b/libs/SDL2/src/audio/disk/SDL_diskaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/dsp/SDL_dspaudio.c b/libs/SDL2/src/audio/dsp/SDL_dspaudio.c index 678c74fe..17e029e1 100644 --- a/libs/SDL2/src/audio/dsp/SDL_dspaudio.c +++ b/libs/SDL2/src/audio/dsp/SDL_dspaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/dsp/SDL_dspaudio.h b/libs/SDL2/src/audio/dsp/SDL_dspaudio.h index 054c4d9a..0e4acfca 100644 --- a/libs/SDL2/src/audio/dsp/SDL_dspaudio.h +++ b/libs/SDL2/src/audio/dsp/SDL_dspaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/dummy/SDL_dummyaudio.c b/libs/SDL2/src/audio/dummy/SDL_dummyaudio.c index ec9c40fa..107f0b07 100644 --- a/libs/SDL2/src/audio/dummy/SDL_dummyaudio.c +++ b/libs/SDL2/src/audio/dummy/SDL_dummyaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/dummy/SDL_dummyaudio.h b/libs/SDL2/src/audio/dummy/SDL_dummyaudio.h index 9415c122..b1f88b1c 100644 --- a/libs/SDL2/src/audio/dummy/SDL_dummyaudio.h +++ b/libs/SDL2/src/audio/dummy/SDL_dummyaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/emscripten/SDL_emscriptenaudio.c b/libs/SDL2/src/audio/emscripten/SDL_emscriptenaudio.c index 792f12c1..8378233c 100644 --- a/libs/SDL2/src/audio/emscripten/SDL_emscriptenaudio.c +++ b/libs/SDL2/src/audio/emscripten/SDL_emscriptenaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/emscripten/SDL_emscriptenaudio.h b/libs/SDL2/src/audio/emscripten/SDL_emscriptenaudio.h index c3da6a02..cd5377d8 100644 --- a/libs/SDL2/src/audio/emscripten/SDL_emscriptenaudio.h +++ b/libs/SDL2/src/audio/emscripten/SDL_emscriptenaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/esd/SDL_esdaudio.c b/libs/SDL2/src/audio/esd/SDL_esdaudio.c index 906728cb..6a7882dc 100644 --- a/libs/SDL2/src/audio/esd/SDL_esdaudio.c +++ b/libs/SDL2/src/audio/esd/SDL_esdaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/esd/SDL_esdaudio.h b/libs/SDL2/src/audio/esd/SDL_esdaudio.h index ad8159ee..d362b16c 100644 --- a/libs/SDL2/src/audio/esd/SDL_esdaudio.h +++ b/libs/SDL2/src/audio/esd/SDL_esdaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/fusionsound/SDL_fsaudio.c b/libs/SDL2/src/audio/fusionsound/SDL_fsaudio.c index 6bab5a78..b22a3e9a 100644 --- a/libs/SDL2/src/audio/fusionsound/SDL_fsaudio.c +++ b/libs/SDL2/src/audio/fusionsound/SDL_fsaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/fusionsound/SDL_fsaudio.h b/libs/SDL2/src/audio/fusionsound/SDL_fsaudio.h index aa2ae192..5cf8a200 100644 --- a/libs/SDL2/src/audio/fusionsound/SDL_fsaudio.h +++ b/libs/SDL2/src/audio/fusionsound/SDL_fsaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/haiku/SDL_haikuaudio.cc b/libs/SDL2/src/audio/haiku/SDL_haikuaudio.cc index c4765e37..38f3b962 100644 --- a/libs/SDL2/src/audio/haiku/SDL_haikuaudio.cc +++ b/libs/SDL2/src/audio/haiku/SDL_haikuaudio.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/haiku/SDL_haikuaudio.h b/libs/SDL2/src/audio/haiku/SDL_haikuaudio.h index 21418618..23e5a765 100644 --- a/libs/SDL2/src/audio/haiku/SDL_haikuaudio.h +++ b/libs/SDL2/src/audio/haiku/SDL_haikuaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/nacl/SDL_naclaudio.c b/libs/SDL2/src/audio/nacl/SDL_naclaudio.c index 5c5b0bcf..2d1ee73e 100644 --- a/libs/SDL2/src/audio/nacl/SDL_naclaudio.c +++ b/libs/SDL2/src/audio/nacl/SDL_naclaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/nacl/SDL_naclaudio.h b/libs/SDL2/src/audio/nacl/SDL_naclaudio.h index c2636f0c..90ff5448 100644 --- a/libs/SDL2/src/audio/nacl/SDL_naclaudio.h +++ b/libs/SDL2/src/audio/nacl/SDL_naclaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/nas/SDL_nasaudio.c b/libs/SDL2/src/audio/nas/SDL_nasaudio.c index 596ca752..9de5ff8b 100644 --- a/libs/SDL2/src/audio/nas/SDL_nasaudio.c +++ b/libs/SDL2/src/audio/nas/SDL_nasaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/nas/SDL_nasaudio.h b/libs/SDL2/src/audio/nas/SDL_nasaudio.h index 715f1fb2..2f46b0b6 100644 --- a/libs/SDL2/src/audio/nas/SDL_nasaudio.h +++ b/libs/SDL2/src/audio/nas/SDL_nasaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/paudio/SDL_paudio.c b/libs/SDL2/src/audio/paudio/SDL_paudio.c index 79c71645..14c9701f 100644 --- a/libs/SDL2/src/audio/paudio/SDL_paudio.c +++ b/libs/SDL2/src/audio/paudio/SDL_paudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/paudio/SDL_paudio.h b/libs/SDL2/src/audio/paudio/SDL_paudio.h index 2bcb706c..ebc8bb5b 100644 --- a/libs/SDL2/src/audio/paudio/SDL_paudio.h +++ b/libs/SDL2/src/audio/paudio/SDL_paudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/psp/SDL_pspaudio.c b/libs/SDL2/src/audio/psp/SDL_pspaudio.c index 60b7993a..8f831141 100644 --- a/libs/SDL2/src/audio/psp/SDL_pspaudio.c +++ b/libs/SDL2/src/audio/psp/SDL_pspaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -66,20 +66,7 @@ PSPAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) this->spec.freq = 44100; /* Update the fragment size as size in bytes. */ -/* SDL_CalculateAudioSpec(this->spec); MOD */ - switch (this->spec.format) { - case AUDIO_U8: - this->spec.silence = 0x80; - break; - default: - this->spec.silence = 0x00; - break; - } - this->spec.size = SDL_AUDIO_BITSIZE(this->spec.format) / 8; - this->spec.size *= this->spec.channels; - this->spec.size *= this->spec.samples; - -/* ========================================== */ + SDL_CalculateAudioSpec(&this->spec); /* Allocate the mixing buffer. Its size and starting address must be a multiple of 64 bytes. Our sample count is already a multiple of diff --git a/libs/SDL2/src/audio/psp/SDL_pspaudio.h b/libs/SDL2/src/audio/psp/SDL_pspaudio.h index c6332744..6b266bd0 100644 --- a/libs/SDL2/src/audio/psp/SDL_pspaudio.h +++ b/libs/SDL2/src/audio/psp/SDL_pspaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.c b/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.c index 30ca984e..6b11e066 100644 --- a/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.c +++ b/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.h b/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.h index 995c53c6..c57ab713 100644 --- a/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.h +++ b/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/qsa/SDL_qsa_audio.c b/libs/SDL2/src/audio/qsa/SDL_qsa_audio.c index 784466ca..1899ca6d 100644 --- a/libs/SDL2/src/audio/qsa/SDL_qsa_audio.c +++ b/libs/SDL2/src/audio/qsa/SDL_qsa_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/qsa/SDL_qsa_audio.h b/libs/SDL2/src/audio/qsa/SDL_qsa_audio.h index 363feb47..53d37e96 100644 --- a/libs/SDL2/src/audio/qsa/SDL_qsa_audio.h +++ b/libs/SDL2/src/audio/qsa/SDL_qsa_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/sdlgenaudiocvt.pl b/libs/SDL2/src/audio/sdlgenaudiocvt.pl index b012df80..c53f1c35 100755 --- a/libs/SDL2/src/audio/sdlgenaudiocvt.pl +++ b/libs/SDL2/src/audio/sdlgenaudiocvt.pl @@ -38,7 +38,7 @@ sub outputHeader { /* DO NOT EDIT! This file is generated by sdlgenaudiocvt.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/sndio/SDL_sndioaudio.c b/libs/SDL2/src/audio/sndio/SDL_sndioaudio.c index ba4fc4fa..64565ae8 100644 --- a/libs/SDL2/src/audio/sndio/SDL_sndioaudio.c +++ b/libs/SDL2/src/audio/sndio/SDL_sndioaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/sndio/SDL_sndioaudio.h b/libs/SDL2/src/audio/sndio/SDL_sndioaudio.h index 6956674b..1e748ac9 100644 --- a/libs/SDL2/src/audio/sndio/SDL_sndioaudio.h +++ b/libs/SDL2/src/audio/sndio/SDL_sndioaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/sun/SDL_sunaudio.c b/libs/SDL2/src/audio/sun/SDL_sunaudio.c index 9cdefbdb..71029d21 100644 --- a/libs/SDL2/src/audio/sun/SDL_sunaudio.c +++ b/libs/SDL2/src/audio/sun/SDL_sunaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/sun/SDL_sunaudio.h b/libs/SDL2/src/audio/sun/SDL_sunaudio.h index 02ac6cbd..ecced0f5 100644 --- a/libs/SDL2/src/audio/sun/SDL_sunaudio.h +++ b/libs/SDL2/src/audio/sun/SDL_sunaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/winmm/SDL_winmm.c b/libs/SDL2/src/audio/winmm/SDL_winmm.c index 37debb90..6d05a65e 100644 --- a/libs/SDL2/src/audio/winmm/SDL_winmm.c +++ b/libs/SDL2/src/audio/winmm/SDL_winmm.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/winmm/SDL_winmm.h b/libs/SDL2/src/audio/winmm/SDL_winmm.h index a0dec010..401db398 100644 --- a/libs/SDL2/src/audio/winmm/SDL_winmm.h +++ b/libs/SDL2/src/audio/winmm/SDL_winmm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/xaudio2/SDL_xaudio2.c b/libs/SDL2/src/audio/xaudio2/SDL_xaudio2.c index 856a3c0d..dff234b4 100644 --- a/libs/SDL2/src/audio/xaudio2/SDL_xaudio2.c +++ b/libs/SDL2/src/audio/xaudio2/SDL_xaudio2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/xaudio2/SDL_xaudio2.h b/libs/SDL2/src/audio/xaudio2/SDL_xaudio2.h index a1a4b545..864eba45 100644 --- a/libs/SDL2/src/audio/xaudio2/SDL_xaudio2.h +++ b/libs/SDL2/src/audio/xaudio2/SDL_xaudio2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/xaudio2/SDL_xaudio2_winrthelpers.cpp b/libs/SDL2/src/audio/xaudio2/SDL_xaudio2_winrthelpers.cpp index e4fb8e84..b2d67c7f 100644 --- a/libs/SDL2/src/audio/xaudio2/SDL_xaudio2_winrthelpers.cpp +++ b/libs/SDL2/src/audio/xaudio2/SDL_xaudio2_winrthelpers.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/xaudio2/SDL_xaudio2_winrthelpers.h b/libs/SDL2/src/audio/xaudio2/SDL_xaudio2_winrthelpers.h index 6f14f17a..aa6486f9 100644 --- a/libs/SDL2/src/audio/xaudio2/SDL_xaudio2_winrthelpers.h +++ b/libs/SDL2/src/audio/xaudio2/SDL_xaudio2_winrthelpers.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/android/SDL_android.c b/libs/SDL2/src/core/android/SDL_android.c index be948d22..49843497 100644 --- a/libs/SDL2/src/core/android/SDL_android.c +++ b/libs/SDL2/src/core/android/SDL_android.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -144,8 +144,9 @@ void Java_org_libsdl_app_SDLActivity_onNativeDropFile( jstring filename) { const char *path = (*env)->GetStringUTFChars(env, filename, NULL); - SDL_SendDropFile(path); + SDL_SendDropFile(NULL, path); (*env)->ReleaseStringUTFChars(env, filename, path); + SDL_SendDropComplete(NULL); } /* Resize */ @@ -560,6 +561,7 @@ int Android_JNI_OpenAudioDevice(int sampleRate, int is16Bit, int channelCount, i { jboolean audioBufferStereo; int audioBufferFrames; + jboolean isCopy; JNIEnv *env = Android_JNI_GetEnv(); @@ -601,7 +603,7 @@ int Android_JNI_OpenAudioDevice(int sampleRate, int is16Bit, int channelCount, i return 0; } - jboolean isCopy = JNI_FALSE; + isCopy = JNI_FALSE; if (audioBuffer16Bit) { audioBufferPinned = (*env)->GetShortArrayElements(env, (jshortArray)audioBuffer, &isCopy); audioBufferFrames = (*env)->GetArrayLength(env, (jshortArray)audioBuffer); @@ -653,10 +655,12 @@ void Android_JNI_CloseAudioDevice(void) /* If the parameter silent is truthy then SDL_SetError() will not be called. */ static SDL_bool Android_JNI_ExceptionOccurred(SDL_bool silent) { - SDL_assert(LocalReferenceHolder_IsActive()); JNIEnv *mEnv = Android_JNI_GetEnv(); + jthrowable exception; - jthrowable exception = (*mEnv)->ExceptionOccurred(mEnv); + SDL_assert(LocalReferenceHolder_IsActive()); + + exception = (*mEnv)->ExceptionOccurred(mEnv); if (exception != NULL) { jmethodID mid; @@ -666,13 +670,16 @@ static SDL_bool Android_JNI_ExceptionOccurred(SDL_bool silent) if (!silent) { jclass exceptionClass = (*mEnv)->GetObjectClass(mEnv, exception); jclass classClass = (*mEnv)->FindClass(mEnv, "java/lang/Class"); + jstring exceptionName; + const char* exceptionNameUTF8; + jstring exceptionMessage; mid = (*mEnv)->GetMethodID(mEnv, classClass, "getName", "()Ljava/lang/String;"); - jstring exceptionName = (jstring)(*mEnv)->CallObjectMethod(mEnv, exceptionClass, mid); - const char* exceptionNameUTF8 = (*mEnv)->GetStringUTFChars(mEnv, exceptionName, 0); + exceptionName = (jstring)(*mEnv)->CallObjectMethod(mEnv, exceptionClass, mid); + exceptionNameUTF8 = (*mEnv)->GetStringUTFChars(mEnv, exceptionName, 0); mid = (*mEnv)->GetMethodID(mEnv, exceptionClass, "getMessage", "()Ljava/lang/String;"); - jstring exceptionMessage = (jstring)(*mEnv)->CallObjectMethod(mEnv, exception, mid); + exceptionMessage = (jstring)(*mEnv)->CallObjectMethod(mEnv, exception, mid); if (exceptionMessage != NULL) { const char* exceptionMessageUTF8 = (*mEnv)->GetStringUTFChars(mEnv, exceptionMessage, 0); @@ -855,6 +862,7 @@ int Android_JNI_FileOpen(SDL_RWops* ctx, struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); JNIEnv *mEnv = Android_JNI_GetEnv(); int retval; + jstring fileNameJString; if (!LocalReferenceHolder_Init(&refs, mEnv)) { LocalReferenceHolder_Cleanup(&refs); @@ -866,7 +874,7 @@ int Android_JNI_FileOpen(SDL_RWops* ctx, return -1; } - jstring fileNameJString = (*mEnv)->NewStringUTF(mEnv, fileName); + fileNameJString = (*mEnv)->NewStringUTF(mEnv, fileName); ctx->hidden.androidio.fileNameRef = (*mEnv)->NewGlobalRef(mEnv, fileNameJString); ctx->hidden.androidio.inputStreamRef = NULL; ctx->hidden.androidio.readableByteChannelRef = NULL; @@ -885,10 +893,11 @@ size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, if (ctx->hidden.androidio.assetFileDescriptorRef) { size_t bytesMax = size * maxnum; + size_t result; if (ctx->hidden.androidio.size != -1 /* UNKNOWN_LENGTH */ && ctx->hidden.androidio.position + bytesMax > ctx->hidden.androidio.size) { bytesMax = ctx->hidden.androidio.size - ctx->hidden.androidio.position; } - size_t result = read(ctx->hidden.androidio.fd, buffer, bytesMax ); + result = read(ctx->hidden.androidio.fd, buffer, bytesMax ); if (result > 0) { ctx->hidden.androidio.position += result; LocalReferenceHolder_Cleanup(&refs); @@ -900,19 +909,23 @@ size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, jlong bytesRemaining = (jlong) (size * maxnum); jlong bytesMax = (jlong) (ctx->hidden.androidio.size - ctx->hidden.androidio.position); int bytesRead = 0; + JNIEnv *mEnv; + jobject readableByteChannel; + jmethodID readMethod; + jobject byteBuffer; /* Don't read more bytes than those that remain in the file, otherwise we get an exception */ if (bytesRemaining > bytesMax) bytesRemaining = bytesMax; - JNIEnv *mEnv = Android_JNI_GetEnv(); + mEnv = Android_JNI_GetEnv(); if (!LocalReferenceHolder_Init(&refs, mEnv)) { LocalReferenceHolder_Cleanup(&refs); return 0; } - jobject readableByteChannel = (jobject)ctx->hidden.androidio.readableByteChannelRef; - jmethodID readMethod = (jmethodID)ctx->hidden.androidio.readMethod; - jobject byteBuffer = (*mEnv)->NewDirectByteBuffer(mEnv, buffer, bytesRemaining); + readableByteChannel = (jobject)ctx->hidden.androidio.readableByteChannelRef; + readMethod = (jmethodID)ctx->hidden.androidio.readMethod; + byteBuffer = (*mEnv)->NewDirectByteBuffer(mEnv, buffer, bytesRemaining); while (bytesRemaining > 0) { /* result = readableByteChannel.read(...); */ @@ -1002,6 +1015,7 @@ Sint64 Android_JNI_FileSize(SDL_RWops* ctx) Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence) { if (ctx->hidden.androidio.assetFileDescriptorRef) { + off_t ret; switch (whence) { case RW_SEEK_SET: if (ctx->hidden.androidio.size != -1 /* UNKNOWN_LENGTH */ && offset > ctx->hidden.androidio.size) offset = ctx->hidden.androidio.size; @@ -1020,11 +1034,12 @@ Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence) } whence = SEEK_SET; - off_t ret = lseek(ctx->hidden.androidio.fd, (off_t)offset, SEEK_SET); + ret = lseek(ctx->hidden.androidio.fd, (off_t)offset, SEEK_SET); if (ret == -1) return -1; ctx->hidden.androidio.position = ret - ctx->hidden.androidio.offset; } else { Sint64 newPosition; + Sint64 movement; switch (whence) { case RW_SEEK_SET: @@ -1048,17 +1063,18 @@ Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence) newPosition = ctx->hidden.androidio.size; } - Sint64 movement = newPosition - ctx->hidden.androidio.position; + movement = newPosition - ctx->hidden.androidio.position; if (movement > 0) { unsigned char buffer[4096]; /* The easy case where we're seeking forwards */ while (movement > 0) { Sint64 amount = sizeof (buffer); + size_t result; if (amount > movement) { amount = movement; } - size_t result = Android_JNI_FileRead(ctx, buffer, 1, amount); + result = Android_JNI_FileRead(ctx, buffer, 1, amount); if (result <= 0) { /* Failed to read/skip the required amount, so fail */ return -1; @@ -1091,21 +1107,23 @@ static jobject Android_JNI_GetSystemServiceObject(const char* name) struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); JNIEnv* env = Android_JNI_GetEnv(); jobject retval = NULL; + jstring service; + jmethodID mid; + jobject context; + jobject manager; if (!LocalReferenceHolder_Init(&refs, env)) { LocalReferenceHolder_Cleanup(&refs); return NULL; } - jstring service = (*env)->NewStringUTF(env, name); - - jmethodID mid; + service = (*env)->NewStringUTF(env, name); mid = (*env)->GetStaticMethodID(env, mActivityClass, "getContext", "()Landroid/content/Context;"); - jobject context = (*env)->CallStaticObjectMethod(env, mActivityClass, mid); + context = (*env)->CallStaticObjectMethod(env, mActivityClass, mid); mid = (*env)->GetMethodID(env, mActivityClass, "getSystemServiceFromUiThread", "(Ljava/lang/String;)Ljava/lang/Object;"); - jobject manager = (*env)->CallObjectMethod(env, context, mid, service); + manager = (*env)->CallObjectMethod(env, context, mid, service); (*env)->DeleteLocalRef(env, service); @@ -1117,11 +1135,12 @@ static jobject Android_JNI_GetSystemServiceObject(const char* name) #define SETUP_CLIPBOARD(error) \ struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); \ JNIEnv* env = Android_JNI_GetEnv(); \ + jobject clipboard; \ if (!LocalReferenceHolder_Init(&refs, env)) { \ LocalReferenceHolder_Cleanup(&refs); \ return error; \ } \ - jobject clipboard = Android_JNI_GetSystemServiceObject("clipboard"); \ + clipboard = Android_JNI_GetSystemServiceObject("clipboard"); \ if (!clipboard) { \ LocalReferenceHolder_Cleanup(&refs); \ return error; \ @@ -1132,14 +1151,17 @@ static jobject Android_JNI_GetSystemServiceObject(const char* name) int Android_JNI_SetClipboardText(const char* text) { + /* Watch out for C89 scoping rules because of the macro */ SETUP_CLIPBOARD(-1) - jmethodID mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, clipboard), "setText", "(Ljava/lang/CharSequence;)V"); - jstring string = (*env)->NewStringUTF(env, text); - (*env)->CallVoidMethod(env, clipboard, mid, string); - (*env)->DeleteGlobalRef(env, clipboard); - (*env)->DeleteLocalRef(env, string); - + /* Nest the following in a scope to avoid C89 declaration rules triggered by the macro */ + { + jmethodID mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, clipboard), "setText", "(Ljava/lang/CharSequence;)V"); + jstring string = (*env)->NewStringUTF(env, text); + (*env)->CallVoidMethod(env, clipboard, mid, string); + (*env)->DeleteGlobalRef(env, clipboard); + (*env)->DeleteLocalRef(env, string); + } CLEANUP_CLIPBOARD(); return 0; @@ -1147,25 +1169,30 @@ int Android_JNI_SetClipboardText(const char* text) char* Android_JNI_GetClipboardText(void) { + /* Watch out for C89 scoping rules because of the macro */ SETUP_CLIPBOARD(SDL_strdup("")) - jmethodID mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, clipboard), "getText", "()Ljava/lang/CharSequence;"); - jobject sequence = (*env)->CallObjectMethod(env, clipboard, mid); - (*env)->DeleteGlobalRef(env, clipboard); - if (sequence) { - mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, sequence), "toString", "()Ljava/lang/String;"); - jstring string = (jstring)((*env)->CallObjectMethod(env, sequence, mid)); - const char* utf = (*env)->GetStringUTFChars(env, string, 0); - if (utf) { - char* text = SDL_strdup(utf); - (*env)->ReleaseStringUTFChars(env, string, utf); + /* Nest the following in a scope to avoid C89 declaration rules triggered by the macro */ + { + jmethodID mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, clipboard), "getText", "()Ljava/lang/CharSequence;"); + jobject sequence = (*env)->CallObjectMethod(env, clipboard, mid); + (*env)->DeleteGlobalRef(env, clipboard); + if (sequence) { + jstring string; + const char* utf; + mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, sequence), "toString", "()Ljava/lang/String;"); + string = (jstring)((*env)->CallObjectMethod(env, sequence, mid)); + utf = (*env)->GetStringUTFChars(env, string, 0); + if (utf) { + char* text = SDL_strdup(utf); + (*env)->ReleaseStringUTFChars(env, string, utf); - CLEANUP_CLIPBOARD(); + CLEANUP_CLIPBOARD(); - return text; + return text; + } } } - CLEANUP_CLIPBOARD(); return SDL_strdup(""); @@ -1173,10 +1200,13 @@ char* Android_JNI_GetClipboardText(void) SDL_bool Android_JNI_HasClipboardText(void) { + jmethodID mid; + jboolean has; + /* Watch out for C89 scoping rules because of the macro */ SETUP_CLIPBOARD(SDL_FALSE) - jmethodID mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, clipboard), "hasText", "()Z"); - jboolean has = (*env)->CallBooleanMethod(env, clipboard, mid); + mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, clipboard), "hasText", "()Z"); + has = (*env)->CallBooleanMethod(env, clipboard, mid); (*env)->DeleteGlobalRef(env, clipboard); CLEANUP_CLIPBOARD(); @@ -1193,49 +1223,61 @@ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seco { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); JNIEnv* env = Android_JNI_GetEnv(); + jmethodID mid; + jobject context; + jstring action; + jclass cls; + jobject filter; + jobject intent; + jstring iname; + jmethodID imid; + jstring bname; + jmethodID bmid; if (!LocalReferenceHolder_Init(&refs, env)) { LocalReferenceHolder_Cleanup(&refs); return -1; } - jmethodID mid; mid = (*env)->GetStaticMethodID(env, mActivityClass, "getContext", "()Landroid/content/Context;"); - jobject context = (*env)->CallStaticObjectMethod(env, mActivityClass, mid); + context = (*env)->CallStaticObjectMethod(env, mActivityClass, mid); - jstring action = (*env)->NewStringUTF(env, "android.intent.action.BATTERY_CHANGED"); + action = (*env)->NewStringUTF(env, "android.intent.action.BATTERY_CHANGED"); - jclass cls = (*env)->FindClass(env, "android/content/IntentFilter"); + cls = (*env)->FindClass(env, "android/content/IntentFilter"); mid = (*env)->GetMethodID(env, cls, "", "(Ljava/lang/String;)V"); - jobject filter = (*env)->NewObject(env, cls, mid, action); + filter = (*env)->NewObject(env, cls, mid, action); (*env)->DeleteLocalRef(env, action); mid = (*env)->GetMethodID(env, mActivityClass, "registerReceiver", "(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;"); - jobject intent = (*env)->CallObjectMethod(env, context, mid, NULL, filter); + intent = (*env)->CallObjectMethod(env, context, mid, NULL, filter); (*env)->DeleteLocalRef(env, filter); cls = (*env)->GetObjectClass(env, intent); - jstring iname; - jmethodID imid = (*env)->GetMethodID(env, cls, "getIntExtra", "(Ljava/lang/String;I)I"); + imid = (*env)->GetMethodID(env, cls, "getIntExtra", "(Ljava/lang/String;I)I"); + /* Watch out for C89 scoping rules because of the macro */ #define GET_INT_EXTRA(var, key) \ + int var; \ iname = (*env)->NewStringUTF(env, key); \ - int var = (*env)->CallIntMethod(env, intent, imid, iname, -1); \ + var = (*env)->CallIntMethod(env, intent, imid, iname, -1); \ (*env)->DeleteLocalRef(env, iname); - jstring bname; - jmethodID bmid = (*env)->GetMethodID(env, cls, "getBooleanExtra", "(Ljava/lang/String;Z)Z"); + bmid = (*env)->GetMethodID(env, cls, "getBooleanExtra", "(Ljava/lang/String;Z)Z"); + /* Watch out for C89 scoping rules because of the macro */ #define GET_BOOL_EXTRA(var, key) \ + int var; \ bname = (*env)->NewStringUTF(env, key); \ - int var = (*env)->CallBooleanMethod(env, intent, bmid, bname, JNI_FALSE); \ + var = (*env)->CallBooleanMethod(env, intent, bmid, bname, JNI_FALSE); \ (*env)->DeleteLocalRef(env, bname); if (plugged) { + /* Watch out for C89 scoping rules because of the macro */ GET_INT_EXTRA(plug, "plugged") /* == BatteryManager.EXTRA_PLUGGED (API 5) */ if (plug == -1) { LocalReferenceHolder_Cleanup(&refs); @@ -1247,6 +1289,7 @@ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seco } if (charged) { + /* Watch out for C89 scoping rules because of the macro */ GET_INT_EXTRA(status, "status") /* == BatteryManager.EXTRA_STATUS (API 5) */ if (status == -1) { LocalReferenceHolder_Cleanup(&refs); @@ -1266,8 +1309,20 @@ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seco } if (percent) { - GET_INT_EXTRA(level, "level") /* == BatteryManager.EXTRA_LEVEL (API 5) */ - GET_INT_EXTRA(scale, "scale") /* == BatteryManager.EXTRA_SCALE (API 5) */ + int level; + int scale; + + /* Watch out for C89 scoping rules because of the macro */ + { + GET_INT_EXTRA(level_temp, "level") /* == BatteryManager.EXTRA_LEVEL (API 5) */ + level = level_temp; + } + /* Watch out for C89 scoping rules because of the macro */ + { + GET_INT_EXTRA(scale_temp, "scale") /* == BatteryManager.EXTRA_SCALE (API 5) */ + scale = scale_temp; + } + if ((level == -1) || (scale == -1)) { LocalReferenceHolder_Cleanup(&refs); return -1; @@ -1320,14 +1375,16 @@ void Android_JNI_PollInputDevices(void) int Android_JNI_SendMessage(int command, int param) { JNIEnv *env = Android_JNI_GetEnv(); + jmethodID mid; + jboolean success; if (!env) { return -1; } - jmethodID mid = (*env)->GetStaticMethodID(env, mActivityClass, "sendMessage", "(II)Z"); + mid = (*env)->GetStaticMethodID(env, mActivityClass, "sendMessage", "(II)Z"); if (!mid) { return -1; } - jboolean success = (*env)->CallStaticBooleanMethod(env, mActivityClass, mid, command, param); + success = (*env)->CallStaticBooleanMethod(env, mActivityClass, mid, command, param); return success ? 0 : -1; } @@ -1339,11 +1396,12 @@ void Android_JNI_SuspendScreenSaver(SDL_bool suspend) void Android_JNI_ShowTextInput(SDL_Rect *inputRect) { JNIEnv *env = Android_JNI_GetEnv(); + jmethodID mid; if (!env) { return; } - jmethodID mid = (*env)->GetStaticMethodID(env, mActivityClass, "showTextInput", "(IIII)Z"); + mid = (*env)->GetStaticMethodID(env, mActivityClass, "showTextInput", "(IIII)Z"); if (!mid) { return; } diff --git a/libs/SDL2/src/core/android/SDL_android.h b/libs/SDL2/src/core/android/SDL_android.h index 758e3023..8e2ab93c 100644 --- a/libs/SDL2/src/core/android/SDL_android.h +++ b/libs/SDL2/src/core/android/SDL_android.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/linux/SDL_dbus.c b/libs/SDL2/src/core/linux/SDL_dbus.c index cc7b3d37..5d0df050 100644 --- a/libs/SDL2/src/core/linux/SDL_dbus.c +++ b/libs/SDL2/src/core/linux/SDL_dbus.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/linux/SDL_dbus.h b/libs/SDL2/src/core/linux/SDL_dbus.h index dcfec77e..c064381a 100644 --- a/libs/SDL2/src/core/linux/SDL_dbus.h +++ b/libs/SDL2/src/core/linux/SDL_dbus.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/linux/SDL_evdev.c b/libs/SDL2/src/core/linux/SDL_evdev.c index b9246745..a8f2b138 100644 --- a/libs/SDL2/src/core/linux/SDL_evdev.c +++ b/libs/SDL2/src/core/linux/SDL_evdev.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/linux/SDL_evdev.h b/libs/SDL2/src/core/linux/SDL_evdev.h index 670a5cb2..989ced85 100644 --- a/libs/SDL2/src/core/linux/SDL_evdev.h +++ b/libs/SDL2/src/core/linux/SDL_evdev.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/linux/SDL_ibus.c b/libs/SDL2/src/core/linux/SDL_ibus.c index 46d602af..c9804c90 100644 --- a/libs/SDL2/src/core/linux/SDL_ibus.c +++ b/libs/SDL2/src/core/linux/SDL_ibus.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/linux/SDL_ibus.h b/libs/SDL2/src/core/linux/SDL_ibus.h index 24765223..5ee7a8e4 100644 --- a/libs/SDL2/src/core/linux/SDL_ibus.h +++ b/libs/SDL2/src/core/linux/SDL_ibus.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/linux/SDL_udev.c b/libs/SDL2/src/core/linux/SDL_udev.c index cf66331e..099cc435 100644 --- a/libs/SDL2/src/core/linux/SDL_udev.c +++ b/libs/SDL2/src/core/linux/SDL_udev.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/linux/SDL_udev.h b/libs/SDL2/src/core/linux/SDL_udev.h index 9242870c..2e4434e6 100644 --- a/libs/SDL2/src/core/linux/SDL_udev.h +++ b/libs/SDL2/src/core/linux/SDL_udev.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/windows/SDL_directx.h b/libs/SDL2/src/core/windows/SDL_directx.h index 10692643..0533f61e 100644 --- a/libs/SDL2/src/core/windows/SDL_directx.h +++ b/libs/SDL2/src/core/windows/SDL_directx.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/windows/SDL_windows.c b/libs/SDL2/src/core/windows/SDL_windows.c index aff6e6d2..bc4afe0a 100644 --- a/libs/SDL2/src/core/windows/SDL_windows.c +++ b/libs/SDL2/src/core/windows/SDL_windows.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/windows/SDL_windows.h b/libs/SDL2/src/core/windows/SDL_windows.h index 863971b6..0c99b03d 100644 --- a/libs/SDL2/src/core/windows/SDL_windows.h +++ b/libs/SDL2/src/core/windows/SDL_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/windows/SDL_xinput.c b/libs/SDL2/src/core/windows/SDL_xinput.c index 1e13faea..355cd834 100644 --- a/libs/SDL2/src/core/windows/SDL_xinput.c +++ b/libs/SDL2/src/core/windows/SDL_xinput.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/windows/SDL_xinput.h b/libs/SDL2/src/core/windows/SDL_xinput.h index c22b1ebe..67f8fdc1 100644 --- a/libs/SDL2/src/core/windows/SDL_xinput.h +++ b/libs/SDL2/src/core/windows/SDL_xinput.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/winrt/SDL_winrtapp_common.cpp b/libs/SDL2/src/core/winrt/SDL_winrtapp_common.cpp index c8ac4813..265aa942 100644 --- a/libs/SDL2/src/core/winrt/SDL_winrtapp_common.cpp +++ b/libs/SDL2/src/core/winrt/SDL_winrtapp_common.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/winrt/SDL_winrtapp_common.h b/libs/SDL2/src/core/winrt/SDL_winrtapp_common.h index e905139c..e87a0b6b 100644 --- a/libs/SDL2/src/core/winrt/SDL_winrtapp_common.h +++ b/libs/SDL2/src/core/winrt/SDL_winrtapp_common.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/winrt/SDL_winrtapp_direct3d.cpp b/libs/SDL2/src/core/winrt/SDL_winrtapp_direct3d.cpp index 1a542fab..5ab2ef9a 100644 --- a/libs/SDL2/src/core/winrt/SDL_winrtapp_direct3d.cpp +++ b/libs/SDL2/src/core/winrt/SDL_winrtapp_direct3d.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/winrt/SDL_winrtapp_direct3d.h b/libs/SDL2/src/core/winrt/SDL_winrtapp_direct3d.h index 341b2d85..0b69c2bb 100644 --- a/libs/SDL2/src/core/winrt/SDL_winrtapp_direct3d.h +++ b/libs/SDL2/src/core/winrt/SDL_winrtapp_direct3d.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/winrt/SDL_winrtapp_xaml.cpp b/libs/SDL2/src/core/winrt/SDL_winrtapp_xaml.cpp index 9f943309..201e3b6c 100644 --- a/libs/SDL2/src/core/winrt/SDL_winrtapp_xaml.cpp +++ b/libs/SDL2/src/core/winrt/SDL_winrtapp_xaml.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/winrt/SDL_winrtapp_xaml.h b/libs/SDL2/src/core/winrt/SDL_winrtapp_xaml.h index 7537710e..a08b67c4 100644 --- a/libs/SDL2/src/core/winrt/SDL_winrtapp_xaml.h +++ b/libs/SDL2/src/core/winrt/SDL_winrtapp_xaml.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/cpuinfo/SDL_cpuinfo.c b/libs/SDL2/src/cpuinfo/SDL_cpuinfo.c index 92652c66..c4c55be3 100644 --- a/libs/SDL2/src/cpuinfo/SDL_cpuinfo.c +++ b/libs/SDL2/src/cpuinfo/SDL_cpuinfo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/dynapi/SDL_dynapi.c b/libs/SDL2/src/dynapi/SDL_dynapi.c index 02e5c787..c26baf37 100644 --- a/libs/SDL2/src/dynapi/SDL_dynapi.c +++ b/libs/SDL2/src/dynapi/SDL_dynapi.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -293,7 +293,7 @@ SDL_InitDynamicAPI(void) * SDL_CreateThread() would also call this function before building the * new thread). */ - static volatile SDL_bool already_initialized = SDL_FALSE; + static SDL_bool already_initialized = SDL_FALSE; /* SDL_AtomicLock calls SDL mutex functions to emulate if SDL_ATOMIC_DISABLED, which we can't do here, so in such a diff --git a/libs/SDL2/src/dynapi/SDL_dynapi.h b/libs/SDL2/src/dynapi/SDL_dynapi.h index fa9a0c7f..db1bf103 100644 --- a/libs/SDL2/src/dynapi/SDL_dynapi.h +++ b/libs/SDL2/src/dynapi/SDL_dynapi.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -47,6 +47,8 @@ #define SDL_DYNAMIC_API 0 #elif SDL_BUILDING_WINRT /* probaly not useful on WinRT, given current .dll loading restrictions */ #define SDL_DYNAMIC_API 0 +#elif __PSP__ +#define SDL_DYNAMIC_API 0 #elif defined(__clang_analyzer__) #define SDL_DYNAMIC_API 0 /* Turn off for static analysis, so reports are more clear. */ #endif diff --git a/libs/SDL2/src/dynapi/SDL_dynapi_overrides.h b/libs/SDL2/src/dynapi/SDL_dynapi_overrides.h index 75f31ced..50bbc352 100644 --- a/libs/SDL2/src/dynapi/SDL_dynapi_overrides.h +++ b/libs/SDL2/src/dynapi/SDL_dynapi_overrides.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -597,3 +597,11 @@ #define SDL_JoystickCurrentPowerLevel SDL_JoystickCurrentPowerLevel_REAL #define SDL_GameControllerFromInstanceID SDL_GameControllerFromInstanceID_REAL #define SDL_JoystickFromInstanceID SDL_JoystickFromInstanceID_REAL +#define SDL_GetDisplayUsableBounds SDL_GetDisplayUsableBounds_REAL +#define SDL_GetWindowBordersSize SDL_GetWindowBordersSize_REAL +#define SDL_SetWindowOpacity SDL_SetWindowOpacity_REAL +#define SDL_GetWindowOpacity SDL_GetWindowOpacity_REAL +#define SDL_SetWindowInputFocus SDL_SetWindowInputFocus_REAL +#define SDL_SetWindowModalFor SDL_SetWindowModalFor_REAL +#define SDL_RenderSetIntegerScale SDL_RenderSetIntegerScale_REAL +#define SDL_RenderGetIntegerScale SDL_RenderGetIntegerScale_REAL diff --git a/libs/SDL2/src/dynapi/SDL_dynapi_procs.h b/libs/SDL2/src/dynapi/SDL_dynapi_procs.h index 57bbba6d..e73b0d9b 100644 --- a/libs/SDL2/src/dynapi/SDL_dynapi_procs.h +++ b/libs/SDL2/src/dynapi/SDL_dynapi_procs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -631,3 +631,11 @@ SDL_DYNAPI_PROC(int,SDL_GetDisplayDPI,(int a, float *b, float *c, float *d),(a,b SDL_DYNAPI_PROC(SDL_JoystickPowerLevel,SDL_JoystickCurrentPowerLevel,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(SDL_GameController*,SDL_GameControllerFromInstanceID,(SDL_JoystickID a),(a),return) SDL_DYNAPI_PROC(SDL_Joystick*,SDL_JoystickFromInstanceID,(SDL_JoystickID a),(a),return) +SDL_DYNAPI_PROC(int,SDL_GetDisplayUsableBounds,(int a, SDL_Rect *b),(a,b),return) +SDL_DYNAPI_PROC(int,SDL_GetWindowBordersSize,(SDL_Window *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(int,SDL_SetWindowOpacity,(SDL_Window *a, float b),(a,b),return) +SDL_DYNAPI_PROC(int,SDL_GetWindowOpacity,(SDL_Window *a, float *b),(a,b),return) +SDL_DYNAPI_PROC(int,SDL_SetWindowInputFocus,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(int,SDL_SetWindowModalFor,(SDL_Window *a, SDL_Window *b),(a,b),return) +SDL_DYNAPI_PROC(int,SDL_RenderSetIntegerScale,(SDL_Renderer *a, SDL_bool b),(a,b),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_RenderGetIntegerScale,(SDL_Renderer *a),(a),return) diff --git a/libs/SDL2/src/dynapi/gendynapi.pl b/libs/SDL2/src/dynapi/gendynapi.pl index 192889fd..5c3d7960 100755 --- a/libs/SDL2/src/dynapi/gendynapi.pl +++ b/libs/SDL2/src/dynapi/gendynapi.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # Simple DirectMedia Layer -# Copyright (C) 1997-2015 Sam Lantinga +# Copyright (C) 1997-2016 Sam Lantinga # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_clipboardevents.c b/libs/SDL2/src/events/SDL_clipboardevents.c index 5df8aa1c..9b2209bd 100644 --- a/libs/SDL2/src/events/SDL_clipboardevents.c +++ b/libs/SDL2/src/events/SDL_clipboardevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_clipboardevents_c.h b/libs/SDL2/src/events/SDL_clipboardevents_c.h index 6c58ee43..98e6a38b 100644 --- a/libs/SDL2/src/events/SDL_clipboardevents_c.h +++ b/libs/SDL2/src/events/SDL_clipboardevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_dropevents.c b/libs/SDL2/src/events/SDL_dropevents.c index 0c8c7bea..49b07d9a 100644 --- a/libs/SDL2/src/events/SDL_dropevents.c +++ b/libs/SDL2/src/events/SDL_dropevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,21 +26,73 @@ #include "SDL_events_c.h" #include "SDL_dropevents_c.h" +#include "../video/SDL_sysvideo.h" /* for SDL_Window internals. */ -int -SDL_SendDropFile(const char *file) + +static int +SDL_SendDrop(SDL_Window *window, const SDL_EventType evtype, const char *data) { - int posted; + static SDL_bool app_is_dropping = SDL_FALSE; + int posted = 0; /* Post the event, if desired */ - posted = 0; - if (SDL_GetEventState(SDL_DROPFILE) == SDL_ENABLE) { + if (SDL_GetEventState(evtype) == SDL_ENABLE) { + const SDL_bool need_begin = window ? !window->is_dropping : !app_is_dropping; SDL_Event event; - event.type = SDL_DROPFILE; - event.drop.file = SDL_strdup(file); + + if (need_begin) { + SDL_zero(event); + event.type = SDL_DROPBEGIN; + + if (window) { + event.drop.windowID = window->id; + } + + posted = (SDL_PushEvent(&event) > 0); + if (!posted) { + return 0; + } + if (window) { + window->is_dropping = SDL_TRUE; + } else { + app_is_dropping = SDL_TRUE; + } + } + + SDL_zero(event); + event.type = evtype; + event.drop.file = data ? SDL_strdup(data) : NULL; + event.drop.windowID = window ? window->id : 0; posted = (SDL_PushEvent(&event) > 0); + + if (posted && (evtype == SDL_DROPCOMPLETE)) { + if (window) { + window->is_dropping = SDL_FALSE; + } else { + app_is_dropping = SDL_FALSE; + } + } } - return (posted); + return posted; } +int +SDL_SendDropFile(SDL_Window *window, const char *file) +{ + return SDL_SendDrop(window, SDL_DROPFILE, file); +} + +int +SDL_SendDropText(SDL_Window *window, const char *text) +{ + return SDL_SendDrop(window, SDL_DROPTEXT, text); +} + +int +SDL_SendDropComplete(SDL_Window *window) +{ + return SDL_SendDrop(window, SDL_DROPCOMPLETE, NULL); +} + + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/events/SDL_dropevents_c.h b/libs/SDL2/src/events/SDL_dropevents_c.h index 3e8615e8..a7adb856 100644 --- a/libs/SDL2/src/events/SDL_dropevents_c.h +++ b/libs/SDL2/src/events/SDL_dropevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,9 @@ #ifndef _SDL_dropevents_c_h #define _SDL_dropevents_c_h -extern int SDL_SendDropFile(const char *file); +extern int SDL_SendDropFile(SDL_Window *window, const char *file); +extern int SDL_SendDropText(SDL_Window *window, const char *text); +extern int SDL_SendDropComplete(SDL_Window *window); #endif /* _SDL_dropevents_c_h */ diff --git a/libs/SDL2/src/events/SDL_events.c b/libs/SDL2/src/events/SDL_events.c index 513cb55e..0af02704 100644 --- a/libs/SDL2/src/events/SDL_events.c +++ b/libs/SDL2/src/events/SDL_events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -73,15 +73,15 @@ typedef struct _SDL_SysWMEntry static struct { SDL_mutex *lock; - volatile SDL_bool active; - volatile int count; - volatile int max_events_seen; + SDL_atomic_t active; + SDL_atomic_t count; + int max_events_seen; SDL_EventEntry *head; SDL_EventEntry *tail; SDL_EventEntry *free; SDL_SysWMEntry *wmmsg_used; SDL_SysWMEntry *wmmsg_free; -} SDL_EventQ = { NULL, SDL_TRUE, 0, 0, NULL, NULL, NULL, NULL, NULL }; +} SDL_EventQ = { NULL, { 1 }, { 0 }, 0, NULL, NULL, NULL, NULL, NULL }; /* Public functions */ @@ -98,7 +98,7 @@ SDL_StopEventLoop(void) SDL_LockMutex(SDL_EventQ.lock); } - SDL_EventQ.active = SDL_FALSE; + SDL_AtomicSet(&SDL_EventQ.active, 0); if (report && SDL_atoi(report)) { SDL_Log("SDL EVENT QUEUE: Maximum events in-flight: %d\n", @@ -127,7 +127,7 @@ SDL_StopEventLoop(void) wmmsg = next; } - SDL_EventQ.count = 0; + SDL_AtomicSet(&SDL_EventQ.count, 0); SDL_EventQ.max_events_seen = 0; SDL_EventQ.head = NULL; SDL_EventQ.tail = NULL; @@ -171,7 +171,7 @@ SDL_StartEventLoop(void) SDL_EventQ.lock = SDL_CreateMutex(); } if (SDL_EventQ.lock == NULL) { - return (-1); + return -1; } #endif /* !SDL_THREADS_DISABLED */ @@ -180,9 +180,9 @@ SDL_StartEventLoop(void) SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE); SDL_EventState(SDL_SYSWMEVENT, SDL_DISABLE); - SDL_EventQ.active = SDL_TRUE; + SDL_AtomicSet(&SDL_EventQ.active, 1); - return (0); + return 0; } @@ -191,9 +191,11 @@ static int SDL_AddEvent(SDL_Event * event) { SDL_EventEntry *entry; + const int initial_count = SDL_AtomicGet(&SDL_EventQ.count); + int final_count; - if (SDL_EventQ.count >= SDL_MAX_QUEUED_EVENTS) { - SDL_SetError("Event queue is full (%d events)", SDL_EventQ.count); + if (initial_count >= SDL_MAX_QUEUED_EVENTS) { + SDL_SetError("Event queue is full (%d events)", initial_count); return 0; } @@ -225,10 +227,10 @@ SDL_AddEvent(SDL_Event * event) entry->prev = NULL; entry->next = NULL; } - ++SDL_EventQ.count; - if (SDL_EventQ.count > SDL_EventQ.max_events_seen) { - SDL_EventQ.max_events_seen = SDL_EventQ.count; + final_count = SDL_AtomicAdd(&SDL_EventQ.count, 1) + 1; + if (final_count > SDL_EventQ.max_events_seen) { + SDL_EventQ.max_events_seen = final_count; } return 1; @@ -256,8 +258,8 @@ SDL_CutEvent(SDL_EventEntry *entry) entry->next = SDL_EventQ.free; SDL_EventQ.free = entry; - SDL_assert(SDL_EventQ.count > 0); - --SDL_EventQ.count; + SDL_assert(SDL_AtomicGet(&SDL_EventQ.count) > 0); + SDL_AtomicAdd(&SDL_EventQ.count, -1); } /* Lock the event queue, take a peep at it, and unlock it */ @@ -268,7 +270,7 @@ SDL_PeepEvents(SDL_Event * events, int numevents, SDL_eventaction action, int i, used; /* Don't look after we've quit */ - if (!SDL_EventQ.active) { + if (!SDL_AtomicGet(&SDL_EventQ.active)) { /* We get a few spurious events at shutdown, so don't warn then */ if (action != SDL_ADDEVENT) { SDL_SetError("The event system has been shut down"); @@ -285,52 +287,48 @@ SDL_PeepEvents(SDL_Event * events, int numevents, SDL_eventaction action, } else { SDL_EventEntry *entry, *next; SDL_SysWMEntry *wmmsg, *wmmsg_next; - SDL_Event tmpevent; Uint32 type; - /* If 'events' is NULL, just see if they exist */ - if (events == NULL) { - action = SDL_PEEKEVENT; - numevents = 1; - events = &tmpevent; + if (action == SDL_GETEVENT) { + /* Clean out any used wmmsg data + FIXME: Do we want to retain the data for some period of time? + */ + for (wmmsg = SDL_EventQ.wmmsg_used; wmmsg; wmmsg = wmmsg_next) { + wmmsg_next = wmmsg->next; + wmmsg->next = SDL_EventQ.wmmsg_free; + SDL_EventQ.wmmsg_free = wmmsg; + } + SDL_EventQ.wmmsg_used = NULL; } - /* Clean out any used wmmsg data - FIXME: Do we want to retain the data for some period of time? - */ - for (wmmsg = SDL_EventQ.wmmsg_used; wmmsg; wmmsg = wmmsg_next) { - wmmsg_next = wmmsg->next; - wmmsg->next = SDL_EventQ.wmmsg_free; - SDL_EventQ.wmmsg_free = wmmsg; - } - SDL_EventQ.wmmsg_used = NULL; - - for (entry = SDL_EventQ.head; entry && used < numevents; entry = next) { + for (entry = SDL_EventQ.head; entry && (!events || used < numevents); entry = next) { next = entry->next; type = entry->event.type; if (minType <= type && type <= maxType) { - events[used] = entry->event; - if (entry->event.type == SDL_SYSWMEVENT) { - /* We need to copy the wmmsg somewhere safe. - For now we'll guarantee it's valid at least until - the next call to SDL_PeepEvents() - */ - if (SDL_EventQ.wmmsg_free) { - wmmsg = SDL_EventQ.wmmsg_free; - SDL_EventQ.wmmsg_free = wmmsg->next; - } else { - wmmsg = (SDL_SysWMEntry *)SDL_malloc(sizeof(*wmmsg)); + if (events) { + events[used] = entry->event; + if (entry->event.type == SDL_SYSWMEVENT) { + /* We need to copy the wmmsg somewhere safe. + For now we'll guarantee it's valid at least until + the next call to SDL_PeepEvents() + */ + if (SDL_EventQ.wmmsg_free) { + wmmsg = SDL_EventQ.wmmsg_free; + SDL_EventQ.wmmsg_free = wmmsg->next; + } else { + wmmsg = (SDL_SysWMEntry *)SDL_malloc(sizeof(*wmmsg)); + } + wmmsg->msg = *entry->event.syswm.msg; + wmmsg->next = SDL_EventQ.wmmsg_used; + SDL_EventQ.wmmsg_used = wmmsg; + events[used].syswm.msg = &wmmsg->msg; + } + + if (action == SDL_GETEVENT) { + SDL_CutEvent(entry); } - wmmsg->msg = *entry->event.syswm.msg; - wmmsg->next = SDL_EventQ.wmmsg_used; - SDL_EventQ.wmmsg_used = wmmsg; - events[used].syswm.msg = &wmmsg->msg; } ++used; - - if (action == SDL_GETEVENT) { - SDL_CutEvent(entry); - } } } } @@ -363,7 +361,7 @@ void SDL_FlushEvents(Uint32 minType, Uint32 maxType) { /* Don't look after we've quit */ - if (!SDL_EventQ.active) { + if (!SDL_AtomicGet(&SDL_EventQ.active)) { return; } @@ -437,8 +435,6 @@ SDL_WaitEventTimeout(SDL_Event * event, int timeout) switch (SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT)) { case -1: return 0; - case 1: - return 1; case 0: if (timeout == 0) { /* Polling and no events, just return */ @@ -450,6 +446,9 @@ SDL_WaitEventTimeout(SDL_Event * event, int timeout) } SDL_Delay(10); break; + default: + /* Has events */ + return 1; } } } diff --git a/libs/SDL2/src/events/SDL_events_c.h b/libs/SDL2/src/events/SDL_events_c.h index 0ead5f30..2e331904 100644 --- a/libs/SDL2/src/events/SDL_events_c.h +++ b/libs/SDL2/src/events/SDL_events_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_gesture.c b/libs/SDL2/src/events/SDL_gesture.c index b7980ede..66def442 100644 --- a/libs/SDL2/src/events/SDL_gesture.c +++ b/libs/SDL2/src/events/SDL_gesture.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_gesture_c.h b/libs/SDL2/src/events/SDL_gesture_c.h index f94dc715..3ff542cb 100644 --- a/libs/SDL2/src/events/SDL_gesture_c.h +++ b/libs/SDL2/src/events/SDL_gesture_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_keyboard.c b/libs/SDL2/src/events/SDL_keyboard.c index 97b90f71..15726545 100644 --- a/libs/SDL2/src/events/SDL_keyboard.c +++ b/libs/SDL2/src/events/SDL_keyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_keyboard_c.h b/libs/SDL2/src/events/SDL_keyboard_c.h index 2e51052c..b4d1c073 100644 --- a/libs/SDL2/src/events/SDL_keyboard_c.h +++ b/libs/SDL2/src/events/SDL_keyboard_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_mouse.c b/libs/SDL2/src/events/SDL_mouse.c index 716384a1..7793de87 100644 --- a/libs/SDL2/src/events/SDL_mouse.c +++ b/libs/SDL2/src/events/SDL_mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_mouse_c.h b/libs/SDL2/src/events/SDL_mouse_c.h index b12bec35..03aca0a5 100644 --- a/libs/SDL2/src/events/SDL_mouse_c.h +++ b/libs/SDL2/src/events/SDL_mouse_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_quit.c b/libs/SDL2/src/events/SDL_quit.c index d2b215bc..5b7105ef 100644 --- a/libs/SDL2/src/events/SDL_quit.c +++ b/libs/SDL2/src/events/SDL_quit.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_sysevents.h b/libs/SDL2/src/events/SDL_sysevents.h index f1d460d8..c4ce0876 100644 --- a/libs/SDL2/src/events/SDL_sysevents.h +++ b/libs/SDL2/src/events/SDL_sysevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_touch.c b/libs/SDL2/src/events/SDL_touch.c index 1b477ea7..c73827c9 100644 --- a/libs/SDL2/src/events/SDL_touch.c +++ b/libs/SDL2/src/events/SDL_touch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_touch_c.h b/libs/SDL2/src/events/SDL_touch_c.h index 3e4b8bbf..d025df6e 100644 --- a/libs/SDL2/src/events/SDL_touch_c.h +++ b/libs/SDL2/src/events/SDL_touch_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_windowevents.c b/libs/SDL2/src/events/SDL_windowevents.c index 26f43abc..785ea4e0 100644 --- a/libs/SDL2/src/events/SDL_windowevents.c +++ b/libs/SDL2/src/events/SDL_windowevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_windowevents_c.h b/libs/SDL2/src/events/SDL_windowevents_c.h index 140b38c3..2a6a4c05 100644 --- a/libs/SDL2/src/events/SDL_windowevents_c.h +++ b/libs/SDL2/src/events/SDL_windowevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/blank_cursor.h b/libs/SDL2/src/events/blank_cursor.h index 17501293..5e15852c 100644 --- a/libs/SDL2/src/events/blank_cursor.h +++ b/libs/SDL2/src/events/blank_cursor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/default_cursor.h b/libs/SDL2/src/events/default_cursor.h index e292cbf5..297dd2dc 100644 --- a/libs/SDL2/src/events/default_cursor.h +++ b/libs/SDL2/src/events/default_cursor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/scancodes_darwin.h b/libs/SDL2/src/events/scancodes_darwin.h index 5677a894..26922530 100644 --- a/libs/SDL2/src/events/scancodes_darwin.h +++ b/libs/SDL2/src/events/scancodes_darwin.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/scancodes_linux.h b/libs/SDL2/src/events/scancodes_linux.h index 532a2a98..8db37df5 100644 --- a/libs/SDL2/src/events/scancodes_linux.h +++ b/libs/SDL2/src/events/scancodes_linux.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/scancodes_windows.h b/libs/SDL2/src/events/scancodes_windows.h index f712d5a0..b23a261e 100644 --- a/libs/SDL2/src/events/scancodes_windows.h +++ b/libs/SDL2/src/events/scancodes_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/scancodes_xfree86.h b/libs/SDL2/src/events/scancodes_xfree86.h index e6155525..29d9ef94 100644 --- a/libs/SDL2/src/events/scancodes_xfree86.h +++ b/libs/SDL2/src/events/scancodes_xfree86.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/file/SDL_rwops.c b/libs/SDL2/src/file/SDL_rwops.c index b3b445d2..38beb628 100644 --- a/libs/SDL2/src/file/SDL_rwops.c +++ b/libs/SDL2/src/file/SDL_rwops.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.h b/libs/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.h index 387428f3..2c63f1da 100644 --- a/libs/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.h +++ b/libs/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.m b/libs/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.m index 1d665edb..3385d3aa 100644 --- a/libs/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.m +++ b/libs/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/filesystem/android/SDL_sysfilesystem.c b/libs/SDL2/src/filesystem/android/SDL_sysfilesystem.c index 0401773e..3bdf9966 100644 --- a/libs/SDL2/src/filesystem/android/SDL_sysfilesystem.c +++ b/libs/SDL2/src/filesystem/android/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/filesystem/cocoa/SDL_sysfilesystem.m b/libs/SDL2/src/filesystem/cocoa/SDL_sysfilesystem.m index 1e6a2067..6dee5805 100644 --- a/libs/SDL2/src/filesystem/cocoa/SDL_sysfilesystem.m +++ b/libs/SDL2/src/filesystem/cocoa/SDL_sysfilesystem.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/filesystem/dummy/SDL_sysfilesystem.c b/libs/SDL2/src/filesystem/dummy/SDL_sysfilesystem.c index 2cb9e21e..45273f24 100644 --- a/libs/SDL2/src/filesystem/dummy/SDL_sysfilesystem.c +++ b/libs/SDL2/src/filesystem/dummy/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/filesystem/emscripten/SDL_sysfilesystem.c b/libs/SDL2/src/filesystem/emscripten/SDL_sysfilesystem.c index e9ded675..ca49df1b 100644 --- a/libs/SDL2/src/filesystem/emscripten/SDL_sysfilesystem.c +++ b/libs/SDL2/src/filesystem/emscripten/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/filesystem/haiku/SDL_sysfilesystem.cc b/libs/SDL2/src/filesystem/haiku/SDL_sysfilesystem.cc index 3a0ea348..03489168 100644 --- a/libs/SDL2/src/filesystem/haiku/SDL_sysfilesystem.cc +++ b/libs/SDL2/src/filesystem/haiku/SDL_sysfilesystem.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/filesystem/nacl/SDL_sysfilesystem.c b/libs/SDL2/src/filesystem/nacl/SDL_sysfilesystem.c index 4efda46e..ac8fef1e 100644 --- a/libs/SDL2/src/filesystem/nacl/SDL_sysfilesystem.c +++ b/libs/SDL2/src/filesystem/nacl/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/filesystem/unix/SDL_sysfilesystem.c b/libs/SDL2/src/filesystem/unix/SDL_sysfilesystem.c index b3264949..bd2e84cd 100644 --- a/libs/SDL2/src/filesystem/unix/SDL_sysfilesystem.c +++ b/libs/SDL2/src/filesystem/unix/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,7 +33,7 @@ #include #include -#ifdef __FREEBSD__ +#if defined(__FREEBSD__) || defined(__OPENBSD__) #include #endif @@ -90,7 +90,26 @@ SDL_GetBasePath(void) return NULL; } } -#elif defined(__SOLARIS__) +#endif +#if defined(__OPENBSD__) + char **retvalargs; + size_t len; + const int mib[] = { CTL_KERN, KERN_PROC_ARGS, getpid(), KERN_PROC_ARGV }; + if (sysctl(mib, 4, NULL, &len, NULL, 0) != -1) { + retvalargs = SDL_malloc(len); + if (!retvalargs) { + SDL_OutOfMemory(); + return NULL; + } + sysctl(mib, 4, retvalargs, &len, NULL, 0); + retval = SDL_malloc(PATH_MAX + 1); + if (retval) + realpath(retvalargs[0], retval); + + SDL_free(retvalargs); + } +#endif +#if defined(__SOLARIS__) const char *path = getexecname(); if ((path != NULL) && (path[0] == '/')) { /* must be absolute path... */ retval = SDL_strdup(path); diff --git a/libs/SDL2/src/filesystem/windows/SDL_sysfilesystem.c b/libs/SDL2/src/filesystem/windows/SDL_sysfilesystem.c index 2d1c7819..fd942d75 100644 --- a/libs/SDL2/src/filesystem/windows/SDL_sysfilesystem.c +++ b/libs/SDL2/src/filesystem/windows/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/filesystem/winrt/SDL_sysfilesystem.cpp b/libs/SDL2/src/filesystem/winrt/SDL_sysfilesystem.cpp index a70c7fe4..b4caf903 100644 --- a/libs/SDL2/src/filesystem/winrt/SDL_sysfilesystem.cpp +++ b/libs/SDL2/src/filesystem/winrt/SDL_sysfilesystem.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/haptic/SDL_haptic.c b/libs/SDL2/src/haptic/SDL_haptic.c index 0d5c0ef5..ddce908d 100644 --- a/libs/SDL2/src/haptic/SDL_haptic.c +++ b/libs/SDL2/src/haptic/SDL_haptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/haptic/SDL_haptic_c.h b/libs/SDL2/src/haptic/SDL_haptic_c.h index 24389c7e..5b9372b5 100644 --- a/libs/SDL2/src/haptic/SDL_haptic_c.h +++ b/libs/SDL2/src/haptic/SDL_haptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/haptic/SDL_syshaptic.h b/libs/SDL2/src/haptic/SDL_syshaptic.h index a364f8a8..372cefac 100644 --- a/libs/SDL2/src/haptic/SDL_syshaptic.h +++ b/libs/SDL2/src/haptic/SDL_syshaptic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/haptic/darwin/SDL_syshaptic.c b/libs/SDL2/src/haptic/darwin/SDL_syshaptic.c index 152f779d..d662012c 100644 --- a/libs/SDL2/src/haptic/darwin/SDL_syshaptic.c +++ b/libs/SDL2/src/haptic/darwin/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/haptic/darwin/SDL_syshaptic_c.h b/libs/SDL2/src/haptic/darwin/SDL_syshaptic_c.h index 0af04487..2b72aab3 100644 --- a/libs/SDL2/src/haptic/darwin/SDL_syshaptic_c.h +++ b/libs/SDL2/src/haptic/darwin/SDL_syshaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/haptic/dummy/SDL_syshaptic.c b/libs/SDL2/src/haptic/dummy/SDL_syshaptic.c index ebff7dae..727e7eca 100644 --- a/libs/SDL2/src/haptic/dummy/SDL_syshaptic.c +++ b/libs/SDL2/src/haptic/dummy/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/haptic/linux/SDL_syshaptic.c b/libs/SDL2/src/haptic/linux/SDL_syshaptic.c index 659252b5..4918d126 100644 --- a/libs/SDL2/src/haptic/linux/SDL_syshaptic.c +++ b/libs/SDL2/src/haptic/linux/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -690,7 +690,7 @@ SDL_SYS_ToDirection(Uint16 *dest, SDL_HapticDirection * src) else if (!src->dir[0]) *dest = (src->dir[1] >= 0 ? 0x8000 : 0); else { - float f = atan2(src->dir[1], src->dir[0]); /* Ideally we'd use fixed point math instead of floats... */ + float f = SDL_atan2(src->dir[1], src->dir[0]); /* Ideally we'd use fixed point math instead of floats... */ /* atan2 takes the parameters: Y-axis-value and X-axis-value (in that order) - Y-axis-value is the second coordinate (from center to SOUTH) diff --git a/libs/SDL2/src/haptic/windows/SDL_dinputhaptic.c b/libs/SDL2/src/haptic/windows/SDL_dinputhaptic.c index 1cd70425..c51470dd 100644 --- a/libs/SDL2/src/haptic/windows/SDL_dinputhaptic.c +++ b/libs/SDL2/src/haptic/windows/SDL_dinputhaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/haptic/windows/SDL_dinputhaptic_c.h b/libs/SDL2/src/haptic/windows/SDL_dinputhaptic_c.h index d587ab72..3dc0f130 100644 --- a/libs/SDL2/src/haptic/windows/SDL_dinputhaptic_c.h +++ b/libs/SDL2/src/haptic/windows/SDL_dinputhaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/haptic/windows/SDL_windowshaptic.c b/libs/SDL2/src/haptic/windows/SDL_windowshaptic.c index a0b6c554..c6bcba1f 100644 --- a/libs/SDL2/src/haptic/windows/SDL_windowshaptic.c +++ b/libs/SDL2/src/haptic/windows/SDL_windowshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -255,7 +255,7 @@ SDL_SYS_HapticQuit(void) for (hapticitem = SDL_haptics; hapticitem; hapticitem = hapticitem->next) { if ((hapticitem->hwdata->bXInputHaptic) && (hapticitem->hwdata->thread)) { /* we _have_ to stop the thread before we free the XInput DLL! */ - hapticitem->hwdata->stopThread = 1; + SDL_AtomicSet(&hapticitem->hwdata->stopThread, 1); SDL_WaitThread(hapticitem->hwdata->thread, NULL); hapticitem->hwdata->thread = NULL; } diff --git a/libs/SDL2/src/haptic/windows/SDL_windowshaptic_c.h b/libs/SDL2/src/haptic/windows/SDL_windowshaptic_c.h index e3de1336..f3442644 100644 --- a/libs/SDL2/src/haptic/windows/SDL_windowshaptic_c.h +++ b/libs/SDL2/src/haptic/windows/SDL_windowshaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -42,8 +42,8 @@ struct haptic_hwdata Uint8 userid; /* XInput userid index for this joystick */ SDL_Thread *thread; SDL_mutex *mutex; - volatile Uint32 stopTicks; - volatile int stopThread; + Uint32 stopTicks; + SDL_atomic_t stopThread; }; diff --git a/libs/SDL2/src/haptic/windows/SDL_xinputhaptic.c b/libs/SDL2/src/haptic/windows/SDL_xinputhaptic.c index b5fb2e34..aefbabbd 100644 --- a/libs/SDL2/src/haptic/windows/SDL_xinputhaptic.c +++ b/libs/SDL2/src/haptic/windows/SDL_xinputhaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -146,7 +146,7 @@ SDL_RunXInputHaptic(void *arg) { struct haptic_hwdata *hwdata = (struct haptic_hwdata *) arg; - while (!hwdata->stopThread) { + while (!SDL_AtomicGet(&hwdata->stopThread)) { SDL_Delay(50); SDL_LockMutex(hwdata->mutex); /* If we're currently running and need to stop... */ @@ -261,7 +261,7 @@ SDL_XINPUT_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick) void SDL_XINPUT_HapticClose(SDL_Haptic * haptic) { - haptic->hwdata->stopThread = 1; + SDL_AtomicSet(&haptic->hwdata->stopThread, 1); SDL_WaitThread(haptic->hwdata->thread, NULL); SDL_DestroyMutex(haptic->hwdata->mutex); } diff --git a/libs/SDL2/src/haptic/windows/SDL_xinputhaptic_c.h b/libs/SDL2/src/haptic/windows/SDL_xinputhaptic_c.h index 7917128d..f9a0c85b 100644 --- a/libs/SDL2/src/haptic/windows/SDL_xinputhaptic_c.h +++ b/libs/SDL2/src/haptic/windows/SDL_xinputhaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/SDL_gamecontroller.c b/libs/SDL2/src/joystick/SDL_gamecontroller.c index be181caa..93e6fbfb 100644 --- a/libs/SDL2/src/joystick/SDL_gamecontroller.c +++ b/libs/SDL2/src/joystick/SDL_gamecontroller.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -861,7 +861,6 @@ SDL_GameControllerInit(void) { int i = 0; const char *pMappingString = NULL; - s_pSupportedControllers = NULL; pMappingString = s_ControllerMappings[i]; while (pMappingString) { SDL_GameControllerAddMapping(pMappingString); diff --git a/libs/SDL2/src/joystick/SDL_gamecontrollerdb.h b/libs/SDL2/src/joystick/SDL_gamecontrollerdb.h index 4f4c1240..af05debc 100644 --- a/libs/SDL2/src/joystick/SDL_gamecontrollerdb.h +++ b/libs/SDL2/src/joystick/SDL_gamecontrollerdb.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -61,6 +61,7 @@ static const char *s_ControllerMappings [] = "5e040000000000008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", #endif #if defined(__LINUX__) + "03000000100000008200000011010000,Akishop Customs PS360+ v1.66,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", "03000000e82000006058000001010000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "030000006f0e00000104000000010000,Gamestop Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", @@ -71,6 +72,12 @@ static const char *s_ControllerMappings [] = "030000006d04000019c2000011010000,Logitech F710 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ "030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000006d04000018c2000010010000,Logitech RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000380700008433000011010000,Mad Catz FightStick TE S+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000380700008483000011010000,Mad Catz FightStick TE S+ PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000380700003847000090040000,Mad Catz Wired Xbox 360 Controller (SFIV),a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "03000000380700008034000011010000,Mad Catz fightstick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000380700008084000011010000,Mad Catz fightstick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000380700001888000010010000,MadCatz PC USB Wired Stick 8818,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000550900001072000011010000,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", "050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b1,b:b0,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "050000003620000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,", diff --git a/libs/SDL2/src/joystick/SDL_joystick.c b/libs/SDL2/src/joystick/SDL_joystick.c index 8516c03a..dc910a82 100644 --- a/libs/SDL2/src/joystick/SDL_joystick.c +++ b/libs/SDL2/src/joystick/SDL_joystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/SDL_joystick_c.h b/libs/SDL2/src/joystick/SDL_joystick_c.h index 2da74bd3..4a076f6d 100644 --- a/libs/SDL2/src/joystick/SDL_joystick_c.h +++ b/libs/SDL2/src/joystick/SDL_joystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/SDL_sysjoystick.h b/libs/SDL2/src/joystick/SDL_sysjoystick.h index f03e4042..1015840a 100644 --- a/libs/SDL2/src/joystick/SDL_sysjoystick.h +++ b/libs/SDL2/src/joystick/SDL_sysjoystick.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/android/SDL_sysjoystick.c b/libs/SDL2/src/joystick/android/SDL_sysjoystick.c index 8ab682d4..6ef16a93 100644 --- a/libs/SDL2/src/joystick/android/SDL_sysjoystick.c +++ b/libs/SDL2/src/joystick/android/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -340,7 +340,6 @@ Android_RemoveJoystick(int device_id) return -1; } - const int retval = item->device_instance; if (item->joystick) { item->joystick->hwdata = NULL; } @@ -376,7 +375,7 @@ Android_RemoveJoystick(int device_id) SDL_free(item->name); SDL_free(item); - return retval; + return numjoysticks; } diff --git a/libs/SDL2/src/joystick/android/SDL_sysjoystick_c.h b/libs/SDL2/src/joystick/android/SDL_sysjoystick_c.h index 2137e33c..51803db3 100644 --- a/libs/SDL2/src/joystick/android/SDL_sysjoystick_c.h +++ b/libs/SDL2/src/joystick/android/SDL_sysjoystick_c.h @@ -1,23 +1,23 @@ /* - Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - */ + Simple DirectMedia Layer + Copyright (C) 1997-2016 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ #include "../../SDL_internal.h" diff --git a/libs/SDL2/src/joystick/bsd/SDL_sysjoystick.c b/libs/SDL2/src/joystick/bsd/SDL_sysjoystick.c index b43e13b3..509d43f7 100644 --- a/libs/SDL2/src/joystick/bsd/SDL_sysjoystick.c +++ b/libs/SDL2/src/joystick/bsd/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/darwin/SDL_sysjoystick.c b/libs/SDL2/src/joystick/darwin/SDL_sysjoystick.c index 0cb09d26..6dd306aa 100644 --- a/libs/SDL2/src/joystick/darwin/SDL_sysjoystick.c +++ b/libs/SDL2/src/joystick/darwin/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/darwin/SDL_sysjoystick_c.h b/libs/SDL2/src/joystick/darwin/SDL_sysjoystick_c.h index 0fefa265..1c317eca 100644 --- a/libs/SDL2/src/joystick/darwin/SDL_sysjoystick_c.h +++ b/libs/SDL2/src/joystick/darwin/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/dummy/SDL_sysjoystick.c b/libs/SDL2/src/joystick/dummy/SDL_sysjoystick.c index 6212c0e5..10fda10d 100644 --- a/libs/SDL2/src/joystick/dummy/SDL_sysjoystick.c +++ b/libs/SDL2/src/joystick/dummy/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/emscripten/SDL_sysjoystick.c b/libs/SDL2/src/joystick/emscripten/SDL_sysjoystick.c index 92b93715..e0c5833b 100644 --- a/libs/SDL2/src/joystick/emscripten/SDL_sysjoystick.c +++ b/libs/SDL2/src/joystick/emscripten/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/emscripten/SDL_sysjoystick_c.h b/libs/SDL2/src/joystick/emscripten/SDL_sysjoystick_c.h index 82b4e13b..41f613e1 100644 --- a/libs/SDL2/src/joystick/emscripten/SDL_sysjoystick_c.h +++ b/libs/SDL2/src/joystick/emscripten/SDL_sysjoystick_c.h @@ -1,23 +1,23 @@ /* - Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Simple DirectMedia Layer + Copyright (C) 1997-2016 Sam Lantinga - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - */ + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ #include "../../SDL_internal.h" diff --git a/libs/SDL2/src/joystick/haiku/SDL_haikujoystick.cc b/libs/SDL2/src/joystick/haiku/SDL_haikujoystick.cc index 612f3849..3ec9ae10 100644 --- a/libs/SDL2/src/joystick/haiku/SDL_haikujoystick.cc +++ b/libs/SDL2/src/joystick/haiku/SDL_haikujoystick.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/iphoneos/SDL_sysjoystick.m b/libs/SDL2/src/joystick/iphoneos/SDL_sysjoystick.m index 3ec9f9c8..c8a42af0 100644 --- a/libs/SDL2/src/joystick/iphoneos/SDL_sysjoystick.m +++ b/libs/SDL2/src/joystick/iphoneos/SDL_sysjoystick.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/iphoneos/SDL_sysjoystick_c.h b/libs/SDL2/src/joystick/iphoneos/SDL_sysjoystick_c.h index 4d21d90a..be0ddf06 100644 --- a/libs/SDL2/src/joystick/iphoneos/SDL_sysjoystick_c.h +++ b/libs/SDL2/src/joystick/iphoneos/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/linux/SDL_sysjoystick.c b/libs/SDL2/src/joystick/linux/SDL_sysjoystick.c index c6f7911c..8c73859e 100644 --- a/libs/SDL2/src/joystick/linux/SDL_sysjoystick.c +++ b/libs/SDL2/src/joystick/linux/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/linux/SDL_sysjoystick_c.h b/libs/SDL2/src/joystick/linux/SDL_sysjoystick_c.h index 0d7e65d2..ee771783 100644 --- a/libs/SDL2/src/joystick/linux/SDL_sysjoystick_c.h +++ b/libs/SDL2/src/joystick/linux/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/psp/SDL_sysjoystick.c b/libs/SDL2/src/joystick/psp/SDL_sysjoystick.c index 9d20f90d..e5247254 100644 --- a/libs/SDL2/src/joystick/psp/SDL_sysjoystick.c +++ b/libs/SDL2/src/joystick/psp/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/windows/SDL_dinputjoystick.c b/libs/SDL2/src/joystick/windows/SDL_dinputjoystick.c index 61d5b386..f6b0cc88 100644 --- a/libs/SDL2/src/joystick/windows/SDL_dinputjoystick.c +++ b/libs/SDL2/src/joystick/windows/SDL_dinputjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/windows/SDL_dinputjoystick_c.h b/libs/SDL2/src/joystick/windows/SDL_dinputjoystick_c.h index f93b1209..7e4ff3e1 100644 --- a/libs/SDL2/src/joystick/windows/SDL_dinputjoystick_c.h +++ b/libs/SDL2/src/joystick/windows/SDL_dinputjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/windows/SDL_mmjoystick.c b/libs/SDL2/src/joystick/windows/SDL_mmjoystick.c index 65b16ab9..37461818 100644 --- a/libs/SDL2/src/joystick/windows/SDL_mmjoystick.c +++ b/libs/SDL2/src/joystick/windows/SDL_mmjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/windows/SDL_windowsjoystick.c b/libs/SDL2/src/joystick/windows/SDL_windowsjoystick.c index c06fad0d..7123c615 100644 --- a/libs/SDL2/src/joystick/windows/SDL_windowsjoystick.c +++ b/libs/SDL2/src/joystick/windows/SDL_windowsjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/windows/SDL_windowsjoystick_c.h b/libs/SDL2/src/joystick/windows/SDL_windowsjoystick_c.h index 5f991dc2..ab946b4f 100644 --- a/libs/SDL2/src/joystick/windows/SDL_windowsjoystick_c.h +++ b/libs/SDL2/src/joystick/windows/SDL_windowsjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/windows/SDL_xinputjoystick.c b/libs/SDL2/src/joystick/windows/SDL_xinputjoystick.c index cf71f5c3..3e34117e 100644 --- a/libs/SDL2/src/joystick/windows/SDL_xinputjoystick.c +++ b/libs/SDL2/src/joystick/windows/SDL_xinputjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -376,7 +376,7 @@ SDL_SYS_IsXInputGamepad_DeviceIndex(int device_index) for (index = device_index; index > 0; index--) device = device->pNext; - return (device->SubType == XINPUT_DEVSUBTYPE_GAMEPAD); + return device->bXInputDevice; } #else /* !SDL_JOYSTICK_XINPUT */ diff --git a/libs/SDL2/src/joystick/windows/SDL_xinputjoystick_c.h b/libs/SDL2/src/joystick/windows/SDL_xinputjoystick_c.h index ed6087bc..b3ba8c02 100644 --- a/libs/SDL2/src/joystick/windows/SDL_xinputjoystick_c.h +++ b/libs/SDL2/src/joystick/windows/SDL_xinputjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/libm/math_libm.h b/libs/SDL2/src/libm/math_libm.h index 9e91073e..3fe1727a 100644 --- a/libs/SDL2/src/libm/math_libm.h +++ b/libs/SDL2/src/libm/math_libm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/loadso/dlopen/SDL_sysloadso.c b/libs/SDL2/src/loadso/dlopen/SDL_sysloadso.c index f3dffefd..03ffae12 100644 --- a/libs/SDL2/src/loadso/dlopen/SDL_sysloadso.c +++ b/libs/SDL2/src/loadso/dlopen/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/loadso/dummy/SDL_sysloadso.c b/libs/SDL2/src/loadso/dummy/SDL_sysloadso.c index a38b5697..4f132f9f 100644 --- a/libs/SDL2/src/loadso/dummy/SDL_sysloadso.c +++ b/libs/SDL2/src/loadso/dummy/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/loadso/haiku/SDL_sysloadso.c b/libs/SDL2/src/loadso/haiku/SDL_sysloadso.c index a5f12950..1336d9e1 100644 --- a/libs/SDL2/src/loadso/haiku/SDL_sysloadso.c +++ b/libs/SDL2/src/loadso/haiku/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/loadso/windows/SDL_sysloadso.c b/libs/SDL2/src/loadso/windows/SDL_sysloadso.c index 1c1d8cfa..bdb2b987 100644 --- a/libs/SDL2/src/loadso/windows/SDL_sysloadso.c +++ b/libs/SDL2/src/loadso/windows/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/main/android/SDL_android_main.c b/libs/SDL2/src/main/android/SDL_android_main.c index 4173bcb1..8a85ccf1 100644 --- a/libs/SDL2/src/main/android/SDL_android_main.c +++ b/libs/SDL2/src/main/android/SDL_android_main.c @@ -22,6 +22,8 @@ JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jc int i; int argc; int status; + int len; + char** argv; /* This interface could expand with ABI negotiation, callbacks, etc. */ SDL_Android_Init(env, cls); @@ -30,8 +32,8 @@ JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jc /* Prepare the arguments. */ - int len = (*env)->GetArrayLength(env, array); - char* argv[1 + len + 1]; + len = (*env)->GetArrayLength(env, array); + argv = SDL_stack_alloc(char*, 1 + len + 1); argc = 0; /* Use the name "app_process" so PHYSFS_platformCalcBaseDir() works. https://bitbucket.org/MartinFelis/love-android-sdl2/issue/23/release-build-crash-on-start @@ -66,7 +68,7 @@ JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jc for (i = 0; i < argc; ++i) { SDL_free(argv[i]); } - + SDL_stack_free(argv); /* Do not issue an exit or the whole application will terminate instead of just the SDL thread */ /* exit(status); */ diff --git a/libs/SDL2/src/main/haiku/SDL_BApp.h b/libs/SDL2/src/main/haiku/SDL_BApp.h index 1c5dbb84..157c2363 100644 --- a/libs/SDL2/src/main/haiku/SDL_BApp.h +++ b/libs/SDL2/src/main/haiku/SDL_BApp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/main/haiku/SDL_BeApp.cc b/libs/SDL2/src/main/haiku/SDL_BeApp.cc index f09afb2e..36c2a1ab 100644 --- a/libs/SDL2/src/main/haiku/SDL_BeApp.cc +++ b/libs/SDL2/src/main/haiku/SDL_BeApp.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/main/haiku/SDL_BeApp.h b/libs/SDL2/src/main/haiku/SDL_BeApp.h index b1cb9501..6700a3be 100644 --- a/libs/SDL2/src/main/haiku/SDL_BeApp.h +++ b/libs/SDL2/src/main/haiku/SDL_BeApp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/main/nacl/SDL_nacl_main.c b/libs/SDL2/src/main/nacl/SDL_nacl_main.c index 378db7af..4c01d0fb 100644 --- a/libs/SDL2/src/main/nacl/SDL_nacl_main.c +++ b/libs/SDL2/src/main/nacl/SDL_nacl_main.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/main/windows/version.rc b/libs/SDL2/src/main/windows/version.rc index d9fbffc7..b4f79b23 100644 --- a/libs/SDL2/src/main/windows/version.rc +++ b/libs/SDL2/src/main/windows/version.rc @@ -25,7 +25,7 @@ BEGIN VALUE "FileDescription", "SDL\0" VALUE "FileVersion", "2, 0, 4, 0\0" VALUE "InternalName", "SDL\0" - VALUE "LegalCopyright", "Copyright © 2015 Sam Lantinga\0" + VALUE "LegalCopyright", "Copyright © 2016 Sam Lantinga\0" VALUE "OriginalFilename", "SDL2.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" VALUE "ProductVersion", "2, 0, 4, 0\0" diff --git a/libs/SDL2/src/power/SDL_power.c b/libs/SDL2/src/power/SDL_power.c index 8f919f2e..016013b9 100644 --- a/libs/SDL2/src/power/SDL_power.c +++ b/libs/SDL2/src/power/SDL_power.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/power/android/SDL_syspower.c b/libs/SDL2/src/power/android/SDL_syspower.c index 94a4ff4c..5a4b0fc1 100644 --- a/libs/SDL2/src/power/android/SDL_syspower.c +++ b/libs/SDL2/src/power/android/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/power/emscripten/SDL_syspower.c b/libs/SDL2/src/power/emscripten/SDL_syspower.c index 3a2b4ed8..307f7974 100644 --- a/libs/SDL2/src/power/emscripten/SDL_syspower.c +++ b/libs/SDL2/src/power/emscripten/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/power/haiku/SDL_syspower.c b/libs/SDL2/src/power/haiku/SDL_syspower.c index 2d87806a..cfda8c96 100644 --- a/libs/SDL2/src/power/haiku/SDL_syspower.c +++ b/libs/SDL2/src/power/haiku/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/power/linux/SDL_syspower.c b/libs/SDL2/src/power/linux/SDL_syspower.c index 3986489f..793e2666 100644 --- a/libs/SDL2/src/power/linux/SDL_syspower.c +++ b/libs/SDL2/src/power/linux/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/power/macosx/SDL_syspower.c b/libs/SDL2/src/power/macosx/SDL_syspower.c index d029de5d..f865d59e 100644 --- a/libs/SDL2/src/power/macosx/SDL_syspower.c +++ b/libs/SDL2/src/power/macosx/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/power/psp/SDL_syspower.c b/libs/SDL2/src/power/psp/SDL_syspower.c index 55011080..76c21b94 100644 --- a/libs/SDL2/src/power/psp/SDL_syspower.c +++ b/libs/SDL2/src/power/psp/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/power/uikit/SDL_syspower.h b/libs/SDL2/src/power/uikit/SDL_syspower.h index 7b0e5242..4cfa5c97 100644 --- a/libs/SDL2/src/power/uikit/SDL_syspower.h +++ b/libs/SDL2/src/power/uikit/SDL_syspower.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/power/uikit/SDL_syspower.m b/libs/SDL2/src/power/uikit/SDL_syspower.m index 2851c109..14ce3576 100644 --- a/libs/SDL2/src/power/uikit/SDL_syspower.m +++ b/libs/SDL2/src/power/uikit/SDL_syspower.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/power/windows/SDL_syspower.c b/libs/SDL2/src/power/windows/SDL_syspower.c index 5c9e0240..ff3784cc 100644 --- a/libs/SDL2/src/power/windows/SDL_syspower.c +++ b/libs/SDL2/src/power/windows/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/power/winrt/SDL_syspower.cpp b/libs/SDL2/src/power/winrt/SDL_syspower.cpp index cce6bede..94e5a285 100644 --- a/libs/SDL2/src/power/winrt/SDL_syspower.cpp +++ b/libs/SDL2/src/power/winrt/SDL_syspower.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/SDL_d3dmath.c b/libs/SDL2/src/render/SDL_d3dmath.c index 058b3af2..83d67bfa 100644 --- a/libs/SDL2/src/render/SDL_d3dmath.c +++ b/libs/SDL2/src/render/SDL_d3dmath.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/SDL_d3dmath.h b/libs/SDL2/src/render/SDL_d3dmath.h index 34a226d5..87c44c7a 100644 --- a/libs/SDL2/src/render/SDL_d3dmath.h +++ b/libs/SDL2/src/render/SDL_d3dmath.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/SDL_render.c b/libs/SDL2/src/render/SDL_render.c index bb0113ba..097ffa02 100644 --- a/libs/SDL2/src/render/SDL_render.c +++ b/libs/SDL2/src/render/SDL_render.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -1154,7 +1154,19 @@ UpdateLogicalSize(SDL_Renderer *renderer) /* Clear the scale because we're setting viewport in output coordinates */ SDL_RenderSetScale(renderer, 1.0f, 1.0f); - if (SDL_fabs(want_aspect-real_aspect) < 0.0001) { + if (renderer->integer_scale) { + if (want_aspect > real_aspect) { + scale = (float)(w / renderer->logical_w); + } else { + scale = (float)(h / renderer->logical_h); + } + viewport.w = (int)SDL_ceil(renderer->logical_w * scale); + viewport.x = (w - viewport.w) / 2; + viewport.h = (int)SDL_ceil(renderer->logical_h * scale); + viewport.y = (h - viewport.h) / 2; + + SDL_RenderSetViewport(renderer, &viewport); + } else if (SDL_fabs(want_aspect-real_aspect) < 0.0001) { /* The aspect ratios are the same, just scale appropriately */ scale = (float)w / renderer->logical_w; SDL_RenderSetViewport(renderer, NULL); @@ -1215,6 +1227,24 @@ SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *h) } } +int +SDL_RenderSetIntegerScale(SDL_Renderer * renderer, SDL_bool enable) +{ + CHECK_RENDERER_MAGIC(renderer, -1); + + renderer->integer_scale = enable; + + return UpdateLogicalSize(renderer); +} + +SDL_bool +SDLCALL SDL_RenderGetIntegerScale(SDL_Renderer * renderer) +{ + CHECK_RENDERER_MAGIC(renderer, SDL_FALSE); + + return renderer->integer_scale; +} + int SDL_RenderSetViewport(SDL_Renderer * renderer, const SDL_Rect * rect) { diff --git a/libs/SDL2/src/render/SDL_sysrender.h b/libs/SDL2/src/render/SDL_sysrender.h index 9c74ebbe..378fc4d9 100644 --- a/libs/SDL2/src/render/SDL_sysrender.h +++ b/libs/SDL2/src/render/SDL_sysrender.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -135,6 +135,9 @@ struct SDL_Renderer int logical_w_backup; int logical_h_backup; + /* Whether or not to force the viewport to even integer intervals */ + SDL_bool integer_scale; + /* The drawable area within the window */ SDL_Rect viewport; SDL_Rect viewport_backup; diff --git a/libs/SDL2/src/render/SDL_yuv_mmx.c b/libs/SDL2/src/render/SDL_yuv_mmx.c index f9320bfb..0de776a3 100644 --- a/libs/SDL2/src/render/SDL_yuv_mmx.c +++ b/libs/SDL2/src/render/SDL_yuv_mmx.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/SDL_yuv_sw.c b/libs/SDL2/src/render/SDL_yuv_sw.c index a9ad87aa..7fc6b886 100644 --- a/libs/SDL2/src/render/SDL_yuv_sw.c +++ b/libs/SDL2/src/render/SDL_yuv_sw.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/SDL_yuv_sw_c.h b/libs/SDL2/src/render/SDL_yuv_sw_c.h index 3b3a266f..2752096f 100644 --- a/libs/SDL2/src/render/SDL_yuv_sw_c.h +++ b/libs/SDL2/src/render/SDL_yuv_sw_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/direct3d/SDL_render_d3d.c b/libs/SDL2/src/render/direct3d/SDL_render_d3d.c index 910ceb37..9d756422 100644 --- a/libs/SDL2/src/render/direct3d/SDL_render_d3d.c +++ b/libs/SDL2/src/render/direct3d/SDL_render_d3d.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/direct3d11/SDL_render_d3d11.c b/libs/SDL2/src/render/direct3d11/SDL_render_d3d11.c index 941c3d79..a48eacee 100644 --- a/libs/SDL2/src/render/direct3d11/SDL_render_d3d11.c +++ b/libs/SDL2/src/render/direct3d11/SDL_render_d3d11.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/direct3d11/SDL_render_winrt.cpp b/libs/SDL2/src/render/direct3d11/SDL_render_winrt.cpp index 99136662..99f2b4ea 100644 --- a/libs/SDL2/src/render/direct3d11/SDL_render_winrt.cpp +++ b/libs/SDL2/src/render/direct3d11/SDL_render_winrt.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/direct3d11/SDL_render_winrt.h b/libs/SDL2/src/render/direct3d11/SDL_render_winrt.h index 5c76b70f..734ebf41 100644 --- a/libs/SDL2/src/render/direct3d11/SDL_render_winrt.h +++ b/libs/SDL2/src/render/direct3d11/SDL_render_winrt.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/opengl/SDL_glfuncs.h b/libs/SDL2/src/render/opengl/SDL_glfuncs.h index a9f38c43..c8eba583 100644 --- a/libs/SDL2/src/render/opengl/SDL_glfuncs.h +++ b/libs/SDL2/src/render/opengl/SDL_glfuncs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/opengl/SDL_render_gl.c b/libs/SDL2/src/render/opengl/SDL_render_gl.c index 0430a25e..6a4fa3ec 100644 --- a/libs/SDL2/src/render/opengl/SDL_render_gl.c +++ b/libs/SDL2/src/render/opengl/SDL_render_gl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/opengl/SDL_shaders_gl.c b/libs/SDL2/src/render/opengl/SDL_shaders_gl.c index f0885523..bcf7b431 100644 --- a/libs/SDL2/src/render/opengl/SDL_shaders_gl.c +++ b/libs/SDL2/src/render/opengl/SDL_shaders_gl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/opengl/SDL_shaders_gl.h b/libs/SDL2/src/render/opengl/SDL_shaders_gl.h index 1b2e4a5a..261627cc 100644 --- a/libs/SDL2/src/render/opengl/SDL_shaders_gl.h +++ b/libs/SDL2/src/render/opengl/SDL_shaders_gl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/opengles/SDL_glesfuncs.h b/libs/SDL2/src/render/opengles/SDL_glesfuncs.h index 4eb72d6b..a15d76d4 100644 --- a/libs/SDL2/src/render/opengles/SDL_glesfuncs.h +++ b/libs/SDL2/src/render/opengles/SDL_glesfuncs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/opengles/SDL_render_gles.c b/libs/SDL2/src/render/opengles/SDL_render_gles.c index c66018de..0d59da36 100644 --- a/libs/SDL2/src/render/opengles/SDL_render_gles.c +++ b/libs/SDL2/src/render/opengles/SDL_render_gles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/opengles2/SDL_gles2funcs.h b/libs/SDL2/src/render/opengles2/SDL_gles2funcs.h index 36dcf742..0ecfa7f9 100644 --- a/libs/SDL2/src/render/opengles2/SDL_gles2funcs.h +++ b/libs/SDL2/src/render/opengles2/SDL_gles2funcs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/opengles2/SDL_render_gles2.c b/libs/SDL2/src/render/opengles2/SDL_render_gles2.c index 87d7b3df..e41ab623 100644 --- a/libs/SDL2/src/render/opengles2/SDL_render_gles2.c +++ b/libs/SDL2/src/render/opengles2/SDL_render_gles2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.c b/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.c index 6f650811..0c01a8c6 100644 --- a/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.c +++ b/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.h b/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.h index f22c8f56..3958ae00 100644 --- a/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.h +++ b/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/psp/SDL_render_psp.c b/libs/SDL2/src/render/psp/SDL_render_psp.c index 39a2eab6..8e8c8735 100644 --- a/libs/SDL2/src/render/psp/SDL_render_psp.c +++ b/libs/SDL2/src/render/psp/SDL_render_psp.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_blendfillrect.c b/libs/SDL2/src/render/software/SDL_blendfillrect.c index 669422f7..7cfb274a 100644 --- a/libs/SDL2/src/render/software/SDL_blendfillrect.c +++ b/libs/SDL2/src/render/software/SDL_blendfillrect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_blendfillrect.h b/libs/SDL2/src/render/software/SDL_blendfillrect.h index b612db24..88bb2e2c 100644 --- a/libs/SDL2/src/render/software/SDL_blendfillrect.h +++ b/libs/SDL2/src/render/software/SDL_blendfillrect.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_blendline.c b/libs/SDL2/src/render/software/SDL_blendline.c index b2090b13..ef0d5853 100644 --- a/libs/SDL2/src/render/software/SDL_blendline.c +++ b/libs/SDL2/src/render/software/SDL_blendline.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_blendline.h b/libs/SDL2/src/render/software/SDL_blendline.h index 602cafd6..c0b545f3 100644 --- a/libs/SDL2/src/render/software/SDL_blendline.h +++ b/libs/SDL2/src/render/software/SDL_blendline.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_blendpoint.c b/libs/SDL2/src/render/software/SDL_blendpoint.c index 47243794..fc42dfe7 100644 --- a/libs/SDL2/src/render/software/SDL_blendpoint.c +++ b/libs/SDL2/src/render/software/SDL_blendpoint.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_blendpoint.h b/libs/SDL2/src/render/software/SDL_blendpoint.h index 7045326a..58ddec7e 100644 --- a/libs/SDL2/src/render/software/SDL_blendpoint.h +++ b/libs/SDL2/src/render/software/SDL_blendpoint.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_draw.h b/libs/SDL2/src/render/software/SDL_draw.h index e2822427..3a5e7cf1 100644 --- a/libs/SDL2/src/render/software/SDL_draw.h +++ b/libs/SDL2/src/render/software/SDL_draw.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_drawline.c b/libs/SDL2/src/render/software/SDL_drawline.c index e76c3f40..fd50ea74 100644 --- a/libs/SDL2/src/render/software/SDL_drawline.c +++ b/libs/SDL2/src/render/software/SDL_drawline.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_drawline.h b/libs/SDL2/src/render/software/SDL_drawline.h index e2dafeae..40721c3f 100644 --- a/libs/SDL2/src/render/software/SDL_drawline.h +++ b/libs/SDL2/src/render/software/SDL_drawline.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_drawpoint.c b/libs/SDL2/src/render/software/SDL_drawpoint.c index 38ea4b74..98f0d83c 100644 --- a/libs/SDL2/src/render/software/SDL_drawpoint.c +++ b/libs/SDL2/src/render/software/SDL_drawpoint.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_drawpoint.h b/libs/SDL2/src/render/software/SDL_drawpoint.h index d26c2b58..e77857ac 100644 --- a/libs/SDL2/src/render/software/SDL_drawpoint.h +++ b/libs/SDL2/src/render/software/SDL_drawpoint.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_render_sw.c b/libs/SDL2/src/render/software/SDL_render_sw.c index 119b2001..dadd2442 100644 --- a/libs/SDL2/src/render/software/SDL_render_sw.c +++ b/libs/SDL2/src/render/software/SDL_render_sw.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_render_sw_c.h b/libs/SDL2/src/render/software/SDL_render_sw_c.h index df1a6473..89b4e8ac 100644 --- a/libs/SDL2/src/render/software/SDL_render_sw_c.h +++ b/libs/SDL2/src/render/software/SDL_render_sw_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_rotate.h b/libs/SDL2/src/render/software/SDL_rotate.h index 01ceb2d8..338109fc 100644 --- a/libs/SDL2/src/render/software/SDL_rotate.h +++ b/libs/SDL2/src/render/software/SDL_rotate.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/stdlib/SDL_getenv.c b/libs/SDL2/src/stdlib/SDL_getenv.c index 7936498c..3fc4119f 100644 --- a/libs/SDL2/src/stdlib/SDL_getenv.c +++ b/libs/SDL2/src/stdlib/SDL_getenv.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/stdlib/SDL_iconv.c b/libs/SDL2/src/stdlib/SDL_iconv.c index 31efb426..8f040373 100644 --- a/libs/SDL2/src/stdlib/SDL_iconv.c +++ b/libs/SDL2/src/stdlib/SDL_iconv.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/stdlib/SDL_malloc.c b/libs/SDL2/src/stdlib/SDL_malloc.c index 996e5d24..d640c8fa 100644 --- a/libs/SDL2/src/stdlib/SDL_malloc.c +++ b/libs/SDL2/src/stdlib/SDL_malloc.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/stdlib/SDL_qsort.c b/libs/SDL2/src/stdlib/SDL_qsort.c index 0d197842..2ef33b15 100644 --- a/libs/SDL2/src/stdlib/SDL_qsort.c +++ b/libs/SDL2/src/stdlib/SDL_qsort.c @@ -1,46 +1,23 @@ -/* qsort.c - * (c) 1998 Gareth McCaughan - * - * This is a drop-in replacement for the C library's |qsort()| routine. - * - * Features: - * - Median-of-three pivoting (and more) - * - Truncation and final polishing by a single insertion sort - * - Early truncation when no swaps needed in pivoting step - * - Explicit recursion, guaranteed not to overflow - * - A few little wrinkles stolen from the GNU |qsort()|. - * - separate code for non-aligned / aligned / word-size objects - * - * This code may be reproduced freely provided - * - this file is retained unaltered apart from minor - * changes for portability and efficiency - * - no changes are made to this comment - * - any changes that *are* made are clearly flagged - * - the _ID string below is altered by inserting, after - * the date, the string " altered" followed at your option - * by other material. (Exceptions: you may change the name - * of the exported routine without changing the ID string. - * You may change the values of the macros TRUNC_* and - * PIVOT_THRESHOLD without changing the ID string, provided - * they remain constants with TRUNC_nonaligned, TRUNC_aligned - * and TRUNC_words/WORD_BYTES between 8 and 24, and - * PIVOT_THRESHOLD between 32 and 200.) - * - * You may use it in anything you like; you may make money - * out of it; you may distribute it in object form or as - * part of an executable without including source code; - * you don't have to credit me. (But it would be nice if - * you did.) - * - * If you find problems with this code, or find ways of - * making it significantly faster, please let me know! - * My e-mail address, valid as of early 1998 and certainly - * OK for at least the next 18 months, is - * gjm11@dpmms.cam.ac.uk - * Thanks! - * - * Gareth McCaughan Peterhouse Cambridge 1998 - */ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2016 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ #if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS) #define SDL_DISABLE_ANALYZE_MACROS 1 @@ -48,11 +25,6 @@ #include "../SDL_internal.h" -/* -#include -#include -#include -*/ #include "SDL_stdinc.h" #include "SDL_assert.h" @@ -62,34 +34,128 @@ SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, c { qsort(base, nmemb, size, compare); } + #else #ifdef assert #undef assert #endif -#define assert(X) SDL_assert(X) +#define assert SDL_assert #ifdef malloc #undef malloc #endif -#define malloc SDL_malloc +#define malloc SDL_malloc #ifdef free #undef free #endif -#define free SDL_free +#define free SDL_free #ifdef memcpy #undef memcpy #endif -#define memcpy SDL_memcpy +#define memcpy SDL_memcpy #ifdef memmove #undef memmove #endif -#define memmove SDL_memmove -#ifdef qsort -#undef qsort +#define memmove SDL_memmove +#ifdef qsortG +#undef qsortG #endif -#define qsort SDL_qsort +#define qsortG SDL_qsort -static const char _ID[] = ""; +/* +This code came from Gareth McCaughan, under the zlib license. +Specifically this: https://www.mccaughan.org.uk/software/qsort.c-1.14 + +Everything below this comment until the HAVE_QSORT #endif was from Gareth +(any minor changes will be noted inline). + +Thank you to Gareth for relicensing this code under the zlib license for our +benefit! + +--ryan. +*/ + +/* This is a drop-in replacement for the C library's |qsort()| routine. + * + * It is intended for use where you know or suspect that your + * platform's qsort is bad. If that isn't the case, then you + * should probably use the qsort your system gives you in preference + * to mine -- it will likely have been tested and tuned better. + * + * Features: + * - Median-of-three pivoting (and more) + * - Truncation and final polishing by a single insertion sort + * - Early truncation when no swaps needed in pivoting step + * - Explicit recursion, guaranteed not to overflow + * - A few little wrinkles stolen from the GNU |qsort()|. + * (For the avoidance of doubt, no code was stolen, only + * broad ideas.) + * - separate code for non-aligned / aligned / word-size objects + * + * Earlier releases of this code used an idiosyncratic licence + * I wrote myself, because I'm an idiot. The code is now released + * under the "zlib/libpng licence"; you will find the actual + * terms in the next comment. I request (but do not require) + * that if you make any changes beyond the name of the exported + * routine and reasonable tweaks to the TRUNC_* and + * PIVOT_THRESHOLD values, you modify the _ID string so as + * to make it clear that you have changed the code. + * + * If you find problems with this code, or find ways of + * making it significantly faster, please let me know! + * My e-mail address, valid as of early 2016 and for the + * foreseeable future, is + * gareth.mccaughan@pobox.com + * Thanks! + * + * Gareth McCaughan + */ + +/* Copyright (c) 1998-2016 Gareth McCaughan + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any + * damages arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; + * you must not claim that you wrote the original software. + * If you use this software in a product, an acknowledgment + * in the product documentation would be appreciated but + * is not required. + * + * 2. Altered source versions must be plainly marked as such, + * and must not be misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + */ + +/* Revision history since release: + * 1998-03-19 v1.12 First release I have any records of. + * 2007-09-02 v1.13 Fix bug kindly reported by Dan Bodoh + * (premature termination of recursion). + * Add a few clarifying comments. + * Minor improvements to debug output. + * 2016-02-21 v1.14 Replace licence with 2-clause BSD, + * and clarify a couple of things in + * comments. No code changes. + */ + +/* BEGIN SDL CHANGE ... commented this out with an #if 0 block. --ryan. */ +#if 0 +#include +#include +#include + +#define DEBUG_QSORT + +static char _ID[]=""; +#endif +/* END SDL CHANGE ... commented this out with an #if 0 block. --ryan. */ /* How many bytes are there per word? (Must be a power of 2, * and must in fact equal sizeof(int).) @@ -110,7 +176,7 @@ static const char _ID[] = ""; */ #define TRUNC_nonaligned 12 #define TRUNC_aligned 12 -#define TRUNC_words 12*WORD_BYTES /* nb different meaning */ +#define TRUNC_words 12*WORD_BYTES /* nb different meaning */ /* We use a simple pivoting algorithm for shortish sub-arrays * and a more complicated one for larger ones. The threshold @@ -118,11 +184,7 @@ static const char _ID[] = ""; */ #define PIVOT_THRESHOLD 40 -typedef struct -{ - char *first; - char *last; -} stack_entry; +typedef struct { char * first; char * last; } stack_entry; #define pushLeft {stack[stacktop].first=ffirst;stack[stacktop++].last=last;} #define pushRight {stack[stacktop].first=first;stack[stacktop++].last=llast;} #define doLeft {first=ffirst;llast=last;continue;} @@ -197,7 +259,9 @@ typedef struct * 16-bit |int|s and 4096-bit |size_t|s. :-) */ -/* The recursion logic is the same in each case: */ +/* The recursion logic is the same in each case. + * We keep chopping up until we reach subarrays of size + * strictly less than Trunc; we leave these unsorted. */ #define Recurse(Trunc) \ { size_t l=last-ffirst,r=llast-first; \ if (lPIVOT_THRESHOLD*sz) mid=pivot_big(first,mid,last,sz,compare);\ + if (last-first>PIVOT_THRESHOLD*sz) mid=pivot_big(first,mid,last,sz,compare);\ else { \ if (compare(first,mid)<0) { \ if (compare(mid,last)>0) { \ @@ -235,26 +299,28 @@ typedef struct /* and so is the partitioning logic: */ #define Partition(swapper,sz) { \ - int swapped=0; \ do { \ while (compare(first,pivot)<0) first+=sz; \ while (compare(pivot,last)<0) last-=sz; \ if (firstlimit ? limit : nmemb-1)*sz;\ + last=first + ((nmemb>limit ? limit : nmemb)-1)*sz;\ while (last!=base) { \ if (compare(first,last)>0) first=last; \ last-=sz; } \ @@ -294,188 +360,175 @@ typedef struct /* ---------------------------------------------------------------------- */ -static char * -pivot_big(char *first, char *mid, char *last, size_t size, - int compare(const void *, const void *)) -{ - size_t d = (((last - first) / size) >> 3) * size; - char *m1, *m2, *m3; - { - char *a = first, *b = first + d, *c = first + 2 * d; +static char * pivot_big(char *first, char *mid, char *last, size_t size, + int compare(const void *, const void *)) { + int d=(((last-first)/size)>>3)*size; #ifdef DEBUG_QSORT - fprintf(stderr, "< %d %d %d\n", *(int *) a, *(int *) b, *(int *) c); +fprintf(stderr, "pivot_big: first=%p last=%p size=%lu n=%lu\n", first, (unsigned long)last, size, (unsigned long)((last-first+1)/size)); #endif - m1 = compare(a, b) < 0 ? - (compare(b, c) < 0 ? b : (compare(a, c) < 0 ? c : a)) - : (compare(a, c) < 0 ? a : (compare(b, c) < 0 ? c : b)); - } - { - char *a = mid - d, *b = mid, *c = mid + d; + char *m1,*m2,*m3; + { char *a=first, *b=first+d, *c=first+2*d; #ifdef DEBUG_QSORT - fprintf(stderr, ". %d %d %d\n", *(int *) a, *(int *) b, *(int *) c); +fprintf(stderr,"< %d %d %d @ %p %p %p\n",*(int*)a,*(int*)b,*(int*)c, a,b,c); #endif - m2 = compare(a, b) < 0 ? - (compare(b, c) < 0 ? b : (compare(a, c) < 0 ? c : a)) - : (compare(a, c) < 0 ? a : (compare(b, c) < 0 ? c : b)); - } - { - char *a = last - 2 * d, *b = last - d, *c = last; + m1 = compare(a,b)<0 ? + (compare(b,c)<0 ? b : (compare(a,c)<0 ? c : a)) + : (compare(a,c)<0 ? a : (compare(b,c)<0 ? c : b)); + } + { char *a=mid-d, *b=mid, *c=mid+d; #ifdef DEBUG_QSORT - fprintf(stderr, "> %d %d %d\n", *(int *) a, *(int *) b, *(int *) c); +fprintf(stderr,". %d %d %d @ %p %p %p\n",*(int*)a,*(int*)b,*(int*)c, a,b,c); #endif - m3 = compare(a, b) < 0 ? - (compare(b, c) < 0 ? b : (compare(a, c) < 0 ? c : a)) - : (compare(a, c) < 0 ? a : (compare(b, c) < 0 ? c : b)); - } + m2 = compare(a,b)<0 ? + (compare(b,c)<0 ? b : (compare(a,c)<0 ? c : a)) + : (compare(a,c)<0 ? a : (compare(b,c)<0 ? c : b)); + } + { char *a=last-2*d, *b=last-d, *c=last; #ifdef DEBUG_QSORT - fprintf(stderr, "-> %d %d %d\n", *(int *) m1, *(int *) m2, *(int *) m3); +fprintf(stderr,"> %d %d %d @ %p %p %p\n",*(int*)a,*(int*)b,*(int*)c, a,b,c); #endif - return compare(m1, m2) < 0 ? - (compare(m2, m3) < 0 ? m2 : (compare(m1, m3) < 0 ? m3 : m1)) - : (compare(m1, m3) < 0 ? m1 : (compare(m2, m3) < 0 ? m3 : m2)); + m3 = compare(a,b)<0 ? + (compare(b,c)<0 ? b : (compare(a,c)<0 ? c : a)) + : (compare(a,c)<0 ? a : (compare(b,c)<0 ? c : b)); + } +#ifdef DEBUG_QSORT +fprintf(stderr,"-> %d %d %d @ %p %p %p\n",*(int*)m1,*(int*)m2,*(int*)m3, m1,m2,m3); +#endif + return compare(m1,m2)<0 ? + (compare(m2,m3)<0 ? m2 : (compare(m1,m3)<0 ? m3 : m1)) + : (compare(m1,m3)<0 ? m1 : (compare(m2,m3)<0 ? m3 : m2)); } /* ---------------------------------------------------------------------- */ -static void -qsort_nonaligned(void *base, size_t nmemb, size_t size, - int (*compare) (const void *, const void *)) -{ +static void qsort_nonaligned(void *base, size_t nmemb, size_t size, + int (*compare)(const void *, const void *)) { - stack_entry stack[STACK_SIZE]; - int stacktop = 0; - char *first, *last; - char *pivot = malloc(size); - size_t trunc = TRUNC_nonaligned * size; - assert(pivot != 0); + stack_entry stack[STACK_SIZE]; + int stacktop=0; + char *first,*last; + char *pivot=malloc(size); + size_t trunc=TRUNC_nonaligned*size; + assert(pivot!=0); - first = (char *) base; - last = first + (nmemb - 1) * size; + first=(char*)base; last=first+(nmemb-1)*size; - if ((size_t) (last - first) > trunc) { - char *ffirst = first, *llast = last; - while (1) { - /* Select pivot */ - { - char *mid = first + size * ((last - first) / size >> 1); - Pivot(SWAP_nonaligned, size); - memcpy(pivot, mid, size); - } - /* Partition. */ - Partition(SWAP_nonaligned, size); - /* Prepare to recurse/iterate. */ - Recurse(trunc)} + if (last-first>=trunc) { + char *ffirst=first, *llast=last; + while (1) { + /* Select pivot */ + { char * mid=first+size*((last-first)/size >> 1); + Pivot(SWAP_nonaligned,size); + memcpy(pivot,mid,size); + } + /* Partition. */ + Partition(SWAP_nonaligned,size); + /* Prepare to recurse/iterate. */ + Recurse(trunc) } - PreInsertion(SWAP_nonaligned, TRUNC_nonaligned, size); - Insertion(SWAP_nonaligned); - free(pivot); + } + PreInsertion(SWAP_nonaligned,TRUNC_nonaligned,size); + Insertion(SWAP_nonaligned); + free(pivot); } -static void -qsort_aligned(void *base, size_t nmemb, size_t size, - int (*compare) (const void *, const void *)) -{ +static void qsort_aligned(void *base, size_t nmemb, size_t size, + int (*compare)(const void *, const void *)) { - stack_entry stack[STACK_SIZE]; - int stacktop = 0; - char *first, *last; - char *pivot = malloc(size); - size_t trunc = TRUNC_aligned * size; - assert(pivot != 0); + stack_entry stack[STACK_SIZE]; + int stacktop=0; + char *first,*last; + char *pivot=malloc(size); + size_t trunc=TRUNC_aligned*size; + assert(pivot!=0); - first = (char *) base; - last = first + (nmemb - 1) * size; + first=(char*)base; last=first+(nmemb-1)*size; - if ((size_t) (last - first) > trunc) { - char *ffirst = first, *llast = last; - while (1) { - /* Select pivot */ - { - char *mid = first + size * ((last - first) / size >> 1); - Pivot(SWAP_aligned, size); - memcpy(pivot, mid, size); - } - /* Partition. */ - Partition(SWAP_aligned, size); - /* Prepare to recurse/iterate. */ - Recurse(trunc)} + if (last-first>=trunc) { + char *ffirst=first,*llast=last; + while (1) { + /* Select pivot */ + { char * mid=first+size*((last-first)/size >> 1); + Pivot(SWAP_aligned,size); + memcpy(pivot,mid,size); + } + /* Partition. */ + Partition(SWAP_aligned,size); + /* Prepare to recurse/iterate. */ + Recurse(trunc) } - PreInsertion(SWAP_aligned, TRUNC_aligned, size); - Insertion(SWAP_aligned); - free(pivot); + } + PreInsertion(SWAP_aligned,TRUNC_aligned,size); + Insertion(SWAP_aligned); + free(pivot); } -static void -qsort_words(void *base, size_t nmemb, - int (*compare) (const void *, const void *)) -{ +static void qsort_words(void *base, size_t nmemb, + int (*compare)(const void *, const void *)) { - stack_entry stack[STACK_SIZE]; - int stacktop = 0; - char *first, *last; - char *pivot = malloc(WORD_BYTES); - assert(pivot != 0); + stack_entry stack[STACK_SIZE]; + int stacktop=0; + char *first,*last; + char *pivot=malloc(WORD_BYTES); + assert(pivot!=0); - first = (char *) base; - last = first + (nmemb - 1) * WORD_BYTES; + first=(char*)base; last=first+(nmemb-1)*WORD_BYTES; - if (last - first > TRUNC_words) { - char *ffirst = first, *llast = last; - while (1) { + if (last-first>=TRUNC_words) { + char *ffirst=first, *llast=last; + while (1) { #ifdef DEBUG_QSORT - fprintf(stderr, "Doing %d:%d: ", - (first - (char *) base) / WORD_BYTES, - (last - (char *) base) / WORD_BYTES); +fprintf(stderr,"Doing %d:%d: ", + (first-(char*)base)/WORD_BYTES, + (last-(char*)base)/WORD_BYTES); #endif - /* Select pivot */ - { - char *mid = - first + WORD_BYTES * ((last - first) / (2 * WORD_BYTES)); - Pivot(SWAP_words, WORD_BYTES); - *(int *) pivot = *(int *) mid; - } + /* Select pivot */ + { char * mid=first+WORD_BYTES*((last-first) / (2*WORD_BYTES)); + Pivot(SWAP_words,WORD_BYTES); + *(int*)pivot=*(int*)mid; #ifdef DEBUG_QSORT - fprintf(stderr, "pivot=%d\n", *(int *) pivot); +fprintf(stderr,"pivot = %p = #%lu = %d\n", mid, (unsigned long)(((int*)mid)-((int*)base)), *(int*)mid); #endif - /* Partition. */ - Partition(SWAP_words, WORD_BYTES); - /* Prepare to recurse/iterate. */ - Recurse(TRUNC_words)} + } + /* Partition. */ + Partition(SWAP_words,WORD_BYTES); +#ifdef DEBUG_QSORT +fprintf(stderr, "after partitioning first=#%lu last=#%lu\n", (first-(char*)base)/4lu, (last-(char*)base)/4lu); +#endif + /* Prepare to recurse/iterate. */ + Recurse(TRUNC_words) } - PreInsertion(SWAP_words, (TRUNC_words / WORD_BYTES), WORD_BYTES); - /* Now do insertion sort. */ - last = ((char *) base) + nmemb * WORD_BYTES; - for (first = ((char *) base) + WORD_BYTES; first != last; - first += WORD_BYTES) { - /* Find the right place for |first|. My apologies for var reuse */ - int *pl = (int *) (first - WORD_BYTES), *pr = (int *) first; - *(int *) pivot = *(int *) first; - for (; compare(pl, pivot) > 0; pr = pl, --pl) { - *pr = *pl; - } - if (pr != (int *) first) - *pr = *(int *) pivot; - } - free(pivot); + } + PreInsertion(SWAP_words,(TRUNC_words/WORD_BYTES),WORD_BYTES); + /* Now do insertion sort. */ + last=((char*)base)+nmemb*WORD_BYTES; + for (first=((char*)base)+WORD_BYTES;first!=last;first+=WORD_BYTES) { + /* Find the right place for |first|. My apologies for var reuse */ + int *pl=(int*)(first-WORD_BYTES),*pr=(int*)first; + *(int*)pivot=*(int*)first; + for (;compare(pl,pivot)>0;pr=pl,--pl) { + *pr=*pl; } + if (pr!=(int*)first) *pr=*(int*)pivot; + } + free(pivot); } /* ---------------------------------------------------------------------- */ -void -qsort(void *base, size_t nmemb, size_t size, - int (*compare) (const void *, const void *)) -{ +extern void qsortG(void *base, size_t nmemb, size_t size, + int (*compare)(const void *, const void *)) { - if (nmemb <= 1) - return; - if (((uintptr_t) base | size) & (WORD_BYTES - 1)) - qsort_nonaligned(base, nmemb, size, compare); - else if (size != WORD_BYTES) - qsort_aligned(base, nmemb, size, compare); - else - qsort_words(base, nmemb, compare); + if (nmemb<=1) return; + if (((int)base|size)&(WORD_BYTES-1)) + qsort_nonaligned(base,nmemb,size,compare); + else if (size!=WORD_BYTES) + qsort_aligned(base,nmemb,size,compare); + else + qsort_words(base,nmemb,compare); } -#endif /* !SDL_qsort */ + +#endif /* HAVE_QSORT */ /* vi: set ts=4 sw=4 expandtab: */ + diff --git a/libs/SDL2/src/stdlib/SDL_stdlib.c b/libs/SDL2/src/stdlib/SDL_stdlib.c index a488af26..f11f65d6 100644 --- a/libs/SDL2/src/stdlib/SDL_stdlib.c +++ b/libs/SDL2/src/stdlib/SDL_stdlib.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/stdlib/SDL_string.c b/libs/SDL2/src/stdlib/SDL_string.c index 68d88ece..5debb228 100644 --- a/libs/SDL2/src/stdlib/SDL_string.c +++ b/libs/SDL2/src/stdlib/SDL_string.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_assert.c b/libs/SDL2/src/test/SDL_test_assert.c index 12eca146..98a84d38 100644 --- a/libs/SDL2/src/test/SDL_test_assert.c +++ b/libs/SDL2/src/test/SDL_test_assert.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_common.c b/libs/SDL2/src/test/SDL_test_common.c index 2f06a794..8607cf92 100644 --- a/libs/SDL2/src/test/SDL_test_common.c +++ b/libs/SDL2/src/test/SDL_test_common.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -1368,6 +1368,24 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done) } } break; + case SDLK_o: + if (withControl) { + /* Ctrl-O (or Ctrl-Shift-O) changes window opacity. */ + SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + if (window) { + float opacity; + if (SDL_GetWindowOpacity(window, &opacity) == 0) { + if (withShift) { + opacity += 0.20f; + } else { + opacity -= 0.20f; + } + SDL_SetWindowOpacity(window, opacity); + } + } + } + break; + case SDLK_c: if (withControl) { /* Ctrl-C copy awesome text! */ diff --git a/libs/SDL2/src/test/SDL_test_compare.c b/libs/SDL2/src/test/SDL_test_compare.c index 9f74c44d..d06ead9f 100644 --- a/libs/SDL2/src/test/SDL_test_compare.c +++ b/libs/SDL2/src/test/SDL_test_compare.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -43,7 +43,7 @@ int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int bpp, bpp_reference; Uint8 *p, *p_reference; int dist; - int sampleErrorX, sampleErrorY, sampleDist; + int sampleErrorX = 0, sampleErrorY = 0, sampleDist = 0; Uint8 R, G, B, A; Uint8 Rd, Gd, Bd, Ad; char imageFilename[128]; diff --git a/libs/SDL2/src/test/SDL_test_crc32.c b/libs/SDL2/src/test/SDL_test_crc32.c index 7aa0a68f..6e122088 100644 --- a/libs/SDL2/src/test/SDL_test_crc32.c +++ b/libs/SDL2/src/test/SDL_test_crc32.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_font.c b/libs/SDL2/src/test/SDL_test_font.c index 4be29f11..afd35c6c 100644 --- a/libs/SDL2/src/test/SDL_test_font.c +++ b/libs/SDL2/src/test/SDL_test_font.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_fuzzer.c b/libs/SDL2/src/test/SDL_test_fuzzer.c index 9fad1785..1bd8dfa1 100644 --- a/libs/SDL2/src/test/SDL_test_fuzzer.c +++ b/libs/SDL2/src/test/SDL_test_fuzzer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_harness.c b/libs/SDL2/src/test/SDL_test_harness.c index 6dde93f8..fec34164 100644 --- a/libs/SDL2/src/test/SDL_test_harness.c +++ b/libs/SDL2/src/test/SDL_test_harness.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_imageBlit.c b/libs/SDL2/src/test/SDL_test_imageBlit.c index 1b9ed7bf..5896ca09 100644 --- a/libs/SDL2/src/test/SDL_test_imageBlit.c +++ b/libs/SDL2/src/test/SDL_test_imageBlit.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_imageBlitBlend.c b/libs/SDL2/src/test/SDL_test_imageBlitBlend.c index 963520bd..6e8c2f1b 100644 --- a/libs/SDL2/src/test/SDL_test_imageBlitBlend.c +++ b/libs/SDL2/src/test/SDL_test_imageBlitBlend.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_imageFace.c b/libs/SDL2/src/test/SDL_test_imageFace.c index 37498d87..84f5037f 100644 --- a/libs/SDL2/src/test/SDL_test_imageFace.c +++ b/libs/SDL2/src/test/SDL_test_imageFace.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_imagePrimitives.c b/libs/SDL2/src/test/SDL_test_imagePrimitives.c index 5576d3d2..4ab48d2d 100644 --- a/libs/SDL2/src/test/SDL_test_imagePrimitives.c +++ b/libs/SDL2/src/test/SDL_test_imagePrimitives.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_imagePrimitivesBlend.c b/libs/SDL2/src/test/SDL_test_imagePrimitivesBlend.c index c8e19930..5e538628 100644 --- a/libs/SDL2/src/test/SDL_test_imagePrimitivesBlend.c +++ b/libs/SDL2/src/test/SDL_test_imagePrimitivesBlend.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_log.c b/libs/SDL2/src/test/SDL_test_log.c index ed7139b6..097372e7 100644 --- a/libs/SDL2/src/test/SDL_test_log.c +++ b/libs/SDL2/src/test/SDL_test_log.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_md5.c b/libs/SDL2/src/test/SDL_test_md5.c index 291ad6b2..7cc35675 100644 --- a/libs/SDL2/src/test/SDL_test_md5.c +++ b/libs/SDL2/src/test/SDL_test_md5.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_random.c b/libs/SDL2/src/test/SDL_test_random.c index 088c301a..c5baaa64 100644 --- a/libs/SDL2/src/test/SDL_test_random.c +++ b/libs/SDL2/src/test/SDL_test_random.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/SDL_systhread.h b/libs/SDL2/src/thread/SDL_systhread.h index d3eab1f3..f13f3e20 100644 --- a/libs/SDL2/src/thread/SDL_systhread.h +++ b/libs/SDL2/src/thread/SDL_systhread.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/SDL_thread.c b/libs/SDL2/src/thread/SDL_thread.c index 8bc37fac..e66c5819 100644 --- a/libs/SDL2/src/thread/SDL_thread.c +++ b/libs/SDL2/src/thread/SDL_thread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/SDL_thread_c.h b/libs/SDL2/src/thread/SDL_thread_c.h index 2df71254..a283a0e2 100644 --- a/libs/SDL2/src/thread/SDL_thread_c.h +++ b/libs/SDL2/src/thread/SDL_thread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/generic/SDL_syscond.c b/libs/SDL2/src/thread/generic/SDL_syscond.c index 6e7f9b33..e2ccd88e 100644 --- a/libs/SDL2/src/thread/generic/SDL_syscond.c +++ b/libs/SDL2/src/thread/generic/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/generic/SDL_sysmutex.c b/libs/SDL2/src/thread/generic/SDL_sysmutex.c index 0c7a8514..f2f66897 100644 --- a/libs/SDL2/src/thread/generic/SDL_sysmutex.c +++ b/libs/SDL2/src/thread/generic/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/generic/SDL_sysmutex_c.h b/libs/SDL2/src/thread/generic/SDL_sysmutex_c.h index 7481b665..9dba5e16 100644 --- a/libs/SDL2/src/thread/generic/SDL_sysmutex_c.h +++ b/libs/SDL2/src/thread/generic/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/generic/SDL_syssem.c b/libs/SDL2/src/thread/generic/SDL_syssem.c index cae084db..92afcb0c 100644 --- a/libs/SDL2/src/thread/generic/SDL_syssem.c +++ b/libs/SDL2/src/thread/generic/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/generic/SDL_systhread.c b/libs/SDL2/src/thread/generic/SDL_systhread.c index b248165f..7a81a620 100644 --- a/libs/SDL2/src/thread/generic/SDL_systhread.c +++ b/libs/SDL2/src/thread/generic/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/generic/SDL_systhread_c.h b/libs/SDL2/src/thread/generic/SDL_systhread_c.h index 30ba69ea..ea9b7146 100644 --- a/libs/SDL2/src/thread/generic/SDL_systhread_c.h +++ b/libs/SDL2/src/thread/generic/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/generic/SDL_systls.c b/libs/SDL2/src/thread/generic/SDL_systls.c index 99bfce77..e29c1981 100644 --- a/libs/SDL2/src/thread/generic/SDL_systls.c +++ b/libs/SDL2/src/thread/generic/SDL_systls.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/psp/SDL_syscond.c b/libs/SDL2/src/thread/psp/SDL_syscond.c index d4ff59d5..a84b206c 100644 --- a/libs/SDL2/src/thread/psp/SDL_syscond.c +++ b/libs/SDL2/src/thread/psp/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/psp/SDL_sysmutex.c b/libs/SDL2/src/thread/psp/SDL_sysmutex.c index e0f411ea..78129fa6 100644 --- a/libs/SDL2/src/thread/psp/SDL_sysmutex.c +++ b/libs/SDL2/src/thread/psp/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/psp/SDL_sysmutex_c.h b/libs/SDL2/src/thread/psp/SDL_sysmutex_c.h index 7481b665..9dba5e16 100644 --- a/libs/SDL2/src/thread/psp/SDL_sysmutex_c.h +++ b/libs/SDL2/src/thread/psp/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/psp/SDL_syssem.c b/libs/SDL2/src/thread/psp/SDL_syssem.c index cfbbe433..643406c4 100644 --- a/libs/SDL2/src/thread/psp/SDL_syssem.c +++ b/libs/SDL2/src/thread/psp/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/psp/SDL_systhread.c b/libs/SDL2/src/thread/psp/SDL_systhread.c index 95141cc8..ab8aff37 100644 --- a/libs/SDL2/src/thread/psp/SDL_systhread.c +++ b/libs/SDL2/src/thread/psp/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/psp/SDL_systhread_c.h b/libs/SDL2/src/thread/psp/SDL_systhread_c.h index 2c5de1ba..4f74df06 100644 --- a/libs/SDL2/src/thread/psp/SDL_systhread_c.h +++ b/libs/SDL2/src/thread/psp/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/pthread/SDL_syscond.c b/libs/SDL2/src/thread/pthread/SDL_syscond.c index 2b0e0a53..998ac55b 100644 --- a/libs/SDL2/src/thread/pthread/SDL_syscond.c +++ b/libs/SDL2/src/thread/pthread/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/pthread/SDL_sysmutex.c b/libs/SDL2/src/thread/pthread/SDL_sysmutex.c index d7fa982c..f24cfdab 100644 --- a/libs/SDL2/src/thread/pthread/SDL_sysmutex.c +++ b/libs/SDL2/src/thread/pthread/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/pthread/SDL_sysmutex_c.h b/libs/SDL2/src/thread/pthread/SDL_sysmutex_c.h index 475275a2..ee60ca04 100644 --- a/libs/SDL2/src/thread/pthread/SDL_sysmutex_c.h +++ b/libs/SDL2/src/thread/pthread/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/pthread/SDL_syssem.c b/libs/SDL2/src/thread/pthread/SDL_syssem.c index a89a262a..b7547e69 100644 --- a/libs/SDL2/src/thread/pthread/SDL_syssem.c +++ b/libs/SDL2/src/thread/pthread/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/pthread/SDL_systhread.c b/libs/SDL2/src/thread/pthread/SDL_systhread.c index a18fa986..22f7bd57 100644 --- a/libs/SDL2/src/thread/pthread/SDL_systhread.c +++ b/libs/SDL2/src/thread/pthread/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/pthread/SDL_systhread_c.h b/libs/SDL2/src/thread/pthread/SDL_systhread_c.h index 3a25f47a..4ad18844 100644 --- a/libs/SDL2/src/thread/pthread/SDL_systhread_c.h +++ b/libs/SDL2/src/thread/pthread/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/pthread/SDL_systls.c b/libs/SDL2/src/thread/pthread/SDL_systls.c index 0440af57..622ad029 100644 --- a/libs/SDL2/src/thread/pthread/SDL_systls.c +++ b/libs/SDL2/src/thread/pthread/SDL_systls.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/stdcpp/SDL_syscond.cpp b/libs/SDL2/src/thread/stdcpp/SDL_syscond.cpp index 69e10685..976bff48 100644 --- a/libs/SDL2/src/thread/stdcpp/SDL_syscond.cpp +++ b/libs/SDL2/src/thread/stdcpp/SDL_syscond.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/stdcpp/SDL_sysmutex.cpp b/libs/SDL2/src/thread/stdcpp/SDL_sysmutex.cpp index da411612..04028627 100644 --- a/libs/SDL2/src/thread/stdcpp/SDL_sysmutex.cpp +++ b/libs/SDL2/src/thread/stdcpp/SDL_sysmutex.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/stdcpp/SDL_sysmutex_c.h b/libs/SDL2/src/thread/stdcpp/SDL_sysmutex_c.h index d7b5b218..ab0f2dd8 100644 --- a/libs/SDL2/src/thread/stdcpp/SDL_sysmutex_c.h +++ b/libs/SDL2/src/thread/stdcpp/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/stdcpp/SDL_systhread.cpp b/libs/SDL2/src/thread/stdcpp/SDL_systhread.cpp index ab8e1505..219c67e9 100644 --- a/libs/SDL2/src/thread/stdcpp/SDL_systhread.cpp +++ b/libs/SDL2/src/thread/stdcpp/SDL_systhread.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/stdcpp/SDL_systhread_c.h b/libs/SDL2/src/thread/stdcpp/SDL_systhread_c.h index d3affedc..c3cc507c 100644 --- a/libs/SDL2/src/thread/stdcpp/SDL_systhread_c.h +++ b/libs/SDL2/src/thread/stdcpp/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/windows/SDL_sysmutex.c b/libs/SDL2/src/thread/windows/SDL_sysmutex.c index 3b75ded8..413cb670 100644 --- a/libs/SDL2/src/thread/windows/SDL_sysmutex.c +++ b/libs/SDL2/src/thread/windows/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/windows/SDL_syssem.c b/libs/SDL2/src/thread/windows/SDL_syssem.c index 1f0a8dfc..86b58882 100644 --- a/libs/SDL2/src/thread/windows/SDL_syssem.c +++ b/libs/SDL2/src/thread/windows/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/windows/SDL_systhread.c b/libs/SDL2/src/thread/windows/SDL_systhread.c index 9217ebc3..2f22b890 100644 --- a/libs/SDL2/src/thread/windows/SDL_systhread.c +++ b/libs/SDL2/src/thread/windows/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -145,9 +145,6 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args) return 0; } -#if 0 /* !!! FIXME: revisit this later. See https://bugzilla.libsdl.org/show_bug.cgi?id=2089 */ -#ifdef _MSC_VER -#pragma warning(disable : 4733) #pragma pack(push,8) typedef struct tagTHREADNAME_INFO { @@ -158,48 +155,20 @@ typedef struct tagTHREADNAME_INFO } THREADNAME_INFO; #pragma pack(pop) -static EXCEPTION_DISPOSITION -ignore_exception(void *a, void *b, void *c, void *d) -{ - return ExceptionContinueExecution; -} -#endif -#endif - void SDL_SYS_SetupThread(const char *name) { - if (name != NULL) { - #if 0 /* !!! FIXME: revisit this later. See https://bugzilla.libsdl.org/show_bug.cgi?id=2089 */ - #if (defined(_MSC_VER) && defined(_M_IX86)) - /* This magic tells the debugger to name a thread if it's listening. - The inline asm sets up SEH (__try/__except) without C runtime - support. See Microsoft Systems Journal, January 1997: - http://www.microsoft.com/msj/0197/exception/exception.aspx */ - INT_PTR handler = (INT_PTR) ignore_exception; + if ((name != NULL) && IsDebuggerPresent()) { + /* This magic tells the debugger to name a thread if it's listening. */ THREADNAME_INFO inf; - + SDL_zero(inf); inf.dwType = 0x1000; inf.szName = name; inf.dwThreadID = (DWORD) -1; inf.dwFlags = 0; - __asm { /* set up SEH */ - push handler - push fs:[0] - mov fs:[0],esp - } - - /* The program itself should ignore this bogus exception. */ - RaiseException(0x406D1388, 0, sizeof(inf)/sizeof(DWORD), (DWORD*)&inf); - - __asm { /* tear down SEH. */ - mov eax,[esp] - mov fs:[0], eax - add esp, 8 - } - #endif - #endif + /* The debugger catches this, renames the thread, continues on. */ + RaiseException(0x406D1388, 0, sizeof(inf) / sizeof(ULONG), (const ULONG_PTR*) &inf); } } @@ -230,11 +199,7 @@ SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) void SDL_SYS_WaitThread(SDL_Thread * thread) { -#if __WINRT__ WaitForSingleObjectEx(thread->handle, INFINITE, FALSE); -#else - WaitForSingleObject(thread->handle, INFINITE); -#endif CloseHandle(thread->handle); } diff --git a/libs/SDL2/src/thread/windows/SDL_systhread_c.h b/libs/SDL2/src/thread/windows/SDL_systhread_c.h index 0beafe88..90866a7b 100644 --- a/libs/SDL2/src/thread/windows/SDL_systhread_c.h +++ b/libs/SDL2/src/thread/windows/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/windows/SDL_systls.c b/libs/SDL2/src/thread/windows/SDL_systls.c index 67c84741..7ec630e8 100644 --- a/libs/SDL2/src/thread/windows/SDL_systls.c +++ b/libs/SDL2/src/thread/windows/SDL_systls.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/timer/SDL_timer.c b/libs/SDL2/src/timer/SDL_timer.c index 2e5e544c..ea24af84 100644 --- a/libs/SDL2/src/timer/SDL_timer.c +++ b/libs/SDL2/src/timer/SDL_timer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,7 +35,7 @@ typedef struct _SDL_Timer void *param; Uint32 interval; Uint32 scheduled; - volatile SDL_bool canceled; + SDL_atomic_t canceled; struct _SDL_Timer *next; } SDL_Timer; @@ -60,9 +60,9 @@ typedef struct { /* Data used to communicate with the timer thread */ SDL_SpinLock lock; SDL_sem *sem; - SDL_Timer * volatile pending; - SDL_Timer * volatile freelist; - volatile SDL_bool active; + SDL_Timer *pending; + SDL_Timer *freelist; + SDL_atomic_t active; /* List of timers - this is only touched by the timer thread */ SDL_Timer *timers; @@ -138,7 +138,7 @@ SDL_TimerThread(void *_data) freelist_tail = NULL; /* Check to see if we're still running, after maintenance */ - if (!data->active) { + if (!SDL_AtomicGet(&data->active)) { break; } @@ -160,7 +160,7 @@ SDL_TimerThread(void *_data) /* We're going to do something with this timer */ data->timers = current->next; - if (current->canceled) { + if (SDL_AtomicGet(¤t->canceled)) { interval = 0; } else { interval = current->callback(current->interval, current->param); @@ -179,7 +179,7 @@ SDL_TimerThread(void *_data) } freelist_tail = current; - current->canceled = SDL_TRUE; + SDL_AtomicSet(¤t->canceled, 1); } } @@ -207,7 +207,7 @@ SDL_TimerInit(void) { SDL_TimerData *data = &SDL_timer_data; - if (!data->active) { + if (!SDL_AtomicGet(&data->active)) { const char *name = "SDLTimer"; data->timermap_lock = SDL_CreateMutex(); if (!data->timermap_lock) { @@ -220,7 +220,7 @@ SDL_TimerInit(void) return -1; } - data->active = SDL_TRUE; + SDL_AtomicSet(&data->active, 1); /* !!! FIXME: this is nasty. */ #if defined(__WIN32__) && !defined(HAVE_LIBC) #undef SDL_CreateThread @@ -249,9 +249,7 @@ SDL_TimerQuit(void) SDL_Timer *timer; SDL_TimerMap *entry; - if (data->active) { - data->active = SDL_FALSE; - + if (SDL_AtomicCAS(&data->active, 1, 0)) { /* active? Move to inactive. */ /* Shutdown the timer thread */ if (data->thread) { SDL_SemPost(data->sem); @@ -291,21 +289,14 @@ SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *param) SDL_Timer *timer; SDL_TimerMap *entry; - if (!data->active) { - int status = 0; - - SDL_AtomicLock(&data->lock); - if (!data->active) { - status = SDL_TimerInit(); - } - SDL_AtomicUnlock(&data->lock); - - if (status < 0) { + SDL_AtomicLock(&data->lock); + if (!SDL_AtomicGet(&data->active)) { + if (SDL_TimerInit() < 0) { + SDL_AtomicUnlock(&data->lock); return 0; } } - SDL_AtomicLock(&data->lock); timer = data->freelist; if (timer) { data->freelist = timer->next; @@ -326,7 +317,7 @@ SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *param) timer->param = param; timer->interval = interval; timer->scheduled = SDL_GetTicks() + interval; - timer->canceled = SDL_FALSE; + SDL_AtomicSet(&timer->canceled, 0); entry = (SDL_TimerMap *)SDL_malloc(sizeof(*entry)); if (!entry) { @@ -377,8 +368,8 @@ SDL_RemoveTimer(SDL_TimerID id) SDL_UnlockMutex(data->timermap_lock); if (entry) { - if (!entry->timer->canceled) { - entry->timer->canceled = SDL_TRUE; + if (!SDL_AtomicGet(&entry->timer->canceled)) { + SDL_AtomicSet(&entry->timer->canceled, 1); canceled = SDL_TRUE; } SDL_free(entry); diff --git a/libs/SDL2/src/timer/SDL_timer_c.h b/libs/SDL2/src/timer/SDL_timer_c.h index ab1e16ac..6ae81705 100644 --- a/libs/SDL2/src/timer/SDL_timer_c.h +++ b/libs/SDL2/src/timer/SDL_timer_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/timer/dummy/SDL_systimer.c b/libs/SDL2/src/timer/dummy/SDL_systimer.c index 0a63bfab..1174d224 100644 --- a/libs/SDL2/src/timer/dummy/SDL_systimer.c +++ b/libs/SDL2/src/timer/dummy/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/timer/haiku/SDL_systimer.c b/libs/SDL2/src/timer/haiku/SDL_systimer.c index ea736ba7..f45aa64d 100644 --- a/libs/SDL2/src/timer/haiku/SDL_systimer.c +++ b/libs/SDL2/src/timer/haiku/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/timer/psp/SDL_systimer.c b/libs/SDL2/src/timer/psp/SDL_systimer.c index ece71d37..1e8802cf 100644 --- a/libs/SDL2/src/timer/psp/SDL_systimer.c +++ b/libs/SDL2/src/timer/psp/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/timer/unix/SDL_systimer.c b/libs/SDL2/src/timer/unix/SDL_systimer.c index 98917214..217fe327 100644 --- a/libs/SDL2/src/timer/unix/SDL_systimer.c +++ b/libs/SDL2/src/timer/unix/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/timer/windows/SDL_systimer.c b/libs/SDL2/src/timer/windows/SDL_systimer.c index a213be00..d2d30c8d 100644 --- a/libs/SDL2/src/timer/windows/SDL_systimer.c +++ b/libs/SDL2/src/timer/windows/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -189,6 +189,10 @@ SDL_Delay(Uint32 ms) } WaitForSingleObjectEx(mutex, ms, FALSE); #else + if (!ticks_started) { + SDL_TicksInit(); + } + Sleep(ms); #endif } diff --git a/libs/SDL2/src/video/SDL_RLEaccel.c b/libs/SDL2/src/video/SDL_RLEaccel.c index b9f1426d..67baaf66 100644 --- a/libs/SDL2/src/video/SDL_RLEaccel.c +++ b/libs/SDL2/src/video/SDL_RLEaccel.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_RLEaccel_c.h b/libs/SDL2/src/video/SDL_RLEaccel_c.h index ed980f98..c04fc152 100644 --- a/libs/SDL2/src/video/SDL_RLEaccel_c.h +++ b/libs/SDL2/src/video/SDL_RLEaccel_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_blit.c b/libs/SDL2/src/video/SDL_blit.c index 1c8b0735..90aa8789 100644 --- a/libs/SDL2/src/video/SDL_blit.c +++ b/libs/SDL2/src/video/SDL_blit.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_blit.h b/libs/SDL2/src/video/SDL_blit.h index 6b8effff..e30f8afe 100644 --- a/libs/SDL2/src/video/SDL_blit.h +++ b/libs/SDL2/src/video/SDL_blit.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_blit_0.c b/libs/SDL2/src/video/SDL_blit_0.c index 64e20f8e..fe7330d7 100644 --- a/libs/SDL2/src/video/SDL_blit_0.c +++ b/libs/SDL2/src/video/SDL_blit_0.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_blit_1.c b/libs/SDL2/src/video/SDL_blit_1.c index 53f486b9..69c15d08 100644 --- a/libs/SDL2/src/video/SDL_blit_1.c +++ b/libs/SDL2/src/video/SDL_blit_1.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_blit_A.c b/libs/SDL2/src/video/SDL_blit_A.c index 4ba7c82c..0190ffdd 100644 --- a/libs/SDL2/src/video/SDL_blit_A.c +++ b/libs/SDL2/src/video/SDL_blit_A.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_blit_N.c b/libs/SDL2/src/video/SDL_blit_N.c index c0c7fbfb..94894a78 100644 --- a/libs/SDL2/src/video/SDL_blit_N.c +++ b/libs/SDL2/src/video/SDL_blit_N.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_blit_auto.c b/libs/SDL2/src/video/SDL_blit_auto.c index 987d12d8..f1228191 100644 --- a/libs/SDL2/src/video/SDL_blit_auto.c +++ b/libs/SDL2/src/video/SDL_blit_auto.c @@ -1,7 +1,7 @@ /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_blit_auto.h b/libs/SDL2/src/video/SDL_blit_auto.h index 7ba689c7..58a532db 100644 --- a/libs/SDL2/src/video/SDL_blit_auto.h +++ b/libs/SDL2/src/video/SDL_blit_auto.h @@ -1,7 +1,7 @@ /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_blit_copy.c b/libs/SDL2/src/video/SDL_blit_copy.c index 3ec2e7eb..7b9a91ff 100644 --- a/libs/SDL2/src/video/SDL_blit_copy.c +++ b/libs/SDL2/src/video/SDL_blit_copy.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_blit_copy.h b/libs/SDL2/src/video/SDL_blit_copy.h index 73defa2f..060026d8 100644 --- a/libs/SDL2/src/video/SDL_blit_copy.h +++ b/libs/SDL2/src/video/SDL_blit_copy.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_blit_slow.c b/libs/SDL2/src/video/SDL_blit_slow.c index 9082f7a6..3a462f6e 100644 --- a/libs/SDL2/src/video/SDL_blit_slow.c +++ b/libs/SDL2/src/video/SDL_blit_slow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_blit_slow.h b/libs/SDL2/src/video/SDL_blit_slow.h index 5bd0598a..75005fc5 100644 --- a/libs/SDL2/src/video/SDL_blit_slow.h +++ b/libs/SDL2/src/video/SDL_blit_slow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_bmp.c b/libs/SDL2/src/video/SDL_bmp.c index 3ea2dd54..f80f9369 100644 --- a/libs/SDL2/src/video/SDL_bmp.c +++ b/libs/SDL2/src/video/SDL_bmp.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_clipboard.c b/libs/SDL2/src/video/SDL_clipboard.c index feff8eb3..91d1eeea 100644 --- a/libs/SDL2/src/video/SDL_clipboard.c +++ b/libs/SDL2/src/video/SDL_clipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_egl.c b/libs/SDL2/src/video/SDL_egl.c index 7b1c690e..bfd4affb 100644 --- a/libs/SDL2/src/video/SDL_egl.c +++ b/libs/SDL2/src/video/SDL_egl.c @@ -1,6 +1,6 @@ /* * Simple DirectMedia Layer - * Copyright (C) 1997-2015 Sam Lantinga + * Copyright (C) 1997-2016 Sam Lantinga * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_egl_c.h b/libs/SDL2/src/video/SDL_egl_c.h index b46cfca6..c683dffa 100644 --- a/libs/SDL2/src/video/SDL_egl_c.h +++ b/libs/SDL2/src/video/SDL_egl_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_fillrect.c b/libs/SDL2/src/video/SDL_fillrect.c index 2282d2b1..e34a43c4 100644 --- a/libs/SDL2/src/video/SDL_fillrect.c +++ b/libs/SDL2/src/video/SDL_fillrect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_pixels.c b/libs/SDL2/src/video/SDL_pixels.c index 6b96125b..d905656c 100644 --- a/libs/SDL2/src/video/SDL_pixels.c +++ b/libs/SDL2/src/video/SDL_pixels.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_pixels_c.h b/libs/SDL2/src/video/SDL_pixels_c.h index 3d2deb1a..4ee91b8a 100644 --- a/libs/SDL2/src/video/SDL_pixels_c.h +++ b/libs/SDL2/src/video/SDL_pixels_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_rect.c b/libs/SDL2/src/video/SDL_rect.c index b2295195..2b29451c 100644 --- a/libs/SDL2/src/video/SDL_rect.c +++ b/libs/SDL2/src/video/SDL_rect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_rect_c.h b/libs/SDL2/src/video/SDL_rect_c.h index bc639ae2..aa5fbde7 100644 --- a/libs/SDL2/src/video/SDL_rect_c.h +++ b/libs/SDL2/src/video/SDL_rect_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_shape.c b/libs/SDL2/src/video/SDL_shape.c index 3309f6db..4a2e5465 100644 --- a/libs/SDL2/src/video/SDL_shape.c +++ b/libs/SDL2/src/video/SDL_shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_shape_internals.h b/libs/SDL2/src/video/SDL_shape_internals.h index 4eda9dd1..bdb0ee91 100644 --- a/libs/SDL2/src/video/SDL_shape_internals.h +++ b/libs/SDL2/src/video/SDL_shape_internals.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_stretch.c b/libs/SDL2/src/video/SDL_stretch.c index d3abaed5..bb34dffb 100644 --- a/libs/SDL2/src/video/SDL_stretch.c +++ b/libs/SDL2/src/video/SDL_stretch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_surface.c b/libs/SDL2/src/video/SDL_surface.c index ef581fa9..dae07f28 100644 --- a/libs/SDL2/src/video/SDL_surface.c +++ b/libs/SDL2/src/video/SDL_surface.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_sysvideo.h b/libs/SDL2/src/video/SDL_sysvideo.h index 5e3e1526..0b1133bd 100644 --- a/libs/SDL2/src/video/SDL_sysvideo.h +++ b/libs/SDL2/src/video/SDL_sysvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -86,6 +86,8 @@ struct SDL_Window SDL_DisplayMode fullscreen_mode; + float opacity; + float brightness; Uint16 *gamma; Uint16 *saved_gamma; /* (just offset into gamma) */ @@ -95,6 +97,7 @@ struct SDL_Window SDL_bool is_hiding; SDL_bool is_destroying; + SDL_bool is_dropping; /* drag/drop in progress, expecting SDL_SendDropComplete(). */ SDL_WindowShaper *shaper; @@ -175,6 +178,11 @@ struct SDL_VideoDevice */ int (*GetDisplayDPI) (_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi); + /* + * Get the usable bounds of a display (bounds minus menubar or whatever) + */ + int (*GetDisplayUsableBounds) (_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); + /* * Get a list of the available display modes for a display. */ @@ -200,6 +208,10 @@ struct SDL_VideoDevice void (*SetWindowSize) (_THIS, SDL_Window * window); void (*SetWindowMinimumSize) (_THIS, SDL_Window * window); void (*SetWindowMaximumSize) (_THIS, SDL_Window * window); + int (*GetWindowBordersSize) (_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right); + int (*SetWindowOpacity) (_THIS, SDL_Window * window, float opacity); + int (*SetWindowModalFor) (_THIS, SDL_Window * modal_window, SDL_Window * parent_window); + int (*SetWindowInputFocus) (_THIS, SDL_Window * window); void (*ShowWindow) (_THIS, SDL_Window * window); void (*HideWindow) (_THIS, SDL_Window * window); void (*RaiseWindow) (_THIS, SDL_Window * window); diff --git a/libs/SDL2/src/video/SDL_video.c b/libs/SDL2/src/video/SDL_video.c index e5f4dc5b..c678f66c 100644 --- a/libs/SDL2/src/video/SDL_video.c +++ b/libs/SDL2/src/video/SDL_video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -684,7 +684,26 @@ SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect) rect->w = display->current_mode.w; rect->h = display->current_mode.h; } - return 0; + return 0; /* !!! FIXME: should this be an error if (rect==NULL) ? */ +} + +int SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect) +{ + CHECK_DISPLAY_INDEX(displayIndex, -1); + + if (rect) { + SDL_VideoDisplay *display = &_this->displays[displayIndex]; + + if (_this->GetDisplayUsableBounds) { + if (_this->GetDisplayUsableBounds(_this, display, rect) == 0) { + return 0; + } + } + + /* Oh well, just give the entire display bounds. */ + return SDL_GetDisplayBounds(displayIndex, rect); + } + return 0; /* !!! FIXME: should this be an error if (rect==NULL) ? */ } int @@ -1285,16 +1304,11 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen) } #define CREATE_FLAGS \ - (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI) + (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_SKIP_TASKBAR | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP) static void SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags) { - window->windowed.x = window->x; - window->windowed.y = window->y; - window->windowed.w = window->w; - window->windowed.h = window->h; - if (flags & SDL_WINDOW_MAXIMIZED) { SDL_MaximizeWindow(window); } @@ -1325,6 +1339,11 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) } } + if ( (((flags & SDL_WINDOW_UTILITY) != 0) + ((flags & SDL_WINDOW_TOOLTIP) != 0) + ((flags & SDL_WINDOW_POPUP_MENU) != 0)) > 1 ) { + SDL_SetError("Conflicting window flags specified"); + return NULL; + } + /* Some platforms can't create zero-sized windows */ if (w < 1) { w = 1; @@ -1389,8 +1408,28 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) window->y = bounds.y + (bounds.h - h) / 2; } } + window->windowed.x = window->x; + window->windowed.y = window->y; + window->windowed.w = window->w; + window->windowed.h = window->h; + + if (flags & SDL_WINDOW_FULLSCREEN) { + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); + int displayIndex; + SDL_Rect bounds; + + displayIndex = SDL_GetIndexOfDisplay(display); + SDL_GetDisplayBounds(displayIndex, &bounds); + + window->x = bounds.x; + window->y = bounds.y; + window->w = bounds.w; + window->h = bounds.h; + } + window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN); window->last_fullscreen_flags = window->flags; + window->opacity = 1.0f; window->brightness = 1.0f; window->next = _this->windows; window->is_destroying = SDL_FALSE; @@ -1451,6 +1490,7 @@ SDL_CreateWindowFrom(const void *data) window->flags = SDL_WINDOW_FOREIGN; window->last_fullscreen_flags = window->flags; window->is_destroying = SDL_FALSE; + window->opacity = 1.0f; window->brightness = 1.0f; window->next = _this->windows; if (_this->windows) { @@ -1883,6 +1923,28 @@ SDL_SetWindowMinimumSize(SDL_Window * window, int min_w, int min_h) } } +int +SDL_GetWindowBordersSize(SDL_Window * window, int *top, int *left, int *bottom, int *right) +{ + int dummy = 0; + + if (!top) { top = &dummy; } + if (!left) { left = &dummy; } + if (!right) { right = &dummy; } + if (!bottom) { bottom = &dummy; } + + /* Always initialize, so applications don't have to care */ + *top = *left = *bottom = *right = 0; + + CHECK_WINDOW_MAGIC(window, -1); + + if (!_this->GetWindowBordersSize) { + return SDL_Unsupported(); + } + + return _this->GetWindowBordersSize(_this, window, top, left, bottom, right); +} + void SDL_GetWindowMinimumSize(SDL_Window * window, int *min_w, int *min_h) { @@ -2144,6 +2206,68 @@ SDL_GetWindowBrightness(SDL_Window * window) return window->brightness; } +int +SDL_SetWindowOpacity(SDL_Window * window, float opacity) +{ + int retval; + CHECK_WINDOW_MAGIC(window, -1); + + if (!_this->SetWindowOpacity) { + return SDL_Unsupported(); + } + + if (opacity < 0.0f) { + opacity = 0.0f; + } else if (opacity > 1.0f) { + opacity = 1.0f; + } + + retval = _this->SetWindowOpacity(_this, window, opacity); + if (retval == 0) { + window->opacity = opacity; + } + + return retval; +} + +int +SDL_GetWindowOpacity(SDL_Window * window, float * out_opacity) +{ + CHECK_WINDOW_MAGIC(window, -1); + + if (out_opacity) { + *out_opacity = window->opacity; + } + + return 0; +} + +int +SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window) +{ + CHECK_WINDOW_MAGIC(modal_window, -1); + CHECK_WINDOW_MAGIC(parent_window, -1); + + if (!_this->SetWindowModalFor) { + return SDL_Unsupported(); + } + + return _this->SetWindowModalFor(_this, modal_window, parent_window); +} + +int +SDL_SetWindowInputFocus(SDL_Window * window) +{ + CHECK_WINDOW_MAGIC(window, -1); + + if (!_this->SetWindowInputFocus) { + return SDL_Unsupported(); + } + + return _this->SetWindowInputFocus(_this, window); +} + + int SDL_SetWindowGammaRamp(SDL_Window * window, const Uint16 * red, const Uint16 * green, diff --git a/libs/SDL2/src/video/android/SDL_androidclipboard.c b/libs/SDL2/src/video/android/SDL_androidclipboard.c index 6a456472..b996e7a4 100644 --- a/libs/SDL2/src/video/android/SDL_androidclipboard.c +++ b/libs/SDL2/src/video/android/SDL_androidclipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/android/SDL_androidclipboard.h b/libs/SDL2/src/video/android/SDL_androidclipboard.h index 600771b9..a61045ae 100644 --- a/libs/SDL2/src/video/android/SDL_androidclipboard.h +++ b/libs/SDL2/src/video/android/SDL_androidclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/android/SDL_androidevents.c b/libs/SDL2/src/video/android/SDL_androidevents.c index f15180a9..326361af 100644 --- a/libs/SDL2/src/video/android/SDL_androidevents.c +++ b/libs/SDL2/src/video/android/SDL_androidevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/android/SDL_androidevents.h b/libs/SDL2/src/video/android/SDL_androidevents.h index 888a593c..4a2230e2 100644 --- a/libs/SDL2/src/video/android/SDL_androidevents.h +++ b/libs/SDL2/src/video/android/SDL_androidevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/android/SDL_androidgl.c b/libs/SDL2/src/video/android/SDL_androidgl.c index 5bf8d1a1..4cfe8635 100644 --- a/libs/SDL2/src/video/android/SDL_androidgl.c +++ b/libs/SDL2/src/video/android/SDL_androidgl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/android/SDL_androidkeyboard.c b/libs/SDL2/src/video/android/SDL_androidkeyboard.c index a6123517..dc8951ff 100644 --- a/libs/SDL2/src/video/android/SDL_androidkeyboard.c +++ b/libs/SDL2/src/video/android/SDL_androidkeyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/android/SDL_androidkeyboard.h b/libs/SDL2/src/video/android/SDL_androidkeyboard.h index 3f643c30..ced9bc24 100644 --- a/libs/SDL2/src/video/android/SDL_androidkeyboard.h +++ b/libs/SDL2/src/video/android/SDL_androidkeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/android/SDL_androidmessagebox.c b/libs/SDL2/src/video/android/SDL_androidmessagebox.c index 1783b9cd..61f67636 100644 --- a/libs/SDL2/src/video/android/SDL_androidmessagebox.c +++ b/libs/SDL2/src/video/android/SDL_androidmessagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/android/SDL_androidmessagebox.h b/libs/SDL2/src/video/android/SDL_androidmessagebox.h index b732a2a0..3c680c62 100644 --- a/libs/SDL2/src/video/android/SDL_androidmessagebox.h +++ b/libs/SDL2/src/video/android/SDL_androidmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/android/SDL_androidmouse.c b/libs/SDL2/src/video/android/SDL_androidmouse.c index 795b2aab..bfbb8434 100644 --- a/libs/SDL2/src/video/android/SDL_androidmouse.c +++ b/libs/SDL2/src/video/android/SDL_androidmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,10 +37,18 @@ #define BUTTON_PRIMARY 1 #define BUTTON_SECONDARY 2 #define BUTTON_TERTIARY 4 +#define BUTTON_BACK 8 +#define BUTTON_FORWARD 16 + +static Uint8 SDLButton; + +void +Android_InitMouse(void) +{ + SDLButton = 0; +} void Android_OnMouse( int androidButton, int action, float x, float y) { - static Uint8 SDLButton; - if (!Android_Window) { return; } @@ -53,6 +61,10 @@ void Android_OnMouse( int androidButton, int action, float x, float y) { SDLButton = SDL_BUTTON_RIGHT; } else if (androidButton == BUTTON_TERTIARY) { SDLButton = SDL_BUTTON_MIDDLE; + } else if (androidButton == BUTTON_FORWARD) { + SDLButton = SDL_BUTTON_X1; + } else if (androidButton == BUTTON_BACK) { + SDLButton = SDL_BUTTON_X2; } SDL_SendMouseMotion(Android_Window, 0, 0, x, y); SDL_SendMouseButton(Android_Window, 0, SDL_PRESSED, SDLButton); diff --git a/libs/SDL2/src/video/android/SDL_androidmouse.h b/libs/SDL2/src/video/android/SDL_androidmouse.h index 72b3deb3..a64e06d5 100644 --- a/libs/SDL2/src/video/android/SDL_androidmouse.h +++ b/libs/SDL2/src/video/android/SDL_androidmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,7 @@ #include "SDL_androidvideo.h" +extern void Android_InitMouse(void); extern void Android_OnMouse( int button, int action, float x, float y); #endif /* _SDL_androidmouse_h */ diff --git a/libs/SDL2/src/video/android/SDL_androidtouch.c b/libs/SDL2/src/video/android/SDL_androidtouch.c index b7ba3860..0ff11ef5 100644 --- a/libs/SDL2/src/video/android/SDL_androidtouch.c +++ b/libs/SDL2/src/video/android/SDL_androidtouch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -50,7 +50,7 @@ static void Android_GetWindowCoordinates(float x, float y, *window_y = (int)(y * window_h); } -static volatile SDL_bool separate_mouse_and_touch = SDL_FALSE; +static SDL_bool separate_mouse_and_touch = SDL_FALSE; static void SeparateEventsHintWatcher(void *userdata, const char *name, diff --git a/libs/SDL2/src/video/android/SDL_androidtouch.h b/libs/SDL2/src/video/android/SDL_androidtouch.h index 73a934fe..2ad096ce 100644 --- a/libs/SDL2/src/video/android/SDL_androidtouch.h +++ b/libs/SDL2/src/video/android/SDL_androidtouch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/android/SDL_androidvideo.c b/libs/SDL2/src/video/android/SDL_androidvideo.c index 983f3aa3..0e24a3d3 100644 --- a/libs/SDL2/src/video/android/SDL_androidvideo.c +++ b/libs/SDL2/src/video/android/SDL_androidvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,6 +36,7 @@ #include "SDL_androidclipboard.h" #include "SDL_androidevents.h" #include "SDL_androidkeyboard.h" +#include "SDL_androidmouse.h" #include "SDL_androidtouch.h" #include "SDL_androidwindow.h" @@ -181,6 +182,8 @@ Android_VideoInit(_THIS) Android_InitTouch(); + Android_InitMouse(); + /* We're done! */ return 0; } diff --git a/libs/SDL2/src/video/android/SDL_androidvideo.h b/libs/SDL2/src/video/android/SDL_androidvideo.h index fc6e60e8..0f76a91b 100644 --- a/libs/SDL2/src/video/android/SDL_androidvideo.h +++ b/libs/SDL2/src/video/android/SDL_androidvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/android/SDL_androidwindow.c b/libs/SDL2/src/video/android/SDL_androidwindow.c index 46eaeb2a..37a928fa 100644 --- a/libs/SDL2/src/video/android/SDL_androidwindow.c +++ b/libs/SDL2/src/video/android/SDL_androidwindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/android/SDL_androidwindow.h b/libs/SDL2/src/video/android/SDL_androidwindow.h index aa9283bc..3ac99f42 100644 --- a/libs/SDL2/src/video/android/SDL_androidwindow.h +++ b/libs/SDL2/src/video/android/SDL_androidwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.h b/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.h index d86a75ef..871b394f 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.m b/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.m index 73307445..015d7710 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoaevents.h b/libs/SDL2/src/video/cocoa/SDL_cocoaevents.h index f92a4a94..ea40e531 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoaevents.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoaevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoaevents.m b/libs/SDL2/src/video/cocoa/SDL_cocoaevents.m index 994da182..c0916fe8 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoaevents.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoaevents.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -176,7 +176,7 @@ - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename { - return (BOOL)SDL_SendDropFile([filename UTF8String]); + return (BOOL)SDL_SendDropFile(NULL, [filename UTF8String]) && SDL_SendDropComplete(NULL); } @end diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.h b/libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.h index e206bd3a..4f9da018 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.m b/libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.m index b6926a93..7f1d2308 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoamessagebox.h b/libs/SDL2/src/video/cocoa/SDL_cocoamessagebox.h index f9ac0c45..d1ca7882 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoamessagebox.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoamessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoamessagebox.m b/libs/SDL2/src/video/cocoa/SDL_cocoamessagebox.m index 0998f792..ed59e728 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoamessagebox.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoamessagebox.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoamodes.h b/libs/SDL2/src/video/cocoa/SDL_cocoamodes.h index 57c22ebd..13a9620a 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoamodes.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoamodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,7 +35,9 @@ typedef struct extern void Cocoa_InitModes(_THIS); extern int Cocoa_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); +extern int Cocoa_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); extern void Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay * display); +extern int Cocoa_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hpdi, float * vdpi); extern int Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); extern void Cocoa_QuitModes(_THIS); diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoamodes.m b/libs/SDL2/src/video/cocoa/SDL_cocoamodes.m index 73b14ed7..2fa619d1 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoamodes.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoamodes.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,6 +19,7 @@ 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" +#include "SDL_assert.h" #if SDL_VIDEO_DRIVER_COCOA @@ -338,6 +339,59 @@ Cocoa_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) return 0; } +int +Cocoa_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) +{ + SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata; + const CGDirectDisplayID cgdisplay = displaydata->display; + NSArray *screens = [NSScreen screens]; + NSScreen *screen = nil; + + /* !!! FIXME: maybe track the NSScreen in SDL_DisplayData? */ + for (NSScreen *i in screens) { + const CGDirectDisplayID thisDisplay = (CGDirectDisplayID) [[[i deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue]; + if (thisDisplay == cgdisplay) { + screen = i; + break; + } + } + + SDL_assert(screen != nil); /* didn't find it?! */ + if (screen == nil) { + return -1; + } + + const CGRect cgrect = CGDisplayBounds(cgdisplay); + const NSRect frame = [screen visibleFrame]; + + // !!! FIXME: I assume -[NSScreen visibleFrame] is relative to the origin of the screen in question and not the whole desktop. + // !!! FIXME: The math vs CGDisplayBounds might be incorrect if that's not the case, though. Check this. + rect->x = (int)(cgrect.origin.x + frame.origin.x); + rect->y = (int)(cgrect.origin.y + frame.origin.y); + rect->w = (int)frame.size.width; + rect->h = (int)frame.size.height; + + return 0; +} + +int +Cocoa_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi) +{ + const float MM_IN_INCH = 25.4f; + + SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata; + + CGSize displaySize = CGDisplayScreenSize(data->display); + size_t pixelWidth = CGDisplayPixelsWide(data->display); + size_t pixelHeight = CGDisplayPixelsHigh(data->display); + + *ddpi = SDL_ComputeDiagonalDPI(pixelWidth, pixelHeight, displaySize.width / MM_IN_INCH, displaySize.height / MM_IN_INCH); + *hdpi = pixelWidth * MM_IN_INCH / displaySize.width; + *vdpi = pixelHeight * MM_IN_INCH / displaySize.height; + + return 0; +} + void Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay * display) { diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoamouse.h b/libs/SDL2/src/video/cocoa/SDL_cocoamouse.h index 89e68caa..4f60c837 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoamouse.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoamouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoamouse.m b/libs/SDL2/src/video/cocoa/SDL_cocoamouse.m index 625d8f40..c7683312 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoamouse.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoamouse.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoamousetap.h b/libs/SDL2/src/video/cocoa/SDL_cocoamousetap.h index f1041b18..af92314b 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoamousetap.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoamousetap.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoamousetap.m b/libs/SDL2/src/video/cocoa/SDL_cocoamousetap.m index ca50ff96..ed70f3ca 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoamousetap.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoamousetap.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoaopengl.h b/libs/SDL2/src/video/cocoa/SDL_cocoaopengl.h index 6b18af1e..1f7bd57f 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoaopengl.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoaopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoaopengl.m b/libs/SDL2/src/video/cocoa/SDL_cocoaopengl.m index d8e9c901..645e5ba4 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoaopengl.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoaopengl.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -173,6 +173,8 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window) return NULL; } + attr[i++] = NSOpenGLPFAAllowOfflineRenderers; + /* specify a profile if we're on Lion (10.7) or later. */ if (lion_or_later) { NSOpenGLPixelFormatAttribute profile = NSOpenGLProfileVersionLegacy; diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoashape.h b/libs/SDL2/src/video/cocoa/SDL_cocoashape.h index e7fd185d..f64b5917 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoashape.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoashape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoashape.m b/libs/SDL2/src/video/cocoa/SDL_cocoashape.m index 1dce5679..cd5d97b7 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoashape.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoashape.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoavideo.h b/libs/SDL2/src/video/cocoa/SDL_cocoavideo.h index 873f2573..498ce6cc 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoavideo.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoavideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoavideo.m b/libs/SDL2/src/video/cocoa/SDL_cocoavideo.m index c6b01296..ddf10e26 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoavideo.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoavideo.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -73,6 +73,8 @@ Cocoa_CreateDevice(int devindex) device->VideoInit = Cocoa_VideoInit; device->VideoQuit = Cocoa_VideoQuit; device->GetDisplayBounds = Cocoa_GetDisplayBounds; + device->GetDisplayUsableBounds = Cocoa_GetDisplayUsableBounds; + device->GetDisplayDPI = Cocoa_GetDisplayDPI; device->GetDisplayModes = Cocoa_GetDisplayModes; device->SetDisplayMode = Cocoa_SetDisplayMode; device->PumpEvents = Cocoa_PumpEvents; @@ -86,6 +88,7 @@ Cocoa_CreateDevice(int devindex) device->SetWindowSize = Cocoa_SetWindowSize; device->SetWindowMinimumSize = Cocoa_SetWindowMinimumSize; device->SetWindowMaximumSize = Cocoa_SetWindowMaximumSize; + device->SetWindowOpacity = Cocoa_SetWindowOpacity; device->ShowWindow = Cocoa_ShowWindow; device->HideWindow = Cocoa_HideWindow; device->RaiseWindow = Cocoa_RaiseWindow; diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoawindow.h b/libs/SDL2/src/video/cocoa/SDL_cocoawindow.h index ed56600f..4e2f7ea2 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoawindow.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoawindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -125,6 +125,7 @@ extern void Cocoa_SetWindowPosition(_THIS, SDL_Window * window); extern void Cocoa_SetWindowSize(_THIS, SDL_Window * window); extern void Cocoa_SetWindowMinimumSize(_THIS, SDL_Window * window); extern void Cocoa_SetWindowMaximumSize(_THIS, SDL_Window * window); +extern int Cocoa_SetWindowOpacity(_THIS, SDL_Window * window, float opacity); extern void Cocoa_ShowWindow(_THIS, SDL_Window * window); extern void Cocoa_HideWindow(_THIS, SDL_Window * window); extern void Cocoa_RaiseWindow(_THIS, SDL_Window * window); diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoawindow.m b/libs/SDL2/src/video/cocoa/SDL_cocoawindow.m index 0c5f300a..0256525e 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoawindow.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoawindow.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -116,9 +116,12 @@ - (BOOL)performDragOperation:(id )sender { @autoreleasepool { + SDL_VideoDevice *_this = SDL_GetVideoDevice(); NSPasteboard *pasteboard = [sender draggingPasteboard]; NSArray *types = [NSArray arrayWithObject:NSFilenamesPboardType]; NSString *desiredType = [pasteboard availableTypeFromArray:types]; + SDL_Window *sdlwindow = nil; + if (desiredType == nil) { return NO; /* can't accept anything that's being dropped here. */ } @@ -157,11 +160,22 @@ } } - if (!SDL_SendDropFile([[fileURL path] UTF8String])) { + /* !!! FIXME: is there a better way to do this? */ + if (_this) { + for (sdlwindow = _this->windows; sdlwindow; sdlwindow = sdlwindow->next) { + NSWindow *nswindow = ((SDL_WindowData *) sdlwindow->driverdata)->nswindow; + if (nswindow == self) { + break; + } + } + } + + if (!SDL_SendDropFile(sdlwindow, [[fileURL path] UTF8String])) { return NO; } } + SDL_SendDropComplete(sdlwindow); return YES; }} @@ -196,6 +210,7 @@ ScheduleContextUpdates(SDL_WindowData *data) } } +/* !!! FIXME: this should use a hint callback. */ static int GetHintCtrlClickEmulateRightClick() { @@ -837,6 +852,7 @@ SetWindowStyle(SDL_Window * window, unsigned int style) } if ([self processHitTest:theEvent]) { + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); return; /* dragging, drop event. */ } @@ -879,6 +895,7 @@ SetWindowStyle(SDL_Window * window, unsigned int style) int button; if ([self processHitTest:theEvent]) { + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); return; /* stopped dragging, drop event. */ } @@ -922,6 +939,7 @@ SetWindowStyle(SDL_Window * window, unsigned int style) int x, y; if ([self processHitTest:theEvent]) { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); return; /* dragging, drop event. */ } @@ -1767,6 +1785,14 @@ Cocoa_SetWindowHitTest(SDL_Window * window, SDL_bool enabled) return 0; /* just succeed, the real work is done elsewhere. */ } +int +Cocoa_SetWindowOpacity(_THIS, SDL_Window * window, float opacity) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + [data->nswindow setAlphaValue:opacity]; + return 0; +} + #endif /* SDL_VIDEO_DRIVER_COCOA */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_WM.c b/libs/SDL2/src/video/directfb/SDL_DirectFB_WM.c index f6e1dea4..4b979f36 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_WM.c +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_WM.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_WM.h b/libs/SDL2/src/video/directfb/SDL_DirectFB_WM.h index 828bd952..f5f9a46f 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_WM.h +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_WM.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_dyn.c b/libs/SDL2/src/video/directfb/SDL_DirectFB_dyn.c index 4dfd08c1..52a4b536 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_dyn.c +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_dyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_dyn.h b/libs/SDL2/src/video/directfb/SDL_DirectFB_dyn.h index 81d2b163..bd99a3fa 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_dyn.h +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_dyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_events.c b/libs/SDL2/src/video/directfb/SDL_DirectFB_events.c index 8508f2a9..0bf9fdba 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_events.c +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_events.h b/libs/SDL2/src/video/directfb/SDL_DirectFB_events.h index fe205d1d..2931ad2a 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_events.h +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_modes.c b/libs/SDL2/src/video/directfb/SDL_DirectFB_modes.c index ab13b7ee..9d0abf56 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_modes.c +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_modes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_modes.h b/libs/SDL2/src/video/directfb/SDL_DirectFB_modes.h index c847f182..9911eff5 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_modes.h +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_modes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_mouse.c b/libs/SDL2/src/video/directfb/SDL_DirectFB_mouse.c index caa9eeec..0657d2f0 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_mouse.c +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_mouse.h b/libs/SDL2/src/video/directfb/SDL_DirectFB_mouse.h index 3f62c01b..4e2f27a9 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_mouse.h +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_opengl.c b/libs/SDL2/src/video/directfb/SDL_DirectFB_opengl.c index edddd32c..065854a0 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_opengl.c +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_opengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_opengl.h b/libs/SDL2/src/video/directfb/SDL_DirectFB_opengl.h index 454aa249..6391ee4f 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_opengl.h +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_render.c b/libs/SDL2/src/video/directfb/SDL_DirectFB_render.c index 003e4a77..4a1bf46b 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_render.c +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_render.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_render.h b/libs/SDL2/src/video/directfb/SDL_DirectFB_render.h index 0cd4bd32..be016b08 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_render.h +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_render.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_shape.c b/libs/SDL2/src/video/directfb/SDL_DirectFB_shape.c index 4c571572..3239e302 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_shape.c +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_shape.h b/libs/SDL2/src/video/directfb/SDL_DirectFB_shape.h index 27304712..46be39fb 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_shape.h +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_video.c b/libs/SDL2/src/video/directfb/SDL_DirectFB_video.c index dbf890be..d339dd78 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_video.c +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -121,6 +121,7 @@ DirectFB_CreateDevice(int devindex) device->SetWindowIcon = DirectFB_SetWindowIcon; device->SetWindowPosition = DirectFB_SetWindowPosition; device->SetWindowSize = DirectFB_SetWindowSize; + device->SetWindowOpacity = DirectFB_SetWindowOpacity; device->ShowWindow = DirectFB_ShowWindow; device->HideWindow = DirectFB_HideWindow; device->RaiseWindow = DirectFB_RaiseWindow; diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_video.h b/libs/SDL2/src/video/directfb/SDL_DirectFB_video.h index b722bbd9..b36ace0d 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_video.h +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_window.c b/libs/SDL2/src/video/directfb/SDL_DirectFB_window.c index b8a94b45..40bbe6ae 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_window.c +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_window.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -529,4 +529,17 @@ DirectFB_AdjustWindowSurface(SDL_Window * window) return; } +int +DirectFB_SetWindowOpacity(_THIS, SDL_Window * window, float opacity) +{ + const Uint8 alpha = (Uint8) ((unsigned int) (opacity * 255.0f)); + SDL_DFB_WINDOWDATA(window); + SDL_DFB_CHECKERR(windata->dfbwin->SetOpacity(windata->dfbwin, alpha)); + windata->opacity = alpha; + return 0; + +error: + return -1; +} + #endif /* SDL_VIDEO_DRIVER_DIRECTFB */ diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_window.h b/libs/SDL2/src/video/directfb/SDL_DirectFB_window.h index 9290abcd..4b997081 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_window.h +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_window.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -75,6 +75,7 @@ extern SDL_bool DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info); extern void DirectFB_AdjustWindowSurface(SDL_Window * window); +extern int DirectFB_SetWindowOpacity(_THIS, SDL_Window * window, float opacity); #endif /* _SDL_directfb_window_h */ diff --git a/libs/SDL2/src/video/dummy/SDL_nullevents.c b/libs/SDL2/src/video/dummy/SDL_nullevents.c index d7df0dcb..a5a94430 100644 --- a/libs/SDL2/src/video/dummy/SDL_nullevents.c +++ b/libs/SDL2/src/video/dummy/SDL_nullevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/dummy/SDL_nullevents_c.h b/libs/SDL2/src/video/dummy/SDL_nullevents_c.h index 21168464..d2f78698 100644 --- a/libs/SDL2/src/video/dummy/SDL_nullevents_c.h +++ b/libs/SDL2/src/video/dummy/SDL_nullevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/dummy/SDL_nullframebuffer.c b/libs/SDL2/src/video/dummy/SDL_nullframebuffer.c index 74eeb310..01c8a5ab 100644 --- a/libs/SDL2/src/video/dummy/SDL_nullframebuffer.c +++ b/libs/SDL2/src/video/dummy/SDL_nullframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/dummy/SDL_nullframebuffer_c.h b/libs/SDL2/src/video/dummy/SDL_nullframebuffer_c.h index f75c70e8..37d198f9 100644 --- a/libs/SDL2/src/video/dummy/SDL_nullframebuffer_c.h +++ b/libs/SDL2/src/video/dummy/SDL_nullframebuffer_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/dummy/SDL_nullvideo.c b/libs/SDL2/src/video/dummy/SDL_nullvideo.c index 96cee921..96f47813 100644 --- a/libs/SDL2/src/video/dummy/SDL_nullvideo.c +++ b/libs/SDL2/src/video/dummy/SDL_nullvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/dummy/SDL_nullvideo.h b/libs/SDL2/src/video/dummy/SDL_nullvideo.h index 90ed3bc8..0126ba18 100644 --- a/libs/SDL2/src/video/dummy/SDL_nullvideo.h +++ b/libs/SDL2/src/video/dummy/SDL_nullvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenevents.c b/libs/SDL2/src/video/emscripten/SDL_emscriptenevents.c index 79fa310f..0f915c6f 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenevents.c +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenevents.h b/libs/SDL2/src/video/emscripten/SDL_emscriptenevents.h index ea5c3f5b..d5b65f85 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenevents.h +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.c b/libs/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.c index a8f927e5..a26e23ae 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.c +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.h b/libs/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.h index 01ed37d1..b2a6d3b3 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.h +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenmouse.c b/libs/SDL2/src/video/emscripten/SDL_emscriptenmouse.c index 5748d1c2..512ad222 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenmouse.c +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -58,11 +58,13 @@ Emscripten_CreateDefaultCursor() return cursor; } +/* static SDL_Cursor* Emscripten_CreateCursor(SDL_Surface* sruface, int hot_x, int hot_y) { return Emscripten_CreateDefaultCursor(); } +*/ static SDL_Cursor* Emscripten_CreateSystemCursor(SDL_SystemCursor id) @@ -200,7 +202,9 @@ Emscripten_InitMouse() { SDL_Mouse* mouse = SDL_GetMouse(); +/* mouse->CreateCursor = Emscripten_CreateCursor; +*/ mouse->ShowCursor = Emscripten_ShowCursor; mouse->FreeCursor = Emscripten_FreeCursor; mouse->WarpMouse = Emscripten_WarpMouse; diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenmouse.h b/libs/SDL2/src/video/emscripten/SDL_emscriptenmouse.h index 1d5d2e9e..76ea849e 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenmouse.h +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenopengles.c b/libs/SDL2/src/video/emscripten/SDL_emscriptenopengles.c index 6e9624d7..12a37c60 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenopengles.c +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenopengles.h b/libs/SDL2/src/video/emscripten/SDL_emscriptenopengles.h index 9c356854..edafed82 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenopengles.h +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenvideo.c b/libs/SDL2/src/video/emscripten/SDL_emscriptenvideo.c index 4ce0a036..302ca879 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenvideo.c +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenvideo.h b/libs/SDL2/src/video/emscripten/SDL_emscriptenvideo.h index 519e3fc3..e824de34 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenvideo.h +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_BWin.h b/libs/SDL2/src/video/haiku/SDL_BWin.h index b4e347d0..dade664c 100644 --- a/libs/SDL2/src/video/haiku/SDL_BWin.h +++ b/libs/SDL2/src/video/haiku/SDL_BWin.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bclipboard.cc b/libs/SDL2/src/video/haiku/SDL_bclipboard.cc index 1a10b6bf..fcd1caa2 100644 --- a/libs/SDL2/src/video/haiku/SDL_bclipboard.cc +++ b/libs/SDL2/src/video/haiku/SDL_bclipboard.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bclipboard.h b/libs/SDL2/src/video/haiku/SDL_bclipboard.h index 654c6c59..dd31f19a 100644 --- a/libs/SDL2/src/video/haiku/SDL_bclipboard.h +++ b/libs/SDL2/src/video/haiku/SDL_bclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bevents.cc b/libs/SDL2/src/video/haiku/SDL_bevents.cc index ec7d0125..36513a3b 100644 --- a/libs/SDL2/src/video/haiku/SDL_bevents.cc +++ b/libs/SDL2/src/video/haiku/SDL_bevents.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bevents.h b/libs/SDL2/src/video/haiku/SDL_bevents.h index ffb9ba5e..cb756c96 100644 --- a/libs/SDL2/src/video/haiku/SDL_bevents.h +++ b/libs/SDL2/src/video/haiku/SDL_bevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bframebuffer.cc b/libs/SDL2/src/video/haiku/SDL_bframebuffer.cc index 3eb835b2..5e6a300e 100644 --- a/libs/SDL2/src/video/haiku/SDL_bframebuffer.cc +++ b/libs/SDL2/src/video/haiku/SDL_bframebuffer.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bframebuffer.h b/libs/SDL2/src/video/haiku/SDL_bframebuffer.h index f3fbd96f..d6be21f4 100644 --- a/libs/SDL2/src/video/haiku/SDL_bframebuffer.h +++ b/libs/SDL2/src/video/haiku/SDL_bframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bkeyboard.cc b/libs/SDL2/src/video/haiku/SDL_bkeyboard.cc index e12d30ba..0ae3d3fc 100644 --- a/libs/SDL2/src/video/haiku/SDL_bkeyboard.cc +++ b/libs/SDL2/src/video/haiku/SDL_bkeyboard.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bkeyboard.h b/libs/SDL2/src/video/haiku/SDL_bkeyboard.h index edf7643d..63279942 100644 --- a/libs/SDL2/src/video/haiku/SDL_bkeyboard.h +++ b/libs/SDL2/src/video/haiku/SDL_bkeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bmodes.cc b/libs/SDL2/src/video/haiku/SDL_bmodes.cc index c5da410f..84aeb1f0 100644 --- a/libs/SDL2/src/video/haiku/SDL_bmodes.cc +++ b/libs/SDL2/src/video/haiku/SDL_bmodes.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bmodes.h b/libs/SDL2/src/video/haiku/SDL_bmodes.h index e73c090e..c3882ba5 100644 --- a/libs/SDL2/src/video/haiku/SDL_bmodes.h +++ b/libs/SDL2/src/video/haiku/SDL_bmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bopengl.cc b/libs/SDL2/src/video/haiku/SDL_bopengl.cc index 25869992..15454f10 100644 --- a/libs/SDL2/src/video/haiku/SDL_bopengl.cc +++ b/libs/SDL2/src/video/haiku/SDL_bopengl.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bopengl.h b/libs/SDL2/src/video/haiku/SDL_bopengl.h index e325687f..e7d475df 100644 --- a/libs/SDL2/src/video/haiku/SDL_bopengl.h +++ b/libs/SDL2/src/video/haiku/SDL_bopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bvideo.cc b/libs/SDL2/src/video/haiku/SDL_bvideo.cc index 9fe24d34..8c243b7a 100644 --- a/libs/SDL2/src/video/haiku/SDL_bvideo.cc +++ b/libs/SDL2/src/video/haiku/SDL_bvideo.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bvideo.h b/libs/SDL2/src/video/haiku/SDL_bvideo.h index 72292d00..ef5c7403 100644 --- a/libs/SDL2/src/video/haiku/SDL_bvideo.h +++ b/libs/SDL2/src/video/haiku/SDL_bvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bwindow.cc b/libs/SDL2/src/video/haiku/SDL_bwindow.cc index dc3ddb5d..287eac96 100644 --- a/libs/SDL2/src/video/haiku/SDL_bwindow.cc +++ b/libs/SDL2/src/video/haiku/SDL_bwindow.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bwindow.h b/libs/SDL2/src/video/haiku/SDL_bwindow.h index e1c59134..f64530ab 100644 --- a/libs/SDL2/src/video/haiku/SDL_bwindow.h +++ b/libs/SDL2/src/video/haiku/SDL_bwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/mir/SDL_mirdyn.c b/libs/SDL2/src/video/mir/SDL_mirdyn.c index ffb1e9e2..6bbe5375 100644 --- a/libs/SDL2/src/video/mir/SDL_mirdyn.c +++ b/libs/SDL2/src/video/mir/SDL_mirdyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -84,9 +84,8 @@ MIR_GetSym(const char *fnname, int *pHasModule) /* Define all the function pointers and wrappers... */ #define SDL_MIR_MODULE(modname) int SDL_MIR_HAVE_##modname = 0; #define SDL_MIR_SYM(rc,fn,params) SDL_DYNMIRFN_##fn MIR_##fn = NULL; +#define SDL_MIR_SYM_CONST(type,name) SDL_DYMMIRCONST_##name MIR_##name = NULL; #include "SDL_mirsym.h" -#undef SDL_MIR_MODULE -#undef SDL_MIR_SYM static int mir_load_refcount = 0; @@ -103,9 +102,8 @@ SDL_MIR_UnloadSymbols(void) /* set all the function pointers to NULL. */ #define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 0; #define SDL_MIR_SYM(rc,fn,params) MIR_##fn = NULL; +#define SDL_MIR_SYM_CONST(type,name) MIR_##name = NULL; #include "SDL_mirsym.h" -#undef SDL_MIR_MODULE -#undef SDL_MIR_SYM #ifdef SDL_VIDEO_DRIVER_MIR_DYNAMIC @@ -138,16 +136,12 @@ SDL_MIR_LoadSymbols(void) } #define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 1; /* default yes */ -#define SDL_MIR_SYM(rc,fn,params) #include "SDL_mirsym.h" -#undef SDL_MIR_MODULE -#undef SDL_MIR_SYM #define SDL_MIR_MODULE(modname) thismod = &SDL_MIR_HAVE_##modname; #define SDL_MIR_SYM(rc,fn,params) MIR_##fn = (SDL_DYNMIRFN_##fn) MIR_GetSym(#fn,thismod); +#define SDL_MIR_SYM_CONST(type,name) MIR_##name = *(SDL_DYMMIRCONST_##name*) MIR_GetSym(#name,thismod); #include "SDL_mirsym.h" -#undef SDL_MIR_MODULE -#undef SDL_MIR_SYM if ((SDL_MIR_HAVE_MIR_CLIENT) && (SDL_MIR_HAVE_XKBCOMMON)) { /* all required symbols loaded. */ @@ -162,9 +156,8 @@ SDL_MIR_LoadSymbols(void) #define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 1; /* default yes */ #define SDL_MIR_SYM(rc,fn,params) MIR_##fn = fn; +#define SDL_MIR_SYM_CONST(type,name) MIR_##name = name; #include "SDL_mirsym.h" -#undef SDL_MIR_MODULE -#undef SDL_MIR_SYM #endif } diff --git a/libs/SDL2/src/video/mir/SDL_mirdyn.h b/libs/SDL2/src/video/mir/SDL_mirdyn.h index 1dadfc6d..a3638cf0 100644 --- a/libs/SDL2/src/video/mir/SDL_mirdyn.h +++ b/libs/SDL2/src/video/mir/SDL_mirdyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,13 +36,13 @@ int SDL_MIR_LoadSymbols(void); void SDL_MIR_UnloadSymbols(void); /* Declare all the function pointers and wrappers... */ -#define SDL_MIR_MODULE(modname) #define SDL_MIR_SYM(rc,fn,params) \ typedef rc (*SDL_DYNMIRFN_##fn) params; \ extern SDL_DYNMIRFN_##fn MIR_##fn; +#define SDL_MIR_SYM_CONST(type, name) \ + typedef type SDL_DYMMIRCONST_##name; \ + extern SDL_DYMMIRCONST_##name MIR_##name; #include "SDL_mirsym.h" -#undef SDL_MIR_MODULE -#undef SDL_MIR_SYM #ifdef __cplusplus } diff --git a/libs/SDL2/src/video/mir/SDL_mirevents.c b/libs/SDL2/src/video/mir/SDL_mirevents.c index 8ff2cb3a..0873a580 100644 --- a/libs/SDL2/src/video/mir/SDL_mirevents.c +++ b/libs/SDL2/src/video/mir/SDL_mirevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -58,7 +58,7 @@ CheckKeyboardFocus(SDL_Window* sdl_window) { SDL_Window* keyboard_window = SDL_GetKeyboardFocus(); - if (keyboard_window != sdl_window) + if (sdl_window && keyboard_window != sdl_window) SDL_SetKeyboardFocus(sdl_window); } @@ -68,51 +68,68 @@ CheckKeyboardFocus(SDL_Window* sdl_window) a single key press produces a character. */ static void -HandleKeyEvent(MirKeyEvent const ev, SDL_Window* window) +HandleKeyEvent(MirKeyboardEvent const* key_event, SDL_Window* window) { - uint32_t scancode = SDL_SCANCODE_UNKNOWN; - Uint8 key_state = ev.action == mir_key_action_up ? SDL_RELEASED : SDL_PRESSED; + xkb_keysym_t key_code; + Uint8 key_state; + int event_scancode; + uint32_t sdl_scancode = SDL_SCANCODE_UNKNOWN; + + MirKeyboardAction action = MIR_mir_keyboard_event_action(key_event); + + key_state = SDL_PRESSED; + key_code = MIR_mir_keyboard_event_key_code(key_event); + event_scancode = MIR_mir_keyboard_event_scan_code(key_event); + + if (action == mir_keyboard_action_up) + key_state = SDL_RELEASED; CheckKeyboardFocus(window); - if (ev.scan_code < SDL_arraysize(xfree86_scancode_table2)) - scancode = xfree86_scancode_table2[ev.scan_code]; + if (event_scancode < SDL_arraysize(xfree86_scancode_table2)) + sdl_scancode = xfree86_scancode_table2[event_scancode]; - if (scancode != SDL_SCANCODE_UNKNOWN) - SDL_SendKeyboardKey(key_state, scancode); + if (sdl_scancode != SDL_SCANCODE_UNKNOWN) + SDL_SendKeyboardKey(key_state, sdl_scancode); if (key_state == SDL_PRESSED) - HandleKeyText(ev.key_code); + HandleKeyText(key_code); } static void -HandleMouseButton(SDL_Window* sdl_window, Uint8 state, MirMotionButton button_state) +HandleMouseButton(SDL_Window* sdl_window, Uint8 state, MirPointerEvent const* pointer) { - static uint32_t last_sdl_button; - uint32_t sdl_button; + uint32_t sdl_button = SDL_BUTTON_LEFT; + MirPointerButton button_state = mir_pointer_button_primary; + + static uint32_t old_button_states = 0; + uint32_t new_button_states = MIR_mir_pointer_event_buttons(pointer); + + // XOR on our old button states vs our new states to get the newley pressed/released button + button_state = new_button_states ^ old_button_states; switch (button_state) { - case mir_motion_button_primary: + case mir_pointer_button_primary: sdl_button = SDL_BUTTON_LEFT; break; - case mir_motion_button_secondary: + case mir_pointer_button_secondary: sdl_button = SDL_BUTTON_RIGHT; break; - case mir_motion_button_tertiary: + case mir_pointer_button_tertiary: sdl_button = SDL_BUTTON_MIDDLE; break; - case mir_motion_button_forward: + case mir_pointer_button_forward: sdl_button = SDL_BUTTON_X1; break; - case mir_motion_button_back: + case mir_pointer_button_back: sdl_button = SDL_BUTTON_X2; break; default: - sdl_button = last_sdl_button; break; } - last_sdl_button = sdl_button; + old_button_states = new_button_states; + SDL_SendMouseButton(sdl_window, 0, state, sdl_button); } @@ -148,71 +165,91 @@ AddTouchDevice(int device_id) } static void -HandleTouchEvent(MirMotionEvent const motion, int cord_index, SDL_Window* sdl_window) +HandleTouchEvent(MirTouchEvent const* touch, int device_id, SDL_Window* sdl_window) { - int device_id = motion.device_id; - int id = motion.pointer_coordinates[cord_index].id; + int i, point_count; + point_count = MIR_mir_touch_event_point_count(touch); - int width = sdl_window->w; - int height = sdl_window->h; - float x = motion.pointer_coordinates[cord_index].x; - float y = motion.pointer_coordinates[cord_index].y; + AddTouchDevice(device_id); - float n_x = x / width; - float n_y = y / height; - float pressure = motion.pointer_coordinates[cord_index].pressure; + for (i = 0; i < point_count; i++) { + int id = MIR_mir_touch_event_id(touch, i); - AddTouchDevice(motion.device_id); + int width = sdl_window->w; + int height = sdl_window->h; - switch (motion.action) { - case mir_motion_action_down: - case mir_motion_action_pointer_down: - HandleTouchPress(device_id, id, SDL_TRUE, n_x, n_y, pressure); - break; - case mir_motion_action_up: - case mir_motion_action_pointer_up: - HandleTouchPress(device_id, id, SDL_FALSE, n_x, n_y, pressure); - break; - case mir_motion_action_hover_move: - case mir_motion_action_move: - HandleTouchMotion(device_id, id, n_x, n_y, pressure); - break; - default: - break; + float x = MIR_mir_touch_event_axis_value(touch, i, mir_touch_axis_x); + float y = MIR_mir_touch_event_axis_value(touch, i, mir_touch_axis_y); + + float n_x = x / width; + float n_y = y / height; + + float pressure = MIR_mir_touch_event_axis_value(touch, i, mir_touch_axis_pressure); + + switch (MIR_mir_touch_event_action(touch, i)) { + case mir_touch_action_up: + HandleTouchPress(device_id, id, SDL_FALSE, n_x, n_y, pressure); + break; + case mir_touch_action_down: + HandleTouchPress(device_id, id, SDL_TRUE, n_x, n_y, pressure); + break; + case mir_touch_action_change: + HandleTouchMotion(device_id, id, n_x, n_y, pressure); + break; + } } } static void -HandleMouseEvent(MirMotionEvent const motion, int cord_index, SDL_Window* sdl_window) +HandleMouseEvent(MirPointerEvent const* pointer, SDL_Window* sdl_window) { SDL_SetMouseFocus(sdl_window); - switch (motion.action) { - case mir_motion_action_down: - case mir_motion_action_pointer_down: - HandleMouseButton(sdl_window, SDL_PRESSED, motion.button_state); + switch (MIR_mir_pointer_event_action(pointer)) { + case mir_pointer_action_button_down: + HandleMouseButton(sdl_window, SDL_PRESSED, pointer); break; - case mir_motion_action_up: - case mir_motion_action_pointer_up: - HandleMouseButton(sdl_window, SDL_RELEASED, motion.button_state); + case mir_pointer_action_button_up: + HandleMouseButton(sdl_window, SDL_RELEASED, pointer); break; - case mir_motion_action_hover_move: - case mir_motion_action_move: - HandleMouseMotion(sdl_window, - motion.pointer_coordinates[cord_index].x, - motion.pointer_coordinates[cord_index].y); + case mir_pointer_action_motion: { + int x, y; + int hscroll, vscroll; + SDL_Mouse* mouse = SDL_GetMouse(); + x = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_x); + y = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_y); + hscroll = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_hscroll); + vscroll = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_vscroll); + + if (mouse && (mouse->x != x || mouse->y != y)) + HandleMouseMotion(sdl_window, x, y); + if (vscroll != 0 || hscroll != 0) + HandleMouseScroll(sdl_window, hscroll, vscroll); + } break; - case mir_motion_action_outside: + case mir_pointer_action_leave: SDL_SetMouseFocus(NULL); break; - case mir_motion_action_scroll: - HandleMouseScroll(sdl_window, - motion.pointer_coordinates[cord_index].hscroll, - motion.pointer_coordinates[cord_index].vscroll); + case mir_pointer_action_enter: + default: break; - case mir_motion_action_cancel: - case mir_motion_action_hover_enter: - case mir_motion_action_hover_exit: + } +} + +static void +MIR_HandleInput(MirInputEvent const* input_event, SDL_Window* window) +{ + switch (MIR_mir_input_event_get_type(input_event)) { + case (mir_input_event_type_key): + HandleKeyEvent(MIR_mir_input_event_get_keyboard_event(input_event), window); + break; + case (mir_input_event_type_pointer): + HandleMouseEvent(MIR_mir_input_event_get_pointer_event(input_event), window); + break; + case (mir_input_event_type_touch): + HandleTouchEvent(MIR_mir_input_event_get_touch_event(input_event), + MIR_mir_input_event_get_device_id(input_event), + window); break; default: break; @@ -220,32 +257,35 @@ HandleMouseEvent(MirMotionEvent const motion, int cord_index, SDL_Window* sdl_wi } static void -HandleMotionEvent(MirMotionEvent const motion, SDL_Window* sdl_window) +MIR_HandleResize(MirResizeEvent const* resize_event, SDL_Window* window) { - int cord_index; - for (cord_index = 0; cord_index < motion.pointer_count; cord_index++) { - if (motion.pointer_coordinates[cord_index].tool_type == mir_motion_tool_type_finger) { - HandleTouchEvent(motion, cord_index, sdl_window); - } - else { - HandleMouseEvent(motion, cord_index, sdl_window); - } - } + int new_w = MIR_mir_resize_event_get_width (resize_event); + int new_h = MIR_mir_resize_event_get_height(resize_event); + + int old_w = window->w; + int old_h = window->h; + + if (new_w != old_w || new_h != old_h) + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, new_w, new_h); } void -MIR_HandleInput(MirSurface* surface, MirEvent const* ev, void* context) +MIR_HandleEvent(MirSurface* surface, MirEvent const* ev, void* context) { - SDL_Window* window = (SDL_Window*)context; - switch (ev->type) { - case (mir_event_type_key): - HandleKeyEvent(ev->key, window); - break; - case (mir_event_type_motion): - HandleMotionEvent(ev->motion, window); - break; - default: - break; + MirEventType event_type = MIR_mir_event_get_type(ev); + SDL_Window* window = (SDL_Window*)context; + + if (window) { + switch (event_type) { + case (mir_event_type_input): + MIR_HandleInput(MIR_mir_event_get_input_event(ev), window); + break; + case (mir_event_type_resize): + MIR_HandleResize(MIR_mir_event_get_resize_event(ev), window); + break; + default: + break; + } } } diff --git a/libs/SDL2/src/video/mir/SDL_mirevents.h b/libs/SDL2/src/video/mir/SDL_mirevents.h index 8caabc8a..121c4b36 100644 --- a/libs/SDL2/src/video/mir/SDL_mirevents.h +++ b/libs/SDL2/src/video/mir/SDL_mirevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,7 +29,7 @@ #include extern void -MIR_HandleInput(MirSurface* surface, MirEvent const* ev, void* context); +MIR_HandleEvent(MirSurface* surface, MirEvent const* ev, void* context); #endif /* _SDL_mirevents_h */ diff --git a/libs/SDL2/src/video/mir/SDL_mirframebuffer.c b/libs/SDL2/src/video/mir/SDL_mirframebuffer.c index d1821cc4..33158732 100644 --- a/libs/SDL2/src/video/mir/SDL_mirframebuffer.c +++ b/libs/SDL2/src/video/mir/SDL_mirframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -39,7 +39,11 @@ static const Uint32 mir_pixel_format_to_sdl_format[] = { SDL_PIXELFORMAT_BGR888, /* mir_pixel_format_xbgr_8888 */ SDL_PIXELFORMAT_ARGB8888, /* mir_pixel_format_argb_8888 */ SDL_PIXELFORMAT_RGB888, /* mir_pixel_format_xrgb_8888 */ - SDL_PIXELFORMAT_BGR24 /* mir_pixel_format_bgr_888 */ + SDL_PIXELFORMAT_BGR24, /* mir_pixel_format_bgr_888 */ + SDL_PIXELFORMAT_RGB24, /* mir_pixel_format_rgb_888 */ + SDL_PIXELFORMAT_RGB565, /* mir_pixel_format_rgb_565 */ + SDL_PIXELFORMAT_RGBA5551, /* mir_pixel_format_rgba_5551 */ + SDL_PIXELFORMAT_RGBA4444 /* mir_pixel_format_rgba_4444 */ }; Uint32 @@ -53,19 +57,13 @@ MIR_CreateWindowFramebuffer(_THIS, SDL_Window* window, Uint32* format, void** pixels, int* pitch) { MIR_Data* mir_data = _this->driverdata; - MIR_Window* mir_window; - MirSurfaceParameters surfaceparm; mir_data->software = SDL_TRUE; if (MIR_CreateWindow(_this, window) < 0) return SDL_SetError("Failed to created a mir window."); - mir_window = window->driverdata; - - MIR_mir_surface_get_parameters(mir_window->surface, &surfaceparm); - - *format = MIR_GetSDLPixelFormat(surfaceparm.pixel_format); + *format = MIR_GetSDLPixelFormat(mir_data->pixel_format); if (*format == SDL_PIXELFORMAT_UNKNOWN) return SDL_SetError("Unknown pixel format"); @@ -75,12 +73,6 @@ MIR_CreateWindowFramebuffer(_THIS, SDL_Window* window, Uint32* format, if (*pixels == NULL) return SDL_OutOfMemory(); - mir_window->surface = MIR_mir_connection_create_surface_sync(mir_data->connection, &surfaceparm); - if (!MIR_mir_surface_is_valid(mir_window->surface)) { - const char* error = MIR_mir_surface_get_error_message(mir_window->surface); - return SDL_SetError("Failed to created a mir surface: %s", error); - } - return 0; } @@ -91,12 +83,14 @@ MIR_UpdateWindowFramebuffer(_THIS, SDL_Window* window, MIR_Window* mir_window = window->driverdata; MirGraphicsRegion region; + MirBufferStream* bs; int i, j, x, y, w, h, start; int bytes_per_pixel, bytes_per_row, s_stride, d_stride; char* s_dest; char* pixels; - MIR_mir_surface_get_graphics_region(mir_window->surface, ®ion); + bs = MIR_mir_surface_get_buffer_stream(mir_window->surface); + MIR_mir_buffer_stream_get_graphics_region(bs, ®ion); s_dest = region.vaddr; pixels = (char*)window->surface->pixels; @@ -138,13 +132,13 @@ MIR_UpdateWindowFramebuffer(_THIS, SDL_Window* window, bytes_per_row = bytes_per_pixel * w; for (j = 0; j < h; j++) { - memcpy(s_dest, pixels, bytes_per_row); + SDL_memcpy(s_dest, pixels, bytes_per_row); pixels += s_stride; s_dest += d_stride; } } - MIR_mir_surface_swap_buffers_sync(mir_window->surface); + MIR_mir_buffer_stream_swap_buffers_sync(bs); return 0; } diff --git a/libs/SDL2/src/video/mir/SDL_mirframebuffer.h b/libs/SDL2/src/video/mir/SDL_mirframebuffer.h index 328fb23d..22a579c0 100644 --- a/libs/SDL2/src/video/mir/SDL_mirframebuffer.h +++ b/libs/SDL2/src/video/mir/SDL_mirframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/mir/SDL_mirmouse.c b/libs/SDL2/src/video/mir/SDL_mirmouse.c index 740ac20e..439f3f3f 100644 --- a/libs/SDL2/src/video/mir/SDL_mirmouse.c +++ b/libs/SDL2/src/video/mir/SDL_mirmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,13 +27,22 @@ #if SDL_VIDEO_DRIVER_MIR -#include "SDL_mirmouse.h" - #include "../../events/SDL_mouse_c.h" +#include "../SDL_sysvideo.h" #include "SDL_assert.h" #include "SDL_mirdyn.h" +#include "SDL_mirvideo.h" +#include "SDL_mirmouse.h" +#include "SDL_mirwindow.h" + +typedef struct +{ + MirCursorConfiguration* conf; + MirBufferStream* stream; +} MIR_Cursor; + static SDL_Cursor* MIR_CreateDefaultCursor() { @@ -41,6 +50,18 @@ MIR_CreateDefaultCursor() cursor = SDL_calloc(1, sizeof(SDL_Cursor)); if (cursor) { + + MIR_Cursor* mir_cursor = SDL_calloc(1, sizeof(MIR_Cursor)); + if (mir_cursor) { + mir_cursor->conf = NULL; + mir_cursor->stream = NULL; + cursor->driverdata = mir_cursor; + } + else { + SDL_OutOfMemory(); + SDL_free(cursor); + cursor = NULL; + } } else { SDL_OutOfMemory(); @@ -49,58 +70,170 @@ MIR_CreateDefaultCursor() return cursor; } -static SDL_Cursor* -MIR_CreateCursor(SDL_Surface* sruface, int hot_x, int hot_y) +static void +CopySurfacePixelsToMirStream(SDL_Surface* surface, MirBufferStream* stream) { - return MIR_CreateDefaultCursor(); + char* dest, *pixels; + int i, s_w, s_h, r_stride, p_stride, bytes_per_pixel, bytes_per_row; + + MirGraphicsRegion region; + MIR_mir_buffer_stream_get_graphics_region(stream, ®ion); + + s_w = surface->w; + s_h = surface->h; + + bytes_per_pixel = surface->format->BytesPerPixel; + bytes_per_row = bytes_per_pixel * s_w; + + dest = region.vaddr; + pixels = (char*)surface->pixels; + + r_stride = region.stride; + p_stride = surface->pitch; + + for (i = 0; i < s_h; i++) + { + SDL_memcpy(dest, pixels, bytes_per_row); + dest += r_stride; + pixels += p_stride; + } +} + +static SDL_Cursor* +MIR_CreateCursor(SDL_Surface* surface, int hot_x, int hot_y) +{ + MirCursorConfiguration* conf; + MirBufferStream* stream; + + int s_w = surface->w; + int s_h = surface->h; + + MIR_Data* mir_data = (MIR_Data*)SDL_GetVideoDevice()->driverdata; + SDL_Cursor* cursor = MIR_CreateDefaultCursor(); + MIR_Cursor* mir_cursor; + + if (!cursor) { + return NULL; + } + + mir_cursor = (MIR_Cursor*)cursor->driverdata; + + stream = MIR_mir_connection_create_buffer_stream_sync(mir_data->connection, + s_w, s_h, mir_data->pixel_format, + mir_buffer_usage_software); + + conf = MIR_mir_cursor_configuration_from_buffer_stream(stream, hot_x, hot_y); + + CopySurfacePixelsToMirStream(surface, stream); + MIR_mir_buffer_stream_swap_buffers_sync(stream); + + mir_cursor->conf = conf; + mir_cursor->stream = stream; + + return cursor; } static SDL_Cursor* MIR_CreateSystemCursor(SDL_SystemCursor id) { + char const* cursor_name = NULL; + MirCursorConfiguration* conf; + SDL_Cursor* cursor = MIR_CreateDefaultCursor(); + + if (!cursor) { + return NULL; + } + switch(id) { case SDL_SYSTEM_CURSOR_ARROW: + cursor_name = MIR_mir_arrow_cursor_name; break; case SDL_SYSTEM_CURSOR_IBEAM: + cursor_name = MIR_mir_caret_cursor_name; break; case SDL_SYSTEM_CURSOR_WAIT: + cursor_name = MIR_mir_busy_cursor_name; break; case SDL_SYSTEM_CURSOR_CROSSHAIR: + /* Unsupported */ + cursor_name = MIR_mir_arrow_cursor_name; break; case SDL_SYSTEM_CURSOR_WAITARROW: + cursor_name = MIR_mir_busy_cursor_name; break; case SDL_SYSTEM_CURSOR_SIZENWSE: + cursor_name = MIR_mir_omnidirectional_resize_cursor_name; break; case SDL_SYSTEM_CURSOR_SIZENESW: + cursor_name = MIR_mir_omnidirectional_resize_cursor_name; break; case SDL_SYSTEM_CURSOR_SIZEWE: + cursor_name = MIR_mir_horizontal_resize_cursor_name; break; case SDL_SYSTEM_CURSOR_SIZENS: + cursor_name = MIR_mir_vertical_resize_cursor_name; break; case SDL_SYSTEM_CURSOR_SIZEALL: + cursor_name = MIR_mir_omnidirectional_resize_cursor_name; break; case SDL_SYSTEM_CURSOR_NO: + /* Unsupported */ + cursor_name = MIR_mir_closed_hand_cursor_name; break; case SDL_SYSTEM_CURSOR_HAND: + cursor_name = MIR_mir_open_hand_cursor_name; break; default: SDL_assert(0); return NULL; } - return MIR_CreateDefaultCursor(); + conf = MIR_mir_cursor_configuration_from_name(cursor_name); + + cursor->driverdata = conf; + + return cursor; } static void MIR_FreeCursor(SDL_Cursor* cursor) { - if (cursor) - SDL_free(cursor); + if (cursor) { + + if (cursor->driverdata) { + MIR_Cursor* mir_cursor = (MIR_Cursor*)cursor->driverdata; + + if (mir_cursor->conf) + MIR_mir_cursor_configuration_destroy(mir_cursor->conf); + if (mir_cursor->stream) + MIR_mir_buffer_stream_release_sync(mir_cursor->stream); + + SDL_free(mir_cursor); + } + + SDL_free(cursor); + } } static int MIR_ShowCursor(SDL_Cursor* cursor) { + MIR_Data* mir_data = (MIR_Data*)SDL_GetVideoDevice()->driverdata; + MIR_Window* mir_window = mir_data->current_window; + + if (cursor && cursor->driverdata) { + if (mir_window && MIR_mir_surface_is_valid(mir_window->surface)) { + MIR_Cursor* mir_cursor = (MIR_Cursor*)cursor->driverdata; + + if (mir_cursor->conf) { + MIR_mir_wait_for(MIR_mir_surface_configure_cursor(mir_window->surface, mir_cursor->conf)); + } + } + } + else if(mir_window && MIR_mir_surface_is_valid(mir_window->surface)) { + MIR_mir_wait_for(MIR_mir_surface_configure_cursor(mir_window->surface, NULL)); + } + return 0; } diff --git a/libs/SDL2/src/video/mir/SDL_mirmouse.h b/libs/SDL2/src/video/mir/SDL_mirmouse.h index 700cc699..94dd0856 100644 --- a/libs/SDL2/src/video/mir/SDL_mirmouse.h +++ b/libs/SDL2/src/video/mir/SDL_mirmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/mir/SDL_miropengl.c b/libs/SDL2/src/video/mir/SDL_miropengl.c index b7c7ae80..23fabb26 100644 --- a/libs/SDL2/src/video/mir/SDL_miropengl.c +++ b/libs/SDL2/src/video/mir/SDL_miropengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/mir/SDL_miropengl.h b/libs/SDL2/src/video/mir/SDL_miropengl.h index 5a04ac8a..96bb40a6 100644 --- a/libs/SDL2/src/video/mir/SDL_miropengl.h +++ b/libs/SDL2/src/video/mir/SDL_miropengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/mir/SDL_mirsym.h b/libs/SDL2/src/video/mir/SDL_mirsym.h index 415df0c9..36112c16 100644 --- a/libs/SDL2/src/video/mir/SDL_mirsym.h +++ b/libs/SDL2/src/video/mir/SDL_mirsym.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,29 +21,96 @@ /* *INDENT-OFF* */ +#ifndef SDL_MIR_MODULE +#define SDL_MIR_MODULE(modname) +#endif + +#ifndef SDL_MIR_SYM +#define SDL_MIR_SYM(rc,fn,params) +#endif + +#ifndef SDL_MIR_SYM_CONST +#define SDL_MIR_SYM_CONST(type, name) +#endif + SDL_MIR_MODULE(MIR_CLIENT) SDL_MIR_SYM(MirDisplayConfiguration*,mir_connection_create_display_config,(MirConnection *connection)) -SDL_MIR_SYM(MirSurface *,mir_connection_create_surface_sync,(MirConnection *connection, MirSurfaceParameters const *params)) +SDL_MIR_SYM(MirSurface *,mir_surface_create_sync,(MirSurfaceSpec* spec)) +SDL_MIR_SYM(MirEGLNativeWindowType,mir_buffer_stream_get_egl_native_window,(MirBufferStream *surface)) +SDL_MIR_SYM(void,mir_buffer_stream_get_graphics_region,(MirBufferStream *stream, MirGraphicsRegion *graphics_region)) +SDL_MIR_SYM(void,mir_buffer_stream_swap_buffers_sync,(MirBufferStream *stream)) +SDL_MIR_SYM(void,mir_surface_set_event_handler,(MirSurface *surface, mir_surface_event_callback callback, void* context)) +SDL_MIR_SYM(MirSurfaceSpec*,mir_connection_create_spec_for_normal_surface,(MirConnection *connection, int width, int height, MirPixelFormat format)) +SDL_MIR_SYM(MirSurfaceSpec*,mir_connection_create_spec_for_changes,(MirConnection *connection)) +SDL_MIR_SYM(void,mir_surface_spec_set_buffer_usage,(MirSurfaceSpec *spec, MirBufferUsage usage)) +SDL_MIR_SYM(void,mir_surface_spec_set_name,(MirSurfaceSpec *spec, char const *name)) +SDL_MIR_SYM(void,mir_surface_spec_release,(MirSurfaceSpec *spec)) +SDL_MIR_SYM(void,mir_surface_spec_set_width,(MirSurfaceSpec *spec, unsigned width)) +SDL_MIR_SYM(void,mir_surface_spec_set_height,(MirSurfaceSpec *spec, unsigned height)) +SDL_MIR_SYM(void,mir_surface_spec_set_min_width,(MirSurfaceSpec *spec, unsigned min_width)) +SDL_MIR_SYM(void,mir_surface_spec_set_min_height,(MirSurfaceSpec *spec, unsigned min_height)) +SDL_MIR_SYM(void,mir_surface_spec_set_max_width,(MirSurfaceSpec *spec, unsigned max_width)) +SDL_MIR_SYM(void,mir_surface_spec_set_max_height,(MirSurfaceSpec *spec, unsigned max_height)) +SDL_MIR_SYM(void,mir_surface_spec_set_type,(MirSurfaceSpec *spec, MirSurfaceType type)) +SDL_MIR_SYM(void,mir_surface_spec_set_state,(MirSurfaceSpec *spec, MirSurfaceState state)) +SDL_MIR_SYM(void,mir_surface_apply_spec,(MirSurface *surface, MirSurfaceSpec *spec)) +SDL_MIR_SYM(void,mir_surface_get_parameters,(MirSurface *surface, MirSurfaceParameters *params)) +SDL_MIR_SYM(MirBufferStream*,mir_surface_get_buffer_stream,(MirSurface *surface)) +SDL_MIR_SYM(MirCursorConfiguration*,mir_cursor_configuration_from_buffer_stream,(MirBufferStream* stream, int hot_x, int hot_y)) +SDL_MIR_SYM(MirBufferStream*,mir_connection_create_buffer_stream_sync,(MirConnection *connection, int w, int h, MirPixelFormat format, MirBufferUsage usage)) +SDL_MIR_SYM(MirKeyboardAction,mir_keyboard_event_action,(MirKeyboardEvent const *event)) +SDL_MIR_SYM(xkb_keysym_t,mir_keyboard_event_key_code,(MirKeyboardEvent const *event)) +SDL_MIR_SYM(int,mir_keyboard_event_scan_code,(MirKeyboardEvent const *event)) +SDL_MIR_SYM(bool,mir_pointer_event_button_state,(MirPointerEvent const *event, MirPointerButton button)) +SDL_MIR_SYM(MirPointerButtons,mir_pointer_event_buttons,(MirPointerEvent const *event)) +SDL_MIR_SYM(MirInputDeviceId,mir_input_event_get_device_id,(MirInputEvent const* ev)) +SDL_MIR_SYM(MirTouchId,mir_touch_event_id,(MirTouchEvent const *event, size_t touch_index)) +SDL_MIR_SYM(float,mir_touch_event_axis_value,(MirTouchEvent const *event, size_t touch_index, MirTouchAxis axis)) +SDL_MIR_SYM(MirTouchAction,mir_touch_event_action,(MirTouchEvent const *event, size_t touch_index)) +SDL_MIR_SYM(MirPointerAction,mir_pointer_event_action,(MirPointerEvent const *event)) +SDL_MIR_SYM(float,mir_pointer_event_axis_value,(MirPointerEvent const *event, MirPointerAxis)) +SDL_MIR_SYM(MirEventType,mir_event_get_type,(MirEvent const *event)) +SDL_MIR_SYM(MirInputEventType,mir_input_event_get_type,(MirInputEvent const *event)) +SDL_MIR_SYM(MirInputEvent const*,mir_event_get_input_event,(MirEvent const *event)) +SDL_MIR_SYM(MirResizeEvent const*,mir_event_get_resize_event,(MirEvent const *event)) +SDL_MIR_SYM(MirKeyboardEvent const*,mir_input_event_get_keyboard_event,(MirInputEvent const *event)) +SDL_MIR_SYM(MirPointerEvent const*,mir_input_event_get_pointer_event,(MirInputEvent const *event)) +SDL_MIR_SYM(MirTouchEvent const*,mir_input_event_get_touch_event,(MirInputEvent const *event)) +SDL_MIR_SYM(unsigned int,mir_touch_event_point_count,(MirTouchEvent const *event)) SDL_MIR_SYM(void,mir_connection_get_available_surface_formats,(MirConnection* connection, MirPixelFormat* formats, unsigned const int format_size, unsigned int *num_valid_formats)) SDL_MIR_SYM(MirEGLNativeDisplayType,mir_connection_get_egl_native_display,(MirConnection *connection)) -SDL_MIR_SYM(MirBool,mir_connection_is_valid,(MirConnection *connection)) +SDL_MIR_SYM(bool,mir_connection_is_valid,(MirConnection *connection)) SDL_MIR_SYM(void,mir_connection_release,(MirConnection *connection)) +SDL_MIR_SYM(MirPixelFormat,mir_connection_get_egl_pixel_format,(MirConnection* connection, void* egldisplay, void* eglconfig)) SDL_MIR_SYM(MirConnection *,mir_connect_sync,(char const *server, char const *app_name)) SDL_MIR_SYM(void,mir_display_config_destroy,(MirDisplayConfiguration* display_configuration)) -SDL_MIR_SYM(MirEGLNativeWindowType,mir_surface_get_egl_native_window,(MirSurface *surface)) SDL_MIR_SYM(char const *,mir_surface_get_error_message,(MirSurface *surface)) -SDL_MIR_SYM(void,mir_surface_get_graphics_region,(MirSurface *surface, MirGraphicsRegion *graphics_region)) -SDL_MIR_SYM(void,mir_surface_get_parameters,(MirSurface *surface, MirSurfaceParameters *parameters)) -SDL_MIR_SYM(MirBool,mir_surface_is_valid,(MirSurface *surface)) +SDL_MIR_SYM(bool,mir_surface_is_valid,(MirSurface *surface)) SDL_MIR_SYM(void,mir_surface_release_sync,(MirSurface *surface)) -SDL_MIR_SYM(void,mir_surface_set_event_handler,(MirSurface *surface, MirEventDelegate const *event_handler)) -SDL_MIR_SYM(MirWaitHandle*,mir_surface_set_type,(MirSurface *surface, MirSurfaceType type)) -SDL_MIR_SYM(MirWaitHandle*,mir_surface_set_state,(MirSurface *surface, MirSurfaceState state)) -SDL_MIR_SYM(void,mir_surface_swap_buffers_sync,(MirSurface *surface)) +SDL_MIR_SYM(void,mir_buffer_stream_release_sync,(MirBufferStream *stream)) +SDL_MIR_SYM(MirCursorConfiguration*,mir_cursor_configuration_from_name,(char const* cursor_name)) +SDL_MIR_SYM(MirWaitHandle*,mir_surface_configure_cursor,(MirSurface* surface, MirCursorConfiguration const* conf)) +SDL_MIR_SYM(void,mir_cursor_configuration_destroy,(MirCursorConfiguration* conf)) +SDL_MIR_SYM(void,mir_wait_for,(MirWaitHandle* handle)) +SDL_MIR_SYM(int,mir_resize_event_get_width,(MirResizeEvent const* resize_event)) +SDL_MIR_SYM(int,mir_resize_event_get_height,(MirResizeEvent const* resize_event)) + +SDL_MIR_SYM_CONST(char const*,mir_omnidirectional_resize_cursor_name) +SDL_MIR_SYM_CONST(char const*,mir_busy_cursor_name) +SDL_MIR_SYM_CONST(char const*,mir_arrow_cursor_name) +SDL_MIR_SYM_CONST(char const*,mir_caret_cursor_name) +SDL_MIR_SYM_CONST(char const*,mir_vertical_resize_cursor_name) +SDL_MIR_SYM_CONST(char const*,mir_horizontal_resize_cursor_name) +SDL_MIR_SYM_CONST(char const*,mir_open_hand_cursor_name) +SDL_MIR_SYM_CONST(char const*,mir_closed_hand_cursor_name) SDL_MIR_MODULE(XKBCOMMON) SDL_MIR_SYM(int,xkb_keysym_to_utf8,(xkb_keysym_t keysym, char *buffer, size_t size)) +#undef SDL_MIR_MODULE +#undef SDL_MIR_SYM +#undef SDL_MIR_SYM_CONST + /* *INDENT-ON* */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/mir/SDL_mirvideo.c b/libs/SDL2/src/video/mir/SDL_mirvideo.c index 176e9a12..7b7196f3 100644 --- a/libs/SDL2/src/video/mir/SDL_mirvideo.c +++ b/libs/SDL2/src/video/mir/SDL_mirvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,13 +27,13 @@ #if SDL_VIDEO_DRIVER_MIR +#include "SDL_mirwindow.h" #include "SDL_video.h" #include "SDL_mirframebuffer.h" #include "SDL_mirmouse.h" #include "SDL_miropengl.h" #include "SDL_mirvideo.h" -#include "SDL_mirwindow.h" #include "SDL_mirdyn.h" @@ -146,29 +146,29 @@ MIR_CreateDevice(int device_index) device->GL_GetProcAddress = MIR_GL_GetProcAddress; /* mirwindow */ - device->CreateWindow = MIR_CreateWindow; - device->DestroyWindow = MIR_DestroyWindow; - device->GetWindowWMInfo = MIR_GetWindowWMInfo; - device->SetWindowFullscreen = MIR_SetWindowFullscreen; - device->MaximizeWindow = MIR_MaximizeWindow; - device->MinimizeWindow = MIR_MinimizeWindow; - device->RestoreWindow = MIR_RestoreWindow; + device->CreateWindow = MIR_CreateWindow; + device->DestroyWindow = MIR_DestroyWindow; + device->GetWindowWMInfo = MIR_GetWindowWMInfo; + device->SetWindowFullscreen = MIR_SetWindowFullscreen; + device->MaximizeWindow = MIR_MaximizeWindow; + device->MinimizeWindow = MIR_MinimizeWindow; + device->RestoreWindow = MIR_RestoreWindow; + device->ShowWindow = MIR_RestoreWindow; + device->HideWindow = MIR_HideWindow; + device->SetWindowSize = MIR_SetWindowSize; + device->SetWindowMinimumSize = MIR_SetWindowMinimumSize; + device->SetWindowMaximumSize = MIR_SetWindowMaximumSize; + device->SetWindowTitle = MIR_SetWindowTitle; device->CreateWindowFrom = NULL; - device->SetWindowTitle = NULL; device->SetWindowIcon = NULL; - device->SetWindowPosition = NULL; - device->SetWindowSize = NULL; - device->SetWindowMinimumSize = NULL; - device->SetWindowMaximumSize = NULL; - device->ShowWindow = NULL; - device->HideWindow = NULL; device->RaiseWindow = NULL; device->SetWindowBordered = NULL; device->SetWindowGammaRamp = NULL; device->GetWindowGammaRamp = NULL; device->SetWindowGrab = NULL; device->OnWindowEnter = NULL; + device->SetWindowPosition = NULL; /* mirframebuffer */ device->CreateWindowFramebuffer = MIR_CreateWindowFramebuffer; @@ -272,8 +272,10 @@ MIR_VideoInit(_THIS) { MIR_Data* mir_data = _this->driverdata; - mir_data->connection = MIR_mir_connect_sync(NULL, __PRETTY_FUNCTION__); - mir_data->software = SDL_FALSE; + mir_data->connection = MIR_mir_connect_sync(NULL, __PRETTY_FUNCTION__); + mir_data->current_window = NULL; + mir_data->software = SDL_FALSE; + mir_data->pixel_format = mir_pixel_format_invalid; if (!MIR_mir_connection_is_valid(mir_data->connection)) return SDL_SetError("Failed to connect to the Mir Server"); diff --git a/libs/SDL2/src/video/mir/SDL_mirvideo.h b/libs/SDL2/src/video/mir/SDL_mirvideo.h index 8db90b52..0824b9e0 100644 --- a/libs/SDL2/src/video/mir/SDL_mirvideo.h +++ b/libs/SDL2/src/video/mir/SDL_mirvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,11 +29,14 @@ #include #include +typedef struct MIR_Window MIR_Window; + typedef struct { MirConnection* connection; - SDL_bool software; - + MIR_Window* current_window; + SDL_bool software; + MirPixelFormat pixel_format; } MIR_Data; #endif /* _SDL_mirvideo_h_ */ diff --git a/libs/SDL2/src/video/mir/SDL_mirwindow.c b/libs/SDL2/src/video/mir/SDL_mirwindow.c index 513dbe24..2d6f4a51 100644 --- a/libs/SDL2/src/video/mir/SDL_mirwindow.c +++ b/libs/SDL2/src/video/mir/SDL_mirwindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -55,7 +55,7 @@ FindValidPixelFormat(MIR_Data* mir_data) MirPixelFormat formats[pf_size]; MIR_mir_connection_get_available_surface_formats(mir_data->connection, formats, - pf_size, &valid_formats); + pf_size, &valid_formats); for (f = 0; f < valid_formats; f++) { MirPixelFormat cur_pf = formats[f]; @@ -77,21 +77,10 @@ MIR_CreateWindow(_THIS, SDL_Window* window) { MIR_Window* mir_window; MIR_Data* mir_data; + MirPixelFormat pixel_format; + MirBufferUsage buffer_usage; - MirSurfaceParameters surfaceparm = - { - .name = "MirSurface", - .width = window->w, - .height = window->h, - .pixel_format = mir_pixel_format_invalid, - .buffer_usage = mir_buffer_usage_hardware, - .output_id = mir_display_output_id_invalid - }; - - MirEventDelegate delegate = { - MIR_HandleInput, - window - }; + MirSurfaceSpec* spec; mir_window = SDL_calloc(1, sizeof(MIR_Window)); if (!mir_window) @@ -100,9 +89,6 @@ MIR_CreateWindow(_THIS, SDL_Window* window) mir_data = _this->driverdata; window->driverdata = mir_window; - if (mir_data->software) - surfaceparm.buffer_usage = mir_buffer_usage_software; - if (window->x == SDL_WINDOWPOS_UNDEFINED) window->x = 0; @@ -112,12 +98,37 @@ MIR_CreateWindow(_THIS, SDL_Window* window) mir_window->mir_data = mir_data; mir_window->sdl_window = window; - surfaceparm.pixel_format = FindValidPixelFormat(mir_data); - if (surfaceparm.pixel_format == mir_pixel_format_invalid) { + if (window->flags & SDL_WINDOW_OPENGL) { + pixel_format = MIR_mir_connection_get_egl_pixel_format(mir_data->connection, + _this->egl_data->egl_display, + _this->egl_data->egl_config); + } + else { + pixel_format = FindValidPixelFormat(mir_data); + } + + mir_data->pixel_format = pixel_format; + if (pixel_format == mir_pixel_format_invalid) { return SDL_SetError("Failed to find a valid pixel format."); } - mir_window->surface = MIR_mir_connection_create_surface_sync(mir_data->connection, &surfaceparm); + buffer_usage = mir_buffer_usage_hardware; + if (mir_data->software) + buffer_usage = mir_buffer_usage_software; + + spec = MIR_mir_connection_create_spec_for_normal_surface(mir_data->connection, + window->w, + window->h, + pixel_format); + + MIR_mir_surface_spec_set_buffer_usage(spec, buffer_usage); + MIR_mir_surface_spec_set_name(spec, "Mir surface"); + + mir_window->surface = MIR_mir_surface_create_sync(spec); + MIR_mir_surface_set_event_handler(mir_window->surface, MIR_HandleEvent, window); + + MIR_mir_surface_spec_release(spec); + if (!MIR_mir_surface_is_valid(mir_window->surface)) { const char* error = MIR_mir_surface_get_error_message(mir_window->surface); return SDL_SetError("Failed to created a mir surface: %s", error); @@ -125,7 +136,8 @@ MIR_CreateWindow(_THIS, SDL_Window* window) if (window->flags & SDL_WINDOW_OPENGL) { EGLNativeWindowType egl_native_window = - (EGLNativeWindowType)MIR_mir_surface_get_egl_native_window(mir_window->surface); + (EGLNativeWindowType)MIR_mir_buffer_stream_get_egl_native_window( + MIR_mir_surface_get_buffer_stream(mir_window->surface)); mir_window->egl_surface = SDL_EGL_CreateSurface(_this, egl_native_window); @@ -138,7 +150,7 @@ MIR_CreateWindow(_THIS, SDL_Window* window) mir_window->egl_surface = EGL_NO_SURFACE; } - MIR_mir_surface_set_event_handler(mir_window->surface, &delegate); + mir_data->current_window = mir_window; return 0; } @@ -146,13 +158,15 @@ MIR_CreateWindow(_THIS, SDL_Window* window) void MIR_DestroyWindow(_THIS, SDL_Window* window) { - MIR_Data* mir_data = _this->driverdata; + MIR_Data* mir_data = _this->driverdata; MIR_Window* mir_window = window->driverdata; if (mir_data) { SDL_EGL_DestroySurface(_this, mir_window->egl_surface); MIR_mir_surface_release_sync(mir_window->surface); + mir_data->current_window = NULL; + SDL_free(mir_window); } window->driverdata = NULL; @@ -180,49 +194,166 @@ MIR_SetWindowFullscreen(_THIS, SDL_Window* window, SDL_VideoDisplay* display, SDL_bool fullscreen) { + MIR_Data* mir_data = _this->driverdata; MIR_Window* mir_window = window->driverdata; + MirSurfaceSpec* spec; + MirSurfaceState state; if (IsSurfaceValid(mir_window) < 0) return; if (fullscreen) { - MIR_mir_surface_set_state(mir_window->surface, mir_surface_state_fullscreen); + state = mir_surface_state_fullscreen; } else { - MIR_mir_surface_set_state(mir_window->surface, mir_surface_state_restored); + state = mir_surface_state_restored; } + + spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); + MIR_mir_surface_spec_set_state(spec, state); + + MIR_mir_surface_apply_spec(mir_window->surface, spec); + MIR_mir_surface_spec_release(spec); } void MIR_MaximizeWindow(_THIS, SDL_Window* window) { + MIR_Data* mir_data = _this->driverdata; MIR_Window* mir_window = window->driverdata; + MirSurfaceSpec* spec; if (IsSurfaceValid(mir_window) < 0) return; - MIR_mir_surface_set_state(mir_window->surface, mir_surface_state_maximized); + spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); + MIR_mir_surface_spec_set_state(spec, mir_surface_state_maximized); + + MIR_mir_surface_apply_spec(mir_window->surface, spec); + MIR_mir_surface_spec_release(spec); } void MIR_MinimizeWindow(_THIS, SDL_Window* window) { + MIR_Data* mir_data = _this->driverdata; MIR_Window* mir_window = window->driverdata; + MirSurfaceSpec* spec; if (IsSurfaceValid(mir_window) < 0) return; - MIR_mir_surface_set_state(mir_window->surface, mir_surface_state_minimized); + spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); + MIR_mir_surface_spec_set_state(spec, mir_surface_state_minimized); + + MIR_mir_surface_apply_spec(mir_window->surface, spec); + MIR_mir_surface_spec_release(spec); } void MIR_RestoreWindow(_THIS, SDL_Window * window) { + MIR_Data* mir_data = _this->driverdata; MIR_Window* mir_window = window->driverdata; + MirSurfaceSpec* spec; if (IsSurfaceValid(mir_window) < 0) return; - MIR_mir_surface_set_state(mir_window->surface, mir_surface_state_restored); + spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); + MIR_mir_surface_spec_set_state(spec, mir_surface_state_restored); + + MIR_mir_surface_apply_spec(mir_window->surface, spec); + MIR_mir_surface_spec_release(spec); +} + +void +MIR_HideWindow(_THIS, SDL_Window* window) +{ + MIR_Data* mir_data = _this->driverdata; + MIR_Window* mir_window = window->driverdata; + MirSurfaceSpec* spec; + + if (IsSurfaceValid(mir_window) < 0) + return; + + spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); + MIR_mir_surface_spec_set_state(spec, mir_surface_state_hidden); + + MIR_mir_surface_apply_spec(mir_window->surface, spec); + MIR_mir_surface_spec_release(spec); +} + +void +MIR_SetWindowSize(_THIS, SDL_Window* window) +{ + MIR_Data* mir_data = _this->driverdata; + MIR_Window* mir_window = window->driverdata; + MirSurfaceSpec* spec; + + if (IsSurfaceValid(mir_window) < 0) + return; + + /* You cannot set the x/y of a mir window! So only update w/h */ + spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); + MIR_mir_surface_spec_set_width (spec, window->w); + MIR_mir_surface_spec_set_height(spec, window->h); + + MIR_mir_surface_apply_spec(mir_window->surface, spec); + MIR_mir_surface_spec_release(spec); +} + +void +MIR_SetWindowMinimumSize(_THIS, SDL_Window* window) +{ + MIR_Data* mir_data = _this->driverdata; + MIR_Window* mir_window = window->driverdata; + MirSurfaceSpec* spec; + + if (IsSurfaceValid(mir_window) < 0) + return; + + spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); + MIR_mir_surface_spec_set_min_width (spec, window->min_w); + MIR_mir_surface_spec_set_min_height(spec, window->min_h); + + MIR_mir_surface_apply_spec(mir_window->surface, spec); + MIR_mir_surface_spec_release(spec); +} + +void +MIR_SetWindowMaximumSize(_THIS, SDL_Window* window) +{ + MIR_Data* mir_data = _this->driverdata; + MIR_Window* mir_window = window->driverdata; + MirSurfaceSpec* spec; + + if (IsSurfaceValid(mir_window) < 0) + return; + + spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); + MIR_mir_surface_spec_set_max_width (spec, window->max_w); + MIR_mir_surface_spec_set_max_height(spec, window->max_h); + + MIR_mir_surface_apply_spec(mir_window->surface, spec); + MIR_mir_surface_spec_release(spec); +} + +void +MIR_SetWindowTitle(_THIS, SDL_Window* window) +{ + MIR_Data* mir_data = _this->driverdata; + MIR_Window* mir_window = window->driverdata; + char const* title = window->title ? window->title : ""; + MirSurfaceSpec* spec; + + if (IsSurfaceValid(mir_window) < 0) + return; + + spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); + MIR_mir_surface_spec_set_name(spec, title); + + MIR_mir_surface_apply_spec(mir_window->surface, spec); + MIR_mir_surface_spec_release(spec); } #endif /* SDL_VIDEO_DRIVER_MIR */ diff --git a/libs/SDL2/src/video/mir/SDL_mirwindow.h b/libs/SDL2/src/video/mir/SDL_mirwindow.h index 577dfa41..4ba5869f 100644 --- a/libs/SDL2/src/video/mir/SDL_mirwindow.h +++ b/libs/SDL2/src/video/mir/SDL_mirwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,13 +31,13 @@ #include "SDL_mirvideo.h" -typedef struct { +struct MIR_Window { SDL_Window* sdl_window; - MIR_Data* mir_data; + MIR_Data* mir_data; MirSurface* surface; - EGLSurface egl_surface; -} MIR_Window; + EGLSurface egl_surface; +}; extern int @@ -60,9 +60,24 @@ MIR_MinimizeWindow(_THIS, SDL_Window* window); extern void MIR_RestoreWindow(_THIS, SDL_Window* window); +extern void +MIR_HideWindow(_THIS, SDL_Window* window); + extern SDL_bool MIR_GetWindowWMInfo(_THIS, SDL_Window* window, SDL_SysWMinfo* info); +extern void +MIR_SetWindowSize(_THIS, SDL_Window* window); + +extern void +MIR_SetWindowMinimumSize(_THIS, SDL_Window* window); + +extern void +MIR_SetWindowMaximumSize(_THIS, SDL_Window* window); + +extern void +MIR_SetWindowTitle(_THIS, SDL_Window* window); + #endif /* _SDL_mirwindow_h */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/nacl/SDL_naclevents.c b/libs/SDL2/src/video/nacl/SDL_naclevents.c index c552abb8..d6ebbdf8 100644 --- a/libs/SDL2/src/video/nacl/SDL_naclevents.c +++ b/libs/SDL2/src/video/nacl/SDL_naclevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/nacl/SDL_naclevents_c.h b/libs/SDL2/src/video/nacl/SDL_naclevents_c.h index 5fa6f991..3255578c 100644 --- a/libs/SDL2/src/video/nacl/SDL_naclevents_c.h +++ b/libs/SDL2/src/video/nacl/SDL_naclevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/nacl/SDL_naclglue.c b/libs/SDL2/src/video/nacl/SDL_naclglue.c index 127494e9..79f5b0f9 100644 --- a/libs/SDL2/src/video/nacl/SDL_naclglue.c +++ b/libs/SDL2/src/video/nacl/SDL_naclglue.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/nacl/SDL_naclopengles.c b/libs/SDL2/src/video/nacl/SDL_naclopengles.c index 349d4bbd..e1124513 100644 --- a/libs/SDL2/src/video/nacl/SDL_naclopengles.c +++ b/libs/SDL2/src/video/nacl/SDL_naclopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/nacl/SDL_naclopengles.h b/libs/SDL2/src/video/nacl/SDL_naclopengles.h index bcbca7db..1845e819 100644 --- a/libs/SDL2/src/video/nacl/SDL_naclopengles.h +++ b/libs/SDL2/src/video/nacl/SDL_naclopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/nacl/SDL_naclvideo.c b/libs/SDL2/src/video/nacl/SDL_naclvideo.c index e9d014c8..467155c6 100644 --- a/libs/SDL2/src/video/nacl/SDL_naclvideo.c +++ b/libs/SDL2/src/video/nacl/SDL_naclvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/nacl/SDL_naclvideo.h b/libs/SDL2/src/video/nacl/SDL_naclvideo.h index d9dc1630..174a6e77 100644 --- a/libs/SDL2/src/video/nacl/SDL_naclvideo.h +++ b/libs/SDL2/src/video/nacl/SDL_naclvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/nacl/SDL_naclwindow.c b/libs/SDL2/src/video/nacl/SDL_naclwindow.c index 73c70337..32d1e6d7 100644 --- a/libs/SDL2/src/video/nacl/SDL_naclwindow.c +++ b/libs/SDL2/src/video/nacl/SDL_naclwindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/nacl/SDL_naclwindow.h b/libs/SDL2/src/video/nacl/SDL_naclwindow.h index 3d6f375b..617bfc3a 100644 --- a/libs/SDL2/src/video/nacl/SDL_naclwindow.h +++ b/libs/SDL2/src/video/nacl/SDL_naclwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/pandora/SDL_pandora.c b/libs/SDL2/src/video/pandora/SDL_pandora.c index 2a0f4dcc..d1c35a70 100644 --- a/libs/SDL2/src/video/pandora/SDL_pandora.c +++ b/libs/SDL2/src/video/pandora/SDL_pandora.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/pandora/SDL_pandora.h b/libs/SDL2/src/video/pandora/SDL_pandora.h index 2dbbb2a9..b95cd10b 100644 --- a/libs/SDL2/src/video/pandora/SDL_pandora.h +++ b/libs/SDL2/src/video/pandora/SDL_pandora.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/pandora/SDL_pandora_events.c b/libs/SDL2/src/video/pandora/SDL_pandora_events.c index f42e0b71..d22d0c75 100644 --- a/libs/SDL2/src/video/pandora/SDL_pandora_events.c +++ b/libs/SDL2/src/video/pandora/SDL_pandora_events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/pandora/SDL_pandora_events.h b/libs/SDL2/src/video/pandora/SDL_pandora_events.h index c4313779..e9f8d7cf 100644 --- a/libs/SDL2/src/video/pandora/SDL_pandora_events.h +++ b/libs/SDL2/src/video/pandora/SDL_pandora_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/psp/SDL_pspevents.c b/libs/SDL2/src/video/psp/SDL_pspevents.c index 7117b50a..c1a095db 100644 --- a/libs/SDL2/src/video/psp/SDL_pspevents.c +++ b/libs/SDL2/src/video/psp/SDL_pspevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/psp/SDL_pspevents_c.h b/libs/SDL2/src/video/psp/SDL_pspevents_c.h index 9e24b6ba..e1929d23 100644 --- a/libs/SDL2/src/video/psp/SDL_pspevents_c.h +++ b/libs/SDL2/src/video/psp/SDL_pspevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/psp/SDL_pspgl.c b/libs/SDL2/src/video/psp/SDL_pspgl.c index f0fa7c3f..e4f81e9e 100644 --- a/libs/SDL2/src/video/psp/SDL_pspgl.c +++ b/libs/SDL2/src/video/psp/SDL_pspgl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/psp/SDL_pspgl_c.h b/libs/SDL2/src/video/psp/SDL_pspgl_c.h index 03b7a8c2..308b0272 100644 --- a/libs/SDL2/src/video/psp/SDL_pspgl_c.h +++ b/libs/SDL2/src/video/psp/SDL_pspgl_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/psp/SDL_pspmouse.c b/libs/SDL2/src/video/psp/SDL_pspmouse.c index 14c69dee..b7c3d2b9 100644 --- a/libs/SDL2/src/video/psp/SDL_pspmouse.c +++ b/libs/SDL2/src/video/psp/SDL_pspmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/psp/SDL_pspmouse_c.h b/libs/SDL2/src/video/psp/SDL_pspmouse_c.h index de5ff4ef..2a3df68e 100644 --- a/libs/SDL2/src/video/psp/SDL_pspmouse_c.h +++ b/libs/SDL2/src/video/psp/SDL_pspmouse_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/psp/SDL_pspvideo.c b/libs/SDL2/src/video/psp/SDL_pspvideo.c index cfcf0cff..95566687 100644 --- a/libs/SDL2/src/video/psp/SDL_pspvideo.c +++ b/libs/SDL2/src/video/psp/SDL_pspvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/psp/SDL_pspvideo.h b/libs/SDL2/src/video/psp/SDL_pspvideo.h index e468c2dd..f5705a94 100644 --- a/libs/SDL2/src/video/psp/SDL_pspvideo.h +++ b/libs/SDL2/src/video/psp/SDL_pspvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/raspberry/SDL_rpievents.c b/libs/SDL2/src/video/raspberry/SDL_rpievents.c index 12760a86..4104568c 100644 --- a/libs/SDL2/src/video/raspberry/SDL_rpievents.c +++ b/libs/SDL2/src/video/raspberry/SDL_rpievents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/raspberry/SDL_rpievents_c.h b/libs/SDL2/src/video/raspberry/SDL_rpievents_c.h index adc2fdd7..54fc196e 100644 --- a/libs/SDL2/src/video/raspberry/SDL_rpievents_c.h +++ b/libs/SDL2/src/video/raspberry/SDL_rpievents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/raspberry/SDL_rpimouse.c b/libs/SDL2/src/video/raspberry/SDL_rpimouse.c index f8ee4ec6..065f2097 100644 --- a/libs/SDL2/src/video/raspberry/SDL_rpimouse.c +++ b/libs/SDL2/src/video/raspberry/SDL_rpimouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -70,7 +70,16 @@ RPI_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y) SDL_assert(surface->pitch == surface->w * 4); cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor)); + if (cursor == NULL) { + SDL_OutOfMemory(); + return NULL; + } curdata = (RPI_CursorData *) SDL_calloc(1, sizeof(*curdata)); + if (curdata == NULL) { + SDL_OutOfMemory(); + SDL_free(cursor); + return NULL; + } curdata->hot_x = hot_x; curdata->hot_y = hot_y; diff --git a/libs/SDL2/src/video/raspberry/SDL_rpimouse.h b/libs/SDL2/src/video/raspberry/SDL_rpimouse.h index db8df76f..6a4e7051 100644 --- a/libs/SDL2/src/video/raspberry/SDL_rpimouse.h +++ b/libs/SDL2/src/video/raspberry/SDL_rpimouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/raspberry/SDL_rpiopengles.c b/libs/SDL2/src/video/raspberry/SDL_rpiopengles.c index 4809c925..0881dbde 100644 --- a/libs/SDL2/src/video/raspberry/SDL_rpiopengles.c +++ b/libs/SDL2/src/video/raspberry/SDL_rpiopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/raspberry/SDL_rpiopengles.h b/libs/SDL2/src/video/raspberry/SDL_rpiopengles.h index 5dda45d5..83c80006 100644 --- a/libs/SDL2/src/video/raspberry/SDL_rpiopengles.h +++ b/libs/SDL2/src/video/raspberry/SDL_rpiopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/raspberry/SDL_rpivideo.c b/libs/SDL2/src/video/raspberry/SDL_rpivideo.c index fae9143b..539c88c9 100644 --- a/libs/SDL2/src/video/raspberry/SDL_rpivideo.c +++ b/libs/SDL2/src/video/raspberry/SDL_rpivideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/raspberry/SDL_rpivideo.h b/libs/SDL2/src/video/raspberry/SDL_rpivideo.h index 648254c8..74dcf941 100644 --- a/libs/SDL2/src/video/raspberry/SDL_rpivideo.h +++ b/libs/SDL2/src/video/raspberry/SDL_rpivideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/sdlgenblit.pl b/libs/SDL2/src/video/sdlgenblit.pl index 202c6c22..9ebffafc 100755 --- a/libs/SDL2/src/video/sdlgenblit.pl +++ b/libs/SDL2/src/video/sdlgenblit.pl @@ -92,7 +92,7 @@ sub open_file { /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitappdelegate.h b/libs/SDL2/src/video/uikit/SDL_uikitappdelegate.h index 9f3c9854..1879f0b3 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitappdelegate.h +++ b/libs/SDL2/src/video/uikit/SDL_uikitappdelegate.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitappdelegate.m b/libs/SDL2/src/video/uikit/SDL_uikitappdelegate.m index 5d63019e..c175cf14 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitappdelegate.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitappdelegate.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -333,7 +333,6 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh) - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSBundle *bundle = [NSBundle mainBundle]; - NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; #if SDL_IPHONE_LAUNCHSCREEN /* The normal launch screen is displayed until didFinishLaunching returns, @@ -451,10 +450,11 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh) { NSURL *fileURL = url.filePathURL; if (fileURL != nil) { - SDL_SendDropFile([fileURL.path UTF8String]); + SDL_SendDropFile(NULL, [fileURL.path UTF8String]); } else { - SDL_SendDropFile([url.absoluteString UTF8String]); + SDL_SendDropFile(NULL, [url.absoluteString UTF8String]); } + SDL_SendDropComplete(NULL); return YES; } diff --git a/libs/SDL2/src/video/uikit/SDL_uikitclipboard.h b/libs/SDL2/src/video/uikit/SDL_uikitclipboard.h new file mode 100644 index 00000000..7d1c35f9 --- /dev/null +++ b/libs/SDL2/src/video/uikit/SDL_uikitclipboard.h @@ -0,0 +1,35 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2016 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#ifndef _SDL_uikitclipboard_h +#define _SDL_uikitclipboard_h + +#include "../SDL_sysvideo.h" + +extern int UIKit_SetClipboardText(_THIS, const char *text); +extern char *UIKit_GetClipboardText(_THIS); +extern SDL_bool UIKit_HasClipboardText(_THIS); + +extern void UIKit_InitClipboard(_THIS); +extern void UIKit_QuitClipboard(_THIS); + +#endif /* _SDL_uikitclipboard_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/uikit/SDL_uikitclipboard.m b/libs/SDL2/src/video/uikit/SDL_uikitclipboard.m new file mode 100644 index 00000000..59fe64fa --- /dev/null +++ b/libs/SDL2/src/video/uikit/SDL_uikitclipboard.m @@ -0,0 +1,99 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2016 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_UIKIT + +#include "SDL_uikitvideo.h" +#include "../../events/SDL_clipboardevents_c.h" + +#import + +int +UIKit_SetClipboardText(_THIS, const char *text) +{ + @autoreleasepool { + [UIPasteboard generalPasteboard].string = @(text); + return 0; + } +} + +char * +UIKit_GetClipboardText(_THIS) +{ + @autoreleasepool { + UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; + NSString *string = pasteboard.string; + + if (string != nil) { + return SDL_strdup(string.UTF8String); + } else { + return SDL_strdup(""); + } + } +} + +SDL_bool +UIKit_HasClipboardText(_THIS) +{ + @autoreleasepool { + if ([UIPasteboard generalPasteboard].string != nil) { + return SDL_TRUE; + } + return SDL_FALSE; + } +} + +void +UIKit_InitClipboard(_THIS) +{ + @autoreleasepool { + SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata; + NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; + + id observer = [center addObserverForName:UIPasteboardChangedNotification + object:nil + queue:nil + usingBlock:^(NSNotification *note) { + SDL_SendClipboardUpdate(); + }]; + + data.pasteboardObserver = observer; + } +} + +void +UIKit_QuitClipboard(_THIS) +{ + @autoreleasepool { + SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata; + + if (data.pasteboardObserver != nil) { + [[NSNotificationCenter defaultCenter] removeObserver:data.pasteboardObserver]; + } + + data.pasteboardObserver = nil; + } +} + +#endif /* SDL_VIDEO_DRIVER_UIKIT */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/uikit/SDL_uikitevents.h b/libs/SDL2/src/video/uikit/SDL_uikitevents.h index 63eeb955..9b1d60c5 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitevents.h +++ b/libs/SDL2/src/video/uikit/SDL_uikitevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitevents.m b/libs/SDL2/src/video/uikit/SDL_uikitevents.m index d4d6fcc4..1d7044d8 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitevents.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitevents.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitmessagebox.h b/libs/SDL2/src/video/uikit/SDL_uikitmessagebox.h index 2f38ac0d..52807241 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitmessagebox.h +++ b/libs/SDL2/src/video/uikit/SDL_uikitmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitmessagebox.m b/libs/SDL2/src/video/uikit/SDL_uikitmessagebox.m index 6c980d47..5778032a 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitmessagebox.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitmessagebox.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitmodes.h b/libs/SDL2/src/video/uikit/SDL_uikitmodes.h index 86bf3b2e..b936df61 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitmodes.h +++ b/libs/SDL2/src/video/uikit/SDL_uikitmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -43,6 +43,7 @@ extern int UIKit_InitModes(_THIS); extern void UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay * display); extern int UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); extern void UIKit_QuitModes(_THIS); +extern int UIKit_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); #endif /* _SDL_uikitmodes_h */ diff --git a/libs/SDL2/src/video/uikit/SDL_uikitmodes.m b/libs/SDL2/src/video/uikit/SDL_uikitmodes.m index afe6a957..a54bfd0c 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitmodes.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitmodes.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -242,6 +242,26 @@ UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) return 0; } +int +UIKit_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) +{ + /* the default function iterates displays to make a fake offset, + as if all the displays were side-by-side, which is fine for iOS. */ + const int displayIndex = (int) (display - _this->displays); + if (SDL_GetDisplayBounds(displayIndex, rect) < 0) { + return -1; + } + + SDL_DisplayData *data = (__bridge SDL_DisplayData *) display->driverdata; + const CGRect frame = [data.uiscreen applicationFrame]; + const float scale = (float) data.uiscreen.scale; + rect->x += (int) (frame.origin.x * scale); + rect->y += (int) (frame.origin.y * scale); + rect->w = (int) (frame.size.width * scale); + rect->h = (int) (frame.size.height * scale); + return 0; +} + void UIKit_QuitModes(_THIS) { diff --git a/libs/SDL2/src/video/uikit/SDL_uikitopengles.h b/libs/SDL2/src/video/uikit/SDL_uikitopengles.h index aa6bc75d..10697610 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitopengles.h +++ b/libs/SDL2/src/video/uikit/SDL_uikitopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitopengles.m b/libs/SDL2/src/video/uikit/SDL_uikitopengles.m index ef901247..a2ea4ab6 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitopengles.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitopengles.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitopenglview.h b/libs/SDL2/src/video/uikit/SDL_uikitopenglview.h index c710813d..86fb5e12 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitopenglview.h +++ b/libs/SDL2/src/video/uikit/SDL_uikitopenglview.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitopenglview.m b/libs/SDL2/src/video/uikit/SDL_uikitopenglview.m index acfdb28f..60c247e6 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitopenglview.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitopenglview.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitvideo.h b/libs/SDL2/src/video/uikit/SDL_uikitvideo.h index 5eacd807..836cf18d 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitvideo.h +++ b/libs/SDL2/src/video/uikit/SDL_uikitvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,6 +25,12 @@ #include "../SDL_sysvideo.h" +@interface SDL_VideoData : NSObject + +@property (nonatomic) id pasteboardObserver; + +@end + void UIKit_SuspendScreenSaver(_THIS); BOOL UIKit_IsSystemVersionAtLeast(double version); diff --git a/libs/SDL2/src/video/uikit/SDL_uikitvideo.m b/libs/SDL2/src/video/uikit/SDL_uikitvideo.m index 3847de71..045a74bc 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitvideo.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitvideo.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,9 +36,14 @@ #include "SDL_uikitmodes.h" #include "SDL_uikitwindow.h" #include "SDL_uikitopengles.h" +#include "SDL_uikitclipboard.h" #define UIKITVID_DRIVER_NAME "uikit" +@implementation SDL_VideoData + +@end + /* Initialization/Query functions */ static int UIKit_VideoInit(_THIS); static void UIKit_VideoQuit(_THIS); @@ -53,60 +58,75 @@ UIKit_Available(void) static void UIKit_DeleteDevice(SDL_VideoDevice * device) { - SDL_free(device); + @autoreleasepool { + CFRelease(device->driverdata); + SDL_free(device); + } } static SDL_VideoDevice * UIKit_CreateDevice(int devindex) { - SDL_VideoDevice *device; + @autoreleasepool { + SDL_VideoDevice *device; + SDL_VideoData *data; - /* Initialize all variables that we clean on shutdown */ - device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (!device) { - SDL_free(device); - SDL_OutOfMemory(); - return (0); + /* Initialize all variables that we clean on shutdown */ + device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); + if (device) { + data = [SDL_VideoData new]; + } else { + SDL_free(device); + SDL_OutOfMemory(); + return (0); + } + + device->driverdata = (void *) CFBridgingRetain(data); + + /* Set the function pointers */ + device->VideoInit = UIKit_VideoInit; + device->VideoQuit = UIKit_VideoQuit; + device->GetDisplayModes = UIKit_GetDisplayModes; + device->SetDisplayMode = UIKit_SetDisplayMode; + device->PumpEvents = UIKit_PumpEvents; + device->SuspendScreenSaver = UIKit_SuspendScreenSaver; + device->CreateWindow = UIKit_CreateWindow; + device->SetWindowTitle = UIKit_SetWindowTitle; + device->ShowWindow = UIKit_ShowWindow; + device->HideWindow = UIKit_HideWindow; + device->RaiseWindow = UIKit_RaiseWindow; + device->SetWindowBordered = UIKit_SetWindowBordered; + device->SetWindowFullscreen = UIKit_SetWindowFullscreen; + device->DestroyWindow = UIKit_DestroyWindow; + device->GetWindowWMInfo = UIKit_GetWindowWMInfo; + device->GetDisplayUsableBounds = UIKit_GetDisplayUsableBounds; + + #if SDL_IPHONE_KEYBOARD + device->HasScreenKeyboardSupport = UIKit_HasScreenKeyboardSupport; + device->ShowScreenKeyboard = UIKit_ShowScreenKeyboard; + device->HideScreenKeyboard = UIKit_HideScreenKeyboard; + device->IsScreenKeyboardShown = UIKit_IsScreenKeyboardShown; + device->SetTextInputRect = UIKit_SetTextInputRect; + #endif + + device->SetClipboardText = UIKit_SetClipboardText; + device->GetClipboardText = UIKit_GetClipboardText; + device->HasClipboardText = UIKit_HasClipboardText; + + /* OpenGL (ES) functions */ + device->GL_MakeCurrent = UIKit_GL_MakeCurrent; + device->GL_GetDrawableSize = UIKit_GL_GetDrawableSize; + device->GL_SwapWindow = UIKit_GL_SwapWindow; + device->GL_CreateContext = UIKit_GL_CreateContext; + device->GL_DeleteContext = UIKit_GL_DeleteContext; + device->GL_GetProcAddress = UIKit_GL_GetProcAddress; + device->GL_LoadLibrary = UIKit_GL_LoadLibrary; + device->free = UIKit_DeleteDevice; + + device->gl_config.accelerated = 1; + + return device; } - - /* Set the function pointers */ - device->VideoInit = UIKit_VideoInit; - device->VideoQuit = UIKit_VideoQuit; - device->GetDisplayModes = UIKit_GetDisplayModes; - device->SetDisplayMode = UIKit_SetDisplayMode; - device->PumpEvents = UIKit_PumpEvents; - device->SuspendScreenSaver = UIKit_SuspendScreenSaver; - device->CreateWindow = UIKit_CreateWindow; - device->SetWindowTitle = UIKit_SetWindowTitle; - device->ShowWindow = UIKit_ShowWindow; - device->HideWindow = UIKit_HideWindow; - device->RaiseWindow = UIKit_RaiseWindow; - device->SetWindowBordered = UIKit_SetWindowBordered; - device->SetWindowFullscreen = UIKit_SetWindowFullscreen; - device->DestroyWindow = UIKit_DestroyWindow; - device->GetWindowWMInfo = UIKit_GetWindowWMInfo; - -#if SDL_IPHONE_KEYBOARD - device->HasScreenKeyboardSupport = UIKit_HasScreenKeyboardSupport; - device->ShowScreenKeyboard = UIKit_ShowScreenKeyboard; - device->HideScreenKeyboard = UIKit_HideScreenKeyboard; - device->IsScreenKeyboardShown = UIKit_IsScreenKeyboardShown; - device->SetTextInputRect = UIKit_SetTextInputRect; -#endif - - /* OpenGL (ES) functions */ - device->GL_MakeCurrent = UIKit_GL_MakeCurrent; - device->GL_GetDrawableSize = UIKit_GL_GetDrawableSize; - device->GL_SwapWindow = UIKit_GL_SwapWindow; - device->GL_CreateContext = UIKit_GL_CreateContext; - device->GL_DeleteContext = UIKit_GL_DeleteContext; - device->GL_GetProcAddress = UIKit_GL_GetProcAddress; - device->GL_LoadLibrary = UIKit_GL_LoadLibrary; - device->free = UIKit_DeleteDevice; - - device->gl_config.accelerated = 1; - - return device; } VideoBootStrap UIKIT_bootstrap = { diff --git a/libs/SDL2/src/video/uikit/SDL_uikitview.h b/libs/SDL2/src/video/uikit/SDL_uikitview.h index 00be7657..18fa78f3 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitview.h +++ b/libs/SDL2/src/video/uikit/SDL_uikitview.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitview.m b/libs/SDL2/src/video/uikit/SDL_uikitview.m index 4372cc20..1ccda98f 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitview.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitview.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.h b/libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.h index e8462b8e..458c684b 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.h +++ b/libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.h @@ -1,23 +1,23 @@ /* - Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Simple DirectMedia Layer + Copyright (C) 1997-2016 Sam Lantinga - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - */ + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ #import diff --git a/libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.m b/libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.m index 112638eb..58cdf1ac 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitwindow.h b/libs/SDL2/src/video/uikit/SDL_uikitwindow.h index 987bbe01..ed08c55d 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitwindow.h +++ b/libs/SDL2/src/video/uikit/SDL_uikitwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitwindow.m b/libs/SDL2/src/video/uikit/SDL_uikitwindow.m index 6826f825..c5f385b8 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitwindow.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitwindow.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/keyinfotable.h b/libs/SDL2/src/video/uikit/keyinfotable.h index 22a79dce..962dbd92 100644 --- a/libs/SDL2/src/video/uikit/keyinfotable.h +++ b/libs/SDL2/src/video/uikit/keyinfotable.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/vivante/SDL_vivanteopengles.c b/libs/SDL2/src/video/vivante/SDL_vivanteopengles.c index 96d2f89d..687cc6a7 100644 --- a/libs/SDL2/src/video/vivante/SDL_vivanteopengles.c +++ b/libs/SDL2/src/video/vivante/SDL_vivanteopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/vivante/SDL_vivanteopengles.h b/libs/SDL2/src/video/vivante/SDL_vivanteopengles.h index b7b61803..f47bf779 100644 --- a/libs/SDL2/src/video/vivante/SDL_vivanteopengles.h +++ b/libs/SDL2/src/video/vivante/SDL_vivanteopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/vivante/SDL_vivanteplatform.c b/libs/SDL2/src/video/vivante/SDL_vivanteplatform.c index 40579dfa..76233417 100644 --- a/libs/SDL2/src/video/vivante/SDL_vivanteplatform.c +++ b/libs/SDL2/src/video/vivante/SDL_vivanteplatform.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/vivante/SDL_vivanteplatform.h b/libs/SDL2/src/video/vivante/SDL_vivanteplatform.h index b8376283..6e11cce6 100644 --- a/libs/SDL2/src/video/vivante/SDL_vivanteplatform.h +++ b/libs/SDL2/src/video/vivante/SDL_vivanteplatform.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/vivante/SDL_vivantevideo.c b/libs/SDL2/src/video/vivante/SDL_vivantevideo.c index 8095cb58..cb1a2649 100644 --- a/libs/SDL2/src/video/vivante/SDL_vivantevideo.c +++ b/libs/SDL2/src/video/vivante/SDL_vivantevideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -366,12 +366,13 @@ VIVANTE_HideWindow(_THIS, SDL_Window * window) SDL_bool VIVANTE_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) { -/* SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_DisplayData *displaydata = SDL_GetDisplayDriverData(0); if (info->version.major == SDL_MAJOR_VERSION && info->version.minor == SDL_MINOR_VERSION) { info->subsystem = SDL_SYSWM_VIVANTE; + info->info.vivante.display = displaydata->native_display; info->info.vivante.window = data->native_window; return SDL_TRUE; } else { @@ -379,9 +380,6 @@ VIVANTE_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } -*/ - SDL_Unsupported(); - return SDL_FALSE; } /*****************************************************************************/ diff --git a/libs/SDL2/src/video/vivante/SDL_vivantevideo.h b/libs/SDL2/src/video/vivante/SDL_vivantevideo.h index 030516bd..b99c7337 100644 --- a/libs/SDL2/src/video/vivante/SDL_vivantevideo.h +++ b/libs/SDL2/src/video/vivante/SDL_vivantevideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/wayland/SDL_waylanddyn.c b/libs/SDL2/src/video/wayland/SDL_waylanddyn.c index edf6e219..14674fbe 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylanddyn.c +++ b/libs/SDL2/src/video/wayland/SDL_waylanddyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -94,9 +94,6 @@ WAYLAND_GetSym(const char *fnname, int *pHasModule) #define SDL_WAYLAND_SYM(rc,fn,params) SDL_DYNWAYLANDFN_##fn WAYLAND_##fn = NULL; #define SDL_WAYLAND_INTERFACE(iface) const struct wl_interface *WAYLAND_##iface = NULL; #include "SDL_waylandsym.h" -#undef SDL_WAYLAND_MODULE -#undef SDL_WAYLAND_SYM -#undef SDL_WAYLAND_INTERFACE static int wayland_load_refcount = 0; @@ -115,9 +112,6 @@ SDL_WAYLAND_UnloadSymbols(void) #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = NULL; #define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = NULL; #include "SDL_waylandsym.h" -#undef SDL_WAYLAND_MODULE -#undef SDL_WAYLAND_SYM -#undef SDL_WAYLAND_INTERFACE #ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC @@ -150,20 +144,12 @@ SDL_WAYLAND_LoadSymbols(void) } #define SDL_WAYLAND_MODULE(modname) SDL_WAYLAND_HAVE_##modname = 1; /* default yes */ -#define SDL_WAYLAND_SYM(rc,fn,params) -#define SDL_WAYLAND_INTERFACE(iface) #include "SDL_waylandsym.h" -#undef SDL_WAYLAND_MODULE -#undef SDL_WAYLAND_SYM -#undef SDL_WAYLAND_INTERFACE #define SDL_WAYLAND_MODULE(modname) thismod = &SDL_WAYLAND_HAVE_##modname; #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = (SDL_DYNWAYLANDFN_##fn) WAYLAND_GetSym(#fn,thismod); #define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = (struct wl_interface *) WAYLAND_GetSym(#iface,thismod); #include "SDL_waylandsym.h" -#undef SDL_WAYLAND_MODULE -#undef SDL_WAYLAND_SYM -#undef SDL_WAYLAND_INTERFACE if (SDL_WAYLAND_HAVE_WAYLAND_CLIENT) { /* all required symbols loaded. */ @@ -180,9 +166,6 @@ SDL_WAYLAND_LoadSymbols(void) #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn; #define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = &iface; #include "SDL_waylandsym.h" -#undef SDL_WAYLAND_MODULE -#undef SDL_WAYLAND_SYM -#undef SDL_WAYLAND_INTERFACE #endif } diff --git a/libs/SDL2/src/video/wayland/SDL_waylanddyn.h b/libs/SDL2/src/video/wayland/SDL_waylanddyn.h index 19fd4558..644f4c1b 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylanddyn.h +++ b/libs/SDL2/src/video/wayland/SDL_waylanddyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -53,10 +53,7 @@ void SDL_WAYLAND_UnloadSymbols(void); extern SDL_DYNWAYLANDFN_##fn WAYLAND_##fn; #define SDL_WAYLAND_INTERFACE(iface) extern const struct wl_interface *WAYLAND_##iface; #include "SDL_waylandsym.h" -#undef SDL_WAYLAND_MODULE -#undef SDL_WAYLAND_SYM -#undef SDL_WAYLAND_INTERFACE - + #ifdef __cplusplus } @@ -79,6 +76,7 @@ void SDL_WAYLAND_UnloadSymbols(void); #define wl_proxy_get_user_data (*WAYLAND_wl_proxy_get_user_data) #define wl_proxy_add_listener (*WAYLAND_wl_proxy_add_listener) #define wl_proxy_marshal_constructor (*WAYLAND_wl_proxy_marshal_constructor) +#define wl_proxy_marshal_constructor_versioned (*WAYLAND_wl_proxy_marshal_constructor_versioned) #define wl_seat_interface (*WAYLAND_wl_seat_interface) #define wl_surface_interface (*WAYLAND_wl_surface_interface) diff --git a/libs/SDL2/src/video/wayland/SDL_waylandevents.c b/libs/SDL2/src/video/wayland/SDL_waylandevents.c index face9d64..8a645c46 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandevents.c +++ b/libs/SDL2/src/video/wayland/SDL_waylandevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -302,9 +302,9 @@ keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, window = wl_surface_get_user_data(surface); - input->keyboard_focus = window; - window->keyboard_device = input; if (window) { + input->keyboard_focus = window; + window->keyboard_device = input; SDL_SetKeyboardFocus(window->sdlwindow); } } diff --git a/libs/SDL2/src/video/wayland/SDL_waylandevents_c.h b/libs/SDL2/src/video/wayland/SDL_waylandevents_c.h index 5a914e90..62b163bf 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandevents_c.h +++ b/libs/SDL2/src/video/wayland/SDL_waylandevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/wayland/SDL_waylandmouse.c b/libs/SDL2/src/video/wayland/SDL_waylandmouse.c index 2d78ebb9..8a8332cc 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandmouse.c +++ b/libs/SDL2/src/video/wayland/SDL_waylandmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -130,6 +130,7 @@ create_buffer_from_shm(Wayland_CursorData *d, d->shm_data = NULL; fprintf (stderr, "mmap () failed\n"); close (shm_fd); + return -1; } shm_pool = wl_shm_create_pool(data->shm, shm_fd, size); @@ -159,6 +160,11 @@ Wayland_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) SDL_VideoDevice *vd = SDL_GetVideoDevice (); SDL_VideoData *wd = (SDL_VideoData *) vd->driverdata; Wayland_CursorData *data = calloc (1, sizeof (Wayland_CursorData)); + if (!data) { + SDL_OutOfMemory(); + free(cursor); + return NULL; + } cursor->driverdata = (void *) data; /* Assume ARGB8888 */ @@ -169,7 +175,7 @@ Wayland_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) if (create_buffer_from_shm (data, surface->w, surface->h, - WL_SHM_FORMAT_XRGB8888) < 0) + WL_SHM_FORMAT_ARGB8888) < 0) { free (cursor->driverdata); free (cursor); @@ -187,6 +193,8 @@ Wayland_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) data->hot_y = hot_y; data->w = surface->w; data->h = surface->h; + } else { + SDL_OutOfMemory(); } return cursor; @@ -200,6 +208,11 @@ CreateCursorFromWlCursor(SDL_VideoData *d, struct wl_cursor *wlcursor) cursor = calloc(1, sizeof (*cursor)); if (cursor) { Wayland_CursorData *data = calloc (1, sizeof (Wayland_CursorData)); + if (!data) { + SDL_OutOfMemory(); + free(cursor); + return NULL; + } cursor->driverdata = (void *) data; data->buffer = WAYLAND_wl_cursor_image_get_buffer(wlcursor->images[0]); @@ -322,13 +335,13 @@ Wayland_ShowCursor(SDL_Cursor *cursor) { Wayland_CursorData *data = cursor->driverdata; - wl_surface_attach(data->surface, data->buffer, 0, 0); - wl_surface_damage(data->surface, 0, 0, data->w, data->h); - wl_surface_commit(data->surface); wl_pointer_set_cursor (pointer, 0, data->surface, data->hot_x, data->hot_y); + wl_surface_attach(data->surface, data->buffer, 0, 0); + wl_surface_damage(data->surface, 0, 0, data->w, data->h); + wl_surface_commit(data->surface); } else { diff --git a/libs/SDL2/src/video/wayland/SDL_waylandmouse.h b/libs/SDL2/src/video/wayland/SDL_waylandmouse.h index 3a914a28..129990de 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandmouse.h +++ b/libs/SDL2/src/video/wayland/SDL_waylandmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/wayland/SDL_waylandopengles.c b/libs/SDL2/src/video/wayland/SDL_waylandopengles.c index ca301e57..6803dbe6 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandopengles.c +++ b/libs/SDL2/src/video/wayland/SDL_waylandopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/wayland/SDL_waylandopengles.h b/libs/SDL2/src/video/wayland/SDL_waylandopengles.h index 42c13f84..6c3f1f38 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandopengles.h +++ b/libs/SDL2/src/video/wayland/SDL_waylandopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/wayland/SDL_waylandsym.h b/libs/SDL2/src/video/wayland/SDL_waylandsym.h index edac091f..aea3cb12 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandsym.h +++ b/libs/SDL2/src/video/wayland/SDL_waylandsym.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,6 +21,18 @@ /* *INDENT-OFF* */ +#ifndef SDL_WAYLAND_MODULE +#define SDL_WAYLAND_MODULE(modname) +#endif + +#ifndef SDL_WAYLAND_SYM +#define SDL_WAYLAND_SYM(rc,fn,params) +#endif + +#ifndef SDL_WAYLAND_INTERFACE +#define SDL_WAYLAND_INTERFACE(iface) +#endif + SDL_WAYLAND_MODULE(WAYLAND_CLIENT) SDL_WAYLAND_SYM(void, wl_proxy_marshal, (struct wl_proxy *, uint32_t, ...)) SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_create, (struct wl_proxy *, const struct wl_interface *)) @@ -55,6 +67,9 @@ SDL_WAYLAND_SYM(void, wl_list_insert_list, (struct wl_list *, struct wl_list *)) SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_4) SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_marshal_constructor, (struct wl_proxy *, uint32_t opcode, const struct wl_interface *interface, ...)) +SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_10) +SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_marshal_constructor_versioned, (struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interface, uint32_t version, ...)) + SDL_WAYLAND_INTERFACE(wl_seat_interface) SDL_WAYLAND_INTERFACE(wl_surface_interface) SDL_WAYLAND_INTERFACE(wl_shm_pool_interface) @@ -99,8 +114,10 @@ SDL_WAYLAND_SYM(enum xkb_state_component, xkb_state_update_mask, (struct xkb_sta xkb_layout_index_t latched_layout,\ xkb_layout_index_t locked_layout) ) +#undef SDL_WAYLAND_MODULE +#undef SDL_WAYLAND_SYM +#undef SDL_WAYLAND_INTERFACE /* *INDENT-ON* */ /* vi: set ts=4 sw=4 expandtab: */ -//SDL_WAYLAND_SYM(ret, fn, params) diff --git a/libs/SDL2/src/video/wayland/SDL_waylandtouch.c b/libs/SDL2/src/video/wayland/SDL_waylandtouch.c index 3aa8828d..4cae4259 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandtouch.c +++ b/libs/SDL2/src/video/wayland/SDL_waylandtouch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/wayland/SDL_waylandtouch.h b/libs/SDL2/src/video/wayland/SDL_waylandtouch.h index 8c0d2036..5f2a0581 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandtouch.h +++ b/libs/SDL2/src/video/wayland/SDL_waylandtouch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/wayland/SDL_waylandvideo.c b/libs/SDL2/src/video/wayland/SDL_waylandvideo.c index f509ddc1..45733fbd 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandvideo.c +++ b/libs/SDL2/src/video/wayland/SDL_waylandvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -253,7 +253,6 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id, } else if (strcmp(interface, "wl_shm") == 0) { d->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1); d->cursor_theme = WAYLAND_wl_cursor_theme_load(NULL, 32, d->shm); - d->default_cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "left_ptr"); #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH } else if (strcmp(interface, "qt_touch_extension") == 0) { diff --git a/libs/SDL2/src/video/wayland/SDL_waylandvideo.h b/libs/SDL2/src/video/wayland/SDL_waylandvideo.h index 6dc736a2..8744d363 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandvideo.h +++ b/libs/SDL2/src/video/wayland/SDL_waylandvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -42,7 +42,6 @@ typedef struct { struct wl_compositor *compositor; struct wl_shm *shm; struct wl_cursor_theme *cursor_theme; - struct wl_cursor *default_cursor; struct wl_pointer *pointer; struct wl_shell *shell; diff --git a/libs/SDL2/src/video/wayland/SDL_waylandwindow.c b/libs/SDL2/src/video/wayland/SDL_waylandwindow.c index e105408a..b59759a7 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandwindow.c +++ b/libs/SDL2/src/video/wayland/SDL_waylandwindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/wayland/SDL_waylandwindow.h b/libs/SDL2/src/video/wayland/SDL_waylandwindow.h index e2bed546..053b1281 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandwindow.h +++ b/libs/SDL2/src/video/wayland/SDL_waylandwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_msctf.h b/libs/SDL2/src/video/windows/SDL_msctf.h index c2368d7a..74e22f10 100644 --- a/libs/SDL2/src/video/windows/SDL_msctf.h +++ b/libs/SDL2/src/video/windows/SDL_msctf.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_vkeys.h b/libs/SDL2/src/video/windows/SDL_vkeys.h index 4c3d390d..fd652041 100644 --- a/libs/SDL2/src/video/windows/SDL_vkeys.h +++ b/libs/SDL2/src/video/windows/SDL_vkeys.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsclipboard.c b/libs/SDL2/src/video/windows/SDL_windowsclipboard.c index d93eceed..b57a66a7 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsclipboard.c +++ b/libs/SDL2/src/video/windows/SDL_windowsclipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsclipboard.h b/libs/SDL2/src/video/windows/SDL_windowsclipboard.h index 3b5e62b4..d86cd97e 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsclipboard.h +++ b/libs/SDL2/src/video/windows/SDL_windowsclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsevents.c b/libs/SDL2/src/video/windows/SDL_windowsevents.c index 9ca94bb5..ee08de1b 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsevents.c +++ b/libs/SDL2/src/video/windows/SDL_windowsevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -907,12 +907,13 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (buffer) { if (DragQueryFile(drop, i, buffer, size)) { char *file = WIN_StringToUTF8(buffer); - SDL_SendDropFile(file); + SDL_SendDropFile(data->window, file); SDL_free(file); } SDL_stack_free(buffer); } } + SDL_SendDropComplete(data->window); DragFinish(drop); return 0; } @@ -927,15 +928,17 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) const SDL_Point point = { (int) winpoint.x, (int) winpoint.y }; const SDL_HitTestResult rc = window->hit_test(window, &point, window->hit_test_data); switch (rc) { - case SDL_HITTEST_DRAGGABLE: return HTCAPTION; - case SDL_HITTEST_RESIZE_TOPLEFT: return HTTOPLEFT; - case SDL_HITTEST_RESIZE_TOP: return HTTOP; - case SDL_HITTEST_RESIZE_TOPRIGHT: return HTTOPRIGHT; - case SDL_HITTEST_RESIZE_RIGHT: return HTRIGHT; - case SDL_HITTEST_RESIZE_BOTTOMRIGHT: return HTBOTTOMRIGHT; - case SDL_HITTEST_RESIZE_BOTTOM: return HTBOTTOM; - case SDL_HITTEST_RESIZE_BOTTOMLEFT: return HTBOTTOMLEFT; - case SDL_HITTEST_RESIZE_LEFT: return HTLEFT; + #define POST_HIT_TEST(ret) { SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); return ret; } + case SDL_HITTEST_DRAGGABLE: POST_HIT_TEST(HTCAPTION); + case SDL_HITTEST_RESIZE_TOPLEFT: POST_HIT_TEST(HTTOPLEFT); + case SDL_HITTEST_RESIZE_TOP: POST_HIT_TEST(HTTOP); + case SDL_HITTEST_RESIZE_TOPRIGHT: POST_HIT_TEST(HTTOPRIGHT); + case SDL_HITTEST_RESIZE_RIGHT: POST_HIT_TEST(HTRIGHT); + case SDL_HITTEST_RESIZE_BOTTOMRIGHT: POST_HIT_TEST(HTBOTTOMRIGHT); + case SDL_HITTEST_RESIZE_BOTTOM: POST_HIT_TEST(HTBOTTOM); + case SDL_HITTEST_RESIZE_BOTTOMLEFT: POST_HIT_TEST(HTBOTTOMLEFT); + case SDL_HITTEST_RESIZE_LEFT: POST_HIT_TEST(HTLEFT); + #undef POST_HIT_TEST case SDL_HITTEST_NORMAL: return HTCLIENT; } } diff --git a/libs/SDL2/src/video/windows/SDL_windowsevents.h b/libs/SDL2/src/video/windows/SDL_windowsevents.h index 3e923aab..dcd3118a 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsevents.h +++ b/libs/SDL2/src/video/windows/SDL_windowsevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsframebuffer.c b/libs/SDL2/src/video/windows/SDL_windowsframebuffer.c index 122f3d06..7bb07ed2 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsframebuffer.c +++ b/libs/SDL2/src/video/windows/SDL_windowsframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsframebuffer.h b/libs/SDL2/src/video/windows/SDL_windowsframebuffer.h index ed6837ba..0c825f9d 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsframebuffer.h +++ b/libs/SDL2/src/video/windows/SDL_windowsframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowskeyboard.c b/libs/SDL2/src/video/windows/SDL_windowskeyboard.c index 1db8bbcd..d3e16c8b 100644 --- a/libs/SDL2/src/video/windows/SDL_windowskeyboard.c +++ b/libs/SDL2/src/video/windows/SDL_windowskeyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowskeyboard.h b/libs/SDL2/src/video/windows/SDL_windowskeyboard.h index 5967b511..d330d387 100644 --- a/libs/SDL2/src/video/windows/SDL_windowskeyboard.h +++ b/libs/SDL2/src/video/windows/SDL_windowskeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsmessagebox.c b/libs/SDL2/src/video/windows/SDL_windowsmessagebox.c index ac4a3a5a..b39df32f 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsmessagebox.c +++ b/libs/SDL2/src/video/windows/SDL_windowsmessagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsmessagebox.h b/libs/SDL2/src/video/windows/SDL_windowsmessagebox.h index 37f9f4cb..e9c69254 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsmessagebox.h +++ b/libs/SDL2/src/video/windows/SDL_windowsmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsmodes.c b/libs/SDL2/src/video/windows/SDL_windowsmodes.c index 7cb4ea5b..1c1a0f6c 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsmodes.c +++ b/libs/SDL2/src/video/windows/SDL_windowsmodes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,6 +23,7 @@ #if SDL_VIDEO_DRIVER_WINDOWS #include "SDL_windowsvideo.h" +#include "../../../include/SDL_assert.h" /* Windows CE compatibility */ #ifndef CDS_FULLSCREEN @@ -69,40 +70,16 @@ WIN_GetMonitorDPI(HMONITOR hMonitor, return TRUE; } -static SDL_bool -WIN_GetDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode) +static void +WIN_UpdateDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode) { SDL_VideoData *vid_data = (SDL_VideoData *) _this->driverdata; - SDL_DisplayModeData *data; - DEVMODE devmode; + SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata; HDC hdc; - devmode.dmSize = sizeof(devmode); - devmode.dmDriverExtra = 0; - if (!EnumDisplaySettings(deviceName, index, &devmode)) { - return SDL_FALSE; - } - - data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data)); - if (!data) { - return SDL_FALSE; - } - data->DeviceMode = devmode; data->DeviceMode.dmFields = (DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY | DM_DISPLAYFLAGS); - data->ScaleX = 1.0f; - data->ScaleY = 1.0f; - data->DiagDPI = 0.0f; - data->HorzDPI = 0.0f; - data->VertDPI = 0.0f; - - /* Fill in the mode information */ - mode->format = SDL_PIXELFORMAT_UNKNOWN; - mode->w = devmode.dmPelsWidth; - mode->h = devmode.dmPelsHeight; - mode->refresh_rate = devmode.dmDisplayFrequency; - mode->driverdata = data; if (index == ENUM_CURRENT_SETTINGS && (hdc = CreateDC(deviceName, NULL, NULL, NULL)) != NULL) { @@ -112,8 +89,8 @@ WIN_GetDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mod int logical_width = GetDeviceCaps( hdc, HORZRES ); int logical_height = GetDeviceCaps( hdc, VERTRES ); - data->ScaleX = (float)logical_width / devmode.dmPelsWidth; - data->ScaleY = (float)logical_height / devmode.dmPelsHeight; + data->ScaleX = (float)logical_width / data->DeviceMode.dmPelsWidth; + data->ScaleY = (float)logical_height / data->DeviceMode.dmPelsHeight; mode->w = logical_width; mode->h = logical_height; @@ -126,8 +103,8 @@ WIN_GetDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mod dpi_data.vid_data = vid_data; dpi_data.mode = mode; dpi_data.mode_data = data; - monitor_rect.left = devmode.dmPosition.x; - monitor_rect.top = devmode.dmPosition.y; + monitor_rect.left = data->DeviceMode.dmPosition.x; + monitor_rect.top = data->DeviceMode.dmPosition.y; monitor_rect.right = monitor_rect.left + 1; monitor_rect.bottom = monitor_rect.top + 1; EnumDisplayMonitors(NULL, &monitor_rect, WIN_GetMonitorDPI, (LPARAM)&dpi_data); @@ -175,10 +152,10 @@ WIN_GetDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mod } else if (bmi->bmiHeader.biBitCount == 4) { mode->format = SDL_PIXELFORMAT_INDEX4LSB; } - } else { + } else if (mode->format == SDL_PIXELFORMAT_UNKNOWN) { /* FIXME: Can we tell what this will be? */ - if ((devmode.dmFields & DM_BITSPERPEL) == DM_BITSPERPEL) { - switch (devmode.dmBitsPerPel) { + if ((data->DeviceMode.dmFields & DM_BITSPERPEL) == DM_BITSPERPEL) { + switch (data->DeviceMode.dmBitsPerPel) { case 32: mode->format = SDL_PIXELFORMAT_RGB888; break; @@ -200,6 +177,42 @@ WIN_GetDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mod } } } +} + +static SDL_bool +WIN_GetDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode) +{ + SDL_DisplayModeData *data; + DEVMODE devmode; + + devmode.dmSize = sizeof(devmode); + devmode.dmDriverExtra = 0; + if (!EnumDisplaySettings(deviceName, index, &devmode)) { + return SDL_FALSE; + } + + data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data)); + if (!data) { + return SDL_FALSE; + } + + mode->driverdata = data; + data->DeviceMode = devmode; + + /* Default basic information */ + data->ScaleX = 1.0f; + data->ScaleY = 1.0f; + data->DiagDPI = 0.0f; + data->HorzDPI = 0.0f; + data->VertDPI = 0.0f; + + mode->format = SDL_PIXELFORMAT_UNKNOWN; + mode->w = data->DeviceMode.dmPelsWidth; + mode->h = data->DeviceMode.dmPelsHeight; + mode->refresh_rate = data->DeviceMode.dmDisplayFrequency; + + /* Fill in the mode information */ + WIN_UpdateDisplayMode(_this, deviceName, index, mode); return SDL_TRUE; } @@ -332,6 +345,43 @@ WIN_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, return data->DiagDPI != 0.0f ? 0 : -1; } +int +WIN_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) +{ + const SDL_DisplayModeData *data = (const SDL_DisplayModeData *) display->current_mode.driverdata; + const DEVMODE *pDevMode = &data->DeviceMode; + POINT pt = { + /* !!! FIXME: no scale, right? */ + (LONG) (pDevMode->dmPosition.x + (pDevMode->dmPelsWidth / 2)), + (LONG) (pDevMode->dmPosition.y + (pDevMode->dmPelsHeight / 2)) + }; + HMONITOR hmon = MonitorFromPoint(pt, MONITOR_DEFAULTTONULL); + MONITORINFO minfo; + const RECT *work; + BOOL rc = FALSE; + + SDL_assert(hmon != NULL); + + if (hmon != NULL) { + SDL_zero(minfo); + minfo.cbSize = sizeof (MONITORINFO); + rc = GetMonitorInfo(hmon, &minfo); + SDL_assert(rc); + } + + if (!rc) { + return SDL_SetError("Couldn't find monitor data"); + } + + work = &minfo.rcWork; + rect->x = (int)SDL_ceil(work->left * data->ScaleX); + rect->y = (int)SDL_ceil(work->top * data->ScaleY); + rect->w = (int)SDL_ceil((work->right - work->left) * data->ScaleX); + rect->h = (int)SDL_ceil((work->bottom - work->top) * data->ScaleY); + + return 0; +} + void WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display) { @@ -389,6 +439,7 @@ WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) return SDL_SetError("ChangeDisplaySettingsEx() failed: %s", reason); } EnumDisplaySettings(displaydata->DeviceName, ENUM_CURRENT_SETTINGS, &data->DeviceMode); + WIN_UpdateDisplayMode(_this, displaydata->DeviceName, ENUM_CURRENT_SETTINGS, mode); return 0; } diff --git a/libs/SDL2/src/video/windows/SDL_windowsmodes.h b/libs/SDL2/src/video/windows/SDL_windowsmodes.h index 2bf9f4c8..6aa293d2 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsmodes.h +++ b/libs/SDL2/src/video/windows/SDL_windowsmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,6 +40,7 @@ typedef struct extern int WIN_InitModes(_THIS); extern int WIN_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); +extern int WIN_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); extern int WIN_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi); extern void WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display); extern int WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); diff --git a/libs/SDL2/src/video/windows/SDL_windowsmouse.c b/libs/SDL2/src/video/windows/SDL_windowsmouse.c index 69aa7771..72d7892d 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsmouse.c +++ b/libs/SDL2/src/video/windows/SDL_windowsmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsmouse.h b/libs/SDL2/src/video/windows/SDL_windowsmouse.h index d3d8f634..60672e6b 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsmouse.h +++ b/libs/SDL2/src/video/windows/SDL_windowsmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsopengl.c b/libs/SDL2/src/video/windows/SDL_windowsopengl.c index fc1921f5..d30d838f 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsopengl.c +++ b/libs/SDL2/src/video/windows/SDL_windowsopengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsopengl.h b/libs/SDL2/src/video/windows/SDL_windowsopengl.h index 71c05db0..7b95cc8d 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsopengl.h +++ b/libs/SDL2/src/video/windows/SDL_windowsopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsopengles.c b/libs/SDL2/src/video/windows/SDL_windowsopengles.c index 9125da0e..f66cc088 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsopengles.c +++ b/libs/SDL2/src/video/windows/SDL_windowsopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsopengles.h b/libs/SDL2/src/video/windows/SDL_windowsopengles.h index f6342088..dbdf5f6a 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsopengles.h +++ b/libs/SDL2/src/video/windows/SDL_windowsopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsshape.c b/libs/SDL2/src/video/windows/SDL_windowsshape.c index 6c38ba1a..0a50985a 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsshape.c +++ b/libs/SDL2/src/video/windows/SDL_windowsshape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsshape.h b/libs/SDL2/src/video/windows/SDL_windowsshape.h index 568945c7..ddd8f49b 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsshape.h +++ b/libs/SDL2/src/video/windows/SDL_windowsshape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsvideo.c b/libs/SDL2/src/video/windows/SDL_windowsvideo.c index 86c3437c..41100fbd 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsvideo.c +++ b/libs/SDL2/src/video/windows/SDL_windowsvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -124,6 +124,7 @@ WIN_CreateDevice(int devindex) device->VideoInit = WIN_VideoInit; device->VideoQuit = WIN_VideoQuit; device->GetDisplayBounds = WIN_GetDisplayBounds; + device->GetDisplayUsableBounds = WIN_GetDisplayUsableBounds; device->GetDisplayDPI = WIN_GetDisplayDPI; device->GetDisplayModes = WIN_GetDisplayModes; device->SetDisplayMode = WIN_SetDisplayMode; @@ -136,6 +137,7 @@ WIN_CreateDevice(int devindex) device->SetWindowIcon = WIN_SetWindowIcon; device->SetWindowPosition = WIN_SetWindowPosition; device->SetWindowSize = WIN_SetWindowSize; + device->SetWindowOpacity = WIN_SetWindowOpacity; device->ShowWindow = WIN_ShowWindow; device->HideWindow = WIN_HideWindow; device->RaiseWindow = WIN_RaiseWindow; diff --git a/libs/SDL2/src/video/windows/SDL_windowsvideo.h b/libs/SDL2/src/video/windows/SDL_windowsvideo.h index 85327a7a..912d8763 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsvideo.h +++ b/libs/SDL2/src/video/windows/SDL_windowsvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowswindow.c b/libs/SDL2/src/video/windows/SDL_windowswindow.c index 45998210..b8f24db8 100644 --- a/libs/SDL2/src/video/windows/SDL_windowswindow.c +++ b/libs/SDL2/src/video/windows/SDL_windowswindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -826,6 +826,39 @@ WIN_SetWindowHitTest(SDL_Window *window, SDL_bool enabled) return 0; /* just succeed, the real work is done elsewhere. */ } +int +WIN_SetWindowOpacity(_THIS, SDL_Window * window, float opacity) +{ + const SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + const HWND hwnd = data->hwnd; + const LONG style = GetWindowLong(hwnd, GWL_EXSTYLE); + + SDL_assert(style != 0); + + if (opacity == 1.0f) { + /* want it fully opaque, just mark it unlayered if necessary. */ + if (style & WS_EX_LAYERED) { + if (SetWindowLong(hwnd, GWL_EXSTYLE, style & ~WS_EX_LAYERED) == 0) { + return WIN_SetError("SetWindowLong()"); + } + } + } else { + const BYTE alpha = (BYTE) ((int) (opacity * 255.0f)); + /* want it transparent, mark it layered if necessary. */ + if ((style & WS_EX_LAYERED) == 0) { + if (SetWindowLong(hwnd, GWL_EXSTYLE, style | WS_EX_LAYERED) == 0) { + return WIN_SetError("SetWindowLong()"); + } + } + + if (SetLayeredWindowAttributes(hwnd, 0, alpha, LWA_ALPHA) == 0) { + return WIN_SetError("SetLayeredWindowAttributes()"); + } + } + + return 0; +} + #endif /* SDL_VIDEO_DRIVER_WINDOWS */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/windows/SDL_windowswindow.h b/libs/SDL2/src/video/windows/SDL_windowswindow.h index 1e8b5557..e7b13c74 100644 --- a/libs/SDL2/src/video/windows/SDL_windowswindow.h +++ b/libs/SDL2/src/video/windows/SDL_windowswindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -56,6 +56,7 @@ extern void WIN_SetWindowTitle(_THIS, SDL_Window * window); extern void WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon); extern void WIN_SetWindowPosition(_THIS, SDL_Window * window); extern void WIN_SetWindowSize(_THIS, SDL_Window * window); +extern int WIN_SetWindowOpacity(_THIS, SDL_Window * window, float opacity); extern void WIN_ShowWindow(_THIS, SDL_Window * window); extern void WIN_HideWindow(_THIS, SDL_Window * window); extern void WIN_RaiseWindow(_THIS, SDL_Window * window); diff --git a/libs/SDL2/src/video/windows/wmmsg.h b/libs/SDL2/src/video/windows/wmmsg.h index e8f65ac3..8c1351fe 100644 --- a/libs/SDL2/src/video/windows/wmmsg.h +++ b/libs/SDL2/src/video/windows/wmmsg.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtevents.cpp b/libs/SDL2/src/video/winrt/SDL_winrtevents.cpp index 5c779d3c..e9df726d 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtevents.cpp +++ b/libs/SDL2/src/video/winrt/SDL_winrtevents.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtevents_c.h b/libs/SDL2/src/video/winrt/SDL_winrtevents_c.h index 047be740..dc94526b 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtevents_c.h +++ b/libs/SDL2/src/video/winrt/SDL_winrtevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtkeyboard.cpp b/libs/SDL2/src/video/winrt/SDL_winrtkeyboard.cpp index f75dd5f9..7477cdee 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtkeyboard.cpp +++ b/libs/SDL2/src/video/winrt/SDL_winrtkeyboard.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtmessagebox.cpp b/libs/SDL2/src/video/winrt/SDL_winrtmessagebox.cpp index dc38d214..ca958107 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtmessagebox.cpp +++ b/libs/SDL2/src/video/winrt/SDL_winrtmessagebox.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtmessagebox.h b/libs/SDL2/src/video/winrt/SDL_winrtmessagebox.h index 8cae479a..4184aa5e 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtmessagebox.h +++ b/libs/SDL2/src/video/winrt/SDL_winrtmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtmouse.cpp b/libs/SDL2/src/video/winrt/SDL_winrtmouse.cpp index cfebe9e0..d3140a4a 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtmouse.cpp +++ b/libs/SDL2/src/video/winrt/SDL_winrtmouse.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtmouse_c.h b/libs/SDL2/src/video/winrt/SDL_winrtmouse_c.h index f97af04d..464ba4d4 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtmouse_c.h +++ b/libs/SDL2/src/video/winrt/SDL_winrtmouse_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtopengles.cpp b/libs/SDL2/src/video/winrt/SDL_winrtopengles.cpp index 04c61ab9..cca07fa1 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtopengles.cpp +++ b/libs/SDL2/src/video/winrt/SDL_winrtopengles.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtopengles.h b/libs/SDL2/src/video/winrt/SDL_winrtopengles.h index a0fde81a..1da757b6 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtopengles.h +++ b/libs/SDL2/src/video/winrt/SDL_winrtopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtpointerinput.cpp b/libs/SDL2/src/video/winrt/SDL_winrtpointerinput.cpp index 2bd3adf2..1d648f96 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtpointerinput.cpp +++ b/libs/SDL2/src/video/winrt/SDL_winrtpointerinput.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtvideo.cpp b/libs/SDL2/src/video/winrt/SDL_winrtvideo.cpp index d1134a5a..af80e68e 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtvideo.cpp +++ b/libs/SDL2/src/video/winrt/SDL_winrtvideo.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -118,15 +118,13 @@ WINRT_CreateDevice(int devindex) device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); if (!device) { SDL_OutOfMemory(); - if (device) { - SDL_free(device); - } return (0); } data = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); if (!data) { SDL_OutOfMemory(); + SDL_free(device); return (0); } SDL_zerop(data); diff --git a/libs/SDL2/src/video/winrt/SDL_winrtvideo_cpp.h b/libs/SDL2/src/video/winrt/SDL_winrtvideo_cpp.h index 84f75a6c..26eb008d 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtvideo_cpp.h +++ b/libs/SDL2/src/video/winrt/SDL_winrtvideo_cpp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11clipboard.c b/libs/SDL2/src/video/x11/SDL_x11clipboard.c index eca40f2a..34c0a71c 100644 --- a/libs/SDL2/src/video/x11/SDL_x11clipboard.c +++ b/libs/SDL2/src/video/x11/SDL_x11clipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11clipboard.h b/libs/SDL2/src/video/x11/SDL_x11clipboard.h index 09dcf568..15dae7df 100644 --- a/libs/SDL2/src/video/x11/SDL_x11clipboard.h +++ b/libs/SDL2/src/video/x11/SDL_x11clipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11dyn.c b/libs/SDL2/src/video/x11/SDL_x11dyn.c index 58e97be7..d07fda74 100644 --- a/libs/SDL2/src/video/x11/SDL_x11dyn.c +++ b/libs/SDL2/src/video/x11/SDL_x11dyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -106,11 +106,8 @@ X11_GetSym(const char *fnname, int *pHasModule) #endif /* SDL_VIDEO_DRIVER_X11_DYNAMIC */ /* Define all the function pointers and wrappers... */ -#define SDL_X11_MODULE(modname) #define SDL_X11_SYM(rc,fn,params,args,ret) SDL_DYNX11FN_##fn X11_##fn = NULL; #include "SDL_x11sym.h" -#undef SDL_X11_MODULE -#undef SDL_X11_SYM /* Annoying varargs entry point... */ #ifdef X_HAVE_UTF8_STRING @@ -120,10 +117,7 @@ SDL_DYNX11FN_XGetICValues X11_XGetICValues = NULL; /* These SDL_X11_HAVE_* flags are here whether you have dynamic X11 or not. */ #define SDL_X11_MODULE(modname) int SDL_X11_HAVE_##modname = 0; -#define SDL_X11_SYM(rc,fn,params,args,ret) #include "SDL_x11sym.h" -#undef SDL_X11_MODULE -#undef SDL_X11_SYM static int x11_load_refcount = 0; @@ -139,8 +133,6 @@ SDL_X11_UnloadSymbols(void) #define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 0; #define SDL_X11_SYM(rc,fn,params,args,ret) X11_##fn = NULL; #include "SDL_x11sym.h" -#undef SDL_X11_MODULE -#undef SDL_X11_SYM #ifdef X_HAVE_UTF8_STRING X11_XCreateIC = NULL; @@ -177,16 +169,11 @@ SDL_X11_LoadSymbols(void) } #define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 1; /* default yes */ -#define SDL_X11_SYM(a,fn,x,y,z) #include "SDL_x11sym.h" -#undef SDL_X11_MODULE -#undef SDL_X11_SYM #define SDL_X11_MODULE(modname) thismod = &SDL_X11_HAVE_##modname; #define SDL_X11_SYM(a,fn,x,y,z) X11_##fn = (SDL_DYNX11FN_##fn) X11_GetSym(#fn,thismod); #include "SDL_x11sym.h" -#undef SDL_X11_MODULE -#undef SDL_X11_SYM #ifdef X_HAVE_UTF8_STRING X11_XCreateIC = (SDL_DYNX11FN_XCreateIC) @@ -209,8 +196,6 @@ SDL_X11_LoadSymbols(void) #define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 1; /* default yes */ #define SDL_X11_SYM(a,fn,x,y,z) X11_##fn = (SDL_DYNX11FN_##fn) fn; #include "SDL_x11sym.h" -#undef SDL_X11_MODULE -#undef SDL_X11_SYM #ifdef X_HAVE_UTF8_STRING X11_XCreateIC = XCreateIC; diff --git a/libs/SDL2/src/video/x11/SDL_x11dyn.h b/libs/SDL2/src/video/x11/SDL_x11dyn.h index 2d729b70..be1ddaa1 100644 --- a/libs/SDL2/src/video/x11/SDL_x11dyn.h +++ b/libs/SDL2/src/video/x11/SDL_x11dyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -86,13 +86,10 @@ int SDL_X11_LoadSymbols(void); void SDL_X11_UnloadSymbols(void); /* Declare all the function pointers and wrappers... */ -#define SDL_X11_MODULE(modname) #define SDL_X11_SYM(rc,fn,params,args,ret) \ typedef rc (*SDL_DYNX11FN_##fn) params; \ extern SDL_DYNX11FN_##fn X11_##fn; #include "SDL_x11sym.h" -#undef SDL_X11_MODULE -#undef SDL_X11_SYM /* Annoying varargs entry point... */ #ifdef X_HAVE_UTF8_STRING @@ -104,10 +101,7 @@ extern SDL_DYNX11FN_XGetICValues X11_XGetICValues; /* These SDL_X11_HAVE_* flags are here whether you have dynamic X11 or not. */ #define SDL_X11_MODULE(modname) extern int SDL_X11_HAVE_##modname; -#define SDL_X11_SYM(rc,fn,params,args,ret) #include "SDL_x11sym.h" -#undef SDL_X11_MODULE -#undef SDL_X11_SYM #ifdef __cplusplus } diff --git a/libs/SDL2/src/video/x11/SDL_x11events.c b/libs/SDL2/src/video/x11/SDL_x11events.c index c8addca4..8e585083 100644 --- a/libs/SDL2/src/video/x11/SDL_x11events.c +++ b/libs/SDL2/src/video/x11/SDL_x11events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -117,7 +117,9 @@ static Atom X11_PickTarget(Display *disp, Atom list[], int list_count) int i; for (i=0; i < list_count && request == None; i++) { name = X11_XGetAtomName(disp, list[i]); - if (strcmp("text/uri-list", name)==0) request = list[i]; + if ((SDL_strcmp("text/uri-list", name) == 0) || (SDL_strcmp("text/plain", name) == 0)) { + request = list[i]; + } X11_XFree(name); } return request; @@ -512,6 +514,23 @@ ProcessHitTest(_THIS, const SDL_WindowData *data, const XEvent *xev) return SDL_FALSE; } +static void +X11_UpdateUserTime(SDL_WindowData *data, const unsigned long latest) +{ + if (latest && (latest != data->user_time)) { + SDL_VideoData *videodata = data->videodata; + Display *display = videodata->display; + X11_XChangeProperty(display, data->xwindow, videodata->_NET_WM_USER_TIME, + XA_CARDINAL, 32, PropModeReplace, + (const unsigned char *) &latest, 1); + #if DEBUG_XEVENTS + printf("window %p: updating _NET_WM_USER_TIME to %lu\n", data, latest); + #endif + data->user_time = latest; + } +} + + static void X11_DispatchEvent(_THIS) { @@ -617,6 +636,7 @@ X11_DispatchEvent(_THIS) /* Gaining mouse coverage? */ case EnterNotify:{ + SDL_Mouse *mouse = SDL_GetMouse(); #ifdef DEBUG_XEVENTS printf("window %p: EnterNotify! (%d,%d,%d)\n", data, xevent.xcrossing.x, @@ -629,7 +649,10 @@ X11_DispatchEvent(_THIS) #endif SDL_SetMouseFocus(data->window); - if (!SDL_GetMouse()->relative_mode) { + mouse->last_x = xevent.xcrossing.x; + mouse->last_y = xevent.xcrossing.y; + + if (!mouse->relative_mode) { SDL_SendMouseMotion(data->window, 0, 0, xevent.xcrossing.x, xevent.xcrossing.y); } } @@ -773,6 +796,7 @@ X11_DispatchEvent(_THIS) } } + X11_UpdateUserTime(data, xevent.xkey.time); } break; @@ -816,32 +840,10 @@ X11_DispatchEvent(_THIS) xevent.xconfigure.x, xevent.xconfigure.y, xevent.xconfigure.width, xevent.xconfigure.height); #endif - long border_left = 0; - long border_top = 0; - if (data->xwindow) { - Atom _net_frame_extents = X11_XInternAtom(display, "_NET_FRAME_EXTENTS", 0); - Atom type; - int format; - unsigned long nitems, bytes_after; - unsigned char *property; - if (X11_XGetWindowProperty(display, data->xwindow, - _net_frame_extents, 0, 16, 0, - XA_CARDINAL, &type, &format, - &nitems, &bytes_after, &property) == Success) { - if (type != None && nitems == 4) - { - border_left = ((long*)property)[0]; - border_top = ((long*)property)[2]; - } - X11_XFree(property); - } - } - if (xevent.xconfigure.x != data->last_xconfigure.x || xevent.xconfigure.y != data->last_xconfigure.y) { SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED, - xevent.xconfigure.x - border_left, - xevent.xconfigure.y - border_top); + xevent.xconfigure.x, xevent.xconfigure.y); #ifdef SDL_USE_IBUS if(SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){ /* Update IBus candidate list position */ @@ -959,6 +961,16 @@ X11_DispatchEvent(_THIS) SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0); break; } + else if ((xevent.xclient.message_type == videodata->WM_PROTOCOLS) && + (xevent.xclient.format == 32) && + (xevent.xclient.data.l[0] == videodata->WM_TAKE_FOCUS)) { + +#ifdef DEBUG_XEVENTS + printf("window %p: WM_TAKE_FOCUS\n", data); +#endif + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_TAKE_FOCUS, 0, 0); + break; + } } break; @@ -991,6 +1003,7 @@ X11_DispatchEvent(_THIS) int button = xevent.xbutton.button; if(button == Button1) { if (ProcessHitTest(_this, data, &xevent)) { + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); break; /* don't pass this event on to app. */ } } @@ -1001,6 +1014,7 @@ X11_DispatchEvent(_THIS) } SDL_SendMouseButton(data->window, 0, SDL_PRESSED, button); } + X11_UpdateUserTime(data, xevent.xbutton.time); } break; @@ -1027,7 +1041,7 @@ X11_DispatchEvent(_THIS) char *name = X11_XGetAtomName(display, xevent.xproperty.atom); if (name) { - printf("window %p: PropertyNotify: %s %s\n", data, name, (xevent.xproperty.state == PropertyDelete) ? "deleted" : "changed"); + printf("window %p: PropertyNotify: %s %s time=%lu\n", data, name, (xevent.xproperty.state == PropertyDelete) ? "deleted" : "changed", xevent.xproperty.time); X11_XFree(name); } @@ -1095,6 +1109,17 @@ X11_DispatchEvent(_THIS) } #endif /* DEBUG_XEVENTS */ + /* Take advantage of this moment to make sure user_time has a + valid timestamp from the X server, so if we later try to + raise/restore this window, _NET_ACTIVE_WINDOW can have a + non-zero timestamp, even if there's never been a mouse or + key press to this window so far. Note that we don't try to + set _NET_WM_USER_TIME here, though. That's only for legit + user interaction with the window. */ + if (!data->user_time) { + data->user_time = xevent.xproperty.time; + } + if (xevent.xproperty.atom == data->videodata->_NET_WM_STATE) { /* Get the new state from the window manager. Compositing window managers can alter visibility of windows @@ -1128,6 +1153,24 @@ X11_DispatchEvent(_THIS) right approach, but it seems to work. */ X11_UpdateKeymap(_this); SDL_SendKeymapChangedEvent(); + } else if (xevent.xproperty.atom == videodata->_NET_FRAME_EXTENTS) { + Atom type; + int format; + unsigned long nitems, bytes_after; + unsigned char *property; + if (X11_XGetWindowProperty(display, data->xwindow, videodata->_NET_FRAME_EXTENTS, 0, 16, 0, XA_CARDINAL, &type, &format, &nitems, &bytes_after, &property) == Success) { + if (type != None && nitems == 4) { + data->border_left = (int) ((long*)property)[0]; + data->border_right = (int) ((long*)property)[1]; + data->border_top = (int) ((long*)property)[2]; + data->border_bottom = (int) ((long*)property)[3]; + } + X11_XFree(property); + + #ifdef DEBUG_XEVENTS + printf("New _NET_FRAME_EXTENTS: left=%d right=%d, top=%d, bottom=%d\n", data->border_left, data->border_right, data->border_top, data->border_bottom); + #endif + } } } break; @@ -1182,51 +1225,33 @@ X11_DispatchEvent(_THIS) break; case SelectionNotify: { + Atom target = xevent.xselection.target; #ifdef DEBUG_XEVENTS printf("window %p: SelectionNotify (requestor = %ld, target = %ld)\n", data, xevent.xselection.requestor, xevent.xselection.target); #endif - Atom target = xevent.xselection.target; if (target == data->xdnd_req) { /* read data */ SDL_x11Prop p; X11_ReadProperty(&p, display, data->xwindow, videodata->PRIMARY); if (p.format == 8) { - SDL_bool expect_lf = SDL_FALSE; - char *start = NULL; - char *scan = (char*)p.data; - char *fn; - char *uri; - int length = 0; - while (p.count--) { - if (!expect_lf) { - if (*scan == 0x0D) { - expect_lf = SDL_TRUE; + /* !!! FIXME: don't use strtok here. It's not reentrant and not in SDL_stdinc. */ + char* name = X11_XGetAtomName(display, target); + char *token = strtok((char *) p.data, "\r\n"); + while (token != NULL) { + if (SDL_strcmp("text/plain", name)==0) { + SDL_SendDropText(data->window, token); + } else if (SDL_strcmp("text/uri-list", name)==0) { + char *fn = X11_URIToLocal(token); + if (fn) { + SDL_SendDropFile(data->window, fn); } - if (start == NULL) { - start = scan; - length = 0; - } - length++; - } else { - if (*scan == 0x0A && length > 0) { - uri = SDL_malloc(length--); - SDL_memcpy(uri, start, length); - uri[length] = '\0'; - fn = X11_URIToLocal(uri); - if (fn) { - SDL_SendDropFile(fn); - } - SDL_free(uri); - } - expect_lf = SDL_FALSE; - start = NULL; } - scan++; + token = strtok(NULL, "\r\n"); } + SDL_SendDropComplete(data->window); } - X11_XFree(p.data); /* send reply */ diff --git a/libs/SDL2/src/video/x11/SDL_x11events.h b/libs/SDL2/src/video/x11/SDL_x11events.h index a6d434de..024fca3f 100644 --- a/libs/SDL2/src/video/x11/SDL_x11events.h +++ b/libs/SDL2/src/video/x11/SDL_x11events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11framebuffer.c b/libs/SDL2/src/video/x11/SDL_x11framebuffer.c index 90a4a6fc..a4886169 100644 --- a/libs/SDL2/src/video/x11/SDL_x11framebuffer.c +++ b/libs/SDL2/src/video/x11/SDL_x11framebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11framebuffer.h b/libs/SDL2/src/video/x11/SDL_x11framebuffer.h index 359ee157..7326e7da 100644 --- a/libs/SDL2/src/video/x11/SDL_x11framebuffer.h +++ b/libs/SDL2/src/video/x11/SDL_x11framebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11keyboard.c b/libs/SDL2/src/video/x11/SDL_x11keyboard.c index b04830f1..e16d9f17 100644 --- a/libs/SDL2/src/video/x11/SDL_x11keyboard.c +++ b/libs/SDL2/src/video/x11/SDL_x11keyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -129,6 +129,7 @@ static const struct { { XK_Control_R, SDL_SCANCODE_RCTRL }, { XK_Shift_R, SDL_SCANCODE_RSHIFT }, { XK_Alt_R, SDL_SCANCODE_RALT }, + { XK_ISO_Level3_Shift, SDL_SCANCODE_RALT }, { XK_Meta_R, SDL_SCANCODE_RGUI }, { XK_Super_R, SDL_SCANCODE_RGUI }, { XK_Mode_switch, SDL_SCANCODE_MODE }, diff --git a/libs/SDL2/src/video/x11/SDL_x11keyboard.h b/libs/SDL2/src/video/x11/SDL_x11keyboard.h index 1e9c48ca..a1102ed7 100644 --- a/libs/SDL2/src/video/x11/SDL_x11keyboard.h +++ b/libs/SDL2/src/video/x11/SDL_x11keyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11messagebox.c b/libs/SDL2/src/video/x11/SDL_x11messagebox.c index a52d4c9e..fc8b1b26 100644 --- a/libs/SDL2/src/video/x11/SDL_x11messagebox.c +++ b/libs/SDL2/src/video/x11/SDL_x11messagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11messagebox.h b/libs/SDL2/src/video/x11/SDL_x11messagebox.h index 37d8312c..c77c57fb 100644 --- a/libs/SDL2/src/video/x11/SDL_x11messagebox.h +++ b/libs/SDL2/src/video/x11/SDL_x11messagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11modes.c b/libs/SDL2/src/video/x11/SDL_x11modes.c index 0c31e35e..312107a3 100644 --- a/libs/SDL2/src/video/x11/SDL_x11modes.c +++ b/libs/SDL2/src/video/x11/SDL_x11modes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -342,7 +342,7 @@ SetXRandRDisplayName(Display *dpy, Atom EDID, char *name, const size_t namelen, X11_XFree(props); } - inches = (int)((SDL_sqrt(widthmm * widthmm + heightmm * heightmm) / 25.4f) + 0.5f); + inches = (int)((SDL_sqrtf(widthmm * widthmm + heightmm * heightmm) / 25.4f) + 0.5f); if (*name && inches) { const size_t len = SDL_strlen(name); SDL_snprintf(&name[len], namelen-len, " %d\"", inches); @@ -618,6 +618,20 @@ X11_InitModes(_THIS) /* !!! FIXME: eventually remove support for Xinerama and XVidMode (everything below here). */ + /* This is a workaround for some apps (UnrealEngine4, for example) until + we sort out the ramifications of removing XVidMode support outright. + This block should be removed with the XVidMode support. */ + { + const char *env = SDL_GetHint("SDL_VIDEO_X11_REQUIRE_XRANDR"); + if (env && SDL_atoi(env)) { + #if SDL_VIDEO_DRIVER_X11_XRANDR + return SDL_SetError("XRandR support is required but not available"); + #else + return SDL_SetError("XRandR support is required but not built into SDL!"); + #endif + } + } + #if SDL_VIDEO_DRIVER_X11_XINERAMA /* Query Xinerama extention * NOTE: This works with Nvidia Twinview correctly, but you need version 302.17 (released on June 2012) @@ -1059,6 +1073,43 @@ X11_GetDisplayDPI(_THIS, SDL_VideoDisplay * sdl_display, float * ddpi, float * h return data->ddpi != 0.0f ? 0 : -1; } +int +X11_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect) +{ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + Display *display = data->display; + Atom _NET_WORKAREA; + int status, real_format; + int retval = -1; + Atom real_type; + unsigned long items_read = 0, items_left = 0; + unsigned char *propdata = NULL; + + if (X11_GetDisplayBounds(_this, sdl_display, rect) < 0) { + return -1; + } + + _NET_WORKAREA = X11_XInternAtom(display, "_NET_WORKAREA", False); + status = X11_XGetWindowProperty(display, DefaultRootWindow(display), + _NET_WORKAREA, 0L, 4L, False, XA_CARDINAL, + &real_type, &real_format, &items_read, + &items_left, &propdata); + if ((status == Success) && (items_read >= 4)) { + const long *p = (long*) propdata; + const SDL_Rect usable = { (int)p[0], (int)p[1], (int)p[2], (int)p[3] }; + retval = 0; + if (!SDL_IntersectRect(rect, &usable, rect)) { + SDL_zerop(rect); + } + } + + if (propdata) { + X11_XFree(propdata); + } + + return retval; +} + #endif /* SDL_VIDEO_DRIVER_X11 */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/x11/SDL_x11modes.h b/libs/SDL2/src/video/x11/SDL_x11modes.h index 769da5a5..4f47f3b5 100644 --- a/libs/SDL2/src/video/x11/SDL_x11modes.h +++ b/libs/SDL2/src/video/x11/SDL_x11modes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -77,6 +77,7 @@ extern int X11_GetVisualInfoFromVisual(Display * display, Visual * visual, extern Uint32 X11_GetPixelFormatFromVisualInfo(Display * display, XVisualInfo * vinfo); extern int X11_GetDisplayBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect); +extern int X11_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect); extern int X11_GetDisplayDPI(_THIS, SDL_VideoDisplay * sdl_display, float * ddpi, float * hdpi, float * vdpi); #endif /* _SDL_x11modes_h */ diff --git a/libs/SDL2/src/video/x11/SDL_x11mouse.c b/libs/SDL2/src/video/x11/SDL_x11mouse.c index 6cef0a4e..e1a16c22 100644 --- a/libs/SDL2/src/video/x11/SDL_x11mouse.c +++ b/libs/SDL2/src/video/x11/SDL_x11mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -366,39 +366,52 @@ X11_CaptureMouse(SDL_Window *window) static Uint32 X11_GetGlobalMouseState(int *x, int *y) { + SDL_VideoData *videodata = (SDL_VideoData *) SDL_GetVideoDevice()->driverdata; Display *display = GetDisplay(); const int num_screens = SDL_GetNumVideoDisplays(); int i; /* !!! FIXME: should we XSync() here first? */ - for (i = 0; i < num_screens; i++) { - SDL_DisplayData *data = (SDL_DisplayData *) SDL_GetDisplayDriverData(i); - if (data != NULL) { - Window root, child; - int rootx, rooty, winx, winy; - unsigned int mask; - if (X11_XQueryPointer(display, RootWindow(display, data->screen), &root, &child, &rootx, &rooty, &winx, &winy, &mask)) { - XWindowAttributes root_attrs; - Uint32 retval = 0; - retval |= (mask & Button1Mask) ? SDL_BUTTON_LMASK : 0; - retval |= (mask & Button2Mask) ? SDL_BUTTON_MMASK : 0; - retval |= (mask & Button3Mask) ? SDL_BUTTON_RMASK : 0; - /* SDL_DisplayData->x,y point to screen origin, and adding them to mouse coordinates relative to root window doesn't do the right thing - * (observed on dual monitor setup with primary display being the rightmost one - mouse was offset to the right). - * - * Adding root position to root-relative coordinates seems to be a better way to get absolute position. */ - X11_XGetWindowAttributes(display, root, &root_attrs); - *x = root_attrs.x + rootx; - *y = root_attrs.y + rooty; - return retval; +#if !SDL_VIDEO_DRIVER_X11_XINPUT2 + videodata->global_mouse_changed = SDL_TRUE; +#endif + + /* check if we have this cached since XInput last saw the mouse move. */ + /* !!! FIXME: can we just calculate this from XInput's events? */ + if (videodata->global_mouse_changed) { + for (i = 0; i < num_screens; i++) { + SDL_DisplayData *data = (SDL_DisplayData *) SDL_GetDisplayDriverData(i); + if (data != NULL) { + Window root, child; + int rootx, rooty, winx, winy; + unsigned int mask; + if (X11_XQueryPointer(display, RootWindow(display, data->screen), &root, &child, &rootx, &rooty, &winx, &winy, &mask)) { + XWindowAttributes root_attrs; + Uint32 buttons = 0; + buttons |= (mask & Button1Mask) ? SDL_BUTTON_LMASK : 0; + buttons |= (mask & Button2Mask) ? SDL_BUTTON_MMASK : 0; + buttons |= (mask & Button3Mask) ? SDL_BUTTON_RMASK : 0; + /* SDL_DisplayData->x,y point to screen origin, and adding them to mouse coordinates relative to root window doesn't do the right thing + * (observed on dual monitor setup with primary display being the rightmost one - mouse was offset to the right). + * + * Adding root position to root-relative coordinates seems to be a better way to get absolute position. */ + X11_XGetWindowAttributes(display, root, &root_attrs); + videodata->global_mouse_position.x = root_attrs.x + rootx; + videodata->global_mouse_position.y = root_attrs.y + rooty; + videodata->global_mouse_buttons = buttons; + videodata->global_mouse_changed = SDL_FALSE; + break; + } } } } - SDL_assert(0 && "The pointer wasn't on any X11 screen?!"); + SDL_assert(!videodata->global_mouse_changed); /* The pointer wasn't on any X11 screen?! */ - return 0; + *x = videodata->global_mouse_position.x; + *y = videodata->global_mouse_position.y; + return videodata->global_mouse_buttons; } diff --git a/libs/SDL2/src/video/x11/SDL_x11mouse.h b/libs/SDL2/src/video/x11/SDL_x11mouse.h index 7c6a5443..d31d6b72 100644 --- a/libs/SDL2/src/video/x11/SDL_x11mouse.h +++ b/libs/SDL2/src/video/x11/SDL_x11mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11opengl.c b/libs/SDL2/src/video/x11/SDL_x11opengl.c index a431ae74..8b634be3 100644 --- a/libs/SDL2/src/video/x11/SDL_x11opengl.c +++ b/libs/SDL2/src/video/x11/SDL_x11opengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11opengl.h b/libs/SDL2/src/video/x11/SDL_x11opengl.h index de229735..86e77d7d 100644 --- a/libs/SDL2/src/video/x11/SDL_x11opengl.h +++ b/libs/SDL2/src/video/x11/SDL_x11opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11opengles.c b/libs/SDL2/src/video/x11/SDL_x11opengles.c index ca57af38..53117220 100644 --- a/libs/SDL2/src/video/x11/SDL_x11opengles.c +++ b/libs/SDL2/src/video/x11/SDL_x11opengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11opengles.h b/libs/SDL2/src/video/x11/SDL_x11opengles.h index e39e3c01..716e6e68 100644 --- a/libs/SDL2/src/video/x11/SDL_x11opengles.h +++ b/libs/SDL2/src/video/x11/SDL_x11opengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11shape.c b/libs/SDL2/src/video/x11/SDL_x11shape.c index 19c7942d..4f78ae89 100644 --- a/libs/SDL2/src/video/x11/SDL_x11shape.c +++ b/libs/SDL2/src/video/x11/SDL_x11shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11shape.h b/libs/SDL2/src/video/x11/SDL_x11shape.h index 0d3c2107..cd88ab70 100644 --- a/libs/SDL2/src/video/x11/SDL_x11shape.h +++ b/libs/SDL2/src/video/x11/SDL_x11shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11sym.h b/libs/SDL2/src/video/x11/SDL_x11sym.h index 4a926a34..5e76fe2c 100644 --- a/libs/SDL2/src/video/x11/SDL_x11sym.h +++ b/libs/SDL2/src/video/x11/SDL_x11sym.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,6 +21,14 @@ /* *INDENT-OFF* */ +#ifndef SDL_X11_MODULE +#define SDL_X11_MODULE(modname) +#endif + +#ifndef SDL_X11_SYM +#define SDL_X11_SYM(rc,fn,params,args,ret) +#endif + SDL_X11_MODULE(BASEXLIB) SDL_X11_SYM(XSizeHints*,XAllocSizeHints,(void),(),return) SDL_X11_SYM(XWMHints*,XAllocWMHints,(void),(),return) @@ -311,6 +319,9 @@ SDL_X11_SYM(Bool,XF86VidModeSwitchToMode,(Display *a,int b,XF86VidModeModeInfo * SDL_X11_SYM(Bool,XF86VidModeLockModeSwitch,(Display *a,int b,int c),(a,b,c),return) #endif +#undef SDL_X11_MODULE +#undef SDL_X11_SYM + /* *INDENT-ON* */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/x11/SDL_x11touch.c b/libs/SDL2/src/video/x11/SDL_x11touch.c index 2b24027a..c19e80a6 100644 --- a/libs/SDL2/src/video/x11/SDL_x11touch.c +++ b/libs/SDL2/src/video/x11/SDL_x11touch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11touch.h b/libs/SDL2/src/video/x11/SDL_x11touch.h index 47645e8f..7f8d18e1 100644 --- a/libs/SDL2/src/video/x11/SDL_x11touch.h +++ b/libs/SDL2/src/video/x11/SDL_x11touch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11video.c b/libs/SDL2/src/video/x11/SDL_x11video.c index 9d07438e..b2136daf 100644 --- a/libs/SDL2/src/video/x11/SDL_x11video.c +++ b/libs/SDL2/src/video/x11/SDL_x11video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -175,6 +175,8 @@ X11_CreateDevice(int devindex) } device->driverdata = data; + data->global_mouse_changed = SDL_TRUE; + /* FIXME: Do we need this? if ( (SDL_strncmp(X11_XDisplayName(display), ":", 1) == 0) || (SDL_strncmp(X11_XDisplayName(display), "unix:", 5) == 0) ) { @@ -216,6 +218,7 @@ X11_CreateDevice(int devindex) device->VideoQuit = X11_VideoQuit; device->GetDisplayModes = X11_GetDisplayModes; device->GetDisplayBounds = X11_GetDisplayBounds; + device->GetDisplayUsableBounds = X11_GetDisplayUsableBounds; device->GetDisplayDPI = X11_GetDisplayDPI; device->SetDisplayMode = X11_SetDisplayMode; device->SuspendScreenSaver = X11_SuspendScreenSaver; @@ -229,6 +232,10 @@ X11_CreateDevice(int devindex) device->SetWindowSize = X11_SetWindowSize; device->SetWindowMinimumSize = X11_SetWindowMinimumSize; device->SetWindowMaximumSize = X11_SetWindowMaximumSize; + device->GetWindowBordersSize = X11_GetWindowBordersSize; + device->SetWindowOpacity = X11_SetWindowOpacity; + device->SetWindowModalFor = X11_SetWindowModalFor; + device->SetWindowInputFocus = X11_SetWindowInputFocus; device->ShowWindow = X11_ShowWindow; device->HideWindow = X11_HideWindow; device->RaiseWindow = X11_RaiseWindow; @@ -373,6 +380,9 @@ X11_VideoInit(_THIS) /* Get the process PID to be associated to the window */ data->pid = getpid(); + /* I have no idea how random this actually is, or has to be. */ + data->window_group = (XID) (((size_t) data->pid) ^ ((size_t) _this)); + /* Open a connection to the X input manager */ #ifdef X_HAVE_UTF8_STRING if (SDL_X11_HAVE_UTF8) { @@ -385,19 +395,26 @@ X11_VideoInit(_THIS) #define GET_ATOM(X) data->X = X11_XInternAtom(data->display, #X, False) GET_ATOM(WM_PROTOCOLS); GET_ATOM(WM_DELETE_WINDOW); + GET_ATOM(WM_TAKE_FOCUS); GET_ATOM(_NET_WM_STATE); GET_ATOM(_NET_WM_STATE_HIDDEN); GET_ATOM(_NET_WM_STATE_FOCUSED); GET_ATOM(_NET_WM_STATE_MAXIMIZED_VERT); GET_ATOM(_NET_WM_STATE_MAXIMIZED_HORZ); GET_ATOM(_NET_WM_STATE_FULLSCREEN); + GET_ATOM(_NET_WM_STATE_ABOVE); + GET_ATOM(_NET_WM_STATE_SKIP_TASKBAR); + GET_ATOM(_NET_WM_STATE_SKIP_PAGER); GET_ATOM(_NET_WM_ALLOWED_ACTIONS); GET_ATOM(_NET_WM_ACTION_FULLSCREEN); GET_ATOM(_NET_WM_NAME); GET_ATOM(_NET_WM_ICON_NAME); GET_ATOM(_NET_WM_ICON); GET_ATOM(_NET_WM_PING); + GET_ATOM(_NET_WM_WINDOW_OPACITY); + GET_ATOM(_NET_WM_USER_TIME); GET_ATOM(_NET_ACTIVE_WINDOW); + GET_ATOM(_NET_FRAME_EXTENTS); GET_ATOM(UTF8_STRING); GET_ATOM(PRIMARY); GET_ATOM(XdndEnter); diff --git a/libs/SDL2/src/video/x11/SDL_x11video.h b/libs/SDL2/src/video/x11/SDL_x11video.h index a544113e..912cf483 100644 --- a/libs/SDL2/src/video/x11/SDL_x11video.h +++ b/libs/SDL2/src/video/x11/SDL_x11video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -81,6 +81,7 @@ typedef struct SDL_VideoData int numwindows; SDL_WindowData **windowlist; int windowlistlength; + XID window_group; /* This is true for ICCCM2.0-compliant window managers */ SDL_bool net_wm; @@ -88,19 +89,26 @@ typedef struct SDL_VideoData /* Useful atoms */ Atom WM_PROTOCOLS; Atom WM_DELETE_WINDOW; + Atom WM_TAKE_FOCUS; Atom _NET_WM_STATE; Atom _NET_WM_STATE_HIDDEN; Atom _NET_WM_STATE_FOCUSED; Atom _NET_WM_STATE_MAXIMIZED_VERT; Atom _NET_WM_STATE_MAXIMIZED_HORZ; Atom _NET_WM_STATE_FULLSCREEN; + Atom _NET_WM_STATE_ABOVE; + Atom _NET_WM_STATE_SKIP_TASKBAR; + Atom _NET_WM_STATE_SKIP_PAGER; Atom _NET_WM_ALLOWED_ACTIONS; Atom _NET_WM_ACTION_FULLSCREEN; Atom _NET_WM_NAME; Atom _NET_WM_ICON_NAME; Atom _NET_WM_ICON; Atom _NET_WM_PING; + Atom _NET_WM_WINDOW_OPACITY; + Atom _NET_WM_USER_TIME; Atom _NET_ACTIVE_WINDOW; + Atom _NET_FRAME_EXTENTS; Atom UTF8_STRING; Atom PRIMARY; Atom XdndEnter; @@ -117,6 +125,10 @@ typedef struct SDL_VideoData SDL_bool selection_waiting; Uint32 last_mode_change_deadline; + + SDL_bool global_mouse_changed; + SDL_Point global_mouse_position; + Uint32 global_mouse_buttons; } SDL_VideoData; extern SDL_bool X11_UseDirectColorVisuals(void); diff --git a/libs/SDL2/src/video/x11/SDL_x11window.c b/libs/SDL2/src/video/x11/SDL_x11window.c index b9505611..8659961d 100644 --- a/libs/SDL2/src/video/x11/SDL_x11window.c +++ b/libs/SDL2/src/video/x11/SDL_x11window.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -130,13 +130,17 @@ X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags) { SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; Display *display = videodata->display; + /* !!! FIXME: just dereference videodata below instead of copying to locals. */ Atom _NET_WM_STATE = videodata->_NET_WM_STATE; /* Atom _NET_WM_STATE_HIDDEN = videodata->_NET_WM_STATE_HIDDEN; */ Atom _NET_WM_STATE_FOCUSED = videodata->_NET_WM_STATE_FOCUSED; Atom _NET_WM_STATE_MAXIMIZED_VERT = videodata->_NET_WM_STATE_MAXIMIZED_VERT; Atom _NET_WM_STATE_MAXIMIZED_HORZ = videodata->_NET_WM_STATE_MAXIMIZED_HORZ; Atom _NET_WM_STATE_FULLSCREEN = videodata->_NET_WM_STATE_FULLSCREEN; - Atom atoms[5]; + Atom _NET_WM_STATE_ABOVE = videodata->_NET_WM_STATE_ABOVE; + Atom _NET_WM_STATE_SKIP_TASKBAR = videodata->_NET_WM_STATE_SKIP_TASKBAR; + Atom _NET_WM_STATE_SKIP_PAGER = videodata->_NET_WM_STATE_SKIP_PAGER; + Atom atoms[16]; int count = 0; /* The window manager sets this property, we shouldn't set it. @@ -147,6 +151,14 @@ X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags) atoms[count++] = _NET_WM_STATE_HIDDEN; } */ + + if (flags & SDL_WINDOW_ALWAYS_ON_TOP) { + atoms[count++] = _NET_WM_STATE_ABOVE; + } + if (flags & SDL_WINDOW_SKIP_TASKBAR) { + atoms[count++] = _NET_WM_STATE_SKIP_TASKBAR; + atoms[count++] = _NET_WM_STATE_SKIP_PAGER; + } if (flags & SDL_WINDOW_INPUT_FOCUS) { atoms[count++] = _NET_WM_STATE_FOCUSED; } @@ -157,6 +169,9 @@ X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags) if (flags & SDL_WINDOW_FULLSCREEN) { atoms[count++] = _NET_WM_STATE_FULLSCREEN; } + + SDL_assert(count <= SDL_arraysize(atoms)); + if (count > 0) { X11_XChangeProperty(display, xwindow, _NET_WM_STATE, XA_ATOM, 32, PropModeReplace, (unsigned char *)atoms, count); @@ -206,7 +221,9 @@ X11_GetNetWMState(_THIS, Window xwindow) } if (maximized == 3) { flags |= SDL_WINDOW_MAXIMIZED; - } else if (fullscreen == 1) { + } + + if (fullscreen == 1) { flags |= SDL_WINDOW_FULLSCREEN; } X11_XFree(propertyValue); @@ -355,10 +372,11 @@ X11_CreateWindow(_THIS, SDL_Window * window) XSizeHints *sizehints; XWMHints *wmhints; XClassHint *classhints; - const long _NET_WM_BYPASS_COMPOSITOR_HINT_ON = 1; Atom _NET_WM_BYPASS_COMPOSITOR; Atom _NET_WM_WINDOW_TYPE; - Atom _NET_WM_WINDOW_TYPE_NORMAL; + Atom wintype; + const char *wintype_name = NULL; + int compositor = 1; Atom _NET_WM_PID; Atom XdndAware, xdnd_version = 5; long fevent = 0; @@ -396,7 +414,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) depth = displaydata->depth; } - xattr.override_redirect = False; + xattr.override_redirect = ((window->flags & SDL_WINDOW_TOOLTIP) || (window->flags & SDL_WINDOW_POPUP_MENU)) ? True : False; xattr.background_pixmap = None; xattr.border_pixel = 0; @@ -506,7 +524,8 @@ X11_CreateWindow(_THIS, SDL_Window * window) /* Setup the input hints so we get keyboard input */ wmhints = X11_XAllocWMHints(); wmhints->input = True; - wmhints->flags = InputHint; + wmhints->window_group = data->window_group; + wmhints->flags = InputHint | WindowGroupHint; /* Setup the class hints so we can get an icon (AfterStep) */ classhints = X11_XAllocClassHint(); @@ -521,39 +540,51 @@ X11_CreateWindow(_THIS, SDL_Window * window) X11_XFree(classhints); /* Set the PID related to the window for the given hostname, if possible */ if (data->pid > 0) { + long pid = (long) data->pid; _NET_WM_PID = X11_XInternAtom(display, "_NET_WM_PID", False); X11_XChangeProperty(display, w, _NET_WM_PID, XA_CARDINAL, 32, PropModeReplace, - (unsigned char *)&data->pid, 1); + (unsigned char *) &pid, 1); } /* Set the window manager state */ X11_SetNetWMState(_this, w, window->flags); - /* Let the window manager know we're a "normal" window */ + compositor = 2; /* don't disable compositing except for "normal" windows */ + + if (window->flags & SDL_WINDOW_UTILITY) { + wintype_name = "_NET_WM_WINDOW_TYPE_UTILITY"; + } else if (window->flags & SDL_WINDOW_TOOLTIP) { + wintype_name = "_NET_WM_WINDOW_TYPE_TOOLTIP"; + } else if (window->flags & SDL_WINDOW_POPUP_MENU) { + wintype_name = "_NET_WM_WINDOW_TYPE_POPUP_MENU"; + } else { + wintype_name = "_NET_WM_WINDOW_TYPE_NORMAL"; + compositor = 1; /* disable compositing for "normal" windows */ + } + + /* Let the window manager know what type of window we are. */ _NET_WM_WINDOW_TYPE = X11_XInternAtom(display, "_NET_WM_WINDOW_TYPE", False); - _NET_WM_WINDOW_TYPE_NORMAL = X11_XInternAtom(display, "_NET_WM_WINDOW_TYPE_NORMAL", False); + wintype = X11_XInternAtom(display, wintype_name, False); X11_XChangeProperty(display, w, _NET_WM_WINDOW_TYPE, XA_ATOM, 32, - PropModeReplace, - (unsigned char *)&_NET_WM_WINDOW_TYPE_NORMAL, 1); + PropModeReplace, (unsigned char *)&wintype, 1); _NET_WM_BYPASS_COMPOSITOR = X11_XInternAtom(display, "_NET_WM_BYPASS_COMPOSITOR", False); X11_XChangeProperty(display, w, _NET_WM_BYPASS_COMPOSITOR, XA_CARDINAL, 32, PropModeReplace, - (unsigned char *)&_NET_WM_BYPASS_COMPOSITOR_HINT_ON, 1); + (unsigned char *)&compositor, 1); { - Atom protocols[2]; + Atom protocols[3]; int proto_count = 0; const char *ping_hint; - protocols[proto_count] = data->WM_DELETE_WINDOW; /* Allow window to be deleted by the WM */ - proto_count++; - + protocols[proto_count++] = data->WM_DELETE_WINDOW; /* Allow window to be deleted by the WM */ + protocols[proto_count++] = data->WM_TAKE_FOCUS; /* Since we will want to set input focus explicitly */ + ping_hint = SDL_GetHint(SDL_HINT_VIDEO_X11_NET_WM_PING); /* Default to using ping if there is no hint */ if (!ping_hint || SDL_atoi(ping_hint)) { - protocols[proto_count] = data->_NET_WM_PING; /* Respond so WM knows we're alive */ - proto_count++; + protocols[proto_count++] = data->_NET_WM_PING; /* Respond so WM knows we're alive */ } SDL_assert(proto_count <= sizeof(protocols) / sizeof(protocols[0])); @@ -750,7 +781,7 @@ X11_SetWindowPosition(_THIS, SDL_Window * window) SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Display *display = data->videodata->display; - X11_XMoveWindow(display, data->xwindow, window->x, window->y); + X11_XMoveWindow(display, data->xwindow, window->x - data->border_left, window->y - data->border_top); X11_XFlush(display); } @@ -776,7 +807,7 @@ X11_SetWindowMinimumSize(_THIS, SDL_Window * window) /* See comment in X11_SetWindowSize. */ X11_XResizeWindow(display, data->xwindow, window->w, window->h); - X11_XMoveWindow(display, data->xwindow, window->x, window->y); + X11_XMoveWindow(display, data->xwindow, window->x - data->border_left, window->y - data->border_top); X11_XRaiseWindow(display, data->xwindow); } @@ -805,7 +836,7 @@ X11_SetWindowMaximumSize(_THIS, SDL_Window * window) /* See comment in X11_SetWindowSize. */ X11_XResizeWindow(display, data->xwindow, window->w, window->h); - X11_XMoveWindow(display, data->xwindow, window->x, window->y); + X11_XMoveWindow(display, data->xwindow, window->x - data->border_left, window->y - data->border_top); X11_XRaiseWindow(display, data->xwindow); } @@ -854,7 +885,7 @@ X11_SetWindowSize(_THIS, SDL_Window * window) and transitioning from windowed to fullscreen in Unity. */ X11_XResizeWindow(display, data->xwindow, window->w, window->h); - X11_XMoveWindow(display, data->xwindow, window->x, window->y); + X11_XMoveWindow(display, data->xwindow, window->x - data->border_left, window->y - data->border_top); X11_XRaiseWindow(display, data->xwindow); } else { X11_XResizeWindow(display, data->xwindow, window->w, window->h); @@ -863,6 +894,61 @@ X11_SetWindowSize(_THIS, SDL_Window * window) X11_XFlush(display); } +int +X11_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right) +{ + SDL_WindowData *data = (SDL_WindowData *)window->driverdata; + + *left = data->border_left; + *right = data->border_right; + *top = data->border_top; + *bottom = data->border_bottom; + + return 0; +} + +int +X11_SetWindowOpacity(_THIS, SDL_Window * window, float opacity) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + Display *display = data->videodata->display; + Atom _NET_WM_WINDOW_OPACITY = data->videodata->_NET_WM_WINDOW_OPACITY; + + if (opacity == 1.0f) { + X11_XDeleteProperty(display, data->xwindow, _NET_WM_WINDOW_OPACITY); + } else { + const Uint32 FullyOpaque = 0xFFFFFFFF; + const long alpha = (long) ((double)opacity * (double)FullyOpaque); + X11_XChangeProperty(display, data->xwindow, _NET_WM_WINDOW_OPACITY, XA_CARDINAL, 32, + PropModeReplace, (unsigned char *)&alpha, 1); + } + + return 0; +} + +int +X11_SetWindowModalFor(_THIS, SDL_Window * modal_window, SDL_Window * parent_window) { + SDL_WindowData *data = (SDL_WindowData *) modal_window->driverdata; + SDL_WindowData *parent_data = (SDL_WindowData *) parent_window->driverdata; + Display *display = data->videodata->display; + + X11_XSetTransientForHint(display, data->xwindow, parent_data->xwindow); + return 0; +} + +int +X11_SetWindowInputFocus(_THIS, SDL_Window * window) +{ + if (X11_IsWindowMapped(_this, window)) { + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + Display *display = data->videodata->display; + X11_XSetInputFocus(display, data->xwindow, RevertToNone, CurrentTime); + X11_XFlush(display); + return 0; + } + return -1; +} + void X11_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) { @@ -946,13 +1032,15 @@ SetWindowActive(_THIS, SDL_Window * window) if (X11_IsWindowMapped(_this, window)) { XEvent e; + /*printf("SDL Window %p: sending _NET_ACTIVE_WINDOW with timestamp %lu\n", window, data->user_time);*/ + SDL_zero(e); e.xany.type = ClientMessage; e.xclient.message_type = _NET_ACTIVE_WINDOW; e.xclient.format = 32; e.xclient.window = data->xwindow; e.xclient.data.l[0] = 1; /* source indication. 1 = application */ - e.xclient.data.l[1] = CurrentTime; + e.xclient.data.l[1] = data->user_time; e.xclient.data.l[2] = 0; X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0, @@ -1038,7 +1126,7 @@ X11_RestoreWindow(_THIS, SDL_Window * window) SetWindowActive(_this, window); } -/* This asks the Window Manager to handle fullscreen for us. Most don't do it right, though. */ +/* This asks the Window Manager to handle fullscreen for us. This is the modern way. */ static void X11_SetWindowFullscreenViaWM(_THIS, SDL_Window * window, SDL_VideoDisplay * _display, SDL_bool fullscreen) { @@ -1083,6 +1171,22 @@ X11_SetWindowFullscreenViaWM(_THIS, SDL_Window * window, SDL_VideoDisplay * _dis X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0, SubstructureNotifyMask | SubstructureRedirectMask, &e); + + /* Fullscreen windows sometimes end up being marked maximized by + window managers. Force it back to how we expect it to be. */ + if (!fullscreen && ((window->flags & SDL_WINDOW_MAXIMIZED) == 0)) { + SDL_zero(e); + e.xany.type = ClientMessage; + e.xclient.message_type = _NET_WM_STATE; + e.xclient.format = 32; + e.xclient.window = data->xwindow; + e.xclient.data.l[0] = _NET_WM_STATE_REMOVE; + e.xclient.data.l[1] = data->videodata->_NET_WM_STATE_MAXIMIZED_VERT; + e.xclient.data.l[2] = data->videodata->_NET_WM_STATE_MAXIMIZED_HORZ; + e.xclient.data.l[3] = 0l; + X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0, + SubstructureNotifyMask | SubstructureRedirectMask, &e); + } } else { Uint32 flags; diff --git a/libs/SDL2/src/video/x11/SDL_x11window.h b/libs/SDL2/src/video/x11/SDL_x11window.h index a3424ff6..3a3e894f 100644 --- a/libs/SDL2/src/video/x11/SDL_x11window.h +++ b/libs/SDL2/src/video/x11/SDL_x11window.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -56,10 +56,15 @@ typedef struct GC gc; XIC ic; SDL_bool created; + int border_left; + int border_right; + int border_top; + int border_bottom; PendingFocusEnum pending_focus; Uint32 pending_focus_time; XConfigureEvent last_xconfigure; struct SDL_VideoData *videodata; + unsigned long user_time; Atom xdnd_req; Window xdnd_source; #if SDL_VIDEO_OPENGL_EGL @@ -78,6 +83,10 @@ extern void X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon); extern void X11_SetWindowPosition(_THIS, SDL_Window * window); extern void X11_SetWindowMinimumSize(_THIS, SDL_Window * window); extern void X11_SetWindowMaximumSize(_THIS, SDL_Window * window); +extern int X11_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right); +extern int X11_SetWindowOpacity(_THIS, SDL_Window * window, float opacity); +extern int X11_SetWindowModalFor(_THIS, SDL_Window * modal_window, SDL_Window * parent_window); +extern int X11_SetWindowInputFocus(_THIS, SDL_Window * window); extern void X11_SetWindowSize(_THIS, SDL_Window * window); extern void X11_ShowWindow(_THIS, SDL_Window * window); extern void X11_HideWindow(_THIS, SDL_Window * window); diff --git a/libs/SDL2/src/video/x11/SDL_x11xinput2.c b/libs/SDL2/src/video/x11/SDL_x11xinput2.c index c74e027c..bed4234f 100644 --- a/libs/SDL2/src/video/x11/SDL_x11xinput2.c +++ b/libs/SDL2/src/video/x11/SDL_x11xinput2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -118,6 +118,8 @@ X11_InitXinput2(_THIS) eventmask.mask = mask; XISetMask(mask, XI_RawMotion); + XISetMask(mask, XI_RawButtonPress); + XISetMask(mask, XI_RawButtonRelease); if (X11_XISelectEvents(data->display,DefaultRootWindow(data->display),&eventmask,1) != Success) { return; @@ -140,6 +142,8 @@ X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie) static Time prev_time = 0; static double prev_rel_coords[2]; + videodata->global_mouse_changed = SDL_TRUE; + if (!mouse->relative_mode || mouse->relative_mode_warp) { return 0; } @@ -158,6 +162,12 @@ X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie) return 1; } break; + + case XI_RawButtonPress: + case XI_RawButtonRelease: + videodata->global_mouse_changed = SDL_TRUE; + break; + #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH case XI_TouchBegin: { const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data; diff --git a/libs/SDL2/src/video/x11/SDL_x11xinput2.h b/libs/SDL2/src/video/x11/SDL_x11xinput2.h index 06d3c990..ed8dd1a4 100644 --- a/libs/SDL2/src/video/x11/SDL_x11xinput2.h +++ b/libs/SDL2/src/video/x11/SDL_x11xinput2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/edid-parse.c b/libs/SDL2/src/video/x11/edid-parse.c index 2c145e23..57f225b8 100644 --- a/libs/SDL2/src/video/x11/edid-parse.c +++ b/libs/SDL2/src/video/x11/edid-parse.c @@ -21,6 +21,8 @@ */ /* Author: Soren Sandmann */ +#include "../../SDL_internal.h" +#include "SDL_stdinc.h" #include "edid.h" #include @@ -247,7 +249,7 @@ decode_fraction (int high, int low) high = (high << 2) | low; for (i = 0; i < 10; ++i) - result += get_bit (high, i) * pow (2, i - 10); + result += get_bit (high, i) * SDL_pow (2, i - 10); return result; } diff --git a/libs/SDL2/src/video/x11/imKStoUCS.c b/libs/SDL2/src/video/x11/imKStoUCS.c index e4f08646..40e22424 100644 --- a/libs/SDL2/src/video/x11/imKStoUCS.c +++ b/libs/SDL2/src/video/x11/imKStoUCS.c @@ -1,297 +1,296 @@ -/* Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved. +/* +Copyright (C) 2003-2006,2008 Jamey Sharp, Josh Triplett +Copyright © 2009 Red Hat, Inc. +Copyright 1990-1992,1999,2000,2004,2009,2010 Oracle and/or its affiliates. +All rights reserved. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is fur- -nished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- -NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the XFree86 Project shall not -be used in advertising or otherwise to promote the sale, use or other deal- -ings in this Software without prior written authorization from the XFree86 -Project. +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. */ + #include "../../SDL_internal.h" #if SDL_VIDEO_DRIVER_X11 - -/* $XFree86: xc/lib/X11/imKStoUCS.c,v 1.4 2003/04/29 11:29:18 pascal Exp $ */ - #include #include "imKStoUCS.h" static unsigned short const keysym_to_unicode_1a1_1ff[] = { - 0x0104, 0x02d8, 0x0141, 0x0000, 0x013d, 0x015a, 0x0000, /* 0x01a0-0x01a7 */ - 0x0000, 0x0160, 0x015e, 0x0164, 0x0179, 0x0000, 0x017d, 0x017b, /* 0x01a8-0x01af */ - 0x0000, 0x0105, 0x02db, 0x0142, 0x0000, 0x013e, 0x015b, 0x02c7, /* 0x01b0-0x01b7 */ - 0x0000, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, /* 0x01b8-0x01bf */ - 0x0154, 0x0000, 0x0000, 0x0102, 0x0000, 0x0139, 0x0106, 0x0000, /* 0x01c0-0x01c7 */ - 0x010c, 0x0000, 0x0118, 0x0000, 0x011a, 0x0000, 0x0000, 0x010e, /* 0x01c8-0x01cf */ - 0x0110, 0x0143, 0x0147, 0x0000, 0x0000, 0x0150, 0x0000, 0x0000, /* 0x01d0-0x01d7 */ - 0x0158, 0x016e, 0x0000, 0x0170, 0x0000, 0x0000, 0x0162, 0x0000, /* 0x01d8-0x01df */ - 0x0155, 0x0000, 0x0000, 0x0103, 0x0000, 0x013a, 0x0107, 0x0000, /* 0x01e0-0x01e7 */ - 0x010d, 0x0000, 0x0119, 0x0000, 0x011b, 0x0000, 0x0000, 0x010f, /* 0x01e8-0x01ef */ - 0x0111, 0x0144, 0x0148, 0x0000, 0x0000, 0x0151, 0x0000, 0x0000, /* 0x01f0-0x01f7 */ - 0x0159, 0x016f, 0x0000, 0x0171, 0x0000, 0x0000, 0x0163, 0x02d9 /* 0x01f8-0x01ff */ + 0x0104, 0x02d8, 0x0141, 0x0000, 0x013d, 0x015a, 0x0000, /* 0x01a0-0x01a7 */ + 0x0000, 0x0160, 0x015e, 0x0164, 0x0179, 0x0000, 0x017d, 0x017b, /* 0x01a8-0x01af */ + 0x0000, 0x0105, 0x02db, 0x0142, 0x0000, 0x013e, 0x015b, 0x02c7, /* 0x01b0-0x01b7 */ + 0x0000, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, /* 0x01b8-0x01bf */ + 0x0154, 0x0000, 0x0000, 0x0102, 0x0000, 0x0139, 0x0106, 0x0000, /* 0x01c0-0x01c7 */ + 0x010c, 0x0000, 0x0118, 0x0000, 0x011a, 0x0000, 0x0000, 0x010e, /* 0x01c8-0x01cf */ + 0x0110, 0x0143, 0x0147, 0x0000, 0x0000, 0x0150, 0x0000, 0x0000, /* 0x01d0-0x01d7 */ + 0x0158, 0x016e, 0x0000, 0x0170, 0x0000, 0x0000, 0x0162, 0x0000, /* 0x01d8-0x01df */ + 0x0155, 0x0000, 0x0000, 0x0103, 0x0000, 0x013a, 0x0107, 0x0000, /* 0x01e0-0x01e7 */ + 0x010d, 0x0000, 0x0119, 0x0000, 0x011b, 0x0000, 0x0000, 0x010f, /* 0x01e8-0x01ef */ + 0x0111, 0x0144, 0x0148, 0x0000, 0x0000, 0x0151, 0x0000, 0x0000, /* 0x01f0-0x01f7 */ + 0x0159, 0x016f, 0x0000, 0x0171, 0x0000, 0x0000, 0x0163, 0x02d9 /* 0x01f8-0x01ff */ }; static unsigned short const keysym_to_unicode_2a1_2fe[] = { - 0x0126, 0x0000, 0x0000, 0x0000, 0x0000, 0x0124, 0x0000, /* 0x02a0-0x02a7 */ - 0x0000, 0x0130, 0x0000, 0x011e, 0x0134, 0x0000, 0x0000, 0x0000, /* 0x02a8-0x02af */ - 0x0000, 0x0127, 0x0000, 0x0000, 0x0000, 0x0000, 0x0125, 0x0000, /* 0x02b0-0x02b7 */ - 0x0000, 0x0131, 0x0000, 0x011f, 0x0135, 0x0000, 0x0000, 0x0000, /* 0x02b8-0x02bf */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x010a, 0x0108, 0x0000, /* 0x02c0-0x02c7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x02c8-0x02cf */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0120, 0x0000, 0x0000, /* 0x02d0-0x02d7 */ - 0x011c, 0x0000, 0x0000, 0x0000, 0x0000, 0x016c, 0x015c, 0x0000, /* 0x02d8-0x02df */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x010b, 0x0109, 0x0000, /* 0x02e0-0x02e7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x02e8-0x02ef */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0121, 0x0000, 0x0000, /* 0x02f0-0x02f7 */ - 0x011d, 0x0000, 0x0000, 0x0000, 0x0000, 0x016d, 0x015d /* 0x02f8-0x02ff */ + 0x0126, 0x0000, 0x0000, 0x0000, 0x0000, 0x0124, 0x0000, /* 0x02a0-0x02a7 */ + 0x0000, 0x0130, 0x0000, 0x011e, 0x0134, 0x0000, 0x0000, 0x0000, /* 0x02a8-0x02af */ + 0x0000, 0x0127, 0x0000, 0x0000, 0x0000, 0x0000, 0x0125, 0x0000, /* 0x02b0-0x02b7 */ + 0x0000, 0x0131, 0x0000, 0x011f, 0x0135, 0x0000, 0x0000, 0x0000, /* 0x02b8-0x02bf */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x010a, 0x0108, 0x0000, /* 0x02c0-0x02c7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x02c8-0x02cf */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0120, 0x0000, 0x0000, /* 0x02d0-0x02d7 */ + 0x011c, 0x0000, 0x0000, 0x0000, 0x0000, 0x016c, 0x015c, 0x0000, /* 0x02d8-0x02df */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x010b, 0x0109, 0x0000, /* 0x02e0-0x02e7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x02e8-0x02ef */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0121, 0x0000, 0x0000, /* 0x02f0-0x02f7 */ + 0x011d, 0x0000, 0x0000, 0x0000, 0x0000, 0x016d, 0x015d /* 0x02f8-0x02ff */ }; static unsigned short const keysym_to_unicode_3a2_3fe[] = { - 0x0138, 0x0156, 0x0000, 0x0128, 0x013b, 0x0000, /* 0x03a0-0x03a7 */ - 0x0000, 0x0000, 0x0112, 0x0122, 0x0166, 0x0000, 0x0000, 0x0000, /* 0x03a8-0x03af */ - 0x0000, 0x0000, 0x0000, 0x0157, 0x0000, 0x0129, 0x013c, 0x0000, /* 0x03b0-0x03b7 */ - 0x0000, 0x0000, 0x0113, 0x0123, 0x0167, 0x014a, 0x0000, 0x014b, /* 0x03b8-0x03bf */ - 0x0100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x012e, /* 0x03c0-0x03c7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0116, 0x0000, 0x0000, 0x012a, /* 0x03c8-0x03cf */ - 0x0000, 0x0145, 0x014c, 0x0136, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x03d0-0x03d7 */ - 0x0000, 0x0172, 0x0000, 0x0000, 0x0000, 0x0168, 0x016a, 0x0000, /* 0x03d8-0x03df */ - 0x0101, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x012f, /* 0x03e0-0x03e7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0117, 0x0000, 0x0000, 0x012b, /* 0x03e8-0x03ef */ - 0x0000, 0x0146, 0x014d, 0x0137, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x03f0-0x03f7 */ - 0x0000, 0x0173, 0x0000, 0x0000, 0x0000, 0x0169, 0x016b /* 0x03f8-0x03ff */ + 0x0138, 0x0156, 0x0000, 0x0128, 0x013b, 0x0000, /* 0x03a0-0x03a7 */ + 0x0000, 0x0000, 0x0112, 0x0122, 0x0166, 0x0000, 0x0000, 0x0000, /* 0x03a8-0x03af */ + 0x0000, 0x0000, 0x0000, 0x0157, 0x0000, 0x0129, 0x013c, 0x0000, /* 0x03b0-0x03b7 */ + 0x0000, 0x0000, 0x0113, 0x0123, 0x0167, 0x014a, 0x0000, 0x014b, /* 0x03b8-0x03bf */ + 0x0100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x012e, /* 0x03c0-0x03c7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0116, 0x0000, 0x0000, 0x012a, /* 0x03c8-0x03cf */ + 0x0000, 0x0145, 0x014c, 0x0136, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x03d0-0x03d7 */ + 0x0000, 0x0172, 0x0000, 0x0000, 0x0000, 0x0168, 0x016a, 0x0000, /* 0x03d8-0x03df */ + 0x0101, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x012f, /* 0x03e0-0x03e7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0117, 0x0000, 0x0000, 0x012b, /* 0x03e8-0x03ef */ + 0x0000, 0x0146, 0x014d, 0x0137, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x03f0-0x03f7 */ + 0x0000, 0x0173, 0x0000, 0x0000, 0x0000, 0x0169, 0x016b /* 0x03f8-0x03ff */ }; static unsigned short const keysym_to_unicode_4a1_4df[] = { - 0x3002, 0x3008, 0x3009, 0x3001, 0x30fb, 0x30f2, 0x30a1, /* 0x04a0-0x04a7 */ - 0x30a3, 0x30a5, 0x30a7, 0x30a9, 0x30e3, 0x30e5, 0x30e7, 0x30c3, /* 0x04a8-0x04af */ - 0x30fc, 0x30a2, 0x30a4, 0x30a6, 0x30a8, 0x30aa, 0x30ab, 0x30ad, /* 0x04b0-0x04b7 */ - 0x30af, 0x30b1, 0x30b3, 0x30b5, 0x30b7, 0x30b9, 0x30bb, 0x30bd, /* 0x04b8-0x04bf */ - 0x30bf, 0x30c1, 0x30c4, 0x30c6, 0x30c8, 0x30ca, 0x30cb, 0x30cc, /* 0x04c0-0x04c7 */ - 0x30cd, 0x30ce, 0x30cf, 0x30d2, 0x30d5, 0x30d8, 0x30db, 0x30de, /* 0x04c8-0x04cf */ - 0x30df, 0x30e0, 0x30e1, 0x30e2, 0x30e4, 0x30e6, 0x30e8, 0x30e9, /* 0x04d0-0x04d7 */ - 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ef, 0x30f3, 0x309b, 0x309c /* 0x04d8-0x04df */ + 0x3002, 0x3008, 0x3009, 0x3001, 0x30fb, 0x30f2, 0x30a1, /* 0x04a0-0x04a7 */ + 0x30a3, 0x30a5, 0x30a7, 0x30a9, 0x30e3, 0x30e5, 0x30e7, 0x30c3, /* 0x04a8-0x04af */ + 0x30fc, 0x30a2, 0x30a4, 0x30a6, 0x30a8, 0x30aa, 0x30ab, 0x30ad, /* 0x04b0-0x04b7 */ + 0x30af, 0x30b1, 0x30b3, 0x30b5, 0x30b7, 0x30b9, 0x30bb, 0x30bd, /* 0x04b8-0x04bf */ + 0x30bf, 0x30c1, 0x30c4, 0x30c6, 0x30c8, 0x30ca, 0x30cb, 0x30cc, /* 0x04c0-0x04c7 */ + 0x30cd, 0x30ce, 0x30cf, 0x30d2, 0x30d5, 0x30d8, 0x30db, 0x30de, /* 0x04c8-0x04cf */ + 0x30df, 0x30e0, 0x30e1, 0x30e2, 0x30e4, 0x30e6, 0x30e8, 0x30e9, /* 0x04d0-0x04d7 */ + 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ef, 0x30f3, 0x309b, 0x309c /* 0x04d8-0x04df */ }; static unsigned short const keysym_to_unicode_590_5fe[] = { - 0x06f0, 0x06f1, 0x06f2, 0x06f3, 0x06f4, 0x06f5, 0x06f6, 0x06f7, /* 0x0590-0x0597 */ - 0x06f8, 0x06f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x0598-0x059f */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x066a, 0x0670, 0x0679, /* 0x05a0-0x05a7 */ + 0x06f0, 0x06f1, 0x06f2, 0x06f3, 0x06f4, 0x06f5, 0x06f6, 0x06f7, /* 0x0590-0x0597 */ + 0x06f8, 0x06f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x0598-0x059f */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x066a, 0x0670, 0x0679, /* 0x05a0-0x05a7 */ - 0x067e, 0x0686, 0x0688, 0x0691, 0x060c, 0x0000, 0x06d4, 0x0000, /* 0x05ac-0x05af */ - 0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, /* 0x05b0-0x05b7 */ - 0x0668, 0x0669, 0x0000, 0x061b, 0x0000, 0x0000, 0x0000, 0x061f, /* 0x05b8-0x05bf */ - 0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, /* 0x05c0-0x05c7 */ - 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, /* 0x05c8-0x05cf */ - 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, /* 0x05d0-0x05d7 */ - 0x0638, 0x0639, 0x063a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x05d8-0x05df */ - 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, /* 0x05e0-0x05e7 */ - 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, /* 0x05e8-0x05ef */ - 0x0650, 0x0651, 0x0652, 0x0653, 0x0654, 0x0655, 0x0698, 0x06a4, /* 0x05f0-0x05f7 */ - 0x06a9, 0x06af, 0x06ba, 0x06be, 0x06cc, 0x06d2, 0x06c1 /* 0x05f8-0x05fe */ + 0x067e, 0x0686, 0x0688, 0x0691, 0x060c, 0x0000, 0x06d4, 0x0000, /* 0x05ac-0x05af */ + 0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, /* 0x05b0-0x05b7 */ + 0x0668, 0x0669, 0x0000, 0x061b, 0x0000, 0x0000, 0x0000, 0x061f, /* 0x05b8-0x05bf */ + 0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, /* 0x05c0-0x05c7 */ + 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, /* 0x05c8-0x05cf */ + 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, /* 0x05d0-0x05d7 */ + 0x0638, 0x0639, 0x063a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x05d8-0x05df */ + 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, /* 0x05e0-0x05e7 */ + 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, /* 0x05e8-0x05ef */ + 0x0650, 0x0651, 0x0652, 0x0653, 0x0654, 0x0655, 0x0698, 0x06a4, /* 0x05f0-0x05f7 */ + 0x06a9, 0x06af, 0x06ba, 0x06be, 0x06cc, 0x06d2, 0x06c1 /* 0x05f8-0x05fe */ }; -static unsigned short const keysym_to_unicode_680_6ff[] = { - 0x0492, 0x0496, 0x049a, 0x049c, 0x04a2, 0x04ae, 0x04b0, 0x04b2, /* 0x0680-0x0687 */ - 0x04b6, 0x04b8, 0x04ba, 0x0000, 0x04d8, 0x04e2, 0x04e8, 0x04ee, /* 0x0688-0x068f */ - 0x0493, 0x0497, 0x049b, 0x049d, 0x04a3, 0x04af, 0x04b1, 0x04b3, /* 0x0690-0x0697 */ - 0x04b7, 0x04b9, 0x04bb, 0x0000, 0x04d9, 0x04e3, 0x04e9, 0x04ef, /* 0x0698-0x069f */ - 0x0000, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, /* 0x06a0-0x06a7 */ - 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0491, 0x045e, 0x045f, /* 0x06a8-0x06af */ - 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, /* 0x06b0-0x06b7 */ - 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x0490, 0x040e, 0x040f, /* 0x06b8-0x06bf */ - 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, /* 0x06c0-0x06c7 */ - 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, /* 0x06c8-0x06cf */ - 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, /* 0x06d0-0x06d7 */ - 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, /* 0x06d8-0x06df */ - 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, /* 0x06e0-0x06e7 */ - 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, /* 0x06e8-0x06ef */ - 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, /* 0x06f0-0x06f7 */ - 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a /* 0x06f8-0x06ff */ +static unsigned short keysym_to_unicode_680_6ff[] = { + 0x0492, 0x0496, 0x049a, 0x049c, 0x04a2, 0x04ae, 0x04b0, 0x04b2, /* 0x0680-0x0687 */ + 0x04b6, 0x04b8, 0x04ba, 0x0000, 0x04d8, 0x04e2, 0x04e8, 0x04ee, /* 0x0688-0x068f */ + 0x0493, 0x0497, 0x049b, 0x049d, 0x04a3, 0x04af, 0x04b1, 0x04b3, /* 0x0690-0x0697 */ + 0x04b7, 0x04b9, 0x04bb, 0x0000, 0x04d9, 0x04e3, 0x04e9, 0x04ef, /* 0x0698-0x069f */ + 0x0000, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, /* 0x06a0-0x06a7 */ + 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0491, 0x045e, 0x045f, /* 0x06a8-0x06af */ + 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, /* 0x06b0-0x06b7 */ + 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x0490, 0x040e, 0x040f, /* 0x06b8-0x06bf */ + 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, /* 0x06c0-0x06c7 */ + 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, /* 0x06c8-0x06cf */ + 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, /* 0x06d0-0x06d7 */ + 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, /* 0x06d8-0x06df */ + 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, /* 0x06e0-0x06e7 */ + 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, /* 0x06e8-0x06ef */ + 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, /* 0x06f0-0x06f7 */ + 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a /* 0x06f8-0x06ff */ }; static unsigned short const keysym_to_unicode_7a1_7f9[] = { - 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, /* 0x07a0-0x07a7 */ - 0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, /* 0x07a8-0x07af */ - 0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, /* 0x07b0-0x07b7 */ - 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x07b8-0x07bf */ - 0x0000, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, /* 0x07c0-0x07c7 */ - 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, /* 0x07c8-0x07cf */ - 0x03a0, 0x03a1, 0x03a3, 0x0000, 0x03a4, 0x03a5, 0x03a6, 0x03a7, /* 0x07d0-0x07d7 */ - 0x03a8, 0x03a9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x07d8-0x07df */ - 0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, /* 0x07e0-0x07e7 */ - 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, /* 0x07e8-0x07ef */ - 0x03c0, 0x03c1, 0x03c3, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, /* 0x07f0-0x07f7 */ - 0x03c8, 0x03c9 /* 0x07f8-0x07ff */ + 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, /* 0x07a0-0x07a7 */ + 0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, /* 0x07a8-0x07af */ + 0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, /* 0x07b0-0x07b7 */ + 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x07b8-0x07bf */ + 0x0000, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, /* 0x07c0-0x07c7 */ + 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, /* 0x07c8-0x07cf */ + 0x03a0, 0x03a1, 0x03a3, 0x0000, 0x03a4, 0x03a5, 0x03a6, 0x03a7, /* 0x07d0-0x07d7 */ + 0x03a8, 0x03a9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x07d8-0x07df */ + 0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, /* 0x07e0-0x07e7 */ + 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, /* 0x07e8-0x07ef */ + 0x03c0, 0x03c1, 0x03c3, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, /* 0x07f0-0x07f7 */ + 0x03c8, 0x03c9 /* 0x07f8-0x07ff */ }; static unsigned short const keysym_to_unicode_8a4_8fe[] = { - 0x2320, 0x2321, 0x0000, 0x231c, /* 0x08a0-0x08a7 */ - 0x231d, 0x231e, 0x231f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08a8-0x08af */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08b0-0x08b7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x2264, 0x2260, 0x2265, 0x222b, /* 0x08b8-0x08bf */ - 0x2234, 0x0000, 0x221e, 0x0000, 0x0000, 0x2207, 0x0000, 0x0000, /* 0x08c0-0x08c7 */ - 0x2245, 0x2246, 0x0000, 0x0000, 0x0000, 0x0000, 0x22a2, 0x0000, /* 0x08c8-0x08cf */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x221a, 0x0000, /* 0x08d0-0x08d7 */ - 0x0000, 0x0000, 0x2282, 0x2283, 0x2229, 0x222a, 0x2227, 0x2228, /* 0x08d8-0x08df */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08e0-0x08e7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08e8-0x08ef */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, /* 0x08f0-0x08f7 */ - 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193 /* 0x08f8-0x08ff */ + 0x2320, 0x2321, 0x0000, 0x231c, /* 0x08a0-0x08a7 */ + 0x231d, 0x231e, 0x231f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08a8-0x08af */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08b0-0x08b7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x2264, 0x2260, 0x2265, 0x222b, /* 0x08b8-0x08bf */ + 0x2234, 0x0000, 0x221e, 0x0000, 0x0000, 0x2207, 0x0000, 0x0000, /* 0x08c0-0x08c7 */ + 0x2245, 0x2246, 0x0000, 0x0000, 0x0000, 0x0000, 0x21d2, 0x0000, /* 0x08c8-0x08cf */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x221a, 0x0000, /* 0x08d0-0x08d7 */ + 0x0000, 0x0000, 0x2282, 0x2283, 0x2229, 0x222a, 0x2227, 0x2228, /* 0x08d8-0x08df */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08e0-0x08e7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2202, /* 0x08e8-0x08ef */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, /* 0x08f0-0x08f7 */ + 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193 /* 0x08f8-0x08ff */ }; static unsigned short const keysym_to_unicode_9df_9f8[] = { - 0x2422, /* 0x09d8-0x09df */ - 0x2666, 0x25a6, 0x2409, 0x240c, 0x240d, 0x240a, 0x0000, 0x0000, /* 0x09e0-0x09e7 */ - 0x240a, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c, 0x2500, /* 0x09e8-0x09ef */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x251c, 0x2524, 0x2534, 0x252c, /* 0x09f0-0x09f7 */ - 0x2502 /* 0x09f8-0x09ff */ + 0x2422, /* 0x09d8-0x09df */ + 0x2666, 0x25a6, 0x2409, 0x240c, 0x240d, 0x240a, 0x0000, 0x0000, /* 0x09e0-0x09e7 */ + 0x240a, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c, 0x2500, /* 0x09e8-0x09ef */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x251c, 0x2524, 0x2534, 0x252c, /* 0x09f0-0x09f7 */ + 0x2502 /* 0x09f8-0x09ff */ }; static unsigned short const keysym_to_unicode_aa1_afe[] = { - 0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, /* 0x0aa0-0x0aa7 */ - 0x200a, 0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, /* 0x0aa8-0x0aaf */ - 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, /* 0x0ab0-0x0ab7 */ - 0x2105, 0x0000, 0x0000, 0x2012, 0x2039, 0x2024, 0x203a, 0x0000, /* 0x0ab8-0x0abf */ - 0x0000, 0x0000, 0x0000, 0x215b, 0x215c, 0x215d, 0x215e, 0x0000, /* 0x0ac0-0x0ac7 */ - 0x0000, 0x2122, 0x2120, 0x0000, 0x25c1, 0x25b7, 0x25cb, 0x25ad, /* 0x0ac8-0x0acf */ - 0x2018, 0x2019, 0x201c, 0x201d, 0x211e, 0x0000, 0x2032, 0x2033, /* 0x0ad0-0x0ad7 */ - 0x0000, 0x271d, 0x0000, 0x220e, 0x25c2, 0x2023, 0x25cf, 0x25ac, /* 0x0ad8-0x0adf */ - 0x25e6, 0x25ab, 0x25ae, 0x25b5, 0x25bf, 0x2606, 0x2022, 0x25aa, /* 0x0ae0-0x0ae7 */ - 0x25b4, 0x25be, 0x261a, 0x261b, 0x2663, 0x2666, 0x2665, 0x0000, /* 0x0ae8-0x0aef */ - 0x2720, 0x2020, 0x2021, 0x2713, 0x2612, 0x266f, 0x266d, 0x2642, /* 0x0af0-0x0af7 */ - 0x2640, 0x2121, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e /* 0x0af8-0x0aff */ + 0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, /* 0x0aa0-0x0aa7 */ + 0x200a, 0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, /* 0x0aa8-0x0aaf */ + 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, /* 0x0ab0-0x0ab7 */ + 0x2105, 0x0000, 0x0000, 0x2012, 0x2039, 0x2024, 0x203a, 0x0000, /* 0x0ab8-0x0abf */ + 0x0000, 0x0000, 0x0000, 0x215b, 0x215c, 0x215d, 0x215e, 0x0000, /* 0x0ac0-0x0ac7 */ + 0x0000, 0x2122, 0x2120, 0x0000, 0x25c1, 0x25b7, 0x25cb, 0x25ad, /* 0x0ac8-0x0acf */ + 0x2018, 0x2019, 0x201c, 0x201d, 0x211e, 0x2030, 0x2032, 0x2033, /* 0x0ad0-0x0ad7 */ + 0x0000, 0x271d, 0x0000, 0x220e, 0x25c2, 0x2023, 0x25cf, 0x25ac, /* 0x0ad8-0x0adf */ + 0x25e6, 0x25ab, 0x25ae, 0x25b5, 0x25bf, 0x2606, 0x2022, 0x25aa, /* 0x0ae0-0x0ae7 */ + 0x25b4, 0x25be, 0x261a, 0x261b, 0x2663, 0x2666, 0x2665, 0x0000, /* 0x0ae8-0x0aef */ + 0x2720, 0x2020, 0x2021, 0x2713, 0x2612, 0x266f, 0x266d, 0x2642, /* 0x0af0-0x0af7 */ + 0x2640, 0x2121, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e /* 0x0af8-0x0aff */ }; /* none of the APL keysyms match the Unicode characters */ static unsigned short const keysym_to_unicode_cdf_cfa[] = { - 0x2017, /* 0x0cd8-0x0cdf */ - 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, /* 0x0ce0-0x0ce7 */ - 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, /* 0x0ce8-0x0cef */ - 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, /* 0x0cf0-0x0cf7 */ - 0x05e8, 0x05e9, 0x05ea /* 0x0cf8-0x0cff */ + 0x2017, /* 0x0cd8-0x0cdf */ + 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, /* 0x0ce0-0x0ce7 */ + 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, /* 0x0ce8-0x0cef */ + 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, /* 0x0cf0-0x0cf7 */ + 0x05e8, 0x05e9, 0x05ea /* 0x0cf8-0x0cff */ }; static unsigned short const keysym_to_unicode_da1_df9[] = { - 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, /* 0x0da0-0x0da7 */ - 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, /* 0x0da8-0x0daf */ - 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, /* 0x0db0-0x0db7 */ - 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, /* 0x0db8-0x0dbf */ - 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, /* 0x0dc0-0x0dc7 */ - 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, /* 0x0dc8-0x0dcf */ - 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, /* 0x0dd0-0x0dd7 */ - 0x0e38, 0x0e39, 0x0e3a, 0x0000, 0x0000, 0x0000, 0x0e3e, 0x0e3f, /* 0x0dd8-0x0ddf */ - 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, /* 0x0de0-0x0de7 */ - 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0000, 0x0000, /* 0x0de8-0x0def */ - 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, /* 0x0df0-0x0df7 */ - 0x0e58, 0x0e59 /* 0x0df8-0x0dff */ + 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, /* 0x0da0-0x0da7 */ + 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, /* 0x0da8-0x0daf */ + 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, /* 0x0db0-0x0db7 */ + 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, /* 0x0db8-0x0dbf */ + 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, /* 0x0dc0-0x0dc7 */ + 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, /* 0x0dc8-0x0dcf */ + 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, /* 0x0dd0-0x0dd7 */ + 0x0e38, 0x0e39, 0x0e3a, 0x0000, 0x0000, 0x0000, 0x0e3e, 0x0e3f, /* 0x0dd8-0x0ddf */ + 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, /* 0x0de0-0x0de7 */ + 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0000, 0x0000, /* 0x0de8-0x0def */ + 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, /* 0x0df0-0x0df7 */ + 0x0e58, 0x0e59 /* 0x0df8-0x0dff */ }; static unsigned short const keysym_to_unicode_ea0_eff[] = { - 0x0000, 0x1101, 0x1101, 0x11aa, 0x1102, 0x11ac, 0x11ad, 0x1103, /* 0x0ea0-0x0ea7 */ - 0x1104, 0x1105, 0x11b0, 0x11b1, 0x11b2, 0x11b3, 0x11b4, 0x11b5, /* 0x0ea8-0x0eaf */ - 0x11b6, 0x1106, 0x1107, 0x1108, 0x11b9, 0x1109, 0x110a, 0x110b, /* 0x0eb0-0x0eb7 */ - 0x110c, 0x110d, 0x110e, 0x110f, 0x1110, 0x1111, 0x1112, 0x1161, /* 0x0eb8-0x0ebf */ - 0x1162, 0x1163, 0x1164, 0x1165, 0x1166, 0x1167, 0x1168, 0x1169, /* 0x0ec0-0x0ec7 */ - 0x116a, 0x116b, 0x116c, 0x116d, 0x116e, 0x116f, 0x1170, 0x1171, /* 0x0ec8-0x0ecf */ - 0x1172, 0x1173, 0x1174, 0x1175, 0x11a8, 0x11a9, 0x11aa, 0x11ab, /* 0x0ed0-0x0ed7 */ - 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, /* 0x0ed8-0x0edf */ - 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba, 0x11bb, /* 0x0ee0-0x0ee7 */ - 0x11bc, 0x11bd, 0x11be, 0x11bf, 0x11c0, 0x11c1, 0x11c2, 0x0000, /* 0x0ee8-0x0eef */ - 0x0000, 0x0000, 0x1140, 0x0000, 0x0000, 0x1159, 0x119e, 0x0000, /* 0x0ef0-0x0ef7 */ - 0x11eb, 0x0000, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9, /* 0x0ef8-0x0eff */ + 0x0000, 0x1101, 0x1101, 0x11aa, 0x1102, 0x11ac, 0x11ad, 0x1103, /* 0x0ea0-0x0ea7 */ + 0x1104, 0x1105, 0x11b0, 0x11b1, 0x11b2, 0x11b3, 0x11b4, 0x11b5, /* 0x0ea8-0x0eaf */ + 0x11b6, 0x1106, 0x1107, 0x1108, 0x11b9, 0x1109, 0x110a, 0x110b, /* 0x0eb0-0x0eb7 */ + 0x110c, 0x110d, 0x110e, 0x110f, 0x1110, 0x1111, 0x1112, 0x1161, /* 0x0eb8-0x0ebf */ + 0x1162, 0x1163, 0x1164, 0x1165, 0x1166, 0x1167, 0x1168, 0x1169, /* 0x0ec0-0x0ec7 */ + 0x116a, 0x116b, 0x116c, 0x116d, 0x116e, 0x116f, 0x1170, 0x1171, /* 0x0ec8-0x0ecf */ + 0x1172, 0x1173, 0x1174, 0x1175, 0x11a8, 0x11a9, 0x11aa, 0x11ab, /* 0x0ed0-0x0ed7 */ + 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, /* 0x0ed8-0x0edf */ + 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba, 0x11bb, /* 0x0ee0-0x0ee7 */ + 0x11bc, 0x11bd, 0x11be, 0x11bf, 0x11c0, 0x11c1, 0x11c2, 0x0000, /* 0x0ee8-0x0eef */ + 0x0000, 0x0000, 0x1140, 0x0000, 0x0000, 0x1159, 0x119e, 0x0000, /* 0x0ef0-0x0ef7 */ + 0x11eb, 0x0000, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9, /* 0x0ef8-0x0eff */ }; -static unsigned short const keysym_to_unicode_12a1_12fe[] = { - 0x1e02, 0x1e03, 0x0000, 0x0000, 0x0000, 0x1e0a, 0x0000, /* 0x12a0-0x12a7 */ - 0x1e80, 0x0000, 0x1e82, 0x1e0b, 0x1ef2, 0x0000, 0x0000, 0x0000, /* 0x12a8-0x12af */ - 0x1e1e, 0x1e1f, 0x0000, 0x0000, 0x1e40, 0x1e41, 0x0000, 0x1e56, /* 0x12b0-0x12b7 */ - 0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61, /* 0x12b8-0x12bf */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12c0-0x12c7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12c8-0x12cf */ - 0x0174, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1e6a, /* 0x12d0-0x12d7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0176, 0x0000, /* 0x12d8-0x12df */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e0-0x12e7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e8-0x12ef */ - 0x0175, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1e6b, /* 0x12f0-0x12f7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0177 /* 0x12f0-0x12ff */ +static unsigned short keysym_to_unicode_12a1_12fe[] = { + 0x1e02, 0x1e03, 0x0000, 0x0000, 0x0000, 0x1e0a, 0x0000, /* 0x12a0-0x12a7 */ + 0x1e80, 0x0000, 0x1e82, 0x1e0b, 0x1ef2, 0x0000, 0x0000, 0x0000, /* 0x12a8-0x12af */ + 0x1e1e, 0x1e1f, 0x0000, 0x0000, 0x1e40, 0x1e41, 0x0000, 0x1e56, /* 0x12b0-0x12b7 */ + 0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61, /* 0x12b8-0x12bf */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12c0-0x12c7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12c8-0x12cf */ + 0x0174, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1e6a, /* 0x12d0-0x12d7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0176, 0x0000, /* 0x12d8-0x12df */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e0-0x12e7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e8-0x12ef */ + 0x0175, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1e6b, /* 0x12f0-0x12f7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0177 /* 0x12f0-0x12ff */ }; static unsigned short const keysym_to_unicode_13bc_13be[] = { - 0x0152, 0x0153, 0x0178 /* 0x13b8-0x13bf */ + 0x0152, 0x0153, 0x0178 /* 0x13b8-0x13bf */ }; -static unsigned short const keysym_to_unicode_14a1_14ff[] = { - 0x2741, 0x00a7, 0x0589, 0x0029, 0x0028, 0x00bb, 0x00ab, /* 0x14a0-0x14a7 */ - 0x2014, 0x002e, 0x055d, 0x002c, 0x2013, 0x058a, 0x2026, 0x055c, /* 0x14a8-0x14af */ - 0x055b, 0x055e, 0x0531, 0x0561, 0x0532, 0x0562, 0x0533, 0x0563, /* 0x14b0-0x14b7 */ - 0x0534, 0x0564, 0x0535, 0x0565, 0x0536, 0x0566, 0x0537, 0x0567, /* 0x14b8-0x14bf */ - 0x0538, 0x0568, 0x0539, 0x0569, 0x053a, 0x056a, 0x053b, 0x056b, /* 0x14c0-0x14c7 */ - 0x053c, 0x056c, 0x053d, 0x056d, 0x053e, 0x056e, 0x053f, 0x056f, /* 0x14c8-0x14cf */ - 0x0540, 0x0570, 0x0541, 0x0571, 0x0542, 0x0572, 0x0543, 0x0573, /* 0x14d0-0x14d7 */ - 0x0544, 0x0574, 0x0545, 0x0575, 0x0546, 0x0576, 0x0547, 0x0577, /* 0x14d8-0x14df */ - 0x0548, 0x0578, 0x0549, 0x0579, 0x054a, 0x057a, 0x054b, 0x057b, /* 0x14e0-0x14e7 */ - 0x054c, 0x057c, 0x054d, 0x057d, 0x054e, 0x057e, 0x054f, 0x057f, /* 0x14e8-0x14ef */ - 0x0550, 0x0580, 0x0551, 0x0581, 0x0552, 0x0582, 0x0553, 0x0583, /* 0x14f0-0x14f7 */ - 0x0554, 0x0584, 0x0555, 0x0585, 0x0556, 0x0586, 0x2019, 0x0027, /* 0x14f8-0x14ff */ +static unsigned short keysym_to_unicode_14a1_14ff[] = { + 0x2741, 0x00a7, 0x0589, 0x0029, 0x0028, 0x00bb, 0x00ab, /* 0x14a0-0x14a7 */ + 0x2014, 0x002e, 0x055d, 0x002c, 0x2013, 0x058a, 0x2026, 0x055c, /* 0x14a8-0x14af */ + 0x055b, 0x055e, 0x0531, 0x0561, 0x0532, 0x0562, 0x0533, 0x0563, /* 0x14b0-0x14b7 */ + 0x0534, 0x0564, 0x0535, 0x0565, 0x0536, 0x0566, 0x0537, 0x0567, /* 0x14b8-0x14bf */ + 0x0538, 0x0568, 0x0539, 0x0569, 0x053a, 0x056a, 0x053b, 0x056b, /* 0x14c0-0x14c7 */ + 0x053c, 0x056c, 0x053d, 0x056d, 0x053e, 0x056e, 0x053f, 0x056f, /* 0x14c8-0x14cf */ + 0x0540, 0x0570, 0x0541, 0x0571, 0x0542, 0x0572, 0x0543, 0x0573, /* 0x14d0-0x14d7 */ + 0x0544, 0x0574, 0x0545, 0x0575, 0x0546, 0x0576, 0x0547, 0x0577, /* 0x14d8-0x14df */ + 0x0548, 0x0578, 0x0549, 0x0579, 0x054a, 0x057a, 0x054b, 0x057b, /* 0x14e0-0x14e7 */ + 0x054c, 0x057c, 0x054d, 0x057d, 0x054e, 0x057e, 0x054f, 0x057f, /* 0x14e8-0x14ef */ + 0x0550, 0x0580, 0x0551, 0x0581, 0x0552, 0x0582, 0x0553, 0x0583, /* 0x14f0-0x14f7 */ + 0x0554, 0x0584, 0x0555, 0x0585, 0x0556, 0x0586, 0x2019, 0x0027, /* 0x14f8-0x14ff */ }; -static unsigned short const keysym_to_unicode_15d0_15f6[] = { - 0x10d0, 0x10d1, 0x10d2, 0x10d3, 0x10d4, 0x10d5, 0x10d6, 0x10d7, /* 0x15d0-0x15d7 */ - 0x10d8, 0x10d9, 0x10da, 0x10db, 0x10dc, 0x10dd, 0x10de, 0x10df, /* 0x15d8-0x15df */ - 0x10e0, 0x10e1, 0x10e2, 0x10e3, 0x10e4, 0x10e5, 0x10e6, 0x10e7, /* 0x15e0-0x15e7 */ - 0x10e8, 0x10e9, 0x10ea, 0x10eb, 0x10ec, 0x10ed, 0x10ee, 0x10ef, /* 0x15e8-0x15ef */ - 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6 /* 0x15f0-0x15f7 */ +static unsigned short keysym_to_unicode_15d0_15f6[] = { + 0x10d0, 0x10d1, 0x10d2, 0x10d3, 0x10d4, 0x10d5, 0x10d6, 0x10d7, /* 0x15d0-0x15d7 */ + 0x10d8, 0x10d9, 0x10da, 0x10db, 0x10dc, 0x10dd, 0x10de, 0x10df, /* 0x15d8-0x15df */ + 0x10e0, 0x10e1, 0x10e2, 0x10e3, 0x10e4, 0x10e5, 0x10e6, 0x10e7, /* 0x15e0-0x15e7 */ + 0x10e8, 0x10e9, 0x10ea, 0x10eb, 0x10ec, 0x10ed, 0x10ee, 0x10ef, /* 0x15e8-0x15ef */ + 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6 /* 0x15f0-0x15f7 */ }; -static unsigned short const keysym_to_unicode_16a0_16f6[] = { - 0x0000, 0x0000, 0xf0a2, 0x1e8a, 0x0000, 0xf0a5, 0x012c, 0xf0a7, /* 0x16a0-0x16a7 */ - 0xf0a8, 0x01b5, 0x01e6, 0x0000, 0x0000, 0x0000, 0x0000, 0x019f, /* 0x16a8-0x16af */ - 0x0000, 0x0000, 0xf0b2, 0x1e8b, 0x01d1, 0xf0b5, 0x012d, 0xf0b7, /* 0x16b0-0x16b7 */ - 0xf0b8, 0x01b6, 0x01e7, 0x0000, 0x0000, 0x01d2, 0x0000, 0x0275, /* 0x16b8-0x16bf */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x018f, 0x0000, /* 0x16c0-0x16c7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16c8-0x16cf */ - 0x0000, 0x1e36, 0xf0d2, 0xf0d3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d0-0x16d7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d8-0x16df */ - 0x0000, 0x1e37, 0xf0e2, 0xf0e3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e0-0x16e7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e8-0x16ef */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0259 /* 0x16f0-0x16f6 */ +static unsigned short keysym_to_unicode_16a0_16f6[] = { + 0x0000, 0x0000, 0xf0a2, 0x1e8a, 0x0000, 0xf0a5, 0x012c, 0xf0a7, /* 0x16a0-0x16a7 */ + 0xf0a8, 0x01b5, 0x01e6, 0x0000, 0x0000, 0x0000, 0x0000, 0x019f, /* 0x16a8-0x16af */ + 0x0000, 0x0000, 0xf0b2, 0x1e8b, 0x01d1, 0xf0b5, 0x012d, 0xf0b7, /* 0x16b0-0x16b7 */ + 0xf0b8, 0x01b6, 0x01e7, 0x0000, 0x0000, 0x01d2, 0x0000, 0x0275, /* 0x16b8-0x16bf */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x018f, 0x0000, /* 0x16c0-0x16c7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16c8-0x16cf */ + 0x0000, 0x1e36, 0xf0d2, 0xf0d3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d0-0x16d7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d8-0x16df */ + 0x0000, 0x1e37, 0xf0e2, 0xf0e3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e0-0x16e7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e8-0x16ef */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0259 /* 0x16f0-0x16f6 */ }; static unsigned short const keysym_to_unicode_1e9f_1eff[] = { - 0x0303, - 0x1ea0, 0x1ea1, 0x1ea2, 0x1ea3, 0x1ea4, 0x1ea5, 0x1ea6, 0x1ea7, /* 0x1ea0-0x1ea7 */ - 0x1ea8, 0x1ea9, 0x1eaa, 0x1eab, 0x1eac, 0x1ead, 0x1eae, 0x1eaf, /* 0x1ea8-0x1eaf */ - 0x1eb0, 0x1eb1, 0x1eb2, 0x1eb3, 0x1eb4, 0x1eb5, 0x1eb6, 0x1eb7, /* 0x1eb0-0x1eb7 */ - 0x1eb8, 0x1eb9, 0x1eba, 0x1ebb, 0x1ebc, 0x1ebd, 0x1ebe, 0x1ebf, /* 0x1eb8-0x1ebf */ - 0x1ec0, 0x1ec1, 0x1ec2, 0x1ec3, 0x1ec4, 0x1ec5, 0x1ec6, 0x1ec7, /* 0x1ec0-0x1ec7 */ - 0x1ec8, 0x1ec9, 0x1eca, 0x1ecb, 0x1ecc, 0x1ecd, 0x1ece, 0x1ecf, /* 0x1ec8-0x1ecf */ - 0x1ed0, 0x1ed1, 0x1ed2, 0x1ed3, 0x1ed4, 0x1ed5, 0x1ed6, 0x1ed7, /* 0x1ed0-0x1ed7 */ - 0x1ed8, 0x1ed9, 0x1eda, 0x1edb, 0x1edc, 0x1edd, 0x1ede, 0x1edf, /* 0x1ed8-0x1edf */ - 0x1ee0, 0x1ee1, 0x1ee2, 0x1ee3, 0x1ee4, 0x1ee5, 0x1ee6, 0x1ee7, /* 0x1ee0-0x1ee7 */ - 0x1ee8, 0x1ee9, 0x1eea, 0x1eeb, 0x1eec, 0x1eed, 0x1eee, 0x1eef, /* 0x1ee8-0x1eef */ - 0x1ef0, 0x1ef1, 0x0300, 0x0301, 0x1ef4, 0x1ef5, 0x1ef6, 0x1ef7, /* 0x1ef0-0x1ef7 */ - 0x1ef8, 0x1ef9, 0x01a0, 0x01a1, 0x01af, 0x01b0, 0x0309, 0x0323 /* 0x1ef8-0x1eff */ + 0x0303, + 0x1ea0, 0x1ea1, 0x1ea2, 0x1ea3, 0x1ea4, 0x1ea5, 0x1ea6, 0x1ea7, /* 0x1ea0-0x1ea7 */ + 0x1ea8, 0x1ea9, 0x1eaa, 0x1eab, 0x1eac, 0x1ead, 0x1eae, 0x1eaf, /* 0x1ea8-0x1eaf */ + 0x1eb0, 0x1eb1, 0x1eb2, 0x1eb3, 0x1eb4, 0x1eb5, 0x1eb6, 0x1eb7, /* 0x1eb0-0x1eb7 */ + 0x1eb8, 0x1eb9, 0x1eba, 0x1ebb, 0x1ebc, 0x1ebd, 0x1ebe, 0x1ebf, /* 0x1eb8-0x1ebf */ + 0x1ec0, 0x1ec1, 0x1ec2, 0x1ec3, 0x1ec4, 0x1ec5, 0x1ec6, 0x1ec7, /* 0x1ec0-0x1ec7 */ + 0x1ec8, 0x1ec9, 0x1eca, 0x1ecb, 0x1ecc, 0x1ecd, 0x1ece, 0x1ecf, /* 0x1ec8-0x1ecf */ + 0x1ed0, 0x1ed1, 0x1ed2, 0x1ed3, 0x1ed4, 0x1ed5, 0x1ed6, 0x1ed7, /* 0x1ed0-0x1ed7 */ + 0x1ed8, 0x1ed9, 0x1eda, 0x1edb, 0x1edc, 0x1edd, 0x1ede, 0x1edf, /* 0x1ed8-0x1edf */ + 0x1ee0, 0x1ee1, 0x1ee2, 0x1ee3, 0x1ee4, 0x1ee5, 0x1ee6, 0x1ee7, /* 0x1ee0-0x1ee7 */ + 0x1ee8, 0x1ee9, 0x1eea, 0x1eeb, 0x1eec, 0x1eed, 0x1eee, 0x1eef, /* 0x1ee8-0x1eef */ + 0x1ef0, 0x1ef1, 0x0300, 0x0301, 0x1ef4, 0x1ef5, 0x1ef6, 0x1ef7, /* 0x1ef0-0x1ef7 */ + 0x1ef8, 0x1ef9, 0x01a0, 0x01a1, 0x01af, 0x01b0, 0x0309, 0x0323 /* 0x1ef8-0x1eff */ }; static unsigned short const keysym_to_unicode_20a0_20ac[] = { - 0x20a0, 0x20a1, 0x20a2, 0x20a3, 0x20a4, 0x20a5, 0x20a6, 0x20a7, /* 0x20a0-0x20a7 */ - 0x20a8, 0x20a9, 0x20aa, 0x20ab, 0x20ac /* 0x20a8-0x20af */ + 0x20a0, 0x20a1, 0x20a2, 0x20a3, 0x20a4, 0x20a5, 0x20a6, 0x20a7, /* 0x20a0-0x20a7 */ + 0x20a8, 0x20a9, 0x20aa, 0x20ab, 0x20ac /* 0x20a8-0x20af */ }; unsigned int @@ -302,49 +301,50 @@ X11_KeySymToUcs4(KeySym keysym) return (keysym & 0x00ffffff); if (keysym > 0 && keysym < 0x100) - return keysym; + return keysym; else if (keysym > 0x1a0 && keysym < 0x200) - return keysym_to_unicode_1a1_1ff[keysym - 0x1a1]; + return keysym_to_unicode_1a1_1ff[keysym - 0x1a1]; else if (keysym > 0x2a0 && keysym < 0x2ff) - return keysym_to_unicode_2a1_2fe[keysym - 0x2a1]; + return keysym_to_unicode_2a1_2fe[keysym - 0x2a1]; else if (keysym > 0x3a1 && keysym < 0x3ff) - return keysym_to_unicode_3a2_3fe[keysym - 0x3a2]; + return keysym_to_unicode_3a2_3fe[keysym - 0x3a2]; else if (keysym > 0x4a0 && keysym < 0x4e0) - return keysym_to_unicode_4a1_4df[keysym - 0x4a1]; + return keysym_to_unicode_4a1_4df[keysym - 0x4a1]; else if (keysym > 0x589 && keysym < 0x5ff) - return keysym_to_unicode_590_5fe[keysym - 0x590]; + return keysym_to_unicode_590_5fe[keysym - 0x590]; else if (keysym > 0x67f && keysym < 0x700) - return keysym_to_unicode_680_6ff[keysym - 0x680]; + return keysym_to_unicode_680_6ff[keysym - 0x680]; else if (keysym > 0x7a0 && keysym < 0x7fa) - return keysym_to_unicode_7a1_7f9[keysym - 0x7a1]; + return keysym_to_unicode_7a1_7f9[keysym - 0x7a1]; else if (keysym > 0x8a3 && keysym < 0x8ff) - return keysym_to_unicode_8a4_8fe[keysym - 0x8a4]; + return keysym_to_unicode_8a4_8fe[keysym - 0x8a4]; else if (keysym > 0x9de && keysym < 0x9f9) - return keysym_to_unicode_9df_9f8[keysym - 0x9df]; + return keysym_to_unicode_9df_9f8[keysym - 0x9df]; else if (keysym > 0xaa0 && keysym < 0xaff) - return keysym_to_unicode_aa1_afe[keysym - 0xaa1]; + return keysym_to_unicode_aa1_afe[keysym - 0xaa1]; else if (keysym > 0xcde && keysym < 0xcfb) - return keysym_to_unicode_cdf_cfa[keysym - 0xcdf]; + return keysym_to_unicode_cdf_cfa[keysym - 0xcdf]; else if (keysym > 0xda0 && keysym < 0xdfa) - return keysym_to_unicode_da1_df9[keysym - 0xda1]; + return keysym_to_unicode_da1_df9[keysym - 0xda1]; else if (keysym > 0xe9f && keysym < 0xf00) - return keysym_to_unicode_ea0_eff[keysym - 0xea0]; + return keysym_to_unicode_ea0_eff[keysym - 0xea0]; else if (keysym > 0x12a0 && keysym < 0x12ff) - return keysym_to_unicode_12a1_12fe[keysym - 0x12a1]; + return keysym_to_unicode_12a1_12fe[keysym - 0x12a1]; else if (keysym > 0x13bb && keysym < 0x13bf) - return keysym_to_unicode_13bc_13be[keysym - 0x13bc]; + return keysym_to_unicode_13bc_13be[keysym - 0x13bc]; else if (keysym > 0x14a0 && keysym < 0x1500) return keysym_to_unicode_14a1_14ff[keysym - 0x14a1]; else if (keysym > 0x15cf && keysym < 0x15f7) - return keysym_to_unicode_15d0_15f6[keysym - 0x15d0]; + return keysym_to_unicode_15d0_15f6[keysym - 0x15d0]; else if (keysym > 0x169f && keysym < 0x16f7) - return keysym_to_unicode_16a0_16f6[keysym - 0x16a0]; + return keysym_to_unicode_16a0_16f6[keysym - 0x16a0]; else if (keysym > 0x1e9e && keysym < 0x1f00) - return keysym_to_unicode_1e9f_1eff[keysym - 0x1e9f]; + return keysym_to_unicode_1e9f_1eff[keysym - 0x1e9f]; else if (keysym > 0x209f && keysym < 0x20ad) - return keysym_to_unicode_20a0_20ac[keysym - 0x20a0]; + return keysym_to_unicode_20a0_20ac[keysym - 0x20a0]; else - return 0; + return 0; } #endif /* SDL_VIDEO_DRIVER_X11 */ + diff --git a/libs/SDL2/src/video/x11/imKStoUCS.h b/libs/SDL2/src/video/x11/imKStoUCS.h index cc684c2e..fe4381d9 100644 --- a/libs/SDL2/src/video/x11/imKStoUCS.h +++ b/libs/SDL2/src/video/x11/imKStoUCS.h @@ -1,29 +1,30 @@ #ifndef _imKStoUCS_h #define _imKStoUCS_h -/* Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved. +/* +Copyright (C) 2003-2006,2008 Jamey Sharp, Josh Triplett +Copyright © 2009 Red Hat, Inc. +Copyright 1990-1992,1999,2000,2004,2009,2010 Oracle and/or its affiliates. +All rights reserved. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is fur- -nished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- -NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the XFree86 Project shall not -be used in advertising or otherwise to promote the sale, use or other deal- -ings in this Software without prior written authorization from the XFree86 -Project. +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. */ extern unsigned int X11_KeySymToUcs4(KeySym keysym); diff --git a/libs/SDL2/test/Makefile.in b/libs/SDL2/test/Makefile.in index 9a1df774..f8b65168 100644 --- a/libs/SDL2/test/Makefile.in +++ b/libs/SDL2/test/Makefile.in @@ -14,6 +14,7 @@ TARGETS = \ testatomic$(EXE) \ testaudioinfo$(EXE) \ testautomation$(EXE) \ + testbounds$(EXE) \ testdraw2$(EXE) \ testdrawchessboard$(EXE) \ testdropfile$(EXE) \ @@ -61,6 +62,7 @@ TARGETS = \ testrendercopyex$(EXE) \ testmessage$(EXE) \ testdisplayinfo$(EXE) \ + testqsort$(EXE) \ controllermap$(EXE) \ all: Makefile $(TARGETS) @@ -270,6 +272,12 @@ testmessage$(EXE): $(srcdir)/testmessage.c testdisplayinfo$(EXE): $(srcdir)/testdisplayinfo.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) +testqsort$(EXE): $(srcdir)/testqsort.c + $(CC) -o $@ $^ $(CFLAGS) $(LIBS) + +testbounds$(EXE): $(srcdir)/testbounds.c + $(CC) -o $@ $^ $(CFLAGS) $(LIBS) + controllermap$(EXE): $(srcdir)/controllermap.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) diff --git a/libs/SDL2/test/checkkeys.c b/libs/SDL2/test/checkkeys.c index 0b51f388..771369fa 100644 --- a/libs/SDL2/test/checkkeys.c +++ b/libs/SDL2/test/checkkeys.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/controllermap.c b/libs/SDL2/test/controllermap.c index da49cc17..3fb30d68 100644 --- a/libs/SDL2/test/controllermap.c +++ b/libs/SDL2/test/controllermap.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/loopwave.c b/libs/SDL2/test/loopwave.c index 47db4a81..ec9f5281 100644 --- a/libs/SDL2/test/loopwave.c +++ b/libs/SDL2/test/loopwave.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/loopwavequeue.c b/libs/SDL2/test/loopwavequeue.c index 2794c723..85f5bd57 100644 --- a/libs/SDL2/test/loopwavequeue.c +++ b/libs/SDL2/test/loopwavequeue.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testatomic.c b/libs/SDL2/test/testatomic.c index 430213bb..d371ef31 100644 --- a/libs/SDL2/test/testatomic.c +++ b/libs/SDL2/test/testatomic.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -284,7 +284,7 @@ typedef struct char cache_pad4[SDL_CACHELINE_SIZE-sizeof(SDL_SpinLock)-2*sizeof(SDL_atomic_t)]; #endif - volatile SDL_bool active; + SDL_atomic_t active; /* Only needed for the mutex test */ SDL_mutex *mutex; @@ -305,7 +305,7 @@ static void InitEventQueue(SDL_EventQueue *queue) SDL_AtomicSet(&queue->rwcount, 0); SDL_AtomicSet(&queue->watcher, 0); #endif - queue->active = SDL_TRUE; + SDL_AtomicSet(&queue->active, 1); } static SDL_bool EnqueueEvent_LockFree(SDL_EventQueue *queue, const SDL_Event *event) @@ -538,7 +538,7 @@ static int FIFO_Reader(void* _data) if (DequeueEvent_LockFree(queue, &event)) { WriterData *writer = (WriterData*)event.user.data1; ++data->counters[writer->index]; - } else if (queue->active) { + } else if (SDL_AtomicGet(&queue->active)) { ++data->waits; SDL_Delay(0); } else { @@ -551,7 +551,7 @@ static int FIFO_Reader(void* _data) if (DequeueEvent_Mutex(queue, &event)) { WriterData *writer = (WriterData*)event.user.data1; ++data->counters[writer->index]; - } else if (queue->active) { + } else if (SDL_AtomicGet(&queue->active)) { ++data->waits; SDL_Delay(0); } else { @@ -571,7 +571,7 @@ static int FIFO_Watcher(void* _data) { SDL_EventQueue *queue = (SDL_EventQueue *)_data; - while (queue->active) { + while (SDL_AtomicGet(&queue->active)) { SDL_AtomicLock(&queue->lock); SDL_AtomicIncRef(&queue->watcher); while (SDL_AtomicGet(&queue->rwcount) > 0) { @@ -652,7 +652,7 @@ static void RunFIFOTest(SDL_bool lock_free) } /* Shut down the queue so readers exit */ - queue.active = SDL_FALSE; + SDL_AtomicSet(&queue.active, 0); /* Wait for the readers */ while (SDL_AtomicGet(&readersRunning) > 0) { diff --git a/libs/SDL2/test/testaudiohotplug.c b/libs/SDL2/test/testaudiohotplug.c index f8c46856..e13868ec 100644 --- a/libs/SDL2/test/testaudiohotplug.c +++ b/libs/SDL2/test/testaudiohotplug.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testaudioinfo.c b/libs/SDL2/test/testaudioinfo.c index cd95dc95..53bf0f5e 100644 --- a/libs/SDL2/test/testaudioinfo.c +++ b/libs/SDL2/test/testaudioinfo.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testautomation.c b/libs/SDL2/test/testautomation.c index 34478a18..eea74b3b 100644 --- a/libs/SDL2/test/testautomation.c +++ b/libs/SDL2/test/testautomation.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testbounds.c b/libs/SDL2/test/testbounds.c new file mode 100644 index 00000000..a447c7a7 --- /dev/null +++ b/libs/SDL2/test/testbounds.c @@ -0,0 +1,39 @@ +/* + Copyright (C) 1997-2014 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ + +#include "SDL.h" + +int main(int argc, char **argv) +{ + int total, i; + + if (SDL_Init(SDL_INIT_VIDEO) < 0) { + SDL_Log("SDL_Init(SDL_INIT_VIDEO) failed: %s", SDL_GetError()); + } + + total = SDL_GetNumVideoDisplays(); + for (i = 0; i < total; i++) { + SDL_Rect bounds = { -1,-1,-1,-1 }, usable = { -1,-1,-1,-1 }; + SDL_GetDisplayBounds(i, &bounds); + SDL_GetDisplayUsableBounds(i, &usable); + SDL_Log("Display #%d ('%s'): bounds={(%d,%d),%dx%d}, usable={(%d,%d),%dx%d}", + i, SDL_GetDisplayName(i), + bounds.x, bounds.y, bounds.w, bounds.h, + usable.x, usable.y, usable.w, usable.h); + } + + SDL_Quit(); + return 0; +} + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/libs/SDL2/test/testdisplayinfo.c b/libs/SDL2/test/testdisplayinfo.c index bdc5596a..f06722e8 100644 --- a/libs/SDL2/test/testdisplayinfo.c +++ b/libs/SDL2/test/testdisplayinfo.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -51,11 +51,18 @@ main(int argc, char *argv[]) for (dpy = 0; dpy < num_displays; dpy++) { const int num_modes = SDL_GetNumDisplayModes(dpy); SDL_Rect rect = { 0, 0, 0, 0 }; + float ddpi, hdpi, vdpi; int m; SDL_GetDisplayBounds(dpy, &rect); SDL_Log("%d: \"%s\" (%dx%d, (%d, %d)), %d modes.\n", dpy, SDL_GetDisplayName(dpy), rect.w, rect.h, rect.x, rect.y, num_modes); + if (SDL_GetDisplayDPI(dpy, &ddpi, &hdpi, &vdpi) == -1) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, " DPI: failed to query (%s)\n", SDL_GetError()); + } else { + SDL_Log(" DPI: ddpi=%f; hdpi=%f; vdpi=%f\n", ddpi, hdpi, vdpi); + } + if (SDL_GetCurrentDisplayMode(dpy, &mode) == -1) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, " CURRENT: failed to query (%s)\n", SDL_GetError()); } else { diff --git a/libs/SDL2/test/testdraw2.c b/libs/SDL2/test/testdraw2.c index c3914260..77bd8c1f 100644 --- a/libs/SDL2/test/testdraw2.c +++ b/libs/SDL2/test/testdraw2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testdrawchessboard.c b/libs/SDL2/test/testdrawchessboard.c index b34fc715..f2a1469d 100644 --- a/libs/SDL2/test/testdrawchessboard.c +++ b/libs/SDL2/test/testdrawchessboard.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testdropfile.c b/libs/SDL2/test/testdropfile.c index 550e58e3..b729b2f6 100644 --- a/libs/SDL2/test/testdropfile.c +++ b/libs/SDL2/test/testdropfile.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -77,9 +77,14 @@ main(int argc, char *argv[]) while (SDL_PollEvent(&event)) { SDLTest_CommonEvent(state, &event, &done); - if (event.type == SDL_DROPFILE) { + if (event.type == SDL_DROPBEGIN) { + SDL_Log("Drop beginning on window %u", (unsigned int) event.drop.windowID); + } else if (event.type == SDL_DROPCOMPLETE) { + SDL_Log("Drop complete on window %u", (unsigned int) event.drop.windowID); + } else if ((event.type == SDL_DROPFILE) || (event.type == SDL_DROPTEXT)) { + const char *typestr = (event.type == SDL_DROPFILE) ? "File" : "Text"; char *dropped_filedir = event.drop.file; - SDL_Log("File dropped on window: %s", dropped_filedir); + SDL_Log("%s dropped on window %u: %s", typestr, (unsigned int) event.drop.windowID, dropped_filedir); SDL_free(dropped_filedir); } } diff --git a/libs/SDL2/test/testerror.c b/libs/SDL2/test/testerror.c index 181ee11e..b5fa3fbc 100644 --- a/libs/SDL2/test/testerror.c +++ b/libs/SDL2/test/testerror.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testfile.c b/libs/SDL2/test/testfile.c index e07b2fab..b45795f6 100644 --- a/libs/SDL2/test/testfile.c +++ b/libs/SDL2/test/testfile.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testfilesystem.c b/libs/SDL2/test/testfilesystem.c index 43b535c4..abd301c0 100644 --- a/libs/SDL2/test/testfilesystem.c +++ b/libs/SDL2/test/testfilesystem.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testgamecontroller.c b/libs/SDL2/test/testgamecontroller.c index 688544ec..ec1dfd32 100644 --- a/libs/SDL2/test/testgamecontroller.c +++ b/libs/SDL2/test/testgamecontroller.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testgesture.c b/libs/SDL2/test/testgesture.c index 5437c6c4..a289ce13 100644 --- a/libs/SDL2/test/testgesture.c +++ b/libs/SDL2/test/testgesture.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testgl2.c b/libs/SDL2/test/testgl2.c index a67bc1a7..74147f9f 100644 --- a/libs/SDL2/test/testgl2.c +++ b/libs/SDL2/test/testgl2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testgles.c b/libs/SDL2/test/testgles.c index b0b47c96..291661a0 100644 --- a/libs/SDL2/test/testgles.c +++ b/libs/SDL2/test/testgles.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testgles2.c b/libs/SDL2/test/testgles2.c index 0cf7d13f..af5962ba 100644 --- a/libs/SDL2/test/testgles2.c +++ b/libs/SDL2/test/testgles2.c @@ -1,5 +1,5 @@ /* - Copyright (r) 1997-2015 Sam Lantinga + Copyright (r) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testhotplug.c b/libs/SDL2/test/testhotplug.c index 1de96f6d..1fa96375 100644 --- a/libs/SDL2/test/testhotplug.c +++ b/libs/SDL2/test/testhotplug.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testiconv.c b/libs/SDL2/test/testiconv.c index 6576a87d..79efec8a 100644 --- a/libs/SDL2/test/testiconv.c +++ b/libs/SDL2/test/testiconv.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testime.c b/libs/SDL2/test/testime.c index fabfde39..15803243 100644 --- a/libs/SDL2/test/testime.c +++ b/libs/SDL2/test/testime.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,8 +29,10 @@ static SDLTest_CommonState *state; static SDL_Rect textRect, markedRect; static SDL_Color lineColor = {0,0,0,0}; -static SDL_Color backColor = {255,255,255,0}; +static SDL_Color backColor = {255,255,255,255}; +#ifdef HAVE_SDL_TTF static SDL_Color textColor = {0,0,0,0}; +#endif static char text[MAX_TEXT_LENGTH], markedText[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; static int cursor = 0; #ifdef HAVE_SDL_TTF @@ -108,21 +110,25 @@ void CleanupVideo() #endif } - void _Redraw(SDL_Renderer * renderer) { int w = 0, h = textRect.h; SDL_Rect cursorRect, underlineRect; - SDL_SetRenderDrawColor(renderer, 255,255,255,255); + SDL_SetRenderDrawColor(renderer, backColor.r, backColor.g, backColor.b, backColor.a); SDL_RenderFillRect(renderer,&textRect); #ifdef HAVE_SDL_TTF if (*text) { SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, text, textColor); - SDL_Rect dest = {textRect.x, textRect.y, textSur->w, textSur->h }; + SDL_Rect dest; + SDL_Texture *texture; + dest.x = textRect.x; + dest.y = textRect.y; + dest.w = textSur->w; + dest.h = textSur->h; - SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer,textSur); + texture = SDL_CreateTextureFromSurface(renderer,textSur); SDL_FreeSurface(textSur); SDL_RenderCopy(renderer,texture,NULL,&dest); @@ -148,18 +154,21 @@ void _Redraw(SDL_Renderer * renderer) { cursorRect.w = 2; cursorRect.h = h; - SDL_SetRenderDrawColor(renderer, 255,255,255,255); + SDL_SetRenderDrawColor(renderer, backColor.r, backColor.g, backColor.b, backColor.a); SDL_RenderFillRect(renderer,&markedRect); if (markedText[0]) { #ifdef HAVE_SDL_TTF + SDL_Surface *textSur; + SDL_Rect dest; + SDL_Texture *texture; if (cursor) { char *p = utf8_advance(markedText, cursor); char c = 0; if (!p) - p = &markedText[strlen(markedText)]; + p = &markedText[SDL_strlen(markedText)]; c = *p; *p = 0; @@ -167,10 +176,13 @@ void _Redraw(SDL_Renderer * renderer) { cursorRect.x += w; *p = c; } - SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, markedText, textColor); - SDL_Rect dest = {markedRect.x, markedRect.y, textSur->w, textSur->h }; + textSur = TTF_RenderUTF8_Blended(font, markedText, textColor); + dest.x = markedRect.x; + dest.y = markedRect.y; + dest.w = textSur->w; + dest.h = textSur->h; TTF_SizeUTF8(font, markedText, &w, &h); - SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer,textSur); + texture = SDL_CreateTextureFromSurface(renderer,textSur); SDL_FreeSurface(textSur); SDL_RenderCopy(renderer,texture,NULL,&dest); @@ -182,11 +194,11 @@ void _Redraw(SDL_Renderer * renderer) { underlineRect.h = 2; underlineRect.w = w; - SDL_SetRenderDrawColor(renderer, 0,0,0,0); + SDL_SetRenderDrawColor(renderer, lineColor.r, lineColor.g, lineColor.b, lineColor.a); SDL_RenderFillRect(renderer,&markedRect); } - SDL_SetRenderDrawColor(renderer, 0,0,0,0); + SDL_SetRenderDrawColor(renderer, lineColor.r, lineColor.g, lineColor.b, lineColor.a); SDL_RenderFillRect(renderer,&cursorRect); SDL_SetTextInputRect(&markedRect); diff --git a/libs/SDL2/test/testintersections.c b/libs/SDL2/test/testintersections.c index d67b15e6..82aae633 100644 --- a/libs/SDL2/test/testintersections.c +++ b/libs/SDL2/test/testintersections.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testjoystick.c b/libs/SDL2/test/testjoystick.c index 259b5a85..bed27212 100644 --- a/libs/SDL2/test/testjoystick.c +++ b/libs/SDL2/test/testjoystick.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testkeys.c b/libs/SDL2/test/testkeys.c index 1c73df91..aea496ca 100644 --- a/libs/SDL2/test/testkeys.c +++ b/libs/SDL2/test/testkeys.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testloadso.c b/libs/SDL2/test/testloadso.c index 8b4e4180..fb87fbed 100644 --- a/libs/SDL2/test/testloadso.c +++ b/libs/SDL2/test/testloadso.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testlock.c b/libs/SDL2/test/testlock.c index 1293f958..113ba0d4 100644 --- a/libs/SDL2/test/testlock.c +++ b/libs/SDL2/test/testlock.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ static SDL_mutex *mutex = NULL; static SDL_threadID mainthread; static SDL_Thread *threads[6]; -static volatile int doterminate = 0; +static SDL_atomic_t doterminate; /* * SDL_Quit() shouldn't be used with atexit() directly because @@ -45,7 +45,7 @@ void terminate(int sig) { signal(SIGINT, terminate); - doterminate = 1; + SDL_AtomicSet(&doterminate, 1); } void @@ -54,7 +54,7 @@ closemutex(int sig) SDL_threadID id = SDL_ThreadID(); int i; SDL_Log("Process %lu: Cleaning up...\n", id == mainthread ? 0 : id); - doterminate = 1; + SDL_AtomicSet(&doterminate, 1); for (i = 0; i < 6; ++i) SDL_WaitThread(threads[i], NULL); SDL_DestroyMutex(mutex); @@ -66,7 +66,7 @@ Run(void *data) { if (SDL_ThreadID() == mainthread) signal(SIGTERM, closemutex); - while (!doterminate) { + while (!SDL_AtomicGet(&doterminate)) { SDL_Log("Process %lu ready to work\n", SDL_ThreadID()); if (SDL_LockMutex(mutex) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't lock mutex: %s", SDL_GetError()); @@ -82,7 +82,7 @@ Run(void *data) /* If this sleep isn't done, then threads may starve */ SDL_Delay(10); } - if (SDL_ThreadID() == mainthread && doterminate) { + if (SDL_ThreadID() == mainthread && SDL_AtomicGet(&doterminate)) { SDL_Log("Process %lu: raising SIGTERM\n", SDL_ThreadID()); raise(SIGTERM); } @@ -105,6 +105,8 @@ main(int argc, char *argv[]) } atexit(SDL_Quit_Wrapper); + SDL_AtomicSet(&doterminate, 0); + if ((mutex = SDL_CreateMutex()) == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create mutex: %s\n", SDL_GetError()); exit(1); diff --git a/libs/SDL2/test/testmessage.c b/libs/SDL2/test/testmessage.c index 2040e554..91968c32 100644 --- a/libs/SDL2/test/testmessage.c +++ b/libs/SDL2/test/testmessage.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testmultiaudio.c b/libs/SDL2/test/testmultiaudio.c index d98ac945..1b07ba9f 100644 --- a/libs/SDL2/test/testmultiaudio.c +++ b/libs/SDL2/test/testmultiaudio.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,7 @@ typedef struct { SDL_AudioDeviceID dev; int soundpos; - volatile int done; + SDL_atomic_t done; } callback_data; callback_data cbd[64]; @@ -46,14 +46,14 @@ play_through_once(void *arg, Uint8 * stream, int len) if (len > 0) { stream += cpy; SDL_memset(stream, spec.silence, len); - cbd->done++; + SDL_AtomicSet(&cbd->done, 1); } } void loop() { - if(cbd[0].done) { + if (SDL_AtomicGet(&cbd[0].done)) { #ifdef __EMSCRIPTEN__ emscripten_cancel_main_loop(); #endif @@ -100,8 +100,7 @@ test_multi_audio(int devcount) #ifdef __EMSCRIPTEN__ emscripten_set_main_loop(loop, 0, 1); #else - while (!cbd[0].done) - { + while (!SDL_AtomicGet(&cbd[0].done)) { #ifdef __ANDROID__ /* Empty queue, some application events would prevent pause. */ while (SDL_PollEvent(&event)){} @@ -136,7 +135,7 @@ test_multi_audio(int devcount) while (keep_going) { keep_going = 0; for (i = 0; i < devcount; i++) { - if ((cbd[i].dev) && (!cbd[i].done)) { + if ((cbd[i].dev) && (!SDL_AtomicGet(&cbd[i].done))) { keep_going = 1; } } diff --git a/libs/SDL2/test/testnative.c b/libs/SDL2/test/testnative.c index 0861bc98..049c4c83 100644 --- a/libs/SDL2/test/testnative.c +++ b/libs/SDL2/test/testnative.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testnative.h b/libs/SDL2/test/testnative.h index a373fa98..ed2bf7e5 100644 --- a/libs/SDL2/test/testnative.h +++ b/libs/SDL2/test/testnative.h @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testnativew32.c b/libs/SDL2/test/testnativew32.c index 7ca41500..aaea267d 100644 --- a/libs/SDL2/test/testnativew32.c +++ b/libs/SDL2/test/testnativew32.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testnativex11.c b/libs/SDL2/test/testnativex11.c index fc6fd9ab..69fa37bb 100644 --- a/libs/SDL2/test/testnativex11.c +++ b/libs/SDL2/test/testnativex11.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testoverlay2.c b/libs/SDL2/test/testoverlay2.c index 47a633a2..453f0f44 100644 --- a/libs/SDL2/test/testoverlay2.c +++ b/libs/SDL2/test/testoverlay2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testplatform.c b/libs/SDL2/test/testplatform.c index 51b0f178..14acac4b 100644 --- a/libs/SDL2/test/testplatform.c +++ b/libs/SDL2/test/testplatform.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testpower.c b/libs/SDL2/test/testpower.c index b400f33b..300d21a2 100644 --- a/libs/SDL2/test/testpower.c +++ b/libs/SDL2/test/testpower.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testqsort.c b/libs/SDL2/test/testqsort.c new file mode 100644 index 00000000..2a7c66ba --- /dev/null +++ b/libs/SDL2/test/testqsort.c @@ -0,0 +1,84 @@ +/* + Copyright (C) 1997-2016 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ + +#include +#include + +#include "SDL.h" + +static int +num_compare(const void *_a, const void *_b) +{ + const int a = *((const int *) _a); + const int b = *((const int *) _b); + return (a < b) ? -1 : ((a > b) ? 1 : 0); +} + +static void +test_sort(const char *desc, int *nums, const int arraylen) +{ + int i; + int prev; + + SDL_Log("test: %s arraylen=%d", desc, arraylen); + + SDL_qsort(nums, arraylen, sizeof (nums[0]), num_compare); + + prev = nums[0]; + for (i = 1; i < arraylen; i++) { + const int val = nums[i]; + if (val < prev) { + SDL_Log("sort is broken!"); + return; + } + prev = val; + } +} + +int +main(int argc, char *argv[]) +{ + static int nums[1024 * 100]; + static const int itervals[] = { SDL_arraysize(nums), 12 }; + int iteration; + + for (iteration = 0; iteration < SDL_arraysize(itervals); iteration++) { + const int arraylen = itervals[iteration]; + int i; + + for (i = 0; i < arraylen; i++) { + nums[i] = i; + } + test_sort("already sorted", nums, arraylen); + + for (i = 0; i < arraylen; i++) { + nums[i] = i; + } + nums[arraylen-1] = -1; + test_sort("already sorted except last element", nums, arraylen); + + for (i = 0; i < arraylen; i++) { + nums[i] = (arraylen-1) - i; + } + test_sort("reverse sorted", nums, arraylen); + + for (i = 0; i < arraylen; i++) { + nums[i] = random(); + } + test_sort("random sorted", nums, arraylen); + } + + return 0; +} + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/libs/SDL2/test/testrelative.c b/libs/SDL2/test/testrelative.c index a8c57444..59d23f63 100644 --- a/libs/SDL2/test/testrelative.c +++ b/libs/SDL2/test/testrelative.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testrendercopyex.c b/libs/SDL2/test/testrendercopyex.c index 8c5e5192..856abf7d 100644 --- a/libs/SDL2/test/testrendercopyex.c +++ b/libs/SDL2/test/testrendercopyex.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testrendertarget.c b/libs/SDL2/test/testrendertarget.c index 0ae0a824..c5e1dce0 100644 --- a/libs/SDL2/test/testrendertarget.c +++ b/libs/SDL2/test/testrendertarget.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testresample.c b/libs/SDL2/test/testresample.c index 1c1333d0..0e92bbe1 100644 --- a/libs/SDL2/test/testresample.c +++ b/libs/SDL2/test/testresample.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testrumble.c b/libs/SDL2/test/testrumble.c index 27c1937e..ea7466d2 100644 --- a/libs/SDL2/test/testrumble.c +++ b/libs/SDL2/test/testrumble.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testscale.c b/libs/SDL2/test/testscale.c index d3edf676..9f5fdbff 100644 --- a/libs/SDL2/test/testscale.c +++ b/libs/SDL2/test/testscale.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testsem.c b/libs/SDL2/test/testsem.c index 456c4f06..b8d3b274 100644 --- a/libs/SDL2/test/testsem.c +++ b/libs/SDL2/test/testsem.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testshader.c b/libs/SDL2/test/testshader.c index 9a29c6cb..fc6da298 100644 --- a/libs/SDL2/test/testshader.c +++ b/libs/SDL2/test/testshader.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testshape.c b/libs/SDL2/test/testshape.c index 845dd59e..00750a97 100644 --- a/libs/SDL2/test/testshape.c +++ b/libs/SDL2/test/testshape.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testsprite2.c b/libs/SDL2/test/testsprite2.c index aa5c930e..7a33af30 100644 --- a/libs/SDL2/test/testsprite2.c +++ b/libs/SDL2/test/testsprite2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testspriteminimal.c b/libs/SDL2/test/testspriteminimal.c index dda99b24..05f97309 100644 --- a/libs/SDL2/test/testspriteminimal.c +++ b/libs/SDL2/test/testspriteminimal.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/teststreaming.c b/libs/SDL2/test/teststreaming.c index 623d5879..86cc1391 100644 --- a/libs/SDL2/test/teststreaming.c +++ b/libs/SDL2/test/teststreaming.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testthread.c b/libs/SDL2/test/testthread.c index 45077d90..90e2c60c 100644 --- a/libs/SDL2/test/testthread.c +++ b/libs/SDL2/test/testthread.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testtimer.c b/libs/SDL2/test/testtimer.c index 7540d55e..32b74909 100644 --- a/libs/SDL2/test/testtimer.c +++ b/libs/SDL2/test/testtimer.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testver.c b/libs/SDL2/test/testver.c index 0f934989..f0e3bcf3 100644 --- a/libs/SDL2/test/testver.c +++ b/libs/SDL2/test/testver.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testviewport.c b/libs/SDL2/test/testviewport.c index 957498a6..7ed4e6ec 100644 --- a/libs/SDL2/test/testviewport.c +++ b/libs/SDL2/test/testviewport.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testwm2.c b/libs/SDL2/test/testwm2.c index 510e29d6..94ba513b 100644 --- a/libs/SDL2/test/testwm2.c +++ b/libs/SDL2/test/testwm2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/torturethread.c b/libs/SDL2/test/torturethread.c index b774cc6f..6b98a0a9 100644 --- a/libs/SDL2/test/torturethread.c +++ b/libs/SDL2/test/torturethread.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #define NUMTHREADS 10 -static char volatile time_for_threads_to_die[NUMTHREADS]; +static SDL_atomic_t time_for_threads_to_die[NUMTHREADS]; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void @@ -58,7 +58,7 @@ ThreadFunc(void *data) } SDL_Log("Thread '%d' waiting for signal\n", tid); - while (time_for_threads_to_die[tid] != 1) { + while (SDL_AtomicGet(&time_for_threads_to_die[tid]) != 1) { ; /* do nothing */ } @@ -92,7 +92,7 @@ main(int argc, char *argv[]) for (i = 0; i < NUMTHREADS; i++) { char name[64]; SDL_snprintf(name, sizeof (name), "Parent%d", i); - time_for_threads_to_die[i] = 0; + SDL_AtomicSet(&time_for_threads_to_die[i], 0); threads[i] = SDL_CreateThread(ThreadFunc, name, (void*) (uintptr_t) i); if (threads[i] == NULL) { @@ -102,7 +102,7 @@ main(int argc, char *argv[]) } for (i = 0; i < NUMTHREADS; i++) { - time_for_threads_to_die[i] = 1; + SDL_AtomicSet(&time_for_threads_to_die[i], 1); } for (i = 0; i < NUMTHREADS; i++) {