Merge lp:~adam-barancsuk/unity/fix-740515 into lp:unity

Proposed by brncsk
Status: Rejected
Rejected by: Alex Launi
Proposed branch: lp:~adam-barancsuk/unity/fix-740515
Merge into: lp:unity
Diff against target: 43 lines (+6/-5)
1 file modified
src/WindowButtons.cpp (+6/-5)
To merge this branch: bzr merge lp:~adam-barancsuk/unity/fix-740515
Reviewer Review Type Date Requested Status
Sam Spilsbury (community) Needs Information
Review via email: mp+60206@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

I can see how this implementation fixes the problem, but there are some weird things that you do in the implementation that don't make sense to me.

First of all, there is a hardcoding of the view height to 24, which could be a bad thing if we ever made the panel larger for a11y reasons. Also, you're stacking the widget from the top of the view container down, which means there's essentially going to be a larger "dead area" at the bottom of the panel.

I think a better idea here would be to stack the object in the center of the panel (that way it grows from the center if the panel was to get larger) and set it's view height to the height of the panel. That way, whenever we get an input event there, it will always go to the button.

review: Needs Information
Revision history for this message
Alex Launi (alexlauni) wrote :

Rejecting since this appears to be stale, if the branch gets updated as per sam's review please submit a new merge!

Unmerged revisions

1186. By brncsk

Fixing bug #740515.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/WindowButtons.cpp'
2--- src/WindowButtons.cpp 2011-04-06 17:53:41 +0000
3+++ src/WindowButtons.cpp 2011-05-06 15:34:00 +0000
4@@ -57,7 +57,7 @@
5 nux::Geometry geo = GetGeometry ();
6 nux::BaseTexture *tex;
7 nux::TexCoordXForm texxform;
8-
9+
10 GfxContext.PushClippingRectangle (geo);
11
12 if (HasMouseFocus ())
13@@ -78,9 +78,9 @@
14 GfxContext.GetRenderStates ().SetColorMask (true, true, true, true);
15 if (tex)
16 GfxContext.QRP_1Tex (geo.x,
17- geo.y,
18+ (geo.height - tex->GetHeight ()) / 2,
19 (float)geo.width,
20- (float)geo.height,
21+ tex->GetHeight (),
22 tex->GetDeviceTexture (),
23 texxform,
24 nux::Colors::White);
25@@ -104,7 +104,8 @@
26 _pressed_tex = style->GetWindowButton (_type, PanelStyle::WINDOW_STATE_PRESSED);
27
28 if (_normal_tex)
29- SetMinMaxSize (_normal_tex->GetWidth (), _normal_tex->GetHeight ());
30+ // SetMinMaxSize (_normal_tex->GetWidth (), _normal_tex->GetHeight ());
31+ SetMinMaxSize (_normal_tex->GetWidth (), 24);
32
33 QueueDraw ();
34 }
35@@ -123,7 +124,7 @@
36 WindowButton *but;
37
38 but = new WindowButton (PanelStyle::WINDOW_BUTTON_CLOSE);
39- AddView (but, 0, nux::eCenter, nux::eFix);
40+ AddView (but, 0, nux::eAbove, nux::eFix);
41 but->sigClick.connect (sigc::mem_fun (this, &WindowButtons::OnCloseClicked));
42 but->OnMouseEnter.connect (sigc::mem_fun (this, &WindowButtons::RecvMouseEnter));
43 but->OnMouseLeave.connect (sigc::mem_fun (this, &WindowButtons::RecvMouseLeave));