From 1cb4a7676a3eef62b4c3465051556cffb08c57e1 Mon Sep 17 00:00:00 2001 From: Benjamin Klum Date: Fri, 18 Oct 2024 05:53:54 +0200 Subject: [PATCH] #1256 Docs: Add support for processing mouse-move events intended to be used for mouse-over help --- main/src/infrastructure/ui/mapping_panel.rs | 5 +++++ swell-ui/src/view.rs | 8 ++++++++ swell-ui/src/view_manager.rs | 6 ++++++ 3 files changed, 19 insertions(+) diff --git a/main/src/infrastructure/ui/mapping_panel.rs b/main/src/infrastructure/ui/mapping_panel.rs index caed2cb80..1b8018e70 100644 --- a/main/src/infrastructure/ui/mapping_panel.rs +++ b/main/src/infrastructure/ui/mapping_panel.rs @@ -7486,6 +7486,11 @@ impl View for MappingPanel { false } } + + // fn mouse_moved(self: SharedView, position: Point) -> bool { + // // dbg!(position); + // false + // } } const SOURCE_MATCH_INDICATOR_TIMER_ID: usize = 570; diff --git a/swell-ui/src/view.rs b/swell-ui/src/view.rs index 5dcd59e33..faa5b0750 100644 --- a/swell-ui/src/view.rs +++ b/swell-ui/src/view.rs @@ -138,6 +138,14 @@ pub trait View: Debug { false } + /// WM_MOUSEMOVE. + /// + /// Should return `true` if processed. + fn mouse_moved(self: SharedView, position: Point) -> bool { + let _ = position; + false + } + /// WM_KEYDOWN. /// /// Should return `true` if processed. diff --git a/swell-ui/src/view_manager.rs b/swell-ui/src/view_manager.rs index fd61dac9d..1040d40f3 100644 --- a/swell-ui/src/view_manager.rs +++ b/swell-ui/src/view_manager.rs @@ -210,6 +210,12 @@ unsafe extern "C" fn view_dialog_proc( // messages are passed through to the XBridge window. This is SWELL functionality // (check the SWELL code). KEYBOARD_MSG_FOR_X_BRIDGE => 0, + raw::WM_MOUSEMOVE => view + .mouse_moved(Point::new( + Pixels(loword(lparam as _) as _), + Pixels(hiword(lparam as _) as _), + )) + .into(), raw::WM_SIZE => view.resized().into(), raw::WM_SETFOCUS => view.focused().into(), raw::WM_COMMAND => {