Merge lp:~smspillaz/compiz-core/compiz-core.work_923683 into lp:compiz-core/0.9.5
- compiz-core.work_923683
- Merge into 0.9.5
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Daniel van Vugt | Needs Resubmitting | ||
Alan Griffiths | Needs Fixing | ||
Review via email: mp+90906@code.launchpad.net |
This proposal has been superseded by a proposal from 2012-02-06.
Commit message
Description of the change
A lot of the work that I've wanted to do in order to properly fix this, but in a far more condensed form. (bug 923683). Proposing early so that ~vanvugt will see it :)
Always use the asynchronous codepaths in core. This commit changes the following:
* CompWindow::move is now just a wrapper around CompWindow:
* CompWindow:
* moveNotify is only ever called pre-request to the server in the case of
managed windows (SubstructureRe
the right place) and post ConfigureNotify for override redirect windows
* resizeNotify is always called post ConfigureNotify regardless of whether
or not the window is managed or not
* composite and opengl now use the geometry last sent to the server in order
to compute display matrices and window positions as well as damage regions
* decor now also does the above
* const correctness in include/
* removed priv->width and priv->height , which was just redundant data used for
window shading and honestly, is a ticking time bomb for future maintainers.
* CompWindow:
* Removed the majority of PrivateWindow:
of redundant code which PrivateWindow:
there was to send synthetic ConfigureNotify events to ourselves to notify about windows
moving within frame windows that don't move themselves. Its safer to use reconfigureXWindow
in this case and probably more sane too. We should look into removing the other update* functions.
Caveats:
0) There are no tests yet
1) Window movement performance will regress with this branch. This is *probably* due to the fact that for every slight movement, we send a full ConfigureWindow request to the X Server and it has to post back to us a full ConfigureNotify, for pretty much every pixel the window moves. In the case that we're not doing compositing thats fine, but in every other case its *super* chatty and largely unnecessary. This can probably be optimized a lot, but that will require work to gather up requests that we want to send to the X server - combine them (eg, merging the stack of requests based on the change mask and using the latest values where appropriate). Thats a lot of work and probably not appropriate in this branch
2) The diff is a little big
3) No tests
4) Window shading is more than likely going to break again, mostly because I haven't tested it yet, but also because shading does some strange things and manipulated geometry values in strange ways
5) No tests
Testing plan?
I would imagine here that the PendingConfigur
We'll need to get CompRegion into a testable state though, which is probably easily done.
- 2977. By Sam Spilsbury
-
Dump a bunch of debugging code
- 2978. By Sam Spilsbury
-
Dump more code nobody cares about
- 2979. By Sam Spilsbury
-
Dump more hacks
Sam Spilsbury (smspillaz) wrote : | # |
Sam Spilsbury (smspillaz) wrote : | # |
824 -
825 - if (!pendingConfig
826 - {
827 - /* Tell plugins its ok to start doing stupid things again but
828 - * obviously FIXME */
829 - CompOption::Vector options;
830 - CompOption::Value v;
831 -
832 - options.push_back (CompOption ("window", CompOption:
833 - v.set ((int) id);
834 - options.back ().set (v);
835 - options.push_back (CompOption ("active", CompOption:
836 - v.set ((int) 0);
837 - options.back ().set (v);
838 -
839 - /* Notify other plugins that it is unsafe to change geometry or serverGeometry
840 - * FIXME: That API should not be accessible to plugins, this is a hack to avoid
841 - * breaking ABI */
842 -
843 - screen-
844 - }
DIE
924 -bool
925 -PrivateWindow:
926 -{
927 - if (pendingConfigu
928 - {
929 - /* FIXME: This is a hack to avoid performance regressions
930 - * and must be removed in 0.9.6 */
931 - compLogMessage ("core", CompLogLevelWarn, "failed to receive ConfigureNotify event on 0x%x\n",
932 - id);
933 - pendingConfigur
934 - pendingConfigur
935 - }
936 -
937 - return false;
938 -}
939 -
940 void
941 compiz:
942 {
943 @@ -2454,21 +2148,6 @@
944 mValueMask (valueMask),
945 mXwc (*xwc)
946 {
947 - CompOption::Vector options;
948 - CompOption::Value v;
949 -
950 - options.push_back (CompOption ("window", CompOption:
951 - v.set ((int) w);
952 - options.back ().set (v);
953 - options.push_back (CompOption ("active", CompOption:
954 - v.set ((int) 1);
955 - options.back ().set (v);
956 -
957 - /* Notify other plugins that it is unsafe to change geometry or serverGeometry
958 - * FIXME: That API should not be accessible to plugins, this is a hack to avoid
959 - * breaking ABI */
960 -
961 - screen-
962 }
DIE
Daniel van Vugt (vanvugt) wrote : | # |
GOOD IN THEORY:
* Most of the description sounds like steps in the right direction.
* Simplified: Replacing 559 lines of code with 247.
UNSURE ABOUT THE THEORY:
* "composite and opengl now use the geometry last sent to the server"
This should give maximum performance, sure, but what if (for some reason) the server rejects the configure request as being somehow invalid? Would you ever encounter that, like moving a window to an invalid location?
For stability and correctness (which should be the primary goal right now) don't we want "composite and opengl now use the geometry last received from the server"?
* Caveat #1 is not really a caveat. It's the right (intended) design. But if you want to see a (buggy) example of how to solve the chattiness look at the timer code here:
https:/
This was slightly buggy though as it broke keyboatrd-initiated moves (incorrect pointer warp). Simple to fix, probably.
* Still no XFlush's to ensure XConfigureWindow happens immediately. Or are there adequate XSyncs already?
BAD IN THEORY:
* The diff is too big for a mere mortal (who hasn't worked on all the code before) to fully load into their mental interpreter and evaluate its theoretical correctness. Please read that sentence again; it's important.
GOOD IN PRACTICE:
* Window movement is smooth and predictable, but not really better than in oneiric.
BAD IN PRACTICE:
* The bug introduced is worse than the bug being fixed; Window contents offset from the frame/decorations whenever a window is created or maximized.
* All that code, but we still haven't reduced the lag below oneiric-levels. Still not as good as Gnome Shell.
CONCLUSION:
The theory is mostly good but there is at least one serious bug that needs fixing. We probably shouldn't risk 0.9.7.0 any more with large changes like this. We should aim to get this code into a later release when it's more stable, not 0.9.7.0.
Sam Spilsbury (smspillaz) wrote : | # |
> GOOD IN THEORY:
>
> * Most of the description sounds like steps in the right direction.
>
> * Simplified: Replacing 559 lines of code with 247.
>
>
> UNSURE ABOUT THE THEORY:
>
> * "composite and opengl now use the geometry last sent to the server"
> This should give maximum performance, sure, but what if (for some reason) the
> server rejects the configure request as being somehow invalid? Would you ever
> encounter that, like moving a window to an invalid location?
> For stability and correctness (which should be the primary goal right now)
> don't we want "composite and opengl now use the geometry last received from
> the server"?
See http://
Since we have SubstructureRed
The only error cases I can think of is where you ask for a window to be of a size < 0 or > MAXSHORT. Ideally we should check for that case.
>
> * Caveat #1 is not really a caveat. It's the right (intended) design. But if
> you want to see a (buggy) example of how to solve the chattiness look at the
> timer code here:
> https:/
> This was slightly buggy though as it broke keyboatrd-initiated moves
> (incorrect pointer warp). Simple to fix, probably.
>
There are some optimizations that can be done here - for example, if a window is grabbed, you can withold sending positions to the server until it is ungrabbed, or there is some other reason why you would want to do that. When that happens you can send it all at once.
> * Still no XFlush's to ensure XConfigureWindow happens immediately. Or are
> there adequate XSyncs already?
The GLib mainloop work introduced an XFlush as soon as we have finished dispatching the X event source.
>
>
> BAD IN THEORY:
>
> * The diff is too big for a mere mortal (who hasn't worked on all the code
> before) to fully load into their mental interpreter and evaluate its
> theoretical correctness. Please read that sentence again; it's important.
Indeed. The good thing is that its mostly all deletion and consolidation.
>
>
> GOOD IN PRACTICE:
>
> * Window movement is smooth and predictable, but not really better than in
> oneiric.
>
>
> BAD IN PRACTICE:
>
> * The bug introduced is worse than the bug being fixed; Window contents offset
> from the frame/decorations whenever a window is created or maximized.
Alright. I haven't seen this yet, but I have an idea of what might cause it. Will have a look into it when I get some time.
>
> * All that code, but we still haven't reduced the lag below oneiric-levels.
> Still not as good as Gnome Shell.
This will be fixed once the chattyness goes away. (as above). Watch your X.org CPU usage as you move windows - it skyrockets because at the moment we flood it with requests.
>
>
> CONCLUSION:
>
> The theory is mostly good but there is at least one serious bug that needs
> fixing. We probably shouldn't risk 0.9.7.0 any more with large changes like
> this. We should aim to get this code into a later r...
Alan Griffiths (alan-griffiths) wrote : | # |
OK, I'm still wading through the changes. But I feel like a rant...
1307 CompSize
1308 CompWindow::size () const
1309 {
1310 - return CompSize (priv->width + priv->geometry.
1311 - priv->height + priv->geometry.
1312 + return CompSize (priv->
1313 + priv->geometry.
1314 }
As a change this doesn't look too bad - but it ignores a horrid design!
1. Chained operations like "priv->
That is "priv->width ()" would reflect less coupling.
2. You're tracing the path "priv->geometry..." many times, which suggests that the logic belongs in "geometry".
"return priv->geometry.size ()" or "return CompSize(
So, assuming (because borders may be optional?) that there's an unambiguous mapping from CompWindow:
a. Add a constructor to CompSize: "explicit CompSize(
b. Add an inline method "CompSize PrivateWindow::size () const { return CompSize(
c. Rewrite the above as "CompSize CompWindow::size () const { "return priv->size ()"; }"
Alan Griffiths (alan-griffiths) wrote : | # |
264 - /* been shaded */
265 + /* been shaded
266 if (w->priv->height == 0)
267 {
268 if (w->id () == priv->activeWindow)
269 w->moveInputFocusTo ();
270 - }
271 + }*/
Comments are not for storing old versions of the code - that's what we use bzr for. ;)
Alan Griffiths (alan-griffiths) wrote : | # |
There's a lot of "<blah>.width () + <blah>.border () * 2" and "<blah>.height () + <blah>.border () * 2" around. Surely CompWindow:
I'm tempted by
template<Typename T>
inline int heightWithBorders(T const& blah) { return blah.height () + blah.border () * 2; }
Sam Spilsbury (smspillaz) wrote : | # |
> OK, I'm still wading through the changes. But I feel like a rant...
>
> 1307 CompSize
> 1308 CompWindow::size () const
> 1309 {
> 1310 - return CompSize (priv->width + priv->geometry.
> 1311 - priv->height + priv->geometry.
> 1312 + return CompSize (priv->
> * 2,
> 1313 + priv->geometry.
> 1314 }
>
> As a change this doesn't look too bad - but it ignores a horrid design!
>
> 1. Chained operations like "priv->
> of the details of "priv".
> That is "priv->width ()" would reflect less coupling.
Probably, although priv is just a private member with implementation details, I don't really see this as a large design problem.
>
> 2. You're tracing the path "priv->geometry..." many times, which suggests that
> the logic belongs in "geometry".
> "return priv->geometry.size ()" or "return CompSize(
> reflect better coherence.
>
> So, assuming (because borders may be optional?) that there's an unambiguous
> mapping from CompWindow:
>
> a. Add a constructor to CompSize: "explicit CompSize(
> const& g) : mWidth(g.width () + g.border () * 2) ..."
> b. Add an inline method "CompSize PrivateWindow::size () const { return
> CompSize(
> c. Rewrite the above as "CompSize CompWindow::size () const { "return
> priv->size ()"; }"
+1 for all three
Sam Spilsbury (smspillaz) wrote : | # |
> 264 - /* been shaded */
> 265 + /* been shaded
> 266 if (w->priv->height == 0)
> 267 {
> 268 if (w->id () == priv->activeWindow)
> 269 w->moveInputFocusTo ();
> 270 - }
> 271 + }*/
>
> Comments are not for storing old versions of the code - that's what we use bzr
> for. ;)
Indeed, this is a small portion of the code and I'm not yet sure what to do with it. When I get around to revisiting this section (when I actually get time to look at this again, wanted to get it up for review early) I'll see what can be done.
Sam Spilsbury (smspillaz) wrote : | # |
> There's a lot of "<blah>.width () + <blah>.border () * 2" and "<blah>.height
> () + <blah>.border () * 2" around. Surely CompWindow:
> "widthWithBorders" method - or maybe a free function?
>
> I'm tempted by
>
> template<Typename T>
> inline int heightWithBorders(T const& blah) { return blah.height () +
> blah.border () * 2; }
I'm not really sure ?
The complexity here comes from a legacy part of the X Server coming into play - a window could have fixed dimentions, but also specify a "border" which would be exclusive of the fixed dimentions, so you'd have to take this into account for all positioning operations (Xterm comes to mind here).
I definitely agree that geom.width () + geom.border () * 2 feels fragile and indeed, that has tripped me up many times before. Maybe a default parameter with a bitflag makes sense here, eg IncludeBorder , IncludeBorderFirst , IncludeBorderSecond (as it is on both sides)
Sam Spilsbury (smspillaz) wrote : | # |
I'll note that the above isn't *really* all that relevant to this merge though, but good things to keep in mind in any case. I'd rather not see the diff get any better except for adding tests.
Daniel van Vugt (vanvugt) wrote : | # |
Please resubmit for target branch lp:compiz-core (0.9.7)
- 2980. By Sam Spilsbury
-
Use serverGeometry for rectsToRegion so that there isn't a race condition
when we fetch the shape rectangles from the server and remove a mostly useless
section of configureXWindow - 2981. By Sam Spilsbury
-
Remove commented code, use serverGeometry where appropriate
- 2982. By Sam Spilsbury
-
Remove XSynchronize
- 2983. By Sam Spilsbury
-
Merged from lp:compiz-core
- 2984. By Sam Spilsbury
-
Fix a memory leak in the decor plugin ... use shared_ptr etc
- 2985. By Sam Spilsbury
-
Don't spuriously re-create decorations when we don't need to. Also handle the
race between the decorator and the decor plugin when attempting to bind a pixmap
that hasn't been fully formed yet. (Should really use XSync barriers in future) - 2986. By Sam Spilsbury
-
Merged from lp:compiz-core
- 2987. By Sam Spilsbury
-
Update PrivateWindow:
:isInvisible - 2988. By Sam Spilsbury
-
Also adjust the client position inside the frame whenever the frame value mask
indicates that it might have moved. - 2989. By Sam Spilsbury
-
Added a note for a fixme
- 2990. By Sam Spilsbury
-
Also send moveNotify for override redirect windows
- 2991. By Sam Spilsbury
-
Cleanup, fix removal of XSynchronize and detect error conditions
- 2992. By Sam Spilsbury
-
Fix silly typo
- 2993. By Sam Spilsbury
-
Merge lp:compiz-core
- 2994. By Sam Spilsbury
-
Use reference
- 2995. By Sam Spilsbury
-
Merge trunk
- 2996. By Sam Spilsbury
-
Removed a lot of width () / height () + border () * 2 sillyness, replace with
more sturdy abstraction - 2997. By Sam Spilsbury
-
Fix LP #932520 - Update regions correctly when sending geometry updates
Use information last sent to server to determine window regions and shape
regions, update regions for resizing when we send the information to the server
as the shape rectangles will be correct anyways (even though it costs us a
round trip). - 2998. By Sam Spilsbury
-
Replace instances of geometry with serverGeoemtry where appropriate
- 2999. By Sam Spilsbury
-
Merge lp:compiz-core
- 3000. By Sam Spilsbury
-
Fix typoo
- 3001. By Sam Spilsbury
-
Merge trunk
- 3002. By Sam Spilsbury
-
Remove abi breaks
- 3003. By Sam Spilsbury
-
Don't break abi
- 3004. By Sam Spilsbury
-
Use geometry last sent to server to calculate damage rects
- 3005. By Sam Spilsbury
-
Use server side rects for calculating clip regions
- 3006. By Sam Spilsbury
-
Use serverGeometry
- 3007. By Sam Spilsbury
-
Damage the screen when windows are resized
- 3008. By Sam Spilsbury
-
Style issue
- 3009. By Sam Spilsbury
-
Merged trunk and fixed a number of problems with resize synchronization
- 3010. By Sam Spilsbury
-
Send resize notification immediately for windows that aren't override redirect
- 3011. By Sam Spilsbury
-
Fix jumping around on resize because we were rebinding way too much at the wrong time.
Only rebind on paints.
- 3012. By Sam Spilsbury
-
Don't not update decorations when we're grabbed for resizing
- 3013. By Sam Spilsbury
-
Null check
- 3014. By Sam Spilsbury
-
resize: unconditionally finish the resize operation when releasing the button
- 3015. By Sam Spilsbury
-
Merge trunk
- 3016. By Sam Spilsbury
-
Don't send a moveNotify and resizeNotify if the window was moved and resized
- 3017. By Sam Spilsbury
-
Cleanup wobbly model update code
- 3018. By Sam Spilsbury
-
Ensure that override redirect windows get their regions set correctly.
Also they can't have input extents. - 3019. By Sam Spilsbury
-
Force all override redirect windows to use geometry last received from
server. Force all managed windows to use geometry last sent.The difference between geometry and server* is now moot and can be
removed in a future release - 3020. By Sam Spilsbury
-
Clean some cruft
- 3021. By Sam Spilsbury
-
Update decoration matrix of shaded windows
- 3022. By Sam Spilsbury
-
Send a resizeNotify to indicate to plugins when map operations have completed
- 3023. By Sam Spilsbury
-
Merge lp:compiz-core
- 3024. By Sam Spilsbury
-
Don't notify plugins of unreparent in the right place
- 3025. By Sam Spilsbury
-
Merged lp:~vanvugt/compiz-core/compiz-core/fix-981703-properly
- 3026. By Sam Spilsbury
-
updateState is bitwise, so never clobber it
- 3027. By Sam Spilsbury
-
Base decision to send notifications to plugins on absolute position
changes - 3028. By Sam Spilsbury
-
Don't set height = 0 if the window still has a pixmap
- 3029. By Sam Spilsbury
-
Remove some unnecessary cahgnes in the wobbly plugin
- 3030. By Sam Spilsbury
-
Merge lp:compiz-core
- 3031. By Sam Spilsbury
-
Now that geometry and serverGeometry both return the same thing, the changes
in client code don't make any sense to keep - 3032. By Sam Spilsbury
-
Fix logic errors
- 3033. By Sam Spilsbury
-
!= 0 not necessary
- 3034. By Sam Spilsbury
-
Merge lp:compiz-core
Unmerged revisions
- 3034. By Sam Spilsbury
-
Merge lp:compiz-core
- 3033. By Sam Spilsbury
-
!= 0 not necessary
- 3032. By Sam Spilsbury
-
Fix logic errors
- 3031. By Sam Spilsbury
-
Now that geometry and serverGeometry both return the same thing, the changes
in client code don't make any sense to keep - 3030. By Sam Spilsbury
-
Merge lp:compiz-core
- 3029. By Sam Spilsbury
-
Remove some unnecessary cahgnes in the wobbly plugin
- 3028. By Sam Spilsbury
-
Don't set height = 0 if the window still has a pixmap
- 3027. By Sam Spilsbury
-
Base decision to send notifications to plugins on absolute position
changes - 3026. By Sam Spilsbury
-
updateState is bitwise, so never clobber it
- 3025. By Sam Spilsbury
-
Merged lp:~vanvugt/compiz-core/compiz-core/fix-981703-properly
Preview Diff
1 | === modified file 'include/core/window.h' | |||
2 | --- include/core/window.h 2012-01-20 15:20:44 +0000 | |||
3 | +++ include/core/window.h 2012-01-31 17:22:24 +0000 | |||
4 | @@ -398,9 +398,9 @@ | |||
5 | 398 | 398 | ||
6 | 399 | bool hasUnmapReference (); | 399 | bool hasUnmapReference (); |
7 | 400 | 400 | ||
9 | 401 | bool resize (XWindowAttributes); | 401 | bool resize (const XWindowAttributes &); |
10 | 402 | 402 | ||
12 | 403 | bool resize (Geometry); | 403 | bool resize (const Geometry &); |
13 | 404 | 404 | ||
14 | 405 | bool resize (int x, int y, int width, int height, | 405 | bool resize (int x, int y, int width, int height, |
15 | 406 | int border = 0); | 406 | int border = 0); |
16 | 407 | 407 | ||
17 | === modified file 'plugins/composite/src/window.cpp' | |||
18 | --- plugins/composite/src/window.cpp 2012-01-16 09:50:28 +0000 | |||
19 | +++ plugins/composite/src/window.cpp 2012-01-31 17:22:24 +0000 | |||
20 | @@ -250,7 +250,7 @@ | |||
21 | 250 | 250 | ||
22 | 251 | if (x2 > x1 && y2 > y1) | 251 | if (x2 > x1 && y2 > y1) |
23 | 252 | { | 252 | { |
25 | 253 | CompWindow::Geometry geom = priv->window->geometry (); | 253 | CompWindow::Geometry geom = priv->window->serverGeometry (); |
26 | 254 | 254 | ||
27 | 255 | x1 += geom.x () + geom.border (); | 255 | x1 += geom.x () + geom.border (); |
28 | 256 | y1 += geom.y () + geom.border (); | 256 | y1 += geom.y () + geom.border (); |
29 | @@ -272,20 +272,20 @@ | |||
30 | 272 | { | 272 | { |
31 | 273 | int x1, x2, y1, y2; | 273 | int x1, x2, y1, y2; |
32 | 274 | 274 | ||
35 | 275 | CompWindow::Geometry geom = priv->window->geometry (); | 275 | const CompWindow::Geometry &geom = priv->window->serverGeometry (); |
36 | 276 | CompWindowExtents output = priv->window->output (); | 276 | const CompWindowExtents &output = priv->window->output (); |
37 | 277 | 277 | ||
38 | 278 | /* top */ | 278 | /* top */ |
39 | 279 | x1 = -output.left - geom.border (); | 279 | x1 = -output.left - geom.border (); |
40 | 280 | y1 = -output.top - geom.border (); | 280 | y1 = -output.top - geom.border (); |
42 | 281 | x2 = priv->window->size ().width () + output.right - geom.border (); | 281 | x2 = priv->window->serverGeometry ().width () + geom.border () + output.right; |
43 | 282 | y2 = -geom.border (); | 282 | y2 = -geom.border (); |
44 | 283 | 283 | ||
45 | 284 | if (x1 < x2 && y1 < y2) | 284 | if (x1 < x2 && y1 < y2) |
46 | 285 | addDamageRect (CompRect (x1, y1, x2 - x1, y2 - y1)); | 285 | addDamageRect (CompRect (x1, y1, x2 - x1, y2 - y1)); |
47 | 286 | 286 | ||
48 | 287 | /* bottom */ | 287 | /* bottom */ |
50 | 288 | y1 = priv->window->size ().height () - geom.border (); | 288 | y1 = priv->window->serverGeometry ().height () + geom.border (); |
51 | 289 | y2 = y1 + output.bottom - geom.border (); | 289 | y2 = y1 + output.bottom - geom.border (); |
52 | 290 | 290 | ||
53 | 291 | if (x1 < x2 && y1 < y2) | 291 | if (x1 < x2 && y1 < y2) |
54 | @@ -295,13 +295,13 @@ | |||
55 | 295 | x1 = -output.left - geom.border (); | 295 | x1 = -output.left - geom.border (); |
56 | 296 | y1 = -geom.border (); | 296 | y1 = -geom.border (); |
57 | 297 | x2 = -geom.border (); | 297 | x2 = -geom.border (); |
59 | 298 | y2 = priv->window->size ().height () - geom.border (); | 298 | y2 = priv->window->serverGeometry ().height () - geom.border (); |
60 | 299 | 299 | ||
61 | 300 | if (x1 < x2 && y1 < y2) | 300 | if (x1 < x2 && y1 < y2) |
62 | 301 | addDamageRect (CompRect (x1, y1, x2 - x1, y2 - y1)); | 301 | addDamageRect (CompRect (x1, y1, x2 - x1, y2 - y1)); |
63 | 302 | 302 | ||
64 | 303 | /* right */ | 303 | /* right */ |
66 | 304 | x1 = priv->window->size ().width () - geom.border (); | 304 | x1 = priv->window->serverGeometry ().width () - geom.border (); |
67 | 305 | x2 = x1 + output.right - geom.border (); | 305 | x2 = x1 + output.right - geom.border (); |
68 | 306 | 306 | ||
69 | 307 | if (x1 < x2 && y1 < y2) | 307 | if (x1 < x2 && y1 < y2) |
70 | @@ -322,7 +322,7 @@ | |||
71 | 322 | x = rect.x (); | 322 | x = rect.x (); |
72 | 323 | y = rect.y (); | 323 | y = rect.y (); |
73 | 324 | 324 | ||
75 | 325 | CompWindow::Geometry geom = priv->window->geometry (); | 325 | const CompWindow::Geometry &geom = priv->window->serverGeometry (); |
76 | 326 | x += geom.x () + geom.border (); | 326 | x += geom.x () + geom.border (); |
77 | 327 | y += geom.y () + geom.border (); | 327 | y += geom.y () + geom.border (); |
78 | 328 | 328 | ||
79 | @@ -341,16 +341,16 @@ | |||
80 | 341 | if (priv->window->shaded () || force || | 341 | if (priv->window->shaded () || force || |
81 | 342 | (priv->window->isViewable ())) | 342 | (priv->window->isViewable ())) |
82 | 343 | { | 343 | { |
84 | 344 | int border = priv->window->geometry ().border (); | 344 | int border = priv->window->serverGeometry ().border (); |
85 | 345 | 345 | ||
86 | 346 | int x1 = -MAX (priv->window->output ().left, | 346 | int x1 = -MAX (priv->window->output ().left, |
87 | 347 | priv->window->input ().left) - border; | 347 | priv->window->input ().left) - border; |
88 | 348 | int y1 = -MAX (priv->window->output ().top, | 348 | int y1 = -MAX (priv->window->output ().top, |
89 | 349 | priv->window->input ().top) - border; | 349 | priv->window->input ().top) - border; |
91 | 350 | int x2 = priv->window->size ().width () + | 350 | int x2 = priv->window->serverGeometry ().width () + |
92 | 351 | MAX (priv->window->output ().right, | 351 | MAX (priv->window->output ().right, |
93 | 352 | priv->window->input ().right) ; | 352 | priv->window->input ().right) ; |
95 | 353 | int y2 = priv->window->size ().height () + | 353 | int y2 = priv->window->serverGeometry ().height () + |
96 | 354 | MAX (priv->window->output ().bottom, | 354 | MAX (priv->window->output ().bottom, |
97 | 355 | priv->window->input ().bottom) ; | 355 | priv->window->input ().bottom) ; |
98 | 356 | CompRect r (x1, y1, x2 - x1, y2 - y1); | 356 | CompRect r (x1, y1, x2 - x1, y2 - y1); |
99 | @@ -410,7 +410,7 @@ | |||
100 | 410 | 410 | ||
101 | 411 | if (!w->damageRect (initial, CompRect (x, y, width, height))) | 411 | if (!w->damageRect (initial, CompRect (x, y, width, height))) |
102 | 412 | { | 412 | { |
104 | 413 | CompWindow::Geometry geom = w->priv->window->geometry (); | 413 | CompWindow::Geometry geom = w->priv->window->serverGeometry (); |
105 | 414 | 414 | ||
106 | 415 | x += geom.x () + geom.border (); | 415 | x += geom.x () + geom.border (); |
107 | 416 | y += geom.y () + geom.border (); | 416 | y += geom.y () + geom.border (); |
108 | @@ -622,14 +622,14 @@ | |||
109 | 622 | { | 622 | { |
110 | 623 | int x, y, x1, x2, y1, y2; | 623 | int x, y, x1, x2, y1, y2; |
111 | 624 | 624 | ||
114 | 625 | x = window->geometry ().x (); | 625 | x = window->serverGeometry ().x (); |
115 | 626 | y = window->geometry ().y (); | 626 | y = window->serverGeometry ().y (); |
116 | 627 | 627 | ||
117 | 628 | x1 = x - window->output ().left - dx; | 628 | x1 = x - window->output ().left - dx; |
118 | 629 | y1 = y - window->output ().top - dy; | 629 | y1 = y - window->output ().top - dy; |
120 | 630 | x2 = x + window->size ().width () + | 630 | x2 = x + window->serverGeometry ().width () + |
121 | 631 | window->output ().right - dx; | 631 | window->output ().right - dx; |
123 | 632 | y2 = y + window->size ().height () + | 632 | y2 = y + window->serverGeometry ().height () + |
124 | 633 | window->output ().bottom - dy; | 633 | window->output ().bottom - dy; |
125 | 634 | 634 | ||
126 | 635 | cScreen->damageRegion (CompRegion (CompRect (x1, y1, x2 - x1, y2 - y1))); | 635 | cScreen->damageRegion (CompRegion (CompRect (x1, y1, x2 - x1, y2 - y1))); |
127 | 636 | 636 | ||
128 | === modified file 'plugins/decor/src/decor.cpp' | |||
129 | --- plugins/decor/src/decor.cpp 2012-01-21 19:05:23 +0000 | |||
130 | +++ plugins/decor/src/decor.cpp 2012-01-31 17:22:24 +0000 | |||
131 | @@ -91,7 +91,7 @@ | |||
132 | 91 | void | 91 | void |
133 | 92 | DecorWindow::computeShadowRegion () | 92 | DecorWindow::computeShadowRegion () |
134 | 93 | { | 93 | { |
136 | 94 | shadowRegion = CompRegion (window->outputRect ()); | 94 | shadowRegion = CompRegion (window->serverOutputRect ()); |
137 | 95 | 95 | ||
138 | 96 | if (window->type () == CompWindowTypeDropdownMenuMask || | 96 | if (window->type () == CompWindowTypeDropdownMenuMask || |
139 | 97 | window->type () == CompWindowTypePopupMenuMask) | 97 | window->type () == CompWindowTypePopupMenuMask) |
140 | @@ -142,11 +142,11 @@ | |||
141 | 142 | if (window->type () == CompWindowTypeDropdownMenuMask && | 142 | if (window->type () == CompWindowTypeDropdownMenuMask && |
142 | 143 | shadowRegion == CompRegion (window->outputRect ())) | 143 | shadowRegion == CompRegion (window->outputRect ())) |
143 | 144 | { | 144 | { |
149 | 145 | CompRect area (window->outputRect ().x1 (), | 145 | CompRect area (window->serverOutputRect ().x1 (), |
150 | 146 | window->outputRect ().y1 (), | 146 | window->serverOutputRect ().y1 (), |
151 | 147 | window->outputRect ().width (), | 147 | window->serverOutputRect ().width (), |
152 | 148 | window->inputRect ().y1 () - | 148 | window->serverInputRect ().y1 () - |
153 | 149 | window->outputRect ().y1 ()); | 149 | window->serverOutputRect ().y1 ()); |
154 | 150 | 150 | ||
155 | 151 | shadowRegion = shadowRegion.subtracted (area); | 151 | shadowRegion = shadowRegion.subtracted (area); |
156 | 152 | } | 152 | } |
157 | @@ -1020,8 +1020,8 @@ | |||
158 | 1020 | for (i = 0; i < wd->nQuad; i++) | 1020 | for (i = 0; i < wd->nQuad; i++) |
159 | 1021 | { | 1021 | { |
160 | 1022 | int x, y; | 1022 | int x, y; |
163 | 1023 | unsigned int width = window->size ().width (); | 1023 | unsigned int width = window->geometry ().width (); |
164 | 1024 | unsigned int height = window->size ().height (); | 1024 | unsigned int height = window->geometry ().height (); |
165 | 1025 | 1025 | ||
166 | 1026 | if (window->shaded ()) | 1026 | if (window->shaded ()) |
167 | 1027 | height = 0; | 1027 | height = 0; |
168 | @@ -1030,8 +1030,8 @@ | |||
169 | 1030 | &x1, &y1, &x2, &y2, &sx, &sy); | 1030 | &x1, &y1, &x2, &y2, &sx, &sy); |
170 | 1031 | 1031 | ||
171 | 1032 | /* Translate by x and y points of this window */ | 1032 | /* Translate by x and y points of this window */ |
174 | 1033 | x = window->geometry ().x (); | 1033 | x = window->serverGeometry ().x (); |
175 | 1034 | y = window->geometry ().y (); | 1034 | y = window->serverGeometry ().y (); |
176 | 1035 | 1035 | ||
177 | 1036 | wd->quad[i].box.x1 = x1 + x; | 1036 | wd->quad[i].box.x1 = x1 + x; |
178 | 1037 | wd->quad[i].box.y1 = y1 + y; | 1037 | wd->quad[i].box.y1 = y1 + y; |
179 | @@ -1059,8 +1059,8 @@ | |||
180 | 1059 | bool | 1059 | bool |
181 | 1060 | DecorWindow::checkSize (Decoration *decoration) | 1060 | DecorWindow::checkSize (Decoration *decoration) |
182 | 1061 | { | 1061 | { |
185 | 1062 | return (decoration->minWidth <= (int) window->size ().width () && | 1062 | return (decoration->minWidth <= (int) window->geometry ().width () && |
186 | 1063 | decoration->minHeight <= (int) window->size ().height ()); | 1063 | decoration->minHeight <= (int) window->geometry ().height ()); |
187 | 1064 | } | 1064 | } |
188 | 1065 | 1065 | ||
189 | 1066 | /* | 1066 | /* |
190 | @@ -2054,8 +2054,8 @@ | |||
191 | 2054 | { | 2054 | { |
192 | 2055 | int x, y; | 2055 | int x, y; |
193 | 2056 | 2056 | ||
196 | 2057 | x = window->geometry (). x (); | 2057 | x = window->serverGeometry (). x (); |
197 | 2058 | y = window->geometry (). y (); | 2058 | y = window->serverGeometry (). y (); |
198 | 2059 | 2059 | ||
199 | 2060 | region += frameRegion.translated (x - wd->decor->input.left, | 2060 | region += frameRegion.translated (x - wd->decor->input.left, |
200 | 2061 | y - wd->decor->input.top); | 2061 | y - wd->decor->input.top); |
201 | @@ -2076,7 +2076,7 @@ | |||
202 | 2076 | void | 2076 | void |
203 | 2077 | DecorWindow::updateWindowRegions () | 2077 | DecorWindow::updateWindowRegions () |
204 | 2078 | { | 2078 | { |
206 | 2079 | const CompRect &input (window->inputRect ()); | 2079 | const CompRect &input (window->serverInputRect ()); |
207 | 2080 | 2080 | ||
208 | 2081 | if (regions.size () != gWindow->textures ().size ()) | 2081 | if (regions.size () != gWindow->textures ().size ()) |
209 | 2082 | regions.resize (gWindow->textures ().size ()); | 2082 | regions.resize (gWindow->textures ().size ()); |
210 | 2083 | 2083 | ||
211 | === modified file 'plugins/move/src/move.cpp' | |||
212 | --- plugins/move/src/move.cpp 2012-01-20 14:42:53 +0000 | |||
213 | +++ plugins/move/src/move.cpp 2012-01-31 17:22:24 +0000 | |||
214 | @@ -487,18 +487,8 @@ | |||
215 | 487 | w->move (wX + dx - w->geometry ().x (), | 487 | w->move (wX + dx - w->geometry ().x (), |
216 | 488 | wY + dy - w->geometry ().y (), false); | 488 | wY + dy - w->geometry ().y (), false); |
217 | 489 | 489 | ||
228 | 490 | if (ms->optionGetLazyPositioning () && ms->hasCompositing) | 490 | if (!ms->optionGetLazyPositioning ()) |
219 | 491 | { | ||
220 | 492 | /* FIXME: This form of lazy positioning is broken and should | ||
221 | 493 | be replaced asap. Current code exists just to avoid a | ||
222 | 494 | major performance regression in the 0.5.2 release. */ | ||
223 | 495 | w->serverGeometry ().setX (w->geometry ().x ()); | ||
224 | 496 | w->serverGeometry ().setY (w->geometry ().y ()); | ||
225 | 497 | } | ||
226 | 498 | else | ||
227 | 499 | { | ||
229 | 500 | w->syncPosition (); | 491 | w->syncPosition (); |
230 | 501 | } | ||
231 | 502 | 492 | ||
232 | 503 | ms->x -= dx; | 493 | ms->x -= dx; |
233 | 504 | ms->y -= dy; | 494 | ms->y -= dy; |
234 | 505 | 495 | ||
235 | === modified file 'plugins/opengl/src/window.cpp' | |||
236 | --- plugins/opengl/src/window.cpp 2011-03-11 12:15:30 +0000 | |||
237 | +++ plugins/opengl/src/window.cpp 2012-01-31 17:22:24 +0000 | |||
238 | @@ -76,7 +76,7 @@ | |||
239 | 76 | void | 76 | void |
240 | 77 | PrivateGLWindow::setWindowMatrix () | 77 | PrivateGLWindow::setWindowMatrix () |
241 | 78 | { | 78 | { |
243 | 79 | CompRect input (window->inputRect ()); | 79 | CompRect input (window->serverInputRect ()); |
244 | 80 | 80 | ||
245 | 81 | if (textures.size () != matrices.size ()) | 81 | if (textures.size () != matrices.size ()) |
246 | 82 | matrices.resize (textures.size ()); | 82 | matrices.resize (textures.size ()); |
247 | @@ -344,7 +344,7 @@ | |||
248 | 344 | void | 344 | void |
249 | 345 | PrivateGLWindow::updateWindowRegions () | 345 | PrivateGLWindow::updateWindowRegions () |
250 | 346 | { | 346 | { |
252 | 347 | CompRect input (window->inputRect ()); | 347 | CompRect input (window->serverInputRect ()); |
253 | 348 | 348 | ||
254 | 349 | if (regions.size () != textures.size ()) | 349 | if (regions.size () != textures.size ()) |
255 | 350 | regions.resize (textures.size ()); | 350 | regions.resize (textures.size ()); |
256 | 351 | 351 | ||
257 | === modified file 'src/event.cpp' | |||
258 | --- src/event.cpp 2012-01-19 18:12:31 +0000 | |||
259 | +++ src/event.cpp 2012-01-31 17:22:24 +0000 | |||
260 | @@ -1179,12 +1179,12 @@ | |||
261 | 1179 | w->priv->managed = true; | 1179 | w->priv->managed = true; |
262 | 1180 | } | 1180 | } |
263 | 1181 | 1181 | ||
265 | 1182 | /* been shaded */ | 1182 | /* been shaded |
266 | 1183 | if (w->priv->height == 0) | 1183 | if (w->priv->height == 0) |
267 | 1184 | { | 1184 | { |
268 | 1185 | if (w->id () == priv->activeWindow) | 1185 | if (w->id () == priv->activeWindow) |
269 | 1186 | w->moveInputFocusTo (); | 1186 | w->moveInputFocusTo (); |
271 | 1187 | } | 1187 | }*/ |
272 | 1188 | 1188 | ||
273 | 1189 | w->map (); | 1189 | w->map (); |
274 | 1190 | } | 1190 | } |
275 | 1191 | 1191 | ||
276 | === modified file 'src/privatewindow.h' | |||
277 | --- src/privatewindow.h 2011-10-10 14:56:06 +0000 | |||
278 | +++ src/privatewindow.h 2012-01-31 17:22:24 +0000 | |||
279 | @@ -36,8 +36,8 @@ | |||
280 | 36 | 36 | ||
281 | 37 | #define WINDOW_INVISIBLE(w) \ | 37 | #define WINDOW_INVISIBLE(w) \ |
282 | 38 | ((w)->attrib.map_state != IsViewable || \ | 38 | ((w)->attrib.map_state != IsViewable || \ |
285 | 39 | (w)->attrib.x + (w)->width + (w)->output.right <= 0 || \ | 39 | (w)->attrib.x + (w)->geometry.width () + (w)->output.right <= 0 || \ |
286 | 40 | (w)->attrib.y + (w)->height + (w)->output.bottom <= 0 || \ | 40 | (w)->attrib.y + (w)->geometry.height () + (w)->output.bottom <= 0 || \ |
287 | 41 | (w)->attrib.x - (w)->output.left >= (int) screen->width () || \ | 41 | (w)->attrib.x - (w)->output.left >= (int) screen->width () || \ |
288 | 42 | (w)->attrib.y - (w)->output.top >= (int) screen->height () ) | 42 | (w)->attrib.y - (w)->output.top >= (int) screen->height () ) |
289 | 43 | 43 | ||
290 | @@ -171,6 +171,11 @@ | |||
291 | 171 | 171 | ||
292 | 172 | bool handleSyncAlarm (); | 172 | bool handleSyncAlarm (); |
293 | 173 | 173 | ||
294 | 174 | void move (int dx, int dy, bool sync); | ||
295 | 175 | bool resize (int dx, int dy, int dwidth, int dheight, int dborder); | ||
296 | 176 | bool resize (const CompWindow::Geometry &g); | ||
297 | 177 | bool resize (const XWindowAttributes &attrib); | ||
298 | 178 | |||
299 | 174 | void configure (XConfigureEvent *ce); | 179 | void configure (XConfigureEvent *ce); |
300 | 175 | 180 | ||
301 | 176 | void configureFrame (XConfigureEvent *ce); | 181 | void configureFrame (XConfigureEvent *ce); |
302 | @@ -211,8 +216,6 @@ | |||
303 | 211 | 216 | ||
304 | 212 | void readIconHint (); | 217 | void readIconHint (); |
305 | 213 | 218 | ||
306 | 214 | bool checkClear (); | ||
307 | 215 | |||
308 | 216 | public: | 219 | public: |
309 | 217 | 220 | ||
310 | 218 | PrivateWindow *priv; | 221 | PrivateWindow *priv; |
311 | @@ -244,13 +247,8 @@ | |||
312 | 244 | XSizeHints sizeHints; | 247 | XSizeHints sizeHints; |
313 | 245 | XWMHints *hints; | 248 | XWMHints *hints; |
314 | 246 | 249 | ||
315 | 247 | struct timeval lastGeometryUpdate; | ||
316 | 248 | struct timeval lastConfigureRequest; | ||
317 | 249 | |||
318 | 250 | bool inputHint; | 250 | bool inputHint; |
322 | 251 | bool alpha; | 251 | bool alpha;; |
320 | 252 | int width; | ||
321 | 253 | int height; | ||
323 | 254 | CompRegion region; | 252 | CompRegion region; |
324 | 255 | CompRegion inputRegion; | 253 | CompRegion inputRegion; |
325 | 256 | CompRegion frameRegion; | 254 | CompRegion frameRegion; |
326 | @@ -293,8 +291,6 @@ | |||
327 | 293 | typedef std::pair <XWindowChanges, unsigned int> XWCValueMask; | 291 | typedef std::pair <XWindowChanges, unsigned int> XWCValueMask; |
328 | 294 | 292 | ||
329 | 295 | compiz::X11::PendingEventQueue pendingConfigures; | 293 | compiz::X11::PendingEventQueue pendingConfigures; |
330 | 296 | CompTimer mClearCheckTimeout; | ||
331 | 297 | bool pendingPositionUpdates; | ||
332 | 298 | 294 | ||
333 | 299 | char *startupId; | 295 | char *startupId; |
334 | 300 | char *resName; | 296 | char *resName; |
335 | @@ -330,6 +326,8 @@ | |||
336 | 330 | 326 | ||
337 | 331 | bool closeRequests; | 327 | bool closeRequests; |
338 | 332 | Time lastCloseRequestTime; | 328 | Time lastCloseRequestTime; |
339 | 329 | |||
340 | 330 | bool nextMoveImmediate; | ||
341 | 333 | }; | 331 | }; |
342 | 334 | 332 | ||
343 | 335 | class CoreWindow | 333 | class CoreWindow |
344 | 336 | 334 | ||
345 | === modified file 'src/window.cpp' | |||
346 | --- src/window.cpp 2012-01-25 09:20:47 +0000 | |||
347 | +++ src/window.cpp 2012-01-31 17:22:24 +0000 | |||
348 | @@ -798,292 +798,14 @@ | |||
349 | 798 | if (!serverFrame) | 798 | if (!serverFrame) |
350 | 799 | return; | 799 | return; |
351 | 800 | 800 | ||
638 | 801 | 801 | xwc.x = serverGeometry.x (); | |
639 | 802 | gettimeofday (&lastConfigureRequest, NULL); | 802 | xwc.y = serverGeometry.y (); |
640 | 803 | /* Flush any changes made to serverFrameGeometry or serverGeometry to the server | 803 | xwc.width = serverGeometry.width (); |
641 | 804 | * since there is a race condition where geometries will go out-of-sync with | 804 | xwc.height = serverGeometry.height (); |
642 | 805 | * window movement */ | 805 | xwc.border_width = serverGeometry.border (); |
643 | 806 | 806 | ||
644 | 807 | window->syncPosition (); | 807 | window->configureXWindow (valueMask, &xwc); |
645 | 808 | 808 | window->windowNotify (CompWindowNotifyFrameUpdate); | |
360 | 809 | if (serverInput.left || serverInput.right || serverInput.top || serverInput.bottom) | ||
361 | 810 | { | ||
362 | 811 | int bw = serverGeometry.border () * 2; | ||
363 | 812 | |||
364 | 813 | xwc.x = serverGeometry.x () - serverInput.left; | ||
365 | 814 | xwc.y = serverGeometry.y () - serverInput.top; | ||
366 | 815 | xwc.width = serverGeometry.width () + serverInput.left + serverInput.right + bw; | ||
367 | 816 | if (shaded) | ||
368 | 817 | xwc.height = serverInput.top + serverInput.bottom + bw; | ||
369 | 818 | else | ||
370 | 819 | xwc.height = serverGeometry.height () + serverInput.top + serverInput.bottom + bw; | ||
371 | 820 | |||
372 | 821 | if (shaded) | ||
373 | 822 | height = serverInput.top + serverInput.bottom; | ||
374 | 823 | |||
375 | 824 | if (serverFrameGeometry.x () == xwc.x) | ||
376 | 825 | valueMask &= ~(CWX); | ||
377 | 826 | else | ||
378 | 827 | serverFrameGeometry.setX (xwc.x); | ||
379 | 828 | |||
380 | 829 | if (serverFrameGeometry.y () == xwc.y) | ||
381 | 830 | valueMask &= ~(CWY); | ||
382 | 831 | else | ||
383 | 832 | serverFrameGeometry.setY (xwc.y); | ||
384 | 833 | |||
385 | 834 | if (serverFrameGeometry.width () == xwc.width) | ||
386 | 835 | valueMask &= ~(CWWidth); | ||
387 | 836 | else | ||
388 | 837 | serverFrameGeometry.setWidth (xwc.width); | ||
389 | 838 | |||
390 | 839 | if (serverFrameGeometry.height () == xwc.height) | ||
391 | 840 | valueMask &= ~(CWHeight); | ||
392 | 841 | else | ||
393 | 842 | serverFrameGeometry.setHeight (xwc.height); | ||
394 | 843 | |||
395 | 844 | /* Geometry is the same, so we're not going to get a ConfigureNotify | ||
396 | 845 | * event when the window is configured, which means that other plugins | ||
397 | 846 | * won't know that the client, frame and wrapper windows got shifted | ||
398 | 847 | * around (and might result in display corruption, eg in OpenGL */ | ||
399 | 848 | if (valueMask == 0) | ||
400 | 849 | { | ||
401 | 850 | XConfigureEvent xev; | ||
402 | 851 | XWindowAttributes attrib; | ||
403 | 852 | unsigned int nchildren = 0; | ||
404 | 853 | Window rootRet = 0, parentRet = 0; | ||
405 | 854 | Window *children = NULL; | ||
406 | 855 | |||
407 | 856 | xev.type = ConfigureNotify; | ||
408 | 857 | xev.event = screen->root (); | ||
409 | 858 | xev.window = priv->serverFrame; | ||
410 | 859 | |||
411 | 860 | XGrabServer (screen->dpy ()); | ||
412 | 861 | |||
413 | 862 | if (XGetWindowAttributes (screen->dpy (), priv->serverFrame, &attrib)) | ||
414 | 863 | { | ||
415 | 864 | xev.x = attrib.x; | ||
416 | 865 | xev.y = attrib.y; | ||
417 | 866 | xev.width = attrib.width; | ||
418 | 867 | xev.height = attrib.height; | ||
419 | 868 | xev.border_width = attrib.border_width; | ||
420 | 869 | xev.above = None; | ||
421 | 870 | |||
422 | 871 | /* We need to ensure that the stacking order is | ||
423 | 872 | * based on the current server stacking order so | ||
424 | 873 | * find the sibling to this window's frame in the | ||
425 | 874 | * server side stack and stack above that */ | ||
426 | 875 | XQueryTree (screen->dpy (), screen->root (), &rootRet, &parentRet, &children, &nchildren); | ||
427 | 876 | |||
428 | 877 | if (nchildren) | ||
429 | 878 | { | ||
430 | 879 | for (unsigned int i = 0; i < nchildren; i++) | ||
431 | 880 | { | ||
432 | 881 | if (i + 1 == nchildren || | ||
433 | 882 | children[i + 1] == ROOTPARENT (window)) | ||
434 | 883 | { | ||
435 | 884 | xev.above = children[i]; | ||
436 | 885 | break; | ||
437 | 886 | } | ||
438 | 887 | } | ||
439 | 888 | } | ||
440 | 889 | |||
441 | 890 | if (children) | ||
442 | 891 | XFree (children); | ||
443 | 892 | |||
444 | 893 | if (!xev.above) | ||
445 | 894 | xev.above = (window->serverPrev) ? ROOTPARENT (window->serverPrev) : None; | ||
446 | 895 | |||
447 | 896 | xev.override_redirect = priv->attrib.override_redirect; | ||
448 | 897 | |||
449 | 898 | } | ||
450 | 899 | |||
451 | 900 | compiz::X11::PendingEvent::Ptr pc = | ||
452 | 901 | boost::shared_static_cast<compiz::X11::PendingEvent> (compiz::X11::PendingConfigureEvent::Ptr ( | ||
453 | 902 | new compiz::X11::PendingConfigureEvent ( | ||
454 | 903 | screen->dpy (), serverFrame, valueMask, &xwc))); | ||
455 | 904 | |||
456 | 905 | pendingConfigures.add (pc); | ||
457 | 906 | if (priv->mClearCheckTimeout.active ()) | ||
458 | 907 | priv->mClearCheckTimeout.stop (); | ||
459 | 908 | priv->mClearCheckTimeout.start (boost::bind (&PrivateWindow::checkClear, priv), | ||
460 | 909 | 2000, 2500); | ||
461 | 910 | |||
462 | 911 | XSendEvent (screen->dpy (), screen->root (), false, | ||
463 | 912 | SubstructureNotifyMask, (XEvent *) &xev); | ||
464 | 913 | |||
465 | 914 | XUngrabServer (screen->dpy ()); | ||
466 | 915 | XSync (screen->dpy (), false); | ||
467 | 916 | } | ||
468 | 917 | else | ||
469 | 918 | { | ||
470 | 919 | compiz::X11::PendingEvent::Ptr pc = | ||
471 | 920 | boost::shared_static_cast<compiz::X11::PendingEvent> (compiz::X11::PendingConfigureEvent::Ptr ( | ||
472 | 921 | new compiz::X11::PendingConfigureEvent ( | ||
473 | 922 | screen->dpy (), serverFrame, valueMask, &xwc))); | ||
474 | 923 | |||
475 | 924 | pendingConfigures.add (pc); | ||
476 | 925 | if (priv->mClearCheckTimeout.active ()) | ||
477 | 926 | priv->mClearCheckTimeout.stop (); | ||
478 | 927 | priv->mClearCheckTimeout.start (boost::bind (&PrivateWindow::checkClear, priv), | ||
479 | 928 | 2000, 2500); | ||
480 | 929 | XConfigureWindow (screen->dpy (), serverFrame, valueMask, &xwc); | ||
481 | 930 | } | ||
482 | 931 | |||
483 | 932 | if (shaded) | ||
484 | 933 | { | ||
485 | 934 | XUnmapWindow (screen->dpy (), wrapper); | ||
486 | 935 | } | ||
487 | 936 | else | ||
488 | 937 | { | ||
489 | 938 | XMapWindow (screen->dpy (), wrapper); | ||
490 | 939 | XMoveResizeWindow (screen->dpy (), wrapper, serverInput.left, serverInput.top, | ||
491 | 940 | serverGeometry.width (), serverGeometry.height ()); | ||
492 | 941 | } | ||
493 | 942 | XMoveResizeWindow (screen->dpy (), id, 0, 0, | ||
494 | 943 | serverGeometry.width (), serverGeometry.height ()); | ||
495 | 944 | window->sendConfigureNotify (); | ||
496 | 945 | window->windowNotify (CompWindowNotifyFrameUpdate); | ||
497 | 946 | } | ||
498 | 947 | else | ||
499 | 948 | { | ||
500 | 949 | int bw = serverGeometry.border () * 2; | ||
501 | 950 | |||
502 | 951 | xwc.x = serverGeometry.x (); | ||
503 | 952 | xwc.y = serverGeometry.y (); | ||
504 | 953 | xwc.width = serverGeometry.width () + bw; | ||
505 | 954 | |||
506 | 955 | /* FIXME: It doesn't make much sense to allow undecorated windows to be | ||
507 | 956 | * shaded */ | ||
508 | 957 | if (shaded) | ||
509 | 958 | xwc.height = bw; | ||
510 | 959 | else | ||
511 | 960 | xwc.height = serverGeometry.height () + bw; | ||
512 | 961 | |||
513 | 962 | if (serverFrameGeometry.x () == xwc.x) | ||
514 | 963 | valueMask &= ~(CWX); | ||
515 | 964 | else | ||
516 | 965 | serverFrameGeometry.setX (xwc.x); | ||
517 | 966 | |||
518 | 967 | if (serverFrameGeometry.y () == xwc.y) | ||
519 | 968 | valueMask &= ~(CWY); | ||
520 | 969 | else | ||
521 | 970 | serverFrameGeometry.setY (xwc.y); | ||
522 | 971 | |||
523 | 972 | if (serverFrameGeometry.width () == xwc.width) | ||
524 | 973 | valueMask &= ~(CWWidth); | ||
525 | 974 | else | ||
526 | 975 | serverFrameGeometry.setWidth (xwc.width); | ||
527 | 976 | |||
528 | 977 | if (serverFrameGeometry.height () == xwc.height) | ||
529 | 978 | valueMask &= ~(CWHeight); | ||
530 | 979 | else | ||
531 | 980 | serverFrameGeometry.setHeight (xwc.height); | ||
532 | 981 | |||
533 | 982 | /* Geometry is the same, so we're not going to get a ConfigureNotify | ||
534 | 983 | * event when the window is configured, which means that other plugins | ||
535 | 984 | * won't know that the client, frame and wrapper windows got shifted | ||
536 | 985 | * around (and might result in display corruption, eg in OpenGL */ | ||
537 | 986 | if (valueMask == 0) | ||
538 | 987 | { | ||
539 | 988 | XConfigureEvent xev; | ||
540 | 989 | XWindowAttributes attrib; | ||
541 | 990 | unsigned int nchildren = 0; | ||
542 | 991 | Window rootRet = 0, parentRet = 0; | ||
543 | 992 | Window *children = NULL; | ||
544 | 993 | |||
545 | 994 | xev.type = ConfigureNotify; | ||
546 | 995 | xev.event = screen->root (); | ||
547 | 996 | xev.window = priv->serverFrame; | ||
548 | 997 | |||
549 | 998 | XGrabServer (screen->dpy ()); | ||
550 | 999 | |||
551 | 1000 | if (XGetWindowAttributes (screen->dpy (), priv->serverFrame, &attrib)) | ||
552 | 1001 | { | ||
553 | 1002 | xev.x = attrib.x; | ||
554 | 1003 | xev.y = attrib.y; | ||
555 | 1004 | xev.width = attrib.width; | ||
556 | 1005 | xev.height = attrib.height; | ||
557 | 1006 | xev.border_width = attrib.border_width; | ||
558 | 1007 | xev.above = None; | ||
559 | 1008 | |||
560 | 1009 | /* We need to ensure that the stacking order is | ||
561 | 1010 | * based on the current server stacking order so | ||
562 | 1011 | * find the sibling to this window's frame in the | ||
563 | 1012 | * server side stack and stack above that */ | ||
564 | 1013 | XQueryTree (screen->dpy (), screen->root (), &rootRet, &parentRet, &children, &nchildren); | ||
565 | 1014 | |||
566 | 1015 | if (nchildren) | ||
567 | 1016 | { | ||
568 | 1017 | for (unsigned int i = 0; i < nchildren; i++) | ||
569 | 1018 | { | ||
570 | 1019 | if (i + 1 == nchildren || | ||
571 | 1020 | children[i + 1] == ROOTPARENT (window)) | ||
572 | 1021 | { | ||
573 | 1022 | xev.above = children[i]; | ||
574 | 1023 | break; | ||
575 | 1024 | } | ||
576 | 1025 | } | ||
577 | 1026 | } | ||
578 | 1027 | |||
579 | 1028 | if (children) | ||
580 | 1029 | XFree (children); | ||
581 | 1030 | |||
582 | 1031 | if (!xev.above) | ||
583 | 1032 | xev.above = (window->serverPrev) ? ROOTPARENT (window->serverPrev) : None; | ||
584 | 1033 | |||
585 | 1034 | xev.override_redirect = priv->attrib.override_redirect; | ||
586 | 1035 | |||
587 | 1036 | } | ||
588 | 1037 | |||
589 | 1038 | compiz::X11::PendingEvent::Ptr pc = | ||
590 | 1039 | boost::shared_static_cast<compiz::X11::PendingEvent> (compiz::X11::PendingConfigureEvent::Ptr ( | ||
591 | 1040 | new compiz::X11::PendingConfigureEvent ( | ||
592 | 1041 | screen->dpy (), serverFrame, valueMask, &xwc))); | ||
593 | 1042 | |||
594 | 1043 | pendingConfigures.add (pc); | ||
595 | 1044 | if (priv->mClearCheckTimeout.active ()) | ||
596 | 1045 | priv->mClearCheckTimeout.stop (); | ||
597 | 1046 | priv->mClearCheckTimeout.start (boost::bind (&PrivateWindow::checkClear, priv), | ||
598 | 1047 | 2000, 2500); | ||
599 | 1048 | |||
600 | 1049 | XSendEvent (screen->dpy (), screen->root (), false, | ||
601 | 1050 | SubstructureNotifyMask, (XEvent *) &xev); | ||
602 | 1051 | |||
603 | 1052 | XUngrabServer (screen->dpy ()); | ||
604 | 1053 | XSync (screen->dpy (), false); | ||
605 | 1054 | } | ||
606 | 1055 | else | ||
607 | 1056 | { | ||
608 | 1057 | compiz::X11::PendingEvent::Ptr pc = | ||
609 | 1058 | boost::shared_static_cast<compiz::X11::PendingEvent> (compiz::X11::PendingConfigureEvent::Ptr ( | ||
610 | 1059 | new compiz::X11::PendingConfigureEvent ( | ||
611 | 1060 | screen->dpy (), serverFrame, valueMask, &xwc))); | ||
612 | 1061 | |||
613 | 1062 | pendingConfigures.add (pc); | ||
614 | 1063 | if (priv->mClearCheckTimeout.active ()) | ||
615 | 1064 | priv->mClearCheckTimeout.stop (); | ||
616 | 1065 | priv->mClearCheckTimeout.start (boost::bind (&PrivateWindow::checkClear, priv), | ||
617 | 1066 | 2000, 2500); | ||
618 | 1067 | |||
619 | 1068 | XConfigureWindow (screen->dpy (), serverFrame, valueMask, &xwc); | ||
620 | 1069 | } | ||
621 | 1070 | |||
622 | 1071 | if (shaded) | ||
623 | 1072 | { | ||
624 | 1073 | XUnmapWindow (screen->dpy (), wrapper); | ||
625 | 1074 | } | ||
626 | 1075 | else | ||
627 | 1076 | { | ||
628 | 1077 | XMapWindow (screen->dpy (), wrapper); | ||
629 | 1078 | XMoveResizeWindow (screen->dpy (), wrapper, 0, 0, | ||
630 | 1079 | serverGeometry.width (), serverGeometry.height ()); | ||
631 | 1080 | } | ||
632 | 1081 | |||
633 | 1082 | XMoveResizeWindow (screen->dpy (), id, 0, 0, | ||
634 | 1083 | serverGeometry.width (), serverGeometry.height ()); | ||
635 | 1084 | window->sendConfigureNotify (); | ||
636 | 1085 | window->windowNotify (CompWindowNotifyFrameUpdate); | ||
637 | 1086 | } | ||
646 | 1087 | window->recalcActions (); | 809 | window->recalcActions (); |
647 | 1088 | } | 810 | } |
648 | 1089 | 811 | ||
649 | @@ -1135,10 +857,10 @@ | |||
650 | 1135 | x1 = 0; | 857 | x1 = 0; |
651 | 1136 | if (y1 < 0) | 858 | if (y1 < 0) |
652 | 1137 | y1 = 0; | 859 | y1 = 0; |
657 | 1138 | if (x2 > priv->width) | 860 | if (x2 > priv->geometry.width ()) |
658 | 1139 | x2 = priv->width; | 861 | x2 = priv->geometry.height (); |
659 | 1140 | if (y2 > priv->height) | 862 | if (y2 > priv->geometry.width ()) |
660 | 1141 | y2 = priv->height; | 863 | y2 = priv->geometry.height (); |
661 | 1142 | 864 | ||
662 | 1143 | if (y1 < y2 && x1 < x2) | 865 | if (y1 < y2 && x1 < x2) |
663 | 1144 | { | 866 | { |
664 | @@ -1182,8 +904,8 @@ | |||
665 | 1182 | 904 | ||
666 | 1183 | r.x = -priv->geometry.border (); | 905 | r.x = -priv->geometry.border (); |
667 | 1184 | r.y = -priv->geometry.border (); | 906 | r.y = -priv->geometry.border (); |
670 | 1185 | r.width = priv->width + priv->geometry.border (); | 907 | r.width = priv->geometry.width () + priv->geometry.border (); |
671 | 1186 | r.height = priv->height + priv->geometry.border (); | 908 | r.height = priv->geometry.height () + priv->geometry.border (); |
672 | 1187 | 909 | ||
673 | 1188 | if (nBounding < 1) | 910 | if (nBounding < 1) |
674 | 1189 | { | 911 | { |
675 | @@ -1716,7 +1438,7 @@ | |||
676 | 1716 | priv->attrib.map_state = IsUnmapped; | 1438 | priv->attrib.map_state = IsUnmapped; |
677 | 1717 | priv->invisible = true; | 1439 | priv->invisible = true; |
678 | 1718 | 1440 | ||
680 | 1719 | if (priv->shaded && priv->height) | 1441 | if (priv->shaded && priv->geometry.height ()) |
681 | 1720 | { | 1442 | { |
682 | 1721 | priv->updateFrameWindow (); | 1443 | priv->updateFrameWindow (); |
683 | 1722 | } | 1444 | } |
684 | @@ -1784,7 +1506,7 @@ | |||
685 | 1784 | } | 1506 | } |
686 | 1785 | 1507 | ||
687 | 1786 | bool | 1508 | bool |
689 | 1787 | CompWindow::resize (XWindowAttributes attr) | 1509 | CompWindow::resize (const XWindowAttributes &attr) |
690 | 1788 | { | 1510 | { |
691 | 1789 | return resize (Geometry (attr.x, attr.y, attr.width, attr.height, | 1511 | return resize (Geometry (attr.x, attr.y, attr.width, attr.height, |
692 | 1790 | attr.border_width)); | 1512 | attr.border_width)); |
693 | @@ -1801,7 +1523,7 @@ | |||
694 | 1801 | } | 1523 | } |
695 | 1802 | 1524 | ||
696 | 1803 | bool | 1525 | bool |
698 | 1804 | CompWindow::resize (CompWindow::Geometry gm) | 1526 | PrivateWindow::resize (const CompWindow::Geometry &gm) |
699 | 1805 | { | 1527 | { |
700 | 1806 | /* Input extents are now the last thing sent | 1528 | /* Input extents are now the last thing sent |
701 | 1807 | * from the server. This might not work in some | 1529 | * from the server. This might not work in some |
702 | @@ -1818,12 +1540,8 @@ | |||
703 | 1818 | priv->geometry.height () != gm.height () || | 1540 | priv->geometry.height () != gm.height () || |
704 | 1819 | priv->geometry.border () != gm.border ()) | 1541 | priv->geometry.border () != gm.border ()) |
705 | 1820 | { | 1542 | { |
706 | 1821 | int pw, ph; | ||
707 | 1822 | int dx, dy, dwidth, dheight; | 1543 | int dx, dy, dwidth, dheight; |
708 | 1823 | 1544 | ||
709 | 1824 | pw = gm.width () + gm.border () * 2; | ||
710 | 1825 | ph = gm.height () + gm.border () * 2; | ||
711 | 1826 | |||
712 | 1827 | dx = gm.x () - priv->geometry.x (); | 1545 | dx = gm.x () - priv->geometry.x (); |
713 | 1828 | dy = gm.y () - priv->geometry.y (); | 1546 | dy = gm.y () - priv->geometry.y (); |
714 | 1829 | dwidth = gm.width () - priv->geometry.width (); | 1547 | dwidth = gm.width () - priv->geometry.width (); |
715 | @@ -1833,37 +1551,60 @@ | |||
716 | 1833 | gm.width (), gm.height (), | 1551 | gm.width (), gm.height (), |
717 | 1834 | gm.border ()); | 1552 | gm.border ()); |
718 | 1835 | 1553 | ||
721 | 1836 | priv->width = pw; | 1554 | if (priv->attrib.override_redirect) |
722 | 1837 | priv->height = ph; | 1555 | { |
723 | 1556 | priv->serverGeometry = priv->geometry; | ||
724 | 1557 | priv->serverFrameGeometry = priv->frameGeometry; | ||
725 | 1558 | } | ||
726 | 1838 | 1559 | ||
727 | 1839 | if (priv->mapNum) | 1560 | if (priv->mapNum) |
728 | 1840 | priv->updateRegion (); | 1561 | priv->updateRegion (); |
729 | 1841 | 1562 | ||
731 | 1842 | resizeNotify (dx, dy, dwidth, dheight); | 1563 | window->resizeNotify (dx, dy, dwidth, dheight); |
732 | 1843 | 1564 | ||
733 | 1844 | priv->invisible = WINDOW_INVISIBLE (priv); | 1565 | priv->invisible = WINDOW_INVISIBLE (priv); |
734 | 1845 | } | 1566 | } |
735 | 1846 | else if (priv->geometry.x () != gm.x () || priv->geometry.y () != gm.y ()) | 1567 | else if (priv->geometry.x () != gm.x () || priv->geometry.y () != gm.y ()) |
736 | 1847 | { | 1568 | { |
753 | 1848 | int dx, dy; | 1569 | move (gm.x () - priv->geometry.x (), |
754 | 1849 | 1570 | gm.y () - priv->geometry.y (), true); | |
739 | 1850 | dx = gm.x () - priv->geometry.x (); | ||
740 | 1851 | dy = gm.y () - priv->geometry.y (); | ||
741 | 1852 | |||
742 | 1853 | priv->geometry.setX (gm.x ()); | ||
743 | 1854 | priv->geometry.setY (gm.y ()); | ||
744 | 1855 | |||
745 | 1856 | priv->region.translate (dx, dy); | ||
746 | 1857 | priv->inputRegion.translate (dx, dy); | ||
747 | 1858 | if (!priv->frameRegion.isEmpty ()) | ||
748 | 1859 | priv->frameRegion.translate (dx, dy); | ||
749 | 1860 | |||
750 | 1861 | priv->invisible = WINDOW_INVISIBLE (priv); | ||
751 | 1862 | |||
752 | 1863 | moveNotify (dx, dy, true); | ||
755 | 1864 | } | 1571 | } |
756 | 1865 | 1572 | ||
758 | 1866 | updateFrameRegion (); | 1573 | window->updateFrameRegion (); |
759 | 1574 | |||
760 | 1575 | return true; | ||
761 | 1576 | } | ||
762 | 1577 | |||
763 | 1578 | bool | ||
764 | 1579 | PrivateWindow::resize (const XWindowAttributes &attr) | ||
765 | 1580 | { | ||
766 | 1581 | return resize (CompWindow::Geometry (attr.x, attr.y, attr.width, attr.height, | ||
767 | 1582 | attr.border_width)); | ||
768 | 1583 | } | ||
769 | 1584 | |||
770 | 1585 | bool | ||
771 | 1586 | PrivateWindow::resize (int x, | ||
772 | 1587 | int y, | ||
773 | 1588 | int width, | ||
774 | 1589 | int height, | ||
775 | 1590 | int border) | ||
776 | 1591 | { | ||
777 | 1592 | return resize (CompWindow::Geometry (x, y, width, height, border)); | ||
778 | 1593 | } | ||
779 | 1594 | |||
780 | 1595 | bool | ||
781 | 1596 | CompWindow::resize (const CompWindow::Geometry &gm) | ||
782 | 1597 | { | ||
783 | 1598 | XWindowChanges xwc = XWINDOWCHANGES_INIT; | ||
784 | 1599 | unsigned int valueMask = CWX | CWY | CWWidth | CWHeight | CWBorderWidth; | ||
785 | 1600 | |||
786 | 1601 | xwc.x = gm.x (); | ||
787 | 1602 | xwc.y = gm.y (); | ||
788 | 1603 | xwc.width = gm.width (); | ||
789 | 1604 | xwc.height = gm.height (); | ||
790 | 1605 | xwc.border_width = gm.border (); | ||
791 | 1606 | |||
792 | 1607 | configureXWindow (valueMask, &xwc); | ||
793 | 1867 | 1608 | ||
794 | 1868 | return true; | 1609 | return true; |
795 | 1869 | } | 1610 | } |
796 | @@ -2031,13 +1772,7 @@ | |||
797 | 2031 | ce->border_width); | 1772 | ce->border_width); |
798 | 2032 | else | 1773 | else |
799 | 2033 | { | 1774 | { |
807 | 2034 | if (ce->override_redirect) | 1775 | resize (ce->x, ce->y, ce->width, ce->height, ce->border_width); |
801 | 2035 | { | ||
802 | 2036 | priv->serverGeometry.set (ce->x, ce->y, ce->width, ce->height, | ||
803 | 2037 | ce->border_width); | ||
804 | 2038 | } | ||
805 | 2039 | |||
806 | 2040 | window->resize (ce->x, ce->y, ce->width, ce->height, ce->border_width); | ||
808 | 2041 | } | 1776 | } |
809 | 2042 | 1777 | ||
810 | 2043 | if (ce->event == screen->root ()) | 1778 | if (ce->event == screen->root ()) |
811 | @@ -2118,7 +1853,7 @@ | |||
812 | 2118 | if (priv->syncWait) | 1853 | if (priv->syncWait) |
813 | 2119 | priv->syncGeometry.set (x, y, width, height, ce->border_width); | 1854 | priv->syncGeometry.set (x, y, width, height, ce->border_width); |
814 | 2120 | else | 1855 | else |
816 | 2121 | window->resize (x, y, width, height, ce->border_width); | 1856 | resize (x, y, width, height, ce->border_width); |
817 | 2122 | 1857 | ||
818 | 2123 | if (priv->restack (ce->above)) | 1858 | if (priv->restack (ce->above)) |
819 | 2124 | priv->updatePassiveButtonGrabs (); | 1859 | priv->updatePassiveButtonGrabs (); |
820 | @@ -2127,27 +1862,6 @@ | |||
821 | 2127 | 1862 | ||
822 | 2128 | if (above) | 1863 | if (above) |
823 | 2129 | above->priv->updatePassiveButtonGrabs (); | 1864 | above->priv->updatePassiveButtonGrabs (); |
824 | 2130 | |||
825 | 2131 | if (!pendingConfigures.pending ()) | ||
826 | 2132 | { | ||
827 | 2133 | /* Tell plugins its ok to start doing stupid things again but | ||
828 | 2134 | * obviously FIXME */ | ||
829 | 2135 | CompOption::Vector options; | ||
830 | 2136 | CompOption::Value v; | ||
831 | 2137 | |||
832 | 2138 | options.push_back (CompOption ("window", CompOption::TypeInt)); | ||
833 | 2139 | v.set ((int) id); | ||
834 | 2140 | options.back ().set (v); | ||
835 | 2141 | options.push_back (CompOption ("active", CompOption::TypeInt)); | ||
836 | 2142 | v.set ((int) 0); | ||
837 | 2143 | options.back ().set (v); | ||
838 | 2144 | |||
839 | 2145 | /* Notify other plugins that it is unsafe to change geometry or serverGeometry | ||
840 | 2146 | * FIXME: That API should not be accessible to plugins, this is a hack to avoid | ||
841 | 2147 | * breaking ABI */ | ||
842 | 2148 | |||
843 | 2149 | screen->handleCompizEvent ("core", "lock_position", options); | ||
844 | 2150 | } | ||
845 | 2151 | } | 1865 | } |
846 | 2152 | 1866 | ||
847 | 2153 | void | 1867 | void |
848 | @@ -2170,43 +1884,39 @@ | |||
849 | 2170 | { | 1884 | { |
850 | 2171 | if (dx || dy) | 1885 | if (dx || dy) |
851 | 2172 | { | 1886 | { |
861 | 2173 | gettimeofday (&priv->lastGeometryUpdate, NULL); | 1887 | XWindowChanges xwc = XWINDOWCHANGES_INIT; |
862 | 2174 | 1888 | unsigned int valueMask = CWX | CWY; | |
863 | 2175 | /* Don't allow window movement to overwrite working geometries | 1889 | |
864 | 2176 | * last received from the server if we know there are pending | 1890 | xwc.x = priv->serverGeometry.x () + dx; |
865 | 2177 | * ConfigureNotify events on this window. That's a clunky workaround | 1891 | xwc.y = priv->serverGeometry.y () + dy; |
866 | 2178 | * and a FIXME in any case, however, until we can break the API | 1892 | |
867 | 2179 | * and remove CompWindow::move, this will need to be the case */ | 1893 | priv->nextMoveImmediate = immediate; |
868 | 2180 | 1894 | ||
869 | 2181 | if (!priv->pendingConfigures.pending ()) | 1895 | configureXWindow (valueMask, &xwc); |
870 | 1896 | } | ||
871 | 1897 | } | ||
872 | 1898 | |||
873 | 1899 | void | ||
874 | 1900 | PrivateWindow::move (int dx, | ||
875 | 1901 | int dy, | ||
876 | 1902 | bool immediate) | ||
877 | 1903 | { | ||
878 | 1904 | if (dx || dy) | ||
879 | 1905 | { | ||
880 | 1906 | priv->geometry.setX (priv->geometry.x () + dx); | ||
881 | 1907 | priv->geometry.setY (priv->geometry.y () + dy); | ||
882 | 1908 | priv->frameGeometry.setX (priv->frameGeometry.x () + dx); | ||
883 | 1909 | priv->frameGeometry.setY (priv->frameGeometry.y () + dy); | ||
884 | 1910 | |||
885 | 1911 | if (priv->attrib.override_redirect) | ||
886 | 2182 | { | 1912 | { |
894 | 2183 | priv->geometry.setX (priv->geometry.x () + dx); | 1913 | priv->serverGeometry = priv->geometry; |
895 | 2184 | priv->geometry.setY (priv->geometry.y () + dy); | 1914 | priv->serverFrameGeometry = priv->frameGeometry; |
889 | 2185 | priv->frameGeometry.setX (priv->frameGeometry.x () + dx); | ||
890 | 2186 | priv->frameGeometry.setY (priv->frameGeometry.y () + dy); | ||
891 | 2187 | |||
892 | 2188 | priv->pendingPositionUpdates = true; | ||
893 | 2189 | |||
896 | 2190 | priv->region.translate (dx, dy); | 1915 | priv->region.translate (dx, dy); |
897 | 2191 | priv->inputRegion.translate (dx, dy); | 1916 | priv->inputRegion.translate (dx, dy); |
898 | 2192 | if (!priv->frameRegion.isEmpty ()) | 1917 | if (!priv->frameRegion.isEmpty ()) |
899 | 2193 | priv->frameRegion.translate (dx, dy); | 1918 | priv->frameRegion.translate (dx, dy); |
916 | 2194 | 1919 | priv->window->moveNotify (dx, dy, immediate); | |
901 | 2195 | priv->invisible = WINDOW_INVISIBLE (priv); | ||
902 | 2196 | |||
903 | 2197 | moveNotify (dx, dy, immediate); | ||
904 | 2198 | } | ||
905 | 2199 | else | ||
906 | 2200 | { | ||
907 | 2201 | XWindowChanges xwc = XWINDOWCHANGES_INIT; | ||
908 | 2202 | unsigned int valueMask = CWX | CWY; | ||
909 | 2203 | compLogMessage ("core", CompLogLevelDebug, "pending configure notifies on 0x%x, "\ | ||
910 | 2204 | "moving window asyncrhonously!", (unsigned int) priv->serverId); | ||
911 | 2205 | |||
912 | 2206 | xwc.x = priv->serverGeometry.x () + dx; | ||
913 | 2207 | xwc.y = priv->serverGeometry.y () + dy; | ||
914 | 2208 | |||
915 | 2209 | configureXWindow (valueMask, &xwc); | ||
917 | 2210 | } | 1920 | } |
918 | 2211 | } | 1921 | } |
919 | 2212 | } | 1922 | } |
920 | @@ -2217,22 +1927,6 @@ | |||
921 | 2217 | return !mEvents.empty (); | 1927 | return !mEvents.empty (); |
922 | 2218 | } | 1928 | } |
923 | 2219 | 1929 | ||
924 | 2220 | bool | ||
925 | 2221 | PrivateWindow::checkClear () | ||
926 | 2222 | { | ||
927 | 2223 | if (pendingConfigures.pending ()) | ||
928 | 2224 | { | ||
929 | 2225 | /* FIXME: This is a hack to avoid performance regressions | ||
930 | 2226 | * and must be removed in 0.9.6 */ | ||
931 | 2227 | compLogMessage ("core", CompLogLevelWarn, "failed to receive ConfigureNotify event on 0x%x\n", | ||
932 | 2228 | id); | ||
933 | 2229 | pendingConfigures.dump (); | ||
934 | 2230 | pendingConfigures.clear (); | ||
935 | 2231 | } | ||
936 | 2232 | |||
937 | 2233 | return false; | ||
938 | 2234 | } | ||
939 | 2235 | |||
940 | 2236 | void | 1930 | void |
941 | 2237 | compiz::X11::PendingEventQueue::add (PendingEvent::Ptr p) | 1931 | compiz::X11::PendingEventQueue::add (PendingEvent::Ptr p) |
942 | 2238 | { | 1932 | { |
943 | @@ -2454,21 +2148,6 @@ | |||
944 | 2454 | mValueMask (valueMask), | 2148 | mValueMask (valueMask), |
945 | 2455 | mXwc (*xwc) | 2149 | mXwc (*xwc) |
946 | 2456 | { | 2150 | { |
947 | 2457 | CompOption::Vector options; | ||
948 | 2458 | CompOption::Value v; | ||
949 | 2459 | |||
950 | 2460 | options.push_back (CompOption ("window", CompOption::TypeInt)); | ||
951 | 2461 | v.set ((int) w); | ||
952 | 2462 | options.back ().set (v); | ||
953 | 2463 | options.push_back (CompOption ("active", CompOption::TypeInt)); | ||
954 | 2464 | v.set ((int) 1); | ||
955 | 2465 | options.back ().set (v); | ||
956 | 2466 | |||
957 | 2467 | /* Notify other plugins that it is unsafe to change geometry or serverGeometry | ||
958 | 2468 | * FIXME: That API should not be accessible to plugins, this is a hack to avoid | ||
959 | 2469 | * breaking ABI */ | ||
960 | 2470 | |||
961 | 2471 | screen->handleCompizEvent ("core", "lock_position", options); | ||
962 | 2472 | } | 2151 | } |
963 | 2473 | 2152 | ||
964 | 2474 | compiz::X11::PendingConfigureEvent::~PendingConfigureEvent () | 2153 | compiz::X11::PendingConfigureEvent::~PendingConfigureEvent () |
965 | @@ -2478,57 +2157,6 @@ | |||
966 | 2478 | void | 2157 | void |
967 | 2479 | CompWindow::syncPosition () | 2158 | CompWindow::syncPosition () |
968 | 2480 | { | 2159 | { |
969 | 2481 | gettimeofday (&priv->lastConfigureRequest, NULL); | ||
970 | 2482 | |||
971 | 2483 | unsigned int valueMask = CWX | CWY; | ||
972 | 2484 | XWindowChanges xwc = XWINDOWCHANGES_INIT; | ||
973 | 2485 | |||
974 | 2486 | if (priv->pendingPositionUpdates && !priv->pendingConfigures.pending ()) | ||
975 | 2487 | { | ||
976 | 2488 | if (priv->serverFrameGeometry.x () == priv->frameGeometry.x ()) | ||
977 | 2489 | valueMask &= ~(CWX); | ||
978 | 2490 | if (priv->serverFrameGeometry.y () == priv->frameGeometry.y ()) | ||
979 | 2491 | valueMask &= ~(CWY); | ||
980 | 2492 | |||
981 | 2493 | /* Because CompWindow::move can update the geometry last | ||
982 | 2494 | * received from the server, we must indicate that no values | ||
983 | 2495 | * changed, because when the ConfigureNotify comes around | ||
984 | 2496 | * the values are going to be the same. That's obviously | ||
985 | 2497 | * broken behaviour and worthy of a FIXME, but requires | ||
986 | 2498 | * larger changes to the window movement system. */ | ||
987 | 2499 | if (valueMask) | ||
988 | 2500 | { | ||
989 | 2501 | priv->serverGeometry.setX (priv->geometry.x ()); | ||
990 | 2502 | priv->serverGeometry.setY (priv->geometry.y ()); | ||
991 | 2503 | priv->serverFrameGeometry.setX (priv->frameGeometry.x ()); | ||
992 | 2504 | priv->serverFrameGeometry.setY (priv->frameGeometry.y ()); | ||
993 | 2505 | |||
994 | 2506 | xwc.x = priv->serverFrameGeometry.x (); | ||
995 | 2507 | xwc.y = priv->serverFrameGeometry.y (); | ||
996 | 2508 | |||
997 | 2509 | compiz::X11::PendingEvent::Ptr pc = | ||
998 | 2510 | boost::shared_static_cast<compiz::X11::PendingEvent> (compiz::X11::PendingConfigureEvent::Ptr ( | ||
999 | 2511 | new compiz::X11::PendingConfigureEvent ( | ||
1000 | 2512 | screen->dpy (), priv->serverFrame, 0, &xwc))); | ||
1001 | 2513 | |||
1002 | 2514 | priv->pendingConfigures.add (pc); | ||
1003 | 2515 | |||
1004 | 2516 | /* Got 3 seconds to get its stuff together */ | ||
1005 | 2517 | if (priv->mClearCheckTimeout.active ()) | ||
1006 | 2518 | priv->mClearCheckTimeout.stop (); | ||
1007 | 2519 | priv->mClearCheckTimeout.start (boost::bind (&PrivateWindow::checkClear, priv), | ||
1008 | 2520 | 2000, 2500); | ||
1009 | 2521 | XConfigureWindow (screen->dpy (), ROOTPARENT (this), valueMask, &xwc); | ||
1010 | 2522 | |||
1011 | 2523 | if (priv->serverFrame) | ||
1012 | 2524 | { | ||
1013 | 2525 | XMoveWindow (screen->dpy (), priv->wrapper, | ||
1014 | 2526 | priv->serverInput.left, priv->serverInput.top); | ||
1015 | 2527 | sendConfigureNotify (); | ||
1016 | 2528 | } | ||
1017 | 2529 | } | ||
1018 | 2530 | priv->pendingPositionUpdates = false; | ||
1019 | 2531 | } | ||
1020 | 2532 | } | 2160 | } |
1021 | 2533 | 2161 | ||
1022 | 2534 | bool | 2162 | bool |
1023 | @@ -3350,6 +2978,12 @@ | |||
1024 | 3350 | 2978 | ||
1025 | 3351 | /* Remove redundant bits */ | 2979 | /* Remove redundant bits */ |
1026 | 3352 | 2980 | ||
1027 | 2981 | xwc->x = valueMask & CWX ? xwc->x : serverGeometry.x (); | ||
1028 | 2982 | xwc->y = valueMask & CWY ? xwc->y : serverGeometry.y (); | ||
1029 | 2983 | xwc->width = valueMask & CWWidth ? xwc->width : serverGeometry.width (); | ||
1030 | 2984 | xwc->height = valueMask & CWHeight ? xwc->height : serverGeometry.height (); | ||
1031 | 2985 | xwc->border_width = valueMask & CWBorderWidth ? xwc->border_width : serverGeometry.border (); | ||
1032 | 2986 | |||
1033 | 3353 | if (valueMask & CWX && serverGeometry.x () == xwc->x) | 2987 | if (valueMask & CWX && serverGeometry.x () == xwc->x) |
1034 | 3354 | valueMask &= ~(CWX); | 2988 | valueMask &= ~(CWX); |
1035 | 3355 | 2989 | ||
1036 | @@ -3416,18 +3050,15 @@ | |||
1037 | 3416 | compLogMessage ("core", CompLogLevelWarn, "restack_mode not Above"); | 3050 | compLogMessage ("core", CompLogLevelWarn, "restack_mode not Above"); |
1038 | 3417 | } | 3051 | } |
1039 | 3418 | 3052 | ||
1041 | 3419 | frameValueMask = valueMask; | 3053 | frameValueMask = CWX | CWY | CWWidth | CWHeight | (valueMask & (CWStackMode | CWSibling)); |
1042 | 3420 | 3054 | ||
1045 | 3421 | if (frameValueMask & CWX && | 3055 | if (serverFrameGeometry.x () == xwc->x - serverGeometry.border () - serverInput.left) |
1044 | 3422 | serverFrameGeometry.x () == xwc->x - serverGeometry.border () - serverInput.left) | ||
1046 | 3423 | frameValueMask &= ~(CWX); | 3056 | frameValueMask &= ~(CWX); |
1047 | 3424 | 3057 | ||
1050 | 3425 | if (frameValueMask & CWY && | 3058 | if (serverFrameGeometry.y () == xwc->y - serverGeometry.border () - serverInput.top) |
1049 | 3426 | serverFrameGeometry.y () == xwc->y - serverGeometry.border () - serverInput.top) | ||
1051 | 3427 | frameValueMask &= ~(CWY); | 3059 | frameValueMask &= ~(CWY); |
1052 | 3428 | 3060 | ||
1055 | 3429 | if (frameValueMask & CWWidth && | 3061 | if (serverFrameGeometry.width () == xwc->width + serverGeometry.border () * 2 |
1054 | 3430 | serverFrameGeometry.width () == xwc->width + serverGeometry.border () * 2 | ||
1056 | 3431 | + serverInput.left + serverInput.right) | 3062 | + serverInput.left + serverInput.right) |
1057 | 3432 | frameValueMask &= ~(CWWidth); | 3063 | frameValueMask &= ~(CWWidth); |
1058 | 3433 | 3064 | ||
1059 | @@ -3437,15 +3068,13 @@ | |||
1060 | 3437 | 3068 | ||
1061 | 3438 | if (shaded) | 3069 | if (shaded) |
1062 | 3439 | { | 3070 | { |
1065 | 3440 | if (frameValueMask & CWHeight && | 3071 | if (serverFrameGeometry.height () == serverGeometry.border () * 2 |
1064 | 3441 | serverFrameGeometry.height () == serverGeometry.border () * 2 | ||
1066 | 3442 | + serverInput.top + serverInput.bottom) | 3072 | + serverInput.top + serverInput.bottom) |
1067 | 3443 | frameValueMask &= ~(CWHeight); | 3073 | frameValueMask &= ~(CWHeight); |
1068 | 3444 | } | 3074 | } |
1069 | 3445 | else | 3075 | else |
1070 | 3446 | { | 3076 | { |
1073 | 3447 | if (frameValueMask & CWHeight && | 3077 | if (serverFrameGeometry.height () == xwc->height + serverGeometry.border () * 2 |
1072 | 3448 | serverFrameGeometry.height () == xwc->height + serverGeometry.border () * 2 | ||
1074 | 3449 | + serverInput.top + serverInput.bottom) | 3078 | + serverInput.top + serverInput.bottom) |
1075 | 3450 | frameValueMask &= ~(CWHeight); | 3079 | frameValueMask &= ~(CWHeight); |
1076 | 3451 | } | 3080 | } |
1077 | @@ -3479,8 +3108,6 @@ | |||
1078 | 3479 | 3108 | ||
1079 | 3480 | if (serverFrame) | 3109 | if (serverFrame) |
1080 | 3481 | { | 3110 | { |
1081 | 3482 | gettimeofday (&lastConfigureRequest, NULL); | ||
1082 | 3483 | |||
1083 | 3484 | if (frameValueMask) | 3111 | if (frameValueMask) |
1084 | 3485 | { | 3112 | { |
1085 | 3486 | XWindowChanges wc = *xwc; | 3113 | XWindowChanges wc = *xwc; |
1086 | @@ -3496,13 +3123,83 @@ | |||
1087 | 3496 | screen->dpy (), priv->serverFrame, frameValueMask, &wc))); | 3123 | screen->dpy (), priv->serverFrame, frameValueMask, &wc))); |
1088 | 3497 | 3124 | ||
1089 | 3498 | pendingConfigures.add (pc); | 3125 | pendingConfigures.add (pc); |
1090 | 3499 | if (priv->mClearCheckTimeout.active ()) | ||
1091 | 3500 | priv->mClearCheckTimeout.stop (); | ||
1092 | 3501 | priv->mClearCheckTimeout.start (boost::bind (&PrivateWindow::checkClear, priv), | ||
1093 | 3502 | 2000, 2500); | ||
1094 | 3503 | 3126 | ||
1095 | 3504 | XConfigureWindow (screen->dpy (), serverFrame, frameValueMask, &wc); | 3127 | XConfigureWindow (screen->dpy (), serverFrame, frameValueMask, &wc); |
1096 | 3505 | } | 3128 | } |
1097 | 3129 | else | ||
1098 | 3130 | { | ||
1099 | 3131 | /* Craft an XConfigureWindow event to send to the frame window */ | ||
1100 | 3132 | XConfigureEvent xev; | ||
1101 | 3133 | XWindowAttributes attrib; | ||
1102 | 3134 | unsigned int nchildren = 0; | ||
1103 | 3135 | Window rootRet = 0, parentRet = 0; | ||
1104 | 3136 | Window *children = NULL; | ||
1105 | 3137 | |||
1106 | 3138 | XWindowChanges wc = *xwc; | ||
1107 | 3139 | |||
1108 | 3140 | wc.x = serverFrameGeometry.x (); | ||
1109 | 3141 | wc.y = serverFrameGeometry.y (); | ||
1110 | 3142 | wc.width = serverFrameGeometry.width (); | ||
1111 | 3143 | wc.height = serverFrameGeometry.height (); | ||
1112 | 3144 | |||
1113 | 3145 | xev.type = ConfigureNotify; | ||
1114 | 3146 | xev.event = screen->root (); | ||
1115 | 3147 | xev.window = priv->serverFrame; | ||
1116 | 3148 | |||
1117 | 3149 | XGrabServer (screen->dpy ()); | ||
1118 | 3150 | |||
1119 | 3151 | if (XGetWindowAttributes (screen->dpy (), priv->serverFrame, &attrib)) | ||
1120 | 3152 | { | ||
1121 | 3153 | xev.x = attrib.x; | ||
1122 | 3154 | xev.y = attrib.y; | ||
1123 | 3155 | xev.width = attrib.width; | ||
1124 | 3156 | xev.height = attrib.height; | ||
1125 | 3157 | xev.border_width = attrib.border_width; | ||
1126 | 3158 | xev.above = None; | ||
1127 | 3159 | |||
1128 | 3160 | /* We need to ensure that the stacking order is | ||
1129 | 3161 | * based on the current server stacking order so | ||
1130 | 3162 | * find the sibling to this window's frame in the | ||
1131 | 3163 | * server side stack and stack above that */ | ||
1132 | 3164 | XQueryTree (screen->dpy (), screen->root (), &rootRet, &parentRet, &children, &nchildren); | ||
1133 | 3165 | |||
1134 | 3166 | if (nchildren) | ||
1135 | 3167 | { | ||
1136 | 3168 | for (unsigned int i = 0; i < nchildren; i++) | ||
1137 | 3169 | { | ||
1138 | 3170 | if (i + 1 == nchildren || | ||
1139 | 3171 | children[i + 1] == ROOTPARENT (window)) | ||
1140 | 3172 | { | ||
1141 | 3173 | xev.above = children[i]; | ||
1142 | 3174 | break; | ||
1143 | 3175 | } | ||
1144 | 3176 | } | ||
1145 | 3177 | } | ||
1146 | 3178 | |||
1147 | 3179 | if (children) | ||
1148 | 3180 | XFree (children); | ||
1149 | 3181 | |||
1150 | 3182 | if (!xev.above) | ||
1151 | 3183 | xev.above = (window->serverPrev) ? ROOTPARENT (window->serverPrev) : None; | ||
1152 | 3184 | |||
1153 | 3185 | xev.override_redirect = priv->attrib.override_redirect; | ||
1154 | 3186 | |||
1155 | 3187 | } | ||
1156 | 3188 | |||
1157 | 3189 | compiz::X11::PendingEvent::Ptr pc = | ||
1158 | 3190 | boost::shared_static_cast<compiz::X11::PendingEvent> (compiz::X11::PendingConfigureEvent::Ptr ( | ||
1159 | 3191 | new compiz::X11::PendingConfigureEvent ( | ||
1160 | 3192 | screen->dpy (), serverFrame, valueMask, &wc))); | ||
1161 | 3193 | |||
1162 | 3194 | pendingConfigures.add (pc); | ||
1163 | 3195 | |||
1164 | 3196 | XSendEvent (screen->dpy (), screen->root (), false, | ||
1165 | 3197 | SubstructureNotifyMask, (XEvent *) &xev); | ||
1166 | 3198 | |||
1167 | 3199 | XUngrabServer (screen->dpy ()); | ||
1168 | 3200 | XSync (screen->dpy (), false); | ||
1169 | 3201 | } | ||
1170 | 3202 | |||
1171 | 3506 | valueMask &= ~(CWSibling | CWStackMode); | 3203 | valueMask &= ~(CWSibling | CWStackMode); |
1172 | 3507 | 3204 | ||
1173 | 3508 | if (valueMask) | 3205 | if (valueMask) |
1174 | @@ -3692,6 +3389,9 @@ | |||
1175 | 3692 | CompWindow::configureXWindow (unsigned int valueMask, | 3389 | CompWindow::configureXWindow (unsigned int valueMask, |
1176 | 3693 | XWindowChanges *xwc) | 3390 | XWindowChanges *xwc) |
1177 | 3694 | { | 3391 | { |
1178 | 3392 | int dx = valueMask & CWX ? xwc->x - priv->serverGeometry.x () : 0; | ||
1179 | 3393 | int dy = valueMask & CWY ? xwc->y - priv->serverGeometry.y () : 0; | ||
1180 | 3394 | |||
1181 | 3695 | if (priv->managed && (valueMask & (CWSibling | CWStackMode))) | 3395 | if (priv->managed && (valueMask & (CWSibling | CWStackMode))) |
1182 | 3696 | { | 3396 | { |
1183 | 3697 | CompWindowList transients; | 3397 | CompWindowList transients; |
1184 | @@ -3746,6 +3446,17 @@ | |||
1185 | 3746 | { | 3446 | { |
1186 | 3747 | priv->reconfigureXWindow (valueMask, xwc); | 3447 | priv->reconfigureXWindow (valueMask, xwc); |
1187 | 3748 | } | 3448 | } |
1188 | 3449 | |||
1189 | 3450 | if (!overrideRedirect () && (dx || dy)) | ||
1190 | 3451 | { | ||
1191 | 3452 | priv->region.translate (dx, dy); | ||
1192 | 3453 | priv->inputRegion.translate (dx, dy); | ||
1193 | 3454 | if (!priv->frameRegion.isEmpty ()) | ||
1194 | 3455 | priv->frameRegion.translate (dx, dy); | ||
1195 | 3456 | moveNotify (dx, dy, priv->nextMoveImmediate); | ||
1196 | 3457 | |||
1197 | 3458 | priv->nextMoveImmediate = true; | ||
1198 | 3459 | } | ||
1199 | 3749 | } | 3460 | } |
1200 | 3750 | 3461 | ||
1201 | 3751 | int | 3462 | int |
1202 | @@ -4297,10 +4008,6 @@ | |||
1203 | 4297 | screen->dpy (), serverFrame, valueMask, &lxwc))); | 4008 | screen->dpy (), serverFrame, valueMask, &lxwc))); |
1204 | 4298 | 4009 | ||
1205 | 4299 | pendingConfigures.add (pc); | 4010 | pendingConfigures.add (pc); |
1206 | 4300 | if (priv->mClearCheckTimeout.active ()) | ||
1207 | 4301 | priv->mClearCheckTimeout.stop (); | ||
1208 | 4302 | priv->mClearCheckTimeout.start (boost::bind (&PrivateWindow::checkClear, priv), | ||
1209 | 4303 | 2000, 2500); | ||
1210 | 4304 | } | 4011 | } |
1211 | 4305 | 4012 | ||
1212 | 4306 | /* Below with no sibling puts the window at the bottom | 4013 | /* Below with no sibling puts the window at the bottom |
1213 | @@ -5472,7 +5179,7 @@ | |||
1214 | 5472 | m = priv->geometry.x () + offX; | 5179 | m = priv->geometry.x () + offX; |
1215 | 5473 | if (m - priv->input.left < (int) s->width () - vWidth) | 5180 | if (m - priv->input.left < (int) s->width () - vWidth) |
1216 | 5474 | rv.setX (offX + vWidth); | 5181 | rv.setX (offX + vWidth); |
1218 | 5475 | else if (m + priv->width + priv->input.right > vWidth) | 5182 | else if (m + priv->geometry.width () + priv->input.right > vWidth) |
1219 | 5476 | rv.setX (offX - vWidth); | 5183 | rv.setX (offX - vWidth); |
1220 | 5477 | else | 5184 | else |
1221 | 5478 | rv.setX (offX); | 5185 | rv.setX (offX); |
1222 | @@ -5487,7 +5194,7 @@ | |||
1223 | 5487 | m = priv->geometry.y () + offY; | 5194 | m = priv->geometry.y () + offY; |
1224 | 5488 | if (m - priv->input.top < (int) s->height () - vHeight) | 5195 | if (m - priv->input.top < (int) s->height () - vHeight) |
1225 | 5489 | rv.setY (offY + vHeight); | 5196 | rv.setY (offY + vHeight); |
1227 | 5490 | else if (m + priv->height + priv->input.bottom > vHeight) | 5197 | else if (m + priv->geometry.height () + priv->input.bottom > vHeight) |
1228 | 5491 | rv.setY (offY - vHeight); | 5198 | rv.setY (offY - vHeight); |
1229 | 5492 | else | 5199 | else |
1230 | 5493 | rv.setY (offY); | 5200 | rv.setY (offY); |
1231 | @@ -6063,7 +5770,7 @@ | |||
1232 | 6063 | 5770 | ||
1233 | 6064 | if (m - priv->output.left < (int) screen->width () - vWidth) | 5771 | if (m - priv->output.left < (int) screen->width () - vWidth) |
1234 | 6065 | wx = tx + vWidth; | 5772 | wx = tx + vWidth; |
1236 | 6066 | else if (m + priv->width + priv->output.right > vWidth) | 5773 | else if (m + priv->geometry.width () + priv->output.right > vWidth) |
1237 | 6067 | wx = tx - vWidth; | 5774 | wx = tx - vWidth; |
1238 | 6068 | } | 5775 | } |
1239 | 6069 | 5776 | ||
1240 | @@ -6073,7 +5780,7 @@ | |||
1241 | 6073 | 5780 | ||
1242 | 6074 | if (m - priv->output.top < (int) screen->height () - vHeight) | 5781 | if (m - priv->output.top < (int) screen->height () - vHeight) |
1243 | 6075 | wy = ty + vHeight; | 5782 | wy = ty + vHeight; |
1245 | 6076 | else if (m + priv->height + priv->output.bottom > vHeight) | 5783 | else if (m + priv->geometry.height () + priv->output.bottom > vHeight) |
1246 | 6077 | wy = ty - vHeight; | 5784 | wy = ty - vHeight; |
1247 | 6078 | } | 5785 | } |
1248 | 6079 | 5786 | ||
1249 | @@ -6299,9 +6006,6 @@ | |||
1250 | 6299 | priv->serverFrameGeometry = priv->frameGeometry = priv->syncGeometry | 6006 | priv->serverFrameGeometry = priv->frameGeometry = priv->syncGeometry |
1251 | 6300 | = priv->geometry = priv->serverGeometry; | 6007 | = priv->geometry = priv->serverGeometry; |
1252 | 6301 | 6008 | ||
1253 | 6302 | priv->width = priv->attrib.width + priv->attrib.border_width * 2; | ||
1254 | 6303 | priv->height = priv->attrib.height + priv->attrib.border_width * 2; | ||
1255 | 6304 | |||
1256 | 6305 | priv->sizeHints.flags = 0; | 6009 | priv->sizeHints.flags = 0; |
1257 | 6306 | 6010 | ||
1258 | 6307 | priv->recalcNormalHints (); | 6011 | priv->recalcNormalHints (); |
1259 | @@ -6323,8 +6027,7 @@ | |||
1260 | 6323 | 6027 | ||
1261 | 6324 | if (priv->attrib.c_class != InputOnly) | 6028 | if (priv->attrib.c_class != InputOnly) |
1262 | 6325 | { | 6029 | { |
1265 | 6326 | priv->region = CompRegion (priv->attrib.x, priv->attrib.y, | 6030 | priv->region = CompRegion (static_cast <CompRect> (priv->serverGeometry)); |
1264 | 6327 | priv->width, priv->height); | ||
1266 | 6328 | priv->inputRegion = priv->region; | 6031 | priv->inputRegion = priv->region; |
1267 | 6329 | 6032 | ||
1268 | 6330 | /* need to check for DisplayModal state on all windows */ | 6033 | /* need to check for DisplayModal state on all windows */ |
1269 | @@ -6569,8 +6272,6 @@ | |||
1270 | 6569 | hints (NULL), | 6272 | hints (NULL), |
1271 | 6570 | inputHint (true), | 6273 | inputHint (true), |
1272 | 6571 | alpha (false), | 6274 | alpha (false), |
1273 | 6572 | width (0), | ||
1274 | 6573 | height (0), | ||
1275 | 6574 | region (), | 6275 | region (), |
1276 | 6575 | wmType (0), | 6276 | wmType (0), |
1277 | 6576 | type (CompWindowTypeUnknownMask), | 6277 | type (CompWindowTypeUnknownMask), |
1278 | @@ -6605,7 +6306,6 @@ | |||
1279 | 6605 | pendingUnmaps (0), | 6306 | pendingUnmaps (0), |
1280 | 6606 | pendingMaps (0), | 6307 | pendingMaps (0), |
1281 | 6607 | pendingConfigures (screen->dpy ()), | 6308 | pendingConfigures (screen->dpy ()), |
1282 | 6608 | pendingPositionUpdates (false), | ||
1283 | 6609 | 6309 | ||
1284 | 6610 | startupId (0), | 6310 | startupId (0), |
1285 | 6611 | resName (0), | 6311 | resName (0), |
1286 | 6612 | 6312 | ||
1287 | === modified file 'src/windowgeometry.cpp' | |||
1288 | --- src/windowgeometry.cpp 2012-01-23 05:44:19 +0000 | |||
1289 | +++ src/windowgeometry.cpp 2012-01-31 17:22:24 +0000 | |||
1290 | @@ -61,22 +61,22 @@ | |||
1291 | 61 | int | 61 | int |
1292 | 62 | CompWindow::width () const | 62 | CompWindow::width () const |
1293 | 63 | { | 63 | { |
1295 | 64 | return priv->width + | 64 | return priv->geometry.width () + |
1296 | 65 | priv->geometry.border () * 2; | 65 | priv->geometry.border () * 2; |
1297 | 66 | } | 66 | } |
1298 | 67 | 67 | ||
1299 | 68 | int | 68 | int |
1300 | 69 | CompWindow::height () const | 69 | CompWindow::height () const |
1301 | 70 | { | 70 | { |
1303 | 71 | return priv->height + | 71 | return priv->geometry.height () + |
1304 | 72 | priv->geometry.border () * 2;; | 72 | priv->geometry.border () * 2;; |
1305 | 73 | } | 73 | } |
1306 | 74 | 74 | ||
1307 | 75 | CompSize | 75 | CompSize |
1308 | 76 | CompWindow::size () const | 76 | CompWindow::size () const |
1309 | 77 | { | 77 | { |
1312 | 78 | return CompSize (priv->width + priv->geometry.border () * 2, | 78 | return CompSize (priv->geometry.width () + priv->geometry.border () * 2, |
1313 | 79 | priv->height + priv->geometry.border () * 2); | 79 | priv->geometry.height () + priv->geometry.border () * 2); |
1314 | 80 | } | 80 | } |
1315 | 81 | 81 | ||
1316 | 82 | int | 82 | int |
The diff is big and scary, but its not too complicated. I'll explain each separate part
1 === modified file 'include/ core/window. h' core/window. h 2012-01-20 15:20:44 +0000 core/window. h 2012-01-31 17:12:59 +0000 tes);
2 --- include/
3 +++ include/
4 @@ -398,9 +398,9 @@
5
6 bool hasUnmapReference ();
7
8 - bool resize (XWindowAttribu
9 + bool resize (const XWindowAttributes &);
10
11 - bool resize (Geometry);
12 + bool resize (const Geometry &);
13
14 bool resize (int x, int y, int width, int height,
15 int border = 0);
const correctness
31 int x1, x2, y1, y2; :Geometry geom = priv->window- >geometry (); >output (); :Geometry &geom = priv->window- >serverGeometry (); >output ();
32
33 - CompWindow:
34 - CompWindowExtents output = priv->window-
35 + const CompWindow:
36 + const CompWindowExtents &output = priv->window-
more const correctness
35 + const CompWindow: :Geometry &geom = priv->window- >serverGeometry (); >output ();
36 + const CompWindowExtents &output = priv->window-
Lots of this - in paint code we want to use serverFoo because it was the last thing sent to the server. And this is always guarunteed to come back to us.
166 - unsigned int width = window->size ().width ();
167 - unsigned int height = window->size ().height ();
168 + unsigned int width = window->geometry ().width ();
169 + unsigned int height = window->geometry ().height ();
CompWindow::size was just returning CompSize (priv->width, priv->height) which was just redundant data which should be removed. Replaced it with geometry () for clarity
299 + void move (int dx, int dy, bool sync); :Geometry &g);
300 + bool resize (int dx, int dy, int dwidth, int dheight, int dborder);
301 + bool resize (const CompWindow:
302 + bool resize (const XWindowAttributes &attrib);
303 +
Added PrivateWindow::move and PrivateWindow: :resize - to be called whenever a new position / size comes back from the server. (cut'n'paste code from CompWindow::move and CompWindow::resize
335 - Request, NULL); >syncPosition (); border () * 2; width () + serverInput.left + serverInput.right + bw; height () + serverInput.top + serverInput.bottom + bw; metry.x () == xwc.x) etry.setX (xwc.x); width (), serverGeometry. height ()); >sendConfigureN otify (); >windowNotify (CompWindowNoti fyFrameUpdate. ..
336 - gettimeofday (&lastConfigure
337 - /* Flush any changes made to serverFrameGeometry or serverGeometry to the server
338 - * since there is a race condition where geometries will go out-of-sync with
339 - * window movement */
340 -
341 - window-
342 -
343 - if (serverInput.left || serverInput.right || serverInput.top || serverInput.bottom)
344 - {
345 - int bw = serverGeometry.
346 -
347 - xwc.x = serverGeometry.x () - serverInput.left;
348 - xwc.y = serverGeometry.y () - serverInput.top;
349 - xwc.width = serverGeometry.
350 - if (shaded)
351 - xwc.height = serverInput.top + serverInput.bottom + bw;
352 - else
353 - xwc.height = serverGeometry.
354 -
355 - if (shaded)
356 - height = serverInput.top + serverInput.bottom;
357 -
358 - if (serverFrameGeo
359 - valueMask &= ~(CWX);
360 - else
361 - serverFrameGeom
362 -
*snip*
616 - XMoveResizeWindow (screen->dpy (), id, 0, 0,
617 - serverGeometry.
618 - window-
619 - window-