summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsabetts <sabetts>2002-01-10 12:03:54 +0000
committersabetts <sabetts>2002-01-10 12:03:54 +0000
commit822fb64e44df92197e3705dfced24720a4a9f8d1 (patch)
treeb7bb8098a32a3366718d5d0da179228c123a313d
parent42a60a8766fad28daab030f799756ea1ef535467 (diff)
downloadratpoison-822fb64e44df92197e3705dfced24720a4a9f8d1.zip
* src/events.c (delegate_event): ignore the CirculateRequest event.
* src/actions.c (cmd_rename): Allows the user to specify a second argument which is the number of the window whose number will be set to the first argument.
-rw-r--r--ChangeLog8
-rw-r--r--doc/ratpoison.texi10
-rw-r--r--src/actions.c63
-rw-r--r--src/events.c5
4 files changed, 69 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index b660ba8..410e903 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2002-01-10 shawn <sabetts@vcn.bc.ca>
+
+ * src/events.c (delegate_event): ignore the CirculateRequest event.
+
+ * src/actions.c (cmd_rename): Allows the user to specify a second
+ argument which is the number of the window whose number will be
+ set to the first argument.
+
2002-01-09 Gergely Nagy <algernon@debian.org>
* src/actions.c (setenv, unsetenv): new functions, used when
diff --git a/doc/ratpoison.texi b/doc/ratpoison.texi
index 8a1431d..23b0233 100644
--- a/doc/ratpoison.texi
+++ b/doc/ratpoison.texi
@@ -565,9 +565,13 @@ and @kbd{C-t enter}.
This is a bad-bad command. It kills ratpoison and revives that
ugly rodent! Yuck! Avoid!
-@item number @var{n}
-Set the current window's number to @var{n}. If another window occupies
-the requested number already, then the windows' numbers are swapped.
+@item number @var{n} @var{target}
+Set a window's number to @var{n}. If another window occupies the
+requested number already, then the windows' numbers are swapped.
+
+The second argument, @var{target}, is optional. It should be the
+number of the window whose number will be changed. If @var{target} is
+omitted ratpoison defaults to the current window.
@item only
Kill all frames but the current one.
diff --git a/src/actions.c b/src/actions.c
index 4553ecc..da6e6e0 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1040,10 +1040,9 @@ char *
cmd_number (int interactive, void *data)
{
int old_number, new_number;
- rp_window *other_win;
+ rp_window *other_win, *win;
char *str;
-
- if (current_window() == NULL) return NULL;
+ char *tmp;
if (data == NULL)
{
@@ -1055,13 +1054,57 @@ cmd_number (int interactive, void *data)
str = xstrdup ((char *) data);
}
- if ((new_number = string_to_window_number (str)) >= 0)
+ tmp = strtok (str, " ");
+ if (tmp)
+ {
+ new_number = string_to_window_number (tmp);
+ if (new_number < 0)
+ {
+ message (" number: Bad argument ");
+ free (str);
+ return NULL;
+ }
+ }
+ else
+ {
+ /* Impossible, but we'll live with it. */
+ print_window_information (current_window());
+ free (str);
+ return NULL;
+ }
+
+ /* Get the rest of the string and see if the user specified a target
+ window. */
+ tmp = strtok (NULL, "");
+ if (tmp)
+ {
+ int win_number;
+
+ PRINT_DEBUG ("2nd: '%s'\n", tmp);
+
+ win_number = string_to_window_number (tmp);
+ if (win_number < 0)
+ {
+ message (" number: Bad argument ");
+ free (str);
+ return NULL;
+ }
+
+ win = find_window_number (win_number);
+ }
+ else
+ {
+ PRINT_DEBUG ("2nd: NULL\n");
+ win = current_window();
+ }
+
+ if ( new_number >= 0 && win)
{
/* Find other window with same number and give it old number. */
other_win = find_window_number (new_number);
if (other_win != NULL)
{
- old_number = current_window()->number;
+ old_number = win->number;
other_win->number = old_number;
/* Resort the the window in the list */
@@ -1070,18 +1113,18 @@ cmd_number (int interactive, void *data)
}
else
{
- return_window_number (current_window()->number);
+ return_window_number (win->number);
}
- current_window()->number = new_number;
+ win->number = new_number;
add_window_number (new_number);
/* resort the the window in the list */
- remove_from_list (current_window());
- insert_into_list (current_window(), rp_mapped_window_sentinel);
+ remove_from_list (win);
+ insert_into_list (win, rp_mapped_window_sentinel);
/* Update the window list. */
- update_window_names (current_screen());
+ update_window_names (win->scr);
}
free (str);
diff --git a/src/events.c b/src/events.c
index ddc0993..a289d93 100644
--- a/src/events.c
+++ b/src/events.c
@@ -693,10 +693,6 @@ delegate_event (XEvent *ev)
configure_request (&ev->xconfigurerequest);
break;
- case CirculateRequest:
- PRINT_DEBUG ("--- Handling CirculateRequest ---\n");
- break;
-
case CreateNotify:
PRINT_DEBUG ("--- Handling CreateNotify ---\n");
new_window (&ev->xcreatewindow);
@@ -766,6 +762,7 @@ delegate_event (XEvent *ev)
case SelectionRequest:
case SelectionNotify:
case SelectionClear:
+ case CirculateRequest:
/* Ignore these events. */
break;