assign QRect to client.geometry

Instead of updating fields of `client.geometry` one by one, assign a
whole new `QRect` instance. This prevents race condition caused by a
series of partial updates.

Addresses bug #13.
This commit is contained in:
Eon S. Jeon 2018-12-12 08:33:39 +09:00
parent 0c36785851
commit 87d96833b8
3 changed files with 9 additions and 1 deletions

View File

@ -82,6 +82,10 @@ class Rect implements IRect {
this.x = other.x;
this.y = other.y;
}
public toQRect(): QRect {
return Qt.rect(this.x, this.y, this.width, this.height);
}
}
function clip(min: number, value: number, max: number): number {

4
src/qt.d.ts vendored
View File

@ -44,4 +44,8 @@ interface QQmlTimer {
stop(): void;
}
declare namespace Qt {
function rect(x: number, y: number, width: number, height: number): QRect;
}
declare var jiggleTimer: QQmlTimer;

View File

@ -104,7 +104,7 @@ class Tile {
this.geometry.width = clip(this.client.minSize.width , this.geometry.width , this.client.maxSize.width );
this.geometry.height = clip(this.client.minSize.height, this.geometry.height, this.client.maxSize.height);
this.geometry.copyTo(this.client.geometry);
this.client.geometry = this.geometry.toQRect();
}
public isVisible(screenId: number): boolean {