POI: AGL LifeCycle Management
[apps/agl-service-windowmanager.git] / client / qlibwindowmanager.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 "qlibwindowmanager.h"
18 #include <unistd.h>
19
20 int QLibWindowmanager::init(int port, char const *token) {
21     return this->wm->init(port, token);
22 }
23
24 int QLibWindowmanager::requestSurface(const char *label) {
25     applabel = label;
26     return this->wm->requestSurface(label);
27 }
28
29 int QLibWindowmanager::activateSurface(const char *label) {
30     return this->wm->activateSurface(label);
31 }
32
33 int QLibWindowmanager::deactivateSurface(const char *label) {
34     return this->wm->deactivateSurface(label);
35 }
36
37 int QLibWindowmanager::endDraw(const char *label) { return this->wm->endDraw(label); }
38
39 void QLibWindowmanager::set_event_handler(enum QEventType et,
40                                   std::function<void(char const *label)> f) {
41     LibWindowmanager::EventType wet = (LibWindowmanager::EventType)et;
42     return this->wm->set_event_handler(wet, std::move(f));
43 }
44
45 void QLibWindowmanager::slotActivateSurface(){
46     qDebug("%s",__FUNCTION__);
47     this->activateSurface(applabel.c_str());
48 }
49
50 QLibWindowmanager::QLibWindowmanager(QObject *parent) 
51     :QObject(parent) 
52 {
53     wm = new LibWindowmanager();
54 }
55
56 QLibWindowmanager::~QLibWindowmanager() { }