Add workspace_overview_is_open function; put in a utils::quirks mod
This is increasingly not just related to screencopy, so it's weird to add there. I don't see any other module that fits, so add one called "quirks" (like the Linux kernel uses for device-specific handling in generic drives).
This commit is contained in:
parent
355b142c52
commit
0636bcdef3
6 changed files with 24 additions and 16 deletions
|
|
@ -7,11 +7,9 @@ use crate::{
|
|||
},
|
||||
shell::Shell,
|
||||
state::SurfaceDmabufFeedback,
|
||||
utils::prelude::*,
|
||||
utils::{prelude::*, quirks::workspace_overview_is_open},
|
||||
wayland::{
|
||||
handlers::screencopy::{
|
||||
submit_buffer, FrameHolder, SessionData, WORKSPACE_OVERVIEW_NAMESPACE,
|
||||
},
|
||||
handlers::screencopy::{submit_buffer, FrameHolder, SessionData},
|
||||
protocols::screencopy::{
|
||||
FailureReason, Frame as ScreencopyFrame, Session as ScreencopySession,
|
||||
},
|
||||
|
|
@ -48,7 +46,7 @@ use smithay::{
|
|||
Bind, ImportDma, Offscreen, Renderer, Texture,
|
||||
},
|
||||
},
|
||||
desktop::{layer_map_for_output, utils::OutputPresentationFeedback},
|
||||
desktop::utils::OutputPresentationFeedback,
|
||||
output::{Output, OutputNoMode},
|
||||
reexports::{
|
||||
calloop::{
|
||||
|
|
@ -871,10 +869,7 @@ impl SurfaceThreadState {
|
|||
|
||||
std::mem::drop(shell);
|
||||
|
||||
let element_filter = if layer_map_for_output(output)
|
||||
.layers()
|
||||
.any(|s| s.namespace() == WORKSPACE_OVERVIEW_NAMESPACE)
|
||||
{
|
||||
let element_filter = if workspace_overview_is_open(output) {
|
||||
ElementFilter::LayerShellOnly
|
||||
} else {
|
||||
ElementFilter::All
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ use crate::{
|
|||
CosmicMappedRenderElement, OverviewMode, SeatExt, SessionLock, Trigger, WorkspaceDelta,
|
||||
WorkspaceRenderElement,
|
||||
},
|
||||
utils::prelude::*,
|
||||
utils::{prelude::*, quirks::WORKSPACE_OVERVIEW_NAMESPACE},
|
||||
wayland::{
|
||||
handlers::{
|
||||
data_device::get_dnd_icon,
|
||||
screencopy::{render_session, FrameHolder, SessionData, WORKSPACE_OVERVIEW_NAMESPACE},
|
||||
screencopy::{render_session, FrameHolder, SessionData},
|
||||
},
|
||||
protocols::workspace::WorkspaceHandle,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -52,11 +52,11 @@ use smithay::{
|
|||
use crate::{
|
||||
backend::render::animations::spring::{Spring, SpringParams},
|
||||
config::Config,
|
||||
utils::prelude::*,
|
||||
utils::{prelude::*, quirks::WORKSPACE_OVERVIEW_NAMESPACE},
|
||||
wayland::{
|
||||
handlers::{
|
||||
screencopy::WORKSPACE_OVERVIEW_NAMESPACE, toplevel_management::minimize_rectangle,
|
||||
xdg_activation::ActivationContext, xdg_shell::popup::get_popup_toplevel,
|
||||
toplevel_management::minimize_rectangle, xdg_activation::ActivationContext,
|
||||
xdg_shell::popup::get_popup_toplevel,
|
||||
},
|
||||
protocols::{
|
||||
toplevel_info::{
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ pub(crate) use self::ids::id_gen;
|
|||
pub mod geometry;
|
||||
pub mod iced;
|
||||
pub mod prelude;
|
||||
pub mod quirks;
|
||||
pub mod rlimit;
|
||||
pub mod screenshot;
|
||||
pub mod tween;
|
||||
|
|
|
|||
14
src/utils/quirks.rs
Normal file
14
src/utils/quirks.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use smithay::{desktop::layer_map_for_output, output::Output};
|
||||
|
||||
/// Layer shell namespace used by `cosmic-workspaces`
|
||||
// TODO: Avoid special case, or add protocol to expose required behavior
|
||||
pub const WORKSPACE_OVERVIEW_NAMESPACE: &str = "cosmic-workspace-overview";
|
||||
|
||||
/// Check if a workspace overview shell surface is open on the output
|
||||
pub fn workspace_overview_is_open(output: &Output) -> bool {
|
||||
layer_map_for_output(output)
|
||||
.layers()
|
||||
.any(|s| s.namespace() == WORKSPACE_OVERVIEW_NAMESPACE)
|
||||
}
|
||||
|
|
@ -39,8 +39,6 @@ pub use self::render::*;
|
|||
use self::user_data::*;
|
||||
pub use self::user_data::{FrameHolder, ScreencopySessions, SessionData, SessionHolder};
|
||||
|
||||
pub const WORKSPACE_OVERVIEW_NAMESPACE: &str = "cosmic-workspace-overview";
|
||||
|
||||
impl ScreencopyHandler for State {
|
||||
fn screencopy_state(&mut self) -> &mut ScreencopyState {
|
||||
&mut self.common.screencopy_state
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue