Merge lp:~unity-team/compiz/x-sru1 into lp:compiz/xenial

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Andrea Azzarone
Approved revision: 4017
Merged at revision: 4011
Proposed branch: lp:~unity-team/compiz/x-sru1
Merge into: lp:compiz/xenial
Diff against target: 582 lines (+213/-37)
14 files modified
debian/changelog (+27/-0)
include/core/screen.h (+3/-0)
plugins/expo/expo.xml.in (+6/-0)
plugins/expo/src/expo.cpp (+3/-1)
plugins/opengl/src/paint.cpp (+1/-1)
plugins/scale/include/scale/scale.h (+1/-1)
plugins/scale/scale.xml.in (+7/-1)
plugins/scale/src/privates.h (+2/-2)
plugins/scale/src/scale.cpp (+83/-18)
src/event.cpp (+29/-3)
src/privatescreen.h (+7/-1)
src/privatescreen/tests/test-privatescreen.cpp (+3/-0)
src/screen.cpp (+26/-6)
src/window.cpp (+15/-3)
To merge this branch: bzr merge lp:~unity-team/compiz/x-sru1
Reviewer Review Type Date Requested Status
Andrea Azzarone Approve
Review via email: mp+295780@code.launchpad.net

Commit message

Backported fixes for the first Xenial SRU

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

+1

review: Approve

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 2016-04-15 05:30:50 +0000
3+++ debian/changelog 2016-05-26 00:07:16 +0000
4@@ -1,3 +1,30 @@
5+compiz (1:0.9.12.2+16.04.20160415-0ubuntu2) UNRELEASED; urgency=medium
6+
7+ [ Andrea Azzarone ]
8+ * Add an option to notify that a key press is actually an "auto
9+ repeat" one. (LP: #1572241)
10+
11+ [ Alberts Muktupāvels ]
12+ * OpenGL: use the number of Opaque windows around to decide whether
13+ paint the bg or not (LP: #1574866)
14+
15+ [ Marco Trevisan (Treviño) ]
16+ * Scale: use the selectedWindow as starting point when focusing a
17+ window (LP: #1575168)
18+ * Scale: allow to iterate through windows using Tab key
19+ * Window: call stateChangeNotify when compiz state changed but before
20+ changing the WM state (LP: #1521302)
21+
22+ [ Eleni Maria Stea ]
23+ * Expo, Scale: add support for bottom offsets (LP: #1562346, LP:
24+ #1573897)
25+
26+ [ handsome_feng ]
27+ * Add a YBottomOffset value when stretch maximized windows。 (LP:
28+ #1562348)
29+
30+ -- Andrea Azzarone <azzaronea@gmail.com> Thu, 26 May 2016 01:56:18 +0200
31+
32 compiz (1:0.9.12.2+16.04.20160415-0ubuntu1) xenial; urgency=medium
33
34 [ Martin Wimpress ]
35
36=== modified file 'include/core/screen.h'
37--- include/core/screen.h 2015-10-20 22:43:42 +0000
38+++ include/core/screen.h 2016-05-26 00:07:16 +0000
39@@ -169,8 +169,11 @@
40 {
41 public:
42 virtual void incrementDesktopWindowCount() = 0;
43+ virtual void incrementOpaqueDesktopWindowCount() = 0;
44 virtual void decrementDesktopWindowCount() = 0;
45+ virtual void decrementOpaqueDesktopWindowCount() = 0;
46 virtual int desktopWindowCount() = 0;
47+ virtual int opaqueDesktopWindowCount() = 0;
48 protected:
49 ~DesktopWindowCount() {}
50 };
51
52=== modified file 'plugins/expo/expo.xml.in'
53--- plugins/expo/expo.xml.in 2015-10-26 17:15:43 +0000
54+++ plugins/expo/expo.xml.in 2016-05-26 00:07:16 +0000
55@@ -149,6 +149,12 @@
56 <_long>Vertical offset (in pixels).</_long>
57 <default>24</default>
58 </option>
59+ <option name="y_bottom_offset" type="int">
60+ <_short>Y Bottom Offset</_short>
61+ <_long>Vertical offset from the bottom (in pixels).</_long>
62+ <default>0</default>
63+ <min>0</min>
64+ </option>
65 <option name="distance" type="float">
66 <_short>Camera Distance</_short>
67 <_long>The distance between the camera and the exposed viewports.</_long>
68
69=== modified file 'plugins/expo/src/expo.cpp'
70--- plugins/expo/src/expo.cpp 2015-10-20 15:12:34 +0000
71+++ plugins/expo/src/expo.cpp 2016-05-26 00:07:16 +0000
72@@ -921,6 +921,8 @@
73 /* translate expo to center */
74 sTransform.translate (vpSize.x () * sx * -0.5 + offsetInWorldCoordX,
75 vpSize.y () * sy * 0.5 - offsetInWorldCoordY, 0.0f);
76+
77+ worldScaleFactorY -= (float)optionGetYBottomOffset () / (float)output->height ();
78 sTransform.scale (worldScaleFactorX, worldScaleFactorY, 1.0f);
79
80
81@@ -1503,7 +1505,7 @@
82 float yS = 1.0 + ((o->height () / (float) window->height ()) - 1.0f) * sigmoidProgress (eScreen->expoCam);
83 float xS = 1.0 + ((o->width () / (float) window->width ()) - 1.0f) * sigmoidProgress (eScreen->expoCam);
84 wTransform.translate (window->x () + window->width (),
85- window->y () + window->height (),
86+ window->y () + window->height () + eScreen->optionGetYBottomOffset (),
87 0.0f);
88 wTransform.scale (xS, yS, 1.0f);
89 wTransform.translate (-(window->x () + window->width ()),
90
91=== modified file 'plugins/opengl/src/paint.cpp'
92--- plugins/opengl/src/paint.cpp 2015-04-07 14:20:32 +0000
93+++ plugins/opengl/src/paint.cpp 2016-05-26 00:07:16 +0000
94@@ -86,7 +86,7 @@
95 if (!nBox)
96 return;
97
98- if (screen->desktopWindowCount ())
99+ if (screen->opaqueDesktopWindowCount ())
100 {
101 if (!backgroundTextures.empty ())
102 {
103
104=== modified file 'plugins/scale/include/scale/scale.h'
105--- plugins/scale/include/scale/scale.h 2014-04-15 16:47:09 +0000
106+++ plugins/scale/include/scale/scale.h 2016-05-26 00:07:16 +0000
107@@ -137,7 +137,7 @@
108 public:
109 ScaleWindow (CompWindow *w);
110 ~ScaleWindow ();
111-
112+
113 CompWindow *window;
114
115 bool hasSlot () const;
116
117=== modified file 'plugins/scale/scale.xml.in'
118--- plugins/scale/scale.xml.in 2015-10-26 17:15:43 +0000
119+++ plugins/scale/scale.xml.in 2016-05-26 00:07:16 +0000
120@@ -33,7 +33,13 @@
121 </option>
122 <option name="y_offset" type="int">
123 <_short>Y Offset</_short>
124- <_long>Vertical offset (in pixels).</_long>
125+ <_long>Vertical offset from the top (in pixels).</_long>
126+ <min>0</min>
127+ <default>0</default>
128+ </option>
129+ <option name="y_bottom_offset" type="int">
130+ <_short>Y Bottom Offset</_short>
131+ <_long>Vertical offset from the bottom (in pixels).</_long>)
132 <min>0</min>
133 <default>0</default>
134 </option>
135
136=== modified file 'plugins/scale/src/privates.h'
137--- plugins/scale/src/privates.h 2014-04-17 16:00:05 +0000
138+++ plugins/scale/src/privates.h 2016-05-26 00:07:16 +0000
139@@ -94,7 +94,9 @@
140 bool selectWindowAt (int x, int y, bool moveInputFocus);
141 bool selectWindowAt (int x, int y);
142
143+ void moveFocusWindow (CompWindow *);
144 void moveFocusWindow (int dx, int dy);
145+ void moveFocusWindow (int distance);
146
147 void windowRemove (CompWindow *);
148
149@@ -117,8 +119,6 @@
150 Window hoveredWindow;
151 Window previousActiveWindow;
152
153- KeyCode leftKeyCode, rightKeyCode, upKeyCode, downKeyCode;
154-
155 bool grab;
156 CompScreen::GrabHandle grabIndex;
157
158
159=== modified file 'plugins/scale/src/scale.cpp'
160--- plugins/scale/src/scale.cpp 2015-11-16 12:14:14 +0000
161+++ plugins/scale/src/scale.cpp 2016-05-26 00:07:16 +0000
162@@ -509,7 +509,7 @@
163 int nSlots = 0;
164
165 y = optionGetYOffset() + workArea.y () + spacing;
166- height = (workArea.height () - optionGetYOffset() - (lines + 1) * spacing) / lines;
167+ height = (workArea.height () - optionGetYOffset () - optionGetYBottomOffset () - (lines + 1) * spacing) / lines;
168
169 for (int i = 0; i < lines; i++)
170 {
171@@ -1528,13 +1528,67 @@
172 }
173
174 void
175+PrivateScaleScreen::moveFocusWindow (int distance)
176+{
177+ CompWindow *selected;
178+ CompWindow *next;
179+
180+ next = NULL;
181+ selected = screen->findWindow (selectedWindow ? selectedWindow : screen->activeWindow ());
182+ auto scaledWindows = windows;
183+
184+ /* Sort windows to respect the natural grid view */
185+ scaledWindows.sort ([] (ScaleWindow *sw1, ScaleWindow *sw2) {
186+ if (!sw1->priv->slot)
187+ return !sw2->priv->slot;
188+ if (!sw2->priv->slot)
189+ return true;
190+
191+ int cy1 = (sw1->priv->slot->y1 () + sw1->priv->slot->y2 ()) / 2;
192+ int cy2 = (sw2->priv->slot->y1 () + sw2->priv->slot->y2 ()) / 2;
193+
194+ if (abs (cy1 - cy2) < std::max (sw1->priv->slot->height (), sw2->priv->slot->height ()) / 2)
195+ {
196+ int cx1 = (sw1->priv->slot->x1 () + sw1->priv->slot->x2 ()) / 2;
197+ int cx2 = (sw2->priv->slot->x1 () + sw2->priv->slot->x2 ()) / 2;
198+ return cx1 < cx2;
199+ }
200+
201+ return cy1 < cy2;
202+ });
203+
204+ if (selected && !scaledWindows.empty())
205+ {
206+ SCALE_WINDOW (selected);
207+ auto selected_it = std::find (scaledWindows.begin (), scaledWindows.end (), sw);
208+
209+ if (selected_it != scaledWindows.end ())
210+ {
211+ std::advance (selected_it, distance);
212+
213+ if (selected_it == scaledWindows.end ())
214+ {
215+ if (distance > 0)
216+ selected_it = scaledWindows.begin ();
217+ else if (distance < 0)
218+ selected_it = std::prev (scaledWindows.end ());
219+ }
220+
221+ next = (*selected_it)->window;
222+ }
223+ }
224+
225+ moveFocusWindow (next);
226+}
227+
228+void
229 PrivateScaleScreen::moveFocusWindow (int dx,
230 int dy)
231 {
232 CompWindow *active;
233 CompWindow *focus = NULL;
234
235- active = screen->findWindow (screen->activeWindow ());
236+ active = screen->findWindow (selectedWindow ? selectedWindow : screen->activeWindow ());
237 if (active)
238 {
239 SCALE_WINDOW (active);
240@@ -1547,9 +1601,9 @@
241 cx = (sw->priv->slot->x1 () + sw->priv->slot->x2 ()) / 2;
242 cy = (sw->priv->slot->y1 () + sw->priv->slot->y2 ()) / 2;
243
244- foreach (CompWindow *w, screen->windows ())
245+ foreach (ScaleWindow *w, windows)
246 {
247- slot = ScaleWindow::get (w)->priv->slot;
248+ slot = w->priv->slot;
249 if (!slot)
250 continue;
251
252@@ -1566,23 +1620,29 @@
253 continue;
254
255 min = d;
256- focus = w;
257+ focus = w->window;
258 }
259 }
260 }
261 }
262
263+ moveFocusWindow (focus);
264+}
265+
266+void
267+PrivateScaleScreen::moveFocusWindow (CompWindow *focus)
268+{
269 /* move focus to the last focused window if no slot window is currently
270 focused */
271 if (!focus)
272 {
273- foreach (CompWindow *w, screen->windows ())
274+ foreach (ScaleWindow *sw, windows)
275 {
276- if (!ScaleWindow::get (w)->priv->slot)
277+ if (!sw->priv->slot)
278 continue;
279
280- if (!focus || focus->activeNum () < w->activeNum ())
281- focus = w;
282+ if (!focus || focus->activeNum () < sw->window->activeNum ())
283+ focus = sw->window;
284 }
285 }
286
287@@ -1719,14 +1779,23 @@
288 {
289 if (grabIndex)
290 {
291- if (event->xkey.keycode == leftKeyCode)
292+ KeySym keySym = XkbKeycodeToKeysym (event->xany.display,
293+ event->xkey.keycode, 0, 0);
294+ if (keySym == XK_Left)
295 moveFocusWindow (-1, 0);
296- else if (event->xkey.keycode == rightKeyCode)
297+ else if (keySym == XK_Right)
298 moveFocusWindow (1, 0);
299- else if (event->xkey.keycode == upKeyCode)
300+ else if (keySym == XK_Up)
301 moveFocusWindow (0, -1);
302- else if (event->xkey.keycode == downKeyCode)
303+ else if (keySym == XK_Down)
304 moveFocusWindow (0, 1);
305+ else if (keySym == XK_Tab)
306+ moveFocusWindow (!(event->xkey.state & ShiftMask) ? 1 : -1);
307+ else if (keySym == XK_w && (event->xkey.state & ControlMask))
308+ {
309+ if (CompWindow *selected = screen->findWindow (selectedWindow))
310+ selected->close (0);
311+ }
312 }
313 }
314 break;
315@@ -1752,6 +1821,7 @@
316 CompRect workArea (screen->currentOutputDev ().workArea ());
317 workArea.setX (workArea.x() + optionGetXOffset ());
318 workArea.setY (workArea.y() + optionGetYOffset ());
319+ workArea.setBottom (workArea.bottom () + optionGetYBottomOffset ());
320
321 if (workArea.contains (pointer))
322 {
323@@ -1962,11 +2032,6 @@
324 moreAdjust (false),
325 nSlots (0)
326 {
327- leftKeyCode = XKeysymToKeycode (screen->dpy (), XStringToKeysym ("Left"));
328- rightKeyCode = XKeysymToKeycode (screen->dpy (), XStringToKeysym ("Right"));
329- upKeyCode = XKeysymToKeycode (screen->dpy (), XStringToKeysym ("Up"));
330- downKeyCode = XKeysymToKeycode (screen->dpy (), XStringToKeysym ("Down"));
331-
332 opacity = (OPAQUE * optionGetOpacity ()) / 100;
333
334 hover.setCallback (boost::bind (&PrivateScaleScreen::hoverTimeout, this));
335
336=== modified file 'src/event.cpp'
337--- src/event.cpp 2015-10-13 11:33:31 +0000
338+++ src/event.cpp 2016-05-26 00:07:16 +0000
339@@ -855,7 +855,7 @@
340
341 if (o.empty ())
342 {
343- o.resize (8);
344+ o.resize (9);
345 o[0].setName ("event_window", CompOption::TypeInt);
346 o[1].setName ("window", CompOption::TypeInt);
347 o[2].setName ("modifiers", CompOption::TypeInt);
348@@ -867,6 +867,7 @@
349 {
350 o[6].reset ();
351 o[7].reset ();
352+ o[8].reset ();
353 }
354
355 switch (event->type) {
356@@ -936,10 +937,14 @@
357
358 o[6].setName ("keycode", CompOption::TypeInt);
359 o[7].setName ("time", CompOption::TypeInt);
360+ o[8].setName ("is_repeated", CompOption::TypeBool);
361
362 o[6].value ().set ((int) event->xkey.keycode);
363 o[7].value ().set ((int) event->xkey.time);
364
365+ o[8].value ().set (nextKeyPressIsRepeated_);
366+ nextKeyPressIsRepeated_ = false;
367+
368 eventManager.resetPossibleTap();
369 foreach (CompPlugin *p, CompPlugin::getPlugins ())
370 {
371@@ -966,6 +971,19 @@
372
373 bool handled = false;
374
375+ nextKeyPressIsRepeated_ = false;
376+ if (XEventsQueued (dpy, QueuedAfterReading))
377+ {
378+ XEvent nev;
379+ XPeekEvent (dpy, &nev);
380+
381+ if (nev.type == KeyPress && nev.xkey.time == event->xkey.time &&
382+ nev.xkey.keycode == event->xkey.keycode)
383+ {
384+ nextKeyPressIsRepeated_ = true;
385+ }
386+ }
387+
388 foreach (CompPlugin *p, CompPlugin::getPlugins ())
389 {
390 CompOption::Vector &options = p->vTable->getOptions ();
391@@ -1679,9 +1697,17 @@
392 if (w->isViewable ())
393 {
394 if (w->type () == CompWindowTypeDesktopMask)
395- decrementDesktopWindowCount();
396+ {
397+ decrementDesktopWindowCount ();
398+ if (!w->alpha ())
399+ decrementOpaqueDesktopWindowCount ();
400+ }
401 else if (type == CompWindowTypeDesktopMask)
402- incrementDesktopWindowCount();
403+ {
404+ incrementDesktopWindowCount ();
405+ if (!w->alpha ())
406+ incrementOpaqueDesktopWindowCount ();
407+ }
408 }
409
410 w->wmType () = type;
411
412=== modified file 'src/privatescreen.h'
413--- src/privatescreen.h 2015-10-26 17:15:50 +0000
414+++ src/privatescreen.h 2016-05-26 00:07:16 +0000
415@@ -542,10 +542,14 @@
416 DesktopWindowCount();
417 virtual ~DesktopWindowCount() {}
418 virtual void incrementDesktopWindowCount();
419+ virtual void incrementOpaqueDesktopWindowCount();
420 virtual void decrementDesktopWindowCount();
421+ virtual void decrementOpaqueDesktopWindowCount();
422 virtual int desktopWindowCount();
423+ virtual int opaqueDesktopWindowCount();
424 private:
425- int count;
426+ int countAll;
427+ int countOpaque;
428 };
429
430 class MapNum :
431@@ -818,6 +822,8 @@
432 compiz::private_screen::PluginManager pluginManager;
433 compiz::private_screen::WindowManager& windowManager;
434 CompOption::Vector resourceManager;
435+
436+ bool nextKeyPressIsRepeated_;
437 };
438
439 class CompManager
440
441=== modified file 'src/privatescreen/tests/test-privatescreen.cpp'
442--- src/privatescreen/tests/test-privatescreen.cpp 2015-10-26 17:15:50 +0000
443+++ src/privatescreen/tests/test-privatescreen.cpp 2016-05-26 00:07:16 +0000
444@@ -145,6 +145,7 @@
445 CompSize &size,
446 void *&data));
447 MOCK_METHOD0(desktopWindowCount, int ());
448+ MOCK_METHOD0(opaqueDesktopWindowCount, int ());
449 MOCK_METHOD0(attrib, XWindowAttributes ());
450 MOCK_CONST_METHOD0(defaultIcon, CompIcon *());
451 virtual bool otherGrabExist (const char *, ...) { return false; } // TODO How to mock?
452@@ -183,7 +184,9 @@
453 MOCK_METHOD0(snDisplay, SnDisplay * ());
454 MOCK_CONST_METHOD0(createFailed, bool ());
455 MOCK_METHOD0(incrementDesktopWindowCount, void ());
456+ MOCK_METHOD0(incrementOpaqueDesktopWindowCount, void ());
457 MOCK_METHOD0(decrementDesktopWindowCount, void ());
458+ MOCK_METHOD0(decrementOpaqueDesktopWindowCount, void ());
459 MOCK_METHOD0(nextMapNum, unsigned int ());
460 MOCK_CONST_METHOD0(updatePassiveKeyGrabs, void ());
461 MOCK_METHOD1(updatePassiveButtonGrabs, void (Window serverFrame));
462
463=== modified file 'src/screen.cpp'
464--- src/screen.cpp 2015-10-26 17:15:50 +0000
465+++ src/screen.cpp 2016-05-26 00:07:16 +0000
466@@ -4565,7 +4565,13 @@
467 int
468 cps::DesktopWindowCount::desktopWindowCount ()
469 {
470- return count;
471+ return countAll;
472+}
473+
474+int
475+cps::DesktopWindowCount::opaqueDesktopWindowCount ()
476+{
477+ return countOpaque;
478 }
479
480 unsigned int
481@@ -4879,19 +4885,32 @@
482 }
483
484 cps::DesktopWindowCount::DesktopWindowCount() :
485-count(0)
486+countAll(0), countOpaque(0)
487 {
488 }
489
490 void
491 cps::DesktopWindowCount::incrementDesktopWindowCount()
492 {
493- count++;
494-}
495+ countAll++;
496+}
497+
498+void
499+cps::DesktopWindowCount::incrementOpaqueDesktopWindowCount()
500+{
501+ countOpaque++;
502+}
503+
504 void
505 cps::DesktopWindowCount::decrementDesktopWindowCount()
506 {
507- count--;
508+ countAll--;
509+}
510+
511+void
512+cps::DesktopWindowCount::decrementOpaqueDesktopWindowCount()
513+{
514+ countOpaque--;
515 }
516
517 cps::MapNum::MapNum() :
518@@ -5451,7 +5470,8 @@
519 edgeWindow (None),
520 edgeDelayTimer (),
521 xdndWindow (None),
522- windowManager(windowManager)
523+ windowManager(windowManager),
524+ nextKeyPressIsRepeated_(false)
525 {
526 for (int i = 0; i < SCREEN_EDGE_NUM; i++)
527 {
528
529=== modified file 'src/window.cpp'
530--- src/window.cpp 2015-08-05 11:26:30 +0000
531+++ src/window.cpp 2016-05-26 00:07:16 +0000
532@@ -543,11 +543,11 @@
533
534 recalcType ();
535 recalcActions ();
536+ stateChangeNotify (oldState);
537
538 if (priv->managed)
539 screen->setWindowState (priv->state, priv->id);
540
541- stateChangeNotify (oldState);
542 screen->matchPropertyChanged (this);
543 }
544
545@@ -1372,7 +1372,11 @@
546 screen->updateClientList ();
547
548 if (priv->type & CompWindowTypeDesktopMask)
549- screen->incrementDesktopWindowCount();
550+ {
551+ screen->incrementDesktopWindowCount ();
552+ if (!alpha ())
553+ screen->incrementOpaqueDesktopWindowCount ();
554+ }
555
556 if (priv->protocols & CompWindowProtocolSyncRequestMask)
557 {
558@@ -1456,7 +1460,11 @@
559 return;
560
561 if (priv->type == CompWindowTypeDesktopMask)
562- screen->decrementDesktopWindowCount();
563+ {
564+ screen->decrementDesktopWindowCount ();
565+ if (!alpha ())
566+ screen->decrementOpaqueDesktopWindowCount ();
567+ }
568
569 priv->attrib.map_state = IsUnmapped;
570 priv->invisible = true;
571@@ -6333,7 +6341,11 @@
572 if (priv->attrib.map_state == IsViewable)
573 {
574 if (priv->type == CompWindowTypeDesktopMask)
575+ {
576 screen->decrementDesktopWindowCount ();
577+ if (!alpha ())
578+ screen->decrementOpaqueDesktopWindowCount ();
579+ }
580
581 if (priv->destroyed && priv->struts)
582 screen->updateWorkarea ();

Subscribers

People subscribed via source and target branches

to all changes: