Commit Graph

273 Commits

Author SHA1 Message Date
Mosè Giordano
fa68804a5b Hoist iterator variable definition outside of for loop
This is compliant with pre-C99 standard.
2021-05-07 12:47:05 +01:00
John Ralls
242b76a771 Add a public header for Cocoa access functions.
Some applications need to access gdk_quartz_window_get_nsview,
gdk_quartz_window_get_nswindow, and gdk_quartz_event_get_nsevent
so move these from the private gdkquartz-gtk-only.h to a new
header gdkquartz-cocoa-access.h. Don't include this header in
gdkquartz.h so that user code that doesn't need to access these
functins isn't required to compile with Objective C/C++.

Closes https://gitlab.gnome.org/GNOME/gtk/-/issues/1737
2021-04-16 16:56:55 -07:00
René de Hesselle
8627a9a569 Fix building on OS X El Capitan 10.11
The preprocessor directives for proper OS version support are missing
their last digit, rendering the checks defunct.

Improves on https://gitlab.gnome.org/GNOME/gtk/-/issues/3592 but does
not fully fix as other issues have surfaced down the line.
2021-04-05 22:20:25 +02:00
Matthias Clasen
1282cac99d imwayland: Be careful about cursor positions
We don't want to hand out cursor positions based on
the original preedit text and then tweak the text to
be different.
2021-02-18 15:44:21 -05:00
Matthias Clasen
f8206f18b1 imwayland: Tweak preedit text
Tweak the preedit text we get from IBus (via the compositor) to
match what GtkIMContextSimple produces for Compose sequences now.

This provides a unified experience.
2021-02-18 13:14:31 -05:00
Philip Zander
5b81864211 Fix 2 warnings, formatting 2020-07-16 15:44:08 +02:00
Philip Zander
5413892b7d Formatting 2020-07-16 15:01:50 +02:00
Philip Zander
e6f05da6ef Use native Windows API for converting keystrokes to characters
Instead of using the incomplete GTK-internal emulation, use the WM_CHAR
messages sent by Windows. Make the IME input method the default for all
languages on Windows.
2020-07-16 15:01:47 +02:00
Ross Burton
1bc6f7ef47 modules/input: don't dist generated protocol sources
For some reason modules/input adds the C code that is generated by
wayland-scanner to EXTRA_DIST. This results in a race where depending
on the timestamps of the tarball and the timestamp of the system
wayland-protocols either the generated source in the tarball or a
regenerated source will be used.

This doesn't actually impact the code generated, but it does break
reproducible builds as the list of source files changes.
2020-07-02 19:05:23 +01:00
Jehan
b592ded80a modules: focus out the GtkIMContextWayland upon finalization.
In particular, it will NULL-ified the current global context if this is
the finalized one, avoiding dangling invalid pointers.
2020-06-29 11:02:08 +02:00
John Ralls
ae97f04498 Fix symbol deprecation warning. 2020-06-20 09:49:43 -07:00
John Ralls
0e30a96404 Use NSTextInputContext discardMarkedText when MacOS is Lion or later.
NSInput manager has been deprecated since 10.6
2020-06-20 09:49:09 -07:00
Matt Rose
3236c09d7d Fix quartz input method filtering Esc keypress 2020-04-15 16:48:02 -04:00
Carlos Garnacho
d7fb15c822 imwayland: Clamp the surrounding string end correctly
In the paths where len > MAX_LEN and cursor/anchor are separated by
at least MAX_LEN from text edges, we were clamping the right end of
the surrounding string at MAX_LEN. Oops.

This end anchor may go as far as the string length, although just
up to len - MAX_LEN in real terms (due to the condition above that
caches cursor/anchor positions being near enough the text end).

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2565
2020-04-03 12:57:44 +02:00
Matthias Clasen
d5264673cb wayland: Load .Compose in imwayland too
GtkIMContextSimple loads custom compose sequences
in its set_client_window implmentation, so we need
to chain up in order to not lose those.
2020-04-02 17:30:54 -04:00
Carlos Garnacho
965a85a0d3 imwayland: Fix typo in code
To find the middle of the string, we should check both cursor/anchor.
This is actually a backport of commit 8fc360dac5 in master.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/2522
2020-03-18 16:59:58 +01:00
Robert Mader
3c28751dee imwayland: Honour len argument in gtk_im_context_wayland_set_surrounding
Clients may pass not `NULL`-terminated strings as the function takes a
`len` argument. Use that argument.
2020-03-16 16:36:30 +01:00
Emmanuele Bassi
1b255dd812 Handle a missing enumeration value 2020-03-13 15:59:46 +00:00
Dorota Czaplejewicz
a7c17ca0c5 imwayland: Do not send events while text input is inactive. 2020-02-15 13:10:34 +01:00
Dorota Czaplejewicz
601b7c8edf imwayland: Use common function to enable text input
Enabling text input needs to send the supported capabilities.
It's easiest to ensure that by using a single enable function.
2020-02-15 13:10:34 +01:00
Dorota Czaplejewicz
fc437410ce imwayland: Move release handling after enable
In preparation for the commit which calls enable in the release handler.
2020-02-15 13:10:34 +01:00
Emmanuele Bassi
418b80e6c8 Merge branch 'private-code' into 'gtk-3-24'
Use `wayland-scanner private-code` in autotools build

See merge request GNOME/gtk!1295
2020-02-11 16:35:30 +00:00
Michael Forney
fb98242e18 Use wayland-scanner private-code in autotools build
The sed -i flag is non-standard, and may not be available in all
implementations.

The meson build already requires wayland >= 1.14.91 and uses
private-code, so just do that in the autotools build as well.
2020-01-09 19:15:46 -08:00
xdavidwu
5ad1316b1e
imwayland: Fix get_preedit_string cursor position
GtkIMContext get_preedit_string should return cursor position counted
in characters, but cursor_begin here is counted in bytes. This add the
missing conversion.
2019-12-15 19:19:54 +08:00
Matthias Clasen
77f465bf19 Merge branch 'terminal-3-24' into 'gtk-3-24'
imwayland: Suppport terminal purpose

See merge request GNOME/gtk!1245
2019-12-12 19:12:34 +00:00
Dorota Czaplejewicz
c7c8ab6624 imwayland: Suppport terminal purpose 2019-12-12 18:20:06 +00:00
Matthias Clasen
f0002ad372 Merge branch 'no-objc' into 'gtk-3-24'
Hide Objective-C from outside GdkQuartz.

See merge request GNOME/gtk!641
2019-11-27 13:39:40 +00:00
Matthias Clasen
75475effb1 Merge branch 'issue-61' into 'gtk-3-24'
Ensure we have a client window before using it

See merge request GNOME/gtk!1194
2019-11-18 01:15:10 +00:00
Emmanuele Bassi
0ade87ef92 Ensure we have a client window before using it
The XIM input method can some times go into weird states, especially
when extended devices or in mixed environments with multiple input
methods installed.

Ideally, people should simply stop using XIM, which is utterly broken,
and use IBus instead; nevertheless, crashing is not nice.

Fixes: #61
Fixes: #518
2019-11-16 20:57:43 +00:00
Ming Hua
307a045e52 Do not use VIQR input method for vi locale by default
In the Vietnamese Quoted-Readable input method, punctuation following a
base letter is converted into diacritical marks, for example a( → ă.
(See <https://en.wikipedia.org/wiki/Vietnamese_Quoted-Readable>.)
A 2008 bug report in Ubuntu argued that this is a problematic default,
particularly when typing passwords, where the effect of the punctuation
is non-obvious.

According to the bug reporter, VIQR is popular with Vietnamese users
living elsewhere in the world, where Vietnamese keyboards are unlikely
to be readily available, but is not a popular choice within Vietnam,
where the Telex or VNI input modes are preferred.

Closes: #183

Bug-Debian: https://bugs.debian.org/895043
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gtk+2.0/+bug/191451

Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
2019-11-16 20:16:55 +00:00
Tom Schoonjans
fa07007389 meson: ensure plugins have so extension on macOS 2019-10-11 08:55:12 +01:00
Philip Zander
d33c24b31e Win32 IME fixes
See merge request !1063
2019-09-06 20:45:45 +02:00
John Ralls
ef72fe750a Hide Objective-C from outside GdkQuartz.
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1737

Don't export any functions taking or returning MacOS types in
gdkquartz.h, gdkprivate-quartz.h, or any header that either includes.

The GdkQuartz internal functions are moved to a new header
gdkinternal-quartz.h, the functions used by quartz-specific
Gtk files are moved to another new header gdkquartz-gtk-only.h, and
the key and event enums to a new header gdkkeys-quartz.h.
2019-06-22 13:37:46 -07:00
Chun-wei Fan
c073a062b6 gtkimcontextime.c: Fix preedit window placement on HiDPI
We must also take the scaling factor into account for placing the IME
preedit window that is often used for Chinese and Japanese input on
Windows.
2019-04-25 12:15:43 +08:00
Timm Bäder
81c8efc863 imcontextwayland: (Hopefully) fix if expression
Backport from master: f9a5a474f0
2019-04-16 00:12:24 +02:00
Christoph Reiter
749a58ab26 meson: simplify builtin_immodules build option
Make it a yes/no/auto combo. "yes" means all modules are built into libgtk,
"no" that none are and "auto" uses the platform defaults, yes on win32,
no otherwise.

If we need more we can always extend it later.
2019-04-11 16:46:22 +02:00
Christoph Reiter
d52dad2042 autotools: dist all meson related build files 2019-04-11 16:45:36 +02:00
Christoph Reiter
26d32f3bd0 meson: build all input modules; fix static build on Linux 2019-04-11 16:45:36 +02:00
Christoph Reiter
cb89ad18a2 meson: immodules: unset the name_prefix to match autotools 2019-04-11 16:45:36 +02:00
Christoph Reiter
1ee995fd0f meson: Install im-multipress.conf 2019-04-11 16:45:36 +02:00
Chun-wei Fan
5e8edec254 meson: Build the input modules
Build the input modules for GTK+, either as modules or built directly
into GTK.  Also provide a configure option to build the specified
immodules, or all, or the backend immodule(s) or none of the immodules
into GTK.  Note that for Visual Studio all immodules are built into
the GTK DLL by default, like what is done in the Visual Studio projects.

Note that building the backend immodules for Quartz, X11 and Wayland are
currently untested.
2019-04-11 16:45:36 +02:00
John Ralls
6afd174162 Merge branch 'suyuan/fix-macos-accented-char-input' into gtk-3-24. 2019-02-17 13:04:20 -08:00
Matthias Clasen
9f3141fc5c Merge branch 'wip/carlosg/toggle-osk-sparingly' into 'gtk-3-24'
imwayland: Toggle OSK more sparingly

See merge request GNOME/gtk!569
2019-02-08 23:40:00 +00:00
Carlos Garnacho
38a4c4dd37 imwayland: Toggle OSK more sparingly
Specifically it is avoided to be toggled if:
- Just received focus (in order to preserve OSK state across focus changes)
- Moving cursor around. Still allow some jitter as perfect accuracy is not
  possible.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1277
2019-02-09 00:29:56 +01:00
Suyuan Chang
cfad43b80d macOS: Fix bug that entry cannot press and hold a key to input accented character.
There're two issues in GdkQuartzView's NSTextInputClient implementation
causes this bug.

1. The -(NSRange)selectedRange should not return [NSNotFound, 0] if
   there's no selection. The accented character window will not show
   if returned NSRange's location is NSNotFound. Instead of that, the
   NSRange's location should be the caret position in the text input
   buffer.

2. The accented character window will invoke
   -(void)insertText:replacementRange: with non-empty replacement
   range, to replace non-accented character with accented character
   after user select it from accented character window. This case is
   not implemented in original code. Here I use another gobject data
   to pass the information to input module and convert it into
   'delete-surrounding' event.

Besides these, there's another bug cause gtk_im_context_filter_keypress()
return wrong value while user press and hold a key. When user press
and hold a key, the accented character window will consume the
repeating key down event. Is this case, gtk_im_context_filter_keypress()
should return TRUE, indicate the key press is filtered by input
method module. But it will return FALSE because
gtk_im_context_filter_keypress() assume that every key press event
will generate some text from input method module.

Fixes #1618
2019-01-30 22:07:23 -08:00
John Ralls
3e3a15de83 [imquartz] Fix incorrect GdkEvent window member name. 2019-01-23 20:02:16 -08:00
John Ralls
a93daa0373 [imquartz] Return event window for mouse events in keypress filter.
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1600
2019-01-21 07:31:52 -08:00
John Ralls
ee0e59e6cf [IMQuartz] Get the GdkWindow from the NSKeyEvent.
Instead of from the IMContextQuartz's client window because the former
is the event window where the text will be inserted. In some cases
they're different and the text may be discarded (because the client
window isn't editable) or misplaced.

Fixes Bug 707945.
2019-01-13 16:00:53 -08:00
Matthias Clasen
3e6fd50d96 Merge branch 'wip/carlosg/im-wayland-surrounding-limits' into 'gtk-3-24'
imwayland: Respect maximum length of 4000 Bytes on strings being sent.

See merge request GNOME/gtk!438
2018-12-14 20:09:18 +00:00
Matthias Clasen
f879741e89 Merge branch 'imwayland_enable' into 'gtk-3-24'
imwayland: Handle enter and leave events

See merge request GNOME/gtk!369
2018-12-14 20:07:18 +00:00