introduce frame_size and window_rect

This commit is contained in:
Paul Rouget 2017-03-07 02:46:06 +01:00
parent c62973b77b
commit 2a05534efb
4 changed files with 50 additions and 11 deletions

View file

@ -19,7 +19,8 @@ use wrappers::CefWrap;
use compositing::compositor_thread::{self, CompositorProxy, CompositorReceiver};
use compositing::windowing::{WindowEvent, WindowMethods};
use euclid::point::Point2D;
use euclid::point::{Point2D, TypedPoint2D};
use euclid::rect::TypedRect;
use euclid::scale_factor::ScaleFactor;
use euclid::size::{Size2D, TypedSize2D};
use gleam::gl;
@ -206,6 +207,12 @@ impl WindowMethods for Window {
}
}
fn window_rect(&self) -> TypedRect<u32, DevicePixel> {
let size = self.framebuffer_size();
let origin = TypedPoint2D::zero();
TypedRect::new(origin, size)
}
fn size(&self) -> TypedSize2D<f32, DeviceIndependentPixel> {
let browser = self.cef_browser.borrow();
match *browser {

View file

@ -9,6 +9,7 @@ use compositing::compositor_thread::{self, CompositorProxy, CompositorReceiver};
use compositing::windowing::{MouseWindowEvent, WindowNavigateMsg};
use compositing::windowing::{WindowEvent, WindowMethods};
use euclid::{Point2D, Size2D, TypedPoint2D};
use euclid::rect::TypedRect;
use euclid::scale_factor::ScaleFactor;
use euclid::size::TypedSize2D;
#[cfg(target_os = "windows")]
@ -797,6 +798,12 @@ impl WindowMethods for Window {
}
}
fn window_rect(&self) -> TypedRect<u32, DevicePixel> {
let size = self.framebuffer_size();
let origin = TypedPoint2D::zero();
TypedRect::new(origin, size)
}
fn size(&self) -> TypedSize2D<f32, DeviceIndependentPixel> {
match self.kind {
WindowKind::Window(ref window) => {