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
=== modified file 'targets/mutter/Makefile.am'
--- targets/mutter/Makefile.am 2010-07-12 08:50:07 +0000
+++ targets/mutter/Makefile.am 2010-08-18 20:18:44 +0000
@@ -22,6 +22,7 @@
22 -I$(top_srcdir)/unity \22 -I$(top_srcdir)/unity \
23 -I$(top_srcdir)/unity-private \23 -I$(top_srcdir)/unity-private \
24 -I$(top_srcdir)/src \24 -I$(top_srcdir)/src \
25 -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \
25 $(BASE_CFLAGS) \26 $(BASE_CFLAGS) \
26 $(MUTTER_CFLAGS) \27 $(MUTTER_CFLAGS) \
27 $(MAINTAINER_CFLAGS)28 $(MAINTAINER_CFLAGS)
2829
=== modified file 'targets/mutter/expose-manager.vala'
--- targets/mutter/expose-manager.vala 2010-08-18 16:07:48 +0000
+++ targets/mutter/expose-manager.vala 2010-08-18 20:18:44 +0000
@@ -70,6 +70,8 @@
70 else70 else
71 clone = new Clutter.Clone (source);71 clone = new Clutter.Clone (source);
7272
73 source.destroy.connect (on_source_destroyed);
74
73 add_actor (clone);75 add_actor (clone);
74 clone.show ();76 clone.show ();
75 clone.reactive = true;77 clone.reactive = true;
@@ -91,6 +93,11 @@
91 this.leave_event.connect (this.on_mouse_leave);93 this.leave_event.connect (this.on_mouse_leave);
92 this.button_press_event.connect (this.on_button_press);94 this.button_press_event.connect (this.on_button_press);
93 }95 }
96
97 private void on_source_destroyed ()
98 {
99 destroy ();
100 }
94 101
95 private bool on_button_press (Clutter.Event evnt)102 private bool on_button_press (Clutter.Event evnt)
96 {103 {
@@ -299,6 +306,8 @@
299306
300 expose_group.add_actor (clone);307 expose_group.add_actor (clone);
301308
309 clone.destroy.connect (on_clone_destroyed);
310
302 clone.hovered_opacity = hovered_opacity;311 clone.hovered_opacity = hovered_opacity;
303 clone.unhovered_opacity = unhovered_opacity;312 clone.unhovered_opacity = unhovered_opacity;
304 clone.opacity = unhovered_opacity;313 clone.opacity = unhovered_opacity;
@@ -327,6 +336,12 @@
327 stage.captured_event.connect (on_stage_captured_event);336 stage.captured_event.connect (on_stage_captured_event);
328 }337 }
329338
339 private void on_clone_destroyed ()
340 {
341 if (expose_group.get_children ().length () <= 1)
342 end_expose ();
343 }
344
330 public void end_expose ()345 public void end_expose ()
331 {346 {
332 if (!expose_showing)347 if (!expose_showing)
333348
=== modified file 'targets/mutter/plugin.vala'
--- targets/mutter/plugin.vala 2010-08-12 11:41:51 +0000
+++ targets/mutter/plugin.vala 2010-08-18 20:18:44 +0000
@@ -133,7 +133,6 @@
133 private Places.Controller places_controller;133 private Places.Controller places_controller;
134 private Places.View places;134 private Places.View places;
135 private Panel.View panel;135 private Panel.View panel;
136 private ActorBlur actor_blur;
137 private Clutter.Rectangle dark_box;136 private Clutter.Rectangle dark_box;
138 private unowned Mutter.MetaWindow? focus_window = null;137 private unowned Mutter.MetaWindow? focus_window = null;
139 private unowned Mutter.MetaDisplay? display = null;138 private unowned Mutter.MetaDisplay? display = null;
@@ -702,11 +701,6 @@
702 this.grab_enabled = grab;701 this.grab_enabled = grab;
703 }702 }
704703
705 private bool envvar_is_enabled (string name)
706 {
707 return (Environment.get_variable (name) != null);
708 }
709
710 private unowned Mutter.MetaWindow? get_window_for_xid (uint32 xid)704 private unowned Mutter.MetaWindow? get_window_for_xid (uint32 xid)
711 {705 {
712 unowned GLib.List<Mutter.Window> mutter_windows = this.plugin.get_windows ();706 unowned GLib.List<Mutter.Window> mutter_windows = this.plugin.get_windows ();
@@ -788,13 +782,10 @@
788 int width,782 int width,
789 int height)783 int height)
790 {784 {
791 /*FIXME: This doesn't work in Mutter
792 if (window.get_data<string> (UNDECORATED_HINT) == null)785 if (window.get_data<string> (UNDECORATED_HINT) == null)
793 {786 {
794 uint32 xid = (uint32)window.get_x_window ();787 Utils.window_set_decorations (Mutter.MetaWindow.get_xwindow (window.get_meta_window ()), 0);
795 Utils.window_set_decorations (xid, 0);
796 }788 }
797 */
798789
799 this.window_maximized (this, window, x, y, width, height);790 this.window_maximized (this, window, x, y, width, height);
800791
@@ -807,13 +798,10 @@
807 int width,798 int width,
808 int height)799 int height)
809 {800 {
810 /* FIXME: This doesn't work in Mutter
811 if (window.get_data<string> (UNDECORATED_HINT) == null)801 if (window.get_data<string> (UNDECORATED_HINT) == null)
812 {802 {
813 uint32 xid = (uint32)window.get_x_window ();803 Utils.window_set_decorations (Mutter.MetaWindow.get_xwindow (window.get_meta_window ()), 1);
814 Utils.window_set_decorations (xid, 1);
815 }804 }
816 */
817805
818 this.window_unmaximized (this, window, x, y, width, height);806 this.window_unmaximized (this, window, x, y, width, height);
819807
@@ -822,11 +810,30 @@
822810
823 public void map (Mutter.Window window)811 public void map (Mutter.Window window)
824 {812 {
825 /* FIXME: This doesn't work in Mutter813 unowned Mutter.MetaWindow win = window.get_meta_window ();
826 uint32 xid = (uint32)window.get_x_window ();814
827 if (Utils.window_is_decorated (xid) == false)815 if (window.get_window_type () == Mutter.MetaCompWindowType.NORMAL)
828 window.set_data (UNDECORATED_HINT, "%s".printf ("true"));816 {
829 */817 Idle.add (() => {
818 if (win is Object)
819 {
820 if (Utils.window_is_decorated (Mutter.MetaWindow.get_xwindow (win)) == false && Mutter.MetaWindow.is_maximized (win) == false)
821 {
822 window.set_data (UNDECORATED_HINT, "%s".printf ("true"));
823 }
824 else
825 {
826 if (Mutter.MetaWindow.is_maximized (win))
827 {
828 Utils.window_set_decorations (Mutter.MetaWindow.get_xwindow (win), 0);
829 }
830 }
831 }
832
833 return false;
834 });
835 }
836
830 this.maximus.process_window (window);837 this.maximus.process_window (window);
831 this.window_mapped (this, window);838 this.window_mapped (this, window);
832839
833840
=== modified file 'targets/mutter/spaces-manager.vala'
--- targets/mutter/spaces-manager.vala 2010-08-18 03:21:28 +0000
+++ targets/mutter/spaces-manager.vala 2010-08-18 20:18:44 +0000
@@ -31,7 +31,7 @@
31 this.parent = _parent;31 this.parent = _parent;
32 parent.notify["showing"].connect (on_notify_showing);32 parent.notify["showing"].connect (on_notify_showing);
3333
34 name = "Workspace Overview";34 name = _("Workspaces");
35 load_icon_from_icon_name ("workspace-switcher");35 load_icon_from_icon_name ("workspace-switcher");
36 }36 }
3737
@@ -52,6 +52,26 @@
52 else52 else
53 parent.show_spaces_picker ();53 parent.show_spaces_picker ();
54 }54 }
55 public override QuicklistController? get_menu_controller ()
56 {
57 return new ApplicationQuicklistController (this);
58 }
59
60 public override void get_menu_actions (ScrollerChildController.menu_cb callback)
61 {
62 callback (null);
63 }
64
65 public override void get_menu_navigation (ScrollerChildController.menu_cb callback)
66 {
67 callback (null);
68 }
69
70 public override bool can_drag ()
71 {
72 return true;
73 }
74
55 }75 }
56 76
57 public class WorkspaceClone : Clutter.Group77 public class WorkspaceClone : Clutter.Group
@@ -109,7 +129,6 @@
109 Clutter.Actor background;129 Clutter.Actor background;
110 List<Clutter.Actor> clones;130 List<Clutter.Actor> clones;
111 Plugin plugin;131 Plugin plugin;
112 unowned Mutter.MetaScreen screen;
113 ScrollerChild _button;132 ScrollerChild _button;
114 SpacesButtonController controller;133 SpacesButtonController controller;
115134
@@ -169,6 +188,8 @@
169 showing = true;188 showing = true;
170 plugin.add_fullscreen_request (this);189 plugin.add_fullscreen_request (this);
171190
191 global_shell.get_stage ().captured_event.connect (on_stage_capture_event);
192
172 if (background is Clutter.Actor)193 if (background is Clutter.Actor)
173 background.destroy ();194 background.destroy ();
174 195
@@ -226,6 +247,20 @@
226 (w as Clutter.Actor).opacity = 0;247 (w as Clutter.Actor).opacity = 0;
227 }248 }
228 }249 }
250
251 private bool on_stage_capture_event (Clutter.Event event)
252 {
253 if (event.type == Clutter.EventType.BUTTON_PRESS)
254 {
255 if (event.button.y <= global_shell.get_panel_height_foobar () ||
256 event.button.x <= global_shell.get_launcher_width_foobar ())
257 {
258 select_workspace (null);
259 }
260 }
261
262 return false;
263 }
229 264
230 private void select_workspace (Mutter.MetaWorkspace? workspace) {265 private void select_workspace (Mutter.MetaWorkspace? workspace) {
231 if (workspace == null)266 if (workspace == null)
@@ -240,6 +275,8 @@
240 Mutter.MetaWorkspace.activate (workspace, time_);275 Mutter.MetaWorkspace.activate (workspace, time_);
241 plugin.remove_fullscreen_request (this);276 plugin.remove_fullscreen_request (this);
242 showing = false;277 showing = false;
278
279 global_shell.get_stage ().captured_event.disconnect (on_stage_capture_event);
243 }280 }
244 281
245 private Clutter.Actor workspace_clone (Mutter.MetaWorkspace workspace) {282 private Clutter.Actor workspace_clone (Mutter.MetaWorkspace workspace) {
@@ -249,8 +286,6 @@
249 windows = plugin.plugin.get_windows ();286 windows = plugin.plugin.get_windows ();
250 wsp = new WorkspaceClone (workspace, plugin);287 wsp = new WorkspaceClone (workspace, plugin);
251288
252 int active_workspace = Mutter.MetaScreen.get_active_workspace_index (plugin.plugin.get_screen ());
253
254 foreach (Mutter.Window window in windows)289 foreach (Mutter.Window window in windows)
255 {290 {
256 if (Mutter.MetaWindow.is_on_all_workspaces (window.get_meta_window ()) ||291 if (Mutter.MetaWindow.is_on_all_workspaces (window.get_meta_window ()) ||
257292
=== modified file 'targets/mutter/window-management.vala'
--- targets/mutter/window-management.vala 2010-07-20 12:59:01 +0000
+++ targets/mutter/window-management.vala 2010-08-18 20:18:44 +0000
@@ -22,7 +22,6 @@
22 public class WindowManagement : Object22 public class WindowManagement : Object
23 {23 {
24 private Plugin plugin;24 private Plugin plugin;
25 private int switch_signals_to_send;
2625
27 private unowned Mutter.Window last_mapped;26 private unowned Mutter.Window last_mapped;
2827
2928
=== modified file 'unity-private/panel/panel-tray.vala'
--- unity-private/panel/panel-tray.vala 2010-06-17 19:27:41 +0000
+++ unity-private/panel/panel-tray.vala 2010-08-18 20:18:44 +0000
@@ -57,7 +57,19 @@
57 string? disable_tray = Environment.get_variable ("UNITY_DISABLE_TRAY");57 string? disable_tray = Environment.get_variable ("UNITY_DISABLE_TRAY");
5858
59 if (disable_tray == null)59 if (disable_tray == null)
60 this.manager.manage_stage (this.stage);60 {
61 Gdk.error_trap_push ();
62
63 this.manager.manage_stage (this.stage);
64 Gdk.flush ();
65
66 int err = 0;
67 if ((err = Gdk.error_trap_pop ()) != 0)
68 {
69 warning ("Unable to connect to the system tray: Error code: %d",
70 err);
71 }
72 }
6173
62 return false;74 return false;
63 }75 }
6476
=== modified file 'unity-private/panel/panel-window-buttons.vala'
--- unity-private/panel/panel-window-buttons.vala 2010-07-30 12:46:52 +0000
+++ unity-private/panel/panel-window-buttons.vala 2010-08-18 20:18:44 +0000
@@ -25,7 +25,6 @@
25 private Ctk.Text appname;25 private Ctk.Text appname;
26 private WindowButton close;26 private WindowButton close;
27 private WindowButton minimize;27 private WindowButton minimize;
28 private WindowButton maximize;
29 private WindowButton unmaximize;28 private WindowButton unmaximize;
3029
31 private unowned Bamf.Matcher matcher;30 private unowned Bamf.Matcher matcher;
@@ -47,28 +46,21 @@
47 appname.max_length = 9;46 appname.max_length = 9;
48 pack (appname, true, true);47 pack (appname, true, true);
4948
50 close = new WindowButton ("close.png");49 close = new WindowButton ("close");
51 pack (close, false, false);50 pack (close, false, false);
52 close.clicked.connect (() => {51 close.clicked.connect (() => {
53 if (last_xid > 0)52 if (last_xid > 0)
54 global_shell.do_window_action (last_xid, WindowAction.CLOSE);53 global_shell.do_window_action (last_xid, WindowAction.CLOSE);
55 });54 });
5655
57 minimize = new WindowButton ("minimize.png");56 minimize = new WindowButton ("minimize");
58 pack (minimize, false, false);57 pack (minimize, false, false);
59 minimize.clicked.connect (() => {58 minimize.clicked.connect (() => {
60 if (last_xid > 0)59 if (last_xid > 0)
61 global_shell.do_window_action (last_xid, WindowAction.MINIMIZE);60 global_shell.do_window_action (last_xid, WindowAction.MINIMIZE);
62 });61 });
6362
64 maximize = new WindowButton ("maximize.png");63 unmaximize = new WindowButton ("unmaximize");
65 pack (maximize, false, false);
66 maximize.clicked.connect (() => {
67 if (last_xid > 0)
68 global_shell.do_window_action (last_xid, WindowAction.MAXIMIZE);
69 });
70
71 unmaximize = new WindowButton ("unmaximize.png");
72 pack (unmaximize, false, false);64 pack (unmaximize, false, false);
73 unmaximize.clicked.connect (() => {65 unmaximize.clicked.connect (() => {
74 if (last_xid > 0)66 if (last_xid > 0)
@@ -91,6 +83,13 @@
91 return false;83 return false;
92 });84 });
93 });85 });
86
87 Idle.add (() => {
88 unowned Bamf.Window? win = matcher.get_active_window ();
89 on_active_window_changed (null, win as GLib.Object);
90
91 return false;
92 });
94 }93 }
9594
96 private void on_active_window_changed (GLib.Object? object,95 private void on_active_window_changed (GLib.Object? object,
@@ -113,7 +112,6 @@
113 appname.hide ();112 appname.hide ();
114 close.show ();113 close.show ();
115 minimize.show ();114 minimize.show ();
116 maximize.hide ();
117 unmaximize.show ();115 unmaximize.show ();
118 }116 }
119 else117 else
@@ -121,7 +119,6 @@
121 appname.show ();119 appname.show ();
122 close.hide ();120 close.hide ();
123 minimize.hide ();121 minimize.hide ();
124 maximize.hide ();
125 unmaximize.hide ();122 unmaximize.hide ();
126 }123 }
127124
@@ -150,7 +147,6 @@
150 appname.hide ();147 appname.hide ();
151 close.hide ();148 close.hide ();
152 minimize.hide ();149 minimize.hide ();
153 maximize.hide ();
154 unmaximize.hide ();150 unmaximize.hide ();
155 last_xid = 0;151 last_xid = 0;
156 }152 }
@@ -168,10 +164,15 @@
168 public class WindowButton : Ctk.Button164 public class WindowButton : Ctk.Button
169 {165 {
170 public static const string AMBIANCE = "/usr/share/themes/Ambiance/metacity-1";166 public static const string AMBIANCE = "/usr/share/themes/Ambiance/metacity-1";
167 public static const string AMBIANCE_BETA = "/usr/share/themes/Ambiance-maverick-beta/metacity-1";
171168
172 public string filename { get; construct; }169 public string filename { get; construct; }
173 public Clutter.Actor bg;170 public Clutter.Actor bg;
174171
172 private bool using_beta = false;
173 private int icon_size = 18;
174 private string directory = AMBIANCE;
175
175 public WindowButton (string filename)176 public WindowButton (string filename)
176 {177 {
177 Object (filename:filename);178 Object (filename:filename);
@@ -179,40 +180,46 @@
179180
180 construct181 construct
181 {182 {
183 if (using_beta = FileUtils.test (AMBIANCE_BETA, FileTest.EXISTS))
184 {
185 icon_size = 19;
186 directory = AMBIANCE_BETA;
187 }
182 try {188 try {
183189 bg = new Ctk.Image.from_filename (icon_size,
184 bg = new Ctk.Image.from_filename (20, AMBIANCE + "/" + filename);190 directory +
185 add_actor (bg);191 "/" +
192 filename +
193 ".png");
194 set_background_for_state (Ctk.ActorState.STATE_NORMAL, bg);
195 bg.show ();
196
197 bg = new Ctk.Image.from_filename (icon_size,
198 directory +
199 "/" +
200 filename +
201 "_focused_prelight.png");
202 set_background_for_state (Ctk.ActorState.STATE_PRELIGHT, bg);
203 bg.show ();
204
205 bg = new Ctk.Image.from_filename (icon_size,
206 directory +
207 "/" +
208 filename +
209 "_focused_pressed.png");
210 set_background_for_state (Ctk.ActorState.STATE_ACTIVE, bg);
186 bg.show ();211 bg.show ();
187212
188 } catch (Error e) {213 } catch (Error e) {
189 warning (@"Unable to load window button theme: You need Ambiance installed: $(e.message)");214 warning (@"Unable to load window button theme: You need Ambiance installed: $(e.message)");
190 }215 }
191
192 notify["state"].connect (() => {
193 switch (state)
194 {
195 case Ctk.ActorState.STATE_NORMAL:
196 bg.opacity = 255;
197 break;
198
199 case Ctk.ActorState.STATE_PRELIGHT:
200 bg.opacity = 120;
201 break;
202
203 case Ctk.ActorState.STATE_ACTIVE:
204 default:
205 bg.opacity = 50;
206 break;
207 }
208 });
209 }216 }
210217
211 private override void get_preferred_width (float for_height,218 private override void get_preferred_width (float for_height,
212 out float min_width,219 out float min_width,
213 out float nat_width)220 out float nat_width)
214 {221 {
215 min_width = 20.0f;222 min_width = icon_size;
216 nat_width = min_width;223 nat_width = min_width;
217 }224 }
218225
@@ -220,7 +227,7 @@
220 out float min_height,227 out float min_height,
221 out float nat_height)228 out float nat_height)
222 {229 {
223 min_height = 18.0f;230 min_height = icon_size;
224 nat_height = min_height;231 nat_height = min_height;
225 }232 }
226 }233 }
227234
=== modified file 'unity-private/unity-utils.c'
--- unity-private/unity-utils.c 2010-08-17 16:00:00 +0000
+++ unity-private/unity-utils.c 2010-08-18 20:18:44 +0000
@@ -55,7 +55,7 @@
55#define _XA_MOTIF_WM_HINTS "_MOTIF_WM_HINTS"55#define _XA_MOTIF_WM_HINTS "_MOTIF_WM_HINTS"
5656
57gboolean57gboolean
58utils_window_is_decorated (guint32 xid)58utils_window_is_decorated (Window xid)
59{59{
60 GdkDisplay *display = gdk_display_get_default();60 GdkDisplay *display = gdk_display_get_default();
61 Atom hints_atom = None;61 Atom hints_atom = None;
@@ -76,20 +76,23 @@
76 False, AnyPropertyType, &type, &format, &nitems,76 False, AnyPropertyType, &type, &format, &nitems,
77 &bytes_after, &data);77 &bytes_after, &data);
78 78
79 if (type == None || !data) return TRUE;79 if (type == None || !data)
80 {
81 return TRUE;
82 }
80 83
81 hints = (MotifWmHints *)data; 84 hints = (MotifWmHints *)data;
82 85
83 retval = hints->decorations;86 retval = hints->decorations;
84 87
85 if (data)88 if (data)
86 XFree (data);89 XFree (data);
8790
88 return retval;91 return retval == 1;
89}92}
9093
91static void94static void
92gdk_window_set_mwm_hints (guint32 xid,95gdk_window_set_mwm_hints (Window xid,
93 MotifWmHints *new_hints)96 MotifWmHints *new_hints)
94{97{
95 GdkDisplay *display = gdk_display_get_default();98 GdkDisplay *display = gdk_display_get_default();
@@ -103,7 +106,7 @@
103106
104 g_return_if_fail (GDK_IS_DISPLAY (display));107 g_return_if_fail (GDK_IS_DISPLAY (display));
105108
106 g_debug ("gdk_window_set_mwm_hints: %u %lu\n", xid, new_hints->decorations);109 g_debug ("gdk_window_set_mwm_hints: %lu %lu\n", xid, new_hints->decorations);
107 110
108 hints_atom = gdk_x11_get_xatom_by_name_for_display (display, 111 hints_atom = gdk_x11_get_xatom_by_name_for_display (display,
109 _XA_MOTIF_WM_HINTS);112 _XA_MOTIF_WM_HINTS);
@@ -148,7 +151,7 @@
148}151}
149152
150void153void
151utils_window_set_decorations (guint32 xid,154utils_window_set_decorations (Window xid,
152 GdkWMDecoration decorations)155 GdkWMDecoration decorations)
153{156{
154 MotifWmHints *hints;157 MotifWmHints *hints;
155158
=== modified file 'unity-private/utils.vala'
--- unity-private/utils.vala 2010-08-17 16:00:00 +0000
+++ unity-private/utils.vala 2010-08-18 20:18:44 +0000
@@ -117,10 +117,10 @@
117 string img2_path);117 string img2_path);
118118
119 [CCode (lower_case_prefix = "utils_")]119 [CCode (lower_case_prefix = "utils_")]
120 public extern bool window_is_decorated (uint32 xid);120 public extern bool window_is_decorated (X.Window window);
121121
122 [CCode (lower_case_prefix = "utils_")]122 [CCode (lower_case_prefix = "utils_")]
123 public extern void window_set_decorations (uint32 xid, uint decorations);123 public extern void window_set_decorations (X.Window window, uint decorations);
124124
125 [CCode (lower_case_prefix = "utils_")]125 [CCode (lower_case_prefix = "utils_")]
126 public extern void volume_eject (GLib.Volume volume);126 public extern void volume_eject (GLib.Volume volume);