Skip to content
Permalink
Browse files

Make Servo components use winapi 0.3

  • Loading branch information...
nox committed Jan 16, 2019
1 parent bd0b191 commit 600ce022ddbc5282622d16dde557e90ccb1a9355
Showing with 8 additions and 34 deletions.
  1. +2 −24 Cargo.lock
  2. +1 −1 components/allocator/Cargo.toml
  3. +1 −1 components/allocator/lib.rs
  4. +1 −3 ports/servo/Cargo.toml
  5. +3 −5 ports/servo/glutin_app/window.rs

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -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"] }
@@ -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 {
@@ -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"}
@@ -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};
@@ -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")]
@@ -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)
}

0 comments on commit 600ce02

Please sign in to comment.
You can’t perform that action at this time.