Skip to content

Commit

Permalink
Address feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
xStrom committed Jun 18, 2020
1 parent 0accfb8 commit 73b93a3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ You can find its changes [documented below](#060---2020-06-01).
### Changed

- `Image` and `ImageData` exported by default. ([#1011] by [@covercash2])
- `Scale::from_scale` to `Scale::new`, and `Scale` methods `scale_x` / `scale_y` to `x` / `y`. ([#1042] by [@xStrom])

### Deprecated

### Removed

- DPI related functions/methods from `Scale`. ([#1042] by [@xStrom])
- `Scale::from_dpi`, `Scale::dpi_x`, and `Scale::dpi_y`. ([#1042] by [@xStrom])

### Fixed

Expand Down
6 changes: 4 additions & 2 deletions druid-shell/src/platform/gtk/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ use super::dialog;
use super::menu::Menu;
use super::util;

/// When the GTK reported DPI differs from this we will scale coordinates to achieve it.
/// The platform target DPI.
///
/// GTK considers 96 the default value which represents a 1.0 scale factor.
const SCALE_TARGET_DPI: f64 = 96.0;

/// Taken from https://gtk-rs.org/docs-src/tutorial/closures
Expand Down Expand Up @@ -175,7 +177,7 @@ impl WindowBuilder {
// Get the scale factor based on the GTK reported DPI
let scale_factor = window
.get_display()
.map(|c| c.get_default_screen().get_resolution() as f64)
.map(|c| c.get_default_screen().get_resolution())
.unwrap_or(SCALE_TARGET_DPI)
/ SCALE_TARGET_DPI;
let scale = Scale::new(scale_factor, scale_factor);
Expand Down
4 changes: 3 additions & 1 deletion druid-shell/src/platform/windows/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ use crate::mouse::{Cursor, MouseButton, MouseButtons, MouseEvent};
use crate::scale::{Scale, ScaledArea};
use crate::window::{IdleToken, Text, TimerToken, WinHandler};

/// When the OS reported DPI differs from this we will scale coordinates to achieve it.
/// The platform target DPI.
///
/// Windows considers 96 the default value which represents a 1.0 scale factor.
pub(crate) const SCALE_TARGET_DPI: f64 = 96.0;

extern "system" {
Expand Down

0 comments on commit 73b93a3

Please sign in to comment.