2 * Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 // FIXME: This is a hack around us not knowing whether the Repeater has finished creating its
22 // delegates on start up.
23 // This is a problem when the stage gets a TopLevelSurfaceList already populated with several
25 property bool startingUp: true
26 onStartingUpChanged: {
28 // the top-most surface must be the focused one.
29 var topmostDelegate = itemAt(0);
30 if (topmostDelegate.focus) {
31 // Delegate got focused while we were still starting up. Not good.
32 // Force signal handler to run again
33 topmostDelegate.onFocusChanged(true);
35 topmostDelegate.focus = true;
42 checkIfStillStartingUp();
46 function checkIfStillStartingUp() {
48 var missingDelegate = false;
49 for (i = 0; i < model.count && !missingDelegate; ++i) {
51 missingDelegate = true;
54 if (!missingDelegate) {