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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue