Add multi-window support to GUI with shared buffer list and improved input handling
- Introduced support for multiple windows, sharing the primary editor's buffer list. - Added `GUIFrontend::OpenNewWindow_` for creating secondary windows with independent dimensions and input handlers. - Redesigned `WindowState` to encapsulate per-window attributes (dimensions, renderer, input, etc.). - Updated input processing and command execution to route events based on active window, preserving window-level states. - Enhanced SDL2 and ImGui integration for proper context management across multiple windows. - Increased robustness by handling window closing, resizing, and cleanup of secondary windows without affecting the primary editor. - Updated documentation and key bindings for multi-window operations (e.g., Cmd+N / Ctrl+Shift+N). - Version updated to 1.8.0 to reflect the major GUI enhancement.
This commit is contained in:
@@ -337,6 +337,18 @@ ImGuiInputHandler::ProcessSDLEvent(const SDL_Event &e)
|
||||
SDL_Keymod mods = SDL_Keymod(e.key.keysym.mod);
|
||||
const SDL_Keycode key = e.key.keysym.sym;
|
||||
|
||||
// New window: Cmd+N (macOS) or Ctrl+Shift+N (Linux/Windows)
|
||||
{
|
||||
const bool gui_n = (mods & KMOD_GUI) && !(mods & KMOD_CTRL) && (key == SDLK_n);
|
||||
const bool ctrl_sn = (mods & KMOD_CTRL) && (mods & KMOD_SHIFT) && (key == SDLK_n);
|
||||
if (gui_n || ctrl_sn) {
|
||||
std::lock_guard<std::mutex> lk(mu_);
|
||||
q_.push(MappedInput{true, CommandId::NewWindow, std::string(), 0});
|
||||
suppress_text_input_once_ = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Paste: Ctrl+V (Windows/Linux) or Cmd+V (macOS)
|
||||
// Note: SDL defines letter keycodes in lowercase only (e.g., SDLK_v). Shift does not change keycode.
|
||||
if ((mods & (KMOD_CTRL | KMOD_GUI)) && (key == SDLK_v)) {
|
||||
@@ -446,7 +458,7 @@ ImGuiInputHandler::ProcessSDLEvent(const SDL_Event &e)
|
||||
if (ed_ &&ed_
|
||||
|
||||
|
||||
|
||||
|
||||
->
|
||||
UArg() != 0
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user