Skip to content

Conversation

cjc7373
Copy link

@cjc7373 cjc7373 commented Nov 3, 2023

This is a major refactor and not finished yet.. But it's workable under sway and I think it's time to get some feedback.

Basically we need to implement a Dispatch trait for every event. There's macro delegate_noop to ignore irrelevant events.

Also wayland-protocols-wlr and wayland-protocols-plasma crate offer the interfaces we need, so there's no need to generate some bindings manually.

poll.poll(&mut events, None).expect("Failed to poll fds");
for event in &events {
match event.token() {
STATE_CHANGE => {
Copy link
Author

Choose a reason for hiding this comment

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

I wonder why do we need to send heartbeat if some state changes? I personally want the watcher to ignore the fluctuations when I switch windows very quickly..

Copy link
Member

Choose a reason for hiding this comment

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

No need, it just makes the tracking more accurate. Essentially it makes the tracking almost perfect instead of approximate.
Considering how cheap it is to make a heartbeat, I found it to be a nice feature for barely any cost.

@2e3s
Copy link

2e3s commented Dec 7, 2023

I recommend that you implement this instead of kwin-idle
https://wayland.app/protocols/ext-idle-notify-v1
You could copy from https://github.com/2e3s/awatcher/blob/main/watchers/src/watchers/wl_ext_idle_notify.rs

@cjc7373
Copy link
Author

cjc7373 commented Dec 7, 2023

Sure, if this PR can be accepted, I definitely want to implement that.

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.

3 participants