~ubuntu-branches/ubuntu/trusty/gnome-do/trusty-proposed

« back to all changes in this revision

Viewing changes to Do.Interface.Linux.Docky/src/Docky.Utilities/WindowControl.cs

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T Chen
  • Date: 2009-03-13 18:00:35 UTC
  • mfrom: (1.1.6 upstream) (0.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090313180035-08lo8130dasdg7n8
Tags: 0.8.1.3-0ubuntu1
* New upstream release (LP: #344578).
  + Gnome Do causes keyboard keys to be remapped (LP: #308143)
  + Docky window too small when summoned (LP: #317381)
  + Minimize/Maximize does not work on all windows (LP: #317908)
  + Docky blocks drag and drop over large areas of the screen
    (LP: #318471)
  + Docky fails to autohide properly when changing themes
    (LP: #318672)
  + Paste via ctrl+v does not work in 1st pane (LP: #318922)
  + Autostart is in wrong assembly (LP: #319114)
  + Docky has no results list (LP: #319797)
  + Docky trash applet does not reflect current state
    (LP: #320621)
  + Docky panels splits into two when over filled (LP: #324648)
  + Docky ui division is inconsistent and confusing
    (LP: #324718)
  + poor performance with two screens (LP: #323294)
  + Docky trash applet doesn't check if trash exists
    (LP: #323453)
  + docky panel splits into two when overfilled (LP: #324648)
  + Docky's UI division is inconsistent and confusing
    (LP: #324718)
  + Do crashes when using a pastebin launcher with docky
    (LP: #325178)
  + Make docky aware of icon theme switch (LP: #328721)
  + Docky doesn't update icon status for some apps that minimize
    to system tray. (LP: #329120)
  + Docky does not work properly with pull-down window
    (LP: #334663)
  + sensitivity of zooming the icons in the dock isn't
    configurable (LP: #336214)
  + Regression: In 0.8.1, "Request attention" is no longer
    indicated (LP: #337594)
  + Clock's Calendar mode auto-hides when leaving the bounds of
    the original dock (LP: #337783)
  + gnome-do does not notice change of icon theme (LP: #204368)
  + Thumbnails are never displayed when files have spaces in
    their names (LP: #311551)
  + Open improperly escapes URLs. (LP: #317416)
  + Docky: Right-click dialog appears on wrong monitor
    (LP: #319062)
  + Dragging items off Docky possible in summon mode
    (LP: #319452)
  + Docky shows icon according to the filename (LP: #320892)
  + Mouse click inactive when Do(cky) is summoned (LP: #324937)
  + Docky trash don't have a right-click menu (LP: #317947)
  + Polish docky's window name labels (LP: #318487)
  + Docky: Scroll on window icon should switch between windows
    of that app (LP: #319805)
  + Docky does not preserve window stack (z?) order when
    switching apps by clicking on app icon (LP: #326661)
  + Docky window switching should be easier. (LP: #327079)
  + Color of indicators on Docky cannot be changed
    (LP: #332936)
  + Do's ResultWindow is using wrong text color (LP: #288771)
  + Docky won't unhide after rev 1053 (LP: #337113)
  + Do's icon label in Docky should be "GNOME Do" instead of
    "Summon GNOME Do" (LP: #338496)
* Build against gtk, gnome mono packages from Experimental.
* debian/control:
  + Bump versioned dep on libgtk2.0-cil to ensure
    Gdk.Screen.IsComposited exists
  + Add libwnck2.20-cil build-dep
  + Add librsvg2-2.18-cil build-dep
  + gnome-sharp2 transition.
* debian/patches/03_show_in_all_DEs
  + Drop; fixed in new upstream
* debian/gnome-do.1
  + Update for new version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
        public static class WindowControl
30
30
        {
31
31
                
 
32
                const int SleepTime = 10;
 
33
                
32
34
                /// <summary>
33
35
                /// Handles intelligent minimize/restoring of windows.  If one or more windows is minimized, it restores
34
36
                /// all windows.  If more all are visible, it minimizes.  This operation only takes into account windows
61
63
                public static void MinimizeWindows (IEnumerable<Window> windows)
62
64
                {
63
65
                        foreach (Window window in windows) {
64
 
                                if (window.IsInViewport (window.Workspace) && !window.IsMinimized)
 
66
                                if (window.IsInViewport (window.Screen.ActiveWorkspace) && !window.IsMinimized) {
65
67
                                        window.Minimize ();
 
68
                                        System.Threading.Thread.Sleep (SleepTime);
 
69
                                }
66
70
                        }
67
71
                }
68
72
                
74
78
                /// </param>
75
79
                public static void RestoreWindows (IEnumerable<Window> windows)
76
80
                {
77
 
                        foreach (Window window in windows) {
78
 
                                if (window.IsInViewport (window.Workspace) && window.IsMinimized)
 
81
                        foreach (Window window in windows.Reverse ()) {
 
82
                                if (window.IsInViewport (window.Screen.ActiveWorkspace) && window.IsMinimized) {
79
83
                                        window.Unminimize (Gtk.Global.CurrentEventTime);
 
84
                                        System.Threading.Thread.Sleep (SleepTime);
 
85
                                }
80
86
                        }
81
87
                }
82
88
                
83
89
                public static void FocusWindows (IEnumerable<Window> windows)
84
90
                {
85
 
                        foreach (Window window in windows) {
86
 
                                if (window.IsInViewport (window.Workspace) && !window.IsMinimized)
87
 
                                        window.Activate (Gtk.Global.CurrentEventTime);
 
91
                        foreach (Window window in windows.Reverse ()) {
 
92
                                if (window.IsInViewport (window.Screen.ActiveWorkspace) && !window.IsMinimized) {
 
93
                                        window.CenterAndFocusWindow ();
 
94
                                        System.Threading.Thread.Sleep (SleepTime);
 
95
                                }
88
96
                        }
89
97
                        
90
98
                        if (windows.Count () <= 1)
91
99
                                return;
92
100
                        
93
101
                        // we do this to make sure our active window is also at the front... Its a tricky thing to do.
 
102
                        // sometimes compiz plays badly.  This hacks around it
94
103
                        uint time = Gtk.Global.CurrentEventTime + 200;
95
104
                        GLib.Timeout.Add (200, delegate {
96
 
                                if (!windows.Any (w => w.IsActive))
97
 
                                        return false;
98
 
                                windows.Where (w => w.IsActive).First ().Activate (time);
 
105
                                windows.Where (w => w.IsInViewport (w.Screen.ActiveWorkspace) && !w.IsMinimized).First ().Activate (time);
99
106
                                return false;
100
107
                        });
101
108
                }
105
112
                        FocusWindows (new [] {window});
106
113
                }
107
114
                
 
115
                public static void IntelligentFocusOffViewportWindow (Window targetWindow, IEnumerable<Window> additionalWindows)
 
116
                {
 
117
                        foreach (Window window in additionalWindows.Reverse ()) {
 
118
                                if (!window.IsMinimized && WindowsShareViewport (targetWindow, window)) {
 
119
                                        window.CenterAndFocusWindow ();
 
120
                                        System.Threading.Thread.Sleep (SleepTime);
 
121
                                }
 
122
                        }
 
123
                        
 
124
                        targetWindow.CenterAndFocusWindow ();
 
125
                        
 
126
                        if (additionalWindows.Count () <= 1)
 
127
                                return;
 
128
                        
 
129
                        // we do this to make sure our active window is also at the front... Its a tricky thing to do.
 
130
                        // sometimes compiz plays badly.  This hacks around it
 
131
                        uint time = Gtk.Global.CurrentEventTime + 200;
 
132
                        GLib.Timeout.Add (200, delegate {
 
133
                                targetWindow.Activate (time);
 
134
                                return false;
 
135
                        });
 
136
                }
 
137
                
 
138
                static bool WindowsShareViewport (Wnck.Window first, Wnck.Window second)
 
139
                {
 
140
                        if (first == null || second == null) return false;
 
141
                        
 
142
                        Wnck.Workspace wksp = first.Workspace ?? second.Workspace;
 
143
                        if (wksp == null) return false;
 
144
                        
 
145
                        Gdk.Rectangle firstGeo, secondGeo;
 
146
                        
 
147
                        first.GetGeometry (out firstGeo.X, out firstGeo.Y, out firstGeo.Width, out firstGeo.Height);
 
148
                        second.GetGeometry (out secondGeo.X, out secondGeo.Y, out secondGeo.Width, out secondGeo.Height);
 
149
                        
 
150
                        firstGeo.X += wksp.ViewportX;
 
151
                        firstGeo.Y += wksp.ViewportY;
 
152
                        
 
153
                        secondGeo.X += wksp.ViewportX;
 
154
                        secondGeo.Y += wksp.ViewportY;
 
155
                        
 
156
                        int viewportWidth, viewportHeight;
 
157
                        viewportWidth = first.Screen.Width;
 
158
                        viewportHeight = first.Screen.Height;
 
159
                        
 
160
                        int firstViewportX = ((firstGeo.X + firstGeo.Width / 2) / viewportWidth) * viewportWidth;
 
161
                        int firstViewportY = ((firstGeo.Y + firstGeo.Height / 2) / viewportHeight) * viewportHeight;
 
162
                        
 
163
                        Gdk.Rectangle viewpRect = new Gdk.Rectangle (firstViewportX, firstViewportY, 
 
164
                                                                     viewportWidth, viewportHeight);
 
165
                        
 
166
                        return viewpRect.IntersectsWith (secondGeo);
 
167
                }
 
168
                
108
169
                public static void CloseWindows (IEnumerable<Window> windows)
109
170
                {
110
171
                        foreach (Window window in windows.Where (w => !w.IsSkipTasklist))
136
197
                {
137
198
                        if (w == null)
138
199
                                return;
139
 
                        
 
200
 
140
201
                        if (!w.IsInViewport (w.Screen.ActiveWorkspace)) {
141
202
                                int viewX, viewY, viewW, viewH;
142
203
                                int midX, midY;
174
235
                                scrn.MoveViewport (midX, midY);
175
236
                        }
176
237
 
177
 
                        if (w.Workspace != null && w.Workspace != w.Screen.ActiveWorkspace)
 
238
                        if (w.Workspace != null && w.Workspace != w.Screen.ActiveWorkspace) 
178
239
                                w.Workspace.Activate (Gtk.Global.CurrentEventTime);
179
240
                        
180
 
                        if (w.IsMinimized)
 
241
                        
 
242
                        if (w.IsMinimized) 
181
243
                                w.Unminimize (Gtk.Global.CurrentEventTime);
182
244
                        
183
245
                        w.Activate (Gtk.Global.CurrentEventTime);