Changeset View
Standalone View
intern/ghost/intern/GHOST_ImeWin32.h
| Show All 30 Lines | |||||
| # include <windows.h> | # include <windows.h> | ||||
| # include <string> | # include <string> | ||||
| # include "GHOST_Event.h" | # include "GHOST_Event.h" | ||||
| # include "GHOST_Rect.h" | # include "GHOST_Rect.h" | ||||
| # include <vector> | # include <vector> | ||||
| /* MSDN LOCALE_SISO639LANGNAME states maximum length of 9, including terminating null. */ | |||||
| # define W32_ISO639_LEN 9 | |||||
| class GHOST_EventIME : public GHOST_Event { | class GHOST_EventIME : public GHOST_Event { | ||||
| public: | public: | ||||
| /** | /** | ||||
| * Constructor. | * Constructor. | ||||
| * \param msec: The time this event was generated. | * \param msec: The time this event was generated. | ||||
| * \param type: The type of key event. | * \param type: The type of key event. | ||||
| * \param key: The key code of the key. | * \param key: The key code of the key. | ||||
| */ | */ | ||||
| ▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | public: | ||||
| ~GHOST_ImeWin32(); | ~GHOST_ImeWin32(); | ||||
| /* Retrieves whether or not there is an ongoing composition. */ | /* Retrieves whether or not there is an ongoing composition. */ | ||||
| bool is_composing() const | bool is_composing() const | ||||
| { | { | ||||
| return is_composing_; | return is_composing_; | ||||
| } | } | ||||
| /** | /* Retrieve the input language from Windows and store it. */ | ||||
| * Retrieves the input language from Windows and update it. | |||||
| */ | |||||
| void UpdateInputLanguage(); | void UpdateInputLanguage(); | ||||
| /* Returns the current input language id. */ | BOOL IsLanguage(const char name[W32_ISO639_LEN]); | ||||
| WORD GetInputLanguage(); | |||||
| /* Saves the current conversion status. */ | /* Saves the current conversion status. */ | ||||
| void UpdateConversionStatus(HWND window_handle); | void UpdateConversionStatus(HWND window_handle); | ||||
| /* Is the IME currently in conversion mode? */ | /* Is the IME currently in conversion mode? */ | ||||
| bool IsEnglishMode(); | bool IsEnglishMode(); | ||||
| /* Checks a key whether IME has to do handling. */ | /* Checks a key whether IME has to do handling. */ | ||||
| ▲ Show 20 Lines • Show All 176 Lines • ▼ Show 20 Lines | |||||
| private: | private: | ||||
| /** | /** | ||||
| * Represents whether or not there is an ongoing composition in a browser | * Represents whether or not there is an ongoing composition in a browser | ||||
| * process, i.e. whether or not a browser process is composing a text. | * process, i.e. whether or not a browser process is composing a text. | ||||
| */ | */ | ||||
| bool is_composing_; | bool is_composing_; | ||||
| /** | /* Abbreviated ISO 639-1 name of the input language, such as "en" for English. */ | ||||
| * The current input Language ID retrieved from Windows, which consists of: | char language_[W32_ISO639_LEN]; | ||||
| * * Primary Language ID (bit 0 to bit 9), which shows a natural language | |||||
| * (English, Korean, Chinese, Japanese, etc.) and; | |||||
| * * Sub-Language ID (bit 10 to bit 15), which shows a geometrical region | |||||
| * the language is spoken (For English, United States, United Kingdom, | |||||
| * Australia, Canada, etc.) | |||||
| * The following list enumerates some examples for the Language ID: | |||||
| * * "en-US" (0x0409) | |||||
| * MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US); | |||||
| * * "ko-KR" (0x0412) | |||||
| * MAKELANGID(LANG_KOREAN, SUBLANG_KOREAN); | |||||
| * * "zh-TW" (0x0404) | |||||
| * MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL); | |||||
| * * "zh-CN" (0x0804) | |||||
| * MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED); | |||||
| * * "ja-JP" (0x0411) | |||||
| * MAKELANGID(LANG_JAPANESE, SUBLANG_JAPANESE_JAPAN), etc. | |||||
| * (See `winnt.h` for other available values.) | |||||
| * This Language ID is used for processing language-specific operations in | |||||
| * IME functions. | |||||
| */ | |||||
| LANGID input_language_id_; | |||||
LazyDodo: The length and source of the length is already documented near the `W32_ISO639_LEN` define, it… | |||||
| /* Current Conversion Mode Values. Retrieved with ImmGetConversionStatus. */ | /* Current Conversion Mode Values. Retrieved with ImmGetConversionStatus. */ | ||||
Not Done Inline ActionsPlease note the source from this comment, I wasn't overly concerned about the contents, but the upper limit of 9 characters I wanted to verify, and went to look at the ISO spec and came up empty (I mean why would they even bother with terminator chars, it was fooling to look at the specs from the start, but that's on me) , it wasn't until I went to look at the LOCALE_SISO639LANGNAME definition in MSDN I recognized where this text came from. doesn't have to be much though MSDN states in the documentation for LOCALE_SISO639LANGNAME the maximum number of characters allowed for this string is nine, including a terminating null character. I would have advocated for a link, but i have been bitten quite a few times now with MS moving the documentation to a different url. LazyDodo: Please note the source from this comment, I wasn't overly concerned about the contents, but the… | |||||
| DWORD conversion_modes_; | DWORD conversion_modes_; | ||||
| /* Current Sentence Mode. Retrieved with ImmGetConversionStatus. */ | /* Current Sentence Mode. Retrieved with ImmGetConversionStatus. */ | ||||
| DWORD sentence_mode_; | DWORD sentence_mode_; | ||||
| /** | /** | ||||
| * Represents whether or not the current input context has created a system | * Represents whether or not the current input context has created a system | ||||
| * caret to set the position of its IME candidate window. | * caret to set the position of its IME candidate window. | ||||
| Show All 13 Lines | |||||
The length and source of the length is already documented near the W32_ISO639_LEN define, it be fine if this comment went away and we just keep the The abbreviated ISO 639-1 name of the input language, such as "en" for English. bit