Skip to content

Make drag and drop part of gui_core - #353

Merged
LogicalError merged 1 commit into
mainfrom
tachyonui/core-drag-drop
Nov 30, 2026
Merged

LogicalError merged 1 commit into
mainfrom
tachyonui/core-drag-drop

Conversation

@LogicalError

Copy link
Copy Markdown
Owner

Part of #350

The second step of splitting gui_controls: drag and drop moves down into gui_core, so every control and every future extension uses the same mechanism.

What changed

  • MakeDragSourceHandler and MakeDropTargetHandler (plain and typed) moved from gui_controls/gui_default_handlers.h to gui_core/input/gui_drag_drop.h. Their code is unchanged.
    • gui_default_handlers.h includes the new header, so existing code compiles as before.
  • New DispatchToElementChain in gui_core: offers an event to the element under the pointer, then to each parent, until one takes it.
    • The same loop was written twice before: in InputManager for drags inside the app, and in GUIApplication for files dropped from other apps. Both use the one function now.
  • Stays in GUIApplication: the ghost windows by the pointer and the per-frame file-drop pass. They need windows and the UI cache, which belong to gui_controls. That's fine: the basic gui_controls stays below every extension.

Tests

  • drag_drop_test.cpp now includes only gui_core headers.
  • New tests for DispatchToElementChain: it goes up until an element takes the event, stops at the first that does, returns Invalid when none does or the element is gone, and passes each handler the event's type and state.
  • The full suite passes on Windows.

Docs: the drag and drop section of the writing-controls guide says where the handlers live and how events bubble. CHANGELOG updated.

MakeDragSourceHandler and MakeDropTargetHandler move to
gui_core/input/gui_drag_drop.h, which gui_default_handlers.h still includes.
DispatchToElementChain is the one walk up the element tree that both drags
inside the app and drops from other applications use.
@LogicalError
LogicalError merged commit 3935bea into main Nov 30, 2026
8 checks passed
@LogicalError
LogicalError deleted the tachyonui/core-drag-drop branch November 30, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant