aboutsummaryrefslogtreecommitdiffstats
path: root/ports/glutin
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2019-06-17 11:46:24 +0200
committerFernando Jiménez Moreno <ferjmoreno@gmail.com>2019-07-04 10:25:48 +0200
commiteb3857237c2760ed17a2888f01c069566def509f (patch)
tree56a62771d53970a2ffc70d86e99b06c98e668bc5 /ports/glutin
parent6e2ee394c966a1119b4e03ae855b7319f48087e2 (diff)
downloadservo-eb3857237c2760ed17a2888f01c069566def509f.tar.gz
servo-eb3857237c2760ed17a2888f01c069566def509f.zip
Add more raw context handler for glutin port
Diffstat (limited to 'ports/glutin')
-rw-r--r--ports/glutin/context.rs32
-rw-r--r--ports/glutin/headed_window.rs44
2 files changed, 62 insertions, 14 deletions
diff --git a/ports/glutin/context.rs b/ports/glutin/context.rs
index 4328f9e47ea..ed56a7afc76 100644
--- a/ports/glutin/context.rs
+++ b/ports/glutin/context.rs
@@ -77,30 +77,53 @@ impl GlContext {
pub fn raw_context(&self) -> RawContext {
match self {
GlContext::Current(c) => {
- let raw_handle = unsafe { c.raw_handle() };
-
#[cfg(any(
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
- target_os = "openbsd"
+ target_os = "openbsd",
))]
{
use glutin::os::unix::RawHandle;
+ let raw_handle = unsafe { c.raw_handle() };
return match raw_handle {
RawHandle::Egl(handle) => RawContext::Egl(handle as usize),
RawHandle::Glx(handle) => RawContext::Glx(handle as usize),
};
}
+ #[cfg(target_os = "windows")]
+ {
+ use glutin::os::windows::RawHandle;
+
+ let raw_handle = unsafe { c.raw_handle() };
+ return match raw_handle {
+ RawHandle::Egl(handle) => RawContext::Egl(handle as usize),
+ // @TODO(victor): RawContext::Wgl in servo-media
+ RawHandle::Wgl(_) => unimplemented!(),
+ }
+ }
+
+ #[cfg(target_os = "android")]
+ {
+ let raw_handle = unsafe { c.raw_handle() };
+ return RawContext::Egl(raw_handle as usize);
+ }
+
+ #[cfg(target_os = "macos")]
+ return unimplemeneted!(); // @TODO(victor): RawContext::Cocoa in servo-media
+
#[cfg(not(any(
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
- target_os = "openbsd"
+ target_os = "openbsd",
+ target_os = "windows",
+ target_os = "android",
+ target_os = "macos",
)))]
unimplemented!()
}
@@ -111,6 +134,7 @@ impl GlContext {
GlContext::None => unreachable!(),
}
}
+
pub fn egl_display(&self) -> Option<*const raw::c_void> {
match self {
GlContext::Current(c) => unsafe { c.get_egl_display() },
diff --git a/ports/glutin/headed_window.rs b/ports/glutin/headed_window.rs
index 9f934029aa6..c19d2bdb63b 100644
--- a/ports/glutin/headed_window.rs
+++ b/ports/glutin/headed_window.rs
@@ -544,21 +544,43 @@ impl WindowMethods for Window {
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
- target_os = "openbsd"
+ target_os = "openbsd",
+ target_os = "windows",
+ target_os = "android",
))]
let native_display = {
if let Some(display) = self.gl_context.borrow().egl_display() {
NativeDisplay::Egl(display as usize)
} else {
- use glutin::os::unix::WindowExt;
-
- if let Some(display) = self.gl_context.borrow().window().get_wayland_display() {
- NativeDisplay::Wayland(display as usize)
- } else if let Some(display) = self.gl_context.borrow().window().get_xlib_display() {
- NativeDisplay::X11(display as usize)
- } else {
- NativeDisplay::Unknown
+ #[cfg(any(
+ target_os = "linux",
+ target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "netbsd",
+ target_os = "openbsd",
+ ))]
+ {
+ use glutin::os::unix::WindowExt;
+
+ if let Some(display) = self.gl_context.borrow().window().get_wayland_display() {
+ NativeDisplay::Wayland(display as usize)
+ } else if let Some(display) =
+ self.gl_context.borrow().window().get_xlib_display()
+ {
+ NativeDisplay::X11(display as usize)
+ } else {
+ NativeDisplay::Unknown
+ }
}
+
+ #[cfg(not(any(
+ target_os = "linux",
+ target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "netbsd",
+ target_os = "openbsd",
+ )))]
+ NativeDisplay::Unknown
}
};
@@ -567,7 +589,9 @@ impl WindowMethods for Window {
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
- target_os = "openbsd"
+ target_os = "openbsd",
+ target_os = "windows",
+ target_os = "android",
)))]
let native_display = NativeDisplay::Unknown;