fix: unify animated presentation and stacking
This commit is contained in:
1 parent
83e36b0d2d
commit
6d19932a64
11 files changed
+484
-107
No files matched your search
@@ -7,7 +7,7 @@ use smithay::{
|
||||
PointerInnerHandle, RelativeMotionEvent,
|
||||
},
|
||||
reexports::wayland_server::protocol::wl_surface::WlSurface,
|
||||
utils::{Logical, Point},
|
||||
utils::{Logical, Point, Size},
|
||||
};
|
||||
|
||||
use crate::Ferese;
|
||||
@@ -16,6 +16,7 @@ pub struct MoveSurfaceGrab {
|
||||
pub start_data: GrabStartData<Ferese>,
|
||||
pub window: Window,
|
||||
pub initial_location: Point<i32, Logical>,
|
||||
pub initial_size: Size<i32, Logical>,
|
||||
pub finished: bool,
|
||||
}
|
||||
|
||||
@@ -30,10 +31,7 @@ impl PointerGrab<Ferese> for MoveSurfaceGrab {
|
||||
handle.motion(data, None, event);
|
||||
let location = self.initial_location.to_f64() + (event.location - self.start_data.location);
|
||||
let location = location.to_i32_round();
|
||||
let size = self.window.geometry().size;
|
||||
|
||||
data.set_floating_window_geometry(&self.window, location, size);
|
||||
data.space.map_element(self.window.clone(), location, true);
|
||||
data.set_floating_window_geometry(&self.window, location, self.initial_size);
|
||||
}
|
||||
|
||||
fn relative_motion(
|
||||
@@ -153,9 +151,6 @@ impl PointerGrab<Ferese> for MoveSurfaceGrab {
|
||||
return;
|
||||
}
|
||||
|
||||
let size = self.window.geometry().size;
|
||||
data.set_floating_window_geometry(&self.window, self.initial_location, size);
|
||||
data.space
|
||||
.map_element(self.window.clone(), self.initial_location, true);
|
||||
data.set_floating_window_geometry(&self.window, self.initial_location, self.initial_size);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::cell::RefCell;
|
||||
|
||||
use smithay::{
|
||||
desktop::{Space, Window},
|
||||
desktop::Window,
|
||||
input::pointer::{
|
||||
AxisFrame, ButtonEvent, GestureHoldBeginEvent, GestureHoldEndEvent, GesturePinchBeginEvent,
|
||||
GesturePinchEndEvent, GesturePinchUpdateEvent, GestureSwipeBeginEvent,
|
||||
@@ -275,8 +275,6 @@ impl PointerGrab<Ferese> for ResizeSurfaceGrab {
|
||||
self.initial_rect.loc,
|
||||
self.initial_rect.size,
|
||||
);
|
||||
data.space
|
||||
.map_element(self.window.clone(), self.initial_rect.loc, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,35 +324,10 @@ impl ResizeState {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn handle_resize_commit(space: &mut Space<Window>, surface: &WlSurface) {
|
||||
let Some(window) = space
|
||||
.elements()
|
||||
.find(|window| {
|
||||
window
|
||||
.toplevel()
|
||||
.is_some_and(|toplevel| toplevel.wl_surface() == surface)
|
||||
})
|
||||
.cloned()
|
||||
else {
|
||||
return;
|
||||
};
|
||||
let Some(mut location) = space.element_location(&window) else {
|
||||
return;
|
||||
};
|
||||
let geometry = window.geometry();
|
||||
let Some((edges, initial_rect)) = ResizeState::with(surface, ResizeState::commit) else {
|
||||
return;
|
||||
};
|
||||
|
||||
if edges.left() {
|
||||
location.x = initial_rect.loc.x + initial_rect.size.w - geometry.size.w;
|
||||
}
|
||||
if edges.top() {
|
||||
location.y = initial_rect.loc.y + initial_rect.size.h - geometry.size.h;
|
||||
}
|
||||
if edges.left() || edges.top() {
|
||||
space.map_element(window, location, false);
|
||||
}
|
||||
pub fn handle_resize_commit(surface: &WlSurface) {
|
||||
// The compositor's visual rect owns the anchored edge. A delayed client
|
||||
// commit must not move the window or change its stacking order.
|
||||
ResizeState::with(surface, ResizeState::commit);
|
||||
}
|
||||
|
||||
fn constrained_size(
|
||||
|
||||
Reference in new issue
Block a user