Merge lp:~albyrock87/awn/awn-lucido into lp:awn/0.4
- awn-lucido
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~albyrock87/awn/awn-lucido |
Merge into: | lp:awn/0.4 |
Diff against target: |
1219 lines (+397/-427) 9 files modified
awn-settings/awn-settings.ui (+0/-33) awn-settings/awnDefs.py.in (+0/-1) awn-settings/awnSettings.py.in (+0/-4) data/avant-window-navigator.schema-ini.in.in (+0/-6) src/awn-background-lucido.c (+345/-358) src/awn-background.c (+1/-19) src/awn-background.h (+0/-1) src/awn-defines.h (+0/-1) src/awn-separator.c (+51/-4) |
To merge this branch: | bzr merge lp:~albyrock87/awn/awn-lucido |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michal Hruby (community) | Needs Fixing | ||
Review via email: mp+26488@code.launchpad.net |
This proposal has been superseded by a proposal from 2010-06-08.
Commit message
Description of the change
Thank's to mhr3's idea: "use separators tho style Lucido"
The new Lucido style is here!
We get rid of stripe width!
Align controls only align like it should be :)
Stripe-Style added to non-expanded mode too :)
http://
http://
Align: left ->
http://
I need some review on how are managed separators from Lucido bg
- 712. By Alberto <alby@CASA>
-
Ops, removing test code
- 713. By Alberto <alby@CASA>
-
Better hi-light pattern
- 714. By Alberto <alby@CASA>
-
SEP_WIDTH to SEP_SIZE
- 715. By Alberto <alby@CASA>
-
Fix to expanded+align background position
- 716. By Alberto <alby@CASA>
-
Ops, fix mem leak
- 717. By Alberto <alby@CASA>
-
Fix: Refresh bug in expanded+
align+no- expanders - 718. By Alberto <alby@CASA>
-
Test version on separators.
- 719. By Alberto <alby@CASA>
-
ops
- 720. By Alberto <alby@CASA>
-
Fix to a bug when changing corner radius
Michal Hruby (mhr3) wrote : | # |
Oh, and 1477 is unnecessary.
Alberto Aldegheri (albyrock87) wrote : | # |
> Ok, there'll be many points here, but here we go:
>
> 1) Please add curly brackets to all ifs (& elses) per code guidelines (the
> one-liners).
> 2) awn_background_
> AwnBackgroundLu
> strange...
Ok..
> 3) _init_positions - remove 239-240 - it's init, so the assumption that you
> need to free something is wrong (otherwise it's not really init)
> 4) 315: starting a timer in init method is suspicious, ideally it should be
> started only once you know that you need to animate.
You're right..
> 5) 1082: shouldn't the value be 10?
Not in that case: if the first applet is a separator, that separator acts like a "background changer". If you put a separator in first position, the curve starts from bottom, otherwise from top.
> 6) 1224: What's the 10000?
It can be changed to : if (expand) w = -w; it's just for give "expand" a great importance in the "w" calculation.
> 7) I still don't like the "transparent" property, I suggest connecting to
> expose event instead of setting this property, since you mentioned you don't
> want to add panel-style switch in Separator's expose.
I mentioned I do want to add style switches to Separator :)
So.. what to do now?
> 8) Revert 1436 & 1442.
Ok
- 721. By Alberto <alby@alby-laptop>
-
Some fixes and code restyle
Michal Hruby (mhr3) wrote : | # |
> I mentioned I do want to add style switches to Separator :)
> So.. what to do now?
Add panel-style property to Separators and have AppletManager update it.
- 722. By Alberto <alby@CASA>
-
Revert all animation changes for getting back stability. Animation -for now and for me- cant work. Feel free to fork rev 721.
- 723. By Alberto <alby@CASA>
-
Merge with lp:awn
- 724. By Alberto <alby@CASA>
-
Minor code restyling
- 725. By Alberto <alby@CASA>
-
Bug fixes for separators in first position. Restyle of docklet-mode.
- 726. By Alberto <alby@CASA>
-
For simil-3D lovers: Now 3D angle acts on lucido too.
- 727. By Alberto <alby@CASA>
-
Fix to shape mask
- 728. By Alberto <alby@CASA>
-
Bug fixes to an old bug in cairo-utils: rounded_rect. Rect explode if radius is bigger than available space. Consecutive fix to highlights. Simplify and speedup to Edgy code. Bugfix to 3D style, not listening on corner-radius changes. Fix on Lucdio shape mask.
- 729. By Alberto <alby@CASA>
-
3D style rewritten. Now full customizable.
- 730. By Alberto <alby@CASA>
-
I hate when I forget things.
- 731. By Alberto <alby@CASA>
-
Add thickness to 3D style.
- 732. By Alberto <alby@CASA>
-
Better padding
- 733. By Alberto <alby@CASA>
-
Better painting
- 734. By Alberto <alby@CASA>
-
Other drawing adjust for glass looking
- 735. By Alberto <alby@CASA>
-
Cleanups
- 736. By Alberto <alby@CASA>
-
Thickness set to 7px
- 737. By Alberto <alby@CASA>
-
Better drawing. Thinner and more defined border. Improved padding.
- 738. By Alberto <alby@CASA>
-
s(e)(i)x is better :P
- 739. By Alberto <alby@CASA>
-
Thickness in 3D style, replacing floaty offset. Removed Lucido 3D style. Lucido now uses Curves Symmetry too.
- 740. By Alberto <alby@CASA>
-
Animation added to Lucido. There are some minor glitches sometime...
- 741. By Alberto <alby@CASA>
-
A little speedup
- 742. By Alberto <alby@CASA>
-
Shit. I've forgot this.
- 743. By Alberto <alby@CASA>
-
More consistent with other style engines
- 744. By Alberto <alby@CASA>
-
Huge speedup and cleanup. Fixed an old bug. Now listening on applets position change.
- 745. By Alberto <alby@CASA>
-
Too much cleanup. Now works on expanded mode too.
- 746. By Alberto <alby@CASA>
-
Fix to 3D background padding
- 747. By Alberto <alby@CASA>
-
Rewrite of lucido path code. Bugs fixed and curves symmetry fully working.
- 748. By Alberto <alby@CASA>
-
Emit applets refreshed on docklet mode changed too.
- 749. By Alberto <alby@CASA>
-
Good looking start :)
- 750. By Alberto <alby@CASA>
-
Little fixes
- 751. By Alberto <alby@CASA>
-
Merged from lp:awn
- 752. By Alberto <alby@CASA>
-
Get and Set for separator new properties. Added awn_panel_
get_docklet_ mode to panel, removed the similar method in awn-applet-manager, because it returns -wrong- (updated too late) values. - 753. By Alberto <alby@CASA>
-
I made an error while editing awn-panel.c, reverted that error.
- 754. By Alberto <alby@CASA>
-
Reverted changes on debian/changelog
- 755. By Alberto <alby@CASA>
-
Last fix to 3D edges when corner radius > height
- 756. By Alberto <alby@CASA>
-
I had removed too much things :P
- 757. By Alberto <alby@CASA>
-
There was a drawing bug when corner radius = 0, fixed.
- 758. By Alberto <alby@CASA>
-
Merge with lp:awn rev 713
- 759. By Alberto <alby@CASA>
-
Fixed 3065, sorry michal
- 760. By Alberto <alby@CASA>
-
Fixed Edgy. Auto invalidate bg on changed signal.
- 761. By Alberto <alby@CASA>
-
Revert changes to flat
- 762. By Alberto <alby@CASA>
-
Better start animation. Fix to Criticals on lucido start. Pot Updated with make check.
- 763. By Alberto <alby@CASA>
-
Fixes to bug #608927
- 764. By Alberto <alby@CASA>
-
Avoid merge problems with gutted-core-icons branch
- 765. By Alberto <alby@CASA>
-
Patch for bug #608927
- 766. By Alberto <alby@CASA>
-
Remove unused refresh method from awnClass.py. A little fix to a translation string.
Unmerged revisions
Preview Diff
1 | === modified file 'awn-settings/awn-settings.ui' | |||
2 | --- awn-settings/awn-settings.ui 2010-06-03 23:39:31 +0000 | |||
3 | +++ awn-settings/awn-settings.ui 2010-06-08 09:35:36 +0000 | |||
4 | @@ -899,22 +899,6 @@ | |||
5 | 899 | </packing> | 899 | </packing> |
6 | 900 | </child> | 900 | </child> |
7 | 901 | <child> | 901 | <child> |
8 | 902 | <object class="GtkSpinButton" id="theme_stripe_width"> | ||
9 | 903 | <property name="visible">True</property> | ||
10 | 904 | <property name="can_focus">True</property> | ||
11 | 905 | <property name="invisible_char">●</property> | ||
12 | 906 | <property name="adjustment">adj_stripe_width</property> | ||
13 | 907 | <property name="digits">2</property> | ||
14 | 908 | </object> | ||
15 | 909 | <packing> | ||
16 | 910 | <property name="left_attach">2</property> | ||
17 | 911 | <property name="right_attach">3</property> | ||
18 | 912 | <property name="top_attach">11</property> | ||
19 | 913 | <property name="bottom_attach">12</property> | ||
20 | 914 | <property name="x_options"></property> | ||
21 | 915 | </packing> | ||
22 | 916 | </child> | ||
23 | 917 | <child> | ||
24 | 918 | <object class="GtkSpinButton" id="theme_angle"> | 902 | <object class="GtkSpinButton" id="theme_angle"> |
25 | 919 | <property name="visible">True</property> | 903 | <property name="visible">True</property> |
26 | 920 | <property name="can_focus">True</property> | 904 | <property name="can_focus">True</property> |
27 | @@ -972,19 +956,6 @@ | |||
28 | 972 | </packing> | 956 | </packing> |
29 | 973 | </child> | 957 | </child> |
30 | 974 | <child> | 958 | <child> |
31 | 975 | <object class="GtkLabel" id="label_stripe"> | ||
32 | 976 | <property name="visible">True</property> | ||
33 | 977 | <property name="xalign">0</property> | ||
34 | 978 | <property name="xpad">10</property> | ||
35 | 979 | <property name="label" translatable="yes">Stripe Width</property> | ||
36 | 980 | </object> | ||
37 | 981 | <packing> | ||
38 | 982 | <property name="right_attach">2</property> | ||
39 | 983 | <property name="top_attach">11</property> | ||
40 | 984 | <property name="bottom_attach">12</property> | ||
41 | 985 | </packing> | ||
42 | 986 | </child> | ||
43 | 987 | <child> | ||
44 | 988 | <object class="GtkLabel" id="label49"> | 959 | <object class="GtkLabel" id="label49"> |
45 | 989 | <property name="visible">True</property> | 960 | <property name="visible">True</property> |
46 | 990 | <property name="xalign">0</property> | 961 | <property name="xalign">0</property> |
47 | @@ -3439,10 +3410,6 @@ | |||
48 | 3439 | <property name="upper">1</property> | 3410 | <property name="upper">1</property> |
49 | 3440 | <property name="step_increment">0.01</property> | 3411 | <property name="step_increment">0.01</property> |
50 | 3441 | </object> | 3412 | </object> |
51 | 3442 | <object class="GtkAdjustment" id="adj_stripe_width"> | ||
52 | 3443 | <property name="upper">1</property> | ||
53 | 3444 | <property name="step_increment">0.01</property> | ||
54 | 3445 | </object> | ||
55 | 3446 | <object class="GtkAdjustment" id="adj_radius"> | 3413 | <object class="GtkAdjustment" id="adj_radius"> |
56 | 3447 | <property name="upper">100</property> | 3414 | <property name="upper">100</property> |
57 | 3448 | <property name="step_increment">1</property> | 3415 | <property name="step_increment">1</property> |
58 | 3449 | 3416 | ||
59 | === modified file 'awn-settings/awnDefs.py.in' | |||
60 | --- awn-settings/awnDefs.py.in 2010-05-31 17:41:58 +0000 | |||
61 | +++ awn-settings/awnDefs.py.in 2010-06-08 09:35:36 +0000 | |||
62 | @@ -86,7 +86,6 @@ | |||
63 | 86 | PANEL_ANGLE = "panel_angle" #float | 86 | PANEL_ANGLE = "panel_angle" #float |
64 | 87 | CURVINESS = "curviness" #float | 87 | CURVINESS = "curviness" #float |
65 | 88 | CURVES_SYMMETRY = "curves_symmetry" #float | 88 | CURVES_SYMMETRY = "curves_symmetry" #float |
66 | 89 | STRIPE_WIDTH = "stripe_width" #float | ||
67 | 90 | FLOATY_OFFSET = "floaty_offset" #int | 89 | FLOATY_OFFSET = "floaty_offset" #int |
68 | 91 | TOOLTIP_FONT_NAME = "tooltip_font_name" #string | 90 | TOOLTIP_FONT_NAME = "tooltip_font_name" #string |
69 | 92 | TOOLTIP_FONT_COLOR = "tooltip_font_color" #string | 91 | TOOLTIP_FONT_COLOR = "tooltip_font_color" #string |
70 | 93 | 92 | ||
71 | === modified file 'awn-settings/awnSettings.py.in' | |||
72 | --- awn-settings/awnSettings.py.in 2010-05-31 17:41:58 +0000 | |||
73 | +++ awn-settings/awnSettings.py.in 2010-06-08 09:35:36 +0000 | |||
74 | @@ -579,7 +579,6 @@ | |||
75 | 579 | 579 | ||
76 | 580 | curviness = gobject.property(type=float, default=1) | 580 | curviness = gobject.property(type=float, default=1) |
77 | 581 | curves_symmetry = gobject.property(type=float, default=0) | 581 | curves_symmetry = gobject.property(type=float, default=0) |
78 | 582 | stripe_width = gobject.property(type=float, default=0) | ||
79 | 583 | floaty_offset = gobject.property(type=int, default=10) | 582 | floaty_offset = gobject.property(type=int, default=10) |
80 | 584 | angle = gobject.property(type=int, default=45) | 583 | angle = gobject.property(type=int, default=45) |
81 | 585 | radius = gobject.property(type=int, default=10) | 584 | radius = gobject.property(type=int, default=10) |
82 | @@ -730,7 +729,6 @@ | |||
83 | 730 | (defs.THEME, defs.PANEL_ANGLE, 'float', sizes), | 729 | (defs.THEME, defs.PANEL_ANGLE, 'float', sizes), |
84 | 731 | (defs.THEME, defs.CURVINESS, 'float', sizes), | 730 | (defs.THEME, defs.CURVINESS, 'float', sizes), |
85 | 732 | (defs.THEME, defs.CURVES_SYMMETRY, 'float', sizes), | 731 | (defs.THEME, defs.CURVES_SYMMETRY, 'float', sizes), |
86 | 733 | (defs.THEME, defs.STRIPE_WIDTH, 'float', sizes), | ||
87 | 734 | (defs.THEME, defs.FLOATY_OFFSET, 'int', sizes), | 732 | (defs.THEME, defs.FLOATY_OFFSET, 'int', sizes), |
88 | 735 | (defs.THEME, defs.TOOLTIP_FONT_NAME, 'str', icon), | 733 | (defs.THEME, defs.TOOLTIP_FONT_NAME, 'str', icon), |
89 | 736 | (defs.THEME, defs.TOOLTIP_FONT_COLOR, 'str', icon), | 734 | (defs.THEME, defs.TOOLTIP_FONT_COLOR, 'str', icon), |
90 | @@ -828,8 +826,6 @@ | |||
91 | 828 | "curviness", "theme_curviness"), | 826 | "curviness", "theme_curviness"), |
92 | 829 | (self.client, defs.THEME, defs.CURVES_SYMMETRY, | 827 | (self.client, defs.THEME, defs.CURVES_SYMMETRY, |
93 | 830 | "curves-symmetry", "theme_symmetry"), | 828 | "curves-symmetry", "theme_symmetry"), |
94 | 831 | (self.client, defs.THEME, defs.STRIPE_WIDTH, | ||
95 | 832 | "stripe-width", "theme_stripe_width"), | ||
96 | 833 | (self.client, defs.THEME, defs.PANEL_ANGLE, | 829 | (self.client, defs.THEME, defs.PANEL_ANGLE, |
97 | 834 | "angle", "theme_angle"), | 830 | "angle", "theme_angle"), |
98 | 835 | (self.client, defs.THEME, defs.FLOATY_OFFSET, | 831 | (self.client, defs.THEME, defs.FLOATY_OFFSET, |
99 | 836 | 832 | ||
100 | === modified file 'data/avant-window-navigator.schema-ini.in.in' | |||
101 | --- data/avant-window-navigator.schema-ini.in.in 2010-05-31 17:41:58 +0000 | |||
102 | +++ data/avant-window-navigator.schema-ini.in.in 2010-06-08 09:35:36 +0000 | |||
103 | @@ -233,12 +233,6 @@ | |||
104 | 233 | _description=The offset of the Floaty background. | 233 | _description=The offset of the Floaty background. |
105 | 234 | per_instance = false | 234 | per_instance = false |
106 | 235 | 235 | ||
107 | 236 | [theme/stripe_width] | ||
108 | 237 | type = float | ||
109 | 238 | default = 0.0 | ||
110 | 239 | _description=The width of the stripe in Lucido mode. | ||
111 | 240 | per_instance = false | ||
112 | 241 | |||
113 | 242 | [theme/dialog_gtk_mode] | 236 | [theme/dialog_gtk_mode] |
114 | 243 | type = boolean | 237 | type = boolean |
115 | 244 | default = true | 238 | default = true |
116 | 245 | 239 | ||
117 | === modified file 'src/awn-background-lucido.c' | |||
118 | --- src/awn-background-lucido.c 2010-05-31 22:40:18 +0000 | |||
119 | +++ src/awn-background-lucido.c 2010-06-08 09:35:36 +0000 | |||
120 | @@ -17,7 +17,7 @@ | |||
121 | 17 | * | 17 | * |
122 | 18 | * Author : Alberto Aldegheri <albyrock87+dev@gmail.com> | 18 | * Author : Alberto Aldegheri <albyrock87+dev@gmail.com> |
123 | 19 | * Thanks to: Matt <sharkbaitbobby@gmail.com> | 19 | * Thanks to: Matt <sharkbaitbobby@gmail.com> |
125 | 20 | * for the code section to analyze expanders | 20 | * for the code section to analyze separators |
126 | 21 | * | 21 | * |
127 | 22 | */ | 22 | */ |
128 | 23 | 23 | ||
129 | @@ -41,10 +41,13 @@ | |||
130 | 41 | { | 41 | { |
131 | 42 | gint expw; | 42 | gint expw; |
132 | 43 | gint expn; | 43 | gint expn; |
133 | 44 | gint expp; | ||
134 | 44 | }; | 45 | }; |
135 | 45 | 46 | ||
136 | 46 | #define TRANSFORM_RADIUS(x) sqrt(x/50.)*50. | 47 | #define TRANSFORM_RADIUS(x) sqrt(x/50.)*50. |
137 | 47 | 48 | ||
138 | 49 | #define IS_SPECIAL(x) AWN_IS_SEPARATOR(x) | ||
139 | 50 | |||
140 | 48 | static void awn_background_lucido_draw (AwnBackground *bg, | 51 | static void awn_background_lucido_draw (AwnBackground *bg, |
141 | 49 | cairo_t *cr, | 52 | cairo_t *cr, |
142 | 50 | GtkPositionType position, | 53 | GtkPositionType position, |
143 | @@ -66,12 +69,24 @@ | |||
144 | 66 | awn_background_lucido_get_needs_redraw (AwnBackground *bg, | 69 | awn_background_lucido_get_needs_redraw (AwnBackground *bg, |
145 | 67 | GtkPositionType position, | 70 | GtkPositionType position, |
146 | 68 | GdkRectangle *area); | 71 | GdkRectangle *area); |
147 | 72 | |||
148 | 73 | static void | ||
149 | 74 | _set_special_widget_width_and_transparent (AwnBackground *bg, | ||
150 | 75 | gint width, | ||
151 | 76 | gboolean transp, | ||
152 | 77 | gboolean dispose); | ||
153 | 69 | 78 | ||
154 | 70 | static void | 79 | static void |
155 | 71 | awn_background_lucido_corner_radius_changed (AwnBackground *bg) | 80 | awn_background_lucido_corner_radius_changed (AwnBackground *bg) |
156 | 72 | { | 81 | { |
157 | 73 | gboolean expand = FALSE; | 82 | gboolean expand = FALSE; |
158 | 74 | g_object_get (bg->panel, "expand", &expand, NULL); | 83 | g_object_get (bg->panel, "expand", &expand, NULL); |
159 | 84 | |||
160 | 85 | _set_special_widget_width_and_transparent ( | ||
161 | 86 | bg, | ||
162 | 87 | TRANSFORM_RADIUS (bg->corner_radius), | ||
163 | 88 | TRUE, | ||
164 | 89 | FALSE); | ||
165 | 75 | 90 | ||
166 | 76 | if (!expand) | 91 | if (!expand) |
167 | 77 | { | 92 | { |
168 | @@ -100,7 +115,8 @@ | |||
169 | 100 | gpointer monitor = NULL; | 115 | gpointer monitor = NULL; |
170 | 101 | 116 | ||
171 | 102 | g_signal_connect_swapped (bg, "notify::corner-radius", | 117 | g_signal_connect_swapped (bg, "notify::corner-radius", |
173 | 103 | G_CALLBACK (awn_background_lucido_corner_radius_changed), | 118 | G_CALLBACK ( |
174 | 119 | awn_background_lucido_corner_radius_changed), | ||
175 | 104 | object); | 120 | object); |
176 | 105 | 121 | ||
177 | 106 | g_return_if_fail (bg->panel); | 122 | g_return_if_fail (bg->panel); |
178 | @@ -121,6 +137,8 @@ | |||
179 | 121 | static void | 137 | static void |
180 | 122 | awn_background_lucido_dispose (GObject *object) | 138 | awn_background_lucido_dispose (GObject *object) |
181 | 123 | { | 139 | { |
182 | 140 | _set_special_widget_width_and_transparent | ||
183 | 141 | (AWN_BACKGROUND (object), 10, FALSE, TRUE); | ||
184 | 124 | gpointer monitor = NULL; | 142 | gpointer monitor = NULL; |
185 | 125 | if (AWN_BACKGROUND (object)->panel) | 143 | if (AWN_BACKGROUND (object)->panel) |
186 | 126 | { | 144 | { |
187 | @@ -211,6 +229,24 @@ | |||
188 | 211 | return gtk_container_get_children (GTK_CONTAINER (manager)); | 229 | return gtk_container_get_children (GTK_CONTAINER (manager)); |
189 | 212 | } | 230 | } |
190 | 213 | 231 | ||
191 | 232 | static gint | ||
192 | 233 | _get_applet_manager_size (AwnBackground* bg, GtkPositionType position) | ||
193 | 234 | { | ||
194 | 235 | AwnAppletManager *manager = NULL; | ||
195 | 236 | g_object_get (bg->panel, "applet-manager", &manager, NULL); | ||
196 | 237 | |||
197 | 238 | switch (position) | ||
198 | 239 | { | ||
199 | 240 | case GTK_POS_BOTTOM: | ||
200 | 241 | case GTK_POS_TOP: | ||
201 | 242 | return GTK_WIDGET (manager)->allocation.width; | ||
202 | 243 | break; | ||
203 | 244 | default: | ||
204 | 245 | return GTK_WIDGET (manager)->allocation.height; | ||
205 | 246 | break; | ||
206 | 247 | } | ||
207 | 248 | } | ||
208 | 249 | |||
209 | 214 | /** | 250 | /** |
210 | 215 | * _create_path_lucido: | 251 | * _create_path_lucido: |
211 | 216 | * @bg: The background pointer | 252 | * @bg: The background pointer |
212 | @@ -219,17 +255,16 @@ | |||
213 | 219 | * @y: The top left coordinate of the "bar rect" - default = 0 | 255 | * @y: The top left coordinate of the "bar rect" - default = 0 |
214 | 220 | * @w: The width of the bar | 256 | * @w: The width of the bar |
215 | 221 | * @h: The height of the bar | 257 | * @h: The height of the bar |
216 | 222 | * @stripe: The width of the stripe (0.0-1.0). Zero for auto-stripe. | ||
217 | 223 | * @d: The width of each curve in the path | 258 | * @d: The width of each curve in the path |
218 | 224 | * @dc: The width of the external curves in non-expanded&auto mode | 259 | * @dc: The width of the external curves in non-expanded&auto mode |
219 | 225 | * @symmetry: The symmetry of the stripe when @stripe > 0 | ||
220 | 226 | * @internal: If Zero, creates the path for the stripe | 260 | * @internal: If Zero, creates the path for the stripe |
221 | 227 | * @expanded: If Zero, the bar is not expanded | 261 | * @expanded: If Zero, the bar is not expanded |
222 | 262 | * @align: the monitor align | ||
223 | 228 | * | 263 | * |
224 | 229 | * This function creates paths on which the bar will be drawn. | 264 | * This function creates paths on which the bar will be drawn. |
226 | 230 | * In atuo-stripe, it searchs for expanders applet, each expander | 265 | * In atuo-stripe, it searchs for separators applet, each separator |
227 | 231 | * equals to one curve. | 266 | * equals to one curve. |
229 | 232 | * If the first widget is an expander, start from bottom-left, | 267 | * If the first widget is an separator, start from bottom-left, |
230 | 233 | * otherwise start from top-left | 268 | * otherwise start from top-left |
231 | 234 | */ | 269 | */ |
232 | 235 | 270 | ||
233 | @@ -241,316 +276,236 @@ | |||
234 | 241 | gfloat y, | 276 | gfloat y, |
235 | 242 | gfloat w, | 277 | gfloat w, |
236 | 243 | gfloat h, | 278 | gfloat h, |
237 | 244 | gfloat stripe, | ||
238 | 245 | gfloat d, | 279 | gfloat d, |
239 | 246 | gfloat dc, | 280 | gfloat dc, |
240 | 247 | gfloat symmetry, | ||
241 | 248 | gboolean internal, | 281 | gboolean internal, |
242 | 249 | gboolean expanded, | 282 | gboolean expanded, |
243 | 250 | gfloat align) | 283 | gfloat align) |
244 | 251 | { | 284 | { |
245 | 252 | cairo_new_path (cr); | 285 | cairo_new_path (cr); |
246 | 253 | 286 | ||
247 | 287 | gfloat curx = x; | ||
248 | 254 | gfloat lx = x; | 288 | gfloat lx = x; |
249 | 255 | gfloat ly = y; | 289 | gfloat ly = y; |
250 | 256 | gfloat y3 = y + h; | 290 | gfloat y3 = y + h; |
251 | 257 | gfloat y2 = y3 - 5; | 291 | gfloat y2 = y3 - 5; |
506 | 258 | 292 | gfloat pad_left = 0.; | |
507 | 259 | if (stripe > 0) | 293 | |
508 | 260 | { | 294 | /* Get list of widgets */ |
509 | 261 | if (expanded) | 295 | GList *widgets = _get_applet_widgets (bg); |
510 | 262 | { | 296 | GList *i = widgets; |
511 | 263 | stripe = (w * stripe); /* now stripe = non-stripe */ | 297 | GtkWidget *widget = NULL; |
512 | 264 | if (internal) | 298 | gboolean first_widget_is_special = FALSE; |
513 | 265 | { | 299 | if (i && IS_SPECIAL (i->data)) |
514 | 266 | /* Manual-Stripe & Expanded & Internal */ | 300 | { |
515 | 267 | lx = stripe * symmetry; | 301 | first_widget_is_special = TRUE; |
516 | 268 | cairo_move_to (cr, lx, ly); | 302 | } |
517 | 269 | _line_from_to (cr, &lx, &ly, lx+d, y2); | 303 | |
518 | 270 | _line_from_to (cr, &lx, &ly, w-stripe * (1. - symmetry) - d, y2); | 304 | /* We start from left */ |
519 | 271 | _line_from_to (cr, &lx, &ly, w-stripe * (1. - symmetry), y); | 305 | ly = y3; |
520 | 272 | cairo_close_path (cr); | 306 | cairo_move_to (cr, lx, ly); |
521 | 273 | } | 307 | |
522 | 274 | else | 308 | if (expanded) |
523 | 275 | { | 309 | { |
524 | 276 | /* Manual-Stripe & Expanded & External */ | 310 | pad_left = lx + (w - _get_applet_manager_size (bg, position)) * align; |
525 | 277 | ly = y3; | 311 | if (first_widget_is_special) |
526 | 278 | cairo_move_to (cr, lx, ly); | 312 | { |
527 | 279 | _line_from_to (cr, &lx, &ly, lx, y); | 313 | /* start from bottom */ |
528 | 280 | _line_from_to (cr, &lx, &ly, stripe * symmetry, y); | 314 | if (internal) |
529 | 281 | _line_from_to (cr, &lx, &ly, stripe * symmetry + d, y2); | 315 | { |
530 | 282 | _line_from_to (cr, &lx, &ly, w - stripe * (1. - symmetry) - d, y2); | 316 | cairo_new_path (cr); |
531 | 283 | _line_from_to (cr, &lx, &ly, w - stripe * (1. - symmetry), y); | 317 | ly = y; |
532 | 284 | _line_from_to (cr, &lx, &ly, w, y); | 318 | cairo_move_to (cr, lx, ly); |
533 | 285 | _line_from_to (cr, &lx, &ly, w, y3); | 319 | } |
534 | 286 | cairo_close_path (cr); | 320 | |
535 | 287 | } | 321 | _line_from_to (cr, &lx, &ly, lx, y2); |
536 | 288 | } | 322 | /* jump first special widget */ |
537 | 289 | else | 323 | i = i->next; |
538 | 290 | { | 324 | } |
539 | 291 | if (stripe == 1.) | 325 | else |
540 | 292 | { | 326 | { |
541 | 293 | _create_path_lucido (bg, position, cr, x, y, w, h, 0., | 327 | /* start from top */ |
542 | 294 | d, dc, 0., internal, expanded, align); | 328 | if (internal) |
543 | 295 | return; | 329 | { |
544 | 296 | } | 330 | cairo_new_path (cr); |
545 | 297 | stripe = ((w - dc * 2) * stripe); /* now stripe = non-stripe */ | 331 | ly = y; |
546 | 298 | if (internal) | 332 | cairo_move_to (cr, lx, ly); |
547 | 299 | { | 333 | } |
548 | 300 | /* Manual-Stripe & Not-Expanded & Internal */ | 334 | |
549 | 301 | lx = stripe * symmetry + dc; | 335 | _line_from_to (cr, &lx, &ly, lx, y); |
550 | 302 | cairo_move_to (cr, lx, ly); | 336 | } |
551 | 303 | _line_from_to (cr, &lx, &ly, lx + d, y2); | 337 | } |
552 | 304 | _line_from_to (cr, &lx, &ly, w - stripe * (1.- symmetry) - dc - d, y2); | 338 | else |
553 | 305 | _line_from_to (cr, &lx, &ly, w - stripe * (1.- symmetry) - dc, y); | 339 | { |
554 | 306 | cairo_close_path (cr); | 340 | if (align == 0.) |
555 | 307 | } | 341 | { |
556 | 308 | else | 342 | if (first_widget_is_special) |
557 | 309 | { | 343 | { |
558 | 310 | /* Manual-Stripe & Not-Expanded & External */ | 344 | /* start from bottom */ |
559 | 311 | ly = y3; | 345 | if (internal) |
560 | 312 | cairo_move_to (cr, lx, ly); | 346 | { |
561 | 313 | _line_from_to (cr, &lx, &ly, lx+dc, y); | 347 | cairo_new_path (cr); |
562 | 314 | _line_from_to (cr, &lx, &ly, stripe * symmetry + dc, y); | 348 | ly = y; |
563 | 315 | _line_from_to (cr, &lx, &ly, stripe * symmetry + d + dc, y2); | 349 | cairo_move_to (cr, lx, ly); |
564 | 316 | _line_from_to (cr, &lx, &ly, w-stripe * (1. - symmetry) - dc - d, y2); | 350 | } |
565 | 317 | _line_from_to (cr, &lx, &ly, w-stripe * (1. - symmetry) - dc, y); | 351 | _line_from_to (cr, &lx, &ly, lx, y2); |
566 | 318 | _line_from_to (cr, &lx, &ly, w-dc, y); | 352 | /* jump first special widget */ |
567 | 319 | _line_from_to (cr, &lx, &ly, w, y3); | 353 | i = i->next; |
568 | 320 | cairo_close_path(cr); | 354 | } |
569 | 321 | } | 355 | else |
570 | 322 | } | 356 | { |
571 | 323 | } | 357 | if (internal) |
572 | 324 | else | 358 | { |
573 | 325 | { | 359 | cairo_new_path (cr); |
574 | 326 | gint exps_found = 0; | 360 | ly = y; |
575 | 327 | gfloat curx = x; | 361 | cairo_move_to (cr, lx, ly); |
576 | 328 | 362 | } | |
577 | 329 | if (expanded) | 363 | else |
578 | 330 | { | 364 | { |
579 | 331 | if (internal) | 365 | /* start from top */ |
580 | 332 | { | 366 | _line_from_to (cr, &lx, &ly, lx, y); |
581 | 333 | /* Auto-Stripe & Expanded & Internal */ | 367 | } |
582 | 334 | GList *widgets = _get_applet_widgets (bg); | 368 | } |
583 | 335 | GList *i = widgets; | 369 | } |
584 | 336 | GtkWidget *widget = NULL; | 370 | else |
585 | 337 | 371 | { | |
586 | 338 | /* analyze first widget*/ | 372 | pad_left = lx + dc; |
587 | 339 | if (i) | 373 | if (first_widget_is_special) |
588 | 340 | { | 374 | { |
589 | 341 | widget = GTK_WIDGET (i->data); | 375 | /* start from bottom */ |
590 | 342 | 376 | if (internal) | |
591 | 343 | /* if first widget is an expander or align==0 || 1*/ | 377 | { |
592 | 344 | if ( (widget && GTK_IS_IMAGE (widget) && !AWN_IS_SEPARATOR (widget) ) || | 378 | cairo_new_path (cr); |
593 | 345 | ( align == 0. || align == 1. ) ) | 379 | lx = lx + dc; |
594 | 346 | { | 380 | ly = y; |
595 | 347 | /* start from bottom */ | 381 | cairo_move_to (cr, lx, ly); |
596 | 348 | lx = curx; | 382 | _line_from_to (cr, &lx, &ly, curx, y3); |
597 | 349 | ly = y; | 383 | _line_from_to (cr, &lx, &ly, lx + dc, y2); |
598 | 350 | cairo_move_to (cr, lx, ly); | 384 | } |
599 | 351 | _line_from_to (cr, &lx, &ly, lx, y2); | 385 | else |
600 | 352 | ++exps_found; | 386 | { |
601 | 353 | if (align != 0. && align != 1.) | 387 | _line_from_to (cr, &lx, &ly, lx + dc, y2); |
602 | 354 | i = i->next; | 388 | /* jump first special widget */ |
603 | 355 | } | 389 | } |
604 | 356 | } | 390 | i = i->next; |
605 | 357 | /* else start from top */ | 391 | } |
606 | 358 | 392 | else | |
607 | 359 | for (; i; i = i->next) | 393 | { |
608 | 360 | { | 394 | /* start from top */ |
609 | 361 | widget = GTK_WIDGET (i->data); | 395 | if (internal) |
610 | 362 | 396 | { | |
611 | 363 | if (!GTK_IS_IMAGE (widget) || AWN_IS_SEPARATOR (widget)) | 397 | cairo_new_path (cr); |
612 | 364 | { | 398 | ly = y; |
613 | 365 | /* if not expander continue */ | 399 | lx = lx + dc; |
614 | 366 | continue; | 400 | cairo_move_to (cr, lx, ly); |
615 | 367 | } | 401 | } |
616 | 368 | /* expander found */ | 402 | else |
617 | 369 | switch (position) | 403 | { |
618 | 370 | { | 404 | _line_from_to (cr, &lx, &ly, lx + dc, y); |
619 | 371 | case GTK_POS_BOTTOM: | 405 | } |
620 | 372 | case GTK_POS_TOP: | 406 | } |
621 | 373 | curx = widget->allocation.x; | 407 | } |
622 | 374 | if (exps_found % 2 != 0) | 408 | } |
623 | 375 | { | 409 | /* "first curve" done. */ |
624 | 376 | curx += widget->allocation.width; | 410 | /* now we are on y or y2 */ |
625 | 377 | } | 411 | /* start loop on widgets */ |
626 | 378 | break; | 412 | curx = lx; |
627 | 379 | default: | 413 | for (; i; i = i->next) |
628 | 380 | curx = widget->allocation.y; | 414 | { |
629 | 381 | if ( exps_found % 2 != 0) | 415 | widget = GTK_WIDGET (i->data); |
630 | 382 | { | 416 | |
631 | 383 | curx += widget->allocation.height; | 417 | if (!IS_SPECIAL (widget)) |
632 | 384 | } | 418 | { |
633 | 385 | break; | 419 | /* if not special continue */ |
634 | 386 | } | 420 | continue; |
635 | 387 | if (curx < 0) | 421 | } |
636 | 388 | { | 422 | /* special found */ |
637 | 389 | continue; | 423 | switch (position) |
638 | 390 | } | 424 | { |
639 | 391 | 425 | case GTK_POS_BOTTOM: | |
640 | 392 | if (exps_found == 0) | 426 | case GTK_POS_TOP: |
641 | 393 | { | 427 | curx = widget->allocation.x + pad_left; |
642 | 394 | /* this is the first expander */ | 428 | break; |
643 | 395 | lx = curx; | 429 | default: |
644 | 396 | cairo_move_to (cr, lx, ly); | 430 | curx = widget->allocation.y + pad_left; |
645 | 397 | _line_from_to (cr, &lx, &ly, curx + d, y2); | 431 | break; |
646 | 398 | } | 432 | } |
647 | 399 | else | 433 | if ((curx - pad_left) < 0) |
648 | 400 | { | 434 | { |
649 | 401 | if (exps_found % 2 != 0) | 435 | continue; |
650 | 402 | { | 436 | } |
651 | 403 | /* odd expander - curve at the end of expander */ | 437 | _line_from_to (cr, &lx, &ly, curx, ly); |
652 | 404 | _line_from_to (cr, &lx, &ly, curx - d, y2); | 438 | if (ly == y2) |
653 | 405 | if (i->next == NULL) | 439 | { |
654 | 406 | _line_from_to (cr, &lx, &ly, curx, y2); | 440 | _line_from_to (cr, &lx, &ly, lx + d, y); |
655 | 407 | _line_from_to (cr, &lx, &ly, curx, y); | 441 | } |
656 | 408 | } | 442 | else |
657 | 409 | else | 443 | { |
658 | 410 | { | 444 | _line_from_to (cr, &lx, &ly, lx + d, y2); |
659 | 411 | /* even expander - curve at the start of expander */ | 445 | } |
660 | 412 | _line_from_to (cr, &lx, &ly, curx, y); | 446 | } |
661 | 413 | _line_from_to (cr, &lx, &ly, curx + d, y2); | 447 | g_list_free (widgets); |
662 | 414 | /* else the last widget is an expander */ | 448 | if (expanded) |
663 | 415 | } | 449 | { |
664 | 416 | } | 450 | /* make sure that cairo close path in the right way */ |
665 | 417 | 451 | _line_from_to (cr, &lx, &ly, w, ly); | |
666 | 418 | ++exps_found; | 452 | if (internal) |
667 | 419 | } | 453 | { |
668 | 420 | g_list_free (widgets); | 454 | _line_from_to (cr, &lx, &ly, lx, y); |
669 | 421 | 455 | } | |
670 | 422 | _line_from_to (cr, &lx, &ly, w, ly); | 456 | else |
671 | 423 | 457 | { | |
672 | 424 | if (exps_found % 2 != 0) | 458 | _line_from_to (cr, &lx, &ly, lx, y3); |
673 | 425 | { | 459 | } |
674 | 426 | _line_from_to (cr, &lx, &ly, lx, y); | 460 | } |
675 | 427 | } | 461 | else |
676 | 428 | 462 | { | |
677 | 429 | cairo_close_path (cr); | 463 | if (align == 1.) |
678 | 430 | } | 464 | { |
679 | 431 | else | 465 | if (internal) |
680 | 432 | { | 466 | { |
681 | 433 | /* Auto-Stripe & Expanded & External */ | 467 | if (ly == y2) |
682 | 434 | 468 | { | |
683 | 435 | GList *widgets = _get_applet_widgets (bg); | 469 | _line_from_to (cr, &lx, &ly, w, ly); |
684 | 436 | GList *i = widgets; | 470 | _line_from_to (cr, &lx, &ly, lx, y); |
685 | 437 | GtkWidget *widget = NULL; | 471 | } |
686 | 438 | 472 | /* else close path */ | |
687 | 439 | /* analyze first widget*/ | 473 | } |
688 | 440 | if (i) | 474 | else |
689 | 441 | { | 475 | { |
436 | 442 | widget = GTK_WIDGET (i->data); | ||
437 | 443 | |||
438 | 444 | ly = y3; | ||
439 | 445 | cairo_move_to (cr, lx, ly); | ||
440 | 446 | |||
441 | 447 | /* if first widget is an expander or align==0 || 1*/ | ||
442 | 448 | if ( (widget && GTK_IS_IMAGE (widget) && !AWN_IS_SEPARATOR (widget) ) || | ||
443 | 449 | ( align == 0. || align == 1. ) ) | ||
444 | 450 | { | ||
445 | 451 | /* start from bottom */ | ||
446 | 452 | _line_from_to (cr, &lx, &ly, lx, y2); | ||
447 | 453 | ++exps_found; | ||
448 | 454 | if (align != 0. && align != 1.) | ||
449 | 455 | i = i->next; | ||
450 | 456 | } | ||
451 | 457 | else | ||
452 | 458 | { | ||
453 | 459 | /* start from top */ | ||
454 | 460 | _line_from_to (cr, &lx, &ly, lx, y); | ||
455 | 461 | } | ||
456 | 462 | } | ||
457 | 463 | |||
458 | 464 | for (; i; i = i->next) | ||
459 | 465 | { | ||
460 | 466 | widget = GTK_WIDGET (i->data); | ||
461 | 467 | |||
462 | 468 | if (!GTK_IS_IMAGE (widget) || AWN_IS_SEPARATOR (widget)) | ||
463 | 469 | { | ||
464 | 470 | /* if not expander continue */ | ||
465 | 471 | continue; | ||
466 | 472 | } | ||
467 | 473 | /* expander found */ | ||
468 | 474 | switch (position) | ||
469 | 475 | { | ||
470 | 476 | case GTK_POS_BOTTOM: | ||
471 | 477 | case GTK_POS_TOP: | ||
472 | 478 | curx = widget->allocation.x; | ||
473 | 479 | if (exps_found % 2 != 0) | ||
474 | 480 | { | ||
475 | 481 | curx += widget->allocation.width; | ||
476 | 482 | } | ||
477 | 483 | break; | ||
478 | 484 | default: | ||
479 | 485 | curx = widget->allocation.y; | ||
480 | 486 | if (exps_found % 2 != 0) | ||
481 | 487 | { | ||
482 | 488 | curx += widget->allocation.height; | ||
483 | 489 | } | ||
484 | 490 | break; | ||
485 | 491 | } | ||
486 | 492 | if (curx < 0) | ||
487 | 493 | { | ||
488 | 494 | continue; | ||
489 | 495 | } | ||
490 | 496 | |||
491 | 497 | if (exps_found % 2 != 0) | ||
492 | 498 | { | ||
493 | 499 | _line_from_to (cr, &lx, &ly, curx - d, y2); | ||
494 | 500 | if (i->next != NULL) | ||
495 | 501 | _line_from_to (cr, &lx, &ly, curx, y); | ||
496 | 502 | } | ||
497 | 503 | else | ||
498 | 504 | { | ||
499 | 505 | _line_from_to (cr, &lx, &ly, curx, y); | ||
500 | 506 | _line_from_to (cr, &lx, &ly, curx + d, y2); | ||
501 | 507 | } | ||
502 | 508 | ++exps_found; | ||
503 | 509 | } | ||
504 | 510 | g_list_free (widgets); | ||
505 | 511 | |||
690 | 512 | _line_from_to (cr, &lx, &ly, w, ly); | 476 | _line_from_to (cr, &lx, &ly, w, ly); |
691 | 513 | _line_from_to (cr, &lx, &ly, lx, y3); | 477 | _line_from_to (cr, &lx, &ly, lx, y3); |
692 | 514 | |||
693 | 515 | cairo_close_path (cr); | ||
694 | 516 | } | 478 | } |
695 | 517 | } | 479 | } |
696 | 518 | else | 480 | else |
697 | 519 | { | 481 | { |
698 | 520 | if (internal) | 482 | if (internal) |
699 | 521 | { | 483 | { |
717 | 522 | /* Auto-Stripe & Not-Expanded & Internal */ | 484 | if (ly == y2) |
718 | 523 | /* no-path */ | 485 | { |
719 | 524 | } | 486 | _line_from_to (cr, &lx, &ly, w - dc, y2); |
720 | 525 | else | 487 | _line_from_to (cr, &lx, &ly, w, y3); |
704 | 526 | { | ||
705 | 527 | /* Auto-Stripe & Not-Expanded & External */ | ||
706 | 528 | ly = y3; | ||
707 | 529 | cairo_move_to (cr, lx, ly); | ||
708 | 530 | |||
709 | 531 | if (align == 0.) | ||
710 | 532 | _line_from_to (cr, &lx, &ly, lx , y); | ||
711 | 533 | else | ||
712 | 534 | _line_from_to (cr, &lx, &ly, lx + dc, y); | ||
713 | 535 | |||
714 | 536 | if (align == 1.) | ||
715 | 537 | _line_from_to (cr, &lx, &ly, w, y); | ||
716 | 538 | else | ||
721 | 539 | _line_from_to (cr, &lx, &ly, w - dc, y); | 488 | _line_from_to (cr, &lx, &ly, w - dc, y); |
723 | 540 | 489 | } | |
724 | 490 | /* else close path */ | ||
725 | 491 | } | ||
726 | 492 | else | ||
727 | 493 | { | ||
728 | 494 | _line_from_to (cr, &lx, &ly, w - dc, ly); | ||
729 | 541 | _line_from_to (cr, &lx, &ly, w, y3); | 495 | _line_from_to (cr, &lx, &ly, w, y3); |
730 | 542 | cairo_close_path (cr); | ||
731 | 543 | } | 496 | } |
732 | 544 | } | 497 | } |
733 | 545 | } | 498 | } |
734 | 499 | cairo_close_path (cr); | ||
735 | 500 | |||
736 | 546 | } | 501 | } |
737 | 547 | 502 | ||
738 | 548 | static void | 503 | static void |
739 | 549 | draw_top_bottom_background (AwnBackground* bg, | 504 | draw_top_bottom_background (AwnBackground* bg, |
740 | 550 | GtkPositionType position, | 505 | GtkPositionType position, |
741 | 551 | cairo_t* cr, | 506 | cairo_t* cr, |
744 | 552 | gint width, | 507 | gfloat width, |
745 | 553 | gint height) | 508 | gfloat height) |
746 | 554 | { | 509 | { |
747 | 555 | cairo_pattern_t *pat = NULL; | 510 | cairo_pattern_t *pat = NULL; |
748 | 556 | cairo_pattern_t *pat_hi = NULL; | 511 | cairo_pattern_t *pat_hi = NULL; |
749 | @@ -565,16 +520,9 @@ | |||
750 | 565 | gfloat align = awn_background_get_panel_alignment (AWN_BACKGROUND (bg)); | 520 | gfloat align = awn_background_get_panel_alignment (AWN_BACKGROUND (bg)); |
751 | 566 | 521 | ||
752 | 567 | /* Make sure the bar gets drawn on the 0.5 pixels (for sharp edges) */ | 522 | /* Make sure the bar gets drawn on the 0.5 pixels (for sharp edges) */ |
763 | 568 | switch (position) | 523 | cairo_translate (cr, 0.5, 0.5); |
764 | 569 | { | 524 | width -= 0.5; |
765 | 570 | case GTK_POS_TOP: | 525 | height -= 0.5; |
756 | 571 | case GTK_POS_BOTTOM: | ||
757 | 572 | cairo_translate (cr, 0., 0.5); | ||
758 | 573 | break; | ||
759 | 574 | default: | ||
760 | 575 | cairo_translate (cr, 0.5, 0.); | ||
761 | 576 | break; | ||
762 | 577 | } | ||
766 | 578 | 526 | ||
767 | 579 | if (gtk_widget_is_composited (GTK_WIDGET (bg->panel)) == FALSE) | 527 | if (gtk_widget_is_composited (GTK_WIDGET (bg->panel)) == FALSE) |
768 | 580 | { | 528 | { |
769 | @@ -583,12 +531,12 @@ | |||
770 | 583 | 531 | ||
771 | 584 | /* create internal path */ | 532 | /* create internal path */ |
772 | 585 | _create_path_lucido (bg, position, cr, -1.0, 0., width, height, | 533 | _create_path_lucido (bg, position, cr, -1.0, 0., width, height, |
775 | 586 | bg->stripe_width, TRANSFORM_RADIUS (bg->corner_radius), | 534 | TRANSFORM_RADIUS (bg->corner_radius), |
776 | 587 | TRANSFORM_RADIUS (bg->corner_radius), bg->curves_symmetry, | 535 | TRANSFORM_RADIUS (bg->corner_radius), |
777 | 588 | 1, expand, align); | 536 | 1, expand, align); |
778 | 589 | 537 | ||
779 | 590 | /* Draw internal pattern if needed */ | 538 | /* Draw internal pattern if needed */ |
781 | 591 | if ((expand || bg->stripe_width != 0.) && bg->enable_pattern && bg->pattern) | 539 | if (bg->enable_pattern && bg->pattern) |
782 | 592 | { | 540 | { |
783 | 593 | /* Prepare pattern */ | 541 | /* Prepare pattern */ |
784 | 594 | pat_hi = cairo_pattern_create_for_surface (bg->pattern); | 542 | pat_hi = cairo_pattern_create_for_surface (bg->pattern); |
785 | @@ -601,6 +549,13 @@ | |||
786 | 601 | cairo_restore (cr); | 549 | cairo_restore (cr); |
787 | 602 | cairo_pattern_destroy (pat_hi); | 550 | cairo_pattern_destroy (pat_hi); |
788 | 603 | } | 551 | } |
789 | 552 | /* Prepare the hi-light */ | ||
790 | 553 | pat_hi = cairo_pattern_create_linear (0, 0, 0, height); | ||
791 | 554 | awn_cairo_pattern_add_color_stop_color (pat_hi, 0.0, bg->g_histep_1); | ||
792 | 555 | awn_cairo_pattern_add_color_stop_color (pat_hi, 0.3, bg->g_histep_2); | ||
793 | 556 | double red, green, blue, alpha; | ||
794 | 557 | desktop_agnostic_color_get_cairo_color (bg->g_histep_2, &red, &green, &blue, &alpha); | ||
795 | 558 | cairo_pattern_add_color_stop_rgba (pat_hi, 0.4, red, green, blue, 0.); | ||
796 | 604 | 559 | ||
797 | 605 | /* Prepare the internal background */ | 560 | /* Prepare the internal background */ |
798 | 606 | pat = cairo_pattern_create_linear (0, 0, 0, height); | 561 | pat = cairo_pattern_create_linear (0, 0, 0, height); |
799 | @@ -613,36 +568,25 @@ | |||
800 | 613 | cairo_set_source (cr, pat); | 568 | cairo_set_source (cr, pat); |
801 | 614 | cairo_paint (cr); | 569 | cairo_paint (cr); |
802 | 615 | cairo_restore (cr); | 570 | cairo_restore (cr); |
812 | 616 | 571 | /* Draw the internal hi-light gradient */ | |
813 | 617 | /* Prepare external background gradient*/ | 572 | cairo_save (cr); |
814 | 618 | if (expand || bg->stripe_width != 0.) | 573 | cairo_clip (cr); |
815 | 619 | { | 574 | cairo_set_source (cr, pat_hi); |
816 | 620 | cairo_pattern_destroy (pat); | 575 | cairo_paint (cr); |
817 | 621 | pat = cairo_pattern_create_linear (0, 0, 0, height); | 576 | cairo_restore (cr); |
818 | 622 | awn_cairo_pattern_add_color_stop_color (pat, 0.0, bg->g_step_1); | 577 | |
819 | 623 | awn_cairo_pattern_add_color_stop_color (pat, 1.0, bg->g_step_2); | 578 | /* Prepare external background gradient*/ |
820 | 624 | } | 579 | cairo_pattern_destroy (pat); |
821 | 580 | pat = cairo_pattern_create_linear (0, 0, 0, height); | ||
822 | 581 | awn_cairo_pattern_add_color_stop_color (pat, 0.0, bg->g_step_1); | ||
823 | 582 | awn_cairo_pattern_add_color_stop_color (pat, 1.0, bg->g_step_2); | ||
824 | 583 | |||
825 | 625 | 584 | ||
826 | 626 | /* create external path */ | 585 | /* create external path */ |
827 | 627 | _create_path_lucido (bg, position, cr, -1.0, 0., width, height, | 586 | _create_path_lucido (bg, position, cr, -1.0, 0., width, height, |
830 | 628 | bg->stripe_width, TRANSFORM_RADIUS (bg->corner_radius), | 587 | TRANSFORM_RADIUS (bg->corner_radius), |
831 | 629 | TRANSFORM_RADIUS (bg->corner_radius), bg->curves_symmetry, | 588 | TRANSFORM_RADIUS (bg->corner_radius), |
832 | 630 | 0, expand, align); | 589 | 0, expand, align); |
833 | 631 | |||
834 | 632 | /* Draw external pattern if needed */ | ||
835 | 633 | if (!expand && bg->stripe_width == 0. && bg->enable_pattern && bg->pattern) | ||
836 | 634 | { | ||
837 | 635 | /* Prepare pattern */ | ||
838 | 636 | pat_hi = cairo_pattern_create_for_surface (bg->pattern); | ||
839 | 637 | cairo_pattern_set_extend (pat_hi, CAIRO_EXTEND_REPEAT); | ||
840 | 638 | /* Draw */ | ||
841 | 639 | cairo_save (cr); | ||
842 | 640 | cairo_clip_preserve (cr); | ||
843 | 641 | cairo_set_source (cr, pat_hi); | ||
844 | 642 | cairo_paint (cr); | ||
845 | 643 | cairo_restore (cr); | ||
846 | 644 | cairo_pattern_destroy (pat_hi); | ||
847 | 645 | } | ||
848 | 646 | 590 | ||
849 | 647 | /* Draw the external background */ | 591 | /* Draw the external background */ |
850 | 648 | cairo_save (cr); | 592 | cairo_save (cr); |
851 | @@ -652,19 +596,13 @@ | |||
852 | 652 | cairo_restore (cr); | 596 | cairo_restore (cr); |
853 | 653 | cairo_pattern_destroy (pat); | 597 | cairo_pattern_destroy (pat); |
854 | 654 | 598 | ||
866 | 655 | /* Draw the hi-light */ | 599 | /* Draw the internal hi-light gradient */ |
867 | 656 | pat_hi = cairo_pattern_create_linear (0, 0, 0, (height / 3.0)); | 600 | cairo_save (cr); |
868 | 657 | awn_cairo_pattern_add_color_stop_color (pat_hi, 0.0, bg->g_histep_1); | 601 | cairo_clip (cr); |
858 | 658 | awn_cairo_pattern_add_color_stop_color (pat_hi, 1.0, bg->g_histep_2); | ||
859 | 659 | |||
860 | 660 | if (expand) | ||
861 | 661 | { | ||
862 | 662 | cairo_new_path (cr); | ||
863 | 663 | cairo_rectangle (cr, 0, 0, width, (height / 3.0)); | ||
864 | 664 | } | ||
865 | 665 | |||
869 | 666 | cairo_set_source (cr, pat_hi); | 602 | cairo_set_source (cr, pat_hi); |
871 | 667 | cairo_fill (cr); | 603 | cairo_paint (cr); |
872 | 604 | cairo_restore (cr); | ||
873 | 605 | |||
874 | 668 | cairo_pattern_destroy (pat_hi); | 606 | cairo_pattern_destroy (pat_hi); |
875 | 669 | 607 | ||
876 | 670 | return; | 608 | return; |
877 | @@ -686,14 +624,14 @@ | |||
878 | 686 | { | 624 | { |
879 | 687 | awn_cairo_set_source_color (cr, bg->border_color); | 625 | awn_cairo_set_source_color (cr, bg->border_color); |
880 | 688 | _create_path_lucido (bg, position, cr, 0., 0., width, height, | 626 | _create_path_lucido (bg, position, cr, 0., 0., width, height, |
883 | 689 | bg->stripe_width, TRANSFORM_RADIUS (bg->corner_radius), | 627 | TRANSFORM_RADIUS (bg->corner_radius), |
884 | 690 | TRANSFORM_RADIUS (bg->corner_radius), bg->curves_symmetry, | 628 | TRANSFORM_RADIUS (bg->corner_radius), |
885 | 691 | 0, expand, align); | 629 | 0, expand, align); |
886 | 692 | cairo_stroke (cr); | 630 | cairo_stroke (cr); |
887 | 693 | awn_cairo_set_source_color (cr, bg->hilight_color); | 631 | awn_cairo_set_source_color (cr, bg->hilight_color); |
888 | 694 | _create_path_lucido (bg, position, cr, 1., 1., width-1., height-1., | 632 | _create_path_lucido (bg, position, cr, 1., 1., width-1., height-1., |
891 | 695 | bg->stripe_width, TRANSFORM_RADIUS (bg->corner_radius), | 633 | TRANSFORM_RADIUS (bg->corner_radius), |
892 | 696 | TRANSFORM_RADIUS (bg->corner_radius), bg->curves_symmetry, | 634 | TRANSFORM_RADIUS (bg->corner_radius), |
893 | 697 | 0, expand, align); | 635 | 0, expand, align); |
894 | 698 | } | 636 | } |
895 | 699 | cairo_stroke (cr); | 637 | cairo_stroke (cr); |
896 | @@ -800,6 +738,39 @@ | |||
897 | 800 | cairo_restore (cr); | 738 | cairo_restore (cr); |
898 | 801 | } | 739 | } |
899 | 802 | 740 | ||
900 | 741 | static void | ||
901 | 742 | _set_special_widget_width_and_transparent (AwnBackground *bg, | ||
902 | 743 | gint width, | ||
903 | 744 | gboolean transp, | ||
904 | 745 | gboolean dispose) | ||
905 | 746 | { | ||
906 | 747 | GList *widgets = _get_applet_widgets (bg); | ||
907 | 748 | GList *i = widgets; | ||
908 | 749 | GtkWidget *widget = NULL; | ||
909 | 750 | |||
910 | 751 | if (i && IS_SPECIAL (i->data) && !dispose) | ||
911 | 752 | { | ||
912 | 753 | widget = GTK_WIDGET (i->data); | ||
913 | 754 | g_object_set (G_OBJECT (widget), "separator-size", 0, NULL); | ||
914 | 755 | g_object_set (G_OBJECT (widget), "transparent", transp, NULL); | ||
915 | 756 | i = i->next; | ||
916 | 757 | } | ||
917 | 758 | |||
918 | 759 | for (; i; i = i->next) | ||
919 | 760 | { | ||
920 | 761 | widget = GTK_WIDGET (i->data); | ||
921 | 762 | if (!IS_SPECIAL (widget)) | ||
922 | 763 | { | ||
923 | 764 | /* if not special continue */ | ||
924 | 765 | continue; | ||
925 | 766 | } | ||
926 | 767 | g_object_set (G_OBJECT (widget), "separator-size", width, NULL); | ||
927 | 768 | g_object_set (G_OBJECT (widget), "transparent", transp, NULL); | ||
928 | 769 | } | ||
929 | 770 | |||
930 | 771 | g_list_free (widgets); | ||
931 | 772 | } | ||
932 | 773 | |||
933 | 803 | static gboolean | 774 | static gboolean |
934 | 804 | awn_background_lucido_get_needs_redraw (AwnBackground *bg, | 775 | awn_background_lucido_get_needs_redraw (AwnBackground *bg, |
935 | 805 | GtkPositionType position, | 776 | GtkPositionType position, |
936 | @@ -813,45 +784,55 @@ | |||
937 | 813 | return TRUE; | 784 | return TRUE; |
938 | 814 | } | 785 | } |
939 | 815 | 786 | ||
941 | 816 | /* Check expanders positions & sizes changed */ | 787 | /* Check separators positions & sizes changed */ |
942 | 817 | GList *widgets = _get_applet_widgets (bg); | 788 | GList *widgets = _get_applet_widgets (bg); |
943 | 818 | GList *i = widgets; | 789 | GList *i = widgets; |
944 | 819 | GtkWidget *widget = NULL; | 790 | GtkWidget *widget = NULL; |
945 | 820 | gint wcheck = 0; | 791 | gint wcheck = 0; |
946 | 821 | gint ncheck = 0; | 792 | gint ncheck = 0; |
947 | 793 | gint pcheck = 0; | ||
948 | 822 | 794 | ||
949 | 823 | for (; i; i = i->next) | 795 | for (; i; i = i->next) |
950 | 824 | { | 796 | { |
951 | 825 | widget = GTK_WIDGET (i->data); | 797 | widget = GTK_WIDGET (i->data); |
954 | 826 | 798 | if (!IS_SPECIAL (widget)) | |
953 | 827 | if (!GTK_IS_IMAGE (widget) || AWN_IS_SEPARATOR (widget)) | ||
955 | 828 | { | 799 | { |
957 | 829 | /* if not expander continue */ | 800 | /* if not special continue */ |
958 | 830 | continue; | 801 | continue; |
959 | 831 | } | 802 | } |
960 | 832 | switch (position) | ||
961 | 833 | { | ||
962 | 834 | case GTK_POS_BOTTOM: | ||
963 | 835 | case GTK_POS_TOP: | ||
964 | 836 | wcheck += (widget->allocation.x * 3) / 2 + widget->allocation.width; | ||
965 | 837 | break; | ||
966 | 838 | default: | ||
967 | 839 | wcheck += (widget->allocation.y * 3 ) / 2 + widget->allocation.height; | ||
968 | 840 | break; | ||
969 | 841 | } | ||
970 | 842 | ++ncheck; | 803 | ++ncheck; |
971 | 804 | pcheck += ncheck; | ||
972 | 805 | switch (position) | ||
973 | 806 | { | ||
974 | 807 | case GTK_POS_BOTTOM: | ||
975 | 808 | case GTK_POS_TOP: | ||
976 | 809 | wcheck += (widget->allocation.x * ncheck); | ||
977 | 810 | break; | ||
978 | 811 | default: | ||
979 | 812 | wcheck += (widget->allocation.y * ncheck); | ||
980 | 813 | break; | ||
981 | 814 | } | ||
982 | 843 | } | 815 | } |
983 | 844 | g_list_free (widgets); | 816 | g_list_free (widgets); |
984 | 845 | 817 | ||
985 | 818 | pcheck += _get_applet_manager_size (bg, position); | ||
986 | 819 | |||
987 | 846 | AwnBackgroundLucido *lbg = NULL; | 820 | AwnBackgroundLucido *lbg = NULL; |
988 | 847 | lbg = AWN_BACKGROUND_LUCIDO (bg); | 821 | lbg = AWN_BACKGROUND_LUCIDO (bg); |
989 | 848 | AwnBackgroundLucidoPrivate *priv; | 822 | AwnBackgroundLucidoPrivate *priv; |
990 | 849 | priv = AWN_BACKGROUND_LUCIDO_GET_PRIVATE (lbg); | 823 | priv = AWN_BACKGROUND_LUCIDO_GET_PRIVATE (lbg); |
991 | 850 | if (priv->expn != ncheck) | 824 | if (priv->expn != ncheck) |
992 | 851 | { | 825 | { |
994 | 852 | priv->expn = ncheck; | 826 | _set_special_widget_width_and_transparent |
995 | 827 | (bg, TRANSFORM_RADIUS (bg->corner_radius), TRUE, FALSE); | ||
996 | 828 | } | ||
997 | 829 | |||
998 | 830 | if (priv->expp != pcheck) | ||
999 | 831 | { | ||
1000 | 832 | priv->expp = pcheck; | ||
1001 | 853 | /* used to refresh bar */ | 833 | /* used to refresh bar */ |
1003 | 854 | awn_background_emit_padding_changed (bg); | 834 | awn_background_emit_changed (bg); |
1004 | 835 | return TRUE; | ||
1005 | 855 | } | 836 | } |
1006 | 856 | if (priv->expw != wcheck) | 837 | if (priv->expw != wcheck) |
1007 | 857 | { | 838 | { |
1008 | @@ -911,9 +892,15 @@ | |||
1009 | 911 | else | 892 | else |
1010 | 912 | { | 893 | { |
1011 | 913 | _create_path_lucido (bg, position, cr, 0, 0., width, height, | 894 | _create_path_lucido (bg, position, cr, 0, 0., width, height, |
1014 | 914 | bg->stripe_width, TRANSFORM_RADIUS (bg->corner_radius), | 895 | TRANSFORM_RADIUS (bg->corner_radius), |
1015 | 915 | TRANSFORM_RADIUS (bg->corner_radius), bg->curves_symmetry, | 896 | TRANSFORM_RADIUS (bg->corner_radius), |
1016 | 916 | 0, expand, align); | 897 | 0, expand, align); |
1017 | 898 | cairo_fill (cr); | ||
1018 | 899 | _create_path_lucido (bg, position, cr, 0, 0., width, height, | ||
1019 | 900 | TRANSFORM_RADIUS (bg->corner_radius), | ||
1020 | 901 | TRANSFORM_RADIUS (bg->corner_radius), | ||
1021 | 902 | 1, expand, align); | ||
1022 | 903 | |||
1023 | 917 | } | 904 | } |
1024 | 918 | cairo_fill (cr); | 905 | cairo_fill (cr); |
1025 | 919 | 906 | ||
1026 | 920 | 907 | ||
1027 | === modified file 'src/awn-background.c' | |||
1028 | --- src/awn-background.c 2010-06-02 09:54:30 +0000 | |||
1029 | +++ src/awn-background.c 2010-06-08 09:35:36 +0000 | |||
1030 | @@ -59,8 +59,7 @@ | |||
1031 | 59 | PROP_PANEL_ANGLE, | 59 | PROP_PANEL_ANGLE, |
1032 | 60 | PROP_CURVINESS, | 60 | PROP_CURVINESS, |
1033 | 61 | PROP_CURVES_SYMEMETRY, | 61 | PROP_CURVES_SYMEMETRY, |
1036 | 62 | PROP_FLOATY_OFFSET, | 62 | PROP_FLOATY_OFFSET |
1035 | 63 | PROP_STRIPE_WIDTH | ||
1037 | 64 | }; | 63 | }; |
1038 | 65 | 64 | ||
1039 | 66 | enum | 65 | enum |
1040 | @@ -197,11 +196,6 @@ | |||
1041 | 197 | object, "curves-symmetry", TRUE, | 196 | object, "curves-symmetry", TRUE, |
1042 | 198 | DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK, | 197 | DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK, |
1043 | 199 | NULL); | 198 | NULL); |
1044 | 200 | desktop_agnostic_config_client_bind (bg->client, | ||
1045 | 201 | AWN_GROUP_THEME, AWN_THEME_STRIPE_WIDTH, | ||
1046 | 202 | object, "stripe-width", TRUE, | ||
1047 | 203 | DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK, | ||
1048 | 204 | NULL); | ||
1049 | 205 | } | 199 | } |
1050 | 206 | 200 | ||
1051 | 207 | static void | 201 | static void |
1052 | @@ -367,9 +361,6 @@ | |||
1053 | 367 | case PROP_FLOATY_OFFSET: | 361 | case PROP_FLOATY_OFFSET: |
1054 | 368 | bg->floaty_offset = g_value_get_int (value); | 362 | bg->floaty_offset = g_value_get_int (value); |
1055 | 369 | break; | 363 | break; |
1056 | 370 | case PROP_STRIPE_WIDTH: | ||
1057 | 371 | bg->stripe_width = g_value_get_float (value); | ||
1058 | 372 | break; | ||
1059 | 373 | 364 | ||
1060 | 374 | default: | 365 | default: |
1061 | 375 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | 366 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
1062 | @@ -620,15 +611,6 @@ | |||
1063 | 620 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT | | 611 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT | |
1064 | 621 | G_PARAM_STATIC_STRINGS)); | 612 | G_PARAM_STATIC_STRINGS)); |
1065 | 622 | 613 | ||
1066 | 623 | g_object_class_install_property (obj_class, | ||
1067 | 624 | PROP_STRIPE_WIDTH, | ||
1068 | 625 | g_param_spec_float ("stripe-width", | ||
1069 | 626 | "Stripe Width", | ||
1070 | 627 | "The width of the stripe", | ||
1071 | 628 | 0.0, 1.0, 0.0, | ||
1072 | 629 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT | | ||
1073 | 630 | G_PARAM_STATIC_STRINGS)); | ||
1074 | 631 | |||
1075 | 632 | /* Add signals to the class */ | 614 | /* Add signals to the class */ |
1076 | 633 | _bg_signals[CHANGED] = | 615 | _bg_signals[CHANGED] = |
1077 | 634 | g_signal_new ("changed", | 616 | g_signal_new ("changed", |
1078 | 635 | 617 | ||
1079 | === modified file 'src/awn-background.h' | |||
1080 | --- src/awn-background.h 2010-05-31 17:41:58 +0000 | |||
1081 | +++ src/awn-background.h 2010-06-08 09:35:36 +0000 | |||
1082 | @@ -99,7 +99,6 @@ | |||
1083 | 99 | gint floaty_offset; | 99 | gint floaty_offset; |
1084 | 100 | gfloat curviness; | 100 | gfloat curviness; |
1085 | 101 | gfloat curves_symmetry; | 101 | gfloat curves_symmetry; |
1086 | 102 | gfloat stripe_width; | ||
1087 | 103 | 102 | ||
1088 | 104 | /* private */ | 103 | /* private */ |
1089 | 105 | guint changed; | 104 | guint changed; |
1090 | 106 | 105 | ||
1091 | === modified file 'src/awn-defines.h' | |||
1092 | --- src/awn-defines.h 2010-05-31 17:41:58 +0000 | |||
1093 | +++ src/awn-defines.h 2010-06-08 09:35:36 +0000 | |||
1094 | @@ -88,7 +88,6 @@ | |||
1095 | 88 | #define AWN_THEME_CURVINESS "curviness" | 88 | #define AWN_THEME_CURVINESS "curviness" |
1096 | 89 | #define AWN_THEME_CURVES_SYMMETRY "curves_symmetry" | 89 | #define AWN_THEME_CURVES_SYMMETRY "curves_symmetry" |
1097 | 90 | #define AWN_THEME_FLOATY_OFFSET "floaty_offset" | 90 | #define AWN_THEME_FLOATY_OFFSET "floaty_offset" |
1098 | 91 | #define AWN_THEME_STRIPE_WIDTH "stripe_width" | ||
1099 | 92 | 91 | ||
1100 | 93 | #endif /*_HAVE_AWN_DEFINES_H */ | 92 | #endif /*_HAVE_AWN_DEFINES_H */ |
1101 | 94 | 93 | ||
1102 | 95 | 94 | ||
1103 | === modified file 'src/awn-separator.c' | |||
1104 | --- src/awn-separator.c 2010-01-01 21:35:47 +0000 | |||
1105 | +++ src/awn-separator.c 2010-06-08 09:35:36 +0000 | |||
1106 | @@ -34,7 +34,9 @@ | |||
1107 | 34 | GtkPositionType position; | 34 | GtkPositionType position; |
1108 | 35 | gint offset; | 35 | gint offset; |
1109 | 36 | gint size; | 36 | gint size; |
1110 | 37 | gint separator_size; | ||
1111 | 37 | 38 | ||
1112 | 39 | gboolean transparent; | ||
1113 | 38 | DesktopAgnosticColor *sep_color; | 40 | DesktopAgnosticColor *sep_color; |
1114 | 39 | }; | 41 | }; |
1115 | 40 | 42 | ||
1116 | @@ -47,7 +49,10 @@ | |||
1117 | 47 | PROP_OFFSET, | 49 | PROP_OFFSET, |
1118 | 48 | PROP_SIZE, | 50 | PROP_SIZE, |
1119 | 49 | 51 | ||
1121 | 50 | PROP_SEP_COLOR | 52 | PROP_SEP_COLOR, |
1122 | 53 | PROP_SEP_TRANSPARENT, | ||
1123 | 54 | |||
1124 | 55 | PROP_SEP_SIZE | ||
1125 | 51 | }; | 56 | }; |
1126 | 52 | 57 | ||
1127 | 53 | static void | 58 | static void |
1128 | @@ -78,6 +83,12 @@ | |||
1129 | 78 | case PROP_SEP_COLOR: | 83 | case PROP_SEP_COLOR: |
1130 | 79 | g_value_set_object (value, priv->sep_color); | 84 | g_value_set_object (value, priv->sep_color); |
1131 | 80 | break; | 85 | break; |
1132 | 86 | case PROP_SEP_SIZE: | ||
1133 | 87 | g_value_set_int (value, priv->separator_size); | ||
1134 | 88 | break; | ||
1135 | 89 | case PROP_SEP_TRANSPARENT: | ||
1136 | 90 | g_value_set_boolean (value, priv->transparent); | ||
1137 | 91 | break; | ||
1138 | 81 | default: | 92 | default: |
1139 | 82 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | 93 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
1140 | 83 | } | 94 | } |
1141 | @@ -126,6 +137,18 @@ | |||
1142 | 126 | priv->sep_color = g_value_dup_object (value); | 137 | priv->sep_color = g_value_dup_object (value); |
1143 | 127 | gtk_widget_queue_draw (GTK_WIDGET (object)); | 138 | gtk_widget_queue_draw (GTK_WIDGET (object)); |
1144 | 128 | break; | 139 | break; |
1145 | 140 | case PROP_SEP_SIZE: | ||
1146 | 141 | temp = g_value_get_int (value); | ||
1147 | 142 | if (temp == priv->separator_size) break; | ||
1148 | 143 | priv->separator_size = temp; | ||
1149 | 144 | gtk_widget_queue_resize (GTK_WIDGET (object)); | ||
1150 | 145 | break; | ||
1151 | 146 | case PROP_SEP_TRANSPARENT: | ||
1152 | 147 | temp = g_value_get_boolean (value); | ||
1153 | 148 | if (temp == priv->transparent) break; | ||
1154 | 149 | priv->transparent = temp; | ||
1155 | 150 | gtk_widget_queue_draw (GTK_WIDGET (object)); | ||
1156 | 151 | break; | ||
1157 | 129 | default: | 152 | default: |
1158 | 130 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | 153 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
1159 | 131 | } | 154 | } |
1160 | @@ -181,13 +204,13 @@ | |||
1161 | 181 | { | 204 | { |
1162 | 182 | case GTK_POS_TOP: | 205 | case GTK_POS_TOP: |
1163 | 183 | case GTK_POS_BOTTOM: | 206 | case GTK_POS_BOTTOM: |
1165 | 184 | req->width = 10; | 207 | req->width = priv->separator_size; |
1166 | 185 | req->height = priv->size + priv->offset; | 208 | req->height = priv->size + priv->offset; |
1167 | 186 | break; | 209 | break; |
1168 | 187 | case GTK_POS_LEFT: | 210 | case GTK_POS_LEFT: |
1169 | 188 | case GTK_POS_RIGHT: | 211 | case GTK_POS_RIGHT: |
1170 | 189 | req->width = priv->size + priv->offset; | 212 | req->width = priv->size + priv->offset; |
1172 | 190 | req->height = 10; | 213 | req->height = priv->separator_size; |
1173 | 191 | break; | 214 | break; |
1174 | 192 | default: | 215 | default: |
1175 | 193 | break; | 216 | break; |
1176 | @@ -198,12 +221,18 @@ | |||
1177 | 198 | awn_separator_expose (GtkWidget *widget, GdkEventExpose *event) | 221 | awn_separator_expose (GtkWidget *widget, GdkEventExpose *event) |
1178 | 199 | { | 222 | { |
1179 | 200 | AwnSeparatorPrivate *priv = AWN_SEPARATOR (widget)->priv; | 223 | AwnSeparatorPrivate *priv = AWN_SEPARATOR (widget)->priv; |
1180 | 224 | |||
1181 | 225 | if (priv->transparent) | ||
1182 | 226 | { | ||
1183 | 227 | return TRUE; | ||
1184 | 228 | } | ||
1185 | 229 | |||
1186 | 201 | cairo_t *cr; | 230 | cairo_t *cr; |
1187 | 202 | cairo_path_t *path; | 231 | cairo_path_t *path; |
1188 | 203 | GtkOrientation orient; | 232 | GtkOrientation orient; |
1189 | 204 | cairo_pattern_t *pat = NULL, *shadow_pat = NULL; | 233 | cairo_pattern_t *pat = NULL, *shadow_pat = NULL; |
1190 | 205 | gdouble r, g, b, a; | 234 | gdouble r, g, b, a; |
1192 | 206 | 235 | ||
1193 | 207 | cr = gdk_cairo_create (widget->window); | 236 | cr = gdk_cairo_create (widget->window); |
1194 | 208 | g_return_val_if_fail (cr, FALSE); | 237 | g_return_val_if_fail (cr, FALSE); |
1195 | 209 | 238 | ||
1196 | @@ -366,6 +395,24 @@ | |||
1197 | 366 | DESKTOP_AGNOSTIC_TYPE_COLOR, | 395 | DESKTOP_AGNOSTIC_TYPE_COLOR, |
1198 | 367 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); | 396 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
1199 | 368 | 397 | ||
1200 | 398 | g_object_class_install_property (object_class, | ||
1201 | 399 | PROP_SEP_SIZE, | ||
1202 | 400 | g_param_spec_int ("separator-size", | ||
1203 | 401 | "Separator Size", | ||
1204 | 402 | "The size of the separator", | ||
1205 | 403 | 0, G_MAXINT, 10, | ||
1206 | 404 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT | | ||
1207 | 405 | G_PARAM_STATIC_STRINGS)); | ||
1208 | 406 | |||
1209 | 407 | g_object_class_install_property (object_class, | ||
1210 | 408 | PROP_SEP_TRANSPARENT, | ||
1211 | 409 | g_param_spec_boolean ("transparent", | ||
1212 | 410 | "Transparent", | ||
1213 | 411 | "Is separator transparent?", | ||
1214 | 412 | FALSE, | ||
1215 | 413 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT | | ||
1216 | 414 | G_PARAM_STATIC_STRINGS)); | ||
1217 | 415 | |||
1218 | 369 | g_type_class_add_private (klass, sizeof (AwnSeparatorPrivate)); | 416 | g_type_class_add_private (klass, sizeof (AwnSeparatorPrivate)); |
1219 | 370 | } | 417 | } |
1220 | 371 | 418 |
Ok, there'll be many points here, but here we go:
1) Please add curly brackets to all ifs (& elses) per code guidelines (the one-liners). lucido_ redraw - please add variables for AwnBackgroundLu cidoPrivate and AwnBackground, everything caps looks just strange...
2) awn_background_
3) _init_positions - remove 239-240 - it's init, so the assumption that you need to free something is wrong (otherwise it's not really init)
4) 315: starting a timer in init method is suspicious, ideally it should be started only once you know that you need to animate.
5) 1082: shouldn't the value be 10?
6) 1224: What's the 10000?
7) I still don't like the "transparent" property, I suggest connecting to expose event instead of setting this property, since you mentioned you don't want to add panel-style switch in Separator's expose.
8) Revert 1436 & 1442.