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