Merge lp:~elementary-pantheon/wingpanel/background-opacity-gala into lp:~elementary-pantheon/wingpanel/trunk-0.3.x

Proposed by Tom Beckmann
Status: Merged
Approved by: Danielle Foré
Approved revision: 159
Merged at revision: 155
Proposed branch: lp:~elementary-pantheon/wingpanel/background-opacity-gala
Merge into: lp:~elementary-pantheon/wingpanel/trunk-0.3.x
Diff against target: 469 lines (+260/-24)
7 files modified
CMakeLists.txt (+6/-1)
org.pantheon.desktop.wingpanel.gschema.xml (+11/-1)
src/Services/BackgroundManager.vala (+110/-0)
src/Services/Settings.vala (+2/-0)
src/Widgets/BasePanel.vala (+111/-19)
src/Widgets/Panel.vala (+16/-3)
src/WingpanelApp.vala (+4/-0)
To merge this branch: bzr merge lp:~elementary-pantheon/wingpanel/background-opacity-gala
Reviewer Review Type Date Requested Status
Victor Martinez (community) Approve
Danielle Foré Needs Fixing
Review via email: mp+210347@code.launchpad.net

This proposal supersedes a proposal from 2014-03-09.

Commit message

Uses the gala dbus API to get the alpha value of the background. Adds a transition when changing alpha and uses wnck to check for maximized windows on the current screen

Description of the change

This is a new version of the branch written by Jacob Parker, which uses the proposed gala dbus API to get the alpha value of the background. It also adds a transition when changing alpha and uses wnck to check for maximized windows on the current screen as requested in https://bugs.launchpad.net/wingpanel/+bug/1011830.

We may want to consider checking the area which is filled with windows instead of just if there's a maximized one, but that's up to the designers to decide.

To post a comment you must log in.
Revision history for this message
Victor Martinez (victored) wrote : Posted in a previous version of this proposal

is lp:wingpanel intentionally the target branch?

(instead of lp:wingpanel/0.3.x, which would make the diff much smaller)

Revision history for this message
Tom Beckmann (tombeckmann) wrote :

No, it wasn't. Thanks for notifying me :)

Revision history for this message
Danielle Foré (danrabbit) wrote :

Going opaque with maximized windows is working for me, which is cool.

But it's not changing opacity with the wallpaper. I'm getting this output:

wingpanel_services_settings_get_background_alpha: assertion 'self != NULL' failed

Revision history for this message
Danielle Foré (danrabbit) wrote :

I've noticed that killing the panel (after changing wallpaper) causes it to change. But it looks pretty binary. I'm only getting either completely transparent or like 80% opacity. Nothing at all in between.

Revision history for this message
Danielle Foré (danrabbit) :
review: Needs Fixing
Revision history for this message
Tom Beckmann (tombeckmann) wrote :

The algorithm currently works with a min variance and mean color value. If it's below that it just uses 0.7 alpha. I could try with some interpolation, but I'm not sure if I can get it to work properly. I just took the alrogithm by Jacob Parker here, too.

Revision history for this message
Tom Beckmann (tombeckmann) wrote :

Also, when there's a maximized window, do you want full opaque or the 0.7 we use for the light wallpapers too?

Revision history for this message
Danielle Foré (danrabbit) wrote :

Okay, I'm actually fine with doing 0 or some value as long as we make that value a lot lighter. Cassidy and I think that 0.3 works pretty well.

Yeah, I think it would better to go fully opaque when it's maximized.

So with the above change, the only real problem I have is that I have to kill the panel to get it to change instead of it changing when I change the wallpaper.

157. By Tom Beckmann

use 0.3 as min alpha value, go fully opaque when there is a maximized window

Revision history for this message
Tom Beckmann (tombeckmann) wrote :

Could you run "dbus-monitor | grep BackgroundChanged" in a terminal, change the background and look if something happens in the terminal? There should be some messages popping up.

I changed the min alpha value, the one that is taken when the wallpaper is found to be too light, to 0.3 now. Wingpanel will go fully opaque now when there's a maximized window. To me it appears very dark now, maybe you'll want to test if that is really the best way to do it. Also, maybe you could see if the logic for testing for a maximized window is already good enough or if we want to do something more complex. It will only go opaque currently if there's some window on the current workspace maximized. It won't go opaque for example when there are multiple non maximized windows obscuring the whole desktop.

Revision history for this message
Danielle Foré (danrabbit) wrote :

Hey Tom,

I don't have any output there. Is there something I need to do to start the dbus service?

the black looks right for me, but I also have a black display :p

158. By Victor Martinez

Fix null Settings instance in BasePanel and correct coding style issues

159. By Victor Martinez

replace tabs by four spaces

Revision history for this message
Victor Martinez (victored) wrote :

Tom, this branch works great!

I've fixed the failed-assertion issue pointed out by Daniel above, which was related to a null Settings instance in BasePanel.

I also made a couple of corrections regarding the coding style, since the branch was using Gala's in some portions.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2013-10-16 09:36:11 +0000
+++ CMakeLists.txt 2014-03-17 21:44:46 +0000
@@ -37,13 +37,14 @@
37 gobject-2.037 gobject-2.0
38 glib-2.038 glib-2.0
39 gio-2.039 gio-2.0
40 gee-1.040 gee-0.8
41 gdk-x11-3.041 gdk-x11-3.0
42 x1142 x11
43 gtk+-3.043 gtk+-3.0
44 granite44 granite
45 indicator3-0.445 indicator3-0.4
46 libido3-0.146 libido3-0.1
47 libwnck-3.0
47)48)
4849
49set (WINGPANEL_DEPS_NOVALA50set (WINGPANEL_DEPS_NOVALA
@@ -72,6 +73,8 @@
72link_libraries(${DEPS_LIBRARIES} ${DEPS_NOVALA_LIBRARIES})73link_libraries(${DEPS_LIBRARIES} ${DEPS_NOVALA_LIBRARIES})
73link_directories(${DEPS_LIBRARY_DIRS} ${DEPS_NOVALA_DIRS})74link_directories(${DEPS_LIBRARY_DIRS} ${DEPS_NOVALA_DIRS})
7475
76add_definitions (-DWNCK_I_KNOW_THIS_IS_UNSTABLE)
77
75# Handle Vala Compilation78# Handle Vala Compilation
76find_package(Vala REQUIRED)79find_package(Vala REQUIRED)
77include(ValaVersion)80include(ValaVersion)
@@ -101,6 +104,7 @@
101 src/Services/AppLauncherService.vala104 src/Services/AppLauncherService.vala
102 src/Services/LauncherRunner.vala105 src/Services/LauncherRunner.vala
103 src/Services/IndicatorSorter.vala106 src/Services/IndicatorSorter.vala
107 src/Services/BackgroundManager.vala
104PACKAGES108PACKAGES
105 ${WINGPANEL_DEPS}109 ${WINGPANEL_DEPS}
106CUSTOM_VAPIS110CUSTOM_VAPIS
@@ -120,6 +124,7 @@
120124
121# Create the Executable125# Create the Executable
122add_executable(${EXEC_NAME} ${VALA_C})126add_executable(${EXEC_NAME} ${VALA_C})
127target_link_libraries(${EXEC_NAME} m)
123128
124# Installation129# Installation
125install (TARGETS ${EXEC_NAME} RUNTIME DESTINATION bin)130install (TARGETS ${EXEC_NAME} RUNTIME DESTINATION bin)
126131
=== modified file 'org.pantheon.desktop.wingpanel.gschema.xml'
--- org.pantheon.desktop.wingpanel.gschema.xml 2012-07-08 03:02:36 +0000
+++ org.pantheon.desktop.wingpanel.gschema.xml 2014-03-17 21:44:46 +0000
@@ -13,7 +13,17 @@
13 <key type="s" name="default-launcher">13 <key type="s" name="default-launcher">
14 <default>"slingshot-launcher"</default>14 <default>"slingshot-launcher"</default>
15 <summary>The default program to use as App launcher.</summary>15 <summary>The default program to use as App launcher.</summary>
16 <description>Description</description>16 <description>The default program to use as App launcher.</description>
17 </key>
18 <key type="d" name="background-alpha">
19 <default>0.8</default>
20 <summary>Background opacity variable.</summary>
21 <description>Background opacity variable (must be between zero and one).</description>
22 </key>
23 <key type="b" name="auto-adjust-alpha">
24 <default>true</default>
25 <summary>Automatically update background alpha.</summary>
26 <description>Automatically update the background alpha to zero if it will be readable, else 0.8.</description>
17 </key>27 </key>
18 </schema>28 </schema>
19</schemalist>29</schemalist>
2030
=== added file 'src/Services/BackgroundManager.vala'
--- src/Services/BackgroundManager.vala 1970-01-01 00:00:00 +0000
+++ src/Services/BackgroundManager.vala 2014-03-17 21:44:46 +0000
@@ -0,0 +1,110 @@
1// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-
2//
3// Copyright (C) 2014 Wingpanel Developers
4//
5// This program is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18namespace Wingpanel.Services {
19 struct ColorInformation {
20 double average_red;
21 double average_green;
22 double average_blue;
23 double mean;
24 double variance;
25 }
26
27 [DBus (name = "org.pantheon.gala")]
28 interface GalaDBus : Object {
29 public signal void background_changed ();
30 public async abstract ColorInformation get_background_color_information (int monitor,
31 int x, int y, int width, int height) throws IOError;
32 }
33
34 public class BackgroundManager : Object {
35 public static const double MIN_ALPHA = 0.3;
36
37 private const int HEIGHT = 50;
38 private const double MIN_VARIANCE = 50;
39 private const double MIN_LUM = 25;
40
41 /**
42 * Emitted when the background changed. It supplies the alpha value that
43 * can be used with this wallpaper while maintining legibility
44 */
45 public signal void update_background_alpha (double legible_alpha_value);
46
47 private Services.Settings settings;
48 private Gdk.Screen screen;
49 private GalaDBus gala_dbus;
50
51 public BackgroundManager (Services.Settings settings, Gdk.Screen screen) {
52 this.settings = settings;
53 this.screen = screen;
54 establish_connection ();
55 }
56
57 private void establish_connection () {
58 try {
59 gala_dbus = Bus.get_proxy_sync (BusType.SESSION,
60 "org.pantheon.gala",
61 "/org/pantheon/gala");
62 gala_dbus.background_changed.connect (on_background_change);
63 on_background_change ();
64 } catch (Error e) {
65 gala_dbus = null;
66 warning ("Auto-adjustment of background opacity not available, " +
67 "connecting to gala dbus failed: %s", e.message);
68 return;
69 }
70 }
71
72 private void on_background_change () {
73 if (!settings.auto_adjust_alpha)
74 return;
75
76 calculate_alpha.begin ((obj, res) => {
77 var alpha = calculate_alpha.end (res);
78 update_background_alpha (alpha);
79 });
80 }
81
82 private async double calculate_alpha () {
83 double alpha = 0;
84 Gdk.Rectangle monitor_geometry;
85 ColorInformation? color_info = null;
86
87 var primary = screen.get_primary_monitor ();
88 screen.get_monitor_geometry (primary, out monitor_geometry);
89
90 try {
91 color_info = yield gala_dbus.get_background_color_information (
92 primary, // monitor index
93 0, // x of reference rect
94 0, // y of rect
95 monitor_geometry.width, // width of rect
96 HEIGHT); // height of rect
97 } catch (Error e) {
98 warning (e.message);
99 alpha = MIN_ALPHA;
100 }
101
102 if (color_info != null
103 && (color_info.mean > MIN_LUM
104 || color_info.variance > MIN_VARIANCE))
105 alpha = MIN_ALPHA;
106
107 return alpha;
108 }
109 }
110}
0111
=== modified file 'src/Services/Settings.vala'
--- src/Services/Settings.vala 2013-04-14 07:54:25 +0000
+++ src/Services/Settings.vala 2014-03-17 21:44:46 +0000
@@ -23,6 +23,8 @@
23 public string[] blacklist { get; set; }23 public string[] blacklist { get; set; }
24 public bool show_launcher { get; set; }24 public bool show_launcher { get; set; }
25 public string default_launcher { get; set; }25 public string default_launcher { get; set; }
26 public double background_alpha { get; set; }
27 public bool auto_adjust_alpha { get; set; }
2628
27 public Settings () {29 public Settings () {
28 base ("org.pantheon.desktop.wingpanel");30 base ("org.pantheon.desktop.wingpanel");
2931
=== modified file 'src/Widgets/BasePanel.vala'
--- src/Widgets/BasePanel.vala 2013-08-07 10:18:24 +0000
+++ src/Widgets/BasePanel.vala 2014-03-17 21:44:46 +0000
@@ -1,17 +1,17 @@
1// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-1// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-
2// 2//
3// Copyright (C) 2011-2013 Wingpanel Developers3// Copyright (C) 2011-2014 Wingpanel Developers
4// 4//
5// This program is free software: you can redistribute it and/or modify5// This program is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.8// (at your option) any later version.
9// 9//
10// This program is distributed in the hope that it will be useful,10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.13// GNU General Public License for more details.
14// 14//
15// You should have received a copy of the GNU General Public License15// You should have received a copy of the GNU General Public License
16// along with this program. If not, see <http://www.gnu.org/licenses/>.16// along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
@@ -32,6 +32,8 @@
32 N_VALUES32 N_VALUES
33 }33 }
3434
35 protected Services.Settings settings { get; private set; }
36
35 private const int SHADOW_SIZE = 4;37 private const int SHADOW_SIZE = 4;
3638
37 private int panel_height = 0;39 private int panel_height = 0;
@@ -41,9 +43,19 @@
41 private int panel_displacement = -40;43 private int panel_displacement = -40;
42 private uint animation_timer = 0;44 private uint animation_timer = 0;
4345
46 private double legible_alpha_value = -1.0;
47 private double panel_alpha = 0.0;
48 private double panel_current_alpha = 0.0;
49 private uint panel_alpha_timer = 0;
50 const int FPS = 60;
51 const double ALPHA_ANIMATION_STEP = 0.05;
52
44 private PanelShadow shadow = new PanelShadow ();53 private PanelShadow shadow = new PanelShadow ();
4554 private Wnck.Screen wnck_screen;
46 public BasePanel () {55
56 public BasePanel (Services.Settings settings) {
57 this.settings = settings;
58
47 decorated = false;59 decorated = false;
48 resizable = false;60 resizable = false;
49 skip_taskbar_hint = true;61 skip_taskbar_hint = true;
@@ -58,6 +70,28 @@
58 screen.monitors_changed.connect (on_monitors_changed);70 screen.monitors_changed.connect (on_monitors_changed);
5971
60 destroy.connect (Gtk.main_quit);72 destroy.connect (Gtk.main_quit);
73
74 wnck_screen = Wnck.Screen.get_default ();
75 wnck_screen.active_workspace_changed.connect (update_panel_alpha);
76 wnck_screen.window_opened.connect ((window) => {
77 if (window.get_window_type () == Wnck.WindowType.NORMAL)
78 window.state_changed.connect (window_state_changed);
79 });
80 wnck_screen.window_closed.connect ((window) => {
81 if (window.get_window_type () == Wnck.WindowType.NORMAL)
82 window.state_changed.disconnect (window_state_changed);
83 });
84
85 update_panel_alpha ();
86 }
87
88 private void window_state_changed (Wnck.Window window,
89 Wnck.WindowState changed_mask, Wnck.WindowState new_state) {
90 if ((changed_mask & Wnck.WindowState.MAXIMIZED_HORIZONTALLY) != 0
91 || (changed_mask & Wnck.WindowState.MAXIMIZED_VERTICALLY) != 0
92 && (window.get_workspace () == wnck_screen.get_active_workspace ()
93 || window.is_sticky ()))
94 update_panel_alpha ();
61 }95 }
6296
63 protected abstract Gtk.StyleContext get_draw_style_context ();97 protected abstract Gtk.StyleContext get_draw_style_context ();
@@ -79,7 +113,11 @@
79 }113 }
80114
81 var ctx = get_draw_style_context ();115 var ctx = get_draw_style_context ();
82 ctx.render_background (cr, size.x, size.y, size.width, size.height);116 var background_color = ctx.get_background_color (Gtk.StateFlags.NORMAL);
117 background_color.alpha = panel_current_alpha;
118 Gdk.cairo_set_source_rgba (cr, background_color);
119 cr.rectangle (size.x, size.y, size.width, size.height);
120 cr.fill ();
83121
84 // Slide in122 // Slide in
85 if (animation_timer == 0) {123 if (animation_timer == 0) {
@@ -92,21 +130,75 @@
92 if (child != null)130 if (child != null)
93 propagate_draw (child, cr);131 propagate_draw (child, cr);
94132
95 if (!shadow.visible)133 if (panel_alpha > 1E-3) {
134 shadow.show ();
96 shadow.show_all ();135 shadow.show_all ();
136 } else
137 shadow.hide ();
97138
98 return true;139 return true;
99 }140 }
100141
142 public void update_opacity (double alpha) {
143 legible_alpha_value = alpha;
144 update_panel_alpha ();
145 }
146
147 private void update_panel_alpha () {
148 panel_alpha = settings.background_alpha;
149 if (settings.auto_adjust_alpha) {
150 if (active_workspace_has_maximized_window ())
151 panel_alpha = 1.0;
152 else if (legible_alpha_value >= 0)
153 panel_alpha = legible_alpha_value;
154 }
155
156 if (panel_current_alpha != panel_alpha)
157 panel_alpha_timer = Gdk.threads_add_timeout (1000 / FPS, draw_timeout);
158 }
159
160 private bool draw_timeout () {
161 queue_draw ();
162
163 if (panel_current_alpha > panel_alpha) {
164 panel_current_alpha -= ALPHA_ANIMATION_STEP;
165 panel_current_alpha = double.max (panel_current_alpha, panel_alpha);
166 } else if (panel_current_alpha < panel_alpha) {
167 panel_current_alpha += ALPHA_ANIMATION_STEP;
168 panel_current_alpha = double.min (panel_current_alpha, panel_alpha);
169 }
170
171 if (panel_current_alpha != panel_alpha)
172 return true;
173
174 if (panel_alpha_timer > 0) {
175 Source.remove (panel_alpha_timer);
176 panel_alpha_timer = 0;
177 }
178
179 return false;
180 }
181
101 private bool animation_callback () {182 private bool animation_callback () {
102 if (panel_displacement >= 0 ) {183 if (panel_displacement >= 0 )
103 return false;184 return false;
104 } else {185
105 panel_displacement += 1;186 panel_displacement += 1;
106 move (panel_x, panel_y + panel_displacement);187 move (panel_x, panel_y + panel_displacement);
107 shadow.move (panel_x, panel_y + panel_height + panel_displacement);188 shadow.move (panel_x, panel_y + panel_height + panel_displacement);
108 return true;189 return true;
190 }
191
192 private bool active_workspace_has_maximized_window () {
193 var workspace = wnck_screen.get_active_workspace ();
194
195 foreach (var window in wnck_screen.get_windows ()) {
196 if ((window.is_pinned () || window.get_workspace () == workspace)
197 && window.is_maximized ())
198 return true;
109 }199 }
200
201 return false;
110 }202 }
111203
112 private void on_monitors_changed () {204 private void on_monitors_changed () {
@@ -144,9 +236,9 @@
144 screen.get_monitor_geometry (screen.get_primary_monitor (), out monitor_dimensions);236 screen.get_monitor_geometry (screen.get_primary_monitor (), out monitor_dimensions);
145237
146 // if we have multiple monitors, we must check if the panel would be placed inbetween238 // if we have multiple monitors, we must check if the panel would be placed inbetween
147 // monitors. If that's the case we have to move it to the topmost, or we'll make the 239 // monitors. If that's the case we have to move it to the topmost, or we'll make the
148 // upper monitor unusable because of the struts.240 // upper monitor unusable because of the struts.
149 // First check if there are monitors overlapping horizontally and if they are higher 241 // First check if there are monitors overlapping horizontally and if they are higher
150 // our current highest, make this one the new highest and test all again242 // our current highest, make this one the new highest and test all again
151 if (screen.get_n_monitors () > 1) {243 if (screen.get_n_monitors () > 1) {
152 Gdk.Rectangle dimensions;244 Gdk.Rectangle dimensions;
@@ -156,8 +248,8 @@
156 && dimensions.x < monitor_dimensions.x + monitor_dimensions.width)248 && dimensions.x < monitor_dimensions.x + monitor_dimensions.width)
157 || (dimensions.x + dimensions.width > monitor_dimensions.x249 || (dimensions.x + dimensions.width > monitor_dimensions.x
158 && dimensions.x + dimensions.width <= monitor_dimensions.x + monitor_dimensions.width)250 && dimensions.x + dimensions.width <= monitor_dimensions.x + monitor_dimensions.width)
159 || (dimensions.x < monitor_dimensions.x251 || (dimensions.x < monitor_dimensions.x
160 && dimensions.x + dimensions.width > monitor_dimensions.x + monitor_dimensions.width))252 && dimensions.x + dimensions.width > monitor_dimensions.x + monitor_dimensions.width))
161 && dimensions.y < monitor_dimensions.y) {253 && dimensions.y < monitor_dimensions.y) {
162 warning ("Not placing wingpanel on the primary monitor because of problems" +254 warning ("Not placing wingpanel on the primary monitor because of problems" +
163 " with multimonitor setups");255 " with multimonitor setups");
164256
=== modified file 'src/Widgets/Panel.vala'
--- src/Widgets/Panel.vala 2013-09-13 08:51:05 +0000
+++ src/Widgets/Panel.vala 2014-03-17 21:44:46 +0000
@@ -2,7 +2,7 @@
2/***2/***
3 BEGIN LICENSE3 BEGIN LICENSE
44
5 Copyright (C) 2011-2012 Wingpanel Developers5 Copyright (C) 2011-2014 Wingpanel Developers
6 This program is free software: you can redistribute it and/or modify it6 This program is free software: you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License version 3, as published7 under the terms of the GNU Lesser General Public License version 3, as published
8 by the Free Software Foundation.8 by the Free Software Foundation.
@@ -32,10 +32,11 @@
32 private IndicatorLoader indicator_loader;32 private IndicatorLoader indicator_loader;
3333
34 public Panel (Gtk.Application app, Services.Settings settings, IndicatorLoader indicator_loader) {34 public Panel (Gtk.Application app, Services.Settings settings, IndicatorLoader indicator_loader) {
35 base (settings);
36
37 this.indicator_loader = indicator_loader;
35 set_application (app);38 set_application (app);
3639
37 this.indicator_loader = indicator_loader;
38
39 container = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);40 container = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
40 left_wrapper = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);41 left_wrapper = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
41 right_wrapper = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);42 right_wrapper = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
@@ -112,6 +113,18 @@
112 var gpr = new Gtk.SizeGroup (Gtk.SizeGroupMode.HORIZONTAL);113 var gpr = new Gtk.SizeGroup (Gtk.SizeGroupMode.HORIZONTAL);
113 gpr.add_widget (left_wrapper);114 gpr.add_widget (left_wrapper);
114 gpr.add_widget (right_wrapper);115 gpr.add_widget (right_wrapper);
116
117 // make sure those are all transparent when we later adjust the transparency
118 // in the panel's draw callback
119 clock.override_background_color (Gtk.StateFlags.NORMAL, Gdk.RGBA () {
120 red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0
121 });
122 menubar.override_background_color (Gtk.StateFlags.NORMAL, Gdk.RGBA () {
123 red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0
124 });
125 apps_menubar.override_background_color (Gtk.StateFlags.NORMAL, Gdk.RGBA () {
126 red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0
127 });
115 }128 }
116 }129 }
117}130}
118131
=== modified file 'src/WingpanelApp.vala'
--- src/WingpanelApp.vala 2013-09-13 08:51:05 +0000
+++ src/WingpanelApp.vala 2014-03-17 21:44:46 +0000
@@ -18,6 +18,7 @@
18public class Wingpanel.App : Granite.Application {18public class Wingpanel.App : Granite.Application {
19 private IndicatorLoader indicator_loader;19 private IndicatorLoader indicator_loader;
20 private Widgets.BasePanel panel;20 private Widgets.BasePanel panel;
21 private Services.BackgroundManager background_manager;
2122
22 construct {23 construct {
23 build_data_dir = Build.DATADIR;24 build_data_dir = Build.DATADIR;
@@ -41,6 +42,9 @@
41 panel = new Widgets.Panel (this, settings, indicator_loader);42 panel = new Widgets.Panel (this, settings, indicator_loader);
4243
43 panel.show_all ();44 panel.show_all ();
45
46 background_manager = new Services.BackgroundManager (settings, panel.get_screen ());
47 background_manager.update_background_alpha.connect (panel.update_opacity);
44 }48 }
4549
46 protected override void activate () {50 protected override void activate () {

Subscribers

People subscribed via source and target branches