summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-11-29 18:35:14 +0900
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-12-07 20:20:17 +0900
commit3ff07151af5040842dd1e56d8312ee39cc50f533 (patch)
treeeec526931acf47143e1e7c478bd66cb55f2ef249
parentd186c2c096756469d7a917e67b49dc9eef68a625 (diff)
Inherit LibWindowmanager to provide libwindowmanger function. Qt application can also use LibWindowmanager functions. Change-Id: Ifda50b84ea7b4a743867c02e8c6bc18f5a03d674 Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
-rw-r--r--src/qlibwindowmanager.cpp18
-rw-r--r--src/qlibwindowmanager.h3
2 files changed, 9 insertions, 12 deletions
diff --git a/src/qlibwindowmanager.cpp b/src/qlibwindowmanager.cpp
index fff99c4..032ef8d 100644
--- a/src/qlibwindowmanager.cpp
+++ b/src/qlibwindowmanager.cpp
@@ -24,12 +24,12 @@ using namespace std;
int QLibWindowmanager::init(int port, const QString &token) {
string ctoken = token.toStdString();
- int ret_init = this->wm->init(port, ctoken);
+ int ret_init = LibWindowmanager::init(port, ctoken);
this->screen_info = new AGLScreenInfoPrivate;
if(ret_init == 0) {
- struct Screen scrn = this->wm->getScreenInfo();
+ struct Screen scrn = LibWindowmanager::getScreenInfo();
this->screen_info->set_width_dp(scrn.width_dp);
this->screen_info->set_height_dp(scrn.height_dp);
this->screen_info->set_width_mm(scrn.width_mm);
@@ -42,7 +42,7 @@ int QLibWindowmanager::init(int port, const QString &token) {
int QLibWindowmanager::requestSurface(const QString &role) {
this->graphic_role = role.toStdString();
- int surface_id = this->wm->requestSurface(this->graphic_role.c_str());
+ int surface_id = LibWindowmanager::requestSurface(this->graphic_role.c_str());
if(surface_id < 0){
qDebug("failed to get surfaceID");
return -1;
@@ -59,18 +59,18 @@ int QLibWindowmanager::requestSurface(const QString &role) {
int QLibWindowmanager::activateWindow(const QString &role) {
string srole = role.toStdString();
// Request default drawing area "normal.full" in libwindowmanager
- return this->wm->activateWindow(srole.c_str());
+ return LibWindowmanager::activateWindow(srole.c_str());
}
int QLibWindowmanager::activateWindow(const QString &role, const QString &area) {
string srole = role.toStdString();
string sarea = area.toStdString();
- return this->wm->activateWindow(srole.c_str(), sarea.c_str());
+ return LibWindowmanager::activateWindow(srole.c_str(), sarea.c_str());
}
int QLibWindowmanager::deactivateWindow(const QString &role) {
string srole = role.toStdString();
- return this->wm->deactivateWindow(srole.c_str());
+ return LibWindowmanager::deactivateWindow(srole.c_str());
}
// This API is deprecated, please use new API
@@ -90,13 +90,13 @@ int QLibWindowmanager::deactivateSurface(const QString &role) {
int QLibWindowmanager::endDraw(const QString &role) {
string srole = role.toStdString();
- return this->wm->endDraw(srole.c_str());
+ return LibWindowmanager::endDraw(srole.c_str());
}
void QLibWindowmanager::set_event_handler(enum QEventType et,
handler_fun f) {
LibWindowmanager::EventType wet = (LibWindowmanager::EventType)et;
- return this->wm->set_event_handler(wet, std::move(f));
+ return LibWindowmanager::set_event_handler(wet, std::move(f));
}
void QLibWindowmanager::slotActivateWindow(){
@@ -116,11 +116,9 @@ void QLibWindowmanager::slotActivateSurface(){
QLibWindowmanager::QLibWindowmanager(QObject *parent)
:QObject(parent), isActive(false), screen_info(nullptr)
{
- wm = new LibWindowmanager();
}
QLibWindowmanager::~QLibWindowmanager()
{
- delete wm;
delete screen_info;
} \ No newline at end of file
diff --git a/src/qlibwindowmanager.h b/src/qlibwindowmanager.h
index e60f04f..6433463 100644
--- a/src/qlibwindowmanager.h
+++ b/src/qlibwindowmanager.h
@@ -57,7 +57,7 @@ class AGLScreenInfoPrivate
double _scale = 1.0;
};
-class QLibWindowmanager : public QObject{
+class QLibWindowmanager : public QObject, public LibWindowmanager{
Q_OBJECT
public:
explicit QLibWindowmanager(QObject *parent = nullptr);
@@ -111,7 +111,6 @@ public slots:
THIS_FUNCTION_IS_DEPRECATED(void slotActivateSurface());
private:
- LibWindowmanager* wm;
std::string graphic_role;
bool isActive;
AGLScreenInfoPrivate* screen_info;