Skip to content

Commit

Permalink
#1557: center desktop windows on screen, change screen background colour
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@16159 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jul 2, 2017
1 parent f7db93d commit e7aad70
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/html5/css/client.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ html, body {
margin: 0;
overflow: hidden;
}

body.desktop {
background-color: #555;
}

div#connect_form {
display: none;
}
Expand Down Expand Up @@ -57,6 +62,11 @@ canvas {
padding: 0;
overflow: hidden; /* required for radius clip */
}
.window.desktop {
border-radius: 0;
box-shadow: none;
}

.window-NORMAL {
border-radius: 6px;
}
Expand Down
3 changes: 3 additions & 0 deletions src/html5/js/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1624,6 +1624,9 @@ XpraClient.prototype._process_hello = function(packet, ctx) {
}
}
ctx.server_is_desktop = Boolean(hello["desktop"]) || Boolean(hello["shadow"]);
if (ctx.server_is_desktop) {
jQuery("body").addClass("desktop");
}

ctx.remote_open_files = Boolean(hello["open-files"]);
ctx.remote_file_transfer = Boolean(hello["file-transfer"]);
Expand Down
14 changes: 13 additions & 1 deletion src/html5/js/Window.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ function XpraWindow(client, canvas_state, wid, x, y, w, h, metadata, override_re
}

if (this.client.server_is_desktop) {
jQuery(this.div).addClass("desktop");
this.resizable = false;
}
else if(this.override_redirect) {
Expand Down Expand Up @@ -273,6 +274,10 @@ XpraWindow.prototype.updateCanvasGeometry = function() {
XpraWindow.prototype.updateCSSGeometry = function() {
// set size of canvas
this.updateCanvasGeometry();
if (this.client.server_is_desktop) {
jQuery(this.div).position({of : jQuery("#screen")});
return;
}
// work out outer size
this.outerH = this.h + this.topoffset + this.bottomoffset;
this.outerW = this.w + this.leftoffset + this.rightoffset;
Expand Down Expand Up @@ -325,6 +330,13 @@ XpraWindow.prototype.getMouse = function(e) {
mbutton = Math.max(0, e.button)+1;
//show("getmouse: button="+mbutton+", which="+e.which+", button="+e.button);

if (this.client.server_is_desktop) {
//substract window offset since the desktop's top-left corner should be at 0,0:
var pos = jQuery(this.div).position()
mx -= pos.left;
my -= pos.top;
}

// We return a simple javascript object (a hash) with x and y defined
return {x: mx, y: my, button: mbutton};
};
Expand Down Expand Up @@ -425,7 +437,7 @@ XpraWindow.prototype.toString = function() {

XpraWindow.prototype.update_zindex = function() {
var z = 5000 + this.stacking_layer;
if (this.override_redirect) {
if (this.override_redirect || this.client.server_is_desktop) {
z = 15000;
}
else if (this.windowtype=="DROPDOWN" || this.windowtype=="TOOLTIP" ||
Expand Down

0 comments on commit e7aad70

Please sign in to comment.