From c5f15297d53904ecfb1e2e6e2df915e380eff2e0 Mon Sep 17 00:00:00 2001 From: Irene Knapp Date: Wed, 11 Nov 2026 17:31:19 -0700 Subject: do proper color management well, sort of. we can't test indexed color, so there's no code specifically accounting for it. ah well. Change-Id: Ic12854c17fd7d433a7ee129ad5663d1bdb2ee541 Force-Push: yes --- src/main.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 436fcfa..2c07e95 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@ use crate::xtypes::*; +use crate::xcolor::DisplayColorExt; use std::sync::Arc; @@ -12,6 +13,7 @@ use xcb::x::{ WindowClass }; +mod xcolor; mod xtypes; @@ -21,6 +23,7 @@ enum ScreenSide { Top, Bottom, Left, Right } struct DockConfiguration { thickness: u16, side: ScreenSide, + background_pixel: u32, } struct Dock { @@ -46,9 +49,13 @@ struct Rectangle { fn main() -> xcb::Result<()> { let display = Arc::new(Display::new()?); + // #d4ffcc + let background_pixel = display.allocate_color(54484, 65535, 52428)?; + let _dock = Dock::new(Arc::clone(&display), DockConfiguration { thickness: 50, side: ScreenSide::Bottom, + background_pixel, })?; loop { @@ -81,6 +88,7 @@ impl Dock { let dock_bounds = Dock::compute_bounds(&screen, &configuration); + println!("back pixel {:?}", configuration.background_pixel); let window = Window::new(Arc::clone(&display), &mut CreateWindow { depth: x::COPY_FROM_PARENT as u8, wid: x::Window::none(), @@ -93,7 +101,7 @@ impl Dock { class: WindowClass::InputOutput, visual: screen.root_visual(), value_list: &[ - Cw::BackPixel(screen.black_pixel()), + Cw::BackPixel(configuration.background_pixel), Cw::EventMask(EventMask::EXPOSURE | EventMask::BUTTON_PRESS), ], })?; @@ -189,6 +197,5 @@ impl Dock { Rectangle { left, top, width, height } } } - } -- cgit 1.4.1