Skip to content

Commit

Permalink
Make Servo components use winapi 0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
nox committed Jan 16, 2019
1 parent bd0b191 commit 600ce02
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 34 deletions.
26 changes: 2 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/allocator/Cargo.toml
Expand Up @@ -13,4 +13,4 @@ path = "lib.rs"
jemalloc-sys = { version = "0.1.4" }

[target.'cfg(windows)'.dependencies]
kernel32-sys = { version = "0.2.1" }
winapi = { version = "0.3", features = ["heapapi"] }
2 changes: 1 addition & 1 deletion components/allocator/lib.rs
Expand Up @@ -98,9 +98,9 @@ mod platform {

#[cfg(windows)]
mod platform {
use kernel32::{GetProcessHeap, HeapSize, HeapValidate};
pub use std::alloc::System as Allocator;
use std::os::raw::c_void;
use winapi::um::heapapi::{GetProcessHeap, HeapSize, HeapValidate};

/// Get the size of a heap block.
pub unsafe extern "C" fn usable_size(mut ptr: *const c_void) -> usize {
Expand Down
4 changes: 1 addition & 3 deletions ports/servo/Cargo.toml
Expand Up @@ -60,9 +60,7 @@ osmesa-sys = "0.1.2"
x11 = "2.0.0"

[target.'cfg(target_os = "windows")'.dependencies]
winapi = "0.2"
user32-sys = "0.2"
gdi32-sys = "0.2"
winapi = { version = "0.3", features = ["wingdi", "winuser"] }

[target.'cfg(any(target_os = "macos", all(target_arch = "x86_64", target_os = "linux")))'.dependencies]
osmesa-src = {git = "https://github.com/servo/osmesa-src"}
8 changes: 3 additions & 5 deletions ports/servo/glutin_app/window.rs
Expand Up @@ -5,8 +5,6 @@
//! A windowing implementation using winit.

use euclid::{TypedPoint2D, TypedVector2D, TypedScale, TypedSize2D};
#[cfg(target_os = "windows")]
use gdi32;
use gleam::gl;
use glutin::{Api, ContextBuilder, GlContext, GlRequest, GlWindow};
use keyboard_types::{Key, KeyboardEvent, KeyState};
Expand All @@ -31,7 +29,7 @@ use std::thread;
use std::time;
use super::keyutils::keyboard_event_from_winit;
#[cfg(target_os = "windows")]
use user32;
use winapi;
use winit::{ElementState, Event, MouseButton, MouseScrollDelta, TouchPhase, KeyboardInput};
use winit::dpi::{LogicalPosition, LogicalSize, PhysicalSize};
#[cfg(target_os = "macos")]
Expand Down Expand Up @@ -159,8 +157,8 @@ fn window_creation_scale_factor() -> TypedScale<f32, DeviceIndependentPixel, Dev

#[cfg(target_os = "windows")]
fn window_creation_scale_factor() -> TypedScale<f32, DeviceIndependentPixel, DevicePixel> {
let hdc = unsafe { user32::GetDC(::std::ptr::null_mut()) };
let ppi = unsafe { gdi32::GetDeviceCaps(hdc, winapi::wingdi::LOGPIXELSY) };
let hdc = unsafe { winapi::um::winuser::GetDC(::std::ptr::null_mut()) };
let ppi = unsafe { winapi::um::wingdi::GetDeviceCaps(hdc, winapi::um::wingdi::LOGPIXELSY) };
TypedScale::new(ppi as f32 / 96.0)
}

Expand Down

0 comments on commit 600ce02

Please sign in to comment.