Merge lp:~gala-dev/gala/window-left-monitor into lp:gala

Proposed by Tom Beckmann
Status: Merged
Merged at revision: 324
Proposed branch: lp:~gala-dev/gala/window-left-monitor
Merge into: lp:gala
Diff against target: 136 lines (+51/-3)
3 files modified
src/Widgets/WindowOverview.vala (+19/-0)
src/Widgets/WindowSwitcher.vala (+19/-3)
src/Widgets/WorkspaceThumb.vala (+13/-0)
To merge this branch: bzr merge lp:~gala-dev/gala/window-left-monitor
Reviewer Review Type Date Requested Status
Rico Tzschichholz Approve
Review via email: mp+162420@code.launchpad.net

Description of the change

Adds watches for window_left_monitor where we use clones. This makes sure that for example windows that are displayed on all workspaces will correctly be removed when they are closed, preventing meta_window_appears_focused crashes.

To post a comment you must log in.
Revision history for this message
Rico Tzschichholz (ricotz) wrote :

You can't use "window.located_on_workspace (workspace)" which is not available in mutter 3.4/3.6

Therefore use:
  return (window->on_all_workspaces && window->screen == workspace->screen) ||
    (window->workspace == workspace);

review: Needs Fixing
Revision history for this message
Rico Tzschichholz (ricotz) wrote :

I know I backported it from 3.8 to 3.4 which wasn't the best idea since I have no plans to maintain a patched 3.6 package too.

326. By Tom Beckmann

dont use meta_window_located_on_workspace where it's not available

Revision history for this message
Rico Tzschichholz (ricotz) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Widgets/WindowOverview.vala'
2--- src/Widgets/WindowOverview.vala 2013-03-27 16:52:39 +0000
3+++ src/Widgets/WindowOverview.vala 2013-05-11 13:05:28 +0000
4@@ -565,6 +565,8 @@
5 workspace.window_added.connect (add_window);
6 workspace.window_removed.connect (remove_window);
7 }
8+
9+ screen.window_left_monitor.connect (window_left_monitor);
10
11 #if HAS_MUTTER38
12 plugin.wallpaper.
13@@ -601,6 +603,22 @@
14
15 calculate_places (get_children ());
16 }
17+
18+ void window_left_monitor (int num, Window window)
19+ {
20+ // see if that's happened on one of our workspaces
21+ foreach (var workspace in workspaces) {
22+#if HAS_MUTTER38
23+ if (window.located_on_workspace (workspace)) {
24+#else
25+ if (window.get_workspace () == workspace ||
26+ (window.is_on_all_workspaces () && window.get_screen () == workspace.get_screen ()) {
27+#endif
28+ remove_window (window);
29+ return;
30+ }
31+ }
32+ }
33
34 void add_window (Window window)
35 {
36@@ -681,6 +699,7 @@
37 workspace.window_added.disconnect (add_window);
38 workspace.window_removed.disconnect (remove_window);
39 }
40+ screen.window_left_monitor.disconnect (window_left_monitor);
41
42 ready = false;
43
44
45=== modified file 'src/Widgets/WindowSwitcher.vala'
46--- src/Widgets/WindowSwitcher.vala 2013-04-28 09:30:41 +0000
47+++ src/Widgets/WindowSwitcher.vala 2013-05-11 13:05:28 +0000
48@@ -132,10 +132,7 @@
49 closing = true;
50
51 var screen = plugin.get_screen ();
52-
53 var workspace = screen.get_active_workspace ();
54- workspace.window_added.disconnect (add_window);
55- workspace.window_removed.disconnect (remove_window);
56
57 if (dock_window != null)
58 dock_window.opacity = 0;
59@@ -186,6 +183,10 @@
60 if (window.get_workspace () == workspace.index ())
61 window.show ();
62 }
63+
64+ workspace.window_added.disconnect (add_window);
65+ workspace.window_removed.disconnect (remove_window);
66+ screen.window_left_monitor.disconnect (window_left_monitor);
67 });
68 }
69
70@@ -278,6 +279,20 @@
71 i++;
72 }
73 }
74+
75+ void window_left_monitor (int num, Meta.Window window)
76+ {
77+ // see if that's happened on our workspace
78+ var workspace = plugin.get_screen ().get_active_workspace ();
79+#if HAS_MUTTER38
80+ if (window.located_on_workspace (workspace)) {
81+#else
82+ if (window.get_workspace () == workspace ||
83+ (window.is_on_all_workspaces () && window.get_screen () == workspace.get_screen ()) {
84+#endif
85+ remove_window (window);
86+ }
87+ }
88
89 void add_window (Meta.Window window)
90 {
91@@ -423,6 +438,7 @@
92
93 workspace.window_added.connect (add_window);
94 workspace.window_removed.connect (remove_window);
95+ screen.window_left_monitor.connect (window_left_monitor);
96
97 //grab the windows to be switched
98 var layout = dock.layout_manager as BoxLayout;
99
100=== modified file 'src/Widgets/WorkspaceThumb.vala'
101--- src/Widgets/WorkspaceThumb.vala 2013-03-29 17:45:46 +0000
102+++ src/Widgets/WorkspaceThumb.vala 2013-05-11 13:05:28 +0000
103@@ -78,6 +78,7 @@
104
105 workspace.window_added.connect (handle_window_added);
106 workspace.window_removed.connect (handle_window_removed);
107+ screen.window_left_monitor.connect (window_left_monitor);
108
109 reactive = true;
110
111@@ -259,6 +260,7 @@
112 screen.workspace_switched.disconnect (handle_workspace_switched);
113 screen.workspace_added.disconnect (workspace_added);
114 screen.monitors_changed.disconnect (resize);
115+ screen.window_left_monitor.disconnect (window_left_monitor);
116 }
117
118 void close_workspace (Clutter.Actor actor)
119@@ -329,6 +331,17 @@
120 check_last_workspace ();
121 }
122
123+ void window_left_monitor (int num, Meta.Window window)
124+ {
125+#if HAS_MUTTER38
126+ if (window.located_on_workspace (workspace))
127+#else
128+ if (window.get_workspace () == workspace ||
129+ (window.is_on_all_workspaces () && window.get_screen () == workspace.get_screen ())
130+#endif
131+ handle_window_removed (window);
132+ }
133+
134 void update_windows ()
135 {
136 windows.remove_all_children ();

Subscribers

People subscribed via source and target branches