Skip to content

Commit

Permalink
smarter window placement, add space at the top for the top-bar
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@18206 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jan 30, 2018
1 parent c044256 commit 2922d4c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/html5/css/client.css
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ div.windowinfocus {
position: absolute;
left: auto;
right: 0;
top: 0;
top: 96px;
bottom: auto;
width: 600px;
height: auto;
Expand Down
15 changes: 15 additions & 0 deletions src/html5/js/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,21 @@ XpraClient.prototype._new_window_common = function(packet, override_redirect) {
var client_properties = {}
if (packet.length>=8)
client_properties = packet[7];
if (x==0 && y==0 && !metadata["set-initial-position"]) {
//find a good position for it
var l = Object.keys(this.id_to_window).length;
if (l==0) {
//first window: center it
x = Math.round((this.desktop_width-w)/2);
if (w<this.desktop_height) {
y = Math.round((this.desktop_height-h)/2);
}
}
else {
x = Math.min(l*10, Math.max(0, this.desktop_width-100));
y = 96;
}
}
this._new_window(wid, x, y, w, h, metadata, override_redirect, client_properties)
this._new_ui_event();
}
Expand Down

0 comments on commit 2922d4c

Please sign in to comment.