ratpoison-devel
[Top][All Lists]
Advanced

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

Re: [RP] Patch to add number command. As in screen.


From: Martin Samuelsson
Subject: Re: [RP] Patch to add number command. As in screen.
Date: Fri, 16 Feb 2001 15:17:22 +0100
User-agent: Mutt/1.3.15i

resending again.

in case something of this is useful to get "number" working as in screen.

On Sun, Jan 28, 2001 at 04:49:01PM +0100, Martin Samuelsson wrote:
> Resend-mania!
> 
> On Thu, Dec 28, 2000 at 02:11:20PM +0100, Martin Samuelsson wrote:
> > I wrote some additional code. It's really ugly, but it works. With this 
> > applied it's possible to move a window to another number. Working exactly 
> > as in screen.
> > 
> > Do you like it?
> > -- 
> > /Martin
> 
> > diff -u -r ratpoison-cvs-20001228-1029/src/actions.c 
> > ratpoison-cvs-20001228-1029-with-number/src/actions.c
> > --- ratpoison-cvs-20001228-1029/src/actions.c       Fri Dec 15 20:52:28 2000
> > +++ ratpoison-cvs-20001228-1029-with-number/src/actions.c   Thu Dec 28 
> > 13:59:38 2000
> > @@ -2,6 +2,7 @@
> >     keystrokes */
> >  
> >  #include <unistd.h>
> > +#include <string.h>
> >  #include <sys/wait.h>
> >  #include <X11/keysym.h>
> >  
> > @@ -126,6 +127,26 @@
> >        update_window_names (rp_current_window->scr);
> >      }
> >  }
> > +void
> > +renumber_current_window (int newnumber)
> > +{
> > +  int oldnumber;
> > +  rp_window *otherwin;
> > +  
> > +  if (rp_current_window == NULL) return;
> > +
> > +  /* Save old number if the new is occupied. */
> > +  oldnumber = rp_current_window->number;
> > +
> > +  /* Find other window with same number and give it old number. */
> > +  if ((otherwin = find_window_by_number (newnumber)) != NULL)
> > +    otherwin->number = oldnumber;
> > +  
> > +  rp_current_window->number = newnumber;
> > +
> > +  /* Update the program bar. */
> > +  update_window_names (rp_current_window->scr);
> > +}
> >  
> >  
> >  void
> > @@ -159,6 +180,8 @@
> >  execute_command (void *data)
> >  {
> >    char cmd[100];
> > +  char errormsg[100];
> > +  int number;
> >  
> >    if (rp_current_window)
> >      {
> > @@ -173,7 +196,23 @@
> >  
> >    PRINT_DEBUG ("user entered: %s\n", cmd);
> >  
> > -  spawn (cmd);
> > +  /* This code is really ugly. It should be an own function, so that it 
> > could be reused when parsing a config file. - cosis */
> > +  if(!strncmp(cmd, "number", 6))
> > +  {
> > +      number = atol(cmd + 7);
> > +      renumber_current_window(number);
> > +      return;
> > +  }
> > +  if(!strncmp(cmd, "exec", 4))
> > +  {
> > +      spawn (cmd + 5);
> > +      return;
> > +  }
> > +
> > +  strcpy(errormsg, ": Unknown command '");
> > +  strncat(errormsg, cmd, 78);
> > +  strcat(errormsg, "'");
> > +  display_msg_in_bar (&screens[0], errormsg);
> >  }
> >  
> >  void
> 
> 
> -- 
> /Martin
> 
> _______________________________________________
> Ratpoison-devel mailing list
> address@hidden
> http://lists.sourceforge.net/lists/listinfo/ratpoison-devel

-- 
/Martin



reply via email to

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