1
0
Fork 0
forked from wry/wry

all: remove traditional i3 titlebars, add corner rounding

This commit is contained in:
kossLAN 2026-04-09 23:04:33 -04:00
parent e1928863d9
commit a41dbae899
No known key found for this signature in database
52 changed files with 1866 additions and 1047 deletions

View file

@ -102,6 +102,8 @@ pub enum GfxApiOpt {
Sync,
FillRect(FillRect),
CopyTexture(CopyTexture),
RoundedFillRect(RoundedFillRect),
RoundedCopyTexture(RoundedCopyTexture),
}
pub struct GfxRenderPass {
@ -289,6 +291,53 @@ pub struct CopyTexture {
pub alpha_mode: AlphaMode,
}
#[derive(Debug)]
pub struct RoundedFillRect {
pub rect: FramebufferRect,
pub color: Color,
pub alpha: Option<f32>,
pub render_intent: RenderIntent,
pub cd: Rc<LinearColorDescription>,
/// Size of the rectangle in physical pixels.
pub size: [f32; 2],
/// Per-corner radius in physical pixels: [top_left, top_right, bottom_right, bottom_left].
pub corner_radius: [f32; 4],
/// Border width in physical pixels. 0 means a filled rounded rect (no cutout).
pub border_width: f32,
/// Output scale for antialiasing.
pub scale: f32,
}
impl RoundedFillRect {
pub fn effective_color(&self) -> Color {
let mut color = self.color;
if let Some(alpha) = self.alpha {
color = color * alpha;
}
color
}
}
pub struct RoundedCopyTexture {
pub tex: Rc<dyn GfxTexture>,
pub source: SampleRect,
pub target: FramebufferRect,
pub buffer_resv: Option<Rc<dyn BufferResv>>,
pub acquire_sync: AcquireSync,
pub release_sync: ReleaseSync,
pub alpha: Option<f32>,
pub opaque: bool,
pub render_intent: RenderIntent,
pub cd: Rc<ColorDescription>,
pub alpha_mode: AlphaMode,
/// Size of the rectangle in physical pixels.
pub size: [f32; 2],
/// Per-corner radius in physical pixels: [top_left, top_right, bottom_right, bottom_left].
pub corner_radius: [f32; 4],
/// Output scale for antialiasing.
pub scale: f32,
}
#[derive(Clone, Debug, PartialEq)]
pub struct SyncFile(pub Rc<OwnedFd>);
@ -705,8 +754,8 @@ impl dyn GfxFramebuffer {
let (width, height) = self.logical_size(transform);
Rect::new_saturating(0, 0, width, height)
},
icons: None,
stretch: None,
corner_radius: None,
};
cursor.render_hardware_cursor(&mut renderer);
self.render(
@ -1039,8 +1088,8 @@ pub fn create_render_pass(
let (width, height) = logical_size(physical_size, transform);
Rect::new_saturating(0, 0, width, height)
},
icons: state.icons.get(state, scale),
stretch: None,
corner_radius: None,
};
node.node_render(&mut renderer, 0, 0, None);
if let Some(rect) = cursor_rect {
@ -1256,6 +1305,8 @@ impl GfxRenderPass {
return None;
}
GfxApiOpt::CopyTexture(ct) => break 'ct2 ct,
GfxApiOpt::RoundedFillRect(_) => return None,
GfxApiOpt::RoundedCopyTexture(_) => return None,
}
}
return None;
@ -1299,6 +1350,8 @@ impl GfxRenderPass {
// Texture could be visible.
return None;
}
GfxApiOpt::RoundedFillRect(_) => return None,
GfxApiOpt::RoundedCopyTexture(_) => return None,
}
}
if let Some(clear) = self.clear