Merge lp:~tigrangab/granite/popover_fix into lp:~elementary-pantheon/granite/granite

Proposed by Tigran Gabrielyan
Status: Merged
Approved by: David Gomes
Approved revision: 626
Merged at revision: 628
Proposed branch: lp:~tigrangab/granite/popover_fix
Merge into: lp:~elementary-pantheon/granite/granite
Diff against target: 19 lines (+2/-1)
1 file modified
lib/Widgets/PopOver.vala (+2/-1)
To merge this branch: bzr merge lp:~tigrangab/granite/popover_fix
Reviewer Review Type Date Requested Status
David Gomes (community) Approve
Review via email: mp+184027@code.launchpad.net

Commit message

popover: Added a NONE to the position enum.

Description of the change

Since the default pop position is set to TOPRIGHT so the condition if (old_pos != pos) { is not met and compute_shadow not called. I added a NONE enum to use as the default value.

To post a comment you must log in.
Revision history for this message
David Gomes (davidgomes) wrote :

>a bit carried away fixing code style issues
I can tell, each branch has its own goal. Therefore, this branch should only fix the popover issue and you should then submit another branch with code style issues.

Besides, I never used PopOvers and unless somebody who has understands this branch and reviews it for me, I'll have to review it. Thus, I'd prefer if you explained the issue more elaboratedly because I don't really understand, thank you:

>Since the default pop position is set to TOPRIGHT so the condition if (old_pos != pos) { is not met and compute_shadow not called.

review: Needs Fixing
lp:~tigrangab/granite/popover_fix updated
626. By Tigran Gabrielyan

Fix arrow position in popover when the position needs to be top right

Revision history for this message
Tigran Gabrielyan (tigrangab) wrote :

Ok. So the way it was at first was "PopPosition pos = PopPosition.TOPRIGHT;"

Now inside of compute_pop_position it sets "var old_pos = pos;"
So old_pos is now set to TOPRIGHT.

At the end of compute_pop_position after it calculates the new position, it checks

if (old_pos != pos) {
     compute_shadow (get_allocated_width (), get_allocated_height ());
}

If the "pos" calculated is TOPRIGHT, compute_shadow won't be called since old_pos is set to TOPRIGHT initially and the old_pos = pos.

This causes the arrow to show bottom left position (arrow_up is default false and the offset isn't drawn to the right because compute_shadow isn't called).

Revision history for this message
David Gomes (davidgomes) wrote :

I get it, it's a good fix (logically), but is it reproducable in any way so I can just confirm it fixes the issue? (bureaucracy)

If this is an issue you noted that could happen but is not really happening anywhere, I'll merge it anyway, I like this.

Anyway I'm totally +1 on the code.

review: Approve
Revision history for this message
Tigran Gabrielyan (tigrangab) wrote :

You can try my RTL branch on slingshot with and without this. In Slingshot you can add setDefaultDirection(Gtk.TextDirection.RTL); in the constructor so you dont have to change your language. You'll see the arrow is in the bottom left.

Revision history for this message
David Gomes (davidgomes) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/Widgets/PopOver.vala'
2--- lib/Widgets/PopOver.vala 2013-03-20 15:42:25 +0000
3+++ lib/Widgets/PopOver.vala 2013-09-06 20:20:34 +0000
4@@ -52,6 +52,7 @@
5 */
6 public enum PopPosition
7 {
8+ NONE,
9 TOPLEFT,
10 TOPRIGHT,
11 BOTTOMLEFT,
12@@ -64,7 +65,7 @@
13 }
14 """;
15
16- PopPosition pos = PopPosition.TOPRIGHT;
17+ PopPosition pos = PopPosition.NONE;
18 protected bool arrow_up = false;
19 protected double arrow_offset = 35.0;
20

Subscribers

People subscribed via source and target branches