Merge lp:~smspillaz/unity/unity.fix_859885 into lp:unity

Proposed by Sam Spilsbury
Status: Merged
Approved by: Jason Smith
Approved revision: no longer in the source branch.
Merged at revision: 1651
Proposed branch: lp:~smspillaz/unity/unity.fix_859885
Merge into: lp:unity
Diff against target: 201 lines (+86/-6)
5 files modified
plugins/unityshell/src/BamfLauncherIcon.h (+2/-0)
plugins/unityshell/src/LauncherIcon.cpp (+3/-1)
plugins/unityshell/src/LauncherIcon.h (+2/-0)
plugins/unityshell/src/compizminimizedwindowhandler.h (+47/-0)
plugins/unityshell/src/unityshell.cpp (+32/-5)
To merge this branch: bzr merge lp:~smspillaz/unity/unity.fix_859885
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+77317@code.launchpad.net

Description of the change

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/BamfLauncherIcon.h'
2--- plugins/unityshell/src/BamfLauncherIcon.h 2011-09-27 03:41:15 +0000
3+++ plugins/unityshell/src/BamfLauncherIcon.h 2011-09-28 12:28:08 +0000
4@@ -76,6 +76,8 @@
5
6 const char* BamfName();
7
8+ bool HandlesSpread () { return true; }
9+
10 private:
11 BamfApplication* m_App;
12 Launcher* _launcher;
13
14=== modified file 'plugins/unityshell/src/LauncherIcon.cpp'
15--- plugins/unityshell/src/LauncherIcon.cpp 2011-09-15 17:20:21 +0000
16+++ plugins/unityshell/src/LauncherIcon.cpp 2011-09-28 12:28:08 +0000
17@@ -197,7 +197,9 @@
18 void
19 LauncherIcon::Activate(ActionArg arg)
20 {
21- if (WindowManager::Default()->IsScaleActive())
22+ /* Launcher Icons that handle spread will adjust the spread state
23+ * accordingly, for all other icons we should terminate spread */
24+ if (WindowManager::Default()->IsScaleActive() && !HandlesSpread ())
25 WindowManager::Default()->TerminateScale();
26
27 ActivateLauncherIcon(arg);
28
29=== modified file 'plugins/unityshell/src/LauncherIcon.h'
30--- plugins/unityshell/src/LauncherIcon.h 2011-09-27 03:41:15 +0000
31+++ plugins/unityshell/src/LauncherIcon.h 2011-09-28 12:28:08 +0000
32@@ -242,6 +242,8 @@
33
34 virtual void OpenInstanceLauncherIcon(ActionArg arg) {}
35
36+ virtual bool HandlesSpread () { return false; }
37+
38 nux::BaseTexture* TextureFromGtkTheme(const char* name, int size, bool update_glow_colors = true);
39
40 nux::BaseTexture* TextureFromSpecificGtkTheme(GtkIconTheme* theme, const char* name, int size, bool update_glow_colors = true, bool is_default_theme = false);
41
42=== modified file 'plugins/unityshell/src/compizminimizedwindowhandler.h'
43--- plugins/unityshell/src/compizminimizedwindowhandler.h 2011-09-20 20:53:38 +0000
44+++ plugins/unityshell/src/compizminimizedwindowhandler.h 2011-09-28 12:28:08 +0000
45@@ -55,6 +55,8 @@
46
47 void updateFrameRegion (CompRegion &r);
48
49+ void windowNotify (CompWindowNotify n);
50+
51 static void setFunctions (bool keepMinimized);
52 static void handleCompizEvent (const char *, const char *, CompOption::Vector &);
53 static void handleEvent (XEvent *event);
54@@ -62,6 +64,7 @@
55
56 typedef CompizMinimizedWindowHandler<Screen, Window> CompizMinimizedWindowHandler_complete;
57 typedef boost::shared_ptr<CompizMinimizedWindowHandler_complete> Ptr;
58+ typedef std::list <Ptr> List;
59 protected:
60
61 virtual std::vector<unsigned int> getTransients ();
62@@ -70,10 +73,14 @@
63
64 PrivateCompizMinimizedWindowHandler *priv;
65 static bool handleEvents;
66+ static std::list<Ptr> minimizedWindows;
67 };
68 }
69
70 template <typename Screen, typename Window>
71+typename compiz::CompizMinimizedWindowHandler<Screen, Window>::List compiz::CompizMinimizedWindowHandler<Screen, Window>::minimizedWindows;
72+
73+template <typename Screen, typename Window>
74 CompWindowList compiz::CompizMinimizedWindowHandler<Screen, Window>::minimizingWindows;
75
76 template <typename Screen, typename Window>
77@@ -126,12 +133,19 @@
78 Atom wmState = XInternAtom (screen->dpy (), "WM_STATE", 0);
79 unsigned long data[2];
80
81+ typedef compiz::CompizMinimizedWindowHandler<Screen, Window> minimized_window_handler_full;
82+
83 std::vector<unsigned int> transients = getTransients ();
84
85 handleEvents = true;
86 priv->mWindow->windowNotify (CompWindowNotifyMinimize);
87 priv->mWindow->changeState (priv->mWindow->state () | CompWindowStateHiddenMask);
88
89+ compiz::CompizMinimizedWindowHandler<Screen, Window>::Ptr compizMinimizeHandler =
90+ boost::dynamic_pointer_cast <minimized_window_handler_full> (Window::get (priv->mWindow)->mMinimizeHandler);
91+
92+ minimizedWindows.push_back (compizMinimizeHandler);
93+
94 for (unsigned int &w : transients)
95 {
96 CompWindow *win = screen->findWindow (w);
97@@ -150,7 +164,31 @@
98 32, PropModeReplace, (unsigned char *) data, 2);
99
100 priv->mWindow->changeState (priv->mWindow->state () | CompWindowStateHiddenMask);
101+
102+ /* Don't allow other windows to be focused by moveInputFocusToOtherWindow */
103+ for (auto mh : minimizedWindows)
104+ mh->priv->mWindow->focusSetEnabled (Window::get (mh->priv->mWindow), false);
105+
106 priv->mWindow->moveInputFocusToOtherWindow ();
107+
108+ for (auto mh : minimizedWindows)
109+ mh->priv->mWindow->focusSetEnabled (Window::get (mh->priv->mWindow), true);
110+}
111+
112+template <typename Screen, typename Window>
113+void
114+compiz::CompizMinimizedWindowHandler<Screen, Window>::windowNotify (CompWindowNotify n)
115+{
116+ if (n == CompWindowNotifyFocusChange && priv->mWindow->minimized ())
117+ {
118+ for (auto mh : minimizedWindows)
119+ mh->priv->mWindow->focusSetEnabled (Window::get (mh->priv->mWindow), false);
120+
121+ priv->mWindow->moveInputFocusToOtherWindow ();
122+
123+ for (auto mh : minimizedWindows)
124+ mh->priv->mWindow->focusSetEnabled (Window::get (mh->priv->mWindow), true);
125+ }
126 }
127
128 template <typename Screen, typename Window>
129@@ -174,8 +212,17 @@
130 Atom wmState = XInternAtom (screen->dpy (), "WM_STATE", 0);
131 unsigned long data[2];
132
133+ typedef compiz::CompizMinimizedWindowHandler<Screen, Window> minimized_window_handler_full;
134+
135 std::vector<unsigned int> transients = getTransients ();
136
137+ compiz::CompizMinimizedWindowHandler<Screen, Window>::Ptr compizMinimizeHandler =
138+ boost::dynamic_pointer_cast <minimized_window_handler_full> (Window::get (priv->mWindow)->mMinimizeHandler);
139+
140+ minimizedWindows.remove (compizMinimizeHandler);
141+
142+ priv->mWindow->focusSetEnabled (Window::get (priv->mWindow), true);
143+
144 priv->mWindow->windowNotify (CompWindowNotifyUnminimize);
145 priv->mWindow->changeState (priv->mWindow->state () & ~CompWindowStateHiddenMask);
146 priv->mWindow->windowNotify (CompWindowNotifyShow);
147
148=== modified file 'plugins/unityshell/src/unityshell.cpp'
149--- plugins/unityshell/src/unityshell.cpp 2011-09-28 01:43:32 +0000
150+++ plugins/unityshell/src/unityshell.cpp 2011-09-28 12:28:08 +0000
151@@ -1680,7 +1680,19 @@
152
153
154 window->windowNotify(n);
155-
156+
157+ if (mMinimizeHandler.get () != NULL)
158+ {
159+ /* The minimize handler will short circuit the frame
160+ * region update func and ensure that the frame
161+ * does not have a region */
162+ typedef compiz::CompizMinimizedWindowHandler<UnityScreen, UnityWindow> minimized_window_handler_unity;
163+
164+ compiz::CompizMinimizedWindowHandler<UnityScreen, UnityWindow>::Ptr compizMinimizeHandler =
165+ boost::dynamic_pointer_cast <minimized_window_handler_unity> (mMinimizeHandler);
166+ compizMinimizeHandler->windowNotify (n);
167+ }
168+
169 // We do this after the notify to ensure input focus has actually been moved.
170 if (n == CompWindowNotifyFocusChange)
171 {
172@@ -2295,10 +2307,25 @@
173 WindowInterface::setHandler(window);
174 GLWindowInterface::setHandler(gWindow);
175
176- window->focusSetEnabled (this, false);
177- window->minimizedSetEnabled (this, false);
178- window->minimizeSetEnabled (this, false);
179- window->unminimizeSetEnabled (this, false);
180+ if (UnityScreen::get (screen)->optionGetShowMinimizedWindows () &&
181+ window->mapNum ())
182+ {
183+ bool wasMinimized = window->minimized ();
184+ if (wasMinimized)
185+ window->unminimize ();
186+ window->minimizeSetEnabled (this, true);
187+ window->unminimizeSetEnabled (this, true);
188+ window->minimizedSetEnabled (this, true);
189+
190+ if (wasMinimized)
191+ window->minimize ();
192+ }
193+ else
194+ {
195+ window->minimizeSetEnabled (this, false);
196+ window->unminimizeSetEnabled (this, false);
197+ window->minimizedSetEnabled (this, false);
198+ }
199
200 if (window->state () & CompWindowStateFullscreenMask)
201 UnityScreen::get (screen)->fullscreen_windows_.push_back(window);