Merge lp:~unity-team/unity/panel-fixes into lp:unity

Proposed by Neil J. Patel
Status: Merged
Approved by: Gord Allott
Approved revision: no longer in the source branch.
Merged at revision: 867
Proposed branch: lp:~unity-team/unity/panel-fixes
Merge into: lp:unity
Diff against target: 1855 lines (+1043/-202)
21 files modified
CMakeLists.txt (+1/-1)
com.canonical.Unity.gschema.xml (+7/-0)
services/panel-service.c (+11/-2)
src/PanelHomeButton.cpp (+11/-7)
src/PanelHomeButton.h (+0/-1)
src/PanelIndicatorObjectEntryView.cpp (+62/-22)
src/PanelIndicatorObjectView.cpp (+7/-3)
src/PanelMenuView.cpp (+49/-36)
src/PanelMenuView.h (+1/-0)
src/PanelStyle.cpp (+274/-0)
src/PanelStyle.h (+79/-0)
src/PanelTray.cpp (+231/-0)
src/PanelTray.h (+73/-0)
src/PanelView.cpp (+126/-43)
src/PanelView.h (+20/-3)
src/WindowButtons.cpp (+27/-71)
src/unityshell.cpp (+34/-7)
src/unityshell.h (+8/-0)
tests/CMakeLists.txt (+4/-0)
tests/TestPanel.cpp (+2/-2)
unityshell.xml.in (+16/-4)
To merge this branch: bzr merge lp:~unity-team/unity/panel-fixes
Reviewer Review Type Date Requested Status
Gord Allott Pending
Review via email: mp+50109@code.launchpad.net

Description of the change

All bugs linked, the only thing different is that I added an option to change panel opacity :)

I had to change the GSettings schemas, so you'll need to make sure that they are installed correctly locally and your exporting XDG_DATA_DIRS=$your_prefix/share:/usr/local/share:/usr/share (or whatever makes sense for your system :)

*update* Install latest libunity-misc too.

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

You have a few conflict markers there, and also you copied Mirco's email in the
header blocks :-)

Revision history for this message
Neil J. Patel (njpatel) wrote :

Fixed conflicts. Mirco's name is because I merged a branch of his with the initial implementation of style object but, yeah, I forgot to add my own name when I updated it :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2011-02-10 17:00:18 +0000
3+++ CMakeLists.txt 2011-02-17 10:02:19 +0000
4@@ -88,7 +88,7 @@
5 #
6 # src (Compiz Plugin)
7 #
8-set (UNITY_PLUGIN_DEPS "nux-0.9;libbamf;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator;atk")
9+set (UNITY_PLUGIN_DEPS "nux-0.9;libbamf;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator;atk;unity-misc")
10
11 find_package (Compiz REQUIRED)
12 include (CompizPlugin)
13
14=== modified file 'com.canonical.Unity.gschema.xml'
15--- com.canonical.Unity.gschema.xml 2010-11-30 14:19:02 +0000
16+++ com.canonical.Unity.gschema.xml 2011-02-17 10:02:19 +0000
17@@ -11,4 +11,11 @@
18 <description>This is a detection key for the favorite migration script to know whether the needed migration is done or not.</description>
19 </key>
20 </schema>
21+ <schema path="/desktop/unity/panel/" id="com.canonical.Unity.Panel" gettext-domain="unity">
22+ <key type="as" name="systray-whitelist">
23+ <default>[ 'JavaEmbeddedFrame', 'Wine', 'Skype' ]</default>
24+ <summary>List of client names, resource classes or wm classes to allow in the Panel's systray implementation.</summary>
25+ <description>"" (empty) will not allow any tray icons, "all" will allow all tray icons, otherwise there will be an attempt to match each icon to a value here.</description>
26+ </key>
27+ </schema>
28 </schemalist>
29
30=== modified file 'services/panel-service.c'
31--- services/panel-service.c 2011-02-08 11:50:18 +0000
32+++ services/panel-service.c 2011-02-17 10:02:19 +0000
33@@ -963,10 +963,13 @@
34 {
35 PanelServicePrivate *priv = self->priv;
36 IndicatorObjectEntry *entry = g_hash_table_lookup (priv->id2entry_hash, entry_id);
37- IndicatorObject *object = g_hash_table_lookup (priv->entry2indicator_hash, entry);
38+ IndicatorObject *object = g_hash_table_lookup (priv->entry2indicator_hash, entry);
39+ GtkWidget *last_menu;
40
41 if (priv->last_entry == entry)
42 return;
43+
44+ last_menu = GTK_WIDGET (priv->last_menu);
45
46 if (GTK_IS_MENU (priv->last_menu))
47 {
48@@ -975,7 +978,6 @@
49
50 g_signal_handler_disconnect (priv->last_menu, priv->last_menu_id);
51 g_signal_handler_disconnect (priv->last_menu, priv->last_menu_move_id);
52- gtk_menu_popdown (GTK_MENU (priv->last_menu));
53
54 priv->last_entry = NULL;
55 priv->last_menu = NULL;
56@@ -1016,6 +1018,13 @@
57
58 g_signal_emit (self, _service_signals[ENTRY_ACTIVATED], 0, entry_id);
59 }
60+
61+ /* We popdown the old one last so we don't accidently send key focus back to the
62+ * active application (which will make it change colour (as state changes), which
63+ * then looks like flickering to the user.
64+ */
65+ if (GTK_MENU (last_menu))
66+ gtk_menu_popdown (GTK_MENU (last_menu));
67 }
68
69 void
70
71=== modified file 'src/PanelHomeButton.cpp'
72--- src/PanelHomeButton.cpp 2011-02-16 14:51:55 +0000
73+++ src/PanelHomeButton.cpp 2011-02-17 10:02:19 +0000
74@@ -32,6 +32,8 @@
75 #include <pango/pangocairo.h>
76 #include <gtk/gtk.h>
77
78+#include "PanelStyle.h"
79+
80 #define PANEL_HEIGHT 24
81 #define BUTTON_WIDTH 66
82
83@@ -41,7 +43,6 @@
84 : TextureArea (NUX_TRACKER_LOCATION),
85 _util_cg (CAIRO_FORMAT_ARGB32, BUTTON_WIDTH, PANEL_HEIGHT)
86 {
87- _pixbuf = gdk_pixbuf_new_from_file (PKGDATADIR"/bfb.png", NULL);
88 SetMinMaxSize (BUTTON_WIDTH, PANEL_HEIGHT);
89
90 OnMouseClick.connect (sigc::mem_fun (this, &PanelHomeButton::RecvMouseClick));
91@@ -51,12 +52,12 @@
92 OnMouseLeave.connect (sigc::mem_fun(this, &PanelHomeButton::RecvMouseLeave));
93 OnMouseMove.connect (sigc::mem_fun(this, &PanelHomeButton::RecvMouseMove));
94
95+ PanelStyle::GetDefault ()->changed.connect (sigc::mem_fun (this, &PanelHomeButton::Refresh));
96 Refresh ();
97 }
98
99 PanelHomeButton::~PanelHomeButton ()
100 {
101- g_object_unref (_pixbuf);
102 }
103
104 void
105@@ -64,14 +65,18 @@
106 {
107 int width = BUTTON_WIDTH;
108 int height = PANEL_HEIGHT;
109+ GdkPixbuf *pixbuf;
110
111 nux::CairoGraphics cairo_graphics(CAIRO_FORMAT_ARGB32, width, height);
112 cairo_t *cr = cairo_graphics.GetContext();
113 cairo_set_line_width (cr, 1);
114
115- gdk_cairo_set_source_pixbuf (cr, _pixbuf,
116- (BUTTON_WIDTH-gdk_pixbuf_get_width (_pixbuf))/2,
117- (PANEL_HEIGHT-gdk_pixbuf_get_height (_pixbuf))/2);
118+ pixbuf = PanelStyle::GetDefault ()->GetHomeButton ();
119+ gdk_cairo_set_source_pixbuf (cr, pixbuf,
120+ (BUTTON_WIDTH-gdk_pixbuf_get_width (pixbuf))/2,
121+ (PANEL_HEIGHT-gdk_pixbuf_get_height (pixbuf))/2);
122+ g_object_unref (pixbuf);
123+
124 cairo_paint (cr);
125
126 cairo_set_source_rgba (cr, 0.0f, 0.0f, 0.0f, 0.2f);
127@@ -102,7 +107,7 @@
128 nux::TextureLayer* texture_layer = new nux::TextureLayer (texture2D->GetDeviceTexture(),
129 texxform, // The Oject that defines the texture wraping and coordinate transformation.
130 nux::Color::White, // The color used to modulate the texture.
131- false, // Write the alpha value of the texture to the destination buffer.
132+ true, // Write the alpha value of the texture to the destination buffer.
133 rop // Use the given raster operation to set the blending when the layer is being rendered.
134 );
135
136@@ -205,5 +210,4 @@
137 g_variant_builder_add (builder, "{sv}", "y", g_variant_new_int32 (geo.y));
138 g_variant_builder_add (builder, "{sv}", "width", g_variant_new_int32 (geo.width));
139 g_variant_builder_add (builder, "{sv}", "height", g_variant_new_int32 (geo.height));
140- g_variant_builder_add (builder, "{sv}", "have-pixbuf", g_variant_new_boolean (GDK_IS_PIXBUF (_pixbuf)));
141 }
142
143=== modified file 'src/PanelHomeButton.h'
144--- src/PanelHomeButton.h 2011-02-14 13:18:26 +0000
145+++ src/PanelHomeButton.h 2011-02-17 10:02:19 +0000
146@@ -51,7 +51,6 @@
147
148 private:
149 nux::CairoGraphics _util_cg;
150- GdkPixbuf *_pixbuf;
151 };
152
153 #endif // PANEL_HOME_BUTTON_H
154
155=== modified file 'src/PanelIndicatorObjectEntryView.cpp'
156--- src/PanelIndicatorObjectEntryView.cpp 2011-01-20 12:48:09 +0000
157+++ src/PanelIndicatorObjectEntryView.cpp 2011-02-17 10:02:19 +0000
158@@ -26,6 +26,7 @@
159 #include "Nux/WindowCompositor.h"
160
161 #include "PanelIndicatorObjectEntryView.h"
162+#include "PanelStyle.h"
163
164 #include <glib.h>
165 #include <pango/pangocairo.h>
166@@ -47,7 +48,8 @@
167
168 InputArea::OnMouseDown.connect (sigc::mem_fun (this, &PanelIndicatorObjectEntryView::OnMouseDown));
169 InputArea::OnMouseWheel.connect (sigc::mem_fun (this, &PanelIndicatorObjectEntryView::OnMouseWheel));
170-
171+
172+ PanelStyle::GetDefault ()->changed.connect (sigc::mem_fun (this, &PanelIndicatorObjectEntryView::Refresh));
173 Refresh ();
174 }
175
176@@ -141,6 +143,9 @@
177 int text_width = 0;
178 int text_height = 0;
179
180+ PanelStyle *style = PanelStyle::GetDefault ();
181+ nux::Color textcol = style->GetTextColor ();
182+ nux::Color textshadowcol = style->GetTextShadow ();
183
184 // First lets figure out our size
185 if (pixbuf && _proxy->icon_visible)
186@@ -194,6 +199,11 @@
187 cr = cairo_graphics.GetContext();
188 cairo_set_line_width (cr, 1);
189
190+ cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
191+ cairo_paint (cr);
192+
193+ cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
194+
195 if (_proxy->GetActive ())
196 draw_menu_bg (cr, width, height);
197
198@@ -215,13 +225,20 @@
199 pango_cairo_update_layout (cr, layout);
200
201 // Once for the homies that couldn't be here
202- cairo_set_source_rgb (cr, 50/255.0f, 50/255.0f, 45/255.0f);
203+ cairo_set_source_rgba (cr,
204+ textshadowcol.GetRed (),
205+ textshadowcol.GetGreen (),
206+ textshadowcol.GetBlue (),
207+ 1.0f - textshadowcol.GetRed ());
208 cairo_move_to (cr, x, ((height - text_height)/2)-1);
209 pango_cairo_show_layout (cr, layout);
210 cairo_stroke (cr);
211
212 // Once again for the homies that could
213- cairo_set_source_rgba (cr, 223/255.0f, 219/255.0f, 210/255.0f,
214+ cairo_set_source_rgba (cr,
215+ textcol.GetRed (),
216+ textcol.GetGreen (),
217+ textcol.GetBlue (),
218 _proxy->label_sensitive ? 1.0f : 0.0f);
219 cairo_move_to (cr, x, (height - text_height)/2);
220 pango_cairo_show_layout (cr, layout);
221@@ -244,23 +261,17 @@
222 texxform.SetWrap (nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT);
223
224 nux::ROPConfig rop;
225- rop.Blend = true; // Enable the blending. By default rop.Blend is false.
226- rop.SrcBlend = GL_ONE; // Set the source blend factor.
227- rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA; // Set the destination blend factor.
228+ rop.Blend = true;
229+ rop.SrcBlend = GL_ONE;
230+ rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
231 nux::TextureLayer* texture_layer = new nux::TextureLayer (texture2D->GetDeviceTexture(),
232- texxform, // The Oject that defines the texture wraping and coordinate transformation.
233- nux::Color::White, // The color used to modulate the texture.
234- false, // Write the alpha value of the texture to the destination buffer.
235- rop // Use the given raster operation to set the blending when the layer is being rendered.
236- );
237-
238+ texxform,
239+ nux::Color::White,
240+ true,
241+ rop);
242 SetPaintLayer (texture_layer);
243
244- // We don't need the texture anymore. Since it hasn't been reference, it ref count should still be 1.
245- // UnReference it and it will be destroyed.
246 texture2D->UnReference ();
247-
248- // The texture layer has been cloned by this object when calling SetPaintLayer. It is safe to delete it now.
249 delete texture_layer;
250
251 NeedRedraw ();
252@@ -281,6 +292,11 @@
253 /* FIXME */
254 double mpi = 3.14159265358979323846;
255
256+ PanelStyle *style = PanelStyle::GetDefault ();
257+ nux::Color bgtop = style->GetBackgroundTop ();
258+ nux::Color bgbot = style->GetBackgroundBottom ();
259+ nux::Color line = style->GetTextShadow ();
260+
261 cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
262
263 cairo_set_line_width (cr, 1.0);
264@@ -294,15 +310,31 @@
265 cairo_arc (cr, x+xos+radius, y+yos+radius, radius, mpi, mpi*1.5);
266
267 cairo_pattern_t * pat = cairo_pattern_create_linear (x+xos, y, x+xos, y+height-yos*2+2);
268- cairo_pattern_add_color_stop_rgba (pat, 0.0, 83/255.0f, 82/255.0f, 78/255.0f, 1.0f);
269- cairo_pattern_add_color_stop_rgba (pat, 1.0, 66/255.0f, 65/255.0f, 63/255.0f, 1.0f);
270+ cairo_pattern_add_color_stop_rgba (pat, 0.0,
271+ bgtop.GetRed (),
272+ bgtop.GetGreen (),
273+ bgtop.GetBlue (),
274+ 1.0f - bgbot.GetRed ());
275+ cairo_pattern_add_color_stop_rgba (pat, 1.0,
276+ bgbot.GetRed (),
277+ bgbot.GetGreen (),
278+ bgbot.GetBlue (),
279+ 1.0f - bgtop.GetRed ());
280 cairo_set_source (cr, pat);
281 cairo_fill_preserve (cr);
282 cairo_pattern_destroy (pat);
283
284 pat = cairo_pattern_create_linear (x+xos, y, x+xos, y+height-yos*2+2);
285- cairo_pattern_add_color_stop_rgba (pat, 0.0, 62/255.0f, 61/255.0f, 58/255.0f, 1.0f);
286- cairo_pattern_add_color_stop_rgba (pat, 1.0, 54/255.0f, 54/255.0f, 52/255.0f, 1.0f);
287+ cairo_pattern_add_color_stop_rgba (pat, 0.0,
288+ line.GetRed (),
289+ line.GetGreen (),
290+ line.GetBlue (),
291+ 1.0f);
292+ cairo_pattern_add_color_stop_rgba (pat, 1.0,
293+ line.GetRed (),
294+ line.GetGreen (),
295+ line.GetBlue (),
296+ 1.0f);
297 cairo_set_source (cr, pat);
298 cairo_stroke (cr);
299 cairo_pattern_destroy (pat);
300@@ -318,8 +350,16 @@
301 cairo_arc (cr, x+xos+radius, y+yos+radius, radius, mpi, mpi*1.5);
302
303 pat = cairo_pattern_create_linear (x+xos, y, x+xos, y+height-yos*2+3);
304- cairo_pattern_add_color_stop_rgba (pat, 0.0, 92/255.0f, 90/255.0f, 85/255.0f, 1.0f);
305- cairo_pattern_add_color_stop_rgba (pat, 1.0, 70/255.0f, 69/255.0f, 66/255.0f, 1.0f);
306+ cairo_pattern_add_color_stop_rgba (pat, 0.0,
307+ bgbot.GetRed (),
308+ bgbot.GetGreen (),
309+ bgbot.GetBlue (),
310+ 1.0f);
311+ cairo_pattern_add_color_stop_rgba (pat, 1.0,
312+ bgbot.GetRed (),
313+ bgbot.GetGreen (),
314+ bgbot.GetBlue (),
315+ 1.0f);
316 cairo_set_source (cr, pat);
317 cairo_stroke (cr);
318 cairo_pattern_destroy (pat);
319
320=== modified file 'src/PanelIndicatorObjectView.cpp'
321--- src/PanelIndicatorObjectView.cpp 2011-01-25 15:45:12 +0000
322+++ src/PanelIndicatorObjectView.cpp 2011-02-17 10:02:19 +0000
323@@ -1,4 +1,4 @@
324-// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
325+
326 /*
327 * Copyright (C) 2010 Canonical Ltd
328 *
329@@ -33,6 +33,7 @@
330
331 PanelIndicatorObjectView::PanelIndicatorObjectView ()
332 : View (NUX_TRACKER_LOCATION),
333+ _layout (NULL),
334 _proxy (NULL),
335 _entries ()
336 {
337@@ -65,7 +66,9 @@
338 PanelIndicatorObjectView::ProcessEvent (nux::IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
339 {
340 long ret = TraverseInfo;
341- ret = _layout->ProcessEvent (ievent, ret, ProcessEventInfo);
342+
343+ if (_layout)
344+ ret = _layout->ProcessEvent (ievent, ret, ProcessEventInfo);
345 return ret;
346 }
347
348@@ -79,7 +82,8 @@
349 PanelIndicatorObjectView::DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw)
350 {
351 GfxContext.PushClippingRectangle (GetGeometry() );
352- _layout->ProcessDraw (GfxContext, force_draw);
353+ if (_layout)
354+ _layout->ProcessDraw (GfxContext, force_draw);
355 GfxContext.PopClippingRectangle();
356 }
357
358
359=== modified file 'src/PanelMenuView.cpp'
360--- src/PanelMenuView.cpp 2011-02-16 19:21:10 +0000
361+++ src/PanelMenuView.cpp 2011-02-17 10:02:19 +0000
362@@ -29,6 +29,7 @@
363 #include "Nux/WindowCompositor.h"
364
365 #include "PanelMenuView.h"
366+#include "PanelStyle.h"
367
368 #include "WindowManager.h"
369
370@@ -56,6 +57,7 @@
371 _title_tex (NULL),
372 _is_inside (false),
373 _is_maximized (false),
374+ _is_own_window (false),
375 _last_active_view (NULL)
376 {
377 WindowManager *win_manager;
378@@ -98,6 +100,8 @@
379 win_manager->window_restored.connect (sigc::mem_fun (this, &PanelMenuView::OnWindowRestored));
380 win_manager->window_unmapped.connect (sigc::mem_fun (this, &PanelMenuView::OnWindowUnmapped));
381
382+ PanelStyle::GetDefault ()->changed.connect (sigc::mem_fun (this, &PanelMenuView::Refresh));
383+
384 Refresh ();
385 }
386
387@@ -223,14 +227,18 @@
388 nux::ColorLayer layer (nux::Color (0x00000000), true, rop);
389 gPainter.PushDrawLayer (GfxContext, GetGeometry (), &layer);
390
391- if (_is_maximized)
392+ if (_is_own_window)
393+ {
394+
395+ }
396+ else if (_is_maximized)
397 {
398 if (!_is_inside && !_last_active_view)
399 gPainter.PushDrawLayer (GfxContext, GetGeometry (), _title_layer);
400 }
401 else
402 {
403- if (_is_inside || _last_active_view)
404+ if ((_is_inside || _last_active_view) && _entries.size ())
405 {
406 if (_gradient_texture == NULL)
407 {
408@@ -273,9 +281,10 @@
409 }
410 _gradient_texture->UnlockRect (0);
411 }
412+ guint alpha = 0, src = 0, dest = 0;
413
414- GfxContext.GetRenderStates ().SetBlend (true);
415- GfxContext.GetRenderStates ().SetPremultipliedBlend (nux::SRC_OVER);
416+ GfxContext.GetRenderStates ().GetBlend (alpha, src, dest);
417+ GfxContext.GetRenderStates ().SetBlend (true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
418
419 nux::TexCoordXForm texxform0;
420 nux::TexCoordXForm texxform1;
421@@ -289,8 +298,7 @@
422 texxform1,
423 nux::Color::White);
424
425- GfxContext.GetRenderStates ().SetBlend(false);
426-
427+ GfxContext.GetRenderStates ().SetBlend (alpha, src, dest);
428 // The previous blend is too aggressive on the texture and therefore there
429 // is a slight loss of clarity. This fixes that
430 geo.width = button_width * (factor - 1);
431@@ -317,14 +325,17 @@
432
433 GfxContext.PushClippingRectangle (geo);
434
435- if (_is_inside || _last_active_view)
436+ if (!_is_own_window)
437 {
438- _layout->ProcessDraw (GfxContext, force_draw);
439- }
440+ if (_is_inside || _last_active_view)
441+ {
442+ _layout->ProcessDraw (GfxContext, force_draw);
443+ }
444
445- if (_is_maximized)
446- {
447- _window_buttons->ProcessDraw (GfxContext, true);
448+ if (_is_maximized)
449+ {
450+ _window_buttons->ProcessDraw (GfxContext, true);
451+ }
452 }
453
454 GfxContext.PopClippingRectangle();
455@@ -333,7 +344,20 @@
456 gchar *
457 PanelMenuView::GetActiveViewName ()
458 {
459- gchar *label = NULL;
460+ gchar *label = NULL;
461+ BamfWindow *window;
462+
463+ // There's probably a better way to do this, but we really only want to ignore our own windows
464+ // as there could be cases where windows like ours have menus and we don't want them to fall
465+ // into this statement. Still, will investigate better ways to do this.
466+ window = bamf_matcher_get_active_window (_matcher);
467+ if (BAMF_IS_WINDOW (window)
468+ && g_str_has_prefix (bamf_view_get_name (BAMF_VIEW (window)), "nux input"))
469+ {
470+ _is_own_window = true;
471+ }
472+ else
473+ _is_own_window = false;
474
475 if (_is_maximized)
476 {
477@@ -448,6 +472,11 @@
478 cr = cairo_graphics.GetContext();
479 cairo_set_line_width (cr, 1);
480
481+ cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
482+ cairo_paint (cr);
483+
484+ cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
485+
486 x = _padding;
487 y = 0;
488
489@@ -456,43 +485,27 @@
490
491 if (label)
492 {
493+ nux::Color col = PanelStyle::GetDefault ()->GetTextColor ();
494+ float red = col.GetRed (), blue = col.GetBlue (), green = col.GetGreen ();
495+
496 pango_cairo_update_layout (cr, layout);
497
498 y += (height - text_height)/2;
499 double startalpha = 1.0 - ((double)text_margin/(double)width);
500
501- // Once for the homies that couldn't be here
502- if (x+text_width >= width-1)
503- {
504- linpat = cairo_pattern_create_linear (x, y-1, width-1, y-1+text_height);
505- cairo_pattern_add_color_stop_rgb (linpat, 0, 50/255.0f, 50/255.0f, 45/255.0f);
506- cairo_pattern_add_color_stop_rgb (linpat, startalpha, 50/255.0f, 50/255.0f, 45/255.0f);
507- cairo_pattern_add_color_stop_rgba (linpat, startalpha, 0, 0.0, 0.0, 0);
508- cairo_pattern_add_color_stop_rgba (linpat, 1, 0, 0.0, 0.0, 0);
509- cairo_set_source(cr, linpat);
510- cairo_pattern_destroy(linpat);
511- }
512- else
513- {
514- cairo_set_source_rgb (cr, 50/255.0f, 50/255.0f, 45/255.0f);
515- }
516- cairo_move_to (cr, x, y-1);
517- pango_cairo_show_layout (cr, layout);
518- cairo_stroke (cr);
519-
520 // Once again for the homies that could
521 if (x+text_width >= width-1)
522 {
523 linpat = cairo_pattern_create_linear (x, y, width-1, y+text_height);
524- cairo_pattern_add_color_stop_rgb (linpat, 0, 223/255.0f, 219/255.0f, 210/255.0f);
525- cairo_pattern_add_color_stop_rgb (linpat, startalpha, 223/255.0f, 219/255.0f, 210/255.0f);
526+ cairo_pattern_add_color_stop_rgb (linpat, 0, red, green, blue);
527+ cairo_pattern_add_color_stop_rgb (linpat, startalpha, red, green, blue);
528 cairo_pattern_add_color_stop_rgba (linpat, 1, 0, 0.0, 0.0, 0);
529 cairo_set_source(cr, linpat);
530 cairo_pattern_destroy(linpat);
531 }
532 else
533 {
534- cairo_set_source_rgb (cr, 223/255.0f, 219/255.0f, 210/255.0f);
535+ cairo_set_source_rgb (cr, red, green, blue);
536 }
537 cairo_move_to (cr, x, y);
538 pango_cairo_show_layout (cr, layout);
539@@ -524,7 +537,7 @@
540 _title_layer = new nux::TextureLayer (texture2D->GetDeviceTexture(),
541 texxform,
542 nux::Color::White,
543- false,
544+ true,
545 rop);
546
547
548
549=== modified file 'src/PanelMenuView.h'
550--- src/PanelMenuView.h 2011-02-08 14:18:09 +0000
551+++ src/PanelMenuView.h 2011-02-17 10:02:19 +0000
552@@ -106,6 +106,7 @@
553 bool _is_inside;
554 bool _is_grabbed;
555 bool _is_maximized;
556+ bool _is_own_window;
557 PanelIndicatorObjectEntryView *_last_active_view;
558
559 WindowButtons * _window_buttons;
560
561=== added file 'src/PanelStyle.cpp'
562--- src/PanelStyle.cpp 1970-01-01 00:00:00 +0000
563+++ src/PanelStyle.cpp 2011-02-17 10:02:19 +0000
564@@ -0,0 +1,274 @@
565+/*
566+ * Copyright (C) 2010 Canonical Ltd
567+ *
568+ * This program is free software: you can redistribute it and/or modify
569+ * it under the terms of the GNU General Public License version 3 as
570+ * published by the Free Software Foundation.
571+ *
572+ * This program is distributed in the hope that it will be useful,
573+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
574+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
575+ * GNU General Public License for more details.
576+ *
577+ * You should have received a copy of the GNU General Public License
578+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
579+ *
580+ * Authored by: Mirco Müller <mirco.mueller@canonical.com>
581+ * Neil Jagdish Patel <neil.patel@canonical.com>
582+ */
583+
584+#include "config.h"
585+
586+#include <math.h>
587+#include <gtk/gtk.h>
588+
589+#include <Nux/Nux.h>
590+#include <NuxGraphics/GraphicsEngine.h>
591+#include <NuxImage/CairoGraphics.h>
592+
593+#include "PanelStyle.h"
594+
595+static PanelStyle *_style = NULL;
596+
597+PanelStyle::PanelStyle ()
598+: _theme_name (NULL)
599+{
600+ _offscreen = gtk_offscreen_window_new ();
601+ gtk_widget_set_name (_offscreen, "UnityPanelWidget");
602+ gtk_widget_set_size_request (_offscreen, 100, 24);
603+ gtk_widget_show_all (_offscreen);
604+
605+ g_signal_connect (gtk_settings_get_default (), "notify::gtk-theme-name",
606+ G_CALLBACK (PanelStyle::OnStyleChanged), this);
607+
608+ Refresh ();
609+}
610+
611+PanelStyle::~PanelStyle ()
612+{
613+ gtk_widget_destroy (_offscreen);
614+
615+ if (_style == this)
616+ _style = NULL;
617+
618+ g_free (_theme_name);
619+}
620+
621+PanelStyle *
622+PanelStyle::GetDefault ()
623+{
624+ if (G_UNLIKELY (!_style))
625+ _style = new PanelStyle ();
626+
627+ return _style;
628+}
629+
630+void
631+PanelStyle::Refresh ()
632+{
633+ GtkStyle* style = NULL;
634+
635+ if (_theme_name)
636+ g_free (_theme_name);
637+
638+ _theme_name = NULL;
639+ g_object_get (gtk_settings_get_default (), "gtk-theme-name", &_theme_name, NULL);
640+
641+ style = gtk_widget_get_style (_offscreen);
642+
643+ _text.SetRed ((float) style->text[0].red / (float) 0xffff);
644+ _text.SetGreen ((float) style->text[0].green / (float) 0xffff);
645+ _text.SetBlue ((float) style->text[0].blue / (float) 0xffff);
646+ _text.SetAlpha (1.0f);
647+
648+ _text_shadow.SetRed ((float) style->dark[0].red / (float) 0xffff);
649+ _text_shadow.SetGreen ((float) style->dark[0].green / (float) 0xffff);
650+ _text_shadow.SetBlue ((float) style->dark[0].blue / (float) 0xffff);
651+ _text_shadow.SetAlpha (1.0f);
652+
653+ _bg_top.SetRed ((float) style->bg[1].red / (float) 0xffff);
654+ _bg_top.SetGreen ((float) style->bg[1].green / (float) 0xffff);
655+ _bg_top.SetBlue ((float) style->bg[1].blue / (float) 0xffff);
656+ _bg_top.SetAlpha (1.0f);
657+
658+ _bg_bottom.SetRed ((float) style->bg[0].red / (float) 0xffff);
659+ _bg_bottom.SetGreen ((float) style->bg[0].green / (float) 0xffff);
660+ _bg_bottom.SetBlue ((float) style->bg[0].blue / (float) 0xffff);
661+ _bg_bottom.SetAlpha (1.0f);
662+
663+ changed.emit ();
664+}
665+
666+nux::Color&
667+PanelStyle::GetTextColor ()
668+{
669+ return _text;
670+}
671+
672+nux::Color&
673+PanelStyle::GetBackgroundTop ()
674+{
675+ return _bg_top;
676+}
677+
678+nux::Color&
679+PanelStyle::GetBackgroundBottom ()
680+{
681+ return _bg_bottom;
682+}
683+
684+nux::Color&
685+PanelStyle::GetTextShadow ()
686+{
687+ return _text_shadow;
688+}
689+
690+void
691+PanelStyle::OnStyleChanged (GObject* gobject,
692+ GParamSpec* pspec,
693+ gpointer data)
694+{
695+ PanelStyle* self = (PanelStyle*) data;
696+
697+ self->Refresh ();
698+}
699+
700+GdkPixbuf *
701+PanelStyle::GetBackground (int width, int height)
702+{
703+ gtk_widget_set_size_request (_offscreen, width, height);
704+ gdk_window_process_updates (gtk_widget_get_window (_offscreen), TRUE);
705+
706+ return gtk_offscreen_window_get_pixbuf (GTK_OFFSCREEN_WINDOW (_offscreen));
707+}
708+
709+nux::BaseTexture *
710+PanelStyle::GetWindowButton (WindowButtonType type, WindowState state)
711+{
712+#define ICON_LOCATION "/usr/share/themes/%s/metacity-1/%s%s.png"
713+ nux::BaseTexture * texture = NULL;
714+ const char *names[] = { "close", "minimize", "unmaximize" };
715+ const char *states[] = { "", "_focused_prelight", "_focused_pressed" };
716+
717+ // I wish there was a magic bullet here, but not all themes actually set the panel to be
718+ // the same style as the window titlebars (e.g. Clearlooks) so we can just grab the
719+ // metacity window buttons as that would look horrible
720+ if (g_strcmp0 (_theme_name, "Ambiance") == 0
721+ || g_strcmp0 (_theme_name, "Radiance") == 0)
722+ {
723+ char *filename;
724+ GdkPixbuf *pixbuf;
725+ GError *error = NULL;
726+
727+ filename = g_strdup_printf (ICON_LOCATION, _theme_name, names[type], states[state]);
728+
729+ pixbuf = gdk_pixbuf_new_from_file (filename, &error);
730+ if (error)
731+ {
732+ g_warning ("Unable to load window button %s: %s", filename, error->message);
733+ g_error_free (error);
734+ error = NULL;
735+ }
736+ else
737+ texture = nux::CreateTexture2DFromPixbuf (pixbuf, true);
738+
739+ g_free (filename);
740+ g_object_unref (pixbuf);
741+ }
742+ else
743+ {
744+ texture = GetWindowButtonForTheme (type, state);
745+ }
746+
747+ return texture;
748+}
749+
750+nux::BaseTexture *
751+PanelStyle::GetWindowButtonForTheme (WindowButtonType type, WindowState state)
752+{
753+ nux::BaseTexture *texture = NULL;
754+ int width = 18, height = 18;
755+ float w = width/3.0f;
756+ float h = height/3.0f;
757+ nux::CairoGraphics cairo_graphics(CAIRO_FORMAT_ARGB32, 22, 22);
758+ cairo_t *cr;
759+ nux::Color main = _text;
760+
761+ if (type == WINDOW_BUTTON_CLOSE)
762+ {
763+ main = nux::Color (1.0f, 0.3f, 0.3f, 0.8f);
764+ }
765+
766+ if (state == WINDOW_STATE_PRELIGHT)
767+ main = main * 1.2f;
768+ else if (state == WINDOW_STATE_PRESSED)
769+ main = main * 0.8f;
770+
771+ cr = cairo_graphics.GetContext();
772+ cairo_translate (cr, 0.5, 0.5);
773+ cairo_set_line_width (cr, 1.5f);
774+
775+ cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
776+ cairo_paint (cr);
777+
778+ cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
779+
780+ cairo_set_source_rgba (cr, main.GetRed (), main.GetGreen (), main.GetBlue (), main.GetAlpha ());
781+
782+ cairo_arc (cr, width/2.0f, height/2.0f, (width - 2)/2.0f, 0.0f, 360 * (M_PI/180));
783+ cairo_stroke (cr);
784+
785+ if (type == WINDOW_BUTTON_CLOSE)
786+ {
787+ cairo_move_to (cr, w, h);
788+ cairo_line_to (cr, width - w, height - h);
789+ cairo_move_to (cr, width -w, h);
790+ cairo_line_to (cr, w, height - h);
791+ }
792+ else if (type == WINDOW_BUTTON_MINIMIZE)
793+ {
794+ cairo_move_to (cr, w, height/2.0f);
795+ cairo_line_to (cr, width - w, height/2.0f);
796+ }
797+ else
798+ {
799+ cairo_move_to (cr, w, h);
800+ cairo_line_to (cr, width - w, h);
801+ cairo_line_to (cr, width - w, height - h);
802+ cairo_line_to (cr, w, height -h);
803+ cairo_close_path (cr);
804+ }
805+
806+ cairo_stroke (cr);
807+
808+ cairo_destroy (cr);
809+
810+ nux::NBitmapData* bitmap = cairo_graphics.GetBitmap();
811+ texture = nux::GetThreadGLDeviceFactory ()->CreateSystemCapableTexture ();
812+ texture->Update(bitmap);
813+ delete bitmap;
814+
815+ return texture;
816+}
817+
818+GdkPixbuf *
819+PanelStyle::GetHomeButton ()
820+{
821+ GdkPixbuf *pixbuf = NULL;
822+
823+ if (g_str_has_prefix (_theme_name, "Ambiance"))
824+ pixbuf = gdk_pixbuf_new_from_file (PKGDATADIR"/bfb.png", NULL);
825+ else
826+ pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
827+ "start-here",
828+ 24,
829+ (GtkIconLookupFlags)0,
830+ NULL);
831+ if (pixbuf == NULL)
832+ pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
833+ "distributor-logo",
834+ 24,
835+ (GtkIconLookupFlags)0,
836+ NULL);
837+ return pixbuf;
838+}
839
840=== added file 'src/PanelStyle.h'
841--- src/PanelStyle.h 1970-01-01 00:00:00 +0000
842+++ src/PanelStyle.h 2011-02-17 10:02:19 +0000
843@@ -0,0 +1,79 @@
844+/*
845+ * Copyright (C) 2010 Canonical Ltd
846+ *
847+ * This program is free software: you can redistribute it and/or modify
848+ * it under the terms of the GNU General Public License version 3 as
849+ * published by the Free Software Foundation.
850+ *
851+ * This program is distributed in the hope that it will be useful,
852+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
853+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
854+ * GNU General Public License for more details.
855+ *
856+ * You should have received a copy of the GNU General Public License
857+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
858+ *
859+ * Authored by: Mirco Müller <mirco.mueller@canonical.com>
860+ * Neil Jagdish Patel <neil.patel@canonical.com>
861+ */
862+
863+#ifndef PANEL_STYLE_H
864+#define PANEL_STYLE_H
865+
866+#include <Nux/Nux.h>
867+
868+#include <gtk/gtk.h>
869+
870+class PanelStyle : public nux::Object
871+{
872+ public:
873+ typedef enum
874+ {
875+ WINDOW_BUTTON_CLOSE = 0,
876+ WINDOW_BUTTON_MINIMIZE,
877+ WINDOW_BUTTON_UNMAXIMIZE
878+
879+ } WindowButtonType;
880+
881+ typedef enum
882+ {
883+ WINDOW_STATE_NORMAL,
884+ WINDOW_STATE_PRELIGHT,
885+ WINDOW_STATE_PRESSED
886+
887+ } WindowState;
888+
889+ static PanelStyle * GetDefault ();
890+
891+ PanelStyle ();
892+ ~PanelStyle ();
893+
894+ nux::Color& GetTextColor ();
895+ nux::Color& GetBackgroundTop ();
896+ nux::Color& GetBackgroundBottom ();
897+ nux::Color& GetTextShadow ();
898+
899+ GdkPixbuf * GetBackground (int width, int height);
900+
901+ nux::BaseTexture * GetWindowButton (WindowButtonType type, WindowState state);
902+
903+ GdkPixbuf * GetHomeButton ();
904+
905+ sigc::signal<void> changed;
906+
907+ private:
908+ void Refresh ();
909+ static void OnStyleChanged (GObject* gobject,
910+ GParamSpec* pspec,
911+ gpointer data);
912+ nux::BaseTexture * GetWindowButtonForTheme (WindowButtonType type, WindowState state);
913+ private:
914+ GtkWidget *_offscreen;
915+ char *_theme_name;
916+ nux::Color _text;
917+ nux::Color _bg_top;
918+ nux::Color _bg_bottom;
919+ nux::Color _text_shadow;
920+};
921+
922+#endif // PANEL_STYLE_H
923
924=== added file 'src/PanelTray.cpp'
925--- src/PanelTray.cpp 1970-01-01 00:00:00 +0000
926+++ src/PanelTray.cpp 2011-02-17 10:02:19 +0000
927@@ -0,0 +1,231 @@
928+/*
929+ * Copyright (C) 2010 Canonical Ltd
930+ *
931+ * This program is free software: you can redistribute it and/or modify
932+ * it under the terms of the GNU General Public License version 3 as
933+ * published by the Free Software Foundation.
934+ *
935+ * This program is distributed in the hope that it will be useful,
936+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
937+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
938+ * GNU General Public License for more details.
939+ *
940+ * You should have received a copy of the GNU General Public License
941+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
942+ *
943+ * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
944+ */
945+
946+#include "PanelTray.h"
947+
948+#define SETTINGS_NAME "com.canonical.Unity.Panel"
949+#define PADDING 3
950+
951+PanelTray::PanelTray ()
952+: _n_children (0),
953+ _last_x (0),
954+ _last_y (0)
955+{
956+ _settings = g_settings_new (SETTINGS_NAME);
957+ _whitelist = g_settings_get_strv (_settings, "systray-whitelist");
958+
959+ _window = gtk_window_new (GTK_WINDOW_POPUP);
960+ gtk_window_set_type_hint (GTK_WINDOW (_window), GDK_WINDOW_TYPE_HINT_DOCK);
961+ //gtk_window_set_keep_above (GTK_WINDOW (_window), TRUE);
962+ gtk_window_set_skip_pager_hint (GTK_WINDOW (_window), TRUE);
963+ gtk_window_set_skip_taskbar_hint (GTK_WINDOW (_window), TRUE);
964+ gtk_window_resize (GTK_WINDOW (_window), 1, 24);
965+ gtk_window_move (GTK_WINDOW (_window), 200, 12);
966+ gtk_widget_set_name (_window, "UnityPanelApplet");
967+ gtk_widget_set_colormap (_window, gdk_screen_get_rgba_colormap (gdk_screen_get_default ()));
968+ gtk_widget_realize (_window);
969+ gdk_window_set_back_pixmap (_window->window, NULL, FALSE);
970+ gtk_widget_set_app_paintable (_window, TRUE);
971+ g_signal_connect (_window, "expose-event", G_CALLBACK (PanelTray::OnTrayExpose), this);
972+
973+ if (!g_getenv ("UNITY_PANEL_TRAY_DISABLE"))
974+ {
975+ _tray = na_tray_new_for_screen (gdk_screen_get_default (),
976+ GTK_ORIENTATION_HORIZONTAL,
977+ (NaTrayFilterCallback)FilterTrayCallback,
978+ this);
979+ g_signal_connect (na_tray_get_manager (_tray), "tray_icon_removed",
980+ G_CALLBACK (PanelTray::OnTrayIconRemoved), this);
981+
982+ gtk_container_add (GTK_CONTAINER (_window), GTK_WIDGET (_tray));
983+ gtk_widget_show (GTK_WIDGET (_tray));
984+
985+ gtk_widget_show_all (_window);
986+ }
987+}
988+
989+PanelTray::~PanelTray ()
990+{
991+ g_strfreev (_whitelist);
992+ g_object_unref (_settings);
993+}
994+
995+void
996+PanelTray::Draw (nux::GraphicsEngine& gfx_content, bool force_draw)
997+{
998+ nux::Geometry geo = GetGeometry ();
999+
1000+ if (geo.x != _last_x || geo.y != _last_y)
1001+ {
1002+ _last_x = geo.x;
1003+ _last_y = geo.y;
1004+
1005+ gtk_window_move (GTK_WINDOW (_window), geo.x + PADDING, geo.y);
1006+ }
1007+}
1008+
1009+Window
1010+PanelTray::GetTrayWindow ()
1011+{
1012+ return GDK_WINDOW_XWINDOW (_window->window);
1013+}
1014+
1015+void
1016+PanelTray::Sync ()
1017+{
1018+ SetMinMaxSize ((_n_children * 24) + (PADDING * 2), 24);
1019+ ComputeChildLayout ();
1020+
1021+ QueueDraw ();
1022+}
1023+
1024+gboolean
1025+PanelTray::FilterTrayCallback (NaTray *tray, NaTrayChild *icon, PanelTray *self)
1026+{
1027+ char *title;
1028+ char *res_name = NULL;
1029+ char *res_class = NULL;
1030+ char *name;
1031+ int i = 0;
1032+ bool accept = false;
1033+
1034+ title = na_tray_child_get_title (icon);
1035+ na_tray_child_get_wm_class (icon, &res_name, &res_class);
1036+
1037+ while ((name = self->_whitelist[i]))
1038+ {
1039+ if (g_strcmp0 (name, "all") == 0)
1040+ {
1041+ accept = true;
1042+ break;
1043+ }
1044+ else if (!name || g_strcmp0 (name, "") == 0)
1045+ {
1046+ accept = false;
1047+ break;
1048+ }
1049+ else if (g_str_has_prefix (title, name)
1050+ || g_str_has_prefix (res_name, name)
1051+ || g_str_has_prefix (res_class, name))
1052+ {
1053+ accept = true;
1054+ break;
1055+ }
1056+
1057+ i++;
1058+ }
1059+
1060+ if (accept)
1061+ {
1062+ if (na_tray_child_has_alpha (icon))
1063+ na_tray_child_set_composited (icon, TRUE);
1064+
1065+ self->_n_children++;
1066+ g_idle_add ((GSourceFunc)IdleSync, self);
1067+ }
1068+
1069+ g_debug ("TrayChild %s: %s %s", na_tray_child_get_title (icon), res_name, res_class);
1070+
1071+ g_free (res_name);
1072+ g_free (res_class);
1073+ g_free (title);
1074+
1075+ return accept ? TRUE : FALSE;
1076+}
1077+
1078+void
1079+PanelTray::OnTrayIconRemoved (NaTrayManager *manager, NaTrayChild *child, PanelTray *self)
1080+{
1081+ g_idle_add ((GSourceFunc)IdleSync, self);
1082+ self->_n_children--;
1083+}
1084+
1085+gboolean
1086+PanelTray::IdleSync (PanelTray *self)
1087+{
1088+ self->Sync ();
1089+ return FALSE;
1090+}
1091+
1092+gboolean
1093+PanelTray::OnTrayExpose (GtkWidget *widget, GdkEventExpose *ev, PanelTray *tray)
1094+{
1095+ cairo_t *cr = gdk_cairo_create (widget->window);
1096+ GtkAllocation alloc;
1097+
1098+ gtk_widget_get_allocation (widget, &alloc);
1099+
1100+ gdk_cairo_region (cr, ev->region);
1101+ cairo_clip (cr);
1102+
1103+ cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
1104+ cairo_paint (cr);
1105+
1106+ cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
1107+ cairo_set_source_rgba (cr, 0.0f, 0.0f, 0.0f, 0.0f);
1108+ cairo_rectangle (cr, 0, 0, alloc.width, alloc.height);
1109+ cairo_fill (cr);
1110+
1111+ cairo_destroy (cr);
1112+
1113+ gtk_container_propagate_expose (GTK_CONTAINER (widget),
1114+ gtk_bin_get_child (GTK_BIN (widget)),
1115+ ev);
1116+
1117+ return FALSE;
1118+}
1119+
1120+//
1121+// We don't use these
1122+//
1123+void
1124+PanelTray::OnEntryAdded (IndicatorObjectEntryProxy *proxy)
1125+{
1126+
1127+}
1128+
1129+void
1130+PanelTray::OnEntryMoved (IndicatorObjectEntryProxy *proxy)
1131+{
1132+
1133+}
1134+
1135+void
1136+PanelTray::OnEntryRemoved (IndicatorObjectEntryProxy *proxy)
1137+{
1138+
1139+}
1140+
1141+const gchar *
1142+PanelTray::GetName ()
1143+{
1144+ return "PanelTray";
1145+}
1146+
1147+const gchar *
1148+PanelTray::GetChildsName ()
1149+{
1150+ return "";
1151+}
1152+
1153+void
1154+PanelTray::AddProperties (GVariantBuilder *builder)
1155+{
1156+
1157+}
1158+
1159
1160=== added file 'src/PanelTray.h'
1161--- src/PanelTray.h 1970-01-01 00:00:00 +0000
1162+++ src/PanelTray.h 2011-02-17 10:02:19 +0000
1163@@ -0,0 +1,73 @@
1164+/*
1165+ * Copyright (C) 2010 Canonical Ltd
1166+ *
1167+ * This program is free software: you can redistribute it and/or modify
1168+ * it under the terms of the GNU General Public License version 3 as
1169+ * published by the Free Software Foundation.
1170+ *
1171+ * This program is distributed in the hope that it will be useful,
1172+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1173+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1174+ * GNU General Public License for more details.
1175+ *
1176+ * You should have received a copy of the GNU General Public License
1177+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1178+ *
1179+ * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
1180+ */
1181+
1182+#ifndef PANEL_TRAY_H
1183+#define PANEL_TRAY_H
1184+
1185+#include <Nux/View.h>
1186+#include <gtk/gtk.h>
1187+
1188+#include <gdk/gdkx.h>
1189+
1190+#include "IndicatorObjectProxy.h"
1191+#include "Introspectable.h"
1192+#include "PanelIndicatorObjectView.h"
1193+
1194+#include <unity-misc/na-tray.h>
1195+#include <unity-misc/na-tray-child.h>
1196+#include <unity-misc/na-tray-manager.h>
1197+
1198+class PanelTray : public PanelIndicatorObjectView
1199+{
1200+public:
1201+
1202+ PanelTray ();
1203+ ~PanelTray ();
1204+
1205+ void Draw (nux::GraphicsEngine& gfx_content, bool force_draw);
1206+
1207+ Window GetTrayWindow ();
1208+
1209+ void Sync ();
1210+
1211+ void OnEntryAdded (IndicatorObjectEntryProxy *proxy);
1212+ void OnEntryMoved (IndicatorObjectEntryProxy *proxy);
1213+ void OnEntryRemoved (IndicatorObjectEntryProxy *proxy);
1214+
1215+public:
1216+ int _n_children;
1217+ char **_whitelist;
1218+protected:
1219+ const gchar * GetName ();
1220+ const gchar * GetChildsName ();
1221+ void AddProperties (GVariantBuilder *builder);
1222+
1223+private:
1224+ static gboolean FilterTrayCallback (NaTray *tray, NaTrayChild *child, PanelTray *self);
1225+ static void OnTrayIconRemoved (NaTrayManager *manager, NaTrayChild *child, PanelTray *self);
1226+ static gboolean IdleSync (PanelTray *tray);
1227+ static gboolean OnTrayExpose (GtkWidget *widget, GdkEventExpose *ev, PanelTray *tray);
1228+
1229+private:
1230+ GSettings *_settings;
1231+ GtkWidget *_window;
1232+ NaTray *_tray;
1233+ int _last_x;
1234+ int _last_y;
1235+};
1236+#endif
1237
1238=== modified file 'src/PanelView.cpp'
1239--- src/PanelView.cpp 2011-02-11 12:44:17 +0000
1240+++ src/PanelView.cpp 2011-02-17 10:02:19 +0000
1241@@ -32,6 +32,7 @@
1242 #include <glib.h>
1243
1244 #include "PanelView.h"
1245+#include "PanelStyle.h"
1246
1247 #include "IndicatorObjectFactoryRemote.h"
1248 #include "PanelIndicatorObjectView.h"
1249@@ -39,8 +40,13 @@
1250 NUX_IMPLEMENT_OBJECT_TYPE (PanelView);
1251
1252 PanelView::PanelView (NUX_FILE_LINE_DECL)
1253-: View (NUX_FILE_LINE_PARAM)
1254+: View (NUX_FILE_LINE_PARAM),
1255+ _is_dirty (true),
1256+ _opacity (1.0f)
1257 {
1258+ _style = new PanelStyle ();
1259+ _style->changed.connect (sigc::mem_fun (this, &PanelView::ForceUpdateBackground));
1260+
1261 _bg_layer = new nux::ColorLayer (nux::Color (0xff595853), true);
1262
1263 _layout = new nux::HLayout ("", NUX_TRACKER_LOCATION);
1264@@ -55,6 +61,10 @@
1265 _layout->AddView (_menu_view, 1, nux::eCenter, nux::eFull);
1266 AddChild (_menu_view);
1267
1268+ _tray = new PanelTray ();
1269+ _layout->AddView (_tray, 0, nux::eCenter, nux::eFull);
1270+ AddChild (_tray);
1271+
1272 _remote = new IndicatorObjectFactoryRemote ();
1273 _remote->OnObjectAdded.connect (sigc::mem_fun (this, &PanelView::OnObjectAdded));
1274 _remote->OnMenuPointerMoved.connect (sigc::mem_fun (this, &PanelView::OnMenuPointerMoved));
1275@@ -64,16 +74,11 @@
1276
1277 PanelView::~PanelView ()
1278 {
1279+ _style->UnReference ();
1280 delete _remote;
1281 delete _bg_layer;
1282 }
1283
1284-PanelHomeButton *
1285-PanelView::HomeButton ()
1286-{
1287- return _home_button;
1288-}
1289-
1290 const gchar* PanelView::GetName ()
1291 {
1292 return "Panel";
1293@@ -152,32 +157,16 @@
1294 {
1295 nux::Geometry geo = GetGeometry ();
1296
1297- if (geo.width == _last_width && geo.height == _last_height)
1298+ if (geo.width == _last_width && geo.height == _last_height && !_is_dirty)
1299 return;
1300
1301 _last_width = geo.width;
1302 _last_height = geo.height;
1303-
1304- nux::CairoGraphics cairo_graphics(CAIRO_FORMAT_ARGB32, _last_width, _last_height);
1305- cairo_t *cr = cairo_graphics.GetContext();
1306- cairo_set_line_width (cr, 1);
1307-
1308- cairo_pattern_t *pat = cairo_pattern_create_linear (0, 0, 0, _last_height);
1309- cairo_pattern_add_color_stop_rgb (pat, 0.0f, 89/255.0f, 88/255.0f, 83/255.0f);
1310- cairo_pattern_add_color_stop_rgb (pat, 1.0f, 50/255.0f, 50/255.0f, 45/255.0f);
1311- cairo_set_source (cr, pat);
1312- cairo_rectangle (cr, 0, 0, _last_width, _last_height);
1313- cairo_fill (cr);
1314- cairo_pattern_destroy (pat);
1315-
1316- cairo_destroy (cr);
1317-
1318- nux::NBitmapData* bitmap = cairo_graphics.GetBitmap();
1319-
1320- nux::BaseTexture* texture2D = nux::GetThreadGLDeviceFactory ()->CreateSystemCapableTexture ();
1321- texture2D->Update(bitmap);
1322- delete bitmap;
1323-
1324+ _is_dirty = false;
1325+
1326+ GdkPixbuf *pixbuf = _style->GetBackground (geo.width, geo.height);
1327+ nux::BaseTexture * texture2D = nux::CreateTexture2DFromPixbuf (pixbuf, true);
1328+ g_object_unref (pixbuf);
1329 nux::TexCoordXForm texxform;
1330 texxform.SetTexCoordType (nux::TexCoordXForm::OFFSET_COORD);
1331 texxform.SetWrap (nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT);
1332@@ -185,42 +174,78 @@
1333 delete _bg_layer;
1334
1335 nux::ROPConfig rop;
1336- rop.Blend = false; // Disable the blending. By default rop.Blend is false.
1337- rop.SrcBlend = GL_ONE; // Set the source blend factor.
1338- rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA; // Set the destination blend factor.
1339+ rop.Blend = true;
1340+ rop.SrcBlend = GL_ONE;
1341+ rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
1342+ nux::Color col = nux::Color::White;
1343+ col.SetAlpha (_opacity);
1344
1345 _bg_layer = new nux::TextureLayer (texture2D->GetDeviceTexture(),
1346- texxform, // The Oject that defines the texture wraping and coordinate transformation.
1347- nux::Color::White, // The color used to modulate the texture.
1348- true, // Write the alpha value of the texture to the destination buffer.
1349- rop // Use the given raster operation to set the blending when the layer is being rendered.
1350- );
1351-
1352+ texxform,
1353+ col,
1354+ true,
1355+ rop);
1356 texture2D->UnReference ();
1357
1358 NeedRedraw ();
1359 }
1360
1361+void
1362+PanelView::ForceUpdateBackground ()
1363+{
1364+ std::list<Area *>::iterator it;
1365+
1366+ _is_dirty = true;
1367+ UpdateBackground ();
1368+
1369+ std::list<Area *> my_children = _layout->GetChildren ();
1370+ for (it = my_children.begin(); it != my_children.end(); it++)
1371+ {
1372+ PanelIndicatorObjectView *view = static_cast<PanelIndicatorObjectView *> (*it);
1373+
1374+ view->QueueDraw ();
1375+ if (view->_layout == NULL)
1376+ continue;
1377+
1378+ std::list<Area *>::iterator it2;
1379+
1380+ std::list<Area *> its_children = view->_layout->GetChildren ();
1381+ for (it2 = its_children.begin(); it2 != its_children.end(); it2++)
1382+ {
1383+ PanelIndicatorObjectEntryView *entry = static_cast<PanelIndicatorObjectEntryView *> (*it2);
1384+ entry->QueueDraw ();
1385+ }
1386+ }
1387+ _home_button->QueueDraw ();
1388+ QueueDraw ();
1389+}
1390+
1391 //
1392 // Signals
1393 //
1394 void
1395 PanelView::OnObjectAdded (IndicatorObjectProxy *proxy)
1396 {
1397- PanelIndicatorObjectView *view = new PanelIndicatorObjectView (proxy);
1398-
1399+ PanelIndicatorObjectView *view;
1400+
1401 // Appmenu is treated differently as it needs to expand
1402 // We could do this in a more special way, but who has the time for special?
1403 if (g_strstr_len (proxy->GetName ().c_str (), -1, "appmenu") != NULL)
1404+ {
1405+ view = _menu_view;
1406 _menu_view->SetProxy (proxy);
1407+ }
1408 else
1409+ {
1410+ view = new PanelIndicatorObjectView (proxy);
1411+
1412 _layout->AddView (view, 0, nux::eCenter, nux::eFull);
1413+ AddChild (view);
1414+ }
1415
1416 _layout->SetContentDistribution (nux::eStackLeft);
1417
1418- AddChild (view);
1419-
1420- this->ComputeChildLayout ();
1421+ ComputeChildLayout ();
1422 NeedRedraw ();
1423 }
1424
1425@@ -307,3 +332,61 @@
1426 if (g_strcmp0 (entry_id, "") == 0)
1427 _menu_view->AllMenusClosed ();
1428 }
1429+
1430+//
1431+// Useful Public Methods
1432+//
1433+PanelHomeButton *
1434+PanelView::HomeButton ()
1435+{
1436+ return _home_button;
1437+}
1438+
1439+void
1440+PanelView::StartFirstMenuShow ()
1441+{
1442+
1443+}
1444+
1445+void
1446+PanelView::EndFirstMenuShow ()
1447+{
1448+ std::list<Area *>::iterator it;
1449+
1450+ std::list<Area *> my_children = _layout->GetChildren ();
1451+ for (it = my_children.begin(); it != my_children.end(); it++)
1452+ {
1453+ PanelIndicatorObjectView *view = static_cast<PanelIndicatorObjectView *> (*it);
1454+
1455+ if (view->_layout == NULL)
1456+ continue;
1457+
1458+ std::list<Area *>::iterator it2;
1459+
1460+ std::list<Area *> its_children = view->_layout->GetChildren ();
1461+ for (it2 = its_children.begin(); it2 != its_children.end(); it2++)
1462+ {
1463+ PanelIndicatorObjectEntryView *entry = static_cast<PanelIndicatorObjectEntryView *> (*it2);
1464+
1465+ entry->Activate ();
1466+ return;
1467+ }
1468+ }
1469+}
1470+
1471+Window
1472+PanelView::GetTrayWindow ()
1473+{
1474+ return _tray->GetTrayWindow ();
1475+}
1476+
1477+void
1478+PanelView::SetOpacity (float opacity)
1479+{
1480+ if (_opacity == opacity)
1481+ return;
1482+
1483+ _opacity = opacity;
1484+
1485+ ForceUpdateBackground ();
1486+}
1487
1488=== modified file 'src/PanelView.h'
1489--- src/PanelView.h 2011-02-14 13:18:26 +0000
1490+++ src/PanelView.h 2011-02-17 10:02:19 +0000
1491@@ -24,10 +24,14 @@
1492 #include <Nux/TextureArea.h>
1493 #include <NuxGraphics/GraphicsEngine.h>
1494
1495+#include <gdk/gdkx.h>
1496+
1497+#include "IndicatorObjectFactoryRemote.h"
1498+#include "Introspectable.h"
1499 #include "PanelHomeButton.h"
1500 #include "PanelMenuView.h"
1501-#include "IndicatorObjectFactoryRemote.h"
1502-#include "Introspectable.h"
1503+#include "PanelTray.h"
1504+#include "PanelStyle.h"
1505
1506 class PanelView : public Introspectable, public nux::View
1507 {
1508@@ -50,6 +54,13 @@
1509
1510 PanelHomeButton * HomeButton ();
1511
1512+ void StartFirstMenuShow ();
1513+ void EndFirstMenuShow ();
1514+
1515+ Window GetTrayWindow ();
1516+
1517+ void SetOpacity (float opacity);
1518+
1519 protected:
1520 // Introspectable methods
1521 const gchar * GetName ();
1522@@ -58,17 +69,23 @@
1523
1524 private:
1525 void UpdateBackground ();
1526+ void ForceUpdateBackground ();
1527
1528 private:
1529 IndicatorObjectFactoryRemote *_remote;
1530
1531 PanelHomeButton *_home_button;
1532 PanelMenuView *_menu_view;
1533+ PanelTray *_tray;
1534 nux::AbstractPaintLayer *_bg_layer;
1535 nux::HLayout *_layout;
1536-
1537+
1538 int _last_width;
1539 int _last_height;
1540+
1541+ PanelStyle *_style;
1542+ bool _is_dirty;
1543+ float _opacity;
1544 };
1545
1546 #endif // PANEL_VIEW_H
1547
1548=== modified file 'src/WindowButtons.cpp'
1549--- src/WindowButtons.cpp 2011-02-01 17:33:26 +0000
1550+++ src/WindowButtons.cpp 2011-02-17 10:02:19 +0000
1551@@ -29,33 +29,20 @@
1552
1553 #include <glib.h>
1554
1555-
1556-// FIXME: This will be all automatic in the future
1557-#define AMBIANCE "/usr/share/themes/Ambiance/metacity-1"
1558-
1559-enum
1560-{
1561- BUTTON_CLOSE=0,
1562- BUTTON_MINIMISE,
1563- BUTTON_UNMAXIMISE
1564-};
1565-
1566+#include "PanelStyle.h"
1567 class WindowButton : public nux::Button
1568 {
1569 // A single window button
1570 public:
1571- WindowButton (int type)
1572+ WindowButton (PanelStyle::WindowButtonType type)
1573 : nux::Button ("X", NUX_TRACKER_LOCATION),
1574+ _type (type),
1575 _normal_tex (NULL),
1576 _prelight_tex (NULL),
1577 _pressed_tex (NULL)
1578 {
1579- if (type == BUTTON_CLOSE)
1580- LoadImages ("close");
1581- else if (type == BUTTON_MINIMISE)
1582- LoadImages ("minimize");
1583- else
1584- LoadImages ("unmaximize");
1585+ LoadImages ();
1586+ PanelStyle::GetDefault ()->changed.connect (sigc::mem_fun (this, &WindowButton::LoadImages));
1587 }
1588
1589 ~WindowButton ()
1590@@ -101,60 +88,29 @@
1591 GfxContext.PopClippingRectangle();
1592 }
1593
1594- void LoadImages (const char *name)
1595+ void LoadImages ()
1596 {
1597- //FIXME: We need to somehow be theme aware. Or, at least support the themes
1598- // we know and have a good default fallback
1599- gchar *filename;
1600- GError *error = NULL;
1601- GdkPixbuf *_normal;
1602- GdkPixbuf *_prelight;
1603- GdkPixbuf *_pressed;
1604-
1605- filename = g_strdup_printf ("%s/%s.png", AMBIANCE, name);
1606- _normal = gdk_pixbuf_new_from_file (filename, &error);
1607- if (error)
1608- {
1609- g_warning ("Unable to load window button %s: %s", filename, error->message);
1610- g_error_free (error);
1611- error = NULL;
1612- }
1613- else
1614- _normal_tex = nux::CreateTexture2DFromPixbuf (_normal, true);
1615- g_free (filename);
1616- g_object_unref (_normal);
1617-
1618- filename = g_strdup_printf ("%s/%s_focused_prelight.png", AMBIANCE, name);
1619- _prelight = gdk_pixbuf_new_from_file (filename, &error);
1620- if (error)
1621- {
1622- g_warning ("Unable to load window button %s: %s", filename, error->message);
1623- g_error_free (error);
1624- error = NULL;
1625- }
1626- else
1627- _prelight_tex = nux::CreateTexture2DFromPixbuf (_prelight, true);
1628- g_free (filename);
1629- g_object_unref (_prelight);
1630-
1631- filename = g_strdup_printf ("%s/%s_focused_pressed.png", AMBIANCE, name);
1632- _pressed = gdk_pixbuf_new_from_file (filename, &error);
1633- if (error)
1634- {
1635- g_warning ("Unable to load window button %s: %s", name, error->message);
1636- g_error_free (error);
1637- error = NULL;
1638- }
1639- else
1640- _pressed_tex = nux::CreateTexture2DFromPixbuf (_pressed, true);
1641- g_free (filename);
1642- g_object_unref (_pressed);
1643-
1644- if (_normal_tex)
1645- SetMinimumSize (_normal_tex->GetWidth (), _normal_tex->GetHeight ());
1646+ PanelStyle *style = PanelStyle::GetDefault ();
1647+
1648+ if (_normal_tex)
1649+ _normal_tex->UnReference ();
1650+ if (_prelight_tex)
1651+ _prelight_tex->UnReference ();
1652+ if (_pressed_tex)
1653+ _pressed_tex->UnReference ();
1654+
1655+ _normal_tex = style->GetWindowButton (_type, PanelStyle::WINDOW_STATE_NORMAL);
1656+ _prelight_tex = style->GetWindowButton (_type, PanelStyle::WINDOW_STATE_PRELIGHT);
1657+ _pressed_tex = style->GetWindowButton (_type, PanelStyle::WINDOW_STATE_PRESSED);
1658+
1659+ if (_normal_tex)
1660+ SetMinMaxSize (_normal_tex->GetWidth (), _normal_tex->GetHeight ());
1661+
1662+ QueueDraw ();
1663 }
1664
1665 private:
1666+ PanelStyle::WindowButtonType _type;
1667 nux::BaseTexture *_normal_tex;
1668 nux::BaseTexture *_prelight_tex;
1669 nux::BaseTexture *_pressed_tex;
1670@@ -166,19 +122,19 @@
1671 {
1672 WindowButton *but;
1673
1674- but = new WindowButton (BUTTON_CLOSE);
1675+ but = new WindowButton (PanelStyle::WINDOW_BUTTON_CLOSE);
1676 AddView (but, 0, nux::eCenter, nux::eFix);
1677 but->sigClick.connect (sigc::mem_fun (this, &WindowButtons::OnCloseClicked));
1678 but->OnMouseEnter.connect (sigc::mem_fun (this, &WindowButtons::RecvMouseEnter));
1679 but->OnMouseLeave.connect (sigc::mem_fun (this, &WindowButtons::RecvMouseLeave));
1680
1681- but = new WindowButton (BUTTON_MINIMISE);
1682+ but = new WindowButton (PanelStyle::WINDOW_BUTTON_MINIMIZE);
1683 AddView (but, 0, nux::eCenter, nux::eFix);
1684 but->sigClick.connect (sigc::mem_fun (this, &WindowButtons::OnMinimizeClicked));
1685 but->OnMouseEnter.connect (sigc::mem_fun (this, &WindowButtons::RecvMouseEnter));
1686 but->OnMouseLeave.connect (sigc::mem_fun (this, &WindowButtons::RecvMouseLeave));
1687
1688- but = new WindowButton (BUTTON_UNMAXIMISE);
1689+ but = new WindowButton (PanelStyle::WINDOW_BUTTON_UNMAXIMIZE);
1690 AddView (but, 0, nux::eCenter, nux::eFix);
1691 but->sigClick.connect (sigc::mem_fun (this, &WindowButtons::OnRestoreClicked));
1692 but->OnMouseEnter.connect (sigc::mem_fun (this, &WindowButtons::RecvMouseEnter));
1693
1694=== modified file 'src/unityshell.cpp'
1695--- src/unityshell.cpp 2011-02-16 14:51:55 +0000
1696+++ src/unityshell.cpp 2011-02-17 10:02:19 +0000
1697@@ -223,6 +223,28 @@
1698 }
1699
1700 bool
1701+UnityScreen::showPanelFirstMenuKeyInitiate (CompAction *action,
1702+ CompAction::State state,
1703+ CompOption::Vector &options)
1704+{
1705+ // to receive the Terminate event
1706+ if (state & CompAction::StateInitKey)
1707+ action->setState (action->state () | CompAction::StateTermKey);
1708+
1709+ panelView->StartFirstMenuShow ();
1710+ return false;
1711+}
1712+
1713+bool
1714+UnityScreen::showPanelFirstMenuKeyTerminate (CompAction *action,
1715+ CompAction::State state,
1716+ CompOption::Vector &options)
1717+{
1718+ panelView->EndFirstMenuShow ();
1719+ return false;
1720+}
1721+
1722+bool
1723 UnityScreen::setKeyboardFocusKeyInitiate (CompAction *action,
1724 CompAction::State state,
1725 CompOption::Vector &options)
1726@@ -473,6 +495,8 @@
1727 case UnityshellOptions::UrgentAnimation:
1728 launcher->SetUrgentAnimation ((Launcher::UrgentAnimation) optionGetUrgentAnimation ());
1729 break;
1730+ case UnityshellOptions::PanelOpacity:
1731+ panelView->SetOpacity (optionGetPanelOpacity ());
1732 case UnityshellOptions::AutohideAnimation:
1733 launcher->SetAutoHideAnimation ((Launcher::AutoHideAnimation) optionGetAutohideAnimation ());
1734 break;
1735@@ -558,15 +582,18 @@
1736
1737 debugger = new DebugDBusInterface (this);
1738
1739- optionSetLauncherHideModeNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));
1740- optionSetBacklightModeNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));
1741- optionSetLaunchAnimationNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));
1742- optionSetUrgentAnimationNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));
1743+ optionSetLauncherHideModeNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));
1744+ optionSetBacklightModeNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));
1745+ optionSetLaunchAnimationNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));
1746+ optionSetUrgentAnimationNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));
1747+ optionSetPanelOpacityNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));
1748 optionSetAutohideAnimationNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));
1749- optionSetShowLauncherInitiate (boost::bind (&UnityScreen::showLauncherKeyInitiate, this, _1, _2, _3));
1750- optionSetShowLauncherTerminate (boost::bind (&UnityScreen::showLauncherKeyTerminate, this, _1, _2, _3));
1751- optionSetKeyboardFocusInitiate (boost::bind (&UnityScreen::setKeyboardFocusKeyInitiate, this, _1, _2, _3));
1752+ optionSetShowLauncherInitiate (boost::bind (&UnityScreen::showLauncherKeyInitiate, this, _1, _2, _3));
1753+ optionSetShowLauncherTerminate (boost::bind (&UnityScreen::showLauncherKeyTerminate, this, _1, _2, _3));
1754+ optionSetKeyboardFocusInitiate (boost::bind (&UnityScreen::setKeyboardFocusKeyInitiate, this, _1, _2, _3));
1755 //optionSetKeyboardFocusTerminate (boost::bind (&UnityScreen::setKeyboardFocusKeyTerminate, this, _1, _2, _3));
1756+ optionSetPanelFirstMenuInitiate (boost::bind (&UnityScreen::showPanelFirstMenuKeyInitiate, this, _1, _2, _3));
1757+ optionSetPanelFirstMenuTerminate(boost::bind (&UnityScreen::showPanelFirstMenuKeyTerminate, this, _1, _2, _3));
1758
1759 ubus_server_register_interest (ubus_server_get_default (),
1760 UBUS_LAUNCHER_EXIT_KEY_NAV,
1761
1762=== modified file 'src/unityshell.h'
1763--- src/unityshell.h 2011-02-10 21:50:31 +0000
1764+++ src/unityshell.h 2011-02-17 10:02:19 +0000
1765@@ -104,6 +104,14 @@
1766 CompOption::Vector &options);
1767
1768 bool
1769+ showPanelFirstMenuKeyInitiate (CompAction *action,
1770+ CompAction::State state,
1771+ CompOption::Vector &options);
1772+ bool
1773+ showPanelFirstMenuKeyTerminate (CompAction *action,
1774+ CompAction::State state,
1775+ CompOption::Vector &options);
1776+ bool
1777 setKeyboardFocusKeyInitiate (CompAction* action,
1778 CompAction::State state,
1779 CompOption::Vector& options);
1780
1781=== modified file 'tests/CMakeLists.txt'
1782--- tests/CMakeLists.txt 2011-02-10 14:34:30 +0000
1783+++ tests/CMakeLists.txt 2011-02-17 10:02:19 +0000
1784@@ -75,6 +75,8 @@
1785
1786 add_executable (test-panel
1787 TestPanel.cpp
1788+ ../src/PanelStyle.cpp
1789+ ../src/PanelStyle.h
1790 ../src/PanelView.cpp
1791 ../src/PanelView.h
1792 ../src/PanelIndicatorObjectView.cpp
1793@@ -83,6 +85,8 @@
1794 ../src/PanelIndicatorObjectEntryView.h
1795 ../src/PanelTitlebarGrabAreaView.h
1796 ../src/PanelTitlebarGrabAreaView.cpp
1797+ ../src/PanelTray.cpp
1798+ ../src/PanelTray.h
1799 ../src/IndicatorObjectFactory.h
1800 ../src/IndicatorObjectProxy.h
1801 ../src/IndicatorObjectEntryProxy.h
1802
1803=== modified file 'tests/TestPanel.cpp'
1804--- tests/TestPanel.cpp 2010-11-05 17:00:30 +0000
1805+++ tests/TestPanel.cpp 2011-02-17 10:02:19 +0000
1806@@ -33,8 +33,8 @@
1807 nux::VLayout *layout = new nux::VLayout(TEXT(""), NUX_TRACKER_LOCATION);
1808 PanelView *view = new PanelView ();
1809
1810- view->SetMinMaxSize(1024, 24);
1811- layout->AddView(view, 1, nux::eCenter, nux::eFix);
1812+ //view->SetMinMaxSize(1024, 24);
1813+ layout->AddView(view, 1, nux::eCenter, nux::eFull);
1814 layout->SetContentDistribution(nux::eStackCenter);
1815
1816 nux::GetGraphicsThread()->SetLayout (layout);
1817
1818=== modified file 'unityshell.xml.in'
1819--- unityshell.xml.in 2011-02-16 12:57:32 +0000
1820+++ unityshell.xml.in 2011-02-17 10:02:19 +0000
1821@@ -68,11 +68,15 @@
1822 <default>&lt;Super&gt;</default>
1823 </option>
1824 <option name="keyboard_focus" type="key">
1825- <_short>Key to put keyboard-focus on launcher</_short>
1826- <_long>Set the keyboard-focus on the launcher so it can be navigated with the cursor-keys</_long>
1827- <default>&lt;Alt&gt;F1</default>
1828+ <_short>Key to put keyboard-focus on launcher</_short>
1829+ <_long>Set the keyboard-focus on the launcher so it can be navigated with the cursor-keys</_long>
1830+ <default>&lt;Alt&gt;F1</default>
1831 </option>
1832- </group>
1833+ <option name="panel_first_menu" type="key">
1834+ <_short>Key to open the first panel menu</_short>
1835+ <_long>Open the first menu on the panel, allowing keyboard navigation thereafter.</_long>
1836+ <default>F10</default>
1837+ </option> </group>
1838 <group>
1839 <_short>Experimental</_short>
1840 <option name="backlight_mode" type="int">
1841@@ -132,6 +136,14 @@
1842 <_name>Wiggle</_name>
1843 </desc>
1844 </option>
1845+ <option type="float" name="panel_opacity">
1846+ <_short>Panel Opacity</_short>
1847+ <_long>The opacity of the Panel background.</_long>
1848+ <default>1.0</default>
1849+ <min>0.0</min>
1850+ <max>1.0</max>
1851+ <precision>0.01</precision>
1852+ </option>
1853 <option name="autohide_animation" type="int">
1854 <_short>Hide Animation</_short>
1855 <_long>Animation played when the launcher is showing or hiding</_long>