Do

Merge lp:~psybers/do/intellifade into lp:do

Proposed by Robert Dyer
Status: Merged
Merge reported by: Chris Halse Rogers
Merged at revision: not available
Proposed branch: lp:~psybers/do/intellifade
Merge into: lp:do
Diff against target: 187 lines
6 files modified
Do.Interface.Linux.Docky/src/Docky.Interface/DockArea.cs (+1/-0)
Do.Interface.Linux.Docky/src/Docky.Interface/DockArea_Rendering.cs (+18/-6)
Do.Interface.Linux.Docky/src/Docky.Interface/Docky.Interface.Painters/DockBackgroundRenderer.cs (+7/-5)
Do.Interface.Linux.Docky/src/Docky.Interface/DockyConfigurationWidget.cs (+1/-0)
Do.Interface.Linux.Docky/src/Docky.Utilities/AutohideType.cs (+1/-0)
Do.Interface.Linux.Docky/src/Docky.Utilities/DockPreferences.cs (+21/-0)
To merge this branch: bzr merge lp:~psybers/do/intellifade
Reviewer Review Type Date Requested Status
Chris Halse Rogers Pending
Review via email: mp+11857@code.launchpad.net

This proposal supersedes a proposal from 2009-09-16.

To post a comment you must log in.
Revision history for this message
Robert Dyer (psybers) wrote : Posted in a previous version of this proposal

Adds 'Intellifade' as another hide option. This is pretty similar to Intellihide, but instead of sliding off screen it fades the dock to a certain opacity (0.4 default). That opacity is gconf configurable, allowing people to mimic the old AllowWindowOverlap behavior (opacity 1) or to truly mimic Intellihide but with only a different animation (opacity 0).

It also adds new functionality in that you can allow the dock to remain visible, but faded when not active. Thus I can still see my clock/weather/etc but it's faded enough to not get in my way too! =)

lp:~psybers/do/intellifade updated
1312. By Robert Dyer <rdyer@narmada>

merge trunk

Revision history for this message
Chris Halse Rogers (raof) wrote :

Merged, ages ago, into Docky

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Do.Interface.Linux.Docky/src/Docky.Interface/DockArea.cs'
2--- Do.Interface.Linux.Docky/src/Docky.Interface/DockArea.cs 2009-08-19 07:43:04 +0000
3+++ Do.Interface.Linux.Docky/src/Docky.Interface/DockArea.cs 2009-10-05 18:36:14 +0000
4@@ -537,6 +537,7 @@
5 showhide_time = enter_time;
6 break;
7 case AutohideType.Intellihide:
8+ case AutohideType.Intellifade:
9 if (WindowIntersectingOther)
10 showhide_time = enter_time;
11 break;
12
13=== modified file 'Do.Interface.Linux.Docky/src/Docky.Interface/DockArea_Rendering.cs'
14--- Do.Interface.Linux.Docky/src/Docky.Interface/DockArea_Rendering.cs 2009-08-31 01:35:40 +0000
15+++ Do.Interface.Linux.Docky/src/Docky.Interface/DockArea_Rendering.cs 2009-10-05 18:36:14 +0000
16@@ -142,6 +142,18 @@
17 }
18 }
19
20+ double DockOpacity {
21+ get {
22+ if (PainterOverlayVisible)
23+ return 1;
24+ double opacity = (RenderTime - showhide_time).TotalMilliseconds / SummonTime.TotalMilliseconds *
25+ (1 - DockPreferences.IntellifadeOpacity);
26+ if (CursorIsOverDockArea || !WindowIntersectingOther)
27+ return Math.Min (1, DockPreferences.IntellifadeOpacity + opacity);
28+ return Math.Max (DockPreferences.IntellifadeOpacity, 1 - opacity);
29+ }
30+ }
31+
32 //// <value>
33 /// Get autohide state
34 /// </value>
35@@ -208,7 +220,7 @@
36 get {
37 double offset = 0;
38 // we never hide in these conditions
39- if (DockPreferences.AutohideType == AutohideType.None || DnDTracker.DragResizing || PainterOpacity == 1) {
40+ if (DockPreferences.AutohideType == AutohideType.None || DockPreferences.AutohideType == AutohideType.Intellifade || DnDTracker.DragResizing || PainterOpacity == 1) {
41 if ((RenderTime - FirstRenderTime) > SummonTime)
42 return 0;
43 offset = 1 - Math.Min (1, (DateTime.UtcNow - FirstRenderTime).TotalMilliseconds / SummonTime.TotalMilliseconds);
44@@ -286,7 +298,8 @@
45
46 void HandleIntersectionChanged (object sender, EventArgs e)
47 {
48- if (DockPreferences.AutohideType == AutohideType.Intellihide && !CursorIsOverDockArea) {
49+ if ((DockPreferences.AutohideType == AutohideType.Intellifade ||
50+ DockPreferences.AutohideType == AutohideType.Intellihide) && !CursorIsOverDockArea) {
51 showhide_time = UpdateTimeStamp (showhide_time, SummonTime);
52 AnimatedDraw ();
53 }
54@@ -296,8 +309,7 @@
55 {
56 Gdk.Rectangle dockArea = GetDockArea ();
57 window.SetBackgroundBlur (dockArea);
58-
59- DockBackgroundRenderer.RenderDockBackground (cr, dockArea);
60+ DockBackgroundRenderer.RenderDockBackground (cr, dockArea, DockOpacity);
61
62 IDockPainter dpaint = (Painter == null) ? LastPainter : Painter;
63
64@@ -311,7 +323,7 @@
65 }
66
67 cr.SetSource (overlay_surface);
68- cr.PaintWithAlpha (PainterOpacity);
69+ cr.PaintWithAlpha (PainterOpacity * DockOpacity);
70 }
71
72 bool isNotSummonTransition = PainterOpacity == 0 || !IsHidden || !DockPreferences.AutoHide;
73@@ -326,7 +338,7 @@
74 int offset = (int) (IconSize * (1 - DockIconOpacity));
75 Gdk.Point iconBufferLocation = new Gdk.Point (0, 0).RelativeMovePoint (offset, RelativeMove.Outward);
76 cr.SetSource (dock_icon_buffer, iconBufferLocation.X, iconBufferLocation.Y);
77- cr.PaintWithAlpha (DockIconOpacity);
78+ cr.PaintWithAlpha (DockIconOpacity * DockOpacity);
79 }
80 }
81
82
83=== modified file 'Do.Interface.Linux.Docky/src/Docky.Interface/Docky.Interface.Painters/DockBackgroundRenderer.cs'
84--- Do.Interface.Linux.Docky/src/Docky.Interface/Docky.Interface.Painters/DockBackgroundRenderer.cs 2009-05-01 16:09:04 +0000
85+++ Do.Interface.Linux.Docky/src/Docky.Interface/Docky.Interface.Painters/DockBackgroundRenderer.cs 2009-10-05 18:36:14 +0000
86@@ -34,32 +34,34 @@
87 {
88 static Surface sr;
89 static int height;
90+ static double oldAlpha;
91
92 const int width = 1500;
93
94- public static void RenderDockBackground (Context context, Gdk.Rectangle dockArea)
95+ public static void RenderDockBackground (Context context, Gdk.Rectangle dockArea, double alpha)
96 {
97- if (sr == null || dockArea.Height != height) {
98+ if (sr == null || dockArea.Height != height || alpha != oldAlpha) {
99
100 if (sr != null)
101 sr.Destroy ();
102
103 height = dockArea.Height;
104+ oldAlpha = alpha;
105 sr = context.Target.CreateSimilar (context.Target.Content, width, dockArea.Height);
106
107 using (Context cr = new Context (sr)) {
108 cr.SetRoundedRectanglePath (.5, .5, width - 1, height + 40, 5); // fall off the bottom
109- cr.Color = new Cairo.Color (0.1, 0.1, 0.1, .75);
110+ cr.Color = new Cairo.Color (0.1, 0.1, 0.1, .75 * alpha);
111 cr.FillPreserve ();
112
113 // gives the dock a "lifted" look and feel
114- cr.Color = new Cairo.Color (0, 0, 0, .6);
115+ cr.Color = new Cairo.Color (0, 0, 0, .6 * alpha);
116 cr.LineWidth = 1;
117 cr.Stroke ();
118
119 cr.SetRoundedRectanglePath (1.5, 1.5, width - 3, height + 40, 5);
120 LinearGradient lg = new LinearGradient (0, 1.5, 0, 10);
121- lg.AddColorStop (0, new Cairo.Color (1, 1, 1, .4));
122+ lg.AddColorStop (0, new Cairo.Color (1, 1, 1, .4 * alpha));
123 lg.AddColorStop (1, new Cairo.Color (1, 1, 1, 0));
124 cr.Pattern = lg;
125 cr.LineWidth = 1;
126
127=== modified file 'Do.Interface.Linux.Docky/src/Docky.Interface/DockyConfigurationWidget.cs'
128--- Do.Interface.Linux.Docky/src/Docky.Interface/DockyConfigurationWidget.cs 2009-06-19 04:30:03 +0000
129+++ Do.Interface.Linux.Docky/src/Docky.Interface/DockyConfigurationWidget.cs 2009-10-05 18:36:14 +0000
130@@ -95,6 +95,7 @@
131 autohide_combo.AppendText (((AutohideType) 0).ToString ());
132 autohide_combo.AppendText (((AutohideType) 1).ToString ());
133 autohide_combo.AppendText (((AutohideType) 2).ToString ());
134+ autohide_combo.AppendText (((AutohideType) 3).ToString ());
135 autohide_combo.Active = (int) DockPreferences.AutohideType;
136
137 BuildDocklets ();
138
139=== modified file 'Do.Interface.Linux.Docky/src/Docky.Utilities/AutohideType.cs'
140--- Do.Interface.Linux.Docky/src/Docky.Utilities/AutohideType.cs 2009-04-27 20:42:27 +0000
141+++ Do.Interface.Linux.Docky/src/Docky.Utilities/AutohideType.cs 2009-10-05 18:36:14 +0000
142@@ -26,5 +26,6 @@
143 None = 0,
144 Autohide,
145 Intellihide,
146+ Intellifade,
147 }
148 }
149
150=== modified file 'Do.Interface.Linux.Docky/src/Docky.Utilities/DockPreferences.cs'
151--- Do.Interface.Linux.Docky/src/Docky.Utilities/DockPreferences.cs 2009-08-28 06:46:50 +0000
152+++ Do.Interface.Linux.Docky/src/Docky.Utilities/DockPreferences.cs 2009-10-05 18:36:14 +0000
153@@ -68,6 +68,8 @@
154 SetZoomEnabled ((bool)e.Value);
155 if (e.Key == "IconSize")
156 SetIconSize ((int)e.Value);
157+ if (e.Key == "IntellifadeOpacity")
158+ SetIntellifadeOpacity ((double)e.Value);
159 if (e.Key == "SummonTime")
160 SetSummonTime (new TimeSpan (0, 0, 0, 0, (int)e.Value));
161 if (e.Key == "AutomaticIcons")
162@@ -188,6 +190,25 @@
163 get { return ZoomPercent; }
164 }
165
166+ static double intellifade_opacity = prefs.Get ("IntellifadeOpacity", 0.4);
167+ public static double IntellifadeOpacity {
168+ get { return intellifade_opacity; }
169+ set {
170+ if (SetIntellifadeOpacity (value))
171+ prefs.Set ("IntellifadeOpacity", value);
172+ }
173+ }
174+ static bool SetIntellifadeOpacity (double val)
175+ {
176+ if (val < 0)
177+ val = 0;
178+ if (val > 1)
179+ val = 1;
180+ if (intellifade_opacity == val) return false;
181+ intellifade_opacity = val;
182+ return true;
183+ }
184+
185 public static bool AutoHide {
186 get { return AutohideType != AutohideType.None; }
187 }