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 */
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");
extern "C" {
#include "emul_state.h"
+#include "emulator_options.h"
+
int qemu_get_thread_id(void);
bool is_display_off(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);