blob: 74f3bfa27b8a6c4802616c5c0fa1f335b430e0ab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
//
// Created by mfritzsc on 7/11/17.
//
#include "app.hpp"
#include "util.hpp"
#include "json_helper.hpp"
#include "wayland.hpp"
#include <json-c/json.h>
namespace wm {
App::App()
: api{this}, display{}, controller{}
{}
binding_api::result_type binding_api::register_surface(uint32_t appid,
uint32_t surfid) {
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));
}
binding_api::result_type binding_api::debug_layers() {
logdebug("%s", __func__);
return Ok(to_json(this->app->controller->lprops));
}
binding_api::result_type binding_api::debug_surfaces() {
logdebug("%s", __func__);
return Ok(to_json(this->app->controller->sprops));
}
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
|