Merge lp:~unity-team/unity/death-to-wncky into lp:unity

Proposed by Jason Smith
Status: Merged
Approved by: Gord Allott
Approved revision: no longer in the source branch.
Merged at revision: 326
Proposed branch: lp:~unity-team/unity/death-to-wncky
Merge into: lp:unity
Diff against target: 592 lines (+106/-263)
11 files modified
configure.ac (+0/-1)
targets/mutter/Makefile.am (+0/-1)
targets/mutter/expose-manager.vala (+30/-35)
targets/mutter/plugin.vala (+70/-211)
targets/mutter/window-management.vala (+5/-9)
targets/unity/Makefile.am (+0/-1)
targets/unity/main.vala (+0/-1)
tests/ui/Makefile.am (+0/-1)
tests/unit/Makefile.am (+0/-1)
unity-private/testing/test-window.vala (+1/-1)
unity/Makefile.am (+0/-1)
To merge this branch: bzr merge lp:~unity-team/unity/death-to-wncky
Reviewer Review Type Date Requested Status
Gord Allott (community) Approve
Review via email: mp+27217@code.launchpad.net

Description of the change

Removes build deps on libwnck except in the testing case.

To post a comment you must log in.
Revision history for this message
Gord Allott (gordallott) wrote :

seems to work okay for me, approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure.ac'
2--- configure.ac 2010-06-08 08:55:30 +0000
3+++ configure.ac 2010-06-10 00:36:28 +0000
4@@ -107,7 +107,6 @@
5 gconf-2.0
6 indicator
7 libbamf >= 0.2
8- libwnck-1.0 >= 2.28.0
9 unique-1.0
10 unity-misc
11 x11)
12
13=== modified file 'targets/mutter/Makefile.am'
14--- targets/mutter/Makefile.am 2010-06-04 11:23:01 +0000
15+++ targets/mutter/Makefile.am 2010-06-10 00:36:28 +0000
16@@ -44,7 +44,6 @@
17 --pkg gee-1.0 \
18 --pkg indicator \
19 --pkg mutter-2.28 \
20- --pkg libwnck-1.0 \
21 --pkg unique-1.0 \
22 --pkg x11 \
23 --pkg unity-const \
24
25=== modified file 'targets/mutter/expose-manager.vala'
26--- targets/mutter/expose-manager.vala 2010-04-26 13:47:08 +0000
27+++ targets/mutter/expose-manager.vala 2010-06-10 00:36:28 +0000
28@@ -26,7 +26,7 @@
29 private Clutter.Actor darken_box;
30 private bool hovered;
31
32- public unowned Mutter.Window source { get; private set; }
33+ public unowned Clutter.Actor source { get; private set; }
34
35 public uint8 hovered_opacity { get; set; }
36 public uint8 unhovered_opacity { get; set; }
37@@ -41,7 +41,7 @@
38 }
39 }
40
41- public ExposeClone (Mutter.Window source)
42+ public ExposeClone (Clutter.Actor source)
43 {
44 darken = 0;
45 hovered_opacity = 255;
46@@ -130,7 +130,7 @@
47 {
48 }
49
50- public void start_expose (SList<Wnck.Window> windows)
51+ public void start_expose (SList<Clutter.Actor> windows)
52 {
53 var controller = Launcher.QuicklistController.get_default ();
54 if (controller.menu_is_open ())
55@@ -150,36 +150,28 @@
56 expose_group.raise_top ();
57 expose_group.show ();
58
59- unowned GLib.List<Mutter.Window> mutter_windows = owner.plugin.get_windows ();
60- foreach (Mutter.Window w in mutter_windows)
61+ foreach (Clutter.Actor actor in windows)
62 {
63- bool keep = false;
64- ulong xid = (ulong) Mutter.MetaWindow.get_xwindow (w.get_meta_window ());
65- foreach (Wnck.Window window in windows)
66- {
67- if (window.get_xid () == xid)
68- {
69- keep = true;
70- break;
71- }
72- }
73-
74- if (keep)
75- {
76- ExposeClone clone = new ExposeClone (w);
77- clone.set_position (w.x, w.y);
78- clone.set_size (w.width, w.height);
79- exposed_windows.append (clone);
80- clone.reactive = true;
81-
82- expose_group.add_actor (clone);
83-
84- clone.hovered_opacity = hovered_opacity;
85- clone.unhovered_opacity = unhovered_opacity;
86- clone.opacity = unhovered_opacity;
87- clone.darken = darken;
88-
89- clone.enter_event.connect (() => {
90+ if (!(actor is Mutter.Window) ||
91+ ((actor as Mutter.Window).get_window_type () != Mutter.MetaCompWindowType.NORMAL &&
92+ (actor as Mutter.Window).get_window_type () != Mutter.MetaCompWindowType.DIALOG &&
93+ (actor as Mutter.Window).get_window_type () != Mutter.MetaCompWindowType.MODAL_DIALOG))
94+ continue;
95+
96+ ExposeClone clone = new ExposeClone (actor);
97+ clone.set_position (actor.x, actor.y);
98+ clone.set_size (actor.width, actor.height);
99+ exposed_windows.append (clone);
100+ clone.reactive = true;
101+
102+ expose_group.add_actor (clone);
103+
104+ clone.hovered_opacity = hovered_opacity;
105+ clone.unhovered_opacity = unhovered_opacity;
106+ clone.opacity = unhovered_opacity;
107+ clone.darken = darken;
108+
109+ clone.enter_event.connect (() => {
110 var ql_controller = Launcher.QuicklistController.get_default ();
111 if (ql_controller.menu_is_open () && this.menu_in_hover_close_state)
112 {
113@@ -188,7 +180,7 @@
114 return false;
115 });
116
117- clone.leave_event.connect (() => {
118+ clone.leave_event.connect (() => {
119 var ql_controller = Launcher.QuicklistController.get_default ();
120 if (ql_controller.menu_is_open () && this.menu_in_hover_close_state)
121 {
122@@ -196,8 +188,11 @@
123 }
124 return false;
125 });
126- }
127-
128+ }
129+
130+ unowned GLib.List<Mutter.Window> mutter_windows = owner.plugin.get_windows ();
131+ foreach (Mutter.Window w in mutter_windows)
132+ {
133 if (w.get_window_type () == Mutter.MetaCompWindowType.DESKTOP)
134 continue;
135
136
137=== modified file 'targets/mutter/plugin.vala'
138--- targets/mutter/plugin.vala 2010-06-08 13:50:40 +0000
139+++ targets/mutter/plugin.vala 2010-06-10 00:36:28 +0000
140@@ -238,12 +238,6 @@
141 this.background.lower_bottom ();
142 this.background.show ();
143
144- /* Allows us to activate windows, essential as we are the WM */
145-/*
146- LibLauncher.Application.set_window_activate_func (this.on_window_activated,
147- this.plugin);
148-*/
149-
150 this.launcher = new Launcher.Launcher (this);
151 this.launcher.get_view ().opacity = 0;
152
153@@ -297,100 +291,9 @@
154 }
155
156 this.ensure_input_region ();
157-
158- Wnck.Screen.get_default ().active_window_changed.connect (on_active_window_changed);
159-
160- if (Wnck.Screen.get_default ().get_active_window () != null)
161- Wnck.Screen.get_default ().get_active_window ().state_changed.connect (on_active_window_state_changed);
162-
163 return false;
164 }
165
166- private static void on_window_activated (Wnck.Window window,
167- uint32 timestamp,
168- void *data)
169- {
170- Mutter.Plugin plugin = data as Mutter.Plugin;
171-
172- unowned GLib.List<Mutter.Window> mutter_windows = plugin.get_windows ();
173- foreach (Mutter.Window w in mutter_windows)
174- {
175- ulong xid = (ulong) Mutter.MetaWindow.get_xwindow (w.get_meta_window ());
176- if (window.get_xid () == xid)
177- {
178- unowned Mutter.MetaWindow win = w.get_meta_window ();
179-
180- Mutter.MetaWorkspace.activate (Mutter.MetaWindow.get_workspace(win),
181- timestamp);
182- Mutter.MetaWindow.activate (win, timestamp);
183- break;
184- }
185- }
186- }
187-
188- private void on_active_window_state_changed (Wnck.WindowState change_mask, Wnck.WindowState new_state)
189- {
190- check_fullscreen_obstruction ();
191- }
192-
193- private void on_active_window_changed (Wnck.Window? previous_window)
194- {
195- if (previous_window != null)
196- previous_window.state_changed.disconnect (on_active_window_state_changed);
197-
198-
199- Wnck.Window current = Wnck.Screen.get_default ().get_active_window ();
200- if (current == null)
201- return;
202-
203- current.state_changed.connect (on_active_window_state_changed);
204-
205- check_fullscreen_obstruction ();
206- }
207-
208-/*
209- private void on_launcher_changed_event (LauncherView? last, LauncherView? current)
210- {
211- if (last != null)
212- {
213- last.menu_opened.disconnect (on_launcher_menu_opened);
214- last.menu_closed.disconnect (on_launcher_menu_closed);
215- }
216-
217- if (current != null)
218- {
219- current.menu_opened.connect (on_launcher_menu_opened);
220- current.menu_closed.connect (on_launcher_menu_closed);
221- }
222-
223- check_fullscreen_obstruction ();
224- }
225-*/
226-/*
227-
228- private void on_launcher_menu_opened (LauncherView sender)
229- {
230- if (sender != quicklauncher.manager.active_launcher || sender == null)
231- return;
232-
233- if (sender.model is ApplicationModel && sender.model.is_active)
234- {
235- if (QuicklistController.get_default ().menu_is_open ())
236- expose_windows ((sender.model as ApplicationModel).windows);
237- }
238- }
239-*/
240-/*
241-
242- private void on_launcher_menu_closed (LauncherView sender)
243- {
244- if (sender != quicklauncher.manager.active_launcher)
245- return;
246-
247- dexpose_windows ();
248- }
249-*/
250-
251 private void got_screensaver_changed (dynamic DBus.Object screensaver, bool changed)
252 {
253 if (changed)
254@@ -410,51 +313,23 @@
255 }
256 }
257
258- bool window_is_obstructing (Wnck.Window window)
259- {
260- if (window.is_fullscreen ())
261- return true;
262-
263- /* Sometimes we're not getting the fullscreen hint updating fast enough
264- * but the geometry seems to mostly be in sync. Seeing if the window is
265- * size-wise fullscreen seems to give us a good fallback when the props
266- * aren't in-sync.
267- * The -2.0 is because we have some variation when converting float to int
268- * from the stage.
269- */
270- int x, y, w, h;
271- window.get_geometry (out x, out y, out w, out h);
272-
273- if (w >= (int)this.stage.width - 2.0
274- && h >= (int)this.stage.height - 2.0)
275- return true;
276-
277- /* Finally try figuring out if the window is fullscreen in Mutter
278- * itself */
279- unowned GLib.List<Mutter.Window> mutter_windows = plugin.get_windows ();
280- foreach (Mutter.Window win in mutter_windows)
281- {
282- ulong xid = (ulong) Mutter.MetaWindow.get_xwindow (win.get_meta_window ());
283- if (xid == window.get_xid ())
284- {
285- if (win.width >= ((int)this.stage.width - 2.0) &&
286- win.height >= ((int)this.stage.height - 2.0))
287- {
288- return true;
289- }
290- }
291- }
292-
293- return false;
294- }
295-
296 void check_fullscreen_obstruction ()
297 {
298- Wnck.Window current = Wnck.Screen.get_default ().get_active_window ();
299- if (current == null)
300+ Mutter.Window focus = null;
301+ bool fullscreen = false;
302+
303+ unowned GLib.List<Mutter.Window> mutter_windows = plugin.get_windows ();
304+ foreach (Mutter.Window w in mutter_windows)
305+ {
306+ if (Mutter.MetaWindow.has_focus (w.get_meta_window ()))
307+ focus = w;
308+ }
309+
310+ if (focus == null)
311 return;
312-
313- if (window_is_obstructing (current))
314+
315+ (focus.get_meta_window () as GLib.Object).get ("fullscreen", ref fullscreen);
316+ if (fullscreen)
317 {
318 this.launcher.get_view ().animate (Clutter.AnimationMode.EASE_IN_SINE, 200, "x", -100f);
319 this.panel.animate (Clutter.AnimationMode.EASE_IN_SINE, 200, "opacity", 0);
320@@ -576,24 +451,12 @@
321 return;
322 }
323
324+ GLib.SList <Clutter.Actor> windows = null;
325+
326 unowned GLib.List<Mutter.Window> mutter_windows = this.plugin.get_windows ();
327-
328- GLib.SList <Wnck.Window> windows = null;
329-
330 foreach (Mutter.Window window in mutter_windows)
331 {
332- int type = window.get_window_type ();
333-
334- if (type == Mutter.MetaWindowType.NORMAL ||
335- type == Mutter.MetaWindowType.DIALOG ||
336- type == Mutter.MetaWindowType.MODAL_DIALOG
337- )
338- {
339- ulong xid = (ulong) Mutter.MetaWindow.get_xwindow (window.get_meta_window ());
340- Wnck.Window wnck_window = Wnck.Window.get (xid);
341- if (wnck_window is Wnck.Window)
342- windows.append (wnck_window);
343- }
344+ windows.append (window as Clutter.Actor);
345 }
346
347 this.expose_windows (windows, 80);
348@@ -609,58 +472,69 @@
349 for (int i = 0; i < xids.length; i++)
350 {
351 uint32 xid = xids.index (i);
352- Wnck.Window window = Wnck.Window.get (xid);
353- if (window is Wnck.Window)
354- window.close (Clutter.get_current_event_time ());
355+
356+ unowned GLib.List<Mutter.Window> mutter_windows = this.plugin.get_windows ();
357+ foreach (Mutter.Window window in mutter_windows)
358+ {
359+ uint32 wxid = (uint32) Mutter.MetaWindow.get_xwindow (window.get_meta_window ());
360+ if (wxid == xid)
361+ {
362+ Mutter.MetaWindow.delete (window.get_meta_window (), Clutter.get_current_event_time ());
363+ }
364+ }
365 }
366 }
367
368- public void expose_xids (Array<uint32> xids)
369- {
370- SList<Wnck.Window> windows = new SList<Wnck.Window> ();
371- for (int i = 0; i < xids.length; i++)
372+ public void expose_xids (Array<uint32> xids)
373+ {
374+ SList<Clutter.Actor> windows = new SList<Clutter.Actor> ();
375+ for (int i = 0; i < xids.length; i++)
376 {
377 uint32 xid = xids.index (i);
378- Wnck.Window window = Wnck.Window.get (xid);
379- if (window is Wnck.Window)
380- windows.append (window);
381+
382+ unowned GLib.List<Mutter.Window> mutter_windows = plugin.get_windows ();
383+ foreach (Mutter.Window w in mutter_windows)
384+ {
385+ uint32 wxid = (uint32) Mutter.MetaWindow.get_xwindow (w.get_meta_window ());
386+ if (wxid == xid)
387+ {
388+ windows.append (w);
389+ break;
390+ }
391+ }
392 }
393- expose_windows (windows);
394- }
395+
396+ expose_windows (windows);
397+ }
398
399- public void stop_expose ()
400- {
401- dexpose_windows ();
402- }
403+ public void stop_expose ()
404+ {
405+ dexpose_windows ();
406+ }
407
408 public void show_window (uint32 xid)
409 {
410- Wnck.Window window = Wnck.Window.get (xid);
411- if (window is Wnck.Window)
412+ unowned GLib.List<Mutter.Window> mutter_windows = this.plugin.get_windows ();
413+
414+ foreach (Mutter.Window mutter_window in mutter_windows)
415 {
416- unowned GLib.List<Mutter.Window> mutter_windows = this.plugin.get_windows ();
417-
418- foreach (Mutter.Window mutter_window in mutter_windows)
419- {
420- int type = mutter_window.get_window_type ();
421-
422- if (type == Mutter.MetaWindowType.NORMAL ||
423- type == Mutter.MetaWindowType.DIALOG ||
424- type == Mutter.MetaWindowType.MODAL_DIALOG
425- )
426- {
427- ulong window_xid = (ulong) Mutter.MetaWindow.get_xwindow (mutter_window.get_meta_window ());
428- if (window_xid == xid)
429- {
430- uint32 time_;
431- unowned Mutter.MetaWindow meta = mutter_window.get_meta_window ();
432-
433- time_ = Mutter.MetaDisplay.get_current_time (Mutter.MetaWindow.get_display (meta));
434- Mutter.MetaWorkspace.activate (Mutter.MetaWindow.get_workspace (meta), time_);
435- Mutter.MetaWindow.activate (meta, time_);
436- }
437- }
438- }
439+ ulong window_xid = (ulong) Mutter.MetaWindow.get_xwindow (mutter_window.get_meta_window ());
440+ if (window_xid != xid)
441+ continue;
442+
443+ int type = mutter_window.get_window_type ();
444+
445+ if (type != Mutter.MetaWindowType.NORMAL &&
446+ type != Mutter.MetaWindowType.DIALOG &&
447+ type != Mutter.MetaWindowType.MODAL_DIALOG)
448+ continue;
449+
450+ uint32 time_;
451+ unowned Mutter.MetaWindow meta = mutter_window.get_meta_window ();
452+
453+ time_ = Mutter.MetaDisplay.get_current_time (Mutter.MetaWindow.get_display (meta));
454+ Mutter.MetaWorkspace.activate (Mutter.MetaWindow.get_workspace (meta), time_);
455+ Mutter.MetaWindow.activate (meta, time_);
456 }
457 }
458
459@@ -674,7 +548,7 @@
460 return this.panel.get_indicators_width ();
461 }
462
463- public void expose_windows (GLib.SList<Wnck.Window> windows,
464+ public void expose_windows (GLib.SList<Clutter.Actor> windows,
465 int left_buffer = 250)
466 {
467 expose_manager.left_buffer = left_buffer;
468@@ -801,21 +675,6 @@
469 {
470 this.maximus.process_window (window);
471 this.window_mapped (this, window);
472-
473-/*
474- int type = window.get_window_type ();
475-
476- if (type == Mutter.MetaWindowType.NORMAL ||
477- type == Mutter.MetaWindowType.DIALOG ||
478- type == Mutter.MetaWindowType.MODAL_DIALOG
479- )
480- {
481- ulong xid = (ulong) Mutter.MetaWindow.get_xwindow (window.get_meta_window ());
482- Wnck.Window wnck_window = Wnck.Window.get (xid);
483- if (wnck_window is Wnck.Window)
484- Launcher.Session.get_default ().update_windows (wnck_window);
485- }
486-*/
487 }
488
489 public void destroy (Mutter.Window window)
490
491=== modified file 'targets/mutter/window-management.vala'
492--- targets/mutter/window-management.vala 2010-03-16 20:37:10 +0000
493+++ targets/mutter/window-management.vala 2010-06-10 00:36:28 +0000
494@@ -295,20 +295,16 @@
495
496 int speed = get_animation_speed (window);
497
498- ulong xid = (ulong) Mutter.MetaWindow.get_xwindow (window.get_meta_window ());
499- Wnck.Window wnck_window = Wnck.Window.get (xid);
500-
501 Mutter.MetaRectangle rect = {0, 0, 0, 0};
502- if (wnck_window is Wnck.Window &&
503- Mutter.MetaWindow.get_icon_geometry (window.get_meta_window (), rect))
504+ if (Mutter.MetaWindow.get_icon_geometry (window.get_meta_window (), rect))
505 {
506- int x, y, w, h;
507- wnck_window.get_geometry (out x, out y, out w, out h);
508+ rect = {0, 0, 0, 0};
509+ Mutter.MetaWindow.get_outer_rect (window.get_meta_window (), rect);
510 actor.set ("scale-gravity", Clutter.Gravity.CENTER);
511 anim = actor.animate (Clutter.AnimationMode.EASE_IN_SINE, speed,
512 "opacity", 255,
513- "x", (float) x,
514- "y", (float) y,
515+ "x", (float) rect.x,
516+ "y", (float) rect.y,
517 "scale-x", 1f,
518 "scale-y", 1f);
519 }
520
521=== modified file 'targets/unity/Makefile.am'
522--- targets/unity/Makefile.am 2010-06-04 16:13:17 +0000
523+++ targets/unity/Makefile.am 2010-06-10 00:36:28 +0000
524@@ -44,7 +44,6 @@
525 --pkg x11 \
526 --pkg gtk+-2.0 \
527 --pkg gee-1.0 \
528- --pkg libwnck-1.0 \
529 --pkg unique-1.0 \
530 --pkg unity \
531 --pkg unity-const \
532
533=== modified file 'targets/unity/main.vala'
534--- targets/unity/main.vala 2010-04-07 15:39:23 +0000
535+++ targets/unity/main.vala 2010-06-10 00:36:28 +0000
536@@ -191,7 +191,6 @@
537 });
538 }
539
540- Wnck.set_client_type (Wnck.ClientType.PAGER);
541 Gtk.main ();
542
543 /* Restore envvar */
544
545=== modified file 'tests/ui/Makefile.am'
546--- tests/ui/Makefile.am 2010-06-09 03:02:57 +0000
547+++ tests/ui/Makefile.am 2010-06-10 00:36:28 +0000
548@@ -38,7 +38,6 @@
549 --pkg indicator \
550 --pkg clutk-0.3 \
551 --pkg launcher-0.3 \
552- --pkg libwnck-1.0 \
553 --pkg test-const \
554 --pkg unique-1.0 \
555 --pkg unity \
556
557=== modified file 'tests/unit/Makefile.am'
558--- tests/unit/Makefile.am 2010-06-04 17:03:39 +0000
559+++ tests/unit/Makefile.am 2010-06-10 00:36:28 +0000
560@@ -39,7 +39,6 @@
561 --pkg indicator \
562 --pkg clutk-0.3 \
563 --pkg launcher-0.3 \
564- --pkg libwnck-1.0 \
565 --pkg test-const \
566 --pkg unique-1.0 \
567 --pkg unity \
568
569=== modified file 'unity-private/testing/test-window.vala'
570--- unity-private/testing/test-window.vala 2010-06-02 22:38:51 +0000
571+++ unity-private/testing/test-window.vala 2010-06-10 00:36:28 +0000
572@@ -237,7 +237,7 @@
573 /*
574 * UNDERLAY WINDOW MANAGEMENT
575 */
576- public void on_active_window_changed (Wnck.Window? previous_window)
577+ private void on_active_window_changed (Wnck.Window? previous_window)
578 {
579 Wnck.Window new_window = this.wnck_screen.get_active_window ();
580 if (new_window == null)
581
582=== modified file 'unity/Makefile.am'
583--- unity/Makefile.am 2010-06-03 10:22:01 +0000
584+++ unity/Makefile.am 2010-06-10 00:36:28 +0000
585@@ -49,7 +49,6 @@
586 --pkg gtk+-2.0 \
587 --pkg gee-1.0 \
588 --pkg Bamf-0.2 \
589- --pkg libwnck-1.0 \
590 --pkg unique-1.0 \
591 --pkg unity-const \
592 $(MAINTAINER_VALAFLAGS)