[network-manager-applet] editor: additional fix for navigation in address/route treeview (rh #1201412)
- From: Jiří Klimeš <jklimes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet] editor: additional fix for navigation in address/route treeview (rh #1201412)
- Date: Mon, 30 Mar 2015 13:47:54 +0000 (UTC)
commit 0bc3e5a226822b82440e0691385fdce015012b02
Author: Jiří Klimeš <jklimes redhat com>
Date: Mon Mar 30 15:34:44 2015 +0200
editor: additional fix for navigation in address/route treeview (rh #1201412)
Make keypad keys (Enter, UpArrow, DownArrow) work properly.
https://bugzilla.redhat.com/show_bug.cgi?id=1201412
src/connection-editor/ip4-routes-dialog.c | 25 +++++++++++++++++++------
src/connection-editor/ip6-routes-dialog.c | 25 +++++++++++++++++++------
src/connection-editor/page-ip4.c | 25 +++++++++++++++++++------
src/connection-editor/page-ip6.c | 25 +++++++++++++++++++------
4 files changed, 76 insertions(+), 24 deletions(-)
---
diff --git a/src/connection-editor/ip4-routes-dialog.c b/src/connection-editor/ip4-routes-dialog.c
index c7ff6cc..310b203 100644
--- a/src/connection-editor/ip4-routes-dialog.c
+++ b/src/connection-editor/ip4-routes-dialog.c
@@ -507,13 +507,21 @@ key_pressed_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
modifiers = event->state & gtk_accelerator_get_default_mod_mask ();
/*
- * Tab should behave the same way as Enter (cycling on cells).
+ * Change some keys so that they work properly:
+ * We want:
+ * - Tab should behave the same way as Enter (cycling on cells),
+ * - Shift-Tab should move in backwards direction.
+ * - Down arrow moves as Enter, but we have to handle Down arrow on
+ * key pad.
+ * - Up arrow should move backwards and we also have to handle Up arrow
+ * on key pad.
+ * - Enter should end editing when pressed on last column.
*
- * 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).
+ * Note: gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (widget)) cannot be called
+ * in this function, because it would crash with XIM input (GTK_IM_MODULE=xim), see
* https://bugzilla.redhat.com/show_bug.cgi?id=747368
*/
+
if (event->keyval == GDK_KEY_Tab && modifiers == 0) {
/* Tab */
g_object_set_data (G_OBJECT (cell), DIRECTION_TAG, GINT_TO_POINTER (1));
@@ -522,9 +530,14 @@ key_pressed_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
/* Shift-Tab */
g_object_set_data (G_OBJECT (cell), DIRECTION_TAG, GINT_TO_POINTER (-1));
utils_fake_return_key (event);
- } else if (event->keyval == GDK_KEY_Up)
+ } else if (event->keyval == GDK_KEY_KP_Down)
+ event->keyval = GDK_KEY_Down;
+ else if (event->keyval == GDK_KEY_Up || event->keyval == GDK_KEY_KP_Up) {
+ event->keyval = GDK_KEY_Up;
g_object_set_data (G_OBJECT (cell), DIRECTION_TAG, GINT_TO_POINTER (-1));
- else if (event->keyval == GDK_KEY_Return || event->keyval == GDK_KEY_ISO_Enter)
+ } else if ( event->keyval == GDK_KEY_Return
+ || event->keyval == GDK_KEY_ISO_Enter
+ || event->keyval == GDK_KEY_KP_Enter)
g_object_set_data (G_OBJECT (cell), DO_NOT_CYCLE_TAG, GUINT_TO_POINTER (TRUE));
return FALSE; /* Allow default handler to be called */
diff --git a/src/connection-editor/ip6-routes-dialog.c b/src/connection-editor/ip6-routes-dialog.c
index b7e48f2..2c830a7 100644
--- a/src/connection-editor/ip6-routes-dialog.c
+++ b/src/connection-editor/ip6-routes-dialog.c
@@ -452,13 +452,21 @@ key_pressed_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
modifiers = event->state & gtk_accelerator_get_default_mod_mask ();
/*
- * Tab should behave the same way as Enter (cycling on cells).
+ * Change some keys so that they work properly:
+ * We want:
+ * - Tab should behave the same way as Enter (cycling on cells),
+ * - Shift-Tab should move in backwards direction.
+ * - Down arrow moves as Enter, but we have to handle Down arrow on
+ * key pad.
+ * - Up arrow should move backwards and we also have to handle Up arrow
+ * on key pad.
+ * - Enter should end editing when pressed on last column.
*
- * 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).
+ * Note: gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (widget)) cannot be called
+ * in this function, because it would crash with XIM input (GTK_IM_MODULE=xim), see
* https://bugzilla.redhat.com/show_bug.cgi?id=747368
*/
+
if (event->keyval == GDK_KEY_Tab && modifiers == 0) {
/* Tab */
g_object_set_data (G_OBJECT (cell), DIRECTION_TAG, GINT_TO_POINTER (1));
@@ -467,9 +475,14 @@ key_pressed_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
/* Shift-Tab */
g_object_set_data (G_OBJECT (cell), DIRECTION_TAG, GINT_TO_POINTER (-1));
utils_fake_return_key (event);
- } else if (event->keyval == GDK_KEY_Up)
+ } else if (event->keyval == GDK_KEY_KP_Down)
+ event->keyval = GDK_KEY_Down;
+ else if (event->keyval == GDK_KEY_Up || event->keyval == GDK_KEY_KP_Up) {
+ event->keyval = GDK_KEY_Up;
g_object_set_data (G_OBJECT (cell), DIRECTION_TAG, GINT_TO_POINTER (-1));
- else if (event->keyval == GDK_KEY_Return || event->keyval == GDK_KEY_ISO_Enter)
+ } else if ( event->keyval == GDK_KEY_Return
+ || event->keyval == GDK_KEY_ISO_Enter
+ || event->keyval == GDK_KEY_KP_Enter)
g_object_set_data (G_OBJECT (cell), DO_NOT_CYCLE_TAG, GUINT_TO_POINTER (TRUE));
return FALSE; /* Allow default handler to be called */
diff --git a/src/connection-editor/page-ip4.c b/src/connection-editor/page-ip4.c
index f4c24bb..a6ec715 100644
--- a/src/connection-editor/page-ip4.c
+++ b/src/connection-editor/page-ip4.c
@@ -766,13 +766,21 @@ key_pressed_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
modifiers = event->state & gtk_accelerator_get_default_mod_mask ();
/*
- * Tab should behave the same way as Enter (cycling on cells).
+ * Change some keys so that they work properly:
+ * We want:
+ * - Tab should behave the same way as Enter (cycling on cells),
+ * - Shift-Tab should move in backwards direction.
+ * - Down arrow moves as Enter, but we have to handle Down arrow on
+ * key pad.
+ * - Up arrow should move backwards and we also have to handle Up arrow
+ * on key pad.
+ * - Enter should end editing when pressed on last column.
*
- * 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).
+ * Note: gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (widget)) cannot be called
+ * in this function, because it would crash with XIM input (GTK_IM_MODULE=xim), see
* https://bugzilla.redhat.com/show_bug.cgi?id=747368
*/
+
if (event->keyval == GDK_KEY_Tab && modifiers == 0) {
/* Tab */
g_object_set_data (G_OBJECT (cell), DIRECTION_TAG, GINT_TO_POINTER (1));
@@ -781,9 +789,14 @@ key_pressed_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
/* Shift-Tab */
g_object_set_data (G_OBJECT (cell), DIRECTION_TAG, GINT_TO_POINTER (-1));
utils_fake_return_key (event);
- } else if (event->keyval == GDK_KEY_Up)
+ } else if (event->keyval == GDK_KEY_KP_Down)
+ event->keyval = GDK_KEY_Down;
+ else if (event->keyval == GDK_KEY_Up || event->keyval == GDK_KEY_KP_Up) {
+ event->keyval = GDK_KEY_Up;
g_object_set_data (G_OBJECT (cell), DIRECTION_TAG, GINT_TO_POINTER (-1));
- else if (event->keyval == GDK_KEY_Return || event->keyval == GDK_KEY_ISO_Enter)
+ } else if ( event->keyval == GDK_KEY_Return
+ || event->keyval == GDK_KEY_ISO_Enter
+ || event->keyval == GDK_KEY_KP_Enter)
g_object_set_data (G_OBJECT (cell), DO_NOT_CYCLE_TAG, GUINT_TO_POINTER (TRUE));
return FALSE; /* Allow default handler to be called */
diff --git a/src/connection-editor/page-ip6.c b/src/connection-editor/page-ip6.c
index 0d79589..35ef713 100644
--- a/src/connection-editor/page-ip6.c
+++ b/src/connection-editor/page-ip6.c
@@ -762,13 +762,21 @@ key_pressed_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
modifiers = event->state & gtk_accelerator_get_default_mod_mask ();
/*
- * Tab should behave the same way as Enter (cycling on cells).
+ * Change some keys so that they work properly:
+ * We want:
+ * - Tab should behave the same way as Enter (cycling on cells),
+ * - Shift-Tab should move in backwards direction.
+ * - Down arrow moves as Enter, but we have to handle Down arrow on
+ * key pad.
+ * - Up arrow should move backwards and we also have to handle Up arrow
+ * on key pad.
+ * - Enter should end editing when pressed on last column.
*
- * 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).
+ * Note: gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (widget)) cannot be called
+ * in this function, because it would crash with XIM input (GTK_IM_MODULE=xim), see
* https://bugzilla.redhat.com/show_bug.cgi?id=747368
*/
+
if (event->keyval == GDK_KEY_Tab && modifiers == 0) {
/* Tab */
g_object_set_data (G_OBJECT (cell), DIRECTION_TAG, GINT_TO_POINTER (1));
@@ -777,9 +785,14 @@ key_pressed_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
/* Shift-Tab */
g_object_set_data (G_OBJECT (cell), DIRECTION_TAG, GINT_TO_POINTER (-1));
utils_fake_return_key (event);
- } else if (event->keyval == GDK_KEY_Up)
+ } else if (event->keyval == GDK_KEY_KP_Down)
+ event->keyval = GDK_KEY_Down;
+ else if (event->keyval == GDK_KEY_Up || event->keyval == GDK_KEY_KP_Up) {
+ event->keyval = GDK_KEY_Up;
g_object_set_data (G_OBJECT (cell), DIRECTION_TAG, GINT_TO_POINTER (-1));
- else if (event->keyval == GDK_KEY_Return || event->keyval == GDK_KEY_ISO_Enter)
+ } else if ( event->keyval == GDK_KEY_Return
+ || event->keyval == GDK_KEY_ISO_Enter
+ || event->keyval == GDK_KEY_KP_Enter)
g_object_set_data (G_OBJECT (cell), DO_NOT_CYCLE_TAG, GUINT_TO_POINTER (TRUE));
return FALSE; /* Allow default handler to be called */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]