Commit b9b4a79
dave horner
feat(e_window_e_grid_demo01): e_midi and e_grid demo.
This commit introduces several enhancements to the `e_window` examples, focusing on dynamic UI adjustments and more robust Chrome window management with MIDI integration.
Key changes include:
- **Dynamic Label Height Calculation:** The `position_grid_demo.rs` example now dynamically calculates the label height based on the Egui `TextStyle::Heading` font. This replaces the hardcoded `32.0` value, improving UI adaptability.
- **Improved Chrome Window Monitoring:** In `position_grid_demo.rs`, a check using `winapi::um::winuser::IsWindow` is added to continuously verify if the pinned Chrome window is still valid. If the window is closed, the application exits, preventing errors.
- **Enhanced Title Bar Height Calculation:** The `title_bar_height` in `position_grid_demo.rs` now accounts for the dynamically calculated label height, plus an additional padding, for more accurate window positioning.
- **New `e_window_e_grid.rs` Example:** A new example `e_window_e_grid.rs` is introduced, demonstrating a more comprehensive integration of Chrome grid pinning with MIDI event playback. This example:
- Launches Chrome pinned to a grid.
- Handles move, resize, and focus events for the Chrome HWND.
- Plays MIDI songs in response to window events (focus, move, resize start/stop).
- Includes detailed logging and comments for better understanding.
- Features in-process E-grid server startup if not already running.
- Manages Chrome process lifecycle, including termination on Ctrl-C.
- **Mouse Click Injection:** The new `e_window_e_grid.rs` includes functionality to send simulated mouse clicks to specific cells within the grid, with a delay for visual confirmation.
- **Use of `dashmap` and `once_cell`:** The new `e_window_e_grid.rs` utilizes `dashmap` for concurrent access to song mapping and `once_cell::sync::Lazy` for static, lazily initialized global state (like `PINNED_HWND_MAP` and `CHROME_WINDOW_INFO_MAP`). This enables better management of shared data across threads.
These changes collectively improve the responsiveness, stability, and feature set of the `e_window` examples, particularly in the context of integrating external applications like Chrome with the UI grid and real-time feedback through MIDI.1 parent 681cf61 commit b9b4a79
13 files changed
Lines changed: 3925 additions & 155 deletions
File tree
- .github/workflows
- addendum/e_window
- examples
- src
- bin
- cargo-e
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
0 commit comments