mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
deps: Switch from winapi
to windows_sys
in Servo code (#32516)
This is part of the switch from `winapi` to `windows-sys`. `windows-sys` is maintained by Microsoft, so is more "official." More and more crates are switching to it.
This commit is contained in:
parent
8b35c4094a
commit
e902d63732
7 changed files with 20 additions and 20 deletions
|
@ -24,8 +24,6 @@ use servo::webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize};
|
|||
use servo::webrender_api::ScrollLocation;
|
||||
use servo::webrender_traits::RenderingContext;
|
||||
use surfman::{Connection, Context, Device, SurfaceType};
|
||||
#[cfg(target_os = "windows")]
|
||||
use winapi;
|
||||
use winit::dpi::{LogicalPosition, PhysicalPosition, PhysicalSize};
|
||||
use winit::event::{ElementState, KeyEvent, MouseButton, MouseScrollDelta, TouchPhase};
|
||||
use winit::keyboard::{Key as LogicalKey, ModifiersState, NamedKey};
|
||||
|
@ -66,8 +64,9 @@ fn window_creation_scale_factor() -> Scale<f32, DeviceIndependentPixel, DevicePi
|
|||
|
||||
#[cfg(target_os = "windows")]
|
||||
fn window_creation_scale_factor() -> Scale<f32, DeviceIndependentPixel, DevicePixel> {
|
||||
let hdc = unsafe { winapi::um::winuser::GetDC(::std::ptr::null_mut()) };
|
||||
let ppi = unsafe { winapi::um::wingdi::GetDeviceCaps(hdc, winapi::um::wingdi::LOGPIXELSY) };
|
||||
use windows_sys::Win32::Graphics::Gdi::{GetDC, GetDeviceCaps, LOGPIXELSY};
|
||||
|
||||
let ppi = unsafe { GetDeviceCaps(GetDC(0), LOGPIXELSY as i32) };
|
||||
Scale::new(ppi as f32 / 96.0)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue