|
@@ -2,7 +2,7 @@ use config::Config;
|
|
|
use xcb;
|
|
|
use ui;
|
|
|
use ui::color;
|
|
|
-use ui::draw_context::DrawContext;
|
|
|
+use ui::context::Context;
|
|
|
use ui::ext;
|
|
|
use ui::ext::ConnectionExt;
|
|
|
use ui::font;
|
|
@@ -10,7 +10,6 @@ use ui::x11;
|
|
|
use widgets::{Message, Update, Widget};
|
|
|
|
|
|
use std::rc::Rc;
|
|
|
-use std::sync::Arc;
|
|
|
use std::iter;
|
|
|
use std::slice;
|
|
|
|
|
@@ -73,7 +72,7 @@ impl WidgetState {
|
|
|
}
|
|
|
|
|
|
pub struct Panel {
|
|
|
- pub conn: Arc<x11::Connection>,
|
|
|
+ pub conn: Rc<x11::Connection>,
|
|
|
pub window: xcb::Window,
|
|
|
pub width: u16,
|
|
|
left_widgets: Vec<WidgetState>,
|
|
@@ -85,7 +84,7 @@ pub struct Panel {
|
|
|
|
|
|
impl Panel {
|
|
|
pub fn new(conn: x11::Connection, cfg: &Config) -> Panel {
|
|
|
- let conn = Arc::new(conn);
|
|
|
+ let conn = Rc::new(conn);
|
|
|
let window = conn.generate_id();
|
|
|
let picture = conn.generate_id();
|
|
|
|
|
@@ -143,8 +142,8 @@ impl Panel {
|
|
|
self.conn.flush();
|
|
|
}
|
|
|
|
|
|
- pub fn make_draw_context(&self) -> DrawContext {
|
|
|
- DrawContext::new(self.conn.clone_connection(), self.picture, self.fonts.clone())
|
|
|
+ pub fn make_context(&self) -> Context {
|
|
|
+ Context::new(self.conn.clone(), self.window, self.picture, self.fonts.clone())
|
|
|
}
|
|
|
|
|
|
fn widgets_iter(&mut self) -> iter::Chain<slice::IterMut<WidgetState>, slice::IterMut<WidgetState>>{
|
|
@@ -282,7 +281,7 @@ impl Panel {
|
|
|
}
|
|
|
|
|
|
pub fn rerender(&mut self) {
|
|
|
- let context = self.make_draw_context();
|
|
|
+ let context = self.make_context();
|
|
|
for state in self.widgets_iter() {
|
|
|
if state.should_render() {
|
|
|
context.draw_bg(state.position, state.width);
|