Implement EventDispatcher exclusive mode for higher-level event control#3
Draft
Copilot wants to merge 4 commits intodevel_41_DrawTextfrom
Draft
Implement EventDispatcher exclusive mode for higher-level event control#3Copilot wants to merge 4 commits intodevel_41_DrawTextfrom
Copilot wants to merge 4 commits intodevel_41_DrawTextfrom
Conversation
Co-authored-by: hyzboy <1788285+hyzboy@users.noreply.github.com>
Co-authored-by: hyzboy <1788285+hyzboy@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] 我看这个EventPatcher是一级级传递的,但是我有一个需求是某一个EventPatcher需要在更高级别处暂时处于独占状态。请帮我设计一下。
Implement EventDispatcher exclusive mode for higher-level event control
Aug 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The existing EventDispatcher system uses hierarchical event propagation (Window → RenderFramework → Scene → SceneNode), but there was no mechanism for a specific EventDispatcher to temporarily operate in exclusive mode at higher levels. This was needed for scenarios like:
Solution
Added comprehensive exclusive mode functionality to the EventDispatcher system that allows any dispatcher to request exclusive control at specified parent levels.
Core Features
EventDispatcher Base Class (
inc/hgl/io/event/EventDispatcher.h)SetExclusiveMode(dispatcher)- Set a child dispatcher as exclusiveRequestExclusiveAtHigherLevel(levels)- Request exclusive mode at parent levelsReleaseExclusiveAtHigherLevel(levels)- Release exclusive controlEvent Handling Classes
WindowEvent- Base window event handling with exclusive mode dispatchMouseEvent- Mouse input handling with coordinate trackingKeyboardEvent- Keyboard input with key state managementWindow- Basic window abstraction for testingUsage Examples
UI Dialog Exclusive Mode:
Camera Control Exclusive Mode:
Implementation Details
Testing
Added complete test suite (
example/EventDispatcherExclusiveTest.cpp) that demonstrates:The implementation successfully handles the original requirement for "某一个EventPatcher需要在更高级别处暂时处于独占状态" (allowing an EventPatcher to temporarily be in exclusive state at higher levels).
Files Added
This provides a robust, flexible solution for selective event handling control in the ULRE rendering engine.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.