@@ -29,6 +29,7 @@ Item {
2929 onSurfaceChanged: {
3030 if (surface) {
3131 surface.parent = root;
32+ d.forceSurfaceActiveFocusIfReady();
3233 } else {
3334 hadSurface = true;
3435 }
@@ -42,7 +43,7 @@ Item {
4243 TouchGate {
4344 targetItem: surface
4445 anchors.fill: root
45− enabled: surface.enabled
46+ enabled: root.surface ? root.surface.enabled : false
4647 z: 2
4748 }
4849
@@ -50,6 +51,9 @@ Item {
5051 target: root.surface
5152 // FIXME: I would rather not need to do this, but currently it doesn't get
5253 // 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.
5357 onFocusChanged: d.forceSurfaceActiveFocusIfReady();
5458 onParentChanged: d.forceSurfaceActiveFocusIfReady();
5559 onEnabledChanged: d.forceSurfaceActiveFocusIfReady();