6c13763b228f7c22a58b82438c6946d6f06ec6ad
[apps/agl-service-windowmanager-2017.git] / libwindowmanager / libwindowmanager.h
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 #ifndef LIBWINDOWMANAGER_H
18 #define LIBWINDOWMANAGER_H
19
20 #include <functional>
21
22 class LibWindowmanager {
23 public:
24     LibWindowmanager();
25     ~LibWindowmanager();
26
27     LibWindowmanager(const LibWindowmanager &) = delete;
28     LibWindowmanager &operator=(const LibWindowmanager &) = delete;
29
30     using handler_fun = std::function<void(const char *)>;
31
32     enum EventType {
33        Event_Active = 1,
34        Event_Inactive,
35
36        Event_Visible,
37        Event_Invisible,
38
39        Event_SyncDraw,
40        Event_FlushDraw,
41     };
42
43     int init(int port, char const *token);
44
45     // WM API
46     int requestSurface(const char *label);
47     int activateSurface(const char *label);
48     int deactivateSurface(const char *label);
49     int endDraw(const char *label);
50
51     void set_event_handler(enum EventType et, handler_fun f);
52
53     struct Impl;
54
55 private:
56     Impl *const d;
57 };
58 #endif // LIBWINDOWMANAGER_H