summaryrefslogtreecommitdiff
path: root/plugins
diff options
Diffstat (limited to 'plugins')
-rw-r--r--plugins/unityshell/resources/switcher_background.pngbin2191 -> 2191 bytes
-rw-r--r--plugins/unityshell/resources/switcher_corner.pngbin0 -> 761 bytes
-rw-r--r--plugins/unityshell/resources/switcher_left.pngbin0 -> 294 bytes
-rw-r--r--plugins/unityshell/resources/switcher_top.pngbin0 -> 276 bytes
-rw-r--r--plugins/unityshell/src/SwitcherView.cpp104
-rw-r--r--plugins/unityshell/src/SwitcherView.h6
6 files changed, 106 insertions, 4 deletions
diff --git a/plugins/unityshell/resources/switcher_background.png b/plugins/unityshell/resources/switcher_background.png
index 946571e9a..1e3c07537 100644
--- a/plugins/unityshell/resources/switcher_background.png
+++ b/plugins/unityshell/resources/switcher_background.png
Binary files differ
diff --git a/plugins/unityshell/resources/switcher_corner.png b/plugins/unityshell/resources/switcher_corner.png
new file mode 100644
index 000000000..6b88cf64d
--- /dev/null
+++ b/plugins/unityshell/resources/switcher_corner.png
Binary files differ
diff --git a/plugins/unityshell/resources/switcher_left.png b/plugins/unityshell/resources/switcher_left.png
new file mode 100644
index 000000000..c2519316e
--- /dev/null
+++ b/plugins/unityshell/resources/switcher_left.png
Binary files differ
diff --git a/plugins/unityshell/resources/switcher_top.png b/plugins/unityshell/resources/switcher_top.png
new file mode 100644
index 000000000..30e1c7b8f
--- /dev/null
+++ b/plugins/unityshell/resources/switcher_top.png
Binary files differ
diff --git a/plugins/unityshell/src/SwitcherView.cpp b/plugins/unityshell/src/SwitcherView.cpp
index 8d6907938..4847cf244 100644
--- a/plugins/unityshell/src/SwitcherView.cpp
+++ b/plugins/unityshell/src/SwitcherView.cpp
@@ -64,7 +64,9 @@ SwitcherView::SwitcherView(NUX_FILE_LINE_DECL)
render_targets_.clear ();
- background_texture_ = nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_background.png", -1, true);
+ background_top_ = nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_top.png", -1, true);
+ background_left_ = nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_left.png", -1, true);
+ background_corner_ = nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_corner.png", -1, true);
rounding_texture_ = nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_round_rect.png", -1, true);
text_view_ = new nux::StaticCairoText("Testing");
@@ -82,7 +84,9 @@ SwitcherView::SwitcherView(NUX_FILE_LINE_DECL)
SwitcherView::~SwitcherView()
{
- background_texture_->UnReference();
+ background_top_->UnReference();
+ background_left_->UnReference();
+ background_corner_->UnReference();
rounding_texture_->UnReference();
text_view_->UnReference();
if (redraw_handle_ > 0)
@@ -533,6 +537,100 @@ gboolean SwitcherView::OnDrawTimeout(gpointer data)
return FALSE;
}
+void SwitcherView::DrawBackground(nux::GraphicsEngine& GfxContext, nux::Geometry const& geo)
+{
+ int border = 30;
+
+ GfxContext.GetRenderStates().SetBlend (TRUE, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+
+ nux::TexCoordXForm texxform;
+ texxform.SetTexCoordType (nux::TexCoordXForm::OFFSET_COORD);
+ texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT);
+
+ // Draw TOP-LEFT CORNER
+ texxform.u0 = 0;
+ texxform.v0 = 0;
+ texxform.u1 = border;
+ texxform.v1 = border;
+ GfxContext.QRP_1Tex (geo.x, geo.y,
+ border, border, background_corner_->GetDeviceTexture(), texxform, nux::color::White);
+
+ // Draw TOP-RIGHT CORNER
+ texxform.u0 = 0;
+ texxform.v0 = 0;
+ texxform.u1 = border;
+ texxform.v1 = border;
+ texxform.flip_u_coord = true;
+ texxform.flip_v_coord = false;
+ GfxContext.QRP_1Tex (geo.x + geo.width - border, geo.y,
+ border, border, background_corner_->GetDeviceTexture(), texxform, nux::color::White);
+
+ // Draw BOTTOM-LEFT CORNER
+ texxform.u0 = 0;
+ texxform.v0 = 0;
+ texxform.u1 = border;
+ texxform.v1 = border;
+ texxform.flip_u_coord = false;
+ texxform.flip_v_coord = true;
+ GfxContext.QRP_1Tex (geo.x, geo.y + geo.height - border,
+ border, border, background_corner_->GetDeviceTexture(), texxform, nux::color::White);
+
+ // Draw BOTTOM-RIGHT CORNER
+ texxform.u0 = 0;
+ texxform.v0 = 0;
+ texxform.u1 = border;
+ texxform.v1 = border;
+ texxform.flip_u_coord = true;
+ texxform.flip_v_coord = true;
+ GfxContext.QRP_1Tex (geo.x + geo.width - border, geo.y + geo.height - border,
+ border, border, background_corner_->GetDeviceTexture(), texxform, nux::color::White);
+
+ int top_width = background_top_->GetWidth();
+ int top_height = background_top_->GetHeight();
+
+ // Draw TOP BORDER
+ texxform.u0 = 0;
+ texxform.v0 = 0;
+ texxform.u1 = top_width;
+ texxform.v1 = top_height;
+ texxform.flip_u_coord = false;
+ texxform.flip_v_coord = false;
+ GfxContext.QRP_1Tex (geo.x + border, geo.y, geo.width - border - border, border, background_top_->GetDeviceTexture(), texxform, nux::color::White);
+
+ // Draw BOTTOM BORDER
+ texxform.u0 = 0;
+ texxform.v0 = 0;
+ texxform.u1 = top_width;
+ texxform.v1 = top_height;
+ texxform.flip_u_coord = false;
+ texxform.flip_v_coord = true;
+ GfxContext.QRP_1Tex (geo.x + border, geo.y + geo.height - border, geo.width - border - border, border, background_top_->GetDeviceTexture(), texxform, nux::color::White);
+
+
+ int left_width = background_left_->GetWidth();
+ int left_height = background_left_->GetHeight();
+
+ // Draw LEFT BORDER
+ texxform.u0 = 0;
+ texxform.v0 = 0;
+ texxform.u1 = left_width;
+ texxform.v1 = left_height;
+ texxform.flip_u_coord = false;
+ texxform.flip_v_coord = false;
+ GfxContext.QRP_1Tex (geo.x, geo.y + border, border, geo.height - border - border, background_left_->GetDeviceTexture(), texxform, nux::color::White);
+
+ // Draw RIGHT BORDER
+ texxform.u0 = 0;
+ texxform.v0 = 0;
+ texxform.u1 = left_width;
+ texxform.v1 = left_height;
+ texxform.flip_u_coord = true;
+ texxform.flip_v_coord = false;
+ GfxContext.QRP_1Tex (geo.x + geo.width - border, geo.y + border, border, geo.height - border - border, background_left_->GetDeviceTexture(), texxform, nux::color::White);
+
+ GfxContext.GetRenderStates().SetBlend (FALSE);
+}
+
void SwitcherView::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
{
timespec current;
@@ -666,7 +764,7 @@ void SwitcherView::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
GfxContext.PopClippingRectangle();
GfxContext.PopClippingRectangle();
- gPainter.PaintTextureShape(GfxContext, background_geo, background_texture_, 30, 30, 30, 30, false);
+ DrawBackground(GfxContext, background_geo);
text_view_->SetBaseY(background_geo.y + background_geo.height - 45);
text_view_->Draw(GfxContext, force_draw);
diff --git a/plugins/unityshell/src/SwitcherView.h b/plugins/unityshell/src/SwitcherView.h
index 6a883cb74..68173a0b4 100644
--- a/plugins/unityshell/src/SwitcherView.h
+++ b/plugins/unityshell/src/SwitcherView.h
@@ -80,6 +80,8 @@ protected:
RenderArg CreateBaseArgForIcon(AbstractLauncherIcon* icon);
private:
+ void DrawBackground(nux::GraphicsEngine& GfxContext, nux::Geometry const& geo);
+
void OnSelectionChanged(AbstractLauncherIcon* selection);
void OnDetailSelectionChanged (bool detail);
void OnDetailSelectionIndexChanged (unsigned int index);
@@ -111,7 +113,9 @@ private:
guint redraw_handle_;
- nux::BaseTexture* background_texture_;
+ nux::BaseTexture* background_top_;
+ nux::BaseTexture* background_left_;
+ nux::BaseTexture* background_corner_;
nux::BaseTexture* rounding_texture_;
nux::StaticCairoText* text_view_;