diff options
author | Jørgen Lind <jorgen.lind@theqtcompany.com> | 2015-09-14 12:35:52 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@theqtcompany.com> | 2015-09-14 12:17:05 +0000 |
commit | f5f06c709937b657c66ca4e35f4e3065ba390153 (patch) | |
tree | 1019883bf566cc7de6d86b9cd2ab4f43b342b26c /examples | |
parent | 2deffa537c82e2f21e01dff5c8f5ba283dd06032 (diff) |
Remove global coordinates
This involves removing:
- pickView and mapView from QWaylandOutput
- requestedPos[X,Y] from QWaylandView
Change-Id: Ie53eef434ac6ae7d0d5474f649f78a59ae857167
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/wayland/pure-qml/qml/Chrome.qml | 13 | ||||
-rw-r--r-- | examples/wayland/pure-qml/qml/main.qml | 35 |
2 files changed, 31 insertions, 17 deletions
diff --git a/examples/wayland/pure-qml/qml/Chrome.qml b/examples/wayland/pure-qml/qml/Chrome.qml index 4a365fc7b..f52582816 100644 --- a/examples/wayland/pure-qml/qml/Chrome.qml +++ b/examples/wayland/pure-qml/qml/Chrome.qml @@ -43,8 +43,6 @@ import QtWayland.Compositor 1.0 WaylandQuickItem { id: rootChrome - x: clampXPos() - y: clampYPos() onSurfaceDestroyed: { lockedBuffer = true; @@ -69,15 +67,4 @@ WaylandQuickItem { } ] - function clampXPos() { - if (!parent) - return view.requestedXPosition; - return Math.max(Math.min(view.requestedXPosition, parent.width - 10), 0) - } - function clampYPos() { - if (!parent) - return view.requestedYPosition; - return Math.max(Math.min(view.requestedYPosition, parent.height - 30), 0) - } - } diff --git a/examples/wayland/pure-qml/qml/main.qml b/examples/wayland/pure-qml/qml/main.qml index 12f6063b4..7f47e1325 100644 --- a/examples/wayland/pure-qml/qml/main.qml +++ b/examples/wayland/pure-qml/qml/main.qml @@ -53,7 +53,8 @@ WaylandCompositor { Component { id: chromeComponent - Chrome { } + Chrome { + } } Component { @@ -69,13 +70,38 @@ WaylandCompositor { Component { id: shellSurfaceComponent - DefaultShellSurface { } + DefaultShellSurface { + property Item chrome + property var previousMousePosition + property var originalInputEventsEnabled + Connections { + target: chrome ? chrome : null + onMouseMove: { + var deltaX = windowPosition.x - previousMousePosition.x + var deltaY = windowPosition.y - previousMousePosition.y + chrome.x = chrome.x + deltaX + chrome.y = chrome.y + deltaY + previousMousePosition = windowPosition; + } + onMouseRelease: { + chrome.inputEventsEnabled = originalInputEventsEnabled; + } + } + + onStartMove: { + previousMousePosition = chrome.mousePressPosition + originalInputEventsEnabled = chrome.inputEventsEnabled + chrome.inputEventsEnabled = false; + } + + } } onCreateShellSurface: { var item = chromeComponent.createObject(defaultOutput.surfaceArea, { "surface": surface } ); - var shellSurface = shellSurfaceComponent.createObject(); - shellSurface.initialize(defaultShell, surface, item.view, client, id); + var shellSurface = shellSurfaceComponent.createObject( null, { "chrome": item }); + shellSurface.chrome = item; + shellSurface.initialize(defaultShell, surface, client, id); surface.shellSurface = shellSurface; } @@ -88,6 +114,7 @@ WaylandCompositor { onCreateSurface: { var surface = surfaceComponent.createObject(0, { } ); surface.initialize(compositor, client, id, version); + } Component.onCompleted: { |