chore: clippy
This commit is contained in:
parent
c13e52da04
commit
2ca99c670a
59 changed files with 1974 additions and 2137 deletions
|
|
@ -602,10 +602,10 @@ impl CosmicStack {
|
|||
let previous = p.previous_keyboard.swap(active, Ordering::SeqCst);
|
||||
if previous != active || p.reenter.swap(false, Ordering::SeqCst) {
|
||||
let windows = p.windows.lock().unwrap();
|
||||
if let Some(previous_surface) = windows.get(previous) {
|
||||
if previous != active {
|
||||
KeyboardTarget::leave(previous_surface, seat, data, serial);
|
||||
}
|
||||
if let Some(previous_surface) = windows.get(previous)
|
||||
&& previous != active
|
||||
{
|
||||
KeyboardTarget::leave(previous_surface, seat, data, serial);
|
||||
}
|
||||
KeyboardTarget::enter(
|
||||
&windows[active],
|
||||
|
|
@ -685,15 +685,15 @@ impl CosmicStack {
|
|||
if tiled && !appearance.shadow_tiled_windows {
|
||||
return None;
|
||||
}
|
||||
let radii = round
|
||||
.then(|| {
|
||||
theme
|
||||
.cosmic()
|
||||
.radius_s()
|
||||
.map(|x| if x < 4.0 { x } else { x + 4.0 })
|
||||
.map(|x| (x * scale as f32).round() as u8)
|
||||
})
|
||||
.unwrap_or([0, 0, 0, 0]);
|
||||
let radii = if round {
|
||||
theme
|
||||
.cosmic()
|
||||
.radius_s()
|
||||
.map(|x| if x < 4.0 { x } else { x + 4.0 })
|
||||
.map(|x| (x * scale as f32).round() as u8)
|
||||
} else {
|
||||
[0, 0, 0, 0]
|
||||
};
|
||||
|
||||
let mut geo = SpaceElement::geometry(&windows[active]).to_f64();
|
||||
geo.size.h += TAB_HEIGHT as f64;
|
||||
|
|
@ -857,37 +857,35 @@ impl CosmicStack {
|
|||
if let Some(dragged_out) = self
|
||||
.0
|
||||
.with_program(|p| p.potential_drag.lock().unwrap().take())
|
||||
{
|
||||
if let Some(surface) = self
|
||||
&& let Some(surface) = self
|
||||
.0
|
||||
.with_program(|p| p.windows.lock().unwrap().get(dragged_out).cloned())
|
||||
{
|
||||
let seat = seat.clone();
|
||||
surface.try_force_undecorated(false);
|
||||
surface.send_configure();
|
||||
if let Some(surface) = surface.wl_surface().map(Cow::into_owned) {
|
||||
let _ = data.common.event_loop_handle.insert_idle(move |state| {
|
||||
let res = state.common.shell.write().move_request(
|
||||
&surface,
|
||||
&seat,
|
||||
serial,
|
||||
ReleaseMode::NoMouseButtons,
|
||||
true,
|
||||
&state.common.config,
|
||||
&state.common.event_loop_handle,
|
||||
false,
|
||||
);
|
||||
if let Some((grab, focus)) = res {
|
||||
if grab.is_touch_grab() {
|
||||
seat.get_touch().unwrap().set_grab(state, grab, serial);
|
||||
} else {
|
||||
seat.get_pointer()
|
||||
.unwrap()
|
||||
.set_grab(state, grab, serial, focus);
|
||||
}
|
||||
{
|
||||
let seat = seat.clone();
|
||||
surface.try_force_undecorated(false);
|
||||
surface.send_configure();
|
||||
if let Some(surface) = surface.wl_surface().map(Cow::into_owned) {
|
||||
let _ = data.common.event_loop_handle.insert_idle(move |state| {
|
||||
let res = state.common.shell.write().move_request(
|
||||
&surface,
|
||||
&seat,
|
||||
serial,
|
||||
ReleaseMode::NoMouseButtons,
|
||||
true,
|
||||
&state.common.config,
|
||||
&state.common.event_loop_handle,
|
||||
false,
|
||||
);
|
||||
if let Some((grab, focus)) = res {
|
||||
if grab.is_touch_grab() {
|
||||
seat.get_touch().unwrap().set_grab(state, grab, serial);
|
||||
} else {
|
||||
seat.get_pointer()
|
||||
.unwrap()
|
||||
.set_grab(state, grab, serial, focus);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1152,47 +1150,46 @@ impl Program for CosmicStackInternal {
|
|||
}
|
||||
}
|
||||
Message::TabMenu(idx) => {
|
||||
if let Some((seat, serial)) = last_seat.cloned() {
|
||||
if let Some(surface) = self.windows.lock().unwrap()[idx]
|
||||
if let Some((seat, serial)) = last_seat.cloned()
|
||||
&& let Some(surface) = self.windows.lock().unwrap()[idx]
|
||||
.wl_surface()
|
||||
.map(Cow::into_owned)
|
||||
{
|
||||
loop_handle.insert_idle(move |state| {
|
||||
let shell = state.common.shell.read();
|
||||
if let Some(mapped) = shell.element_for_surface(&surface).cloned() {
|
||||
if let Some(workspace) = shell.space_for(&mapped) {
|
||||
let Some(elem_geo) = workspace.element_geometry(&mapped) else {
|
||||
return;
|
||||
};
|
||||
let position = elem_geo.loc.to_global(&workspace.output);
|
||||
{
|
||||
loop_handle.insert_idle(move |state| {
|
||||
let shell = state.common.shell.read();
|
||||
if let Some(mapped) = shell.element_for_surface(&surface).cloned()
|
||||
&& let Some(workspace) = shell.space_for(&mapped)
|
||||
{
|
||||
let Some(elem_geo) = workspace.element_geometry(&mapped) else {
|
||||
return;
|
||||
};
|
||||
let position = elem_geo.loc.to_global(&workspace.output);
|
||||
|
||||
let mut cursor = seat
|
||||
.get_pointer()
|
||||
.unwrap()
|
||||
.current_location()
|
||||
.to_i32_round();
|
||||
cursor.y -= TAB_HEIGHT;
|
||||
let res = shell.menu_request(
|
||||
false,
|
||||
&surface,
|
||||
&seat,
|
||||
serial,
|
||||
cursor - position.as_logical(),
|
||||
false,
|
||||
&state.common.config,
|
||||
&state.common.event_loop_handle,
|
||||
);
|
||||
let mut cursor = seat
|
||||
.get_pointer()
|
||||
.unwrap()
|
||||
.current_location()
|
||||
.to_i32_round();
|
||||
cursor.y -= TAB_HEIGHT;
|
||||
let res = shell.menu_request(
|
||||
false,
|
||||
&surface,
|
||||
&seat,
|
||||
serial,
|
||||
cursor - position.as_logical(),
|
||||
false,
|
||||
&state.common.config,
|
||||
&state.common.event_loop_handle,
|
||||
);
|
||||
|
||||
std::mem::drop(shell);
|
||||
if let Some((grab, focus)) = res {
|
||||
seat.get_pointer()
|
||||
.unwrap()
|
||||
.set_grab(state, grab, serial, focus);
|
||||
}
|
||||
}
|
||||
std::mem::drop(shell);
|
||||
if let Some((grab, focus)) = res {
|
||||
seat.get_pointer()
|
||||
.unwrap()
|
||||
.set_grab(state, grab, serial, focus);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
_ => unreachable!(),
|
||||
|
|
@ -1701,37 +1698,35 @@ impl PointerTarget<State> for CosmicStack {
|
|||
if let Some(dragged_out) = self
|
||||
.0
|
||||
.with_program(|p| p.potential_drag.lock().unwrap().take())
|
||||
{
|
||||
if let Some(surface) = self
|
||||
&& let Some(surface) = self
|
||||
.0
|
||||
.with_program(|p| p.windows.lock().unwrap().get(dragged_out).cloned())
|
||||
{
|
||||
let seat = seat.clone();
|
||||
surface.try_force_undecorated(false);
|
||||
surface.send_configure();
|
||||
if let Some(surface) = surface.wl_surface().map(Cow::into_owned) {
|
||||
let _ = data.common.event_loop_handle.insert_idle(move |state| {
|
||||
let res = state.common.shell.write().move_request(
|
||||
&surface,
|
||||
&seat,
|
||||
serial,
|
||||
ReleaseMode::NoMouseButtons,
|
||||
true,
|
||||
&state.common.config,
|
||||
&state.common.event_loop_handle,
|
||||
false,
|
||||
);
|
||||
if let Some((grab, focus)) = res {
|
||||
if grab.is_touch_grab() {
|
||||
seat.get_touch().unwrap().set_grab(state, grab, serial);
|
||||
} else {
|
||||
seat.get_pointer()
|
||||
.unwrap()
|
||||
.set_grab(state, grab, serial, focus);
|
||||
}
|
||||
{
|
||||
let seat = seat.clone();
|
||||
surface.try_force_undecorated(false);
|
||||
surface.send_configure();
|
||||
if let Some(surface) = surface.wl_surface().map(Cow::into_owned) {
|
||||
let _ = data.common.event_loop_handle.insert_idle(move |state| {
|
||||
let res = state.common.shell.write().move_request(
|
||||
&surface,
|
||||
&seat,
|
||||
serial,
|
||||
ReleaseMode::NoMouseButtons,
|
||||
true,
|
||||
&state.common.config,
|
||||
&state.common.event_loop_handle,
|
||||
false,
|
||||
);
|
||||
if let Some((grab, focus)) = res {
|
||||
if grab.is_touch_grab() {
|
||||
seat.get_touch().unwrap().set_grab(state, grab, serial);
|
||||
} else {
|
||||
seat.get_pointer()
|
||||
.unwrap()
|
||||
.set_grab(state, grab, serial, focus);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -356,22 +356,20 @@ where
|
|||
if matches!(
|
||||
event,
|
||||
event::Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left))
|
||||
) {
|
||||
if let Some(message) = self.press_message.clone() {
|
||||
shell.publish(message);
|
||||
shell.capture_event();
|
||||
return;
|
||||
}
|
||||
) && let Some(message) = self.press_message.clone()
|
||||
{
|
||||
shell.publish(message);
|
||||
shell.capture_event();
|
||||
return;
|
||||
}
|
||||
if matches!(
|
||||
event,
|
||||
event::Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Right))
|
||||
) {
|
||||
if let Some(message) = self.right_click_message.clone() {
|
||||
shell.publish(message);
|
||||
shell.capture_event();
|
||||
return;
|
||||
}
|
||||
) && let Some(message) = self.right_click_message.clone()
|
||||
{
|
||||
shell.publish(message);
|
||||
shell.capture_event();
|
||||
return;
|
||||
}
|
||||
if matches!(
|
||||
event,
|
||||
|
|
@ -379,7 +377,6 @@ where
|
|||
) {
|
||||
shell.publish(Message::activate(self.idx));
|
||||
shell.capture_event();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -270,10 +270,10 @@ impl State {
|
|||
pub fn cleanup_old_animations(&mut self) {
|
||||
let start_time = Instant::now();
|
||||
|
||||
if let Some(animation) = self.scroll_animation.as_ref() {
|
||||
if start_time.duration_since(animation.start_time) > SCROLL_ANIMATION_DURATION {
|
||||
self.scroll_animation.take();
|
||||
}
|
||||
if let Some(animation) = self.scroll_animation.as_ref()
|
||||
&& start_time.duration_since(animation.start_time) > SCROLL_ANIMATION_DURATION
|
||||
{
|
||||
self.scroll_animation.take();
|
||||
}
|
||||
|
||||
Self::discard_expired_tab_animations(&mut self.tab_animations, start_time);
|
||||
|
|
|
|||
|
|
@ -693,15 +693,13 @@ impl CosmicSurface {
|
|||
.primary_scanout_feedback
|
||||
.as_ref()
|
||||
.unwrap_or(&feedback.render_feedback)
|
||||
} else if frame_time_filter_fn(data) == Kind::ScanoutCandidate {
|
||||
feedback
|
||||
.overlay_scanout_feedback
|
||||
.as_ref()
|
||||
.unwrap_or(&feedback.render_feedback)
|
||||
} else {
|
||||
if frame_time_filter_fn(data) == Kind::ScanoutCandidate {
|
||||
feedback
|
||||
.overlay_scanout_feedback
|
||||
.as_ref()
|
||||
.unwrap_or(&feedback.render_feedback)
|
||||
} else {
|
||||
&feedback.render_feedback
|
||||
}
|
||||
&feedback.render_feedback
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -983,6 +981,6 @@ fn with_toplevel_state<T, F: FnOnce(Option<&smithay::wayland::shell::xdg::Toplev
|
|||
if pending {
|
||||
toplevel.with_pending_state(|pending| cb(Some(pending)))
|
||||
} else {
|
||||
toplevel.with_committed_state(|committed| cb(committed))
|
||||
toplevel.with_committed_state(cb)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -576,10 +576,8 @@ impl CosmicWindow {
|
|||
*conf = *appearance;
|
||||
if appearance.clip_floating_windows {
|
||||
p.window.set_tiled(true);
|
||||
} else {
|
||||
if !p.tiled.load(Ordering::Acquire) {
|
||||
p.window.set_tiled(false);
|
||||
}
|
||||
} else if !p.tiled.load(Ordering::Acquire) {
|
||||
p.window.set_tiled(false);
|
||||
}
|
||||
p.window.send_configure();
|
||||
}
|
||||
|
|
@ -633,8 +631,8 @@ impl CosmicWindow {
|
|||
&& !p.window.is_maximized(false);
|
||||
let round =
|
||||
(!is_tiled || appearance.clip_tiled_windows) && !p.window.is_maximized(false);
|
||||
let radii = round
|
||||
.then(|| {
|
||||
let radii = if round {
|
||||
{
|
||||
p.theme
|
||||
.lock()
|
||||
.unwrap()
|
||||
|
|
@ -642,8 +640,10 @@ impl CosmicWindow {
|
|||
.radius_s()
|
||||
.map(|x| if x < 4.0 { x } else { x + 4.0 })
|
||||
.map(|x| x.round() as u8)
|
||||
})
|
||||
.unwrap_or([0; 4]);
|
||||
}
|
||||
} else {
|
||||
[0; 4]
|
||||
};
|
||||
|
||||
match (has_ssd, clip) {
|
||||
(has_ssd, true) => {
|
||||
|
|
@ -698,30 +698,30 @@ impl Program for CosmicWindowInternal {
|
|||
) -> Task<Self::Message> {
|
||||
match message {
|
||||
Message::DragStart => {
|
||||
if let Some((seat, serial)) = last_seat.cloned() {
|
||||
if let Some(surface) = self.window.wl_surface().map(Cow::into_owned) {
|
||||
loop_handle.insert_idle(move |state| {
|
||||
let res = state.common.shell.write().move_request(
|
||||
&surface,
|
||||
&seat,
|
||||
serial,
|
||||
ReleaseMode::NoMouseButtons,
|
||||
false,
|
||||
&state.common.config,
|
||||
&state.common.event_loop_handle,
|
||||
false,
|
||||
);
|
||||
if let Some((grab, focus)) = res {
|
||||
if grab.is_touch_grab() {
|
||||
seat.get_touch().unwrap().set_grab(state, grab, serial);
|
||||
} else {
|
||||
seat.get_pointer()
|
||||
.unwrap()
|
||||
.set_grab(state, grab, serial, focus);
|
||||
}
|
||||
if let Some((seat, serial)) = last_seat.cloned()
|
||||
&& let Some(surface) = self.window.wl_surface().map(Cow::into_owned)
|
||||
{
|
||||
loop_handle.insert_idle(move |state| {
|
||||
let res = state.common.shell.write().move_request(
|
||||
&surface,
|
||||
&seat,
|
||||
serial,
|
||||
ReleaseMode::NoMouseButtons,
|
||||
false,
|
||||
&state.common.config,
|
||||
&state.common.event_loop_handle,
|
||||
false,
|
||||
);
|
||||
if let Some((grab, focus)) = res {
|
||||
if grab.is_touch_grab() {
|
||||
seat.get_touch().unwrap().set_grab(state, grab, serial);
|
||||
} else {
|
||||
seat.get_pointer()
|
||||
.unwrap()
|
||||
.set_grab(state, grab, serial, focus);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Message::Minimize => {
|
||||
|
|
@ -745,51 +745,51 @@ impl Program for CosmicWindowInternal {
|
|||
}
|
||||
Message::Close => self.window.close(),
|
||||
Message::Menu => {
|
||||
if let Some((seat, serial)) = last_seat.cloned() {
|
||||
if let Some(surface) = self.window.wl_surface().map(Cow::into_owned) {
|
||||
loop_handle.insert_idle(move |state| {
|
||||
let shell = state.common.shell.read();
|
||||
if let Some(mapped) = shell.element_for_surface(&surface).cloned() {
|
||||
let position = if let Some((output, set)) =
|
||||
shell.workspaces.sets.iter().find(|(_, set)| {
|
||||
set.sticky_layer.mapped().any(|m| m == &mapped)
|
||||
}) {
|
||||
set.sticky_layer
|
||||
.element_geometry(&mapped)
|
||||
.unwrap()
|
||||
.loc
|
||||
.to_global(output)
|
||||
} else if let Some(workspace) = shell.space_for(&mapped) {
|
||||
let Some(elem_geo) = workspace.element_geometry(&mapped) else {
|
||||
return;
|
||||
};
|
||||
elem_geo.loc.to_global(&workspace.output)
|
||||
} else {
|
||||
if let Some((seat, serial)) = last_seat.cloned()
|
||||
&& let Some(surface) = self.window.wl_surface().map(Cow::into_owned)
|
||||
{
|
||||
loop_handle.insert_idle(move |state| {
|
||||
let shell = state.common.shell.read();
|
||||
if let Some(mapped) = shell.element_for_surface(&surface).cloned() {
|
||||
let position = if let Some((output, set)) =
|
||||
shell.workspaces.sets.iter().find(|(_, set)| {
|
||||
set.sticky_layer.mapped().any(|m| m == &mapped)
|
||||
}) {
|
||||
set.sticky_layer
|
||||
.element_geometry(&mapped)
|
||||
.unwrap()
|
||||
.loc
|
||||
.to_global(output)
|
||||
} else if let Some(workspace) = shell.space_for(&mapped) {
|
||||
let Some(elem_geo) = workspace.element_geometry(&mapped) else {
|
||||
return;
|
||||
};
|
||||
elem_geo.loc.to_global(&workspace.output)
|
||||
} else {
|
||||
return;
|
||||
};
|
||||
|
||||
let pointer = seat.get_pointer().unwrap();
|
||||
let mut cursor = pointer.current_location().to_i32_round();
|
||||
cursor.y -= SSD_HEIGHT;
|
||||
let pointer = seat.get_pointer().unwrap();
|
||||
let mut cursor = pointer.current_location().to_i32_round();
|
||||
cursor.y -= SSD_HEIGHT;
|
||||
|
||||
let res = shell.menu_request(
|
||||
false,
|
||||
&surface,
|
||||
&seat,
|
||||
serial,
|
||||
cursor - position.as_logical(),
|
||||
false,
|
||||
&state.common.config,
|
||||
&state.common.event_loop_handle,
|
||||
);
|
||||
let res = shell.menu_request(
|
||||
false,
|
||||
&surface,
|
||||
&seat,
|
||||
serial,
|
||||
cursor - position.as_logical(),
|
||||
false,
|
||||
&state.common.config,
|
||||
&state.common.event_loop_handle,
|
||||
);
|
||||
|
||||
std::mem::drop(shell);
|
||||
if let Some((grab, focus)) = res {
|
||||
pointer.set_grab(state, grab, serial, focus);
|
||||
}
|
||||
std::mem::drop(shell);
|
||||
if let Some((grab, focus)) = res {
|
||||
pointer.set_grab(state, grab, serial, focus);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -238,10 +238,9 @@ impl Shell {
|
|||
.user_data()
|
||||
.get::<PopupGrabData>()
|
||||
.and_then(|x| x.take())
|
||||
&& !popup_grab.has_ended()
|
||||
{
|
||||
if !popup_grab.has_ended() {
|
||||
popup_grab.ungrab(PopupUngrabStrategy::All);
|
||||
}
|
||||
popup_grab.ungrab(PopupUngrabStrategy::All);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -501,31 +500,28 @@ impl Common {
|
|||
trace!("Wrong Window, focus fixup");
|
||||
}
|
||||
} else {
|
||||
if let KeyboardFocusTarget::Popup(_) = target {
|
||||
if let Some(popup_grab) = seat
|
||||
if let KeyboardFocusTarget::Popup(_) = target
|
||||
&& let Some(popup_grab) = seat
|
||||
.user_data()
|
||||
.get::<PopupGrabData>()
|
||||
.and_then(|x| x.take())
|
||||
{
|
||||
if !popup_grab.has_ended() {
|
||||
if let Some(new) = popup_grab.current_grab() {
|
||||
trace!("restore focus to previous popup grab");
|
||||
std::mem::drop(shell);
|
||||
// TODO: verify whether cursor should be updated at end of popup grab
|
||||
update_focus_state(
|
||||
seat,
|
||||
Some(&new),
|
||||
state,
|
||||
Some(SERIAL_COUNTER.next_serial()),
|
||||
false,
|
||||
);
|
||||
seat.user_data()
|
||||
.get_or_insert::<PopupGrabData, _>(PopupGrabData::default)
|
||||
.set(Some(popup_grab));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
&& !popup_grab.has_ended()
|
||||
&& let Some(new) = popup_grab.current_grab()
|
||||
{
|
||||
trace!("restore focus to previous popup grab");
|
||||
std::mem::drop(shell);
|
||||
// TODO: verify whether cursor should be updated at end of popup grab
|
||||
update_focus_state(
|
||||
seat,
|
||||
Some(&new),
|
||||
state,
|
||||
Some(SERIAL_COUNTER.next_serial()),
|
||||
false,
|
||||
);
|
||||
seat.user_data()
|
||||
.get_or_insert::<PopupGrabData, _>(PopupGrabData::default)
|
||||
.set(Some(popup_grab));
|
||||
continue;
|
||||
}
|
||||
trace!("Surface dead, focus fixup");
|
||||
}
|
||||
|
|
@ -547,10 +543,9 @@ impl Common {
|
|||
.user_data()
|
||||
.get::<PopupGrabData>()
|
||||
.and_then(|x| x.take())
|
||||
&& !popup_grab.has_ended()
|
||||
{
|
||||
if !popup_grab.has_ended() {
|
||||
popup_grab.ungrab(PopupUngrabStrategy::All);
|
||||
}
|
||||
popup_grab.ungrab(PopupUngrabStrategy::All);
|
||||
}
|
||||
|
||||
// update keyboard focus
|
||||
|
|
@ -682,12 +677,12 @@ fn update_focus_target(
|
|||
} else {
|
||||
let workspace = shell.active_space(output).unwrap();
|
||||
|
||||
if let Some(Trigger::KeyboardSwap(_, desc)) = shell.overview_mode().0.active_trigger() {
|
||||
if workspace.handle == desc.handle && workspace.tiling_layer.has_node(&desc.node) {
|
||||
if let Some(focus) = workspace.tiling_layer.node_desc_to_focus(desc) {
|
||||
return Some(focus);
|
||||
}
|
||||
}
|
||||
if let Some(Trigger::KeyboardSwap(_, desc)) = shell.overview_mode().0.active_trigger()
|
||||
&& workspace.handle == desc.handle
|
||||
&& workspace.tiling_layer.has_node(&desc.node)
|
||||
&& let Some(focus) = workspace.tiling_layer.node_desc_to_focus(desc)
|
||||
{
|
||||
return Some(focus);
|
||||
}
|
||||
|
||||
workspace
|
||||
|
|
|
|||
|
|
@ -271,16 +271,16 @@ fn render_input_order_internal<R: 'static>(
|
|||
}
|
||||
}
|
||||
|
||||
if let Some((_, has_fullscreen, offset)) = previous.as_ref() {
|
||||
if !has_fullscreen {
|
||||
// previous bottom layer popups
|
||||
for (layer, popup, location) in layer_popups(output, Layer::Bottom, element_filter) {
|
||||
callback(Stage::LayerPopup {
|
||||
layer,
|
||||
popup: &popup,
|
||||
location: location + offset.as_global(),
|
||||
})?;
|
||||
}
|
||||
if let Some((_, has_fullscreen, offset)) = previous.as_ref()
|
||||
&& !has_fullscreen
|
||||
{
|
||||
// previous bottom layer popups
|
||||
for (layer, popup, location) in layer_popups(output, Layer::Bottom, element_filter) {
|
||||
callback(Stage::LayerPopup {
|
||||
layer,
|
||||
popup: &popup,
|
||||
location: location + offset.as_global(),
|
||||
})?;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -295,17 +295,16 @@ fn render_input_order_internal<R: 'static>(
|
|||
}
|
||||
}
|
||||
|
||||
if let Some((_, has_fullscreen, offset)) = previous.as_ref() {
|
||||
if !has_fullscreen {
|
||||
// previous background layer popups
|
||||
for (layer, popup, location) in layer_popups(output, Layer::Background, element_filter)
|
||||
{
|
||||
callback(Stage::LayerPopup {
|
||||
layer,
|
||||
popup: &popup,
|
||||
location: location + offset.as_global(),
|
||||
})?;
|
||||
}
|
||||
if let Some((_, has_fullscreen, offset)) = previous.as_ref()
|
||||
&& !has_fullscreen
|
||||
{
|
||||
// previous background layer popups
|
||||
for (layer, popup, location) in layer_popups(output, Layer::Background, element_filter) {
|
||||
callback(Stage::LayerPopup {
|
||||
layer,
|
||||
popup: &popup,
|
||||
location: location + offset.as_global(),
|
||||
})?;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -348,13 +347,13 @@ fn render_input_order_internal<R: 'static>(
|
|||
}
|
||||
}
|
||||
|
||||
if let Some((_, has_fullscreen, offset)) = previous.as_ref() {
|
||||
if !has_fullscreen {
|
||||
// previous bottom layer
|
||||
for (layer, mut location) in layer_surfaces(output, Layer::Bottom, element_filter) {
|
||||
location += offset.as_global();
|
||||
callback(Stage::LayerSurface { layer, location })?;
|
||||
}
|
||||
if let Some((_, has_fullscreen, offset)) = previous.as_ref()
|
||||
&& !has_fullscreen
|
||||
{
|
||||
// previous bottom layer
|
||||
for (layer, mut location) in layer_surfaces(output, Layer::Bottom, element_filter) {
|
||||
location += offset.as_global();
|
||||
callback(Stage::LayerSurface { layer, location })?;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -366,13 +365,13 @@ fn render_input_order_internal<R: 'static>(
|
|||
}
|
||||
}
|
||||
|
||||
if let Some((_, has_fullscreen, offset)) = previous.as_ref() {
|
||||
if !has_fullscreen {
|
||||
// previous background layer
|
||||
for (layer, mut location) in layer_surfaces(output, Layer::Background, element_filter) {
|
||||
location += offset.as_global();
|
||||
callback(Stage::LayerSurface { layer, location })?;
|
||||
}
|
||||
if let Some((_, has_fullscreen, offset)) = previous.as_ref()
|
||||
&& !has_fullscreen
|
||||
{
|
||||
// previous background layer
|
||||
for (layer, mut location) in layer_surfaces(output, Layer::Background, element_filter) {
|
||||
location += offset.as_global();
|
||||
callback(Stage::LayerSurface { layer, location })?;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,18 +63,18 @@ impl<G: PointerGrab<State>> PointerGrab<State> for DelayGrab<G> {
|
|||
handle.motion(data, focus, event);
|
||||
|
||||
let distance = self.start_data.distance(event.location);
|
||||
if distance >= 1. {
|
||||
if let Some(factory) = self.grab_factory.take() {
|
||||
let serial = self.serial.unwrap_or(event.serial);
|
||||
let seat = self.seat.clone();
|
||||
data.common.event_loop_handle.insert_idle(move |data| {
|
||||
if let Some((grab, focus)) = factory(data) {
|
||||
seat.get_pointer()
|
||||
.unwrap()
|
||||
.set_grab(data, grab, serial, focus);
|
||||
}
|
||||
});
|
||||
}
|
||||
if distance >= 1.
|
||||
&& let Some(factory) = self.grab_factory.take()
|
||||
{
|
||||
let serial = self.serial.unwrap_or(event.serial);
|
||||
let seat = self.seat.clone();
|
||||
data.common.event_loop_handle.insert_idle(move |data| {
|
||||
if let Some((grab, focus)) = factory(data) {
|
||||
seat.get_pointer()
|
||||
.unwrap()
|
||||
.set_grab(data, grab, serial, focus);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -232,16 +232,16 @@ impl<G: TouchGrab<State>> TouchGrab<State> for DelayGrab<G> {
|
|||
handle.motion(data, focus, event, seq);
|
||||
|
||||
let distance = self.start_data.distance(event.location);
|
||||
if distance >= 1. {
|
||||
if let Some(factory) = self.grab_factory.take() {
|
||||
let seat = self.seat.clone();
|
||||
let serial = self.serial.unwrap_or_else(|| SERIAL_COUNTER.next_serial());
|
||||
data.common.event_loop_handle.insert_idle(move |data| {
|
||||
if let Some((grab, _)) = factory(data) {
|
||||
seat.get_touch().unwrap().set_grab(data, grab, serial);
|
||||
}
|
||||
});
|
||||
}
|
||||
if distance >= 1.
|
||||
&& let Some(factory) = self.grab_factory.take()
|
||||
{
|
||||
let seat = self.seat.clone();
|
||||
let serial = self.serial.unwrap_or_else(|| SERIAL_COUNTER.next_serial());
|
||||
data.common.event_loop_handle.insert_idle(move |data| {
|
||||
if let Some((grab, _)) = factory(data) {
|
||||
seat.get_touch().unwrap().set_grab(data, grab, serial);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -260,115 +260,112 @@ impl Program for ContextMenu {
|
|||
// But right now we don't have any touch responsive menus with submenus
|
||||
}
|
||||
Message::ItemEntered(idx, bounds) => {
|
||||
if let Some(Item::Submenu { items, .. }) = self.items.get_mut(idx) {
|
||||
if let Some((seat, _)) = last_seat.cloned() {
|
||||
let items = items.clone();
|
||||
let _ = loop_handle.insert_idle(move |state| {
|
||||
let grab_state = seat
|
||||
.user_data()
|
||||
.get::<SeatMenuGrabState>()
|
||||
.unwrap()
|
||||
.lock()
|
||||
.unwrap();
|
||||
if let Some(Item::Submenu { items, .. }) = self.items.get_mut(idx)
|
||||
&& let Some((seat, _)) = last_seat.cloned()
|
||||
{
|
||||
let items = items.clone();
|
||||
let _ = loop_handle.insert_idle(move |state| {
|
||||
let grab_state = seat
|
||||
.user_data()
|
||||
.get::<SeatMenuGrabState>()
|
||||
.unwrap()
|
||||
.lock()
|
||||
.unwrap();
|
||||
|
||||
if let Some(grab_state) = &*grab_state {
|
||||
let mut elements = grab_state.elements.lock().unwrap();
|
||||
if let Some(grab_state) = &*grab_state {
|
||||
let mut elements = grab_state.elements.lock().unwrap();
|
||||
|
||||
let position = elements.last().unwrap().position;
|
||||
let element = IcedElement::new(
|
||||
ContextMenu::new(items),
|
||||
Size::default(),
|
||||
state.common.event_loop_handle.clone(),
|
||||
state.common.theme.clone(),
|
||||
);
|
||||
let position = elements.last().unwrap().position;
|
||||
let element = IcedElement::new(
|
||||
ContextMenu::new(items),
|
||||
Size::default(),
|
||||
state.common.event_loop_handle.clone(),
|
||||
state.common.theme.clone(),
|
||||
);
|
||||
|
||||
let min_size = element.minimum_size();
|
||||
element.with_program(|p| {
|
||||
*p.row_width.lock().unwrap() = Some(min_size.w as f32);
|
||||
});
|
||||
element.resize(min_size);
|
||||
let min_size = element.minimum_size();
|
||||
element.with_program(|p| {
|
||||
*p.row_width.lock().unwrap() = Some(min_size.w as f32);
|
||||
});
|
||||
element.resize(min_size);
|
||||
|
||||
let output = seat.active_output();
|
||||
let position = [
|
||||
// to the right -> down
|
||||
Rectangle::new(
|
||||
position
|
||||
+ Point::from((
|
||||
bounds.width.ceil() as i32,
|
||||
bounds.y.ceil() as i32,
|
||||
)),
|
||||
min_size.as_global(),
|
||||
),
|
||||
// to the right -> up
|
||||
Rectangle::new(
|
||||
position
|
||||
+ Point::from((
|
||||
bounds.width.ceil() as i32,
|
||||
bounds.y.ceil() as i32
|
||||
+ bounds.height.ceil() as i32
|
||||
- min_size.h,
|
||||
)),
|
||||
min_size.as_global(),
|
||||
),
|
||||
// to the left -> down
|
||||
Rectangle::new(
|
||||
position
|
||||
+ Point::from((-min_size.w, bounds.y.ceil() as i32)),
|
||||
min_size.as_global(),
|
||||
),
|
||||
// to the left -> up
|
||||
Rectangle::new(
|
||||
position
|
||||
+ Point::from((
|
||||
-min_size.w,
|
||||
bounds.y.ceil() as i32
|
||||
+ bounds.height.ceil() as i32
|
||||
- min_size.h,
|
||||
)),
|
||||
min_size.as_global(),
|
||||
),
|
||||
]
|
||||
.iter()
|
||||
.rev() // preference of max_by_key is backwards
|
||||
.max_by_key(|rect| {
|
||||
output
|
||||
.geometry()
|
||||
.intersection(**rect)
|
||||
.map(|rect| rect.size.w * rect.size.h)
|
||||
})
|
||||
.unwrap()
|
||||
.loc;
|
||||
element.output_enter(&output, element.bbox());
|
||||
element.set_additional_scale(*grab_state.scale.lock().unwrap());
|
||||
let output = seat.active_output();
|
||||
let position = [
|
||||
// to the right -> down
|
||||
Rectangle::new(
|
||||
position
|
||||
+ Point::from((
|
||||
bounds.width.ceil() as i32,
|
||||
bounds.y.ceil() as i32,
|
||||
)),
|
||||
min_size.as_global(),
|
||||
),
|
||||
// to the right -> up
|
||||
Rectangle::new(
|
||||
position
|
||||
+ Point::from((
|
||||
bounds.width.ceil() as i32,
|
||||
bounds.y.ceil() as i32 + bounds.height.ceil() as i32
|
||||
- min_size.h,
|
||||
)),
|
||||
min_size.as_global(),
|
||||
),
|
||||
// to the left -> down
|
||||
Rectangle::new(
|
||||
position + Point::from((-min_size.w, bounds.y.ceil() as i32)),
|
||||
min_size.as_global(),
|
||||
),
|
||||
// to the left -> up
|
||||
Rectangle::new(
|
||||
position
|
||||
+ Point::from((
|
||||
-min_size.w,
|
||||
bounds.y.ceil() as i32 + bounds.height.ceil() as i32
|
||||
- min_size.h,
|
||||
)),
|
||||
min_size.as_global(),
|
||||
),
|
||||
]
|
||||
.iter()
|
||||
.rev() // preference of max_by_key is backwards
|
||||
.max_by_key(|rect| {
|
||||
output
|
||||
.geometry()
|
||||
.intersection(**rect)
|
||||
.map(|rect| rect.size.w * rect.size.h)
|
||||
})
|
||||
.unwrap()
|
||||
.loc;
|
||||
element.output_enter(&output, element.bbox());
|
||||
element.set_additional_scale(*grab_state.scale.lock().unwrap());
|
||||
|
||||
elements.push(Element {
|
||||
iced: element,
|
||||
position,
|
||||
pointer_entered: false,
|
||||
touch_entered: None,
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
elements.push(Element {
|
||||
iced: element,
|
||||
position,
|
||||
pointer_entered: false,
|
||||
touch_entered: None,
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Message::ItemLeft(idx, _) => {
|
||||
if let Some(Item::Submenu { .. }) = self.items.get_mut(idx) {
|
||||
if let Some((seat, _)) = last_seat.cloned() {
|
||||
let _ = loop_handle.insert_idle(move |_| {
|
||||
let grab_state = seat
|
||||
.user_data()
|
||||
.get::<SeatMenuGrabState>()
|
||||
.unwrap()
|
||||
.lock()
|
||||
.unwrap();
|
||||
if let Some(Item::Submenu { .. }) = self.items.get_mut(idx)
|
||||
&& let Some((seat, _)) = last_seat.cloned()
|
||||
{
|
||||
let _ = loop_handle.insert_idle(move |_| {
|
||||
let grab_state = seat
|
||||
.user_data()
|
||||
.get::<SeatMenuGrabState>()
|
||||
.unwrap()
|
||||
.lock()
|
||||
.unwrap();
|
||||
|
||||
if let Some(grab_state) = &*grab_state {
|
||||
let mut elements = grab_state.elements.lock().unwrap();
|
||||
elements.pop();
|
||||
}
|
||||
});
|
||||
}
|
||||
if let Some(grab_state) = &*grab_state {
|
||||
let mut elements = grab_state.elements.lock().unwrap();
|
||||
elements.pop();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -862,43 +862,43 @@ impl Drop for MoveGrab {
|
|||
window_location.to_local(&workspace.output),
|
||||
);
|
||||
|
||||
if matches!(previous, ManagedLayer::Floating) {
|
||||
if let Some(sz) = grab_state.snapping_zone {
|
||||
if sz == SnappingZone::Maximize {
|
||||
shell.maximize_toggle(
|
||||
&window,
|
||||
&seat,
|
||||
&state.common.event_loop_handle,
|
||||
);
|
||||
} else {
|
||||
let directions = match sz {
|
||||
SnappingZone::Maximize => vec![],
|
||||
SnappingZone::Top => vec![Direction::Up],
|
||||
SnappingZone::TopLeft => {
|
||||
vec![Direction::Up, Direction::Left]
|
||||
}
|
||||
SnappingZone::Left => vec![Direction::Left],
|
||||
SnappingZone::BottomLeft => {
|
||||
vec![Direction::Down, Direction::Left]
|
||||
}
|
||||
SnappingZone::Bottom => vec![Direction::Down],
|
||||
SnappingZone::BottomRight => {
|
||||
vec![Direction::Down, Direction::Right]
|
||||
}
|
||||
SnappingZone::Right => vec![Direction::Right],
|
||||
SnappingZone::TopRight => {
|
||||
vec![Direction::Up, Direction::Right]
|
||||
}
|
||||
};
|
||||
for direction in directions {
|
||||
workspace.floating_layer.move_element(
|
||||
direction,
|
||||
&seat,
|
||||
ManagedLayer::Floating,
|
||||
&theme,
|
||||
&window,
|
||||
);
|
||||
if matches!(previous, ManagedLayer::Floating)
|
||||
&& let Some(sz) = grab_state.snapping_zone
|
||||
{
|
||||
if sz == SnappingZone::Maximize {
|
||||
shell.maximize_toggle(
|
||||
&window,
|
||||
&seat,
|
||||
&state.common.event_loop_handle,
|
||||
);
|
||||
} else {
|
||||
let directions = match sz {
|
||||
SnappingZone::Maximize => vec![],
|
||||
SnappingZone::Top => vec![Direction::Up],
|
||||
SnappingZone::TopLeft => {
|
||||
vec![Direction::Up, Direction::Left]
|
||||
}
|
||||
SnappingZone::Left => vec![Direction::Left],
|
||||
SnappingZone::BottomLeft => {
|
||||
vec![Direction::Down, Direction::Left]
|
||||
}
|
||||
SnappingZone::Bottom => vec![Direction::Down],
|
||||
SnappingZone::BottomRight => {
|
||||
vec![Direction::Down, Direction::Right]
|
||||
}
|
||||
SnappingZone::Right => vec![Direction::Right],
|
||||
SnappingZone::TopRight => {
|
||||
vec![Direction::Up, Direction::Right]
|
||||
}
|
||||
};
|
||||
for direction in directions {
|
||||
workspace.floating_layer.move_element(
|
||||
direction,
|
||||
&seat,
|
||||
ManagedLayer::Floating,
|
||||
&theme,
|
||||
&window,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -525,10 +525,10 @@ impl ResizeSurfaceGrab {
|
|||
};
|
||||
|
||||
// Finish resizing.
|
||||
if let Some(ResizeState::WaitingForCommit(_)) = *resize_state {
|
||||
if !window.is_resizing(false).unwrap_or(false) {
|
||||
*resize_state = None;
|
||||
}
|
||||
if let Some(ResizeState::WaitingForCommit(_)) = *resize_state
|
||||
&& !window.is_resizing(false).unwrap_or(false)
|
||||
{
|
||||
*resize_state = None;
|
||||
}
|
||||
std::mem::drop(resize_state);
|
||||
|
||||
|
|
|
|||
|
|
@ -385,13 +385,12 @@ impl FloatingLayout {
|
|||
} else {
|
||||
self.animations.remove(&mapped);
|
||||
}
|
||||
if mapped.floating_tiled.lock().unwrap().take().is_some() {
|
||||
if let Some(state) = mapped.maximized_state.lock().unwrap().as_mut() {
|
||||
if let Some(real_old_geo) = *mapped.last_geometry.lock().unwrap() {
|
||||
state.original_geometry = real_old_geo;
|
||||
}
|
||||
};
|
||||
}
|
||||
if mapped.floating_tiled.lock().unwrap().take().is_some()
|
||||
&& let Some(state) = mapped.maximized_state.lock().unwrap().as_mut()
|
||||
&& let Some(real_old_geo) = *mapped.last_geometry.lock().unwrap()
|
||||
{
|
||||
state.original_geometry = real_old_geo;
|
||||
};
|
||||
self.space
|
||||
.map_element(mapped, geometry.loc.as_logical(), true);
|
||||
self.space.refresh();
|
||||
|
|
@ -683,10 +682,10 @@ impl FloatingLayout {
|
|||
mapped_geometry.size = last_size;
|
||||
}
|
||||
} else if !window.is_maximized(true) {
|
||||
if window.active_window().has_pending_changes() {
|
||||
if let Some(pending_size) = window.pending_size() {
|
||||
mapped_geometry.size = pending_size.as_local();
|
||||
}
|
||||
if window.active_window().has_pending_changes()
|
||||
&& let Some(pending_size) = window.pending_size()
|
||||
{
|
||||
mapped_geometry.size = pending_size.as_local();
|
||||
}
|
||||
*window.last_geometry.lock().unwrap() = Some(mapped_geometry);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -452,53 +452,51 @@ impl TilingLayout {
|
|||
mut sizes,
|
||||
}) = tiling_state
|
||||
{
|
||||
if let Some(node) = parent.as_ref().and_then(|parent| tree.get_mut(parent).ok()) {
|
||||
if let Data::Group {
|
||||
if let Some(node) = parent.as_ref().and_then(|parent| tree.get_mut(parent).ok())
|
||||
&& let Data::Group {
|
||||
orientation: current_orientation,
|
||||
sizes: current_sizes,
|
||||
..
|
||||
} = node.data_mut()
|
||||
{
|
||||
let parent_id = parent.unwrap();
|
||||
{
|
||||
let parent_id = parent.unwrap();
|
||||
|
||||
if *current_orientation == orientation && sizes.len() == current_sizes.len() + 1
|
||||
{
|
||||
let previous_length: i32 = sizes.iter().copied().sum();
|
||||
let new_length: i32 = current_sizes.iter().copied().sum();
|
||||
if previous_length != new_length {
|
||||
// rescale sizes
|
||||
sizes.iter_mut().for_each(|len| {
|
||||
*len = (((*len as f64) / (previous_length as f64))
|
||||
* (new_length as f64))
|
||||
.round() as i32;
|
||||
});
|
||||
let sum: i32 = sizes.iter().sum();
|
||||
if *current_orientation == orientation && sizes.len() == current_sizes.len() + 1 {
|
||||
let previous_length: i32 = sizes.iter().copied().sum();
|
||||
let new_length: i32 = current_sizes.iter().copied().sum();
|
||||
if previous_length != new_length {
|
||||
// rescale sizes
|
||||
sizes.iter_mut().for_each(|len| {
|
||||
*len = (((*len as f64) / (previous_length as f64))
|
||||
* (new_length as f64))
|
||||
.round() as i32;
|
||||
});
|
||||
let sum: i32 = sizes.iter().sum();
|
||||
|
||||
// fix rounding issues
|
||||
if sum != new_length {
|
||||
let diff = new_length - sum;
|
||||
*sizes.last_mut().unwrap() += diff;
|
||||
}
|
||||
// fix rounding issues
|
||||
if sum != new_length {
|
||||
let diff = new_length - sum;
|
||||
*sizes.last_mut().unwrap() += diff;
|
||||
}
|
||||
}
|
||||
|
||||
*current_sizes = sizes;
|
||||
let new_node = Node::new(Data::Mapped {
|
||||
mapped: window.clone(),
|
||||
last_geometry: Rectangle::from_size((100, 100).into()),
|
||||
minimize_rect: from,
|
||||
});
|
||||
let new_id = tree
|
||||
.insert(new_node, InsertBehavior::UnderNode(&parent_id))
|
||||
.unwrap();
|
||||
tree.make_nth_sibling(&new_id, idx).unwrap();
|
||||
*window.tiling_node_id.lock().unwrap() = Some(new_id);
|
||||
|
||||
let blocker = TilingLayout::update_positions(&self.output, &mut tree, gaps);
|
||||
self.queue
|
||||
.push_tree(tree, MINIMIZE_ANIMATION_DURATION, blocker);
|
||||
return;
|
||||
}
|
||||
|
||||
*current_sizes = sizes;
|
||||
let new_node = Node::new(Data::Mapped {
|
||||
mapped: window.clone(),
|
||||
last_geometry: Rectangle::from_size((100, 100).into()),
|
||||
minimize_rect: from,
|
||||
});
|
||||
let new_id = tree
|
||||
.insert(new_node, InsertBehavior::UnderNode(&parent_id))
|
||||
.unwrap();
|
||||
tree.make_nth_sibling(&new_id, idx).unwrap();
|
||||
*window.tiling_node_id.lock().unwrap() = Some(new_id);
|
||||
|
||||
let blocker = TilingLayout::update_positions(&self.output, &mut tree, gaps);
|
||||
self.queue
|
||||
.push_tree(tree, MINIMIZE_ANIMATION_DURATION, blocker);
|
||||
return;
|
||||
}
|
||||
|
||||
if sibling
|
||||
|
|
@ -1414,8 +1412,8 @@ impl TilingLayout {
|
|||
let tiling_node_id = mapped.tiling_node_id.lock().unwrap().as_ref().cloned();
|
||||
let gaps = self.gaps();
|
||||
|
||||
if let Some(node_id) = tiling_node_id {
|
||||
if self
|
||||
if let Some(node_id) = tiling_node_id
|
||||
&& self
|
||||
.queue
|
||||
.trees
|
||||
.back()
|
||||
|
|
@ -1424,21 +1422,20 @@ impl TilingLayout {
|
|||
.get(&node_id)
|
||||
.map(|node| node.data().is_mapped(Some(mapped)))
|
||||
.unwrap_or(false)
|
||||
{
|
||||
let mut tree = self.queue.trees.back().unwrap().0.copy_clone();
|
||||
{
|
||||
let mut tree = self.queue.trees.back().unwrap().0.copy_clone();
|
||||
|
||||
TilingLayout::unmap_internal(&mut tree, &node_id);
|
||||
TilingLayout::unmap_internal(&mut tree, &node_id);
|
||||
|
||||
let duration = if minimizing {
|
||||
MINIMIZE_ANIMATION_DURATION
|
||||
} else {
|
||||
ANIMATION_DURATION
|
||||
};
|
||||
let blocker = TilingLayout::update_positions(&self.output, &mut tree, gaps);
|
||||
self.queue.push_tree(tree, duration, blocker);
|
||||
let duration = if minimizing {
|
||||
MINIMIZE_ANIMATION_DURATION
|
||||
} else {
|
||||
ANIMATION_DURATION
|
||||
};
|
||||
let blocker = TilingLayout::update_positions(&self.output, &mut tree, gaps);
|
||||
self.queue.push_tree(tree, duration, blocker);
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
false
|
||||
}
|
||||
|
|
@ -1742,7 +1739,7 @@ impl TilingLayout {
|
|||
_ => {
|
||||
// we want the middle
|
||||
let group_len = tree.get(&next_child_id).unwrap().data().len();
|
||||
if group_len % 2 == 0 {
|
||||
if group_len.is_multiple_of(2) {
|
||||
tree.make_nth_sibling(&node_id, group_len / 2).unwrap();
|
||||
tree.get_mut(&next_child_id)
|
||||
.unwrap()
|
||||
|
|
@ -1965,8 +1962,8 @@ impl TilingLayout {
|
|||
if focus_subtree.is_some() {
|
||||
let mut node_id = focus_subtree;
|
||||
while node_id.is_some() {
|
||||
if let Some(desc) = swap_desc.as_ref() {
|
||||
if let Some(replacement_id) = tree
|
||||
if let Some(desc) = swap_desc.as_ref()
|
||||
&& let Some(replacement_id) = tree
|
||||
.ancestor_ids(node_id.unwrap())
|
||||
.unwrap()
|
||||
.find(|anchestor| *anchestor == &desc.node)
|
||||
|
|
@ -1975,31 +1972,30 @@ impl TilingLayout {
|
|||
.unwrap()
|
||||
.find(|child| *child == &desc.node)
|
||||
})
|
||||
{
|
||||
return match tree.get(replacement_id).unwrap().data() {
|
||||
Data::Group { alive, .. } => {
|
||||
FocusResult::Some(KeyboardFocusTarget::Group(WindowGroup {
|
||||
node: replacement_id.clone(),
|
||||
alive: Arc::downgrade(alive),
|
||||
focus_stack: tree
|
||||
.children_ids(replacement_id)
|
||||
.unwrap()
|
||||
.cloned()
|
||||
.collect(),
|
||||
}))
|
||||
{
|
||||
return match tree.get(replacement_id).unwrap().data() {
|
||||
Data::Group { alive, .. } => {
|
||||
FocusResult::Some(KeyboardFocusTarget::Group(WindowGroup {
|
||||
node: replacement_id.clone(),
|
||||
alive: Arc::downgrade(alive),
|
||||
focus_stack: tree
|
||||
.children_ids(replacement_id)
|
||||
.unwrap()
|
||||
.cloned()
|
||||
.collect(),
|
||||
}))
|
||||
}
|
||||
Data::Mapped { mapped, .. } => {
|
||||
if mapped.is_stack()
|
||||
&& desc.stack_window.is_none()
|
||||
&& replacement_id == &desc.node
|
||||
{
|
||||
mapped.stack_ref().unwrap().focus_stack();
|
||||
}
|
||||
Data::Mapped { mapped, .. } => {
|
||||
if mapped.is_stack()
|
||||
&& desc.stack_window.is_none()
|
||||
&& replacement_id == &desc.node
|
||||
{
|
||||
mapped.stack_ref().unwrap().focus_stack();
|
||||
}
|
||||
FocusResult::Some(KeyboardFocusTarget::Element(mapped.clone()))
|
||||
}
|
||||
_ => unreachable!(),
|
||||
};
|
||||
}
|
||||
FocusResult::Some(KeyboardFocusTarget::Element(mapped.clone()))
|
||||
}
|
||||
_ => unreachable!(),
|
||||
};
|
||||
}
|
||||
|
||||
match tree.get(node_id.unwrap()).unwrap().data() {
|
||||
|
|
@ -2098,40 +2094,38 @@ impl TilingLayout {
|
|||
};
|
||||
|
||||
let mut tree = self.queue.trees.back().unwrap().0.copy_clone();
|
||||
if let Some((last_active, _)) = TilingLayout::currently_focused_node(&tree, target) {
|
||||
if let Some(group) = tree.get(&last_active).unwrap().parent().cloned() {
|
||||
if let &mut Data::Group {
|
||||
ref mut orientation,
|
||||
ref mut sizes,
|
||||
ref last_geometry,
|
||||
..
|
||||
} = tree.get_mut(&group).unwrap().data_mut()
|
||||
{
|
||||
let previous_length = match orientation {
|
||||
Orientation::Horizontal => last_geometry.size.h,
|
||||
Orientation::Vertical => last_geometry.size.w,
|
||||
};
|
||||
let new_orientation = new_orientation.unwrap_or(!*orientation);
|
||||
let new_length = match new_orientation {
|
||||
Orientation::Horizontal => last_geometry.size.h,
|
||||
Orientation::Vertical => last_geometry.size.w,
|
||||
};
|
||||
if let Some((last_active, _)) = TilingLayout::currently_focused_node(&tree, target)
|
||||
&& let Some(group) = tree.get(&last_active).unwrap().parent().cloned()
|
||||
&& let &mut Data::Group {
|
||||
ref mut orientation,
|
||||
ref mut sizes,
|
||||
ref last_geometry,
|
||||
..
|
||||
} = tree.get_mut(&group).unwrap().data_mut()
|
||||
{
|
||||
let previous_length = match orientation {
|
||||
Orientation::Horizontal => last_geometry.size.h,
|
||||
Orientation::Vertical => last_geometry.size.w,
|
||||
};
|
||||
let new_orientation = new_orientation.unwrap_or(!*orientation);
|
||||
let new_length = match new_orientation {
|
||||
Orientation::Horizontal => last_geometry.size.h,
|
||||
Orientation::Vertical => last_geometry.size.w,
|
||||
};
|
||||
|
||||
sizes.iter_mut().for_each(|len| {
|
||||
*len = (((*len as f64) / (previous_length as f64)) * (new_length as f64))
|
||||
.round() as i32;
|
||||
});
|
||||
let sum: i32 = sizes.iter().sum();
|
||||
if sum < new_length {
|
||||
*sizes.last_mut().unwrap() += new_length - sum;
|
||||
}
|
||||
|
||||
*orientation = new_orientation;
|
||||
|
||||
let blocker = TilingLayout::update_positions(&self.output, &mut tree, gaps);
|
||||
self.queue.push_tree(tree, ANIMATION_DURATION, blocker);
|
||||
}
|
||||
sizes.iter_mut().for_each(|len| {
|
||||
*len = (((*len as f64) / (previous_length as f64)) * (new_length as f64)).round()
|
||||
as i32;
|
||||
});
|
||||
let sum: i32 = sizes.iter().sum();
|
||||
if sum < new_length {
|
||||
*sizes.last_mut().unwrap() += new_length - sum;
|
||||
}
|
||||
|
||||
*orientation = new_orientation;
|
||||
|
||||
let blocker = TilingLayout::update_positions(&self.output, &mut tree, gaps);
|
||||
self.queue.push_tree(tree, ANIMATION_DURATION, blocker);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3371,21 +3365,20 @@ impl TilingLayout {
|
|||
if matches!(
|
||||
overview.active_trigger(),
|
||||
Some(Trigger::Pointer(_) | Trigger::Touch(_))
|
||||
) {
|
||||
if location_f64.is_some() {
|
||||
let mut tree = tree.copy_clone();
|
||||
tree.insert(
|
||||
Node::new(Data::Placeholder {
|
||||
id: Id::new(),
|
||||
last_geometry: Rectangle::from_size((100, 100).into()),
|
||||
type_: PlaceholderType::DropZone,
|
||||
}),
|
||||
InsertBehavior::AsRoot,
|
||||
)
|
||||
.unwrap();
|
||||
let blocker = TilingLayout::update_positions(&self.output, &mut tree, gaps);
|
||||
self.queue.push_tree(tree, ANIMATION_DURATION, blocker);
|
||||
}
|
||||
) && location_f64.is_some()
|
||||
{
|
||||
let mut tree = tree.copy_clone();
|
||||
tree.insert(
|
||||
Node::new(Data::Placeholder {
|
||||
id: Id::new(),
|
||||
last_geometry: Rectangle::from_size((100, 100).into()),
|
||||
type_: PlaceholderType::DropZone,
|
||||
}),
|
||||
InsertBehavior::AsRoot,
|
||||
)
|
||||
.unwrap();
|
||||
let blocker = TilingLayout::update_positions(&self.output, &mut tree, gaps);
|
||||
self.queue.push_tree(tree, ANIMATION_DURATION, blocker);
|
||||
}
|
||||
return;
|
||||
};
|
||||
|
|
@ -4626,62 +4619,62 @@ where
|
|||
geo.loc += (gap, gap).into();
|
||||
geo.size -= (gap * 2, gap * 2).into();
|
||||
|
||||
if mouse_tiling.is_some() {
|
||||
if let Some(PillIndicator::Outer(direction)) = pill_indicator {
|
||||
let (pill_geo, remaining_geo) = match direction {
|
||||
Direction::Left => (
|
||||
Rectangle::new(
|
||||
(geo.loc.x, geo.loc.y).into(),
|
||||
(16, geo.size.h).into(),
|
||||
),
|
||||
Rectangle::new(
|
||||
(geo.loc.x + 48, geo.loc.y).into(),
|
||||
(geo.size.w - 48, geo.size.h).into(),
|
||||
),
|
||||
if mouse_tiling.is_some()
|
||||
&& let Some(PillIndicator::Outer(direction)) = pill_indicator
|
||||
{
|
||||
let (pill_geo, remaining_geo) = match direction {
|
||||
Direction::Left => (
|
||||
Rectangle::new(
|
||||
(geo.loc.x, geo.loc.y).into(),
|
||||
(16, geo.size.h).into(),
|
||||
),
|
||||
Direction::Up => (
|
||||
Rectangle::new(
|
||||
(geo.loc.x, geo.loc.y).into(),
|
||||
(geo.size.w, 16).into(),
|
||||
),
|
||||
Rectangle::new(
|
||||
(geo.loc.x, geo.loc.y + 48).into(),
|
||||
(geo.size.w, geo.size.h - 48).into(),
|
||||
),
|
||||
Rectangle::new(
|
||||
(geo.loc.x + 48, geo.loc.y).into(),
|
||||
(geo.size.w - 48, geo.size.h).into(),
|
||||
),
|
||||
Direction::Right => (
|
||||
Rectangle::new(
|
||||
(geo.loc.x + geo.size.w - 16, geo.loc.y).into(),
|
||||
(16, geo.size.h).into(),
|
||||
),
|
||||
Rectangle::new(geo.loc, (geo.size.w - 48, geo.size.h).into()),
|
||||
),
|
||||
Direction::Up => (
|
||||
Rectangle::new(
|
||||
(geo.loc.x, geo.loc.y).into(),
|
||||
(geo.size.w, 16).into(),
|
||||
),
|
||||
Direction::Down => (
|
||||
Rectangle::new(
|
||||
(geo.loc.x, geo.loc.y + geo.size.h - 16).into(),
|
||||
(geo.size.w, 16).into(),
|
||||
),
|
||||
Rectangle::new(geo.loc, (geo.size.w, geo.size.h - 48).into()),
|
||||
Rectangle::new(
|
||||
(geo.loc.x, geo.loc.y + 48).into(),
|
||||
(geo.size.w, geo.size.h - 48).into(),
|
||||
),
|
||||
};
|
||||
|
||||
if let Some(renderer) = renderer.as_mut() {
|
||||
elements.push(
|
||||
BackdropShader::element(
|
||||
*renderer,
|
||||
backdrop_id.clone(),
|
||||
pill_geo,
|
||||
8.,
|
||||
alpha * 0.4,
|
||||
group_color,
|
||||
)
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
|
||||
geo = remaining_geo;
|
||||
),
|
||||
Direction::Right => (
|
||||
Rectangle::new(
|
||||
(geo.loc.x + geo.size.w - 16, geo.loc.y).into(),
|
||||
(16, geo.size.h).into(),
|
||||
),
|
||||
Rectangle::new(geo.loc, (geo.size.w - 48, geo.size.h).into()),
|
||||
),
|
||||
Direction::Down => (
|
||||
Rectangle::new(
|
||||
(geo.loc.x, geo.loc.y + geo.size.h - 16).into(),
|
||||
(geo.size.w, 16).into(),
|
||||
),
|
||||
Rectangle::new(geo.loc, (geo.size.w, geo.size.h - 48).into()),
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
if let Some(renderer) = renderer.as_mut() {
|
||||
elements.push(
|
||||
BackdropShader::element(
|
||||
*renderer,
|
||||
backdrop_id.clone(),
|
||||
pill_geo,
|
||||
8.,
|
||||
alpha * 0.4,
|
||||
group_color,
|
||||
)
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
|
||||
geo = remaining_geo;
|
||||
};
|
||||
|
||||
if matches!(swap_desc, Some(ref desc) if desc.node == node_id) {
|
||||
if let Some(renderer) = renderer.as_mut() {
|
||||
|
|
@ -4758,35 +4751,35 @@ where
|
|||
(geo.loc.x, geo.loc.y + previous).into(),
|
||||
(geo.size.w, *size).into(),
|
||||
);
|
||||
if mouse_tiling.is_some() {
|
||||
if let Some(PillIndicator::Inner(pill_idx)) = pill_indicator {
|
||||
if *pill_idx == idx {
|
||||
geo.size.h -= 32;
|
||||
}
|
||||
if idx
|
||||
.checked_sub(1)
|
||||
.map(|idx| idx == *pill_idx)
|
||||
.unwrap_or(false)
|
||||
{
|
||||
if let Some(renderer) = renderer.as_mut() {
|
||||
elements.push(
|
||||
BackdropShader::element(
|
||||
*renderer,
|
||||
backdrop_id.clone(),
|
||||
Rectangle::new(
|
||||
(geo.loc.x, geo.loc.y - 8).into(),
|
||||
(geo.size.w, 16).into(),
|
||||
),
|
||||
8.,
|
||||
alpha * 0.4,
|
||||
group_color,
|
||||
)
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
geo.loc.y += 32;
|
||||
geo.size.h -= 32;
|
||||
if mouse_tiling.is_some()
|
||||
&& let Some(PillIndicator::Inner(pill_idx)) = pill_indicator
|
||||
{
|
||||
if *pill_idx == idx {
|
||||
geo.size.h -= 32;
|
||||
}
|
||||
if idx
|
||||
.checked_sub(1)
|
||||
.map(|idx| idx == *pill_idx)
|
||||
.unwrap_or(false)
|
||||
{
|
||||
if let Some(renderer) = renderer.as_mut() {
|
||||
elements.push(
|
||||
BackdropShader::element(
|
||||
*renderer,
|
||||
backdrop_id.clone(),
|
||||
Rectangle::new(
|
||||
(geo.loc.x, geo.loc.y - 8).into(),
|
||||
(geo.size.w, 16).into(),
|
||||
),
|
||||
8.,
|
||||
alpha * 0.4,
|
||||
group_color,
|
||||
)
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
geo.loc.y += 32;
|
||||
geo.size.h -= 32;
|
||||
}
|
||||
}
|
||||
stack.push((geo, depth + 1));
|
||||
|
|
@ -4800,35 +4793,35 @@ where
|
|||
(geo.loc.x + previous, geo.loc.y).into(),
|
||||
(*size, geo.size.h).into(),
|
||||
);
|
||||
if mouse_tiling.is_some() {
|
||||
if let Some(PillIndicator::Inner(pill_idx)) = pill_indicator {
|
||||
if *pill_idx == idx {
|
||||
geo.size.w -= 32;
|
||||
}
|
||||
if idx
|
||||
.checked_sub(1)
|
||||
.map(|idx| idx == *pill_idx)
|
||||
.unwrap_or(false)
|
||||
{
|
||||
if let Some(renderer) = renderer.as_mut() {
|
||||
elements.push(
|
||||
BackdropShader::element(
|
||||
*renderer,
|
||||
backdrop_id.clone(),
|
||||
Rectangle::new(
|
||||
(geo.loc.x - 8, geo.loc.y).into(),
|
||||
(16, geo.size.h).into(),
|
||||
),
|
||||
8.,
|
||||
alpha * 0.4,
|
||||
group_color,
|
||||
)
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
geo.loc.x += 32;
|
||||
geo.size.w -= 32;
|
||||
if mouse_tiling.is_some()
|
||||
&& let Some(PillIndicator::Inner(pill_idx)) = pill_indicator
|
||||
{
|
||||
if *pill_idx == idx {
|
||||
geo.size.w -= 32;
|
||||
}
|
||||
if idx
|
||||
.checked_sub(1)
|
||||
.map(|idx| idx == *pill_idx)
|
||||
.unwrap_or(false)
|
||||
{
|
||||
if let Some(renderer) = renderer.as_mut() {
|
||||
elements.push(
|
||||
BackdropShader::element(
|
||||
*renderer,
|
||||
backdrop_id.clone(),
|
||||
Rectangle::new(
|
||||
(geo.loc.x - 8, geo.loc.y).into(),
|
||||
(16, geo.size.h).into(),
|
||||
),
|
||||
8.,
|
||||
alpha * 0.4,
|
||||
group_color,
|
||||
)
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
geo.loc.x += 32;
|
||||
geo.size.w -= 32;
|
||||
}
|
||||
}
|
||||
stack.push((geo, depth + 1));
|
||||
|
|
@ -5102,10 +5095,7 @@ where
|
|||
},
|
||||
);
|
||||
|
||||
shadow_elements
|
||||
.into_iter()
|
||||
.chain(elements.into_iter())
|
||||
.collect()
|
||||
shadow_elements.into_iter().chain(elements).collect()
|
||||
}
|
||||
|
||||
fn render_old_tree(
|
||||
|
|
@ -5518,21 +5508,20 @@ where
|
|||
.unwrap_or(false)
|
||||
})
|
||||
.unwrap_or(false))
|
||||
&& let Some(swap) = swap_indicator.as_ref()
|
||||
{
|
||||
if let Some(swap) = swap_indicator.as_ref() {
|
||||
swap.resize(geo.size.as_logical());
|
||||
swap.output_enter(output, output_geo.as_logical());
|
||||
swap_elements.extend(
|
||||
swap.render_elements::<CosmicWindowRenderElement<R>>(
|
||||
renderer,
|
||||
geo.loc.as_logical().to_physical_precise_round(output_scale),
|
||||
output_scale.into(),
|
||||
alpha * overview.0.alpha().unwrap_or(1.0),
|
||||
)
|
||||
.into_iter()
|
||||
.map(CosmicMappedRenderElement::from),
|
||||
);
|
||||
}
|
||||
swap.resize(geo.size.as_logical());
|
||||
swap.output_enter(output, output_geo.as_logical());
|
||||
swap_elements.extend(
|
||||
swap.render_elements::<CosmicWindowRenderElement<R>>(
|
||||
renderer,
|
||||
geo.loc.as_logical().to_physical_precise_round(output_scale),
|
||||
output_scale.into(),
|
||||
alpha * overview.0.alpha().unwrap_or(1.0),
|
||||
)
|
||||
.into_iter()
|
||||
.map(CosmicMappedRenderElement::from),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5716,7 +5705,7 @@ where
|
|||
.into_iter()
|
||||
.flatten()
|
||||
.chain(swap_elements)
|
||||
.chain(indicators.into_iter().map(Into::into))
|
||||
.chain(indicators)
|
||||
.chain(window_elements)
|
||||
.chain(animating_window_elements)
|
||||
.chain(shadow_elements)
|
||||
|
|
@ -5858,10 +5847,10 @@ fn render_new_tree(
|
|||
(new_geo, percentage, false)
|
||||
};
|
||||
|
||||
if let Data::Mapped { mapped, .. } = data {
|
||||
if mapped.is_maximized(false) {
|
||||
return;
|
||||
}
|
||||
if let Data::Mapped { mapped, .. } = data
|
||||
&& mapped.is_maximized(false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
processor(node_id, data, geo, original_geo, alpha, animating)
|
||||
});
|
||||
|
|
|
|||
346
src/shell/mod.rs
346
src/shell/mod.rs
|
|
@ -479,7 +479,7 @@ impl WorkspaceSet {
|
|||
appearance: AppearanceConfig,
|
||||
) -> WorkspaceSet {
|
||||
let group_handle = state.create_workspace_group();
|
||||
let sticky_layer = FloatingLayout::new(theme.clone(), appearance.clone(), output);
|
||||
let sticky_layer = FloatingLayout::new(theme.clone(), appearance, output);
|
||||
|
||||
WorkspaceSet {
|
||||
previously_active: None,
|
||||
|
|
@ -753,7 +753,7 @@ impl Workspaces {
|
|||
autotile: config.cosmic_conf.autotile,
|
||||
autotile_behavior: config.cosmic_conf.autotile_behavior,
|
||||
theme,
|
||||
appearance: config.cosmic_conf.appearance_settings.clone(),
|
||||
appearance: config.cosmic_conf.appearance_settings,
|
||||
persisted_workspaces: config.cosmic_conf.pinned_workspaces.clone(),
|
||||
}
|
||||
}
|
||||
|
|
@ -1462,7 +1462,7 @@ impl Common {
|
|||
let mut shell = self.shell.write();
|
||||
let shell_ref = &mut *shell;
|
||||
shell_ref.active_hint = self.config.cosmic_conf.active_hint;
|
||||
shell_ref.appearance_conf = self.config.cosmic_conf.appearance_settings.clone();
|
||||
shell_ref.appearance_conf = self.config.cosmic_conf.appearance_settings;
|
||||
if let Some(zoom_state) = shell_ref.zoom_state.as_mut() {
|
||||
zoom_state.increment = self.config.cosmic_conf.accessibility_zoom.increment;
|
||||
zoom_state.movement = self.config.cosmic_conf.accessibility_zoom.view_moves;
|
||||
|
|
@ -1519,12 +1519,12 @@ impl Common {
|
|||
let shell = self.shell.read();
|
||||
|
||||
for seat in shell.seats.iter() {
|
||||
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>() {
|
||||
if let Some(grab_state) = move_grab.lock().unwrap().as_ref() {
|
||||
let mapped = grab_state.element();
|
||||
if mapped.active_window().wl_surface().as_deref() == Some(surface) {
|
||||
mapped.on_commit(surface);
|
||||
}
|
||||
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>()
|
||||
&& let Some(grab_state) = move_grab.lock().unwrap().as_ref()
|
||||
{
|
||||
let mapped = grab_state.element();
|
||||
if mapped.active_window().wl_surface().as_deref() == Some(surface) {
|
||||
mapped.on_commit(surface);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1595,7 +1595,7 @@ impl Shell {
|
|||
resize_mode: ResizeMode::None,
|
||||
resize_state: None,
|
||||
resize_indicator: None,
|
||||
appearance_conf: config.cosmic_conf.appearance_settings.clone(),
|
||||
appearance_conf: config.cosmic_conf.appearance_settings,
|
||||
zoom_state: None,
|
||||
tiling_exceptions,
|
||||
|
||||
|
|
@ -1972,22 +1972,22 @@ impl Shell {
|
|||
.filter(|seat| seat.active_output() == **o)
|
||||
.any(|seat| {
|
||||
let cursor_status = seat.cursor_image_status();
|
||||
if let CursorImageStatus::Surface(s) = cursor_status {
|
||||
if s == *surface {
|
||||
return true;
|
||||
}
|
||||
if let CursorImageStatus::Surface(s) = cursor_status
|
||||
&& s == *surface
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>() {
|
||||
if let Some(grab_state) = move_grab.lock().unwrap().as_ref() {
|
||||
for (window, _) in grab_state.element().windows() {
|
||||
let mut matches = false;
|
||||
window.0.with_surfaces(|s, _| {
|
||||
matches |= s == surface;
|
||||
});
|
||||
if matches {
|
||||
return true;
|
||||
}
|
||||
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>()
|
||||
&& let Some(grab_state) = move_grab.lock().unwrap().as_ref()
|
||||
{
|
||||
for (window, _) in grab_state.element().windows() {
|
||||
let mut matches = false;
|
||||
window.0.with_surfaces(|s, _| {
|
||||
matches |= s == surface;
|
||||
});
|
||||
if matches {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2216,18 +2216,18 @@ impl Shell {
|
|||
}
|
||||
|
||||
pub fn overview_mode(&self) -> (OverviewMode, Option<SwapIndicator>) {
|
||||
if let OverviewMode::Started(trigger, timestamp) = &self.overview_mode {
|
||||
if Instant::now().duration_since(*timestamp) > ANIMATION_DURATION {
|
||||
return (
|
||||
OverviewMode::Active(trigger.clone()),
|
||||
self.swap_indicator.clone(),
|
||||
);
|
||||
}
|
||||
if let OverviewMode::Started(trigger, timestamp) = &self.overview_mode
|
||||
&& Instant::now().duration_since(*timestamp) > ANIMATION_DURATION
|
||||
{
|
||||
return (
|
||||
OverviewMode::Active(trigger.clone()),
|
||||
self.swap_indicator.clone(),
|
||||
);
|
||||
}
|
||||
if let OverviewMode::Ended(_, timestamp) = &self.overview_mode {
|
||||
if Instant::now().duration_since(*timestamp) > ANIMATION_DURATION {
|
||||
return (OverviewMode::None, None);
|
||||
}
|
||||
if let OverviewMode::Ended(_, timestamp) = &self.overview_mode
|
||||
&& Instant::now().duration_since(*timestamp) > ANIMATION_DURATION
|
||||
{
|
||||
return (OverviewMode::None, None);
|
||||
}
|
||||
|
||||
(self.overview_mode.clone(), self.swap_indicator.clone())
|
||||
|
|
@ -2261,18 +2261,18 @@ impl Shell {
|
|||
}
|
||||
|
||||
pub fn resize_mode(&self) -> (ResizeMode, Option<ResizeIndicator>) {
|
||||
if let ResizeMode::Started(binding, timestamp, direction) = &self.resize_mode {
|
||||
if Instant::now().duration_since(*timestamp) > ANIMATION_DURATION {
|
||||
return (
|
||||
ResizeMode::Active(binding.clone(), *direction),
|
||||
self.resize_indicator.clone(),
|
||||
);
|
||||
}
|
||||
if let ResizeMode::Started(binding, timestamp, direction) = &self.resize_mode
|
||||
&& Instant::now().duration_since(*timestamp) > ANIMATION_DURATION
|
||||
{
|
||||
return (
|
||||
ResizeMode::Active(binding.clone(), *direction),
|
||||
self.resize_indicator.clone(),
|
||||
);
|
||||
}
|
||||
if let ResizeMode::Ended(timestamp, _) = self.resize_mode {
|
||||
if Instant::now().duration_since(timestamp) > ANIMATION_DURATION {
|
||||
return (ResizeMode::None, None);
|
||||
}
|
||||
if let ResizeMode::Ended(timestamp, _) = self.resize_mode
|
||||
&& Instant::now().duration_since(timestamp) > ANIMATION_DURATION
|
||||
{
|
||||
return (ResizeMode::None, None);
|
||||
}
|
||||
|
||||
(self.resize_mode.clone(), self.resize_indicator.clone())
|
||||
|
|
@ -2299,7 +2299,7 @@ impl Shell {
|
|||
}
|
||||
|
||||
pub fn appearance_config(&self) -> AppearanceConfig {
|
||||
self.appearance_conf.clone()
|
||||
self.appearance_conf
|
||||
}
|
||||
|
||||
pub fn trigger_zoom(
|
||||
|
|
@ -2333,10 +2333,10 @@ impl Shell {
|
|||
}
|
||||
|
||||
let mut toggled = self.zoom_state.is_none();
|
||||
if let Some(old_state) = self.zoom_state.as_ref() {
|
||||
if &old_state.seat != seat {
|
||||
return;
|
||||
}
|
||||
if let Some(old_state) = self.zoom_state.as_ref()
|
||||
&& &old_state.seat != seat
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for output in &outputs {
|
||||
|
|
@ -2766,18 +2766,16 @@ impl Shell {
|
|||
}
|
||||
|
||||
let maybe_focused = workspace.focus_stack.get(&seat).iter().next().cloned();
|
||||
if let Some(FocusTarget::Window(focused)) = maybe_focused {
|
||||
if (focused.is_stack() && !is_dialog && !should_be_maximized)
|
||||
&& !(workspace.is_tiled(&focused.active_window()) && floating_exception)
|
||||
{
|
||||
focused.stack_ref().unwrap().add_window(window, None, None);
|
||||
if was_activated {
|
||||
workspace_state.add_workspace_state(&workspace_handle, WState::Urgent);
|
||||
}
|
||||
return (workspace_output == seat.active_output()
|
||||
&& active_handle == workspace_handle)
|
||||
.then_some(KeyboardFocusTarget::Element(focused));
|
||||
if let Some(FocusTarget::Window(focused)) = maybe_focused
|
||||
&& (focused.is_stack() && !is_dialog && !should_be_maximized)
|
||||
&& !(workspace.is_tiled(&focused.active_window()) && floating_exception)
|
||||
{
|
||||
focused.stack_ref().unwrap().add_window(window, None, None);
|
||||
if was_activated {
|
||||
workspace_state.add_workspace_state(&workspace_handle, WState::Urgent);
|
||||
}
|
||||
return (workspace_output == seat.active_output() && active_handle == workspace_handle)
|
||||
.then_some(KeyboardFocusTarget::Element(focused));
|
||||
}
|
||||
|
||||
let mapped = CosmicMapped::from(CosmicWindow::new(
|
||||
|
|
@ -3026,62 +3024,62 @@ impl Shell {
|
|||
|
||||
let spaces = self.workspaces.spaces_mut();
|
||||
let (mut from_w, mut other_w) = spaces.partition::<Vec<_>, _>(|w| w.handle == from);
|
||||
if let Some(from_workspace) = from_w.get_mut(0) {
|
||||
if let Some(to_workspace) = other_w.iter_mut().find(|w| w.handle == to) {
|
||||
{
|
||||
let mut stack = to_workspace.focus_stack.get_mut(seat);
|
||||
for elem in focus_stack.iter().flat_map(|node_id| {
|
||||
from_workspace.tiling_layer.element_for_node(node_id)
|
||||
}) {
|
||||
stack.append(elem.clone());
|
||||
}
|
||||
if let Some(from_workspace) = from_w.get_mut(0)
|
||||
&& let Some(to_workspace) = other_w.iter_mut().find(|w| w.handle == to)
|
||||
{
|
||||
{
|
||||
let mut stack = to_workspace.focus_stack.get_mut(seat);
|
||||
for elem in focus_stack.iter().flat_map(|node_id| {
|
||||
from_workspace.tiling_layer.element_for_node(node_id)
|
||||
}) {
|
||||
stack.append(elem.clone());
|
||||
}
|
||||
|
||||
if to_workspace.tiling_enabled {
|
||||
for mapped in to_workspace
|
||||
.mapped()
|
||||
.filter(|m| m.maximized_state.lock().unwrap().is_some())
|
||||
.cloned()
|
||||
.collect::<Vec<_>>()
|
||||
.into_iter()
|
||||
{
|
||||
to_workspace.unmaximize_request(&mapped);
|
||||
}
|
||||
}
|
||||
|
||||
let res = TilingLayout::move_tree(
|
||||
&mut from_workspace.tiling_layer,
|
||||
&mut to_workspace.tiling_layer,
|
||||
&to,
|
||||
seat,
|
||||
to_workspace.focus_stack.get(seat).iter(),
|
||||
NodeDesc {
|
||||
handle: from,
|
||||
node,
|
||||
stack_window: None,
|
||||
focus_stack,
|
||||
},
|
||||
direction,
|
||||
);
|
||||
from_workspace.refresh_focus_stack();
|
||||
to_workspace.refresh_focus_stack();
|
||||
|
||||
if !to_workspace.tiling_enabled {
|
||||
to_workspace.tiling_enabled = true;
|
||||
for mapped in to_workspace
|
||||
.tiling_layer
|
||||
.mapped()
|
||||
.map(|(mapped, _)| mapped.clone())
|
||||
.collect::<Vec<_>>()
|
||||
.into_iter()
|
||||
{
|
||||
to_workspace.toggle_floating_window(seat, &mapped);
|
||||
}
|
||||
to_workspace.tiling_enabled = false;
|
||||
}
|
||||
|
||||
return Ok(res.zip(new_pos));
|
||||
}
|
||||
|
||||
if to_workspace.tiling_enabled {
|
||||
for mapped in to_workspace
|
||||
.mapped()
|
||||
.filter(|m| m.maximized_state.lock().unwrap().is_some())
|
||||
.cloned()
|
||||
.collect::<Vec<_>>()
|
||||
.into_iter()
|
||||
{
|
||||
to_workspace.unmaximize_request(&mapped);
|
||||
}
|
||||
}
|
||||
|
||||
let res = TilingLayout::move_tree(
|
||||
&mut from_workspace.tiling_layer,
|
||||
&mut to_workspace.tiling_layer,
|
||||
&to,
|
||||
seat,
|
||||
to_workspace.focus_stack.get(seat).iter(),
|
||||
NodeDesc {
|
||||
handle: from,
|
||||
node,
|
||||
stack_window: None,
|
||||
focus_stack,
|
||||
},
|
||||
direction,
|
||||
);
|
||||
from_workspace.refresh_focus_stack();
|
||||
to_workspace.refresh_focus_stack();
|
||||
|
||||
if !to_workspace.tiling_enabled {
|
||||
to_workspace.tiling_enabled = true;
|
||||
for mapped in to_workspace
|
||||
.tiling_layer
|
||||
.mapped()
|
||||
.map(|(mapped, _)| mapped.clone())
|
||||
.collect::<Vec<_>>()
|
||||
.into_iter()
|
||||
{
|
||||
to_workspace.toggle_floating_window(seat, &mapped);
|
||||
}
|
||||
to_workspace.tiling_enabled = false;
|
||||
}
|
||||
|
||||
return Ok(res.zip(new_pos));
|
||||
}
|
||||
|
||||
Ok(None)
|
||||
|
|
@ -3155,12 +3153,10 @@ impl Shell {
|
|||
was_maximized: previous.was_maximized(),
|
||||
},
|
||||
};
|
||||
} else {
|
||||
if let FullscreenRestoreState::Tiling { workspace, .. }
|
||||
| FullscreenRestoreState::Floating { workspace, .. } = previous
|
||||
{
|
||||
*workspace = *to;
|
||||
}
|
||||
} else if let FullscreenRestoreState::Tiling { workspace, .. }
|
||||
| FullscreenRestoreState::Floating { workspace, .. } = previous
|
||||
{
|
||||
*workspace = *to;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3408,20 +3404,19 @@ impl Shell {
|
|||
}
|
||||
|
||||
pub fn update_reactive_popups(&self, mapped: &CosmicMapped) {
|
||||
if let Some(workspace) = self.space_for(mapped) {
|
||||
if let Some(element_loc) = workspace
|
||||
if let Some(workspace) = self.space_for(mapped)
|
||||
&& let Some(element_loc) = workspace
|
||||
.element_geometry(mapped)
|
||||
.map(|geo| geo.loc.to_global(&workspace.output))
|
||||
{
|
||||
for (window, offset) in mapped.windows() {
|
||||
if let Some(toplevel) = window.0.toplevel() {
|
||||
let window_geo_offset = window.geometry().loc.as_global();
|
||||
update_reactive_popups(
|
||||
toplevel,
|
||||
element_loc + offset.as_global() + window_geo_offset,
|
||||
self.outputs(),
|
||||
);
|
||||
}
|
||||
{
|
||||
for (window, offset) in mapped.windows() {
|
||||
if let Some(toplevel) = window.0.toplevel() {
|
||||
let window_geo_offset = window.geometry().loc.as_global();
|
||||
update_reactive_popups(
|
||||
toplevel,
|
||||
element_loc + offset.as_global() + window_geo_offset,
|
||||
self.outputs(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3744,12 +3739,11 @@ impl Shell {
|
|||
None
|
||||
};
|
||||
|
||||
if mapped == old_mapped {
|
||||
if let Some(geo) = sticky_layer.unmap(&mapped, None) {
|
||||
if geo.size != elem_geo.size {
|
||||
new_size = Some(geo.size.as_logical());
|
||||
}
|
||||
}
|
||||
if mapped == old_mapped
|
||||
&& let Some(geo) = sticky_layer.unmap(&mapped, None)
|
||||
&& geo.size != elem_geo.size
|
||||
{
|
||||
new_size = Some(geo.size.as_logical());
|
||||
}
|
||||
|
||||
if let Some(new_size) = new_size {
|
||||
|
|
@ -4404,47 +4398,47 @@ impl Shell {
|
|||
.resize(&focused, direction, edge, amount)
|
||||
{
|
||||
self.resize_state = Some((focused, direction, edge, amount, idx, output));
|
||||
} else if let Some(workspace) = self.workspaces.get_mut(idx, &output) {
|
||||
if workspace.resize(&focused, direction, edge, amount) {
|
||||
self.resize_state = Some((focused, direction, edge, amount, idx, output));
|
||||
}
|
||||
} else if let Some(workspace) = self.workspaces.get_mut(idx, &output)
|
||||
&& workspace.resize(&focused, direction, edge, amount)
|
||||
{
|
||||
self.resize_state = Some((focused, direction, edge, amount, idx, output));
|
||||
}
|
||||
}
|
||||
|
||||
pub fn finish_resize(&mut self, direction: ResizeDirection, edge: ResizeEdge) {
|
||||
if let Some((old_focused, old_direction, old_edge, _, idx, output)) =
|
||||
self.resize_state.take()
|
||||
&& old_direction == direction
|
||||
&& old_edge == edge
|
||||
{
|
||||
if old_direction == direction && old_edge == edge {
|
||||
let Some(toplevel) = old_focused.toplevel() else {
|
||||
return;
|
||||
};
|
||||
let Some(mapped) = self
|
||||
.workspaces
|
||||
.sets
|
||||
.values()
|
||||
.find_map(|set| {
|
||||
set.sticky_layer
|
||||
.mapped()
|
||||
.find(|m| m.has_surface(&toplevel, WindowSurfaceType::TOPLEVEL))
|
||||
})
|
||||
.cloned()
|
||||
.or_else(|| {
|
||||
let workspace = self.workspaces.get(idx, &output).unwrap();
|
||||
workspace
|
||||
.mapped()
|
||||
.find(|m| m.has_surface(&toplevel, WindowSurfaceType::TOPLEVEL))
|
||||
.cloned()
|
||||
})
|
||||
else {
|
||||
return;
|
||||
};
|
||||
let Some(toplevel) = old_focused.toplevel() else {
|
||||
return;
|
||||
};
|
||||
let Some(mapped) = self
|
||||
.workspaces
|
||||
.sets
|
||||
.values()
|
||||
.find_map(|set| {
|
||||
set.sticky_layer
|
||||
.mapped()
|
||||
.find(|m| m.has_surface(&toplevel, WindowSurfaceType::TOPLEVEL))
|
||||
})
|
||||
.cloned()
|
||||
.or_else(|| {
|
||||
let workspace = self.workspaces.get(idx, &output).unwrap();
|
||||
workspace
|
||||
.mapped()
|
||||
.find(|m| m.has_surface(&toplevel, WindowSurfaceType::TOPLEVEL))
|
||||
.cloned()
|
||||
})
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
let mut resize_state = mapped.resize_state.lock().unwrap();
|
||||
if let Some(ResizeState::Resizing(data)) = *resize_state {
|
||||
mapped.set_resizing(false);
|
||||
*resize_state = Some(ResizeState::WaitingForCommit(data));
|
||||
}
|
||||
let mut resize_state = mapped.resize_state.lock().unwrap();
|
||||
if let Some(ResizeState::Resizing(data)) = *resize_state {
|
||||
mapped.set_resizing(false);
|
||||
*resize_state = Some(ResizeState::WaitingForCommit(data));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4520,10 +4514,8 @@ impl Shell {
|
|||
None
|
||||
};
|
||||
|
||||
if was_maximized {
|
||||
if let Some(KeyboardFocusTarget::Element(mapped)) = res.as_ref() {
|
||||
self.maximize_request(mapped, seat, false, loop_handle);
|
||||
}
|
||||
if was_maximized && let Some(KeyboardFocusTarget::Element(mapped)) = res.as_ref() {
|
||||
self.maximize_request(mapped, seat, false, loop_handle);
|
||||
}
|
||||
|
||||
res
|
||||
|
|
|
|||
|
|
@ -112,12 +112,12 @@ impl Devices {
|
|||
.collect::<Vec<_>>();
|
||||
map.insert(id, caps);
|
||||
|
||||
if device.has_capability(DeviceCapability::Keyboard) {
|
||||
if let Some(device) = <dyn Any>::downcast_ref::<InputDevice>(device) {
|
||||
let mut device = device.clone();
|
||||
device.led_update(led_state.into());
|
||||
self.keyboards.borrow_mut().push(device);
|
||||
}
|
||||
if device.has_capability(DeviceCapability::Keyboard)
|
||||
&& let Some(device) = <dyn Any>::downcast_ref::<InputDevice>(device)
|
||||
{
|
||||
let mut device = device.clone();
|
||||
device.led_update(led_state.into());
|
||||
self.keyboards.borrow_mut().push(device);
|
||||
}
|
||||
|
||||
new_caps
|
||||
|
|
@ -385,10 +385,10 @@ impl SeatExt for Seat<State> {
|
|||
let lock = self.user_data().get::<Mutex<CursorImageStatus>>().unwrap();
|
||||
// Reset the cursor if the surface is no longer alive
|
||||
let mut cursor_status = lock.lock().unwrap();
|
||||
if let CursorImageStatus::Surface(ref surface) = *cursor_status {
|
||||
if !surface.alive() {
|
||||
*cursor_status = CursorImageStatus::default_named();
|
||||
}
|
||||
if let CursorImageStatus::Surface(ref surface) = *cursor_status
|
||||
&& !surface.alive()
|
||||
{
|
||||
*cursor_status = CursorImageStatus::default_named();
|
||||
}
|
||||
cursor_status.clone()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -487,11 +487,9 @@ impl Workspace {
|
|||
.unwrap()
|
||||
.lock()
|
||||
.unwrap();
|
||||
let move_mapped = if let Some(move_grab_state) = &*move_grab_state {
|
||||
Some(move_grab_state.element())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let move_mapped = (*move_grab_state)
|
||||
.as_ref()
|
||||
.map(|move_grab_state| move_grab_state.element());
|
||||
|
||||
let mapped = || {
|
||||
self.floating_layer
|
||||
|
|
@ -640,7 +638,7 @@ impl Workspace {
|
|||
})));
|
||||
}
|
||||
|
||||
let was_snapped = mapped.floating_tiled.lock().unwrap().clone();
|
||||
let was_snapped = *mapped.floating_tiled.lock().unwrap();
|
||||
// unmaximize_request might have triggered a `floating_layer.refresh()`,
|
||||
// which may have already removed a non-alive surface.
|
||||
if let Some(floating_geometry) = self.floating_layer.unmap(mapped, None).or(was_maximized) {
|
||||
|
|
@ -695,18 +693,18 @@ impl Workspace {
|
|||
|
||||
let mapped = self.element_for_surface(surface)?;
|
||||
let maybe_stack = mapped.stack_ref().filter(|s| s.len() > 1);
|
||||
if let Some(stack) = maybe_stack {
|
||||
if stack.len() > 1 {
|
||||
let idx = stack.surfaces().position(|s| &s == surface);
|
||||
let layer = if self.is_tiled(surface) {
|
||||
ManagedLayer::Tiling
|
||||
} else {
|
||||
ManagedLayer::Floating
|
||||
};
|
||||
return idx
|
||||
.and_then(|idx| stack.remove_idx(idx))
|
||||
.map(|s| (s, layer.into()));
|
||||
}
|
||||
if let Some(stack) = maybe_stack
|
||||
&& stack.len() > 1
|
||||
{
|
||||
let idx = stack.surfaces().position(|s| &s == surface);
|
||||
let layer = if self.is_tiled(surface) {
|
||||
ManagedLayer::Tiling
|
||||
} else {
|
||||
ManagedLayer::Floating
|
||||
};
|
||||
return idx
|
||||
.and_then(|idx| stack.remove_idx(idx))
|
||||
.map(|s| (s, layer.into()));
|
||||
}
|
||||
|
||||
// we know mapped is no stack with more than one element now,
|
||||
|
|
@ -774,25 +772,25 @@ impl Workspace {
|
|||
let stack = self.focus_stack.get(seat);
|
||||
let last_focused = stack.last();
|
||||
|
||||
if let Some(fullscreen) = self.fullscreen.as_ref() {
|
||||
if last_focused.is_some_and(
|
||||
if let Some(fullscreen) = self.fullscreen.as_ref()
|
||||
&& last_focused.is_some_and(
|
||||
|t| matches!(t, FocusTarget::Fullscreen(f) if f == &fullscreen.surface),
|
||||
) && !fullscreen.is_animating()
|
||||
{
|
||||
let geometry = self.fullscreen_geometry().unwrap();
|
||||
return fullscreen_element_under(fullscreen, geometry);
|
||||
}
|
||||
)
|
||||
&& !fullscreen.is_animating()
|
||||
{
|
||||
let geometry = self.fullscreen_geometry().unwrap();
|
||||
return fullscreen_element_under(fullscreen, geometry);
|
||||
}
|
||||
|
||||
self.floating_layer
|
||||
.popup_element_under(location)
|
||||
.or_else(|| self.tiling_layer.popup_element_under(location))
|
||||
.or_else(|| {
|
||||
if last_focused.is_none_or(|t| !matches!(t, FocusTarget::Fullscreen(_))) {
|
||||
if let Some(fullscreen) = self.fullscreen.as_ref() {
|
||||
let geometry = self.fullscreen_geometry().unwrap();
|
||||
return fullscreen_element_under(fullscreen, geometry);
|
||||
}
|
||||
if last_focused.is_none_or(|t| !matches!(t, FocusTarget::Fullscreen(_)))
|
||||
&& let Some(fullscreen) = self.fullscreen.as_ref()
|
||||
{
|
||||
let geometry = self.fullscreen_geometry().unwrap();
|
||||
return fullscreen_element_under(fullscreen, geometry);
|
||||
}
|
||||
None
|
||||
})
|
||||
|
|
@ -824,25 +822,25 @@ impl Workspace {
|
|||
let stack = self.focus_stack.get(seat);
|
||||
let last_focused = stack.last();
|
||||
|
||||
if let Some(fullscreen) = self.fullscreen.as_ref() {
|
||||
if last_focused.is_some_and(
|
||||
if let Some(fullscreen) = self.fullscreen.as_ref()
|
||||
&& last_focused.is_some_and(
|
||||
|t| matches!(t, FocusTarget::Fullscreen(f) if f == &fullscreen.surface),
|
||||
) && !fullscreen.is_animating()
|
||||
{
|
||||
let geometry = self.fullscreen_geometry().unwrap();
|
||||
return fullscreen_element_under(fullscreen, geometry);
|
||||
}
|
||||
)
|
||||
&& !fullscreen.is_animating()
|
||||
{
|
||||
let geometry = self.fullscreen_geometry().unwrap();
|
||||
return fullscreen_element_under(fullscreen, geometry);
|
||||
}
|
||||
|
||||
self.floating_layer
|
||||
.toplevel_element_under(location)
|
||||
.or_else(|| self.tiling_layer.toplevel_element_under(location))
|
||||
.or_else(|| {
|
||||
if last_focused.is_none_or(|t| !matches!(t, FocusTarget::Fullscreen(_))) {
|
||||
if let Some(fullscreen) = self.fullscreen.as_ref() {
|
||||
let geometry = self.fullscreen_geometry().unwrap();
|
||||
return fullscreen_element_under(fullscreen, geometry);
|
||||
}
|
||||
if last_focused.is_none_or(|t| !matches!(t, FocusTarget::Fullscreen(_)))
|
||||
&& let Some(fullscreen) = self.fullscreen.as_ref()
|
||||
{
|
||||
let geometry = self.fullscreen_geometry().unwrap();
|
||||
return fullscreen_element_under(fullscreen, geometry);
|
||||
}
|
||||
None
|
||||
})
|
||||
|
|
@ -1071,7 +1069,7 @@ impl Workspace {
|
|||
mapped.set_minimized(true);
|
||||
mapped.configure();
|
||||
|
||||
let was_snapped = mapped.floating_tiled.lock().unwrap().clone();
|
||||
let was_snapped = *mapped.floating_tiled.lock().unwrap();
|
||||
if let Some(geometry) = self.floating_layer.unmap(&mapped, Some(to)) {
|
||||
return Some(MinimizedWindow::Floating {
|
||||
window: mapped,
|
||||
|
|
|
|||
|
|
@ -232,24 +232,24 @@ impl ZoomState {
|
|||
let active_output = self.seat.active_output();
|
||||
let output = output.unwrap_or(&active_output);
|
||||
let output_state = output.user_data().get::<Mutex<OutputZoomState>>().unwrap();
|
||||
let res = output_state
|
||||
|
||||
output_state
|
||||
.lock()
|
||||
.unwrap()
|
||||
.animating_focal_point()
|
||||
.to_global(output);
|
||||
res
|
||||
.to_global(output)
|
||||
}
|
||||
|
||||
pub fn current_focal_point(&self, output: Option<&Output>) -> Point<f64, Global> {
|
||||
let active_output = self.seat.active_output();
|
||||
let output = output.unwrap_or(&active_output);
|
||||
let output_state = output.user_data().get::<Mutex<OutputZoomState>>().unwrap();
|
||||
let res = output_state
|
||||
|
||||
output_state
|
||||
.lock()
|
||||
.unwrap()
|
||||
.current_focal_point()
|
||||
.to_global(output);
|
||||
res
|
||||
.to_global(output)
|
||||
}
|
||||
|
||||
pub fn update_focal_point(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue