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

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_engine_ibus.cc

Issue 45733008: sk6_charactercomposer: Merged DispatchKeyEvent and its fabricated version. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/input_method/input_method_engine_ibus.h" 5 #include "chrome/browser/chromeos/input_method/input_method_engine_ibus.h"
6 6
7 #define XK_MISCELLANY 7 #define XK_MISCELLANY
8 #include <X11/keysymdef.h> 8 #include <X11/keysymdef.h>
9 #include <map> 9 #include <map>
10 10
(...skipping 14 matching lines...) Expand all
25 #include "chromeos/ime/ibus_keymap.h" 25 #include "chromeos/ime/ibus_keymap.h"
26 #include "chromeos/ime/input_method_manager.h" 26 #include "chromeos/ime/input_method_manager.h"
27 #include "dbus/object_path.h" 27 #include "dbus/object_path.h"
28 28
29 namespace chromeos { 29 namespace chromeos {
30 const char* kErrorNotActive = "IME is not active"; 30 const char* kErrorNotActive = "IME is not active";
31 const char* kErrorWrongContext = "Context is not active"; 31 const char* kErrorWrongContext = "Context is not active";
32 const char* kCandidateNotFound = "Candidate not found"; 32 const char* kCandidateNotFound = "Candidate not found";
33 const char* kEngineBusPrefix = "org.freedesktop.IBus."; 33 const char* kEngineBusPrefix = "org.freedesktop.IBus.";
34 34
35 namespace {
36 const uint32 kIBusAltKeyMask = 1 << 3;
37 const uint32 kIBusCtrlKeyMask = 1 << 2;
38 const uint32 kIBusShiftKeyMask = 1 << 0;
39 const uint32 kIBusCapsLockMask = 1 << 1;
40 const uint32 kIBusKeyReleaseMask = 1 << 30;
41 }
42
43 InputMethodEngineIBus::InputMethodEngineIBus() 35 InputMethodEngineIBus::InputMethodEngineIBus()
44 : focused_(false), 36 : focused_(false),
45 active_(false), 37 active_(false),
46 context_id_(0), 38 context_id_(0),
47 next_context_id_(1), 39 next_context_id_(1),
48 aux_text_(new IBusText()), 40 aux_text_(new IBusText()),
49 aux_text_visible_(false), 41 aux_text_visible_(false),
50 observer_(NULL), 42 observer_(NULL),
51 preedit_text_(new IBusText()), 43 preedit_text_(new IBusText()),
52 preedit_cursor_(0), 44 preedit_cursor_(0),
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 452
461 void InputMethodEngineIBus::SetCapability( 453 void InputMethodEngineIBus::SetCapability(
462 IBusCapability capability) { 454 IBusCapability capability) {
463 } 455 }
464 456
465 void InputMethodEngineIBus::Reset() { 457 void InputMethodEngineIBus::Reset() {
466 observer_->OnReset(engine_id_); 458 observer_->OnReset(engine_id_);
467 } 459 }
468 460
469 void InputMethodEngineIBus::ProcessKeyEvent( 461 void InputMethodEngineIBus::ProcessKeyEvent(
470 uint32 keysym, 462 const std::string& keysym,
471 uint32 keycode, 463 const std::string& keycode,
472 uint32 state, 464 bool is_key_down,
465 bool is_alt_down,
466 bool is_ctrl_down,
467 bool is_shift_down,
468 bool is_caps_lock_down,
473 const KeyEventDoneCallback& callback) { 469 const KeyEventDoneCallback& callback) {
474
475 KeyEventDoneCallback *handler = new KeyEventDoneCallback(); 470 KeyEventDoneCallback *handler = new KeyEventDoneCallback();
476 *handler = callback; 471 *handler = callback;
477 472
478 KeyboardEvent event; 473 KeyboardEvent event;
479 event.type = !(state & kIBusKeyReleaseMask) ? "keydown" : "keyup"; 474 event.type = is_key_down ? "keydown" : "keyup";
480 event.key = input_method::GetIBusKey(keysym); 475 event.key = keysym;
481 event.code = input_method::GetIBusKeyCode(keycode); 476 event.code = keycode;
482 event.alt_key = state & kIBusAltKeyMask; 477 event.alt_key = is_alt_down;
483 event.ctrl_key = state & kIBusCtrlKeyMask; 478 event.ctrl_key = is_ctrl_down;
484 event.shift_key = state & kIBusShiftKeyMask; 479 event.shift_key = is_shift_down;
485 event.caps_lock = state & kIBusCapsLockMask; 480 event.caps_lock = is_caps_lock_down;
486 observer_->OnKeyEvent( 481 observer_->OnKeyEvent(
487 engine_id_, 482 engine_id_,
488 event, 483 event,
489 reinterpret_cast<input_method::KeyEventHandle*>(handler)); 484 reinterpret_cast<input_method::KeyEventHandle*>(handler));
490 } 485 }
491 486
492 void InputMethodEngineIBus::CandidateClicked(uint32 index, 487 void InputMethodEngineIBus::CandidateClicked(uint32 index,
493 ibus::IBusMouseButton button, 488 ibus::IBusMouseButton button,
494 uint32 state) { 489 uint32 state) {
495 if (index > candidate_ids_.size()) { 490 if (index > candidate_ids_.size()) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 DBusThreadManager::Get()->RemoveIBusEngineService(object_path_); 606 DBusThreadManager::Get()->RemoveIBusEngineService(object_path_);
612 607
613 object_path_ = DBusThreadManager::Get()->GetIBusEngineFactoryService()-> 608 object_path_ = DBusThreadManager::Get()->GetIBusEngineFactoryService()->
614 GenerateUniqueObjectPath(); 609 GenerateUniqueObjectPath();
615 610
616 GetCurrentService()->SetEngine(this); 611 GetCurrentService()->SetEngine(this);
617 sender.Run(object_path_); 612 sender.Run(object_path_);
618 } 613 }
619 614
620 } // namespace chromeos 615 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698