From bc95ce4fc5f0c9f9957a9f7ca29ebcb625b3cc84 Mon Sep 17 00:00:00 2001 From: underscorediscovery Date: Sat, 2 Jan 2016 17:24:23 -0330 Subject: [PATCH] SDL 2.0.4 stable --- include/SDL.h | 2 +- include/SDL_assert.h | 2 +- include/SDL_atomic.h | 2 +- include/SDL_audio.h | 2 +- include/SDL_bits.h | 2 +- include/SDL_blendmode.h | 2 +- include/SDL_clipboard.h | 2 +- include/SDL_config_android.h | 2 +- include/SDL_config_iphoneos.h | 2 +- include/SDL_config_macosx.h | 2 +- include/SDL_config_minimal.h | 2 +- include/SDL_config_pandora.h | 2 +- include/SDL_config_psp.h | 2 +- include/SDL_config_windows.h | 2 +- include/SDL_config_winrt.h | 28 +- include/SDL_config_wiz.h | 3 +- include/SDL_copying.h | 2 +- include/SDL_cpuinfo.h | 2 +- include/SDL_egl.h | 2 +- include/SDL_endian.h | 2 +- include/SDL_error.h | 2 +- include/SDL_events.h | 2 +- include/SDL_filesystem.h | 2 +- include/SDL_gamecontroller.h | 7 +- include/SDL_gesture.h | 2 +- include/SDL_haptic.h | 2 +- include/SDL_hints.h | 2 +- include/SDL_joystick.h | 12 +- include/SDL_keyboard.h | 2 +- include/SDL_keycode.h | 2 +- include/SDL_loadso.h | 2 +- include/SDL_log.h | 2 +- include/SDL_main.h | 2 +- include/SDL_messagebox.h | 2 +- include/SDL_mouse.h | 2 +- include/SDL_mutex.h | 2 +- include/SDL_name.h | 2 +- include/SDL_opengl.h | 2 +- include/SDL_opengles.h | 2 +- include/SDL_opengles2.h | 2 +- include/SDL_pixels.h | 2 +- include/SDL_platform.h | 2 +- include/SDL_power.h | 2 +- include/SDL_quit.h | 2 +- include/SDL_rect.h | 2 +- include/SDL_render.h | 4 +- include/SDL_revision.h | 4 +- include/SDL_rwops.h | 2 +- include/SDL_scancode.h | 2 +- include/SDL_shape.h | 2 +- include/SDL_stdinc.h | 2 +- include/SDL_surface.h | 2 +- include/SDL_system.h | 2 +- include/SDL_syswm.h | 2 +- include/SDL_test.h | 2 +- include/SDL_test_assert.h | 2 +- include/SDL_test_common.h | 2 +- include/SDL_test_compare.h | 2 +- include/SDL_test_crc32.h | 2 +- include/SDL_test_font.h | 2 +- include/SDL_test_fuzzer.h | 2 +- include/SDL_test_harness.h | 2 +- include/SDL_test_images.h | 2 +- include/SDL_test_log.h | 2 +- include/SDL_test_md5.h | 2 +- include/SDL_test_random.h | 2 +- include/SDL_thread.h | 2 +- include/SDL_timer.h | 2 +- include/SDL_touch.h | 2 +- include/SDL_types.h | 2 +- include/SDL_version.h | 2 +- include/SDL_video.h | 61 +- include/begin_code.h | 2 +- include/close_code.h | 2 +- src/SDL.c | 2 +- src/SDL_assert.c | 2 +- src/SDL_assert_c.h | 2 +- src/SDL_error.c | 2 +- src/SDL_error_c.h | 2 +- src/SDL_hints.c | 2 +- src/SDL_internal.h | 2 +- src/SDL_log.c | 2 +- src/atomic/SDL_atomic.c | 2 +- src/atomic/SDL_spinlock.c | 2 +- src/audio/SDL_audio.c | 2 +- src/audio/SDL_audio_c.h | 2 +- src/audio/SDL_audiocvt.c | 2 +- src/audio/SDL_audiodev.c | 2 +- src/audio/SDL_audiodev_c.h | 2 +- src/audio/SDL_audiomem.h | 2 +- src/audio/SDL_audiotypecvt.c | 2 +- src/audio/SDL_mixer.c | 2 +- src/audio/SDL_sysaudio.h | 2 +- src/audio/SDL_wave.c | 2 +- src/audio/SDL_wave.h | 2 +- src/audio/alsa/SDL_alsa_audio.c | 2 +- src/audio/alsa/SDL_alsa_audio.h | 2 +- src/audio/android/SDL_androidaudio.c | 2 +- src/audio/android/SDL_androidaudio.h | 2 +- src/audio/arts/SDL_artsaudio.c | 2 +- src/audio/arts/SDL_artsaudio.h | 2 +- src/audio/bsd/SDL_bsdaudio.c | 2 +- src/audio/bsd/SDL_bsdaudio.h | 2 +- src/audio/coreaudio/SDL_coreaudio.c | 2 +- src/audio/coreaudio/SDL_coreaudio.h | 2 +- src/audio/directsound/SDL_directsound.c | 2 +- src/audio/directsound/SDL_directsound.h | 2 +- src/audio/disk/SDL_diskaudio.c | 2 +- src/audio/disk/SDL_diskaudio.h | 2 +- src/audio/dsp/SDL_dspaudio.c | 2 +- src/audio/dsp/SDL_dspaudio.h | 2 +- src/audio/dummy/SDL_dummyaudio.c | 2 +- src/audio/dummy/SDL_dummyaudio.h | 2 +- src/audio/emscripten/SDL_emscriptenaudio.c | 2 +- src/audio/emscripten/SDL_emscriptenaudio.h | 2 +- src/audio/esd/SDL_esdaudio.c | 2 +- src/audio/esd/SDL_esdaudio.h | 2 +- src/audio/fusionsound/SDL_fsaudio.c | 2 +- src/audio/fusionsound/SDL_fsaudio.h | 2 +- src/audio/haiku/SDL_haikuaudio.cc | 2 +- src/audio/haiku/SDL_haikuaudio.h | 2 +- src/audio/nacl/SDL_naclaudio.c | 2 +- src/audio/nacl/SDL_naclaudio.h | 2 +- src/audio/nas/SDL_nasaudio.c | 2 +- src/audio/nas/SDL_nasaudio.h | 2 +- src/audio/paudio/SDL_paudio.c | 2 +- src/audio/paudio/SDL_paudio.h | 2 +- src/audio/psp/SDL_pspaudio.c | 2 +- src/audio/psp/SDL_pspaudio.h | 2 +- src/audio/pulseaudio/SDL_pulseaudio.c | 2 +- src/audio/pulseaudio/SDL_pulseaudio.h | 2 +- src/audio/qsa/SDL_qsa_audio.c | 2 +- src/audio/qsa/SDL_qsa_audio.h | 2 +- src/audio/sdlgenaudiocvt.pl | 2 +- src/audio/sndio/SDL_sndioaudio.c | 2 +- src/audio/sndio/SDL_sndioaudio.h | 2 +- src/audio/sun/SDL_sunaudio.c | 2 +- src/audio/sun/SDL_sunaudio.h | 2 +- src/audio/winmm/SDL_winmm.c | 2 +- src/audio/winmm/SDL_winmm.h | 2 +- src/audio/xaudio2/SDL_xaudio2.c | 31 +- src/audio/xaudio2/SDL_xaudio2.h | 386 +++++++++++++ .../xaudio2/SDL_xaudio2_winrthelpers.cpp | 2 +- src/audio/xaudio2/SDL_xaudio2_winrthelpers.h | 2 +- src/core/android/SDL_android.c | 2 +- src/core/android/SDL_android.h | 2 +- src/core/linux/SDL_dbus.c | 2 +- src/core/linux/SDL_dbus.h | 2 +- src/core/linux/SDL_evdev.c | 2 +- src/core/linux/SDL_evdev.h | 2 +- src/core/linux/SDL_ibus.c | 2 +- src/core/linux/SDL_ibus.h | 2 +- src/core/linux/SDL_udev.c | 2 +- src/core/linux/SDL_udev.h | 2 +- src/core/windows/SDL_directx.h | 2 +- src/core/windows/SDL_windows.c | 2 +- src/core/windows/SDL_windows.h | 2 +- src/core/windows/SDL_xinput.c | 2 +- src/core/windows/SDL_xinput.h | 12 +- src/core/winrt/SDL_winrtapp_common.cpp | 2 +- src/core/winrt/SDL_winrtapp_common.h | 2 +- src/core/winrt/SDL_winrtapp_direct3d.cpp | 328 +++++++---- src/core/winrt/SDL_winrtapp_direct3d.h | 15 +- src/core/winrt/SDL_winrtapp_xaml.cpp | 2 +- src/core/winrt/SDL_winrtapp_xaml.h | 2 +- src/cpuinfo/SDL_cpuinfo.c | 4 +- src/dynapi/SDL_dynapi.c | 2 +- src/dynapi/SDL_dynapi.h | 2 +- src/dynapi/SDL_dynapi_overrides.h | 4 +- src/dynapi/SDL_dynapi_procs.h | 4 +- src/dynapi/gendynapi.pl | 2 +- src/events/SDL_clipboardevents.c | 2 +- src/events/SDL_clipboardevents_c.h | 2 +- src/events/SDL_dropevents.c | 2 +- src/events/SDL_dropevents_c.h | 2 +- src/events/SDL_events.c | 2 +- src/events/SDL_events_c.h | 2 +- src/events/SDL_gesture.c | 2 +- src/events/SDL_gesture_c.h | 2 +- src/events/SDL_keyboard.c | 15 +- src/events/SDL_keyboard_c.h | 5 +- src/events/SDL_mouse.c | 2 +- src/events/SDL_mouse_c.h | 2 +- src/events/SDL_quit.c | 2 +- src/events/SDL_sysevents.h | 2 +- src/events/SDL_touch.c | 2 +- src/events/SDL_touch_c.h | 2 +- src/events/SDL_windowevents.c | 4 +- src/events/SDL_windowevents_c.h | 2 +- src/events/blank_cursor.h | 2 +- src/events/default_cursor.h | 2 +- src/events/scancodes_darwin.h | 2 +- src/events/scancodes_linux.h | 2 +- src/events/scancodes_windows.h | 2 +- src/events/scancodes_xfree86.h | 2 +- src/file/SDL_rwops.c | 2 +- src/file/cocoa/SDL_rwopsbundlesupport.h | 2 +- src/file/cocoa/SDL_rwopsbundlesupport.m | 2 +- src/filesystem/android/SDL_sysfilesystem.c | 2 +- src/filesystem/cocoa/SDL_sysfilesystem.m | 2 +- src/filesystem/dummy/SDL_sysfilesystem.c | 2 +- src/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 | 2 +- src/filesystem/windows/SDL_sysfilesystem.c | 2 +- src/filesystem/winrt/SDL_sysfilesystem.cpp | 2 +- src/haptic/SDL_haptic.c | 2 +- src/haptic/SDL_haptic_c.h | 2 +- src/haptic/SDL_syshaptic.h | 2 +- src/haptic/darwin/SDL_syshaptic.c | 2 +- src/haptic/darwin/SDL_syshaptic_c.h | 2 +- src/haptic/dummy/SDL_syshaptic.c | 2 +- src/haptic/linux/SDL_syshaptic.c | 2 +- src/haptic/windows/SDL_dinputhaptic.c | 2 +- src/haptic/windows/SDL_dinputhaptic_c.h | 2 +- src/haptic/windows/SDL_windowshaptic.c | 2 +- src/haptic/windows/SDL_windowshaptic_c.h | 2 +- src/haptic/windows/SDL_xinputhaptic.c | 2 +- src/haptic/windows/SDL_xinputhaptic_c.h | 2 +- src/joystick/SDL_gamecontroller.c | 189 ++++--- src/joystick/SDL_gamecontrollerdb.h | 9 +- src/joystick/SDL_gamecontrollerdb.h.new | 65 --- src/joystick/SDL_joystick.c | 19 +- src/joystick/SDL_joystick_c.h | 2 +- src/joystick/SDL_sysjoystick.h | 2 +- src/joystick/android/SDL_sysjoystick.c | 2 +- src/joystick/android/SDL_sysjoystick_c.h | 2 +- src/joystick/bsd/SDL_sysjoystick.c | 50 +- src/joystick/darwin/SDL_sysjoystick.c | 17 +- src/joystick/darwin/SDL_sysjoystick_c.h | 2 +- src/joystick/dummy/SDL_sysjoystick.c | 2 +- src/joystick/emscripten/SDL_sysjoystick.c | 2 +- src/joystick/emscripten/SDL_sysjoystick_c.h | 2 +- src/joystick/haiku/SDL_haikujoystick.cc | 2 +- src/joystick/iphoneos/SDL_sysjoystick.m | 104 +++- src/joystick/iphoneos/SDL_sysjoystick_c.h | 2 +- src/joystick/linux/SDL_sysjoystick.c | 2 +- src/joystick/linux/SDL_sysjoystick_c.h | 2 +- src/joystick/psp/SDL_sysjoystick.c | 2 +- src/joystick/windows/SDL_dinputjoystick.c | 2 +- src/joystick/windows/SDL_dinputjoystick_c.h | 2 +- src/joystick/windows/SDL_mmjoystick.c | 2 +- src/joystick/windows/SDL_windowsjoystick.c | 2 +- src/joystick/windows/SDL_windowsjoystick_c.h | 2 +- src/joystick/windows/SDL_xinputjoystick.c | 10 +- src/joystick/windows/SDL_xinputjoystick_c.h | 2 +- src/libm/math_libm.h | 2 +- src/loadso/dlopen/SDL_sysloadso.c | 2 +- src/loadso/dummy/SDL_sysloadso.c | 2 +- src/loadso/haiku/SDL_sysloadso.c | 2 +- src/loadso/windows/SDL_sysloadso.c | 2 +- src/main/haiku/SDL_BApp.h | 2 +- src/main/haiku/SDL_BeApp.cc | 2 +- src/main/haiku/SDL_BeApp.h | 2 +- src/main/nacl/SDL_nacl_main.c | 2 +- src/main/windows/version.rc | 2 +- src/power/SDL_power.c | 2 +- src/power/android/SDL_syspower.c | 2 +- src/power/emscripten/SDL_syspower.c | 2 +- src/power/haiku/SDL_syspower.c | 2 +- src/power/linux/SDL_syspower.c | 2 +- src/power/macosx/SDL_syspower.c | 2 +- src/power/psp/SDL_syspower.c | 2 +- src/power/uikit/SDL_syspower.h | 2 +- src/power/uikit/SDL_syspower.m | 2 +- src/power/windows/SDL_syspower.c | 2 +- src/power/winrt/SDL_syspower.cpp | 2 +- src/render/SDL_d3dmath.c | 2 +- src/render/SDL_d3dmath.h | 2 +- src/render/SDL_render.c | 5 +- src/render/SDL_sysrender.h | 2 +- src/render/SDL_yuv_mmx.c | 2 +- src/render/SDL_yuv_sw.c | 2 +- src/render/SDL_yuv_sw_c.h | 2 +- src/render/direct3d/SDL_render_d3d.c | 2 +- src/render/direct3d11/SDL_render_d3d11.c | 10 +- src/render/direct3d11/SDL_render_winrt.cpp | 2 +- src/render/direct3d11/SDL_render_winrt.h | 2 +- src/render/opengl/SDL_glfuncs.h | 2 +- src/render/opengl/SDL_render_gl.c | 6 +- src/render/opengl/SDL_shaders_gl.c | 2 +- src/render/opengl/SDL_shaders_gl.h | 2 +- src/render/opengles/SDL_glesfuncs.h | 2 +- src/render/opengles/SDL_render_gles.c | 6 +- src/render/opengles2/SDL_gles2funcs.h | 2 +- src/render/opengles2/SDL_render_gles2.c | 6 +- src/render/opengles2/SDL_shaders_gles2.c | 2 +- src/render/opengles2/SDL_shaders_gles2.h | 2 +- src/render/psp/SDL_render_psp.c | 2 +- src/render/software/SDL_blendfillrect.c | 2 +- src/render/software/SDL_blendfillrect.h | 2 +- src/render/software/SDL_blendline.c | 2 +- src/render/software/SDL_blendline.h | 2 +- src/render/software/SDL_blendpoint.c | 2 +- src/render/software/SDL_blendpoint.h | 2 +- src/render/software/SDL_draw.h | 2 +- src/render/software/SDL_drawline.c | 2 +- src/render/software/SDL_drawline.h | 2 +- src/render/software/SDL_drawpoint.c | 2 +- src/render/software/SDL_drawpoint.h | 2 +- src/render/software/SDL_render_sw.c | 2 +- src/render/software/SDL_render_sw_c.h | 2 +- src/render/software/SDL_rotate.h | 2 +- src/stdlib/SDL_getenv.c | 2 +- src/stdlib/SDL_iconv.c | 2 +- src/stdlib/SDL_malloc.c | 2 +- src/stdlib/SDL_stdlib.c | 2 +- src/stdlib/SDL_string.c | 2 +- src/test/SDL_test_assert.c | 2 +- src/test/SDL_test_common.c | 2 +- src/test/SDL_test_compare.c | 2 +- src/test/SDL_test_crc32.c | 2 +- src/test/SDL_test_font.c | 2 +- src/test/SDL_test_fuzzer.c | 2 +- src/test/SDL_test_harness.c | 2 +- src/test/SDL_test_imageBlit.c | 2 +- src/test/SDL_test_imageBlitBlend.c | 2 +- src/test/SDL_test_imageFace.c | 2 +- src/test/SDL_test_imagePrimitives.c | 2 +- src/test/SDL_test_imagePrimitivesBlend.c | 2 +- src/test/SDL_test_log.c | 2 +- src/test/SDL_test_md5.c | 2 +- src/test/SDL_test_random.c | 2 +- src/thread/SDL_systhread.h | 2 +- src/thread/SDL_thread.c | 2 +- src/thread/SDL_thread_c.h | 2 +- src/thread/generic/SDL_syscond.c | 2 +- src/thread/generic/SDL_sysmutex.c | 2 +- src/thread/generic/SDL_sysmutex_c.h | 2 +- src/thread/generic/SDL_syssem.c | 2 +- src/thread/generic/SDL_systhread.c | 2 +- src/thread/generic/SDL_systhread_c.h | 2 +- src/thread/generic/SDL_systls.c | 2 +- src/thread/psp/SDL_syscond.c | 2 +- src/thread/psp/SDL_sysmutex.c | 2 +- src/thread/psp/SDL_sysmutex_c.h | 2 +- src/thread/psp/SDL_syssem.c | 2 +- src/thread/psp/SDL_systhread.c | 2 +- src/thread/psp/SDL_systhread_c.h | 2 +- src/thread/pthread/SDL_syscond.c | 2 +- src/thread/pthread/SDL_sysmutex.c | 2 +- src/thread/pthread/SDL_sysmutex_c.h | 2 +- src/thread/pthread/SDL_syssem.c | 2 +- src/thread/pthread/SDL_systhread.c | 6 +- src/thread/pthread/SDL_systhread_c.h | 2 +- src/thread/pthread/SDL_systls.c | 2 +- src/thread/stdcpp/SDL_syscond.cpp | 4 +- src/thread/stdcpp/SDL_sysmutex.cpp | 2 +- src/thread/stdcpp/SDL_sysmutex_c.h | 2 +- src/thread/stdcpp/SDL_systhread.cpp | 2 +- src/thread/stdcpp/SDL_systhread_c.h | 2 +- src/thread/windows/SDL_sysmutex.c | 6 +- src/thread/windows/SDL_syssem.c | 10 +- src/thread/windows/SDL_systhread.c | 8 +- src/thread/windows/SDL_systhread_c.h | 2 +- src/thread/windows/SDL_systls.c | 2 +- src/timer/SDL_timer.c | 2 +- src/timer/SDL_timer_c.h | 2 +- src/timer/dummy/SDL_systimer.c | 2 +- src/timer/haiku/SDL_systimer.c | 2 +- src/timer/psp/SDL_systimer.c | 2 +- src/timer/unix/SDL_systimer.c | 2 +- src/timer/windows/SDL_systimer.c | 2 +- src/video/SDL_RLEaccel.c | 2 +- src/video/SDL_RLEaccel_c.h | 2 +- src/video/SDL_blit.c | 2 +- src/video/SDL_blit.h | 2 +- src/video/SDL_blit_0.c | 2 +- src/video/SDL_blit_1.c | 2 +- src/video/SDL_blit_A.c | 2 +- src/video/SDL_blit_N.c | 2 +- src/video/SDL_blit_auto.c | 2 +- src/video/SDL_blit_auto.h | 2 +- src/video/SDL_blit_copy.c | 2 +- src/video/SDL_blit_copy.h | 2 +- src/video/SDL_blit_slow.c | 2 +- src/video/SDL_blit_slow.h | 2 +- src/video/SDL_bmp.c | 2 +- src/video/SDL_clipboard.c | 2 +- src/video/SDL_egl.c | 2 +- src/video/SDL_egl_c.h | 2 +- src/video/SDL_fillrect.c | 2 +- src/video/SDL_pixels.c | 2 +- src/video/SDL_pixels_c.h | 2 +- src/video/SDL_rect.c | 2 +- src/video/SDL_rect_c.h | 2 +- src/video/SDL_shape.c | 2 +- src/video/SDL_shape_internals.h | 2 +- src/video/SDL_stretch.c | 2 +- src/video/SDL_surface.c | 2 +- src/video/SDL_sysvideo.h | 2 +- src/video/SDL_video.c | 86 ++- 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 +- 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 +- src/video/android/SDL_androidmouse.c | 2 +- src/video/android/SDL_androidmouse.h | 2 +- src/video/android/SDL_androidtouch.c | 2 +- src/video/android/SDL_androidtouch.h | 2 +- src/video/android/SDL_androidvideo.c | 2 +- src/video/android/SDL_androidvideo.h | 2 +- src/video/android/SDL_androidwindow.c | 2 +- src/video/android/SDL_androidwindow.h | 2 +- src/video/cocoa/SDL_cocoaclipboard.h | 2 +- src/video/cocoa/SDL_cocoaclipboard.m | 2 +- src/video/cocoa/SDL_cocoaevents.h | 2 +- src/video/cocoa/SDL_cocoaevents.m | 2 +- src/video/cocoa/SDL_cocoakeyboard.h | 2 +- src/video/cocoa/SDL_cocoakeyboard.m | 77 ++- src/video/cocoa/SDL_cocoamessagebox.h | 2 +- src/video/cocoa/SDL_cocoamessagebox.m | 2 +- src/video/cocoa/SDL_cocoamodes.h | 2 +- src/video/cocoa/SDL_cocoamodes.m | 2 +- src/video/cocoa/SDL_cocoamouse.h | 2 +- src/video/cocoa/SDL_cocoamouse.m | 2 +- src/video/cocoa/SDL_cocoamousetap.h | 2 +- src/video/cocoa/SDL_cocoamousetap.m | 2 +- src/video/cocoa/SDL_cocoaopengl.h | 2 +- src/video/cocoa/SDL_cocoaopengl.m | 2 +- src/video/cocoa/SDL_cocoashape.h | 2 +- src/video/cocoa/SDL_cocoashape.m | 2 +- src/video/cocoa/SDL_cocoavideo.h | 2 +- src/video/cocoa/SDL_cocoavideo.m | 2 +- src/video/cocoa/SDL_cocoawindow.h | 2 +- src/video/cocoa/SDL_cocoawindow.m | 99 +++- src/video/directfb/SDL_DirectFB_WM.c | 2 +- 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 | 2 +- src/video/directfb/SDL_DirectFB_video.h | 2 +- src/video/directfb/SDL_DirectFB_window.c | 2 +- src/video/directfb/SDL_DirectFB_window.h | 2 +- src/video/dummy/SDL_nullevents.c | 2 +- src/video/dummy/SDL_nullevents_c.h | 2 +- src/video/dummy/SDL_nullframebuffer.c | 2 +- src/video/dummy/SDL_nullframebuffer_c.h | 2 +- src/video/dummy/SDL_nullvideo.c | 2 +- src/video/dummy/SDL_nullvideo.h | 2 +- src/video/emscripten/SDL_emscriptenevents.c | 2 +- src/video/emscripten/SDL_emscriptenevents.h | 2 +- .../emscripten/SDL_emscriptenframebuffer.c | 2 +- .../emscripten/SDL_emscriptenframebuffer.h | 2 +- src/video/emscripten/SDL_emscriptenmouse.c | 2 +- src/video/emscripten/SDL_emscriptenmouse.h | 2 +- src/video/emscripten/SDL_emscriptenopengles.c | 2 +- src/video/emscripten/SDL_emscriptenopengles.h | 2 +- src/video/emscripten/SDL_emscriptenvideo.c | 2 +- src/video/emscripten/SDL_emscriptenvideo.h | 2 +- src/video/haiku/SDL_BWin.h | 2 +- src/video/haiku/SDL_bclipboard.cc | 2 +- src/video/haiku/SDL_bclipboard.h | 2 +- src/video/haiku/SDL_bevents.cc | 2 +- src/video/haiku/SDL_bevents.h | 2 +- src/video/haiku/SDL_bframebuffer.cc | 2 +- src/video/haiku/SDL_bframebuffer.h | 2 +- src/video/haiku/SDL_bkeyboard.cc | 2 +- src/video/haiku/SDL_bkeyboard.h | 2 +- src/video/haiku/SDL_bmodes.cc | 2 +- src/video/haiku/SDL_bmodes.h | 2 +- src/video/haiku/SDL_bopengl.cc | 2 +- src/video/haiku/SDL_bopengl.h | 2 +- src/video/haiku/SDL_bvideo.cc | 2 +- src/video/haiku/SDL_bvideo.h | 2 +- src/video/haiku/SDL_bwindow.cc | 2 +- src/video/haiku/SDL_bwindow.h | 2 +- src/video/mir/SDL_mirdyn.c | 2 +- src/video/mir/SDL_mirdyn.h | 2 +- src/video/mir/SDL_mirevents.c | 2 +- src/video/mir/SDL_mirevents.h | 2 +- src/video/mir/SDL_mirframebuffer.c | 2 +- src/video/mir/SDL_mirframebuffer.h | 2 +- src/video/mir/SDL_mirmouse.c | 2 +- src/video/mir/SDL_mirmouse.h | 2 +- src/video/mir/SDL_miropengl.c | 2 +- src/video/mir/SDL_miropengl.h | 2 +- src/video/mir/SDL_mirsym.h | 2 +- src/video/mir/SDL_mirvideo.c | 2 +- src/video/mir/SDL_mirvideo.h | 2 +- src/video/mir/SDL_mirwindow.c | 2 +- src/video/mir/SDL_mirwindow.h | 2 +- src/video/nacl/SDL_naclevents.c | 2 +- src/video/nacl/SDL_naclevents_c.h | 2 +- src/video/nacl/SDL_naclglue.c | 2 +- src/video/nacl/SDL_naclopengles.c | 2 +- src/video/nacl/SDL_naclopengles.h | 2 +- src/video/nacl/SDL_naclvideo.c | 2 +- src/video/nacl/SDL_naclvideo.h | 2 +- src/video/nacl/SDL_naclwindow.c | 2 +- src/video/nacl/SDL_naclwindow.h | 2 +- src/video/pandora/SDL_pandora.c | 2 +- src/video/pandora/SDL_pandora.h | 2 +- src/video/pandora/SDL_pandora_events.c | 2 +- src/video/pandora/SDL_pandora_events.h | 2 +- src/video/psp/SDL_pspevents.c | 2 +- src/video/psp/SDL_pspevents_c.h | 2 +- src/video/psp/SDL_pspgl.c | 2 +- src/video/psp/SDL_pspgl_c.h | 2 +- src/video/psp/SDL_pspmouse.c | 2 +- src/video/psp/SDL_pspmouse_c.h | 2 +- src/video/psp/SDL_pspvideo.c | 2 +- src/video/psp/SDL_pspvideo.h | 2 +- src/video/raspberry/SDL_rpievents.c | 2 +- src/video/raspberry/SDL_rpievents_c.h | 2 +- src/video/raspberry/SDL_rpimouse.c | 2 +- src/video/raspberry/SDL_rpimouse.h | 2 +- src/video/raspberry/SDL_rpiopengles.c | 2 +- src/video/raspberry/SDL_rpiopengles.h | 2 +- src/video/raspberry/SDL_rpivideo.c | 2 +- src/video/raspberry/SDL_rpivideo.h | 2 +- src/video/sdlgenblit.pl | 2 +- src/video/uikit/SDL_uikitappdelegate.h | 2 +- src/video/uikit/SDL_uikitappdelegate.m | 2 +- src/video/uikit/SDL_uikitevents.h | 2 +- src/video/uikit/SDL_uikitevents.m | 2 +- src/video/uikit/SDL_uikitmessagebox.h | 2 +- src/video/uikit/SDL_uikitmessagebox.m | 2 +- src/video/uikit/SDL_uikitmodes.h | 2 +- src/video/uikit/SDL_uikitmodes.m | 2 +- src/video/uikit/SDL_uikitopengles.h | 2 +- src/video/uikit/SDL_uikitopengles.m | 2 +- src/video/uikit/SDL_uikitopenglview.h | 2 +- src/video/uikit/SDL_uikitopenglview.m | 2 +- src/video/uikit/SDL_uikitvideo.h | 2 +- src/video/uikit/SDL_uikitvideo.m | 2 +- src/video/uikit/SDL_uikitview.h | 2 +- src/video/uikit/SDL_uikitview.m | 2 +- src/video/uikit/SDL_uikitviewcontroller.h | 2 +- src/video/uikit/SDL_uikitviewcontroller.m | 2 +- src/video/uikit/SDL_uikitwindow.h | 2 +- src/video/uikit/SDL_uikitwindow.m | 9 +- 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 +- src/video/vivante/SDL_vivantevideo.c | 2 +- src/video/vivante/SDL_vivantevideo.h | 2 +- src/video/wayland/SDL_waylanddyn.c | 2 +- src/video/wayland/SDL_waylanddyn.h | 2 +- src/video/wayland/SDL_waylandevents.c | 2 +- src/video/wayland/SDL_waylandevents_c.h | 2 +- src/video/wayland/SDL_waylandmouse.c | 2 +- src/video/wayland/SDL_waylandmouse.h | 2 +- src/video/wayland/SDL_waylandopengles.c | 2 +- src/video/wayland/SDL_waylandopengles.h | 2 +- src/video/wayland/SDL_waylandsym.h | 2 +- src/video/wayland/SDL_waylandtouch.c | 2 +- src/video/wayland/SDL_waylandtouch.h | 2 +- src/video/wayland/SDL_waylandvideo.c | 2 +- src/video/wayland/SDL_waylandvideo.h | 2 +- src/video/wayland/SDL_waylandwindow.c | 2 +- src/video/wayland/SDL_waylandwindow.h | 2 +- src/video/windows/SDL_msctf.h | 2 +- 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 | 9 +- src/video/windows/SDL_windowsevents.h | 2 +- src/video/windows/SDL_windowsframebuffer.c | 5 +- src/video/windows/SDL_windowsframebuffer.h | 2 +- src/video/windows/SDL_windowskeyboard.c | 6 +- src/video/windows/SDL_windowskeyboard.h | 2 +- src/video/windows/SDL_windowsmessagebox.c | 2 +- src/video/windows/SDL_windowsmessagebox.h | 2 +- src/video/windows/SDL_windowsmodes.c | 2 +- src/video/windows/SDL_windowsmodes.h | 2 +- src/video/windows/SDL_windowsmouse.c | 2 +- src/video/windows/SDL_windowsmouse.h | 2 +- src/video/windows/SDL_windowsopengl.c | 42 +- src/video/windows/SDL_windowsopengl.h | 2 +- src/video/windows/SDL_windowsopengles.c | 2 +- src/video/windows/SDL_windowsopengles.h | 2 +- src/video/windows/SDL_windowsshape.c | 2 +- src/video/windows/SDL_windowsshape.h | 2 +- src/video/windows/SDL_windowsvideo.c | 2 +- src/video/windows/SDL_windowsvideo.h | 2 +- src/video/windows/SDL_windowswindow.c | 20 +- src/video/windows/SDL_windowswindow.h | 4 +- src/video/windows/wmmsg.h | 2 +- src/video/winrt/SDL_winrtevents.cpp | 2 +- src/video/winrt/SDL_winrtevents_c.h | 4 +- src/video/winrt/SDL_winrtkeyboard.cpp | 2 +- src/video/winrt/SDL_winrtmessagebox.cpp | 2 +- src/video/winrt/SDL_winrtmessagebox.h | 2 +- src/video/winrt/SDL_winrtmouse.cpp | 2 +- src/video/winrt/SDL_winrtmouse_c.h | 2 +- src/video/winrt/SDL_winrtopengles.cpp | 2 +- src/video/winrt/SDL_winrtopengles.h | 2 +- src/video/winrt/SDL_winrtpointerinput.cpp | 24 +- src/video/winrt/SDL_winrtvideo.cpp | 526 ++++++++++++++---- src/video/winrt/SDL_winrtvideo_cpp.h | 39 +- src/video/x11/SDL_x11clipboard.c | 2 +- src/video/x11/SDL_x11clipboard.h | 2 +- src/video/x11/SDL_x11dyn.c | 2 +- src/video/x11/SDL_x11dyn.h | 2 +- src/video/x11/SDL_x11events.c | 25 +- src/video/x11/SDL_x11events.h | 2 +- src/video/x11/SDL_x11framebuffer.c | 2 +- src/video/x11/SDL_x11framebuffer.h | 2 +- src/video/x11/SDL_x11keyboard.c | 2 +- src/video/x11/SDL_x11keyboard.h | 2 +- src/video/x11/SDL_x11messagebox.c | 2 +- src/video/x11/SDL_x11messagebox.h | 2 +- src/video/x11/SDL_x11modes.c | 212 +++---- src/video/x11/SDL_x11modes.h | 2 +- src/video/x11/SDL_x11mouse.c | 2 +- src/video/x11/SDL_x11mouse.h | 2 +- src/video/x11/SDL_x11opengl.c | 2 +- src/video/x11/SDL_x11opengl.h | 2 +- src/video/x11/SDL_x11opengles.c | 2 +- src/video/x11/SDL_x11opengles.h | 2 +- src/video/x11/SDL_x11shape.c | 2 +- src/video/x11/SDL_x11shape.h | 2 +- src/video/x11/SDL_x11sym.h | 2 +- src/video/x11/SDL_x11touch.c | 2 +- src/video/x11/SDL_x11touch.h | 2 +- src/video/x11/SDL_x11video.c | 2 +- src/video/x11/SDL_x11video.h | 2 +- src/video/x11/SDL_x11window.c | 2 +- src/video/x11/SDL_x11window.h | 2 +- src/video/x11/SDL_x11xinput2.c | 2 +- src/video/x11/SDL_x11xinput2.h | 2 +- 642 files changed, 2527 insertions(+), 1297 deletions(-) create mode 100644 src/audio/xaudio2/SDL_xaudio2.h delete mode 100644 src/joystick/SDL_gamecontrollerdb.h.new diff --git a/include/SDL.h b/include/SDL.h index 9d1ede336..7647b5111 100644 --- a/include/SDL.h +++ b/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/include/SDL_assert.h b/include/SDL_assert.h index 6889514d4..402981f96 100644 --- a/include/SDL_assert.h +++ b/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/include/SDL_atomic.h b/include/SDL_atomic.h index bb01eb9e1..56aa81df9 100644 --- a/include/SDL_atomic.h +++ b/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/include/SDL_audio.h b/include/SDL_audio.h index 359005d02..4f6552146 100644 --- a/include/SDL_audio.h +++ b/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/include/SDL_bits.h b/include/SDL_bits.h index c62766d9e..528da2eac 100644 --- a/include/SDL_bits.h +++ b/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/include/SDL_blendmode.h b/include/SDL_blendmode.h index c7fa09f72..56d8ad66e 100644 --- a/include/SDL_blendmode.h +++ b/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/include/SDL_clipboard.h b/include/SDL_clipboard.h index 3ad20548b..a5556f21c 100644 --- a/include/SDL_clipboard.h +++ b/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/include/SDL_config_android.h b/include/SDL_config_android.h index 8d5f1e5f2..a388ba8de 100644 --- a/include/SDL_config_android.h +++ b/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/include/SDL_config_iphoneos.h b/include/SDL_config_iphoneos.h index 2d741c389..304c89201 100644 --- a/include/SDL_config_iphoneos.h +++ b/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/include/SDL_config_macosx.h b/include/SDL_config_macosx.h index e4ce82fc2..5c8b7e033 100644 --- a/include/SDL_config_macosx.h +++ b/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/include/SDL_config_minimal.h b/include/SDL_config_minimal.h index 7721abc92..3c9d09afc 100644 --- a/include/SDL_config_minimal.h +++ b/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/include/SDL_config_pandora.h b/include/SDL_config_pandora.h index 530e78f11..7b51e571f 100644 --- a/include/SDL_config_pandora.h +++ b/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/include/SDL_config_psp.h b/include/SDL_config_psp.h index 26bf9d1a2..a6e49609a 100644 --- a/include/SDL_config_psp.h +++ b/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/include/SDL_config_windows.h b/include/SDL_config_windows.h index 067d7f310..890986cc4 100644 --- a/include/SDL_config_windows.h +++ b/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/include/SDL_config_winrt.h b/include/SDL_config_winrt.h index 0a33993f6..e392f773e 100644 --- a/include/SDL_config_winrt.h +++ b/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 @@ -19,11 +19,26 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_windows_h -#define _SDL_config_windows_h +#ifndef _SDL_config_winrt_h +#define _SDL_config_winrt_h #include "SDL_platform.h" +/* Make sure the Windows SDK's NTDDI_VERSION macro gets defined. This is used + by SDL to determine which version of the Windows SDK is being used. +*/ +#include + +/* Define possibly-undefined NTDDI values (used when compiling SDL against + older versions of the Windows SDK. +*/ +#ifndef NTDDI_WINBLUE +#define NTDDI_WINBLUE 0x06030000 +#endif +#ifndef NTDDI_WIN10 +#define NTDDI_WIN10 0x0A000000 +#endif + /* This is a set of defines to configure the SDL features */ #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) @@ -163,7 +178,12 @@ typedef unsigned int uintptr_t; #define SDL_LOADSO_WINDOWS 1 /* Enable various threading systems */ +#if (NTDDI_VERSION >= NTDDI_WINBLUE) +#define SDL_THREAD_WINDOWS 1 +#else +/* WinRT on Windows 8.0 and Windows Phone 8.0 don't support CreateThread() */ #define SDL_THREAD_STDCPP 1 +#endif /* Enable various timer systems */ #define SDL_TIMER_WINDOWS 1 @@ -191,4 +211,4 @@ typedef unsigned int uintptr_t; #define SDL_ASSEMBLY_ROUTINES 1 #endif -#endif /* _SDL_config_windows_h */ +#endif /* _SDL_config_winrt_h */ diff --git a/include/SDL_config_wiz.h b/include/SDL_config_wiz.h index 4b3c5a2a2..e090a1a90 100644 --- a/include/SDL_config_wiz.h +++ b/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 @@ -97,7 +97,6 @@ #define HAVE_NANOSLEEP 1 #define HAVE_POW 1 -#define SDL_CDROM_DISABLED 1 #define SDL_AUDIO_DRIVER_DUMMY 1 #define SDL_AUDIO_DRIVER_OSS 1 diff --git a/include/SDL_copying.h b/include/SDL_copying.h index 6fd65219c..212da0ee0 100644 --- a/include/SDL_copying.h +++ b/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/include/SDL_cpuinfo.h b/include/SDL_cpuinfo.h index 30d09cce8..d0ba47bf7 100644 --- a/include/SDL_cpuinfo.h +++ b/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/include/SDL_egl.h b/include/SDL_egl.h index 358d869b2..bea2a6c0e 100644 --- a/include/SDL_egl.h +++ b/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/include/SDL_endian.h b/include/SDL_endian.h index ec7841c48..9100b103d 100644 --- a/include/SDL_endian.h +++ b/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/include/SDL_error.h b/include/SDL_error.h index 1720c43f8..2f3b4b500 100644 --- a/include/SDL_error.h +++ b/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/include/SDL_events.h b/include/SDL_events.h index 8a364c2ad..1437f4c70 100644 --- a/include/SDL_events.h +++ b/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 diff --git a/include/SDL_filesystem.h b/include/SDL_filesystem.h index 15bda498a..02999ed27 100644 --- a/include/SDL_filesystem.h +++ b/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/include/SDL_gamecontroller.h b/include/SDL_gamecontroller.h index 72fba60bf..42087eea1 100644 --- a/include/SDL_gamecontroller.h +++ b/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 @@ -171,6 +171,11 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_ */ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index); +/** + * Return the SDL_GameController associated with an instance id. + */ +extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid); + /** * Return the name for this currently opened controller */ diff --git a/include/SDL_gesture.h b/include/SDL_gesture.h index 44983486d..3c29ca7ac 100644 --- a/include/SDL_gesture.h +++ b/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/include/SDL_haptic.h b/include/SDL_haptic.h index 0e6f523b0..b36d78b12 100644 --- a/include/SDL_haptic.h +++ b/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/include/SDL_hints.h b/include/SDL_hints.h index c28cbad8a..3bd5435fb 100644 --- a/include/SDL_hints.h +++ b/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/include/SDL_joystick.h b/include/SDL_joystick.h index a707e6c38..266f3b387 100644 --- a/include/SDL_joystick.h +++ b/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 @@ -106,6 +106,11 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); */ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index); +/** + * Return the SDL_Joystick associated with an instance id. + */ +extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID joyid); + /** * Return the name for this currently opened joystick. * If no name can be found, this function returns NULL. @@ -253,11 +258,10 @@ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick, extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick); /** -* Return the battery level of this joystick -*/ + * Return the battery level of this joystick + */ extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL_Joystick * joystick); - /* Ends C function definitions when using C++ */ #ifdef __cplusplus } diff --git a/include/SDL_keyboard.h b/include/SDL_keyboard.h index 1ad58ee37..bbba0f07b 100644 --- a/include/SDL_keyboard.h +++ b/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/include/SDL_keycode.h b/include/SDL_keycode.h index 66980cef0..7be963571 100644 --- a/include/SDL_keycode.h +++ b/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/include/SDL_loadso.h b/include/SDL_loadso.h index db7493ad7..3d540bd7d 100644 --- a/include/SDL_loadso.h +++ b/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/include/SDL_log.h b/include/SDL_log.h index 6ffbfc99f..09be1104d 100644 --- a/include/SDL_log.h +++ b/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/include/SDL_main.h b/include/SDL_main.h index c5168ba6b..9ce3754e9 100644 --- a/include/SDL_main.h +++ b/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/include/SDL_messagebox.h b/include/SDL_messagebox.h index 44d458f46..ec370dbbe 100644 --- a/include/SDL_messagebox.h +++ b/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/include/SDL_mouse.h b/include/SDL_mouse.h index 1ae312698..ea9622f0f 100644 --- a/include/SDL_mouse.h +++ b/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/include/SDL_mutex.h b/include/SDL_mutex.h index 2765210a4..b7e39734e 100644 --- a/include/SDL_mutex.h +++ b/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/include/SDL_name.h b/include/SDL_name.h index b6a413a2c..06cd4a5e2 100644 --- a/include/SDL_name.h +++ b/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/include/SDL_opengl.h b/include/SDL_opengl.h index aebe30ebb..780919bc4 100644 --- a/include/SDL_opengl.h +++ b/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/include/SDL_opengles.h b/include/SDL_opengles.h index 49c709c1d..bcc127779 100644 --- a/include/SDL_opengles.h +++ b/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/include/SDL_opengles2.h b/include/SDL_opengles2.h index 13ebd9dc2..edcd1a24a 100644 --- a/include/SDL_opengles2.h +++ b/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/include/SDL_pixels.h b/include/SDL_pixels.h index ba24a47dd..8499c3289 100644 --- a/include/SDL_pixels.h +++ b/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/include/SDL_platform.h b/include/SDL_platform.h index 75e4c6535..c6c21398b 100644 --- a/include/SDL_platform.h +++ b/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/include/SDL_power.h b/include/SDL_power.h index 89eb1718f..24c050114 100644 --- a/include/SDL_power.h +++ b/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/include/SDL_quit.h b/include/SDL_quit.h index 0108ff044..cc06f28d8 100644 --- a/include/SDL_quit.h +++ b/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/include/SDL_rect.h b/include/SDL_rect.h index ebe516740..bbcb9a3b8 100644 --- a/include/SDL_rect.h +++ b/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/include/SDL_render.h b/include/SDL_render.h index de2749cce..e4ed2af69 100644 --- a/include/SDL_render.h +++ b/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); diff --git a/include/SDL_revision.h b/include/SDL_revision.h index 76c0758b9..6d7163d4d 100644 --- a/include/SDL_revision.h +++ b/include/SDL_revision.h @@ -1,2 +1,2 @@ -#define SDL_REVISION "hg-9901:c9cae280468f" -#define SDL_REVISION_NUMBER 9901 +#define SDL_REVISION "hg-10001:e12c38730512" +#define SDL_REVISION_NUMBER 10001 diff --git a/include/SDL_rwops.h b/include/SDL_rwops.h index c8b024be3..f460ae7d4 100644 --- a/include/SDL_rwops.h +++ b/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/include/SDL_scancode.h b/include/SDL_scancode.h index 4bf861804..0af1dd59f 100644 --- a/include/SDL_scancode.h +++ b/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/include/SDL_shape.h b/include/SDL_shape.h index 157d61279..db10a8f01 100644 --- a/include/SDL_shape.h +++ b/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/include/SDL_stdinc.h b/include/SDL_stdinc.h index c1f2b6dd7..887bcd2d4 100644 --- a/include/SDL_stdinc.h +++ b/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/include/SDL_surface.h b/include/SDL_surface.h index 3634f7d38..e63ca8903 100644 --- a/include/SDL_surface.h +++ b/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/include/SDL_system.h b/include/SDL_system.h index bdc4f9684..5da9adb45 100644 --- a/include/SDL_system.h +++ b/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/include/SDL_syswm.h b/include/SDL_syswm.h index a3441fdc9..1056e526b 100644 --- a/include/SDL_syswm.h +++ b/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 diff --git a/include/SDL_test.h b/include/SDL_test.h index 77b350bd0..217847bfc 100644 --- a/include/SDL_test.h +++ b/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/include/SDL_test_assert.h b/include/SDL_test_assert.h index a800a3840..29277e122 100644 --- a/include/SDL_test_assert.h +++ b/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/include/SDL_test_common.h b/include/SDL_test_common.h index bb671fa50..0ebf31cb6 100644 --- a/include/SDL_test_common.h +++ b/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/include/SDL_test_compare.h b/include/SDL_test_compare.h index bc1213363..772cf9fbd 100644 --- a/include/SDL_test_compare.h +++ b/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/include/SDL_test_crc32.h b/include/SDL_test_crc32.h index cf9ea23db..572a3d955 100644 --- a/include/SDL_test_crc32.h +++ b/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/include/SDL_test_font.h b/include/SDL_test_font.h index 42696d74c..3378ea85b 100644 --- a/include/SDL_test_font.h +++ b/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/include/SDL_test_fuzzer.h b/include/SDL_test_fuzzer.h index 59c89a501..9603652b2 100644 --- a/include/SDL_test_fuzzer.h +++ b/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/include/SDL_test_harness.h b/include/SDL_test_harness.h index b33893157..74c0950cd 100644 --- a/include/SDL_test_harness.h +++ b/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/include/SDL_test_images.h b/include/SDL_test_images.h index 9b9f979b3..8c64b4feb 100644 --- a/include/SDL_test_images.h +++ b/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/include/SDL_test_log.h b/include/SDL_test_log.h index 968d9b32a..73a5c016f 100644 --- a/include/SDL_test_log.h +++ b/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/include/SDL_test_md5.h b/include/SDL_test_md5.h index 52ea2c9a4..f2d9a7d7e 100644 --- a/include/SDL_test_md5.h +++ b/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/include/SDL_test_random.h b/include/SDL_test_random.h index 925205dfb..91c36526c 100644 --- a/include/SDL_test_random.h +++ b/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/include/SDL_thread.h b/include/SDL_thread.h index 797767f8b..377e6c73d 100644 --- a/include/SDL_thread.h +++ b/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/include/SDL_timer.h b/include/SDL_timer.h index 1f2a02063..e0d3785ee 100644 --- a/include/SDL_timer.h +++ b/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/include/SDL_touch.h b/include/SDL_touch.h index 68ff17149..2643e3679 100644 --- a/include/SDL_touch.h +++ b/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/include/SDL_types.h b/include/SDL_types.h index 1a1877fa9..5118af219 100644 --- a/include/SDL_types.h +++ b/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/include/SDL_version.h b/include/SDL_version.h index 0b364d073..de1f16056 100644 --- a/include/SDL_version.h +++ b/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/include/SDL_video.h b/include/SDL_video.h index f466165b4..52dbbc765 100644 --- a/include/SDL_video.h +++ b/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; @@ -143,7 +143,9 @@ typedef enum SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1, data2 */ SDL_WINDOWEVENT_RESIZED, /**< Window has been resized to data1xdata2 */ - SDL_WINDOWEVENT_SIZE_CHANGED, /**< The window size has changed, either as a result of an API call or through the system or user changing the window size. */ + SDL_WINDOWEVENT_SIZE_CHANGED, /**< The window size has changed, either as + a result of an API call or through the + system or user changing the window size. */ SDL_WINDOWEVENT_MINIMIZED, /**< Window has been minimized */ SDL_WINDOWEVENT_MAXIMIZED, /**< Window has been maximized */ SDL_WINDOWEVENT_RESTORED, /**< Window has been restored to normal size @@ -412,8 +414,8 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window); * ::SDL_WINDOWPOS_UNDEFINED. * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or * ::SDL_WINDOWPOS_UNDEFINED. - * \param w The width of the window. - * \param h The height of the window. + * \param w The width of the window, in screen coordinates. + * \param h The height of the window, in screen coordinates. * \param flags The flags for the window, a mask of any of the following: * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL, * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS, @@ -423,6 +425,12 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window); * * \return The id of the window created, or zero if window creation failed. * + * If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size + * in pixels may differ from its size in screen coordinates on platforms with + * high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query + * the client area's size in screen coordinates, and SDL_GL_GetDrawableSize() + * or SDL_GetRendererOutputSize() to query the drawable size in pixels. + * * \sa SDL_DestroyWindow() */ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title, @@ -513,10 +521,10 @@ extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window, * \brief Set the position of a window. * * \param window The window to reposition. - * \param x The x coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or - ::SDL_WINDOWPOS_UNDEFINED. - * \param y The y coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or - ::SDL_WINDOWPOS_UNDEFINED. + * \param x The x coordinate of the window in screen coordinates, or + * ::SDL_WINDOWPOS_CENTERED or ::SDL_WINDOWPOS_UNDEFINED. + * \param y The y coordinate of the window in screen coordinates, or + * ::SDL_WINDOWPOS_CENTERED or ::SDL_WINDOWPOS_UNDEFINED. * * \note The window coordinate origin is the upper left of the display. * @@ -529,8 +537,10 @@ extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window, * \brief Get the position of a window. * * \param window The window to query. - * \param x Pointer to variable for storing the x position, may be NULL - * \param y Pointer to variable for storing the y position, may be NULL + * \param x Pointer to variable for storing the x position, in screen + * coordinates. May be NULL. + * \param y Pointer to variable for storing the y position, in screen + * coordinates. May be NULL. * * \sa SDL_SetWindowPosition() */ @@ -541,12 +551,17 @@ extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window, * \brief Set the size of a window's client area. * * \param window The window to resize. - * \param w The width of the window, must be >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,8 +571,15 @@ 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() */ @@ -1009,11 +1031,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/include/begin_code.h b/include/begin_code.h index c032400f7..04e78c64d 100644 --- a/include/begin_code.h +++ b/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/include/close_code.h b/include/close_code.h index 73f6c8186..d908b00eb 100644 --- a/include/close_code.h +++ b/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/src/SDL.c b/src/SDL.c index 6318bbe6f..5d310021a 100644 --- a/src/SDL.c +++ b/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/src/SDL_assert.c b/src/SDL_assert.c index e1d267a94..a21f70b68 100644 --- a/src/SDL_assert.c +++ b/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/src/SDL_assert_c.h b/src/SDL_assert_c.h index 6f05c925d..bc3b631e0 100644 --- a/src/SDL_assert_c.h +++ b/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/src/SDL_error.c b/src/SDL_error.c index 79e9347a4..ace5cc397 100644 --- a/src/SDL_error.c +++ b/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/src/SDL_error_c.h b/src/SDL_error_c.h index 946281d21..76ccf2b94 100644 --- a/src/SDL_error_c.h +++ b/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/src/SDL_hints.c b/src/SDL_hints.c index 7026ac5df..04523327a 100644 --- a/src/SDL_hints.c +++ b/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/src/SDL_internal.h b/src/SDL_internal.h index a3ccb3630..7e928501a 100644 --- a/src/SDL_internal.h +++ b/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/src/SDL_log.c b/src/SDL_log.c index b5ab601e9..60bac9f65 100644 --- a/src/SDL_log.c +++ b/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/src/atomic/SDL_atomic.c b/src/atomic/SDL_atomic.c index 30b4ccca9..db86d6eda 100644 --- a/src/atomic/SDL_atomic.c +++ b/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/src/atomic/SDL_spinlock.c b/src/atomic/SDL_spinlock.c index 1681aa781..f582afb4e 100644 --- a/src/atomic/SDL_spinlock.c +++ b/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/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index 04f1e7ec2..2ffd216c0 100644 --- a/src/audio/SDL_audio.c +++ b/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/src/audio/SDL_audio_c.h b/src/audio/SDL_audio_c.h index b1fab65ff..b03a9156f 100644 --- a/src/audio/SDL_audio_c.h +++ b/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/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c index 092839b8e..3b47c4cbc 100644 --- a/src/audio/SDL_audiocvt.c +++ b/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/src/audio/SDL_audiodev.c b/src/audio/SDL_audiodev.c index dd89af743..5c392cfb7 100644 --- a/src/audio/SDL_audiodev.c +++ b/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/src/audio/SDL_audiodev_c.h b/src/audio/SDL_audiodev_c.h index 2208d9c49..fa60bcdb1 100644 --- a/src/audio/SDL_audiodev_c.h +++ b/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/src/audio/SDL_audiomem.h b/src/audio/SDL_audiomem.h index a65b44b79..091d15c29 100644 --- a/src/audio/SDL_audiomem.h +++ b/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/src/audio/SDL_audiotypecvt.c b/src/audio/SDL_audiotypecvt.c index 1e3a64470..be3b7430a 100644 --- a/src/audio/SDL_audiotypecvt.c +++ b/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/src/audio/SDL_mixer.c b/src/audio/SDL_mixer.c index 38fda0bf7..b49c73dab 100644 --- a/src/audio/SDL_mixer.c +++ b/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/src/audio/SDL_sysaudio.h b/src/audio/SDL_sysaudio.h index c220f5821..426a190f1 100644 --- a/src/audio/SDL_sysaudio.h +++ b/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/src/audio/SDL_wave.c b/src/audio/SDL_wave.c index e898115ce..99daac64b 100644 --- a/src/audio/SDL_wave.c +++ b/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/src/audio/SDL_wave.h b/src/audio/SDL_wave.h index ccfa04480..f2f93986e 100644 --- a/src/audio/SDL_wave.h +++ b/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/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c index fac51978b..af952371b 100644 --- a/src/audio/alsa/SDL_alsa_audio.c +++ b/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 diff --git a/src/audio/alsa/SDL_alsa_audio.h b/src/audio/alsa/SDL_alsa_audio.h index c5d3aeeef..3080aea23 100644 --- a/src/audio/alsa/SDL_alsa_audio.h +++ b/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/src/audio/android/SDL_androidaudio.c b/src/audio/android/SDL_androidaudio.c index f35878cd6..4a4faadcf 100644 --- a/src/audio/android/SDL_androidaudio.c +++ b/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/src/audio/android/SDL_androidaudio.h b/src/audio/android/SDL_androidaudio.h index 38bb19054..639be9c08 100644 --- a/src/audio/android/SDL_androidaudio.h +++ b/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/src/audio/arts/SDL_artsaudio.c b/src/audio/arts/SDL_artsaudio.c index ca97c0af1..5d40cd14e 100644 --- a/src/audio/arts/SDL_artsaudio.c +++ b/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/src/audio/arts/SDL_artsaudio.h b/src/audio/arts/SDL_artsaudio.h index 54b86f6b0..6b9bf3037 100644 --- a/src/audio/arts/SDL_artsaudio.h +++ b/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/src/audio/bsd/SDL_bsdaudio.c b/src/audio/bsd/SDL_bsdaudio.c index b684f9eb3..eeb257371 100644 --- a/src/audio/bsd/SDL_bsdaudio.c +++ b/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/src/audio/bsd/SDL_bsdaudio.h b/src/audio/bsd/SDL_bsdaudio.h index 7eee944f9..7fe141b14 100644 --- a/src/audio/bsd/SDL_bsdaudio.h +++ b/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/src/audio/coreaudio/SDL_coreaudio.c b/src/audio/coreaudio/SDL_coreaudio.c index f75bc7846..46b617dc0 100644 --- a/src/audio/coreaudio/SDL_coreaudio.c +++ b/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/src/audio/coreaudio/SDL_coreaudio.h b/src/audio/coreaudio/SDL_coreaudio.h index 119d25826..577f9fb32 100644 --- a/src/audio/coreaudio/SDL_coreaudio.h +++ b/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/src/audio/directsound/SDL_directsound.c b/src/audio/directsound/SDL_directsound.c index 10c32f83f..065e163a6 100644 --- a/src/audio/directsound/SDL_directsound.c +++ b/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/src/audio/directsound/SDL_directsound.h b/src/audio/directsound/SDL_directsound.h index 718cbab34..0d5f6bd76 100644 --- a/src/audio/directsound/SDL_directsound.h +++ b/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/src/audio/disk/SDL_diskaudio.c b/src/audio/disk/SDL_diskaudio.c index ef8bc0dcb..28745f9d0 100644 --- a/src/audio/disk/SDL_diskaudio.c +++ b/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/src/audio/disk/SDL_diskaudio.h b/src/audio/disk/SDL_diskaudio.h index 0c1af3a54..b5666f7fc 100644 --- a/src/audio/disk/SDL_diskaudio.h +++ b/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/src/audio/dsp/SDL_dspaudio.c b/src/audio/dsp/SDL_dspaudio.c index 678c74fe8..17e029e1d 100644 --- a/src/audio/dsp/SDL_dspaudio.c +++ b/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/src/audio/dsp/SDL_dspaudio.h b/src/audio/dsp/SDL_dspaudio.h index 054c4d9a0..0e4acfcab 100644 --- a/src/audio/dsp/SDL_dspaudio.h +++ b/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/src/audio/dummy/SDL_dummyaudio.c b/src/audio/dummy/SDL_dummyaudio.c index ec9c40fa1..107f0b073 100644 --- a/src/audio/dummy/SDL_dummyaudio.c +++ b/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/src/audio/dummy/SDL_dummyaudio.h b/src/audio/dummy/SDL_dummyaudio.h index 9415c122a..b1f88b1cb 100644 --- a/src/audio/dummy/SDL_dummyaudio.h +++ b/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/src/audio/emscripten/SDL_emscriptenaudio.c b/src/audio/emscripten/SDL_emscriptenaudio.c index 792f12c11..8378233ca 100644 --- a/src/audio/emscripten/SDL_emscriptenaudio.c +++ b/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/src/audio/emscripten/SDL_emscriptenaudio.h b/src/audio/emscripten/SDL_emscriptenaudio.h index c3da6a025..cd5377d86 100644 --- a/src/audio/emscripten/SDL_emscriptenaudio.h +++ b/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/src/audio/esd/SDL_esdaudio.c b/src/audio/esd/SDL_esdaudio.c index 906728cb7..6a7882dcb 100644 --- a/src/audio/esd/SDL_esdaudio.c +++ b/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/src/audio/esd/SDL_esdaudio.h b/src/audio/esd/SDL_esdaudio.h index ad8159ee8..d362b16ce 100644 --- a/src/audio/esd/SDL_esdaudio.h +++ b/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/src/audio/fusionsound/SDL_fsaudio.c b/src/audio/fusionsound/SDL_fsaudio.c index 6bab5a786..b22a3e9a3 100644 --- a/src/audio/fusionsound/SDL_fsaudio.c +++ b/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/src/audio/fusionsound/SDL_fsaudio.h b/src/audio/fusionsound/SDL_fsaudio.h index aa2ae192b..5cf8a2009 100644 --- a/src/audio/fusionsound/SDL_fsaudio.h +++ b/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/src/audio/haiku/SDL_haikuaudio.cc b/src/audio/haiku/SDL_haikuaudio.cc index c4765e370..38f3b9621 100644 --- a/src/audio/haiku/SDL_haikuaudio.cc +++ b/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/src/audio/haiku/SDL_haikuaudio.h b/src/audio/haiku/SDL_haikuaudio.h index 21418618f..23e5a7655 100644 --- a/src/audio/haiku/SDL_haikuaudio.h +++ b/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/src/audio/nacl/SDL_naclaudio.c b/src/audio/nacl/SDL_naclaudio.c index 5c5b0bcf8..2d1ee73e9 100644 --- a/src/audio/nacl/SDL_naclaudio.c +++ b/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/src/audio/nacl/SDL_naclaudio.h b/src/audio/nacl/SDL_naclaudio.h index c2636f0c2..90ff5448e 100644 --- a/src/audio/nacl/SDL_naclaudio.h +++ b/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/src/audio/nas/SDL_nasaudio.c b/src/audio/nas/SDL_nasaudio.c index 596ca7529..9de5ff8b4 100644 --- a/src/audio/nas/SDL_nasaudio.c +++ b/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/src/audio/nas/SDL_nasaudio.h b/src/audio/nas/SDL_nasaudio.h index 715f1fb2f..2f46b0b60 100644 --- a/src/audio/nas/SDL_nasaudio.h +++ b/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/src/audio/paudio/SDL_paudio.c b/src/audio/paudio/SDL_paudio.c index 79c71645c..14c9701f4 100644 --- a/src/audio/paudio/SDL_paudio.c +++ b/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/src/audio/paudio/SDL_paudio.h b/src/audio/paudio/SDL_paudio.h index 2bcb706cb..ebc8bb5b1 100644 --- a/src/audio/paudio/SDL_paudio.h +++ b/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/src/audio/psp/SDL_pspaudio.c b/src/audio/psp/SDL_pspaudio.c index 60b7993ac..18d2947e4 100644 --- a/src/audio/psp/SDL_pspaudio.c +++ b/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 diff --git a/src/audio/psp/SDL_pspaudio.h b/src/audio/psp/SDL_pspaudio.h index c63327444..6b266bd0c 100644 --- a/src/audio/psp/SDL_pspaudio.h +++ b/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/src/audio/pulseaudio/SDL_pulseaudio.c b/src/audio/pulseaudio/SDL_pulseaudio.c index 30ca984e2..6b11e066f 100644 --- a/src/audio/pulseaudio/SDL_pulseaudio.c +++ b/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/src/audio/pulseaudio/SDL_pulseaudio.h b/src/audio/pulseaudio/SDL_pulseaudio.h index 995c53c60..c57ab7132 100644 --- a/src/audio/pulseaudio/SDL_pulseaudio.h +++ b/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/src/audio/qsa/SDL_qsa_audio.c b/src/audio/qsa/SDL_qsa_audio.c index 784466ca3..1899ca6d9 100644 --- a/src/audio/qsa/SDL_qsa_audio.c +++ b/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/src/audio/qsa/SDL_qsa_audio.h b/src/audio/qsa/SDL_qsa_audio.h index 363feb47c..53d37e96f 100644 --- a/src/audio/qsa/SDL_qsa_audio.h +++ b/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/src/audio/sdlgenaudiocvt.pl b/src/audio/sdlgenaudiocvt.pl index b012df801..c53f1c355 100755 --- a/src/audio/sdlgenaudiocvt.pl +++ b/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/src/audio/sndio/SDL_sndioaudio.c b/src/audio/sndio/SDL_sndioaudio.c index ba4fc4fa8..64565ae88 100644 --- a/src/audio/sndio/SDL_sndioaudio.c +++ b/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/src/audio/sndio/SDL_sndioaudio.h b/src/audio/sndio/SDL_sndioaudio.h index 6956674be..1e748ac93 100644 --- a/src/audio/sndio/SDL_sndioaudio.h +++ b/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/src/audio/sun/SDL_sunaudio.c b/src/audio/sun/SDL_sunaudio.c index 9cdefbdb5..71029d21f 100644 --- a/src/audio/sun/SDL_sunaudio.c +++ b/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/src/audio/sun/SDL_sunaudio.h b/src/audio/sun/SDL_sunaudio.h index 02ac6cbd9..ecced0f51 100644 --- a/src/audio/sun/SDL_sunaudio.h +++ b/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/src/audio/winmm/SDL_winmm.c b/src/audio/winmm/SDL_winmm.c index 37debb90c..6d05a65ef 100644 --- a/src/audio/winmm/SDL_winmm.c +++ b/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/src/audio/winmm/SDL_winmm.h b/src/audio/winmm/SDL_winmm.h index a0dec0104..401db398b 100644 --- a/src/audio/winmm/SDL_winmm.h +++ b/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/src/audio/xaudio2/SDL_xaudio2.c b/src/audio/xaudio2/SDL_xaudio2.c index 9d6858337..dff234b40 100644 --- a/src/audio/xaudio2/SDL_xaudio2.c +++ b/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 @@ -58,17 +58,19 @@ /* The configure script already did any necessary checking */ # define SDL_XAUDIO2_HAS_SDK 1 #elif defined(__WINRT__) -/* WinRT always has access to the XAudio 2 SDK */ +/* WinRT always has access to the XAudio 2 SDK (albeit with a header file + that doesn't compile as C code). +*/ # define SDL_XAUDIO2_HAS_SDK +#include "SDL_xaudio2.h" /* ... compiles as C code, in contrast to XAudio2 headers + in the Windows SDK, v.10.0.10240.0 (Win 10's initial SDK) + */ #else -/* XAudio2 exists as of the March 2008 DirectX SDK - The XAudio2 implementation available in the Windows 8 SDK targets Windows 8 and newer. - If you want to build SDL with XAudio2 support you should install the DirectX SDK. +/* XAudio2 exists in the last DirectX SDK as well as the latest Windows SDK. + To enable XAudio2 support, you will need to add the location of your DirectX SDK headers to + the SDL projects additional include directories and then set SDL_XAUDIO2_HAS_SDK=1 as a + preprocessor define */ -/* Disable compiling in the XAudio2 support pending fixes to dynamically load the XAudio2 - entry points so we can be robust to user configuration. Also needs to be fixed to build - with the Windows 10 SDK. -*/ #if 0 /* See comment above */ #include #if (!defined(_DXSDK_BUILD_MAJOR) || (_DXSDK_BUILD_MAJOR < 1284)) @@ -88,17 +90,10 @@ #endif #endif -/* The XAudio header file, when #include'd on WinRT, will only compile in C++ - files, but not C. A few preprocessor-based hacks are defined below in order - to get xaudio2.h to compile in the C/non-C++ file, SDL_xaudio2.c. - */ -#ifdef __WINRT__ -#define uuid(x) -#define DX_BUILD -#endif - +#if !defined(_SDL_XAUDIO2_H) #define INITGUID 1 #include +#endif /* Hidden "this" pointer for the audio functions */ #define _THIS SDL_AudioDevice *this diff --git a/src/audio/xaudio2/SDL_xaudio2.h b/src/audio/xaudio2/SDL_xaudio2.h new file mode 100644 index 000000000..864eba451 --- /dev/null +++ b/src/audio/xaudio2/SDL_xaudio2.h @@ -0,0 +1,386 @@ +/* + 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_XAUDIO2_H +#define _SDL_XAUDIO2_H + +#include +#include +#include + +/* XAudio2 packs its structure members together as tightly as possible. + This pragma is needed to ensure compatibility with XAudio2 on 64-bit + platforms. +*/ +#pragma pack(push, 1) + +typedef interface IXAudio2 IXAudio2; +typedef interface IXAudio2SourceVoice IXAudio2SourceVoice; +typedef interface IXAudio2MasteringVoice IXAudio2MasteringVoice; +typedef interface IXAudio2EngineCallback IXAudio2EngineCallback; +typedef interface IXAudio2VoiceCallback IXAudio2VoiceCallback; +typedef interface IXAudio2Voice IXAudio2Voice; +typedef interface IXAudio2SubmixVoice IXAudio2SubmixVoice; + +typedef enum _AUDIO_STREAM_CATEGORY { + AudioCategory_Other = 0, + AudioCategory_ForegroundOnlyMedia, + AudioCategory_BackgroundCapableMedia, + AudioCategory_Communications, + AudioCategory_Alerts, + AudioCategory_SoundEffects, + AudioCategory_GameEffects, + AudioCategory_GameMedia, + AudioCategory_GameChat, + AudioCategory_Movie, + AudioCategory_Media +} AUDIO_STREAM_CATEGORY; + +typedef struct XAUDIO2_BUFFER { + UINT32 Flags; + UINT32 AudioBytes; + const BYTE *pAudioData; + UINT32 PlayBegin; + UINT32 PlayLength; + UINT32 LoopBegin; + UINT32 LoopLength; + UINT32 LoopCount; + void *pContext; +} XAUDIO2_BUFFER; + +typedef struct XAUDIO2_BUFFER_WMA { + const UINT32 *pDecodedPacketCumulativeBytes; + UINT32 PacketCount; +} XAUDIO2_BUFFER_WMA; + +typedef struct XAUDIO2_SEND_DESCRIPTOR { + UINT32 Flags; + IXAudio2Voice *pOutputVoice; +} XAUDIO2_SEND_DESCRIPTOR; + +typedef struct XAUDIO2_VOICE_SENDS { + UINT32 SendCount; + XAUDIO2_SEND_DESCRIPTOR *pSends; +} XAUDIO2_VOICE_SENDS; + +typedef struct XAUDIO2_EFFECT_DESCRIPTOR { + IUnknown *pEffect; + BOOL InitialState; + UINT32 OutputChannels; +} XAUDIO2_EFFECT_DESCRIPTOR; + +typedef struct XAUDIO2_EFFECT_CHAIN { + UINT32 EffectCount; + XAUDIO2_EFFECT_DESCRIPTOR *pEffectDescriptors; +} XAUDIO2_EFFECT_CHAIN; + +typedef struct XAUDIO2_PERFORMANCE_DATA { + UINT64 AudioCyclesSinceLastQuery; + UINT64 TotalCyclesSinceLastQuery; + UINT32 MinimumCyclesPerQuantum; + UINT32 MaximumCyclesPerQuantum; + UINT32 MemoryUsageInBytes; + UINT32 CurrentLatencyInSamples; + UINT32 GlitchesSinceEngineStarted; + UINT32 ActiveSourceVoiceCount; + UINT32 TotalSourceVoiceCount; + UINT32 ActiveSubmixVoiceCount; + UINT32 ActiveResamplerCount; + UINT32 ActiveMatrixMixCount; + UINT32 ActiveXmaSourceVoices; + UINT32 ActiveXmaStreams; +} XAUDIO2_PERFORMANCE_DATA; + +typedef struct XAUDIO2_DEBUG_CONFIGURATION { + UINT32 TraceMask; + UINT32 BreakMask; + BOOL LogThreadID; + BOOL LogFileline; + BOOL LogFunctionName; + BOOL LogTiming; +} XAUDIO2_DEBUG_CONFIGURATION; + +typedef struct XAUDIO2_VOICE_DETAILS { + UINT32 CreationFlags; + UINT32 ActiveFlags; + UINT32 InputChannels; + UINT32 InputSampleRate; +} XAUDIO2_VOICE_DETAILS; + +typedef enum XAUDIO2_FILTER_TYPE { + LowPassFilter = 0, + BandPassFilter = 1, + HighPassFilter = 2, + NotchFilter = 3, + LowPassOnePoleFilter = 4, + HighPassOnePoleFilter = 5 +} XAUDIO2_FILTER_TYPE; + +typedef struct XAUDIO2_FILTER_PARAMETERS { + XAUDIO2_FILTER_TYPE Type; + float Frequency; + float OneOverQ; +} XAUDIO2_FILTER_PARAMETERS; + +typedef struct XAUDIO2_VOICE_STATE { + void *pCurrentBufferContext; + UINT32 BuffersQueued; + UINT64 SamplesPlayed; +} XAUDIO2_VOICE_STATE; + + +typedef UINT32 XAUDIO2_PROCESSOR; +#define Processor1 0x00000001 +#define XAUDIO2_DEFAULT_PROCESSOR Processor1 + +#define XAUDIO2_E_DEVICE_INVALIDATED 0x88960004 +#define XAUDIO2_COMMIT_NOW 0 +#define XAUDIO2_VOICE_NOSAMPLESPLAYED 0x0100 +#define XAUDIO2_DEFAULT_CHANNELS 0 + +extern HRESULT __stdcall XAudio2Create( + _Out_ IXAudio2 **ppXAudio2, + _In_ UINT32 Flags, + _In_ XAUDIO2_PROCESSOR XAudio2Processor + ); + +#undef INTERFACE +#define INTERFACE IXAudio2 +typedef interface IXAudio2 { + const struct IXAudio2Vtbl FAR* lpVtbl; +} IXAudio2; +typedef const struct IXAudio2Vtbl IXAudio2Vtbl; +const struct IXAudio2Vtbl +{ + /* IUnknown */ + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + /* IXAudio2 */ + STDMETHOD_(HRESULT, RegisterForCallbacks)(THIS, IXAudio2EngineCallback *pCallback) PURE; + STDMETHOD_(VOID, UnregisterForCallbacks)(THIS, IXAudio2EngineCallback *pCallback) PURE; + STDMETHOD_(HRESULT, CreateSourceVoice)(THIS, IXAudio2SourceVoice **ppSourceVoice, + const WAVEFORMATEX *pSourceFormat, + UINT32 Flags, + float MaxFrequencyRatio, + IXAudio2VoiceCallback *pCallback, + const XAUDIO2_VOICE_SENDS *pSendList, + const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE; + STDMETHOD_(HRESULT, CreateSubmixVoice)(THIS, IXAudio2SubmixVoice **ppSubmixVoice, + UINT32 InputChannels, + UINT32 InputSampleRate, + UINT32 Flags, + UINT32 ProcessingStage, + const XAUDIO2_VOICE_SENDS *pSendList, + const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE; + STDMETHOD_(HRESULT, CreateMasteringVoice)(THIS, IXAudio2MasteringVoice **ppMasteringVoice, + UINT32 InputChannels, + UINT32 InputSampleRate, + UINT32 Flags, + LPCWSTR szDeviceId, + const XAUDIO2_EFFECT_CHAIN *pEffectChain, + AUDIO_STREAM_CATEGORY StreamCategory) PURE; + STDMETHOD_(HRESULT, StartEngine)(THIS) PURE; + STDMETHOD_(VOID, StopEngine)(THIS) PURE; + STDMETHOD_(HRESULT, CommitChanges)(THIS, UINT32 OperationSet) PURE; + STDMETHOD_(HRESULT, GetPerformanceData)(THIS, XAUDIO2_PERFORMANCE_DATA *pPerfData) PURE; + STDMETHOD_(HRESULT, SetDebugConfiguration)(THIS, XAUDIO2_DEBUG_CONFIGURATION *pDebugConfiguration, + VOID *pReserved) PURE; +}; + +#define IXAudio2_Release(A) ((A)->lpVtbl->Release(A)) +#define IXAudio2_CreateSourceVoice(A,B,C,D,E,F,G,H) ((A)->lpVtbl->CreateSourceVoice(A,B,C,D,E,F,G,H)) +#define IXAudio2_CreateMasteringVoice(A,B,C,D,E,F,G,H) ((A)->lpVtbl->CreateMasteringVoice(A,B,C,D,E,F,G,H)) +#define IXAudio2_StartEngine(A) ((A)->lpVtbl->StartEngine(A)) +#define IXAudio2_StopEngine(A) ((A)->lpVtbl->StopEngine(A)) + + +#undef INTERFACE +#define INTERFACE IXAudio2SourceVoice +typedef interface IXAudio2SourceVoice { + const struct IXAudio2SourceVoiceVtbl FAR* lpVtbl; +} IXAudio2SourceVoice; +typedef const struct IXAudio2SourceVoiceVtbl IXAudio2SourceVoiceVtbl; +const struct IXAudio2SourceVoiceVtbl +{ + /* MSDN says that IXAudio2Voice inherits from IXAudio2, but MSVC's debugger + * says otherwise, and that IXAudio2Voice doesn't inherit from any other + * interface! + */ + + /* IXAudio2Voice */ + STDMETHOD_(VOID, GetVoiceDetails)(THIS, XAUDIO2_VOICE_DETAILS *pVoiceDetails) PURE; + STDMETHOD_(HRESULT, SetOutputVoices)(THIS, const XAUDIO2_VOICE_SENDS *pSendList) PURE; + STDMETHOD_(HRESULT, SetEffectChain)(THIS, const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE; + STDMETHOD_(HRESULT, EnableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE; + STDMETHOD_(HRESULT, DisableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE; + STDMETHOD_(VOID, GetEffectState)(THIS, UINT32 EffectIndex, BOOL *pEnabled) PURE; + STDMETHOD_(HRESULT, SetEffectParameters)(THIS, UINT32 EffectIndex, + const void *pParameters, + UINT32 ParametersByteSize, + UINT32 OperationSet) PURE; + STDMETHOD_(VOID, GetEffectParameters)(THIS, UINT32 EffectIndex, + void *pParameters, + UINT32 ParametersByteSize) PURE; + STDMETHOD_(HRESULT, SetFilterParameters)(THIS, const XAUDIO2_FILTER_PARAMETERS *pParameters, + UINT32 OperationSet) PURE; + STDMETHOD_(VOID, GetFilterParameters)(THIS, XAUDIO2_FILTER_PARAMETERS *pParameters) PURE; + STDMETHOD_(HRESULT, SetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice, + XAUDIO2_FILTER_PARAMETERS *pParameters, + UINT32 OperationSet) PURE; + STDMETHOD_(VOID, GetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice, + XAUDIO2_FILTER_PARAMETERS *pParameters) PURE; + STDMETHOD_(HRESULT, SetVolume)(THIS, float Volume, + UINT32 OperationSet) PURE; + STDMETHOD_(VOID, GetVolume)(THIS, float *pVolume) PURE; + STDMETHOD_(HRESULT, SetChannelVolumes)(THIS, UINT32 Channels, + const float *pVolumes, + UINT32 OperationSet) PURE; + STDMETHOD_(VOID, GetChannelVolumes)(THIS, UINT32 Channels, + float *pVolumes) PURE; + STDMETHOD_(HRESULT, SetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice, + UINT32 SourceChannels, + UINT32 DestinationChannels, + const float *pLevelMatrix, + UINT32 OperationSet) PURE; + STDMETHOD_(VOID, GetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice, + UINT32 SourceChannels, + UINT32 DestinationChannels, + float *pLevelMatrix) PURE; + STDMETHOD_(VOID, DestroyVoice)(THIS) PURE; + + /* IXAudio2SourceVoice */ + STDMETHOD_(HRESULT, Start)(THIS, UINT32 Flags, + UINT32 OperationSet) PURE; + STDMETHOD_(HRESULT, Stop)(THIS, UINT32 Flags, + UINT32 OperationSet) PURE; + STDMETHOD_(HRESULT, SubmitSourceBuffer)(THIS, const XAUDIO2_BUFFER *pBuffer, + const XAUDIO2_BUFFER_WMA *pBufferWMA) PURE; + STDMETHOD_(HRESULT, FlushSourceBuffers)(THIS) PURE; + STDMETHOD_(HRESULT, Discontinuity)(THIS) PURE; + STDMETHOD_(HRESULT, ExitLoop)(THIS, UINT32 OperationSet) PURE; + STDMETHOD_(VOID, GetState)(THIS, XAUDIO2_VOICE_STATE *pVoiceState, + UINT32 Flags) PURE; + STDMETHOD_(HRESULT, SetFrequencyRatio)(THIS, float Ratio, + UINT32 OperationSet) PURE; + STDMETHOD_(VOID, GetFrequencyRatio)(THIS, float *pRatio) PURE; + STDMETHOD_(HRESULT, SetSourceSampleRate)(THIS, UINT32 NewSourceSampleRate) PURE; +}; + +#define IXAudio2SourceVoice_DestroyVoice(A) ((A)->lpVtbl->DestroyVoice(A)) +#define IXAudio2SourceVoice_Start(A,B,C) ((A)->lpVtbl->Start(A,B,C)) +#define IXAudio2SourceVoice_Stop(A,B,C) ((A)->lpVtbl->Stop(A,B,C)) +#define IXAudio2SourceVoice_SubmitSourceBuffer(A,B,C) ((A)->lpVtbl->SubmitSourceBuffer(A,B,C)) +#define IXAudio2SourceVoice_FlushSourceBuffers(A) ((A)->lpVtbl->FlushSourceBuffers(A)) +#define IXAudio2SourceVoice_Discontinuity(A) ((A)->lpVtbl->Discontinuity(A)) +#define IXAudio2SourceVoice_GetState(A,B,C) ((A)->lpVtbl->GetState(A,B,C)) + + +#undef INTERFACE +#define INTERFACE IXAudio2MasteringVoice +typedef interface IXAudio2MasteringVoice { + const struct IXAudio2MasteringVoiceVtbl FAR* lpVtbl; +} IXAudio2MasteringVoice; +typedef const struct IXAudio2MasteringVoiceVtbl IXAudio2MasteringVoiceVtbl; +const struct IXAudio2MasteringVoiceVtbl +{ + /* MSDN says that IXAudio2Voice inherits from IXAudio2, but MSVC's debugger + * says otherwise, and that IXAudio2Voice doesn't inherit from any other + * interface! + */ + + /* IXAudio2Voice */ + STDMETHOD_(VOID, GetVoiceDetails)(THIS, XAUDIO2_VOICE_DETAILS *pVoiceDetails) PURE; + STDMETHOD_(HRESULT, SetOutputVoices)(THIS, const XAUDIO2_VOICE_SENDS *pSendList) PURE; + STDMETHOD_(HRESULT, SetEffectChain)(THIS, const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE; + STDMETHOD_(HRESULT, EnableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE; + STDMETHOD_(HRESULT, DisableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE; + STDMETHOD_(VOID, GetEffectState)(THIS, UINT32 EffectIndex, BOOL *pEnabled) PURE; + STDMETHOD_(HRESULT, SetEffectParameters)(THIS, UINT32 EffectIndex, + const void *pParameters, + UINT32 ParametersByteSize, + UINT32 OperationSet) PURE; + STDMETHOD_(VOID, GetEffectParameters)(THIS, UINT32 EffectIndex, + void *pParameters, + UINT32 ParametersByteSize) PURE; + STDMETHOD_(HRESULT, SetFilterParameters)(THIS, const XAUDIO2_FILTER_PARAMETERS *pParameters, + UINT32 OperationSet) PURE; + STDMETHOD_(VOID, GetFilterParameters)(THIS, XAUDIO2_FILTER_PARAMETERS *pParameters) PURE; + STDMETHOD_(HRESULT, SetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice, + XAUDIO2_FILTER_PARAMETERS *pParameters, + UINT32 OperationSet) PURE; + STDMETHOD_(VOID, GetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice, + XAUDIO2_FILTER_PARAMETERS *pParameters) PURE; + STDMETHOD_(HRESULT, SetVolume)(THIS, float Volume, + UINT32 OperationSet) PURE; + STDMETHOD_(VOID, GetVolume)(THIS, float *pVolume) PURE; + STDMETHOD_(HRESULT, SetChannelVolumes)(THIS, UINT32 Channels, + const float *pVolumes, + UINT32 OperationSet) PURE; + STDMETHOD_(VOID, GetChannelVolumes)(THIS, UINT32 Channels, + float *pVolumes) PURE; + STDMETHOD_(HRESULT, SetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice, + UINT32 SourceChannels, + UINT32 DestinationChannels, + const float *pLevelMatrix, + UINT32 OperationSet) PURE; + STDMETHOD_(VOID, GetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice, + UINT32 SourceChannels, + UINT32 DestinationChannels, + float *pLevelMatrix) PURE; + STDMETHOD_(VOID, DestroyVoice)(THIS) PURE; + + /* IXAudio2SourceVoice */ + STDMETHOD_(VOID, GetChannelMask)(THIS, DWORD *pChannelMask) PURE; +}; + +#define IXAudio2MasteringVoice_DestroyVoice(A) ((A)->lpVtbl->DestroyVoice(A)) + + +#undef INTERFACE +#define INTERFACE IXAudio2VoiceCallback +typedef interface IXAudio2VoiceCallback { + const struct IXAudio2VoiceCallbackVtbl FAR* lpVtbl; +} IXAudio2VoiceCallback; +typedef const struct IXAudio2VoiceCallbackVtbl IXAudio2VoiceCallbackVtbl; +const struct IXAudio2VoiceCallbackVtbl +{ + /* MSDN says that IXAudio2VoiceCallback inherits from IXAudio2, but SDL's + * own code says otherwise, and that IXAudio2VoiceCallback doesn't inherit + * from any other interface! + */ + + /* IXAudio2VoiceCallback */ + STDMETHOD_(VOID, OnVoiceProcessingPassStart)(THIS, UINT32 BytesRequired) PURE; + STDMETHOD_(VOID, OnVoiceProcessingPassEnd)(THIS) PURE; + STDMETHOD_(VOID, OnStreamEnd)(THIS) PURE; + STDMETHOD_(VOID, OnBufferStart)(THIS, void *pBufferContext) PURE; + STDMETHOD_(VOID, OnBufferEnd)(THIS, void *pBufferContext) PURE; + STDMETHOD_(VOID, OnLoopEnd)(THIS, void *pBufferContext) PURE; + STDMETHOD_(VOID, OnVoiceError)(THIS, void *pBufferContext, HRESULT Error) PURE; +}; + +#pragma pack(pop) /* Undo pragma push */ + +#endif /* _SDL_XAUDIO2_H */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/xaudio2/SDL_xaudio2_winrthelpers.cpp b/src/audio/xaudio2/SDL_xaudio2_winrthelpers.cpp index e4fb8e84d..b2d67c7fb 100644 --- a/src/audio/xaudio2/SDL_xaudio2_winrthelpers.cpp +++ b/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/src/audio/xaudio2/SDL_xaudio2_winrthelpers.h b/src/audio/xaudio2/SDL_xaudio2_winrthelpers.h index 6f14f17ae..aa6486f91 100644 --- a/src/audio/xaudio2/SDL_xaudio2_winrthelpers.h +++ b/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/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index be948d225..f6e0a833c 100644 --- a/src/core/android/SDL_android.c +++ b/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 diff --git a/src/core/android/SDL_android.h b/src/core/android/SDL_android.h index 758e3023c..8e2ab93c3 100644 --- a/src/core/android/SDL_android.h +++ b/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/src/core/linux/SDL_dbus.c b/src/core/linux/SDL_dbus.c index cc7b3d374..5d0df050c 100644 --- a/src/core/linux/SDL_dbus.c +++ b/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/src/core/linux/SDL_dbus.h b/src/core/linux/SDL_dbus.h index dcfec77ef..c064381a0 100644 --- a/src/core/linux/SDL_dbus.h +++ b/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/src/core/linux/SDL_evdev.c b/src/core/linux/SDL_evdev.c index b9246745d..a8f2b138e 100644 --- a/src/core/linux/SDL_evdev.c +++ b/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/src/core/linux/SDL_evdev.h b/src/core/linux/SDL_evdev.h index 670a5cb26..989ced858 100644 --- a/src/core/linux/SDL_evdev.h +++ b/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/src/core/linux/SDL_ibus.c b/src/core/linux/SDL_ibus.c index 46d602af8..c9804c90a 100644 --- a/src/core/linux/SDL_ibus.c +++ b/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/src/core/linux/SDL_ibus.h b/src/core/linux/SDL_ibus.h index 247652231..5ee7a8e40 100644 --- a/src/core/linux/SDL_ibus.h +++ b/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/src/core/linux/SDL_udev.c b/src/core/linux/SDL_udev.c index cf66331e7..099cc435e 100644 --- a/src/core/linux/SDL_udev.c +++ b/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/src/core/linux/SDL_udev.h b/src/core/linux/SDL_udev.h index 9242870c4..2e4434e62 100644 --- a/src/core/linux/SDL_udev.h +++ b/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/src/core/windows/SDL_directx.h b/src/core/windows/SDL_directx.h index 106926438..0533f61ed 100644 --- a/src/core/windows/SDL_directx.h +++ b/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/src/core/windows/SDL_windows.c b/src/core/windows/SDL_windows.c index aff6e6d28..bc4afe0aa 100644 --- a/src/core/windows/SDL_windows.c +++ b/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/src/core/windows/SDL_windows.h b/src/core/windows/SDL_windows.h index 863971b61..0c99b03d4 100644 --- a/src/core/windows/SDL_windows.h +++ b/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/src/core/windows/SDL_xinput.c b/src/core/windows/SDL_xinput.c index 1e13faea6..355cd8343 100644 --- a/src/core/windows/SDL_xinput.c +++ b/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/src/core/windows/SDL_xinput.h b/src/core/windows/SDL_xinput.h index 664edd0c5..67f8fdc1f 100644 --- a/src/core/windows/SDL_xinput.h +++ b/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 @@ -118,11 +118,11 @@ typedef struct XINPUT_GAMEPAD_EX Gamepad; } XINPUT_STATE_EX; -typedef struct _XINPUT_BATTERY_INFORMATION +typedef struct { BYTE BatteryType; BYTE BatteryLevel; -} XINPUT_BATTERY_INFORMATION, *PXINPUT_BATTERY_INFORMATION; +} XINPUT_BATTERY_INFORMATION_EX; /* Forward decl's for XInput API's we load dynamically and use if available */ typedef DWORD (WINAPI *XInputGetState_t) @@ -146,9 +146,9 @@ typedef DWORD (WINAPI *XInputGetCapabilities_t) typedef DWORD (WINAPI *XInputGetBatteryInformation_t) ( - _In_ DWORD dwUserIndex, - _In_ BYTE devType, - _Out_ XINPUT_BATTERY_INFORMATION *pBatteryInformation + DWORD dwUserIndex, + BYTE devType, + XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation ); extern int WIN_LoadXInputDLL(void); diff --git a/src/core/winrt/SDL_winrtapp_common.cpp b/src/core/winrt/SDL_winrtapp_common.cpp index c8ac48133..265aa942e 100644 --- a/src/core/winrt/SDL_winrtapp_common.cpp +++ b/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/src/core/winrt/SDL_winrtapp_common.h b/src/core/winrt/SDL_winrtapp_common.h index e905139c0..e87a0b6b6 100644 --- a/src/core/winrt/SDL_winrtapp_common.h +++ b/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/src/core/winrt/SDL_winrtapp_direct3d.cpp b/src/core/winrt/SDL_winrtapp_direct3d.cpp index 267ce4eda..5ab2ef9a2 100644 --- a/src/core/winrt/SDL_winrtapp_direct3d.cpp +++ b/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 @@ -184,97 +184,55 @@ static void WINRT_SetDisplayOrientationsPreference(void *userdata, const char *n } static void -WINRT_ProcessWindowSizeChange() -{ - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - - // Make the new window size be the one true fullscreen mode. - // This change was initially done, in part, to allow the Direct3D 11.1 - // renderer to receive window-resize events as a device rotates. - // Before, rotating a device from landscape, to portrait, and then - // back to landscape would cause the Direct3D 11.1 swap buffer to - // not get resized appropriately. SDL would, on the rotation from - // landscape to portrait, re-resize the SDL window to it's initial - // size (landscape). On the subsequent rotation, SDL would drop the - // window-resize event as it appeared the SDL window didn't change - // size, and the Direct3D 11.1 renderer wouldn't resize its swap - // chain. - SDL_DisplayMode newDisplayMode; - if (WINRT_CalcDisplayModeUsingNativeWindow(&newDisplayMode) != 0) { - return; - } - - // Make note of the old display mode, and it's old driverdata. - SDL_DisplayMode oldDisplayMode; - SDL_zero(oldDisplayMode); - if (_this) { - oldDisplayMode = _this->displays[0].desktop_mode; - } +WINRT_ProcessWindowSizeChange() // TODO: Pass an SDL_Window-identifying thing into WINRT_ProcessWindowSizeChange() +{ + CoreWindow ^ coreWindow = CoreWindow::GetForCurrentThread(); + if (coreWindow) { + if (WINRT_GlobalSDLWindow) { + SDL_Window * window = WINRT_GlobalSDLWindow; + SDL_WindowData * data = (SDL_WindowData *) window->driverdata; + + int x = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Left); + int y = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Top); + int w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width); + int h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height); + +#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (NTDDI_VERSION == NTDDI_WIN8) + /* WinPhone 8.0 always keeps its native window size in portrait, + regardless of orientation. This changes in WinPhone 8.1, + in which the native window's size changes along with + orientation. + + Attempt to emulate WinPhone 8.1's behavior on WinPhone 8.0, with + regards to window size. This fixes a rendering bug that occurs + when a WinPhone 8.0 app is rotated to either 90 or 270 degrees. + */ + const DisplayOrientations currentOrientation = WINRT_DISPLAY_PROPERTY(CurrentOrientation); + switch (currentOrientation) { + case DisplayOrientations::Landscape: + case DisplayOrientations::LandscapeFlipped: { + int tmp = w; + w = h; + h = tmp; + } break; + } +#endif - // Setup the new display mode in the appropriate spots. - if (_this) { - // Make a full copy of the display mode for display_modes[0], - // one with with a separately malloced 'driverdata' field. - // SDL_VideoQuit(), if called, will attempt to free the driverdata - // fields in 'desktop_mode' and each entry in the 'display_modes' - // array. - if (_this->displays[0].display_modes[0].driverdata) { - // Free the previous mode's memory - SDL_free(_this->displays[0].display_modes[0].driverdata); - _this->displays[0].display_modes[0].driverdata = NULL; - } - if (WINRT_DuplicateDisplayMode(&(_this->displays[0].display_modes[0]), &newDisplayMode) != 0) { - // Uh oh, something went wrong. A malloc call probably failed. - SDL_free(newDisplayMode.driverdata); - return; - } + const Uint32 latestFlags = WINRT_DetectWindowFlags(window); + if (latestFlags & SDL_WINDOW_MAXIMIZED) { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0); + } else { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0); + } - // Install 'newDisplayMode' into 'current_mode' and 'desktop_mode'. - _this->displays[0].current_mode = newDisplayMode; - _this->displays[0].desktop_mode = newDisplayMode; - } + WINRT_UpdateWindowFlags(window, SDL_WINDOW_FULLSCREEN_DESKTOP); - if (WINRT_GlobalSDLWindow) { - // If the window size changed, send a resize event to SDL and its host app: - int window_w = 0; - int window_h = 0; - SDL_GetWindowSize(WINRT_GlobalSDLWindow, &window_w, &window_h); - if ((window_w != newDisplayMode.w) || (window_h != newDisplayMode.h)) { - SDL_SendWindowEvent( - WINRT_GlobalSDLWindow, - SDL_WINDOWEVENT_RESIZED, - newDisplayMode.w, - newDisplayMode.h); - } else { -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP - // HACK: Make sure that orientation changes - // lead to the Direct3D renderer's viewport getting updated: - // - // For some reason, this doesn't seem to need to be done on Windows 8.x, - // even when going from Landscape to LandscapeFlipped. It only seems to - // be needed on Windows Phone, at least when I tested on my devices. - // I'm not currently sure why this is, but it seems to work fine. -- David L. - // - // TODO, WinRT: do more extensive research into why orientation changes on Win 8.x don't need D3D changes, or if they might, in some cases - const DisplayOrientations oldOrientation = ((SDL_DisplayModeData *)oldDisplayMode.driverdata)->currentOrientation; - const DisplayOrientations newOrientation = ((SDL_DisplayModeData *)newDisplayMode.driverdata)->currentOrientation; - if (oldOrientation != newOrientation) - { - SDL_SendWindowEvent( - WINRT_GlobalSDLWindow, - SDL_WINDOWEVENT_SIZE_CHANGED, - newDisplayMode.w, - newDisplayMode.h); - } -#endif + /* The window can move during a resize event, such as when maximizing + or resizing from a corner */ + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y); + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, w, h); } } - - // Finally, free the 'driverdata' field of the old 'desktop_mode'. - if (oldDisplayMode.driverdata) { - SDL_free(oldDisplayMode.driverdata); - oldDisplayMode.driverdata = NULL; - } } SDL_WinRTApp::SDL_WinRTApp() : @@ -286,7 +244,7 @@ SDL_WinRTApp::SDL_WinRTApp() : void SDL_WinRTApp::Initialize(CoreApplicationView^ applicationView) { applicationView->Activated += - ref new TypedEventHandler(this, &SDL_WinRTApp::OnActivated); + ref new TypedEventHandler(this, &SDL_WinRTApp::OnAppActivated); CoreApplication::Suspending += ref new EventHandler(this, &SDL_WinRTApp::OnSuspending); @@ -305,35 +263,61 @@ void SDL_WinRTApp::OnOrientationChanged(Object^ sender) #endif { #if LOG_ORIENTATION_EVENTS==1 - CoreWindow^ window = CoreWindow::GetForCurrentThread(); - if (window) { - SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d, CoreWindow Size={%f,%f}\n", - __FUNCTION__, - WINRT_DISPLAY_PROPERTY(CurrentOrientation), - WINRT_DISPLAY_PROPERTY(NativeOrientation), - WINRT_DISPLAY_PROPERTY(AutoRotationPreferences), - window->Bounds.Width, - window->Bounds.Height); - } else { - SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d\n", - __FUNCTION__, - WINRT_DISPLAY_PROPERTY(CurrentOrientation), - WINRT_DISPLAY_PROPERTY(NativeOrientation), - WINRT_DISPLAY_PROPERTY(AutoRotationPreferences)); + { + CoreWindow^ window = CoreWindow::GetForCurrentThread(); + if (window) { + SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d, CoreWindow Bounds={%f,%f,%f,%f}\n", + __FUNCTION__, + WINRT_DISPLAY_PROPERTY(CurrentOrientation), + WINRT_DISPLAY_PROPERTY(NativeOrientation), + WINRT_DISPLAY_PROPERTY(AutoRotationPreferences), + window->Bounds.X, + window->Bounds.Y, + window->Bounds.Width, + window->Bounds.Height); + } else { + SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d\n", + __FUNCTION__, + WINRT_DISPLAY_PROPERTY(CurrentOrientation), + WINRT_DISPLAY_PROPERTY(NativeOrientation), + WINRT_DISPLAY_PROPERTY(AutoRotationPreferences)); + } } #endif WINRT_ProcessWindowSizeChange(); + +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP + // HACK: Make sure that orientation changes + // lead to the Direct3D renderer's viewport getting updated: + // + // For some reason, this doesn't seem to need to be done on Windows 8.x, + // even when going from Landscape to LandscapeFlipped. It only seems to + // be needed on Windows Phone, at least when I tested on my devices. + // I'm not currently sure why this is, but it seems to work fine. -- David L. + // + // TODO, WinRT: do more extensive research into why orientation changes on Win 8.x don't need D3D changes, or if they might, in some cases + SDL_Window * window = WINRT_GlobalSDLWindow; + if (window) { + SDL_WindowData * data = (SDL_WindowData *)window->driverdata; + int w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width); + int h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height); + SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_SIZE_CHANGED, w, h); + } +#endif + } void SDL_WinRTApp::SetWindow(CoreWindow^ window) { #if LOG_WINDOW_EVENTS==1 - SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d, window Size={%f,%f}\n", + SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d, window bounds={%f, %f, %f,%f}\n", __FUNCTION__, WINRT_DISPLAY_PROPERTY(CurrentOrientation), WINRT_DISPLAY_PROPERTY(NativeOrientation), WINRT_DISPLAY_PROPERTY(AutoRotationPreferences), + window->Bounds.X, + window->Bounds.Y, window->Bounds.Width, window->Bounds.Height); #endif @@ -344,6 +328,9 @@ void SDL_WinRTApp::SetWindow(CoreWindow^ window) window->VisibilityChanged += ref new TypedEventHandler(this, &SDL_WinRTApp::OnVisibilityChanged); + window->Activated += + ref new TypedEventHandler(this, &SDL_WinRTApp::OnWindowActivated); + window->Closed += ref new TypedEventHandler(this, &SDL_WinRTApp::OnWindowClosed); @@ -360,6 +347,12 @@ void SDL_WinRTApp::SetWindow(CoreWindow^ window) window->PointerReleased += ref new TypedEventHandler(this, &SDL_WinRTApp::OnPointerReleased); + window->PointerEntered += + ref new TypedEventHandler(this, &SDL_WinRTApp::OnPointerEntered); + + window->PointerExited += + ref new TypedEventHandler(this, &SDL_WinRTApp::OnPointerExited); + window->PointerWheelChanged += ref new TypedEventHandler(this, &SDL_WinRTApp::OnPointerWheelChanged); @@ -378,7 +371,10 @@ void SDL_WinRTApp::SetWindow(CoreWindow^ window) window->CharacterReceived += ref new TypedEventHandler(this, &SDL_WinRTApp::OnCharacterReceived); -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if NTDDI_VERSION >= NTDDI_WIN10 + Windows::UI::Core::SystemNavigationManager::GetForCurrentView()->BackRequested += + ref new EventHandler(this, &SDL_WinRTApp::OnBackButtonPressed); +#elif WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP HardwareButtons::BackPressed += ref new EventHandler(this, &SDL_WinRTApp::OnBackButtonPressed); #endif @@ -395,7 +391,7 @@ void SDL_WinRTApp::SetWindow(CoreWindow^ window) // TODO, WinRT: see if an app's default orientation can be found out via WinRT API(s), then set the initial value of SDL_HINT_ORIENTATIONS accordingly. SDL_AddHintCallback(SDL_HINT_ORIENTATIONS, WINRT_SetDisplayOrientationsPreference, NULL); -#if WINAPI_FAMILY == WINAPI_FAMILY_APP // for Windows 8/8.1/RT apps... (and not Phone apps) +#if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10) // for Windows 8/8.1/RT apps... (and not Phone apps) // Make sure we know when a user has opened the app's settings pane. // This is needed in order to display a privacy policy, which needs // to be done for network-enabled apps, as per Windows Store requirements. @@ -488,7 +484,7 @@ void SDL_WinRTApp::Uninitialize() { } -#if WINAPI_FAMILY == WINAPI_FAMILY_APP +#if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10) void SDL_WinRTApp::OnSettingsPaneCommandsRequested( Windows::UI::ApplicationSettings::SettingsPane ^p, Windows::UI::ApplicationSettings::SettingsPaneCommandsRequestedEventArgs ^args) @@ -530,14 +526,15 @@ void SDL_WinRTApp::OnSettingsPaneCommandsRequested( args->Request->ApplicationCommands->Append(cmd); } } -#endif // if WINAPI_FAMILY == WINAPI_FAMILY_APP +#endif // if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10) void SDL_WinRTApp::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args) { #if LOG_WINDOW_EVENTS==1 - SDL_Log("%s, size={%f,%f}, current orientation=%d, native orientation=%d, auto rot. pref=%d, WINRT_GlobalSDLWindow?=%s\n", + SDL_Log("%s, size={%f,%f}, bounds={%f,%f,%f,%f}, current orientation=%d, native orientation=%d, auto rot. pref=%d, WINRT_GlobalSDLWindow?=%s\n", __FUNCTION__, args->Size.Width, args->Size.Height, + sender->Bounds.X, sender->Bounds.Y, sender->Bounds.Width, sender->Bounds.Height, WINRT_DISPLAY_PROPERTY(CurrentOrientation), WINRT_DISPLAY_PROPERTY(NativeOrientation), WINRT_DISPLAY_PROPERTY(AutoRotationPreferences), @@ -550,20 +547,26 @@ void SDL_WinRTApp::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEven void SDL_WinRTApp::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args) { #if LOG_WINDOW_EVENTS==1 - SDL_Log("%s, visible?=%s, WINRT_GlobalSDLWindow?=%s\n", + SDL_Log("%s, visible?=%s, bounds={%f,%f,%f,%f}, WINRT_GlobalSDLWindow?=%s\n", __FUNCTION__, (args->Visible ? "yes" : "no"), + sender->Bounds.X, sender->Bounds.Y, + sender->Bounds.Width, sender->Bounds.Height, (WINRT_GlobalSDLWindow ? "yes" : "no")); #endif m_windowVisible = args->Visible; if (WINRT_GlobalSDLWindow) { SDL_bool wasSDLWindowSurfaceValid = WINRT_GlobalSDLWindow->surface_valid; - + Uint32 latestWindowFlags = WINRT_DetectWindowFlags(WINRT_GlobalSDLWindow); if (args->Visible) { SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_SHOWN, 0, 0); SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0); - SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_RESTORED, 0, 0); + if (latestWindowFlags & SDL_WINDOW_MAXIMIZED) { + SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_MAXIMIZED, 0, 0); + } else { + SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_RESTORED, 0, 0); + } } else { SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_HIDDEN, 0, 0); SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); @@ -580,6 +583,68 @@ void SDL_WinRTApp::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEven } } +void SDL_WinRTApp::OnWindowActivated(CoreWindow^ sender, WindowActivatedEventArgs^ args) +{ +#if LOG_WINDOW_EVENTS==1 + SDL_Log("%s, WINRT_GlobalSDLWindow?=%s\n\n", + __FUNCTION__, + (WINRT_GlobalSDLWindow ? "yes" : "no")); +#endif + + /* There's no property in Win 8.x to tell whether a window is active or + not. [De]activation events are, however, sent to the app. We'll just + record those, in case the CoreWindow gets wrapped by an SDL_Window at + some future time. + */ + sender->CustomProperties->Insert("SDLHelperWindowActivationState", args->WindowActivationState); + + SDL_Window * window = WINRT_GlobalSDLWindow; + if (window) { + if (args->WindowActivationState != CoreWindowActivationState::Deactivated) { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SHOWN, 0, 0); + if (SDL_GetKeyboardFocus() != window) { + SDL_SetKeyboardFocus(window); + } + + /* Send a mouse-motion event as appropriate. + This doesn't work when called from OnPointerEntered, at least + not in WinRT CoreWindow apps (as OnPointerEntered doesn't + appear to be called after window-reactivation, at least not + in Windows 10, Build 10586.3 (November 2015 update, non-beta). + + Don't do it on WinPhone 8.0 though, as CoreWindow's 'PointerPosition' + property isn't available. + */ +#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION >= NTDDI_WINBLUE) + Point cursorPos = WINRT_TransformCursorPosition(window, sender->PointerPosition, TransformToSDLWindowSize); + SDL_SendMouseMotion(window, 0, 0, (int)cursorPos.X, (int)cursorPos.Y); +#endif + + /* TODO, WinRT: see if the Win32 bugfix from https://hg.libsdl.org/SDL/rev/d278747da408 needs to be applied (on window activation) */ + //WIN_CheckAsyncMouseRelease(data); + + /* TODO, WinRT: implement clipboard support, if possible */ + ///* + // * FIXME: Update keyboard state + // */ + //WIN_CheckClipboardUpdate(data->videodata); + + // HACK: Resetting the mouse-cursor here seems to fix + // https://bugzilla.libsdl.org/show_bug.cgi?id=3217, whereby a + // WinRT app's mouse cursor may switch to Windows' 'wait' cursor, + // after a user alt-tabs back into a full-screened SDL app. + // This bug does not appear to reproduce 100% of the time. + // It may be a bug in Windows itself (v.10.0.586.36, as tested, + // and the most-recent as of this writing). + SDL_SetCursor(NULL); + } else { + if (SDL_GetKeyboardFocus() == window) { + SDL_SetKeyboardFocus(NULL); + } + } + } +} + void SDL_WinRTApp::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args) { #if LOG_WINDOW_EVENTS==1 @@ -588,7 +653,7 @@ void SDL_WinRTApp::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args) m_windowClosed = true; } -void SDL_WinRTApp::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args) +void SDL_WinRTApp::OnAppActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args) { CoreWindow::GetForCurrentThread()->Activate(); } @@ -688,10 +753,28 @@ void SDL_WinRTApp::OnPointerReleased(CoreWindow^ sender, PointerEventArgs^ args) #if LOG_POINTER_EVENTS WINRT_LogPointerEvent("pointer released", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize)); #endif - + WINRT_ProcessPointerReleasedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint); } +void SDL_WinRTApp::OnPointerEntered(CoreWindow^ sender, PointerEventArgs^ args) +{ +#if LOG_POINTER_EVENTS + WINRT_LogPointerEvent("pointer entered", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize)); +#endif + + WINRT_ProcessPointerEnteredEvent(WINRT_GlobalSDLWindow, args->CurrentPoint); +} + +void SDL_WinRTApp::OnPointerExited(CoreWindow^ sender, PointerEventArgs^ args) +{ +#if LOG_POINTER_EVENTS + WINRT_LogPointerEvent("pointer exited", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize)); +#endif + + WINRT_ProcessPointerExitedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint); +} + void SDL_WinRTApp::OnPointerWheelChanged(CoreWindow^ sender, PointerEventArgs^ args) { #if LOG_POINTER_EVENTS @@ -721,8 +804,8 @@ void SDL_WinRTApp::OnCharacterReceived(Windows::UI::Core::CoreWindow^ sender, Wi WINRT_ProcessCharacterReceivedEvent(args); } -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP -void SDL_WinRTApp::OnBackButtonPressed(Platform::Object^ sender, Windows::Phone::UI::Input::BackPressedEventArgs^ args) +template +static void WINRT_OnBackButtonPressed(BackButtonEventArgs ^ args) { SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_AC_BACK); SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_AC_BACK); @@ -734,5 +817,18 @@ void SDL_WinRTApp::OnBackButtonPressed(Platform::Object^ sender, Windows::Phone: } } } + +#if NTDDI_VERSION == NTDDI_WIN10 +void SDL_WinRTApp::OnBackButtonPressed(Platform::Object^ sender, Windows::UI::Core::BackRequestedEventArgs^ args) + +{ + WINRT_OnBackButtonPressed(args); +} +#elif WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +void SDL_WinRTApp::OnBackButtonPressed(Platform::Object^ sender, Windows::Phone::UI::Input::BackPressedEventArgs^ args) + +{ + WINRT_OnBackButtonPressed(args); +} #endif diff --git a/src/core/winrt/SDL_winrtapp_direct3d.h b/src/core/winrt/SDL_winrtapp_direct3d.h index 6a8838ec8..0b69c2bb9 100644 --- a/src/core/winrt/SDL_winrtapp_direct3d.h +++ b/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 @@ -43,11 +43,11 @@ ref class SDL_WinRTApp sealed : public Windows::ApplicationModel::Core::IFramewo // Event Handlers. -#if WINAPI_FAMILY == WINAPI_FAMILY_APP // for Windows 8/8.1/RT apps... (and not Phone apps) +#if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10) // for Windows 8/8.1/RT apps... (and not Phone apps) void OnSettingsPaneCommandsRequested( Windows::UI::ApplicationSettings::SettingsPane ^p, Windows::UI::ApplicationSettings::SettingsPaneCommandsRequestedEventArgs ^args); -#endif // if WINAPI_FAMILY == WINAPI_FAMILY_APP +#endif // if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10) #if NTDDI_VERSION > NTDDI_WIN8 void OnOrientationChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args); @@ -56,22 +56,27 @@ ref class SDL_WinRTApp sealed : public Windows::ApplicationModel::Core::IFramewo #endif void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args); void OnLogicalDpiChanged(Platform::Object^ sender); - void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args); + void OnAppActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args); void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args); void OnResuming(Platform::Object^ sender, Platform::Object^ args); void OnExiting(Platform::Object^ sender, Platform::Object^ args); + void OnWindowActivated(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowActivatedEventArgs^ args); void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args); void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args); void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); void OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); void OnPointerWheelChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); void OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); + void OnPointerEntered(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); + void OnPointerExited(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); void OnMouseMoved(Windows::Devices::Input::MouseDevice^ mouseDevice, Windows::Devices::Input::MouseEventArgs^ args); void OnKeyDown(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args); void OnKeyUp(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args); void OnCharacterReceived(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CharacterReceivedEventArgs^ args); -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if NTDDI_VERSION >= NTDDI_WIN10 + void OnBackButtonPressed(Platform::Object^ sender, Windows::UI::Core::BackRequestedEventArgs^ args); +#elif WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP void OnBackButtonPressed(Platform::Object^ sender, Windows::Phone::UI::Input::BackPressedEventArgs^ args); #endif diff --git a/src/core/winrt/SDL_winrtapp_xaml.cpp b/src/core/winrt/SDL_winrtapp_xaml.cpp index 9f943309c..201e3b6c2 100644 --- a/src/core/winrt/SDL_winrtapp_xaml.cpp +++ b/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/src/core/winrt/SDL_winrtapp_xaml.h b/src/core/winrt/SDL_winrtapp_xaml.h index 7537710e3..a08b67c40 100644 --- a/src/core/winrt/SDL_winrtapp_xaml.h +++ b/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/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c index ed839cccb..c4c55be39 100644 --- a/src/cpuinfo/SDL_cpuinfo.c +++ b/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 @@ -735,7 +735,7 @@ SDL_GetSystemRAM(void) #endif #ifdef HAVE_SYSCTLBYNAME if (SDL_SystemRAM <= 0) { -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) #ifdef HW_REALMEM int mib[2] = {CTL_HW, HW_REALMEM}; #else diff --git a/src/dynapi/SDL_dynapi.c b/src/dynapi/SDL_dynapi.c index 02e5c787b..1411f8c93 100644 --- a/src/dynapi/SDL_dynapi.c +++ b/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 diff --git a/src/dynapi/SDL_dynapi.h b/src/dynapi/SDL_dynapi.h index fa9a0c7f9..5faac2194 100644 --- a/src/dynapi/SDL_dynapi.h +++ b/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 diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index 6daacd75f..c9ebfffe2 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/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 @@ -595,3 +595,5 @@ #define SDL_GetGrabbedWindow SDL_GetGrabbedWindow_REAL #define SDL_SetWindowsMessageHook SDL_SetWindowsMessageHook_REAL #define SDL_JoystickCurrentPowerLevel SDL_JoystickCurrentPowerLevel_REAL +#define SDL_GameControllerFromInstanceID SDL_GameControllerFromInstanceID_REAL +#define SDL_JoystickFromInstanceID SDL_JoystickFromInstanceID_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index f864a13dd..3f11a25f9 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/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 @@ -629,3 +629,5 @@ SDL_DYNAPI_PROC(void,SDL_SetWindowsMessageHook,(SDL_WindowsMessageHook a, void * #endif SDL_DYNAPI_PROC(int,SDL_GetDisplayDPI,(int a, float *b, float *c, float *d),(a,b,c,d),return) 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) diff --git a/src/dynapi/gendynapi.pl b/src/dynapi/gendynapi.pl index 192889fd8..5c3d79608 100755 --- a/src/dynapi/gendynapi.pl +++ b/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/src/events/SDL_clipboardevents.c b/src/events/SDL_clipboardevents.c index 5df8aa1c0..9b2209bdf 100644 --- a/src/events/SDL_clipboardevents.c +++ b/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/src/events/SDL_clipboardevents_c.h b/src/events/SDL_clipboardevents_c.h index 6c58ee431..98e6a38bd 100644 --- a/src/events/SDL_clipboardevents_c.h +++ b/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/src/events/SDL_dropevents.c b/src/events/SDL_dropevents.c index 0c8c7bea0..8f4405efa 100644 --- a/src/events/SDL_dropevents.c +++ b/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 diff --git a/src/events/SDL_dropevents_c.h b/src/events/SDL_dropevents_c.h index 3e8615e84..a60e089f3 100644 --- a/src/events/SDL_dropevents_c.h +++ b/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 diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c index 513cb55ed..ffd103824 100644 --- a/src/events/SDL_events.c +++ b/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 diff --git a/src/events/SDL_events_c.h b/src/events/SDL_events_c.h index 0ead5f304..2e3319047 100644 --- a/src/events/SDL_events_c.h +++ b/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/src/events/SDL_gesture.c b/src/events/SDL_gesture.c index b7980ede6..66def4429 100644 --- a/src/events/SDL_gesture.c +++ b/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/src/events/SDL_gesture_c.h b/src/events/SDL_gesture_c.h index f94dc715e..3ff542cbb 100644 --- a/src/events/SDL_gesture_c.h +++ b/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/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index d4dc0e7bc..15726545c 100644 --- a/src/events/SDL_keyboard.c +++ b/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 @@ -845,6 +845,19 @@ SDL_SetModState(SDL_Keymod modstate) keyboard->modstate = modstate; } +/* Note that SDL_ToggleModState() is not a public API. SDL_SetModState() is. */ +void +SDL_ToggleModState(const SDL_Keymod modstate, const SDL_bool toggle) +{ + SDL_Keyboard *keyboard = &SDL_keyboard; + if (toggle) { + keyboard->modstate |= modstate; + } else { + keyboard->modstate &= ~modstate; + } +} + + SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode scancode) { diff --git a/src/events/SDL_keyboard_c.h b/src/events/SDL_keyboard_c.h index 50fb06da7..b4d1c0739 100644 --- a/src/events/SDL_keyboard_c.h +++ b/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 @@ -62,6 +62,9 @@ extern void SDL_KeyboardQuit(void); /* Convert to UTF-8 */ extern char *SDL_UCS4ToUTF8(Uint32 ch, char *dst); +/* Toggle on or off pieces of the keyboard mod state. */ +extern void SDL_ToggleModState(const SDL_Keymod modstate, const SDL_bool toggle); + #endif /* _SDL_keyboard_c_h */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 716384a10..7793de870 100644 --- a/src/events/SDL_mouse.c +++ b/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/src/events/SDL_mouse_c.h b/src/events/SDL_mouse_c.h index b12bec351..03aca0a5c 100644 --- a/src/events/SDL_mouse_c.h +++ b/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/src/events/SDL_quit.c b/src/events/SDL_quit.c index d2b215bc4..5b7105ef8 100644 --- a/src/events/SDL_quit.c +++ b/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/src/events/SDL_sysevents.h b/src/events/SDL_sysevents.h index f1d460d8b..c4ce08764 100644 --- a/src/events/SDL_sysevents.h +++ b/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/src/events/SDL_touch.c b/src/events/SDL_touch.c index 1b477ea7d..c73827c96 100644 --- a/src/events/SDL_touch.c +++ b/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/src/events/SDL_touch_c.h b/src/events/SDL_touch_c.h index 3e4b8bbfa..d025df6e8 100644 --- a/src/events/SDL_touch_c.h +++ b/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/src/events/SDL_windowevents.c b/src/events/SDL_windowevents.c index 0e480f276..785ea4e0c 100644 --- a/src/events/SDL_windowevents.c +++ b/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 @@ -127,6 +127,7 @@ SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1, if (window->flags & SDL_WINDOW_MINIMIZED) { return 0; } + window->flags &= ~SDL_WINDOW_MAXIMIZED; window->flags |= SDL_WINDOW_MINIMIZED; SDL_OnWindowMinimized(window); break; @@ -134,6 +135,7 @@ SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1, if (window->flags & SDL_WINDOW_MAXIMIZED) { return 0; } + window->flags &= ~SDL_WINDOW_MINIMIZED; window->flags |= SDL_WINDOW_MAXIMIZED; break; case SDL_WINDOWEVENT_RESTORED: diff --git a/src/events/SDL_windowevents_c.h b/src/events/SDL_windowevents_c.h index 140b38c3f..2a6a4c051 100644 --- a/src/events/SDL_windowevents_c.h +++ b/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/src/events/blank_cursor.h b/src/events/blank_cursor.h index 175012936..5e15852cb 100644 --- a/src/events/blank_cursor.h +++ b/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/src/events/default_cursor.h b/src/events/default_cursor.h index e292cbf5a..297dd2dc1 100644 --- a/src/events/default_cursor.h +++ b/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/src/events/scancodes_darwin.h b/src/events/scancodes_darwin.h index 5677a894a..269225309 100644 --- a/src/events/scancodes_darwin.h +++ b/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/src/events/scancodes_linux.h b/src/events/scancodes_linux.h index 532a2a984..8db37df5b 100644 --- a/src/events/scancodes_linux.h +++ b/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/src/events/scancodes_windows.h b/src/events/scancodes_windows.h index f712d5a01..b23a261ea 100644 --- a/src/events/scancodes_windows.h +++ b/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/src/events/scancodes_xfree86.h b/src/events/scancodes_xfree86.h index e61555259..29d9ef944 100644 --- a/src/events/scancodes_xfree86.h +++ b/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/src/file/SDL_rwops.c b/src/file/SDL_rwops.c index b3b445d2d..38beb6285 100644 --- a/src/file/SDL_rwops.c +++ b/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/src/file/cocoa/SDL_rwopsbundlesupport.h b/src/file/cocoa/SDL_rwopsbundlesupport.h index 387428f39..2c63f1dab 100644 --- a/src/file/cocoa/SDL_rwopsbundlesupport.h +++ b/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/src/file/cocoa/SDL_rwopsbundlesupport.m b/src/file/cocoa/SDL_rwopsbundlesupport.m index 1d665edb2..3385d3aa5 100644 --- a/src/file/cocoa/SDL_rwopsbundlesupport.m +++ b/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/src/filesystem/android/SDL_sysfilesystem.c b/src/filesystem/android/SDL_sysfilesystem.c index 0401773e4..3bdf9966d 100644 --- a/src/filesystem/android/SDL_sysfilesystem.c +++ b/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/src/filesystem/cocoa/SDL_sysfilesystem.m b/src/filesystem/cocoa/SDL_sysfilesystem.m index 1e6a20678..6dee58052 100644 --- a/src/filesystem/cocoa/SDL_sysfilesystem.m +++ b/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/src/filesystem/dummy/SDL_sysfilesystem.c b/src/filesystem/dummy/SDL_sysfilesystem.c index 2cb9e21e1..45273f24a 100644 --- a/src/filesystem/dummy/SDL_sysfilesystem.c +++ b/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/src/filesystem/emscripten/SDL_sysfilesystem.c b/src/filesystem/emscripten/SDL_sysfilesystem.c index e9ded6754..ca49df1b9 100644 --- a/src/filesystem/emscripten/SDL_sysfilesystem.c +++ b/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/src/filesystem/haiku/SDL_sysfilesystem.cc b/src/filesystem/haiku/SDL_sysfilesystem.cc index 3a0ea3484..03489168e 100644 --- a/src/filesystem/haiku/SDL_sysfilesystem.cc +++ b/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/src/filesystem/nacl/SDL_sysfilesystem.c b/src/filesystem/nacl/SDL_sysfilesystem.c index 4efda46e5..ac8fef1e3 100644 --- a/src/filesystem/nacl/SDL_sysfilesystem.c +++ b/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/src/filesystem/unix/SDL_sysfilesystem.c b/src/filesystem/unix/SDL_sysfilesystem.c index b32649490..fa034a456 100644 --- a/src/filesystem/unix/SDL_sysfilesystem.c +++ b/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 diff --git a/src/filesystem/windows/SDL_sysfilesystem.c b/src/filesystem/windows/SDL_sysfilesystem.c index 2d1c78198..fd942d75f 100644 --- a/src/filesystem/windows/SDL_sysfilesystem.c +++ b/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/src/filesystem/winrt/SDL_sysfilesystem.cpp b/src/filesystem/winrt/SDL_sysfilesystem.cpp index a70c7fe44..b4caf9037 100644 --- a/src/filesystem/winrt/SDL_sysfilesystem.cpp +++ b/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/src/haptic/SDL_haptic.c b/src/haptic/SDL_haptic.c index 0d5c0ef54..ddce908d6 100644 --- a/src/haptic/SDL_haptic.c +++ b/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/src/haptic/SDL_haptic_c.h b/src/haptic/SDL_haptic_c.h index 24389c7e5..5b9372b5c 100644 --- a/src/haptic/SDL_haptic_c.h +++ b/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/src/haptic/SDL_syshaptic.h b/src/haptic/SDL_syshaptic.h index a364f8a8a..372cefacf 100644 --- a/src/haptic/SDL_syshaptic.h +++ b/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/src/haptic/darwin/SDL_syshaptic.c b/src/haptic/darwin/SDL_syshaptic.c index 152f779d0..d662012c3 100644 --- a/src/haptic/darwin/SDL_syshaptic.c +++ b/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/src/haptic/darwin/SDL_syshaptic_c.h b/src/haptic/darwin/SDL_syshaptic_c.h index 0af044871..2b72aab3d 100644 --- a/src/haptic/darwin/SDL_syshaptic_c.h +++ b/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/src/haptic/dummy/SDL_syshaptic.c b/src/haptic/dummy/SDL_syshaptic.c index ebff7daee..727e7ecac 100644 --- a/src/haptic/dummy/SDL_syshaptic.c +++ b/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/src/haptic/linux/SDL_syshaptic.c b/src/haptic/linux/SDL_syshaptic.c index 659252b54..e8d785535 100644 --- a/src/haptic/linux/SDL_syshaptic.c +++ b/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 diff --git a/src/haptic/windows/SDL_dinputhaptic.c b/src/haptic/windows/SDL_dinputhaptic.c index 1cd704259..c51470dd5 100644 --- a/src/haptic/windows/SDL_dinputhaptic.c +++ b/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/src/haptic/windows/SDL_dinputhaptic_c.h b/src/haptic/windows/SDL_dinputhaptic_c.h index d587ab72a..3dc0f1303 100644 --- a/src/haptic/windows/SDL_dinputhaptic_c.h +++ b/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/src/haptic/windows/SDL_windowshaptic.c b/src/haptic/windows/SDL_windowshaptic.c index a0b6c5541..0c038fb1b 100644 --- a/src/haptic/windows/SDL_windowshaptic.c +++ b/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 diff --git a/src/haptic/windows/SDL_windowshaptic_c.h b/src/haptic/windows/SDL_windowshaptic_c.h index e3de13365..89fdd2cb9 100644 --- a/src/haptic/windows/SDL_windowshaptic_c.h +++ b/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 diff --git a/src/haptic/windows/SDL_xinputhaptic.c b/src/haptic/windows/SDL_xinputhaptic.c index b5fb2e344..a46ae5f97 100644 --- a/src/haptic/windows/SDL_xinputhaptic.c +++ b/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 diff --git a/src/haptic/windows/SDL_xinputhaptic_c.h b/src/haptic/windows/SDL_xinputhaptic_c.h index 7917128d6..f9a0c85b2 100644 --- a/src/haptic/windows/SDL_xinputhaptic_c.h +++ b/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/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c index bfa8abeaf..0fd1ef4a7 100644 --- a/src/joystick/SDL_gamecontroller.c +++ b/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 @@ -254,36 +254,6 @@ ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickGUID *gu return NULL; } -/* - * Helper function to determine pre-calculated offset to certain joystick mappings - */ -ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index) -{ - SDL_JoystickGUID jGUID = SDL_JoystickGetDeviceGUID(device_index); - ControllerMapping_t *mapping; - - mapping = SDL_PrivateGetControllerMappingForGUID(&jGUID); -#if SDL_JOYSTICK_XINPUT - if (!mapping && SDL_SYS_IsXInputGamepad_DeviceIndex(device_index)) { - mapping = s_pXInputMapping; - } -#endif -#if defined(SDL_JOYSTICK_EMSCRIPTEN) - if (!mapping && s_pEmscriptenMapping) { - mapping = s_pEmscriptenMapping; - } -#endif - if (!mapping) { - const char *name = SDL_JoystickNameForIndex(device_index); - if (name) { - if (SDL_strstr(name, "Xbox") || SDL_strstr(name, "X-Box")) { - mapping = s_pXInputMapping; - } - } - } - return mapping; -} - static const char* map_StringForControllerAxis[] = { "leftx", "lefty", @@ -581,6 +551,9 @@ char *SDL_PrivateGetControllerMappingFromMappingString(const char *pMapping) return SDL_strdup(pSecondComma + 1); /* mapping is everything after the 3rd comma */ } +/* + * Helper function to refresh a mapping + */ void SDL_PrivateGameControllerRefreshMapping(ControllerMapping_t *pControllerMapping) { SDL_GameController *gamecontrollerlist = SDL_gamecontrollers; @@ -599,6 +572,102 @@ void SDL_PrivateGameControllerRefreshMapping(ControllerMapping_t *pControllerMap } } +/* + * Helper function to add a mapping for a guid + */ +static ControllerMapping_t * +SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString, SDL_bool *existing) +{ + char *pchName; + char *pchMapping; + ControllerMapping_t *pControllerMapping; + + pchName = SDL_PrivateGetControllerNameFromMappingString(mappingString); + if (!pchName) { + SDL_SetError("Couldn't parse name from %s", mappingString); + return NULL; + } + + pchMapping = SDL_PrivateGetControllerMappingFromMappingString(mappingString); + if (!pchMapping) { + SDL_free(pchName); + SDL_SetError("Couldn't parse %s", mappingString); + return NULL; + } + + pControllerMapping = SDL_PrivateGetControllerMappingForGUID(&jGUID); + if (pControllerMapping) { + /* Update existing mapping */ + SDL_free(pControllerMapping->name); + pControllerMapping->name = pchName; + SDL_free(pControllerMapping->mapping); + pControllerMapping->mapping = pchMapping; + /* refresh open controllers */ + SDL_PrivateGameControllerRefreshMapping(pControllerMapping); + *existing = SDL_TRUE; + } else { + pControllerMapping = SDL_malloc(sizeof(*pControllerMapping)); + if (!pControllerMapping) { + SDL_free(pchName); + SDL_free(pchMapping); + SDL_OutOfMemory(); + return NULL; + } + pControllerMapping->guid = jGUID; + pControllerMapping->name = pchName; + pControllerMapping->mapping = pchMapping; + pControllerMapping->next = s_pSupportedControllers; + s_pSupportedControllers = pControllerMapping; + *existing = SDL_FALSE; + } + return pControllerMapping; +} + +/* + * Helper function to determine pre-calculated offset to certain joystick mappings + */ +ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index) +{ + SDL_JoystickGUID jGUID = SDL_JoystickGetDeviceGUID(device_index); + ControllerMapping_t *mapping; + + mapping = SDL_PrivateGetControllerMappingForGUID(&jGUID); +#if SDL_JOYSTICK_XINPUT + if (!mapping && SDL_SYS_IsXInputGamepad_DeviceIndex(device_index)) { + mapping = s_pXInputMapping; + } +#endif +#if defined(SDL_JOYSTICK_EMSCRIPTEN) + if (!mapping && s_pEmscriptenMapping) { + mapping = s_pEmscriptenMapping; + } +#endif +#ifdef __LINUX__ + if (!mapping) { + const char *name = SDL_JoystickNameForIndex(device_index); + if (name) { + if (SDL_strstr(name, "Xbox 360 Wireless Receiver")) { + /* The Linux driver xpad.c maps the wireless dpad to buttons */ + SDL_bool existing; + mapping = SDL_PrivateAddMappingForGUID(jGUID, +"none,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,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,", + &existing); + } + } + } +#endif /* __LINUX__ */ + + if (!mapping) { + const char *name = SDL_JoystickNameForIndex(device_index); + if (name) { + if (SDL_strstr(name, "Xbox") || SDL_strstr(name, "X-Box")) { + mapping = s_pXInputMapping; + } + } + } + return mapping; +} + /* * Add or update an entry into the Mappings Database */ @@ -677,12 +746,11 @@ int SDL_GameControllerAddMapping(const char *mappingString) { char *pchGUID; - char *pchName; - char *pchMapping; SDL_JoystickGUID jGUID; - ControllerMapping_t *pControllerMapping; SDL_bool is_xinput_mapping = SDL_FALSE; SDL_bool is_emscripten_mapping = SDL_FALSE; + SDL_bool existing = SDL_FALSE; + ControllerMapping_t *pControllerMapping; if (!mappingString) { return SDL_InvalidParamError("mappingString"); @@ -701,46 +769,20 @@ SDL_GameControllerAddMapping(const char *mappingString) jGUID = SDL_JoystickGetGUIDFromString(pchGUID); SDL_free(pchGUID); - pchName = SDL_PrivateGetControllerNameFromMappingString(mappingString); - if (!pchName) { - return SDL_SetError("Couldn't parse name from %s", mappingString); - } - - pchMapping = SDL_PrivateGetControllerMappingFromMappingString(mappingString); - if (!pchMapping) { - SDL_free(pchName); - return SDL_SetError("Couldn't parse %s", mappingString); + pControllerMapping = SDL_PrivateAddMappingForGUID(jGUID, mappingString, &existing); + if (!pControllerMapping) { + return -1; } - pControllerMapping = SDL_PrivateGetControllerMappingForGUID(&jGUID); - - if (pControllerMapping) { - /* Update existing mapping */ - SDL_free(pControllerMapping->name); - pControllerMapping->name = pchName; - SDL_free(pControllerMapping->mapping); - pControllerMapping->mapping = pchMapping; - /* refresh open controllers */ - SDL_PrivateGameControllerRefreshMapping(pControllerMapping); + if (existing) { return 0; } else { - pControllerMapping = SDL_malloc(sizeof(*pControllerMapping)); - if (!pControllerMapping) { - SDL_free(pchName); - SDL_free(pchMapping); - return SDL_OutOfMemory(); - } if (is_xinput_mapping) { s_pXInputMapping = pControllerMapping; } if (is_emscripten_mapping) { s_pEmscriptenMapping = pControllerMapping; } - pControllerMapping->guid = jGUID; - pControllerMapping->name = pchName; - pControllerMapping->mapping = pchMapping; - pControllerMapping->next = s_pSupportedControllers; - s_pSupportedControllers = pControllerMapping; return 1; } } @@ -1046,6 +1088,25 @@ SDL_Joystick *SDL_GameControllerGetJoystick(SDL_GameController * gamecontroller) return gamecontroller->joystick; } + +/* + * Find the SDL_GameController that owns this instance id + */ +SDL_GameController * +SDL_GameControllerFromInstanceID(SDL_JoystickID joyid) +{ + SDL_GameController *gamecontroller = SDL_gamecontrollers; + while (gamecontroller) { + if (gamecontroller->joystick->instance_id == joyid) { + return gamecontroller; + } + gamecontroller = gamecontroller->next; + } + + return NULL; +} + + /** * Get the SDL joystick layer binding for this controller axis mapping */ diff --git a/src/joystick/SDL_gamecontrollerdb.h b/src/joystick/SDL_gamecontrollerdb.h index d9193b73a..211d00d01 100644 --- a/src/joystick/SDL_gamecontrollerdb.h +++ b/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 @@ -39,6 +39,7 @@ static const char *s_ControllerMappings [] = "e8206058000000000000504944564944,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,", "ffff0000000000000000504944564944,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,", "6d0416c2000000000000504944564944,Generic DirectInput Controller,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,", + "6d0418c2000000000000504944564944,Logitech F510 Gamepad,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,", "6d0419c2000000000000504944564944,Logitech F710 Gamepad,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. */ "4d6963726f736f66742050432d6a6f79,OUYA Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:b12,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b13,rightx:a5,righty:a4,x:b1,y:b2,", "88880803000000000000504944564944,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,", @@ -55,11 +56,14 @@ static const char *s_ControllerMappings [] = "6d0400000000000019c2000000000000,Logitech Wireless 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,", /* This includes F710 in DInput mode and the "Logitech Cordless RumblePad 2", at the very least. */ "4c050000000000006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", "4c05000000000000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "11010000000000002014000000000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b12,x:b2,y:b3,", + "11010000000000001714000000000000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b12,x:b2,y:b3,", "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__) "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,", "03000000ba2200002010000001010000,Jess Technology USB Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,", "030000006d04000019c2000010010000,Logitech Cordless RumblePad 2,a:b1,b:b2,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:b0,y:b3,", "030000006d0400001dc2000014400000,Logitech F310 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,", @@ -74,12 +78,11 @@ static const char *s_ControllerMappings [] = "03000000341a00003608000011010000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,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,", "030000004c050000c405000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "050000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000c6240000045d000025010000,Razer Sabertooth,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,", "03000000321500000009000011010000,Razer Serval,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:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", "050000003215000000090000163a0000,Razer Serval,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:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", "03000000de280000fc11000001000000,Steam 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,", "03000000de280000ff11000001000000,Valve Streaming Gamepad,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,", - "030000005e0400001907000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,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,", - "030000005e0400009102000007010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,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,", "xinput,XInput 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,", "030000005e040000d102000001010000,Xbox One Wireless 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,", #endif diff --git a/src/joystick/SDL_gamecontrollerdb.h.new b/src/joystick/SDL_gamecontrollerdb.h.new deleted file mode 100644 index 7f6c7b29f..000000000 --- a/src/joystick/SDL_gamecontrollerdb.h.new +++ /dev/null @@ -1,65 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2013 Sam Lantinga - - 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_config.h" - - -/* Default mappings we support - - The easiest way to generate a new mapping is to start Steam in Big Picture - mode, configure your joystick and then look in config/config.vdf in your - Steam installation directory for the "SDL_GamepadBind" entry. - */ -static const char *s_ControllerMappings [] = -{ -#ifdef SDL_JOYSTICK_DINPUT - "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,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,", - "ffff0000000000000000504944564944,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,", - "6d0416c2000000000000504944564944,Generic DirectInput Controller,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,", - "6d0419c2000000000000504944564944,Logitech F710 Gamepad,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. */ - "88880803000000000000504944564944,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,", - "4c056802000000000000504944564944,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", - "25090500000000000000504944564944,PS3 DualShock,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,", - "xinput,X360 Controller,a:b10,b:b11,back:b5,dpdown:b1,dpleft:b2,dpright:b3,dpup:b0,guide:b14,leftshoulder:b8,leftstick:b6,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b7,righttrigger:a5,rightx:a2,righty:a3,start:b4,x:b12,y:b13,", -#elif defined(__MACOSX__) - "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,", - "6d0400000000000016c2000000000000,Logitech F310 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. */ - "6d0400000000000018c2000000000000,Logitech F510 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,", - "6d040000000000001fc2000000000000,Logitech F710 Gamepad (XInput),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,", - "6d0400000000000019c2000000000000,Logitech Wireless 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,", /* This includes F710 in DInput mode and the "Logitech Cordless RumblePad 2", at the very least. */ - "4c050000000000006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", - "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,", -#elif defined(__LINUX__) - "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,", - "03000000ba2200002010000001010000,Jess Technology USB Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,", - "030000006d04000019c2000010010000,Logitech Cordless RumblePad 2,a:b1,b:b2,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:b0,y:b3,", - "030000006d0400001dc2000014400000,Logitech F310 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,", - "030000006d0400001ec2000020200000,Logitech F510 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,", - "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,", - "030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", - "030000005e0400008e02000014010000,X360 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,", - "030000005e0400008e02000010010000,X360 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,", - "030000005e0400001907000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,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,", -#endif - NULL -}; - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 532748cde..dc910a82b 100644 --- a/src/joystick/SDL_joystick.c +++ b/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 @@ -373,6 +373,23 @@ SDL_JoystickInstanceID(SDL_Joystick * joystick) return (joystick->instance_id); } +/* + * Find the SDL_Joystick that owns this instance id + */ +SDL_Joystick * +SDL_JoystickFromInstanceID(SDL_JoystickID joyid) +{ + SDL_Joystick *joystick = SDL_joysticks; + while (joystick) { + if (joystick->instance_id == joyid) { + return joystick; + } + joystick = joystick->next; + } + + return NULL; +} + /* * Get the friendly name of this joystick */ diff --git a/src/joystick/SDL_joystick_c.h b/src/joystick/SDL_joystick_c.h index 2da74bd3c..4a076f6d6 100644 --- a/src/joystick/SDL_joystick_c.h +++ b/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/src/joystick/SDL_sysjoystick.h b/src/joystick/SDL_sysjoystick.h index f03e40429..1015840af 100644 --- a/src/joystick/SDL_sysjoystick.h +++ b/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/src/joystick/android/SDL_sysjoystick.c b/src/joystick/android/SDL_sysjoystick.c index 8ab682d45..8656a5322 100644 --- a/src/joystick/android/SDL_sysjoystick.c +++ b/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 diff --git a/src/joystick/android/SDL_sysjoystick_c.h b/src/joystick/android/SDL_sysjoystick_c.h index 2137e33c1..49b494c54 100644 --- a/src/joystick/android/SDL_sysjoystick_c.h +++ b/src/joystick/android/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/src/joystick/bsd/SDL_sysjoystick.c b/src/joystick/bsd/SDL_sysjoystick.c index a6fe2f735..509d43f75 100644 --- a/src/joystick/bsd/SDL_sysjoystick.c +++ b/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 @@ -76,7 +76,7 @@ #include "../SDL_sysjoystick.h" #include "../SDL_joystick_c.h" -#define MAX_UHID_JOYS 16 +#define MAX_UHID_JOYS 64 #define MAX_JOY_JOYS 2 #define MAX_JOYS (MAX_UHID_JOYS + MAX_JOY_JOYS) @@ -286,7 +286,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joy, int device_index) struct joystick_hwdata *hw; struct hid_item hitem; struct hid_data *hdata; - struct report *rep; + struct report *rep = NULL; int fd; int i; @@ -337,6 +337,38 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joy, int device_index) #endif rep->rid = -1; /* XXX */ } +#if defined(__NetBSD__) + usb_device_descriptor_t udd; + struct usb_string_desc usd; + if (ioctl(fd, USB_GET_DEVICE_DESC, &udd) == -1) + goto desc_failed; + + /* Get default language */ + usd.usd_string_index = USB_LANGUAGE_TABLE; + usd.usd_language_id = 0; + if (ioctl(fd, USB_GET_STRING_DESC, &usd) == -1 || usd.usd_desc.bLength < 4) { + usd.usd_language_id = 0; + } else { + usd.usd_language_id = UGETW(usd.usd_desc.bString[0]); + } + + usd.usd_string_index = udd.iProduct; + if (ioctl(fd, USB_GET_STRING_DESC, &usd) == 0) { + char str[128]; + char *new_name = NULL; + int i; + for (i = 0; i < (usd.usd_desc.bLength >> 1) - 1 && i < sizeof(str) - 1; i++) { + str[i] = UGETW(usd.usd_desc.bString[i]); + } + str[i] = '\0'; + asprintf(&new_name, "%s @ %s", str, path); + if (new_name != NULL) { + free(joydevnames[SDL_SYS_numjoysticks]); + joydevnames[SDL_SYS_numjoysticks] = new_name; + } + } +desc_failed: +#endif if (report_alloc(rep, hw->repdesc, REPORT_INPUT) < 0) { goto usberr; } @@ -409,9 +441,21 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joy, int device_index) if (hw->axis_map[i] > 0) hw->axis_map[i] = joy->naxes++; + if (joy->naxes == 0 && joy->nbuttons == 0 && joy->nhats == 0 && joy->nballs == 0) { + SDL_SetError("%s: Not a joystick, ignoring", hw->path); + goto usberr; + } + usbend: /* The poll blocks the event thread. */ fcntl(fd, F_SETFL, O_NONBLOCK); +#ifdef __NetBSD__ + /* Flush pending events */ + if (rep) { + while (read(joy->hwdata->fd, REP_BUF_DATA(rep), rep->size) == rep->size) + ; + } +#endif return (0); usberr: diff --git a/src/joystick/darwin/SDL_sysjoystick.c b/src/joystick/darwin/SDL_sysjoystick.c index e9a028b47..6dd306aa8 100644 --- a/src/joystick/darwin/SDL_sysjoystick.c +++ b/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 @@ -243,6 +243,20 @@ AddHIDElement(const void *value, void *parameter) } } break; + case kHIDUsage_GD_DPadUp: + case kHIDUsage_GD_DPadDown: + case kHIDUsage_GD_DPadRight: + case kHIDUsage_GD_DPadLeft: + case kHIDUsage_GD_Start: + case kHIDUsage_GD_Select: + if (!ElementAlreadyAdded(cookie, pDevice->firstButton)) { + element = (recElement *) SDL_calloc(1, sizeof (recElement)); + if (element) { + pDevice->buttons++; + headElement = &(pDevice->firstButton); + } + } + break; } break; @@ -265,6 +279,7 @@ AddHIDElement(const void *value, void *parameter) break; case kHIDPage_Button: + case kHIDPage_Consumer: /* e.g. 'pause' button on Steelseries MFi gamepads. */ if (!ElementAlreadyAdded(cookie, pDevice->firstButton)) { element = (recElement *) SDL_calloc(1, sizeof (recElement)); if (element) { diff --git a/src/joystick/darwin/SDL_sysjoystick_c.h b/src/joystick/darwin/SDL_sysjoystick_c.h index 0fefa265b..1c317eca7 100644 --- a/src/joystick/darwin/SDL_sysjoystick_c.h +++ b/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/src/joystick/dummy/SDL_sysjoystick.c b/src/joystick/dummy/SDL_sysjoystick.c index 6212c0e55..10fda10da 100644 --- a/src/joystick/dummy/SDL_sysjoystick.c +++ b/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/src/joystick/emscripten/SDL_sysjoystick.c b/src/joystick/emscripten/SDL_sysjoystick.c index 92b937155..e0c5833bf 100644 --- a/src/joystick/emscripten/SDL_sysjoystick.c +++ b/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/src/joystick/emscripten/SDL_sysjoystick_c.h b/src/joystick/emscripten/SDL_sysjoystick_c.h index 82b4e13b7..c7103c56a 100644 --- a/src/joystick/emscripten/SDL_sysjoystick_c.h +++ b/src/joystick/emscripten/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/src/joystick/haiku/SDL_haikujoystick.cc b/src/joystick/haiku/SDL_haikujoystick.cc index 612f3849d..3ec9ae107 100644 --- a/src/joystick/haiku/SDL_haikujoystick.cc +++ b/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/src/joystick/iphoneos/SDL_sysjoystick.m b/src/joystick/iphoneos/SDL_sysjoystick.m index 38c0ffe17..c8a42af05 100644 --- a/src/joystick/iphoneos/SDL_sysjoystick.m +++ b/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 @@ -116,6 +116,10 @@ device->nbuttons = 7; /* ABXY, shoulder buttons, pause button */ } /* TODO: Handle micro profiles on tvOS. */ + + /* This will be set when the first button press of the controller is + * detected. */ + controller.playerIndex = -1; #endif } @@ -361,7 +365,7 @@ SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) } else { #ifdef SDL_JOYSTICK_MFI GCController *controller = device->controller; - controller.controllerPausedHandler = ^(GCController *controller) { + controller.controllerPausedHandler = ^(GCController *c) { if (joystick->hwdata) { ++joystick->hwdata->num_pause_presses; } @@ -456,53 +460,102 @@ SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) GCController *controller = joystick->hwdata->controller; Uint8 hatstate = SDL_HAT_CENTERED; int i; + int updateplayerindex = 0; if (controller.extendedGamepad) { GCExtendedGamepad *gamepad = controller.extendedGamepad; /* Axis order matches the XInput Windows mappings. */ - SDL_PrivateJoystickAxis(joystick, 0, (Sint16) (gamepad.leftThumbstick.xAxis.value * 32767)); - SDL_PrivateJoystickAxis(joystick, 1, (Sint16) (gamepad.leftThumbstick.yAxis.value * 32767)); - SDL_PrivateJoystickAxis(joystick, 2, (Sint16) (gamepad.leftTrigger.value * 32767)); - SDL_PrivateJoystickAxis(joystick, 3, (Sint16) (gamepad.rightThumbstick.xAxis.value * 32767)); - SDL_PrivateJoystickAxis(joystick, 4, (Sint16) (gamepad.rightThumbstick.yAxis.value * 32767)); - SDL_PrivateJoystickAxis(joystick, 5, (Sint16) (gamepad.rightTrigger.value * 32767)); + Sint16 axes[] = { + (Sint16) (gamepad.leftThumbstick.xAxis.value * 32767), + (Sint16) (gamepad.leftThumbstick.yAxis.value * -32767), + (Sint16) ((gamepad.leftTrigger.value * 65535) - 32768), + (Sint16) (gamepad.rightThumbstick.xAxis.value * 32767), + (Sint16) (gamepad.rightThumbstick.yAxis.value * -32767), + (Sint16) ((gamepad.rightTrigger.value * 65535) - 32768), + }; + + /* Button order matches the XInput Windows mappings. */ + Uint8 buttons[] = { + gamepad.buttonA.isPressed, gamepad.buttonB.isPressed, + gamepad.buttonX.isPressed, gamepad.buttonY.isPressed, + gamepad.leftShoulder.isPressed, + gamepad.rightShoulder.isPressed, + }; hatstate = SDL_SYS_MFIJoystickHatStateForDPad(gamepad.dpad); - /* Button order matches the XInput Windows mappings. */ - SDL_PrivateJoystickButton(joystick, 0, gamepad.buttonA.isPressed); - SDL_PrivateJoystickButton(joystick, 1, gamepad.buttonB.isPressed); - SDL_PrivateJoystickButton(joystick, 2, gamepad.buttonX.isPressed); - SDL_PrivateJoystickButton(joystick, 3, gamepad.buttonY.isPressed); - SDL_PrivateJoystickButton(joystick, 4, gamepad.leftShoulder.isPressed); - SDL_PrivateJoystickButton(joystick, 5, gamepad.rightShoulder.isPressed); + for (i = 0; i < SDL_arraysize(axes); i++) { + /* The triggers (axes 2 and 5) are resting at -32768 but SDL + * initializes its values to 0. We only want to make sure the + * player index is up to date if the user actually moves an axis. */ + if ((i != 2 && i != 5) || axes[i] != -32768) { + updateplayerindex |= (joystick->axes[i] != axes[i]); + } + SDL_PrivateJoystickAxis(joystick, i, axes[i]); + } + + for (i = 0; i < SDL_arraysize(buttons); i++) { + updateplayerindex |= (joystick->buttons[i] != buttons[i]); + SDL_PrivateJoystickButton(joystick, i, buttons[i]); + } } else if (controller.gamepad) { GCGamepad *gamepad = controller.gamepad; + /* Button order matches the XInput Windows mappings. */ + Uint8 buttons[] = { + gamepad.buttonA.isPressed, gamepad.buttonB.isPressed, + gamepad.buttonX.isPressed, gamepad.buttonY.isPressed, + gamepad.leftShoulder.isPressed, + gamepad.rightShoulder.isPressed, + }; + hatstate = SDL_SYS_MFIJoystickHatStateForDPad(gamepad.dpad); - /* Button order matches the XInput Windows mappings. */ - SDL_PrivateJoystickButton(joystick, 0, gamepad.buttonA.isPressed); - SDL_PrivateJoystickButton(joystick, 1, gamepad.buttonB.isPressed); - SDL_PrivateJoystickButton(joystick, 2, gamepad.buttonX.isPressed); - SDL_PrivateJoystickButton(joystick, 3, gamepad.buttonY.isPressed); - SDL_PrivateJoystickButton(joystick, 4, gamepad.leftShoulder.isPressed); - SDL_PrivateJoystickButton(joystick, 5, gamepad.rightShoulder.isPressed); + for (i = 0; i < SDL_arraysize(buttons); i++) { + updateplayerindex |= (joystick->buttons[i] != buttons[i]); + SDL_PrivateJoystickButton(joystick, i, buttons[i]); + } } /* TODO: Handle micro profiles on tvOS. */ - SDL_PrivateJoystickHat(joystick, 0, hatstate); + if (joystick->nhats > 0) { + updateplayerindex |= (joystick->hats[0] != hatstate); + SDL_PrivateJoystickHat(joystick, 0, hatstate); + } for (i = 0; i < joystick->hwdata->num_pause_presses; i++) { /* The pause button is always last. */ Uint8 pausebutton = joystick->nbuttons - 1; - SDL_PrivateJoystickButton(joystick, pausebutton, 1); - SDL_PrivateJoystickButton(joystick, pausebutton, 0); + SDL_PrivateJoystickButton(joystick, pausebutton, SDL_PRESSED); + SDL_PrivateJoystickButton(joystick, pausebutton, SDL_RELEASED); + + updateplayerindex = YES; } joystick->hwdata->num_pause_presses = 0; + + if (updateplayerindex && controller.playerIndex == -1) { + BOOL usedPlayerIndexSlots[4] = {NO, NO, NO, NO}; + + /* Find the player index of all other connected controllers. */ + for (GCController *c in [GCController controllers]) { + if (c != controller && c.playerIndex >= 0) { + usedPlayerIndexSlots[c.playerIndex] = YES; + } + } + + /* Set this controller's player index to the first unused index. + * FIXME: This logic isn't great... but SDL doesn't expose this + * concept in its external API, so we don't have much to go on. */ + for (i = 0; i < SDL_arraysize(usedPlayerIndexSlots); i++) { + if (!usedPlayerIndexSlots[i]) { + controller.playerIndex = i; + break; + } + } + } } #endif } @@ -547,6 +600,7 @@ SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) #ifdef SDL_JOYSTICK_MFI GCController *controller = device->controller; controller.controllerPausedHandler = nil; + controller.playerIndex = -1; #endif } } diff --git a/src/joystick/iphoneos/SDL_sysjoystick_c.h b/src/joystick/iphoneos/SDL_sysjoystick_c.h index 4d21d90ab..be0ddf068 100644 --- a/src/joystick/iphoneos/SDL_sysjoystick_c.h +++ b/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/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c index c6f7911ca..8c73859ea 100644 --- a/src/joystick/linux/SDL_sysjoystick.c +++ b/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/src/joystick/linux/SDL_sysjoystick_c.h b/src/joystick/linux/SDL_sysjoystick_c.h index 0d7e65d2c..ee7717839 100644 --- a/src/joystick/linux/SDL_sysjoystick_c.h +++ b/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/src/joystick/psp/SDL_sysjoystick.c b/src/joystick/psp/SDL_sysjoystick.c index 9d20f90dd..e5247254f 100644 --- a/src/joystick/psp/SDL_sysjoystick.c +++ b/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/src/joystick/windows/SDL_dinputjoystick.c b/src/joystick/windows/SDL_dinputjoystick.c index 61d5b3862..f6b0cc88d 100644 --- a/src/joystick/windows/SDL_dinputjoystick.c +++ b/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/src/joystick/windows/SDL_dinputjoystick_c.h b/src/joystick/windows/SDL_dinputjoystick_c.h index f93b12090..7e4ff3e19 100644 --- a/src/joystick/windows/SDL_dinputjoystick_c.h +++ b/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/src/joystick/windows/SDL_mmjoystick.c b/src/joystick/windows/SDL_mmjoystick.c index 65b16ab98..374618181 100644 --- a/src/joystick/windows/SDL_mmjoystick.c +++ b/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/src/joystick/windows/SDL_windowsjoystick.c b/src/joystick/windows/SDL_windowsjoystick.c index c06fad0d8..7123c6151 100644 --- a/src/joystick/windows/SDL_windowsjoystick.c +++ b/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/src/joystick/windows/SDL_windowsjoystick_c.h b/src/joystick/windows/SDL_windowsjoystick_c.h index 5f991dc2c..ab946b4f7 100644 --- a/src/joystick/windows/SDL_windowsjoystick_c.h +++ b/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/src/joystick/windows/SDL_xinputjoystick.c b/src/joystick/windows/SDL_xinputjoystick.c index b3a4c9e6d..2f27c47dc 100644 --- a/src/joystick/windows/SDL_xinputjoystick.c +++ b/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 @@ -222,7 +222,7 @@ SDL_XINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickde } static void -UpdateXInputJoystickBatteryInformation(SDL_Joystick * joystick, XINPUT_BATTERY_INFORMATION *pBatteryInformation) +UpdateXInputJoystickBatteryInformation(SDL_Joystick * joystick, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation) { if ( pBatteryInformation->BatteryType != BATTERY_TYPE_UNKNOWN ) { @@ -253,7 +253,7 @@ UpdateXInputJoystickBatteryInformation(SDL_Joystick * joystick, XINPUT_BATTERY_I } static void -UpdateXInputJoystickState_OLD(SDL_Joystick * joystick, XINPUT_STATE_EX *pXInputState, XINPUT_BATTERY_INFORMATION *pBatteryInformation) +UpdateXInputJoystickState_OLD(SDL_Joystick * joystick, XINPUT_STATE_EX *pXInputState, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation) { static WORD s_XInputButtons[] = { XINPUT_GAMEPAD_DPAD_UP, XINPUT_GAMEPAD_DPAD_DOWN, XINPUT_GAMEPAD_DPAD_LEFT, XINPUT_GAMEPAD_DPAD_RIGHT, @@ -280,7 +280,7 @@ UpdateXInputJoystickState_OLD(SDL_Joystick * joystick, XINPUT_STATE_EX *pXInputS } static void -UpdateXInputJoystickState(SDL_Joystick * joystick, XINPUT_STATE_EX *pXInputState, XINPUT_BATTERY_INFORMATION *pBatteryInformation) +UpdateXInputJoystickState(SDL_Joystick * joystick, XINPUT_STATE_EX *pXInputState, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation) { static WORD s_XInputButtons[] = { XINPUT_GAMEPAD_A, XINPUT_GAMEPAD_B, XINPUT_GAMEPAD_X, XINPUT_GAMEPAD_Y, @@ -325,7 +325,7 @@ SDL_XINPUT_JoystickUpdate(SDL_Joystick * joystick) { HRESULT result; XINPUT_STATE_EX XInputState; - XINPUT_BATTERY_INFORMATION XBatteryInformation; + XINPUT_BATTERY_INFORMATION_EX XBatteryInformation; if (!XINPUTGETSTATE) return; diff --git a/src/joystick/windows/SDL_xinputjoystick_c.h b/src/joystick/windows/SDL_xinputjoystick_c.h index ed6087bcd..b3ba8c02e 100644 --- a/src/joystick/windows/SDL_xinputjoystick_c.h +++ b/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/src/libm/math_libm.h b/src/libm/math_libm.h index 9e91073e9..3fe1727a3 100644 --- a/src/libm/math_libm.h +++ b/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/src/loadso/dlopen/SDL_sysloadso.c b/src/loadso/dlopen/SDL_sysloadso.c index f3dffefd0..03ffae129 100644 --- a/src/loadso/dlopen/SDL_sysloadso.c +++ b/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/src/loadso/dummy/SDL_sysloadso.c b/src/loadso/dummy/SDL_sysloadso.c index a38b56970..4f132f9f5 100644 --- a/src/loadso/dummy/SDL_sysloadso.c +++ b/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/src/loadso/haiku/SDL_sysloadso.c b/src/loadso/haiku/SDL_sysloadso.c index a5f129505..1336d9e18 100644 --- a/src/loadso/haiku/SDL_sysloadso.c +++ b/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/src/loadso/windows/SDL_sysloadso.c b/src/loadso/windows/SDL_sysloadso.c index 1c1d8cfa5..bdb2b9874 100644 --- a/src/loadso/windows/SDL_sysloadso.c +++ b/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/src/main/haiku/SDL_BApp.h b/src/main/haiku/SDL_BApp.h index 1c5dbb844..157c23635 100644 --- a/src/main/haiku/SDL_BApp.h +++ b/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/src/main/haiku/SDL_BeApp.cc b/src/main/haiku/SDL_BeApp.cc index f09afb2ed..36c2a1ab8 100644 --- a/src/main/haiku/SDL_BeApp.cc +++ b/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/src/main/haiku/SDL_BeApp.h b/src/main/haiku/SDL_BeApp.h index b1cb95016..6700a3be9 100644 --- a/src/main/haiku/SDL_BeApp.h +++ b/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/src/main/nacl/SDL_nacl_main.c b/src/main/nacl/SDL_nacl_main.c index 378db7afb..4c01d0fba 100644 --- a/src/main/nacl/SDL_nacl_main.c +++ b/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/src/main/windows/version.rc b/src/main/windows/version.rc index d9fbffc71..b4f79b23e 100644 --- a/src/main/windows/version.rc +++ b/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/src/power/SDL_power.c b/src/power/SDL_power.c index 8f919f2eb..016013b97 100644 --- a/src/power/SDL_power.c +++ b/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/src/power/android/SDL_syspower.c b/src/power/android/SDL_syspower.c index 94a4ff4cb..5a4b0fc14 100644 --- a/src/power/android/SDL_syspower.c +++ b/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/src/power/emscripten/SDL_syspower.c b/src/power/emscripten/SDL_syspower.c index 3a2b4ed8d..307f79742 100644 --- a/src/power/emscripten/SDL_syspower.c +++ b/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/src/power/haiku/SDL_syspower.c b/src/power/haiku/SDL_syspower.c index 2d87806af..cfda8c962 100644 --- a/src/power/haiku/SDL_syspower.c +++ b/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/src/power/linux/SDL_syspower.c b/src/power/linux/SDL_syspower.c index 3986489f7..793e26669 100644 --- a/src/power/linux/SDL_syspower.c +++ b/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/src/power/macosx/SDL_syspower.c b/src/power/macosx/SDL_syspower.c index d029de5d9..f865d59ef 100644 --- a/src/power/macosx/SDL_syspower.c +++ b/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/src/power/psp/SDL_syspower.c b/src/power/psp/SDL_syspower.c index 55011080a..76c21b947 100644 --- a/src/power/psp/SDL_syspower.c +++ b/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/src/power/uikit/SDL_syspower.h b/src/power/uikit/SDL_syspower.h index 7b0e52421..4cfa5c974 100644 --- a/src/power/uikit/SDL_syspower.h +++ b/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/src/power/uikit/SDL_syspower.m b/src/power/uikit/SDL_syspower.m index 2851c109f..14ce3576a 100644 --- a/src/power/uikit/SDL_syspower.m +++ b/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/src/power/windows/SDL_syspower.c b/src/power/windows/SDL_syspower.c index 5c9e02402..ff3784ccf 100644 --- a/src/power/windows/SDL_syspower.c +++ b/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/src/power/winrt/SDL_syspower.cpp b/src/power/winrt/SDL_syspower.cpp index cce6bede8..94e5a2853 100644 --- a/src/power/winrt/SDL_syspower.cpp +++ b/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/src/render/SDL_d3dmath.c b/src/render/SDL_d3dmath.c index 058b3af28..83d67bfa7 100644 --- a/src/render/SDL_d3dmath.c +++ b/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/src/render/SDL_d3dmath.h b/src/render/SDL_d3dmath.h index 34a226d5d..87c44c7a3 100644 --- a/src/render/SDL_d3dmath.h +++ b/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/src/render/SDL_render.c b/src/render/SDL_render.c index f00688b05..923973ec7 100644 --- a/src/render/SDL_render.c +++ b/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 @@ -158,7 +158,8 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event) } } else if (event->window.event == SDL_WINDOWEVENT_MINIMIZED) { renderer->hidden = SDL_TRUE; - } else if (event->window.event == SDL_WINDOWEVENT_RESTORED) { + } else if (event->window.event == SDL_WINDOWEVENT_RESTORED || + event->window.event == SDL_WINDOWEVENT_MAXIMIZED) { if (!(SDL_GetWindowFlags(window) & SDL_WINDOW_HIDDEN)) { renderer->hidden = SDL_FALSE; } diff --git a/src/render/SDL_sysrender.h b/src/render/SDL_sysrender.h index 9c74ebbef..19dfe8e64 100644 --- a/src/render/SDL_sysrender.h +++ b/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 diff --git a/src/render/SDL_yuv_mmx.c b/src/render/SDL_yuv_mmx.c index f9320bfbf..0de776a36 100644 --- a/src/render/SDL_yuv_mmx.c +++ b/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/src/render/SDL_yuv_sw.c b/src/render/SDL_yuv_sw.c index a9ad87aa9..7fc6b8865 100644 --- a/src/render/SDL_yuv_sw.c +++ b/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/src/render/SDL_yuv_sw_c.h b/src/render/SDL_yuv_sw_c.h index 3b3a266f3..2752096f4 100644 --- a/src/render/SDL_yuv_sw_c.h +++ b/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/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c index 910ceb37c..9d7564224 100644 --- a/src/render/direct3d/SDL_render_d3d.c +++ b/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/src/render/direct3d11/SDL_render_d3d11.c b/src/render/direct3d11/SDL_render_d3d11.c index ebe4100aa..a48eacee7 100644 --- a/src/render/direct3d11/SDL_render_d3d11.c +++ b/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 @@ -760,8 +760,8 @@ SDL_RenderDriver D3D11_RenderDriver = { }; -static Uint32 -DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat) { +Uint32 +D3D11_DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat) { switch (dxgiFormat) { case DXGI_FORMAT_B8G8R8A8_UNORM: return SDL_PIXELFORMAT_ARGB8888; @@ -2367,7 +2367,7 @@ D3D11_UpdateVertexBuffer(SDL_Renderer *renderer, } else { SAFE_RELEASE(rendererData->vertexBuffer); - vertexBufferDesc.ByteWidth = dataSizeInBytes; + vertexBufferDesc.ByteWidth = (UINT) dataSizeInBytes; vertexBufferDesc.Usage = D3D11_USAGE_DYNAMIC; vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; vertexBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; @@ -2911,7 +2911,7 @@ D3D11_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, */ if (SDL_ConvertPixels( rect->w, rect->h, - DXGIFormatToSDLPixelFormat(stagingTextureDesc.Format), + D3D11_DXGIFormatToSDLPixelFormat(stagingTextureDesc.Format), textureMemory.pData, textureMemory.RowPitch, format, diff --git a/src/render/direct3d11/SDL_render_winrt.cpp b/src/render/direct3d11/SDL_render_winrt.cpp index 991366628..99f2b4ea4 100644 --- a/src/render/direct3d11/SDL_render_winrt.cpp +++ b/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/src/render/direct3d11/SDL_render_winrt.h b/src/render/direct3d11/SDL_render_winrt.h index 5c76b70f8..734ebf41a 100644 --- a/src/render/direct3d11/SDL_render_winrt.h +++ b/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/src/render/opengl/SDL_glfuncs.h b/src/render/opengl/SDL_glfuncs.h index a9f38c436..c8eba583c 100644 --- a/src/render/opengl/SDL_glfuncs.h +++ b/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/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index f5ac96d01..6a4fa3ecf 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/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 @@ -393,7 +393,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) const char *hint; GLint value; Uint32 window_flags; - int profile_mask, major, minor; + int profile_mask = 0, major = 0, minor = 0; SDL_bool changed_window = SDL_FALSE; SDL_GL_GetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, &profile_mask); @@ -1052,7 +1052,7 @@ GL_UpdateClipRect(SDL_Renderer * renderer) int w, h; SDL_GetRendererOutputSize(renderer, &w, &h); - data->glScissor(renderer->viewport.x + rect->x, (h - renderer->viewport.y - renderer->viewport.h) + rect->y, rect->w, rect->h); + data->glScissor(renderer->viewport.x + rect->x, h - renderer->viewport.y - rect->y - rect->h, rect->w, rect->h); } } else { data->glDisable(GL_SCISSOR_TEST); diff --git a/src/render/opengl/SDL_shaders_gl.c b/src/render/opengl/SDL_shaders_gl.c index f08855238..bcf7b4315 100644 --- a/src/render/opengl/SDL_shaders_gl.c +++ b/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/src/render/opengl/SDL_shaders_gl.h b/src/render/opengl/SDL_shaders_gl.h index 1b2e4a5a3..261627cc7 100644 --- a/src/render/opengl/SDL_shaders_gl.h +++ b/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/src/render/opengles/SDL_glesfuncs.h b/src/render/opengles/SDL_glesfuncs.h index 4eb72d6bc..a15d76d49 100644 --- a/src/render/opengles/SDL_glesfuncs.h +++ b/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/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c index 21c22bfd7..0d59da360 100644 --- a/src/render/opengles/SDL_render_gles.c +++ b/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 @@ -285,7 +285,7 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags) GLES_RenderData *data; GLint value; Uint32 window_flags; - int profile_mask, major, minor; + int profile_mask = 0, major = 0, minor = 0; SDL_bool changed_window = SDL_FALSE; SDL_GL_GetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, &profile_mask); @@ -721,7 +721,7 @@ GLES_UpdateClipRect(SDL_Renderer * renderer) int w, h; SDL_GetRendererOutputSize(renderer, &w, &h); - data->glScissor(renderer->viewport.x + rect->x, (h - renderer->viewport.y - renderer->viewport.h) + rect->y, rect->w, rect->h); + data->glScissor(renderer->viewport.x + rect->x, h - renderer->viewport.y - rect->y - rect->h, rect->w, rect->h); } } else { data->glDisable(GL_SCISSOR_TEST); diff --git a/src/render/opengles2/SDL_gles2funcs.h b/src/render/opengles2/SDL_gles2funcs.h index 36dcf7424..0ecfa7f94 100644 --- a/src/render/opengles2/SDL_gles2funcs.h +++ b/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/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c index 7254cb7a3..e41ab6231 100644 --- a/src/render/opengles2/SDL_render_gles2.c +++ b/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 @@ -418,7 +418,7 @@ GLES2_UpdateClipRect(SDL_Renderer * renderer) int w, h; SDL_GetRendererOutputSize(renderer, &w, &h); - data->glScissor(renderer->viewport.x + rect->x, (h - renderer->viewport.y - renderer->viewport.h) + rect->y, rect->w, rect->h); + data->glScissor(renderer->viewport.x + rect->x, h - renderer->viewport.y - rect->y - rect->h, rect->w, rect->h); } } else { data->glDisable(GL_SCISSOR_TEST); @@ -1956,7 +1956,7 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) Uint32 window_flags; GLint window_framebuffer; GLint value; - int profile_mask, major, minor; + int profile_mask = 0, major = 0, minor = 0; SDL_bool changed_window = SDL_FALSE; SDL_GL_GetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, &profile_mask); diff --git a/src/render/opengles2/SDL_shaders_gles2.c b/src/render/opengles2/SDL_shaders_gles2.c index 6f650811a..0c01a8c64 100644 --- a/src/render/opengles2/SDL_shaders_gles2.c +++ b/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/src/render/opengles2/SDL_shaders_gles2.h b/src/render/opengles2/SDL_shaders_gles2.h index f22c8f56b..3958ae00d 100644 --- a/src/render/opengles2/SDL_shaders_gles2.h +++ b/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/src/render/psp/SDL_render_psp.c b/src/render/psp/SDL_render_psp.c index 39a2eab6a..8e8c87353 100644 --- a/src/render/psp/SDL_render_psp.c +++ b/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/src/render/software/SDL_blendfillrect.c b/src/render/software/SDL_blendfillrect.c index 669422f77..7cfb274ae 100644 --- a/src/render/software/SDL_blendfillrect.c +++ b/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/src/render/software/SDL_blendfillrect.h b/src/render/software/SDL_blendfillrect.h index b612db24c..88bb2e2c4 100644 --- a/src/render/software/SDL_blendfillrect.h +++ b/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/src/render/software/SDL_blendline.c b/src/render/software/SDL_blendline.c index b2090b137..ef0d58531 100644 --- a/src/render/software/SDL_blendline.c +++ b/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/src/render/software/SDL_blendline.h b/src/render/software/SDL_blendline.h index 602cafd6c..c0b545f34 100644 --- a/src/render/software/SDL_blendline.h +++ b/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/src/render/software/SDL_blendpoint.c b/src/render/software/SDL_blendpoint.c index 47243794b..fc42dfe76 100644 --- a/src/render/software/SDL_blendpoint.c +++ b/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/src/render/software/SDL_blendpoint.h b/src/render/software/SDL_blendpoint.h index 7045326a7..58ddec7ee 100644 --- a/src/render/software/SDL_blendpoint.h +++ b/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/src/render/software/SDL_draw.h b/src/render/software/SDL_draw.h index e2822427c..3a5e7cf11 100644 --- a/src/render/software/SDL_draw.h +++ b/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/src/render/software/SDL_drawline.c b/src/render/software/SDL_drawline.c index e76c3f40e..fd50ea748 100644 --- a/src/render/software/SDL_drawline.c +++ b/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/src/render/software/SDL_drawline.h b/src/render/software/SDL_drawline.h index e2dafeae2..40721c3fc 100644 --- a/src/render/software/SDL_drawline.h +++ b/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/src/render/software/SDL_drawpoint.c b/src/render/software/SDL_drawpoint.c index 38ea4b740..98f0d83c0 100644 --- a/src/render/software/SDL_drawpoint.c +++ b/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/src/render/software/SDL_drawpoint.h b/src/render/software/SDL_drawpoint.h index d26c2b58b..e77857ac9 100644 --- a/src/render/software/SDL_drawpoint.h +++ b/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/src/render/software/SDL_render_sw.c b/src/render/software/SDL_render_sw.c index 119b20015..dadd2442f 100644 --- a/src/render/software/SDL_render_sw.c +++ b/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/src/render/software/SDL_render_sw_c.h b/src/render/software/SDL_render_sw_c.h index df1a64734..89b4e8acc 100644 --- a/src/render/software/SDL_render_sw_c.h +++ b/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/src/render/software/SDL_rotate.h b/src/render/software/SDL_rotate.h index 01ceb2d84..338109fc0 100644 --- a/src/render/software/SDL_rotate.h +++ b/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/src/stdlib/SDL_getenv.c b/src/stdlib/SDL_getenv.c index 7936498cc..3fc4119fd 100644 --- a/src/stdlib/SDL_getenv.c +++ b/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/src/stdlib/SDL_iconv.c b/src/stdlib/SDL_iconv.c index 31efb4269..8f0403734 100644 --- a/src/stdlib/SDL_iconv.c +++ b/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/src/stdlib/SDL_malloc.c b/src/stdlib/SDL_malloc.c index 996e5d242..d640c8fad 100644 --- a/src/stdlib/SDL_malloc.c +++ b/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/src/stdlib/SDL_stdlib.c b/src/stdlib/SDL_stdlib.c index a488af266..f11f65d64 100644 --- a/src/stdlib/SDL_stdlib.c +++ b/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/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c index 68d88ece0..5debb2285 100644 --- a/src/stdlib/SDL_string.c +++ b/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/src/test/SDL_test_assert.c b/src/test/SDL_test_assert.c index 12eca146a..98a84d386 100644 --- a/src/test/SDL_test_assert.c +++ b/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/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index 2f06a794a..fee249cb9 100644 --- a/src/test/SDL_test_common.c +++ b/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 diff --git a/src/test/SDL_test_compare.c b/src/test/SDL_test_compare.c index 9f74c44d4..45eb3c689 100644 --- a/src/test/SDL_test_compare.c +++ b/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 diff --git a/src/test/SDL_test_crc32.c b/src/test/SDL_test_crc32.c index 7aa0a68fa..6e1220881 100644 --- a/src/test/SDL_test_crc32.c +++ b/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/src/test/SDL_test_font.c b/src/test/SDL_test_font.c index 4be29f117..afd35c6c2 100644 --- a/src/test/SDL_test_font.c +++ b/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/src/test/SDL_test_fuzzer.c b/src/test/SDL_test_fuzzer.c index 9fad17858..1bd8dfa18 100644 --- a/src/test/SDL_test_fuzzer.c +++ b/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/src/test/SDL_test_harness.c b/src/test/SDL_test_harness.c index 6dde93f87..fec34164c 100644 --- a/src/test/SDL_test_harness.c +++ b/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/src/test/SDL_test_imageBlit.c b/src/test/SDL_test_imageBlit.c index 1b9ed7bf6..5896ca099 100644 --- a/src/test/SDL_test_imageBlit.c +++ b/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/src/test/SDL_test_imageBlitBlend.c b/src/test/SDL_test_imageBlitBlend.c index 963520bd7..6e8c2f1b4 100644 --- a/src/test/SDL_test_imageBlitBlend.c +++ b/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/src/test/SDL_test_imageFace.c b/src/test/SDL_test_imageFace.c index 37498d874..84f5037f4 100644 --- a/src/test/SDL_test_imageFace.c +++ b/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/src/test/SDL_test_imagePrimitives.c b/src/test/SDL_test_imagePrimitives.c index 5576d3d26..4ab48d2de 100644 --- a/src/test/SDL_test_imagePrimitives.c +++ b/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/src/test/SDL_test_imagePrimitivesBlend.c b/src/test/SDL_test_imagePrimitivesBlend.c index c8e199309..5e538628e 100644 --- a/src/test/SDL_test_imagePrimitivesBlend.c +++ b/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/src/test/SDL_test_log.c b/src/test/SDL_test_log.c index ed7139b67..097372e7a 100644 --- a/src/test/SDL_test_log.c +++ b/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/src/test/SDL_test_md5.c b/src/test/SDL_test_md5.c index 291ad6b20..7cc356757 100644 --- a/src/test/SDL_test_md5.c +++ b/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/src/test/SDL_test_random.c b/src/test/SDL_test_random.c index 088c301ad..c5baaa640 100644 --- a/src/test/SDL_test_random.c +++ b/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/src/thread/SDL_systhread.h b/src/thread/SDL_systhread.h index d3eab1f3f..f13f3e203 100644 --- a/src/thread/SDL_systhread.h +++ b/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/src/thread/SDL_thread.c b/src/thread/SDL_thread.c index 8bc37fac9..e66c5819c 100644 --- a/src/thread/SDL_thread.c +++ b/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/src/thread/SDL_thread_c.h b/src/thread/SDL_thread_c.h index 2df712540..a283a0e2c 100644 --- a/src/thread/SDL_thread_c.h +++ b/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/src/thread/generic/SDL_syscond.c b/src/thread/generic/SDL_syscond.c index 6e7f9b330..e2ccd88ef 100644 --- a/src/thread/generic/SDL_syscond.c +++ b/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/src/thread/generic/SDL_sysmutex.c b/src/thread/generic/SDL_sysmutex.c index 0c7a85142..f2f668970 100644 --- a/src/thread/generic/SDL_sysmutex.c +++ b/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/src/thread/generic/SDL_sysmutex_c.h b/src/thread/generic/SDL_sysmutex_c.h index 7481b6656..9dba5e16c 100644 --- a/src/thread/generic/SDL_sysmutex_c.h +++ b/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/src/thread/generic/SDL_syssem.c b/src/thread/generic/SDL_syssem.c index cae084db5..92afcb0c0 100644 --- a/src/thread/generic/SDL_syssem.c +++ b/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/src/thread/generic/SDL_systhread.c b/src/thread/generic/SDL_systhread.c index b248165fd..7a81a6201 100644 --- a/src/thread/generic/SDL_systhread.c +++ b/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/src/thread/generic/SDL_systhread_c.h b/src/thread/generic/SDL_systhread_c.h index 30ba69ea0..ea9b71460 100644 --- a/src/thread/generic/SDL_systhread_c.h +++ b/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/src/thread/generic/SDL_systls.c b/src/thread/generic/SDL_systls.c index 99bfce77c..e29c19818 100644 --- a/src/thread/generic/SDL_systls.c +++ b/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/src/thread/psp/SDL_syscond.c b/src/thread/psp/SDL_syscond.c index d4ff59d59..a84b206c8 100644 --- a/src/thread/psp/SDL_syscond.c +++ b/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/src/thread/psp/SDL_sysmutex.c b/src/thread/psp/SDL_sysmutex.c index e0f411ea5..78129fa69 100644 --- a/src/thread/psp/SDL_sysmutex.c +++ b/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/src/thread/psp/SDL_sysmutex_c.h b/src/thread/psp/SDL_sysmutex_c.h index 7481b6656..9dba5e16c 100644 --- a/src/thread/psp/SDL_sysmutex_c.h +++ b/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/src/thread/psp/SDL_syssem.c b/src/thread/psp/SDL_syssem.c index cfbbe433d..643406c46 100644 --- a/src/thread/psp/SDL_syssem.c +++ b/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/src/thread/psp/SDL_systhread.c b/src/thread/psp/SDL_systhread.c index 95141cc80..ab8aff376 100644 --- a/src/thread/psp/SDL_systhread.c +++ b/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/src/thread/psp/SDL_systhread_c.h b/src/thread/psp/SDL_systhread_c.h index 2c5de1bae..4f74df06a 100644 --- a/src/thread/psp/SDL_systhread_c.h +++ b/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/src/thread/pthread/SDL_syscond.c b/src/thread/pthread/SDL_syscond.c index 2b0e0a537..998ac55b3 100644 --- a/src/thread/pthread/SDL_syscond.c +++ b/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/src/thread/pthread/SDL_sysmutex.c b/src/thread/pthread/SDL_sysmutex.c index d7fa982c8..f24cfdab0 100644 --- a/src/thread/pthread/SDL_sysmutex.c +++ b/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/src/thread/pthread/SDL_sysmutex_c.h b/src/thread/pthread/SDL_sysmutex_c.h index 475275a25..ee60ca041 100644 --- a/src/thread/pthread/SDL_sysmutex_c.h +++ b/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/src/thread/pthread/SDL_syssem.c b/src/thread/pthread/SDL_syssem.c index a89a262a7..b7547e699 100644 --- a/src/thread/pthread/SDL_syssem.c +++ b/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/src/thread/pthread/SDL_systhread.c b/src/thread/pthread/SDL_systhread.c index 14eee8deb..22f7bd57b 100644 --- a/src/thread/pthread/SDL_systhread.c +++ b/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 @@ -143,7 +143,11 @@ SDL_SYS_SetupThread(const char *name) #endif } #elif HAVE_PTHREAD_SETNAME_NP + #if defined(__NETBSD__) + pthread_setname_np(pthread_self(), "%s", name); + #else pthread_setname_np(pthread_self(), name); + #endif #elif HAVE_PTHREAD_SET_NAME_NP pthread_set_name_np(pthread_self(), name); #elif defined(__HAIKU__) diff --git a/src/thread/pthread/SDL_systhread_c.h b/src/thread/pthread/SDL_systhread_c.h index 3a25f47a8..4ad188443 100644 --- a/src/thread/pthread/SDL_systhread_c.h +++ b/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/src/thread/pthread/SDL_systls.c b/src/thread/pthread/SDL_systls.c index 0440af57f..622ad0297 100644 --- a/src/thread/pthread/SDL_systls.c +++ b/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/src/thread/stdcpp/SDL_syscond.cpp b/src/thread/stdcpp/SDL_syscond.cpp index 51ec4dc7c..976bff487 100644 --- a/src/thread/stdcpp/SDL_syscond.cpp +++ b/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 @@ -128,7 +128,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms) } try { - std::unique_lock cpp_lock(mutex->cpp_mutex, std::defer_lock_t()); + std::unique_lock cpp_lock(mutex->cpp_mutex, std::adopt_lock_t()); if (ms == SDL_MUTEX_MAXWAIT) { cond->cpp_cond.wait( cpp_lock diff --git a/src/thread/stdcpp/SDL_sysmutex.cpp b/src/thread/stdcpp/SDL_sysmutex.cpp index da411612b..04028627d 100644 --- a/src/thread/stdcpp/SDL_sysmutex.cpp +++ b/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/src/thread/stdcpp/SDL_sysmutex_c.h b/src/thread/stdcpp/SDL_sysmutex_c.h index d7b5b218b..ab0f2dd83 100644 --- a/src/thread/stdcpp/SDL_sysmutex_c.h +++ b/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/src/thread/stdcpp/SDL_systhread.cpp b/src/thread/stdcpp/SDL_systhread.cpp index ab8e1505c..219c67e93 100644 --- a/src/thread/stdcpp/SDL_systhread.cpp +++ b/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/src/thread/stdcpp/SDL_systhread_c.h b/src/thread/stdcpp/SDL_systhread_c.h index d3affedc4..c3cc507c3 100644 --- a/src/thread/stdcpp/SDL_systhread_c.h +++ b/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/src/thread/windows/SDL_sysmutex.c b/src/thread/windows/SDL_sysmutex.c index a5c62cd5a..413cb6703 100644 --- a/src/thread/windows/SDL_sysmutex.c +++ b/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 @@ -45,7 +45,11 @@ SDL_CreateMutex(void) if (mutex) { /* Initialize */ /* On SMP systems, a non-zero spin count generally helps performance */ +#if __WINRT__ + InitializeCriticalSectionEx(&mutex->cs, 2000, 0); +#else InitializeCriticalSectionAndSpinCount(&mutex->cs, 2000); +#endif } else { SDL_OutOfMemory(); } diff --git a/src/thread/windows/SDL_syssem.c b/src/thread/windows/SDL_syssem.c index 149c27577..86b58882d 100644 --- a/src/thread/windows/SDL_syssem.c +++ b/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 @@ -45,7 +45,11 @@ SDL_CreateSemaphore(Uint32 initial_value) sem = (SDL_sem *) SDL_malloc(sizeof(*sem)); if (sem) { /* Create the semaphore, with max value 32K */ +#if __WINRT__ + sem->id = CreateSemaphoreEx(NULL, initial_value, 32 * 1024, NULL, 0, SEMAPHORE_ALL_ACCESS); +#else sem->id = CreateSemaphore(NULL, initial_value, 32 * 1024, NULL); +#endif sem->count = initial_value; if (!sem->id) { SDL_SetError("Couldn't create semaphore"); @@ -86,7 +90,11 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) } else { dwMilliseconds = (DWORD) timeout; } +#if __WINRT__ + switch (WaitForSingleObjectEx(sem->id, dwMilliseconds, FALSE)) { +#else switch (WaitForSingleObject(sem->id, dwMilliseconds)) { +#endif case WAIT_OBJECT_0: InterlockedDecrement(&sem->count); retval = 0; diff --git a/src/thread/windows/SDL_systhread.c b/src/thread/windows/SDL_systhread.c index 34d70d45b..308145e30 100644 --- a/src/thread/windows/SDL_systhread.c +++ b/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 @@ -106,7 +106,7 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread) { -#elif defined(__CYGWIN__) +#elif defined(__CYGWIN__) || defined(__WINRT__) int SDL_SYS_CreateThread(SDL_Thread * thread, void *args) { @@ -230,7 +230,11 @@ 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/src/thread/windows/SDL_systhread_c.h b/src/thread/windows/SDL_systhread_c.h index 0beafe889..90866a7bb 100644 --- a/src/thread/windows/SDL_systhread_c.h +++ b/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/src/thread/windows/SDL_systls.c b/src/thread/windows/SDL_systls.c index 67c847414..7ec630e8f 100644 --- a/src/thread/windows/SDL_systls.c +++ b/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/src/timer/SDL_timer.c b/src/timer/SDL_timer.c index 2e5e544c7..6189ab8b5 100644 --- a/src/timer/SDL_timer.c +++ b/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 diff --git a/src/timer/SDL_timer_c.h b/src/timer/SDL_timer_c.h index ab1e16ac7..6ae817058 100644 --- a/src/timer/SDL_timer_c.h +++ b/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/src/timer/dummy/SDL_systimer.c b/src/timer/dummy/SDL_systimer.c index 0a63bfabd..1174d2241 100644 --- a/src/timer/dummy/SDL_systimer.c +++ b/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/src/timer/haiku/SDL_systimer.c b/src/timer/haiku/SDL_systimer.c index ea736ba7a..f45aa64d7 100644 --- a/src/timer/haiku/SDL_systimer.c +++ b/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/src/timer/psp/SDL_systimer.c b/src/timer/psp/SDL_systimer.c index ece71d371..1e8802cf1 100644 --- a/src/timer/psp/SDL_systimer.c +++ b/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/src/timer/unix/SDL_systimer.c b/src/timer/unix/SDL_systimer.c index 98917214d..217fe327f 100644 --- a/src/timer/unix/SDL_systimer.c +++ b/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/src/timer/windows/SDL_systimer.c b/src/timer/windows/SDL_systimer.c index a213be009..abfbcb99a 100644 --- a/src/timer/windows/SDL_systimer.c +++ b/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 diff --git a/src/video/SDL_RLEaccel.c b/src/video/SDL_RLEaccel.c index b9f1426dc..67baaf664 100644 --- a/src/video/SDL_RLEaccel.c +++ b/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/src/video/SDL_RLEaccel_c.h b/src/video/SDL_RLEaccel_c.h index ed980f981..c04fc1527 100644 --- a/src/video/SDL_RLEaccel_c.h +++ b/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/src/video/SDL_blit.c b/src/video/SDL_blit.c index 1c8b0735e..90aa87898 100644 --- a/src/video/SDL_blit.c +++ b/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/src/video/SDL_blit.h b/src/video/SDL_blit.h index 6b8effff9..e30f8afec 100644 --- a/src/video/SDL_blit.h +++ b/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/src/video/SDL_blit_0.c b/src/video/SDL_blit_0.c index 64e20f8e0..fe7330d78 100644 --- a/src/video/SDL_blit_0.c +++ b/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/src/video/SDL_blit_1.c b/src/video/SDL_blit_1.c index 53f486b98..69c15d08d 100644 --- a/src/video/SDL_blit_1.c +++ b/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/src/video/SDL_blit_A.c b/src/video/SDL_blit_A.c index 4ba7c82cd..0190ffddd 100644 --- a/src/video/SDL_blit_A.c +++ b/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/src/video/SDL_blit_N.c b/src/video/SDL_blit_N.c index c0c7fbfbe..94894a78c 100644 --- a/src/video/SDL_blit_N.c +++ b/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/src/video/SDL_blit_auto.c b/src/video/SDL_blit_auto.c index 987d12d80..f12281913 100644 --- a/src/video/SDL_blit_auto.c +++ b/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/src/video/SDL_blit_auto.h b/src/video/SDL_blit_auto.h index 7ba689c7c..58a532db0 100644 --- a/src/video/SDL_blit_auto.h +++ b/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/src/video/SDL_blit_copy.c b/src/video/SDL_blit_copy.c index 3ec2e7eb1..7b9a91ffd 100644 --- a/src/video/SDL_blit_copy.c +++ b/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/src/video/SDL_blit_copy.h b/src/video/SDL_blit_copy.h index 73defa2f8..060026d8a 100644 --- a/src/video/SDL_blit_copy.h +++ b/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/src/video/SDL_blit_slow.c b/src/video/SDL_blit_slow.c index 9082f7a62..3a462f6e2 100644 --- a/src/video/SDL_blit_slow.c +++ b/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/src/video/SDL_blit_slow.h b/src/video/SDL_blit_slow.h index 5bd0598ad..75005fc53 100644 --- a/src/video/SDL_blit_slow.h +++ b/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/src/video/SDL_bmp.c b/src/video/SDL_bmp.c index 3ea2dd541..f80f93696 100644 --- a/src/video/SDL_bmp.c +++ b/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/src/video/SDL_clipboard.c b/src/video/SDL_clipboard.c index feff8eb33..91d1eeea0 100644 --- a/src/video/SDL_clipboard.c +++ b/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/src/video/SDL_egl.c b/src/video/SDL_egl.c index 7b1c690ef..bfd4affb9 100644 --- a/src/video/SDL_egl.c +++ b/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/src/video/SDL_egl_c.h b/src/video/SDL_egl_c.h index b46cfca66..c683dffa7 100644 --- a/src/video/SDL_egl_c.h +++ b/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/src/video/SDL_fillrect.c b/src/video/SDL_fillrect.c index 2282d2b19..e34a43c44 100644 --- a/src/video/SDL_fillrect.c +++ b/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/src/video/SDL_pixels.c b/src/video/SDL_pixels.c index 6b96125bb..d905656ca 100644 --- a/src/video/SDL_pixels.c +++ b/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/src/video/SDL_pixels_c.h b/src/video/SDL_pixels_c.h index 3d2deb1a1..4ee91b8a3 100644 --- a/src/video/SDL_pixels_c.h +++ b/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/src/video/SDL_rect.c b/src/video/SDL_rect.c index b22951954..2b29451c7 100644 --- a/src/video/SDL_rect.c +++ b/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/src/video/SDL_rect_c.h b/src/video/SDL_rect_c.h index bc639ae2e..aa5fbde79 100644 --- a/src/video/SDL_rect_c.h +++ b/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/src/video/SDL_shape.c b/src/video/SDL_shape.c index 3309f6dbb..4a2e5465b 100644 --- a/src/video/SDL_shape.c +++ b/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/src/video/SDL_shape_internals.h b/src/video/SDL_shape_internals.h index 4eda9dd11..bdb0ee91b 100644 --- a/src/video/SDL_shape_internals.h +++ b/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/src/video/SDL_stretch.c b/src/video/SDL_stretch.c index d3abaed52..bb34dffb7 100644 --- a/src/video/SDL_stretch.c +++ b/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/src/video/SDL_surface.c b/src/video/SDL_surface.c index ef581fa94..dae07f285 100644 --- a/src/video/SDL_surface.c +++ b/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/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h index 5e3e1526d..77426c3eb 100644 --- a/src/video/SDL_sysvideo.h +++ b/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 diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 7aa0aaaab..511b4c087 100644 --- a/src/video/SDL_video.c +++ b/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 @@ -1125,6 +1125,10 @@ SDL_RestoreMousePosition(SDL_Window *window) } } +#if __WINRT__ +extern Uint32 WINRT_DetectWindowFlags(SDL_Window * window); +#endif + static int SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen) { @@ -1138,9 +1142,17 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen) return 0; #ifdef __MACOSX__ + /* if the window is going away and no resolution change is necessary, + do nothing, or else we may trigger an ugly double-transition + */ + if (window->is_destroying && (window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) + return 0; + /* If we're switching between a fullscreen Space and "normal" fullscreen, we need to get back to normal first. */ if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN)) { - Cocoa_SetWindowFullscreenSpace(window, SDL_FALSE); + if (!Cocoa_SetWindowFullscreenSpace(window, SDL_FALSE)) { + return -1; + } } else if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)) { display = SDL_GetDisplayForWindow(window); SDL_SetDisplayModeForDisplay(display, NULL); @@ -1150,9 +1162,36 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen) } if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) { + if (Cocoa_IsWindowInFullscreenSpace(window) != fullscreen) { + return -1; + } window->last_fullscreen_flags = window->flags; return 0; } +#elif __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10) + /* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen + or not. The user can choose this, via OS-provided UI, but this can't + be set programmatically. + + Just look at what SDL's WinRT video backend code detected with regards + to fullscreen (being active, or not), and figure out a return/error code + from that. + */ + if (fullscreen == !(WINRT_DetectWindowFlags(window) & FULLSCREEN_MASK)) { + /* Uh oh, either: + 1. fullscreen was requested, and we're already windowed + 2. windowed-mode was requested, and we're already fullscreen + + WinRT 8.x can't resolve either programmatically, so we're + giving up. + */ + return -1; + } else { + /* Whatever was requested, fullscreen or windowed mode, is already + in-place. + */ + return 0; + } #endif display = SDL_GetDisplayForWindow(window); @@ -1366,6 +1405,18 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) return NULL; } +#if __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10) + /* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen + or not. The user can choose this, via OS-provided UI, but this can't + be set programmatically. + + Just look at what SDL's WinRT video backend code detected with regards + to fullscreen (being active, or not), and figure out a return/error code + from that. + */ + flags = window->flags; +#endif + if (title) { SDL_SetWindowTitle(window, title); } @@ -1437,6 +1488,7 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags) if (window->surface) { window->surface->flags &= ~SDL_DONTFREE; SDL_FreeSurface(window->surface); + window->surface = NULL; } if (_this->DestroyWindowFramebuffer) { _this->DestroyWindowFramebuffer(_this, window); @@ -1975,6 +2027,7 @@ SDL_RestoreWindow(SDL_Window * window) int SDL_SetWindowFullscreen(SDL_Window * window, Uint32 flags) { + Uint32 oldflags; CHECK_WINDOW_MAGIC(window, -1); flags &= FULLSCREEN_MASK; @@ -1984,10 +2037,17 @@ SDL_SetWindowFullscreen(SDL_Window * window, Uint32 flags) } /* clear the previous flags and OR in the new ones */ + oldflags = window->flags & FULLSCREEN_MASK; window->flags &= ~FULLSCREEN_MASK; window->flags |= flags; - return SDL_UpdateFullscreenMode(window, FULLSCREEN_VISIBLE(window)); + if (SDL_UpdateFullscreenMode(window, FULLSCREEN_VISIBLE(window)) == 0) { + return 0; + } + + window->flags &= ~FULLSCREEN_MASK; + window->flags |= oldflags; + return -1; } static SDL_Surface * @@ -2854,18 +2914,8 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) void (APIENTRY *glGetFramebufferAttachmentParameterivFunc) (GLenum target, GLenum attachment, GLenum pname, GLint* params); GLenum attachment = GL_BACK_LEFT; GLenum attachmentattrib = 0; - - glGetStringFunc = SDL_GL_GetProcAddress("glGetString"); - if (!glGetStringFunc) { - return SDL_SetError("Failed getting OpenGL glGetString entry point"); - } #endif - glGetErrorFunc = SDL_GL_GetProcAddress("glGetError"); - if (!glGetErrorFunc) { - return SDL_SetError("Failed getting OpenGL glGetError entry point"); - } - /* Clear value in any case */ *value = 0; @@ -3036,6 +3086,11 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) } #if SDL_VIDEO_OPENGL + glGetStringFunc = SDL_GL_GetProcAddress("glGetString"); + if (!glGetStringFunc) { + return SDL_SetError("Failed getting OpenGL glGetString entry point"); + } + if (attachmentattrib && isAtLeastGL3((const char *) glGetStringFunc(GL_VERSION))) { glGetFramebufferAttachmentParameterivFunc = SDL_GL_GetProcAddress("glGetFramebufferAttachmentParameteriv"); @@ -3056,6 +3111,11 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) } } + glGetErrorFunc = SDL_GL_GetProcAddress("glGetError"); + if (!glGetErrorFunc) { + return SDL_SetError("Failed getting OpenGL glGetError entry point"); + } + error = glGetErrorFunc(); if (error != GL_NO_ERROR) { if (error == GL_INVALID_ENUM) { diff --git a/src/video/android/SDL_androidclipboard.c b/src/video/android/SDL_androidclipboard.c index 6a4564724..b996e7a40 100644 --- a/src/video/android/SDL_androidclipboard.c +++ b/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/src/video/android/SDL_androidclipboard.h b/src/video/android/SDL_androidclipboard.h index 600771b91..a61045ae8 100644 --- a/src/video/android/SDL_androidclipboard.h +++ b/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/src/video/android/SDL_androidevents.c b/src/video/android/SDL_androidevents.c index f15180a9e..326361af0 100644 --- a/src/video/android/SDL_androidevents.c +++ b/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/src/video/android/SDL_androidevents.h b/src/video/android/SDL_androidevents.h index 888a593c7..4a2230e20 100644 --- a/src/video/android/SDL_androidevents.h +++ b/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/src/video/android/SDL_androidgl.c b/src/video/android/SDL_androidgl.c index 5bf8d1a17..4cfe86357 100644 --- a/src/video/android/SDL_androidgl.c +++ b/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/src/video/android/SDL_androidkeyboard.c b/src/video/android/SDL_androidkeyboard.c index a61235175..dc8951ff9 100644 --- a/src/video/android/SDL_androidkeyboard.c +++ b/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/src/video/android/SDL_androidkeyboard.h b/src/video/android/SDL_androidkeyboard.h index 3f643c305..ced9bc24e 100644 --- a/src/video/android/SDL_androidkeyboard.h +++ b/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/src/video/android/SDL_androidmessagebox.c b/src/video/android/SDL_androidmessagebox.c index 1783b9cd5..61f67636a 100644 --- a/src/video/android/SDL_androidmessagebox.c +++ b/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/src/video/android/SDL_androidmessagebox.h b/src/video/android/SDL_androidmessagebox.h index b732a2a0b..3c680c62f 100644 --- a/src/video/android/SDL_androidmessagebox.h +++ b/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/src/video/android/SDL_androidmouse.c b/src/video/android/SDL_androidmouse.c index 795b2aabf..3e9c0aff5 100644 --- a/src/video/android/SDL_androidmouse.c +++ b/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 diff --git a/src/video/android/SDL_androidmouse.h b/src/video/android/SDL_androidmouse.h index 72b3deb38..9b68eed57 100644 --- a/src/video/android/SDL_androidmouse.h +++ b/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 diff --git a/src/video/android/SDL_androidtouch.c b/src/video/android/SDL_androidtouch.c index b7ba3860f..a6e0b896a 100644 --- a/src/video/android/SDL_androidtouch.c +++ b/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 diff --git a/src/video/android/SDL_androidtouch.h b/src/video/android/SDL_androidtouch.h index 73a934fe3..2ad096ce8 100644 --- a/src/video/android/SDL_androidtouch.h +++ b/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/src/video/android/SDL_androidvideo.c b/src/video/android/SDL_androidvideo.c index 983f3aa30..e14b96641 100644 --- a/src/video/android/SDL_androidvideo.c +++ b/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 diff --git a/src/video/android/SDL_androidvideo.h b/src/video/android/SDL_androidvideo.h index fc6e60e8c..0f76a91b1 100644 --- a/src/video/android/SDL_androidvideo.h +++ b/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/src/video/android/SDL_androidwindow.c b/src/video/android/SDL_androidwindow.c index 46eaeb2a0..37a928faf 100644 --- a/src/video/android/SDL_androidwindow.c +++ b/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/src/video/android/SDL_androidwindow.h b/src/video/android/SDL_androidwindow.h index aa9283bc6..3ac99f42b 100644 --- a/src/video/android/SDL_androidwindow.h +++ b/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/src/video/cocoa/SDL_cocoaclipboard.h b/src/video/cocoa/SDL_cocoaclipboard.h index d86a75ef6..871b394f5 100644 --- a/src/video/cocoa/SDL_cocoaclipboard.h +++ b/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/src/video/cocoa/SDL_cocoaclipboard.m b/src/video/cocoa/SDL_cocoaclipboard.m index 733074457..015d77106 100644 --- a/src/video/cocoa/SDL_cocoaclipboard.m +++ b/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/src/video/cocoa/SDL_cocoaevents.h b/src/video/cocoa/SDL_cocoaevents.h index f92a4a94b..ea40e5317 100644 --- a/src/video/cocoa/SDL_cocoaevents.h +++ b/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/src/video/cocoa/SDL_cocoaevents.m b/src/video/cocoa/SDL_cocoaevents.m index 994da1825..e0da11fd4 100644 --- a/src/video/cocoa/SDL_cocoaevents.m +++ b/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 diff --git a/src/video/cocoa/SDL_cocoakeyboard.h b/src/video/cocoa/SDL_cocoakeyboard.h index e206bd3a6..4f9da0185 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.h +++ b/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/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m index 9abca976a..7f1d2308f 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.m +++ b/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 @@ -24,6 +24,7 @@ #include "SDL_cocoavideo.h" +#include "../../events/SDL_events_c.h" #include "../../events/SDL_keyboard_c.h" #include "../../events/scancodes_darwin.h" @@ -32,25 +33,27 @@ /*#define DEBUG_IME NSLog */ #define DEBUG_IME(...) -@interface SDLTranslatorResponder : NSView { +@interface SDLTranslatorResponder : NSView { NSString *_markedText; NSRange _markedRange; NSRange _selectedRange; SDL_Rect _inputRect; } -- (void) doCommandBySelector:(SEL)myselector; -- (void) setInputRect:(SDL_Rect *) rect; +- (void)doCommandBySelector:(SEL)myselector; +- (void)setInputRect:(SDL_Rect *)rect; @end @implementation SDLTranslatorResponder -- (void) setInputRect:(SDL_Rect *) rect +- (void)setInputRect:(SDL_Rect *)rect { _inputRect = *rect; } -- (void) insertText:(id) aString +- (void)insertText:(id)aString replacementRange:(NSRange)replacementRange { + /* TODO: Make use of replacementRange? */ + const char *str; DEBUG_IME(@"insertText: %@", aString); @@ -66,7 +69,15 @@ - (void) insertText:(id) aString SDL_SendKeyboardText(str); } -- (void) doCommandBySelector:(SEL) myselector +- (void)insertText:(id)insertString +{ + /* This method is part of NSTextInput and not NSTextInputClient, but + * apparently it still might be called in OS X 10.5 and can cause beeps if + * the implementation is missing: http://crbug.com/47890 */ + [self insertText:insertString replacementRange:NSMakeRange(0, 0)]; +} + +- (void)doCommandBySelector:(SEL)myselector { /* No need to do anything since we are not using Cocoa selectors to handle special keys, instead we use SDL @@ -74,23 +85,22 @@ - (void) doCommandBySelector:(SEL) myselector */ } -- (BOOL) hasMarkedText +- (BOOL)hasMarkedText { return _markedText != nil; } -- (NSRange) markedRange +- (NSRange)markedRange { return _markedRange; } -- (NSRange) selectedRange +- (NSRange)selectedRange { return _selectedRange; } -- (void) setMarkedText:(id) aString - selectedRange:(NSRange) selRange +- (void)setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange; { if ([aString isKindOfClass: [NSAttributedString class]]) { aString = [aString string]; @@ -106,17 +116,17 @@ - (void) setMarkedText:(id) aString _markedText = [aString retain]; } - _selectedRange = selRange; + _selectedRange = selectedRange; _markedRange = NSMakeRange(0, [aString length]); SDL_SendEditingText([aString UTF8String], - selRange.location, selRange.length); + selectedRange.location, selectedRange.length); DEBUG_IME(@"setMarkedText: %@, (%d, %d)", _markedText, selRange.location, selRange.length); } -- (void) unmarkText +- (void)unmarkText { [_markedText release]; _markedText = nil; @@ -124,29 +134,38 @@ - (void) unmarkText SDL_SendEditingText("", 0, 0); } -- (NSRect) firstRectForCharacterRange: (NSRange) theRange +- (NSRect)firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange; { NSWindow *window = [self window]; - NSRect contentRect = [window contentRectForFrameRect: [window frame]]; + NSRect contentRect = [window contentRectForFrameRect:[window frame]]; float windowHeight = contentRect.size.height; NSRect rect = NSMakeRect(_inputRect.x, windowHeight - _inputRect.y - _inputRect.h, _inputRect.w, _inputRect.h); + if (actualRange) { + *actualRange = aRange; + } + DEBUG_IME(@"firstRectForCharacterRange: (%d, %d): windowHeight = %g, rect = %@", - theRange.location, theRange.length, windowHeight, + aRange.location, aRange.length, windowHeight, NSStringFromRect(rect)); - rect.origin = [[self window] convertBaseToScreen: rect.origin]; + + if ([[self window] respondsToSelector:@selector(convertRectToScreen:)]) { + rect = [[self window] convertRectToScreen:rect]; + } else { + rect.origin = [[self window] convertBaseToScreen:rect.origin]; + } return rect; } -- (NSAttributedString *) attributedSubstringFromRange: (NSRange) theRange +- (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange; { - DEBUG_IME(@"attributedSubstringFromRange: (%d, %d)", theRange.location, theRange.length); + DEBUG_IME(@"attributedSubstringFromRange: (%d, %d)", aRange.location, aRange.length); return nil; } -- (NSInteger) conversationIdentifier +- (NSInteger)conversationIdentifier { return (NSInteger) self; } @@ -154,7 +173,7 @@ - (NSInteger) conversationIdentifier /* This method returns the index for character that is * nearest to thePoint. thPoint is in screen coordinate system. */ -- (NSUInteger) characterIndexForPoint:(NSPoint) thePoint +- (NSUInteger)characterIndexForPoint:(NSPoint)thePoint { DEBUG_IME(@"characterIndexForPoint: (%g, %g)", thePoint.x, thePoint.y); return 0; @@ -165,7 +184,7 @@ - (NSUInteger) characterIndexForPoint:(NSPoint) thePoint * NSInputServer examines the return value of this * method & constructs appropriate attributed string. */ -- (NSArray *) validAttributesForMarkedText +- (NSArray *)validAttributesForMarkedText { return [NSArray array]; } @@ -478,6 +497,12 @@ - (NSArray *) validAttributesForMarkedText SDL_SetScancodeName(SDL_SCANCODE_LGUI, "Left Command"); SDL_SetScancodeName(SDL_SCANCODE_RALT, "Right Option"); SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Command"); + + /* On pre-10.6, you might have the initial capslock key state wrong. */ + if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_6) { + data->modifierFlags = [NSEvent modifierFlags]; + SDL_ToggleModState(KMOD_CAPS, (data->modifierFlags & NSAlphaShiftKeyMask) != 0); + } } void @@ -503,7 +528,7 @@ - (NSArray *) validAttributesForMarkedText [[SDLTranslatorResponder alloc] initWithFrame: NSMakeRect(0.0, 0.0, 0.0, 0.0)]; } - if (![[data->fieldEdit superview] isEqual: parentView]) { + if (![[data->fieldEdit superview] isEqual:parentView]) { /* DEBUG_IME(@"add fieldEdit to window contentView"); */ [data->fieldEdit removeFromSuperview]; [parentView addSubview: data->fieldEdit]; @@ -534,7 +559,7 @@ - (NSArray *) validAttributesForMarkedText return; } - [data->fieldEdit setInputRect: rect]; + [data->fieldEdit setInputRect:rect]; } void diff --git a/src/video/cocoa/SDL_cocoamessagebox.h b/src/video/cocoa/SDL_cocoamessagebox.h index f9ac0c458..d1ca7882e 100644 --- a/src/video/cocoa/SDL_cocoamessagebox.h +++ b/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/src/video/cocoa/SDL_cocoamessagebox.m b/src/video/cocoa/SDL_cocoamessagebox.m index 0998f7924..ed59e728c 100644 --- a/src/video/cocoa/SDL_cocoamessagebox.m +++ b/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/src/video/cocoa/SDL_cocoamodes.h b/src/video/cocoa/SDL_cocoamodes.h index 57c22ebda..a0a29f501 100644 --- a/src/video/cocoa/SDL_cocoamodes.h +++ b/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 diff --git a/src/video/cocoa/SDL_cocoamodes.m b/src/video/cocoa/SDL_cocoamodes.m index 73b14ed7c..7d98264a7 100644 --- a/src/video/cocoa/SDL_cocoamodes.m +++ b/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 diff --git a/src/video/cocoa/SDL_cocoamouse.h b/src/video/cocoa/SDL_cocoamouse.h index 89e68caae..4f60c8372 100644 --- a/src/video/cocoa/SDL_cocoamouse.h +++ b/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/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m index 625d8f409..c76833123 100644 --- a/src/video/cocoa/SDL_cocoamouse.m +++ b/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/src/video/cocoa/SDL_cocoamousetap.h b/src/video/cocoa/SDL_cocoamousetap.h index f1041b182..af92314b6 100644 --- a/src/video/cocoa/SDL_cocoamousetap.h +++ b/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/src/video/cocoa/SDL_cocoamousetap.m b/src/video/cocoa/SDL_cocoamousetap.m index ca50ff962..ed70f3ca3 100644 --- a/src/video/cocoa/SDL_cocoamousetap.m +++ b/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/src/video/cocoa/SDL_cocoaopengl.h b/src/video/cocoa/SDL_cocoaopengl.h index 6b18af1eb..1f7bd57f0 100644 --- a/src/video/cocoa/SDL_cocoaopengl.h +++ b/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/src/video/cocoa/SDL_cocoaopengl.m b/src/video/cocoa/SDL_cocoaopengl.m index d8e9c901c..aa3609984 100644 --- a/src/video/cocoa/SDL_cocoaopengl.m +++ b/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 diff --git a/src/video/cocoa/SDL_cocoashape.h b/src/video/cocoa/SDL_cocoashape.h index e7fd185d3..f64b59178 100644 --- a/src/video/cocoa/SDL_cocoashape.h +++ b/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/src/video/cocoa/SDL_cocoashape.m b/src/video/cocoa/SDL_cocoashape.m index 1dce56799..cd5d97b70 100644 --- a/src/video/cocoa/SDL_cocoashape.m +++ b/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/src/video/cocoa/SDL_cocoavideo.h b/src/video/cocoa/SDL_cocoavideo.h index 873f2573a..498ce6cca 100644 --- a/src/video/cocoa/SDL_cocoavideo.h +++ b/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/src/video/cocoa/SDL_cocoavideo.m b/src/video/cocoa/SDL_cocoavideo.m index c6b012967..b8f775ddb 100644 --- a/src/video/cocoa/SDL_cocoavideo.m +++ b/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 diff --git a/src/video/cocoa/SDL_cocoawindow.h b/src/video/cocoa/SDL_cocoawindow.h index ed56600f1..1037badfc 100644 --- a/src/video/cocoa/SDL_cocoawindow.h +++ b/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 diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index 1ab5baca0..a4da6cb2d 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/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 @@ -282,6 +282,8 @@ - (void)listen:(SDL_WindowData *)data [center addObserver:self selector:@selector(windowDidEnterFullScreen:) name:NSWindowDidEnterFullScreenNotification object:window]; [center addObserver:self selector:@selector(windowWillExitFullScreen:) name:NSWindowWillExitFullScreenNotification object:window]; [center addObserver:self selector:@selector(windowDidExitFullScreen:) name:NSWindowDidExitFullScreenNotification object:window]; + [center addObserver:self selector:@selector(windowDidFailToEnterFullScreen:) name:@"NSWindowDidFailToEnterFullScreenNotification" object:window]; + [center addObserver:self selector:@selector(windowDidFailToExitFullScreen:) name:@"NSWindowDidFailToExitFullScreenNotification" object:window]; } else { [window setDelegate:self]; } @@ -413,6 +415,8 @@ - (void)close [center removeObserver:self name:NSWindowDidEnterFullScreenNotification object:window]; [center removeObserver:self name:NSWindowWillExitFullScreenNotification object:window]; [center removeObserver:self name:NSWindowDidExitFullScreenNotification object:window]; + [center removeObserver:self name:@"NSWindowDidFailToEnterFullScreenNotification" object:window]; + [center removeObserver:self name:@"NSWindowDidFailToExitFullScreenNotification" object:window]; } else { [window setDelegate:nil]; } @@ -584,6 +588,13 @@ - (void)windowDidBecomeKey:(NSNotification *)aNotification if ((isFullscreenSpace) && ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP)) { [NSMenu setMenuBarVisible:NO]; } + + /* On pre-10.6, you might have the capslock key state wrong now because we can't check here. */ + if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_6) { + const unsigned int newflags = [NSEvent modifierFlags] & NSAlphaShiftKeyMask; + _data->videodata->modifierFlags = (_data->videodata->modifierFlags & ~NSAlphaShiftKeyMask) | newflags; + SDL_ToggleModState(KMOD_CAPS, newflags != 0); + } } - (void)windowDidResignKey:(NSNotification *)aNotification @@ -634,6 +645,22 @@ - (void)windowWillEnterFullScreen:(NSNotification *)aNotification inFullscreenTransition = YES; } +- (void)windowDidFailToEnterFullScreen:(NSNotification *)aNotification +{ + SDL_Window *window = _data->window; + + if (window->is_destroying) { + return; + } + + SetWindowStyle(window, GetWindowStyle(window)); + + isFullscreenSpace = NO; + inFullscreenTransition = NO; + + [self windowDidExitFullScreen:nil]; +} + - (void)windowDidEnterFullScreen:(NSNotification *)aNotification { SDL_Window *window = _data->window; @@ -662,12 +689,31 @@ - (void)windowWillExitFullScreen:(NSNotification *)aNotification { SDL_Window *window = _data->window; - SetWindowStyle(window, GetWindowStyle(window)); + /* As of OS X 10.11, the window seems to need to be resizable when exiting + a Space, in order for it to resize back to its windowed-mode size. + */ + SetWindowStyle(window, GetWindowStyle(window) | NSResizableWindowMask); isFullscreenSpace = NO; inFullscreenTransition = YES; } +- (void)windowDidFailToExitFullScreen:(NSNotification *)aNotification +{ + SDL_Window *window = _data->window; + + if (window->is_destroying) { + return; + } + + SetWindowStyle(window, (NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask)); + + isFullscreenSpace = YES; + inFullscreenTransition = NO; + + [self windowDidEnterFullScreen:nil]; +} + - (void)windowDidExitFullScreen:(NSNotification *)aNotification { SDL_Window *window = _data->window; @@ -675,6 +721,8 @@ - (void)windowDidExitFullScreen:(NSNotification *)aNotification inFullscreenTransition = NO; + SetWindowStyle(window, GetWindowStyle(window)); + [nswindow setLevel:kCGNormalWindowLevel]; if (pendingWindowOperation == PENDING_OPERATION_ENTER_FULLSCREEN) { @@ -775,7 +823,14 @@ - (void)mouseDown:(NSEvent *)theEvent /* Ignore events that aren't inside the client area (i.e. title bar.) */ if ([theEvent window]) { - const NSRect windowRect = [[[theEvent window] contentView] frame]; + NSRect windowRect = [[[theEvent window] contentView] frame]; + + /* add one to size, since NSPointInRect is exclusive of the bottom + edges, which mean it misses the top of the window by one pixel + (as the origin is the bottom left). */ + windowRect.size.width += 1; + windowRect.size.height += 1; + if (!NSPointInRect([theEvent locationInWindow], windowRect)) { return; } @@ -1620,6 +1675,9 @@ - (void)resetCursorRects SDL_WindowData *data = (SDL_WindowData *) window->driverdata; if (data) { + if ([data->listener isInFullscreenSpace]) { + [NSMenu setMenuBarVisible:YES]; + } [data->listener close]; [data->listener release]; if (data->created) { @@ -1674,21 +1732,30 @@ - (void)resetCursorRects SDL_WindowData *data = (SDL_WindowData *) window->driverdata; if ([data->listener setFullscreenSpace:(state ? YES : NO)]) { - succeeded = SDL_TRUE; - - /* Wait for the transition to complete, so application changes - take effect properly (e.g. setting the window size, etc.) - */ - const int limit = 10000; - int count = 0; - while ([data->listener isInFullscreenSpaceTransition]) { - if ( ++count == limit ) { - /* Uh oh, transition isn't completing. Should we assert? */ - break; + const int maxattempts = 3; + int attempt = 0; + while (++attempt <= maxattempts) { + /* Wait for the transition to complete, so application changes + take effect properly (e.g. setting the window size, etc.) + */ + const int limit = 10000; + int count = 0; + while ([data->listener isInFullscreenSpaceTransition]) { + if ( ++count == limit ) { + /* Uh oh, transition isn't completing. Should we assert? */ + break; + } + SDL_Delay(1); + SDL_PumpEvents(); } - SDL_Delay(1); - SDL_PumpEvents(); + if ([data->listener isInFullscreenSpace] == (state ? YES : NO)) + break; + /* Try again, the last attempt was interrupted by user gestures */ + if (![data->listener setFullscreenSpace:(state ? YES : NO)]) + break; /* ??? */ } + /* Return TRUE to prevent non-space fullscreen logic from running */ + succeeded = SDL_TRUE; } return succeeded; diff --git a/src/video/directfb/SDL_DirectFB_WM.c b/src/video/directfb/SDL_DirectFB_WM.c index f6e1dea48..4b979f36c 100644 --- a/src/video/directfb/SDL_DirectFB_WM.c +++ b/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/src/video/directfb/SDL_DirectFB_WM.h b/src/video/directfb/SDL_DirectFB_WM.h index 828bd9528..f5f9a46fd 100644 --- a/src/video/directfb/SDL_DirectFB_WM.h +++ b/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/src/video/directfb/SDL_DirectFB_dyn.c b/src/video/directfb/SDL_DirectFB_dyn.c index 4dfd08c1e..52a4b5367 100644 --- a/src/video/directfb/SDL_DirectFB_dyn.c +++ b/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/src/video/directfb/SDL_DirectFB_dyn.h b/src/video/directfb/SDL_DirectFB_dyn.h index 81d2b163d..bd99a3faf 100644 --- a/src/video/directfb/SDL_DirectFB_dyn.h +++ b/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/src/video/directfb/SDL_DirectFB_events.c b/src/video/directfb/SDL_DirectFB_events.c index 8508f2a99..0bf9fdba5 100644 --- a/src/video/directfb/SDL_DirectFB_events.c +++ b/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/src/video/directfb/SDL_DirectFB_events.h b/src/video/directfb/SDL_DirectFB_events.h index fe205d1de..2931ad2a1 100644 --- a/src/video/directfb/SDL_DirectFB_events.h +++ b/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/src/video/directfb/SDL_DirectFB_modes.c b/src/video/directfb/SDL_DirectFB_modes.c index ab13b7ee7..9d0abf560 100644 --- a/src/video/directfb/SDL_DirectFB_modes.c +++ b/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/src/video/directfb/SDL_DirectFB_modes.h b/src/video/directfb/SDL_DirectFB_modes.h index c847f1821..9911eff56 100644 --- a/src/video/directfb/SDL_DirectFB_modes.h +++ b/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/src/video/directfb/SDL_DirectFB_mouse.c b/src/video/directfb/SDL_DirectFB_mouse.c index caa9eeec3..0657d2f06 100644 --- a/src/video/directfb/SDL_DirectFB_mouse.c +++ b/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/src/video/directfb/SDL_DirectFB_mouse.h b/src/video/directfb/SDL_DirectFB_mouse.h index 3f62c01bf..4e2f27a92 100644 --- a/src/video/directfb/SDL_DirectFB_mouse.h +++ b/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/src/video/directfb/SDL_DirectFB_opengl.c b/src/video/directfb/SDL_DirectFB_opengl.c index edddd32cd..065854a08 100644 --- a/src/video/directfb/SDL_DirectFB_opengl.c +++ b/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/src/video/directfb/SDL_DirectFB_opengl.h b/src/video/directfb/SDL_DirectFB_opengl.h index 454aa249d..6391ee4f3 100644 --- a/src/video/directfb/SDL_DirectFB_opengl.h +++ b/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/src/video/directfb/SDL_DirectFB_render.c b/src/video/directfb/SDL_DirectFB_render.c index 003e4a772..4a1bf46b8 100644 --- a/src/video/directfb/SDL_DirectFB_render.c +++ b/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/src/video/directfb/SDL_DirectFB_render.h b/src/video/directfb/SDL_DirectFB_render.h index 0cd4bd321..be016b084 100644 --- a/src/video/directfb/SDL_DirectFB_render.h +++ b/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/src/video/directfb/SDL_DirectFB_shape.c b/src/video/directfb/SDL_DirectFB_shape.c index 4c5715723..3239e3021 100644 --- a/src/video/directfb/SDL_DirectFB_shape.c +++ b/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/src/video/directfb/SDL_DirectFB_shape.h b/src/video/directfb/SDL_DirectFB_shape.h index 27304712b..46be39fbf 100644 --- a/src/video/directfb/SDL_DirectFB_shape.h +++ b/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/src/video/directfb/SDL_DirectFB_video.c b/src/video/directfb/SDL_DirectFB_video.c index dbf890be0..5579759eb 100644 --- a/src/video/directfb/SDL_DirectFB_video.c +++ b/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 diff --git a/src/video/directfb/SDL_DirectFB_video.h b/src/video/directfb/SDL_DirectFB_video.h index b722bbd9f..b36ace0dd 100644 --- a/src/video/directfb/SDL_DirectFB_video.h +++ b/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/src/video/directfb/SDL_DirectFB_window.c b/src/video/directfb/SDL_DirectFB_window.c index b8a94b45a..3b8b45d44 100644 --- a/src/video/directfb/SDL_DirectFB_window.c +++ b/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 diff --git a/src/video/directfb/SDL_DirectFB_window.h b/src/video/directfb/SDL_DirectFB_window.h index 9290abcdc..658cc8749 100644 --- a/src/video/directfb/SDL_DirectFB_window.h +++ b/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 diff --git a/src/video/dummy/SDL_nullevents.c b/src/video/dummy/SDL_nullevents.c index d7df0dcbe..a5a944304 100644 --- a/src/video/dummy/SDL_nullevents.c +++ b/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/src/video/dummy/SDL_nullevents_c.h b/src/video/dummy/SDL_nullevents_c.h index 211684644..d2f78698d 100644 --- a/src/video/dummy/SDL_nullevents_c.h +++ b/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/src/video/dummy/SDL_nullframebuffer.c b/src/video/dummy/SDL_nullframebuffer.c index 74eeb3101..01c8a5abb 100644 --- a/src/video/dummy/SDL_nullframebuffer.c +++ b/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/src/video/dummy/SDL_nullframebuffer_c.h b/src/video/dummy/SDL_nullframebuffer_c.h index f75c70e82..37d198f90 100644 --- a/src/video/dummy/SDL_nullframebuffer_c.h +++ b/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/src/video/dummy/SDL_nullvideo.c b/src/video/dummy/SDL_nullvideo.c index 96cee9213..96f47813a 100644 --- a/src/video/dummy/SDL_nullvideo.c +++ b/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/src/video/dummy/SDL_nullvideo.h b/src/video/dummy/SDL_nullvideo.h index 90ed3bc81..0126ba183 100644 --- a/src/video/dummy/SDL_nullvideo.h +++ b/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/src/video/emscripten/SDL_emscriptenevents.c b/src/video/emscripten/SDL_emscriptenevents.c index 79fa310f8..0f915c6f3 100644 --- a/src/video/emscripten/SDL_emscriptenevents.c +++ b/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/src/video/emscripten/SDL_emscriptenevents.h b/src/video/emscripten/SDL_emscriptenevents.h index ea5c3f5b3..d5b65f854 100644 --- a/src/video/emscripten/SDL_emscriptenevents.h +++ b/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/src/video/emscripten/SDL_emscriptenframebuffer.c b/src/video/emscripten/SDL_emscriptenframebuffer.c index a8f927e57..a26e23ae6 100644 --- a/src/video/emscripten/SDL_emscriptenframebuffer.c +++ b/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/src/video/emscripten/SDL_emscriptenframebuffer.h b/src/video/emscripten/SDL_emscriptenframebuffer.h index 01ed37d1c..b2a6d3b37 100644 --- a/src/video/emscripten/SDL_emscriptenframebuffer.h +++ b/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/src/video/emscripten/SDL_emscriptenmouse.c b/src/video/emscripten/SDL_emscriptenmouse.c index 5748d1c2e..2a68dd95c 100644 --- a/src/video/emscripten/SDL_emscriptenmouse.c +++ b/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 diff --git a/src/video/emscripten/SDL_emscriptenmouse.h b/src/video/emscripten/SDL_emscriptenmouse.h index 1d5d2e9e6..76ea849ed 100644 --- a/src/video/emscripten/SDL_emscriptenmouse.h +++ b/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/src/video/emscripten/SDL_emscriptenopengles.c b/src/video/emscripten/SDL_emscriptenopengles.c index 6e9624d76..12a37c604 100644 --- a/src/video/emscripten/SDL_emscriptenopengles.c +++ b/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/src/video/emscripten/SDL_emscriptenopengles.h b/src/video/emscripten/SDL_emscriptenopengles.h index 9c356854f..edafed822 100644 --- a/src/video/emscripten/SDL_emscriptenopengles.h +++ b/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/src/video/emscripten/SDL_emscriptenvideo.c b/src/video/emscripten/SDL_emscriptenvideo.c index 4ce0a036b..302ca8793 100644 --- a/src/video/emscripten/SDL_emscriptenvideo.c +++ b/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/src/video/emscripten/SDL_emscriptenvideo.h b/src/video/emscripten/SDL_emscriptenvideo.h index 519e3fc3e..e824de34f 100644 --- a/src/video/emscripten/SDL_emscriptenvideo.h +++ b/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/src/video/haiku/SDL_BWin.h b/src/video/haiku/SDL_BWin.h index b4e347d04..dade664c3 100644 --- a/src/video/haiku/SDL_BWin.h +++ b/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/src/video/haiku/SDL_bclipboard.cc b/src/video/haiku/SDL_bclipboard.cc index 1a10b6bfe..fcd1caa26 100644 --- a/src/video/haiku/SDL_bclipboard.cc +++ b/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/src/video/haiku/SDL_bclipboard.h b/src/video/haiku/SDL_bclipboard.h index 654c6c59e..dd31f19a5 100644 --- a/src/video/haiku/SDL_bclipboard.h +++ b/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/src/video/haiku/SDL_bevents.cc b/src/video/haiku/SDL_bevents.cc index ec7d01251..36513a3b2 100644 --- a/src/video/haiku/SDL_bevents.cc +++ b/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/src/video/haiku/SDL_bevents.h b/src/video/haiku/SDL_bevents.h index ffb9ba5ea..cb756c967 100644 --- a/src/video/haiku/SDL_bevents.h +++ b/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/src/video/haiku/SDL_bframebuffer.cc b/src/video/haiku/SDL_bframebuffer.cc index 3eb835b2f..5e6a300e8 100644 --- a/src/video/haiku/SDL_bframebuffer.cc +++ b/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/src/video/haiku/SDL_bframebuffer.h b/src/video/haiku/SDL_bframebuffer.h index f3fbd96fc..d6be21f4d 100644 --- a/src/video/haiku/SDL_bframebuffer.h +++ b/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/src/video/haiku/SDL_bkeyboard.cc b/src/video/haiku/SDL_bkeyboard.cc index e12d30ba2..0ae3d3fc1 100644 --- a/src/video/haiku/SDL_bkeyboard.cc +++ b/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/src/video/haiku/SDL_bkeyboard.h b/src/video/haiku/SDL_bkeyboard.h index edf7643de..632799421 100644 --- a/src/video/haiku/SDL_bkeyboard.h +++ b/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/src/video/haiku/SDL_bmodes.cc b/src/video/haiku/SDL_bmodes.cc index c5da410fd..84aeb1f07 100644 --- a/src/video/haiku/SDL_bmodes.cc +++ b/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/src/video/haiku/SDL_bmodes.h b/src/video/haiku/SDL_bmodes.h index e73c090e2..c3882ba58 100644 --- a/src/video/haiku/SDL_bmodes.h +++ b/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/src/video/haiku/SDL_bopengl.cc b/src/video/haiku/SDL_bopengl.cc index 258699929..15454f100 100644 --- a/src/video/haiku/SDL_bopengl.cc +++ b/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/src/video/haiku/SDL_bopengl.h b/src/video/haiku/SDL_bopengl.h index e325687f7..e7d475dfb 100644 --- a/src/video/haiku/SDL_bopengl.h +++ b/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/src/video/haiku/SDL_bvideo.cc b/src/video/haiku/SDL_bvideo.cc index 9fe24d347..8c243b7a0 100644 --- a/src/video/haiku/SDL_bvideo.cc +++ b/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/src/video/haiku/SDL_bvideo.h b/src/video/haiku/SDL_bvideo.h index 72292d00d..ef5c74032 100644 --- a/src/video/haiku/SDL_bvideo.h +++ b/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/src/video/haiku/SDL_bwindow.cc b/src/video/haiku/SDL_bwindow.cc index dc3ddb5df..287eac965 100644 --- a/src/video/haiku/SDL_bwindow.cc +++ b/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/src/video/haiku/SDL_bwindow.h b/src/video/haiku/SDL_bwindow.h index e1c59134f..f64530ab7 100644 --- a/src/video/haiku/SDL_bwindow.h +++ b/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/src/video/mir/SDL_mirdyn.c b/src/video/mir/SDL_mirdyn.c index ffb1e9e23..f9dfc0395 100644 --- a/src/video/mir/SDL_mirdyn.c +++ b/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 diff --git a/src/video/mir/SDL_mirdyn.h b/src/video/mir/SDL_mirdyn.h index 1dadfc6d6..48bf489c6 100644 --- a/src/video/mir/SDL_mirdyn.h +++ b/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 diff --git a/src/video/mir/SDL_mirevents.c b/src/video/mir/SDL_mirevents.c index 8ff2cb3a4..708f8ffde 100644 --- a/src/video/mir/SDL_mirevents.c +++ b/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 diff --git a/src/video/mir/SDL_mirevents.h b/src/video/mir/SDL_mirevents.h index 8caabc8a6..3e0d96625 100644 --- a/src/video/mir/SDL_mirevents.h +++ b/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 diff --git a/src/video/mir/SDL_mirframebuffer.c b/src/video/mir/SDL_mirframebuffer.c index d1821cc44..53e6056ff 100644 --- a/src/video/mir/SDL_mirframebuffer.c +++ b/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 diff --git a/src/video/mir/SDL_mirframebuffer.h b/src/video/mir/SDL_mirframebuffer.h index 328fb23dd..22a579c03 100644 --- a/src/video/mir/SDL_mirframebuffer.h +++ b/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/src/video/mir/SDL_mirmouse.c b/src/video/mir/SDL_mirmouse.c index 740ac20ef..bb8dc6c4e 100644 --- a/src/video/mir/SDL_mirmouse.c +++ b/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 diff --git a/src/video/mir/SDL_mirmouse.h b/src/video/mir/SDL_mirmouse.h index 700cc6998..94dd08561 100644 --- a/src/video/mir/SDL_mirmouse.h +++ b/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/src/video/mir/SDL_miropengl.c b/src/video/mir/SDL_miropengl.c index b7c7ae80a..23fabb267 100644 --- a/src/video/mir/SDL_miropengl.c +++ b/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/src/video/mir/SDL_miropengl.h b/src/video/mir/SDL_miropengl.h index 5a04ac8a1..96bb40a6d 100644 --- a/src/video/mir/SDL_miropengl.h +++ b/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/src/video/mir/SDL_mirsym.h b/src/video/mir/SDL_mirsym.h index 415df0c94..d0aaf70a3 100644 --- a/src/video/mir/SDL_mirsym.h +++ b/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 diff --git a/src/video/mir/SDL_mirvideo.c b/src/video/mir/SDL_mirvideo.c index 176e9a128..b6160fd92 100644 --- a/src/video/mir/SDL_mirvideo.c +++ b/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 diff --git a/src/video/mir/SDL_mirvideo.h b/src/video/mir/SDL_mirvideo.h index 8db90b522..c5ef4758d 100644 --- a/src/video/mir/SDL_mirvideo.h +++ b/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 diff --git a/src/video/mir/SDL_mirwindow.c b/src/video/mir/SDL_mirwindow.c index 513dbe24d..0eb54be01 100644 --- a/src/video/mir/SDL_mirwindow.c +++ b/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 diff --git a/src/video/mir/SDL_mirwindow.h b/src/video/mir/SDL_mirwindow.h index 577dfa417..c21fc9292 100644 --- a/src/video/mir/SDL_mirwindow.h +++ b/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 diff --git a/src/video/nacl/SDL_naclevents.c b/src/video/nacl/SDL_naclevents.c index c552abb80..d6ebbdf87 100644 --- a/src/video/nacl/SDL_naclevents.c +++ b/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/src/video/nacl/SDL_naclevents_c.h b/src/video/nacl/SDL_naclevents_c.h index 5fa6f9914..3255578c3 100644 --- a/src/video/nacl/SDL_naclevents_c.h +++ b/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/src/video/nacl/SDL_naclglue.c b/src/video/nacl/SDL_naclglue.c index 127494e9e..79f5b0f90 100644 --- a/src/video/nacl/SDL_naclglue.c +++ b/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/src/video/nacl/SDL_naclopengles.c b/src/video/nacl/SDL_naclopengles.c index 349d4bbd6..e11245135 100644 --- a/src/video/nacl/SDL_naclopengles.c +++ b/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/src/video/nacl/SDL_naclopengles.h b/src/video/nacl/SDL_naclopengles.h index bcbca7db4..1845e8191 100644 --- a/src/video/nacl/SDL_naclopengles.h +++ b/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/src/video/nacl/SDL_naclvideo.c b/src/video/nacl/SDL_naclvideo.c index e9d014c85..467155c67 100644 --- a/src/video/nacl/SDL_naclvideo.c +++ b/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/src/video/nacl/SDL_naclvideo.h b/src/video/nacl/SDL_naclvideo.h index d9dc16303..174a6e77c 100644 --- a/src/video/nacl/SDL_naclvideo.h +++ b/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/src/video/nacl/SDL_naclwindow.c b/src/video/nacl/SDL_naclwindow.c index 73c703370..32d1e6d7e 100644 --- a/src/video/nacl/SDL_naclwindow.c +++ b/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/src/video/nacl/SDL_naclwindow.h b/src/video/nacl/SDL_naclwindow.h index 3d6f375b9..617bfc3ab 100644 --- a/src/video/nacl/SDL_naclwindow.h +++ b/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/src/video/pandora/SDL_pandora.c b/src/video/pandora/SDL_pandora.c index 2a0f4dcc3..d1c35a705 100644 --- a/src/video/pandora/SDL_pandora.c +++ b/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/src/video/pandora/SDL_pandora.h b/src/video/pandora/SDL_pandora.h index 2dbbb2a95..b95cd10b1 100644 --- a/src/video/pandora/SDL_pandora.h +++ b/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/src/video/pandora/SDL_pandora_events.c b/src/video/pandora/SDL_pandora_events.c index f42e0b715..d22d0c759 100644 --- a/src/video/pandora/SDL_pandora_events.c +++ b/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/src/video/pandora/SDL_pandora_events.h b/src/video/pandora/SDL_pandora_events.h index c43137798..e9f8d7cfa 100644 --- a/src/video/pandora/SDL_pandora_events.h +++ b/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/src/video/psp/SDL_pspevents.c b/src/video/psp/SDL_pspevents.c index 7117b50ad..c1a095dbb 100644 --- a/src/video/psp/SDL_pspevents.c +++ b/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/src/video/psp/SDL_pspevents_c.h b/src/video/psp/SDL_pspevents_c.h index 9e24b6ba1..e1929d237 100644 --- a/src/video/psp/SDL_pspevents_c.h +++ b/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/src/video/psp/SDL_pspgl.c b/src/video/psp/SDL_pspgl.c index f0fa7c3fd..e4f81e9ee 100644 --- a/src/video/psp/SDL_pspgl.c +++ b/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/src/video/psp/SDL_pspgl_c.h b/src/video/psp/SDL_pspgl_c.h index 03b7a8c24..308b02729 100644 --- a/src/video/psp/SDL_pspgl_c.h +++ b/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/src/video/psp/SDL_pspmouse.c b/src/video/psp/SDL_pspmouse.c index 14c69dee2..b7c3d2b99 100644 --- a/src/video/psp/SDL_pspmouse.c +++ b/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/src/video/psp/SDL_pspmouse_c.h b/src/video/psp/SDL_pspmouse_c.h index de5ff4ef9..2a3df68ef 100644 --- a/src/video/psp/SDL_pspmouse_c.h +++ b/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/src/video/psp/SDL_pspvideo.c b/src/video/psp/SDL_pspvideo.c index cfcf0cfff..955666877 100644 --- a/src/video/psp/SDL_pspvideo.c +++ b/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/src/video/psp/SDL_pspvideo.h b/src/video/psp/SDL_pspvideo.h index e468c2ddf..f5705a944 100644 --- a/src/video/psp/SDL_pspvideo.h +++ b/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/src/video/raspberry/SDL_rpievents.c b/src/video/raspberry/SDL_rpievents.c index 12760a865..4104568cc 100644 --- a/src/video/raspberry/SDL_rpievents.c +++ b/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/src/video/raspberry/SDL_rpievents_c.h b/src/video/raspberry/SDL_rpievents_c.h index adc2fdd7c..54fc196e4 100644 --- a/src/video/raspberry/SDL_rpievents_c.h +++ b/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/src/video/raspberry/SDL_rpimouse.c b/src/video/raspberry/SDL_rpimouse.c index f8ee4ec61..0d1482c04 100644 --- a/src/video/raspberry/SDL_rpimouse.c +++ b/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 diff --git a/src/video/raspberry/SDL_rpimouse.h b/src/video/raspberry/SDL_rpimouse.h index db8df76f4..6a4e70511 100644 --- a/src/video/raspberry/SDL_rpimouse.h +++ b/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/src/video/raspberry/SDL_rpiopengles.c b/src/video/raspberry/SDL_rpiopengles.c index 4809c9255..0881dbde8 100644 --- a/src/video/raspberry/SDL_rpiopengles.c +++ b/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/src/video/raspberry/SDL_rpiopengles.h b/src/video/raspberry/SDL_rpiopengles.h index 5dda45d57..83c800067 100644 --- a/src/video/raspberry/SDL_rpiopengles.h +++ b/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/src/video/raspberry/SDL_rpivideo.c b/src/video/raspberry/SDL_rpivideo.c index fae9143b6..539c88c9b 100644 --- a/src/video/raspberry/SDL_rpivideo.c +++ b/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/src/video/raspberry/SDL_rpivideo.h b/src/video/raspberry/SDL_rpivideo.h index 648254c8e..74dcf9414 100644 --- a/src/video/raspberry/SDL_rpivideo.h +++ b/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/src/video/sdlgenblit.pl b/src/video/sdlgenblit.pl index 202c6c228..9ebffafc4 100755 --- a/src/video/sdlgenblit.pl +++ b/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/src/video/uikit/SDL_uikitappdelegate.h b/src/video/uikit/SDL_uikitappdelegate.h index 9f3c98541..1879f0b3a 100644 --- a/src/video/uikit/SDL_uikitappdelegate.h +++ b/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/src/video/uikit/SDL_uikitappdelegate.m b/src/video/uikit/SDL_uikitappdelegate.m index 5d63019ec..971b438b0 100644 --- a/src/video/uikit/SDL_uikitappdelegate.m +++ b/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 diff --git a/src/video/uikit/SDL_uikitevents.h b/src/video/uikit/SDL_uikitevents.h index 63eeb955f..9b1d60c59 100644 --- a/src/video/uikit/SDL_uikitevents.h +++ b/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/src/video/uikit/SDL_uikitevents.m b/src/video/uikit/SDL_uikitevents.m index d4d6fcc4e..1d7044d88 100644 --- a/src/video/uikit/SDL_uikitevents.m +++ b/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/src/video/uikit/SDL_uikitmessagebox.h b/src/video/uikit/SDL_uikitmessagebox.h index 2f38ac0d4..528072413 100644 --- a/src/video/uikit/SDL_uikitmessagebox.h +++ b/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/src/video/uikit/SDL_uikitmessagebox.m b/src/video/uikit/SDL_uikitmessagebox.m index 6c980d472..5778032a0 100644 --- a/src/video/uikit/SDL_uikitmessagebox.m +++ b/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/src/video/uikit/SDL_uikitmodes.h b/src/video/uikit/SDL_uikitmodes.h index 86bf3b2ea..027cf7aa0 100644 --- a/src/video/uikit/SDL_uikitmodes.h +++ b/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 diff --git a/src/video/uikit/SDL_uikitmodes.m b/src/video/uikit/SDL_uikitmodes.m index afe6a957d..98d031484 100644 --- a/src/video/uikit/SDL_uikitmodes.m +++ b/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 diff --git a/src/video/uikit/SDL_uikitopengles.h b/src/video/uikit/SDL_uikitopengles.h index aa6bc75d0..10697610d 100644 --- a/src/video/uikit/SDL_uikitopengles.h +++ b/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/src/video/uikit/SDL_uikitopengles.m b/src/video/uikit/SDL_uikitopengles.m index ef901247f..a2ea4ab67 100644 --- a/src/video/uikit/SDL_uikitopengles.m +++ b/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/src/video/uikit/SDL_uikitopenglview.h b/src/video/uikit/SDL_uikitopenglview.h index c710813de..86fb5e12e 100644 --- a/src/video/uikit/SDL_uikitopenglview.h +++ b/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/src/video/uikit/SDL_uikitopenglview.m b/src/video/uikit/SDL_uikitopenglview.m index acfdb28f8..60c247e6a 100644 --- a/src/video/uikit/SDL_uikitopenglview.m +++ b/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/src/video/uikit/SDL_uikitvideo.h b/src/video/uikit/SDL_uikitvideo.h index 5eacd8078..3fbaf92f1 100644 --- a/src/video/uikit/SDL_uikitvideo.h +++ b/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 diff --git a/src/video/uikit/SDL_uikitvideo.m b/src/video/uikit/SDL_uikitvideo.m index 3847de71e..4f3c7dc43 100644 --- a/src/video/uikit/SDL_uikitvideo.m +++ b/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 diff --git a/src/video/uikit/SDL_uikitview.h b/src/video/uikit/SDL_uikitview.h index 00be76574..18fa78f36 100644 --- a/src/video/uikit/SDL_uikitview.h +++ b/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/src/video/uikit/SDL_uikitview.m b/src/video/uikit/SDL_uikitview.m index 4372cc20d..1ccda98ff 100644 --- a/src/video/uikit/SDL_uikitview.m +++ b/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/src/video/uikit/SDL_uikitviewcontroller.h b/src/video/uikit/SDL_uikitviewcontroller.h index e8462b8e2..c78396802 100644 --- a/src/video/uikit/SDL_uikitviewcontroller.h +++ b/src/video/uikit/SDL_uikitviewcontroller.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2015 Sam Lantinga + Copyright (C) 1997-2016 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/video/uikit/SDL_uikitviewcontroller.m b/src/video/uikit/SDL_uikitviewcontroller.m index 112638eb2..58cdf1ac5 100644 --- a/src/video/uikit/SDL_uikitviewcontroller.m +++ b/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/src/video/uikit/SDL_uikitwindow.h b/src/video/uikit/SDL_uikitwindow.h index 987bbe01d..ed08c55d4 100644 --- a/src/video/uikit/SDL_uikitwindow.h +++ b/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/src/video/uikit/SDL_uikitwindow.m b/src/video/uikit/SDL_uikitwindow.m index 3e26113dc..c5f385b8c 100644 --- a/src/video/uikit/SDL_uikitwindow.m +++ b/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 @@ -316,6 +316,13 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo for (SDL_uikitview *view in views) { [view setSDLWindow:NULL]; } + + /* iOS may still hold a reference to the window after we release it. + * We want to make sure the SDL view controller isn't accessed in + * that case, because it would contain an invalid pointer to the old + * SDL window. */ + data.uiwindow.rootViewController = nil; + data.uiwindow.hidden = YES; } } window->driverdata = NULL; diff --git a/src/video/uikit/keyinfotable.h b/src/video/uikit/keyinfotable.h index 22a79dceb..962dbd922 100644 --- a/src/video/uikit/keyinfotable.h +++ b/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/src/video/vivante/SDL_vivanteopengles.c b/src/video/vivante/SDL_vivanteopengles.c index 96d2f89dd..687cc6a73 100644 --- a/src/video/vivante/SDL_vivanteopengles.c +++ b/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/src/video/vivante/SDL_vivanteopengles.h b/src/video/vivante/SDL_vivanteopengles.h index b7b618030..f47bf7797 100644 --- a/src/video/vivante/SDL_vivanteopengles.h +++ b/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/src/video/vivante/SDL_vivanteplatform.c b/src/video/vivante/SDL_vivanteplatform.c index 40579dfab..76233417e 100644 --- a/src/video/vivante/SDL_vivanteplatform.c +++ b/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/src/video/vivante/SDL_vivanteplatform.h b/src/video/vivante/SDL_vivanteplatform.h index b8376283a..6e11cce62 100644 --- a/src/video/vivante/SDL_vivanteplatform.h +++ b/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/src/video/vivante/SDL_vivantevideo.c b/src/video/vivante/SDL_vivantevideo.c index 8095cb588..fe4ea089d 100644 --- a/src/video/vivante/SDL_vivantevideo.c +++ b/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 diff --git a/src/video/vivante/SDL_vivantevideo.h b/src/video/vivante/SDL_vivantevideo.h index 030516bd1..b99c73375 100644 --- a/src/video/vivante/SDL_vivantevideo.h +++ b/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/src/video/wayland/SDL_waylanddyn.c b/src/video/wayland/SDL_waylanddyn.c index edf6e2195..bc1d06e46 100644 --- a/src/video/wayland/SDL_waylanddyn.c +++ b/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 diff --git a/src/video/wayland/SDL_waylanddyn.h b/src/video/wayland/SDL_waylanddyn.h index 19fd4558e..b3ff9d8e9 100644 --- a/src/video/wayland/SDL_waylanddyn.h +++ b/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 diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index face9d64b..53b0ac907 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/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 diff --git a/src/video/wayland/SDL_waylandevents_c.h b/src/video/wayland/SDL_waylandevents_c.h index 5a914e908..62b163bf6 100644 --- a/src/video/wayland/SDL_waylandevents_c.h +++ b/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/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c index 2d78ebb95..b810f7784 100644 --- a/src/video/wayland/SDL_waylandmouse.c +++ b/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 diff --git a/src/video/wayland/SDL_waylandmouse.h b/src/video/wayland/SDL_waylandmouse.h index 3a914a28b..129990ded 100644 --- a/src/video/wayland/SDL_waylandmouse.h +++ b/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/src/video/wayland/SDL_waylandopengles.c b/src/video/wayland/SDL_waylandopengles.c index ca301e57a..6803dbe63 100644 --- a/src/video/wayland/SDL_waylandopengles.c +++ b/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/src/video/wayland/SDL_waylandopengles.h b/src/video/wayland/SDL_waylandopengles.h index 42c13f84c..6c3f1f384 100644 --- a/src/video/wayland/SDL_waylandopengles.h +++ b/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/src/video/wayland/SDL_waylandsym.h b/src/video/wayland/SDL_waylandsym.h index edac091f4..b093d9db1 100644 --- a/src/video/wayland/SDL_waylandsym.h +++ b/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 diff --git a/src/video/wayland/SDL_waylandtouch.c b/src/video/wayland/SDL_waylandtouch.c index 3aa8828d2..4cae42594 100644 --- a/src/video/wayland/SDL_waylandtouch.c +++ b/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/src/video/wayland/SDL_waylandtouch.h b/src/video/wayland/SDL_waylandtouch.h index 8c0d20366..5f2a05813 100644 --- a/src/video/wayland/SDL_waylandtouch.h +++ b/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/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index f509ddc1b..b47ec29be 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/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 diff --git a/src/video/wayland/SDL_waylandvideo.h b/src/video/wayland/SDL_waylandvideo.h index 6dc736a20..8111bf153 100644 --- a/src/video/wayland/SDL_waylandvideo.h +++ b/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 diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index e105408ac..b59759a7c 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/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/src/video/wayland/SDL_waylandwindow.h b/src/video/wayland/SDL_waylandwindow.h index e2bed5462..053b1281f 100644 --- a/src/video/wayland/SDL_waylandwindow.h +++ b/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/src/video/windows/SDL_msctf.h b/src/video/windows/SDL_msctf.h index c2368d7ac..74e22f107 100644 --- a/src/video/windows/SDL_msctf.h +++ b/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/src/video/windows/SDL_vkeys.h b/src/video/windows/SDL_vkeys.h index 4c3d390de..fd6520419 100644 --- a/src/video/windows/SDL_vkeys.h +++ b/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/src/video/windows/SDL_windowsclipboard.c b/src/video/windows/SDL_windowsclipboard.c index d93eceed1..b57a66a7b 100644 --- a/src/video/windows/SDL_windowsclipboard.c +++ b/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/src/video/windows/SDL_windowsclipboard.h b/src/video/windows/SDL_windowsclipboard.h index 3b5e62b46..d86cd97ec 100644 --- a/src/video/windows/SDL_windowsclipboard.h +++ b/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/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index 3ce8291df..61420894f 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/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 @@ -415,12 +415,19 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) * FIXME: Update keyboard state */ WIN_CheckClipboardUpdate(data->videodata); + + SDL_ToggleModState(KMOD_CAPS, (GetKeyState(VK_CAPITAL) & 0x0001) != 0); + SDL_ToggleModState(KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) != 0); } else { + data->in_window_deactivation = SDL_TRUE; + if (SDL_GetKeyboardFocus() == data->window) { SDL_SetKeyboardFocus(NULL); } ClipCursor(NULL); + + data->in_window_deactivation = SDL_FALSE; } } returnCode = 0; diff --git a/src/video/windows/SDL_windowsevents.h b/src/video/windows/SDL_windowsevents.h index 3e923aaba..dcd3118a4 100644 --- a/src/video/windows/SDL_windowsevents.h +++ b/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/src/video/windows/SDL_windowsframebuffer.c b/src/video/windows/SDL_windowsframebuffer.c index d92a5a1b9..7bb07ed2e 100644 --- a/src/video/windows/SDL_windowsframebuffer.c +++ b/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 @@ -42,6 +42,9 @@ int WIN_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, voi /* Find out the format of the screen */ size = sizeof(BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD); info = (LPBITMAPINFO)SDL_stack_alloc(Uint8, size); + if (!info) { + return SDL_OutOfMemory(); + } SDL_memset(info, 0, size); info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); diff --git a/src/video/windows/SDL_windowsframebuffer.h b/src/video/windows/SDL_windowsframebuffer.h index ed6837bab..0c825f9da 100644 --- a/src/video/windows/SDL_windowsframebuffer.h +++ b/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/src/video/windows/SDL_windowskeyboard.c b/src/video/windows/SDL_windowskeyboard.c index d56f4042a..d3e16c8bf 100644 --- a/src/video/windows/SDL_windowskeyboard.c +++ b/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 @@ -102,6 +102,10 @@ WIN_InitKeyboard(_THIS) SDL_SetScancodeName(SDL_SCANCODE_APPLICATION, "Menu"); SDL_SetScancodeName(SDL_SCANCODE_LGUI, "Left Windows"); SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Windows"); + + /* Are system caps/num/scroll lock active? Set our state to match. */ + SDL_ToggleModState(KMOD_CAPS, (GetKeyState(VK_CAPITAL) & 0x0001) != 0); + SDL_ToggleModState(KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) != 0); } void diff --git a/src/video/windows/SDL_windowskeyboard.h b/src/video/windows/SDL_windowskeyboard.h index 5967b5114..d330d3871 100644 --- a/src/video/windows/SDL_windowskeyboard.h +++ b/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/src/video/windows/SDL_windowsmessagebox.c b/src/video/windows/SDL_windowsmessagebox.c index ac4a3a5a5..b39df32fc 100644 --- a/src/video/windows/SDL_windowsmessagebox.c +++ b/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/src/video/windows/SDL_windowsmessagebox.h b/src/video/windows/SDL_windowsmessagebox.h index 37f9f4cba..e9c692546 100644 --- a/src/video/windows/SDL_windowsmessagebox.h +++ b/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/src/video/windows/SDL_windowsmodes.c b/src/video/windows/SDL_windowsmodes.c index 7cb4ea5b8..91ed67f87 100644 --- a/src/video/windows/SDL_windowsmodes.c +++ b/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 diff --git a/src/video/windows/SDL_windowsmodes.h b/src/video/windows/SDL_windowsmodes.h index 2bf9f4c86..e725848b2 100644 --- a/src/video/windows/SDL_windowsmodes.h +++ b/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 diff --git a/src/video/windows/SDL_windowsmouse.c b/src/video/windows/SDL_windowsmouse.c index 69aa77712..72d7892d4 100644 --- a/src/video/windows/SDL_windowsmouse.c +++ b/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/src/video/windows/SDL_windowsmouse.h b/src/video/windows/SDL_windowsmouse.h index d3d8f6342..60672e6bb 100644 --- a/src/video/windows/SDL_windowsmouse.h +++ b/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/src/video/windows/SDL_windowsopengl.c b/src/video/windows/SDL_windowsopengl.c index dc8cbb8a1..d30d838fd 100644 --- a/src/video/windows/SDL_windowsopengl.c +++ b/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 @@ -666,29 +666,29 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window) WGL_CONTEXT_MINOR_VERSION_ARB, _this->gl_config.minor_version, 0 }; - int iattr = 4; - - /* SDL profile bits match WGL profile bits */ - if( _this->gl_config.profile_mask != 0 ) { - attribs[iattr++] = WGL_CONTEXT_PROFILE_MASK_ARB; - attribs[iattr++] = _this->gl_config.profile_mask; - } - - /* SDL flags match WGL flags */ - if( _this->gl_config.flags != 0 ) { - attribs[iattr++] = WGL_CONTEXT_FLAGS_ARB; - attribs[iattr++] = _this->gl_config.flags; - } - - /* only set if wgl extension is available */ - if( _this->gl_data->HAS_WGL_ARB_context_flush_control ) { - attribs[iattr++] = WGL_CONTEXT_RELEASE_BEHAVIOR_ARB; - attribs[iattr++] = _this->gl_config.release_behavior ? + int iattr = 4; + + /* SDL profile bits match WGL profile bits */ + if (_this->gl_config.profile_mask != 0) { + attribs[iattr++] = WGL_CONTEXT_PROFILE_MASK_ARB; + attribs[iattr++] = _this->gl_config.profile_mask; + } + + /* SDL flags match WGL flags */ + if (_this->gl_config.flags != 0) { + attribs[iattr++] = WGL_CONTEXT_FLAGS_ARB; + attribs[iattr++] = _this->gl_config.flags; + } + + /* only set if wgl extension is available */ + if (_this->gl_data->HAS_WGL_ARB_context_flush_control) { + attribs[iattr++] = WGL_CONTEXT_RELEASE_BEHAVIOR_ARB; + attribs[iattr++] = _this->gl_config.release_behavior ? WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB : WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB; - } + } - attribs[iattr++] = 0; + attribs[iattr++] = 0; /* Create the GL 3.x context */ context = wglCreateContextAttribsARB(hdc, share_context, attribs); diff --git a/src/video/windows/SDL_windowsopengl.h b/src/video/windows/SDL_windowsopengl.h index 71c05db03..7b95cc8d9 100644 --- a/src/video/windows/SDL_windowsopengl.h +++ b/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/src/video/windows/SDL_windowsopengles.c b/src/video/windows/SDL_windowsopengles.c index 9125da0e4..f66cc088a 100644 --- a/src/video/windows/SDL_windowsopengles.c +++ b/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/src/video/windows/SDL_windowsopengles.h b/src/video/windows/SDL_windowsopengles.h index f63420880..dbdf5f6a1 100644 --- a/src/video/windows/SDL_windowsopengles.h +++ b/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/src/video/windows/SDL_windowsshape.c b/src/video/windows/SDL_windowsshape.c index 6c38ba1a5..0a50985a2 100644 --- a/src/video/windows/SDL_windowsshape.c +++ b/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/src/video/windows/SDL_windowsshape.h b/src/video/windows/SDL_windowsshape.h index 568945c7d..ddd8f49ba 100644 --- a/src/video/windows/SDL_windowsshape.h +++ b/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/src/video/windows/SDL_windowsvideo.c b/src/video/windows/SDL_windowsvideo.c index 86c3437c4..37199805b 100644 --- a/src/video/windows/SDL_windowsvideo.c +++ b/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 diff --git a/src/video/windows/SDL_windowsvideo.h b/src/video/windows/SDL_windowsvideo.h index 85327a7ab..912d8763d 100644 --- a/src/video/windows/SDL_windowsvideo.h +++ b/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/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index 70e80a95a..26683a0ed 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/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 @@ -559,7 +559,25 @@ WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, y = bounds.y; w = bounds.w; h = bounds.h; + + /* Unset the maximized flag. This fixes + https://bugzilla.libsdl.org/show_bug.cgi?id=3215 + */ + if (style & WS_MAXIMIZE) { + data->windowed_mode_was_maximized = SDL_TRUE; + style &= ~WS_MAXIMIZE; + } } else { + /* Restore window-maximization state, as applicable. + Special care is taken to *not* do this if and when we're + alt-tab'ing away (to some other window; as indicated by + in_window_deactivation), otherwise + https://bugzilla.libsdl.org/show_bug.cgi?id=3215 can reproduce! + */ + if (data->windowed_mode_was_maximized && !data->in_window_deactivation) { + style |= WS_MAXIMIZE; + data->windowed_mode_was_maximized = SDL_FALSE; + } rect.left = 0; rect.top = 0; rect.right = window->windowed.w; diff --git a/src/video/windows/SDL_windowswindow.h b/src/video/windows/SDL_windowswindow.h index 6b8b0c2d3..f91aa0ed2 100644 --- a/src/video/windows/SDL_windowswindow.h +++ b/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 @@ -42,6 +42,8 @@ typedef struct SDL_bool in_border_change; SDL_bool in_title_click; SDL_bool focus_click_pending; + SDL_bool windowed_mode_was_maximized; + SDL_bool in_window_deactivation; struct SDL_VideoData *videodata; #if SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; diff --git a/src/video/windows/wmmsg.h b/src/video/windows/wmmsg.h index e8f65ac3e..8c1351fe9 100644 --- a/src/video/windows/wmmsg.h +++ b/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/src/video/winrt/SDL_winrtevents.cpp b/src/video/winrt/SDL_winrtevents.cpp index 5c779d3c6..e9df726d4 100644 --- a/src/video/winrt/SDL_winrtevents.cpp +++ b/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/src/video/winrt/SDL_winrtevents_c.h b/src/video/winrt/SDL_winrtevents_c.h index b63c85fa3..dc94526bb 100644 --- a/src/video/winrt/SDL_winrtevents_c.h +++ b/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 @@ -57,6 +57,8 @@ extern Uint8 WINRT_GetSDLButtonForPointerPoint(Windows::UI::Input::PointerPoint extern void WINRT_ProcessPointerPressedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint); extern void WINRT_ProcessPointerMovedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint); extern void WINRT_ProcessPointerReleasedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint); +extern void WINRT_ProcessPointerEnteredEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint); +extern void WINRT_ProcessPointerExitedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint); extern void WINRT_ProcessPointerWheelChangedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint); extern void WINRT_ProcessMouseMovedEvent(SDL_Window * window, Windows::Devices::Input::MouseEventArgs ^args); diff --git a/src/video/winrt/SDL_winrtkeyboard.cpp b/src/video/winrt/SDL_winrtkeyboard.cpp index f75dd5f9d..7477cdeeb 100644 --- a/src/video/winrt/SDL_winrtkeyboard.cpp +++ b/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/src/video/winrt/SDL_winrtmessagebox.cpp b/src/video/winrt/SDL_winrtmessagebox.cpp index dc38d214c..ca958107c 100644 --- a/src/video/winrt/SDL_winrtmessagebox.cpp +++ b/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/src/video/winrt/SDL_winrtmessagebox.h b/src/video/winrt/SDL_winrtmessagebox.h index 8cae479a0..4184aa5ee 100644 --- a/src/video/winrt/SDL_winrtmessagebox.h +++ b/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/src/video/winrt/SDL_winrtmouse.cpp b/src/video/winrt/SDL_winrtmouse.cpp index cfebe9e0d..d3140a4a4 100644 --- a/src/video/winrt/SDL_winrtmouse.cpp +++ b/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/src/video/winrt/SDL_winrtmouse_c.h b/src/video/winrt/SDL_winrtmouse_c.h index f97af04d2..464ba4d47 100644 --- a/src/video/winrt/SDL_winrtmouse_c.h +++ b/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/src/video/winrt/SDL_winrtopengles.cpp b/src/video/winrt/SDL_winrtopengles.cpp index 04c61ab9f..cca07fa1b 100644 --- a/src/video/winrt/SDL_winrtopengles.cpp +++ b/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/src/video/winrt/SDL_winrtopengles.h b/src/video/winrt/SDL_winrtopengles.h index a0fde81ae..1da757b6c 100644 --- a/src/video/winrt/SDL_winrtopengles.h +++ b/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/src/video/winrt/SDL_winrtpointerinput.cpp b/src/video/winrt/SDL_winrtpointerinput.cpp index d900ef48f..1d648f966 100644 --- a/src/video/winrt/SDL_winrtpointerinput.cpp +++ b/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 @@ -306,6 +306,28 @@ void WINRT_ProcessPointerReleasedEvent(SDL_Window *window, Windows::UI::Input::P } } +void WINRT_ProcessPointerEnteredEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint) +{ + if (!window) { + return; + } + + if (!WINRT_IsTouchEvent(pointerPoint)) { + SDL_SetMouseFocus(window); + } +} + +void WINRT_ProcessPointerExitedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint) +{ + if (!window) { + return; + } + + if (!WINRT_IsTouchEvent(pointerPoint)) { + SDL_SetMouseFocus(NULL); + } +} + void WINRT_ProcessPointerWheelChangedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint) { diff --git a/src/video/winrt/SDL_winrtvideo.cpp b/src/video/winrt/SDL_winrtvideo.cpp index edd56f025..9d7c1ccee 100644 --- a/src/video/winrt/SDL_winrtvideo.cpp +++ b/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 @@ -30,8 +30,18 @@ /* Windows includes */ #include -#include +#include +#include +#include +using namespace Windows::ApplicationModel::Core; +using namespace Windows::Foundation; +using namespace Windows::Graphics::Display; using namespace Windows::UI::Core; +using namespace Windows::UI::ViewManagement; + + +/* [re]declare Windows GUIDs locally, to limit the amount of external lib(s) SDL has to link to */ +static const GUID IID_IDXGIFactory2 = { 0x50c83a1c, 0xe072, 0x4c48,{ 0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, 0xd0 } }; /* SDL includes */ @@ -44,6 +54,7 @@ extern "C" { #include "../../render/SDL_sysrender.h" #include "SDL_syswm.h" #include "SDL_winrtopengles.h" +#include "../../core/windows/SDL_windows.h" } #include "../../core/winrt/SDL_winrtapp_direct3d.h" @@ -65,6 +76,8 @@ static void WINRT_VideoQuit(_THIS); /* Window functions */ static int WINRT_CreateWindow(_THIS, SDL_Window * window); +static void WINRT_SetWindowSize(_THIS, SDL_Window * window); +static void WINRT_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen); static void WINRT_DestroyWindow(_THIS, SDL_Window * window); static SDL_bool WINRT_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info); @@ -123,6 +136,8 @@ WINRT_CreateDevice(int devindex) device->VideoInit = WINRT_VideoInit; device->VideoQuit = WINRT_VideoQuit; device->CreateWindow = WINRT_CreateWindow; + device->SetWindowSize = WINRT_SetWindowSize; + device->SetWindowFullscreen = WINRT_SetWindowFullscreen; device->DestroyWindow = WINRT_DestroyWindow; device->SetDisplayMode = WINRT_SetDisplayMode; device->PumpEvents = WINRT_PumpEvents; @@ -161,110 +176,232 @@ WINRT_VideoInit(_THIS) return 0; } -int -WINRT_CalcDisplayModeUsingNativeWindow(SDL_DisplayMode * mode) -{ - SDL_DisplayModeData * driverdata; +extern "C" +Uint32 D3D11_DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat); - using namespace Windows::Graphics::Display; +static void +WINRT_DXGIModeToSDLDisplayMode(const DXGI_MODE_DESC * dxgiMode, SDL_DisplayMode * sdlMode) +{ + SDL_zerop(sdlMode); + sdlMode->w = dxgiMode->Width; + sdlMode->h = dxgiMode->Height; + sdlMode->refresh_rate = dxgiMode->RefreshRate.Numerator / dxgiMode->RefreshRate.Denominator; + sdlMode->format = D3D11_DXGIFormatToSDLPixelFormat(dxgiMode->Format); +} - // Go no further if a native window cannot be accessed. This can happen, - // for example, if this function is called from certain threads, such as - // the SDL/XAML thread. - if (!CoreWindow::GetForCurrentThread()) { - return SDL_SetError("SDL/WinRT display modes cannot be calculated outside of the main thread, such as in SDL's XAML thread"); +static int +WINRT_AddDisplaysForOutput (_THIS, IDXGIAdapter1 * dxgiAdapter1, int outputIndex) +{ + HRESULT hr; + IDXGIOutput * dxgiOutput = NULL; + DXGI_OUTPUT_DESC dxgiOutputDesc; + SDL_VideoDisplay display; + char * displayName = NULL; + UINT numModes; + DXGI_MODE_DESC * dxgiModes = NULL; + int functionResult = -1; /* -1 for failure, 0 for success */ + DXGI_MODE_DESC modeToMatch, closestMatch; + + SDL_zero(display); + + hr = dxgiAdapter1->EnumOutputs(outputIndex, &dxgiOutput); + if (FAILED(hr)) { + if (hr != DXGI_ERROR_NOT_FOUND) { + WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIAdapter1::EnumOutputs failed", hr); + } + goto done; } - //SDL_Log("%s, size={%f,%f}, current orientation=%d, native orientation=%d, auto rot. pref=%d, DPI = %f\n", - // __FUNCTION__, - // CoreWindow::GetForCurrentThread()->Bounds.Width, CoreWindow::GetForCurrentThread()->Bounds.Height, - // WINRT_DISPLAY_PROPERTY(CurrentOrientation), - // WINRT_DISPLAY_PROPERTY(NativeOrientation), - // WINRT_DISPLAY_PROPERTY(AutoRotationPreferences), - // WINRT_DISPLAY_PROPERTY(LogicalDpi)); - - // Calculate the display size given the window size, taking into account - // the current display's DPI: - const float currentDPI = WINRT_DISPLAY_PROPERTY(LogicalDpi); - const float dipsPerInch = 96.0f; - const int w = (int) ((CoreWindow::GetForCurrentThread()->Bounds.Width * currentDPI) / dipsPerInch); - const int h = (int) ((CoreWindow::GetForCurrentThread()->Bounds.Height * currentDPI) / dipsPerInch); - if (w == 0 || w == h) { - return SDL_SetError("Unable to calculate the WinRT window/display's size"); + hr = dxgiOutput->GetDesc(&dxgiOutputDesc); + if (FAILED(hr)) { + WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIOutput::GetDesc failed", hr); + goto done; } - // Create a driverdata field: - driverdata = (SDL_DisplayModeData *) SDL_malloc(sizeof(*driverdata)); - if (!driverdata) { - return SDL_OutOfMemory(); - } - SDL_zerop(driverdata); - - // Fill in most fields: - SDL_zerop(mode); - mode->format = SDL_PIXELFORMAT_RGB888; - mode->refresh_rate = 0; // TODO, WinRT: see if refresh rate data is available, or relevant (for WinRT apps) - mode->w = w; - mode->h = h; - mode->driverdata = driverdata; - driverdata->currentOrientation = WINRT_DISPLAY_PROPERTY(CurrentOrientation); - -#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (NTDDI_VERSION == NTDDI_WIN8) - // On Windows Phone 8.0, the native window's size is always in portrait, - // regardless of the device's orientation. This is in contrast to - // Windows 8.x/RT and Windows Phone 8.1, which will resize the native window as the device's - // orientation changes. In order to compensate for this behavior, - // on Windows Phone, the mode's width and height will be swapped when - // the device is in a landscape (non-portrait) mode. - switch (driverdata->currentOrientation) { - case DisplayOrientations::Landscape: - case DisplayOrientations::LandscapeFlipped: - { - const int tmp = mode->h; - mode->h = mode->w; - mode->w = tmp; - break; + SDL_zero(modeToMatch); + modeToMatch.Format = DXGI_FORMAT_B8G8R8A8_UNORM; + modeToMatch.Width = (dxgiOutputDesc.DesktopCoordinates.right - dxgiOutputDesc.DesktopCoordinates.left); + modeToMatch.Height = (dxgiOutputDesc.DesktopCoordinates.bottom - dxgiOutputDesc.DesktopCoordinates.top); + hr = dxgiOutput->FindClosestMatchingMode(&modeToMatch, &closestMatch, NULL); + if (hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE) { + /* DXGI_ERROR_NOT_CURRENTLY_AVAILABLE gets returned by IDXGIOutput::FindClosestMatchingMode + when running under the Windows Simulator, which uses Remote Desktop (formerly known as Terminal + Services) under the hood. According to the MSDN docs for the similar function, + IDXGIOutput::GetDisplayModeList, DXGI_ERROR_NOT_CURRENTLY_AVAILABLE is returned if and + when an app is run under a Terminal Services session, hence the assumption. + + In this case, just add an SDL display mode, with approximated values. + */ + SDL_DisplayMode mode; + SDL_zero(mode); + display.name = "Windows Simulator / Terminal Services Display"; + mode.w = (dxgiOutputDesc.DesktopCoordinates.right - dxgiOutputDesc.DesktopCoordinates.left); + mode.h = (dxgiOutputDesc.DesktopCoordinates.bottom - dxgiOutputDesc.DesktopCoordinates.top); + mode.format = DXGI_FORMAT_B8G8R8A8_UNORM; + mode.refresh_rate = 0; /* Display mode is unknown, so just fill in zero, as specified by SDL's header files */ + display.desktop_mode = mode; + display.current_mode = mode; + if ( ! SDL_AddDisplayMode(&display, &mode)) { + goto done; + } + } else if (FAILED(hr)) { + WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIOutput::FindClosestMatchingMode failed", hr); + goto done; + } else { + displayName = WIN_StringToUTF8(dxgiOutputDesc.DeviceName); + display.name = displayName; + WINRT_DXGIModeToSDLDisplayMode(&closestMatch, &display.desktop_mode); + display.current_mode = display.desktop_mode; + + hr = dxgiOutput->GetDisplayModeList(DXGI_FORMAT_B8G8R8A8_UNORM, 0, &numModes, NULL); + if (FAILED(hr)) { + if (hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE) { + // TODO, WinRT: make sure display mode(s) are added when using Terminal Services / Windows Simulator + } + WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIOutput::GetDisplayModeList [get mode list size] failed", hr); + goto done; } - default: - break; + dxgiModes = (DXGI_MODE_DESC *)SDL_calloc(numModes, sizeof(DXGI_MODE_DESC)); + if ( ! dxgiModes) { + SDL_OutOfMemory(); + goto done; + } + + hr = dxgiOutput->GetDisplayModeList(DXGI_FORMAT_B8G8R8A8_UNORM, 0, &numModes, dxgiModes); + if (FAILED(hr)) { + WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIOutput::GetDisplayModeList [get mode contents] failed", hr); + goto done; + } + + for (UINT i = 0; i < numModes; ++i) { + SDL_DisplayMode sdlMode; + WINRT_DXGIModeToSDLDisplayMode(&dxgiModes[i], &sdlMode); + SDL_AddDisplayMode(&display, &sdlMode); + } } -#endif - return 0; + if (SDL_AddVideoDisplay(&display) < 0) { + goto done; + } + + functionResult = 0; /* 0 for Success! */ +done: + if (dxgiModes) { + SDL_free(dxgiModes); + } + if (dxgiOutput) { + dxgiOutput->Release(); + } + if (displayName) { + SDL_free(displayName); + } + return functionResult; } -int -WINRT_DuplicateDisplayMode(SDL_DisplayMode * dest, const SDL_DisplayMode * src) +static int +WINRT_AddDisplaysForAdapter (_THIS, IDXGIFactory2 * dxgiFactory2, int adapterIndex) { - SDL_DisplayModeData * driverdata; - driverdata = (SDL_DisplayModeData *) SDL_malloc(sizeof(*driverdata)); - if (!driverdata) { - return SDL_OutOfMemory(); + HRESULT hr; + IDXGIAdapter1 * dxgiAdapter1; + + hr = dxgiFactory2->EnumAdapters1(adapterIndex, &dxgiAdapter1); + if (FAILED(hr)) { + if (hr != DXGI_ERROR_NOT_FOUND) { + WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIFactory1::EnumAdapters1() failed", hr); + } + return -1; + } + + for (int outputIndex = 0; ; ++outputIndex) { + if (WINRT_AddDisplaysForOutput(_this, dxgiAdapter1, outputIndex) < 0) { + /* HACK: The Windows App Certification Kit 10.0 can fail, when + running the Store Apps' test, "Direct3D Feature Test". The + certification kit's error is: + + "Application App was not running at the end of the test. It likely crashed or was terminated for having become unresponsive." + + This was caused by SDL/WinRT's DXGI failing to report any + outputs. Attempts to get the 1st display-output from the + 1st display-adapter can fail, with IDXGIAdapter::EnumOutputs + returning DXGI_ERROR_NOT_FOUND. This could be a bug in Windows, + the Windows App Certification Kit, or possibly in SDL/WinRT's + display detection code. Either way, try to detect when this + happens, and use a hackish means to create a reasonable-as-possible + 'display mode'. -- DavidL + */ + if (adapterIndex == 0 && outputIndex == 0) { + SDL_VideoDisplay display; + SDL_DisplayMode mode; +#if SDL_WINRT_USE_APPLICATIONVIEW + ApplicationView ^ appView = ApplicationView::GetForCurrentView(); +#endif + CoreWindow ^ coreWin = CoreWindow::GetForCurrentThread(); + SDL_zero(display); + SDL_zero(mode); + display.name = "DXGI Display-detection Workaround"; + + /* HACK: ApplicationView's VisibleBounds property, appeared, via testing, to + give a better approximation of display-size, than did CoreWindow's + Bounds property, insofar that ApplicationView::VisibleBounds seems like + it will, at least some of the time, give the full display size (during the + failing test), whereas CoreWindow might not. -- DavidL + */ + +#if (NTDDI_VERSION >= NTDDI_WIN10) || (SDL_WINRT_USE_APPLICATIONVIEW && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) + mode.w = WINRT_DIPS_TO_PHYSICAL_PIXELS(appView->VisibleBounds.Width); + mode.h = WINRT_DIPS_TO_PHYSICAL_PIXELS(appView->VisibleBounds.Height); +#else + /* On platform(s) that do not support VisibleBounds, such as Windows 8.1, + fall back to CoreWindow's Bounds property. + */ + mode.w = WINRT_DIPS_TO_PHYSICAL_PIXELS(coreWin->Bounds.Width); + mode.h = WINRT_DIPS_TO_PHYSICAL_PIXELS(coreWin->Bounds.Height); +#endif + + mode.format = DXGI_FORMAT_B8G8R8A8_UNORM; + mode.refresh_rate = 0; /* Display mode is unknown, so just fill in zero, as specified by SDL's header files */ + display.desktop_mode = mode; + display.current_mode = mode; + if ((SDL_AddDisplayMode(&display, &mode) < 0) || + (SDL_AddVideoDisplay(&display) < 0)) + { + return SDL_SetError("Failed to apply DXGI Display-detection workaround"); + } + } + + break; + } } - SDL_memcpy(driverdata, src->driverdata, sizeof(SDL_DisplayModeData)); - SDL_memcpy(dest, src, sizeof(SDL_DisplayMode)); - dest->driverdata = driverdata; + + dxgiAdapter1->Release(); return 0; } int WINRT_InitModes(_THIS) { - // Retrieve the display mode: - SDL_DisplayMode mode, desktop_mode; - if (WINRT_CalcDisplayModeUsingNativeWindow(&mode) != 0) { - return -1; // If WINRT_CalcDisplayModeUsingNativeWindow fails, it'll already have set the SDL error - } + /* HACK: Initialize a single display, for whatever screen the app's + CoreApplicationView is on. + TODO, WinRT: Try initializing multiple displays, one for each monitor. + Appropriate WinRT APIs for this seem elusive, though. -- DavidL + */ - if (WINRT_DuplicateDisplayMode(&desktop_mode, &mode) != 0) { + HRESULT hr; + IDXGIFactory2 * dxgiFactory2 = NULL; + + hr = CreateDXGIFactory1(IID_IDXGIFactory2, (void **)&dxgiFactory2); + if (FAILED(hr)) { + WIN_SetErrorFromHRESULT(__FUNCTION__ ", CreateDXGIFactory1() failed", hr); return -1; } - if (SDL_AddBasicVideoDisplay(&desktop_mode) < 0) { - return -1; + + for (int adapterIndex = 0; ; ++adapterIndex) { + if (WINRT_AddDisplaysForAdapter(_this, dxgiFactory2, adapterIndex) < 0) { + break; + } } - SDL_AddDisplayMode(&_this->displays[0], &mode); return 0; } @@ -280,6 +417,121 @@ WINRT_VideoQuit(_THIS) WINRT_QuitMouse(_this); } +static const Uint32 WINRT_DetectableFlags = + SDL_WINDOW_MAXIMIZED | + SDL_WINDOW_FULLSCREEN_DESKTOP | + SDL_WINDOW_SHOWN | + SDL_WINDOW_HIDDEN | + SDL_WINDOW_MOUSE_FOCUS; + +extern "C" Uint32 +WINRT_DetectWindowFlags(SDL_Window * window) +{ + Uint32 latestFlags = 0; + SDL_WindowData * data = (SDL_WindowData *) window->driverdata; + bool is_fullscreen = false; + +#if SDL_WINRT_USE_APPLICATIONVIEW + if (data->appView) { + is_fullscreen = data->appView->IsFullScreen; + } +#elif (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION == NTDDI_WIN8) + is_fullscreen = true; +#endif + + if (data->coreWindow.Get()) { + if (is_fullscreen) { + SDL_VideoDisplay * display = SDL_GetDisplayForWindow(window); + int w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width); + int h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height); + +#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION > NTDDI_WIN8) + // On all WinRT platforms, except for WinPhone 8.0, rotate the + // window size. This is needed to properly calculate + // fullscreen vs. maximized. + const DisplayOrientations currentOrientation = WINRT_DISPLAY_PROPERTY(CurrentOrientation); + switch (currentOrientation) { +#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) + case DisplayOrientations::Landscape: + case DisplayOrientations::LandscapeFlipped: +#else + case DisplayOrientations::Portrait: + case DisplayOrientations::PortraitFlipped: +#endif + { + int tmp = w; + w = h; + h = tmp; + } break; + } +#endif + + if (display->desktop_mode.w != w || display->desktop_mode.h != h) { + latestFlags |= SDL_WINDOW_MAXIMIZED; + } else { + latestFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP; + } + } + + if (data->coreWindow->Visible) { + latestFlags |= SDL_WINDOW_SHOWN; + } else { + latestFlags |= SDL_WINDOW_HIDDEN; + } + +#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (NTDDI_VERSION < NTDDI_WINBLUE) + // data->coreWindow->PointerPosition is not supported on WinPhone 8.0 + latestFlags |= SDL_WINDOW_MOUSE_FOCUS; +#else + if (data->coreWindow->Bounds.Contains(data->coreWindow->PointerPosition)) { + latestFlags |= SDL_WINDOW_MOUSE_FOCUS; + } +#endif + } + + return latestFlags; +} + +// TODO, WinRT: consider removing WINRT_UpdateWindowFlags, and just calling WINRT_DetectWindowFlags as-appropriate (with appropriate calls to SDL_SendWindowEvent) +void +WINRT_UpdateWindowFlags(SDL_Window * window, Uint32 mask) +{ + mask &= WINRT_DetectableFlags; + if (window) { + Uint32 apply = WINRT_DetectWindowFlags(window); + if ((apply & mask) & SDL_WINDOW_FULLSCREEN) { + window->last_fullscreen_flags = window->flags; // seems necessary to programmatically un-fullscreen, via SDL APIs + } + window->flags = (window->flags & ~mask) | (apply & mask); + } +} + +static bool +WINRT_IsCoreWindowActive(CoreWindow ^ coreWindow) +{ + /* WinRT does not appear to offer API(s) to determine window-activation state, + at least not that I am aware of in Win8 - Win10. As such, SDL tracks this + itself, via window-activation events. + + If there *is* an API to track this, it should probably get used instead + of the following hack (that uses "SDLHelperWindowActivationState"). + -- DavidL. + */ + if (coreWindow->CustomProperties->HasKey("SDLHelperWindowActivationState")) { + CoreWindowActivationState activationState = \ + safe_cast(coreWindow->CustomProperties->Lookup("SDLHelperWindowActivationState")); + return (activationState != CoreWindowActivationState::Deactivated); + } + + /* Assume that non-SDL tracked windows are active, although this should + probably be avoided, if possible. + + This might not even be possible, in normal SDL use, at least as of + this writing (Dec 22, 2015; via latest hg.libsdl.org/SDL clone) -- DavidL + */ + return true; +} + int WINRT_CreateWindow(_THIS, SDL_Window * window) { @@ -290,7 +542,7 @@ WINRT_CreateWindow(_THIS, SDL_Window * window) return -1; } - SDL_WindowData *data = new SDL_WindowData; + SDL_WindowData *data = new SDL_WindowData; /* use 'new' here as SDL_WindowData may use WinRT/C++ types */ if (!data) { SDL_OutOfMemory(); return -1; @@ -306,8 +558,14 @@ WINRT_CreateWindow(_THIS, SDL_Window * window) */ if (!WINRT_XAMLWasEnabled) { data->coreWindow = CoreWindow::GetForCurrentThread(); +#if SDL_WINRT_USE_APPLICATIONVIEW + data->appView = ApplicationView::GetForCurrentView(); +#endif } + /* Make note of the requested window flags, before they start getting changed. */ + const Uint32 requestedFlags = window->flags; + #if SDL_VIDEO_OPENGL_EGL /* Setup the EGL surface, but only if OpenGL ES 2 was requested. */ if (!(window->flags & SDL_WINDOW_OPENGL)) { @@ -359,17 +617,10 @@ WINRT_CreateWindow(_THIS, SDL_Window * window) } #endif - /* Make sure the window is considered to be positioned at {0,0}, - and is considered fullscreen, shown, and the like. - */ - window->x = 0; - window->y = 0; + /* Determine as many flags dynamically, as possible. */ window->flags = - SDL_WINDOW_FULLSCREEN | - SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS | - SDL_WINDOW_MAXIMIZED | - SDL_WINDOW_INPUT_GRABBED; + SDL_WINDOW_RESIZABLE; #if SDL_VIDEO_OPENGL_EGL if (data->egl_surface) { @@ -377,20 +628,55 @@ WINRT_CreateWindow(_THIS, SDL_Window * window) } #endif - /* WinRT does not, as of this writing, appear to support app-adjustable - window sizes. Set the window size to whatever the native WinRT - CoreWindow is set at. + if (WINRT_XAMLWasEnabled) { + /* TODO, WinRT: set SDL_Window size, maybe position too, from XAML control */ + window->x = 0; + window->y = 0; + window->flags |= SDL_WINDOW_SHOWN; + SDL_SetMouseFocus(NULL); // TODO: detect this + SDL_SetKeyboardFocus(NULL); // TODO: detect this + } else { + /* WinRT 8.x apps seem to live in an environment where the OS controls the + app's window size, with some apps being fullscreen, depending on + user choice of various things. For now, just adapt the SDL_Window to + whatever Windows set-up as the native-window's geometry. + */ + window->x = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Left); + window->y = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Top); +#if NTDDI_VERSION < NTDDI_WIN10 + /* On WinRT 8.x / pre-Win10, just use the size we were given. */ + window->w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width); + window->h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height); +#else + /* On Windows 10, we occasionally get control over window size. For windowed + mode apps, try this. + */ + bool didSetSize = false; + if (!(requestedFlags & SDL_WINDOW_FULLSCREEN)) { + const Windows::Foundation::Size size(WINRT_PHYSICAL_PIXELS_TO_DIPS(window->w), + WINRT_PHYSICAL_PIXELS_TO_DIPS(window->h)); + didSetSize = data->appView->TryResizeView(size); + } + if (!didSetSize) { + /* We either weren't able to set the window size, or a request for + fullscreen was made. Get window-size info from the OS. + */ + window->w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width); + window->h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height); + } +#endif + + WINRT_UpdateWindowFlags( + window, + 0xffffffff /* Update any window flag(s) that WINRT_UpdateWindow can handle */ + ); - TODO, WinRT: if and when non-fullscreen XAML control support is added to SDL, consider making those resizable via SDL_Window's interfaces. - */ - window->w = _this->displays[0].current_mode.w; - window->h = _this->displays[0].current_mode.h; - - /* For now, treat WinRT apps as if they always have focus. - TODO, WinRT: try tracking keyboard and mouse focus state with respect to snapped apps - */ - SDL_SetMouseFocus(window); - SDL_SetKeyboardFocus(window); + /* Try detecting if the window is active */ + bool isWindowActive = WINRT_IsCoreWindowActive(data->coreWindow.Get()); + if (isWindowActive) { + SDL_SetKeyboardFocus(window); + } + } /* Make sure the WinRT app's IFramworkView can post events on behalf of SDL: @@ -401,6 +687,38 @@ WINRT_CreateWindow(_THIS, SDL_Window * window) return 0; } +void +WINRT_SetWindowSize(_THIS, SDL_Window * window) +{ +#if NTDDI_VERSION >= NTDDI_WIN10 + SDL_WindowData * data = (SDL_WindowData *)window->driverdata; + const Windows::Foundation::Size size(WINRT_PHYSICAL_PIXELS_TO_DIPS(window->w), + WINRT_PHYSICAL_PIXELS_TO_DIPS(window->h)); + data->appView->TryResizeView(size); // TODO, WinRT: return failure (to caller?) from TryResizeView() +#endif +} + +void +WINRT_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen) +{ +#if NTDDI_VERSION >= NTDDI_WIN10 + SDL_WindowData * data = (SDL_WindowData *)window->driverdata; + bool isWindowActive = WINRT_IsCoreWindowActive(data->coreWindow.Get()); + if (isWindowActive) { + if (fullscreen) { + if (!data->appView->IsFullScreenMode) { + data->appView->TryEnterFullScreenMode(); // TODO, WinRT: return failure (to caller?) from TryEnterFullScreenMode() + } + } else { + if (data->appView->IsFullScreenMode) { + data->appView->ExitFullScreenMode(); + } + } + } +#endif +} + + void WINRT_DestroyWindow(_THIS, SDL_Window * window) { diff --git a/src/video/winrt/SDL_winrtvideo_cpp.h b/src/video/winrt/SDL_winrtvideo_cpp.h index a39de826a..26eb008d4 100644 --- a/src/video/winrt/SDL_winrtvideo_cpp.h +++ b/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 @@ -29,6 +29,12 @@ #include "SDL_video.h" #include "SDL_events.h" +#if NTDDI_VERSION >= NTDDI_WINBLUE /* ApplicationView's functionality only becomes + useful for SDL in Win[Phone] 8.1 and up. + Plus, it is not available at all in WinPhone 8.0. */ +#define SDL_WINRT_USE_APPLICATIONVIEW 1 +#endif + extern "C" { #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" @@ -48,25 +54,17 @@ typedef struct SDL_VideoData { */ extern SDL_Window * WINRT_GlobalSDLWindow; -/* Creates a display mode for Plain Direct3D (non-XAML) apps, using the lone, native window's settings. - - Pass in an allocated SDL_DisplayMode field to store the data in. - - This function will return 0 on success, -1 on failure. - - If this function succeeds, be sure to call SDL_free on the - SDL_DisplayMode's driverdata field. +/* Updates one or more SDL_Window flags, by querying the OS' native windowing APIs. + SDL_Window flags that can be updated should be specified in 'mask'. */ -extern int WINRT_CalcDisplayModeUsingNativeWindow(SDL_DisplayMode * mode); - -/* Duplicates a display mode, copying over driverdata as necessary */ -extern int WINRT_DuplicateDisplayMode(SDL_DisplayMode * dest, const SDL_DisplayMode * src); +extern void WINRT_UpdateWindowFlags(SDL_Window * window, Uint32 mask); +extern "C" Uint32 WINRT_DetectWindowFlags(SDL_Window * window); /* detects flags w/o applying them */ /* Display mode internals */ -typedef struct -{ - Windows::Graphics::Display::DisplayOrientations currentOrientation; -} SDL_DisplayModeData; +//typedef struct +//{ +// Windows::Graphics::Display::DisplayOrientations currentOrientation; +//} SDL_DisplayModeData; #ifdef __cplusplus_winrt @@ -77,6 +75,10 @@ typedef struct #define WINRT_DISPLAY_PROPERTY(NAME) (Windows::Graphics::Display::DisplayProperties::NAME) #endif +/* Converts DIPS to/from physical pixels */ +#define WINRT_DIPS_TO_PHYSICAL_PIXELS(DIPS) ((int)(0.5f + (((float)(DIPS) * (float)WINRT_DISPLAY_PROPERTY(LogicalDpi)) / 96.f))) +#define WINRT_PHYSICAL_PIXELS_TO_DIPS(PHYSPIX) (((float)(PHYSPIX) * 96.f)/WINRT_DISPLAY_PROPERTY(LogicalDpi)) + /* Internal window data */ struct SDL_WindowData { @@ -85,6 +87,9 @@ struct SDL_WindowData #ifdef SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; #endif +#if SDL_WINRT_USE_APPLICATIONVIEW + Windows::UI::ViewManagement::ApplicationView ^ appView; +#endif }; #endif // ifdef __cplusplus_winrt diff --git a/src/video/x11/SDL_x11clipboard.c b/src/video/x11/SDL_x11clipboard.c index eca40f2af..34c0a71c6 100644 --- a/src/video/x11/SDL_x11clipboard.c +++ b/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/src/video/x11/SDL_x11clipboard.h b/src/video/x11/SDL_x11clipboard.h index 09dcf568c..15dae7dfd 100644 --- a/src/video/x11/SDL_x11clipboard.h +++ b/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/src/video/x11/SDL_x11dyn.c b/src/video/x11/SDL_x11dyn.c index 58e97be7e..7cbfa3e97 100644 --- a/src/video/x11/SDL_x11dyn.c +++ b/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 diff --git a/src/video/x11/SDL_x11dyn.h b/src/video/x11/SDL_x11dyn.h index 2d729b708..136609b85 100644 --- a/src/video/x11/SDL_x11dyn.h +++ b/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 diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index 2f730c440..208009607 100644 --- a/src/video/x11/SDL_x11events.c +++ b/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 @@ -348,27 +348,10 @@ X11_ReconcileKeyboardState(_THIS) X11_XQueryKeymap(display, keys); - /* Get the keyboard modifier state */ + /* Sync up the keyboard modifier state */ if (X11_XQueryPointer(display, DefaultRootWindow(display), &junk_window, &junk_window, &x, &y, &x, &y, &mask)) { - unsigned num_mask = X11_GetNumLockModifierMask(_this); - const Uint8 *keystate = SDL_GetKeyboardState(NULL); - Uint8 capslockState = keystate[SDL_SCANCODE_CAPSLOCK]; - Uint8 numlockState = keystate[SDL_SCANCODE_NUMLOCKCLEAR]; - - /* Toggle key mod state if needed */ - if (!!(mask & LockMask) != !!(SDL_GetModState() & KMOD_CAPS)) { - SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_CAPSLOCK); - if (capslockState == SDL_RELEASED) { - SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_CAPSLOCK); - } - } - - if (!!(mask & num_mask) != !!(SDL_GetModState() & KMOD_NUM)) { - SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_NUMLOCKCLEAR); - if (numlockState == SDL_RELEASED) { - SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_NUMLOCKCLEAR); - } - } + SDL_ToggleModState(KMOD_CAPS, (mask & LockMask) != 0); + SDL_ToggleModState(KMOD_NUM, (mask & X11_GetNumLockModifierMask(_this)) != 0); } for (keycode = 0; keycode < 256; ++keycode) { diff --git a/src/video/x11/SDL_x11events.h b/src/video/x11/SDL_x11events.h index a6d434de6..024fca3f4 100644 --- a/src/video/x11/SDL_x11events.h +++ b/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/src/video/x11/SDL_x11framebuffer.c b/src/video/x11/SDL_x11framebuffer.c index 90a4a6fcc..a4886169f 100644 --- a/src/video/x11/SDL_x11framebuffer.c +++ b/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/src/video/x11/SDL_x11framebuffer.h b/src/video/x11/SDL_x11framebuffer.h index 359ee1571..7326e7da9 100644 --- a/src/video/x11/SDL_x11framebuffer.h +++ b/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/src/video/x11/SDL_x11keyboard.c b/src/video/x11/SDL_x11keyboard.c index b04830f1c..2c3acdadd 100644 --- a/src/video/x11/SDL_x11keyboard.c +++ b/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 diff --git a/src/video/x11/SDL_x11keyboard.h b/src/video/x11/SDL_x11keyboard.h index 1e9c48ca5..a1102ed75 100644 --- a/src/video/x11/SDL_x11keyboard.h +++ b/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/src/video/x11/SDL_x11messagebox.c b/src/video/x11/SDL_x11messagebox.c index a52d4c9e0..fc8b1b26b 100644 --- a/src/video/x11/SDL_x11messagebox.c +++ b/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/src/video/x11/SDL_x11messagebox.h b/src/video/x11/SDL_x11messagebox.h index 37d8312cf..c77c57fb1 100644 --- a/src/video/x11/SDL_x11messagebox.h +++ b/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/src/video/x11/SDL_x11modes.c b/src/video/x11/SDL_x11modes.c index eb4bf7e27..446da2b64 100644 --- a/src/video/x11/SDL_x11modes.c +++ b/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 @@ -357,16 +357,12 @@ SetXRandRDisplayName(Display *dpy, Atom EDID, char *name, const size_t namelen, int X11_InitModes_XRandR(_THIS) { - /* In theory, you _could_ have multiple screens (like DISPLAY=:0.0 - and DISPLAY=:0.1) but no XRandR system we care about is like this, - as all the physical displays would be separate XRandR "outputs" on - the one X11 virtual "screen". So we don't use ScreenCount() here. */ - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; Display *dpy = data->display; + const int screencount = ScreenCount(dpy); + const int default_screen = DefaultScreen(dpy); + RROutput primary = X11_XRRGetOutputPrimary(dpy, RootWindow(dpy, default_screen)); Atom EDID = X11_XInternAtom(dpy, "EDID", False); - const int screen = DefaultScreen(dpy); - RROutput primary; XRRScreenResources *res = NULL; Uint32 pixelformat; XVisualInfo vinfo; @@ -374,125 +370,131 @@ X11_InitModes_XRandR(_THIS) int looking_for_primary; int scanline_pad; int output; - int i, n; - - if (get_visualinfo(dpy, screen, &vinfo) < 0) { - return -1; - } + int screen, i, n; - pixelformat = X11_GetPixelFormatFromVisualInfo(dpy, &vinfo); - if (SDL_ISPIXELFORMAT_INDEXED(pixelformat)) { - return SDL_SetError("Palettized video modes are no longer supported"); - } + for (looking_for_primary = 1; looking_for_primary >= 0; looking_for_primary--) { + for (screen = 0; screen < screencount; screen++) { - scanline_pad = SDL_BYTESPERPIXEL(pixelformat) * 8; - pixmapformats = X11_XListPixmapFormats(dpy, &n); - if (pixmapformats) { - for (i = 0; i < n; ++i) { - if (pixmapformats[i].depth == vinfo.depth) { - scanline_pad = pixmapformats[i].scanline_pad; - break; + /* we want the primary output first, and then skipped later. */ + if (looking_for_primary && (screen != default_screen)) { + continue; } - } - X11_XFree(pixmapformats); - } - res = X11_XRRGetScreenResources(dpy, RootWindow(dpy, screen)); - if (!res) { - return -1; - } + if (get_visualinfo(dpy, screen, &vinfo) < 0) { + continue; /* uh, skip this screen? */ + } - primary = X11_XRRGetOutputPrimary(dpy, RootWindow(dpy, screen)); + pixelformat = X11_GetPixelFormatFromVisualInfo(dpy, &vinfo); + if (SDL_ISPIXELFORMAT_INDEXED(pixelformat)) { + continue; /* Palettized video modes are no longer supported */ + } - for (looking_for_primary = 1; looking_for_primary >= 0; looking_for_primary--) { - for (output = 0; output < res->noutput; output++) { - XRROutputInfo *output_info; - int display_x, display_y; - unsigned long display_mm_width, display_mm_height; - SDL_DisplayData *displaydata; - char display_name[128]; - SDL_DisplayMode mode; - SDL_DisplayModeData *modedata; - SDL_VideoDisplay display; - RRMode modeID; - RRCrtc output_crtc; - XRRCrtcInfo *crtc; - - /* The primary output _should_ always be sorted first, but just in case... */ - if ((looking_for_primary && (res->outputs[output] != primary)) || - (!looking_for_primary && (res->outputs[output] == primary))) { - continue; + scanline_pad = SDL_BYTESPERPIXEL(pixelformat) * 8; + pixmapformats = X11_XListPixmapFormats(dpy, &n); + if (pixmapformats) { + for (i = 0; i < n; ++i) { + if (pixmapformats[i].depth == vinfo.depth) { + scanline_pad = pixmapformats[i].scanline_pad; + break; + } + } + X11_XFree(pixmapformats); } - output_info = X11_XRRGetOutputInfo(dpy, res, res->outputs[output]); - if (!output_info || !output_info->crtc || output_info->connection == RR_Disconnected) { - X11_XRRFreeOutputInfo(output_info); + res = X11_XRRGetScreenResources(dpy, RootWindow(dpy, screen)); + if (!res) { continue; } - SDL_strlcpy(display_name, output_info->name, sizeof(display_name)); - display_mm_width = output_info->mm_width; - display_mm_height = output_info->mm_height; - output_crtc = output_info->crtc; - X11_XRRFreeOutputInfo(output_info); + for (output = 0; output < res->noutput; output++) { + XRROutputInfo *output_info; + int display_x, display_y; + unsigned long display_mm_width, display_mm_height; + SDL_DisplayData *displaydata; + char display_name[128]; + SDL_DisplayMode mode; + SDL_DisplayModeData *modedata; + SDL_VideoDisplay display; + RRMode modeID; + RRCrtc output_crtc; + XRRCrtcInfo *crtc; + + /* The primary output _should_ always be sorted first, but just in case... */ + if ((looking_for_primary && (res->outputs[output] != primary)) || + (!looking_for_primary && (screen == default_screen) && (res->outputs[output] == primary))) { + continue; + } - crtc = X11_XRRGetCrtcInfo(dpy, res, output_crtc); - if (!crtc) { - continue; - } + output_info = X11_XRRGetOutputInfo(dpy, res, res->outputs[output]); + if (!output_info || !output_info->crtc || output_info->connection == RR_Disconnected) { + X11_XRRFreeOutputInfo(output_info); + continue; + } - SDL_zero(mode); - modeID = crtc->mode; - mode.w = crtc->width; - mode.h = crtc->height; - mode.format = pixelformat; + SDL_strlcpy(display_name, output_info->name, sizeof(display_name)); + display_mm_width = output_info->mm_width; + display_mm_height = output_info->mm_height; + output_crtc = output_info->crtc; + X11_XRRFreeOutputInfo(output_info); - display_x = crtc->x; - display_y = crtc->y; + crtc = X11_XRRGetCrtcInfo(dpy, res, output_crtc); + if (!crtc) { + continue; + } - X11_XRRFreeCrtcInfo(crtc); + SDL_zero(mode); + modeID = crtc->mode; + mode.w = crtc->width; + mode.h = crtc->height; + mode.format = pixelformat; - displaydata = (SDL_DisplayData *) SDL_calloc(1, sizeof(*displaydata)); - if (!displaydata) { - return SDL_OutOfMemory(); - } + display_x = crtc->x; + display_y = crtc->y; - modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData)); - if (!modedata) { - SDL_free(displaydata); - return SDL_OutOfMemory(); - } - modedata->xrandr_mode = modeID; - mode.driverdata = modedata; + X11_XRRFreeCrtcInfo(crtc); - displaydata->screen = screen; - displaydata->visual = vinfo.visual; - displaydata->depth = vinfo.depth; - displaydata->hdpi = ((float) mode.w) * 25.4f / display_mm_width; - displaydata->vdpi = ((float) mode.h) * 25.4f / display_mm_height; - displaydata->ddpi = SDL_ComputeDiagonalDPI(mode.w, mode.h, ((float) display_mm_width) / 25.4f,((float) display_mm_height) / 25.4f); - displaydata->scanline_pad = scanline_pad; - displaydata->x = display_x; - displaydata->y = display_y; - displaydata->use_xrandr = 1; - displaydata->xrandr_output = res->outputs[output]; - - SetXRandRModeInfo(dpy, res, output_crtc, modeID, &mode); - SetXRandRDisplayName(dpy, EDID, display_name, sizeof (display_name), res->outputs[output], display_mm_width, display_mm_height); - - SDL_zero(display); - if (*display_name) { - display.name = display_name; + displaydata = (SDL_DisplayData *) SDL_calloc(1, sizeof(*displaydata)); + if (!displaydata) { + return SDL_OutOfMemory(); + } + + modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData)); + if (!modedata) { + SDL_free(displaydata); + return SDL_OutOfMemory(); + } + modedata->xrandr_mode = modeID; + mode.driverdata = modedata; + + displaydata->screen = screen; + displaydata->visual = vinfo.visual; + displaydata->depth = vinfo.depth; + displaydata->hdpi = ((float) mode.w) * 25.4f / display_mm_width; + displaydata->vdpi = ((float) mode.h) * 25.4f / display_mm_height; + displaydata->ddpi = SDL_ComputeDiagonalDPI(mode.w, mode.h, ((float) display_mm_width) / 25.4f,((float) display_mm_height) / 25.4f); + displaydata->scanline_pad = scanline_pad; + displaydata->x = display_x; + displaydata->y = display_y; + displaydata->use_xrandr = 1; + displaydata->xrandr_output = res->outputs[output]; + + SetXRandRModeInfo(dpy, res, output_crtc, modeID, &mode); + SetXRandRDisplayName(dpy, EDID, display_name, sizeof (display_name), res->outputs[output], display_mm_width, display_mm_height); + + SDL_zero(display); + if (*display_name) { + display.name = display_name; + } + display.desktop_mode = mode; + display.current_mode = mode; + display.driverdata = displaydata; + SDL_AddVideoDisplay(&display); } - display.desktop_mode = mode; - display.current_mode = mode; - display.driverdata = displaydata; - SDL_AddVideoDisplay(&display); + + X11_XRRFreeScreenResources(res); } } - X11_XRRFreeScreenResources(res); - if (_this->num_displays == 0) { return SDL_SetError("No available displays"); } diff --git a/src/video/x11/SDL_x11modes.h b/src/video/x11/SDL_x11modes.h index 769da5a56..a68286ab1 100644 --- a/src/video/x11/SDL_x11modes.h +++ b/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 diff --git a/src/video/x11/SDL_x11mouse.c b/src/video/x11/SDL_x11mouse.c index 6cef0a4ea..245b116ea 100644 --- a/src/video/x11/SDL_x11mouse.c +++ b/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 diff --git a/src/video/x11/SDL_x11mouse.h b/src/video/x11/SDL_x11mouse.h index 7c6a54438..d31d6b722 100644 --- a/src/video/x11/SDL_x11mouse.h +++ b/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/src/video/x11/SDL_x11opengl.c b/src/video/x11/SDL_x11opengl.c index a431ae742..8b634be3d 100644 --- a/src/video/x11/SDL_x11opengl.c +++ b/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/src/video/x11/SDL_x11opengl.h b/src/video/x11/SDL_x11opengl.h index de2297356..86e77d7da 100644 --- a/src/video/x11/SDL_x11opengl.h +++ b/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/src/video/x11/SDL_x11opengles.c b/src/video/x11/SDL_x11opengles.c index ca57af387..531172200 100644 --- a/src/video/x11/SDL_x11opengles.c +++ b/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/src/video/x11/SDL_x11opengles.h b/src/video/x11/SDL_x11opengles.h index e39e3c01c..716e6e688 100644 --- a/src/video/x11/SDL_x11opengles.h +++ b/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/src/video/x11/SDL_x11shape.c b/src/video/x11/SDL_x11shape.c index 19c7942d8..4f78ae899 100644 --- a/src/video/x11/SDL_x11shape.c +++ b/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/src/video/x11/SDL_x11shape.h b/src/video/x11/SDL_x11shape.h index 0d3c2107b..cd88ab70f 100644 --- a/src/video/x11/SDL_x11shape.h +++ b/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/src/video/x11/SDL_x11sym.h b/src/video/x11/SDL_x11sym.h index 4a926a34c..3683ac0a5 100644 --- a/src/video/x11/SDL_x11sym.h +++ b/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 diff --git a/src/video/x11/SDL_x11touch.c b/src/video/x11/SDL_x11touch.c index 2b24027aa..c19e80a67 100644 --- a/src/video/x11/SDL_x11touch.c +++ b/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/src/video/x11/SDL_x11touch.h b/src/video/x11/SDL_x11touch.h index 47645e8ff..7f8d18e1c 100644 --- a/src/video/x11/SDL_x11touch.h +++ b/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/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c index 9d07438ea..01f8ae60f 100644 --- a/src/video/x11/SDL_x11video.c +++ b/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 diff --git a/src/video/x11/SDL_x11video.h b/src/video/x11/SDL_x11video.h index a544113ee..2083defd2 100644 --- a/src/video/x11/SDL_x11video.h +++ b/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 diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index b95056111..afc802198 100644 --- a/src/video/x11/SDL_x11window.c +++ b/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 diff --git a/src/video/x11/SDL_x11window.h b/src/video/x11/SDL_x11window.h index a3424ff62..efe7ec0f0 100644 --- a/src/video/x11/SDL_x11window.h +++ b/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 diff --git a/src/video/x11/SDL_x11xinput2.c b/src/video/x11/SDL_x11xinput2.c index c74e027ce..57132fe9e 100644 --- a/src/video/x11/SDL_x11xinput2.c +++ b/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 diff --git a/src/video/x11/SDL_x11xinput2.h b/src/video/x11/SDL_x11xinput2.h index 06d3c9905..ed8dd1a4a 100644 --- a/src/video/x11/SDL_x11xinput2.h +++ b/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