Merge lp://qastaging/~psybers/do-plugins/nodocky into lp://qastaging/do-plugins

Proposed by Robert Dyer
Status: Merged
Merged at revision: not available
Proposed branch: lp://qastaging/~psybers/do-plugins/nodocky
Merge into: lp://qastaging/do-plugins
Diff against target: 1964 lines (+1635/-28)
30 files modified
WindowManager/Makefile.am (+13/-3)
WindowManager/WindowManager.mdp (+1/-3)
WindowManager/src/CurrentApplicationItem.cs (+1/-1)
WindowManager/src/CurrentWindowItem.cs (+1/-1)
WindowManager/src/IWindowList.cs (+1/-1)
WindowManager/src/Screen/CurrentScreenItem.cs (+2/-2)
WindowManager/src/Screen/ScreenActionAction.cs (+1/-1)
WindowManager/src/Screen/ScreenCascadeAction.cs (+1/-1)
WindowManager/src/Screen/ScreenItem.cs (+1/-1)
WindowManager/src/Screen/ScreenItemSource.cs (+1/-1)
WindowManager/src/Screen/ScreenRestoreAction.cs (+1/-1)
WindowManager/src/Screen/ScreenSwapAction.cs (+1/-1)
WindowManager/src/Screen/ScreenTileAction.cs (+1/-1)
WindowManager/src/WindowActions/WindowActionAction.cs (+1/-1)
WindowManager/src/WindowActions/WindowCloseAction.cs (+1/-1)
WindowManager/src/WindowActions/WindowFocusAction.cs (+1/-1)
WindowManager/src/WindowActions/WindowMaximizeAction.cs (+1/-1)
WindowManager/src/WindowActions/WindowMinimizeAction.cs (+1/-1)
WindowManager/src/WindowActions/WindowMoveAction.cs (+1/-1)
WindowManager/src/WindowItem.cs (+1/-1)
WindowManager/src/WindowItemSource.cs (+1/-1)
WindowManager/src/Wink/Position.cs (+30/-0)
WindowManager/src/Wink/ScreenUtils.cs (+160/-0)
WindowManager/src/Wink/Viewport.cs (+280/-0)
WindowManager/src/Wink/WindowControl.cs (+173/-0)
WindowManager/src/Wink/WindowUtils.cs (+402/-0)
WindowManager/src/Wink/WnckWindow_Extensions.cs (+94/-0)
WindowManager/src/Xlib/X11Atoms.cs (+336/-0)
WindowManager/src/Xlib/Xlib.cs (+126/-0)
configure.ac (+0/-2)
To merge this branch: bzr merge lp://qastaging/~psybers/do-plugins/nodocky
Reviewer Review Type Date Requested Status
Do Plugins Team Pending
Review via email: mp+13192@code.qastaging.launchpad.net
To post a comment you must log in.
Revision history for this message
Robert Dyer (psybers) wrote :

Moved the Wink library from Do to WindowManager, as thats all that needs it. I also cleaned up the library to remove things WindowManager doesn't need.

668. By Robert Dyer

merge trunk

669. By Robert Dyer

merge trunk

670. By Robert Dyer

merge trunk

671. By Robert Dyer

merge trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'WindowManager/Makefile.am'
2--- WindowManager/Makefile.am 2009-06-22 04:05:16 +0000
3+++ WindowManager/Makefile.am 2009-11-23 15:31:10 +0000
4@@ -22,7 +22,17 @@
5 src/WindowActions/WindowFocusAction.cs \
6 src/WindowActions/WindowMaximizeAction.cs \
7 src/WindowActions/WindowMinimizeAction.cs \
8- src/WindowActions/WindowMoveAction.cs
9+ src/WindowActions/WindowMoveAction.cs \
10+ src/Wink/ScreenUtils.cs \
11+ src/Wink/WindowControl.cs \
12+ src/Wink/WnckWindow_Extensions.cs \
13+ src/Wink/Position.cs \
14+ src/Wink/Viewport.cs \
15+ src/Wink/WindowUtils.cs \
16+ src/Xlib/X11Atoms.cs \
17+ src/Xlib/Xlib.cs
18+
19+
20
21
22 RESOURCES = \
23@@ -31,10 +41,10 @@
24 REFERENCES = \
25 System \
26 System.Core \
27+ Mono.Posix \
28 $(WNCK_SHARP_10_LIBS) \
29 $(GTK_SHARP_20_LIBS) \
30 $(GLIB_SHARP_20_LIBS) \
31 $(GNOME_DESKTOP_SHARP_20_LIBS) \
32 $(DO_PLATFORM_LIBS) \
33- $(DO_UNIVERSE_LIBS) \
34- $(DO_INTERFACE_WINK_LIBS)
35+ $(DO_UNIVERSE_LIBS)
36
37=== modified file 'WindowManager/WindowManager.mdp'
38--- WindowManager/WindowManager.mdp 2009-06-29 08:47:41 +0000
39+++ WindowManager/WindowManager.mdp 2009-11-23 15:31:10 +0000
40@@ -50,8 +50,6 @@
41 <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
42 <ProjectReference type="Gac" localcopy="True" refto="Do.Platform, Version=0.9.0.0, Culture=neutral" />
43 <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" />
44- <ProjectReference type="Gac" localcopy="True" refto="Do.Interface.Wink, Version=0.9.0.0, Culture=neutral" />
45- <ProjectReference type="Gac" localcopy="True" refto="Do.Interface.Wink, Version=1.0.3375.29611, Culture=neutral" />
46 </References>
47 <LanguageParameters ApplicationIcon="." ctype="CSharpProjectParameters" />
48-</Project>
49\ No newline at end of file
50+</Project>
51
52=== modified file 'WindowManager/src/CurrentApplicationItem.cs'
53--- WindowManager/src/CurrentApplicationItem.cs 2009-06-22 04:05:16 +0000
54+++ WindowManager/src/CurrentApplicationItem.cs 2009-11-23 15:31:10 +0000
55@@ -23,7 +23,7 @@
56 using Mono.Addins;
57
58 using Do.Universe;
59-using Do.Interface.Wink;
60+using WindowManager.Wink;
61
62 namespace WindowManager
63 {
64
65=== modified file 'WindowManager/src/CurrentWindowItem.cs'
66--- WindowManager/src/CurrentWindowItem.cs 2009-06-22 04:05:16 +0000
67+++ WindowManager/src/CurrentWindowItem.cs 2009-11-23 15:31:10 +0000
68@@ -23,7 +23,7 @@
69 using Mono.Addins;
70
71 using Do.Universe;
72-using Do.Interface.Wink;
73+using WindowManager.Wink;
74
75 namespace WindowManager
76 {
77
78=== modified file 'WindowManager/src/IWindowList.cs'
79--- WindowManager/src/IWindowList.cs 2009-03-30 00:03:03 +0000
80+++ WindowManager/src/IWindowList.cs 2009-11-23 15:31:10 +0000
81@@ -25,7 +25,7 @@
82 using Wnck;
83
84 using Do.Universe;
85-using Do.Interface.Wink;
86+using WindowManager.Wink;
87
88 namespace WindowManager
89 {
90
91=== modified file 'WindowManager/src/Screen/CurrentScreenItem.cs'
92--- WindowManager/src/Screen/CurrentScreenItem.cs 2009-06-22 04:05:16 +0000
93+++ WindowManager/src/Screen/CurrentScreenItem.cs 2009-11-23 15:31:10 +0000
94@@ -23,7 +23,7 @@
95 using Mono.Addins;
96
97 using Do.Universe;
98-using Do.Interface.Wink;
99+using WindowManager.Wink;
100
101 namespace WindowManager
102 {
103@@ -65,4 +65,4 @@
104 }
105 }
106 }
107-}
108\ No newline at end of file
109+}
110
111=== modified file 'WindowManager/src/Screen/ScreenActionAction.cs'
112--- WindowManager/src/Screen/ScreenActionAction.cs 2009-06-22 04:05:16 +0000
113+++ WindowManager/src/Screen/ScreenActionAction.cs 2009-11-23 15:31:10 +0000
114@@ -22,7 +22,7 @@
115 using System.Threading;
116
117 using Do.Universe;
118-using Do.Interface.Wink;
119+using WindowManager.Wink;
120
121 using Wnck;
122 using Mono.Addins;
123
124=== modified file 'WindowManager/src/Screen/ScreenCascadeAction.cs'
125--- WindowManager/src/Screen/ScreenCascadeAction.cs 2009-06-22 04:05:16 +0000
126+++ WindowManager/src/Screen/ScreenCascadeAction.cs 2009-11-23 15:31:10 +0000
127@@ -22,7 +22,7 @@
128 using System.Threading;
129
130 using Do.Universe;
131-using Do.Interface.Wink;
132+using WindowManager.Wink;
133
134 using Wnck;
135 using Mono.Addins;
136
137=== modified file 'WindowManager/src/Screen/ScreenItem.cs'
138--- WindowManager/src/Screen/ScreenItem.cs 2009-06-22 04:05:16 +0000
139+++ WindowManager/src/Screen/ScreenItem.cs 2009-11-23 15:31:10 +0000
140@@ -23,7 +23,7 @@
141 using Mono.Addins;
142
143 using Do.Universe;
144-using Do.Interface.Wink;
145+using WindowManager.Wink;
146
147 namespace WindowManager
148 {
149
150=== modified file 'WindowManager/src/Screen/ScreenItemSource.cs'
151--- WindowManager/src/Screen/ScreenItemSource.cs 2009-06-22 04:05:16 +0000
152+++ WindowManager/src/Screen/ScreenItemSource.cs 2009-11-23 15:31:10 +0000
153@@ -24,7 +24,7 @@
154 using System.Collections.Generic;
155
156 using Do.Universe;
157-using Do.Interface.Wink;
158+using WindowManager.Wink;
159 using Wnck;
160 using Mono.Addins;
161
162
163=== modified file 'WindowManager/src/Screen/ScreenRestoreAction.cs'
164--- WindowManager/src/Screen/ScreenRestoreAction.cs 2009-06-22 04:05:16 +0000
165+++ WindowManager/src/Screen/ScreenRestoreAction.cs 2009-11-23 15:31:10 +0000
166@@ -27,7 +27,7 @@
167 using System.Threading;
168
169 using Do.Universe;
170-using Do.Interface.Wink;
171+using WindowManager.Wink;
172
173 using Wnck;
174 using Mono.Addins;
175
176=== modified file 'WindowManager/src/Screen/ScreenSwapAction.cs'
177--- WindowManager/src/Screen/ScreenSwapAction.cs 2009-06-22 04:05:16 +0000
178+++ WindowManager/src/Screen/ScreenSwapAction.cs 2009-11-23 15:31:10 +0000
179@@ -22,7 +22,7 @@
180 using System.Threading;
181
182 using Do.Universe;
183-using Do.Interface.Wink;
184+using WindowManager.Wink;
185
186 using Wnck;
187 using Mono.Addins;
188
189=== modified file 'WindowManager/src/Screen/ScreenTileAction.cs'
190--- WindowManager/src/Screen/ScreenTileAction.cs 2009-06-22 04:05:16 +0000
191+++ WindowManager/src/Screen/ScreenTileAction.cs 2009-11-23 15:31:10 +0000
192@@ -22,7 +22,7 @@
193 using System.Threading;
194
195 using Do.Universe;
196-using Do.Interface.Wink;
197+using WindowManager.Wink;
198
199 using Wnck;
200 using Mono.Addins;
201
202=== modified file 'WindowManager/src/WindowActions/WindowActionAction.cs'
203--- WindowManager/src/WindowActions/WindowActionAction.cs 2009-06-22 04:05:16 +0000
204+++ WindowManager/src/WindowActions/WindowActionAction.cs 2009-11-23 15:31:10 +0000
205@@ -27,7 +27,7 @@
206 using System.Threading;
207
208 using Do.Universe;
209-using Do.Interface.Wink;
210+using WindowManager.Wink;
211
212 using Wnck;
213 using Mono.Addins;
214
215=== modified file 'WindowManager/src/WindowActions/WindowCloseAction.cs'
216--- WindowManager/src/WindowActions/WindowCloseAction.cs 2009-06-22 04:05:16 +0000
217+++ WindowManager/src/WindowActions/WindowCloseAction.cs 2009-11-23 15:31:10 +0000
218@@ -20,7 +20,7 @@
219 using System.Linq;
220
221 using Do.Universe;
222-using Do.Interface.Wink;
223+using WindowManager.Wink;
224
225 using Wnck;
226 using Mono.Addins;
227
228=== modified file 'WindowManager/src/WindowActions/WindowFocusAction.cs'
229--- WindowManager/src/WindowActions/WindowFocusAction.cs 2009-06-22 04:05:16 +0000
230+++ WindowManager/src/WindowActions/WindowFocusAction.cs 2009-11-23 15:31:10 +0000
231@@ -20,7 +20,7 @@
232 using System.Linq;
233
234 using Do.Universe;
235-using Do.Interface.Wink;
236+using WindowManager.Wink;
237
238 using Wnck;
239 using Mono.Addins;
240
241=== modified file 'WindowManager/src/WindowActions/WindowMaximizeAction.cs'
242--- WindowManager/src/WindowActions/WindowMaximizeAction.cs 2009-06-22 04:05:16 +0000
243+++ WindowManager/src/WindowActions/WindowMaximizeAction.cs 2009-11-23 15:31:10 +0000
244@@ -20,7 +20,7 @@
245 using System.Linq;
246
247 using Do.Universe;
248-using Do.Interface.Wink;
249+using WindowManager.Wink;
250
251 using Wnck;
252 using Mono.Addins;
253
254=== modified file 'WindowManager/src/WindowActions/WindowMinimizeAction.cs'
255--- WindowManager/src/WindowActions/WindowMinimizeAction.cs 2009-06-22 04:05:16 +0000
256+++ WindowManager/src/WindowActions/WindowMinimizeAction.cs 2009-11-23 15:31:10 +0000
257@@ -20,7 +20,7 @@
258 using System.Linq;
259
260 using Do.Universe;
261-using Do.Interface.Wink;
262+using WindowManager.Wink;
263
264 using Wnck;
265 using Mono.Addins;
266
267=== modified file 'WindowManager/src/WindowActions/WindowMoveAction.cs'
268--- WindowManager/src/WindowActions/WindowMoveAction.cs 2009-04-04 04:53:33 +0000
269+++ WindowManager/src/WindowActions/WindowMoveAction.cs 2009-11-23 15:31:10 +0000
270@@ -23,7 +23,7 @@
271
272 using Do.Platform;
273 using Do.Universe;
274-using Do.Interface.Wink;
275+using WindowManager.Wink;
276
277 namespace WindowManager
278 {
279
280=== modified file 'WindowManager/src/WindowItem.cs'
281--- WindowManager/src/WindowItem.cs 2009-06-22 04:05:16 +0000
282+++ WindowManager/src/WindowItem.cs 2009-11-23 15:31:10 +0000
283@@ -28,7 +28,7 @@
284 using Mono.Addins;
285
286 using Do.Universe;
287-using Do.Interface.Wink;
288+using WindowManager.Wink;
289
290 namespace WindowManager
291 {
292
293=== modified file 'WindowManager/src/WindowItemSource.cs'
294--- WindowManager/src/WindowItemSource.cs 2009-06-22 04:05:16 +0000
295+++ WindowManager/src/WindowItemSource.cs 2009-11-23 15:31:10 +0000
296@@ -25,7 +25,7 @@
297 using System.Linq;
298
299 using Do.Universe;
300-using Do.Interface.Wink;
301+using WindowManager.Wink;
302
303 using Wnck;
304 using Mono.Addins;
305
306=== added directory 'WindowManager/src/Wink'
307=== added file 'WindowManager/src/Wink/Position.cs'
308--- WindowManager/src/Wink/Position.cs 1970-01-01 00:00:00 +0000
309+++ WindowManager/src/Wink/Position.cs 2009-11-23 15:31:10 +0000
310@@ -0,0 +1,30 @@
311+//
312+// Copyright (C) 2009 GNOME Do
313+//
314+// This program is free software: you can redistribute it and/or modify
315+// it under the terms of the GNU General Public License as published by
316+// the Free Software Foundation, either version 3 of the License, or
317+// (at your option) any later version.
318+//
319+// This program is distributed in the hope that it will be useful,
320+// but WITHOUT ANY WARRANTY; without even the implied warranty of
321+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
322+// GNU General Public License for more details.
323+//
324+// You should have received a copy of the GNU General Public License
325+// along with this program. If not, see <http://www.gnu.org/licenses/>.
326+//
327+
328+using System;
329+
330+namespace WindowManager.Wink
331+{
332+
333+
334+ public enum Position {
335+ Left = 0,
336+ Right,
337+ Top,
338+ Bottom,
339+ }
340+}
341
342=== added file 'WindowManager/src/Wink/ScreenUtils.cs'
343--- WindowManager/src/Wink/ScreenUtils.cs 1970-01-01 00:00:00 +0000
344+++ WindowManager/src/Wink/ScreenUtils.cs 2009-11-23 15:31:10 +0000
345@@ -0,0 +1,160 @@
346+//
347+// Copyright (C) 2009 GNOME Do
348+//
349+// This program is free software: you can redistribute it and/or modify
350+// it under the terms of the GNU General Public License as published by
351+// the Free Software Foundation, either version 3 of the License, or
352+// (at your option) any later version.
353+//
354+// This program is distributed in the hope that it will be useful,
355+// but WITHOUT ANY WARRANTY; without even the implied warranty of
356+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
357+// GNU General Public License for more details.
358+//
359+// You should have received a copy of the GNU General Public License
360+// along with this program. If not, see <http://www.gnu.org/licenses/>.
361+//
362+
363+using System;
364+using System.Collections.Generic;
365+using System.Linq;
366+
367+using Mono.Unix;
368+
369+using Wnck;
370+
371+namespace WindowManager.Wink
372+{
373+
374+
375+ public static class ScreenUtils
376+ {
377+ static bool initialized;
378+ static string ViewportFormatString = Catalog.GetString ("Desktop") + " {0}";
379+ static Dictionary<Workspace, Viewport [,]> layouts;
380+
381+ public static event EventHandler ViewportsChanged;
382+
383+ public static Viewport ActiveViewport {
384+ get {
385+ Workspace wsp = Wnck.Screen.Default.ActiveWorkspace;
386+ Gdk.Rectangle geo = new Gdk.Rectangle (wsp.ViewportX, wsp.ViewportY, wsp.Screen.Width, wsp.Screen.Height);
387+ if (Viewports.Any (vp => vp.IsActive))
388+ return Viewports.First (vp => vp.IsActive);
389+ return null;
390+ }
391+ }
392+
393+ public static IEnumerable<Viewport> Viewports {
394+ get {
395+ foreach (Viewport [,] layout in layouts.Values) {
396+ foreach (Viewport viewport in layout)
397+ yield return viewport;
398+ }
399+ }
400+ }
401+
402+ public static void Initialize ()
403+ {
404+ if (initialized)
405+ return;
406+
407+ initialized = true;
408+ Wnck.Global.ClientType = Wnck.ClientType.Pager;
409+
410+ Wnck.Screen.Default.ViewportsChanged += HandleViewportsChanged;
411+ Wnck.Screen.Default.WorkspaceCreated += HandleWorkspaceCreated;
412+ Wnck.Screen.Default.WorkspaceDestroyed += HandleWorkspaceDestroyed;
413+
414+ UpdateViewports ();
415+ }
416+
417+ static void HandleWorkspaceDestroyed(object o, WorkspaceDestroyedArgs args)
418+ {
419+ UpdateViewports ();
420+ }
421+
422+ static void HandleWorkspaceCreated(object o, WorkspaceCreatedArgs args)
423+ {
424+ UpdateViewports ();
425+ }
426+
427+ static void HandleViewportsChanged(object sender, EventArgs e)
428+ {
429+ UpdateViewports ();
430+ }
431+
432+ public static bool DesktopShown (Screen screen)
433+ {
434+ return screen.ShowingDesktop;
435+ }
436+
437+ public static void ShowDesktop (Screen screen)
438+ {
439+ if (!screen.ShowingDesktop)
440+ screen.ToggleShowingDesktop (true);
441+ }
442+
443+ public static void UnshowDesktop (Screen screen)
444+ {
445+ if (screen.ShowingDesktop)
446+ screen.ToggleShowingDesktop (false);
447+ }
448+
449+ public static Viewport [,] ViewportLayout ()
450+ {
451+ return ViewportLayout (Wnck.Screen.Default.ActiveWorkspace);
452+ }
453+
454+ public static Viewport [,] ViewportLayout (Workspace workspace)
455+ {
456+ if (!layouts.ContainsKey (workspace))
457+ return new Viewport [0,0];
458+
459+ return layouts [workspace];
460+ }
461+
462+ static void UpdateViewports ()
463+ {
464+ layouts = new Dictionary<Workspace, Viewport [,]> ();
465+
466+ int currentViewport = 1;
467+ foreach (Wnck.Workspace workspace in Wnck.Screen.Default.Workspaces) {
468+
469+ if (workspace.IsVirtual) {
470+ int viewportWidth;
471+ int viewportHeight;
472+ viewportWidth = workspace.Screen.Width;
473+ viewportHeight = workspace.Screen.Height;
474+
475+ int rows = workspace.Height / viewportHeight;
476+ int columns = workspace.Width / viewportWidth;
477+
478+ layouts [workspace] = new Viewport [rows, columns];
479+
480+ for (int i = 0; i < rows; i++) {
481+ for (int j = 0; j < columns; j++) {
482+ Gdk.Rectangle area = new Gdk.Rectangle (j * viewportWidth,
483+ i * viewportHeight,
484+ viewportWidth,
485+ viewportHeight);
486+ layouts [workspace] [i, j] = new Viewport (string.Format (ViewportFormatString, currentViewport),
487+ area,
488+ workspace);
489+ currentViewport++;
490+ }
491+ }
492+ } else {
493+ layouts [workspace] = new Viewport [1,1];
494+ Viewport viewport = new Viewport (string.Format (ViewportFormatString, currentViewport),
495+ new Gdk.Rectangle (0, 0, workspace.Width, workspace.Height),
496+ workspace);
497+ layouts [workspace] [0,0] = viewport;
498+ currentViewport++;
499+ }
500+ }
501+ if (ViewportsChanged != null)
502+ ViewportsChanged (new object (), EventArgs.Empty);
503+ }
504+ }
505+}
506
507=== added file 'WindowManager/src/Wink/Viewport.cs'
508--- WindowManager/src/Wink/Viewport.cs 1970-01-01 00:00:00 +0000
509+++ WindowManager/src/Wink/Viewport.cs 2009-11-23 15:31:10 +0000
510@@ -0,0 +1,280 @@
511+//
512+// Copyright (C) 2009 GNOME Do
513+//
514+// This program is free software: you can redistribute it and/or modify
515+// it under the terms of the GNU General Public License as published by
516+// the Free Software Foundation, either version 3 of the License, or
517+// (at your option) any later version.
518+//
519+// This program is distributed in the hope that it will be useful,
520+// but WITHOUT ANY WARRANTY; without even the implied warranty of
521+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
522+// GNU General Public License for more details.
523+//
524+// You should have received a copy of the GNU General Public License
525+// along with this program. If not, see <http://www.gnu.org/licenses/>.
526+//
527+
528+using System;
529+using System.Collections.Generic;
530+using System.Runtime.InteropServices;
531+using System.Linq;
532+
533+
534+using Gdk;
535+using Wnck;
536+
537+using Do.Platform;
538+using WindowManager.Xlib;
539+
540+namespace WindowManager.Wink
541+{
542+ public class Viewport
543+ {
544+ static Dictionary<Wnck.Window, WindowState> window_states = new Dictionary<Wnck.Window, WindowState> ();
545+
546+ private class WindowState {
547+ public Gdk.Rectangle Area;
548+ public Wnck.WindowState State;
549+
550+ public WindowState (Gdk.Rectangle area, Wnck.WindowState state)
551+ {
552+ Area = area;
553+ State = state;
554+ }
555+ }
556+
557+ Workspace parent;
558+ Rectangle area;
559+
560+ public string Name { get; private set; }
561+
562+ public Rectangle Area {
563+ get { return area; }
564+ }
565+
566+ public bool IsActive {
567+ get {
568+ if (!parent.IsVirtual)
569+ return Wnck.Screen.Default.ActiveWorkspace == parent;
570+ else
571+ return Wnck.Screen.Default.ActiveWorkspace.ViewportX == area.X && Wnck.Screen.Default.ActiveWorkspace.ViewportY == area.Y;
572+ }
573+ }
574+
575+ WindowMoveResizeMask MoveMask {
576+ get {
577+ return WindowMoveResizeMask.X | WindowMoveResizeMask.Y;
578+ }
579+ }
580+
581+ WindowMoveResizeMask ResizeMask {
582+ get {
583+ return WindowMoveResizeMask.Width | WindowMoveResizeMask.Height;
584+ }
585+ }
586+
587+ WindowMoveResizeMask MoveResizeMask {
588+ get {
589+ return WindowMoveResizeMask.X |
590+ WindowMoveResizeMask.Y |
591+ WindowMoveResizeMask.Height |
592+ WindowMoveResizeMask.Width;
593+ }
594+ }
595+
596+ internal Viewport(string name, Rectangle area, Workspace parent)
597+ {
598+ this.area = area;
599+ this.parent = parent;
600+ Name = name;
601+ }
602+
603+ public void Present ()
604+ {
605+ parent.Screen.MoveViewport (area.X, area.Y);
606+ }
607+
608+ public bool Contains (Gdk.Point point)
609+ {
610+ return area.Contains (point);
611+ }
612+
613+ private IEnumerable<Wnck.Window> RawWindows ()
614+ {
615+ foreach (Wnck.Window window in WindowUtils.GetWindows ()) {
616+ if (WindowCenterInViewport (window) || window.IsSticky)
617+ yield return window;
618+ }
619+ }
620+
621+ public IEnumerable<Wnck.Window> Windows ()
622+ {
623+ return RawWindows ().Where (w => !w.IsSkipTasklist && w.WindowType != Wnck.WindowType.Dock);
624+ }
625+
626+ public IEnumerable<Wnck.Window> UnprocessedWindows ()
627+ {
628+ return RawWindows ().Where (w => w.WindowType != Wnck.WindowType.Dock);
629+ }
630+
631+ public void MoveWindowInto (Wnck.Window window)
632+ {
633+ if (parent.IsVirtual) {
634+ Rectangle geo = window.EasyGeometry ();
635+
636+ geo.X += window.Workspace.ViewportX;
637+ geo.Y += window.Workspace.ViewportY;
638+
639+ int x = area.X + (geo.X % area.Width);
640+ int y = area.Y + (geo.Y % area.Height);
641+
642+ x -= window.Workspace.ViewportX;
643+ y -= window.Workspace.ViewportY;
644+
645+ window.SetWorkaroundGeometry (WindowGravity.Current, MoveMask, x, y, 0, 0);
646+ } else {
647+ window.MoveToWorkspace (parent);
648+ }
649+ }
650+
651+ bool WindowCenterInViewport (Wnck.Window window)
652+ {
653+ if (!window.IsOnWorkspace (parent))
654+ return false;
655+
656+ Rectangle geo = window.EasyGeometry ();
657+ geo.X += parent.ViewportX;
658+ geo.Y += parent.ViewportY;
659+
660+ Point center = new Point (geo.X + geo.Width / 2, geo.Y + geo.Height / 2);
661+ return Contains (center);
662+ }
663+
664+ public void RestoreLayout ()
665+ {
666+ foreach (Wnck.Window window in Windows ())
667+ RestoreTemporaryWindowGeometry (window);
668+ }
669+
670+ public void Cascade ()
671+ {
672+ IEnumerable<Wnck.Window> windows = Windows ().Where (w => !w.IsMinimized);
673+ if (windows.Count () <= 1) return;
674+
675+ Gdk.Rectangle screenGeo = GetScreenGeoMinusStruts ();
676+
677+ int titleBarSize = windows.First ().FrameExtents () [(int) Position.Top];
678+ int windowHeight = screenGeo.Height - ((windows.Count () - 1) * titleBarSize);
679+ int windowWidth = screenGeo.Width - ((windows.Count () - 1) * titleBarSize);
680+
681+ int count = 0;
682+ int x, y;
683+ foreach (Wnck.Window window in windows) {
684+ x = screenGeo.X + titleBarSize * count - parent.ViewportX;
685+ y = screenGeo.Y + titleBarSize * count - parent.ViewportY;
686+
687+ SetTemporaryWindowGeometry (window, new Gdk.Rectangle (x, y, windowWidth, windowHeight));
688+ count++;
689+ }
690+ }
691+
692+ public void ShowDesktop ()
693+ {
694+ if (!ScreenUtils.DesktopShown (parent.Screen))
695+ ScreenUtils.ShowDesktop (parent.Screen);
696+ else
697+ ScreenUtils.UnshowDesktop (parent.Screen);
698+ }
699+
700+ public void Tile ()
701+ {
702+ IEnumerable<Wnck.Window> windows = Windows ().Where (w => !w.IsMinimized);
703+ if (windows.Count () <= 1) return;
704+
705+ Gdk.Rectangle screenGeo = GetScreenGeoMinusStruts ();
706+
707+ int width, height;
708+ //We are going to tile to a square, so what we want is to find
709+ //the smallest perfect square all our windows will fit into
710+ width = (int) Math.Ceiling (Math.Sqrt (windows.Count ()));
711+
712+ //Our height is at least one (e.g. a 2x1)
713+ height = 1;
714+ while (width * height < windows.Count ())
715+ height++;
716+
717+ int windowWidth, windowHeight;
718+ windowWidth = screenGeo.Width / width;
719+ windowHeight = screenGeo.Height / height;
720+
721+ int row = 0, column = 0;
722+ int x, y;
723+
724+ foreach (Wnck.Window window in windows) {
725+ x = screenGeo.X + (column * windowWidth) - parent.ViewportX;
726+ y = screenGeo.Y + (row * windowHeight) - parent.ViewportY;
727+
728+ Gdk.Rectangle windowArea = new Gdk.Rectangle (x, y, windowWidth, windowHeight);;
729+
730+ if (window == windows.Last ())
731+ windowArea.Width *= width - column;
732+
733+ SetTemporaryWindowGeometry (window, windowArea);
734+
735+ column++;
736+ if (column == width) {
737+ column = 0;
738+ row++;
739+ }
740+ }
741+ }
742+
743+ Gdk.Rectangle GetScreenGeoMinusStruts ()
744+ {
745+ IEnumerable<int []> struts = RawWindows ()
746+ .Where (w => w.WindowType == Wnck.WindowType.Dock)
747+ .Select (w => w.GetCardinalProperty (X11Atoms.Instance._NET_WM_STRUT_PARTIAL));
748+
749+ int [] offsets = new int [4];
750+ for (int i = 0; i < 4; i++)
751+ offsets [i] = struts.Max (a => a[i]);
752+
753+ Gdk.Rectangle screenGeo = Area;
754+ screenGeo.Width -= offsets [(int) Position.Left] + offsets [(int) Position.Right];
755+ screenGeo.Height -= offsets [(int) Position.Top] + offsets [(int) Position.Bottom];
756+ screenGeo.X += offsets [(int) Position.Left];
757+ screenGeo.Y += offsets [(int) Position.Top];
758+
759+ return screenGeo;
760+ }
761+
762+ void SetTemporaryWindowGeometry (Wnck.Window window, Gdk.Rectangle area)
763+ {
764+ Gdk.Rectangle oldGeo = window.EasyGeometry ();
765+
766+ oldGeo.X += parent.ViewportX;
767+ oldGeo.Y += parent.ViewportY;
768+
769+ if (!window_states.ContainsKey (window))
770+ window_states [window] = new WindowState (oldGeo, window.State);
771+
772+ if (window.IsMaximized)
773+ window.Unmaximize ();
774+
775+ window.SetWorkaroundGeometry (WindowGravity.Current, MoveResizeMask, area.X, area.Y, area.Width, area.Height);
776+ }
777+
778+ void RestoreTemporaryWindowGeometry (Wnck.Window window)
779+ {
780+ if (!window_states.ContainsKey (window))
781+ return;
782+
783+ WindowState state = window_states [window];
784+ window.SetWorkaroundGeometry (WindowGravity.Current, MoveResizeMask, state.Area.X - parent.ViewportX,
785+ state.Area.Y - parent.ViewportY, state.Area.Width, state.Area.Height);
786+
787+ window_states.Remove (window);
788+ }
789+ }
790+}
791
792=== added file 'WindowManager/src/Wink/WindowControl.cs'
793--- WindowManager/src/Wink/WindowControl.cs 1970-01-01 00:00:00 +0000
794+++ WindowManager/src/Wink/WindowControl.cs 2009-11-23 15:31:10 +0000
795@@ -0,0 +1,173 @@
796+// WindowControl.cs
797+//
798+// Copyright (C) 2008 GNOME Do
799+//
800+// This program is free software: you can redistribute it and/or modify
801+// it under the terms of the GNU General Public License as published by
802+// the Free Software Foundation, either version 3 of the License, or
803+// (at your option) any later version.
804+//
805+// This program is distributed in the hope that it will be useful,
806+// but WITHOUT ANY WARRANTY; without even the implied warranty of
807+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
808+// GNU General Public License for more details.
809+//
810+// You should have received a copy of the GNU General Public License
811+// along with this program. If not, see <http://www.gnu.org/licenses/>.
812+//
813+
814+using System;
815+using System.Collections.Generic;
816+using System.Linq;
817+
818+using Wnck;
819+
820+namespace WindowManager.Wink
821+{
822+
823+
824+ public static class WindowControl
825+ {
826+
827+ const int SleepTime = 10;
828+ const int FocusDelay = 200;
829+
830+ static WindowControl ()
831+ {
832+ Wnck.Global.ClientType = Wnck.ClientType.Pager;
833+ }
834+
835+ /// <summary>
836+ /// Handles intelligent minimize/restoring of windows. If one or more windows is minimized, it restores
837+ /// all windows. If more all are visible, it minimizes. This operation only takes into account windows
838+ /// on the current workspace (by design).
839+ /// </summary>
840+ /// <param name="windows">
841+ /// A <see cref="IEnumerable"/>
842+ /// </param>
843+ public static void MinimizeRestoreWindows (IEnumerable<Window> windows)
844+ {
845+ bool restore = false;
846+ foreach (Window w in windows) {
847+ if (w.IsMinimized) {
848+ restore = true;
849+ break;
850+ }
851+ }
852+ if (restore)
853+ RestoreWindows (windows);
854+ else
855+ MinimizeWindows (windows);
856+ }
857+
858+ /// <summary>
859+ /// Minimizes every window in the list if it is not minimized
860+ /// </summary>
861+ /// <param name="windows">
862+ /// A <see cref="IEnumerable"/>
863+ /// </param>
864+ public static void MinimizeWindows (IEnumerable<Window> windows)
865+ {
866+ foreach (Window window in windows) {
867+ if (window.IsInViewport (window.Screen.ActiveWorkspace) && !window.IsMinimized) {
868+ window.Minimize ();
869+ System.Threading.Thread.Sleep (SleepTime);
870+ }
871+ }
872+ }
873+
874+ /// <summary>
875+ /// Restores every window in the list that is minimized
876+ /// </summary>
877+ /// <param name="windows">
878+ /// A <see cref="IEnumerable"/>
879+ /// </param>
880+ public static void RestoreWindows (IEnumerable<Window> windows)
881+ {
882+ foreach (Window window in windows.Reverse ()) {
883+ if (window.IsInViewport (window.Screen.ActiveWorkspace) && window.IsMinimized) {
884+ window.Unminimize (Gtk.Global.CurrentEventTime);
885+ System.Threading.Thread.Sleep (SleepTime);
886+ }
887+ }
888+ }
889+
890+ public static void FocusWindows (IEnumerable<Window> windows)
891+ {
892+ if (!windows.Any ())
893+ return;
894+
895+ if (windows.Any (w => w.IsInViewport (w.Screen.ActiveWorkspace))) {
896+ foreach (Window window in windows.Reverse ()) {
897+ if (window.IsInViewport (window.Screen.ActiveWorkspace) && !window.IsMinimized) {
898+ window.CenterAndFocusWindow ();
899+ System.Threading.Thread.Sleep (SleepTime);
900+ }
901+ }
902+ } else {
903+ windows.First ().CenterAndFocusWindow ();
904+ }
905+
906+ if (windows.Count () <= 1)
907+ return;
908+
909+ // we do this to make sure our active window is also at the front... Its a tricky thing to do.
910+ // sometimes compiz plays badly. This hacks around it
911+ uint time = Gtk.Global.CurrentEventTime + FocusDelay;
912+ GLib.Timeout.Add (FocusDelay, delegate {
913+ try { //unimportant if this fails, its just "nice"
914+ windows.Where (w => w.IsInViewport (w.Screen.ActiveWorkspace) && !w.IsMinimized).First ().Activate (time);
915+ } catch { }
916+ return false;
917+ });
918+ }
919+
920+ public static void FocusWindows (Window window)
921+ {
922+ FocusWindows (new [] {window});
923+ }
924+
925+ public static void CloseWindows (IEnumerable<Window> windows)
926+ {
927+ foreach (Window window in windows.Where (w => !w.IsSkipTasklist))
928+ window.Close (Gtk.Global.CurrentEventTime);
929+ }
930+
931+ public static void CloseWindows (Window window)
932+ {
933+ CloseWindows (new [] {window});
934+ }
935+
936+ public static void MinimizeRestoreWindows (Window window)
937+ {
938+ MinimizeRestoreWindows (new [] {window});
939+ }
940+
941+ public static void MaximizeWindow (Window window)
942+ {
943+ window.Maximize ();
944+ }
945+
946+ /// <summary>
947+ /// Moves the current viewport to the selected window and then raises it
948+ /// </summary>
949+ /// <param name="w">
950+ /// A <see cref="Window"/>
951+ /// </param>
952+ public static void CenterAndFocusWindow (this Window w)
953+ {
954+ if (w == null)
955+ return;
956+
957+ uint time = Gtk.Global.CurrentEventTime;
958+ if (w.Workspace != null && w.Workspace != w.Screen.ActiveWorkspace)
959+ w.Workspace.Activate (time);
960+
961+
962+ if (w.IsMinimized)
963+ w.Unminimize (time);
964+
965+ w.ActivateTransient (time);
966+ }
967+ }
968+}
969
970=== added file 'WindowManager/src/Wink/WindowUtils.cs'
971--- WindowManager/src/Wink/WindowUtils.cs 1970-01-01 00:00:00 +0000
972+++ WindowManager/src/Wink/WindowUtils.cs 2009-11-23 15:31:10 +0000
973@@ -0,0 +1,402 @@
974+// WindowUtils.cs
975+//
976+// Copyright (C) 2008 GNOME Do
977+//
978+// This program is free software: you can redistribute it and/or modify
979+// it under the terms of the GNU General Public License as published by
980+// the Free Software Foundation, either version 3 of the License, or
981+// (at your option) any later version.
982+//
983+// This program is distributed in the hope that it will be useful,
984+// but WITHOUT ANY WARRANTY; without even the implied warranty of
985+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
986+// GNU General Public License for more details.
987+//
988+// You should have received a copy of the GNU General Public License
989+// along with this program. If not, see <http://www.gnu.org/licenses/>.
990+//
991+
992+using System;
993+using System.Collections.Generic;
994+using System.Diagnostics;
995+using System.IO;
996+using System.Linq;
997+using System.Text.RegularExpressions;
998+
999+using Do.Platform;
1000+
1001+using Wnck;
1002+
1003+namespace WindowManager.Wink
1004+{
1005+
1006+ public static class WindowUtils
1007+ {
1008+ enum OpenOfficeProducts {
1009+ Writer,
1010+ Calc,
1011+ Base,
1012+ Math,
1013+ Impress,
1014+ }
1015+
1016+ static bool initialized;
1017+
1018+ static string RemapFile {
1019+ get { return Path.Combine (Services.Paths.UserDataDirectory, "RemapFile"); }
1020+ }
1021+
1022+ static IEnumerable<string> PrefixStrings {
1023+ get {
1024+ yield return "gksu";
1025+ yield return "sudo";
1026+ yield return "java";
1027+ yield return "mono";
1028+ yield return "ruby";
1029+ yield return "padsp";
1030+ yield return "aoss";
1031+ yield return "python(\\d.\\d)?";
1032+ yield return "(ba)?sh";
1033+ }
1034+ }
1035+
1036+ public static IEnumerable<Regex> BadPrefixes { get; private set; }
1037+
1038+ static Dictionary<string, string> RemapDictionary { get; set; }
1039+
1040+ static List<Window> window_list;
1041+ static bool window_list_update_needed;
1042+
1043+ static Dictionary<int, string> exec_lines = new Dictionary<int, string> ();
1044+ static DateTime last_update = new DateTime (0);
1045+
1046+ #region ctor
1047+ public static void Initialize ()
1048+ {
1049+ if (initialized)
1050+ return;
1051+
1052+ initialized = true;
1053+ Wnck.Global.ClientType = Wnck.ClientType.Pager;
1054+
1055+ List<Regex> regex = new List<Regex> ();
1056+ foreach (string s in PrefixStrings) {
1057+ regex.Add (new Regex (string.Format ("^{0}$", s), RegexOptions.IgnoreCase));
1058+ }
1059+
1060+ BadPrefixes = regex.AsEnumerable ();
1061+
1062+ Wnck.Screen.Default.WindowClosed += delegate {
1063+ window_list_update_needed = true;
1064+ };
1065+
1066+ Wnck.Screen.Default.WindowOpened += delegate {
1067+ window_list_update_needed = true;
1068+ };
1069+
1070+ Wnck.Screen.Default.ApplicationOpened += delegate {
1071+ window_list_update_needed = true;
1072+ };
1073+
1074+ Wnck.Screen.Default.ApplicationClosed += delegate {
1075+ window_list_update_needed = true;
1076+ };
1077+
1078+ BuildRemapDictionary ();
1079+ }
1080+ #endregion
1081+
1082+ #region Private Methods
1083+ static void BuildRemapDictionary ()
1084+ {
1085+ if (!File.Exists (RemapFile)) {
1086+ RemapDictionary = BuildDefaultRemapDictionary ();
1087+
1088+ try {
1089+ using (StreamWriter writer = new StreamWriter (RemapFile)) {
1090+ writer.WriteLine ("# Docky Remap File");
1091+ writer.WriteLine ("# Add key value pairs following dictionary syntax");
1092+ writer.WriteLine ("# key, value");
1093+ writer.WriteLine ("# key, altKey, value");
1094+ writer.WriteLine ("# Lines starting with # are comments, otherwise # is a valid character");
1095+
1096+ foreach (KeyValuePair<string, string> kvp in RemapDictionary) {
1097+ writer.WriteLine ("{0}, {1}", kvp.Key, kvp.Value);
1098+ }
1099+ writer.Close ();
1100+ }
1101+ } catch {
1102+ }
1103+ } else {
1104+ RemapDictionary = new Dictionary<string, string> ();
1105+
1106+ try {
1107+ using (StreamReader reader = new StreamReader (RemapFile)) {
1108+ string line;
1109+ while (!reader.EndOfStream) {
1110+ line = reader.ReadLine ();
1111+ if (line.StartsWith ("#") || !line.Contains (","))
1112+ continue;
1113+ string [] array = line.Split (',');
1114+ if (array.Length < 2 || array [0].Length == 0)
1115+ continue;
1116+
1117+ string val = array [array.Length - 1].Trim ().ToLower ();
1118+ if (string.IsNullOrEmpty (val))
1119+ continue;
1120+
1121+ for (int i=0; i < array.Length - 1; i++) {
1122+ string key = array [i].Trim ().ToLower ();
1123+ if (string.IsNullOrEmpty (key))
1124+ continue;
1125+ RemapDictionary [key] = val;
1126+ }
1127+ }
1128+
1129+ reader.Close ();
1130+ }
1131+ } catch {
1132+ Log.Error ("Could not read remap file");
1133+ RemapDictionary = BuildDefaultRemapDictionary ();
1134+ }
1135+ }
1136+ }
1137+
1138+ static Dictionary<string, string> BuildDefaultRemapDictionary ()
1139+ {
1140+ Dictionary<string, string> remapDict = new Dictionary<string, string> ();
1141+ remapDict ["banshee.exe"] = "banshee";
1142+ remapDict ["banshee-1"] = "banshee";
1143+ remapDict ["azureus"] = "vuze";
1144+ remapDict ["thunderbird-3.0"] = "thunderbird";
1145+ remapDict ["thunderbird-bin"] = "thunderbird";
1146+
1147+ return remapDict;
1148+ }
1149+
1150+ static void UpdateExecList ()
1151+ {
1152+ if ((DateTime.UtcNow - last_update).TotalMilliseconds < 200) return;
1153+
1154+ Dictionary<int, string> old = exec_lines;
1155+
1156+ exec_lines = new Dictionary<int, string> ();
1157+
1158+ foreach (string dir in Directory.GetDirectories ("/proc")) {
1159+ int pid;
1160+ try { pid = Convert.ToInt32 (Path.GetFileName (dir)); }
1161+ catch { continue; }
1162+
1163+ if (old.ContainsKey (pid)) {
1164+ exec_lines [pid] = old [pid];
1165+ continue;
1166+ }
1167+
1168+ string exec_line = CmdLineForPid (pid);
1169+ if (string.IsNullOrEmpty (exec_line))
1170+ continue;
1171+
1172+ if (exec_line.Contains ("java") && exec_line.Contains ("jar")) {
1173+ foreach (Window window in GetWindows ()) {
1174+ if (window == null)
1175+ continue;
1176+
1177+ if (window.Pid == pid || window.Application.Pid == pid) {
1178+ exec_line = window.ClassGroup.ResClass;
1179+
1180+ // Vuze is retarded
1181+ if (exec_line == "SWT")
1182+ exec_line = window.Name;
1183+ }
1184+ }
1185+ }
1186+
1187+ exec_line = ProcessExecString (exec_line);
1188+
1189+ exec_lines [pid] = exec_line;
1190+ }
1191+
1192+ last_update = DateTime.UtcNow;
1193+ }
1194+ #endregion
1195+
1196+ #region Public Methods
1197+ /// <summary>
1198+ /// Returns a list of all windows on the default screen
1199+ /// </summary>
1200+ /// <returns>
1201+ /// A <see cref="List"/>
1202+ /// </returns>
1203+ public static List<Window> GetWindows ()
1204+ {
1205+ if (window_list == null || window_list_update_needed)
1206+ window_list = new List<Window> (Wnck.Screen.Default.WindowsStacked);
1207+
1208+ return window_list;
1209+ }
1210+
1211+ /// <summary>
1212+ /// Gets the command line excec string for a PID
1213+ /// </summary>
1214+ /// <param name="pid">
1215+ /// A <see cref="System.Int32"/>
1216+ /// </param>
1217+ /// <returns>
1218+ /// A <see cref="System.String"/>
1219+ /// </returns>
1220+ public static string CmdLineForPid (int pid)
1221+ {
1222+ string cmdline = null;
1223+
1224+ try {
1225+ string procPath = new [] { "/proc", pid.ToString (), "cmdline" }.Aggregate (Path.Combine);
1226+ using (StreamReader reader = new StreamReader (procPath)) {
1227+ cmdline = reader.ReadLine ();
1228+ reader.Close ();
1229+ }
1230+ } catch { }
1231+
1232+ return cmdline;
1233+ }
1234+
1235+ public static List<Window> WindowListForCmd (string exec)
1236+ {
1237+ List<Window> windows = new List<Window> ();
1238+ if (string.IsNullOrEmpty (exec))
1239+ return windows;
1240+
1241+ // open office hakk
1242+ if (exec.Contains ("ooffice")) {
1243+ return GetOpenOfficeWindows (exec);
1244+ }
1245+
1246+ exec = ProcessExecString (exec);
1247+ if (string.IsNullOrEmpty (exec))
1248+ return windows;
1249+
1250+ UpdateExecList ();
1251+
1252+ foreach (KeyValuePair<int, string> kvp in exec_lines) {
1253+ if (!string.IsNullOrEmpty (kvp.Value) && kvp.Value.Contains (exec)) {
1254+ // we have a matching exec, now we just find every window whose PID matches this exec
1255+ foreach (Window window in GetWindows ()) {
1256+ if (window == null)
1257+ continue;
1258+
1259+ // this window matches the right PID and exec string, we can match it.
1260+ bool pidMatch = window.Pid == kvp.Key ||
1261+ (window.Application != null && window.Application.Pid == kvp.Key);
1262+
1263+ if (pidMatch)
1264+ windows.Add (window);
1265+ }
1266+ }
1267+ }
1268+
1269+ return windows.Distinct ().ToList ();
1270+ }
1271+
1272+ static List<Window> GetOpenOfficeWindows (string exec)
1273+ {
1274+ if (exec.Contains ("writer")) {
1275+ return GetWindows ().Where ((Wnck.Window w) => w.Name.Contains ("OpenOffice.org Writer")).ToList ();
1276+ } else if (exec.Contains ("math")) {
1277+ return GetWindows ().Where ((Wnck.Window w) => w.Name.Contains ("OpenOffice.org Math")).ToList ();
1278+ } else if (exec.Contains ("calc")) {
1279+ return GetWindows ().Where ((Wnck.Window w) => w.Name.Contains ("OpenOffice.org Calc")).ToList ();
1280+ } else if (exec.Contains ("impress")) {
1281+ return GetWindows ().Where ((Wnck.Window w) => w.Name.Contains ("OpenOffice.org Impress")).ToList ();
1282+ } else if (exec.Contains ("draw")) {
1283+ return GetWindows ().Where ((Wnck.Window w) => w.Name.Contains ("OpenOffice.org Draw")).ToList ();
1284+ } else {
1285+ return new List<Window> (0);
1286+ }
1287+ }
1288+
1289+ /// <summary>
1290+ /// This method takes in an "execution string" from proc and applies a heureustic to try
1291+ /// to magic out the name of the actual executing application. The executing binary is not
1292+ /// the desired target all the time.
1293+ /// </summary>
1294+ /// <param name="exec">
1295+ /// A <see cref="System.String"/>
1296+ /// </param>
1297+ /// <returns>
1298+ /// A <see cref="System.String"/>
1299+ /// </returns>
1300+ static string ProcessExecString (string exec)
1301+ {
1302+ if (string.IsNullOrEmpty (exec))
1303+ return exec;
1304+
1305+ // lower it and trim off white space so we can abuse whitespace a bit
1306+ exec = exec.ToLower ().Trim ();
1307+
1308+ // if the user has specified a specific mapping, we can use that here
1309+ if (RemapDictionary.ContainsKey (exec))
1310+ return RemapDictionary [exec];
1311+
1312+ // this is the "split" character or the argument separator. If the string contains a null
1313+ // it was fetched from /proc/PID/cmdline and will be nicely split up. Otherwise things get a bit
1314+ // nasty, and it likely came from a .desktop file.
1315+ char splitChar = Convert.ToChar (0x0);
1316+ splitChar = exec.Contains (splitChar) ? splitChar : ' ';
1317+
1318+ // this part is here soley for the remap file so that users may specify to remap based on just the name
1319+ // without the full path. If no remap file match is found, the net effect of this is nothing.
1320+ if (exec.StartsWith ("/")) {
1321+ string first_part = exec.Split (splitChar) [0];
1322+ int length = first_part.Length;
1323+ first_part = first_part.Split ('/').Last ();
1324+
1325+ if (length < exec.Length)
1326+ first_part = first_part + " " + exec.Substring (length + 1);
1327+
1328+ if (RemapDictionary.ContainsKey (first_part)) {
1329+ return RemapDictionary [first_part];
1330+ }
1331+ }
1332+
1333+ string [] parts = exec.Split (splitChar);
1334+ for (int i = 0; i < parts.Length; i++) {
1335+ // we're going to use this a lot
1336+ string out_val = parts [i];
1337+
1338+ // arguments are useless
1339+ if (out_val.StartsWith ("-"))
1340+ continue;
1341+
1342+ // we want the end of paths
1343+ if (out_val.Contains ("/"))
1344+ out_val = out_val.Split ('/').Last ();
1345+
1346+ // wine apps can do it backwards... who knew?
1347+ if (out_val.Contains ("\\"))
1348+ out_val = out_val.Split ('\\').Last ();
1349+
1350+ // null out our part if is a bad prefix
1351+ foreach (Regex regex in BadPrefixes) {
1352+ if (regex.IsMatch (out_val)) {
1353+ out_val = null;
1354+ break;
1355+ }
1356+ }
1357+
1358+ // check if it was a bad prefix...
1359+ if (!string.IsNullOrEmpty (out_val)) {
1360+ // sometimes we hide things with shell scripts. This is the most common method of doing it.
1361+ if (out_val.EndsWith (".real"))
1362+ out_val = out_val.Substring (0, out_val.Length - ".real".Length);
1363+
1364+ // give the remap dictionary one last shot at this
1365+ if (RemapDictionary.ContainsKey (out_val))
1366+ out_val = RemapDictionary [out_val];
1367+ return out_val;
1368+ }
1369+ }
1370+ return null;
1371+ }
1372+
1373+ #endregion
1374+ }
1375+}
1376
1377=== added file 'WindowManager/src/Wink/WnckWindow_Extensions.cs'
1378--- WindowManager/src/Wink/WnckWindow_Extensions.cs 1970-01-01 00:00:00 +0000
1379+++ WindowManager/src/Wink/WnckWindow_Extensions.cs 2009-11-23 15:31:10 +0000
1380@@ -0,0 +1,94 @@
1381+//
1382+// Copyright (C) 2009 GNOME Do
1383+//
1384+// This program is free software: you can redistribute it and/or modify
1385+// it under the terms of the GNU General Public License as published by
1386+// the Free Software Foundation, either version 3 of the License, or
1387+// (at your option) any later version.
1388+//
1389+// This program is distributed in the hope that it will be useful,
1390+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1391+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1392+// GNU General Public License for more details.
1393+//
1394+// You should have received a copy of the GNU General Public License
1395+// along with this program. If not, see <http://www.gnu.org/licenses/>.
1396+//
1397+
1398+using System;
1399+using System.Collections.Generic;
1400+using System.Linq;
1401+using System.Runtime.InteropServices;
1402+
1403+using Wnck;
1404+using WindowManager.Xlib;
1405+
1406+namespace WindowManager.Wink
1407+{
1408+
1409+
1410+ public static class WnckWindow_Extensions
1411+ {
1412+ public static int Area (this Wnck.Window self)
1413+ {
1414+ Gdk.Rectangle geo = self.EasyGeometry ();
1415+ return geo.Width * geo.Height;
1416+ }
1417+
1418+ public static Gdk.Rectangle EasyGeometry (this Wnck.Window self)
1419+ {
1420+ Gdk.Rectangle geo;
1421+ self.GetGeometry (out geo.X, out geo.Y, out geo.Width, out geo.Height);
1422+ return geo;
1423+ }
1424+
1425+ public static void SetWorkaroundGeometry (this Wnck.Window window, WindowGravity gravity, WindowMoveResizeMask mask,
1426+ int x, int y, int width, int height)
1427+ {
1428+ // This is very weird. Don't know when they will fix it. You must subtract the top and left
1429+ // frame extents from a move operation to get the window to actually show in the right spot.
1430+ // Save for maybe kwin, I think only compiz uses Viewports anyhow, so this is ok.
1431+ int [] extents = window.FrameExtents ();
1432+
1433+ x -= extents [(int) Position.Left];
1434+ y -= extents [(int) Position.Top];
1435+
1436+ window.SetGeometry (gravity, mask, x, y, width, height);
1437+ }
1438+
1439+ public static int [] FrameExtents (this Wnck.Window window)
1440+ {
1441+ return GetCardinalProperty (window, X11Atoms.Instance._NET_FRAME_EXTENTS);
1442+ }
1443+
1444+ public static int [] GetCardinalProperty (this Wnck.Window window, IntPtr atom)
1445+ {
1446+ X11Atoms atoms = X11Atoms.Instance;
1447+ IntPtr display;
1448+ IntPtr type;
1449+ int format;
1450+ IntPtr prop_return;
1451+ IntPtr nitems, bytes_after;
1452+ int result;
1453+ int [] extents = new int[12];
1454+
1455+ IntPtr window_handle = (IntPtr) window.Xid;
1456+
1457+ display = Xlib.Xlib.GdkDisplayXDisplay (Gdk.Screen.Default.Display);
1458+ type = IntPtr.Zero;
1459+
1460+ result = Xlib.Xlib.XGetWindowProperty (display, window_handle, atom, (IntPtr) 0,
1461+ (IntPtr) System.Int32.MaxValue, false, atoms.XA_CARDINAL, out type, out format,
1462+ out nitems, out bytes_after, out prop_return);
1463+
1464+ if (type == atoms.XA_CARDINAL && format == 32) {
1465+ extents = new int [(int) nitems];
1466+ for (int i = 0; i < (int) nitems; i++) {
1467+ extents [i] = Marshal.ReadInt32 (prop_return, i * IntPtr.Size);
1468+ }
1469+ }
1470+
1471+ return extents;
1472+ }
1473+ }
1474+}
1475
1476=== added directory 'WindowManager/src/Xlib'
1477=== added file 'WindowManager/src/Xlib/X11Atoms.cs'
1478--- WindowManager/src/Xlib/X11Atoms.cs 1970-01-01 00:00:00 +0000
1479+++ WindowManager/src/Xlib/X11Atoms.cs 2009-11-23 15:31:10 +0000
1480@@ -0,0 +1,336 @@
1481+// Permission is hereby granted, free of charge, to any person obtaining
1482+// a copy of this software and associated documentation files (the
1483+// "Software"), to deal in the Software without restriction, including
1484+// without limitation the rights to use, copy, modify, merge, publish,
1485+// distribute, sublicense, and/or sell copies of the Software, and to
1486+// permit persons to whom the Software is furnished to do so, subject to
1487+// the following conditions:
1488+//
1489+// The above copyright notice and this permission notice shall be
1490+// included in all copies or substantial portions of the Software.
1491+//
1492+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1493+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1494+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1495+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
1496+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
1497+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
1498+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1499+//
1500+// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
1501+//
1502+//
1503+
1504+using System;
1505+
1506+namespace WindowManager.Xlib {
1507+
1508+ public class X11Atoms {
1509+
1510+ static X11Atoms instance;
1511+ public static X11Atoms Instance {
1512+ get {
1513+ if (instance == null)
1514+ instance = new X11Atoms (Gdk.Screen.Default.Display);
1515+ return instance;
1516+ }
1517+ }
1518+
1519+ // Our atoms
1520+ public readonly IntPtr AnyPropertyType = (IntPtr)0;
1521+ public readonly IntPtr XA_PRIMARY = (IntPtr)1;
1522+ public readonly IntPtr XA_SECONDARY = (IntPtr)2;
1523+ public readonly IntPtr XA_ARC = (IntPtr)3;
1524+ public readonly IntPtr XA_ATOM = (IntPtr)4;
1525+ public readonly IntPtr XA_BITMAP = (IntPtr)5;
1526+ public readonly IntPtr XA_CARDINAL = (IntPtr)6;
1527+ public readonly IntPtr XA_COLORMAP = (IntPtr)7;
1528+ public readonly IntPtr XA_CURSOR = (IntPtr)8;
1529+ public readonly IntPtr XA_CUT_BUFFER0 = (IntPtr)9;
1530+ public readonly IntPtr XA_CUT_BUFFER1 = (IntPtr)10;
1531+ public readonly IntPtr XA_CUT_BUFFER2 = (IntPtr)11;
1532+ public readonly IntPtr XA_CUT_BUFFER3 = (IntPtr)12;
1533+ public readonly IntPtr XA_CUT_BUFFER4 = (IntPtr)13;
1534+ public readonly IntPtr XA_CUT_BUFFER5 = (IntPtr)14;
1535+ public readonly IntPtr XA_CUT_BUFFER6 = (IntPtr)15;
1536+ public readonly IntPtr XA_CUT_BUFFER7 = (IntPtr)16;
1537+ public readonly IntPtr XA_DRAWABLE = (IntPtr)17;
1538+ public readonly IntPtr XA_FONT = (IntPtr)18;
1539+ public readonly IntPtr XA_INTEGER = (IntPtr)19;
1540+ public readonly IntPtr XA_PIXMAP = (IntPtr)20;
1541+ public readonly IntPtr XA_POINT = (IntPtr)21;
1542+ public readonly IntPtr XA_RECTANGLE = (IntPtr)22;
1543+ public readonly IntPtr XA_RESOURCE_MANAGER = (IntPtr)23;
1544+ public readonly IntPtr XA_RGB_COLOR_MAP = (IntPtr)24;
1545+ public readonly IntPtr XA_RGB_BEST_MAP = (IntPtr)25;
1546+ public readonly IntPtr XA_RGB_BLUE_MAP = (IntPtr)26;
1547+ public readonly IntPtr XA_RGB_DEFAULT_MAP = (IntPtr)27;
1548+ public readonly IntPtr XA_RGB_GRAY_MAP = (IntPtr)28;
1549+ public readonly IntPtr XA_RGB_GREEN_MAP = (IntPtr)29;
1550+ public readonly IntPtr XA_RGB_RED_MAP = (IntPtr)30;
1551+ public readonly IntPtr XA_STRING = (IntPtr)31;
1552+ public readonly IntPtr XA_VISUALID = (IntPtr)32;
1553+ public readonly IntPtr XA_WINDOW = (IntPtr)33;
1554+ public readonly IntPtr XA_WM_COMMAND = (IntPtr)34;
1555+ public readonly IntPtr XA_WM_HINTS = (IntPtr)35;
1556+ public readonly IntPtr XA_WM_CLIENT_MACHINE = (IntPtr)36;
1557+ public readonly IntPtr XA_WM_ICON_NAME = (IntPtr)37;
1558+ public readonly IntPtr XA_WM_ICON_SIZE = (IntPtr)38;
1559+ public readonly IntPtr XA_WM_NAME = (IntPtr)39;
1560+ public readonly IntPtr XA_WM_NORMAL_HINTS = (IntPtr)40;
1561+ public readonly IntPtr XA_WM_SIZE_HINTS = (IntPtr)41;
1562+ public readonly IntPtr XA_WM_ZOOM_HINTS = (IntPtr)42;
1563+ public readonly IntPtr XA_MIN_SPACE = (IntPtr)43;
1564+ public readonly IntPtr XA_NORM_SPACE = (IntPtr)44;
1565+ public readonly IntPtr XA_MAX_SPACE = (IntPtr)45;
1566+ public readonly IntPtr XA_END_SPACE = (IntPtr)46;
1567+ public readonly IntPtr XA_SUPERSCRIPT_X = (IntPtr)47;
1568+ public readonly IntPtr XA_SUPERSCRIPT_Y = (IntPtr)48;
1569+ public readonly IntPtr XA_SUBSCRIPT_X = (IntPtr)49;
1570+ public readonly IntPtr XA_SUBSCRIPT_Y = (IntPtr)50;
1571+ public readonly IntPtr XA_UNDERLINE_POSITION = (IntPtr)51;
1572+ public readonly IntPtr XA_UNDERLINE_THICKNESS = (IntPtr)52;
1573+ public readonly IntPtr XA_STRIKEOUT_ASCENT = (IntPtr)53;
1574+ public readonly IntPtr XA_STRIKEOUT_DESCENT = (IntPtr)54;
1575+ public readonly IntPtr XA_ITALIC_ANGLE = (IntPtr)55;
1576+ public readonly IntPtr XA_X_HEIGHT = (IntPtr)56;
1577+ public readonly IntPtr XA_QUAD_WIDTH = (IntPtr)57;
1578+ public readonly IntPtr XA_WEIGHT = (IntPtr)58;
1579+ public readonly IntPtr XA_POINT_SIZE = (IntPtr)59;
1580+ public readonly IntPtr XA_RESOLUTION = (IntPtr)60;
1581+ public readonly IntPtr XA_COPYRIGHT = (IntPtr)61;
1582+ public readonly IntPtr XA_NOTICE = (IntPtr)62;
1583+ public readonly IntPtr XA_FONT_NAME = (IntPtr)63;
1584+ public readonly IntPtr XA_FAMILY_NAME = (IntPtr)64;
1585+ public readonly IntPtr XA_FULL_NAME = (IntPtr)65;
1586+ public readonly IntPtr XA_CAP_HEIGHT = (IntPtr)66;
1587+ public readonly IntPtr XA_WM_CLASS = (IntPtr)67;
1588+ public readonly IntPtr XA_WM_TRANSIENT_FOR = (IntPtr)68;
1589+
1590+ public readonly IntPtr WM_PROTOCOLS;
1591+ public readonly IntPtr WM_DELETE_WINDOW;
1592+ public readonly IntPtr WM_TAKE_FOCUS;
1593+ public readonly IntPtr _NET_SUPPORTED;
1594+ public readonly IntPtr _NET_CLIENT_LIST;
1595+ public readonly IntPtr _NET_NUMBER_OF_DESKTOPS;
1596+ public readonly IntPtr _NET_DESKTOP_GEOMETRY;
1597+ public readonly IntPtr _NET_DESKTOP_VIEWPORT;
1598+ public readonly IntPtr _NET_CURRENT_DESKTOP;
1599+ public readonly IntPtr _NET_DESKTOP_NAMES;
1600+ public readonly IntPtr _NET_ACTIVE_WINDOW;
1601+ public readonly IntPtr _NET_WORKAREA;
1602+ public readonly IntPtr _NET_SUPPORTING_WM_CHECK;
1603+ public readonly IntPtr _NET_VIRTUAL_ROOTS;
1604+ public readonly IntPtr _NET_DESKTOP_LAYOUT;
1605+ public readonly IntPtr _NET_SHOWING_DESKTOP;
1606+ public readonly IntPtr _NET_CLOSE_WINDOW;
1607+ public readonly IntPtr _NET_MOVERESIZE_WINDOW;
1608+ public readonly IntPtr _NET_WM_MOVERESIZE;
1609+ public readonly IntPtr _NET_RESTACK_WINDOW;
1610+ public readonly IntPtr _NET_REQUEST_FRAME_EXTENTS;
1611+ public readonly IntPtr _NET_WM_NAME;
1612+ public readonly IntPtr _NET_WM_VISIBLE_NAME;
1613+ public readonly IntPtr _NET_WM_ICON_NAME;
1614+ public readonly IntPtr _NET_WM_VISIBLE_ICON_NAME;
1615+ public readonly IntPtr _NET_WM_DESKTOP;
1616+ public readonly IntPtr _NET_WM_WINDOW_TYPE;
1617+ public readonly IntPtr _NET_WM_STATE;
1618+ public readonly IntPtr _NET_WM_ALLOWED_ACTIONS;
1619+ public readonly IntPtr _NET_WM_STRUT;
1620+ public readonly IntPtr _NET_WM_STRUT_PARTIAL;
1621+ public readonly IntPtr _NET_WM_ICON_GEOMETRY;
1622+ public readonly IntPtr _NET_WM_ICON;
1623+ public readonly IntPtr _NET_WM_PID;
1624+ public readonly IntPtr _NET_WM_HANDLED_ICONS;
1625+ public readonly IntPtr _NET_WM_USER_TIME;
1626+ public readonly IntPtr _NET_FRAME_EXTENTS;
1627+ public readonly IntPtr _NET_WM_PING;
1628+ public readonly IntPtr _NET_WM_SYNC_REQUEST;
1629+ public readonly IntPtr _NET_SYSTEM_TRAY_ORIENTATION;
1630+ public readonly IntPtr _NET_SYSTEM_TRAY_OPCODE;
1631+ public readonly IntPtr _NET_WM_STATE_MAXIMIZED_HORZ;
1632+ public readonly IntPtr _NET_WM_STATE_MAXIMIZED_VERT;
1633+ public readonly IntPtr _XEMBED;
1634+ public readonly IntPtr _XEMBED_INFO;
1635+ public readonly IntPtr _MOTIF_WM_HINTS;
1636+ public readonly IntPtr _NET_WM_STATE_SKIP_TASKBAR;
1637+ public readonly IntPtr _NET_WM_STATE_ABOVE;
1638+ public readonly IntPtr _NET_WM_STATE_MODAL;
1639+ public readonly IntPtr _NET_WM_STATE_HIDDEN;
1640+ public readonly IntPtr _NET_WM_CONTEXT_HELP;
1641+ public readonly IntPtr _NET_WM_WINDOW_OPACITY;
1642+ public readonly IntPtr _NET_WM_WINDOW_TYPE_DESKTOP;
1643+ public readonly IntPtr _NET_WM_WINDOW_TYPE_DOCK;
1644+ public readonly IntPtr _NET_WM_WINDOW_TYPE_TOOLBAR;
1645+ public readonly IntPtr _NET_WM_WINDOW_TYPE_MENU;
1646+ public readonly IntPtr _NET_WM_WINDOW_TYPE_UTILITY;
1647+ public readonly IntPtr _NET_WM_WINDOW_TYPE_SPLASH;
1648+ public readonly IntPtr _NET_WM_WINDOW_TYPE_DIALOG;
1649+ public readonly IntPtr _NET_WM_WINDOW_TYPE_NORMAL;
1650+ public readonly IntPtr _COMPIZ_WM_WINDOW_BLUR;
1651+ public readonly IntPtr CLIPBOARD;
1652+ public readonly IntPtr PRIMARY;
1653+ public readonly IntPtr DIB;
1654+ public readonly IntPtr OEMTEXT;
1655+ public readonly IntPtr UNICODETEXT;
1656+ public readonly IntPtr TARGETS;
1657+ public readonly IntPtr PostAtom;
1658+ public readonly IntPtr AsyncAtom;
1659+
1660+
1661+ X11Atoms (Gdk.Display dsp) {
1662+ IntPtr display = Xlib.GdkDisplayXDisplay (dsp);
1663+ // make sure this array stays in sync with the statements below
1664+ string [] atom_names = new string[] {
1665+ "WM_PROTOCOLS",
1666+ "WM_DELETE_WINDOW",
1667+ "WM_TAKE_FOCUS",
1668+ "_NET_SUPPORTED",
1669+ "_NET_CLIENT_LIST",
1670+ "_NET_NUMBER_OF_DESKTOPS",
1671+ "_NET_DESKTOP_GEOMETRY",
1672+ "_NET_DESKTOP_VIEWPORT",
1673+ "_NET_CURRENT_DESKTOP",
1674+ "_NET_DESKTOP_NAMES",
1675+ "_NET_ACTIVE_WINDOW",
1676+ "_NET_WORKAREA",
1677+ "_NET_SUPPORTING_WM_CHECK",
1678+ "_NET_VIRTUAL_ROOTS",
1679+ "_NET_DESKTOP_LAYOUT",
1680+ "_NET_SHOWING_DESKTOP",
1681+ "_NET_CLOSE_WINDOW",
1682+ "_NET_MOVERESIZE_WINDOW",
1683+ "_NET_WM_MOVERESIZE",
1684+ "_NET_RESTACK_WINDOW",
1685+ "_NET_REQUEST_FRAME_EXTENTS",
1686+ "_NET_WM_NAME",
1687+ "_NET_WM_VISIBLE_NAME",
1688+ "_NET_WM_ICON_NAME",
1689+ "_NET_WM_VISIBLE_ICON_NAME",
1690+ "_NET_WM_DESKTOP",
1691+ "_NET_WM_WINDOW_TYPE",
1692+ "_NET_WM_STATE",
1693+ "_NET_WM_ALLOWED_ACTIONS",
1694+ "_NET_WM_STRUT",
1695+ "_NET_WM_STRUT_PARTIAL",
1696+ "_NET_WM_ICON_GEOMETRY",
1697+ "_NET_WM_ICON",
1698+ "_NET_WM_PID",
1699+ "_NET_WM_HANDLED_ICONS",
1700+ "_NET_WM_USER_TIME",
1701+ "_NET_FRAME_EXTENTS",
1702+ "_NET_WM_PING",
1703+ "_NET_WM_SYNC_REQUEST",
1704+ "_NET_SYSTEM_TRAY_OPCODE",
1705+ "_NET_SYSTEM_TRAY_ORIENTATION",
1706+ "_NET_WM_STATE_MAXIMIZED_HORZ",
1707+ "_NET_WM_STATE_MAXIMIZED_VERT",
1708+ "_NET_WM_STATE_HIDDEN",
1709+ "_XEMBED",
1710+ "_XEMBED_INFO",
1711+ "_MOTIF_WM_HINTS",
1712+ "_NET_WM_STATE_SKIP_TASKBAR",
1713+ "_NET_WM_STATE_ABOVE",
1714+ "_NET_WM_STATE_MODAL",
1715+ "_NET_WM_CONTEXT_HELP",
1716+ "_NET_WM_WINDOW_OPACITY",
1717+ "_NET_WM_WINDOW_TYPE_DESKTOP",
1718+ "_NET_WM_WINDOW_TYPE_DOCK",
1719+ "_NET_WM_WINDOW_TYPE_TOOLBAR",
1720+ "_NET_WM_WINDOW_TYPE_MENU",
1721+ "_NET_WM_WINDOW_TYPE_UTILITY",
1722+ "_NET_WM_WINDOW_TYPE_DIALOG",
1723+ "_NET_WM_WINDOW_TYPE_SPLASH",
1724+ "_NET_WM_WINDOW_TYPE_NORMAL",
1725+ "_COMPIZ_WM_WINDOW_BLUR",
1726+ "CLIPBOARD",
1727+ "PRIMARY",
1728+ "COMPOUND_TEXT",
1729+ "UTF8_STRING",
1730+ "TARGETS",
1731+ "_SWF_AsyncAtom",
1732+ "_SWF_PostMessageAtom",
1733+ "_SWF_HoverAtom",
1734+ };
1735+
1736+ IntPtr[] atoms = new IntPtr [atom_names.Length];;
1737+
1738+ Xlib.XInternAtoms (display, atom_names, atom_names.Length, false, atoms);
1739+
1740+ int off = 0;
1741+ WM_PROTOCOLS = atoms [off++];
1742+ WM_DELETE_WINDOW = atoms [off++];
1743+ WM_TAKE_FOCUS = atoms [off++];
1744+ _NET_SUPPORTED = atoms [off++];
1745+ _NET_CLIENT_LIST = atoms [off++];
1746+ _NET_NUMBER_OF_DESKTOPS = atoms [off++];
1747+ _NET_DESKTOP_GEOMETRY = atoms [off++];
1748+ _NET_DESKTOP_VIEWPORT = atoms [off++];
1749+ _NET_CURRENT_DESKTOP = atoms [off++];
1750+ _NET_DESKTOP_NAMES = atoms [off++];
1751+ _NET_ACTIVE_WINDOW = atoms [off++];
1752+ _NET_WORKAREA = atoms [off++];
1753+ _NET_SUPPORTING_WM_CHECK = atoms [off++];
1754+ _NET_VIRTUAL_ROOTS = atoms [off++];
1755+ _NET_DESKTOP_LAYOUT = atoms [off++];
1756+ _NET_SHOWING_DESKTOP = atoms [off++];
1757+ _NET_CLOSE_WINDOW = atoms [off++];
1758+ _NET_MOVERESIZE_WINDOW = atoms [off++];
1759+ _NET_WM_MOVERESIZE = atoms [off++];
1760+ _NET_RESTACK_WINDOW = atoms [off++];
1761+ _NET_REQUEST_FRAME_EXTENTS = atoms [off++];
1762+ _NET_WM_NAME = atoms [off++];
1763+ _NET_WM_VISIBLE_NAME = atoms [off++];
1764+ _NET_WM_ICON_NAME = atoms [off++];
1765+ _NET_WM_VISIBLE_ICON_NAME = atoms [off++];
1766+ _NET_WM_DESKTOP = atoms [off++];
1767+ _NET_WM_WINDOW_TYPE = atoms [off++];
1768+ _NET_WM_STATE = atoms [off++];
1769+ _NET_WM_ALLOWED_ACTIONS = atoms [off++];
1770+ _NET_WM_STRUT = atoms [off++];
1771+ _NET_WM_STRUT_PARTIAL = atoms [off++];
1772+ _NET_WM_ICON_GEOMETRY = atoms [off++];
1773+ _NET_WM_ICON = atoms [off++];
1774+ _NET_WM_PID = atoms [off++];
1775+ _NET_WM_HANDLED_ICONS = atoms [off++];
1776+ _NET_WM_USER_TIME = atoms [off++];
1777+ _NET_FRAME_EXTENTS = atoms [off++];
1778+ _NET_WM_PING = atoms [off++];
1779+ _NET_WM_SYNC_REQUEST = atoms [off++];
1780+ _NET_SYSTEM_TRAY_OPCODE = atoms [off++];
1781+ _NET_SYSTEM_TRAY_ORIENTATION = atoms [off++];
1782+ _NET_WM_STATE_MAXIMIZED_HORZ = atoms [off++];
1783+ _NET_WM_STATE_MAXIMIZED_VERT = atoms [off++];
1784+ _NET_WM_STATE_HIDDEN = atoms [off++];
1785+ _XEMBED = atoms [off++];
1786+ _XEMBED_INFO = atoms [off++];
1787+ _MOTIF_WM_HINTS = atoms [off++];
1788+ _NET_WM_STATE_SKIP_TASKBAR = atoms [off++];
1789+ _NET_WM_STATE_ABOVE = atoms [off++];
1790+ _NET_WM_STATE_MODAL = atoms [off++];
1791+ _NET_WM_CONTEXT_HELP = atoms [off++];
1792+ _NET_WM_WINDOW_OPACITY = atoms [off++];
1793+ _NET_WM_WINDOW_TYPE_DESKTOP = atoms [off++];
1794+ _NET_WM_WINDOW_TYPE_DOCK = atoms [off++];
1795+ _NET_WM_WINDOW_TYPE_TOOLBAR = atoms [off++];
1796+ _NET_WM_WINDOW_TYPE_MENU = atoms [off++];
1797+ _NET_WM_WINDOW_TYPE_UTILITY = atoms [off++];
1798+ _NET_WM_WINDOW_TYPE_DIALOG = atoms [off++];
1799+ _NET_WM_WINDOW_TYPE_SPLASH = atoms [off++];
1800+ _NET_WM_WINDOW_TYPE_NORMAL = atoms [off++];
1801+ _COMPIZ_WM_WINDOW_BLUR = atoms [off++];
1802+ CLIPBOARD = atoms [off++];
1803+ PRIMARY = atoms [off++];
1804+ OEMTEXT = atoms [off++];
1805+ UNICODETEXT = atoms [off++];
1806+ TARGETS = atoms [off++];
1807+ AsyncAtom = atoms [off++];
1808+ PostAtom = atoms [off++];
1809+
1810+ DIB = XA_PIXMAP;
1811+ }
1812+
1813+ }
1814+
1815+}
1816+
1817
1818=== added file 'WindowManager/src/Xlib/Xlib.cs'
1819--- WindowManager/src/Xlib/Xlib.cs 1970-01-01 00:00:00 +0000
1820+++ WindowManager/src/Xlib/Xlib.cs 2009-11-23 15:31:10 +0000
1821@@ -0,0 +1,126 @@
1822+// Permission is hereby granted, free of charge, to any person obtaining
1823+// a copy of this software and associated documentation files (the
1824+// "Software"), to deal in the Software without restriction, including
1825+// without limitation the rights to use, copy, modify, merge, publish,
1826+// distribute, sublicense, and/or sell copies of the Software, and to
1827+// permit persons to whom the Software is furnished to do so, subject to
1828+// the following conditions:
1829+//
1830+// The above copyright notice and this permission notice shall be
1831+// included in all copies or substantial portions of the Software.
1832+//
1833+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1834+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1835+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1836+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
1837+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
1838+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
1839+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1840+//
1841+// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
1842+//
1843+//
1844+
1845+using System;
1846+using System.Text;
1847+using System.Runtime.InteropServices;
1848+using System.Collections.Generic;
1849+using System.Linq;
1850+
1851+namespace WindowManager.Xlib {
1852+
1853+ public enum PropertyMode
1854+ {
1855+ PropModeReplace = 0,
1856+ PropModePrepend = 1,
1857+ PropModeAppend = 2,
1858+ }
1859+
1860+ public enum Struts
1861+ {
1862+ Left = 0,
1863+ Right = 1,
1864+ Top = 2,
1865+ Bottom = 3,
1866+ LeftStart = 4,
1867+ LeftEnd = 5,
1868+ RightStart = 6,
1869+ RightEnd = 7,
1870+ TopStart = 8,
1871+ TopEnd = 9,
1872+ BottomStart = 10,
1873+ BottomEnd = 11
1874+ }
1875+
1876+ public enum XGravity
1877+ {
1878+ ForgetGravity = 0,
1879+ NorthWestGravity = 1,
1880+ NorthGravity = 2,
1881+ NorthEastGravity = 3,
1882+ WestGravity = 4,
1883+ CenterGravity = 5,
1884+ EastGravity = 6,
1885+ SouthWestGravity = 7,
1886+ SouthGravity = 8,
1887+ SouthEastGravity = 9,
1888+ StaticGravity = 10,
1889+ }
1890+
1891+ public static class Xlib {
1892+ const string libX11 = "X11";
1893+ const string libGdkX11 = "libgdk-x11";
1894+
1895+ [DllImport (libGdkX11)]
1896+ static extern IntPtr gdk_x11_drawable_get_xid (IntPtr handle);
1897+
1898+ [DllImport (libGdkX11)]
1899+ static extern IntPtr gdk_x11_drawable_get_xdisplay (IntPtr handle);
1900+
1901+ [DllImport (libGdkX11)]
1902+ static extern IntPtr gdk_x11_display_get_xdisplay (IntPtr display);
1903+
1904+ [DllImport (libGdkX11)]
1905+ static extern void gdk_x11_window_set_user_time (IntPtr window, uint timestamp);
1906+
1907+ [DllImport (libX11)]
1908+ public extern static IntPtr XOpenDisplay (IntPtr display);
1909+
1910+ [DllImport (libX11)]
1911+ public extern static int XInternAtoms (IntPtr display, string[] atom_names, int atom_count, bool only_if_exists, IntPtr[] atoms);
1912+
1913+ [DllImport (libX11)]
1914+ extern static int XChangeProperty (IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, int mode, IntPtr[] data, int nelements);
1915+
1916+ [DllImport (libX11)]
1917+ public extern static int XGetWindowProperty (IntPtr display, IntPtr window, IntPtr atom, IntPtr long_offset,
1918+ IntPtr long_length, bool delete, IntPtr req_type, out IntPtr actual_type,
1919+ out int actual_format, out IntPtr nitems, out IntPtr bytes_after, out IntPtr prop);
1920+
1921+ public static IntPtr GdkWindowX11Xid (Gdk.Window window)
1922+ {
1923+ return gdk_x11_drawable_get_xid (window.Handle);
1924+ }
1925+
1926+ public static IntPtr GdkDrawableXDisplay (Gdk.Window window)
1927+ {
1928+ return gdk_x11_drawable_get_xdisplay (window.Handle);
1929+ }
1930+
1931+ public static IntPtr GdkDisplayXDisplay (Gdk.Display display)
1932+ {
1933+ return gdk_x11_display_get_xdisplay (display.Handle);
1934+ }
1935+
1936+ public static int XChangeProperty (Gdk.Window window, IntPtr property, IntPtr type, int mode, IntPtr[] data)
1937+ {
1938+ return XChangeProperty (GdkDrawableXDisplay (window), GdkWindowX11Xid (window), property, type, 32, mode, data, data.Length);
1939+ }
1940+
1941+ public static void GdkWindowSetUserTime (Gdk.Window window, uint timestamp)
1942+ {
1943+ gdk_x11_window_set_user_time (window.Handle, timestamp);
1944+ }
1945+
1946+ }
1947+}
1948
1949=== modified file 'configure.ac'
1950--- configure.ac 2009-11-08 23:58:01 +0000
1951+++ configure.ac 2009-11-23 15:31:10 +0000
1952@@ -211,12 +211,10 @@
1953 PKG_CHECK_MODULES([DO_PLATFORM], [do.platform >= 0.8])
1954 PKG_CHECK_MODULES([DO_PLATFORM_LINUX], [do.platform.linux >= 0.8])
1955 PKG_CHECK_MODULES([DO_UNIVERSE], [do.universe >= 0.8])
1956-PKG_CHECK_MODULES([DO_INTERFACE_WINK], [do.interface.wink >= 0.8])
1957
1958 AC_SUBST([DO_PLATFORM_LIBS])
1959 AC_SUBST([DO_PLATFORM_LINUX_LIBS])
1960 AC_SUBST([DO_UNIVERSE_LIBS])
1961-AC_SUBST([DO_INTERFACE_WINK_LIBS])
1962
1963 AC_ARG_ENABLE(debug,
1964 AC_HELP_STRING([--enable-debug],

Subscribers

People subscribed via source and target branches