open-trade 2021-12-22 14:28:08 +08:00
parent b6feaa695f
commit 334c94ceb3
3 changed files with 12 additions and 5 deletions

View File

@ -311,3 +311,10 @@ function Progress()
this.value = "";
}
function isReasonableSize(r) {
var x = r[0];
var y = r[1];
return !(x < -3200 || x > 3200 || y < -3200 || y > 3200);
}

View File

@ -708,10 +708,10 @@ function self.closing() {
function self.ready() {
var r = handler.get_size();
if (r[2] == 0) {
centerize(800, 600);
} else {
if (isReasonableSize(r) && r[2] > 0) {
view.move(r[0], r[1], r[2], r[3]);
} else {
centerize(800, 600);
}
if (!handler.get_remote_id()) {
view.focus = $(#remote_id);

View File

@ -396,7 +396,7 @@ function self.ready() {
var h = 640;
if (is_file_transfer || is_port_forward) {
var r = handler.get_size();
if (r[0] > 0) {
if (isReasonableSize(r) && r[2] > 0) {
view.move(r[0], r[1], r[2], r[3]);
} else {
centerize(w, h);
@ -418,7 +418,7 @@ handler.adaptSize = function() {
var (fx, fy, fw, fh) = view.screenBox(#frame, #rectw);
if (is_osx) workarea_offset = sy;
var r = handler.get_size();
if (r[2] > 0) {
if (isReasonableSize(r) && r[2] > 0) {
if (r[2] >= fw && r[3] >= fh && !is_linux) {
view.windowState = View.WINDOW_FULL_SCREEN;
stdout.println("Initialize to full screen");