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

Proposed by Sam Spilsbury
Status: Superseded
Proposed branch: lp://qastaging/~smspillaz/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: 2200 lines (+1172/-648)
25 files modified
include/core/rect.h (+9/-0)
include/core/window.h (+5/-25)
plugins/CMakeLists.txt (+2/-0)
plugins/decor/src/decor.cpp (+0/-12)
plugins/move/src/move.cpp (+0/-8)
plugins/place/src/place.cpp (+4/-33)
src/CMakeLists.txt (+9/-3)
src/event.cpp (+25/-16)
src/privatewindow.h (+1/-2)
src/rect.cpp (+2/-1)
src/screen.cpp (+7/-5)
src/window.cpp (+401/-379)
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 (+72/-0)
src/window/geometry/src/windowgeometry.cpp (+1/-164)
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/fix_894633_geometry_saver_class
Reviewer Review Type Date Requested Status
Thomas Voß Needs Fixing
Thomi Richards (community) Approve
Review via email: mp+84056@code.qastaging.launchpad.net

This proposal has been superseded by a proposal from 2012-01-13.

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.
2900. By Sam Spilsbury

Added tests for GeometrySaver

2901. By Sam Spilsbury

Added test for compiz::window::Geometry

2902. By Sam Spilsbury

Added missing file

2903. By Sam Spilsbury

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

2904. By Sam Spilsbury

Update the window geometry test to cover that case

2905. By Sam Spilsbury

Merged fix-893567

2906. By Sam Spilsbury

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

2907. By Sam Spilsbury

Cleanup dead code

Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

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 :

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

Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

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 :

> 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).

2908. By Sam Spilsbury

Merge

2909. By Sam Spilsbury

Cleanup

2910. By Sam Spilsbury

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

Revision history for this message
Thomi Richards (thomir-deactivatedaccount) :
review: Approve
2911. By Sam Spilsbury

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

2912. By Sam Spilsbury

Merge

2913. By Sam Spilsbury

Migrated the window geometry tests to the new directory layout

2914. By Sam Spilsbury

Switch the geometry tests to Google Test

2915. By Sam Spilsbury

Added geometry includes to plugins list

2916. By Sam Spilsbury

Merge

2917. By Sam Spilsbury

Fix typo

Revision history for this message
Thomas Voß (thomas-voss) wrote :

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

review: Needs Fixing
2918. By Sam Spilsbury

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

2919. By Sam Spilsbury

Remove dead code

2920. By Sam Spilsbury

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

2921. By Sam Spilsbury

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

2922. By Sam Spilsbury

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

2923. By Sam Spilsbury

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

2924. By Sam Spilsbury

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

2925. By Sam Spilsbury

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

2926. By Sam Spilsbury

Remove unnecessary file in build

Unmerged revisions

2926. By Sam Spilsbury

Remove unnecessary file in build

2925. By Sam Spilsbury

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

2924. By Sam Spilsbury

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

2923. By Sam Spilsbury

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

2922. By Sam Spilsbury

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

2921. By Sam Spilsbury

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

2920. By Sam Spilsbury

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

2919. By Sam Spilsbury

Remove dead code

2918. By Sam Spilsbury

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

2917. By Sam Spilsbury

Fix typo

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