Add changelog entry

This commit is contained in:
Osspial 2020-01-05 16:57:32 -05:00
parent a1b8d265d0
commit 3aa3880e69
10 changed files with 21 additions and 15 deletions

View file

@ -1,6 +1,14 @@
# Unreleased
- On X11, fix `ModifiersChanged` emitting incorrect modifier change events
- **Breaking**: Overhaul how Winit handles DPI:
+ Window functions and events now return `PhysicalSize` instead of `LogicalSize`.
+ Functions that take `Size` or `Position` types can now take either `Logical` or `Physical` types.
+ `hidpi_factor` has been renamed to `scale_factor`.
+ `HiDpiFactorChanged` has been renamed to `ScaleFactorChanged`, and lets you control how the OS
resizes the window in response to the change.
+ On X11, deprecate `WINIT_HIDPI_FACTOR` environment variable in favor of `WINIT_X11_SCALE_FACTOR`.
+ `Size` and `Position` types are generic over their exact pixel type.
# 0.20.0 Alpha 6 (2020-01-03)
@ -47,8 +55,6 @@
- On X11, generate synthetic key events for keys held when a window gains or loses focus.
- On X11, issue a `CursorMoved` event when a `Touch` event occurs,
as X11 implicitly moves the cursor for such events.
- Rename `hidpi_factor` to `scale_factor`
- On X11, deprecate `WINIT_HIDPI_FACTOR` environment variable in favor of `WINIT_X11_SCALE_FACTOR`
# 0.20.0 Alpha 4 (2019-10-18)

View file

@ -52,12 +52,12 @@
//!
//! ### Events
//!
//! Winit will dispatch a [`DpiChanged`](crate::event::WindowEvent::DpiChanged)
//! Winit will dispatch a [`ScaleFactorChanged`](crate::event::WindowEvent::ScaleFactorChanged)
//! event whenever a window's scale factor has changed. This can happen if the user drags their
//! window from a standard-resolution monitor to a high-DPI monitor, or if the user changes their
//! DPI settings. This gives you a chance to rescale your application's UI elements and adjust how
//! the platform changes the window's size to reflect the new scale factor. If a window hasn't
//! received a [`DpiChanged`](crate::event::WindowEvent::DpiChanged) event,
//! received a [`ScaleFactorChanged`](crate::event::WindowEvent::ScaleFactorChanged) event,
//! then its scale factor is `1.0`.
//!
//! ## How is the scale factor calculated?

View file

@ -305,7 +305,7 @@ pub enum WindowEvent<'a> {
/// by the OS, but it can be changed to any value.
///
/// For more information about DPI in general, see the [`dpi`](crate::dpi) module.
DpiChanged {
ScaleFactorChanged {
scale_factor: f64,
new_inner_size: &'a mut PhysicalSize<u32>,
},
@ -397,7 +397,7 @@ impl<'a> WindowEvent<'a> {
}),
Touch(touch) => Some(Touch(touch)),
ThemeChanged(theme) => Some(ThemeChanged(theme)),
DpiChanged { .. } => None,
ScaleFactorChanged { .. } => None,
}
}
}

View file

@ -865,7 +865,7 @@ fn handle_hidpi_proxy(
let new_inner_size = &mut size;
let event = Event::WindowEvent {
window_id: RootWindowId(window_id.into()),
event: WindowEvent::DpiChanged {
event: WindowEvent::ScaleFactorChanged {
scale_factor,
new_inner_size,
},

View file

@ -398,7 +398,7 @@ impl Window {
};
app_state::set_key_window(window);
// Like the Windows and macOS backends, we send a `DpiChanged` and `Resized`
// Like the Windows and macOS backends, we send a `ScaleFactorChanged` and `Resized`
// event on window creation if the DPI factor != 1.0
let dpi_factor: CGFloat = msg_send![view, contentScaleFactor];
let scale_factor: f64 = dpi_factor.into();

View file

@ -734,7 +734,7 @@ impl<T> EventLoop<T> {
callback(Event::WindowEvent {
window_id,
event: WindowEvent::DpiChanged {
event: WindowEvent::ScaleFactorChanged {
scale_factor: dpi,
new_inner_size: &mut new_inner_size,
},

View file

@ -427,7 +427,7 @@ impl<T: 'static> EventProcessor<T> {
callback(Event::WindowEvent {
window_id,
event: WindowEvent::DpiChanged {
event: WindowEvent::ScaleFactorChanged {
scale_factor: new_scale_factor,
new_inner_size: &mut new_inner_size,
},
@ -1148,7 +1148,7 @@ impl<T: 'static> EventProcessor<T> {
callback(Event::WindowEvent {
window_id,
event: WindowEvent::DpiChanged {
event: WindowEvent::ScaleFactorChanged {
scale_factor: new_monitor.scale_factor,
new_inner_size: &mut new_inner_size,
},

View file

@ -192,7 +192,7 @@ impl Handler {
let new_inner_size = &mut size;
let event = Event::WindowEvent {
window_id: WindowId(get_window_id(*ns_window)),
event: WindowEvent::DpiChanged {
event: WindowEvent::ScaleFactorChanged {
scale_factor,
new_inner_size,
},

View file

@ -1415,7 +1415,7 @@ unsafe extern "system" fn public_window_callback<T: 'static>(
// Only sent on Windows 8.1 or newer. On Windows 7 and older user has to log out to change
// DPI, therefore all applications are closed while DPI is changing.
winuser::WM_DPICHANGED => {
use crate::event::WindowEvent::DpiChanged;
use crate::event::WindowEvent::ScaleFactorChanged;
// This message actually provides two DPI values - x and y. However MSDN says that
// "you only need to use either the X-axis or the Y-axis value when scaling your
@ -1499,7 +1499,7 @@ unsafe extern "system" fn public_window_callback<T: 'static>(
let _ = subclass_input.send_event_unbuffered(Event::WindowEvent {
window_id: RootWindowId(WindowId(window)),
event: DpiChanged {
event: ScaleFactorChanged {
scale_factor: new_dpi_factor,
new_inner_size: &mut new_physical_inner_size,
},

View file

@ -371,7 +371,7 @@ impl Window {
/// See the [`dpi`](crate::dpi) module for more information.
///
/// Note that this value can change depending on user action (for example if the window is
/// moved to another screen); as such, tracking `WindowEvent::DpiChanged` events is
/// moved to another screen); as such, tracking `WindowEvent::ScaleFactorChanged` events is
/// the most robust way to track the DPI you need to use to draw.
///
/// ## Platform-specific