Skip to content
Snippets Groups Projects
Commit 19670b60 authored by Alexander Tuxen's avatar Alexander Tuxen Committed by Felix Gerking
Browse files

Improved Surface handling and debug output

Lots of cleanup to do but this should work as a demo/test
parent a68af4be
No related branches found
No related tags found
1 merge request!48Rework Compositor
......@@ -72,9 +72,5 @@ Item {
}
function setVisible(){
visible = true;
}
}
......@@ -126,6 +126,53 @@ WaylandCompositor {
console.log("Surface requested: client", client, "id", id, "version", version, "pid", client.processId);
}
function createShellSurfaceItem(shellSurface, moveItem, output) {
// ![parenting]
var parentSurfaceItem = output.viewsBySurface[shellSurface.parentSurface];
var parent = parentSurfaceItem || output.surfaceArea;
// ![parenting]
var item = chromeComponent.createObject(parent, {
"shellSurface": shellSurface,
"moveItem": moveItem,
"output": output
});
if (parentSurfaceItem) {
item.x += output.position.x;
item.y += output.position.y;
}
output.viewsBySurface[shellSurface.surface] = item;
return item;
}
function handleShellSurfaceCreated(shellSurface) {
var moveItem = moveItemComponent.createObject(rootItem, {
"x": screens.objectAt(0).position.x,
"y": screens.objectAt(0).position.y,
"width": Qt.binding(function() { return shellSurface.surface.width; }),
"height": Qt.binding(function() { return shellSurface.surface.height; })
});
//! [createShellSurfaceItems]
for (var i = 0; i < screens.count; ++i)
{
var item = createShellSurfaceItem(shellSurface, moveItem, screens.objectAt(i));
item.shellSurface.toplevel.sendFullscreen(Qt.size(1024, 600));
var show = (active_screen == i) ? true : false;
item.visible = show;
if (active_screen == i)
{
var surfaceOnScreen = ({ 'surface': item, 'screen': active_screen });
activeSurfaces.push(surfaceOnScreen);
}
}
//! [createShellSurfaceItems]
//createShellSurfaceItem(shellSurface, moveItem, screens.objectAt(active_screen));
}
/*
function createShellSurfaceItem(shellSurface, output) {
console.log("createShellSurfaceItem: Creating surface", shellSurface, "on output", output);
cleanUpApplist();
......@@ -141,6 +188,7 @@ WaylandCompositor {
var surfaceOnScreen = ({ 'surface': shellSurface, 'screen': active_screen });
activeSurfaces.push(surfaceOnScreen);
}
*/
function createIviSurfaceItem(iviSurface, output) {
console.log("createIviSurfaceItem: surface", iviSurface, "output", output);
......@@ -192,6 +240,8 @@ WaylandCompositor {
// =============================================
onSurfaceAboutToBeDestroyed: {
// Removing this seems to have fixed the crashes.
// no, it didn't.
cleanUpApplist();
//Also, with the new way to keep the applist clean of undefined objects, it is unnecessary.
/*
console.log("Surface will be destroyed", surface);
......@@ -244,8 +294,9 @@ WaylandCompositor {
console.log("found IVI Shell Surface", i, id, item.surface.shellSurface, item.surface.shellSurface.surface)
return item.surface;
}
else if ((item.surface.surface) && ( id === item.surface.surface.client.processId)) {
console.log("found XDG Shell Surface", i, id, item.surface)
else if ((item.surface.shellSurface) && ( id === item.surface.shellSurface.surface.client.processId)) {
//else if ((item.surface.surface) && ( id === item.surface.surface.client.processId)) {
console.log("found XDG Shell Surface", i, id, item.surface, "containing surface", item.surface.surface)
return item.surface;
}
}
......@@ -282,20 +333,33 @@ WaylandCompositor {
if( !surface ) return;
console.log("Move", surface, "to screen", screenid)
if (surface.shellSurface.iviId)
surface.parent = screens.objectAt(screenid).surfaceArea;
else
{
surface.visible = (active_screen === screenid) ? true : false;
}
updateScreenAssignment(surface, screenid);
}
function windowVisibility(windowid, show){
var surface = findSurfaceById(windowid)
if( !surface ) return;
if (surface.shellSurface){
console.log("Set visable to", show,"for", surface.shellSurface)
}
console.log("Set visable to", show,"for", surface)
console.log("Set visible to", show,"for", surface)
surface.visible = show
}
else if (surface.surface){
console.log("Set visible to", show,"for", surface.toplevel)
if (show)
surface.toplevel.sendFullscreen(surface.surface.size);
else
surface.toplevel.sendFullscreen(surface.surface.size);
surface.toplevel.setMinimized();
}
}
function onHideWindow(windowid){
console.log("Received a hideWindow Signal", windowid)
......@@ -311,12 +375,12 @@ WaylandCompositor {
console.log("Active surfaces:")
for (var i=0; i < activeSurfaces.length; i++) {
var item = activeSurfaces[i];
if (item.surface.surface) {
console.log("- Surface", i, item.surface, "pid", item.surface.surface.client.processId, "on screen", item.screen);
}
else if (item.surface.shellSurface) {
if (item.surface.shellSurface.iviId) {
console.log("- Surface", i, "iviId:", item.surface.shellSurface.iviId, item.surface, "on screen", item.screen);
}
else if (item.shellSurface) {
console.log("- Surface", i, item.shellSurface, "pid", item.surface.surface.client.processId, "on screen", item.screen);
}
}
}
function onGetScreen(windowid){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment