aboutsummaryrefslogtreecommitdiffstats
path: root/src/app.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/app.cpp')
-rw-r--r--src/app.cpp38
1 files changed, 29 insertions, 9 deletions
diff --git a/src/app.cpp b/src/app.cpp
index 5da4f9d..74f3bfa 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -3,28 +3,48 @@
//
#include "app.hpp"
+#include "util.hpp"
+#include "json_helper.hpp"
+#include "wayland.hpp"
+
+#include <json-c/json.h>
namespace wm {
App::App()
- : api{this}
+ : api{this}, display{}, controller{}
{}
- result<char const *, json> App::API::register_surface(uint32_t appid,
+ binding_api::result_type binding_api::register_surface(uint32_t appid,
uint32_t surfid) {
- return Err<char const *, json>("not implemented");
+ logdebug("%s appid %u surfid %u", __func__, appid, surfid);
+ if (appid > 0xff) {
+ return Err<json_object *>("invalid appid");
+ }
+
+ if (surfid > 0xffff) {
+ return Err<json_object *>("invalid surfaceid");
+ }
+
+ return Ok(json_object_new_int((appid << 16) + surfid));
}
- result<char const *, json> App::API::debug_layers() const {
- return Err<char const *, json>("not implemented");
+ binding_api::result_type binding_api::debug_layers() {
+ logdebug("%s", __func__);
+ return Ok(to_json(this->app->controller->lprops));
}
- result<char const *, json> App::API::debug_surfaces() const {
- return Err<char const *, json>("not implemented");
+ binding_api::result_type binding_api::debug_surfaces() {
+ logdebug("%s", __func__);
+ return Ok(to_json(this->app->controller->sprops));
}
- result<char const *, json> App::API::debug_status() const {
- return Err<char const *, json>("not implemented");
+ binding_api::result_type binding_api::debug_status() {
+ logdebug("%s", __func__);
+ json_object *jr = json_object_new_object();
+ json_object_object_add(jr, "surfaces", to_json(this->app->controller->sprops));
+ json_object_object_add(jr, "layers", to_json(this->app->controller->lprops));
+ return Ok(jr);
}
} // namespace wm \ No newline at end of file