[gnome-boxes] app,props,wizard: Fix kbd shortcuts for RTL
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] app,props,wizard: Fix kbd shortcuts for RTL
- Date: Mon, 7 Dec 2015 18:10:52 +0000 (UTC)
commit c371b3eb651ace1483eb017ee5273f7e9775f4f0
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Mon Dec 7 17:58:45 2015 +0000
app,props,wizard: Fix kbd shortcuts for RTL
The back and forward keyboard shortcuts need to be reversed for
Right-To-Left locales.
src/app-window.vala | 6 +++++-
src/properties-window.vala | 6 +++++-
src/wizard-window.vala | 13 ++++++++++---
3 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/src/app-window.vala b/src/app-window.vala
index c2e3729..08e2e92 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -338,6 +338,7 @@ private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
[GtkCallback]
public bool on_key_pressed (Widget widget, Gdk.EventKey event) {
var default_modifiers = Gtk.accelerator_get_default_mod_mask ();
+ var direction = get_direction ();
if (event.keyval == Gdk.Key.F11) {
fullscreened = !fullscreened;
@@ -367,7 +368,10 @@ private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
App.app.quit_app ();
return true;
- } else if (event.keyval == Gdk.Key.Left && // ALT + Left -> back
+ } else if (((direction == Gtk.TextDirection.LTR && // LTR
+ event.keyval == Gdk.Key.Left) || // ALT + Left -> back
+ (direction == Gtk.TextDirection.RTL && // RTL
+ event.keyval == Gdk.Key.Right)) && // ALT + Right -> back
(event.state & default_modifiers) == Gdk.ModifierType.MOD1_MASK) {
topbar.click_back_button ();
return true;
diff --git a/src/properties-window.vala b/src/properties-window.vala
index 5a889d0..20ef436 100644
--- a/src/properties-window.vala
+++ b/src/properties-window.vala
@@ -100,8 +100,12 @@ private class Boxes.PropertiesWindow: Gtk.Window, Boxes.UI {
[GtkCallback]
private bool on_key_pressed (Widget widget, Gdk.EventKey event) {
var default_modifiers = Gtk.accelerator_get_default_mod_mask ();
+ var direction = get_direction ();
- if (event.keyval == Gdk.Key.Left && // ALT + Left -> back
+ if (((direction == Gtk.TextDirection.LTR && // LTR
+ event.keyval == Gdk.Key.Left) || // ALT + Left -> back
+ (direction == Gtk.TextDirection.RTL && // RTL
+ event.keyval == Gdk.Key.Right)) && // ALT + Right -> back
(event.state & default_modifiers) == Gdk.ModifierType.MOD1_MASK) {
topbar.click_back_button ();
diff --git a/src/wizard-window.vala b/src/wizard-window.vala
index ac0deb2..8613747 100644
--- a/src/wizard-window.vala
+++ b/src/wizard-window.vala
@@ -117,12 +117,19 @@ private class Boxes.WizardWindow : Gtk.Window, Boxes.UI {
[GtkCallback]
private bool on_key_pressed (Widget widget, Gdk.EventKey event) {
var default_modifiers = Gtk.accelerator_get_default_mod_mask ();
+ var direction = get_direction ();
- if (event.keyval == Gdk.Key.Left && // ALT + Left -> back
- (event.state & default_modifiers) == Gdk.ModifierType.MOD1_MASK) {
+ if (((direction == Gtk.TextDirection.LTR && // LTR
+ event.keyval == Gdk.Key.Left) || // ALT + Left -> back
+ (direction == Gtk.TextDirection.RTL && // RTL
+ event.keyval == Gdk.Key.Right)) && // ALT + Right -> back
+ (event.state & default_modifiers) == Gdk.ModifierType.MOD1_MASK) {
topbar.click_back_button ();
return true;
- } else if (event.keyval == Gdk.Key.Right && // ALT + Right -> forward
+ } else if (((direction == Gtk.TextDirection.LTR && // LTR
+ event.keyval == Gdk.Key.Right) || // ALT + Right -> forward
+ (direction == Gtk.TextDirection.RTL && // RTL
+ event.keyval == Gdk.Key.Left)) && // ALT + Left -> forward
(event.state & default_modifiers) == Gdk.ModifierType.MOD1_MASK) {
topbar.click_forward_button ();
return true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]