~ubuntu-branches/ubuntu/oneiric/docky/oneiric

« back to all changes in this revision

Viewing changes to Docky/Docky/Interface/DockDragTracker.cs

  • Committer: Bazaar Package Importer
  • Author(s): Rico Tzschichholz
  • Date: 2010-07-01 21:21:50 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20100701212150-1dqehqxey8rrvtlo
Tags: 2.0.5-1
* New upstream release 2.0.5 "Be proud of your dock",
  changes include:
  + remove --debug flag from launcher for lower memory usage
  + update the about dialog credits to list documenters and make translation 
    tab easier to read
  + change url in about dialog to the launchpad project page
  + Window-Matching
    - fix for applications commandline
    - properly match qt creator (LP: #594814)
    - prefer local over global launchers (LP: #588073) (LP: #592841)
    - match prefix for gksudo (LP: #516433)
    - fix nautilus items showing active indicator when desktop 
      is focused (LP: #487113)
    - fix matching wine apps that use a prefixed launcher (LP: #596092)
  + Memory Leaks
    - dispose of calendar painter when the clock item is disposed
    - fix leak in AutoHideManager
    - several fixes using Cairo.Context.Target and Pango.Layout
    - fix leak in PagingPainters
    - fix leak in recursive file-deletion
    - fix leaking SeparatorItems, WnckDockItems
    - fix leaks with FileEmblems
    - fix Pixbuf related leaks
    - fix some leaks regarding FileMonitors
    - fix leaks regarding Tiles and AbtractTileObjects
    - fix leaking Glib.FileAdapter caused by unreferenced Action in 
      FileDockItem
  + Handle invalid desktopfile entry and UriFormatException in 
    FileApplicationProvider (LP: #595921)
  + fix potential crash for invalid HelperMetadata
  + handle drops correctly
  + fix handling of Helpers in HelperService
  + make the sliders in preferences behave better
  + fix drawing of rotated items
  + fix HoveredItem click-position
  + avoids fatal errors on console when loading embedded icons when no 
    height or width is specified and when dock items have a null Icon
  + fix icon theme change not refreshing the dock icons (LP: #590205)
  + fix SVG rendering bug
  + fix iconsize temporarily getting large when adding to full dock 
    (LP: #579576)
  + fix the 'crash in PinToDock' (LP: #588073)
  + make 3d background height more consistent and a tad larger (LP: #503038)
  + fix dragging multiple files to a folder on the dock, which caused 
    a crash and data corruption (LP: #579049)
  + don't request animations if urgent state is removed from a window and 
    fix glow location (LP: #596422)
  + fix window previews being offset (LP: #495065)
  + fix broken zoom after shrinking icon size (LP: #598924)
  + fix problem with hovers still visible when painters show
  + fix displaying default icon in place of missing file emblem (LP: #534651)
  + fix crash when gconf key for menus_have_icons is not set (LP: #573751)
  + make sure painters fit on screen (LP: #589978)
  + fix icon minimize animations not working immediately for some newly 
    opened windows
  + don't dispose our static DockyItem
  + fix CurrentDesktopOnly not working when dragging a window across desktops
    (LP: #600290)
  + GMail: 
    - fix thread-guards and remove deprecated code
    - fix problem with feeds that don't have an author entry (LP: #595530)
  + NPR: fix bug where removing your last NPR station unloaded the docklet
    and fix station icon
  + NetworkManager: fix crash caused when NM goes away
    and fix icons and add another fallback icon (LP: #588581)
  + Mounter:
    - fixed some leaks
    - only remove mounted items if they were successfully unmounted 
      (LP: #597637)
    - fix duplicate icons showing in mounter (LP: #525306)
  + Weather: fix feels like temp showing incorrect for metric (LP: #597670)
  + RecentDocuments: 
    - fixed some leaks
    - fix sensitivity of recent docs clear menu item - even if docky shows 
      the list as empty does not mean it cant be cleared
* debian/patches/01_use_cli_for_wrapper.patch:
  + patch wrapper script to meet the Debian CLI Policy
* debian/control:
  + Bump Standards version to 3.9.0 (no changes needed)

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
                bool repo_mode = false;
48
48
                bool drag_disabled = false;
49
49
                int marker = 0;
 
50
                uint drag_hover_timer;
50
51
                
51
52
                AbstractDockItem drag_item;
52
53
                
100
101
                                        return;
101
102
                                repo_mode = value;
102
103
                                
103
 
                                if (repo_mode) {
 
104
                                if (repo_mode)
104
105
                                        DisableDragTo ();
105
 
                                } else {
 
106
                                else
106
107
                                        EnableDragTo ();
107
 
                                }
108
108
                        }
109
109
                }
110
110
                
193
193
                        if (drag_item is INonPersistedItem || RepositionMode)
194
194
                                drag_item = null;
195
195
                        
196
 
                        if (drag_item != null) {
 
196
                        if (drag_item != null)
197
197
                                pbuf = Owner.HoveredItem.IconSurface (new DockySurface (1, 1), Owner.ZoomedIconSize, Owner.IconSize, 0).LoadToPixbuf ();
198
 
                        } else {
 
198
                        else
199
199
                                pbuf = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, true, 8, 1, 1);
200
 
                        }
201
200
                        
202
201
                        Gtk.Drag.SetIconPixbuf (args.Context, pbuf, pbuf.Width / 2, pbuf.Height / 2);
203
202
                        pbuf.Dispose ();
204
203
                        
205
204
                        // Set up a cursor tracker so we can move the window on the fly
206
 
                        if (RepositionMode) {
 
205
                        if (RepositionMode)
207
206
                                Owner.CursorTracker.CursorPositionChanged += HandleCursorPositionChanged;
208
 
                        }
209
207
                }
210
208
 
211
209
                void HandleCursorPositionChanged (object sender, CursorPostionChangedArgs e)
221
219
                        Gdk.Rectangle right = new Gdk.Rectangle (geo.X + geo.Width - activeRegion, geo.Y + activeRegion, activeRegion, geo.Height - activeRegion * 2);
222
220
                        Gdk.Rectangle bottom = new Gdk.Rectangle (geo.X + activeRegion, geo.Y + geo.Height - activeRegion, geo.Width - activeRegion * 2, activeRegion);
223
221
                        
224
 
                        DockPosition target = DockPosition.Left;
225
 
                        if (top.Contains (cursor)) {
 
222
                        DockPosition target;
 
223
                        if (top.Contains (cursor))
226
224
                                target = DockPosition.Top;
227
 
                        } else if (bottom.Contains (cursor)) {
 
225
                        else if (bottom.Contains (cursor))
228
226
                                target = DockPosition.Bottom;
229
 
                        } else if (left.Contains (cursor)) {
 
227
                        else if (left.Contains (cursor))
230
228
                                target = DockPosition.Left;
231
 
                        } else if (right.Contains (cursor)) {
 
229
                        else if (right.Contains (cursor))
232
230
                                target = DockPosition.Right;
233
 
                        } else {
 
231
                        else
234
232
                                return;
235
 
                        }
236
233
                        
237
234
                        IDockPreferences prefs = Owner.Preferences;
238
235
                        if (prefs.Position != target || prefs.MonitorNumber != monitor) {
291
288
                        if (drag_data == null)
292
289
                                return false;
293
290
                        
294
 
                        foreach (string s in drag_data) {
295
 
                                if (Owner.HoveredProvider != null && Owner.HoveredProvider.CanAcceptDrop (s)) {
296
 
                                        return true;
297
 
                                } else if (Owner.Preferences.DefaultProvider.CanAcceptDrop (s)) {
298
 
                                        return true;
299
 
                                }
300
 
                        }
 
291
                        foreach (string s in drag_data)
 
292
                                if (Owner.HoveredProvider != null && Owner.HoveredProvider.CanAcceptDrop (s))
 
293
                                        return true;
 
294
                                else if (Owner.Preferences.DefaultProvider.CanAcceptDrop (s))
 
295
                                        return true;
301
296
                        
302
297
                        // cant accept anything!
303
298
                        return false;
324
319
                        
325
320
                                foreach (string s in drag_data) {
326
321
                                        AbstractDockItemProvider provider;
327
 
                                        if (Owner.HoveredProvider != null && Owner.HoveredProvider.CanAcceptDrop (s)) {
 
322
                                        if (Owner.HoveredProvider != null && Owner.HoveredProvider.CanAcceptDrop (s))
328
323
                                                provider = Owner.HoveredProvider;
329
 
                                        } else if (Owner.Preferences.DefaultProvider.CanAcceptDrop (s)) {
 
324
                                        else if (Owner.Preferences.DefaultProvider.CanAcceptDrop (s))
330
325
                                                provider = Owner.Preferences.DefaultProvider;
331
 
                                        } else {
 
326
                                        else
332
327
                                                // nothing will take it, continue!
333
328
                                                continue;
334
 
                                        }
335
329
                                        
336
330
                                        provider.AcceptDrop (s, newPosition);
337
331
                                        
417
411
                        if (RepositionMode)
418
412
                                return;
419
413
                        
420
 
                        if (!InternalDragActive) {
421
 
                                ExternalDragActive = true;
422
 
                        }
 
414
                        ExternalDragActive = !InternalDragActive;
423
415
                        
424
416
                        if (marker != args.Context.GetHashCode ()) {
425
417
                                marker = args.Context.GetHashCode ();
470
462
                                // drag right
471
463
                                if (drag_item.Position < destPos) {
472
464
                                        foreach (AbstractDockItem adi in ProviderForItem (drag_item).Items
473
 
                                                                                .Where (i => i.Position > drag_item.Position && i.Position <= destPos))
 
465
                                                                .Where (i => i.Position > drag_item.Position && i.Position <= destPos))
474
466
                                                adi.Position--;
475
467
                                // drag left
476
468
                                } else if (drag_item.Position > destPos) {
477
469
                                        foreach (AbstractDockItem adi in ProviderForItem (drag_item).Items
478
 
                                                                                .Where (i => i.Position < drag_item.Position && i.Position >= destPos))
 
470
                                                                .Where (i => i.Position < drag_item.Position && i.Position >= destPos))
479
471
                                                adi.Position++;
480
472
                                }
481
473
                                drag_item.Position = destPos;
483
475
                                Owner.UpdateCollectionBuffer ();
484
476
                                Owner.Preferences.SyncPreferences ();
485
477
                        }
 
478
                        
 
479
                        if (drag_hover_timer > 0) {
 
480
                                GLib.Source.Remove (drag_hover_timer);
 
481
                                drag_hover_timer = 0;
 
482
                        }
 
483
                        
 
484
                        if (ExternalDragActive && drag_data != null)
 
485
                                drag_hover_timer = GLib.Timeout.Add (1500, delegate {
 
486
                                        AbstractDockItem item = Owner.HoveredItem;
 
487
                                        if (item != null)
 
488
                                                item.Scrolled (ScrollDirection.Down, Gdk.ModifierType.None);
 
489
                                        return true;
 
490
                                });
486
491
                }
487
492
                
488
493
                AbstractDockItemProvider ProviderForItem (AbstractDockItem item)
503
508
                public void EnsureDragAndDropProxy ()
504
509
                {
505
510
                        // having a proxy window here is VERY bad ju-ju
506
 
                        if (InternalDragActive) {
 
511
                        if (InternalDragActive)
507
512
                                return;
508
 
                        }
509
513
                        
510
514
                        if (Owner.DockHovered) {
511
515
                                if (proxy_window == null)