on xenial help sign in
displace windows when the OSK shows up
866d754Michael Zanetti
qml/Stages/DesktopStage.qml+13−2
@@ -263,8 +263,19 @@ AbstractStage {
263 }
263 }
264 }
264 }
265 z: normalZ
265 z: normalZ
266+ x: requestedX // may be overridden in some states. Do not directly write to this.
267+ y: requestedY // may be overridden in some states. Do not directly write to this.
266− x: priv.focusedAppDelegate ? priv.focusedAppDelegate.x + units.gu(3) : (normalZ - 1) * units.gu(3)
268+ property real requestedX: priv.focusedAppDelegate ? priv.focusedAppDelegate.x + units.gu(3) : (normalZ - 1) * units.gu(3)
267− y: priv.focusedAppDelegate ? priv.focusedAppDelegate.y + units.gu(3) : normalZ * units.gu(3)
269+ property real requestedY: priv.focusedAppDelegate ? priv.focusedAppDelegate.y + units.gu(3) : normalZ * units.gu(3)
270+
271+ Binding {
272+ target: appDelegate
273+ property: "y"
274+ value: appDelegate.requestedY -
275+ Math.min(appDelegate.requestedY - PanelState.panelHeight,
276+ UbuntuKeyboardInfo.height)
277+ when: appDelegate.focus
278+ }
268
279
269 width: decoratedWindow.width
280 width: decoratedWindow.width
270 height: decoratedWindow.height
281 height: decoratedWindow.height
qml/Stages/WindowDecoration.qml+2−2
@@ -65,8 +65,8 @@ MouseArea {
65 // Use integer coordinate values to ensure that target is left in a pixel-aligned
65 // Use integer coordinate values to ensure that target is left in a pixel-aligned
66 // position. Mouse movement could have subpixel precision, yielding a fractional
66 // position. Mouse movement could have subpixel precision, yielding a fractional
67 // mouse position.
67 // mouse position.
68− root.target.x = Math.round(pos.x - priv.distanceX);
68+ root.target.requestedX = Math.round(pos.x - priv.distanceX);
69− root.target.y = Math.round(Math.max(pos.y - priv.distanceY, PanelState.panelHeight));
69+ root.target.requestedY = Math.round(Math.max(pos.y - priv.distanceY, PanelState.panelHeight));
70 }
70 }
71 }
71 }
72
72
qml/Stages/WindowResizeArea.qml+11−11
@@ -55,8 +55,8 @@ MouseArea {
55
55
56 function updateNormalGeometry() {
56 function updateNormalGeometry() {
57 if (root.target.state == "normal") {
57 if (root.target.state == "normal") {
58− normalX = root.target.x
58+ normalX = root.target.requestedX
59− normalY = root.target.y
59+ normalY = root.target.requestedY
60 normalWidth = root.target.width
60 normalWidth = root.target.width
61 normalHeight = root.target.height
61 normalHeight = root.target.height
62 }
62 }
@@ -73,14 +73,14 @@ MouseArea {
73
73
74 function loadWindowState() {
74 function loadWindowState() {
75 var windowGeometry = windowStateStorage.getGeometry(root.windowId,
75 var windowGeometry = windowStateStorage.getGeometry(root.windowId,
76− Qt.rect(target.x, target.y, defaultWidth, defaultHeight));
76+ Qt.rect(target.requestedX, target.requestedY, defaultWidth, defaultHeight));
77
77
78 target.requestedWidth = Qt.binding(function() { return Math.min(Math.max(windowGeometry.width, d.minimumWidth), screenWidth - root.leftMargin); });
78 target.requestedWidth = Qt.binding(function() { return Math.min(Math.max(windowGeometry.width, d.minimumWidth), screenWidth - root.leftMargin); });
79 target.requestedHeight = Qt.binding(function() { return Math.min(Math.max(windowGeometry.height, d.minimumHeight),
79 target.requestedHeight = Qt.binding(function() { return Math.min(Math.max(windowGeometry.height, d.minimumHeight),
80 root.screenHeight - (target.fullscreen ? 0 : PanelState.panelHeight)); });
80 root.screenHeight - (target.fullscreen ? 0 : PanelState.panelHeight)); });
81− target.x = Qt.binding(function() { return Math.max(Math.min(windowGeometry.x, root.screenWidth - root.leftMargin - target.requestedWidth),
81+ target.requestedX = Qt.binding(function() { return Math.max(Math.min(windowGeometry.x, root.screenWidth - root.leftMargin - target.requestedWidth),
82 (target.fullscreen ? 0 : root.leftMargin)); });
82 (target.fullscreen ? 0 : root.leftMargin)); });
83− target.y = Qt.binding(function() { return Math.max(Math.min(windowGeometry.y, root.screenHeight - target.requestedHeight), PanelState.panelHeight); });
83+ target.requestedY = Qt.binding(function() { return Math.max(Math.min(windowGeometry.y, root.screenHeight - target.requestedHeight), PanelState.panelHeight); });
84
84
85 var windowState = windowStateStorage.getState(root.windowId, WindowStateStorage.WindowStateNormal)
85 var windowState = windowStateStorage.getState(root.windowId, WindowStateStorage.WindowStateNormal)
86 switch (windowState) {
86 switch (windowState) {
@@ -258,8 +258,8 @@ MouseArea {
258 var pos = mapToItem(root.target.parent, mouseX, mouseY);
258 var pos = mapToItem(root.target.parent, mouseX, mouseY);
259 d.startMousePosX = pos.x;
259 d.startMousePosX = pos.x;
260 d.startMousePosY = pos.y;
260 d.startMousePosY = pos.y;
261− d.startX = target.x;
261+ d.startX = target.requestedX;
262− d.startY = target.y;
262+ d.startY = target.requestedY;
263 d.startWidth = target.width;
263 d.startWidth = target.width;
264 d.startHeight = target.height;
264 d.startHeight = target.height;
265 d.currentWidth = target.width;
265 d.currentWidth = target.width;
@@ -296,7 +296,7 @@ MouseArea {
296
296
297 if (d.leftBorder) {
297 if (d.leftBorder) {
298 var newTargetX = d.startX + deltaX;
298 var newTargetX = d.startX + deltaX;
299− var rightBorderX = target.x + target.width;
299+ var rightBorderX = target.requestedX + target.width;
300 if (rightBorderX > newTargetX + d.minimumWidth) {
300 if (rightBorderX > newTargetX + d.minimumWidth) {
301 if (rightBorderX < newTargetX + d.maximumWidth) {
301 if (rightBorderX < newTargetX + d.maximumWidth) {
302 target.requestedWidth = rightBorderX - newTargetX;
302 target.requestedWidth = rightBorderX - newTargetX;
@@ -322,7 +322,7 @@ MouseArea {
322
322
323 if (d.topBorder) {
323 if (d.topBorder) {
324 var newTargetY = Math.max(d.startY + deltaY, PanelState.panelHeight); // disallow resizing up past Panel
324 var newTargetY = Math.max(d.startY + deltaY, PanelState.panelHeight); // disallow resizing up past Panel
325− var bottomBorderY = target.y + target.height;
325+ var bottomBorderY = target.requestedY + target.height;
326 if (bottomBorderY > newTargetY + d.minimumHeight) {
326 if (bottomBorderY > newTargetY + d.minimumHeight) {
327 if (bottomBorderY < newTargetY + d.maximumHeight) {
327 if (bottomBorderY < newTargetY + d.maximumHeight) {
328 target.requestedHeight = bottomBorderY - newTargetY;
328 target.requestedHeight = bottomBorderY - newTargetY;
@@ -351,13 +351,13 @@ MouseArea {
351 target: root.target
351 target: root.target
352 onWidthChanged: {
352 onWidthChanged: {
353 if (d.moveLeftBorder) {
353 if (d.moveLeftBorder) {
354− target.x += d.currentWidth - target.width;
354+ target.requestedX += d.currentWidth - target.width;
355 }
355 }
356 d.currentWidth = target.width;
356 d.currentWidth = target.width;
357 }
357 }
358 onHeightChanged: {
358 onHeightChanged: {
359 if (d.moveTopBorder) {
359 if (d.moveTopBorder) {
360− target.y += d.currentHeight - target.height;
360+ target.requestedY += d.currentHeight - target.height;
361 }
361 }
362 d.currentHeight = target.height;
362 d.currentHeight = target.height;
363 }
363 }
tests/mocks/Unity/Application/UbuntuKeyboardInfo.cpp+1−1
@@ -21,7 +21,7 @@ UbuntuKeyboardInfo::UbuntuKeyboardInfo(QObject *parent)
21 m_x(0),
21 m_x(0),
22 m_y(0),
22 m_y(0),
23 m_width(200),
23 m_width(200),
24− m_height(200)
24+ m_height(0)
25{
25{
26}
26}
27
27
tests/qmltests/Stages/tst_DesktopStage.qml+13
@@ -677,5 +677,18 @@ Item {
677 var closeButton = findChild(dashAppDelegate, "closeWindowButton");
677 var closeButton = findChild(dashAppDelegate, "closeWindowButton");
678 tryCompare(closeButton, "visible", false);
678 tryCompare(closeButton, "visible", false);
679 }
679 }
680+
681+ function test_oskDisplacesWindow() {
682+ var dashAppDelegate = startApplication("unity8-dash");
683+ verify(dashAppDelegate);
684+ var initialY = dashAppDelegate.y;
685+ verify(initialY > PanelState.panelHeight);
686+
687+ UbuntuKeyboardInfo.height = units.gu(10);
688+ tryCompare(dashAppDelegate, "y", PanelState.panelHeight);
689+
690+ UbuntuKeyboardInfo.height = 0;
691+ tryCompare(dashAppDelegate, "y", initialY);
692+ }
680 }
693 }
681}
694}