tui/remote_ui: Fix some regressions

- Explicitly set the SignalWatcher event queue. Without this, the watcher will
  publish events to the fast queue, resulting in resize bugs for certain
  terminals(#2322).
- Set `async = false` to the `remote_ui_attach` handler(It was a deferred
  before, this is the new equivalent)
This commit is contained in:
Thiago de Arruda 2015-08-17 13:19:53 -03:00
parent d5b5063622
commit 6e59b7b0e5
2 changed files with 3 additions and 1 deletions

View File

@ -28,7 +28,7 @@ void remote_ui_init(void)
connected_uis = pmap_new(uint64_t)(); connected_uis = pmap_new(uint64_t)();
// Add handler for "attach_ui" // Add handler for "attach_ui"
String method = cstr_as_string("ui_attach"); String method = cstr_as_string("ui_attach");
MsgpackRpcRequestHandler handler = {.fn = remote_ui_attach, .async = true}; MsgpackRpcRequestHandler handler = {.fn = remote_ui_attach, .async = false};
msgpack_rpc_add_method_handler(method, handler); msgpack_rpc_add_method_handler(method, handler);
method = cstr_as_string("ui_detach"); method = cstr_as_string("ui_detach");
handler.fn = remote_ui_detach; handler.fn = remote_ui_detach;

View File

@ -140,6 +140,7 @@ UI *tui_start(void)
// listen for SIGWINCH // listen for SIGWINCH
signal_watcher_init(&loop, &data->winch_handle, ui); signal_watcher_init(&loop, &data->winch_handle, ui);
data->winch_handle.events = queue_new_child(loop.events);
signal_watcher_start(&data->winch_handle, sigwinch_cb, SIGWINCH); signal_watcher_start(&data->winch_handle, sigwinch_cb, SIGWINCH);
ui->stop = tui_stop; ui->stop = tui_stop;
@ -179,6 +180,7 @@ static void tui_stop(UI *ui)
// Destroy common stuff // Destroy common stuff
kv_destroy(data->invalid_regions); kv_destroy(data->invalid_regions);
signal_watcher_stop(&data->winch_handle); signal_watcher_stop(&data->winch_handle);
queue_free(data->winch_handle.events);
signal_watcher_close(&data->winch_handle, NULL); signal_watcher_close(&data->winch_handle, NULL);
// Destroy input stuff // Destroy input stuff
term_input_destroy(data->input); term_input_destroy(data->input);