Improve minecraft-on-wayland support

This commit is contained in:
Nathan McCarty 2022-06-01 13:02:33 -04:00
parent c7d5e0df98
commit 4dd48d694d
Signed by: thatonelutenist
GPG Key ID: D70DA3DD4D1E9F96
4 changed files with 35 additions and 3 deletions

View File

@ -527,7 +527,7 @@
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
"libnbtplusplus": "libnbtplusplus", "libnbtplusplus": "libnbtplusplus",
"nixpkgs": [ "nixpkgs": [
"nixpkgs-unstable" "nixpkgs"
] ]
}, },
"locked": { "locked": {

View File

@ -30,7 +30,7 @@
}; };
polymc = { polymc = {
url = "github:PolyMC/PolyMC"; url = "github:PolyMC/PolyMC";
inputs.nixpkgs.follows = "nixpkgs-unstable"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nix-doom-emacs = { nix-doom-emacs = {
url = "github:nix-community/nix-doom-emacs"; url = "github:nix-community/nix-doom-emacs";

View File

@ -1,8 +1,12 @@
{ pkgs, ... }: { { pkgs, ... }: {
environment.systemPackages = environment.systemPackages =
let let
# https://github.com/Admicos/minecraft-wayland
glfw-patched = pkgs.glfw-wayland.overrideAttrs (attrs: { glfw-patched = pkgs.glfw-wayland.overrideAttrs (attrs: {
patches = attrs.patches ++ [ ../patches/minecraft/0003-Don-t-crash-on-calls-to-focus-or-icon.patch ]; patches = attrs.patches ++ [
../patches/minecraft/0003-Don-t-crash-on-calls-to-focus-or-icon.patch
../patches/minecraft/0004-wayland-fix-broken-opengl-screenshots-on-mutter.patch
];
}); });
in in
with pkgs; [ with pkgs; [

View File

@ -0,0 +1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: ninja- <ninja-@users.noreply.github.com>
Date: Tue, 30 Jun 2020 19:41:52 +0200
Subject: wayland: fix broken opengl screenshots on mutter
---
src/egl_context.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/egl_context.c b/src/egl_context.c
index 6b34f724..b0a810d8 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 = desired->doublebuffer;
+#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++;
}