Merge lp:~sil2100/compiz-core/scale_all-0.9.7 into lp:compiz-core

Proposed by Łukasz Zemczak
Status: Merged
Approved by: Daniel van Vugt
Approved revision: 3105
Merged at revision: 3110
Proposed branch: lp:~sil2100/compiz-core/scale_all-0.9.7
Merge into: lp:compiz-core
Diff against target: 64 lines (+43/-0)
2 files modified
plugins/scale/src/privates.h (+2/-0)
plugins/scale/src/scale.cpp (+41/-0)
To merge this branch: bzr merge lp:~sil2100/compiz-core/scale_all-0.9.7
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
Sam Spilsbury Approve
Review via email: mp+111515@code.launchpad.net

Commit message

Add support for initiating window picker in other than nomal mode. For now added only the additional 'All windows' picker, essentially fixing LP: #933776.
The code from the all mode comes from a patch made by Doug McMahon. Thanks!

Description of the change

Submitting the fix first to 0.9.7 because I had the branch prepared and I want to go to sleep ASAP. But still, I would like some comment on this way of fixing the bug.

The scale plugin has many actions defined: initiate for current workspace, for all windows, for groups and for current output device. But the scale plugin only supports one handler for all actions (the type of the action is not considered at all). For now I added a distinction between ScaleTypeAll and ScaleTypeNormal. I took the code proposed by Doug in the bug report as the code for ScaleTypeAll.

Would be nice to have this SRUed.

I browsed through the commits, but I never really saw any type-distinct action code. But I might have missed that, since it's REALLY busy here in London!lp:~sil2100/compiz-core/scale_all-0.9.7

To post a comment you must log in.
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Will add the trunk version in the morning, if this one is alright.

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Looks fine to me. Are you willing to write tests for it?

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I'm going to say Needs fixing, just because there is no fix upstream yet :)

Also, I strongly recommend investigating the other scale regressions and starting by simply reverting the code that caused the regressions from oneiric to precise. We will fix more bugs, faster and more reliably. Then we can re-implement whatever was reverted more safely.

If we accept bespoke fixes like this, then fixing the other scale regressions in precise becomes harder.

review: Needs Fixing
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

> I'm going to say Needs fixing, just because there is no fix upstream yet :)
>
> Also, I strongly recommend investigating the other scale regressions and
> starting by simply reverting the code that caused the regressions

This will inherently "cause" regressions by the fact that you just reverted important bugfixes. It does not take into account the waste of developer time as they are chasing up old code that they probably don't even remember writing.

If you want to fix things safely, analyse how the code works, analyse what its meant to do, write unit tests to ensure that it matches the required behaviour and implement your fixes. I don't revert things simply because I don't understand them - I learn the code by making it better and writing tests to ensure that it does what I think it does.

Lucasz - can you propose this fix to lp:compiz and then resubmit it here? Thanks for taking the time to look into this.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Approved for upstream today. So 0.9.7 is OK too.

This seems to solve 2 of the 3 scale regressions. And the other one, we found last week, was actually a unity bug.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/scale/src/privates.h'
--- plugins/scale/src/privates.h 2012-02-01 17:49:07 +0000
+++ plugins/scale/src/privates.h 2012-06-21 23:21:19 +0000
@@ -63,6 +63,8 @@
63 void findBestSlots ();63 void findBestSlots ();
64 bool fillInWindows ();64 bool fillInWindows ();
65 bool layoutThumbs ();65 bool layoutThumbs ();
66 bool layoutThumbsAll ();
67 bool layoutThumbsSingle ();
6668
67 SlotArea::vector getSlotAreas ();69 SlotArea::vector getSlotAreas ();
6870
6971
=== modified file 'plugins/scale/src/scale.cpp'
--- plugins/scale/src/scale.cpp 2012-04-01 07:34:59 +0000
+++ plugins/scale/src/scale.cpp 2012-06-21 23:21:19 +0000
@@ -684,6 +684,47 @@
684bool684bool
685PrivateScaleScreen::layoutThumbs ()685PrivateScaleScreen::layoutThumbs ()
686{686{
687 switch (type) {
688 case ScaleTypeAll:
689 return layoutThumbsAll ();
690 case ScaleTypeNormal:
691 default:
692 return layoutThumbsSingle ();
693 }
694}
695
696bool
697PrivateScaleScreen::layoutThumbsAll ()
698{
699 windows.clear ();
700
701 /* add windows scale list, top most window first */
702 foreach (CompWindow *w, screen->windows ())
703 {
704 SCALE_WINDOW (w);
705
706 if (sw->priv->slot)
707 sw->priv->adjust = true;
708
709 sw->priv->slot = NULL;
710
711 if (!sw->priv->isScaleWin ())
712 continue;
713
714 windows.push_back (sw);
715 }
716
717 if (windows.empty ())
718 return false;
719
720 slots.resize (windows.size ());
721
722 return ScaleScreen::get (screen)->layoutSlotsAndAssignWindows ();
723}
724
725bool
726PrivateScaleScreen::layoutThumbsSingle ()
727{
687 bool ret = false;728 bool ret = false;
688 std::map <ScaleWindow *, ScaleSlot> slotWindows;729 std::map <ScaleWindow *, ScaleSlot> slotWindows;
689 CompWindowList allWindows;730 CompWindowList allWindows;

Subscribers

People subscribed via source and target branches