Admicos / minecraft-wayland

A better way of running Minecraft Without XWayland. Because I REALLY had nothing better to do with my life.
254 stars 14 forks source link

[FIX] Running Forge 27/Vanilla 1.20 in Wayland Native #58

Open patrickpmueller opened 6 months ago

patrickpmueller commented 6 months ago

Problem

Hi all! When I tried to install the patches on my system (even the one-nineteen and libdecoration branches) GLFW was spitting out the error

Wayland: setting the window position is not supported on this platform.

My system:

Solution

To fix this issue, you have to manually apply the patches to the master branch of GLFW. This fix will break in the future as it is based on the active and changing master branch, not a static release.

Downloading GLFW

You might want to cd into your downloads or temp folder if you don't want to clutter your $HOME.

git clone https://github.com/glfw/glfw.git
cd glfw

Download the patch

I have combined the patches 0003, 0005 and the necessary patch to mute the error that causes forge to crash on start Copy and paste it into a file called glfw.patch, the last empty line is important as otherwise it refuses to git apply - this file should be located in the glfw dir that you just cd'd into. gist.github.com/patrickpmueller/3e24a3ba435c1708a3ebace60cfa1dcf

If patch somehow fails (in case GLFW updated their code in this part) manually review patch, find the section of code and replace it. You can use patches from repo, one-nineteen branch, etc. but be sure to add the patch for the window position.

Applying the patch and compiling GLFW

Just run the commands below:

git apply glfw.patch
cmake -S . -B build -D GLFW_USE_WAYLAND=1 -D BUILD_SHARED_LIBS=ON -D GLFW_BUILD_EXAMPLES=no -D GLFW_BUILD_TESTS=no -D GLFW_BUILD_DOCS=no
cd build
make

Using the patched version to start Forge 27

You can

Export a neccessary environment variable

This is neccessary becuase Minecraft crashed otherwise (I don't have the error message any more, but this fixed it). Name: __GL_THREADED_OPTIMIZATIONS Value: 0

Result

This should fix any issues related to Forge 27 and should also fix vanilla 1.20. I might include a PKGBUILD in the future - or someone can share it if they write it.

Note: this is a temporary fix that just suppresses the errors instead of properly fixing them. However, at least it works without XWayland

Piecuuu commented 3 months ago

I'm experiencing the same issue, but on a Intel iGPU.

TailsFanLOL commented 2 days ago

patch broken