Open wusyong opened 2 years ago
There is no clipboard
implementations in winit.
There is no global-shortcut
implementations in winit, too.
clipboard will be replaced with arboard
and globalShortcut
will be replaced with DeviceEvents
clipboard will be replaced with
arboard
andglobalShortcut
will be replaced withDeviceEvent
Happy to hear that and is there any plan to merge tao
to winit
?
That's the idea Amr and Yu-Wei are creating PRs at winit non-stop to get stuff we need implemented in winit so that we hopefully can switch at some point.
clipboard will be replaced with
arboard
andglobalShortcut
will be replaced withDeviceEvents
I'm testing DeviceEvents
on Windows as compared to a native implementation using RegisterHotKey
as is performed by tao and sadly the results with DeviceEvents
are inferior for the following reasons:
DeviceEvents
seems to only send an event when a key is released, not when a key is pressedRegisterHotKey
which is noticable in useDeviceEvents
doesn't take over the original shortcut like RegisterHotKey
does; for example if I bind Volume Up with RegisterHotKey
, I will no longer see the original volume slider as my app completely overrides it, with DeviceEvents
the original action from the OS is still performed in addition to our owndevice_event_filter
to DeviceEventFilter::Never
will now also process all other device events including any keybord presses and mouse movements which is much less efficient than capturing a particular set of hotkeysPerhaps it may be worth evaluating these differences on Windows and reconsidering this?
Cheers Fotis
DeviceEvents
seems to only send an event when a key is released, not when a key is pressed- Even when releasing the key as fast as I can, I see at least a 50ms difference between seeing the event registered with
RegisterHotKey
which is noticable in use
There is two separate events, Pressed
and Released
, I can see both so please double-check that otherwise it is a bug.
DeviceEvents
doesn't take over the original shortcut likeRegisterHotKey
does; for example if I bind Volume Up withRegisterHotKey
, I will no longer see the original volume slider as my app completely overrides it, withDeviceEvents
the original action from the OS is still performed in addition to our own
I am aware of that, and I think it is a fair trade off for the flexibility of device events
- Setting the
device_event_filter
toDeviceEventFilter::Never
will now also process all other device events including any keybord presses and mouse movements which is much less efficient than capturing a particular set of hotkeys
That is true and might be a good reason to stick with the current implementation especially since handling these events resulted in a slower webview rendering in WRY.
Perhaps it may be worth evaluating these differences on Windows and reconsidering this?
Nothing is set in stone yet so thanks for your feedback.
DeviceEvents
seems to only send an event when a key is released, not when a key is pressed- Even when releasing the key as fast as I can, I see at least a 50ms difference between seeing the event registered with
RegisterHotKey
which is noticable in useThere is two separate events,
Pressed
andReleased
, I can see both so please double-check that otherwise it is a bug.
Ah I didn't realise this was a bug and I do see that it was fixed on a slightly newer revision than I'm using so this is likely due to an older version of winit on my end 😄
DeviceEvents
doesn't take over the original shortcut likeRegisterHotKey
does; for example if I bind Volume Up withRegisterHotKey
, I will no longer see the original volume slider as my app completely overrides it, withDeviceEvents
the original action from the OS is still performed in addition to our ownI am aware of that, and I think it is a fair trade off for the flexibility of device events
Totally understand. I think there are use cases for both. For example, I'm building a volume control app which needs to take over the volume keys. However in most cases, this won't be needed.
Appreciate the reply Fotis
Linux platform's WindowEvent::ModifiersChanged(state)
in inconsistent with winit.
winit maintains the ModifiersState for me.
for tao I have to maintain the state my self with some hacky code like this
...(&mut self, state: ModifiersState) {
if state.is_empty() {
self.modifiers = state;
} else if state.shift_key() {
self.modifiers.set(ModifiersState::SHIFT, state.shift_key());
} else if state.control_key() {
self.modifiers
.set(ModifiersState::CONTROL, state.control_key());
} else if state.alt_key() {
self.modifiers.set(ModifiersState::ALT, state.alt_key());
} else if state.super_key() {
self.modifiers.set(ModifiersState::SUPER, state.super_key());
}
log::trace!("modifer changed {:?}", self.modifiers);
}```
our current key handling was just a merge of new-keyboard branch from winit which winit plans to roll out soon in https://github.com/rust-windowing/winit/pull/2662
Amr Bashir @.***> writes:
our current key handling was just a merge of new-keyboard branch from winit which winit plans to roll out soon in https://github.com/rust-windowing/winit/pull/2662
Good to know. Thanks.
This is an issue to track which PR or commit we add that's not in winit yet. We should either add to winit too or adjust the behavior in tao, so they are consistent.
Transparent Windows don't work unless we draw to the window surface https://github.com/rust-windowing/winit/issues/2502, usesoftbuffer
to clear the window surface[ALL] https://github.com/tauri-apps/tao/commit/c0d5a5307cd6625622989ef529f3189967f3a76f -REJECTED: usemonitor_from_point
available_monitors()
and compare bounds with the point.cursor_position
- https://github.com/rust-windowing/winit/pull/2648nextResponder
inkey_down
openURL
,openFile
,openFiles
WS_CLIPCHILDREN
- https://github.com/rust-windowing/winit/pull/3212