Skip to content

Commit

Permalink
feat(sctk): define default icon color
Browse files Browse the repository at this point in the history
  • Loading branch information
mmstick committed Aug 30, 2023
1 parent 09a47eb commit 974c54c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
23 changes: 16 additions & 7 deletions sctk/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ where
configure.new_size.1 as f64,
);
}

}
}
LayerSurfaceEventVariant::ScaleFactorChanged(sf, viewport) => {
Expand Down Expand Up @@ -854,6 +854,7 @@ where
&mut renderer,
state.theme(),
&Style {
icon_color: state.icon_color(),
text_color: state.text_color(),
scale_factor: state.scale_factor(),
},
Expand Down Expand Up @@ -1012,10 +1013,11 @@ where
has_events || !native_events.is_empty();

let (interface_state, statuses) = {
let Some(user_interface) = interfaces
.get_mut(&surface_id.inner()) else {
continue;
};
let Some(user_interface) =
interfaces.get_mut(&surface_id.inner())
else {
continue;
};
user_interface.update(
native_events.as_slice(),
cursor_position,
Expand Down Expand Up @@ -1141,8 +1143,9 @@ where
Instant::now(),
),
);
let Some(user_interface) = interfaces
.get_mut(&surface_id.inner()) else {
let Some(user_interface) =
interfaces.get_mut(&surface_id.inner())
else {
continue;
};
let (interface_state, _) = user_interface.update(
Expand Down Expand Up @@ -1306,6 +1309,7 @@ where
&mut renderer,
state.theme(),
&Style {
icon_color: state.icon_color(),
text_color: state.text_color(),
scale_factor: state.scale_factor(),
},
Expand Down Expand Up @@ -1725,6 +1729,11 @@ where
self.appearance.background_color
}

/// Returns the current icon [`Color`] of the [`State`].
pub fn icon_color(&self) -> Color {
self.appearance.icon_color
}

/// Returns the current text [`Color`] of the [`State`].
pub fn text_color(&self) -> Color {
self.appearance.text_color
Expand Down
7 changes: 1 addition & 6 deletions sctk/src/event_loop/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ use sctk::{
},
registry::RegistryState,
seat::SeatState,
shell::{
wlr_layer::LayerShell,
xdg::XdgShell,
WaylandSurface,
},
shell::{wlr_layer::LayerShell, xdg::XdgShell, WaylandSurface},
shm::Shm,
};
#[cfg(feature = "a11y")]
Expand Down Expand Up @@ -680,7 +676,6 @@ where
let wl_surface = layer_surface.surface.wl_surface();

if let Some(mut prev_configure) = layer_surface.last_configure.clone() {

prev_configure.new_size = (width.unwrap_or(prev_configure.new_size.0), width.unwrap_or(prev_configure.new_size.1));
sticky_exit_callback(
IcedSctkEvent::SctkEvent(SctkEvent::LayerSurfaceEvent { variant: LayerSurfaceEventVariant::Configure(prev_configure, wl_surface.clone(), false), id: wl_surface.clone()}),
Expand Down

0 comments on commit 974c54c

Please sign in to comment.