ratpoison-devel
[Top][All Lists]
Advanced

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

Re: [RP] virtual screens


From: Gergely Nagy
Subject: Re: [RP] virtual screens
Date: Wed Jun 5 09:06:02 2002
User-agent: Wanderlust/2.9.13 (Unchained Melody) Emacs/21.2 Mule/5.0 (SAKAKI)

Hi!

> The improvments are that the 'next' and 'select' commands now are aware of
> virtual screens. 'next' does not consider windows "visible" on other virtual
> screens and 'select' switches to the virtual screen the window is visible on
> (if any). The "Bad Window" problem should hopefully be eliminated with the
> new behaviour of 'next' as the same window shouldn't be able to be visible
> in more than one virtual screen at a time.

Wonderful!

> Although I use rp with this patch daily, I haven't tested it very
> thoroughly. It does at least seems to work well the way I use it.

I've been trying to break it for a few hours now, and I can raise only
three complaints, all of them pretty minor:

1) When I'm on an empty virtual screen, `next' and other commands tell
   me that there are no managed windows. However, there are, just on
   another screen. `windows' on the other hand displays them. I'd
   suggest adding some logic to detect this case, and if there are
   windows, but on a different screen, RP should echo "No managed
   windows on this screen".

2) It would be great if one could see the number of the screen a
   window is on in the output of `windows'

3) It might be a little overkill, but dynamic allocation of virtual
   screens would rock.

To contribute some things to this great piece of code, I made a patch
for my first complaint. I'm not entirely sure that this is the right
approach, but it appears to work. :)

Apply it after the vscreen patch.

-=-

2002-06-05  Gergely Nagy  <address@hidden>

        * src/actions.c (cmd_next, cmd_prev): If there are managed
          windows, but on other screens, tell so.
        * src/messages.h (MESSAGE_NO_WINDOW_ON_SCREEN): new message

diff -u -urad ratpoison-patched/src/actions.c ratpoison-work/src/actions.c
--- ratpoison-patched/src/actions.c     Wed Jun  5 13:55:53 2002
+++ ratpoison-work/src/actions.c        Wed Jun  5 14:29:05 2002
@@ -612,7 +612,12 @@
     {
       set_active_window (find_window_other());
       if (!current_window())
-       message (MESSAGE_NO_MANAGED_WINDOWS);
+       {
+         if (rp_mapped_window_sentinel->next != rp_mapped_window_sentinel)
+             message(MESSAGE_NO_WINDOWS_ON_SCREEN);
+         else
+           message (MESSAGE_NO_MANAGED_WINDOWS);
+       }
 
       return NULL;
     }
@@ -654,7 +659,12 @@
     {
       set_active_window (find_window_other());
       if (!current_window())
-       message (MESSAGE_NO_MANAGED_WINDOWS);
+       {
+         if (rp_mapped_window_sentinel->next != rp_mapped_window_sentinel)
+             message(MESSAGE_NO_WINDOWS_ON_SCREEN);
+         else
+           message (MESSAGE_NO_MANAGED_WINDOWS);
+       }
 
       return NULL;
     }
diff -u -urad ratpoison-patched/src/messages.h ratpoison-work/src/messages.h
--- ratpoison-patched/src/messages.h    Mon Jan 28 23:53:29 2002
+++ ratpoison-work/src/messages.h       Wed Jun  5 14:27:13 2002
@@ -27,6 +27,7 @@
 #define MESSAGE_NO_OTHER_WINDOW        " No other window "
 #define MESSAGE_NO_OTHER_FRAME                 " No other frame "
 #define MESSAGE_NO_MANAGED_WINDOWS     " No managed windows "
+#define MESSAGE_NO_WINDOWS_ON_SCREEN   " No windows on this screen "
 #define MESSAGE_UNKNOWN_COMMAND        ": unknown command '%s' "
 #define MESSAGE_WINDOW_INFORMATION     " This is window %d (%s) "
 
-=-

While there, I've gone ahead and came up with a patch for my second
complaint too. This should be applied after the vscreen patch and the
patch above.

-=-

2002-06-05  Gergely Nagy  <address@hidden>

        * src/list.c (format_window_name): handle %v
        * src/split.c (frames_vscreen): Remove the `static' attribute,
          this is used by format_window_name above
        * src/split.h: Added a definition for frames_vscreen

diff -u -urad ratpoison-nowinscreen/src/list.c ratpoison-work/src/list.c
--- ratpoison-nowinscreen/src/list.c    Mon Jan 28 23:53:29 2002
+++ ratpoison-work/src/list.c   Wed Jun  5 15:00:22 2002
@@ -695,6 +695,11 @@
              sbuf_concat (buffer, dbuf);
              break;
 
+           case 'v':
+             snprintf (dbuf, 9, "%d", frames_vscreen(find_windows_frame(win)));
+             sbuf_concat (buffer, dbuf);
+             break;
+             
            case '%':
              sbuf_concat (buffer, "%");
              break;
diff -u -urad ratpoison-nowinscreen/src/split.c ratpoison-work/src/split.c
--- ratpoison-nowinscreen/src/split.c   Wed Jun  5 13:55:53 2002
+++ ratpoison-work/src/split.c  Wed Jun  5 14:57:14 2002
@@ -72,7 +72,7 @@
   return NULL;
 }
 
-static int
+int
 frames_vscreen (rp_window_frame *frame)
 {
   int i, j;
diff -u -urad ratpoison-nowinscreen/src/split.h ratpoison-work/src/split.h
--- ratpoison-nowinscreen/src/split.h   Wed Jun  5 13:55:53 2002
+++ ratpoison-work/src/split.h  Wed Jun  5 14:57:35 2002
@@ -47,5 +47,6 @@
 rp_window_frame *find_last_frame (screen_info *s);
 
 void set_virtual_screen (int vscreen_num, int rel);
+int frames_vscreen (rp_window_frame *frame);
 
 #endif

-=-

Finally, the vscreen stuff and my modifications should be
documented. Patch below.

-=-

2002-06-05  Gergely Nagy  <address@hidden>

        * doc/ratpoison.texi, doc/ratpoison.1: Document the vscreen
          commands, and alter the wording of `prev' and `next'.

diff -u -urad ratpoison-defwinfmt/doc/ratpoison.1 ratpoison-work/doc/ratpoison.1
--- ratpoison-defwinfmt/doc/ratpoison.1 Sat Feb  2 16:13:46 2002
+++ ratpoison-work/doc/ratpoison.1      Wed Jun  5 15:16:34 2002
@@ -236,6 +236,9 @@
 `%t'
 Window Name
 
+`%v'
+Windows virtual screen
+
 `%a'
 Application Name
 
@@ -348,9 +351,8 @@
 ugly rodent! Yuck! Avoid!
 .TP
 .B next
-This jumps you to the next window in the window list. This one is
-bound to three keystrokes, namely `C\-t n', `C\-t space', and `C\-t
-enter'.
+This jumps you to the next window on the screen. This one is bound to
+three keystrokes, namely `C\-t n', `C\-t space', and `C\-t enter'.
 .TP
 .B number \fIN TARGET\fP
 Set a window's number to \fIN\fP. If another window occupies the requested
@@ -368,8 +370,8 @@
 default, this is bound to `C\-t C\-t'.
 .TP
 .B prev
-This jumps you to the previous window in the window list. By
-default, this is bound to `C\-t p'.
+This jumps you to the previous window on the screen. By default, this
+is bound to `C\-t p'.
 .TP
 .B quit
 Quit ratpoison.
@@ -455,6 +457,13 @@
 .TP
 .B version
 Print ratpoison version. By default, this is bound to `C\-t v'.
+.TP
+.B vscreen \fINUMBER\fP
+Jumps to the virtual screen \fInumber\fP.
+.TP
+.B vscreen_rel \fINUMBER\fP
+Jumps to a virtual screen, which is \fINUMBER\fP entries away from the
+current one.
 .TP
 .B vsplit
 Split the current window vertically in two. The last accessed
diff -u -urad ratpoison-defwinfmt/doc/ratpoison.texi 
ratpoison-work/doc/ratpoison.texi
--- ratpoison-defwinfmt/doc/ratpoison.texi      Fri Mar 15 20:07:40 2002
+++ ratpoison-work/doc/ratpoison.texi   Wed Jun  5 15:14:14 2002
@@ -481,6 +481,8 @@
 Window status (current window, last window, etc)
 @item %t
 Window Name
address@hidden %v
+Windows virtual screen
 @item %a
 Application Name
 @item %c
@@ -585,9 +587,9 @@
 returned.
 
 @item next
-This jumps you to the next window in the window list. This one is
-bound to three keystrokes, namely @kbd{C-t n}, @kbd{C-t space},
-and @kbd{C-t enter}.
+This jumps you to the next window on the screen. This one is bound to
+three keystrokes, namely @kbd{C-t n}, @kbd{C-t space}, and @kbd{C-t
+enter}.
 
 @item nextscreen
 This jumps you to the next X11 screen. @command{nextscreen} is
@@ -613,8 +615,8 @@
 default, this is bound to @kbd{C-t C-t}.
 
 @item prev
-This jumps you to the previous window in the window list. By default,
-this is bound to @kbd{C-t p}.
+This jumps you to the previous window on the screen. By default, this
+is bound to @kbd{C-t p}.
 
 @item prevscreen
 This jumps you to the previous X11 screen. @command{prevscreen} is
@@ -705,6 +707,13 @@
 
 @item version
 Print ratpoison version.  By default, this is bound to @kbd{C-t v}.
+
address@hidden vscreen @var{number}
+Jumps to the virtual screen @var{number}.
+
address@hidden vscreen_rel @var{number}
+Jumps to a virtual screen, which is @var{number} entries away from the
+current one.
 
 @item vsplit
 Split the current window vertically in two. The last accessed window not

-=-

Attachment: pgpu7fZuIyXbY.pgp
Description: PGP signature


reply via email to

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