render: force black background color for fullscreen nodes
This commit is contained in:
parent
609f6f99cd
commit
41754e268f
6 changed files with 46 additions and 4 deletions
|
|
@ -505,6 +505,7 @@ impl MetalConnector {
|
|||
Some(rr),
|
||||
output.global.preferred_scale.get(),
|
||||
render_hw_cursor,
|
||||
output.has_fullscreen(),
|
||||
);
|
||||
let try_direct_scanout = try_direct_scanout
|
||||
&& !output.global.have_shm_screencopies()
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use {
|
|||
scale::Scale,
|
||||
state::State,
|
||||
theme::Color,
|
||||
tree::Node,
|
||||
tree::{Node, OutputNode},
|
||||
utils::numcell::NumCell,
|
||||
video::{dmabuf::DmaBuf, gbm::GbmDevice, Modifier},
|
||||
},
|
||||
|
|
@ -211,6 +211,7 @@ impl dyn GfxFramebuffer {
|
|||
result: Option<&mut RenderResult>,
|
||||
scale: Scale,
|
||||
render_hardware_cursor: bool,
|
||||
black_background: bool,
|
||||
) -> GfxRenderPass {
|
||||
let mut ops = self.take_render_ops();
|
||||
let (width, height) = self.size();
|
||||
|
|
@ -251,7 +252,10 @@ impl dyn GfxFramebuffer {
|
|||
}
|
||||
}
|
||||
}
|
||||
let c = state.theme.colors.background.get();
|
||||
let c = match black_background {
|
||||
true => Color::SOLID_BLACK,
|
||||
false => state.theme.colors.background.get(),
|
||||
};
|
||||
GfxRenderPass {
|
||||
ops,
|
||||
clear: Some(c),
|
||||
|
|
@ -262,6 +266,26 @@ impl dyn GfxFramebuffer {
|
|||
self.render(pass.ops, pass.clear.as_ref())
|
||||
}
|
||||
|
||||
pub fn render_output(
|
||||
&self,
|
||||
node: &OutputNode,
|
||||
state: &State,
|
||||
cursor_rect: Option<Rect>,
|
||||
result: Option<&mut RenderResult>,
|
||||
scale: Scale,
|
||||
render_hardware_cursor: bool,
|
||||
) {
|
||||
self.render_node(
|
||||
node,
|
||||
state,
|
||||
cursor_rect,
|
||||
result,
|
||||
scale,
|
||||
render_hardware_cursor,
|
||||
node.has_fullscreen(),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn render_node(
|
||||
&self,
|
||||
node: &dyn Node,
|
||||
|
|
@ -270,6 +294,7 @@ impl dyn GfxFramebuffer {
|
|||
result: Option<&mut RenderResult>,
|
||||
scale: Scale,
|
||||
render_hardware_cursor: bool,
|
||||
black_background: bool,
|
||||
) {
|
||||
let pass = self.create_render_pass(
|
||||
node,
|
||||
|
|
@ -278,6 +303,7 @@ impl dyn GfxFramebuffer {
|
|||
result,
|
||||
scale,
|
||||
render_hardware_cursor,
|
||||
black_background,
|
||||
);
|
||||
self.perform_render_pass(pass);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ pub fn take_screenshot(state: &State) -> Result<Screenshot, ScreenshooterError>
|
|||
None,
|
||||
Scale::from_int(1),
|
||||
true,
|
||||
false,
|
||||
);
|
||||
let drm = gbm.drm.dup_render()?.fd().clone();
|
||||
Ok(Screenshot { drm, bo })
|
||||
|
|
|
|||
|
|
@ -743,7 +743,7 @@ impl State {
|
|||
rr: &mut RenderResult,
|
||||
render_hw_cursor: bool,
|
||||
) {
|
||||
fb.render_node(
|
||||
fb.render_output(
|
||||
output,
|
||||
self,
|
||||
Some(output.global.pos.get()),
|
||||
|
|
@ -794,7 +794,7 @@ impl State {
|
|||
}
|
||||
}
|
||||
}
|
||||
let clear = target.format().has_alpha.then_some(&Color::TRANSPARENT);
|
||||
let clear = target.format().has_alpha.then_some(&Color::SOLID_BLACK);
|
||||
target.render(ops, clear);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,13 @@ impl Color {
|
|||
a: 0.0,
|
||||
};
|
||||
|
||||
pub const SOLID_BLACK: Self = Self {
|
||||
r: 0.0,
|
||||
g: 0.0,
|
||||
b: 0.0,
|
||||
a: 1.0,
|
||||
};
|
||||
|
||||
pub fn from_gray(g: u8) -> Self {
|
||||
Self::from_rgb(g, g, g)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -477,6 +477,13 @@ impl OutputNode {
|
|||
fn pointer_move(self: &Rc<Self>, seat: &Rc<WlSeatGlobal>, x: i32, y: i32) {
|
||||
self.pointer_positions.set(seat.id(), (x, y));
|
||||
}
|
||||
|
||||
pub fn has_fullscreen(&self) -> bool {
|
||||
self.workspace
|
||||
.get()
|
||||
.map(|w| w.fullscreen.get().is_some())
|
||||
.unwrap_or(false)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct OutputTitle {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue