autocommit 2022-04-13 21:01:32 CEST
This commit is contained in:
parent
661a28e5b0
commit
916e3644c3
30 changed files with 681 additions and 73 deletions
|
|
@ -36,7 +36,7 @@ use {
|
|||
pub struct EglDisplay {
|
||||
pub exts: DisplayExt,
|
||||
pub formats: Rc<AHashMap<u32, &'static Format>>,
|
||||
pub gbm: GbmDevice,
|
||||
pub gbm: Rc<GbmDevice>,
|
||||
pub dpy: EGLDisplay,
|
||||
}
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ impl EglDisplay {
|
|||
let mut dpy = EglDisplay {
|
||||
exts: DisplayExt::empty(),
|
||||
formats: Rc::new(AHashMap::new()),
|
||||
gbm,
|
||||
gbm: Rc::new(gbm),
|
||||
dpy,
|
||||
};
|
||||
let mut major = 0;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ use {
|
|||
video::{
|
||||
dmabuf::DmaBuf,
|
||||
drm::{Drm, NodeType},
|
||||
gbm::GbmDevice,
|
||||
},
|
||||
},
|
||||
ahash::AHashMap,
|
||||
|
|
@ -44,6 +45,7 @@ impl TexProg {
|
|||
|
||||
pub struct RenderContext {
|
||||
pub(super) ctx: Rc<EglContext>,
|
||||
pub gbm: Rc<GbmDevice>,
|
||||
|
||||
pub(super) render_node: Rc<CString>,
|
||||
|
||||
|
|
@ -97,6 +99,7 @@ impl RenderContext {
|
|||
)?;
|
||||
Ok(Self {
|
||||
ctx: ctx.clone(),
|
||||
gbm: ctx.dpy.gbm.clone(),
|
||||
|
||||
render_node: node.clone(),
|
||||
|
||||
|
|
|
|||
|
|
@ -47,10 +47,11 @@ impl Framebuffer {
|
|||
|
||||
pub fn render(&self, node: &dyn Node, state: &State, cursor_rect: Option<Rect>) {
|
||||
let _ = self.ctx.ctx.with_current(|| {
|
||||
let c = state.theme.background_color.get();
|
||||
unsafe {
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, self.gl.fbo);
|
||||
glViewport(0, 0, self.gl.width, self.gl.height);
|
||||
glClearColor(0.0, 0.0, 0.0, 1.0);
|
||||
glClearColor(c.r, c.g, c.b, 1.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ use {
|
|||
},
|
||||
state::State,
|
||||
theme::Color,
|
||||
tree::{ContainerNode, FloatNode, OutputNode, WorkspaceNode},
|
||||
tree::{ContainerNode, DisplayNode, FloatNode, OutputNode, WorkspaceNode},
|
||||
utils::rc_eq::rc_eq,
|
||||
},
|
||||
std::{ops::Deref, rc::Rc, slice},
|
||||
|
|
@ -38,6 +38,16 @@ pub struct Renderer<'a> {
|
|||
}
|
||||
|
||||
impl Renderer<'_> {
|
||||
pub fn render_display(&mut self, display: &DisplayNode, x: i32, y: i32) {
|
||||
let ext = display.extents.get();
|
||||
let outputs = display.outputs.lock();
|
||||
for output in outputs.values() {
|
||||
let opos = output.global.pos.get();
|
||||
let (ox, oy) = ext.translate(opos.x1(), opos.y1());
|
||||
self.render_output(output, x + ox, y + oy);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn render_output(&mut self, output: &OutputNode, x: i32, y: i32) {
|
||||
let opos = output.global.pos.get();
|
||||
macro_rules! render_layer {
|
||||
|
|
@ -57,15 +67,22 @@ impl Renderer<'_> {
|
|||
let theme = &self.state.theme;
|
||||
let th = theme.title_height.get();
|
||||
{
|
||||
let c = Color::BLACK;
|
||||
self.fill_boxes2(
|
||||
slice::from_ref(&Rect::new_sized(0, 0, opos.width(), th).unwrap()),
|
||||
&c,
|
||||
x,
|
||||
y,
|
||||
);
|
||||
let rd = output.render_data.borrow_mut();
|
||||
if let Some(aw) = &rd.active_workspace {
|
||||
let c = theme.active_title_color.get();
|
||||
self.fill_boxes(slice::from_ref(aw), &c);
|
||||
self.fill_boxes2(slice::from_ref(aw), &c, x, y);
|
||||
}
|
||||
let c = theme.underline_color.get();
|
||||
self.fill_boxes(slice::from_ref(&rd.underline), &c);
|
||||
self.fill_boxes2(slice::from_ref(&rd.underline), &c, x, y);
|
||||
let c = theme.title_color.get();
|
||||
self.fill_boxes(&rd.inactive_workspaces, &c);
|
||||
self.fill_boxes2(&rd.inactive_workspaces, &c, x, y);
|
||||
for title in &rd.titles {
|
||||
self.render_texture(&title.tex, x + title.x, y + title.y, ARGB8888);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue