shell: Unify element_for_(x11_|wl_)surface
This commit is contained in:
parent
dbe2a073ef
commit
6858238bd6
13 changed files with 56 additions and 105 deletions
|
|
@ -711,7 +711,7 @@ impl Program for CosmicStackInternal {
|
|||
if let Some(surface) = self.windows.lock().unwrap()[active].wl_surface() {
|
||||
loop_handle.insert_idle(move |state| {
|
||||
if let Some(mapped) =
|
||||
state.common.shell.element_for_wl_surface(&surface).cloned()
|
||||
state.common.shell.element_for_surface(&surface).cloned()
|
||||
{
|
||||
let position = if let Some((output, set)) =
|
||||
state.common.shell.workspaces.sets.iter().find(|(_, set)| {
|
||||
|
|
@ -757,7 +757,7 @@ impl Program for CosmicStackInternal {
|
|||
if let Some(surface) = self.windows.lock().unwrap()[idx].wl_surface() {
|
||||
loop_handle.insert_idle(move |state| {
|
||||
if let Some(mapped) =
|
||||
state.common.shell.element_for_wl_surface(&surface).cloned()
|
||||
state.common.shell.element_for_surface(&surface).cloned()
|
||||
{
|
||||
if let Some(workspace) = state.common.shell.space_for_mut(&mapped) {
|
||||
let Some(elem_geo) = workspace.element_geometry(&mapped) else {
|
||||
|
|
|
|||
|
|
@ -73,6 +73,18 @@ impl From<X11Surface> for CosmicSurface {
|
|||
}
|
||||
}
|
||||
|
||||
impl PartialEq<WlSurface> for CosmicSurface {
|
||||
fn eq(&self, other: &WlSurface) -> bool {
|
||||
self.wl_surface().map_or(false, |s| &s == other)
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq<X11Surface> for CosmicSurface {
|
||||
fn eq(&self, other: &X11Surface) -> bool {
|
||||
self.x11_surface().map_or(false, |s| s == other)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct Minimized(AtomicBool);
|
||||
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ impl Program for CosmicWindowInternal {
|
|||
if let Some(surface) = self.window.wl_surface() {
|
||||
loop_handle.insert_idle(move |state| {
|
||||
if let Some(mapped) =
|
||||
state.common.shell.element_for_wl_surface(&surface).cloned()
|
||||
state.common.shell.element_for_surface(&surface).cloned()
|
||||
{
|
||||
state.common.shell.minimize_request(&mapped)
|
||||
}
|
||||
|
|
@ -300,7 +300,7 @@ impl Program for CosmicWindowInternal {
|
|||
if let Some(surface) = self.window.wl_surface() {
|
||||
loop_handle.insert_idle(move |state| {
|
||||
if let Some(mapped) =
|
||||
state.common.shell.element_for_wl_surface(&surface).cloned()
|
||||
state.common.shell.element_for_surface(&surface).cloned()
|
||||
{
|
||||
let seat = state.common.last_active_seat().clone();
|
||||
state.common.shell.maximize_toggle(&mapped, &seat)
|
||||
|
|
@ -314,7 +314,7 @@ impl Program for CosmicWindowInternal {
|
|||
if let Some(surface) = self.window.wl_surface() {
|
||||
loop_handle.insert_idle(move |state| {
|
||||
if let Some(mapped) =
|
||||
state.common.shell.element_for_wl_surface(&surface).cloned()
|
||||
state.common.shell.element_for_surface(&surface).cloned()
|
||||
{
|
||||
let position = if let Some((output, set)) =
|
||||
state.common.shell.workspaces.sets.iter().find(|(_, set)| {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue