Merge lp:~unity-team/unity/places-fixes-17-08-2010 into lp:unity

Proposed by Neil J. Patel
Status: Merged
Approved by: Mirco Müller
Approved revision: no longer in the source branch.
Merged at revision: 444
Proposed branch: lp:~unity-team/unity/places-fixes-17-08-2010
Merge into: lp:unity
Diff against target: 533 lines (+150/-71)
9 files modified
targets/mutter/Makefile.am (+1/-0)
targets/mutter/expose-manager.vala (+15/-0)
targets/mutter/plugin.vala (+26/-19)
targets/mutter/spaces-manager.vala (+39/-4)
targets/mutter/window-management.vala (+0/-1)
unity-private/panel/panel-tray.vala (+13/-1)
unity-private/panel/panel-window-buttons.vala (+44/-37)
unity-private/unity-utils.c (+10/-7)
unity-private/utils.vala (+2/-2)
To merge this branch: bzr merge lp:~unity-team/unity/places-fixes-17-08-2010
Reviewer Review Type Date Requested Status
Mirco Müller Pending
Review via email: mp+33048@code.launchpad.net

Description of the change

Doesn't fix actually much places stuff, sorry for the mis-naming. The links bugs should provide the low-down on what should be fixed.

To post a comment you must log in.
Revision history for this message
Mirco Müller (macslow) wrote :

Approved

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'targets/mutter/Makefile.am'
2--- targets/mutter/Makefile.am 2010-07-12 08:50:07 +0000
3+++ targets/mutter/Makefile.am 2010-08-18 20:18:44 +0000
4@@ -22,6 +22,7 @@
5 -I$(top_srcdir)/unity \
6 -I$(top_srcdir)/unity-private \
7 -I$(top_srcdir)/src \
8+ -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \
9 $(BASE_CFLAGS) \
10 $(MUTTER_CFLAGS) \
11 $(MAINTAINER_CFLAGS)
12
13=== modified file 'targets/mutter/expose-manager.vala'
14--- targets/mutter/expose-manager.vala 2010-08-18 16:07:48 +0000
15+++ targets/mutter/expose-manager.vala 2010-08-18 20:18:44 +0000
16@@ -70,6 +70,8 @@
17 else
18 clone = new Clutter.Clone (source);
19
20+ source.destroy.connect (on_source_destroyed);
21+
22 add_actor (clone);
23 clone.show ();
24 clone.reactive = true;
25@@ -91,6 +93,11 @@
26 this.leave_event.connect (this.on_mouse_leave);
27 this.button_press_event.connect (this.on_button_press);
28 }
29+
30+ private void on_source_destroyed ()
31+ {
32+ destroy ();
33+ }
34
35 private bool on_button_press (Clutter.Event evnt)
36 {
37@@ -299,6 +306,8 @@
38
39 expose_group.add_actor (clone);
40
41+ clone.destroy.connect (on_clone_destroyed);
42+
43 clone.hovered_opacity = hovered_opacity;
44 clone.unhovered_opacity = unhovered_opacity;
45 clone.opacity = unhovered_opacity;
46@@ -327,6 +336,12 @@
47 stage.captured_event.connect (on_stage_captured_event);
48 }
49
50+ private void on_clone_destroyed ()
51+ {
52+ if (expose_group.get_children ().length () <= 1)
53+ end_expose ();
54+ }
55+
56 public void end_expose ()
57 {
58 if (!expose_showing)
59
60=== modified file 'targets/mutter/plugin.vala'
61--- targets/mutter/plugin.vala 2010-08-12 11:41:51 +0000
62+++ targets/mutter/plugin.vala 2010-08-18 20:18:44 +0000
63@@ -133,7 +133,6 @@
64 private Places.Controller places_controller;
65 private Places.View places;
66 private Panel.View panel;
67- private ActorBlur actor_blur;
68 private Clutter.Rectangle dark_box;
69 private unowned Mutter.MetaWindow? focus_window = null;
70 private unowned Mutter.MetaDisplay? display = null;
71@@ -702,11 +701,6 @@
72 this.grab_enabled = grab;
73 }
74
75- private bool envvar_is_enabled (string name)
76- {
77- return (Environment.get_variable (name) != null);
78- }
79-
80 private unowned Mutter.MetaWindow? get_window_for_xid (uint32 xid)
81 {
82 unowned GLib.List<Mutter.Window> mutter_windows = this.plugin.get_windows ();
83@@ -788,13 +782,10 @@
84 int width,
85 int height)
86 {
87- /*FIXME: This doesn't work in Mutter
88 if (window.get_data<string> (UNDECORATED_HINT) == null)
89 {
90- uint32 xid = (uint32)window.get_x_window ();
91- Utils.window_set_decorations (xid, 0);
92+ Utils.window_set_decorations (Mutter.MetaWindow.get_xwindow (window.get_meta_window ()), 0);
93 }
94- */
95
96 this.window_maximized (this, window, x, y, width, height);
97
98@@ -807,13 +798,10 @@
99 int width,
100 int height)
101 {
102- /* FIXME: This doesn't work in Mutter
103 if (window.get_data<string> (UNDECORATED_HINT) == null)
104 {
105- uint32 xid = (uint32)window.get_x_window ();
106- Utils.window_set_decorations (xid, 1);
107+ Utils.window_set_decorations (Mutter.MetaWindow.get_xwindow (window.get_meta_window ()), 1);
108 }
109- */
110
111 this.window_unmaximized (this, window, x, y, width, height);
112
113@@ -822,11 +810,30 @@
114
115 public void map (Mutter.Window window)
116 {
117- /* FIXME: This doesn't work in Mutter
118- uint32 xid = (uint32)window.get_x_window ();
119- if (Utils.window_is_decorated (xid) == false)
120- window.set_data (UNDECORATED_HINT, "%s".printf ("true"));
121- */
122+ unowned Mutter.MetaWindow win = window.get_meta_window ();
123+
124+ if (window.get_window_type () == Mutter.MetaCompWindowType.NORMAL)
125+ {
126+ Idle.add (() => {
127+ if (win is Object)
128+ {
129+ if (Utils.window_is_decorated (Mutter.MetaWindow.get_xwindow (win)) == false && Mutter.MetaWindow.is_maximized (win) == false)
130+ {
131+ window.set_data (UNDECORATED_HINT, "%s".printf ("true"));
132+ }
133+ else
134+ {
135+ if (Mutter.MetaWindow.is_maximized (win))
136+ {
137+ Utils.window_set_decorations (Mutter.MetaWindow.get_xwindow (win), 0);
138+ }
139+ }
140+ }
141+
142+ return false;
143+ });
144+ }
145+
146 this.maximus.process_window (window);
147 this.window_mapped (this, window);
148
149
150=== modified file 'targets/mutter/spaces-manager.vala'
151--- targets/mutter/spaces-manager.vala 2010-08-18 03:21:28 +0000
152+++ targets/mutter/spaces-manager.vala 2010-08-18 20:18:44 +0000
153@@ -31,7 +31,7 @@
154 this.parent = _parent;
155 parent.notify["showing"].connect (on_notify_showing);
156
157- name = "Workspace Overview";
158+ name = _("Workspaces");
159 load_icon_from_icon_name ("workspace-switcher");
160 }
161
162@@ -52,6 +52,26 @@
163 else
164 parent.show_spaces_picker ();
165 }
166+ public override QuicklistController? get_menu_controller ()
167+ {
168+ return new ApplicationQuicklistController (this);
169+ }
170+
171+ public override void get_menu_actions (ScrollerChildController.menu_cb callback)
172+ {
173+ callback (null);
174+ }
175+
176+ public override void get_menu_navigation (ScrollerChildController.menu_cb callback)
177+ {
178+ callback (null);
179+ }
180+
181+ public override bool can_drag ()
182+ {
183+ return true;
184+ }
185+
186 }
187
188 public class WorkspaceClone : Clutter.Group
189@@ -109,7 +129,6 @@
190 Clutter.Actor background;
191 List<Clutter.Actor> clones;
192 Plugin plugin;
193- unowned Mutter.MetaScreen screen;
194 ScrollerChild _button;
195 SpacesButtonController controller;
196
197@@ -169,6 +188,8 @@
198 showing = true;
199 plugin.add_fullscreen_request (this);
200
201+ global_shell.get_stage ().captured_event.connect (on_stage_capture_event);
202+
203 if (background is Clutter.Actor)
204 background.destroy ();
205
206@@ -226,6 +247,20 @@
207 (w as Clutter.Actor).opacity = 0;
208 }
209 }
210+
211+ private bool on_stage_capture_event (Clutter.Event event)
212+ {
213+ if (event.type == Clutter.EventType.BUTTON_PRESS)
214+ {
215+ if (event.button.y <= global_shell.get_panel_height_foobar () ||
216+ event.button.x <= global_shell.get_launcher_width_foobar ())
217+ {
218+ select_workspace (null);
219+ }
220+ }
221+
222+ return false;
223+ }
224
225 private void select_workspace (Mutter.MetaWorkspace? workspace) {
226 if (workspace == null)
227@@ -240,6 +275,8 @@
228 Mutter.MetaWorkspace.activate (workspace, time_);
229 plugin.remove_fullscreen_request (this);
230 showing = false;
231+
232+ global_shell.get_stage ().captured_event.disconnect (on_stage_capture_event);
233 }
234
235 private Clutter.Actor workspace_clone (Mutter.MetaWorkspace workspace) {
236@@ -249,8 +286,6 @@
237 windows = plugin.plugin.get_windows ();
238 wsp = new WorkspaceClone (workspace, plugin);
239
240- int active_workspace = Mutter.MetaScreen.get_active_workspace_index (plugin.plugin.get_screen ());
241-
242 foreach (Mutter.Window window in windows)
243 {
244 if (Mutter.MetaWindow.is_on_all_workspaces (window.get_meta_window ()) ||
245
246=== modified file 'targets/mutter/window-management.vala'
247--- targets/mutter/window-management.vala 2010-07-20 12:59:01 +0000
248+++ targets/mutter/window-management.vala 2010-08-18 20:18:44 +0000
249@@ -22,7 +22,6 @@
250 public class WindowManagement : Object
251 {
252 private Plugin plugin;
253- private int switch_signals_to_send;
254
255 private unowned Mutter.Window last_mapped;
256
257
258=== modified file 'unity-private/panel/panel-tray.vala'
259--- unity-private/panel/panel-tray.vala 2010-06-17 19:27:41 +0000
260+++ unity-private/panel/panel-tray.vala 2010-08-18 20:18:44 +0000
261@@ -57,7 +57,19 @@
262 string? disable_tray = Environment.get_variable ("UNITY_DISABLE_TRAY");
263
264 if (disable_tray == null)
265- this.manager.manage_stage (this.stage);
266+ {
267+ Gdk.error_trap_push ();
268+
269+ this.manager.manage_stage (this.stage);
270+ Gdk.flush ();
271+
272+ int err = 0;
273+ if ((err = Gdk.error_trap_pop ()) != 0)
274+ {
275+ warning ("Unable to connect to the system tray: Error code: %d",
276+ err);
277+ }
278+ }
279
280 return false;
281 }
282
283=== modified file 'unity-private/panel/panel-window-buttons.vala'
284--- unity-private/panel/panel-window-buttons.vala 2010-07-30 12:46:52 +0000
285+++ unity-private/panel/panel-window-buttons.vala 2010-08-18 20:18:44 +0000
286@@ -25,7 +25,6 @@
287 private Ctk.Text appname;
288 private WindowButton close;
289 private WindowButton minimize;
290- private WindowButton maximize;
291 private WindowButton unmaximize;
292
293 private unowned Bamf.Matcher matcher;
294@@ -47,28 +46,21 @@
295 appname.max_length = 9;
296 pack (appname, true, true);
297
298- close = new WindowButton ("close.png");
299+ close = new WindowButton ("close");
300 pack (close, false, false);
301 close.clicked.connect (() => {
302 if (last_xid > 0)
303 global_shell.do_window_action (last_xid, WindowAction.CLOSE);
304 });
305
306- minimize = new WindowButton ("minimize.png");
307+ minimize = new WindowButton ("minimize");
308 pack (minimize, false, false);
309 minimize.clicked.connect (() => {
310 if (last_xid > 0)
311 global_shell.do_window_action (last_xid, WindowAction.MINIMIZE);
312 });
313
314- maximize = new WindowButton ("maximize.png");
315- pack (maximize, false, false);
316- maximize.clicked.connect (() => {
317- if (last_xid > 0)
318- global_shell.do_window_action (last_xid, WindowAction.MAXIMIZE);
319- });
320-
321- unmaximize = new WindowButton ("unmaximize.png");
322+ unmaximize = new WindowButton ("unmaximize");
323 pack (unmaximize, false, false);
324 unmaximize.clicked.connect (() => {
325 if (last_xid > 0)
326@@ -91,6 +83,13 @@
327 return false;
328 });
329 });
330+
331+ Idle.add (() => {
332+ unowned Bamf.Window? win = matcher.get_active_window ();
333+ on_active_window_changed (null, win as GLib.Object);
334+
335+ return false;
336+ });
337 }
338
339 private void on_active_window_changed (GLib.Object? object,
340@@ -113,7 +112,6 @@
341 appname.hide ();
342 close.show ();
343 minimize.show ();
344- maximize.hide ();
345 unmaximize.show ();
346 }
347 else
348@@ -121,7 +119,6 @@
349 appname.show ();
350 close.hide ();
351 minimize.hide ();
352- maximize.hide ();
353 unmaximize.hide ();
354 }
355
356@@ -150,7 +147,6 @@
357 appname.hide ();
358 close.hide ();
359 minimize.hide ();
360- maximize.hide ();
361 unmaximize.hide ();
362 last_xid = 0;
363 }
364@@ -168,10 +164,15 @@
365 public class WindowButton : Ctk.Button
366 {
367 public static const string AMBIANCE = "/usr/share/themes/Ambiance/metacity-1";
368+ public static const string AMBIANCE_BETA = "/usr/share/themes/Ambiance-maverick-beta/metacity-1";
369
370 public string filename { get; construct; }
371 public Clutter.Actor bg;
372
373+ private bool using_beta = false;
374+ private int icon_size = 18;
375+ private string directory = AMBIANCE;
376+
377 public WindowButton (string filename)
378 {
379 Object (filename:filename);
380@@ -179,40 +180,46 @@
381
382 construct
383 {
384+ if (using_beta = FileUtils.test (AMBIANCE_BETA, FileTest.EXISTS))
385+ {
386+ icon_size = 19;
387+ directory = AMBIANCE_BETA;
388+ }
389 try {
390-
391- bg = new Ctk.Image.from_filename (20, AMBIANCE + "/" + filename);
392- add_actor (bg);
393+ bg = new Ctk.Image.from_filename (icon_size,
394+ directory +
395+ "/" +
396+ filename +
397+ ".png");
398+ set_background_for_state (Ctk.ActorState.STATE_NORMAL, bg);
399+ bg.show ();
400+
401+ bg = new Ctk.Image.from_filename (icon_size,
402+ directory +
403+ "/" +
404+ filename +
405+ "_focused_prelight.png");
406+ set_background_for_state (Ctk.ActorState.STATE_PRELIGHT, bg);
407+ bg.show ();
408+
409+ bg = new Ctk.Image.from_filename (icon_size,
410+ directory +
411+ "/" +
412+ filename +
413+ "_focused_pressed.png");
414+ set_background_for_state (Ctk.ActorState.STATE_ACTIVE, bg);
415 bg.show ();
416
417 } catch (Error e) {
418 warning (@"Unable to load window button theme: You need Ambiance installed: $(e.message)");
419 }
420-
421- notify["state"].connect (() => {
422- switch (state)
423- {
424- case Ctk.ActorState.STATE_NORMAL:
425- bg.opacity = 255;
426- break;
427-
428- case Ctk.ActorState.STATE_PRELIGHT:
429- bg.opacity = 120;
430- break;
431-
432- case Ctk.ActorState.STATE_ACTIVE:
433- default:
434- bg.opacity = 50;
435- break;
436- }
437- });
438 }
439
440 private override void get_preferred_width (float for_height,
441 out float min_width,
442 out float nat_width)
443 {
444- min_width = 20.0f;
445+ min_width = icon_size;
446 nat_width = min_width;
447 }
448
449@@ -220,7 +227,7 @@
450 out float min_height,
451 out float nat_height)
452 {
453- min_height = 18.0f;
454+ min_height = icon_size;
455 nat_height = min_height;
456 }
457 }
458
459=== modified file 'unity-private/unity-utils.c'
460--- unity-private/unity-utils.c 2010-08-17 16:00:00 +0000
461+++ unity-private/unity-utils.c 2010-08-18 20:18:44 +0000
462@@ -55,7 +55,7 @@
463 #define _XA_MOTIF_WM_HINTS "_MOTIF_WM_HINTS"
464
465 gboolean
466-utils_window_is_decorated (guint32 xid)
467+utils_window_is_decorated (Window xid)
468 {
469 GdkDisplay *display = gdk_display_get_default();
470 Atom hints_atom = None;
471@@ -76,20 +76,23 @@
472 False, AnyPropertyType, &type, &format, &nitems,
473 &bytes_after, &data);
474
475- if (type == None || !data) return TRUE;
476+ if (type == None || !data)
477+ {
478+ return TRUE;
479+ }
480
481 hints = (MotifWmHints *)data;
482
483 retval = hints->decorations;
484-
485+
486 if (data)
487 XFree (data);
488
489- return retval;
490+ return retval == 1;
491 }
492
493 static void
494-gdk_window_set_mwm_hints (guint32 xid,
495+gdk_window_set_mwm_hints (Window xid,
496 MotifWmHints *new_hints)
497 {
498 GdkDisplay *display = gdk_display_get_default();
499@@ -103,7 +106,7 @@
500
501 g_return_if_fail (GDK_IS_DISPLAY (display));
502
503- g_debug ("gdk_window_set_mwm_hints: %u %lu\n", xid, new_hints->decorations);
504+ g_debug ("gdk_window_set_mwm_hints: %lu %lu\n", xid, new_hints->decorations);
505
506 hints_atom = gdk_x11_get_xatom_by_name_for_display (display,
507 _XA_MOTIF_WM_HINTS);
508@@ -148,7 +151,7 @@
509 }
510
511 void
512-utils_window_set_decorations (guint32 xid,
513+utils_window_set_decorations (Window xid,
514 GdkWMDecoration decorations)
515 {
516 MotifWmHints *hints;
517
518=== modified file 'unity-private/utils.vala'
519--- unity-private/utils.vala 2010-08-17 16:00:00 +0000
520+++ unity-private/utils.vala 2010-08-18 20:18:44 +0000
521@@ -117,10 +117,10 @@
522 string img2_path);
523
524 [CCode (lower_case_prefix = "utils_")]
525- public extern bool window_is_decorated (uint32 xid);
526+ public extern bool window_is_decorated (X.Window window);
527
528 [CCode (lower_case_prefix = "utils_")]
529- public extern void window_set_decorations (uint32 xid, uint decorations);
530+ public extern void window_set_decorations (X.Window window, uint decorations);
531
532 [CCode (lower_case_prefix = "utils_")]
533 public extern void volume_eject (GLib.Volume volume);