Merge lp:~smspillaz/compiz-core/compiz-core.work_923683 into lp:compiz-core
- compiz-core.work_923683
- Merge into 0.9.7
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sam Spilsbury | Needs Fixing | ||
Daniel van Vugt | Pending | ||
Alan Griffiths | Pending | ||
Review via email: mp+94643@code.launchpad.net |
This proposal supersedes a proposal from 2012-02-06.
This proposal has been superseded by a proposal from 2012-02-26.
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
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
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 : Posted in a previous version of this proposal | # |
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 : Posted in a previous version of this proposal | # |
> 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 : Posted in a previous version of this proposal | # |
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 : Posted in a previous version of this proposal | # |
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 : Posted in a previous version of this proposal | # |
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 : Posted in a previous version of this proposal | # |
> 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 : Posted in a previous version of this proposal | # |
> 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 : Posted in a previous version of this proposal | # |
> 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 : Posted in a previous version of this proposal | # |
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 : Posted in a previous version of this proposal | # |
Please resubmit for target branch lp:compiz-core (0.9.7)
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal | # |
A lot of the above is about making the code better (which the proposal doesn't attempt). However, in a previous version I pointed out that:
> 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. ;)
I still think that needs fixing.
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
Alright, I've updated this so that there's no distorted windows on decoration size change. Was (ironically) a race condition.
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
For the sake of not making this diff any bigger, I'm not going to introduce unit tests here.
As for testing this I'd say the following is appropriate:
* Add testcase for PendingConfigur
* Add testcase for rectsToRegion (serverGeometry should really be DI'd here)
Notes for the future:
* As alan has said - the whole priv->geometry ().width () + priv->geometry ().border () * 2 is /really/ awkward and error prone, but we need it to support windows like xterm that still use this (stupid, legacy) attribute on their windows. I would say that the role of compiz:
- it should also encapsulate priv->region and really, geometry::x and friends should be made with reference to that. Ideally we'll store two regions, one with borders and one without. That sucks, since its a little memory hungry, but at least the cost is only really born whenever those regions need to be updated (::translate on a region with one rectangle is basically free, slightly more complicated on regions with multiple rects (eg, shaped window). The default should be to return the size /without/ borders, and have a default-parameter enum to get the size with borders.
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
Unfortunately still fails basic testing. The same bug remains;
* The bug introduced is worse than the bug being fixed; Window contents offset from the frame/decorations whenever a window is created or maximized.
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
Also... I would have thought/hoped that a simplified/stable solution would eliminate "serverGeometry" completely.
/**
* Geometry retrieved from the
* last ConfigureNotify event received
*/
Geometry & geometry () const;
/**
* Geometry last sent to the server
*/
Geometry & serverGeometry () const;
I understand why we have, and why we might want, serverGeometry. However it is an optimization which only makes sense to attempt if the code is stable and bug-free to begin with.
While serious bugs remain, I think the first goal should be to simplify the logic down to just using "geometry" and remove or stub "serverGeometry".
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
> Also... I would have thought/hoped that a simplified/stable solution would
> eliminate "serverGeometry" completely.
>
> /**
> * Geometry retrieved from the
> * last ConfigureNotify event received
> */
> Geometry & geometry () const;
>
> /**
> * Geometry last sent to the server
> */
> Geometry & serverGeometry () const;
>
> I understand why we have, and why we might want, serverGeometry. However it is
> an optimization which only makes sense to attempt if the code is stable and
> bug-free to begin with.
>
> While serious bugs remain, I think the first goal should be to simplify the
> logic down to just using "geometry" and remove or stub "serverGeometry".
There are some usescases for when we need to know what the last /received/ geometry from the server is. That's why the whole geometry/
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
Also, I'm not seeing this offset problem - could you give me some steps to reproduce it ?
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
> > Also... I would have thought/hoped that a simplified/stable solution would
> > eliminate "serverGeometry" completely.
> >
> > /**
> > * Geometry retrieved from the
> > * last ConfigureNotify event received
> > */
> > Geometry & geometry () const;
> >
> > /**
> > * Geometry last sent to the server
> > */
> > Geometry & serverGeometry () const;
> >
> > I understand why we have, and why we might want, serverGeometry. However it
> is
> > an optimization which only makes sense to attempt if the code is stable and
> > bug-free to begin with.
> >
> > While serious bugs remain, I think the first goal should be to simplify the
> > logic down to just using "geometry" and remove or stub "serverGeometry".
>
>
> There are some usescases for when we need to know what the last /received/
> geometry from the server is. That's why the whole geometry/
> thing exists.
Hmm, we could make it so that serverGeometry is returned for managed windows and geometry is returned for override redirect windows on the public API. That of course means that we have to break the public API and update all the plugins.
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
The practical problem:
Just start compiz --replace composite opengl move resize decor
and gtk-window-
Then every window will have its contents horizontally shifted around 15 pixels from the correct location relative to its decorations. The shift occurs whenever a window is created, maximized or restored. The shift goes away (corrects itself) when you start moving the window. On a positive note, the lag *appears* totally fixed and dragging windows is performing as well as Gnome Shell now.
The theoretical problem:
You can ignore my comments about geometry/
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
Screenshot of the bug introduced by this branch:
https:/
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
Alright, I'll have another look into it ? (Not seeing it here :( )
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
And it gets worse:
* The usual lag has come back. I have no idea how or why it was fixed when I ran it the first time.
* When dragging windows around, the area of desktop recently exposed flashes white.
So there is no improvement in performance and 2 serious regressions introduced :(
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
//XSynchronize (dpy, TRUE);
:) Haven't merged your other branch
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
Yikes. That would be another regression to be missing:
src/screen.cpp: XSynchronize (dpy, synchronousX ? True : False);
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
Perhaps remember to pull from trunk more often.
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
where trunk == lp:compiz-core
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
Why doesn't the removal of XSynchronize show up in the below diff? It's obvious if I merge the branch myself. Maybe LaunchPad needs a kick to update the below diff?
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
I think the horizontal shift bug is coming from upstream lp:compiz-core, and is exposed moreso by this branch. I can reproduce the same kind of horizontal shift jitter using just lp:compiz-core and resizing a window rapidly.
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal | # |
> The default should be to return the size /without/ borders,
> and have a default-parameter enum to get the size with borders.
There are very few designs where default parameters are better than multiple functions. This isn't one.
auto sizeWithoutBorders = geometry.size();
auto sizeWithBorders = geometry.
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
OK, the horizontal shifting bug does not seem to be caused by this branch. Just made worse by this branch.
Sam, please review that nasty issue first: bug 928173.
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
This branch will incidentally help with a lot of the resizing issues, so I think it should be merged first.
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
I would prefer not to approve this branch so long as the offset/shift bug is as bad as it is. If absolutely necessary, we could release without a fix for bug 928173 because it is hidden by the default Ubuntu config. But introducing this branch makes the bug unacceptably worse, as the screenshot showed.
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
To clarify, "unacceptably worse" means that the bug will no longer be hidden in Ubuntu and will occur on every new window that opens. At least on my machine (and presumably others).
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
.... I'm still not even seeing this issue.
I can look into resizing tonight if you really think that this is a blocker.
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
I think I may have confused the situation by suggesting the regression introduced by this branch is bug 928173. The symptoms are actually slightly different. It's only a theory that it's the same bug, because the size of the horizontal offset looks similar.
The bug I see with this branch would be worthy of a new bug report (a critical regression) that I don't want to log. And we won't have to log that bug so long as it's fixed before this branch is merged.
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
On Wed, 8 Feb 2012, Daniel van Vugt wrote:
> I think I may have confused the situation by suggesting the regression introduced by this branch is bug 928173. The symptoms are actually slightly different. It's only a theory that it's the same bug, because the size of the horizontal offset looks similar.
>
> The bug I see with this branch would be worthy of a new bug report (a critical regression) that I don't want to log. And we won't have to log that bug so long as it's fixed before this branch is merged.
> --
> https:/
> You are the owner of lp:~smspillaz/compiz-core/compiz-core.work_923683.
>
Alright.
I am looking into the decor plugin for a way to resolve this.
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
Despite the success of the fix for #928173: lp:~smspillaz/compiz-core/compiz-core.decor_928173
the offset bug introduced by this branch persists.
This confirms that the horizontal offset/shift problems introduced (or exposed) by this branch are certainly not the same as bug 928173.
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
I still can't even observe this problem that you're referring to :(
Can you specify, exactly what windows this occurs on and /exact/ steps to reproduce it ?
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
Steps to reproduce the issue:
1. Start with an exact clone of lp:compiz-core
2. Merge in lp:~smspillaz/compiz-core/compiz-core.work_923683
3. Build and install it.
4. Run compiz --replace composite opengl move resize decor
5. Run gtk-window-
Now every window will be corrupted. Not just the existing ones, but any new ones you open too. The corruption persists during window resizing, but vanishes as soon as you move a window.
Here is a new screenshot:
https:/
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
Is the window itself shifted (eg are the input regions correctly lined up) or is it just the image that is shifted ?
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
The window itself is shifted. The input regions correctly line up with the image still.
However, it looks like the damage events are not shifted. This causes some redraw problems.
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
Can you post the xwininfo -all of the window, xwininfo -all -id of the parent and xwininfo -all -parent of the parent of that ?
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
Attachments sent via email. This is interesting though;
$ diff correct.xwininfo shifted.xwininfo
11c11
< 0x2c03ca7 (has no name): () 1x1+-1+-1 +45+69
---
> 0x2c03ca7 (has no name): () 1x1+-1+-1 +34+69
13c13
< Absolute upper-left X: 46
---
> Absolute upper-left X: 35
31,32c31,32
< Corners: +46+70 -1232+70 -1232-720 +46-720
< -geometry 80x24+35+41
---
> Corners: +35+70 -1243+70 -1243-720 +35-720
> -geometry 80x24+34+41
It looks like geometry/
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
And why do I have so many 1x1 pixel windows?! I swear occasionally I see them on screen too.
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
On Sun, 12 Feb 2012, Daniel van Vugt wrote:
> And why do I have so many 1x1 pixel windows?!
Applications use them as a means of doing IPC. Gtk+ is a serial offender
here.
> I swear occasionally I see them on screen too.
Under what circumstances?
> --
> https:/
> You are the owner of lp:~smspillaz/compiz-core/compiz-core.work_923683.
>
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
On Sun, 12 Feb 2012, Daniel van Vugt wrote:
The frame window is in the wrong position. This means that serverGeometry
isn't the last thing sent to the server. serverGeometry is still writable
in this branch, so it could be $evilplugin doing the wrong thing here.
I don't want to spend any more time on this until wednesday. So I'll pick
it up then.
(compiz run with --debug will have some logs which can confirm this btw)
Incidentally, you don't see any of those "unmatched ConfigureNotify"
warnings do you? They're all gone here but they indicate the first sign of
trouble.
> Attachments sent via email. This is interesting though;
>
> $ diff correct.xwininfo shifted.xwininfo
> 11c11
> < 0x2c03ca7 (has no name): () 1x1+-1+-1 +45+69
> ---
>> 0x2c03ca7 (has no name): () 1x1+-1+-1 +34+69
> 13c13
> < Absolute upper-left X: 46
> ---
>> Absolute upper-left X: 35
> 31,32c31,32
> < Corners: +46+70 -1232+70 -1232-720 +46-720
> < -geometry 80x24+35+41
> ---
>> Corners: +35+70 -1243+70 -1243-720 +35-720
>> -geometry 80x24+34+41
>
> It looks like geometry/
> --
> https:/
> You are the owner of lp:~smspillaz/compiz-core/compiz-core.work_923683.
>
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
It's random and very rare. But sometimes I see 1-pixel windows (with shadow). Can't ever seem to get xwininfo for them. Sometimes I also get very large white anonymous windows blocking my view. But it's all very hard to reproduce. And off-topic.
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
Correct. I did stop getting "Warn: failed to receive ConfigureNotify event on ..." when using this branch.
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
Well, you should stop getting "failed to receive" since I've removed the timeout which checks for unmatched events :) (A necessary hack coming up to the oneiric release).
I'm more interested in warnings that say "unmatched ConfigureNotify"
Sam Spilsbury (smspillaz) wrote : | # |
Could you have a look again to see if the issue is still occurring for you ? I've just re-synced with trunk, so it may be fixed.
Sam Spilsbury (smspillaz) wrote : | # |
OK, I found the issue. Its actually a bug that's been in the code for quite some time which would cause the client to not move within the frame when the frame was updated until the client position itself was updated.
Sam Spilsbury (smspillaz) wrote : | # |
There's still one more issue here though to do with override redirect windows not getting their paint regions updated, so that needs to be looked into as well. And tests.
- 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
Sam Spilsbury (smspillaz) wrote : | # |
^ Those fix the offset issue confirmed here (was finally able to reproduce it with qtcreator)
- 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-02-16 09:55:06 +0000 | |||
3 | +++ include/core/window.h 2012-02-25 14:51:17 +0000 | |||
4 | @@ -406,9 +406,9 @@ | |||
5 | 406 | 406 | ||
6 | 407 | bool hasUnmapReference (); | 407 | bool hasUnmapReference (); |
7 | 408 | 408 | ||
9 | 409 | bool resize (XWindowAttributes); | 409 | bool resize (const XWindowAttributes &); |
10 | 410 | 410 | ||
12 | 411 | bool resize (Geometry); | 411 | bool resize (const Geometry &); |
13 | 412 | 412 | ||
14 | 413 | bool resize (int x, int y, int width, int height, | 413 | bool resize (int x, int y, int width, int height, |
15 | 414 | int border = 0); | 414 | int border = 0); |
16 | 415 | 415 | ||
17 | === modified file 'plugins/composite/src/window.cpp' | |||
18 | --- plugins/composite/src/window.cpp 2012-02-01 17:49:07 +0000 | |||
19 | +++ plugins/composite/src/window.cpp 2012-02-25 14:51:17 +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-02-24 08:22:28 +0000 | |||
130 | +++ plugins/decor/src/decor.cpp 2012-02-25 14:51:17 +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 | @@ -1064,8 +1064,8 @@ | |||
158 | 1064 | for (i = 0; i < wd->nQuad; i++) | 1064 | for (i = 0; i < wd->nQuad; i++) |
159 | 1065 | { | 1065 | { |
160 | 1066 | int x, y; | 1066 | int x, y; |
163 | 1067 | unsigned int width = window->size ().width (); | 1067 | unsigned int width = window->geometry ().width (); |
164 | 1068 | unsigned int height = window->size ().height (); | 1068 | unsigned int height = window->geometry ().height (); |
165 | 1069 | 1069 | ||
166 | 1070 | if (window->shaded ()) | 1070 | if (window->shaded ()) |
167 | 1071 | height = 0; | 1071 | height = 0; |
168 | @@ -1074,8 +1074,8 @@ | |||
169 | 1074 | &x1, &y1, &x2, &y2, &sx, &sy); | 1074 | &x1, &y1, &x2, &y2, &sx, &sy); |
170 | 1075 | 1075 | ||
171 | 1076 | /* Translate by x and y points of this window */ | 1076 | /* Translate by x and y points of this window */ |
174 | 1077 | x = window->geometry ().x (); | 1077 | x = window->serverGeometry ().x (); |
175 | 1078 | y = window->geometry ().y (); | 1078 | y = window->serverGeometry ().y (); |
176 | 1079 | 1079 | ||
177 | 1080 | wd->quad[i].box.x1 = x1 + x; | 1080 | wd->quad[i].box.x1 = x1 + x; |
178 | 1081 | wd->quad[i].box.y1 = y1 + y; | 1081 | wd->quad[i].box.y1 = y1 + y; |
179 | @@ -1103,8 +1103,8 @@ | |||
180 | 1103 | bool | 1103 | bool |
181 | 1104 | DecorWindow::checkSize (const Decoration::Ptr &decoration) | 1104 | DecorWindow::checkSize (const Decoration::Ptr &decoration) |
182 | 1105 | { | 1105 | { |
185 | 1106 | return (decoration->minWidth <= (int) window->size ().width () && | 1106 | return (decoration->minWidth <= (int) window->geometry ().width () && |
186 | 1107 | decoration->minHeight <= (int) window->size ().height ()); | 1107 | decoration->minHeight <= (int) window->geometry ().height ()); |
187 | 1108 | } | 1108 | } |
188 | 1109 | 1109 | ||
189 | 1110 | /* | 1110 | /* |
190 | @@ -2116,8 +2116,8 @@ | |||
191 | 2116 | { | 2116 | { |
192 | 2117 | int x, y; | 2117 | int x, y; |
193 | 2118 | 2118 | ||
196 | 2119 | x = window->geometry (). x (); | 2119 | x = window->serverGeometry (). x (); |
197 | 2120 | y = window->geometry (). y (); | 2120 | y = window->serverGeometry (). y (); |
198 | 2121 | 2121 | ||
199 | 2122 | region += frameRegion.translated (x - wd->decor->input.left, | 2122 | region += frameRegion.translated (x - wd->decor->input.left, |
200 | 2123 | y - wd->decor->input.top); | 2123 | y - wd->decor->input.top); |
201 | @@ -2138,7 +2138,7 @@ | |||
202 | 2138 | void | 2138 | void |
203 | 2139 | DecorWindow::updateWindowRegions () | 2139 | DecorWindow::updateWindowRegions () |
204 | 2140 | { | 2140 | { |
206 | 2141 | const CompRect &input (window->inputRect ()); | 2141 | const CompRect &input (window->serverInputRect ()); |
207 | 2142 | 2142 | ||
208 | 2143 | if (regions.size () != gWindow->textures ().size ()) | 2143 | if (regions.size () != gWindow->textures ().size ()) |
209 | 2144 | regions.resize (gWindow->textures ().size ()); | 2144 | regions.resize (gWindow->textures ().size ()); |
210 | 2145 | 2145 | ||
211 | === modified file 'plugins/move/src/move.cpp' | |||
212 | --- plugins/move/src/move.cpp 2012-02-16 05:31:28 +0000 | |||
213 | +++ plugins/move/src/move.cpp 2012-02-25 14:51:17 +0000 | |||
214 | @@ -138,8 +138,8 @@ | |||
215 | 138 | { | 138 | { |
216 | 139 | int xRoot, yRoot; | 139 | int xRoot, yRoot; |
217 | 140 | 140 | ||
220 | 141 | xRoot = w->geometry ().x () + (w->size ().width () / 2); | 141 | xRoot = w->serverGeometry ().x () + (w->size ().width () / 2); |
221 | 142 | yRoot = w->geometry ().y () + (w->size ().height () / 2); | 142 | yRoot = w->serverGeometry ().y () + (w->size ().height () / 2); |
222 | 143 | 143 | ||
223 | 144 | s->warpPointer (xRoot - pointerX, yRoot - pointerY); | 144 | s->warpPointer (xRoot - pointerX, yRoot - pointerY); |
224 | 145 | } | 145 | } |
225 | @@ -169,8 +169,8 @@ | |||
226 | 169 | if (ms->w) | 169 | if (ms->w) |
227 | 170 | { | 170 | { |
228 | 171 | if (state & CompAction::StateCancel) | 171 | if (state & CompAction::StateCancel) |
231 | 172 | ms->w->move (ms->savedX - ms->w->geometry ().x (), | 172 | ms->w->move (ms->savedX - ms->w->serverGeometry ().x (), |
232 | 173 | ms->savedY - ms->w->geometry ().y (), false); | 173 | ms->savedY - ms->w->serverGeometry ().y (), false); |
233 | 174 | 174 | ||
234 | 175 | ms->w->syncPosition (); | 175 | ms->w->syncPosition (); |
235 | 176 | 176 | ||
236 | @@ -314,12 +314,12 @@ | |||
237 | 314 | 314 | ||
238 | 315 | w = ms->w; | 315 | w = ms->w; |
239 | 316 | 316 | ||
246 | 317 | wX = w->geometry ().x (); | 317 | wX = w->serverGeometry ().x (); |
247 | 318 | wY = w->geometry ().y (); | 318 | wY = w->serverGeometry ().y (); |
248 | 319 | wWidth = w->geometry ().width () + | 319 | wWidth = w->serverGeometry ().width () + |
249 | 320 | w->geometry ().border () * 2; | 320 | w->serverGeometry ().border () * 2; |
250 | 321 | wHeight = w->geometry ().height () + | 321 | wHeight = w->serverGeometry ().height () + |
251 | 322 | w->geometry ().border () * 2; | 322 | w->serverGeometry ().border () * 2; |
252 | 323 | 323 | ||
253 | 324 | ms->x += xRoot - lastPointerX; | 324 | ms->x += xRoot - lastPointerX; |
254 | 325 | ms->y += yRoot - lastPointerY; | 325 | ms->y += yRoot - lastPointerY; |
255 | @@ -484,8 +484,8 @@ | |||
256 | 484 | 484 | ||
257 | 485 | if (dx || dy) | 485 | if (dx || dy) |
258 | 486 | { | 486 | { |
261 | 487 | w->move (wX + dx - w->geometry ().x (), | 487 | w->move (wX + dx - w->serverGeometry ().x (), |
262 | 488 | wY + dy - w->geometry ().y (), false); | 488 | wY + dy - w->serverGeometry ().y (), false); |
263 | 489 | 489 | ||
264 | 490 | if (!ms->optionGetLazyPositioning ()) | 490 | if (!ms->optionGetLazyPositioning ()) |
265 | 491 | w->syncPosition (); | 491 | w->syncPosition (); |
266 | 492 | 492 | ||
267 | === modified file 'plugins/opengl/src/window.cpp' | |||
268 | --- plugins/opengl/src/window.cpp 2011-03-11 12:15:30 +0000 | |||
269 | +++ plugins/opengl/src/window.cpp 2012-02-25 14:51:17 +0000 | |||
270 | @@ -76,7 +76,7 @@ | |||
271 | 76 | void | 76 | void |
272 | 77 | PrivateGLWindow::setWindowMatrix () | 77 | PrivateGLWindow::setWindowMatrix () |
273 | 78 | { | 78 | { |
275 | 79 | CompRect input (window->inputRect ()); | 79 | CompRect input (window->serverInputRect ()); |
276 | 80 | 80 | ||
277 | 81 | if (textures.size () != matrices.size ()) | 81 | if (textures.size () != matrices.size ()) |
278 | 82 | matrices.resize (textures.size ()); | 82 | matrices.resize (textures.size ()); |
279 | @@ -344,7 +344,7 @@ | |||
280 | 344 | void | 344 | void |
281 | 345 | PrivateGLWindow::updateWindowRegions () | 345 | PrivateGLWindow::updateWindowRegions () |
282 | 346 | { | 346 | { |
284 | 347 | CompRect input (window->inputRect ()); | 347 | CompRect input (window->serverInputRect ()); |
285 | 348 | 348 | ||
286 | 349 | if (regions.size () != textures.size ()) | 349 | if (regions.size () != textures.size ()) |
287 | 350 | regions.resize (textures.size ()); | 350 | regions.resize (textures.size ()); |
288 | 351 | 351 | ||
289 | === modified file 'src/event.cpp' | |||
290 | --- src/event.cpp 2012-02-22 05:13:00 +0000 | |||
291 | +++ src/event.cpp 2012-02-25 14:51:17 +0000 | |||
292 | @@ -1249,7 +1249,7 @@ | |||
293 | 1249 | } | 1249 | } |
294 | 1250 | 1250 | ||
295 | 1251 | /* been shaded */ | 1251 | /* been shaded */ |
297 | 1252 | if (w->priv->height == 0) | 1252 | if (w->shaded ()) |
298 | 1253 | { | 1253 | { |
299 | 1254 | if (w->id () == priv->activeWindow) | 1254 | if (w->id () == priv->activeWindow) |
300 | 1255 | w->moveInputFocusTo (); | 1255 | w->moveInputFocusTo (); |
301 | 1256 | 1256 | ||
302 | === modified file 'src/privatewindow.h' | |||
303 | --- src/privatewindow.h 2012-02-14 14:37:04 +0000 | |||
304 | +++ src/privatewindow.h 2012-02-25 14:51:17 +0000 | |||
305 | @@ -34,7 +34,6 @@ | |||
306 | 34 | #include <core/timer.h> | 34 | #include <core/timer.h> |
307 | 35 | #include "privatescreen.h" | 35 | #include "privatescreen.h" |
308 | 36 | 36 | ||
309 | 37 | |||
310 | 38 | typedef CompWindowExtents CompFullscreenMonitorSet; | 37 | typedef CompWindowExtents CompFullscreenMonitorSet; |
311 | 39 | 38 | ||
312 | 40 | class PrivateWindow { | 39 | class PrivateWindow { |
313 | @@ -167,6 +166,11 @@ | |||
314 | 167 | 166 | ||
315 | 168 | bool handleSyncAlarm (); | 167 | bool handleSyncAlarm (); |
316 | 169 | 168 | ||
317 | 169 | void move (int dx, int dy, bool sync); | ||
318 | 170 | bool resize (int dx, int dy, int dwidth, int dheight, int dborder); | ||
319 | 171 | bool resize (const CompWindow::Geometry &g); | ||
320 | 172 | bool resize (const XWindowAttributes &attrib); | ||
321 | 173 | |||
322 | 170 | void configure (XConfigureEvent *ce); | 174 | void configure (XConfigureEvent *ce); |
323 | 171 | 175 | ||
324 | 172 | void configureFrame (XConfigureEvent *ce); | 176 | void configureFrame (XConfigureEvent *ce); |
325 | @@ -207,8 +211,6 @@ | |||
326 | 207 | 211 | ||
327 | 208 | void readIconHint (); | 212 | void readIconHint (); |
328 | 209 | 213 | ||
329 | 210 | bool checkClear (); | ||
330 | 211 | |||
331 | 212 | public: | 214 | public: |
332 | 213 | 215 | ||
333 | 214 | PrivateWindow *priv; | 216 | PrivateWindow *priv; |
334 | @@ -240,13 +242,8 @@ | |||
335 | 240 | XSizeHints sizeHints; | 242 | XSizeHints sizeHints; |
336 | 241 | XWMHints *hints; | 243 | XWMHints *hints; |
337 | 242 | 244 | ||
338 | 243 | struct timeval lastGeometryUpdate; | ||
339 | 244 | struct timeval lastConfigureRequest; | ||
340 | 245 | |||
341 | 246 | bool inputHint; | 245 | bool inputHint; |
345 | 247 | bool alpha; | 246 | bool alpha;; |
343 | 248 | int width; | ||
344 | 249 | int height; | ||
346 | 250 | CompRegion region; | 247 | CompRegion region; |
347 | 251 | CompRegion inputRegion; | 248 | CompRegion inputRegion; |
348 | 252 | CompRegion frameRegion; | 249 | CompRegion frameRegion; |
349 | @@ -289,8 +286,6 @@ | |||
350 | 289 | typedef std::pair <XWindowChanges, unsigned int> XWCValueMask; | 286 | typedef std::pair <XWindowChanges, unsigned int> XWCValueMask; |
351 | 290 | 287 | ||
352 | 291 | compiz::X11::PendingEventQueue pendingConfigures; | 288 | compiz::X11::PendingEventQueue pendingConfigures; |
353 | 292 | CompTimer mClearCheckTimeout; | ||
354 | 293 | bool pendingPositionUpdates; | ||
355 | 294 | 289 | ||
356 | 295 | char *startupId; | 290 | char *startupId; |
357 | 296 | char *resName; | 291 | char *resName; |
358 | @@ -326,6 +321,8 @@ | |||
359 | 326 | 321 | ||
360 | 327 | bool closeRequests; | 322 | bool closeRequests; |
361 | 328 | Time lastCloseRequestTime; | 323 | Time lastCloseRequestTime; |
362 | 324 | |||
363 | 325 | bool nextMoveImmediate; | ||
364 | 329 | }; | 326 | }; |
365 | 330 | 327 | ||
366 | 331 | class CoreWindow | 328 | class CoreWindow |
367 | 332 | 329 | ||
368 | === modified file 'src/screen.cpp' | |||
369 | --- src/screen.cpp 2012-02-24 11:00:05 +0000 | |||
370 | +++ src/screen.cpp 2012-02-25 14:51:17 +0000 | |||
371 | @@ -4531,7 +4531,7 @@ | |||
372 | 4531 | return false; | 4531 | return false; |
373 | 4532 | } | 4532 | } |
374 | 4533 | 4533 | ||
376 | 4534 | XSynchronize (dpy, synchronousX ? True : False); | 4534 | // priv->connection = XGetXCBConnection (priv->dpy); |
377 | 4535 | 4535 | ||
378 | 4536 | snprintf (displayString, 255, "DISPLAY=%s", | 4536 | snprintf (displayString, 255, "DISPLAY=%s", |
379 | 4537 | DisplayString (dpy)); | 4537 | DisplayString (dpy)); |
380 | 4538 | 4538 | ||
381 | === modified file 'src/window.cpp' | |||
382 | --- src/window.cpp 2012-02-20 02:30:34 +0000 | |||
383 | +++ src/window.cpp 2012-02-25 14:51:17 +0000 | |||
384 | @@ -75,8 +75,8 @@ | |||
385 | 75 | PrivateWindow::isInvisible() const | 75 | PrivateWindow::isInvisible() const |
386 | 76 | { | 76 | { |
387 | 77 | return attrib.map_state != IsViewable || | 77 | return attrib.map_state != IsViewable || |
390 | 78 | attrib.x + width + output.right <= 0 || | 78 | attrib.x + geometry.width () + output.right <= 0 || |
391 | 79 | attrib.y + height + output.bottom <= 0 || | 79 | attrib.y + geometry.height () + output.bottom <= 0 || |
392 | 80 | attrib.x - output.left >= (int) screen->width () || | 80 | attrib.x - output.left >= (int) screen->width () || |
393 | 81 | attrib.y - output.top >= (int) screen->height (); | 81 | attrib.y - output.top >= (int) screen->height (); |
394 | 82 | } | 82 | } |
395 | @@ -808,292 +808,14 @@ | |||
396 | 808 | if (!serverFrame) | 808 | if (!serverFrame) |
397 | 809 | return; | 809 | return; |
398 | 810 | 810 | ||
685 | 811 | 811 | xwc.x = serverGeometry.x (); | |
686 | 812 | gettimeofday (&lastConfigureRequest, NULL); | 812 | xwc.y = serverGeometry.y (); |
687 | 813 | /* Flush any changes made to serverFrameGeometry or serverGeometry to the server | 813 | xwc.width = serverGeometry.width (); |
688 | 814 | * since there is a race condition where geometries will go out-of-sync with | 814 | xwc.height = serverGeometry.height (); |
689 | 815 | * window movement */ | 815 | xwc.border_width = serverGeometry.border (); |
690 | 816 | 816 | ||
691 | 817 | window->syncPosition (); | 817 | window->configureXWindow (valueMask, &xwc); |
692 | 818 | 818 | window->windowNotify (CompWindowNotifyFrameUpdate); | |
407 | 819 | if (serverInput.left || serverInput.right || serverInput.top || serverInput.bottom) | ||
408 | 820 | { | ||
409 | 821 | int bw = serverGeometry.border () * 2; | ||
410 | 822 | |||
411 | 823 | xwc.x = serverGeometry.x () - serverInput.left; | ||
412 | 824 | xwc.y = serverGeometry.y () - serverInput.top; | ||
413 | 825 | xwc.width = serverGeometry.width () + serverInput.left + serverInput.right + bw; | ||
414 | 826 | if (shaded) | ||
415 | 827 | xwc.height = serverInput.top + serverInput.bottom + bw; | ||
416 | 828 | else | ||
417 | 829 | xwc.height = serverGeometry.height () + serverInput.top + serverInput.bottom + bw; | ||
418 | 830 | |||
419 | 831 | if (shaded) | ||
420 | 832 | height = serverInput.top + serverInput.bottom; | ||
421 | 833 | |||
422 | 834 | if (serverFrameGeometry.x () == xwc.x) | ||
423 | 835 | valueMask &= ~(CWX); | ||
424 | 836 | else | ||
425 | 837 | serverFrameGeometry.setX (xwc.x); | ||
426 | 838 | |||
427 | 839 | if (serverFrameGeometry.y () == xwc.y) | ||
428 | 840 | valueMask &= ~(CWY); | ||
429 | 841 | else | ||
430 | 842 | serverFrameGeometry.setY (xwc.y); | ||
431 | 843 | |||
432 | 844 | if (serverFrameGeometry.width () == xwc.width) | ||
433 | 845 | valueMask &= ~(CWWidth); | ||
434 | 846 | else | ||
435 | 847 | serverFrameGeometry.setWidth (xwc.width); | ||
436 | 848 | |||
437 | 849 | if (serverFrameGeometry.height () == xwc.height) | ||
438 | 850 | valueMask &= ~(CWHeight); | ||
439 | 851 | else | ||
440 | 852 | serverFrameGeometry.setHeight (xwc.height); | ||
441 | 853 | |||
442 | 854 | /* Geometry is the same, so we're not going to get a ConfigureNotify | ||
443 | 855 | * event when the window is configured, which means that other plugins | ||
444 | 856 | * won't know that the client, frame and wrapper windows got shifted | ||
445 | 857 | * around (and might result in display corruption, eg in OpenGL */ | ||
446 | 858 | if (valueMask == 0) | ||
447 | 859 | { | ||
448 | 860 | XConfigureEvent xev; | ||
449 | 861 | XWindowAttributes attrib; | ||
450 | 862 | unsigned int nchildren = 0; | ||
451 | 863 | Window rootRet = 0, parentRet = 0; | ||
452 | 864 | Window *children = NULL; | ||
453 | 865 | |||
454 | 866 | xev.type = ConfigureNotify; | ||
455 | 867 | xev.event = screen->root (); | ||
456 | 868 | xev.window = priv->serverFrame; | ||
457 | 869 | |||
458 | 870 | XGrabServer (screen->dpy ()); | ||
459 | 871 | |||
460 | 872 | if (XGetWindowAttributes (screen->dpy (), priv->serverFrame, &attrib)) | ||
461 | 873 | { | ||
462 | 874 | xev.x = attrib.x; | ||
463 | 875 | xev.y = attrib.y; | ||
464 | 876 | xev.width = attrib.width; | ||
465 | 877 | xev.height = attrib.height; | ||
466 | 878 | xev.border_width = attrib.border_width; | ||
467 | 879 | xev.above = None; | ||
468 | 880 | |||
469 | 881 | /* We need to ensure that the stacking order is | ||
470 | 882 | * based on the current server stacking order so | ||
471 | 883 | * find the sibling to this window's frame in the | ||
472 | 884 | * server side stack and stack above that */ | ||
473 | 885 | XQueryTree (screen->dpy (), screen->root (), &rootRet, &parentRet, &children, &nchildren); | ||
474 | 886 | |||
475 | 887 | if (nchildren) | ||
476 | 888 | { | ||
477 | 889 | for (unsigned int i = 0; i < nchildren; i++) | ||
478 | 890 | { | ||
479 | 891 | if (i + 1 == nchildren || | ||
480 | 892 | children[i + 1] == ROOTPARENT (window)) | ||
481 | 893 | { | ||
482 | 894 | xev.above = children[i]; | ||
483 | 895 | break; | ||
484 | 896 | } | ||
485 | 897 | } | ||
486 | 898 | } | ||
487 | 899 | |||
488 | 900 | if (children) | ||
489 | 901 | XFree (children); | ||
490 | 902 | |||
491 | 903 | if (!xev.above) | ||
492 | 904 | xev.above = (window->serverPrev) ? ROOTPARENT (window->serverPrev) : None; | ||
493 | 905 | |||
494 | 906 | xev.override_redirect = priv->attrib.override_redirect; | ||
495 | 907 | |||
496 | 908 | } | ||
497 | 909 | |||
498 | 910 | compiz::X11::PendingEvent::Ptr pc = | ||
499 | 911 | boost::shared_static_cast<compiz::X11::PendingEvent> (compiz::X11::PendingConfigureEvent::Ptr ( | ||
500 | 912 | new compiz::X11::PendingConfigureEvent ( | ||
501 | 913 | screen->dpy (), serverFrame, valueMask, &xwc))); | ||
502 | 914 | |||
503 | 915 | pendingConfigures.add (pc); | ||
504 | 916 | if (priv->mClearCheckTimeout.active ()) | ||
505 | 917 | priv->mClearCheckTimeout.stop (); | ||
506 | 918 | priv->mClearCheckTimeout.start (boost::bind (&PrivateWindow::checkClear, priv), | ||
507 | 919 | 2000, 2500); | ||
508 | 920 | |||
509 | 921 | XSendEvent (screen->dpy (), screen->root (), false, | ||
510 | 922 | SubstructureNotifyMask, (XEvent *) &xev); | ||
511 | 923 | |||
512 | 924 | XUngrabServer (screen->dpy ()); | ||
513 | 925 | XSync (screen->dpy (), false); | ||
514 | 926 | } | ||
515 | 927 | else | ||
516 | 928 | { | ||
517 | 929 | compiz::X11::PendingEvent::Ptr pc = | ||
518 | 930 | boost::shared_static_cast<compiz::X11::PendingEvent> (compiz::X11::PendingConfigureEvent::Ptr ( | ||
519 | 931 | new compiz::X11::PendingConfigureEvent ( | ||
520 | 932 | screen->dpy (), serverFrame, valueMask, &xwc))); | ||
521 | 933 | |||
522 | 934 | pendingConfigures.add (pc); | ||
523 | 935 | if (priv->mClearCheckTimeout.active ()) | ||
524 | 936 | priv->mClearCheckTimeout.stop (); | ||
525 | 937 | priv->mClearCheckTimeout.start (boost::bind (&PrivateWindow::checkClear, priv), | ||
526 | 938 | 2000, 2500); | ||
527 | 939 | XConfigureWindow (screen->dpy (), serverFrame, valueMask, &xwc); | ||
528 | 940 | } | ||
529 | 941 | |||
530 | 942 | if (shaded) | ||
531 | 943 | { | ||
532 | 944 | XUnmapWindow (screen->dpy (), wrapper); | ||
533 | 945 | } | ||
534 | 946 | else | ||
535 | 947 | { | ||
536 | 948 | XMapWindow (screen->dpy (), wrapper); | ||
537 | 949 | XMoveResizeWindow (screen->dpy (), wrapper, serverInput.left, serverInput.top, | ||
538 | 950 | serverGeometry.width (), serverGeometry.height ()); | ||
539 | 951 | } | ||
540 | 952 | XMoveResizeWindow (screen->dpy (), id, 0, 0, | ||
541 | 953 | serverGeometry.width (), serverGeometry.height ()); | ||
542 | 954 | window->sendConfigureNotify (); | ||
543 | 955 | window->windowNotify (CompWindowNotifyFrameUpdate); | ||
544 | 956 | } | ||
545 | 957 | else | ||
546 | 958 | { | ||
547 | 959 | int bw = serverGeometry.border () * 2; | ||
548 | 960 | |||
549 | 961 | xwc.x = serverGeometry.x (); | ||
550 | 962 | xwc.y = serverGeometry.y (); | ||
551 | 963 | xwc.width = serverGeometry.width () + bw; | ||
552 | 964 | |||
553 | 965 | /* FIXME: It doesn't make much sense to allow undecorated windows to be | ||
554 | 966 | * shaded */ | ||
555 | 967 | if (shaded) | ||
556 | 968 | xwc.height = bw; | ||
557 | 969 | else | ||
558 | 970 | xwc.height = serverGeometry.height () + bw; | ||
559 | 971 | |||
560 | 972 | if (serverFrameGeometry.x () == xwc.x) | ||
561 | 973 | valueMask &= ~(CWX); | ||
562 | 974 | else | ||
563 | 975 | serverFrameGeometry.setX (xwc.x); | ||
564 | 976 | |||
565 | 977 | if (serverFrameGeometry.y () == xwc.y) | ||
566 | 978 | valueMask &= ~(CWY); | ||
567 | 979 | else | ||
568 | 980 | serverFrameGeometry.setY (xwc.y); | ||
569 | 981 | |||
570 | 982 | if (serverFrameGeometry.width () == xwc.width) | ||
571 | 983 | valueMask &= ~(CWWidth); | ||
572 | 984 | else | ||
573 | 985 | serverFrameGeometry.setWidth (xwc.width); | ||
574 | 986 | |||
575 | 987 | if (serverFrameGeometry.height () == xwc.height) | ||
576 | 988 | valueMask &= ~(CWHeight); | ||
577 | 989 | else | ||
578 | 990 | serverFrameGeometry.setHeight (xwc.height); | ||
579 | 991 | |||
580 | 992 | /* Geometry is the same, so we're not going to get a ConfigureNotify | ||
581 | 993 | * event when the window is configured, which means that other plugins | ||
582 | 994 | * won't know that the client, frame and wrapper windows got shifted | ||
583 | 995 | * around (and might result in display corruption, eg in OpenGL */ | ||
584 | 996 | if (valueMask == 0) | ||
585 | 997 | { | ||
586 | 998 | XConfigureEvent xev; | ||
587 | 999 | XWindowAttributes attrib; | ||
588 | 1000 | unsigned int nchildren = 0; | ||
589 | 1001 | Window rootRet = 0, parentRet = 0; | ||
590 | 1002 | Window *children = NULL; | ||
591 | 1003 | |||
592 | 1004 | xev.type = ConfigureNotify; | ||
593 | 1005 | xev.event = screen->root (); | ||
594 | 1006 | xev.window = priv->serverFrame; | ||
595 | 1007 | |||
596 | 1008 | XGrabServer (screen->dpy ()); | ||
597 | 1009 | |||
598 | 1010 | if (XGetWindowAttributes (screen->dpy (), priv->serverFrame, &attrib)) | ||
599 | 1011 | { | ||
600 | 1012 | xev.x = attrib.x; | ||
601 | 1013 | xev.y = attrib.y; | ||
602 | 1014 | xev.width = attrib.width; | ||
603 | 1015 | xev.height = attrib.height; | ||
604 | 1016 | xev.border_width = attrib.border_width; | ||
605 | 1017 | xev.above = None; | ||
606 | 1018 | |||
607 | 1019 | /* We need to ensure that the stacking order is | ||
608 | 1020 | * based on the current server stacking order so | ||
609 | 1021 | * find the sibling to this window's frame in the | ||
610 | 1022 | * server side stack and stack above that */ | ||
611 | 1023 | XQueryTree (screen->dpy (), screen->root (), &rootRet, &parentRet, &children, &nchildren); | ||
612 | 1024 | |||
613 | 1025 | if (nchildren) | ||
614 | 1026 | { | ||
615 | 1027 | for (unsigned int i = 0; i < nchildren; i++) | ||
616 | 1028 | { | ||
617 | 1029 | if (i + 1 == nchildren || | ||
618 | 1030 | children[i + 1] == ROOTPARENT (window)) | ||
619 | 1031 | { | ||
620 | 1032 | xev.above = children[i]; | ||
621 | 1033 | break; | ||
622 | 1034 | } | ||
623 | 1035 | } | ||
624 | 1036 | } | ||
625 | 1037 | |||
626 | 1038 | if (children) | ||
627 | 1039 | XFree (children); | ||
628 | 1040 | |||
629 | 1041 | if (!xev.above) | ||
630 | 1042 | xev.above = (window->serverPrev) ? ROOTPARENT (window->serverPrev) : None; | ||
631 | 1043 | |||
632 | 1044 | xev.override_redirect = priv->attrib.override_redirect; | ||
633 | 1045 | |||
634 | 1046 | } | ||
635 | 1047 | |||
636 | 1048 | compiz::X11::PendingEvent::Ptr pc = | ||
637 | 1049 | boost::shared_static_cast<compiz::X11::PendingEvent> (compiz::X11::PendingConfigureEvent::Ptr ( | ||
638 | 1050 | new compiz::X11::PendingConfigureEvent ( | ||
639 | 1051 | screen->dpy (), serverFrame, valueMask, &xwc))); | ||
640 | 1052 | |||
641 | 1053 | pendingConfigures.add (pc); | ||
642 | 1054 | if (priv->mClearCheckTimeout.active ()) | ||
643 | 1055 | priv->mClearCheckTimeout.stop (); | ||
644 | 1056 | priv->mClearCheckTimeout.start (boost::bind (&PrivateWindow::checkClear, priv), | ||
645 | 1057 | 2000, 2500); | ||
646 | 1058 | |||
647 | 1059 | XSendEvent (screen->dpy (), screen->root (), false, | ||
648 | 1060 | SubstructureNotifyMask, (XEvent *) &xev); | ||
649 | 1061 | |||
650 | 1062 | XUngrabServer (screen->dpy ()); | ||
651 | 1063 | XSync (screen->dpy (), false); | ||
652 | 1064 | } | ||
653 | 1065 | else | ||
654 | 1066 | { | ||
655 | 1067 | compiz::X11::PendingEvent::Ptr pc = | ||
656 | 1068 | boost::shared_static_cast<compiz::X11::PendingEvent> (compiz::X11::PendingConfigureEvent::Ptr ( | ||
657 | 1069 | new compiz::X11::PendingConfigureEvent ( | ||
658 | 1070 | screen->dpy (), serverFrame, valueMask, &xwc))); | ||
659 | 1071 | |||
660 | 1072 | pendingConfigures.add (pc); | ||
661 | 1073 | if (priv->mClearCheckTimeout.active ()) | ||
662 | 1074 | priv->mClearCheckTimeout.stop (); | ||
663 | 1075 | priv->mClearCheckTimeout.start (boost::bind (&PrivateWindow::checkClear, priv), | ||
664 | 1076 | 2000, 2500); | ||
665 | 1077 | |||
666 | 1078 | XConfigureWindow (screen->dpy (), serverFrame, valueMask, &xwc); | ||
667 | 1079 | } | ||
668 | 1080 | |||
669 | 1081 | if (shaded) | ||
670 | 1082 | { | ||
671 | 1083 | XUnmapWindow (screen->dpy (), wrapper); | ||
672 | 1084 | } | ||
673 | 1085 | else | ||
674 | 1086 | { | ||
675 | 1087 | XMapWindow (screen->dpy (), wrapper); | ||
676 | 1088 | XMoveResizeWindow (screen->dpy (), wrapper, 0, 0, | ||
677 | 1089 | serverGeometry.width (), serverGeometry.height ()); | ||
678 | 1090 | } | ||
679 | 1091 | |||
680 | 1092 | XMoveResizeWindow (screen->dpy (), id, 0, 0, | ||
681 | 1093 | serverGeometry.width (), serverGeometry.height ()); | ||
682 | 1094 | window->sendConfigureNotify (); | ||
683 | 1095 | window->windowNotify (CompWindowNotifyFrameUpdate); | ||
684 | 1096 | } | ||
693 | 1097 | window->recalcActions (); | 819 | window->recalcActions (); |
694 | 1098 | } | 820 | } |
695 | 1099 | 821 | ||
696 | @@ -1136,8 +858,8 @@ | |||
697 | 1136 | 858 | ||
698 | 1137 | for (unsigned int i = 0; i < n; i++) | 859 | for (unsigned int i = 0; i < n; i++) |
699 | 1138 | { | 860 | { |
702 | 1139 | x1 = rects[i].x + priv->geometry.border (); | 861 | x1 = rects[i].x + priv->serverGeometry.border (); |
703 | 1140 | y1 = rects[i].y + priv->geometry.border (); | 862 | y1 = rects[i].y + priv->serverGeometry.border (); |
704 | 1141 | x2 = x1 + rects[i].width; | 863 | x2 = x1 + rects[i].width; |
705 | 1142 | y2 = y1 + rects[i].height; | 864 | y2 = y1 + rects[i].height; |
706 | 1143 | 865 | ||
707 | @@ -1145,17 +867,17 @@ | |||
708 | 1145 | x1 = 0; | 867 | x1 = 0; |
709 | 1146 | if (y1 < 0) | 868 | if (y1 < 0) |
710 | 1147 | y1 = 0; | 869 | y1 = 0; |
715 | 1148 | if (x2 > priv->width) | 870 | if (x2 > priv->serverGeometry.width ()) |
716 | 1149 | x2 = priv->width; | 871 | x2 = priv->serverGeometry.height (); |
717 | 1150 | if (y2 > priv->height) | 872 | if (y2 > priv->serverGeometry.width ()) |
718 | 1151 | y2 = priv->height; | 873 | y2 = priv->serverGeometry.height (); |
719 | 1152 | 874 | ||
720 | 1153 | if (y1 < y2 && x1 < x2) | 875 | if (y1 < y2 && x1 < x2) |
721 | 1154 | { | 876 | { |
726 | 1155 | x1 += priv->geometry.x (); | 877 | x1 += priv->serverGeometry.x (); |
727 | 1156 | y1 += priv->geometry.y (); | 878 | y1 += priv->serverGeometry.y (); |
728 | 1157 | x2 += priv->geometry.x (); | 879 | x2 += priv->serverGeometry.x (); |
729 | 1158 | y2 += priv->geometry.y (); | 880 | y2 += priv->serverGeometry.y (); |
730 | 1159 | 881 | ||
731 | 1160 | ret += CompRect (x1, y1, x2 - x1, y2 - y1); | 882 | ret += CompRect (x1, y1, x2 - x1, y2 - y1); |
732 | 1161 | } | 883 | } |
733 | @@ -1183,17 +905,19 @@ | |||
734 | 1183 | { | 905 | { |
735 | 1184 | int order; | 906 | int order; |
736 | 1185 | 907 | ||
737 | 908 | /* We should update the server here */ | ||
738 | 909 | XSync (screen->dpy (), false); | ||
739 | 910 | |||
740 | 1186 | boundingShapeRects = XShapeGetRectangles (screen->dpy (), priv->id, | 911 | boundingShapeRects = XShapeGetRectangles (screen->dpy (), priv->id, |
741 | 1187 | ShapeBounding, &nBounding, &order); | 912 | ShapeBounding, &nBounding, &order); |
742 | 1188 | inputShapeRects = XShapeGetRectangles (screen->dpy (), priv->id, | 913 | inputShapeRects = XShapeGetRectangles (screen->dpy (), priv->id, |
743 | 1189 | ShapeInput, &nInput, &order); | 914 | ShapeInput, &nInput, &order); |
744 | 1190 | |||
745 | 1191 | } | 915 | } |
746 | 1192 | 916 | ||
751 | 1193 | r.x = -priv->geometry.border (); | 917 | r.x = -priv->serverGeometry.border (); |
752 | 1194 | r.y = -priv->geometry.border (); | 918 | r.y = -priv->serverGeometry.border (); |
753 | 1195 | r.width = priv->width + priv->geometry.border (); | 919 | r.width = priv->serverGeometry.width () + priv->serverGeometry.border (); |
754 | 1196 | r.height = priv->height + priv->geometry.border (); | 920 | r.height = priv->serverGeometry.height () + priv->serverGeometry.border (); |
755 | 1197 | 921 | ||
756 | 1198 | if (nBounding < 1) | 922 | if (nBounding < 1) |
757 | 1199 | { | 923 | { |
758 | @@ -1726,7 +1450,7 @@ | |||
759 | 1726 | priv->attrib.map_state = IsUnmapped; | 1450 | priv->attrib.map_state = IsUnmapped; |
760 | 1727 | priv->invisible = true; | 1451 | priv->invisible = true; |
761 | 1728 | 1452 | ||
763 | 1729 | if (priv->shaded && priv->height) | 1453 | if (priv->shaded) |
764 | 1730 | { | 1454 | { |
765 | 1731 | priv->updateFrameWindow (); | 1455 | priv->updateFrameWindow (); |
766 | 1732 | } | 1456 | } |
767 | @@ -1794,7 +1518,7 @@ | |||
768 | 1794 | } | 1518 | } |
769 | 1795 | 1519 | ||
770 | 1796 | bool | 1520 | bool |
772 | 1797 | CompWindow::resize (XWindowAttributes attr) | 1521 | CompWindow::resize (const XWindowAttributes &attr) |
773 | 1798 | { | 1522 | { |
774 | 1799 | return resize (Geometry (attr.x, attr.y, attr.width, attr.height, | 1523 | return resize (Geometry (attr.x, attr.y, attr.width, attr.height, |
775 | 1800 | attr.border_width)); | 1524 | attr.border_width)); |
776 | @@ -1811,7 +1535,7 @@ | |||
777 | 1811 | } | 1535 | } |
778 | 1812 | 1536 | ||
779 | 1813 | bool | 1537 | bool |
781 | 1814 | CompWindow::resize (CompWindow::Geometry gm) | 1538 | PrivateWindow::resize (const CompWindow::Geometry &gm) |
782 | 1815 | { | 1539 | { |
783 | 1816 | /* Input extents are now the last thing sent | 1540 | /* Input extents are now the last thing sent |
784 | 1817 | * from the server. This might not work in some | 1541 | * from the server. This might not work in some |
785 | @@ -1828,12 +1552,8 @@ | |||
786 | 1828 | priv->geometry.height () != gm.height () || | 1552 | priv->geometry.height () != gm.height () || |
787 | 1829 | priv->geometry.border () != gm.border ()) | 1553 | priv->geometry.border () != gm.border ()) |
788 | 1830 | { | 1554 | { |
789 | 1831 | int pw, ph; | ||
790 | 1832 | int dx, dy, dwidth, dheight; | 1555 | int dx, dy, dwidth, dheight; |
791 | 1833 | 1556 | ||
792 | 1834 | pw = gm.width () + gm.border () * 2; | ||
793 | 1835 | ph = gm.height () + gm.border () * 2; | ||
794 | 1836 | |||
795 | 1837 | dx = gm.x () - priv->geometry.x (); | 1557 | dx = gm.x () - priv->geometry.x (); |
796 | 1838 | dy = gm.y () - priv->geometry.y (); | 1558 | dy = gm.y () - priv->geometry.y (); |
797 | 1839 | dwidth = gm.width () - priv->geometry.width (); | 1559 | dwidth = gm.width () - priv->geometry.width (); |
798 | @@ -1843,37 +1563,60 @@ | |||
799 | 1843 | gm.width (), gm.height (), | 1563 | gm.width (), gm.height (), |
800 | 1844 | gm.border ()); | 1564 | gm.border ()); |
801 | 1845 | 1565 | ||
804 | 1846 | priv->width = pw; | 1566 | if (priv->attrib.override_redirect) |
805 | 1847 | priv->height = ph; | 1567 | { |
806 | 1568 | priv->serverGeometry = priv->geometry; | ||
807 | 1569 | priv->serverFrameGeometry = priv->frameGeometry; | ||
808 | 1570 | } | ||
809 | 1848 | 1571 | ||
810 | 1849 | if (priv->mapNum) | 1572 | if (priv->mapNum) |
811 | 1850 | priv->updateRegion (); | 1573 | priv->updateRegion (); |
812 | 1851 | 1574 | ||
814 | 1852 | resizeNotify (dx, dy, dwidth, dheight); | 1575 | window->resizeNotify (dx, dy, dwidth, dheight); |
815 | 1853 | 1576 | ||
816 | 1854 | priv->invisible = priv->isInvisible (); | 1577 | priv->invisible = priv->isInvisible (); |
817 | 1855 | } | 1578 | } |
818 | 1856 | else if (priv->geometry.x () != gm.x () || priv->geometry.y () != gm.y ()) | 1579 | else if (priv->geometry.x () != gm.x () || priv->geometry.y () != gm.y ()) |
819 | 1857 | { | 1580 | { |
836 | 1858 | int dx, dy; | 1581 | move (gm.x () - priv->geometry.x (), |
837 | 1859 | 1582 | gm.y () - priv->geometry.y (), true); | |
822 | 1860 | dx = gm.x () - priv->geometry.x (); | ||
823 | 1861 | dy = gm.y () - priv->geometry.y (); | ||
824 | 1862 | |||
825 | 1863 | priv->geometry.setX (gm.x ()); | ||
826 | 1864 | priv->geometry.setY (gm.y ()); | ||
827 | 1865 | |||
828 | 1866 | priv->region.translate (dx, dy); | ||
829 | 1867 | priv->inputRegion.translate (dx, dy); | ||
830 | 1868 | if (!priv->frameRegion.isEmpty ()) | ||
831 | 1869 | priv->frameRegion.translate (dx, dy); | ||
832 | 1870 | |||
833 | 1871 | priv->invisible = priv->isInvisible (); | ||
834 | 1872 | |||
835 | 1873 | moveNotify (dx, dy, true); | ||
838 | 1874 | } | 1583 | } |
839 | 1875 | 1584 | ||
841 | 1876 | updateFrameRegion (); | 1585 | window->updateFrameRegion (); |
842 | 1586 | |||
843 | 1587 | return true; | ||
844 | 1588 | } | ||
845 | 1589 | |||
846 | 1590 | bool | ||
847 | 1591 | PrivateWindow::resize (const XWindowAttributes &attr) | ||
848 | 1592 | { | ||
849 | 1593 | return resize (CompWindow::Geometry (attr.x, attr.y, attr.width, attr.height, | ||
850 | 1594 | attr.border_width)); | ||
851 | 1595 | } | ||
852 | 1596 | |||
853 | 1597 | bool | ||
854 | 1598 | PrivateWindow::resize (int x, | ||
855 | 1599 | int y, | ||
856 | 1600 | int width, | ||
857 | 1601 | int height, | ||
858 | 1602 | int border) | ||
859 | 1603 | { | ||
860 | 1604 | return resize (CompWindow::Geometry (x, y, width, height, border)); | ||
861 | 1605 | } | ||
862 | 1606 | |||
863 | 1607 | bool | ||
864 | 1608 | CompWindow::resize (const CompWindow::Geometry &gm) | ||
865 | 1609 | { | ||
866 | 1610 | XWindowChanges xwc = XWINDOWCHANGES_INIT; | ||
867 | 1611 | unsigned int valueMask = CWX | CWY | CWWidth | CWHeight | CWBorderWidth; | ||
868 | 1612 | |||
869 | 1613 | xwc.x = gm.x (); | ||
870 | 1614 | xwc.y = gm.y (); | ||
871 | 1615 | xwc.width = gm.width (); | ||
872 | 1616 | xwc.height = gm.height (); | ||
873 | 1617 | xwc.border_width = gm.border (); | ||
874 | 1618 | |||
875 | 1619 | configureXWindow (valueMask, &xwc); | ||
876 | 1877 | 1620 | ||
877 | 1878 | return true; | 1621 | return true; |
878 | 1879 | } | 1622 | } |
879 | @@ -2041,13 +1784,7 @@ | |||
880 | 2041 | ce->border_width); | 1784 | ce->border_width); |
881 | 2042 | else | 1785 | else |
882 | 2043 | { | 1786 | { |
890 | 2044 | if (ce->override_redirect) | 1787 | resize (ce->x, ce->y, ce->width, ce->height, ce->border_width); |
884 | 2045 | { | ||
885 | 2046 | priv->serverGeometry.set (ce->x, ce->y, ce->width, ce->height, | ||
886 | 2047 | ce->border_width); | ||
887 | 2048 | } | ||
888 | 2049 | |||
889 | 2050 | window->resize (ce->x, ce->y, ce->width, ce->height, ce->border_width); | ||
891 | 2051 | } | 1788 | } |
892 | 2052 | 1789 | ||
893 | 2053 | if (ce->event == screen->root ()) | 1790 | if (ce->event == screen->root ()) |
894 | @@ -2128,7 +1865,7 @@ | |||
895 | 2128 | if (priv->syncWait) | 1865 | if (priv->syncWait) |
896 | 2129 | priv->syncGeometry.set (x, y, width, height, ce->border_width); | 1866 | priv->syncGeometry.set (x, y, width, height, ce->border_width); |
897 | 2130 | else | 1867 | else |
899 | 2131 | window->resize (x, y, width, height, ce->border_width); | 1868 | resize (x, y, width, height, ce->border_width); |
900 | 2132 | 1869 | ||
901 | 2133 | if (priv->restack (ce->above)) | 1870 | if (priv->restack (ce->above)) |
902 | 2134 | priv->updatePassiveButtonGrabs (); | 1871 | priv->updatePassiveButtonGrabs (); |
903 | @@ -2137,27 +1874,6 @@ | |||
904 | 2137 | 1874 | ||
905 | 2138 | if (above) | 1875 | if (above) |
906 | 2139 | above->priv->updatePassiveButtonGrabs (); | 1876 | above->priv->updatePassiveButtonGrabs (); |
907 | 2140 | |||
908 | 2141 | if (!pendingConfigures.pending ()) | ||
909 | 2142 | { | ||
910 | 2143 | /* Tell plugins its ok to start doing stupid things again but | ||
911 | 2144 | * obviously FIXME */ | ||
912 | 2145 | CompOption::Vector options; | ||
913 | 2146 | CompOption::Value v; | ||
914 | 2147 | |||
915 | 2148 | options.push_back (CompOption ("window", CompOption::TypeInt)); | ||
916 | 2149 | v.set ((int) id); | ||
917 | 2150 | options.back ().set (v); | ||
918 | 2151 | options.push_back (CompOption ("active", CompOption::TypeInt)); | ||
919 | 2152 | v.set ((int) 0); | ||
920 | 2153 | options.back ().set (v); | ||
921 | 2154 | |||
922 | 2155 | /* Notify other plugins that it is unsafe to change geometry or serverGeometry | ||
923 | 2156 | * FIXME: That API should not be accessible to plugins, this is a hack to avoid | ||
924 | 2157 | * breaking ABI */ | ||
925 | 2158 | |||
926 | 2159 | screen->handleCompizEvent ("core", "lock_position", options); | ||
927 | 2160 | } | ||
928 | 2161 | } | 1877 | } |
929 | 2162 | 1878 | ||
930 | 2163 | void | 1879 | void |
931 | @@ -2180,23 +1896,34 @@ | |||
932 | 2180 | { | 1896 | { |
933 | 2181 | if (dx || dy) | 1897 | if (dx || dy) |
934 | 2182 | { | 1898 | { |
944 | 2183 | gettimeofday (&priv->lastGeometryUpdate, NULL); | 1899 | XWindowChanges xwc = XWINDOWCHANGES_INIT; |
945 | 2184 | 1900 | unsigned int valueMask = CWX | CWY; | |
946 | 2185 | /* Don't allow window movement to overwrite working geometries | 1901 | |
947 | 2186 | * last received from the server if we know there are pending | 1902 | xwc.x = priv->serverGeometry.x () + dx; |
948 | 2187 | * ConfigureNotify events on this window. That's a clunky workaround | 1903 | xwc.y = priv->serverGeometry.y () + dy; |
949 | 2188 | * and a FIXME in any case, however, until we can break the API | 1904 | |
950 | 2189 | * and remove CompWindow::move, this will need to be the case */ | 1905 | priv->nextMoveImmediate = immediate; |
951 | 2190 | 1906 | ||
952 | 2191 | if (!priv->pendingConfigures.pending ()) | 1907 | configureXWindow (valueMask, &xwc); |
953 | 1908 | } | ||
954 | 1909 | } | ||
955 | 1910 | |||
956 | 1911 | void | ||
957 | 1912 | PrivateWindow::move (int dx, | ||
958 | 1913 | int dy, | ||
959 | 1914 | bool immediate) | ||
960 | 1915 | { | ||
961 | 1916 | if (dx || dy) | ||
962 | 1917 | { | ||
963 | 1918 | priv->geometry.setX (priv->geometry.x () + dx); | ||
964 | 1919 | priv->geometry.setY (priv->geometry.y () + dy); | ||
965 | 1920 | priv->frameGeometry.setX (priv->frameGeometry.x () + dx); | ||
966 | 1921 | priv->frameGeometry.setY (priv->frameGeometry.y () + dy); | ||
967 | 1922 | |||
968 | 1923 | if (priv->attrib.override_redirect) | ||
969 | 2192 | { | 1924 | { |
977 | 2193 | priv->geometry.setX (priv->geometry.x () + dx); | 1925 | priv->serverGeometry = priv->geometry; |
978 | 2194 | priv->geometry.setY (priv->geometry.y () + dy); | 1926 | priv->serverFrameGeometry = priv->frameGeometry; |
972 | 2195 | priv->frameGeometry.setX (priv->frameGeometry.x () + dx); | ||
973 | 2196 | priv->frameGeometry.setY (priv->frameGeometry.y () + dy); | ||
974 | 2197 | |||
975 | 2198 | priv->pendingPositionUpdates = true; | ||
976 | 2199 | |||
979 | 2200 | priv->region.translate (dx, dy); | 1927 | priv->region.translate (dx, dy); |
980 | 2201 | priv->inputRegion.translate (dx, dy); | 1928 | priv->inputRegion.translate (dx, dy); |
981 | 2202 | if (!priv->frameRegion.isEmpty ()) | 1929 | if (!priv->frameRegion.isEmpty ()) |
982 | @@ -2204,19 +1931,7 @@ | |||
983 | 2204 | 1931 | ||
984 | 2205 | priv->invisible = priv->isInvisible (); | 1932 | priv->invisible = priv->isInvisible (); |
985 | 2206 | 1933 | ||
999 | 2207 | moveNotify (dx, dy, immediate); | 1934 | window->moveNotify (dx, dy, true); |
987 | 2208 | } | ||
988 | 2209 | else | ||
989 | 2210 | { | ||
990 | 2211 | XWindowChanges xwc = XWINDOWCHANGES_INIT; | ||
991 | 2212 | unsigned int valueMask = CWX | CWY; | ||
992 | 2213 | compLogMessage ("core", CompLogLevelDebug, "pending configure notifies on 0x%x, "\ | ||
993 | 2214 | "moving window asyncrhonously!", (unsigned int) priv->serverId); | ||
994 | 2215 | |||
995 | 2216 | xwc.x = priv->serverGeometry.x () + dx; | ||
996 | 2217 | xwc.y = priv->serverGeometry.y () + dy; | ||
997 | 2218 | |||
998 | 2219 | configureXWindow (valueMask, &xwc); | ||
1000 | 2220 | } | 1935 | } |
1001 | 2221 | } | 1936 | } |
1002 | 2222 | } | 1937 | } |
1003 | @@ -2227,22 +1942,6 @@ | |||
1004 | 2227 | return !mEvents.empty (); | 1942 | return !mEvents.empty (); |
1005 | 2228 | } | 1943 | } |
1006 | 2229 | 1944 | ||
1007 | 2230 | bool | ||
1008 | 2231 | PrivateWindow::checkClear () | ||
1009 | 2232 | { | ||
1010 | 2233 | if (pendingConfigures.pending ()) | ||
1011 | 2234 | { | ||
1012 | 2235 | /* FIXME: This is a hack to avoid performance regressions | ||
1013 | 2236 | * and must be removed in 0.9.6 */ | ||
1014 | 2237 | compLogMessage ("core", CompLogLevelWarn, "failed to receive ConfigureNotify event on 0x%x\n", | ||
1015 | 2238 | id); | ||
1016 | 2239 | pendingConfigures.dump (); | ||
1017 | 2240 | pendingConfigures.clear (); | ||
1018 | 2241 | } | ||
1019 | 2242 | |||
1020 | 2243 | return false; | ||
1021 | 2244 | } | ||
1022 | 2245 | |||
1023 | 2246 | void | 1945 | void |
1024 | 2247 | compiz::X11::PendingEventQueue::add (PendingEvent::Ptr p) | 1946 | compiz::X11::PendingEventQueue::add (PendingEvent::Ptr p) |
1025 | 2248 | { | 1947 | { |
1026 | @@ -2464,21 +2163,6 @@ | |||
1027 | 2464 | mValueMask (valueMask), | 2163 | mValueMask (valueMask), |
1028 | 2465 | mXwc (*xwc) | 2164 | mXwc (*xwc) |
1029 | 2466 | { | 2165 | { |
1030 | 2467 | CompOption::Vector options; | ||
1031 | 2468 | CompOption::Value v; | ||
1032 | 2469 | |||
1033 | 2470 | options.push_back (CompOption ("window", CompOption::TypeInt)); | ||
1034 | 2471 | v.set ((int) w); | ||
1035 | 2472 | options.back ().set (v); | ||
1036 | 2473 | options.push_back (CompOption ("active", CompOption::TypeInt)); | ||
1037 | 2474 | v.set ((int) 1); | ||
1038 | 2475 | options.back ().set (v); | ||
1039 | 2476 | |||
1040 | 2477 | /* Notify other plugins that it is unsafe to change geometry or serverGeometry | ||
1041 | 2478 | * FIXME: That API should not be accessible to plugins, this is a hack to avoid | ||
1042 | 2479 | * breaking ABI */ | ||
1043 | 2480 | |||
1044 | 2481 | screen->handleCompizEvent ("core", "lock_position", options); | ||
1045 | 2482 | } | 2166 | } |
1046 | 2483 | 2167 | ||
1047 | 2484 | compiz::X11::PendingConfigureEvent::~PendingConfigureEvent () | 2168 | compiz::X11::PendingConfigureEvent::~PendingConfigureEvent () |
1048 | @@ -2488,57 +2172,6 @@ | |||
1049 | 2488 | void | 2172 | void |
1050 | 2489 | CompWindow::syncPosition () | 2173 | CompWindow::syncPosition () |
1051 | 2490 | { | 2174 | { |
1052 | 2491 | gettimeofday (&priv->lastConfigureRequest, NULL); | ||
1053 | 2492 | |||
1054 | 2493 | unsigned int valueMask = CWX | CWY; | ||
1055 | 2494 | XWindowChanges xwc = XWINDOWCHANGES_INIT; | ||
1056 | 2495 | |||
1057 | 2496 | if (priv->pendingPositionUpdates && !priv->pendingConfigures.pending ()) | ||
1058 | 2497 | { | ||
1059 | 2498 | if (priv->serverFrameGeometry.x () == priv->frameGeometry.x ()) | ||
1060 | 2499 | valueMask &= ~(CWX); | ||
1061 | 2500 | if (priv->serverFrameGeometry.y () == priv->frameGeometry.y ()) | ||
1062 | 2501 | valueMask &= ~(CWY); | ||
1063 | 2502 | |||
1064 | 2503 | /* Because CompWindow::move can update the geometry last | ||
1065 | 2504 | * received from the server, we must indicate that no values | ||
1066 | 2505 | * changed, because when the ConfigureNotify comes around | ||
1067 | 2506 | * the values are going to be the same. That's obviously | ||
1068 | 2507 | * broken behaviour and worthy of a FIXME, but requires | ||
1069 | 2508 | * larger changes to the window movement system. */ | ||
1070 | 2509 | if (valueMask) | ||
1071 | 2510 | { | ||
1072 | 2511 | priv->serverGeometry.setX (priv->geometry.x ()); | ||
1073 | 2512 | priv->serverGeometry.setY (priv->geometry.y ()); | ||
1074 | 2513 | priv->serverFrameGeometry.setX (priv->frameGeometry.x ()); | ||
1075 | 2514 | priv->serverFrameGeometry.setY (priv->frameGeometry.y ()); | ||
1076 | 2515 | |||
1077 | 2516 | xwc.x = priv->serverFrameGeometry.x (); | ||
1078 | 2517 | xwc.y = priv->serverFrameGeometry.y (); | ||
1079 | 2518 | |||
1080 | 2519 | compiz::X11::PendingEvent::Ptr pc = | ||
1081 | 2520 | boost::shared_static_cast<compiz::X11::PendingEvent> (compiz::X11::PendingConfigureEvent::Ptr ( | ||
1082 | 2521 | new compiz::X11::PendingConfigureEvent ( | ||
1083 | 2522 | screen->dpy (), priv->serverFrame, 0, &xwc))); | ||
1084 | 2523 | |||
1085 | 2524 | priv->pendingConfigures.add (pc); | ||
1086 | 2525 | |||
1087 | 2526 | /* Got 3 seconds to get its stuff together */ | ||
1088 | 2527 | if (priv->mClearCheckTimeout.active ()) | ||
1089 | 2528 | priv->mClearCheckTimeout.stop (); | ||
1090 | 2529 | priv->mClearCheckTimeout.start (boost::bind (&PrivateWindow::checkClear, priv), | ||
1091 | 2530 | 2000, 2500); | ||
1092 | 2531 | XConfigureWindow (screen->dpy (), ROOTPARENT (this), valueMask, &xwc); | ||
1093 | 2532 | |||
1094 | 2533 | if (priv->serverFrame) | ||
1095 | 2534 | { | ||
1096 | 2535 | XMoveWindow (screen->dpy (), priv->wrapper, | ||
1097 | 2536 | priv->serverInput.left, priv->serverInput.top); | ||
1098 | 2537 | sendConfigureNotify (); | ||
1099 | 2538 | } | ||
1100 | 2539 | } | ||
1101 | 2540 | priv->pendingPositionUpdates = false; | ||
1102 | 2541 | } | ||
1103 | 2542 | } | 2175 | } |
1104 | 2543 | 2176 | ||
1105 | 2544 | bool | 2177 | bool |
1106 | @@ -3360,14 +2993,17 @@ | |||
1107 | 3360 | { | 2993 | { |
1108 | 3361 | unsigned int frameValueMask = 0; | 2994 | unsigned int frameValueMask = 0; |
1109 | 3362 | 2995 | ||
1110 | 3363 | /* Immediately sync window position | ||
1111 | 3364 | * if plugins were updating w->geometry () directly | ||
1112 | 3365 | * in order to avoid a race condition */ | ||
1113 | 3366 | |||
1114 | 3367 | window->syncPosition (); | ||
1115 | 3368 | |||
1116 | 3369 | /* Remove redundant bits */ | 2996 | /* Remove redundant bits */ |
1117 | 3370 | 2997 | ||
1118 | 2998 | xwc->x = valueMask & CWX ? xwc->x : serverGeometry.x (); | ||
1119 | 2999 | xwc->y = valueMask & CWY ? xwc->y : serverGeometry.y (); | ||
1120 | 3000 | xwc->width = valueMask & CWWidth ? xwc->width : serverGeometry.width (); | ||
1121 | 3001 | xwc->height = valueMask & CWHeight ? xwc->height : serverGeometry.height (); | ||
1122 | 3002 | xwc->border_width = valueMask & CWBorderWidth ? xwc->border_width : serverGeometry.border (); | ||
1123 | 3003 | |||
1124 | 3004 | /* FIXME: This is a total fallacy for the reparenting case | ||
1125 | 3005 | * at least since the client doesn't actually move here, it only | ||
1126 | 3006 | * moves within the frame */ | ||
1127 | 3371 | if (valueMask & CWX && serverGeometry.x () == xwc->x) | 3007 | if (valueMask & CWX && serverGeometry.x () == xwc->x) |
1128 | 3372 | valueMask &= ~(CWX); | 3008 | valueMask &= ~(CWX); |
1129 | 3373 | 3009 | ||
1130 | @@ -3434,18 +3070,15 @@ | |||
1131 | 3434 | compLogMessage ("core", CompLogLevelWarn, "restack_mode not Above"); | 3070 | compLogMessage ("core", CompLogLevelWarn, "restack_mode not Above"); |
1132 | 3435 | } | 3071 | } |
1133 | 3436 | 3072 | ||
1135 | 3437 | frameValueMask = valueMask; | 3073 | frameValueMask = CWX | CWY | CWWidth | CWHeight | (valueMask & (CWStackMode | CWSibling)); |
1136 | 3438 | 3074 | ||
1139 | 3439 | if (frameValueMask & CWX && | 3075 | if (serverFrameGeometry.x () == xwc->x - serverGeometry.border () - serverInput.left) |
1138 | 3440 | serverFrameGeometry.x () == xwc->x - serverGeometry.border () - serverInput.left) | ||
1140 | 3441 | frameValueMask &= ~(CWX); | 3076 | frameValueMask &= ~(CWX); |
1141 | 3442 | 3077 | ||
1144 | 3443 | if (frameValueMask & CWY && | 3078 | if (serverFrameGeometry.y () == xwc->y - serverGeometry.border () - serverInput.top) |
1143 | 3444 | serverFrameGeometry.y () == xwc->y - serverGeometry.border () - serverInput.top) | ||
1145 | 3445 | frameValueMask &= ~(CWY); | 3079 | frameValueMask &= ~(CWY); |
1146 | 3446 | 3080 | ||
1149 | 3447 | if (frameValueMask & CWWidth && | 3081 | if (serverFrameGeometry.width () == xwc->width + serverGeometry.border () * 2 |
1148 | 3448 | serverFrameGeometry.width () == xwc->width + serverGeometry.border () * 2 | ||
1150 | 3449 | + serverInput.left + serverInput.right) | 3082 | + serverInput.left + serverInput.right) |
1151 | 3450 | frameValueMask &= ~(CWWidth); | 3083 | frameValueMask &= ~(CWWidth); |
1152 | 3451 | 3084 | ||
1153 | @@ -3455,15 +3088,13 @@ | |||
1154 | 3455 | 3088 | ||
1155 | 3456 | if (shaded) | 3089 | if (shaded) |
1156 | 3457 | { | 3090 | { |
1159 | 3458 | if (frameValueMask & CWHeight && | 3091 | if (serverFrameGeometry.height () == serverGeometry.border () * 2 |
1158 | 3459 | serverFrameGeometry.height () == serverGeometry.border () * 2 | ||
1160 | 3460 | + serverInput.top + serverInput.bottom) | 3092 | + serverInput.top + serverInput.bottom) |
1161 | 3461 | frameValueMask &= ~(CWHeight); | 3093 | frameValueMask &= ~(CWHeight); |
1162 | 3462 | } | 3094 | } |
1163 | 3463 | else | 3095 | else |
1164 | 3464 | { | 3096 | { |
1167 | 3465 | if (frameValueMask & CWHeight && | 3097 | if (serverFrameGeometry.height () == xwc->height + serverGeometry.border () * 2 |
1166 | 3466 | serverFrameGeometry.height () == xwc->height + serverGeometry.border () * 2 | ||
1168 | 3467 | + serverInput.top + serverInput.bottom) | 3098 | + serverInput.top + serverInput.bottom) |
1169 | 3468 | frameValueMask &= ~(CWHeight); | 3099 | frameValueMask &= ~(CWHeight); |
1170 | 3469 | } | 3100 | } |
1171 | @@ -3493,12 +3124,9 @@ | |||
1172 | 3493 | serverFrameGeometry.setHeight (xwc->height + serverGeometry.border () * 2 | 3124 | serverFrameGeometry.setHeight (xwc->height + serverGeometry.border () * 2 |
1173 | 3494 | + serverInput.top + serverInput.bottom); | 3125 | + serverInput.top + serverInput.bottom); |
1174 | 3495 | } | 3126 | } |
1177 | 3496 | 3127 | ||
1176 | 3497 | |||
1178 | 3498 | if (serverFrame) | 3128 | if (serverFrame) |
1179 | 3499 | { | 3129 | { |
1180 | 3500 | gettimeofday (&lastConfigureRequest, NULL); | ||
1181 | 3501 | |||
1182 | 3502 | if (frameValueMask) | 3130 | if (frameValueMask) |
1183 | 3503 | { | 3131 | { |
1184 | 3504 | XWindowChanges wc = *xwc; | 3132 | XWindowChanges wc = *xwc; |
1185 | @@ -3514,15 +3142,20 @@ | |||
1186 | 3514 | screen->dpy (), priv->serverFrame, frameValueMask, &wc))); | 3142 | screen->dpy (), priv->serverFrame, frameValueMask, &wc))); |
1187 | 3515 | 3143 | ||
1188 | 3516 | pendingConfigures.add (pc); | 3144 | pendingConfigures.add (pc); |
1189 | 3517 | if (priv->mClearCheckTimeout.active ()) | ||
1190 | 3518 | priv->mClearCheckTimeout.stop (); | ||
1191 | 3519 | priv->mClearCheckTimeout.start (boost::bind (&PrivateWindow::checkClear, priv), | ||
1192 | 3520 | 2000, 2500); | ||
1193 | 3521 | 3145 | ||
1194 | 3522 | XConfigureWindow (screen->dpy (), serverFrame, frameValueMask, &wc); | 3146 | XConfigureWindow (screen->dpy (), serverFrame, frameValueMask, &wc); |
1195 | 3523 | } | 3147 | } |
1196 | 3148 | |||
1197 | 3524 | valueMask &= ~(CWSibling | CWStackMode); | 3149 | valueMask &= ~(CWSibling | CWStackMode); |
1198 | 3525 | 3150 | ||
1199 | 3151 | /* If the frame has changed position (eg, serverInput.top | ||
1200 | 3152 | * or serverInput.left have changed) then we also need to | ||
1201 | 3153 | * update the client and wrapper position */ | ||
1202 | 3154 | if (!(valueMask & CWX)) | ||
1203 | 3155 | valueMask |= frameValueMask & CWX; | ||
1204 | 3156 | if (!(valueMask & CWY)) | ||
1205 | 3157 | valueMask |= frameValueMask & CWY; | ||
1206 | 3158 | |||
1207 | 3526 | if (valueMask) | 3159 | if (valueMask) |
1208 | 3527 | { | 3160 | { |
1209 | 3528 | xwc->x = serverInput.left; | 3161 | xwc->x = serverInput.left; |
1210 | @@ -3710,6 +3343,9 @@ | |||
1211 | 3710 | CompWindow::configureXWindow (unsigned int valueMask, | 3343 | CompWindow::configureXWindow (unsigned int valueMask, |
1212 | 3711 | XWindowChanges *xwc) | 3344 | XWindowChanges *xwc) |
1213 | 3712 | { | 3345 | { |
1214 | 3346 | int dx = valueMask & CWX ? xwc->x - priv->serverGeometry.x () : 0; | ||
1215 | 3347 | int dy = valueMask & CWY ? xwc->y - priv->serverGeometry.y () : 0; | ||
1216 | 3348 | |||
1217 | 3713 | if (priv->managed && (valueMask & (CWSibling | CWStackMode))) | 3349 | if (priv->managed && (valueMask & (CWSibling | CWStackMode))) |
1218 | 3714 | { | 3350 | { |
1219 | 3715 | CompWindowList transients; | 3351 | CompWindowList transients; |
1220 | @@ -3764,6 +3400,16 @@ | |||
1221 | 3764 | { | 3400 | { |
1222 | 3765 | priv->reconfigureXWindow (valueMask, xwc); | 3401 | priv->reconfigureXWindow (valueMask, xwc); |
1223 | 3766 | } | 3402 | } |
1224 | 3403 | |||
1225 | 3404 | if (!overrideRedirect () && (dx || dy)) | ||
1226 | 3405 | { | ||
1227 | 3406 | priv->region.translate (dx, dy); | ||
1228 | 3407 | priv->inputRegion.translate (dx, dy); | ||
1229 | 3408 | if (!priv->frameRegion.isEmpty ()) | ||
1230 | 3409 | priv->frameRegion.translate (dx, dy); | ||
1231 | 3410 | moveNotify (dx, dy, priv->nextMoveImmediate); | ||
1232 | 3411 | priv->nextMoveImmediate = true; | ||
1233 | 3412 | } | ||
1234 | 3767 | } | 3413 | } |
1235 | 3768 | 3414 | ||
1236 | 3769 | int | 3415 | int |
1237 | @@ -4315,10 +3961,6 @@ | |||
1238 | 4315 | screen->dpy (), serverFrame, valueMask, &lxwc))); | 3961 | screen->dpy (), serverFrame, valueMask, &lxwc))); |
1239 | 4316 | 3962 | ||
1240 | 4317 | pendingConfigures.add (pc); | 3963 | pendingConfigures.add (pc); |
1241 | 4318 | if (priv->mClearCheckTimeout.active ()) | ||
1242 | 4319 | priv->mClearCheckTimeout.stop (); | ||
1243 | 4320 | priv->mClearCheckTimeout.start (boost::bind (&PrivateWindow::checkClear, priv), | ||
1244 | 4321 | 2000, 2500); | ||
1245 | 4322 | } | 3964 | } |
1246 | 4323 | 3965 | ||
1247 | 4324 | /* Below with no sibling puts the window at the bottom | 3966 | /* Below with no sibling puts the window at the bottom |
1248 | @@ -5489,7 +5131,7 @@ | |||
1249 | 5489 | m = priv->geometry.x () + offX; | 5131 | m = priv->geometry.x () + offX; |
1250 | 5490 | if (m - priv->input.left < (int) s->width () - vWidth) | 5132 | if (m - priv->input.left < (int) s->width () - vWidth) |
1251 | 5491 | rv.setX (offX + vWidth); | 5133 | rv.setX (offX + vWidth); |
1253 | 5492 | else if (m + priv->width + priv->input.right > vWidth) | 5134 | else if (m + priv->geometry.width () + priv->input.right > vWidth) |
1254 | 5493 | rv.setX (offX - vWidth); | 5135 | rv.setX (offX - vWidth); |
1255 | 5494 | else | 5136 | else |
1256 | 5495 | rv.setX (offX); | 5137 | rv.setX (offX); |
1257 | @@ -5504,7 +5146,7 @@ | |||
1258 | 5504 | m = priv->geometry.y () + offY; | 5146 | m = priv->geometry.y () + offY; |
1259 | 5505 | if (m - priv->input.top < (int) s->height () - vHeight) | 5147 | if (m - priv->input.top < (int) s->height () - vHeight) |
1260 | 5506 | rv.setY (offY + vHeight); | 5148 | rv.setY (offY + vHeight); |
1262 | 5507 | else if (m + priv->height + priv->input.bottom > vHeight) | 5149 | else if (m + priv->geometry.height () + priv->input.bottom > vHeight) |
1263 | 5508 | rv.setY (offY - vHeight); | 5150 | rv.setY (offY - vHeight); |
1264 | 5509 | else | 5151 | else |
1265 | 5510 | rv.setY (offY); | 5152 | rv.setY (offY); |
1266 | @@ -6080,7 +5722,7 @@ | |||
1267 | 6080 | 5722 | ||
1268 | 6081 | if (m - priv->output.left < (int) screen->width () - vWidth) | 5723 | if (m - priv->output.left < (int) screen->width () - vWidth) |
1269 | 6082 | wx = tx + vWidth; | 5724 | wx = tx + vWidth; |
1271 | 6083 | else if (m + priv->width + priv->output.right > vWidth) | 5725 | else if (m + priv->geometry.width () + priv->output.right > vWidth) |
1272 | 6084 | wx = tx - vWidth; | 5726 | wx = tx - vWidth; |
1273 | 6085 | } | 5727 | } |
1274 | 6086 | 5728 | ||
1275 | @@ -6090,7 +5732,7 @@ | |||
1276 | 6090 | 5732 | ||
1277 | 6091 | if (m - priv->output.top < (int) screen->height () - vHeight) | 5733 | if (m - priv->output.top < (int) screen->height () - vHeight) |
1278 | 6092 | wy = ty + vHeight; | 5734 | wy = ty + vHeight; |
1280 | 6093 | else if (m + priv->height + priv->output.bottom > vHeight) | 5735 | else if (m + priv->geometry.height () + priv->output.bottom > vHeight) |
1281 | 6094 | wy = ty - vHeight; | 5736 | wy = ty - vHeight; |
1282 | 6095 | } | 5737 | } |
1283 | 6096 | 5738 | ||
1284 | @@ -6316,9 +5958,6 @@ | |||
1285 | 6316 | priv->serverFrameGeometry = priv->frameGeometry = priv->syncGeometry | 5958 | priv->serverFrameGeometry = priv->frameGeometry = priv->syncGeometry |
1286 | 6317 | = priv->geometry = priv->serverGeometry; | 5959 | = priv->geometry = priv->serverGeometry; |
1287 | 6318 | 5960 | ||
1288 | 6319 | priv->width = priv->attrib.width + priv->attrib.border_width * 2; | ||
1289 | 6320 | priv->height = priv->attrib.height + priv->attrib.border_width * 2; | ||
1290 | 6321 | |||
1291 | 6322 | priv->sizeHints.flags = 0; | 5961 | priv->sizeHints.flags = 0; |
1292 | 6323 | 5962 | ||
1293 | 6324 | priv->recalcNormalHints (); | 5963 | priv->recalcNormalHints (); |
1294 | @@ -6340,8 +5979,7 @@ | |||
1295 | 6340 | 5979 | ||
1296 | 6341 | if (priv->attrib.c_class != InputOnly) | 5980 | if (priv->attrib.c_class != InputOnly) |
1297 | 6342 | { | 5981 | { |
1300 | 6343 | priv->region = CompRegion (priv->attrib.x, priv->attrib.y, | 5982 | priv->region = CompRegion (static_cast <CompRect> (priv->serverGeometry)); |
1299 | 6344 | priv->width, priv->height); | ||
1301 | 6345 | priv->inputRegion = priv->region; | 5983 | priv->inputRegion = priv->region; |
1302 | 6346 | 5984 | ||
1303 | 6347 | /* need to check for DisplayModal state on all windows */ | 5985 | /* need to check for DisplayModal state on all windows */ |
1304 | @@ -6586,8 +6224,6 @@ | |||
1305 | 6586 | hints (NULL), | 6224 | hints (NULL), |
1306 | 6587 | inputHint (true), | 6225 | inputHint (true), |
1307 | 6588 | alpha (false), | 6226 | alpha (false), |
1308 | 6589 | width (0), | ||
1309 | 6590 | height (0), | ||
1310 | 6591 | region (), | 6227 | region (), |
1311 | 6592 | wmType (0), | 6228 | wmType (0), |
1312 | 6593 | type (CompWindowTypeUnknownMask), | 6229 | type (CompWindowTypeUnknownMask), |
1313 | @@ -6622,7 +6258,6 @@ | |||
1314 | 6622 | pendingUnmaps (0), | 6258 | pendingUnmaps (0), |
1315 | 6623 | pendingMaps (0), | 6259 | pendingMaps (0), |
1316 | 6624 | pendingConfigures (screen->dpy ()), | 6260 | pendingConfigures (screen->dpy ()), |
1317 | 6625 | pendingPositionUpdates (false), | ||
1318 | 6626 | 6261 | ||
1319 | 6627 | startupId (0), | 6262 | startupId (0), |
1320 | 6628 | resName (0), | 6263 | resName (0), |
1321 | @@ -6824,8 +6459,8 @@ | |||
1322 | 6824 | priv->frameRegion &= CompRegion (r); | 6459 | priv->frameRegion &= CompRegion (r); |
1323 | 6825 | } | 6460 | } |
1324 | 6826 | 6461 | ||
1327 | 6827 | x = priv->geometry.x () - priv->input.left; | 6462 | x = priv->serverGeometry.x () - priv->input.left; |
1328 | 6828 | y = priv->geometry.y () - priv->input.top; | 6463 | y = priv->serverGeometry.y () - priv->input.top; |
1329 | 6829 | 6464 | ||
1330 | 6830 | XShapeCombineRegion (screen->dpy (), priv->serverFrame, | 6465 | XShapeCombineRegion (screen->dpy (), priv->serverFrame, |
1331 | 6831 | ShapeBounding, -x, -y, | 6466 | ShapeBounding, -x, -y, |
1332 | @@ -6866,6 +6501,11 @@ | |||
1333 | 6866 | 6501 | ||
1334 | 6867 | priv->updateSize (); | 6502 | priv->updateSize (); |
1335 | 6868 | priv->updateFrameWindow (); | 6503 | priv->updateFrameWindow (); |
1336 | 6504 | |||
1337 | 6505 | /* Always send a moveNotify | ||
1338 | 6506 | * whenever the frame extents update | ||
1339 | 6507 | * so that plugins can re-position appropriately */ | ||
1340 | 6508 | moveNotify (0, 0, true); | ||
1341 | 6869 | } | 6509 | } |
1342 | 6870 | 6510 | ||
1343 | 6871 | /* Use b for _NET_WM_FRAME_EXTENTS here because | 6511 | /* Use b for _NET_WM_FRAME_EXTENTS here because |
1344 | 6872 | 6512 | ||
1345 | === modified file 'src/windowgeometry.cpp' | |||
1346 | --- src/windowgeometry.cpp 2012-01-23 05:44:19 +0000 | |||
1347 | +++ src/windowgeometry.cpp 2012-02-25 14:51:17 +0000 | |||
1348 | @@ -61,22 +61,22 @@ | |||
1349 | 61 | int | 61 | int |
1350 | 62 | CompWindow::width () const | 62 | CompWindow::width () const |
1351 | 63 | { | 63 | { |
1353 | 64 | return priv->width + | 64 | return priv->geometry.width () + |
1354 | 65 | priv->geometry.border () * 2; | 65 | priv->geometry.border () * 2; |
1355 | 66 | } | 66 | } |
1356 | 67 | 67 | ||
1357 | 68 | int | 68 | int |
1358 | 69 | CompWindow::height () const | 69 | CompWindow::height () const |
1359 | 70 | { | 70 | { |
1361 | 71 | return priv->height + | 71 | return priv->geometry.height () + |
1362 | 72 | priv->geometry.border () * 2;; | 72 | priv->geometry.border () * 2;; |
1363 | 73 | } | 73 | } |
1364 | 74 | 74 | ||
1365 | 75 | CompSize | 75 | CompSize |
1366 | 76 | CompWindow::size () const | 76 | CompWindow::size () const |
1367 | 77 | { | 77 | { |
1370 | 78 | return CompSize (priv->width + priv->geometry.border () * 2, | 78 | return CompSize (priv->geometry.width () + priv->geometry.border () * 2, |
1371 | 79 | priv->height + priv->geometry.border () * 2); | 79 | priv->geometry.height () + priv->geometry.border () * 2); |
1372 | 80 | } | 80 | } |
1373 | 81 | 81 | ||
1374 | 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-