merge: pop-os/iced a l'etat pinne par libcosmic 7f715bc5d (epoch-1.10.0)
Some checks are pending
Audit / vulnerabilities (push) Waiting to run
Check / wasm (push) Waiting to run
Check / widget (push) Waiting to run
Document / all (push) Waiting to run
Format / all (push) Waiting to run
Lint / all (push) Waiting to run
Test / all (macOS-latest, 1.88) (push) Waiting to run
Test / all (macOS-latest, beta) (push) Waiting to run
Test / all (macOS-latest, stable) (push) Waiting to run
Test / all (ubuntu-latest, 1.88) (push) Waiting to run
Test / all (ubuntu-latest, beta) (push) Waiting to run
Test / all (ubuntu-latest, stable) (push) Waiting to run
Test / all (windows-latest, 1.88) (push) Waiting to run
Test / all (windows-latest, beta) (push) Waiting to run
Test / all (windows-latest, stable) (push) Waiting to run

This commit is contained in:
Lionel DARNIS 2026-10-11 06:57:56 +02:00
commit f8ac890b9c
7 changed files with 118 additions and 40 deletions

View file

@ -1,3 +1,10 @@
The core team is busy and does not have time to mentor nor babysit new contributors. If a member of the core team thinks that reviewing and understanding your work will take more time and effort than writing it from scratch by themselves, your contribution will be dismissed. It is your responsibility to communicate and figure out how to reduce the likelihood of this!
Replace this text with a description of your changes, and why these changes are important. Read and acknowledge the list below. PRs without a completed checkbox will be closed.
Read the contributing guidelines for more details: https://github.com/iced-rs/iced/blob/master/CONTRIBUTING.md
---
- I have not included any LLM (also known as AI) generated content in this PR, including code, comments, and descriptions.
- I understand these changes in full and will be able to respond to review comments.
- My change is accurately described in the commit message.
- My contribution is tested and working as described.
- I have read the [Developer Certificate of Origin](https://developercertificate.org/) and certify my contribution under its conditions.
- [ ] I have read and followed all of the above requirements. For more information, see our [contributor guide](https://github.com/pop-os/pop/blob/master/CONTRIBUTING.md).

14
.github/workflows/require-checklist.yml vendored Normal file
View file

@ -0,0 +1,14 @@
# From https://github.com/mheap/require-checklist-action, license MIT
name: Require Checklist
on:
pull_request:
types: [opened, edited, synchronize]
jobs:
job1:
runs-on: ubuntu-latest
steps:
- uses: mheap/require-checklist-action@v2
with:
requireChecklist: true

View file

@ -344,7 +344,7 @@ where
_renderer: &Renderer,
_clipboard: &mut dyn Clipboard,
shell: &mut Shell<'_, Message>,
_viewport: &Rectangle,
viewport: &Rectangle,
) {
let state = tree.state.downcast_mut::<State>();
@ -452,6 +452,8 @@ where
Event::Mouse(mouse::Event::ButtonReleased(
mouse::Button::Left,
))
| Event::Mouse(mouse::Event::CursorLeft)
| Event::Mouse(mouse::Event::CursorEntered)
| Event::Touch(touch::Event::FingerLifted { .. })
| Event::Touch(touch::Event::FingerLost { .. }) => {
if state.is_dragging {
@ -464,13 +466,20 @@ where
Event::Mouse(mouse::Event::CursorMoved { .. })
| Event::Touch(touch::Event::FingerMoved { .. }) => {
if state.is_dragging {
let _ = cursor
.land()
.position()
.and_then(locate)
.map(change);
let position = cursor.land().position();
let outside = position.is_none_or(|position| {
!viewport.contains(position)
});
shell.capture_event();
if outside {
if let Some(on_release) = self.on_release.clone() {
shell.publish(on_release);
}
state.is_dragging = false;
} else {
let _ = position.and_then(locate).map(change);
shell.capture_event();
}
}
}
Event::Mouse(mouse::Event::WheelScrolled { delta })

View file

@ -255,7 +255,7 @@ where
_renderer: &Renderer,
_clipboard: &mut dyn Clipboard,
shell: &mut Shell<'_, Message>,
_viewport: &Rectangle,
viewport: &Rectangle,
) {
let state = tree.state.downcast_mut::<State>();
let is_dragging = state.is_dragging;
@ -354,6 +354,8 @@ where
}
}
Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left))
| Event::Mouse(mouse::Event::CursorLeft)
| Event::Mouse(mouse::Event::CursorEntered)
| Event::Touch(touch::Event::FingerLifted { .. })
| Event::Touch(touch::Event::FingerLost { .. }) => {
if is_dragging {
@ -366,10 +368,20 @@ where
Event::Mouse(mouse::Event::CursorMoved { .. })
| Event::Touch(touch::Event::FingerMoved { .. }) => {
if is_dragging {
let _ =
cursor.land().position().and_then(locate).map(change);
let position = cursor.land().position();
let outside = position.is_none_or(|position| {
!viewport.contains(position)
});
shell.capture_event();
if outside {
if let Some(on_release) = self.on_release.clone() {
shell.publish(on_release);
}
state.is_dragging = false;
} else {
let _ = position.and_then(locate).map(change);
shell.capture_event();
}
}
}
Event::Mouse(mouse::Event::WheelScrolled { delta })

View file

@ -1,3 +1,5 @@
use crate::conversion;
use crate::core::mouse;
use cursor_icon::CursorIcon;
use winit::window::ResizeDirection;
@ -24,6 +26,9 @@ const DRAG_RESIZE_SUPPORTED: bool = true;
const DRAG_RESIZE_SUPPORTED: bool = false;
/// If supported by winit, returns a closure that implements cursor resize support.
///
/// The closure takes the cursor last set by the UI, which it restores when
/// the pointer leaves the resize border.
pub fn event_func(
window: &dyn winit::window::Window,
border_size: f64,
@ -32,6 +37,7 @@ pub fn event_func(
dyn FnMut(
&dyn winit::window::Window,
&winit::event::WindowEvent,
mouse::Interaction,
) -> bool,
>,
> {
@ -41,7 +47,8 @@ pub fn event_func(
Some(Box::new(
move |window: &dyn winit::window::Window,
window_event: &winit::event::WindowEvent|
window_event: &winit::event::WindowEvent,
ui_interaction: mouse::Interaction|
-> bool {
// Keep track of border resize state and set cursor icon when in range
match window_event {
@ -49,23 +56,30 @@ pub fn event_func(
position,
..
} => {
let resizable = !window.is_decorated()
&& !window.is_maximized()
&& window.fullscreen().is_none();
if resizable {
let location = cursor_resize_direction(
let location = if is_resizable(window) {
cursor_resize_direction(
window.surface_size(),
*position,
border_size,
);
if location != cursor_prev_resize_direction {
window.set_cursor(
resize_direction_cursor_icon(location)
)
} else {
None
};
if location != cursor_prev_resize_direction {
match location {
Some(direction) => window.set_cursor(
resize_direction_cursor_icon(direction)
.into(),
);
cursor_prev_resize_direction = location;
return true;
),
None => restore_cursor(window, ui_interaction),
}
cursor_prev_resize_direction = location;
return true;
}
}
winit::event::WindowEvent::PointerLeft { .. } => {
if cursor_prev_resize_direction.take().is_some() {
restore_cursor(window, ui_interaction);
}
}
winit::event::WindowEvent::PointerButton {
@ -80,7 +94,9 @@ pub fn event_func(
primary: true,
..
} => {
if let Some(direction) = cursor_prev_resize_direction {
if let Some(direction) = cursor_prev_resize_direction
&& is_resizable(window)
{
let _res = window.drag_resize_window(direction);
return true;
}
@ -96,22 +112,37 @@ pub fn event_func(
}
}
/// Whether the window can currently be resized from its border.
fn is_resizable(window: &dyn winit::window::Window) -> bool {
!window.is_decorated()
&& !window.is_maximized()
&& window.fullscreen().is_none()
}
/// Set the cursor back to the one the UI last set.
fn restore_cursor(
window: &dyn winit::window::Window,
ui_interaction: mouse::Interaction,
) {
// `None` means the UI hid the cursor, which a cursor icon doesn't undo.
if let Some(icon) = conversion::mouse_interaction(ui_interaction) {
window.set_cursor(icon.into());
}
}
/// Get the cursor icon that corresponds to the resize direction.
fn resize_direction_cursor_icon(
resize_direction: Option<ResizeDirection>,
resize_direction: ResizeDirection,
) -> CursorIcon {
match resize_direction {
Some(resize_direction) => match resize_direction {
ResizeDirection::East => CursorIcon::EResize,
ResizeDirection::North => CursorIcon::NResize,
ResizeDirection::NorthEast => CursorIcon::NeResize,
ResizeDirection::NorthWest => CursorIcon::NwResize,
ResizeDirection::South => CursorIcon::SResize,
ResizeDirection::SouthEast => CursorIcon::SeResize,
ResizeDirection::SouthWest => CursorIcon::SwResize,
ResizeDirection::West => CursorIcon::WResize,
},
None => CursorIcon::Default,
ResizeDirection::East => CursorIcon::EResize,
ResizeDirection::North => CursorIcon::NResize,
ResizeDirection::NorthEast => CursorIcon::NeResize,
ResizeDirection::NorthWest => CursorIcon::NwResize,
ResizeDirection::South => CursorIcon::SResize,
ResizeDirection::SouthEast => CursorIcon::SeResize,
ResizeDirection::SouthWest => CursorIcon::SwResize,
ResizeDirection::West => CursorIcon::WResize,
}
}

View file

@ -1326,7 +1326,11 @@ async fn run_instance<P>(
};
// Initiates a drag resize window state when found.
if let Some(func) = window.drag_resize_window_func.as_mut() {
if func(window.raw.as_ref(), &event) {
if func(
window.raw.as_ref(),
&event,
window.mouse_interaction,
) {
continue;
}
}

View file

@ -191,6 +191,7 @@ where
dyn FnMut(
&dyn winit::window::Window,
&winit::event::WindowEvent,
mouse::Interaction,
) -> bool,
>,
>,