Commit Graph

417 Commits

Author SHA1 Message Date
Daijiro Fukuda
4a2883b4e2 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.
2024-04-02 08:39:12 +09:00
Daijiro Fukuda
1ba8267f20 Doc: Improve document about IME features 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
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
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
d24ee9953f Start 3.5 2024-02-29 15:42:28 +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
c8372cda08 Documentation work 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
14e653358b Add support for XDG_SESSION_TYPE env variable
Related to #2439
2024-02-16 00:18:44 +01:00
Camilla Löwy
2b3f919b60 Wayland: Add support for fractional scaling
This adds basic support for fractional-scale-v1.

Note that this introduces a potential discrepancy between window and
monitor content scales.
2024-02-14 22:35:46 +01:00
Camilla Löwy
a9cc7c7260 Add GLFW_SCALE_FRAMEBUFFER window hint
This adds the GLFW_SCALE_FRAMEBUFFER window hint, enabling control of
framebuffer scaling across Wayland and macOS.  On macOS, this window
hint is a new name for GLFW_COCOA_RETINA_FRAMEBUFFER, and both hint
names will modify the same hint.

This is now a more symmetric counterpart to GLFW_SCALE_TO_MONITOR and,
weirdly, they each apply neatly to half of the supported platforms.

This commit is mostly documentation updates to better integrate and
contrast these two scaling mechanisms.
2024-02-14 22:35:46 +01:00
Camilla Löwy
63397fb0d5 Convert some external links to reference links 2024-02-14 22:35:46 +01:00
Camilla Löwy
8946f5314d Win32: Add GLFW_WIN32_SHOWDEFAULT
Fixes #2359
2024-02-13 17:36:35 +01:00
Camilla Löwy
2afd57bf9b Expand documentation for custom allocator
Fixes #2298
2024-02-13 17:35:59 +01:00
Camilla Löwy
a12311e596 Document GLFW_FLOATING not supported on Wayland 2024-02-12 22:50:25 +01:00
Camilla Löwy
a360198f8f Wayland: Implement glfwFocusWindow
This implements window focus requests via the xdg-activation-v1
protocol.  These requests will likely only work when another window of
the same application already has input focus, but that isn't unlike the
behavior of other platforms.

The GLFW_FEATURE_UNAVAILABLE error has been removed from this function
for now.

Related to #2284
Related to #2306
Related to #2439
2024-02-09 13:52:54 +01:00
Camilla Löwy
d2b88cf7ab Update documentation for native access errors
The GLFW_PLATFORM_UNAVAILABLE error was not listed for those native
access function that can emit it.

The order of errors for many functions in glfw3native.h did not match
the order used in glfw3.h.

The documentation for GLFW_PLATFORM_UNAVAILABLE was a little bit terse.
2024-01-13 22:13:56 +01:00
Camilla Löwy
29885c6942 Win32: Improve clipboard contention issue
This is primarily a workaround for a GLFW application reading and/or
writing to the clipboard in rapid succession and catching up with the
Windows Clipboard History, which also has to contend for the lock.
2024-01-13 22:13:56 +01:00
Camilla Löwy
73948e6c0f Fix missing error in docs for glfwCreateWindow
The GLFW_NO_WINDOW_CONTEXT error can be emitted if the window passed in
for context sharing does not have a context.

Fixes #2456
2024-01-13 22:13:56 +01:00
Camilla Löwy
9959dc69ca Improve documentation relating to key tokens
Shifted the documentation away from the term 'named keys' as something
different than keys that glfwGetKeyName will return a name for.  The
already existing term 'key token' should now be used to refer to the
GLFW_KEY_* constants.

The associated term 'named mouse button' was also replaced with
'supported mouse button'.

The parts explaining which key tokens will return a valid scancode from
glfwGetKeyScancode have hopefully been clarified.  This issue was
reported in #2055.

The GLFW_KEY_UNKNOWN constant has been moved out of the list of key
tokens to simplify and hopefully clarify the related documentation.

Various other keyboard key related edits were made, hopefully resulting
in improvements.

Related to #2055
2023-12-05 19:10:06 +01:00
Camilla Löwy
557a633b2d Fix list of possible errors for glfwGetKeyName 2023-12-05 18:36:54 +01:00
Camilla Löwy
3f31519de8 Clarify documentation for glfwMakeContextCurrent 2023-12-05 18:36:54 +01:00
Grzesiek11
dbe810e403
Documentation: only named keys generate synthetic key releases
The current wording states that all keys have synthetic key release
events generated after focus is lost, but keys that aren't named
don't have any state held, so no such events are generated for them.

The new wording clarifies that only named keys have the events generated
for them.
2023-11-24 17:04:13 +00: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
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
0f9a9578f3 Add window hints for initial position
This adds window hints for the initial position, in screen coordinates,
of a window.  The special value GLFW_ANY_POSITION means the window
manager will be allowed to position the window.

It is not possible to set window positions on Wayland and GLFW will
always behave as if these hints are set to GLFW_ANY_POSITION.

Fixes #1603
Fixes #1747
2022-07-29 11:50:13 +02:00
Camilla Löwy
2efc598d70 Fix native access macros being mutually exclusive
The documentation was updated with the introduction of run-time platform
selection, but the preprocessor logic was not.
2022-07-28 15:56:47 +02:00
Camilla Löwy
488008e0a2 Add cursor mode GLFW_CURSOR_CAPTURED
This adds a cursor mode that provides a visible cursor confined to the
content area of the window.

Fixes #58
2022-07-25 18:02:57 +02:00
Michael Pennington
b9ed25d2e9 Wayland: Add GLFW_WAYLAND_APP_ID window hint
This adds a window hint string for the xdg_toplevel::app_id, which is
used by desktop environments to connect windows with application icons
and other information.  This is similar to the WM_CLASS property on X11.

A few very minor fixes were done by @elmindreda during merge.

Fixes #2121
Closes #2122
2022-07-24 17:51:54 +02:00
Camilla Löwy
aa80d24d01 Documentation work
Fixes #1596
2022-07-12 19:08:01 +02:00
Camilla Löwy
2796e61af7 Documentation work 2022-07-11 20:54:22 +02:00
Camilla Löwy
05f6c13d11 Add support for GLFW_NATIVE_INCLUDE_NONE macro
By default, the glfw3native.h header will include the platform-specific
headers necessary for the return types of GLFW native access functions.

Sometimes it is preferrable to declare those types

This commit adds support for the GLFW_NATIVE_INCLUDE_NONE macro, which
when defined disables the inclusion of all platform-specific headers.

Fixes #1348
2022-06-08 22:14:38 +02:00
Camilla Löwy
edec334b32 Cocoa: Use system header to declare id type
Related to #1348
2022-06-08 22:14:38 +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
685de9089f Fix and clarify comments for GLFWAPI 2022-04-28 21:58:44 +02:00
Camilla Löwy
06089a91a6 Document delayed initialization of EGL display 2022-04-28 21:18:49 +02:00
Camilla Löwy
66a4882eb1 Add checks for some invalid values to public API
There were no checks for invalid values or asserts for all invalid NULL
pointers to glfwSetWindowIcon or glfwCreateCursor.

Fixes #1862
2022-03-18 00:23:20 +01:00
Camilla Löwy
add0521efb Fix accidental C99 in C89 header 2022-03-16 18:41:27 +01:00
Camilla Löwy
535c3ce632 Fix GLAPIENTRY redefinition warning
On a Unix system, if you define GLFW_INCLUDE_NONE and
GLFW_EXPOSE_NATIVE_GLX, then include glfw3.h and glfw3native.h, you will
get a redefinition warning for GLAPIENTRY.

The glfw3.h header defines GLAPIENTRY as a service for OpenGL related
headers that assume it's already defined.  However, glx.h includes gl.h,
which defines GLAPIENTRY unconditionally.

If not for Hyrum's law, the better solution would have been not to
define GLAPIENTRY if GLFW_INCLUDE_NONE is defined.

Fixes #2010
2022-03-16 18:40:26 +01:00
Camilla Löwy
8edbc4971d Wayland: Document delayed window showing 2021-12-27 01:31:38 +01:00
Camilla Löwy
05b0e2fab2 Update docs for specific Vulkan surface extensions
Related to #2014
2021-12-26 18:10:18 +01:00
InKryption
c19f36b28d Add missing errors section for glfwGetGamepadName
The reference documentation for glfwGetGamepadName lacked the possible
errors section.

Closes #2007
2021-12-08 19:20:45 +01:00
Stephen Gutekanst
37fc28bff6 Fix docs calling GLFW_CONTEXT_REVISION a hint
This docstring previously indicated that GLFW_CONTEXT_REVISION was
a window hint and attribute, but in fact it is only a window attribute
(there is no code which uses this constant in any other context.)

We noticed this in https://github.com/hexops/mach/pull/71/files#r749741814

Closes #1992

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-11-25 23:44:12 +01:00
InKryption
bb193325cc Add missing error to glfwGetClipboardString docs
Add GLFW_FORMAT_UNAVAILABLE to the list of possible errors in the
reference documentation for glfwGetClipboardString.

Slightly edited by @elmindreda.

Closes #1998
2021-11-25 23:24:26 +01:00