Merge lp:~3v1n0/unity/fix-690143 into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Merged at revision: 1462
Proposed branch: lp:~3v1n0/unity/fix-690143
Merge into: lp:unity
Diff against target: 554 lines (+169/-33)
13 files modified
plugins/unityshell/src/AbstractIconRenderer.h (+2/-0)
plugins/unityshell/src/BamfLauncherIcon.cpp (+40/-1)
plugins/unityshell/src/BamfLauncherIcon.h (+1/-0)
plugins/unityshell/src/IconRenderer.cpp (+5/-6)
plugins/unityshell/src/Launcher.cpp (+52/-3)
plugins/unityshell/src/Launcher.h (+7/-0)
plugins/unityshell/src/PluginAdapter.cpp (+24/-0)
plugins/unityshell/src/PluginAdapter.h (+3/-0)
plugins/unityshell/src/WindowManager.cpp (+5/-0)
plugins/unityshell/src/WindowManager.h (+6/-0)
plugins/unityshell/src/compizminimizedwindowhandler.h (+14/-6)
plugins/unityshell/src/unityshell.cpp (+1/-16)
plugins/unityshell/unityshell.xml.in (+9/-1)
To merge this branch: bzr merge lp:~3v1n0/unity/fix-690143
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Review via email: mp+73430@code.launchpad.net

This proposal supersedes a proposal from 2011-07-29.

Description of the change

Proposal of merge resubmitted after the update of the branch against the newest unity trunk.
I never experienced the crash that Jason found on my test with this version (as I never found one with the previous one), and it also fixes a new bug introduced by the CompizMinimizedWindowHandler that caused unity not to be notified for some events like the viewport switch (and this was causing some visual issues, like the launcher hiding during the vp switch).

Old merge request message (still valid)
=======================================

Fixed bug #690143 as requested by the design team specifications.

To get this I had to get signals from Compiz related to the viewport switch, so to achive this and to keep the implementation clean, I decided to implement the new PluginAdapter signals compiz_screen_viewport_switch_{started,ended}. They are emitted using the PluginAdapter::NotifyCompizEvent function that is called directly by unityshell (UnityScreen).

So now both Launcher and BamfLauncherIcon are listening to these signals to perform their operations. In particular BamfLauncherIcon uses it to check if, after a viewport switch (or a scale terminate), all the windows of the given Icon are viewable in the current workspace and to update the icon indicator accordingly.

Plus I decided to give also another Icon backlight coloring option, and after talking with JohnLea on #ayatana I also added two more options to the "Backlight Mode":
 - Edge Illumination Toggles: illuminate only the edge of the icons linked to
                              running applications.
 - Backlight and Edge Illumination Toggles: illuminate the background of the
                                            icons linked to running
                                            applications; if the windows
                                            of this application are all in
                                            a non viewable workspace, then
                                            only the edge of the icon is
                                            illuminated.

You can see a working example of the "Backlight and Edge Illumination Toggles" option on this screenshot [1].

[1] https://bugs.launchpad.net/unity/+bug/690143/+attachment/2240766/+files/Unity-Unactive-Icons.png

To post a comment you must log in.
Revision history for this message
Jason Smith (jassmith) wrote : Posted in a previous version of this proposal

Crashes in current trunk

review: Needs Fixing
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote : Posted in a previous version of this proposal

Mhmhm... Maybe I've worked with a too old version but it was working fine. However I'll retry with the current trunk.

Thank you!

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote : Posted in a previous version of this proposal

It seems to work fine here also after merging with upstream, so I'm waiting for a crash log to fix it.

Revision history for this message
Jason Smith (jassmith) wrote :

Works great now

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/unityshell/src/AbstractIconRenderer.h'
--- plugins/unityshell/src/AbstractIconRenderer.h 2011-08-24 22:30:37 +0000
+++ plugins/unityshell/src/AbstractIconRenderer.h 2011-08-30 19:14:24 +0000
@@ -54,6 +54,7 @@
54 , running_arrow(false)54 , running_arrow(false)
55 , running_colored(false)55 , running_colored(false)
56 , running_on_viewport(false)56 , running_on_viewport(false)
57 , draw_edge_only(false)
57 , active_arrow(false)58 , active_arrow(false)
58 , active_colored(false)59 , active_colored(false)
59 , skip(false)60 , skip(false)
@@ -82,6 +83,7 @@
82 bool running_arrow;83 bool running_arrow;
83 bool running_colored;84 bool running_colored;
84 bool running_on_viewport;85 bool running_on_viewport;
86 bool draw_edge_only;
85 bool active_arrow;87 bool active_arrow;
86 bool active_colored;88 bool active_colored;
87 bool skip;89 bool skip;
8890
=== modified file 'plugins/unityshell/src/BamfLauncherIcon.cpp'
--- plugins/unityshell/src/BamfLauncherIcon.cpp 2011-08-29 23:36:21 +0000
+++ plugins/unityshell/src/BamfLauncherIcon.cpp 2011-08-30 19:14:24 +0000
@@ -186,6 +186,8 @@
186 this);186 this);
187187
188 WindowManager::Default()->window_minimized.connect(sigc::mem_fun(this, &BamfLauncherIcon::OnWindowMinimized));188 WindowManager::Default()->window_minimized.connect(sigc::mem_fun(this, &BamfLauncherIcon::OnWindowMinimized));
189 WindowManager::Default()->compiz_screen_viewport_switch_ended.connect(sigc::mem_fun(this, &BamfLauncherIcon::OnViewPortSwitchEnded));
190 WindowManager::Default()->terminate_expo.connect(sigc::mem_fun(this, &BamfLauncherIcon::OnViewPortSwitchEnded));
189 IconManager->hidden_changed.connect(sigc::mem_fun(this, &BamfLauncherIcon::OnLauncherHiddenChanged));191 IconManager->hidden_changed.connect(sigc::mem_fun(this, &BamfLauncherIcon::OnLauncherHiddenChanged));
190192
191 // hack193 // hack
@@ -290,6 +292,31 @@
290 UpdateQuirkTimeDelayed(300, QUIRK_SHIMMER);292 UpdateQuirkTimeDelayed(300, QUIRK_SHIMMER);
291}293}
292294
295void BamfLauncherIcon::OnViewPortSwitchEnded()
296{
297 bool any_on_current = false;
298 GList *children = bamf_view_get_children(BAMF_VIEW(m_App));
299
300 for (GList *l = children; l; l = l->next)
301 {
302 BamfView *view = BAMF_VIEW(l->data);
303
304 if (BAMF_IS_WINDOW(view))
305 {
306 Window xid = bamf_window_get_xid(BAMF_WINDOW(view));
307 if (WindowManager::Default()->IsWindowOnCurrentDesktop(xid))
308 {
309 any_on_current = true;
310 break;
311 }
312 }
313 }
314
315 SetHasWindowOnViewport(any_on_current);
316
317 g_list_free(children);
318}
319
293bool BamfLauncherIcon::IsSticky()320bool BamfLauncherIcon::IsSticky()
294{321{
295 return bamf_view_is_sticky(BAMF_VIEW(m_App));322 return bamf_view_is_sticky(BAMF_VIEW(m_App));
@@ -358,6 +385,8 @@
358 BamfView* view;385 BamfView* view;
359 bool owns = false;386 bool owns = false;
360387
388 if (!w) return owns;
389
361 children = bamf_view_get_children(BAMF_VIEW(m_App));390 children = bamf_view_get_children(BAMF_VIEW(m_App));
362391
363 for (l = children; l; l = l->next)392 for (l = children; l; l = l->next)
@@ -546,16 +575,26 @@
546{575{
547 GList* children, *l;576 GList* children, *l;
548 int count = 0;577 int count = 0;
578 bool has_visible = false;
579
549 children = bamf_view_get_children(BAMF_VIEW(m_App));580 children = bamf_view_get_children(BAMF_VIEW(m_App));
550 for (l = children; l; l = l->next)581 for (l = children; l; l = l->next)
551 {582 {
552 if (!BAMF_IS_WINDOW(l->data))583 if (!BAMF_IS_WINDOW(l->data))
553 continue;584 continue;
585
586 if (!has_visible)
587 {
588 Window xid = bamf_window_get_xid(BAMF_WINDOW(l->data));
589 if (WindowManager::Default()->IsWindowOnCurrentDesktop(xid))
590 has_visible = true;
591 }
592
554 count++;593 count++;
555 }594 }
556595
557 SetRelatedWindows(count);596 SetRelatedWindows(count);
558 SetHasWindowOnViewport(true); // FIXME597 SetHasWindowOnViewport(has_visible);
559598
560 g_list_free(children);599 g_list_free(children);
561}600}
562601
=== modified file 'plugins/unityshell/src/BamfLauncherIcon.h'
--- plugins/unityshell/src/BamfLauncherIcon.h 2011-08-29 23:36:21 +0000
+++ plugins/unityshell/src/BamfLauncherIcon.h 2011-08-30 19:14:24 +0000
@@ -108,6 +108,7 @@
108 void EnsureMenuItemsReady();108 void EnsureMenuItemsReady();
109109
110 void OnWindowMinimized(guint32 xid);110 void OnWindowMinimized(guint32 xid);
111 void OnViewPortSwitchEnded();
111 bool OwnsWindow(Window w);112 bool OwnsWindow(Window w);
112 113
113 const std::set<std::string>& GetSupportedTypes();114 const std::set<std::string>& GetSupportedTypes();
114115
=== modified file 'plugins/unityshell/src/IconRenderer.cpp'
--- plugins/unityshell/src/IconRenderer.cpp 2011-08-25 18:55:57 +0000
+++ plugins/unityshell/src/IconRenderer.cpp 2011-08-30 19:14:24 +0000
@@ -408,7 +408,7 @@
408 auto tile_transform = arg.icon->GetTransform(AbstractLauncherIcon::TRANSFORM_TILE);408 auto tile_transform = arg.icon->GetTransform(AbstractLauncherIcon::TRANSFORM_TILE);
409409
410 // draw tile410 // draw tile
411 if (backlight_intensity > 0)411 if (backlight_intensity > 0 && !arg.draw_edge_only)
412 {412 {
413 RenderElement(GfxContext,413 RenderElement(GfxContext,
414 arg,414 arg,
@@ -778,13 +778,12 @@
778 // markers are well outside screen bounds to start778 // markers are well outside screen bounds to start
779 int markers [3] = {-100, -100, -100};779 int markers [3] = {-100, -100, -100};
780780
781 /*if (!arg.running_on_viewport)781 if (!arg.running_on_viewport)
782 {782 {
783 markers.push_back (markerCenter);783 markers[0] = markerCenter;
784 texture = _arrow_empty_ltr;784 texture = local::arrow_empty_ltr;
785 }785 }
786 else*/786 else if (running == 1)
787 if (running == 1)
788 {787 {
789 markers[0] = markerCenter;788 markers[0] = markerCenter;
790 texture = local::arrow_ltr;789 texture = local::arrow_ltr;
791790
=== modified file 'plugins/unityshell/src/Launcher.cpp'
--- plugins/unityshell/src/Launcher.cpp 2011-08-29 23:36:21 +0000
+++ plugins/unityshell/src/Launcher.cpp 2011-08-30 19:14:24 +0000
@@ -189,6 +189,8 @@
189 plugin_adapter.initiate_expo.connect(sigc::mem_fun(this, &Launcher::OnPluginStateChanged));189 plugin_adapter.initiate_expo.connect(sigc::mem_fun(this, &Launcher::OnPluginStateChanged));
190 plugin_adapter.terminate_spread.connect(sigc::mem_fun(this, &Launcher::OnPluginStateChanged));190 plugin_adapter.terminate_spread.connect(sigc::mem_fun(this, &Launcher::OnPluginStateChanged));
191 plugin_adapter.terminate_expo.connect(sigc::mem_fun(this, &Launcher::OnPluginStateChanged));191 plugin_adapter.terminate_expo.connect(sigc::mem_fun(this, &Launcher::OnPluginStateChanged));
192 plugin_adapter.compiz_screen_viewport_switch_started.connect(sigc::mem_fun(this, &Launcher::OnViewPortSwitchStarted));
193 plugin_adapter.compiz_screen_viewport_switch_ended.connect(sigc::mem_fun(this, &Launcher::OnViewPortSwitchEnded));
192194
193 GeisAdapter& adapter = *(GeisAdapter::Default());195 GeisAdapter& adapter = *(GeisAdapter::Default());
194 adapter.drag_start.connect(sigc::mem_fun(this, &Launcher::OnDragStart));196 adapter.drag_start.connect(sigc::mem_fun(this, &Launcher::OnDragStart));
@@ -895,7 +897,8 @@
895 struct timespec starting_time = icon->GetQuirkTime(LauncherIcon::QUIRK_STARTING);897 struct timespec starting_time = icon->GetQuirkTime(LauncherIcon::QUIRK_STARTING);
896 int starting_ms = TimeDelta(&current, &starting_time);898 int starting_ms = TimeDelta(&current, &starting_time);
897 double starting_progress = (double) CLAMP((float) starting_ms / (float)(ANIM_DURATION_LONG * STARTING_BLINK_LAMBDA), 0.0f, 1.0f);899 double starting_progress = (double) CLAMP((float) starting_ms / (float)(ANIM_DURATION_LONG * STARTING_BLINK_LAMBDA), 0.0f, 1.0f);
898 return 0.5f + (float)(std::cos(M_PI * (_backlight_mode != BACKLIGHT_NORMAL ? 4.0f : 3.0f) * starting_progress)) * 0.5f;900 double val = IsBackLightModeToggles() ? 3.0f : 4.0f;
901 return 0.5f + (float)(std::cos(M_PI * val * starting_progress)) * 0.5f;
899}902}
900903
901float Launcher::IconStartingPulseValue(LauncherIcon* icon, struct timespec const& current)904float Launcher::IconStartingPulseValue(LauncherIcon* icon, struct timespec const& current)
@@ -931,7 +934,7 @@
931 float backlight_strength;934 float backlight_strength;
932 if (_backlight_mode == BACKLIGHT_ALWAYS_ON)935 if (_backlight_mode == BACKLIGHT_ALWAYS_ON)
933 backlight_strength = BACKLIGHT_STRENGTH;936 backlight_strength = BACKLIGHT_STRENGTH;
934 else if (_backlight_mode == BACKLIGHT_NORMAL)937 else if (IsBackLightModeToggles())
935 backlight_strength = BACKLIGHT_STRENGTH * running_progress;938 backlight_strength = BACKLIGHT_STRENGTH * running_progress;
936 else939 else
937 backlight_strength = 0.0f;940 backlight_strength = 0.0f;
@@ -956,7 +959,7 @@
956 result = backlight_strength;959 result = backlight_strength;
957 if (_backlight_mode == BACKLIGHT_ALWAYS_ON)960 if (_backlight_mode == BACKLIGHT_ALWAYS_ON)
958 result *= CLAMP(running_progress + IconStartingPulseValue(icon, current), 0.0f, 1.0f);961 result *= CLAMP(running_progress + IconStartingPulseValue(icon, current), 0.0f, 1.0f);
959 else if (_backlight_mode == BACKLIGHT_NORMAL)962 else if (IsBackLightModeToggles())
960 result += (BACKLIGHT_STRENGTH - result) * (1.0f - IconStartingPulseValue(icon, current));963 result += (BACKLIGHT_STRENGTH - result) * (1.0f - IconStartingPulseValue(icon, current));
961 else964 else
962 result = 1.0f - CLAMP(running_progress + IconStartingPulseValue(icon, current), 0.0f, 1.0f);965 result = 1.0f - CLAMP(running_progress + IconStartingPulseValue(icon, current), 0.0f, 1.0f);
@@ -992,6 +995,17 @@
992 return result;995 return result;
993}996}
994997
998bool Launcher::IconDrawEdgeOnly(LauncherIcon* icon)
999{
1000 if (_backlight_mode == BACKLIGHT_EDGE_TOGGLE)
1001 return true;
1002
1003 if (_backlight_mode == BACKLIGHT_NORMAL_EDGE_TOGGLE && !icon->HasWindowOnViewport())
1004 return true;
1005
1006 return false;
1007}
1008
995void Launcher::SetupRenderArg(LauncherIcon* icon, struct timespec const& current, RenderArg& arg)1009void Launcher::SetupRenderArg(LauncherIcon* icon, struct timespec const& current, RenderArg& arg)
996{1010{
997 arg.icon = icon;1011 arg.icon = icon;
@@ -1000,6 +1014,7 @@
1000 arg.running_arrow = icon->GetQuirk(LauncherIcon::QUIRK_RUNNING);1014 arg.running_arrow = icon->GetQuirk(LauncherIcon::QUIRK_RUNNING);
1001 arg.running_colored = icon->GetQuirk(LauncherIcon::QUIRK_URGENT);1015 arg.running_colored = icon->GetQuirk(LauncherIcon::QUIRK_URGENT);
1002 arg.running_on_viewport = icon->HasWindowOnViewport();1016 arg.running_on_viewport = icon->HasWindowOnViewport();
1017 arg.draw_edge_only = IconDrawEdgeOnly(icon);
1003 arg.active_colored = false;1018 arg.active_colored = false;
1004 arg.x_rotation = 0.0f;1019 arg.x_rotation = 0.0f;
1005 arg.y_rotation = 0.0f;1020 arg.y_rotation = 0.0f;
@@ -1653,6 +1668,28 @@
1653 return;1668 return;
1654}1669}
16551670
1671void
1672Launcher::OnViewPortSwitchStarted()
1673{
1674 /*
1675 * don't take into account window over launcher state during
1676 * the viewport switch as we can get false positives
1677 * (like switching to an empty viewport while grabbing a fullscreen window)
1678 */
1679 _check_window_over_launcher = false;
1680}
1681
1682void
1683Launcher::OnViewPortSwitchEnded()
1684{
1685 /*
1686 * compute again the list of all window on the new viewport
1687 * to decide if we should or not hide the launcher
1688 */
1689 _check_window_over_launcher = true;
1690 CheckWindowOverLauncher();
1691}
1692
1656Launcher::LauncherHideMode Launcher::GetHideMode()1693Launcher::LauncherHideMode Launcher::GetHideMode()
1657{1694{
1658 return _hidemode;1695 return _hidemode;
@@ -1729,6 +1766,18 @@
1729 return _backlight_mode;1766 return _backlight_mode;
1730}1767}
17311768
1769bool Launcher::IsBackLightModeToggles()
1770{
1771 switch (_backlight_mode) {
1772 case BACKLIGHT_NORMAL:
1773 case BACKLIGHT_EDGE_TOGGLE:
1774 case BACKLIGHT_NORMAL_EDGE_TOGGLE:
1775 return true;
1776 default:
1777 return false;
1778 }
1779}
1780
1732void1781void
1733Launcher::SetLaunchAnimation(LaunchAnimation animation)1782Launcher::SetLaunchAnimation(LaunchAnimation animation)
1734{1783{
17351784
=== modified file 'plugins/unityshell/src/Launcher.h'
--- plugins/unityshell/src/Launcher.h 2011-08-29 23:36:21 +0000
+++ plugins/unityshell/src/Launcher.h 2011-08-30 19:14:24 +0000
@@ -99,6 +99,8 @@
99 BACKLIGHT_ALWAYS_ON,99 BACKLIGHT_ALWAYS_ON,
100 BACKLIGHT_NORMAL,100 BACKLIGHT_NORMAL,
101 BACKLIGHT_ALWAYS_OFF,101 BACKLIGHT_ALWAYS_OFF,
102 BACKLIGHT_EDGE_TOGGLE,
103 BACKLIGHT_NORMAL_EDGE_TOGGLE
102 } BacklightMode;104 } BacklightMode;
103105
104 Launcher(nux::BaseWindow* parent, NUX_FILE_LINE_PROTO);106 Launcher(nux::BaseWindow* parent, NUX_FILE_LINE_PROTO);
@@ -140,6 +142,7 @@
140142
141 void SetBacklightMode(BacklightMode mode);143 void SetBacklightMode(BacklightMode mode);
142 BacklightMode GetBacklightMode();144 BacklightMode GetBacklightMode();
145 bool IsBackLightModeToggles();
143146
144 void SetLaunchAnimation(LaunchAnimation animation);147 void SetLaunchAnimation(LaunchAnimation animation);
145 LaunchAnimation GetLaunchAnimation();148 LaunchAnimation GetLaunchAnimation();
@@ -247,6 +250,9 @@
247250
248 void OnPluginStateChanged();251 void OnPluginStateChanged();
249252
253 void OnViewPortSwitchStarted();
254 void OnViewPortSwitchEnded();
255
250 static gboolean AnimationTimeout(gpointer data);256 static gboolean AnimationTimeout(gpointer data);
251 static gboolean SuperShowLauncherTimeout(gpointer data);257 static gboolean SuperShowLauncherTimeout(gpointer data);
252 static gboolean SuperHideLauncherTimeout(gpointer data);258 static gboolean SuperHideLauncherTimeout(gpointer data);
@@ -266,6 +272,7 @@
266 void OnDragWindowAnimCompleted();272 void OnDragWindowAnimCompleted();
267273
268 bool IconNeedsAnimation(LauncherIcon* icon, struct timespec const& current);274 bool IconNeedsAnimation(LauncherIcon* icon, struct timespec const& current);
275 bool IconDrawEdgeOnly(LauncherIcon* icon);
269 bool AnimationInProgress();276 bool AnimationInProgress();
270277
271 void SetActionState(LauncherActionState actionstate);278 void SetActionState(LauncherActionState actionstate);
272279
=== modified file 'plugins/unityshell/src/PluginAdapter.cpp'
--- plugins/unityshell/src/PluginAdapter.cpp 2011-08-29 23:36:21 +0000
+++ plugins/unityshell/src/PluginAdapter.cpp 2011-08-30 19:14:24 +0000
@@ -63,6 +63,7 @@
63{63{
64 _spread_state = false;64 _spread_state = false;
65 _expo_state = false;65 _expo_state = false;
66 _vp_switch_started = false;
6667
67 _grab_show_action = 0;68 _grab_show_action = 0;
68 _grab_hide_action = 0;69 _grab_hide_action = 0;
@@ -190,6 +191,23 @@
190}191}
191192
192void193void
194PluginAdapter::NotifyCompizEvent(const char* plugin, const char* event, CompOption::Vector& option)
195{
196 if (g_strcmp0(event, "start_viewport_switch") == 0)
197 {
198 _vp_switch_started = true;
199 compiz_screen_viewport_switch_started.emit();
200 }
201 else if (g_strcmp0(event, "end_viewport_switch") == 0)
202 {
203 _vp_switch_started = false;
204 compiz_screen_viewport_switch_ended.emit();
205 }
206
207 compiz_event.emit(plugin, event, option);
208}
209
210void
193MultiActionList::AddNewAction(CompAction* a, bool primary)211MultiActionList::AddNewAction(CompAction* a, bool primary)
194{212{
195 if (std::find(m_ActionList.begin(), m_ActionList.end(), a) == m_ActionList.end())213 if (std::find(m_ActionList.begin(), m_ActionList.end(), a) == m_ActionList.end())
@@ -785,6 +803,12 @@
785 return m_Screen->grabbed();803 return m_Screen->grabbed();
786}804}
787805
806bool
807PluginAdapter::IsViewPortSwitchStarted()
808{
809 return _vp_switch_started;
810}
811
788void PluginAdapter::MaximizeIfBigEnough(CompWindow* window)812void PluginAdapter::MaximizeIfBigEnough(CompWindow* window)
789{813{
790 XClassHint classHint;814 XClassHint classHint;
791815
=== modified file 'plugins/unityshell/src/PluginAdapter.h'
--- plugins/unityshell/src/PluginAdapter.h 2011-08-29 23:36:21 +0000
+++ plugins/unityshell/src/PluginAdapter.h 2011-08-30 19:14:24 +0000
@@ -103,6 +103,7 @@
103 void NotifyMoved(CompWindow* window, int x, int y);103 void NotifyMoved(CompWindow* window, int x, int y);
104 void NotifyResized(CompWindow* window, int x, int y, int w, int h);104 void NotifyResized(CompWindow* window, int x, int y, int w, int h);
105 void NotifyStateChange(CompWindow* window, unsigned int state, unsigned int last_state);105 void NotifyStateChange(CompWindow* window, unsigned int state, unsigned int last_state);
106 void NotifyCompizEvent(const char* plugin, const char* event, CompOption::Vector& option);
106107
107 void Decorate(guint32 xid);108 void Decorate(guint32 xid);
108 void Undecorate(guint32 xid);109 void Undecorate(guint32 xid);
@@ -126,6 +127,7 @@
126 bool ScaleWindowGroup(std::vector<Window> windows, int state, bool force);127 bool ScaleWindowGroup(std::vector<Window> windows, int state, bool force);
127128
128 bool IsScreenGrabbed();129 bool IsScreenGrabbed();
130 bool IsViewPortSwitchStarted();
129131
130 unsigned int GetWindowActiveNumber (guint32 xid);132 unsigned int GetWindowActiveNumber (guint32 xid);
131133
@@ -160,6 +162,7 @@
160162
161 bool _spread_state;163 bool _spread_state;
162 bool _expo_state;164 bool _expo_state;
165 bool _vp_switch_started;
163166
164 CompAction* _grab_show_action;167 CompAction* _grab_show_action;
165 CompAction* _grab_hide_action;168 CompAction* _grab_hide_action;
166169
=== modified file 'plugins/unityshell/src/WindowManager.cpp'
--- plugins/unityshell/src/WindowManager.cpp 2011-08-29 23:36:21 +0000
+++ plugins/unityshell/src/WindowManager.cpp 2011-08-30 19:14:24 +0000
@@ -32,6 +32,11 @@
32 return false;32 return false;
33 }33 }
3434
35 bool IsViewPortSwitchStarted()
36 {
37 return false;
38 }
39
35 void ShowDesktop()40 void ShowDesktop()
36 {41 {
37 g_debug("%s", G_STRFUNC);42 g_debug("%s", G_STRFUNC);
3843
=== modified file 'plugins/unityshell/src/WindowManager.h'
--- plugins/unityshell/src/WindowManager.h 2011-08-29 23:36:21 +0000
+++ plugins/unityshell/src/WindowManager.h 2011-08-30 19:14:24 +0000
@@ -25,6 +25,7 @@
25#include "Nux/WindowThread.h"25#include "Nux/WindowThread.h"
26#include "NuxGraphics/GLWindowManager.h"26#include "NuxGraphics/GLWindowManager.h"
27#include <gdk/gdkx.h>27#include <gdk/gdkx.h>
28#include <core/core.h>
2829
29class WindowManager30class WindowManager
30{31{
@@ -75,6 +76,7 @@
75 virtual void Undecorate(guint32 xid) {};76 virtual void Undecorate(guint32 xid) {};
7677
77 virtual bool IsScreenGrabbed() = 0;78 virtual bool IsScreenGrabbed() = 0;
79 virtual bool IsViewPortSwitchStarted() = 0;
7880
79 void StartMove(guint32 id, int, int);81 void StartMove(guint32 id, int, int);
8082
@@ -113,6 +115,10 @@
113115
114 sigc::signal<void> compiz_screen_grabbed;116 sigc::signal<void> compiz_screen_grabbed;
115 sigc::signal<void> compiz_screen_ungrabbed;117 sigc::signal<void> compiz_screen_ungrabbed;
118 sigc::signal<void> compiz_screen_viewport_switch_started;
119 sigc::signal<void> compiz_screen_viewport_switch_ended;
120
121 sigc::signal<void, const char*, const char*, CompOption::Vector&> compiz_event;
116122
117private:123private:
118 Atom m_MoveResizeAtom;124 Atom m_MoveResizeAtom;
119125
=== modified file 'plugins/unityshell/src/compizminimizedwindowhandler.h'
--- plugins/unityshell/src/compizminimizedwindowhandler.h 2011-08-24 17:01:08 +0000
+++ plugins/unityshell/src/compizminimizedwindowhandler.h 2011-08-30 19:14:24 +0000
@@ -1,3 +1,4 @@
1// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
1/*2/*
2 * Copyright (C) 2011 Canonical Ltd.3 * Copyright (C) 2011 Canonical Ltd.
3 *4 *
@@ -53,9 +54,7 @@
53 void unminimize ();54 void unminimize ();
5455
55 static void setFunctions (bool keepMinimized);56 static void setFunctions (bool keepMinimized);
56 static void handleCompizEvent (const char *,57 static void handleCompizEvent (const char *, const char *, CompOption::Vector &);
57 const char *,
58 CompOption::Vector &);
59 static std::list<CompWindow *> minimizingWindows;58 static std::list<CompWindow *> minimizingWindows;
6059
61 typedef CompizMinimizedWindowHandler<Screen, Window> CompizMinimizedWindowHandler_complete;60 typedef CompizMinimizedWindowHandler<Screen, Window> CompizMinimizedWindowHandler_complete;
@@ -67,6 +66,7 @@
67private:66private:
6867
69 PrivateCompizMinimizedWindowHandler *priv;68 PrivateCompizMinimizedWindowHandler *priv;
69 static bool handleEvents;
70};70};
71}71}
7272
@@ -74,6 +74,9 @@
74CompWindowList compiz::CompizMinimizedWindowHandler<Screen, Window>::minimizingWindows;74CompWindowList compiz::CompizMinimizedWindowHandler<Screen, Window>::minimizingWindows;
7575
76template <typename Screen, typename Window>76template <typename Screen, typename Window>
77bool compiz::CompizMinimizedWindowHandler<Screen, Window>::handleEvents = true;
78
79template <typename Screen, typename Window>
77compiz::CompizMinimizedWindowHandler<Screen, Window>::CompizMinimizedWindowHandler(CompWindow *w) :80compiz::CompizMinimizedWindowHandler<Screen, Window>::CompizMinimizedWindowHandler(CompWindow *w) :
78 MinimizedWindowHandler (screen->dpy (), w->id ())81 MinimizedWindowHandler (screen->dpy (), w->id ())
79{82{
@@ -121,7 +124,7 @@
121124
122 std::vector<unsigned int> transients = getTransients ();125 std::vector<unsigned int> transients = getTransients ();
123126
124 screen->handleCompizEventSetEnabled (Screen::get (screen), true);127 handleEvents = true;
125 priv->mWindow->windowNotify (CompWindowNotifyMinimize);128 priv->mWindow->windowNotify (CompWindowNotifyMinimize);
126 priv->mWindow->changeState (priv->mWindow->state () | CompWindowStateHiddenMask);129 priv->mWindow->changeState (priv->mWindow->state () | CompWindowStateHiddenMask);
127130
@@ -205,6 +208,9 @@
205 const char *eventName,208 const char *eventName,
206 CompOption::Vector &o)209 CompOption::Vector &o)
207{210{
211 if (!handleEvents)
212 return;
213
208 if (strncmp (pluginName, "animation", 9) == 0 &&214 if (strncmp (pluginName, "animation", 9) == 0 &&
209 strncmp (eventName, "window_animation", 16) == 0)215 strncmp (eventName, "window_animation", 16) == 0)
210 {216 {
@@ -218,13 +224,15 @@
218 minimizingWindows.push_back (w);224 minimizingWindows.push_back (w);
219 else225 else
220 minimizingWindows.remove (w);226 minimizingWindows.remove (w);
221 }227 }
222 }228 }
223 }229 }
224230
225 if (!CompOption::getBoolOptionNamed (o, "active", false) &&231 if (!CompOption::getBoolOptionNamed (o, "active", false) &&
226 minimizingWindows.empty ())232 minimizingWindows.empty ())
227 screen->handleCompizEventSetEnabled (Screen::get (screen), false);233 {
234 handleEvents = false;
235 }
228}236}
229237
230template <typename Screen, typename Window>238template <typename Screen, typename Window>
231239
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2011-08-29 23:36:21 +0000
+++ plugins/unityshell/src/unityshell.cpp 2011-08-30 19:14:24 +0000
@@ -848,23 +848,8 @@
848 const char* event,848 const char* event,
849 CompOption::Vector& option)849 CompOption::Vector& option)
850{850{
851 /*851 PluginAdapter::Default()->NotifyCompizEvent(plugin, event, option);
852 * don't take into account window over launcher state during
853 * the ws switch as we can get false positives
854 * (like switching to an empty viewport while grabbing a fullscreen window)
855 */
856 if (strcmp(event, "start_viewport_switch") == 0)
857 launcher->EnableCheckWindowOverLauncher(false);
858 else if (strcmp(event, "end_viewport_switch") == 0)
859 {
860 // compute again the list of all window on the new viewport
861 // to decide if we should or not hide the launcher
862 launcher->EnableCheckWindowOverLauncher(true);
863 launcher->CheckWindowOverLauncher();
864 }
865
866 compiz::CompizMinimizedWindowHandler<UnityScreen, UnityWindow>::handleCompizEvent (plugin, event, option);852 compiz::CompizMinimizedWindowHandler<UnityScreen, UnityWindow>::handleCompizEvent (plugin, event, option);
867
868 screen->handleCompizEvent(plugin, event, option);853 screen->handleCompizEvent(plugin, event, option);
869}854}
870855
871856
=== modified file 'plugins/unityshell/unityshell.xml.in'
--- plugins/unityshell/unityshell.xml.in 2011-08-26 22:31:20 +0000
+++ plugins/unityshell/unityshell.xml.in 2011-08-30 19:14:24 +0000
@@ -160,7 +160,7 @@
160 <_short>Backlight Mode</_short>160 <_short>Backlight Mode</_short>
161 <_long>Change how the icons are backlit</_long>161 <_long>Change how the icons are backlit</_long>
162 <min>0</min>162 <min>0</min>
163 <max>2</max>163 <max>4</max>
164 <default>0</default>164 <default>0</default>
165 <desc>165 <desc>
166 <value>0</value>166 <value>0</value>
@@ -174,6 +174,14 @@
174 <value>2</value>174 <value>2</value>
175 <_name>Backlight Always Off</_name>175 <_name>Backlight Always Off</_name>
176 </desc>176 </desc>
177 <desc>
178 <value>3</value>
179 <_name>Edge Illumination Toggles</_name>
180 </desc>
181 <desc>
182 <value>4</value>
183 <_name>Backlight and Edge Illumination Toggles</_name>
184 </desc>
177 </option>185 </option>
178 <option name="launch_animation" type="int">186 <option name="launch_animation" type="int">
179 <_short>Launch Animation</_short>187 <_short>Launch Animation</_short>