mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-10-31 10:38:09 +08:00 
			
		
		
		
	Support SIGTSTP and task posting. (#331)
- Add support for SIGTSTP: https://github.com/ArthurSonzogni/FTXUI/issues/330 This - Add support for task posting. This allows folks to defer function execution, and execute it directly below the main loop. The task are executed in a FIFO order.
This commit is contained in:
		| @@ -32,8 +32,8 @@ Element make_grid() { | ||||
| }; | ||||
|  | ||||
| int main(int argc, const char* argv[]) { | ||||
|   float focus_x = 0.0f; | ||||
|   float focus_y = 0.0f; | ||||
|   float focus_x = 0.5f; | ||||
|   float focus_y = 0.5f; | ||||
|  | ||||
|   auto slider_x = Slider("x", &focus_x, 0.f, 1.f, 0.01f); | ||||
|   auto slider_y = Slider("y", &focus_y, 0.f, 1.f, 0.01f); | ||||
|   | ||||
| @@ -18,14 +18,12 @@ int main() { | ||||
|   // temporarily uninstall the terminal hook and execute the provided callback | ||||
|   // function. This allow running the application in a non-interactive mode. | ||||
|   auto btn_run = Button("Execute with restored IO", screen.WithRestoredIO([] { | ||||
|     std::system("bash"); | ||||
|     std::cout << "This is a child program using stdin/stdout." << std::endl; | ||||
|     for (int i = 0; i < 10; ++i) { | ||||
|       std::cout << "Please enter 10 strings (" << i << "/10)" << std::flush; | ||||
|       std::string input; | ||||
|       std::getline(std::cin, input); | ||||
|     } | ||||
|     std::system("bash"); | ||||
|   })); | ||||
|  | ||||
|   auto btn_quit = Button("Quit", screen.ExitLoopClosure()); | ||||
|   | ||||
| @@ -34,7 +34,7 @@ std::vector<std::vector<ColorInfo>> ColorInfoSorted2D() { | ||||
|     for (int i = 0; i < int(column.size()) - 1; ++i) { | ||||
|       int best_index = i + 1; | ||||
|       int best_distance = 255 * 255 * 3; | ||||
|       for (size_t j = i + 1; j < column.size(); ++j) { | ||||
|       for (int j = i + 1; j < column.size(); ++j) { | ||||
|         int dx = column[i].red - column[j].red; | ||||
|         int dy = column[i].green - column[j].green; | ||||
|         int dz = column[i].blue - column[j].blue; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Arthur Sonzogni
					Arthur Sonzogni