mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
fix undefined symbols in embedding lib
cef_get_xdisplay() was an internal function that should not have been used here
This commit is contained in:
parent
7e7ee225c7
commit
6e74e510c6
3 changed files with 36 additions and 9 deletions
10
ports/cef/Cargo.lock
generated
10
ports/cef/Cargo.lock
generated
|
@ -29,6 +29,7 @@ dependencies = [
|
|||
"style 0.0.1",
|
||||
"url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"x11 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1298,6 +1299,15 @@ dependencies = [
|
|||
"libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "x11"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xlib"
|
||||
version = "0.1.0"
|
||||
|
|
|
@ -84,3 +84,9 @@ git = "https://github.com/servo/rust-cgl"
|
|||
url = "*"
|
||||
libc = "*"
|
||||
objc = "0.1"
|
||||
|
||||
[target.i686-unknown-linux-gnu.dependencies]
|
||||
x11 = "*"
|
||||
|
||||
[target.x86_64-unknown-linux-gnu.dependencies]
|
||||
x11 = "*"
|
||||
|
|
|
@ -23,6 +23,7 @@ use layers::platform::surface::NativeGraphicsMetadata;
|
|||
use libc::{c_char, c_void};
|
||||
use msg::constellation_msg::{Key, KeyModifiers};
|
||||
use msg::compositor_msg::{ReadyState, PaintState};
|
||||
use std::ptr;
|
||||
use std_url::Url;
|
||||
use util::cursor::Cursor;
|
||||
use util::geometry::ScreenPx;
|
||||
|
@ -30,11 +31,17 @@ use std::cell::RefCell;
|
|||
use std::ffi::CString;
|
||||
use std::rc::Rc;
|
||||
use std::sync::mpsc::{Sender, channel};
|
||||
#[cfg(target_os="linux")]
|
||||
extern crate x11;
|
||||
#[cfg(target_os="linux")]
|
||||
use self::x11::xlib::XOpenDisplay;
|
||||
|
||||
/// The type of an off-screen window.
|
||||
#[derive(Clone)]
|
||||
pub struct Window {
|
||||
cef_browser: RefCell<Option<CefBrowser>>,
|
||||
#[cfg(target_os="linux")]
|
||||
display: *mut c_void,
|
||||
}
|
||||
|
||||
#[cfg(target_os="macos")]
|
||||
|
@ -69,6 +76,16 @@ fn load_gl() {
|
|||
|
||||
impl Window {
|
||||
/// Creates a new window.
|
||||
#[cfg(target_os="linux")]
|
||||
pub fn new() -> Rc<Window> {
|
||||
load_gl();
|
||||
|
||||
Rc::new(Window {
|
||||
cef_browser: RefCell::new(None),
|
||||
display: unsafe { XOpenDisplay(ptr::null()) as *mut c_void },
|
||||
})
|
||||
}
|
||||
#[cfg(not(target_os="linux"))]
|
||||
pub fn new() -> Rc<Window> {
|
||||
load_gl();
|
||||
|
||||
|
@ -249,15 +266,9 @@ impl WindowMethods for Window {
|
|||
|
||||
#[cfg(target_os="linux")]
|
||||
fn native_metadata(&self) -> NativeGraphicsMetadata {
|
||||
extern {
|
||||
fn cef_get_xdisplay() -> *mut c_void;
|
||||
}
|
||||
|
||||
unsafe {
|
||||
NativeGraphicsMetadata {
|
||||
display: cef_get_xdisplay()
|
||||
}
|
||||
}
|
||||
NativeGraphicsMetadata {
|
||||
display: self.display,
|
||||
}
|
||||
}
|
||||
|
||||
fn create_compositor_channel(_: &Option<Rc<Window>>)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue