ratpoison-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RP] List architecture (potential bikeshed)


From: Mike Meyer
Subject: [RP] List architecture (potential bikeshed)
Date: Fri Oct 19 21:27:18 2001

In starting to work on the frame selection commands I discussed
earlier, I realized that there were essentially two sets of list
manipulation routines in ratpoison, one in list.c for handling lists
of windows, and one in split.c for handling frames.

I started unifying those, using the same mechanism used by X and
Intuition, of declaring a list type (rp_list) and putting it at the
head of both the rp_window and rp_window_frame, then manipulating
lists of windows via rp_list and typecasting to the rp_window type to
manipulate the window or frame. I converted the code, and then
realized it was time for a break for the weekend, so I figured I'd ask
for input before continuing.

The question for other developers - particularly committers - is
whether the style I outlined above bothers them. A typical example might
be:

struct rp_list
{
  int last_access;
  int number;
  int named;
  char *name;
  rp_list *prev, *next;
};

rp_list *rp_window_frame_sentinel;

void
maximize_all_windows_in_frame (rp_window_frame *frame)
{
  rp_list *win;

  for (win = rp_mapped_window_sentinel->next;
       win != rp_mapped_window_sentinel;
       win = win->next)
    {
      if (((rp_window *) win)->frame == frame)
        {
          maximize ((rp_window *) win);
        }
    }
}

The two window lists have the same structure. This lets
remove_from_list, append_to_list and so on be used on the frame list
as well, meaning I can (actually, have) removed them from split.c.

The ultimate goal is to be able to write soemthing like:

rp_list *find_number(rp_list *in, int n); 
rp_list *find_name(rp_list *in, char *name);

and use them for both frames and windwos.

The other alternative would be to lift the CIRCLEQ macros out of the
BSD kernels. These are documented here:

<URL:
http://www.FreeBSD.org/cgi/man.cgi?query=SLIST_EMPTY&apropos=0&sektion=0&manpath=FreeBSD+4.4-stable&format=html
>

I know some people hate the approach I started with. Do any of the
developers have preferences one way or another? Some third technic
I've missed?  Should I just ignore all this, and write the frame
selection commands without this restructuring?

        Thanx,
        <mike
--
Mike Meyer <address@hidden>                     http://www.mired.org/home/mwm/
Q: How do you make the gods laugh?              A: Tell them your plans.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]