[patch] [FIX] Reverse Task Switch (Alt+Shift+Tab)

Olivier Fourdan fourdan at xfce.org
Wed Oct 29 21:39:19 CET 2003


Dan,

Why do you add the "break" in the case switches? By adding those, you
break the logic and that won't work... The walkthru is on purpose.

Cheers,
Olivier.

On Wed, 2003-10-29 at 19:58, Dan Compton wrote:
> I'm sorry but the previous patch had a small bug if your 
> cycle_windows_key included the Shift key (Mainly, when you let go of 
> Shift, the cycle windows window would not be relinguished).  This is a 
> replacement patch, it doesn't patch on top of the last patch because I 
> assume almost no one or no one has actually tried the original since 
> there have been no responses yet.
> 
> This applies to xfwm4-4.0.0.  Apply it by "patch -p0 < 
> xfwm4-4.0.0.shiftalttab-0.1.patch" above the xfwm4-4.0.0 directory.
> 
> Dan Compton
> 
> ______________________________________________________________________
> diff -aur xfwm4-4.0.0/src/client.c xfwm4-4.0.0.new/src/client.c
> --- xfwm4-4.0.0/src/client.c	2003-09-21 17:39:55.000000000 -0400
> +++ xfwm4-4.0.0.new/src/client.c	2003-10-29 13:43:50.000000000 -0500
> @@ -3547,6 +3547,33 @@
>      return NULL;
>  }
>  
> +Client *
> +clientGetPrevious (Client * c, int mask)
> +{
> +    Client *c2;
> +    unsigned int i;
> +
> +    TRACE ("entering clientGetPrevious");
> +
> +    if (c)
> +    {
> +        for (c2 = c->prev, i = 0; (c2) && (i < client_count);
> +            c2 = c2->prev, i++)
> +        {
> +            if ((c2->type == WINDOW_SPLASHSCREEN)
> +                || (c2->type == WINDOW_DESKTOP))
> +            {
> +                continue;
> +            }
> +            if (clientSelectMask (c2, mask))
> +            {
> +                return c2;
> +            }
> +        }
> +    }
> +    return NULL;
> +}
> +
>  /* Build a GList of clients that have a transient relationship */
>  static GList *
>  clientListTransient (Client * c)
> @@ -5617,12 +5644,14 @@
>                  clientGetFromWindow (((XDestroyWindowEvent *) xevent)->window,
>                      WINDOW));
>              status = XEV_FILTER_CONTINUE;
> +            break;
>          case UnmapNotify:
>              gone |=
>                  (passdata->c ==
>                  clientGetFromWindow (((XUnmapEvent *) xevent)->window,
>                      WINDOW));
>              status = XEV_FILTER_CONTINUE;
> +            break;
>          case KeyPress:
>              if (gone
>                  || (xevent->xkey.keycode ==
> @@ -5630,8 +5659,19 @@
>              {
>                  /* Hide frame draw */
>                  clientDrawOutline (passdata->c);
> -                passdata->c =
> -                    clientGetNext (passdata->c, passdata->cycle_range);
> +
> +                /* If KEY_CYCLE_WINDOWS has Shift, then do not reverse */
> +                if (!(params.keys[KEY_CYCLE_WINDOWS].modifier & ShiftMask)
> +                        && xevent->xkey.state & ShiftMask) {
> +                    passdata->c =
> +                        clientGetPrevious (passdata->c, passdata->cycle_range);
> +                }
> +                else
> +                {
> +                    passdata->c =
> +                        clientGetNext (passdata->c, passdata->cycle_range);
> +                }
> +
>                  if (passdata->c)
>                  {
>                      /* Redraw frame draw */
> @@ -5645,10 +5685,19 @@
>              }
>              break;
>          case KeyRelease:
> -            if (IsModifierKey (XKeycodeToKeysym (dpy, xevent->xkey.keycode,
> -                        0)))
>              {
> -                cycling = FALSE;
> +                int keysym = XKeycodeToKeysym (dpy, xevent->xkey.keycode, 0);
> +
> +                /* If KEY_CYCE_WINDOWS has Shift, then stop cycling on Shift
> +                 * release.
> +                 */
> +                if (IsModifierKey (keysym)
> +                        && ( (params.keys[KEY_CYCLE_WINDOWS].modifier
> +                             & ShiftMask)
> +                        || (keysym != XK_Shift_L && keysym != XK_Shift_R) ) )
> +                {
> +                    cycling = FALSE;
> +                }
>              }
>              break;
>          case ButtonPress:
> diff -aur xfwm4-4.0.0/src/client.h xfwm4-4.0.0.new/src/client.h
> --- xfwm4-4.0.0/src/client.h	2003-09-12 16:28:30.000000000 -0400
> +++ xfwm4-4.0.0.new/src/client.h	2003-10-29 01:38:51.000000000 -0500
> @@ -263,6 +263,7 @@
>  Client *clientGetFromWindow (Window, int);
>  Client *clientAtPosition (int, int, Client *);
>  Client *clientGetNext (Client *, int);
> +Client *clientGetPrevious (Client *, int);
>  void clientPassFocus (Client *);
>  void clientShow (Client *, gboolean);
>  void clientHide (Client *, int, gboolean);
> 
> ______________________________________________________________________
> _______________________________________________
> Xfce4-dev mailing list
> Xfce4-dev at xfce.org
> http://moongroup.com/mailman/listinfo/xfce4-dev
-- 
Olivier Fourdan - fourdan at xfce.org
   
   Interoperability is the keyword, uniformity is a dead end. 
   http://www.xfce.org






More information about the Xfce4-dev mailing list