Track if a move or resize request is client initiated

This commit is contained in:
João Capucho 2024-08-19 16:01:04 +01:00 committed by Victoria Brekenfeld
parent 3625454420
commit 3c24934f48
7 changed files with 18 additions and 10 deletions

View file

@ -888,6 +888,7 @@ impl State {
&state.common.config,
&state.common.event_loop_handle,
&state.common.xdg_activation_state,
false
);
drop(shell);
dispatch_grab(res, seat_clone, serial, state);
@ -910,7 +911,8 @@ impl State {
&surface,
&seat_clone,
serial,
edge
edge,
false
);
drop(shell);
dispatch_grab(res, seat_clone, serial, state);

View file

@ -622,6 +622,7 @@ impl CosmicStack {
&state.common.config,
&state.common.event_loop_handle,
&state.common.xdg_activation_state,
false,
);
if let Some((grab, focus)) = res {
if grab.is_touch_grab() {
@ -710,6 +711,7 @@ impl Program for CosmicStackInternal {
&state.common.config,
&state.common.event_loop_handle,
&state.common.xdg_activation_state,
false,
);
if let Some((grab, focus)) = res {
if grab.is_touch_grab() {
@ -1290,6 +1292,7 @@ impl PointerTarget<State> for CosmicStack {
Focus::ResizeRight => ResizeEdge::RIGHT,
Focus::Header => unreachable!(),
},
false,
);
if let Some((grab, focus)) = res {
if grab.is_touch_grab() {
@ -1356,6 +1359,7 @@ impl PointerTarget<State> for CosmicStack {
&state.common.config,
&state.common.event_loop_handle,
&state.common.xdg_activation_state,
false,
);
if let Some((grab, focus)) = res {
if grab.is_touch_grab() {

View file

@ -406,6 +406,7 @@ impl Program for CosmicWindowInternal {
&state.common.config,
&state.common.event_loop_handle,
&state.common.xdg_activation_state,
false,
);
if let Some((grab, focus)) = res {
if grab.is_touch_grab() {
@ -718,6 +719,7 @@ impl PointerTarget<State> for CosmicWindow {
Focus::ResizeRight => ResizeEdge::RIGHT,
Focus::Header => unreachable!(),
},
false,
);
if let Some((grab, focus)) = res {

View file

@ -257,6 +257,7 @@ pub fn window_items(
&state.common.config,
&state.common.event_loop_handle,
&state.common.xdg_activation_state,
false,
);
std::mem::drop(shell);

View file

@ -2430,15 +2430,11 @@ impl Shell {
config: &Config,
evlh: &LoopHandle<'static, State>,
xdg_activation_state: &XdgActivationState,
client_initiated: bool,
) -> Option<(MoveGrab, Focus)> {
let serial = serial.into();
let mut start_data = check_grab_preconditions(
&seat,
surface,
serial,
release == ReleaseMode::NoMouseButtons && !move_out_of_stack,
)?;
let mut start_data = check_grab_preconditions(&seat, surface, serial, client_initiated)?;
let mut old_mapped = self.element_for_surface(surface).cloned()?;
if old_mapped.is_minimized() {
return None;
@ -3072,9 +3068,10 @@ impl Shell {
seat: &Seat<State>,
serial: impl Into<Option<Serial>>,
edges: ResizeEdge,
client_initiated: bool,
) -> Option<(ResizeGrab, Focus)> {
let serial = serial.into();
let start_data = check_grab_preconditions(&seat, surface, serial, true)?;
let start_data = check_grab_preconditions(&seat, surface, serial, client_initiated)?;
let mapped = self.element_for_surface(surface).cloned()?;
if mapped.is_fullscreen(true) || mapped.is_maximized(true) {
return None;

View file

@ -161,6 +161,7 @@ impl XdgShellHandler for State {
&self.common.config,
&self.common.event_loop_handle,
&self.common.xdg_activation_state,
true,
) {
std::mem::drop(shell);
if grab.is_touch_grab() {
@ -183,7 +184,7 @@ impl XdgShellHandler for State {
let seat = Seat::from_resource(&seat).unwrap();
let mut shell = self.common.shell.write().unwrap();
if let Some((grab, focus)) =
shell.resize_request(surface.wl_surface(), &seat, serial, edges.into())
shell.resize_request(surface.wl_surface(), &seat, serial, edges.into(), true)
{
std::mem::drop(shell);
if grab.is_touch_grab() {

View file

@ -481,7 +481,7 @@ impl XwmHandler for State {
let mut shell = self.common.shell.write().unwrap();
let seat = shell.seats.last_active().clone();
if let Some((grab, focus)) =
shell.resize_request(&wl_surface, &seat, None, resize_edge.into())
shell.resize_request(&wl_surface, &seat, None, resize_edge.into(), true)
{
std::mem::drop(shell);
if grab.is_touch_grab() {
@ -513,6 +513,7 @@ impl XwmHandler for State {
&self.common.config,
&self.common.event_loop_handle,
&self.common.xdg_activation_state,
true,
) {
std::mem::drop(shell);
if grab.is_touch_grab() {