be8db1d152db0c609d3152a6fd944fac6228f35f
[apps/agl-service-windowmanager.git] / src / main.cpp
1 /*
2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include <unistd.h>
18 #include <algorithm>
19 #include <mutex>
20 #include <json.h>
21 #include <json.hpp>
22 #include "app.hpp"
23 #include "result.hpp"
24 #include "json_helper.hpp"
25 #include "util.hpp"
26 #include "wayland_ivi_wm.hpp"
27
28 extern "C"
29 {
30 #include <afb/afb-binding.h>
31 #include <systemd/sd-event.h>
32 }
33
34 typedef struct WMClientCtxt
35 {
36     std::string name;
37     std::string role;
38     WMClientCtxt(const char *appName, const char* appRole)
39     {
40         name = appName;
41         role = role;
42     }
43 } WMClientCtxt;
44
45 struct afb_instance
46 {
47     std::unique_ptr<wl::display> display;
48     wm::App app;
49
50     afb_instance() : display{new wl::display}, app{this->display.get()} {}
51
52     int init();
53 };
54
55 struct afb_instance *g_afb_instance;
56 std::mutex binding_m;
57
58 int afb_instance::init()
59 {
60     return this->app.init();
61 }
62
63 int display_event_callback(sd_event_source *evs, int /*fd*/, uint32_t events,
64                            void * /*data*/)
65 {
66     ST();
67
68     if ((events & EPOLLHUP) != 0)
69     {
70         HMI_ERROR("wm", "The compositor hung up, dying now.");
71         delete g_afb_instance;
72         g_afb_instance = nullptr;
73         goto error;
74     }
75
76     if ((events & EPOLLIN) != 0u)
77     {
78         {
79             STN(display_read_events);
80             g_afb_instance->app.display->read_events();
81             g_afb_instance->app.set_pending_events();
82         }
83         {
84             // We want do dispatch pending wayland events from within
85             // the API context
86             STN(winman_ping_api_call);
87             afb_service_call("windowmanager", "ping", json_object_new_object(),
88                              [](void *c, int st, json_object *j) {
89                                  STN(winman_ping_api_call_return);
90                              },
91                              nullptr);
92         }
93     }
94
95     return 0;
96
97 error:
98     sd_event_source_unref(evs);
99     if (getenv("WINMAN_EXIT_ON_HANGUP") != nullptr)
100     {
101         exit(1);
102     }
103     return -1;
104 }
105
106 int _binding_init()
107 {
108     HMI_NOTICE("wm", "WinMan ver. %s", WINMAN_VERSION_STRING);
109
110     if (g_afb_instance != nullptr)
111     {
112         HMI_ERROR("wm", "Wayland context already initialized?");
113         return 0;
114     }
115
116     if (getenv("XDG_RUNTIME_DIR") == nullptr)
117     {
118         HMI_ERROR("wm", "Environment variable XDG_RUNTIME_DIR not set");
119         goto error;
120     }
121
122     {
123         // wait until wayland compositor starts up.
124         int cnt = 0;
125         g_afb_instance = new afb_instance;
126         while (!g_afb_instance->display->ok())
127         {
128             cnt++;
129             if (20 <= cnt)
130             {
131                 HMI_ERROR("wm", "Could not connect to compositor");
132                 goto error;
133             }
134             HMI_ERROR("wm", "Wait to start weston ...");
135             sleep(1);
136             delete g_afb_instance;
137             g_afb_instance = new afb_instance;
138         }
139     }
140
141     if (g_afb_instance->init() == -1)
142     {
143         HMI_ERROR("wm", "Could not connect to compositor");
144         goto error;
145     }
146
147     {
148         int ret = sd_event_add_io(afb_daemon_get_event_loop(), nullptr,
149                                   g_afb_instance->display->get_fd(), EPOLLIN,
150                                   display_event_callback, g_afb_instance);
151         if (ret < 0)
152         {
153             HMI_ERROR("wm", "Could not initialize afb_instance event handler: %d", -ret);
154             goto error;
155         }
156     }
157
158     atexit([] { delete g_afb_instance; });
159
160     return 0;
161
162 error:
163     delete g_afb_instance;
164     g_afb_instance = nullptr;
165     return -1;
166 }
167
168 int binding_init() noexcept
169 {
170     try
171     {
172         return _binding_init();
173     }
174     catch (std::exception &e)
175     {
176         HMI_ERROR("wm", "Uncaught exception in binding_init(): %s", e.what());
177     }
178     return -1;
179 }
180
181 static bool checkFirstReq(afb_req req)
182 {
183     WMClientCtxt *ctxt = (WMClientCtxt *)afb_req_context_get(req);
184     return (ctxt) ? false : true;
185 }
186
187 static void cbRemoveClientCtxt(void *data)
188 {
189     WMClientCtxt *ctxt = (WMClientCtxt *)data;
190     if (ctxt == nullptr)
191     {
192         return;
193     }
194     HMI_DEBUG("wm", "remove app %s", ctxt->name.c_str());
195     // Lookup surfaceID and remove it because App is dead.
196     auto pSid = g_afb_instance->app.id_alloc.lookup(ctxt->role.c_str());
197     if (pSid)
198     {
199         auto sid = *pSid;
200         g_afb_instance->app.id_alloc.remove_id(sid);
201         g_afb_instance->app.layers.remove_surface(sid);
202         g_afb_instance->app.controller->sprops.erase(sid);
203         g_afb_instance->app.controller->surfaces.erase(sid);
204         HMI_DEBUG("wm", "delete surfaceID %d", sid);
205     }
206     g_afb_instance->app.removeClient(ctxt->name);
207     delete ctxt;
208 }
209
210 void windowmanager_requestsurface(afb_req req) noexcept
211 {
212     std::lock_guard<std::mutex> guard(binding_m);
213 #ifdef ST
214     ST();
215 #endif
216     if (g_afb_instance == nullptr)
217     {
218         afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
219         return;
220     }
221
222     try
223     {
224         const char *a_drawing_name = afb_req_value(req, "drawing_name");
225         if (!a_drawing_name)
226         {
227             afb_req_fail(req, "failed", "Need char const* argument drawing_name");
228             return;
229         }
230
231         /* Create Security Context */
232         bool isFirstReq = checkFirstReq(req);
233         if (!isFirstReq)
234         {
235             WMClientCtxt *ctxt = (WMClientCtxt *)afb_req_context_get(req);
236             HMI_DEBUG("wm", "You're %s.", ctxt->name.c_str());
237             if (ctxt->name != std::string(a_drawing_name))
238             {
239                 afb_req_fail_f(req, "failed", "Dont request with other name: %s for now", a_drawing_name);
240                 HMI_DEBUG("wm", "Don't request with other name: %s for now", a_drawing_name);
241                 return;
242             }
243         }
244
245         auto ret = g_afb_instance->app.api_request_surface(
246             afb_req_get_application_id(req), a_drawing_name);
247
248         if (isFirstReq)
249         {
250             WMClientCtxt *ctxt = new WMClientCtxt(afb_req_get_application_id(req), a_drawing_name);
251             HMI_DEBUG("wm", "create session for %s", ctxt->name.c_str());
252             afb_req_session_set_LOA(req, 1);
253             afb_req_context_set(req, ctxt, cbRemoveClientCtxt);
254         }
255         else
256         {
257             HMI_DEBUG("wm", "session already created for %s", a_drawing_name);
258         }
259
260         if (ret.is_err())
261         {
262             afb_req_fail(req, "failed", ret.unwrap_err());
263             return;
264         }
265
266         afb_req_success(req, json_object_new_int(ret.unwrap()), "success");
267     }
268     catch (std::exception &e)
269     {
270         afb_req_fail_f(req, "failed", "Uncaught exception while calling requestsurface: %s", e.what());
271         return;
272     }
273 }
274
275 void windowmanager_requestsurfacexdg(afb_req req) noexcept
276 {
277     std::lock_guard<std::mutex> guard(binding_m);
278 #ifdef ST
279     ST();
280 #endif
281     if (g_afb_instance == nullptr)
282     {
283         afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
284         return;
285     }
286
287     try
288     {
289         json_object *jreq = afb_req_json(req);
290
291         json_object *j_drawing_name = nullptr;
292         if (!json_object_object_get_ex(jreq, "drawing_name", &j_drawing_name))
293         {
294             afb_req_fail(req, "failed", "Need char const* argument drawing_name");
295             return;
296         }
297         char const *a_drawing_name = json_object_get_string(j_drawing_name);
298
299         json_object *j_ivi_id = nullptr;
300         if (!json_object_object_get_ex(jreq, "ivi_id", &j_ivi_id))
301         {
302             afb_req_fail(req, "failed", "Need char const* argument ivi_id");
303             return;
304         }
305         char const *a_ivi_id = json_object_get_string(j_ivi_id);
306
307         auto ret = g_afb_instance->app.api_request_surface(
308             afb_req_get_application_id(req), a_drawing_name, a_ivi_id);
309         if (ret != nullptr)
310         {
311             afb_req_fail(req, "failed", ret);
312             return;
313         }
314
315         afb_req_success(req, NULL, "success");
316     }
317     catch (std::exception &e)
318     {
319         afb_req_fail_f(req, "failed", "Uncaught exception while calling requestsurfacexdg: %s", e.what());
320         return;
321     }
322 }
323
324 void windowmanager_setrole(afb_req req) noexcept
325 {
326     std::lock_guard<std::mutex> guard(binding_m);
327     if (g_afb_instance == nullptr)
328     {
329         afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
330         return;
331     }
332     try
333     {
334         unsigned pid = 0;
335         std::string appid = afb_req_get_application_id(req);
336         json_object *jreq = afb_req_json(req);
337
338         json_object *j_role = nullptr;
339         if (!json_object_object_get_ex(jreq, "role", &j_role))
340         {
341             afb_req_fail(req, "failed", "Need char const* argument role");
342             return;
343         }
344         char const *a_role = json_object_get_string(j_role);
345
346         /* Create Security Context */
347         bool isFirstReq = checkFirstReq(req);
348         /* if (!isFirstReq)
349         {
350             WMClientCtxt *ctxt = (WMClientCtxt *)afb_req_context_get(req);
351             HMI_DEBUG("wm", "Set %s into %s.", a_role, appid.c_str());
352         } */
353
354         json_object *j_pid = nullptr;
355         if (json_object_object_get_ex(jreq, "pid", &j_pid))
356         {
357             HMI_DEBUG("wm", "PID is set");
358             char const *a_pid = json_object_get_string(j_pid);
359             pid = std::stol(a_pid);
360         }
361
362         g_afb_instance->app.api_set_role(appid.c_str(), a_role, pid);
363
364         if (isFirstReq)
365         {
366             WMClientCtxt *ctxt = new WMClientCtxt(appid.c_str(), a_role);
367             HMI_DEBUG("wm", "create session for appid:%s, role: %s", ctxt->name.c_str(), ctxt->role.c_str());
368             afb_req_session_set_LOA(req, 1);
369             afb_req_context_set(req, ctxt, cbRemoveClientCtxt);
370         }
371         else
372         {
373             HMI_DEBUG("wm", "session already created for %s", appid.c_str());
374         }
375
376         afb_req_success(req, NULL, "success");
377     }
378     catch (std::exception &e)
379     {
380         afb_req_fail_f(req, "failed", "Uncaught exception while calling requestsurfacexdg: %s", e.what());
381         return;
382     }
383 }
384
385 void windowmanager_activatesurface(afb_req req) noexcept
386 {
387     std::lock_guard<std::mutex> guard(binding_m);
388 #ifdef ST
389     ST();
390 #endif
391     if (g_afb_instance == nullptr)
392     {
393         afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
394         return;
395     }
396
397     try
398     {
399         const char *a_drawing_name = afb_req_value(req, "drawing_name");
400         if (!a_drawing_name)
401         {
402             afb_req_fail(req, "failed", "Need char const* argument drawing_name");
403             return;
404         }
405
406         const char *a_drawing_area = afb_req_value(req, "drawing_area");
407         if (!a_drawing_area)
408         {
409             afb_req_fail(req, "failed", "Need char const* argument drawing_area");
410             return;
411         }
412
413         g_afb_instance->app.api_activate_surface(
414             afb_req_get_application_id(req),
415             a_drawing_name, a_drawing_area,
416             [&req](const char *errmsg) {
417                 if (errmsg != nullptr)
418                 {
419                     HMI_ERROR("wm", errmsg);
420                     afb_req_fail(req, "failed", errmsg);
421                     return;
422                 }
423                 afb_req_success(req, NULL, "success");
424             });
425     }
426     catch (std::exception &e)
427     {
428         HMI_WARNING("wm", "failed", "Uncaught exception while calling activatesurface: %s", e.what());
429         return;
430     }
431 }
432
433 void windowmanager_deactivatesurface(afb_req req) noexcept
434 {
435     std::lock_guard<std::mutex> guard(binding_m);
436 #ifdef ST
437     ST();
438 #endif
439     if (g_afb_instance == nullptr)
440     {
441         afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
442         return;
443     }
444
445     try
446     {
447         const char *a_drawing_name = afb_req_value(req, "drawing_name");
448         if (!a_drawing_name)
449         {
450             afb_req_fail(req, "failed", "Need char const* argument drawing_name");
451             return;
452         }
453
454         g_afb_instance->app.api_deactivate_surface(
455             afb_req_get_application_id(req), a_drawing_name,
456             [&req](const char *errmsg) {
457                 if (errmsg != nullptr)
458                 {
459                     HMI_ERROR("wm", errmsg);
460                     afb_req_fail(req, "failed", errmsg);
461                     return;
462                 }
463                 afb_req_success(req, NULL, "success");
464             });
465     }
466     catch (std::exception &e)
467     {
468         HMI_WARNING("wm", "Uncaught exception while calling deactivatesurface: %s", e.what());
469         return;
470     }
471 }
472
473 void windowmanager_enddraw(afb_req req) noexcept
474 {
475     std::lock_guard<std::mutex> guard(binding_m);
476 #ifdef ST
477     ST();
478 #endif
479     if (g_afb_instance == nullptr)
480     {
481         afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
482         return;
483     }
484
485     try
486     {
487         const char *a_drawing_name = afb_req_value(req, "drawing_name");
488         if (!a_drawing_name)
489         {
490             afb_req_fail(req, "failed", "Need char const* argument drawing_name");
491             return;
492         }
493         afb_req_success(req, NULL, "success");
494
495         g_afb_instance->app.api_enddraw(
496             afb_req_get_application_id(req), a_drawing_name);
497     }
498     catch (std::exception &e)
499     {
500         HMI_WARNING("wm", "failed", "Uncaught exception while calling enddraw: %s", e.what());
501         return;
502     }
503 }
504
505 void windowmanager_getdisplayinfo_thunk(afb_req req) noexcept
506 {
507     std::lock_guard<std::mutex> guard(binding_m);
508 #ifdef ST
509     ST();
510 #endif
511     if (g_afb_instance == nullptr)
512     {
513         afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
514         return;
515     }
516
517     try
518     {
519         auto ret = g_afb_instance->app.api_get_display_info();
520         if (ret.is_err())
521         {
522             afb_req_fail(req, "failed", ret.unwrap_err());
523             return;
524         }
525
526         afb_req_success(req, ret.unwrap(), "success");
527     }
528     catch (std::exception &e)
529     {
530         afb_req_fail_f(req, "failed", "Uncaught exception while calling getdisplayinfo: %s", e.what());
531         return;
532     }
533 }
534
535 void windowmanager_getareainfo_thunk(afb_req req) noexcept
536 {
537     std::lock_guard<std::mutex> guard(binding_m);
538 #ifdef ST
539     ST();
540 #endif
541     if (g_afb_instance == nullptr)
542     {
543         afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
544         return;
545     }
546
547     try
548     {
549         json_object *jreq = afb_req_json(req);
550
551         json_object *j_drawing_name = nullptr;
552         if (!json_object_object_get_ex(jreq, "drawing_name", &j_drawing_name))
553         {
554             afb_req_fail(req, "failed", "Need char const* argument drawing_name");
555             return;
556         }
557         char const *a_drawing_name = json_object_get_string(j_drawing_name);
558
559         auto ret = g_afb_instance->app.api_get_area_info(a_drawing_name);
560         if (ret.is_err())
561         {
562             afb_req_fail(req, "failed", ret.unwrap_err());
563             return;
564         }
565
566         afb_req_success(req, ret.unwrap(), "success");
567     }
568     catch (std::exception &e)
569     {
570         afb_req_fail_f(req, "failed", "Uncaught exception while calling getareainfo: %s", e.what());
571         return;
572     }
573 }
574
575 void windowmanager_wm_subscribe(afb_req req) noexcept
576 {
577     std::lock_guard<std::mutex> guard(binding_m);
578 #ifdef ST
579     ST();
580 #endif
581     if (g_afb_instance == nullptr)
582     {
583         afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
584         return;
585     }
586
587     try
588     {
589         json_object *jreq = afb_req_json(req);
590         json_object *j = nullptr;
591         if (!json_object_object_get_ex(jreq, "event", &j))
592         {
593             afb_req_fail(req, "failed", "Need char const* argument event");
594             return;
595         }
596         int event_type = json_object_get_int(j);
597         const char *event_name = g_afb_instance->app.kListEventName[event_type];
598         struct afb_event event = g_afb_instance->app.map_afb_event[event_name];
599         int ret = afb_req_subscribe(req, event);
600         if (ret)
601         {
602             afb_req_fail(req, "failed", "Error: afb_req_subscribe()");
603             return;
604         }
605         afb_req_success(req, NULL, "success");
606     }
607     catch (std::exception &e)
608     {
609         afb_req_fail_f(req, "failed", "Uncaught exception while calling wm_subscribe: %s", e.what());
610         return;
611     }
612 }
613
614 void windowmanager_list_drawing_names(afb_req req) noexcept
615 {
616     std::lock_guard<std::mutex> guard(binding_m);
617 #ifdef ST
618     ST();
619 #endif
620     if (g_afb_instance == nullptr)
621     {
622         afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
623         return;
624     }
625
626     try
627     {
628
629         nlohmann::json j = g_afb_instance->app.id_alloc.name2id;
630         auto ret = wm::Ok(json_tokener_parse(j.dump().c_str()));
631         if (ret.is_err())
632         {
633             afb_req_fail(req, "failed", ret.unwrap_err());
634             return;
635         }
636
637         afb_req_success(req, ret.unwrap(), "success");
638     }
639     catch (std::exception &e)
640     {
641         afb_req_fail_f(req, "failed", "Uncaught exception while calling list_drawing_names: %s", e.what());
642         return;
643     }
644 }
645
646 void windowmanager_ping(afb_req req) noexcept
647 {
648     std::lock_guard<std::mutex> guard(binding_m);
649 #ifdef ST
650     ST();
651 #endif
652     if (g_afb_instance == nullptr)
653     {
654         afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
655         return;
656     }
657
658     try
659     {
660
661         g_afb_instance->app.api_ping();
662
663         afb_req_success(req, NULL, "success");
664     }
665     catch (std::exception &e)
666     {
667         afb_req_fail_f(req, "failed", "Uncaught exception while calling ping: %s", e.what());
668         return;
669     }
670 }
671
672 void windowmanager_debug_status(afb_req req) noexcept
673 {
674     std::lock_guard<std::mutex> guard(binding_m);
675 #ifdef ST
676     ST();
677 #endif
678     if (g_afb_instance == nullptr)
679     {
680         afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
681         return;
682     }
683
684     try
685     {
686
687         json_object *jr = json_object_new_object();
688         json_object_object_add(jr, "surfaces",
689                                to_json(g_afb_instance->app.controller->sprops));
690         json_object_object_add(jr, "layers", to_json(g_afb_instance->app.controller->lprops));
691
692         afb_req_success(req, jr, "success");
693     }
694     catch (std::exception &e)
695     {
696         afb_req_fail_f(req, "failed", "Uncaught exception while calling debug_status: %s", e.what());
697         return;
698     }
699 }
700
701 void windowmanager_debug_layers(afb_req req) noexcept
702 {
703     std::lock_guard<std::mutex> guard(binding_m);
704 #ifdef ST
705     ST();
706 #endif
707     if (g_afb_instance == nullptr)
708     {
709         afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
710         return;
711     }
712
713     try
714     {
715         auto ret = wm::Ok(json_tokener_parse(g_afb_instance->app.layers.to_json().dump().c_str()));
716
717         afb_req_success(req, ret, "success");
718     }
719     catch (std::exception &e)
720     {
721         afb_req_fail_f(req, "failed", "Uncaught exception while calling debug_layers: %s", e.what());
722         return;
723     }
724 }
725
726 void windowmanager_debug_surfaces(afb_req req) noexcept
727 {
728     std::lock_guard<std::mutex> guard(binding_m);
729 #ifdef ST
730     ST();
731 #endif
732     if (g_afb_instance == nullptr)
733     {
734         afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
735         return;
736     }
737
738     try
739     {
740
741         auto ret = wm::Ok(to_json(g_afb_instance->app.controller->sprops));
742         if (ret.is_err())
743         {
744             afb_req_fail(req, "failed", ret.unwrap_err());
745             return;
746         }
747
748         afb_req_success(req, ret.unwrap(), "success");
749     }
750     catch (std::exception &e)
751     {
752         afb_req_fail_f(req, "failed", "Uncaught exception while calling debug_surfaces: %s", e.what());
753         return;
754     }
755 }
756
757 void windowmanager_debug_terminate(afb_req req) noexcept
758 {
759     std::lock_guard<std::mutex> guard(binding_m);
760 #ifdef ST
761     ST();
762 #endif
763     if (g_afb_instance == nullptr)
764     {
765         afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
766         return;
767     }
768
769     try
770     {
771
772         if (getenv("WINMAN_DEBUG_TERMINATE") != nullptr)
773         {
774             raise(SIGKILL); // afb-daemon kills it's pgroup using TERM, which
775                             // doesn't play well with perf
776         }
777
778         afb_req_success(req, NULL, "success");
779     }
780     catch (std::exception &e)
781     {
782         afb_req_fail_f(req, "failed", "Uncaught exception while calling debug_terminate: %s", e.what());
783         return;
784     }
785 }
786
787 const struct afb_verb_v2 windowmanager_verbs[] = {
788     {"requestsurface", windowmanager_requestsurface, nullptr, nullptr, AFB_SESSION_NONE},
789     {"requestsurfacexdg", windowmanager_requestsurfacexdg, nullptr, nullptr, AFB_SESSION_NONE},
790     {"setrole", windowmanager_setrole, nullptr, nullptr, AFB_SESSION_NONE},
791     {"activatesurface", windowmanager_activatesurface, nullptr, nullptr, AFB_SESSION_LOA_1},
792     {"deactivatesurface", windowmanager_deactivatesurface, nullptr, nullptr, AFB_SESSION_LOA_1},
793     {"enddraw", windowmanager_enddraw, nullptr, nullptr, AFB_SESSION_LOA_1},
794     {"getdisplayinfo", windowmanager_getdisplayinfo_thunk, nullptr, nullptr, AFB_SESSION_NONE},
795     {"getareainfo", windowmanager_getareainfo_thunk, nullptr, nullptr, AFB_SESSION_LOA_1},
796     {"wm_subscribe", windowmanager_wm_subscribe, nullptr, nullptr, AFB_SESSION_NONE},
797     {"list_drawing_names", windowmanager_list_drawing_names, nullptr, nullptr, AFB_SESSION_NONE},
798     {"ping", windowmanager_ping, nullptr, nullptr, AFB_SESSION_NONE},
799     {"debug_status", windowmanager_debug_status, nullptr, nullptr, AFB_SESSION_NONE},
800     {"debug_layers", windowmanager_debug_layers, nullptr, nullptr, AFB_SESSION_NONE},
801     {"debug_surfaces", windowmanager_debug_surfaces, nullptr, nullptr, AFB_SESSION_NONE},
802     {"debug_terminate", windowmanager_debug_terminate, nullptr, nullptr, AFB_SESSION_NONE},
803     {}};
804
805 extern "C" const struct afb_binding_v2 afbBindingV2 = {
806     "windowmanager", nullptr, nullptr, windowmanager_verbs, nullptr, binding_init, nullptr, 0};