Skip to content

Commit

Permalink
feat: bump version to 0.9.4-rc3
Browse files Browse the repository at this point in the history
add scale information to axis event
  • Loading branch information
Decodetalkers committed Oct 22, 2024
1 parent 52a88f6 commit 8293dcd
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 32 deletions.
30 changes: 15 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ authors = [
"Aakash Sen Sharma <[email protected]>",
]
edition = "2021"
version = "0.9.4-rc2"
version = "0.9.4-rc3"
license = "MIT"
repository = "https://github.com/waycrate/exwlshelleventloop"
description = "Wayland extra shell lib"
keywords = ["wayland", "wlroots"]
readme = "README.md"

[workspace.dependencies]
layershellev = { version = "0.9.4-rc2", path = "./layershellev" }
sessionlockev = { version = "0.9.4-rc2", path = "./sessionlockev" }

iced_layershell = { version = "0.9.4-rc2", path = "./iced_layershell" }
iced_layershell_macros = { version = "0.9.4-rc2", path = "./iced_layershell_macros" }
iced_sessionlock = { version = "0.9.4-rc2", path = "./iced_sessionlock" }
iced_sessionlock_macros = { version = "0.9.4-rc2", path = "./iced_sessionlock_macros" }
waycrate_xkbkeycode = { version = "0.9.4-rc2", path = "./waycrate_xkbkeycode" }
layershellev = { version = "0.9.4-rc3", path = "./layershellev" }
sessionlockev = { version = "0.9.4-rc3", path = "./sessionlockev" }

iced_layershell = { version = "0.9.4-rc3", path = "./iced_layershell" }
iced_layershell_macros = { version = "0.9.4-rc3", path = "./iced_layershell_macros" }
iced_sessionlock = { version = "0.9.4-rc3", path = "./iced_sessionlock" }
iced_sessionlock_macros = { version = "0.9.4-rc3", path = "./iced_sessionlock_macros" }
waycrate_xkbkeycode = { version = "0.9.4-rc3", path = "./waycrate_xkbkeycode" }

tempfile = "3.13.0"
thiserror = "1.0.64"
Expand Down
9 changes: 5 additions & 4 deletions iced_layershell/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ impl<Message: 'static, INFO: Clone> From<&DispatchMessage> for IcedLayerEvent<Me
DispatchMessage::Axis {
horizontal,
vertical,
scale,
..
} => {
if horizontal.stop && vertical.stop {
Expand All @@ -223,13 +224,13 @@ impl<Message: 'static, INFO: Clone> From<&DispatchMessage> for IcedLayerEvent<Me
let has_scroll = vertical.discrete != 0 || horizontal.discrete != 0;
if has_scroll {
return IcedLayerEvent::Window(WindowEvent::Axis {
x: -horizontal.discrete as f32,
y: -vertical.discrete as f32,
x: (-horizontal.discrete as f64 * scale) as f32,
y: (-vertical.discrete as f64 * scale) as f32,
});
}
IcedLayerEvent::Window(WindowEvent::PixelDelta {
x: -horizontal.absolute as f32,
y: -vertical.absolute as f32,
x: (-horizontal.absolute * scale) as f32,
y: (-vertical.absolute * scale) as f32,
})
}
}
Expand Down
9 changes: 5 additions & 4 deletions iced_sessionlock/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ impl<Message: 'static> From<&DispatchMessage> for IcedSessionLockEvent<Message>
DispatchMessage::Axis {
horizontal,
vertical,
scale,
..
} => {
if horizontal.stop && vertical.stop {
Expand All @@ -200,13 +201,13 @@ impl<Message: 'static> From<&DispatchMessage> for IcedSessionLockEvent<Message>
let has_scroll = vertical.discrete != 0 || horizontal.discrete != 0;
if has_scroll {
return IcedSessionLockEvent::Window(WindowEvent::Axis {
x: -horizontal.discrete as f32,
y: -vertical.discrete as f32,
x: (-horizontal.discrete as f64 * scale) as f32,
y: (-vertical.discrete as f64 * scale) as f32,
});
}
IcedSessionLockEvent::Window(WindowEvent::PixelDelta {
x: -horizontal.absolute as f32,
y: -vertical.absolute as f32,
x: (-horizontal.absolute * scale) as f32,
y: (-vertical.absolute * scale) as f32,
})
}
}
Expand Down
4 changes: 4 additions & 0 deletions layershellev/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ pub(crate) enum DispatchMessageInner {
},
Axis {
time: u32,
scale: f64,
horizontal: AxisScroll,
vertical: AxisScroll,
source: Option<wl_pointer::AxisSource>,
Expand Down Expand Up @@ -277,6 +278,7 @@ pub enum DispatchMessage {
/// About the scroll
Axis {
time: u32,
scale: f64,
horizontal: AxisScroll,
vertical: AxisScroll,
source: Option<wl_pointer::AxisSource>,
Expand Down Expand Up @@ -411,11 +413,13 @@ impl From<DispatchMessageInner> for DispatchMessage {
},
DispatchMessageInner::Axis {
time,
scale,
horizontal,
vertical,
source,
} => DispatchMessage::Axis {
time,
scale,
horizontal,
vertical,
source,
Expand Down
9 changes: 9 additions & 0 deletions layershellev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1357,6 +1357,11 @@ impl<T> Dispatch<wl_pointer::WlPointer, ()> for WindowState<T> {
_conn: &Connection,
_qhandle: &wayland_client::QueueHandle<Self>,
) {
let scale = state
.surface_id()
.and_then(|id| state.get_unit_with_id(id))
.map(|unit| unit.scale_float())
.unwrap_or(1.0);
match event {
wl_pointer::Event::Axis { time, axis, value } => match axis {
WEnum::Value(axis) => {
Expand All @@ -1375,6 +1380,7 @@ impl<T> Dispatch<wl_pointer::WlPointer, ()> for WindowState<T> {
state.surface_id(),
DispatchMessageInner::Axis {
time,
scale,
horizontal,
vertical,
source: None,
Expand All @@ -1399,6 +1405,7 @@ impl<T> Dispatch<wl_pointer::WlPointer, ()> for WindowState<T> {
state.surface_id(),
DispatchMessageInner::Axis {
time,
scale,
horizontal,
vertical,
source: None,
Expand All @@ -1416,6 +1423,7 @@ impl<T> Dispatch<wl_pointer::WlPointer, ()> for WindowState<T> {
DispatchMessageInner::Axis {
horizontal: AxisScroll::default(),
vertical: AxisScroll::default(),
scale,
source: Some(source),
time: 0,
},
Expand Down Expand Up @@ -1443,6 +1451,7 @@ impl<T> Dispatch<wl_pointer::WlPointer, ()> for WindowState<T> {
state.surface_id(),
DispatchMessageInner::Axis {
time: 0,
scale,
horizontal,
vertical,
source: None,
Expand Down
4 changes: 4 additions & 0 deletions sessionlockev/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ pub(crate) enum DispatchMessageInner {
},
Axis {
time: u32,
scale: f64,
horizontal: AxisScroll,
vertical: AxisScroll,
source: Option<wl_pointer::AxisSource>,
Expand Down Expand Up @@ -208,6 +209,7 @@ pub enum DispatchMessage {
/// About the scroll
Axis {
time: u32,
scale: f64,
horizontal: AxisScroll,
vertical: AxisScroll,
source: Option<wl_pointer::AxisSource>,
Expand Down Expand Up @@ -353,11 +355,13 @@ impl From<DispatchMessageInner> for DispatchMessage {
},
DispatchMessageInner::Axis {
time,
scale,
horizontal,
vertical,
source,
} => DispatchMessage::Axis {
time,
scale,
horizontal,
vertical,
source,
Expand Down
9 changes: 9 additions & 0 deletions sessionlockev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,11 @@ impl<T> Dispatch<wl_pointer::WlPointer, ()> for WindowState<T> {
_conn: &Connection,
_qhandle: &wayland_client::QueueHandle<Self>,
) {
let scale = state
.surface_id()
.and_then(|id| state.get_unit_with_id(id))
.map(|unit| unit.scale_float())
.unwrap_or(1.0);
match event {
wl_pointer::Event::Axis { time, axis, value } => match axis {
WEnum::Value(axis) => {
Expand All @@ -879,6 +884,7 @@ impl<T> Dispatch<wl_pointer::WlPointer, ()> for WindowState<T> {
state.surface_id(),
DispatchMessageInner::Axis {
time,
scale,
horizontal,
vertical,
source: None,
Expand All @@ -903,6 +909,7 @@ impl<T> Dispatch<wl_pointer::WlPointer, ()> for WindowState<T> {
state.surface_id(),
DispatchMessageInner::Axis {
time,
scale,
horizontal,
vertical,
source: None,
Expand All @@ -922,6 +929,7 @@ impl<T> Dispatch<wl_pointer::WlPointer, ()> for WindowState<T> {
vertical: AxisScroll::default(),
source: Some(source),
time: 0,
scale,
},
)),
WEnum::Unknown(unknown) => {
Expand All @@ -947,6 +955,7 @@ impl<T> Dispatch<wl_pointer::WlPointer, ()> for WindowState<T> {
state.surface_id(),
DispatchMessageInner::Axis {
time: 0,
scale,
horizontal,
vertical,
source: None,
Expand Down

0 comments on commit 8293dcd

Please sign in to comment.