Commit Graph

4644 Commits

Author SHA1 Message Date
Yoshiki Shibukawa
69af4a3fb7 Apply shibukawa's document fix
This fix is from shibukawa's fix:
  https://github.com/glfw/glfw/pull/658
  d36a164423
2023-04-07 16:04:29 +09:00
Daijiro Fukuda
7592cd8692 tests: Add tests for IME features
Co-authored-by: Takuro Ashie <ashie@clear-code.com>
2023-04-07 16:04:29 +09:00
Takuro Ashie
f50fd796cd Wayland: Support text_input_unstable_v3 and text_input_unstable_v1
They are wayland protocols to support input methods:
https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/text-input/text-input-unstable-v3.xml
https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/text-input/text-input-unstable-v1.xml

text_input_unstable_v3 is widely supported by major desktop environment
on GNU/Linux such as GNOME or KDE.

text_input_unstable_v1 isn't so popular but Weston which is the
reference Wayland implementation supports only it and doesn't support
text_input_unstable_v3 so that we also implement it.
2023-04-07 16:04:29 +09:00
Daijiro Fukuda
017090f46c X11: Support IME
This commit re-organizes 6e7f93916b96c643ca7abe45d09f72d841ff15ed.

* Load missing XIM related function symbols.
* Generalize platform-specific features to _GLFWplatform.
* Change the defalut input style to over-the-spot style.
* Rename `decodeUTF8()` to `_glfwDecodeUTF8()` to make it as internal API.
    * It will be also needed to implment input method for Wayland.
* Refactor code shapes and variable names.

About over-the-spot style and on-the-spot style on X11:

* In over-the-spot mode, almost all APIs are disabled since applications only
  need to specify the preedit candidate window position by `glfwSetPreeditCursorPos()`.
* We can change the style by enabling `GLFW_X11_ONTHESPOT` init hint, but it
  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.

Known problems:

* Some keys (arrow, Enter, BackSpace, ...) are passed to applications during preediting.
    * This will be fixed in PR #1972 : https://github.com/glfw/glfw/pull/1972

Co-authored-by: Takuro Ashie <ashie@clear-code.com>
2023-04-07 16:04:29 +09:00
Daijiro Fukuda
a3f7da4769 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`

Co-authored-by: Yoshiki Shibukawa <yoshiki@shibu.jp>
Co-authored-by: Takuro Ashie <ashie@clear-code.com>
2023-04-07 15:51:40 +09:00
Daijiro Fukuda
21f02568a1 macOS: Support IME
This commit re-organizes 31b12b7f79a5aa8bd8f8eb1488a050ab894ca289.

* Use dynamic load for TIS functions and stop using Carbon.
* Generalize platform-specific features to _GLFWplatform.
* Add caret-position info to preedit-callback.
* Handle UTF16 data correctly.
* Implement `firstRectForCharacterRange:actualRange:` to display preedit candidate window correctly.
* Suppress _glfwInputKey during preediting.
* Ensure preedit cleared after committed.
* Fix wrong length of markedRange.
* Improve IME status APIs.
* Refactor code shapes and variable names.

Co-authored-by: Takuro Ashie <ashie@clear-code.com>
Co-authored-by: xfangfang <2553041586@qq.com>
2023-04-07 15:51:40 +09:00
Daijiro Fukuda
004d348def Apply shibukawa's fix of GLFW for MacOS
This fix is based on shibukawa's fix:
  https://github.com/glfw/glfw/pull/658
  d36a164423

Co-authored-by: Yoshiki Shibukawa <yoshiki@shibu.jp>
Co-authored-by: Takuro Ashie <ashie@clear-code.com>
2023-04-07 15:51:40 +09:00
Daijiro Fukuda
6536792f9f Win32: Support IME
This commit re-organizes 9d9af132610829f295c34ceb81b17af8b567b76f.

* Use dynamic load for Imm32.
* Generalize platform-specific features to _GLFWplatform.
* Add caret-position info to preedit-callback.
* Add cursorWidth to preeditCursor and related APIs.
* Handle UTF16 data correctly.
* Handle GCS_RESULTSTR so that committed texts are processed correctly.
* Handle WM_IME_ENDCOMPOSITION to clear preedit.
* Handle WM_IME_SETCONTEXT.
    * https://learn.microsoft.com/en-us/windows/win32/intl/wm-ime-setcontext#remarks
* Refactor code shapes and variable names.

Co-authored-by: Takuro Ashie <ashie@clear-code.com>
2023-04-07 15:51:40 +09:00
Daijiro Fukuda
181f2832cc 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.

Co-authored-by: Yoshiki Shibukawa <yoshiki@shibu.jp>
Co-authored-by: Takuro Ashie <ashie@clear-code.com>
2023-04-07 15:51:40 +09:00
Camilla Löwy
3fa2360720 Update changelog
Related to #2198
2023-03-31 16:18:46 +02:00
TheBrokenRail
0b94e1b29b Wayland: Fix detection of joysticks after init
Closes #2198
2023-03-31 16:18:46 +02:00
Camilla Löwy
f27daa34ad Fix glfwinfo output of Vulkan layer spec version 2023-03-31 16:18:46 +02:00
Camilla Löwy
6f2d7064be Make glfwinfo try Vulkan even if GL/GLES fails 2023-03-31 16:18:46 +02:00
Camilla Löwy
9cce2896ee Null: Add (fictional) scancodes
This replaces the previous scheme where scancodes were equal to keycodes
(an implausible and potentially misleading situation) with a set of
scancodes invented purely for the null platform.
2023-03-31 15:56:01 +02:00
Camilla Löwy
23ab972724 Fix unquoted CMake variable references
The previous version did not handle paths containing whitespace
correctly.

Related to #2256
2023-03-31 15:33:15 +02:00
Camilla Löwy
fbdb53b9ca Wayland: Add initial support for libdecor
This is partly based on the implementation of libdecor support in
PR #1693 by @ christianrauch.

Where available, the libdecor library is loaded at init and becomes the
preferred method for window decorations.  On compositors that support
XDG decorations, libdecor in turn uses those.  If not, libdecor has
a plug-in archtecture and may load additional libraries to either use
compositor-specific decorations or draw its own.

If necessary, support for libdecor can be disabled with the
GLFW_WAYLAND_LIBDECOR init hint.  This is mostly in case some part of
the dynamic loading or duplication of header material added here turns
out to cause problems with future versions of libdecor-0.so.0.

Fixes #1639
Closes #1693
Related to #1725
2023-03-27 22:03:36 +02:00
Camilla Löwy
cd466cf9fd Wayland: Simplify decoration side detection
This commit simplifies the detection of which element of a fallback
decorated window the pointer has entered.  Instead of looping through
the list of windows, the user pointer of fallback decoration surfaces is
set to the GLFW window object.
2023-03-27 22:03:36 +02:00
Camilla Löwy
39f0e86228 Wayland: Clean up enum value names 2023-03-27 22:03:36 +02:00
Camilla Löwy
efa9297a41 Wayland: Simplify per-window ouput scales tracking
This replaces (one case of) manual management of weak links between
windows and monitors, both objects with complex life times, with
wl_object pointers used as opaque key values.
2023-03-27 22:03:36 +02:00
Camilla Löwy
91c837ace5 Wayland: Use tags to verify proxy ownership
This is in preparation for adding support for libdecor, which creates
its own proxies on our display.  It will likely also be helpful to some
people using native access on Wayland.

This is partly based on the implementation of libdecor support in
PR #1693 by @ christianrauch.
2023-03-27 22:03:36 +02:00
Camilla Löwy
6d9083af03 Wayland: Remove duplicate setting of user data
The surface user data is already set by wl_surface_add_listener.
2023-03-27 22:03:36 +02:00
Camilla Löwy
4cf510511c Wayland: Stop manually tracking interface versions
This is already tracked by the proxies we care about.
2023-03-27 22:03:36 +02:00
Camilla Löwy
c1a79c1c41 Wayland: Emit size event when setting aspect ratio 2023-03-27 22:03:36 +02:00
Camilla Löwy
8397b39afa Wayland: Fix some missing window refresh events 2023-03-27 22:03:36 +02:00
Camilla Löwy
735fc101f5 Wayland: Fix decorations not always being created
If a window was initially fullscreen then it would not get an XDG
decoration object.  If the window was later switched to windowed mode it
would then get fallback decorations instead of XDG ones.
2023-03-27 22:03:36 +02:00
Camilla Löwy
228428fa4f Wayland: Simplify test for fallback decorations
The GLFW fallback decorations only exist when the window is visible,
decorated and in windowed mode.
2023-03-27 22:03:36 +02:00
Camilla Löwy
82e77dbff4 Wayland: Pick more plausible default cursor size
This is not intended as a replacement for actually querying the desktop
for the correct size, but it appears to be a better fallback value.
2023-03-27 22:03:36 +02:00
Juan Ramos
9a87635686 Update to actions/checkout@v3
Fixes the following CI warning:

"Node.js 12 actions are deprecated. Please update the following
actions to use Node.js 16: actions/checkout@v2..."

Closes #2255
2023-03-03 14:47:15 +01:00
Camilla Löwy
2b580012da Add credit
Related to #2199
2023-03-03 14:46:43 +01:00
Yoshinori Sano
5c463a9070 Win32: Fix typo in error description
Closes #2199
2023-03-03 14:36:12 +01:00
Camilla Löwy
9b1f63bad9 Add credit
Closes #2256
2023-03-02 17:47:36 +01:00
Juan Ramos
1c9fcdc9df Simplify setting of GLFW_STANDALONE CMake variable
Use string(COMPARE EQUAL ...) instead of a whole if() statement.

Related to #2256
2023-03-02 17:44:18 +01:00
Juan Ramos
30b91c8b60 Remove CMAKE_LEGACY_CYGWIN_WIN32 CMake option
This was needed for compatibility with CMake versions before 2.8.4.

Related to #2256
2023-03-02 17:42:34 +01:00
Juan Ramos
e0ae1c45df Remove setting of CMake policy CMP0054
This policy is already set to NEW by requiring CMake 3.4.

Related to #2256
2023-03-02 17:40:32 +01:00
Camilla Löwy
8f470597d6 Add support for manually running build workflow 2023-01-26 18:41:46 +01:00
Camilla Löwy
57cbded076 Add credit
Related to #2225
2022-12-16 13:44:59 +01:00
Takuro Ashie
41d8da1cea
Wayland: Fix wrong array size for _GLFWofferWayland
Closes #2225
2022-12-16 13:40:36 +01:00
TheBrokenRail
00967cbb8a
Linux: Fix joystick input being disabled
Closes #2192
2022-12-15 20:18:59 +01:00
Camilla Löwy
dd8a678a66 Update Doxyfile template for Doxygen 1.9.5
This is mostly to disable Doxygen HTML output dark mode (for now).
2022-09-20 19:38:37 +02:00
Camilla Löwy
97b9e49637 Documentation work 2022-09-20 17:03:30 +02:00
Camilla Löwy
b2b087cd8e Fix documented errors for gamma ramp functions
Fixes #2186
2022-09-20 17:02:51 +02:00
Camilla Löwy
d299d9f788 Remove Doxyfile tags deprecated by Doxygen 1.9.5 2022-09-15 22:25:10 +02:00
Camilla Löwy
ed1d9e1ca7 Document X11 WM_CLASS hint behavior
Fixes #2180
2022-09-15 22:25:10 +02:00
Camilla Löwy
ab3ea8ac9f Win32: Remove unhelpful helper function 2022-09-15 22:25:10 +02:00
Camilla Löwy
c812b9d87c Add conditional compilation for platform units
This is a step towards being able to compile GLFW manually without
needing to duplicate a lot of platform- or OS-specific logic.
2022-09-15 22:24:39 +02:00
Camilla Löwy
8a72918bcd Move helper macros to single point of use 2022-09-15 22:14:41 +02:00
Camilla Löwy
ab1b1edfd0 EGL: Cleanup
Both config parameters are "desired", but one is older and never had its
name updated.

This commit at least makes it clearer that they are similar.
2022-09-15 22:14:41 +02:00
Camilla Löwy
93e93135f2 EGL: Add better error for no stereo 2022-09-15 22:14:41 +02:00
Camilla Löwy
e057666642 EGL: Add better errors for client API mismatch
Because EGL ties client API support to configs, attempts to create
a context with an unavailable client API will fail with the unhelpful
"failed to find suitable config" error description.

This attempts to detect cases where there are usable configs for the
other client API and emit a hopefully more helpful error.

Related to #2173
2022-09-15 22:09:56 +02:00
Camilla Löwy
6b57e08bb0 Check if context creation APIs match when sharing 2022-08-22 19:17:12 +02:00