Codebase list mozc / upstream/1.3.911.102 session / commands.proto
upstream/1.3.911.102

Tree @upstream/1.3.911.102 (Download .tar.gz)

commands.proto @upstream/1.3.911.102raw · 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
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
// Copyright 2010-2011, 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.

// Protocol messages to be used for mozc client/server communication
// and client/renderer communication.
//
// The Command message contains all the input/output values for
// client/server commnication.  The messages structure of Command and
// its child messages are here:

syntax = "proto2";

import "config/config.proto";
import "session/candidates.proto";

package mozc.commands;


// This enum is used by SessionCommand::input_mode with
// CHANGE_INPUT_MODE and Output::mode.
enum CompositionMode {
  DIRECT = 0;
  HIRAGANA = 1;
  FULL_KATAKANA = 2;
  HALF_ASCII = 3;
  FULL_ASCII = 4;
  HALF_KATAKANA = 5;
  NUM_OF_COMPOSITIONS = 6;
}

message KeyEvent {
  enum SpecialKey {
    NO_SPECIALKEY = 0;
    DIGIT = 1;
    ON = 2;
    OFF = 3;
    SPACE = 4;
    ENTER = 5;
    LEFT = 6;
    RIGHT = 7;
    UP = 8;
    DOWN = 9;
    ESCAPE = 10;
    DEL = 11;    // not DELETE because DELETE is reserved in MSVC
    BACKSPACE = 12;
    HENKAN = 13;
    MUHENKAN = 14;
    KANA = 15;  // VK_DBE_HIRAGANA(Win), kVK_JIS_Kana(Mac)
    // TODO(toshiyuki): It is better to rename this to HIRAGANA
    // In Windows, we have Katakana and it may confusing.
    HOME = 16;
    END = 17;
    TAB = 18;
    F1 = 19;
    F2 = 20;
    F3 = 21;
    F4 = 22;
    F5 = 23;
    F6 = 24;
    F7 = 25;
    F8 = 26;
    F9 = 27;
    F10 = 28;
    F11 = 29;
    F12 = 30;
    PAGE_UP = 31;
    PAGE_DOWN = 32;
    INSERT = 33;
    F13 = 34;
    F14 = 35;
    F15 = 36;
    F16 = 37;
    F17 = 38;
    F18 = 39;
    F19 = 40;
    F20 = 41;
    F21 = 42;
    F22 = 43;
    F23 = 44;
    F24 = 45;
    EISU = 46;  // alphanumeric  VK_DBE_ALPHANUMERIC(Win), kVK_JIS_Eisu(Mac)
    NUMPAD0 = 47;
    NUMPAD1 = 48;
    NUMPAD2 = 49;
    NUMPAD3 = 50;
    NUMPAD4 = 51;
    NUMPAD5 = 52;
    NUMPAD6 = 53;
    NUMPAD7 = 54;
    NUMPAD8 = 55;
    NUMPAD9 = 56;
    MULTIPLY = 57;  // Numpad [*]
    ADD = 58;  // Numpad [+]
    SEPARATOR = 59;  // Numpad [enter]
    SUBTRACT = 60;  // Numpad [-]
    DECIMAL = 61;  // Numpad [.]
    DIVIDE = 62;  // Numpad [/]
    EQUALS = 63;  // Numpad [=]
    ASCII = 64;
    HANKAKU = 65;
    KANJI = 66;
    KATAKANA = 67; // VK_DBE_KATAKANA(Win)
    CAPS_LOCK = 68;
    HANJA = 69;
    NUM_SPECIALKEYS = 70;
  };

  // CTRL, ALT and SHIFT cover both LEFT and RIGHT keys.  If the
  // difference between LEFT and RIGHT is no matter, using CTRL (or ALT, SHIFT)
  // is preferred.
  // Mozc key translation logic is as follows
  //
  //             ---- Modifier Keys -----
  //             |                      |
  //             |         B            |
  //    ---------+------        -- -----+-------
  //    |        |  D  |        |   E   |      |
  //    |    A   +---- +--------+--------  C   |
  //    |              |   F    |              |
  //    --Special Keys--        ---Other Keys---
  //
  // A:Press only a special key
  //   => Send special key event with no modifier.
  // B:Press only modifier keys
  //   => Send modifier key event with no key_code.
  // C:Press an other key
  //   => Send KeyEvent with no modifier.
  // D:Press a special key with one or more modifier keys
  //   => Send special key event with modifiers.
  // E:Press an other key with one or more modifier keys
  //   => If combined key is printable, replace keycodes. Otherwise, just send
  //   with modifier keys. Note that, unless the whole combined key is
  //   printable, keycodes are not replaced even if a subset of combined key is
  //   printable.
  // F:Otherwise
  //   => Send nothing.
  //
  // Following example shows expected behaviours.
  // E.g. )
  //    case   |  Pressed Key  |   translated key event
  //  ----------------------------------------------------
  //     A     |      SP       |  special_key = 4
  //     A     |      F1       |  special_key = 19
  //     B     |     CTRL      |  modifier_key = {CTRL}
  //     B     |     SHIFT     |  modifier_key = {SHIFT}
  //     B     |   CTRL+SHIFT  |  modifier_key = {CTRL,SHIFT}
  //     C     |      'a'      |  key_code = \x61 = 'a'
  //     D     |    CTRL+BS    |  special_key = 12, modifier_key = {CTRL}
  //     D     | CTRL+SHIFT+BS |  special_key = 12, modifier_key = {CTRL,SHIFT}
  //     E     |   SHIFT+'a'   |  key_code = \x41 = 'A'
  //     E     |   CTRL+'a'    |  key_code = \x61, modifier_key = {CTRL}
  //     E     | CTRL+ALT+'a'  |  key_code = \x61, modifier_key = {CTRL,ALT}
  //     E     | CTRL+SHIFT+'a'|  key_code = \x61, modifier_key = {CTRL,SHIFT}
  //     F     | CTRL+BS+SP    |  send nothing
  //
  // In addition, we treat CAPS lock independently besides alphabet keys,
  // though it is a member of modifier keys. Following example shows currently
  // expected behaviours with Caps lock set.
  //
  // E.g. ) While CAPS is set on.
  //    Pressed Key  |   translated key event
  //  ----------------------------------------------------
  //       'a'       |  key_code = \x41 = 'A', modifier_key = {CAPS}
  //     SHIFT+'a'   |  key_code = \x61 = 'a', modifier_key = {CAPS}
  //     CTRL+'a'    |  key_code = \x41, modifier_key = {CTRL,CAPS}
  //   CTRL+ALT+'a'  |  key_code = \x41, modifier_key = {CTRL,ALT,CAPS}
  //   CTRL+SHIFT+'a'|  key_code = \x41, modifier_key = {CTRL,SHIFT,CAPS}
  //
  // However, only in short-cut judgement, we should convert capital characters
  // into lower cases.
  // TODO(peria): Specify exceptions with CAPS, and unify with the above table.

  enum ModifierKey {
    CTRL = 1;
    ALT = 2;
    SHIFT = 4;
    KEY_DOWN = 8;
    KEY_UP = 16;
    LEFT_CTRL = 32;
    LEFT_ALT = 64;
    LEFT_SHIFT = 128;
    RIGHT_CTRL = 256;
    RIGHT_ALT = 512;
    RIGHT_SHIFT = 1024;
    CAPS = 2048;
  };

  optional uint32 key_code = 1;  // Printable key in ASCII.
  optional uint32 modifiers = 2;  // Going to be obsolete.
  optional SpecialKey special_key = 3;  // Unprintable key listed above.
  repeated ModifierKey modifier_keys = 4;  // ModifierKeys

  // String used for preedit.  Kana characters and strings typed from
  // a software keyboard are supposed to be stored here.  To set kana
  // value, key_code=1 should be stored an ascii character for the
  // kana key.
  optional string key_string = 5;

  enum InputStyle {
    // Follow the current input mode (default).
    FOLLOW_MODE = 0;
    // Do not transliterate key_string and use it as-is.
    AS_IS = 1;
    // Immediately output key_string on the precomposition mode.
    // Same with AS_IS on the preedit mode.
    DIRECT_INPUT = 2;
  };
  optional InputStyle input_style = 6 [default = FOLLOW_MODE];

  // Input mode
  optional CompositionMode mode = 7;
};


message SessionCommand {
  enum CommandType {
    // Revert the session, this is usually similar to type ESC several times.
    REVERT = 1;
    // Commit the session, this is usually similar to type Enter.
    // SUBMIT session command is accepted in any status.
    // Pre-condition:
    // - Any states of IME are acceptable.
    // Post-condition:
    // - Preedit text becomes empty.
    SUBMIT = 2;
    // Select the specified candidate word by id.  This command is
    // usually used with mouse clicking.
    SELECT_CANDIDATE = 3;

    // Set the focus to the candidate by id.  This is usually used
    // with mouse dragging.  The difference from SELECT_CANDIDATE is
    // that HIGHLIGHT_CANDIDATE does not close the candidate window
    // while SELECT_CANDIDATE closes the candidate window.
    HIGHLIGHT_CANDIDATE = 4;

    // Specify the input mode.  This command should be used with
    // composition_mode.
    SWITCH_INPUT_MODE = 5;

    // Return the current status such as composition mode, preedit method, etc.
    GET_STATUS = 6;

    SUBMIT_CANDIDATE = 7;

    // Perform reverse conversion.
    CONVERT_REVERSE = 8;

    // Perform Undo.
    UNDO = 9;

    // Reset convert history and revert current composition.
    // This is usually used by moving cursor with mouse clicking.
    RESET_CONTEXT = 10;

    // Change cursor position in preedit.
    MOVE_CURSOR = 11;

    // Specify the input field type.
    SWITCH_INPUT_FIELD_TYPE = 12;

    // Client side event information for collecting usage statistics
    USAGE_STATS_EVENT = 13;


    // Expand suggestion candidates.
    // Usual suggestion algorithm is not "rich" but "fast" because suggestion
    // is executed every key event (On the other hand predicition is "rich"
    // because prediction is executed only when a user types TAB key).
    // This command expands suggestion candidate but IME state is
    // kept as is (Note : PredictAndConvert key command does almost the same
    // thing but it changes IME state to prediction).
    EXPAND_SUGGESTION = 15;

    // The client can send the current caret position whenever the caret
    // position is changed. The caret position is used for suggest window
    // position calculation. This is an optional message. If client can show
    // suggest window on the correct position, this message can be ignored.
    SEND_CARET_LOCATION = 16;

    // Number of commands.
    // When new command is added, the command should use below number
    // and NUM_OF_COMMANDS should be incremented.
    NUM_OF_COMMANDS = 17;
  };
  required CommandType type = 1;

  // Unique number specifying a candidate word.
  optional int32 id = 2;

  // This is used with SWITCH_INPUT_MODE.
  optional CompositionMode composition_mode = 3;

  // Text argument.  This is used by CONVERT_REVERSE at this moment.
  optional string text = 4;

  // New cursor position in preedit. Used with MOVE_CURSOR.
  optional uint32 cursor_position = 5;

  // Input field type.
  // The types are based on the input types defined in HTML5.
  // http://dev.w3.org/html5/spec/Overview.html#attr-input-type
  // Other types are to be added later.
  enum InputFieldType {
    // No restrictions nor special functions. The IME operates as usual.
    NORMAL = 1;

    // Password field. Text is hidden after input.
    PASSWORD = 2;

    // Telephone number
    TEL = 3;

    // Number
    NUMBER = 4;
  };
  // Type of the input field being focused.
  optional InputFieldType input_field_type = 6;

  // Client side event for collecting usage statistics
  enum UsageStatsEvent {
    INFOLIST_WINDOW_SHOW = 1;
    INFOLIST_WINDOW_HIDE = 2;
  }
  optional UsageStatsEvent usage_stats_event = 7;

  // Specify the current caret location, this is used for suggest window
  // position calculation. Used with SEND_CARET_LOCATION.
  optional Rectangle caret_rectangle = 8;
};

message Context {
  // Former part of surrounding text.
  optional string preceding_text = 1;

  // Latter part of surrounding text.
  optional string following_text = 2;
};

// Clients' capability.
// Users cannot modify this.
// The server has to obey this capability.
message Capability {
  // Bit fields to notify what the client can do.
  enum TextDeletionCapabilityType {
    NO_TEXT_DELETION_CAPABILITY = 0;

    // Can delete preceding text which is adjacent to preedit.
    DELETE_PRECEDING_TEXT = 1;
  };
  optional TextDeletionCapabilityType text_deletion = 1
      [default = NO_TEXT_DELETION_CAPABILITY];
};


// Note there is another ApplicationInfo inside RendererCommand.
// Since Input is not using nested message, define ApplicationInfo here.
message ApplicationInfo {
  optional uint32 process_id = 1;
  optional uint32 thread_id = 2;
};

message Input {
  enum CommandType {
    NONE = 0;
    CREATE_SESSION = 1;
    DELETE_SESSION = 2;
    SEND_KEY = 3;

    // Check only if the key event will be consumed.  This command is
    // for TSF on Windows.  You do not need to use this command, if it
    // is not necessary.
    TEST_SEND_KEY = 4;

    // Evaluate the command specified by SessionCommand.  The output
    // format should be the same with an output of a SEND_KEY command.
    SEND_COMMAND = 5;

    // Config accessors.
    // There are three configurations.
    // Stored config, Imposed config, One-shot config.
    // Stored config : Set by SET_CONFIG command.
    // Its lifetime is permanent (stored into a storage).
    // GET_CONFIG returns stored config.
    // Imposed config : Set by SET_IMPOSED_CONFIG. Its lifetime is the
    // same as the process (*not* stored into a storage as opposed to Stored
    // config).
    // Imposed config is prioritized over Stored config.
    // Only the values explicitly set are effective and override ones in Stored
    // config. In typical usage, most fields are not set.
    // GET_CONFIG's result is *not* affected by imposed config
    // (stored config returns).
    // One-shot config : Set by each key events.
    // It is effective while the key event is processed.
    // This is prioritized over Imposed config.
    // Like as Imposed config, some fields can be omitted.
    // TODO(matsuzakit): Rename (GET|SET)_CONFIG to (GET|SET)_STORED_CONFIG
    GET_CONFIG = 6;
    SET_CONFIG = 7;
    SET_IMPOSED_CONFIG = 22;


    // sync dictionary/history data to local file
    SYNC_DATA = 8;

    // shutdowon server safely
    SHUTDOWN = 9;

    // reload mutable data (like config, user-dic, history)
    RELOAD = 10;

    // clear user history data
    CLEAR_USER_HISTORY = 11;

    // clear user prediction data
    CLEAR_USER_PREDICTION = 12;

    // clear unused prediction
    CLEAR_UNUSED_USER_PREDICTION = 16;

    // clean up sessions
    // shutdwon if session is empty and
    // mozc_server is launched with timeout mode
    CLEANUP = 13;

    // no operation
    // can be used for pinging the server
    NO_OPERATION = 14;



    // Number of commands.
    // When new command is added, the command should use below number
    // and NUM_OF_COMMANDS should be incremented.
    NUM_OF_COMMANDS = 26;
  };
  required CommandType type = 1;

  // Session ID created by CREATE_SESSION.
  optional uint64 id = 2;

  // Key combinations used for SEND_KEY or TEST_SEND_KEY.
  optional KeyEvent key = 3;

  // Command sent to the session layer used with SEND_COMMAND.
  optional SessionCommand command = 4;

  // Input config
  optional mozc.config.Config config = 5;

  // Context data
  optional Context context = 6;

  // Client capability
  optional Capability capability = 7;

  // Application information, like process id.
  // Server may be able to change the behavior by seeing the
  // the program name.
  optional ApplicationInfo application_info = 8;




};


// Result contains data to be submitted to the host application by the
// ime client.
message Result {
  enum ResultType {
    NONE = 0;
    STRING = 1;
  };
  required ResultType type = 1;
  // The result of conversion.
  required string value = 2;

  // Source of the value.  It is almost always the reading of the value.
  optional string key = 3;
};


// Preedit represents a composition data, which is rendered on the
// host application by the ime client.  On Japanese IME, the both
// Preedit and Conversion statuses are represented by this message.
message Preedit {
  required uint32 cursor = 1;
  // The string data of Preedit is separated into Segment messages
  // presenting the ime server's status.  On Preedit status of
  // Japanese IME, there are up to three segments; left side chars of
  // cursor, forcused char, right side chars of cursor.  On Conversion
  // status of Japanese IME, the messages literally represent the
  // segments of the conversion.
  repeated group Segment = 2 {
    enum Annotation {
      NONE = 0;
      UNDERLINE = 1;
      HIGHLIGHT = 2;
    };
    required Annotation annotation = 3;
    required string value = 4;

    // The length of value in characters.  This is NOT a number in
    // bytes or logical character units.  So, the length of "abc" and
    // "あいう" should be 3, "ヴ" should be 1 and "ヴ" and "う゛"
    // should be 2.
    required uint32 value_length = 5;

    // Source of the value.  It is almost always the reading of the value.
    optional string key = 6;
  };

  // The position of the first segment whose annotation is 'HIGHLIGHT'. Not set
  // if there are no such segments.
  optional uint32 highlighted_position = 3;
};


message Status {
  // Whether IME is ON or OFF
  optional bool activated = 1;

  // Composition mode when IME is activated.
  optional CompositionMode mode = 2;
};

// This messsage contains which characters are to be deleted by client.
// E.g. if current composition and surrounding text are
//     "この感じは漢字は"
//                ^^^^^^
// and we send DeletionRange with offset == -3 and length == 3, then they will
// be rendered like:
//     "この漢字は"
//          ^^^^^^
message DeletionRange {
  // Offset of start of range.
  optional int32 offset = 1;

  // Length of the range.
  optional int32 length = 2;
};


message Output {
  optional uint64 id = 1;

  // This variable is going to be obsolete.
  optional CompositionMode mode = 2;

  optional bool consumed = 3;
  optional Result result = 4;
  optional Preedit preedit = 5;
  optional Candidates candidates = 6;
  optional KeyEvent key = 7;

  // when URL is non empty, UI can open the page with a browser,
  // after finishing the all rendering part.
  // We are using this feature for bug-report system.
  optional string url = 8;

  // Output config
  optional mozc.config.Config config = 9;

  // PreeditMethod: this is the default input mode of the session.
  // If the user's config is "kana-input", it returns KANA.  Only
  // CreateSession response will have this field.
  enum PreeditMethod {
    ASCII = 0;
    KANA = 1;
  };
  optional PreeditMethod preedit_method = 10 [default = ASCII];

  // ErrorCode:
  // if SessionHandler::EvalCommand() returns false,
  // return output with error_code = SESSION_FAILURE;
  enum ErrorCode {
    SESSION_SUCCESS = 0;
    SESSION_FAILURE = 1;
  };
  optional ErrorCode error_code = 11 [ default = SESSION_SUCCESS ];

  // number of microseconds that have elapsed for processing the request.
  optional uint32 elapsed_time = 12 [ default = 0 ];

  // The current IME status.
  optional Status status = 13;

  // All flatten candidate words stored in 1D array.  This value is
  // filled only when the content is changed.
  optional CandidateList all_candidate_words = 14;

  // Performed command name in the server
  optional string performed_command = 15;

  // Range of characters to be deleted by client.
  optional DeletionRange deletion_range = 16;

  // if launch_tool_mode is set, MozcTool is supposed to be launched
  // by client.
  enum ToolMode {
    NO_TOOL = 0;   // no need to launch tool
    CONFIG_DIALOG = 1;
    DICTIONARY_TOOL = 2;
    WORD_REGISTER_DIALOG = 3;
  };
  optional ToolMode launch_tool_mode = 17 [ default = NO_TOOL ];

  // Callback request to the client.
  message Callback {
    // Callback command to be sent from the client to the server.  The
    // optional values such as id and composition_mode can be modified
    // or added by the client.
    optional SessionCommand session_command = 1;
  };
  optional Callback callback = 18;

};

message Command {
  required Input input = 1;
  required Output output = 2;
};

message CommandList {
  // This message is used for unittest.
  repeated Command commands = 1;
};
// TODO(team): Make a new proto file into which RendererCommand is moved.
message RendererCommand {
  message Rectangle {
    optional int32 left   = 1;
    optional int32 top    = 2;
    optional int32 right  = 3;
    optional int32 bottom = 4;
  };
  message Point {
    optional int32 x = 1;
    optional int32 y = 2;
  };

  enum CommandType {
    NOOP = 0;      // No operation
    UPDATE = 1;    // Update the current window
    SHUTDOWN = 2;  // shutdown renderer
  };

  optional CommandType type = 1 [ default = NOOP ];

  // set visibility
  // if visible is false, the content of output
  // is basically ignored.
  optional bool visible = 2 [ default = false ];

  optional Output output = 3;

  // Preedit rectangle
  optional Rectangle preedit_rectangle = 4;

  // TODO(yukawa): make a common font format for all platforms.
  message WinLogFont {
    optional int32 height         = 1 [ default = 0 ];
    optional int32 width          = 2 [ default = 0 ];
    optional int32 escapement     = 3 [ default = 0 ];
    optional int32 orientation    = 4 [ default = 0 ];
    optional int32 weight         = 5 [ default = 0 ];   // FW_DONTCARE
    optional bool  italic         = 6 [ default = false ];
    optional bool  underline      = 7 [ default = false ];
    optional bool  strike_out     = 8 [ default = false ];
    optional int32 char_set       = 9 [ default = 1 ];   // DEFAULT_CHARSET
    optional int32 out_precision  = 10 [ default = 0 ];  // OUT_DEFAULT_PRECIS
    optional int32 clip_precision = 11 [ default = 0 ];  // CLIP_DEFAULT_PRECIS
    optional int32 quality        = 12 [ default = 0 ];  // DEFAULT_QUALITY
    optional int32 pitch_and_family = 13 [ default = 0 ];  // DEFAULT_PITCH
    optional string face_name = 14;  // should be within 32 TCHARs (w/ '\0')
  };

  // An equivalent to COMPOSITIONFORM in IMM32. (For Windows only)
  // TODO(yukawa): make a common composition form format for all platforms.
  message CompositionForm {
    // These constants correspond to CFS_* in Imm.h
    enum Style {
      DEFAULT = 0;          // CFS_DEFAULT
      RECT = 1;             // CFS_RECT
      POINT = 2;            // CFS_POINT
      FORCE_POSITION = 32;  // CFS_FORCE_POSITION
    };
    // Use |style_bits| instead because there are some applications which
    // specify a combination of style bits like CFS_RECT + CFS_POINT.
    optional Style DEPRECATED_style = 1;
    optional Point current_position = 2;
    optional Rectangle area = 3;
    optional uint32 style_bits = 4 [ default = 0 ];  // 0 means Style::DEFAULT
  };

  // This message is not ready to be externally released.
  // An equivalent to CANDIDATEFORM in IMM32. (For Windows only)
  // TODO(yukawa): make a common candidate form format for all platforms.
  message CandidateForm {
    // These constants correspond to CFS_* in Imm.h
    enum Style {
      DEFAULT = 0;        // CFS_DEFAULT
      CANDIDATEPOS = 64;  // CFS_CANDIDATEPOS
      EXCLUDE = 128;      // CFS_EXCLUDE
    };
    // Use |style_bits| instead in case there is an applications which
    // specifies a combination of style bits.
    optional Style DEPRECATED_style = 1;
    optional Point current_position = 2;
    optional Rectangle area = 3;
    optional uint32 style_bits = 4 [ default = 0 ];  // 0 means Style::DEFAULT
  };

  // This message is not ready to be externally released.
  // An equivalent to IMECHARPOSITION in IMM32. (For Windows only)
  // TODO(yukawa): make a common candidate form format for all platforms.
  message CharacterPosition {
    optional uint32 position = 1;
    optional Point top_left = 2;
    optional uint32 line_height = 3;
    optional Rectangle document_area = 4;
  }

  // This message is a subset of Win32 GUITHREADINFO. (For Windows only)
  // TODO(yukawa): make a common candidate form format for all platforms.
  message CaretInfo {
    optional bool blinking = 1 [ default = false ];
    optional Rectangle caret_rect = 2;
    optional uint32 target_window_handle = 3;
  }

  // Application information Mozc UI is attaching
  message ApplicationInfo {
    optional uint32 process_id = 1;
    optional uint32 thread_id = 2;
    // used in Windows:
    // WHND of the message-only window:
    optional uint32 receiver_handle = 3;
    // used in Windows:
    // HWND of the window where composition is displayed.
    optional uint32 target_window_handle = 4;
    // used in Windows:
    // Preffered font for composition string.
    optional WinLogFont composition_font = 5;

    // Represents IM Framework used in the client.
    // Currently only Windows IM frameworks are supported.
    // TODO(team): Add other IM frameworks.
    enum InputFrameworkType {
      UNKNOWN_FRAMEWORK = 0;   // Default. For backward compatibility.
      TSF = 1;
      IMM32 = 2;
    };
    // used in Windows:
    // Specifies which IM Framework is used in the client.
    // TODO(team): Support other IM frameworks.
    optional InputFrameworkType input_framework = 6
        [ default = UNKNOWN_FRAMEWORK ];

    // used in Windows:
    // Specifies where and how the renderer process shows the composition
    // window (if necessary).
    optional CompositionForm composition_form = 7;

    // used in Windows:
    // Specifies where and how the renderer process shows the candidate
    // window (if necessary).
    // Currently only one candidate window is supported.
    // TODO(yukawa): support multiple candidate windows.
    optional CandidateForm candidate_form = 8;

    // used in Windows:
    // Indicates if a UI element is expected to be displayed or not.  Note
    // taht |RendererCommand::visible| should be prior to these flags, that is,
    // you should hide all UI elements if |RendererCommand::visible| is false
    // regardless of the visibility specified in this field.
    enum UIVisibility {
      ShowUIDefault = 0;
      ShowCompositionWindow = 1;
      ShowCandidateWindow = 2;
      ShowSuggestWindow = 4;
    };
    // used in Windows:
    optional int32 ui_visibilities = 9 [ default = 0 ];  // ShowUIDefault

    // used in Windows:
    // Specifies the target position in composition window.
    optional CharacterPosition composition_target = 10;

    // used in Windows:
    // Represents caret information.
    optional CaretInfo caret_info = 11;

    // Renderer sends RendererCommand to renderer itself in order to
    // extend InfoList.
    enum MessageSenderType {
      CLIENT = 0;
      RENDERER = 1;
    };
    optional MessageSenderType message_sender_type = 12 [ default = CLIENT ];
  };

  optional ApplicationInfo application_info = 5;
};