boxpointer: Handle non-widget source actors

There is no convincing reason why source actors must be widgets,
so lift that restriction.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1903>
This commit is contained in:
Florian Müllner 2021-06-29 20:13:00 +02:00
parent 006d206f98
commit 16d3718735

View File

@ -464,8 +464,10 @@ var BoxPointer = GObject.registerClass({
this._workArea = Main.layoutManager.getWorkAreaForMonitor(monitorIndex); this._workArea = Main.layoutManager.getWorkAreaForMonitor(monitorIndex);
// Position correctly relative to the sourceActor // Position correctly relative to the sourceActor
let sourceNode = sourceActor.get_theme_node(); const sourceAllocation = sourceActor.get_allocation_box();
let sourceContentBox = sourceNode.get_content_box(sourceActor.get_allocation_box()); const sourceContentBox = sourceActor instanceof St.Widget
? sourceActor.get_theme_node().get_content_box(sourceAllocation)
: sourceAllocation;
let sourceTopLeft = this._sourceExtents.get_top_left(); let sourceTopLeft = this._sourceExtents.get_top_left();
let sourceBottomRight = this._sourceExtents.get_bottom_right(); let sourceBottomRight = this._sourceExtents.get_bottom_right();
let sourceCenterX = sourceTopLeft.x + sourceContentBox.x1 + (sourceContentBox.x2 - sourceContentBox.x1) * this._sourceAlignment; let sourceCenterX = sourceTopLeft.x + sourceContentBox.x1 + (sourceContentBox.x2 - sourceContentBox.x1) * this._sourceAlignment;