@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2016 Canonical, Ltd.
2+ * Copyright (C) 2016-2017 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@ import QtQuick 2.4
1818import Ubuntu.Components 1.3
1919import Unity.Application 0.1
2020
21−Item {
21+FocusScope {
2222 id: root
2323
2424 property alias surface: childWindow.surface
@@ -100,6 +100,13 @@ Item {
100100 onFocusRequested: {
101101 root.surface.activate();
102102 }
103+ onFocusedChanged: {
104+ if (root.surface.focused) {
105+ childWindow.focus = true;
106+ // Propagate
107+ root.focus = true;
108+ }
109+ }
103110 }
104111
105112 // Using a loader here mainly to circunvent the "ChildWindowTree is instantiated recursively" error from the QML engine
@@ -119,5 +126,12 @@ Item {
119126 property: "boundsItem"
120127 value: root.boundsItem
121128 }
129+ onFocusChanged: {
130+ if (focus) {
131+ // A surface in some ChildWindowTree got focused.
132+ // Propagate
133+ root.focus = true;
134+ }
135+ }
122136 }
123137}