2 * Copyright (C) 2017 Mentor Graphics Development (Deutschland) GmbH
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef TMCAGLWM_APP_HPP
18 #define TMCAGLWM_APP_HPP
20 #include <json-c/json.h>
23 #include "afb_binding_api.hpp"
25 #include "controller_hooks.hpp"
29 #include "wayland.hpp"
42 struct binding_api api;
43 struct controller_hooks chooks;
45 // This is the one thing, we do not own.
46 struct wl::display *display;
48 std::unique_ptr<struct genivi::controller> controller;
49 std::vector<std::unique_ptr<struct wl::output>> outputs;
56 typedef std::pair<char const *, std::function<void()>> name_task_pair;
57 std::vector<name_task_pair> pending;
59 explicit App(wl::display *d);
62 App(App const &) = delete;
63 App &operator=(App const &) = delete;
65 App &operator=(App &&) = delete;
68 int dispatch_events();
70 void surface_set_layout(uint32_t surface_id);
71 char const *activate_surface(uint32_t surface_id);
73 void add_task(char const *name, std::function<void()> &&f);
74 void execute_pending();
76 void surface_created(uint32_t surface_id);
77 void surface_removed(uint32_t surface_id);
82 #endif // TMCAGLWM_APP_HPP