mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2025-01-30 20:34:49 +01:00
Update scanout output for cursor surfaces
Also schedule render when they commit
This commit is contained in:
parent
f1bcd8357b
commit
fca6a6c5f5
4 changed files with 87 additions and 11 deletions
|
@ -423,6 +423,15 @@ impl CompositorHandler for State {
|
||||||
.cloned()
|
.cloned()
|
||||||
{
|
{
|
||||||
vec![output] // surface is a layer surface
|
vec![output] // surface is a layer surface
|
||||||
|
} else if matches!(self.pinnacle.cursor_state.cursor_image(), CursorImageStatus::Surface(s) if s == surface)
|
||||||
|
{
|
||||||
|
// This is a cursor surface
|
||||||
|
// TODO: granular
|
||||||
|
self.pinnacle.space.outputs().cloned().collect()
|
||||||
|
} else if self.pinnacle.dnd_icon.as_ref() == Some(surface) {
|
||||||
|
// This is a dnd icon
|
||||||
|
// TODO: granular
|
||||||
|
self.pinnacle.space.outputs().cloned().collect()
|
||||||
} else if let Some(output) = self
|
} else if let Some(output) = self
|
||||||
.pinnacle
|
.pinnacle
|
||||||
.space
|
.space
|
||||||
|
|
|
@ -7,18 +7,14 @@ use std::{
|
||||||
|
|
||||||
use smithay::{
|
use smithay::{
|
||||||
backend::renderer::element::{
|
backend::renderer::element::{
|
||||||
self,
|
surface::WaylandSurfaceRenderElement, utils::RescaleRenderElement, Element,
|
||||||
surface::WaylandSurfaceRenderElement,
|
|
||||||
texture::{TextureBuffer, TextureRenderElement},
|
|
||||||
utils::RescaleRenderElement,
|
|
||||||
Element,
|
|
||||||
},
|
},
|
||||||
desktop::Space,
|
desktop::Space,
|
||||||
reexports::calloop::{
|
reexports::calloop::{
|
||||||
timer::{TimeoutAction, Timer},
|
timer::{TimeoutAction, Timer},
|
||||||
LoopHandle,
|
LoopHandle,
|
||||||
},
|
},
|
||||||
utils::{Logical, Point, Scale, Serial, Transform},
|
utils::{Logical, Point, Scale, Serial},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
|
@ -29,7 +29,7 @@ use smithay::{
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
backend::{udev::UdevRenderer, Backend},
|
backend::{udev::UdevRenderer, Backend},
|
||||||
layout::transaction::{LayoutTransaction, SnapshotRenderElement, SnapshotTarget},
|
layout::transaction::SnapshotRenderElement,
|
||||||
pinnacle_render_elements,
|
pinnacle_render_elements,
|
||||||
state::{State, WithState},
|
state::{State, WithState},
|
||||||
window::WindowElement,
|
window::WindowElement,
|
||||||
|
|
79
src/state.rs
79
src/state.rs
|
@ -53,7 +53,9 @@ use smithay::{
|
||||||
},
|
},
|
||||||
utils::{Clock, Monotonic},
|
utils::{Clock, Monotonic},
|
||||||
wayland::{
|
wayland::{
|
||||||
compositor::{self, CompositorClientState, CompositorState, SurfaceData},
|
compositor::{
|
||||||
|
self, with_surface_tree_downward, CompositorClientState, CompositorState, SurfaceData,
|
||||||
|
},
|
||||||
cursor_shape::CursorShapeManagerState,
|
cursor_shape::CursorShapeManagerState,
|
||||||
fractional_scale::{with_fractional_scale, FractionalScaleManagerState},
|
fractional_scale::{with_fractional_scale, FractionalScaleManagerState},
|
||||||
idle_notify::IdleNotifierState,
|
idle_notify::IdleNotifierState,
|
||||||
|
@ -490,9 +492,22 @@ impl Pinnacle {
|
||||||
// the frame callbacks across potentially multiple outputs, and for regular windows and
|
// the frame callbacks across potentially multiple outputs, and for regular windows and
|
||||||
// layer-shell surfaces it avoids sending frame callbacks to invisible surfaces.
|
// layer-shell surfaces it avoids sending frame callbacks to invisible surfaces.
|
||||||
let current_primary_output = surface_primary_scanout_output(surface, states);
|
let current_primary_output = surface_primary_scanout_output(surface, states);
|
||||||
|
|
||||||
|
if matches!(self.cursor_state.cursor_image(), CursorImageStatus::Surface(s) if s == surface)
|
||||||
|
{
|
||||||
|
tracing::info!(
|
||||||
|
"cursor primary scanout output: {:?}",
|
||||||
|
current_primary_output.as_ref().map(|o| o.name())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// tracing::info!(
|
// tracing::info!(
|
||||||
// "current primary output is {:?}",
|
// op_count = self.outputs.len(),
|
||||||
// current_primary_output.as_ref().map(|o| o.name())
|
// "current primary output is {:?}, wl_output {:?}",
|
||||||
|
// current_primary_output.as_ref().map(|o| o.name()),
|
||||||
|
// current_primary_output
|
||||||
|
// .as_ref()
|
||||||
|
// .and_then(|o| { self.outputs.get(o) }),
|
||||||
// );
|
// );
|
||||||
if current_primary_output.as_ref() != Some(output) {
|
if current_primary_output.as_ref() != Some(output) {
|
||||||
// return self
|
// return self
|
||||||
|
@ -586,7 +601,9 @@ impl Pinnacle {
|
||||||
offscreen_id.clone().unwrap_or_else(|| Id::from(surface)),
|
offscreen_id.clone().unwrap_or_else(|| Id::from(surface)),
|
||||||
output,
|
output,
|
||||||
render_element_states,
|
render_element_states,
|
||||||
default_primary_scanout_output_compare,
|
// TODO:
|
||||||
|
// default_primary_scanout_output_compare,
|
||||||
|
|_, _, op, _| op,
|
||||||
);
|
);
|
||||||
|
|
||||||
if let Some(output) = primary_scanout_output {
|
if let Some(output) = primary_scanout_output {
|
||||||
|
@ -617,6 +634,60 @@ impl Pinnacle {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(lock_surface) = output.with_state(|state| state.lock_surface.clone()) {
|
||||||
|
with_surface_tree_downward(
|
||||||
|
lock_surface.wl_surface(),
|
||||||
|
(),
|
||||||
|
|_, _, _| compositor::TraversalAction::DoChildren(()),
|
||||||
|
|surface, states, _| {
|
||||||
|
update_surface_primary_scanout_output(
|
||||||
|
surface,
|
||||||
|
output,
|
||||||
|
states,
|
||||||
|
render_element_states,
|
||||||
|
default_primary_scanout_output_compare,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|_, _, _| true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(dnd) = self.dnd_icon.as_ref() {
|
||||||
|
with_surface_tree_downward(
|
||||||
|
dnd,
|
||||||
|
(),
|
||||||
|
|_, _, _| compositor::TraversalAction::DoChildren(()),
|
||||||
|
|surface, states, _| {
|
||||||
|
update_surface_primary_scanout_output(
|
||||||
|
surface,
|
||||||
|
output,
|
||||||
|
states,
|
||||||
|
render_element_states,
|
||||||
|
default_primary_scanout_output_compare,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|_, _, _| true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if let CursorImageStatus::Surface(surface) = self.cursor_state.cursor_image() {
|
||||||
|
with_surface_tree_downward(
|
||||||
|
surface,
|
||||||
|
(),
|
||||||
|
|_, _, _| compositor::TraversalAction::DoChildren(()),
|
||||||
|
|surface, states, _| {
|
||||||
|
update_surface_primary_scanout_output(
|
||||||
|
surface,
|
||||||
|
output,
|
||||||
|
states,
|
||||||
|
render_element_states,
|
||||||
|
default_primary_scanout_output_compare,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|_, _, _| true,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send_dmabuf_feedback(
|
pub fn send_dmabuf_feedback(
|
||||||
|
|
Loading…
Add table
Reference in a new issue