smithay icon indicating copy to clipboard operation
smithay copied to clipboard

Add xx_input_method_v1 support.

Open dcz-self opened this issue 6 months ago • 8 comments

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.~~

dcz-self avatar May 23 '25 09:05 dcz-self

To test:

  • stiwri from "popup" branch https://codeberg.org/dcz/stiwri/src/branch/popup
# in anvil
cargo run --release -- --winit &
WAYLAND_DISPLAY=wayland-1 yad &
# in stiwri
WAYLAND_DISPLAY=wayland-1 cargo run --release --bin im_popup

dcz-self avatar May 23 '25 09:05 dcz-self

This is an implementation of https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/407

dcz-self avatar May 23 '25 09:05 dcz-self

Lookng at CI failures, I need some help understanding what they are.

For example, this code wasn't even touched by my change.

  error: fields `popup_geometry_callback`, `new_popup`, and `popup_repositioned` are never read
     --> src/wayland/input_method/input_method_handle.rs:172:16

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.

dcz-self avatar May 23 '25 09:05 dcz-self

For example, this code wasn't even touched by my change.

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.

ids1024 avatar May 23 '25 15:05 ids1024

Added repositioning:

WAYLAND_DISPLAY=wayland-1 cargo run --release --bin im_popup_reposition

Screencast_20250524_202116.webm

dcz-self avatar May 25 '25 09:05 dcz-self

I did some cleanups:

  • lints, except the ack_configure which I don't understand
  • both input methods are supported and working

Is there anything I can do to make reviewing this easier?

dcz-self avatar May 25 '25 13:05 dcz-self

run these on your branch and correct them btw: cargo clippy --features "test_all_features" -- -D warnings cargo fmt --all -- --check cargo hack check --each-feature --no-dev-deps --exclude-features use_bindgen

rano-oss avatar Jun 11 '25 14:06 rano-oss

LGTM otherwise, someone that knows xdg positioner should probably have a look at the positioner and popup part

rano-oss avatar Jun 11 '25 16:06 rano-oss

The only thing left that breaks ci is the ack_configure which I have no idea what to do with.

dcz-self avatar Jun 19 '25 08:06 dcz-self

Just add documentation to this function:

error: missing documentation for a method
   --> src/wayland/input_method_v3/mod.rs:131:5
    |
131 | /     fn popup_ack_configure(
132 | |         &mut self,
133 | |         _surface: &WlSurface,
134 | |         _serial: Serial,
135 | |         _client_state: PopupSurfaceState,
136 | |     ) {
    | |_____^
    |
    = note: `-D missing-docs` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(missing_docs)]`

rano-oss avatar Jun 19 '25 19:06 rano-oss

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.

dcz-self avatar Jun 19 '25 19:06 dcz-self

This now relies only on published protocols now that experimental is out.

dcz-self avatar Jul 30 '25 07:07 dcz-self

Codecov Report

:x: Patch coverage is 2.17654% with 809 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 18.05%. Comparing base (ec35248) to head (5c40b3a). :warning: Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
src/wayland/input_method_v3/positioner.rs 0.00% 242 Missing :warning:
src/wayland/input_method_v3/input_method_handle.rs 0.00% 190 Missing :warning:
...land/input_method_v3/input_method_popup_surface.rs 0.00% 188 Missing :warning:
src/wayland/input_method_v3/mod.rs 21.25% 63 Missing :warning:
anvil/src/state.rs 2.43% 40 Missing :warning:
src/wayland/input_method_v3/configure_tracker.rs 0.00% 24 Missing :warning:
src/wayland/text_input/text_input_handle.rs 0.00% 19 Missing :warning:
anvil/src/shell/mod.rs 0.00% 13 Missing :warning:
src/wayland/seat/keyboard.rs 0.00% 11 Missing :warning:
src/desktop/wayland/popup/mod.rs 0.00% 9 Missing :warning:
... and 2 more
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     
Flag Coverage Δ
wlcs-buffer ?
wlcs-core 15.70% <2.17%> (-0.43%) :arrow_down:
wlcs-output 6.70% <2.17%> (-0.15%) :arrow_down:
wlcs-pointer-input 17.38% <2.17%> (-0.47%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov-commenter avatar Aug 14 '25 08:08 codecov-commenter

Rebased.

dcz-self avatar Aug 14 '25 08:08 dcz-self

Rebased again.

dcz-self avatar Aug 14 '25 17:08 dcz-self

Fixed the last problem, fixed conflict.

dcz-self avatar Oct 16 '25 15:10 dcz-self