Title: [91376] trunk/Source/WebCore
Revision
91376
Author
[email protected]
Date
2011-07-20 09:52:13 -0700 (Wed, 20 Jul 2011)

Log Message

[GTK] REGRESSION(r86436): does not add newlines when return is pressed with some modifiers held
https://bugs.webkit.org/show_bug.cgi?id=64867

Patch by Gustavo Noronha Silva <[email protected]> on 2011-07-20
Reviewed by Martin Robinson.

* platform/gtk/KeyBindingTranslator.cpp:
(WebCore::KeyBindingTranslator::getEditorCommandsForKeyEvent):
special-case enter keys so that their commands are returned
whatever the modifiers state.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (91375 => 91376)


--- trunk/Source/WebCore/ChangeLog	2011-07-20 16:42:51 UTC (rev 91375)
+++ trunk/Source/WebCore/ChangeLog	2011-07-20 16:52:13 UTC (rev 91376)
@@ -1,3 +1,15 @@
+2011-07-20  Gustavo Noronha Silva  <[email protected]>
+
+        [GTK] REGRESSION(r86436): does not add newlines when return is pressed with some modifiers held
+        https://bugs.webkit.org/show_bug.cgi?id=64867
+
+        Reviewed by Martin Robinson.
+
+        * platform/gtk/KeyBindingTranslator.cpp:
+        (WebCore::KeyBindingTranslator::getEditorCommandsForKeyEvent):
+        special-case enter keys so that their commands are returned
+        whatever the modifiers state.
+
 2011-07-20  Mike Reed  <[email protected]>
 
         [skia] disable lcd text when drawing on a transparent layer or canvas

Modified: trunk/Source/WebCore/platform/gtk/KeyBindingTranslator.cpp (91375 => 91376)


--- trunk/Source/WebCore/platform/gtk/KeyBindingTranslator.cpp	2011-07-20 16:42:51 UTC (rev 91375)
+++ trunk/Source/WebCore/platform/gtk/KeyBindingTranslator.cpp	2011-07-20 16:52:13 UTC (rev 91376)
@@ -179,10 +179,6 @@
     g_signal_connect(m_nativeWidget.get(), "show-help", G_CALLBACK(showHelpCallback), this);
 }
 
-static const unsigned CtrlKey = 1 << 0;
-static const unsigned AltKey = 1 << 1;
-static const unsigned ShiftKey = 1 << 2;
-
 struct KeyCombinationEntry {
     unsigned gdkKeyCode;
     unsigned state;
@@ -201,20 +197,6 @@
 static const KeyCombinationEntry keyPressEntries[] = {
     { GDK_Tab,       0,                              "InsertTab"     },
     { GDK_Tab,       GDK_SHIFT_MASK,                 "InsertBacktab" },
-    { GDK_Tab,       0,                              "InsertTab"     },
-    { GDK_Tab,       GDK_SHIFT_MASK,                 "InsertBacktab" },
-    { GDK_Return,    0,                              "InsertNewline" },
-    { GDK_Return,    GDK_CONTROL_MASK,               "InsertNewline" },
-    { GDK_Return,    GDK_MOD1_MASK,                  "InsertNewline" },
-    { GDK_Return,    GDK_MOD1_MASK | GDK_SHIFT_MASK, "InsertNewline" },
-    { GDK_KP_Enter,  0,                              "InsertNewline" },
-    { GDK_KP_Enter,  GDK_CONTROL_MASK,               "InsertNewline" },
-    { GDK_KP_Enter,  GDK_MOD1_MASK,                  "InsertNewline" },
-    { GDK_KP_Enter,  GDK_MOD1_MASK | GDK_SHIFT_MASK, "InsertNewline" },
-    { GDK_ISO_Enter, 0,                              "InsertNewline" },
-    { GDK_ISO_Enter, GDK_CONTROL_MASK,               "InsertNewline" },
-    { GDK_ISO_Enter, GDK_MOD1_MASK,                  "InsertNewline" },
-    { GDK_ISO_Enter, GDK_MOD1_MASK | GDK_SHIFT_MASK, "InsertNewline" },
 };
 
 void KeyBindingTranslator::getEditorCommandsForKeyEvent(GdkEventKey* event, EventType type, Vector<WTF::String>& commandList)
@@ -243,12 +225,18 @@
             keyPressCommandsMap.set(keyPressEntries[i].state << 16 | keyPressEntries[i].gdkKeyCode, keyPressEntries[i].name);
     }
 
+    // Special-case enter keys for we want them to work regardless of modifier.
+    if ((event->keyval == GDK_Return || event->keyval == GDK_KP_Enter || event->keyval == GDK_ISO_Enter) && type == KeyPress) {
+        commandList.append("InsertNewLine");
+        return;
+    }
+
     // For keypress events, we want charCode(), but keyCode() does that.
     int mapKey = event->state << 16 | event->keyval;
     if (mapKey) {
         HashMap<int, const char*>* commandMap = type == KeyDown ?  &keyDownCommandsMap : &keyPressCommandsMap;
         if (const char* commandString = commandMap->get(mapKey)) {
-            commandList.append(commandString);  
+            commandList.append(commandString);
             return;
         }
     }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to