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: |
1375 lines (+1062/-11) 13 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 (+797/-0) src/awn-background-lucido.h (+71/-0) src/awn-background.c (+97/-3) src/awn-background.h (+19/-0) src/awn-defines.h (+1/-0) src/awn-panel.c (+16/-0) src/awn-panel.h (+1/-0) |
To merge this branch: | bzr merge lp:~albyrock87/awn/awn-lucido |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alberto Aldegheri | Needs Information | ||
Michal Hruby (community) | code-review | Needs Fixing | |
Review via email: mp+26165@code.launchpad.net |
This proposal supersedes a proposal from 2010-05-17.
This proposal has been superseded by 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
- 700. By Michal Hruby
-
* awn-settings/
awnSettings. py.in:
* po/avant-window- navigator. pot:
Fix LP bug #586670. - 701. By Michal Hruby
-
* applets/
quick-prefs/ applet. vala:
Use async DBus calls in quick-prefs applet.
Michal Hruby (mhr3) wrote : | # |
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 : | # |
Also it'd be nice to use private structure for the 'expw' variable, don't expose it.
Michal Hruby (mhr3) wrote : | # |
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 : | # |
And one more: On bottom orientation (expanded panel) the pixels on x == 0 have incorrect color.
- 702. By Michal Hruby
-
* src/awn-monitor.c:
* src/awn-monitor.h:
* src/awn-panel.c:
Possible fix for LP bug #562453.
Alberto Aldegheri (albyrock87) wrote : | # |
> 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 : | # |
Ok, all done.
I've found a way to fix:
> 3) Incomplete redraw when second expander is added to the panel.
Resubmitting :)
- 703. By Michal Hruby
-
Merge Lucido style from <lp:~albyrock87/awn/awn-lucido>
- 704. By Michal Hruby
-
* awn-settings/
awn-settings. ui:
* awn-settings/awnDefs. py.in:
* awn-settings/awnSettings. py.in:
* data/avant-window- navigator. schema- ini.in. in:
* src/awn-background- floaty. c:
* src/awn-background- lucido. c:
* src/awn-background. c:
* src/awn-background. h:
* src/awn-defines.h:
Stop misusing curviness in Floaty, don't use it in Lucido either. - 705. By Michal Hruby
-
Merge Lucido changes from <lp:~albyrock87/awn/awn-lucido>
- 706. By Alberto <alby@CASA>
-
FixTo:(0.5 pixel line not colored)
- 707. By Alberto <alby@CASA>
-
Merge from trunk
- 708. By Alberto <alby@CASA>
-
First version of separator-lucido
- 709. By Alberto <alby@CASA>
-
Stripe Width deleted
- 710. By Alberto <alby@CASA>
-
Draw bugfix
- 711. By Alberto <alby@CASA>
-
Draw bugfix number 2
- 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
- 721. By Alberto <alby@alby-laptop>
-
Some fixes and code restyle
- 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-03-08 12:50:07 +0000 |
3 | +++ awn-settings/awn-settings.ui 2010-05-30 13:41:34 +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-30 13:41:34 +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-30 13:41:34 +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-30 13:41:34 +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-30 13:41:34 +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-30 13:41:34 +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-30 13:41:34 +0000 |
188 | @@ -0,0 +1,797 @@ |
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 | +#include "awn-panel.h" |
222 | + |
223 | +G_DEFINE_TYPE (AwnBackgroundLucido, awn_background_lucido, AWN_TYPE_BACKGROUND_FLAT) |
224 | + |
225 | +#define AWN_BACKGROUND_LUCIDO_GET_PRIVATE(obj) ( \ |
226 | + G_TYPE_INSTANCE_GET_PRIVATE (obj, AWN_TYPE_BACKGROUND_LUCIDO, \ |
227 | + AwnBackgroundLucidoPrivate)) |
228 | + |
229 | +struct _AwnBackgroundLucidoPrivate |
230 | +{ |
231 | + gint expw; |
232 | + gint expn; |
233 | +}; |
234 | + |
235 | +enum |
236 | +{ |
237 | + PROP_0, |
238 | + |
239 | + PROP_CLIENT, |
240 | + PROP_PANEL, |
241 | + |
242 | + PROP_GSTEP1, |
243 | + PROP_GSTEP2, |
244 | + PROP_GHISTEP1, |
245 | + PROP_GHISTEP2, |
246 | + PROP_BORDER, |
247 | + PROP_HILIGHT, |
248 | + |
249 | + PROP_SHOW_SEP, |
250 | + PROP_SEP_COLOR, |
251 | + |
252 | + PROP_ENABLE_PATTERN, |
253 | + PROP_PATTERN_ALPHA, |
254 | + PROP_PATTERN_FILENAME, |
255 | + |
256 | + PROP_GTK_THEME_MODE, |
257 | + PROP_DIALOG_GTK_MODE, |
258 | + PROP_ROUNDED_CORNERS, |
259 | + PROP_CORNER_RADIUS, |
260 | + PROP_PANEL_ANGLE, |
261 | + PROP_CURVINESS, |
262 | + PROP_CURVES_SYMEMETRY, |
263 | + PROP_STRIPE_WIDTH |
264 | +}; |
265 | + |
266 | +static void awn_background_lucido_draw (AwnBackground *bg, |
267 | + cairo_t *cr, |
268 | + GtkPositionType position, |
269 | + GdkRectangle *area); |
270 | + |
271 | +static void awn_background_lucido_get_shape_mask (AwnBackground *bg, |
272 | + cairo_t *cr, |
273 | + GtkPositionType position, |
274 | + GdkRectangle *area); |
275 | + |
276 | +static void awn_background_lucido_padding_request (AwnBackground *bg, |
277 | + GtkPositionType position, |
278 | + guint *padding_top, |
279 | + guint *padding_bottom, |
280 | + guint *padding_left, |
281 | + guint *padding_right); |
282 | + |
283 | +static gboolean |
284 | +awn_background_lucido_get_needs_redraw (AwnBackground *bg, |
285 | + GtkPositionType position, |
286 | + GdkRectangle *area); |
287 | + |
288 | +static |
289 | +void awn_background_lucido_property_changed (AwnBackground *bg, |
290 | + guint prop_id); |
291 | + |
292 | +static void |
293 | +awn_background_lucido_constructed (GObject *object) |
294 | +{ |
295 | + G_OBJECT_CLASS (awn_background_lucido_parent_class)->constructed (object); |
296 | +} |
297 | + |
298 | +static void |
299 | +awn_background_lucido_dispose (GObject *object) |
300 | +{ |
301 | + G_OBJECT_CLASS (awn_background_lucido_parent_class)->dispose (object); |
302 | +} |
303 | + |
304 | +static void |
305 | +awn_background_lucido_class_init (AwnBackgroundLucidoClass *klass) |
306 | +{ |
307 | + AwnBackgroundClass *bg_class = AWN_BACKGROUND_CLASS (klass); |
308 | + |
309 | + GObjectClass *obj_class = G_OBJECT_CLASS (klass); |
310 | + obj_class->constructed = awn_background_lucido_constructed; |
311 | + obj_class->dispose = awn_background_lucido_dispose; |
312 | + |
313 | + bg_class->draw = awn_background_lucido_draw; |
314 | + bg_class->padding_request = awn_background_lucido_padding_request; |
315 | + bg_class->get_shape_mask = awn_background_lucido_get_shape_mask; |
316 | + bg_class->get_input_shape_mask = awn_background_lucido_get_shape_mask; |
317 | + bg_class->get_needs_redraw = awn_background_lucido_get_needs_redraw; |
318 | + bg_class->property_changed = awn_background_lucido_property_changed; |
319 | + |
320 | + g_type_class_add_private (obj_class, sizeof (AwnBackgroundLucidoPrivate)); |
321 | +} |
322 | + |
323 | +static void |
324 | +awn_background_lucido_init (AwnBackgroundLucido *bg) |
325 | +{ |
326 | + |
327 | +} |
328 | + |
329 | +AwnBackground * |
330 | +awn_background_lucido_new (DesktopAgnosticConfigClient *client, |
331 | + AwnPanel *panel) |
332 | +{ |
333 | + AwnBackground *bg; |
334 | + |
335 | + bg = g_object_new (AWN_TYPE_BACKGROUND_LUCIDO, |
336 | + "client", client, |
337 | + "panel", panel, |
338 | + NULL); |
339 | + return bg; |
340 | +} |
341 | + |
342 | +/* |
343 | + * Drawing functions |
344 | + */ |
345 | +static void |
346 | +_line_from_to ( cairo_t *cr, |
347 | + gfloat *xs, |
348 | + gfloat *ys, |
349 | + gfloat xf, |
350 | + gfloat yf) |
351 | +{ |
352 | + if ( *xs==xf || *ys==yf ) /* Vertical/Horizontal line */ |
353 | + cairo_line_to (cr, xf, yf); |
354 | + else |
355 | + { /* Oblique */ |
356 | + gfloat xm = ( *xs + xf ) / 2.0; |
357 | + cairo_curve_to (cr, xm, *ys, xm, yf, xf, yf); |
358 | + } |
359 | + *xs = xf; |
360 | + *ys = yf; |
361 | +} |
362 | + |
363 | +static GList* |
364 | +_get_applet_widgets (AwnBackground* bg) |
365 | +{ |
366 | + AwnAppletManager *manager = NULL; |
367 | + g_object_get (bg->panel, "applet-manager", &manager, NULL); |
368 | + |
369 | + return gtk_container_get_children (GTK_CONTAINER (manager)); |
370 | +} |
371 | + |
372 | +/** |
373 | + * _create_path_lucido: |
374 | + * @bg: The background pointer |
375 | + * @position: The position of the bar |
376 | + * @cairo_t: The cairo context |
377 | + * @y: The top left coordinate of the "bar rect" - default = 0 |
378 | + * @w: The width of the bar |
379 | + * @h: The height of the bar |
380 | + * @stripe: The width of the stripe (0.0-1.0). Zero for auto-stripe. |
381 | + * @d: The width of each curve in the path |
382 | + * @dc: The width of the external curves in non-expanded&auto mode |
383 | + * @symmetry: The symmetry of the stripe when @stripe > 0 |
384 | + * @internal: If Zero, creates the path for the stripe |
385 | + * @expanded: If Zero, the bar is not expanded |
386 | + * |
387 | + * This function creates paths on which the bar will be drawn. |
388 | + * In atuo-stripe, it searchs for expanders applet, each expander |
389 | + * equals to one curve. |
390 | + * If the first widget is an expander, start from bottom-left, |
391 | + * otherwise start from top-left |
392 | + */ |
393 | + |
394 | +static void |
395 | +_create_path_lucido ( AwnBackground* bg, |
396 | + GtkPositionType position, |
397 | + cairo_t* cr, |
398 | + gfloat x, |
399 | + gfloat y, |
400 | + gfloat w, |
401 | + gfloat h, |
402 | + gfloat stripe, |
403 | + gfloat d, |
404 | + gfloat dc, |
405 | + gfloat symmetry, |
406 | + gboolean internal, |
407 | + gboolean expanded, |
408 | + gfloat align) |
409 | +{ |
410 | + cairo_new_path (cr); |
411 | + |
412 | + gfloat lx = x; |
413 | + gfloat ly = y; |
414 | + gfloat y3 = y + h; |
415 | + gfloat y2 = y3 - 5; |
416 | + |
417 | + if (stripe > 0) |
418 | + { |
419 | + if (expanded) |
420 | + { |
421 | + stripe = (w * stripe); /* now stripe = non-stripe */ |
422 | + if (internal) |
423 | + { |
424 | + /* Manual-Stripe & Expanded & Internal */ |
425 | + lx = stripe * symmetry; |
426 | + cairo_move_to (cr, lx, ly); |
427 | + _line_from_to (cr, &lx, &ly, lx+d, y2); |
428 | + _line_from_to (cr, &lx, &ly, w-stripe * (1. - symmetry) - d, y2); |
429 | + _line_from_to (cr, &lx, &ly, w-stripe * (1. - symmetry), y); |
430 | + cairo_close_path (cr); |
431 | + } |
432 | + else |
433 | + { |
434 | + /* Manual-Stripe & Expanded & External */ |
435 | + ly = y3; |
436 | + cairo_move_to (cr, lx, ly); |
437 | + _line_from_to (cr, &lx, &ly, lx, y); |
438 | + _line_from_to (cr, &lx, &ly, stripe * symmetry, y); |
439 | + _line_from_to (cr, &lx, &ly, stripe * symmetry + d, y2); |
440 | + _line_from_to (cr, &lx, &ly, w - stripe * (1. - symmetry) - d, y2); |
441 | + _line_from_to (cr, &lx, &ly, w - stripe * (1. - symmetry), y); |
442 | + _line_from_to (cr, &lx, &ly, w, y); |
443 | + _line_from_to (cr, &lx, &ly, w, y3); |
444 | + cairo_close_path (cr); |
445 | + } |
446 | + } |
447 | + else |
448 | + { |
449 | + if (stripe == 1.) |
450 | + { |
451 | + _create_path_lucido (bg, position, cr, x, y, w, h, 0., |
452 | + d, dc, 0., internal, expanded, align); |
453 | + return; |
454 | + } |
455 | + stripe = ((w - dc * 2) * stripe); /* now stripe = non-stripe */ |
456 | + if (internal) |
457 | + { |
458 | + /* Manual-Stripe & Not-Expanded & Internal */ |
459 | + lx = stripe * symmetry + dc; |
460 | + cairo_move_to (cr, lx, ly); |
461 | + _line_from_to (cr, &lx, &ly, lx + d, y2); |
462 | + _line_from_to (cr, &lx, &ly, w - stripe * (1.- symmetry) - dc - d, y2); |
463 | + _line_from_to (cr, &lx, &ly, w - stripe * (1.- symmetry) - dc, y); |
464 | + cairo_close_path (cr); |
465 | + } |
466 | + else |
467 | + { |
468 | + /* Manual-Stripe & Not-Expanded & External */ |
469 | + ly = y3; |
470 | + cairo_move_to (cr, lx, ly); |
471 | + _line_from_to (cr, &lx, &ly, lx+dc, y); |
472 | + _line_from_to (cr, &lx, &ly, stripe * symmetry + dc, y); |
473 | + _line_from_to (cr, &lx, &ly, stripe * symmetry + d + dc, y2); |
474 | + _line_from_to (cr, &lx, &ly, w-stripe * (1. - symmetry) - dc - d, y2); |
475 | + _line_from_to (cr, &lx, &ly, w-stripe * (1. - symmetry) - dc, y); |
476 | + _line_from_to (cr, &lx, &ly, w-dc, y); |
477 | + _line_from_to (cr, &lx, &ly, w, y3); |
478 | + cairo_close_path(cr); |
479 | + } |
480 | + } |
481 | + } |
482 | + else |
483 | + { |
484 | + gint exps_found = 0; |
485 | + gfloat curx = 0.0; |
486 | + |
487 | + if (expanded) |
488 | + { |
489 | + if (internal) |
490 | + { |
491 | + /* Auto-Stripe & Expanded & Internal */ |
492 | + GList *widgets = _get_applet_widgets (bg); |
493 | + GList *i = widgets; |
494 | + GtkWidget *widget = NULL; |
495 | + |
496 | + /* analyze first widget*/ |
497 | + if (i) |
498 | + { |
499 | + widget = GTK_WIDGET (i->data); |
500 | + |
501 | + /* if first widget is an expander or align==0 || 1*/ |
502 | + if ( (widget && GTK_IS_IMAGE (widget) && !AWN_IS_SEPARATOR (widget) ) || |
503 | + ( align == 0. || align == 1. ) ) |
504 | + { |
505 | + /* start from bottom */ |
506 | + lx = curx; |
507 | + ly = y; |
508 | + cairo_move_to (cr, lx, ly); |
509 | + _line_from_to (cr, &lx, &ly, lx, y2); |
510 | + ++exps_found; |
511 | + if (align != 0. && align != 1.) |
512 | + i = i->next; |
513 | + } |
514 | + } |
515 | + /* else start from top */ |
516 | + |
517 | + for (; i; i = i->next) |
518 | + { |
519 | + widget = GTK_WIDGET (i->data); |
520 | + |
521 | + if (!GTK_IS_IMAGE (widget) || AWN_IS_SEPARATOR (widget)) |
522 | + { |
523 | + /* if not expander continue */ |
524 | + continue; |
525 | + } |
526 | + /* expander found */ |
527 | + switch (position) |
528 | + { |
529 | + case GTK_POS_BOTTOM: |
530 | + case GTK_POS_TOP: |
531 | + curx = widget->allocation.x; |
532 | + if (exps_found % 2 != 0) |
533 | + curx += widget->allocation.width; |
534 | + break; |
535 | + default: |
536 | + curx = widget->allocation.y; |
537 | + if ( exps_found % 2 != 0) |
538 | + curx += widget->allocation.height; |
539 | + break; |
540 | + } |
541 | + if (curx < 0) |
542 | + continue; |
543 | + |
544 | + if (exps_found == 0) |
545 | + { |
546 | + /* this is the first expander */ |
547 | + lx = curx; |
548 | + cairo_move_to (cr, lx, ly); |
549 | + _line_from_to (cr, &lx, &ly, curx + d, y2); |
550 | + } |
551 | + else |
552 | + { |
553 | + if (exps_found % 2 != 0) |
554 | + { |
555 | + /* odd expander - curve at the end of expander */ |
556 | + _line_from_to (cr, &lx, &ly, curx - d, y2); |
557 | + if (i->next != NULL) |
558 | + _line_from_to (cr, &lx, &ly, curx, y); |
559 | + /* else the last widget is an expander */ |
560 | + } |
561 | + else |
562 | + { |
563 | + /* even expander - curve at the start of expander */ |
564 | + _line_from_to (cr, &lx, &ly, curx, y); |
565 | + if (i->next != NULL) |
566 | + _line_from_to (cr, &lx, &ly, curx + d, y2); |
567 | + /* else the last widget is an expander */ |
568 | + } |
569 | + } |
570 | + |
571 | + ++exps_found; |
572 | + } |
573 | + g_list_free (widgets); |
574 | + |
575 | + _line_from_to (cr, &lx, &ly, w, ly); |
576 | + |
577 | + if (exps_found % 2 != 0) |
578 | + _line_from_to (cr, &lx, &ly, lx, y); |
579 | + |
580 | + cairo_close_path (cr); |
581 | + } |
582 | + else |
583 | + { |
584 | + /* Auto-Stripe & Expanded & External */ |
585 | + |
586 | + GList *widgets = _get_applet_widgets (bg); |
587 | + GList *i = widgets; |
588 | + GtkWidget *widget = NULL; |
589 | + |
590 | + /* analyze first widget*/ |
591 | + if (i) |
592 | + { |
593 | + widget = GTK_WIDGET (i->data); |
594 | + |
595 | + ly = y3; |
596 | + cairo_move_to (cr, lx, ly); |
597 | + |
598 | + /* if first widget is an expander or align==0 || 1*/ |
599 | + if ( (widget && GTK_IS_IMAGE (widget) && !AWN_IS_SEPARATOR (widget) ) || |
600 | + ( align == 0. || align == 1. ) ) |
601 | + { |
602 | + /* start from bottom */ |
603 | + _line_from_to (cr, &lx, &ly, lx, y2); |
604 | + ++exps_found; |
605 | + if (align != 0. && align != 1.) |
606 | + i = i->next; |
607 | + } |
608 | + else |
609 | + { |
610 | + /* start from top */ |
611 | + _line_from_to (cr, &lx, &ly, lx, y); |
612 | + } |
613 | + } |
614 | + |
615 | + for (; i; i = i->next) |
616 | + { |
617 | + widget = GTK_WIDGET (i->data); |
618 | + |
619 | + if (!GTK_IS_IMAGE (widget) || AWN_IS_SEPARATOR (widget)) |
620 | + { |
621 | + /* if not expander continue */ |
622 | + continue; |
623 | + } |
624 | + /* expander found */ |
625 | + switch (position) |
626 | + { |
627 | + case GTK_POS_BOTTOM: |
628 | + case GTK_POS_TOP: |
629 | + curx = widget->allocation.x; |
630 | + if (exps_found % 2 != 0) |
631 | + curx += widget->allocation.width; |
632 | + break; |
633 | + default: |
634 | + curx = widget->allocation.y; |
635 | + if (exps_found % 2 != 0) |
636 | + curx += widget->allocation.height; |
637 | + break; |
638 | + } |
639 | + if (curx < 0) |
640 | + continue; |
641 | + |
642 | + if (exps_found % 2 != 0) |
643 | + { |
644 | + _line_from_to (cr, &lx, &ly, curx - d, y2); |
645 | + _line_from_to (cr, &lx, &ly, curx, y); |
646 | + } |
647 | + else |
648 | + { |
649 | + _line_from_to (cr, &lx, &ly, curx, y); |
650 | + _line_from_to (cr, &lx, &ly, curx + d, y2); |
651 | + } |
652 | + ++exps_found; |
653 | + } |
654 | + g_list_free (widgets); |
655 | + |
656 | + _line_from_to (cr, &lx, &ly, w, ly); |
657 | + _line_from_to (cr, &lx, &ly, lx, y3); |
658 | + |
659 | + cairo_close_path (cr); |
660 | + } |
661 | + } |
662 | + else |
663 | + { |
664 | + if (internal) |
665 | + { |
666 | + /* Auto-Stripe & Not-Expanded & Internal */ |
667 | + /* no-path */ |
668 | + } |
669 | + else |
670 | + { |
671 | + /* Auto-Stripe & Not-Expanded & External */ |
672 | + ly = y3; |
673 | + cairo_move_to (cr, lx, ly); |
674 | + |
675 | + if (align == 0.) |
676 | + _line_from_to (cr, &lx, &ly, lx , y); |
677 | + else |
678 | + _line_from_to (cr, &lx, &ly, lx + dc, y); |
679 | + |
680 | + if (align == 1.) |
681 | + _line_from_to (cr, &lx, &ly, w, y); |
682 | + else |
683 | + _line_from_to (cr, &lx, &ly, w - dc, y); |
684 | + |
685 | + _line_from_to (cr, &lx, &ly, w, y3); |
686 | + cairo_close_path (cr); |
687 | + } |
688 | + } |
689 | + } |
690 | +} |
691 | + |
692 | +static void |
693 | +draw_top_bottom_background (AwnBackground* bg, |
694 | + GtkPositionType position, |
695 | + cairo_t* cr, |
696 | + gint width, |
697 | + gint height) |
698 | +{ |
699 | + cairo_pattern_t *pat = NULL; |
700 | + cairo_pattern_t *pat_hi = NULL; |
701 | + |
702 | + /* Make sure the bar gets drawn on the 0.5 pixels (for sharp edges) */ |
703 | + cairo_translate (cr, 0.5, 0.5); |
704 | + |
705 | + /* Basic set-up */ |
706 | + cairo_set_line_width (cr, 1.0); |
707 | + cairo_set_operator (cr, CAIRO_OPERATOR_OVER); |
708 | + |
709 | + if(gtk_widget_is_composited (GTK_WIDGET (bg->panel) ) == FALSE) |
710 | + { |
711 | + goto paint_lines; |
712 | + } |
713 | + |
714 | + gboolean expand = FALSE; |
715 | + g_object_get (bg->panel, "expand", &expand, NULL); |
716 | + |
717 | + gfloat align = awn_background_get_panel_alignment (AWN_BACKGROUND (bg)); |
718 | + |
719 | + /* create internal path */ |
720 | + _create_path_lucido (bg, position, cr, -1.0, 0., width, height, |
721 | + bg->stripe_width, bg->curviness, |
722 | + bg->curviness, bg->curves_symmetry, |
723 | + 1, expand, align); |
724 | + |
725 | + /* Draw internal pattern if needed */ |
726 | + if (bg->enable_pattern && bg->pattern) |
727 | + { |
728 | + /* Prepare pattern */ |
729 | + pat = cairo_pattern_create_for_surface (bg->pattern); |
730 | + cairo_pattern_set_extend (pat, CAIRO_EXTEND_REPEAT); |
731 | + /* Draw */ |
732 | + cairo_save (cr); |
733 | + cairo_clip_preserve (cr); |
734 | + cairo_set_source (cr, pat); |
735 | + cairo_paint (cr); |
736 | + cairo_restore (cr); |
737 | + cairo_pattern_destroy (pat); |
738 | + } |
739 | + |
740 | + /* Prepare the internal background */ |
741 | + pat = cairo_pattern_create_linear (0, 0, 0, height); |
742 | + awn_cairo_pattern_add_color_stop_color (pat, 0.0, bg->border_color); |
743 | + awn_cairo_pattern_add_color_stop_color (pat, 1.0, bg->hilight_color); |
744 | + |
745 | + /* Draw the internal background gradient */ |
746 | + cairo_save (cr); |
747 | + cairo_clip_preserve (cr); |
748 | + cairo_set_source (cr, pat); |
749 | + cairo_paint (cr); |
750 | + cairo_restore (cr); |
751 | + cairo_pattern_destroy (pat); |
752 | + |
753 | + /* Prepare external background gradient*/ |
754 | + pat = cairo_pattern_create_linear (0, 0, 0, height); |
755 | + awn_cairo_pattern_add_color_stop_color (pat, 0.0, bg->g_step_1); |
756 | + awn_cairo_pattern_add_color_stop_color (pat, 1.0, bg->g_step_2); |
757 | + |
758 | + /* create external path */ |
759 | + _create_path_lucido (bg, position, cr, -1.0, 0., width, height, |
760 | + bg->stripe_width, bg->curviness, |
761 | + bg->curviness, bg->curves_symmetry, |
762 | + 0, expand, align); |
763 | + |
764 | + /* Draw the external background */ |
765 | + cairo_save (cr); |
766 | + cairo_clip_preserve (cr); |
767 | + cairo_set_source (cr, pat); |
768 | + cairo_paint (cr); |
769 | + cairo_restore (cr); |
770 | + cairo_pattern_destroy (pat); |
771 | + |
772 | + /* Draw the hi-light */ |
773 | + pat_hi = cairo_pattern_create_linear (0, 0, 0, (height / 3.0)); |
774 | + awn_cairo_pattern_add_color_stop_color (pat_hi, 0.0, bg->g_histep_1); |
775 | + awn_cairo_pattern_add_color_stop_color (pat_hi, 1.0, bg->g_histep_2); |
776 | + |
777 | + if (expand) |
778 | + { |
779 | + cairo_new_path (cr); |
780 | + cairo_rectangle (cr, 0, 0, width, (height / 3.0)); |
781 | + } |
782 | + |
783 | + cairo_set_source (cr, pat_hi); |
784 | + cairo_fill (cr); |
785 | + cairo_pattern_destroy (pat_hi); |
786 | + |
787 | + return; |
788 | + /* if not composited */ |
789 | +paint_lines: |
790 | + |
791 | + /* Internal border */ |
792 | + awn_cairo_set_source_color (cr, bg->hilight_color); |
793 | + cairo_rectangle (cr, 1, 1, width - 3, height + 3); |
794 | + cairo_stroke (cr); |
795 | + |
796 | + /* External border */ |
797 | + awn_cairo_set_source_color (cr, bg->border_color); |
798 | + cairo_rectangle (cr, 1, 1, width - 1, height + 3); |
799 | + cairo_stroke (cr); |
800 | +} |
801 | + |
802 | + |
803 | +static |
804 | +void awn_background_lucido_padding_request (AwnBackground *bg, |
805 | + GtkPositionType position, |
806 | + guint *padding_top, |
807 | + guint *padding_bottom, |
808 | + guint *padding_left, |
809 | + guint *padding_right) |
810 | +{ |
811 | + #define TOP_PADDING 2 |
812 | + gboolean expand = FALSE; |
813 | + g_object_get (bg->panel, "expand", &expand, NULL); |
814 | + gint side_padding = expand ? 0 : bg->curviness; |
815 | + gint zero_padding = 0; |
816 | + |
817 | + gfloat align = awn_background_get_panel_alignment (bg); |
818 | + if (awn_background_do_rtl_swap (bg)) |
819 | + { |
820 | + if (align <= 0.0 || align >= 1.0) |
821 | + { |
822 | + zero_padding = side_padding; |
823 | + side_padding = 0; |
824 | + } |
825 | + } |
826 | + |
827 | + switch (position) |
828 | + { |
829 | + case GTK_POS_TOP: |
830 | + *padding_top = 0; |
831 | + *padding_bottom = TOP_PADDING; |
832 | + *padding_left = align == 0.0 ? zero_padding : side_padding; |
833 | + *padding_right = align == 1.0 ? zero_padding : side_padding; |
834 | + break; |
835 | + case GTK_POS_BOTTOM: |
836 | + *padding_top = TOP_PADDING; |
837 | + *padding_bottom = 0; |
838 | + *padding_left = align == 0.0 ? zero_padding : side_padding; |
839 | + *padding_right = align == 1.0 ? zero_padding : side_padding; |
840 | + break; |
841 | + case GTK_POS_LEFT: |
842 | + *padding_top = align == 0.0 ? zero_padding : side_padding; |
843 | + *padding_bottom = align == 1.0 ? zero_padding : side_padding; |
844 | + *padding_left = 0; |
845 | + *padding_right = TOP_PADDING; |
846 | + break; |
847 | + case GTK_POS_RIGHT: |
848 | + *padding_top = align == 0.0 ? zero_padding : side_padding; |
849 | + *padding_bottom = align == 1.0 ? zero_padding : side_padding; |
850 | + *padding_left = TOP_PADDING; |
851 | + *padding_right = 0; |
852 | + break; |
853 | + default: |
854 | + break; |
855 | + } |
856 | +} |
857 | + |
858 | + |
859 | + |
860 | +static void |
861 | +awn_background_lucido_draw (AwnBackground *bg, |
862 | + cairo_t *cr, |
863 | + GtkPositionType position, |
864 | + GdkRectangle *area) |
865 | +{ |
866 | + gint temp; |
867 | + gint x = area->x, y = area->y; |
868 | + gint width = area->width, height = area->height; |
869 | + cairo_save (cr); |
870 | + |
871 | + switch (position) |
872 | + { |
873 | + case GTK_POS_RIGHT: |
874 | + cairo_translate (cr, 0., y + height); |
875 | + cairo_scale (cr, 1., -1.); |
876 | + cairo_translate (cr, x, height); |
877 | + cairo_rotate (cr, M_PI * 1.5); |
878 | + temp = width; |
879 | + width = height; |
880 | + height = temp; |
881 | + break; |
882 | + case GTK_POS_LEFT: |
883 | + cairo_translate (cr, x + width, y); |
884 | + cairo_rotate (cr, M_PI * 0.5); |
885 | + temp = width; |
886 | + width = height; |
887 | + height = temp; |
888 | + break; |
889 | + case GTK_POS_TOP: |
890 | + cairo_translate (cr, x, y + height); |
891 | + cairo_scale (cr, 1., -1.); |
892 | + break; |
893 | + default: |
894 | + cairo_translate (cr, x, y); |
895 | + break; |
896 | + } |
897 | + |
898 | + draw_top_bottom_background (bg, position, cr, width, height); |
899 | + |
900 | + cairo_restore (cr); |
901 | +} |
902 | + |
903 | +static gboolean |
904 | +awn_background_lucido_get_needs_redraw (AwnBackground *bg, |
905 | + GtkPositionType position, |
906 | + GdkRectangle *area) |
907 | +{ |
908 | + /* Check default needs redraw */ |
909 | + gboolean nr = AWN_BACKGROUND_CLASS (awn_background_lucido_parent_class)-> |
910 | + get_needs_redraw (bg, position, area); |
911 | + if (nr) |
912 | + return TRUE; |
913 | + |
914 | + /* Check expanders positions & sizes changed */ |
915 | + GList *widgets = _get_applet_widgets (bg); |
916 | + GList *i = widgets; |
917 | + GtkWidget *widget = NULL; |
918 | + gint wcheck = 0; |
919 | + gint ncheck = 0; |
920 | + |
921 | + for (; i; i = i->next) |
922 | + { |
923 | + widget = GTK_WIDGET (i->data); |
924 | + |
925 | + if (!GTK_IS_IMAGE (widget) || AWN_IS_SEPARATOR (widget)) |
926 | + { |
927 | + /* if not expander continue */ |
928 | + continue; |
929 | + } |
930 | + switch (position) |
931 | + { |
932 | + case GTK_POS_BOTTOM: |
933 | + case GTK_POS_TOP: |
934 | + wcheck += widget->allocation.x * 2 + widget->allocation.width; |
935 | + break; |
936 | + default: |
937 | + wcheck += widget->allocation.y * 2 + widget->allocation.height; |
938 | + break; |
939 | + } |
940 | + ++ncheck; |
941 | + } |
942 | + g_list_free (widgets); |
943 | + |
944 | + AwnBackgroundLucido *lbg = NULL; |
945 | + lbg = AWN_BACKGROUND_LUCIDO (bg); |
946 | + AwnBackgroundLucidoPrivate *priv; |
947 | + priv = AWN_BACKGROUND_LUCIDO_GET_PRIVATE (lbg); |
948 | + if (priv->expn != ncheck) |
949 | + { |
950 | + priv->expn = ncheck; |
951 | + /* used to refresh bar */ |
952 | + AWN_PANEL_GET_CLASS (bg->panel)->padding_changed (bg->panel); |
953 | + } |
954 | + if (priv->expw != wcheck) |
955 | + { |
956 | + priv->expw = wcheck; |
957 | + return TRUE; |
958 | + } |
959 | + return FALSE; |
960 | +} |
961 | + |
962 | +static void |
963 | +awn_background_lucido_get_shape_mask (AwnBackground *bg, |
964 | + cairo_t *cr, |
965 | + GtkPositionType position, |
966 | + GdkRectangle *area) |
967 | +{ |
968 | + AWN_BACKGROUND_CLASS (awn_background_lucido_parent_class)->get_shape_mask ( |
969 | + bg, cr, position, area); |
970 | +} |
971 | + |
972 | +static |
973 | +void awn_background_lucido_property_changed (AwnBackground *bg, |
974 | + guint prop_id) |
975 | +{ |
976 | + switch (prop_id) |
977 | + { |
978 | + case PROP_CURVINESS: |
979 | + AWN_PANEL_GET_CLASS (bg->panel)->padding_changed (bg->panel); |
980 | + break; |
981 | + default: |
982 | + break; |
983 | + } |
984 | +} |
985 | +/* vim: set et ts=2 sts=2 sw=2 : */ |
986 | |
987 | === added file 'src/awn-background-lucido.h' |
988 | --- src/awn-background-lucido.h 1970-01-01 00:00:00 +0000 |
989 | +++ src/awn-background-lucido.h 2010-05-30 13:41:34 +0000 |
990 | @@ -0,0 +1,71 @@ |
991 | +/* |
992 | + * Copyright (C) 2009 Michal Hruby <michal.mhr@gmail.com> |
993 | + * |
994 | + * This program is free software; you can redistribute it and/or modify |
995 | + * it under the terms of the GNU General Public License as published by |
996 | + * the Free Software Foundation; either version 2 of the License, or |
997 | + * (at your option) any later version. |
998 | + * |
999 | + * This program is distributed in the hope that it will be useful, |
1000 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1001 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1002 | + * GNU General Public License for more details. |
1003 | + * |
1004 | + * You should have received a copy of the GNU General Public License |
1005 | + * along with this program; if not, write to the Free Software |
1006 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
1007 | + * |
1008 | + * Author : Alberto Aldegheri <albyrock87+dev@gmail.com> |
1009 | +*/ |
1010 | + |
1011 | +#ifndef _AWN_BACKGROUND_LUCIDO_H |
1012 | +#define _AWN_BACKGROUND_LUCIDO_H |
1013 | + |
1014 | +#include <glib.h> |
1015 | +#include <glib-object.h> |
1016 | +#include <gtk/gtk.h> |
1017 | + |
1018 | +#include "awn-background-flat.h" |
1019 | + |
1020 | +G_BEGIN_DECLS |
1021 | + |
1022 | +#define AWN_TYPE_BACKGROUND_LUCIDO (awn_background_lucido_get_type()) |
1023 | + |
1024 | +#define AWN_BACKGROUND_LUCIDO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AWN_TYPE_BACKGROUND_LUCIDO, \ |
1025 | + AwnBackgroundLucido)) |
1026 | + |
1027 | +#define AWN_BACKGROUND_LUCIDO_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), AWN_BACKGROUND_LUCIDO, \ |
1028 | + AwnBackgroundLucidoClass)) |
1029 | + |
1030 | +#define AWN_IS_BACKGROUND_LUCIDO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AWN_TYPE_BACKGROUND_LUCIDO)) |
1031 | + |
1032 | +#define AWN_IS_BACKGROUND_LUCIDO_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((obj), \ |
1033 | + AWN_TYPE_BACKGROUND_LUCIDO)) |
1034 | + |
1035 | +#define AWN_BACKGROUND_LUCIDO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \ |
1036 | + AWN_TYPE_BACKGROUND_LUCIDO, AwnBackgroundLucidoClass)) |
1037 | + |
1038 | +typedef struct _AwnBackgroundLucido AwnBackgroundLucido; |
1039 | +typedef struct _AwnBackgroundLucidoClass AwnBackgroundLucidoClass; |
1040 | +typedef struct _AwnBackgroundLucidoPrivate AwnBackgroundLucidoPrivate; |
1041 | + |
1042 | +struct _AwnBackgroundLucido |
1043 | +{ |
1044 | + AwnBackgroundFlat parent; |
1045 | + AwnBackgroundLucidoPrivate *priv; |
1046 | +}; |
1047 | + |
1048 | +struct _AwnBackgroundLucidoClass |
1049 | +{ |
1050 | + AwnBackgroundFlatClass parent_class; |
1051 | +}; |
1052 | + |
1053 | +GType awn_background_lucido_get_type (void) G_GNUC_CONST; |
1054 | + |
1055 | +AwnBackground * awn_background_lucido_new (DesktopAgnosticConfigClient *client, |
1056 | + AwnPanel *panel); |
1057 | + |
1058 | +G_END_DECLS |
1059 | + |
1060 | +#endif /* _AWN_BACKGROUND_LUCIDO_H */ |
1061 | + |
1062 | |
1063 | === modified file 'src/awn-background.c' |
1064 | --- src/awn-background.c 2010-04-08 15:38:05 +0000 |
1065 | +++ src/awn-background.c 2010-05-30 13:41:34 +0000 |
1066 | @@ -58,7 +58,8 @@ |
1067 | PROP_CORNER_RADIUS, |
1068 | PROP_PANEL_ANGLE, |
1069 | PROP_CURVINESS, |
1070 | - PROP_CURVES_SYMEMETRY |
1071 | + PROP_CURVES_SYMEMETRY, |
1072 | + PROP_STRIPE_WIDTH |
1073 | }; |
1074 | |
1075 | enum |
1076 | @@ -90,6 +91,10 @@ |
1077 | GtkPositionType position, |
1078 | GdkRectangle *area); |
1079 | |
1080 | +static gboolean awn_background_get_needs_redraw (AwnBackground *bg, |
1081 | + GtkPositionType position, |
1082 | + GdkRectangle *area); |
1083 | + |
1084 | static AwnPathType awn_background_path_default (AwnBackground *bg, |
1085 | gfloat *offset_mod); |
1086 | |
1087 | @@ -186,6 +191,11 @@ |
1088 | object, "curves-symmetry", TRUE, |
1089 | DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK, |
1090 | NULL); |
1091 | + desktop_agnostic_config_client_bind (bg->client, |
1092 | + AWN_GROUP_THEME, AWN_THEME_STRIPE_WIDTH, |
1093 | + object, "stripe-width", TRUE, |
1094 | + DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK, |
1095 | + NULL); |
1096 | } |
1097 | |
1098 | static void |
1099 | @@ -342,12 +352,21 @@ |
1100 | case PROP_CURVES_SYMEMETRY: |
1101 | bg->curves_symmetry = g_value_get_float (value); |
1102 | break; |
1103 | + case PROP_STRIPE_WIDTH: |
1104 | + bg->stripe_width = g_value_get_float (value); |
1105 | + break; |
1106 | |
1107 | default: |
1108 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
1109 | return; |
1110 | } |
1111 | |
1112 | + AwnBackgroundClass *klass; |
1113 | + klass = AWN_BACKGROUND_GET_CLASS (bg); |
1114 | + if (klass->property_changed != NULL) |
1115 | + klass->property_changed (bg, prop_id); |
1116 | + |
1117 | + awn_background_invalidate (bg); |
1118 | g_signal_emit (object, _bg_signals[CHANGED], 0); |
1119 | } |
1120 | |
1121 | @@ -380,6 +399,12 @@ |
1122 | if (bg->hilight_color) g_object_unref (bg->hilight_color); |
1123 | if (bg->sep_color) g_object_unref (bg->sep_color); |
1124 | |
1125 | + if (bg->helper_surface != NULL) |
1126 | + { |
1127 | + cairo_surface_finish (bg->helper_surface); |
1128 | + cairo_surface_destroy (bg->helper_surface); |
1129 | + } |
1130 | + |
1131 | G_OBJECT_CLASS (awn_background_parent_class)->finalize (object); |
1132 | } |
1133 | |
1134 | @@ -398,6 +423,8 @@ |
1135 | klass->get_input_shape_mask = awn_background_mask_none; |
1136 | klass->get_path_type = awn_background_path_default; |
1137 | klass->get_strut_offsets = NULL; |
1138 | + klass->get_needs_redraw = awn_background_get_needs_redraw; |
1139 | + klass->property_changed = NULL; |
1140 | |
1141 | /* Object properties */ |
1142 | g_object_class_install_property (obj_class, |
1143 | @@ -575,6 +602,15 @@ |
1144 | 0.0, 1.0, 0.5, |
1145 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT | |
1146 | G_PARAM_STATIC_STRINGS)); |
1147 | + |
1148 | + g_object_class_install_property (obj_class, |
1149 | + PROP_STRIPE_WIDTH, |
1150 | + g_param_spec_float ("stripe-width", |
1151 | + "Stripe Width", |
1152 | + "The width of the stripe", |
1153 | + 0.0, 1.0, 0.0, |
1154 | + G_PARAM_READWRITE | G_PARAM_CONSTRUCT | |
1155 | + G_PARAM_STATIC_STRINGS)); |
1156 | |
1157 | /* Add signals to the class */ |
1158 | _bg_signals[CHANGED] = |
1159 | @@ -650,6 +686,11 @@ |
1160 | bg->border_color = NULL; |
1161 | bg->hilight_color = NULL; |
1162 | bg->sep_color = NULL; |
1163 | + bg->needs_redraw = TRUE; |
1164 | + bg->helper_surface = NULL; |
1165 | + bg->cache_enabled = TRUE; |
1166 | + bg->last_height = 0; |
1167 | + bg->last_width = 0; |
1168 | } |
1169 | |
1170 | void |
1171 | @@ -664,8 +705,40 @@ |
1172 | |
1173 | klass = AWN_BACKGROUND_GET_CLASS (bg); |
1174 | g_return_if_fail (klass->draw != NULL); |
1175 | - |
1176 | - klass->draw (bg, cr, position, area); |
1177 | + |
1178 | + /* Check if background caching is enabled - TRUE by default */ |
1179 | + if (bg->cache_enabled) |
1180 | + { |
1181 | + g_return_if_fail (klass->get_needs_redraw != NULL); |
1182 | + cairo_save (cr); |
1183 | + |
1184 | + /* Check if background needs to be redrawn */ |
1185 | + if (klass->get_needs_redraw (bg, position, area)) |
1186 | + { |
1187 | + /* Free last surface */ |
1188 | + if (bg->helper_surface != NULL) |
1189 | + { |
1190 | + cairo_surface_finish (bg->helper_surface); |
1191 | + cairo_surface_destroy (bg->helper_surface); |
1192 | + } |
1193 | + /* Create new surface */ |
1194 | + bg->helper_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, |
1195 | + area->x + area->width, |
1196 | + area->y + area->height); |
1197 | + cairo_t* temp_cr = cairo_create (bg->helper_surface); |
1198 | + /* Draw background on temp cairo_t */ |
1199 | + klass->draw (bg, temp_cr, position, area); |
1200 | + cairo_destroy (temp_cr); |
1201 | + } |
1202 | + /* Paint saved surface */ |
1203 | + cairo_set_source_surface (cr, bg->helper_surface, 0., 0.); |
1204 | + cairo_paint(cr); |
1205 | + cairo_restore (cr); |
1206 | + } |
1207 | + else |
1208 | + { |
1209 | + klass->draw (bg, cr, position, area); |
1210 | + } |
1211 | } |
1212 | |
1213 | void |
1214 | @@ -1009,4 +1082,25 @@ |
1215 | return AWN_PATH_LINEAR; |
1216 | } |
1217 | |
1218 | +static gboolean awn_background_get_needs_redraw (AwnBackground *bg, |
1219 | + GtkPositionType position, |
1220 | + GdkRectangle *area) |
1221 | +{ |
1222 | + if (bg->needs_redraw == 1 || |
1223 | + bg->last_height != area->height || |
1224 | + bg->last_width != area->width) |
1225 | + { |
1226 | + bg->needs_redraw = 0; |
1227 | + bg->last_height = area->height; |
1228 | + bg->last_width = area->width; |
1229 | + return TRUE; |
1230 | + } |
1231 | + return FALSE; |
1232 | +} |
1233 | + |
1234 | +void awn_background_invalidate (AwnBackground *bg) |
1235 | +{ |
1236 | + bg->needs_redraw = 1; |
1237 | +} |
1238 | + |
1239 | /* vim: set et ts=2 sts=2 sw=2 : */ |
1240 | |
1241 | === modified file 'src/awn-background.h' |
1242 | --- src/awn-background.h 2010-03-07 18:38:07 +0000 |
1243 | +++ src/awn-background.h 2010-05-30 13:41:34 +0000 |
1244 | @@ -76,6 +76,15 @@ |
1245 | gfloat pattern_alpha; |
1246 | GdkPixbuf *pattern_original; |
1247 | cairo_surface_t *pattern; |
1248 | + |
1249 | + /* Speedup code. |
1250 | + * We can save the bg and redraw only when properties changes |
1251 | + */ |
1252 | + gboolean cache_enabled; |
1253 | + gboolean needs_redraw; |
1254 | + cairo_surface_t* helper_surface; |
1255 | + gint last_height; |
1256 | + gint last_width; |
1257 | |
1258 | /* FIXME: |
1259 | * These two should ultimately go somewhere else (once we do multiple panels) |
1260 | @@ -89,6 +98,7 @@ |
1261 | gint panel_angle; |
1262 | gfloat curviness; |
1263 | gfloat curves_symmetry; |
1264 | + gfloat stripe_width; |
1265 | |
1266 | /* private */ |
1267 | guint changed; |
1268 | @@ -129,6 +139,13 @@ |
1269 | GdkRectangle *area, |
1270 | gint *strut, |
1271 | gint *strut_start, gint *strut_end); |
1272 | + |
1273 | + gboolean (*get_needs_redraw) (AwnBackground *bg, |
1274 | + GtkPositionType position, |
1275 | + GdkRectangle *area); |
1276 | + |
1277 | + void (*property_changed) (AwnBackground *bg, |
1278 | + guint prop_id); |
1279 | |
1280 | /*< signals >*/ |
1281 | void (*changed) (AwnBackground *bg); |
1282 | @@ -142,6 +159,8 @@ |
1283 | GtkPositionType position, |
1284 | GdkRectangle *area); |
1285 | |
1286 | +void awn_background_invalidate (AwnBackground *bg); |
1287 | + |
1288 | void awn_background_padding_request (AwnBackground *bg, |
1289 | GtkPositionType position, |
1290 | guint *padding_top, |
1291 | |
1292 | === modified file 'src/awn-defines.h' |
1293 | --- src/awn-defines.h 2010-02-06 13:34:02 +0000 |
1294 | +++ src/awn-defines.h 2010-05-30 13:41:34 +0000 |
1295 | @@ -87,6 +87,7 @@ |
1296 | #define AWN_THEME_PANEL_ANGLE "panel_angle" |
1297 | #define AWN_THEME_CURVINESS "curviness" |
1298 | #define AWN_THEME_CURVES_SYMMETRY "curves_symmetry" |
1299 | +#define AWN_THEME_STRIPE_WIDTH "stripe_width" |
1300 | |
1301 | #endif /*_HAVE_AWN_DEFINES_H */ |
1302 | |
1303 | |
1304 | === modified file 'src/awn-panel.c' |
1305 | --- src/awn-panel.c 2010-05-29 17:17:22 +0000 |
1306 | +++ src/awn-panel.c 2010-05-30 13:41:34 +0000 |
1307 | @@ -43,6 +43,7 @@ |
1308 | #include "awn-background-3d.h" |
1309 | #include "awn-background-curves.h" |
1310 | #include "awn-background-edgy.h" |
1311 | +#include "awn-background-lucido.h" |
1312 | #include "awn-background-floaty.h" |
1313 | #include "awn-defines.h" |
1314 | #include "awn-marshal.h" |
1315 | @@ -222,6 +223,7 @@ |
1316 | STYLE_EDGY, |
1317 | STYLE_FLOATY, |
1318 | |
1319 | + STYLE_LUCIDO, |
1320 | STYLE_LAST |
1321 | }; |
1322 | |
1323 | @@ -1075,6 +1077,9 @@ |
1324 | } |
1325 | |
1326 | awn_panel_queue_masks_update (panel); |
1327 | + |
1328 | + if (priv->bg) |
1329 | + awn_background_invalidate (priv->bg); |
1330 | } |
1331 | |
1332 | static |
1333 | @@ -1126,6 +1131,12 @@ |
1334 | gtk_widget_queue_draw (GTK_WIDGET (panel)); |
1335 | } |
1336 | |
1337 | +static |
1338 | +void awn_panel_padding_changed (AwnPanel *panel) |
1339 | +{ |
1340 | + awn_panel_refresh_padding (panel, NULL); |
1341 | +} |
1342 | + |
1343 | #ifdef DEBUG_APPLET_AREA |
1344 | static |
1345 | void awn_panel_get_applet_rect (AwnPanel *panel, |
1346 | @@ -1760,6 +1771,8 @@ |
1347 | obj_class->finalize = awn_panel_finalize; |
1348 | obj_class->get_property = awn_panel_get_property; |
1349 | obj_class->set_property = awn_panel_set_property; |
1350 | + |
1351 | + klass->padding_changed = awn_panel_padding_changed; |
1352 | |
1353 | cont_class->add = awn_panel_add; |
1354 | |
1355 | @@ -3179,6 +3192,9 @@ |
1356 | case STYLE_EDGY: |
1357 | priv->bg = awn_background_edgy_new (priv->client, panel); |
1358 | break; |
1359 | + case STYLE_LUCIDO: |
1360 | + priv->bg = awn_background_lucido_new (priv->client, panel); |
1361 | + break; |
1362 | case STYLE_FLOATY: |
1363 | priv->bg = awn_background_floaty_new (priv->client, panel); |
1364 | break; |
1365 | |
1366 | === modified file 'src/awn-panel.h' |
1367 | --- src/awn-panel.h 2010-01-01 12:50:38 +0000 |
1368 | +++ src/awn-panel.h 2010-05-30 13:41:34 +0000 |
1369 | @@ -70,6 +70,7 @@ |
1370 | void (*offset_changed) (AwnPanel *panel, gint offset); |
1371 | void (*property_changed) (AwnPanel *panel, |
1372 | const gchar *prop_name, GValue *value); |
1373 | + void (*padding_changed) (AwnPanel *panel); |
1374 | void (*destroy_notify) (AwnPanel *panel); |
1375 | void (*destroy_applet) (AwnPanel *panel, const gchar *uid); |
1376 |
WTF!!!
Why BZR removes 'po/avant- window- navigator. pot' if i've never touched that file?????