Skip to content

Commit

Permalink
if we change the clock area width, the trays need to be reconfigured …
Browse files Browse the repository at this point in the history
…(updated coordinates) to respond to clicks

git-svn-id: https://xpra.org/svn/Xpra/trunk@18736 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Mar 16, 2018
1 parent 628b959 commit 4ec1dbf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
8 changes: 7 additions & 1 deletion src/html5/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,13 @@ <h3>Version 2.3</h3>
var now = new Date().getTime();
var server_time = client.last_ping_server_time + (now - client.last_ping_local_time);
var date = new Date(server_time);
$("#clock_text").text(date.toLocaleDateString()+" "+date.toLocaleTimeString());
var clock_text = $("#clock_text");
var width = clock_text.width();
clock_text.text(date.toLocaleDateString()+" "+date.toLocaleTimeString());
if (width != clock_text.width()) {
//trays have been shifted left or right:
client.reconfigure_all_trays();
}
//try to land at the half-second point,
//so that we never miss displaying a second:
var delay = (1500-(server_time % 1000)) % 1000;
Expand Down
20 changes: 11 additions & 9 deletions src/html5/js/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1903,6 +1903,16 @@ XpraClient.prototype._tray_closed = function(win) {
ctx.debug("main", "tray closed (ignored)");
}

XpraClient.prototype.reconfigure_all_trays = function() {
for (var twid in this.id_to_window) {
var twin = this.id_to_window[twid];
if (twin && twin.tray) {
this.send_tray_configure(twid);
}
}
}


XpraClient.prototype._process_new_window = function(packet, ctx) {
ctx._new_window_common(packet, false);
}
Expand Down Expand Up @@ -1950,15 +1960,7 @@ XpraClient.prototype._process_lost_window = function(packet, ctx) {
console.log("lost window, was tray=", win.tray);
if (win.tray) {
//other trays may have moved:
for (var twid in ctx.id_to_window) {
console.log("testing", twid);
var twin = ctx.id_to_window[twid];
console.log("testing", twin);
if (twin && twin.tray) {
console.log("is tray!");
ctx.send_tray_configure(twid);
}
}
ctx.reconfigure_all_trays();
}
}
console.log("lost window", wid, ", remaining: ", Object.keys(ctx.id_to_window));
Expand Down

0 comments on commit 4ec1dbf

Please sign in to comment.