git: cd234304ece4 - main - games/veloren-weekly: unbreak key name translation

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Fri, 10 May 2024 01:19:47 UTC
The branch main has been updated by jbeich:

URL: https://cgit.FreeBSD.org/ports/commit/?id=cd234304ece4e9df995bcfe6b4ed32c4e08fcfaa

commit cd234304ece4e9df995bcfe6b4ed32c4e08fcfaa
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2024-05-09 23:19:49 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2024-05-10 01:19:12 +0000

    games/veloren-weekly: unbreak key name translation
    
    WARN veloren_voxygen::window: Failed to construct the scancode to keyname mapper, falling back to displaying Unknown(<scancode>). err=PlatformUnsupportedError
    
    https://gitlab.com/veloren/veloren/-/commit/0d7d069d4149
---
 games/veloren-weekly/Makefile                      |  4 ++-
 games/veloren-weekly/files/patch-keyboard-keynames | 41 ++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/games/veloren-weekly/Makefile b/games/veloren-weekly/Makefile
index b0c02ae3391f..576eaffb3bd0 100644
--- a/games/veloren-weekly/Makefile
+++ b/games/veloren-weekly/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	veloren
 PORTVERSION=	s20240509
+PORTREVISION=	1
 CATEGORIES=	games wayland
 PKGNAMESUFFIX=	-weekly
 
@@ -18,7 +19,8 @@ ONLY_FOR_ARCHS_REASON=	unsupported platform by https://github.com/wasmerio/wasme
 LIB_DEPENDS=	libzstd.so:archivers/zstd \
 		libasound.so:audio/alsa-lib \
 		libudev.so:devel/libudev-devd \
-		libshaderc_shared.so:graphics/shaderc
+		libshaderc_shared.so:graphics/shaderc \
+		libxkbcommon-x11.so:x11/libxkbcommon
 RUN_DEPENDS=	${LOCALBASE}/lib/alsa-lib/libasound_module_pcm_oss.so:audio/alsa-plugins \
 		${LOCALBASE}/lib/libvulkan.so:graphics/vulkan-loader
 
diff --git a/games/veloren-weekly/files/patch-keyboard-keynames b/games/veloren-weekly/files/patch-keyboard-keynames
new file mode 100644
index 000000000000..10f126ce6f72
--- /dev/null
+++ b/games/veloren-weekly/files/patch-keyboard-keynames
@@ -0,0 +1,41 @@
+Assume X11/Wayland key names on every Unix-like system
+
+--- ../keyboard-keynames-veloren-winit-0.28-fca4bbdfa51bf054b155a455935b3792975c989d/Cargo.toml.orig	2023-08-23 04:01:46 UTC
++++ ../keyboard-keynames-veloren-winit-0.28-fca4bbdfa51bf054b155a455935b3792975c989d/Cargo.toml
+@@ -18,7 +18,7 @@ winapi = { version = "0.3.9", features = ["winuser"] }
+ [target.'cfg(windows)'.dependencies]
+ winapi = { version = "0.3.9", features = ["winuser"] }
+ 
+-[target.'cfg(target_os = "linux")'.dependencies]
++[target.'cfg(all(unix, not(target_os = "macos")))'.dependencies]
+ xkbcommon = { version = "0.5", features = ["x11", "wayland"] }
+ xcb = { version = "1", features = ["as-raw-xcb-connection"] }
+ wayland-client = "0.29"
+--- ../keyboard-keynames-veloren-winit-0.28-fca4bbdfa51bf054b155a455935b3792975c989d/src/platform/mod.rs.orig	2023-08-23 04:01:46 UTC
++++ ../keyboard-keynames-veloren-winit-0.28-fca4bbdfa51bf054b155a455935b3792975c989d/src/platform/mod.rs
+@@ -1,5 +1,5 @@
+ //! The KeyLayout struct and supporting elements
+-#[cfg(target_os = "linux")]
++#[cfg(all(unix, not(target_os = "macos")))]
+ #[path = "unix/mod.rs"]
+ mod platform;
+ 
+@@ -7,7 +7,7 @@ mod platform;
+ #[path = "windows/mod.rs"]
+ mod platform;
+ 
+-#[cfg(not(any(target_os = "windows", target_os = "linux")))]
++#[cfg(target_os = "macos")]
+ #[path = "other/mod.rs"]
+ mod platform;
+ 
+--- ../keyboard-keynames-veloren-winit-0.28-fca4bbdfa51bf054b155a455935b3792975c989d/src/platform/unix/key_layout.rs.orig	2023-08-23 04:01:46 UTC
++++ ../keyboard-keynames-veloren-winit-0.28-fca4bbdfa51bf054b155a455935b3792975c989d/src/platform/unix/key_layout.rs
+@@ -220,7 +220,6 @@ impl KeyLayout {
+ }
+ 
+ /// Methods for KeyLayout specific to Unix-based systems
+-#[cfg(target_os = "linux")]
+ pub trait KeyLayoutExtUnix {
+     /// Construct a KeyLayout explicitly using the Wayland protocol
+     fn new_wayland() -> Result<KeyLayout, KeyLayoutError>;