diff options
| author | 2025-01-16 11:44:15 +0000 | |
|---|---|---|
| committer | 2025-01-16 11:44:15 +0000 | |
| commit | 24297c549be022ee1e848c0c090df986e825f10c (patch) | |
| tree | 10d10bf65d41de0d04ea7ae8037dd49681f3916b /winit | |
| parent | a00f564deed291765a35311784096193dc3988b3 (diff) | |
| parent | 8a453903b99dd2855e556f5f8baab502441eb16b (diff) | |
| download | iced-24297c549be022ee1e848c0c090df986e825f10c.tar.gz iced-24297c549be022ee1e848c0c090df986e825f10c.tar.bz2 iced-24297c549be022ee1e848c0c090df986e825f10c.zip | |
Merge pull request #2642 from tsuza/master
feat: add a window drag resize task
Diffstat (limited to '')
| -rw-r--r-- | winit/src/conversion.rs | 26 | ||||
| -rw-r--r-- | winit/src/program.rs | 7 | 
2 files changed, 32 insertions, 1 deletions
| diff --git a/winit/src/conversion.rs b/winit/src/conversion.rs index 01c6abc8..462be65b 100644 --- a/winit/src/conversion.rs +++ b/winit/src/conversion.rs @@ -1120,7 +1120,7 @@ pub fn native_key_code(      }  } -/// Converts some [`UserAttention`] into it's `winit` counterpart. +/// Converts some [`UserAttention`] into its `winit` counterpart.  ///  /// [`UserAttention`]: window::UserAttention  pub fn user_attention( @@ -1136,6 +1136,30 @@ pub fn user_attention(      }  } +/// Converts some [`window::Direction`] into a [`winit::window::ResizeDirection`]. +pub fn resize_direction( +    resize_direction: window::Direction, +) -> winit::window::ResizeDirection { +    match resize_direction { +        window::Direction::North => winit::window::ResizeDirection::North, +        window::Direction::South => winit::window::ResizeDirection::South, +        window::Direction::East => winit::window::ResizeDirection::East, +        window::Direction::West => winit::window::ResizeDirection::West, +        window::Direction::NorthEast => { +            winit::window::ResizeDirection::NorthEast +        } +        window::Direction::NorthWest => { +            winit::window::ResizeDirection::NorthWest +        } +        window::Direction::SouthEast => { +            winit::window::ResizeDirection::SouthEast +        } +        window::Direction::SouthWest => { +            winit::window::ResizeDirection::SouthWest +        } +    } +} +  /// Converts some [`window::Icon`] into it's `winit` counterpart.  ///  /// Returns `None` if there is an error during the conversion. diff --git a/winit/src/program.rs b/winit/src/program.rs index dddaf33d..5387e5e5 100644 --- a/winit/src/program.rs +++ b/winit/src/program.rs @@ -1265,6 +1265,13 @@ fn run_action<P, C>(                      let _ = window.raw.drag_window();                  }              } +            window::Action::DragResize(id, direction) => { +                if let Some(window) = window_manager.get_mut(id) { +                    let _ = window.raw.drag_resize_window( +                        conversion::resize_direction(direction), +                    ); +                } +            }              window::Action::Resize(id, size) => {                  if let Some(window) = window_manager.get_mut(id) {                      let _ = window.raw.request_inner_size( | 
