diff options
| author | Irene Knapp <ireneista@irenes.space> | 2026-11-11 21:03:30 -0700 |
|---|---|---|
| committer | Irene Knapp <ireneista@irenes.space> | 2026-11-11 21:32:53 -0700 |
| commit | 960663d476d8a1391b8bcc4424f3f716147068ab (patch) | |
| tree | 3bf7e3372295f67c4afcad07c0b74e23624ab60f /src/xcontext.rs | |
| parent | 89a6a257f89bba997e778160c53938be371ec6ac (diff) | |
all the xcb wrapper types are in individual files now
the trait inheritance structure isn't THAT convoluted, but having more than one of these in a file was obscuring things. Change-Id: I5132a6304796654d778d731be1ecb1c7b4e77120 Force-Push: yes
Diffstat (limited to 'src/xcontext.rs')
| -rw-r--r-- | src/xcontext.rs | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/xcontext.rs b/src/xcontext.rs deleted file mode 100644 index d9543f7..0000000 --- a/src/xcontext.rs +++ /dev/null @@ -1,44 +0,0 @@ -use crate::xtypes::*; - -use std::sync::Arc; - -use xcb::x::{ self, Drawable, CreateGc, FreeGc }; - - -pub struct GraphicContext { - display: Arc<Display>, - context_id: x::Gcontext, -} - - -impl GraphicContext { - pub fn new(display: Arc<Display>, drawable: Drawable) - -> xcb::Result<Self> - { - let context_id: x::Gcontext = display.generate_id(); - let cookie = display.send_request_checked(&CreateGc { - cid: context_id, - drawable, - value_list: &[], - }); - display.check_request(cookie)?; - - Ok(GraphicContext { display, context_id }) - } -} - -impl Drop for GraphicContext { - fn drop(&mut self) { - let cookie = self.send_request_checked(&FreeGc { gc: self.context_id }); - let _ = self.check_request(cookie); // TODO - } -} - -impl HasDisplay for GraphicContext { - fn display(&self) -> &Arc<Display> { &self.display } -} - -impl HasConnection for GraphicContext { - fn connection(&self) -> &Connection { self.display.connection() } -} - |