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.

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
1=== modified file 'targets/mutter/plugin.vala'
2--- targets/mutter/plugin.vala 2010-06-10 00:17:10 +0000
3+++ targets/mutter/plugin.vala 2010-06-10 20:14:22 +0000
4@@ -128,6 +128,8 @@
5 private Panel.View panel;
6 private ActorBlur actor_blur;
7 private Clutter.Rectangle dark_box;
8+ private unowned Mutter.MetaWindow? focus_window = null;
9+ private unowned Mutter.MetaDisplay? display = null;
10
11 private bool places_enabled = false;
12
13@@ -153,8 +155,6 @@
14 private DBus.Connection screensaver_conn;
15 private dynamic DBus.Object screensaver;
16
17- private unowned Mutter.Window? active_window = null;
18-
19 construct
20 {
21 Unity.global_shell = this;
22@@ -293,6 +293,25 @@
23 this.ensure_input_region ();
24 return false;
25 }
26+
27+ private void on_focus_window_changed ()
28+ {
29+ check_fullscreen_obstruction ();
30+
31+ if (focus_window != null)
32+ {
33+ focus_window.notify["fullscreen"].disconnect (on_focus_window_fullscreen_changed);
34+ }
35+
36+ display.get ("focus-window", ref focus_window);
37+ focus_window.notify["fullscreen"].connect (on_focus_window_fullscreen_changed);
38+ }
39+
40+ private void on_focus_window_fullscreen_changed ()
41+ {
42+ warning ("FOCUS WINDOW FULLSCREEN CHANGED");
43+ check_fullscreen_obstruction ();
44+ }
45
46 private void got_screensaver_changed (dynamic DBus.Object screensaver, bool changed)
47 {
48@@ -315,19 +334,32 @@
49
50 void check_fullscreen_obstruction ()
51 {
52+ warning ("Point0");
53 Mutter.Window focus = null;
54 bool fullscreen = false;
55+
56+ if (!(launcher is Launcher.Launcher) || !(panel is Clutter.Actor))
57+ return;
58+
59+ warning ("Point1");
60
61 unowned GLib.List<Mutter.Window> mutter_windows = plugin.get_windows ();
62 foreach (Mutter.Window w in mutter_windows)
63 {
64- if (Mutter.MetaWindow.has_focus (w.get_meta_window ()))
65- focus = w;
66+ unowned Mutter.MetaWindow meta = w.get_meta_window ();
67+
68+ if (meta != null && Mutter.MetaWindow.has_focus (w.get_meta_window ()))
69+ {
70+ focus = w;
71+ break;
72+ }
73 }
74
75 if (focus == null)
76 return;
77
78+ warning ("Point2");
79+
80 (focus.get_meta_window () as GLib.Object).get ("fullscreen", ref fullscreen);
81 if (fullscreen)
82 {
83@@ -675,6 +707,12 @@
84 {
85 this.maximus.process_window (window);
86 this.window_mapped (this, window);
87+
88+ if (display == null)
89+ {
90+ display = Mutter.MetaWindow.get_display (window.get_meta_window ());
91+ display.notify["focus-window"].connect (on_focus_window_changed);
92+ }
93 }
94
95 public void destroy (Mutter.Window window)
96
97=== modified file 'vapi/mutter-2.28.vapi'
98--- vapi/mutter-2.28.vapi 2010-03-01 19:57:23 +0000
99+++ vapi/mutter-2.28.vapi 2010-06-10 20:14:22 +0000
100@@ -85,7 +85,7 @@
101 }
102 [Compact]
103 [CCode (cheader_filename = "mutter-plugins.h", cname = "MetaDisplay")]
104- public class MetaDisplay {
105+ public class MetaDisplay : GLib.Object {
106 [CCode (cname = "meta_display_begin_grab_op")]
107 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);
108 [CCode (cname = "meta_display_end_grab_op")]
109@@ -675,7 +675,7 @@
110 }
111 [Compact]
112 [CCode (cheader_filename = "mutter-plugins.h", cname = "MetaWindow")]
113- public class MetaWindow {
114+ public class MetaWindow : GLib.Object {
115 [CCode (cname = "meta_window_activate")]
116 public static void activate (Mutter.MetaWindow window, uint32 current_time);
117 [CCode (cname = "meta_window_activate_with_workspace")]