summary refs log tree commit diff
path: root/src/x/font.rs
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-11-12 22:40:42 -0700
committerIrene Knapp <ireneista@irenes.space>2026-11-12 22:40:42 -0700
commite521722f5fd339ef72ee51af88f3941b71b1d9cf (patch)
tree300734c3a95ad6c73908e8f203a1d70b53379be0 /src/x/font.rs
parent9f61e842d01f910349458466c3749d92561f5cde (diff)
okay, all the color stuff is well-organized now HEAD main
since color is one of those "the data is the point" types, rather than one that encapsulates remote state, both the xcb and xft stuff is handled by a single type, Color.

Force-Push: yes
Change-Id: I192c40b13dd9040897cbf043d5dd84d5a73f607b
Diffstat (limited to 'src/x/font.rs')
-rw-r--r--src/x/font.rs15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/x/font.rs b/src/x/font.rs
index d12cbe8..e0e3602 100644
--- a/src/x/font.rs
+++ b/src/x/font.rs
@@ -3,16 +3,11 @@ use crate::x::*;
 use std::ffi::CString;
 use std::sync::Arc;
 
-use x11::xft::{
-  XftColor,
-  XftDraw,
-  XftDrawStringUtf8,
-  XftFontOpenName,
-};
+use x11::xft::{ XftDrawStringUtf8, XftFontOpenName };
 
 
 pub struct Font {
-  display: Arc<Display>,
+  _display: Arc<Display>,
   font_state: *mut x11::xft::XftFont,
 }
 
@@ -27,17 +22,17 @@ impl Font {
       XftFontOpenName(xlib_display, screen_index, name.as_ptr().cast())
     };
 
-    Ok(Font { display, font_state })
+    Ok(Font { _display: display, font_state })
   }
 
-  pub fn draw(&self, context: &FontGraphicContext, xft_color: &XftColor,
+  pub fn draw(&self, context: &FontGraphicContext, color: &Color,
 	      x: i32, y: i32, text: &str)
     -> xcb::Result<()>
   {
     let xft_draw = context.get_xft_draw();
     let text = CString::new(text).unwrap();
     unsafe {
-      XftDrawStringUtf8(xft_draw, xft_color, self.font_state, x, y,
+      XftDrawStringUtf8(xft_draw, color.as_xft_color(), self.font_state, x, y,
                         text.as_ptr().cast(), text.count_bytes() as i32)
     };