#include "hardwarekey.h"
#include "floatingcontroller.h"
#include "ui/xml/emulatoruitype.h"
+#include "uiutil.h"
extern "C" {
#include "emul_state.h"
mainwindow = new MainWindow(uiInfo);
/* position */
- int xx = mruInfo.value(SKIN_PROPERTY_WINDOW_X).toInt();
- int yy = mruInfo.value(SKIN_PROPERTY_WINDOW_Y).toInt();
- qDebug("previous position value is (%d, %d)", xx, yy);
+ QRect hostBounds = UIUtil::getHostScreenBounds();
+ qDebug() << "host geometry : " << hostBounds;
- if (xx == 0 && yy == 0) {
- xx = yy = 80 + (uiInfo->basePort % 100);
+ int defaultValueX = hostBounds.x() - 1;
+ int defaultValueY = hostBounds.y() - 1;
+ int xx = mruInfo.value(SKIN_PROPERTY_WINDOW_X, defaultValueX).toInt();
+ int yy = mruInfo.value(SKIN_PROPERTY_WINDOW_Y, defaultValueY).toInt();
+
+ if (xx == defaultValueX || yy == defaultValueY) {
+ xx = yy = 80 + (uiInfo->basePort % 100); /* default position */
+ } else {
+ qDebug("previous position value : (%d, %d)", xx, yy);
+
+ xx = qMax(xx, hostBounds.x());
+ xx = qMin(xx, hostBounds.x() + hostBounds.width() - 100);
+ yy = qMax(yy, hostBounds.y());
+ yy = qMin(yy, hostBounds.y() + hostBounds.height() - 100);
}
+
mainwindow->move(xx, yy);
+ qDebug("current position value : (%d, %d)", xx, yy);
bool onTop = mruInfo.value(SKIN_PROPERTY_WINDOW_TOPMOST).toBool();
if (onTop == true) {
obj-$(CONFIG_QT) += skinview.o
obj-$(CONFIG_QT) += uiinformation.o
obj-$(CONFIG_QT) += uistate.o
+obj-$(CONFIG_QT) += uiutil.o
obj-$(CONFIG_QT) += qrc_resource.o
obj-$(CONFIG_QT) += xml/
--- /dev/null
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "uiutil.h"
+
+UIUtil::UIUtil()
+{
+ /* do nothing */
+}
+
+QRect UIUtil::getHostScreenBounds()
+{
+ return QApplication::screens().at(
+ QApplication::desktop()->primaryScreen())->virtualGeometry();
+}
--- /dev/null
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef UIUTIL_H
+#define UIUTIL_H
+
+#include <QApplication>
+#include <QDesktopWidget>
+#include <QScreen>
+#include <QRect>
+
+class UIUtil
+{
+public:
+ UIUtil();
+
+ static QRect getHostScreenBounds();
+};
+
+#endif // UIUTIL_H