diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/CursesDialog/ccmake.cxx | 23 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesForm.cxx | 29 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesForm.h | 4 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesLongMessageForm.cxx | 6 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesMainForm.cxx | 6 | ||||
-rw-r--r-- | Source/cmCMakePresetsGraph.cxx | 2 | ||||
-rw-r--r-- | Source/cmCMakePresetsGraph.h | 1 | ||||
-rw-r--r-- | Source/cmCMakePresetsGraphReadJSON.cxx | 26 |
9 files changed, 51 insertions, 48 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8a8d6fc..d4ad937 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 22) -set(CMake_VERSION_PATCH 20220120) +set(CMake_VERSION_PATCH 20220121) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index ae4c0f6..1f7776c 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -9,8 +9,6 @@ #include <string> #include <vector> -#include <unistd.h> - #include "cmsys/Encoding.hxx" #include "cmCursesColor.h" @@ -53,31 +51,18 @@ static const char* cmDocumentationOptions[][2] = { cmCursesForm* cmCursesForm::CurrentForm = nullptr; +#ifndef _WIN32 extern "C" { static void onsig(int /*unused*/) { if (cmCursesForm::CurrentForm) { - endwin(); - if (initscr() == nullptr) { - static const char errmsg[] = "Error: ncurses initialization failed\n"; - auto r = write(STDERR_FILENO, errmsg, sizeof(errmsg) - 1); - static_cast<void>(r); - exit(1); - } - noecho(); /* Echo off */ - cbreak(); /* nl- or cr not needed */ - keypad(stdscr, true); /* Use key symbols as KEY_DOWN */ - refresh(); - int x; - int y; - getmaxyx(stdscr, y, x); - cmCursesForm::CurrentForm->Render(1, 1, x, y); - cmCursesForm::CurrentForm->UpdateStatusBar(); + cmCursesForm::CurrentForm->HandleResize(); } signal(SIGWINCH, onsig); } } +#endif // _WIN32 int main(int argc, char const* const* argv) { @@ -143,7 +128,9 @@ int main(int argc, char const* const* argv) keypad(stdscr, true); /* Use key symbols as KEY_DOWN */ cmCursesColor::InitColors(); +#ifndef _WIN32 signal(SIGWINCH, onsig); +#endif // _WIN32 int x; int y; diff --git a/Source/CursesDialog/cmCursesForm.cxx b/Source/CursesDialog/cmCursesForm.cxx index bd65c4a..ef36b45 100644 --- a/Source/CursesDialog/cmCursesForm.cxx +++ b/Source/CursesDialog/cmCursesForm.cxx @@ -2,6 +2,11 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmCursesForm.h" +#include <cstdlib> +#ifndef _WIN32 +# include <unistd.h> +#endif // _WIN32 + cmsys::ofstream cmCursesForm::DebugFile; bool cmCursesForm::Debug = false; @@ -43,3 +48,27 @@ void cmCursesForm::LogMessage(const char* msg) cmCursesForm::DebugFile << msg << std::endl; } + +void cmCursesForm::HandleResize() +{ + endwin(); + if (initscr() == nullptr) { + static const char errmsg[] = "Error: ncurses initialization failed\n"; +#ifdef _WIN32 + fprintf(stderr, "%s", errmsg); +#else + auto r = write(STDERR_FILENO, errmsg, sizeof(errmsg) - 1); + static_cast<void>(r); +#endif // _WIN32 + exit(1); + } + noecho(); /* Echo off */ + cbreak(); /* nl- or cr not needed */ + keypad(stdscr, true); /* Use key symbols as KEY_DOWN */ + refresh(); + int x; + int y; + getmaxyx(stdscr, y, x); + this->Render(1, 1, x, y); + this->UpdateStatusBar(); +} diff --git a/Source/CursesDialog/cmCursesForm.h b/Source/CursesDialog/cmCursesForm.h index 93459b9..3a1eb25 100644 --- a/Source/CursesDialog/cmCursesForm.h +++ b/Source/CursesDialog/cmCursesForm.h @@ -55,6 +55,10 @@ public: static cmCursesForm* CurrentForm; + // Description: + // Handle resizing the form with curses. + void HandleResize(); + protected: static cmsys::ofstream DebugFile; static bool Debug; diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx index 7f1815f..9b3a649 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.cxx +++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx @@ -177,6 +177,12 @@ void cmCursesLongMessageForm::HandleInput() this->PrintKeys(); int key = getch(); +#ifdef _WIN32 + if (key == KEY_RESIZE) { + HandleResize(); + } +#endif // _WIN32 + snprintf(debugMessage, sizeof(debugMessage), "Message widget handling input, key: %d", key); cmCursesForm::LogMessage(debugMessage); diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 0012a25..11b3b35 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -686,6 +686,12 @@ void cmCursesMainForm::HandleInput() } int key = getch(); +#ifdef _WIN32 + if (key == KEY_RESIZE) { + HandleResize(); + } +#endif // _WIN32 + getmaxyx(stdscr, y, x); // If window too small, handle 'q' only if (x < cmCursesMainForm::MIN_WIDTH || y < cmCursesMainForm::MIN_HEIGHT) { diff --git a/Source/cmCMakePresetsGraph.cxx b/Source/cmCMakePresetsGraph.cxx index 58dca36..238aa68 100644 --- a/Source/cmCMakePresetsGraph.cxx +++ b/Source/cmCMakePresetsGraph.cxx @@ -1014,8 +1014,6 @@ const char* cmCMakePresetsGraph::ResultToString(ReadFileResult result) "support."; case ReadFileResult::CYCLIC_INCLUDE: return "Cyclic include among preset files"; - case ReadFileResult::INCLUDE_OUTSIDE_PROJECT: - return "File included from outside project directory"; } return "Unknown error"; diff --git a/Source/cmCMakePresetsGraph.h b/Source/cmCMakePresetsGraph.h index 02c506f..8581809 100644 --- a/Source/cmCMakePresetsGraph.h +++ b/Source/cmCMakePresetsGraph.h @@ -44,7 +44,6 @@ public: CONDITION_UNSUPPORTED, TOOLCHAIN_FILE_UNSUPPORTED, CYCLIC_INCLUDE, - INCLUDE_OUTSIDE_PROJECT, }; enum class ArchToolsetStrategy diff --git a/Source/cmCMakePresetsGraphReadJSON.cxx b/Source/cmCMakePresetsGraphReadJSON.cxx index ca34124..85cf5be 100644 --- a/Source/cmCMakePresetsGraphReadJSON.cxx +++ b/Source/cmCMakePresetsGraphReadJSON.cxx @@ -424,17 +424,6 @@ cmCMakePresetsGraph::ReadFileResult cmCMakePresetsGraph::ReadJSONFile( { ReadFileResult result; - if (rootType == RootType::Project) { - auto normalizedFilename = cmSystemTools::CollapseFullPath(filename); - - auto normalizedProjectDir = - cmSystemTools::CollapseFullPath(this->SourceDir); - if (!cmSystemTools::IsSubDirectory(normalizedFilename, - normalizedProjectDir)) { - return ReadFileResult::INCLUDE_OUTSIDE_PROJECT; - } - } - for (auto const& f : this->Files) { if (cmSystemTools::SameFile(filename, f->Filename)) { file = f.get(); @@ -444,21 +433,6 @@ cmCMakePresetsGraph::ReadFileResult cmCMakePresetsGraph::ReadJSONFile( return cmCMakePresetsGraph::ReadFileResult::CYCLIC_INCLUDE; } - // Check files included by this file again to make sure they're in the - // project directory. - if (rootType == RootType::Project) { - for (auto* f2 : file->ReachableFiles) { - if (!cmSystemTools::SameFile(filename, f2->Filename)) { - File* file2; - if ((result = this->ReadJSONFile( - f2->Filename, rootType, ReadReason::Included, - inProgressFiles, file2)) != ReadFileResult::READ_OK) { - return result; - } - } - } - } - return cmCMakePresetsGraph::ReadFileResult::READ_OK; } } |