cargo fmt
This commit is contained in:
parent
5e9ea93819
commit
b6c5d00bec
17 changed files with 264 additions and 277 deletions
5
build.rs
5
build.rs
|
|
@ -2,10 +2,7 @@
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
if let Ok(output) = Command::new("git")
|
if let Ok(output) = Command::new("git").args(["rev-parse", "HEAD"]).output() {
|
||||||
.args(["rev-parse", "HEAD"])
|
|
||||||
.output()
|
|
||||||
{
|
|
||||||
let git_hash = String::from_utf8(output.stdout).unwrap();
|
let git_hash = String::from_utf8(output.stdout).unwrap();
|
||||||
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
|
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -141,9 +141,7 @@ impl Timings {
|
||||||
if let Some(frame) = self.pending_frame.as_mut() {
|
if let Some(frame) = self.pending_frame.as_mut() {
|
||||||
frame.render_duration_draw = Some(
|
frame.render_duration_draw = Some(
|
||||||
Time::elapsed(&frame.render_start, clock.now())
|
Time::elapsed(&frame.render_start, clock.now())
|
||||||
- frame
|
- frame.render_duration_elements.unwrap_or(Duration::ZERO),
|
||||||
.render_duration_elements
|
|
||||||
.unwrap_or(Duration::ZERO),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -773,223 +773,208 @@ where
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
render_input_order::<()>(
|
render_input_order::<()>(&shell, output, previous, current, element_filter, |stage| {
|
||||||
&shell,
|
match stage {
|
||||||
output,
|
Stage::ZoomUI => {
|
||||||
previous,
|
elements.extend(ZoomState::render(renderer, output));
|
||||||
current,
|
}
|
||||||
element_filter,
|
Stage::SessionLock(lock_surface) => {
|
||||||
|stage| {
|
elements.extend(
|
||||||
match stage {
|
session_lock_elements(renderer, output, lock_surface)
|
||||||
Stage::ZoomUI => {
|
|
||||||
elements.extend(ZoomState::render(renderer, output));
|
|
||||||
}
|
|
||||||
Stage::SessionLock(lock_surface) => {
|
|
||||||
elements.extend(
|
|
||||||
session_lock_elements(renderer, output, lock_surface)
|
|
||||||
.into_iter()
|
|
||||||
.map(Into::into)
|
|
||||||
.flat_map(crop_to_output)
|
|
||||||
.map(Into::into),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Stage::LayerPopup {
|
|
||||||
popup, location, ..
|
|
||||||
} => {
|
|
||||||
elements.extend(
|
|
||||||
render_elements_from_surface_tree::<_, WorkspaceRenderElement<_>>(
|
|
||||||
renderer,
|
|
||||||
popup.wl_surface(),
|
|
||||||
location
|
|
||||||
.to_local(output)
|
|
||||||
.as_logical()
|
|
||||||
.to_physical_precise_round(scale),
|
|
||||||
Scale::from(scale),
|
|
||||||
1.0,
|
|
||||||
FRAME_TIME_FILTER,
|
|
||||||
)
|
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.flat_map(crop_to_output)
|
|
||||||
.map(Into::into),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Stage::LayerSurface { layer, location } => {
|
|
||||||
elements.extend(
|
|
||||||
render_elements_from_surface_tree::<_, WorkspaceRenderElement<_>>(
|
|
||||||
renderer,
|
|
||||||
layer.wl_surface(),
|
|
||||||
location
|
|
||||||
.to_local(output)
|
|
||||||
.as_logical()
|
|
||||||
.to_physical_precise_round(scale),
|
|
||||||
Scale::from(scale),
|
|
||||||
1.0,
|
|
||||||
FRAME_TIME_FILTER,
|
|
||||||
)
|
|
||||||
.into_iter()
|
|
||||||
.flat_map(crop_to_output)
|
|
||||||
.map(Into::into),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Stage::OverrideRedirect { surface, location } => {
|
|
||||||
elements.extend(surface.wl_surface().into_iter().flat_map(|surface| {
|
|
||||||
render_elements_from_surface_tree::<_, WorkspaceRenderElement<_>>(
|
|
||||||
renderer,
|
|
||||||
&surface,
|
|
||||||
location
|
|
||||||
.to_local(output)
|
|
||||||
.as_logical()
|
|
||||||
.to_physical_precise_round(scale),
|
|
||||||
Scale::from(scale),
|
|
||||||
1.0,
|
|
||||||
FRAME_TIME_FILTER,
|
|
||||||
)
|
|
||||||
.into_iter()
|
|
||||||
.flat_map(crop_to_output)
|
|
||||||
.map(Into::into)
|
.map(Into::into)
|
||||||
}));
|
.flat_map(crop_to_output)
|
||||||
}
|
.map(Into::into),
|
||||||
Stage::StickyPopups(layout) => {
|
);
|
||||||
let alpha = match &overview.0 {
|
}
|
||||||
OverviewMode::Started(_, started) => {
|
Stage::LayerPopup {
|
||||||
(1.0 - (Instant::now().duration_since(*started).as_millis()
|
popup, location, ..
|
||||||
/ ANIMATION_DURATION.as_millis())
|
} => {
|
||||||
as f32)
|
elements.extend(
|
||||||
.max(0.0)
|
render_elements_from_surface_tree::<_, WorkspaceRenderElement<_>>(
|
||||||
* 0.4
|
renderer,
|
||||||
+ 0.6
|
popup.wl_surface(),
|
||||||
}
|
location
|
||||||
OverviewMode::Ended(_, ended) => {
|
.to_local(output)
|
||||||
((Instant::now().duration_since(*ended).as_millis()
|
.as_logical()
|
||||||
/ ANIMATION_DURATION.as_millis())
|
.to_physical_precise_round(scale),
|
||||||
as f32)
|
Scale::from(scale),
|
||||||
* 0.4
|
1.0,
|
||||||
+ 0.6
|
FRAME_TIME_FILTER,
|
||||||
}
|
|
||||||
OverviewMode::Active(_) => 0.6,
|
|
||||||
OverviewMode::None => 1.0,
|
|
||||||
};
|
|
||||||
|
|
||||||
elements.extend(
|
|
||||||
layout
|
|
||||||
.render_popups(renderer, alpha)
|
|
||||||
.into_iter()
|
|
||||||
.map(Into::into)
|
|
||||||
.flat_map(crop_to_output)
|
|
||||||
.map(Into::into),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Stage::Sticky(layout) => {
|
|
||||||
let alpha = match &overview.0 {
|
|
||||||
OverviewMode::Started(_, started) => {
|
|
||||||
(1.0 - (Instant::now().duration_since(*started).as_millis()
|
|
||||||
/ ANIMATION_DURATION.as_millis())
|
|
||||||
as f32)
|
|
||||||
.max(0.0)
|
|
||||||
* 0.4
|
|
||||||
+ 0.6
|
|
||||||
}
|
|
||||||
OverviewMode::Ended(_, ended) => {
|
|
||||||
((Instant::now().duration_since(*ended).as_millis()
|
|
||||||
/ ANIMATION_DURATION.as_millis())
|
|
||||||
as f32)
|
|
||||||
* 0.4
|
|
||||||
+ 0.6
|
|
||||||
}
|
|
||||||
OverviewMode::Active(_) => 0.6,
|
|
||||||
OverviewMode::None => 1.0,
|
|
||||||
};
|
|
||||||
|
|
||||||
let current_focus = (!move_active && is_active_space)
|
|
||||||
.then_some(last_active_seat)
|
|
||||||
.map(|seat| workspace.focus_stack.get(seat));
|
|
||||||
|
|
||||||
elements.extend(
|
|
||||||
layout
|
|
||||||
.render(
|
|
||||||
renderer,
|
|
||||||
current_focus.as_ref().and_then(|stack| {
|
|
||||||
stack.last().and_then(|t| match t {
|
|
||||||
FocusTarget::Window(w) => Some(w),
|
|
||||||
_ => None,
|
|
||||||
})
|
|
||||||
}),
|
|
||||||
resize_indicator.clone(),
|
|
||||||
active_hint,
|
|
||||||
alpha,
|
|
||||||
theme.cosmic(),
|
|
||||||
)
|
|
||||||
.into_iter()
|
|
||||||
.map(Into::into)
|
|
||||||
.flat_map(crop_to_output)
|
|
||||||
.map(Into::into),
|
|
||||||
)
|
)
|
||||||
}
|
.into_iter()
|
||||||
Stage::WorkspacePopups { workspace, offset } => {
|
.flat_map(crop_to_output)
|
||||||
elements.extend(
|
.map(Into::into),
|
||||||
match workspace.render_popups(
|
);
|
||||||
|
}
|
||||||
|
Stage::LayerSurface { layer, location } => {
|
||||||
|
elements.extend(
|
||||||
|
render_elements_from_surface_tree::<_, WorkspaceRenderElement<_>>(
|
||||||
|
renderer,
|
||||||
|
layer.wl_surface(),
|
||||||
|
location
|
||||||
|
.to_local(output)
|
||||||
|
.as_logical()
|
||||||
|
.to_physical_precise_round(scale),
|
||||||
|
Scale::from(scale),
|
||||||
|
1.0,
|
||||||
|
FRAME_TIME_FILTER,
|
||||||
|
)
|
||||||
|
.into_iter()
|
||||||
|
.flat_map(crop_to_output)
|
||||||
|
.map(Into::into),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Stage::OverrideRedirect { surface, location } => {
|
||||||
|
elements.extend(surface.wl_surface().into_iter().flat_map(|surface| {
|
||||||
|
render_elements_from_surface_tree::<_, WorkspaceRenderElement<_>>(
|
||||||
|
renderer,
|
||||||
|
&surface,
|
||||||
|
location
|
||||||
|
.to_local(output)
|
||||||
|
.as_logical()
|
||||||
|
.to_physical_precise_round(scale),
|
||||||
|
Scale::from(scale),
|
||||||
|
1.0,
|
||||||
|
FRAME_TIME_FILTER,
|
||||||
|
)
|
||||||
|
.into_iter()
|
||||||
|
.flat_map(crop_to_output)
|
||||||
|
.map(Into::into)
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
Stage::StickyPopups(layout) => {
|
||||||
|
let alpha = match &overview.0 {
|
||||||
|
OverviewMode::Started(_, started) => {
|
||||||
|
(1.0 - (Instant::now().duration_since(*started).as_millis()
|
||||||
|
/ ANIMATION_DURATION.as_millis()) as f32)
|
||||||
|
.max(0.0)
|
||||||
|
* 0.4
|
||||||
|
+ 0.6
|
||||||
|
}
|
||||||
|
OverviewMode::Ended(_, ended) => {
|
||||||
|
((Instant::now().duration_since(*ended).as_millis()
|
||||||
|
/ ANIMATION_DURATION.as_millis()) as f32)
|
||||||
|
* 0.4
|
||||||
|
+ 0.6
|
||||||
|
}
|
||||||
|
OverviewMode::Active(_) => 0.6,
|
||||||
|
OverviewMode::None => 1.0,
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.extend(
|
||||||
|
layout
|
||||||
|
.render_popups(renderer, alpha)
|
||||||
|
.into_iter()
|
||||||
|
.map(Into::into)
|
||||||
|
.flat_map(crop_to_output)
|
||||||
|
.map(Into::into),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Stage::Sticky(layout) => {
|
||||||
|
let alpha = match &overview.0 {
|
||||||
|
OverviewMode::Started(_, started) => {
|
||||||
|
(1.0 - (Instant::now().duration_since(*started).as_millis()
|
||||||
|
/ ANIMATION_DURATION.as_millis()) as f32)
|
||||||
|
.max(0.0)
|
||||||
|
* 0.4
|
||||||
|
+ 0.6
|
||||||
|
}
|
||||||
|
OverviewMode::Ended(_, ended) => {
|
||||||
|
((Instant::now().duration_since(*ended).as_millis()
|
||||||
|
/ ANIMATION_DURATION.as_millis()) as f32)
|
||||||
|
* 0.4
|
||||||
|
+ 0.6
|
||||||
|
}
|
||||||
|
OverviewMode::Active(_) => 0.6,
|
||||||
|
OverviewMode::None => 1.0,
|
||||||
|
};
|
||||||
|
|
||||||
|
let current_focus = (!move_active && is_active_space)
|
||||||
|
.then_some(last_active_seat)
|
||||||
|
.map(|seat| workspace.focus_stack.get(seat));
|
||||||
|
|
||||||
|
elements.extend(
|
||||||
|
layout
|
||||||
|
.render(
|
||||||
renderer,
|
renderer,
|
||||||
last_active_seat,
|
current_focus.as_ref().and_then(|stack| {
|
||||||
!move_active && is_active_space,
|
stack.last().and_then(|t| match t {
|
||||||
overview.clone(),
|
FocusTarget::Window(w) => Some(w),
|
||||||
theme.cosmic(),
|
_ => None,
|
||||||
) {
|
})
|
||||||
Ok(elements) => {
|
}),
|
||||||
elements
|
|
||||||
.into_iter()
|
|
||||||
.flat_map(crop_to_output)
|
|
||||||
.map(|element| {
|
|
||||||
CosmicElement::Workspace(
|
|
||||||
RelocateRenderElement::from_element(
|
|
||||||
element,
|
|
||||||
offset.to_physical_precise_round(scale),
|
|
||||||
Relocate::Relative,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
Err(_) => {
|
|
||||||
return ControlFlow::Break(Err(OutputNoMode));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Stage::Workspace { workspace, offset } => {
|
|
||||||
elements.extend(
|
|
||||||
match workspace.render(
|
|
||||||
renderer,
|
|
||||||
last_active_seat,
|
|
||||||
!move_active && is_active_space,
|
|
||||||
overview.clone(),
|
|
||||||
resize_indicator.clone(),
|
resize_indicator.clone(),
|
||||||
active_hint,
|
active_hint,
|
||||||
|
alpha,
|
||||||
theme.cosmic(),
|
theme.cosmic(),
|
||||||
) {
|
)
|
||||||
Ok(elements) => {
|
.into_iter()
|
||||||
elements
|
.map(Into::into)
|
||||||
.into_iter()
|
.flat_map(crop_to_output)
|
||||||
.flat_map(crop_to_output)
|
.map(Into::into),
|
||||||
.map(|element| {
|
)
|
||||||
CosmicElement::Workspace(
|
}
|
||||||
RelocateRenderElement::from_element(
|
Stage::WorkspacePopups { workspace, offset } => {
|
||||||
element,
|
elements.extend(
|
||||||
offset.to_physical_precise_round(scale),
|
match workspace.render_popups(
|
||||||
Relocate::Relative,
|
renderer,
|
||||||
),
|
last_active_seat,
|
||||||
)
|
!move_active && is_active_space,
|
||||||
})
|
overview.clone(),
|
||||||
}
|
theme.cosmic(),
|
||||||
Err(_) => {
|
) {
|
||||||
return ControlFlow::Break(Err(OutputNoMode));
|
Ok(elements) => {
|
||||||
}
|
elements
|
||||||
},
|
.into_iter()
|
||||||
);
|
.flat_map(crop_to_output)
|
||||||
}
|
.map(|element| {
|
||||||
};
|
CosmicElement::Workspace(RelocateRenderElement::from_element(
|
||||||
|
element,
|
||||||
|
offset.to_physical_precise_round(scale),
|
||||||
|
Relocate::Relative,
|
||||||
|
))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Err(_) => {
|
||||||
|
return ControlFlow::Break(Err(OutputNoMode));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Stage::Workspace { workspace, offset } => {
|
||||||
|
elements.extend(
|
||||||
|
match workspace.render(
|
||||||
|
renderer,
|
||||||
|
last_active_seat,
|
||||||
|
!move_active && is_active_space,
|
||||||
|
overview.clone(),
|
||||||
|
resize_indicator.clone(),
|
||||||
|
active_hint,
|
||||||
|
theme.cosmic(),
|
||||||
|
) {
|
||||||
|
Ok(elements) => {
|
||||||
|
elements
|
||||||
|
.into_iter()
|
||||||
|
.flat_map(crop_to_output)
|
||||||
|
.map(|element| {
|
||||||
|
CosmicElement::Workspace(RelocateRenderElement::from_element(
|
||||||
|
element,
|
||||||
|
offset.to_physical_precise_round(scale),
|
||||||
|
Relocate::Relative,
|
||||||
|
))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Err(_) => {
|
||||||
|
return ControlFlow::Break(Err(OutputNoMode));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
ControlFlow::Continue(())
|
ControlFlow::Continue(())
|
||||||
},
|
})?;
|
||||||
)?;
|
|
||||||
|
|
||||||
Ok(elements)
|
Ok(elements)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,9 @@ pub fn get_config<'a, T: 'a, F: Fn(&'a InputConfig) -> Option<T>>(
|
||||||
) -> Option<(T, bool)> {
|
) -> Option<(T, bool)> {
|
||||||
if let Some(setting) = device_config.and_then(&f) {
|
if let Some(setting) = device_config.and_then(&f) {
|
||||||
Some((setting, false))
|
Some((setting, false))
|
||||||
} else { f(default_config).map(|setting| (setting, true)) }
|
} else {
|
||||||
|
f(default_config).map(|setting| (setting, true))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn config_set_error<T: std::fmt::Debug>(
|
fn config_set_error<T: std::fmt::Debug>(
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,6 @@ pub fn init(evlh: &LoopHandle<'static, State>) -> Result<Vec<RegistrationToken>>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
calloop::channel::Event::Closed => (),
|
calloop::channel::Event::Closed => (),
|
||||||
})
|
})
|
||||||
|
|
|
||||||
10
src/main.rs
10
src/main.rs
|
|
@ -80,10 +80,12 @@ impl State {
|
||||||
command.envs(
|
command.envs(
|
||||||
session::get_env(&self.common).expect("WAYLAND_DISPLAY should be valid UTF-8"),
|
session::get_env(&self.common).expect("WAYLAND_DISPLAY should be valid UTF-8"),
|
||||||
);
|
);
|
||||||
unsafe { command.pre_exec(|| {
|
unsafe {
|
||||||
utils::rlimit::restore_nofile_limit();
|
command.pre_exec(|| {
|
||||||
Ok(())
|
utils::rlimit::restore_nofile_limit();
|
||||||
}) };
|
Ok(())
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
info!("Running {:?}", exec);
|
info!("Running {:?}", exec);
|
||||||
command
|
command
|
||||||
|
|
|
||||||
|
|
@ -804,11 +804,15 @@ impl PointerTarget<State> for CosmicWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn axis(&self, seat: &Seat<State>, data: &mut State, frame: AxisFrame) {
|
fn axis(&self, seat: &Seat<State>, data: &mut State, frame: AxisFrame) {
|
||||||
if let Some(Focus::Header) = self.0.with_program(|p| p.current_focus()) { PointerTarget::axis(&self.0, seat, data, frame) }
|
if let Some(Focus::Header) = self.0.with_program(|p| p.current_focus()) {
|
||||||
|
PointerTarget::axis(&self.0, seat, data, frame)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn frame(&self, seat: &Seat<State>, data: &mut State) {
|
fn frame(&self, seat: &Seat<State>, data: &mut State) {
|
||||||
if let Some(Focus::Header) = self.0.with_program(|p| p.current_focus()) { PointerTarget::frame(&self.0, seat, data) }
|
if let Some(Focus::Header) = self.0.with_program(|p| p.current_focus()) {
|
||||||
|
PointerTarget::frame(&self.0, seat, data)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn leave(&self, seat: &Seat<State>, data: &mut State, serial: Serial, time: u32) {
|
fn leave(&self, seat: &Seat<State>, data: &mut State, serial: Serial, time: u32) {
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,8 @@ fn next_workspace(
|
||||||
shell
|
shell
|
||||||
.workspaces
|
.workspaces
|
||||||
.spaces_for_output(&output)
|
.spaces_for_output(&output)
|
||||||
.skip_while(|space| space.handle != current_handle).nth(1)
|
.skip_while(|space| space.handle != current_handle)
|
||||||
|
.nth(1)
|
||||||
.map(|space| (current_handle, space.handle))
|
.map(|space| (current_handle, space.handle))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -962,45 +962,35 @@ impl MenuAlignment {
|
||||||
AxisAlignment::Centered,
|
AxisAlignment::Centered,
|
||||||
)
|
)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.chain(
|
.chain(for_alignment(
|
||||||
for_alignment(
|
position,
|
||||||
position,
|
size,
|
||||||
size,
|
AxisAlignment::Centered,
|
||||||
AxisAlignment::Centered,
|
AxisAlignment::Corner(0),
|
||||||
AxisAlignment::Corner(0),
|
))
|
||||||
),
|
.chain(for_alignment(
|
||||||
)
|
position,
|
||||||
.chain(
|
size,
|
||||||
for_alignment(
|
AxisAlignment::Corner(0),
|
||||||
position,
|
AxisAlignment::Centered,
|
||||||
size,
|
))
|
||||||
AxisAlignment::Corner(0),
|
.chain(for_alignment(
|
||||||
AxisAlignment::Centered,
|
position,
|
||||||
),
|
size,
|
||||||
)
|
AxisAlignment::Corner(0),
|
||||||
.chain(
|
AxisAlignment::Corner(0),
|
||||||
for_alignment(
|
))
|
||||||
position,
|
|
||||||
size,
|
|
||||||
AxisAlignment::Corner(0),
|
|
||||||
AxisAlignment::Corner(0),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.collect(),
|
.collect(),
|
||||||
(AxisAlignment::PreferCentered, y) => {
|
(AxisAlignment::PreferCentered, y) => {
|
||||||
for_alignment(position, size, AxisAlignment::Centered, y)
|
for_alignment(position, size, AxisAlignment::Centered, y)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.chain(
|
.chain(for_alignment(position, size, AxisAlignment::Corner(0), y))
|
||||||
for_alignment(position, size, AxisAlignment::Corner(0), y),
|
|
||||||
)
|
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
(x, AxisAlignment::PreferCentered) => {
|
(x, AxisAlignment::PreferCentered) => {
|
||||||
for_alignment(position, size, x, AxisAlignment::Centered)
|
for_alignment(position, size, x, AxisAlignment::Centered)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.chain(
|
.chain(for_alignment(position, size, x, AxisAlignment::Corner(0)))
|
||||||
for_alignment(position, size, x, AxisAlignment::Corner(0)),
|
|
||||||
)
|
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,8 @@ impl MoveGrabState {
|
||||||
if output
|
if output
|
||||||
.geometry()
|
.geometry()
|
||||||
.as_logical()
|
.as_logical()
|
||||||
.intersection(window_geo).is_none()
|
.intersection(window_geo)
|
||||||
|
.is_none()
|
||||||
{
|
{
|
||||||
return Vec::new();
|
return Vec::new();
|
||||||
}
|
}
|
||||||
|
|
@ -113,8 +114,8 @@ impl MoveGrabState {
|
||||||
.corner_radius(window_geo.size, self.indicator_thickness);
|
.corner_radius(window_geo.size, self.indicator_thickness);
|
||||||
|
|
||||||
let focus_element = if self.indicator_thickness > 0 {
|
let focus_element = if self.indicator_thickness > 0 {
|
||||||
Some(
|
Some(CosmicMappedRenderElement::from(
|
||||||
CosmicMappedRenderElement::from(IndicatorShader::focus_element(
|
IndicatorShader::focus_element(
|
||||||
renderer,
|
renderer,
|
||||||
Key::Window(Usage::MoveGrabIndicator, self.window.key()),
|
Key::Window(Usage::MoveGrabIndicator, self.window.key()),
|
||||||
Rectangle::new(
|
Rectangle::new(
|
||||||
|
|
@ -135,8 +136,8 @@ impl MoveGrabState {
|
||||||
active_window_hint.green,
|
active_window_hint.green,
|
||||||
active_window_hint.blue,
|
active_window_hint.blue,
|
||||||
],
|
],
|
||||||
)),
|
),
|
||||||
)
|
))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
@ -435,8 +436,7 @@ impl MoveGrab {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let indicator_location =
|
let indicator_location = shell.stacking_indicator(¤t_output, self.previous);
|
||||||
shell.stacking_indicator(¤t_output, self.previous);
|
|
||||||
if indicator_location.is_some() != grab_state.stacking_indicator.is_some() {
|
if indicator_location.is_some() != grab_state.stacking_indicator.is_some() {
|
||||||
grab_state.stacking_indicator = indicator_location.map(|geo| {
|
grab_state.stacking_indicator = indicator_location.map(|geo| {
|
||||||
let element = stack_hover(
|
let element = stack_hover(
|
||||||
|
|
|
||||||
|
|
@ -535,7 +535,9 @@ impl TouchGrab<State> for ResizeForkGrab {
|
||||||
event: &TouchMotionEvent,
|
event: &TouchMotionEvent,
|
||||||
seq: Serial,
|
seq: Serial,
|
||||||
) {
|
) {
|
||||||
if event.slot == <Self as TouchGrab<State>>::start_data(self).slot && self.update_location(data, event.location, false) {
|
if event.slot == <Self as TouchGrab<State>>::start_data(self).slot
|
||||||
|
&& self.update_location(data, event.location, false)
|
||||||
|
{
|
||||||
handle.unset_grab(self, data);
|
handle.unset_grab(self, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
10
src/state.rs
10
src/state.rs
|
|
@ -336,9 +336,7 @@ impl BackendData {
|
||||||
) -> Result<Option<DrmNode>, anyhow::Error> {
|
) -> Result<Option<DrmNode>, anyhow::Error> {
|
||||||
match self {
|
match self {
|
||||||
BackendData::Kms(state) => {
|
BackendData::Kms(state) => {
|
||||||
return state
|
return state.dmabuf_imported(client, global, dmabuf).map(Some);
|
||||||
.dmabuf_imported(client, global, dmabuf)
|
|
||||||
.map(Some);
|
|
||||||
}
|
}
|
||||||
BackendData::Winit(state) => {
|
BackendData::Winit(state) => {
|
||||||
state.backend.renderer().import_dmabuf(&dmabuf, None)?;
|
state.backend.renderer().import_dmabuf(&dmabuf, None)?;
|
||||||
|
|
@ -574,12 +572,14 @@ impl From<DrmNode> for KmsNodes {
|
||||||
|
|
||||||
pub fn client_has_no_security_context(client: &Client) -> bool {
|
pub fn client_has_no_security_context(client: &Client) -> bool {
|
||||||
client
|
client
|
||||||
.get_data::<ClientState>().is_none_or(|client_state| client_state.security_context.is_none())
|
.get_data::<ClientState>()
|
||||||
|
.is_none_or(|client_state| client_state.security_context.is_none())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn client_is_privileged(client: &Client) -> bool {
|
pub fn client_is_privileged(client: &Client) -> bool {
|
||||||
client
|
client
|
||||||
.get_data::<ClientState>().is_some_and(|client_state| client_state.privileged)
|
.get_data::<ClientState>()
|
||||||
|
.is_some_and(|client_state| client_state.privileged)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn enable_wayland_security() -> bool {
|
fn enable_wayland_security() -> bool {
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,11 @@ impl BufferHandler for State {
|
||||||
fn buffer_destroyed(&mut self, buffer: &WlBuffer) {
|
fn buffer_destroyed(&mut self, buffer: &WlBuffer) {
|
||||||
if let BackendData::Kms(kms_state) = &mut self.backend {
|
if let BackendData::Kms(kms_state) = &mut self.backend {
|
||||||
for device in kms_state.drm_devices.values_mut() {
|
for device in kms_state.drm_devices.values_mut() {
|
||||||
if device.inner.active_buffers.remove(&buffer.downgrade()) && !device
|
if device.inner.active_buffers.remove(&buffer.downgrade())
|
||||||
|
&& !device
|
||||||
.inner
|
.inner
|
||||||
.in_use(kms_state.primary_node.read().unwrap().as_ref()) {
|
.in_use(kms_state.primary_node.read().unwrap().as_ref())
|
||||||
|
{
|
||||||
if let Err(err) = kms_state.refresh_used_devices() {
|
if let Err(err) = kms_state.refresh_used_devices() {
|
||||||
warn!(?err, "Failed to init devices.");
|
warn!(?err, "Failed to init devices.");
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,8 @@ impl PointerConstraintsHandler for State {
|
||||||
fn new_constraint(&mut self, surface: &WlSurface, pointer: &PointerHandle<Self>) {
|
fn new_constraint(&mut self, surface: &WlSurface, pointer: &PointerHandle<Self>) {
|
||||||
// XXX region
|
// XXX region
|
||||||
if pointer
|
if pointer
|
||||||
.current_focus().is_some_and(|x| x.wl_surface().as_deref() == Some(surface))
|
.current_focus()
|
||||||
|
.is_some_and(|x| x.wl_surface().as_deref() == Some(surface))
|
||||||
{
|
{
|
||||||
with_pointer_constraint(surface, pointer, |constraint| {
|
with_pointer_constraint(surface, pointer, |constraint| {
|
||||||
constraint.unwrap().activate();
|
constraint.unwrap().activate();
|
||||||
|
|
|
||||||
|
|
@ -304,9 +304,11 @@ impl XdgShellHandler for State {
|
||||||
if should_focus {
|
if should_focus {
|
||||||
Shell::set_focus(self, Some(&target), &seat, None, true);
|
Shell::set_focus(self, Some(&target), &seat, None, true);
|
||||||
}
|
}
|
||||||
} else if let Some(pending) = shell.pending_windows.iter_mut().find(|pending| {
|
} else if let Some(pending) = shell
|
||||||
pending.surface.wl_surface().as_deref() == Some(surface.wl_surface())
|
.pending_windows
|
||||||
}) {
|
.iter_mut()
|
||||||
|
.find(|pending| pending.surface.wl_surface().as_deref() == Some(surface.wl_surface()))
|
||||||
|
{
|
||||||
pending.fullscreen.take();
|
pending.fullscreen.take();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,8 @@ mod handlers;
|
||||||
pub fn head_is_enabled(output: &Output) -> bool {
|
pub fn head_is_enabled(output: &Output) -> bool {
|
||||||
output
|
output
|
||||||
.user_data()
|
.user_data()
|
||||||
.get::<OutputState>().is_some_and(|inner| inner.lock().unwrap().enabled)
|
.get::<OutputState>()
|
||||||
|
.is_some_and(|inner| inner.lock().unwrap().enabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
||||||
|
|
@ -800,7 +800,9 @@ where
|
||||||
_dhandle: &DisplayHandle,
|
_dhandle: &DisplayHandle,
|
||||||
data_init: &mut DataInit<'_, D>,
|
data_init: &mut DataInit<'_, D>,
|
||||||
) {
|
) {
|
||||||
if let ext_image_copy_capture_cursor_session_v1::Request::GetCaptureSession { session } = request {
|
if let ext_image_copy_capture_cursor_session_v1::Request::GetCaptureSession { session } =
|
||||||
|
request
|
||||||
|
{
|
||||||
let new_data = CursorSessionData {
|
let new_data = CursorSessionData {
|
||||||
inner: data.inner.clone(),
|
inner: data.inner.clone(),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue