Merge lp:~docky-core/plank/indicator-style into lp:plank
- indicator-style
- Merge into trunk
Status: | Work in progress |
---|---|
Proposed branch: | lp:~docky-core/plank/indicator-style |
Merge into: | lp:plank |
Diff against target: |
649 lines (+378/-47) 8 files modified
data/themes/Glowless/dock.theme (+70/-0) data/themes/Makefile.am (+5/-0) docs/Makefile.am (+1/-0) lib/DockRenderer.vala (+35/-42) lib/Drawing/DockTheme.vala (+193/-5) lib/Drawing/Enums.vala (+63/-0) lib/Makefile.am (+1/-0) lib/libplank.symbols (+10/-0) |
To merge this branch: | bzr merge lp:~docky-core/plank/indicator-style |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
truu (community) | testing | Needs Information | |
Docky Core | Pending | ||
Review via email:
|
Commit message
Description of the change
* Reworked indicator-drawing while adding some styles
(Branch will get rebased and squashed in self-contained/
TODO:
* Naming of new theme-settings needs some more thinking
* Add new theme "Modern" / "Flat" (?) which makes use of the new features
THOUGHTS:
* Moving caching in the theme rather than handle it in the renderer?
- 1550. By Rico Tzschichholz
-
surface: Some minor cleaning
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Rico Tzschichholz (ricotz) wrote : | # |
> Theme naming:
> I'd vote for "flat" in case of a theme with the line type indicator and
> "modern" in case of the circle.
Let's see how this turns out when the styles are finished ;-)
> Looks:
> The circular ones look better if their center is in the middle of bottom
> padding: http://
> An extra slight bump off the ground instead might look better too.
I am not really convinced here.
> The circles also end up a bit too close together at times, depending on the
> size set (indicatorsize 1 looked to be too close, while 1.2 looked fine at
> icon size 48)
> http://
Should be better now
> In my opinion lines should not indicate several instances being open, as it
> appears strange :D
> Neither chrome os nor windows seem to provide such information while having
> that kind of indicators. It feels as if the application were somehow divided
> into smaller fragments.
I agree here.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
truu (marten-truu) wrote : | # |
stroke_preserve seems to make the indicators strangely fuzzy :D
Can't really tell with circles but it's very noticeable with lines.
The lines are also now lifted slightly off the ground by about the amount that I like the indicators to be. But I suppose that's a up to personal preference.
I'll also add a side-by-side of the lifted and not circles with values I'd actually use:
http://
Perhaps of some use as reference when deciding which way to go.
tldr: imo the lines should be grounded and not fuzzy.
- 1551. By Rico Tzschichholz
-
drawing/color: Add support for HSL and some convenience functions
- 1555. By Rico Tzschichholz
-
WIP
- 1556. By Rico Tzschichholz
-
WIP
- 1557. By Rico Tzschichholz
-
WIP
- 1558. By Rico Tzschichholz
-
WIP
- 1559. By Rico Tzschichholz
-
WIP
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Rico Tzschichholz (ricotz) wrote : | # |
Unmerged revisions
- 1559. By Rico Tzschichholz
-
WIP
- 1558. By Rico Tzschichholz
-
WIP
- 1557. By Rico Tzschichholz
-
WIP
- 1556. By Rico Tzschichholz
-
WIP
- 1555. By Rico Tzschichholz
-
WIP
- 1554. By truu
-
Removed Spacing and Height options, probably created a weird style enum in a weird place and put some things where they should've been put all along.
- 1553. By truu
-
Add missing newline.
- 1552. By truu
-
Makes gradients optional by adding a few theming options.
Preview Diff
1 | === added directory 'data/themes/Glowless' |
2 | === added file 'data/themes/Glowless/dock.theme' |
3 | --- data/themes/Glowless/dock.theme 1970-01-01 00:00:00 +0000 |
4 | +++ data/themes/Glowless/dock.theme 2016-04-10 16:22:24 +0000 |
5 | @@ -0,0 +1,70 @@ |
6 | + |
7 | +[PlankTheme] |
8 | +#The roundness of the top corners. |
9 | +TopRoundness=4 |
10 | +#The roundness of the bottom corners. |
11 | +BottomRoundness=0 |
12 | +#The thickness (in pixels) of lines drawn. |
13 | +LineWidth=0 |
14 | +#The color (RGBA) of the outer stroke. |
15 | +OuterStrokeColor=255;;255;;255;;200 |
16 | +#The starting color (RGBA) of the fill gradient. |
17 | +FillStartColor=38;;50;;56;;200 |
18 | +#The ending color (RGBA) of the fill gradient. |
19 | +FillEndColor=38;;50;;56;;200 |
20 | +#The color (RGBA) of the inner stroke. |
21 | +InnerStrokeColor=2;;2;;2;;0 |
22 | + |
23 | +[PlankDockTheme] |
24 | +#The padding on the left/right dock edges, in tenths of a percent of IconSize. |
25 | +HorizPadding=1 |
26 | +#The padding on the top dock edge, in tenths of a percent of IconSize. |
27 | +TopPadding=1 |
28 | +#The padding on the bottom dock edge, in tenths of a percent of IconSize. |
29 | +BottomPadding=1.5 |
30 | +#The padding between items on the dock, in tenths of a percent of IconSize. |
31 | +ItemPadding=2 |
32 | +#The size of item indicators, in tenths of a percent of IconSize. |
33 | +IndicatorSize=5 |
34 | +#The size of the icon-shadow behind every item, in tenths of a percent of IconSize. |
35 | +IconShadowSize=1 |
36 | +#The style of item indicators (values 0 - 3), styles: 0 - circle-glow, 1 - circle-color-glow, 2 - circle, 3 - underline. |
37 | +IndicatorStyle=2 |
38 | +#The color (RGBA) of the indicator. |
39 | +IndicatorColor=225;;225;;225;;255 |
40 | +#The height (in percent of IconSize) to bounce an icon when the application sets urgent. |
41 | +UrgentBounceHeight=1.6666666666666667 |
42 | +#The height (in percent of IconSize) to bounce an icon when launching an application. |
43 | +LaunchBounceHeight=0.625 |
44 | +#The opacity value (0 to 1) to fade the dock to when hiding it. |
45 | +FadeOpacity=1 |
46 | +#The amount of time (in ms) for click animations. |
47 | +ClickTime=300 |
48 | +#The amount of time (in ms) to bounce an urgent icon. |
49 | +UrgentBounceTime=600 |
50 | +#The amount of time (in ms) to bounce an icon when launching an application. |
51 | +LaunchBounceTime=600 |
52 | +#The amount of time (in ms) for active window indicator animations. |
53 | +ActiveTime=300 |
54 | +#The amount of time (in ms) to slide icons into/out of the dock. |
55 | +SlideTime=300 |
56 | +#The time (in ms) to fade the dock in/out on a hide (if FadeOpacity is < 1). |
57 | +FadeTime=250 |
58 | +#The time (in ms) to slide the dock in/out on a hide (if FadeOpacity is 1). |
59 | +HideTime=250 |
60 | +#The size of the urgent glow (shown when dock is hidden), in tenths of a percent of IconSize. |
61 | +GlowSize=30 |
62 | +#The total time (in ms) to show the hidden-dock urgent glow. |
63 | +GlowTime=10000 |
64 | +#The time (in ms) of each pulse of the hidden-dock urgent glow. |
65 | +GlowPulseTime=2000 |
66 | +#The hue-shift (-180 to 180) of the urgent indicator color. |
67 | +UrgentHueShift=150 |
68 | +#The time (in ms) to move an item to its new position or its addition/removal to/from the dock. |
69 | +ItemMoveTime=450 |
70 | +#Whether background and icons will unhide/hide with different speeds. The top-border of both will leave/hit the screen-edge at the same time. |
71 | +CascadeHide=true |
72 | +#Whether an item has an active background glow. If not, active-item-color (RGBA) will be used instead. |
73 | +SelectionStyle=1 |
74 | +#The color (RGBA) of the active item background. |
75 | +SelectionColor=0;;0;;0;;0 |
76 | |
77 | === modified file 'data/themes/Makefile.am' |
78 | --- data/themes/Makefile.am 2013-11-10 12:52:40 +0000 |
79 | +++ data/themes/Makefile.am 2016-04-10 16:22:24 +0000 |
80 | @@ -14,3 +14,8 @@ |
81 | dist_transparenttheme_DATA = \ |
82 | Transparent/dock.theme \ |
83 | $(NULL) |
84 | + |
85 | +glowlessthemedir = $(pkgdatadir)/themes/Glowless |
86 | +dist_glowlesstheme_DATA = \ |
87 | + Glowless/dock.theme \ |
88 | + $(NULL) |
89 | |
90 | === modified file 'docs/Makefile.am' |
91 | --- docs/Makefile.am 2016-02-28 12:06:16 +0000 |
92 | +++ docs/Makefile.am 2016-04-10 16:22:24 +0000 |
93 | @@ -34,6 +34,7 @@ |
94 | $(top_srcdir)/lib/Drawing/DrawingService.vala \ |
95 | $(top_srcdir)/lib/Drawing/DockTheme.vala \ |
96 | $(top_srcdir)/lib/Drawing/Easing.vala \ |
97 | + $(top_srcdir)/lib/Drawing/Enums.vala \ |
98 | $(top_srcdir)/lib/Drawing/Renderer.vala \ |
99 | $(top_srcdir)/lib/Drawing/Surface.vala \ |
100 | $(top_srcdir)/lib/Drawing/SurfaceCache.vala \ |
101 | |
102 | === modified file 'lib/DockRenderer.vala' |
103 | --- lib/DockRenderer.vala 2016-02-28 12:06:16 +0000 |
104 | +++ lib/DockRenderer.vala 2016-04-10 16:22:24 +0000 |
105 | @@ -59,8 +59,8 @@ |
106 | |
107 | Surface? background_buffer = null; |
108 | Gdk.Rectangle background_rect; |
109 | - Surface? indicator_buffer = null; |
110 | - Surface? urgent_indicator_buffer = null; |
111 | + Surface[] indicator_buffer = new Surface[2]; |
112 | + Surface[] urgent_indicator_buffer = new Surface[2]; |
113 | Surface? urgent_glow_buffer = null; |
114 | |
115 | int64 last_hide = 0LL; |
116 | @@ -209,8 +209,10 @@ |
117 | shadow_buffer = null; |
118 | |
119 | background_buffer = null; |
120 | - indicator_buffer = null; |
121 | - urgent_indicator_buffer = null; |
122 | + indicator_buffer[0] = null; |
123 | + indicator_buffer[1] = null; |
124 | + urgent_indicator_buffer[0] = null; |
125 | + urgent_indicator_buffer[1] = null; |
126 | urgent_glow_buffer = null; |
127 | |
128 | animated_draw (); |
129 | @@ -819,7 +821,8 @@ |
130 | if ((item.State & ItemState.ACTIVE) == 0) |
131 | opacity = 1 - opacity; |
132 | if (opacity > 0) { |
133 | - theme.draw_active_glow (item_buffer, background_rect, draw_value.background_region, item.AverageIconColor, opacity, position); |
134 | + var color = (theme.SelectionStyle == SelectionStyleType.LEGACY ? item.AverageIconColor : theme.SelectionColor); |
135 | + theme.draw_active_glow (item_buffer, background_rect, draw_value.background_region, color, opacity, position); |
136 | } |
137 | |
138 | // draw the icon |
139 | @@ -837,7 +840,7 @@ |
140 | cr.restore (); |
141 | |
142 | // draw indicators |
143 | - if (draw_value.show_indicator && item.Indicator != IndicatorState.NONE) |
144 | + if (draw_value.show_indicator) |
145 | draw_indicator_state (cr, draw_value.hover_region, item.Indicator, item.State); |
146 | } |
147 | |
148 | @@ -877,7 +880,7 @@ |
149 | var surface = new Surface.with_surface (width, height, model); |
150 | |
151 | var icon_size = int.min (width, height); |
152 | - var urgent_color = get_styled_color (); |
153 | + var urgent_color = (theme.IndicatorStyle == IndicatorStyleType.LEGACY ? get_styled_color () : theme.IndicatorColor); |
154 | urgent_color.add_hue (theme.UrgentHueShift); |
155 | |
156 | // draw item's count |
157 | @@ -930,60 +933,50 @@ |
158 | return surface; |
159 | } |
160 | |
161 | - void draw_indicator_state (Cairo.Context cr, Gdk.Rectangle item_rect, IndicatorState indicator, ItemState item_state) |
162 | + void draw_indicator_state (Cairo.Context cr, Gdk.Rectangle item_rect, IndicatorState indicator_state, ItemState item_state) |
163 | { |
164 | + if (indicator_state == IndicatorState.NONE || theme.IndicatorSize <= 0) |
165 | + return; |
166 | + |
167 | unowned PositionManager position_manager = controller.position_manager; |
168 | - |
169 | - if (indicator_buffer == null) { |
170 | - var indicator_color = get_styled_color (); |
171 | - indicator_color.set_min_sat (0.4); |
172 | - indicator_buffer = theme.create_indicator (position_manager.IndicatorSize, indicator_color, item_buffer); |
173 | - } |
174 | - if (urgent_indicator_buffer == null) { |
175 | - var urgent_indicator_color = get_styled_color (); |
176 | - urgent_indicator_color.add_hue (theme.UrgentHueShift); |
177 | - urgent_indicator_color.set_sat (1.0); |
178 | - urgent_indicator_buffer = theme.create_indicator (position_manager.IndicatorSize, urgent_indicator_color, item_buffer); |
179 | - } |
180 | - |
181 | - unowned Surface indicator_surface = (item_state & ItemState.URGENT) != 0 ? urgent_indicator_buffer : indicator_buffer; |
182 | + unowned Surface indicator_surface; |
183 | + var index = indicator_state - 1; |
184 | + |
185 | + if ((item_state & ItemState.URGENT) == 0) { |
186 | + if (indicator_buffer[index] == null) |
187 | + indicator_buffer[index] = theme.create_indicator_for_state (indicator_state, ItemState.NORMAL, |
188 | + position_manager.IconSize, position_manager.Position, item_buffer); |
189 | + indicator_surface = indicator_buffer[index]; |
190 | + } else { |
191 | + if (urgent_indicator_buffer[index] == null) |
192 | + urgent_indicator_buffer[index] = theme.create_indicator_for_state (indicator_state, ItemState.URGENT, |
193 | + position_manager.IconSize, position_manager.Position, item_buffer); |
194 | + indicator_surface = urgent_indicator_buffer[index]; |
195 | + } |
196 | |
197 | var x = 0.0, y = 0.0; |
198 | switch (position_manager.Position) { |
199 | default: |
200 | case Gtk.PositionType.BOTTOM: |
201 | x = item_rect.x + item_rect.width / 2.0 - indicator_surface.Width / 2.0; |
202 | - y = item_buffer.Height - indicator_surface.Height / 2.0 - 2.0 * theme.get_bottom_offset () - indicator_surface.Height / 24.0; |
203 | + y = item_buffer.Height - theme.get_bottom_offset () - indicator_surface.Height; |
204 | break; |
205 | case Gtk.PositionType.TOP: |
206 | x = item_rect.x + item_rect.width / 2.0 - indicator_surface.Width / 2.0; |
207 | - y = - indicator_surface.Height / 2.0 + 2.0 * theme.get_bottom_offset () + indicator_surface.Height / 24.0; |
208 | + y = theme.get_bottom_offset (); |
209 | break; |
210 | case Gtk.PositionType.LEFT: |
211 | - x = - indicator_surface.Width / 2.0 + 2.0 * theme.get_bottom_offset () + indicator_surface.Width / 24.0; |
212 | + x = theme.get_bottom_offset (); |
213 | y = item_rect.y + item_rect.height / 2.0 - indicator_surface.Height / 2.0; |
214 | break; |
215 | case Gtk.PositionType.RIGHT: |
216 | - x = item_buffer.Width - indicator_surface.Width / 2.0 - 2.0 * theme.get_bottom_offset () - indicator_surface.Width / 24.0; |
217 | + x = item_buffer.Width - theme.get_bottom_offset () - indicator_surface.Width; |
218 | y = item_rect.y + item_rect.height / 2.0 - indicator_surface.Height / 2.0; |
219 | break; |
220 | } |
221 | |
222 | - if (indicator == IndicatorState.SINGLE) { |
223 | - cr.set_source_surface (indicator_surface.Internal, x, y); |
224 | - cr.paint (); |
225 | - } else { |
226 | - var x_offset = 0.0, y_offset = 0.0; |
227 | - if (position_manager.is_horizontal_dock ()) |
228 | - x_offset = position_manager.IconSize / 16.0; |
229 | - else |
230 | - y_offset = position_manager.IconSize / 16.0; |
231 | - |
232 | - cr.set_source_surface (indicator_surface.Internal, x - x_offset, y - y_offset); |
233 | - cr.paint (); |
234 | - cr.set_source_surface (indicator_surface.Internal, x + x_offset, y + y_offset); |
235 | - cr.paint (); |
236 | - } |
237 | + cr.set_source_surface (indicator_surface.Internal, x, y); |
238 | + cr.paint (); |
239 | } |
240 | |
241 | void draw_urgent_glow (DockItem item, Cairo.Context cr, int64 frame_time) |
242 | @@ -999,7 +992,7 @@ |
243 | var x_offset = 0, y_offset = 0; |
244 | |
245 | if (urgent_glow_buffer == null) { |
246 | - var urgent_color = get_styled_color (); |
247 | + var urgent_color = (theme.IndicatorStyle == IndicatorStyleType.LEGACY ? get_styled_color () : theme.IndicatorColor); |
248 | urgent_color.add_hue (theme.UrgentHueShift); |
249 | urgent_color.set_sat (1.0); |
250 | urgent_glow_buffer = theme.create_urgent_glow (position_manager.GlowSize, urgent_color, main_buffer); |
251 | |
252 | === modified file 'lib/Drawing/DockTheme.vala' |
253 | --- lib/Drawing/DockTheme.vala 2016-03-12 15:14:09 +0000 |
254 | +++ lib/Drawing/DockTheme.vala 2016-04-10 16:22:24 +0000 |
255 | @@ -40,9 +40,15 @@ |
256 | [Description(nick = "item-padding", blurb = "The padding between items on the dock, in tenths of a percent of IconSize.")] |
257 | public double ItemPadding { get; set; } |
258 | |
259 | + [Description(nick = "indicator-color", blurb = "The color (RGBA) of the indicator.")] |
260 | + public Color IndicatorColor { get; set; } |
261 | + |
262 | [Description(nick = "indicator-size", blurb = "The size of item indicators, in tenths of a percent of IconSize.")] |
263 | public double IndicatorSize { get; set; } |
264 | |
265 | + [Description(nick = "indicator-style", blurb = "The style of item indicators, styles: circle-glow, circle-color-glow, circle, underline.")] |
266 | + public IndicatorStyleType IndicatorStyle { get; set; } |
267 | + |
268 | [Description(nick = "icon-shadow-size", blurb = "The size of the icon-shadow behind every item, in tenths of a percent of IconSize.")] |
269 | public double IconShadowSize { get; set; } |
270 | |
271 | @@ -94,6 +100,12 @@ |
272 | [Description(nick = "cascade-hide", blurb = "Whether background and icons will unhide/hide with different speeds. The top-border of both will leave/hit the screen-edge at the same time.")] |
273 | public bool CascadeHide { get; set; } |
274 | |
275 | + [Description(nick = "selection-style", blurb = "Whether an item has an active background glow. If not, active-item-color (RGBA) will be used instead.")] |
276 | + public SelectionStyleType SelectionStyle { get; set; } |
277 | + |
278 | + [Description(nick = "selection-color", blurb = "The color (RGBA) of the active item background.")] |
279 | + public Color SelectionColor { get; set; } |
280 | + |
281 | public DockTheme (string name) |
282 | { |
283 | base.with_name (name); |
284 | @@ -111,7 +123,9 @@ |
285 | TopPadding = -11.0; |
286 | BottomPadding = 2.5; |
287 | ItemPadding = 2.5; |
288 | + IndicatorColor = { 1.0, 1.0, 1.0, 1.0 }; |
289 | IndicatorSize = 5.0; |
290 | + IndicatorStyle = IndicatorStyleType.LEGACY; |
291 | IconShadowSize = 1.0; |
292 | UrgentBounceHeight = 5.0 / 3.0; |
293 | LaunchBounceHeight = 0.625; |
294 | @@ -129,6 +143,8 @@ |
295 | UrgentHueShift = 150; |
296 | ItemMoveTime = 450; |
297 | CascadeHide = true; |
298 | + SelectionColor = { 0.0, 0.0, 0.0, 1.0 }; |
299 | + SelectionStyle = SelectionStyleType.LEGACY; |
300 | } |
301 | |
302 | /** |
303 | @@ -238,6 +254,112 @@ |
304 | } |
305 | |
306 | /** |
307 | + * Creates a surface of an indicator for the given states. |
308 | + * |
309 | + * @param indicator_state the state of indicator |
310 | + * @param item_state the state of item |
311 | + * @param icon_size the size of icons |
312 | + * @param color the color of the indicator |
313 | + * @param position the position of the dock |
314 | + * @param model existing surface to use as basis of new surface |
315 | + * @return a new surface with the indicator drawn on it |
316 | + */ |
317 | + public Surface create_indicator_for_state (IndicatorState indicator_state, ItemState item_state, int icon_size, |
318 | + Gtk.PositionType position, Surface model) |
319 | + { |
320 | + double width = icon_size; |
321 | + double height = icon_size / 3.0 + get_bottom_offset (); |
322 | + var size = (int) (IndicatorSize * icon_size / 10.0); |
323 | + |
324 | + Logger.verbose ("DockTheme.create_indicator (width = %i, height = %i, state = [%i,%i])", (int) width, (int) height, indicator_state, item_state); |
325 | + |
326 | + var surface = new Surface.with_surface ((int) width, (int) height, model); |
327 | + surface.clear (); |
328 | + |
329 | + if (width <= 0 || height <= 0 || size <= 0 || indicator_state == IndicatorState.NONE) |
330 | + return surface; |
331 | + |
332 | + Color color; |
333 | + if ((item_state & ItemState.URGENT) != 0) { |
334 | + color = (IndicatorStyle == IndicatorStyleType.LEGACY ? get_styled_color () : IndicatorColor); |
335 | + color.add_hue (UrgentHueShift); |
336 | + color.set_sat (1.0); |
337 | + } else { |
338 | + if (IndicatorStyle == IndicatorStyleType.LEGACY) { |
339 | + color = get_styled_color (); |
340 | + color.set_min_sat (0.4); |
341 | + } else { |
342 | + color = IndicatorColor; |
343 | + } |
344 | + } |
345 | + |
346 | + unowned Cairo.Context cr = surface.Context; |
347 | + cr.save (); |
348 | + cr.set_line_width (1.0); |
349 | + |
350 | + switch (IndicatorStyle) { |
351 | + default: |
352 | + case IndicatorStyleType.LEGACY: |
353 | + case IndicatorStyleType.GLOW: |
354 | + var x = 0.0; |
355 | + var y = Math.round (height - size / 12.0 - get_bottom_offset ()); |
356 | + |
357 | + for (var i = 0; i < indicator_state; i++) { |
358 | + x = Math.round (width / 2.0 + (2.0 * i - (indicator_state - 1)) * size / 8.0); |
359 | + |
360 | + cr.move_to (x, y); |
361 | + cr.arc (x, y, height / 2, 0, Math.PI * 2); |
362 | + cr.close_path (); |
363 | + |
364 | + var rg = new Cairo.Pattern.radial (x, y, 0, x, y, size / 2); |
365 | + rg.add_color_stop_rgba (0, 1, 1, 1, 1); |
366 | + rg.add_color_stop_rgba (0.1, color.red, color.green, color.blue, 1); |
367 | + rg.add_color_stop_rgba (0.2, color.red, color.green, color.blue, 0.6); |
368 | + rg.add_color_stop_rgba (0.25, color.red, color.green, color.blue, 0.25); |
369 | + rg.add_color_stop_rgba (0.5, color.red, color.green, color.blue, 0.15); |
370 | + rg.add_color_stop_rgba (1.0, color.red, color.green, color.blue, 0.0); |
371 | + |
372 | + cr.set_source (rg); |
373 | + cr.fill (); |
374 | + } |
375 | + break; |
376 | + case IndicatorStyleType.CIRCLE: |
377 | + var x = 0.0; |
378 | + var y = Math.round (height - size / 1.666 - get_bottom_offset ()); |
379 | + |
380 | + for (var i = 0; i < indicator_state; i++) { |
381 | + x = Math.round (width / 2.0 + (2.0 * i - (indicator_state - 1)) * size / 1.2); |
382 | + |
383 | + cr.move_to (x, y); |
384 | + cr.arc (x, y, size / 2, 0, Math.PI * 2); |
385 | + cr.close_path (); |
386 | + |
387 | + cr.set_source_rgba (color.red, color.green, color.blue, color.alpha); |
388 | + cr.stroke_preserve (); |
389 | + cr.fill (); |
390 | + } |
391 | + break; |
392 | + case IndicatorStyleType.LINE: |
393 | + var x = Math.round (icon_size / 10.0); |
394 | + var y = Math.round (height - size - get_bottom_offset () - icon_size / 30.0); |
395 | + width = Math.round (width - icon_size / 5.0); |
396 | + |
397 | + cr.rectangle (x, y, width, size); |
398 | + cr.set_source_rgba (color.red, color.green, color.blue, color.alpha); |
399 | + cr.stroke_preserve (); |
400 | + cr.fill (); |
401 | + break; |
402 | + } |
403 | + |
404 | + cr.restore (); |
405 | + |
406 | + if (position != Gtk.PositionType.BOTTOM) |
407 | + surface = rotate_for_position ((owned) surface, position); |
408 | + |
409 | + return surface; |
410 | + } |
411 | + |
412 | + /** |
413 | * Creates a surface for an urgent glow. |
414 | * |
415 | * @param size the size of the urgent glow |
416 | @@ -339,12 +461,17 @@ |
417 | |
418 | cr.set_line_width (LineWidth); |
419 | cr.clip (); |
420 | - |
421 | - gradient.add_color_stop_rgba (0, color.red, color.green, color.blue, 0); |
422 | - gradient.add_color_stop_rgba (1, color.red, color.green, color.blue, 0.6 * opacity); |
423 | |
424 | cr.rectangle (rect.x, rect.y, rect.width, rect.height); |
425 | - cr.set_source (gradient); |
426 | + |
427 | + if (SelectionStyle == SelectionStyleType.LEGACY) { |
428 | + gradient.add_color_stop_rgba (0, color.red, color.green, color.blue, 0); |
429 | + gradient.add_color_stop_rgba (1, color.red, color.green, color.blue, 0.6 * opacity); |
430 | + cr.set_source (gradient); |
431 | + } else { |
432 | + cr.set_source_rgba (color.red, color.green, color.blue, color.alpha * opacity); |
433 | + } |
434 | + |
435 | cr.fill (); |
436 | |
437 | cr.reset_clip (); |
438 | @@ -568,6 +695,11 @@ |
439 | IconShadowSize = MAX_ICON_SHADOW_SIZE; |
440 | break; |
441 | |
442 | + case "IndicatorStyle": |
443 | + if (IndicatorStyle < 0 || IndicatorStyle > 3) |
444 | + IndicatorStyle = IndicatorStyleType.LEGACY; |
445 | + break; |
446 | + |
447 | case "UrgentBounceHeight": |
448 | if (UrgentBounceHeight < 0) |
449 | UrgentBounceHeight = 0; |
450 | @@ -641,7 +773,63 @@ |
451 | else if (UrgentHueShift > 180) |
452 | UrgentHueShift = 180; |
453 | break; |
454 | - } |
455 | + |
456 | + case "IndicatorColor": |
457 | + break; |
458 | + |
459 | + case "ActiveItemColor": |
460 | + break; |
461 | + } |
462 | + } |
463 | + |
464 | + static Surface rotate_for_position (owned Surface surface, Gtk.PositionType position) |
465 | + { |
466 | + if (position == Gtk.PositionType.BOTTOM) |
467 | + return surface; |
468 | + |
469 | + Surface result; |
470 | + var width = surface.Width; |
471 | + var height = surface.Height; |
472 | + var rotate = 0.0; |
473 | + |
474 | + if (position == Gtk.PositionType.TOP) |
475 | + result = new Surface.with_surface (width, height, surface); |
476 | + else |
477 | + result = new Surface.with_surface (height, width, surface); |
478 | + |
479 | + unowned Cairo.Context cr = result.Context; |
480 | + |
481 | + switch (position) { |
482 | + case Gtk.PositionType.TOP: |
483 | + rotate = Math.PI; |
484 | + break; |
485 | + case Gtk.PositionType.LEFT: |
486 | + rotate = Math.PI_2; |
487 | + break; |
488 | + case Gtk.PositionType.RIGHT: |
489 | + rotate = -Math.PI_2; |
490 | + break; |
491 | + default: |
492 | + assert_not_reached (); |
493 | + } |
494 | + |
495 | + cr.save (); |
496 | + cr.translate (result.Width / 2.0, result.Height / 2.0); |
497 | + cr.rotate (rotate); |
498 | + cr.translate (- width / 2.0, - height / 2.0); |
499 | + cr.set_source_surface (surface.Internal, 0.0, 0.0); |
500 | + cr.paint (); |
501 | + cr.restore (); |
502 | + |
503 | + return result; |
504 | + } |
505 | + |
506 | + Color get_styled_color () |
507 | + { |
508 | + unowned Gtk.StyleContext context = get_style_context (); |
509 | + var color = (Color) context.get_background_color (context.get_state ()); |
510 | + color.set_min_val (90 / (double) uint16.MAX); |
511 | + return color; |
512 | } |
513 | } |
514 | } |
515 | |
516 | === added file 'lib/Drawing/Enums.vala' |
517 | --- lib/Drawing/Enums.vala 1970-01-01 00:00:00 +0000 |
518 | +++ lib/Drawing/Enums.vala 2016-04-10 16:22:24 +0000 |
519 | @@ -0,0 +1,63 @@ |
520 | +// |
521 | +// Copyright (C) 2016 Rico Tzschichholz |
522 | +// |
523 | +// This file is part of Plank. |
524 | +// |
525 | +// Plank is free software: you can redistribute it and/or modify |
526 | +// it under the terms of the GNU General Public License as published by |
527 | +// the Free Software Foundation, either version 3 of the License, or |
528 | +// (at your option) any later version. |
529 | +// |
530 | +// Plank is distributed in the hope that it will be useful, |
531 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
532 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
533 | +// GNU General Public License for more details. |
534 | +// |
535 | +// You should have received a copy of the GNU General Public License |
536 | +// along with this program. If not, see <http://www.gnu.org/licenses/>. |
537 | +// |
538 | + |
539 | +namespace Plank |
540 | +{ |
541 | + /** |
542 | + * The style of the item indicator. |
543 | + */ |
544 | + public enum IndicatorStyleType |
545 | + { |
546 | + /** |
547 | + * A glowing dot which is gtk-theme-colored. |
548 | + */ |
549 | + LEGACY, |
550 | + /** |
551 | + * A glowing dot. |
552 | + */ |
553 | + GLOW, |
554 | + /** |
555 | + * A solid circle. |
556 | + */ |
557 | + CIRCLE, |
558 | + /** |
559 | + * A solid line. |
560 | + */ |
561 | + LINE |
562 | + } |
563 | + |
564 | + /** |
565 | + * The style of the item indicator. |
566 | + */ |
567 | + public enum SelectionStyleType |
568 | + { |
569 | + /** |
570 | + * A vertical gradient which is colored based of the item's icon'. |
571 | + */ |
572 | + LEGACY, |
573 | + /** |
574 | + * A vertical gradient. |
575 | + */ |
576 | + GRADIENT, |
577 | + /** |
578 | + * A solid color. |
579 | + */ |
580 | + SOLID |
581 | + } |
582 | +} |
583 | |
584 | === modified file 'lib/Makefile.am' |
585 | --- lib/Makefile.am 2016-02-28 12:06:16 +0000 |
586 | +++ lib/Makefile.am 2016-04-10 16:22:24 +0000 |
587 | @@ -75,6 +75,7 @@ |
588 | Drawing/DrawingService.vala \ |
589 | Drawing/DockTheme.vala \ |
590 | Drawing/Easing.vala \ |
591 | + Drawing/Enums.vala \ |
592 | Drawing/Renderer.vala \ |
593 | Drawing/Surface.vala \ |
594 | Drawing/SurfaceCache.vala \ |
595 | |
596 | === modified file 'lib/libplank.symbols' |
597 | --- lib/libplank.symbols 2016-04-10 09:00:49 +0000 |
598 | +++ lib/libplank.symbols 2016-04-10 16:22:24 +0000 |
599 | @@ -340,10 +340,13 @@ |
600 | plank_dock_theme_construct |
601 | plank_dock_theme_create_background |
602 | plank_dock_theme_create_indicator |
603 | +plank_dock_theme_create_indicator_for_state |
604 | plank_dock_theme_create_urgent_glow |
605 | plank_dock_theme_draw_active_glow |
606 | plank_dock_theme_draw_item_count |
607 | plank_dock_theme_draw_item_progress |
608 | +plank_dock_theme_get_ActiveGlow |
609 | +plank_dock_theme_get_ActiveItemColor |
610 | plank_dock_theme_get_ActiveTime |
611 | plank_dock_theme_get_BottomPadding |
612 | plank_dock_theme_get_CascadeHide |
613 | @@ -356,7 +359,9 @@ |
614 | plank_dock_theme_get_HideTime |
615 | plank_dock_theme_get_HorizPadding |
616 | plank_dock_theme_get_IconShadowSize |
617 | +plank_dock_theme_get_IndicatorColor |
618 | plank_dock_theme_get_IndicatorSize |
619 | +plank_dock_theme_get_IndicatorStyle |
620 | plank_dock_theme_get_ItemMoveTime |
621 | plank_dock_theme_get_ItemPadding |
622 | plank_dock_theme_get_LaunchBounceHeight |
623 | @@ -368,6 +373,8 @@ |
624 | plank_dock_theme_get_UrgentBounceTime |
625 | plank_dock_theme_get_UrgentHueShift |
626 | plank_dock_theme_new |
627 | +plank_dock_theme_set_ActiveGlow |
628 | +plank_dock_theme_set_ActiveItemColor |
629 | plank_dock_theme_set_ActiveTime |
630 | plank_dock_theme_set_BottomPadding |
631 | plank_dock_theme_set_CascadeHide |
632 | @@ -380,7 +387,9 @@ |
633 | plank_dock_theme_set_HideTime |
634 | plank_dock_theme_set_HorizPadding |
635 | plank_dock_theme_set_IconShadowSize |
636 | +plank_dock_theme_set_IndicatorColor |
637 | plank_dock_theme_set_IndicatorSize |
638 | +plank_dock_theme_set_IndicatorStyle |
639 | plank_dock_theme_set_ItemMoveTime |
640 | plank_dock_theme_set_ItemPadding |
641 | plank_dock_theme_set_LaunchBounceHeight |
642 | @@ -462,6 +471,7 @@ |
643 | plank_hover_window_set_text |
644 | plank_hover_window_show_at |
645 | plank_indicator_state_get_type |
646 | +plank_indicator_style_type_get_type |
647 | plank_item_factory_construct |
648 | plank_item_factory_default_make_element |
649 | plank_item_factory_get_item_for_dock |
Theme naming:
I'd vote for "flat" in case of a theme with the line type indicator and "modern" in case of the circle.
Looks: imgur.com/ co1S0t7
The circular ones look better if their center is in the middle of bottom padding: http://
An extra slight bump off the ground instead might look better too.
The circles also end up a bit too close together at times, depending on the size set (indicatorsize 1 looked to be too close, while 1.2 looked fine at icon size 48) imgur.com/ sUCYEoN
http://
In my opinion lines should not indicate several instances being open, as it appears strange :D
Neither chrome os nor windows seem to provide such information while having that kind of indicators. It feels as if the application were somehow divided into smaller fragments.