diff options
Diffstat (limited to 'src/qlibwindowmanager.cpp')
-rw-r--r-- | src/qlibwindowmanager.cpp | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/qlibwindowmanager.cpp b/src/qlibwindowmanager.cpp index b264c94..df17f47 100644 --- a/src/qlibwindowmanager.cpp +++ b/src/qlibwindowmanager.cpp @@ -28,7 +28,37 @@ using namespace std; int QLibWindowmanager::init(int port, const QString &token) { string ctoken = token.toStdString(); - return this->wm->init(port, ctoken.c_str()); + int ret_init = this->wm->init(port, ctoken.c_str()); + + // initialize dpyinfo + json_object *obj = json_object_new_object(); + + int ret = this->wm->getDisplayInfo(obj); + + this->screen_info = new AGLScreenInfoPrivate; + + if (!ret) { + json_object *j_val; + if (json_object_object_get_ex(obj, "width_pixel", &j_val)) { + this->screen_info->set_width_dp(json_object_get_double(j_val)); + } + if (json_object_object_get_ex(obj, "height_pixel", &j_val)) { + this->screen_info->set_height_dp(json_object_get_double(j_val)); + } + if (json_object_object_get_ex(obj, "width_mm", &j_val)) { + this->screen_info->set_width_mm(json_object_get_double(j_val)); + } + if (json_object_object_get_ex(obj, "height_mm", &j_val)) { + this->screen_info->set_height_mm(json_object_get_double(j_val)); + } + if (json_object_object_get_ex(obj, "scale", &j_val)) { + this->screen_info->set_scale_factor(json_object_get_double(j_val)); + } + } + + json_object_put(obj); + + return ret_init; } int QLibWindowmanager::requestSurface(const QString &label) { @@ -120,7 +150,7 @@ void QLibWindowmanager::slotActivateSurface(){ } QLibWindowmanager::QLibWindowmanager(QObject *parent) - :QObject(parent), isActive(false) + :QObject(parent), isActive(false), screen_info(nullptr) { wm = new LibWindowmanager(); } |