[network-manager-applet] editor: fix crash when 'Tab' is pressed with XIM input (editting IPs) (rh #747368)
- From: JiÅÃ KlimeÅ <jklimes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet] editor: fix crash when 'Tab' is pressed with XIM input (editting IPs) (rh #747368)
- Date: Wed, 5 Dec 2012 18:14:43 +0000 (UTC)
commit d06f1ea8e2eaa5faab41fbc87669dc9c56b3cb73
Author: JiÅÃ KlimeÅ <jklimes redhat com>
Date: Wed Dec 5 18:58:39 2012 +0100
editor: fix crash when 'Tab' is pressed with XIM input (editting IPs) (rh #747368)
Reproducer:
1. GTK_IM_MODULE=xim nm-connection-editor
2. Go to 'IPv4 Settings', set Method as 'Manual'
3. Click Add and then press Tab key
For details see:
https://bugzilla.redhat.com/show_bug.cgi?id=747368
src/connection-editor/ip4-routes-dialog.c | 25 +++++++++++++++++++++----
src/connection-editor/ip6-routes-dialog.c | 25 +++++++++++++++++++++----
src/connection-editor/page-ip4.c | 23 ++++++++++++++++++++---
src/connection-editor/page-ip6.c | 23 ++++++++++++++++++++---
4 files changed, 82 insertions(+), 14 deletions(-)
---
diff --git a/src/connection-editor/ip4-routes-dialog.c b/src/connection-editor/ip4-routes-dialog.c
index 6bcd83d..c23e241 100644
--- a/src/connection-editor/ip4-routes-dialog.c
+++ b/src/connection-editor/ip4-routes-dialog.c
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2011 Red Hat, Inc.
+ * (C) Copyright 2008 - 2012 Red Hat, Inc.
*/
#include "config.h"
@@ -492,9 +492,26 @@ key_pressed_cb (GtkWidget *widget,
#define GDK_KEY_Tab GDK_Tab
#endif
- /* Tab should behave the same way as Enter (finish editing) */
- if (event->type == GDK_KEY_PRESS && event->key.keyval == GDK_KEY_Tab)
- gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (widget));
+ GdkKeymapKey *keys = NULL;
+ gint n_keys;
+
+ /*
+ * Tab should behave the same way as Enter (cycling on cells).
+ *
+ * Previously, we had finished cell editing, which appeared to work:
+ * gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (widget));
+ * But unfortunately, it showed up crash occurred with XIM input (GTK_IM_MODULE=xim).
+ * https://bugzilla.redhat.com/show_bug.cgi?id=747368
+ */
+ if (event->type == GDK_KEY_PRESS && event->key.keyval == GDK_KEY_Tab) {
+ /* Get hardware keycode for GDK_KEY_Return */
+ if (gdk_keymap_get_entries_for_keyval (gdk_keymap_get_default (), GDK_KEY_Return, &keys, &n_keys)) {
+ /* Change 'Tab' to 'Enter' key */
+ event->key.keyval = GDK_KEY_Return;
+ event->key.hardware_keycode = keys[0].keycode;
+ }
+ g_free (keys);
+ }
return FALSE;
}
diff --git a/src/connection-editor/ip6-routes-dialog.c b/src/connection-editor/ip6-routes-dialog.c
index 0b47861..c332147 100644
--- a/src/connection-editor/ip6-routes-dialog.c
+++ b/src/connection-editor/ip6-routes-dialog.c
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2011 Red Hat, Inc.
+ * (C) Copyright 2008 - 2012 Red Hat, Inc.
*/
#include "config.h"
@@ -433,9 +433,26 @@ key_pressed_cb (GtkWidget *widget,
#define GDK_KEY_Tab GDK_Tab
#endif
- /* Tab should behave the same way as Enter (finish editing) */
- if (event->type == GDK_KEY_PRESS && event->key.keyval == GDK_KEY_Tab)
- gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (widget));
+ GdkKeymapKey *keys = NULL;
+ gint n_keys;
+
+ /*
+ * Tab should behave the same way as Enter (cycling on cells).
+ *
+ * Previously, we had finished cell editing, which appeared to work:
+ * gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (widget));
+ * But unfortunately, it showed up crash occurred with XIM input (GTK_IM_MODULE=xim).
+ * https://bugzilla.redhat.com/show_bug.cgi?id=747368
+ */
+ if (event->type == GDK_KEY_PRESS && event->key.keyval == GDK_KEY_Tab) {
+ /* Get hardware keycode for GDK_KEY_Return */
+ if (gdk_keymap_get_entries_for_keyval (gdk_keymap_get_default (), GDK_KEY_Return, &keys, &n_keys)) {
+ /* Change 'Tab' to 'Enter' key */
+ event->key.keyval = GDK_KEY_Return;
+ event->key.hardware_keycode = keys[0].keycode;
+ }
+ g_free (keys);
+ }
return FALSE;
}
diff --git a/src/connection-editor/page-ip4.c b/src/connection-editor/page-ip4.c
index 9493723..9cf7b32 100644
--- a/src/connection-editor/page-ip4.c
+++ b/src/connection-editor/page-ip4.c
@@ -742,9 +742,26 @@ key_pressed_cb (GtkWidget *widget,
#define GDK_KEY_Tab GDK_Tab
#endif
- /* Tab should behave the same way as Enter (finish editing) */
- if (event->type == GDK_KEY_PRESS && event->key.keyval == GDK_KEY_Tab)
- gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (widget));
+ GdkKeymapKey *keys = NULL;
+ gint n_keys;
+
+ /*
+ * Tab should behave the same way as Enter (cycling on cells).
+ *
+ * Previously, we had finished cell editing, which appeared to work:
+ * gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (widget));
+ * But unfortunately, it showed up crash occurred with XIM input (GTK_IM_MODULE=xim).
+ * https://bugzilla.redhat.com/show_bug.cgi?id=747368
+ */
+ if (event->type == GDK_KEY_PRESS && event->key.keyval == GDK_KEY_Tab) {
+ /* Get hardware keycode for GDK_KEY_Return */
+ if (gdk_keymap_get_entries_for_keyval (gdk_keymap_get_default (), GDK_KEY_Return, &keys, &n_keys)) {
+ /* Change 'Tab' to 'Enter' key */
+ event->key.keyval = GDK_KEY_Return;
+ event->key.hardware_keycode = keys[0].keycode;
+ }
+ g_free (keys);
+ }
return FALSE;
}
diff --git a/src/connection-editor/page-ip6.c b/src/connection-editor/page-ip6.c
index 0724ccc..da5b147 100644
--- a/src/connection-editor/page-ip6.c
+++ b/src/connection-editor/page-ip6.c
@@ -703,9 +703,26 @@ key_pressed_cb (GtkWidget *widget,
#define GDK_KEY_Tab GDK_Tab
#endif
- /* Tab should behave the same way as Enter (finish editing) */
- if (event->type == GDK_KEY_PRESS && event->key.keyval == GDK_KEY_Tab)
- gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (widget));
+ GdkKeymapKey *keys = NULL;
+ gint n_keys;
+
+ /*
+ * Tab should behave the same way as Enter (cycling on cells).
+ *
+ * Previously, we had finished cell editing, which appeared to work:
+ * gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (widget));
+ * But unfortunately, it showed up crash occurred with XIM input (GTK_IM_MODULE=xim).
+ * https://bugzilla.redhat.com/show_bug.cgi?id=747368
+ */
+ if (event->type == GDK_KEY_PRESS && event->key.keyval == GDK_KEY_Tab) {
+ /* Get hardware keycode for GDK_KEY_Return */
+ if (gdk_keymap_get_entries_for_keyval (gdk_keymap_get_default (), GDK_KEY_Return, &keys, &n_keys)) {
+ /* Change 'Tab' to 'Enter' key */
+ event->key.keyval = GDK_KEY_Return;
+ event->key.hardware_keycode = keys[0].keycode;
+ }
+ g_free (keys);
+ }
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]