Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: chrome/browser/renderer_host/gtk_im_context_wrapper.cc

Issue 7041003: Show composition text on IME panel when Pepper plugin is focused (Linux). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: A todo comment is reworded to be more correct. Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/renderer_host/gtk_im_context_wrapper.h" 5 #include "chrome/browser/renderer_host/gtk_im_context_wrapper.h"
6 6
7 #include <gdk/gdk.h> 7 #include <gdk/gdk.h>
8 #include <gdk/gdkkeysyms.h> 8 #include <gdk/gdkkeysyms.h>
9 #include <gtk/gtk.h> 9 #include <gtk/gtk.h>
10 10
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 218
219 if (!suppress) 219 if (!suppress)
220 host_view_->ForwardKeyboardEvent(wke); 220 host_view_->ForwardKeyboardEvent(wke);
221 } 221 }
222 222
223 last_key_code_ = key_code; 223 last_key_code_ = key_code;
224 last_key_was_up_ = (event->type == GDK_KEY_RELEASE); 224 last_key_was_up_ = (event->type == GDK_KEY_RELEASE);
225 last_key_filtered_no_result_ = (filtered && !has_result); 225 last_key_filtered_no_result_ = (filtered && !has_result);
226 } 226 }
227 227
228 void GtkIMContextWrapper::UpdateInputMethodState(WebKit::WebTextInputType type, 228 void GtkIMContextWrapper::UpdateInputMethodState(
229 const gfx::Rect& caret_rect) { 229 ui::TextInputType type,
230 bool can_compose_inline,
231 const gfx::Rect& caret_rect) {
230 suppress_next_commit_ = false; 232 suppress_next_commit_ = false;
231 233
232 // The renderer has updated its IME status. 234 // The renderer has updated its IME status.
233 // Control the GtkIMContext object according to this status. 235 // Control the GtkIMContext object according to this status.
234 if (!context_ || !is_focused_) 236 if (!context_ || !is_focused_)
235 return; 237 return;
236 238
237 DCHECK(!is_in_key_event_handler_); 239 DCHECK(!is_in_key_event_handler_);
238 240
239 bool is_enabled = (type == WebKit::WebTextInputTypeText); 241 bool is_enabled = (type == ui::TEXT_INPUT_TYPE_TEXT);
240 if (is_enabled_ != is_enabled) { 242 if (is_enabled_ != is_enabled) {
241 is_enabled_ = is_enabled; 243 is_enabled_ = is_enabled;
242 if (is_enabled) 244 if (is_enabled)
243 gtk_im_context_focus_in(context_); 245 gtk_im_context_focus_in(context_);
244 else 246 else
245 gtk_im_context_focus_out(context_); 247 gtk_im_context_focus_out(context_);
246 } 248 }
247 249
248 if (is_enabled) { 250 if (is_enabled) {
251 // If the focused element supports inline rendering of composition text,
252 // we receive and send related events to it. Otherwise, the events related
253 // to the updates of composition text are directed to the candidate window.
254 gtk_im_context_set_use_preedit(context_, can_compose_inline);
249 // Updates the position of the IME candidate window. 255 // Updates the position of the IME candidate window.
250 // The position sent from the renderer is a relative one, so we need to 256 // The position sent from the renderer is a relative one, so we need to
251 // attach the GtkIMContext object to this window before changing the 257 // attach the GtkIMContext object to this window before changing the
252 // position. 258 // position.
253 GdkRectangle cursor_rect(caret_rect.ToGdkRectangle()); 259 GdkRectangle cursor_rect(caret_rect.ToGdkRectangle());
254 gtk_im_context_set_cursor_location(context_, &cursor_rect); 260 gtk_im_context_set_cursor_location(context_, &cursor_rect);
255 } 261 }
256 } 262 }
257 263
258 void GtkIMContextWrapper::OnFocusIn() { 264 void GtkIMContextWrapper::OnFocusIn() {
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 632
627 void GtkIMContextWrapper::HandleHostViewRealizeThunk( 633 void GtkIMContextWrapper::HandleHostViewRealizeThunk(
628 GtkWidget* widget, GtkIMContextWrapper* self) { 634 GtkWidget* widget, GtkIMContextWrapper* self) {
629 self->HandleHostViewRealize(widget); 635 self->HandleHostViewRealize(widget);
630 } 636 }
631 637
632 void GtkIMContextWrapper::HandleHostViewUnrealizeThunk( 638 void GtkIMContextWrapper::HandleHostViewUnrealizeThunk(
633 GtkWidget* widget, GtkIMContextWrapper* self) { 639 GtkWidget* widget, GtkIMContextWrapper* self) {
634 self->HandleHostViewUnrealize(); 640 self->HandleHostViewUnrealize();
635 } 641 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/gtk_im_context_wrapper.h ('k') | chrome/browser/renderer_host/render_widget_host_view_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698