-
Notifications
You must be signed in to change notification settings - Fork 207
Add xx_input_method_v1 support. #1745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
To test:
|
This is an implementation of https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/407 |
Lookng at CI failures, I need some help understanding what they are. For example, this code wasn't even touched by my change.
There's also the ack_configure callback which is for some reason exposed to the compositor, but I don't really understand why, so I couldn't come up with a sensible doc comment. |
I think that's a result of the earlier warning. Because certain methods are never used, the variables that are read only in those methods are never read. |
Added repositioning:
Screencast_20250524_202116.webm |
335ccb6
to
9497a8f
Compare
I did some cleanups:
Is there anything I can do to make reviewing this easier? |
src/desktop/wayland/popup/mod.rs
Outdated
match *self { | ||
PopupKind::Xdg(ref t) => t.send_popup_done(), | ||
PopupKind::InputMethod(_) => {} //Nothing to do the IME takes care of this itself | ||
PopupKind::InputMethodV3(_) => {} //Nothing to do the IME takes care of this itself |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be useful as a way to communicate that the compositor closed the popup? Or is it redundant since normally that would follow from a deactivate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was nothing to do previously since there was no concept of how the popup should function. But you are free to add that now if it is needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the only time the compositor closes the popup is in deactivate, so I decided there's no need for another notification. Would one be useful?
run these on your branch and correct them btw: |
LGTM otherwise, someone that knows xdg positioner should probably have a look at the positioner and popup part |
The only thing left that breaks ci is the ack_configure which I have no idea what to do with. |
Just add documentation to this function:
|
Well that's the problem, I don't have a clue what it's meant to do :P I copy-pasted it without understanding and I hope a reviewer can enlighten me. |
4baf615
to
06f09b3
Compare
a0ba0f8
to
ba9616e
Compare
This now relies only on published protocols now that experimental is out. |
pub(crate) input_method_handle: input_method::InputMethodHandle, | ||
pub(crate) input_method_v3_handle: input_method_v3::InputMethodHandle, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't have two input methods at once. Including using different protocols. Maybe it would make sense if these were grouped together into a single enum?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this works, because those are slots for input methods that may be filled in at any time. See a couple lines below:
if !data.input_method_handle.has_instance() && !data.input_method_v3_handle.has_instance() {
The instance for either may not be present, and because the Option
is rather deeply nested (even behind a mutex each), there's no way to turn it into an enum.
I don't remember why it is so, but I do remember originally not liking it and exposing the Option directly. Eventually I just had to copy the same design in v3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually having two at once should be just fine, it depends on how it is used but functionally there really isn't any problem. Though I have only tested it locally, so take my word for it ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would even go so far as to say that several input method instances is a wanted feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you had to input methods clients though, won't both try to create a popup at the same time, and potentially insert text in response to the same input?
I don't know if there's really a way with the design of this protocol (any version) to have reasonable behavior with multiple input method engines running at once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO multiple input methods only work with handover of the protocol. But handover is outside of scope for this, so this MR doesn't allow multiple input method clients.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not really be a problem, as long as one has a one-to-one relationship between text-input client and input method client. Input method 1 would have a list [ti1, ti2, t3] and input method 2 [t3, t4, t5]. We can make sure they never overlap in the compositor. Also about the popup, each IME should just own their popup. There is nothing really needed in the protocol to support this, just remove the part that allows only one. I would make a POC if life wasn't in the way currently, maybe in 6 months.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I get the problem, if v2 and v3 don't have a way to separate which IME own which text input then double input methods are definitely a problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually only one input method are allowed in the system. So we only process the first request of creating input method?
abaea9b
to
5c40b3a
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1745 +/- ##
==========================================
- Coverage 18.89% 18.05% -0.85%
==========================================
Files 176 181 +5
Lines 27672 28543 +871
==========================================
- Hits 5230 5154 -76
- Misses 22442 23389 +947
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Rebased. |
Experimental protocol version from July 2025, including popup.
Rebased again. |
where | ||
D: Dispatch<ZwpTextInputV3, TextInputUserData>, | ||
D: SeatHandler, | ||
//D: input_method_v3::InputMethodHandler, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So why it is here?
Implements https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/407
Notably missing: repositioning, reactivity of the popup.EDIT: this replaces the previous input method for now, so I made it a draft instead.