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
=== modified file 'src/PanelMenuView.cpp'
--- src/PanelMenuView.cpp 2011-06-01 23:46:41 +0000
+++ src/PanelMenuView.cpp 2011-06-04 06:25:38 +0000
@@ -120,6 +120,8 @@
120120
121 _on_window_maximized_connection = win_manager->window_maximized.connect (sigc::mem_fun (this, &PanelMenuView::OnWindowMaximized));121 _on_window_maximized_connection = win_manager->window_maximized.connect (sigc::mem_fun (this, &PanelMenuView::OnWindowMaximized));
122 _on_window_restored_connection = win_manager->window_restored.connect (sigc::mem_fun (this, &PanelMenuView::OnWindowRestored));122 _on_window_restored_connection = win_manager->window_restored.connect (sigc::mem_fun (this, &PanelMenuView::OnWindowRestored));
123 _on_window_undecorated_connection = win_manager->window_undecorated.connect (sigc::mem_fun (this, &PanelMenuView::OnWindowUndecorated));
124 _on_window_decorated_connection = win_manager->window_decorated.connect (sigc::mem_fun (this, &PanelMenuView::OnWindowDecorated));
123 _on_window_unmapped_connection = win_manager->window_unmapped.connect (sigc::mem_fun (this, &PanelMenuView::OnWindowUnmapped));125 _on_window_unmapped_connection = win_manager->window_unmapped.connect (sigc::mem_fun (this, &PanelMenuView::OnWindowUnmapped));
124 _on_window_moved_connection = win_manager->window_moved.connect (sigc::mem_fun (this, &PanelMenuView::OnWindowMoved));126 _on_window_moved_connection = win_manager->window_moved.connect (sigc::mem_fun (this, &PanelMenuView::OnWindowMoved));
125127
@@ -155,6 +157,8 @@
155 _on_window_unmapped_connection.disconnect ();157 _on_window_unmapped_connection.disconnect ();
156 _on_window_moved_connection.disconnect ();158 _on_window_moved_connection.disconnect ();
157 _on_panelstyle_changed_connection.disconnect ();159 _on_panelstyle_changed_connection.disconnect ();
160 _on_window_decorated_connection.disconnect ();
161 _on_window_undecorated_connection.disconnect ();
158162
159 if (_name_changed_callback_id)163 if (_name_changed_callback_id)
160 g_signal_handler_disconnect (_name_changed_callback_instance,164 g_signal_handler_disconnect (_name_changed_callback_instance,
@@ -823,6 +827,7 @@
823 827
824 if (_decor_map[xid])828 if (_decor_map[xid])
825 {829 {
830 _pending_maximize_set.insert (xid);
826 WindowManager::Default ()->Undecorate (xid);831 WindowManager::Default ()->Undecorate (xid);
827 }832 }
828833
@@ -833,6 +838,26 @@
833}838}
834839
835void840void
841PanelMenuView::OnWindowDecorated (guint xid)
842{
843 /* Skip undecoration from recent maximize */
844 if (!_decor_map[xid] && _pending_maximize_set.find (xid) == _pending_maximize_set.end ())
845 _decor_map[xid] = true;
846
847 _pending_maximize_set.erase (xid);
848}
849
850void
851PanelMenuView::OnWindowUndecorated (guint xid)
852{
853 /* Skip undecoration from recent unmaximize */
854 if (_decor_map[xid] && _pending_maximize_set.find (xid) == _pending_maximize_set.end ())
855 _decor_map[xid] = false;
856
857 _pending_maximize_set.erase (xid);
858}
859
860void
836PanelMenuView::OnWindowRestored (guint xid)861PanelMenuView::OnWindowRestored (guint xid)
837{862{
838 BamfWindow *window;863 BamfWindow *window;
@@ -845,9 +870,10 @@
845870
846 if (_decor_map[xid])871 if (_decor_map[xid])
847 {872 {
873 _pending_maximize_set.insert (xid);
848 WindowManager::Default ()->Decorate (xid);874 WindowManager::Default ()->Decorate (xid);
849 }875 }
850 876
851 _maximized_set.erase (xid);877 _maximized_set.erase (xid);
852878
853 Refresh ();879 Refresh ();
854880
=== modified file 'src/PanelMenuView.h'
--- src/PanelMenuView.h 2011-05-29 22:18:50 +0000
+++ src/PanelMenuView.h 2011-06-04 06:25:38 +0000
@@ -75,6 +75,8 @@
75 void OnWindowMaximized (guint32 xid);75 void OnWindowMaximized (guint32 xid);
76 void OnWindowRestored (guint32 xid);76 void OnWindowRestored (guint32 xid);
77 void OnWindowMoved (guint32 xid);77 void OnWindowMoved (guint32 xid);
78 void OnWindowDecorated (guint32 xid);
79 void OnWindowUndecorated (guint32 xid);
7880
79 guint32 GetMaximizedWindow ();81 guint32 GetMaximizedWindow ();
8082
@@ -126,6 +128,7 @@
126128
127 std::map<guint32, bool> _decor_map;129 std::map<guint32, bool> _decor_map;
128 std::set<guint32> _maximized_set;130 std::set<guint32> _maximized_set;
131 std::set<guint32> _pending_maximize_set;
129 int _padding;132 int _padding;
130 gpointer _name_changed_callback_instance;133 gpointer _name_changed_callback_instance;
131 gulong _name_changed_callback_id;134 gulong _name_changed_callback_id;
@@ -155,6 +158,8 @@
155 sigc::connection _on_window_terminatespread_connection;158 sigc::connection _on_window_terminatespread_connection;
156 sigc::connection _on_window_maximized_connection;159 sigc::connection _on_window_maximized_connection;
157 sigc::connection _on_window_restored_connection;160 sigc::connection _on_window_restored_connection;
161 sigc::connection _on_window_decorated_connection;
162 sigc::connection _on_window_undecorated_connection;
158 sigc::connection _on_window_unmapped_connection;163 sigc::connection _on_window_unmapped_connection;
159 sigc::connection _on_window_moved_connection;164 sigc::connection _on_window_moved_connection;
160 sigc::connection _on_panelstyle_changed_connection;165 sigc::connection _on_panelstyle_changed_connection;
161166
=== modified file 'src/WindowManager.h'
--- src/WindowManager.h 2011-04-18 17:39:17 +0000
+++ src/WindowManager.h 2011-06-04 06:25:38 +0000
@@ -83,6 +83,8 @@
83 sigc::signal<void, guint32> window_resized;83 sigc::signal<void, guint32> window_resized;
84 sigc::signal<void, guint32> window_moved;84 sigc::signal<void, guint32> window_moved;
85 sigc::signal<void, guint32> window_focus_changed;85 sigc::signal<void, guint32> window_focus_changed;
86 sigc::signal<void, guint32> window_decorated;
87 sigc::signal<void, guint32> window_undecorated;
86 88
87 sigc::signal<void> initiate_spread;89 sigc::signal<void> initiate_spread;
88 sigc::signal<void> terminate_spread;90 sigc::signal<void> terminate_spread;
8991
=== modified file 'src/unityshell.cpp'
--- src/unityshell.cpp 2011-06-02 17:27:06 +0000
+++ src/unityshell.cpp 2011-06-04 06:25:38 +0000
@@ -285,6 +285,33 @@
285 if (!skip_other_plugins)285 if (!skip_other_plugins)
286 screen->handleEvent (event);286 screen->handleEvent (event);
287287
288 if (event->type == PropertyNotify)
289 {
290 if (event->xproperty.atom == Atoms::mwmHints)
291 {
292 CompWindow *w = screen->findWindow (event->xproperty.window);
293
294 if (w)
295 {
296 UnityWindow *uw = UnityWindow::get (w);
297
298 if (w->mwmDecor () != uw->mOldMwmDecor)
299 {
300 if (w->mwmDecor () & (MwmDecorAll | MwmDecorTitle))
301 {
302 WindowManager::Default ()->window_decorated.emit (w->id ());
303 }
304 else
305 {
306 WindowManager::Default ()->window_undecorated.emit (w->id ());
307 }
308
309 uw->mOldMwmDecor = w->mwmDecor ();
310 }
311 }
312 }
313 }
314
288 if (!skip_other_plugins && screen->otherGrabExist ("deco", "move", "switcher", "resize", NULL))315 if (!skip_other_plugins && screen->otherGrabExist ("deco", "move", "switcher", "resize", NULL))
289 {316 {
290 wt->ProcessForeignEvent (event, NULL);317 wt->ProcessForeignEvent (event, NULL);
@@ -1086,7 +1113,8 @@
1086UnityWindow::UnityWindow (CompWindow *window) :1113UnityWindow::UnityWindow (CompWindow *window) :
1087 PluginClassHandler <UnityWindow, CompWindow> (window),1114 PluginClassHandler <UnityWindow, CompWindow> (window),
1088 window (window),1115 window (window),
1089 gWindow (GLWindow::get (window))1116 gWindow (GLWindow::get (window)),
1117 mOldMwmDecor (window->mwmDecor ())
1090{1118{
1091 WindowInterface::setHandler (window);1119 WindowInterface::setHandler (window);
1092 GLWindowInterface::setHandler (gWindow);1120 GLWindowInterface::setHandler (gWindow);
10931121
=== modified file 'src/unityshell.h'
--- src/unityshell.h 2011-05-31 03:28:29 +0000
+++ src/unityshell.h 2011-06-04 06:25:38 +0000
@@ -260,6 +260,8 @@
260 CompWindow *window;260 CompWindow *window;
261 GLWindow *gWindow;261 GLWindow *gWindow;
262262
263 unsigned int mOldMwmDecor;
264
263 /* basic window draw function */265 /* basic window draw function */
264 bool266 bool
265 glDraw (const GLMatrix &matrix,267 glDraw (const GLMatrix &matrix,