mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-19 01:38:08 +08:00
Add support for emscripten screen resize. (#463)
This resolves: https://github.com/ArthurSonzogni/FTXUI/issues/432
This commit is contained in:
@@ -135,6 +135,17 @@ void EventListener(std::atomic<bool>* quit, Sender<Task> out) {
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
EMSCRIPTEN_KEEPALIVE
|
||||
void ftxui_on_resize(int columns, int rows) {
|
||||
Terminal::SetFallbackSize({
|
||||
columns,
|
||||
rows,
|
||||
});
|
||||
std::raise(SIGWINCH);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
#include <sys/time.h> // for timeval
|
||||
|
||||
|
@@ -38,7 +38,10 @@ Dimensions& FallbackSize() {
|
||||
constexpr int fallback_width = 80;
|
||||
constexpr int fallback_height = 24;
|
||||
#endif
|
||||
static Dimensions g_fallback_size{fallback_width, fallback_height};
|
||||
static Dimensions g_fallback_size{
|
||||
fallback_width,
|
||||
fallback_height,
|
||||
};
|
||||
return g_fallback_size;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user