aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/ui.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-12-31 14:23:24 +0100
committerGitHub <noreply@github.com>2022-12-31 14:23:24 +0100
commitcce736218f465511194465410e1ba23b5530e46f (patch)
tree02f488ea361a4fba8aec92e44193d8627836cd55 /src/nvim/api/ui.c
parent99cf111289bfcd14981255e805da43bac5139141 (diff)
parent9fdcbbb4063daa125e420e0ffe9dae6801c264bc (diff)
downloadrneovim-cce736218f465511194465410e1ba23b5530e46f.tar.gz
rneovim-cce736218f465511194465410e1ba23b5530e46f.tar.bz2
rneovim-cce736218f465511194465410e1ba23b5530e46f.zip
Merge pull request #18375 from bfredl/tui_rework
feat(ui): refactor TUI from thread to separate process
Diffstat (limited to 'src/nvim/api/ui.c')
-rw-r--r--src/nvim/api/ui.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c
index aeccddb9ea..e4134133ac 100644
--- a/src/nvim/api/ui.c
+++ b/src/nvim/api/ui.c
@@ -14,9 +14,6 @@
#include "nvim/api/private/helpers.h"
#include "nvim/api/ui.h"
#include "nvim/channel.h"
-#include "nvim/event/loop.h"
-#include "nvim/event/wstream.h"
-#include "nvim/globals.h"
#include "nvim/grid.h"
#include "nvim/highlight.h"
#include "nvim/main.h"
@@ -30,6 +27,7 @@
#include "nvim/types.h"
#include "nvim/ui.h"
#include "nvim/vim.h"
+#include "nvim/window.h"
typedef struct {
uint64_t channel_id;
@@ -285,6 +283,19 @@ void ui_attach(uint64_t channel_id, Integer width, Integer height, Boolean enabl
api_free_dictionary(opts);
}
+/// Tells the nvim server if focus was gained or lost by the GUI
+void nvim_ui_set_focus(uint64_t channel_id, Boolean gained, Error *error)
+ FUNC_API_SINCE(11) FUNC_API_REMOTE_ONLY
+{
+ if (!pmap_has(uint64_t)(&connected_uis, channel_id)) {
+ api_set_error(error, kErrorTypeException,
+ "UI not attached to channel: %" PRId64, channel_id);
+ return;
+ }
+
+ do_autocmd_focusgained((bool)gained);
+}
+
/// Deactivates UI events on the channel.
///
/// Removes the client from the list of UIs. |nvim_list_uis()|
@@ -404,6 +415,24 @@ static void ui_set_option(UI *ui, bool init, String name, Object value, Error *e
return;
}
+ if (strequal(name.data, "stdin_tty")) {
+ if (value.type != kObjectTypeBoolean) {
+ api_set_error(error, kErrorTypeValidation, "stdin_tty must be a Boolean");
+ return;
+ }
+ stdin_isatty = value.data.boolean;
+ return;
+ }
+
+ if (strequal(name.data, "stdout_tty")) {
+ if (value.type != kObjectTypeBoolean) {
+ api_set_error(error, kErrorTypeValidation, "stdout_tty must be a Boolean");
+ return;
+ }
+ stdout_isatty = value.data.boolean;
+ return;
+ }
+
// LEGACY: Deprecated option, use `ext_cmdline` instead.
bool is_popupmenu = strequal(name.data, "popupmenu_external");