aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/generators
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2018-02-03 20:11:31 +0100
committerBjörn Linse <bjorn.linse@gmail.com>2019-02-02 16:31:49 +0100
commit31cbd34d9724922026a5ae00846ce8105605df5d (patch)
tree34d4076660cfa48f0a2cd1a896f69e27f484135e /src/nvim/generators
parent894f6bee54e80811f95b8767327d39ab277a4866 (diff)
downloadrneovim-31cbd34d9724922026a5ae00846ce8105605df5d.tar.gz
rneovim-31cbd34d9724922026a5ae00846ce8105605df5d.tar.bz2
rneovim-31cbd34d9724922026a5ae00846ce8105605df5d.zip
UI: add "compositor" layer to merge grids for TUI use in a correct way
Initially we will use this for the popupmenu, floating windows will follow soon NB: writedelay + compositor is weird, we need more flexible redraw introspection.
Diffstat (limited to 'src/nvim/generators')
-rw-r--r--src/nvim/generators/c_grammar.lua2
-rw-r--r--src/nvim/generators/gen_api_ui_events.lua30
2 files changed, 25 insertions, 7 deletions
diff --git a/src/nvim/generators/c_grammar.lua b/src/nvim/generators/c_grammar.lua
index d3047e1a9c..40bdc3e30c 100644
--- a/src/nvim/generators/c_grammar.lua
+++ b/src/nvim/generators/c_grammar.lua
@@ -25,6 +25,7 @@ local c_id = (
local c_void = P('void')
local c_param_type = (
((P('Error') * fill * P('*') * fill) * Cc('error')) +
+ C((P('const ') ^ -1) * (c_id) * (ws ^ 1) * P('*')) +
(C(c_id) * (ws ^ 1))
)
local c_type = (C(c_void) * (ws ^ 1)) + c_param_type
@@ -43,6 +44,7 @@ local c_proto = Ct(
(fill * Cg((P('FUNC_API_REMOTE_ONLY') * Cc(true)), 'remote_only') ^ -1) *
(fill * Cg((P('FUNC_API_REMOTE_IMPL') * Cc(true)), 'remote_impl') ^ -1) *
(fill * Cg((P('FUNC_API_BRIDGE_IMPL') * Cc(true)), 'bridge_impl') ^ -1) *
+ (fill * Cg((P('FUNC_API_COMPOSITOR_IMPL') * Cc(true)), 'compositor_impl') ^ -1) *
fill * P(';')
)
diff --git a/src/nvim/generators/gen_api_ui_events.lua b/src/nvim/generators/gen_api_ui_events.lua
index e76b601d8a..c8ab310b02 100644
--- a/src/nvim/generators/gen_api_ui_events.lua
+++ b/src/nvim/generators/gen_api_ui_events.lua
@@ -54,7 +54,7 @@ for i = 1, #events do
ev = events[i]
assert(ev.return_type == 'void')
- if ev.since == nil then
+ if ev.since == nil and not ev.noexport then
print("Ui event "..ev.name.." lacks since field.\n")
os.exit(1)
end
@@ -65,7 +65,7 @@ for i = 1, #events do
write_signature(proto_output, ev, 'UI *ui')
proto_output:write(';\n')
- if not ev.remote_impl then
+ if not ev.remote_impl and not ev.noexport then
remote_output:write('static void remote_ui_'..ev.name)
write_signature(remote_output, ev, 'UI *ui')
remote_output:write('\n{\n')
@@ -74,8 +74,7 @@ for i = 1, #events do
remote_output:write('}\n\n')
end
- if not ev.bridge_impl then
-
+ if not ev.bridge_impl and not ev.noexport then
send, argv, recv, recv_argv, recv_cleanup = '', '', '', '', ''
argc = 1
for j = 1, #ev.parameters do
@@ -138,21 +137,36 @@ for i = 1, #events do
call_output:write('\n{\n')
if ev.remote_only then
write_arglist(call_output, ev, false)
- call_output:write(' UI_LOG('..ev.name..', 0);\n')
+ call_output:write(' UI_LOG('..ev.name..');\n')
call_output:write(' ui_event("'..ev.name..'", args);\n')
+ elseif ev.compositor_impl then
+ call_output:write(' UI_CALL')
+ write_signature(call_output, ev, '!ui->composed, '..ev.name..', ui', true)
+ call_output:write(";\n")
else
call_output:write(' UI_CALL')
- write_signature(call_output, ev, ev.name, true)
+ write_signature(call_output, ev, 'true, '..ev.name..', ui', true)
call_output:write(";\n")
end
call_output:write("}\n\n")
end
+ if ev.compositor_impl then
+ call_output:write('void ui_composed_call_'..ev.name)
+ write_signature(call_output, ev, '')
+ call_output:write('\n{\n')
+ call_output:write(' UI_CALL')
+ write_signature(call_output, ev, 'ui->composed, '..ev.name..', ui', true)
+ call_output:write(";\n")
+ call_output:write("}\n\n")
+ end
+
end
proto_output:close()
call_output:close()
remote_output:close()
+bridge_output:close()
-- don't expose internal attributes like "impl_name" in public metadata
exported_attributes = {'name', 'parameters',
@@ -168,7 +182,9 @@ for _,ev in ipairs(events) do
p[1] = 'Dictionary'
end
end
- exported_events[#exported_events+1] = ev_exported
+ if not ev.noexport then
+ exported_events[#exported_events+1] = ev_exported
+ end
end
packed = mpack.pack(exported_events)