mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-27 13:28:28 +00:00
Run cargo fmt on winit 0.22 changes
This commit is contained in:
parent
02545f9c38
commit
59c67e78f4
@ -90,7 +90,7 @@ use winit::{
|
|||||||
TouchPhase, VirtualKeyCode, Window, WindowEvent,
|
TouchPhase, VirtualKeyCode, Window, WindowEvent,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(any(feature = "winit-20", feature ="winit-22"))]
|
#[cfg(any(feature = "winit-20", feature = "winit-22"))]
|
||||||
use winit::{
|
use winit::{
|
||||||
error::ExternalError,
|
error::ExternalError,
|
||||||
event::{
|
event::{
|
||||||
@ -213,7 +213,7 @@ impl WinitPlatform {
|
|||||||
///
|
///
|
||||||
/// * framebuffer scale (= DPI factor) is set
|
/// * framebuffer scale (= DPI factor) is set
|
||||||
/// * display size is set
|
/// * display size is set
|
||||||
#[cfg(any(feature = "winit-20", feature ="winit-22"))]
|
#[cfg(any(feature = "winit-20", feature = "winit-22"))]
|
||||||
pub fn attach_window(&mut self, io: &mut Io, window: &Window, hidpi_mode: HiDpiMode) {
|
pub fn attach_window(&mut self, io: &mut Io, window: &Window, hidpi_mode: HiDpiMode) {
|
||||||
let (hidpi_mode, hidpi_factor) = hidpi_mode.apply(window.scale_factor());
|
let (hidpi_mode, hidpi_factor) = hidpi_mode.apply(window.scale_factor());
|
||||||
self.hidpi_mode = hidpi_mode;
|
self.hidpi_mode = hidpi_mode;
|
||||||
@ -246,7 +246,7 @@ impl WinitPlatform {
|
|||||||
///
|
///
|
||||||
/// This utility function is useful if you are using a DPI mode other than default, and want
|
/// This utility function is useful if you are using a DPI mode other than default, and want
|
||||||
/// your application to use the same logical coordinates as imgui-rs.
|
/// your application to use the same logical coordinates as imgui-rs.
|
||||||
#[cfg(any(feature = "winit-20", feature ="winit-22"))]
|
#[cfg(any(feature = "winit-20", feature = "winit-22"))]
|
||||||
pub fn scale_size_from_winit(
|
pub fn scale_size_from_winit(
|
||||||
&self,
|
&self,
|
||||||
window: &Window,
|
window: &Window,
|
||||||
@ -280,7 +280,7 @@ impl WinitPlatform {
|
|||||||
///
|
///
|
||||||
/// This utility function is useful if you are using a DPI mode other than default, and want
|
/// This utility function is useful if you are using a DPI mode other than default, and want
|
||||||
/// your application to use the same logical coordinates as imgui-rs.
|
/// your application to use the same logical coordinates as imgui-rs.
|
||||||
#[cfg(any(feature = "winit-20", feature ="winit-22"))]
|
#[cfg(any(feature = "winit-20", feature = "winit-22"))]
|
||||||
pub fn scale_pos_from_winit(
|
pub fn scale_pos_from_winit(
|
||||||
&self,
|
&self,
|
||||||
window: &Window,
|
window: &Window,
|
||||||
@ -314,7 +314,7 @@ impl WinitPlatform {
|
|||||||
///
|
///
|
||||||
/// This utility function is useful if you are using a DPI mode other than default, and want
|
/// This utility function is useful if you are using a DPI mode other than default, and want
|
||||||
/// your application to use the same logical coordinates as imgui-rs.
|
/// your application to use the same logical coordinates as imgui-rs.
|
||||||
#[cfg(any(feature = "winit-20", feature ="winit-22"))]
|
#[cfg(any(feature = "winit-20", feature = "winit-22"))]
|
||||||
pub fn scale_pos_for_winit(
|
pub fn scale_pos_for_winit(
|
||||||
&self,
|
&self,
|
||||||
window: &Window,
|
window: &Window,
|
||||||
@ -441,11 +441,11 @@ impl WinitPlatform {
|
|||||||
// we might never see the release event if some other window gets focus.
|
// we might never see the release event if some other window gets focus.
|
||||||
Event::DeviceEvent {
|
Event::DeviceEvent {
|
||||||
event:
|
event:
|
||||||
DeviceEvent::Key(KeyboardInput {
|
DeviceEvent::Key(KeyboardInput {
|
||||||
state: ElementState::Released,
|
state: ElementState::Released,
|
||||||
virtual_keycode: Some(key),
|
virtual_keycode: Some(key),
|
||||||
..
|
..
|
||||||
}),
|
}),
|
||||||
..
|
..
|
||||||
} => {
|
} => {
|
||||||
io.keys_down[key as usize] = false;
|
io.keys_down[key as usize] = false;
|
||||||
@ -663,7 +663,7 @@ impl WinitPlatform {
|
|||||||
/// This function performs the following actions:
|
/// This function performs the following actions:
|
||||||
///
|
///
|
||||||
/// * mouse cursor is repositioned (if requested by imgui-rs)
|
/// * mouse cursor is repositioned (if requested by imgui-rs)
|
||||||
#[cfg(any(feature = "winit-20", feature ="winit-22"))]
|
#[cfg(any(feature = "winit-20", feature = "winit-22"))]
|
||||||
pub fn prepare_frame(&self, io: &mut Io, window: &Window) -> Result<(), ExternalError> {
|
pub fn prepare_frame(&self, io: &mut Io, window: &Window) -> Result<(), ExternalError> {
|
||||||
if io.want_set_mouse_pos {
|
if io.want_set_mouse_pos {
|
||||||
let logical_pos = self.scale_pos_for_winit(
|
let logical_pos = self.scale_pos_for_winit(
|
||||||
@ -713,7 +713,7 @@ impl WinitPlatform {
|
|||||||
/// This function performs the following actions:
|
/// This function performs the following actions:
|
||||||
///
|
///
|
||||||
/// * mouse cursor is changed and/or hidden (if requested by imgui-rs)
|
/// * mouse cursor is changed and/or hidden (if requested by imgui-rs)
|
||||||
#[cfg(any(feature = "winit-20", feature ="winit-22"))]
|
#[cfg(any(feature = "winit-20", feature = "winit-22"))]
|
||||||
pub fn prepare_render(&self, ui: &Ui, window: &Window) {
|
pub fn prepare_render(&self, ui: &Ui, window: &Window) {
|
||||||
let io = ui.io();
|
let io = ui.io();
|
||||||
if !io
|
if !io
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user