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