mirror of
https://github.com/esjeon/krohnkite.git
synced 2024-10-04 07:18:09 +03:00
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:
parent
0c36785851
commit
87d96833b8
@ -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
4
src/qt.d.ts
vendored
@ -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;
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user