summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>2012-01-10 10:29:38 +0200
committerJørgen Lind <jorgen.lind@nokia.com>2012-01-10 12:35:35 +0100
commit6c32ea510f7f75764c7039e6f117e9b6e43b4622 (patch)
treea10d39db1d89e447744dd70cf83a3199f2c772ad /examples
parentd70a139911a3329bd2b4b443c2d6f9b954b528a2 (diff)
Add an option to qwindow-compositor for disabling random positioning
When passing -stickytopleft all surfaces will be shown at position 0,0 instead of picking a random one. This is useful for apps with one single large window in combination with -nofullscreen. Change-Id: I0834c43981a2d2c7b9796e273ac0eb0cfd738132 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/qwindow-compositor/qwindowcompositor.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/examples/qwindow-compositor/qwindowcompositor.cpp b/examples/qwindow-compositor/qwindowcompositor.cpp
index b88dcf51b..fd5b24aea 100644
--- a/examples/qwindow-compositor/qwindowcompositor.cpp
+++ b/examples/qwindow-compositor/qwindowcompositor.cpp
@@ -45,8 +45,12 @@ void QWindowCompositor::surfaceMapped()
WaylandSurface *surface = qobject_cast<WaylandSurface *>(sender());
QPoint pos;
if (!m_surfaces.contains(surface)) {
- uint px = 1 + (qrand() % (m_window->width() - surface->size().width() - 2));
- uint py = 1 + (qrand() % (m_window->height() - surface->size().height() - 2));
+ uint px = 0;
+ uint py = 0;
+ if (!QCoreApplication::arguments().contains(QLatin1String("-stickytopleft"))) {
+ px = 1 + (qrand() % (m_window->width() - surface->size().width() - 2));
+ py = 1 + (qrand() % (m_window->height() - surface->size().height() - 2));
+ }
pos = QPoint(px, py);
surface->setPos(pos);
} else {