After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 680077 - Malformed boxpointer arrows
Malformed boxpointer arrows
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: st
3.5.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2012-07-17 09:19 UTC by Allan Day
Modified: 2012-09-06 19:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
ibus popup screenshot (21.49 KB, image/png)
2012-07-17 09:19 UTC, Allan Day
  Details
boxpointer: Ensure that the arrows are never obtuse angled (3.53 KB, patch)
2012-09-01 22:07 UTC, Debarshi Ray
none Details | Review
Screenshot with first compensation (17.19 KB, image/png)
2012-09-01 22:07 UTC, Debarshi Ray
  Details
boxpointer: Try to improve the worst-case shape of the arrows (6.72 KB, patch)
2012-09-01 22:08 UTC, Debarshi Ray
none Details | Review
Screenshot with second compensation (16.02 KB, image/png)
2012-09-01 22:08 UTC, Debarshi Ray
  Details
boxpointer: Always aim for an isosceles-angled arrow (10.29 KB, patch)
2012-09-02 12:30 UTC, Debarshi Ray
none Details | Review
boxpointer: Account for hanging actors (2.58 KB, patch)
2012-09-02 18:06 UTC, Debarshi Ray
rejected Details | Review
Striving for isosceles arrows, sometimes at the cost of the rounded corners (16.31 KB, image/png)
2012-09-03 12:46 UTC, Debarshi Ray
  Details
boxpointer: Avoid malformed boxpointer arrow (9.92 KB, patch)
2012-09-06 13:25 UTC, Debarshi Ray
reviewed Details | Review
boxpointer: Avoid malformed boxpointer arrow (11.38 KB, patch)
2012-09-06 17:04 UTC, Debarshi Ray
committed Details | Review

Description Allan Day 2012-07-17 09:19:24 UTC
Created attachment 218999 [details]
ibus popup screenshot

This happens when an object is close to the screen edge and the boxpointer cannot be placed close enough to it. The point of the arrow is draw close to the object and the pointer itself becomes stretched and distorted. You can see this in the power off menu in the login screen and in the new iBus suggestion popups (see screenshot).

A couple of recommendations here:

 * Reduce the horizontal padding between between the boxpointer and the screen edge.
 * Always ensure that the pointer is draw the same - it should have a fixed form that doesn't ever get distorted. If the pointer is a little way away from its parent then so be it.
Comment 1 Debarshi Ray 2012-09-01 22:07:09 UTC
Created attachment 223165 [details] [review]
boxpointer: Ensure that the arrows are never obtuse angled
Comment 2 Debarshi Ray 2012-09-01 22:07:49 UTC
Created attachment 223166 [details]
Screenshot with first compensation
Comment 3 Debarshi Ray 2012-09-01 22:08:30 UTC
Created attachment 223167 [details] [review]
boxpointer: Try to improve the worst-case shape of the arrows
Comment 4 Debarshi Ray 2012-09-01 22:08:59 UTC
Created attachment 223168 [details]
Screenshot with second compensation
Comment 5 Debarshi Ray 2012-09-01 22:10:54 UTC
In case it is not obvious, the second compensation/patch is meant to work with the first one. It is tries to improve over the first one.
Comment 6 Allan Day 2012-09-01 23:05:03 UTC
That's an improvement, but it's still a bit odd looking. Why not give the pointer a fixed form?
Comment 7 Debarshi Ray 2012-09-02 12:30:17 UTC
Created attachment 223197 [details] [review]
boxpointer: Always aim for an isosceles-angled arrow

If the arrow was going to be acute angled, but non-isosceles, we try to adjust
its direction and reduce the padding between the edge of the monitor by half,
effectively settling for a slightly inaccurate arrow.

If the arrow was going to be obtuse angled, we reduce the padding and adjust
its direction as above, and also skip the rounded corner to achieve an
isosceles-angled arrow. Currently this is only implemented for top and bottom
arrows because I could not find a scenario where this would be needed for left
and right arrows, which means I would not be able to test it. Such a need may
arise in the future, though.

For this to work, -arrow-border-radius should not be greater than half the
-arrow-base. Existing style classes satisfy this requirement.
Comment 8 Debarshi Ray 2012-09-02 18:06:09 UTC
Created attachment 223208 [details] [review]
boxpointer: Account for hanging actors

Reducing the padding from the edge of the monitor to preserve the
shape of the arrow can cause actors that are hanging out from the box
(eg., close buttons) to be clipped. We should have a way to accomodate
them.

Introducing -boxpointer-extra to specify the amount of extra space
that is needed. This is along the X axis when the arrow is at the top
or bottom, and is on the Y axis when the arrow is on the left or
right.
Comment 9 Debarshi Ray 2012-09-03 12:46:49 UTC
Created attachment 223291 [details]
Striving for isosceles arrows, sometimes at the cost of the rounded corners
Comment 10 Debarshi Ray 2012-09-06 11:05:39 UTC
Jimmac wants the arrows to be right-angled when the rounded corners are skipped:
https://raw.github.com/gnome-design-team/gnome-mockups/master/shell/bubble-arrow.png
Comment 11 Debarshi Ray 2012-09-06 13:25:06 UTC
Created attachment 223650 [details] [review]
boxpointer: Avoid malformed boxpointer arrow
Comment 12 Debarshi Ray 2012-09-06 13:25:49 UTC
Comment on attachment 223208 [details] [review]
boxpointer: Account for hanging actors

Withdrawing it for the time being because we do not adjust the padding any more.
Comment 13 Rui Matos 2012-09-06 14:43:09 UTC
Review of attachment 223650 [details] [review]:

Overall looks good. 2 comments:

- even if it's not used right now I think it doesn't hurt to implement this for arrows on the left and right side;

- we can at least fix one of the inaccuracies introduced here. This case:

       x
     |\____ 

we can just shift the whole box and keep the arrow form such that it actually points at x.

::: js/ui/boxpointer.js
@@ +457,3 @@
+
+        let halfBase = Math.floor(arrowBase/2);
+        let halfBorder = borderWidth / 2;

I think this would be a bit easier to read if you moved this hunk...

@@ +460,3 @@
         let halfMargin = margin / 2;
 
         let themeNode = this.actor.get_theme_node();

This was already here, but please remove this duplicated line. Either on this or other patch would be fine.

@@ +465,3 @@
 
+        let [x1, y1] = [halfBorder, halfBorder];
+        let [x2, y2] = [natWidth - halfBorder, natHeight - halfBorder];

... and this one...

@@ +501,3 @@
+        //     always isosceles.
+
+        let arrowOrigin;

... over here.
Comment 14 Debarshi Ray 2012-09-06 17:03:51 UTC
(In reply to comment #13)
> Review of attachment 223650 [details] [review]:
> 
> Overall looks good. 2 comments:
> 
> - even if it's not used right now I think it doesn't hurt to implement this
> for arrows on the left and right side;

Done.

> - we can at least fix one of the inaccuracies introduced here. This case:
> 
>        x
>      |\____ 

Done.

> ::: js/ui/boxpointer.js
> @@ +457,3 @@
> +
> +        let halfBase = Math.floor(arrowBase/2);
> +        let halfBorder = borderWidth / 2;
> 
> I think this would be a bit easier to read if you moved this hunk...

Done.

> @@ +460,3 @@
>          let halfMargin = margin / 2;
> 
>          let themeNode = this.actor.get_theme_node();
> 
> This was already here, but please remove this duplicated line. Either on this
> or other patch would be fine.

Done, in the same patch since we are already moving around things.

> @@ +465,3 @@
> 
> +        let [x1, y1] = [halfBorder, halfBorder];
> +        let [x2, y2] = [natWidth - halfBorder, natHeight - halfBorder];
> 
> ... and this one...

Done.
Comment 15 Debarshi Ray 2012-09-06 17:04:27 UTC
Created attachment 223670 [details] [review]
boxpointer: Avoid malformed boxpointer arrow
Comment 16 Rui Matos 2012-09-06 18:42:44 UTC
Review of attachment 223670 [details] [review]:

ACN with the comments below fixed.

::: js/ui/boxpointer.js
@@ +313,3 @@
         if (this._arrowSide == St.Side.TOP) {
+            if (skipTopLeft) {
+                cr.moveTo(x1, y1 + borderRadius);

Y here has to be (y2 - borderRadius) because in the end the bottom left arc ends there and we would end up without the vertical left line.

@@ +330,3 @@
 
+        if (!skipTopRight) {
+            // top-right corner

These comments are kind of needless now that we have these variables here. I think we can drop them.

@@ +458,1 @@
+        let halfMargin = margin / 2;

This can also move below.
Comment 17 Debarshi Ray 2012-09-06 19:00:20 UTC
(In reply to comment #16)
> Review of attachment 223670 [details] [review]:
> 
> ACN with the comments below fixed.
> 
> ::: js/ui/boxpointer.js
> @@ +313,3 @@
>          if (this._arrowSide == St.Side.TOP) {
> +            if (skipTopLeft) {
> +                cr.moveTo(x1, y1 + borderRadius);
> 
> Y here has to be (y2 - borderRadius) because in the end the bottom left arc
> ends there and we would end up without the vertical left line.

Thanks for spotting it. Fixed.

> @@ +330,3 @@
> 
> +        if (!skipTopRight) {
> +            // top-right corner
> 
> These comments are kind of needless now that we have these variables here. I
> think we can drop them.

Fixed.

> @@ +458,1 @@
> +        let halfMargin = margin / 2;
> 
> This can also move below.

Fixed.
Comment 18 Debarshi Ray 2012-09-06 19:00:57 UTC
commit 00f15c10754fc327802fdec9318b8a07491df7b4
Author: Debarshi Ray <debarshir@gnome.org>
Date:   Sat Sep 1 16:42:50 2012 +0200

    boxpointer: Avoid malformed boxpointer arrow
    
    If the arrow's origin is so close to the edge that the arrow will not
    be isosceles, we try to compensate as follows:
      - We skip the rounded corner and settle for a right angled arrow as
        as shown below.
        |\_____
        |
        |
      - If the arrow was going to be acute angled, we move the position of
        the box to maintain the arrow's accuracy.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=680077
Comment 19 Debarshi Ray 2012-09-06 19:01:08 UTC
commit 10da35cbef64441d0c92c831d5a651d7e447f253
Author: Debarshi Ray <debarshir@gnome.org>
Date:   Thu Sep 6 20:59:58 2012 +0200

    boxpointer: Clean up
    
    https://bugzilla.gnome.org/show_bug.cgi?id=680077