Skip to content

Commit b9b4a79

Browse files
author
dave horner
committed
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/release-plz.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ jobs:
2424
- name: Install Rust toolchain
2525
uses: dtolnay/rust-toolchain@stable
2626
- name: Install speech-dispatcher development headers
27-
run: sudo apt-get update && sudo apt-get install -y libspeechd-dev
27+
run: sudo apt-get update && sudo apt-get install -y libspeechd-dev
28+
- name: Install ALSA development libraries
29+
run: sudo apt-get update && sudo apt-get install -y libasound2-dev
2830
- name: Run release-plz
2931
uses: release-plz/action@v0.5
3032
with:

.github/workflows/rust.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
steps:
1818
- name: Install speech-dispatcher development headers
1919
run: sudo apt-get update && sudo apt-get install -y libspeechd-dev
20+
- name: Install ALSA development libraries
21+
run: sudo apt-get update && sudo apt-get install -y libasound2-dev
2022
- uses: actions/checkout@v4
2123
- name: Build
2224
run: cargo build --verbose

0 commit comments

Comments
 (0)