Step 88: drag-and-drop open

This commit is contained in:
Bill
2026-02-09 09:38:57 -07:00
parent a1efe93ba3
commit 23e3758cca
5 changed files with 92 additions and 0 deletions

View File

@@ -22,6 +22,7 @@
#include "FileDialog.h"
#include "FileTree.h"
#include "WelcomeScreen.h"
#include "DragDropHandler.h"
#include "ast/Generator.h"
#include <cstdio>
@@ -624,6 +625,18 @@ int main(int, char**) {
event.window.event == SDL_WINDOWEVENT_CLOSE &&
event.window.windowID == SDL_GetWindowID(window))
done = true;
if (event.type == SDL_DROPFILE) {
char* droppedFile = event.drop.file;
if (droppedFile) {
DragDropHandler::handleDrop(droppedFile,
[&](const std::string& p) { state.doOpen(p); },
[&](const std::string& p) {
state.workspaceRoot = p;
state.fileTreeDirty = true;
});
SDL_free(droppedFile);
}
}
// Handle keyboard shortcuts via KeybindingManager
if (event.type == SDL_KEYDOWN && !io.WantTextInput) {