On Fri, Feb 27, 2009 at 12:24 PM, Joel Bosveld <joel.bosv...@gmail.com>wrote:

> This adds an argument to the raise/lower/restackBelow/restackAbove window
> functions (default to false) which immediately reorders the window list.
> This is needed to make the functions work as expected when doing multiple
> restacks. Obviously, you would't be able to keep cycling through the window
> list, so this should not be used in that situation (as indicated in the
> comment in header).
>

I have attached new copy of the patch that should have fixed all the coding
style problems in the first patch.

Joel.


>
> This was needed to make my plugin (tag) work correctly. I have tried going
> through the list of windows I need pulled in front: both forwards and
> reverse, stacking above instead of below, raising bottom window instead of
> top - and not been able to make any combination work correctly. Even with
> maniac103's help I couldn't get it working ;)
>
> maniac said that this was a fundamental problem with the stacking code, and
> the whole lot needs to be looked over (iirc, or at least, something
> similar). This may not be what is needed, but it at least works, and doesn't
> affect anything else (only gives the ability to plugins which need such a
> feature). Or is this solution a bit too hacky? CompWindow::updateAttributes
> does something similar though. Comments?
>
> Joel.
>
> -----
>
>
> From b15c5e8f779becd08e31a858502b7d4d796fbcd4 Mon Sep 17 00:00:00 2001
> From: Joel Bosveld <joel.bosv...@gmail.com>
> Date: Fri, 27 Feb 2009 11:48:49 +0900
> Subject: [PATCH] Allow immediate reorder of window list after restack
>
> ---
>  include/core/window.h |   11 +++++++----
>  src/window.cpp        |   20 ++++++++++++++++----
>  2 files changed, 23 insertions(+), 8 deletions(-)
>
> diff --git a/include/core/window.h b/include/core/window.h
> index 3a62f58..6dee0bc 100644
> --- a/include/core/window.h
> +++ b/include/core/window.h
> @@ -370,13 +370,16 @@ class CompWindow :
>               int            gravity,
>               unsigned int   source);
>
> -    void raise ();
> +    /* If immediate is true for these functions,
> +     * it will reorder the window list immediately.
> +     * Do not do this while cycling through window list */
> +    void raise (bool immediate = false);
>
> -    void lower ();
> +    void lower (bool immediate = false);
>
> -    void restackAbove (CompWindow *sibling);
> +    void restackAbove (CompWindow *sibling, bool immediate = false);
>
> -    void restackBelow (CompWindow *sibling);
> +    void restackBelow (CompWindow *sibling, bool immediate = false);
>
>      void updateAttributes (CompStackingUpdateMode stackingMode);
>
> diff --git a/src/window.cpp b/src/window.cpp
> index 83bb4fa..46c84ae 100644
> --- a/src/window.cpp
> +++ b/src/window.cpp
> @@ -2806,7 +2806,7 @@ PrivateWindow::addWindowStackChanges (XWindowChanges
> *xwc,
>  }
>
>  void
> -CompWindow::raise ()
> +CompWindow::raise (bool immediate)
>  {
>      XWindowChanges xwc;
>      int           mask;
> @@ -2814,11 +2814,14 @@ CompWindow::raise ()
>      mask = priv->addWindowStackChanges (&xwc,
>      PrivateWindow::findSiblingBelow (this, false));
>      if (mask)
> +    {
>      configureXWindow (mask, &xwc);
> +    if(immediate) priv->restack (xwc.sibling);
> +    }
>  }
>
>  void
> -CompWindow::lower ()
> +CompWindow::lower (bool immediate)
>  {
>      XWindowChanges xwc;
>      int           mask;
> @@ -2826,11 +2829,14 @@ CompWindow::lower ()
>      mask = priv->addWindowStackChanges (&xwc,
>      PrivateWindow::findLowestSiblingBelow (this));
>      if (mask)
> +    {
>      configureXWindow (mask, &xwc);
> +    if(immediate) priv->restack (xwc.sibling);
> +    }
>  }
>
>  void
> -CompWindow::restackAbove (CompWindow *sibling)
> +CompWindow::restackAbove (CompWindow *sibling, bool immediate)
>  {
>      for (; sibling; sibling = sibling->next)
>      if (PrivateWindow::validSiblingBelow (this, sibling))
> @@ -2843,7 +2849,10 @@ CompWindow::restackAbove (CompWindow *sibling)
>
>      mask = priv->addWindowStackChanges (&xwc, sibling);
>      if (mask)
> +    {
>          configureXWindow (mask, &xwc);
> +        if(immediate) priv->restack (xwc.sibling);
> +    }
>      }
>  }
>
> @@ -2887,7 +2896,7 @@ PrivateWindow::findValidStackSiblingBelow (CompWindow
> *w,
>  }
>
>  void
> -CompWindow::restackBelow (CompWindow *sibling)
> +CompWindow::restackBelow (CompWindow *sibling, bool immediate)
>  {
>      XWindowChanges xwc;
>      unsigned int   mask;
> @@ -2896,7 +2905,10 @@ CompWindow::restackBelow (CompWindow *sibling)
>      PrivateWindow::findValidStackSiblingBelow (this, sibling));
>
>      if (mask)
> +    {
>      configureXWindow (mask, &xwc);
> +    if(immediate) priv->restack (xwc.sibling);
> +    }
>  }
>
>  void
> --
> 1.6.0.6
>
>

Attachment: 0001-Allow-immediate-reorder-of-window-list-after-restack.patch
Description: Binary data

_______________________________________________
Dev mailing list
Dev@lists.compiz-fusion.org
http://lists.compiz-fusion.org/mailman/listinfo/dev

Reply via email to