Merge lp:~diego-rocha-comp/wingpanel/fix-1473563 into lp:~wingpanel-devs/wingpanel/trunk
- fix-1473563
- Merge into trunk
Proposed by
Diego Rocha
Status: | Merged |
---|---|
Approved by: | Cody Garver |
Approved revision: | 109 |
Merged at revision: | 109 |
Proposed branch: | lp:~diego-rocha-comp/wingpanel/fix-1473563 |
Merge into: | lp:~wingpanel-devs/wingpanel/trunk |
Diff against target: |
342 lines (+102/-51) 6 files modified
src/Services/BackgroundManager.vala (+3/-2) src/Widgets/Panel.vala (+9/-2) wingpanel-interface/BackgroundManager.vala (+54/-14) wingpanel-interface/CMakeLists.txt (+1/-1) wingpanel-interface/DBusServer.vala (+4/-4) wingpanel-interface/Utils.vala (+31/-28) |
To merge this branch: | bzr merge lp:~diego-rocha-comp/wingpanel/fix-1473563 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
WingPanel Devs | Pending | ||
Review via email: mp+286452@code.launchpad.net |
Commit message
Improve the logic used to define the panel's style by accounting for luminance, contrast and sharpness, and adding the TRANSLUCENT state.
This new state is used when the desktop wallpaper is complex or has high contrast.
Description of the change
Improves the logic used to define the panel's style by accounting for luminance, contrast and sharpness, and adding the TRANSLUCENT state.
This new state is used when the desktop wallpaper is complex or has high contrast.
Depends on https:/
To post a comment you must log in.
- 108. By Diego Rocha
-
backgroundmanager: added TRANSLUCENT state and improved state selection logic
- 109. By Diego Rocha
-
backgroundmanager: load background color information before checking for initial state
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/Services/BackgroundManager.vala' | |||
2 | --- src/Services/BackgroundManager.vala 2015-12-02 20:52:48 +0000 | |||
3 | +++ src/Services/BackgroundManager.vala 2016-02-19 22:10:36 +0000 | |||
4 | @@ -21,7 +21,8 @@ | |||
5 | 21 | public enum BackgroundState { | 21 | public enum BackgroundState { |
6 | 22 | LIGHT, | 22 | LIGHT, |
7 | 23 | DARK, | 23 | DARK, |
9 | 24 | MAXIMIZED | 24 | MAXIMIZED, |
10 | 25 | TRANSLUCENT | ||
11 | 25 | } | 26 | } |
12 | 26 | 27 | ||
13 | 27 | [DBus (name = "org.pantheon.gala.WingpanelInterface")] | 28 | [DBus (name = "org.pantheon.gala.WingpanelInterface")] |
14 | @@ -113,4 +114,4 @@ | |||
15 | 113 | return instance; | 114 | return instance; |
16 | 114 | } | 115 | } |
17 | 115 | } | 116 | } |
18 | 116 | } | ||
19 | 117 | \ No newline at end of file | 117 | \ No newline at end of file |
20 | 118 | } | ||
21 | 118 | 119 | ||
22 | === modified file 'src/Widgets/Panel.vala' | |||
23 | --- src/Widgets/Panel.vala 2015-10-21 21:48:36 +0000 | |||
24 | +++ src/Widgets/Panel.vala 2016-02-19 22:10:36 +0000 | |||
25 | @@ -18,8 +18,6 @@ | |||
26 | 18 | */ | 18 | */ |
27 | 19 | 19 | ||
28 | 20 | public class Wingpanel.Widgets.Panel : Gtk.Box { | 20 | public class Wingpanel.Widgets.Panel : Gtk.Box { |
29 | 21 | private static const double ALPHA_ANIMATION_STEP = 0.05; | ||
30 | 22 | |||
31 | 23 | public Services.PopoverManager popover_manager { get; construct; } | 21 | public Services.PopoverManager popover_manager { get; construct; } |
32 | 24 | 22 | ||
33 | 25 | private IndicatorMenuBar right_menubar; | 23 | private IndicatorMenuBar right_menubar; |
34 | @@ -126,16 +124,25 @@ | |||
35 | 126 | style_context.add_class ("color-light"); | 124 | style_context.add_class ("color-light"); |
36 | 127 | style_context.remove_class ("color-dark"); | 125 | style_context.remove_class ("color-dark"); |
37 | 128 | style_context.remove_class ("maximized"); | 126 | style_context.remove_class ("maximized"); |
38 | 127 | style_context.remove_class ("translucent"); | ||
39 | 129 | break; | 128 | break; |
40 | 130 | case Services.BackgroundState.LIGHT: | 129 | case Services.BackgroundState.LIGHT: |
41 | 131 | style_context.add_class ("color-dark"); | 130 | style_context.add_class ("color-dark"); |
42 | 132 | style_context.remove_class ("color-light"); | 131 | style_context.remove_class ("color-light"); |
43 | 133 | style_context.remove_class ("maximized"); | 132 | style_context.remove_class ("maximized"); |
44 | 133 | style_context.remove_class ("translucent"); | ||
45 | 134 | break; | 134 | break; |
46 | 135 | case Services.BackgroundState.MAXIMIZED: | 135 | case Services.BackgroundState.MAXIMIZED: |
47 | 136 | style_context.add_class ("maximized"); | 136 | style_context.add_class ("maximized"); |
48 | 137 | style_context.remove_class ("color-light"); | 137 | style_context.remove_class ("color-light"); |
49 | 138 | style_context.remove_class ("color-dark"); | 138 | style_context.remove_class ("color-dark"); |
50 | 139 | style_context.remove_class ("translucent"); | ||
51 | 140 | break; | ||
52 | 141 | case Services.BackgroundState.TRANSLUCENT: | ||
53 | 142 | style_context.add_class ("translucent"); | ||
54 | 143 | style_context.remove_class ("color-light"); | ||
55 | 144 | style_context.remove_class ("color-dark"); | ||
56 | 145 | style_context.remove_class ("maximized"); | ||
57 | 139 | break; | 146 | break; |
58 | 140 | } | 147 | } |
59 | 141 | } | 148 | } |
60 | 142 | 149 | ||
61 | === renamed file 'wingpanel-interface/AlphaManager.vala' => 'wingpanel-interface/BackgroundManager.vala' | |||
62 | --- wingpanel-interface/AlphaManager.vala 2015-12-02 20:28:08 +0000 | |||
63 | +++ wingpanel-interface/BackgroundManager.vala 2016-02-19 22:10:36 +0000 | |||
64 | @@ -20,11 +20,15 @@ | |||
65 | 20 | public enum BackgroundState { | 20 | public enum BackgroundState { |
66 | 21 | LIGHT, | 21 | LIGHT, |
67 | 22 | DARK, | 22 | DARK, |
69 | 23 | MAXIMIZED | 23 | MAXIMIZED, |
70 | 24 | TRANSLUCENT | ||
71 | 24 | } | 25 | } |
72 | 25 | 26 | ||
74 | 26 | public class WingpanelInterface.AlphaManager : Object { | 27 | public class WingpanelInterface.BackgroundManager : Object { |
75 | 27 | private const int WALLPAPER_TRANSITION_DURATION = 150; | 28 | private const int WALLPAPER_TRANSITION_DURATION = 150; |
76 | 29 | private const double ACUTANCE_THRESHOLD = 8; | ||
77 | 30 | private const double STD_THRESHOLD = 45; | ||
78 | 31 | private const double LUMINANCE_THRESHOLD = 180; | ||
79 | 28 | 32 | ||
80 | 29 | public signal void state_changed (BackgroundState state, uint animation_duration); | 33 | public signal void state_changed (BackgroundState state, uint animation_duration); |
81 | 30 | 34 | ||
82 | @@ -36,16 +40,20 @@ | |||
83 | 36 | private Meta.Workspace? current_workspace = null; | 40 | private Meta.Workspace? current_workspace = null; |
84 | 37 | 41 | ||
85 | 38 | private BackgroundState current_state = BackgroundState.LIGHT; | 42 | private BackgroundState current_state = BackgroundState.LIGHT; |
87 | 39 | private bool needs_dark_background = false; | 43 | |
88 | 44 | private Utils.ColorInformation? bk_color_info = null; | ||
89 | 40 | 45 | ||
91 | 41 | public AlphaManager (int monitor, int panel_height) { | 46 | public BackgroundManager (int monitor, int panel_height) { |
92 | 42 | Object (monitor : monitor, panel_height: panel_height); | 47 | Object (monitor : monitor, panel_height: panel_height); |
93 | 43 | 48 | ||
94 | 44 | connect_signals (); | 49 | connect_signals (); |
96 | 45 | update_current_workspace (); | 50 | update_bk_color_info.begin ((obj, res) => { |
97 | 51 | update_bk_color_info.end (res); | ||
98 | 52 | update_current_workspace (); | ||
99 | 53 | }); | ||
100 | 46 | } | 54 | } |
101 | 47 | 55 | ||
103 | 48 | ~AlphaManager () { | 56 | ~BackgroundManager () { |
104 | 49 | var signal_id = GLib.Signal.lookup ("changed", Main.wm.background_group.get_type ()); | 57 | var signal_id = GLib.Signal.lookup ("changed", Main.wm.background_group.get_type ()); |
105 | 50 | GLib.Signal.remove_emission_hook (signal_id, wallpaper_hook_id); | 58 | GLib.Signal.remove_emission_hook (signal_id, wallpaper_hook_id); |
106 | 51 | } | 59 | } |
107 | @@ -58,7 +66,10 @@ | |||
108 | 58 | var signal_id = GLib.Signal.lookup ("changed", Main.wm.background_group.get_type ()); | 66 | var signal_id = GLib.Signal.lookup ("changed", Main.wm.background_group.get_type ()); |
109 | 59 | 67 | ||
110 | 60 | wallpaper_hook_id = GLib.Signal.add_emission_hook (signal_id, 0, (ihint, param_values) => { | 68 | wallpaper_hook_id = GLib.Signal.add_emission_hook (signal_id, 0, (ihint, param_values) => { |
112 | 61 | update_alpha_state.begin (); | 69 | update_bk_color_info.begin ((obj, res) => { |
113 | 70 | update_bk_color_info.end (res); | ||
114 | 71 | check_for_state_change (WALLPAPER_TRANSITION_DURATION); | ||
115 | 72 | }); | ||
116 | 62 | 73 | ||
117 | 63 | return true; | 74 | return true; |
118 | 64 | }, null); | 75 | }, null); |
119 | @@ -112,14 +123,35 @@ | |||
120 | 112 | check_for_state_change (AnimationSettings.get_default ().snap_duration); | 123 | check_for_state_change (AnimationSettings.get_default ().snap_duration); |
121 | 113 | } | 124 | } |
122 | 114 | 125 | ||
128 | 115 | public async void update_alpha_state () { | 126 | public async void update_bk_color_info () { |
129 | 116 | Utils.background_needed.begin (Main.wm, monitor, panel_height, (obj, res) => { | 127 | SourceFunc callback = update_bk_color_info.callback; |
130 | 117 | needs_dark_background = Utils.background_needed.end (res); | 128 | Gdk.Rectangle monitor_geometry; |
131 | 118 | 129 | ||
132 | 119 | check_for_state_change (WALLPAPER_TRANSITION_DURATION); | 130 | Gdk.Screen.get_default ().get_monitor_geometry (monitor, out monitor_geometry); |
133 | 131 | |||
134 | 132 | Utils.get_background_color_information.begin (Main.wm, monitor, 0, 0, monitor_geometry.width, panel_height, (obj, res) => { | ||
135 | 133 | try { | ||
136 | 134 | bk_color_info = Utils.get_background_color_information.end (res); | ||
137 | 135 | } catch (Error e) { | ||
138 | 136 | warning (e.message); | ||
139 | 137 | } finally { | ||
140 | 138 | callback (); | ||
141 | 139 | } | ||
142 | 120 | }); | 140 | }); |
143 | 141 | |||
144 | 142 | yield; | ||
145 | 121 | } | 143 | } |
146 | 122 | 144 | ||
147 | 145 | /** | ||
148 | 146 | * Check if Wingpanel's background state should change. | ||
149 | 147 | * | ||
150 | 148 | * The state is defined as follows: | ||
151 | 149 | * - If there's a maximized window, the state should be MAXIMIZED; | ||
152 | 150 | * - If no information about the background could be gathered, it should be TRANSLUCENT; | ||
153 | 151 | * - If there's too much contrast or sharpness, it should be TRANSLUCENT; | ||
154 | 152 | * - If the background is too bright, it should be DARK; | ||
155 | 153 | * - Else it should be LIGHT. | ||
156 | 154 | */ | ||
157 | 123 | private void check_for_state_change (uint animation_duration) { | 155 | private void check_for_state_change (uint animation_duration) { |
158 | 124 | bool has_maximized_window = false; | 156 | bool has_maximized_window = false; |
159 | 125 | 157 | ||
160 | @@ -136,12 +168,20 @@ | |||
161 | 136 | 168 | ||
162 | 137 | if (has_maximized_window) { | 169 | if (has_maximized_window) { |
163 | 138 | new_state = BackgroundState.MAXIMIZED; | 170 | new_state = BackgroundState.MAXIMIZED; |
164 | 171 | } else if (bk_color_info == null) { | ||
165 | 172 | new_state = BackgroundState.TRANSLUCENT; | ||
166 | 139 | } else { | 173 | } else { |
168 | 140 | new_state = needs_dark_background ? BackgroundState.DARK : BackgroundState.LIGHT; | 174 | var luminance_std = Math.sqrt (bk_color_info.luminance_variance); |
169 | 175 | |||
170 | 176 | new_state = luminance_std > STD_THRESHOLD || | ||
171 | 177 | (bk_color_info.mean_luminance < LUMINANCE_THRESHOLD && | ||
172 | 178 | bk_color_info.mean_luminance + 1.645 * luminance_std > LUMINANCE_THRESHOLD ) || | ||
173 | 179 | bk_color_info.mean_acutance > ACUTANCE_THRESHOLD ? BackgroundState.TRANSLUCENT : | ||
174 | 180 | bk_color_info.mean_luminance > LUMINANCE_THRESHOLD ? BackgroundState.DARK : BackgroundState.LIGHT; | ||
175 | 141 | } | 181 | } |
176 | 142 | 182 | ||
177 | 143 | if (new_state != current_state) { | 183 | if (new_state != current_state) { |
178 | 144 | state_changed (current_state = new_state, animation_duration); | 184 | state_changed (current_state = new_state, animation_duration); |
179 | 145 | } | 185 | } |
180 | 146 | } | 186 | } |
181 | 147 | } | ||
182 | 148 | \ No newline at end of file | 187 | \ No newline at end of file |
183 | 188 | } | ||
184 | 149 | 189 | ||
185 | === modified file 'wingpanel-interface/CMakeLists.txt' | |||
186 | --- wingpanel-interface/CMakeLists.txt 2015-05-25 16:19:07 +0000 | |||
187 | +++ wingpanel-interface/CMakeLists.txt 2016-02-19 22:10:36 +0000 | |||
188 | @@ -14,7 +14,7 @@ | |||
189 | 14 | vala_precompile (VALA_C ${WINGPANELINTERFACE} | 14 | vala_precompile (VALA_C ${WINGPANELINTERFACE} |
190 | 15 | Main.vala | 15 | Main.vala |
191 | 16 | DBusServer.vala | 16 | DBusServer.vala |
193 | 17 | AlphaManager.vala | 17 | BackgroundManager.vala |
194 | 18 | FocusManager.vala | 18 | FocusManager.vala |
195 | 19 | Settings.vala | 19 | Settings.vala |
196 | 20 | Utils.vala | 20 | Utils.vala |
197 | 21 | 21 | ||
198 | === modified file 'wingpanel-interface/DBusServer.vala' | |||
199 | --- wingpanel-interface/DBusServer.vala 2015-10-20 23:43:37 +0000 | |||
200 | +++ wingpanel-interface/DBusServer.vala 2016-02-19 22:10:36 +0000 | |||
201 | @@ -19,13 +19,13 @@ | |||
202 | 19 | 19 | ||
203 | 20 | [DBus (name = "org.pantheon.gala.WingpanelInterface")] | 20 | [DBus (name = "org.pantheon.gala.WingpanelInterface")] |
204 | 21 | public class WingpanelInterface.DBusServer : Object { | 21 | public class WingpanelInterface.DBusServer : Object { |
206 | 22 | private AlphaManager alpha_manager; | 22 | private BackgroundManager background_manager; |
207 | 23 | 23 | ||
208 | 24 | public signal void state_changed (BackgroundState state, uint animation_duration); | 24 | public signal void state_changed (BackgroundState state, uint animation_duration); |
209 | 25 | 25 | ||
210 | 26 | public void initialize (int monitor, int panel_height) { | 26 | public void initialize (int monitor, int panel_height) { |
213 | 27 | alpha_manager = new AlphaManager (monitor, panel_height); | 27 | background_manager = new BackgroundManager (monitor, panel_height); |
214 | 28 | alpha_manager.state_changed.connect ((state, animation_duration) => { | 28 | background_manager.state_changed.connect ((state, animation_duration) => { |
215 | 29 | state_changed (state, animation_duration); | 29 | state_changed (state, animation_duration); |
216 | 30 | }); | 30 | }); |
217 | 31 | } | 31 | } |
218 | @@ -37,4 +37,4 @@ | |||
219 | 37 | public void restore_focused_window () { | 37 | public void restore_focused_window () { |
220 | 38 | FocusManager.get_default ().restore_focused_window (); | 38 | FocusManager.get_default ().restore_focused_window (); |
221 | 39 | } | 39 | } |
222 | 40 | } | ||
223 | 41 | \ No newline at end of file | 40 | \ No newline at end of file |
224 | 41 | } | ||
225 | 42 | 42 | ||
226 | === modified file 'wingpanel-interface/Utils.vala' | |||
227 | --- wingpanel-interface/Utils.vala 2015-10-20 14:07:04 +0000 | |||
228 | +++ wingpanel-interface/Utils.vala 2016-02-19 22:10:36 +0000 | |||
229 | @@ -25,8 +25,6 @@ | |||
230 | 25 | namespace WingpanelInterface.Utils { | 25 | namespace WingpanelInterface.Utils { |
231 | 26 | private const double SATURATION_WEIGHT = 1.5; | 26 | private const double SATURATION_WEIGHT = 1.5; |
232 | 27 | private const double WEIGHT_THRESHOLD = 1.0; | 27 | private const double WEIGHT_THRESHOLD = 1.0; |
233 | 28 | private const double MIN_VARIANCE = 50; | ||
234 | 29 | private const double MIN_LUM = 25; | ||
235 | 30 | 28 | ||
236 | 31 | private class DummyOffscreenEffect : Clutter.OffscreenEffect { | 29 | private class DummyOffscreenEffect : Clutter.OffscreenEffect { |
237 | 32 | public signal void done_painting (); | 30 | public signal void done_painting (); |
238 | @@ -41,8 +39,9 @@ | |||
239 | 41 | double average_red; | 39 | double average_red; |
240 | 42 | double average_green; | 40 | double average_green; |
241 | 43 | double average_blue; | 41 | double average_blue; |
244 | 44 | double mean; | 42 | double mean_luminance; |
245 | 45 | double variance; | 43 | double luminance_variance; |
246 | 44 | double mean_acutance; | ||
247 | 46 | } | 45 | } |
248 | 47 | 46 | ||
249 | 48 | public async ColorInformation get_background_color_information (Gala.WindowManager wm, int monitor, | 47 | public async ColorInformation get_background_color_information (Gala.WindowManager wm, int monitor, |
250 | @@ -68,7 +67,7 @@ | |||
251 | 68 | throw new DBusError.INVALID_ARGS ("Invalid rectangle specified: %i, %i, %i, %i".printf (x_start, y_start, width, height)); | 67 | throw new DBusError.INVALID_ARGS ("Invalid rectangle specified: %i, %i, %i, %i".printf (x_start, y_start, width, height)); |
252 | 69 | } | 68 | } |
253 | 70 | 69 | ||
255 | 71 | double variance = 0, mean = 0, rTotal = 0, gTotal = 0, bTotal = 0; | 70 | double mean_acutance = 0, variance = 0, mean = 0, rTotal = 0, gTotal = 0, bTotal = 0; |
256 | 72 | ulong paint_signal_handler = 0; | 71 | ulong paint_signal_handler = 0; |
257 | 73 | 72 | ||
258 | 74 | paint_signal_handler = effect.done_painting.connect (() => { | 73 | paint_signal_handler = effect.done_painting.connect (() => { |
259 | @@ -77,6 +76,7 @@ | |||
260 | 77 | 76 | ||
261 | 78 | var texture = (Cogl.Texture)effect.get_texture (); | 77 | var texture = (Cogl.Texture)effect.get_texture (); |
262 | 79 | var pixels = new uint8[texture.get_width () * texture.get_height () * 4]; | 78 | var pixels = new uint8[texture.get_width () * texture.get_height () * 4]; |
263 | 79 | var pixel_lums = new double[texture.get_width () * texture.get_height ()]; | ||
264 | 80 | 80 | ||
265 | 81 | CoglFixes.texture_get_data (texture, Cogl.PixelFormat.BGRA_8888_PRE, 0, pixels); | 81 | CoglFixes.texture_get_data (texture, Cogl.PixelFormat.BGRA_8888_PRE, 0, pixels); |
266 | 82 | 82 | ||
267 | @@ -100,7 +100,9 @@ | |||
268 | 100 | uint8 g = pixels[i + 1]; | 100 | uint8 g = pixels[i + 1]; |
269 | 101 | uint8 b = pixels[i + 2]; | 101 | uint8 b = pixels[i + 2]; |
270 | 102 | 102 | ||
272 | 103 | pixel = (0.3 * r + 0.6 * g + 0.11 * b) - 128f; | 103 | pixel = (0.3 * r + 0.59 * g + 0.11 * b) ; |
273 | 104 | |||
274 | 105 | pixel_lums[y * width + x] = pixel; | ||
275 | 104 | 106 | ||
276 | 105 | min = uint8.min (r, uint8.min (g, b)); | 107 | min = uint8.min (r, uint8.min (g, b)); |
277 | 106 | max = uint8.max (r, uint8.max (g, b)); | 108 | max = uint8.max (r, uint8.max (g, b)); |
278 | @@ -123,6 +125,21 @@ | |||
279 | 123 | mean_squares += pixel * pixel; | 125 | mean_squares += pixel * pixel; |
280 | 124 | } | 126 | } |
281 | 125 | } | 127 | } |
282 | 128 | |||
283 | 129 | for (int y = y_start + 1; y < height - 1; y++) { | ||
284 | 130 | for (int x = x_start + 1; x < width - 1; x++) { | ||
285 | 131 | var acutance = | ||
286 | 132 | (pixel_lums[y * width + x] * 4) - | ||
287 | 133 | ( | ||
288 | 134 | pixel_lums[y * width + x - 1] + | ||
289 | 135 | pixel_lums[y * width + x + 1] + | ||
290 | 136 | pixel_lums[(y - 1) * width + x] + | ||
291 | 137 | pixel_lums[(y + 1) * width + x] | ||
292 | 138 | ); | ||
293 | 139 | |||
294 | 140 | mean_acutance += acutance > 0 ? acutance : -acutance; | ||
295 | 141 | } | ||
296 | 142 | } | ||
297 | 126 | 143 | ||
298 | 127 | scoreTotal /= size; | 144 | scoreTotal /= size; |
299 | 128 | bTotal /= size; | 145 | bTotal /= size; |
300 | @@ -163,9 +180,11 @@ | |||
301 | 163 | } | 180 | } |
302 | 164 | 181 | ||
303 | 165 | mean /= size; | 182 | mean /= size; |
305 | 166 | mean_squares *= mean_squares / size; | 183 | mean_squares = mean_squares / size; |
306 | 167 | 184 | ||
308 | 168 | variance = Math.sqrt (mean_squares - mean * mean) / (double)size; | 185 | variance = (mean_squares - (mean * mean)); |
309 | 186 | |||
310 | 187 | mean_acutance /= (width - 2) * (height - 2); | ||
311 | 169 | 188 | ||
312 | 170 | get_background_color_information.callback (); | 189 | get_background_color_information.callback (); |
313 | 171 | }); | 190 | }); |
314 | @@ -174,23 +193,7 @@ | |||
315 | 174 | 193 | ||
316 | 175 | yield; | 194 | yield; |
317 | 176 | 195 | ||
318 | 177 | return { rTotal, gTotal, bTotal, mean, variance }; | ||
319 | 178 | } | ||
320 | 179 | |||
321 | 180 | public async bool background_needed (Gala.WindowManager wm, int screen, int panel_height) { | ||
322 | 181 | Gdk.Rectangle monitor_geometry; | ||
323 | 182 | ColorInformation? color_info = null; | ||
324 | 183 | |||
325 | 184 | Gdk.Screen.get_default ().get_monitor_geometry (screen, out monitor_geometry); | ||
326 | 185 | |||
327 | 186 | try { | ||
328 | 187 | color_info = yield get_background_color_information (wm, screen, 0, 0, monitor_geometry.width, panel_height); | ||
329 | 188 | } catch (Error e) { | ||
330 | 189 | warning (e.message); | ||
331 | 190 | |||
332 | 191 | return false; | ||
333 | 192 | } | ||
334 | 193 | |||
335 | 194 | return color_info != null && (color_info.mean > MIN_LUM || color_info.variance > MIN_VARIANCE); | ||
336 | 195 | } | ||
337 | 196 | } | ||
338 | 197 | \ No newline at end of file | 196 | \ No newline at end of file |
339 | 197 | return { rTotal, gTotal, bTotal, mean, variance, mean_acutance }; | ||
340 | 198 | } | ||
341 | 199 | |||
342 | 200 | } |