Commit Graph

4530 Commits

Author SHA1 Message Date
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
Takuro Ashie
3e99fcc865 Win32: Cosmetic changes
* Remove a needless local variable
* Shorten long lines
2022-05-24 14:14:57 +09:00
Takuro Ashie
4fd32183f8 Win32: Extract retrieving preedit text as a function 2022-05-24 14:14:57 +09:00
Takuro Ashie
3a4d7eb85a Win32: Use ImmGetCompositionStringW() explicitly
ImmGetCompositionString() is ambiguous.
2022-05-24 14:14:57 +09:00
Takuro Ashie
599a1a98ec Win32: Fix style
* Remove needless braces
* Add spaces
* Use C89 style variable declarations
2022-05-24 14:14:57 +09:00
Takuro Ashie
169da05c53 Fix too long buffer for ImmGetCompositionStringW()
It return's byte size, not string length. So that multiplying by
sizeof(WCHAR) isn't needed.
2022-05-24 14:14:57 +09:00
Daijiro Fukuda
ffce1503cc Apply sibukawa's fix of GLFW for MacOS
This fix is based on shibukawa's fix:
  https://github.com/glfw/glfw/pull/658
  d36a164423
2022-05-24 14:14:57 +09:00
Takuro Ashie
8a02ec2702 X11: Revive inputContextDestroyCallback()
XCreateIC() has vararg so that both XNStatusAttributes and
XNDestroyCallback are acceptable.
2022-05-24 14:14:57 +09:00
Takuro Ashie
2130afeb02 Win32: Fix coding style
* brace position
* add missing spaces
2022-05-24 14:14:57 +09:00
Takuro Ashie
e4c4c7343c Win32: Plug potential memory leaks 2022-05-24 14:14:57 +09:00
Takuro Ashie
d97e954aa3 Win32: Link imm32 on building examples and tests 2022-05-24 14:14:57 +09:00
Takuro Ashie
d808d1d274 Load missing XIM related function symbols
* XSetICValues
* XVaCreateNestedList
* XmbResetIC
2022-05-24 14:14:57 +09:00
daipom
a2c18d6c2f Apply shibukawa's fix of GLFW for X11
This fix is based on shibukawa's fix:
  https://github.com/glfw/glfw/pull/658

The differences is the following.

* Remove `X_HAVE_UTF8_STRING` branching since the current logic doesn't use it
* Replace `XNDestroyCallback` for `XNPreeditAttributes` in `XCreateIC`
2022-05-24 14:14:57 +09:00
daipom
fad44068e5 Apply shibukawa's fix of GLFW for Windows
This fix is based on shibukawa's fix:
  https://github.com/glfw/glfw/pull/658
  d36a164423

Some minor coding style changes are made, but not yet follow glfw's one,
and some comments doesn't follow recent changes. So further work is
needed.
2022-05-24 14:14:57 +09:00
Camilla Löwy
62e175ef9f Win32: Add comment clarifying use of ToUnicode
Fixes #2100
2022-05-06 19:19:25 +02:00
Camilla Löwy
ce85c7dcaf Fix GLAPIENTRY not being defined for native access
This is a follow-up to 535c3ce632.

That commit made glfw3native.h undefine GLAPIENTRY whenever
GLFW_EXPOSE_NATIVE_GLX or GLFW_EXPOSE_NATIVE_OSMESA was defined, on the
assumption that it was glfw3.h that had defined GLAPIENTRY.

If gl.h or an extension loader header has been included before glfw3.h,
then it has defined inclusion guards preventing GLAPIENTRY from being
defined later when the GLX or OSMesa header includes gl.h.

This commit ensures GLAPIENTRY is only undefined if glfw3.h defined it.

Related to #2010
2022-05-06 19:18:47 +02:00
Camilla Löwy
5c3ebfb9cc Remove OSMesa specific code from offscreen example
The OSMesa specific path is more appropriate for a test than an example.
2022-05-06 19:06:13 +02:00
Camilla Löwy
7dfd84c458 Win32: Make monitor area retrieval more consistent
The rest of this file uses GetMonitorInfoW to retrieve this information.
2022-04-28 21:58:44 +02:00
Camilla Löwy
685de9089f Fix and clarify comments for GLFWAPI 2022-04-28 21:58:44 +02:00
Camilla Löwy
09653b8c54 Move last bits of window setup to platform code
This avoids glfwCreateWindow emitting GLFW_FEATURE_UNAVAILABLE or
GLFW_FEATURE_UNIMPLEMENTED on Wayland because shared code was calling
unimplemented or unavailable platform functions during final setup.

It also makes it consistent with the final setup of full screen windows.
2022-04-28 21:58:06 +02:00
Camilla Löwy
72642ea0d1 Simplify struct stitching for sync primitives
There will not currently be more than one set of threading or timer APIs
selected regardless of how many window systems are enabled, so there is
no need for this extra complexity.
2022-04-28 21:54:25 +02:00
Camilla Löwy
8f050b5655 Wayland: Add support for older wayland-scanner
Versions of wayland-scanner prior to 1.17.91 named every global array of
wl_interface pointers 'types', making it impossible to combine several
unmodified private-code files into a single compilation unit.

This overrides that name with a macro for each file, allowing them to
coexist.

Fixes #2016
Closes #2032
2022-04-28 21:54:24 +02:00
Camilla Löwy
acf0c10e7a Win32: Fix message reported by VS 2022 2022-04-28 21:54:24 +02:00