shell: Move seats into shell
This commit is contained in:
parent
1216cd0b67
commit
647deb81f1
31 changed files with 824 additions and 883 deletions
|
|
@ -78,7 +78,10 @@ impl State {
|
|||
});
|
||||
if !initial_configure_sent {
|
||||
// compute initial dimensions by mapping
|
||||
Shell::map_layer(self, &surface);
|
||||
if let Some(target) = self.common.shell.map_layer(&surface) {
|
||||
let seat = self.common.shell.seats.last_active().clone();
|
||||
Shell::set_focus(self, Some(&target), &seat, None);
|
||||
}
|
||||
surface.layer_surface().send_configure();
|
||||
}
|
||||
initial_configure_sent
|
||||
|
|
@ -159,7 +162,14 @@ impl CompositorHandler for State {
|
|||
.unwrap_or(false)
|
||||
{
|
||||
window.on_commit();
|
||||
Shell::map_window(self, &window);
|
||||
if let Some(target) = self.common.shell.map_window(
|
||||
&window,
|
||||
&self.common.event_loop_handle,
|
||||
&self.common.theme,
|
||||
) {
|
||||
let seat = self.common.shell.seats.last_active().clone();
|
||||
Shell::set_focus(self, Some(&target), &seat, None);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -187,7 +197,7 @@ impl CompositorHandler for State {
|
|||
// session-lock disallows null commits
|
||||
|
||||
// if it was a move-grab?
|
||||
let seat = self.common.last_active_seat().clone();
|
||||
let seat = self.common.shell.seats.last_active().clone();
|
||||
let moved_window = seat
|
||||
.user_data()
|
||||
.get::<SeatMoveGrabState>()
|
||||
|
|
|
|||
|
|
@ -45,10 +45,7 @@ impl FractionalScaleHandler for State {
|
|||
.cloned()
|
||||
})
|
||||
})
|
||||
.unwrap_or_else(|| {
|
||||
let seat = self.common.last_active_seat();
|
||||
seat.active_output()
|
||||
});
|
||||
.unwrap_or_else(|| self.common.shell.seats.last_active().active_output());
|
||||
|
||||
with_states(&surface, |states| {
|
||||
with_fractional_scale(states, |fractional_scale| {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ impl WlrLayerShellHandler for State {
|
|||
_layer: Layer,
|
||||
namespace: String,
|
||||
) {
|
||||
let seat = self.common.last_active_seat().clone();
|
||||
let seat = self.common.shell.seats.last_active().clone();
|
||||
let output = wl_output
|
||||
.as_ref()
|
||||
.and_then(Output::from_resource)
|
||||
|
|
|
|||
|
|
@ -82,12 +82,10 @@ impl State {
|
|||
}
|
||||
}
|
||||
|
||||
let seats = self.common.seats().cloned().collect::<Vec<_>>();
|
||||
if let Err(err) = self.backend.apply_config_for_output(
|
||||
output,
|
||||
test_only,
|
||||
&mut self.common.shell,
|
||||
seats.iter().cloned(),
|
||||
&self.common.event_loop_handle,
|
||||
) {
|
||||
warn!(
|
||||
|
|
@ -109,7 +107,6 @@ impl State {
|
|||
output,
|
||||
false,
|
||||
&mut self.common.shell,
|
||||
seats.iter().cloned(),
|
||||
&self.common.event_loop_handle,
|
||||
) {
|
||||
error!(?err, "Failed to reset output config for {}.", output.name(),);
|
||||
|
|
|
|||
|
|
@ -64,7 +64,9 @@ impl ScreencopyHandler for State {
|
|||
fn capture_cursor_source(&mut self, _source: &ImageSourceData) -> Option<BufferConstraints> {
|
||||
let size = if let Some((geometry, _)) = self
|
||||
.common
|
||||
.last_active_seat()
|
||||
.shell
|
||||
.seats
|
||||
.last_active()
|
||||
.cursor_geometry((0.0, 0.0), self.common.clock.now())
|
||||
{
|
||||
geometry.size
|
||||
|
|
@ -125,7 +127,7 @@ impl ScreencopyHandler for State {
|
|||
}
|
||||
fn new_cursor_session(&mut self, session: CursorSession) {
|
||||
let (pointer_loc, pointer_size, hotspot) = {
|
||||
let seat = self.common.last_active_seat();
|
||||
let seat = self.common.shell.seats.last_active();
|
||||
|
||||
let pointer = seat.get_pointer().unwrap();
|
||||
let pointer_loc = pointer.current_location().to_i32_round().as_global();
|
||||
|
|
@ -266,7 +268,7 @@ impl ScreencopyHandler for State {
|
|||
return;
|
||||
}
|
||||
|
||||
let seat = self.common.last_active_seat().clone();
|
||||
let seat = self.common.shell.seats.last_active().clone();
|
||||
render_cursor_to_buffer(self, &session, frame, &seat);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -286,7 +286,10 @@ pub fn render_workspace_to_buffer(
|
|||
dt,
|
||||
age,
|
||||
additional_damage,
|
||||
common,
|
||||
&common.shell,
|
||||
&common.config,
|
||||
&common.theme,
|
||||
common.clock.now(),
|
||||
&output,
|
||||
None,
|
||||
handle,
|
||||
|
|
@ -311,7 +314,10 @@ pub fn render_workspace_to_buffer(
|
|||
dt,
|
||||
age,
|
||||
additional_damage,
|
||||
common,
|
||||
&common.shell,
|
||||
&common.config,
|
||||
&common.theme,
|
||||
common.clock.now(),
|
||||
&output,
|
||||
None,
|
||||
handle,
|
||||
|
|
@ -529,7 +535,7 @@ pub fn render_window_to_buffer(
|
|||
.map(Into::<WindowCaptureElement<R>>::into),
|
||||
);
|
||||
|
||||
let seat = common.last_active_seat().clone();
|
||||
let seat = common.shell.seats.last_active().clone();
|
||||
if let Some(location) = {
|
||||
if let Some(mapped) = common.shell.element_for_surface(window) {
|
||||
mapped.cursor_position(&seat).and_then(|mut p| {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use crate::{
|
||||
input::Devices,
|
||||
shell::focus::target::{KeyboardFocusTarget, PointerFocusTarget},
|
||||
shell::Devices,
|
||||
state::State,
|
||||
};
|
||||
use smithay::{
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ impl ToplevelManagementHandler for State {
|
|||
.any(|w| &w == window)
|
||||
});
|
||||
if let Some((idx, workspace)) = maybe {
|
||||
let seat = seat.unwrap_or(self.common.last_active_seat().clone());
|
||||
let seat = seat.unwrap_or(self.common.shell.seats.last_active().clone());
|
||||
let mapped = workspace
|
||||
.mapped()
|
||||
.find(|m| m.windows().any(|(w, _)| &w == window))
|
||||
|
|
@ -66,7 +66,7 @@ impl ToplevelManagementHandler for State {
|
|||
WorkspaceDelta::new_shortcut(),
|
||||
); // TODO: Move pointer?
|
||||
mapped.focus_window(window);
|
||||
Common::set_focus(self, Some(&mapped.clone().into()), &seat, None);
|
||||
Shell::set_focus(self, Some(&mapped.clone().into()), &seat, None);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -104,7 +104,17 @@ impl ToplevelManagementHandler for State {
|
|||
.unwrap()
|
||||
.clone();
|
||||
let from_handle = from_workspace.handle;
|
||||
let _ = Shell::move_window(self, None, &mapped, &from_handle, &to_handle, false, None);
|
||||
let seat = self.common.shell.seats.last_active().clone();
|
||||
if let Some((target, _)) = self.common.shell.move_window(
|
||||
Some(&seat),
|
||||
&mapped,
|
||||
&from_handle,
|
||||
&to_handle,
|
||||
false,
|
||||
None,
|
||||
) {
|
||||
Shell::set_focus(self, Some(&target), &seat, None);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -115,7 +125,7 @@ impl ToplevelManagementHandler for State {
|
|||
window: &<Self as ToplevelInfoHandler>::Window,
|
||||
output: Option<Output>,
|
||||
) {
|
||||
let seat = self.common.last_active_seat().clone();
|
||||
let seat = self.common.shell.seats.last_active().clone();
|
||||
if let Some(mapped) = self.common.shell.element_for_surface(window).cloned() {
|
||||
if let Some(output) = output {
|
||||
let from = self
|
||||
|
|
@ -177,7 +187,7 @@ impl ToplevelManagementHandler for State {
|
|||
|
||||
fn maximize(&mut self, _dh: &DisplayHandle, window: &<Self as ToplevelInfoHandler>::Window) {
|
||||
if let Some(mapped) = self.common.shell.element_for_surface(window).cloned() {
|
||||
let seat = self.common.last_active_seat().clone();
|
||||
let seat = self.common.shell.seats.last_active().clone();
|
||||
self.common.shell.maximize_request(&mapped, &seat);
|
||||
}
|
||||
}
|
||||
|
|
@ -198,7 +208,7 @@ impl ToplevelManagementHandler for State {
|
|||
|
||||
fn unminimize(&mut self, _dh: &DisplayHandle, window: &<Self as ToplevelInfoHandler>::Window) {
|
||||
if let Some(mut mapped) = self.common.shell.element_for_surface(window).cloned() {
|
||||
let seat = self.common.last_active_seat().clone();
|
||||
let seat = self.common.shell.seats.last_active().clone();
|
||||
self.common.shell.unminimize_request(&mapped, &seat);
|
||||
if mapped.is_stack() {
|
||||
mapped.stack_ref_mut().unwrap().set_active(window);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ impl WorkspaceHandler for State {
|
|||
}
|
||||
}
|
||||
Request::SetTilingState { workspace, state } => {
|
||||
let seat = self.common.last_active_seat().clone();
|
||||
let seat = self.common.shell.seats.last_active().clone();
|
||||
if let Some(workspace) = self
|
||||
.common
|
||||
.shell
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ impl XdgActivationHandler for State {
|
|||
}
|
||||
}
|
||||
ActivationContext::Workspace(workspace) => {
|
||||
let seat = self.common.last_active_seat().clone();
|
||||
let seat = self.common.shell.seats.last_active().clone();
|
||||
let current_output = seat.active_output();
|
||||
|
||||
if element.is_minimized() {
|
||||
|
|
@ -159,7 +159,7 @@ impl XdgActivationHandler for State {
|
|||
.space_for(&element)
|
||||
.map(|w| w.handle.clone())
|
||||
{
|
||||
Shell::append_focus_stack(self, &element, &seat);
|
||||
self.common.shell.append_focus_stack(&element, &seat);
|
||||
self.common.shell.set_urgent(&w);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ impl XdgShellHandler for State {
|
|||
}
|
||||
|
||||
fn new_toplevel(&mut self, surface: ToplevelSurface) {
|
||||
let seat = self.common.last_active_seat().clone();
|
||||
let seat = self.common.shell.seats.last_active().clone();
|
||||
let window = CosmicSurface::from(surface);
|
||||
self.common.shell.pending_windows.push((window, seat, None));
|
||||
// We will position the window after the first commit, when we know its size hints
|
||||
|
|
@ -90,7 +90,7 @@ impl XdgShellHandler for State {
|
|||
grab.ungrab(PopupUngrabStrategy::All);
|
||||
return;
|
||||
}
|
||||
Common::set_focus(self, grab.current_grab().as_ref(), &seat, Some(serial));
|
||||
Shell::set_focus(self, grab.current_grab().as_ref(), &seat, Some(serial));
|
||||
keyboard.set_grab(PopupKeyboardGrab::new(&grab), serial);
|
||||
}
|
||||
|
||||
|
|
@ -183,7 +183,7 @@ impl XdgShellHandler for State {
|
|||
.element_for_surface(surface.wl_surface())
|
||||
.cloned()
|
||||
{
|
||||
let seat = self.common.last_active_seat().clone();
|
||||
let seat = self.common.shell.seats.last_active().clone();
|
||||
self.common.shell.maximize_request(&mapped, &seat)
|
||||
}
|
||||
}
|
||||
|
|
@ -200,7 +200,7 @@ impl XdgShellHandler for State {
|
|||
}
|
||||
|
||||
fn fullscreen_request(&mut self, surface: ToplevelSurface, output: Option<WlOutput>) {
|
||||
let seat = self.common.last_active_seat().clone();
|
||||
let seat = self.common.shell.seats.last_active().clone();
|
||||
let active_output = seat.active_output();
|
||||
let output = output
|
||||
.as_ref()
|
||||
|
|
@ -378,7 +378,7 @@ impl XdgShellHandler for State {
|
|||
}
|
||||
|
||||
fn toplevel_destroyed(&mut self, surface: ToplevelSurface) {
|
||||
let seat = self.common.last_active_seat().clone();
|
||||
let seat = self.common.shell.seats.last_active().clone();
|
||||
self.common.shell.unmap_surface(surface.wl_surface(), &seat);
|
||||
|
||||
let output = self
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue