aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Berger <victor.berger@m4x.org>2015-05-10 19:13:56 +0200
committerVictor Berger <victor.berger@m4x.org>2015-05-13 08:12:09 +0200
commit40322a2c69bdbb465ce1481aa61ac6dec85e10dd (patch)
tree692d62d2a7b31b323c94ffcc8c44ae57d2d15815
parent1278d9779d119be706d75d1ecaeaa9846fd78ed2 (diff)
downloadglutin-40322a2c69bdbb465ce1481aa61ac6dec85e10dd.tar.gz
glutin-40322a2c69bdbb465ce1481aa61ac6dec85e10dd.zip
Implement some more functions for wayland.
- set/get_inner_size() - set_title
-rw-r--r--Cargo.toml6
-rw-r--r--src/api/wayland/mod.rs34
2 files changed, 28 insertions, 12 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 32e8d90..89ed55e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -50,15 +50,15 @@ kernel32-sys = "0.1"
[target.i686-unknown-linux-gnu.dependencies]
osmesa-sys = "0.0.5"
-wayland-client = "0.1.4"
+wayland-client = "0.1.5"
x11-dl = "=1.0.1"
[target.x86_64-unknown-linux-gnu.dependencies]
osmesa-sys = "0.0.5"
-wayland-client = "0.1.4"
+wayland-client = "0.1.5"
x11-dl = "=1.0.1"
[target.arm-unknown-linux-gnueabihf.dependencies]
osmesa-sys = "0.0.5"
-wayland-client = "0.1.4"
+wayland-client = "0.1.5"
x11-dl = "=1.0.1"
diff --git a/src/api/wayland/mod.rs b/src/api/wayland/mod.rs
index 6838598..1c6c0e7 100644
--- a/src/api/wayland/mod.rs
+++ b/src/api/wayland/mod.rs
@@ -157,10 +157,6 @@ pub struct Window {
pub context: EglContext,
}
-// It is okay, as the window is completely self-owned: it has its
-// own wayland connexion.
-unsafe impl Send for Window {}
-
#[derive(Clone)]
pub struct WindowProxy;
@@ -300,16 +296,21 @@ impl Window {
}
pub fn is_closed(&self) -> bool {
+ // TODO
false
}
pub fn set_title(&self, title: &str) {
+ let ctitle = CString::new(title).unwrap();
+ self.shell_surface.set_title(&ctitle);
}
pub fn show(&self) {
+ // TODO
}
pub fn hide(&self) {
+ // TODO
}
pub fn get_position(&self) -> Option<(i32, i32)> {
@@ -322,15 +323,18 @@ impl Window {
}
pub fn get_inner_size(&self) -> Option<(u32, u32)> {
- unimplemented!()
+ let (w, h) = self.shell_surface.get_attached_size();
+ Some((w as u32, h as u32))
}
pub fn get_outer_size(&self) -> Option<(u32, u32)> {
- unimplemented!()
+ // maybe available if we draw the border ourselves ?
+ // but for now, no.
+ None
}
- pub fn set_inner_size(&self, _x: u32, _y: u32) {
- unimplemented!()
+ pub fn set_inner_size(&self, x: u32, y: u32) {
+ self.shell_surface.resize(x as i32, y as i32, 0, 0)
}
pub fn create_window_proxy(&self) -> WindowProxy {
@@ -349,13 +353,24 @@ impl Window {
}
}
- pub fn set_window_resize_callback(&mut self, _: Option<fn(u32, u32)>) {
+ pub fn set_window_resize_callback(&mut self, callback: Option<fn(u32, u32)>) {
+ if let Some(callback) = callback {
+ self.shell_surface.set_configure_callback(
+ move |_,w,h| { callback(w as u32, h as u32) }
+ );
+ } else {
+ self.shell_surface.set_configure_callback(
+ move |_,_,_| {}
+ );
+ }
}
pub fn set_cursor(&self, cursor: MouseCursor) {
+ // TODO
}
pub fn set_cursor_state(&self, state: CursorState) -> Result<(), String> {
+ // TODO
Ok(())
}
@@ -364,6 +379,7 @@ impl Window {
}
pub fn set_cursor_position(&self, x: i32, y: i32) -> Result<(), ()> {
+ // TODO
Ok(())
}