boxpointer: Use the right source center for the arrow pointing

Point the arrow to the center of the sourceActor's content box, rather
than its allocation, in case it has asymmetric padding (as the
rightmost message tray summary item does).

https://bugzilla.gnome.org/show_bug.cgi?id=641728
This commit is contained in:
Sardem FF7 2011-02-02 23:38:55 +01:00 committed by Dan Winship
parent 70dd9c9d3d
commit c705b64d67
2 changed files with 5 additions and 2 deletions

View File

@ -309,9 +309,12 @@ BoxPointer.prototype = {
this.actor.show(); this.actor.show();
// Position correctly relative to the sourceActor // Position correctly relative to the sourceActor
let sourceNode = sourceActor.get_theme_node();
let sourceContentBox = sourceNode.get_content_box(sourceActor.get_allocation_box());
let [sourceX, sourceY] = sourceActor.get_transformed_position(); let [sourceX, sourceY] = sourceActor.get_transformed_position();
let [sourceWidth, sourceHeight] = sourceActor.get_transformed_size(); let [sourceWidth, sourceHeight] = sourceActor.get_transformed_size();
let [sourceCenterX, sourceCenterY] = [sourceX + (sourceWidth / 2), sourceY + (sourceHeight / 2)]; let sourceCenterX = sourceX + sourceContentBox.x1 + (sourceContentBox.x2 - sourceContentBox.x1) / 2;
let sourceCenterY = sourceY + sourceContentBox.y1 + (sourceContentBox.y2 - sourceContentBox.y1) / 2;
let [minWidth, minHeight, natWidth, natHeight] = this.actor.get_preferred_size(); let [minWidth, minHeight, natWidth, natHeight] = this.actor.get_preferred_size();
// We also want to keep it onscreen, and separated from the // We also want to keep it onscreen, and separated from the

View File

@ -3184,7 +3184,7 @@ st_theme_node_adjust_preferred_height (StThemeNode *node,
* st_theme_node_get_content_box: * st_theme_node_get_content_box:
* @node: a #StThemeNode * @node: a #StThemeNode
* @allocation: the box allocated to a #ClutterAlctor * @allocation: the box allocated to a #ClutterAlctor
* @content_box: computed box occupied by the actor's content * @content_box: (out): computed box occupied by the actor's content
* *
* Gets the box within an actor's allocation that contents the content * Gets the box within an actor's allocation that contents the content
* of an actor (excluding borders and padding). This is a convenience function * of an actor (excluding borders and padding). This is a convenience function