- int rc = afb_wsj1_call_j(
- wsj1, wmAPI, verb, jp,
- [](void *closure, afb_wsj1_msg *msg) {
- if (afb_wsj1_msg_is_reply_ok(msg)) {
- int id = json_object_get_int(json_object_object_get(
- afb_wsj1_msg_object_j(msg), "response"));
- auto oid = (optional *)closure;
- *oid = optional{id};
- } else
- fprintf(stderr, "wrong request surface reply received!\n");
- },
- (void *)&id);
-
- if (rc < 0) {
- fprintf(stderr, "calling %s/%s(%s) failed: %m\n", wmAPI, verb,
- json_object_to_json_string(jp));
- } else {
- // Lets make this call sync here...
- dispatch(-1);
-
- if (!id.is_not_set) {
+ int rc2 = call("request_surface", jp, [&rc](bool ok, json_object *j) {
+ if (ok) {
+ int id = json_object_get_int(json_object_object_get(j, "response"));