Merge lp:~unity-team/unity/meta-fullscreen-detection into lp:unity

Proposed by Jason Smith
Status: Merged
Merged at revision: 329
Proposed branch: lp:~unity-team/unity/meta-fullscreen-detection
Merge into: lp:unity
Diff against target: 117 lines (+44/-6)
2 files modified
targets/mutter/plugin.vala (+42/-4)
vapi/mutter-2.28.vapi (+2/-2)
To merge this branch: bzr merge lp:~unity-team/unity/meta-fullscreen-detection
Reviewer Review Type Date Requested Status
Mikkel Kamstrup Erlandsen (community) Approve
Review via email: mp+27306@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

Looks good. But I have to comments:

 1) Perhaps remove the PointX warnings, unless its crucial for some debugging... Or at least elaborate the messages a bit if they should stay there

 2) The section

+ if (!(launcher is Launcher.Launcher) || !(panel is Clutter.Actor))
+ return;

could maybe use a comment in the code

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'targets/mutter/plugin.vala'
--- targets/mutter/plugin.vala 2010-06-10 00:17:10 +0000
+++ targets/mutter/plugin.vala 2010-06-10 20:14:22 +0000
@@ -128,6 +128,8 @@
128 private Panel.View panel;128 private Panel.View panel;
129 private ActorBlur actor_blur;129 private ActorBlur actor_blur;
130 private Clutter.Rectangle dark_box;130 private Clutter.Rectangle dark_box;
131 private unowned Mutter.MetaWindow? focus_window = null;
132 private unowned Mutter.MetaDisplay? display = null;
131133
132 private bool places_enabled = false;134 private bool places_enabled = false;
133135
@@ -153,8 +155,6 @@
153 private DBus.Connection screensaver_conn;155 private DBus.Connection screensaver_conn;
154 private dynamic DBus.Object screensaver;156 private dynamic DBus.Object screensaver;
155157
156 private unowned Mutter.Window? active_window = null;
157
158 construct158 construct
159 {159 {
160 Unity.global_shell = this;160 Unity.global_shell = this;
@@ -293,6 +293,25 @@
293 this.ensure_input_region ();293 this.ensure_input_region ();
294 return false;294 return false;
295 }295 }
296
297 private void on_focus_window_changed ()
298 {
299 check_fullscreen_obstruction ();
300
301 if (focus_window != null)
302 {
303 focus_window.notify["fullscreen"].disconnect (on_focus_window_fullscreen_changed);
304 }
305
306 display.get ("focus-window", ref focus_window);
307 focus_window.notify["fullscreen"].connect (on_focus_window_fullscreen_changed);
308 }
309
310 private void on_focus_window_fullscreen_changed ()
311 {
312 warning ("FOCUS WINDOW FULLSCREEN CHANGED");
313 check_fullscreen_obstruction ();
314 }
296315
297 private void got_screensaver_changed (dynamic DBus.Object screensaver, bool changed)316 private void got_screensaver_changed (dynamic DBus.Object screensaver, bool changed)
298 {317 {
@@ -315,19 +334,32 @@
315334
316 void check_fullscreen_obstruction ()335 void check_fullscreen_obstruction ()
317 {336 {
337 warning ("Point0");
318 Mutter.Window focus = null;338 Mutter.Window focus = null;
319 bool fullscreen = false;339 bool fullscreen = false;
340
341 if (!(launcher is Launcher.Launcher) || !(panel is Clutter.Actor))
342 return;
343
344 warning ("Point1");
320345
321 unowned GLib.List<Mutter.Window> mutter_windows = plugin.get_windows ();346 unowned GLib.List<Mutter.Window> mutter_windows = plugin.get_windows ();
322 foreach (Mutter.Window w in mutter_windows)347 foreach (Mutter.Window w in mutter_windows)
323 {348 {
324 if (Mutter.MetaWindow.has_focus (w.get_meta_window ()))349 unowned Mutter.MetaWindow meta = w.get_meta_window ();
325 focus = w;350
351 if (meta != null && Mutter.MetaWindow.has_focus (w.get_meta_window ()))
352 {
353 focus = w;
354 break;
355 }
326 }356 }
327 357
328 if (focus == null)358 if (focus == null)
329 return;359 return;
330 360
361 warning ("Point2");
362
331 (focus.get_meta_window () as GLib.Object).get ("fullscreen", ref fullscreen);363 (focus.get_meta_window () as GLib.Object).get ("fullscreen", ref fullscreen);
332 if (fullscreen)364 if (fullscreen)
333 {365 {
@@ -675,6 +707,12 @@
675 {707 {
676 this.maximus.process_window (window);708 this.maximus.process_window (window);
677 this.window_mapped (this, window);709 this.window_mapped (this, window);
710
711 if (display == null)
712 {
713 display = Mutter.MetaWindow.get_display (window.get_meta_window ());
714 display.notify["focus-window"].connect (on_focus_window_changed);
715 }
678 }716 }
679717
680 public void destroy (Mutter.Window window)718 public void destroy (Mutter.Window window)
681719
=== modified file 'vapi/mutter-2.28.vapi'
--- vapi/mutter-2.28.vapi 2010-03-01 19:57:23 +0000
+++ vapi/mutter-2.28.vapi 2010-06-10 20:14:22 +0000
@@ -85,7 +85,7 @@
85 }85 }
86 [Compact]86 [Compact]
87 [CCode (cheader_filename = "mutter-plugins.h", cname = "MetaDisplay")]87 [CCode (cheader_filename = "mutter-plugins.h", cname = "MetaDisplay")]
88 public class MetaDisplay {88 public class MetaDisplay : GLib.Object {
89 [CCode (cname = "meta_display_begin_grab_op")]89 [CCode (cname = "meta_display_begin_grab_op")]
90 public static bool begin_grab_op (Mutter.MetaDisplay display, Mutter.MetaScreen screen, Mutter.MetaWindow window, Mutter.MetaGrabOp op, bool pointer_already_grabbed, bool frame_action, int button, ulong modmask, uint32 timestamp, int root_x, int root_y);90 public static bool begin_grab_op (Mutter.MetaDisplay display, Mutter.MetaScreen screen, Mutter.MetaWindow window, Mutter.MetaGrabOp op, bool pointer_already_grabbed, bool frame_action, int button, ulong modmask, uint32 timestamp, int root_x, int root_y);
91 [CCode (cname = "meta_display_end_grab_op")]91 [CCode (cname = "meta_display_end_grab_op")]
@@ -675,7 +675,7 @@
675 }675 }
676 [Compact]676 [Compact]
677 [CCode (cheader_filename = "mutter-plugins.h", cname = "MetaWindow")]677 [CCode (cheader_filename = "mutter-plugins.h", cname = "MetaWindow")]
678 public class MetaWindow {678 public class MetaWindow : GLib.Object {
679 [CCode (cname = "meta_window_activate")]679 [CCode (cname = "meta_window_activate")]
680 public static void activate (Mutter.MetaWindow window, uint32 current_time);680 public static void activate (Mutter.MetaWindow window, uint32 current_time);
681 [CCode (cname = "meta_window_activate_with_workspace")]681 [CCode (cname = "meta_window_activate_with_workspace")]