Skip to content

Renamed DeviceEventFilter to DeviceEvents - #2700

Merged
kchibisov merged 5 commits into
rust-windowing:masterfrom
Toniman575:event-filter
May 30, 2023
Merged

kchibisov merged 5 commits into
rust-windowing:masterfrom
Toniman575:event-filter

Conversation

@Toniman575

@Toniman575 Toniman575 commented Feb 26, 2023 •

Copy link
Copy Markdown
Contributor
  • Tested on all platforms changed
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality
  • Updated feature matrix, if new features were added or implemented

Renamed EventLoopWindowTarget::set_device_event_filter to EventLoopWindowTarget::listen_device_events and DeviceEventFilter to DeviceEvents and appropriately reversed its variants according to #2591 (comment).

Could only test it on Linux.

Fixes #2591.

@madsmtm madsmtm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

Blocked on #2710

Comment thread src/event_loop.rs Resolved
Comment thread src/event_loop.rs Resolved
Comment thread src/platform_impl/linux/mod.rs Outdated

#[inline]
pub fn set_device_event_filter(&self, _filter: DeviceEventFilter) {
pub fn listen_device_events(&self, _filter: DeviceEvents) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should be set_ something ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think in this file that makes sense as it doesn't conflict with other function names.
Happy to change it if a maintainer thinks otherwise.

Comment thread src/platform_impl/linux/x11/mod.rs Resolved
Comment thread src/event_loop.rs Resolved
@daxpedda daxpedda added the DS - x11 Affects the X11 backend, or generally free Unix platforms label May 28, 2023
@Toniman575

Copy link
Copy Markdown
Contributor Author

rebased

Comment thread src/event_loop.rs Outdated
impl<T: fmt::Debug> error::Error for EventLoopClosed<T> {}

/// Filter controlling the propagation of device events.
/// Controlling when device events are captured.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
/// Controlling when device events are captured.
/// Control when device events are captured.

Comment thread CHANGELOG.md
Comment on lines 9 to 10
# Unreleased
- **Breaking** Renamed `EventLoopWindowTarget::set_device_event_filter` to `EventLoopWindowTarget::listen_device_events` and `DeviceEventFilter` to `DeviceEvents` and appropriately reversed its variants.
- On X11, fix `EventLoopWindowTarget::listen_device_events` effect being reversed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
# Unreleased
- **Breaking** Renamed `EventLoopWindowTarget::set_device_event_filter` to `EventLoopWindowTarget::listen_device_events` and `DeviceEventFilter` to `DeviceEvents` and appropriately reversed its variants.
- On X11, fix `EventLoopWindowTarget::listen_device_events` effect being reversed.
# Unreleased
- **Breaking** Rename `DeviceEventFilter` to `DeviceEvents` reversing the behavior of variants.
- **Breaking** Rename `EventLoopWindowTarget::set_device_event_filter` to `listen_device_events`.
- On X11, fix `EventLoopWindowTarget::listen_device_events` effect being reversed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ensure that there's no empty line with the `Breaking below and there's one empty line to section heading.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The line is too long, I've suggested the splitting in the suggested change but it's ignored.

Comment thread src/event_loop.rs Resolved
Comment thread src/platform_impl/linux/x11/mod.rs Outdated
Comment on lines 580 to 584
let filter_events = self.device_events.get() == DeviceEvents::Never
|| (self.device_events.get() == DeviceEvents::WhenFocused && !focus);

let mut mask = 0;
if !filter_events {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you reverse all of that to Always and remove filter word all together?

@Toniman575 Toniman575 May 30, 2023 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What do you mean revert all of that to Always?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So we don't have to !filter_events? It would be let device_events = self.device_events.get() == DeviceEvents::Always || (focus && self.device.events.get() == DeviceEvents::WhenFocused) and then if device_events.

Remove all mentions of `filter` in documentation and function parameters.
Brought documentation language more in line with the rest of the documentation.
Comment thread src/platform_impl/linux/x11/mod.rs Resolved
@kchibisov
kchibisov merged commit 8bb004a into rust-windowing:master May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DS - x11 Affects the X11 backend, or generally free Unix platforms I - BREAKING CHANGE

Development

Successfully merging this pull request may close these issues.

DeviceEventFilter works differently on X11 and Windows

6 participants