diff options
| author | Enrico Borba <enricozb@users.noreply.github.com> | 2024-12-23 09:23:58 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-23 09:23:58 +0100 |
| commit | 52125e6336d596aebdd4da91080b3178ddca7449 (patch) | |
| tree | 27d3e5c01660d567f22fee621c97753f294256b0 /src/json_ui.cc | |
| parent | 14cb35f62b36b2f1aa530adb5e31c05ff1347bfc (diff) | |
| parent | 9c458c50661446fc6e7295787b06422137af099d (diff) | |
Merge branch 'master' into enricozb/daemon-stdin
Diffstat (limited to 'src/json_ui.cc')
| -rw-r--r-- | src/json_ui.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/json_ui.cc b/src/json_ui.cc index 01768897..7f645605 100644 --- a/src/json_ui.cc +++ b/src/json_ui.cc @@ -8,6 +8,7 @@ #include "keys.hh" #include "ranges.hh" #include "string_utils.hh" +#include "format.hh" #include <cstdio> #include <utility> @@ -39,6 +40,7 @@ String to_json(Attribute attributes) attrs[] { { Attribute::Underline, "underline" }, { Attribute::CurlyUnderline, "curly_underline" }, + { Attribute::DoubleUnderline, "double_underline" }, { Attribute::Reverse, "reverse" }, { Attribute::Blink, "blink" }, { Attribute::Bold, "bold" }, @@ -282,12 +284,12 @@ void JsonUI::eval_json(const Value& json) } else if (method == "scroll") { - if (params.size() != 1) - throw invalid_rpc_request("scroll needs an amount"); - else if (not params[0].is_a<int>()) - throw invalid_rpc_request("scroll amount is not an integer"); - m_on_key({Key::Modifiers::Scroll, (Codepoint)params[0].as<int>()}); - + if (params.size() != 3) + throw invalid_rpc_request("scroll needs an amount and coordinates"); + else if (not params[0].is_a<int>() or not params[1].is_a<int>() or not params[2].is_a<int>()) + throw invalid_rpc_request("scroll parameters are not integers"); + m_on_key({Key::Modifiers::Scroll | (Key::Modifiers)(params[0].as<int>() << 16), + encode_coord({params[1].as<int>(), params[2].as<int>()})}); } else if (method == "menu_select") { |
