Skip to content

Commit

Permalink
feat: forward unfocus event
Browse files Browse the repository at this point in the history
  • Loading branch information
Decodetalkers committed Dec 20, 2024
1 parent 9583658 commit bf96071
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions iced_layershell/src/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ pub fn window_event(
keyboard::Event::ModifiersChanged(keymap::modifiers(*new_modifiers)),
)),
LayerShellEvent::Unfocus => Some(IcedEvent::Window(iced::window::Event::Unfocused)),
LayerShellEvent::Focused => Some(IcedEvent::Window(iced::window::Event::Focused)),
_ => None,
}
}
Expand Down
2 changes: 2 additions & 0 deletions iced_layershell/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ pub enum WindowEvent {
is_synthetic: bool,
},
Unfocus,
Focused,
ModifiersChanged(ModifiersState),
Axis {
x: f32,
Expand Down Expand Up @@ -207,6 +208,7 @@ impl<Message: 'static> From<&DispatchMessage> for IcedLayerEvent<Message> {
is_synthetic: *is_synthetic,
}),
DispatchMessage::Unfocus => IcedLayerEvent::Window(WindowEvent::Unfocus),
DispatchMessage::Focused(_) => IcedLayerEvent::Window(WindowEvent::Focused),
DispatchMessage::ModifiersChanged(modifiers) => {
IcedLayerEvent::Window(WindowEvent::ModifiersChanged(*modifiers))
}
Expand Down
1 change: 1 addition & 0 deletions iced_sessionlock/src/multi_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ async fn run_instance<A, E, C>(
iced_core::Event::Window(window::Event::RedrawRequested(Instant::now()));
let cursor = window.state.cursor();

events.push((Some(id), redraw_event.clone()));
ui.update(
&[redraw_event.clone()],
cursor,
Expand Down
3 changes: 3 additions & 0 deletions layershellev/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ pub(crate) enum DispatchMessageInner {
},

ModifiersChanged(ModifiersState),
Focused(Id),
Unfocus,
KeyboardInput {
event: KeyEvent,
Expand Down Expand Up @@ -315,6 +316,7 @@ pub enum DispatchMessage {
x: f64,
y: f64,
},
Focused(Id),
Unfocus,
/// Keyboard ModifiersChanged.
ModifiersChanged(ModifiersState),
Expand Down Expand Up @@ -440,6 +442,7 @@ impl From<DispatchMessageInner> for DispatchMessage {
vertical,
source,
},
DispatchMessageInner::Focused(id) => DispatchMessage::Focused(id),
DispatchMessageInner::Unfocus => DispatchMessage::Unfocus,
DispatchMessageInner::ModifiersChanged(modifier) => {
DispatchMessage::ModifiersChanged(modifier)
Expand Down
5 changes: 5 additions & 0 deletions layershellev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1561,6 +1561,11 @@ impl<T> Dispatch<wl_pointer::WlPointer, ()> for WindowState<T> {
surface_y,
},
));
if let Some(id) = surface_id {
state
.message
.push((Some(id), DispatchMessageInner::Focused(id)));
}
}
wl_pointer::Event::Motion {
time,
Expand Down

0 comments on commit bf96071

Please sign in to comment.