mirror of
https://github.com/servo/servo.git
synced 2025-09-30 16:49:16 +01:00
Auto merge of #6525 - mrobinson:simplify-display, r=glennw
Update to latest rust-layers The compositing context, painting context and display metadata have all been collapsed into a single NativeDisplay class. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6525) <!-- Reviewable:end -->
This commit is contained in:
commit
4674afe846
13 changed files with 71 additions and 108 deletions
4
ports/cef/Cargo.lock
generated
4
ports/cef/Cargo.lock
generated
|
@ -634,7 +634,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
[[package]]
|
||||
name = "layers"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-layers#a3f07d9a7e34fe368aa8010a83ce8979491fc057"
|
||||
source = "git+https://github.com/servo/rust-layers#01bfc9fbb0748af62d89720f67a84e9542fad1d1"
|
||||
dependencies = [
|
||||
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
|
||||
"cgl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -857,7 +857,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "offscreen_gl_context"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#9b2a5fc48de8b06d02e0d18329dd6dd797b01d05"
|
||||
source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#46c5cc8694b08c09de55821e0e8a00ebe5ed97da"
|
||||
dependencies = [
|
||||
"cgl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
|
@ -21,7 +21,7 @@ use euclid::scale_factor::ScaleFactor;
|
|||
use euclid::size::{Size2D, TypedSize2D};
|
||||
use gleam::gl;
|
||||
use layers::geometry::DevicePixel;
|
||||
use layers::platform::surface::NativeGraphicsMetadata;
|
||||
use layers::platform::surface::NativeDisplay;
|
||||
use libc::{c_char, c_void};
|
||||
use msg::constellation_msg::{Key, KeyModifiers};
|
||||
use net::net_error_list::NetError;
|
||||
|
@ -265,26 +265,17 @@ impl WindowMethods for Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os="macos")]
|
||||
fn native_metadata(&self) -> NativeGraphicsMetadata {
|
||||
use cgl::{CGLGetCurrentContext, CGLGetPixelFormat};
|
||||
|
||||
// FIXME(pcwalton)
|
||||
#[cfg(target_os="linux")]
|
||||
fn native_display(&self) -> NativeDisplay {
|
||||
use x11::xlib;
|
||||
unsafe {
|
||||
NativeGraphicsMetadata {
|
||||
pixel_format: CGLGetPixelFormat(CGLGetCurrentContext()),
|
||||
}
|
||||
NativeDisplay::new(DISPLAY as *mut xlib::Display)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os="linux")]
|
||||
fn native_metadata(&self) -> NativeGraphicsMetadata {
|
||||
use x11::xlib;
|
||||
unsafe {
|
||||
NativeGraphicsMetadata {
|
||||
display: DISPLAY as *mut xlib::Display,
|
||||
}
|
||||
}
|
||||
#[cfg(not(target_os="linux"))]
|
||||
fn native_display(&self) -> NativeDisplay {
|
||||
NativeDisplay::new()
|
||||
}
|
||||
|
||||
fn create_compositor_channel(_: &Option<Rc<Window>>)
|
||||
|
|
|
@ -11,7 +11,7 @@ use euclid::size::{Size2D, TypedSize2D};
|
|||
use gleam::gl;
|
||||
use glutin;
|
||||
use layers::geometry::DevicePixel;
|
||||
use layers::platform::surface::NativeGraphicsMetadata;
|
||||
use layers::platform::surface::NativeDisplay;
|
||||
use msg::constellation_msg;
|
||||
use msg::constellation_msg::Key;
|
||||
use net::net_error_list::NetError;
|
||||
|
@ -617,29 +617,16 @@ impl WindowMethods for Window {
|
|||
}
|
||||
|
||||
#[cfg(target_os="linux")]
|
||||
fn native_metadata(&self) -> NativeGraphicsMetadata {
|
||||
fn native_display(&self) -> NativeDisplay {
|
||||
use x11::xlib;
|
||||
NativeGraphicsMetadata {
|
||||
display: unsafe { self.window.platform_display() as *mut xlib::Display }
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os="macos")]
|
||||
fn native_metadata(&self) -> NativeGraphicsMetadata {
|
||||
use cgl::{CGLGetCurrentContext, CGLGetPixelFormat};
|
||||
unsafe {
|
||||
NativeGraphicsMetadata {
|
||||
pixel_format: CGLGetPixelFormat(CGLGetCurrentContext()),
|
||||
}
|
||||
NativeDisplay::new(self.window.platform_display() as *mut xlib::Display)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os="android")]
|
||||
fn native_metadata(&self) -> NativeGraphicsMetadata {
|
||||
use egl::egl::GetCurrentDisplay;
|
||||
NativeGraphicsMetadata {
|
||||
display: GetCurrentDisplay(),
|
||||
}
|
||||
#[cfg(not(target_os="linux"))]
|
||||
fn native_display(&self) -> NativeDisplay {
|
||||
NativeDisplay::new()
|
||||
}
|
||||
|
||||
/// Helper function to handle keyboard events.
|
||||
|
@ -795,10 +782,8 @@ impl WindowMethods for Window {
|
|||
}
|
||||
|
||||
#[cfg(target_os="linux")]
|
||||
fn native_metadata(&self) -> NativeGraphicsMetadata {
|
||||
NativeGraphicsMetadata {
|
||||
display: ptr::null_mut()
|
||||
}
|
||||
fn native_display(&self) -> NativeDisplay {
|
||||
NativeDisplay::new(ptr::null_mut())
|
||||
}
|
||||
|
||||
/// Helper function to handle keyboard events.
|
||||
|
|
4
ports/gonk/Cargo.lock
generated
4
ports/gonk/Cargo.lock
generated
|
@ -568,7 +568,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
[[package]]
|
||||
name = "layers"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-layers#a3f07d9a7e34fe368aa8010a83ce8979491fc057"
|
||||
source = "git+https://github.com/servo/rust-layers#01bfc9fbb0748af62d89720f67a84e9542fad1d1"
|
||||
dependencies = [
|
||||
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
|
||||
"cgl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -774,7 +774,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "offscreen_gl_context"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#9b2a5fc48de8b06d02e0d18329dd6dd797b01d05"
|
||||
source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#46c5cc8694b08c09de55821e0e8a00ebe5ed97da"
|
||||
dependencies = [
|
||||
"cgl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
|
@ -9,7 +9,7 @@ use compositing::windowing::{WindowEvent, WindowMethods};
|
|||
use euclid::scale_factor::ScaleFactor;
|
||||
use euclid::size::{Size2D, TypedSize2D};
|
||||
use layers::geometry::DevicePixel;
|
||||
use layers::platform::surface::NativeGraphicsMetadata;
|
||||
use layers::platform::surface::NativeDisplay;
|
||||
use libc::c_int;
|
||||
use msg::constellation_msg::{Key, KeyModifiers};
|
||||
use net::net_error_list::NetError;
|
||||
|
@ -819,10 +819,8 @@ impl WindowMethods for Window {
|
|||
ScaleFactor::new(1.0)
|
||||
}
|
||||
|
||||
fn native_metadata(&self) -> NativeGraphicsMetadata {
|
||||
NativeGraphicsMetadata {
|
||||
display: self.dpy,
|
||||
}
|
||||
fn native_display(&self) -> NativeDisplay {
|
||||
NativeDisplay::new_with_display(self.dpy)
|
||||
}
|
||||
|
||||
fn handle_key(&self, _: Key, _: KeyModifiers) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue