Browse Source

Update for current rust

Thomas Dy 7 years ago
parent
commit
ab5d5f2c0d
3 changed files with 8 additions and 8 deletions
  1. 2 2
      Cargo.toml
  2. 2 2
      src/wm.rs
  3. 4 4
      src/x11.rs

+ 2 - 2
Cargo.toml

@@ -6,5 +6,5 @@ authors = ["Thomas Dy <thatsmydoing@gmail.com>"]
 [dependencies]
 time = "0.1"
 toml = "0.1"
-mpd = "0.0.11"
-xcb = "0.7.0"
+mpd = "0.0.12"
+xcb = "0.8.1"

+ 2 - 2
src/wm.rs

@@ -41,7 +41,7 @@ pub fn wm(tx: &Channel, _config: &Config) {
         conn.event_loop(&mut |event: &xcb::GenericEvent| {
             match event.response_type() {
                 xcb::PROPERTY_NOTIFY => {
-                    let prop_event: &xcb::PropertyNotifyEvent = xcb::cast_event(event);
+                    let prop_event: &xcb::PropertyNotifyEvent = unsafe { xcb::cast_event(event) };
                     if prop_event.atom() == conn.atoms._NET_ACTIVE_WINDOW {
                         let new_win = screen.get_active_window();
                         conn.watch(last_win, false);
@@ -55,7 +55,7 @@ pub fn wm(tx: &Channel, _config: &Config) {
                     }
                 },
                 xcb::CONFIGURE_NOTIFY => {
-                    let event: &xcb::ConfigureNotifyEvent = xcb::cast_event(&event);
+                    let event: &xcb::ConfigureNotifyEvent = unsafe { xcb::cast_event(&event) };
                     let spacer = format!("%{{O{}}}", event.width()+5);
                     comm::send(tx, "spacer", spacer.as_ref());
                 },

+ 4 - 4
src/x11.rs

@@ -83,14 +83,14 @@ impl Connection {
         let cookie = xcb::get_property(&self.conn, false, win, self.atoms._NET_WM_NAME, self.atoms.UTF8_STRING, 0, 100);
         let reply = cookie.get_reply();
         let value: &str = match reply {
-            Ok(reply) => unsafe { mem::transmute(reply.value()) },
+            Ok(reply) => unsafe { mem::transmute(reply.value::<u8>()) },
             _ => ""
         };
         if value == "" {
             let cookie = xcb::get_property(&self.conn, false, win, xcb::ATOM_WM_NAME, xcb::ATOM_STRING, 0, 100);
             let reply = cookie.get_reply();
             let value: &str = match reply {
-                Ok(reply) => unsafe { mem::transmute(reply.value()) },
+                Ok(reply) => unsafe { mem::transmute(reply.value::<u8>()) },
                 _ => ""
             };
             value.to_string()
@@ -104,7 +104,7 @@ impl Connection {
         let cookie = xcb::get_property(&self.conn, false, win, xcb::ATOM_WM_CLASS, xcb::ATOM_STRING, 0, 100);
         let reply = cookie.get_reply();
         let value: &str = match reply {
-            Ok(reply) => unsafe { mem::transmute(reply.value()) },
+            Ok(reply) => unsafe { mem::transmute(reply.value::<u8>()) },
             _ => ""
         };
         let parts: Vec<&str> = value.split_terminator('\0').collect();
@@ -158,7 +158,7 @@ impl<'a> Screen<'a> {
             0
         }
         else {
-            let value: &xcb::Window = unsafe { mem::transmute(&(reply.value()[0])) };
+            let value: &xcb::Window = unsafe { mem::transmute(&(reply.value::<u8>()[0])) };
             *value
         }
     }