OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include <algorithm> | 10 #include <algorithm> |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 return; | 263 return; |
264 | 264 |
265 DCHECK(!is_in_key_event_handler_); | 265 DCHECK(!is_in_key_event_handler_); |
266 | 266 |
267 // To prevent any text from being committed when resetting the |context_|; | 267 // To prevent any text from being committed when resetting the |context_|; |
268 is_in_key_event_handler_ = true; | 268 is_in_key_event_handler_ = true; |
269 | 269 |
270 gtk_im_context_reset(context_); | 270 gtk_im_context_reset(context_); |
271 gtk_im_context_reset(context_simple_); | 271 gtk_im_context_reset(context_simple_); |
272 | 272 |
273 // Some input methods may not honour the reset call. Focusing out/in the | 273 if (is_focused_) { |
274 // |context_| to make sure it gets reset correctly. | 274 // Some input methods may not honour the reset call. Focusing out/in the |
275 gtk_im_context_focus_out(context_); | 275 // |context_| to make sure it gets reset correctly. |
276 gtk_im_context_focus_in(context_); | 276 gtk_im_context_focus_out(context_); |
| 277 gtk_im_context_focus_in(context_); |
| 278 } |
277 | 279 |
278 is_composing_text_ = false; | 280 is_composing_text_ = false; |
279 preedit_text_.clear(); | 281 preedit_text_.clear(); |
280 preedit_underlines_.clear(); | 282 preedit_underlines_.clear(); |
281 commit_text_.clear(); | 283 commit_text_.clear(); |
282 | 284 |
283 is_in_key_event_handler_ = false; | 285 is_in_key_event_handler_ = false; |
284 } | 286 } |
285 | 287 |
286 bool GtkIMContextWrapper::NeedCommitByForwardingCharEvent() { | 288 bool GtkIMContextWrapper::NeedCommitByForwardingCharEvent() { |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 } while (pango_attr_iterator_next(iter)); | 621 } while (pango_attr_iterator_next(iter)); |
620 pango_attr_iterator_destroy(iter); | 622 pango_attr_iterator_destroy(iter); |
621 } | 623 } |
622 | 624 |
623 // Use a black thin underline by default. | 625 // Use a black thin underline by default. |
624 if (underlines->empty()) { | 626 if (underlines->empty()) { |
625 underlines->push_back( | 627 underlines->push_back( |
626 WebKit::WebCompositionUnderline(0, length, SK_ColorBLACK, false)); | 628 WebKit::WebCompositionUnderline(0, length, SK_ColorBLACK, false)); |
627 } | 629 } |
628 } | 630 } |
OLD | NEW |