Skip to content

Commit

Permalink
Improve window handling
Browse files Browse the repository at this point in the history
When starting an application in the minimized state we still need to
accept the window, but reparent it to a dummy item instead of pushing it
into the window stack. This is achieved by extending the
applicationSurfaceReady signal with a isMinimized property.

Also use the new isClosing property of the application manager to
identify closing windows. This is needed to make sure we only raise
windows which are in a usable state.

Change-Id: I0a5d544576859024b3f33e0814e72707bc692621
Reviewed-by: Nedim Hadzic <[email protected]>
Reviewed-by: Erik Botö <[email protected]>
  • Loading branch information
Gagi2k committed Oct 5, 2016
1 parent d48bacf commit c9d5103
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
17 changes: 9 additions & 8 deletions imports/system/models/ApplicationManagerInterface.qml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ QtObject {
}
}

signal applicationSurfaceReady(Item item)
signal applicationSurfaceReady(Item item, bool isMinimized)
signal releaseApplicationSurface()

// Cluster signals
Expand All @@ -81,12 +81,13 @@ QtObject {

var acceptWindow = true;
var appID = WindowManager.get(index).applicationId;
var isMinimized = false;

if (isInWidgetState) {
if (ApplicationManager.get(appID).categories[0] === "navigation") {
root.mapWidget = item
}
acceptWindow = false
return
}
else if (isClusterWidget) {
if (!Style.withCluster) {
Expand All @@ -99,7 +100,7 @@ QtObject {
else if (ApplicationManager.get(appID).categories[0] === "media") {
root.clusterWidgetReady("media", item)
}
acceptWindow = false
return
}
} else {

Expand All @@ -110,18 +111,18 @@ QtObject {

for (i = 0; i < root.minimizedItems.length; ++i) {
if (appID === root.minimizedItems[i]) {
acceptWindow = false;
root.minimizedItems.pop(appID)
isMinimized = true;
break
}
}
}

if (acceptWindow) {
root.windowItem = item
WindowManager.setWindowProperty(item, "visibility", true)
WindowManager.setWindowProperty(item, "visibility", !isMinimized)

root.applicationSurfaceReady(item)
root.applicationSurfaceReady(item, isMinimized)
} else {
// If nobody feels responsible for this window, we need to at least give it a
// parent, to not block the client process which would wait for result of the
Expand Down Expand Up @@ -179,7 +180,7 @@ QtObject {
print(":::LaunchController::: WindowManager:raiseApplicaitonWindow" + appId + " " + WindowManager.count)
root.activeAppId = appId
for (var i = 0; i < WindowManager.count; i++) {
if (WindowManager.get(i).applicationId === appId) {
if (!WindowManager.get(i).isClosing && WindowManager.get(i).applicationId === appId) {
var item = WindowManager.get(i).windowItem
print(":::LaunchController::: App found. Running the app " + appId + " Item: " + item)
var isWidget = (WindowManager.windowProperty(item, "windowType") === "widget")
Expand All @@ -191,7 +192,7 @@ QtObject {
if (!isMapWidget && !isClusterWidget) {
WindowManager.setWindowProperty(item, "visibility", true)
root.windowItem = item
root.applicationSurfaceReady(item)
root.applicationSurfaceReady(item, false)
break
}
}
Expand Down
8 changes: 7 additions & 1 deletion sysui/LaunchController.qml
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,16 @@ StackView {
target: ApplicationManagerInterface

onApplicationSurfaceReady: {
root.push(item)
if (isMinimized)
item.parent = dummyitem
else
root.push(item)
}

onReleaseApplicationSurface: {
if (root.depth <= 1)
return;

root.pop(null)
}
}
Expand Down

0 comments on commit c9d5103

Please sign in to comment.