cargo fmt
This commit is contained in:
parent
43062c1754
commit
39de286d51
40 changed files with 1557 additions and 1080 deletions
|
|
@ -1,25 +1,23 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use crate::utils::prelude::*;
|
||||
use smithay::{
|
||||
desktop::{Kind, Window},
|
||||
reexports::{
|
||||
wayland_protocols::xdg::shell::server::xdg_toplevel,
|
||||
wayland_server::DisplayHandle,
|
||||
wayland_protocols::xdg::shell::server::xdg_toplevel, wayland_server::DisplayHandle,
|
||||
},
|
||||
utils::{IsAlive, Logical, Point, Size},
|
||||
wayland::{
|
||||
compositor::with_states,
|
||||
seat::{AxisFrame, PointerGrab, PointerGrabStartData, PointerInnerHandle, MotionEvent, ButtonEvent},
|
||||
seat::{
|
||||
AxisFrame, ButtonEvent, MotionEvent, PointerGrab, PointerGrabStartData,
|
||||
PointerInnerHandle,
|
||||
},
|
||||
shell::xdg::{SurfaceCachedState, ToplevelConfigure, XdgToplevelSurfaceRoleAttributes},
|
||||
Serial,
|
||||
},
|
||||
};
|
||||
use crate::utils::prelude::*;
|
||||
use std::{
|
||||
cell::RefCell,
|
||||
convert::TryFrom,
|
||||
sync::Mutex,
|
||||
};
|
||||
use std::{cell::RefCell, convert::TryFrom, sync::Mutex};
|
||||
|
||||
pub struct MoveSurfaceGrab {
|
||||
start_data: PointerGrabStartData,
|
||||
|
|
@ -32,15 +30,19 @@ impl PointerGrab<State> for MoveSurfaceGrab {
|
|||
fn motion(
|
||||
&mut self,
|
||||
data: &mut State,
|
||||
_dh: &DisplayHandle,
|
||||
handle: &mut PointerInnerHandle<'_, State>,
|
||||
event: &MotionEvent
|
||||
_dh: &DisplayHandle,
|
||||
handle: &mut PointerInnerHandle<'_, State>,
|
||||
event: &MotionEvent,
|
||||
) {
|
||||
// While the grab is active, no client has pointer focus
|
||||
handle.motion(event.location, None, event.serial, event.time);
|
||||
self.delta = event.location - self.start_data.location;
|
||||
|
||||
if let Some(workspace) = data.common.shell.space_for_surface_mut(self.window.toplevel().wl_surface()) {
|
||||
|
||||
if let Some(workspace) = data
|
||||
.common
|
||||
.shell
|
||||
.space_for_surface_mut(self.window.toplevel().wl_surface())
|
||||
{
|
||||
let new_location = (self.initial_window_location.to_f64() + self.delta).to_i32_round();
|
||||
workspace.space.map_window(&self.window, new_location, true);
|
||||
}
|
||||
|
|
@ -197,11 +199,10 @@ impl PointerGrab<State> for ResizeSurfaceGrab {
|
|||
new_window_height = (self.initial_window_size.h as f64 + dy) as i32;
|
||||
}
|
||||
|
||||
let (min_size, max_size) =
|
||||
with_states(self.window.toplevel().wl_surface(), |states| {
|
||||
let data = states.cached_state.current::<SurfaceCachedState>();
|
||||
(data.min_size, data.max_size)
|
||||
});
|
||||
let (min_size, max_size) = with_states(self.window.toplevel().wl_surface(), |states| {
|
||||
let data = states.cached_state.current::<SurfaceCachedState>();
|
||||
(data.min_size, data.max_size)
|
||||
});
|
||||
|
||||
let min_width = min_size.w.max(1);
|
||||
let min_height = min_size.h.max(1);
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use smithay::{
|
||||
desktop::{layer_map_for_output, Kind, Space, Window, space::RenderZindex},
|
||||
desktop::{layer_map_for_output, space::RenderZindex, Kind, Space, Window},
|
||||
reexports::wayland_protocols::xdg::shell::server::xdg_toplevel::{
|
||||
ResizeEdge, State as XdgState,
|
||||
},
|
||||
utils::IsAlive,
|
||||
wayland::{
|
||||
output::Output,
|
||||
seat::{PointerGrabStartData, Seat},
|
||||
Serial,
|
||||
},
|
||||
utils::IsAlive,
|
||||
};
|
||||
use std::collections::HashSet;
|
||||
|
||||
|
|
@ -30,12 +30,7 @@ impl FloatingLayout {
|
|||
Default::default()
|
||||
}
|
||||
|
||||
pub fn map_window(
|
||||
&mut self,
|
||||
space: &mut Space,
|
||||
window: Window,
|
||||
seat: &Seat<State>,
|
||||
) {
|
||||
pub fn map_window(&mut self, space: &mut Space, window: Window, seat: &Seat<State>) {
|
||||
if let Some(output) = super::output_from_seat(Some(seat), space) {
|
||||
self.map_window_internal(space, window, &output);
|
||||
} else {
|
||||
|
|
@ -53,12 +48,7 @@ impl FloatingLayout {
|
|||
// TODO make sure all windows are still visible on any output or move them
|
||||
}
|
||||
|
||||
fn map_window_internal(
|
||||
&mut self,
|
||||
space: &mut Space,
|
||||
window: Window,
|
||||
output: &Output
|
||||
) {
|
||||
fn map_window_internal(&mut self, space: &mut Space, window: Window, output: &Output) {
|
||||
let win_geo = window.bbox();
|
||||
let layers = layer_map_for_output(&output);
|
||||
let geometry = layers.non_exclusive_zone();
|
||||
|
|
|
|||
|
|
@ -1,15 +1,10 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use crate::{
|
||||
input::ActiveOutput,
|
||||
state::State,
|
||||
};
|
||||
use crate::{input::ActiveOutput, state::State};
|
||||
use smithay::{
|
||||
desktop::{Space, Window},
|
||||
wayland::{
|
||||
compositor::with_states,
|
||||
output::Output,
|
||||
seat::Seat,
|
||||
compositor::with_states, output::Output, seat::Seat,
|
||||
shell::xdg::XdgToplevelSurfaceRoleAttributes,
|
||||
},
|
||||
};
|
||||
|
|
@ -37,9 +32,7 @@ pub fn should_be_floating(window: &Window) -> bool {
|
|||
// simple heuristic taken from
|
||||
// sway/desktop/xdg_shell.c:188 @ 0ee54a52
|
||||
if attrs.parent.is_some()
|
||||
|| (attrs.min_size.w != 0
|
||||
&& attrs.min_size.h != 0
|
||||
&& attrs.min_size == attrs.max_size)
|
||||
|| (attrs.min_size.w != 0 && attrs.min_size.h != 0 && attrs.min_size == attrs.max_size)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,13 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use crate::{
|
||||
utils::prelude::*,
|
||||
shell::layout::Orientation,
|
||||
};
|
||||
use crate::{shell::layout::Orientation, utils::prelude::*};
|
||||
use atomic_float::AtomicF64;
|
||||
use smithay::{
|
||||
reexports::wayland_server::{
|
||||
DisplayHandle,
|
||||
},
|
||||
reexports::wayland_server::DisplayHandle,
|
||||
utils::{Logical, Size},
|
||||
wayland::seat::{AxisFrame, PointerGrab, PointerGrabStartData, PointerInnerHandle, MotionEvent, ButtonEvent},
|
||||
wayland::seat::{
|
||||
AxisFrame, ButtonEvent, MotionEvent, PointerGrab, PointerGrabStartData, PointerInnerHandle,
|
||||
},
|
||||
};
|
||||
use std::sync::{atomic::Ordering, Arc};
|
||||
|
||||
|
|
@ -26,9 +23,9 @@ impl PointerGrab<State> for ResizeForkGrab {
|
|||
fn motion(
|
||||
&mut self,
|
||||
_data: &mut State,
|
||||
_dh: &DisplayHandle,
|
||||
handle: &mut PointerInnerHandle<'_, State>,
|
||||
event: &MotionEvent
|
||||
_dh: &DisplayHandle,
|
||||
handle: &mut PointerInnerHandle<'_, State>,
|
||||
event: &MotionEvent,
|
||||
) {
|
||||
// While the grab is active, no client has pointer focus
|
||||
handle.motion(event.location, None, event.serial, event.time);
|
||||
|
|
@ -58,7 +55,8 @@ impl PointerGrab<State> for ResizeForkGrab {
|
|||
}
|
||||
}
|
||||
|
||||
fn axis(&mut self,
|
||||
fn axis(
|
||||
&mut self,
|
||||
_data: &mut State,
|
||||
_dh: &DisplayHandle,
|
||||
handle: &mut PointerInnerHandle<'_, State>,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use crate::{
|
||||
shell::{
|
||||
layout::Orientation,
|
||||
focus::FocusDirection,
|
||||
},
|
||||
shell::{focus::FocusDirection, layout::Orientation},
|
||||
utils::prelude::*,
|
||||
};
|
||||
|
||||
|
|
@ -187,7 +184,12 @@ impl TilingLayout {
|
|||
if let Some(root_id) = tree.root_node_id() {
|
||||
for node in tree.traverse_pre_order(root_id).unwrap() {
|
||||
if let Data::Window(window) = node.data() {
|
||||
self.map_window_internal(space, window, None, Option::<std::iter::Empty<&Window>>::None);
|
||||
self.map_window_internal(
|
||||
space,
|
||||
window,
|
||||
None,
|
||||
Option::<std::iter::Empty<&Window>>::None,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -274,7 +276,7 @@ impl TilingLayout {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fn active_tree<'a>(trees: &'a mut Vec<Tree<Data>>, output: usize) -> &'a mut Tree<Data> {
|
||||
while trees.len() <= output {
|
||||
trees.push(Tree::new())
|
||||
|
|
@ -558,11 +560,8 @@ impl TilingLayout {
|
|||
if let Some(geo) = geo {
|
||||
#[allow(irrefutable_let_patterns)]
|
||||
if let Kind::Xdg(xdg) = &window.toplevel() {
|
||||
if xdg
|
||||
.current_state()
|
||||
.states.contains(XdgState::Fullscreen)
|
||||
|| xdg
|
||||
.with_pending_state(|pending| {
|
||||
if xdg.current_state().states.contains(XdgState::Fullscreen)
|
||||
|| xdg.with_pending_state(|pending| {
|
||||
pending.states.contains(XdgState::Fullscreen)
|
||||
})
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue