[gnome-games] collection-view: Translate keyval for shortcuts
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] collection-view: Translate keyval for shortcuts
- Date: Wed, 14 Aug 2019 19:51:19 +0000 (UTC)
commit 3f64e8b6fa66eb31d4101e30bce6bfdc23536045
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Wed Aug 14 22:06:34 2019 +0500
collection-view: Translate keyval for shortcuts
This way, shortcuts can work independently of the current keyboard layout.
See https://gitlab.gnome.org/GNOME/gnome-games/commit/a378f4b80154e78222341692edda419d046f20b2
src/ui/collection-view.vala | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/ui/collection-view.vala b/src/ui/collection-view.vala
index be34a2cc..e383d41e 100644
--- a/src/ui/collection-view.vala
+++ b/src/ui/collection-view.vala
@@ -109,16 +109,21 @@ private class Games.CollectionView : Object, UiView {
public bool on_key_pressed (Gdk.EventKey event) {
var default_modifiers = Gtk.accelerator_get_default_mod_mask ();
+ uint keyval;
+ var keymap = Gdk.Keymap.get_for_display (window.get_display ());
+ keymap.translate_keyboard_state (event.hardware_keycode, event.state,
+ event.group, out keyval, null, null, null);
+
if (((event.state & default_modifiers) == Gdk.ModifierType.MOD1_MASK) &&
- (((window.get_direction () == Gtk.TextDirection.LTR) && event.keyval == Gdk.Key.Left) ||
- ((window.get_direction () == Gtk.TextDirection.RTL) && event.keyval == Gdk.Key.Right)) &&
+ (((window.get_direction () == Gtk.TextDirection.LTR) && keyval == Gdk.Key.Left) ||
+ ((window.get_direction () == Gtk.TextDirection.RTL) && keyval == Gdk.Key.Right)) &&
adaptive_state.is_subview_open) {
adaptive_state.is_subview_open = false;
return true;
}
- if ((event.keyval == Gdk.Key.f || event.keyval == Gdk.Key.F) &&
+ if ((keyval == Gdk.Key.f || keyval == Gdk.Key.F) &&
(event.state & default_modifiers) == Gdk.ModifierType.CONTROL_MASK) {
if (!search_mode)
search_mode = true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]