@@ -29,6 +29,7 @@ Item {
29 onSurfaceChanged: {
29 onSurfaceChanged: {
30 if (surface) {
30 if (surface) {
31 surface.parent = root;
31 surface.parent = root;
32+ d.forceSurfaceActiveFocusIfReady();
33 hadSurface = true;
34 hadSurface = true;
@@ -42,7 +43,7 @@ Item {
42 TouchGate {
43 TouchGate {
43 targetItem: surface
44 targetItem: surface
44 anchors.fill: root
45 anchors.fill: root
45− enabled: surface.enabled
46+ enabled: root.surface ? root.surface.enabled : false
@@ -50,6 +51,9 @@ Item {
50 target: root.surface
51 target: root.surface
51 // FIXME: I would rather not need to do this, but currently it doesn't get
52 // FIXME: I would rather not need to do this, but currently it doesn't get
52 // active focus without it and I don't know why.
53 // active focus without it and I don't know why.
54+ // Possibly because if an item get focus=true before it has a parent, once
55+ // it gets a parent QQuickWindow won't check its focus and update its activeFocus
56+ // accordingly. Unlike when you focus=true after the item already has a parent.
53 onFocusChanged: d.forceSurfaceActiveFocusIfReady();
57 onFocusChanged: d.forceSurfaceActiveFocusIfReady();
54 onParentChanged: d.forceSurfaceActiveFocusIfReady();
58 onParentChanged: d.forceSurfaceActiveFocusIfReady();
55 onEnabledChanged: d.forceSurfaceActiveFocusIfReady();
59 onEnabledChanged: d.forceSurfaceActiveFocusIfReady();