summary refs log tree commit diff
path: root/src/main.rs
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-11-11 17:31:19 -0700
committerIrene Knapp <ireneista@irenes.space>2026-11-11 18:01:29 -0700
commitc5f15297d53904ecfb1e2e6e2df915e380eff2e0 (patch)
tree408a195c22542e9cb374a0ac6aca565839a347d0 /src/main.rs
parentcc1bed1f1f3e26a6a00b292ace94b6991c181ff9 (diff)
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
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs11
1 files changed, 9 insertions, 2 deletions
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<T> {
 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 }
     }
   }
-
 }