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

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 1582
Proposed branch: lp:~unity-team/unity/unity.fix_732997
Merge into: lp:unity
Diff against target: 332 lines (+78/-44)
13 files modified
plugins/unityshell/src/BamfLauncherIcon.cpp (+7/-1)
plugins/unityshell/src/PluginAdapter.cpp (+12/-0)
plugins/unityshell/src/PluginAdapter.h (+1/-0)
plugins/unityshell/src/SwitcherController.cpp (+7/-12)
plugins/unityshell/src/SwitcherController.h (+1/-3)
plugins/unityshell/src/SwitcherModel.cpp (+4/-4)
plugins/unityshell/src/SwitcherModel.h (+1/-1)
plugins/unityshell/src/SwitcherView.cpp (+1/-1)
plugins/unityshell/src/SwitcherView.h (+1/-1)
plugins/unityshell/src/WindowManager.cpp (+5/-0)
plugins/unityshell/src/WindowManager.h (+1/-0)
plugins/unityshell/src/compizminimizedwindowhandler.h (+4/-3)
plugins/unityshell/src/unityshell.cpp (+33/-18)
To merge this branch: bzr merge lp:~unity-team/unity/unity.fix_732997
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Review via email: mp+76065@code.launchpad.net

Description of the change

Don't override minimization and unminimization for windows that have not yet been mapped and do not show windows with inaccessible pixmaps (because they're withdrawn or started unmapped) in the switcher detail view

To post a comment you must log in.
Revision history for this message
Jason Smith (jassmith) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/unityshell/src/BamfLauncherIcon.cpp'
--- plugins/unityshell/src/BamfLauncherIcon.cpp 2011-09-12 14:59:42 +0000
+++ plugins/unityshell/src/BamfLauncherIcon.cpp 2011-09-19 16:41:04 +0000
@@ -246,13 +246,19 @@
246 std::vector<Window> results;246 std::vector<Window> results;
247 GList* children, *l;247 GList* children, *l;
248 BamfView* view;248 BamfView* view;
249 WindowManager *wm = WindowManager::Default ();
249250
250 children = bamf_view_get_children(BAMF_VIEW(m_App));251 children = bamf_view_get_children(BAMF_VIEW(m_App));
251 for (l = children; l; l = l->next)252 for (l = children; l; l = l->next)
252 {253 {
253 view = (BamfView*) l->data;254 view = (BamfView*) l->data;
254 if (BAMF_IS_WINDOW(view))255 if (BAMF_IS_WINDOW(view))
255 results.push_back ((Window) bamf_window_get_xid(BAMF_WINDOW(view)));256 {
257 guint32 xid = bamf_window_get_xid(BAMF_WINDOW(view));
258
259 if (wm->IsWindowMapped(xid))
260 results.push_back ((Window) xid);
261 }
256 }262 }
257263
258 g_list_free(children);264 g_list_free(children);
259265
=== modified file 'plugins/unityshell/src/PluginAdapter.cpp'
--- plugins/unityshell/src/PluginAdapter.cpp 2011-09-12 02:41:10 +0000
+++ plugins/unityshell/src/PluginAdapter.cpp 2011-09-19 16:41:04 +0000
@@ -458,6 +458,18 @@
458 return false;458 return false;
459}459}
460460
461bool
462PluginAdapter::IsWindowMapped(guint32 xid)
463{
464 Window win = (Window) xid;
465 CompWindow* window;
466
467 window = m_Screen->findWindow(win);
468 if (window)
469 return window->mapNum () > 0;
470 return true;
471}
472
461void473void
462PluginAdapter::Restore(guint32 xid)474PluginAdapter::Restore(guint32 xid)
463{475{
464476
=== modified file 'plugins/unityshell/src/PluginAdapter.h'
--- plugins/unityshell/src/PluginAdapter.h 2011-08-31 20:31:03 +0000
+++ plugins/unityshell/src/PluginAdapter.h 2011-09-19 16:41:04 +0000
@@ -113,6 +113,7 @@
113 bool IsWindowDecorated(guint xid);113 bool IsWindowDecorated(guint xid);
114 bool IsWindowOnCurrentDesktop(guint xid);114 bool IsWindowOnCurrentDesktop(guint xid);
115 bool IsWindowObscured(guint xid);115 bool IsWindowObscured(guint xid);
116 bool IsWindowMapped(guint xid);
116 void Restore(guint32 xid);117 void Restore(guint32 xid);
117 void Minimize(guint32 xid);118 void Minimize(guint32 xid);
118 void Close(guint32 xid);119 void Close(guint32 xid);
119120
=== modified file 'plugins/unityshell/src/SwitcherController.cpp'
--- plugins/unityshell/src/SwitcherController.cpp 2011-09-15 23:12:57 +0000
+++ plugins/unityshell/src/SwitcherController.cpp 2011-09-19 16:41:04 +0000
@@ -188,7 +188,8 @@
188 }188 }
189 else189 else
190 {190 {
191 if (selection->GetQuirk (AbstractLauncherIcon::QUIRK_ACTIVE))191 if (selection->GetQuirk (AbstractLauncherIcon::QUIRK_ACTIVE) &&
192 !model_->DetailXids().empty ())
192 {193 {
193 selection->Activate(ActionArg (ActionArg::SWITCHER, 0, model_->DetailXids()[0]));194 selection->Activate(ActionArg (ActionArg::SWITCHER, 0, model_->DetailXids()[0]));
194 }195 }
@@ -225,13 +226,6 @@
225 return visible_;226 return visible_;
226}227}
227228
228int SwitcherController::WindowsRelatedToSelection()
229{
230 if (model_->Selection())
231 return model_->Selection()->RelatedWindows ();
232 return 0;
233}
234
235void SwitcherController::Next()229void SwitcherController::Next()
236{230{
237 if (!model_)231 if (!model_)
@@ -242,7 +236,7 @@
242 switch (detail_mode_)236 switch (detail_mode_)
243 {237 {
244 case TAB_NEXT_WINDOW:238 case TAB_NEXT_WINDOW:
245 if (model_->detail_selection_index < WindowsRelatedToSelection() - 1)239 if (model_->detail_selection_index < model_->Selection()->RelatedXids ().size () - 1)
246 model_->NextDetail();240 model_->NextDetail();
247 else241 else
248 model_->Next();242 model_->Next();
@@ -271,7 +265,7 @@
271 switch (detail_mode_)265 switch (detail_mode_)
272 {266 {
273 case TAB_NEXT_WINDOW:267 case TAB_NEXT_WINDOW:
274 if (model_->detail_selection_index > 0)268 if (model_->detail_selection_index > (unsigned int) 0)
275 model_->PrevDetail();269 model_->PrevDetail();
276 else270 else
277 model_->Prev();271 model_->Prev();
@@ -295,9 +289,10 @@
295 return view_.GetPointer();289 return view_.GetPointer();
296}290}
297291
298void SwitcherController::SetDetail(bool value, int min_windows)292void SwitcherController::SetDetail(bool value, unsigned
293int min_windows)
299{294{
300 if (value && model_->Selection()->RelatedWindows() >= min_windows)295 if (value && model_->Selection()->RelatedXids().size () >= min_windows)
301 {296 {
302 model_->detail_selection = true;297 model_->detail_selection = true;
303 detail_mode_ = TAB_NEXT_WINDOW_LOOP;298 detail_mode_ = TAB_NEXT_WINDOW_LOOP;
304299
=== modified file 'plugins/unityshell/src/SwitcherController.h'
--- plugins/unityshell/src/SwitcherController.h 2011-08-25 03:53:17 +0000
+++ plugins/unityshell/src/SwitcherController.h 2011-09-19 16:41:04 +0000
@@ -72,7 +72,7 @@
7272
73 void Select (int index);73 void Select (int index);
7474
75 void SetDetail(bool detail, int min_windows = 1);75 void SetDetail(bool detail, unsigned int min_windows = 1);
7676
77 void SelectFirstItem();77 void SelectFirstItem();
7878
@@ -94,8 +94,6 @@
9494
95 void OnModelSelectionChanged(AbstractLauncherIcon *icon);95 void OnModelSelectionChanged(AbstractLauncherIcon *icon);
9696
97 int WindowsRelatedToSelection();
98
99 static void OnBackgroundUpdate (GVariant *data, SwitcherController *self);97 static void OnBackgroundUpdate (GVariant *data, SwitcherController *self);
10098
101 SwitcherModel::Ptr model_;99 SwitcherModel::Ptr model_;
102100
=== modified file 'plugins/unityshell/src/SwitcherModel.cpp'
--- plugins/unityshell/src/SwitcherModel.cpp 2011-09-13 22:06:17 +0000
+++ plugins/unityshell/src/SwitcherModel.cpp 2011-09-19 16:41:04 +0000
@@ -130,7 +130,7 @@
130Window130Window
131SwitcherModel::DetailSelectionWindow ()131SwitcherModel::DetailSelectionWindow ()
132{132{
133 if (!detail_selection)133 if (!detail_selection || DetailXids ().empty())
134 return 0;134 return 0;
135 135
136 return DetailXids()[detail_selection_index];136 return DetailXids()[detail_selection_index];
@@ -171,7 +171,7 @@
171 if (!detail_selection())171 if (!detail_selection())
172 return;172 return;
173173
174 if (detail_selection_index < Selection()->RelatedWindows () - 1)174 if (detail_selection_index < Selection()->RelatedXids ().size () - 1)
175 detail_selection_index = detail_selection_index + 1;175 detail_selection_index = detail_selection_index + 1;
176 else176 else
177 detail_selection_index = 0;177 detail_selection_index = 0;
@@ -182,10 +182,10 @@
182 if (!detail_selection())182 if (!detail_selection())
183 return;183 return;
184184
185 if (detail_selection_index > 0)185 if (detail_selection_index >= (unsigned int) 1)
186 detail_selection_index = detail_selection_index - 1;186 detail_selection_index = detail_selection_index - 1;
187 else187 else
188 detail_selection_index = Selection()->RelatedWindows () - 1;188 detail_selection_index = Selection()->RelatedXids ().size () - 1;
189}189}
190190
191void191void
192192
=== modified file 'plugins/unityshell/src/SwitcherModel.h'
--- plugins/unityshell/src/SwitcherModel.h 2011-08-17 20:43:46 +0000
+++ plugins/unityshell/src/SwitcherModel.h 2011-09-19 16:41:04 +0000
@@ -44,7 +44,7 @@
44 typedef Base::reverse_iterator reverse_iterator;44 typedef Base::reverse_iterator reverse_iterator;
4545
46 nux::Property<bool> detail_selection;46 nux::Property<bool> detail_selection;
47 nux::Property<int> detail_selection_index;47 nux::Property<unsigned int> detail_selection_index;
4848
49 // Icons are owned externally and assumed valid for life of switcher.49 // Icons are owned externally and assumed valid for life of switcher.
50 // When AbstractLauncherIcon is complete, it will be passed as a shared pointer and this50 // When AbstractLauncherIcon is complete, it will be passed as a shared pointer and this
5151
=== modified file 'plugins/unityshell/src/SwitcherView.cpp'
--- plugins/unityshell/src/SwitcherView.cpp 2011-09-14 20:59:39 +0000
+++ plugins/unityshell/src/SwitcherView.cpp 2011-09-19 16:41:04 +0000
@@ -130,7 +130,7 @@
130 clock_gettime(CLOCK_MONOTONIC, &save_time_);130 clock_gettime(CLOCK_MONOTONIC, &save_time_);
131}131}
132132
133void SwitcherView::OnDetailSelectionIndexChanged (int index)133void SwitcherView::OnDetailSelectionIndexChanged (unsigned int index)
134{134{
135 if (model_->detail_selection)135 if (model_->detail_selection)
136 {136 {
137137
=== modified file 'plugins/unityshell/src/SwitcherView.h'
--- plugins/unityshell/src/SwitcherView.h 2011-09-14 20:59:39 +0000
+++ plugins/unityshell/src/SwitcherView.h 2011-09-19 16:41:04 +0000
@@ -82,7 +82,7 @@
82private:82private:
83 void OnSelectionChanged(AbstractLauncherIcon* selection);83 void OnSelectionChanged(AbstractLauncherIcon* selection);
84 void OnDetailSelectionChanged (bool detail);84 void OnDetailSelectionChanged (bool detail);
85 void OnDetailSelectionIndexChanged (int index);85 void OnDetailSelectionIndexChanged (unsigned int index);
8686
87 void OnIconSizeChanged (int size);87 void OnIconSizeChanged (int size);
88 void OnTileSizeChanged (int size);88 void OnTileSizeChanged (int size);
8989
=== modified file 'plugins/unityshell/src/WindowManager.cpp'
--- plugins/unityshell/src/WindowManager.cpp 2011-09-12 01:07:57 +0000
+++ plugins/unityshell/src/WindowManager.cpp 2011-09-19 16:41:04 +0000
@@ -62,6 +62,11 @@
62 return false;62 return false;
63 }63 }
6464
65 bool IsWindowMapped(guint32 xid)
66 {
67 return true;
68 }
69
65 void Restore(guint32 xid)70 void Restore(guint32 xid)
66 {71 {
67 g_debug("%s", G_STRFUNC);72 g_debug("%s", G_STRFUNC);
6873
=== modified file 'plugins/unityshell/src/WindowManager.h'
--- plugins/unityshell/src/WindowManager.h 2011-09-08 03:04:04 +0000
+++ plugins/unityshell/src/WindowManager.h 2011-09-19 16:41:04 +0000
@@ -52,6 +52,7 @@
52 virtual bool IsWindowDecorated(guint32 xid) = 0;52 virtual bool IsWindowDecorated(guint32 xid) = 0;
53 virtual bool IsWindowOnCurrentDesktop(guint32 xid) = 0;53 virtual bool IsWindowOnCurrentDesktop(guint32 xid) = 0;
54 virtual bool IsWindowObscured(guint32 xid) = 0;54 virtual bool IsWindowObscured(guint32 xid) = 0;
55 virtual bool IsWindowMapped(guint32 xid) = 0;
5556
56 virtual void ShowDesktop() = 0;57 virtual void ShowDesktop() = 0;
5758
5859
=== modified file 'plugins/unityshell/src/compizminimizedwindowhandler.h'
--- plugins/unityshell/src/compizminimizedwindowhandler.h 2011-09-09 13:21:10 +0000
+++ plugins/unityshell/src/compizminimizedwindowhandler.h 2011-09-19 16:41:04 +0000
@@ -287,12 +287,13 @@
287 for (CompWindow *w : screen->windows ())287 for (CompWindow *w : screen->windows ())
288 {288 {
289 bool m = w->minimized ();289 bool m = w->minimized ();
290 bool enable = keepMinimized && w->mapNum () > 0;
290291
291 if (m)292 if (m)
292 w->unminimize ();293 w->unminimize ();
293 w->minimizeSetEnabled (Window::get (w), keepMinimized);294 w->minimizeSetEnabled (Window::get (w), enable);
294 w->unminimizeSetEnabled (Window::get (w), keepMinimized);295 w->unminimizeSetEnabled (Window::get (w), enable);
295 w->minimizedSetEnabled (Window::get (w), keepMinimized);296 w->minimizedSetEnabled (Window::get (w), enable);
296 if (m)297 if (m)
297 Window::get (w)->window->minimize ();298 Window::get (w)->window->minimize ();
298 }299 }
299300
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2011-09-16 14:10:10 +0000
+++ plugins/unityshell/src/unityshell.cpp 2011-09-19 16:41:04 +0000
@@ -1592,6 +1592,36 @@
1592void UnityWindow::windowNotify(CompWindowNotify n)1592void UnityWindow::windowNotify(CompWindowNotify n)
1593{1593{
1594 PluginAdapter::Default()->Notify(window, n);1594 PluginAdapter::Default()->Notify(window, n);
1595
1596 switch (n)
1597 {
1598 case CompWindowNotifyMap:
1599 case CompWindowNotifyUnmap:
1600 if (UnityScreen::get (screen)->optionGetShowMinimizedWindows () &&
1601 window->mapNum ())
1602 {
1603 bool wasMinimized = window->minimized ();
1604 if (wasMinimized)
1605 window->unminimize ();
1606 window->minimizeSetEnabled (this, true);
1607 window->unminimizeSetEnabled (this, true);
1608 window->minimizedSetEnabled (this, true);
1609
1610 if (wasMinimized)
1611 window->minimize ();
1612 }
1613 else
1614 {
1615 window->minimizeSetEnabled (this, false);
1616 window->unminimizeSetEnabled (this, false);
1617 window->minimizedSetEnabled (this, false);
1618 }
1619 break;
1620 default:
1621 break;
1622 }
1623
1624
1595 window->windowNotify(n);1625 window->windowNotify(n);
1596 1626
1597 // We do this after the notify to ensure input focus has actually been moved.1627 // We do this after the notify to ensure input focus has actually been moved.
@@ -2141,24 +2171,9 @@
2141 WindowInterface::setHandler(window);2171 WindowInterface::setHandler(window);
2142 GLWindowInterface::setHandler(gWindow);2172 GLWindowInterface::setHandler(gWindow);
21432173
2144 if (UnityScreen::get (screen)->optionGetShowMinimizedWindows ())2174 window->minimizedSetEnabled (this, false);
2145 {2175 window->minimizeSetEnabled (this, false);
2146 bool wasMinimized = window->minimized ();2176 window->unminimizeSetEnabled (this, false);
2147 if (wasMinimized)
2148 window->unminimize ();
2149 window->minimizeSetEnabled (this, true);
2150 window->unminimizeSetEnabled (this, true);
2151 window->minimizedSetEnabled (this, true);
2152
2153 if (wasMinimized)
2154 window->minimize ();
2155 }
2156 else
2157 {
2158 window->minimizeSetEnabled (this, false);
2159 window->unminimizeSetEnabled (this, false);
2160 window->minimizedSetEnabled (this, false);
2161 }
21622177
2163 if (window->state () & CompWindowStateFullscreenMask)2178 if (window->state () & CompWindowStateFullscreenMask)
2164 UnityScreen::get (screen)->fullscreen_windows_.push_back(window);2179 UnityScreen::get (screen)->fullscreen_windows_.push_back(window);