|
|
|
@ -74,10 +74,10 @@ impl XcbEasel { |
|
|
|
, screen.root(), 0, 0, width, width, 0
|
|
|
|
, xcb::WINDOW_CLASS_INPUT_OUTPUT as u16
|
|
|
|
, screen.root_visual()
|
|
|
|
, &[(xcb::CW_BACK_PIXEL, screen.white_pixel())] );
|
|
|
|
, &[(xcb::CW_BACK_PIXEL, screen.black_pixel())] );
|
|
|
|
|
|
|
|
xcb::create_gc( &conn, gc, screen.root()
|
|
|
|
, &[ (xcb::GC_FOREGROUND, screen.black_pixel())
|
|
|
|
, &[ (xcb::GC_FOREGROUND, screen.white_pixel())
|
|
|
|
, (xcb::GC_GRAPHICS_EXPOSURES, 0) ] );
|
|
|
|
|
|
|
|
let (shmid, shm) = getshm((width * height) as usize);
|
|
|
|
@ -120,8 +120,8 @@ fn getshm<'a>(size :usize) -> (i32, &'a mut [u32]) { |
|
|
|
|
|
|
|
unsafe {
|
|
|
|
let id = libc::shmget( libc::IPC_PRIVATE
|
|
|
|
, size * 4
|
|
|
|
, libc::IPC_CREAT | 0o744 );
|
|
|
|
, size * 4
|
|
|
|
, libc::IPC_CREAT | 0o744 );
|
|
|
|
let ptr = libc::shmat(id, ptr::null(), 0);
|
|
|
|
(id as i32, from_raw_parts_mut(ptr as *mut u32, size))
|
|
|
|
}
|
|
|
|
@ -233,6 +233,13 @@ impl<'a> Canvas for XcbCanvas<'a> { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn put_text(&self, ofs :Coordinate, s :&str) {
|
|
|
|
let Coordinate(xofs, yofs) = ofs;
|
|
|
|
xcb::xproto::image_text_8( &self.conn, self.pixmap, self.gc
|
|
|
|
, xofs as i16, yofs as i16, s );
|
|
|
|
self.conn.flush();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn show(&self) {
|
|
|
|
xcb::copy_area( &self.conn, self.pixmap, self.window, self.gc
|
|
|
|
, 0, 0, 0, 0
|
|
|
|
|