Merge lp:~unity-team/unity/unity.fix_787277 into lp:unity

Proposed by Sam Spilsbury
Status: Rejected
Rejected by: Neil J. Patel
Proposed branch: lp:~unity-team/unity/unity.fix_787277
Merge into: lp:unity
Diff against target: 172 lines (+65/-2)
5 files modified
src/PanelMenuView.cpp (+27/-1)
src/PanelMenuView.h (+5/-0)
src/WindowManager.h (+2/-0)
src/unityshell.cpp (+29/-1)
src/unityshell.h (+2/-0)
To merge this branch: bzr merge lp:~unity-team/unity/unity.fix_787277
Reviewer Review Type Date Requested Status
Alex Launi (community) Needs Fixing
Review via email: mp+63453@code.launchpad.net

Description of the change

Fixes LP#787277

Track when windows set decoration hints and take this into account when undecorating and redecorating windows

To post a comment you must log in.
Revision history for this message
Alex Launi (alexlauni) wrote :

I merged this branch but the behavior did not go away. The problem remains.

review: Needs Fixing

Unmerged revisions

1209. By Sam Spilsbury

Track windows that decorate and undecorate themselves and factor this into
the decision to decorate and undecorate windows on maximize. Fixes LP#787277

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/PanelMenuView.cpp'
2--- src/PanelMenuView.cpp 2011-06-01 23:46:41 +0000
3+++ src/PanelMenuView.cpp 2011-06-04 06:25:38 +0000
4@@ -120,6 +120,8 @@
5
6 _on_window_maximized_connection = win_manager->window_maximized.connect (sigc::mem_fun (this, &PanelMenuView::OnWindowMaximized));
7 _on_window_restored_connection = win_manager->window_restored.connect (sigc::mem_fun (this, &PanelMenuView::OnWindowRestored));
8+ _on_window_undecorated_connection = win_manager->window_undecorated.connect (sigc::mem_fun (this, &PanelMenuView::OnWindowUndecorated));
9+ _on_window_decorated_connection = win_manager->window_decorated.connect (sigc::mem_fun (this, &PanelMenuView::OnWindowDecorated));
10 _on_window_unmapped_connection = win_manager->window_unmapped.connect (sigc::mem_fun (this, &PanelMenuView::OnWindowUnmapped));
11 _on_window_moved_connection = win_manager->window_moved.connect (sigc::mem_fun (this, &PanelMenuView::OnWindowMoved));
12
13@@ -155,6 +157,8 @@
14 _on_window_unmapped_connection.disconnect ();
15 _on_window_moved_connection.disconnect ();
16 _on_panelstyle_changed_connection.disconnect ();
17+ _on_window_decorated_connection.disconnect ();
18+ _on_window_undecorated_connection.disconnect ();
19
20 if (_name_changed_callback_id)
21 g_signal_handler_disconnect (_name_changed_callback_instance,
22@@ -823,6 +827,7 @@
23
24 if (_decor_map[xid])
25 {
26+ _pending_maximize_set.insert (xid);
27 WindowManager::Default ()->Undecorate (xid);
28 }
29
30@@ -833,6 +838,26 @@
31 }
32
33 void
34+PanelMenuView::OnWindowDecorated (guint xid)
35+{
36+ /* Skip undecoration from recent maximize */
37+ if (!_decor_map[xid] && _pending_maximize_set.find (xid) == _pending_maximize_set.end ())
38+ _decor_map[xid] = true;
39+
40+ _pending_maximize_set.erase (xid);
41+}
42+
43+void
44+PanelMenuView::OnWindowUndecorated (guint xid)
45+{
46+ /* Skip undecoration from recent unmaximize */
47+ if (_decor_map[xid] && _pending_maximize_set.find (xid) == _pending_maximize_set.end ())
48+ _decor_map[xid] = false;
49+
50+ _pending_maximize_set.erase (xid);
51+}
52+
53+void
54 PanelMenuView::OnWindowRestored (guint xid)
55 {
56 BamfWindow *window;
57@@ -845,9 +870,10 @@
58
59 if (_decor_map[xid])
60 {
61+ _pending_maximize_set.insert (xid);
62 WindowManager::Default ()->Decorate (xid);
63 }
64-
65+
66 _maximized_set.erase (xid);
67
68 Refresh ();
69
70=== modified file 'src/PanelMenuView.h'
71--- src/PanelMenuView.h 2011-05-29 22:18:50 +0000
72+++ src/PanelMenuView.h 2011-06-04 06:25:38 +0000
73@@ -75,6 +75,8 @@
74 void OnWindowMaximized (guint32 xid);
75 void OnWindowRestored (guint32 xid);
76 void OnWindowMoved (guint32 xid);
77+ void OnWindowDecorated (guint32 xid);
78+ void OnWindowUndecorated (guint32 xid);
79
80 guint32 GetMaximizedWindow ();
81
82@@ -126,6 +128,7 @@
83
84 std::map<guint32, bool> _decor_map;
85 std::set<guint32> _maximized_set;
86+ std::set<guint32> _pending_maximize_set;
87 int _padding;
88 gpointer _name_changed_callback_instance;
89 gulong _name_changed_callback_id;
90@@ -155,6 +158,8 @@
91 sigc::connection _on_window_terminatespread_connection;
92 sigc::connection _on_window_maximized_connection;
93 sigc::connection _on_window_restored_connection;
94+ sigc::connection _on_window_decorated_connection;
95+ sigc::connection _on_window_undecorated_connection;
96 sigc::connection _on_window_unmapped_connection;
97 sigc::connection _on_window_moved_connection;
98 sigc::connection _on_panelstyle_changed_connection;
99
100=== modified file 'src/WindowManager.h'
101--- src/WindowManager.h 2011-04-18 17:39:17 +0000
102+++ src/WindowManager.h 2011-06-04 06:25:38 +0000
103@@ -83,6 +83,8 @@
104 sigc::signal<void, guint32> window_resized;
105 sigc::signal<void, guint32> window_moved;
106 sigc::signal<void, guint32> window_focus_changed;
107+ sigc::signal<void, guint32> window_decorated;
108+ sigc::signal<void, guint32> window_undecorated;
109
110 sigc::signal<void> initiate_spread;
111 sigc::signal<void> terminate_spread;
112
113=== modified file 'src/unityshell.cpp'
114--- src/unityshell.cpp 2011-06-02 17:27:06 +0000
115+++ src/unityshell.cpp 2011-06-04 06:25:38 +0000
116@@ -285,6 +285,33 @@
117 if (!skip_other_plugins)
118 screen->handleEvent (event);
119
120+ if (event->type == PropertyNotify)
121+ {
122+ if (event->xproperty.atom == Atoms::mwmHints)
123+ {
124+ CompWindow *w = screen->findWindow (event->xproperty.window);
125+
126+ if (w)
127+ {
128+ UnityWindow *uw = UnityWindow::get (w);
129+
130+ if (w->mwmDecor () != uw->mOldMwmDecor)
131+ {
132+ if (w->mwmDecor () & (MwmDecorAll | MwmDecorTitle))
133+ {
134+ WindowManager::Default ()->window_decorated.emit (w->id ());
135+ }
136+ else
137+ {
138+ WindowManager::Default ()->window_undecorated.emit (w->id ());
139+ }
140+
141+ uw->mOldMwmDecor = w->mwmDecor ();
142+ }
143+ }
144+ }
145+ }
146+
147 if (!skip_other_plugins && screen->otherGrabExist ("deco", "move", "switcher", "resize", NULL))
148 {
149 wt->ProcessForeignEvent (event, NULL);
150@@ -1086,7 +1113,8 @@
151 UnityWindow::UnityWindow (CompWindow *window) :
152 PluginClassHandler <UnityWindow, CompWindow> (window),
153 window (window),
154- gWindow (GLWindow::get (window))
155+ gWindow (GLWindow::get (window)),
156+ mOldMwmDecor (window->mwmDecor ())
157 {
158 WindowInterface::setHandler (window);
159 GLWindowInterface::setHandler (gWindow);
160
161=== modified file 'src/unityshell.h'
162--- src/unityshell.h 2011-05-31 03:28:29 +0000
163+++ src/unityshell.h 2011-06-04 06:25:38 +0000
164@@ -260,6 +260,8 @@
165 CompWindow *window;
166 GLWindow *gWindow;
167
168+ unsigned int mOldMwmDecor;
169+
170 /* basic window draw function */
171 bool
172 glDraw (const GLMatrix &matrix,