element: Refactor remaining libcosmic elements for blur
This commit is contained in:
parent
6c76fdaa79
commit
db06770a6b
9 changed files with 444 additions and 142 deletions
|
|
@ -20,7 +20,7 @@ use cosmic::{
|
|||
use smithay::{
|
||||
backend::{
|
||||
input::{ButtonState, TouchSlot},
|
||||
renderer::{ImportMem, Renderer, element::memory::MemoryRenderBufferRenderElement},
|
||||
renderer::ImportMem,
|
||||
},
|
||||
desktop::space::SpaceElement,
|
||||
input::{
|
||||
|
|
@ -42,10 +42,11 @@ use smithay::{
|
|||
};
|
||||
|
||||
use crate::{
|
||||
backend::render::element::AsGlowRenderer,
|
||||
shell::{SeatExt, focus::target::PointerFocusTarget},
|
||||
state::State,
|
||||
utils::{
|
||||
iced::{IcedElement, Program},
|
||||
iced::{IcedElement, IcedRenderElement, Program},
|
||||
prelude::*,
|
||||
},
|
||||
};
|
||||
|
|
@ -68,9 +69,9 @@ impl MenuGrabState {
|
|||
&self,
|
||||
renderer: &mut R,
|
||||
output: &Output,
|
||||
push: &mut dyn FnMut(MemoryRenderBufferRenderElement<R>),
|
||||
push: &mut dyn FnMut(IcedRenderElement<R>),
|
||||
) where
|
||||
R: Renderer + ImportMem,
|
||||
R: AsGlowRenderer + ImportMem,
|
||||
R::TextureId: Send + Clone + 'static,
|
||||
{
|
||||
let scale = output.current_scale().fractional_scale();
|
||||
|
|
@ -83,7 +84,11 @@ impl MenuGrabState {
|
|||
.to_physical_precise_round(scale),
|
||||
scale.into(),
|
||||
1.0,
|
||||
elem.iced
|
||||
.with_theme(|theme| theme.cosmic().radius_s())
|
||||
.map(|x| x.round() as u8),
|
||||
push,
|
||||
None,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -274,11 +279,13 @@ impl Program for ContextMenu {
|
|||
let mut elements = grab_state.elements.lock().unwrap();
|
||||
|
||||
let position = elements.last().unwrap().position;
|
||||
let mut theme = state.common.theme.clone();
|
||||
theme.transparent = theme.cosmic().frosted_system_interface;
|
||||
let element = IcedElement::new(
|
||||
ContextMenu::new(items),
|
||||
Size::default(),
|
||||
state.common.event_loop_handle.clone(),
|
||||
state.common.theme.clone(),
|
||||
theme,
|
||||
);
|
||||
|
||||
let min_size = element.minimum_size();
|
||||
|
|
@ -474,7 +481,7 @@ impl Program for ContextMenu {
|
|||
.padding(1)
|
||||
.class(theme::Container::custom(|theme| {
|
||||
let cosmic = theme.cosmic();
|
||||
let component = &cosmic.background(false).component;
|
||||
let component = &cosmic.background(theme.cosmic().frosted_windows).component;
|
||||
iced_widget::container::Style {
|
||||
snap: true,
|
||||
icon_color: Some(cosmic.accent.base.into()),
|
||||
|
|
|
|||
|
|
@ -6,10 +6,7 @@ use crate::{
|
|||
},
|
||||
shell::{
|
||||
CosmicMapped, CosmicSurface, Direction, ManagedLayer,
|
||||
element::{
|
||||
CosmicMappedRenderElement,
|
||||
stack_hover::{StackHover, stack_hover},
|
||||
},
|
||||
element::{CosmicMappedRenderElement, stack_hover::StackHover},
|
||||
focus::target::{KeyboardFocusTarget, PointerFocusTarget},
|
||||
layout::floating::TiledCorners,
|
||||
},
|
||||
|
|
@ -25,7 +22,7 @@ use smithay::{
|
|||
drm::DrmNode,
|
||||
input::ButtonState,
|
||||
renderer::{
|
||||
ImportAll, ImportMem, Renderer,
|
||||
ImportAll, ImportMem,
|
||||
element::{RenderElement, utils::RescaleRenderElement},
|
||||
},
|
||||
},
|
||||
|
|
@ -78,7 +75,7 @@ impl MoveGrabState {
|
|||
scanout_node: Option<DrmNode>,
|
||||
push: &mut dyn FnMut(CosmicMappedRenderElement<R>),
|
||||
) where
|
||||
R: Renderer + ImportAll + ImportMem + AsGlowRenderer,
|
||||
R: AsGlowRenderer + ImportAll + ImportMem,
|
||||
R::TextureId: Send + Clone + 'static,
|
||||
CosmicMappedRenderElement<R>: RenderElement<R>,
|
||||
{
|
||||
|
|
@ -122,6 +119,7 @@ impl MoveGrabState {
|
|||
output_scale,
|
||||
1.0,
|
||||
&mut |elem| push(elem.into()),
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -441,7 +439,7 @@ impl MoveGrab {
|
|||
if let Some(indicator) =
|
||||
grab_state.stacking_indicator.as_ref().map(|x| &x.0)
|
||||
{
|
||||
indicator.output_enter(output, overlap);
|
||||
indicator.output_enter(output);
|
||||
}
|
||||
}
|
||||
} else if self.window_outputs.remove(output) {
|
||||
|
|
@ -455,16 +453,14 @@ impl MoveGrab {
|
|||
let indicator_location = shell.stacking_indicator(¤t_output, self.previous);
|
||||
if indicator_location.is_some() != grab_state.stacking_indicator.is_some() {
|
||||
grab_state.stacking_indicator = indicator_location.map(|geo| {
|
||||
let element = stack_hover(
|
||||
let size = geo.size.as_logical();
|
||||
let element = StackHover::new(
|
||||
state.common.event_loop_handle.clone(),
|
||||
geo.size.as_logical(),
|
||||
size,
|
||||
state.common.theme.clone(),
|
||||
);
|
||||
for output in &self.window_outputs {
|
||||
element.output_enter(
|
||||
output,
|
||||
Rectangle::from_size(output.geometry().size.as_logical()),
|
||||
);
|
||||
element.output_enter(output);
|
||||
}
|
||||
(element, geo.loc.as_logical())
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue