From c8735077a4e890b6b0640bcd00dc857ed8943b9d Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Mon, 30 Nov 2015 23:36:12 +0100 Subject: [PATCH 1/2] Update some libraries --- Cargo.toml | 10 ++++------ src/lib.rs | 15 +++++++-------- src/platform/with_glx/native_gl_context.rs | 11 ++--------- src/platform/with_glx/utils.rs | 2 +- 4 files changed, 14 insertions(+), 24 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 75467de..5c1c04a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,14 +8,13 @@ repository = "https://github.com/ecoal95/rust-offscreen-rendering-context" build = "build.rs" [build-dependencies] -gl_generator = "0.2.0" -khronos_api = "0.0.8" +gl_generator = "0.4" +khronos_api = "1.0" [features] texture_surface = ["layers"] [dependencies] -libc = "0.2" log = "0.3.3" gleam = "0.1" euclid = "0.4" @@ -46,6 +45,5 @@ features = ["xlib"] version = "2.3.0" features = ["xlib"] -[target.x86_64-pc-windows-gnu.dependencies.glutin] -git = "https://github.com/servo/glutin" -branch = "servo" +[target.x86_64-pc-windows-gnu.dependencies] +servo-glutin = "0.4" diff --git a/src/lib.rs b/src/lib.rs index f175f21..0a2c0bc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,6 @@ #![plugin(serde_macros)] extern crate gleam; -extern crate libc; extern crate euclid; extern crate serde; @@ -49,14 +48,14 @@ mod glx { #[cfg(target_os="android")] #[allow(non_camel_case_types)] mod egl { - use libc; + use std::os::raw::{c_long, c_void}; pub type khronos_utime_nanoseconds_t = khronos_uint64_t; - pub type khronos_uint64_t = libc::uint64_t; - pub type khronos_ssize_t = libc::c_long; - pub type EGLint = libc::int32_t; - pub type EGLNativeDisplayType = *const libc::c_void; - pub type EGLNativePixmapType = *const libc::c_void; - pub type EGLNativeWindowType = *const libc::c_void; + pub type khronos_uint64_t = u64; + pub type khronos_ssize_t = c_long; + pub type EGLint = i32; + pub type EGLNativeDisplayType = *const c_void; + pub type EGLNativePixmapType = *const c_void; + pub type EGLNativeWindowType = *const c_void; pub type NativeDisplayType = EGLNativeDisplayType; pub type NativePixmapType = EGLNativePixmapType; pub type NativeWindowType = EGLNativeWindowType; diff --git a/src/platform/with_glx/native_gl_context.rs b/src/platform/with_glx/native_gl_context.rs index ef92039..3dc9edc 100644 --- a/src/platform/with_glx/native_gl_context.rs +++ b/src/platform/with_glx/native_gl_context.rs @@ -2,7 +2,7 @@ use std::ffi::CString; use glx; use x11::xlib::*; -use libc::*; +use std::os::raw::*; use glx::types::{GLXContext, GLXDrawable, GLXFBConfig, GLXPixmap}; use euclid::Size2D; use super::utils::{create_offscreen_pixmap_backed_context}; @@ -32,14 +32,7 @@ impl NativeGLContext { let native = unsafe { glx::CreateNewContext(display, framebuffer_config, glx::RGBA_TYPE as c_int, shared, 1 as glx::types::Bool) }; - // FIXME: This should be: - // if native == (0 as *const c_void) { - // but that way compilation fails with error: - // expected `*const libc::types::common::c95::c_void`, - // found `*const libc::types::common::c95::c_void` - // (expected enum `libc::types::common::c95::c_void`, - // found a different enum `libc::types::common::c95::c_void`) [E0308] - if (native as *const c_void) == (0 as *const c_void) { + if native == (0 as *const c_void) { unsafe { glx::DestroyPixmap(display, drawable as GLXPixmap) }; return Err("Error creating native glx context"); } diff --git a/src/platform/with_glx/utils.rs b/src/platform/with_glx/utils.rs index 448d91c..dd9da1b 100644 --- a/src/platform/with_glx/utils.rs +++ b/src/platform/with_glx/utils.rs @@ -1,7 +1,7 @@ use glx; use x11::xlib::*; use glx::types::{GLXDrawable}; -use libc::*; +use std::os::raw::*; use euclid::Size2D; use NativeGLContext; From 7c12aea4dd392f39fd78a1aed4e39f16771990f6 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Tue, 1 Dec 2015 03:45:39 +0100 Subject: [PATCH 2/2] =?UTF-8?q?Add=20APT=20dependencies=20from=20glutin?= =?UTF-8?q?=E2=80=99s=20.travis.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 3795d24..a66ab24 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,8 @@ addons: packages: - gcc-4.8 - g++-4.8 + - libxxf86vm-dev + - libosmesa6-dev before_install: - if [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX=g++-4.8; fi