Merge lp:~jamespharaoh/ubuntu/oneiric/unity/fix-for-880672 into lp:ubuntu/oneiric/unity

Proposed by James Pharaoh
Status: Work in progress
Proposed branch: lp:~jamespharaoh/ubuntu/oneiric/unity/fix-for-880672
Merge into: lp:ubuntu/oneiric/unity
Diff against target: 350 lines (+134/-13)
12 files modified
debian/changelog (+6/-0)
plugins/unityshell/src/Behaviour.cpp (+33/-0)
plugins/unityshell/src/Behaviour.h (+55/-0)
plugins/unityshell/src/PanelController.cpp (+4/-3)
plugins/unityshell/src/PanelController.h (+3/-1)
plugins/unityshell/src/PanelMenuView.cpp (+18/-3)
plugins/unityshell/src/PanelMenuView.h (+5/-1)
plugins/unityshell/src/PanelView.cpp (+2/-2)
plugins/unityshell/src/PanelView.h (+1/-1)
plugins/unityshell/src/unityshell.cpp (+2/-1)
plugins/unityshell/src/unityshell.h (+3/-0)
tests/TestPanel.cpp (+2/-1)
To merge this branch: bzr merge lp:~jamespharaoh/ubuntu/oneiric/unity/fix-for-880672
Reviewer Review Type Date Requested Status
Ubuntu branches Pending
Review via email: mp+80181@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

thank you for your bug report, it would be better to have a merge request on the upstream lp:unity code rather than on the packaging though

Revision history for this message
Sebastien Bacher (seb128) wrote :

Do you think you could update that request to target the right vcs?

Revision history for this message
Stéphane Graber (stgraber) wrote :

Based on comments above, marking as work in progress.

Revision history for this message
James Pharaoh (jamespharaoh) wrote :

I will get around to this this week, I have been off for a couple of
weeks and am now catching up with a few things.

2011/11/28 Stéphane Graber <email address hidden>:
> Based on comments above, marking as work in progress.
> --
> https://code.launchpad.net/~jamespharaoh/ubuntu/oneiric/unity/fix-for-880672/+merge/80181
> You are the owner of lp:~jamespharaoh/ubuntu/oneiric/unity/fix-for-880672.
>

--
James Pharaoh
Pharaoh Systems Limited
http://phsys.co.uk/contact

Unmerged revisions

122. By James Pharaoh <email address hidden>

Raise window appropriately on title bar click when raise on click is disabled (LP: #880672)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2011-10-07 09:03:50 +0000
3+++ debian/changelog 2011-10-24 06:49:27 +0000
4@@ -1,3 +1,9 @@
5+unity (4.22.0-0ubuntu4) oneiric; urgency=low
6+
7+ * Raise window appropriately on title bar click when raise on click is disabled (LP: #880672)
8+
9+ -- James Pharaoh <james@phsys.co.uk> Mon, 24 Oct 2011 08:36:23 +0200
10+
11 unity (4.22.0-0ubuntu3) oneiric; urgency=low
12
13 * Cherry-pick upstream:
14
15=== added file 'plugins/unityshell/src/Behaviour.cpp'
16--- plugins/unityshell/src/Behaviour.cpp 1970-01-01 00:00:00 +0000
17+++ plugins/unityshell/src/Behaviour.cpp 2011-10-24 06:49:27 +0000
18@@ -0,0 +1,33 @@
19+/*
20+ * Copyright (C) 2011 Canonical Ltd
21+ *
22+ * This program is free software: you can redistribute it and/or modify
23+ * it under the terms of the GNU General Public License version 3 as
24+ * published by the Free Software Foundation.
25+ *
26+ * This program is distributed in the hope that it will be useful,
27+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
28+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29+ * GNU General Public License for more details.
30+ *
31+ * You should have received a copy of the GNU General Public License
32+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
33+ *
34+ * Authored by: James Pharaoh <james@phsys.co.uk>
35+ */
36+
37+#include "Behaviour.h"
38+
39+namespace unity {
40+
41+DefaultBehaviour::DefaultBehaviour (CompScreen* compScreen)
42+ : _compScreen (compScreen) {
43+}
44+
45+bool DefaultBehaviour::raiseOnClick () {
46+ CompOption* option = _compScreen->getOption ("raise_on_click");
47+ if (! option) return true;
48+ return option->value ().b ();
49+}
50+
51+} // namespace unity
52
53=== added file 'plugins/unityshell/src/Behaviour.h'
54--- plugins/unityshell/src/Behaviour.h 1970-01-01 00:00:00 +0000
55+++ plugins/unityshell/src/Behaviour.h 2011-10-24 06:49:27 +0000
56@@ -0,0 +1,55 @@
57+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
58+/*
59+ * Copyright (C) 2011 Canonical Ltd
60+ *
61+ * This program is free software: you can redistribute it and/or modify
62+ * it under the terms of the GNU General Public License version 3 as
63+ * published by the Free Software Foundation.
64+ *
65+ * This program is distributed in the hope that it will be useful,
66+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
67+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
68+ * GNU General Public License for more details.
69+ *
70+ * You should have received a copy of the GNU General Public License
71+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
72+ *
73+ * Authored by: James Pharaoh <james@phsys.co.uk>
74+ */
75+
76+#ifndef BEHAVIOUR_H
77+#define BEHAVIOUR_H
78+
79+#include <core/screen.h>
80+
81+namespace unity {
82+
83+class Behaviour {
84+
85+public:
86+ virtual bool raiseOnClick () = 0;
87+};
88+
89+class DefaultBehaviour :
90+ public Behaviour {
91+
92+public:
93+ DefaultBehaviour (CompScreen* compScreen);
94+ virtual bool raiseOnClick ();
95+
96+private:
97+ CompScreen* _compScreen;
98+};
99+
100+class DummyBehaviour :
101+ public Behaviour {
102+
103+public:
104+ virtual bool raiseOnClick () {
105+ return false;
106+ }
107+};
108+
109+}
110+
111+#endif
112
113=== modified file 'plugins/unityshell/src/PanelController.cpp'
114--- plugins/unityshell/src/PanelController.cpp 2011-09-29 19:07:09 +0000
115+++ plugins/unityshell/src/PanelController.cpp 2011-10-24 06:49:27 +0000
116@@ -32,8 +32,9 @@
117 nux::logging::Logger logger("unity.panel");
118 }
119
120-PanelController::PanelController()
121- : _bfb_size(66),
122+PanelController::PanelController(Behaviour* behaviour)
123+ : _behaviour (behaviour),
124+ _bfb_size(66),
125 _opacity(1.0f),
126 _open_menu_start_received(false)
127 {
128@@ -183,7 +184,7 @@
129
130 layout = new nux::HLayout(NUX_TRACKER_LOCATION);
131
132- view = new PanelView();
133+ view = new PanelView(_behaviour);
134 view->SetMaximumHeight(24);
135 view->SetOpacity(_opacity);
136 view->SetPrimary(i == primary_monitor);
137
138=== modified file 'plugins/unityshell/src/PanelController.h'
139--- plugins/unityshell/src/PanelController.h 2011-09-29 19:07:09 +0000
140+++ plugins/unityshell/src/PanelController.h 2011-10-24 06:49:27 +0000
141@@ -25,11 +25,12 @@
142
143 #include "Introspectable.h"
144 #include "PanelView.h"
145+#include "Behaviour.h"
146
147 class PanelController : public nux::Object, public unity::Introspectable
148 {
149 public:
150- PanelController();
151+ PanelController(unity::Behaviour* behaviour);
152 ~PanelController();
153
154 void StartFirstMenuShow();
155@@ -55,6 +56,7 @@
156 nux::Geometry& geo,
157 void* user_data);
158 private:
159+ unity::Behaviour* _behaviour;
160 std::vector<nux::BaseWindow*> _windows;
161 int _bfb_size;
162 float _opacity;
163
164=== modified file 'plugins/unityshell/src/PanelMenuView.cpp'
165--- plugins/unityshell/src/PanelMenuView.cpp 2011-10-07 09:03:50 +0000
166+++ plugins/unityshell/src/PanelMenuView.cpp 2011-10-24 06:49:27 +0000
167@@ -62,8 +62,9 @@
168 gchar* new_name,
169 PanelMenuView* self);
170
171-PanelMenuView::PanelMenuView(int padding)
172- : _matcher(NULL),
173+PanelMenuView::PanelMenuView(Behaviour* behaviour, int padding)
174+ : _behaviour (behaviour),
175+ _matcher(NULL),
176 _title_layer(NULL),
177 _util_cg(CAIRO_FORMAT_ARGB32, 1, 1),
178 _gradient_texture(NULL),
179@@ -1268,6 +1269,13 @@
180 // showing the window shape preview effect. See bug #838923
181 if (GetMaximizedWindow() != 0)
182 _panel_titlebar_grab_area->SetGrabbed(true);
183+
184+ if (_behaviour->raiseOnClick ()) {
185+ guint32 window_xid = GetMaximizedWindow();
186+ WindowManager::Default()->Activate(window_xid);
187+ }
188+
189+ _is_moved = false;
190 }
191
192 void
193@@ -1299,13 +1307,15 @@
194 {
195 _panel_titlebar_grab_area->SetGrabbed(false);
196
197- WindowManager::Default()->Activate(window_xid);
198 _is_inside = true;
199 _is_grabbed = true;
200 Refresh();
201 FullRedraw();
202 WindowManager::Default()->StartMove(window_xid, x, y);
203 }
204+
205+ if (_panel_titlebar_grab_area->GetAbsoluteX() || _panel_titlebar_grab_area->GetAbsoluteY())
206+ _is_moved = true;
207 }
208
209 void
210@@ -1320,6 +1330,11 @@
211 if (!_is_inside)
212 _is_grabbed = false;
213
214+ if (! _behaviour->raiseOnClick () && ! _is_moved) {
215+ guint32 window_xid = GetMaximizedWindow();
216+ WindowManager::Default()->Activate(window_xid);
217+ }
218+
219 Refresh();
220 FullRedraw();
221 }
222
223=== modified file 'plugins/unityshell/src/PanelMenuView.h'
224--- plugins/unityshell/src/PanelMenuView.h 2011-10-04 15:45:58 +0000
225+++ plugins/unityshell/src/PanelMenuView.h 2011-10-24 06:49:27 +0000
226@@ -31,6 +31,7 @@
227 #include "PanelTitlebarGrabAreaView.h"
228 #include "PluginAdapter.h"
229 #include "Animator.h"
230+#include "Behaviour.h"
231
232 #include <libbamf/libbamf.h>
233
234@@ -52,7 +53,7 @@
235 // It also deals with undecorating maximized windows (and redecorating them
236 // on unmaximize)
237
238- PanelMenuView(int padding = 6);
239+ PanelMenuView(Behaviour* behaviour, int padding = 6);
240 ~PanelMenuView();
241
242 void FullRedraw();
243@@ -129,6 +130,8 @@
244 void OnFadeOutChanged(double);
245
246 private:
247+ Behaviour* _behaviour;
248+
249 BamfMatcher* _matcher;
250
251 nux::TextureLayer* _title_layer;
252@@ -140,6 +143,7 @@
253 bool _is_grabbed;
254 bool _is_maximized;
255 bool _is_own_window;
256+ bool _is_moved;
257 PanelIndicatorEntryView* _last_active_view;
258
259 WindowButtons* _window_buttons;
260
261=== modified file 'plugins/unityshell/src/PanelView.cpp'
262--- plugins/unityshell/src/PanelView.cpp 2011-09-29 19:07:09 +0000
263+++ plugins/unityshell/src/PanelView.cpp 2011-10-24 06:49:27 +0000
264@@ -52,7 +52,7 @@
265
266 NUX_IMPLEMENT_OBJECT_TYPE(PanelView);
267
268-PanelView::PanelView(NUX_FILE_LINE_DECL)
269+PanelView::PanelView(Behaviour* behaviour, NUX_FILE_LINE_DECL)
270 : View(NUX_FILE_LINE_PARAM),
271 _is_dirty(true),
272 _opacity(1.0f),
273@@ -74,7 +74,7 @@
274
275 _layout = new nux::HLayout("", NUX_TRACKER_LOCATION);
276
277- _menu_view = new PanelMenuView();
278+ _menu_view = new PanelMenuView(behaviour);
279 AddPanelView(_menu_view, 1);
280
281 SetCompositionLayout(_layout);
282
283=== modified file 'plugins/unityshell/src/PanelView.h'
284--- plugins/unityshell/src/PanelView.h 2011-09-29 19:07:09 +0000
285+++ plugins/unityshell/src/PanelView.h 2011-10-24 06:49:27 +0000
286@@ -44,7 +44,7 @@
287 {
288 NUX_DECLARE_OBJECT_TYPE(PanelView, nux::View);
289 public:
290- PanelView(NUX_FILE_LINE_PROTO);
291+ PanelView(unity::Behaviour* behaviour, NUX_FILE_LINE_PROTO);
292 ~PanelView();
293
294 long ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo);
295
296=== modified file 'plugins/unityshell/src/unityshell.cpp'
297--- plugins/unityshell/src/unityshell.cpp 2011-10-05 12:04:39 +0000
298+++ plugins/unityshell/src/unityshell.cpp 2011-10-24 06:49:27 +0000
299@@ -116,6 +116,7 @@
300 , dash_is_open_ (false)
301 , grab_index_ (0)
302 , painting_tray_ (false)
303+ , _behaviour (screen)
304 {
305 Timer timer;
306 gfloat version;
307@@ -2384,7 +2385,7 @@
308
309 /* Setup panel */
310 timer.Reset();
311- self->panelController = new PanelController();
312+ self->panelController = new PanelController(& self->_behaviour);
313 self->AddChild(self->panelController);
314 LOG_INFO(logger) << "initLauncher-Panel " << timer.ElapsedSeconds() << "s";
315
316
317=== modified file 'plugins/unityshell/src/unityshell.h'
318--- plugins/unityshell/src/unityshell.h 2011-10-04 15:45:58 +0000
319+++ plugins/unityshell/src/unityshell.h 2011-10-24 06:49:27 +0000
320@@ -42,6 +42,7 @@
321 #include "DebugDBusInterface.h"
322 #include "SwitcherController.h"
323 #include "UBusWrapper.h"
324+#include "Behaviour.h"
325 #include <Nux/WindowThread.h>
326 #include <sigc++/sigc++.h>
327 #include <boost/shared_ptr.hpp>
328@@ -333,6 +334,8 @@
329 bool painting_tray_;
330 unsigned int tray_paint_mask_;
331
332+ unity::DefaultBehaviour _behaviour;
333+
334 friend class UnityWindow;
335 };
336
337
338=== modified file 'tests/TestPanel.cpp'
339--- tests/TestPanel.cpp 2011-09-29 19:07:09 +0000
340+++ tests/TestPanel.cpp 2011-10-24 06:49:27 +0000
341@@ -31,7 +31,8 @@
342 void ThreadWidgetInit(nux::NThread* thread, void* InitData)
343 {
344 nux::VLayout* layout = new nux::VLayout(TEXT(""), NUX_TRACKER_LOCATION);
345- unity::PanelView* view = new unity::PanelView();
346+ unity::Behaviour* behaviour = new unity::DummyBehaviour ();
347+ unity::PanelView* view = new unity::PanelView(behaviour);
348
349 //view->SetMinMaxSize(1024, 24);
350 view->SetPrimary(true);

Subscribers

People subscribed via source and target branches

to all changes: