Merge lp://qastaging/~compiz-team/compiz/compiz.fix_1008020 into lp://qastaging/compiz/0.9.8

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 3259
Proposed branch: lp://qastaging/~compiz-team/compiz/compiz.fix_1008020
Merge into: lp://qastaging/compiz/0.9.8
Diff against target: 255 lines (+55/-21)
9 files modified
include/core/abiversion.h (+1/-1)
include/core/screen.h (+2/-1)
include/core/window.h (+1/-0)
src/event.cpp (+10/-2)
src/privatescreen.h (+4/-2)
src/privatescreen/tests/test-privatescreen.cpp (+2/-1)
src/privatewindow.h (+1/-1)
src/screen.cpp (+24/-7)
src/window.cpp (+10/-6)
To merge this branch: bzr merge lp://qastaging/~compiz-team/compiz/compiz.fix_1008020
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
Robert Carr testing Pending
Tim Penhey Pending
Andrea Cimitan Pending
Review via email: mp+111146@code.qastaging.launchpad.net

This proposal supersedes a proposal from 2012-06-18.

Description of the change

Don't insert the window into the server list above the window it was
  created above.

  The server list might have been modified by the time that we process the
  create event, and as such there is a case where a window can be inserted
  into the server list above another window and not at the top (the default
  for where windows are created) if that window is pending a restack.

  When updateAttributes is called later, putting it above the correct window
  will silently fail, because it is already there in the server list, even
  though a restack was never issued to put it there.

  (LP: #1008020) (LP: #886605)

We really need to do something about the fact that the stacking code is not under test. An email was sent about smoke testing window stacking for now until we can get some kind of sensible unit testing story.

I tested this against lp:~smspillaz/+junk/stackingtest (using proc test-stacking-ops which creates tons of new windows and reshuffles them, excersizing this code). Nothing went above panels or screensavers after the fixes were applied.

Case from bug 1008020 that I know this fixed:

1. Log in to unity-2d or gnome-classic
2. kill unity-2d-shell (so just the panel remains)
3. Open nautilus and repeatedly hit Ctrl-N to create a new window really quickly
4. Windows will eventually go above the panel

To post a comment you must log in.
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Using stackingtest in a loop, I find windows appear over the top of the lock screen even with this fix. But only when using the animation plugin. Is that still what's being fixed here or a different issue?

I see exactly the same stacking behaviour with and without this fix...

review: Needs Information
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Also, there's a trivial conflict in abiversion.h.

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Could be a different issue. There is no conflict in abiversion.h according to lp

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

(Have a look at bug 1008020 for the case that I can absolutely confirm this fixes, I wasn't sure if the screen lock one and this one were related as I can't reproduce it anyways [I hate these race conditions])

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

> Using stackingtest in a loop, I find windows appear over the top of the lock
> screen even with this fix. But only when using the animation plugin. Is that
> still what's being fixed here or a different issue?
>
> I see exactly the same stacking behaviour with and without this fix...

A small question here: Do the windows appear temporarily on top of the lockscreen, or do they go away quickly? I know that we're supposed to create windows on top of fullscreen windows and it is the job of the fullscreen window to request that it goes on top of the other windows in that case.

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

As far as I can tell, only the open/close animations are visible over the lock screen.

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

In that case, there is no stacking bug (but a bug in the animation plugin for sure)

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

(What happens if you turn down the speed of the animations too)

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

I updated the description with the case I know this fixes for sure. We can unlinkbug 886605 if appropriate. I'd like to get feedback from cimi and racarr on that since they have macbook airs that can reproduce this.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal

There is a trivial conflict in abiversion.h

Also, as list::size() can be O(N)

117 + if (serverWindows.size ())

Should be:

117 + if (!serverWindows.empty ())

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

I think we should be making new functions as useful as possible. That means returning CompWindow* instead of Window (None --> NULL):
  Window cps::WindowManager::getTopServerWindow()

If you just return Window and actually want a CompWindow then you have to waste CPU and more lines of code looking it up again.

review: Needs Fixing
Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

There is no CPU wastage since it hits the cached last found window. Im amy case the function cab be changed

Sent from Samsung Mobile

 Daniel van Vugt <email address hidden> wrote:

null

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

I'm not talking about this proposal. I mean potential wastage for anyone else trying to use the function in future.

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

To be honest, we should move getTopWindow and getTopServerWindow to a more private place too.

Sent from Samsung Mobile

 Daniel van Vugt <email address hidden> wrote:

I'm not talking about this proposal. I mean potential wastage for anyone else trying to use the function in future.
--
https://code.launchpad.net/~compiz-team/compiz/compiz.fix_1008020/+merge/109758
Your team Compiz Maintainers is subscribed to branch lp:compiz.

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

I don't see any problems running this branch. But I also still can't reproduce any of the bugs we're aiming to fix here. So can't really verify the fixes.

Just some notes on style:
You have inconsistent use of white space in function (calls). Sometimes there's a space, sometimes not. I think we should switch to no white space like most coding conventions do: function(calls).

review: Approve
Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Compiz coding style has always had a space between the caller and the brackets. i'd prefer to keep it that way

Sent from Samsung Mobile

 Daniel van Vugt <email address hidden> wrote:

Review: Approve

I don't see any problems running this branch. But I also still can't reproduce any of the bugs we're aiming to fix here. So can't really verify the fixes.

Just some notes on style:
You have inconsistent use of white space in function (calls). Sometimes there's a space, sometimes not. I think we should switch to no white space like most coding conventions do: function(calls).

--
https://code.launchpad.net/~compiz-team/compiz/compiz.fix_1008020/+merge/110724
Your team Compiz Maintainers is subscribed to branch lp:compiz.

Revision history for this message
Tim Penhey (thumper) wrote : Posted in a previous version of this proposal

You have functions that may return null pointers, and call sites where you are dereferencing without checking.

Something should be done there.

review: Needs Fixing
Revision history for this message
Tim Penhey (thumper) wrote : Posted in a previous version of this proposal

I suggest something like:

inline Window window_from_compwindow(CompWindow* win)
{
  return win ? win->id () : None;
}

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

> I suggest something like:
>
> inline Window window_from_compwindow(CompWindow* win)
> {
> return win ? win->id () : None;
> }

Thanks, will do

Revision history for this message
Tim Penhey (thumper) wrote : Posted in a previous version of this proposal

Line 71 also needs the function treatment.

> PrivateWindow::createCompWindow (i ? children[i - 1] : 0, i ? children[i - 1] : 0, attrib, children[i]);

This is fugly.

Please do something the equivalent of:

CompWindow* top_window_id = i ? children[i - 1] : 0;
PrivateWindow::createCompWindow (top_window_id, top_window_id, attrib, children[i]);

If you had the CompWindowToWindow function defined in a header, you could use it in src/window.cpp instead of implementing the logic again.

review: Needs Fixing
Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

> Line 71 also needs the function treatment.
>
> > PrivateWindow::createCompWindow (i ? children[i - 1] : 0, i ? children[i -
> 1] : 0, attrib, children[i]);
>
> This is fugly.
>
> Please do something the equivalent of:
>
> CompWindow* top_window_id = i ? children[i - 1] : 0;
> PrivateWindow::createCompWindow (top_window_id, top_window_id, attrib,
> children[i]);
>

It is not a CompWindow*, but I will still do

Window topWindowId = i ? children[i - 1] : 0;

> If you had the CompWindowToWindow function defined in a header, you could use
> it in src/window.cpp instead of implementing the logic again.

I do not like functions in headers, changing them means rebuilding everything that includes that header.

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Remember to use "None" instead of "0". :)

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

0 == none but I can change it.

Sent from Samsung Mobile

 Daniel van Vugt <email address hidden> wrote:

Remember to use "None" instead of "0". :)
--
https://code.launchpad.net/~compiz-team/compiz/compiz.fix_1008020/+merge/110724
Your team Compiz Maintainers is subscribed to branch lp:compiz.

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

Looks good, works well, though I still can't reproduce the bugs.

Ideally, CompWindowToWindow (CompWindow *window) would be CompWindowToWindow (const CompWindow *window). But I know that's not possible because CompWindow::id() is not const (!)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches