aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Berger <victor.berger@m4x.org>2015-05-09 22:30:17 +0200
committerVictor Berger <victor.berger@m4x.org>2015-05-13 08:12:09 +0200
commit1278d9779d119be706d75d1ecaeaa9846fd78ed2 (patch)
tree23d6231e31f797d82661cbdd1f8cfb237c7b2e08
parent41af4406cbf88869ecf687ef536cb902e5f1ebd1 (diff)
downloadglutin-1278d9779d119be706d75d1ecaeaa9846fd78ed2.tar.gz
glutin-1278d9779d119be706d75d1ecaeaa9846fd78ed2.zip
wayland: Fix MonitorID::get_dimensions() and fullscreen support.
-rw-r--r--src/api/wayland/mod.rs20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/api/wayland/mod.rs b/src/api/wayland/mod.rs
index 4fd0357..6838598 100644
--- a/src/api/wayland/mod.rs
+++ b/src/api/wayland/mod.rs
@@ -4,7 +4,7 @@
use self::wayland::egl::{EGLSurface, is_egl_available};
use self::wayland::core::{Display, Registry, Compositor, Shell, ShellSurface,
Seat, Pointer, default_display, WSurface, SurfaceId,
- Surface, Output};
+ Surface, Output, ShellFullscreenMethod};
use libc;
use api::dlopen;
@@ -172,6 +172,7 @@ impl WindowProxy {
}
}
+#[derive(Clone)]
pub struct MonitorID {
output: Arc<Output>
}
@@ -202,7 +203,11 @@ impl MonitorID {
}
pub fn get_dimensions(&self) -> (u32, u32) {
- let (w, h) = self.output.dimensions();
+ let (w, h) = self.output.modes()
+ .into_iter()
+ .find(|m| m.is_current())
+ .map(|m| (m.width, m.height))
+ .unwrap();
(w as u32, h as u32)
}
}
@@ -257,6 +262,13 @@ impl Window {
h as i32
);
+ let shell_surface = wayland_context.shell.get_shell_surface(surface);
+ if let Some(ref monitor) = builder.monitor {
+ shell_surface.set_fullscreen(ShellFullscreenMethod::Default, Some(&monitor.output));
+ } else {
+ shell_surface.set_toplevel();
+ }
+
let context = {
let libegl = unsafe { dlopen::dlopen(b"libEGL.so\0".as_ptr() as *const _, dlopen::RTLD_NOW) };
if libegl.is_null() {
@@ -270,12 +282,10 @@ impl Window {
egl,
builder,
Some(wayland_context.display.ptr() as *const _),
- surface.ptr() as *const _
+ (*shell_surface).ptr() as *const _
))
};
- let shell_surface = wayland_context.shell.get_shell_surface(surface);
- shell_surface.set_toplevel();
let events = Arc::new(Mutex::new(VecDeque::new()));
wayland_context.register_surface(shell_surface.get_wsurface().get_id(), events.clone());