[gnome-shell] boxpointer: Trigger a relayout when setting position
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] boxpointer: Trigger a relayout when setting position
- Date: Mon, 17 Jun 2019 15:54:05 +0000 (UTC)
commit cb4c0d32c060d0f5851327782f36aa60b2393153
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date: Mon Jun 17 12:31:48 2019 +0200
boxpointer: Trigger a relayout when setting position
Since the repositioning is now done during allocation, we can just queue
a relayout when setting the boxpointer positioning via the source actor.
As per this _relayout() and _updateFlip now needs to be called during allocation
only and with an allocation box set.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/576
js/ui/boxpointer.js | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
---
diff --git a/js/ui/boxpointer.js b/js/ui/boxpointer.js
index 2f4975a29..3c704d2d3 100644
--- a/js/ui/boxpointer.js
+++ b/js/ui/boxpointer.js
@@ -455,10 +455,6 @@ var BoxPointer = GObject.registerClass({
}
setPosition(sourceActor, alignment) {
- // We need to show it now to force an allocation,
- // so that we can query the correct size.
- this.show();
-
if (!this._sourceActor || sourceActor != this._sourceActor) {
if (this._sourceActorDestroyId) {
this._sourceActor.disconnect(this._sourceActorDestroyId);
@@ -474,13 +470,10 @@ var BoxPointer = GObject.registerClass({
})
}
}
- this._arrowAlignment = alignment;
- if (!this._sourceActor)
- return;
+ this._arrowAlignment = alignment;
- this._reposition();
- this._updateFlip();
+ this.queue_relayout();
}
setSourceAlignment(alignment) {
@@ -605,14 +598,8 @@ var BoxPointer = GObject.registerClass({
parent = parent.get_parent();
}
- x = Math.floor(x);
- y = Math.floor(y);
-
// Actually set the position
- if (!allocationBox)
- this.set_position(x, y);
- else
- allocationBox.set_origin(x, y);
+ allocationBox.set_origin(Math.floor(x), Math.floor(y));
}
// @origin: Coordinate specifying middle of the arrow, along
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]