dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

DesktopConfig.with_event_handler is unused

Open ColonelThirtyTwo opened this issue 2 years ago • 4 comments

DesktopConfig.with_event_handler sets the event_handler field, but that isn't used anywhere:

> grep -r 'event_handler' packages/desktop/
packages/desktop/src/cfg.rs:    pub(crate) event_handler: Option<Box<DynEventHandlerFn>>,
packages/desktop/src/cfg.rs:            event_handler: None,
packages/desktop/src/cfg.rs:    pub fn with_event_handler(
packages/desktop/src/cfg.rs:        self.event_handler = Some(Box::new(handler));

Would be nice to install an application-wide keypress handler.

ColonelThirtyTwo avatar Jul 29 '22 17:07 ColonelThirtyTwo

If I understand correctly, it's for window events such as "minimize" or "close", etc. I think it should just be removed until such functionality is implemented.

Would be nice to install an application-wide keypress handler.

You can probably add this on some wrapper for the whole document if needed.

rMazeiks avatar Jul 29 '22 18:07 rMazeiks

Well, when I tried to use onkeydown on the top level rsx macro, it complained about an unexpected token.

ColonelThirtyTwo avatar Aug 01 '22 00:08 ColonelThirtyTwo

wrap it in a div or similar. only elements can have attributes.

rMazeiks avatar Aug 01 '22 09:08 rMazeiks

Will that work even if the window is focused by, say, clicking on the titlebar?

ColonelThirtyTwo avatar Aug 05 '22 19:08 ColonelThirtyTwo