summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--graphics/src/viewport.rs2
-rw-r--r--native/src/widget/pick_list.rs2
-rw-r--r--native/src/window/event.rs8
-rw-r--r--winit/src/conversion.rs5
4 files changed, 14 insertions, 3 deletions
diff --git a/graphics/src/viewport.rs b/graphics/src/viewport.rs
index 78d539af..2c0b541a 100644
--- a/graphics/src/viewport.rs
+++ b/graphics/src/viewport.rs
@@ -31,7 +31,7 @@ impl Viewport {
/// Returns the physical width of the [`Viewport`].
pub fn physical_width(&self) -> u32 {
- self.physical_size.height
+ self.physical_size.width
}
/// Returns the physical height of the [`Viewport`].
diff --git a/native/src/widget/pick_list.rs b/native/src/widget/pick_list.rs
index 58c0dfe1..4110b9bb 100644
--- a/native/src/widget/pick_list.rs
+++ b/native/src/widget/pick_list.rs
@@ -132,7 +132,7 @@ where
Renderer: self::Renderer + scrollable::Renderer + 'a,
{
fn width(&self) -> Length {
- Length::Shrink
+ self.width
}
fn height(&self) -> Length {
diff --git a/native/src/window/event.rs b/native/src/window/event.rs
index b177141a..fc746781 100644
--- a/native/src/window/event.rs
+++ b/native/src/window/event.rs
@@ -3,7 +3,7 @@ use std::path::PathBuf;
/// A window-related event.
#[derive(PartialEq, Clone, Debug)]
pub enum Event {
- /// A window was resized
+ /// A window was resized.
Resized {
/// The new width of the window (in units)
width: u32,
@@ -12,6 +12,12 @@ pub enum Event {
height: u32,
},
+ /// A window was focused.
+ Focused,
+
+ /// A window was unfocused.
+ Unfocused,
+
/// A file is being hovered over the window.
///
/// When the user hovers multiple files at once, this event will be emitted
diff --git a/winit/src/conversion.rs b/winit/src/conversion.rs
index f073c474..0e04b35d 100644
--- a/winit/src/conversion.rs
+++ b/winit/src/conversion.rs
@@ -109,6 +109,11 @@ pub fn window_event(
WindowEvent::ModifiersChanged(new_modifiers) => Some(Event::Keyboard(
keyboard::Event::ModifiersChanged(self::modifiers(*new_modifiers)),
)),
+ WindowEvent::Focused(focused) => Some(Event::Window(if *focused {
+ window::Event::Focused
+ } else {
+ window::Event::Unfocused
+ })),
WindowEvent::HoveredFile(path) => {
Some(Event::Window(window::Event::FileHovered(path.clone())))
}