deps: update for new smithay version

This commit is contained in:
Victoria Brekenfeld 2022-03-16 20:05:24 +01:00
parent 1ab0196502
commit 25b44fde58
11 changed files with 230 additions and 237 deletions

View file

@ -6,7 +6,7 @@ use smithay::{
wayland_protocols::xdg_shell::server::xdg_toplevel,
wayland_server::protocol::{wl_pointer::ButtonState, wl_surface},
},
utils::{Logical, Point, Rectangle, Size},
utils::{Logical, Point, Size},
wayland::{
compositor::with_states,
seat::{AxisFrame, PointerGrab, PointerGrabStartData, PointerInnerHandle},
@ -306,10 +306,9 @@ impl ResizeSurfaceGrab {
start_data: PointerGrabStartData,
window: Window,
edges: xdg_toplevel::ResizeEdge,
initial_window_geometry: Rectangle<i32, Logical>,
initial_window_location: Point<i32, Logical>,
initial_window_size: Size<i32, Logical>,
) -> ResizeSurfaceGrab {
let (initial_window_location, initial_window_size) =
(initial_window_geometry.loc, initial_window_geometry.size);
let resize_state = ResizeState::Resizing(ResizeData {
edges: edges.into(),
initial_window_location,
@ -393,7 +392,8 @@ impl ResizeSurfaceGrab {
pub fn apply_resize_state(
window: &Window,
geometry: Rectangle<i32, Logical>,
mut location: Point<i32, Logical>,
size: Size<i32, Logical>,
) -> Option<Point<i32, Logical>> {
let mut new_location = None;
@ -413,15 +413,13 @@ impl ResizeSurfaceGrab {
} = resize_data;
if edges.intersects(ResizeEdge::TOP_LEFT) {
let mut location = geometry.loc;
if edges.intersects(ResizeEdge::LEFT) {
location.x = initial_window_location.x
+ (initial_window_size.w - geometry.size.w);
location.x =
initial_window_location.x + (initial_window_size.w - size.w);
}
if edges.intersects(ResizeEdge::TOP) {
location.y = initial_window_location.y
+ (initial_window_size.h - geometry.size.h);
location.y =
initial_window_location.y + (initial_window_size.h - size.h);
}
new_location = Some(location);

View file

@ -110,8 +110,7 @@ pub fn init_shell(display: &mut Display) -> ShellStates {
.window_for_surface(surface.get_surface().unwrap())
.unwrap()
.clone();
let mut initial_window_location =
space.window_geometry(&window).unwrap().loc;
let mut initial_window_location = space.window_location(&window).unwrap();
// If surface is maximized then unmaximize it
if let Some(current_state) = surface.current_state() {
@ -172,10 +171,12 @@ pub fn init_shell(display: &mut Display) -> ShellStates {
.window_for_surface(surface.get_surface().unwrap())
.unwrap()
.clone();
let geometry = space.window_geometry(&window).unwrap();
let location = space.window_location(&window).unwrap();
let size = window.geometry().size;
let grab =
grabs::ResizeSurfaceGrab::new(start_data, window, edges, geometry);
let grab = grabs::ResizeSurfaceGrab::new(
start_data, window, edges, location, size,
);
pointer.set_grab(grab, serial, 0);
}
@ -415,7 +416,8 @@ fn commit(surface: &WlSurface, state: &mut State) {
{
let new_location = grabs::ResizeSurfaceGrab::apply_resize_state(
&window,
space.window_geometry(&window).unwrap(),
space.window_location(&window).unwrap(),
window.geometry().size,
);
if let Some(location) = new_location {
space.map_window(&window, location, true);