|
@@ -1,6 +1,5 @@
|
|
|
use xcb;
|
|
|
|
|
|
-use ui;
|
|
|
use ui::x11;
|
|
|
use widgets::{Message, Update, Widget, WidgetParams};
|
|
|
|
|
@@ -9,6 +8,7 @@ const CLIENT_MESSAGE: u8 = xcb::CLIENT_MESSAGE | 0x80; // 0x80 flag for client m
|
|
|
pub struct Tray {
|
|
|
conn: x11::Connection,
|
|
|
window: xcb::Window,
|
|
|
+ height: u16,
|
|
|
children: Vec<xcb::Window>,
|
|
|
timestamp: xcb::Timestamp,
|
|
|
}
|
|
@@ -17,6 +17,7 @@ pub fn tray(params: WidgetParams) -> Box<Widget> {
|
|
|
let widget = Tray {
|
|
|
conn: params.conn(),
|
|
|
window: params.window(),
|
|
|
+ height: params.context.height,
|
|
|
children: vec![],
|
|
|
timestamp: 0
|
|
|
};
|
|
@@ -67,10 +68,10 @@ impl Tray {
|
|
|
let geometry = xcb::get_geometry(conn, window).get_reply().unwrap();
|
|
|
(geometry.width(), geometry.height())
|
|
|
});
|
|
|
- if dimensions != (ui::SIZE, ui::SIZE) {
|
|
|
+ if dimensions != (self.height, self.height) {
|
|
|
xcb::configure_window(conn, window, &[
|
|
|
- (xcb::CONFIG_WINDOW_WIDTH as u16, ui::SIZE as u32),
|
|
|
- (xcb::CONFIG_WINDOW_HEIGHT as u16, ui::SIZE as u32)
|
|
|
+ (xcb::CONFIG_WINDOW_WIDTH as u16, self.height as u32),
|
|
|
+ (xcb::CONFIG_WINDOW_HEIGHT as u16, self.height as u32)
|
|
|
]);
|
|
|
conn.flush();
|
|
|
}
|
|
@@ -79,13 +80,13 @@ impl Tray {
|
|
|
|
|
|
impl Widget for Tray {
|
|
|
fn width(&mut self) -> u16 {
|
|
|
- (self.children.len() as u16) * ui::SIZE
|
|
|
+ (self.children.len() as u16) * self.height
|
|
|
}
|
|
|
|
|
|
fn render(&mut self, x: u16, _w: u16) {
|
|
|
for (index, child) in self.children.iter().enumerate() {
|
|
|
let window = *child;
|
|
|
- let xpos = x + index as u16 * ui::SIZE;
|
|
|
+ let xpos = x + index as u16 * self.height;
|
|
|
xcb::configure_window(&self.conn, window, &[
|
|
|
(xcb::CONFIG_WINDOW_X as u16, xpos as u32)
|
|
|
]);
|