[libreoffice/f20] Resolves: rhbz#958300 fix GTK non Latin keyboard layout shortcuts
Caolán McNamara
caolanm at fedoraproject.org
Fri Nov 22 13:32:42 UTC 2013
commit ac488ec1bb86487cf8d371bffeecb6ef48e6074e
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Nov 22 13:32:31 2013 +0000
Resolves: rhbz#958300 fix GTK non Latin keyboard layout shortcuts
...-41169-fix-GTK-non-Latin-keyboard-layout-.patch | 114 ++++++++++++++++++++
libreoffice.spec | 9 ++-
2 files changed, 121 insertions(+), 2 deletions(-)
---
diff --git a/0001-Related-fdo-41169-fix-GTK-non-Latin-keyboard-layout-.patch b/0001-Related-fdo-41169-fix-GTK-non-Latin-keyboard-layout-.patch
new file mode 100644
index 0000000..5ca84cf
--- /dev/null
+++ b/0001-Related-fdo-41169-fix-GTK-non-Latin-keyboard-layout-.patch
@@ -0,0 +1,114 @@
+From 8cef6c7ec67aec88b339ca647e784afbabf190f8 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm at redhat.com>
+Date: Fri, 22 Nov 2013 13:20:12 +0000
+Subject: [PATCH] Related: fdo#41169 fix GTK non-Latin keyboard layout with
+ Latin shortcuts
+
+See also rhbz#958300
+
+Change-Id: I5c3cf9652adb7b1c9ec53a32ed39f231a09ae1d7
+---
+ vcl/unx/gtk/window/gtksalframe.cxx | 67 +++++++++++++++++++++++++-------------
+ 1 file changed, 45 insertions(+), 22 deletions(-)
+
+diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx
+index 5651dcf..de96dbd 100644
+--- a/vcl/unx/gtk/window/gtksalframe.cxx
++++ b/vcl/unx/gtk/window/gtksalframe.cxx
+@@ -335,6 +335,14 @@ static sal_uInt16 GetKeyCode( guint keyval )
+ return nCode;
+ }
+
++static guint GetKeyValFor(GdkKeymap* pKeyMap, guint16 hardware_keycode, guint8 group)
++{
++ guint updated_keyval = 0;
++ gdk_keymap_translate_keyboard_state(pKeyMap, hardware_keycode,
++ (GdkModifierType)0, group, &updated_keyval, NULL, NULL, NULL);
++ return updated_keyval;
++}
++
+ // F10 means either KEY_F10 or KEY_MENU, which has to be decided
+ // in the independent part.
+ struct KeyAlternate
+@@ -385,7 +393,7 @@ struct DamageTracker : public basebmp::IBitmapDeviceDamageTracker
+ void GtkSalFrame::doKeyCallback( guint state,
+ guint keyval,
+ guint16 hardware_keycode,
+- guint8 /*group*/,
++ guint8 group,
+ guint32 time,
+ sal_Unicode aOrigCode,
+ bool bDown,
+@@ -417,33 +425,48 @@ void GtkSalFrame::doKeyCallback( guint state,
+ }
+ #endif
+
+- /* #i42122# translate all keys with Ctrl and/or Alt to group 0
+- * else shortcuts (e.g. Ctrl-o) will not work but be inserted by
+- * the application
+- */
+- /* #i52338# do this for all keys that the independent part has no key code for
+- */
++ /*
++ * #i42122# translate all keys with Ctrl and/or Alt to group 0 else
++ * shortcuts (e.g. Ctrl-o) will not work but be inserted by the
++ * application
++ *
++ * #i52338# do this for all keys that the independent part has no key code
++ * for
++ *
++ * fdo#41169 rather than use group 0, detect if there is a group which can
++ * be used to input Latin text and use that if possible
++ */
+ aEvent.mnCode = GetKeyCode( keyval );
+ if( aEvent.mnCode == 0 )
+ {
+- // check other mapping
+- gint eff_group, level;
+- GdkModifierType consumed;
+- guint updated_keyval = 0;
+- // use gdk_keymap_get_default instead of NULL;
+- // workaround a crahs fixed in gtk 2.4
+- if( gdk_keymap_translate_keyboard_state( gdk_keymap_get_default(),
+- hardware_keycode,
+- (GdkModifierType)0,
+- 0,
+- &updated_keyval,
+- &eff_group,
+- &level,
+- &consumed ) )
++ gint best_group = SAL_MAX_INT32;
++
++ // Try and find Latin layout
++ GdkKeymap* keymap = gdk_keymap_get_default();
++ GdkKeymapKey *keys;
++ gint n_keys;
++ if (gdk_keymap_get_entries_for_keyval(keymap, GDK_A, &keys, &n_keys))
+ {
+- aEvent.mnCode = GetKeyCode( updated_keyval );
++ // Find the lowest group that supports Latin layout
++ for (gint i = 0; i < n_keys; ++i)
++ {
++ if (keys[i].level != 0 && keys[i].level != 1)
++ continue;
++ best_group = std::min(best_group, keys[i].group);
++ if (best_group == 0)
++ break;
++ }
++ g_free(keys);
+ }
++
++ //Unavailable, go with original group then I suppose
++ if (best_group == SAL_MAX_INT32)
++ best_group = group;
++
++ guint updated_keyval = GetKeyValFor(keymap, hardware_keycode, best_group);
++ aEvent.mnCode = GetKeyCode(updated_keyval);
+ }
++
+ aEvent.mnCode |= GetKeyModCode( state );
+
+ if( bDown )
+--
+1.8.3.1
+
diff --git a/libreoffice.spec b/libreoffice.spec
index 231ac56..de3a805 100644
--- a/libreoffice.spec
+++ b/libreoffice.spec
@@ -43,7 +43,7 @@ Summary: Free Software Productivity Suite
Name: libreoffice
Epoch: 1
Version: %{libo_version}.2
-Release: 6%{?libo_prerelease}%{?dist}
+Release: 7%{?libo_prerelease}%{?dist}
License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0
Group: Applications/Productivity
URL: http://www.libreoffice.org/default/
@@ -274,6 +274,7 @@ Patch33: 0001-add-config.-for-formats-newly-supported-by-libmwaw.patch
Patch34: 0001-enable-more-formats-supported-by-libmwaw.patch
Patch35: 0001-Revert-transpose-data-in-rows-ranges-for-internal-da.patch
Patch36: 0001-fdo-69971-formula-dialog-crash-when-Paint-restores-E.patch
+Patch37: 0001-Related-fdo-41169-fix-GTK-non-Latin-keyboard-layout-.patch
%define instdir %{_libdir}
%define baseinstdir %{instdir}/libreoffice
@@ -1045,6 +1046,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc
%patch34 -p1 -b .enable-more-formats-supported-by-libmwaw.patch
%patch35 -p1 -b .Revert-transpose-data-in-rows-ranges-for-internal-da.patch
%patch36 -p1 -b .fdo-69971-formula-dialog-crash-when-Paint-restores-E.patch
+%patch37 -p1 -b .fdo-41169-fix-GTK-non-Latin-keyboard-layout-.patch
# TODO: check this
# these are horribly incomplete--empty translations and copied english
@@ -2134,7 +2136,10 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
%endif
%changelog
-* Thu Nov 21 2013 Caolán McNamara <caolanm at redhat.com> - 1:4.1.3.2-5
+* Fri Nov 22 2013 Caolán McNamara <caolanm at redhat.com> - 1:4.1.3.2-7.unbuilt
+- Resolves: rhbz#958300 fix GTK non Latin keyboard layout shortcuts
+
+* Thu Nov 21 2013 Caolán McNamara <caolanm at redhat.com> - 1:4.1.3.2-6
- Resolves: rhbz#1008102 Revert transpose data in rows ranges
- Resolves: rhbz#1031174 suspicious input handler crashes
More information about the scm-commits
mailing list