Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kwin-tiling
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christian Bay
kwin-tiling
Commits
32d1cd95
Commit
32d1cd95
authored
11 years ago
by
Fabian Homborg
Browse files
Options
Downloads
Patches
Plain Diff
Put windows that reappear (e.g. unminimize) in the same tile
This appears to crash kwin quite a bit
parent
5d33dfb5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
contents/code/tile.js
+4
-0
4 additions, 0 deletions
contents/code/tile.js
contents/code/tilelist.js
+39
-71
39 additions, 71 deletions
contents/code/tilelist.js
contents/code/tiling.js
+20
-2
20 additions, 2 deletions
contents/code/tiling.js
with
63 additions
and
73 deletions
contents/code/tile.js
+
4
−
0
View file @
32d1cd95
...
...
@@ -285,3 +285,7 @@ Tile.prototype.addClient = function(client) {
print
(
err
,
"
in Tile.addClient
"
);
}
}
Tile
.
prototype
.
hasClient
=
function
(
client
)
{
return
(
this
.
clients
.
indexOf
(
client
)
>
-
1
);
}
This diff is collapsed.
Click to expand it.
contents/code/tilelist.js
+
39
−
71
View file @
32d1cd95
...
...
@@ -87,7 +87,7 @@ TileList.prototype.connectSignals = function(client) {
// We also have to connect other client signals here instead of in Tile
// because the tile of a client might change over time
var
getTile
=
function
(
client
)
{
return
self
.
t
ile
s
[
client
.
tiling_tileIndex
]
;
return
self
.
getT
ile
(
client
)
;
};
client
.
geometryShapeChanged
.
connect
(
function
()
{
var
tile
=
getTile
(
client
);
...
...
@@ -156,6 +156,7 @@ TileList.prototype.addClient = function(client) {
}
if
(
TileList
.
_isIgnored
(
client
))
{
client
.
tiling_tileIndex
=
-
1
;
client
.
tiling_floating
=
true
;
return
;
}
...
...
@@ -177,34 +178,17 @@ TileList.prototype.addClient = function(client) {
}
// Check whether the client is part of an existing tile
var
tileIndex
=
client
.
tiling_tileIndex
;
if
(
tileIndex
>=
0
&&
tileIndex
<
this
.
tiles
.
length
)
{
var
notInTiles
=
true
;
for
(
var
i
=
0
;
i
<
this
.
tiles
.
length
;
i
++
)
{
if
(
this
.
tiles
[
i
]
===
client
)
{
notInTiles
=
false
;
break
;
}
}
if
(
notInTiles
)
{
this
.
tiles
[
tileIndex
].
addClient
(
client
);
}
}
else
{
// If not, create a new tile
if
(
this
.
_indexWithClient
(
client
)
==
-
1
)
{
this
.
_addTile
(
client
);
}
}
client
.
tiling_floating
=
false
;
assert
(
client
.
tiling_tileIndex
>=
0
,
"
Client added with invalid tileIndex
"
);
};
TileList
.
prototype
.
retile
=
function
()
{
var
existingClients
=
workspace
.
clientList
();
var
self
=
this
;
existingClients
.
forEach
(
function
(
client
)
{
var
tileIndex
=
client
.
tiling_tileIndex
;
if
(
tileIndex
>=
0
&&
tileIndex
<
self
.
tiles
.
length
)
{
self
.
addClient
(
client
);
}
self
.
addClient
(
client
);
});
};
...
...
@@ -215,16 +199,14 @@ TileList.prototype.retile = function() {
* @return Tile in which the client is located.
*/
TileList
.
prototype
.
getTile
=
function
(
client
)
{
var
tileIndex
=
client
.
tiling_tileIndex
;
if
(
tileIndex
>=
0
&&
tileIndex
<
this
.
tiles
.
length
)
{
return
this
.
tiles
[
tileIndex
];
}
else
{
return
null
;
}
var
index
=
this
.
_indexWithClient
(
client
);
if
(
index
>
-
1
)
{
return
this
.
tiles
[
index
];
}
return
null
;
};
TileList
.
prototype
.
_onClientAdded
=
function
(
client
)
{
this
.
_identifyNewTiles
();
this
.
addClient
(
client
);
};
...
...
@@ -237,22 +219,23 @@ TileList.prototype._onClientRemoved = function(client) {
}
}
try
{
var
tileIndex
=
client
.
tiling_tileIndex
;
if
(
!
(
tileIndex
>=
0
&&
tileIndex
<
this
.
tiles
.
length
))
{
return
;
}
// Unset keepBelow because we set it when tiling
client
.
keepBelow
=
false
;
// Remove the client from its tile
var
tileIndex
=
this
.
_indexWithClient
(
client
);
var
tile
=
this
.
tiles
[
tileIndex
];
if
(
tile
.
clients
.
length
==
1
)
{
// Remove the tile if this was the last client in it
this
.
_removeTile
(
tileIndex
);
}
else
{
// Remove the client from its tile
tile
.
removeClient
(
client
);
if
(
tile
!=
null
)
{
if
(
tile
.
clients
.
length
==
1
)
{
// Remove the tile if this was the last client in it
this
.
_removeTile
(
tileIndex
);
}
else
{
// Remove the client from its tile
tile
.
removeClient
(
client
);
}
}
client
.
tiling_tileIndex
=
-
1
;
// Don't remove tileIndex, so we can move the window to its position in case it comes back (after minimize etc)
//client.tiling_tileIndex = - 1;
if
(
client
.
tiling_floating
==
true
)
{
client
.
noBorder
=
false
;
if
(
cactive
==
true
)
{
...
...
@@ -277,43 +260,28 @@ TileList.prototype._onClientTabGroupChanged = function(client) {
};
TileList
.
prototype
.
_addTile
=
function
(
client
)
{
var
newTile
=
new
Tile
(
client
,
this
.
tiles
.
length
)
var
tileIndex
=
this
.
tiles
.
length
;
if
(
client
.
tiling_tileIndex
>
-
1
)
{
tileIndex
=
client
.
tiling_tileIndex
;
}
var
newTile
=
new
Tile
(
client
,
tileIndex
);
this
.
tiles
.
push
(
newTile
);
this
.
tileAdded
.
emit
(
newTile
);
};
TileList
.
prototype
.
_removeTile
=
function
(
tileIndex
)
{
try
{
//
Remove the tile if this was the last client in it
//
Don't modify tileIndex here - this is a list of _all_ tiles, while tileIndex is the index on the desktop
var
tile
=
this
.
tiles
[
tileIndex
];
if
(
tileIndex
<
this
.
tiles
.
length
-
1
)
{
this
.
tiles
[
tileIndex
]
=
this
.
tiles
[
this
.
tiles
.
length
-
1
];
this
.
tiles
[
tileIndex
].
tileIndex
=
tileIndex
;
this
.
tiles
[
tileIndex
].
syncCustomProperties
();
if
(
tileIndex
>
-
1
)
{
this
.
tiles
.
splice
(
tileIndex
,
1
);
}
this
.
tileRemoved
.
emit
(
tile
);
this
.
tiles
.
length
--
;
}
catch
(
err
)
{
print
(
err
,
"
in TileList._removeTile
"
);
}
};
/**
* Updates the tile index on all clients in all existing tiles by synchronizing
* the tiling_tileIndex property of the group. Clients which do not belong to
* any existing tile will have this property set to null afterwards, while
* clients which belong to a tile have the correct tile index.
*
* This can only detect clients which are not in any tile, it does not detect
* client tab group changes! These shall be handled by removing the client from
* any tile in _onClientTabGroupChanged() first.
*/
TileList
.
prototype
.
_identifyNewTiles
=
function
()
{
this
.
tiles
.
forEach
(
function
(
tile
)
{
tile
.
syncCustomProperties
();
});
};
/**
* Returns true for clients which shall not be handled by the tiling script at
* all, e.g. the panel.
...
...
@@ -329,17 +297,17 @@ TileList._isIgnored = function(client) {
client
.
syncTabGroupFor
(
"
kwin_tiling_floats
"
,
true
);
return
true
;
}
if
(
client
.
dialog
)
{
return
true
;
}
if
(
client
.
splash
)
{
return
true
;
}
if
(
client
.
dock
)
{
return
true
;
}
if
(
client
.
specialWindow
==
true
)
{
return
true
;
}
return
false
;
};
TileList
.
prototype
.
_indexWithClient
=
function
(
client
)
{
for
(
i
=
0
;
i
<
this
.
tiles
.
length
;
i
++
)
{
if
(
this
.
tiles
[
i
].
hasClient
(
client
))
{
return
i
;
}
}
return
-
1
;
}
This diff is collapsed.
Click to expand it.
contents/code/tiling.js
+
20
−
2
View file @
32d1cd95
...
...
@@ -85,7 +85,16 @@ Tiling.prototype.addTile = function(tile, x, y) {
this
.
tiles
.
splice
(
index
,
0
,
tile
);
}
}
else
{
this
.
tiles
.
push
(
tile
);
if
(
tile
.
tileIndex
>
-
1
)
{
this
.
tiles
.
splice
(
tile
.
tileIndex
,
0
,
tile
);
for
(
i
=
0
;
i
<
this
.
tiles
.
length
;
i
++
)
{
this
.
tiles
[
i
].
tileIndex
=
i
;
this
.
tiles
[
i
].
syncCustomProperties
();
}
}
else
{
tile
.
tileIndex
=
this
.
tiles
.
length
;
this
.
tiles
.
push
(
tile
);
}
}
this
.
_updateAllTiles
();
// TODO: Register tile callbacks
...
...
@@ -99,6 +108,11 @@ Tiling.prototype.removeTile = function(tile) {
var
tileIndex
=
this
.
tiles
.
indexOf
(
tile
);
this
.
tiles
.
splice
(
tileIndex
,
1
);
this
.
layout
.
removeTile
(
tileIndex
);
// Correct tileIndex
for
(
i
=
0
;
i
<
this
.
tiles
.
length
;
i
++
)
{
this
.
tiles
[
i
].
tileIndex
=
i
;
this
.
tiles
[
i
].
syncCustomProperties
();
}
// TODO: Unregister tile callbacks
this
.
_updateAllTiles
();
}
catch
(
err
)
{
...
...
@@ -114,6 +128,10 @@ Tiling.prototype.swapTiles = function(tile1, tile2) {
var
index2
=
this
.
tiles
.
indexOf
(
tile2
);
this
.
tiles
[
index1
]
=
tile2
;
this
.
tiles
[
index2
]
=
tile1
;
this
.
tiles
[
index1
].
tileIndex
=
index1
;
this
.
tiles
[
index2
].
tileIndex
=
index2
;
this
.
tiles
[
index1
].
syncCustomProperties
();
this
.
tiles
[
index2
].
syncCustomProperties
();
this
.
_updateAllTiles
();
}
else
if
(
tile1
.
_moving
==
false
)
{
this
.
_updateAllTiles
();
...
...
@@ -237,7 +255,7 @@ Tiling.prototype.getAdjacentTile = function(from, direction, directOnly) {
Tiling
.
prototype
.
resizeTile
=
function
(
tile
){
try
{
if
(
tile
!=
null
)
{
var
tileIndex
=
t
his
.
tile
s
.
i
ndex
Of
(
tile
)
;
var
tileIndex
=
t
ile
.
tile
I
ndex
;
var
client
=
tile
.
clients
[
0
];
this
.
layout
.
resizeTile
(
tileIndex
,
client
.
geometry
);
this
.
_updateAllTiles
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment