diff --git a/Frontend.h b/Frontend.h index 026f90c..e6e7df7 100644 --- a/Frontend.h +++ b/Frontend.h @@ -12,7 +12,7 @@ public: virtual ~Frontend() = default; // Initialize the frontend (create window/terminal, etc.) - virtual bool Init(Editor &ed) = 0; + virtual bool Init(int &argc, char **argv, Editor &ed) = 0; // Execute one iteration (poll input, dispatch, draw). Set running=false to exit. virtual void Step(Editor &ed, bool &running) = 0; diff --git a/ImGuiFrontend.cc b/ImGuiFrontend.cc index 862d304..c73964e 100644 --- a/ImGuiFrontend.cc +++ b/ImGuiFrontend.cc @@ -30,8 +30,10 @@ static auto kGlslVersion = "#version 150"; // GL 3.2 core (macOS compatible) bool -GUIFrontend::Init(Editor &ed) +GUIFrontend::Init(int &argc, char **argv, Editor &ed) { + (void) argc; + (void) argv; // Attach editor to input handler for editor-owned features (e.g., universal argument) input_.Attach(&ed); // editor dimensions will be initialized during the first Step() frame diff --git a/ImGuiFrontend.h b/ImGuiFrontend.h index 54c15aa..1a0c2e4 100644 --- a/ImGuiFrontend.h +++ b/ImGuiFrontend.h @@ -17,7 +17,7 @@ public: ~GUIFrontend() override = default; - bool Init(Editor &ed) override; + bool Init(int &argc, char **argv, Editor &ed) override; void Step(Editor &ed, bool &running) override; diff --git a/QtFrontend.cc b/QtFrontend.cc index 89940fc..278c09f 100644 --- a/QtFrontend.cc +++ b/QtFrontend.cc @@ -658,11 +658,9 @@ private: } // namespace bool -GUIFrontend::Init(Editor &ed) +GUIFrontend::Init(int &argc, char **argv, Editor &ed) { - int argc = 0; - char **argv = nullptr; - app_ = new QApplication(argc, argv); + app_ = new QApplication(argc, argv); window_ = new MainWindow(input_); window_->show(); diff --git a/QtFrontend.h b/QtFrontend.h index ca1fed0..cb389d4 100644 --- a/QtFrontend.h +++ b/QtFrontend.h @@ -18,7 +18,7 @@ public: ~GUIFrontend() override = default; - bool Init(Editor &ed) override; + bool Init(int &argc, char **argv, Editor &ed) override; void Step(Editor &ed, bool &running) override; diff --git a/TerminalFrontend.cc b/TerminalFrontend.cc index eeed8a9..8aaa921 100644 --- a/TerminalFrontend.cc +++ b/TerminalFrontend.cc @@ -8,8 +8,10 @@ bool -TerminalFrontend::Init(Editor &ed) +TerminalFrontend::Init(int &argc, char **argv, Editor &ed) { + (void) argc; + (void) argv; // Ensure Control keys reach the app: disable XON/XOFF and dsusp/susp bindings (e.g., ^S/^Q, ^Y on macOS) { struct termios tio{}; @@ -121,4 +123,4 @@ TerminalFrontend::Shutdown() have_old_sigint_ = false; } endwin(); -} +} \ No newline at end of file diff --git a/TerminalFrontend.h b/TerminalFrontend.h index 1afc27d..6749c7a 100644 --- a/TerminalFrontend.h +++ b/TerminalFrontend.h @@ -21,7 +21,7 @@ public: // Adjust if your terminal needs a different threshold. static constexpr int kEscDelayMs = 50; - bool Init(Editor &ed) override; + bool Init(int &argc, char **argv, Editor &ed) override; void Step(Editor &ed, bool &running) override; diff --git a/TestFrontend.cc b/TestFrontend.cc index 30e11a3..dcea91f 100644 --- a/TestFrontend.cc +++ b/TestFrontend.cc @@ -4,8 +4,10 @@ bool -TestFrontend::Init(Editor &ed) +TestFrontend::Init(int &argc, char **argv, Editor &ed) { + (void) argc; + (void) argv; ed.SetDimensions(24, 80); return true; } @@ -30,4 +32,4 @@ TestFrontend::Step(Editor &ed, bool &running) void -TestFrontend::Shutdown() {} +TestFrontend::Shutdown() {} \ No newline at end of file diff --git a/TestFrontend.h b/TestFrontend.h index 7adc0e4..b188745 100644 --- a/TestFrontend.h +++ b/TestFrontend.h @@ -13,7 +13,7 @@ public: ~TestFrontend() override = default; - bool Init(Editor &ed) override; + bool Init(int &argc, char **argv, Editor &ed) override; void Step(Editor &ed, bool &running) override; diff --git a/main.cc b/main.cc index 55f0ab8..3e93448 100644 --- a/main.cc +++ b/main.cc @@ -112,7 +112,7 @@ RunStressHighlighter(unsigned seconds) int -main(int argc, const char *argv[]) +main(int argc, char *argv[]) { std::setlocale(LC_ALL, ""); @@ -136,7 +136,7 @@ main(int argc, const char *argv[]) int opt; int long_index = 0; unsigned stress_seconds = 0; - while ((opt = getopt_long(argc, const_cast(argv), "gthV", long_opts, &long_index)) != -1) { + while ((opt = getopt_long(argc, argv, "gthV", long_opts, &long_index)) != -1) { switch (opt) { case 'g': req_gui = true; @@ -303,7 +303,7 @@ main(int argc, const char *argv[]) } #endif - if (!fe->Init(editor)) { + if (!fe->Init(argc, argv, editor)) { std::cerr << "kte: failed to initialize frontend" << std::endl; return 1; }