Browse Source

bumped SDL2 to the latest repository version

fysx 12 years ago
parent
commit
ce866b214c
33 changed files with 1588 additions and 198 deletions
  1. 5 4
      jni/SDL2-2.0.1/CMakeLists.txt
  2. 130 0
      jni/SDL2-2.0.1/README-dynapi.txt
  3. 80 0
      jni/SDL2-2.0.1/README-linux.txt
  4. 42 0
      jni/SDL2-2.0.1/README-windows.txt
  5. 209 0
      jni/SDL2-2.0.1/SDL.tag
  6. 14 2
      jni/SDL2-2.0.1/android-project/src/org/libsdl/app/SDLActivity.java
  7. 5 5
      jni/SDL2-2.0.1/cmake/sdlchecks.cmake
  8. 185 16
      jni/SDL2-2.0.1/configure
  9. 158 11
      jni/SDL2-2.0.1/configure.in
  10. 42 0
      jni/SDL2-2.0.1/doxygen_warn.txt
  11. 4 0
      jni/SDL2-2.0.1/include/SDL_config.h.in
  12. 5 1
      jni/SDL2-2.0.1/src/dynapi/SDL_dynapi.h
  13. 69 25
      jni/SDL2-2.0.1/src/joystick/android/SDL_sysjoystick.c
  14. 42 17
      jni/SDL2-2.0.1/src/test/SDL_test_common.c
  15. 2 2
      jni/SDL2-2.0.1/src/video/SDL_egl.c
  16. 3 0
      jni/SDL2-2.0.1/src/video/SDL_sysvideo.h
  17. 25 8
      jni/SDL2-2.0.1/src/video/SDL_video.c
  18. 10 3
      jni/SDL2-2.0.1/src/video/cocoa/SDL_cocoawindow.m
  19. 195 0
      jni/SDL2-2.0.1/src/video/wayland/SDL_waylanddyn.c
  20. 104 0
      jni/SDL2-2.0.1/src/video/wayland/SDL_waylanddyn.h
  21. 19 13
      jni/SDL2-2.0.1/src/video/wayland/SDL_waylandevents.c
  22. 1 1
      jni/SDL2-2.0.1/src/video/wayland/SDL_waylandevents_c.h
  23. 22 17
      jni/SDL2-2.0.1/src/video/wayland/SDL_waylandmouse.c
  24. 1 1
      jni/SDL2-2.0.1/src/video/wayland/SDL_waylandmouse.h
  25. 7 6
      jni/SDL2-2.0.1/src/video/wayland/SDL_waylandopengles.c
  26. 1 1
      jni/SDL2-2.0.1/src/video/wayland/SDL_waylandopengles.h
  27. 106 0
      jni/SDL2-2.0.1/src/video/wayland/SDL_waylandsym.h
  28. 12 1
      jni/SDL2-2.0.1/src/video/wayland/SDL_waylandtouch.c
  29. 19 18
      jni/SDL2-2.0.1/src/video/wayland/SDL_waylandtouch.h
  30. 55 25
      jni/SDL2-2.0.1/src/video/wayland/SDL_waylandvideo.c
  31. 2 11
      jni/SDL2-2.0.1/src/video/wayland/SDL_waylandvideo.h
  32. 13 9
      jni/SDL2-2.0.1/src/video/wayland/SDL_waylandwindow.c
  33. 1 1
      jni/SDL2-2.0.1/src/video/wayland/SDL_waylandwindow.h

+ 5 - 4
jni/SDL2-2.0.1/CMakeLists.txt

@@ -30,7 +30,7 @@ include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake)
 set(SDL_MAJOR_VERSION 2)
 set(SDL_MINOR_VERSION 0)
 set(SDL_MICRO_VERSION 1)
-set(SDL_INTERFACE_AGE 0)
+set(SDL_INTERFACE_AGE 1)
 set(SDL_BINARY_AGE 1)
 set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
 
@@ -213,6 +213,7 @@ dep_option(PULSEAUDIO_SHARED   "Dynamically load PulseAudio support" ON "PULSEAU
 set_option(ARTS                "Support the Analog Real Time Synthesizer" ${UNIX_SYS})
 dep_option(ARTS_SHARED         "Dynamically load aRts audio support" ON "ARTS" OFF)
 set_option(NAS                 "Support the NAS audio API" ${UNIX_SYS})
+set_option(NAS_SHARED          "Dynamically load NAS audio API" ${UNIX_SYS})
 set_option(SNDIO               "Support the sndio audio API" ${UNIX_SYS})
 set_option(RPATH               "Use an rpath when linking SDL" ${UNIX_SYS})
 set_option(CLOCK_GETTIME       "Use clock_gettime() instead of gettimeofday()" OFF)
@@ -1188,9 +1189,9 @@ message(STATUS " Build Shared Library: ${SDL_SHARED}")
 message(STATUS " Build Static Library: ${SDL_STATIC}")
 message(STATUS "")
 if(UNIX)
-  message(STATUS "Something was not detected, although your are sure that it")
-  message(STATUS "has been properly installed? Then make sure, you have set")
-  message(STATUS "the CFLAGS and LDFLAGS environment variables correctly.")
+  message(STATUS "If something was not detected, although the libraries")
+  message(STATUS "were installed, then make sure you have set the")
+  message(STATUS "CFLAGS and LDFLAGS environment variables correctly.")
   message(STATUS "")
 endif(UNIX)
 

+ 130 - 0
jni/SDL2-2.0.1/README-dynapi.txt

@@ -0,0 +1,130 @@
+================================================================================
+Dynamic API
+================================================================================
+Originally posted by Ryan at https://plus.google.com/103391075724026391227/posts/TB8UfnDYu4U
+
+Background:
+
+- The Steam Runtime has (at least in theory) a really kick-ass build of SDL2, 
+  but developers are shipping their own SDL2 with individual Steam games. 
+  These games might stop getting updates, but a newer SDL2 might be needed later. 
+  Certainly we'll always be fixing bugs in SDL, even if a new video target isn't 
+  ever needed, and these fixes won't make it to a game shipping its own SDL.
+- Even if we replace the SDL2 in those games with a compatible one, that is to 
+  say, edit a developer's Steam depot (yuck!), there are developers that are 
+  statically linking SDL2 that we can't do this for. We can't even force the 
+  dynamic loader to ignore their SDL2 in this case, of course.
+- If you don't ship an SDL2 with the game in some form, people that disabled the
+  Steam Runtime, or just tried to run the game from the command line instead of 
+  Steam might find themselves unable to run the game, due to a missing dependency.
+- If you want to ship on non-Steam platforms like GOG or Humble Bundle, or target
+  generic Linux boxes that may or may not have SDL2 installed, you have to ship 
+  the library or risk a total failure to launch. So now, you might have to have 
+  a non-Steam build plus a Steam build (that is, one with and one without SDL2 
+  included), which is inconvenient if you could have had one universal build 
+  that works everywhere.
+- We like the zlib license, but the biggest complaint from the open source 
+  community about the license change is the static linking. The LGPL forced this 
+  as a legal, not technical issue, but zlib doesn't care. Even those that aren't
+  concerned about the GNU freedoms found themselves solving the same problems: 
+  swapping in a newer SDL to an older game often times can save the day. 
+  Static linking stops this dead.
+
+So here's what we did:
+
+SDL now has, internally, a table of function pointers. So, this is what SDL_Init
+now looks like:
+
+    UInt32 SDL_Init(Uint32 flags)
+    {
+        return jump_table.SDL_Init(flags);
+    }
+
+Except that is all done with a bunch of macro magic so we don't have to maintain
+every one of these.
+
+What is jump_table.SDL_init()? Eventually, that's a function pointer of the real
+SDL_Init() that you've been calling all this time. But at startup, it looks more 
+like this:
+
+    Uint32 SDL_Init_DEFAULT(Uint32 flags)
+    {
+        SDL_InitDynamicAPI();
+        return jump_table.SDL_Init(flags);
+    }
+
+SDL_InitDynamicAPI() fills in jump_table with all the actual SDL function 
+pointers, which means that this _DEFAULT function never gets called again. 
+First call to any SDL function sets the whole thing up.
+
+So you might be asking, what was the value in that? Isn't this what the operating
+system's dynamic loader was supposed to do for us? Yes, but now we've got this 
+level of indirection, we can do things like this:
+
+    export SDL_DYNAMIC_API=/my/actual/libSDL-2.0.so.0
+    ./MyGameThatIsStaticallyLinkedToSDL2
+
+And now, this game that is staticallly linked to SDL, can still be overridden 
+with a newer, or better, SDL. The statically linked one will only be used as 
+far as calling into the jump table in this case. But in cases where no override
+is desired, the statically linked version will provide its own jump table, 
+and everyone is happy.
+
+So now:
+- Developers can statically link SDL, and users can still replace it. 
+  (We'd still rather you ship a shared library, though!)
+- Developers can ship an SDL with their game, Valve can override it for, say, 
+  new features on SteamOS, or distros can override it for their own needs, 
+  but it'll also just work in the default case.
+- Developers can ship the same package to everyone (Humble Bundle, GOG, etc), 
+  and it'll do the right thing.
+- End users (and Valve) can update a game's SDL in almost any case, 
+  to keep abandoned games running on newer platforms.
+- Everyone develops with SDL exactly as they have been doing all along. 
+  Same headers, same ABI. Just get the latest version to enable this magic.
+
+
+A little more about SDL_InitDynamicAPI():
+
+Internally, InitAPI does some locking to make sure everything waits until a 
+single thread initializes everything (although even SDL_CreateThread() goes 
+through here before spinning a thread, too), and then decides if it should use
+an external SDL library. If not, it sets up the jump table using the current 
+SDL's function pointers (which might be statically linked into a program, or in
+a shared library of its own). If so, it loads that library and looks for and 
+calls a single function:
+
+    SInt32 SDL_DYNAPI_entry(Uint32 version, void *table, Uint32 tablesize);
+
+That function takes a version number (more on that in a moment), the address of
+the jump table, and the size, in bytes, of the table. 
+Now, we've got policy here: this table's layout never changes; new stuff gets 
+added to the end. Therefore SDL_DYNAPI_entry() knows that it can provide all 
+the needed functions if tablesize <= sizeof its own jump table. If tablesize is
+bigger (say, SDL 2.0.4 is trying to load SDL 2.0.3), then we know to abort, but
+if it's smaller, we know we can provide the entire API that the caller needs.
+
+The version variable is a failsafe switch. 
+Right now it's always 1. This number changes when there are major API changes 
+(so we know if the tablesize might be smaller, or entries in it have changed). 
+Right now SDL_DYNAPI_entry gives up if the version doesn't match, but it's not 
+inconceivable to have a small dispatch library that only supplies this one 
+function and loads different, otherwise-incompatible SDL libraries and has the
+right one initialize the jump table based on the version. For something that 
+must generically catch lots of different versions of SDL over time, like the 
+Steam Client, this isn't a bad option.
+
+Finally, I'm sure some people are reading this and thinking 
+"I don't want that overhead in my project!"  
+To which I would point out that the extra function call through the jump table 
+probably wouldn't even show up in a profile, but lucky you: this can all be 
+disabled. You can build SDL without this if you absolutely must, but we would 
+encourage you not to do that. However, on heavily locked down platforms like 
+iOS, or maybe when debugging,  it makes sense to disable it. The way this is 
+designed in SDL, you just have to change one #define, and the entire system 
+vaporizes out, and SDL functions exactly like it always did. Most of it is 
+macro magic, so the system is contained to one C file and a few headers. 
+However, this is on by default and you have to edit a header file to turn it 
+off. Our hopes is that if we make it easy to disable, but not too easy, 
+everyone will ultimately be able to get what they want, but we've gently 
+nudged everyone towards what we think is the best solution.

+ 80 - 0
jni/SDL2-2.0.1/README-linux.txt

@@ -0,0 +1,80 @@
+================================================================================
+Simple DirectMedia Layer for Linux
+================================================================================
+
+By default SDL will only link against glibc, the rest of the features will be
+enabled dynamically at runtime depending on the available features on the target
+system. So, for example if you built SDL with Xinerama support and the target
+system does not have the Xinerama libraries installed, it will be disabled
+at runtime, and you won't get a missing library error, at least with the 
+default configuration parameters.
+
+
+================================================================================
+Build Dependencies
+================================================================================
+    
+Ubuntu 13.04, all available features enabled:
+
+sudo apt-get install build-essential mercurial make cmake autoconf automake \
+libtool libasound2-dev libpulse-dev libaudio-dev libx11-dev libxext-dev \
+libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev \
+libxss-dev libgl1-mesa-dev libesd0-dev libdbus-1-dev libudev-dev \
+libgles1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev
+
+NOTES:
+- This includes all the audio targets except arts, because Ubuntu pulled the 
+  artsc0-dev package, but in theory SDL still supports it.
+- DirectFB isn't included because the configure script (currently) fails to find
+  it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the 
+  configure script to include DirectFB support. Send patches.  :)
+
+
+================================================================================
+Joystick does not work
+================================================================================
+
+If you compiled or are using a version of SDL with udev support (and you should!)
+there's a few issues that may cause SDL to fail to detect your joystick. To
+debug this, start by installing the evtest utility. On Ubuntu/Debian:
+
+    sudo apt-get install evtest
+    
+Then run:
+    
+    sudo evtest
+    
+You'll hopefully see your joystick listed along with a name like "/dev/input/eventXX"
+Now run:
+    
+    cat /dev/input/event/XX
+
+If you get a permission error, you need to set a udev rule to change the mode of
+your device (see below)    
+    
+Also, try:
+    
+    sudo udevadm info --query=all --name=input/eventXX
+    
+If you see a line stating ID_INPUT_JOYSTICK=1, great, if you don't see it,
+you need to set up an udev rule to force this variable.
+
+A combined rule for the Saitek Pro Flight Rudder Pedals to fix both issues looks 
+like:
+    
+   SUBSYSTEM=="input", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
+   SUBSYSTEM=="input", ATTRS{idProduct}=="0764", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
+   
+You can set up similar rules for your device by changing the values listed in
+idProduct and idVendor. To obtain these values, try:
+    
+    sudo udevadm info -a --name=input/eventXX | grep idVendor
+    sudo udevadm info -a --name=input/eventXX | grep idProduct
+    
+If multiple values come up for each of these, the one you want is the first one of each.    
+
+On other systems which ship with an older udev (such as CentOS), you may need
+to set up a rule such as:
+    
+    SUBSYSTEM=="input", ENV{ID_CLASS}=="joystick", ENV{ID_INPUT_JOYSTICK}="1"
+

+ 42 - 0
jni/SDL2-2.0.1/README-windows.txt

@@ -0,0 +1,42 @@
+================================================================================
+Simple DirectMedia Layer for Windows
+================================================================================
+
+================================================================================
+OpenGL ES 2.x support
+================================================================================
+
+SDL has support for OpenGL ES 2.x under Windows via two alternative 
+implementations. 
+The most straightforward method consists in running your app in a system with 
+a graphic card paired with a relatively recent (as of November of 2013) driver 
+which supports the WGL_EXT_create_context_es2_profile extension. Vendors known 
+to ship said extension on Windows currently include nVidia and Intel.
+
+The other method involves using the ANGLE library (https://code.google.com/p/angleproject/)
+If an OpenGL ES 2.x context is requested and no WGL_EXT_create_context_es2_profile
+extension is found, SDL will try to load the libEGL.dll library provided by
+ANGLE.
+To obtain the ANGLE binaries, you can either compile from source from
+https://chromium.googlesource.com/angle/angle or copy the relevant binaries from
+a recent Chrome/Chromium install for Windows. The files you need are:
+    
+    * libEGL.dll
+    * libGLESv2.dll
+    * d3dcompiler_46.dll (supports Windows Vista or later, better shader compiler)
+    or...
+    * d3dcompiler_43.dll (supports Windows XP or later)
+    
+If you compile ANGLE from source, you can configure it so it does not need the
+d3dcompiler_* DLL at all (for details on this, see their documentation). 
+However, by default SDL will try to preload the d3dcompiler_46.dll to
+comply with ANGLE's requirements. If you wish SDL to preload d3dcompiler_43.dll (to
+support Windows XP) or to skip this step at all, you can use the 
+SDL_VIDEO_WIN_D3DCOMPILER hint (see SDL_hints.h for more details).
+
+Known Bugs:
+    
+    * SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears
+      that there's a bug in the library which prevents the window contents from
+      refreshing if this is set to anything other than the default value.
+      

File diff suppressed because it is too large
+ 209 - 0
jni/SDL2-2.0.1/SDL.tag


+ 14 - 2
jni/SDL2-2.0.1/android-project/src/org/libsdl/app/SDLActivity.java

@@ -2,6 +2,9 @@ package org.libsdl.app;
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
 
 import android.app.*;
 import android.content.*;
@@ -922,6 +925,13 @@ class SDLJoystickHandler_API12 extends SDLJoystickHandler {
         public String name;
         public ArrayList<InputDevice.MotionRange> axes;
     }
+    class RangeComparator implements Comparator<InputDevice.MotionRange>
+    {
+        @Override
+        public int compare(InputDevice.MotionRange arg0, InputDevice.MotionRange arg1) {
+            return arg0.getAxis() - arg1.getAxis();
+        }
+    }
     
     private ArrayList<SDLJoystick> mJoysticks;
     
@@ -948,8 +958,10 @@ class SDLJoystickHandler_API12 extends SDLJoystickHandler {
                     joystick.name = joystickDevice.getName();
                     joystick.axes = new ArrayList<InputDevice.MotionRange>();
                     
-                    for (InputDevice.MotionRange range : joystickDevice.getMotionRanges()) {
-                         if ( (range.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
+                    List<InputDevice.MotionRange> ranges = joystickDevice.getMotionRanges();
+                    Collections.sort(ranges, new RangeComparator());
+                    for (InputDevice.MotionRange range : ranges ) {
+                        if ( (range.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0 ) {
                             joystick.axes.add(range);
                          }
                     }

+ 5 - 5
jni/SDL2-2.0.1/cmake/sdlchecks.cmake

@@ -491,11 +491,11 @@ macro(CheckX11)
       endif(VIDEO_X11_XSHAPE AND HAVE_XSHAPE_H)
 
       if(VIDEO_X11_XVM AND HAVE_XF86VM_H)
-        if(HAVE_X11_SHARED AND XF86VMODE_LIB)
-          set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "\"${XF86VMODE_LIB_SONAME}\"")
-        else(HAVE_X11_SHARED AND XF86VMODE_LIB)
-          list(APPEND EXTRA_LIBS ${XF86VMODE_LIB})
-        endif(HAVE_X11_SHARED AND XF86VMODE_LIB)
+        if(HAVE_X11_SHARED AND XXF86VM_LIB)
+          set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "\"${XXF86VM_LIB_SONAME}\"")
+        else(HAVE_X11_SHARED AND XXF86VM_LIB)
+          list(APPEND EXTRA_LIBS ${XXF86VM_LIB})
+        endif(HAVE_X11_SHARED AND XXF86VM_LIB)
         set(SDL_VIDEO_DRIVER_X11_XVIDMODE 1)
         set(HAVE_VIDEO_X11_XVM TRUE)
       endif(VIDEO_X11_XVM AND HAVE_XF86VM_H)

+ 185 - 16
jni/SDL2-2.0.1/configure

@@ -819,6 +819,7 @@ enable_diskaudio
 enable_dummyaudio
 enable_video_wayland
 enable_video_wayland_qt_touch
+enable_wayland_shared
 enable_video_x11
 with_x
 enable_x11_shared
@@ -1506,7 +1507,6 @@ Optional Features:
   --enable-loadso         Enable the shared object loading subsystem
                           [[default=yes]]
   --enable-cpuinfo        Enable the cpuinfo subsystem [[default=yes]]
-  --enable-atomic         Enable the atomic operations [[default=yes]]
   --enable-assembly       Enable assembly routines [[default=yes]]
   --enable-ssemath        Allow GCC to use SSE floating point math
                           [[default=no]]
@@ -1538,6 +1538,7 @@ Optional Features:
   --enable-video-wayland-qt-touch
                           QtWayland server support for Wayland video driver
                           [[default=yes]]
+  --enable-wayland-shared dynamically load Wayland support [[default=maybe]]
   --enable-video-x11      use X11 video driver [[default=yes]]
   --enable-x11-shared     dynamically load X11 support [[default=maybe]]
   --enable-video-x11-xcursor
@@ -16819,6 +16820,8 @@ if test x$enable_atomic != xyes; then
 
 $as_echo "#define SDL_ATOMIC_DISABLED 1" >>confdefs.h
 
+else
+    SUMMARY_modules="${SUMMARY_modules} atomic"
 fi
 # Check whether --enable-audio was given.
 if test "${enable_audio+set}" = set; then :
@@ -16831,6 +16834,8 @@ if test x$enable_audio != xyes; then
 
 $as_echo "#define SDL_AUDIO_DISABLED 1" >>confdefs.h
 
+else
+    SUMMARY_modules="${SUMMARY_modules} audio"
 fi
 # Check whether --enable-video was given.
 if test "${enable_video+set}" = set; then :
@@ -16843,6 +16848,8 @@ if test x$enable_video != xyes; then
 
 $as_echo "#define SDL_VIDEO_DISABLED 1" >>confdefs.h
 
+else
+    SUMMARY_modules="${SUMMARY_modules} video"
 fi
 # Check whether --enable-render was given.
 if test "${enable_render+set}" = set; then :
@@ -16855,6 +16862,8 @@ if test x$enable_render != xyes; then
 
 $as_echo "#define SDL_RENDER_DISABLED 1" >>confdefs.h
 
+else
+    SUMMARY_modules="${SUMMARY_modules} render"
 fi
 # Check whether --enable-events was given.
 if test "${enable_events+set}" = set; then :
@@ -16867,6 +16876,8 @@ if test x$enable_events != xyes; then
 
 $as_echo "#define SDL_EVENTS_DISABLED 1" >>confdefs.h
 
+else
+    SUMMARY_modules="${SUMMARY_modules} events"
 fi
 # Check whether --enable-joystick was given.
 if test "${enable_joystick+set}" = set; then :
@@ -16879,6 +16890,8 @@ if test x$enable_joystick != xyes; then
 
 $as_echo "#define SDL_JOYSTICK_DISABLED 1" >>confdefs.h
 
+else
+    SUMMARY_modules="${SUMMARY_modules} joystick"
 fi
 # Check whether --enable-haptic was given.
 if test "${enable_haptic+set}" = set; then :
@@ -16891,6 +16904,8 @@ if test x$enable_haptic != xyes; then
 
 $as_echo "#define SDL_HAPTIC_DISABLED 1" >>confdefs.h
 
+else
+    SUMMARY_modules="${SUMMARY_modules} haptic"
 fi
 # Check whether --enable-power was given.
 if test "${enable_power+set}" = set; then :
@@ -16903,6 +16918,8 @@ if test x$enable_power != xyes; then
 
 $as_echo "#define SDL_POWER_DISABLED 1" >>confdefs.h
 
+else
+    SUMMARY_modules="${SUMMARY_modules} power"
 fi
 # Check whether --enable-filesystem was given.
 if test "${enable_filesystem+set}" = set; then :
@@ -16915,6 +16932,8 @@ if test x$enable_filesystem != xyes; then
 
 $as_echo "#define SDL_FILESYSTEM_DISABLED 1" >>confdefs.h
 
+else
+    SUMMARY_modules="${SUMMARY_modules} filesystem"
 fi
 # Check whether --enable-threads was given.
 if test "${enable_threads+set}" = set; then :
@@ -16927,6 +16946,8 @@ if test x$enable_threads != xyes; then
 
 $as_echo "#define SDL_THREADS_DISABLED 1" >>confdefs.h
 
+else
+    SUMMARY_modules="${SUMMARY_modules} threads"
 fi
 # Check whether --enable-timers was given.
 if test "${enable_timers+set}" = set; then :
@@ -16939,6 +16960,8 @@ if test x$enable_timers != xyes; then
 
 $as_echo "#define SDL_TIMERS_DISABLED 1" >>confdefs.h
 
+else
+    SUMMARY_modules="${SUMMARY_modules} timers"
 fi
 # Check whether --enable-file was given.
 if test "${enable_file+set}" = set; then :
@@ -16951,6 +16974,8 @@ if test x$enable_file != xyes; then
 
 $as_echo "#define SDL_FILE_DISABLED 1" >>confdefs.h
 
+else
+    SUMMARY_modules="${SUMMARY_modules} file"
 fi
 # Check whether --enable-loadso was given.
 if test "${enable_loadso+set}" = set; then :
@@ -16963,6 +16988,8 @@ if test x$enable_loadso != xyes; then
 
 $as_echo "#define SDL_LOADSO_DISABLED 1" >>confdefs.h
 
+else
+    SUMMARY_modules="${SUMMARY_modules} loadso"
 fi
 # Check whether --enable-cpuinfo was given.
 if test "${enable_cpuinfo+set}" = set; then :
@@ -16975,18 +17002,8 @@ if test x$enable_cpuinfo != xyes; then
 
 $as_echo "#define SDL_CPUINFO_DISABLED 1" >>confdefs.h
 
-fi
-# Check whether --enable-atomic was given.
-if test "${enable_atomic+set}" = set; then :
-  enableval=$enable_atomic;
 else
-  enable_atomic=yes
-fi
-
-if test x$enable_atomic != xyes; then
-
-$as_echo "#define SDL_ATOMIC_DISABLED 1" >>confdefs.h
-
+    SUMMARY_modules="${SUMMARY_modules} cpuinfo"
 fi
 # Check whether --enable-assembly was given.
 if test "${enable_assembly+set}" = set; then :
@@ -16996,6 +17013,8 @@ else
 fi
 
 if test x$enable_assembly = xyes; then
+    SUMMARY_modules="${SUMMARY_modules} assembly"
+
 
 $as_echo "#define SDL_ASSEMBLY_ROUTINES 1" >>confdefs.h
 
@@ -17081,6 +17100,7 @@ $as_echo "$have_gcc_mmx" >&6; }
 
         if test x$have_gcc_mmx = xyes; then
             EXTRA_CFLAGS="$EXTRA_CFLAGS $mmx_CFLAGS"
+            SUMMARY_math="${SUMMARY_math} mmx"
         fi
     fi
 
@@ -17131,6 +17151,7 @@ $as_echo "$have_gcc_3dnow" >&6; }
 
         if test x$have_gcc_3dnow = xyes; then
             EXTRA_CFLAGS="$EXTRA_CFLAGS $amd3dnow_CFLAGS"
+            SUMMARY_math="${SUMMARY_math} 3dnow"
         fi
     fi
 
@@ -17187,6 +17208,7 @@ $as_echo "$have_gcc_sse" >&6; }
 
         if test x$have_gcc_sse = xyes; then
             EXTRA_CFLAGS="$EXTRA_CFLAGS $sse_CFLAGS"
+            SUMMARY_math="${SUMMARY_math} sse"
         fi
     fi
 
@@ -17243,6 +17265,7 @@ $as_echo "$have_gcc_sse2" >&6; }
 
         if test x$have_gcc_sse2 = xyes; then
             EXTRA_CFLAGS="$EXTRA_CFLAGS $sse2_CFLAGS"
+            SUMMARY_math="${SUMMARY_math} sse2"
         fi
     fi
 
@@ -17391,6 +17414,7 @@ $as_echo "#define HAVE_ALTIVEC_H 1" >>confdefs.h
 
             fi
             EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
+            SUMMARY_math="${SUMMARY_math} altivec"
         fi
     fi
 fi
@@ -17472,6 +17496,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_oss" >&5
 $as_echo "$have_oss" >&6; }
         if test x$have_oss = xyes; then
+            SUMMARY_audio="${SUMMARY_audio} oss"
 
 $as_echo "#define SDL_AUDIO_DRIVER_OSS 1" >>confdefs.h
 
@@ -17736,8 +17761,10 @@ cat >>confdefs.h <<_ACEOF
 #define SDL_AUDIO_DRIVER_ALSA_DYNAMIC "$alsa_lib"
 _ACEOF
 
+                SUMMARY_audio="${SUMMARY_audio} alsa(dynamic)"
             else
                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS"
+                SUMMARY_audio="${SUMMARY_audio} alsa"
             fi
             have_audio=yes
         fi
@@ -18019,8 +18046,10 @@ cat >>confdefs.h <<_ACEOF
 #define SDL_AUDIO_DRIVER_ESD_DYNAMIC "$esd_lib"
 _ACEOF
 
+                SUMMARY_audio="${SUMMARY_audio} esd(dynamic)"
             else
                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS"
+                SUMMARY_audio="${SUMMARY_audio} esd"
             fi
             have_audio=yes
         fi
@@ -18122,6 +18151,7 @@ cat >>confdefs.h <<_ACEOF
 #define SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC "$pulseaudio_lib"
 _ACEOF
 
+                SUMMARY_audio="${SUMMARY_audio} pulse(dynamic)"
 
                 case "$host" in
                     # On Solaris, pulseaudio must be linked deferred explicitly
@@ -18132,6 +18162,7 @@ _ACEOF
                 esac
             else
                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
+                SUMMARY_audio="${SUMMARY_audio} pulse"
             fi
             have_audio=yes
         fi
@@ -18250,8 +18281,10 @@ cat >>confdefs.h <<_ACEOF
 #define SDL_AUDIO_DRIVER_ARTS_DYNAMIC "$arts_lib"
 _ACEOF
 
+                    SUMMARY_audio="${SUMMARY_audio} arts(dynamic)"
                 else
                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
+                    SUMMARY_audio="${SUMMARY_audio} arts"
                 fi
                 have_audio=yes
             fi
@@ -18357,8 +18390,10 @@ cat >>confdefs.h <<_ACEOF
 #define SDL_AUDIO_DRIVER_NAS_DYNAMIC "$nas_lib"
 _ACEOF
 
+                SUMMARY_audio="${SUMMARY_audio} nas(dynamic)"
             else
                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
+                SUMMARY_audio="${SUMMARY_audio} nas"
             fi
 
 
@@ -18463,8 +18498,10 @@ cat >>confdefs.h <<_ACEOF
 #define SDL_AUDIO_DRIVER_SNDIO_DYNAMIC "$sndio_lib"
 _ACEOF
 
+                SUMMARY_audio="${SUMMARY_audio} sndio(dynamic)"
             else
                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SNDIO_LIBS"
+                SUMMARY_audio="${SUMMARY_audio} sndio"
             fi
 
 
@@ -18491,6 +18528,7 @@ fi
 $as_echo "#define SDL_AUDIO_DRIVER_DISK 1" >>confdefs.h
 
         SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
+        SUMMARY_audio="${SUMMARY_audio} disk"
     fi
 }
 
@@ -18508,6 +18546,7 @@ fi
 $as_echo "#define SDL_AUDIO_DRIVER_DUMMY 1" >>confdefs.h
 
         SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
+        SUMMARY_audio="${SUMMARY_audio} dummy"
     fi
 }
 
@@ -18705,8 +18744,8 @@ $as_echo_n "checking for Wayland support... " >&6; }
         video_wayland=no
         if test x$PKG_CONFIG != xno; then
             if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon ; then
-                WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor egl xkbcommon`
-                WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor egl xkbcommon`
+                WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon`
+                WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
                 video_wayland=yes
             fi
         fi
@@ -18724,7 +18763,71 @@ $as_echo "#define SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1" >>confdefs.h
             fi
             SOURCES="$SOURCES $srcdir/src/video/wayland/*.c"
             EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS"
-                        EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS"
+            # Check whether --enable-wayland-shared was given.
+if test "${enable_wayland_shared+set}" = set; then :
+  enableval=$enable_wayland_shared;
+else
+  enable_wayland_shared=maybe
+fi
+
+
+                        case "$host" in
+                *)
+                    wayland_client_lib=`find_lib "libwayland-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
+                    wayland_egl_lib=`find_lib "libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
+                    if test x$wayland_egl_lib = x; then
+                                                wayland_egl_lib=`find_lib "mesa-egl/libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
+                    fi
+                    wayland_cursor_lib=`find_lib "libwayland-cursor.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
+                    xkbcommon_lib=`find_lib "libxkbcommon.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
+                    ;;
+            esac
+
+            if test x$enable_wayland_shared = xmaybe; then
+                enable_wayland_shared=yes
+            fi
+            if test x$have_loadso != xyes && \
+               test x$enable_wayland_shared = xyes; then
+                { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic WAYLAND loading" >&5
+$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic WAYLAND loading" >&2;}
+                enable_wayland_shared=no
+            fi
+            if test x$have_loadso = xyes && \
+               test x$enable_wayland_shared = xyes && \
+               test x$wayland_client_lib != x && \
+               test x$wayland_egl_lib != x && \
+               test x$wayland_cursor_lib != x && \
+               test x$xkbcommon_lib != x; then
+                echo "-- dynamic libwayland-client -> $wayland_client_lib"
+                echo "-- dynamic libwayland-egl -> $wayland_egl_lib"
+                echo "-- dynamic libwayland-cursor -> $wayland_cursor_lib"
+                echo "-- dynamic xkbcommon -> $xkbcommon_lib"
+
+cat >>confdefs.h <<_ACEOF
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC "$wayland_client_lib"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL "$wayland_egl_lib"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR "$wayland_cursor_lib"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON "$xkbcommon_lib"
+_ACEOF
+
+                SUMMARY_video="${SUMMARY_video} wayland(dynamic)"
+            else
+                enable_wayland_shared=no
+                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS"
+                SUMMARY_video="${SUMMARY_video} wayland"
+            fi
             have_video=yes
         fi
     fi
@@ -19537,9 +19640,11 @@ cat >>confdefs.h <<_ACEOF
 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "$x11ext_lib"
 _ACEOF
 
+                SUMMARY_video="${SUMMARY_video} x11(dynamic)"
             else
                 enable_x11_shared=no
                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
+                SUMMARY_video="${SUMMARY_video} x11"
             fi
             have_video=yes
 
@@ -19761,6 +19866,7 @@ fi
 
 $as_echo "#define SDL_VIDEO_DRIVER_X11_XCURSOR 1" >>confdefs.h
 
+                SUMMARY_video_x11="${SUMMARY_video_x11} xcursor"
             fi
             # Check whether --enable-video-x11-xinerama was given.
 if test "${enable_video_x11_xinerama+set}" = set; then :
@@ -19842,6 +19948,7 @@ fi
 
 $as_echo "#define SDL_VIDEO_DRIVER_X11_XINERAMA 1" >>confdefs.h
 
+                SUMMARY_video_x11="${SUMMARY_video_x11} xinerama"
             fi
             # Check whether --enable-video-x11-xinput was given.
 if test "${enable_video_x11_xinput+set}" = set; then :
@@ -19920,6 +20027,7 @@ fi
                 fi
             fi
             if test x$definitely_enable_video_x11_xinput = xyes; then
+                SUMMARY_video_x11="${SUMMARY_video_x11} xinput2"
 
 $as_echo "#define SDL_VIDEO_DRIVER_X11_XINPUT2 1" >>confdefs.h
 
@@ -19954,6 +20062,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
             	have_xinput2_multitouch=yes
             	$as_echo "#define SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1" >>confdefs.h
 
+                SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch"
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
@@ -20040,6 +20149,7 @@ fi
 
 $as_echo "#define SDL_VIDEO_DRIVER_X11_XRANDR 1" >>confdefs.h
 
+                SUMMARY_video_x11="${SUMMARY_video_x11} xrandr"
             fi
             # Check whether --enable-video-x11-scrnsaver was given.
 if test "${enable_video_x11_scrnsaver+set}" = set; then :
@@ -20120,6 +20230,7 @@ fi
 
 $as_echo "#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1" >>confdefs.h
 
+                SUMMARY_video_x11="${SUMMARY_video_x11} xscrnsaver"
             fi
             # Check whether --enable-video-x11-xshape was given.
 if test "${enable_video_x11_xshape+set}" = set; then :
@@ -20143,6 +20254,7 @@ fi
 
 $as_echo "#define SDL_VIDEO_DRIVER_X11_XSHAPE 1" >>confdefs.h
 
+                    SUMMARY_video_x11="${SUMMARY_video_x11} xshape"
                 fi
             fi
             # Check whether --enable-video-x11-vm was given.
@@ -20225,6 +20337,7 @@ fi
 
 $as_echo "#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1" >>confdefs.h
 
+                SUMMARY_video_x11="${SUMMARY_video_x11} xvidmode"
             fi
         fi
     fi
@@ -20238,6 +20351,7 @@ $as_echo "#define SDL_VIDEO_DRIVER_HAIKU 1" >>confdefs.h
 
         SOURCES="$SOURCES $srcdir/src/video/haiku/*.cc"
         have_video=yes
+        SUMMARY_video="${SUMMARY_video} haiku"
     fi
 }
 
@@ -20284,6 +20398,7 @@ $as_echo "$have_cocoa" >&6; }
 $as_echo "#define SDL_VIDEO_DRIVER_COCOA 1" >>confdefs.h
 
             SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
+            SUMMARY_video="${SUMMARY_video} cocoa"
             have_video=yes
         fi
     fi
@@ -20470,8 +20585,10 @@ cat >>confdefs.h <<_ACEOF
 #define SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC "$directfb_lib"
 _ACEOF
 
+                SUMMARY_video="${SUMMARY_video} directfb(dynamic)"
             else
                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
+                SUMMARY_video="${SUMMARY_video} directfb"
             fi
             { $as_echo "$as_me:${as_lineno-$LINENO}: result: $directfb_shared" >&5
 $as_echo "$directfb_shared" >&6; }
@@ -20577,8 +20694,10 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
                 fusionsound_shared=yes
+                SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)"
             else
                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
+                SUMMARY_audio="${SUMMARY_audio} fusionsound"
             fi
             { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fusionsound_shared" >&5
 $as_echo "$fusionsound_shared" >&6; }
@@ -20603,6 +20722,7 @@ $as_echo "#define SDL_VIDEO_DRIVER_DUMMY 1" >>confdefs.h
 
         SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
         have_video=yes
+        SUMMARY_video="${SUMMARY_video} dummy"
     fi
 }
 
@@ -20653,6 +20773,7 @@ $as_echo "#define SDL_VIDEO_OPENGL_GLX 1" >>confdefs.h
 
 $as_echo "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h
 
+            SUMMARY_video="${SUMMARY_video} opengl"
         fi
     fi
 }
@@ -20732,6 +20853,7 @@ $as_echo "#define SDL_VIDEO_OPENGL_ES 1" >>confdefs.h
 
 $as_echo "#define SDL_VIDEO_RENDER_OGL_ES 1" >>confdefs.h
 
+            SUMMARY_video="${SUMMARY_video} opengl_es1"
         fi
 
         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES v2 headers" >&5
@@ -20767,6 +20889,7 @@ $as_echo "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h
 
 $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h
 
+            SUMMARY_video="${SUMMARY_video} opengl_es2"
         fi
     fi
 }
@@ -20783,6 +20906,7 @@ $as_echo "#define SDL_VIDEO_OPENGL_WGL 1" >>confdefs.h
 
 $as_echo "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h
 
+        SUMMARY_video="${SUMMARY_video} opengl"
     fi
 }
 
@@ -20822,6 +20946,7 @@ $as_echo "#define SDL_VIDEO_OPENGL 1" >>confdefs.h
 
 $as_echo "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h
 
+            SUMMARY_video="${SUMMARY_video} opengl_es1"
         fi
 
         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES v2 headers" >&5
@@ -20860,6 +20985,7 @@ $as_echo "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h
 
 $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h
 
+            SUMMARY_video="${SUMMARY_video} opengl_es2"
         fi
     fi
 }
@@ -20877,6 +21003,7 @@ $as_echo "#define SDL_VIDEO_OPENGL_HAIKU 1" >>confdefs.h
 $as_echo "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h
 
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
+        SUMMARY_video="${SUMMARY_video} opengl"
     fi
 }
 
@@ -20892,6 +21019,7 @@ $as_echo "#define SDL_VIDEO_OPENGL_CGL 1" >>confdefs.h
 
 $as_echo "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h
 
+        SUMMARY_video="${SUMMARY_video} opengl"
         case "$host" in
             *-*-darwin*)
                 if test x$enable_video_cocoa = xyes; then
@@ -20935,6 +21063,7 @@ $as_echo "$use_input_events" >&6; }
 
 $as_echo "#define SDL_INPUT_LINUXEV 1" >>confdefs.h
 
+            SUMMARY_input="${SUMMARY_input} linuxev"
         fi
 }
 
@@ -20974,6 +21103,7 @@ $as_echo "$use_input_kd" >&6; }
 
 $as_echo "#define SDL_INPUT_LINUXKD 1" >>confdefs.h
 
+        SUMMARY_input="${SUMMARY_input} linuxkd"
     fi
 }
 
@@ -21117,6 +21247,7 @@ $as_echo "$enable_input_tslib" >&6; }
 $as_echo "#define SDL_INPUT_TSLIB 1" >>confdefs.h
 
             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
+            SUMMARY_input="${SUMMARY_input} ts"
         fi
     fi
 }
@@ -21640,6 +21771,9 @@ fi
 
 
 
+        SUMMARY_video="${SUMMARY_video} directx"
+        SUMMARY_audio="${SUMMARY_audio} directx"
+
         # FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers.
         # FIXME:  ...so force it off for now.
         case "$host" in
@@ -22960,6 +23094,37 @@ __EOF__
 
 ac_config_files="$ac_config_files Makefile:Makefile.in:Makefile.rules sdl2-config SDL2.spec sdl2.pc"
 
+ac_config_commands="$ac_config_commands sdl2_config"
+
+
+SUMMARY="SDL2 Configure Summary:\n"
+if test x$enable_shared = xyes; then
+    SUMMARY="${SUMMARY}Building Shared Libraries\n"
+fi
+if test x$enable_static = xyes; then
+    SUMMARY="${SUMMARY}Building Static Libraries\n"
+fi
+SUMMARY="${SUMMARY}Enabled modules :${SUMMARY_modules}\n"
+SUMMARY="${SUMMARY}Assembly Math   :${SUMMARY_math}\n"
+SUMMARY="${SUMMARY}Audio drivers   :${SUMMARY_audio}\n"
+SUMMARY="${SUMMARY}Video drivers   :${SUMMARY_video}\n"
+if test x$have_x = xyes; then
+    SUMMARY="${SUMMARY}X11 libraries   :${SUMMARY_video_x11}\n"
+fi
+SUMMARY="${SUMMARY}Input drivers   :${SUMMARY_input}\n"
+if test x$enable_libudev = xyes; then
+    SUMMARY="${SUMMARY}Using libudev   : YES\n"
+else
+    SUMMARY="${SUMMARY}Using libudev   : NO\n"
+fi
+if test x$have_dbus_dbus_h_hdr = xyes; then
+    SUMMARY="${SUMMARY}Using dbus      : YES\n"
+else
+    SUMMARY="${SUMMARY}Using dbus      : NO\n"
+fi
+ac_config_commands="$ac_config_commands summary"
+
+
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
@@ -24027,6 +24192,7 @@ fi
 
 
 
+SUMMARY="$SUMMARY"
 
 _ACEOF
 
@@ -24042,6 +24208,8 @@ do
     "sdl2-config") CONFIG_FILES="$CONFIG_FILES sdl2-config" ;;
     "SDL2.spec") CONFIG_FILES="$CONFIG_FILES SDL2.spec" ;;
     "sdl2.pc") CONFIG_FILES="$CONFIG_FILES sdl2.pc" ;;
+    "sdl2_config") CONFIG_COMMANDS="$CONFIG_COMMANDS sdl2_config" ;;
+    "summary") CONFIG_COMMANDS="$CONFIG_COMMANDS summary" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
@@ -25397,6 +25565,8 @@ compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
 _LT_EOF
 
  ;;
+    "sdl2_config":C) chmod a+x sdl2-config ;;
+    "summary":C) echo -en "$SUMMARY" ;;
 
   esac
 done # for ac_tag
@@ -25435,4 +25605,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
-chmod a+x sdl2-config

+ 158 - 11
jni/SDL2-2.0.1/configure.in

@@ -348,95 +348,119 @@ AC_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [[defa
               , enable_atomic=yes)
 if test x$enable_atomic != xyes; then
     AC_DEFINE(SDL_ATOMIC_DISABLED, 1, [ ])
+else
+    SUMMARY_modules="${SUMMARY_modules} atomic"
 fi
 AC_ARG_ENABLE(audio,
 AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]),
               , enable_audio=yes)
 if test x$enable_audio != xyes; then
     AC_DEFINE(SDL_AUDIO_DISABLED, 1, [ ])
+else
+    SUMMARY_modules="${SUMMARY_modules} audio"
 fi
 AC_ARG_ENABLE(video,
 AC_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]),
               , enable_video=yes)
 if test x$enable_video != xyes; then
     AC_DEFINE(SDL_VIDEO_DISABLED, 1, [ ])
+else
+    SUMMARY_modules="${SUMMARY_modules} video"
 fi
 AC_ARG_ENABLE(render,
 AC_HELP_STRING([--enable-render], [Enable the render subsystem [[default=yes]]]),
               , enable_render=yes)
 if test x$enable_render != xyes; then
     AC_DEFINE(SDL_RENDER_DISABLED, 1, [ ])
+else
+    SUMMARY_modules="${SUMMARY_modules} render"
 fi
 AC_ARG_ENABLE(events,
 AC_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]),
               , enable_events=yes)
 if test x$enable_events != xyes; then
     AC_DEFINE(SDL_EVENTS_DISABLED, 1, [ ])
+else
+    SUMMARY_modules="${SUMMARY_modules} events"
 fi
 AC_ARG_ENABLE(joystick,
 AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes]]]),
               , enable_joystick=yes)
 if test x$enable_joystick != xyes; then
     AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ])
+else
+    SUMMARY_modules="${SUMMARY_modules} joystick"
 fi
 AC_ARG_ENABLE(haptic,
 AC_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]),
               , enable_haptic=yes)
 if test x$enable_haptic != xyes; then
     AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ])
+else
+    SUMMARY_modules="${SUMMARY_modules} haptic"
 fi
 AC_ARG_ENABLE(power,
 AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]),
               , enable_power=yes)
 if test x$enable_power != xyes; then
     AC_DEFINE(SDL_POWER_DISABLED, 1, [ ])
+else
+    SUMMARY_modules="${SUMMARY_modules} power"
 fi
 AC_ARG_ENABLE(filesystem,
 AC_HELP_STRING([--enable-filesystem], [Enable the filesystem subsystem [[default=yes]]]),
               , enable_filesystem=yes)
 if test x$enable_filesystem != xyes; then
     AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ])
+else
+    SUMMARY_modules="${SUMMARY_modules} filesystem"
 fi
 AC_ARG_ENABLE(threads,
 AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]),
               , enable_threads=yes)
 if test x$enable_threads != xyes; then
     AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
+else
+    SUMMARY_modules="${SUMMARY_modules} threads"
 fi
 AC_ARG_ENABLE(timers,
 AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [[default=yes]]]),
               , enable_timers=yes)
 if test x$enable_timers != xyes; then
     AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ])
+else
+    SUMMARY_modules="${SUMMARY_modules} timers"
 fi
 AC_ARG_ENABLE(file,
 AC_HELP_STRING([--enable-file], [Enable the file subsystem [[default=yes]]]),
               , enable_file=yes)
 if test x$enable_file != xyes; then
     AC_DEFINE(SDL_FILE_DISABLED, 1, [ ])
+else
+    SUMMARY_modules="${SUMMARY_modules} file"
 fi
 AC_ARG_ENABLE(loadso,
 AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [[default=yes]]]),
               , enable_loadso=yes)
 if test x$enable_loadso != xyes; then
     AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ])
+else
+    SUMMARY_modules="${SUMMARY_modules} loadso"
 fi
 AC_ARG_ENABLE(cpuinfo,
 AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [[default=yes]]]),
               , enable_cpuinfo=yes)
 if test x$enable_cpuinfo != xyes; then
     AC_DEFINE(SDL_CPUINFO_DISABLED, 1, [ ])
-fi
-AC_ARG_ENABLE(atomic,
-AC_HELP_STRING([--enable-atomic], [Enable the atomic operations [[default=yes]]]),
-              , enable_atomic=yes)
-if test x$enable_atomic != xyes; then
-    AC_DEFINE(SDL_ATOMIC_DISABLED, 1, [ ])
+else
+    SUMMARY_modules="${SUMMARY_modules} cpuinfo"
 fi
 AC_ARG_ENABLE(assembly,
 AC_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]),
               , enable_assembly=yes)
 if test x$enable_assembly = xyes; then
+    SUMMARY_modules="${SUMMARY_modules} assembly"
+
     AC_DEFINE(SDL_ASSEMBLY_ROUTINES, 1, [ ])
 
     # Make sure that we don't generate floating point code that would
@@ -497,6 +521,7 @@ AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]),
 
         if test x$have_gcc_mmx = xyes; then
             EXTRA_CFLAGS="$EXTRA_CFLAGS $mmx_CFLAGS"
+            SUMMARY_math="${SUMMARY_math} mmx"
         fi
     fi
 
@@ -526,6 +551,7 @@ AC_HELP_STRING([--enable-3dnow], [use 3DNow! assembly routines [[default=yes]]])
 
         if test x$have_gcc_3dnow = xyes; then
             EXTRA_CFLAGS="$EXTRA_CFLAGS $amd3dnow_CFLAGS"
+            SUMMARY_math="${SUMMARY_math} 3dnow"
         fi
     fi
 
@@ -562,6 +588,7 @@ AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]),
 
         if test x$have_gcc_sse = xyes; then
             EXTRA_CFLAGS="$EXTRA_CFLAGS $sse_CFLAGS"
+            SUMMARY_math="${SUMMARY_math} sse"
         fi
     fi
 
@@ -598,6 +625,7 @@ AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=no]]]),
 
         if test x$have_gcc_sse2 = xyes; then
             EXTRA_CFLAGS="$EXTRA_CFLAGS $sse2_CFLAGS"
+            SUMMARY_math="${SUMMARY_math} sse2"
         fi
     fi
 
@@ -674,6 +702,7 @@ AC_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]
               AC_DEFINE(HAVE_ALTIVEC_H, 1, [ ])
             fi
             EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
+            SUMMARY_math="${SUMMARY_math} altivec"
         fi
     fi
 fi
@@ -720,6 +749,7 @@ AC_HELP_STRING([--enable-oss], [support the OSS audio API [[default=maybe]]]),
         fi
         AC_MSG_RESULT($have_oss)
         if test x$have_oss = xyes; then
+            SUMMARY_audio="${SUMMARY_audio} oss"
             AC_DEFINE(SDL_AUDIO_DRIVER_OSS, 1, [ ])
             SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c"
             have_audio=yes
@@ -762,8 +792,10 @@ AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[de
                test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
                 echo "-- dynamic libasound -> $alsa_lib"
                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib", [ ])
+                SUMMARY_audio="${SUMMARY_audio} alsa(dynamic)"
             else
                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS"
+                SUMMARY_audio="${SUMMARY_audio} alsa"
             fi
             have_audio=yes
         fi
@@ -795,8 +827,10 @@ AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[defa
                test x$enable_esd_shared = xyes && test x$esd_lib != x; then
                 echo "-- dynamic libesd -> $esd_lib"
                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib", [ ])
+                SUMMARY_audio="${SUMMARY_audio} esd(dynamic)"
             else
                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS"
+                SUMMARY_audio="${SUMMARY_audio} esd"
             fi
             have_audio=yes
         fi
@@ -842,6 +876,7 @@ AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio suppor
                test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then
                 echo "-- dynamic libpulse-simple -> $pulseaudio_lib"
                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib", [ ])
+                SUMMARY_audio="${SUMMARY_audio} pulse(dynamic)"
 
                 case "$host" in
                     # On Solaris, pulseaudio must be linked deferred explicitly
@@ -852,6 +887,7 @@ AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio suppor
                 esac
             else
                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
+                SUMMARY_audio="${SUMMARY_audio} pulse"
             fi
             have_audio=yes
         fi
@@ -900,8 +936,10 @@ AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[de
                    test x$enable_arts_shared = xyes && test x$arts_lib != x; then
                     echo "-- dynamic libartsc -> $arts_lib"
                     AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib", [ ])
+                    SUMMARY_audio="${SUMMARY_audio} arts(dynamic)"
                 else
                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
+                    SUMMARY_audio="${SUMMARY_audio} arts"
                 fi
                 have_audio=yes
             fi
@@ -949,8 +987,10 @@ AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[defa
                test x$enable_nas_shared = xyes && test x$nas_lib != x; then
                 echo "-- dynamic libaudio -> $nas_lib"
                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib", [ ])
+                SUMMARY_audio="${SUMMARY_audio} nas(dynamic)"
             else
                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
+                SUMMARY_audio="${SUMMARY_audio} nas"
             fi
 
             AC_DEFINE(SDL_AUDIO_DRIVER_NAS, 1, [ ])
@@ -995,8 +1035,10 @@ AC_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [[
                test x$enable_sndio_shared = xyes && test x$sndio_lib != x; then
                 echo "-- dynamic libsndio -> $sndio_lib"
                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC, "$sndio_lib", [ ])
+                SUMMARY_audio="${SUMMARY_audio} sndio(dynamic)"
             else
                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SNDIO_LIBS"
+                SUMMARY_audio="${SUMMARY_audio} sndio"
             fi
 
             AC_DEFINE(SDL_AUDIO_DRIVER_SNDIO, 1, [ ])
@@ -1016,6 +1058,7 @@ AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[def
     if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
         AC_DEFINE(SDL_AUDIO_DRIVER_DISK, 1, [ ])
         SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
+        SUMMARY_audio="${SUMMARY_audio} disk"
     fi
 }
 
@@ -1028,6 +1071,7 @@ AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=
     if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then
         AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY, 1, [ ])
         SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
+        SUMMARY_audio="${SUMMARY_audio} dummy"
     fi
 }
 
@@ -1133,8 +1177,8 @@ AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for
         video_wayland=no
         if test x$PKG_CONFIG != xno; then
             if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon ; then
-                WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor egl xkbcommon`
-                WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor egl xkbcommon`
+                WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon`
+                WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
                 video_wayland=yes
             fi
         fi
@@ -1147,8 +1191,52 @@ AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for
             fi
             SOURCES="$SOURCES $srcdir/src/video/wayland/*.c"
             EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS"
-            dnl FIXME do dynamic loading code here.
-            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS"
+            AC_ARG_ENABLE(wayland-shared,
+AC_HELP_STRING([--enable-wayland-shared], [dynamically load Wayland support [[default=maybe]]]),
+                          , enable_wayland_shared=maybe)
+
+            dnl FIXME: Do BSD and OS X need special cases?
+            case "$host" in
+                *)
+                    wayland_client_lib=[`find_lib "libwayland-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
+                    wayland_egl_lib=[`find_lib "libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
+                    if test x$wayland_egl_lib = x; then
+                        dnl This works in Ubuntu 13.10, maybe others
+                        wayland_egl_lib=[`find_lib "mesa-egl/libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
+                    fi
+                    wayland_cursor_lib=[`find_lib "libwayland-cursor.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
+                    xkbcommon_lib=[`find_lib "libxkbcommon.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
+                    ;;
+            esac
+
+            if test x$enable_wayland_shared = xmaybe; then
+                enable_wayland_shared=yes
+            fi
+            if test x$have_loadso != xyes && \
+               test x$enable_wayland_shared = xyes; then
+                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic WAYLAND loading])
+                enable_wayland_shared=no
+            fi
+            if test x$have_loadso = xyes && \
+               test x$enable_wayland_shared = xyes && \
+               test x$wayland_client_lib != x && \
+               test x$wayland_egl_lib != x && \
+               test x$wayland_cursor_lib != x && \
+               test x$xkbcommon_lib != x; then
+                echo "-- dynamic libwayland-client -> $wayland_client_lib"
+                echo "-- dynamic libwayland-egl -> $wayland_egl_lib"
+                echo "-- dynamic libwayland-cursor -> $wayland_cursor_lib"
+                echo "-- dynamic xkbcommon -> $xkbcommon_lib"
+                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC, "$wayland_client_lib", [ ])
+                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL, "$wayland_egl_lib", [ ])
+                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR, "$wayland_cursor_lib", [ ])
+                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON, "$xkbcommon_lib", [ ])
+                SUMMARY_video="${SUMMARY_video} wayland(dynamic)"
+            else
+                enable_wayland_shared=no
+                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS"
+                SUMMARY_video="${SUMMARY_video} wayland"
+            fi
             have_video=yes
         fi
     fi
@@ -1257,9 +1345,11 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=ma
                 echo "-- dynamic libX11ext -> $x11ext_lib"
                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib", [ ])
                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib", [ ])
+                SUMMARY_video="${SUMMARY_video} x11(dynamic)"
             else
                 enable_x11_shared=no
                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
+                SUMMARY_video="${SUMMARY_video} x11"
             fi
             have_video=yes
 
@@ -1336,6 +1426,7 @@ AC_HELP_STRING([--enable-video-x11-xcursor], [enable X11 Xcursor support [[defau
             fi
             if test x$definitely_enable_video_x11_xcursor = xyes; then
                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XCURSOR, 1, [ ])
+                SUMMARY_video_x11="${SUMMARY_video_x11} xcursor"
             fi
             AC_ARG_ENABLE(video-x11-xinerama,
 AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
@@ -1363,6 +1454,7 @@ AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[def
             fi
             if test x$definitely_enable_video_x11_xinerama = xyes; then
                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA, 1, [ ])
+                SUMMARY_video_x11="${SUMMARY_video_x11} xinerama"
             fi
             AC_ARG_ENABLE(video-x11-xinput,
 AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]),
@@ -1389,6 +1481,7 @@ AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for man
                 fi
             fi
             if test x$definitely_enable_video_x11_xinput = xyes; then
+                SUMMARY_video_x11="${SUMMARY_video_x11} xinput2"
                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2, 1, [ ])
                 AC_MSG_CHECKING(for xinput2 multitouch)
             	have_xinput2_multitouch=no
@@ -1407,6 +1500,7 @@ XIAllowTouchEvents(Display *a,int b,unsigned int c,Window d,int f)
             	],[
             	have_xinput2_multitouch=yes
             	AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH)
+                SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch"
             	])
             	AC_MSG_RESULT($have_xinput2_multitouch)
             fi
@@ -1436,6 +1530,7 @@ AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for ful
             fi
             if test x$definitely_enable_video_x11_xrandr = xyes; then
                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR, 1, [ ])
+                SUMMARY_video_x11="${SUMMARY_video_x11} xrandr"
             fi
             AC_ARG_ENABLE(video-x11-scrnsaver,
 AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]),
@@ -1462,6 +1557,7 @@ AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension
             fi
             if test x$definitely_enable_video_x11_scrnsaver = xyes; then
                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSCRNSAVER, 1, [ ])
+                SUMMARY_video_x11="${SUMMARY_video_x11} xscrnsaver"
             fi
             AC_ARG_ENABLE(video-x11-xshape,
 AC_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default=yes]]]),
@@ -1474,6 +1570,7 @@ AC_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default
                                 ])
                 if test x$have_shape_h_hdr = xyes; then
                     AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSHAPE, 1, [ ])
+                    SUMMARY_video_x11="${SUMMARY_video_x11} xshape"
                 fi
             fi
             AC_ARG_ENABLE(video-x11-vm,
@@ -1502,6 +1599,7 @@ AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[d
             fi
             if test x$definitely_enable_video_x11_vm = xyes; then
                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XVIDMODE, 1, [ ])
+                SUMMARY_video_x11="${SUMMARY_video_x11} xvidmode"
             fi
         fi
     fi
@@ -1514,6 +1612,7 @@ CheckHaikuVideo()
         AC_DEFINE(SDL_VIDEO_DRIVER_HAIKU, 1, [ ])
         SOURCES="$SOURCES $srcdir/src/video/haiku/*.cc"
         have_video=yes
+        SUMMARY_video="${SUMMARY_video} haiku"
     fi
 }
 
@@ -1540,6 +1639,7 @@ AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]])
         if test x$have_cocoa = xyes; then
             AC_DEFINE(SDL_VIDEO_DRIVER_COCOA, 1, [ ])
             SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
+            SUMMARY_video="${SUMMARY_video} cocoa"
             have_video=yes
         fi
     fi
@@ -1613,8 +1713,10 @@ AC_MSG_WARN("directfb $directfb_lib")
                 directfb_shared=yes
                 echo "-- $directfb_lib_spec -> $directfb_lib"
                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib", [ ])
+                SUMMARY_video="${SUMMARY_video} directfb(dynamic)"
             else
                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
+                SUMMARY_video="${SUMMARY_video} directfb"
             fi
             AC_MSG_RESULT($directfb_shared)
             have_video=yes
@@ -1662,8 +1764,10 @@ AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audi
                test x$enable_fusionsound_shared = xyes; then
                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so", [ ])
                 fusionsound_shared=yes
+                SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)"
             else
                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
+                SUMMARY_audio="${SUMMARY_audio} fusionsound"
             fi
             AC_MSG_RESULT($fusionsound_shared)
             
@@ -1682,6 +1786,7 @@ AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]])
         AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY, 1, [ ])
         SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
         have_video=yes
+        SUMMARY_video="${SUMMARY_video} dummy"
     fi
 }
 
@@ -1708,6 +1813,7 @@ CheckOpenGLX11()
             AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
             AC_DEFINE(SDL_VIDEO_OPENGL_GLX, 1, [ ])
             AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
+            SUMMARY_video="${SUMMARY_video} opengl"
         fi
     fi
 }
@@ -1747,6 +1853,7 @@ CheckOpenGLESX11()
         if test x$video_opengles_v1 = xyes; then
             AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ])
             AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ])
+            SUMMARY_video="${SUMMARY_video} opengl_es1"
         fi
         
         AC_MSG_CHECKING(for OpenGL ES v2 headers)
@@ -1762,6 +1869,7 @@ CheckOpenGLESX11()
         if test x$video_opengles_v2 = xyes; then
             AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
             AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
+            SUMMARY_video="${SUMMARY_video} opengl_es2"
         fi
     fi
 }
@@ -1773,6 +1881,7 @@ CheckWINDOWSGL()
         AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
         AC_DEFINE(SDL_VIDEO_OPENGL_WGL, 1, [ ])
         AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
+        SUMMARY_video="${SUMMARY_video} opengl"
     fi
 }
 
@@ -1793,6 +1902,7 @@ CheckWINDOWSGLES()
         if test x$video_opengl_egl = xyes; then
             AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
             AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
+            SUMMARY_video="${SUMMARY_video} opengl_es1"
         fi
        
         AC_MSG_CHECKING(for OpenGL ES v2 headers)
@@ -1809,6 +1919,7 @@ CheckWINDOWSGLES()
             AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
             AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
             AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
+            SUMMARY_video="${SUMMARY_video} opengl_es2"
         fi
     fi
 }
@@ -1821,6 +1932,7 @@ CheckHaikuGL()
         AC_DEFINE(SDL_VIDEO_OPENGL_HAIKU, 1, [ ])
         AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
+        SUMMARY_video="${SUMMARY_video} opengl"
     fi
 }
 
@@ -1831,6 +1943,7 @@ CheckMacGL()
         AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
         AC_DEFINE(SDL_VIDEO_OPENGL_CGL, 1, [ ])
         AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
+        SUMMARY_video="${SUMMARY_video} opengl"
         case "$host" in
             *-*-darwin*)
                 if test x$enable_video_cocoa = xyes; then
@@ -1858,6 +1971,7 @@ CheckInputEvents()
         AC_MSG_RESULT($use_input_events)
         if test x$use_input_events = xyes; then
             AC_DEFINE(SDL_INPUT_LINUXEV, 1, [ ])
+            SUMMARY_input="${SUMMARY_input} linuxev"
         fi
 }
 
@@ -1880,6 +1994,7 @@ CheckInputKD()
     AC_MSG_RESULT($use_input_kd)
     if test x$use_input_kd = xyes; then
         AC_DEFINE(SDL_INPUT_LINUXKD, 1, [ ])
+        SUMMARY_input="${SUMMARY_input} linuxkd"
     fi
 }
 
@@ -1942,6 +2057,7 @@ AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[
         if test x$enable_input_tslib = xyes; then
             AC_DEFINE(SDL_INPUT_TSLIB, 1, [ ])
             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
+            SUMMARY_input="${SUMMARY_input} ts"
         fi
     fi
 }
@@ -2220,6 +2336,9 @@ AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[defaul
         AC_CHECK_HEADER(dinput.h, have_dinput=yes)
         AC_CHECK_HEADER(xaudio2.h, have_xaudio2=yes)
 
+        SUMMARY_video="${SUMMARY_video} directx"
+        SUMMARY_audio="${SUMMARY_audio} directx"
+
         # FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers.
         # FIXME:  ...so force it off for now.
         case "$host" in
@@ -3034,5 +3153,33 @@ __EOF__
 AC_CONFIG_FILES([
     Makefile:Makefile.in:Makefile.rules sdl2-config SDL2.spec sdl2.pc
 ])
+AC_CONFIG_COMMANDS([sdl2_config],[chmod a+x sdl2-config])
+
+SUMMARY="SDL2 Configure Summary:\n"
+if test x$enable_shared = xyes; then
+    SUMMARY="${SUMMARY}Building Shared Libraries\n"
+fi
+if test x$enable_static = xyes; then
+    SUMMARY="${SUMMARY}Building Static Libraries\n"
+fi
+SUMMARY="${SUMMARY}Enabled modules :${SUMMARY_modules}\n"
+SUMMARY="${SUMMARY}Assembly Math   :${SUMMARY_math}\n" 
+SUMMARY="${SUMMARY}Audio drivers   :${SUMMARY_audio}\n"
+SUMMARY="${SUMMARY}Video drivers   :${SUMMARY_video}\n"
+if test x$have_x = xyes; then
+    SUMMARY="${SUMMARY}X11 libraries   :${SUMMARY_video_x11}\n"
+fi
+SUMMARY="${SUMMARY}Input drivers   :${SUMMARY_input}\n"
+if test x$enable_libudev = xyes; then
+    SUMMARY="${SUMMARY}Using libudev   : YES\n"
+else
+    SUMMARY="${SUMMARY}Using libudev   : NO\n"
+fi
+if test x$have_dbus_dbus_h_hdr = xyes; then
+    SUMMARY="${SUMMARY}Using dbus      : YES\n"
+else
+    SUMMARY="${SUMMARY}Using dbus      : NO\n"
+fi
+AC_CONFIG_COMMANDS([summary], [echo -en "$SUMMARY"], [SUMMARY="$SUMMARY"])
+
 AC_OUTPUT
-chmod a+x sdl2-config

File diff suppressed because it is too large
+ 42 - 0
jni/SDL2-2.0.1/doxygen_warn.txt


+ 4 - 0
jni/SDL2-2.0.1/include/SDL_config.h.in

@@ -263,6 +263,10 @@
 #undef SDL_VIDEO_DRIVER_WINDOWS
 #undef SDL_VIDEO_DRIVER_WAYLAND
 #undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
+#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
+#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL
+#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
+#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
 #undef SDL_VIDEO_DRIVER_X11
 #undef SDL_VIDEO_DRIVER_RPI
 #undef SDL_VIDEO_DRIVER_X11_DYNAMIC

+ 5 - 1
jni/SDL2-2.0.1/src/dynapi/SDL_dynapi.h

@@ -39,7 +39,11 @@
 #error Nope, you have to edit this file to force this off.
 #endif
 
-#if defined(__APPLE__) && TARGET_OS_IPHONE  /* probably not useful on iOS. */
+#ifdef __APPLE__
+#include "TargetConditionals.h"
+#endif
+
+#if TARGET_OS_IPHONE  /* probably not useful on iOS. */
 #define SDL_DYNAMIC_API 0
 #else   /* everyone else. */
 #define SDL_DYNAMIC_API 1

+ 69 - 25
jni/SDL2-2.0.1/src/joystick/android/SDL_sysjoystick.c

@@ -85,35 +85,70 @@ keycode_to_SDL(int keycode)
     int button = 0;
     switch(keycode) 
     {
-        /* D-Pad key codes (API 1), these get mapped to 0...4 */
-        case AKEYCODE_DPAD_UP:
-        case AKEYCODE_DPAD_DOWN:
-        case AKEYCODE_DPAD_LEFT:
-        case AKEYCODE_DPAD_RIGHT:
-        case AKEYCODE_DPAD_CENTER:
-            button = keycode - AKEYCODE_DPAD_UP;
-            break;
-        
-        /* Some gamepad buttons (API 9), these get mapped to 5...19*/
+        /* Some gamepad buttons (API 9) */
         case AKEYCODE_BUTTON_A:
+            button = SDL_CONTROLLER_BUTTON_A;
+            break;
         case AKEYCODE_BUTTON_B:
-        case AKEYCODE_BUTTON_C:
+            button = SDL_CONTROLLER_BUTTON_B;
+            break;
         case AKEYCODE_BUTTON_X:
+            button = SDL_CONTROLLER_BUTTON_X;
+            break;
         case AKEYCODE_BUTTON_Y:
-        case AKEYCODE_BUTTON_Z:
+            button = SDL_CONTROLLER_BUTTON_Y;
+            break;
         case AKEYCODE_BUTTON_L1:
-        case AKEYCODE_BUTTON_L2:
+            button = SDL_CONTROLLER_BUTTON_LEFTSHOULDER;
+            break;
         case AKEYCODE_BUTTON_R1:
-        case AKEYCODE_BUTTON_R2:
+            button = SDL_CONTROLLER_BUTTON_RIGHTSHOULDER;
+            break;
         case AKEYCODE_BUTTON_THUMBL:
+            button = SDL_CONTROLLER_BUTTON_LEFTSTICK;
+            break;
         case AKEYCODE_BUTTON_THUMBR:
+            button = SDL_CONTROLLER_BUTTON_RIGHTSTICK;
+            break;
         case AKEYCODE_BUTTON_START:
+            button = SDL_CONTROLLER_BUTTON_START;
+            break;
         case AKEYCODE_BUTTON_SELECT:
+            button = SDL_CONTROLLER_BUTTON_BACK;
+            break;
         case AKEYCODE_BUTTON_MODE:
-            button = keycode - AKEYCODE_BUTTON_A + 5;
+            button = SDL_CONTROLLER_BUTTON_GUIDE;
             break;
-            
-        
+        case AKEYCODE_BUTTON_L2:
+            button = SDL_CONTROLLER_BUTTON_MAX; /* Not supported by GameController */
+            break;
+        case AKEYCODE_BUTTON_R2:
+            button = SDL_CONTROLLER_BUTTON_MAX+1; /* Not supported by GameController */
+            break;
+        case AKEYCODE_BUTTON_C:
+            button = SDL_CONTROLLER_BUTTON_MAX+2; /* Not supported by GameController */
+            break;
+        case AKEYCODE_BUTTON_Z:
+            button = SDL_CONTROLLER_BUTTON_MAX+3; /* Not supported by GameController */
+            break;
+                        
+        /* D-Pad key codes (API 1) */
+        case AKEYCODE_DPAD_UP:
+            button = SDL_CONTROLLER_BUTTON_DPAD_UP;
+            break;
+        case AKEYCODE_DPAD_DOWN:
+            button = SDL_CONTROLLER_BUTTON_DPAD_DOWN;
+            break;
+        case AKEYCODE_DPAD_LEFT:
+            button = SDL_CONTROLLER_BUTTON_DPAD_LEFT;
+            break;
+        case AKEYCODE_DPAD_RIGHT:
+            button = SDL_CONTROLLER_BUTTON_DPAD_RIGHT;
+            break;
+        case AKEYCODE_DPAD_CENTER:
+            button = SDL_CONTROLLER_BUTTON_MAX+4; /* Not supported by GameController */
+            break;
+
         /* More gamepad buttons (API 12), these get mapped to 20...35*/
         case AKEYCODE_BUTTON_1:
         case AKEYCODE_BUTTON_2:
@@ -131,7 +166,7 @@ keycode_to_SDL(int keycode)
         case AKEYCODE_BUTTON_14:
         case AKEYCODE_BUTTON_15:
         case AKEYCODE_BUTTON_16:
-            button = keycode - AKEYCODE_BUTTON_1 + 20;
+            button = keycode - AKEYCODE_BUTTON_1 + SDL_CONTROLLER_BUTTON_MAX + 5;
             break;
             
         default:
@@ -284,6 +319,10 @@ Android_RemoveJoystick(int device_id)
     }
 
     const int retval = item->device_instance;
+    if (item->joystick) {
+        item->joystick->hwdata = NULL;
+    }
+        
     if (prev != NULL) {
         prev->next = item->next;
     } else {
@@ -458,12 +497,10 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
     while (item) {
         if (item->is_accelerometer) {
             if (item->joystick) {
-                SDL_bool updated = Android_JNI_GetAccelerometerValues(values);
-                if (updated) {
-                    for ( i = 0; i < 3; i++ ) {
-                        value = (Sint16)(values[i] * 32767.0f);
-                        SDL_PrivateJoystickAxis(item->joystick, i, value);
-                    }
+                Android_JNI_GetAccelerometerValues(values);
+                for ( i = 0; i < 3; i++ ) {
+                    value = (Sint16)(values[i] * 32767.0f);
+                    SDL_PrivateJoystickAxis(item->joystick, i, value);
                 }
             }
             break;
@@ -509,7 +546,14 @@ SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
 
 SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
 {
-    return ((SDL_joylist_item*)joystick->hwdata)->guid;
+    SDL_JoystickGUID guid;
+    
+    if (joystick->hwdata != NULL) {
+        return ((SDL_joylist_item*)joystick->hwdata)->guid;
+    }
+    
+    SDL_zero(guid);
+    return guid;
 }
 
 #endif /* SDL_JOYSTICK_ANDROID */

+ 42 - 17
jni/SDL2-2.0.1/src/test/SDL_test_common.c

@@ -1281,9 +1281,17 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
             {
                 SDL_Window *window = SDL_GetWindowFromID(event->window.windowID);
                 if (window) {
-                    SDL_DestroyWindow(window);
                     for (i = 0; i < state->num_windows; ++i) {
                         if (window == state->windows[i]) {
+                            if (state->targets[i]) {
+                                SDL_DestroyTexture(state->targets[i]);
+                                state->targets[i] = NULL;
+                            }
+                            if (state->renderers[i]) {
+                                SDL_DestroyRenderer(state->renderers[i]);
+                                state->renderers[i] = NULL;
+                            }
+                            SDL_DestroyWindow(state->windows[i]);
                             state->windows[i] = NULL;
                             break;
                         }
@@ -1293,7 +1301,11 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
             break;
         }
         break;
-    case SDL_KEYDOWN:
+    case SDL_KEYDOWN: {
+        SDL_bool withControl = !!(event->key.keysym.mod & KMOD_CTRL);
+        SDL_bool withShift = !!(event->key.keysym.mod & KMOD_SHIFT);
+        SDL_bool withAlt = !!(event->key.keysym.mod & KMOD_ALT);
+
         switch (event->key.keysym.sym) {
             /* Add hotkeys here */
         case SDLK_PRINTSCREEN: {
@@ -1308,7 +1320,7 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
             }
             break;
         case SDLK_EQUALS:
-            if (event->key.keysym.mod & KMOD_CTRL) {
+            if (withControl) {
                 /* Ctrl-+ double the size of the window */
                 SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
                 if (window) {
@@ -1319,7 +1331,7 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
             }
             break;
         case SDLK_MINUS:
-            if (event->key.keysym.mod & KMOD_CTRL) {
+            if (withControl) {
                 /* Ctrl-- half the size of the window */
                 SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
                 if (window) {
@@ -1330,12 +1342,12 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
             }
             break;
         case SDLK_c:
-            if (event->key.keysym.mod & KMOD_CTRL) {
+            if (withControl) {
                 /* Ctrl-C copy awesome text! */
                 SDL_SetClipboardText("SDL rocks!\nYou know it!");
                 printf("Copied text to clipboard\n");
             }
-            if (event->key.keysym.mod & KMOD_ALT) {
+            if (withAlt) {
                 /* Alt-C toggle a render clip rectangle */
                 for (i = 0; i < state->num_windows; ++i) {
                     int w, h;
@@ -1357,7 +1369,7 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
             }
             break;
         case SDLK_v:
-            if (event->key.keysym.mod & KMOD_CTRL) {
+            if (withControl) {
                 /* Ctrl-V paste awesome text! */
                 char *text = SDL_GetClipboardText();
                 if (*text) {
@@ -1369,7 +1381,7 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
             }
             break;
         case SDLK_g:
-            if (event->key.keysym.mod & KMOD_CTRL) {
+            if (withControl) {
                 /* Ctrl-G toggle grab */
                 SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
                 if (window) {
@@ -1378,7 +1390,7 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
             }
             break;
         case SDLK_m:
-            if (event->key.keysym.mod & KMOD_CTRL) {
+            if (withControl) {
                 /* Ctrl-M maximize */
                 SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
                 if (window) {
@@ -1392,13 +1404,13 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
             }
             break;
         case SDLK_r:
-            if (event->key.keysym.mod & KMOD_CTRL) {
+            if (withControl) {
                 /* Ctrl-R toggle mouse relative mode */
                 SDL_SetRelativeMouseMode(!SDL_GetRelativeMouseMode() ? SDL_TRUE : SDL_FALSE);
             }
             break;
         case SDLK_z:
-            if (event->key.keysym.mod & KMOD_CTRL) {
+            if (withControl) {
                 /* Ctrl-Z minimize */
                 SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
                 if (window) {
@@ -1407,7 +1419,7 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
             }
             break;
         case SDLK_RETURN:
-            if (event->key.keysym.mod & KMOD_CTRL) {
+            if (withControl) {
                 /* Ctrl-Enter toggle fullscreen */
                 SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
                 if (window) {
@@ -1418,7 +1430,7 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
                         SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN);
                     }
                 }
-            } else if (event->key.keysym.mod & KMOD_ALT) {
+            } else if (withAlt) {
                 /* Alt-Enter toggle fullscreen desktop */
                 SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
                 if (window) {
@@ -1429,10 +1441,22 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
                         SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
                     }
                 }
+            } else if (withShift) {
+                /* Shift-Enter toggle fullscreen desktop / fullscreen */
+                SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
+                if (window) {
+                    Uint32 flags = SDL_GetWindowFlags(window);
+                    if ((flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) {
+                        SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN);
+                    } else {
+                        SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
+                    }
+                }
             }
+
             break;
         case SDLK_b:
-            if (event->key.keysym.mod & KMOD_CTRL) {
+            if (withControl) {
                 /* Ctrl-B toggle window border */
                 SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
                 if (window) {
@@ -1443,18 +1467,18 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
             }
             break;
         case SDLK_0:
-            if (event->key.keysym.mod & KMOD_CTRL) {
+            if (withControl) {
                 SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
                 SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "Test Message", "You're awesome!", window);
             }
             break;
         case SDLK_1:
-            if (event->key.keysym.mod & KMOD_CTRL) {
+            if (withControl) {
                 FullscreenTo(0, event->key.windowID);
             }
             break;
         case SDLK_2:
-            if (event->key.keysym.mod & KMOD_CTRL) {
+            if (withControl) {
                 FullscreenTo(1, event->key.windowID);
             }
             break;
@@ -1474,6 +1498,7 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
             break;
         }
         break;
+    }
     case SDL_QUIT:
         *done = 1;
         break;

+ 2 - 2
jni/SDL2-2.0.1/src/video/SDL_egl.c

@@ -181,8 +181,8 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa
     if (egl_path != NULL) {
         dll_handle = SDL_LoadObject(egl_path);
     }   
-    /* Catch the case where the application isn't linked with EGL */
-    if ((SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) && (egl_path == NULL)) {
+    /* Try loading a EGL symbol, if it does not work try the default library paths */
+    if (SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) {
         if (dll_handle != NULL) {
             SDL_UnloadObject(dll_handle);
         }

+ 3 - 0
jni/SDL2-2.0.1/src/video/SDL_sysvideo.h

@@ -79,6 +79,7 @@ struct SDL_Window
     int min_w, min_h;
     int max_w, max_h;
     Uint32 flags;
+    Uint32 last_fullscreen_flags;
 
     /* Stored position and size for windowed mode */
     SDL_Rect windowed;
@@ -92,6 +93,8 @@ struct SDL_Window
     SDL_Surface *surface;
     SDL_bool surface_valid;
 
+    SDL_bool is_destroying;
+
     SDL_WindowShaper *shaper;
 
     SDL_WindowUserData *data;

+ 25 - 8
jni/SDL2-2.0.1/src/video/SDL_video.c

@@ -83,11 +83,11 @@ static VideoBootStrap *bootstrap[] = {
 #if SDL_VIDEO_DRIVER_RPI
     &RPI_bootstrap,
 #endif 
-#if SDL_VIDEO_DRIVER_DUMMY
-    &DUMMY_bootstrap,
-#endif
 #if SDL_VIDEO_DRIVER_WAYLAND
     &Wayland_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_DUMMY
+    &DUMMY_bootstrap,
 #endif
     NULL
 };
@@ -115,6 +115,7 @@ static SDL_VideoDevice *_this = NULL;
         return retval; \
     }
 
+#define FULLSCREEN_MASK ( SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN )
 
 #ifdef __MACOSX__
 /* Support for Mac OS X fullscreen spaces */
@@ -446,8 +447,10 @@ SDL_VideoInit(const char *driver_name)
     if (driver_name != NULL) {
         for (i = 0; bootstrap[i]; ++i) {
             if (SDL_strncasecmp(bootstrap[i]->name, driver_name, SDL_strlen(driver_name)) == 0) {
-                video = bootstrap[i]->create(index);
-                break;
+                if (bootstrap[i]->available()) {
+                    video = bootstrap[i]->create(index);
+                    break;
+                }
             }
         }
     } else {
@@ -1096,6 +1099,7 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
 
 #ifdef __MACOSX__
     if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) {
+        window->last_fullscreen_flags = window->flags;
         return;
     }
 #endif
@@ -1112,7 +1116,9 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
 
     /* See if anything needs to be done now */
     if ((display->fullscreen_window == window) == fullscreen) {
-        return;
+        if ((window->last_fullscreen_flags & FULLSCREEN_MASK) == (window->flags & FULLSCREEN_MASK)) {
+            return;
+        }
     }
 
     /* See if there are any fullscreen windows */
@@ -1157,6 +1163,8 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
                 }
 
                 SDL_RestoreMousePosition(other);
+
+                window->last_fullscreen_flags = window->flags;
                 return;
             }
         }
@@ -1175,6 +1183,8 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
 
     /* Restore the cursor position */
     SDL_RestoreMousePosition(window);
+
+    window->last_fullscreen_flags = window->flags;
 }
 
 #define CREATE_FLAGS \
@@ -1277,8 +1287,10 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
         }
     }
     window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
+    window->last_fullscreen_flags = window->flags;
     window->brightness = 1.0f;
     window->next = _this->windows;
+    window->is_destroying = SDL_FALSE;
 
     if (_this->windows) {
         _this->windows->prev = window;
@@ -1318,6 +1330,8 @@ SDL_CreateWindowFrom(const void *data)
     window->magic = &_this->window_magic;
     window->id = _this->next_object_id++;
     window->flags = SDL_WINDOW_FOREIGN;
+    window->last_fullscreen_flags = window->flags;
+    window->is_destroying = SDL_FALSE;
     window->brightness = 1.0f;
     window->next = _this->windows;
     if (_this->windows) {
@@ -1378,6 +1392,8 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
     window->title = NULL;
     window->icon = NULL;
     window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
+    window->last_fullscreen_flags = window->flags;
+    window->is_destroying = SDL_FALSE;
 
     if (_this->CreateWindow && !(flags & SDL_WINDOW_FOREIGN)) {
         if (_this->CreateWindow(_this, window) < 0) {
@@ -1857,7 +1873,6 @@ SDL_RestoreWindow(SDL_Window * window)
     }
 }
 
-#define FULLSCREEN_MASK ( SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN )
 int
 SDL_SetWindowFullscreen(SDL_Window * window, Uint32 flags)
 {
@@ -2159,7 +2174,7 @@ ShouldMinimizeOnFocusLoss(SDL_Window * window)
 {
     const char *hint;
 
-    if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
+    if (!(window->flags & SDL_WINDOW_FULLSCREEN) || window->is_destroying) {
         return SDL_FALSE;
     }
 
@@ -2218,6 +2233,8 @@ SDL_DestroyWindow(SDL_Window * window)
 
     CHECK_WINDOW_MAGIC(window, );
 
+    window->is_destroying = SDL_TRUE;
+
     /* Restore video mode, etc. */
     SDL_HideWindow(window);
 

+ 10 - 3
jni/SDL2-2.0.1/src/video/cocoa/SDL_cocoawindow.m

@@ -299,9 +299,14 @@ SetWindowStyle(SDL_Window * window, unsigned int style)
        !!! FIXME:   http://bugzilla.libsdl.org/show_bug.cgi?id=1825
     */
     windows = [NSApp orderedWindows];
-    if ([windows count] > 0) {
-        NSWindow *win = (NSWindow *) [windows objectAtIndex:0];
+    for (NSWindow *win in windows)
+    {
+        if (win == window) {
+            continue;
+        }
+
         [win makeKeyAndOrderFront:self];
+        break;
     }
 }
 
@@ -699,9 +704,11 @@ SetWindowStyle(SDL_Window * window, unsigned int style)
             touches = [event touchesMatchingPhase:NSTouchPhaseBegan inView:nil];
             break;
         case COCOA_TOUCH_UP:
-        case COCOA_TOUCH_CANCELLED:
             touches = [event touchesMatchingPhase:NSTouchPhaseEnded inView:nil];
             break;
+        case COCOA_TOUCH_CANCELLED:
+            touches = [event touchesMatchingPhase:NSTouchPhaseCancelled inView:nil];
+            break;
         case COCOA_TOUCH_MOVE:
             touches = [event touchesMatchingPhase:NSTouchPhaseMoved inView:nil];
             break;

+ 195 - 0
jni/SDL2-2.0.1/src/video/wayland/SDL_waylanddyn.c

@@ -0,0 +1,195 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WAYLAND
+
+#define DEBUG_DYNAMIC_WAYLAND 0
+
+#include "SDL_waylanddyn.h"
+
+#if DEBUG_DYNAMIC_WAYLAND
+#include "SDL_log.h"
+#endif
+
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
+
+#include "SDL_name.h"
+#include "SDL_loadso.h"
+
+typedef struct
+{
+    void *lib;
+    const char *libname;
+} waylanddynlib;
+
+#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC NULL
+#endif
+#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL NULL
+#endif
+#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR NULL
+#endif
+#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON NULL
+#endif
+
+static waylanddynlib waylandlibs[] = {
+    {NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC},
+    {NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL},
+    {NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR},
+    {NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON}
+};
+
+static void *
+WAYLAND_GetSym(const char *fnname, int *pHasModule)
+{
+    int i;
+    void *fn = NULL;
+    for (i = 0; i < SDL_TABLESIZE(waylandlibs); i++) {
+        if (waylandlibs[i].lib != NULL) {
+            fn = SDL_LoadFunction(waylandlibs[i].lib, fnname);
+            if (fn != NULL)
+                break;
+        }
+    }
+
+#if DEBUG_DYNAMIC_WAYLAND
+    if (fn != NULL)
+        SDL_Log("WAYLAND: Found '%s' in %s (%p)\n", fnname, waylandlibs[i].libname, fn);
+    else
+        SDL_Log("WAYLAND: Symbol '%s' NOT FOUND!\n", fnname);
+#endif
+
+    if (fn == NULL)
+        *pHasModule = 0;  /* kill this module. */
+
+    return fn;
+}
+
+#endif /* SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */
+
+/* Define all the function pointers and wrappers... */
+#define SDL_WAYLAND_MODULE(modname) int SDL_WAYLAND_HAVE_##modname = 0;
+#define SDL_WAYLAND_SYM(rc,fn,params) SDL_DYNWAYLANDFN_##fn WAYLAND_##fn = NULL;
+#define SDL_WAYLAND_INTERFACE(iface) const struct wl_interface *WAYLAND_##iface = NULL;
+#include "SDL_waylandsym.h"
+#undef SDL_WAYLAND_MODULE
+#undef SDL_WAYLAND_SYM
+#undef SDL_WAYLAND_INTERFACE
+
+static int wayland_load_refcount = 0;
+
+void
+SDL_WAYLAND_UnloadSymbols(void)
+{
+    /* Don't actually unload if more than one module is using the libs... */
+    if (wayland_load_refcount > 0) {
+        if (--wayland_load_refcount == 0) {
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC            
+            int i;
+#endif
+            
+            /* set all the function pointers to NULL. */
+#define SDL_WAYLAND_MODULE(modname) SDL_WAYLAND_HAVE_##modname = 0;
+#define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = NULL;
+#define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = NULL;
+#include "SDL_waylandsym.h"
+#undef SDL_WAYLAND_MODULE
+#undef SDL_WAYLAND_SYM
+#undef SDL_WAYLAND_INTERFACE
+
+
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
+            for (i = 0; i < SDL_TABLESIZE(waylandlibs); i++) {
+                if (waylandlibs[i].lib != NULL) {
+                    SDL_UnloadObject(waylandlibs[i].lib);
+                    waylandlibs[i].lib = NULL;
+                }
+            }
+#endif
+        }
+    }
+}
+
+/* returns non-zero if all needed symbols were loaded. */
+int
+SDL_WAYLAND_LoadSymbols(void)
+{
+    int rc = 1;                 /* always succeed if not using Dynamic WAYLAND stuff. */
+
+    /* deal with multiple modules (dga, wayland, etc) needing these symbols... */
+    if (wayland_load_refcount++ == 0) {
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
+        int i;
+        int *thismod = NULL;
+        for (i = 0; i < SDL_TABLESIZE(waylandlibs); i++) {
+            if (waylandlibs[i].libname != NULL) {
+                waylandlibs[i].lib = SDL_LoadObject(waylandlibs[i].libname);
+            }
+        }
+
+#define SDL_WAYLAND_MODULE(modname) SDL_WAYLAND_HAVE_##modname = 1; /* default yes */
+#define SDL_WAYLAND_SYM(rc,fn,params)
+#define SDL_WAYLAND_INTERFACE(iface)
+#include "SDL_waylandsym.h"
+#undef SDL_WAYLAND_MODULE
+#undef SDL_WAYLAND_SYM
+#undef SDL_WAYLAND_INTERFACE
+
+#define SDL_WAYLAND_MODULE(modname) thismod = &SDL_WAYLAND_HAVE_##modname;
+#define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = (SDL_DYNWAYLANDFN_##fn) WAYLAND_GetSym(#fn,thismod);
+#define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = (struct wl_interface *) WAYLAND_GetSym(#iface,thismod);
+#include "SDL_waylandsym.h"
+#undef SDL_WAYLAND_MODULE
+#undef SDL_WAYLAND_SYM
+#undef SDL_WAYLAND_INTERFACE
+
+        if (SDL_WAYLAND_HAVE_WAYLAND_CLIENT) {
+            /* all required symbols loaded. */
+            SDL_ClearError();
+        } else {
+            /* in case something got loaded... */
+            SDL_WAYLAND_UnloadSymbols();
+            rc = 0;
+        }
+
+#else  /* no dynamic WAYLAND */
+
+#define SDL_WAYLAND_MODULE(modname) SDL_WAYLAND_HAVE_##modname = 1; /* default yes */
+#define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
+#define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = &iface;
+#include "SDL_waylandsym.h"
+#undef SDL_WAYLAND_MODULE
+#undef SDL_WAYLAND_SYM
+#undef SDL_WAYLAND_INTERFACE
+
+#endif
+    }
+
+    return rc;
+}
+
+#endif /* SDL_VIDEO_DRIVER_WAYLAND */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 104 - 0
jni/SDL2-2.0.1/src/video/wayland/SDL_waylanddyn.h

@@ -0,0 +1,104 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
+
+  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_waylanddyn_h
+#define _SDL_waylanddyn_h
+
+#include "../../SDL_internal.h"
+
+/* We can't include wayland-client.h here 
+ * but we need some structs from it
+ */
+struct wl_interface;
+struct wl_proxy;
+struct wl_event_queue;
+struct wl_display;
+struct wl_surface;
+struct wl_shm;
+
+#include <stdint.h>
+#include "wayland-cursor.h"
+#include "wayland-util.h"
+#include "xkbcommon/xkbcommon.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+int SDL_WAYLAND_LoadSymbols(void);
+void SDL_WAYLAND_UnloadSymbols(void);
+
+#define SDL_WAYLAND_MODULE(modname) extern int SDL_WAYLAND_HAVE_##modname;
+#define SDL_WAYLAND_SYM(rc,fn,params) \
+    typedef rc (*SDL_DYNWAYLANDFN_##fn) params; \
+    extern SDL_DYNWAYLANDFN_##fn WAYLAND_##fn;
+#define SDL_WAYLAND_INTERFACE(iface) extern const struct wl_interface *WAYLAND_##iface;
+#include "SDL_waylandsym.h"
+#undef SDL_WAYLAND_MODULE
+#undef SDL_WAYLAND_SYM
+#undef SDL_WAYLAND_INTERFACE
+ 
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
+
+#ifdef _WAYLAND_CLIENT_H
+#error Do not include wayland-client ahead of SDL_waylanddyn.h in dynamic loading mode
+#endif
+
+/* wayland-client-protocol.h included from wayland-client.h
+ * has inline functions that require these to be defined in dynamic loading mode
+ */
+
+#define wl_proxy_create (*WAYLAND_wl_proxy_create)
+#define wl_proxy_destroy (*WAYLAND_wl_proxy_destroy)
+#define wl_proxy_marshal (*WAYLAND_wl_proxy_marshal)
+#define wl_proxy_set_user_data (*WAYLAND_wl_proxy_set_user_data)
+#define wl_proxy_get_user_data (*WAYLAND_wl_proxy_get_user_data)
+#define wl_proxy_add_listener (*WAYLAND_wl_proxy_add_listener)
+#define wl_proxy_marshal_constructor (*WAYLAND_wl_proxy_marshal_constructor)
+
+#define wl_seat_interface (*WAYLAND_wl_seat_interface)
+#define wl_surface_interface (*WAYLAND_wl_surface_interface)
+#define wl_shm_pool_interface (*WAYLAND_wl_shm_pool_interface)
+#define wl_buffer_interface (*WAYLAND_wl_buffer_interface)
+#define wl_registry_interface (*WAYLAND_wl_registry_interface)
+#define wl_shell_surface_interface (*WAYLAND_wl_shell_surface_interface)
+#define wl_region_interface (*WAYLAND_wl_region_interface)
+#define wl_pointer_interface (*WAYLAND_wl_pointer_interface)
+#define wl_keyboard_interface (*WAYLAND_wl_keyboard_interface)
+#define wl_compositor_interface (*WAYLAND_wl_compositor_interface)
+#define wl_output_interface (*WAYLAND_wl_output_interface)
+#define wl_shell_interface (*WAYLAND_wl_shell_interface)
+#define wl_shm_interface (*WAYLAND_wl_shm_interface)
+
+#endif /* SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */
+
+#include "wayland-client.h"
+#include "wayland-egl.h"
+
+#endif /* !defined _SDL_waylanddyn_h */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 19 - 13
jni/SDL2-2.0.1/src/video/wayland/SDL_waylandevents.c

@@ -19,7 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WAYLAND
 
 #include "SDL_stdinc.h"
 #include "SDL_assert.h"
@@ -32,6 +34,8 @@
 #include "SDL_waylandevents_c.h"
 #include "SDL_waylandwindow.h"
 
+#include "SDL_waylanddyn.h"
+
 #include <linux/input.h>
 #include <sys/select.h>
 #include <sys/mman.h>
@@ -60,14 +64,14 @@ Wayland_PumpEvents(_THIS)
     SDL_VideoData *d = _this->driverdata;
     struct pollfd pfd[1];
 
-    pfd[0].fd = wl_display_get_fd(d->display);
+    pfd[0].fd = WAYLAND_wl_display_get_fd(d->display);
     pfd[0].events = POLLIN;
     poll(pfd, 1, 0);
 
     if (pfd[0].revents & POLLIN)
-        wl_display_dispatch(d->display);
+        WAYLAND_wl_display_dispatch(d->display);
     else
-        wl_display_dispatch_pending(d->display);
+        WAYLAND_wl_display_dispatch_pending(d->display);
 }
 
 static void
@@ -199,7 +203,7 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
         return;
     }
 
-    input->xkb.keymap = xkb_map_new_from_string(input->display->xkb_context,
+    input->xkb.keymap = WAYLAND_xkb_keymap_new_from_string(input->display->xkb_context,
                                                 map_str,
                                                 XKB_KEYMAP_FORMAT_TEXT_V1,
                                                 0);
@@ -211,10 +215,10 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
         return;
     }
 
-    input->xkb.state = xkb_state_new(input->xkb.keymap);
+    input->xkb.state = WAYLAND_xkb_state_new(input->xkb.keymap);
     if (!input->xkb.state) {
         fprintf(stderr, "failed to create XKB state\n");
-        xkb_map_unref(input->xkb.keymap);
+        WAYLAND_xkb_keymap_unref(input->xkb.keymap);
         input->xkb.keymap = NULL;
         return;
     }
@@ -266,11 +270,11 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard,
         return;
 
     // TODO can this happen?
-    if (xkb_key_get_syms(input->xkb.state, key + 8, &syms) != 1)
+    if (WAYLAND_xkb_state_key_get_syms(input->xkb.state, key + 8, &syms) != 1)
         return;
 
     if (state) {
-        size = xkb_keysym_to_utf8(syms[0], text, sizeof text);
+        size = WAYLAND_xkb_keysym_to_utf8(syms[0], text, sizeof text);
 
         if (size > 0) {
             text[size] = 0;
@@ -287,7 +291,7 @@ keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard,
 {
     struct SDL_WaylandInput *input = data;
 
-    xkb_state_update_mask(input->xkb.state, mods_depressed, mods_latched,
+    WAYLAND_xkb_state_update_mask(input->xkb.state, mods_depressed, mods_latched,
                           mods_locked, 0, 0, group);
 }
 
@@ -349,7 +353,7 @@ Wayland_display_add_input(SDL_VideoData *d, uint32_t id)
     wl_seat_add_listener(input->seat, &seat_listener, input);
     wl_seat_set_user_data(input->seat, input);
 
-    wayland_schedule_write(d);
+    WAYLAND_wl_display_flush(d->display);
 }
 
 void Wayland_display_destroy_input(SDL_VideoData *d)
@@ -369,13 +373,15 @@ void Wayland_display_destroy_input(SDL_VideoData *d)
         wl_seat_destroy(input->seat);
 
     if (input->xkb.state)
-        xkb_state_unref(input->xkb.state);
+        WAYLAND_xkb_state_unref(input->xkb.state);
 
     if (input->xkb.keymap)
-        xkb_map_unref(input->xkb.keymap);
+        WAYLAND_xkb_keymap_unref(input->xkb.keymap);
 
     free(input);
     d->input = NULL;
 }
 
+#endif /* SDL_VIDEO_DRIVER_WAYLAND */
+
 /* vi: set ts=4 sw=4 expandtab: */

+ 1 - 1
jni/SDL2-2.0.1/src/video/wayland/SDL_waylandevents_c.h

@@ -19,7 +19,7 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
 
 #ifndef _SDL_waylandevents_h
 #define _SDL_waylandevents_h

+ 22 - 17
jni/SDL2-2.0.1/src/video/wayland/SDL_waylandmouse.c

@@ -19,6 +19,10 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WAYLAND
+
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
@@ -33,15 +37,16 @@
 
 #include "../SDL_sysvideo.h"
 
-#include "SDL_config.h"
 #include "SDL_mouse.h"
 #include "../../events/SDL_mouse_c.h"
 #include "SDL_waylandvideo.h"
 #include "SDL_waylandevents_c.h"
 
+#include "SDL_waylanddyn.h"
+#include "wayland-cursor.h"
+
 #include "SDL_assert.h"
 
-#if SDL_VIDEO_DRIVER_WAYLAND
 
 typedef struct {
     struct wl_buffer   *buffer;
@@ -210,7 +215,7 @@ CreateCursorFromWlCursor(SDL_VideoData *d, struct wl_cursor *wlcursor)
         data->buffer = NULL;
         data->surface = wl_compositor_create_surface(d->compositor);
         wl_surface_attach(data->surface,
-                          wl_cursor_image_get_buffer(wlcursor->images[0]),
+                          WAYLAND_wl_cursor_image_get_buffer(wlcursor->images[0]),
                           0,
                           0);
         wl_surface_damage(data->surface,
@@ -236,7 +241,7 @@ Wayland_CreateDefaultCursor()
     SDL_VideoData *data = device->driverdata;
 
     return CreateCursorFromWlCursor (data,
-                                     wl_cursor_theme_get_cursor(data->cursor_theme,
+                                     WAYLAND_wl_cursor_theme_get_cursor(data->cursor_theme,
                                                                 "left_ptr"));
 }
 
@@ -254,40 +259,40 @@ Wayland_CreateSystemCursor(SDL_SystemCursor id)
         SDL_assert(0);
         return NULL;
     case SDL_SYSTEM_CURSOR_ARROW:
-        cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "left_ptr");
+        cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "left_ptr");
         break;
     case SDL_SYSTEM_CURSOR_IBEAM:
-        cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "xterm");
+        cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "xterm");
         break;
     case SDL_SYSTEM_CURSOR_WAIT:
-        cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "wait");
+        cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "wait");
         break;
     case SDL_SYSTEM_CURSOR_CROSSHAIR:
-        cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
+        cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
         break;
     case SDL_SYSTEM_CURSOR_WAITARROW:
-        cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "wait");
+        cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "wait");
         break;
     case SDL_SYSTEM_CURSOR_SIZENWSE:
-        cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
+        cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
         break;
     case SDL_SYSTEM_CURSOR_SIZENESW:
-        cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
+        cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
         break;
     case SDL_SYSTEM_CURSOR_SIZEWE:
-        cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
+        cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
         break;
     case SDL_SYSTEM_CURSOR_SIZENS:
-        cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
+        cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
         break;
     case SDL_SYSTEM_CURSOR_SIZEALL:
-        cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
+        cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
         break;
     case SDL_SYSTEM_CURSOR_NO:
-        cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "xterm");
+        cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "xterm");
         break;
     case SDL_SYSTEM_CURSOR_HAND:
-        cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
+        cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
         break;
     }
 
@@ -404,4 +409,4 @@ Wayland_FiniMouse(void)
     mouse->WarpMouse = NULL;
     mouse->SetRelativeMouseMode = NULL;
 }
-#endif
+#endif  /* SDL_VIDEO_DRIVER_WAYLAND */

+ 1 - 1
jni/SDL2-2.0.1/src/video/wayland/SDL_waylandmouse.h

@@ -19,7 +19,7 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
 #include "SDL_mouse.h"
 #include "SDL_waylandvideo.h"
 

+ 7 - 6
jni/SDL2-2.0.1/src/video/wayland/SDL_waylandopengles.c

@@ -18,7 +18,7 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
 
 #if SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL
 
@@ -26,6 +26,7 @@
 #include "SDL_waylandopengles.h"
 #include "SDL_waylandwindow.h"
 #include "SDL_waylandevents_c.h"
+#include "SDL_waylanddyn.h"
 
 /* EGL implementation of SDL OpenGL ES support */
 
@@ -37,7 +38,7 @@ Wayland_GLES_LoadLibrary(_THIS, const char *path) {
     ret = SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display);
 
     Wayland_PumpEvents(_this);
-    wayland_schedule_write(data);
+    WAYLAND_wl_display_flush(data->display);
     
     return ret;
 }
@@ -48,7 +49,7 @@ Wayland_GLES_CreateContext(_THIS, SDL_Window * window)
 {
     SDL_GLContext context;
     context = SDL_EGL_CreateContext(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
-    wayland_schedule_write(_this->driverdata);
+    WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
     
     return context;
 }
@@ -57,7 +58,7 @@ void
 Wayland_GLES_SwapWindow(_THIS, SDL_Window *window)
 {
     SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
-    wayland_schedule_write(_this->driverdata);
+    WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
 }
 
 
@@ -73,7 +74,7 @@ Wayland_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
         ret = SDL_EGL_MakeCurrent(_this, NULL, NULL);
     }
     
-    wayland_schedule_write(_this->driverdata);
+    WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
     
     return ret;
 }
@@ -82,7 +83,7 @@ void
 Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context)
 {
     SDL_EGL_DeleteContext(_this, context);
-    wayland_schedule_write(_this->driverdata);
+    WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
 }
 
 #endif /* SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL */

+ 1 - 1
jni/SDL2-2.0.1/src/video/wayland/SDL_waylandopengles.h

@@ -18,7 +18,7 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
 
 #ifndef _SDL_waylandopengles_h
 #define _SDL_waylandopengles_h

+ 106 - 0
jni/SDL2-2.0.1/src/video/wayland/SDL_waylandsym.h

@@ -0,0 +1,106 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
+
+  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.
+*/
+
+/* *INDENT-OFF* */
+
+SDL_WAYLAND_MODULE(WAYLAND_CLIENT)
+SDL_WAYLAND_SYM(void, wl_proxy_marshal, (struct wl_proxy *, uint32_t, ...))
+SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_create, (struct wl_proxy *, const struct wl_interface *))
+SDL_WAYLAND_SYM(void, wl_proxy_destroy, (struct wl_proxy *))
+SDL_WAYLAND_SYM(int, wl_proxy_add_listener, (struct wl_proxy *, void (**)(void), void *))
+SDL_WAYLAND_SYM(void, wl_proxy_set_user_data, (struct wl_proxy *, void *))
+SDL_WAYLAND_SYM(void *, wl_proxy_get_user_data, (struct wl_proxy *))
+SDL_WAYLAND_SYM(uint32_t, wl_proxy_get_id, (struct wl_proxy *))
+SDL_WAYLAND_SYM(const char *, wl_proxy_get_class, (struct wl_proxy *))
+SDL_WAYLAND_SYM(void, wl_proxy_set_queue, (struct wl_proxy *, struct wl_event_queue *))
+SDL_WAYLAND_SYM(struct wl_display *, wl_display_connect, (const char *))
+SDL_WAYLAND_SYM(struct wl_display *, wl_display_connect_to_fd, (int))
+SDL_WAYLAND_SYM(void, wl_display_disconnect, (struct wl_display *))
+SDL_WAYLAND_SYM(int, wl_display_get_fd, (struct wl_display *))
+SDL_WAYLAND_SYM(int, wl_display_dispatch, (struct wl_display *))
+SDL_WAYLAND_SYM(int, wl_display_dispatch_queue, (struct wl_display *, struct wl_event_queue *))
+SDL_WAYLAND_SYM(int, wl_display_dispatch_queue_pending, (struct wl_display *, struct wl_event_queue *))
+SDL_WAYLAND_SYM(int, wl_display_dispatch_pending, (struct wl_display *))
+SDL_WAYLAND_SYM(int, wl_display_get_error, (struct wl_display *))
+SDL_WAYLAND_SYM(int, wl_display_flush, (struct wl_display *))
+SDL_WAYLAND_SYM(int, wl_display_roundtrip, (struct wl_display *))
+SDL_WAYLAND_SYM(struct wl_event_queue *, wl_display_create_queue, (struct wl_display *))
+SDL_WAYLAND_SYM(void, wl_log_set_handler_client, (wl_log_func_t))
+SDL_WAYLAND_SYM(void, wl_list_init, (struct wl_list *))
+SDL_WAYLAND_SYM(void, wl_list_insert, (struct wl_list *, struct wl_list *) )
+SDL_WAYLAND_SYM(void, wl_list_remove, (struct wl_list *))
+SDL_WAYLAND_SYM(int, wl_list_length, (const struct wl_list *))
+SDL_WAYLAND_SYM(int, wl_list_empty, (const struct wl_list *))
+SDL_WAYLAND_SYM(void, wl_list_insert_list, (struct wl_list *, struct wl_list *))
+
+/* These functions are available in Wayland >= 1.4 */
+SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_4)
+SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_marshal_constructor, (struct wl_proxy *, uint32_t opcode, const struct wl_interface *interface, ...))
+
+SDL_WAYLAND_INTERFACE(wl_seat_interface)
+SDL_WAYLAND_INTERFACE(wl_surface_interface)
+SDL_WAYLAND_INTERFACE(wl_shm_pool_interface)
+SDL_WAYLAND_INTERFACE(wl_buffer_interface)
+SDL_WAYLAND_INTERFACE(wl_registry_interface)
+SDL_WAYLAND_INTERFACE(wl_shell_surface_interface)
+SDL_WAYLAND_INTERFACE(wl_region_interface)
+SDL_WAYLAND_INTERFACE(wl_pointer_interface)
+SDL_WAYLAND_INTERFACE(wl_keyboard_interface)
+SDL_WAYLAND_INTERFACE(wl_compositor_interface)
+SDL_WAYLAND_INTERFACE(wl_output_interface)
+SDL_WAYLAND_INTERFACE(wl_shell_interface)
+SDL_WAYLAND_INTERFACE(wl_shm_interface)
+
+SDL_WAYLAND_MODULE(WAYLAND_EGL)
+SDL_WAYLAND_SYM(struct wl_egl_window *, wl_egl_window_create, (struct wl_surface *, int, int))
+SDL_WAYLAND_SYM(void, wl_egl_window_destroy, (struct wl_egl_window *))
+SDL_WAYLAND_SYM(void, wl_egl_window_resize, (struct wl_egl_window *, int, int, int, int))
+SDL_WAYLAND_SYM(void, wl_egl_window_get_attached_size, (struct wl_egl_window *, int *, int *))
+
+SDL_WAYLAND_MODULE(WAYLAND_CURSOR)
+SDL_WAYLAND_SYM(struct wl_cursor_theme *, wl_cursor_theme_load, (const char *, int , struct wl_shm *))
+SDL_WAYLAND_SYM(void, wl_cursor_theme_destroy, (struct wl_cursor_theme *))
+SDL_WAYLAND_SYM(struct wl_cursor *, wl_cursor_theme_get_cursor, (struct wl_cursor_theme *, const char *))
+SDL_WAYLAND_SYM(struct wl_buffer *, wl_cursor_image_get_buffer, (struct wl_cursor_image *))
+SDL_WAYLAND_SYM(int, wl_cursor_frame, (struct wl_cursor *, uint32_t))
+
+SDL_WAYLAND_MODULE(WAYLAND_XKB)
+SDL_WAYLAND_SYM(int, xkb_state_key_get_syms, (struct xkb_state *, xkb_keycode_t, const xkb_keysym_t **))
+SDL_WAYLAND_SYM(int, xkb_keysym_to_utf8, (xkb_keysym_t, char *, size_t) )
+SDL_WAYLAND_SYM(struct xkb_keymap *, xkb_keymap_new_from_string, (struct xkb_context *, const char *, enum xkb_keymap_format, enum xkb_keymap_compile_flags))
+SDL_WAYLAND_SYM(struct xkb_state *, xkb_state_new, (struct xkb_keymap *) )
+SDL_WAYLAND_SYM(void, xkb_keymap_unref, (struct xkb_keymap *) )
+SDL_WAYLAND_SYM(void, xkb_state_unref, (struct xkb_state *) )
+SDL_WAYLAND_SYM(void, xkb_context_unref, (struct xkb_context *) )
+SDL_WAYLAND_SYM(struct xkb_context *, xkb_context_new, (enum xkb_context_flags flags) )
+SDL_WAYLAND_SYM(enum xkb_state_component, xkb_state_update_mask, (struct xkb_state *state,\
+                      xkb_mod_mask_t depressed_mods,\
+                      xkb_mod_mask_t latched_mods,\
+                      xkb_mod_mask_t locked_mods,\
+                      xkb_layout_index_t depressed_layout,\
+                      xkb_layout_index_t latched_layout,\
+                      xkb_layout_index_t locked_layout) )
+
+
+/* *INDENT-ON* */
+
+/* vi: set ts=4 sw=4 expandtab: */
+//SDL_WAYLAND_SYM(ret, fn, params)

+ 12 - 1
jni/SDL2-2.0.1/src/video/wayland/SDL_waylandtouch.c

@@ -21,7 +21,7 @@
 
 /* Contributed by Thomas Perl <[email protected]> */
 
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
 
 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
 
@@ -118,6 +118,7 @@ touch_handle_configure(void *data,
 {
 }
 
+
 /* wayland-qt-touch-extension.c BEGINS */
 
 static const struct qt_touch_extension_listener touch_listener = {
@@ -183,13 +184,23 @@ WL_EXPORT const struct wl_interface qt_windowmanager_interface = {
 
 /* wayland-qt-surface-extension.c BEGINS */
 extern const struct wl_interface qt_extended_surface_interface;
+#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
 extern const struct wl_interface wl_surface_interface;
+#endif
 
 static const struct wl_interface *qt_surface_extension_types[] = {
     NULL,
     NULL,
     &qt_extended_surface_interface,
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
+    /* FIXME: Set this dynamically to (*WAYLAND_wl_surface_interface) ? 
+     * The value comes from auto generated code and does 
+     * not appear to actually be used anywhere
+     */
+    NULL, 
+#else
     &wl_surface_interface,
+#endif    
 };
 
 static const struct wl_message qt_surface_extension_requests[] = {

+ 19 - 18
jni/SDL2-2.0.1/src/video/wayland/SDL_waylandtouch.h

@@ -19,7 +19,7 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
 
 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
 
@@ -29,8 +29,9 @@
 #include "SDL_waylandvideo.h"
 #include <stdint.h>
 #include <stddef.h>
-#include "wayland-client.h"
 #include "wayland-util.h"
+#include "SDL_waylanddyn.h"
+
 
 void Wayland_touch_create(SDL_VideoData *data, uint32_t id);
 void Wayland_touch_destroy(SDL_VideoData *data);
@@ -89,7 +90,7 @@ qt_surface_extension_get_user_data(struct qt_surface_extension *qt_surface_exten
 static inline void
 qt_surface_extension_destroy(struct qt_surface_extension *qt_surface_extension)
 {
-    wl_proxy_destroy((struct wl_proxy *) qt_surface_extension);
+    WAYLAND_wl_proxy_destroy((struct wl_proxy *) qt_surface_extension);
 }
 
 static inline struct qt_extended_surface *
@@ -102,7 +103,7 @@ qt_surface_extension_get_extended_surface(struct qt_surface_extension *qt_surfac
     if (!id)
         return NULL;
 
-    wl_proxy_marshal((struct wl_proxy *) qt_surface_extension,
+    WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_surface_extension,
              QT_SURFACE_EXTENSION_GET_EXTENDED_SURFACE, id, surface);
 
     return (struct qt_extended_surface *) id;
@@ -166,39 +167,39 @@ qt_extended_surface_add_listener(struct qt_extended_surface *qt_extended_surface
 static inline void
 qt_extended_surface_set_user_data(struct qt_extended_surface *qt_extended_surface, void *user_data)
 {
-    wl_proxy_set_user_data((struct wl_proxy *) qt_extended_surface, user_data);
+    WAYLAND_wl_proxy_set_user_data((struct wl_proxy *) qt_extended_surface, user_data);
 }
 
 static inline void *
 qt_extended_surface_get_user_data(struct qt_extended_surface *qt_extended_surface)
 {
-    return wl_proxy_get_user_data((struct wl_proxy *) qt_extended_surface);
+    return WAYLAND_wl_proxy_get_user_data((struct wl_proxy *) qt_extended_surface);
 }
 
 static inline void
 qt_extended_surface_destroy(struct qt_extended_surface *qt_extended_surface)
 {
-    wl_proxy_destroy((struct wl_proxy *) qt_extended_surface);
+    WAYLAND_wl_proxy_destroy((struct wl_proxy *) qt_extended_surface);
 }
 
 static inline void
 qt_extended_surface_update_generic_property(struct qt_extended_surface *qt_extended_surface, const char *name, struct wl_array *value)
 {
-    wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
+    WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
              QT_EXTENDED_SURFACE_UPDATE_GENERIC_PROPERTY, name, value);
 }
 
 static inline void
 qt_extended_surface_set_content_orientation(struct qt_extended_surface *qt_extended_surface, int32_t orientation)
 {
-    wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
+    WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
              QT_EXTENDED_SURFACE_SET_CONTENT_ORIENTATION, orientation);
 }
 
 static inline void
 qt_extended_surface_set_window_flags(struct qt_extended_surface *qt_extended_surface, int32_t flags)
 {
-    wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
+    WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
              QT_EXTENDED_SURFACE_SET_WINDOW_FLAGS, flags);
 }
 
@@ -269,25 +270,25 @@ qt_touch_extension_add_listener(struct qt_touch_extension *qt_touch_extension,
 static inline void
 qt_touch_extension_set_user_data(struct qt_touch_extension *qt_touch_extension, void *user_data)
 {
-    wl_proxy_set_user_data((struct wl_proxy *) qt_touch_extension, user_data);
+    WAYLAND_wl_proxy_set_user_data((struct wl_proxy *) qt_touch_extension, user_data);
 }
 
 static inline void *
 qt_touch_extension_get_user_data(struct qt_touch_extension *qt_touch_extension)
 {
-    return wl_proxy_get_user_data((struct wl_proxy *) qt_touch_extension);
+    return WAYLAND_wl_proxy_get_user_data((struct wl_proxy *) qt_touch_extension);
 }
 
 static inline void
 qt_touch_extension_destroy(struct qt_touch_extension *qt_touch_extension)
 {
-    wl_proxy_destroy((struct wl_proxy *) qt_touch_extension);
+    WAYLAND_wl_proxy_destroy((struct wl_proxy *) qt_touch_extension);
 }
 
 static inline void
 qt_touch_extension_dummy(struct qt_touch_extension *qt_touch_extension)
 {
-    wl_proxy_marshal((struct wl_proxy *) qt_touch_extension,
+    WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_touch_extension,
              QT_TOUCH_EXTENSION_DUMMY);
 }
 
@@ -324,25 +325,25 @@ qt_windowmanager_add_listener(struct qt_windowmanager *qt_windowmanager,
 static inline void
 qt_windowmanager_set_user_data(struct qt_windowmanager *qt_windowmanager, void *user_data)
 {
-    wl_proxy_set_user_data((struct wl_proxy *) qt_windowmanager, user_data);
+    WAYLAND_wl_proxy_set_user_data((struct wl_proxy *) qt_windowmanager, user_data);
 }
 
 static inline void *
 qt_windowmanager_get_user_data(struct qt_windowmanager *qt_windowmanager)
 {
-    return wl_proxy_get_user_data((struct wl_proxy *) qt_windowmanager);
+    return WAYLAND_wl_proxy_get_user_data((struct wl_proxy *) qt_windowmanager);
 }
 
 static inline void
 qt_windowmanager_destroy(struct qt_windowmanager *qt_windowmanager)
 {
-    wl_proxy_destroy((struct wl_proxy *) qt_windowmanager);
+    WAYLAND_wl_proxy_destroy((struct wl_proxy *) qt_windowmanager);
 }
 
 static inline void
 qt_windowmanager_open_url(struct qt_windowmanager *qt_windowmanager, uint32_t remaining, const char *url)
 {
-    wl_proxy_marshal((struct wl_proxy *) qt_windowmanager,
+    WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_windowmanager,
              QT_WINDOWMANAGER_OPEN_URL, remaining, url);
 }
 

+ 55 - 25
jni/SDL2-2.0.1/src/video/wayland/SDL_waylandvideo.c

@@ -19,10 +19,13 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WAYLAND
 
 #include "SDL_video.h"
 #include "SDL_mouse.h"
+#include "SDL_stdinc.h"
 #include "../../events/SDL_events_c.h"
 
 #include "SDL_waylandvideo.h"
@@ -35,6 +38,9 @@
 #include <fcntl.h>
 #include <xkbcommon/xkbcommon.h>
 
+#include "SDL_waylanddyn.h"
+#include <wayland-util.h>
+
 #define WAYLANDVID_DRIVER_NAME "wayland"
 
 struct wayland_mode {
@@ -59,10 +65,12 @@ static int
 Wayland_Available(void)
 {
     struct wl_display *display = NULL;
-
-    display = wl_display_connect(NULL);
-    if (display != NULL) {
-        wl_display_disconnect(display);
+    if (SDL_WAYLAND_LoadSymbols()) {
+        display = WAYLAND_wl_display_connect(NULL);
+        if (display != NULL) {
+            WAYLAND_wl_display_disconnect(display);
+        }
+        SDL_WAYLAND_UnloadSymbols();
     }
 
     return (display != NULL);
@@ -72,12 +80,17 @@ static void
 Wayland_DeleteDevice(SDL_VideoDevice *device)
 {
     SDL_free(device);
+    SDL_WAYLAND_UnloadSymbols();
 }
 
 static SDL_VideoDevice *
 Wayland_CreateDevice(int devindex)
 {
     SDL_VideoDevice *device;
+    
+    if (!SDL_WAYLAND_LoadSymbols()) {
+        return NULL;
+    }
 
     /* Initialize all variables that we clean on shutdown */
     device = SDL_calloc(1, sizeof(SDL_VideoDevice));
@@ -133,13 +146,13 @@ wayland_add_mode(SDL_VideoData *d, SDL_DisplayMode m)
 	    return;
 
     /* Add new mode to the list */
-    mode = SDL_calloc(1, sizeof *mode);
+    mode = (struct wayland_mode *) SDL_calloc(1, sizeof *mode);
 
     if (!mode)
 	return;
 
     mode->mode = m;
-    wl_list_insert(&d->modes_list, &mode->link);
+    WAYLAND_wl_list_insert(&d->modes_list, &mode->link);
 }
 
 static void
@@ -227,7 +240,7 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id,
 					const char *interface, uint32_t version)
 {
     SDL_VideoData *d = data;
-
+    
     if (strcmp(interface, "wl_compositor") == 0) {
         d->compositor = wl_registry_bind(d->registry, id, &wl_compositor_interface, 1);
     } else if (strcmp(interface, "wl_output") == 0) {
@@ -239,8 +252,8 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id,
         d->shell = wl_registry_bind(d->registry, id, &wl_shell_interface, 1);
     } else if (strcmp(interface, "wl_shm") == 0) {
         d->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
-        d->cursor_theme = wl_cursor_theme_load(NULL, 32, d->shm);
-        d->default_cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "left_ptr");
+        d->cursor_theme = WAYLAND_wl_cursor_theme_load(NULL, 32, d->shm);
+        d->default_cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "left_ptr");
         wl_shm_add_listener(d->shm, &shm_listener, d);
     
 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
@@ -265,7 +278,10 @@ int
 Wayland_VideoInit(_THIS)
 {
     SDL_VideoData *data;
-
+    SDL_VideoDisplay display;
+    SDL_DisplayMode mode;
+    int i;
+    
     data = malloc(sizeof *data);
     if (data == NULL)
         return 0;
@@ -273,29 +289,41 @@ Wayland_VideoInit(_THIS)
 
     _this->driverdata = data;
 
-    wl_list_init(&data->modes_list);
+    WAYLAND_wl_list_init(&data->modes_list);
     
-    data->display = wl_display_connect(NULL);
+    data->display = WAYLAND_wl_display_connect(NULL);
     if (data->display == NULL) {
         SDL_SetError("Failed to connect to a Wayland display");
         return 0;
     }
 
     data->registry = wl_display_get_registry(data->display);
+   
+    if ( data->registry == NULL) {
+        SDL_SetError("Failed to get the Wayland registry");
+        return 0;
+    }
+    
     wl_registry_add_listener(data->registry, &registry_listener, data);
 
-    while (data->screen_allocation.width == 0)
-        wl_display_dispatch(data->display);
+    for (i=0; i < 100; i++) {
+        if (data->screen_allocation.width != 0 || WAYLAND_wl_display_get_error(data->display) != 0) {
+            break;
+        }
+        WAYLAND_wl_display_dispatch(data->display);
+    }
+    
+    if (data->screen_allocation.width == 0) {
+        SDL_SetError("Failed while waiting for screen allocation: %d ", WAYLAND_wl_display_get_error(data->display));
+        return 0;
+    }
 
-    data->xkb_context = xkb_context_new(0);
+    data->xkb_context = WAYLAND_xkb_context_new(0);
     if (!data->xkb_context) {
         SDL_SetError("Failed to create XKB context");
         return 0;
     }
 
-    SDL_VideoDisplay display;
-    SDL_DisplayMode mode;
-
     /* Use a fake 32-bpp desktop mode */
     mode.format = SDL_PIXELFORMAT_RGB888;
     mode.w = data->screen_allocation.width;
@@ -311,7 +339,7 @@ Wayland_VideoInit(_THIS)
 
     Wayland_InitMouse ();
 
-    wayland_schedule_write(data);
+    WAYLAND_wl_display_flush(data->display);
 
     return 0;
 }
@@ -363,7 +391,7 @@ Wayland_VideoQuit(_THIS)
     Wayland_display_destroy_input(data);
 
     if (data->xkb_context) {
-        xkb_context_unref(data->xkb_context);
+        WAYLAND_xkb_context_unref(data->xkb_context);
         data->xkb_context = NULL;
     }
 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
@@ -380,7 +408,7 @@ Wayland_VideoQuit(_THIS)
         wl_shm_destroy(data->shm);
 
     if (data->cursor_theme)
-        wl_cursor_theme_destroy(data->cursor_theme);
+        WAYLAND_wl_cursor_theme_destroy(data->cursor_theme);
 
     if (data->shell)
         wl_shell_destroy(data->shell);
@@ -389,12 +417,12 @@ Wayland_VideoQuit(_THIS)
         wl_compositor_destroy(data->compositor);
 
     if (data->display) {
-        wl_display_flush(data->display);
-        wl_display_disconnect(data->display);
+        WAYLAND_wl_display_flush(data->display);
+        WAYLAND_wl_display_disconnect(data->display);
     }
     
     wl_list_for_each_safe(m, t, &data->modes_list, link) {
-        wl_list_remove(&m->link);
+        WAYLAND_wl_list_remove(&m->link);
         free(m);
     }
 
@@ -403,4 +431,6 @@ Wayland_VideoQuit(_THIS)
     _this->driverdata = NULL;
 }
 
+#endif /* SDL_VIDEO_DRIVER_WAYLAND */
+
 /* vi: set ts=4 sw=4 expandtab: */

+ 2 - 11
jni/SDL2-2.0.1/src/video/wayland/SDL_waylandvideo.h

@@ -19,16 +19,13 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
 
 #ifndef _SDL_waylandvideo_h
 #define _SDL_waylandvideo_h
 
-#include <wayland-client.h>
-#include <wayland-cursor.h>
-#include <wayland-egl.h>
-
 #include <EGL/egl.h>
+#include "wayland-util.h"
 
 struct xkb_context;
 struct SDL_WaylandInput;
@@ -72,12 +69,6 @@ typedef struct {
     uint32_t shm_formats;
 } SDL_VideoData;
 
-static inline void
-wayland_schedule_write(SDL_VideoData *data)
-{
-    wl_display_flush(data->display);
-}
-
 #endif /* _SDL_nullvideo_h */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 13 - 9
jni/SDL2-2.0.1/src/video/wayland/SDL_waylandwindow.c

@@ -19,7 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL
 
 #include "../SDL_sysvideo.h"
 #include "../../events/SDL_windowevents_c.h"
@@ -104,7 +106,7 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window)
     else
         wl_shell_surface_set_toplevel(wind->shell_surface);
 
-    wayland_schedule_write(_this->driverdata);
+    WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
 }
 
 void
@@ -120,7 +122,7 @@ Wayland_SetWindowFullscreen(_THIS, SDL_Window * window,
     else
         wl_shell_surface_set_toplevel(wind->shell_surface);
 
-    wayland_schedule_write(_this->driverdata);
+    WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
 }
 
 int Wayland_CreateWindow(_THIS, SDL_Window *window)
@@ -162,7 +164,7 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window)
                 c->surface_extension, data->surface);
     }
 #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
-    data->egl_window = wl_egl_window_create(data->surface,
+    data->egl_window = WAYLAND_wl_egl_window_create(data->surface,
                                             window->w, window->h);
 
     /* Create the GLES window surface */
@@ -192,7 +194,7 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window)
     wl_surface_set_opaque_region(data->surface, region);
     wl_region_destroy(region);
 
-    wayland_schedule_write(c);
+    WAYLAND_wl_display_flush(c->display);
 
     return 0;
 }
@@ -203,9 +205,9 @@ void Wayland_SetWindowSize(_THIS, SDL_Window * window)
     SDL_WindowData *wind = window->driverdata;
     struct wl_region *region;
 
-    wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0);
+    WAYLAND_wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0);
 
-    region = wl_compositor_create_region(data->compositor);
+    region =wl_compositor_create_region(data->compositor);
     wl_region_add(region, 0, 0, window->w, window->h);
     wl_surface_set_opaque_region(wind->surface, region);
     wl_region_destroy(region);
@@ -220,7 +222,7 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window)
 
     if (data) {
         SDL_EGL_DestroySurface(_this, wind->egl_surface);
-        wl_egl_window_destroy(wind->egl_window);
+        WAYLAND_wl_egl_window_destroy(wind->egl_window);
 
         if (wind->shell_surface)
             wl_shell_surface_destroy(wind->shell_surface);
@@ -232,8 +234,10 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window)
         wl_surface_destroy(wind->surface);
 
         SDL_free(wind);
-        wayland_schedule_write(data);
+        WAYLAND_wl_display_flush(data->display);
     }
 }
 
+#endif /* SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL */
+
 /* vi: set ts=4 sw=4 expandtab: */

+ 1 - 1
jni/SDL2-2.0.1/src/video/wayland/SDL_waylandwindow.h

@@ -19,7 +19,7 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
 
 #ifndef _SDL_waylandwindow_h
 #define _SDL_waylandwindow_h

Some files were not shown because too many files changed in this diff