Merge lp://qastaging/~smspillaz/compiz-core/compiz-core.fix_894633_geometry_saver_class into lp://qastaging/compiz-core/0.9.5

Proposed by Sam Spilsbury
Status: Rejected
Rejected by: Sam Spilsbury
Proposed branch: lp://qastaging/~smspillaz/compiz-core/compiz-core.fix_894633_geometry_saver_class
Merge into: lp://qastaging/compiz-core/0.9.5
Prerequisite: lp://qastaging/~smspillaz/compiz-core/fix-timer-warnings-893998
Diff against target: 2174 lines (+1139/-624)
24 files modified
include/core/window.h (+4/-34)
plugins/CMakeLists.txt (+2/-0)
plugins/decor/src/decor.cpp (+1/-25)
plugins/move/src/move.cpp (+0/-10)
plugins/place/src/place.cpp (+4/-33)
src/CMakeLists.txt (+12/-16)
src/event.cpp (+25/-16)
src/privatewindow.h (+1/-2)
src/rect.cpp (+2/-0)
src/screen.cpp (+7/-5)
src/window.cpp (+373/-320)
src/window/CMakeLists.txt (+2/-0)
src/window/geometry-saver/CMakeLists.txt (+68/-0)
src/window/geometry-saver/include/core/windowgeometrysaver.h (+94/-0)
src/window/geometry-saver/src/geometrysaver.cpp (+75/-0)
src/window/geometry-saver/tests/test-window-geometry-saver.cpp (+26/-0)
src/window/geometry-saver/tests/test-window-geometry-saver.h (+39/-0)
src/window/geometry-saver/tests/window-geometry-saver/src/test-window-geometry-saver.cpp (+111/-0)
src/window/geometry/CMakeLists.txt (+65/-0)
src/window/geometry/include/core/windowgeometry.h (+73/-0)
src/window/geometry/src/windowgeometry.cpp (+1/-163)
src/window/geometry/tests/test-window-geometry.cpp (+26/-0)
src/window/geometry/tests/test-window-geometry.h (+39/-0)
src/window/geometry/tests/window-geometry/src/test-window-geometry.cpp (+89/-0)
To merge this branch: bzr merge lp://qastaging/~smspillaz/compiz-core/compiz-core.fix_894633_geometry_saver_class
Reviewer Review Type Date Requested Status
Thomas Voß Pending
Thomi Richards Pending
Review via email: mp+88489@code.qastaging.launchpad.net

This proposal supersedes a proposal from 2011-12-01.

Description of the change

This branch adds a new class GeometrySaver which handles selective geometry save / restore.

This was previously done by using the old XWindowChanges structure and change masks, but since we want to break the dependency with X in order to do things like unit testing, we need to use our own class.

GeometrySaver::push () will save some geometry specified by the change mask
GeometrySaver::pop () will write to the geoemtry the saved geometry specified by the change mask and returns the change mask of the actual restored geometry.
GeometrySaver::update () allows you to force-update already pushed geometry, eg, for viewport changes where a window is maximized.
GeoemtrySaver::get () will allow you to inspect the state of the GeoemtrySaver object without actually clearing the mask bits.

CompWindow::SyncPosition was removed.

Geometry related functions in CompWindow which were in windowgeometry.cpp were moved to window.cpp

Code snippits which might look like:

if (!(w->saveMask () & CWX))
{
    w->saveWc ().x = foo;
    w->saveMask () |= CWX;
}

were changed to

compiz::window::Geometry (foo, 0, 0, 0, 0);

saver.push (foo, CHANGE_X);

Added unit tests for compiz::window::Geometry and compiz::window::GeoemtrySaver

Next pipe: lp:~smspillaz/compiz-core/fix_894685

To post a comment you must log in.
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote : Posted in a previous version of this proposal

Hi,

A few notes:

First, I'm not qualified to ensure that your changes actually do what they're supposed to - I know next to nothing about Compiz, and, to be honest, the sight of the compiz code fills me with trepidation. What I *can* do is check for stylistic consistency, and point out any places in the public API where I feel a comment or two would help. My point is that we really need to get someone else who understands compiz to look at these branches.

window.h:
 * ln 219 - comments above preprocessor macros need to be Doxygen-style comments, like the others on the lines above.

 * In your Geometry class, the border() and setBorder() methods should be declared next to each other.

 * The unit tests for this class need to be landed as part of this merge, not later in the pipeline.

As a general rule, #defining things makes me nervous, but it's obviously the "compiz way", so you'd better stick with the established coding standards. I'm nervous because #define ignores all scoping rules.

composite.h:
 * ln 318 - need comment.
 * is it called positionOffset or paintOffset? The comment and the method name should be the same, whichever you pick.

privates.h:
 * ln 125 - need comment.

move.cpp:
 * ln 451 - don't comment out code - delete it. This looks especially odd when compared to the previous revision.

privatewindow.h:
 * ln 82 - it's not obvious to me what the difference is between configureXWindow and reconfigureXWindow - perhaps a comment explaining what the difference is?

That's it!

review: Needs Resubmitting
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote : Posted in a previous version of this proposal

Please ignore me - I posted my review to the wrong merge proposal.

Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote : Posted in a previous version of this proposal

include/core/windowgeometry.h:

Comments in GeometrySaver class should be doxygen comments - either start them with '///' or '/**' if you're using block comments.

plugins/place/src/place.cpp
You have two instances in this file of code being commented with with a 'XXX' label. If you don't need the code, delete it. At the very least tell us why it's commented out. If you're not sure whether you need the code or not, you need to find out before landing the merge.

src/windowgeometry.cpp
You have a comment that says:

/* XXX: Do not allow geometry to be saved if window
 * has not been placed */

Is this something that needs to be fixed before this lands?

You also have this interesting logic within the push(...) method:

unsigned int useMask = mask & ~mMask;
mMask |= useMask;

Perhaps I'm being dense, but surely this is the same as "mMask |= mask" ?

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

> include/core/windowgeometry.h:
>
> Comments in GeometrySaver class should be doxygen comments - either start them
> with '///' or '/**' if you're using block comments.
>

+1

> plugins/place/src/place.cpp
> You have two instances in this file of code being commented with with a 'XXX'
> label. If you don't need the code, delete it. At the very least tell us why
> it's commented out. If you're not sure whether you need the code or not, you
> need to find out before landing the merge.
>

+1

> src/windowgeometry.cpp
> You have a comment that says:
>
> /* XXX: Do not allow geometry to be saved if window
> * has not been placed */
>
> Is this something that needs to be fixed before this lands?
>

fixed

> You also have this interesting logic within the push(...) method:
>
> unsigned int useMask = mask & ~mMask;
> mMask |= useMask;
>
> Perhaps I'm being dense, but surely this is the same as "mMask |= mask" ?

useMask is the return value here to indicate which bits were actually pushed (eg the class doesn't allow you to overwrite some saved geometry with the push () method).

Revision history for this message
Thomi Richards (thomir-deactivatedaccount) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Thomas Voß (thomas-voss) wrote : Posted in a previous version of this proposal

Looks good to me except for unnecessary custom c'tors and d'tors in the test fixtures.

review: Needs Fixing
2931. By Sam Spilsbury

Fix merge

2932. By Sam Spilsbury

Merge

2933. By Sam Spilsbury

Merged fix-timer-warnings-893998 into compiz-core.fix_894633_geometry_saver_class.

2934. By Sam Spilsbury

Merged fix-timer-warnings-893998 into compiz-core.fix_894633_geometry_saver_class.

2935. By Sam Spilsbury

Merged fix-timer-warnings-893998 into compiz-core.fix_894633_geometry_saver_class.

2936. By Sam Spilsbury

Merged fix-timer-warnings-893998 into compiz-core.fix_894633_geometry_saver_class.

2937. By Sam Spilsbury

Merged fix-timer-warnings-893998 into compiz-core.fix_894633_geometry_saver_class.

2938. By Sam Spilsbury

Merge

2939. By Sam Spilsbury

Fix warning

2940. By Sam Spilsbury

Fix more warnings

2941. By Sam Spilsbury

Merged fix-timer-warnings-893998 into compiz-core.fix_894633_geometry_saver_class.

Unmerged revisions

2941. By Sam Spilsbury

Merged fix-timer-warnings-893998 into compiz-core.fix_894633_geometry_saver_class.

2940. By Sam Spilsbury

Fix more warnings

2939. By Sam Spilsbury

Fix warning

2938. By Sam Spilsbury

Merge

2937. By Sam Spilsbury

Merged fix-timer-warnings-893998 into compiz-core.fix_894633_geometry_saver_class.

2936. By Sam Spilsbury

Merged fix-timer-warnings-893998 into compiz-core.fix_894633_geometry_saver_class.

2935. By Sam Spilsbury

Merged fix-timer-warnings-893998 into compiz-core.fix_894633_geometry_saver_class.

2934. By Sam Spilsbury

Merged fix-timer-warnings-893998 into compiz-core.fix_894633_geometry_saver_class.

2933. By Sam Spilsbury

Merged fix-timer-warnings-893998 into compiz-core.fix_894633_geometry_saver_class.

2932. By Sam Spilsbury

Merge

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