2008-02-08 Pierre-Luc Beaudoin <pierre-luc.beaudoin@collabora.co.uk>
authoralp@webkit.org <alp@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Feb 2008 10:41:58 +0000 (10:41 +0000)
committeralp@webkit.org <alp@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Feb 2008 10:41:58 +0000 (10:41 +0000)
        Reviewed by Alp Toker.

        http://bugs.webkit.org/show_bug.cgi?id=17009
        [Gtk] Webkit strips accents from some dead-key combinations

        KeyEvents have to go through the gtk input method.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@30090 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/PlatformKeyboardEvent.h
WebCore/platform/gtk/KeyEventGtk.cpp
WebKit/gtk/ChangeLog
WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp

index 08ba8de..38648cb 100644 (file)
@@ -1,3 +1,21 @@
+2008-02-08  Pierre-Luc Beaudoin  <pierre-luc.beaudoin@collabora.co.uk>
+
+        Reviewed by Alp Toker.
+
+        http://bugs.webkit.org/show_bug.cgi?id=17009
+        [Gtk] Webkit strips accents from some dead-key combinations
+
+        KeyEvents have to go through the gtk input method.
+
+        Also implement the isKeypad check and make disambiguateKeyDownEvent
+        behave more like other ports.
+
+        * platform/PlatformKeyboardEvent.h:
+        * platform/gtk/KeyEventGtk.cpp:
+        (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
+        (WebCore::PlatformKeyboardEvent::disambiguateKeyDownEvent):
+        (WebCore::PlatformKeyboardEvent::gdkEventKey):
+
 2008-02-08  Darin Adler  <darin@apple.com>
 
         Reviewed by Eric.
index 3d4268a..4346295 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2008 Collabora, Ltd.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -118,6 +119,7 @@ namespace WebCore {
 
 #if PLATFORM(GTK)
         PlatformKeyboardEvent(GdkEventKey*);
+        GdkEventKey* gdkEventKey() const;
 #endif
 
 #if PLATFORM(QT)
@@ -147,6 +149,9 @@ namespace WebCore {
 #if PLATFORM(WIN)
         bool m_isSystemKey;
 #endif
+#if PLATFORM(GTK)
+        GdkEventKey* m_gdkEventKey;
+#endif
     };
 
 } // namespace WebCore
index 5d2efcf..f0f705e 100644 (file)
@@ -2,6 +2,7 @@
  * Copyright (C) 2006, 2007 Apple Inc.  All rights reserved.
  * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
  * Copyright (C) 2007 Holger Hans Peter Freyther
+ * Copyright (C) 2008 Collabora, Ltd.  All rights reserved.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -484,6 +485,7 @@ static String singleCharacterString(guint val)
     return retVal;
 }
 
+// TODO: m_gdkEventKey should be refcounted
 PlatformKeyboardEvent::PlatformKeyboardEvent(GdkEventKey* event)
     : m_type((event->type == GDK_KEY_RELEASE) ? KeyUp : KeyDown)
     , m_text(singleCharacterString(event->keyval))
@@ -491,20 +493,24 @@ PlatformKeyboardEvent::PlatformKeyboardEvent(GdkEventKey* event)
     , m_keyIdentifier(keyIdentifierForGdkKeyCode(event->keyval))
     , m_autoRepeat(false)
     , m_windowsVirtualKeyCode(windowsKeyCodeForKeyEvent(event->keyval))
-    , m_isKeypad(false)
+    , m_isKeypad(event->keyval >= GDK_KP_Space && event->keyval <= GDK_KP_9)
     , m_shiftKey((event->state & GDK_SHIFT_MASK) || (event->keyval == GDK_3270_BackTab))
     , m_ctrlKey(event->state & GDK_CONTROL_MASK)
     , m_altKey(event->state & GDK_MOD1_MASK)
     , m_metaKey(event->state & GDK_MOD2_MASK)
+    , m_gdkEventKey(event)
 {
 }
 
-void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool)
+void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool backwardCompatibilityMode)
 {
     // Can only change type from KeyDown to RawKeyDown or Char, as we lack information for other conversions.
     ASSERT(m_type == KeyDown);
     m_type = type;
 
+    if (backwardCompatibilityMode)
+        return;
+
     if (type == RawKeyDown) {
         m_text = String();
         m_unmodifiedText = String();
@@ -520,4 +526,9 @@ bool PlatformKeyboardEvent::currentCapsLockState()
     return false;
 }
 
+GdkEventKey* PlatformKeyboardEvent::gdkEventKey() const
+{
+    return m_gdkEventKey;
+}
+
 }
index 42f717d..2a74e2d 100644 (file)
@@ -1,3 +1,16 @@
+2008-02-08  Pierre-Luc Beaudoin  <pierre-luc.beaudoin@collabora.co.uk>
+
+        Reviewed by Alp Toker.
+
+        http://bugs.webkit.org/show_bug.cgi?id=17009
+        [Gtk] Webkit strips accents from some dead-key combinations
+
+        KeyEvents have to go through the gtk input method.
+
+        * WebCoreSupport/EditorClientGtk.cpp:
+        (WebKit::imContextCommitted):
+        (WebKit::EditorClient::doTextFieldCommandFromEvent):
+
 2008-02-05  Mark Rowe  <mrowe@apple.com>
 
         Reviewed by Alp Toker.
index 663e2b1..8b6c954 100644 (file)
@@ -37,7 +37,7 @@ namespace WebKit {
 static void imContextCommitted(GtkIMContext* context, const char* str, EditorClient* client)
 {
     Frame* frame = core(client->m_webView)->focusController()->focusedOrMainFrame();
-    frame->editor()->insertTextWithoutSendingTextEvent(str, false);
+    frame->editor()->insertTextWithoutSendingTextEvent(String::fromUTF8(str), false);
 }
 
 bool EditorClient::shouldDeleteRange(Range*)
@@ -382,10 +382,10 @@ void EditorClient::textDidChangeInTextField(Element*)
     notImplemented();
 }
 
-bool EditorClient::doTextFieldCommandFromEvent(Element*, KeyboardEvent*)
+bool EditorClient::doTextFieldCommandFromEvent(Element* element, KeyboardEvent* event)
 {
-    notImplemented();
-    return false;
+    WebKitWebViewPrivate* priv = m_webView->priv;
+    return gtk_im_context_filter_keypress(priv->imContext, event->keyEvent()->gdkEventKey());
 }
 
 void EditorClient::textWillBeDeletedInTextField(Element*)