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