mirror of https://github.com/encounter/SDL.git
Dynamic loading support for Wayland
This commit is contained in:
parent
5fd5567c4c
commit
272ebb8efb
|
@ -819,6 +819,7 @@ enable_diskaudio
|
||||||
enable_dummyaudio
|
enable_dummyaudio
|
||||||
enable_video_wayland
|
enable_video_wayland
|
||||||
enable_video_wayland_qt_touch
|
enable_video_wayland_qt_touch
|
||||||
|
enable_wayland_shared
|
||||||
enable_video_x11
|
enable_video_x11
|
||||||
with_x
|
with_x
|
||||||
enable_x11_shared
|
enable_x11_shared
|
||||||
|
@ -1538,6 +1539,7 @@ Optional Features:
|
||||||
--enable-video-wayland-qt-touch
|
--enable-video-wayland-qt-touch
|
||||||
QtWayland server support for Wayland video driver
|
QtWayland server support for Wayland video driver
|
||||||
[[default=yes]]
|
[[default=yes]]
|
||||||
|
--enable-wayland-shared dynamically load Wayland support [[default=maybe]]
|
||||||
--enable-video-x11 use X11 video driver [[default=yes]]
|
--enable-video-x11 use X11 video driver [[default=yes]]
|
||||||
--enable-x11-shared dynamically load X11 support [[default=maybe]]
|
--enable-x11-shared dynamically load X11 support [[default=maybe]]
|
||||||
--enable-video-x11-xcursor
|
--enable-video-x11-xcursor
|
||||||
|
@ -18705,8 +18707,8 @@ $as_echo_n "checking for Wayland support... " >&6; }
|
||||||
video_wayland=no
|
video_wayland=no
|
||||||
if test x$PKG_CONFIG != xno; then
|
if test x$PKG_CONFIG != xno; then
|
||||||
if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon ; then
|
if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon ; then
|
||||||
WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor egl xkbcommon`
|
WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon`
|
||||||
WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor egl xkbcommon`
|
WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
|
||||||
video_wayland=yes
|
video_wayland=yes
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -18724,7 +18726,69 @@ $as_echo "#define SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1" >>confdefs.h
|
||||||
fi
|
fi
|
||||||
SOURCES="$SOURCES $srcdir/src/video/wayland/*.c"
|
SOURCES="$SOURCES $srcdir/src/video/wayland/*.c"
|
||||||
EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS"
|
EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS"
|
||||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS"
|
# Check whether --enable-wayland-shared was given.
|
||||||
|
if test "${enable_wayland_shared+set}" = set; then :
|
||||||
|
enableval=$enable_wayland_shared;
|
||||||
|
else
|
||||||
|
enable_wayland_shared=maybe
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
case "$host" in
|
||||||
|
*)
|
||||||
|
wayland_client_lib=`find_lib "libwayland-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
|
||||||
|
wayland_egl_lib=`find_lib "libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
|
||||||
|
if test x$wayland_egl_lib = x; then
|
||||||
|
wayland_egl_lib=`find_lib "mesa-egl/libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
|
||||||
|
fi
|
||||||
|
wayland_cursor_lib=`find_lib "libwayland-cursor.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
|
||||||
|
xkbcommon_lib=`find_lib "libxkbcommon.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if test x$enable_wayland_shared = xmaybe; then
|
||||||
|
enable_wayland_shared=yes
|
||||||
|
fi
|
||||||
|
if test x$have_loadso != xyes && \
|
||||||
|
test x$enable_wayland_shared = xyes; then
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic WAYLAND loading" >&5
|
||||||
|
$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic WAYLAND loading" >&2;}
|
||||||
|
enable_wayland_shared=no
|
||||||
|
fi
|
||||||
|
if test x$have_loadso = xyes && \
|
||||||
|
test x$enable_wayland_shared = xyes && \
|
||||||
|
test x$wayland_client_lib != x && \
|
||||||
|
test x$wayland_egl_lib != x && \
|
||||||
|
test x$wayland_cursor_lib != x && \
|
||||||
|
test x$xkbcommon_lib != x; then
|
||||||
|
echo "-- dynamic libwayland-client -> $wayland_client_lib"
|
||||||
|
echo "-- dynamic libwayland-egl -> $wayland_egl_lib"
|
||||||
|
echo "-- dynamic libwayland-cursor -> $wayland_cursor_lib"
|
||||||
|
echo "-- dynamic xkbcommon -> $xkbcommon_lib"
|
||||||
|
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC "$wayland_client_lib"
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL "$wayland_egl_lib"
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR "$wayland_cursor_lib"
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON "$xkbcommon_lib"
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
else
|
||||||
|
enable_wayland_shared=no
|
||||||
|
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS"
|
||||||
|
fi
|
||||||
have_video=yes
|
have_video=yes
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
50
configure.in
50
configure.in
|
@ -1133,8 +1133,8 @@ AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for
|
||||||
video_wayland=no
|
video_wayland=no
|
||||||
if test x$PKG_CONFIG != xno; then
|
if test x$PKG_CONFIG != xno; then
|
||||||
if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon ; then
|
if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon ; then
|
||||||
WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor egl xkbcommon`
|
WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon`
|
||||||
WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor egl xkbcommon`
|
WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
|
||||||
video_wayland=yes
|
video_wayland=yes
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -1147,8 +1147,50 @@ AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for
|
||||||
fi
|
fi
|
||||||
SOURCES="$SOURCES $srcdir/src/video/wayland/*.c"
|
SOURCES="$SOURCES $srcdir/src/video/wayland/*.c"
|
||||||
EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS"
|
EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS"
|
||||||
dnl FIXME do dynamic loading code here.
|
AC_ARG_ENABLE(wayland-shared,
|
||||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS"
|
AC_HELP_STRING([--enable-wayland-shared], [dynamically load Wayland support [[default=maybe]]]),
|
||||||
|
, enable_wayland_shared=maybe)
|
||||||
|
|
||||||
|
dnl FIXME: Do BSD and OS X need special cases?
|
||||||
|
case "$host" in
|
||||||
|
*)
|
||||||
|
wayland_client_lib=[`find_lib "libwayland-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
|
||||||
|
wayland_egl_lib=[`find_lib "libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
|
||||||
|
if test x$wayland_egl_lib = x; then
|
||||||
|
dnl This works in Ubuntu 13.10, maybe others
|
||||||
|
wayland_egl_lib=[`find_lib "mesa-egl/libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
|
||||||
|
fi
|
||||||
|
wayland_cursor_lib=[`find_lib "libwayland-cursor.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
|
||||||
|
xkbcommon_lib=[`find_lib "libxkbcommon.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if test x$enable_wayland_shared = xmaybe; then
|
||||||
|
enable_wayland_shared=yes
|
||||||
|
fi
|
||||||
|
if test x$have_loadso != xyes && \
|
||||||
|
test x$enable_wayland_shared = xyes; then
|
||||||
|
AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic WAYLAND loading])
|
||||||
|
enable_wayland_shared=no
|
||||||
|
fi
|
||||||
|
if test x$have_loadso = xyes && \
|
||||||
|
test x$enable_wayland_shared = xyes && \
|
||||||
|
test x$wayland_client_lib != x && \
|
||||||
|
test x$wayland_egl_lib != x && \
|
||||||
|
test x$wayland_cursor_lib != x && \
|
||||||
|
test x$xkbcommon_lib != x; then
|
||||||
|
echo "-- dynamic libwayland-client -> $wayland_client_lib"
|
||||||
|
echo "-- dynamic libwayland-egl -> $wayland_egl_lib"
|
||||||
|
echo "-- dynamic libwayland-cursor -> $wayland_cursor_lib"
|
||||||
|
echo "-- dynamic xkbcommon -> $xkbcommon_lib"
|
||||||
|
AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC, "$wayland_client_lib", [ ])
|
||||||
|
AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL, "$wayland_egl_lib", [ ])
|
||||||
|
AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR, "$wayland_cursor_lib", [ ])
|
||||||
|
AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON, "$xkbcommon_lib", [ ])
|
||||||
|
else
|
||||||
|
enable_wayland_shared=no
|
||||||
|
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS"
|
||||||
|
fi
|
||||||
have_video=yes
|
have_video=yes
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -263,6 +263,10 @@
|
||||||
#undef SDL_VIDEO_DRIVER_WINDOWS
|
#undef SDL_VIDEO_DRIVER_WINDOWS
|
||||||
#undef SDL_VIDEO_DRIVER_WAYLAND
|
#undef SDL_VIDEO_DRIVER_WAYLAND
|
||||||
#undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
|
#undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
|
||||||
|
#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
|
||||||
|
#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL
|
||||||
|
#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
|
||||||
|
#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
|
||||||
#undef SDL_VIDEO_DRIVER_X11
|
#undef SDL_VIDEO_DRIVER_X11
|
||||||
#undef SDL_VIDEO_DRIVER_RPI
|
#undef SDL_VIDEO_DRIVER_RPI
|
||||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
|
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
|
||||||
|
|
|
@ -0,0 +1,195 @@
|
||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
|
#if SDL_VIDEO_DRIVER_WAYLAND
|
||||||
|
|
||||||
|
#define DEBUG_DYNAMIC_WAYLAND 0
|
||||||
|
|
||||||
|
#include "SDL_waylanddyn.h"
|
||||||
|
|
||||||
|
#if DEBUG_DYNAMIC_WAYLAND
|
||||||
|
#include "SDL_log.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
|
||||||
|
|
||||||
|
#include "SDL_name.h"
|
||||||
|
#include "SDL_loadso.h"
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
void *lib;
|
||||||
|
const char *libname;
|
||||||
|
} waylanddynlib;
|
||||||
|
|
||||||
|
#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
|
||||||
|
#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC NULL
|
||||||
|
#endif
|
||||||
|
#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL
|
||||||
|
#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL NULL
|
||||||
|
#endif
|
||||||
|
#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
|
||||||
|
#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR NULL
|
||||||
|
#endif
|
||||||
|
#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
|
||||||
|
#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON NULL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static waylanddynlib waylandlibs[] = {
|
||||||
|
{NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC},
|
||||||
|
{NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL},
|
||||||
|
{NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR},
|
||||||
|
{NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON}
|
||||||
|
};
|
||||||
|
|
||||||
|
static void *
|
||||||
|
WAYLAND_GetSym(const char *fnname, int *pHasModule)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
void *fn = NULL;
|
||||||
|
for (i = 0; i < SDL_TABLESIZE(waylandlibs); i++) {
|
||||||
|
if (waylandlibs[i].lib != NULL) {
|
||||||
|
fn = SDL_LoadFunction(waylandlibs[i].lib, fnname);
|
||||||
|
if (fn != NULL)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if DEBUG_DYNAMIC_WAYLAND
|
||||||
|
if (fn != NULL)
|
||||||
|
SDL_Log("WAYLAND: Found '%s' in %s (%p)\n", fnname, waylandlibs[i].libname, fn);
|
||||||
|
else
|
||||||
|
SDL_Log("WAYLAND: Symbol '%s' NOT FOUND!\n", fnname);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (fn == NULL)
|
||||||
|
*pHasModule = 0; /* kill this module. */
|
||||||
|
|
||||||
|
return fn;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */
|
||||||
|
|
||||||
|
/* Define all the function pointers and wrappers... */
|
||||||
|
#define SDL_WAYLAND_MODULE(modname) int SDL_WAYLAND_HAVE_##modname = 0;
|
||||||
|
#define SDL_WAYLAND_SYM(rc,fn,params) SDL_DYNWAYLANDFN_##fn WAYLAND_##fn = NULL;
|
||||||
|
#define SDL_WAYLAND_INTERFACE(iface) const struct wl_interface *WAYLAND_##iface = NULL;
|
||||||
|
#include "SDL_waylandsym.h"
|
||||||
|
#undef SDL_WAYLAND_MODULE
|
||||||
|
#undef SDL_WAYLAND_SYM
|
||||||
|
#undef SDL_WAYLAND_INTERFACE
|
||||||
|
|
||||||
|
static int wayland_load_refcount = 0;
|
||||||
|
|
||||||
|
void
|
||||||
|
SDL_WAYLAND_UnloadSymbols(void)
|
||||||
|
{
|
||||||
|
/* Don't actually unload if more than one module is using the libs... */
|
||||||
|
if (wayland_load_refcount > 0) {
|
||||||
|
if (--wayland_load_refcount == 0) {
|
||||||
|
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
|
||||||
|
int i;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* set all the function pointers to NULL. */
|
||||||
|
#define SDL_WAYLAND_MODULE(modname) SDL_WAYLAND_HAVE_##modname = 0;
|
||||||
|
#define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = NULL;
|
||||||
|
#define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = NULL;
|
||||||
|
#include "SDL_waylandsym.h"
|
||||||
|
#undef SDL_WAYLAND_MODULE
|
||||||
|
#undef SDL_WAYLAND_SYM
|
||||||
|
#undef SDL_WAYLAND_INTERFACE
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
|
||||||
|
for (i = 0; i < SDL_TABLESIZE(waylandlibs); i++) {
|
||||||
|
if (waylandlibs[i].lib != NULL) {
|
||||||
|
SDL_UnloadObject(waylandlibs[i].lib);
|
||||||
|
waylandlibs[i].lib = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* returns non-zero if all needed symbols were loaded. */
|
||||||
|
int
|
||||||
|
SDL_WAYLAND_LoadSymbols(void)
|
||||||
|
{
|
||||||
|
int rc = 1; /* always succeed if not using Dynamic WAYLAND stuff. */
|
||||||
|
|
||||||
|
/* deal with multiple modules (dga, wayland, etc) needing these symbols... */
|
||||||
|
if (wayland_load_refcount++ == 0) {
|
||||||
|
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
|
||||||
|
int i;
|
||||||
|
int *thismod = NULL;
|
||||||
|
for (i = 0; i < SDL_TABLESIZE(waylandlibs); i++) {
|
||||||
|
if (waylandlibs[i].libname != NULL) {
|
||||||
|
waylandlibs[i].lib = SDL_LoadObject(waylandlibs[i].libname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SDL_WAYLAND_MODULE(modname) SDL_WAYLAND_HAVE_##modname = 1; /* default yes */
|
||||||
|
#define SDL_WAYLAND_SYM(rc,fn,params)
|
||||||
|
#define SDL_WAYLAND_INTERFACE(iface)
|
||||||
|
#include "SDL_waylandsym.h"
|
||||||
|
#undef SDL_WAYLAND_MODULE
|
||||||
|
#undef SDL_WAYLAND_SYM
|
||||||
|
#undef SDL_WAYLAND_INTERFACE
|
||||||
|
|
||||||
|
#define SDL_WAYLAND_MODULE(modname) thismod = &SDL_WAYLAND_HAVE_##modname;
|
||||||
|
#define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = (SDL_DYNWAYLANDFN_##fn) WAYLAND_GetSym(#fn,thismod);
|
||||||
|
#define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = (struct wl_interface *) WAYLAND_GetSym(#iface,thismod);
|
||||||
|
#include "SDL_waylandsym.h"
|
||||||
|
#undef SDL_WAYLAND_MODULE
|
||||||
|
#undef SDL_WAYLAND_SYM
|
||||||
|
#undef SDL_WAYLAND_INTERFACE
|
||||||
|
|
||||||
|
if (SDL_WAYLAND_HAVE_WAYLAND_CLIENT) {
|
||||||
|
/* all required symbols loaded. */
|
||||||
|
SDL_ClearError();
|
||||||
|
} else {
|
||||||
|
/* in case something got loaded... */
|
||||||
|
SDL_WAYLAND_UnloadSymbols();
|
||||||
|
rc = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* no dynamic WAYLAND */
|
||||||
|
|
||||||
|
#define SDL_WAYLAND_MODULE(modname) SDL_WAYLAND_HAVE_##modname = 1; /* default yes */
|
||||||
|
#define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
|
||||||
|
#define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = &iface;
|
||||||
|
#include "SDL_waylandsym.h"
|
||||||
|
#undef SDL_WAYLAND_MODULE
|
||||||
|
#undef SDL_WAYLAND_SYM
|
||||||
|
#undef SDL_WAYLAND_INTERFACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* SDL_VIDEO_DRIVER_WAYLAND */
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
|
@ -0,0 +1,103 @@
|
||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SDL_waylanddyn_h
|
||||||
|
#define _SDL_waylanddyn_h
|
||||||
|
|
||||||
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
|
/* We can't include wayland-client.h here
|
||||||
|
* but we need some structs from it
|
||||||
|
*/
|
||||||
|
struct wl_interface;
|
||||||
|
struct wl_proxy;
|
||||||
|
struct wl_event_queue;
|
||||||
|
struct wl_display;
|
||||||
|
struct wl_surface;
|
||||||
|
struct wl_shm;
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "wayland-cursor.h"
|
||||||
|
#include "wayland-util.h"
|
||||||
|
#include "xkbcommon/xkbcommon.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int SDL_WAYLAND_LoadSymbols(void);
|
||||||
|
void SDL_WAYLAND_UnloadSymbols(void);
|
||||||
|
|
||||||
|
#define SDL_WAYLAND_MODULE(modname) extern int SDL_WAYLAND_HAVE_##modname;
|
||||||
|
#define SDL_WAYLAND_SYM(rc,fn,params) \
|
||||||
|
typedef rc (*SDL_DYNWAYLANDFN_##fn) params; \
|
||||||
|
extern SDL_DYNWAYLANDFN_##fn WAYLAND_##fn;
|
||||||
|
#define SDL_WAYLAND_INTERFACE(iface) extern const struct wl_interface *WAYLAND_##iface;
|
||||||
|
#include "SDL_waylandsym.h"
|
||||||
|
#undef SDL_WAYLAND_MODULE
|
||||||
|
#undef SDL_WAYLAND_SYM
|
||||||
|
#undef SDL_WAYLAND_INTERFACE
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
|
||||||
|
|
||||||
|
#ifdef _WAYLAND_CLIENT_H
|
||||||
|
#error Do not include wayland-client ahead of SDL_waylanddyn.h in dynamic loading mode
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* wayland-client-protocol.h included from wayland-client.h
|
||||||
|
* has inline functions that require these to be defined in dynamic loading mode
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define wl_proxy_create (*WAYLAND_wl_proxy_create)
|
||||||
|
#define wl_proxy_destroy (*WAYLAND_wl_proxy_destroy)
|
||||||
|
#define wl_proxy_marshal (*WAYLAND_wl_proxy_marshal)
|
||||||
|
#define wl_proxy_set_user_data (*WAYLAND_wl_proxy_set_user_data)
|
||||||
|
#define wl_proxy_get_user_data (*WAYLAND_wl_proxy_get_user_data)
|
||||||
|
#define wl_proxy_add_listener (*WAYLAND_wl_proxy_add_listener)
|
||||||
|
|
||||||
|
#define wl_seat_interface (*WAYLAND_wl_seat_interface)
|
||||||
|
#define wl_surface_interface (*WAYLAND_wl_surface_interface)
|
||||||
|
#define wl_shm_pool_interface (*WAYLAND_wl_shm_pool_interface)
|
||||||
|
#define wl_buffer_interface (*WAYLAND_wl_buffer_interface)
|
||||||
|
#define wl_registry_interface (*WAYLAND_wl_registry_interface)
|
||||||
|
#define wl_shell_surface_interface (*WAYLAND_wl_shell_surface_interface)
|
||||||
|
#define wl_region_interface (*WAYLAND_wl_region_interface)
|
||||||
|
#define wl_pointer_interface (*WAYLAND_wl_pointer_interface)
|
||||||
|
#define wl_keyboard_interface (*WAYLAND_wl_keyboard_interface)
|
||||||
|
#define wl_compositor_interface (*WAYLAND_wl_compositor_interface)
|
||||||
|
#define wl_output_interface (*WAYLAND_wl_output_interface)
|
||||||
|
#define wl_shell_interface (*WAYLAND_wl_shell_interface)
|
||||||
|
#define wl_shm_interface (*WAYLAND_wl_shm_interface)
|
||||||
|
|
||||||
|
#endif /* SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */
|
||||||
|
|
||||||
|
#include "wayland-client.h"
|
||||||
|
#include "wayland-egl.h"
|
||||||
|
|
||||||
|
#endif /* !defined _SDL_waylanddyn_h */
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
|
@ -19,7 +19,7 @@
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SDL_config.h"
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
#include "SDL_assert.h"
|
#include "SDL_assert.h"
|
||||||
|
@ -32,6 +32,8 @@
|
||||||
#include "SDL_waylandevents_c.h"
|
#include "SDL_waylandevents_c.h"
|
||||||
#include "SDL_waylandwindow.h"
|
#include "SDL_waylandwindow.h"
|
||||||
|
|
||||||
|
#include "SDL_waylanddyn.h"
|
||||||
|
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
@ -60,14 +62,14 @@ Wayland_PumpEvents(_THIS)
|
||||||
SDL_VideoData *d = _this->driverdata;
|
SDL_VideoData *d = _this->driverdata;
|
||||||
struct pollfd pfd[1];
|
struct pollfd pfd[1];
|
||||||
|
|
||||||
pfd[0].fd = wl_display_get_fd(d->display);
|
pfd[0].fd = WAYLAND_wl_display_get_fd(d->display);
|
||||||
pfd[0].events = POLLIN;
|
pfd[0].events = POLLIN;
|
||||||
poll(pfd, 1, 0);
|
poll(pfd, 1, 0);
|
||||||
|
|
||||||
if (pfd[0].revents & POLLIN)
|
if (pfd[0].revents & POLLIN)
|
||||||
wl_display_dispatch(d->display);
|
WAYLAND_wl_display_dispatch(d->display);
|
||||||
else
|
else
|
||||||
wl_display_dispatch_pending(d->display);
|
WAYLAND_wl_display_dispatch_pending(d->display);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -199,7 +201,7 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
input->xkb.keymap = xkb_map_new_from_string(input->display->xkb_context,
|
input->xkb.keymap = WAYLAND_xkb_keymap_new_from_string(input->display->xkb_context,
|
||||||
map_str,
|
map_str,
|
||||||
XKB_KEYMAP_FORMAT_TEXT_V1,
|
XKB_KEYMAP_FORMAT_TEXT_V1,
|
||||||
0);
|
0);
|
||||||
|
@ -211,10 +213,10 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
input->xkb.state = xkb_state_new(input->xkb.keymap);
|
input->xkb.state = WAYLAND_xkb_state_new(input->xkb.keymap);
|
||||||
if (!input->xkb.state) {
|
if (!input->xkb.state) {
|
||||||
fprintf(stderr, "failed to create XKB state\n");
|
fprintf(stderr, "failed to create XKB state\n");
|
||||||
xkb_map_unref(input->xkb.keymap);
|
WAYLAND_xkb_keymap_unref(input->xkb.keymap);
|
||||||
input->xkb.keymap = NULL;
|
input->xkb.keymap = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -266,11 +268,11 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// TODO can this happen?
|
// TODO can this happen?
|
||||||
if (xkb_key_get_syms(input->xkb.state, key + 8, &syms) != 1)
|
if (WAYLAND_xkb_state_key_get_syms(input->xkb.state, key + 8, &syms) != 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (state) {
|
if (state) {
|
||||||
size = xkb_keysym_to_utf8(syms[0], text, sizeof text);
|
size = WAYLAND_xkb_keysym_to_utf8(syms[0], text, sizeof text);
|
||||||
|
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
text[size] = 0;
|
text[size] = 0;
|
||||||
|
@ -287,7 +289,7 @@ keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard,
|
||||||
{
|
{
|
||||||
struct SDL_WaylandInput *input = data;
|
struct SDL_WaylandInput *input = data;
|
||||||
|
|
||||||
xkb_state_update_mask(input->xkb.state, mods_depressed, mods_latched,
|
WAYLAND_xkb_state_update_mask(input->xkb.state, mods_depressed, mods_latched,
|
||||||
mods_locked, 0, 0, group);
|
mods_locked, 0, 0, group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,7 +351,7 @@ Wayland_display_add_input(SDL_VideoData *d, uint32_t id)
|
||||||
wl_seat_add_listener(input->seat, &seat_listener, input);
|
wl_seat_add_listener(input->seat, &seat_listener, input);
|
||||||
wl_seat_set_user_data(input->seat, input);
|
wl_seat_set_user_data(input->seat, input);
|
||||||
|
|
||||||
wayland_schedule_write(d);
|
WAYLAND_wl_display_flush(d->display);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wayland_display_destroy_input(SDL_VideoData *d)
|
void Wayland_display_destroy_input(SDL_VideoData *d)
|
||||||
|
@ -369,10 +371,10 @@ void Wayland_display_destroy_input(SDL_VideoData *d)
|
||||||
wl_seat_destroy(input->seat);
|
wl_seat_destroy(input->seat);
|
||||||
|
|
||||||
if (input->xkb.state)
|
if (input->xkb.state)
|
||||||
xkb_state_unref(input->xkb.state);
|
WAYLAND_xkb_state_unref(input->xkb.state);
|
||||||
|
|
||||||
if (input->xkb.keymap)
|
if (input->xkb.keymap)
|
||||||
xkb_map_unref(input->xkb.keymap);
|
WAYLAND_xkb_keymap_unref(input->xkb.keymap);
|
||||||
|
|
||||||
free(input);
|
free(input);
|
||||||
d->input = NULL;
|
d->input = NULL;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SDL_config.h"
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
#ifndef _SDL_waylandevents_h
|
#ifndef _SDL_waylandevents_h
|
||||||
#define _SDL_waylandevents_h
|
#define _SDL_waylandevents_h
|
||||||
|
|
|
@ -31,14 +31,17 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
#include "../../SDL_internal.h"
|
||||||
#include "../SDL_sysvideo.h"
|
#include "../SDL_sysvideo.h"
|
||||||
|
|
||||||
#include "SDL_config.h"
|
|
||||||
#include "SDL_mouse.h"
|
#include "SDL_mouse.h"
|
||||||
#include "../../events/SDL_mouse_c.h"
|
#include "../../events/SDL_mouse_c.h"
|
||||||
#include "SDL_waylandvideo.h"
|
#include "SDL_waylandvideo.h"
|
||||||
#include "SDL_waylandevents_c.h"
|
#include "SDL_waylandevents_c.h"
|
||||||
|
|
||||||
|
#include "SDL_waylanddyn.h"
|
||||||
|
#include "wayland-cursor.h"
|
||||||
|
|
||||||
#include "SDL_assert.h"
|
#include "SDL_assert.h"
|
||||||
|
|
||||||
#if SDL_VIDEO_DRIVER_WAYLAND
|
#if SDL_VIDEO_DRIVER_WAYLAND
|
||||||
|
@ -210,7 +213,7 @@ CreateCursorFromWlCursor(SDL_VideoData *d, struct wl_cursor *wlcursor)
|
||||||
data->buffer = NULL;
|
data->buffer = NULL;
|
||||||
data->surface = wl_compositor_create_surface(d->compositor);
|
data->surface = wl_compositor_create_surface(d->compositor);
|
||||||
wl_surface_attach(data->surface,
|
wl_surface_attach(data->surface,
|
||||||
wl_cursor_image_get_buffer(wlcursor->images[0]),
|
WAYLAND_wl_cursor_image_get_buffer(wlcursor->images[0]),
|
||||||
0,
|
0,
|
||||||
0);
|
0);
|
||||||
wl_surface_damage(data->surface,
|
wl_surface_damage(data->surface,
|
||||||
|
@ -236,7 +239,7 @@ Wayland_CreateDefaultCursor()
|
||||||
SDL_VideoData *data = device->driverdata;
|
SDL_VideoData *data = device->driverdata;
|
||||||
|
|
||||||
return CreateCursorFromWlCursor (data,
|
return CreateCursorFromWlCursor (data,
|
||||||
wl_cursor_theme_get_cursor(data->cursor_theme,
|
WAYLAND_wl_cursor_theme_get_cursor(data->cursor_theme,
|
||||||
"left_ptr"));
|
"left_ptr"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,40 +257,40 @@ Wayland_CreateSystemCursor(SDL_SystemCursor id)
|
||||||
SDL_assert(0);
|
SDL_assert(0);
|
||||||
return NULL;
|
return NULL;
|
||||||
case SDL_SYSTEM_CURSOR_ARROW:
|
case SDL_SYSTEM_CURSOR_ARROW:
|
||||||
cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "left_ptr");
|
cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "left_ptr");
|
||||||
break;
|
break;
|
||||||
case SDL_SYSTEM_CURSOR_IBEAM:
|
case SDL_SYSTEM_CURSOR_IBEAM:
|
||||||
cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "xterm");
|
cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "xterm");
|
||||||
break;
|
break;
|
||||||
case SDL_SYSTEM_CURSOR_WAIT:
|
case SDL_SYSTEM_CURSOR_WAIT:
|
||||||
cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "wait");
|
cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "wait");
|
||||||
break;
|
break;
|
||||||
case SDL_SYSTEM_CURSOR_CROSSHAIR:
|
case SDL_SYSTEM_CURSOR_CROSSHAIR:
|
||||||
cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
|
cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
|
||||||
break;
|
break;
|
||||||
case SDL_SYSTEM_CURSOR_WAITARROW:
|
case SDL_SYSTEM_CURSOR_WAITARROW:
|
||||||
cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "wait");
|
cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "wait");
|
||||||
break;
|
break;
|
||||||
case SDL_SYSTEM_CURSOR_SIZENWSE:
|
case SDL_SYSTEM_CURSOR_SIZENWSE:
|
||||||
cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
|
cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
|
||||||
break;
|
break;
|
||||||
case SDL_SYSTEM_CURSOR_SIZENESW:
|
case SDL_SYSTEM_CURSOR_SIZENESW:
|
||||||
cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
|
cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
|
||||||
break;
|
break;
|
||||||
case SDL_SYSTEM_CURSOR_SIZEWE:
|
case SDL_SYSTEM_CURSOR_SIZEWE:
|
||||||
cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
|
cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
|
||||||
break;
|
break;
|
||||||
case SDL_SYSTEM_CURSOR_SIZENS:
|
case SDL_SYSTEM_CURSOR_SIZENS:
|
||||||
cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
|
cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
|
||||||
break;
|
break;
|
||||||
case SDL_SYSTEM_CURSOR_SIZEALL:
|
case SDL_SYSTEM_CURSOR_SIZEALL:
|
||||||
cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
|
cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
|
||||||
break;
|
break;
|
||||||
case SDL_SYSTEM_CURSOR_NO:
|
case SDL_SYSTEM_CURSOR_NO:
|
||||||
cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "xterm");
|
cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "xterm");
|
||||||
break;
|
break;
|
||||||
case SDL_SYSTEM_CURSOR_HAND:
|
case SDL_SYSTEM_CURSOR_HAND:
|
||||||
cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
|
cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SDL_config.h"
|
#include "../../SDL_internal.h"
|
||||||
#include "SDL_mouse.h"
|
#include "SDL_mouse.h"
|
||||||
#include "SDL_waylandvideo.h"
|
#include "SDL_waylandvideo.h"
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
misrepresented as being the original software.
|
misrepresented as being the original software.
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
*/
|
*/
|
||||||
#include "SDL_config.h"
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
#if SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL
|
#if SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
||||||
#include "SDL_waylandopengles.h"
|
#include "SDL_waylandopengles.h"
|
||||||
#include "SDL_waylandwindow.h"
|
#include "SDL_waylandwindow.h"
|
||||||
#include "SDL_waylandevents_c.h"
|
#include "SDL_waylandevents_c.h"
|
||||||
|
#include "SDL_waylanddyn.h"
|
||||||
|
|
||||||
/* EGL implementation of SDL OpenGL ES support */
|
/* EGL implementation of SDL OpenGL ES support */
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ Wayland_GLES_LoadLibrary(_THIS, const char *path) {
|
||||||
ret = SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display);
|
ret = SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display);
|
||||||
|
|
||||||
Wayland_PumpEvents(_this);
|
Wayland_PumpEvents(_this);
|
||||||
wayland_schedule_write(data);
|
WAYLAND_wl_display_flush(data->display);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +49,7 @@ Wayland_GLES_CreateContext(_THIS, SDL_Window * window)
|
||||||
{
|
{
|
||||||
SDL_GLContext context;
|
SDL_GLContext context;
|
||||||
context = SDL_EGL_CreateContext(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
|
context = SDL_EGL_CreateContext(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
|
||||||
wayland_schedule_write(_this->driverdata);
|
WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +58,7 @@ void
|
||||||
Wayland_GLES_SwapWindow(_THIS, SDL_Window *window)
|
Wayland_GLES_SwapWindow(_THIS, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
|
SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
|
||||||
wayland_schedule_write(_this->driverdata);
|
WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,7 +74,7 @@ Wayland_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
|
||||||
ret = SDL_EGL_MakeCurrent(_this, NULL, NULL);
|
ret = SDL_EGL_MakeCurrent(_this, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
wayland_schedule_write(_this->driverdata);
|
WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +83,7 @@ void
|
||||||
Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context)
|
Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context)
|
||||||
{
|
{
|
||||||
SDL_EGL_DeleteContext(_this, context);
|
SDL_EGL_DeleteContext(_this, context);
|
||||||
wayland_schedule_write(_this->driverdata);
|
WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL */
|
#endif /* SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL */
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
misrepresented as being the original software.
|
misrepresented as being the original software.
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
*/
|
*/
|
||||||
#include "SDL_config.h"
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
#ifndef _SDL_waylandopengles_h
|
#ifndef _SDL_waylandopengles_h
|
||||||
#define _SDL_waylandopengles_h
|
#define _SDL_waylandopengles_h
|
||||||
|
|
|
@ -0,0 +1,102 @@
|
||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
|
|
||||||
|
SDL_WAYLAND_MODULE(WAYLAND_CLIENT)
|
||||||
|
SDL_WAYLAND_SYM(void, wl_proxy_marshal, (struct wl_proxy *, uint32_t, ...))
|
||||||
|
SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_create, (struct wl_proxy *, const struct wl_interface *))
|
||||||
|
SDL_WAYLAND_SYM(void, wl_proxy_destroy, (struct wl_proxy *))
|
||||||
|
SDL_WAYLAND_SYM(int, wl_proxy_add_listener, (struct wl_proxy *, void (**)(void), void *))
|
||||||
|
SDL_WAYLAND_SYM(void, wl_proxy_set_user_data, (struct wl_proxy *, void *))
|
||||||
|
SDL_WAYLAND_SYM(void *, wl_proxy_get_user_data, (struct wl_proxy *))
|
||||||
|
SDL_WAYLAND_SYM(uint32_t, wl_proxy_get_id, (struct wl_proxy *))
|
||||||
|
SDL_WAYLAND_SYM(const char *, wl_proxy_get_class, (struct wl_proxy *))
|
||||||
|
SDL_WAYLAND_SYM(void, wl_proxy_set_queue, (struct wl_proxy *, struct wl_event_queue *))
|
||||||
|
SDL_WAYLAND_SYM(struct wl_display *, wl_display_connect, (const char *))
|
||||||
|
SDL_WAYLAND_SYM(struct wl_display *, wl_display_connect_to_fd, (int))
|
||||||
|
SDL_WAYLAND_SYM(void, wl_display_disconnect, (struct wl_display *))
|
||||||
|
SDL_WAYLAND_SYM(int, wl_display_get_fd, (struct wl_display *))
|
||||||
|
SDL_WAYLAND_SYM(int, wl_display_dispatch, (struct wl_display *))
|
||||||
|
SDL_WAYLAND_SYM(int, wl_display_dispatch_queue, (struct wl_display *, struct wl_event_queue *))
|
||||||
|
SDL_WAYLAND_SYM(int, wl_display_dispatch_queue_pending, (struct wl_display *, struct wl_event_queue *))
|
||||||
|
SDL_WAYLAND_SYM(int, wl_display_dispatch_pending, (struct wl_display *))
|
||||||
|
SDL_WAYLAND_SYM(int, wl_display_get_error, (struct wl_display *))
|
||||||
|
SDL_WAYLAND_SYM(int, wl_display_flush, (struct wl_display *))
|
||||||
|
SDL_WAYLAND_SYM(int, wl_display_roundtrip, (struct wl_display *))
|
||||||
|
SDL_WAYLAND_SYM(struct wl_event_queue *, wl_display_create_queue, (struct wl_display *))
|
||||||
|
SDL_WAYLAND_SYM(void, wl_log_set_handler_client, (wl_log_func_t))
|
||||||
|
SDL_WAYLAND_SYM(void, wl_list_init, (struct wl_list *))
|
||||||
|
SDL_WAYLAND_SYM(void, wl_list_insert, (struct wl_list *, struct wl_list *) )
|
||||||
|
SDL_WAYLAND_SYM(void, wl_list_remove, (struct wl_list *))
|
||||||
|
SDL_WAYLAND_SYM(int, wl_list_length, (const struct wl_list *))
|
||||||
|
SDL_WAYLAND_SYM(int, wl_list_empty, (const struct wl_list *))
|
||||||
|
SDL_WAYLAND_SYM(void, wl_list_insert_list, (struct wl_list *, struct wl_list *))
|
||||||
|
|
||||||
|
SDL_WAYLAND_INTERFACE(wl_seat_interface)
|
||||||
|
SDL_WAYLAND_INTERFACE(wl_surface_interface)
|
||||||
|
SDL_WAYLAND_INTERFACE(wl_shm_pool_interface)
|
||||||
|
SDL_WAYLAND_INTERFACE(wl_buffer_interface)
|
||||||
|
SDL_WAYLAND_INTERFACE(wl_registry_interface)
|
||||||
|
SDL_WAYLAND_INTERFACE(wl_shell_surface_interface)
|
||||||
|
SDL_WAYLAND_INTERFACE(wl_region_interface)
|
||||||
|
SDL_WAYLAND_INTERFACE(wl_pointer_interface)
|
||||||
|
SDL_WAYLAND_INTERFACE(wl_keyboard_interface)
|
||||||
|
SDL_WAYLAND_INTERFACE(wl_compositor_interface)
|
||||||
|
SDL_WAYLAND_INTERFACE(wl_output_interface)
|
||||||
|
SDL_WAYLAND_INTERFACE(wl_shell_interface)
|
||||||
|
SDL_WAYLAND_INTERFACE(wl_shm_interface)
|
||||||
|
|
||||||
|
SDL_WAYLAND_MODULE(WAYLAND_EGL)
|
||||||
|
SDL_WAYLAND_SYM(struct wl_egl_window *, wl_egl_window_create, (struct wl_surface *, int, int))
|
||||||
|
SDL_WAYLAND_SYM(void, wl_egl_window_destroy, (struct wl_egl_window *))
|
||||||
|
SDL_WAYLAND_SYM(void, wl_egl_window_resize, (struct wl_egl_window *, int, int, int, int))
|
||||||
|
SDL_WAYLAND_SYM(void, wl_egl_window_get_attached_size, (struct wl_egl_window *, int *, int *))
|
||||||
|
|
||||||
|
SDL_WAYLAND_MODULE(WAYLAND_CURSOR)
|
||||||
|
SDL_WAYLAND_SYM(struct wl_cursor_theme *, wl_cursor_theme_load, (const char *, int , struct wl_shm *))
|
||||||
|
SDL_WAYLAND_SYM(void, wl_cursor_theme_destroy, (struct wl_cursor_theme *))
|
||||||
|
SDL_WAYLAND_SYM(struct wl_cursor *, wl_cursor_theme_get_cursor, (struct wl_cursor_theme *, const char *))
|
||||||
|
SDL_WAYLAND_SYM(struct wl_buffer *, wl_cursor_image_get_buffer, (struct wl_cursor_image *))
|
||||||
|
SDL_WAYLAND_SYM(int, wl_cursor_frame, (struct wl_cursor *, uint32_t))
|
||||||
|
|
||||||
|
SDL_WAYLAND_MODULE(WAYLAND_XKB)
|
||||||
|
SDL_WAYLAND_SYM(int, xkb_state_key_get_syms, (struct xkb_state *, xkb_keycode_t, const xkb_keysym_t **))
|
||||||
|
SDL_WAYLAND_SYM(int, xkb_keysym_to_utf8, (xkb_keysym_t, char *, size_t) )
|
||||||
|
SDL_WAYLAND_SYM(struct xkb_keymap *, xkb_keymap_new_from_string, (struct xkb_context *, const char *, enum xkb_keymap_format, enum xkb_keymap_compile_flags))
|
||||||
|
SDL_WAYLAND_SYM(struct xkb_state *, xkb_state_new, (struct xkb_keymap *) )
|
||||||
|
SDL_WAYLAND_SYM(void, xkb_keymap_unref, (struct xkb_keymap *) )
|
||||||
|
SDL_WAYLAND_SYM(void, xkb_state_unref, (struct xkb_state *) )
|
||||||
|
SDL_WAYLAND_SYM(void, xkb_context_unref, (struct xkb_context *) )
|
||||||
|
SDL_WAYLAND_SYM(struct xkb_context *, xkb_context_new, (enum xkb_context_flags flags) )
|
||||||
|
SDL_WAYLAND_SYM(enum xkb_state_component, xkb_state_update_mask, (struct xkb_state *state,\
|
||||||
|
xkb_mod_mask_t depressed_mods,\
|
||||||
|
xkb_mod_mask_t latched_mods,\
|
||||||
|
xkb_mod_mask_t locked_mods,\
|
||||||
|
xkb_layout_index_t depressed_layout,\
|
||||||
|
xkb_layout_index_t latched_layout,\
|
||||||
|
xkb_layout_index_t locked_layout) )
|
||||||
|
|
||||||
|
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
//SDL_WAYLAND_SYM(ret, fn, params)
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
/* Contributed by Thomas Perl <thomas.perl@jollamobile.com> */
|
/* Contributed by Thomas Perl <thomas.perl@jollamobile.com> */
|
||||||
|
|
||||||
#include "SDL_config.h"
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
|
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
|
||||||
|
|
||||||
|
@ -118,6 +118,7 @@ touch_handle_configure(void *data,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* wayland-qt-touch-extension.c BEGINS */
|
/* wayland-qt-touch-extension.c BEGINS */
|
||||||
|
|
||||||
static const struct qt_touch_extension_listener touch_listener = {
|
static const struct qt_touch_extension_listener touch_listener = {
|
||||||
|
@ -183,13 +184,23 @@ WL_EXPORT const struct wl_interface qt_windowmanager_interface = {
|
||||||
|
|
||||||
/* wayland-qt-surface-extension.c BEGINS */
|
/* wayland-qt-surface-extension.c BEGINS */
|
||||||
extern const struct wl_interface qt_extended_surface_interface;
|
extern const struct wl_interface qt_extended_surface_interface;
|
||||||
|
#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
|
||||||
extern const struct wl_interface wl_surface_interface;
|
extern const struct wl_interface wl_surface_interface;
|
||||||
|
#endif
|
||||||
|
|
||||||
static const struct wl_interface *qt_surface_extension_types[] = {
|
static const struct wl_interface *qt_surface_extension_types[] = {
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
&qt_extended_surface_interface,
|
&qt_extended_surface_interface,
|
||||||
|
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
|
||||||
|
/* FIXME: Set this dynamically to (*WAYLAND_wl_surface_interface) ?
|
||||||
|
* The value comes from auto generated code and does
|
||||||
|
* not appear to actually be used anywhere
|
||||||
|
*/
|
||||||
|
NULL,
|
||||||
|
#else
|
||||||
&wl_surface_interface,
|
&wl_surface_interface,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct wl_message qt_surface_extension_requests[] = {
|
static const struct wl_message qt_surface_extension_requests[] = {
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SDL_config.h"
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
|
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
|
||||||
|
|
||||||
|
@ -29,8 +29,9 @@
|
||||||
#include "SDL_waylandvideo.h"
|
#include "SDL_waylandvideo.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include "wayland-client.h"
|
|
||||||
#include "wayland-util.h"
|
#include "wayland-util.h"
|
||||||
|
#include "SDL_waylanddyn.h"
|
||||||
|
|
||||||
|
|
||||||
void Wayland_touch_create(SDL_VideoData *data, uint32_t id);
|
void Wayland_touch_create(SDL_VideoData *data, uint32_t id);
|
||||||
void Wayland_touch_destroy(SDL_VideoData *data);
|
void Wayland_touch_destroy(SDL_VideoData *data);
|
||||||
|
@ -89,7 +90,7 @@ qt_surface_extension_get_user_data(struct qt_surface_extension *qt_surface_exten
|
||||||
static inline void
|
static inline void
|
||||||
qt_surface_extension_destroy(struct qt_surface_extension *qt_surface_extension)
|
qt_surface_extension_destroy(struct qt_surface_extension *qt_surface_extension)
|
||||||
{
|
{
|
||||||
wl_proxy_destroy((struct wl_proxy *) qt_surface_extension);
|
WAYLAND_wl_proxy_destroy((struct wl_proxy *) qt_surface_extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct qt_extended_surface *
|
static inline struct qt_extended_surface *
|
||||||
|
@ -102,7 +103,7 @@ qt_surface_extension_get_extended_surface(struct qt_surface_extension *qt_surfac
|
||||||
if (!id)
|
if (!id)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
wl_proxy_marshal((struct wl_proxy *) qt_surface_extension,
|
WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_surface_extension,
|
||||||
QT_SURFACE_EXTENSION_GET_EXTENDED_SURFACE, id, surface);
|
QT_SURFACE_EXTENSION_GET_EXTENDED_SURFACE, id, surface);
|
||||||
|
|
||||||
return (struct qt_extended_surface *) id;
|
return (struct qt_extended_surface *) id;
|
||||||
|
@ -166,39 +167,39 @@ qt_extended_surface_add_listener(struct qt_extended_surface *qt_extended_surface
|
||||||
static inline void
|
static inline void
|
||||||
qt_extended_surface_set_user_data(struct qt_extended_surface *qt_extended_surface, void *user_data)
|
qt_extended_surface_set_user_data(struct qt_extended_surface *qt_extended_surface, void *user_data)
|
||||||
{
|
{
|
||||||
wl_proxy_set_user_data((struct wl_proxy *) qt_extended_surface, user_data);
|
WAYLAND_wl_proxy_set_user_data((struct wl_proxy *) qt_extended_surface, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void *
|
static inline void *
|
||||||
qt_extended_surface_get_user_data(struct qt_extended_surface *qt_extended_surface)
|
qt_extended_surface_get_user_data(struct qt_extended_surface *qt_extended_surface)
|
||||||
{
|
{
|
||||||
return wl_proxy_get_user_data((struct wl_proxy *) qt_extended_surface);
|
return WAYLAND_wl_proxy_get_user_data((struct wl_proxy *) qt_extended_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
qt_extended_surface_destroy(struct qt_extended_surface *qt_extended_surface)
|
qt_extended_surface_destroy(struct qt_extended_surface *qt_extended_surface)
|
||||||
{
|
{
|
||||||
wl_proxy_destroy((struct wl_proxy *) qt_extended_surface);
|
WAYLAND_wl_proxy_destroy((struct wl_proxy *) qt_extended_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
qt_extended_surface_update_generic_property(struct qt_extended_surface *qt_extended_surface, const char *name, struct wl_array *value)
|
qt_extended_surface_update_generic_property(struct qt_extended_surface *qt_extended_surface, const char *name, struct wl_array *value)
|
||||||
{
|
{
|
||||||
wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
|
WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
|
||||||
QT_EXTENDED_SURFACE_UPDATE_GENERIC_PROPERTY, name, value);
|
QT_EXTENDED_SURFACE_UPDATE_GENERIC_PROPERTY, name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
qt_extended_surface_set_content_orientation(struct qt_extended_surface *qt_extended_surface, int32_t orientation)
|
qt_extended_surface_set_content_orientation(struct qt_extended_surface *qt_extended_surface, int32_t orientation)
|
||||||
{
|
{
|
||||||
wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
|
WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
|
||||||
QT_EXTENDED_SURFACE_SET_CONTENT_ORIENTATION, orientation);
|
QT_EXTENDED_SURFACE_SET_CONTENT_ORIENTATION, orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
qt_extended_surface_set_window_flags(struct qt_extended_surface *qt_extended_surface, int32_t flags)
|
qt_extended_surface_set_window_flags(struct qt_extended_surface *qt_extended_surface, int32_t flags)
|
||||||
{
|
{
|
||||||
wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
|
WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
|
||||||
QT_EXTENDED_SURFACE_SET_WINDOW_FLAGS, flags);
|
QT_EXTENDED_SURFACE_SET_WINDOW_FLAGS, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,25 +270,25 @@ qt_touch_extension_add_listener(struct qt_touch_extension *qt_touch_extension,
|
||||||
static inline void
|
static inline void
|
||||||
qt_touch_extension_set_user_data(struct qt_touch_extension *qt_touch_extension, void *user_data)
|
qt_touch_extension_set_user_data(struct qt_touch_extension *qt_touch_extension, void *user_data)
|
||||||
{
|
{
|
||||||
wl_proxy_set_user_data((struct wl_proxy *) qt_touch_extension, user_data);
|
WAYLAND_wl_proxy_set_user_data((struct wl_proxy *) qt_touch_extension, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void *
|
static inline void *
|
||||||
qt_touch_extension_get_user_data(struct qt_touch_extension *qt_touch_extension)
|
qt_touch_extension_get_user_data(struct qt_touch_extension *qt_touch_extension)
|
||||||
{
|
{
|
||||||
return wl_proxy_get_user_data((struct wl_proxy *) qt_touch_extension);
|
return WAYLAND_wl_proxy_get_user_data((struct wl_proxy *) qt_touch_extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
qt_touch_extension_destroy(struct qt_touch_extension *qt_touch_extension)
|
qt_touch_extension_destroy(struct qt_touch_extension *qt_touch_extension)
|
||||||
{
|
{
|
||||||
wl_proxy_destroy((struct wl_proxy *) qt_touch_extension);
|
WAYLAND_wl_proxy_destroy((struct wl_proxy *) qt_touch_extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
qt_touch_extension_dummy(struct qt_touch_extension *qt_touch_extension)
|
qt_touch_extension_dummy(struct qt_touch_extension *qt_touch_extension)
|
||||||
{
|
{
|
||||||
wl_proxy_marshal((struct wl_proxy *) qt_touch_extension,
|
WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_touch_extension,
|
||||||
QT_TOUCH_EXTENSION_DUMMY);
|
QT_TOUCH_EXTENSION_DUMMY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,25 +325,25 @@ qt_windowmanager_add_listener(struct qt_windowmanager *qt_windowmanager,
|
||||||
static inline void
|
static inline void
|
||||||
qt_windowmanager_set_user_data(struct qt_windowmanager *qt_windowmanager, void *user_data)
|
qt_windowmanager_set_user_data(struct qt_windowmanager *qt_windowmanager, void *user_data)
|
||||||
{
|
{
|
||||||
wl_proxy_set_user_data((struct wl_proxy *) qt_windowmanager, user_data);
|
WAYLAND_wl_proxy_set_user_data((struct wl_proxy *) qt_windowmanager, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void *
|
static inline void *
|
||||||
qt_windowmanager_get_user_data(struct qt_windowmanager *qt_windowmanager)
|
qt_windowmanager_get_user_data(struct qt_windowmanager *qt_windowmanager)
|
||||||
{
|
{
|
||||||
return wl_proxy_get_user_data((struct wl_proxy *) qt_windowmanager);
|
return WAYLAND_wl_proxy_get_user_data((struct wl_proxy *) qt_windowmanager);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
qt_windowmanager_destroy(struct qt_windowmanager *qt_windowmanager)
|
qt_windowmanager_destroy(struct qt_windowmanager *qt_windowmanager)
|
||||||
{
|
{
|
||||||
wl_proxy_destroy((struct wl_proxy *) qt_windowmanager);
|
WAYLAND_wl_proxy_destroy((struct wl_proxy *) qt_windowmanager);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
qt_windowmanager_open_url(struct qt_windowmanager *qt_windowmanager, uint32_t remaining, const char *url)
|
qt_windowmanager_open_url(struct qt_windowmanager *qt_windowmanager, uint32_t remaining, const char *url)
|
||||||
{
|
{
|
||||||
wl_proxy_marshal((struct wl_proxy *) qt_windowmanager,
|
WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_windowmanager,
|
||||||
QT_WINDOWMANAGER_OPEN_URL, remaining, url);
|
QT_WINDOWMANAGER_OPEN_URL, remaining, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,11 @@
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SDL_config.h"
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
#include "SDL_video.h"
|
#include "SDL_video.h"
|
||||||
#include "SDL_mouse.h"
|
#include "SDL_mouse.h"
|
||||||
|
#include "SDL_stdinc.h"
|
||||||
#include "../../events/SDL_events_c.h"
|
#include "../../events/SDL_events_c.h"
|
||||||
|
|
||||||
#include "SDL_waylandvideo.h"
|
#include "SDL_waylandvideo.h"
|
||||||
|
@ -35,6 +36,9 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
|
|
||||||
|
#include "SDL_waylanddyn.h"
|
||||||
|
#include <wayland-util.h>
|
||||||
|
|
||||||
#define WAYLANDVID_DRIVER_NAME "wayland"
|
#define WAYLANDVID_DRIVER_NAME "wayland"
|
||||||
|
|
||||||
struct wayland_mode {
|
struct wayland_mode {
|
||||||
|
@ -59,10 +63,12 @@ static int
|
||||||
Wayland_Available(void)
|
Wayland_Available(void)
|
||||||
{
|
{
|
||||||
struct wl_display *display = NULL;
|
struct wl_display *display = NULL;
|
||||||
|
if (SDL_WAYLAND_LoadSymbols()) {
|
||||||
display = wl_display_connect(NULL);
|
display = WAYLAND_wl_display_connect(NULL);
|
||||||
if (display != NULL) {
|
if (display != NULL) {
|
||||||
wl_display_disconnect(display);
|
WAYLAND_wl_display_disconnect(display);
|
||||||
|
}
|
||||||
|
SDL_WAYLAND_UnloadSymbols();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (display != NULL);
|
return (display != NULL);
|
||||||
|
@ -72,6 +78,7 @@ static void
|
||||||
Wayland_DeleteDevice(SDL_VideoDevice *device)
|
Wayland_DeleteDevice(SDL_VideoDevice *device)
|
||||||
{
|
{
|
||||||
SDL_free(device);
|
SDL_free(device);
|
||||||
|
SDL_WAYLAND_UnloadSymbols();
|
||||||
}
|
}
|
||||||
|
|
||||||
static SDL_VideoDevice *
|
static SDL_VideoDevice *
|
||||||
|
@ -79,6 +86,10 @@ Wayland_CreateDevice(int devindex)
|
||||||
{
|
{
|
||||||
SDL_VideoDevice *device;
|
SDL_VideoDevice *device;
|
||||||
|
|
||||||
|
if (!SDL_WAYLAND_LoadSymbols()) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize all variables that we clean on shutdown */
|
/* Initialize all variables that we clean on shutdown */
|
||||||
device = SDL_calloc(1, sizeof(SDL_VideoDevice));
|
device = SDL_calloc(1, sizeof(SDL_VideoDevice));
|
||||||
if (!device) {
|
if (!device) {
|
||||||
|
@ -133,13 +144,13 @@ wayland_add_mode(SDL_VideoData *d, SDL_DisplayMode m)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Add new mode to the list */
|
/* Add new mode to the list */
|
||||||
mode = SDL_calloc(1, sizeof *mode);
|
mode = (struct wayland_mode *) SDL_calloc(1, sizeof *mode);
|
||||||
|
|
||||||
if (!mode)
|
if (!mode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mode->mode = m;
|
mode->mode = m;
|
||||||
wl_list_insert(&d->modes_list, &mode->link);
|
WAYLAND_wl_list_insert(&d->modes_list, &mode->link);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -239,8 +250,8 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id,
|
||||||
d->shell = wl_registry_bind(d->registry, id, &wl_shell_interface, 1);
|
d->shell = wl_registry_bind(d->registry, id, &wl_shell_interface, 1);
|
||||||
} else if (strcmp(interface, "wl_shm") == 0) {
|
} else if (strcmp(interface, "wl_shm") == 0) {
|
||||||
d->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
|
d->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
|
||||||
d->cursor_theme = wl_cursor_theme_load(NULL, 32, d->shm);
|
d->cursor_theme = WAYLAND_wl_cursor_theme_load(NULL, 32, d->shm);
|
||||||
d->default_cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "left_ptr");
|
d->default_cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "left_ptr");
|
||||||
wl_shm_add_listener(d->shm, &shm_listener, d);
|
wl_shm_add_listener(d->shm, &shm_listener, d);
|
||||||
|
|
||||||
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
|
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
|
||||||
|
@ -265,6 +276,9 @@ int
|
||||||
Wayland_VideoInit(_THIS)
|
Wayland_VideoInit(_THIS)
|
||||||
{
|
{
|
||||||
SDL_VideoData *data;
|
SDL_VideoData *data;
|
||||||
|
SDL_VideoDisplay display;
|
||||||
|
SDL_DisplayMode mode;
|
||||||
|
int i;
|
||||||
|
|
||||||
data = malloc(sizeof *data);
|
data = malloc(sizeof *data);
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
|
@ -273,29 +287,41 @@ Wayland_VideoInit(_THIS)
|
||||||
|
|
||||||
_this->driverdata = data;
|
_this->driverdata = data;
|
||||||
|
|
||||||
wl_list_init(&data->modes_list);
|
WAYLAND_wl_list_init(&data->modes_list);
|
||||||
|
|
||||||
data->display = wl_display_connect(NULL);
|
data->display = WAYLAND_wl_display_connect(NULL);
|
||||||
if (data->display == NULL) {
|
if (data->display == NULL) {
|
||||||
SDL_SetError("Failed to connect to a Wayland display");
|
SDL_SetError("Failed to connect to a Wayland display");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
data->registry = wl_display_get_registry(data->display);
|
data->registry = wl_display_get_registry(data->display);
|
||||||
|
|
||||||
|
if ( data->registry == NULL) {
|
||||||
|
SDL_SetError("Failed to get the Wayland registry");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
wl_registry_add_listener(data->registry, ®istry_listener, data);
|
wl_registry_add_listener(data->registry, ®istry_listener, data);
|
||||||
|
|
||||||
while (data->screen_allocation.width == 0)
|
for (i=0; i < 100; i++) {
|
||||||
wl_display_dispatch(data->display);
|
if (data->screen_allocation.width != 0 || WAYLAND_wl_display_get_error(data->display) != 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
WAYLAND_wl_display_dispatch(data->display);
|
||||||
|
}
|
||||||
|
|
||||||
data->xkb_context = xkb_context_new(0);
|
if (data->screen_allocation.width == 0) {
|
||||||
|
SDL_SetError("Failed while waiting for screen allocation: %d ", WAYLAND_wl_display_get_error(data->display));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
data->xkb_context = WAYLAND_xkb_context_new(0);
|
||||||
if (!data->xkb_context) {
|
if (!data->xkb_context) {
|
||||||
SDL_SetError("Failed to create XKB context");
|
SDL_SetError("Failed to create XKB context");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_VideoDisplay display;
|
|
||||||
SDL_DisplayMode mode;
|
|
||||||
|
|
||||||
/* Use a fake 32-bpp desktop mode */
|
/* Use a fake 32-bpp desktop mode */
|
||||||
mode.format = SDL_PIXELFORMAT_RGB888;
|
mode.format = SDL_PIXELFORMAT_RGB888;
|
||||||
mode.w = data->screen_allocation.width;
|
mode.w = data->screen_allocation.width;
|
||||||
|
@ -311,7 +337,7 @@ Wayland_VideoInit(_THIS)
|
||||||
|
|
||||||
Wayland_InitMouse ();
|
Wayland_InitMouse ();
|
||||||
|
|
||||||
wayland_schedule_write(data);
|
WAYLAND_wl_display_flush(data->display);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -363,7 +389,7 @@ Wayland_VideoQuit(_THIS)
|
||||||
Wayland_display_destroy_input(data);
|
Wayland_display_destroy_input(data);
|
||||||
|
|
||||||
if (data->xkb_context) {
|
if (data->xkb_context) {
|
||||||
xkb_context_unref(data->xkb_context);
|
WAYLAND_xkb_context_unref(data->xkb_context);
|
||||||
data->xkb_context = NULL;
|
data->xkb_context = NULL;
|
||||||
}
|
}
|
||||||
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
|
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
|
||||||
|
@ -380,7 +406,7 @@ Wayland_VideoQuit(_THIS)
|
||||||
wl_shm_destroy(data->shm);
|
wl_shm_destroy(data->shm);
|
||||||
|
|
||||||
if (data->cursor_theme)
|
if (data->cursor_theme)
|
||||||
wl_cursor_theme_destroy(data->cursor_theme);
|
WAYLAND_wl_cursor_theme_destroy(data->cursor_theme);
|
||||||
|
|
||||||
if (data->shell)
|
if (data->shell)
|
||||||
wl_shell_destroy(data->shell);
|
wl_shell_destroy(data->shell);
|
||||||
|
@ -389,12 +415,12 @@ Wayland_VideoQuit(_THIS)
|
||||||
wl_compositor_destroy(data->compositor);
|
wl_compositor_destroy(data->compositor);
|
||||||
|
|
||||||
if (data->display) {
|
if (data->display) {
|
||||||
wl_display_flush(data->display);
|
WAYLAND_wl_display_flush(data->display);
|
||||||
wl_display_disconnect(data->display);
|
WAYLAND_wl_display_disconnect(data->display);
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_for_each_safe(m, t, &data->modes_list, link) {
|
wl_list_for_each_safe(m, t, &data->modes_list, link) {
|
||||||
wl_list_remove(&m->link);
|
WAYLAND_wl_list_remove(&m->link);
|
||||||
free(m);
|
free(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,16 +19,13 @@
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SDL_config.h"
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
#ifndef _SDL_waylandvideo_h
|
#ifndef _SDL_waylandvideo_h
|
||||||
#define _SDL_waylandvideo_h
|
#define _SDL_waylandvideo_h
|
||||||
|
|
||||||
#include <wayland-client.h>
|
|
||||||
#include <wayland-cursor.h>
|
|
||||||
#include <wayland-egl.h>
|
|
||||||
|
|
||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
|
#include "wayland-util.h"
|
||||||
|
|
||||||
struct xkb_context;
|
struct xkb_context;
|
||||||
struct SDL_WaylandInput;
|
struct SDL_WaylandInput;
|
||||||
|
@ -72,12 +69,6 @@ typedef struct {
|
||||||
uint32_t shm_formats;
|
uint32_t shm_formats;
|
||||||
} SDL_VideoData;
|
} SDL_VideoData;
|
||||||
|
|
||||||
static inline void
|
|
||||||
wayland_schedule_write(SDL_VideoData *data)
|
|
||||||
{
|
|
||||||
wl_display_flush(data->display);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _SDL_nullvideo_h */
|
#endif /* _SDL_nullvideo_h */
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SDL_config.h"
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
#include "../SDL_sysvideo.h"
|
#include "../SDL_sysvideo.h"
|
||||||
#include "../../events/SDL_windowevents_c.h"
|
#include "../../events/SDL_windowevents_c.h"
|
||||||
|
@ -104,7 +104,7 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window)
|
||||||
else
|
else
|
||||||
wl_shell_surface_set_toplevel(wind->shell_surface);
|
wl_shell_surface_set_toplevel(wind->shell_surface);
|
||||||
|
|
||||||
wayland_schedule_write(_this->driverdata);
|
WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -120,7 +120,7 @@ Wayland_SetWindowFullscreen(_THIS, SDL_Window * window,
|
||||||
else
|
else
|
||||||
wl_shell_surface_set_toplevel(wind->shell_surface);
|
wl_shell_surface_set_toplevel(wind->shell_surface);
|
||||||
|
|
||||||
wayland_schedule_write(_this->driverdata);
|
WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
|
||||||
}
|
}
|
||||||
|
|
||||||
int Wayland_CreateWindow(_THIS, SDL_Window *window)
|
int Wayland_CreateWindow(_THIS, SDL_Window *window)
|
||||||
|
@ -162,7 +162,7 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window)
|
||||||
c->surface_extension, data->surface);
|
c->surface_extension, data->surface);
|
||||||
}
|
}
|
||||||
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
|
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
|
||||||
data->egl_window = wl_egl_window_create(data->surface,
|
data->egl_window = WAYLAND_wl_egl_window_create(data->surface,
|
||||||
window->w, window->h);
|
window->w, window->h);
|
||||||
|
|
||||||
/* Create the GLES window surface */
|
/* Create the GLES window surface */
|
||||||
|
@ -192,7 +192,7 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window)
|
||||||
wl_surface_set_opaque_region(data->surface, region);
|
wl_surface_set_opaque_region(data->surface, region);
|
||||||
wl_region_destroy(region);
|
wl_region_destroy(region);
|
||||||
|
|
||||||
wayland_schedule_write(c);
|
WAYLAND_wl_display_flush(c->display);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -203,9 +203,9 @@ void Wayland_SetWindowSize(_THIS, SDL_Window * window)
|
||||||
SDL_WindowData *wind = window->driverdata;
|
SDL_WindowData *wind = window->driverdata;
|
||||||
struct wl_region *region;
|
struct wl_region *region;
|
||||||
|
|
||||||
wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0);
|
WAYLAND_wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0);
|
||||||
|
|
||||||
region = wl_compositor_create_region(data->compositor);
|
region =wl_compositor_create_region(data->compositor);
|
||||||
wl_region_add(region, 0, 0, window->w, window->h);
|
wl_region_add(region, 0, 0, window->w, window->h);
|
||||||
wl_surface_set_opaque_region(wind->surface, region);
|
wl_surface_set_opaque_region(wind->surface, region);
|
||||||
wl_region_destroy(region);
|
wl_region_destroy(region);
|
||||||
|
@ -220,7 +220,7 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window)
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
SDL_EGL_DestroySurface(_this, wind->egl_surface);
|
SDL_EGL_DestroySurface(_this, wind->egl_surface);
|
||||||
wl_egl_window_destroy(wind->egl_window);
|
WAYLAND_wl_egl_window_destroy(wind->egl_window);
|
||||||
|
|
||||||
if (wind->shell_surface)
|
if (wind->shell_surface)
|
||||||
wl_shell_surface_destroy(wind->shell_surface);
|
wl_shell_surface_destroy(wind->shell_surface);
|
||||||
|
@ -232,7 +232,7 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window)
|
||||||
wl_surface_destroy(wind->surface);
|
wl_surface_destroy(wind->surface);
|
||||||
|
|
||||||
SDL_free(wind);
|
SDL_free(wind);
|
||||||
wayland_schedule_write(data);
|
WAYLAND_wl_display_flush(data->display);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SDL_config.h"
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
#ifndef _SDL_waylandwindow_h
|
#ifndef _SDL_waylandwindow_h
|
||||||
#define _SDL_waylandwindow_h
|
#define _SDL_waylandwindow_h
|
||||||
|
|
Loading…
Reference in New Issue