[evolution] Bug 788293 - Editing an appointment name inline inserts newline when pressing Enter



commit 096ddcc5e3b597d7482aab8fbbea240cf9953af9
Author: Milan Crha <mcrha redhat com>
Date:   Tue Oct 3 13:53:17 2017 +0200

    Bug 788293 - Editing an appointment name inline inserts newline when pressing Enter

 src/calendar/gui/e-day-view.c        |    9 ++++++---
 src/calendar/gui/e-week-view.c       |    9 +++++----
 src/calendar/gui/e-weekday-chooser.c |    1 +
 3 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/src/calendar/gui/e-day-view.c b/src/calendar/gui/e-day-view.c
index 8854665..facd0b3 100644
--- a/src/calendar/gui/e-day-view.c
+++ b/src/calendar/gui/e-day-view.c
@@ -6481,11 +6481,12 @@ e_day_view_do_key_press (GtkWidget *widget,
 
        /* We only want to start an edit with a return key or a simple
         * character. */
-       if ((keyval != GDK_KEY_Return) &&
+       if ((keyval != GDK_KEY_Return && keyval != GDK_KEY_KP_Enter) &&
            (((keyval >= 0x20) && (keyval <= 0xFF)
              && (event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)))
             || (event->length == 0)
-            || (keyval == GDK_KEY_Tab))) {
+            || (keyval == GDK_KEY_Tab)
+            || (keyval == GDK_KEY_Escape))) {
                return FALSE;
        }
 
@@ -7369,7 +7370,9 @@ e_day_view_on_text_item_event (GnomeCanvasItem *item,
        switch (event->type) {
        case GDK_KEY_PRESS:
                tooltip_destroy (day_view, item);
-               if (!E_TEXT (item)->preedit_len && event && event->key.keyval == GDK_KEY_Return) {
+               if (!E_TEXT (item)->preedit_len && event && (
+                    event->key.keyval == GDK_KEY_Return ||
+                    event->key.keyval == GDK_KEY_KP_Enter)) {
                        day_view->resize_event_num = -1;
 
                        /* We set the keyboard focus to the EDayView, so the
diff --git a/src/calendar/gui/e-week-view.c b/src/calendar/gui/e-week-view.c
index 19f0fcb..0eed94d 100644
--- a/src/calendar/gui/e-week-view.c
+++ b/src/calendar/gui/e-week-view.c
@@ -4194,7 +4194,7 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
                tooltip_destroy (week_view, item);
                gdk_event_get_keyval (gdk_event, &event_keyval);
 
-               if (!E_TEXT (item)->preedit_len && event_keyval == GDK_KEY_Return) {
+               if (!E_TEXT (item)->preedit_len && (event_keyval == GDK_KEY_Return || event_keyval == 
GDK_KEY_KP_Enter)) {
                        /* We set the keyboard focus to the EDayView, so the
                         * EText item loses it and stops the edit. */
                        gtk_widget_grab_focus (GTK_WIDGET (week_view));
@@ -5066,12 +5066,13 @@ e_week_view_do_key_press (GtkWidget *widget,
 
        /* We only want to start an edit with a return key or a simple
         * character. */
-       if (event->keyval == GDK_KEY_Return) {
+       if (event->keyval == GDK_KEY_Return || event->keyval == GDK_KEY_KP_Enter) {
                initial_text = NULL;
        } else if (((event->keyval >= 0x20) && (event->keyval <= 0xFF)
                    && (event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)))
                   || (event->length == 0)
-                  || (event->keyval == GDK_KEY_Tab)) {
+                  || (event->keyval == GDK_KEY_Tab)
+                  || (event->keyval == GDK_KEY_Escape)) {
                return FALSE;
        } else
                initial_text = e_utf8_from_gtk_event_key (widget, event->keyval, event->string);
@@ -5163,7 +5164,7 @@ e_week_view_on_jump_button_event (GnomeCanvasItem *item,
                /* with a return key or a simple character (from 0x20 to 0xff),
                 * jump to the day
                 */
-               if ((event->key.keyval == GDK_KEY_Return) ||
+               if ((event->key.keyval == GDK_KEY_Return || event->key.keyval == GDK_KEY_KP_Enter) ||
                    ((event->key.keyval >= 0x20) &&
                     (event->key.keyval <= 0xFF))) {
                        e_week_view_jump_to_button_item (week_view, item);
diff --git a/src/calendar/gui/e-weekday-chooser.c b/src/calendar/gui/e-weekday-chooser.c
index eb49d1d..d7af6ab 100644
--- a/src/calendar/gui/e-weekday-chooser.c
+++ b/src/calendar/gui/e-weekday-chooser.c
@@ -430,6 +430,7 @@ handle_key_press_event (EWeekdayChooser *chooser,
                        break;
                case GDK_KEY_space:
                case GDK_KEY_Return:
+               case GDK_KEY_KP_Enter:
                        day_clicked (chooser, priv->focus_day);
                        return TRUE;
                default:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]