Re: FVWM: Alt-tab

From: Stian Sletner <stian_at_sletner.com>
Date: Mon, 29 Apr 2002 21:10:52 +0200

* At 2002-04-26T20:31+0000, Mikhael Goikhman wrote:
:
| What you want is for the Iconify command to move the window to the tail of
| the window list (from the head). This is probably doable now using some
| tricky script, but I don't think it is easy.
|
| The problem is that the Iconify command already transferes the focus, i.e.
| changes this list, but not in the way you want. A solution may be to add
| a global or Style option, like IconifyBringsToEnd or similar.
|
| Another solution is to add IconifiedAtEnd option to WindowList.

I hacked this last solution into the code, now. I've included a patch
for it, since I would really like to see this feature in FVWM. However,
since I'm new to both using and hacking FVWM, my patch should probably
be thoroughly checked before applied to anything (though it seems to
work). This patch is against 2.4.6, and thus includes the CurrentAtEnd
patch Jochen Klenner made (I had to make a little addition to it, too,
so that the current window comes behind the iconified ones).

(IconifiedAtEnd patch: diff -c fvwm/windowlist.c.orig fvwm/windowlist.c)

*** fvwm/windowlist.c.orig Fri Feb 22 23:07:48 2002
--- fvwm/windowlist.c Mon Apr 29 21:03:09 2002
***************
*** 87,92 ****
--- 87,93 ----
    char* ret_action = NULL;
    FvwmWindow *t;
    FvwmWindow **windowList;
+ FvwmWindow **iconifiedList;
    int numWindows;
    int ii;
    char tname[80] = "";
***************
*** 121,126 ****
--- 122,131 ----
    /* Condition vars. */
    Bool use_condition = False;
    Bool do_reverse_sort_order = False;
+ Bool current_at_end = False;
+ Bool iconified_at_end = False;
+ int ic = 0;
+ int ij;
    WindowConditionMask mask;
    char *cond_flags;
  
***************
*** 183,188 ****
--- 188,197 ----
          flags |= SHOW_ALPHABETIC;
        else if (StrEquals(tok,"ReverseOrder"))
          do_reverse_sort_order = True;
+ else if (StrEquals(tok,"CurrentAtEnd"))
+ current_at_end = True;
+ else if (StrEquals(tok,"IconifiedAtEnd"))
+ iconified_at_end = True;
        else if (StrEquals(tok,"NoDeskSort"))
          flags |= NO_DESK_SORT;
        else if (StrEquals(tok,"UseIconName"))
***************
*** 312,331 ****
    {
      return;
    }
    /* get the windowlist starting from the current window (if any)*/
! if ((t = get_focus_window()) == NULL)
      t = Scr.FvwmRoot.next;
    for (ii = 0; ii < numWindows; ii++)
    {
      if (do_reverse_sort_order)
        windowList[numWindows - ii - 1] = t;
      else
! windowList[ii] = t;
      if (t->next)
        t = t->next;
      else
        t = Scr.FvwmRoot.next;
    }
  
    /* Do alphabetic sort */
    if (flags & SHOW_ALPHABETIC)
--- 321,364 ----
    {
      return;
    }
+ if (iconified_at_end)
+ {
+ iconifiedList = malloc(numWindows*sizeof(t));
+ if (iconifiedList == NULL)
+ return;
+ }
    /* get the windowlist starting from the current window (if any)*/
! t = get_focus_window();
! if (t == NULL)
      t = Scr.FvwmRoot.next;
+ else if (current_at_end) {
+ if (t->next)
+ t = t->next;
+ else
+ t = Scr.FvwmRoot.next;
+ }
    for (ii = 0; ii < numWindows; ii++)
    {
      if (do_reverse_sort_order)
        windowList[numWindows - ii - 1] = t;
+ else if (iconified_at_end && IS_ICONIFIED(t))
+ iconifiedList[ic++] = t;
      else
! windowList[ii - ic] = t;
      if (t->next)
        t = t->next;
      else
        t = Scr.FvwmRoot.next;
    }
+ if (iconified_at_end && ic > 0)
+ {
+ if (current_at_end)
+ windowList[numWindows - 1] = windowList[--ii - ic];
+ for (ij = 0; ij < ic; ij++)
+ {
+ windowList[ij + (ii - ic)] = iconifiedList[ij];
+ }
+ }
  
    /* Do alphabetic sort */
    if (flags & SHOW_ALPHABETIC)
***************
*** 511,516 ****
--- 544,551 ----
    if (func)
      free(func);
    free(windowList);
+ if (iconified_at_end)
+ free(iconifiedList);
    if (!default_action && eventp && eventp->type == KeyPress)
      teventp = (XEvent *)1;
    else

-- 
Stian Sletner
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
Received on Mon Apr 29 2002 - 14:12:52 BST

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:53 BST