diff options
author | Ecmel Berk Canlıer | 2021-06-25 00:48:24 +0300 |
---|---|---|
committer | Ecmel Berk Canlıer | 2021-06-25 12:00:24 +0300 |
commit | ceda97a3f0717050f27093ed2b6682b29415e8d1 (patch) | |
tree | 55e6a6bd1c17d422ade45bd5fd9a7f16f0d5039e | |
download | aur-ceda97a3f0717050f27093ed2b6682b29415e8d1.tar.gz |
Prepare for AUR
AUR required me to include .SRCINFO in the root commit, and honestly I
couldn't be bothered with keeping the history.
-rw-r--r-- | .SRCINFO | 37 | ||||
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | 0001-set-O_NONBLOCK-on-repeat-timerfd.patch | 28 | ||||
-rw-r--r-- | 0002-Don-t-crash-on-calls-to-focus-or-icon.patch | 36 | ||||
-rw-r--r-- | 0003-fix-broken-opengl-screenshots-on-mutter.patch | 33 | ||||
-rw-r--r-- | 0004-Do-not-crash-on-window-position-set.patch | 27 | ||||
-rw-r--r-- | PKGBUILD | 60 | ||||
-rw-r--r-- | README.md | 90 |
8 files changed, 317 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..18a39a82e403 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,37 @@ +pkgbase = glfw-wayland-minecraft + pkgdesc = A free, open source, portable framework for graphical application development (wayland, patched for Minecraft) + pkgver = 3.3.4 + pkgrel = 2 + url = https://www.glfw.org/ + arch = x86_64 + license = custom:ZLIB + makedepends = mesa + makedepends = cmake + makedepends = doxygen + makedepends = vulkan-headers + makedepends = vulkan-icd-loader + makedepends = extra-cmake-modules + makedepends = wayland-protocols + makedepends = libxi + makedepends = libxrandr + makedepends = libxcursor + makedepends = libxkbcommon + makedepends = libxinerama + depends = wayland + depends = libxkbcommon + depends = libgl + provides = glfw=3.3.4 + conflicts = glfw + conflicts = glfw-wayland + source = https://github.com/glfw/glfw/archive/3.3.4.tar.gz + source = 0001-set-O_NONBLOCK-on-repeat-timerfd.patch + source = 0002-Don-t-crash-on-calls-to-focus-or-icon.patch + source = 0003-fix-broken-opengl-screenshots-on-mutter.patch + source = 0004-Do-not-crash-on-window-position-set.patch + sha512sums = 2b45ab72da7a2c007c0f42ccd56205f9684cfb980e2b1df127850cd057bb2b02ce02c7c64acd54cd433778e7017148f214afedf09badff9d2edf5f9b8d9d2701 + sha512sums = e90c5995f405dc5d0581c597719fb1bf0d9335cec162506e34e37c676a4d6eee4a50f2c9d5d1bd1a27f3668ea4a0570db24a10aad7145cd8688e25523d497de8 + sha512sums = 02fbbb28f6f6ffae3b5b32aac76218b917229e491981e4576054e96a78c7a3dfec3f3b2ffb939d47188b5d47681805c05d66b6fd75ad18b1d225655187ddfb9a + sha512sums = 3ca405894fb3549c0bba69fd9f3b5bc5ade1d010e5d82a76c8c2684fd8f008976ad81344b842993a6620e7935c177c524acd2bf1d43c9790dd404a845bdcef72 + sha512sums = 77732e58d6a6b3406ded5aa208b77bcdcaee808ed9a624ea2f41331a1231a96589bb0608d88835f7081f1fdb8b538e63f9cdc8d8fdbb0ce4b1d588c667782af1 + +pkgname = glfw-wayland-minecraft diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..d53251af9d26 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +* +!*.patch +!.SRCINFO +!.gitignore +!PKGBUILD +!README.md
\ No newline at end of file diff --git a/0001-set-O_NONBLOCK-on-repeat-timerfd.patch b/0001-set-O_NONBLOCK-on-repeat-timerfd.patch new file mode 100644 index 000000000000..3d24c220f741 --- /dev/null +++ b/0001-set-O_NONBLOCK-on-repeat-timerfd.patch @@ -0,0 +1,28 @@ +From f57907bf3bbce52fbf2c5ca10206ad2b660f6cda Mon Sep 17 00:00:00 2001 +From: Stone Tickle <lattis@mochiro.moe> +Date: Fri, 5 Jun 2020 12:51:25 +0900 +Subject: [PATCH 1/3] set O_NONBLOCK on repeat timerfd + +--- + src/wl_init.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/wl_init.c b/src/wl_init.c +index 49e7cc52..7d90e6ee 100644 +--- a/src/wl_init.c ++++ b/src/wl_init.c +@@ -1165,8 +1165,9 @@ int _glfwPlatformInit(void) + _glfwInitTimerPOSIX(); + + _glfw.wl.timerfd = -1; +- if (_glfw.wl.seatVersion >= 4) +- _glfw.wl.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC); ++ if (_glfw.wl.seatVersion >= 4) { ++ _glfw.wl.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK); ++ } + + if (_glfw.wl.pointer && _glfw.wl.shm) + { +-- +2.32.0 + diff --git a/0002-Don-t-crash-on-calls-to-focus-or-icon.patch b/0002-Don-t-crash-on-calls-to-focus-or-icon.patch new file mode 100644 index 000000000000..7fdb135903c3 --- /dev/null +++ b/0002-Don-t-crash-on-calls-to-focus-or-icon.patch @@ -0,0 +1,36 @@ +From db9b89fad9058172a844fe0a9faaae5a477c3fb3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ecmel=20Berk=20Canl=C4=B1er?= <me@ecmelberk.com> +Date: Fri, 25 Jun 2021 01:00:01 +0300 +Subject: [PATCH 2/3] Don't crash on calls to focus or icon + +Manually applying the following commit + https://github.com/glfw/glfw/pull/1725/commits/e89e9aee41382508ed36594a4b028239cad5197b +--- + src/wl_window.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/src/wl_window.c b/src/wl_window.c +index d10861cd..3f8987b8 100644 +--- a/src/wl_window.c ++++ b/src/wl_window.c +@@ -1047,8 +1047,6 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) + void _glfwPlatformSetWindowIcon(_GLFWwindow* window, + int count, const GLFWimage* images) + { +- _glfwInputError(GLFW_PLATFORM_ERROR, +- "Wayland: Setting window icon not supported"); + } + + void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos) +@@ -1236,8 +1234,6 @@ void _glfwPlatformRequestWindowAttention(_GLFWwindow* window) + + void _glfwPlatformFocusWindow(_GLFWwindow* window) + { +- _glfwInputError(GLFW_PLATFORM_ERROR, +- "Wayland: Focusing a window requires user interaction"); + } + + void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, +-- +2.32.0 + diff --git a/0003-fix-broken-opengl-screenshots-on-mutter.patch b/0003-fix-broken-opengl-screenshots-on-mutter.patch new file mode 100644 index 000000000000..f51e5c901924 --- /dev/null +++ b/0003-fix-broken-opengl-screenshots-on-mutter.patch @@ -0,0 +1,33 @@ +From ee84b919ad1f2d99a6805f3c00d7550908e8bd7b Mon Sep 17 00:00:00 2001 +From: ninja- <ninja-@users.noreply.github.com> +Date: Tue, 30 Jun 2020 19:41:52 +0200 +Subject: [PATCH 3/3] fix broken opengl screenshots on mutter + +(admicos) This breaks more than just screenshots. On sway, the window is +rendered half transparent. And we do not want that. +--- + src/egl_context.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/src/egl_context.c b/src/egl_context.c +index 6288fb7c..106da4f3 100644 +--- a/src/egl_context.c ++++ b/src/egl_context.c +@@ -175,6 +175,14 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig, + u->samples = getEGLConfigAttrib(n, EGL_SAMPLES); + u->doublebuffer = GLFW_TRUE; + ++#if defined(_GLFW_WAYLAND) ++ // Avoid using transparent buffer on Wayland if transparency is not requested. ++ // Otherwise mutter will fail to properly screenshot OpenGL content. ++ if (u->alphaBits > 0 && !desired->transparent) { ++ continue; ++ } ++#endif // _GLFW_WAYLAND ++ + u->handle = (uintptr_t) n; + usableCount++; + } +-- +2.32.0 + diff --git a/0004-Do-not-crash-on-window-position-set.patch b/0004-Do-not-crash-on-window-position-set.patch new file mode 100644 index 000000000000..1fe2fe186967 --- /dev/null +++ b/0004-Do-not-crash-on-window-position-set.patch @@ -0,0 +1,27 @@ +From 071e14a3dda0ab312f70dbbbdf987c5933adfc8a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ecmel=20Berk=20Canl=C4=B1er?= <me@ecmelberk.com> +Date: Fri, 25 Jun 2021 02:06:33 +0300 +Subject: [PATCH 4/4] Do not crash on window position set + +Apparently Minecraft Forge 1.16 does that? +--- + src/wl_window.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/src/wl_window.c b/src/wl_window.c +index 3f8987b8..45d57b81 100644 +--- a/src/wl_window.c ++++ b/src/wl_window.c +@@ -1061,9 +1061,6 @@ void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos) + void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos) + { + // A Wayland client can not set its position, so just warn +- +- _glfwInputError(GLFW_PLATFORM_ERROR, +- "Wayland: Window position setting not supported"); + } + + void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height) +-- +2.32.0 + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..738605683212 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,60 @@ +# Maintainer: Ecmel Berk Canlıer <me@ecmelberk.com> +# Contributor: Sven-Hendrik Haase <svenstaro@gmail.com> +# Contributor: philefou <tuxication AT gmail DOT com> +# Contributor: lindquist <tomas@famolsen.dk> +# Contributor: Christoph Siegenthaler <csi@gmx.ch> +# Contributor: Mihai Militaru <mihai.militaru@ephemeros.org> +# Contributor: SpepS <dreamspepser at yahoo dot it> + +pkgname=glfw-wayland-minecraft +pkgdesc="A free, open source, portable framework for graphical application development (wayland, patched for Minecraft)" +pkgver=3.3.4 +pkgrel=2 +arch=('x86_64') +url="https://www.glfw.org/" +license=('custom:ZLIB') +depends=('wayland' 'libxkbcommon' 'libgl') +conflicts=('glfw' 'glfw-wayland') +provides=("glfw=$pkgver") +makedepends=('mesa' 'cmake' 'doxygen' 'vulkan-headers' 'vulkan-icd-loader' + 'extra-cmake-modules' 'wayland-protocols' 'libxi' 'libxrandr' + 'libxcursor' 'libxkbcommon' 'libxinerama') +source=("https://github.com/glfw/glfw/archive/${pkgver}.tar.gz" + "0001-set-O_NONBLOCK-on-repeat-timerfd.patch" + "0002-Don-t-crash-on-calls-to-focus-or-icon.patch" + "0003-fix-broken-opengl-screenshots-on-mutter.patch" + "0004-Do-not-crash-on-window-position-set.patch") +sha512sums=('2b45ab72da7a2c007c0f42ccd56205f9684cfb980e2b1df127850cd057bb2b02ce02c7c64acd54cd433778e7017148f214afedf09badff9d2edf5f9b8d9d2701' + 'e90c5995f405dc5d0581c597719fb1bf0d9335cec162506e34e37c676a4d6eee4a50f2c9d5d1bd1a27f3668ea4a0570db24a10aad7145cd8688e25523d497de8' + '02fbbb28f6f6ffae3b5b32aac76218b917229e491981e4576054e96a78c7a3dfec3f3b2ffb939d47188b5d47681805c05d66b6fd75ad18b1d225655187ddfb9a' + '3ca405894fb3549c0bba69fd9f3b5bc5ade1d010e5d82a76c8c2684fd8f008976ad81344b842993a6620e7935c177c524acd2bf1d43c9790dd404a845bdcef72' + '77732e58d6a6b3406ded5aa208b77bcdcaee808ed9a624ea2f41331a1231a96589bb0608d88835f7081f1fdb8b538e63f9cdc8d8fdbb0ce4b1d588c667782af1') + +prepare() { + cd "$srcdir/glfw-$pkgver" + mkdir build-wayland +} + +build() { + cd "$srcdir/glfw-$pkgver" + for patch in ../../00*.patch; do + echo "Applying patch $patch" + patch -p1 < "$patch" + done + cd "build-wayland" + + cmake .. \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DBUILD_SHARED_LIBS=ON \ + -DGLFW_USE_WAYLAND=ON +} + +package() { + cd "$srcdir/glfw-$pkgver"/build-wayland + + make DESTDIR=$pkgdir install + + cd .. + install -Dm644 LICENSE.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE.md" +} diff --git a/README.md b/README.md new file mode 100644 index 000000000000..81ec79e81bae --- /dev/null +++ b/README.md @@ -0,0 +1,90 @@ +# The better way of running Minecraft Without XWayland + +Because I **REALLY** had nothing better to do with my life. + +## Why is this better than [Waynotgonnaland](https://github.com/Admicos/waynotgonnaland) + +This doesn't require modding Minecraft, instead preferring to patch GLFW. You +had to patch GLFW anyway to fix a pretty important freezing issue, so why not +patch it for the other things too? + +## Requirements + +- A version of Minecraft >= 1.13 + + - Older versions are not guaranteed to work. You can still try, though. + +- The MultiMC Minecraft Launcher + + - Use it even if you don't plan to do this. It's great! + - If you don't want to do that, throw this into your Java arguments, changing + the file path as needed: `-Dorg.lwjgl.glfw.libname=/usr/lib/libglfw.so` + +- An Arch-based system + + - Or the knowledge on how to patch packages in your distribution. + - In which case you can skip step 2 of this guide, as it will not apply to you + and you should know what to do with the `.patch` files in this repo already + +## Side effects + +- Forge will not work without another workaround +- The controls page (and anywhere a keyboard key is shown) is a bit wonky +- Not tested outside Sway. You mileage may vary on, say, GNOME. + - I do not have any test environment but if you're confident a patch fixes any + issues encountered I will most likely add it in. + +## Step 1: Setting up MultiMC to use the system GLFW + +Go to `Settings` > `Minecraft`, and enable `Use system installation of GLFW`. + +If you have a Wayland-compatible version of GLFW installed (`wayland-glfw` on +Arch) you can try launching the game. It will most likely error out with +something about window focus not being supported. In that case, you are in the +right direction. + +## Step 2: Installing tha patched GLFW library + +If you're not under an Arch-based system, you're mostly on your own here. You +can try waiting for someone else to write a guide I guess. + +`git clone` this repository to somewhere, and run `makepkg -si` inside. It will +ask you to replace your existing GLFW package if already installed. + +## Step 3: There is no step 3 + +This should be it. Try launching Minecraft now and see if it works. + +## Bonus: XWayland per instance + +If some version of Minecraft doesn't work with the patch enabled, you can +disable it through MultiMC just for that version by + +- Right clicking on your instance +- Clicking `Edit instance` +- Going to `Settings` > `Workarounds` +- Enabling `Native Libraries` override switch +- Disabling the GLFW option + +You can also disable the global switch and enable the patch per instance if +that's how you want to roll. + +## Bonus: Making Forge work + +Due to "Forge being Forge", you will need to add +`-Dfml.earlyprogresswindow=false` to your Java arguments to make Forge instances +start up properly. See [issue #1](https://github.com/Admicos/minecraft-wayland/issues/1) +for more information. + +## Thanks To + +I really didn't do much on this other than "re-discovering" these things which +aren't even that old. Here are the proper credits: + +- `ninja-` on GitHub + + - For https://github.com/glfw/glfw/pull/1725 + +- `annacrombie` on GitHub + + - For https://github.com/glfw/glfw/pull/1711 |