Merge lp:~gordallott/unity/fix-reflections into lp:unity

Proposed by Gord Allott
Status: Merged
Merged at revision: 1608
Proposed branch: lp:~gordallott/unity/fix-reflections
Merge into: lp:unity
Diff against target: 144 lines (+37/-12)
5 files modified
plugins/unityshell/src/DashView.cpp (+7/-5)
plugins/unityshell/src/ResultViewGrid.cpp (+19/-7)
plugins/unityshell/src/ResultViewGrid.h (+6/-0)
plugins/unityshell/src/UBusMessages.h (+2/-0)
tests/CMakeLists.txt (+3/-0)
To merge this branch: bzr merge lp:~gordallott/unity/fix-reflections
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Andrea Cimitan (community) Approve
Review via email: mp+76536@code.launchpad.net

Description of the change

fixes the dash reflections, they were based on the basewindow size but at some point the basewindow size got increased to the size of the maximised dash at all times, which threw the reflections off.

this is a crappy way to fix this, we'll need something better in P

To post a comment you must log in.
Revision history for this message
Andrea Cimitan (cimi) wrote :

Coding wise, I can't see anything wrong. If the math and the threshold you're using to calculate the offset are right, that's a +1 from me.

review: Approve
Revision history for this message
Jason Smith (jassmith) wrote :

Works fine but the effect is VERY subtle. I wonder if it shouldn't be exagerated a bit more.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/unityshell/src/DashView.cpp'
--- plugins/unityshell/src/DashView.cpp 2011-09-21 20:22:09 +0000
+++ plugins/unityshell/src/DashView.cpp 2011-09-22 10:00:29 +0000
@@ -174,6 +174,8 @@
174 // Minus the padding that gets added to the left174 // Minus the padding that gets added to the left
175 style->SetDefaultNColumns(floorf((content_geo_.width - 32)/ (float)style->GetTileWidth()));175 style->SetDefaultNColumns(floorf((content_geo_.width - 32)/ (float)style->GetTileWidth()));
176176
177 ubus_manager_.SendMessage(UBUS_DASH_SIZE_CHANGED, g_variant_new("(ii)", content_geo_.width, content_geo_.height));
178
177 QueueDraw();179 QueueDraw();
178}180}
179181
@@ -388,8 +390,8 @@
388 gfx_context.PushClippingRectangle(bg_clip);390 gfx_context.PushClippingRectangle(bg_clip);
389391
390 gfx_context.GetRenderStates().SetBlend(false);392 gfx_context.GetRenderStates().SetBlend(false);
391 gfx_context.QRP_1Tex (content_geo_.x, content_geo_.y, 393 gfx_context.QRP_1Tex (content_geo_.x, content_geo_.y,
392 content_geo_.width, content_geo_.height, 394 content_geo_.width, content_geo_.height,
393 bg_blur_texture_, texxform_absolute_bg, color::White);395 bg_blur_texture_, texxform_absolute_bg, color::White);
394 gPainter.PopBackground();396 gPainter.PopBackground();
395397
@@ -411,10 +413,10 @@
411 gfx_context.GetRenderStates().SetColorMask(true, true, true, false);413 gfx_context.GetRenderStates().SetColorMask(true, true, true, false);
412 gfx_context.GetRenderStates().SetBlend(true, GL_DST_COLOR, GL_ONE);414 gfx_context.GetRenderStates().SetBlend(true, GL_DST_COLOR, GL_ONE);
413415
414 gfx_context.QRP_1Tex (content_geo_.x, content_geo_.y, 416 gfx_context.QRP_1Tex (content_geo_.x, content_geo_.y,
415 content_geo_.width, content_geo_.height, 417 content_geo_.width, content_geo_.height,
416 bg_shine_texture_, texxform_absolute_bg, color::White);418 bg_shine_texture_, texxform_absolute_bg, color::White);
417 419
418420
419 // Make round corners421 // Make round corners
420 nux::ROPConfig rop;422 nux::ROPConfig rop;
421423
=== modified file 'plugins/unityshell/src/ResultViewGrid.cpp'
--- plugins/unityshell/src/ResultViewGrid.cpp 2011-09-21 11:25:04 +0000
+++ plugins/unityshell/src/ResultViewGrid.cpp 2011-09-22 10:00:29 +0000
@@ -57,6 +57,8 @@
57 , lazy_load_handle_(0)57 , lazy_load_handle_(0)
58 , last_mouse_down_x_(-1)58 , last_mouse_down_x_(-1)
59 , last_mouse_down_y_(-1)59 , last_mouse_down_y_(-1)
60 , recorded_dash_width_(-1)
61 , recorded_dash_height_(-1)
60{62{
61 auto needredraw_lambda = [&](int value)63 auto needredraw_lambda = [&](int value)
62 {64 {
@@ -84,6 +86,12 @@
84 NeedRedraw();86 NeedRedraw();
85 });87 });
8688
89 ubus_.RegisterInterest(UBUS_DASH_SIZE_CHANGED, [this] (GVariant* data) {
90 // on dash size changed, we update our stored values, this sucks
91 //FIXME in P - make dash size the size of our dash not the entire screen
92 g_variant_get (data, "(ii)", &recorded_dash_width_, &recorded_dash_height_);
93 });
94
87 SetDndEnabled(true, false);95 SetDndEnabled(true, false);
88 NeedRedraw();96 NeedRedraw();
89}97}
@@ -559,7 +567,6 @@
559 uint row_size = renderer_->height + vertical_spacing;567 uint row_size = renderer_->height + vertical_spacing;
560568
561 int y_position = padding + GetGeometry().y;569 int y_position = padding + GetGeometry().y;
562 nux::Area* top_level_parent = GetToplevel();
563570
564 ResultListBounds visible_bounds = GetVisableResults();571 ResultListBounds visible_bounds = GetVisableResults();
565572
@@ -590,12 +597,17 @@
590 state = ResultRenderer::RESULT_RENDERER_ACTIVE;597 state = ResultRenderer::RESULT_RENDERER_ACTIVE;
591 }598 }
592599
593 int half_width = top_level_parent->GetGeometry().width / 2;600 int half_width = recorded_dash_width_ / 2;
594 // FIXME - we assume the height of the viewport is 600601 int half_height = recorded_dash_height_;
595 int half_height = top_level_parent->GetGeometry().height;602
596603 int offset_x = MAX(MIN((x_position - half_width) / (half_width / 10), 5), -5);
597 int offset_x = (x_position - half_width) / (half_width / 10);604 int offset_y = MAX(MIN(((y_position + absolute_y) - half_height) / (half_height / 10), 5), -5);
598 int offset_y = ((y_position + absolute_y) - half_height) / (half_height / 10);605
606 if (recorded_dash_width_ < 1 || recorded_dash_height_ < 1)
607 {
608 offset_x = 0;
609 offset_y = 0;
610 }
599 nux::Geometry render_geo(x_position, y_position, renderer_->width, renderer_->height);611 nux::Geometry render_geo(x_position, y_position, renderer_->width, renderer_->height);
600 renderer_->Render(GfxContext, results_[index], state, render_geo, offset_x, offset_y);612 renderer_->Render(GfxContext, results_[index], state, render_geo, offset_x, offset_y);
601613
602614
=== modified file 'plugins/unityshell/src/ResultViewGrid.h'
--- plugins/unityshell/src/ResultViewGrid.h 2011-09-19 15:12:23 +0000
+++ plugins/unityshell/src/ResultViewGrid.h 2011-09-22 10:00:29 +0000
@@ -27,6 +27,7 @@
2727
28#include <UnityCore/Categories.h>28#include <UnityCore/Categories.h>
29#include "ResultView.h"29#include "ResultView.h"
30#include "UBusWrapper.h"
3031
31namespace unity32namespace unity
32{33{
@@ -100,6 +101,11 @@
100 std::string current_drag_uri_;101 std::string current_drag_uri_;
101 std::string current_drag_icon_name_;102 std::string current_drag_icon_name_;
102103
104 int recorded_dash_width_;
105 int recorded_dash_height_;
106
107 UBusManager ubus_;
108
103};109};
104110
105}111}
106112
=== modified file 'plugins/unityshell/src/UBusMessages.h'
--- plugins/unityshell/src/UBusMessages.h 2011-09-05 14:00:26 +0000
+++ plugins/unityshell/src/UBusMessages.h 2011-09-22 10:00:29 +0000
@@ -67,4 +67,6 @@
67#define UBUS_BACKGROUND_COLOR_CHANGED "BACKGROUND_COLOR_CHANGED"67#define UBUS_BACKGROUND_COLOR_CHANGED "BACKGROUND_COLOR_CHANGED"
68#define UBUS_BACKGROUND_REQUEST_COLOUR_EMIT "REQUEST_BACKGROUND_COLOUR_EMIT"68#define UBUS_BACKGROUND_REQUEST_COLOUR_EMIT "REQUEST_BACKGROUND_COLOUR_EMIT"
6969
70#define UBUS_DASH_SIZE_CHANGED "DASH_SIZE_CHANGED"
71
70#endif // UBUS_MESSAGES_H72#endif // UBUS_MESSAGES_H
7173
=== modified file 'tests/CMakeLists.txt'
--- tests/CMakeLists.txt 2011-09-19 06:05:54 +0000
+++ tests/CMakeLists.txt 2011-09-22 10:00:29 +0000
@@ -449,6 +449,9 @@
449 ${UNITY_SRC}/Timer.cpp449 ${UNITY_SRC}/Timer.cpp
450 ${UNITY_SRC}/DashStyle.cpp450 ${UNITY_SRC}/DashStyle.cpp
451 ${UNITY_SRC}/JSONParser.cpp451 ${UNITY_SRC}/JSONParser.cpp
452 ${UNITY_SRC}/UBusMessages.h
453 ${UNITY_SRC}/UBusWrapper.cpp
454 ${UNITY_SRC}/UBusWrapper.h
452 ${UNITY_SRC}/ubus-server.cpp455 ${UNITY_SRC}/ubus-server.cpp
453 ${UNITY_SRC}/ubus-server.h456 ${UNITY_SRC}/ubus-server.h
454 )457 )