Merge lp://staging/~jassmith/do/intellihide into lp://staging/do
- intellihide
- Merge into trunk
Proposed by
Jason Smith
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp://staging/~jassmith/do/intellihide |
Merge into: | lp://staging/do |
Diff against target: | None lines |
To merge this branch: | bzr merge lp://staging/~jassmith/do/intellihide |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Do Core Team | Pending | ||
Review via email: mp+5947@code.staging.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Jason Smith (jassmith) wrote : | # |
- 1122. By Jason Smith
-
Handle window detection on a reconfigure properly
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'Do.Interface.Linux.Docky/Do.Interface.Linux.Docky.mdp' |
2 | --- Do.Interface.Linux.Docky/Do.Interface.Linux.Docky.mdp 2009-04-20 04:49:28 +0000 |
3 | +++ Do.Interface.Linux.Docky/Do.Interface.Linux.Docky.mdp 2009-04-27 20:42:27 +0000 |
4 | @@ -90,6 +90,7 @@ |
5 | <File name="gtk-gui/generated.cs" subtype="Code" buildaction="Compile" /> |
6 | <File name="src/Docky.Interface/DockyConfigurationWidget.cs" subtype="Code" buildaction="Compile" /> |
7 | <File name="gtk-gui/Docky.Interface.DockyConfigurationWidget.cs" subtype="Code" buildaction="Compile" /> |
8 | + <File name="src/Docky.Utilities/AutohideType.cs" subtype="Code" buildaction="Compile" /> |
9 | </Contents> |
10 | <References> |
11 | <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> |
12 | |
13 | === modified file 'Do.Interface.Linux.Docky/Makefile.am' |
14 | --- Do.Interface.Linux.Docky/Makefile.am 2009-04-20 04:49:28 +0000 |
15 | +++ Do.Interface.Linux.Docky/Makefile.am 2009-04-27 20:42:27 +0000 |
16 | @@ -68,6 +68,7 @@ |
17 | src/Docky.Interface/TextRenderContext.cs \ |
18 | src/Docky.Interface/UpdateRequestArgs.cs \ |
19 | src/Docky.Interface/Util.cs \ |
20 | + src/Docky.Utilities/AutohideType.cs \ |
21 | src/Docky.Utilities/DockOrientation.cs \ |
22 | src/Docky.Utilities/DockPreferences.cs \ |
23 | src/Docky.Utilities/GtkUtils.cs |
24 | |
25 | === modified file 'Do.Interface.Linux.Docky/gtk-gui/Docky.Interface.DockyConfigurationWidget.cs' |
26 | --- Do.Interface.Linux.Docky/gtk-gui/Docky.Interface.DockyConfigurationWidget.cs 2009-04-21 02:15:39 +0000 |
27 | +++ Do.Interface.Linux.Docky/gtk-gui/Docky.Interface.DockyConfigurationWidget.cs 2009-04-27 20:42:27 +0000 |
28 | @@ -23,9 +23,9 @@ |
29 | |
30 | private Gtk.HBox hbox8; |
31 | |
32 | - private Gtk.CheckButton autohide_checkbutton; |
33 | + private Gtk.Label orientation_label1; |
34 | |
35 | - private Gtk.CheckButton window_overlap_checkbutton; |
36 | + private Gtk.ComboBox autohide_combo; |
37 | |
38 | private Gtk.HBox hbox9; |
39 | |
40 | @@ -87,28 +87,24 @@ |
41 | // Container child vbox2.Gtk.Box+BoxChild |
42 | this.hbox8 = new Gtk.HBox(); |
43 | this.hbox8.Name = "hbox8"; |
44 | - this.hbox8.Homogeneous = true; |
45 | this.hbox8.Spacing = 6; |
46 | // Container child hbox8.Gtk.Box+BoxChild |
47 | - this.autohide_checkbutton = new Gtk.CheckButton(); |
48 | - this.autohide_checkbutton.CanFocus = true; |
49 | - this.autohide_checkbutton.Name = "autohide_checkbutton"; |
50 | - this.autohide_checkbutton.Label = Mono.Unix.Catalog.GetString("Automatically Hide"); |
51 | - this.autohide_checkbutton.DrawIndicator = true; |
52 | - this.autohide_checkbutton.UseUnderline = true; |
53 | - this.hbox8.Add(this.autohide_checkbutton); |
54 | - Gtk.Box.BoxChild w4 = ((Gtk.Box.BoxChild)(this.hbox8[this.autohide_checkbutton])); |
55 | + this.orientation_label1 = new Gtk.Label(); |
56 | + this.orientation_label1.Name = "orientation_label1"; |
57 | + this.orientation_label1.LabelProp = Mono.Unix.Catalog.GetString("Automatic Hiding:"); |
58 | + this.hbox8.Add(this.orientation_label1); |
59 | + Gtk.Box.BoxChild w4 = ((Gtk.Box.BoxChild)(this.hbox8[this.orientation_label1])); |
60 | w4.Position = 0; |
61 | + w4.Expand = false; |
62 | + w4.Fill = false; |
63 | // Container child hbox8.Gtk.Box+BoxChild |
64 | - this.window_overlap_checkbutton = new Gtk.CheckButton(); |
65 | - this.window_overlap_checkbutton.CanFocus = true; |
66 | - this.window_overlap_checkbutton.Name = "window_overlap_checkbutton"; |
67 | - this.window_overlap_checkbutton.Label = Mono.Unix.Catalog.GetString("Allow Window Overlap"); |
68 | - this.window_overlap_checkbutton.DrawIndicator = true; |
69 | - this.window_overlap_checkbutton.UseUnderline = true; |
70 | - this.hbox8.Add(this.window_overlap_checkbutton); |
71 | - Gtk.Box.BoxChild w5 = ((Gtk.Box.BoxChild)(this.hbox8[this.window_overlap_checkbutton])); |
72 | + this.autohide_combo = Gtk.ComboBox.NewText(); |
73 | + this.autohide_combo.Name = "autohide_combo"; |
74 | + this.hbox8.Add(this.autohide_combo); |
75 | + Gtk.Box.BoxChild w5 = ((Gtk.Box.BoxChild)(this.hbox8[this.autohide_combo])); |
76 | w5.Position = 1; |
77 | + w5.Expand = false; |
78 | + w5.Fill = false; |
79 | this.vbox2.Add(this.hbox8); |
80 | Gtk.Box.BoxChild w6 = ((Gtk.Box.BoxChild)(this.vbox2[this.hbox8])); |
81 | w6.Position = 1; |
82 | @@ -239,8 +235,7 @@ |
83 | } |
84 | this.Hide(); |
85 | this.orientation_combobox.Changed += new System.EventHandler(this.OnOrientationComboboxChanged); |
86 | - this.autohide_checkbutton.Toggled += new System.EventHandler(this.OnAutohideCheckbuttonToggled); |
87 | - this.window_overlap_checkbutton.Toggled += new System.EventHandler(this.OnWindowOverlapCheckbuttonToggled); |
88 | + this.autohide_combo.Changed += new System.EventHandler(this.OnAutohideComboChanged); |
89 | this.zoom_checkbutton.Toggled += new System.EventHandler(this.OnZoomCheckbuttonToggled); |
90 | this.advanced_indicators_checkbutton.Toggled += new System.EventHandler(this.OnAdvancedIndicatorsCheckbuttonToggled); |
91 | this.zoom_scale.FormatValue += new Gtk.FormatValueHandler(this.OnZoomScaleFormatValue); |
92 | |
93 | === modified file 'Do.Interface.Linux.Docky/gtk-gui/gui.stetic' |
94 | --- Do.Interface.Linux.Docky/gtk-gui/gui.stetic 2009-04-21 02:15:39 +0000 |
95 | +++ Do.Interface.Linux.Docky/gtk-gui/gui.stetic 2009-04-27 20:42:27 +0000 |
96 | @@ -9,9 +9,9 @@ |
97 | <widget-library name="../../Do.Interface.Linux/bin/Debug/Do.Interface.Linux.dll" /> |
98 | <widget-library name="gnomedesktop-sharp, Version=2.20.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> |
99 | <widget-library name="../../Do.Interface.Wink/bin/Debug/Do.Interface.Wnck.dll" /> |
100 | - <widget-library name="../bin/Debug/Do.Interface.Linux.Docky.dll" internal="true" /> |
101 | <widget-library name="../../Do.Platform.Linux/bin/Debug/Do.Platform.Linux.dll" /> |
102 | <widget-library name="../../Do.Interface.Linux.AnimationBase/bin/Debug/Do.Interface.Linux.AnimationBase.dll" /> |
103 | + <widget-library name="../bin/Debug/Do.Interface.Linux.Docky.dll" internal="true" /> |
104 | </import> |
105 | <widget class="Gtk.Bin" id="Docky.Interface.DockyConfigurationWidget" design-size="376 347"> |
106 | <property name="MemberName" /> |
107 | @@ -61,36 +61,31 @@ |
108 | <child> |
109 | <widget class="Gtk.HBox" id="hbox8"> |
110 | <property name="MemberName" /> |
111 | - <property name="Homogeneous">True</property> |
112 | <property name="Spacing">6</property> |
113 | <child> |
114 | - <widget class="Gtk.CheckButton" id="autohide_checkbutton"> |
115 | + <widget class="Gtk.Label" id="orientation_label1"> |
116 | <property name="MemberName" /> |
117 | - <property name="CanFocus">True</property> |
118 | - <property name="Label" translatable="yes">Automatically Hide</property> |
119 | - <property name="DrawIndicator">True</property> |
120 | - <property name="HasLabel">True</property> |
121 | - <property name="UseUnderline">True</property> |
122 | - <signal name="Toggled" handler="OnAutohideCheckbuttonToggled" /> |
123 | + <property name="LabelProp" translatable="yes">Automatic Hiding:</property> |
124 | </widget> |
125 | <packing> |
126 | <property name="Position">0</property> |
127 | <property name="AutoSize">True</property> |
128 | + <property name="Expand">False</property> |
129 | + <property name="Fill">False</property> |
130 | </packing> |
131 | </child> |
132 | <child> |
133 | - <widget class="Gtk.CheckButton" id="window_overlap_checkbutton"> |
134 | + <widget class="Gtk.ComboBox" id="autohide_combo"> |
135 | <property name="MemberName" /> |
136 | - <property name="CanFocus">True</property> |
137 | - <property name="Label" translatable="yes">Allow Window Overlap</property> |
138 | - <property name="DrawIndicator">True</property> |
139 | - <property name="HasLabel">True</property> |
140 | - <property name="UseUnderline">True</property> |
141 | - <signal name="Toggled" handler="OnWindowOverlapCheckbuttonToggled" /> |
142 | + <property name="IsTextCombo">True</property> |
143 | + <property name="Items" translatable="yes" /> |
144 | + <signal name="Changed" handler="OnAutohideComboChanged" /> |
145 | </widget> |
146 | <packing> |
147 | <property name="Position">1</property> |
148 | <property name="AutoSize">True</property> |
149 | + <property name="Expand">False</property> |
150 | + <property name="Fill">False</property> |
151 | </packing> |
152 | </child> |
153 | </widget> |
154 | |
155 | === modified file 'Do.Interface.Linux.Docky/src/Docky.Interface/DockAnimationState.cs' |
156 | --- Do.Interface.Linux.Docky/src/Docky.Interface/DockAnimationState.cs 2009-03-02 05:26:10 +0000 |
157 | +++ Do.Interface.Linux.Docky/src/Docky.Interface/DockAnimationState.cs 2009-04-27 20:42:27 +0000 |
158 | @@ -34,6 +34,7 @@ |
159 | Zoom, |
160 | Bounce, |
161 | Painter, |
162 | + Summon, |
163 | IconInsert, |
164 | UrgencyChanged, |
165 | InputModeChanged, |
166 | |
167 | === modified file 'Do.Interface.Linux.Docky/src/Docky.Interface/DockArea.cs' |
168 | --- Do.Interface.Linux.Docky/src/Docky.Interface/DockArea.cs 2009-04-26 21:00:06 +0000 |
169 | +++ Do.Interface.Linux.Docky/src/Docky.Interface/DockArea.cs 2009-04-27 20:42:27 +0000 |
170 | @@ -26,6 +26,7 @@ |
171 | using Gtk; |
172 | |
173 | using Do.Platform; |
174 | +using Do.Interface.Wink; |
175 | using Do.Interface.Xlib; |
176 | |
177 | using Docky.Core; |
178 | @@ -57,6 +58,7 @@ |
179 | DateTime interface_change_time = new DateTime (0); |
180 | DateTime last_draw_timeout = new DateTime (0); |
181 | DateTime cursor_update = new DateTime (0); |
182 | + DateTime showhide_time = new DateTime (0); |
183 | |
184 | bool disposed; |
185 | |
186 | @@ -98,7 +100,7 @@ |
187 | uint[] values = new uint[12]; |
188 | Gdk.Rectangle geo = LayoutUtils.MonitorGemonetry (); |
189 | |
190 | - if (DockPreferences.AutoHide || DockPreferences.AllowOverlap) |
191 | + if (DockPreferences.AutohideType != AutohideType.None) |
192 | return values; |
193 | |
194 | switch (DockPreferences.Orientation) { |
195 | @@ -168,7 +170,7 @@ |
196 | dockRegion.Inflate (0, (int) (IconSize * (DockPreferences.ZoomPercent - 1)) + 22); |
197 | CursorIsOverDockArea = dockRegion.Contains (cursor); |
198 | } else { |
199 | - if (DockPreferences.AutoHide) { |
200 | + if (Hidden) { |
201 | switch (DockPreferences.Orientation) { |
202 | case DockOrientation.Bottom: |
203 | dockRegion.Y += dockRegion.Height - 1; |
204 | @@ -183,11 +185,21 @@ |
205 | CursorIsOverDockArea = dockRegion.Contains (cursor); |
206 | } |
207 | |
208 | + bool codChange = CursorIsOverDockArea != cursorIsOverDockArea; |
209 | // When we change over this boundry, it will normally trigger an animation, we need to be sure to catch it |
210 | - if (CursorIsOverDockArea != cursorIsOverDockArea) { |
211 | + if (codChange) { |
212 | ResetCursorTimer (); |
213 | enter_time = DateTime.UtcNow; |
214 | AnimatedDraw (); |
215 | + switch (DockPreferences.AutohideType) { |
216 | + case AutohideType.Autohide: |
217 | + showhide_time = enter_time; |
218 | + break; |
219 | + case AutohideType.Intellihide: |
220 | + if (WindowIntersectingOther) |
221 | + showhide_time = enter_time; |
222 | + break; |
223 | + } |
224 | } |
225 | |
226 | DragCursorUpdate (); |
227 | @@ -200,6 +212,20 @@ |
228 | } |
229 | } |
230 | |
231 | + IEnumerable<Gdk.Window> WindowStack { |
232 | + get { |
233 | + try { |
234 | + return Screen.WindowStack; |
235 | + } catch { |
236 | + try { |
237 | + return Wnck.Screen.Default.WindowsStacked.Select (wnk => Gdk.Window.ForeignNew ((uint) wnk.Xid)); |
238 | + } catch { |
239 | + return null; |
240 | + } |
241 | + } |
242 | + } |
243 | + } |
244 | + |
245 | public DockArea (DockWindow window) : base () |
246 | { |
247 | this.window = window; |
248 | @@ -317,7 +343,8 @@ |
249 | () => DockItems.Any (di => DateTime.UtcNow - di.AttentionRequestStartTime < BounceTime)); |
250 | |
251 | AnimationState.AddCondition (Animations.InputModeChanged, |
252 | - () => DateTime.UtcNow - interface_change_time < SummonTime); |
253 | + () => DateTime.UtcNow - interface_change_time < SummonTime || |
254 | + DateTime.UtcNow - showhide_time < SummonTime); |
255 | } |
256 | |
257 | void HandleItemNeedsUpdate (object sender, UpdateRequestArgs args) |
258 | @@ -546,12 +573,11 @@ |
259 | Display.GetPointer (out screen, out x, out y, out mod); |
260 | |
261 | if (screen == Screen) { |
262 | - Gdk.Rectangle geo, hide_offset; |
263 | + Gdk.Rectangle geo; |
264 | window.GetBufferedPosition (out geo.X, out geo.Y); |
265 | - window.WindowHideOffset (out hide_offset.X, out hide_offset.Y); |
266 | |
267 | - x -= geo.X - hide_offset.X; |
268 | - y -= geo.Y - hide_offset.Y; |
269 | + x -= geo.X; |
270 | + y -= geo.Y; |
271 | } else { |
272 | x = -4000; |
273 | y = -4000; |
274 | @@ -686,17 +712,16 @@ |
275 | |
276 | void SetIconRegions () |
277 | { |
278 | - Gdk.Rectangle pos, area, offset; |
279 | + Gdk.Rectangle pos, area; |
280 | window.GetPosition (out pos.X, out pos.Y); |
281 | window.GetSize (out pos.Width, out pos.Height); |
282 | |
283 | - window.WindowHideOffset (out offset.X, out offset.Y); |
284 | // we use geo here instead of our position for the Y value because we know the parent window |
285 | // may offset us when hidden. This is not desired... |
286 | for (int i = 0; i < DockItems.Count; i++) { |
287 | Gdk.Point position = PositionProvider.IconUnzoomedPosition (i); |
288 | - area = new Gdk.Rectangle (pos.X + (position.X - IconSize / 2) - offset.X, |
289 | - pos.Y + (position.Y - IconSize / 2) - offset.Y, |
290 | + area = new Gdk.Rectangle (pos.X + (position.X - IconSize / 2), |
291 | + pos.Y + (position.Y - IconSize / 2), |
292 | IconSize, |
293 | IconSize); |
294 | DockItems [i].SetIconRegion (area); |
295 | @@ -715,7 +740,7 @@ |
296 | offset = GetDockArea ().Height; |
297 | offset = offset * 2 + 10; |
298 | } else { |
299 | - if (DockPreferences.AutoHide && !drag_resizing) { |
300 | + if (Hidden && !drag_resizing) { |
301 | // setting the offset to 2 will trigger the parent window to unhide us if we are hidden. |
302 | if (AnimationState [Animations.UrgencyChanged]) |
303 | offset = 2; |
304 | |
305 | === modified file 'Do.Interface.Linux.Docky/src/Docky.Interface/DockArea_DragAndDrop.cs' |
306 | --- Do.Interface.Linux.Docky/src/Docky.Interface/DockArea_DragAndDrop.cs 2009-04-18 03:12:46 +0000 |
307 | +++ Do.Interface.Linux.Docky/src/Docky.Interface/DockArea_DragAndDrop.cs 2009-04-27 20:42:27 +0000 |
308 | @@ -132,16 +132,7 @@ |
309 | } else { |
310 | Gdk.Point local_cursor = Cursor.RelativePointToRootPoint (window); |
311 | |
312 | - IEnumerable<Gdk.Window> windows; |
313 | - try { |
314 | - windows = Screen.WindowStack; |
315 | - } catch { |
316 | - try { |
317 | - windows = Wnck.Screen.Default.WindowsStacked.Select (wnk => Gdk.Window.ForeignNew ((uint) wnk.Xid)); |
318 | - } catch { |
319 | - return; |
320 | - } |
321 | - } |
322 | + IEnumerable<Gdk.Window> windows = WindowStack; |
323 | |
324 | foreach (Gdk.Window w in windows.Reverse ()) { |
325 | if (w == null || w == window.GdkWindow || !w.IsVisible) |
326 | |
327 | === modified file 'Do.Interface.Linux.Docky/src/Docky.Interface/DockArea_Rendering.cs' |
328 | --- Do.Interface.Linux.Docky/src/Docky.Interface/DockArea_Rendering.cs 2009-04-08 00:57:55 +0000 |
329 | +++ Do.Interface.Linux.Docky/src/Docky.Interface/DockArea_Rendering.cs 2009-04-27 20:42:27 +0000 |
330 | @@ -26,6 +26,7 @@ |
331 | |
332 | using Do.Interface; |
333 | using Do.Interface.CairoUtils; |
334 | +using Do.Interface.Wink; |
335 | |
336 | using Docky.Core; |
337 | using Docky.Utilities; |
338 | @@ -49,7 +50,7 @@ |
339 | const int UrgentIndicatorSize = 12; |
340 | |
341 | Dictionary<IDockPainter, Surface> painter_surfaces; |
342 | - bool fast_render_fail, first_render_set; |
343 | + bool fast_render_fail, first_render_set, last_intersect; |
344 | |
345 | Surface backbuffer, input_area_buffer, dock_icon_buffer; |
346 | Surface indicator, urgent_indicator; |
347 | @@ -97,6 +98,21 @@ |
348 | } |
349 | } |
350 | |
351 | + bool Hidden { |
352 | + get { |
353 | + bool hidden = false; |
354 | + switch (DockPreferences.AutohideType) { |
355 | + case AutohideType.Autohide: |
356 | + hidden = !CursorIsOverDockArea; |
357 | + break; |
358 | + case AutohideType.Intellihide: |
359 | + hidden = !CursorIsOverDockArea && WindowIntersectingOther; |
360 | + break; |
361 | + } |
362 | + return hidden; |
363 | + } |
364 | + } |
365 | + |
366 | /// <value> |
367 | /// Icon Size used for the dock |
368 | /// </value> |
369 | @@ -137,6 +153,24 @@ |
370 | double PainterOpacity { |
371 | get { return 1 - DockIconOpacity; } |
372 | } |
373 | + |
374 | + bool WindowIntersectingOther { |
375 | + get { |
376 | + bool intersect = false; |
377 | + try { |
378 | + Gdk.Rectangle adjustedDockArea = MinimumDockArea.RelativeRectangleToRootPoint (window); |
379 | + adjustedDockArea.Inflate (-2, -2); |
380 | + intersect = ScreenUtils.ActiveViewport.Windows ().Any (w => w.EasyGeometry ().IntersectsWith (adjustedDockArea)); |
381 | + } catch { |
382 | + } |
383 | + if (intersect != last_intersect && DateTime.UtcNow - showhide_time > SummonTime) { |
384 | + showhide_time = DateTime.UtcNow; |
385 | + AnimatedDraw (); |
386 | + } |
387 | + last_intersect = intersect; |
388 | + return intersect; |
389 | + } |
390 | + } |
391 | |
392 | //// <value> |
393 | /// The overall offset of the dock as a whole |
394 | @@ -145,7 +179,7 @@ |
395 | get { |
396 | double offset = 0; |
397 | // we never hide in these conditions |
398 | - if (!DockPreferences.AutoHide || drag_resizing || PainterOpacity == 1) { |
399 | + if (DockPreferences.AutohideType == AutohideType.None || drag_resizing || PainterOpacity == 1) { |
400 | if ((RenderTime - FirstRenderTime) > SummonTime) |
401 | return 0; |
402 | offset = 1 - Math.Min (1, (DateTime.UtcNow - FirstRenderTime).TotalMilliseconds / SummonTime.TotalMilliseconds); |
403 | @@ -153,10 +187,10 @@ |
404 | } |
405 | |
406 | if (PainterOpacity > 0) { |
407 | - if (CursorIsOverDockArea) { |
408 | + if (!Hidden) { |
409 | return 0; |
410 | } else { |
411 | - offset = Math.Min (1, (RenderTime - enter_time).TotalMilliseconds / |
412 | + offset = Math.Min (1, (RenderTime - showhide_time).TotalMilliseconds / |
413 | SummonTime.TotalMilliseconds); |
414 | offset = Math.Min (offset, Math.Min (1, |
415 | (RenderTime - interface_change_time) |
416 | @@ -166,9 +200,9 @@ |
417 | if (PainterOverlayVisible) |
418 | offset = 1 - offset; |
419 | } else { |
420 | - offset = Math.Min (1, (RenderTime - enter_time).TotalMilliseconds / |
421 | + offset = Math.Min (1, (RenderTime - showhide_time).TotalMilliseconds / |
422 | SummonTime.TotalMilliseconds); |
423 | - if (CursorIsOverDockArea) |
424 | + if (!Hidden) |
425 | offset = 1 - offset; |
426 | } |
427 | return (int) (offset * PositionProvider.DockHeight * 1.5); |
428 | @@ -186,7 +220,7 @@ |
429 | double zoom = Math.Min (1, (RenderTime - enter_time).TotalMilliseconds / |
430 | BaseAnimationTime.TotalMilliseconds); |
431 | if (CursorIsOverDockArea) { |
432 | - if (DockPreferences.AutoHide) |
433 | + if (DockPreferences.AutohideType == AutohideType.Autohide) |
434 | zoom = 1; |
435 | } else { |
436 | zoom = 1 - zoom; |
437 | @@ -225,7 +259,7 @@ |
438 | cr.PaintWithAlpha (PainterOpacity); |
439 | } |
440 | |
441 | - bool isNotSummonTransition = PainterOpacity == 0 || CursorIsOverDockArea || !DockPreferences.AutoHide; |
442 | + bool isNotSummonTransition = PainterOpacity == 0 || !Hidden || !DockPreferences.AutoHide; |
443 | if (DockIconOpacity > 0 && isNotSummonTransition) { |
444 | if (dock_icon_buffer == null) |
445 | dock_icon_buffer = cr.Target.CreateSimilar (cr.Target.Content, Width, Height); |
446 | @@ -598,7 +632,7 @@ |
447 | |
448 | protected override bool OnExposeEvent(EventExpose evnt) |
449 | { |
450 | - if (!IsDrawable || window.IsRepositionHidden) |
451 | + if (!IsDrawable) |
452 | return false; |
453 | |
454 | RenderTime = DateTime.UtcNow; |
455 | |
456 | === modified file 'Do.Interface.Linux.Docky/src/Docky.Interface/DockWindow.cs' |
457 | --- Do.Interface.Linux.Docky/src/Docky.Interface/DockWindow.cs 2009-04-26 21:00:06 +0000 |
458 | +++ Do.Interface.Linux.Docky/src/Docky.Interface/DockWindow.cs 2009-04-27 20:42:27 +0000 |
459 | @@ -50,7 +50,6 @@ |
460 | IDoController controller; |
461 | Gdk.Rectangle current_mask; |
462 | uint strut_timer; |
463 | - bool is_repositioned_hidden; |
464 | bool presented; |
465 | int buffer_x, buffer_y; |
466 | int buffer_width, buffer_height; |
467 | @@ -58,10 +57,6 @@ |
468 | public new string Name { |
469 | get { return "Docky"; } |
470 | } |
471 | - |
472 | - public bool IsRepositionHidden { |
473 | - get { return is_repositioned_hidden; } |
474 | - } |
475 | |
476 | public IDoController Controller { |
477 | get { return controller; } |
478 | @@ -172,17 +167,6 @@ |
479 | |
480 | (cr as IDisposable).Dispose (); |
481 | pixmap.Dispose (); |
482 | - |
483 | - if (area.Height == 1) { |
484 | - GLib.Timeout.Add (500, () => { |
485 | - if (current_mask.Height == 1) |
486 | - HideReposition (); |
487 | - return false; |
488 | - }); |
489 | - } else { |
490 | - if (is_repositioned_hidden) |
491 | - Reposition (); |
492 | - } |
493 | } |
494 | |
495 | protected override bool OnButtonReleaseEvent (Gdk.EventButton evnt) |
496 | @@ -250,54 +234,7 @@ |
497 | break; |
498 | } |
499 | |
500 | - if (Display != null) |
501 | - Display.Sync (); |
502 | - |
503 | results.SlideFromBottom = DockPreferences.Orientation == DockOrientation.Bottom; |
504 | - is_repositioned_hidden = false; |
505 | - } |
506 | - |
507 | - void HideReposition () |
508 | - { |
509 | - Gdk.Rectangle geo, main; |
510 | - |
511 | - GetSize (out main.Width, out main.Height); |
512 | - geo = LayoutUtils.MonitorGemonetry (); |
513 | - |
514 | - switch (DockPreferences.Orientation) { |
515 | - case DockOrientation.Bottom: |
516 | - Move ((geo.X + geo.Width / 2) - main.Width / 2, geo.Y + geo.Height); |
517 | - break; |
518 | - case DockOrientation.Top: |
519 | - Move (geo.X, geo.Y - main.Height); |
520 | - break; |
521 | - } |
522 | - |
523 | - if (Display != null) |
524 | - Display.Sync (); |
525 | - |
526 | - is_repositioned_hidden = true; |
527 | - } |
528 | - |
529 | - public void WindowHideOffset (out int x, out int y) |
530 | - { |
531 | - x = y = 0; |
532 | - |
533 | - Gdk.Rectangle main, geo; |
534 | - main.Width = dock_area.Width; |
535 | - main.Height = dock_area.Height; |
536 | - GetBufferedPosition (out main.X, out main.Y); |
537 | - geo = LayoutUtils.MonitorGemonetry (); |
538 | - |
539 | - |
540 | - switch (DockPreferences.Orientation) { |
541 | - case DockOrientation.Bottom: |
542 | - y = main.Y - ((geo.Y + geo.Height) - main.Height); |
543 | - return; |
544 | - case DockOrientation.Top: |
545 | - y = main.Y - geo.Y; |
546 | - return; |
547 | - } |
548 | } |
549 | |
550 | public void GetBufferedPosition (out int x, out int y) |
551 | |
552 | === modified file 'Do.Interface.Linux.Docky/src/Docky.Interface/Docky.Interface.Items/DoDockItem.cs' |
553 | --- Do.Interface.Linux.Docky/src/Docky.Interface/Docky.Interface.Items/DoDockItem.cs 2009-04-21 16:10:39 +0000 |
554 | +++ Do.Interface.Linux.Docky/src/Docky.Interface/Docky.Interface.Items/DoDockItem.cs 2009-04-27 20:42:27 +0000 |
555 | @@ -89,9 +89,6 @@ |
556 | { |
557 | yield return new SeparatorMenuButtonArgs (); |
558 | |
559 | - yield return new SimpleMenuButtonArgs (() => DockPreferences.AutoHide = !DockPreferences.AutoHide, |
560 | - Catalog.GetString ("Automatically Hide"), DockPreferences.AutoHide ? EnableIcon : DisableIcon).AsDark (); |
561 | - |
562 | yield return new SimpleMenuButtonArgs (() => DockPreferences.ZoomEnabled = !DockPreferences.ZoomEnabled, |
563 | Catalog.GetString ("Zoom Icons"), DockPreferences.ZoomEnabled ? EnableIcon : DisableIcon).AsDark (); |
564 | |
565 | |
566 | === modified file 'Do.Interface.Linux.Docky/src/Docky.Interface/DockyConfigurationWidget.cs' |
567 | --- Do.Interface.Linux.Docky/src/Docky.Interface/DockyConfigurationWidget.cs 2009-04-22 03:50:29 +0000 |
568 | +++ Do.Interface.Linux.Docky/src/Docky.Interface/DockyConfigurationWidget.cs 2009-04-27 20:42:27 +0000 |
569 | @@ -89,14 +89,17 @@ |
570 | zoom_width_scale.Value = DockPreferences.ZoomSize; |
571 | |
572 | advanced_indicators_checkbutton.Active = DockPreferences.IndicateMultipleWindows; |
573 | - autohide_checkbutton.Active = DockPreferences.AutoHide; |
574 | - window_overlap_checkbutton.Active = DockPreferences.AllowOverlap; |
575 | zoom_checkbutton.Active = DockPreferences.ZoomEnabled; |
576 | |
577 | orientation_combobox.AppendText (DockOrientation.Bottom.ToString ()); |
578 | orientation_combobox.AppendText (DockOrientation.Top.ToString ()); |
579 | orientation_combobox.Active = DockPreferences.Orientation == DockOrientation.Bottom ? 0 : 1; |
580 | |
581 | + autohide_combo.AppendText (((AutohideType) 0).ToString ()); |
582 | + autohide_combo.AppendText (((AutohideType) 1).ToString ()); |
583 | + autohide_combo.AppendText (((AutohideType) 2).ToString ()); |
584 | + autohide_combo.Active = (int) DockPreferences.AutohideType; |
585 | + |
586 | BuildDocklets (); |
587 | |
588 | SetSensitivity (); |
589 | @@ -171,23 +174,17 @@ |
590 | DockPreferences.ZoomEnabled = zoom_checkbutton.Active; |
591 | } |
592 | |
593 | - protected virtual void OnWindowOverlapCheckbuttonToggled (object sender, System.EventArgs e) |
594 | - { |
595 | - if (setup) return; |
596 | - DockPreferences.AllowOverlap = window_overlap_checkbutton.Active; |
597 | - } |
598 | - |
599 | - protected virtual void OnAutohideCheckbuttonToggled (object sender, System.EventArgs e) |
600 | - { |
601 | - if (setup) return; |
602 | - DockPreferences.AutoHide = autohide_checkbutton.Active; |
603 | - } |
604 | - |
605 | protected virtual void OnOrientationComboboxChanged (object sender, System.EventArgs e) |
606 | { |
607 | if (setup) return; |
608 | DockPreferences.Orientation = (DockOrientation) orientation_combobox.Active; |
609 | } |
610 | + |
611 | + protected virtual void OnAutohideComboChanged (object sender, System.EventArgs e) |
612 | + { |
613 | + if (setup) return; |
614 | + DockPreferences.AutohideType = (AutohideType) autohide_combo.Active; |
615 | + } |
616 | |
617 | protected virtual void OnZoomWidthScaleValueChanged (object sender, System.EventArgs e) |
618 | { |
619 | |
620 | === modified file 'Do.Interface.Linux.Docky/src/Docky.Interface/LayoutUtils.cs' |
621 | --- Do.Interface.Linux.Docky/src/Docky.Interface/LayoutUtils.cs 2009-02-26 07:55:16 +0000 |
622 | +++ Do.Interface.Linux.Docky/src/Docky.Interface/LayoutUtils.cs 2009-04-27 20:42:27 +0000 |
623 | @@ -64,6 +64,13 @@ |
624 | { |
625 | return monitor_geo; |
626 | } |
627 | + |
628 | + public static Gdk.Rectangle RelativeRectangleToRootPoint (this Gdk.Rectangle relativePoint, Gtk.Window window) |
629 | + { |
630 | + Gdk.Rectangle main; |
631 | + window.GetPosition (out main.X, out main.Y); |
632 | + return new Gdk.Rectangle (main.X + relativePoint.X, main.Y + relativePoint.Y, relativePoint.Width, relativePoint.Height); |
633 | + } |
634 | |
635 | public static Gdk.Point RelativePointToRootPoint (this Gdk.Point relativePoint, Gtk.Window window) |
636 | { |
637 | |
638 | === added file 'Do.Interface.Linux.Docky/src/Docky.Utilities/AutohideType.cs' |
639 | --- Do.Interface.Linux.Docky/src/Docky.Utilities/AutohideType.cs 1970-01-01 00:00:00 +0000 |
640 | +++ Do.Interface.Linux.Docky/src/Docky.Utilities/AutohideType.cs 2009-04-27 20:42:27 +0000 |
641 | @@ -0,0 +1,30 @@ |
642 | +// |
643 | +// Copyright (C) 2009 GNOME Do |
644 | +// |
645 | +// This program is free software: you can redistribute it and/or modify |
646 | +// it under the terms of the GNU General Public License as published by |
647 | +// the Free Software Foundation, either version 3 of the License, or |
648 | +// (at your option) any later version. |
649 | +// |
650 | +// This program is distributed in the hope that it will be useful, |
651 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
652 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
653 | +// GNU General Public License for more details. |
654 | +// |
655 | +// You should have received a copy of the GNU General Public License |
656 | +// along with this program. If not, see <http://www.gnu.org/licenses/>. |
657 | +// |
658 | + |
659 | +using System; |
660 | + |
661 | +namespace Docky |
662 | +{ |
663 | + |
664 | + |
665 | + public enum AutohideType |
666 | + { |
667 | + None = 0, |
668 | + Autohide, |
669 | + Intellihide, |
670 | + } |
671 | +} |
672 | |
673 | === modified file 'Do.Interface.Linux.Docky/src/Docky.Utilities/DockPreferences.cs' |
674 | --- Do.Interface.Linux.Docky/src/Docky.Utilities/DockPreferences.cs 2009-04-23 01:09:57 +0000 |
675 | +++ Do.Interface.Linux.Docky/src/Docky.Utilities/DockPreferences.cs 2009-04-27 20:42:27 +0000 |
676 | @@ -153,33 +153,8 @@ |
677 | get { return ZoomPercent; } |
678 | } |
679 | |
680 | - static bool autohide = prefs.Get ("AutoHide", false); |
681 | public static bool AutoHide { |
682 | - get { return autohide; } |
683 | - set { |
684 | - if (autohide == value) |
685 | - return; |
686 | - |
687 | - prefs.Set ("AutoHide", value); |
688 | - autohide = value; |
689 | - if (AutohideChanged != null) |
690 | - AutohideChanged (); |
691 | - } |
692 | - } |
693 | - |
694 | - static bool allow_overlap = prefs.Get ("AllowWindowOverlap", false); |
695 | - public static bool AllowOverlap { |
696 | - get { return allow_overlap; } |
697 | - set { |
698 | - if (allow_overlap == value) |
699 | - return; |
700 | - |
701 | - prefs.Set ("AllowWindowOverlap", value); |
702 | - allow_overlap = value; |
703 | - |
704 | - if (AllowOverlapChanged != null) |
705 | - AllowOverlapChanged (); |
706 | - } |
707 | + get { return AutohideType != AutohideType.None; } |
708 | } |
709 | |
710 | static TimeSpan summon_time = new TimeSpan (0, 0, 0, 0, prefs.Get ("SummonTime", 100)); |
711 | @@ -243,6 +218,19 @@ |
712 | OrientationChanged (); |
713 | } |
714 | } |
715 | + |
716 | + static AutohideType hide = (AutohideType) Enum.Parse (typeof (AutohideType), prefs.Get ("AutohideType", AutohideType.None.ToString ())); |
717 | + public static AutohideType AutohideType { |
718 | + get { return hide; } |
719 | + set { |
720 | + if (hide == value) |
721 | + return; |
722 | + hide = value; |
723 | + prefs.Set ("AutohideType", value.ToString ()); |
724 | + if (AutohideChanged != null) |
725 | + AutohideChanged (); |
726 | + } |
727 | + } |
728 | |
729 | #region blacklists |
730 | static List<string> item_blacklist = DeserializeBlacklist (); |
731 | |
732 | === modified file 'Do.Interface.Linux.Docky/src/Docky.Utilities/GtkUtils.cs' |
733 | --- Do.Interface.Linux.Docky/src/Docky.Utilities/GtkUtils.cs 2009-02-13 00:19:29 +0000 |
734 | +++ Do.Interface.Linux.Docky/src/Docky.Utilities/GtkUtils.cs 2009-04-27 20:42:27 +0000 |
735 | @@ -38,5 +38,13 @@ |
736 | self.Colormap = colormap; |
737 | colormap.Dispose (); |
738 | } |
739 | + |
740 | + public static Gdk.Rectangle EasyGeometery (this Gdk.Window self) |
741 | + { |
742 | + Gdk.Rectangle rect; |
743 | + int depth; |
744 | + self.GetGeometry (out rect.X, out rect.Y, out rect.Width, out rect.Height, out depth); |
745 | + return rect; |
746 | + } |
747 | } |
748 | } |
Implements a much better hiding behavior called "intellihide" which is similar to autohide except that it only hides when its "in the way" thus keeping docky visible when there is nothing else present.
Further this branch removes the remaining repositioning code as it conflicts with intellihide and is generally unneeded and causes all sorts of headaches.
Features Added:
-Intellihide
Features Replaced:
-Repositing Window (not user visible)
-Allow Window Overlap
-Autohide toggle on do dock item