Commit Graph

4818 Commits

Author SHA1 Message Date
Daijiro Fukuda
2a7ab5b1a9 tests: Add tests for IME features
Co-authored-by: Takuro Ashie <ashie@clear-code.com>
2024-04-02 08:38:10 +09:00
Takuro Ashie
12d72f5e1c 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.
2024-04-02 08:38:10 +09:00
Daijiro Fukuda
b0506b7912 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>
2024-04-02 08:38:10 +09:00
Daijiro Fukuda
6981f7ae83 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>
2024-04-02 08:38:10 +09:00
Daijiro Fukuda
2368112f98 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>
2024-04-02 08:38:10 +09:00
Daijiro Fukuda
e947cb7b52 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>
2024-04-02 08:38:10 +09:00
Daijiro Fukuda
9802d73c96 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>
2024-04-02 08:38:10 +09:00
Daijiro Fukuda
2e30ad17fe 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>
2024-04-02 08:38:10 +09:00
Camilla Löwy
228e58262e EGL: Allow native access with defaults on Wayland
The intent of enforcing GLFW_EGL_CONTEXT_API for EGL native access
functions was to ensure that the application had requested the same
context creation API at window creation time that it then attempted
native access for.

With the 3.4 ABI this both isn't true anymore, as a single binary may
have multiple meanings of GLFW_NATIVE_CONTEXT_API, and is no longer
necessary, since glfwGetPlatform provides enough information to
disambiguate even without knowing what GLFW_PLATFORM was set to.

This all leaves the requirement that the context creation API be
GLFW_EGL_CONTEXT_API as just an unnecessary annoyance.

Fixes #2518
2024-03-29 13:18:31 +01:00
Camilla Löwy
3573c5a890 Wayland: Fix segfault when there is no seat
Bug encountered running on a headless instance of Weston.

Fixes #2517
2024-03-29 13:17:06 +01:00
Camilla Löwy
072f660d93 Allow C99 booleans 2024-03-28 16:53:04 +01:00
Camilla Löwy
68dcea0d7f Place assertions for handles after init check
This lets automated testing check that GLFW_NOT_INITIALIZED is emitted
for every public function.
2024-03-28 16:53:04 +01:00
Camilla Löwy
38ec7abd3b Fix missing assertions for native access functions 2024-03-28 16:53:04 +01:00
Camilla Löwy
738dd6ff1d Null: Add limited EGL context creation on Mesa
This provides very limited support for context creation via EGL on the
Null platform.  It supports Unix-like systems with a version of Mesa
that provides EGL_MESA_platform_surfaceless.

Even then, the actual framebuffer provided is not resized along with the
'window'.  That will hopefully change once context and framebuffer
creation are separated, but this commit should at least allow more
applications than before to run on the Null platform.
2024-03-28 16:53:04 +01:00
Camilla Löwy
860c8ef38f Null: Add Vulkan 'window' surface creation
This adds support for Vulkan 'window' surface creation on the Null
platform via the VK_EXT_headless_surface extension, where available.

Tested with MoltenVK.
2024-03-28 16:53:04 +01:00
Camilla Löwy
42dc1ffaee Wayland: Fix leak of surface scaling objects 2024-03-28 16:53:04 +01:00
Grzesiek11
bf945f1213 Unlimited mouse button input mode
This adds the GLFW_UNLIMITED_MOUSE_BUTTONS input mode which permits
mouse buttons over GLFW_MOUSE_BUTTON_LAST to be reported to the mouse
button callback.

Closes #2423
2024-03-12 16:24:01 +00:00
Camilla Löwy
dc557ecf38 Fix minimum CMake version in README 2024-02-29 15:44:01 +01:00
Camilla Löwy
d24ee9953f Start 3.5 2024-02-29 15:42:28 +01:00
Camilla Löwy
7b6aead9fb Documentation updates for 3.4 release 2024-02-23 12:45:31 +01:00
Camilla Löwy
e14e72a2e7 De-emphasize FAQ
Until it can be properly rewritten.
2024-02-22 22:35:05 +01:00
Camilla Löwy
523d1d61ca Remove outline of Doxygen 1.9.8 menu links 2024-02-22 22:35:05 +01:00
Camilla Löwy
4d9557aefe Update README for 3.3.10 release 2024-02-22 20:20:50 +01:00
Camilla Löwy
415df7e3ba Wayland: Explain what to do when the build fails
That would be a helpful thing to do.
2024-02-21 15:42:44 +01:00
Camilla Löwy
fb9c23fbf2 Build has been tested with CMake 3.28 2024-02-21 15:34:36 +01:00
Camilla Löwy
d45cbc82c9 Fix error return value for glfwGetVideoMode
The function returned a pointer to a zeroed video mode instead of NULL
on error because errors were not propagated up from the platform.

Fixes #1292
2024-02-21 01:01:20 +01:00
Camilla Löwy
d7e7b164bc Add credit
Related to #2359
2024-02-21 00:17:32 +01:00
Camilla Löwy
421dc66afb Remove reference to stale Coverity result 2024-02-20 23:38:16 +01:00
Camilla Löwy
b864e4baeb Improved build guide slightly 2024-02-20 21:28:42 +01:00
Camilla Löwy
f6f7ee2284 Add new symbol to list 2024-02-20 20:23:19 +01:00
Camilla Löwy
961e45bded Include declarations from native access header 2024-02-20 16:29:41 +01:00
Camilla Löwy
e28397bda0 Cocoa: Fix glfwGetCocoaWindow error return value 2024-02-20 16:29:41 +01:00
Camilla Löwy
8f2f766f0d NSGL: ANGLE exists 2024-02-20 16:27:51 +01:00
Camilla Löwy
f6360eadee NSGL: Fix missing check for OpenGL profile
macOS only provides the core profile for OpenGL 3.2 and later.
2024-02-20 15:55:24 +01:00
Doug Binks
1fb7f0e120 Cocoa: Added glfwGetCocoaView native access function
Resolves #2235

Co-authored-by: mightgoyardstill <mightgoyardstill@users.noreply.github.com>
2024-02-20 13:20:30 +00:00
Camilla Löwy
0bb605cd79 Wayland related documentation work 2024-02-19 15:08:51 +01:00
Camilla Löwy
559bd3adb9 Add credit
Related to #2035
2024-02-19 14:44:02 +01:00
Florian Hülsmann
65102e2005 Prefer Wayland over X11
When GLFW_ANY_PLATFORM is used (which is the default), X11 would be
selected on a Wayland system with XWayland and where XDG_SESSION_TYPE
was not set.

Closes #2035
2024-02-19 14:39:50 +01:00
Camilla Löwy
dbf7cfc4dc Update credit
Related to #2204
2024-02-19 14:21:55 +01:00
Camilla Löwy
42afd127a9 Documentation work 2024-02-19 14:21:55 +01:00
Camilla Löwy
7bdcdf435a Cleanup 2024-02-19 14:21:48 +01:00
Camilla Löwy
c8372cda08 Documentation work 2024-02-19 14:20:52 +01:00
Camilla Löwy
1ce41b358b Null: Remove unused struct member 2024-02-19 14:20:52 +01:00
Camilla Löwy
af5d250553 Wayland: Remove separate window title copy 2024-02-19 14:20:52 +01:00
Doug Binks
95d464bb4b Add glfwGetWindowTitle
This adds a function for querying the current title of a window.  This
currently returns a copy of the last title set via GLFW.

Fixes #1448
Closes #1909
Closes #2482
2024-02-19 14:20:52 +01:00
Camilla Löwy
bafece4cf7 Update Wayland remarks for glfwCreateWindow
The backend has improved somewhat and support among compositors for some
protocols have improved to the point that they can be relied upon.
2024-02-19 14:19:36 +01:00
Camilla Löwy
64b4f0f30c Null: Fix missing damage event 2024-02-16 12:36:15 +01:00
Camilla Löwy
a53ce7e8b8 Null: Fix window/framebuffer size event order 2024-02-16 12:36:15 +01:00
Camilla Löwy
f0ec791386 X11: Cleanup
The actual reported bug was fixed at some point during the refactoring
of the Wayland backend.  This is only a bit of tidying.  Updating the
cache before emitting events is always a nice thing to do.

Closes #2046
2024-02-16 12:34:03 +01:00
Camilla Löwy
14e653358b Add support for XDG_SESSION_TYPE env variable
Related to #2439
2024-02-16 00:18:44 +01:00