Codebase list mozc / 280e38f src / gui / config_dialog / keybinding_editor.cc
280e38f

Tree @280e38f (Download .tar.gz)

keybinding_editor.cc @280e38fraw · history · blame

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
// Copyright 2010-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "gui/config_dialog/keybinding_editor.h"

#if defined(OS_ANDROID) || defined(OS_NACL)
#error "This platform is not supported."
#endif  // OS_ANDROID || OS_NACL

#ifdef OS_WIN
#include <windows.h>
#include <imm.h>
#include <ime.h>
#elif OS_LINUX
#define XK_MISCELLANY
#include <X11/keysymdef.h>
#endif

#include <QtCore/QString>
#include <QtWidgets/QMessageBox>
#include <QtWidgets/QMenu>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QTableWidget>

#include "base/logging.h"
#include "base/util.h"

namespace mozc {
namespace gui {

namespace {
struct QtKeyEntry {
  Qt::Key qt_key;
  const char *mozc_key_name;
};

// TODO(taku): check it these mappings are correct.
const QtKeyEntry kQtKeyModifierNonRequiredTable[] = {
  { Qt::Key_Escape, "Escape" },
  { Qt::Key_Tab, "Tab" },
  { Qt::Key_Backtab, "Tab" },   // Qt handles Tab + Shift as a special key
  { Qt::Key_Backspace, "Backspace" },
  { Qt::Key_Return, "Enter" },
  { Qt::Key_Enter, "Enter" },
  { Qt::Key_Insert, "Insert" },
  { Qt::Key_Delete, "Delete" },
  { Qt::Key_Home, "Home" },
  { Qt::Key_End, "End" },
  { Qt::Key_Left, "Left" },
  { Qt::Key_Up, "Up" },
  { Qt::Key_Right, "Right" },
  { Qt::Key_Down, "Down" },
  { Qt::Key_PageUp, "PageUp" },
  { Qt::Key_PageDown, "PageDown" },
  { Qt::Key_Space, "Space" },
  { Qt::Key_F1, "F1" },
  { Qt::Key_F2, "F2" },
  { Qt::Key_F3, "F3" },
  { Qt::Key_F4, "F4" },
  { Qt::Key_F5, "F5" },
  { Qt::Key_F6, "F6" },
  { Qt::Key_F7, "F7" },
  { Qt::Key_F8, "F8" },
  { Qt::Key_F9, "F9" },
  { Qt::Key_F10, "F10" },
  { Qt::Key_F11, "F11" },
  { Qt::Key_F12, "F12" },
  { Qt::Key_F13, "F13" },
  { Qt::Key_F14, "F14" },
  { Qt::Key_F15, "F15" },
  { Qt::Key_F16, "F16" },
  { Qt::Key_F17, "F17" },
  { Qt::Key_F18, "F18" },
  { Qt::Key_F19, "F19" },
  { Qt::Key_F20, "F20" },
  { Qt::Key_F21, "F21" },
  { Qt::Key_F22, "F22" },
  { Qt::Key_F23, "F23" },
  { Qt::Key_F24, "F24" }
};

#ifdef OS_WIN
struct WinVirtualKeyEntry {
  DWORD virtual_key;
  const char *mozc_key_name;
};

const WinVirtualKeyEntry kWinVirtualKeyModifierNonRequiredTable[] = {
  //  { VK_DBE_HIRAGANA, "Kana" },       // Kana
  // "Hiragana" and "Kana" are the same key on Mozc
  { VK_DBE_HIRAGANA, "Hiragana" },       // Hiragana
  { VK_DBE_KATAKANA, "Katakana" },        // Ktakana
  { VK_DBE_ALPHANUMERIC, "Eisu" },   // Eisu
  // TODO(taku): better to support Romaji key
  // { VK_DBE_ROMAN, "Romaji" },           // Romaji
  // { VK_DBE_NOROMAN, "Romaji" },         // Romaji
  { VK_NONCONVERT, "Muhenkan" },     // Muhenkan
  { VK_CONVERT, "Henkan" },           // Henkan
  // JP109's Hankaku/Zenkaku key has two V_KEY for toggling IME-On and Off.
  // Althogh these are visible keys on 109JP, Mozc doesn't support them.
  { VK_DBE_SBCSCHAR, "Hankaku/Zenkaku" },        // Zenkaku/hankaku
  { VK_DBE_DBCSCHAR, "Hankaku/Zenkaku" },        // Zenkaku/hankaku
  // { VK_KANJI, "Kanji" },  // Do not support Kanji
};
#elif OS_LINUX
struct LinuxVirtualKeyEntry {
  uint16 virtual_key;
  const char *mozc_key_name;
};

const LinuxVirtualKeyEntry kLinuxVirtualKeyModifierNonRequiredTable[] = {
  { XK_Muhenkan, "Muhenkan" },
  { XK_Henkan, "Henkan" },
  { XK_Hiragana, "Hiragana" },
  { XK_Katakana, "Katakana" },
  // We need special hack for Hiragana_Katakana key. For the detail, please see
  // KeyBindingFilter::AddKey implementation.
  { XK_Hiragana_Katakana, "Hiragana" },
  { XK_Eisu_toggle, "Eisu" },
  { XK_Zenkaku_Hankaku, "Hankaku/Zenkaku" },
};
#endif

// On Windows Hiragana/Eisu keys only emits KEY_DOWN event.
// for these keys we don't hanlde auto-key repeat.
bool IsDownOnlyKey(const QKeyEvent &key_event) {
#ifdef OS_WIN
  const DWORD virtual_key = key_event.nativeVirtualKey();
  return (virtual_key == VK_DBE_ALPHANUMERIC ||
          virtual_key == VK_DBE_HIRAGANA ||
          virtual_key == VK_DBE_KATAKANA);
#else
  return false;
#endif  // OS_WIN
}

bool IsAlphabet(const char key) {
  return (key >= 'a' && key <= 'z');
}
}  // namespace

class KeyBindingFilter : public QObject {
 public:
  KeyBindingFilter(QLineEdit *line_edit, QPushButton *ok_button);
  virtual ~KeyBindingFilter();

  enum KeyState {
    DENY_KEY,
    ACCEPT_KEY,
    SUBMIT_KEY
  };

 protected:
  bool eventFilter(QObject *obj, QEvent *event);

 private:
  void Reset();

  // add new "qt_key" to the filter.
  // return true if the current key_bindings the KeyBindingFilter holds
  // is valid. Composed key_bindings are stored to "result"
  KeyState AddKey(const QKeyEvent &key_event, QString *result);

  // encode the current key binding
  KeyState Encode(QString *result) const;

  bool committed_;
  bool ctrl_pressed_;
  bool alt_pressed_;
  bool shift_pressed_;
  QString modifier_required_key_;
  QString modifier_non_required_key_;
  QString unknown_key_;
  QLineEdit *line_edit_;
  QPushButton *ok_button_;
};

KeyBindingFilter::KeyBindingFilter(QLineEdit *line_edit,
                                   QPushButton *ok_button)
    : committed_(false),
      ctrl_pressed_(false),
      alt_pressed_(false),
      shift_pressed_(false),
      line_edit_(line_edit),
      ok_button_(ok_button) {
  Reset();
}

KeyBindingFilter::~KeyBindingFilter() {}

void KeyBindingFilter::Reset() {
  ctrl_pressed_ = false;
  alt_pressed_ = false;
  shift_pressed_ = false;
  modifier_required_key_.clear();
  modifier_non_required_key_.clear();
  unknown_key_.clear();
  committed_ = true;
  ok_button_->setEnabled(false);
}

KeyBindingFilter::KeyState KeyBindingFilter::Encode(QString *result) const {
  CHECK(result);

  // We don't accept any modifier keys for Hiragana, Eisu, Hankaku/Zenkaku keys.
  // On Windows, KEY_UP event is not raised for Hiragana/Eisu keys
  // until alternative keys (e.g., Eisu for Hiragana and Hiragana for Eisu)
  // are pressed. If Hiragana/Eisu key is pressed, we assume that
  // the key is already released at the same time.
  // Hankaku/Zenkaku key is preserved key and modifier keys are ignored.
  if (modifier_non_required_key_ == "Hiragana" ||
      modifier_non_required_key_ == "Katakana" ||
      modifier_non_required_key_ == "Eisu" ||
      modifier_non_required_key_ == "Hankaku/Zenkaku") {
    *result = modifier_non_required_key_;
    return KeyBindingFilter::SUBMIT_KEY;
  }

  QStringList results;

  if (ctrl_pressed_) {
    results << "Ctrl";
  }

  if (shift_pressed_) {
    results << "Shift";
  }

  if (alt_pressed_) {
#ifdef OS_MACOSX
    results << "Option";
#else
    // Do not support and show keybindings with alt for Windows
    // results << "Alt";
#endif
  }

  const bool has_modifier = !results.isEmpty();

  if (!modifier_non_required_key_.isEmpty()) {
    results << modifier_non_required_key_;
  }

  if (!modifier_required_key_.isEmpty()) {
    results << modifier_required_key_;
  }

  // in release binary, unknown_key_ is hidden
#ifndef NO_LOGGING
  if (!unknown_key_.isEmpty()) {
    results << unknown_key_;
  }
#endif

  KeyBindingFilter::KeyState result_state = KeyBindingFilter::ACCEPT_KEY;

  if (!unknown_key_.isEmpty()) {
    result_state = KeyBindingFilter::DENY_KEY;
  }

  const char key = modifier_required_key_.isEmpty() ?
      0 : modifier_required_key_[0].toLatin1();

  // Alt or Ctrl or these combinations
  if ((alt_pressed_ || ctrl_pressed_) &&
      modifier_non_required_key_.isEmpty() &&
      modifier_required_key_.isEmpty()) {
    result_state = KeyBindingFilter::DENY_KEY;
  }

  // TODO(taku) Shift + 3 ("#" on US-keyboard) is also valid
  // keys, but we disable it for now, since we have no way
  // to get the original key "3" from "#" only with Qt layer.
  // need to see platform dependent scan code here.

  // Don't support Shift only
  // Shift in composition is set to EDIT_INSERT by default.
  // Now we do not make the keybindings for EDIT_INSERT configurable.
  // For avoiding complexity, we do not support Shift here.
  if (shift_pressed_ && !ctrl_pressed_ && !alt_pressed_ &&
      modifier_required_key_.isEmpty() &&
      modifier_non_required_key_.isEmpty()) {
    result_state = KeyBindingFilter::DENY_KEY;
  }

  // Don't support Shift + 'a' only
  if (shift_pressed_ && !ctrl_pressed_ && !alt_pressed_ &&
      !modifier_required_key_.isEmpty() && IsAlphabet(key)) {
    result_state = KeyBindingFilter::DENY_KEY;
  }

  // Don't support Shift + Ctrl + '@'
  if (shift_pressed_ && !modifier_required_key_.isEmpty() &&
      !IsAlphabet(key)) {
    result_state = KeyBindingFilter::DENY_KEY;
  }

  // no modifer for modifier_required_key
  if (!has_modifier && !modifier_required_key_.isEmpty()) {
    result_state = KeyBindingFilter::DENY_KEY;
  }

  // modifier_required_key and modifier_non_required_key
  // cannot co-exist
  if (!modifier_required_key_.isEmpty() &&
      !modifier_non_required_key_.isEmpty()) {
    result_state = KeyBindingFilter::DENY_KEY;
  }

  // no valid key
  if (results.empty()) {
    result_state = KeyBindingFilter::DENY_KEY;
  }

  *result = results.join(" ");

  return result_state;
}

KeyBindingFilter::KeyState KeyBindingFilter::AddKey(
    const QKeyEvent &key_event, QString *result) {
  CHECK(result);
  result->clear();

  const int qt_key = key_event.key();

  // modifier keys
  switch (qt_key) {
#ifdef OS_MACOSX
    case Qt::Key_Meta:
      ctrl_pressed_ = true;
      return Encode(result);
    case Qt::Key_Alt:   // Option key
     //    case Qt::Key_Control:  Command key
      alt_pressed_ = true;
      return Encode(result);
#else
    case Qt::Key_Control:
      ctrl_pressed_ = true;
      return Encode(result);
      //    case Qt::Key_Meta:  // Windows key
    case Qt::Key_Alt:
      alt_pressed_ = true;
      return Encode(result);
#endif
    case Qt::Key_Shift:
      shift_pressed_ = true;
      return Encode(result);
    default:
      break;
  }

  // non-printable command, which doesn't require modifier keys
  for (size_t i = 0; i < arraysize(kQtKeyModifierNonRequiredTable); ++i) {
    if (kQtKeyModifierNonRequiredTable[i].qt_key == qt_key) {
      modifier_non_required_key_ =
          kQtKeyModifierNonRequiredTable[i].mozc_key_name;
      return Encode(result);
    }
  }

#ifdef OS_WIN
  // Handle JP109's Muhenkan/Henkan/katakana-hiragana and Zenkaku/Hankaku
  const DWORD virtual_key = key_event.nativeVirtualKey();
  for (size_t i = 0; i < arraysize(kWinVirtualKeyModifierNonRequiredTable);
       ++i) {
    if (kWinVirtualKeyModifierNonRequiredTable[i].virtual_key ==
        virtual_key) {
      modifier_non_required_key_ =
          kWinVirtualKeyModifierNonRequiredTable[i].mozc_key_name;
      return Encode(result);
    }
  }
#elif OS_LINUX
  const uint16 virtual_key = key_event.nativeVirtualKey();

  // The XKB defines three types of logical key code: "xkb::Hiragana",
  // "xkb::Katakana" and "xkb::Hiragana_Katakana".
  // On most of Linux distributions, any key event against physical
  // "ひらがな/カタカナ" key is likely to be mapped into
  // "xkb::Hiragana_Katakana" regardless of the state of shift modifier. This
  // means that you are likely to receive "Shift + xkb::Hiragana_Katakana"
  // rather than "xkb::Katakana" when you physically press Shift +
  // "ひらがな/カタカナ".
  // On the other hand, Mozc protocol expects that Shift + "ひらがな/カタカナ"
  // key event is always interpret as "{special_key: KeyEvent::KATAKANA}"
  // without shift modifier. This is why we have the following special treatment
  // against "shift + XK_Hiragana_Katakana". See b/6087341 for the background
  // information.
  // We use |key_event.modifiers()| instead of |shift_pressed_| because
  // |shift_pressed_| is no longer valid in the following scenario.
  //   1. Press "Shift"
  //   2. Press "Hiragana/Katakana"  (shift_pressed_ == true)
  //   3. Press "Hiragana/Katakana"  (shift_pressed_ == false)
  const bool with_shift = (key_event.modifiers() & Qt::ShiftModifier) != 0;
  if (with_shift && (virtual_key == XK_Hiragana_Katakana)) {
    modifier_non_required_key_ = "Katakana";
    return Encode(result);
  }

  // Handle JP109's Muhenkan/Henkan/katakana-hiragana and Zenkaku/Hankaku
  for (size_t i = 0; i < arraysize(kLinuxVirtualKeyModifierNonRequiredTable);
       ++i) {
    if (kLinuxVirtualKeyModifierNonRequiredTable[i].virtual_key ==
        virtual_key) {
      modifier_non_required_key_ =
          kLinuxVirtualKeyModifierNonRequiredTable[i].mozc_key_name;
      return Encode(result);
    }
  }
#endif

  if (qt_key == Qt::Key_yen) {
    // Japanese Yen mark, treat it as backslash for compatibility
    modifier_non_required_key_ = "\\";
    return Encode(result);
  }

  // printable command, which requires modifier keys
  if ((qt_key >= 0x21 && qt_key <= 0x60) ||
      (qt_key >= 0x7B && qt_key <= 0x7E)) {
    if (qt_key >= 0x41 && qt_key <= 0x5A) {
      modifier_required_key_ = static_cast<char>(qt_key - 'A' + 'a');
    } else {
      modifier_required_key_ = static_cast<char>(qt_key);
    }
    return Encode(result);
  }

  unknown_key_.sprintf("<UNK:0x%x 0x%x 0x%x>",
                       key_event.key(),
                       key_event.nativeScanCode(),
                       key_event.nativeVirtualKey());

  return Encode(result);
}

bool KeyBindingFilter::eventFilter(QObject *obj, QEvent *event) {
  if ((event->type() == QEvent::KeyPress ||
       event->type() == QEvent::KeyRelease) &&
      !IsDownOnlyKey(*static_cast<QKeyEvent *>(event)) &&
      static_cast<QKeyEvent *>(event)->isAutoRepeat()) {
    // ignores auto key repeat. just eat the event
    return true;
  }

  // TODO(taku): the following sequence doesn't work as once
  // user relase any of keys, the statues goes to "submitted"
  // 1. Press Ctrl + a
  // 2. Release a, but keep pressing Ctrl
  // 3. Press b  (the result should be "Ctrl + b").

  if (event->type() == QEvent::KeyPress) {
    // when the state is committed, reset the internal key binding
    if (committed_) {
      Reset();
      line_edit_->clear();
    }
    committed_ = false;
    const QKeyEvent *key_event = static_cast<QKeyEvent *>(event);
    QString result;
    const KeyBindingFilter::KeyState state = AddKey(*key_event, &result);
    ok_button_->setEnabled(state != KeyBindingFilter::DENY_KEY);
    line_edit_->setText(result);
    line_edit_->setCursorPosition(0);
    line_edit_->setAttribute(Qt::WA_InputMethodEnabled, false);
    if (state == KeyBindingFilter::SUBMIT_KEY) {
      committed_ = true;
    }
    return true;
  } else if (event->type() == QEvent::KeyRelease) {
    // when any of key is released, change the state "committed";
    line_edit_->setCursorPosition(0);
    committed_ = true;
    return true;
  }

  return QObject::eventFilter(obj, event);
}

KeyBindingEditor::KeyBindingEditor(QWidget *parent, QWidget *trigger_parent)
    : QDialog(parent), trigger_parent_(trigger_parent) {
  setupUi(this);
#if defined(OS_LINUX)
  // Workaround for the issue https://github.com/google/mozc/issues/9
  // Seems that even after clicking the button for the keybinding dialog,
  // the edit is not raised. This might be a bug of setFocusProxy.
  setWindowFlags(Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint |
                 Qt::Tool | Qt::WindowStaysOnTopHint);
#else
  setWindowFlags(Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint |
                 Qt::Tool);
#endif

  QPushButton *ok_button =
      KeyBindingEditorbuttonBox->button(QDialogButtonBox::Ok);
  CHECK(ok_button != NULL);

  filter_.reset(new KeyBindingFilter(KeyBindingLineEdit, ok_button));
  KeyBindingLineEdit->installEventFilter(filter_.get());

  // no right click
  KeyBindingLineEdit->setContextMenuPolicy(Qt::NoContextMenu);
  KeyBindingLineEdit->setMaxLength(32);
  KeyBindingLineEdit->setAttribute(Qt::WA_InputMethodEnabled, false);

#ifdef OS_WIN
  ::ImmAssociateContext(reinterpret_cast<HWND>(KeyBindingLineEdit->winId()), 0);
#endif

  QObject::connect(KeyBindingEditorbuttonBox,
                   SIGNAL(clicked(QAbstractButton *)),
                   this,
                   SLOT(Clicked(QAbstractButton *)));

  setFocusProxy(KeyBindingLineEdit);
}

KeyBindingEditor::~KeyBindingEditor() {}

void KeyBindingEditor::Clicked(QAbstractButton *button) {
  switch (KeyBindingEditorbuttonBox->buttonRole(button)) {
    case QDialogButtonBox::AcceptRole:
      QDialog::accept();
      break;
    default:
      QDialog::reject();
      break;
  }
}

const QString KeyBindingEditor::GetBinding() const {
  return KeyBindingLineEdit->text();
}

void KeyBindingEditor::SetBinding(const QString &binding) {
  KeyBindingLineEdit->setText(binding);
  KeyBindingLineEdit->setCursorPosition(0);
}
}  // namespace gui
}  // namespace mozc