Basic and buggy Android activity backend

This commit is contained in:
Twaik Yont 2019-06-30 05:01:25 +03:00
parent 3c5fee04da
commit 19e068945e
67 changed files with 7673 additions and 126 deletions

19
WTermux.iml Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="WTermux" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
<option name="BUILDABLE" value="false" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,40 @@
{
"buildFiles": [
"/home/twaik/WTermux/app/src/main/jni/Android.mk"
],
"cleanCommands": [
"/opt/AndroidSdk/ndk-bundle/ndk-build NDK_PROJECT_PATH\u003dnull APP_BUILD_SCRIPT\u003d/home/twaik/WTermux/app/src/main/jni/Android.mk APP_ABI\u003darmeabi-v7a NDK_ALL_ABIS\u003darmeabi-v7a NDK_DEBUG\u003d1 APP_PLATFORM\u003dandroid-19 NDK_OUT\u003d/home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT\u003d/home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib clean"
],
"libraries": {
"lorie-debug-armeabi-v7a": {
"buildCommand": "/opt/AndroidSdk/ndk-bundle/ndk-build NDK_PROJECT_PATH\u003dnull APP_BUILD_SCRIPT\u003d/home/twaik/WTermux/app/src/main/jni/Android.mk APP_ABI\u003darmeabi-v7a NDK_ALL_ABIS\u003darmeabi-v7a NDK_DEBUG\u003d1 APP_PLATFORM\u003dandroid-19 NDK_OUT\u003d/home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT\u003d/home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/liblorie.so",
"toolchain": "toolchain-armeabi-v7a",
"abi": "armeabi-v7a",
"artifactName": "lorie",
"files": [
{
"src": "/home/twaik/WTermux/app/src/main/jni/lorie/backend-android.c",
"flags": "-target armv7-none-linux-androideabi19 -fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes --sysroot /opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot -g -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -fno-addrsig -fpic -march\u003darmv7-a -mthumb -O0 -UNDEBUG -fno-limit-debug-info -I/home/twaik/WTermux/app/src/main/jni/prebuilt/include -I/home/twaik/WTermux/app/src/main/jni/lorie -DANDROID -Wa,--noexecstack -Wformat -Werror\u003dformat-security"
},
{
"src": "/home/twaik/WTermux/app/src/main/jni/lorie/main.c",
"flags": "-target armv7-none-linux-androideabi19 -fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes --sysroot /opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot -g -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -fno-addrsig -fpic -march\u003darmv7-a -mthumb -O0 -UNDEBUG -fno-limit-debug-info -I/home/twaik/WTermux/app/src/main/jni/prebuilt/include -I/home/twaik/WTermux/app/src/main/jni/lorie -DANDROID -Wa,--noexecstack -Wformat -Werror\u003dformat-security"
},
{
"src": "/home/twaik/WTermux/app/src/main/jni/lorie/renderer.c",
"flags": "-target armv7-none-linux-androideabi19 -fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes --sysroot /opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot -g -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -fno-addrsig -fpic -march\u003darmv7-a -mthumb -O0 -UNDEBUG -fno-limit-debug-info -I/home/twaik/WTermux/app/src/main/jni/prebuilt/include -I/home/twaik/WTermux/app/src/main/jni/lorie -DANDROID -Wa,--noexecstack -Wformat -Werror\u003dformat-security"
}
],
"output": "/home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/liblorie.so"
}
},
"toolchains": {
"toolchain-armeabi-v7a": {
"cCompilerExecutable": "/opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang"
}
},
"cFileExtensions": [
"c"
],
"cppFileExtensions": []
}

View File

@ -0,0 +1,13 @@
Executable : /opt/AndroidSdk/ndk-bundle/ndk-build
arguments :
NDK_PROJECT_PATH=null
APP_BUILD_SCRIPT=/home/twaik/WTermux/app/src/main/jni/Android.mk
APP_ABI=armeabi-v7a
NDK_ALL_ABIS=armeabi-v7a
NDK_DEBUG=1
APP_PLATFORM=android-19
NDK_OUT=/home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj
NDK_LIBS_OUT=/home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib
/home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/liblorie.so
jvmArgs :

View File

@ -0,0 +1 @@
make: `/home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/liblorie.so' is up to date.

View File

@ -0,0 +1,16 @@
{
"buildFiles": [
"/home/twaik/WTermux/app/src/main/jni/Android.mk"
],
"cleanCommands": [
"/opt/AndroidSdk/ndk-bundle/ndk-build NDK_PROJECT_PATH\u003dnull APP_BUILD_SCRIPT\u003d/home/twaik/WTermux/app/src/main/jni/Android.mk APP_ABI\u003darmeabi-v7a NDK_ALL_ABIS\u003darmeabi-v7a NDK_DEBUG\u003d1 APP_PLATFORM\u003dandroid-19 NDK_OUT\u003d/home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT\u003d/home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib clean"
],
"libraries": {
"lorie-debug-armeabi-v7a": {
"artifactName": "lorie",
"buildCommand": "/opt/AndroidSdk/ndk-bundle/ndk-build NDK_PROJECT_PATH\u003dnull APP_BUILD_SCRIPT\u003d/home/twaik/WTermux/app/src/main/jni/Android.mk APP_ABI\u003darmeabi-v7a NDK_ALL_ABIS\u003darmeabi-v7a NDK_DEBUG\u003d1 APP_PLATFORM\u003dandroid-19 NDK_OUT\u003d/home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT\u003d/home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/liblorie.so",
"abi": "armeabi-v7a",
"output": "/home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/liblorie.so"
}
}
}

View File

@ -0,0 +1,16 @@
Executable : /opt/AndroidSdk/ndk-bundle/ndk-build
arguments :
NDK_PROJECT_PATH=null
APP_BUILD_SCRIPT=/home/twaik/WTermux/app/src/main/jni/Android.mk
APP_ABI=armeabi-v7a
NDK_ALL_ABIS=armeabi-v7a
NDK_DEBUG=1
APP_PLATFORM=android-19
NDK_OUT=/home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj
NDK_LIBS_OUT=/home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib
APP_SHORT_COMMANDS=false
LOCAL_SHORT_COMMANDS=false
-B
-n
jvmArgs :

View File

@ -0,0 +1,40 @@
rm -f /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/*
rm -f /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/gdbserver
rm -f /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/gdb.setup
mkdir -p /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a
echo [armeabi-v7a] "Gdbserver ": "[arm-linux-androideabi] /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/gdbserver"
install -p /opt/AndroidSdk/ndk-bundle/prebuilt/android-arm/gdbserver/gdbserver /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/gdbserver
echo [armeabi-v7a] "Gdbsetup ": "/home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/gdb.setup"
echo "set solib-search-path /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a" > /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/gdb.setup
echo "directory /opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot /home/twaik/WTermux/app/src/main/jni/prebuilt /home/twaik/WTermux/app/src/main/jni/prebuilt/include /home/twaik/WTermux/app/src/main/jni/lorie /opt/AndroidSdk/ndk-bundle/sources/cxx-stl/system" >> /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/gdb.setup
mkdir -p /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a
echo [armeabi-v7a] "Prebuilt ": "libandroid-support.so <= /home/twaik/WTermux/app/src/main/jni/prebuilt/armeabi-v7a/"
cp -f /home/twaik/WTermux/app/src/main/jni/prebuilt/armeabi-v7a/libandroid-support.so /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/libandroid-support.so
echo [armeabi-v7a] "Install ": "libandroid-support.so => /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/libandroid-support.so"
install -p /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/libandroid-support.so /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/libandroid-support.so
/opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip --strip-unneeded /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/libandroid-support.so
echo [armeabi-v7a] "Prebuilt ": "libffi.so <= /home/twaik/WTermux/app/src/main/jni/prebuilt/armeabi-v7a/"
cp -f /home/twaik/WTermux/app/src/main/jni/prebuilt/armeabi-v7a/libffi.so /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/libffi.so
echo [armeabi-v7a] "Install ": "libffi.so => /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/libffi.so"
install -p /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/libffi.so /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/libffi.so
/opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip --strip-unneeded /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/libffi.so
mkdir -p /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/lorie
echo [armeabi-v7a] "Compile thumb ": "lorie <= main.c"
rm -f /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/lorie/main.o
/opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -MMD -MP -MF /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/lorie/main.o.d -target armv7-none-linux-androideabi19 -fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes --sysroot /opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot -g -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -fno-addrsig -fpic -march=armv7-a -mthumb -O0 -UNDEBUG -fno-limit-debug-info -I/home/twaik/WTermux/app/src/main/jni/prebuilt/include -I/home/twaik/WTermux/app/src/main/jni/lorie -DANDROID -Wa,--noexecstack -Wformat -Werror=format-security -c /home/twaik/WTermux/app/src/main/jni/lorie/main.c -o /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/lorie/main.o
echo [armeabi-v7a] "Compile thumb ": "lorie <= backend-android.c"
rm -f /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/lorie/backend-android.o
/opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -MMD -MP -MF /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/lorie/backend-android.o.d -target armv7-none-linux-androideabi19 -fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes --sysroot /opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot -g -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -fno-addrsig -fpic -march=armv7-a -mthumb -O0 -UNDEBUG -fno-limit-debug-info -I/home/twaik/WTermux/app/src/main/jni/prebuilt/include -I/home/twaik/WTermux/app/src/main/jni/lorie -DANDROID -Wa,--noexecstack -Wformat -Werror=format-security -c /home/twaik/WTermux/app/src/main/jni/lorie/backend-android.c -o /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/lorie/backend-android.o
echo [armeabi-v7a] "Compile thumb ": "lorie <= renderer.c"
rm -f /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/lorie/renderer.o
/opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -MMD -MP -MF /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/lorie/renderer.o.d -target armv7-none-linux-androideabi19 -fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes --sysroot /opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot -g -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -fno-addrsig -fpic -march=armv7-a -mthumb -O0 -UNDEBUG -fno-limit-debug-info -I/home/twaik/WTermux/app/src/main/jni/prebuilt/include -I/home/twaik/WTermux/app/src/main/jni/lorie -DANDROID -Wa,--noexecstack -Wformat -Werror=format-security -c /home/twaik/WTermux/app/src/main/jni/lorie/renderer.c -o /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/lorie/renderer.o
echo [armeabi-v7a] "Prebuilt ": "libwayland-server.so <= /home/twaik/WTermux/app/src/main/jni/prebuilt/armeabi-v7a/"
cp -f /home/twaik/WTermux/app/src/main/jni/prebuilt/armeabi-v7a/libwayland-server.so /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/libwayland-server.so
echo [armeabi-v7a] "SharedLibrary ": "liblorie.so"
/opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -Wl,-soname,liblorie.so -shared /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/lorie/main.o /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/lorie/backend-android.o /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/lorie/renderer.o -lgcc -Wl,--exclude-libs,libgcc.a -latomic -Wl,--exclude-libs,libatomic.a /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/libwayland-server.so -target armv7-none-linux-androideabi19 -no-canonical-prefixes -Wl,--build-id -stdlib=libstdc++ -Wl,--no-undefined -Wl,-z,noexecstack -Wl,--warn-shared-textrel -Wl,--fatal-warnings -lEGL -lGLESv2 -llog -lc -lm -o /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/liblorie.so
echo [armeabi-v7a] "Install ": "liblorie.so => /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/liblorie.so"
install -p /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/liblorie.so /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/liblorie.so
/opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip --strip-unneeded /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/liblorie.so
echo [armeabi-v7a] "Install ": "libwayland-server.so => /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/libwayland-server.so"
install -p /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/libwayland-server.so /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/libwayland-server.so
/opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip --strip-unneeded /home/twaik/WTermux/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/libwayland-server.so

View File

@ -0,0 +1,40 @@
{
"buildFiles": [
"/home/twaik/WTermux/app/src/main/jni/Android.mk"
],
"cleanCommands": [
"/opt/AndroidSdk/ndk-bundle/ndk-build NDK_PROJECT_PATH\u003dnull APP_BUILD_SCRIPT\u003d/home/twaik/WTermux/app/src/main/jni/Android.mk APP_ABI\u003darmeabi-v7a NDK_ALL_ABIS\u003darmeabi-v7a NDK_DEBUG\u003d0 APP_PLATFORM\u003dandroid-19 NDK_OUT\u003d/home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT\u003d/home/twaik/WTermux/app/build/intermediates/ndkBuild/release/lib clean"
],
"libraries": {
"lorie-release-armeabi-v7a": {
"buildCommand": "/opt/AndroidSdk/ndk-bundle/ndk-build NDK_PROJECT_PATH\u003dnull APP_BUILD_SCRIPT\u003d/home/twaik/WTermux/app/src/main/jni/Android.mk APP_ABI\u003darmeabi-v7a NDK_ALL_ABIS\u003darmeabi-v7a NDK_DEBUG\u003d0 APP_PLATFORM\u003dandroid-19 NDK_OUT\u003d/home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT\u003d/home/twaik/WTermux/app/build/intermediates/ndkBuild/release/lib /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/liblorie.so",
"toolchain": "toolchain-armeabi-v7a",
"abi": "armeabi-v7a",
"artifactName": "lorie",
"files": [
{
"src": "/home/twaik/WTermux/app/src/main/jni/lorie/backend-android.c",
"flags": "-target armv7-none-linux-androideabi19 -fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes --sysroot /opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot -g -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -fno-addrsig -fpic -march\u003darmv7-a -mthumb -Oz -DNDEBUG -I/home/twaik/WTermux/app/src/main/jni/prebuilt/include -I/home/twaik/WTermux/app/src/main/jni/lorie -DANDROID -Wa,--noexecstack -Wformat -Werror\u003dformat-security"
},
{
"src": "/home/twaik/WTermux/app/src/main/jni/lorie/main.c",
"flags": "-target armv7-none-linux-androideabi19 -fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes --sysroot /opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot -g -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -fno-addrsig -fpic -march\u003darmv7-a -mthumb -Oz -DNDEBUG -I/home/twaik/WTermux/app/src/main/jni/prebuilt/include -I/home/twaik/WTermux/app/src/main/jni/lorie -DANDROID -Wa,--noexecstack -Wformat -Werror\u003dformat-security"
},
{
"src": "/home/twaik/WTermux/app/src/main/jni/lorie/renderer.c",
"flags": "-target armv7-none-linux-androideabi19 -fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes --sysroot /opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot -g -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -fno-addrsig -fpic -march\u003darmv7-a -mthumb -Oz -DNDEBUG -I/home/twaik/WTermux/app/src/main/jni/prebuilt/include -I/home/twaik/WTermux/app/src/main/jni/lorie -DANDROID -Wa,--noexecstack -Wformat -Werror\u003dformat-security"
}
],
"output": "/home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/liblorie.so"
}
},
"toolchains": {
"toolchain-armeabi-v7a": {
"cCompilerExecutable": "/opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang"
}
},
"cFileExtensions": [
"c"
],
"cppFileExtensions": []
}

View File

@ -0,0 +1,16 @@
{
"buildFiles": [
"/home/twaik/WTermux/app/src/main/jni/Android.mk"
],
"cleanCommands": [
"/opt/AndroidSdk/ndk-bundle/ndk-build NDK_PROJECT_PATH\u003dnull APP_BUILD_SCRIPT\u003d/home/twaik/WTermux/app/src/main/jni/Android.mk APP_ABI\u003darmeabi-v7a NDK_ALL_ABIS\u003darmeabi-v7a NDK_DEBUG\u003d0 APP_PLATFORM\u003dandroid-19 NDK_OUT\u003d/home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT\u003d/home/twaik/WTermux/app/build/intermediates/ndkBuild/release/lib clean"
],
"libraries": {
"lorie-release-armeabi-v7a": {
"artifactName": "lorie",
"buildCommand": "/opt/AndroidSdk/ndk-bundle/ndk-build NDK_PROJECT_PATH\u003dnull APP_BUILD_SCRIPT\u003d/home/twaik/WTermux/app/src/main/jni/Android.mk APP_ABI\u003darmeabi-v7a NDK_ALL_ABIS\u003darmeabi-v7a NDK_DEBUG\u003d0 APP_PLATFORM\u003dandroid-19 NDK_OUT\u003d/home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT\u003d/home/twaik/WTermux/app/build/intermediates/ndkBuild/release/lib /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/liblorie.so",
"abi": "armeabi-v7a",
"output": "/home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/liblorie.so"
}
}
}

View File

@ -0,0 +1,16 @@
Executable : /opt/AndroidSdk/ndk-bundle/ndk-build
arguments :
NDK_PROJECT_PATH=null
APP_BUILD_SCRIPT=/home/twaik/WTermux/app/src/main/jni/Android.mk
APP_ABI=armeabi-v7a
NDK_ALL_ABIS=armeabi-v7a
NDK_DEBUG=0
APP_PLATFORM=android-19
NDK_OUT=/home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj
NDK_LIBS_OUT=/home/twaik/WTermux/app/build/intermediates/ndkBuild/release/lib
APP_SHORT_COMMANDS=false
LOCAL_SHORT_COMMANDS=false
-B
-n
jvmArgs :

View File

@ -0,0 +1,35 @@
rm -f /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/lib/armeabi-v7a/*
rm -f /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/lib/armeabi-v7a/gdbserver
rm -f /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/lib/armeabi-v7a/gdb.setup
mkdir -p /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a
echo [armeabi-v7a] "Prebuilt ": "libandroid-support.so <= /home/twaik/WTermux/app/src/main/jni/prebuilt/armeabi-v7a/"
cp -f /home/twaik/WTermux/app/src/main/jni/prebuilt/armeabi-v7a/libandroid-support.so /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/libandroid-support.so
mkdir -p /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/lib/armeabi-v7a
echo [armeabi-v7a] "Install ": "libandroid-support.so => /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/lib/armeabi-v7a/libandroid-support.so"
install -p /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/libandroid-support.so /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/lib/armeabi-v7a/libandroid-support.so
/opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip --strip-unneeded /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/lib/armeabi-v7a/libandroid-support.so
echo [armeabi-v7a] "Prebuilt ": "libffi.so <= /home/twaik/WTermux/app/src/main/jni/prebuilt/armeabi-v7a/"
cp -f /home/twaik/WTermux/app/src/main/jni/prebuilt/armeabi-v7a/libffi.so /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/libffi.so
echo [armeabi-v7a] "Install ": "libffi.so => /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/lib/armeabi-v7a/libffi.so"
install -p /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/libffi.so /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/lib/armeabi-v7a/libffi.so
/opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip --strip-unneeded /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/lib/armeabi-v7a/libffi.so
mkdir -p /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/lorie
echo [armeabi-v7a] "Compile thumb ": "lorie <= main.c"
rm -f /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/lorie/main.o
/opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -MMD -MP -MF /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/lorie/main.o.d -target armv7-none-linux-androideabi19 -fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes --sysroot /opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot -g -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -fno-addrsig -fpic -march=armv7-a -mthumb -Oz -DNDEBUG -I/home/twaik/WTermux/app/src/main/jni/prebuilt/include -I/home/twaik/WTermux/app/src/main/jni/lorie -DANDROID -Wa,--noexecstack -Wformat -Werror=format-security -c /home/twaik/WTermux/app/src/main/jni/lorie/main.c -o /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/lorie/main.o
echo [armeabi-v7a] "Compile thumb ": "lorie <= backend-android.c"
rm -f /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/lorie/backend-android.o
/opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -MMD -MP -MF /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/lorie/backend-android.o.d -target armv7-none-linux-androideabi19 -fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes --sysroot /opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot -g -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -fno-addrsig -fpic -march=armv7-a -mthumb -Oz -DNDEBUG -I/home/twaik/WTermux/app/src/main/jni/prebuilt/include -I/home/twaik/WTermux/app/src/main/jni/lorie -DANDROID -Wa,--noexecstack -Wformat -Werror=format-security -c /home/twaik/WTermux/app/src/main/jni/lorie/backend-android.c -o /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/lorie/backend-android.o
echo [armeabi-v7a] "Compile thumb ": "lorie <= renderer.c"
rm -f /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/lorie/renderer.o
/opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -MMD -MP -MF /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/lorie/renderer.o.d -target armv7-none-linux-androideabi19 -fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes --sysroot /opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot -g -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -fno-addrsig -fpic -march=armv7-a -mthumb -Oz -DNDEBUG -I/home/twaik/WTermux/app/src/main/jni/prebuilt/include -I/home/twaik/WTermux/app/src/main/jni/lorie -DANDROID -Wa,--noexecstack -Wformat -Werror=format-security -c /home/twaik/WTermux/app/src/main/jni/lorie/renderer.c -o /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/lorie/renderer.o
echo [armeabi-v7a] "Prebuilt ": "libwayland-server.so <= /home/twaik/WTermux/app/src/main/jni/prebuilt/armeabi-v7a/"
cp -f /home/twaik/WTermux/app/src/main/jni/prebuilt/armeabi-v7a/libwayland-server.so /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/libwayland-server.so
echo [armeabi-v7a] "SharedLibrary ": "liblorie.so"
/opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -Wl,-soname,liblorie.so -shared /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/lorie/main.o /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/lorie/backend-android.o /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/lorie/renderer.o -lgcc -Wl,--exclude-libs,libgcc.a -latomic -Wl,--exclude-libs,libatomic.a /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/libwayland-server.so -target armv7-none-linux-androideabi19 -no-canonical-prefixes -Wl,--build-id -stdlib=libstdc++ -Wl,--no-undefined -Wl,-z,noexecstack -Wl,--warn-shared-textrel -Wl,--fatal-warnings -lEGL -lGLESv2 -llog -lc -lm -o /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/liblorie.so
echo [armeabi-v7a] "Install ": "liblorie.so => /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/lib/armeabi-v7a/liblorie.so"
install -p /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/liblorie.so /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/lib/armeabi-v7a/liblorie.so
/opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip --strip-unneeded /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/lib/armeabi-v7a/liblorie.so
echo [armeabi-v7a] "Install ": "libwayland-server.so => /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/lib/armeabi-v7a/libwayland-server.so"
install -p /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/libwayland-server.so /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/lib/armeabi-v7a/libwayland-server.so
/opt/AndroidSdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip --strip-unneeded /home/twaik/WTermux/app/build/intermediates/ndkBuild/release/lib/armeabi-v7a/libwayland-server.so

1
app/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

179
app/app.iml Normal file
View File

@ -0,0 +1,179 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":app" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/build/generated/res/resValues/debug" />
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
<facet type="native-android-gradle" name="Native-Android-Gradle">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug-armeabi-v7a" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
<output url="file://$MODULE_DIR$/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes" />
<output-test url="file://$MODULE_DIR$/build/intermediates/javac/debugUnitTest/compileDebugUnitTestJavaWithJavac/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/jni/lorie" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debug/compileDebugAidl/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debug/compileDebugRenderscript/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debugAndroidTest/compileDebugAndroidTestAidl/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debugAndroidTest/compileDebugAndroidTestRenderscript/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/.externalNativeBuild" />
<excludeFolder url="file://$MODULE_DIR$/build/generated/not_namespaced_r_class_sources" />
<excludeFolder url="file://$MODULE_DIR$/build/generated/source/r" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotation_processor_list" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/apk_list" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundle_manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check_manifest_result" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/compatible_screen_manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/duplicate_classes_check" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/external_libs_dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_app_manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_merged_manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javac" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_jni_libs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/metadata_feature_manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndkBuild" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/processed_res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shader_assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/signing_config" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/validate_signing_config" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 28 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Gradle: com.android.support:support-fragment:28.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:localbroadcastmanager:28.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:documentfile:28.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:animated-vector-drawable:28.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:slidingpanelayout:28.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: android.arch.lifecycle:viewmodel:1.1.1@aar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:appcompat-v7:28.0.0@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test.espresso:espresso-idling-resource:3.0.2@aar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:loader:28.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: android.arch.core:runtime:1.1.1@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test:runner:1.0.2@aar" level="project" />
<orderEntry type="library" name="Gradle: android.arch.lifecycle:livedata-core:1.1.1@aar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:collections:28.0.0@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: com.squareup:javawriter:2.1.1@jar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:cursoradapter:28.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: android.arch.lifecycle:runtime:1.1.1@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test.espresso:espresso-core:3.0.2@aar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:support-compat:28.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:support-core-ui:28.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:asynclayoutinflater:28.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support.constraint:constraint-layout:1.1.3@aar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:print:28.0.0@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: com.google.code.findbugs:jsr305:2.0.1@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: javax.inject:javax.inject:1@jar" level="project" />
<orderEntry type="library" name="Gradle: android.arch.core:common:1.1.1@jar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:versionedparcelable:28.0.0@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: junit:junit:4.12@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-core:1.3@jar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:viewpager:28.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:support-core-utils:28.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:support-vector-drawable:28.0.0@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test:monitor:1.0.2@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-library:1.3@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-integration:1.3@jar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:support-annotations:28.0.0@jar" level="project" />
<orderEntry type="library" name="Gradle: android.arch.lifecycle:common:1.1.1@jar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:interpolator:28.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: android.arch.lifecycle:livedata:1.1.1@aar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:drawerlayout:28.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:coordinatorlayout:28.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:customview:28.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:swiperefreshlayout:28.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support.constraint:constraint-layout-solver:1.1.3@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: net.sf.kxml:kxml2:2.3.0@jar" level="project" />
</component>
</module>

33
app/build.gradle Normal file
View File

@ -0,0 +1,33 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.termux.wtermux"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
ndkBuild {
path "src/main/jni/Android.mk"
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

21
app/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.termux.wtermux"
android:sharedUserId="com.termux">
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".MainActivity"
android:theme="@style/NoActionBar"
android:configChanges="orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -0,0 +1,99 @@
package com.termux.wtermux;
import android.annotation.SuppressLint;
import android.util.Log;
import android.view.MotionEvent;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
public class LorieService implements SurfaceHolder.Callback, View.OnTouchListener {
private static final int BTN_LEFT = 0x110;
private static final int BTN_MIDDLE = 0x110;
private static final int BTN_RIGHT = 0x110;
private static final int WL_STATE_PRESSED = 1;
private static final int WL_STATE_RELEASED = 0;
private static final int WL_POINTER_MOTION = 2;
private static final int WL_POINTER_BUTTON = 3;
private long compositor = 0;
LorieService() {
compositor = createLorieThread();
if (compositor == 0) {
Log.e("WestonService", "compositor thread was not created");
}
}
@SuppressLint("ClickableViewAccessibility")
void connectSurfaceView(SurfaceView surface) {
surface.getHolder().addCallback(this);
surface.setOnTouchListener(this);
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
windowChanged(compositor, holder.getSurface(), width, height);
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
}
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouch(View v, MotionEvent e) {
int type = 0;
int button = 0;
switch (e.getAction()) {
case MotionEvent.ACTION_POINTER_DOWN:
case MotionEvent.ACTION_BUTTON_PRESS:
case MotionEvent.ACTION_DOWN:
type = WL_STATE_PRESSED; // STATE_PRESSED
break;
case MotionEvent.ACTION_HOVER_MOVE:
case MotionEvent.ACTION_MOVE:
type = WL_POINTER_MOTION;
break;
case MotionEvent.ACTION_POINTER_UP:
case MotionEvent.ACTION_BUTTON_RELEASE:
case MotionEvent.ACTION_UP:
type = WL_STATE_RELEASED; // STATE_RELEASED
break;
}
if (type == WL_STATE_PRESSED || type == WL_STATE_RELEASED)
switch (e.getButtonState()) {
case MotionEvent.BUTTON_PRIMARY:
button = BTN_LEFT;
break;
case MotionEvent.BUTTON_TERTIARY:
button = BTN_MIDDLE;
break;
case MotionEvent.BUTTON_SECONDARY:
button = BTN_RIGHT;
break;
default:
Log.d("LorieService","Unknown button: " + e.getButtonState());
button = BTN_LEFT;
}
onTouch(compositor, type, button, (int)e.getX(), (int)e.getY());
return true;
}
private native long createLorieThread();
private native void windowChanged(long compositor, Surface surface, int width, int height);
private native void onTouch(long compositor, int type, int button, int x, int y);
private native void onKey(long compositor, int type, int key);
static {
System.loadLibrary("lorie");
}
}

View File

@ -0,0 +1,22 @@
package com.termux.wtermux;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.SurfaceView;
import android.view.WindowManager;
public class MainActivity extends AppCompatActivity {
LorieService weston;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
SurfaceView surface = findViewById(R.id.WestonView);
weston = new LorieService();
weston.connectSurfaceView(surface);
}
}

View File

@ -0,0 +1,3 @@
ROOT_PATH := $(call my-dir)
include $(ROOT_PATH)/prebuilt/Android.mk
include $(ROOT_PATH)/lorie/Android.mk

View File

@ -0,0 +1,11 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := lorie
LOCAL_SRC_FILES := \
main.c \
backend-android.c \
renderer.c
LOCAL_SHARED_LIBRARIES := wayland-server
LOCAL_LDLIBS := -lEGL -lGLESv2 -llog -landroid
include $(BUILD_SHARED_LIBRARY)

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Twaik Yont
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,355 @@
#pragma clang diagnostic push
#pragma ide diagnostic ignored "readability-isolate-declaration"
#pragma ide diagnostic ignored "cppcoreguidelines-avoid-magic-numbers"
#include <unistd.h>
#include <jni.h>
#include <android/native_window_jni.h>
#include <pthread.h>
#include <poll.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <wayland-server.h>
#include "backend.h"
#include "log.h"
static void checkEGLError(int line) {
char* error = NULL;
switch(eglGetError()) {
#define E(code, desc) case code: error = desc; break;
case EGL_SUCCESS: return; // "No error"
E(EGL_NOT_INITIALIZED, "EGL not initialized or failed to initialize");
E(EGL_BAD_ACCESS, "Resource inaccessible");
E(EGL_BAD_ALLOC, "Cannot allocate resources");
E(EGL_BAD_ATTRIBUTE, "Unrecognized attribute or attribute value");
E(EGL_BAD_CONTEXT, "Invalid EGL context");
E(EGL_BAD_CONFIG, "Invalid EGL frame buffer configuration");
E(EGL_BAD_CURRENT_SURFACE, "Current surface is no longer valid");
E(EGL_BAD_DISPLAY, "Invalid EGL display");
E(EGL_BAD_SURFACE, "Invalid surface");
E(EGL_BAD_MATCH, "Inconsistent arguments");
E(EGL_BAD_PARAMETER, "Invalid argument");
E(EGL_BAD_NATIVE_PIXMAP, "Invalid native pixmap");
E(EGL_BAD_NATIVE_WINDOW, "Invalid native window");
E(EGL_CONTEXT_LOST, "Context lost");
#undef E
default: error = "Unknown error";
}
LOGE("EGL: %s after %d", error, line);
}
#define checkEGLError() checkEGLError(__LINE__)
enum {
ACTION_KEY = 1,
ACTION_POINTER = 2,
ACTION_WIN_CHANGE = 3,
#ifdef __ANDROID__
ACTION_JNI_WIN_CHANGE = 4,
#endif
};
static const EGLint ctxattr[] = {
EGL_CONTEXT_CLIENT_VERSION, 2, // Request opengl ES2.0
EGL_NONE
};
static const EGLint sfcattr[] = {
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_BLUE_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_RED_SIZE, 8,
EGL_NONE
};
typedef struct {
uint8_t type;
union {
struct {
uint8_t state;
uint16_t key;
} key;
struct {
uint16_t state, button;
uint32_t x, y;
} pointer;
struct {
EGLDisplay dpy;
EGLNativeWindowType win;
uint32_t width, height;
} window_change;
#ifdef __ANDROID__
struct {
JavaVM* jvm;
jobject surface;
uint32_t width, height;
} jni_window_change;
#endif
};
} lorie_event;
struct backend_android {
EGLDisplay dpy;
EGLContext ctx;
EGLNativeDisplayType win;
EGLConfig config;
EGLSurface sfc;
struct callbacks callbacks;
int fds[2];
};
struct backend_android *backend = NULL;
void lorie_key_event(void __unused *b, uint8_t state, uint16_t key) {
if (!backend) return;
lorie_event e;
memset(&e, 0, sizeof(lorie_event));
e.type = ACTION_KEY;
e.key.state = state;
e.key.key = key;
write(backend->fds[0], &e, sizeof(lorie_event));
}
void lorie_pointer_event(void __unused *b, uint8_t state, uint16_t button, uint32_t x, uint32_t y) {
if (!backend) return;
lorie_event e;
memset(&e, 0, sizeof(lorie_event));
e.type = ACTION_POINTER;
e.pointer.state = state;
e.pointer.button = button;
e.pointer.x = x;
e.pointer.y = y;
write(backend->fds[0], &e, sizeof(lorie_event));
}
void lorie_window_change_event(void __unused *b, EGLDisplay dpy, EGLNativeWindowType win, uint32_t width, uint32_t height) {
if (!backend) return;
lorie_event e;
memset(&e, 0, sizeof(lorie_event));
e.type = ACTION_WIN_CHANGE;
e.window_change.dpy = dpy;
e.window_change.win = win;
e.window_change.width = width;
e.window_change.height = height;
write(backend->fds[0], &e, sizeof(lorie_event));
}
void lorie_jni_window_change_event(void __unused *b, JavaVM* jvm, jobject surface, uint32_t width, uint32_t height) {
if (!backend) return;
lorie_event e;
memset(&e, 0, sizeof(lorie_event));
e.type = ACTION_JNI_WIN_CHANGE;
e.jni_window_change.jvm = jvm;
e.jni_window_change.surface = surface;
e.jni_window_change.width = width;
e.jni_window_change.height = height;
write(backend->fds[0], &e, sizeof(lorie_event));
}
static int has_data(int socket) {
int count = 0;
ioctl(socket, FIONREAD, &count);
return count;
}
JNIEXPORT jlong JNICALL
Java_com_termux_wtermux_LorieService_createLorieThread(JNIEnv __unused *env, jobject __unused instance) {
pthread_t thread;
//void *server = NULL;
setenv("XDG_RUNTIME_DIR", "/data/data/com.termux/files/usr/tmp", 1);
pthread_create(&thread, NULL, (void *(*)(void *))lorie_start, NULL);
while(backend == NULL) { usleep(10); }
//return (jlong) compositor;
return 1;
}
JNIEXPORT void JNICALL
Java_com_termux_wtermux_LorieService_windowChanged(JNIEnv *env, jobject __unused instance, jlong __unused jcompositor, jobject jsurface, jint width, jint height) {
if (backend == NULL) return;
#if 1
EGLNativeWindowType win = ANativeWindow_fromSurface(env, jsurface);
if (win == NULL) {
LOGE("Surface is invalid");
lorie_window_change_event(backend, NULL, NULL, (uint32_t) width, (uint32_t) height);
return;
}
lorie_window_change_event(backend, NULL, win, (uint32_t) width,
(uint32_t) height);
#else
JavaVM* jvm;
(*env)->GetJavaVM(env, &jvm);
if (jvm == NULL) {
LOGE("Error getting jvm instance");
return;
}
jobject surface = (*env)->NewGlobalRef(env, jsurface);
if (surface == NULL) {
LOGE("Error creating global reference of Surface object");
return;
}
lorie_jni_window_change_event(backend, jvm, surface, width, height);
#endif
}
JNIEXPORT void JNICALL
Java_com_termux_wtermux_LorieService_onTouch(JNIEnv __unused *env, jobject __unused instance, jlong __unused jcompositor, jint type, jint button, jint x, jint y) {
if (backend == NULL) return;
lorie_pointer_event(backend, (uint8_t) type, (uint16_t) button, (uint32_t) x, (uint32_t) y);
}
JNIEXPORT void JNICALL
Java_com_termux_wtermux_LorieService_onKey(JNIEnv __unused *env, jobject __unused instance, jlong __unused compositor,
jint type, jint key) {
lorie_key_event(backend, (uint8_t) type, (uint16_t) key);
}
////////////////////////////////////////////////////////////////////////
void backend_init (struct callbacks *callbacks) {
backend = calloc (1, sizeof(struct backend_android));
if (backend == NULL) {
LOGE("Can not allocate backend_android");
return;
}
backend->callbacks = *callbacks;
if (socketpair(PF_LOCAL, SOCK_STREAM, 0, backend->fds)) {
}
// Setup EGL
EGLint num_configs_returned;
backend->dpy = eglGetDisplay (EGL_DEFAULT_DISPLAY); checkEGLError();
eglInitialize (backend->dpy, NULL, NULL); checkEGLError();
eglBindAPI (EGL_OPENGL_ES_API);
eglChooseConfig (backend->dpy, sfcattr, &backend->config, 1, &num_configs_returned); checkEGLError();
backend->ctx = eglCreateContext (backend->dpy, backend->config, EGL_NO_CONTEXT, ctxattr); checkEGLError();
eglMakeCurrent(backend->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, backend->ctx); checkEGLError();
}
EGLDisplay __unused backend_get_egl_display (void) {
return backend->dpy;
}
void backend_swap_buffers (void) {
eglSwapBuffers(backend->dpy, backend->sfc); checkEGLError();
}
void backend_dispatch_nonblocking (void)
{
lorie_event ev;
while (has_data(backend->fds[1]) >= (int) sizeof(lorie_event)) {
read(backend->fds[1], &ev, sizeof(lorie_event));
switch (ev.type) {
case ACTION_KEY:
if (backend->callbacks.key)
backend->callbacks.key(ev.key.key, ev.key.state);
break;
case ACTION_POINTER:
if (backend->callbacks.mouse_motion)
backend->callbacks.mouse_motion(ev.pointer.x, ev.pointer.y);
if (ev.pointer.state != WL_POINTER_MOTION) {
if (backend->callbacks.mouse_button)
backend->callbacks.mouse_button(ev.pointer.button, ev.pointer.state);
}
break;
case ACTION_WIN_CHANGE:
if (ev.window_change.win != backend->win) {
if (backend->sfc)
eglDestroySurface(backend->dpy, backend->sfc);
backend->sfc = eglCreateWindowSurface(backend->dpy, backend->config, ev.window_change.win, NULL); checkEGLError();
backend->win = ev.window_change.win;
}
checkEGLError();
eglMakeCurrent(backend->dpy, backend->sfc, backend->sfc, backend->ctx); checkEGLError();
if (backend->callbacks.resize)
backend->callbacks.resize(ev.window_change.width, ev.window_change.height);
break;
#if 0
#ifdef __ANDROID__
case ACTION_JNI_WIN_CHANGE:
{
JavaVM* jvm = ev.jni_window_change.jvm;
JNIEnv* env;
(*jvm)->AttachCurrentThread(jvm, (void**)&env, NULL);
if (!jvm || !env) {
weston_log("Failed getting JNIEnv\n");
return -1;
}
b->edpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
b->ewin = ANativeWindow_fromSurface(env, ev.jni_window_change.surface);
if (b->ewin == NULL) {
weston_log("Error getting EGLNativeWindowType from Java Surface object\n");
return -1;
}
struct weston_mode mode = b->output->mode;
if (mode.width == ev.jni_window_change.width &&
mode.height == ev.jni_window_change.height)
break;
mode.width = ev.jni_window_change.width;
mode.height = ev.jni_window_change.height;
if (weston_output_mode_set_native(&b->output->base,
&mode, b->output->scale) < 0)
weston_log("Mode switch failed\n");
break;
}
#endif
#endif
default:break;
}
}
}
void backend_wait_for_events (int wayland_fd) {
if (!backend) return;
struct pollfd fds[2] = {{backend->fds[1], POLLIN}, {wayland_fd, POLLIN}};
poll (fds, 2, -1);
}
void __unused backend_get_keymap (int __unused *fd, int __unused *size) {
}
long backend_get_timestamp (void) {
struct timespec t;
clock_gettime (CLOCK_MONOTONIC, &t);
return t.tv_sec * 1000 + t.tv_nsec / 1000000;
}
void backend_get_dimensions(uint32_t *width, uint32_t *height) {
if (width) *width = 480;
if (height) *height = 800;
}
#pragma clang diagnostic pop

View File

@ -1,5 +1,4 @@
#define _GNU_SOURCE
#include "backend.h"
#include <wayland-server.h>
#include <X11/Xlib.h>
#include <linux/input.h>
@ -14,6 +13,10 @@
#include <time.h>
#include <stdio.h>
#include <poll.h>
#include <signal.h>
#include <execinfo.h>
#include "backend.h"
#include "log.h"
#define WINDOW_WIDTH 1024
#define WINDOW_HEIGHT 600
@ -91,7 +94,21 @@ static void create_window (void) {
XMapWindow (x_display, window.window);
}
void handler(int sig) {
void *array[10];
size_t size;
// get void*'s for all entries on the stack
size = backtrace(array, 10);
// print out all the frames to stderr
fprintf(stderr, "Error: signal %d:\n", sig);
backtrace_symbols_fd(array, size, STDERR_FILENO);
exit(1);
}
void backend_init (struct callbacks *_callbacks) {
signal(SIGSEGV, handler);
callbacks = *_callbacks;
x_display = XOpenDisplay (NULL);
@ -116,6 +133,7 @@ void backend_swap_buffers (void) {
}
static void update_modifiers (void) {
if (!callbacks.modifiers) return;
struct modifier_state modifier_state;
modifier_state.depressed = xkb_state_serialize_mods (state, XKB_STATE_MODS_DEPRESSED);
modifier_state.latched = xkb_state_serialize_mods (state, XKB_STATE_MODS_LATCHED);
@ -128,16 +146,16 @@ void backend_dispatch_nonblocking (void) {
XEvent event;
while (XPending(x_display)) {
XNextEvent (x_display, &event);
if (event.type == ConfigureNotify) {
if (event.type == ConfigureNotify && callbacks.resize) {
callbacks.resize (event.xconfigure.width, event.xconfigure.height);
}
else if (event.type == Expose) {
else if (event.type == Expose && callbacks.draw) {
callbacks.draw ();
}
else if (event.type == MotionNotify) {
else if (event.type == MotionNotify && callbacks.mouse_motion) {
callbacks.mouse_motion (event.xbutton.x, event.xbutton.y);
}
else if (event.type == ButtonPress) {
else if (event.type == ButtonPress && callbacks.mouse_button) {
if (event.xbutton.button == Button1)
callbacks.mouse_button (BTN_LEFT, WL_POINTER_BUTTON_STATE_PRESSED);
else if (event.xbutton.button == Button2)
@ -145,7 +163,7 @@ void backend_dispatch_nonblocking (void) {
else if (event.xbutton.button == Button3)
callbacks.mouse_button (BTN_RIGHT, WL_POINTER_BUTTON_STATE_PRESSED);
}
else if (event.type == ButtonRelease) {
else if (event.type == ButtonRelease && callbacks.mouse_button) {
if (event.xbutton.button == Button1)
callbacks.mouse_button (BTN_LEFT, WL_POINTER_BUTTON_STATE_RELEASED);
else if (event.xbutton.button == Button2)
@ -153,12 +171,12 @@ void backend_dispatch_nonblocking (void) {
else if (event.xbutton.button == Button3)
callbacks.mouse_button (BTN_RIGHT, WL_POINTER_BUTTON_STATE_RELEASED);
}
else if (event.type == KeyPress) {
else if (event.type == KeyPress && callbacks.key) {
callbacks.key (event.xkey.keycode - 8, WL_KEYBOARD_KEY_STATE_PRESSED);
xkb_state_update_key (state, event.xkey.keycode, XKB_KEY_DOWN);
update_modifiers ();
}
else if (event.type == KeyRelease) {
else if (event.type == KeyRelease && callbacks.key) {
callbacks.key (event.xkey.keycode - 8, WL_KEYBOARD_KEY_STATE_RELEASED);
xkb_state_update_key (state, event.xkey.keycode, XKB_KEY_UP);
update_modifiers ();
@ -168,7 +186,7 @@ void backend_dispatch_nonblocking (void) {
state = xkb_x11_state_new_from_device (keymap, xcb_connection, keyboard_device_id);
update_modifiers ();
}
else if (event.type == ClientMessage) {
else if (event.type == ClientMessage && callbacks.terminate) {
if(event.xclient.message_type == atom1 &&
event.xclient.data.l[0] == atom2) {
//XDestroyWindow(x_display, event.xclient.window);
@ -176,7 +194,7 @@ void backend_dispatch_nonblocking (void) {
}
break;
}
else if (event.type == DestroyNotify) {
else if (event.type == DestroyNotify && callbacks.terminate) {
callbacks.terminate();
break;
}
@ -205,3 +223,16 @@ long backend_get_timestamp (void) {
clock_gettime (CLOCK_MONOTONIC, &t);
return t.tv_sec * 1000 + t.tv_nsec / 1000000;
}
void backend_get_dimensions(uint32_t *width, uint32_t *height) {
if (width != NULL) *width = WINDOW_WIDTH;
if (height != NULL) *height = WINDOW_HEIGHT;
}
int main(int argc, char *argv[]) {
#ifndef __ANDROID__
if (argc == 2 && !strcmp("-f", argv[1])) trace_funcs = 1;
#endif
lorie_start();
return 0;
}

View File

@ -1,5 +1,6 @@
#include <EGL/egl.h>
#include <GLES2/gl2.h>
#include <stdint.h>
struct modifier_state {
uint32_t depressed, latched, locked, group;
@ -22,5 +23,6 @@ void backend_dispatch_nonblocking (void);
void backend_wait_for_events (int wayland_fd);
void backend_get_keymap (int *fd, int *size);
long backend_get_timestamp (void);
void backend_get_dimensions(uint32_t *width, uint32_t *height);
void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * data);
void lorie_start(void);

View File

@ -0,0 +1,56 @@
#include <wayland-server.h>
static void no_op_func(void) {}
#define NO_OP(type) ((type) &no_op_func)
// wl_region
typedef void (*wl_region_destroy_t)(struct wl_client *client, struct wl_resource *resource);
typedef void (*wl_region_add_t)(struct wl_client *client, struct wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height);
typedef void (*wl_region_subtract_t) (struct wl_client *client, struct wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height);
// wl_shell_surface
typedef void (*wl_shell_surface_pong_t)(struct wl_client *client, struct wl_resource *resource, uint32_t serial);
typedef void (*wl_shell_surface_move_t)(struct wl_client *client, struct wl_resource *resource, struct wl_resource *seat, uint32_t serial);
typedef void (*wl_shell_surface_resize_t)(struct wl_client *client, struct wl_resource *resource, struct wl_resource *seat, uint32_t serial, uint32_t edges);
typedef void (*wl_shell_surface_set_toplevel_t)(struct wl_client *client, struct wl_resource *resource);
typedef void (*wl_shell_surface_set_transient_t)(struct wl_client *client, struct wl_resource *resource, struct wl_resource *parent, int32_t x, int32_t y, uint32_t flags);
typedef void (*wl_shell_surface_set_fullscreen_t)(struct wl_client *client, struct wl_resource *resource, uint32_t method, uint32_t framerate, struct wl_resource *output);
typedef void (*wl_shell_surface_set_popup_t)(struct wl_client *client, struct wl_resource *resource, struct wl_resource *seat, uint32_t serial, struct wl_resource *parent, int32_t x, int32_t y, uint32_t flags);
typedef void (*wl_shell_surface_set_maximized_t)(struct wl_client *client, struct wl_resource *resource, struct wl_resource *output);
typedef void (*wl_shell_surface_set_title_t)(struct wl_client *client, struct wl_resource *resource, const char *title);
typedef void (*wl_shell_surface_set_class_t)(struct wl_client *client, struct wl_resource *resource, const char *class_);
// wl_surface
typedef void (*wl_surface_destroy_t)(struct wl_client *client, struct wl_resource *resource);
typedef void (*wl_surface_attach_t)(struct wl_client *client, struct wl_resource *resource, struct wl_resource *buffer, int32_t x, int32_t y);
typedef void (*wl_surface_damage_t)(struct wl_client *client, struct wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height);
typedef void (*wl_surface_frame_t)(struct wl_client *client, struct wl_resource *resource, uint32_t callback);
typedef void (*wl_surface_set_opaque_region_t)(struct wl_client *client, struct wl_resource *resource, struct wl_resource *region);
typedef void (*wl_surface_set_input_region_t)(struct wl_client *client, struct wl_resource *resource, struct wl_resource *region);
typedef void (*wl_surface_commit_t)(struct wl_client *client, struct wl_resource *resource);
typedef void (*wl_surface_set_buffer_transform_t)(struct wl_client *client, struct wl_resource *resource, int32_t transform);
typedef void (*wl_surface_set_buffer_scale_t)(struct wl_client *client, struct wl_resource *resource, int32_t scale);
// wl_seat, wl_keyboard, wl_pointer
typedef void (*wl_seat_get_pointer_t)(struct wl_client *client, struct wl_resource *resource, uint32_t id);
typedef void (*wl_seat_get_keyboard_t)(struct wl_client *client, struct wl_resource *resource, uint32_t id);
typedef void (*wl_seat_get_touch_t)(struct wl_client *client, struct wl_resource *resource, uint32_t id);
typedef void (*wl_pointer_set_cursor_t)(struct wl_client *client, struct wl_resource *resource, uint32_t serial, struct wl_resource *_surface, int32_t hotspot_x, int32_t hotspot_y);
typedef void (*wl_pointer_release_t)(struct wl_client *client, struct wl_resource *resource);
typedef void (*wl_keyboard_release_t)(struct wl_client *client, struct wl_resource *resource);
// No op interfaces
static struct wl_region_interface lorie_region_interface = {NO_OP(wl_region_destroy_t), NO_OP(wl_region_add_t), NO_OP(wl_region_subtract_t)};
static struct wl_pointer_interface lorie_pointer_interface = {NO_OP(wl_pointer_set_cursor_t), NO_OP(wl_pointer_release_t)};
static struct wl_keyboard_interface lorie_keyboard_interface = {NO_OP(wl_keyboard_release_t)};
#define BINDFUNC(interface, version, implementation) \
static void interface##_bind (struct wl_client *client, void *data, uint32_t _version, uint32_t id) { \
LOGD("bind: " #interface); \
struct wl_resource *resource = wl_resource_create (client, &interface##_interface, version, id); \
if (resource == NULL) { \
wl_client_post_no_memory(client); \
return; \
} \
wl_resource_set_implementation (resource, &implementation, NULL, NULL); \
}

View File

@ -32,3 +32,25 @@
#endif
#define DBG LOGD("Here! %s %d", __FILE__, __LINE__)
extern int trace_funcs;
#if defined(TRACE_FUNCS) && !defined(__ANDROID__)
#include <execinfo.h>
#include <dlfcn.h>
void __attribute__((no_instrument_function))
__cyg_profile_func_enter (void *func, void *caller) {
if (!trace_funcs) return;
Dl_info info;
if (dladdr(func, &info))
LOGD ("enter %p [%s] %s\n", func, (info.dli_fname) ? info.dli_fname : "?", info.dli_sname ? info.dli_sname : "?");
}
void __attribute__((no_instrument_function))
__cyg_profile_func_exit (void *func, void *caller) {
if (!trace_funcs) return;
Dl_info info;
if (dladdr(func, &info))
LOGD ("leave %p [%s] %s\n", func, (info.dli_fname) ? info.dli_fname : "?", info.dli_sname ? info.dli_sname : "?");
}
#define static // backtrace do not report static function names
#endif

View File

@ -1,67 +1,14 @@
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#ifndef __USE_GNU
#define __USE_GNU
#endif
#include <execinfo.h>
#include <signal.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include <sys/time.h>
#include <wayland-server.h>
#include <dlfcn.h>
#include "backend.h"
#include "renderer.h"
#include "interfaces.h"
#include "log.h"
bool trace_funcs = false;
void __attribute__((no_instrument_function))
__cyg_profile_func_enter (void *func, void *caller) {
if (!trace_funcs) return;
Dl_info info;
if (dladdr(func, &info))
LOGD ("enter %p [%s] %s\n", func, (info.dli_fname) ? info.dli_fname : "?", info.dli_sname ? info.dli_sname : "?");
}
void __attribute__((no_instrument_function))
__cyg_profile_func_exit (void *func, void *caller) {
if (!trace_funcs) return;
Dl_info info;
if (dladdr(func, &info))
LOGD ("leave %p [%s] %s\n", func, (info.dli_fname) ? info.dli_fname : "?", info.dli_sname ? info.dli_sname : "?");
}
#define static // backtrace do not report static function names
void handler(int sig) {
void *array[10];
size_t size;
// get void*'s for all entries on the stack
size = backtrace(array, 10);
// print out all the frames to stderr
fprintf(stderr, "Error: signal %d:\n", sig);
backtrace_symbols_fd(array, size, STDERR_FILENO);
exit(1);
}
#define BINDFUNC(interface, version, implementation) \
static void interface##_bind (struct wl_client *client, void *data, uint32_t _version, uint32_t id) { \
LOGD("bind: " #interface); \
struct wl_resource *resource = wl_resource_create (client, &interface##_interface, version, id); \
if (resource == NULL) { \
wl_client_post_no_memory(client); \
return; \
} \
wl_resource_set_implementation (resource, &implementation, NULL, NULL); \
}
int trace_funcs = 0;
struct lorie_composiror {
struct wl_display *display;
@ -102,10 +49,8 @@ static struct client *get_client (struct wl_client *_client) {
struct surface {
struct wl_resource *surface;
//struct wl_resource *xdg_surface;
struct wl_resource *buffer;
struct wl_resource *frame_callback;
//int x, y;
struct texture *texture;
struct client *client;
struct shell_surface *shell_surface;
@ -129,14 +74,7 @@ struct lorie_client {
void *null = NULL;
// region
/*No op*/ static void region_destroy (struct wl_client *client, struct wl_resource *resource) {}
/*No op*/ static void region_add (struct wl_client *client, struct wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) {}
/*No op*/ static void region_subtract (struct wl_client *client, struct wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) {}
/*No op*/ static struct wl_region_interface region_interface = {&region_destroy, &region_add, &region_subtract};
// surface
/*No op*/ static void surface_destroy (struct wl_client *client, struct wl_resource *resource) {}
static void surface_attach (struct wl_client *client, struct wl_resource *resource, struct wl_resource *buffer, int32_t x, int32_t y) {
struct surface *surface = wl_resource_get_user_data (resource);
surface->buffer = buffer;
@ -146,9 +84,10 @@ static void surface_attach (struct wl_client *client, struct wl_resource *resour
surface->width = surface->height = 0;
return;
}
surface->width = wl_shm_buffer_get_width (shm_buffer);
surface->height = wl_shm_buffer_get_height (shm_buffer);
if (!surface->texture ||
surface->texture->width != surface->width ||
surface->texture->height != surface->height) {
@ -173,8 +112,6 @@ static void surface_frame (struct wl_client *client, struct wl_resource *resourc
struct surface *surface = wl_resource_get_user_data (resource);
surface->frame_callback = wl_resource_create (client, &wl_callback_interface, 1, callback);
}
/*No op*/ static void surface_set_opaque_region (struct wl_client *client, struct wl_resource *resource, struct wl_resource *region) {}
/*No op*/ static void surface_set_input_region (struct wl_client *client, struct wl_resource *resource, struct wl_resource *region) {}
static void surface_commit (struct wl_client *client, struct wl_resource *resource) {
struct surface *surface = wl_resource_get_user_data (resource);
if (!surface || !surface->buffer) return;
@ -193,8 +130,6 @@ static void surface_commit (struct wl_client *client, struct wl_resource *resour
surface->frame_callback = NULL;
}
}
/*No op*/ static void surface_set_buffer_transform (struct wl_client *client, struct wl_resource *resource, int32_t transform) {}
/*No op*/ static void surface_set_buffer_scale (struct wl_client *client, struct wl_resource *resource, int32_t scale) {}
static void surface_delete (struct wl_resource *resource) {
struct surface *surface = wl_resource_get_user_data (resource);
if (c.toplevel == surface) c.toplevel = NULL;
@ -202,7 +137,7 @@ static void surface_delete (struct wl_resource *resource) {
texture_destroy(&surface->texture);
free (surface);
}
static struct wl_surface_interface surface_interface = {&surface_destroy, &surface_attach, &surface_damage, &surface_frame, &surface_set_opaque_region, &surface_set_input_region, &surface_commit, &surface_set_buffer_transform, &surface_set_buffer_scale};
static struct wl_surface_interface surface_interface = {NO_OP(wl_surface_destroy_t), surface_attach, surface_damage, surface_frame, NO_OP(wl_surface_set_opaque_region_t), NO_OP(wl_surface_set_input_region_t), surface_commit, NO_OP(wl_surface_set_buffer_transform_t), NO_OP(wl_surface_set_buffer_scale_t)};
// compositor
static void compositor_create_surface (struct wl_client *client, struct wl_resource *resource, uint32_t id) {
@ -214,32 +149,23 @@ static void compositor_create_surface (struct wl_client *client, struct wl_resou
}
static void compositor_create_region (struct wl_client *client, struct wl_resource *resource, uint32_t id) {
struct wl_resource *region = wl_resource_create (client, &wl_region_interface, 1, id);
wl_resource_set_implementation (region, &region_interface, NULL, NULL);
wl_resource_set_implementation (region, &lorie_region_interface, NULL, NULL);
}
static struct wl_compositor_interface compositor_interface = {&compositor_create_surface, &compositor_create_region};
BINDFUNC(wl_compositor, 4, compositor_interface);
// shell surface
/*No op*/ static void shell_surface_pong (struct wl_client *client, struct wl_resource *resource, uint32_t serial) {}
/*No op*/ static void shell_surface_move (struct wl_client *client, struct wl_resource *resource, struct wl_resource *seat, uint32_t serial) {}
/*No op*/ static void shell_surface_resize (struct wl_client *client, struct wl_resource *resource, struct wl_resource *seat, uint32_t serial, uint32_t edges) {}
static void shell_surface_set_toplevel (struct wl_client *client, struct wl_resource *resource) {
struct shell_surface *shell_surface = wl_resource_get_user_data (resource);
c.toplevel = shell_surface->surface;
wl_shell_surface_send_configure(shell_surface->shell_surface, 0, c.width, c.height);
}
/*No op*/ static void shell_surface_set_transient (struct wl_client *client, struct wl_resource *resource, struct wl_resource *parent, int32_t x, int32_t y, uint32_t flags) {}
/*No op*/ static void shell_surface_set_fullscreen (struct wl_client *client, struct wl_resource *resource, uint32_t method, uint32_t framerate, struct wl_resource *output) {}
/*No op*/ static void shell_surface_set_popup (struct wl_client *client, struct wl_resource *resource, struct wl_resource *seat, uint32_t serial, struct wl_resource *parent, int32_t x, int32_t y, uint32_t flags) {}
/*No op*/ static void shell_surface_set_maximized (struct wl_client *client, struct wl_resource *resource, struct wl_resource *output) {}
/*No op*/ static void shell_surface_set_title (struct wl_client *client, struct wl_resource *resource, const char *title) {}
/*No op*/ static void shell_surface_set_class (struct wl_client *client, struct wl_resource *resource, const char *class_) {}
static struct wl_shell_surface_interface shell_surface_interface = {&shell_surface_pong, &shell_surface_move, &shell_surface_resize, &shell_surface_set_toplevel, &shell_surface_set_transient, &shell_surface_set_fullscreen, &shell_surface_set_popup, &shell_surface_set_maximized, &shell_surface_set_title, &shell_surface_set_class};
static struct wl_shell_surface_interface shell_surface_interface = {NO_OP(wl_shell_surface_pong_t), NO_OP(wl_shell_surface_move_t), NO_OP(wl_shell_surface_resize_t), shell_surface_set_toplevel, NO_OP(wl_shell_surface_set_transient_t), NO_OP(wl_shell_surface_set_fullscreen_t), NO_OP(wl_shell_surface_set_popup_t), NO_OP(wl_shell_surface_set_maximized_t), NO_OP(wl_shell_surface_set_title_t), NO_OP(wl_shell_surface_set_class_t)};
// wl shell
static void shell_get_shell_surface (struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *res_surface) {
struct shell_surface *shell_surface = calloc (1, sizeof(struct surface));
struct shell_surface *shell_surface = calloc (1, sizeof(struct shell_surface));
struct surface *surface = wl_resource_get_user_data (res_surface);
shell_surface->shell_surface = wl_resource_create (client, &wl_shell_surface_interface, 1, id);
wl_resource_set_implementation (shell_surface->shell_surface, &shell_surface_interface, shell_surface, NULL);
@ -249,35 +175,22 @@ static void shell_get_shell_surface (struct wl_client *client, struct wl_resourc
static struct wl_shell_interface shell_interface = {&shell_get_shell_surface};
BINDFUNC(wl_shell, 1, shell_interface);
// pointer
static void pointer_set_cursor (struct wl_client *client, struct wl_resource *resource, uint32_t serial, struct wl_resource *_surface, int32_t hotspot_x, int32_t hotspot_y) {
//struct surface *surface = wl_resource_get_user_data (_surface);
//cursor = surface;
}
/*No op*/ static void pointer_release (struct wl_client *client, struct wl_resource *resource) {}
/*No op*/ static struct wl_pointer_interface pointer_interface = {&pointer_set_cursor, &pointer_release};
// keyboard
/*No op*/ static void keyboard_release (struct wl_client *client, struct wl_resource *resource) {}
/*No op*/ static struct wl_keyboard_interface keyboard_interface = {&keyboard_release};
// seat
static void seat_get_pointer (struct wl_client *client, struct wl_resource *resource, uint32_t id) {
struct wl_resource *pointer = wl_resource_create (client, &wl_pointer_interface, 7, id);
wl_resource_set_implementation (pointer, &pointer_interface, NULL, NULL);
wl_resource_set_implementation (pointer, &lorie_pointer_interface, NULL, NULL);
get_client(client)->pointer = pointer;
}
static void seat_get_keyboard (struct wl_client *client, struct wl_resource *resource, uint32_t id) {
struct wl_resource *keyboard = wl_resource_create (client, &wl_keyboard_interface, 7, id);
wl_resource_set_implementation (keyboard, &keyboard_interface, NULL, NULL);
wl_resource_set_implementation (keyboard, &lorie_keyboard_interface, NULL, NULL);
//get_client(client)->keyboard = keyboard;
//int fd, size;
//backend_get_keymap (&fd, &size);
//wl_keyboard_send_keymap (keyboard, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, fd, size);
//close (fd);
}
/*No op*/ static void seat_get_touch (struct wl_client *client, struct wl_resource *resource, uint32_t id) {}
static struct wl_seat_interface seat_interface = {&seat_get_pointer, &seat_get_keyboard, &seat_get_touch};
static struct wl_seat_interface seat_interface = {&seat_get_pointer, &seat_get_keyboard, NO_OP(wl_seat_get_touch_t)};
static void wl_seat_bind (struct wl_client *client, void *data, uint32_t version, uint32_t id) {
LOGD("bind: wl_seat");
struct wl_resource *seat = wl_resource_create (client, &wl_seat_interface, 7, id);
@ -327,16 +240,13 @@ wl_output_bind(struct wl_client *client, void *data, uint32_t version, uint32_t
// backend callbacks
static void handle_resize_event (int width, int height) {
//glViewport(0, 0, width, height);
if (width == c.width && height == c.height) return;
glViewport(0, 0, width, height);
c.width = width;
c.height = height;
if (c.wl_output) {
wl_output_send_mode(c.wl_output, 3, width, height, 60000);
wl_output_send_done(c.wl_output);
if (c.toplevel && c.toplevel->client->pointer) {
wl_pointer_send_leave(c.toplevel->client->pointer, 0, c.toplevel->surface);
wl_pointer_send_enter (c.toplevel->client->pointer, 0, c.toplevel->surface, 0, 0);
}
if (c.toplevel && c.toplevel->shell_surface) {
wl_shell_surface_send_configure(c.toplevel->shell_surface->shell_surface, 0, width, height);
@ -363,6 +273,7 @@ static void handle_mouse_motion_event (int x, int y) {
}
}
static void handle_mouse_button_event (int button, int state) {
LOGD("Surface button: button %d, state %d", button, state);
if (!c.toplevel || !c.toplevel->client->pointer) return;
wl_pointer_send_button (c.toplevel->client->pointer, 0, backend_get_timestamp(), button, state);
if (wl_resource_get_version(c.toplevel->client->pointer) >=
@ -397,18 +308,15 @@ static void draw (void) {
c.redraw_needed = false;
}
int main(int argc, char *argv[]) {
if (argc == 2 && !strcmp("-f", argv[1])) trace_funcs = true;
void lorie_start(void) {
LOGV("Starting lorie server");
signal(SIGSEGV, handler);
backend_init (&callbacks);
//setenv("WAYLAND_DEBUG", "1", 1);
memset(&c, 0, sizeof(c));
wl_list_init (&c.clients);
wl_list_init (&c.surfaces);
wl_list_init (&c.shell_surfaces);
c.width = 1024;
c.height = 600;
backend_get_dimensions(&c.width, &c.height);
c.running = true;
c.display = wl_display_create ();
wl_display_add_socket_auto (c.display);
@ -418,9 +326,9 @@ int main(int argc, char *argv[]) {
wl_global_create (c.display, &wl_seat_interface, 4, NULL, &wl_seat_bind);
wl_global_create (c.display, &wl_output_interface, 3, NULL, &wl_output_bind);
wl_display_init_shm (c.display);
c.renderer = renderer_create();
struct wl_event_loop *event_loop = wl_display_get_event_loop (c.display);
int wayland_fd = wl_event_loop_get_fd (event_loop);
while (c.running) {
@ -430,11 +338,9 @@ int main(int argc, char *argv[]) {
if (c.redraw_needed) {
draw ();
}
// usleep(50000);
backend_wait_for_events (wayland_fd);
}
wl_display_destroy (c.display);
return 0;
}

View File

@ -139,7 +139,7 @@ struct texture *texture_create(int width, int height) {
return NULL;
}
//LOGD("Creating %dx%d texture", width, height);
LOGD("Creating %dx%d texture", width, height);
glActiveTexture(GL_TEXTURE0);
glGenTextures(1, &texture->id);

View File

@ -0,0 +1,18 @@
LOCAL_PATH := $(call my-dir)
# libs are prebuilt with termux
include $(CLEAR_VARS)
LOCAL_MODULE := android-support
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE).so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := ffi
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE).so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := wayland-server
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE).so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,665 @@
/*
* Copyright © 2008 Kristian Høgsberg
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef WAYLAND_SERVER_CORE_H
#define WAYLAND_SERVER_CORE_H
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include "wayland-util.h"
#include "wayland-version.h"
#ifdef __cplusplus
extern "C" {
#endif
enum {
WL_EVENT_READABLE = 0x01,
WL_EVENT_WRITABLE = 0x02,
WL_EVENT_HANGUP = 0x04,
WL_EVENT_ERROR = 0x08
};
/** File descriptor dispatch function type
*
* Functions of this type are used as callbacks for file descriptor events.
*
* \param fd The file descriptor delivering the event.
* \param mask Describes the kind of the event as a bitwise-or of:
* \c WL_EVENT_READABLE, \c WL_EVENT_WRITABLE, \c WL_EVENT_HANGUP,
* \c WL_EVENT_ERROR.
* \param data The user data argument of the related wl_event_loop_add_fd()
* call.
* \return If the event source is registered for re-check with
* wl_event_source_check(): 0 for all done, 1 for needing a re-check.
* If not registered, the return value is ignored and should be zero.
*
* \sa wl_event_loop_add_fd()
* \memberof wl_event_source
*/
typedef int (*wl_event_loop_fd_func_t)(int fd, uint32_t mask, void *data);
/** Timer dispatch function type
*
* Functions of this type are used as callbacks for timer expiry.
*
* \param data The user data argument of the related wl_event_loop_add_timer()
* call.
* \return If the event source is registered for re-check with
* wl_event_source_check(): 0 for all done, 1 for needing a re-check.
* If not registered, the return value is ignored and should be zero.
*
* \sa wl_event_loop_add_timer()
* \memberof wl_event_source
*/
typedef int (*wl_event_loop_timer_func_t)(void *data);
/** Signal dispatch function type
*
* Functions of this type are used as callbacks for (POSIX) signals.
*
* \param signal_number
* \param data The user data argument of the related wl_event_loop_add_signal()
* call.
* \return If the event source is registered for re-check with
* wl_event_source_check(): 0 for all done, 1 for needing a re-check.
* If not registered, the return value is ignored and should be zero.
*
* \sa wl_event_loop_add_signal()
* \memberof wl_event_source
*/
typedef int (*wl_event_loop_signal_func_t)(int signal_number, void *data);
/** Idle task function type
*
* Functions of this type are used as callbacks before blocking in
* wl_event_loop_dispatch().
*
* \param data The user data argument of the related wl_event_loop_add_idle()
* call.
*
* \sa wl_event_loop_add_idle() wl_event_loop_dispatch()
* \memberof wl_event_source
*/
typedef void (*wl_event_loop_idle_func_t)(void *data);
/** \struct wl_event_loop
*
* \brief An event loop context
*
* Usually you create an event loop context, add sources to it, and call
* wl_event_loop_dispatch() in a loop to process events.
*
* \sa wl_event_source
*/
/** \struct wl_event_source
*
* \brief An abstract event source
*
* This is the generic type for fd, timer, signal, and idle sources.
* Functions that operate on specific source types must not be used with
* a different type, even if the function signature allows it.
*/
struct wl_event_loop *
wl_event_loop_create(void);
void
wl_event_loop_destroy(struct wl_event_loop *loop);
struct wl_event_source *
wl_event_loop_add_fd(struct wl_event_loop *loop,
int fd, uint32_t mask,
wl_event_loop_fd_func_t func,
void *data);
int
wl_event_source_fd_update(struct wl_event_source *source, uint32_t mask);
struct wl_event_source *
wl_event_loop_add_timer(struct wl_event_loop *loop,
wl_event_loop_timer_func_t func,
void *data);
struct wl_event_source *
wl_event_loop_add_signal(struct wl_event_loop *loop,
int signal_number,
wl_event_loop_signal_func_t func,
void *data);
int
wl_event_source_timer_update(struct wl_event_source *source,
int ms_delay);
int
wl_event_source_remove(struct wl_event_source *source);
void
wl_event_source_check(struct wl_event_source *source);
int
wl_event_loop_dispatch(struct wl_event_loop *loop, int timeout);
void
wl_event_loop_dispatch_idle(struct wl_event_loop *loop);
struct wl_event_source *
wl_event_loop_add_idle(struct wl_event_loop *loop,
wl_event_loop_idle_func_t func,
void *data);
int
wl_event_loop_get_fd(struct wl_event_loop *loop);
struct wl_listener;
typedef void (*wl_notify_func_t)(struct wl_listener *listener, void *data);
void
wl_event_loop_add_destroy_listener(struct wl_event_loop *loop,
struct wl_listener *listener);
struct wl_listener *
wl_event_loop_get_destroy_listener(struct wl_event_loop *loop,
wl_notify_func_t notify);
struct wl_display *
wl_display_create(void);
void
wl_display_destroy(struct wl_display *display);
struct wl_event_loop *
wl_display_get_event_loop(struct wl_display *display);
int
wl_display_add_socket(struct wl_display *display, const char *name);
const char *
wl_display_add_socket_auto(struct wl_display *display);
int
wl_display_add_socket_fd(struct wl_display *display, int sock_fd);
void
wl_display_terminate(struct wl_display *display);
void
wl_display_run(struct wl_display *display);
void
wl_display_flush_clients(struct wl_display *display);
void
wl_display_destroy_clients(struct wl_display *display);
struct wl_client;
typedef void (*wl_global_bind_func_t)(struct wl_client *client, void *data,
uint32_t version, uint32_t id);
uint32_t
wl_display_get_serial(struct wl_display *display);
uint32_t
wl_display_next_serial(struct wl_display *display);
void
wl_display_add_destroy_listener(struct wl_display *display,
struct wl_listener *listener);
void
wl_display_add_client_created_listener(struct wl_display *display,
struct wl_listener *listener);
struct wl_listener *
wl_display_get_destroy_listener(struct wl_display *display,
wl_notify_func_t notify);
struct wl_global *
wl_global_create(struct wl_display *display,
const struct wl_interface *interface,
int version,
void *data, wl_global_bind_func_t bind);
void
wl_global_destroy(struct wl_global *global);
/** A filter function for wl_global objects
*
* \param client The client object
* \param global The global object to show or hide
* \param data The user data pointer
*
* A filter function enables the server to decide which globals to
* advertise to each client.
*
* When a wl_global filter is set, the given callback funtion will be
* called during wl_global advertisment and binding.
*
* This function should return true if the global object should be made
* visible to the client or false otherwise.
*/
typedef bool (*wl_display_global_filter_func_t)(const struct wl_client *client,
const struct wl_global *global,
void *data);
void
wl_display_set_global_filter(struct wl_display *display,
wl_display_global_filter_func_t filter,
void *data);
const struct wl_interface *
wl_global_get_interface(const struct wl_global *global);
void *
wl_global_get_user_data(const struct wl_global *global);
struct wl_client *
wl_client_create(struct wl_display *display, int fd);
struct wl_list *
wl_display_get_client_list(struct wl_display *display);
struct wl_list *
wl_client_get_link(struct wl_client *client);
struct wl_client *
wl_client_from_link(struct wl_list *link);
/** Iterate over a list of clients. */
#define wl_client_for_each(client, list) \
for (client = wl_client_from_link((list)->next); \
wl_client_get_link(client) != (list); \
client = wl_client_from_link(wl_client_get_link(client)->next))
void
wl_client_destroy(struct wl_client *client);
void
wl_client_flush(struct wl_client *client);
void
wl_client_get_credentials(struct wl_client *client,
pid_t *pid, uid_t *uid, gid_t *gid);
int
wl_client_get_fd(struct wl_client *client);
void
wl_client_add_destroy_listener(struct wl_client *client,
struct wl_listener *listener);
struct wl_listener *
wl_client_get_destroy_listener(struct wl_client *client,
wl_notify_func_t notify);
struct wl_resource *
wl_client_get_object(struct wl_client *client, uint32_t id);
void
wl_client_post_no_memory(struct wl_client *client);
void
wl_client_add_resource_created_listener(struct wl_client *client,
struct wl_listener *listener);
typedef enum wl_iterator_result (*wl_client_for_each_resource_iterator_func_t)(
struct wl_resource *resource,
void *user_data);
void
wl_client_for_each_resource(struct wl_client *client,
wl_client_for_each_resource_iterator_func_t iterator,
void *user_data);
/** \class wl_listener
*
* \brief A single listener for Wayland signals
*
* wl_listener provides the means to listen for wl_signal notifications. Many
* Wayland objects use wl_listener for notification of significant events like
* object destruction.
*
* Clients should create wl_listener objects manually and can register them as
* listeners to signals using #wl_signal_add, assuming the signal is
* directly accessible. For opaque structs like wl_event_loop, adding a
* listener should be done through provided accessor methods. A listener can
* only listen to one signal at a time.
*
* \code
* struct wl_listener your_listener;
*
* your_listener.notify = your_callback_method;
*
* // Direct access
* wl_signal_add(&some_object->destroy_signal, &your_listener);
*
* // Accessor access
* wl_event_loop *loop = ...;
* wl_event_loop_add_destroy_listener(loop, &your_listener);
* \endcode
*
* If the listener is part of a larger struct, #wl_container_of can be used
* to retrieve a pointer to it:
*
* \code
* void your_listener(struct wl_listener *listener, void *data)
* {
* struct your_data *data;
*
* your_data = wl_container_of(listener, data, your_member_name);
* }
* \endcode
*
* If you need to remove a listener from a signal, use wl_list_remove().
*
* \code
* wl_list_remove(&your_listener.link);
* \endcode
*
* \sa wl_signal
*/
struct wl_listener {
struct wl_list link;
wl_notify_func_t notify;
};
/** \class wl_signal
*
* \brief A source of a type of observable event
*
* Signals are recognized points where significant events can be observed.
* Compositors as well as the server can provide signals. Observers are
* wl_listener's that are added through #wl_signal_add. Signals are emitted
* using #wl_signal_emit, which will invoke all listeners until that
* listener is removed by wl_list_remove() (or whenever the signal is
* destroyed).
*
* \sa wl_listener for more information on using wl_signal
*/
struct wl_signal {
struct wl_list listener_list;
};
/** Initialize a new \ref wl_signal for use.
*
* \param signal The signal that will be initialized
*
* \memberof wl_signal
*/
static inline void
wl_signal_init(struct wl_signal *signal)
{
wl_list_init(&signal->listener_list);
}
/** Add the specified listener to this signal.
*
* \param signal The signal that will emit events to the listener
* \param listener The listener to add
*
* \memberof wl_signal
*/
static inline void
wl_signal_add(struct wl_signal *signal, struct wl_listener *listener)
{
wl_list_insert(signal->listener_list.prev, &listener->link);
}
/** Gets the listener struct for the specified callback.
*
* \param signal The signal that contains the specified listener
* \param notify The listener that is the target of this search
* \return the list item that corresponds to the specified listener, or NULL
* if none was found
*
* \memberof wl_signal
*/
static inline struct wl_listener *
wl_signal_get(struct wl_signal *signal, wl_notify_func_t notify)
{
struct wl_listener *l;
wl_list_for_each(l, &signal->listener_list, link)
if (l->notify == notify)
return l;
return NULL;
}
/** Emits this signal, notifying all registered listeners.
*
* \param signal The signal object that will emit the signal
* \param data The data that will be emitted with the signal
*
* \memberof wl_signal
*/
static inline void
wl_signal_emit(struct wl_signal *signal, void *data)
{
struct wl_listener *l, *next;
wl_list_for_each_safe(l, next, &signal->listener_list, link)
l->notify(l, data);
}
typedef void (*wl_resource_destroy_func_t)(struct wl_resource *resource);
/*
* Post an event to the client's object referred to by 'resource'.
* 'opcode' is the event number generated from the protocol XML
* description (the event name). The variable arguments are the event
* parameters, in the order they appear in the protocol XML specification.
*
* The variable arguments' types are:
* - type=uint: uint32_t
* - type=int: int32_t
* - type=fixed: wl_fixed_t
* - type=string: (const char *) to a nil-terminated string
* - type=array: (struct wl_array *)
* - type=fd: int, that is an open file descriptor
* - type=new_id: (struct wl_object *) or (struct wl_resource *)
* - type=object: (struct wl_object *) or (struct wl_resource *)
*/
void
wl_resource_post_event(struct wl_resource *resource,
uint32_t opcode, ...);
void
wl_resource_post_event_array(struct wl_resource *resource,
uint32_t opcode, union wl_argument *args);
void
wl_resource_queue_event(struct wl_resource *resource,
uint32_t opcode, ...);
void
wl_resource_queue_event_array(struct wl_resource *resource,
uint32_t opcode, union wl_argument *args);
/* msg is a printf format string, variable args are its args. */
void
wl_resource_post_error(struct wl_resource *resource,
uint32_t code, const char *msg, ...) WL_PRINTF(3, 4);
void
wl_resource_post_no_memory(struct wl_resource *resource);
struct wl_display *
wl_client_get_display(struct wl_client *client);
struct wl_resource *
wl_resource_create(struct wl_client *client,
const struct wl_interface *interface,
int version, uint32_t id);
void
wl_resource_set_implementation(struct wl_resource *resource,
const void *implementation,
void *data,
wl_resource_destroy_func_t destroy);
void
wl_resource_set_dispatcher(struct wl_resource *resource,
wl_dispatcher_func_t dispatcher,
const void *implementation,
void *data,
wl_resource_destroy_func_t destroy);
void
wl_resource_destroy(struct wl_resource *resource);
uint32_t
wl_resource_get_id(struct wl_resource *resource);
struct wl_list *
wl_resource_get_link(struct wl_resource *resource);
struct wl_resource *
wl_resource_from_link(struct wl_list *resource);
struct wl_resource *
wl_resource_find_for_client(struct wl_list *list, struct wl_client *client);
struct wl_client *
wl_resource_get_client(struct wl_resource *resource);
void
wl_resource_set_user_data(struct wl_resource *resource, void *data);
void *
wl_resource_get_user_data(struct wl_resource *resource);
int
wl_resource_get_version(struct wl_resource *resource);
void
wl_resource_set_destructor(struct wl_resource *resource,
wl_resource_destroy_func_t destroy);
int
wl_resource_instance_of(struct wl_resource *resource,
const struct wl_interface *interface,
const void *implementation);
const char *
wl_resource_get_class(struct wl_resource *resource);
void
wl_resource_add_destroy_listener(struct wl_resource *resource,
struct wl_listener *listener);
struct wl_listener *
wl_resource_get_destroy_listener(struct wl_resource *resource,
wl_notify_func_t notify);
#define wl_resource_for_each(resource, list) \
for (resource = 0, resource = wl_resource_from_link((list)->next); \
wl_resource_get_link(resource) != (list); \
resource = wl_resource_from_link(wl_resource_get_link(resource)->next))
#define wl_resource_for_each_safe(resource, tmp, list) \
for (resource = 0, tmp = 0, \
resource = wl_resource_from_link((list)->next), \
tmp = wl_resource_from_link((list)->next->next); \
wl_resource_get_link(resource) != (list); \
resource = tmp, \
tmp = wl_resource_from_link(wl_resource_get_link(resource)->next))
struct wl_shm_buffer *
wl_shm_buffer_get(struct wl_resource *resource);
void
wl_shm_buffer_begin_access(struct wl_shm_buffer *buffer);
void
wl_shm_buffer_end_access(struct wl_shm_buffer *buffer);
void *
wl_shm_buffer_get_data(struct wl_shm_buffer *buffer);
int32_t
wl_shm_buffer_get_stride(struct wl_shm_buffer *buffer);
uint32_t
wl_shm_buffer_get_format(struct wl_shm_buffer *buffer);
int32_t
wl_shm_buffer_get_width(struct wl_shm_buffer *buffer);
int32_t
wl_shm_buffer_get_height(struct wl_shm_buffer *buffer);
struct wl_shm_pool *
wl_shm_buffer_ref_pool(struct wl_shm_buffer *buffer);
void
wl_shm_pool_unref(struct wl_shm_pool *pool);
int
wl_display_init_shm(struct wl_display *display);
uint32_t *
wl_display_add_shm_format(struct wl_display *display, uint32_t format);
struct wl_shm_buffer *
wl_shm_buffer_create(struct wl_client *client,
uint32_t id, int32_t width, int32_t height,
int32_t stride, uint32_t format) WL_DEPRECATED;
void
wl_log_set_handler_server(wl_log_func_t handler);
enum wl_protocol_logger_type {
WL_PROTOCOL_LOGGER_REQUEST,
WL_PROTOCOL_LOGGER_EVENT,
};
struct wl_protocol_logger_message {
struct wl_resource *resource;
int message_opcode;
const struct wl_message *message;
int arguments_count;
const union wl_argument *arguments;
};
typedef void (*wl_protocol_logger_func_t)(void *user_data,
enum wl_protocol_logger_type direction,
const struct wl_protocol_logger_message *message);
struct wl_protocol_logger *
wl_display_add_protocol_logger(struct wl_display *display,
wl_protocol_logger_func_t, void *user_data);
void
wl_protocol_logger_destroy(struct wl_protocol_logger *logger);
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,106 @@
/*
* Copyright © 2008 Kristian Høgsberg
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/** \file
*
* \brief Include the server API, deprecations and protocol C API.
*
* \warning Use of this header file is discouraged. Prefer including
* wayland-server-core.h instead, which does not include the
* server protocol header and as such only defines the library
* API, excluding the deprecated API below.
*/
#ifndef WAYLAND_SERVER_H
#define WAYLAND_SERVER_H
#include <stdint.h>
#include "wayland-server-core.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* The user can set this macro to hide the wl_object, wl_resource and wl_buffer
* objects alongside the associated API.
*
* The structs were meant to be opaque, although we missed that in the early days.
*
* NOTE: the list of structs, functions, etc in this section MUST NEVER GROW.
* Otherwise we will break forward compatibility and applications that used to
* build fine will no longer be able to do so.
*/
#ifndef WL_HIDE_DEPRECATED
struct wl_object {
const struct wl_interface *interface;
const void *implementation;
uint32_t id;
};
struct wl_resource {
struct wl_object object;
wl_resource_destroy_func_t destroy;
struct wl_list link;
struct wl_signal destroy_signal;
struct wl_client *client;
void *data;
};
uint32_t
wl_client_add_resource(struct wl_client *client,
struct wl_resource *resource) WL_DEPRECATED;
struct wl_resource *
wl_client_add_object(struct wl_client *client,
const struct wl_interface *interface,
const void *implementation,
uint32_t id, void *data) WL_DEPRECATED;
struct wl_resource *
wl_client_new_object(struct wl_client *client,
const struct wl_interface *interface,
const void *implementation, void *data) WL_DEPRECATED;
struct wl_global *
wl_display_add_global(struct wl_display *display,
const struct wl_interface *interface,
void *data,
wl_global_bind_func_t bind) WL_DEPRECATED;
void
wl_display_remove_global(struct wl_display *display,
struct wl_global *global) WL_DEPRECATED;
#endif
#ifdef __cplusplus
}
#endif
#include "wayland-server-protocol.h"
#endif

View File

@ -0,0 +1,751 @@
/*
* Copyright © 2008 Kristian Høgsberg
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/** \file wayland-util.h
*
* \brief Utility classes, functions, and macros.
*/
#ifndef WAYLAND_UTIL_H
#define WAYLAND_UTIL_H
#include <math.h>
#include <stddef.h>
#include <inttypes.h>
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif
/** Visibility attribute */
#if defined(__GNUC__) && __GNUC__ >= 4
#define WL_EXPORT __attribute__ ((visibility("default")))
#else
#define WL_EXPORT
#endif
/** Deprecated attribute */
#if defined(__GNUC__) && __GNUC__ >= 4
#define WL_DEPRECATED __attribute__ ((deprecated))
#else
#define WL_DEPRECATED
#endif
/**
* Printf-style argument attribute
*
* \param x Ordinality of the format string argument
* \param y Ordinality of the argument to check against the format string
*
* \sa https://gcc.gnu.org/onlinedocs/gcc-3.2.1/gcc/Function-Attributes.html
*/
#if defined(__GNUC__) && __GNUC__ >= 4
#define WL_PRINTF(x, y) __attribute__((__format__(__printf__, x, y)))
#else
#define WL_PRINTF(x, y)
#endif
/**
* Protocol message signature
*
* A wl_message describes the signature of an actual protocol message, such as a
* request or event, that adheres to the Wayland protocol wire format. The
* protocol implementation uses a wl_message within its demarshal machinery for
* decoding messages between a compositor and its clients. In a sense, a
* wl_message is to a protocol message like a class is to an object.
*
* The `name` of a wl_message is the name of the corresponding protocol message.
*
* The `signature` is an ordered list of symbols representing the data types
* of message arguments and, optionally, a protocol version and indicators for
* nullability. A leading integer in the `signature` indicates the _since_
* version of the protocol message. A `?` preceding a data type symbol indicates
* that the following argument type is nullable. While it is a protocol violation
* to send messages with non-nullable arguments set to `NULL`, event handlers in
* clients might still get called with non-nullable object arguments set to
* `NULL`. This can happen when the client destroyed the object being used as
* argument on its side and an event referencing that object was sent before the
* server knew about its destruction. As this race cannot be prevented, clients
* should - as a general rule - program their event handlers such that they can
* handle object arguments declared non-nullable being `NULL` gracefully.
*
* When no arguments accompany a message, `signature` is an empty string.
*
* Symbols:
*
* * `i`: int
* * `u`: uint
* * `f`: fixed
* * `s`: string
* * `o`: object
* * `n`: new_id
* * `a`: array
* * `h`: fd
* * `?`: following argument is nullable
*
* While demarshaling primitive arguments is straightforward, when demarshaling
* messages containing `object` or `new_id` arguments, the protocol
* implementation often must determine the type of the object. The `types` of a
* wl_message is an array of wl_interface references that correspond to `o` and
* `n` arguments in `signature`, with `NULL` placeholders for arguments with
* non-object types.
*
* Consider the protocol event wl_display `delete_id` that has a single `uint`
* argument. The wl_message is:
*
* \code
* { "delete_id", "u", [NULL] }
* \endcode
*
* Here, the message `name` is `"delete_id"`, the `signature` is `"u"`, and the
* argument `types` is `[NULL]`, indicating that the `uint` argument has no
* corresponding wl_interface since it is a primitive argument.
*
* In contrast, consider a `wl_foo` interface supporting protocol request `bar`
* that has existed since version 2, and has two arguments: a `uint` and an
* object of type `wl_baz_interface` that may be `NULL`. Such a `wl_message`
* might be:
*
* \code
* { "bar", "2u?o", [NULL, &wl_baz_interface] }
* \endcode
*
* Here, the message `name` is `"bar"`, and the `signature` is `"2u?o"`. Notice
* how the `2` indicates the protocol version, the `u` indicates the first
* argument type is `uint`, and the `?o` indicates that the second argument
* is an object that may be `NULL`. Lastly, the argument `types` array indicates
* that no wl_interface corresponds to the first argument, while the type
* `wl_baz_interface` corresponds to the second argument.
*
* \sa wl_argument
* \sa wl_interface
* \sa <a href="https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-Wire-Format">Wire Format</a>
*/
struct wl_message {
/** Message name */
const char *name;
/** Message signature */
const char *signature;
/** Object argument interfaces */
const struct wl_interface **types;
};
/**
* Protocol object interface
*
* A wl_interface describes the API of a protocol object defined in the Wayland
* protocol specification. The protocol implementation uses a wl_interface
* within its marshalling machinery for encoding client requests.
*
* The `name` of a wl_interface is the name of the corresponding protocol
* interface, and `version` represents the version of the interface. The members
* `method_count` and `event_count` represent the number of `methods` (requests)
* and `events` in the respective wl_message members.
*
* For example, consider a protocol interface `foo`, marked as version `1`, with
* two requests and one event.
*
* \code
* <interface name="foo" version="1">
* <request name="a"></request>
* <request name="b"></request>
* <event name="c"></event>
* </interface>
* \endcode
*
* Given two wl_message arrays `foo_requests` and `foo_events`, a wl_interface
* for `foo` might be:
*
* \code
* struct wl_interface foo_interface = {
* "foo", 1,
* 2, foo_requests,
* 1, foo_events
* };
* \endcode
*
* \note The server side of the protocol may define interface <em>implementation
* types</em> that incorporate the term `interface` in their name. Take
* care to not confuse these server-side `struct`s with a wl_interface
* variable whose name also ends in `interface`. For example, while the
* server may define a type `struct wl_foo_interface`, the client may
* define a `struct wl_interface wl_foo_interface`.
*
* \sa wl_message
* \sa wl_proxy
* \sa <a href="https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-Interfaces">Interfaces</a>
* \sa <a href="https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-Versioning">Versioning</a>
*/
struct wl_interface {
/** Interface name */
const char *name;
/** Interface version */
int version;
/** Number of methods (requests) */
int method_count;
/** Method (request) signatures */
const struct wl_message *methods;
/** Number of events */
int event_count;
/** Event signatures */
const struct wl_message *events;
};
/** \class wl_list
*
* \brief Doubly-linked list
*
* On its own, an instance of `struct wl_list` represents the sentinel head of
* a doubly-linked list, and must be initialized using wl_list_init().
* When empty, the list head's `next` and `prev` members point to the list head
* itself, otherwise `next` references the first element in the list, and `prev`
* refers to the last element in the list.
*
* Use the `struct wl_list` type to represent both the list head and the links
* between elements within the list. Use wl_list_empty() to determine if the
* list is empty in O(1).
*
* All elements in the list must be of the same type. The element type must have
* a `struct wl_list` member, often named `link` by convention. Prior to
* insertion, there is no need to initialize an element's `link` - invoking
* wl_list_init() on an individual list element's `struct wl_list` member is
* unnecessary if the very next operation is wl_list_insert(). However, a
* common idiom is to initialize an element's `link` prior to removal - ensure
* safety by invoking wl_list_init() before wl_list_remove().
*
* Consider a list reference `struct wl_list foo_list`, an element type as
* `struct element`, and an element's link member as `struct wl_list link`.
*
* The following code initializes a list and adds three elements to it.
*
* \code
* struct wl_list foo_list;
*
* struct element {
* int foo;
* struct wl_list link;
* };
* struct element e1, e2, e3;
*
* wl_list_init(&foo_list);
* wl_list_insert(&foo_list, &e1.link); // e1 is the first element
* wl_list_insert(&foo_list, &e2.link); // e2 is now the first element
* wl_list_insert(&e2.link, &e3.link); // insert e3 after e2
* \endcode
*
* The list now looks like <em>[e2, e3, e1]</em>.
*
* The `wl_list` API provides some iterator macros. For example, to iterate
* a list in ascending order:
*
* \code
* struct element *e;
* wl_list_for_each(e, foo_list, link) {
* do_something_with_element(e);
* }
* \endcode
*
* See the documentation of each iterator for details.
* \sa http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/linux/list.h
*/
struct wl_list {
/** Previous list element */
struct wl_list *prev;
/** Next list element */
struct wl_list *next;
};
/**
* Initializes the list.
*
* \param list List to initialize
*
* \memberof wl_list
*/
void
wl_list_init(struct wl_list *list);
/**
* Inserts an element into the list, after the element represented by \p list.
* When \p list is a reference to the list itself (the head), set the containing
* struct of \p elm as the first element in the list.
*
* \note If \p elm is already part of a list, inserting it again will lead to
* list corruption.
*
* \param list List element after which the new element is inserted
* \param elm Link of the containing struct to insert into the list
*
* \memberof wl_list
*/
void
wl_list_insert(struct wl_list *list, struct wl_list *elm);
/**
* Removes an element from the list.
*
* \note This operation leaves \p elm in an invalid state.
*
* \param elm Link of the containing struct to remove from the list
*
* \memberof wl_list
*/
void
wl_list_remove(struct wl_list *elm);
/**
* Determines the length of the list.
*
* \note This is an O(n) operation.
*
* \param list List whose length is to be determined
*
* \return Number of elements in the list
*
* \memberof wl_list
*/
int
wl_list_length(const struct wl_list *list);
/**
* Determines if the list is empty.
*
* \param list List whose emptiness is to be determined
*
* \return 1 if empty, or 0 if not empty
*
* \memberof wl_list
*/
int
wl_list_empty(const struct wl_list *list);
/**
* Inserts all of the elements of one list into another, after the element
* represented by \p list.
*
* \note This leaves \p other in an invalid state.
*
* \param list List element after which the other list elements will be inserted
* \param other List of elements to insert
*
* \memberof wl_list
*/
void
wl_list_insert_list(struct wl_list *list, struct wl_list *other);
/**
* Retrieves a pointer to a containing struct, given a member name.
*
* This macro allows "conversion" from a pointer to a member to its containing
* struct. This is useful if you have a contained item like a wl_list,
* wl_listener, or wl_signal, provided via a callback or other means, and would
* like to retrieve the struct that contains it.
*
* To demonstrate, the following example retrieves a pointer to
* `example_container` given only its `destroy_listener` member:
*
* \code
* struct example_container {
* struct wl_listener destroy_listener;
* // other members...
* };
*
* void example_container_destroy(struct wl_listener *listener, void *data)
* {
* struct example_container *ctr;
*
* ctr = wl_container_of(listener, ctr, destroy_listener);
* // destroy ctr...
* }
* \endcode
*
* \note `sample` need not be a valid pointer. A null or uninitialised pointer
* is sufficient.
*
* \param ptr Valid pointer to the contained member
* \param sample Pointer to a struct whose type contains \p ptr
* \param member Named location of \p ptr within the \p sample type
*
* \return The container for the specified pointer
*/
#define wl_container_of(ptr, sample, member) \
(__typeof__(sample))((char *)(ptr) - \
offsetof(__typeof__(*sample), member))
/**
* Iterates over a list.
*
* This macro expresses a for-each iterator for wl_list. Given a list and
* wl_list link member name (often named `link` by convention), this macro
* assigns each element in the list to \p pos, which can then be referenced in
* a trailing code block. For example, given a wl_list of `struct message`
* elements:
*
* \code
* struct message {
* char *contents;
* wl_list link;
* };
*
* struct wl_list *message_list;
* // Assume message_list now "contains" many messages
*
* struct message *m;
* wl_list_for_each(m, message_list, link) {
* do_something_with_message(m);
* }
* \endcode
*
* \param pos Cursor that each list element will be assigned to
* \param head Head of the list to iterate over
* \param member Name of the link member within the element struct
*
* \relates wl_list
*/
#define wl_list_for_each(pos, head, member) \
for (pos = wl_container_of((head)->next, pos, member); \
&pos->member != (head); \
pos = wl_container_of(pos->member.next, pos, member))
/**
* Iterates over a list, safe against removal of the list element.
*
* \note Only removal of the current element, \p pos, is safe. Removing
* any other element during traversal may lead to a loop malfunction.
*
* \sa wl_list_for_each()
*
* \param pos Cursor that each list element will be assigned to
* \param tmp Temporary pointer of the same type as \p pos
* \param head Head of the list to iterate over
* \param member Name of the link member within the element struct
*
* \relates wl_list
*/
#define wl_list_for_each_safe(pos, tmp, head, member) \
for (pos = wl_container_of((head)->next, pos, member), \
tmp = wl_container_of((pos)->member.next, tmp, member); \
&pos->member != (head); \
pos = tmp, \
tmp = wl_container_of(pos->member.next, tmp, member))
/**
* Iterates backwards over a list.
*
* \sa wl_list_for_each()
*
* \param pos Cursor that each list element will be assigned to
* \param head Head of the list to iterate over
* \param member Name of the link member within the element struct
*
* \relates wl_list
*/
#define wl_list_for_each_reverse(pos, head, member) \
for (pos = wl_container_of((head)->prev, pos, member); \
&pos->member != (head); \
pos = wl_container_of(pos->member.prev, pos, member))
/**
* Iterates backwards over a list, safe against removal of the list element.
*
* \note Only removal of the current element, \p pos, is safe. Removing
* any other element during traversal may lead to a loop malfunction.
*
* \sa wl_list_for_each()
*
* \param pos Cursor that each list element will be assigned to
* \param tmp Temporary pointer of the same type as \p pos
* \param head Head of the list to iterate over
* \param member Name of the link member within the element struct
*
* \relates wl_list
*/
#define wl_list_for_each_reverse_safe(pos, tmp, head, member) \
for (pos = wl_container_of((head)->prev, pos, member), \
tmp = wl_container_of((pos)->member.prev, tmp, member); \
&pos->member != (head); \
pos = tmp, \
tmp = wl_container_of(pos->member.prev, tmp, member))
/**
* \class wl_array
*
* Dynamic array
*
* A wl_array is a dynamic array that can only grow until released. It is
* intended for relatively small allocations whose size is variable or not known
* in advance. While construction of a wl_array does not require all elements to
* be of the same size, wl_array_for_each() does require all elements to have
* the same type and size.
*
*/
struct wl_array {
/** Array size */
size_t size;
/** Allocated space */
size_t alloc;
/** Array data */
void *data;
};
/**
* Initializes the array.
*
* \param array Array to initialize
*
* \memberof wl_array
*/
void
wl_array_init(struct wl_array *array);
/**
* Releases the array data.
*
* \note Leaves the array in an invalid state.
*
* \param array Array whose data is to be released
*
* \memberof wl_array
*/
void
wl_array_release(struct wl_array *array);
/**
* Increases the size of the array by \p size bytes.
*
* \param array Array whose size is to be increased
* \param size Number of bytes to increase the size of the array by
*
* \return A pointer to the beginning of the newly appended space, or NULL when
* resizing fails.
*
* \memberof wl_array
*/
void *
wl_array_add(struct wl_array *array, size_t size);
/**
* Copies the contents of \p source to \p array.
*
* \param array Destination array to copy to
* \param source Source array to copy from
*
* \return 0 on success, or -1 on failure
*
* \memberof wl_array
*/
int
wl_array_copy(struct wl_array *array, struct wl_array *source);
/**
* Iterates over an array.
*
* This macro expresses a for-each iterator for wl_array. It assigns each
* element in the array to \p pos, which can then be referenced in a trailing
* code block. \p pos must be a pointer to the array element type, and all
* array elements must be of the same type and size.
*
* \param pos Cursor that each array element will be assigned to
* \param array Array to iterate over
*
* \relates wl_array
* \sa wl_list_for_each()
*/
#define wl_array_for_each(pos, array) \
for (pos = (array)->data; \
(const char *) pos < ((const char *) (array)->data + (array)->size); \
(pos)++)
/**
* Fixed-point number
*
* A `wl_fixed_t` is a 24.8 signed fixed-point number with a sign bit, 23 bits
* of integer precision and 8 bits of decimal precision. Consider `wl_fixed_t`
* as an opaque struct with methods that facilitate conversion to and from
* `double` and `int` types.
*/
typedef int32_t wl_fixed_t;
/**
* Converts a fixed-point number to a floating-point number.
*
* \param f Fixed-point number to convert
*
* \return Floating-point representation of the fixed-point argument
*/
static inline double
wl_fixed_to_double(wl_fixed_t f)
{
union {
double d;
int64_t i;
} u;
u.i = ((1023LL + 44LL) << 52) + (1LL << 51) + f;
return u.d - (3LL << 43);
}
/**
* Converts a floating-point number to a fixed-point number.
*
* \param d Floating-point number to convert
*
* \return Fixed-point representation of the floating-point argument
*/
static inline wl_fixed_t
wl_fixed_from_double(double d)
{
union {
double d;
int64_t i;
} u;
u.d = d + (3LL << (51 - 8));
return u.i;
}
/**
* Converts a fixed-point number to an integer.
*
* \param f Fixed-point number to convert
*
* \return Integer component of the fixed-point argument
*/
static inline int
wl_fixed_to_int(wl_fixed_t f)
{
return f / 256;
}
/**
* Converts an integer to a fixed-point number.
*
* \param i Integer to convert
*
* \return Fixed-point representation of the integer argument
*/
static inline wl_fixed_t
wl_fixed_from_int(int i)
{
return i * 256;
}
/**
* Protocol message argument data types
*
* This union represents all of the argument types in the Wayland protocol wire
* format. The protocol implementation uses wl_argument within its marshalling
* machinery for dispatching messages between a client and a compositor.
*
* \sa wl_message
* \sa wl_interface
* \sa <a href="https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-wire-Format">Wire Format</a>
*/
union wl_argument {
int32_t i; /**< `int` */
uint32_t u; /**< `uint` */
wl_fixed_t f; /**< `fixed` */
const char *s; /**< `string` */
struct wl_object *o; /**< `object` */
uint32_t n; /**< `new_id` */
struct wl_array *a; /**< `array` */
int32_t h; /**< `fd` */
};
/**
* Dispatcher function type alias
*
* A dispatcher is a function that handles the emitting of callbacks in client
* code. For programs directly using the C library, this is done by using
* libffi to call function pointers. When binding to languages other than C,
* dispatchers provide a way to abstract the function calling process to be
* friendlier to other function calling systems.
*
* A dispatcher takes five arguments: The first is the dispatcher-specific
* implementation associated with the target object. The second is the object
* upon which the callback is being invoked (either wl_proxy or wl_resource).
* The third and fourth arguments are the opcode and the wl_message
* corresponding to the callback. The final argument is an array of arguments
* received from the other process via the wire protocol.
*
* \param "const void *" Dispatcher-specific implementation data
* \param "void *" Callback invocation target (wl_proxy or `wl_resource`)
* \param uint32_t Callback opcode
* \param "const struct wl_message *" Callback message signature
* \param "union wl_argument *" Array of received arguments
*
* \return 0 on success, or -1 on failure
*/
typedef int (*wl_dispatcher_func_t)(const void *, void *, uint32_t,
const struct wl_message *,
union wl_argument *);
/**
* Log function type alias
*
* The C implementation of the Wayland protocol abstracts the details of
* logging. Users may customize the logging behavior, with a function conforming
* to the `wl_log_func_t` type, via `wl_log_set_handler_client` and
* `wl_log_set_handler_server`.
*
* A `wl_log_func_t` must conform to the expectations of `vprintf`, and
* expects two arguments: a string to write and a corresponding variable
* argument list. While the string to write may contain format specifiers and
* use values in the variable argument list, the behavior of any `wl_log_func_t`
* depends on the implementation.
*
* \note Take care to not confuse this with `wl_protocol_logger_func_t`, which
* is a specific server-side logger for requests and events.
*
* \param "const char *" String to write to the log, containing optional format
* specifiers
* \param "va_list" Variable argument list
*
* \sa wl_log_set_handler_client
* \sa wl_log_set_handler_server
*/
typedef void (*wl_log_func_t)(const char *, va_list) WL_PRINTF(1, 0);
/**
* Return value of an iterator function
*
* \sa wl_client_for_each_resource_iterator_func_t
* \sa wl_client_for_each_resource
*/
enum wl_iterator_result {
/** Stop the iteration */
WL_ITERATOR_STOP,
/** Continue the iteration */
WL_ITERATOR_CONTINUE
};
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,34 @@
/*
* Copyright © 2012 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef WAYLAND_VERSION_H
#define WAYLAND_VERSION_H
#define WAYLAND_VERSION_MAJOR 1
#define WAYLAND_VERSION_MINOR 16
#define WAYLAND_VERSION_MICRO 0
#define WAYLAND_VERSION "1.16.0"
#endif

View File

@ -0,0 +1,34 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeWidth="1"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

View File

@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#008577"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<SurfaceView
android:id="@+id/WestonView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible"
tools:visibility="visible" />
<LinearLayout
android:id="@+id/MenuHolder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"></LinearLayout>
</FrameLayout>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
</resources>

View File

@ -0,0 +1,3 @@
<resources>
<string name="app_name">WTermux</string>
</resources>

View File

@ -0,0 +1,16 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="NoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>

27
build.gradle Normal file
View File

@ -0,0 +1,27 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

15
gradle.properties Normal file
View File

@ -0,0 +1,15 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,6 @@
#Tue Jun 25 16:06:19 IDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

172
gradlew vendored Executable file
View File

@ -0,0 +1,172 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

84
gradlew.bat vendored Normal file
View File

@ -0,0 +1,84 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

9
local.properties Normal file
View File

@ -0,0 +1,9 @@
## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Tue Jun 25 16:06:37 IDT 2019
ndk.dir=/opt/AndroidSdk/ndk-bundle
sdk.dir=/opt/AndroidSdk

1
settings.gradle Normal file
View File

@ -0,0 +1 @@
include ':app'