summaryrefslogtreecommitdiffstats
path: root/views/widget/widget_gtk.h
diff options
context:
space:
mode:
authorsuzhe@google.com <suzhe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-01 22:05:14 +0000
committersuzhe@google.com <suzhe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-01 22:05:14 +0000
commit6c8a4312deb82e599b2c9695b2ec22aa1e298271 (patch)
treeb524c5d2d193ca166da62b4906d19e899a850f47 /views/widget/widget_gtk.h
parent38788d94bc411c89d6a0bbebe6e0628e401e43e4 (diff)
downloadchromium_src-6c8a4312deb82e599b2c9695b2ec22aa1e298271.zip
chromium_src-6c8a4312deb82e599b2c9695b2ec22aa1e298271.tar.gz
chromium_src-6c8a4312deb82e599b2c9695b2ec22aa1e298271.tar.bz2
Integrate the new input method API for Views into Chromium.
This CL contains following changes: 1. Improve TextfieldViewsModel to support composition text. 2. Implement TextInputClient interface in NativeTextfieldViews. 3. Fix Textfield and native implementations to avoid calling TextfieldController::ContentsChanged() when the text is changed by calling Textfield::SetText() or AppendText(). 4. Fix a bug in FocusManager that causes NativeTextfieldViewsTest.FocusTraversalTest to fail. 5. Fix accelerator_handler_touch.cc to send key events to the top-level widget's input method instance instead of the root view. 6. Do the same fix in extension_input_api.cc. 7. Hook InputMethod into WidgetGtk and WidgetWin. BUG=75003 TEST=views_unittests --gtest_filter=NativeTextfieldViews* Review URL: http://codereview.chromium.org/6675005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80226 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/widget/widget_gtk.h')
-rw-r--r--views/widget/widget_gtk.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/views/widget/widget_gtk.h b/views/widget/widget_gtk.h
index 9ddc0a4..323f886 100644
--- a/views/widget/widget_gtk.h
+++ b/views/widget/widget_gtk.h
@@ -13,6 +13,8 @@
#include "ui/base/x/active_window_watcher_x.h"
#include "ui/gfx/size.h"
#include "views/focus/focus_manager.h"
+#include "views/ime/input_method_delegate.h"
+#include "views/ime/input_method_gtk.h"
#include "views/widget/native_widget.h"
#include "views/widget/widget.h"
@@ -41,7 +43,8 @@ class NativeWidgetDelegate;
// Widget implementation for GTK.
class WidgetGtk : public Widget,
public NativeWidget,
- public ui::ActiveWindowWatcherX::Observer {
+ public ui::ActiveWindowWatcherX::Observer,
+ public internal::InputMethodDelegate {
public:
// Type of widget.
enum Type {
@@ -171,7 +174,7 @@ class WidgetGtk : public Widget,
// Handles a keyboard event by sending it to our focus manager.
// Returns true if it's handled by the focus manager.
- bool HandleKeyboardEvent(GdkEventKey* event);
+ bool HandleKeyboardEvent(const KeyEvent& key);
// Enables debug painting. See |debug_paint_enabled_| for details.
static void EnableDebugPaint();
@@ -196,6 +199,8 @@ class WidgetGtk : public Widget,
virtual void SetMouseCapture() OVERRIDE;
virtual void ReleaseMouseCapture() OVERRIDE;
virtual bool HasMouseCapture() const OVERRIDE;
+ virtual InputMethod* GetInputMethodNative() OVERRIDE;
+ virtual void ReplaceInputMethod(InputMethod* input_method) OVERRIDE;
virtual gfx::Rect GetWindowScreenBounds() const OVERRIDE;
virtual gfx::Rect GetClientAreaScreenBounds() const OVERRIDE;
virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
@@ -297,6 +302,9 @@ class WidgetGtk : public Widget,
// Overridden from NativeWidget
virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
+ // Overridden from internal::InputMethodDelegate
+ virtual void DispatchKeyEventPostIME(const KeyEvent& key) OVERRIDE;
+
CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnWindowPaint, GdkEventExpose*);
// Returns the first ancestor of |widget| that is a window.
@@ -414,6 +422,8 @@ class WidgetGtk : public Widget,
// that window manager shows the window only after the window is painted.
bool painted_;
+ scoped_ptr<InputMethod> input_method_;
+
DISALLOW_COPY_AND_ASSIGN(WidgetGtk);
};