diff options
-rw-r--r-- | tizen/src/ui/mainwindow.cpp | 25 | ||||
-rw-r--r-- | tizen/src/ui/mainwindow.h | 1 | ||||
-rw-r--r-- | tizen/src/ui/qt5_supplement.cpp | 36 |
3 files changed, 37 insertions, 25 deletions
diff --git a/tizen/src/ui/mainwindow.cpp b/tizen/src/ui/mainwindow.cpp index 5a21f18ca1..dd8a5d02ef 100644 --- a/tizen/src/ui/mainwindow.cpp +++ b/tizen/src/ui/mainwindow.cpp @@ -398,16 +398,7 @@ void MainWindow::resizeEvent(QResizeEvent *event) QWidget::resizeEvent(event); setFixedSize(size()); - /* correctional position */ - int xx = pos().x(); - int yy = pos().y(); - QRect hostBounds = UiUtil::getHostScreenBounds(); - xx = qMax(xx, hostBounds.x()); - yy = qMax(yy, hostBounds.y()); - // shift a little bit from screen edge to inside of bounds - xx = qMin(xx, hostBounds.x() + hostBounds.width() - 100); - yy = qMin(yy, hostBounds.y() + hostBounds.height() - 100); - move(xx, yy); + calibratedMove(pos().x(), pos().y()); } /* override */ @@ -547,6 +538,20 @@ void MainWindow::setTopMost(bool on) popupMenu->slotOnTop(on); } +void MainWindow::calibratedMove(int xx, int yy) +{ + QRect hostBounds = UiUtil::getHostScreenBounds(); + + xx = qMax(xx, hostBounds.x()); + yy = qMax(yy, hostBounds.y()); + // shift a little bit from screen edge to inside of bounds + xx = qMin(xx, hostBounds.x() + hostBounds.width() - 100); + yy = qMin(yy, hostBounds.y() + hostBounds.height() - 100); + + move(xx, yy); + qDebug() << "current position:" << pos(); +} + void MainWindow::turnOnMovingMode() { qDebug("enter the moving mode"); diff --git a/tizen/src/ui/mainwindow.h b/tizen/src/ui/mainwindow.h index 7cfbd8e1c8..183aeb337c 100644 --- a/tizen/src/ui/mainwindow.h +++ b/tizen/src/ui/mainwindow.h @@ -73,6 +73,7 @@ public: void unsetCaptureRequestHandler(void *data); void processCaptured(bool captured, void *pixels, int width, int height); void setTopMost(bool on); + void calibratedMove(int x, int y); DockingController *getDockingCon(); FloatingController *getFloatingCon(); diff --git a/tizen/src/ui/qt5_supplement.cpp b/tizen/src/ui/qt5_supplement.cpp index f3346e23f3..4df02d7634 100644 --- a/tizen/src/ui/qt5_supplement.cpp +++ b/tizen/src/ui/qt5_supplement.cpp @@ -41,6 +41,8 @@ extern "C" { #include "emul_state.h" +#include "emulator_options.h" + int qemu_get_thread_id(void); bool is_display_off(void); } @@ -210,28 +212,32 @@ static void qt5_gui_init(void) mainwindow->setCaptureRequestHandler(captureRequestListener, captureRequestHandler); /* position */ - QRect hostBounds = UiUtil::getHostScreenBounds(); - qDebug() << "host geometry:" << hostBounds; + int xx = 0; + int yy = 0; - 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(); + const char *winPosOpt = get_variable("window_position"); + if (winPosOpt != NULL) { + qDebug("window_position option was found"); - if (xx == defaultValueX || yy == defaultValueY) { - xx = yy = 80 + (uiInfo->getBasePort() % 100); /* default position */ + char *endptr = NULL; + xx = (int)g_ascii_strtoll(winPosOpt, &endptr, 10); + yy = (int)g_ascii_strtoll(++endptr, &endptr, 10); } else { - qDebug("previous position: (%d, %d)", xx, yy); + const int defaultPos = 80; - 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); + if (mruInfo.contains(SKIN_PROPERTY_WINDOW_X) == true && + mruInfo.contains(SKIN_PROPERTY_WINDOW_Y) == true) { + xx = mruInfo.value(SKIN_PROPERTY_WINDOW_X, defaultPos).toInt(); + yy = mruInfo.value(SKIN_PROPERTY_WINDOW_Y, defaultPos).toInt(); + } else { + /* differential position for each VM */ + xx = yy = defaultPos + (uiInfo->getBasePort() % 100); + } } - mainwindow->move(xx, yy); - qDebug("current position: (%d, %d)", xx, yy); + mainwindow->calibratedMove(xx, yy); + /* z-order */ bool onTop = mruInfo.value(SKIN_PROPERTY_WINDOW_TOPMOST).toBool(); if (onTop == true) { mainwindow->setTopMost(true); |