mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-21 02:01:55 +07:00
Move CastTarget to src/niri.rs
This commit is contained in:
@@ -21,7 +21,7 @@ use smithay::{delegate_compositor, delegate_shm};
|
||||
use super::xdg_shell::add_mapped_toplevel_pre_commit_hook;
|
||||
use crate::handlers::XDG_ACTIVATION_TOKEN_TIMEOUT;
|
||||
use crate::layout::{ActivateWindow, AddWindowTarget};
|
||||
use crate::niri::{ClientState, LockState, State};
|
||||
use crate::niri::{CastTarget, ClientState, LockState, State};
|
||||
use crate::utils::transaction::Transaction;
|
||||
use crate::utils::{is_mapped, send_scale_transform};
|
||||
use crate::window::{InitialConfigureState, Mapped, ResolvedWindowRules, Unmapped};
|
||||
@@ -220,7 +220,6 @@ impl CompositorHandler for State {
|
||||
let window = mapped.window.clone();
|
||||
let output = output.cloned();
|
||||
|
||||
#[cfg(feature = "xdp-gnome-screencast")]
|
||||
let id = mapped.id();
|
||||
|
||||
// This is a commit of a previously-mapped toplevel.
|
||||
@@ -246,11 +245,8 @@ impl CompositorHandler for State {
|
||||
let active_window = self.niri.layout.focus().map(|m| &m.window);
|
||||
let was_active = active_window == Some(&window);
|
||||
|
||||
#[cfg(feature = "xdp-gnome-screencast")]
|
||||
self.niri
|
||||
.stop_casts_for_target(crate::pw_utils::CastTarget::Window {
|
||||
id: id.get(),
|
||||
});
|
||||
.stop_casts_for_target(CastTarget::Window { id: id.get() });
|
||||
|
||||
self.niri.layout.remove_window(&window, transaction.clone());
|
||||
self.add_default_dmabuf_pre_commit_hook(surface);
|
||||
|
||||
@@ -43,7 +43,7 @@ use crate::input::resize_grab::ResizeGrab;
|
||||
use crate::input::touch_move_grab::TouchMoveGrab;
|
||||
use crate::input::touch_resize_grab::TouchResizeGrab;
|
||||
use crate::input::{PointerOrTouchStartData, DOUBLE_CLICK_TIME};
|
||||
use crate::niri::{PopupGrabState, State};
|
||||
use crate::niri::{CastTarget, PopupGrabState, State};
|
||||
use crate::utils::transaction::Transaction;
|
||||
use crate::utils::{
|
||||
get_monotonic_time, output_matches_name, send_scale_transform, update_tiled_state, ResizeEdge,
|
||||
@@ -647,11 +647,9 @@ impl XdgShellHandler for State {
|
||||
let window = mapped.window.clone();
|
||||
let output = output.cloned();
|
||||
|
||||
#[cfg(feature = "xdp-gnome-screencast")]
|
||||
self.niri
|
||||
.stop_casts_for_target(crate::pw_utils::CastTarget::Window {
|
||||
id: mapped.id().get(),
|
||||
});
|
||||
self.niri.stop_casts_for_target(CastTarget::Window {
|
||||
id: mapped.id().get(),
|
||||
});
|
||||
|
||||
self.backend.with_primary_renderer(|renderer| {
|
||||
self.niri.layout.store_unmap_snapshot(renderer, &window);
|
||||
|
||||
+11
-2
@@ -47,7 +47,7 @@ use smithay::desktop::{
|
||||
use smithay::input::keyboard::Layout as KeyboardLayout;
|
||||
use smithay::input::pointer::{CursorIcon, CursorImageStatus, CursorImageSurfaceData, MotionEvent};
|
||||
use smithay::input::{Seat, SeatState};
|
||||
use smithay::output::{self, Output, OutputModeSource, PhysicalProperties, Subpixel};
|
||||
use smithay::output::{self, Output, OutputModeSource, PhysicalProperties, Subpixel, WeakOutput};
|
||||
use smithay::reexports::calloop::generic::Generic;
|
||||
use smithay::reexports::calloop::timer::{TimeoutAction, Timer};
|
||||
use smithay::reexports::calloop::{
|
||||
@@ -138,7 +138,7 @@ use crate::protocols::screencopy::{Screencopy, ScreencopyBuffer, ScreencopyManag
|
||||
use crate::protocols::virtual_pointer::VirtualPointerManagerState;
|
||||
use crate::pw_utils::{Cast, PipeWire};
|
||||
#[cfg(feature = "xdp-gnome-screencast")]
|
||||
use crate::pw_utils::{CastSizeChange, CastTarget, PwToNiri};
|
||||
use crate::pw_utils::{CastSizeChange, PwToNiri};
|
||||
use crate::render_helpers::debug::draw_opaque_regions;
|
||||
use crate::render_helpers::primary_gpu_texture::PrimaryGpuTextureRenderElement;
|
||||
use crate::render_helpers::renderer::NiriRenderer;
|
||||
@@ -508,6 +508,12 @@ pub enum CenterCoords {
|
||||
Both,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
pub enum CastTarget {
|
||||
Output(WeakOutput),
|
||||
Window { id: u64 },
|
||||
}
|
||||
|
||||
impl RedrawState {
|
||||
fn queue_redraw(self) -> Self {
|
||||
match self {
|
||||
@@ -4584,6 +4590,9 @@ impl Niri {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "xdp-gnome-screencast"))]
|
||||
pub fn stop_casts_for_target(&mut self, _target: CastTarget) {}
|
||||
|
||||
#[cfg(feature = "xdp-gnome-screencast")]
|
||||
pub fn stop_casts_for_target(&mut self, target: CastTarget) {
|
||||
let _span = tracy_client::span!("Niri::stop_casts_for_target");
|
||||
|
||||
+2
-8
@@ -36,7 +36,7 @@ use smithay::backend::drm::DrmDeviceFd;
|
||||
use smithay::backend::renderer::damage::OutputDamageTracker;
|
||||
use smithay::backend::renderer::element::RenderElement;
|
||||
use smithay::backend::renderer::gles::GlesRenderer;
|
||||
use smithay::output::{Output, OutputModeSource, WeakOutput};
|
||||
use smithay::output::{Output, OutputModeSource};
|
||||
use smithay::reexports::calloop::generic::Generic;
|
||||
use smithay::reexports::calloop::{Interest, LoopHandle, Mode, PostAction};
|
||||
use smithay::reexports::gbm::Modifier;
|
||||
@@ -44,7 +44,7 @@ use smithay::utils::{Physical, Scale, Size, Transform};
|
||||
use zbus::object_server::SignalEmitter;
|
||||
|
||||
use crate::dbus::mutter_screen_cast::{self, CursorMode};
|
||||
use crate::niri::State;
|
||||
use crate::niri::{CastTarget, State};
|
||||
use crate::render_helpers::render_to_dmabuf;
|
||||
use crate::utils::get_monotonic_time;
|
||||
|
||||
@@ -109,12 +109,6 @@ pub enum CastSizeChange {
|
||||
Pending,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
pub enum CastTarget {
|
||||
Output(WeakOutput),
|
||||
Window { id: u64 },
|
||||
}
|
||||
|
||||
macro_rules! make_params {
|
||||
($params:ident, $formats:expr, $size:expr, $refresh:expr, $alpha:expr) => {
|
||||
let mut b1 = Vec::new();
|
||||
|
||||
Reference in New Issue
Block a user