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

Proposed by Sam Spilsbury
Status: Superseded
Proposed branch: lp:~smspillaz/compiz-core/fix_894633_geometry_saver_class
Merge into: lp:compiz-core/0.9.5
Prerequisite: lp:~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:~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.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
=== modified file 'include/core/rect.h'
--- include/core/rect.h 2011-03-16 19:39:09 +0000
+++ include/core/rect.h 2012-01-11 08:47:28 +0000
@@ -26,6 +26,15 @@
26#ifndef _COMPRECT_H26#ifndef _COMPRECT_H
27#define _COMPRECT_H27#define _COMPRECT_H
2828
29#include <core/point.h>
30#include <core/size.h>
31#include <vector>
32#include <list>
33#include <X11/Xlib.h>
34#include <X11/Xutil.h>
35#include <X11/Xregion.h>
36
37
29/**38/**
30 * A 2D rectangle, which is likely in screen space. It's data is39 * A 2D rectangle, which is likely in screen space. It's data is
31 * isolated and can only be mutated with set() methods.40 * isolated and can only be mutated with set() methods.
3241
=== modified file 'include/core/window.h'
--- include/core/window.h 2012-01-11 08:47:27 +0000
+++ include/core/window.h 2012-01-11 08:47:28 +0000
@@ -41,6 +41,8 @@
41#include <core/size.h>41#include <core/size.h>
42#include <core/point.h>42#include <core/point.h>
43#include <core/region.h>43#include <core/region.h>
44#include <core/windowgeometry.h>
45#include <core/windowgeometrysaver.h>
4446
45#include <core/wrapsystem.h>47#include <core/wrapsystem.h>
4648
@@ -241,31 +243,9 @@
241 */243 */
242static const unsigned int ConstrainPositionVirtualScreen (1 << 2);244static const unsigned int ConstrainPositionVirtualScreen (1 << 2);
243245
244/**246
245 * A mutable object about the dimensions and location of a CompWindow.247}
246 */248}
247class Geometry :
248 public CompRect
249{
250public:
251 Geometry ();
252 Geometry (int x, int y, int width, int height, int border);
253
254 int border () const;
255 void setBorder (int border);
256
257 void set (int x, int y, int width, int height, int border);
258
259 unsigned int changeMask (const compiz::window::Geometry &g) const;
260 void applyChange (const compiz::window::Geometry &g, unsigned int mask);
261
262private:
263 int mBorder;
264};
265
266}
267}
268
269/**249/**
270 * Wrappable core window functions. Derive from this class250 * Wrappable core window functions. Derive from this class
271 * and overload these functions in order to have your function called251 * and overload these functions in order to have your function called
272252
=== modified file 'plugins/CMakeLists.txt'
--- plugins/CMakeLists.txt 2012-01-11 08:47:27 +0000
+++ plugins/CMakeLists.txt 2012-01-11 08:47:28 +0000
@@ -15,6 +15,8 @@
15 ${CMAKE_CURRENT_SOURCE_DIR}/../src/string/include15 ${CMAKE_CURRENT_SOURCE_DIR}/../src/string/include
16 ${CMAKE_CURRENT_SOURCE_DIR}/../src/pluginclasshandler/include16 ${CMAKE_CURRENT_SOURCE_DIR}/../src/pluginclasshandler/include
17 ${CMAKE_CURRENT_SOURCE_DIR}/../src/logmessage/include17 ${CMAKE_CURRENT_SOURCE_DIR}/../src/logmessage/include
18 ${CMAKE_CURRENT_SOURCE_DIR}/../src/window/geometry/include
19 ${CMAKE_CURRENT_SOURCE_DIR}/../src/window/geometry-saver/include
18)20)
1921
20compiz_add_plugins_in_folder (${CMAKE_CURRENT_SOURCE_DIR})22compiz_add_plugins_in_folder (${CMAKE_CURRENT_SOURCE_DIR})
2123
=== modified file 'plugins/decor/src/decor.cpp'
--- plugins/decor/src/decor.cpp 2012-01-11 08:47:27 +0000
+++ plugins/decor/src/decor.cpp 2012-01-11 08:47:28 +0000
@@ -1588,12 +1588,6 @@
1588 if (window->state () & CompWindowStateMaximizedVertMask)1588 if (window->state () & CompWindowStateMaximizedVertMask)
1589 mask &= ~CHANGE_Y;1589 mask &= ~CHANGE_Y;
15901590
1591 if (window->saveMask () & CWX)
1592 window->saveWc ().x += moveDx;
1593
1594 if (window->saveMask () & CWY)
1595 window->saveWc ().y += moveDy;
1596
1597 if (mask)1591 if (mask)
1598 {1592 {
1599 /* allowDecoration is only false in the case of1593 /* allowDecoration is only false in the case of
@@ -2826,12 +2820,6 @@
2826 moveDx = shiftX () - oldShiftX;2820 moveDx = shiftX () - oldShiftX;
2827 moveDy = shiftY () - oldShiftY;2821 moveDy = shiftY () - oldShiftY;
28282822
2829 if (window->saveMask () & CWX)
2830 window->saveWc ().x += moveDx;
2831
2832 if (window->saveMask () & CWY)
2833 window->saveWc ().y += moveDy;
2834
2835 updateFrame ();2823 updateFrame ();
2836 }2824 }
28372825
28382826
=== modified file 'plugins/move/src/move.cpp'
--- plugins/move/src/move.cpp 2012-01-11 08:47:27 +0000
+++ plugins/move/src/move.cpp 2012-01-11 08:47:28 +0000
@@ -419,14 +419,6 @@
419 {419 {
420 int width = w->serverGeometry ().width ();420 int width = w->serverGeometry ().width ();
421421
422 w->saveMask () |= CWX | CWY;
423
424 if (w->saveMask ()& CWWidth)
425 width = w->saveWc ().width;
426
427 w->saveWc ().x = xRoot - (width >> 1);
428 w->saveWc ().y = yRoot + (w->border ().top >> 1);
429
430 ms->x = ms->y = 0;422 ms->x = ms->y = 0;
431423
432 w->maximize (0);424 w->maximize (0);
433425
=== modified file 'plugins/place/src/place.cpp'
--- plugins/place/src/place.cpp 2012-01-11 08:47:27 +0000
+++ plugins/place/src/place.cpp 2012-01-11 08:47:28 +0000
@@ -110,22 +110,13 @@
110 pivotX = winRect.x ();110 pivotX = winRect.x ();
111 pivotY = winRect.y ();111 pivotY = winRect.y ();
112112
113 /* FIXME: used the saved geometry for windows that are maximized
114 * or fullscreen to determine which screen or viewport they actually
115 * lie on */
113 if (w->type () & CompWindowTypeFullscreenMask ||116 if (w->type () & CompWindowTypeFullscreenMask ||
114 (w->state () & (CompWindowStateMaximizedVertMask |117 (w->state () & (CompWindowStateMaximizedVertMask |
115 CompWindowStateMaximizedHorzMask)))118 CompWindowStateMaximizedHorzMask)))
116 {119 {
117 if (w->saveMask () & CWX)
118 winRect.setX (w->saveWc ().x);
119
120 if (w->saveMask () & CWY)
121 winRect.setY (w->saveWc ().y);
122
123 if (w->saveMask () & CWWidth)
124 winRect.setWidth (w->saveWc ().width);
125
126 if (w->saveMask () & CWHeight)
127 winRect.setHeight (w->saveWc ().height);
128
129 pivotX = pw->mPrevServer.x ();120 pivotX = pw->mPrevServer.x ();
130 pivotY = pw->mPrevServer.y ();121 pivotY = pw->mPrevServer.y ();
131 }122 }
@@ -237,31 +228,11 @@
237 if (firstPass) /* if first pass, don't actually move the window */228 if (firstPass) /* if first pass, don't actually move the window */
238 continue;229 continue;
239230
240 /* for maximized/fullscreen windows, update saved pos/size */231 /* for maximized/fullscreen windows, update saved pos/size XXX */
241 if (w->type () & CompWindowTypeFullscreenMask ||232 if (w->type () & CompWindowTypeFullscreenMask ||
242 (w->state () & (CompWindowStateMaximizedVertMask |233 (w->state () & (CompWindowStateMaximizedVertMask |
243 CompWindowStateMaximizedHorzMask)))234 CompWindowStateMaximizedHorzMask)))
244 {235 {
245 if (mask & CWX)
246 {
247 w->saveWc ().x = xwc.x;
248 w->saveMask () |= CWX;
249 }
250 if (mask & CWY)
251 {
252 w->saveWc ().y = xwc.y;
253 w->saveMask () |= CWY;
254 }
255 if (mask & CWWidth)
256 {
257 w->saveWc ().width = xwc.width;
258 w->saveMask () |= CWWidth;
259 }
260 if (mask & CWHeight)
261 {
262 w->saveWc ().height = xwc.height;
263 w->saveMask () |= CWHeight;
264 }
265236
266 if (w->type () & CompWindowTypeFullscreenMask)237 if (w->type () & CompWindowTypeFullscreenMask)
267 {238 {
268239
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2011-12-23 06:44:28 +0000
+++ src/CMakeLists.txt 2012-01-11 08:47:28 +0000
@@ -5,6 +5,7 @@
5add_subdirectory( logmessage )5add_subdirectory( logmessage )
6add_subdirectory( timer )6add_subdirectory( timer )
7add_subdirectory( pluginclasshandler )7add_subdirectory( pluginclasshandler )
8add_subdirectory( window )
89
9compiz_add_bcop_targets (10compiz_add_bcop_targets (
10 core11 core
@@ -39,7 +40,12 @@
39 40
40 ${CMAKE_CURRENT_SOURCE_DIR}/pluginclasshandler/include41 ${CMAKE_CURRENT_SOURCE_DIR}/pluginclasshandler/include
41 ${CMAKE_CURRENT_SOURCE_DIR}/pluginclasshandler/src42 ${CMAKE_CURRENT_SOURCE_DIR}/pluginclasshandler/src
42 43
44 ${CMAKE_CURRENT_SOURCE_DIR}/window/geometry-saver/include
45 ${CMAKE_CURRENT_SOURCE_DIR}/window/geometry-saver/src
46
47 ${CMAKE_CURRENT_SOURCE_DIR}/window/geometry/include
48 ${CMAKE_CURRENT_SOURCE_DIR}/window/geometry/src
43)49)
4450
45add_definitions (51add_definitions (
@@ -72,10 +78,8 @@
72 ${CMAKE_CURRENT_SOURCE_DIR}/plugin.cpp78 ${CMAKE_CURRENT_SOURCE_DIR}/plugin.cpp
73 ${CMAKE_CURRENT_SOURCE_DIR}/session.cpp79 ${CMAKE_CURRENT_SOURCE_DIR}/session.cpp
74 ${CMAKE_CURRENT_SOURCE_DIR}/output.cpp80 ${CMAKE_CURRENT_SOURCE_DIR}/output.cpp
75 ${CMAKE_CURRENT_SOURCE_DIR}/rect.cpp
76 ${CMAKE_CURRENT_SOURCE_DIR}/size.cpp81 ${CMAKE_CURRENT_SOURCE_DIR}/size.cpp
77 ${CMAKE_CURRENT_SOURCE_DIR}/point.cpp82 ${CMAKE_CURRENT_SOURCE_DIR}/point.cpp
78 ${CMAKE_CURRENT_SOURCE_DIR}/windowgeometry.cpp
79 ${CMAKE_CURRENT_SOURCE_DIR}/icon.cpp83 ${CMAKE_CURRENT_SOURCE_DIR}/icon.cpp
80 ${CMAKE_CURRENT_SOURCE_DIR}/modifierhandler.cpp84 ${CMAKE_CURRENT_SOURCE_DIR}/modifierhandler.cpp
81 ${CMAKE_CURRENT_SOURCE_DIR}/propertywriter.cpp85 ${CMAKE_CURRENT_SOURCE_DIR}/propertywriter.cpp
@@ -103,6 +107,8 @@
103 compiz_timer107 compiz_timer
104 compiz_logmessage108 compiz_logmessage
105 compiz_pluginclasshandler109 compiz_pluginclasshandler
110 compiz_window_geometry
111 compiz_window_geometry_saver
106# ${CORE_MOD_LIBRARIES}112# ${CORE_MOD_LIBRARIES}
107)113)
108114
109115
=== modified file 'src/event.cpp'
--- src/event.cpp 2012-01-11 08:47:27 +0000
+++ src/event.cpp 2012-01-11 08:47:28 +0000
@@ -1579,9 +1579,9 @@
1579 {1579 {
1580 compiz::window::Geometry g = w->serverGeometry ();1580 compiz::window::Geometry g = w->serverGeometry ();
1581 compiz::window::Geometry ng = compiz::window::Geometry (event->xclient.data.l[1],1581 compiz::window::Geometry ng = compiz::window::Geometry (event->xclient.data.l[1],
1582 event->xclient.data.l[2],1582 event->xclient.data.l[2],
1583 event->xclient.data.l[3],1583 event->xclient.data.l[3],
1584 event->xclient.data.l[4], 0);1584 event->xclient.data.l[4], 0);
1585 int gravity;1585 int gravity;
1586 int value_mask;1586 int value_mask;
1587 unsigned int source;1587 unsigned int source;
@@ -1726,12 +1726,20 @@
1726 if (w && w->managed ())1726 if (w && w->managed ())
1727 {1727 {
1728 compiz::window::Geometry g (event->xconfigurerequest.x,1728 compiz::window::Geometry g (event->xconfigurerequest.x,
1729 event->xconfigurerequest.y,1729 event->xconfigurerequest.y,
1730 event->xconfigurerequest.width,1730 event->xconfigurerequest.width,
1731 event->xconfigurerequest.height,1731 event->xconfigurerequest.height,
1732 event->xconfigurerequest.border_width);1732 event->xconfigurerequest.border_width);
17331733
1734 w->position (g, event->xconfigurerequest.value_mask, ClientTypeUnknown);1734 /* Revert unset bits to serverGeometry */
1735
1736 g.applyChange (w->priv->serverGeometry, ~event->xconfigurerequest.value_mask);
1737
1738 /* Use the moveResize logic here */
1739 w->priv->moveResize (g,
1740 event->xconfigurerequest.value_mask,
1741 0,
1742 ClientTypeUnknown);
17351743
1736 if (event->xconfigurerequest.value_mask & CWStackMode)1744 if (event->xconfigurerequest.value_mask & CWStackMode)
1737 {1745 {
@@ -1794,13 +1802,14 @@
1794 * to being not override redirect */1802 * to being not override redirect */
1795 w->priv->setOverrideRedirect (false);1803 w->priv->setOverrideRedirect (false);
17961804
1797 compiz::window::Geometry g = w->geometry ();1805 compiz::window::Geometry g = (compiz::window::Geometry (xwc.x,
17981806 xwc.y,
1799 g.applyChange (compiz::window::Geometry (xwc.x,1807 xwc.width,
1800 xwc.y,1808 xwc.height,
1801 xwc.width,1809 xwc.border_width));
1802 xwc.height,1810
1803 xwc.border_width), xwcm);1811 g.applyChange (w->priv->serverGeometry, ~xwcm);
1812
1804 w->position (g);1813 w->position (g);
1805 }1814 }
1806 else1815 else
18071816
=== modified file 'src/privatewindow.h'
--- src/privatewindow.h 2012-01-11 08:47:27 +0000
+++ src/privatewindow.h 2012-01-11 08:47:28 +0000
@@ -339,8 +339,7 @@
339339
340 CompRect iconGeometry;340 CompRect iconGeometry;
341341
342 XWindowChanges saveWc;342 compiz::window::GeometrySaver geometrySaver;
343 int saveMask;
344343
345 XSyncCounter syncCounter;344 XSyncCounter syncCounter;
346 XSyncValue syncValue;345 XSyncValue syncValue;
347346
=== modified file 'src/rect.cpp'
--- src/rect.cpp 2011-03-16 19:39:09 +0000
+++ src/rect.cpp 2012-01-11 08:47:28 +0000
@@ -23,7 +23,8 @@
23 * Authors: Dennis Kasprzyk <onestone@compiz-fusion.org>23 * Authors: Dennis Kasprzyk <onestone@compiz-fusion.org>
24 */24 */
2525
26#include <core/core.h>26#include <X11/Xlib.h>
27#include <X11/Xregion.h>
27#include <core/rect.h>28#include <core/rect.h>
2829
29CompRect::CompRect ()30CompRect::CompRect ()
3031
=== modified file 'src/screen.cpp'
--- src/screen.cpp 2012-01-11 08:47:27 +0000
+++ src/screen.cpp 2012-01-11 08:47:28 +0000
@@ -3522,17 +3522,19 @@
3522 {3522 {
3523 unsigned int valueMask = CWX | CWY;3523 unsigned int valueMask = CWX | CWY;
3524 XWindowChanges xwc;3524 XWindowChanges xwc;
3525 compiz::window::Geometry saved;
35253526
3526 if (w->onAllViewports ())3527 if (w->onAllViewports ())
3527 continue;3528 continue;
35283529
3529 pnt = w->getMovementForOffset (CompPoint (tx, ty));3530 pnt = w->getMovementForOffset (CompPoint (tx, ty));
35303531
3531 if (w->saveMask () & CWX)3532 unsigned int saveMask = w->priv->geometrySaver.get (saved) & (CHANGE_X |
3532 w->saveWc ().x += pnt.x ();3533 CHANGE_Y);
35333534
3534 if (w->saveMask () & CWY)3535 saved.setPos (saved.pos () + pnt);
3535 w->saveWc ().y += pnt.y ();3536
3537 w->priv->geometrySaver.update (saved, saveMask);
35363538
3537 xwc.x = w->serverGeometry ().x () + pnt.x ();3539 xwc.x = w->serverGeometry ().x () + pnt.x ();
3538 xwc.y = w->serverGeometry ().y () + pnt.y ();3540 xwc.y = w->serverGeometry ().y () + pnt.y ();
35393541
=== added directory 'src/window'
=== modified file 'src/window.cpp'
--- src/window.cpp 2012-01-11 08:47:27 +0000
+++ src/window.cpp 2012-01-11 08:47:28 +0000
@@ -2445,62 +2445,6 @@
2445{2445{
2446}2446}
24472447
2448void
2449PrivateWindow::syncPosition ()
2450{
2451 gettimeofday (&priv->lastConfigureRequest, NULL);
2452
2453 unsigned int valueMask = CWX | CWY;
2454 XWindowChanges xwc;
2455
2456 if (priv->pendingPositionUpdates && !priv->pendingConfigures.pending ())
2457 {
2458 if (priv->serverFrameGeometry.x () == priv->frameGeometry.x ())
2459 valueMask &= ~(CWX);
2460 if (priv->serverFrameGeometry.y () == priv->frameGeometry.y ())
2461 valueMask &= ~(CWY);
2462
2463 /* Because CompWindow::move can update the geometry last
2464 * received from the server, we must indicate that no values
2465 * changed, because when the ConfigureNotify comes around
2466 * the values are going to be the same. That's obviously
2467 * broken behaviour and worthy of a FIXME, but requires
2468 * larger changes to the window movement system. */
2469 if (valueMask)
2470 {
2471 priv->serverGeometry.setX (priv->geometry.x ());
2472 priv->serverGeometry.setY (priv->geometry.y ());
2473 priv->serverFrameGeometry.setX (priv->frameGeometry.x ());
2474 priv->serverFrameGeometry.setY (priv->frameGeometry.y ());
2475
2476 xwc.x = priv->serverFrameGeometry.x ();
2477 xwc.y = priv->serverFrameGeometry.y ();
2478
2479 compiz::X11::PendingEvent::Ptr pc =
2480 boost::shared_static_cast<compiz::X11::PendingEvent> (compiz::X11::PendingConfigureEvent::Ptr (
2481 new compiz::X11::PendingConfigureEvent (
2482 screen->dpy (), priv->serverFrame, 0, &xwc)));
2483
2484 priv->pendingConfigures.add (pc);
2485
2486 /* Got 3 seconds to get its stuff together */
2487 if (priv->mClearCheckTimeout.active ())
2488 priv->mClearCheckTimeout.stop ();
2489 priv->mClearCheckTimeout.start (boost::bind (&PrivateWindow::checkClear, priv),
2490 2000, 2500);
2491 XConfigureWindow (screen->dpy (), ROOTPARENT (window), valueMask, &xwc);
2492
2493 if (priv->serverFrame)
2494 {
2495 XMoveWindow (screen->dpy (), priv->wrapper,
2496 priv->serverInput.left, priv->serverInput.top);
2497 window->sendConfigureNotify ();
2498 }
2499 }
2500 priv->pendingPositionUpdates = false;
2501 }
2502}
2503
2504bool2448bool
2505CompWindow::focus ()2449CompWindow::focus ()
2506{2450{
@@ -2612,6 +2556,8 @@
2612 XWindowChanges xwc;2556 XWindowChanges xwc;
2613 CompPoint dp = g.pos () - priv->serverGeometry.pos ();2557 CompPoint dp = g.pos () - priv->serverGeometry.pos ();
26142558
2559 memset (&xwc, sizeof (XWindowChanges), 0);
2560
2615 xwc.x = g.x ();2561 xwc.x = g.x ();
2616 xwc.y = g.y ();2562 xwc.y = g.y ();
2617 xwc.width = g.width ();2563 xwc.width = g.width ();
@@ -3250,81 +3196,165 @@
3250 return false;3196 return false;
3251}3197}
32523198
3253void3199const compiz::window::Geometry &
3254PrivateWindow::saveGeometry (int mask)3200CompWindow::serverGeometry () const
3255{3201{
3256 int m = mask & ~saveMask;3202 return priv->serverGeometry;
32573203}
3258 /* only save geometry if window has been placed */3204
3259 if (!placed)3205const compiz::window::Geometry &
3260 return;3206CompWindow::geometry () const
32613207{
3262 if (m & CWX)3208 return priv->geometry;
3263 saveWc.x = serverGeometry.x ();3209}
32643210
3265 if (m & CWY)3211int
3266 saveWc.y = serverGeometry.y ();3212CompWindow::x () const
32673213{
3268 if (m & CWWidth)3214 return priv->geometry.x ();
3269 saveWc.width = serverGeometry.width ();3215}
32703216
3271 if (m & CWHeight)3217int
3272 saveWc.height = serverGeometry.height ();3218CompWindow::y () const
32733219{
3274 if (m & CWBorderWidth)3220 return priv->geometry.y ();
3275 saveWc.border_width = serverGeometry.border ();3221}
32763222
3277 saveMask |= m;3223CompPoint
3278}3224CompWindow::pos () const
32793225{
3280int3226 return CompPoint (priv->geometry.x (), priv->geometry.y ());
3281PrivateWindow::restoreGeometry (XWindowChanges *xwc,3227}
3282 int mask)3228
3283{3229/* With border */
3284 int m = mask & saveMask;3230int
32853231CompWindow::width () const
3286 if (m & CWX)3232{
3287 xwc->x = saveWc.x;3233 return priv->width +
32883234 priv->geometry.border () * 2;
3289 if (m & CWY)3235}
3290 xwc->y = saveWc.y;3236
32913237int
3292 if (m & CWWidth)3238CompWindow::height () const
3293 {3239{
3294 xwc->width = saveWc.width;3240 return priv->height +
32953241 priv->geometry.border () * 2;;
3296 /* This is not perfect but it works OK for now. If the saved width is3242}
3297 the same as the current width then make it a little be smaller so3243
3298 the user can see that it changed and it also makes sure that3244CompSize
3299 windowResizeNotify is called and plugins are notified. */3245CompWindow::size () const
3300 if (xwc->width == (int) serverGeometry.width ())3246{
3301 {3247 return CompSize (priv->width + priv->geometry.border () * 2,
3302 xwc->width -= 10;3248 priv->height + priv->geometry.border () * 2);
3303 if (m & CWX)3249}
3304 xwc->x += 5;3250
3305 }3251int
3306 }3252CompWindow::serverX () const
33073253{
3308 if (m & CWHeight)3254 return priv->serverGeometry.x ();
3309 {3255}
3310 xwc->height = saveWc.height;3256
33113257int
3312 /* As above, if the saved height is the same as the current height3258CompWindow::serverY () const
3313 then make it a little be smaller. */3259{
3314 if (xwc->height == (int) serverGeometry.height ())3260 return priv->serverGeometry.y ();
3315 {3261}
3316 xwc->height -= 10;3262
3317 if (m & CWY)3263CompPoint
3318 xwc->y += 5;3264CompWindow::serverPos () const
3319 }3265{
3320 }3266 return CompPoint (priv->serverGeometry.x (),
33213267 priv->serverGeometry.y ());
3322 if (m & CWBorderWidth)3268}
3323 xwc->border_width = saveWc.border_width;3269
33243270/* With border */
3325 saveMask &= ~mask;3271int
33263272CompWindow::serverWidth () const
3327 return m;3273{
3274 return priv->serverGeometry.width () +
3275 2 * priv->serverGeometry.border ();
3276}
3277
3278int
3279CompWindow::serverHeight () const
3280{
3281 return priv->serverGeometry.height () +
3282 2 * priv->serverGeometry.border ();
3283}
3284
3285const CompSize
3286CompWindow::serverSize () const
3287{
3288 return CompSize (priv->serverGeometry.width () +
3289 2 * priv->serverGeometry.border (),
3290 priv->serverGeometry.height () +
3291 2 * priv->serverGeometry.border ());
3292}
3293
3294CompRect
3295CompWindow::borderRect () const
3296{
3297 return CompRect (priv->geometry.x () - priv->geometry.border () - priv->border.left,
3298 priv->geometry.y () - priv->geometry.border () - priv->border.top,
3299 priv->geometry.width () + priv->geometry.border () * 2 +
3300 priv->border.left + priv->border.right,
3301 priv->geometry.height () + priv->geometry.border () * 2 +
3302 priv->border.top + priv->border.bottom);
3303}
3304
3305CompRect
3306CompWindow::serverBorderRect () const
3307{
3308 return CompRect (priv->serverGeometry.x () - priv->geometry.border () - priv->border.left,
3309 priv->serverGeometry.y () - priv->geometry.border () - priv->border.top,
3310 priv->serverGeometry.width () + priv->geometry.border () * 2 +
3311 priv->border.left + priv->border.right,
3312 priv->serverGeometry.height () + priv->geometry.border () * 2 +
3313 priv->border.top + priv->border.bottom);
3314}
3315
3316CompRect
3317CompWindow::inputRect () const
3318{
3319 return CompRect (priv->geometry.x () - priv->geometry.border () - priv->serverInput.left,
3320 priv->geometry.y () - priv->geometry.border () - priv->serverInput.top,
3321 priv->geometry.width () + priv->geometry.border () * 2 +
3322 priv->serverInput.left + priv->serverInput.right,
3323 priv->geometry.height () +priv->geometry.border () * 2 +
3324 priv->serverInput.top + priv->serverInput.bottom);
3325}
3326
3327CompRect
3328CompWindow::serverInputRect () const
3329{
3330 return CompRect (priv->serverGeometry.x () - priv->serverGeometry.border () - priv->serverInput.left,
3331 priv->serverGeometry.y () - priv->serverGeometry.border () - priv->serverInput.top,
3332 priv->serverGeometry.width () + priv->serverGeometry.border () * 2 +
3333 priv->serverInput.left + priv->serverInput.right,
3334 priv->serverGeometry.height () + priv->serverGeometry.border () * 2 +
3335 priv->serverInput.top + priv->serverInput.bottom);
3336}
3337
3338CompRect
3339CompWindow::outputRect () const
3340{
3341 return CompRect (priv->geometry.x () - priv->serverGeometry.border ()- priv->output.left,
3342 priv->geometry.y () - priv->serverGeometry.border () - priv->output.top,
3343 priv->geometry.width () + priv->serverGeometry.border () * 2 +
3344 priv->output.left + priv->output.right,
3345 priv->geometry.height () + priv->serverGeometry.border () * 2 +
3346 priv->output.top + priv->output.bottom);
3347}
3348
3349CompRect
3350CompWindow::serverOutputRect () const
3351{
3352 return CompRect (priv->serverGeometry.x () - priv->serverGeometry.border () - priv->output.left,
3353 priv->serverGeometry.y () - priv->serverGeometry.border () - priv->output.top,
3354 priv->serverGeometry.width () + priv->serverGeometry.border () * 2 +
3355 priv->output.left + priv->output.right,
3356 priv->serverGeometry.height () + priv->serverGeometry.border () * 2 +
3357 priv->output.top + priv->output.bottom);
3328}3358}
33293359
3330static bool isPendingRestack (compiz::X11::PendingEvent::Ptr p)3360static bool isPendingRestack (compiz::X11::PendingEvent::Ptr p)
@@ -3848,204 +3878,205 @@
3848 output = selectOutputForGeometry (old);3878 output = selectOutputForGeometry (old);
3849 workArea = output->workArea ();3879 workArea = output->workArea ();
38503880
3851 if (type & CompWindowTypeFullscreenMask)3881 if (!priv->placed)
3852 {3882 {
3853 saveGeometry (CHANGE_X | CHANGE_Y | CHANGE_WIDTH | CHANGE_HEIGHT | CHANGE_BORDER);3883 if (type & CompWindowTypeFullscreenMask)
38543884 {
3855 if (fullscreenMonitorsSet)3885 unsigned int fsChangeMask = CHANGE_X |
3856 {3886 CHANGE_Y |
3857 ng = compiz::window::Geometry (x + fullscreenMonitorRect.x (),3887 CHANGE_WIDTH |
3858 y + fullscreenMonitorRect.y (),3888 CHANGE_HEIGHT |
3859 fullscreenMonitorRect.width (),3889 CHANGE_BORDER;
3860 fullscreenMonitorRect.height (), 0);3890 changeMask |= geometrySaver.push (serverGeometry,
3861 }3891 fsChangeMask);
3862 else3892
3863 {3893 /* Only on push success */
3864 ng = compiz::window::Geometry (x + output->x (),3894 if (fsChangeMask == changeMask)
3865 y + output->y (),3895 {
3866 width + output->width (),3896 if (fullscreenMonitorsSet)
3867 height + output->height (), 0);3897 {
3868 }3898 ng = compiz::window::Geometry (x + fullscreenMonitorRect.x (),
38693899 y + fullscreenMonitorRect.y (),
3870 changeMask |= CHANGE_X | CHANGE_Y | CHANGE_WIDTH | CHANGE_HEIGHT | CHANGE_BORDER;3900 fullscreenMonitorRect.width (),
3871 }3901 fullscreenMonitorRect.height (), 0);
3872 else3902 }
3873 {3903 else
3874 XWindowChanges xwc;3904 {
38753905 ng = compiz::window::Geometry (x + output->x (),
3876 changeMask |= restoreGeometry (&xwc, CHANGE_BORDER);3906 y + output->y (),
38773907 width + output->width (),
3878 if (state & CompWindowStateMaximizedVertMask)3908 height + output->height (), 0);
3879 {3909 }
3880 saveGeometry (CHANGE_Y | CHANGE_HEIGHT);3910 }
38813911 }
3882 ng.setHeight (workArea.height () - border.top - border.bottom - old.border () * 2);3912 else
38833913 {
3884 changeMask |= CHANGE_HEIGHT;3914 changeMask |= geometrySaver.pop (ng, CHANGE_BORDER);
3885 }
3886 else
3887 {
3888 changeMask |= restoreGeometry (&xwc, CHANGE_Y | CHANGE_HEIGHT);
3889 }
3890
3891 if (state & CompWindowStateMaximizedHorzMask)
3892 {
3893 saveGeometry (CHANGE_X | CHANGE_WIDTH);
3894
3895 ng.setWidth (workArea.width () - border.left - border.right - old.border () * 2);
3896
3897 changeMask |= CHANGE_WIDTH;
3898 }
3899 else
3900 {
3901 changeMask |= restoreGeometry (&xwc, CHANGE_X | CHANGE_WIDTH);
3902 }
3903
3904 compiz::window::Geometry xg = compiz::window::Geometry (xwc.x,
3905 xwc.y,
3906 xwc.width,
3907 xwc.height,
3908 xwc.border_width);
3909
3910 ng.applyChange (xg, changeMask);
3911
3912 /* constrain window width if smaller than minimum width */
3913 if (!(changeMask & CHANGE_WIDTH) && (int) old.width () < sizeHints.min_width)
3914 {
3915 ng.setWidth (sizeHints.min_width);
3916 changeMask |= CHANGE_WIDTH;
3917 }
3918
3919 /* constrain window width if greater than maximum width */
3920 if (!(changeMask & CHANGE_WIDTH) && (int) old.width () > sizeHints.max_width)
3921 {
3922 ng.setWidth (sizeHints.max_width);
3923 changeMask |= CHANGE_WIDTH;
3924 }
3925
3926 /* constrain window height if smaller than minimum height */
3927 if (!(changeMask & CHANGE_HEIGHT) && (int) old.height () < sizeHints.min_height)
3928 {
3929 ng.setHeight (sizeHints.min_height);
3930 changeMask |= CHANGE_HEIGHT;
3931 }
3932
3933 /* constrain window height if greater than maximum height */
3934 if (!(changeMask & CHANGE_HEIGHT) && (int) old.height () > sizeHints.max_height)
3935 {
3936 ng.setHeight (sizeHints.max_height);
3937 changeMask |= CHANGE_HEIGHT;
3938 }
3939
3940 if (changeMask & (CHANGE_WIDTH | CHANGE_HEIGHT))
3941 {
3942 compiz::window::Geometry constrained = old;
3943 int width, height, max;
3944
3945 constrained.applyChange (ng, changeMask);
3946 ng.setSize (CompSize (old.width (), old.height ()));
3947
3948 width = constrained.width ();
3949 height = constrained.height ();
3950
3951 window->constrainNewWindowSize (width, height, &width, &height);
3952
3953 if (width != (int) old.width ())
3954 {
3955 changeMask |= CHANGE_WIDTH;
3956 ng.setWidth (width);
3957 }
3958 else
3959 changeMask &= ~CHANGE_WIDTH;
3960
3961 if (height != (int) old.height ())
3962 {
3963 changeMask |= CHANGE_HEIGHT;
3964 ng.setHeight (height);
3965 }
3966 else
3967 changeMask &= ~CHANGE_HEIGHT;
39683915
3969 if (state & CompWindowStateMaximizedVertMask)3916 if (state & CompWindowStateMaximizedVertMask)
3970 {3917 {
3971 /* If the window is still offscreen, then we need to constrain it3918 changeMask |= geometrySaver.push (serverGeometry, CHANGE_Y | CHANGE_HEIGHT);
3972 * by the gravity value (so that the corner that the gravity specifies3919
3973 * is 'anchored' to that edge of the workarea) */3920 /* Geometry save succeeded */
39743921 if (changeMask & CHANGE_HEIGHT)
3975 ng.setY (y + workArea.y () + border.top);3922 ng.setHeight (workArea.height () - border.top - border.bottom - old.border () * 2);
3976 changeMask |= CHANGE_Y;3923 }
39773924 else
3978 switch (priv->sizeHints.win_gravity)3925 {
3979 {3926 changeMask |= geometrySaver.pop (ng, CHANGE_Y | CHANGE_HEIGHT);
3980 case SouthWestGravity:
3981 case SouthEastGravity:
3982 case SouthGravity:
3983 /* Shift the window so that the bottom meets the top of the bottom */
3984 height = ng.height () + old.border () * 2;
3985
3986 max = y + workArea.bottom ();
3987 if (ng.y () + ng.height () + border.bottom > max)
3988 {
3989 ng.setY (max - height - border.bottom);
3990 changeMask |= CHANGE_Y;
3991 }
3992 break;
3993 /* For EastGravity, WestGravity and CenterGravity we default to the top
3994 * of the window since the user should at least be able to close it
3995 * (but not for SouthGravity, SouthWestGravity and SouthEastGravity since
3996 * that indicates that the application has requested positioning in that area
3997 */
3998 case EastGravity:
3999 case WestGravity:
4000 case CenterGravity:
4001 case NorthWestGravity:
4002 case NorthEastGravity:
4003 case NorthGravity:
4004 default:
4005 /* Shift the window so that the top meets the top of the screen */
4006 break;
4007 }
4008 }3927 }
40093928
4010 if (state & CompWindowStateMaximizedHorzMask)3929 if (state & CompWindowStateMaximizedHorzMask)
4011 {3930 {
4012 ng.setX (x + workArea.x () + border.left);3931 changeMask |= geometrySaver.push (serverGeometry, CHANGE_X | CHANGE_WIDTH);
4013 changeMask |= CHANGE_X;3932
40143933 /* Geometry save succeeded */
4015 switch (priv->sizeHints.win_gravity)3934 if (changeMask & CHANGE_HEIGHT)
4016 {3935 ng.setWidth (workArea.width () - border.left - border.right - old.border () * 2);
4017 case NorthEastGravity:3936 }
4018 case SouthEastGravity:3937 else
4019 case EastGravity:3938 {
4020 width = ng.width () + old.border () * 2;3939 changeMask |= geometrySaver.pop (ng, CHANGE_X | CHANGE_WIDTH);
40213940 }
4022 max = x + workArea.right ();3941
40233942 /* constrain window width if smaller than minimum width */
4024 if (old.x () + (int) old.width () + border.right > max)3943 if (!(changeMask & CHANGE_WIDTH) && (int) old.width () < sizeHints.min_width)
4025 {3944 {
4026 ng.setX (max - width - border.right);3945 ng.setWidth (sizeHints.min_width);
4027 changeMask |= CHANGE_X;3946 changeMask |= CHANGE_WIDTH;
4028 }3947 }
4029 else if (old.x () + width + border.right > max)3948
4030 {3949 /* constrain window width if greater than maximum width */
4031 ng.setX (x + workArea.x () +3950 if (!(changeMask & CHANGE_WIDTH) && (int) old.width () > sizeHints.max_width)
4032 (workArea.width () - border.left - width -3951 {
4033 border.right) / 2 + border.left);3952 ng.setWidth (sizeHints.max_width);
4034 changeMask |= CHANGE_X;3953 changeMask |= CHANGE_WIDTH;
4035 }3954 }
4036 /* For NorthGravity, SouthGravity and CenterGravity we default to the top3955
4037 * of the window since the user should at least be able to close it3956 /* constrain window height if smaller than minimum height */
4038 * (but not for SouthGravity, SouthWestGravity and SouthEastGravity since3957 if (!(changeMask & CHANGE_HEIGHT) && (int) old.height () < sizeHints.min_height)
4039 * that indicates that the application has requested positioning in that area3958 {
4040 */3959 ng.setHeight (sizeHints.min_height);
4041 case NorthGravity:3960 changeMask |= CHANGE_HEIGHT;
4042 case SouthGravity:3961 }
4043 case CenterGravity:3962
4044 case NorthWestGravity:3963 /* constrain window height if greater than maximum height */
4045 case SouthWestGravity:3964 if (!(changeMask & CHANGE_HEIGHT) && (int) old.height () > sizeHints.max_height)
4046 case WestGravity:3965 {
4047 default:3966 ng.setHeight (sizeHints.max_height);
4048 break;3967 changeMask |= CHANGE_HEIGHT;
3968 }
3969
3970 if (changeMask & (CHANGE_WIDTH | CHANGE_HEIGHT))
3971 {
3972 compiz::window::Geometry constrained = old;
3973 int width, height, max;
3974
3975 constrained.applyChange (ng, changeMask);
3976 ng.setSize (CompSize (old.width (), old.height ()));
3977
3978 width = constrained.width ();
3979 height = constrained.height ();
3980
3981 window->constrainNewWindowSize (width, height, &width, &height);
3982
3983 if (width != (int) old.width ())
3984 {
3985 changeMask |= CHANGE_WIDTH;
3986 ng.setWidth (width);
3987 }
3988 else
3989 changeMask &= ~CHANGE_WIDTH;
3990
3991 if (height != (int) old.height ())
3992 {
3993 changeMask |= CHANGE_HEIGHT;
3994 ng.setHeight (height);
3995 }
3996 else
3997 changeMask &= ~CHANGE_HEIGHT;
3998
3999 if (state & CompWindowStateMaximizedVertMask)
4000 {
4001 /* If the window is still offscreen, then we need to constrain it
4002 * by the gravity value (so that the corner that the gravity specifies
4003 * is 'anchored' to that edge of the workarea) */
4004
4005 ng.setY (y + workArea.y () + border.top);
4006 changeMask |= CHANGE_Y;
4007
4008 switch (priv->sizeHints.win_gravity)
4009 {
4010 case SouthWestGravity:
4011 case SouthEastGravity:
4012 case SouthGravity:
4013 /* Shift the window so that the bottom meets the top of the bottom */
4014 height = ng.height () + old.border () * 2;
4015
4016 max = y + workArea.bottom ();
4017 if (ng.y () + ng.height () + border.bottom > max)
4018 {
4019 ng.setY (max - height - border.bottom);
4020 changeMask |= CHANGE_Y;
4021 }
4022 break;
4023 /* For EastGravity, WestGravity and CenterGravity we default to the top
4024 * of the window since the user should at least be able to close it
4025 * (but not for SouthGravity, SouthWestGravity and SouthEastGravity since
4026 * that indicates that the application has requested positioning in that area
4027 */
4028 case EastGravity:
4029 case WestGravity:
4030 case CenterGravity:
4031 case NorthWestGravity:
4032 case NorthEastGravity:
4033 case NorthGravity:
4034 default:
4035 /* Shift the window so that the top meets the top of the screen */
4036 break;
4037 }
4038 }
4039
4040 if (state & CompWindowStateMaximizedHorzMask)
4041 {
4042 ng.setX (x + workArea.x () + border.left);
4043 changeMask |= CHANGE_X;
4044
4045 switch (priv->sizeHints.win_gravity)
4046 {
4047 case NorthEastGravity:
4048 case SouthEastGravity:
4049 case EastGravity:
4050 width = ng.width () + old.border () * 2;
4051
4052 max = x + workArea.right ();
4053
4054 if (old.x () + (int) old.width () + border.right > max)
4055 {
4056 ng.setX (max - width - border.right);
4057 changeMask |= CHANGE_X;
4058 }
4059 else if (old.x () + width + border.right > max)
4060 {
4061 ng.setX (x + workArea.x () +
4062 (workArea.width () - border.left - width -
4063 border.right) / 2 + border.left);
4064 changeMask |= CHANGE_X;
4065 }
4066 /* For NorthGravity, SouthGravity and CenterGravity we default to the top
4067 * of the window since the user should at least be able to close it
4068 * (but not for SouthGravity, SouthWestGravity and SouthEastGravity since
4069 * that indicates that the application has requested positioning in that area
4070 */
4071 case NorthGravity:
4072 case SouthGravity:
4073 case CenterGravity:
4074 case NorthWestGravity:
4075 case SouthWestGravity:
4076 case WestGravity:
4077 default:
4078 break;
4079 }
4049 }4080 }
4050 }4081 }
4051 }4082 }
@@ -4161,17 +4192,6 @@
4161 /* Revert to serverGeometry on any unset bits */4192 /* Revert to serverGeometry on any unset bits */
4162 ng.applyChange (serverGeometry, ~changeMask);4193 ng.applyChange (serverGeometry, ~changeMask);
41634194
4164/*
4165 if (!(changeMask & CWX))
4166 xwc->x = serverGeometry.x ();
4167 if (!(changeMask & CWY))
4168 xwc->y = serverGeometry.y ();
4169 if (!(changeMask & CWWidth))
4170 xwc->width = serverGeometry.width ();
4171 if (!(changeMask & CWHeight))
4172 xwc->height = serverGeometry.height ();
4173*/
4174
4175 if (changeMask & (CHANGE_WIDTH | CHANGE_HEIGHT))4195 if (changeMask & (CHANGE_WIDTH | CHANGE_HEIGHT))
4176 {4196 {
4177 int width, height;4197 int width, height;
@@ -4217,11 +4237,15 @@
4217 or maximized windows after addWindowSizeChanges, it should be pretty4237 or maximized windows after addWindowSizeChanges, it should be pretty
4218 safe to assume that the saved coordinates should be updated too, e.g.4238 safe to assume that the saved coordinates should be updated too, e.g.
4219 because the window was moved to another viewport by some client */4239 because the window was moved to another viewport by some client */
4220 if ((changeMask & CHANGE_X) && (saveMask & CHANGE_X))4240 compiz::window::Geometry update;
4221 saveWc.x += (ng.x () - serverGeometry.x ());4241 unsigned int saveMask = geometrySaver.get (update);
42224242
4223 if ((changeMask & CHANGE_Y) && (saveMask & CHANGE_Y))4243 saveMask &= (changeMask & (CHANGE_X | CHANGE_Y));
4224 saveWc.y += (ng.y () - serverGeometry.y ());4244
4245 update.setPos (update.pos () + CompPoint (ng.x () - serverGeometry.x (),
4246 ng.y () - serverGeometry.y ()));
4247
4248 geometrySaver.update (update, saveMask);
42254249
4226 if (mapNum && (changeMask & (CHANGE_X | CHANGE_Y)))4250 if (mapNum && (changeMask & (CHANGE_X | CHANGE_Y)))
4227 window->sendSyncRequest ();4251 window->sendSyncRequest ();
@@ -4540,6 +4564,8 @@
4540 priv->show ();4564 priv->show ();
4541 }4565 }
45424566
4567 memset (&xwc, 0, sizeof (XWindowChanges));
4568
4543 if (stackingMode != CompStackingUpdateModeNone)4569 if (stackingMode != CompStackingUpdateModeNone)
4544 {4570 {
4545 bool aboveFs;4571 bool aboveFs;
@@ -5863,28 +5889,20 @@
5863 if (!priv->placed)5889 if (!priv->placed)
5864 {5890 {
5865 int gravity = priv->sizeHints.win_gravity;5891 int gravity = priv->sizeHints.win_gravity;
5866 unsigned int changeMask;
5867 /* adjust for gravity, but only for frame size */5892 /* adjust for gravity, but only for frame size */
5868 compiz::window::Geometry sg = compiz::window::Geometry (priv->serverGeometry.x (),5893 compiz::window::Geometry sg = priv->serverGeometry;
5869 priv->serverGeometry.y (),5894
5870 0,5895 adjustConfigureRequestForGravity (sg, CHANGE_X | CHANGE_Y, gravity, 1);
5871 0,5896
5872 0);5897 /* was: validateRequestRequest */
5873 compiz::window::Geometry g = window->geometry ();5898 window->position (sg, ClientTypeApplication);
58745899
5875 changeMask = adjustConfigureRequestForGravity (sg, CHANGE_X | CHANGE_Y, gravity, 1);5900 CompPoint pos (sg.pos ());
5876
5877 g.applyChange (sg, changeMask);
5878
5879 window->position (g, ClientTypeApplication);
5880
5881 CompPoint pos (g.pos ());
5882 if (window->place (pos))5901 if (window->place (pos))
5883 {5902 sg.setPos (pos);
5884 g.setPos (g.pos () + pos);
5885 }
58865903
5887 window->position (g, 0);5904 /* calls through to configureXWindow */
5905 window->position (sg, 0);
58885906
5889 priv->placed = true;5907 priv->placed = true;
5890 }5908 }
@@ -6115,18 +6133,6 @@
6115 return priv->struts;6133 return priv->struts;
6116}6134}
61176135
6118int &
6119CompWindow::saveMask ()
6120{
6121 return priv->saveMask;
6122}
6123
6124XWindowChanges &
6125CompWindow::saveWc ()
6126{
6127 return priv->saveWc;
6128}
6129
6130void6136void
6131CompWindow::moveToViewportPosition (int x,6137CompWindow::moveToViewportPosition (int x,
6132 int y,6138 int y,
@@ -6191,11 +6197,14 @@
6191 wy = ty - vHeight;6197 wy = ty - vHeight;
6192 }6198 }
61936199
6194 if (priv->saveMask & CWX)6200 compiz::window::Geometry update;
6195 priv->saveWc.x += wx;6201 unsigned int saveMask = (priv->geometrySaver.get (update) & (CHANGE_X |
61966202 CHANGE_Y));
6197 if (priv->saveMask & CWY)6203
6198 priv->saveWc.y += wy;6204 update.setPos (CompPoint (update.x () + wx,
6205 update.y () + wy));
6206
6207 priv->geometrySaver.update (update, saveMask);
61996208
6200 xwc.x = serverGeometry ().x () + wx;6209 xwc.x = serverGeometry ().x () + wx;
6201 xwc.y = serverGeometry ().y () + wy;6210 xwc.y = serverGeometry ().y () + wy;
@@ -6631,9 +6640,23 @@
6631 /* restore saved geometry and map if hidden */6640 /* restore saved geometry and map if hidden */
6632 if (!priv->attrib.override_redirect)6641 if (!priv->attrib.override_redirect)
6633 {6642 {
6634 if (priv->saveMask)6643 compiz::window::Geometry restore;
6635 XConfigureWindow (screen->dpy (), priv->id,6644 unsigned int mask = priv->geometrySaver.pop (restore,
6636 priv->saveMask, &priv->saveWc);6645 CHANGE_X |
6646 CHANGE_Y |
6647 CHANGE_WIDTH |
6648 CHANGE_HEIGHT |
6649 CHANGE_BORDER);
6650
6651 XWindowChanges xwc;
6652
6653 xwc.x = restore.x ();
6654 xwc.y = restore.y ();
6655 xwc.width = restore.height ();
6656 xwc.height = restore.height ();
6657 xwc.border_width = restore.border ();
6658
6659 XConfigureWindow (screen->dpy (), priv->id, mask, &xwc);
66376660
6638 if (!priv->hidden)6661 if (!priv->hidden)
6639 {6662 {
@@ -6735,8 +6758,7 @@
6735 icons (0),6758 icons (0),
6736 noIcons (false),6759 noIcons (false),
67376760
6738 saveMask (0),6761 geometrySaver (serverGeometry),
6739 syncCounter (0),
6740 syncAlarm (None),6762 syncAlarm (None),
6741 syncWaitTimer (),6763 syncWaitTimer (),
67426764
67436765
=== added file 'src/window/CMakeLists.txt'
--- src/window/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/window/CMakeLists.txt 2012-01-11 08:47:28 +0000
@@ -0,0 +1,2 @@
1add_subdirectory (geometry)
2add_subdirectory (geometry-saver)
03
=== added directory 'src/window/geometry'
=== added directory 'src/window/geometry-saver'
=== added file 'src/window/geometry-saver/CMakeLists.txt'
--- src/window/geometry-saver/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/window/geometry-saver/CMakeLists.txt 2012-01-11 08:47:28 +0000
@@ -0,0 +1,68 @@
1pkg_check_modules (
2 GLIBMM
3 REQUIRED
4 glibmm-2.4 glib-2.0
5)
6
7INCLUDE_DIRECTORIES (
8 ${CMAKE_CURRENT_SOURCE_DIR}/include
9 ${CMAKE_CURRENT_SOURCE_DIR}/src
10
11 ${compiz_SOURCE_DIR}/include
12
13 ${Boost_INCLUDE_DIRS}
14
15 ${GLIBMM_INCLUDE_DIRS}
16
17 ${compiz_SOURCE_DIR}/src/window/geometry/include
18)
19
20LINK_DIRECTORIES (${GLIBMM_LIBRARY_DIRS})
21
22SET (
23 PUBLIC_HEADERS
24 ${CMAKE_CURRENT_SOURCE_DIR}/include/core/windowgeometrysaver.h
25)
26
27SET (
28 PRIVATE_HEADERS
29)
30
31SET(
32 SRCS
33 ${CMAKE_CURRENT_SOURCE_DIR}/src/geometrysaver.cpp
34)
35
36ADD_LIBRARY(
37 compiz_window_geometry_saver STATIC
38
39 ${SRCS}
40
41 ${PUBLIC_HEADERS}
42 ${PRIVATE_HEADERS}
43)
44
45ADD_SUBDIRECTORY( ${CMAKE_CURRENT_SOURCE_DIR}/tests )
46
47SET_TARGET_PROPERTIES(
48 compiz_window_geometry_saver PROPERTIES
49 PUBLIC_HEADER "${PUBLIC_HEADERS}"
50)
51
52INSTALL(
53 TARGETS compiz_window_geometry_saver
54 RUNTIME DESTINATION bin
55 LIBRARY DESTINATION lib
56 ARCHIVE DESTINATION lib
57 PUBLIC_HEADER DESTINATION include/compiz
58)
59
60
61
62TARGET_LINK_LIBRARIES (
63 compiz_window_geometry_saver
64
65 compiz_window_geometry
66
67 ${GLIBMM_LIBRARIES}
68)
069
=== added directory 'src/window/geometry-saver/include'
=== added directory 'src/window/geometry-saver/include/core'
=== added file 'src/window/geometry-saver/include/core/windowgeometrysaver.h'
--- src/window/geometry-saver/include/core/windowgeometrysaver.h 1970-01-01 00:00:00 +0000
+++ src/window/geometry-saver/include/core/windowgeometrysaver.h 2012-01-11 08:47:28 +0000
@@ -0,0 +1,94 @@
1/*
2 * Copyright © 2011 Canonical Ltd.
3 * Copyright © 2008 Dennis Kasprzyk
4 * Copyright © 2007 Novell, Inc.
5 *
6 * Permission to use, copy, modify, distribute, and sell this software
7 * and its documentation for any purpose is hereby granted without
8 * fee, provided that the above copyright notice appear in all copies
9 * and that both that copyright notice and this permission notice
10 * appear in supporting documentation, and that the name of
11 * Dennis Kasprzyk not be used in advertising or publicity pertaining to
12 * distribution of the software without specific, written prior permission.
13 * Dennis Kasprzyk makes no representations about the suitability of this
14 * software for any purpose. It is provided "as is" without express or
15 * implied warranty.
16 *
17 * DENNIS KASPRZYK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
18 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
19 * NO EVENT SHALL DENNIS KASPRZYK BE LIABLE FOR ANY SPECIAL, INDIRECT OR
20 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
21 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
22 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
23 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24 *
25 * Authors: Dennis Kasprzyk <onestone@compiz-fusion.org>
26 * David Reveman <davidr@novell.com>
27 */
28
29#ifndef _COMPWINDOWGEOMETRYSAVER_H
30#define _COMPWINDOWGEOMETRYSAVER_H
31
32#include <core/rect.h>
33#include <core/windowgeometry.h>
34
35namespace compiz
36{
37namespace window
38{
39
40/**
41 * A one-level push-pop stack for saving window geometry
42 * parameters, eg, to maximize and demaximize windows
43 * and make sure they are restored to the same place
44 * relative to the window */
45class GeometrySaver
46{
47public:
48
49 GeometrySaver (const Geometry &g);
50
51 /**
52 * Push some new geometry into the saved bits
53 *
54 * @param g a const compiz::window::Geometry & of the geometry
55 * you wish to push
56 * @param mask an unsigned int indicating which bits of the
57 * specified geometry should be saved
58 * @return the bits actually saved
59 */
60 unsigned int push (const Geometry &g, unsigned int mask);
61
62 /**
63 * Restore saved geometry
64 *
65 * @param g a compiz::window::Geometry & of the geometry
66 * which should be written into
67 * @param mask an unsigned int indicating which bits of the
68 * geometry should be restored
69 * @return the bits actually restored
70 */
71 unsigned int pop (Geometry &g, unsigned int mask);
72
73 /**
74 * Force update certain saved geometry bits
75 *
76 * @param g a const compiz::window::Geometry & of the geometry
77 * you wish to update
78 * @param mask an unsigned int indicating which bits of the
79 * specified geometry should be updated
80 */
81 void update (const Geometry &g, unsigned int mask);
82
83 unsigned int get (Geometry &g);
84
85private:
86
87 Geometry mGeometry;
88 unsigned int mMask;
89};
90
91}
92}
93
94#endif
095
=== added directory 'src/window/geometry-saver/src'
=== added file 'src/window/geometry-saver/src/geometrysaver.cpp'
--- src/window/geometry-saver/src/geometrysaver.cpp 1970-01-01 00:00:00 +0000
+++ src/window/geometry-saver/src/geometrysaver.cpp 2012-01-11 08:47:28 +0000
@@ -0,0 +1,75 @@
1/*
2 * Copyright © 2008 Dennis Kasprzyk
3 *
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without
6 * fee, provided that the above copyright notice appear in all copies
7 * and that both that copyright notice and this permission notice
8 * appear in supporting documentation, and that the name of
9 * Dennis Kasprzyk not be used in advertising or publicity pertaining to
10 * distribution of the software without specific, written prior permission.
11 * Dennis Kasprzyk makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without express or
13 * implied warranty.
14 *
15 * DENNIS KASPRZYK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17 * NO EVENT SHALL DENNIS KASPRZYK BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 *
23 * Authors: Dennis Kasprzyk <onestone@compiz-fusion.org>
24 */
25
26#include <core/windowgeometrysaver.h>
27
28compiz::window::GeometrySaver::GeometrySaver (const Geometry &g) :
29 mGeometry (g),
30 mMask (0)
31{
32}
33
34unsigned int
35compiz::window::GeometrySaver::push (const Geometry &g, unsigned int mask)
36{
37 /* Don't allow overwriting of any already set geometry */
38 unsigned int useMask = mask & ~mMask;
39
40 mMask |= useMask;
41 mGeometry.applyChange (g, useMask);
42
43 return useMask;
44}
45
46unsigned int
47compiz::window::GeometrySaver::pop (Geometry &g, unsigned int mask)
48{
49 unsigned int restoreMask = mask & mMask;
50
51 mMask &= ~restoreMask;
52 g.applyChange (mGeometry, restoreMask);
53
54 return restoreMask;
55}
56
57void
58compiz::window::GeometrySaver::update (const Geometry &g,
59 unsigned int mask)
60{
61 /* By default, only update bits that have not been saved */
62 unsigned int updateMask = ~mMask;
63
64 /* But also update bits that we are forcing an update on */
65 updateMask |= mask;
66
67 mGeometry.applyChange (g, updateMask);
68}
69
70unsigned int
71compiz::window::GeometrySaver::get (Geometry &g)
72{
73 g = mGeometry;
74 return mMask;
75}
076
=== added directory 'src/window/geometry-saver/tests'
=== added file 'src/window/geometry-saver/tests/test-window-geometry-saver.cpp'
--- src/window/geometry-saver/tests/test-window-geometry-saver.cpp 1970-01-01 00:00:00 +0000
+++ src/window/geometry-saver/tests/test-window-geometry-saver.cpp 2012-01-11 08:47:28 +0000
@@ -0,0 +1,26 @@
1/*
2 * Copyright © 2011 Canonical Ltd.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without
6 * fee, provided that the above copyright notice appear in all copies
7 * and that both that copyright notice and this permission notice
8 * appear in supporting documentation, and that the name of
9 * Canonical Ltd. not be used in advertising or publicity pertaining to
10 * distribution of the software without specific, written prior permission.
11 * Canonical Ltd. makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without express or
13 * implied warranty.
14 *
15 * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17 * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 *
23 * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com>
24 */
25
26#include "test-window-geometry-saver.h"
027
=== added file 'src/window/geometry-saver/tests/test-window-geometry-saver.h'
--- src/window/geometry-saver/tests/test-window-geometry-saver.h 1970-01-01 00:00:00 +0000
+++ src/window/geometry-saver/tests/test-window-geometry-saver.h 2012-01-11 08:47:28 +0000
@@ -0,0 +1,39 @@
1/*
2 * Copyright © 2011 Canonical Ltd.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without
6 * fee, provided that the above copyright notice appear in all copies
7 * and that both that copyright notice and this permission notice
8 * appear in supporting documentation, and that the name of
9 * Canonical Ltd. not be used in advertising or publicity pertaining to
10 * distribution of the software without specific, written prior permission.
11 * Canonical Ltd. makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without express or
13 * implied warranty.
14 *
15 * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17 * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 *
23 * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com>
24 */
25
26#ifndef _COMPIZ_TEST_WINDOW_GEOMETRY_H
27#define _COMPIZ_TEST_WINDOW_GEOMETRY_H
28
29#include <gtest/gtest.h>
30#include <core/windowgeometrysaver.h>
31#include <core/rect.h>
32#include <iostream>
33#include <boost/bind.hpp>
34
35class CompWindowGeometryTest : public ::testing::Test
36{
37};
38
39#endif
040
=== added directory 'src/window/geometry-saver/tests/window-geometry-saver'
=== added directory 'src/window/geometry-saver/tests/window-geometry-saver/src'
=== added file 'src/window/geometry-saver/tests/window-geometry-saver/src/test-window-geometry-saver.cpp'
--- src/window/geometry-saver/tests/window-geometry-saver/src/test-window-geometry-saver.cpp 1970-01-01 00:00:00 +0000
+++ src/window/geometry-saver/tests/window-geometry-saver/src/test-window-geometry-saver.cpp 2012-01-11 08:47:28 +0000
@@ -0,0 +1,111 @@
1/*
2 * Copyright © 2011 Canonical Ltd.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without
6 * fee, provided that the above copyright notice appear in all copies
7 * and that both that copyright notice and this permission notice
8 * appear in supporting documentation, and that the name of
9 * Canonical Ltd. not be used in advertising or publicity pertaining to
10 * distribution of the software without specific, written prior permission.
11 * Canonical Ltd. makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without express or
13 * implied warranty.
14 *
15 * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17 * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 *
23 * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com>
24 */
25
26#include "test-window-geometry-saver.h"
27
28class CompWindowGeometryTestSaver :
29 public CompWindowGeometryTest
30{
31public:
32
33 CompWindowGeometryTestSaver ();
34 virtual ~CompWindowGeometryTestSaver ();
35
36protected:
37
38 compiz::window::Geometry g;
39 compiz::window::GeometrySaver saver;
40};
41
42CompWindowGeometryTestSaver::CompWindowGeometryTestSaver () :
43 g (100, 100, 300, 300, 5),
44 saver (g)
45{
46}
47
48CompWindowGeometryTestSaver::~CompWindowGeometryTestSaver ()
49{
50}
51
52TEST_F (CompWindowGeometryTestSaver, TestSaver)
53{
54 /* g by default */
55 compiz::window::Geometry rg;
56 unsigned int mask = saver.get (rg);
57
58 EXPECT_EQ (mask, 0);
59 EXPECT_EQ (rg, compiz::window::Geometry (100, 100, 300, 300, 5));
60
61 /* Push X value on to the saved geometry */
62 saver.push (g, CHANGE_X);
63 mask = saver.get (rg);
64
65 EXPECT_EQ (mask, CHANGE_X);
66 EXPECT_EQ (rg, compiz::window::Geometry (100, 100, 300, 300, 5));
67
68 /* Push Y and Width values on to the saved geometry */
69 saver.push (g, CHANGE_Y | CHANGE_WIDTH);
70 mask = saver.get (rg);
71
72 EXPECT_EQ (mask, CHANGE_X | CHANGE_Y | CHANGE_WIDTH);
73 EXPECT_EQ (rg, compiz::window::Geometry (100, 100, 300, 300, 5));
74
75 /* Pop Y value off the saved geoemtry */
76 rg = compiz::window::Geometry ();
77 mask = saver.pop (rg, CHANGE_Y);
78
79 EXPECT_EQ (mask, CHANGE_Y);
80 EXPECT_EQ (rg, compiz::window::Geometry (0, 100, 0, 0, 0));
81
82 /* Attempt to pop X Y and Height off the saved geometry,
83 * but since Y is not saved, only expect X */
84 rg = compiz::window::Geometry ();
85 mask = saver.pop (rg, CHANGE_X | CHANGE_Y | CHANGE_HEIGHT);
86
87 EXPECT_EQ (mask, CHANGE_X);
88 EXPECT_EQ (rg, compiz::window::Geometry (100, 0, 0, 0, 0));
89
90 /* Update the saved geometry (eg, workspace change) and
91 * pop the new value off */
92 rg = compiz::window::Geometry ();
93 g.setWidth (1200);
94 saver.update (g, CHANGE_WIDTH);
95 mask = saver.pop (rg, CHANGE_WIDTH);
96
97 EXPECT_EQ (mask, CHANGE_WIDTH);
98 EXPECT_EQ (rg, compiz::window::Geometry (0, 0, 1200, 0, 0));
99
100 /* Try to push twice, only allow the first value to be popped off */
101 rg = compiz::window::Geometry ();
102 g.setWidth (1000);
103 saver.push (g, CHANGE_WIDTH);
104 g.setWidth (1200);
105 saver.push (g, CHANGE_WIDTH);
106
107 mask = saver.pop (rg, CHANGE_WIDTH);
108
109 EXPECT_EQ (mask, CHANGE_WIDTH);
110 EXPECT_EQ (rg, compiz::window::Geometry (0, 0, 1000, 0, 0));
111}
0112
=== added file 'src/window/geometry/CMakeLists.txt'
--- src/window/geometry/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/window/geometry/CMakeLists.txt 2012-01-11 08:47:28 +0000
@@ -0,0 +1,65 @@
1pkg_check_modules (
2 GLIBMM
3 REQUIRED
4 glibmm-2.4 glib-2.0
5)
6
7INCLUDE_DIRECTORIES (
8 ${CMAKE_CURRENT_SOURCE_DIR}/include
9 ${CMAKE_CURRENT_SOURCE_DIR}/src
10
11 ${compiz_SOURCE_DIR}/include
12
13 ${Boost_INCLUDE_DIRS}
14
15 ${GLIBMM_INCLUDE_DIRS}
16)
17
18LINK_DIRECTORIES (${GLIBMM_LIBRARY_DIRS})
19
20SET (
21 PUBLIC_HEADERS
22 ${CMAKE_CURRENT_SOURCE_DIR}/include/core/windowgeometry.h
23)
24
25SET (
26 PRIVATE_HEADERS
27)
28
29SET(
30 SRCS
31 ${CMAKE_CURRENT_SOURCE_DIR}/src/windowgeometry.cpp
32 ${compiz_SOURCE_DIR}/src/rect.cpp
33)
34
35ADD_LIBRARY(
36 compiz_window_geometry STATIC
37
38 ${SRCS}
39
40 ${PUBLIC_HEADERS}
41 ${PRIVATE_HEADERS}
42)
43
44ADD_SUBDIRECTORY( ${CMAKE_CURRENT_SOURCE_DIR}/tests )
45
46SET_TARGET_PROPERTIES(
47 compiz_window_geometry PROPERTIES
48 PUBLIC_HEADER "${PUBLIC_HEADERS}"
49)
50
51INSTALL(
52 TARGETS compiz_window_geometry
53 RUNTIME DESTINATION bin
54 LIBRARY DESTINATION lib
55 ARCHIVE DESTINATION lib
56 PUBLIC_HEADER DESTINATION include/compiz
57)
58
59
60
61TARGET_LINK_LIBRARIES(
62 compiz_window_geometry
63
64 ${GLIBMM_LIBRARIES}
65)
066
=== added directory 'src/window/geometry/include'
=== added directory 'src/window/geometry/include/core'
=== added file 'src/window/geometry/include/core/windowgeometry.h'
--- src/window/geometry/include/core/windowgeometry.h 1970-01-01 00:00:00 +0000
+++ src/window/geometry/include/core/windowgeometry.h 2012-01-11 08:47:28 +0000
@@ -0,0 +1,72 @@
1/*
2 * Copyright © 2011 Canonical Ltd.
3 * Copyright © 2008 Dennis Kasprzyk
4 * Copyright © 2007 Novell, Inc.
5 *
6 * Permission to use, copy, modify, distribute, and sell this software
7 * and its documentation for any purpose is hereby granted without
8 * fee, provided that the above copyright notice appear in all copies
9 * and that both that copyright notice and this permission notice
10 * appear in supporting documentation, and that the name of
11 * Dennis Kasprzyk not be used in advertising or publicity pertaining to
12 * distribution of the software without specific, written prior permission.
13 * Dennis Kasprzyk makes no representations about the suitability of this
14 * software for any purpose. It is provided "as is" without express or
15 * implied warranty.
16 *
17 * DENNIS KASPRZYK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
18 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
19 * NO EVENT SHALL DENNIS KASPRZYK BE LIABLE FOR ANY SPECIAL, INDIRECT OR
20 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
21 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
22 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
23 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24 *
25 * Authors: Dennis Kasprzyk <onestone@compiz-fusion.org>
26 * David Reveman <davidr@novell.com>
27 */
28
29#ifndef _COMPWINDOWGEOMETRY_H
30#define _COMPWINDOWGEOMETRY_H
31
32#include <core/rect.h>
33
34/* FIXME: Remove #defines in favor of const variables
35 * inside of the compiz::window namespace */
36#define CHANGE_X 1 << 0
37#define CHANGE_Y 1 << 1
38#define CHANGE_WIDTH 1 << 2
39#define CHANGE_HEIGHT 1 << 3
40#define CHANGE_BORDER 1 << 4
41
42namespace compiz
43{
44namespace window
45{
46
47/**
48 * A mutable object about the dimensions and location of a CompWindow.
49 */
50class Geometry :
51 public CompRect
52{
53public:
54 Geometry ();
55 Geometry (int x, int y, int width, int height, int border);
56
57 int border () const;
58
59 void set (int x, int y, int width, int height, int border);
60 void setBorder (int border);
61
62 unsigned int changeMask (const compiz::window::Geometry &g) const;
63 void applyChange (const compiz::window::Geometry &g, unsigned int mask);
64
65private:
66 int mBorder;
67};
68
69}
70}
71
72#endif
073
=== added directory 'src/window/geometry/src'
=== renamed file 'src/windowgeometry.cpp' => 'src/window/geometry/src/windowgeometry.cpp'
--- src/windowgeometry.cpp 2012-01-11 08:47:27 +0000
+++ src/window/geometry/src/windowgeometry.cpp 2012-01-11 08:47:28 +0000
@@ -23,9 +23,7 @@
23 * Authors: Dennis Kasprzyk <onestone@compiz-fusion.org>23 * Authors: Dennis Kasprzyk <onestone@compiz-fusion.org>
24 */24 */
2525
26#include <core/core.h>26#include <core/windowgeometry.h>
27#include <core/window.h>
28#include <privatewindow.h>
2927
3028
31compiz::window::Geometry::Geometry () :29compiz::window::Geometry::Geometry () :
@@ -110,164 +108,3 @@
110 if (mask & CHANGE_BORDER)108 if (mask & CHANGE_BORDER)
111 setBorder (g.border ());109 setBorder (g.border ());
112}110}
113
114const compiz::window::Geometry &
115CompWindow::serverGeometry () const
116{
117 return priv->serverGeometry;
118}
119
120const compiz::window::Geometry &
121CompWindow::geometry () const
122{
123 return priv->geometry;
124}
125
126int
127CompWindow::x () const
128{
129 return priv->geometry.x ();
130}
131
132int
133CompWindow::y () const
134{
135 return priv->geometry.y ();
136}
137
138CompPoint
139CompWindow::pos () const
140{
141 return CompPoint (priv->geometry.x (), priv->geometry.y ());
142}
143
144/* With border */
145int
146CompWindow::width () const
147{
148 return priv->width +
149 priv->geometry.border () * 2;
150}
151
152int
153CompWindow::height () const
154{
155 return priv->height +
156 priv->geometry.border () * 2;;
157}
158
159CompSize
160CompWindow::size () const
161{
162 return CompSize (priv->width + priv->geometry.border () * 2,
163 priv->height + priv->geometry.border () * 2);
164}
165
166int
167CompWindow::serverX () const
168{
169 return priv->serverGeometry.x ();
170}
171
172int
173CompWindow::serverY () const
174{
175 return priv->serverGeometry.y ();
176}
177
178CompPoint
179CompWindow::serverPos () const
180{
181 return CompPoint (priv->serverGeometry.x (),
182 priv->serverGeometry.y ());
183}
184
185/* With border */
186int
187CompWindow::serverWidth () const
188{
189 return priv->serverGeometry.width () +
190 2 * priv->serverGeometry.border ();
191}
192
193int
194CompWindow::serverHeight () const
195{
196 return priv->serverGeometry.height () +
197 2 * priv->serverGeometry.border ();
198}
199
200const CompSize
201CompWindow::serverSize () const
202{
203 return CompSize (priv->serverGeometry.width () +
204 2 * priv->serverGeometry.border (),
205 priv->serverGeometry.height () +
206 2 * priv->serverGeometry.border ());
207}
208
209CompRect
210CompWindow::borderRect () const
211{
212 return CompRect (priv->geometry.x () - priv->geometry.border () - priv->border.left,
213 priv->geometry.y () - priv->geometry.border () - priv->border.top,
214 priv->geometry.width () + priv->geometry.border () * 2 +
215 priv->border.left + priv->border.right,
216 priv->geometry.height () + priv->geometry.border () * 2 +
217 priv->border.top + priv->border.bottom);
218}
219
220CompRect
221CompWindow::serverBorderRect () const
222{
223 return CompRect (priv->serverGeometry.x () - priv->geometry.border () - priv->border.left,
224 priv->serverGeometry.y () - priv->geometry.border () - priv->border.top,
225 priv->serverGeometry.width () + priv->geometry.border () * 2 +
226 priv->border.left + priv->border.right,
227 priv->serverGeometry.height () + priv->geometry.border () * 2 +
228 priv->border.top + priv->border.bottom);
229}
230
231CompRect
232CompWindow::inputRect () const
233{
234 return CompRect (priv->geometry.x () - priv->geometry.border () - priv->serverInput.left,
235 priv->geometry.y () - priv->geometry.border () - priv->serverInput.top,
236 priv->geometry.width () + priv->geometry.border () * 2 +
237 priv->serverInput.left + priv->serverInput.right,
238 priv->geometry.height () +priv->geometry.border () * 2 +
239 priv->serverInput.top + priv->serverInput.bottom);
240}
241
242CompRect
243CompWindow::serverInputRect () const
244{
245 return CompRect (priv->serverGeometry.x () - priv->serverGeometry.border () - priv->serverInput.left,
246 priv->serverGeometry.y () - priv->serverGeometry.border () - priv->serverInput.top,
247 priv->serverGeometry.width () + priv->serverGeometry.border () * 2 +
248 priv->serverInput.left + priv->serverInput.right,
249 priv->serverGeometry.height () + priv->serverGeometry.border () * 2 +
250 priv->serverInput.top + priv->serverInput.bottom);
251}
252
253CompRect
254CompWindow::outputRect () const
255{
256 return CompRect (priv->geometry.x () - priv->serverGeometry.border ()- priv->output.left,
257 priv->geometry.y () - priv->serverGeometry.border () - priv->output.top,
258 priv->geometry.width () + priv->serverGeometry.border () * 2 +
259 priv->output.left + priv->output.right,
260 priv->geometry.height () + priv->serverGeometry.border () * 2 +
261 priv->output.top + priv->output.bottom);
262}
263
264CompRect
265CompWindow::serverOutputRect () const
266{
267 return CompRect (priv->serverGeometry.x () - priv->serverGeometry.border () - priv->output.left,
268 priv->serverGeometry.y () - priv->serverGeometry.border () - priv->output.top,
269 priv->serverGeometry.width () + priv->serverGeometry.border () * 2 +
270 priv->output.left + priv->output.right,
271 priv->serverGeometry.height () + priv->serverGeometry.border () * 2 +
272 priv->output.top + priv->output.bottom);
273}
274111
=== added directory 'src/window/geometry/tests'
=== added file 'src/window/geometry/tests/test-window-geometry.cpp'
--- src/window/geometry/tests/test-window-geometry.cpp 1970-01-01 00:00:00 +0000
+++ src/window/geometry/tests/test-window-geometry.cpp 2012-01-11 08:47:28 +0000
@@ -0,0 +1,26 @@
1/*
2 * Copyright © 2011 Canonical Ltd.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without
6 * fee, provided that the above copyright notice appear in all copies
7 * and that both that copyright notice and this permission notice
8 * appear in supporting documentation, and that the name of
9 * Canonical Ltd. not be used in advertising or publicity pertaining to
10 * distribution of the software without specific, written prior permission.
11 * Canonical Ltd. makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without express or
13 * implied warranty.
14 *
15 * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17 * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 *
23 * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com>
24 */
25
26#include "test-window-geometry.h"
027
=== added file 'src/window/geometry/tests/test-window-geometry.h'
--- src/window/geometry/tests/test-window-geometry.h 1970-01-01 00:00:00 +0000
+++ src/window/geometry/tests/test-window-geometry.h 2012-01-11 08:47:28 +0000
@@ -0,0 +1,39 @@
1/*
2 * Copyright © 2011 Canonical Ltd.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without
6 * fee, provided that the above copyright notice appear in all copies
7 * and that both that copyright notice and this permission notice
8 * appear in supporting documentation, and that the name of
9 * Canonical Ltd. not be used in advertising or publicity pertaining to
10 * distribution of the software without specific, written prior permission.
11 * Canonical Ltd. makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without express or
13 * implied warranty.
14 *
15 * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17 * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 *
23 * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com>
24 */
25
26#ifndef _COMPIZ_TEST_WINDOW_GEOMETRY_H
27#define _COMPIZ_TEST_WINDOW_GEOMETRY_H
28
29#include <gtest/gtest.h>
30#include <core/windowgeometry.h>
31#include <core/rect.h>
32#include <iostream>
33#include <boost/bind.hpp>
34
35class CompWindowGeometryTest : public ::testing::Test
36{
37};
38
39#endif
040
=== added directory 'src/window/geometry/tests/window-geometry'
=== added directory 'src/window/geometry/tests/window-geometry/src'
=== added file 'src/window/geometry/tests/window-geometry/src/test-window-geometry.cpp'
--- src/window/geometry/tests/window-geometry/src/test-window-geometry.cpp 1970-01-01 00:00:00 +0000
+++ src/window/geometry/tests/window-geometry/src/test-window-geometry.cpp 2012-01-11 08:47:28 +0000
@@ -0,0 +1,89 @@
1/*
2 * Copyright © 2011 Canonical Ltd.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without
6 * fee, provided that the above copyright notice appear in all copies
7 * and that both that copyright notice and this permission notice
8 * appear in supporting documentation, and that the name of
9 * Canonical Ltd. not be used in advertising or publicity pertaining to
10 * distribution of the software without specific, written prior permission.
11 * Canonical Ltd. makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without express or
13 * implied warranty.
14 *
15 * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17 * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 *
23 * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com>
24 */
25
26#include "test-window-geometry.h"
27
28class CompWindowGeometryTestGeometry :
29 public CompWindowGeometryTest
30{
31 public:
32
33 CompWindowGeometryTestGeometry ();
34 ~CompWindowGeometryTestGeometry ();
35
36 protected:
37
38 compiz::window::Geometry g;
39};
40
41CompWindowGeometryTestGeometry::CompWindowGeometryTestGeometry () :
42 g (50, 100, 200, 300, 5)
43{
44}
45
46CompWindowGeometryTestGeometry::~CompWindowGeometryTestGeometry ()
47{
48}
49
50TEST_F (CompWindowGeometryTestGeometry, TestGeometry)
51{
52
53 /* apply x only */
54 compiz::window::Geometry rg = compiz::window::Geometry ();
55 rg.applyChange (g, CHANGE_X);
56
57 EXPECT_EQ (rg, compiz::window::Geometry (50, 0, 0, 0, 0));
58
59 /* apply y only */
60 rg = compiz::window::Geometry ();
61 rg.applyChange (g, CHANGE_Y);
62
63 EXPECT_EQ (rg, compiz::window::Geometry (0, 100, 0, 0, 0));
64
65 /* apply width only */
66 rg = compiz::window::Geometry ();
67 rg.applyChange (g, CHANGE_WIDTH);
68
69 EXPECT_EQ (rg, compiz::window::Geometry (0, 0, 200, 0, 0));
70
71 /* apply height only */
72 rg = compiz::window::Geometry ();
73 rg.applyChange (g, CHANGE_HEIGHT);
74
75 EXPECT_EQ (rg, compiz::window::Geometry (0, 0, 0, 300, 0));
76
77 /* apply width | height */
78 rg = compiz::window::Geometry ();
79 rg.applyChange (g, CHANGE_WIDTH | CHANGE_HEIGHT);
80
81 EXPECT_EQ (rg, compiz::window::Geometry (0, 0, 200, 300, 0));
82
83 /* change mask for x | y | width | height */
84 rg = compiz::window::Geometry (49, 99, 199, 299, 5);
85 unsigned int mask = rg.changeMask (g);
86
87 EXPECT_EQ (rg, compiz::window::Geometry (49, 99, 199, 299, 5));
88 EXPECT_EQ (mask, CHANGE_X | CHANGE_Y | CHANGE_WIDTH | CHANGE_HEIGHT);
89}

Subscribers

People subscribed via source and target branches