Commit Graph

4552 Commits

Author SHA1 Message Date
Daijiro Fukuda
d8f35c3552 Win32: Move preedit clearing process to WM_IME_ENDCOMPOSITION
This enables to clear preedit in cases other than committing, such as
deleting all preedit texts.
2022-06-01 09:06:24 +09:00
Daijiro Fukuda
0ba4b36557 Add caret position to preedit-callback
- Win32: This works fine.
- macOS: The caret is always at the last of the preedit text.
- X11:
  - over-the-spot: The callback is not used.
  - on-the-spot: In IBus, the caret is always at the last of the preedit
    text, although the actual position can be changed. On-the-spot on X11
    has many other unstable behaviors, so allow this problem for now.
2022-05-30 14:42:41 +09:00
Takuro Ashie
7563d1bce0 Win32: Include imm.h to support input methods 2022-05-24 15:48:20 +09:00
Takuro Ashie
0f8780dcc0 Fix indent 2022-05-24 14:20:47 +09:00
Daijiro Fukuda
6ec3c85aee Fix preeditCusorPos init timing to align with other parameters 2022-05-24 14:19:06 +09:00
Daijiro Fukuda
bf4d8aec54 Remove needless diffs 2022-05-24 14:14:57 +09:00
Daijiro Fukuda
c932274494 Doc: Add contents about IME support of X11 2022-05-24 14:14:57 +09:00
Daijiro Fukuda
6fbccb4f9a Doc: Fix spaces 2022-05-24 14:14:57 +09:00
Daijiro Fukuda
18927b7af0 Doc: Fix spaces 2022-05-24 14:14:57 +09:00
Takuro Ashie
b061c0fabc Remove needless spaces 2022-05-24 14:14:57 +09:00
Daijiro Fukuda
0759632788 Win32: Revert an unneeded fix
This fix is not needed.

https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-unichar
> An application should return zero if it processes this message.
2022-05-24 14:14:57 +09:00
Daijiro Fukuda
52f0ca1ab6 Add comments and reshape codes 2022-05-24 14:14:57 +09:00
Daijiro Fukuda
89c7e252f9 Win32: Use GLFWbool 2022-05-24 14:14:57 +09:00
Daijiro Fukuda
dc953898cc X11: Use GLFW_X11_ONTHESPOT of glfwInitHint to change on-the-spot
GLFW has the function `glfwInitHint` for setting initialization parameters.
So use this instead of environmental variable.
2022-05-24 14:14:57 +09:00
Daijiro Fukuda
cacb1e8222 Doc: Improve contents about status API
- Remove contents about glfwSet/GetIMEStatus since they don't exist now
- Add contents about glfwSet/GetInputMode using GLFW_IME
2022-05-24 14:14:57 +09:00
Daijiro Fukuda
7e4de68614 tests: Remove ime test
We can use `events` test and `input_text` test for testing IME,
so we don't need this test anymore.
2022-05-24 14:14:57 +09:00
Daijiro Fukuda
18b87b8a3b Doc: Improve IME support section contents 2022-05-24 14:14:57 +09:00
Daijiro Fukuda
fa0d693fcd Doc: Fix callback arguments style
In addition, add callback signatures.
2022-05-24 14:14:57 +09:00
Daijiro Fukuda
4d8c6c9f11 Doc: Fix typo 2022-05-24 14:14:57 +09:00
Daijiro Fukuda
0b0f9e8e5b Doc: Fix refs of preedit API 2022-05-24 14:14:57 +09:00
Daijiro Fukuda
6c6f5d712f Windows: Use UTF-32 for preedit text encoding
The char stream of GLFW API must be UTF-32.
2022-05-24 14:14:57 +09:00
Daijiro Fukuda
68c977ee4d macOS: Use UTF-32 for preedit text encoding
The char stream of GLFW API must be UTF-32.
2022-05-24 14:14:57 +09:00
Daijiro Fukuda
dcfde1a0db macOS: Suppress _glfwInputKey during preediting
During preediting, the following keys

- arrow keys
- enter key
- backspace key
- ...

should not be passed to an application.
2022-05-24 14:14:57 +09:00
Daijiro Fukuda
97f52c9cf8 tests: Add preedit callback to display preedit contents 2022-05-24 14:14:57 +09:00
Daijiro Fukuda
a0daa8801c tests: Add functions about IME status and preedit position 2022-05-24 14:14:57 +09:00
Daijiro Fukuda
7383bf5f0f Doc: Improve contents 2022-05-24 14:14:57 +09:00
Yoshiki Shibukawa
5ef1fe666b Apply shibukawa's document fix
This fix is from shibukawa's fix:
  https://github.com/glfw/glfw/pull/658
  d36a164423
2022-05-24 14:14:57 +09:00
Daijiro Fukuda
1c7e52faf8 Enable glfwSetPreeditCursorPos API to apply the change immediately
In Windows and X11, the changes were applied at the time of the preedit
callback. This has been removed and make them applied immediately.

In macOS, the position callback is provided, so do nothing and leave
this to it.
2022-05-24 14:14:57 +09:00
Daijiro Fukuda
66d668501d tests: just improve view 2022-05-24 14:14:57 +09:00
Daijiro Fukuda
6f85a43e78 tests: Fix branching of using fontconfig
fontconfig seems to have a problem with macOS, so limit to X11 or Wayland.
2022-05-24 14:14:57 +09:00
Daijiro Fukuda
a7ec734281 Add new test input_text to check IME input 2022-05-24 14:14:57 +09:00
Takuro Ashie
02a69e893f Add migging argument names of GLFWpreeditfun and GLFWimestatusfun
Signed-off-by: Takuro Ashie <ashie@clear-code.com>
2022-05-24 14:14:57 +09:00
Daijiro Fukuda
09d51dcd84 Move new platform APIs to _GLFWplatform
The following APIs should be generalized to _GLFWplatform.

* _glfwPlatformResetPreeditText
* _glfwPlatformSetIMEStatus
* _glfwPlatformGetIMEStatus
2022-05-24 14:14:57 +09:00
Daijiro Fukuda
86b2c3b579 macOS: Enable to clear preedit after commit input. 2022-05-24 14:14:57 +09:00
Daijiro Fukuda
c2923ac577 macOS: Apply preeditCursor to position of candidate window 2022-05-24 14:14:57 +09:00
Daijiro Fukuda
2e976c01ed macOS: Fix coding style
* brace position
* space
* length of one line
2022-05-24 14:14:57 +09:00
Daijiro Fukuda
28ea48ea38 X11: Change default style to over-the-spot
In over-the-spot mode, almost all APIs are disabled.
Applications only need to specify the candidate window position by
`glfwSetPreeditCursorPos`.

We can change style to on-the-spot by setting "on-the-spot" to the
environmental variable `IM_STYLE`.

However on-the-spot mode of X11 has the following problems:

* Status APIs don't work because status callbacks don't work
  (at least in my ibus environment)
* Can't specify the candidate window position
2022-05-24 14:14:57 +09:00
Takuro Ashie
a5a3cbe5c0 X11: Fix coding style 2022-05-24 14:14:57 +09:00
Daijiro Fukuda
3ad6cd187d X11: Fix transplanting oversight
There was a oversight in transplanting shibukawa's fix:
* https://github.com/glfw/glfw/pull/658
* d36a164423

This made preedit callbacks not being called.
2022-05-24 14:14:57 +09:00
Daijiro Fukuda
20cc0fa21c tests: Add original author's copyright and reference to shibukawa's fix 2022-05-24 14:14:57 +09:00
Daijiro Fukuda
e7a1099a7b tests: Fix coding style
* brace position
* length of one line
2022-05-24 14:14:57 +09:00
Daijiro Fukuda
0d8627121c Add IME test code
This fix is based on `tests/ime.c` of shibukawa's fix:
  https://github.com/glfw/glfw/pull/658
  d36a164423

I simplified and restructured it entirely.
2022-05-24 14:14:57 +09:00
Daijiro Fukuda
e2e88ef8aa Fix shibukawa's fix of tests/events 2022-05-24 14:14:57 +09:00
Daijiro Fukuda
3386299e1f Apply shibukawa's fix of tests/events
This fix is based on shibukawa's fix:
  https://github.com/glfw/glfw/pull/658
  d36a164423

This code doesn't work because `get_character_string` is undefined.
We need further work.
2022-05-24 14:14:57 +09:00
Daijiro Fukuda
59e192be6d Win32: Use dynamic load for imm32 2022-05-24 14:14:57 +09:00
Daijiro Fukuda
15a64185b0 Win32: Rename commit function
The data to commit is a result-string rather than preedit.
2022-05-24 14:14:57 +09:00
Daijiro Fukuda
4cdabc29f2 Win32: Add preedit commit logic
Make committed preedit data output to `character` callback,
which is set at `glfwSetCharCallback`.
2022-05-24 14:14:57 +09:00
Takuro Ashie
853b68fed7 Fix docs concerned with input methods to follow others
the function signature ->
the function pointer type
2022-05-24 14:14:57 +09:00
Takuro Ashie
9b22e781ca Win32: Remove needless cast 2022-05-24 14:14:57 +09:00
Takuro Ashie
b9223f114d Win32: Plug potential memory leaks 2022-05-24 14:14:57 +09:00