mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
Update glutin and add hidpi methods.
This commit is contained in:
parent
432b89f60f
commit
f74db53329
2 changed files with 10 additions and 4 deletions
2
components/servo/Cargo.lock
generated
2
components/servo/Cargo.lock
generated
|
@ -335,7 +335,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glutin"
|
name = "glutin"
|
||||||
version = "0.0.2"
|
version = "0.0.2"
|
||||||
source = "git+https://github.com/servo/glutin?ref=servo#47d4e815c063f1ebff534e759e02e887006ae74f"
|
source = "git+https://github.com/servo/glutin?ref=servo#db27370a1cbafcbfcaeee52a44076a61b3e0573c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android_glue 0.0.1 (git+https://github.com/servo/android-rs-glue?ref=servo)",
|
"android_glue 0.0.1 (git+https://github.com/servo/android-rs-glue?ref=servo)",
|
||||||
"cocoa 0.1.1 (git+https://github.com/servo/rust-cocoa)",
|
"cocoa 0.1.1 (git+https://github.com/servo/rust-cocoa)",
|
||||||
|
|
|
@ -170,7 +170,11 @@ impl WindowMethods for Window {
|
||||||
/// Returns the size of the window in hardware pixels.
|
/// Returns the size of the window in hardware pixels.
|
||||||
fn framebuffer_size(&self) -> TypedSize2D<DevicePixel, uint> {
|
fn framebuffer_size(&self) -> TypedSize2D<DevicePixel, uint> {
|
||||||
let (width, height) = match self.glutin {
|
let (width, height) = match self.glutin {
|
||||||
WindowHandle::Windowed(ref window) => window.get_inner_size(),
|
WindowHandle::Windowed(ref window) => {
|
||||||
|
let scale_factor = window.hidpi_factor() as uint;
|
||||||
|
let (width, height) = window.get_inner_size().unwrap();
|
||||||
|
Some((width * scale_factor, height * scale_factor))
|
||||||
|
}
|
||||||
WindowHandle::Headless(ref context) => Some((context.size.to_untyped().width,
|
WindowHandle::Headless(ref context) => Some((context.size.to_untyped().width,
|
||||||
context.size.to_untyped().height)),
|
context.size.to_untyped().height)),
|
||||||
}.unwrap();
|
}.unwrap();
|
||||||
|
@ -230,8 +234,10 @@ impl WindowMethods for Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hidpi_factor(&self) -> ScaleFactor<ScreenPx, DevicePixel, f32> {
|
fn hidpi_factor(&self) -> ScaleFactor<ScreenPx, DevicePixel, f32> {
|
||||||
// TODO - handle hidpi
|
match self.glutin {
|
||||||
ScaleFactor(1.0)
|
WindowHandle::Windowed(ref window) => ScaleFactor(window.hidpi_factor()),
|
||||||
|
WindowHandle::Headless(_) => ScaleFactor(1.0),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_page_title(&self, _: Option<String>) {
|
fn set_page_title(&self, _: Option<String>) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue