Skip to content

Commit

Permalink
#1256 Docs: Add support for processing mouse-move events
Browse files Browse the repository at this point in the history
intended to be used for mouse-over help
  • Loading branch information
helgoboss committed Oct 18, 2024
1 parent a5ff027 commit 1cb4a76
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions main/src/infrastructure/ui/mapping_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7486,6 +7486,11 @@ impl View for MappingPanel {
false
}
}

// fn mouse_moved(self: SharedView<Self>, position: Point<Pixels>) -> bool {
// // dbg!(position);
// false
// }
}

const SOURCE_MATCH_INDICATOR_TIMER_ID: usize = 570;
Expand Down
8 changes: 8 additions & 0 deletions swell-ui/src/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ pub trait View: Debug {
false
}

/// WM_MOUSEMOVE.
///
/// Should return `true` if processed.
fn mouse_moved(self: SharedView<Self>, position: Point<Pixels>) -> bool {
let _ = position;
false
}

/// WM_KEYDOWN.
///
/// Should return `true` if processed.
Expand Down
6 changes: 6 additions & 0 deletions swell-ui/src/view_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down

0 comments on commit 1cb4a76

Please sign in to comment.