Hooked up dynamic loading for Mir.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 03 Feb 2014 11:52:54 -0500
changeset 8159427e8fdf6f69
parent 8158 429513cb6707
child 8160 71639d445b59
Hooked up dynamic loading for Mir.
cmake/sdlchecks.cmake
configure
configure.in
include/SDL_config.h.cmake
include/SDL_config.h.in
src/video/mir/SDL_mirdyn.c
src/video/mir/SDL_mirdyn.h
src/video/mir/SDL_mirevents.c
src/video/mir/SDL_mirframebuffer.c
src/video/mir/SDL_mirmouse.c
src/video/mir/SDL_miropengl.c
src/video/mir/SDL_mirsym.h
src/video/mir/SDL_mirvideo.c
src/video/mir/SDL_mirwindow.c
     1.1 --- a/cmake/sdlchecks.cmake	Mon Feb 03 11:14:25 2014 -0500
     1.2 +++ b/cmake/sdlchecks.cmake	Mon Feb 03 11:52:54 2014 -0500
     1.3 @@ -506,6 +506,7 @@
     1.4  endmacro(CheckX11)
     1.5  
     1.6  macro(CheckMir)
     1.7 +# !!! FIXME: hook up dynamic loading here.
     1.8      if(VIDEO_MIR)
     1.9          find_library(MIR_LIB mirclient mircommon egl)
    1.10          pkg_check_modules(MIR_TOOLKIT mirclient mircommon)
    1.11 @@ -529,6 +530,7 @@
    1.12  # Requires:
    1.13  # - EGL
    1.14  macro(CheckWayland)
    1.15 +# !!! FIXME: hook up dynamic loading here.
    1.16    if(VIDEO_WAYLAND)
    1.17      pkg_check_modules(WAYLAND wayland-client wayland-cursor wayland-egl egl xkbcommon)
    1.18      if(WAYLAND_FOUND)
     2.1 --- a/configure	Mon Feb 03 11:14:25 2014 -0500
     2.2 +++ b/configure	Mon Feb 03 11:52:54 2014 -0500
     2.3 @@ -817,10 +817,11 @@
     2.4  enable_sndio_shared
     2.5  enable_diskaudio
     2.6  enable_dummyaudio
     2.7 -enable_video_mir
     2.8  enable_video_wayland
     2.9  enable_video_wayland_qt_touch
    2.10  enable_wayland_shared
    2.11 +enable_video_mir
    2.12 +enable_mir_shared
    2.13  enable_video_x11
    2.14  with_x
    2.15  enable_x11_shared
    2.16 @@ -1535,12 +1536,13 @@
    2.17    --enable-sndio-shared   dynamically load sndio audio support [[default=yes]]
    2.18    --enable-diskaudio      support the disk writer audio driver [[default=yes]]
    2.19    --enable-dummyaudio     support the dummy audio driver [[default=yes]]
    2.20 -  --enable-video-mir      use Mir video driver [[default=yes]]
    2.21    --enable-video-wayland  use Wayland video driver [[default=yes]]
    2.22    --enable-video-wayland-qt-touch
    2.23                            QtWayland server support for Wayland video driver
    2.24                            [[default=yes]]
    2.25    --enable-wayland-shared dynamically load Wayland support [[default=maybe]]
    2.26 +  --enable-video-mir      use Mir video driver [[default=yes]]
    2.27 +  --enable-mir-shared     dynamically load Mir support [[default=maybe]]
    2.28    --enable-video-x11      use X11 video driver [[default=yes]]
    2.29    --enable-x11-shared     dynamically load X11 support [[default=maybe]]
    2.30    --enable-video-x11-xcursor
    2.31 @@ -18629,105 +18631,6 @@
    2.32      fi
    2.33  }
    2.34  
    2.35 -CheckMir()
    2.36 -{
    2.37 -    # Check whether --enable-video-mir was given.
    2.38 -if test "${enable_video_mir+set}" = set; then :
    2.39 -  enableval=$enable_video_mir;
    2.40 -else
    2.41 -  enable_video_mir=yes
    2.42 -fi
    2.43 -
    2.44 -
    2.45 -    if test x$enable_video = xyes -a x$enable_video_mir = xyes; then
    2.46 -        # Extract the first word of "pkg-config", so it can be a program name with args.
    2.47 -set dummy pkg-config; ac_word=$2
    2.48 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    2.49 -$as_echo_n "checking for $ac_word... " >&6; }
    2.50 -if ${ac_cv_path_PKG_CONFIG+:} false; then :
    2.51 -  $as_echo_n "(cached) " >&6
    2.52 -else
    2.53 -  case $PKG_CONFIG in
    2.54 -  [\\/]* | ?:[\\/]*)
    2.55 -  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
    2.56 -  ;;
    2.57 -  *)
    2.58 -  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
    2.59 -for as_dir in $PATH
    2.60 -do
    2.61 -  IFS=$as_save_IFS
    2.62 -  test -z "$as_dir" && as_dir=.
    2.63 -    for ac_exec_ext in '' $ac_executable_extensions; do
    2.64 -  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    2.65 -    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
    2.66 -    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    2.67 -    break 2
    2.68 -  fi
    2.69 -done
    2.70 -  done
    2.71 -IFS=$as_save_IFS
    2.72 -
    2.73 -  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
    2.74 -  ;;
    2.75 -esac
    2.76 -fi
    2.77 -PKG_CONFIG=$ac_cv_path_PKG_CONFIG
    2.78 -if test -n "$PKG_CONFIG"; then
    2.79 -  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
    2.80 -$as_echo "$PKG_CONFIG" >&6; }
    2.81 -else
    2.82 -  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
    2.83 -$as_echo "no" >&6; }
    2.84 -fi
    2.85 -
    2.86 -
    2.87 -
    2.88 -        if test x$PKG_CONFIG != xno; then
    2.89 -            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mir support" >&5
    2.90 -$as_echo_n "checking for Mir support... " >&6; }
    2.91 -            video_mir=no
    2.92 -            tmp_CFLAGS="$CFLAGS"
    2.93 -            CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags egl mirclient xkbcommon`"
    2.94 -
    2.95 -            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    2.96 -/* end confdefs.h.  */
    2.97 -
    2.98 -             #include <EGL/egl.h>
    2.99 -             #include <xkbcommon/xkbcommon.h>
   2.100 -             #include <mir_toolkit/mir_client_library.h>
   2.101 -
   2.102 -int
   2.103 -main ()
   2.104 -{
   2.105 -
   2.106 -
   2.107 -  ;
   2.108 -  return 0;
   2.109 -}
   2.110 -_ACEOF
   2.111 -if ac_fn_c_try_compile "$LINENO"; then :
   2.112 -
   2.113 -            video_mir=yes
   2.114 -
   2.115 -fi
   2.116 -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   2.117 -            CFLAGS="$tmp_CFLAGS"
   2.118 -            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_mir" >&5
   2.119 -$as_echo "$video_mir" >&6; }
   2.120 -
   2.121 -            if test x$video_mir = xyes; then
   2.122 -                  $as_echo "#define SDL_VIDEO_DRIVER_MIR 1" >>confdefs.h
   2.123 -
   2.124 -                  SOURCES="$SOURCES $srcdir/src/video/mir/*.c"
   2.125 -                  EXTRA_CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags egl mirclient xkbcommon`"
   2.126 -                  EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$PKG_CONFIG --libs egl mirclient xkbcommon`"
   2.127 -                  have_video=yes
   2.128 -                  SUMMARY_video="${SUMMARY_video} mir"
   2.129 -            fi
   2.130 -        fi
   2.131 -    fi
   2.132 -}
   2.133 -
   2.134  CheckWarnAll()
   2.135  {
   2.136      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -Wall option" >&5
   2.137 @@ -18888,8 +18791,8 @@
   2.138              fi
   2.139              if test x$have_loadso != xyes && \
   2.140                 test x$enable_wayland_shared = xyes; then
   2.141 -                { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic WAYLAND loading" >&5
   2.142 -$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic WAYLAND loading" >&2;}
   2.143 +                { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic Wayland loading" >&5
   2.144 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic Wayland loading" >&2;}
   2.145                  enable_wayland_shared=no
   2.146              fi
   2.147              if test x$have_loadso = xyes && \
   2.148 @@ -18901,7 +18804,7 @@
   2.149                  echo "-- dynamic libwayland-client -> $wayland_client_lib"
   2.150                  echo "-- dynamic libwayland-egl -> $wayland_egl_lib"
   2.151                  echo "-- dynamic libwayland-cursor -> $wayland_cursor_lib"
   2.152 -                echo "-- dynamic xkbcommon -> $xkbcommon_lib"
   2.153 +                echo "-- dynamic libxkbcommon -> $xkbcommon_lib"
   2.154  
   2.155  cat >>confdefs.h <<_ACEOF
   2.156  #define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC "$wayland_client_lib"
   2.157 @@ -18933,6 +18836,129 @@
   2.158      fi
   2.159  }
   2.160  
   2.161 +CheckMir()
   2.162 +{
   2.163 +    # Check whether --enable-video-mir was given.
   2.164 +if test "${enable_video_mir+set}" = set; then :
   2.165 +  enableval=$enable_video_mir;
   2.166 +else
   2.167 +  enable_video_mir=yes
   2.168 +fi
   2.169 +
   2.170 +
   2.171 +    if test x$enable_video = xyes -a x$enable_video_mir = xyes; then
   2.172 +        # Extract the first word of "pkg-config", so it can be a program name with args.
   2.173 +set dummy pkg-config; ac_word=$2
   2.174 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
   2.175 +$as_echo_n "checking for $ac_word... " >&6; }
   2.176 +if ${ac_cv_path_PKG_CONFIG+:} false; then :
   2.177 +  $as_echo_n "(cached) " >&6
   2.178 +else
   2.179 +  case $PKG_CONFIG in
   2.180 +  [\\/]* | ?:[\\/]*)
   2.181 +  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
   2.182 +  ;;
   2.183 +  *)
   2.184 +  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
   2.185 +for as_dir in $PATH
   2.186 +do
   2.187 +  IFS=$as_save_IFS
   2.188 +  test -z "$as_dir" && as_dir=.
   2.189 +    for ac_exec_ext in '' $ac_executable_extensions; do
   2.190 +  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
   2.191 +    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
   2.192 +    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   2.193 +    break 2
   2.194 +  fi
   2.195 +done
   2.196 +  done
   2.197 +IFS=$as_save_IFS
   2.198 +
   2.199 +  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
   2.200 +  ;;
   2.201 +esac
   2.202 +fi
   2.203 +PKG_CONFIG=$ac_cv_path_PKG_CONFIG
   2.204 +if test -n "$PKG_CONFIG"; then
   2.205 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
   2.206 +$as_echo "$PKG_CONFIG" >&6; }
   2.207 +else
   2.208 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   2.209 +$as_echo "no" >&6; }
   2.210 +fi
   2.211 +
   2.212 +
   2.213 +        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mir support" >&5
   2.214 +$as_echo_n "checking for Mir support... " >&6; }
   2.215 +        video_mir=no
   2.216 +        if test x$PKG_CONFIG != xno; then
   2.217 +            if $PKG_CONFIG --exists mirclient egl xkbcommon ; then
   2.218 +                MIR_CFLAGS=`$PKG_CONFIG --cflags mirclient egl xkbcommon`
   2.219 +                MIR_LIBS=`$PKG_CONFIG --libs mirclient egl xkbcommon`
   2.220 +                video_mir=yes
   2.221 +            fi
   2.222 +        fi
   2.223 +        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_mir" >&5
   2.224 +$as_echo "$video_mir" >&6; }
   2.225 +
   2.226 +        if test x$video_mir = xyes; then
   2.227 +
   2.228 +$as_echo "#define SDL_VIDEO_DRIVER_MIR 1" >>confdefs.h
   2.229 +
   2.230 +            SOURCES="$SOURCES $srcdir/src/video/mir/*.c"
   2.231 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $MIR_CFLAGS"
   2.232 +            # Check whether --enable-mir-shared was given.
   2.233 +if test "${enable_mir_shared+set}" = set; then :
   2.234 +  enableval=$enable_mir_shared;
   2.235 +else
   2.236 +  enable_mir_shared=maybe
   2.237 +fi
   2.238 +
   2.239 +
   2.240 +                        case "$host" in
   2.241 +                *)
   2.242 +                    mirclient_lib=`find_lib "libmirclient.so.*" "$MIR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
   2.243 +                    xkbcommon_lib=`find_lib "libxkbcommon.so.*" "$MIR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
   2.244 +                    ;;
   2.245 +            esac
   2.246 +
   2.247 +            if test x$enable_mir_shared = xmaybe; then
   2.248 +                enable_mir_shared=yes
   2.249 +            fi
   2.250 +            if test x$have_loadso != xyes && \
   2.251 +               test x$enable_mir_shared = xyes; then
   2.252 +                { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic Mir loading" >&5
   2.253 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic Mir loading" >&2;}
   2.254 +                enable_mir_shared=no
   2.255 +            fi
   2.256 +            if test x$have_loadso = xyes && \
   2.257 +               test x$enable_mir_shared = xyes && \
   2.258 +               test x$mirclient_lib != x && \
   2.259 +               test x$xkbcommon_lib != x; then
   2.260 +                echo "-- dynamic libmirclient -> $mirclient_lib"
   2.261 +                echo "-- dynamic libxkbcommon -> $xkbcommon_lib"
   2.262 +
   2.263 +cat >>confdefs.h <<_ACEOF
   2.264 +#define SDL_VIDEO_DRIVER_MIR_DYNAMIC "$mirclient_lib"
   2.265 +_ACEOF
   2.266 +
   2.267 +
   2.268 +cat >>confdefs.h <<_ACEOF
   2.269 +#define SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON "$xkbcommon_lib"
   2.270 +_ACEOF
   2.271 +
   2.272 +                SUMMARY_video="${SUMMARY_video} mir(dynamic)"
   2.273 +            else
   2.274 +                enable_mir_shared=no
   2.275 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MIR_LIBS"
   2.276 +                SUMMARY_video="${SUMMARY_video} mir"
   2.277 +            fi
   2.278 +            have_video=yes
   2.279 +        fi
   2.280 +    fi
   2.281 +}
   2.282 +
   2.283 +
   2.284  CheckX11()
   2.285  {
   2.286  
     3.1 --- a/configure.in	Mon Feb 03 11:14:25 2014 -0500
     3.2 +++ b/configure.in	Mon Feb 03 11:52:54 2014 -0500
     3.3 @@ -1124,44 +1124,6 @@
     3.4      fi
     3.5  }
     3.6  
     3.7 -CheckMir()
     3.8 -{
     3.9 -    AC_ARG_ENABLE(video-mir,
    3.10 -    AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=yes]]]),
    3.11 -                   , enable_video_mir=yes)
    3.12 -
    3.13 -    if test x$enable_video = xyes -a x$enable_video_mir = xyes; then
    3.14 -        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
    3.15 -
    3.16 -        if test x$PKG_CONFIG != xno; then
    3.17 -            AC_MSG_CHECKING(for Mir support)
    3.18 -            video_mir=no
    3.19 -            tmp_CFLAGS="$CFLAGS"
    3.20 -            CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags egl mirclient xkbcommon`"
    3.21 -
    3.22 -            AC_TRY_COMPILE([
    3.23 -             #include <EGL/egl.h>
    3.24 -             #include <xkbcommon/xkbcommon.h>
    3.25 -             #include <mir_toolkit/mir_client_library.h>
    3.26 -            ],[
    3.27 -            ],[
    3.28 -            video_mir=yes
    3.29 -            ])
    3.30 -            CFLAGS="$tmp_CFLAGS"
    3.31 -            AC_MSG_RESULT($video_mir)
    3.32 -
    3.33 -            if test x$video_mir = xyes; then
    3.34 -                  AC_DEFINE(SDL_VIDEO_DRIVER_MIR)
    3.35 -                  SOURCES="$SOURCES $srcdir/src/video/mir/*.c"
    3.36 -                  EXTRA_CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags egl mirclient xkbcommon`"
    3.37 -                  EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$PKG_CONFIG --libs egl mirclient xkbcommon`"
    3.38 -                  have_video=yes
    3.39 -                  SUMMARY_video="${SUMMARY_video} mir"
    3.40 -            fi
    3.41 -        fi
    3.42 -    fi
    3.43 -}
    3.44 -
    3.45  dnl See if GCC's -Wall is supported.
    3.46  CheckWarnAll()
    3.47  {
    3.48 @@ -1251,7 +1213,7 @@
    3.49              fi
    3.50              if test x$have_loadso != xyes && \
    3.51                 test x$enable_wayland_shared = xyes; then
    3.52 -                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic WAYLAND loading])
    3.53 +                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic Wayland loading])
    3.54                  enable_wayland_shared=no
    3.55              fi
    3.56              if test x$have_loadso = xyes && \
    3.57 @@ -1263,7 +1225,7 @@
    3.58                  echo "-- dynamic libwayland-client -> $wayland_client_lib"
    3.59                  echo "-- dynamic libwayland-egl -> $wayland_egl_lib"
    3.60                  echo "-- dynamic libwayland-cursor -> $wayland_cursor_lib"
    3.61 -                echo "-- dynamic xkbcommon -> $xkbcommon_lib"
    3.62 +                echo "-- dynamic libxkbcommon -> $xkbcommon_lib"
    3.63                  AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC, "$wayland_client_lib", [ ])
    3.64                  AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL, "$wayland_egl_lib", [ ])
    3.65                  AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR, "$wayland_cursor_lib", [ ])
    3.66 @@ -1279,6 +1241,70 @@
    3.67      fi
    3.68  }
    3.69  
    3.70 +dnl Check for Mir
    3.71 +CheckMir()
    3.72 +{
    3.73 +    AC_ARG_ENABLE(video-mir,
    3.74 +AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=yes]]]),
    3.75 +                  ,enable_video_mir=yes)
    3.76 +
    3.77 +    if test x$enable_video = xyes -a x$enable_video_mir = xyes; then
    3.78 +        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
    3.79 +        AC_MSG_CHECKING(for Mir support)
    3.80 +        video_mir=no
    3.81 +        if test x$PKG_CONFIG != xno; then
    3.82 +            if $PKG_CONFIG --exists mirclient egl xkbcommon ; then
    3.83 +                MIR_CFLAGS=`$PKG_CONFIG --cflags mirclient egl xkbcommon`
    3.84 +                MIR_LIBS=`$PKG_CONFIG --libs mirclient egl xkbcommon`
    3.85 +                video_mir=yes
    3.86 +            fi
    3.87 +        fi
    3.88 +        AC_MSG_RESULT($video_mir)
    3.89 +
    3.90 +        if test x$video_mir = xyes; then
    3.91 +            AC_DEFINE(SDL_VIDEO_DRIVER_MIR, 1, [ ])
    3.92 +            SOURCES="$SOURCES $srcdir/src/video/mir/*.c"
    3.93 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $MIR_CFLAGS"
    3.94 +            AC_ARG_ENABLE(mir-shared,
    3.95 +AC_HELP_STRING([--enable-mir-shared], [dynamically load Mir support [[default=maybe]]]),
    3.96 +                          , enable_mir_shared=maybe)
    3.97 +
    3.98 +            dnl FIXME: Do BSD and OS X need special cases?
    3.99 +            case "$host" in
   3.100 +                *)
   3.101 +                    mirclient_lib=[`find_lib "libmirclient.so.*" "$MIR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   3.102 +                    xkbcommon_lib=[`find_lib "libxkbcommon.so.*" "$MIR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   3.103 +                    ;;
   3.104 +            esac
   3.105 +
   3.106 +            if test x$enable_mir_shared = xmaybe; then
   3.107 +                enable_mir_shared=yes
   3.108 +            fi
   3.109 +            if test x$have_loadso != xyes && \
   3.110 +               test x$enable_mir_shared = xyes; then
   3.111 +                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic Mir loading])
   3.112 +                enable_mir_shared=no
   3.113 +            fi
   3.114 +            if test x$have_loadso = xyes && \
   3.115 +               test x$enable_mir_shared = xyes && \
   3.116 +               test x$mirclient_lib != x && \
   3.117 +               test x$xkbcommon_lib != x; then
   3.118 +                echo "-- dynamic libmirclient -> $mirclient_lib"
   3.119 +                echo "-- dynamic libxkbcommon -> $xkbcommon_lib"
   3.120 +                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_MIR_DYNAMIC, "$mirclient_lib", [ ])
   3.121 +                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON, "$xkbcommon_lib", [ ])
   3.122 +                SUMMARY_video="${SUMMARY_video} mir(dynamic)"
   3.123 +            else
   3.124 +                enable_mir_shared=no
   3.125 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MIR_LIBS"
   3.126 +                SUMMARY_video="${SUMMARY_video} mir"
   3.127 +            fi
   3.128 +            have_video=yes
   3.129 +        fi
   3.130 +    fi
   3.131 +}
   3.132 +
   3.133 +
   3.134  dnl Find the X11 include and library directories
   3.135  CheckX11()
   3.136  {
     4.1 --- a/include/SDL_config.h.cmake	Mon Feb 03 11:14:25 2014 -0500
     4.2 +++ b/include/SDL_config.h.cmake	Mon Feb 03 11:52:54 2014 -0500
     4.3 @@ -259,7 +259,19 @@
     4.4  #cmakedefine SDL_VIDEO_DRIVER_DUMMY @SDL_VIDEO_DRIVER_DUMMY@
     4.5  #cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@
     4.6  #cmakedefine SDL_VIDEO_DRIVER_WAYLAND @SDL_VIDEO_DRIVER_WAYLAND@
     4.7 +
     4.8 +#if 0
     4.9 +/* !!! FIXME: in configure script version, missing here: */
    4.10 +#undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
    4.11 +#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
    4.12 +#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL
    4.13 +#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
    4.14 +#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
    4.15 +#endif
    4.16 +
    4.17  #cmakedefine SDL_VIDEO_DRIVER_MIR @SDL_VIDEO_DRIVER_MIR@
    4.18 +#cmakedefine SDL_VIDEO_DRIVER_MIR_DYNAMIC @SDL_VIDEO_DRIVER_MIR_DYNAMIC@
    4.19 +#cmakedefine SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON @SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON@
    4.20  #cmakedefine SDL_VIDEO_DRIVER_X11 @SDL_VIDEO_DRIVER_X11@
    4.21  #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC @SDL_VIDEO_DRIVER_X11_DYNAMIC@
    4.22  #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT @SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT@
     5.1 --- a/include/SDL_config.h.in	Mon Feb 03 11:14:25 2014 -0500
     5.2 +++ b/include/SDL_config.h.in	Mon Feb 03 11:52:54 2014 -0500
     5.3 @@ -268,6 +268,8 @@
     5.4  #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
     5.5  #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
     5.6  #undef SDL_VIDEO_DRIVER_MIR
     5.7 +#undef SDL_VIDEO_DRIVER_MIR_DYNAMIC
     5.8 +#undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON
     5.9  #undef SDL_VIDEO_DRIVER_X11
    5.10  #undef SDL_VIDEO_DRIVER_RPI
    5.11  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/src/video/mir/SDL_mirdyn.c	Mon Feb 03 11:52:54 2014 -0500
     6.3 @@ -0,0 +1,177 @@
     6.4 +/*
     6.5 +  Simple DirectMedia Layer
     6.6 +  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
     6.7 +
     6.8 +  This software is provided 'as-is', without any express or implied
     6.9 +  warranty.  In no event will the authors be held liable for any damages
    6.10 +  arising from the use of this software.
    6.11 +
    6.12 +  Permission is granted to anyone to use this software for any purpose,
    6.13 +  including commercial applications, and to alter it and redistribute it
    6.14 +  freely, subject to the following restrictions:
    6.15 +
    6.16 +  1. The origin of this software must not be misrepresented; you must not
    6.17 +     claim that you wrote the original software. If you use this software
    6.18 +     in a product, an acknowledgment in the product documentation would be
    6.19 +     appreciated but is not required.
    6.20 +  2. Altered source versions must be plainly marked as such, and must not be
    6.21 +     misrepresented as being the original software.
    6.22 +  3. This notice may not be removed or altered from any source distribution.
    6.23 +*/
    6.24 +#include "../../SDL_internal.h"
    6.25 +
    6.26 +#if SDL_VIDEO_DRIVER_MIR
    6.27 +
    6.28 +#define DEBUG_DYNAMIC_MIR 0
    6.29 +
    6.30 +#include "SDL_mirdyn.h"
    6.31 +
    6.32 +#if DEBUG_DYNAMIC_MIR
    6.33 +#include "SDL_log.h"
    6.34 +#endif
    6.35 +
    6.36 +#ifdef SDL_VIDEO_DRIVER_MIR_DYNAMIC
    6.37 +
    6.38 +#include "SDL_name.h"
    6.39 +#include "SDL_loadso.h"
    6.40 +
    6.41 +typedef struct
    6.42 +{
    6.43 +    void *lib;
    6.44 +    const char *libname;
    6.45 +} mirdynlib;
    6.46 +
    6.47 +#ifndef SDL_VIDEO_DRIVER_MIR_DYNAMIC
    6.48 +#define SDL_VIDEO_DRIVER_MIR_DYNAMIC NULL
    6.49 +#endif
    6.50 +#ifndef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON
    6.51 +#define SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON NULL
    6.52 +#endif
    6.53 +
    6.54 +static mirdynlib mirlibs[] = {
    6.55 +    {NULL, SDL_VIDEO_DRIVER_MIR_DYNAMIC},
    6.56 +    {NULL, SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON}
    6.57 +};
    6.58 +
    6.59 +static void *
    6.60 +MIR_GetSym(const char *fnname, int *pHasModule)
    6.61 +{
    6.62 +    int i;
    6.63 +    void *fn = NULL;
    6.64 +    for (i = 0; i < SDL_TABLESIZE(mirlibs); i++) {
    6.65 +        if (mirlibs[i].lib != NULL) {
    6.66 +            fn = SDL_LoadFunction(mirlibs[i].lib, fnname);
    6.67 +            if (fn != NULL)
    6.68 +                break;
    6.69 +        }
    6.70 +    }
    6.71 +
    6.72 +#if DEBUG_DYNAMIC_MIR
    6.73 +    if (fn != NULL)
    6.74 +        SDL_Log("MIR: Found '%s' in %s (%p)\n", fnname, mirlibs[i].libname, fn);
    6.75 +    else
    6.76 +        SDL_Log("MIR: Symbol '%s' NOT FOUND!\n", fnname);
    6.77 +#endif
    6.78 +
    6.79 +    if (fn == NULL)
    6.80 +        *pHasModule = 0;  /* kill this module. */
    6.81 +
    6.82 +    return fn;
    6.83 +}
    6.84 +
    6.85 +#endif /* SDL_VIDEO_DRIVER_MIR_DYNAMIC */
    6.86 +
    6.87 +/* Define all the function pointers and wrappers... */
    6.88 +#define SDL_MIR_MODULE(modname) int SDL_MIR_HAVE_##modname = 0;
    6.89 +#define SDL_MIR_SYM(rc,fn,params) SDL_DYNMIRFN_##fn MIR_##fn = NULL;
    6.90 +#include "SDL_mirsym.h"
    6.91 +#undef SDL_MIR_MODULE
    6.92 +#undef SDL_MIR_SYM
    6.93 +
    6.94 +static int mir_load_refcount = 0;
    6.95 +
    6.96 +void
    6.97 +SDL_MIR_UnloadSymbols(void)
    6.98 +{
    6.99 +    /* Don't actually unload if more than one module is using the libs... */
   6.100 +    if (mir_load_refcount > 0) {
   6.101 +        if (--mir_load_refcount == 0) {
   6.102 +#ifdef SDL_VIDEO_DRIVER_MIR_DYNAMIC            
   6.103 +            int i;
   6.104 +#endif
   6.105 +            
   6.106 +            /* set all the function pointers to NULL. */
   6.107 +#define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 0;
   6.108 +#define SDL_MIR_SYM(rc,fn,params) MIR_##fn = NULL;
   6.109 +#include "SDL_mirsym.h"
   6.110 +#undef SDL_MIR_MODULE
   6.111 +#undef SDL_MIR_SYM
   6.112 +
   6.113 +
   6.114 +#ifdef SDL_VIDEO_DRIVER_MIR_DYNAMIC
   6.115 +            for (i = 0; i < SDL_TABLESIZE(mirlibs); i++) {
   6.116 +                if (mirlibs[i].lib != NULL) {
   6.117 +                    SDL_UnloadObject(mirlibs[i].lib);
   6.118 +                    mirlibs[i].lib = NULL;
   6.119 +                }
   6.120 +            }
   6.121 +#endif
   6.122 +        }
   6.123 +    }
   6.124 +}
   6.125 +
   6.126 +/* returns non-zero if all needed symbols were loaded. */
   6.127 +int
   6.128 +SDL_MIR_LoadSymbols(void)
   6.129 +{
   6.130 +    int rc = 1;                 /* always succeed if not using Dynamic MIR stuff. */
   6.131 +
   6.132 +    /* deal with multiple modules (dga, wayland, mir, etc) needing these symbols... */
   6.133 +    if (mir_load_refcount++ == 0) {
   6.134 +#ifdef SDL_VIDEO_DRIVER_MIR_DYNAMIC
   6.135 +        int i;
   6.136 +        int *thismod = NULL;
   6.137 +        for (i = 0; i < SDL_TABLESIZE(mirlibs); i++) {
   6.138 +            if (mirlibs[i].libname != NULL) {
   6.139 +                mirlibs[i].lib = SDL_LoadObject(mirlibs[i].libname);
   6.140 +            }
   6.141 +        }
   6.142 +
   6.143 +#define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 1; /* default yes */
   6.144 +#define SDL_MIR_SYM(rc,fn,params)
   6.145 +#include "SDL_mirsym.h"
   6.146 +#undef SDL_MIR_MODULE
   6.147 +#undef SDL_MIR_SYM
   6.148 +
   6.149 +#define SDL_MIR_MODULE(modname) thismod = &SDL_MIR_HAVE_##modname;
   6.150 +#define SDL_MIR_SYM(rc,fn,params) MIR_##fn = (SDL_DYNMIRFN_##fn) MIR_GetSym(#fn,thismod);
   6.151 +#include "SDL_mirsym.h"
   6.152 +#undef SDL_MIR_MODULE
   6.153 +#undef SDL_MIR_SYM
   6.154 +
   6.155 +        if ((SDL_MIR_HAVE_MIR_CLIENT) && (SDL_MIR_HAVE_XKBCOMMON)) {
   6.156 +            /* all required symbols loaded. */
   6.157 +            SDL_ClearError();
   6.158 +        } else {
   6.159 +            /* in case something got loaded... */
   6.160 +            SDL_MIR_UnloadSymbols();
   6.161 +            rc = 0;
   6.162 +        }
   6.163 +
   6.164 +#else  /* no dynamic MIR */
   6.165 +
   6.166 +#define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 1; /* default yes */
   6.167 +#define SDL_MIR_SYM(rc,fn,params) MIR_##fn = fn;
   6.168 +#include "SDL_mirsym.h"
   6.169 +#undef SDL_MIR_MODULE
   6.170 +#undef SDL_MIR_SYM
   6.171 +
   6.172 +#endif
   6.173 +    }
   6.174 +
   6.175 +    return rc;
   6.176 +}
   6.177 +
   6.178 +#endif /* SDL_VIDEO_DRIVER_MIR */
   6.179 +
   6.180 +/* vi: set ts=4 sw=4 expandtab: */
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/src/video/mir/SDL_mirdyn.h	Mon Feb 03 11:52:54 2014 -0500
     7.3 @@ -0,0 +1,53 @@
     7.4 +/*
     7.5 +  Simple DirectMedia Layer
     7.6 +  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
     7.7 +
     7.8 +  This software is provided 'as-is', without any express or implied
     7.9 +  warranty.  In no event will the authors be held liable for any damages
    7.10 +  arising from the use of this software.
    7.11 +
    7.12 +  Permission is granted to anyone to use this software for any purpose,
    7.13 +  including commercial applications, and to alter it and redistribute it
    7.14 +  freely, subject to the following restrictions:
    7.15 +
    7.16 +  1. The origin of this software must not be misrepresented; you must not
    7.17 +     claim that you wrote the original software. If you use this software
    7.18 +     in a product, an acknowledgment in the product documentation would be
    7.19 +     appreciated but is not required.
    7.20 +  2. Altered source versions must be plainly marked as such, and must not be
    7.21 +     misrepresented as being the original software.
    7.22 +  3. This notice may not be removed or altered from any source distribution.
    7.23 +*/
    7.24 +
    7.25 +#ifndef _SDL_mirdyn_h
    7.26 +#define _SDL_mirdyn_h
    7.27 +
    7.28 +#include "../../SDL_internal.h"
    7.29 +
    7.30 +#include <EGL/egl.h>
    7.31 +#include <mir_toolkit/mir_client_library.h>
    7.32 +#include <xkbcommon/xkbcommon.h>
    7.33 +
    7.34 +#ifdef __cplusplus
    7.35 +extern "C" {
    7.36 +#endif
    7.37 +
    7.38 +int SDL_MIR_LoadSymbols(void);
    7.39 +void SDL_MIR_UnloadSymbols(void);
    7.40 +
    7.41 +/* Declare all the function pointers and wrappers... */
    7.42 +#define SDL_MIR_MODULE(modname)
    7.43 +#define SDL_MIR_SYM(rc,fn,params) \
    7.44 +    typedef rc (*SDL_DYNMIRFN_##fn) params; \
    7.45 +    extern SDL_DYNMIRFN_##fn MIR_##fn;
    7.46 +#include "SDL_mirsym.h"
    7.47 +#undef SDL_MIR_MODULE
    7.48 +#undef SDL_MIR_SYM
    7.49 +
    7.50 +#ifdef __cplusplus
    7.51 +}
    7.52 +#endif
    7.53 +
    7.54 +#endif /* !defined _SDL_mirdyn_h */
    7.55 +
    7.56 +/* vi: set ts=4 sw=4 expandtab: */
     8.1 --- a/src/video/mir/SDL_mirevents.c	Mon Feb 03 11:14:25 2014 -0500
     8.2 +++ b/src/video/mir/SDL_mirevents.c	Mon Feb 03 11:52:54 2014 -0500
     8.3 @@ -37,13 +37,15 @@
     8.4  
     8.5  #include <xkbcommon/xkbcommon.h>
     8.6  
     8.7 +#include "SDL_mirdyn.h"
     8.8 +
     8.9  static void
    8.10  HandleKeyText(int32_t key_code)
    8.11  {
    8.12      char text[8];
    8.13      int size = 0;
    8.14  
    8.15 -    size = xkb_keysym_to_utf8(key_code, text, sizeof text);
    8.16 +    size = MIR_xkb_keysym_to_utf8(key_code, text, sizeof text);
    8.17  
    8.18      if (size > 0) {
    8.19          text[size] = '\0';
     9.1 --- a/src/video/mir/SDL_mirframebuffer.c	Mon Feb 03 11:14:25 2014 -0500
     9.2 +++ b/src/video/mir/SDL_mirframebuffer.c	Mon Feb 03 11:52:54 2014 -0500
     9.3 @@ -31,6 +31,8 @@
     9.4  #include "SDL_mirframebuffer.h"
     9.5  #include "SDL_mirwindow.h"
     9.6  
     9.7 +#include "SDL_mirdyn.h"
     9.8 +
     9.9  static const Uint32 mir_pixel_format_to_sdl_format[] = {
    9.10      SDL_PIXELFORMAT_UNKNOWN,  /* mir_pixel_format_invalid   */
    9.11      SDL_PIXELFORMAT_ABGR8888, /* mir_pixel_format_abgr_8888 */
    9.12 @@ -59,7 +61,7 @@
    9.13  
    9.14      mir_window = window->driverdata;
    9.15  
    9.16 -    mir_surface_get_parameters(mir_window->surface, &surfaceparm);
    9.17 +    MIR_mir_surface_get_parameters(mir_window->surface, &surfaceparm);
    9.18  
    9.19      *format = MIR_GetSDLPixelFormat(surfaceparm.pixel_format);
    9.20      if (*format == SDL_PIXELFORMAT_UNKNOWN)
    9.21 @@ -71,9 +73,9 @@
    9.22      if (*pixels == NULL)
    9.23          return SDL_OutOfMemory();
    9.24  
    9.25 -    mir_window->surface = mir_connection_create_surface_sync(mir_data->connection, &surfaceparm);
    9.26 -    if (!mir_surface_is_valid(mir_window->surface)) {
    9.27 -        const char* error = mir_surface_get_error_message(mir_window->surface);
    9.28 +    mir_window->surface = MIR_mir_connection_create_surface_sync(mir_data->connection, &surfaceparm);
    9.29 +    if (!MIR_mir_surface_is_valid(mir_window->surface)) {
    9.30 +        const char* error = MIR_mir_surface_get_error_message(mir_window->surface);
    9.31          return SDL_SetError("Failed to created a mir surface: %s", error);
    9.32      }
    9.33  
    9.34 @@ -90,7 +92,7 @@
    9.35      int i, j, x, y, w, h, start;
    9.36      int bytes_per_pixel, bytes_per_row, s_stride, d_stride;
    9.37  
    9.38 -    mir_surface_get_graphics_region(mir_window->surface, &region);
    9.39 +    MIR_mir_surface_get_graphics_region(mir_window->surface, &region);
    9.40  
    9.41      char* s_dest = region.vaddr;
    9.42      char* pixels = (char*)window->surface->pixels;
    9.43 @@ -138,7 +140,7 @@
    9.44          }
    9.45      }
    9.46  
    9.47 -    mir_surface_swap_buffers_sync(mir_window->surface);
    9.48 +    MIR_mir_surface_swap_buffers_sync(mir_window->surface);
    9.49  
    9.50      return 0;
    9.51  }
    10.1 --- a/src/video/mir/SDL_mirmouse.c	Mon Feb 03 11:14:25 2014 -0500
    10.2 +++ b/src/video/mir/SDL_mirmouse.c	Mon Feb 03 11:52:54 2014 -0500
    10.3 @@ -32,6 +32,8 @@
    10.4  #include "../../events/SDL_mouse_c.h"
    10.5  #include "SDL_assert.h"
    10.6  
    10.7 +#include "SDL_mirdyn.h"
    10.8 +
    10.9  static SDL_Cursor*
   10.10  MIR_CreateDefaultCursor()
   10.11  {
    11.1 --- a/src/video/mir/SDL_miropengl.c	Mon Feb 03 11:14:25 2014 -0500
    11.2 +++ b/src/video/mir/SDL_miropengl.c	Mon Feb 03 11:52:54 2014 -0500
    11.3 @@ -33,6 +33,8 @@
    11.4  
    11.5  #define DEFAULT_OGL_ES2 "libGLESv2.so"
    11.6  
    11.7 +#include "SDL_mirdyn.h"
    11.8 +
    11.9  void* MIR_GLHandle = NULL;
   11.10  
   11.11  void
   11.12 @@ -70,8 +72,7 @@
   11.13  {
   11.14      MIR_Data* mir_data = _this->driverdata;
   11.15  
   11.16 -    SDL_EGL_LoadLibrary(_this, path,
   11.17 -                        mir_connection_get_egl_native_display(mir_data->connection));
   11.18 +    SDL_EGL_LoadLibrary(_this, path, MIR_mir_connection_get_egl_native_display(mir_data->connection));
   11.19  
   11.20      SDL_EGL_ChooseConfig(_this);
   11.21  
   11.22 @@ -103,7 +104,7 @@
   11.23  void*
   11.24  MIR_GL_GetProcAddress(_THIS, const char* proc)
   11.25  {
   11.26 -    void* proc_addr = eglGetProcAddress(proc);
   11.27 +    void* proc_addr = SDL_EGL_GetProcAddress(_this, proc);
   11.28  
   11.29      /* FIXME when on the phone/tablet eglGetProcAddress returns NULL through libhybris,
   11.30         seems to be a problem in android. Also looks like a problem in the android video driver:
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/src/video/mir/SDL_mirsym.h	Mon Feb 03 11:52:54 2014 -0500
    12.3 @@ -0,0 +1,48 @@
    12.4 +/*
    12.5 +  Simple DirectMedia Layer
    12.6 +  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
    12.7 +
    12.8 +  This software is provided 'as-is', without any express or implied
    12.9 +  warranty.  In no event will the authors be held liable for any damages
   12.10 +  arising from the use of this software.
   12.11 +
   12.12 +  Permission is granted to anyone to use this software for any purpose,
   12.13 +  including commercial applications, and to alter it and redistribute it
   12.14 +  freely, subject to the following restrictions:
   12.15 +
   12.16 +  1. The origin of this software must not be misrepresented; you must not
   12.17 +     claim that you wrote the original software. If you use this software
   12.18 +     in a product, an acknowledgment in the product documentation would be
   12.19 +     appreciated but is not required.
   12.20 +  2. Altered source versions must be plainly marked as such, and must not be
   12.21 +     misrepresented as being the original software.
   12.22 +  3. This notice may not be removed or altered from any source distribution.
   12.23 +*/
   12.24 +
   12.25 +/* *INDENT-OFF* */
   12.26 +
   12.27 +SDL_MIR_MODULE(MIR_CLIENT)
   12.28 +SDL_MIR_SYM(MirDisplayConfiguration*,mir_connection_create_display_config,(MirConnection *connection))
   12.29 +SDL_MIR_SYM(MirSurface *,mir_connection_create_surface_sync,(MirConnection *connection, MirSurfaceParameters const *params))
   12.30 +SDL_MIR_SYM(void,mir_connection_get_available_surface_formats,(MirConnection* connection, MirPixelFormat* formats, unsigned const int format_size, unsigned int *num_valid_formats))
   12.31 +SDL_MIR_SYM(MirEGLNativeDisplayType,mir_connection_get_egl_native_display,(MirConnection *connection))
   12.32 +SDL_MIR_SYM(int,mir_connection_is_valid,(MirConnection *connection))
   12.33 +SDL_MIR_SYM(void,mir_connection_release,(MirConnection *connection))
   12.34 +SDL_MIR_SYM(MirConnection *,mir_connect_sync,(char const *server, char const *app_name))
   12.35 +SDL_MIR_SYM(void,mir_display_config_destroy,(MirDisplayConfiguration* display_configuration))
   12.36 +SDL_MIR_SYM(MirEGLNativeWindowType,mir_surface_get_egl_native_window,(MirSurface *surface))
   12.37 +SDL_MIR_SYM(char const *,mir_surface_get_error_message,(MirSurface *surface))
   12.38 +SDL_MIR_SYM(void,mir_surface_get_graphics_region,(MirSurface *surface, MirGraphicsRegion *graphics_region))
   12.39 +SDL_MIR_SYM(void,mir_surface_get_parameters,(MirSurface *surface, MirSurfaceParameters *parameters))
   12.40 +SDL_MIR_SYM(int,mir_surface_is_valid,(MirSurface *surface))
   12.41 +SDL_MIR_SYM(void,mir_surface_release_sync,(MirSurface *surface))
   12.42 +SDL_MIR_SYM(void,mir_surface_set_event_handler,(MirSurface *surface, MirEventDelegate const *event_handler))
   12.43 +SDL_MIR_SYM(MirWaitHandle*,mir_surface_set_type,(MirSurface *surface, MirSurfaceType type))
   12.44 +SDL_MIR_SYM(void,mir_surface_swap_buffers_sync,(MirSurface *surface))
   12.45 +
   12.46 +SDL_MIR_MODULE(XKBCOMMON)
   12.47 +SDL_MIR_SYM(int,xkb_keysym_to_utf8,(xkb_keysym_t keysym, char *buffer, size_t size))
   12.48 +
   12.49 +/* *INDENT-ON* */
   12.50 +
   12.51 +/* vi: set ts=4 sw=4 expandtab: */
    13.1 --- a/src/video/mir/SDL_mirvideo.c	Mon Feb 03 11:14:25 2014 -0500
    13.2 +++ b/src/video/mir/SDL_mirvideo.c	Mon Feb 03 11:52:54 2014 -0500
    13.3 @@ -35,6 +35,8 @@
    13.4  #include "SDL_mirvideo.h"
    13.5  #include "SDL_mirwindow.h"
    13.6  
    13.7 +#include "SDL_mirdyn.h"
    13.8 +
    13.9  #define MIR_DRIVER_NAME "mir"
   13.10  
   13.11  static int
   13.12 @@ -74,13 +76,23 @@
   13.13  static int
   13.14  MIR_Available()
   13.15  {
   13.16 -    return 1;
   13.17 +    int available = 0;
   13.18 +
   13.19 +    if (SDL_MIR_LoadSymbols()) {
   13.20 +        /* !!! FIXME: try to make a MirConnection here. */
   13.21 +        available = 1;
   13.22 +        SDL_MIR_UnloadSymbols();
   13.23 +
   13.24 +    }
   13.25 +
   13.26 +    return available;
   13.27  }
   13.28  
   13.29  static void
   13.30  MIR_DeleteDevice(SDL_VideoDevice* device)
   13.31  {
   13.32      SDL_free(device);
   13.33 +    SDL_MIR_UnloadSymbols();
   13.34  }
   13.35  
   13.36  void
   13.37 @@ -92,16 +104,24 @@
   13.38  MIR_CreateDevice(int device_index)
   13.39  {
   13.40      MIR_Data* mir_data;
   13.41 -    SDL_VideoDevice* device = SDL_calloc(1, sizeof(SDL_VideoDevice));
   13.42 +    SDL_VideoDevice* device = NULL;
   13.43 +
   13.44 +    if (!SDL_MIR_LoadSymbols()) {
   13.45 +        return NULL;
   13.46 +    }
   13.47 +
   13.48 +    device = SDL_calloc(1, sizeof(SDL_VideoDevice));
   13.49      if (!device) {
   13.50 +        SDL_MIR_UnloadSymbols();
   13.51          SDL_OutOfMemory();
   13.52          return NULL;
   13.53      }
   13.54  
   13.55      mir_data = SDL_calloc(1, sizeof(MIR_Data));
   13.56      if (!mir_data) {
   13.57 +        SDL_free(device);
   13.58 +        SDL_MIR_UnloadSymbols();
   13.59          SDL_OutOfMemory();
   13.60 -        SDL_free(device);
   13.61          return NULL;
   13.62      }
   13.63  
   13.64 @@ -225,8 +245,7 @@
   13.65      MIR_Data* mir_data = _this->driverdata;
   13.66      int d;
   13.67  
   13.68 -    MirDisplayConfiguration* display_config =
   13.69 -            mir_connection_create_display_config(mir_data->connection);
   13.70 +    MirDisplayConfiguration* display_config = MIR_mir_connection_create_display_config(mir_data->connection);
   13.71  
   13.72      for (d = 0; d < display_config->num_outputs; d++) {
   13.73          MirDisplayOutput const* out = display_config->outputs + d;
   13.74 @@ -246,7 +265,7 @@
   13.75          }
   13.76      }
   13.77  
   13.78 -    mir_display_config_destroy(display_config);
   13.79 +    MIR_mir_display_config_destroy(display_config);
   13.80  }
   13.81  
   13.82  int
   13.83 @@ -254,9 +273,9 @@
   13.84  {
   13.85      MIR_Data* mir_data = _this->driverdata;
   13.86  
   13.87 -    mir_data->connection = mir_connect_sync(NULL, __PRETTY_FUNCTION__);
   13.88 +    mir_data->connection = MIR_mir_connect_sync(NULL, __PRETTY_FUNCTION__);
   13.89  
   13.90 -    if (!mir_connection_is_valid(mir_data->connection))
   13.91 +    if (!MIR_mir_connection_is_valid(mir_data->connection))
   13.92          return SDL_SetError("Failed to connect to the Mir Server");
   13.93  
   13.94      MIR_InitDisplays(_this);
   13.95 @@ -275,7 +294,7 @@
   13.96      MIR_GL_DeleteContext(_this, NULL);
   13.97      MIR_GL_UnloadLibrary(_this);
   13.98  
   13.99 -    mir_connection_release(mir_data->connection);
  13.100 +    MIR_mir_connection_release(mir_data->connection);
  13.101  
  13.102      SDL_free(mir_data);
  13.103      _this->driverdata = NULL;
  13.104 @@ -287,8 +306,7 @@
  13.105      MIR_Data* mir_data = _this->driverdata;
  13.106      int d;
  13.107  
  13.108 -    MirDisplayConfiguration* display_config =
  13.109 -            mir_connection_create_display_config(mir_data->connection);
  13.110 +    MirDisplayConfiguration* display_config = MIR_mir_connection_create_display_config(mir_data->connection);
  13.111  
  13.112      for (d = 0; d < display_config->num_outputs; d++) {
  13.113          MirDisplayOutput const* out = display_config->outputs + d;
  13.114 @@ -305,7 +323,7 @@
  13.115          }
  13.116      }
  13.117  
  13.118 -    mir_display_config_destroy(display_config);
  13.119 +    MIR_mir_display_config_destroy(display_config);
  13.120  
  13.121      return 0;
  13.122  }
    14.1 --- a/src/video/mir/SDL_mirwindow.c	Mon Feb 03 11:14:25 2014 -0500
    14.2 +++ b/src/video/mir/SDL_mirwindow.c	Mon Feb 03 11:52:54 2014 -0500
    14.3 @@ -33,11 +33,13 @@
    14.4  #include "SDL_mirevents.h"
    14.5  #include "SDL_mirwindow.h"
    14.6  
    14.7 +#include "SDL_mirdyn.h"
    14.8 +
    14.9  int
   14.10  IsSurfaceValid(MIR_Window* mir_window)
   14.11  {
   14.12 -    if (!mir_surface_is_valid(mir_window->surface)) {
   14.13 -        const char* error = mir_surface_get_error_message(mir_window->surface);
   14.14 +    if (!MIR_mir_surface_is_valid(mir_window->surface)) {
   14.15 +        const char* error = MIR_mir_surface_get_error_message(mir_window->surface);
   14.16          return SDL_SetError("Failed to created a mir surface: %s", error);
   14.17      }
   14.18  
   14.19 @@ -52,7 +54,7 @@
   14.20      unsigned int f;
   14.21  
   14.22      MirPixelFormat formats[pf_size];
   14.23 -    mir_connection_get_available_surface_formats(mir_data->connection, formats,
   14.24 +    MIR_mir_connection_get_available_surface_formats(mir_data->connection, formats,
   14.25                                                   pf_size, &valid_formats);
   14.26  
   14.27      for (f = 0; f < valid_formats; f++) {
   14.28 @@ -111,15 +113,15 @@
   14.29          return SDL_SetError("Failed to find a valid pixel format.");
   14.30      }
   14.31  
   14.32 -    mir_window->surface = mir_connection_create_surface_sync(mir_data->connection, &surfaceparm);
   14.33 -    if (!mir_surface_is_valid(mir_window->surface)) {
   14.34 -        const char* error = mir_surface_get_error_message(mir_window->surface);
   14.35 +    mir_window->surface = MIR_mir_connection_create_surface_sync(mir_data->connection, &surfaceparm);
   14.36 +    if (!MIR_mir_surface_is_valid(mir_window->surface)) {
   14.37 +        const char* error = MIR_mir_surface_get_error_message(mir_window->surface);
   14.38          return SDL_SetError("Failed to created a mir surface: %s", error);
   14.39      }
   14.40  
   14.41      if (window->flags & SDL_WINDOW_OPENGL) {
   14.42          EGLNativeWindowType egl_native_window =
   14.43 -                        (EGLNativeWindowType)mir_surface_get_egl_native_window(mir_window->surface);
   14.44 +                        (EGLNativeWindowType)MIR_mir_surface_get_egl_native_window(mir_window->surface);
   14.45  
   14.46          mir_window->egl_surface = SDL_EGL_CreateSurface(_this, egl_native_window);
   14.47  
   14.48 @@ -132,7 +134,7 @@
   14.49          mir_window->egl_surface = EGL_NO_SURFACE;
   14.50      }
   14.51  
   14.52 -    mir_surface_set_event_handler(mir_window->surface, &delegate);
   14.53 +    MIR_mir_surface_set_event_handler(mir_window->surface, &delegate);
   14.54  
   14.55      return 0;
   14.56  }
   14.57 @@ -147,7 +149,7 @@
   14.58  
   14.59      if (mir_data) {
   14.60          SDL_EGL_DestroySurface(_this, mir_window->egl_surface);
   14.61 -        mir_surface_release_sync(mir_window->surface);
   14.62 +        MIR_mir_surface_release_sync(mir_window->surface);
   14.63  
   14.64          SDL_free(mir_window);
   14.65      }
   14.66 @@ -181,10 +183,9 @@
   14.67          return;
   14.68  
   14.69      if (fullscreen) {
   14.70 -        mir_surface_set_type(mir_window->surface, mir_surface_state_fullscreen);
   14.71 -    }
   14.72 -    else {
   14.73 -        mir_surface_set_type(mir_window->surface, mir_surface_state_restored);
   14.74 +        MIR_mir_surface_set_type(mir_window->surface, mir_surface_state_fullscreen);
   14.75 +    } else {
   14.76 +        MIR_mir_surface_set_type(mir_window->surface, mir_surface_state_restored);
   14.77      }
   14.78  }
   14.79  
   14.80 @@ -196,7 +197,7 @@
   14.81      if (IsSurfaceValid(mir_window) < 0)
   14.82          return;
   14.83  
   14.84 -    mir_surface_set_type(mir_window->surface, mir_surface_state_maximized);
   14.85 +    MIR_mir_surface_set_type(mir_window->surface, mir_surface_state_maximized);
   14.86  }
   14.87  
   14.88  void
   14.89 @@ -207,7 +208,7 @@
   14.90      if (IsSurfaceValid(mir_window) < 0)
   14.91          return;
   14.92  
   14.93 -    mir_surface_set_type(mir_window->surface, mir_surface_state_minimized);
   14.94 +    MIR_mir_surface_set_type(mir_window->surface, mir_surface_state_minimized);
   14.95  }
   14.96  
   14.97  void
   14.98 @@ -218,7 +219,7 @@
   14.99      if (IsSurfaceValid(mir_window) < 0)
  14.100          return;
  14.101  
  14.102 -    mir_surface_set_type(mir_window->surface, mir_surface_state_restored);
  14.103 +    MIR_mir_surface_set_type(mir_window->surface, mir_surface_state_restored);
  14.104  }
  14.105  
  14.106  #endif /* SDL_VIDEO_DRIVER_MIR */