mir: Removed mir client support.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 02 Nov 2018 21:34:17 -0400
changeset 12391ca6e41ade79a
parent 12390 60f322c5984f
child 12392 046dcbdbaa74
mir: Removed mir client support.

Fixes Bugzilla #4288.
CMakeLists.txt
build-scripts/raspberrypi-buildbot.sh
cmake/sdlchecks.cmake
configure
configure.in
docs/README-linux.md
include/SDL_config.h.cmake
include/SDL_config.h.in
include/SDL_syswm.h
src/video/SDL_sysvideo.h
src/video/SDL_video.c
src/video/SDL_vulkan_internal.h
src/video/mir/SDL_mirdyn.c
src/video/mir/SDL_mirdyn.h
src/video/mir/SDL_mirevents.c
src/video/mir/SDL_mirevents.h
src/video/mir/SDL_mirframebuffer.c
src/video/mir/SDL_mirframebuffer.h
src/video/mir/SDL_mirmouse.c
src/video/mir/SDL_mirmouse.h
src/video/mir/SDL_miropengl.c
src/video/mir/SDL_miropengl.h
src/video/mir/SDL_mirsym.h
src/video/mir/SDL_mirvideo.c
src/video/mir/SDL_mirvideo.h
src/video/mir/SDL_mirvulkan.c
src/video/mir/SDL_mirvulkan.h
src/video/mir/SDL_mirwindow.c
src/video/mir/SDL_mirwindow.h
     1.1 --- a/CMakeLists.txt	Fri Nov 02 18:07:11 2018 -0700
     1.2 +++ b/CMakeLists.txt	Fri Nov 02 21:34:17 2018 -0400
     1.3 @@ -326,8 +326,6 @@
     1.4  set_option(VIDEO_WAYLAND       "Use Wayland video driver" ${UNIX_SYS})
     1.5  dep_option(WAYLAND_SHARED      "Dynamically load Wayland support" ON "VIDEO_WAYLAND" OFF)
     1.6  dep_option(VIDEO_WAYLAND_QT_TOUCH  "QtWayland server support for Wayland video driver" ON "VIDEO_WAYLAND" OFF)
     1.7 -set_option(VIDEO_MIR           "Use Mir video driver" ${UNIX_SYS})
     1.8 -dep_option(MIR_SHARED          "Dynamically load Mir support" ON "VIDEO_MIR" OFF)
     1.9  set_option(VIDEO_RPI           "Use Raspberry Pi video driver" ${UNIX_SYS})
    1.10  dep_option(X11_SHARED          "Dynamically load X11 support" ON "VIDEO_X11" OFF)
    1.11  set(SDL_X11_OPTIONS Xcursor Xinerama XInput Xrandr Xscrnsaver XShape Xvm)
    1.12 @@ -997,7 +995,6 @@
    1.13      # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails!
    1.14      CheckRPI()
    1.15      CheckX11()
    1.16 -    CheckMir()
    1.17      CheckDirectFB()
    1.18      CheckOpenGLX11()
    1.19      CheckOpenGLESX11()
     2.1 --- a/build-scripts/raspberrypi-buildbot.sh	Fri Nov 02 18:07:11 2018 -0700
     2.2 +++ b/build-scripts/raspberrypi-buildbot.sh	Fri Nov 02 21:34:17 2018 -0400
     2.3 @@ -42,7 +42,7 @@
     2.4  export CC="ccache /opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc --sysroot=$SYSROOT -I$SYSROOT/opt/vc/include -I$SYSROOT/usr/include -I$SYSROOT/opt/vc/include/interface/vcos/pthreads -I$SYSROOT/opt/vc/include/interface/vmcs_host/linux -L$SYSROOT/opt/vc/lib"
     2.5  # -L$SYSROOT/usr/lib/arm-linux-gnueabihf"
     2.6  # !!! FIXME: shouldn't have to --disable-* things here.
     2.7 -../configure --with-sysroot=$SYSROOT --host=arm-raspberry-linux-gnueabihf --prefix=$PWD/rpi-sdl2-installed --disable-pulseaudio --disable-esd --disable-video-mir --disable-video-wayland
     2.8 +../configure --with-sysroot=$SYSROOT --host=arm-raspberry-linux-gnueabihf --prefix=$PWD/rpi-sdl2-installed --disable-pulseaudio --disable-esd --disable-video-wayland
     2.9  $MAKE
    2.10  $MAKE install
    2.11  # Fix up a few things to a real install path on a real Raspberry Pi...
     3.1 --- a/cmake/sdlchecks.cmake	Fri Nov 02 18:07:11 2018 -0700
     3.2 +++ b/cmake/sdlchecks.cmake	Fri Nov 02 21:34:17 2018 -0400
     3.3 @@ -564,46 +564,6 @@
     3.4    endif()
     3.5  endmacro()
     3.6  
     3.7 -# Requires:
     3.8 -# - EGL
     3.9 -# - PkgCheckModules
    3.10 -# Optional:
    3.11 -# - MIR_SHARED opt
    3.12 -# - HAVE_DLOPEN opt
    3.13 -macro(CheckMir)
    3.14 -    if(VIDEO_MIR)
    3.15 -        find_library(MIR_LIB mirclient mircommon egl)
    3.16 -        pkg_check_modules(MIR_TOOLKIT mirclient>=0.26 mircommon)
    3.17 -        pkg_check_modules(EGL egl)
    3.18 -        pkg_check_modules(XKB xkbcommon)
    3.19 -
    3.20 -        if (MIR_LIB AND MIR_TOOLKIT_FOUND AND EGL_FOUND AND XKB_FOUND)
    3.21 -            set(HAVE_VIDEO_MIR TRUE)
    3.22 -            set(HAVE_SDL_VIDEO TRUE)
    3.23 -
    3.24 -            file(GLOB MIR_SOURCES ${SDL2_SOURCE_DIR}/src/video/mir/*.c)
    3.25 -            set(SOURCE_FILES ${SOURCE_FILES} ${MIR_SOURCES})
    3.26 -            set(SDL_VIDEO_DRIVER_MIR 1)
    3.27 -
    3.28 -            list(APPEND EXTRA_CFLAGS ${MIR_TOOLKIT_CFLAGS} ${EGL_CFLAGS} ${XKB_CFLAGS})
    3.29 -
    3.30 -            if(MIR_SHARED)
    3.31 -                if(NOT HAVE_DLOPEN)
    3.32 -                    message_warn("You must have SDL_LoadObject() support for dynamic Mir loading")
    3.33 -                else()
    3.34 -                    FindLibraryAndSONAME(mirclient)
    3.35 -                    FindLibraryAndSONAME(xkbcommon)
    3.36 -                    set(SDL_VIDEO_DRIVER_MIR_DYNAMIC "\"${MIRCLIENT_LIB_SONAME}\"")
    3.37 -                    set(SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON "\"${XKBCOMMON_LIB_SONAME}\"")
    3.38 -                    set(HAVE_MIR_SHARED TRUE)
    3.39 -                endif()
    3.40 -            else()
    3.41 -                set(EXTRA_LIBS ${MIR_TOOLKIT_LIBRARIES} ${EXTRA_LIBS})
    3.42 -            endif()
    3.43 -        endif()
    3.44 -    endif()
    3.45 -endmacro()
    3.46 -
    3.47  macro(WaylandProtocolGen _SCANNER _XML _PROTL)
    3.48      set(_WAYLAND_PROT_C_CODE "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols/${_PROTL}-protocol.c")
    3.49      set(_WAYLAND_PROT_H_CODE "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols/${_PROTL}-client-protocol.h")
     4.1 --- a/configure	Fri Nov 02 18:07:11 2018 -0700
     4.2 +++ b/configure	Fri Nov 02 21:34:17 2018 -0400
     4.3 @@ -831,8 +831,6 @@
     4.4  enable_video_wayland
     4.5  enable_video_wayland_qt_touch
     4.6  enable_wayland_shared
     4.7 -enable_video_mir
     4.8 -enable_mir_shared
     4.9  enable_video_rpi
    4.10  enable_video_x11
    4.11  with_x
    4.12 @@ -1576,8 +1574,6 @@
    4.13                            QtWayland server support for Wayland video driver
    4.14                            [[default=yes]]
    4.15    --enable-wayland-shared dynamically load Wayland support [[default=maybe]]
    4.16 -  --enable-video-mir      use Mir video driver [[default=no]]
    4.17 -  --enable-mir-shared     dynamically load Mir support [[default=maybe]]
    4.18    --enable-video-rpi      use Raspberry Pi video driver [[default=yes]]
    4.19    --enable-video-x11      use X11 video driver [[default=yes]]
    4.20    --enable-x11-shared     dynamically load X11 support [[default=maybe]]
    4.21 @@ -19422,152 +19418,6 @@
    4.22      fi
    4.23  }
    4.24  
    4.25 -CheckMir()
    4.26 -{
    4.27 -    # Check whether --enable-video-mir was given.
    4.28 -if test "${enable_video_mir+set}" = set; then :
    4.29 -  enableval=$enable_video_mir;
    4.30 -else
    4.31 -  enable_video_mir=no
    4.32 -fi
    4.33 -
    4.34 -
    4.35 -    if test x$enable_video = xyes -a x$enable_video_mir = xyes; then
    4.36 -        # Extract the first word of "pkg-config", so it can be a program name with args.
    4.37 -set dummy pkg-config; ac_word=$2
    4.38 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    4.39 -$as_echo_n "checking for $ac_word... " >&6; }
    4.40 -if ${ac_cv_path_PKG_CONFIG+:} false; then :
    4.41 -  $as_echo_n "(cached) " >&6
    4.42 -else
    4.43 -  case $PKG_CONFIG in
    4.44 -  [\\/]* | ?:[\\/]*)
    4.45 -  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
    4.46 -  ;;
    4.47 -  *)
    4.48 -  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
    4.49 -for as_dir in $PATH
    4.50 -do
    4.51 -  IFS=$as_save_IFS
    4.52 -  test -z "$as_dir" && as_dir=.
    4.53 -    for ac_exec_ext in '' $ac_executable_extensions; do
    4.54 -  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    4.55 -    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
    4.56 -    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    4.57 -    break 2
    4.58 -  fi
    4.59 -done
    4.60 -  done
    4.61 -IFS=$as_save_IFS
    4.62 -
    4.63 -  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
    4.64 -  ;;
    4.65 -esac
    4.66 -fi
    4.67 -PKG_CONFIG=$ac_cv_path_PKG_CONFIG
    4.68 -if test -n "$PKG_CONFIG"; then
    4.69 -  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
    4.70 -$as_echo "$PKG_CONFIG" >&6; }
    4.71 -else
    4.72 -  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
    4.73 -$as_echo "no" >&6; }
    4.74 -fi
    4.75 -
    4.76 -
    4.77 -        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mir support" >&5
    4.78 -$as_echo_n "checking for Mir support... " >&6; }
    4.79 -        video_mir=no
    4.80 -        if test x$PKG_CONFIG != xno; then
    4.81 -            if $PKG_CONFIG --exists mirclient egl xkbcommon ; then
    4.82 -                MIR_CFLAGS=`$PKG_CONFIG --cflags mirclient egl xkbcommon`
    4.83 -                MIR_LIBS=`$PKG_CONFIG --libs mirclient egl xkbcommon`
    4.84 -                save_CFLAGS="$CFLAGS"
    4.85 -                CFLAGS="$save_CFLAGS $MIR_CFLAGS"
    4.86 -
    4.87 -                                cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    4.88 -/* end confdefs.h.  */
    4.89 -
    4.90 -                #include <mir_toolkit/mir_client_library.h>
    4.91 -
    4.92 -int
    4.93 -main ()
    4.94 -{
    4.95 -
    4.96 -                    MirWindowAttrib attrib = mir_window_attrib_state
    4.97 -
    4.98 -  ;
    4.99 -  return 0;
   4.100 -}
   4.101 -_ACEOF
   4.102 -if ac_fn_c_try_compile "$LINENO"; then :
   4.103 -
   4.104 -                video_mir=yes
   4.105 -
   4.106 -fi
   4.107 -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   4.108 -                CFLAGS="$save_CFLAGS"
   4.109 -            fi
   4.110 -        fi
   4.111 -        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_mir" >&5
   4.112 -$as_echo "$video_mir" >&6; }
   4.113 -
   4.114 -        if test x$video_mir = xyes; then
   4.115 -
   4.116 -$as_echo "#define SDL_VIDEO_DRIVER_MIR 1" >>confdefs.h
   4.117 -
   4.118 -            SOURCES="$SOURCES $srcdir/src/video/mir/*.c"
   4.119 -            EXTRA_CFLAGS="$EXTRA_CFLAGS $MIR_CFLAGS"
   4.120 -            # Check whether --enable-mir-shared was given.
   4.121 -if test "${enable_mir_shared+set}" = set; then :
   4.122 -  enableval=$enable_mir_shared;
   4.123 -else
   4.124 -  enable_mir_shared=maybe
   4.125 -fi
   4.126 -
   4.127 -
   4.128 -                        case "$host" in
   4.129 -                *)
   4.130 -                    mirclient_lib=`find_lib "libmirclient.so.*" "$MIR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
   4.131 -                    xkbcommon_lib=`find_lib "libxkbcommon.so.*" "$MIR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
   4.132 -                    ;;
   4.133 -            esac
   4.134 -
   4.135 -            if test x$enable_mir_shared = xmaybe; then
   4.136 -                enable_mir_shared=yes
   4.137 -            fi
   4.138 -            if test x$have_loadso != xyes && \
   4.139 -               test x$enable_mir_shared = xyes; then
   4.140 -                { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic Mir loading" >&5
   4.141 -$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic Mir loading" >&2;}
   4.142 -                enable_mir_shared=no
   4.143 -            fi
   4.144 -            if test x$have_loadso = xyes && \
   4.145 -               test x$enable_mir_shared = xyes && \
   4.146 -               test x$mirclient_lib != x && \
   4.147 -               test x$xkbcommon_lib != x; then
   4.148 -                echo "-- dynamic libmirclient -> $mirclient_lib"
   4.149 -                echo "-- dynamic libxkbcommon -> $xkbcommon_lib"
   4.150 -
   4.151 -cat >>confdefs.h <<_ACEOF
   4.152 -#define SDL_VIDEO_DRIVER_MIR_DYNAMIC "$mirclient_lib"
   4.153 -_ACEOF
   4.154 -
   4.155 -
   4.156 -cat >>confdefs.h <<_ACEOF
   4.157 -#define SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON "$xkbcommon_lib"
   4.158 -_ACEOF
   4.159 -
   4.160 -                SUMMARY_video="${SUMMARY_video} mir(dynamic)"
   4.161 -            else
   4.162 -                enable_mir_shared=no
   4.163 -                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MIR_LIBS"
   4.164 -                SUMMARY_video="${SUMMARY_video} mir"
   4.165 -            fi
   4.166 -            have_video=yes
   4.167 -        fi
   4.168 -    fi
   4.169 -}
   4.170 -
   4.171  CheckNativeClient()
   4.172  {
   4.173          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
   4.174 @@ -24153,7 +24003,6 @@
   4.175          CheckOpenGLX11
   4.176          CheckOpenGLESX11
   4.177          CheckVulkan
   4.178 -        CheckMir
   4.179          CheckWayland
   4.180          CheckLibUDev
   4.181          CheckDBus
     5.1 --- a/configure.in	Fri Nov 02 18:07:11 2018 -0700
     5.2 +++ b/configure.in	Fri Nov 02 21:34:17 2018 -0400
     5.3 @@ -1528,79 +1528,6 @@
     5.4      fi
     5.5  }
     5.6  
     5.7 -dnl Check for Mir
     5.8 -CheckMir()
     5.9 -{
    5.10 -    AC_ARG_ENABLE(video-mir,
    5.11 -AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=no]]]),
    5.12 -                  ,enable_video_mir=no)
    5.13 -
    5.14 -    if test x$enable_video = xyes -a x$enable_video_mir = xyes; then
    5.15 -        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
    5.16 -        AC_MSG_CHECKING(for Mir support)
    5.17 -        video_mir=no
    5.18 -        if test x$PKG_CONFIG != xno; then
    5.19 -            if $PKG_CONFIG --exists mirclient egl xkbcommon ; then
    5.20 -                MIR_CFLAGS=`$PKG_CONFIG --cflags mirclient egl xkbcommon`
    5.21 -                MIR_LIBS=`$PKG_CONFIG --libs mirclient egl xkbcommon`
    5.22 -                save_CFLAGS="$CFLAGS"
    5.23 -                CFLAGS="$save_CFLAGS $MIR_CFLAGS"
    5.24 -
    5.25 -                dnl This will disable Mir if >= v0.26 is not available
    5.26 -                AC_TRY_COMPILE([
    5.27 -                #include <mir_toolkit/mir_client_library.h>
    5.28 -                ],[
    5.29 -                    MirWindowAttrib attrib = mir_window_attrib_state
    5.30 -                ],[
    5.31 -                video_mir=yes
    5.32 -                ])
    5.33 -                CFLAGS="$save_CFLAGS"
    5.34 -            fi
    5.35 -        fi
    5.36 -        AC_MSG_RESULT($video_mir)
    5.37 -
    5.38 -        if test x$video_mir = xyes; then
    5.39 -            AC_DEFINE(SDL_VIDEO_DRIVER_MIR, 1, [ ])
    5.40 -            SOURCES="$SOURCES $srcdir/src/video/mir/*.c"
    5.41 -            EXTRA_CFLAGS="$EXTRA_CFLAGS $MIR_CFLAGS"
    5.42 -            AC_ARG_ENABLE(mir-shared,
    5.43 -AC_HELP_STRING([--enable-mir-shared], [dynamically load Mir support [[default=maybe]]]),
    5.44 -                          , enable_mir_shared=maybe)
    5.45 -
    5.46 -            dnl FIXME: Do BSD and OS X need special cases?
    5.47 -            case "$host" in
    5.48 -                *)
    5.49 -                    mirclient_lib=[`find_lib "libmirclient.so.*" "$MIR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
    5.50 -                    xkbcommon_lib=[`find_lib "libxkbcommon.so.*" "$MIR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
    5.51 -                    ;;
    5.52 -            esac
    5.53 -
    5.54 -            if test x$enable_mir_shared = xmaybe; then
    5.55 -                enable_mir_shared=yes
    5.56 -            fi
    5.57 -            if test x$have_loadso != xyes && \
    5.58 -               test x$enable_mir_shared = xyes; then
    5.59 -                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic Mir loading])
    5.60 -                enable_mir_shared=no
    5.61 -            fi
    5.62 -            if test x$have_loadso = xyes && \
    5.63 -               test x$enable_mir_shared = xyes && \
    5.64 -               test x$mirclient_lib != x && \
    5.65 -               test x$xkbcommon_lib != x; then
    5.66 -                echo "-- dynamic libmirclient -> $mirclient_lib"
    5.67 -                echo "-- dynamic libxkbcommon -> $xkbcommon_lib"
    5.68 -                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_MIR_DYNAMIC, "$mirclient_lib", [ ])
    5.69 -                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON, "$xkbcommon_lib", [ ])
    5.70 -                SUMMARY_video="${SUMMARY_video} mir(dynamic)"
    5.71 -            else
    5.72 -                enable_mir_shared=no
    5.73 -                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MIR_LIBS"
    5.74 -                SUMMARY_video="${SUMMARY_video} mir"
    5.75 -            fi
    5.76 -            have_video=yes
    5.77 -        fi
    5.78 -    fi
    5.79 -}
    5.80  
    5.81  dnl Check for Native Client stuff
    5.82  CheckNativeClient()
    5.83 @@ -3476,7 +3403,6 @@
    5.84          CheckOpenGLX11
    5.85          CheckOpenGLESX11
    5.86          CheckVulkan
    5.87 -        CheckMir
    5.88          CheckWayland
    5.89          CheckLibUDev
    5.90          CheckDBus
     6.1 --- a/docs/README-linux.md	Fri Nov 02 18:07:11 2018 -0700
     6.2 +++ b/docs/README-linux.md	Fri Nov 02 21:34:17 2018 -0400
     6.3 @@ -25,9 +25,6 @@
     6.4  Ubuntu 16.04+ can also add "libwayland-dev libxkbcommon-dev wayland-protocols"
     6.5  to that command line for Wayland support.
     6.6  
     6.7 -Ubuntu 16.10 can also add "libmirclient-dev libxkbcommon-dev" to that command
     6.8 -line for Mir support.
     6.9 -
    6.10  NOTES:
    6.11  - This includes all the audio targets except arts, because Ubuntu pulled the 
    6.12    artsc0-dev package, but in theory SDL still supports it.
     7.1 --- a/include/SDL_config.h.cmake	Fri Nov 02 18:07:11 2018 -0700
     7.2 +++ b/include/SDL_config.h.cmake	Fri Nov 02 21:34:17 2018 -0400
     7.3 @@ -339,9 +339,6 @@
     7.4  #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR@
     7.5  #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON@
     7.6  
     7.7 -#cmakedefine SDL_VIDEO_DRIVER_MIR @SDL_VIDEO_DRIVER_MIR@
     7.8 -#cmakedefine SDL_VIDEO_DRIVER_MIR_DYNAMIC @SDL_VIDEO_DRIVER_MIR_DYNAMIC@
     7.9 -#cmakedefine SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON @SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON@
    7.10  #cmakedefine SDL_VIDEO_DRIVER_EMSCRIPTEN @SDL_VIDEO_DRIVER_EMSCRIPTEN@
    7.11  #cmakedefine SDL_VIDEO_DRIVER_X11 @SDL_VIDEO_DRIVER_X11@
    7.12  #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC @SDL_VIDEO_DRIVER_X11_DYNAMIC@
     8.1 --- a/include/SDL_config.h.in	Fri Nov 02 18:07:11 2018 -0700
     8.2 +++ b/include/SDL_config.h.in	Fri Nov 02 21:34:17 2018 -0400
     8.3 @@ -327,9 +327,6 @@
     8.4  #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL
     8.5  #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
     8.6  #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
     8.7 -#undef SDL_VIDEO_DRIVER_MIR
     8.8 -#undef SDL_VIDEO_DRIVER_MIR_DYNAMIC
     8.9 -#undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON
    8.10  #undef SDL_VIDEO_DRIVER_X11
    8.11  #undef SDL_VIDEO_DRIVER_RPI
    8.12  #undef SDL_VIDEO_DRIVER_KMSDRM
     9.1 --- a/include/SDL_syswm.h	Fri Nov 02 18:07:11 2018 -0700
     9.2 +++ b/include/SDL_syswm.h	Fri Nov 02 21:34:17 2018 -0400
     9.3 @@ -122,7 +122,7 @@
     9.4      SDL_SYSWM_COCOA,
     9.5      SDL_SYSWM_UIKIT,
     9.6      SDL_SYSWM_WAYLAND,
     9.7 -    SDL_SYSWM_MIR,
     9.8 +    SDL_SYSWM_MIR,  /* no longer available, left for API/ABI compatibility. Remove in 2.1! */
     9.9      SDL_SYSWM_WINRT,
    9.10      SDL_SYSWM_ANDROID,
    9.11      SDL_SYSWM_VIVANTE,
    9.12 @@ -257,11 +257,11 @@
    9.13              struct wl_shell_surface *shell_surface; /**< Wayland shell_surface (window manager handle) */
    9.14          } wl;
    9.15  #endif
    9.16 -#if defined(SDL_VIDEO_DRIVER_MIR)
    9.17 +#if defined(SDL_VIDEO_DRIVER_MIR)  /* no longer available, left for API/ABI compatibility. Remove in 2.1! */
    9.18          struct
    9.19          {
    9.20 -            struct MirConnection *connection;  /**< Mir display server connection */
    9.21 -            struct MirSurface *surface;  /**< Mir surface */
    9.22 +            void *connection;  /**< Mir display server connection */
    9.23 +            void *surface;  /**< Mir surface */
    9.24          } mir;
    9.25  #endif
    9.26  
    10.1 --- a/src/video/SDL_sysvideo.h	Fri Nov 02 18:07:11 2018 -0700
    10.2 +++ b/src/video/SDL_sysvideo.h	Fri Nov 02 21:34:17 2018 -0400
    10.3 @@ -405,7 +405,6 @@
    10.4  /* Not all of these are available in a given build. Use #ifdefs, etc. */
    10.5  extern VideoBootStrap COCOA_bootstrap;
    10.6  extern VideoBootStrap X11_bootstrap;
    10.7 -extern VideoBootStrap MIR_bootstrap;
    10.8  extern VideoBootStrap DirectFB_bootstrap;
    10.9  extern VideoBootStrap WINDOWS_bootstrap;
   10.10  extern VideoBootStrap WINRT_bootstrap;
    11.1 --- a/src/video/SDL_video.c	Fri Nov 02 18:07:11 2018 -0700
    11.2 +++ b/src/video/SDL_video.c	Fri Nov 02 21:34:17 2018 -0400
    11.3 @@ -64,9 +64,6 @@
    11.4  #if SDL_VIDEO_DRIVER_X11
    11.5      &X11_bootstrap,
    11.6  #endif
    11.7 -#if SDL_VIDEO_DRIVER_MIR
    11.8 -    &MIR_bootstrap,
    11.9 -#endif
   11.10  #if SDL_VIDEO_DRIVER_WAYLAND
   11.11      &Wayland_bootstrap,
   11.12  #endif
    12.1 --- a/src/video/SDL_vulkan_internal.h	Fri Nov 02 18:07:11 2018 -0700
    12.2 +++ b/src/video/SDL_vulkan_internal.h	Fri Nov 02 21:34:17 2018 -0400
    12.3 @@ -38,9 +38,6 @@
    12.4  #if SDL_VIDEO_DRIVER_COCOA
    12.5  #define VK_USE_PLATFORM_MACOS_MVK
    12.6  #endif
    12.7 -#if SDL_VIDEO_DRIVER_MIR
    12.8 -#define VK_USE_PLATFORM_MIR_KHR
    12.9 -#endif
   12.10  #if SDL_VIDEO_DRIVER_UIKIT
   12.11  #define VK_USE_PLATFORM_IOS_MVK
   12.12  #endif
    13.1 --- a/src/video/mir/SDL_mirdyn.c	Fri Nov 02 18:07:11 2018 -0700
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,170 +0,0 @@
    13.4 -/*
    13.5 -  Simple DirectMedia Layer
    13.6 -  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
    13.7 -
    13.8 -  This software is provided 'as-is', without any express or implied
    13.9 -  warranty.  In no event will the authors be held liable for any damages
   13.10 -  arising from the use of this software.
   13.11 -
   13.12 -  Permission is granted to anyone to use this software for any purpose,
   13.13 -  including commercial applications, and to alter it and redistribute it
   13.14 -  freely, subject to the following restrictions:
   13.15 -
   13.16 -  1. The origin of this software must not be misrepresented; you must not
   13.17 -     claim that you wrote the original software. If you use this software
   13.18 -     in a product, an acknowledgment in the product documentation would be
   13.19 -     appreciated but is not required.
   13.20 -  2. Altered source versions must be plainly marked as such, and must not be
   13.21 -     misrepresented as being the original software.
   13.22 -  3. This notice may not be removed or altered from any source distribution.
   13.23 -*/
   13.24 -#include "../../SDL_internal.h"
   13.25 -
   13.26 -#if SDL_VIDEO_DRIVER_MIR
   13.27 -
   13.28 -#define DEBUG_DYNAMIC_MIR 0
   13.29 -
   13.30 -#include "SDL_mirdyn.h"
   13.31 -
   13.32 -#if DEBUG_DYNAMIC_MIR
   13.33 -#include "SDL_log.h"
   13.34 -#endif
   13.35 -
   13.36 -#ifdef SDL_VIDEO_DRIVER_MIR_DYNAMIC
   13.37 -
   13.38 -#include "SDL_name.h"
   13.39 -#include "SDL_loadso.h"
   13.40 -
   13.41 -typedef struct
   13.42 -{
   13.43 -    void *lib;
   13.44 -    const char *libname;
   13.45 -} mirdynlib;
   13.46 -
   13.47 -#ifndef SDL_VIDEO_DRIVER_MIR_DYNAMIC
   13.48 -#define SDL_VIDEO_DRIVER_MIR_DYNAMIC NULL
   13.49 -#endif
   13.50 -#ifndef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON
   13.51 -#define SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON NULL
   13.52 -#endif
   13.53 -
   13.54 -static mirdynlib mirlibs[] = {
   13.55 -    {NULL, SDL_VIDEO_DRIVER_MIR_DYNAMIC},
   13.56 -    {NULL, SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON}
   13.57 -};
   13.58 -
   13.59 -static void *
   13.60 -MIR_GetSym(const char *fnname, int *pHasModule)
   13.61 -{
   13.62 -    int i;
   13.63 -    void *fn = NULL;
   13.64 -    for (i = 0; i < SDL_TABLESIZE(mirlibs); i++) {
   13.65 -        if (mirlibs[i].lib != NULL) {
   13.66 -            fn = SDL_LoadFunction(mirlibs[i].lib, fnname);
   13.67 -            if (fn != NULL)
   13.68 -                break;
   13.69 -        }
   13.70 -    }
   13.71 -
   13.72 -#if DEBUG_DYNAMIC_MIR
   13.73 -    if (fn != NULL)
   13.74 -        SDL_Log("MIR: Found '%s' in %s (%p)\n", fnname, mirlibs[i].libname, fn);
   13.75 -    else
   13.76 -        SDL_Log("MIR: Symbol '%s' NOT FOUND!\n", fnname);
   13.77 -#endif
   13.78 -
   13.79 -    if (fn == NULL)
   13.80 -        *pHasModule = 0;  /* kill this module. */
   13.81 -
   13.82 -    return fn;
   13.83 -}
   13.84 -
   13.85 -#endif /* SDL_VIDEO_DRIVER_MIR_DYNAMIC */
   13.86 -
   13.87 -/* Define all the function pointers and wrappers... */
   13.88 -#define SDL_MIR_MODULE(modname) int SDL_MIR_HAVE_##modname = 0;
   13.89 -#define SDL_MIR_SYM(rc,fn,params) SDL_DYNMIRFN_##fn MIR_##fn = NULL;
   13.90 -#define SDL_MIR_SYM_CONST(type,name) SDL_DYMMIRCONST_##name MIR_##name = NULL;
   13.91 -#include "SDL_mirsym.h"
   13.92 -
   13.93 -static int mir_load_refcount = 0;
   13.94 -
   13.95 -void
   13.96 -SDL_MIR_UnloadSymbols(void)
   13.97 -{
   13.98 -    /* Don't actually unload if more than one module is using the libs... */
   13.99 -    if (mir_load_refcount > 0) {
  13.100 -        if (--mir_load_refcount == 0) {
  13.101 -#ifdef SDL_VIDEO_DRIVER_MIR_DYNAMIC            
  13.102 -            int i;
  13.103 -#endif
  13.104 -            
  13.105 -            /* set all the function pointers to NULL. */
  13.106 -#define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 0;
  13.107 -#define SDL_MIR_SYM(rc,fn,params) MIR_##fn = NULL;
  13.108 -#define SDL_MIR_SYM_CONST(type,name) MIR_##name = NULL;
  13.109 -#include "SDL_mirsym.h"
  13.110 -
  13.111 -
  13.112 -#ifdef SDL_VIDEO_DRIVER_MIR_DYNAMIC
  13.113 -            for (i = 0; i < SDL_TABLESIZE(mirlibs); i++) {
  13.114 -                if (mirlibs[i].lib != NULL) {
  13.115 -                    SDL_UnloadObject(mirlibs[i].lib);
  13.116 -                    mirlibs[i].lib = NULL;
  13.117 -                }
  13.118 -            }
  13.119 -#endif
  13.120 -        }
  13.121 -    }
  13.122 -}
  13.123 -
  13.124 -/* returns non-zero if all needed symbols were loaded. */
  13.125 -int
  13.126 -SDL_MIR_LoadSymbols(void)
  13.127 -{
  13.128 -    int rc = 1;                 /* always succeed if not using Dynamic MIR stuff. */
  13.129 -
  13.130 -    /* deal with multiple modules (dga, wayland, mir, etc) needing these symbols... */
  13.131 -    if (mir_load_refcount++ == 0) {
  13.132 -#ifdef SDL_VIDEO_DRIVER_MIR_DYNAMIC
  13.133 -        int i;
  13.134 -        int *thismod = NULL;
  13.135 -        for (i = 0; i < SDL_TABLESIZE(mirlibs); i++) {
  13.136 -            if (mirlibs[i].libname != NULL) {
  13.137 -                mirlibs[i].lib = SDL_LoadObject(mirlibs[i].libname);
  13.138 -            }
  13.139 -        }
  13.140 -
  13.141 -#define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 1; /* default yes */
  13.142 -#include "SDL_mirsym.h"
  13.143 -
  13.144 -#define SDL_MIR_MODULE(modname) thismod = &SDL_MIR_HAVE_##modname;
  13.145 -#define SDL_MIR_SYM(rc,fn,params) MIR_##fn = (SDL_DYNMIRFN_##fn) MIR_GetSym(#fn,thismod);
  13.146 -#define SDL_MIR_SYM_CONST(type,name) MIR_##name = *(SDL_DYMMIRCONST_##name*) MIR_GetSym(#name,thismod);
  13.147 -#include "SDL_mirsym.h"
  13.148 -
  13.149 -        if ((SDL_MIR_HAVE_MIR_CLIENT) && (SDL_MIR_HAVE_XKBCOMMON)) {
  13.150 -            /* all required symbols loaded. */
  13.151 -            SDL_ClearError();
  13.152 -        } else {
  13.153 -            /* in case something got loaded... */
  13.154 -            SDL_MIR_UnloadSymbols();
  13.155 -            rc = 0;
  13.156 -        }
  13.157 -
  13.158 -#else  /* no dynamic MIR */
  13.159 -
  13.160 -#define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 1; /* default yes */
  13.161 -#define SDL_MIR_SYM(rc,fn,params) MIR_##fn = fn;
  13.162 -#define SDL_MIR_SYM_CONST(type,name) MIR_##name = name;
  13.163 -#include "SDL_mirsym.h"
  13.164 -
  13.165 -#endif
  13.166 -    }
  13.167 -
  13.168 -    return rc;
  13.169 -}
  13.170 -
  13.171 -#endif /* SDL_VIDEO_DRIVER_MIR */
  13.172 -
  13.173 -/* vi: set ts=4 sw=4 expandtab: */
    14.1 --- a/src/video/mir/SDL_mirdyn.h	Fri Nov 02 18:07:11 2018 -0700
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,53 +0,0 @@
    14.4 -/*
    14.5 -  Simple DirectMedia Layer
    14.6 -  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
    14.7 -
    14.8 -  This software is provided 'as-is', without any express or implied
    14.9 -  warranty.  In no event will the authors be held liable for any damages
   14.10 -  arising from the use of this software.
   14.11 -
   14.12 -  Permission is granted to anyone to use this software for any purpose,
   14.13 -  including commercial applications, and to alter it and redistribute it
   14.14 -  freely, subject to the following restrictions:
   14.15 -
   14.16 -  1. The origin of this software must not be misrepresented; you must not
   14.17 -     claim that you wrote the original software. If you use this software
   14.18 -     in a product, an acknowledgment in the product documentation would be
   14.19 -     appreciated but is not required.
   14.20 -  2. Altered source versions must be plainly marked as such, and must not be
   14.21 -     misrepresented as being the original software.
   14.22 -  3. This notice may not be removed or altered from any source distribution.
   14.23 -*/
   14.24 -
   14.25 -#ifndef SDL_mirdyn_h_
   14.26 -#define SDL_mirdyn_h_
   14.27 -
   14.28 -#include "../../SDL_internal.h"
   14.29 -
   14.30 -#include <EGL/egl.h>
   14.31 -#include <mir_toolkit/mir_client_library.h>
   14.32 -#include <xkbcommon/xkbcommon.h>
   14.33 -
   14.34 -#ifdef __cplusplus
   14.35 -extern "C" {
   14.36 -#endif
   14.37 -
   14.38 -int SDL_MIR_LoadSymbols(void);
   14.39 -void SDL_MIR_UnloadSymbols(void);
   14.40 -
   14.41 -/* Declare all the function pointers and wrappers... */
   14.42 -#define SDL_MIR_SYM(rc,fn,params) \
   14.43 -    typedef rc (*SDL_DYNMIRFN_##fn) params; \
   14.44 -    extern SDL_DYNMIRFN_##fn MIR_##fn;
   14.45 -#define SDL_MIR_SYM_CONST(type, name) \
   14.46 -    typedef type SDL_DYMMIRCONST_##name; \
   14.47 -    extern SDL_DYMMIRCONST_##name MIR_##name;
   14.48 -#include "SDL_mirsym.h"
   14.49 -
   14.50 -#ifdef __cplusplus
   14.51 -}
   14.52 -#endif
   14.53 -
   14.54 -#endif /* !defined SDL_mirdyn_h_ */
   14.55 -
   14.56 -/* vi: set ts=4 sw=4 expandtab: */
    15.1 --- a/src/video/mir/SDL_mirevents.c	Fri Nov 02 18:07:11 2018 -0700
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,321 +0,0 @@
    15.4 -/*
    15.5 -  Simple DirectMedia Layer
    15.6 -  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
    15.7 -
    15.8 -  This software is provided 'as-is', without any express or implied
    15.9 -  warranty.  In no event will the authors be held liable for any damages
   15.10 -  arising from the use of this software.
   15.11 -
   15.12 -  Permission is granted to anyone to use this software for any purpose,
   15.13 -  including commercial applications, and to alter it and redistribute it
   15.14 -  freely, subject to the following restrictions:
   15.15 -
   15.16 -  1. The origin of this software must not be misrepresented; you must not
   15.17 -     claim that you wrote the original software. If you use this software
   15.18 -     in a product, an acknowledgment in the product documentation would be
   15.19 -     appreciated but is not required.
   15.20 -  2. Altered source versions must be plainly marked as such, and must not be
   15.21 -     misrepresented as being the original software.
   15.22 -  3. This notice may not be removed or altered from any source distribution.
   15.23 -*/
   15.24 -
   15.25 -/*
   15.26 -  Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
   15.27 -*/
   15.28 -
   15.29 -#include "../../SDL_internal.h"
   15.30 -
   15.31 -#if SDL_VIDEO_DRIVER_MIR
   15.32 -
   15.33 -#include "../../events/SDL_events_c.h"
   15.34 -#include "../../events/SDL_keyboard_c.h"
   15.35 -#include "../../events/SDL_touch_c.h"
   15.36 -#include "../../events/scancodes_xfree86.h"
   15.37 -
   15.38 -#include "SDL_mirevents.h"
   15.39 -#include "SDL_mirwindow.h"
   15.40 -
   15.41 -#include <xkbcommon/xkbcommon.h>
   15.42 -
   15.43 -#include "SDL_mirdyn.h"
   15.44 -
   15.45 -static void
   15.46 -HandleKeyText(int32_t key_code)
   15.47 -{
   15.48 -    char text[8];
   15.49 -    int size = 0;
   15.50 -
   15.51 -    size = MIR_xkb_keysym_to_utf8(key_code, text, sizeof text);
   15.52 -
   15.53 -    if (size > 0) {
   15.54 -        text[size] = '\0';
   15.55 -        SDL_SendKeyboardText(text);
   15.56 -    }
   15.57 -}
   15.58 -
   15.59 -/* FIXME
   15.60 -   Mir still needs to implement its IM API, for now we assume
   15.61 -   a single key press produces a character.
   15.62 -*/
   15.63 -static void
   15.64 -HandleKeyEvent(MirKeyboardEvent const* key_event, SDL_Window* window)
   15.65 -{
   15.66 -    xkb_keysym_t key_code;
   15.67 -    Uint8 key_state;
   15.68 -    int event_scancode;
   15.69 -    uint32_t sdl_scancode = SDL_SCANCODE_UNKNOWN;
   15.70 -
   15.71 -    MirKeyboardAction action = MIR_mir_keyboard_event_action(key_event);
   15.72 -
   15.73 -    key_state      = SDL_PRESSED;
   15.74 -    key_code       = MIR_mir_keyboard_event_key_code(key_event);
   15.75 -    event_scancode = MIR_mir_keyboard_event_scan_code(key_event);
   15.76 -
   15.77 -    if (action == mir_keyboard_action_up)
   15.78 -        key_state = SDL_RELEASED;
   15.79 -
   15.80 -    if (event_scancode < SDL_arraysize(xfree86_scancode_table2))
   15.81 -        sdl_scancode = xfree86_scancode_table2[event_scancode];
   15.82 -
   15.83 -    if (sdl_scancode != SDL_SCANCODE_UNKNOWN)
   15.84 -        SDL_SendKeyboardKey(key_state, sdl_scancode);
   15.85 -
   15.86 -    if (key_state == SDL_PRESSED)
   15.87 -        HandleKeyText(key_code);
   15.88 -}
   15.89 -
   15.90 -static void
   15.91 -HandleMouseButton(SDL_Window* sdl_window, Uint8 state, MirPointerEvent const* pointer)
   15.92 -{
   15.93 -    uint32_t sdl_button           = SDL_BUTTON_LEFT;
   15.94 -    MirPointerButton button_state = mir_pointer_button_primary;
   15.95 -
   15.96 -    static uint32_t old_button_states = 0;
   15.97 -    uint32_t new_button_states = MIR_mir_pointer_event_buttons(pointer);
   15.98 -
   15.99 -    // XOR on our old button states vs our new states to get the newley pressed/released button
  15.100 -    button_state = new_button_states ^ old_button_states;
  15.101 -
  15.102 -    switch (button_state) {
  15.103 -        case mir_pointer_button_primary:
  15.104 -            sdl_button = SDL_BUTTON_LEFT;
  15.105 -            break;
  15.106 -        case mir_pointer_button_secondary:
  15.107 -            sdl_button = SDL_BUTTON_RIGHT;
  15.108 -            break;
  15.109 -        case mir_pointer_button_tertiary:
  15.110 -            sdl_button = SDL_BUTTON_MIDDLE;
  15.111 -            break;
  15.112 -        case mir_pointer_button_forward:
  15.113 -            sdl_button = SDL_BUTTON_X1;
  15.114 -            break;
  15.115 -        case mir_pointer_button_back:
  15.116 -            sdl_button = SDL_BUTTON_X2;
  15.117 -            break;
  15.118 -        default:
  15.119 -            break;
  15.120 -    }
  15.121 -
  15.122 -    old_button_states = new_button_states;
  15.123 -
  15.124 -    SDL_SendMouseButton(sdl_window, 0, state, sdl_button);
  15.125 -}
  15.126 -
  15.127 -static void
  15.128 -HandleMouseMotion(SDL_Window* sdl_window, int x, int y)
  15.129 -{
  15.130 -    SDL_Mouse* mouse = SDL_GetMouse();
  15.131 -    SDL_SendMouseMotion(sdl_window, 0, mouse->relative_mode, x, y);
  15.132 -}
  15.133 -
  15.134 -static void
  15.135 -HandleTouchPress(int device_id, int source_id, SDL_bool down, float x, float y, float pressure)
  15.136 -{
  15.137 -    SDL_SendTouch(device_id, source_id, down, x, y, pressure);
  15.138 -}
  15.139 -
  15.140 -static void
  15.141 -HandleTouchMotion(int device_id, int source_id, float x, float y, float pressure)
  15.142 -{
  15.143 -    SDL_SendTouchMotion(device_id, source_id, x, y, pressure);
  15.144 -}
  15.145 -
  15.146 -static void
  15.147 -HandleMouseScroll(SDL_Window* sdl_window, float hscroll, float vscroll)
  15.148 -{
  15.149 -    SDL_SendMouseWheel(sdl_window, 0, hscroll, vscroll, SDL_MOUSEWHEEL_NORMAL);
  15.150 -}
  15.151 -
  15.152 -static void
  15.153 -AddTouchDevice(int device_id)
  15.154 -{
  15.155 -    if (SDL_AddTouch(device_id, "") < 0)
  15.156 -        SDL_SetError("Error: can't add touch %s, %d", __FILE__, __LINE__);
  15.157 -}
  15.158 -
  15.159 -static void
  15.160 -HandleTouchEvent(MirTouchEvent const* touch, int device_id, SDL_Window* sdl_window)
  15.161 -{
  15.162 -    int i, point_count;
  15.163 -    point_count = MIR_mir_touch_event_point_count(touch);
  15.164 -
  15.165 -    AddTouchDevice(device_id);
  15.166 -
  15.167 -    for (i = 0; i < point_count; i++) {
  15.168 -        int id = MIR_mir_touch_event_id(touch, i);
  15.169 -
  15.170 -        int width  = sdl_window->w;
  15.171 -        int height = sdl_window->h;
  15.172 -
  15.173 -        float x = MIR_mir_touch_event_axis_value(touch, i, mir_touch_axis_x);
  15.174 -        float y = MIR_mir_touch_event_axis_value(touch, i, mir_touch_axis_y);
  15.175 -
  15.176 -        float n_x = x / width;
  15.177 -        float n_y = y / height;
  15.178 -
  15.179 -        float pressure = MIR_mir_touch_event_axis_value(touch, i, mir_touch_axis_pressure);
  15.180 -
  15.181 -        switch (MIR_mir_touch_event_action(touch, i)) {
  15.182 -            case mir_touch_action_up:
  15.183 -                HandleTouchPress(device_id, id, SDL_FALSE, n_x, n_y, pressure);
  15.184 -                break;
  15.185 -            case mir_touch_action_down:
  15.186 -                HandleTouchPress(device_id, id, SDL_TRUE, n_x, n_y, pressure);
  15.187 -                break;
  15.188 -            case mir_touch_action_change:
  15.189 -                HandleTouchMotion(device_id, id, n_x, n_y, pressure);
  15.190 -                break;
  15.191 -            case mir_touch_actions:
  15.192 -                break;
  15.193 -        }
  15.194 -    }
  15.195 -}
  15.196 -
  15.197 -static void
  15.198 -HandleMouseEvent(MirPointerEvent const* pointer, SDL_Window* sdl_window)
  15.199 -{
  15.200 -    SDL_SetMouseFocus(sdl_window);
  15.201 -
  15.202 -    switch (MIR_mir_pointer_event_action(pointer)) {
  15.203 -        case mir_pointer_action_button_down:
  15.204 -            HandleMouseButton(sdl_window, SDL_PRESSED, pointer);
  15.205 -            break;
  15.206 -        case mir_pointer_action_button_up:
  15.207 -            HandleMouseButton(sdl_window, SDL_RELEASED, pointer);
  15.208 -            break;
  15.209 -        case mir_pointer_action_motion: {
  15.210 -            int x, y;
  15.211 -            float hscroll, vscroll;
  15.212 -            SDL_Mouse* mouse = SDL_GetMouse();
  15.213 -            x = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_x);
  15.214 -            y = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_y);
  15.215 -
  15.216 -            if (mouse) {
  15.217 -                if (mouse->relative_mode) {
  15.218 -                    int relative_x = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_relative_x);
  15.219 -                    int relative_y = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_relative_y);
  15.220 -                    HandleMouseMotion(sdl_window, relative_x, relative_y);
  15.221 -                }
  15.222 -                else if (mouse->x != x || mouse->y != y) {
  15.223 -                    HandleMouseMotion(sdl_window, x, y);
  15.224 -                }
  15.225 -            }
  15.226 -
  15.227 -            hscroll = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_hscroll);
  15.228 -            vscroll = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_vscroll);
  15.229 -            if (vscroll != 0 || hscroll != 0)
  15.230 -                HandleMouseScroll(sdl_window, hscroll, vscroll);
  15.231 -        }
  15.232 -            break;
  15.233 -        case mir_pointer_action_leave:
  15.234 -            SDL_SetMouseFocus(NULL);
  15.235 -            break;
  15.236 -        case mir_pointer_action_enter:
  15.237 -        default:
  15.238 -            break;
  15.239 -    }
  15.240 -}
  15.241 -
  15.242 -static void
  15.243 -HandleInput(MirInputEvent const* input_event, SDL_Window* window)
  15.244 -{
  15.245 -    switch (MIR_mir_input_event_get_type(input_event)) {
  15.246 -        case (mir_input_event_type_key):
  15.247 -            HandleKeyEvent(MIR_mir_input_event_get_keyboard_event(input_event), window);
  15.248 -            break;
  15.249 -        case (mir_input_event_type_pointer):
  15.250 -            HandleMouseEvent(MIR_mir_input_event_get_pointer_event(input_event), window);
  15.251 -            break;
  15.252 -        case (mir_input_event_type_touch):
  15.253 -            HandleTouchEvent(MIR_mir_input_event_get_touch_event(input_event),
  15.254 -                             MIR_mir_input_event_get_device_id(input_event),
  15.255 -                             window);
  15.256 -            break;
  15.257 -        default:
  15.258 -            break;
  15.259 -    }
  15.260 -}
  15.261 -
  15.262 -static void
  15.263 -HandleResize(MirResizeEvent const* resize_event, SDL_Window* window)
  15.264 -{
  15.265 -    int new_w = MIR_mir_resize_event_get_width (resize_event);
  15.266 -    int new_h = MIR_mir_resize_event_get_height(resize_event);
  15.267 -
  15.268 -    int old_w = window->w;
  15.269 -    int old_h = window->h;
  15.270 -
  15.271 -    if (new_w != old_w || new_h != old_h)
  15.272 -        SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, new_w, new_h);
  15.273 -}
  15.274 -
  15.275 -static void
  15.276 -HandleWindow(MirWindowEvent const* event, SDL_Window* window)
  15.277 -{
  15.278 -    MirWindowAttrib attrib = MIR_mir_window_event_get_attribute(event);
  15.279 -    int value              = MIR_mir_window_event_get_attribute_value(event);
  15.280 -
  15.281 -    if (attrib == mir_window_attrib_focus) {
  15.282 -        if (value == mir_window_focus_state_focused) {
  15.283 -            SDL_SetKeyboardFocus(window);
  15.284 -        }
  15.285 -        else if (value == mir_window_focus_state_unfocused) {
  15.286 -            SDL_SetKeyboardFocus(NULL);
  15.287 -        }
  15.288 -    }
  15.289 -}
  15.290 -
  15.291 -static void
  15.292 -MIR_HandleClose(SDL_Window* window) {
  15.293 -    SDL_SendWindowEvent(window, SDL_WINDOWEVENT_CLOSE, 0, 0);
  15.294 -}
  15.295 -
  15.296 -void
  15.297 -MIR_HandleEvent(MirWindow* mirwindow, MirEvent const* ev, void* context)
  15.298 -{
  15.299 -    MirEventType event_type = MIR_mir_event_get_type(ev);
  15.300 -    SDL_Window* window      = (SDL_Window*)context;
  15.301 -
  15.302 -    if (window) {
  15.303 -        switch (event_type) {
  15.304 -            case (mir_event_type_input):
  15.305 -                HandleInput(MIR_mir_event_get_input_event(ev), window);
  15.306 -                break;
  15.307 -            case (mir_event_type_resize):
  15.308 -                HandleResize(MIR_mir_event_get_resize_event(ev), window);
  15.309 -                break;
  15.310 -            case (mir_event_type_window):
  15.311 -                HandleWindow(MIR_mir_event_get_window_event(ev), window);
  15.312 -                break;
  15.313 -            case (mir_event_type_close_window):
  15.314 -                MIR_HandleClose(window);
  15.315 -                break;
  15.316 -            default:
  15.317 -                break;
  15.318 -        }
  15.319 -    }
  15.320 -}
  15.321 -
  15.322 -#endif /* SDL_VIDEO_DRIVER_MIR */
  15.323 -
  15.324 -/* vi: set ts=4 sw=4 expandtab: */
    16.1 --- a/src/video/mir/SDL_mirevents.h	Fri Nov 02 18:07:11 2018 -0700
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,37 +0,0 @@
    16.4 -/*
    16.5 -  Simple DirectMedia Layer
    16.6 -  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
    16.7 -
    16.8 -  This software is provided 'as-is', without any express or implied
    16.9 -  warranty.  In no event will the authors be held liable for any damages
   16.10 -  arising from the use of this software.
   16.11 -
   16.12 -  Permission is granted to anyone to use this software for any purpose,
   16.13 -  including commercial applications, and to alter it and redistribute it
   16.14 -  freely, subject to the following restrictions:
   16.15 -
   16.16 -  1. The origin of this software must not be misrepresented; you must not
   16.17 -     claim that you wrote the original software. If you use this software
   16.18 -     in a product, an acknowledgment in the product documentation would be
   16.19 -     appreciated but is not required.
   16.20 -  2. Altered source versions must be plainly marked as such, and must not be
   16.21 -     misrepresented as being the original software.
   16.22 -  3. This notice may not be removed or altered from any source distribution.
   16.23 -*/
   16.24 -
   16.25 -/*
   16.26 -  Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
   16.27 -*/
   16.28 -
   16.29 -#ifndef SDL_mirevents_h_
   16.30 -#define SDL_mirevents_h_
   16.31 -
   16.32 -#include <mir_toolkit/mir_client_library.h>
   16.33 -
   16.34 -extern void
   16.35 -MIR_HandleEvent(MirWindow*, MirEvent const* ev, void* context);
   16.36 -
   16.37 -#endif /* SDL_mirevents_h_ */
   16.38 -
   16.39 -/* vi: set ts=4 sw=4 expandtab: */
   16.40 -
    17.1 --- a/src/video/mir/SDL_mirframebuffer.c	Fri Nov 02 18:07:11 2018 -0700
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,134 +0,0 @@
    17.4 -/*
    17.5 -  Simple DirectMedia Layer
    17.6 -  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
    17.7 -
    17.8 -  This software is provided 'as-is', without any express or implied
    17.9 -  warranty.  In no event will the authors be held liable for any damages
   17.10 -  arising from the use of this software.
   17.11 -
   17.12 -  Permission is granted to anyone to use this software for any purpose,
   17.13 -  including commercial applications, and to alter it and redistribute it
   17.14 -  freely, subject to the following restrictions:
   17.15 -
   17.16 -  1. The origin of this software must not be misrepresented; you must not
   17.17 -     claim that you wrote the original software. If you use this software
   17.18 -     in a product, an acknowledgment in the product documentation would be
   17.19 -     appreciated but is not required.
   17.20 -  2. Altered source versions must be plainly marked as such, and must not be
   17.21 -     misrepresented as being the original software.
   17.22 -  3. This notice may not be removed or altered from any source distribution.
   17.23 -*/
   17.24 -
   17.25 -/*
   17.26 -  Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
   17.27 -*/
   17.28 -
   17.29 -#include "../../SDL_internal.h"
   17.30 -
   17.31 -#if SDL_VIDEO_DRIVER_MIR
   17.32 -
   17.33 -#include "SDL_mirevents.h"
   17.34 -#include "SDL_mirframebuffer.h"
   17.35 -#include "SDL_mirwindow.h"
   17.36 -
   17.37 -#include "SDL_mirdyn.h"
   17.38 -
   17.39 -int
   17.40 -MIR_CreateWindowFramebuffer(_THIS, SDL_Window* window, Uint32* format,
   17.41 -                            void** pixels, int* pitch)
   17.42 -{
   17.43 -    MIR_Data* mir_data = _this->driverdata;
   17.44 -
   17.45 -    mir_data->software = SDL_TRUE;
   17.46 -
   17.47 -    if (MIR_CreateWindow(_this, window) < 0)
   17.48 -        return SDL_SetError("Failed to create a mir window.");
   17.49 -
   17.50 -    *format = MIR_GetSDLPixelFormat(mir_data->pixel_format);
   17.51 -    if (*format == SDL_PIXELFORMAT_UNKNOWN)
   17.52 -        return SDL_SetError("Unknown pixel format");
   17.53 -
   17.54 -    *pitch = (((window->w * SDL_BYTESPERPIXEL(*format)) + 3) & ~3);
   17.55 -
   17.56 -    *pixels = SDL_malloc(window->h*(*pitch));
   17.57 -    if (*pixels == NULL)
   17.58 -        return SDL_OutOfMemory();
   17.59 -
   17.60 -    return 0;
   17.61 -}
   17.62 -
   17.63 -int
   17.64 -MIR_UpdateWindowFramebuffer(_THIS, SDL_Window* window,
   17.65 -                            const SDL_Rect* rects, int numrects)
   17.66 -{
   17.67 -    MIR_Window* mir_window = window->driverdata;
   17.68 -
   17.69 -    MirGraphicsRegion region;
   17.70 -    MirBufferStream* bs;
   17.71 -    int i, j, x, y, w, h, start;
   17.72 -    int bytes_per_pixel, bytes_per_row, s_stride, d_stride;
   17.73 -    char* s_dest;
   17.74 -    char* pixels;
   17.75 -
   17.76 -    bs = MIR_mir_window_get_buffer_stream(mir_window->window);
   17.77 -    MIR_mir_buffer_stream_get_graphics_region(bs, &region);
   17.78 -
   17.79 -    s_dest = region.vaddr;
   17.80 -    pixels = (char*)window->surface->pixels;
   17.81 -
   17.82 -    s_stride = window->surface->pitch;
   17.83 -    d_stride = region.stride;
   17.84 -    bytes_per_pixel = window->surface->format->BytesPerPixel;
   17.85 -
   17.86 -    for (i = 0; i < numrects; i++) {
   17.87 -        s_dest = region.vaddr;
   17.88 -        pixels = (char*)window->surface->pixels;
   17.89 -
   17.90 -        x = rects[i].x;
   17.91 -        y = rects[i].y;
   17.92 -        w = rects[i].w;
   17.93 -        h = rects[i].h;
   17.94 -
   17.95 -        if (w <= 0 || h <= 0 || (x + w) <= 0 || (y + h) <= 0)
   17.96 -            continue;
   17.97 -
   17.98 -        if (x < 0) {
   17.99 -            x += w;
  17.100 -            w += rects[i].x;
  17.101 -        }
  17.102 -
  17.103 -        if (y < 0) {
  17.104 -            y += h;
  17.105 -            h += rects[i].y;
  17.106 -        }
  17.107 -
  17.108 -        if (x + w > window->w)
  17.109 -            w = window->w - x;
  17.110 -        if (y + h > window->h)
  17.111 -            h = window->h - y;
  17.112 -
  17.113 -        start = y * s_stride + x;
  17.114 -        pixels += start;
  17.115 -        s_dest += start;
  17.116 -
  17.117 -        bytes_per_row =  bytes_per_pixel * w;
  17.118 -        for (j = 0; j < h; j++) {
  17.119 -            SDL_memcpy(s_dest, pixels, bytes_per_row);
  17.120 -            pixels += s_stride;
  17.121 -            s_dest += d_stride;
  17.122 -        }
  17.123 -    }
  17.124 -
  17.125 -    MIR_mir_buffer_stream_swap_buffers_sync(bs);
  17.126 -
  17.127 -    return 0;
  17.128 -}
  17.129 -
  17.130 -void
  17.131 -MIR_DestroyWindowFramebuffer(_THIS, SDL_Window* window)
  17.132 -{
  17.133 -}
  17.134 -
  17.135 -#endif /* SDL_VIDEO_DRIVER_MIR */
  17.136 -
  17.137 -/* vi: set ts=4 sw=4 expandtab: */
    18.1 --- a/src/video/mir/SDL_mirframebuffer.h	Fri Nov 02 18:07:11 2018 -0700
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,47 +0,0 @@
    18.4 -/*
    18.5 -  Simple DirectMedia Layer
    18.6 -  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
    18.7 -
    18.8 -  This software is provided 'as-is', without any express or implied
    18.9 -  warranty.  In no event will the authors be held liable for any damages
   18.10 -  arising from the use of this software.
   18.11 -
   18.12 -  Permission is granted to anyone to use this software for any purpose,
   18.13 -  including commercial applications, and to alter it and redistribute it
   18.14 -  freely, subject to the following restrictions:
   18.15 -
   18.16 -  1. The origin of this software must not be misrepresented; you must not
   18.17 -     claim that you wrote the original software. If you use this software
   18.18 -     in a product, an acknowledgment in the product documentation would be
   18.19 -     appreciated but is not required.
   18.20 -  2. Altered source versions must be plainly marked as such, and must not be
   18.21 -     misrepresented as being the original software.
   18.22 -  3. This notice may not be removed or altered from any source distribution.
   18.23 -*/
   18.24 -
   18.25 -/*
   18.26 -  Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
   18.27 -*/
   18.28 -
   18.29 -#ifndef SDL_mirframebuffer_h_
   18.30 -#define SDL_mirframebuffer_h_
   18.31 -
   18.32 -#include "../SDL_sysvideo.h"
   18.33 -
   18.34 -#include "SDL_mirvideo.h"
   18.35 -
   18.36 -extern int
   18.37 -MIR_CreateWindowFramebuffer(_THIS, SDL_Window* sdl_window, Uint32* format,
   18.38 -                            void** pixels, int* pitch);
   18.39 -
   18.40 -extern int
   18.41 -MIR_UpdateWindowFramebuffer(_THIS, SDL_Window* sdl_window,
   18.42 -                            const SDL_Rect* rects, int numrects);
   18.43 -
   18.44 -extern void
   18.45 -MIR_DestroyWindowFramebuffer(_THIS, SDL_Window* sdl_window);
   18.46 -
   18.47 -#endif /* SDL_mirframebuffer_h_ */
   18.48 -
   18.49 -/* vi: set ts=4 sw=4 expandtab: */
   18.50 -
    19.1 --- a/src/video/mir/SDL_mirmouse.c	Fri Nov 02 18:07:11 2018 -0700
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,292 +0,0 @@
    19.4 -/*
    19.5 -  Simple DirectMedia Layer
    19.6 -  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
    19.7 -
    19.8 -  This software is provided 'as-is', without any express or implied
    19.9 -  warranty.  In no event will the authors be held liable for any damages
   19.10 -  arising from the use of this software.
   19.11 -
   19.12 -  Permission is granted to anyone to use this software for any purpose,
   19.13 -  including commercial applications, and to alter it and redistribute it
   19.14 -  freely, subject to the following restrictions:
   19.15 -
   19.16 -  1. The origin of this software must not be misrepresented; you must not
   19.17 -     claim that you wrote the original software. If you use this software
   19.18 -     in a product, an acknowledgment in the product documentation would be
   19.19 -     appreciated but is not required.
   19.20 -  2. Altered source versions must be plainly marked as such, and must not be
   19.21 -     misrepresented as being the original software.
   19.22 -  3. This notice may not be removed or altered from any source distribution.
   19.23 -*/
   19.24 -
   19.25 -/*
   19.26 -  Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
   19.27 -*/
   19.28 -
   19.29 -#include "../../SDL_internal.h"
   19.30 -
   19.31 -#if SDL_VIDEO_DRIVER_MIR
   19.32 -
   19.33 -#include "../../events/SDL_mouse_c.h"
   19.34 -#include "../SDL_sysvideo.h"
   19.35 -#include "SDL_assert.h"
   19.36 -
   19.37 -#include "SDL_mirdyn.h"
   19.38 -
   19.39 -#include "SDL_mirvideo.h"
   19.40 -#include "SDL_mirmouse.h"
   19.41 -#include "SDL_mirwindow.h"
   19.42 -
   19.43 -typedef struct
   19.44 -{
   19.45 -    MirCursorConfiguration* conf;
   19.46 -    MirBufferStream*        stream;
   19.47 -    char const*             name;
   19.48 -} MIR_Cursor;
   19.49 -
   19.50 -static SDL_Cursor*
   19.51 -MIR_CreateDefaultCursor()
   19.52 -{
   19.53 -    SDL_Cursor* cursor;
   19.54 -
   19.55 -    cursor = SDL_calloc(1, sizeof(SDL_Cursor));
   19.56 -    if (cursor) {
   19.57 -
   19.58 -        MIR_Cursor* mir_cursor = SDL_calloc(1, sizeof(MIR_Cursor));
   19.59 -        if (mir_cursor) {
   19.60 -            mir_cursor->conf   = NULL;
   19.61 -            mir_cursor->stream = NULL;
   19.62 -            mir_cursor->name   = NULL;
   19.63 -            cursor->driverdata = mir_cursor;
   19.64 -        }
   19.65 -        else {
   19.66 -            SDL_OutOfMemory();
   19.67 -            SDL_free(cursor);
   19.68 -            cursor = NULL;
   19.69 -        }
   19.70 -    }
   19.71 -    else {
   19.72 -        SDL_OutOfMemory();
   19.73 -    }
   19.74 -
   19.75 -    return cursor;
   19.76 -}
   19.77 -
   19.78 -static void
   19.79 -CopySurfacePixelsToMirStream(SDL_Surface* surface, MirBufferStream* stream)
   19.80 -{
   19.81 -    char* dest, *pixels;
   19.82 -    int i, s_w, s_h, r_stride, p_stride, bytes_per_pixel, bytes_per_row;
   19.83 -
   19.84 -    MirGraphicsRegion region;
   19.85 -    MIR_mir_buffer_stream_get_graphics_region(stream, &region);
   19.86 -
   19.87 -    s_w = surface->w;
   19.88 -    s_h = surface->h;
   19.89 -
   19.90 -    bytes_per_pixel = surface->format->BytesPerPixel;
   19.91 -    bytes_per_row   = bytes_per_pixel * s_w;
   19.92 -
   19.93 -    dest = region.vaddr;
   19.94 -    pixels = (char*)surface->pixels;
   19.95 -
   19.96 -    r_stride = region.stride;
   19.97 -    p_stride = surface->pitch;
   19.98 -
   19.99 -    for (i = 0; i < s_h; i++)
  19.100 -    {
  19.101 -        SDL_memcpy(dest, pixels, bytes_per_row);
  19.102 -        dest   += r_stride;
  19.103 -        pixels += p_stride;
  19.104 -    }
  19.105 -}
  19.106 -
  19.107 -static SDL_Cursor*
  19.108 -MIR_CreateCursor(SDL_Surface* surface, int hot_x, int hot_y)
  19.109 -{
  19.110 -    MirCursorConfiguration* conf;
  19.111 -    MirBufferStream*        stream;
  19.112 -
  19.113 -    int s_w = surface->w;
  19.114 -    int s_h = surface->h;
  19.115 -
  19.116 -    MIR_Data* mir_data     = (MIR_Data*)SDL_GetVideoDevice()->driverdata;
  19.117 -    SDL_Cursor* cursor     = MIR_CreateDefaultCursor();
  19.118 -    MIR_Cursor* mir_cursor;
  19.119 -
  19.120 -    if (!cursor) {
  19.121 -        return NULL;
  19.122 -    }
  19.123 -
  19.124 -    mir_cursor = (MIR_Cursor*)cursor->driverdata;
  19.125 -
  19.126 -    stream = MIR_mir_connection_create_buffer_stream_sync(mir_data->connection,
  19.127 -                                                          s_w, s_h, mir_data->pixel_format,
  19.128 -                                                          mir_buffer_usage_software);
  19.129 -
  19.130 -    conf = MIR_mir_cursor_configuration_from_buffer_stream(stream, hot_x, hot_y);
  19.131 -
  19.132 -    CopySurfacePixelsToMirStream(surface, stream);
  19.133 -    MIR_mir_buffer_stream_swap_buffers_sync(stream);
  19.134 -
  19.135 -    mir_cursor->conf   = conf;
  19.136 -    mir_cursor->stream = stream;
  19.137 -
  19.138 -    return cursor;
  19.139 -}
  19.140 -
  19.141 -static SDL_Cursor*
  19.142 -MIR_CreateSystemCursor(SDL_SystemCursor id)
  19.143 -{
  19.144 -    char const* cursor_name = NULL;
  19.145 -    SDL_Cursor* cursor;
  19.146 -    MIR_Cursor* mir_cursor;
  19.147 -
  19.148 -    switch(id) {
  19.149 -        case SDL_SYSTEM_CURSOR_ARROW:
  19.150 -            cursor_name = MIR_mir_arrow_cursor_name;
  19.151 -            break;
  19.152 -        case SDL_SYSTEM_CURSOR_IBEAM:
  19.153 -            cursor_name = MIR_mir_caret_cursor_name;
  19.154 -            break;
  19.155 -        case SDL_SYSTEM_CURSOR_WAIT:
  19.156 -            cursor_name = MIR_mir_busy_cursor_name;
  19.157 -            break;
  19.158 -        case SDL_SYSTEM_CURSOR_CROSSHAIR:
  19.159 -            /* Unsupported */
  19.160 -            cursor_name = MIR_mir_arrow_cursor_name;
  19.161 -            break;
  19.162 -        case SDL_SYSTEM_CURSOR_WAITARROW:
  19.163 -            cursor_name = MIR_mir_busy_cursor_name;
  19.164 -            break;
  19.165 -        case SDL_SYSTEM_CURSOR_SIZENWSE:
  19.166 -            cursor_name = MIR_mir_omnidirectional_resize_cursor_name;
  19.167 -            break;
  19.168 -        case SDL_SYSTEM_CURSOR_SIZENESW:
  19.169 -            cursor_name = MIR_mir_omnidirectional_resize_cursor_name;
  19.170 -            break;
  19.171 -        case SDL_SYSTEM_CURSOR_SIZEWE:
  19.172 -            cursor_name = MIR_mir_horizontal_resize_cursor_name;
  19.173 -            break;
  19.174 -        case SDL_SYSTEM_CURSOR_SIZENS:
  19.175 -            cursor_name = MIR_mir_vertical_resize_cursor_name;
  19.176 -            break;
  19.177 -        case SDL_SYSTEM_CURSOR_SIZEALL:
  19.178 -            cursor_name = MIR_mir_omnidirectional_resize_cursor_name;
  19.179 -            break;
  19.180 -        case SDL_SYSTEM_CURSOR_NO:
  19.181 -            /* Unsupported */
  19.182 -            cursor_name = MIR_mir_closed_hand_cursor_name;
  19.183 -            break;
  19.184 -        case SDL_SYSTEM_CURSOR_HAND:
  19.185 -            cursor_name = MIR_mir_open_hand_cursor_name;
  19.186 -            break;
  19.187 -        default:
  19.188 -            SDL_assert(0);
  19.189 -            return NULL;
  19.190 -    }
  19.191 -
  19.192 -    cursor = MIR_CreateDefaultCursor();
  19.193 -    if (!cursor) {
  19.194 -        return NULL;
  19.195 -    }
  19.196 -
  19.197 -    mir_cursor = (MIR_Cursor*)cursor->driverdata;
  19.198 -    mir_cursor->name = cursor_name;
  19.199 -
  19.200 -    return cursor;
  19.201 -}
  19.202 -
  19.203 -static void
  19.204 -MIR_FreeCursor(SDL_Cursor* cursor)
  19.205 -{
  19.206 -    if (cursor) {
  19.207 -
  19.208 -        if (cursor->driverdata) {
  19.209 -            MIR_Cursor* mir_cursor = (MIR_Cursor*)cursor->driverdata;
  19.210 -
  19.211 -            if (mir_cursor->conf)
  19.212 -                MIR_mir_cursor_configuration_destroy(mir_cursor->conf);
  19.213 -            if (mir_cursor->stream)
  19.214 -                MIR_mir_buffer_stream_release_sync(mir_cursor->stream);
  19.215 -
  19.216 -            SDL_free(mir_cursor);
  19.217 -        }
  19.218 -
  19.219 -        SDL_free(cursor);
  19.220 -    }
  19.221 -}
  19.222 -
  19.223 -static int
  19.224 -MIR_ShowCursor(SDL_Cursor* cursor)
  19.225 -{
  19.226 -    MIR_Data* mir_data      = (MIR_Data*)SDL_GetVideoDevice()->driverdata;
  19.227 -    MIR_Window* mir_window  = mir_data->current_window;
  19.228 -
  19.229 -    if (cursor && cursor->driverdata) {
  19.230 -        if (mir_window && MIR_mir_window_is_valid(mir_window->window)) {
  19.231 -            MIR_Cursor* mir_cursor = (MIR_Cursor*)cursor->driverdata;
  19.232 -
  19.233 -            if (mir_cursor->name != NULL) {
  19.234 -                MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection);
  19.235 -                MIR_mir_window_spec_set_cursor_name(spec, mir_cursor->name);
  19.236 -                MIR_mir_window_apply_spec(mir_window->window, spec);
  19.237 -                MIR_mir_window_spec_release(spec);
  19.238 -            }
  19.239 -
  19.240 -            if (mir_cursor->conf) {
  19.241 -                MIR_mir_window_configure_cursor(mir_window->window, mir_cursor->conf);
  19.242 -            }
  19.243 -        }
  19.244 -    }
  19.245 -    else if(mir_window && MIR_mir_window_is_valid(mir_window->window)) {
  19.246 -        MIR_mir_window_configure_cursor(mir_window->window, NULL);
  19.247 -    }
  19.248 -
  19.249 -    return 0;
  19.250 -}
  19.251 -
  19.252 -static void
  19.253 -MIR_WarpMouse(SDL_Window* window, int x, int y)
  19.254 -{
  19.255 -    SDL_Unsupported();
  19.256 -}
  19.257 -
  19.258 -static int
  19.259 -MIR_WarpMouseGlobal(int x, int y)
  19.260 -{
  19.261 -    return SDL_Unsupported();
  19.262 -}
  19.263 -
  19.264 -static int
  19.265 -MIR_SetRelativeMouseMode(SDL_bool enabled)
  19.266 -{
  19.267 -    return 0;
  19.268 -}
  19.269 -
  19.270 -/* TODO Actually implement the cursor, need to wait for mir support */
  19.271 -void
  19.272 -MIR_InitMouse()
  19.273 -{
  19.274 -    SDL_Mouse* mouse = SDL_GetMouse();
  19.275 -
  19.276 -    mouse->CreateCursor         = MIR_CreateCursor;
  19.277 -    mouse->ShowCursor           = MIR_ShowCursor;
  19.278 -    mouse->FreeCursor           = MIR_FreeCursor;
  19.279 -    mouse->WarpMouse            = MIR_WarpMouse;
  19.280 -    mouse->WarpMouseGlobal      = MIR_WarpMouseGlobal;
  19.281 -    mouse->CreateSystemCursor   = MIR_CreateSystemCursor;
  19.282 -    mouse->SetRelativeMouseMode = MIR_SetRelativeMouseMode;
  19.283 -
  19.284 -    SDL_SetDefaultCursor(MIR_CreateDefaultCursor());
  19.285 -}
  19.286 -
  19.287 -void
  19.288 -MIR_FiniMouse()
  19.289 -{
  19.290 -}
  19.291 -
  19.292 -#endif /* SDL_VIDEO_DRIVER_MIR */
  19.293 -
  19.294 -/* vi: set ts=4 sw=4 expandtab: */
  19.295 -
    20.1 --- a/src/video/mir/SDL_mirmouse.h	Fri Nov 02 18:07:11 2018 -0700
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,37 +0,0 @@
    20.4 -/*
    20.5 -  Simple DirectMedia Layer
    20.6 -  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
    20.7 -
    20.8 -  This software is provided 'as-is', without any express or implied
    20.9 -  warranty.  In no event will the authors be held liable for any damages
   20.10 -  arising from the use of this software.
   20.11 -
   20.12 -  Permission is granted to anyone to use this software for any purpose,
   20.13 -  including commercial applications, and to alter it and redistribute it
   20.14 -  freely, subject to the following restrictions:
   20.15 -
   20.16 -  1. The origin of this software must not be misrepresented; you must not
   20.17 -     claim that you wrote the original software. If you use this software
   20.18 -     in a product, an acknowledgment in the product documentation would be
   20.19 -     appreciated but is not required.
   20.20 -  2. Altered source versions must be plainly marked as such, and must not be
   20.21 -     misrepresented as being the original software.
   20.22 -  3. This notice may not be removed or altered from any source distribution.
   20.23 -*/
   20.24 -
   20.25 -/*
   20.26 -  Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
   20.27 -*/
   20.28 -
   20.29 -#ifndef SDL_mirmouse_h_
   20.30 -#define SDL_mirmouse_h_
   20.31 -
   20.32 -extern void
   20.33 -MIR_InitMouse();
   20.34 -
   20.35 -extern void
   20.36 -MIR_FiniMouse();
   20.37 -
   20.38 -#endif /* SDL_mirmouse_h_ */
   20.39 -
   20.40 -/* vi: set ts=4 sw=4 expandtab: */
    21.1 --- a/src/video/mir/SDL_miropengl.c	Fri Nov 02 18:07:11 2018 -0700
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,78 +0,0 @@
    21.4 -/*
    21.5 -  Simple DirectMedia Layer
    21.6 -  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
    21.7 -
    21.8 -  This software is provided 'as-is', without any express or implied
    21.9 -  warranty.  In no event will the authors be held liable for any damages
   21.10 -  arising from the use of this software.
   21.11 -
   21.12 -  Permission is granted to anyone to use this software for any purpose,
   21.13 -  including commercial applications, and to alter it and redistribute it
   21.14 -  freely, subject to the following restrictions:
   21.15 -
   21.16 -  1. The origin of this software must not be misrepresented; you must not
   21.17 -     claim that you wrote the original software. If you use this software
   21.18 -     in a product, an acknowledgment in the product documentation would be
   21.19 -     appreciated but is not required.
   21.20 -  2. Altered source versions must be plainly marked as such, and must not be
   21.21 -     misrepresented as being the original software.
   21.22 -  3. This notice may not be removed or altered from any source distribution.
   21.23 -*/
   21.24 -
   21.25 -/*
   21.26 -  Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
   21.27 -*/
   21.28 -
   21.29 -#include "../../SDL_internal.h"
   21.30 -
   21.31 -#if SDL_VIDEO_DRIVER_MIR
   21.32 -
   21.33 -#include "SDL_miropengl.h"
   21.34 -
   21.35 -#include "SDL_mirdyn.h"
   21.36 -
   21.37 -int
   21.38 -MIR_GL_SwapWindow(_THIS, SDL_Window* window)
   21.39 -{
   21.40 -    MIR_Window* mir_wind = window->driverdata;
   21.41 -
   21.42 -    return SDL_EGL_SwapBuffers(_this, mir_wind->egl_surface);
   21.43 -}
   21.44 -
   21.45 -int
   21.46 -MIR_GL_MakeCurrent(_THIS, SDL_Window* window, SDL_GLContext context)
   21.47 -{
   21.48 -  if (window) {
   21.49 -      EGLSurface egl_surface = ((MIR_Window*)window->driverdata)->egl_surface;
   21.50 -      return SDL_EGL_MakeCurrent(_this, egl_surface, context);
   21.51 -  }
   21.52 -
   21.53 -  return SDL_EGL_MakeCurrent(_this, NULL, NULL);
   21.54 -}
   21.55 -
   21.56 -SDL_GLContext
   21.57 -MIR_GL_CreateContext(_THIS, SDL_Window* window)
   21.58 -{
   21.59 -    MIR_Window* mir_window = window->driverdata;
   21.60 -
   21.61 -    SDL_GLContext context;
   21.62 -    context = SDL_EGL_CreateContext(_this, mir_window->egl_surface);
   21.63 -
   21.64 -    return context;
   21.65 -}
   21.66 -
   21.67 -int
   21.68 -MIR_GL_LoadLibrary(_THIS, const char* path)
   21.69 -{
   21.70 -    MIR_Data* mir_data = _this->driverdata;
   21.71 -
   21.72 -    SDL_EGL_LoadLibrary(_this, path, MIR_mir_connection_get_egl_native_display(mir_data->connection), 0);
   21.73 -
   21.74 -    SDL_EGL_ChooseConfig(_this);
   21.75 -
   21.76 -    return 0;
   21.77 -}
   21.78 -
   21.79 -#endif /* SDL_VIDEO_DRIVER_MIR */
   21.80 -
   21.81 -/* vi: set ts=4 sw=4 expandtab: */
    22.1 --- a/src/video/mir/SDL_miropengl.h	Fri Nov 02 18:07:11 2018 -0700
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,53 +0,0 @@
    22.4 -/*
    22.5 -  Simple DirectMedia Layer
    22.6 -  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
    22.7 -
    22.8 -  This software is provided 'as-is', without any express or implied
    22.9 -  warranty.  In no event will the authors be held liable for any damages
   22.10 -  arising from the use of this software.
   22.11 -
   22.12 -  Permission is granted to anyone to use this software for any purpose,
   22.13 -  including commercial applications, and to alter it and redistribute it
   22.14 -  freely, subject to the following restrictions:
   22.15 -
   22.16 -  1. The origin of this software must not be misrepresented; you must not
   22.17 -     claim that you wrote the original software. If you use this software
   22.18 -     in a product, an acknowledgment in the product documentation would be
   22.19 -     appreciated but is not required.
   22.20 -  2. Altered source versions must be plainly marked as such, and must not be
   22.21 -     misrepresented as being the original software.
   22.22 -  3. This notice may not be removed or altered from any source distribution.
   22.23 -*/
   22.24 -
   22.25 -/*
   22.26 -  Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
   22.27 -*/
   22.28 -
   22.29 -#ifndef SDL_miropengl_h_
   22.30 -#define SDL_miropengl_h_
   22.31 -
   22.32 -#include "SDL_mirwindow.h"
   22.33 -
   22.34 -#include "../SDL_egl_c.h"
   22.35 -
   22.36 -#define MIR_GL_DeleteContext   SDL_EGL_DeleteContext
   22.37 -#define MIR_GL_GetSwapInterval SDL_EGL_GetSwapInterval
   22.38 -#define MIR_GL_SetSwapInterval SDL_EGL_SetSwapInterval
   22.39 -#define MIR_GL_UnloadLibrary   SDL_EGL_UnloadLibrary
   22.40 -#define MIR_GL_GetProcAddress  SDL_EGL_GetProcAddress
   22.41 -
   22.42 -extern int
   22.43 -MIR_GL_SwapWindow(_THIS, SDL_Window* window);
   22.44 -
   22.45 -extern int
   22.46 -MIR_GL_MakeCurrent(_THIS, SDL_Window* window, SDL_GLContext context);
   22.47 -
   22.48 -extern SDL_GLContext
   22.49 -MIR_GL_CreateContext(_THIS, SDL_Window* window);
   22.50 -
   22.51 -extern int
   22.52 -MIR_GL_LoadLibrary(_THIS, const char* path);
   22.53 -
   22.54 -#endif /* SDL_miropengl_h_ */
   22.55 -
   22.56 -/* vi: set ts=4 sw=4 expandtab: */
    23.1 --- a/src/video/mir/SDL_mirsym.h	Fri Nov 02 18:07:11 2018 -0700
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,143 +0,0 @@
    23.4 -/*
    23.5 -  Simple DirectMedia Layer
    23.6 -  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
    23.7 -
    23.8 -  This software is provided 'as-is', without any express or implied
    23.9 -  warranty.  In no event will the authors be held liable for any damages
   23.10 -  arising from the use of this software.
   23.11 -
   23.12 -  Permission is granted to anyone to use this software for any purpose,
   23.13 -  including commercial applications, and to alter it and redistribute it
   23.14 -  freely, subject to the following restrictions:
   23.15 -
   23.16 -  1. The origin of this software must not be misrepresented; you must not
   23.17 -     claim that you wrote the original software. If you use this software
   23.18 -     in a product, an acknowledgment in the product documentation would be
   23.19 -     appreciated but is not required.
   23.20 -  2. Altered source versions must be plainly marked as such, and must not be
   23.21 -     misrepresented as being the original software.
   23.22 -  3. This notice may not be removed or altered from any source distribution.
   23.23 -*/
   23.24 -
   23.25 -/* *INDENT-OFF* */
   23.26 -
   23.27 -#ifndef SDL_MIR_MODULE
   23.28 -#define SDL_MIR_MODULE(modname)
   23.29 -#endif
   23.30 -
   23.31 -#ifndef SDL_MIR_SYM
   23.32 -#define SDL_MIR_SYM(rc,fn,params)
   23.33 -#endif
   23.34 -
   23.35 -#ifndef SDL_MIR_SYM_CONST
   23.36 -#define SDL_MIR_SYM_CONST(type, name)
   23.37 -#endif
   23.38 -
   23.39 -SDL_MIR_MODULE(MIR_CLIENT)
   23.40 -SDL_MIR_SYM(MirWindow *,mir_create_window_sync,(MirWindowSpec* spec))
   23.41 -SDL_MIR_SYM(MirEGLNativeWindowType,mir_buffer_stream_get_egl_native_window,(MirBufferStream *surface))
   23.42 -SDL_MIR_SYM(bool,mir_buffer_stream_get_graphics_region,(MirBufferStream *stream, MirGraphicsRegion *graphics_region))
   23.43 -SDL_MIR_SYM(void,mir_buffer_stream_swap_buffers_sync,(MirBufferStream *stream))
   23.44 -SDL_MIR_SYM(void,mir_window_set_event_handler,(MirWindow* window, MirWindowEventCallback callback, void* context))
   23.45 -SDL_MIR_SYM(MirWindowSpec*,mir_create_normal_window_spec,(MirConnection *connection, int width, int height))
   23.46 -SDL_MIR_SYM(MirWindowSpec*,mir_create_window_spec,(MirConnection *connection))
   23.47 -SDL_MIR_SYM(void,mir_window_spec_set_buffer_usage,(MirWindowSpec *spec, MirBufferUsage usage))
   23.48 -SDL_MIR_SYM(void,mir_window_spec_set_name,(MirWindowSpec *spec, char const *name))
   23.49 -SDL_MIR_SYM(void,mir_window_spec_release,(MirWindowSpec *spec))
   23.50 -SDL_MIR_SYM(void,mir_window_spec_set_width,(MirWindowSpec *spec, unsigned width))
   23.51 -SDL_MIR_SYM(void,mir_window_spec_set_height,(MirWindowSpec *spec, unsigned height))
   23.52 -SDL_MIR_SYM(void,mir_window_spec_set_min_width,(MirWindowSpec *spec, unsigned min_width))
   23.53 -SDL_MIR_SYM(void,mir_window_spec_set_min_height,(MirWindowSpec *spec, unsigned min_height))
   23.54 -SDL_MIR_SYM(void,mir_window_spec_set_max_width,(MirWindowSpec *spec, unsigned max_width))
   23.55 -SDL_MIR_SYM(void,mir_window_spec_set_max_height,(MirWindowSpec *spec, unsigned max_height))
   23.56 -SDL_MIR_SYM(void,mir_window_spec_set_type,(MirWindowSpec *spec, MirWindowType type))
   23.57 -SDL_MIR_SYM(void,mir_window_spec_set_state,(MirWindowSpec *spec, MirWindowState state))
   23.58 -SDL_MIR_SYM(void,mir_window_spec_set_pointer_confinement,(MirWindowSpec *spec, MirPointerConfinementState state))
   23.59 -SDL_MIR_SYM(void,mir_window_spec_set_pixel_format,(MirWindowSpec *spec, MirPixelFormat pixel_format))
   23.60 -SDL_MIR_SYM(void,mir_window_spec_set_cursor_name,(MirWindowSpec *spec, char const* cursor_name))
   23.61 -SDL_MIR_SYM(void,mir_window_apply_spec,(MirWindow* window, MirWindowSpec* spec))
   23.62 -SDL_MIR_SYM(void,mir_window_get_parameters,(MirWindow *window, MirWindowParameters *params))
   23.63 -SDL_MIR_SYM(MirBufferStream*,mir_window_get_buffer_stream,(MirWindow* window))
   23.64 -SDL_MIR_SYM(MirCursorConfiguration*,mir_cursor_configuration_from_buffer_stream,(MirBufferStream const* stream, int hot_x, int hot_y))
   23.65 -SDL_MIR_SYM(MirBufferStream*,mir_connection_create_buffer_stream_sync,(MirConnection *connection, int w, int h, MirPixelFormat format, MirBufferUsage usage))
   23.66 -SDL_MIR_SYM(MirKeyboardAction,mir_keyboard_event_action,(MirKeyboardEvent const *event))
   23.67 -SDL_MIR_SYM(xkb_keysym_t,mir_keyboard_event_key_code,(MirKeyboardEvent const *event))
   23.68 -SDL_MIR_SYM(int,mir_keyboard_event_scan_code,(MirKeyboardEvent const *event))
   23.69 -SDL_MIR_SYM(bool,mir_pointer_event_button_state,(MirPointerEvent const *event, MirPointerButton button))
   23.70 -SDL_MIR_SYM(MirPointerButtons,mir_pointer_event_buttons,(MirPointerEvent const *event))
   23.71 -SDL_MIR_SYM(MirInputDeviceId,mir_input_event_get_device_id,(MirInputEvent const* ev))
   23.72 -SDL_MIR_SYM(MirTouchId,mir_touch_event_id,(MirTouchEvent const *event, size_t touch_index))
   23.73 -SDL_MIR_SYM(float,mir_touch_event_axis_value,(MirTouchEvent const *event, size_t touch_index, MirTouchAxis axis))
   23.74 -SDL_MIR_SYM(MirTouchAction,mir_touch_event_action,(MirTouchEvent const *event, size_t touch_index))
   23.75 -SDL_MIR_SYM(MirPointerAction,mir_pointer_event_action,(MirPointerEvent const *event))
   23.76 -SDL_MIR_SYM(float,mir_pointer_event_axis_value,(MirPointerEvent const *event, MirPointerAxis))
   23.77 -SDL_MIR_SYM(MirEventType,mir_event_get_type,(MirEvent const *event))
   23.78 -SDL_MIR_SYM(MirInputEventType,mir_input_event_get_type,(MirInputEvent const *event))
   23.79 -SDL_MIR_SYM(MirInputEvent const*,mir_event_get_input_event,(MirEvent const *event))
   23.80 -SDL_MIR_SYM(MirResizeEvent const*,mir_event_get_resize_event,(MirEvent const *event))
   23.81 -SDL_MIR_SYM(MirKeyboardEvent const*,mir_input_event_get_keyboard_event,(MirInputEvent const *event))
   23.82 -SDL_MIR_SYM(MirPointerEvent const*,mir_input_event_get_pointer_event,(MirInputEvent const *event))
   23.83 -SDL_MIR_SYM(MirTouchEvent const*,mir_input_event_get_touch_event,(MirInputEvent const *event))
   23.84 -SDL_MIR_SYM(MirWindowEvent const*,mir_event_get_window_event,(MirEvent const *event))
   23.85 -SDL_MIR_SYM(unsigned int,mir_touch_event_point_count,(MirTouchEvent const *event))
   23.86 -SDL_MIR_SYM(void,mir_connection_get_available_surface_formats,(MirConnection* connection, MirPixelFormat* formats, unsigned const int format_size, unsigned int *num_valid_formats))
   23.87 -SDL_MIR_SYM(MirEGLNativeDisplayType,mir_connection_get_egl_native_display,(MirConnection *connection))
   23.88 -SDL_MIR_SYM(bool,mir_connection_is_valid,(MirConnection *connection))
   23.89 -SDL_MIR_SYM(void,mir_connection_release,(MirConnection *connection))
   23.90 -SDL_MIR_SYM(MirPixelFormat,mir_connection_get_egl_pixel_format,(MirConnection* connection, void* egldisplay, void* eglconfig))
   23.91 -SDL_MIR_SYM(MirConnection *,mir_connect_sync,(char const *server, char const *app_name))
   23.92 -SDL_MIR_SYM(char const *,mir_window_get_error_message,(MirWindow *window))
   23.93 -SDL_MIR_SYM(bool,mir_window_is_valid,(MirWindow *window))
   23.94 -SDL_MIR_SYM(void,mir_window_release_sync,(MirWindow* window))
   23.95 -SDL_MIR_SYM(void,mir_buffer_stream_release_sync,(MirBufferStream *stream))
   23.96 -SDL_MIR_SYM(void,mir_window_configure_cursor,(MirWindow* window, MirCursorConfiguration const* conf))
   23.97 -SDL_MIR_SYM(void,mir_cursor_configuration_destroy,(MirCursorConfiguration* conf))
   23.98 -SDL_MIR_SYM(int,mir_resize_event_get_width,(MirResizeEvent const* resize_event))
   23.99 -SDL_MIR_SYM(int,mir_resize_event_get_height,(MirResizeEvent const* resize_event))
  23.100 -SDL_MIR_SYM(char const*,mir_connection_get_error_message,(MirConnection* connection))
  23.101 -SDL_MIR_SYM(MirWindowAttrib,mir_window_event_get_attribute,(MirWindowEvent const* event))
  23.102 -SDL_MIR_SYM(int,mir_window_event_get_attribute_value,(MirWindowEvent const* window_event))
  23.103 -SDL_MIR_SYM(MirDisplayConfig*,mir_connection_create_display_configuration,(MirConnection* connection))
  23.104 -SDL_MIR_SYM(void,mir_display_config_release,(MirDisplayConfig* config))
  23.105 -SDL_MIR_SYM(int,mir_display_config_get_num_outputs,(MirDisplayConfig const* config))
  23.106 -SDL_MIR_SYM(MirOutput*,mir_display_config_get_mutable_output,(MirDisplayConfig* config, size_t index))
  23.107 -SDL_MIR_SYM(int,mir_output_get_num_modes,(MirOutput const* output))
  23.108 -SDL_MIR_SYM(MirOutputMode const*,mir_output_get_current_mode,(MirOutput const* output))
  23.109 -SDL_MIR_SYM(MirPixelFormat,mir_output_get_current_pixel_format,(MirOutput const* output))
  23.110 -SDL_MIR_SYM(int,mir_output_get_position_x,(MirOutput const* output))
  23.111 -SDL_MIR_SYM(int,mir_output_get_position_y,(MirOutput const* output))
  23.112 -SDL_MIR_SYM(bool,mir_output_is_enabled,(MirOutput const* output))
  23.113 -SDL_MIR_SYM(MirOutputConnectionState,mir_output_get_connection_state,(MirOutput const* output))
  23.114 -SDL_MIR_SYM(size_t,mir_output_get_preferred_mode_index,(MirOutput const* output))
  23.115 -SDL_MIR_SYM(MirOutputType,mir_output_get_type,(MirOutput const* output))
  23.116 -SDL_MIR_SYM(char const*,mir_output_type_name,(MirOutputType type))
  23.117 -SDL_MIR_SYM(void,mir_output_set_current_mode,(MirOutput* output, MirOutputMode const* mode))
  23.118 -SDL_MIR_SYM(MirOutputMode const*,mir_output_get_mode,(MirOutput const* output, size_t index))
  23.119 -SDL_MIR_SYM(int,mir_output_mode_get_width,(MirOutputMode const* mode))
  23.120 -SDL_MIR_SYM(int,mir_output_mode_get_height,(MirOutputMode const* mode))
  23.121 -SDL_MIR_SYM(double,mir_output_mode_get_refresh_rate,(MirOutputMode const* mode))
  23.122 -SDL_MIR_SYM(bool,mir_output_is_gamma_supported,(MirOutput const* output))
  23.123 -SDL_MIR_SYM(uint32_t,mir_output_get_gamma_size,(MirOutput const* output))
  23.124 -SDL_MIR_SYM(void,mir_output_get_gamma,(MirOutput const* output, uint16_t* red, uint16_t* green, uint16_t* blue, uint32_t size))
  23.125 -SDL_MIR_SYM(void,mir_output_set_gamma,(MirOutput* output, uint16_t const* red, uint16_t const* green, uint16_t const* blue, uint32_t size))
  23.126 -
  23.127 -SDL_MIR_SYM_CONST(char const*,mir_omnidirectional_resize_cursor_name)
  23.128 -SDL_MIR_SYM_CONST(char const*,mir_busy_cursor_name)
  23.129 -SDL_MIR_SYM_CONST(char const*,mir_arrow_cursor_name)
  23.130 -SDL_MIR_SYM_CONST(char const*,mir_caret_cursor_name)
  23.131 -SDL_MIR_SYM_CONST(char const*,mir_vertical_resize_cursor_name)
  23.132 -SDL_MIR_SYM_CONST(char const*,mir_horizontal_resize_cursor_name)
  23.133 -SDL_MIR_SYM_CONST(char const*,mir_open_hand_cursor_name)
  23.134 -SDL_MIR_SYM_CONST(char const*,mir_closed_hand_cursor_name)
  23.135 -SDL_MIR_SYM_CONST(char const*,mir_disabled_cursor_name)
  23.136 -
  23.137 -SDL_MIR_MODULE(XKBCOMMON)
  23.138 -SDL_MIR_SYM(int,xkb_keysym_to_utf8,(xkb_keysym_t keysym, char *buffer, size_t size))
  23.139 -
  23.140 -#undef SDL_MIR_MODULE
  23.141 -#undef SDL_MIR_SYM
  23.142 -#undef SDL_MIR_SYM_CONST
  23.143 -
  23.144 -/* *INDENT-ON* */
  23.145 -
  23.146 -/* vi: set ts=4 sw=4 expandtab: */
    24.1 --- a/src/video/mir/SDL_mirvideo.c	Fri Nov 02 18:07:11 2018 -0700
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,423 +0,0 @@
    24.4 -/*
    24.5 -  Simple DirectMedia Layer
    24.6 -  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
    24.7 -
    24.8 -  This software is provided 'as-is', without any express or implied
    24.9 -  warranty.  In no event will the authors be held liable for any damages
   24.10 -  arising from the use of this software.
   24.11 -
   24.12 -  Permission is granted to anyone to use this software for any purpose,
   24.13 -  including commercial applications, and to alter it and redistribute it
   24.14 -  freely, subject to the following restrictions:
   24.15 -
   24.16 -  1. The origin of this software must not be misrepresented; you must not
   24.17 -     claim that you wrote the original software. If you use this software
   24.18 -     in a product, an acknowledgment in the product documentation would be
   24.19 -     appreciated but is not required.
   24.20 -  2. Altered source versions must be plainly marked as such, and must not be
   24.21 -     misrepresented as being the original software.
   24.22 -  3. This notice may not be removed or altered from any source distribution.
   24.23 -*/
   24.24 -
   24.25 -/*
   24.26 -  Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
   24.27 -*/
   24.28 -
   24.29 -#include "../../SDL_internal.h"
   24.30 -
   24.31 -#if SDL_VIDEO_DRIVER_MIR
   24.32 -
   24.33 -#include "SDL_assert.h"
   24.34 -#include "SDL_log.h"
   24.35 -
   24.36 -#include "SDL_mirwindow.h"
   24.37 -#include "SDL_video.h"
   24.38 -
   24.39 -#include "SDL_mirframebuffer.h"
   24.40 -#include "SDL_mirmouse.h"
   24.41 -#include "SDL_miropengl.h"
   24.42 -#include "SDL_mirvideo.h"
   24.43 -#include "SDL_mirvulkan.h"
   24.44 -
   24.45 -#include "SDL_mirdyn.h"
   24.46 -
   24.47 -#define MIR_DRIVER_NAME "mir"
   24.48 -
   24.49 -static const Uint32 mir_pixel_format_to_sdl_format[] = {
   24.50 -    SDL_PIXELFORMAT_UNKNOWN,  /* mir_pixel_format_invalid   */
   24.51 -    SDL_PIXELFORMAT_ABGR8888, /* mir_pixel_format_abgr_8888 */
   24.52 -    SDL_PIXELFORMAT_BGR888,   /* mir_pixel_format_xbgr_8888 */
   24.53 -    SDL_PIXELFORMAT_ARGB8888, /* mir_pixel_format_argb_8888 */
   24.54 -    SDL_PIXELFORMAT_RGB888,   /* mir_pixel_format_xrgb_8888 */
   24.55 -    SDL_PIXELFORMAT_BGR24,    /* mir_pixel_format_bgr_888   */
   24.56 -    SDL_PIXELFORMAT_RGB24,    /* mir_pixel_format_rgb_888   */
   24.57 -    SDL_PIXELFORMAT_RGB565,   /* mir_pixel_format_rgb_565   */
   24.58 -    SDL_PIXELFORMAT_RGBA5551, /* mir_pixel_format_rgba_5551 */
   24.59 -    SDL_PIXELFORMAT_RGBA4444  /* mir_pixel_format_rgba_4444 */
   24.60 -};
   24.61 -
   24.62 -Uint32
   24.63 -MIR_GetSDLPixelFormat(MirPixelFormat format)
   24.64 -{
   24.65 -    return mir_pixel_format_to_sdl_format[format];
   24.66 -}
   24.67 -
   24.68 -static int
   24.69 -MIR_VideoInit(_THIS);
   24.70 -
   24.71 -static void
   24.72 -MIR_VideoQuit(_THIS);
   24.73 -
   24.74 -static int
   24.75 -MIR_GetDisplayBounds(_THIS, SDL_VideoDisplay* display, SDL_Rect* rect);
   24.76 -
   24.77 -static void
   24.78 -MIR_GetDisplayModes(_THIS, SDL_VideoDisplay* sdl_display);
   24.79 -
   24.80 -static int
   24.81 -MIR_SetDisplayMode(_THIS, SDL_VideoDisplay* sdl_display, SDL_DisplayMode* mode);
   24.82 -
   24.83 -static SDL_WindowShaper*
   24.84 -MIR_CreateShaper(SDL_Window* window)
   24.85 -{
   24.86 -    /* FIXME Im not sure if mir support this atm, will have to come back to this */
   24.87 -    return NULL;
   24.88 -}
   24.89 -
   24.90 -static int
   24.91 -MIR_SetWindowShape(SDL_WindowShaper* shaper, SDL_Surface* shape, SDL_WindowShapeMode* shape_mode)
   24.92 -{
   24.93 -    return SDL_Unsupported();
   24.94 -}
   24.95 -
   24.96 -static int
   24.97 -MIR_ResizeWindowShape(SDL_Window* window)
   24.98 -{
   24.99 -    return SDL_Unsupported();
  24.100 -}
  24.101 -
  24.102 -static int
  24.103 -MIR_Available()
  24.104 -{
  24.105 -    int available = 0;
  24.106 -
  24.107 -    if (SDL_MIR_LoadSymbols()) {
  24.108 -
  24.109 -        /* Lets ensure we can connect to the mir server */
  24.110 -        MirConnection* connection = MIR_mir_connect_sync(NULL, SDL_FUNCTION);
  24.111 -
  24.112 -        if (!MIR_mir_connection_is_valid(connection)) {
  24.113 -            SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Unable to connect to the mir server %s",
  24.114 -                MIR_mir_connection_get_error_message(connection));
  24.115 -
  24.116 -            return available;
  24.117 -        }
  24.118 -
  24.119 -        MIR_mir_connection_release(connection);
  24.120 -
  24.121 -        available = 1;
  24.122 -        SDL_MIR_UnloadSymbols();
  24.123 -    }
  24.124 -
  24.125 -    return available;
  24.126 -}
  24.127 -
  24.128 -static void
  24.129 -MIR_DeleteDevice(SDL_VideoDevice* device)
  24.130 -{
  24.131 -    SDL_free(device);
  24.132 -    SDL_MIR_UnloadSymbols();
  24.133 -}
  24.134 -
  24.135 -static void
  24.136 -MIR_PumpEvents(_THIS)
  24.137 -{
  24.138 -}
  24.139 -
  24.140 -static SDL_VideoDevice*
  24.141 -MIR_CreateDevice(int device_index)
  24.142 -{
  24.143 -    MIR_Data* mir_data;
  24.144 -    SDL_VideoDevice* device = NULL;
  24.145 -
  24.146 -    if (!SDL_MIR_LoadSymbols()) {
  24.147 -        return NULL;
  24.148 -    }
  24.149 -
  24.150 -    device = SDL_calloc(1, sizeof(SDL_VideoDevice));
  24.151 -    if (!device) {
  24.152 -        SDL_MIR_UnloadSymbols();
  24.153 -        SDL_OutOfMemory();
  24.154 -        return NULL;
  24.155 -    }
  24.156 -
  24.157 -    mir_data = SDL_calloc(1, sizeof(MIR_Data));
  24.158 -    if (!mir_data) {
  24.159 -        SDL_free(device);
  24.160 -        SDL_MIR_UnloadSymbols();
  24.161 -        SDL_OutOfMemory();
  24.162 -        return NULL;
  24.163 -    }
  24.164 -
  24.165 -    device->driverdata = mir_data;
  24.166 -
  24.167 -    /* mirvideo */
  24.168 -    device->VideoInit        = MIR_VideoInit;
  24.169 -    device->VideoQuit        = MIR_VideoQuit;
  24.170 -    device->GetDisplayBounds = MIR_GetDisplayBounds;
  24.171 -    device->GetDisplayModes  = MIR_GetDisplayModes;
  24.172 -    device->SetDisplayMode   = MIR_SetDisplayMode;
  24.173 -    device->free             = MIR_DeleteDevice;
  24.174 -
  24.175 -    /* miropengles */
  24.176 -    device->GL_SwapWindow      = MIR_GL_SwapWindow;
  24.177 -    device->GL_MakeCurrent     = MIR_GL_MakeCurrent;
  24.178 -    device->GL_CreateContext   = MIR_GL_CreateContext;
  24.179 -    device->GL_DeleteContext   = MIR_GL_DeleteContext;
  24.180 -    device->GL_LoadLibrary     = MIR_GL_LoadLibrary;
  24.181 -    device->GL_UnloadLibrary   = MIR_GL_UnloadLibrary;
  24.182 -    device->GL_GetSwapInterval = MIR_GL_GetSwapInterval;
  24.183 -    device->GL_SetSwapInterval = MIR_GL_SetSwapInterval;
  24.184 -    device->GL_GetProcAddress  = MIR_GL_GetProcAddress;
  24.185 -
  24.186 -    /* mirwindow */
  24.187 -    device->CreateSDLWindow         = MIR_CreateWindow;
  24.188 -    device->DestroyWindow        = MIR_DestroyWindow;
  24.189 -    device->GetWindowWMInfo      = MIR_GetWindowWMInfo;
  24.190 -    device->SetWindowFullscreen  = MIR_SetWindowFullscreen;
  24.191 -    device->MaximizeWindow       = MIR_MaximizeWindow;
  24.192 -    device->MinimizeWindow       = MIR_MinimizeWindow;
  24.193 -    device->RestoreWindow        = MIR_RestoreWindow;
  24.194 -    device->ShowWindow           = MIR_RestoreWindow;
  24.195 -    device->HideWindow           = MIR_HideWindow;
  24.196 -    device->SetWindowSize        = MIR_SetWindowSize;
  24.197 -    device->SetWindowMinimumSize = MIR_SetWindowMinimumSize;
  24.198 -    device->SetWindowMaximumSize = MIR_SetWindowMaximumSize;
  24.199 -    device->SetWindowTitle       = MIR_SetWindowTitle;
  24.200 -    device->SetWindowGrab        = MIR_SetWindowGrab;
  24.201 -    device->SetWindowGammaRamp   = MIR_SetWindowGammaRamp;
  24.202 -    device->GetWindowGammaRamp   = MIR_GetWindowGammaRamp;
  24.203 -
  24.204 -    device->CreateSDLWindowFrom     = NULL;
  24.205 -    device->SetWindowIcon        = NULL;
  24.206 -    device->RaiseWindow          = NULL;
  24.207 -    device->SetWindowBordered    = NULL;
  24.208 -    device->SetWindowResizable   = NULL;
  24.209 -    device->OnWindowEnter        = NULL;
  24.210 -    device->SetWindowPosition    = NULL;
  24.211 -
  24.212 -    /* mirframebuffer */
  24.213 -    device->CreateWindowFramebuffer  = MIR_CreateWindowFramebuffer;
  24.214 -    device->UpdateWindowFramebuffer  = MIR_UpdateWindowFramebuffer;
  24.215 -    device->DestroyWindowFramebuffer = MIR_DestroyWindowFramebuffer;
  24.216 -
  24.217 -    device->shape_driver.CreateShaper      = MIR_CreateShaper;
  24.218 -    device->shape_driver.SetWindowShape    = MIR_SetWindowShape;
  24.219 -    device->shape_driver.ResizeWindowShape = MIR_ResizeWindowShape;
  24.220 -
  24.221 -    device->PumpEvents = MIR_PumpEvents;
  24.222 -
  24.223 -    device->SuspendScreenSaver = NULL;
  24.224 -
  24.225 -    device->StartTextInput   = NULL;
  24.226 -    device->StopTextInput    = NULL;
  24.227 -    device->SetTextInputRect = NULL;
  24.228 -
  24.229 -    device->HasScreenKeyboardSupport = NULL;
  24.230 -    device->ShowScreenKeyboard       = NULL;
  24.231 -    device->HideScreenKeyboard       = NULL;
  24.232 -    device->IsScreenKeyboardShown    = NULL;
  24.233 -
  24.234 -    device->SetClipboardText = NULL;
  24.235 -    device->GetClipboardText = NULL;
  24.236 -    device->HasClipboardText = NULL;
  24.237 -
  24.238 -    device->ShowMessageBox = NULL;
  24.239 -
  24.240 -#if SDL_VIDEO_VULKAN
  24.241 -    device->Vulkan_LoadLibrary = MIR_Vulkan_LoadLibrary;
  24.242 -    device->Vulkan_UnloadLibrary = MIR_Vulkan_UnloadLibrary;
  24.243 -    device->Vulkan_GetInstanceExtensions = MIR_Vulkan_GetInstanceExtensions;
  24.244 -    device->Vulkan_CreateSurface = MIR_Vulkan_CreateSurface;
  24.245 -#endif
  24.246 -
  24.247 -    return device;
  24.248 -}
  24.249 -
  24.250 -VideoBootStrap MIR_bootstrap = {
  24.251 -    MIR_DRIVER_NAME, "SDL Mir video driver",
  24.252 -    MIR_Available, MIR_CreateDevice
  24.253 -};
  24.254 -
  24.255 -static SDL_DisplayMode
  24.256 -MIR_ConvertModeToSDLMode(MirOutputMode const* mode, MirPixelFormat format)
  24.257 -{
  24.258 -    SDL_DisplayMode sdl_mode  = {
  24.259 -        .format = MIR_GetSDLPixelFormat(format),
  24.260 -        .w      = MIR_mir_output_mode_get_width(mode),
  24.261 -        .h      = MIR_mir_output_mode_get_height(mode),
  24.262 -        .refresh_rate = MIR_mir_output_mode_get_refresh_rate(mode),
  24.263 -        .driverdata   = NULL
  24.264 -    };
  24.265 -
  24.266 -    return sdl_mode;
  24.267 -}
  24.268 -
  24.269 -static void
  24.270 -MIR_AddModeToDisplay(SDL_VideoDisplay* display, MirOutputMode const* mode, MirPixelFormat format)
  24.271 -{
  24.272 -    SDL_DisplayMode sdl_mode = MIR_ConvertModeToSDLMode(mode, format);
  24.273 -    SDL_AddDisplayMode(display, &sdl_mode);
  24.274 -}
  24.275 -
  24.276 -static void
  24.277 -MIR_InitDisplayFromOutput(_THIS, MirOutput* output)
  24.278 -{
  24.279 -    SDL_VideoDisplay display;
  24.280 -    int m;
  24.281 -
  24.282 -    MirPixelFormat format = MIR_mir_output_get_current_pixel_format(output);
  24.283 -    int num_modes         = MIR_mir_output_get_num_modes(output);
  24.284 -    SDL_DisplayMode current_mode = MIR_ConvertModeToSDLMode(MIR_mir_output_get_current_mode(output), format);
  24.285 -
  24.286 -    SDL_zero(display);
  24.287 -
  24.288 -    // Unfortunate cast, but SDL_AddVideoDisplay will strdup this pointer so its read-only in this case.
  24.289 -    display.name = (char*)MIR_mir_output_type_name(MIR_mir_output_get_type(output));
  24.290 -
  24.291 -    for (m = 0; m < num_modes; m++) {
  24.292 -        MirOutputMode const* mode = MIR_mir_output_get_mode(output, m);
  24.293 -        MIR_AddModeToDisplay(&display, mode, format);
  24.294 -    }
  24.295 -
  24.296 -    display.desktop_mode = current_mode;
  24.297 -    display.current_mode = current_mode;
  24.298 -
  24.299 -    display.driverdata = output;
  24.300 -    SDL_AddVideoDisplay(&display);
  24.301 -}
  24.302 -
  24.303 -static void
  24.304 -MIR_InitDisplays(_THIS)
  24.305 -{
  24.306 -    MIR_Data* mir_data = _this->driverdata;
  24.307 -    int num_outputs    = MIR_mir_display_config_get_num_outputs(mir_data->display_config);
  24.308 -    int d;
  24.309 -
  24.310 -    for (d = 0; d < num_outputs; d++) {
  24.311 -        MirOutput* output = MIR_mir_display_config_get_mutable_output(mir_data->display_config, d);
  24.312 -        SDL_bool enabled  = MIR_mir_output_is_enabled(output);
  24.313 -        MirOutputConnectionState state = MIR_mir_output_get_connection_state(output);
  24.314 -
  24.315 -        if (enabled && state == mir_output_connection_state_connected) {
  24.316 -            MIR_InitDisplayFromOutput(_this, output);
  24.317 -        }
  24.318 -    }
  24.319 -}
  24.320 -
  24.321 -static int
  24.322 -MIR_VideoInit(_THIS)
  24.323 -{
  24.324 -    MIR_Data* mir_data = _this->driverdata;
  24.325 -
  24.326 -    mir_data->connection     = MIR_mir_connect_sync(NULL, SDL_FUNCTION);
  24.327 -    mir_data->current_window = NULL;
  24.328 -    mir_data->software       = SDL_FALSE;
  24.329 -    mir_data->pixel_format   = mir_pixel_format_invalid;
  24.330 -
  24.331 -    if (!MIR_mir_connection_is_valid(mir_data->connection)) {
  24.332 -        return SDL_SetError("Failed to connect to the mir server: %s",
  24.333 -            MIR_mir_connection_get_error_message(mir_data->connection));
  24.334 -    }
  24.335 -
  24.336 -    mir_data->display_config = MIR_mir_connection_create_display_configuration(mir_data->connection);
  24.337 -
  24.338 -    MIR_InitDisplays(_this);
  24.339 -    MIR_InitMouse();
  24.340 -
  24.341 -    return 0;
  24.342 -}
  24.343 -
  24.344 -static void
  24.345 -MIR_CleanUpDisplayConfig(_THIS)
  24.346 -{
  24.347 -    MIR_Data* mir_data = _this->driverdata;
  24.348 -    int i;
  24.349 -
  24.350 -    // SDL_VideoQuit frees the display driverdata, we own it not them
  24.351 -    for (i = 0; i < _this->num_displays; ++i) {
  24.352 -        _this->displays[i].driverdata = NULL;
  24.353 -    }
  24.354 -
  24.355 -    MIR_mir_display_config_release(mir_data->display_config);
  24.356 -}
  24.357 -
  24.358 -static void
  24.359 -MIR_VideoQuit(_THIS)
  24.360 -{
  24.361 -    MIR_Data* mir_data = _this->driverdata;
  24.362 -
  24.363 -    MIR_CleanUpDisplayConfig(_this);
  24.364 -
  24.365 -    MIR_FiniMouse();
  24.366 -
  24.367 -    MIR_GL_DeleteContext(_this, NULL);
  24.368 -    MIR_GL_UnloadLibrary(_this);
  24.369 -
  24.370 -    MIR_mir_connection_release(mir_data->connection);
  24.371 -
  24.372 -    SDL_free(mir_data);
  24.373 -    _this->driverdata = NULL;
  24.374 -}
  24.375 -
  24.376 -static int
  24.377 -MIR_GetDisplayBounds(_THIS, SDL_VideoDisplay* display, SDL_Rect* rect)
  24.378 -{
  24.379 -    MirOutput const* output = display->driverdata;
  24.380 -
  24.381 -    rect->x = MIR_mir_output_get_position_x(output);
  24.382 -    rect->y = MIR_mir_output_get_position_y(output);
  24.383 -    rect->w = display->current_mode.w;
  24.384 -    rect->h = display->current_mode.h;
  24.385 -
  24.386 -    return 0;
  24.387 -}
  24.388 -
  24.389 -static void
  24.390 -MIR_GetDisplayModes(_THIS, SDL_VideoDisplay* display)
  24.391 -{
  24.392 -}
  24.393 -
  24.394 -static int
  24.395 -MIR_SetDisplayMode(_THIS, SDL_VideoDisplay* display, SDL_DisplayMode* mode)
  24.396 -{
  24.397 -    int m;
  24.398 -    MirOutput* output = display->driverdata;
  24.399 -    int num_modes     = MIR_mir_output_get_num_modes(output);
  24.400 -    Uint32 sdl_format = MIR_GetSDLPixelFormat(
  24.401 -                            MIR_mir_output_get_current_pixel_format(output));
  24.402 -
  24.403 -    for (m = 0; m < num_modes; m++) {
  24.404 -        MirOutputMode const* mir_mode = MIR_mir_output_get_mode(output, m);
  24.405 -        int width  = MIR_mir_output_mode_get_width(mir_mode);
  24.406 -        int height = MIR_mir_output_mode_get_height(mir_mode);
  24.407 -        double refresh_rate = MIR_mir_output_mode_get_refresh_rate(mir_mode);
  24.408 -
  24.409 -        if (mode->format == sdl_format &&
  24.410 -            mode->w      == width &&
  24.411 -            mode->h      == height &&
  24.412 -            mode->refresh_rate == refresh_rate) {
  24.413 -
  24.414 -            // FIXME Currently wont actually *set* anything. Need to wait for applying display changes
  24.415 -            MIR_mir_output_set_current_mode(output, mir_mode);
  24.416 -            return 0;
  24.417 -        }
  24.418 -    }
  24.419 -
  24.420 -    return -1;
  24.421 -}
  24.422 -
  24.423 -#endif /* SDL_VIDEO_DRIVER_MIR */
  24.424 -
  24.425 -/* vi: set ts=4 sw=4 expandtab: */
  24.426 -
    25.1 --- a/src/video/mir/SDL_mirvideo.h	Fri Nov 02 18:07:11 2018 -0700
    25.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3 @@ -1,49 +0,0 @@
    25.4 -/*
    25.5 -  Simple DirectMedia Layer
    25.6 -  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
    25.7 -
    25.8 -  This software is provided 'as-is', without any express or implied
    25.9 -  warranty.  In no event will the authors be held liable for any damages
   25.10 -  arising from the use of this software.
   25.11 -
   25.12 -  Permission is granted to anyone to use this software for any purpose,
   25.13 -  including commercial applications, and to alter it and redistribute it
   25.14 -  freely, subject to the following restrictions:
   25.15 -
   25.16 -  1. The origin of this software must not be misrepresented; you must not
   25.17 -     claim that you wrote the original software. If you use this software
   25.18 -     in a product, an acknowledgment in the product documentation would be
   25.19 -     appreciated but is not required.
   25.20 -  2. Altered source versions must be plainly marked as such, and must not be
   25.21 -     misrepresented as being the original software.
   25.22 -  3. This notice may not be removed or altered from any source distribution.
   25.23 -*/
   25.24 -
   25.25 -/*
   25.26 -  Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
   25.27 -*/
   25.28 -
   25.29 -#ifndef SDL_mirvideo_h__
   25.30 -#define SDL_mirvideo_h__
   25.31 -
   25.32 -#include <EGL/egl.h>
   25.33 -#include <mir_toolkit/mir_client_library.h>
   25.34 -#include "SDL_stdinc.h"
   25.35 -
   25.36 -typedef struct MIR_Window MIR_Window;
   25.37 -
   25.38 -typedef struct
   25.39 -{
   25.40 -    MirConnection*    connection;
   25.41 -    MirDisplayConfig* display_config;
   25.42 -    MIR_Window*       current_window;
   25.43 -    SDL_bool          software;
   25.44 -    MirPixelFormat    pixel_format;
   25.45 -} MIR_Data;
   25.46 -
   25.47 -extern Uint32
   25.48 -MIR_GetSDLPixelFormat(MirPixelFormat format);
   25.49 -
   25.50 -#endif /* SDL_mirvideo_h__ */
   25.51 -
   25.52 -/* vi: set ts=4 sw=4 expandtab: */
    26.1 --- a/src/video/mir/SDL_mirvulkan.c	Fri Nov 02 18:07:11 2018 -0700
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,176 +0,0 @@
    26.4 -/*
    26.5 -  Simple DirectMedia Layer
    26.6 -  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
    26.7 -
    26.8 -  This software is provided 'as-is', without any express or implied
    26.9 -  warranty.  In no event will the authors be held liable for any damages
   26.10 -  arising from the use of this software.
   26.11 -
   26.12 -  Permission is granted to anyone to use this software for any purpose,
   26.13 -  including commercial applications, and to alter it and redistribute it
   26.14 -  freely, subject to the following restrictions:
   26.15 -
   26.16 -  1. The origin of this software must not be misrepresented; you must not
   26.17 -     claim that you wrote the original software. If you use this software
   26.18 -     in a product, an acknowledgment in the product documentation would be
   26.19 -     appreciated but is not required.
   26.20 -  2. Altered source versions must be plainly marked as such, and must not be
   26.21 -     misrepresented as being the original software.
   26.22 -  3. This notice may not be removed or altered from any source distribution.
   26.23 -*/
   26.24 -
   26.25 -/*
   26.26 - * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's
   26.27 - * SDL_x11vulkan.c.
   26.28 - */
   26.29 -
   26.30 -#include "../../SDL_internal.h"
   26.31 -
   26.32 -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_MIR
   26.33 -
   26.34 -#include "SDL_mirvideo.h"
   26.35 -#include "SDL_mirwindow.h"
   26.36 -#include "SDL_assert.h"
   26.37 -
   26.38 -#include "SDL_loadso.h"
   26.39 -#include "SDL_mirvulkan.h"
   26.40 -#include "SDL_syswm.h"
   26.41 -
   26.42 -int MIR_Vulkan_LoadLibrary(_THIS, const char *path)
   26.43 -{
   26.44 -    VkExtensionProperties *extensions = NULL;
   26.45 -    Uint32 extensionCount = 0;
   26.46 -    SDL_bool hasSurfaceExtension = SDL_FALSE;
   26.47 -    SDL_bool hasMIRSurfaceExtension = SDL_FALSE;
   26.48 -    PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;
   26.49 -    if(_this->vulkan_config.loader_handle)
   26.50 -        return SDL_SetError("Vulkan already loaded");
   26.51 -
   26.52 -    /* Load the Vulkan loader library */
   26.53 -    if(!path)
   26.54 -        path = SDL_getenv("SDL_VULKAN_LIBRARY");
   26.55 -    if(!path)
   26.56 -        path = "libvulkan.so.1";
   26.57 -    _this->vulkan_config.loader_handle = SDL_LoadObject(path);
   26.58 -    if(!_this->vulkan_config.loader_handle)
   26.59 -        return -1;
   26.60 -    SDL_strlcpy(_this->vulkan_config.loader_path, path,
   26.61 -                SDL_arraysize(_this->vulkan_config.loader_path));
   26.62 -    vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
   26.63 -        _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
   26.64 -    if(!vkGetInstanceProcAddr)
   26.65 -        goto fail;
   26.66 -    _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
   26.67 -    _this->vulkan_config.vkEnumerateInstanceExtensionProperties =
   26.68 -        (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
   26.69 -            VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
   26.70 -    if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties)
   26.71 -        goto fail;
   26.72 -    extensions = SDL_Vulkan_CreateInstanceExtensionsList(
   26.73 -        (PFN_vkEnumerateInstanceExtensionProperties)
   26.74 -            _this->vulkan_config.vkEnumerateInstanceExtensionProperties,
   26.75 -        &extensionCount);
   26.76 -    if(!extensions)
   26.77 -        goto fail;
   26.78 -    for(Uint32 i = 0; i < extensionCount; i++)
   26.79 -    {
   26.80 -        if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
   26.81 -            hasSurfaceExtension = SDL_TRUE;
   26.82 -        else if(SDL_strcmp(VK_KHR_MIR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
   26.83 -            hasMIRSurfaceExtension = SDL_TRUE;
   26.84 -    }
   26.85 -    SDL_free(extensions);
   26.86 -    if(!hasSurfaceExtension)
   26.87 -    {
   26.88 -        SDL_SetError("Installed Vulkan doesn't implement the "
   26.89 -                     VK_KHR_SURFACE_EXTENSION_NAME " extension");
   26.90 -        goto fail;
   26.91 -    }
   26.92 -    else if(!hasMIRSurfaceExtension)
   26.93 -    {
   26.94 -        SDL_SetError("Installed Vulkan doesn't implement the "
   26.95 -                     VK_KHR_MIR_SURFACE_EXTENSION_NAME "extension");
   26.96 -        goto fail;
   26.97 -    }
   26.98 -    return 0;
   26.99 -
  26.100 -fail:
  26.101 -    SDL_UnloadObject(_this->vulkan_config.loader_handle);
  26.102 -    _this->vulkan_config.loader_handle = NULL;
  26.103 -    return -1;
  26.104 -}
  26.105 -
  26.106 -void MIR_Vulkan_UnloadLibrary(_THIS)
  26.107 -{
  26.108 -    if(_this->vulkan_config.loader_handle)
  26.109 -    {
  26.110 -        SDL_UnloadObject(_this->vulkan_config.loader_handle);
  26.111 -        _this->vulkan_config.loader_handle = NULL;
  26.112 -    }
  26.113 -}
  26.114 -
  26.115 -SDL_bool MIR_Vulkan_GetInstanceExtensions(_THIS,
  26.116 -                                          SDL_Window *window,
  26.117 -                                          unsigned *count,
  26.118 -                                          const char **names)
  26.119 -{
  26.120 -    static const char *const extensionsForMir[] = {
  26.121 -        VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_MIR_SURFACE_EXTENSION_NAME
  26.122 -    };
  26.123 -    if(!_this->vulkan_config.loader_handle)
  26.124 -    {
  26.125 -        SDL_SetError("Vulkan is not loaded");
  26.126 -        return SDL_FALSE;
  26.127 -    }
  26.128 -    return SDL_Vulkan_GetInstanceExtensions_Helper(
  26.129 -            count, names, SDL_arraysize(extensionsForMir),
  26.130 -            extensionsForMir);
  26.131 -}
  26.132 -
  26.133 -SDL_bool MIR_Vulkan_CreateSurface(_THIS,
  26.134 -                                  SDL_Window *window,
  26.135 -                                  VkInstance instance,
  26.136 -                                  VkSurfaceKHR *surface)
  26.137 -{
  26.138 -    MIR_Window *windowData = (MIR_Window *)window->driverdata;
  26.139 -    PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr =
  26.140 -        (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr;
  26.141 -    PFN_vkCreateMirSurfaceKHR vkCreateMirSurfaceKHR =
  26.142 -        (PFN_vkCreateMirSurfaceKHR)vkGetInstanceProcAddr(
  26.143 -                                            (VkInstance)instance,
  26.144 -                                            "vkCreateMirSurfaceKHR");
  26.145 -    VkMirSurfaceCreateInfoKHR createInfo;
  26.146 -    VkResult result;
  26.147 -
  26.148 -    if(!_this->vulkan_config.loader_handle)
  26.149 -    {
  26.150 -        SDL_SetError("Vulkan is not loaded");
  26.151 -        return SDL_FALSE;
  26.152 -    }
  26.153 -
  26.154 -    if(!vkCreateMirSurfaceKHR)
  26.155 -    {
  26.156 -        SDL_SetError(VK_KHR_MIR_SURFACE_EXTENSION_NAME
  26.157 -                     " extension is not enabled in the Vulkan instance.");
  26.158 -        return SDL_FALSE;
  26.159 -    }
  26.160 -    SDL_zero(createInfo);
  26.161 -    createInfo.sType = VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR;
  26.162 -    createInfo.pNext = NULL;
  26.163 -    createInfo.flags = 0;
  26.164 -    createInfo.connection = windowData->mir_data->connection;
  26.165 -    createInfo.mirSurface = windowData->window;
  26.166 -    result = vkCreateMirSurfaceKHR(instance, &createInfo,
  26.167 -                                       NULL, surface);
  26.168 -    if(result != VK_SUCCESS)
  26.169 -    {
  26.170 -        SDL_SetError("vkCreateMirSurfaceKHR failed: %s",
  26.171 -                     SDL_Vulkan_GetResultString(result));
  26.172 -        return SDL_FALSE;
  26.173 -    }
  26.174 -    return SDL_TRUE;
  26.175 -}
  26.176 -
  26.177 -#endif
  26.178 -
  26.179 -/* vim: set ts=4 sw=4 expandtab: */
    27.1 --- a/src/video/mir/SDL_mirvulkan.h	Fri Nov 02 18:07:11 2018 -0700
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,52 +0,0 @@
    27.4 -/*
    27.5 -  Simple DirectMedia Layer
    27.6 -  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
    27.7 -
    27.8 -  This software is provided 'as-is', without any express or implied
    27.9 -  warranty.  In no event will the authors be held liable for any damages
   27.10 -  arising from the use of this software.
   27.11 -
   27.12 -  Permission is granted to anyone to use this software for any purpose,
   27.13 -  including commercial applications, and to alter it and redistribute it
   27.14 -  freely, subject to the following restrictions:
   27.15 -
   27.16 -  1. The origin of this software must not be misrepresented; you must not
   27.17 -     claim that you wrote the original software. If you use this software
   27.18 -     in a product, an acknowledgment in the product documentation would be
   27.19 -     appreciated but is not required.
   27.20 -  2. Altered source versions must be plainly marked as such, and must not be
   27.21 -     misrepresented as being the original software.
   27.22 -  3. This notice may not be removed or altered from any source distribution.
   27.23 -*/
   27.24 -
   27.25 -/*
   27.26 - * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's
   27.27 - * SDL_x11vulkan.h.
   27.28 - */
   27.29 -
   27.30 -#include "../../SDL_internal.h"
   27.31 -
   27.32 -#ifndef SDL_mirvulkan_h_
   27.33 -#define SDL_mirvulkan_h_
   27.34 -
   27.35 -#include "../SDL_vulkan_internal.h"
   27.36 -#include "../SDL_sysvideo.h"
   27.37 -
   27.38 -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_MIR
   27.39 -
   27.40 -int MIR_Vulkan_LoadLibrary(_THIS, const char *path);
   27.41 -void MIR_Vulkan_UnloadLibrary(_THIS);
   27.42 -SDL_bool MIR_Vulkan_GetInstanceExtensions(_THIS,
   27.43 -                                          SDL_Window *window,
   27.44 -                                          unsigned *count,
   27.45 -                                          const char **names);
   27.46 -SDL_bool MIR_Vulkan_CreateSurface(_THIS,
   27.47 -                                  SDL_Window *window,
   27.48 -                                  VkInstance instance,
   27.49 -                                  VkSurfaceKHR *surface);
   27.50 -
   27.51 -#endif
   27.52 -
   27.53 -#endif /* SDL_mirvulkan_h_ */
   27.54 -
   27.55 -/* vi: set ts=4 sw=4 expandtab: */
    28.1 --- a/src/video/mir/SDL_mirwindow.c	Fri Nov 02 18:07:11 2018 -0700
    28.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.3 @@ -1,374 +0,0 @@
    28.4 -/*
    28.5 -  Simple DirectMedia Layer
    28.6 -  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
    28.7 -
    28.8 -  This software is provided 'as-is', without any express or implied
    28.9 -  warranty.  In no event will the authors be held liable for any damages
   28.10 -  arising from the use of this software.
   28.11 -
   28.12 -  Permission is granted to anyone to use this software for any purpose,
   28.13 -  including commercial applications, and to alter it and redistribute it
   28.14 -  freely, subject to the following restrictions:
   28.15 -
   28.16 -  1. The origin of this software must not be misrepresented; you must not
   28.17 -     claim that you wrote the original software. If you use this software
   28.18 -     in a product, an acknowledgment in the product documentation would be
   28.19 -     appreciated but is not required.
   28.20 -  2. Altered source versions must be plainly marked as such, and must not be
   28.21 -     misrepresented as being the original software.
   28.22 -  3. This notice may not be removed or altered from any source distribution.
   28.23 -*/
   28.24 -
   28.25 -/*
   28.26 -  Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
   28.27 -*/
   28.28 -
   28.29 -#include "../../SDL_internal.h"
   28.30 -
   28.31 -#if SDL_VIDEO_DRIVER_MIR
   28.32 -
   28.33 -#include "../SDL_egl_c.h"
   28.34 -#include "../SDL_sysvideo.h"
   28.35 -#include "../../events/SDL_keyboard_c.h"
   28.36 -
   28.37 -#include "SDL_mirevents.h"
   28.38 -#include "SDL_mirwindow.h"
   28.39 -
   28.40 -#include "SDL_mirdyn.h"
   28.41 -
   28.42 -static int
   28.43 -IsMirWindowValid(MIR_Window* mir_window)
   28.44 -{
   28.45 -    if (!MIR_mir_window_is_valid(mir_window->window)) {
   28.46 -        const char* error = MIR_mir_window_get_error_message(mir_window->window);
   28.47 -        return SDL_SetError("Failed to create a mir surface: %s", error);
   28.48 -    }
   28.49 -
   28.50 -    return 1;
   28.51 -}
   28.52 -
   28.53 -static MirPixelFormat
   28.54 -FindValidPixelFormat(MIR_Data* mir_data)
   28.55 -{
   28.56 -    unsigned int pf_size = 32;
   28.57 -    unsigned int valid_formats;
   28.58 -    unsigned int f;
   28.59 -
   28.60 -    MirPixelFormat formats[pf_size];
   28.61 -    MIR_mir_connection_get_available_surface_formats(mir_data->connection, formats,
   28.62 -                                                     pf_size, &valid_formats);
   28.63 -
   28.64 -    for (f = 0; f < valid_formats; f++) {
   28.65 -        MirPixelFormat cur_pf = formats[f];
   28.66 -
   28.67 -        if (cur_pf == mir_pixel_format_abgr_8888 ||
   28.68 -            cur_pf == mir_pixel_format_xbgr_8888 ||
   28.69 -            cur_pf == mir_pixel_format_argb_8888 ||
   28.70 -            cur_pf == mir_pixel_format_xrgb_8888) {
   28.71 -
   28.72 -            return cur_pf;
   28.73 -        }
   28.74 -    }
   28.75 -
   28.76 -    return mir_pixel_format_invalid;
   28.77 -}
   28.78 -
   28.79 -int
   28.80 -MIR_CreateWindow(_THIS, SDL_Window* window)
   28.81 -{
   28.82 -    MIR_Window* mir_window;
   28.83 -    MIR_Data* mir_data;
   28.84 -    MirPixelFormat pixel_format;
   28.85 -    MirBufferUsage buffer_usage;
   28.86 -
   28.87 -    MirWindowSpec* spec;
   28.88 -
   28.89 -    mir_window = SDL_calloc(1, sizeof(MIR_Window));
   28.90 -    if (!mir_window)
   28.91 -        return SDL_OutOfMemory();
   28.92 -
   28.93 -    mir_data = _this->driverdata;
   28.94 -    window->driverdata = mir_window;
   28.95 -
   28.96 -    if (window->x == SDL_WINDOWPOS_UNDEFINED)
   28.97 -        window->x = 0;
   28.98 -
   28.99 -    if (window->y == SDL_WINDOWPOS_UNDEFINED)
  28.100 -        window->y = 0;
  28.101 -
  28.102 -    mir_window->mir_data = mir_data;
  28.103 -    mir_window->sdl_window = window;
  28.104 -
  28.105 -    if (window->flags & SDL_WINDOW_OPENGL) {
  28.106 -        pixel_format = MIR_mir_connection_get_egl_pixel_format(mir_data->connection,
  28.107 -                                                               _this->egl_data->egl_display,
  28.108 -                                                               _this->egl_data->egl_config);
  28.109 -    }
  28.110 -    else {
  28.111 -        pixel_format = FindValidPixelFormat(mir_data);
  28.112 -    }
  28.113 -
  28.114 -    mir_data->pixel_format = pixel_format;
  28.115 -    if (pixel_format == mir_pixel_format_invalid) {
  28.116 -        return SDL_SetError("Failed to find a valid pixel format.");
  28.117 -    }
  28.118 -
  28.119 -    buffer_usage = mir_buffer_usage_hardware;
  28.120 -    if (mir_data->software)
  28.121 -        buffer_usage = mir_buffer_usage_software;
  28.122 -
  28.123 -    spec = MIR_mir_create_normal_window_spec(mir_data->connection,
  28.124 -                                             window->w,
  28.125 -                                             window->h);
  28.126 -
  28.127 -    MIR_mir_window_spec_set_buffer_usage(spec, buffer_usage);
  28.128 -    MIR_mir_window_spec_set_name(spec, "Mir surface");
  28.129 -    MIR_mir_window_spec_set_pixel_format(spec, pixel_format);
  28.130 -
  28.131 -    if (window->flags & SDL_WINDOW_INPUT_FOCUS)
  28.132 -        SDL_SetKeyboardFocus(window);
  28.133 -
  28.134 -    mir_window->window = MIR_mir_create_window_sync(spec);
  28.135 -    MIR_mir_window_set_event_handler(mir_window->window, MIR_HandleEvent, window);
  28.136 -
  28.137 -    MIR_mir_window_spec_release(spec);
  28.138 -
  28.139 -    if (!MIR_mir_window_is_valid(mir_window->window)) {
  28.140 -        return SDL_SetError("Failed to create a mir surface: %s",
  28.141 -            MIR_mir_window_get_error_message(mir_window->window));
  28.142 -    }
  28.143 -
  28.144 -    if (window->flags & SDL_WINDOW_OPENGL) {
  28.145 -        EGLNativeWindowType egl_native_window =
  28.146 -                        (EGLNativeWindowType)MIR_mir_buffer_stream_get_egl_native_window(
  28.147 -                                                       MIR_mir_window_get_buffer_stream(mir_window->window));
  28.148 -
  28.149 -        mir_window->egl_surface = SDL_EGL_CreateSurface(_this, egl_native_window);
  28.150 -
  28.151 -        if (mir_window->egl_surface == EGL_NO_SURFACE) {
  28.152 -            return SDL_SetError("Failed to create a window surface %p",
  28.153 -                                _this->egl_data->egl_display);
  28.154 -        }
  28.155 -    }
  28.156 -    else {
  28.157 -        mir_window->egl_surface = EGL_NO_SURFACE;
  28.158 -    }
  28.159 -
  28.160 -    mir_data->current_window = mir_window;
  28.161 -
  28.162 -    return 0;
  28.163 -}
  28.164 -
  28.165 -void
  28.166 -MIR_DestroyWindow(_THIS, SDL_Window* window)
  28.167 -{
  28.168 -    MIR_Data* mir_data     = _this->driverdata;
  28.169 -    MIR_Window* mir_window = window->driverdata;
  28.170 -
  28.171 -    if (mir_data) {
  28.172 -        SDL_EGL_DestroySurface(_this, mir_window->egl_surface);
  28.173 -        MIR_mir_window_release_sync(mir_window->window);
  28.174 -
  28.175 -        mir_data->current_window = NULL;
  28.176 -
  28.177 -        SDL_free(mir_window);
  28.178 -    }
  28.179 -    window->driverdata = NULL;
  28.180 -}
  28.181 -
  28.182 -SDL_bool
  28.183 -MIR_GetWindowWMInfo(_THIS, SDL_Window* window, SDL_SysWMinfo* info)
  28.184 -{
  28.185 -    if (info->version.major == SDL_MAJOR_VERSION &&
  28.186 -        info->version.minor == SDL_MINOR_VERSION) {
  28.187 -        MIR_Window* mir_window = window->driverdata;
  28.188 -
  28.189 -        info->subsystem = SDL_SYSWM_MIR;
  28.190 -        info->info.mir.connection = mir_window->mir_data->connection;
  28.191 -        // Cannot change this to window due to it being in the public API
  28.192 -        info->info.mir.surface = mir_window->window;
  28.193 -
  28.194 -        return SDL_TRUE;
  28.195 -    }
  28.196 -
  28.197 -    return SDL_FALSE;
  28.198 -}
  28.199 -
  28.200 -static void
  28.201 -UpdateMirWindowState(MIR_Data* mir_data, MIR_Window* mir_window, MirWindowState window_state)
  28.202 -{
  28.203 -    if (IsMirWindowValid(mir_window)) {
  28.204 -        MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection);
  28.205 -        MIR_mir_window_spec_set_state(spec, window_state);
  28.206 -
  28.207 -        MIR_mir_window_apply_spec(mir_window->window, spec);
  28.208 -        MIR_mir_window_spec_release(spec);
  28.209 -    }
  28.210 -}
  28.211 -
  28.212 -void
  28.213 -MIR_SetWindowFullscreen(_THIS, SDL_Window* window,
  28.214 -                        SDL_VideoDisplay* display,
  28.215 -                        SDL_bool fullscreen)
  28.216 -{
  28.217 -    if (IsMirWindowValid(window->driverdata)) {
  28.218 -        MirWindowState state;
  28.219 -
  28.220 -        if (fullscreen) {
  28.221 -            state = mir_window_state_fullscreen;
  28.222 -        }
  28.223 -        else {
  28.224 -            state = mir_window_state_restored;
  28.225 -        }
  28.226 -
  28.227 -        UpdateMirWindowState(_this->driverdata, window->driverdata, state);
  28.228 -    }
  28.229 -}
  28.230 -
  28.231 -void
  28.232 -MIR_MaximizeWindow(_THIS, SDL_Window* window)
  28.233 -{
  28.234 -    UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_maximized);
  28.235 -}
  28.236 -
  28.237 -void
  28.238 -MIR_MinimizeWindow(_THIS, SDL_Window* window)
  28.239 -{
  28.240 -    UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_minimized);
  28.241 -}
  28.242 -
  28.243 -void
  28.244 -MIR_RestoreWindow(_THIS, SDL_Window * window)
  28.245 -{
  28.246 -    UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_restored);
  28.247 -}
  28.248 -
  28.249 -void
  28.250 -MIR_HideWindow(_THIS, SDL_Window* window)
  28.251 -{
  28.252 -    UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_hidden);
  28.253 -}
  28.254 -
  28.255 -void
  28.256 -MIR_SetWindowSize(_THIS, SDL_Window* window)
  28.257 -{
  28.258 -    MIR_Data* mir_data     = _this->driverdata;
  28.259 -    MIR_Window* mir_window = window->driverdata;
  28.260 -
  28.261 -    if (IsMirWindowValid(mir_window)) {
  28.262 -        MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection);
  28.263 -        MIR_mir_window_spec_set_width (spec, window->w);
  28.264 -        MIR_mir_window_spec_set_height(spec, window->h);
  28.265 -
  28.266 -        MIR_mir_window_apply_spec(mir_window->window, spec);
  28.267 -    }
  28.268 -}
  28.269 -
  28.270 -void
  28.271 -MIR_SetWindowMinimumSize(_THIS, SDL_Window* window)
  28.272 -{
  28.273 -    MIR_Data* mir_data     = _this->driverdata;
  28.274 -    MIR_Window* mir_window = window->driverdata;
  28.275 -
  28.276 -    if (IsMirWindowValid(mir_window)) {
  28.277 -        MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection);
  28.278 -        MIR_mir_window_spec_set_min_width (spec, window->min_w);
  28.279 -        MIR_mir_window_spec_set_min_height(spec, window->min_h);
  28.280 -
  28.281 -        MIR_mir_window_apply_spec(mir_window->window, spec);
  28.282 -    }
  28.283 -}
  28.284 -
  28.285 -void
  28.286 -MIR_SetWindowMaximumSize(_THIS, SDL_Window* window)
  28.287 -{
  28.288 -    MIR_Data* mir_data     = _this->driverdata;
  28.289 -    MIR_Window* mir_window = window->driverdata;
  28.290 -
  28.291 -    if (IsMirWindowValid(mir_window)) {
  28.292 -        MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection);
  28.293 -        MIR_mir_window_spec_set_max_width (spec, window->max_w);
  28.294 -        MIR_mir_window_spec_set_max_height(spec, window->max_h);
  28.295 -
  28.296 -        MIR_mir_window_apply_spec(mir_window->window, spec);
  28.297 -    }
  28.298 -}
  28.299 -
  28.300 -void
  28.301 -MIR_SetWindowTitle(_THIS, SDL_Window* window)
  28.302 -{
  28.303 -    MIR_Data*   mir_data   = _this->driverdata;
  28.304 -    MIR_Window* mir_window = window->driverdata;
  28.305 -    char const* title = window->title ? window->title : "";
  28.306 -    MirWindowSpec* spec;
  28.307 -
  28.308 -    if (IsMirWindowValid(mir_window) < 0)
  28.309 -        return;
  28.310 -
  28.311 -    spec = MIR_mir_create_window_spec(mir_data->connection);
  28.312 -    MIR_mir_window_spec_set_name(spec, title);
  28.313 -
  28.314 -    MIR_mir_window_apply_spec(mir_window->window, spec);
  28.315 -    MIR_mir_window_spec_release(spec);
  28.316 -}
  28.317 -
  28.318 -void
  28.319 -MIR_SetWindowGrab(_THIS, SDL_Window* window, SDL_bool grabbed)
  28.320 -{
  28.321 -    MIR_Data*   mir_data   = _this->driverdata;
  28.322 -    MIR_Window* mir_window = window->driverdata;
  28.323 -    MirPointerConfinementState confined = mir_pointer_unconfined;
  28.324 -    MirWindowSpec* spec;
  28.325 -
  28.326 -    if (grabbed)
  28.327 -        confined = mir_pointer_confined_to_window;
  28.328 -
  28.329 -    spec = MIR_mir_create_window_spec(mir_data->connection);
  28.330 -    MIR_mir_window_spec_set_pointer_confinement(spec, confined);
  28.331 -
  28.332 -    MIR_mir_window_apply_spec(mir_window->window, spec);
  28.333 -    MIR_mir_window_spec_release(spec);
  28.334 -}
  28.335 -
  28.336 -int
  28.337 -MIR_SetWindowGammaRamp(_THIS, SDL_Window* window, Uint16 const* ramp)
  28.338 -{
  28.339 -    MirOutput* output = SDL_GetDisplayForWindow(window)->driverdata;
  28.340 -    Uint32 ramp_size = 256;
  28.341 -
  28.342 -    // FIXME Need to apply the changes to the output, once that public API function is around
  28.343 -    if (MIR_mir_output_is_gamma_supported(output) == mir_output_gamma_supported) {
  28.344 -        MIR_mir_output_set_gamma(output,
  28.345 -                                 ramp + ramp_size * 0,
  28.346 -                                 ramp + ramp_size * 1,
  28.347 -                                 ramp + ramp_size * 2,
  28.348 -                                 ramp_size);
  28.349 -        return 0;
  28.350 -    }
  28.351 -
  28.352 -    return -1;
  28.353 -}
  28.354 -
  28.355 -int
  28.356 -MIR_GetWindowGammaRamp(_THIS, SDL_Window* window, Uint16* ramp)
  28.357 -{
  28.358 -    MirOutput* output = SDL_GetDisplayForWindow(window)->driverdata;
  28.359 -    Uint32 ramp_size = 256;
  28.360 -
  28.361 -    if (MIR_mir_output_is_gamma_supported(output) == mir_output_gamma_supported) {
  28.362 -        if (MIR_mir_output_get_gamma_size(output) == ramp_size) {
  28.363 -            MIR_mir_output_get_gamma(output,
  28.364 -                                     ramp + ramp_size * 0,
  28.365 -                                     ramp + ramp_size * 1,
  28.366 -                                     ramp + ramp_size * 2,
  28.367 -                                     ramp_size);
  28.368 -            return 0;
  28.369 -        }
  28.370 -    }
  28.371 -
  28.372 -    return -1;
  28.373 -}
  28.374 -
  28.375 -#endif /* SDL_VIDEO_DRIVER_MIR */
  28.376 -
  28.377 -/* vi: set ts=4 sw=4 expandtab: */
    29.1 --- a/src/video/mir/SDL_mirwindow.h	Fri Nov 02 18:07:11 2018 -0700
    29.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.3 @@ -1,93 +0,0 @@
    29.4 -/*
    29.5 -  Simple DirectMedia Layer
    29.6 -  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
    29.7 -
    29.8 -  This software is provided 'as-is', without any express or implied
    29.9 -  warranty.  In no event will the authors be held liable for any damages
   29.10 -  arising from the use of this software.
   29.11 -
   29.12 -  Permission is granted to anyone to use this software for any purpose,
   29.13 -  including commercial applications, and to alter it and redistribute it
   29.14 -  freely, subject to the following restrictions:
   29.15 -
   29.16 -  1. The origin of this software must not be misrepresented; you must not
   29.17 -     claim that you wrote the original software. If you use this software
   29.18 -     in a product, an acknowledgment in the product documentation would be
   29.19 -     appreciated but is not required.
   29.20 -  2. Altered source versions must be plainly marked as such, and must not be
   29.21 -     misrepresented as being the original software.
   29.22 -  3. This notice may not be removed or altered from any source distribution.
   29.23 -*/
   29.24 -
   29.25 -/*
   29.26 -  Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
   29.27 -*/
   29.28 -
   29.29 -#ifndef SDL_mirwindow_h_
   29.30 -#define SDL_mirwindow_h_
   29.31 -
   29.32 -#include "../SDL_sysvideo.h"
   29.33 -#include "SDL_syswm.h"
   29.34 -
   29.35 -#include "SDL_mirvideo.h"
   29.36 -
   29.37 -struct MIR_Window {
   29.38 -    SDL_Window* sdl_window;
   29.39 -    MIR_Data*   mir_data;
   29.40 -
   29.41 -    MirWindow*  window;
   29.42 -    EGLSurface  egl_surface;
   29.43 -};
   29.44 -
   29.45 -
   29.46 -extern int
   29.47 -MIR_CreateWindow(_THIS, SDL_Window* window);
   29.48 -
   29.49 -extern void
   29.50 -MIR_DestroyWindow(_THIS, SDL_Window* window);
   29.51 -
   29.52 -extern void
   29.53 -MIR_SetWindowFullscreen(_THIS, SDL_Window* window,
   29.54 -                        SDL_VideoDisplay* display,
   29.55 -                        SDL_bool fullscreen);
   29.56 -
   29.57 -extern void
   29.58 -MIR_MaximizeWindow(_THIS, SDL_Window* window);
   29.59 -
   29.60 -extern void
   29.61 -MIR_MinimizeWindow(_THIS, SDL_Window* window);
   29.62 -
   29.63 -extern void
   29.64 -MIR_RestoreWindow(_THIS, SDL_Window* window);
   29.65 -
   29.66 -extern void
   29.67 -MIR_HideWindow(_THIS, SDL_Window* window);
   29.68 -
   29.69 -extern SDL_bool
   29.70 -MIR_GetWindowWMInfo(_THIS, SDL_Window* window, SDL_SysWMinfo* info);
   29.71 -
   29.72 -extern void
   29.73 -MIR_SetWindowSize(_THIS, SDL_Window* window);
   29.74 -
   29.75 -extern void
   29.76 -MIR_SetWindowMinimumSize(_THIS, SDL_Window* window);
   29.77 -
   29.78 -extern void
   29.79 -MIR_SetWindowMaximumSize(_THIS, SDL_Window* window);
   29.80 -
   29.81 -extern void
   29.82 -MIR_SetWindowTitle(_THIS, SDL_Window* window);
   29.83 -
   29.84 -extern void
   29.85 -MIR_SetWindowGrab(_THIS, SDL_Window* window, SDL_bool grabbed);
   29.86 -
   29.87 -extern int
   29.88 -MIR_SetWindowGammaRamp(_THIS, SDL_Window* window, Uint16 const* ramp);
   29.89 -
   29.90 -extern int
   29.91 -MIR_GetWindowGammaRamp(_THIS, SDL_Window* window, Uint16* ramp);
   29.92 -
   29.93 -#endif /* SDL_mirwindow_h_ */
   29.94 -
   29.95 -/* vi: set ts=4 sw=4 expandtab: */
   29.96 -