Commit Graph

4858 Commits

Author SHA1 Message Date
Daijiro Fukuda
a20275f443
Merge c0d34f3634 into 63a7e8b7f8 2025-08-20 16:06:19 -04:00
Camilla Löwy
63a7e8b7f8 Add and update Wayland-specific notes in docs
Fixes #2746
2025-08-20 20:13:07 +02:00
Doug Binks
acb92944d4 Revert readme for "Wayland: Keyboard leave event handler now processes key repeats" 2025-08-19 11:30:52 +02:00
Camilla Löwy
7ef6efeb66 Wayland: Fix cursor position after a modal
If a modal surface like the window menu was active, clicking on the GLFW
window content area to close it would correctly emit the cursor enter
event but would not propagate the cursor position from the event.
2025-08-18 20:58:12 +02:00
Camilla Löwy
3cf9f6726d Wayland: Fix fallback decoration cursor updating
When a click through to the fallback decorations caused the end of
a modal like the window menu, the cursor shape would not be updated
until the next time the cursor moved.

This commit adds an update of the cursor for the pointer enter event for
fallback decoration surfaces, in addition to the updates at pointer
motion events.
2025-08-18 18:06:46 +02:00
Camilla Löwy
bfa1c424e5 Wayland: Fix fallback decoration menu placement
The fallback decorations would place the menu at the wrong position, by
not translating the last decoration surface position into toplevel
surface coordinates.

This also limits the menu to the caption area of the top decoration
surface, similar to how other toolkits work.
2025-08-18 18:06:46 +02:00
Doug Binks
0d2d85d19c Revert "Wayland: Keyboard leave event handler now processes key repeats" 2025-08-15 11:27:59 +02:00
Jan Hendrik Farr
768e81a0eb Wayland: Fix key repeat halting
Key repeat shoud only be halted when the repeating key
is released, not when another key is released.
2025-08-14 15:35:04 +02:00
Camilla Löwy
161fb1b6f6 Wayland: Fix fallback decoration scroll events
The fallback decorations would emit scroll events as if scrolling had
occurred over the content area of the window.
2025-08-12 17:11:27 +02:00
Camilla Löwy
645a35a38e Wayland: Cleanup 2025-08-12 17:11:27 +02:00
Camilla Löwy
7523b0e6bd Wayland: Move fallback decoration pointer logic
Decluttered the wl_pointer handlers by moving the bulk of fallback
decoration related logic to separate functions.
2025-08-12 17:11:26 +02:00
Camilla Löwy
5190a30d8a Wayland: Move fallback decoration struct member
The cursorPreviousName member was only used for the fallback decorations
but was not grouped with other related members.
2025-08-12 17:11:26 +02:00
Camilla Löwy
ddbb8e0f2c Wayland: Fix fallback decoration cursor position
If fallback decorations were in use, pointer motion over a decoration
surface would cause glfwGetCursorPos to provide incorrect cursor
positions.

The cursor position is now only updated when the pointer is over the
content area of the window, similar to libdecor and XDG decorations.
2025-08-12 17:11:24 +02:00
Camilla Löwy
5245180c56 Formatting 2025-08-12 17:10:43 +02:00
Doug Binks
7b51a8eb31 Wayland: Keyboard leave event handler now processes key repeats
- Fixes #2736
2025-08-10 18:27:44 +02:00
Camilla Löwy
ac10768495 Wayland: Fix memory leaks in data offer reading
The buffer storing the contents of the data offer being read could leak
if buffer reallocation or reading from the pipe failed.
2025-07-18 12:31:07 +02:00
Doug Binks
feb2a6b728 Wayland: Reset key repeat timer on window destruction
Windows with keyboard focus may have an active key repeat timer.
This should be reset when the window is closed, or key repeat events
could be sent to a NULL window were it not for the quickfix in PR #2732.

Fixes #2741
Probably the source of #2727
2025-07-17 17:24:19 +02:00
Camilla Löwy
d11cb3779b Win32: Remove support for Windows XP and Vista
It's increasingly difficult to maintain a safe testing environment for
Windows XP, and so increasingly a burden on contributors to maintain
support for it.

Windows XP has been out of of support since 2014 and should not be used
as a desktop OS.

Fixes #2505
2025-07-11 16:49:23 +02:00
Camilla Löwy
d1b87143bc Win32: Remove support for original MinGW
The original MinGW distribution appears to no longer be maintained and
should not be used.  Anyone still using MinGW should consider switching
to the MinGW-w64 fork or another actively maintained toolchain.
MinGW-w64 supports 64-bit binaries and provides much newer compilers and
Win32 headers.

Fixes #2540
2025-07-10 17:59:12 +02:00
Jan Schürkamp
506c11ba43
Wayland: Ignore key repeat events when no window has keyboard focus (#2732)
* Wayland: Ignore key repeat events when no window has keyboard focus
2025-07-05 19:16:08 +02:00
Doug Binks
d30d63313c Examples: disable MSVC warning C5287 in nuklear.h
Latest MSVC has a warning `operands are different enum types` which this disables until upstream nuklear fixes this
2025-07-05 19:12:15 +02:00
xfangfang
c0d34f3634 WIN32: Better support for IME 2025-01-14 12:13:51 +09:00
Takuro Ashie
67fe83f9ad Don't link Fontconfig
Load it dynamically instead.
2025-01-14 12:13:51 +09:00
Daijiro Fukuda
813a805ecc Win32: Support preedit candidate feature
You can use this feature when you need to manage the drawing of
the preedit candidates on the application side.
2025-01-14 12:13:51 +09:00
Daijiro Fukuda
8a1dd690cb Add change log entries 2025-01-14 12:13:51 +09:00
Daijiro Fukuda
6c7c2d2602 Add credit
new

- Daijiro Fukuda
- Ryo Ichinose (from #658)
- Yasutaka Kumei (from #658)
- xfangfang

already in the list

- Takuro Ashie
- Yoshiki Shibukawa
2025-01-14 12:13:51 +09:00
Daijiro Fukuda
1b7ab5c523 Doc: Improve document about IME features 2025-01-14 12:13:51 +09:00
Yoshiki Shibukawa
d0f300fa89 Apply shibukawa's document fix
This fix is from shibukawa's fix:
  https://github.com/glfw/glfw/pull/658
  d36a164423
2025-01-14 12:13:51 +09:00
Daijiro Fukuda
1500c31b0a tests: Add tests for IME features
Co-authored-by: Takuro Ashie <ashie@clear-code.com>
2025-01-14 12:13:51 +09:00
Takuro Ashie
b109d02b00 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.
2025-01-14 12:13:51 +09:00
Daijiro Fukuda
b198b4b842 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>
2025-01-14 12:13:51 +09:00
Daijiro Fukuda
ea358b32fb 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>
2025-01-14 12:13:51 +09:00
Daijiro Fukuda
e3ffd25956 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>
2025-01-14 12:13:48 +09:00
Daijiro Fukuda
3d5f5825bb 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>
2025-01-14 12:12:27 +09:00
Daijiro Fukuda
2810acc4e4 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>
2025-01-14 12:06:46 +09:00
Daijiro Fukuda
4ac5f4044d 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>
2025-01-14 12:06:46 +09:00
Camilla Löwy
e7ea71be03 Update changelog and add credit
Related to #2593
2025-01-13 20:00:04 +01:00
er-azh
cf4734ce8a X11: Fix detectEWMH not releasing error handler
If detectEWMH failed to query the EWMH helper window, it would return
without restoring the previous Xlib error handler.  This was bad
(because other code might also be using the facility) and bad (because
GLFW would assert the next time it tried to grab the error handler).

This commit adds the necessary release call.

Closes #2593
Fixes #2601
Closes #2631
2025-01-13 19:59:19 +01:00
LocalSpook
21fea01161 Wayland: Replace _glfwKeySym2Unicode with xkbcommon
libxkbcommon already provides functions to convert keysyms to codepoints
and UTF-8. The library has offered these functions since 0.5.0[1], so
using them won't cause any compatibility problems.

[1] https://xkbcommon.org/doc/0.5.0/group__keysyms.html

Closes #2444
2024-11-29 12:05:20 +01:00
Camilla Löwy
a576a56a8d Remove unused CMake find module for OSMesa 2024-11-27 16:26:00 +01:00
Camilla Löwy
b850107a32 Update minimum CMake version to 3.16
This replaces some workarounds and manual logic with new features
available with CMake 3.16, including list(FILTER), list(JOIN),
foreach(IN LISTS) and enable_language(OBJC).  Policy settings no longer
needed with 3.16 have been removed.

Related to #2541
2024-11-27 16:25:07 +01:00
Camilla Löwy
043378876a Use CMakePushCheckState for check state management 2024-05-09 17:18:39 +02:00
Camilla Löwy
b35641f4a3 Wayland: Cleanup 2024-04-12 18:27:53 +02:00
Camilla Löwy
64906f8e64 Wayland: Cleanup 2024-04-12 18:25:06 +02:00
Camilla Löwy
51b6434ac4 Wayland: Fix possible segfault on drag enter
Found with Clang static analysis.
2024-04-11 19:12:17 +02:00
Camilla Löwy
dfebad786d Update macOS OpenGL compatibility notes 2024-04-07 20:56:18 +02:00
Camilla Löwy
97892c6037 Cocoa: Add QuartzCore as a link-time dependency 2024-04-07 20:55:30 +02:00
Camilla Löwy
8b574030a8 Cocoa: Remove support for OS X 10.10 Yosemite
Fixes #2506
2024-04-07 20:43:48 +02: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