From 8fb0ede72ef9ae4e40ae5bb32ae3e2415d4749c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Fri, 18 Dec 2020 09:40:10 +0100 Subject: [PATCH] Propagate `Button` events to contents --- native/src/widget/button.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/native/src/widget/button.rs b/native/src/widget/button.rs index 8e2450de..b8c14634 100644 --- a/native/src/widget/button.rs +++ b/native/src/widget/button.rs @@ -161,9 +161,20 @@ where layout: Layout<'_>, cursor_position: Point, messages: &mut Vec, - _renderer: &Renderer, - _clipboard: Option<&dyn Clipboard>, + renderer: &Renderer, + clipboard: Option<&dyn Clipboard>, ) -> event::Status { + if let event::Status::Captured = self.content.on_event( + event.clone(), + layout.children().next().unwrap(), + cursor_position, + messages, + renderer, + clipboard, + ) { + return event::Status::Captured; + } + match event { Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)) | Event::Touch(touch::Event::FingerPressed { .. }) => {