| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
Update all (non-deprecated) callers to use
gtk_widget_compute_point instead.
Fixes: #5697
|
|\
| |
| |
| |
| | |
gtkimcontextwayland: Convert byte based offset to char based offset in delete_surrounding_text
See merge request GNOME/gtk!5254
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
delete_surrounding_text
ClutterInputFocus/GtkIMContext uses char based offset for
delete_surrounding, however, text_input_v3 uses byte based offset for
it. Currently only GTK with mutter can work correctly via text_input_v3
because they both forget to convert between char based offset and byte
based offset.
This commit fixes it in GTK by converting byte based offset to char
based offset with the UTF-8 encoded surrounding text.
Fixes <https://gitlab.gnome.org/GNOME/gtk/-/issues/4566>.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
With GtkText and GtkTextView (and in extension, all their subclasses)
handling OSK activation activation, this gesture is only useful for
all text input widgets that are not subclasses of these 2 widgets,
e.g. the VTEs and crosswords of the world.
These still do need a hand in handling OSK activation, so only
set up the gesture for such cases.
|
|/
|
|
|
|
| |
This method does explicitly what the builtin GtkClickGesture in
the IM context is doing implicitly. The gesture will be dropped
after porting is done.
|
|\
| |
| |
| |
| |
| |
| | |
gtkimcontextwayland: Shuffle full resets after IM changes
Closes #5200
See merge request GNOME/gtk!5050
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Doing reset() on the text widgets after commit and delete_surrounding
is still too eager for some IMs (e.g. those that expect being able
to commit text while keeping a preedit buffer shown).
However, reset() is more of a "synchronize state" action on Wayland,
and it is still desirable to do that after changes that do come from
the IM (e.g. requesting the new surrounding text and cursor/anchor
positions). Notably here, the text_input protocol may still come up
with a preedit string after this state synchronization happens.
Shuffle the code so that the text widgets do not reset() the IM
context after text is deleted or committed, but the Wayland IM does
apply its practical effects after these actions happen. This keeps
the Wayland IM fully up-to-date wrt text widget state, while not
altering the ::commit and ::delete-surrounding-text behavior for
other IM context implementations.
Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5200
Fixes: 5b78fe2721 (gtktextview: Also reset IM context after IM...)
Fixes: 7c0a395ff9 (gtktext: Also reset IM context after IM...)
Fixes: 52ac71b972 (gtktextview: Shuffle the places doing IM reset)
Fixes: 9e29739e66 (gtktext: Shuffle the places doing IM reset)
|
|/
|
|
|
| |
Include gtkprivate.h for I_() and glib-i18n.h for
gettext macros.
|
|
|
|
| |
This avoids strdups.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, the wayland IM context sends zwp_text_input_v3.commit from
a number of places, and some of them with partial data. In order to
make client state updates "atomic" and complete, make the communication
happen over an unified notify_im_change() function that happens on
a narrower set of circumstances:
- The GtkIMContext is reset
- The GtkIMContext is just focused
- The gesture to invoke the OSK is triggered
- The IM context is reacting to changes coming from the compositor
Notably, setting the cursor location or the surrounding text do not try
to commit state on their own, and now will be flushed with the corresponding
IM update or reset. But also, these requests won't be prevented from
happening individually on serial mismatch, instead it will be the whole
state commit which is held off.
With these changes in place, all client-side updates are notified
atomically to the compositor under a single .commit request.
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5106
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5105
|
|
|
|
|
|
|
| |
If we get consecutive preedit string updates that announce a NULL
string, we still do end up issuing ::preedit-changed with those.
Ignore changes from NULL to NULL, it is the other combinations which
must issue this signal.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For reasons that only apply to the old serial handling, asking for
the surrounding after IM changes resulted in lazy handling of
commit() afterwards.
With the recent interpretation of serials, this problem became more
apparent, since it is in fact very likely that the last interaction
step after an IM change is notifying of the changed surrounding
text after the IM change was applied.
Make handling of surrounding text similar to caret position changes,
always commit() after the state change, but skip through non-changes.
This makes the compositor state fully up-to-date after an IM change.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The gesture as connected currently on the child GtkText is easily overridden
by the parent editables (and gently done so in the attempt to consume all
clicks).
Connect this gesture to the parent editable widget in these cases, so the
gesture can cohabit with the click-consuming one. It's not part of the same
group, but it won't be abruptly cancelled.
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4795
|
|\
| |
| |
| |
| |
| |
| | |
gtk/imwayland: Use serial to control outbound messages
Closes #3641
See merge request GNOME/gtk!4398
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Following the text-input protocol changes at
https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/115,
use the serial number to have the client push changes to the
zwp_text_input_v3 object only after compositor/client states match.
This specifically is more lenient to compositors pushing multiple
.done events ahead of the client replying to them.
Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3641
|
|/
|
|
|
|
|
|
| |
We were missing the surface offset (e.g. shadows) at the time of expressing
the text caret location in surface coordinates. Add this offset so the
coordinates are as expected by the compositor.
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4668
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Remember the current context on focus-in even though the text-input
isn't set up yet. This helps in the case where the text-input is not yet
created but a widget already got focused. Without that the enable()
invocation in text_input_enter() woulnd't be invoked leaving the input
method disabled.
This fixes
gtk4-demo --run=search_entry
which would initially not show the on-screen keyboard when e.g using
phoc/sway as compositor.
|
|
|
|
|
|
|
|
| |
We want this to take precedence in the wayland platform to other
modules that might be loaded via the IO extension point. None of
those is going to bode well in this platform.
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4443
|
|
|
|
|
|
|
|
| |
This reverts commit d84a028455cadbf146e4cd234f57dc1df2e69cd6.
IBus uses the same character now.
Fixes: #4123
|
|
|
|
| |
This helps with debugging.
|
|
|
|
|
|
| |
This was missing in the initial implementation since
GtkIMContext did not have it in its api, but it was
added now, so we can send the information.
|
|
|
|
|
|
| |
We don't want to hand out cursor positions based on
the original preedit text and then tweak the text to
be different.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
It should not matter, but it is the right thing to
do to limit the preedit attributes to the length
of the preedit text.
|
|
|
|
|
|
| |
Not doing so only invites hexboxes.
Fixes: #3678
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If multiple nested widgets have drag sources on them, both using bubble
phase, we need to reliably pick the inner one. Both of them will try to
start dragging, and we need to make sure there are no situations where the
outer widget starts drag earlier and cancels the inner one.
Currently, this can easily happen via integer rounding: start and current
coordinates passed into gtk_drag_check_threshold() are initially doubles
(other than in GtkNotebook and GtkIconView), and are casted to ints. Then
those rounded values are used to calculate deltas to compare to the drag
threshold, losing quite a lot of precision along the way, and often
resulting in the outer widget getting larger deltas.
To avoid it, just don't round it. Introduce a variant of the function that
operates on doubles: gtk_drag_check_threshold_double() and use it instead
of the original everywhere.
|
|
|
|
|
|
|
|
|
|
|
| |
In destruction paths of a focused entry, the IM context might first
end up detached from its widget, then destroyed. This currently prevents
the IM context from detaching itself from the GtkIMContextWaylandGlobal.
Make it do so when unsetting the client widget, so the IM context gets
properly unfocused before destruction.
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3176
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
In particular, it will NULL-ified the current global context if this is
the finalized one, avoiding dangling invalid pointers.
Would have been a cherry-pick from branch gtk-3-24 of commit
b592ded80ad4825d115317ba6750a086da0434c0, but files moved.
|
|
|
|
|
|
| |
Change gtk_widget_translate_coordinates and
gtk_native_get_surface_transform to operate
on doubles. Update all callers.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
(cherry-picked from commit d7fb15c822eabe22ffda19892153d69b0f4fc2f3)
|
|
|
|
|
| |
Clients may pass not `NULL`-terminated strings as the function takes a
`len` argument. Use that argument.
|
| |
|
|
|
|
|
| |
We should just use GdkEvent, instead of taking
a GdkEventKey, and then cast it everywhere.
|
|
|
|
|
|
| |
GtkIMContext get_preedit_string should return cursor position counted
in characters, but cursor_begin here is counted in bytes. This add the
missing conversion.
|
| |
|
|
|
|
|
| |
The name just made it hard for people to find the
right gesture to use.
|
|
|
|
| |
All uses of it can be replaced by gtk_widget_get_root.
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
Attach it to the GdkDisplay.
Also fixes -Wshadow complaining about "global" being shadowed.
|
|
|
|
|
|
|
|
|
| |
All built-in backend modules get a priority of 0 because they are the
default ones.
GtkIMContextSimple gets a priority of G_MININT because it's the fallback
one.
This mirrors the media modules code.
|
| |
|
|
|
|
| |
Hitting the limit will raise protocol errors.
|
|
|
|
|
| |
The various strings (pending/current preedit, surrounding, and commit
buffer) are being leaked in the case of GtkIMContext destruction.
|
| |
|
| |
|
|
|
|
| |
Before this patch, imwayland would assume that text-input enter and leave events follow the general (wl_keyboard) focus, and was unable to handle the situation where they would not be provided at the same time.
|
|
|
|
|
| |
There's not much we can do about the signal not being handled, but
we should fetch the return value anyway.
|