From bd439cc941cd11f3826e2e2d38c75880f8872919 Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Sun, 24 Mar 2024 12:18:09 +0200 Subject: [PATCH] feat: added "force grab cursor" option to the gamescope settings --- assets/locales/de/gamescope.ftl | 3 +++ assets/locales/en/gamescope.ftl | 3 +++ assets/locales/es/gamescope.ftl | 3 +++ assets/locales/fr/gamescope.ftl | 3 +++ assets/locales/hu/gamescope.ftl | 3 +++ assets/locales/id/gamescope.ftl | 3 +++ assets/locales/it/gamescope.ftl | 3 +++ assets/locales/ja/gamescope.ftl | 3 +++ assets/locales/ko/gamescope.ftl | 3 +++ assets/locales/nl/gamescope.ftl | 3 +++ assets/locales/pl/gamescope.ftl | 5 +++- assets/locales/pt/gamescope.ftl | 3 +++ assets/locales/ru/gamescope.ftl | 3 +++ assets/locales/sv/gamescope.ftl | 3 +++ assets/locales/th/gamescope.ftl | 3 +++ assets/locales/tr/gamescope.ftl | 3 +++ assets/locales/uk/gamescope.ftl | 3 +++ assets/locales/vi/gamescope.ftl | 3 +++ assets/locales/zh-cn/gamescope.ftl | 7 +++++- src/ui/preferences/gamescope.rs | 38 +++++++++++++++++++++++------- 20 files changed, 90 insertions(+), 11 deletions(-) diff --git a/assets/locales/de/gamescope.ftl b/assets/locales/de/gamescope.ftl index f222a66..9eba9d7 100644 --- a/assets/locales/de/gamescope.ftl +++ b/assets/locales/de/gamescope.ftl @@ -11,3 +11,6 @@ nis-description = Eine Open-Source-Upscaling-Technik, die von Nvidia als herstel other-settings = Andere Einstellungen framerate-limit = Framerate-Limit unfocused-framerate-limit = Unfokussiert Framerate-Limit + +force-grab-cursor = Force grab cursor +force-grab-cursor-description = Always use relative mouse mode instead of flipping dependent on cursor visibility. The mouse cursor will correctly be centered in the game diff --git a/assets/locales/en/gamescope.ftl b/assets/locales/en/gamescope.ftl index 6fbb639..7e7ed77 100644 --- a/assets/locales/en/gamescope.ftl +++ b/assets/locales/en/gamescope.ftl @@ -11,3 +11,6 @@ nis-description = An open source upscaling technique developed by Nvidia as a cr other-settings = Other settings framerate-limit = Framerate limit unfocused-framerate-limit = Unfocused framerate limit + +force-grab-cursor = Force grab cursor +force-grab-cursor-description = Always use relative mouse mode instead of flipping dependent on cursor visibility. The mouse cursor will correctly be centered in the game diff --git a/assets/locales/es/gamescope.ftl b/assets/locales/es/gamescope.ftl index b04ff36..d65d0dd 100644 --- a/assets/locales/es/gamescope.ftl +++ b/assets/locales/es/gamescope.ftl @@ -11,3 +11,6 @@ nis-description = Una técnica de escalado de código abierto desarrollada por N other-settings = Otras opciones framerate-limit = Límite de framerate unfocused-framerate-limit = Límite de framerate en segundo plano + +force-grab-cursor = Force grab cursor +force-grab-cursor-description = Always use relative mouse mode instead of flipping dependent on cursor visibility. The mouse cursor will correctly be centered in the game diff --git a/assets/locales/fr/gamescope.ftl b/assets/locales/fr/gamescope.ftl index 2df9d55..53eda0c 100644 --- a/assets/locales/fr/gamescope.ftl +++ b/assets/locales/fr/gamescope.ftl @@ -11,3 +11,6 @@ nis-description = Une technologie de mise à l'échelle Open Source développée other-settings = Autres paramètres framerate-limit = Limitation des FPS unfocused-framerate-limit = Limitation des FPS hors focus + +force-grab-cursor = Force grab cursor +force-grab-cursor-description = Always use relative mouse mode instead of flipping dependent on cursor visibility. The mouse cursor will correctly be centered in the game diff --git a/assets/locales/hu/gamescope.ftl b/assets/locales/hu/gamescope.ftl index 7b0b993..758ffac 100644 --- a/assets/locales/hu/gamescope.ftl +++ b/assets/locales/hu/gamescope.ftl @@ -11,3 +11,6 @@ nis-description = Open source upscaling technika az Nvidia-tól, alternatíva a other-settings = Egyéb beállítások framerate-limit = FPS limit unfocused-framerate-limit = Fókuszon kívüli FPS limit + +force-grab-cursor = Force grab cursor +force-grab-cursor-description = Always use relative mouse mode instead of flipping dependent on cursor visibility. The mouse cursor will correctly be centered in the game diff --git a/assets/locales/id/gamescope.ftl b/assets/locales/id/gamescope.ftl index 9be40bb..8c9e95c 100644 --- a/assets/locales/id/gamescope.ftl +++ b/assets/locales/id/gamescope.ftl @@ -11,3 +11,6 @@ nis-description = Teknik peningkatan skala yang dikembangkan oleh Nvidia sebagai other-settings = Pengaturan lainnya framerate-limit = Batas framerate unfocused-framerate-limit = Batas framerate saat tidak fokus + +force-grab-cursor = Force grab cursor +force-grab-cursor-description = Always use relative mouse mode instead of flipping dependent on cursor visibility. The mouse cursor will correctly be centered in the game diff --git a/assets/locales/it/gamescope.ftl b/assets/locales/it/gamescope.ftl index 9ebaa4d..240cbe7 100644 --- a/assets/locales/it/gamescope.ftl +++ b/assets/locales/it/gamescope.ftl @@ -11,3 +11,6 @@ nis-description = Una tecnica di upscaling open-source sviluppata da Nvidia per other-settings = Altre impostazioni framerate-limit = Limite del framerate unfocused-framerate-limit = Limite del framerate quando fuori dal focus + +force-grab-cursor = Force grab cursor +force-grab-cursor-description = Always use relative mouse mode instead of flipping dependent on cursor visibility. The mouse cursor will correctly be centered in the game diff --git a/assets/locales/ja/gamescope.ftl b/assets/locales/ja/gamescope.ftl index 5bcefa8..48c5bff 100644 --- a/assets/locales/ja/gamescope.ftl +++ b/assets/locales/ja/gamescope.ftl @@ -11,3 +11,6 @@ nis-description = An open source upscaling technique developed by Nvidia as a cr other-settings = その他の設定 framerate-limit = FPS制限 unfocused-framerate-limit = 非フォーカス時の最大FPS + +force-grab-cursor = Force grab cursor +force-grab-cursor-description = Always use relative mouse mode instead of flipping dependent on cursor visibility. The mouse cursor will correctly be centered in the game diff --git a/assets/locales/ko/gamescope.ftl b/assets/locales/ko/gamescope.ftl index fbe9709..eeb0407 100644 --- a/assets/locales/ko/gamescope.ftl +++ b/assets/locales/ko/gamescope.ftl @@ -11,3 +11,6 @@ nis-description = Nvidia가 독점 DLSS 솔루션에 대한 낮은 오버헤드 other-settings = 기타 설정 framerate-limit = 프레임 속도 제한 unfocused-framerate-limit = 초점이 맞지 않는 프레임 속도 제한 + +force-grab-cursor = Force grab cursor +force-grab-cursor-description = Always use relative mouse mode instead of flipping dependent on cursor visibility. The mouse cursor will correctly be centered in the game diff --git a/assets/locales/nl/gamescope.ftl b/assets/locales/nl/gamescope.ftl index c72b5bf..6f6dc12 100644 --- a/assets/locales/nl/gamescope.ftl +++ b/assets/locales/nl/gamescope.ftl @@ -11,3 +11,6 @@ nis-description = Een open source opschalingstechniek ontwikkeld door Nvidia als other-settings = Andere instellingen framerate-limit = Frameratelimiet unfocused-framerate-limit = Ongefocuste frameratelimiet + +force-grab-cursor = Force grab cursor +force-grab-cursor-description = Always use relative mouse mode instead of flipping dependent on cursor visibility. The mouse cursor will correctly be centered in the game diff --git a/assets/locales/pl/gamescope.ftl b/assets/locales/pl/gamescope.ftl index 53441fd..5305bc8 100644 --- a/assets/locales/pl/gamescope.ftl +++ b/assets/locales/pl/gamescope.ftl @@ -10,4 +10,7 @@ nis-description = Technika skalowania otwartego źródła opracowana przez Nvidi other-settings = Inne ustawienia framerate-limit = Limit klatek na sekundę -unfocused-framerate-limit = Limit klatek na sekundę po utraceniu skupienia \ No newline at end of file +unfocused-framerate-limit = Limit klatek na sekundę po utraceniu skupienia + +force-grab-cursor = Force grab cursor +force-grab-cursor-description = Always use relative mouse mode instead of flipping dependent on cursor visibility. The mouse cursor will correctly be centered in the game diff --git a/assets/locales/pt/gamescope.ftl b/assets/locales/pt/gamescope.ftl index 722ec94..d4bbdbe 100644 --- a/assets/locales/pt/gamescope.ftl +++ b/assets/locales/pt/gamescope.ftl @@ -11,3 +11,6 @@ nis-description = Uma técnica de upscaling de código aberto desenvolvida pela other-settings = Outras configuraões framerate-limit = Limite de taxa de quadros unfocused-framerate-limit = Limite de taxa de quadros desfocado + +force-grab-cursor = Force grab cursor +force-grab-cursor-description = Always use relative mouse mode instead of flipping dependent on cursor visibility. The mouse cursor will correctly be centered in the game diff --git a/assets/locales/ru/gamescope.ftl b/assets/locales/ru/gamescope.ftl index 478608e..48aff04 100644 --- a/assets/locales/ru/gamescope.ftl +++ b/assets/locales/ru/gamescope.ftl @@ -11,3 +11,6 @@ nis-description = Открытая техника масштабирования other-settings = Другие настройки framerate-limit = Лимит числа кадров unfocused-framerate-limit = Лимит числа кадров вне фокуса + +force-grab-cursor = Принудительный захват курсора +force-grab-cursor-description = Использовать относительный режим мыши вместо переворачивания в зависимости от видимости курсора. Курсор мыши будет правильно центрирован в игре diff --git a/assets/locales/sv/gamescope.ftl b/assets/locales/sv/gamescope.ftl index 959b29e..8cd626b 100644 --- a/assets/locales/sv/gamescope.ftl +++ b/assets/locales/sv/gamescope.ftl @@ -11,3 +11,6 @@ nis-description = En uppskalningsteknik med öppen källkod som utvecklats av Nv other-settings = Andra inställningar framerate-limit = Gräns för bilduppdateringshastighet unfocused-framerate-limit = Gräns för bilduppdateringshastighet utan fokus + +force-grab-cursor = Force grab cursor +force-grab-cursor-description = Always use relative mouse mode instead of flipping dependent on cursor visibility. The mouse cursor will correctly be centered in the game diff --git a/assets/locales/th/gamescope.ftl b/assets/locales/th/gamescope.ftl index e810b5d..6531a85 100644 --- a/assets/locales/th/gamescope.ftl +++ b/assets/locales/th/gamescope.ftl @@ -11,3 +11,6 @@ nis-description = เทคนิคการขยายขนาดโอเ other-settings = การตั้งค่าอื่นๆ framerate-limit = ขีดจำกัดเฟรมเรต unfocused-framerate-limit = เฟรมเรทจำกัดขณะไม่ได้โฟกัส + +force-grab-cursor = Force grab cursor +force-grab-cursor-description = Always use relative mouse mode instead of flipping dependent on cursor visibility. The mouse cursor will correctly be centered in the game diff --git a/assets/locales/tr/gamescope.ftl b/assets/locales/tr/gamescope.ftl index 221969c..f19da2e 100644 --- a/assets/locales/tr/gamescope.ftl +++ b/assets/locales/tr/gamescope.ftl @@ -11,3 +11,6 @@ nis-description = DLSS teknolojisine düşük maliyetli bir alternatif olarak Nv other-settings = Diğer ayarlar framerate-limit = Kare hızı limiti unfocused-framerate-limit = Odakta değilken kare hızı limiti + +force-grab-cursor = Force grab cursor +force-grab-cursor-description = Always use relative mouse mode instead of flipping dependent on cursor visibility. The mouse cursor will correctly be centered in the game diff --git a/assets/locales/uk/gamescope.ftl b/assets/locales/uk/gamescope.ftl index 28a657b..b94a9a9 100644 --- a/assets/locales/uk/gamescope.ftl +++ b/assets/locales/uk/gamescope.ftl @@ -11,3 +11,6 @@ nis-description = Відкрита техніка масштабування з other-settings = Інші налаштування framerate-limit = Обмеження кількості кадрів unfocused-framerate-limit = Обмеження кількості кадрів поза фокусом + +force-grab-cursor = Force grab cursor +force-grab-cursor-description = Always use relative mouse mode instead of flipping dependent on cursor visibility. The mouse cursor will correctly be centered in the game diff --git a/assets/locales/vi/gamescope.ftl b/assets/locales/vi/gamescope.ftl index 6ced83c..2edf20b 100644 --- a/assets/locales/vi/gamescope.ftl +++ b/assets/locales/vi/gamescope.ftl @@ -11,3 +11,6 @@ nis-description = Một kỹ thuật nâng cấp mã nguồn mở do Nvidia phá other-settings = Cài đặt khác framerate-limit = Giới hạn tốc độ khung hình unfocused-framerate-limit = Giới hạn tốc độ khung hình khi không tập trung + +force-grab-cursor = Force grab cursor +force-grab-cursor-description = Always use relative mouse mode instead of flipping dependent on cursor visibility. The mouse cursor will correctly be centered in the game diff --git a/assets/locales/zh-cn/gamescope.ftl b/assets/locales/zh-cn/gamescope.ftl index 1c3f462..282801b 100644 --- a/assets/locales/zh-cn/gamescope.ftl +++ b/assets/locales/zh-cn/gamescope.ftl @@ -1,6 +1,11 @@ game-resolution = 游戏分辨率 gamescope-resolution = Gamescope 分辨率 + +integer-scaling = 整数倍数缩放 + other-settings = 其它设置 framerate-limit = 帧率限制 unfocused-framerate-limit = 切出游戏帧率限制 -integer-scaling = 整数倍数缩放 + +force-grab-cursor = Force grab cursor +force-grab-cursor-description = Always use relative mouse mode instead of flipping dependent on cursor visibility. The mouse cursor will correctly be centered in the game diff --git a/src/ui/preferences/gamescope.rs b/src/ui/preferences/gamescope.rs index edc3a66..eeecb39 100644 --- a/src/ui/preferences/gamescope.rs +++ b/src/ui/preferences/gamescope.rs @@ -130,13 +130,13 @@ impl SimpleAsyncComponent for GamescopeApp { add_suffix = >k::Switch { set_valign: gtk::Align::Center, - set_state: CONFIG.game.enhancements.gamescope.integer_scaling, + set_active: CONFIG.game.enhancements.gamescope.integer_scaling, connect_state_notify => |switch| { if is_ready() { if let Ok(mut config) = Config::get() { - config.game.enhancements.gamescope.integer_scaling = switch.state(); - + config.game.enhancements.gamescope.integer_scaling = switch.is_active(); + Config::update(config); } } @@ -150,13 +150,13 @@ impl SimpleAsyncComponent for GamescopeApp { add_suffix = >k::Switch { set_valign: gtk::Align::Center, - set_state: CONFIG.game.enhancements.gamescope.fsr, + set_active: CONFIG.game.enhancements.gamescope.fsr, connect_state_notify => |switch| { if is_ready() { if let Ok(mut config) = Config::get() { - config.game.enhancements.gamescope.fsr = switch.state(); - + config.game.enhancements.gamescope.fsr = switch.is_active(); + Config::update(config); } } @@ -170,13 +170,13 @@ impl SimpleAsyncComponent for GamescopeApp { add_suffix = >k::Switch { set_valign: gtk::Align::Center, - set_state: CONFIG.game.enhancements.gamescope.nis, + set_active: CONFIG.game.enhancements.gamescope.nis, connect_state_notify => |switch| { if is_ready() { if let Ok(mut config) = Config::get() { - config.game.enhancements.gamescope.nis = switch.state(); - + config.game.enhancements.gamescope.nis = switch.is_active(); + Config::update(config); } } @@ -252,6 +252,26 @@ impl SimpleAsyncComponent for GamescopeApp { } } } + }, + + adw::ActionRow { + set_title: &tr!("force-grab-cursor"), + set_subtitle: &tr!("force-grab-cursor-description"), + + add_suffix = >k::Switch { + set_valign: gtk::Align::Center, + set_active: CONFIG.game.enhancements.gamescope.force_grab_cursor, + + connect_state_notify => |switch| { + if is_ready() { + if let Ok(mut config) = Config::get() { + config.game.enhancements.gamescope.force_grab_cursor = switch.is_active(); + + Config::update(config); + } + } + } + } } } }