Skip to content
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

Clean up IME handling code #599

Merged
merged 5 commits into from
Sep 23, 2024
Merged

Clean up IME handling code #599

merged 5 commits into from
Sep 23, 2024

Conversation

PoignardAzur
Copy link
Contributor

Should fix the way repaints were requested every paint on some platforms.

This PR unfortunately comes with a lack of tests. TestHarness currently doesn't have good support for testing signals, but even if it did, this is an inherently visual feature that we don't really have a way to test visually.

I don't know how to trigger IME on my machine. (I'm using PopOS, a Debian variant.) If someone wants to either test this or help me get to speed, I'd appreciate it.

@PoignardAzur
Copy link
Contributor Author

I just realized Textbox never actually calls register_as_text_input. Oops.

This is yet one more thing I'd like to test, but expressing it in a test is kinda awkward.

@DJMcNab
Copy link
Member

DJMcNab commented Sep 23, 2024

I'll review when that is fixed.

@PoignardAzur
Copy link
Contributor Author

Should be fixed, but I haven't tested it locally.

Copy link
Member

@DJMcNab DJMcNab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm seeing this work. One thing I am running into is that to_do_list is extremely laggy, but that's still the case before this PR.

@@ -598,6 +593,21 @@ impl RenderRoot {
}
}

impl RenderRootSignal {
pub(crate) fn ime_moved(area: Rect) -> Self {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename this to from_ime_area or similar?

ime_moved reads like a variant, but the capitalisation is wrong. Alternatively, could we just make ImeMoved take a Rect.

Comment on lines 246 to 252
let was_ime_active = root.state.is_ime_active;
let is_ime_active = if let Some(id) = next_focused {
root.widget_arena.get_state(id).item.is_text_input
} else {
false
};
root.state.is_ime_active = is_ime_active;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this outside the below check?

pub(crate) is_portal: bool,

/// Tracks whether widget is eligible for IME events.
/// Should be immutable after `WidgetAdded` event.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? I mean I realise that there is no way to unset this, but are there scenarios where we'd want this to change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically I'd like to be able to write our logic with the assumption that things like "is this focusable", "is this text-editable", etc, are immutable properties of a widget and don't need to be re-checked after creation.

@PoignardAzur PoignardAzur added this pull request to the merge queue Sep 23, 2024
Merged via the queue into main with commit ecc9468 Sep 23, 2024
17 checks passed
@PoignardAzur PoignardAzur deleted the ime_stuff branch September 23, 2024 17:20
tomcur added a commit to tomcur/xilem that referenced this pull request Sep 27, 2024
github-merge-queue bot pushed a commit that referenced this pull request Sep 27, 2024
`WidgetState::merge_up` no longer actually mutates `child_state` since
#488 and
#599, but it may do so again in
the future.

See also this Zulip thread:

https://xi.zulipchat.com/#narrow/stream/317477-masonry/topic/WidgetState.3A.3Amerge_up.20no.20longer.20needs.20mutable.20child.20state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants