aboutsummaryrefslogtreecommitdiffstats
path: root/src/platform
diff options
context:
space:
mode:
authorPierre Krieger <pierre.krieger1708@gmail.com>2015-09-21 11:52:21 +0200
committerPierre Krieger <pierre.krieger1708@gmail.com>2015-09-21 12:04:33 +0200
commit5182023fd6f14469290b80f0f5e9b0dead73048e (patch)
tree91fcb81cec8fad69f956712b97da79e58331203e /src/platform
parentb5d0a3eb67247a8ed5e43a9161f7e9567e1c1ea7 (diff)
downloadglutin-5182023fd6f14469290b80f0f5e9b0dead73048e.tar.gz
glutin-5182023fd6f14469290b80f0f5e9b0dead73048e.zip
Switch X11 and wayland to the new design
Diffstat (limited to 'src/platform')
-rw-r--r--src/platform/linux/api_dispatch.rs24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/platform/linux/api_dispatch.rs b/src/platform/linux/api_dispatch.rs
index f25bda9..0fae6a0 100644
--- a/src/platform/linux/api_dispatch.rs
+++ b/src/platform/linux/api_dispatch.rs
@@ -162,9 +162,29 @@ impl<'a> Iterator for WaitEventsIterator<'a> {
impl Window {
pub fn new(builder: BuilderAttribs) -> Result<Window, CreationError> {
+ let window = builder.window;
+ let pf_reqs = builder.pf_reqs;
+ let opengl = builder.opengl;
+
match *BACKEND {
- Backend::Wayland => wayland::Window::new(builder).map(Window::Wayland),
- Backend::X(ref connec) => x11::Window::new(connec, builder).map(Window::X),
+ Backend::Wayland => {
+ let opengl = opengl.map_sharing(|w| match w {
+ &Window::Wayland(ref w) => w,
+ _ => panic!() // TODO: return an error
+ });
+
+ wayland::Window::new(&window, &pf_reqs, &opengl).map(Window::Wayland)
+ },
+
+ Backend::X(ref connec) => {
+ let opengl = opengl.map_sharing(|w| match w {
+ &Window::X(ref w) => w,
+ _ => panic!() // TODO: return an error
+ });
+
+ x11::Window::new(connec, &window, &pf_reqs, &opengl).map(Window::X)
+ },
+
Backend::Error(ref error) => Err(CreationError::NoBackendAvailable(Box::new(error.clone())))
}
}