Merge lp:~albyrock87/awn/awn-lucido into lp:awn/0.4
- awn-lucido
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 703 |
Proposed branch: | lp:~albyrock87/awn/awn-lucido |
Merge into: | lp:awn/0.4 |
Diff against target: |
1419 lines (+1122/-13) 12 files modified
awn-settings/awn-settings.ui (+34/-0) awn-settings/awnDefs.py.in (+1/-0) awn-settings/awnSettings.py.in (+6/-1) data/avant-window-navigator.schema-ini.in.in (+7/-1) src/Makefile.am (+2/-0) src/awn-background-flat.c (+10/-6) src/awn-background-lucido.c (+874/-0) src/awn-background-lucido.h (+71/-0) src/awn-background.c (+91/-4) src/awn-background.h (+16/-0) src/awn-defines.h (+1/-0) src/awn-panel.c (+9/-1) |
To merge this branch: | bzr merge lp:~albyrock87/awn/awn-lucido |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michal Hruby (community) | code & behaviour | Approve | |
Alberto Aldegheri | shape-mask | Abstain | |
Review via email: mp+26413@code.launchpad.net |
This proposal supersedes a proposal from 2010-05-30.
Commit message
Description of the change
This is a rewrite of awn-style-lucido.
Implemented a new style, features:
- Stripe-style
- The number of stripes changes dynamically depends on "expanders"
- If you set stripe-width>0, you can manually set the stripe position and width
- Fixed all-orientation cairo "translate"
- custom curved style if panel is not expanded
- speedup code for draw background only when need (otherwise repaint last surface)
:)
Alberto Aldegheri (albyrock87) wrote : Posted in a previous version of this proposal | # |
Michal Hruby (mhr3) wrote : Posted in a previous version of this proposal | # |
> WTF!!!
>
> Why BZR removes 'po/avant-
> file?????
There's a bug in the build system, make clean removes it, please revert the change.
Also there are a lot of lines which break our coding conventions, I know it might sound trivial, but for the review process it makes it easier to read the code. Fix please.
Alberto Aldegheri (albyrock87) wrote : Posted in a previous version of this proposal | # |
> > WTF!!!
> >
> > Why BZR removes 'po/avant-
> > file?????
>
> There's a bug in the build system, make clean removes it, please revert the
> change.
> Also there are a lot of lines which break our coding conventions, I know it
> might sound trivial, but for the review process it makes it easier to read the
> code. Fix please.
'po/avant-
Conding style fixes :)
Default Stripe-Width = 0 (enables auto-stripe)
moonbeam (rcryderman) wrote : Posted in a previous version of this proposal | # |
Seems to be leaking:
revision: 707.
After leaving it running 12-24 hours.
mapped: 1539380K writeable/private: 1297488K shared: 816K
Alberto Aldegheri (albyrock87) wrote : Posted in a previous version of this proposal | # |
> Seems to be leaking:
>
> revision: 707.
>
> After leaving it running 12-24 hours.
>
> mapped: 1539380K writeable/private: 1297488K shared: 816K
I'm very sorry for that :'(
Now it's fixed (rev 710) :)
Michal Hruby (mhr3) wrote : Posted in a previous version of this proposal | # |
Thanks for the style fixes. Here are my comments:
1) When using cairo methods, please use doubles directly, don't have the compiler do it ( cairo_scale (cr, 1, -1) => cairo_scale (cr, 1., -1.) )
2) You're using the expander detection quite often, move it to a function (at least the g_object_get() + gtk_container_
3) Get rid of "g_list_free (i)", it could cause problems.
4) Since you introduced the helper surface, it'd be nice to integrate it properly into the background base class and have a "cached-drawing" property that will control whether the surface is used (default TRUE). (you'll get an extra point if you provide some statistics on how often is helps)
5) The stripe-width spin is put on a strange place in awn-settings, please try to rearrange it, so that it fits nicely.
Alberto Aldegheri (albyrock87) wrote : Posted in a previous version of this proposal | # |
> Thanks for the style fixes. Here are my comments:
>
> 1) When using cairo methods, please use doubles directly, don't have the
> compiler do it ( cairo_scale (cr, 1, -1) => cairo_scale (cr, 1., -1.) )
> 2) You're using the expander detection quite often, move it to a function (at
> least the g_object_get() + gtk_container_
> 3) Get rid of "g_list_free (i)", it could cause problems.
> 4) Since you introduced the helper surface, it'd be nice to integrate it
> properly into the background base class and have a "cached-drawing" property
> that will control whether the surface is used (default TRUE). (you'll get an
> extra point if you provide some statistics on how often is helps)
> 5) The stripe-width spin is put on a strange place in awn-settings, please try
> to rearrange it, so that it fits nicely.
I'm working on this.
For now I can tell you that (in lucido style), times are:
- use helper surface: ~0ms
- redraw surface: ~10ms
If you hover an icon and then run away with your mouse with bounce effect, you get about 20 redraw (during animation):
- using helper surface: ~1ms
- not using helper surface: 20*10 = 200ms
Time calculated with:
#include <time.h>
clock_t start, end;
double elapsed;
start = clock();
... /* Do the work. */
end = clock();
elapsed = ((double) (end - start)) / (((double)
Alberto Aldegheri (albyrock87) wrote : Posted in a previous version of this proposal | # |
> Thanks for the style fixes. Here are my comments:
>
> 1) When using cairo methods, please use doubles directly, don't have the
> compiler do it ( cairo_scale (cr, 1, -1) => cairo_scale (cr, 1., -1.) )
> 2) You're using the expander detection quite often, move it to a function (at
> least the g_object_get() + gtk_container_
> 3) Get rid of "g_list_free (i)", it could cause problems.
> 4) Since you introduced the helper surface, it'd be nice to integrate it
> properly into the background base class and have a "cached-drawing" property
> that will control whether the surface is used (default TRUE). (you'll get an
> extra point if you provide some statistics on how often is helps)
> 5) The stripe-width spin is put on a strange place in awn-settings, please try
> to rearrange it, so that it fits nicely.
Ok, What do you think about?
Some statistic? mh..
On any animation's step on every icon, you get background refreshed. (with cache in O(1) time)
The same for any expose event.
However, if you want to see how often is the redraw, you can put a:
fprintf (stderr, "I'm redrawing the bg \n");
on awn-background.c row 701
You will see that the redraw is rare, then the performance gain is very often :)
Alberto Aldegheri (albyrock87) wrote : Posted in a previous version of this proposal | # |
Resubmitting :)
PS: i've checked for mem-leaks this time, and I have not found any mem-leak.
Michal Hruby (mhr3) wrote : Posted in a previous version of this proposal | # |
As a side note, the "Resubmit" is for reviewers when they want you to resubmit the proposal, when you want to resubmit it, there's the "Resubmit proposal" link on top of this page.
1) Please revert the 1210-1220, this should go into background's finalize method.
2) It seems that awn_background_
3) Also why is 1190-1192 necessary?
Alberto Aldegheri (albyrock87) wrote : Posted in a previous version of this proposal | # |
> As a side note, the "Resubmit" is for reviewers when they want you to resubmit
> the proposal, when you want to resubmit it, there's the "Resubmit proposal"
> link on top of this page.
I'm sorry, but I'm new in Lauchpad&Bzr :P
> 1) Please revert the 1210-1220, this should go into background's finalize
> method.
Done :)
> 2) It seems that awn_background_
> is not necessary to be exposed in the .h files. Please make it a static method
> and use the virtual klass->
awn_background_
Moved awn_background_
> 3) Also why is 1190-1192 necessary?
Because when you move panel position from bottom to top, or left to right, width&height doesn't change. So we need to notify background to redraw itself.
Michal Hruby (mhr3) wrote : Posted in a previous version of this proposal | # |
> > 2) It seems that awn_background_
> variant)
> > is not necessary to be exposed in the .h files. Please make it a static
> method
> > and use the virtual klass->
> awn_background_
> used in awn-background-
It still doesn't have to be in the .h, you can use >>>
AWN_BACKGROUND_
> > 3) Also why is 1190-1192 necessary?
> Because when you move panel position from bottom to top, or left to right,
> width&height doesn't change. So we need to notify background to redraw itself.
Ok, but please make a method for it (awn_background
Alberto Aldegheri (albyrock87) wrote : Posted in a previous version of this proposal | # |
> > > 2) It seems that awn_background_
> > variant)
> > > is not necessary to be exposed in the .h files. Please make it a static
> > method
> > > and use the virtual klass->
> > awn_background_
> is
> > used in awn-background-
>
> It still doesn't have to be in the .h, you can use >>>
> AWN_BACKGROUND_
> ()
Done, thank you :)
> > > 3) Also why is 1190-1192 necessary?
> > Because when you move panel position from bottom to top, or left to right,
> > width&height doesn't change. So we need to notify background to redraw
> itself.
>
> Ok, but please make a method for it (awn_background
> public variables is really unfortunate in the background class.
You're right, done
Michal Hruby (mhr3) wrote : Posted in a previous version of this proposal | # |
Sorry for late reply, been bit busy lately...
Lines 450 and 534 will cause a crash if there are no applets setup, fix pls.
Michal Hruby (mhr3) wrote : Posted in a previous version of this proposal | # |
Also it'd be nice to use private structure for the 'expw' variable, don't expose it.
Michal Hruby (mhr3) wrote : Posted in a previous version of this proposal | # |
Few more observations:
1) Backgrounds don't redraw properly when monitor_align is changed.
2) There are some issues with padding (no refresh) when curviness is being changed.
3) Incomplete redraw when second expander is added to the panel.
Michal Hruby (mhr3) wrote : Posted in a previous version of this proposal | # |
And one more: On bottom orientation (expanded panel) the pixels on x == 0 have incorrect color.
Alberto Aldegheri (albyrock87) wrote : Posted in a previous version of this proposal | # |
> 3) Incomplete redraw when second expander is added to the panel.
I need help with this.
The way to fix this problem is call a redraw of all applets when an applet gets added/removed.
But I don't know how to do that.
Alberto Aldegheri (albyrock87) wrote : Posted in a previous version of this proposal | # |
Ok, all done.
I've found a way to fix:
> 3) Incomplete redraw when second expander is added to the panel.
Resubmitting :)
Alberto Aldegheri (albyrock87) : Posted in a previous version of this proposal | # |
Alberto Aldegheri (albyrock87) wrote : Posted in a previous version of this proposal | # |
Noes!! There's a bug with a special configuration, i'll fix soon :(
Alberto Aldegheri (albyrock87) wrote : Posted in a previous version of this proposal | # |
> Noes!! There's a bug with a special configuration, i'll fix soon :(
Ok, done :)
Michal Hruby (mhr3) wrote : Posted in a previous version of this proposal | # |
Sorry, but additions in 714 are completely redundant - please take a look for example at Edgy code...
1) There's no need for extra signal in awn-panel, if you need panel to ask you again for padding emit the "padding-changed" signal (using awn_background_
2) There's no need for "property-changed", this is implemented automatically for every property which is registered using g_object_
Michal Hruby (mhr3) wrote : Posted in a previous version of this proposal | # |
And I also have one question - what is the rationale behind using curviness instead of corner_radius?
Alberto Aldegheri (albyrock87) wrote : Posted in a previous version of this proposal | # |
> And I also have one question - what is the rationale behind using curviness
> instead of corner_radius?
Because Lucido consists in curves:
- curves symmetry
- curviness
Lucido's boundary rect has no rounded corners.
Alberto Aldegheri (albyrock87) wrote : Posted in a previous version of this proposal | # |
How can I remove myself from reviewers? :D
Michal Hruby (mhr3) wrote : Posted in a previous version of this proposal | # |
Good question... Change it to Abstain?!
Alberto Aldegheri (albyrock87) wrote : Posted in a previous version of this proposal | # |
Tanks Michal! ;)
However, Lucido seems to be ready now :)
Michal Hruby (mhr3) wrote : Posted in a previous version of this proposal | # |
Looking at the latest changes, shouldn't you monitor also changes to "expand" property and emit padding-changed?
Alberto Aldegheri (albyrock87) wrote : Posted in a previous version of this proposal | # |
I think that "expand" already refreshes padding. So there's no need to observ "expand"..
Michal Hruby (mhr3) wrote : Posted in a previous version of this proposal | # |
I see, you derive from FLAT background, and it monitors expand property. Is this really intentional?
Alberto Aldegheri (albyrock87) wrote : Posted in a previous version of this proposal | # |
Haha!
Great! No, that was not intentional :P
It was intentional for some methods, but not for monitor expand :P
Michal Hruby (mhr3) wrote : Posted in a previous version of this proposal | # |
Which methods exactly? It seems to me that Lucido should be derived directly from AwnBackground, not Flat...
Alberto Aldegheri (albyrock87) wrote : Posted in a previous version of this proposal | # |
For the shape mask, and initally for the padding method, but after i must reimplement that for use curviness in not-expanded mode..
Michal Hruby (mhr3) wrote : Posted in a previous version of this proposal | # |
Yep :)
Alberto Aldegheri (albyrock87) wrote : Posted in a previous version of this proposal | # |
review: Needs Fixing?
In what? I don't understand, do you want that i change the parent to AwnBackground?
Michal Hruby (mhr3) wrote : Posted in a previous version of this proposal | # |
Oh sorry, we didn't understand each other... Yes, please change the base class to AwnBackground and implement correct version of get_shape_mask.
Alberto Aldegheri (albyrock87) wrote : Posted in a previous version of this proposal | # |
I understand that my english is not so good :D
I'll do the job soon then I resubmit :)
Michal Hruby (mhr3) wrote : | # |
The mask is incorrect when using non-expanded mode, please make sure the corners are clickable exactly as it's painted. (like in BackgroundCurved)
Alberto Aldegheri (albyrock87) wrote : | # |
Shape-mask fixed :)
Michal Hruby (mhr3) wrote : | # |
Yep, looks good. I'm going to merge it in the current state, but there's two more things I'd like to see which can be merged later:
1) stripe_width == 0.0 has the same color as stripe_width == 1.0 and there's a big change when going from 0.0 to 0.01, please fix.
2) Paint the outline on the corners in non-composited mode.
Alberto Aldegheri (albyrock87) wrote : | # |
I don't understand this:
> 1) stripe_width == 0.0 has the same color as stripe_width == 1.0 and there's a
> big change when going from 0.0 to 0.01, please fix.
Can you explain in other words?
- 703. By Michal Hruby
-
Merge Lucido style from <lp:~albyrock87/awn/awn-lucido>
Michal Hruby (mhr3) wrote : | # |
If I have Lucido with black and white colors, it will be fully white for stripe-width 0.0 and also 1.0, but if I use 0.01 it'll be almost fully black (when non-expanded). Therefore IMO it should be fully black when using 0.0.
Alberto Aldegheri (albyrock87) wrote : | # |
Great idea!!
Coding it now :)
Alberto Aldegheri (albyrock87) wrote : | # |
> If I have Lucido with black and white colors, it will be fully white for stripe-width 0.0 and also
> 1.0, but if I use 0.01 it'll be almost fully black (when non-expanded). Therefore IMO it should be
> fully black when using 0.0.
I think it's done now, give it a try! ;)
Michal Hruby (mhr3) wrote : | # |
Yep, better now, but there's still a slight displacement of the gradient... sorry perfectionist here :P
Also, please pull trunk branch, I did some slight changes to your code.
Anyway this thread has gone long enough, feel free to join us on freenode in #awn.
Preview Diff
1 | === modified file 'awn-settings/awn-settings.ui' |
2 | --- awn-settings/awn-settings.ui 2010-03-08 12:50:07 +0000 |
3 | +++ awn-settings/awn-settings.ui 2010-05-31 17:25:42 +0000 |
4 | @@ -908,6 +908,22 @@ |
5 | </packing> |
6 | </child> |
7 | <child> |
8 | + <object class="GtkSpinButton" id="theme_stripe_width"> |
9 | + <property name="visible">True</property> |
10 | + <property name="can_focus">True</property> |
11 | + <property name="invisible_char">●</property> |
12 | + <property name="adjustment">adj_stripe_width</property> |
13 | + <property name="digits">2</property> |
14 | + </object> |
15 | + <packing> |
16 | + <property name="left_attach">5</property> |
17 | + <property name="right_attach">6</property> |
18 | + <property name="top_attach">8</property> |
19 | + <property name="bottom_attach">9</property> |
20 | + <property name="x_options"></property> |
21 | + </packing> |
22 | + </child> |
23 | + <child> |
24 | <object class="GtkSpinButton" id="theme_angle"> |
25 | <property name="visible">True</property> |
26 | <property name="can_focus">True</property> |
27 | @@ -964,6 +980,20 @@ |
28 | </packing> |
29 | </child> |
30 | <child> |
31 | + <object class="GtkLabel" id="label_stripe"> |
32 | + <property name="visible">True</property> |
33 | + <property name="xalign">0</property> |
34 | + <property name="xpad">0</property> |
35 | + <property name="label" translatable="yes">Stripe Width</property> |
36 | + </object> |
37 | + <packing> |
38 | + <property name="left_attach">3</property> |
39 | + <property name="right_attach">5</property> |
40 | + <property name="top_attach">8</property> |
41 | + <property name="bottom_attach">9</property> |
42 | + </packing> |
43 | + </child> |
44 | + <child> |
45 | <object class="GtkLabel" id="label49"> |
46 | <property name="visible">True</property> |
47 | <property name="xalign">0</property> |
48 | @@ -3406,6 +3436,10 @@ |
49 | <property name="upper">1</property> |
50 | <property name="step_increment">0.01</property> |
51 | </object> |
52 | + <object class="GtkAdjustment" id="adj_stripe_width"> |
53 | + <property name="upper">1</property> |
54 | + <property name="step_increment">0.01</property> |
55 | + </object> |
56 | <object class="GtkAdjustment" id="adj_radius"> |
57 | <property name="upper">100</property> |
58 | <property name="step_increment">1</property> |
59 | |
60 | === modified file 'awn-settings/awnDefs.py.in' |
61 | --- awn-settings/awnDefs.py.in 2010-04-29 14:58:51 +0000 |
62 | +++ awn-settings/awnDefs.py.in 2010-05-31 17:25:42 +0000 |
63 | @@ -86,6 +86,7 @@ |
64 | PANEL_ANGLE = "panel_angle" #float |
65 | CURVINESS = "curviness" #float |
66 | CURVES_SYMMETRY = "curves_symmetry" #float |
67 | +STRIPE_WIDTH = "stripe_width" #float |
68 | TOOLTIP_FONT_NAME = "tooltip_font_name" #string |
69 | TOOLTIP_FONT_COLOR = "tooltip_font_color" #string |
70 | TOOLTIP_BG_COLOR = "tooltip_bg_color" #string |
71 | |
72 | === modified file 'awn-settings/awnSettings.py.in' |
73 | --- awn-settings/awnSettings.py.in 2010-05-28 08:09:17 +0000 |
74 | +++ awn-settings/awnSettings.py.in 2010-05-31 17:25:42 +0000 |
75 | @@ -141,7 +141,8 @@ |
76 | #setup style mode |
77 | dropdown = self.wTree.get_object("stylecombo") |
78 | self.create_dropdown(dropdown, [_("None"), _("Flat"), _("3d"), |
79 | - _("Curved"), _("Edgy"), _("Floaty")]) |
80 | + _("Curved"), _("Edgy"), _("Floaty"), |
81 | + _("Lucido")]) |
82 | |
83 | #setup behaviour combo |
84 | dropdown = self.wTree.get_object("behaviorcombo") |
85 | @@ -578,6 +579,7 @@ |
86 | |
87 | curviness = gobject.property(type=int, default=10) |
88 | curves_symmetry = gobject.property(type=float, default=0) |
89 | + stripe_width = gobject.property(type=float, default=0) |
90 | angle = gobject.property(type=int, default=45) |
91 | radius = gobject.property(type=int, default=10) |
92 | gtk_theme_mode = gobject.property(type=bool, default=False) |
93 | @@ -727,6 +729,7 @@ |
94 | (defs.THEME, defs.PANEL_ANGLE, 'float', sizes), |
95 | (defs.THEME, defs.CURVINESS, 'float', sizes), |
96 | (defs.THEME, defs.CURVES_SYMMETRY, 'float', sizes), |
97 | + (defs.THEME, defs.STRIPE_WIDTH, 'float', sizes), |
98 | (defs.THEME, defs.TOOLTIP_FONT_NAME, 'str', icon), |
99 | (defs.THEME, defs.TOOLTIP_FONT_COLOR, 'str', icon), |
100 | (defs.THEME, defs.TOOLTIP_BG_COLOR, 'str', icon), |
101 | @@ -823,6 +826,8 @@ |
102 | "curviness", "theme_curviness"), |
103 | (self.client, defs.THEME, defs.CURVES_SYMMETRY, |
104 | "curves-symmetry", "theme_symmetry"), |
105 | + (self.client, defs.THEME, defs.STRIPE_WIDTH, |
106 | + "stripe-width", "theme_stripe_width"), |
107 | (self.client, defs.THEME, defs.PANEL_ANGLE, |
108 | "angle", "theme_angle"), |
109 | (self.client, defs.THEME, defs.CORNER_RADIUS, |
110 | |
111 | === modified file 'data/avant-window-navigator.schema-ini.in.in' |
112 | --- data/avant-window-navigator.schema-ini.in.in 2010-03-09 20:20:25 +0000 |
113 | +++ data/avant-window-navigator.schema-ini.in.in 2010-05-31 17:25:42 +0000 |
114 | @@ -159,7 +159,7 @@ |
115 | [panel/style] |
116 | type = integer |
117 | default = 1 |
118 | -_description=The style of the bar. (none=0, flat bar=1, 3d bar=2, curved bar=3, edgy=4, floaty=5) |
119 | +_description=The style of the bar. (none=0, flat bar=1, 3d bar=2, curved bar=3, edgy=4, floaty=5,lucido=6) |
120 | |
121 | [panels/panel_list] |
122 | type = list-integer |
123 | @@ -227,6 +227,12 @@ |
124 | _description=The curviness of the panel in Curves mode. |
125 | per_instance = false |
126 | |
127 | +[theme/stripe_width] |
128 | +type = float |
129 | +default = 0.0 |
130 | +_description=The width of the stripe in Lucido mode. |
131 | +per_instance = false |
132 | + |
133 | [theme/dialog_gtk_mode] |
134 | type = boolean |
135 | default = true |
136 | |
137 | === modified file 'src/Makefile.am' |
138 | --- src/Makefile.am 2010-03-24 23:24:19 +0000 |
139 | +++ src/Makefile.am 2010-05-31 17:25:42 +0000 |
140 | @@ -41,6 +41,8 @@ |
141 | awn-background-edgy.h \ |
142 | awn-background-floaty.c \ |
143 | awn-background-floaty.h \ |
144 | + awn-background-lucido.c \ |
145 | + awn-background-lucido.h \ |
146 | awn-defines.h \ |
147 | $(builddir)/awn-marshal.c \ |
148 | $(builddir)/awn-marshal.h \ |
149 | |
150 | === modified file 'src/awn-background-flat.c' |
151 | --- src/awn-background-flat.c 2010-03-07 18:38:07 +0000 |
152 | +++ src/awn-background-flat.c 2010-05-31 17:25:42 +0000 |
153 | @@ -324,20 +324,24 @@ |
154 | switch (position) |
155 | { |
156 | case GTK_POS_RIGHT: |
157 | - cairo_translate (cr, x, y+height); |
158 | + cairo_translate (cr, 0., y + height); |
159 | + cairo_scale (cr, 1., -1.); |
160 | + cairo_translate (cr, x, height); |
161 | cairo_rotate (cr, M_PI * 1.5); |
162 | temp = width; |
163 | - width = height; height = temp; |
164 | + width = height; |
165 | + height = temp; |
166 | break; |
167 | case GTK_POS_LEFT: |
168 | - cairo_translate (cr, x+width, y); |
169 | + cairo_translate (cr, x + width, y); |
170 | cairo_rotate (cr, M_PI * 0.5); |
171 | temp = width; |
172 | - width = height; height = temp; |
173 | + width = height; |
174 | + height = temp; |
175 | break; |
176 | case GTK_POS_TOP: |
177 | - cairo_translate (cr, x+width, y+height); |
178 | - cairo_rotate (cr, M_PI); |
179 | + cairo_translate (cr, x, y + height); |
180 | + cairo_scale (cr, 1., -1.); |
181 | break; |
182 | default: |
183 | cairo_translate (cr, x, y); |
184 | |
185 | === added file 'src/awn-background-lucido.c' |
186 | --- src/awn-background-lucido.c 1970-01-01 00:00:00 +0000 |
187 | +++ src/awn-background-lucido.c 2010-05-31 17:25:42 +0000 |
188 | @@ -0,0 +1,874 @@ |
189 | +/* |
190 | + * Copyright (C) 2009 Michal Hruby <michal.mhr@gmail.com> |
191 | + * |
192 | + * This program is free software; you can redistribute it and/or modify |
193 | + * it under the terms of the GNU General Public License as published by |
194 | + * the Free Software Foundation; either version 2 of the License, or |
195 | + * (at your option) any later version. |
196 | + * |
197 | + * This program is distributed in the hope that it will be useful, |
198 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
199 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
200 | + * GNU General Public License for more details. |
201 | + * |
202 | + * You should have received a copy of the GNU General Public License |
203 | + * along with this program; if not, write to the Free Software |
204 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
205 | + * |
206 | + * Author : Alberto Aldegheri <albyrock87+dev@gmail.com> |
207 | + * Thanks to: Matt <sharkbaitbobby@gmail.com> |
208 | + * for the code section to analyze expanders |
209 | + * |
210 | + */ |
211 | + |
212 | +#include "config.h" |
213 | + |
214 | +#include <gdk/gdk.h> |
215 | +#include <libawn/awn-cairo-utils.h> |
216 | +#include <math.h> |
217 | + |
218 | +#include "awn-applet-manager.h" |
219 | +#include "awn-background-lucido.h" |
220 | +#include "awn-separator.h" |
221 | + |
222 | +G_DEFINE_TYPE (AwnBackgroundLucido, awn_background_lucido, AWN_TYPE_BACKGROUND) |
223 | + |
224 | +#define AWN_BACKGROUND_LUCIDO_GET_PRIVATE(obj) ( \ |
225 | + G_TYPE_INSTANCE_GET_PRIVATE (obj, AWN_TYPE_BACKGROUND_LUCIDO, \ |
226 | + AwnBackgroundLucidoPrivate)) |
227 | + |
228 | +struct _AwnBackgroundLucidoPrivate |
229 | +{ |
230 | + gint expw; |
231 | + gint expn; |
232 | +}; |
233 | + |
234 | +static void awn_background_lucido_draw (AwnBackground *bg, |
235 | + cairo_t *cr, |
236 | + GtkPositionType position, |
237 | + GdkRectangle *area); |
238 | + |
239 | +static void awn_background_lucido_get_shape_mask (AwnBackground *bg, |
240 | + cairo_t *cr, |
241 | + GtkPositionType position, |
242 | + GdkRectangle *area); |
243 | + |
244 | +static void awn_background_lucido_padding_request (AwnBackground *bg, |
245 | + GtkPositionType position, |
246 | + guint *padding_top, |
247 | + guint *padding_bottom, |
248 | + guint *padding_left, |
249 | + guint *padding_right); |
250 | + |
251 | +static gboolean |
252 | +awn_background_lucido_get_needs_redraw (AwnBackground *bg, |
253 | + GtkPositionType position, |
254 | + GdkRectangle *area); |
255 | + |
256 | +static void |
257 | +awn_background_lucido_curviness_changed (AwnBackground *bg) |
258 | +{ |
259 | + gboolean expand = FALSE; |
260 | + g_object_get (bg->panel, "expand", &expand, NULL); |
261 | + |
262 | + if (!expand) |
263 | + awn_background_emit_padding_changed (bg); |
264 | +} |
265 | + |
266 | +static void |
267 | +awn_background_lucido_expand_changed (AwnBackground *bg) |
268 | +{ |
269 | + awn_background_emit_padding_changed (bg); |
270 | +} |
271 | + |
272 | +static void |
273 | +awn_background_lucido_align_changed (AwnBackground *bg) |
274 | +{ |
275 | + awn_background_emit_padding_changed (bg); |
276 | +} |
277 | + |
278 | +static void |
279 | +awn_background_lucido_constructed (GObject *object) |
280 | +{ |
281 | + G_OBJECT_CLASS (awn_background_lucido_parent_class)->constructed (object); |
282 | + |
283 | + AwnBackground *bg = AWN_BACKGROUND (object); |
284 | + gpointer monitor = NULL; |
285 | + |
286 | + g_signal_connect_swapped (bg, "notify::curviness", |
287 | + G_CALLBACK (awn_background_lucido_curviness_changed), |
288 | + object); |
289 | + |
290 | + g_return_if_fail (bg->panel); |
291 | + |
292 | + g_signal_connect_swapped (bg->panel, "notify::expand", |
293 | + G_CALLBACK (awn_background_lucido_expand_changed), |
294 | + object); |
295 | + |
296 | + g_object_get (bg->panel, "monitor", &monitor, NULL); |
297 | + |
298 | + g_return_if_fail (monitor); |
299 | + |
300 | + g_signal_connect_swapped (monitor, "notify::monitor-align", |
301 | + G_CALLBACK (awn_background_lucido_align_changed), |
302 | + object); |
303 | +} |
304 | + |
305 | +static void |
306 | +awn_background_lucido_dispose (GObject *object) |
307 | +{ |
308 | + gpointer monitor = NULL; |
309 | + if (AWN_BACKGROUND (object)->panel) |
310 | + g_object_get (AWN_BACKGROUND (object)->panel, "monitor", &monitor, NULL); |
311 | + |
312 | + if (monitor) |
313 | + g_signal_handlers_disconnect_by_func (monitor, |
314 | + G_CALLBACK (awn_background_lucido_align_changed), object); |
315 | + |
316 | + g_signal_handlers_disconnect_by_func (AWN_BACKGROUND (object)->panel, |
317 | + G_CALLBACK (awn_background_lucido_expand_changed), object); |
318 | + |
319 | + g_signal_handlers_disconnect_by_func (AWN_BACKGROUND (object), |
320 | + G_CALLBACK (awn_background_lucido_curviness_changed), object); |
321 | + |
322 | + G_OBJECT_CLASS (awn_background_lucido_parent_class)->dispose (object); |
323 | +} |
324 | + |
325 | +static void |
326 | +awn_background_lucido_class_init (AwnBackgroundLucidoClass *klass) |
327 | +{ |
328 | + AwnBackgroundClass *bg_class = AWN_BACKGROUND_CLASS (klass); |
329 | + |
330 | + GObjectClass *obj_class = G_OBJECT_CLASS (klass); |
331 | + obj_class->constructed = awn_background_lucido_constructed; |
332 | + obj_class->dispose = awn_background_lucido_dispose; |
333 | + |
334 | + bg_class->draw = awn_background_lucido_draw; |
335 | + bg_class->padding_request = awn_background_lucido_padding_request; |
336 | + bg_class->get_shape_mask = awn_background_lucido_get_shape_mask; |
337 | + bg_class->get_input_shape_mask = awn_background_lucido_get_shape_mask; |
338 | + bg_class->get_needs_redraw = awn_background_lucido_get_needs_redraw; |
339 | + |
340 | + g_type_class_add_private (obj_class, sizeof (AwnBackgroundLucidoPrivate)); |
341 | +} |
342 | + |
343 | +static void |
344 | +awn_background_lucido_init (AwnBackgroundLucido *bg) |
345 | +{ |
346 | + |
347 | +} |
348 | + |
349 | +AwnBackground * |
350 | +awn_background_lucido_new (DesktopAgnosticConfigClient *client, |
351 | + AwnPanel *panel) |
352 | +{ |
353 | + AwnBackground *bg; |
354 | + |
355 | + bg = g_object_new (AWN_TYPE_BACKGROUND_LUCIDO, |
356 | + "client", client, |
357 | + "panel", panel, |
358 | + NULL); |
359 | + return bg; |
360 | +} |
361 | + |
362 | +/* |
363 | + * Drawing functions |
364 | + */ |
365 | +static void |
366 | +_line_from_to ( cairo_t *cr, |
367 | + gfloat *xs, |
368 | + gfloat *ys, |
369 | + gfloat xf, |
370 | + gfloat yf) |
371 | +{ |
372 | + if ( *xs==xf || *ys==yf ) /* Vertical/Horizontal line */ |
373 | + cairo_line_to (cr, xf, yf); |
374 | + else |
375 | + { /* Oblique */ |
376 | + gfloat xm = ( *xs + xf ) / 2.0; |
377 | + cairo_curve_to (cr, xm, *ys, xm, yf, xf, yf); |
378 | + } |
379 | + *xs = xf; |
380 | + *ys = yf; |
381 | +} |
382 | + |
383 | +static GList* |
384 | +_get_applet_widgets (AwnBackground* bg) |
385 | +{ |
386 | + AwnAppletManager *manager = NULL; |
387 | + g_object_get (bg->panel, "applet-manager", &manager, NULL); |
388 | + |
389 | + return gtk_container_get_children (GTK_CONTAINER (manager)); |
390 | +} |
391 | + |
392 | +/** |
393 | + * _create_path_lucido: |
394 | + * @bg: The background pointer |
395 | + * @position: The position of the bar |
396 | + * @cairo_t: The cairo context |
397 | + * @y: The top left coordinate of the "bar rect" - default = 0 |
398 | + * @w: The width of the bar |
399 | + * @h: The height of the bar |
400 | + * @stripe: The width of the stripe (0.0-1.0). Zero for auto-stripe. |
401 | + * @d: The width of each curve in the path |
402 | + * @dc: The width of the external curves in non-expanded&auto mode |
403 | + * @symmetry: The symmetry of the stripe when @stripe > 0 |
404 | + * @internal: If Zero, creates the path for the stripe |
405 | + * @expanded: If Zero, the bar is not expanded |
406 | + * |
407 | + * This function creates paths on which the bar will be drawn. |
408 | + * In atuo-stripe, it searchs for expanders applet, each expander |
409 | + * equals to one curve. |
410 | + * If the first widget is an expander, start from bottom-left, |
411 | + * otherwise start from top-left |
412 | + */ |
413 | + |
414 | +static void |
415 | +_create_path_lucido ( AwnBackground* bg, |
416 | + GtkPositionType position, |
417 | + cairo_t* cr, |
418 | + gfloat x, |
419 | + gfloat y, |
420 | + gfloat w, |
421 | + gfloat h, |
422 | + gfloat stripe, |
423 | + gfloat d, |
424 | + gfloat dc, |
425 | + gfloat symmetry, |
426 | + gboolean internal, |
427 | + gboolean expanded, |
428 | + gfloat align) |
429 | +{ |
430 | + cairo_new_path (cr); |
431 | + |
432 | + gfloat lx = x; |
433 | + gfloat ly = y; |
434 | + gfloat y3 = y + h; |
435 | + gfloat y2 = y3 - 5; |
436 | + |
437 | + if (stripe > 0) |
438 | + { |
439 | + if (expanded) |
440 | + { |
441 | + stripe = (w * stripe); /* now stripe = non-stripe */ |
442 | + if (internal) |
443 | + { |
444 | + /* Manual-Stripe & Expanded & Internal */ |
445 | + lx = stripe * symmetry; |
446 | + cairo_move_to (cr, lx, ly); |
447 | + _line_from_to (cr, &lx, &ly, lx+d, y2); |
448 | + _line_from_to (cr, &lx, &ly, w-stripe * (1. - symmetry) - d, y2); |
449 | + _line_from_to (cr, &lx, &ly, w-stripe * (1. - symmetry), y); |
450 | + cairo_close_path (cr); |
451 | + } |
452 | + else |
453 | + { |
454 | + /* Manual-Stripe & Expanded & External */ |
455 | + ly = y3; |
456 | + cairo_move_to (cr, lx, ly); |
457 | + _line_from_to (cr, &lx, &ly, lx, y); |
458 | + _line_from_to (cr, &lx, &ly, stripe * symmetry, y); |
459 | + _line_from_to (cr, &lx, &ly, stripe * symmetry + d, y2); |
460 | + _line_from_to (cr, &lx, &ly, w - stripe * (1. - symmetry) - d, y2); |
461 | + _line_from_to (cr, &lx, &ly, w - stripe * (1. - symmetry), y); |
462 | + _line_from_to (cr, &lx, &ly, w, y); |
463 | + _line_from_to (cr, &lx, &ly, w, y3); |
464 | + cairo_close_path (cr); |
465 | + } |
466 | + } |
467 | + else |
468 | + { |
469 | + if (stripe == 1.) |
470 | + { |
471 | + _create_path_lucido (bg, position, cr, x, y, w, h, 0., |
472 | + d, dc, 0., internal, expanded, align); |
473 | + return; |
474 | + } |
475 | + stripe = ((w - dc * 2) * stripe); /* now stripe = non-stripe */ |
476 | + if (internal) |
477 | + { |
478 | + /* Manual-Stripe & Not-Expanded & Internal */ |
479 | + lx = stripe * symmetry + dc; |
480 | + cairo_move_to (cr, lx, ly); |
481 | + _line_from_to (cr, &lx, &ly, lx + d, y2); |
482 | + _line_from_to (cr, &lx, &ly, w - stripe * (1.- symmetry) - dc - d, y2); |
483 | + _line_from_to (cr, &lx, &ly, w - stripe * (1.- symmetry) - dc, y); |
484 | + cairo_close_path (cr); |
485 | + } |
486 | + else |
487 | + { |
488 | + /* Manual-Stripe & Not-Expanded & External */ |
489 | + ly = y3; |
490 | + cairo_move_to (cr, lx, ly); |
491 | + _line_from_to (cr, &lx, &ly, lx+dc, y); |
492 | + _line_from_to (cr, &lx, &ly, stripe * symmetry + dc, y); |
493 | + _line_from_to (cr, &lx, &ly, stripe * symmetry + d + dc, y2); |
494 | + _line_from_to (cr, &lx, &ly, w-stripe * (1. - symmetry) - dc - d, y2); |
495 | + _line_from_to (cr, &lx, &ly, w-stripe * (1. - symmetry) - dc, y); |
496 | + _line_from_to (cr, &lx, &ly, w-dc, y); |
497 | + _line_from_to (cr, &lx, &ly, w, y3); |
498 | + cairo_close_path(cr); |
499 | + } |
500 | + } |
501 | + } |
502 | + else |
503 | + { |
504 | + gint exps_found = 0; |
505 | + gfloat curx = x; |
506 | + |
507 | + if (expanded) |
508 | + { |
509 | + if (internal) |
510 | + { |
511 | + /* Auto-Stripe & Expanded & Internal */ |
512 | + GList *widgets = _get_applet_widgets (bg); |
513 | + GList *i = widgets; |
514 | + GtkWidget *widget = NULL; |
515 | + |
516 | + /* analyze first widget*/ |
517 | + if (i) |
518 | + { |
519 | + widget = GTK_WIDGET (i->data); |
520 | + |
521 | + /* if first widget is an expander or align==0 || 1*/ |
522 | + if ( (widget && GTK_IS_IMAGE (widget) && !AWN_IS_SEPARATOR (widget) ) || |
523 | + ( align == 0. || align == 1. ) ) |
524 | + { |
525 | + /* start from bottom */ |
526 | + lx = curx; |
527 | + ly = y; |
528 | + cairo_move_to (cr, lx, ly); |
529 | + _line_from_to (cr, &lx, &ly, lx, y2); |
530 | + ++exps_found; |
531 | + if (align != 0. && align != 1.) |
532 | + i = i->next; |
533 | + } |
534 | + } |
535 | + /* else start from top */ |
536 | + |
537 | + for (; i; i = i->next) |
538 | + { |
539 | + widget = GTK_WIDGET (i->data); |
540 | + |
541 | + if (!GTK_IS_IMAGE (widget) || AWN_IS_SEPARATOR (widget)) |
542 | + { |
543 | + /* if not expander continue */ |
544 | + continue; |
545 | + } |
546 | + /* expander found */ |
547 | + switch (position) |
548 | + { |
549 | + case GTK_POS_BOTTOM: |
550 | + case GTK_POS_TOP: |
551 | + curx = widget->allocation.x; |
552 | + if (exps_found % 2 != 0) |
553 | + curx += widget->allocation.width; |
554 | + break; |
555 | + default: |
556 | + curx = widget->allocation.y; |
557 | + if ( exps_found % 2 != 0) |
558 | + curx += widget->allocation.height; |
559 | + break; |
560 | + } |
561 | + if (curx < 0) |
562 | + continue; |
563 | + |
564 | + if (exps_found == 0) |
565 | + { |
566 | + /* this is the first expander */ |
567 | + lx = curx; |
568 | + cairo_move_to (cr, lx, ly); |
569 | + _line_from_to (cr, &lx, &ly, curx + d, y2); |
570 | + } |
571 | + else |
572 | + { |
573 | + if (exps_found % 2 != 0) |
574 | + { |
575 | + /* odd expander - curve at the end of expander */ |
576 | + _line_from_to (cr, &lx, &ly, curx - d, y2); |
577 | + if (i->next == NULL) |
578 | + _line_from_to (cr, &lx, &ly, curx, y2); |
579 | + _line_from_to (cr, &lx, &ly, curx, y); |
580 | + } |
581 | + else |
582 | + { |
583 | + /* even expander - curve at the start of expander */ |
584 | + _line_from_to (cr, &lx, &ly, curx, y); |
585 | + _line_from_to (cr, &lx, &ly, curx + d, y2); |
586 | + /* else the last widget is an expander */ |
587 | + } |
588 | + } |
589 | + |
590 | + ++exps_found; |
591 | + } |
592 | + g_list_free (widgets); |
593 | + |
594 | + _line_from_to (cr, &lx, &ly, w, ly); |
595 | + |
596 | + if (exps_found % 2 != 0) |
597 | + _line_from_to (cr, &lx, &ly, lx, y); |
598 | + |
599 | + cairo_close_path (cr); |
600 | + } |
601 | + else |
602 | + { |
603 | + /* Auto-Stripe & Expanded & External */ |
604 | + |
605 | + GList *widgets = _get_applet_widgets (bg); |
606 | + GList *i = widgets; |
607 | + GtkWidget *widget = NULL; |
608 | + |
609 | + /* analyze first widget*/ |
610 | + if (i) |
611 | + { |
612 | + widget = GTK_WIDGET (i->data); |
613 | + |
614 | + ly = y3; |
615 | + cairo_move_to (cr, lx, ly); |
616 | + |
617 | + /* if first widget is an expander or align==0 || 1*/ |
618 | + if ( (widget && GTK_IS_IMAGE (widget) && !AWN_IS_SEPARATOR (widget) ) || |
619 | + ( align == 0. || align == 1. ) ) |
620 | + { |
621 | + /* start from bottom */ |
622 | + _line_from_to (cr, &lx, &ly, lx, y2); |
623 | + ++exps_found; |
624 | + if (align != 0. && align != 1.) |
625 | + i = i->next; |
626 | + } |
627 | + else |
628 | + { |
629 | + /* start from top */ |
630 | + _line_from_to (cr, &lx, &ly, lx, y); |
631 | + } |
632 | + } |
633 | + |
634 | + for (; i; i = i->next) |
635 | + { |
636 | + widget = GTK_WIDGET (i->data); |
637 | + |
638 | + if (!GTK_IS_IMAGE (widget) || AWN_IS_SEPARATOR (widget)) |
639 | + { |
640 | + /* if not expander continue */ |
641 | + continue; |
642 | + } |
643 | + /* expander found */ |
644 | + switch (position) |
645 | + { |
646 | + case GTK_POS_BOTTOM: |
647 | + case GTK_POS_TOP: |
648 | + curx = widget->allocation.x; |
649 | + if (exps_found % 2 != 0) |
650 | + curx += widget->allocation.width; |
651 | + break; |
652 | + default: |
653 | + curx = widget->allocation.y; |
654 | + if (exps_found % 2 != 0) |
655 | + curx += widget->allocation.height; |
656 | + break; |
657 | + } |
658 | + if (curx < 0) |
659 | + continue; |
660 | + |
661 | + if (exps_found % 2 != 0) |
662 | + { |
663 | + _line_from_to (cr, &lx, &ly, curx - d, y2); |
664 | + if (i->next != NULL) |
665 | + _line_from_to (cr, &lx, &ly, curx, y); |
666 | + } |
667 | + else |
668 | + { |
669 | + _line_from_to (cr, &lx, &ly, curx, y); |
670 | + _line_from_to (cr, &lx, &ly, curx + d, y2); |
671 | + } |
672 | + ++exps_found; |
673 | + } |
674 | + g_list_free (widgets); |
675 | + |
676 | + _line_from_to (cr, &lx, &ly, w, ly); |
677 | + _line_from_to (cr, &lx, &ly, lx, y3); |
678 | + |
679 | + cairo_close_path (cr); |
680 | + } |
681 | + } |
682 | + else |
683 | + { |
684 | + if (internal) |
685 | + { |
686 | + /* Auto-Stripe & Not-Expanded & Internal */ |
687 | + /* no-path */ |
688 | + } |
689 | + else |
690 | + { |
691 | + /* Auto-Stripe & Not-Expanded & External */ |
692 | + ly = y3; |
693 | + cairo_move_to (cr, lx, ly); |
694 | + |
695 | + if (align == 0.) |
696 | + _line_from_to (cr, &lx, &ly, lx , y); |
697 | + else |
698 | + _line_from_to (cr, &lx, &ly, lx + dc, y); |
699 | + |
700 | + if (align == 1.) |
701 | + _line_from_to (cr, &lx, &ly, w, y); |
702 | + else |
703 | + _line_from_to (cr, &lx, &ly, w - dc, y); |
704 | + |
705 | + _line_from_to (cr, &lx, &ly, w, y3); |
706 | + cairo_close_path (cr); |
707 | + } |
708 | + } |
709 | + } |
710 | +} |
711 | + |
712 | +static void |
713 | +draw_top_bottom_background (AwnBackground* bg, |
714 | + GtkPositionType position, |
715 | + cairo_t* cr, |
716 | + gint width, |
717 | + gint height) |
718 | +{ |
719 | + cairo_pattern_t *pat = NULL; |
720 | + cairo_pattern_t *pat_hi = NULL; |
721 | + |
722 | + /* Basic set-up */ |
723 | + cairo_set_line_width (cr, 1.0); |
724 | + cairo_set_operator (cr, CAIRO_OPERATOR_OVER); |
725 | + |
726 | + gboolean expand = FALSE; |
727 | + g_object_get (bg->panel, "expand", &expand, NULL); |
728 | + |
729 | + gfloat align = awn_background_get_panel_alignment (AWN_BACKGROUND (bg)); |
730 | + |
731 | + /* Make sure the bar gets drawn on the 0.5 pixels (for sharp edges) */ |
732 | + switch (position) |
733 | + { |
734 | + case GTK_POS_TOP: |
735 | + case GTK_POS_BOTTOM: |
736 | + cairo_translate (cr, 0., 0.5); |
737 | + break; |
738 | + default: |
739 | + cairo_translate (cr, 0.5, 0.); |
740 | + break; |
741 | + } |
742 | + |
743 | + if(gtk_widget_is_composited (GTK_WIDGET (bg->panel) ) == FALSE) |
744 | + { |
745 | + goto paint_lines; |
746 | + } |
747 | + |
748 | + /* create internal path */ |
749 | + _create_path_lucido (bg, position, cr, -1.0, 0., width, height, |
750 | + bg->stripe_width, bg->curviness, |
751 | + bg->curviness, bg->curves_symmetry, |
752 | + 1, expand, align); |
753 | + |
754 | + /* Draw internal pattern if needed */ |
755 | + if (bg->enable_pattern && bg->pattern) |
756 | + { |
757 | + /* Prepare pattern */ |
758 | + pat = cairo_pattern_create_for_surface (bg->pattern); |
759 | + cairo_pattern_set_extend (pat, CAIRO_EXTEND_REPEAT); |
760 | + /* Draw */ |
761 | + cairo_save (cr); |
762 | + cairo_clip_preserve (cr); |
763 | + cairo_set_source (cr, pat); |
764 | + cairo_paint (cr); |
765 | + cairo_restore (cr); |
766 | + cairo_pattern_destroy (pat); |
767 | + } |
768 | + |
769 | + /* Prepare the internal background */ |
770 | + pat = cairo_pattern_create_linear (0, 0, 0, height); |
771 | + awn_cairo_pattern_add_color_stop_color (pat, 0.0, bg->border_color); |
772 | + awn_cairo_pattern_add_color_stop_color (pat, 1.0, bg->hilight_color); |
773 | + |
774 | + /* Draw the internal background gradient */ |
775 | + cairo_save (cr); |
776 | + cairo_clip_preserve (cr); |
777 | + cairo_set_source (cr, pat); |
778 | + cairo_paint (cr); |
779 | + cairo_restore (cr); |
780 | + cairo_pattern_destroy (pat); |
781 | + |
782 | + /* Prepare external background gradient*/ |
783 | + pat = cairo_pattern_create_linear (0, 0, 0, height); |
784 | + awn_cairo_pattern_add_color_stop_color (pat, 0.0, bg->g_step_1); |
785 | + awn_cairo_pattern_add_color_stop_color (pat, 1.0, bg->g_step_2); |
786 | + |
787 | + /* create external path */ |
788 | + _create_path_lucido (bg, position, cr, -1.0, 0., width, height, |
789 | + bg->stripe_width, bg->curviness, |
790 | + bg->curviness, bg->curves_symmetry, |
791 | + 0, expand, align); |
792 | + |
793 | + /* Draw the external background */ |
794 | + cairo_save (cr); |
795 | + cairo_clip_preserve (cr); |
796 | + cairo_set_source (cr, pat); |
797 | + cairo_paint (cr); |
798 | + cairo_restore (cr); |
799 | + cairo_pattern_destroy (pat); |
800 | + |
801 | + /* Draw the hi-light */ |
802 | + pat_hi = cairo_pattern_create_linear (0, 0, 0, (height / 3.0)); |
803 | + awn_cairo_pattern_add_color_stop_color (pat_hi, 0.0, bg->g_histep_1); |
804 | + awn_cairo_pattern_add_color_stop_color (pat_hi, 1.0, bg->g_histep_2); |
805 | + |
806 | + if (expand) |
807 | + { |
808 | + cairo_new_path (cr); |
809 | + cairo_rectangle (cr, 0, 0, width, (height / 3.0)); |
810 | + } |
811 | + |
812 | + cairo_set_source (cr, pat_hi); |
813 | + cairo_fill (cr); |
814 | + cairo_pattern_destroy (pat_hi); |
815 | + |
816 | + return; |
817 | + /* if not composited */ |
818 | +paint_lines: |
819 | + |
820 | + if (expand) |
821 | + { |
822 | + /* Internal border */ |
823 | + awn_cairo_set_source_color (cr, bg->hilight_color); |
824 | + cairo_rectangle (cr, 1, 1, width - 3, height + 3); |
825 | + cairo_stroke (cr); |
826 | + |
827 | + /* External border */ |
828 | + awn_cairo_set_source_color (cr, bg->border_color); |
829 | + cairo_rectangle (cr, 1, 1, width - 1, height + 3); |
830 | + } |
831 | + else |
832 | + { |
833 | + awn_cairo_set_source_color (cr, bg->border_color); |
834 | + _create_path_lucido (bg, position, cr, 0., 0., width, height, |
835 | + bg->stripe_width, bg->curviness, |
836 | + bg->curviness, bg->curves_symmetry, |
837 | + 0, expand, align); |
838 | + cairo_stroke (cr); |
839 | + awn_cairo_set_source_color (cr, bg->hilight_color); |
840 | + _create_path_lucido (bg, position, cr, 1., 1., width-1., height-1., |
841 | + bg->stripe_width, bg->curviness, |
842 | + bg->curviness, bg->curves_symmetry, |
843 | + 0, expand, align); |
844 | + } |
845 | + cairo_stroke (cr); |
846 | +} |
847 | + |
848 | + |
849 | +static |
850 | +void awn_background_lucido_padding_request (AwnBackground *bg, |
851 | + GtkPositionType position, |
852 | + guint *padding_top, |
853 | + guint *padding_bottom, |
854 | + guint *padding_left, |
855 | + guint *padding_right) |
856 | +{ |
857 | + #define TOP_PADDING 2 |
858 | + gboolean expand = FALSE; |
859 | + g_object_get (bg->panel, "expand", &expand, NULL); |
860 | + gint side_padding = expand ? 0 : bg->curviness; |
861 | + gint zero_padding = 0; |
862 | + |
863 | + gfloat align = awn_background_get_panel_alignment (bg); |
864 | + if (awn_background_do_rtl_swap (bg)) |
865 | + { |
866 | + if (align <= 0.0 || align >= 1.0) |
867 | + { |
868 | + zero_padding = side_padding; |
869 | + side_padding = 0; |
870 | + } |
871 | + } |
872 | + |
873 | + switch (position) |
874 | + { |
875 | + case GTK_POS_TOP: |
876 | + *padding_top = 0; |
877 | + *padding_bottom = TOP_PADDING; |
878 | + *padding_left = align == 0.0 ? zero_padding : side_padding; |
879 | + *padding_right = align == 1.0 ? zero_padding : side_padding; |
880 | + break; |
881 | + case GTK_POS_BOTTOM: |
882 | + *padding_top = TOP_PADDING; |
883 | + *padding_bottom = 0; |
884 | + *padding_left = align == 0.0 ? zero_padding : side_padding; |
885 | + *padding_right = align == 1.0 ? zero_padding : side_padding; |
886 | + break; |
887 | + case GTK_POS_LEFT: |
888 | + *padding_top = align == 0.0 ? zero_padding : side_padding; |
889 | + *padding_bottom = align == 1.0 ? zero_padding : side_padding; |
890 | + *padding_left = 0; |
891 | + *padding_right = TOP_PADDING; |
892 | + break; |
893 | + case GTK_POS_RIGHT: |
894 | + *padding_top = align == 0.0 ? zero_padding : side_padding; |
895 | + *padding_bottom = align == 1.0 ? zero_padding : side_padding; |
896 | + *padding_left = TOP_PADDING; |
897 | + *padding_right = 0; |
898 | + break; |
899 | + default: |
900 | + break; |
901 | + } |
902 | +} |
903 | + |
904 | + |
905 | + |
906 | +static void |
907 | +awn_background_lucido_draw (AwnBackground *bg, |
908 | + cairo_t *cr, |
909 | + GtkPositionType position, |
910 | + GdkRectangle *area) |
911 | +{ |
912 | + gint temp; |
913 | + gint x = area->x, y = area->y; |
914 | + gint width = area->width, height = area->height; |
915 | + cairo_save (cr); |
916 | + |
917 | + switch (position) |
918 | + { |
919 | + case GTK_POS_RIGHT: |
920 | + cairo_translate (cr, 0., y + height); |
921 | + cairo_scale (cr, 1., -1.); |
922 | + cairo_translate (cr, x, height); |
923 | + cairo_rotate (cr, M_PI * 1.5); |
924 | + temp = width; |
925 | + width = height; |
926 | + height = temp; |
927 | + break; |
928 | + case GTK_POS_LEFT: |
929 | + cairo_translate (cr, x + width, y); |
930 | + cairo_rotate (cr, M_PI * 0.5); |
931 | + temp = width; |
932 | + width = height; |
933 | + height = temp; |
934 | + break; |
935 | + case GTK_POS_TOP: |
936 | + cairo_translate (cr, x, y + height); |
937 | + cairo_scale (cr, 1., -1.); |
938 | + break; |
939 | + default: |
940 | + cairo_translate (cr, x, y); |
941 | + break; |
942 | + } |
943 | + |
944 | + draw_top_bottom_background (bg, position, cr, width, height); |
945 | + |
946 | + cairo_restore (cr); |
947 | +} |
948 | + |
949 | +static gboolean |
950 | +awn_background_lucido_get_needs_redraw (AwnBackground *bg, |
951 | + GtkPositionType position, |
952 | + GdkRectangle *area) |
953 | +{ |
954 | + /* Check default needs redraw */ |
955 | + gboolean nr = AWN_BACKGROUND_CLASS (awn_background_lucido_parent_class)-> |
956 | + get_needs_redraw (bg, position, area); |
957 | + if (nr) |
958 | + return TRUE; |
959 | + |
960 | + /* Check expanders positions & sizes changed */ |
961 | + GList *widgets = _get_applet_widgets (bg); |
962 | + GList *i = widgets; |
963 | + GtkWidget *widget = NULL; |
964 | + gint wcheck = 0; |
965 | + gint ncheck = 0; |
966 | + |
967 | + for (; i; i = i->next) |
968 | + { |
969 | + widget = GTK_WIDGET (i->data); |
970 | + |
971 | + if (!GTK_IS_IMAGE (widget) || AWN_IS_SEPARATOR (widget)) |
972 | + { |
973 | + /* if not expander continue */ |
974 | + continue; |
975 | + } |
976 | + switch (position) |
977 | + { |
978 | + case GTK_POS_BOTTOM: |
979 | + case GTK_POS_TOP: |
980 | + wcheck += (widget->allocation.x * 3) / 2 + widget->allocation.width; |
981 | + break; |
982 | + default: |
983 | + wcheck += (widget->allocation.y * 3 ) / 2 + widget->allocation.height; |
984 | + break; |
985 | + } |
986 | + ++ncheck; |
987 | + } |
988 | + g_list_free (widgets); |
989 | + |
990 | + AwnBackgroundLucido *lbg = NULL; |
991 | + lbg = AWN_BACKGROUND_LUCIDO (bg); |
992 | + AwnBackgroundLucidoPrivate *priv; |
993 | + priv = AWN_BACKGROUND_LUCIDO_GET_PRIVATE (lbg); |
994 | + if (priv->expn != ncheck) |
995 | + { |
996 | + priv->expn = ncheck; |
997 | + /* used to refresh bar */ |
998 | + awn_background_emit_padding_changed (bg); |
999 | + } |
1000 | + if (priv->expw != wcheck) |
1001 | + { |
1002 | + priv->expw = wcheck; |
1003 | + return TRUE; |
1004 | + } |
1005 | + return FALSE; |
1006 | +} |
1007 | + |
1008 | +static void |
1009 | +awn_background_lucido_get_shape_mask (AwnBackground *bg, |
1010 | + cairo_t *cr, |
1011 | + GtkPositionType position, |
1012 | + GdkRectangle *area) |
1013 | +{ |
1014 | + gint temp; |
1015 | + gint x = area->x, y = area->y; |
1016 | + gint width = area->width, height = area->height; |
1017 | + gfloat align = 0.5; |
1018 | + gboolean expand = FALSE; |
1019 | + |
1020 | + cairo_save (cr); |
1021 | + |
1022 | + align = awn_background_get_panel_alignment (bg); |
1023 | + g_object_get (bg->panel, "expand", &expand, NULL); |
1024 | + |
1025 | + switch (position) |
1026 | + { |
1027 | + case GTK_POS_RIGHT: |
1028 | + cairo_translate (cr, 0., y + height); |
1029 | + cairo_scale (cr, 1., -1.); |
1030 | + cairo_translate (cr, x, height); |
1031 | + cairo_rotate (cr, M_PI * 1.5); |
1032 | + temp = width; |
1033 | + width = height; |
1034 | + height = temp; |
1035 | + break; |
1036 | + case GTK_POS_LEFT: |
1037 | + cairo_translate (cr, x + width, y); |
1038 | + cairo_rotate (cr, M_PI * 0.5); |
1039 | + temp = width; |
1040 | + width = height; |
1041 | + height = temp; |
1042 | + break; |
1043 | + case GTK_POS_TOP: |
1044 | + cairo_translate (cr, x, y + height); |
1045 | + cairo_scale (cr, 1., -1.); |
1046 | + break; |
1047 | + default: |
1048 | + cairo_translate (cr, x, y); |
1049 | + break; |
1050 | + } |
1051 | + if (expand) |
1052 | + cairo_rectangle (cr, 0, 0, width, height + 2); |
1053 | + else |
1054 | + _create_path_lucido (bg, position, cr, 0, 0., width, height, |
1055 | + bg->stripe_width, bg->curviness, |
1056 | + bg->curviness, bg->curves_symmetry, |
1057 | + 0, expand, align); |
1058 | + cairo_fill (cr); |
1059 | + |
1060 | + cairo_restore (cr); |
1061 | +} |
1062 | +/* vim: set et ts=2 sts=2 sw=2 : */ |
1063 | |
1064 | === added file 'src/awn-background-lucido.h' |
1065 | --- src/awn-background-lucido.h 1970-01-01 00:00:00 +0000 |
1066 | +++ src/awn-background-lucido.h 2010-05-31 17:25:42 +0000 |
1067 | @@ -0,0 +1,71 @@ |
1068 | +/* |
1069 | + * Copyright (C) 2009 Michal Hruby <michal.mhr@gmail.com> |
1070 | + * |
1071 | + * This program is free software; you can redistribute it and/or modify |
1072 | + * it under the terms of the GNU General Public License as published by |
1073 | + * the Free Software Foundation; either version 2 of the License, or |
1074 | + * (at your option) any later version. |
1075 | + * |
1076 | + * This program is distributed in the hope that it will be useful, |
1077 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1078 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1079 | + * GNU General Public License for more details. |
1080 | + * |
1081 | + * You should have received a copy of the GNU General Public License |
1082 | + * along with this program; if not, write to the Free Software |
1083 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
1084 | + * |
1085 | + * Author : Alberto Aldegheri <albyrock87+dev@gmail.com> |
1086 | +*/ |
1087 | + |
1088 | +#ifndef _AWN_BACKGROUND_LUCIDO_H |
1089 | +#define _AWN_BACKGROUND_LUCIDO_H |
1090 | + |
1091 | +#include <glib.h> |
1092 | +#include <glib-object.h> |
1093 | +#include <gtk/gtk.h> |
1094 | + |
1095 | +#include "awn-background.h" |
1096 | + |
1097 | +G_BEGIN_DECLS |
1098 | + |
1099 | +#define AWN_TYPE_BACKGROUND_LUCIDO (awn_background_lucido_get_type()) |
1100 | + |
1101 | +#define AWN_BACKGROUND_LUCIDO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AWN_TYPE_BACKGROUND_LUCIDO, \ |
1102 | + AwnBackgroundLucido)) |
1103 | + |
1104 | +#define AWN_BACKGROUND_LUCIDO_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), AWN_BACKGROUND_LUCIDO, \ |
1105 | + AwnBackgroundLucidoClass)) |
1106 | + |
1107 | +#define AWN_IS_BACKGROUND_LUCIDO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AWN_TYPE_BACKGROUND_LUCIDO)) |
1108 | + |
1109 | +#define AWN_IS_BACKGROUND_LUCIDO_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((obj), \ |
1110 | + AWN_TYPE_BACKGROUND_LUCIDO)) |
1111 | + |
1112 | +#define AWN_BACKGROUND_LUCIDO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \ |
1113 | + AWN_TYPE_BACKGROUND_LUCIDO, AwnBackgroundLucidoClass)) |
1114 | + |
1115 | +typedef struct _AwnBackgroundLucido AwnBackgroundLucido; |
1116 | +typedef struct _AwnBackgroundLucidoClass AwnBackgroundLucidoClass; |
1117 | +typedef struct _AwnBackgroundLucidoPrivate AwnBackgroundLucidoPrivate; |
1118 | + |
1119 | +struct _AwnBackgroundLucido |
1120 | +{ |
1121 | + AwnBackground parent; |
1122 | + AwnBackgroundLucidoPrivate *priv; |
1123 | +}; |
1124 | + |
1125 | +struct _AwnBackgroundLucidoClass |
1126 | +{ |
1127 | + AwnBackgroundClass parent_class; |
1128 | +}; |
1129 | + |
1130 | +GType awn_background_lucido_get_type (void) G_GNUC_CONST; |
1131 | + |
1132 | +AwnBackground * awn_background_lucido_new (DesktopAgnosticConfigClient *client, |
1133 | + AwnPanel *panel); |
1134 | + |
1135 | +G_END_DECLS |
1136 | + |
1137 | +#endif /* _AWN_BACKGROUND_LUCIDO_H */ |
1138 | + |
1139 | |
1140 | === modified file 'src/awn-background.c' |
1141 | --- src/awn-background.c 2010-04-08 15:38:05 +0000 |
1142 | +++ src/awn-background.c 2010-05-31 17:25:42 +0000 |
1143 | @@ -58,7 +58,8 @@ |
1144 | PROP_CORNER_RADIUS, |
1145 | PROP_PANEL_ANGLE, |
1146 | PROP_CURVINESS, |
1147 | - PROP_CURVES_SYMEMETRY |
1148 | + PROP_CURVES_SYMEMETRY, |
1149 | + PROP_STRIPE_WIDTH |
1150 | }; |
1151 | |
1152 | enum |
1153 | @@ -90,6 +91,10 @@ |
1154 | GtkPositionType position, |
1155 | GdkRectangle *area); |
1156 | |
1157 | +static gboolean awn_background_get_needs_redraw (AwnBackground *bg, |
1158 | + GtkPositionType position, |
1159 | + GdkRectangle *area); |
1160 | + |
1161 | static AwnPathType awn_background_path_default (AwnBackground *bg, |
1162 | gfloat *offset_mod); |
1163 | |
1164 | @@ -186,6 +191,11 @@ |
1165 | object, "curves-symmetry", TRUE, |
1166 | DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK, |
1167 | NULL); |
1168 | + desktop_agnostic_config_client_bind (bg->client, |
1169 | + AWN_GROUP_THEME, AWN_THEME_STRIPE_WIDTH, |
1170 | + object, "stripe-width", TRUE, |
1171 | + DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK, |
1172 | + NULL); |
1173 | } |
1174 | |
1175 | static void |
1176 | @@ -342,12 +352,15 @@ |
1177 | case PROP_CURVES_SYMEMETRY: |
1178 | bg->curves_symmetry = g_value_get_float (value); |
1179 | break; |
1180 | + case PROP_STRIPE_WIDTH: |
1181 | + bg->stripe_width = g_value_get_float (value); |
1182 | + break; |
1183 | |
1184 | default: |
1185 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
1186 | return; |
1187 | } |
1188 | - |
1189 | + awn_background_invalidate (bg); |
1190 | g_signal_emit (object, _bg_signals[CHANGED], 0); |
1191 | } |
1192 | |
1193 | @@ -380,6 +393,12 @@ |
1194 | if (bg->hilight_color) g_object_unref (bg->hilight_color); |
1195 | if (bg->sep_color) g_object_unref (bg->sep_color); |
1196 | |
1197 | + if (bg->helper_surface != NULL) |
1198 | + { |
1199 | + cairo_surface_finish (bg->helper_surface); |
1200 | + cairo_surface_destroy (bg->helper_surface); |
1201 | + } |
1202 | + |
1203 | G_OBJECT_CLASS (awn_background_parent_class)->finalize (object); |
1204 | } |
1205 | |
1206 | @@ -398,6 +417,7 @@ |
1207 | klass->get_input_shape_mask = awn_background_mask_none; |
1208 | klass->get_path_type = awn_background_path_default; |
1209 | klass->get_strut_offsets = NULL; |
1210 | + klass->get_needs_redraw = awn_background_get_needs_redraw; |
1211 | |
1212 | /* Object properties */ |
1213 | g_object_class_install_property (obj_class, |
1214 | @@ -575,6 +595,15 @@ |
1215 | 0.0, 1.0, 0.5, |
1216 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT | |
1217 | G_PARAM_STATIC_STRINGS)); |
1218 | + |
1219 | + g_object_class_install_property (obj_class, |
1220 | + PROP_STRIPE_WIDTH, |
1221 | + g_param_spec_float ("stripe-width", |
1222 | + "Stripe Width", |
1223 | + "The width of the stripe", |
1224 | + 0.0, 1.0, 0.0, |
1225 | + G_PARAM_READWRITE | G_PARAM_CONSTRUCT | |
1226 | + G_PARAM_STATIC_STRINGS)); |
1227 | |
1228 | /* Add signals to the class */ |
1229 | _bg_signals[CHANGED] = |
1230 | @@ -650,6 +679,11 @@ |
1231 | bg->border_color = NULL; |
1232 | bg->hilight_color = NULL; |
1233 | bg->sep_color = NULL; |
1234 | + bg->needs_redraw = TRUE; |
1235 | + bg->helper_surface = NULL; |
1236 | + bg->cache_enabled = TRUE; |
1237 | + bg->last_height = 0; |
1238 | + bg->last_width = 0; |
1239 | } |
1240 | |
1241 | void |
1242 | @@ -664,8 +698,40 @@ |
1243 | |
1244 | klass = AWN_BACKGROUND_GET_CLASS (bg); |
1245 | g_return_if_fail (klass->draw != NULL); |
1246 | - |
1247 | - klass->draw (bg, cr, position, area); |
1248 | + |
1249 | + /* Check if background caching is enabled - TRUE by default */ |
1250 | + if (bg->cache_enabled) |
1251 | + { |
1252 | + g_return_if_fail (klass->get_needs_redraw != NULL); |
1253 | + cairo_save (cr); |
1254 | + |
1255 | + /* Check if background needs to be redrawn */ |
1256 | + if (klass->get_needs_redraw (bg, position, area)) |
1257 | + { |
1258 | + /* Free last surface */ |
1259 | + if (bg->helper_surface != NULL) |
1260 | + { |
1261 | + cairo_surface_finish (bg->helper_surface); |
1262 | + cairo_surface_destroy (bg->helper_surface); |
1263 | + } |
1264 | + /* Create new surface */ |
1265 | + bg->helper_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, |
1266 | + area->x + area->width, |
1267 | + area->y + area->height); |
1268 | + cairo_t* temp_cr = cairo_create (bg->helper_surface); |
1269 | + /* Draw background on temp cairo_t */ |
1270 | + klass->draw (bg, temp_cr, position, area); |
1271 | + cairo_destroy (temp_cr); |
1272 | + } |
1273 | + /* Paint saved surface */ |
1274 | + cairo_set_source_surface (cr, bg->helper_surface, 0., 0.); |
1275 | + cairo_paint(cr); |
1276 | + cairo_restore (cr); |
1277 | + } |
1278 | + else |
1279 | + { |
1280 | + klass->draw (bg, cr, position, area); |
1281 | + } |
1282 | } |
1283 | |
1284 | void |
1285 | @@ -1009,4 +1075,25 @@ |
1286 | return AWN_PATH_LINEAR; |
1287 | } |
1288 | |
1289 | +static gboolean awn_background_get_needs_redraw (AwnBackground *bg, |
1290 | + GtkPositionType position, |
1291 | + GdkRectangle *area) |
1292 | +{ |
1293 | + if (bg->needs_redraw == 1 || |
1294 | + bg->last_height != area->height || |
1295 | + bg->last_width != area->width) |
1296 | + { |
1297 | + bg->needs_redraw = 0; |
1298 | + bg->last_height = area->height; |
1299 | + bg->last_width = area->width; |
1300 | + return TRUE; |
1301 | + } |
1302 | + return FALSE; |
1303 | +} |
1304 | + |
1305 | +void awn_background_invalidate (AwnBackground *bg) |
1306 | +{ |
1307 | + bg->needs_redraw = 1; |
1308 | +} |
1309 | + |
1310 | /* vim: set et ts=2 sts=2 sw=2 : */ |
1311 | |
1312 | === modified file 'src/awn-background.h' |
1313 | --- src/awn-background.h 2010-03-07 18:38:07 +0000 |
1314 | +++ src/awn-background.h 2010-05-31 17:25:42 +0000 |
1315 | @@ -76,6 +76,15 @@ |
1316 | gfloat pattern_alpha; |
1317 | GdkPixbuf *pattern_original; |
1318 | cairo_surface_t *pattern; |
1319 | + |
1320 | + /* Speedup code. |
1321 | + * We can save the bg and redraw only when properties changes |
1322 | + */ |
1323 | + gboolean cache_enabled; |
1324 | + gboolean needs_redraw; |
1325 | + cairo_surface_t* helper_surface; |
1326 | + gint last_height; |
1327 | + gint last_width; |
1328 | |
1329 | /* FIXME: |
1330 | * These two should ultimately go somewhere else (once we do multiple panels) |
1331 | @@ -89,6 +98,7 @@ |
1332 | gint panel_angle; |
1333 | gfloat curviness; |
1334 | gfloat curves_symmetry; |
1335 | + gfloat stripe_width; |
1336 | |
1337 | /* private */ |
1338 | guint changed; |
1339 | @@ -129,6 +139,10 @@ |
1340 | GdkRectangle *area, |
1341 | gint *strut, |
1342 | gint *strut_start, gint *strut_end); |
1343 | + |
1344 | + gboolean (*get_needs_redraw) (AwnBackground *bg, |
1345 | + GtkPositionType position, |
1346 | + GdkRectangle *area); |
1347 | |
1348 | /*< signals >*/ |
1349 | void (*changed) (AwnBackground *bg); |
1350 | @@ -142,6 +156,8 @@ |
1351 | GtkPositionType position, |
1352 | GdkRectangle *area); |
1353 | |
1354 | +void awn_background_invalidate (AwnBackground *bg); |
1355 | + |
1356 | void awn_background_padding_request (AwnBackground *bg, |
1357 | GtkPositionType position, |
1358 | guint *padding_top, |
1359 | |
1360 | === modified file 'src/awn-defines.h' |
1361 | --- src/awn-defines.h 2010-02-06 13:34:02 +0000 |
1362 | +++ src/awn-defines.h 2010-05-31 17:25:42 +0000 |
1363 | @@ -87,6 +87,7 @@ |
1364 | #define AWN_THEME_PANEL_ANGLE "panel_angle" |
1365 | #define AWN_THEME_CURVINESS "curviness" |
1366 | #define AWN_THEME_CURVES_SYMMETRY "curves_symmetry" |
1367 | +#define AWN_THEME_STRIPE_WIDTH "stripe_width" |
1368 | |
1369 | #endif /*_HAVE_AWN_DEFINES_H */ |
1370 | |
1371 | |
1372 | === modified file 'src/awn-panel.c' |
1373 | --- src/awn-panel.c 2010-05-29 17:17:22 +0000 |
1374 | +++ src/awn-panel.c 2010-05-31 17:25:42 +0000 |
1375 | @@ -43,6 +43,7 @@ |
1376 | #include "awn-background-3d.h" |
1377 | #include "awn-background-curves.h" |
1378 | #include "awn-background-edgy.h" |
1379 | +#include "awn-background-lucido.h" |
1380 | #include "awn-background-floaty.h" |
1381 | #include "awn-defines.h" |
1382 | #include "awn-marshal.h" |
1383 | @@ -222,6 +223,7 @@ |
1384 | STYLE_EDGY, |
1385 | STYLE_FLOATY, |
1386 | |
1387 | + STYLE_LUCIDO, |
1388 | STYLE_LAST |
1389 | }; |
1390 | |
1391 | @@ -1075,6 +1077,9 @@ |
1392 | } |
1393 | |
1394 | awn_panel_queue_masks_update (panel); |
1395 | + |
1396 | + if (priv->bg) |
1397 | + awn_background_invalidate (priv->bg); |
1398 | } |
1399 | |
1400 | static |
1401 | @@ -1760,7 +1765,7 @@ |
1402 | obj_class->finalize = awn_panel_finalize; |
1403 | obj_class->get_property = awn_panel_get_property; |
1404 | obj_class->set_property = awn_panel_set_property; |
1405 | - |
1406 | + |
1407 | cont_class->add = awn_panel_add; |
1408 | |
1409 | wid_class->expose_event = awn_panel_expose; |
1410 | @@ -3179,6 +3184,9 @@ |
1411 | case STYLE_EDGY: |
1412 | priv->bg = awn_background_edgy_new (priv->client, panel); |
1413 | break; |
1414 | + case STYLE_LUCIDO: |
1415 | + priv->bg = awn_background_lucido_new (priv->client, panel); |
1416 | + break; |
1417 | case STYLE_FLOATY: |
1418 | priv->bg = awn_background_floaty_new (priv->client, panel); |
1419 | break; |
WTF!!!
Why BZR removes 'po/avant- window- navigator. pot' if i've never touched that file?????