summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/actions.c2240
-rw-r--r--src/actions.h24
-rw-r--r--src/bar.c138
-rw-r--r--src/communications.c38
-rw-r--r--src/completions.c42
-rw-r--r--src/conf.h12
-rw-r--r--src/data.h28
-rw-r--r--src/editor.c68
-rw-r--r--src/events.c497
-rw-r--r--src/events.h4
-rw-r--r--src/format.c88
-rw-r--r--src/frame.c44
-rw-r--r--src/frame.h4
-rw-r--r--src/getopt.c896
-rw-r--r--src/getopt.h28
-rw-r--r--src/getopt1.c116
-rw-r--r--src/globals.c60
-rw-r--r--src/globals.h12
-rw-r--r--src/group.c158
-rw-r--r--src/history.c2
-rw-r--r--src/hook.c22
-rw-r--r--src/hook.h4
-rw-r--r--src/input.c202
-rw-r--r--src/linkedlist.c20
-rw-r--r--src/linkedlist.h163
-rw-r--r--src/main.c321
-rw-r--r--src/manage.c236
-rw-r--r--src/manage.h6
-rw-r--r--src/messages.h40
-rw-r--r--src/number.c16
-rw-r--r--src/number.h4
-rw-r--r--src/ratpoison.h22
-rw-r--r--src/sbuf.c12
-rw-r--r--src/sbuf.h6
-rw-r--r--src/screen.c108
-rw-r--r--src/screen.h4
-rw-r--r--src/split.c349
-rw-r--r--src/window.c232
-rw-r--r--src/window.h10
-rw-r--r--src/xinerama.c69
-rw-r--r--src/xinerama.h4
41 files changed, 3172 insertions, 3177 deletions
diff --git a/src/actions.c b/src/actions.c
index d9cc00e..6889ee6 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -78,7 +78,7 @@ add_set_var (char *name, cmdret * (*fn)(struct cmdarg **), int nargs, ...)
var->set_fn = fn;
var->nargs = nargs;
var->args = xmalloc(sizeof(struct argspec) * nargs);
-
+
/* Fill var->args */
va_start(va, nargs);
for (i=0; i<nargs; i++)
@@ -101,8 +101,8 @@ init_set_vars()
add_set_var ("maxsizegravity", set_maxsizegravity, 1, "", arg_GRAVITY);
add_set_var ("bargravity", set_bargravity, 1, "", arg_GRAVITY);
add_set_var ("font", set_font, 1, "", arg_STRING);
- add_set_var ("padding", set_padding, 4,
- "", arg_NUMBER, "", arg_NUMBER, "", arg_NUMBER, "", arg_NUMBER);
+ add_set_var ("padding", set_padding, 4,
+ "", arg_NUMBER, "", arg_NUMBER, "", arg_NUMBER, "", arg_NUMBER);
add_set_var ("border", set_border, 1, "", arg_NUMBER);
add_set_var ("barborder", set_barborder, 1, "", arg_NUMBER);
add_set_var ("inputwidth", set_inputwidth, 1, "", arg_NUMBER);
@@ -137,7 +137,7 @@ add_command (char *name, cmdret * (*fn)(int, struct cmdarg **), int nargs, int i
cmd->ni_required_args = ni_nrequired;
cmd->i_required_args = i_nrequired;
cmd->args = xmalloc(sizeof(struct argspec) * nargs);
-
+
/* Fill cmd->args */
va_start(va, ni_nrequired);
for (i=0; i<nargs; i++)
@@ -154,179 +154,179 @@ void
init_user_commands()
{
/*@begin (tag required for genrpbindings) */
- add_command ("abort", cmd_abort, 0, 0, 0);
- add_command ("addhook", cmd_addhook, 2, 2, 2,
- "Hook: ", arg_HOOK,
- "Command: ", arg_REST);
- add_command ("alias", cmd_alias, 2, 2, 2,
- "Alias: ", arg_STRING,
- "Command: ", arg_REST);
- add_command ("banish", cmd_banish, 0, 0, 0);
- add_command ("chdir", cmd_chdir, 1, 0, 0,
- "Dir: ", arg_REST);
- add_command ("clrunmanaged", cmd_clrunmanaged, 0, 0, 0);
- add_command ("colon", cmd_colon, 1, 0, 0,
- "", arg_REST);
- add_command ("curframe", cmd_curframe, 0, 0, 0);
- add_command ("definekey", cmd_definekey, 3, 3, 3,
- "Keymap: ", arg_KEYMAP,
- "Key: ", arg_KEY,
- "Command: ", arg_REST);
- add_command ("undefinekey", cmd_undefinekey, 2, 2, 2,
- "Keymap: ", arg_KEYMAP,
- "Key: ", arg_KEY);
- add_command ("delete", cmd_delete, 0, 0, 0);
- add_command ("delkmap", cmd_delkmap, 1, 1, 1,
- "Keymap: ", arg_KEYMAP);
- add_command ("echo", cmd_echo, 1, 1, 1,
- "Echo: ", arg_RAW);
- add_command ("escape", cmd_escape, 1, 1, 1,
- "Key: ", arg_KEY);
- add_command ("exec", cmd_exec, 1, 1, 1,
- "/bin/sh -c ", arg_SHELLCMD);
- add_command ("fdump", cmd_fdump, 1, 0, 0,
- "", arg_NUMBER);
- add_command ("focus", cmd_next_frame, 0, 0, 0);
- add_command ("focusprev", cmd_prev_frame, 0, 0, 0);
- add_command ("focusdown", cmd_focusdown, 0, 0, 0);
- add_command ("focuslast", cmd_focuslast, 0, 0, 0);
- add_command ("focusleft", cmd_focusleft, 0, 0, 0);
- add_command ("focusright", cmd_focusright, 0, 0, 0);
- add_command ("focusup", cmd_focusup, 0, 0, 0);
- add_command ("frestore", cmd_frestore, 1, 1, 1,
- "Frames: ", arg_REST);
- add_command ("fselect", cmd_fselect, 1, 1, 1,
- "", arg_FRAME);
- add_command ("gdelete", cmd_gdelete, 1, 0, 0,
- "Group:", arg_GROUP);
- add_command ("getenv", cmd_getenv, 1, 1, 1,
- "Variable: ", arg_STRING);
- add_command ("gmerge", cmd_gmerge, 1, 1, 1,
- "Group: ", arg_GROUP);
- add_command ("gmove", cmd_gmove, 1, 1, 1,
- "Group: ", arg_GROUP);
- add_command ("gnew", cmd_gnew, 1, 1, 1,
- "Name: ", arg_STRING);
- add_command ("gnewbg", cmd_gnewbg, 1, 1, 1,
- "Name: ", arg_STRING);
- add_command ("gnext", cmd_gnext, 0, 0, 0);
- add_command ("gprev", cmd_gprev, 0, 0, 0);
- add_command ("gravity", cmd_gravity, 1, 0, 0,
- "Gravity: ", arg_GRAVITY);
- add_command ("groups", cmd_groups, 0, 0, 0);
- add_command ("gselect", cmd_gselect, 1, 1, 1,
- "Group: ", arg_GROUP);
- add_command ("help", cmd_help, 1, 0, 0,
- "Keymap: ", arg_KEYMAP);
- add_command ("hsplit", cmd_h_split, 1, 0, 0,
- "Split: ", arg_STRING);
- add_command ("info", cmd_info, 1, 0, 0,
- "Format: ", arg_REST);
- add_command ("kill", cmd_kill, 0, 0, 0);
- add_command ("lastmsg", cmd_lastmsg, 0, 0, 0);
- add_command ("license", cmd_license, 0, 0, 0);
- add_command ("link", cmd_link, 2, 1, 1,
- "Key: ", arg_STRING,
- "Keymap: ", arg_KEYMAP);
- add_command ("listhook", cmd_listhook, 1, 1, 1,
- "Hook: ", arg_HOOK);
- add_command ("meta", cmd_meta, 1, 0, 0,
- "key: ", arg_KEY);
- add_command ("msgwait", cmd_msgwait, 1, 0, 0,
- "", arg_NUMBER);
- add_command ("newkmap", cmd_newkmap, 1, 1, 1,
- "Keymap: ", arg_STRING);
- add_command ("newwm", cmd_newwm, 1, 1, 1,
- "Switch to wm: ", arg_REST);
- add_command ("next", cmd_next, 0, 0, 0);
- add_command ("nextscreen", cmd_nextscreen, 0, 0, 0);
- add_command ("number", cmd_number, 2, 1, 1,
- "Number: ", arg_NUMBER,
- "Number: ", arg_NUMBER);
- add_command ("only", cmd_only, 0, 0, 0);
- add_command ("other", cmd_other, 0, 0, 0);
- add_command ("prev", cmd_prev, 0, 0, 0);
- add_command ("prevscreen", cmd_prevscreen, 0, 0, 0);
- add_command ("quit", cmd_quit, 0, 0, 0);
- add_command ("ratwarp", cmd_ratwarp, 2, 2, 2,
- "X: ", arg_NUMBER,
- "Y: ", arg_NUMBER);
- add_command ("ratrelwarp", cmd_ratrelwarp, 2, 2, 2,
- "X: ", arg_NUMBER,
- "Y: ", arg_NUMBER);
- add_command ("ratclick", cmd_ratclick, 1, 0, 0,
- "Button: ", arg_NUMBER);
- add_command ("rathold", cmd_rathold, 2, 1, 1,
- "State: ", arg_STRING,
- "Button: ", arg_NUMBER);
- add_command ("readkey", cmd_readkey, 1, 1, 1,
- "Keymap: ", arg_KEYMAP);
- add_command ("redisplay", cmd_redisplay, 0, 0, 0);
- add_command ("remhook", cmd_remhook, 2, 2, 2,
- "Hook: ", arg_HOOK,
- "Command: ", arg_REST);
- add_command ("remove", cmd_remove, 0, 0, 0);
- add_command ("resize", cmd_resize, 2, 0, 2,
- "", arg_NUMBER,
- "", arg_NUMBER);
- add_command ("restart", cmd_restart, 0, 0, 0);
- add_command ("rudeness", cmd_rudeness, 1, 0, 0,
- "Rudeness: ", arg_NUMBER);
- add_command ("select", cmd_select, 1, 0, 1,
- "Select window: ", arg_REST);
- add_command ("set", cmd_set, 2, 0, 0,
- "", arg_VARIABLE,
- "", arg_REST);
- add_command ("setenv", cmd_setenv, 2, 2, 2,
- "Variable: ", arg_STRING,
- "Value: ", arg_REST);
- add_command ("shrink", cmd_shrink, 0, 0, 0);
- add_command ("source", cmd_source, 1, 1, 1,
- "File: ", arg_REST);
- add_command ("sselect", cmd_sselect, 1, 1, 1,
- "Screen: ", arg_NUMBER);
- add_command ("startup_message", cmd_startup_message, 1, 1, 1,
- "Startup message: ", arg_STRING);
- add_command ("time", cmd_time, 0, 0, 0);
- add_command ("title", cmd_rename, 1, 1, 1,
- "Set window's title to: ", arg_REST);
- add_command ("tmpwm", cmd_tmpwm, 1, 1, 1,
- "Tmp wm: ", arg_REST);
- add_command ("unalias", cmd_unalias, 1, 1, 1,
- "Alias: ", arg_STRING);
- add_command ("unmanage", cmd_unmanage, 1, 1, 0,
- "Unmanage: ", arg_REST);
- add_command ("unsetenv", cmd_unsetenv, 1, 1, 1,
- "Variable: ", arg_STRING);
- add_command ("verbexec", cmd_verbexec, 1, 1, 1,
- "/bin/sh -c ", arg_SHELLCMD);
- add_command ("version", cmd_version, 0, 0, 0);
- add_command ("vsplit", cmd_v_split, 1, 0, 0,
- "Split: ", arg_STRING);
- add_command ("warp", cmd_warp, 1, 1, 1,
- "Warp State: ", arg_STRING);
- add_command ("windows", cmd_windows, 1, 0, 0,
- "", arg_REST);
- add_command ("cnext", cmd_cnext, 0, 0, 0);
- add_command ("cother", cmd_cother, 0, 0, 0);
- add_command ("cprev", cmd_cprev, 0, 0, 0);
- add_command ("dedicate", cmd_dedicate, 1, 0, 0,
- "", arg_NUMBER);
- add_command ("describekey", cmd_describekey, 1, 1, 1,
- "Keymap: ", arg_KEYMAP);
- add_command ("inext", cmd_inext, 0, 0, 0);
- add_command ("iother", cmd_iother, 0, 0, 0);
- add_command ("iprev", cmd_iprev, 0, 0, 0);
- add_command ("prompt", cmd_prompt, 1, 0, 0,
- "", arg_REST);
- add_command ("sdump", cmd_sdump, 0, 0, 0);
- add_command ("sfdump", cmd_sfdump, 0, 0, 0);
- add_command ("undo", cmd_undo, 0, 0, 0);
- add_command ("redo", cmd_redo, 0, 0, 0);
- add_command ("putsel", cmd_putsel, 1, 1, 1,
- "Text: ", arg_RAW);
- add_command ("getsel", cmd_getsel, 0, 0, 0);
- add_command ("compat", cmd_compat, 0, 0, 0);
+ add_command ("abort", cmd_abort, 0, 0, 0);
+ add_command ("addhook", cmd_addhook, 2, 2, 2,
+ "Hook: ", arg_HOOK,
+ "Command: ", arg_REST);
+ add_command ("alias", cmd_alias, 2, 2, 2,
+ "Alias: ", arg_STRING,
+ "Command: ", arg_REST);
+ add_command ("banish", cmd_banish, 0, 0, 0);
+ add_command ("chdir", cmd_chdir, 1, 0, 0,
+ "Dir: ", arg_REST);
+ add_command ("clrunmanaged", cmd_clrunmanaged, 0, 0, 0);
+ add_command ("colon", cmd_colon, 1, 0, 0,
+ "", arg_REST);
+ add_command ("curframe", cmd_curframe, 0, 0, 0);
+ add_command ("definekey", cmd_definekey, 3, 3, 3,
+ "Keymap: ", arg_KEYMAP,
+ "Key: ", arg_KEY,
+ "Command: ", arg_REST);
+ add_command ("undefinekey", cmd_undefinekey, 2, 2, 2,
+ "Keymap: ", arg_KEYMAP,
+ "Key: ", arg_KEY);
+ add_command ("delete", cmd_delete, 0, 0, 0);
+ add_command ("delkmap", cmd_delkmap, 1, 1, 1,
+ "Keymap: ", arg_KEYMAP);
+ add_command ("echo", cmd_echo, 1, 1, 1,
+ "Echo: ", arg_RAW);
+ add_command ("escape", cmd_escape, 1, 1, 1,
+ "Key: ", arg_KEY);
+ add_command ("exec", cmd_exec, 1, 1, 1,
+ "/bin/sh -c ", arg_SHELLCMD);
+ add_command ("fdump", cmd_fdump, 1, 0, 0,
+ "", arg_NUMBER);
+ add_command ("focus", cmd_next_frame, 0, 0, 0);
+ add_command ("focusprev", cmd_prev_frame, 0, 0, 0);
+ add_command ("focusdown", cmd_focusdown, 0, 0, 0);
+ add_command ("focuslast", cmd_focuslast, 0, 0, 0);
+ add_command ("focusleft", cmd_focusleft, 0, 0, 0);
+ add_command ("focusright", cmd_focusright, 0, 0, 0);
+ add_command ("focusup", cmd_focusup, 0, 0, 0);
+ add_command ("frestore", cmd_frestore, 1, 1, 1,
+ "Frames: ", arg_REST);
+ add_command ("fselect", cmd_fselect, 1, 1, 1,
+ "", arg_FRAME);
+ add_command ("gdelete", cmd_gdelete, 1, 0, 0,
+ "Group:", arg_GROUP);
+ add_command ("getenv", cmd_getenv, 1, 1, 1,
+ "Variable: ", arg_STRING);
+ add_command ("gmerge", cmd_gmerge, 1, 1, 1,
+ "Group: ", arg_GROUP);
+ add_command ("gmove", cmd_gmove, 1, 1, 1,
+ "Group: ", arg_GROUP);
+ add_command ("gnew", cmd_gnew, 1, 1, 1,
+ "Name: ", arg_STRING);
+ add_command ("gnewbg", cmd_gnewbg, 1, 1, 1,
+ "Name: ", arg_STRING);
+ add_command ("gnext", cmd_gnext, 0, 0, 0);
+ add_command ("gprev", cmd_gprev, 0, 0, 0);
+ add_command ("gravity", cmd_gravity, 1, 0, 0,
+ "Gravity: ", arg_GRAVITY);
+ add_command ("groups", cmd_groups, 0, 0, 0);
+ add_command ("gselect", cmd_gselect, 1, 1, 1,
+ "Group: ", arg_GROUP);
+ add_command ("help", cmd_help, 1, 0, 0,
+ "Keymap: ", arg_KEYMAP);
+ add_command ("hsplit", cmd_h_split, 1, 0, 0,
+ "Split: ", arg_STRING);
+ add_command ("info", cmd_info, 1, 0, 0,
+ "Format: ", arg_REST);
+ add_command ("kill", cmd_kill, 0, 0, 0);
+ add_command ("lastmsg", cmd_lastmsg, 0, 0, 0);
+ add_command ("license", cmd_license, 0, 0, 0);
+ add_command ("link", cmd_link, 2, 1, 1,
+ "Key: ", arg_STRING,
+ "Keymap: ", arg_KEYMAP);
+ add_command ("listhook", cmd_listhook, 1, 1, 1,
+ "Hook: ", arg_HOOK);
+ add_command ("meta", cmd_meta, 1, 0, 0,
+ "key: ", arg_KEY);
+ add_command ("msgwait", cmd_msgwait, 1, 0, 0,
+ "", arg_NUMBER);
+ add_command ("newkmap", cmd_newkmap, 1, 1, 1,
+ "Keymap: ", arg_STRING);
+ add_command ("newwm", cmd_newwm, 1, 1, 1,
+ "Switch to wm: ", arg_REST);
+ add_command ("next", cmd_next, 0, 0, 0);
+ add_command ("nextscreen", cmd_nextscreen, 0, 0, 0);
+ add_command ("number", cmd_number, 2, 1, 1,
+ "Number: ", arg_NUMBER,
+ "Number: ", arg_NUMBER);
+ add_command ("only", cmd_only, 0, 0, 0);
+ add_command ("other", cmd_other, 0, 0, 0);
+ add_command ("prev", cmd_prev, 0, 0, 0);
+ add_command ("prevscreen", cmd_prevscreen, 0, 0, 0);
+ add_command ("quit", cmd_quit, 0, 0, 0);
+ add_command ("ratwarp", cmd_ratwarp, 2, 2, 2,
+ "X: ", arg_NUMBER,
+ "Y: ", arg_NUMBER);
+ add_command ("ratrelwarp", cmd_ratrelwarp, 2, 2, 2,
+ "X: ", arg_NUMBER,
+ "Y: ", arg_NUMBER);
+ add_command ("ratclick", cmd_ratclick, 1, 0, 0,
+ "Button: ", arg_NUMBER);
+ add_command ("rathold", cmd_rathold, 2, 1, 1,
+ "State: ", arg_STRING,
+ "Button: ", arg_NUMBER);
+ add_command ("readkey", cmd_readkey, 1, 1, 1,
+ "Keymap: ", arg_KEYMAP);
+ add_command ("redisplay", cmd_redisplay, 0, 0, 0);
+ add_command ("remhook", cmd_remhook, 2, 2, 2,
+ "Hook: ", arg_HOOK,
+ "Command: ", arg_REST);
+ add_command ("remove", cmd_remove, 0, 0, 0);
+ add_command ("resize", cmd_resize, 2, 0, 2,
+ "", arg_NUMBER,
+ "", arg_NUMBER);
+ add_command ("restart", cmd_restart, 0, 0, 0);
+ add_command ("rudeness", cmd_rudeness, 1, 0, 0,
+ "Rudeness: ", arg_NUMBER);
+ add_command ("select", cmd_select, 1, 0, 1,
+ "Select window: ", arg_REST);
+ add_command ("set", cmd_set, 2, 0, 0,
+ "", arg_VARIABLE,
+ "", arg_REST);
+ add_command ("setenv", cmd_setenv, 2, 2, 2,
+ "Variable: ", arg_STRING,
+ "Value: ", arg_REST);
+ add_command ("shrink", cmd_shrink, 0, 0, 0);
+ add_command ("source", cmd_source, 1, 1, 1,
+ "File: ", arg_REST);
+ add_command ("sselect", cmd_sselect, 1, 1, 1,
+ "Screen: ", arg_NUMBER);
+ add_command ("startup_message", cmd_startup_message, 1, 1, 1,
+ "Startup message: ", arg_STRING);
+ add_command ("time", cmd_time, 0, 0, 0);
+ add_command ("title", cmd_rename, 1, 1, 1,
+ "Set window's title to: ", arg_REST);
+ add_command ("tmpwm", cmd_tmpwm, 1, 1, 1,
+ "Tmp wm: ", arg_REST);
+ add_command ("unalias", cmd_unalias, 1, 1, 1,
+ "Alias: ", arg_STRING);
+ add_command ("unmanage", cmd_unmanage, 1, 1, 0,
+ "Unmanage: ", arg_REST);
+ add_command ("unsetenv", cmd_unsetenv, 1, 1, 1,
+ "Variable: ", arg_STRING);
+ add_command ("verbexec", cmd_verbexec, 1, 1, 1,
+ "/bin/sh -c ", arg_SHELLCMD);
+ add_command ("version", cmd_version, 0, 0, 0);
+ add_command ("vsplit", cmd_v_split, 1, 0, 0,
+ "Split: ", arg_STRING);
+ add_command ("warp", cmd_warp, 1, 1, 1,
+ "Warp State: ", arg_STRING);
+ add_command ("windows", cmd_windows, 1, 0, 0,
+ "", arg_REST);
+ add_command ("cnext", cmd_cnext, 0, 0, 0);
+ add_command ("cother", cmd_cother, 0, 0, 0);
+ add_command ("cprev", cmd_cprev, 0, 0, 0);
+ add_command ("dedicate", cmd_dedicate, 1, 0, 0,
+ "", arg_NUMBER);
+ add_command ("describekey", cmd_describekey, 1, 1, 1,
+ "Keymap: ", arg_KEYMAP);
+ add_command ("inext", cmd_inext, 0, 0, 0);
+ add_command ("iother", cmd_iother, 0, 0, 0);
+ add_command ("iprev", cmd_iprev, 0, 0, 0);
+ add_command ("prompt", cmd_prompt, 1, 0, 0,
+ "", arg_REST);
+ add_command ("sdump", cmd_sdump, 0, 0, 0);
+ add_command ("sfdump", cmd_sfdump, 0, 0, 0);
+ add_command ("undo", cmd_undo, 0, 0, 0);
+ add_command ("redo", cmd_redo, 0, 0, 0);
+ add_command ("putsel", cmd_putsel, 1, 1, 1,
+ "Text: ", arg_RAW);
+ add_command ("getsel", cmd_getsel, 0, 0, 0);
+ add_command ("compat", cmd_compat, 0, 0, 0);
/*@end (tag required for genrpbindings) */
/* Commands to help debug ratpoison. */
@@ -351,7 +351,7 @@ typedef struct
char *name;
char *alias;
} alias_t;
-
+
static alias_t *alias_list;
static int alias_list_size;
static int alias_list_last;
@@ -380,10 +380,10 @@ del_frame_undo (rp_frame_undo *u)
if (u->frames) free (u->frames);
list_del (&(u->node));
free (u);
- rp_num_frame_undos--; /* decrement counter */
+ rp_num_frame_undos--; /* decrement counter */
}
-static void
+static void
push_frame_undo(rp_screen *screen)
{
rp_frame_undo *cur;
@@ -397,7 +397,7 @@ push_frame_undo(rp_screen *screen)
cur->frames = fdump (screen);
cur->screen = screen;
list_add (&cur->node, &rp_frame_undos);
- rp_num_frame_undos++; /* increment counter */
+ rp_num_frame_undos++; /* increment counter */
/* Since we're creating new frames the redo list is now invalid, so
clear it. */
clear_frame_redos();
@@ -446,9 +446,9 @@ find_keybinding_by_action (char *action, rp_keymap *map)
for (i=0; i<map->actions_last; i++)
{
if (!strcmp (map->actions[i].data, action))
- {
- return &map->actions[i];
- }
+ {
+ return &map->actions[i];
+ }
}
return NULL;
@@ -460,9 +460,9 @@ find_keybinding (KeySym keysym, int state, rp_keymap *map)
int i;
for (i = 0; i < map->actions_last; i++)
{
- if (map->actions[i].key == keysym
- && map->actions[i].state == state)
- return &map->actions[i];
+ if (map->actions[i].key == keysym
+ && map->actions[i].state == state)
+ return &map->actions[i];
}
return NULL;
}
@@ -521,7 +521,7 @@ add_keybinding (KeySym keysym, int state, char *cmd, rp_keymap *map)
map->actions[map->actions_last].key = keysym;
map->actions[map->actions_last].state = state;
/* free this on shutdown, or re/unbinding */
- map->actions[map->actions_last].data = xstrdup (cmd);
+ map->actions[map->actions_last].data = xstrdup (cmd);
map->actions_last++;
}
@@ -544,20 +544,20 @@ remove_keybinding (KeySym keysym, int state, rp_keymap *map)
for (i=0; i<map->actions_last; i++)
{
if (map->actions[i].key == keysym && map->actions[i].state == state)
- {
- found = i;
- break;
- }
+ {
+ found = i;
+ break;
+ }
}
if (found >= 0)
{
free (map->actions[found].data);
- memmove (&map->actions[found], &map->actions[found+1],
- sizeof (rp_action) * (map->actions_last - found - 1));
+ memmove (&map->actions[found], &map->actions[found+1],
+ sizeof (rp_action) * (map->actions_last - found - 1));
map->actions_last--;
-
+
return 1;
}
@@ -570,7 +570,7 @@ keymap_new (char *name)
rp_keymap *map;
/* All keymaps must have a name. */
- if (name == NULL)
+ if (name == NULL)
return NULL;
map = xmalloc (sizeof (rp_keymap));
@@ -590,9 +590,9 @@ find_keymap (char *name)
list_for_each_entry (cur, &rp_keymaps, node)
{
if (!strcmp (name, cur->name))
- {
- return cur;
- }
+ {
+ return cur;
+ }
}
return NULL;
@@ -627,10 +627,10 @@ add_alias (char *name, char *alias)
else
{
if (alias_list_last >= alias_list_size)
- {
- alias_list_size *= 2;
- alias_list = xrealloc (alias_list, sizeof (alias_t) * alias_list_size);
- }
+ {
+ alias_list_size *= 2;
+ alias_list = xrealloc (alias_list, sizeof (alias_t) * alias_list_size);
+ }
alias_list[alias_list_last].name = xstrdup (name);
alias_list[alias_list_last].alias = xstrdup (alias);
@@ -679,7 +679,7 @@ initialize_default_keybindings (void)
add_keybinding (XK_K, 0, "kill", map);
add_keybinding (XK_K, RP_CONTROL_MASK, "kill", map);
add_keybinding (XK_Return, 0, "next", map);
- add_keybinding (XK_Return, RP_CONTROL_MASK, "next", map);
+ add_keybinding (XK_Return, RP_CONTROL_MASK, "next", map);
add_keybinding (XK_a, 0, "time", map);
add_keybinding (XK_a, RP_CONTROL_MASK, "time", map);
add_keybinding (XK_b, 0, "banish", map);
@@ -817,9 +817,9 @@ free_aliases ()
/* return a KeySym from a string that contains either a hex value or
an X keysym description */
-static int string_to_keysym (char *str)
-{
- int retval;
+static int string_to_keysym (char *str)
+{
+ int retval;
int keysym;
retval = sscanf (str, "0x%x", &keysym);
@@ -836,7 +836,7 @@ parse_keydesc (char *s, struct rp_key *key)
{
char *token, *next_token, *keydesc;
- if (s == NULL)
+ if (s == NULL)
return NULL;
/* Avoid mangling s. */
@@ -852,11 +852,11 @@ parse_keydesc (char *s, struct rp_key *key)
/* A keycode of 0 means the keysym doesn't have a keycode. */
if (key->sym == NoSymbol || XKeysymToKeycode (dpy, key->sym) == 0)
- {
- cmdret *ret = cmdret_new (RET_FAILURE, "parse_keydesc: Unknown key '%s'", keydesc);
- free (keydesc);
- return ret;
- }
+ {
+ cmdret *ret = cmdret_new (RET_FAILURE, "parse_keydesc: Unknown key '%s'", keydesc);
+ free (keydesc);
+ return ret;
+ }
}
else if (keydesc[strlen (keydesc) - 1] == '-')
{
@@ -870,68 +870,68 @@ parse_keydesc (char *s, struct rp_key *key)
token = strtok (keydesc, "-");
if (token == NULL)
- {
- /* It was nothing but hyphens */
- free (keydesc);
- return cmdret_new (RET_FAILURE, "parse_keydesc: Can't parse key '%s'", s);
- }
+ {
+ /* It was nothing but hyphens */
+ free (keydesc);
+ return cmdret_new (RET_FAILURE, "parse_keydesc: Can't parse key '%s'", s);
+ }
do
- {
- next_token = strtok (NULL, "-");
-
- if (next_token == NULL)
- {
- /* There is nothing more to parse and token contains the
- keysym name. */
- key->sym = string_to_keysym (token);
-
- /* A keycode of 0 means the keysym doesn't have a keycode. */
- if (key->sym == NoSymbol || XKeysymToKeycode (dpy, key->sym) == 0)
- {
- cmdret *ret = cmdret_new (RET_FAILURE, "parse_keydesc: Unknown key '%s'", token);
- free (keydesc);
- return ret;
- }
- }
- else
- {
- /* Which modifier is it? Only accept modifiers that are
- present. ie don't accept a hyper modifier if the keymap
- has no hyper key. */
- if (!strcmp (token, "C"))
- {
- key->state |= RP_CONTROL_MASK;
- }
- else if (!strcmp (token, "M"))
- {
- key->state |= RP_META_MASK;
- }
- else if (!strcmp (token, "A"))
- {
- key->state |= RP_ALT_MASK;
- }
- else if (!strcmp (token, "S"))
- {
- key->state |= RP_SHIFT_MASK;
- }
- else if (!strcmp (token, "s"))
- {
- key->state |= RP_SUPER_MASK;
- }
- else if (!strcmp (token, "H"))
- {
- key->state |= RP_HYPER_MASK;
- }
- else
- {
- free (keydesc);
- return cmdret_new (RET_FAILURE, "parse_keydesc: Unknown modifier '%s'", token);
- }
- }
-
- token = next_token;
- } while (next_token != NULL);
+ {
+ next_token = strtok (NULL, "-");
+
+ if (next_token == NULL)
+ {
+ /* There is nothing more to parse and token contains the
+ keysym name. */
+ key->sym = string_to_keysym (token);
+
+ /* A keycode of 0 means the keysym doesn't have a keycode. */
+ if (key->sym == NoSymbol || XKeysymToKeycode (dpy, key->sym) == 0)
+ {
+ cmdret *ret = cmdret_new (RET_FAILURE, "parse_keydesc: Unknown key '%s'", token);
+ free (keydesc);
+ return ret;
+ }
+ }
+ else
+ {
+ /* Which modifier is it? Only accept modifiers that are
+ present. ie don't accept a hyper modifier if the keymap
+ has no hyper key. */
+ if (!strcmp (token, "C"))
+ {
+ key->state |= RP_CONTROL_MASK;
+ }
+ else if (!strcmp (token, "M"))
+ {
+ key->state |= RP_META_MASK;
+ }
+ else if (!strcmp (token, "A"))
+ {
+ key->state |= RP_ALT_MASK;
+ }
+ else if (!strcmp (token, "S"))
+ {
+ key->state |= RP_SHIFT_MASK;
+ }
+ else if (!strcmp (token, "s"))
+ {
+ key->state |= RP_SUPER_MASK;
+ }
+ else if (!strcmp (token, "H"))
+ {
+ key->state |= RP_HYPER_MASK;
+ }
+ else
+ {
+ free (keydesc);
+ return cmdret_new (RET_FAILURE, "parse_keydesc: Unknown modifier '%s'", token);
+ }
+ }
+
+ token = next_token;
+ } while (next_token != NULL);
}
/* Successfully parsed the key. */
@@ -1057,7 +1057,7 @@ cmd_meta (int interactive, struct cmdarg **args)
XEvent ev1, ev;
ev = rp_current_event;
- if (current_window() == NULL)
+ if (current_window() == NULL)
return cmdret_new (RET_FAILURE, NULL);
ev1.xkey.type = KeyPress;
@@ -1067,11 +1067,11 @@ cmd_meta (int interactive, struct cmdarg **args)
if (args[0])
{
if((ret = parse_keydesc (ARG_STRING(0), &key)))
- return ret;
+ return ret;
ev1.xkey.state = rp_mask_to_x11_mask (key.state);
if(!(ev1.xkey.keycode = XKeysymToKeycode (dpy, key.sym)))
- return cmdret_new (RET_FAILURE, "meta: Couldn't convert keysym to keycode");
+ return cmdret_new (RET_FAILURE, "meta: Couldn't convert keysym to keycode");
}
else
{
@@ -1261,30 +1261,30 @@ cmd_select (int interactive, struct cmdarg **args)
if (strlen (str) > 0)
{
if (strlen (str) == 1 && str[0] == '-')
- {
- blank_frame (current_frame());
- }
+ {
+ blank_frame (current_frame());
+ }
/* try by number */
else if ((n = string_to_window_number (str)) >= 0)
- {
- rp_window_elem *elem = group_find_window_by_number (rp_current_group, n);
-
- if (elem)
- goto_window (elem->win);
- else
- /* show the window list as feedback */
- show_bar (current_screen (), defaults.window_fmt);
- }
+ {
+ rp_window_elem *elem = group_find_window_by_number (rp_current_group, n);
+
+ if (elem)
+ goto_window (elem->win);
+ else
+ /* show the window list as feedback */
+ show_bar (current_screen (), defaults.window_fmt);
+ }
else
- /* try by name */
- {
- rp_window *win = find_window_name (str);
+ /* try by name */
+ {
+ rp_window *win = find_window_name (str);
- if (win)
- goto_window (win);
- else
- ret = cmdret_new (RET_FAILURE, "select: unknown window '%s'", str);
- }
+ if (win)
+ goto_window (win);
+ else
+ ret = cmdret_new (RET_FAILURE, "select: unknown window '%s'", str);
+ }
}
free (str);
@@ -1298,13 +1298,13 @@ cmd_select (int interactive, struct cmdarg **args)
cmdret *
cmd_rename (int interactive, struct cmdarg **args)
{
- if (current_window() == NULL)
+ if (current_window() == NULL)
return cmdret_new (RET_FAILURE, NULL);
free (current_window()->user_name);
current_window()->user_name = xstrdup (ARG_STRING(0));
current_window()->named = 1;
-
+
/* Update the program bar. */
update_window_names (current_screen(), defaults.window_fmt);
@@ -1374,7 +1374,7 @@ frame_selector_match (char ch)
for (i=0; i<strlen (defaults.frame_selectors); i++)
{
if (ch == defaults.frame_selectors[i])
- return i;
+ return i;
}
/* Maybe it's a number less than 9 and the frame selector doesn't
@@ -1399,7 +1399,7 @@ read_string (struct argspec *spec, struct sbuf *s, completion_fn fn, struct cmd
input = get_input (spec->prompt, fn);
if (input)
- {
+ {
*arg = xmalloc (sizeof(struct cmdarg));
(*arg)->type = spec->type;
(*arg)->string = input;
@@ -1424,7 +1424,7 @@ read_keymap (struct argspec *spec, struct sbuf *s, struct cmdarg **arg)
rp_keymap *map;
map = find_keymap (input);
if (map == NULL)
- return cmdret_new (RET_FAILURE, "unknown keymap '%s'", input);
+ return cmdret_new (RET_FAILURE, "unknown keymap '%s'", input);
*arg = xmalloc (sizeof(struct cmdarg));
(*arg)->type = spec->type;
(*arg)->arg.keymap = map;
@@ -1451,8 +1451,8 @@ read_keydesc (struct argspec *spec, struct sbuf *s, struct cmdarg **arg)
struct rp_key *key = xmalloc (sizeof(struct rp_key));
ret = parse_keydesc (input, key);
if (ret) {
- free (key);
- return ret;
+ free (key);
+ return ret;
}
*arg = xmalloc (sizeof(struct cmdarg));
(*arg)->type = spec->type;
@@ -1482,15 +1482,15 @@ group_completions (char *str)
s = sbuf_new (0);
/* A group may not have a name, so if it doesn't, use it's
- number. */
+ number. */
if (cur->name)
- {
- sbuf_copy (s, cur->name);
- }
+ {
+ sbuf_copy (s, cur->name);
+ }
else
- {
- sbuf_printf (s, "%d", cur->number);
- }
+ {
+ sbuf_printf (s, "%d", cur->number);
+ }
list_add_tail (&s->node, list);
}
@@ -1516,7 +1516,7 @@ colon_completions (char* str)
s = sbuf_new (0);
sbuf_copy (s, alias_list[i].name);
/* The space is so when the user completes a space is
- conveniently inserted after the command. */
+ conveniently inserted after the command. */
sbuf_concat (s, " ");
list_add_tail (&s->node, list);
}
@@ -1527,7 +1527,7 @@ colon_completions (char* str)
s = sbuf_new (0);
sbuf_copy (s, uc->name);
/* The space is so when the user completes a space is
- conveniently inserted after the command. */
+ conveniently inserted after the command. */
sbuf_concat (s, " ");
list_add_tail (&s->node, list);
}
@@ -1554,7 +1554,7 @@ exec_completions (char *str)
/* Initialize our list. */
head = xmalloc (sizeof (struct list_head));
INIT_LIST_HEAD (head);
-
+
/* FIXME: A Bash dependancy?? */
completion_string = xsprintf("bash -c \"compgen -ac %s|sort\"", str);
file = popen (completion_string, "r");
@@ -1576,23 +1576,23 @@ exec_completions (char *str)
sbuf_concat (line, partial);
if (feof(file) || (*(sbuf_get (line) + strlen(sbuf_get (line)) - 1) == '\n'))
- {
- char *s;
- struct sbuf *elem;
+ {
+ char *s;
+ struct sbuf *elem;
+
+ s = sbuf_get (line);
- s = sbuf_get (line);
+ /* Frob the newline into */
+ if (*(s + strlen(s) - 1) == '\n')
+ *(s + strlen(s) - 1) = '\0';
- /* Frob the newline into */
- if (*(s + strlen(s) - 1) == '\n')
- *(s + strlen(s) - 1) = '\0';
-
- /* Add our line to the list. */
- elem = sbuf_new (0);
- sbuf_copy (elem, s);
- list_add_tail (&elem->node, head);
+ /* Add our line to the list. */
+ elem = sbuf_new (0);
+ sbuf_copy (elem, s);
+ list_add_tail (&elem->node, head);
- sbuf_clear (line);
- }
+ sbuf_clear (line);
+ }
}
free (partial);
@@ -1626,53 +1626,53 @@ read_frame (struct argspec *spec, struct sbuf *s, struct cmdarg **arg)
{
frames = 0;
for (j=0; j<num_screens; j++)
- frames += num_frames(&screens[j]);
+ frames += num_frames(&screens[j]);
wins = xmalloc (sizeof (Window) * frames);
/* Loop through each frame and display its number in it's top
- left corner. */
+ left corner. */
i = 0;
for (j=0; j<num_screens; j++)
- {
- XSetWindowAttributes attr;
- rp_screen *s = &screens[j];
-
- /* Set up the window attributes to be used in the loop. */
- attr.border_pixel = s->fg_color;
- attr.background_pixel = s->bg_color;
- attr.override_redirect = True;
-
- list_for_each_entry (cur, &s->frames, node)
- {
- int width, height;
- char *num;
-
- /* Create the string to be displayed in the window and
- determine the height and width of the window. */
- /* num = xsprintf (" %d ", cur->number); */
- num = frame_selector (cur->number);
- width = defaults.bar_x_padding * 2 + XTextWidth (defaults.font, num, strlen (num));
- height = (FONT_HEIGHT (defaults.font) + defaults.bar_y_padding * 2);
-
- /* Create and map the window. */
- wins[i] = XCreateWindow (dpy, s->root, s->left + cur->x, s->top + cur->y, width, height, 1,
- CopyFromParent, CopyFromParent, CopyFromParent,
- CWOverrideRedirect | CWBorderPixel | CWBackPixel,
- &attr);
- XMapWindow (dpy, wins[i]);
- XClearWindow (dpy, wins[i]);
-
- /* Display the frame's number inside the window. */
- XDrawString (dpy, wins[i], s->normal_gc,
- defaults.bar_x_padding,
- defaults.bar_y_padding + defaults.font->max_bounds.ascent,
- num, strlen (num));
-
- free (num);
- i++;
- }
- }
+ {
+ XSetWindowAttributes attr;
+ rp_screen *s = &screens[j];
+
+ /* Set up the window attributes to be used in the loop. */
+ attr.border_pixel = s->fg_color;
+ attr.background_pixel = s->bg_color;
+ attr.override_redirect = True;
+
+ list_for_each_entry (cur, &s->frames, node)
+ {
+ int width, height;
+ char *num;
+
+ /* Create the string to be displayed in the window and
+ determine the height and width of the window. */
+ /* num = xsprintf (" %d ", cur->number); */
+ num = frame_selector (cur->number);
+ width = defaults.bar_x_padding * 2 + XTextWidth (defaults.font, num, strlen (num));
+ height = (FONT_HEIGHT (defaults.font) + defaults.bar_y_padding * 2);
+
+ /* Create and map the window. */
+ wins[i] = XCreateWindow (dpy, s->root, s->left + cur->x, s->top + cur->y, width, height, 1,
+ CopyFromParent, CopyFromParent, CopyFromParent,
+ CWOverrideRedirect | CWBorderPixel | CWBackPixel,
+ &attr);
+ XMapWindow (dpy, wins[i]);
+ XClearWindow (dpy, wins[i]);
+
+ /* Display the frame's number inside the window. */
+ XDrawString (dpy, wins[i], s->normal_gc,
+ defaults.bar_x_padding,
+ defaults.bar_y_padding + defaults.font->max_bounds.ascent,
+ num, strlen (num));
+
+ free (num);
+ i++;
+ }
+ }
XSync (dpy, False);
/* Read a key. */
@@ -1682,21 +1682,21 @@ read_frame (struct argspec *spec, struct sbuf *s, struct cmdarg **arg)
/* Destroy our number windows and free the array. */
for (i=0; i<frames; i++)
- XDestroyWindow (dpy, wins[i]);
+ XDestroyWindow (dpy, wins[i]);
free (wins);
/* FIXME: We only handle one character long keysym names. */
if (strlen (keysym_buf) == 1)
- {
- fnum = frame_selector_match (keysym_buf[0]);
- if (fnum == -1)
- goto frame_fail;
- }
+ {
+ fnum = frame_selector_match (keysym_buf[0]);
+ if (fnum == -1)
+ goto frame_fail;
+ }
else
- {
- goto frame_fail;
- }
+ {
+ goto frame_fail;
+ }
}
else
{
@@ -1708,8 +1708,8 @@ read_frame (struct argspec *spec, struct sbuf *s, struct cmdarg **arg)
if (frame)
{
/* We have to return a string, because commands get lists of
- strings. Sucky, yes. The command is simply going to parse it
- back into an rp_frame. */
+ strings. Sucky, yes. The command is simply going to parse it
+ back into an rp_frame. */
*arg = xmalloc (sizeof(struct cmdarg));
(*arg)->type = arg_FRAME;
(*arg)->string = NULL;
@@ -1739,33 +1739,33 @@ read_window (struct argspec *spec, struct sbuf *s, struct cmdarg **arg)
{
/* try by number */
if ((n = string_to_window_number (name)) >= 0)
- {
- rp_window_elem *elem = group_find_window_by_number (rp_current_group, n);
- if (elem)
- win = elem->win;
- }
+ {
+ rp_window_elem *elem = group_find_window_by_number (rp_current_group, n);
+ if (elem)
+ win = elem->win;
+ }
else
- /* try by name */
- {
- win = find_window_name (name);
- }
-
+ /* try by name */
+ {
+ win = find_window_name (name);
+ }
+
if (win)
- {
- *arg = xmalloc (sizeof(struct cmdarg));
- (*arg)->type = arg_WINDOW;
- (*arg)->arg.win = win;
- (*arg)->string = name;
- return NULL;
- }
+ {
+ *arg = xmalloc (sizeof(struct cmdarg));
+ (*arg)->type = arg_WINDOW;
+ (*arg)->arg.win = win;
+ (*arg)->string = name;
+ return NULL;
+ }
else
- {
- free (name);
- *arg = NULL;
- return cmdret_new (RET_SUCCESS, NULL);
- }
+ {
+ free (name);
+ *arg = NULL;
+ return cmdret_new (RET_SUCCESS, NULL);
+ }
}
-
+
/* user abort. */
*arg = NULL;
return cmdret_new (RET_SUCCESS, NULL);
@@ -1812,18 +1812,18 @@ read_gravity (struct argspec *spec, struct sbuf *s, struct cmdarg **arg)
{
int g = parse_wingravity (input);
if (g == -1)
- {
- cmdret *ret = cmdret_new (RET_FAILURE, "bad gravity '%s'", input);
- free (input);
- return ret;
- }
+ {
+ cmdret *ret = cmdret_new (RET_FAILURE, "bad gravity '%s'", input);
+ free (input);
+ return ret;
+ }
*arg = xmalloc (sizeof(struct cmdarg));
(*arg)->type = arg_GRAVITY;
(*arg)->arg.gravity = g;
(*arg)->string = input;
return NULL;
}
-
+
*arg = NULL;
return cmdret_new (RET_SUCCESS, NULL);
}
@@ -1842,7 +1842,7 @@ find_group (char *str)
{
group = groups_find_group_by_number (n);
if (group)
- return group;
+ return group;
}
group = groups_find_group_by_name (str);
@@ -1862,23 +1862,23 @@ read_group (struct argspec *spec, struct sbuf *s, struct cmdarg **arg)
if (input)
{
rp_group *g = find_group (input);
-
+
if (g)
- {
- *arg = xmalloc (sizeof(struct cmdarg));
- (*arg)->type = arg_GROUP;
- (*arg)->arg.group = g;
- (*arg)->string = input;
- return NULL;
- }
+ {
+ *arg = xmalloc (sizeof(struct cmdarg));
+ (*arg)->type = arg_GROUP;
+ (*arg)->arg.group = g;
+ (*arg)->string = input;
+ return NULL;
+ }
else
- {
- cmdret *ret = cmdret_new (RET_FAILURE, "unknown group '%s'", input);
- free (input);
- return ret;
- }
+ {
+ cmdret *ret = cmdret_new (RET_FAILURE, "unknown group '%s'", input);
+ free (input);
+ return ret;
+ }
}
-
+
*arg = NULL;
return cmdret_new (RET_SUCCESS, NULL);
}
@@ -1892,7 +1892,7 @@ hook_completions (char* str)
/* Initialize our list. */
list = xmalloc (sizeof (struct list_head));
INIT_LIST_HEAD (list);
-
+
for (entry = rp_hook_db; entry->name; entry++)
{
struct sbuf *hookname;
@@ -1901,7 +1901,7 @@ hook_completions (char* str)
sbuf_copy (hookname, entry->name);
list_add_tail (&hookname->node, list);
}
-
+
return list;
}
@@ -1918,23 +1918,23 @@ read_hook (struct argspec *spec, struct sbuf *s, struct cmdarg **arg)
if (input)
{
struct list_head *hook = hook_lookup (input);
-
+
if (hook)
- {
- *arg = xmalloc (sizeof(struct cmdarg));
- (*arg)->type = arg_HOOK;
- (*arg)->arg.hook = hook;
- (*arg)->string = input;
- return NULL;
- }
+ {
+ *arg = xmalloc (sizeof(struct cmdarg));
+ (*arg)->type = arg_HOOK;
+ (*arg)->arg.hook = hook;
+ (*arg)->string = input;
+ return NULL;
+ }
else
- {
- cmdret *ret = cmdret_new (RET_FAILURE, "unknown hook '%s'", input);
- free (input);
- return ret;
- }
+ {
+ cmdret *ret = cmdret_new (RET_FAILURE, "unknown hook '%s'", input);
+ free (input);
+ return ret;
+ }
}
-
+
*arg = NULL;
return cmdret_new (RET_SUCCESS, NULL);
}
@@ -1946,7 +1946,7 @@ find_variable (char *str)
list_for_each_entry (cur, &set_vars, node)
{
if (!strcmp (str, cur->var))
- return cur;
+ return cur;
}
return NULL;
}
@@ -1987,11 +1987,11 @@ read_variable (struct argspec *spec, struct sbuf *s, struct cmdarg **arg)
{
struct set_var *var = find_variable (input);
if (var == NULL)
- {
- cmdret *ret = cmdret_new (RET_FAILURE, "unknown variable '%s'", input);
- free (input);
- return ret;
- }
+ {
+ cmdret *ret = cmdret_new (RET_FAILURE, "unknown variable '%s'", input);
+ free (input);
+ return ret;
+ }
*arg = xmalloc (sizeof(struct cmdarg));
(*arg)->type = arg_VARIABLE;
@@ -1999,7 +1999,7 @@ read_variable (struct argspec *spec, struct sbuf *s, struct cmdarg **arg)
(*arg)->string = input;
return NULL;
}
-
+
*arg = NULL;
return cmdret_new (RET_SUCCESS, NULL);
}
@@ -2022,7 +2022,7 @@ read_number (struct argspec *spec, struct sbuf *s, struct cmdarg **arg)
(*arg)->string = input;
return NULL;
}
-
+
*arg = NULL;
return cmdret_new (RET_SUCCESS, NULL);
}
@@ -2080,7 +2080,7 @@ read_arg (struct argspec *spec, struct sbuf *s, struct cmdarg **arg)
/* Return -1 on failure. Return the number of args on success. */
static cmdret *
parsed_input_to_args (int num_args, struct argspec *argspec, struct list_head *list,
- struct list_head *args, int *parsed_args)
+ struct list_head *args, int *parsed_args)
{
struct sbuf *s;
struct cmdarg *arg;
@@ -2097,7 +2097,7 @@ parsed_input_to_args (int num_args, struct argspec *argspec, struct list_head *l
ret = read_arg (&argspec[*parsed_args], s, &arg);
/* If there was an error, then abort. */
if (ret)
- return ret;
+ return ret;
list_add_tail (&arg->node, args);
(*parsed_args)++;
@@ -2124,7 +2124,7 @@ fill_in_missing_args (struct user_command *cmd, struct list_head *list, struct l
{
ret = read_arg (&cmd->args[i], NULL, &arg);
if (ret)
- return ret;
+ return ret;
list_add_tail (&arg->node, args);
}
@@ -2157,80 +2157,80 @@ parse_args (char *str, struct list_head *list, int nargs, int raw)
{
/* Have we hit the arg limit? */
if (raw && parsed_args >= nargs)
- {
- struct sbuf *s = sbuf_new(0);
- if (!raw)
- while (*i && *i == ' ') i++;
- if (*i)
- {
- sbuf_concat(s, i);
- list_add_tail (&s->node, list);
- }
- len = 0;
- break;
- }
+ {
+ struct sbuf *s = sbuf_new(0);
+ if (!raw)
+ while (*i && *i == ' ') i++;
+ if (*i)
+ {
+ sbuf_concat(s, i);
+ list_add_tail (&s->node, list);
+ }
+ len = 0;
+ break;
+ }
/* Escaped characters always get added. */
if (str_escape)
- {
- tmp[len] = *i;
- len++;
- str_escape = 0;
- }
+ {
+ tmp[len] = *i;
+ len++;
+ str_escape = 0;
+ }
else if (*i == '\\')
- {
- str_escape = 1;
- }
+ {
+ str_escape = 1;
+ }
else if (*i == '"')
- {
- if (in_str)
- {
- /* End the arg. */
- struct sbuf *s = sbuf_new(0);
- sbuf_nconcat(s, tmp, len);
- list_add_tail (&s->node, list);
- len = 0;
- gobble = 1;
- in_str = 0;
- parsed_args++;
- }
- else if (len == 0)
- {
- /* A string open can only start at the beginning of an
- argument. */
- in_str = 1;
- }
- else
- {
- ret = cmdret_new (RET_FAILURE, "parse error in '%s'", str);
- break;
- }
- }
+ {
+ if (in_str)
+ {
+ /* End the arg. */
+ struct sbuf *s = sbuf_new(0);
+ sbuf_nconcat(s, tmp, len);
+ list_add_tail (&s->node, list);
+ len = 0;
+ gobble = 1;
+ in_str = 0;
+ parsed_args++;
+ }
+ else if (len == 0)
+ {
+ /* A string open can only start at the beginning of an
+ argument. */
+ in_str = 1;
+ }
+ else
+ {
+ ret = cmdret_new (RET_FAILURE, "parse error in '%s'", str);
+ break;
+ }
+ }
else if (*i == ' ' && !in_str)
- {
- /* End the current arg, and start a new one. */
- struct sbuf *s = sbuf_new(0);
- sbuf_nconcat(s, tmp, len);
- list_add_tail (&s->node, list);
- len = 0;
- gobble = 1;
- parsed_args++;
- }
+ {
+ /* End the current arg, and start a new one. */
+ struct sbuf *s = sbuf_new(0);
+ sbuf_nconcat(s, tmp, len);
+ list_add_tail (&s->node, list);
+ len = 0;
+ gobble = 1;
+ parsed_args++;
+ }
else
- {
- /* Add the character to the argument. */
- tmp[len] = *i;
- len++;
- }
+ {
+ /* Add the character to the argument. */
+ tmp[len] = *i;
+ len++;
+ }
/* Should we eat the whitespace? */
if (gobble)
- {
- while (*i && *i == ' ') i++;
- /* Did we go too far? */
- if (*i && *i != ' ') i--;
- gobble = 0;
- }
+ {
+ while (*i && *i == ' ') i++;
+ /* Did we go too far? */
+ if (*i && *i != ' ') i--;
+ gobble = 0;
+ }
}
/* Add the remaining text in tmp. */
if (ret == NULL && len)
@@ -2271,31 +2271,31 @@ arg_free (struct cmdarg *arg)
{
/* read_frame doesn't fill in string. */
if (arg->string)
- free (arg->string);
+ free (arg->string);
switch (arg->type)
- {
- case arg_KEY:
- free (arg->arg.key);
- break;
- case arg_REST:
- case arg_STRING:
- case arg_NUMBER:
- case arg_WINDOW:
- case arg_FRAME:
- case arg_COMMAND:
- case arg_SHELLCMD:
- case arg_KEYMAP:
- case arg_GRAVITY:
- case arg_GROUP:
- case arg_HOOK:
- case arg_VARIABLE:
- case arg_RAW:
- /* Do nothing */
- break;
- default:
- PRINT_ERROR (("Missed an arg type.\n"));
- break;
- }
+ {
+ case arg_KEY:
+ free (arg->arg.key);
+ break;
+ case arg_REST:
+ case arg_STRING:
+ case arg_NUMBER:
+ case arg_WINDOW:
+ case arg_FRAME:
+ case arg_COMMAND:
+ case arg_SHELLCMD:
+ case arg_KEYMAP:
+ case arg_GRAVITY:
+ case arg_GROUP:
+ case arg_HOOK:
+ case arg_VARIABLE:
+ case arg_RAW:
+ /* Do nothing */
+ break;
+ default:
+ PRINT_ERROR (("Missed an arg type.\n"));
+ break;
+ }
free (arg);
}
}
@@ -2310,7 +2310,7 @@ command (int interactive, char *data)
char *input;
user_command *uc;
int i;
-
+
if (data == NULL)
return cmdret_new (RET_FAILURE, NULL);
@@ -2330,97 +2330,97 @@ command (int interactive, char *data)
for (i=0; i<alias_list_last; i++)
{
if (!strcmp (cmd, alias_list[i].name))
- {
- struct sbuf *s;
-
- /* Append any arguments onto the end of the alias' command. */
- s = sbuf_new (0);
- sbuf_concat (s, alias_list[i].alias);
- if (rest != NULL)
- sbuf_printf_concat (s, " %s", rest);
-
- alias_recursive_depth++;
- if (alias_recursive_depth >= MAX_ALIAS_RECURSIVE_DEPTH)
- result = cmdret_new (RET_FAILURE, "command: alias recursion has exceeded maximum depth");
- else
- result = command (interactive, sbuf_get (s));
- alias_recursive_depth--;
-
- sbuf_free (s);
- goto done;
- }
+ {
+ struct sbuf *s;
+
+ /* Append any arguments onto the end of the alias' command. */
+ s = sbuf_new (0);
+ sbuf_concat (s, alias_list[i].alias);
+ if (rest != NULL)
+ sbuf_printf_concat (s, " %s", rest);
+
+ alias_recursive_depth++;
+ if (alias_recursive_depth >= MAX_ALIAS_RECURSIVE_DEPTH)
+ result = cmdret_new (RET_FAILURE, "command: alias recursion has exceeded maximum depth");
+ else
+ result = command (interactive, sbuf_get (s));
+ alias_recursive_depth--;
+
+ sbuf_free (s);
+ goto done;
+ }
}
/* If it wasn't an alias, maybe its a command. */
list_for_each_entry (uc, &user_commands, node)
{
if (!strcmp (cmd, uc->name))
- {
- struct sbuf *scur;
- struct cmdarg *acur;
- struct list_head *iter, *tmp;
- struct list_head head, args;
- int i, nargs = 0, raw = 0;
-
- INIT_LIST_HEAD (&args);
- INIT_LIST_HEAD (&head);
-
- /* We need to tell parse_args about arg_REST and arg_SHELLCMD. */
- for (i=0; i<uc->num_args; i++)
- if (uc->args[i].type == arg_REST
- || uc->args[i].type == arg_SHELLCMD
- || uc->args[i].type == arg_RAW)
- {
- raw = 1;
- nargs = i;
- break;
- }
-
- /* Parse the arguments and call the function. */
- result = parse_args (rest, &head, nargs, raw);
- if (result)
- goto free_lists;
-
- /* Interactive commands prompt the user for missing args. */
- if (interactive)
- result = fill_in_missing_args (uc, &head, &args);
- else
- {
- int parsed_args;
- result = parsed_input_to_args (uc->num_args, uc->args, &head, &args, &parsed_args);
- }
-
- if (result == NULL)
- {
- if ((interactive && list_size (&args) < uc->i_required_args)
- || (!interactive && list_size (&args) < uc->ni_required_args))
- {
- result = cmdret_new (RET_FAILURE, "not enough arguments.");
- goto free_lists;
- }
- else if (list_size (&head) > uc->num_args)
- {
- result = cmdret_new (RET_FAILURE, "too many arguments.");
- goto free_lists;
- }
- else
- {
- struct cmdarg **cmdargs = arg_array (&args);
- result = uc->func (interactive, cmdargs);
- free (cmdargs);
- }
- }
-
- free_lists:
- /* Free the parsed strings */
- list_for_each_safe_entry (scur, iter, tmp, &head, node)
- sbuf_free(scur);
- /* Free the args */
- list_for_each_safe_entry (acur, iter, tmp, &args, node)
- arg_free (acur);
-
- goto done;
- }
+ {
+ struct sbuf *scur;
+ struct cmdarg *acur;
+ struct list_head *iter, *tmp;
+ struct list_head head, args;
+ int i, nargs = 0, raw = 0;
+
+ INIT_LIST_HEAD (&args);
+ INIT_LIST_HEAD (&head);
+
+ /* We need to tell parse_args about arg_REST and arg_SHELLCMD. */
+ for (i=0; i<uc->num_args; i++)
+ if (uc->args[i].type == arg_REST
+ || uc->args[i].type == arg_SHELLCMD
+ || uc->args[i].type == arg_RAW)
+ {
+ raw = 1;
+ nargs = i;
+ break;
+ }
+
+ /* Parse the arguments and call the function. */
+ result = parse_args (rest, &head, nargs, raw);
+ if (result)
+ goto free_lists;
+
+ /* Interactive commands prompt the user for missing args. */
+ if (interactive)
+ result = fill_in_missing_args (uc, &head, &args);
+ else
+ {
+ int parsed_args;
+ result = parsed_input_to_args (uc->num_args, uc->args, &head, &args, &parsed_args);
+ }
+
+ if (result == NULL)
+ {
+ if ((interactive && list_size (&args) < uc->i_required_args)
+ || (!interactive && list_size (&args) < uc->ni_required_args))
+ {
+ result = cmdret_new (RET_FAILURE, "not enough arguments.");
+ goto free_lists;
+ }
+ else if (list_size (&head) > uc->num_args)
+ {
+ result = cmdret_new (RET_FAILURE, "too many arguments.");
+ goto free_lists;
+ }
+ else
+ {
+ struct cmdarg **cmdargs = arg_array (&args);
+ result = uc->func (interactive, cmdargs);
+ free (cmdargs);
+ }
+ }
+
+ free_lists:
+ /* Free the parsed strings */
+ list_for_each_safe_entry (scur, iter, tmp, &head, node)
+ sbuf_free(scur);
+ /* Free the args */
+ list_for_each_safe_entry (acur, iter, tmp, &args, node)
+ arg_free (acur);
+
+ goto done;
+ }
}
result = cmdret_new (RET_FAILURE, MESSAGE_UNKNOWN_COMMAND, cmd);
@@ -2464,10 +2464,10 @@ spawn(char *cmd, int raw)
int pid;
pid = fork();
- if (pid == 0)
+ if (pid == 0)
{
/* Some process setup to make sure the spawned process runs
- in its own session. */
+ in its own session. */
putenv(current_screen()->display_string);
#ifdef HAVE_SETSID
setsid();
@@ -2479,7 +2479,7 @@ spawn(char *cmd, int raw)
#endif
/* raw means don't run it through sh. */
if (raw)
- execl (cmd, 0);
+ execl (cmd, 0);
execl("/bin/sh", "sh", "-c", cmd, 0);
_exit(EXIT_FAILURE);
}
@@ -2502,7 +2502,7 @@ spawn(char *cmd, int raw)
return pid;
}
-/* Switch to a different Window Manager. Thanks to
+/* Switch to a different Window Manager. Thanks to
"Chr. v. Stuckrad" <stucki@math.fu-berlin.de> for the patch. */
cmdret *
cmd_newwm(int interactive, struct cmdarg **args)
@@ -2533,12 +2533,12 @@ cmd_time (int interactive, struct cmdarg **args)
timep = time(NULL);
tmp = ctime(&timep);
msg = xmalloc (strlen (tmp));
- strncpy(msg, tmp, strlen (tmp) - 1); /* Remove the newline */
+ strncpy(msg, tmp, strlen (tmp) - 1); /* Remove the newline */
msg[strlen(tmp) - 1] = 0;
ret = cmdret_new (RET_SUCCESS, "%s", msg);
free (msg);
-
+
return ret;
}
@@ -2569,17 +2569,17 @@ cmd_number (int interactive, struct cmdarg **args)
/* Find other window with same number and give it old number. */
other_win = group_find_window_by_number (rp_current_group, new_number);
if (other_win != NULL)
- {
- old_number = win->number;
- other_win->number = old_number;
+ {
+ old_number = win->number;
+ other_win->number = old_number;
- /* Resort the window in the list */
- group_resort_window (rp_current_group, other_win);
- }
+ /* Resort the window in the list */
+ group_resort_window (rp_current_group, other_win);
+ }
else
- {
- numset_release (rp_current_group->numset, win->number);
- }
+ {
+ numset_release (rp_current_group->numset, win->number);
+ }
win->number = new_number;
numset_add_num (rp_current_group->numset, new_number);
@@ -2613,13 +2613,13 @@ cmd_windows (int interactive, struct cmdarg **args)
{
s = current_screen ();
/* This is a yukky hack. If the bar already hidden then show the
- bar. This handles the case when msgwait is 0 (the bar sticks)
- and the user uses this command to toggle the bar on and
- off. OR the timeout is >0 then show the bar. Which means,
- always show the bar if msgwait is >0 which fixes the case
- when a command in the prefix hook displays the bar. */
+ bar. This handles the case when msgwait is 0 (the bar sticks)
+ and the user uses this command to toggle the bar on and
+ off. OR the timeout is >0 then show the bar. Which means,
+ always show the bar if msgwait is >0 which fixes the case
+ when a command in the prefix hook displays the bar. */
if (!hide_bar (s) || defaults.bar_timeout > 0) show_bar (s, fmt);
-
+
return cmdret_new (RET_SUCCESS, NULL);
}
else
@@ -2673,9 +2673,9 @@ cmd_escape (int interactive, struct cmdarg **args)
{
action->key = key->sym;
if (key->state != 0)
- action->state = 0;
+ action->state = 0;
else
- action->state = RP_CONTROL_MASK;
+ action->state = RP_CONTROL_MASK;
}
/* Remove the grab on the current prefix key */
@@ -2712,7 +2712,7 @@ static cmdret *
read_split (char *str, int max, int *p)
{
int a, b;
-
+
if (sscanf(str, "%d/%d", &a, &b) == 2)
{
*p = (int)(max * (float)(a) / (float)(b));
@@ -2720,7 +2720,7 @@ read_split (char *str, int max, int *p)
else if (sscanf(str, "%d", p) == 1)
{
if (*p < 0)
- *p = max + *p;
+ *p = max + *p;
}
else
{
@@ -2748,7 +2748,7 @@ cmd_v_split (int interactive, struct cmdarg **args)
{
ret = read_split (ARG_STRING(0), frame->height, &pixels);
if (ret)
- return ret;
+ return ret;
}
if (pixels > 0)
@@ -2776,7 +2776,7 @@ cmd_h_split (int interactive, struct cmdarg **args)
{
ret = read_split (ARG_STRING(0), frame->width, &pixels);
if (ret)
- return ret;
+ return ret;
}
if (pixels > 0)
@@ -2841,27 +2841,27 @@ struct resize_binding
};
static resize_binding resize_bindings[] =
- { {{INPUT_ABORT_KEY, INPUT_ABORT_MODIFIER}, RESIZE_ABORT},
- {{RESIZE_VGROW_KEY, RESIZE_VGROW_MODIFIER}, RESIZE_VGROW},
- {{RESIZE_VSHRINK_KEY, RESIZE_VSHRINK_MODIFIER}, RESIZE_VSHRINK},
- {{RESIZE_HGROW_KEY, RESIZE_HGROW_MODIFIER}, RESIZE_HGROW},
- {{RESIZE_HSHRINK_KEY, RESIZE_HSHRINK_MODIFIER}, RESIZE_HSHRINK},
+ { {{INPUT_ABORT_KEY, INPUT_ABORT_MODIFIER}, RESIZE_ABORT},
+ {{RESIZE_VGROW_KEY, RESIZE_VGROW_MODIFIER}, RESIZE_VGROW},
+ {{RESIZE_VSHRINK_KEY, RESIZE_VSHRINK_MODIFIER}, RESIZE_VSHRINK},
+ {{RESIZE_HGROW_KEY, RESIZE_HGROW_MODIFIER}, RESIZE_HGROW},
+ {{RESIZE_HSHRINK_KEY, RESIZE_HSHRINK_MODIFIER}, RESIZE_HSHRINK},
{{RESIZE_SHRINK_TO_WINDOW_KEY,RESIZE_SHRINK_TO_WINDOW_MODIFIER},RESIZE_TO_WINDOW},
- {{RESIZE_END_KEY, RESIZE_END_MODIFIER}, RESIZE_END},
-/* Some more default keys
+ {{RESIZE_END_KEY, RESIZE_END_MODIFIER}, RESIZE_END},
+/* Some more default keys
* (after the values from conf.h, so that they have lower priority):
* first the arrow keys: */
- {{XK_Escape, 0}, RESIZE_ABORT},
- {{XK_Down, 0}, RESIZE_VGROW},
- {{XK_Up, 0}, RESIZE_VSHRINK},
- {{XK_Right, 0}, RESIZE_HGROW},
- {{XK_Left, 0}, RESIZE_HSHRINK},
+ {{XK_Escape, 0}, RESIZE_ABORT},
+ {{XK_Down, 0}, RESIZE_VGROW},
+ {{XK_Up, 0}, RESIZE_VSHRINK},
+ {{XK_Right, 0}, RESIZE_HGROW},
+ {{XK_Left, 0}, RESIZE_HSHRINK},
/* some vi-like bindings: */
- {{XK_j, 0}, RESIZE_VGROW},
- {{XK_k, 0}, RESIZE_VSHRINK},
- {{XK_l, 0}, RESIZE_HGROW},
- {{XK_h, 0}, RESIZE_HSHRINK},
- {{0, 0}, RESIZE_UNKNOWN} };
+ {{XK_j, 0}, RESIZE_VGROW},
+ {{XK_k, 0}, RESIZE_VSHRINK},
+ {{XK_l, 0}, RESIZE_HGROW},
+ {{XK_h, 0}, RESIZE_HSHRINK},
+ {{0, 0}, RESIZE_UNKNOWN} };
cmdret *
@@ -2880,9 +2880,9 @@ cmd_resize (int interactive, struct cmdarg **args)
struct list_head *bk;
/* If we haven't got at least 2 frames, there isn't anything to
- scale. */
+ scale. */
if (num_frames (s) < 2)
- return cmdret_new (RET_FAILURE, NULL);
+ return cmdret_new (RET_FAILURE, NULL);
XGrabKeyboard (dpy, s->key_window, False, GrabModeSync, GrabModeAsync, CurrentTime);
@@ -2890,48 +2890,48 @@ cmd_resize (int interactive, struct cmdarg **args)
bk = screen_copy_frameset (s);
while (1)
- {
+ {
struct resize_binding *binding;
- show_frame_message ("Resize frame");
- nbytes = read_key (&c, &mod, buffer, sizeof (buffer));
+ show_frame_message ("Resize frame");
+ nbytes = read_key (&c, &mod, buffer, sizeof (buffer));
- /* Convert the mask to be compatible with ratpoison. */
- mod = x11_mask_to_rp_mask (mod);
+ /* Convert the mask to be compatible with ratpoison. */
+ mod = x11_mask_to_rp_mask (mod);
- for (binding = resize_bindings; binding->action; binding++)
+ for (binding = resize_bindings; binding->action; binding++)
{
if (c == binding->key.sym && mod == binding->key.state)
break;
}
- if (binding->action == RESIZE_VGROW)
- resize_frame_vertically (current_frame(), defaults.frame_resize_unit);
- else if (binding->action == RESIZE_VSHRINK)
- resize_frame_vertically (current_frame(), -defaults.frame_resize_unit);
- else if (binding->action == RESIZE_HGROW)
- resize_frame_horizontally (current_frame(), defaults.frame_resize_unit);
- else if (binding->action == RESIZE_HSHRINK)
- resize_frame_horizontally (current_frame(), -defaults.frame_resize_unit);
- else if (binding->action == RESIZE_TO_WINDOW)
- resize_shrink_to_window (current_frame());
- else if (binding->action == RESIZE_ABORT)
- {
- rp_frame *cur;
-
- screen_restore_frameset (s, bk);
- list_for_each_entry (cur, &s->frames, node)
- {
- maximize_all_windows_in_frame (cur);
- }
- break;
- }
- else if (binding->action == RESIZE_END)
- {
- frameset_free (bk);
- break;
- }
- }
+ if (binding->action == RESIZE_VGROW)
+ resize_frame_vertically (current_frame(), defaults.frame_resize_unit);
+ else if (binding->action == RESIZE_VSHRINK)
+ resize_frame_vertically (current_frame(), -defaults.frame_resize_unit);
+ else if (binding->action == RESIZE_HGROW)
+ resize_frame_horizontally (current_frame(), defaults.frame_resize_unit);
+ else if (binding->action == RESIZE_HSHRINK)
+ resize_frame_horizontally (current_frame(), -defaults.frame_resize_unit);
+ else if (binding->action == RESIZE_TO_WINDOW)
+ resize_shrink_to_window (current_frame());
+ else if (binding->action == RESIZE_ABORT)
+ {
+ rp_frame *cur;
+
+ screen_restore_frameset (s, bk);
+ list_for_each_entry (cur, &s->frames, node)
+ {
+ maximize_all_windows_in_frame (cur);
+ }
+ break;
+ }
+ else if (binding->action == RESIZE_END)
+ {
+ frameset_free (bk);
+ break;
+ }
+ }
/* It is our responsibility to free this. */
free (bk);
@@ -2942,12 +2942,12 @@ cmd_resize (int interactive, struct cmdarg **args)
else
{
if (args[0] && args[1])
- {
- resize_frame_horizontally (current_frame(), ARG(0,number));
- resize_frame_vertically (current_frame(), ARG(1,number));
- }
+ {
+ resize_frame_horizontally (current_frame(), ARG(0,number));
+ resize_frame_vertically (current_frame(), ARG(1,number));
+ }
else
- return cmdret_new (RET_FAILURE, "resize: two numeric arguments required");
+ return cmdret_new (RET_FAILURE, "resize: two numeric arguments required");
}
return cmdret_new (RET_SUCCESS, NULL);
@@ -3005,10 +3005,10 @@ cmd_ratclick (int interactive, struct cmdarg **args)
int button = 1;
if (args[0])
- {
+ {
button = ARG(0,number);
if (button < 1 || button > 3)
- return cmdret_new (RET_SUCCESS, "ratclick: invalid argument");
+ return cmdret_new (RET_SUCCESS, "ratclick: invalid argument");
}
XTestFakeButtonEvent(dpy, button, True, CurrentTime);
@@ -3022,10 +3022,10 @@ cmd_rathold (int interactive, struct cmdarg **args)
int button = 1;
if (args[1])
- {
+ {
button = ARG(1,number);
if (button < 1 || button > 3)
- return cmdret_new (RET_SUCCESS, "ratclick: invalid argument");
+ return cmdret_new (RET_SUCCESS, "ratclick: invalid argument");
}
if (!strcmp(ARG_STRING(0), "down"))
@@ -3034,7 +3034,7 @@ cmd_rathold (int interactive, struct cmdarg **args)
XTestFakeButtonEvent(dpy, button, False, CurrentTime);
else
return cmdret_new (RET_FAILURE, "rathold: '%s' invalid argument", ARG_STRING(0));
-
+
return cmdret_new (RET_SUCCESS, NULL);
}
@@ -3062,30 +3062,30 @@ cmd_license (int interactive, struct cmdarg **args)
int i;
int max_width = 0;
char *license_text[] = { PACKAGE " " VERSION, "(built " __DATE__ " " __TIME__ ")",
- "",
- "Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts",
- "",
- "ratpoison is free software; you can redistribute it and/or modify ",
- "it under the terms of the GNU General Public License as published by ",
- "the Free Software Foundation; either version 2, or (at your option) ",
- "any later version.",
- "",
- "ratpoison is distributed in the hope that it will be useful, ",
- "but WITHOUT ANY WARRANTY; without even the implied warranty of ",
- "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ",
- "GNU General Public License for more details.",
- "",
- "You should have received a copy of the GNU General Public License ",
- "along with this software; see the file COPYING. If not, write to ",
- "the Free Software Foundation, Inc., 59 Temple Place, Suite 330, ",
- "Boston, MA 02111-1307 USA",
- "",
- "Send bugreports, fixes, enhancements, t-shirts, money, beer & pizza ",
- "to ratpoison-devel@nongnu.org or visit ",
- "http://www.nongnu.org/ratpoison/",
- "",
- "[Press any key to end.] ",
- NULL};
+ "",
+ "Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts",
+ "",
+ "ratpoison is free software; you can redistribute it and/or modify ",
+ "it under the terms of the GNU General Public License as published by ",
+ "the Free Software Foundation; either version 2, or (at your option) ",
+ "any later version.",
+ "",
+ "ratpoison is distributed in the hope that it will be useful, ",
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of ",
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ",
+ "GNU General Public License for more details.",
+ "",
+ "You should have received a copy of the GNU General Public License ",
+ "along with this software; see the file COPYING. If not, write to ",
+ "the Free Software Foundation, Inc., 59 Temple Place, Suite 330, ",
+ "Boston, MA 02111-1307 USA",
+ "",
+ "Send bugreports, fixes, enhancements, t-shirts, money, beer & pizza ",
+ "to ratpoison-devel@nongnu.org or visit ",
+ "http://www.nongnu.org/ratpoison/",
+ "",
+ "[Press any key to end.] ",
+ NULL};
XMapRaised (dpy, s->help_window);
XGrabKeyboard (dpy, s->help_window, False, GrabModeSync, GrabModeAsync, CurrentTime);
@@ -3097,7 +3097,7 @@ cmd_license (int interactive, struct cmdarg **args)
tmp = XTextWidth (defaults.font, license_text[i], strlen (license_text[i]));
if (tmp > max_width)
- max_width = tmp;
+ max_width = tmp;
}
/* Offset the text so its in the center. */
@@ -3110,8 +3110,8 @@ cmd_license (int interactive, struct cmdarg **args)
for(i=0; license_text[i]; i++)
{
XDrawString (dpy, s->help_window, s->normal_gc,
- x, y + defaults.font->max_bounds.ascent,
- license_text[i], strlen (license_text[i]));
+ x, y + defaults.font->max_bounds.ascent,
+ license_text[i], strlen (license_text[i]));
y += FONT_HEIGHT (defaults.font);
}
@@ -3148,7 +3148,7 @@ cmd_help (int interactive, struct cmdarg **args)
int x = 10;
int y = 0;
int max_width = 0;
- int drawing_keys = 1; /* 1 if we are drawing keys 0 if we are drawing commands */
+ int drawing_keys = 1; /* 1 if we are drawing keys 0 if we are drawing commands */
char *keysym_name;
XMapRaised (dpy, s->help_window);
@@ -3176,66 +3176,66 @@ cmd_help (int interactive, struct cmdarg **args)
i = 0;
old_i = 0;
while (i<map->actions_last || drawing_keys)
- {
- if (drawing_keys)
- {
- keysym_name = keysym_to_string (map->actions[i].key, map->actions[i].state);
-
- XDrawString (dpy, s->help_window, s->normal_gc,
- x, y + defaults.font->max_bounds.ascent,
- keysym_name, strlen (keysym_name));
-
- if (XTextWidth (defaults.font, keysym_name, strlen (keysym_name)) > max_width)
- max_width = XTextWidth (defaults.font, keysym_name, strlen (keysym_name));
-
- free (keysym_name);
- }
- else
- {
- XDrawString (dpy, s->help_window, s->normal_gc,
- x, y + defaults.font->max_bounds.ascent,
- map->actions[i].data, strlen (map->actions[i].data));
-
- if (XTextWidth (defaults.font, map->actions[i].data, strlen (map->actions[i].data)) > max_width)
- {
- max_width = XTextWidth (defaults.font, map->actions[i].data, strlen (map->actions[i].data));
- }
- }
-
- y += FONT_HEIGHT (defaults.font);
- /* Make sure the next line fits entirely within the window. */
- if (y + FONT_HEIGHT (defaults.font) >= (s->top + s->height))
- {
- if (drawing_keys)
- {
- x += max_width + 10;
- drawing_keys = 0;
- i = old_i;
- }
- else
- {
- x += max_width + 20;
- drawing_keys = 1;
- i++;
- old_i = i;
- }
-
- max_width = 0;
- y = FONT_HEIGHT (defaults.font) * 4;
- }
- else
- {
- i++;
- if (i >= map->actions_last && drawing_keys)
- {
- x += max_width + 10;
- drawing_keys = 0;
- y = FONT_HEIGHT (defaults.font) * 4;
- i = old_i;
- max_width = 0;
- }
- }
- }
+ {
+ if (drawing_keys)
+ {
+ keysym_name = keysym_to_string (map->actions[i].key, map->actions[i].state);
+
+ XDrawString (dpy, s->help_window, s->normal_gc,
+ x, y + defaults.font->max_bounds.ascent,
+ keysym_name, strlen (keysym_name));
+
+ if (XTextWidth (defaults.font, keysym_name, strlen (keysym_name)) > max_width)
+ max_width = XTextWidth (defaults.font, keysym_name, strlen (keysym_name));
+
+ free (keysym_name);
+ }
+ else
+ {
+ XDrawString (dpy, s->help_window, s->normal_gc,
+ x, y + defaults.font->max_bounds.ascent,
+ map->actions[i].data, strlen (map->actions[i].data));
+
+ if (XTextWidth (defaults.font, map->actions[i].data, strlen (map->actions[i].data)) > max_width)
+ {
+ max_width = XTextWidth (defaults.font, map->actions[i].data, strlen (map->actions[i].data));
+ }
+ }
+
+ y += FONT_HEIGHT (defaults.font);
+ /* Make sure the next line fits entirely within the window. */
+ if (y + FONT_HEIGHT (defaults.font) >= (s->top + s->height))
+ {
+ if (drawing_keys)
+ {
+ x += max_width + 10;
+ drawing_keys = 0;
+ i = old_i;
+ }
+ else
+ {
+ x += max_width + 20;
+ drawing_keys = 1;
+ i++;
+ old_i = i;
+ }
+
+ max_width = 0;
+ y = FONT_HEIGHT (defaults.font) * 4;
+ }
+ else
+ {
+ i++;
+ if (i >= map->actions_last && drawing_keys)
+ {
+ x += max_width + 10;
+ drawing_keys = 0;
+ y = FONT_HEIGHT (defaults.font) * 4;
+ i = old_i;
+ max_width = 0;
+ }
+ }
+ }
XMaskEvent (dpy, KeyPressMask, &ev);
XUngrabKeyboard (dpy, CurrentTime);
@@ -3257,15 +3257,15 @@ cmd_help (int interactive, struct cmdarg **args)
help_list = sbuf_new (0);
for (i = 0; i < map->actions_last; i++)
- {
- keysym_name = keysym_to_string (map->actions[i].key, map->actions[i].state);
- sbuf_concat (help_list, keysym_name);
- free (keysym_name);
- sbuf_concat (help_list, " ");
- sbuf_concat (help_list, map->actions[i].data);
- if (i < map->actions_last - 1)
- sbuf_concat (help_list, "\n");
- }
+ {
+ keysym_name = keysym_to_string (map->actions[i].key, map->actions[i].state);
+ sbuf_concat (help_list, keysym_name);
+ free (keysym_name);
+ sbuf_concat (help_list, " ");
+ sbuf_concat (help_list, map->actions[i].data);
+ if (i < map->actions_last - 1)
+ sbuf_concat (help_list, "\n");
+ }
tmp = sbuf_get (help_list);
free (help_list);
@@ -3283,10 +3283,10 @@ cmd_rudeness (int interactive, struct cmdarg **args)
if (args[0] == NULL)
return cmdret_new (RET_SUCCESS, "%d",
- rp_honour_transient_raise
- | (rp_honour_normal_raise << 1)
- | (rp_honour_transient_map << 2)
- | (rp_honour_normal_map << 3));
+ rp_honour_transient_raise
+ | (rp_honour_normal_raise << 1)
+ | (rp_honour_transient_map << 2)
+ | (rp_honour_normal_map << 3));
num = ARG(0,number);
if (num < 0 || num > 15)
@@ -3356,7 +3356,7 @@ cmd_gravity (int interactive, struct cmdarg **args)
static cmdret *
set_wingravity (struct cmdarg **args)
{
- if (args[0] == NULL)
+ if (args[0] == NULL)
return cmdret_new (RET_SUCCESS, "%s", wingravity_to_string (defaults.win_gravity));
defaults.win_gravity = ARG(0,gravity);
@@ -3423,10 +3423,10 @@ update_gc (rp_screen *s)
gv.subwindow_mode = IncludeInferiors;
gv.font = defaults.font->fid;
XFreeGC (dpy, s->normal_gc);
- s->normal_gc = XCreateGC(dpy, s->root,
- GCForeground | GCBackground
- | GCFunction | GCLineWidth
- | GCSubwindowMode | GCFont, &gv);
+ s->normal_gc = XCreateGC(dpy, s->root,
+ GCForeground | GCBackground
+ | GCFunction | GCLineWidth
+ | GCSubwindowMode | GCFont, &gv);
}
static void
@@ -3470,11 +3470,11 @@ set_padding (struct cmdarg **args)
int l, t, r, b;
if (args[0] == NULL)
- return cmdret_new (RET_SUCCESS, "%d %d %d %d",
- defaults.padding_left,
- defaults.padding_top,
- defaults.padding_right,
- defaults.padding_bottom);
+ return cmdret_new (RET_SUCCESS, "%d %d %d %d",
+ defaults.padding_left,
+ defaults.padding_top,
+ defaults.padding_right,
+ defaults.padding_bottom);
l = ARG(0,number);
t = ARG(1,number);
@@ -3492,33 +3492,33 @@ set_padding (struct cmdarg **args)
bk_len = frame->width;
if (frame->x == defaults.padding_left)
- {
- frame->x = l;
- frame->width += bk_pos - l;
- }
+ {
+ frame->x = l;
+ frame->width += bk_pos - l;
+ }
if ((bk_pos + bk_len) == (current_screen()->left + current_screen()->width - defaults.padding_right))
- frame->width = current_screen()->left + current_screen()->width - r - frame->x;
+ frame->width = current_screen()->left + current_screen()->width - r - frame->x;
/* Resize vertically. */
bk_pos = frame->y;
bk_len = frame->height;
if (frame->y == defaults.padding_top)
- {
- frame->y = t;
- frame->height += bk_pos - t;
- }
+ {
+ frame->y = t;
+ frame->height += bk_pos - t;
+ }
if ((bk_pos + bk_len) == (current_screen()->top + current_screen()->height - defaults.padding_bottom))
- frame->height = current_screen()->top + current_screen()->height - b - frame->y;
+ frame->height = current_screen()->top + current_screen()->height - b - frame->y;
maximize_all_windows_in_frame (frame);
}
defaults.padding_left = l;
defaults.padding_right = r;
- defaults.padding_top = t;
+ defaults.padding_top = t;
defaults.padding_bottom = b;
return cmdret_new (RET_SUCCESS, NULL);
@@ -3541,7 +3541,7 @@ set_border (struct cmdarg **args)
list_for_each_entry (win,&rp_mapped_window,node)
{
if (win_get_frame (win))
- maximize (win);
+ maximize (win);
}
return cmdret_new (RET_SUCCESS, NULL);
@@ -3628,14 +3628,14 @@ set_winname (struct cmdarg **args)
switch (defaults.win_name)
{
case WIN_NAME_TITLE:
- return cmdret_new (RET_SUCCESS, "title");
+ return cmdret_new (RET_SUCCESS, "title");
case WIN_NAME_RES_NAME:
- return cmdret_new (RET_SUCCESS, "name");
+ return cmdret_new (RET_SUCCESS, "name");
case WIN_NAME_RES_CLASS:
- return cmdret_new (RET_SUCCESS, "class");
+ return cmdret_new (RET_SUCCESS, "class");
default:
- PRINT_DEBUG (("Unknown win_name\n"));
- return cmdret_new (RET_FAILURE, "unknown");
+ PRINT_DEBUG (("Unknown win_name\n"));
+ return cmdret_new (RET_FAILURE, "unknown");
}
name = ARG_STRING(0);
@@ -3666,7 +3666,7 @@ set_fgcolor (struct cmdarg **args)
for (i=0; i<num_screens; i++)
{
if (!XAllocNamedColor (dpy, screens[i].def_cmap, ARG_STRING(0), &color, &junk))
- return cmdret_new (RET_FAILURE, "deffgcolor: unknown color");
+ return cmdret_new (RET_FAILURE, "deffgcolor: unknown color");
screens[i].fg_color = color.pixel;
update_gc (&screens[i]);
@@ -3694,7 +3694,7 @@ set_bgcolor (struct cmdarg **args)
for (i=0; i<num_screens; i++)
{
if (!XAllocNamedColor (dpy, screens[i].def_cmap, ARG_STRING(0), &color, &junk))
- return cmdret_new (RET_FAILURE, "defbgcolor: unknown color");
+ return cmdret_new (RET_FAILURE, "defbgcolor: unknown color");
screens[i].bg_color = color.pixel;
update_gc (&screens[i]);
@@ -3758,8 +3758,8 @@ cmd_chdir (int interactive, struct cmdarg **args)
dir = getenv ("HOME");
if (dir == NULL || *dir == '\0')
{
- return cmdret_new (RET_FAILURE, "chdir: HOME not set");
- }
+ return cmdret_new (RET_FAILURE, "chdir: HOME not set");
+ }
}
else
dir = ARG_STRING(0);
@@ -3801,21 +3801,21 @@ cmd_info (int interactive, struct cmdarg **args)
rp_window_elem *win_elem;
win_elem = group_find_window (&rp_current_group->mapped_windows, win);
if (!win_elem)
- win_elem = group_find_window (&rp_current_group->unmapped_windows, win);
+ win_elem = group_find_window (&rp_current_group->unmapped_windows, win);
if (win_elem)
- {
- char *s;
-
- if (args[0] == NULL)
- s = defaults.info_fmt;
- else
- s = ARG_STRING(0);
- buf = sbuf_new (0);
- format_string (s, win_elem, buf);
- tmp = sbuf_free_struct (buf);
- return cmdret_new (RET_SUCCESS, "%s", tmp);
- }
+ {
+ char *s;
+
+ if (args[0] == NULL)
+ s = defaults.info_fmt;
+ else
+ s = ARG_STRING(0);
+ buf = sbuf_new (0);
+ format_string (s, win_elem, buf);
+ tmp = sbuf_free_struct (buf);
+ return cmdret_new (RET_SUCCESS, "%s", tmp);
+ }
}
return cmdret_new (RET_SUCCESS, "No window.");
@@ -3955,7 +3955,7 @@ set_barpadding (struct cmdarg **args)
defaults.bar_y_padding = y;
}
else
- return cmdret_new (RET_FAILURE, "defbarpadding: invalid arguments");
+ return cmdret_new (RET_FAILURE, "defbarpadding: invalid arguments");
return cmdret_new (RET_SUCCESS, NULL);
}
@@ -3982,9 +3982,9 @@ cmd_unalias (int interactive, struct cmdarg **args)
alias_list_last--;
/* Free the alias and put the last alias in the the space to
- keep alias_list from becoming sparse. This code must jump
- through some hoops to correctly handle the case when
- alias_list_last == index. */
+ keep alias_list from becoming sparse. This code must jump
+ through some hoops to correctly handle the case when
+ alias_list_last == index. */
tmp = alias_list[index].alias;
alias_list[index].alias = xstrdup (alias_list[alias_list_last].alias);
free (tmp);
@@ -4067,7 +4067,7 @@ cmd_warp (int interactive, struct cmdarg **args)
defaults.warp = 0;
else
return cmdret_new (RET_FAILURE, "warp: invalid argument");
-
+
return cmdret_new (RET_SUCCESS, NULL);
}
@@ -4088,131 +4088,131 @@ sync_wins (rp_screen *s)
found = 0;
for (i=0; i<nwins; i++)
- {
- if (win->w == wins[i])
- {
- found = 1;
- break;
- }
- }
+ {
+ if (win->w == wins[i])
+ {
+ found = 1;
+ break;
+ }
+ }
if (!found)
- {
- ignore_badwindow++;
-
- /* If, somehow, the window is not withdrawn before it is destroyed,
- perform the necessary steps to withdraw the window before it is
- unmanaged. */
- if (win->state == IconicState)
- {
- PRINT_DEBUG (("Destroying Iconic Window (%s)\n", window_name (win)));
- withdraw_window (win);
- }
- else if (win->state == NormalState)
- {
- rp_frame *frame;
-
- PRINT_DEBUG (("Destroying Normal Window (%s)\n", window_name (win)));
- frame = find_windows_frame (win);
- if (frame)
- {
- cleanup_frame (frame);
- if (frame->number == win->scr->current_frame)
- set_active_frame (frame);
- }
- withdraw_window (win);
- }
-
- /* Now that the window is guaranteed to be in the unmapped window
- list, we can safely stop managing it. */
- unmanage (win);
- ignore_badwindow--;
- }
+ {
+ ignore_badwindow++;
+
+ /* If, somehow, the window is not withdrawn before it is destroyed,
+ perform the necessary steps to withdraw the window before it is
+ unmanaged. */
+ if (win->state == IconicState)
+ {
+ PRINT_DEBUG (("Destroying Iconic Window (%s)\n", window_name (win)));
+ withdraw_window (win);
+ }
+ else if (win->state == NormalState)
+ {
+ rp_frame *frame;
+
+ PRINT_DEBUG (("Destroying Normal Window (%s)\n", window_name (win)));
+ frame = find_windows_frame (win);
+ if (frame)
+ {
+ cleanup_frame (frame);
+ if (frame->number == win->scr->current_frame)
+ set_active_frame (frame);
+ }
+ withdraw_window (win);
+ }
+
+ /* Now that the window is guaranteed to be in the unmapped window
+ list, we can safely stop managing it. */
+ unmanage (win);
+ ignore_badwindow--;
+ }
}
for (i=0; i<nwins; i++)
{
XGetWindowAttributes(dpy, wins[i], &attr);
- if (wins[i] == s->bar_window
- || wins[i] == s->key_window
- || wins[i] == s->input_window
- || wins[i] == s->frame_window
- || wins[i] == s->help_window
- || attr.override_redirect == True) continue;
-
+ if (wins[i] == s->bar_window
+ || wins[i] == s->key_window
+ || wins[i] == s->input_window
+ || wins[i] == s->frame_window
+ || wins[i] == s->help_window
+ || attr.override_redirect == True) continue;
+
/* Find the window in our mapped window list. */
win = find_window_in_list (wins[i], &rp_mapped_window);
if (win)
- {
- rp_frame *frame;
- /* If the window is viewable and it is in a frame, then
- maximize it and go to the next window. */
- if (attr.map_state == IsViewable)
- {
- frame = find_windows_frame (win);
- if (frame)
- {
- maximize (win);
- }
- else
- {
- hide_window (win);
- }
- }
- else if (attr.map_state == IsUnmapped
- && get_state (win) == IconicState)
- {
- frame = find_windows_frame (win);
- if (frame)
- {
- unhide_window (win);
- maximize (win);
- }
- }
- else
- {
- PRINT_DEBUG (("I don't know what to do...\n"));
- }
-
- /* We've handled the window. */
- continue;
- }
+ {
+ rp_frame *frame;
+ /* If the window is viewable and it is in a frame, then
+ maximize it and go to the next window. */
+ if (attr.map_state == IsViewable)
+ {
+ frame = find_windows_frame (win);
+ if (frame)
+ {
+ maximize (win);
+ }
+ else
+ {
+ hide_window (win);
+ }
+ }
+ else if (attr.map_state == IsUnmapped
+ && get_state (win) == IconicState)
+ {
+ frame = find_windows_frame (win);
+ if (frame)
+ {
+ unhide_window (win);
+ maximize (win);
+ }
+ }
+ else
+ {
+ PRINT_DEBUG (("I don't know what to do...\n"));
+ }
+
+ /* We've handled the window. */
+ continue;
+ }
/* Try the unmapped window list. */
win = find_window_in_list (wins[i], &rp_unmapped_window);
if (win)
- {
- /* If the window is viewable and it is in a frame, then
- maximize it and go to the next window. */
- if (attr.map_state == IsViewable)
- {
- /* We need to map it since it's visible now. */
- map_window (win);
- }
- else if (attr.map_state == IsUnmapped
- && get_state (win) == IconicState)
- {
- /* We need to map the window and then hide it. */
- map_window (win);
- hide_window (win);
- }
- else
- {
- PRINT_DEBUG (("I think it's all sync'd up...\n"));
- }
-
- /* We've handled the window. */
- continue;
- }
+ {
+ /* If the window is viewable and it is in a frame, then
+ maximize it and go to the next window. */
+ if (attr.map_state == IsViewable)
+ {
+ /* We need to map it since it's visible now. */
+ map_window (win);
+ }
+ else if (attr.map_state == IsUnmapped
+ && get_state (win) == IconicState)
+ {
+ /* We need to map the window and then hide it. */
+ map_window (win);
+ hide_window (win);
+ }
+ else
+ {
+ PRINT_DEBUG (("I think it's all sync'd up...\n"));
+ }
+
+ /* We've handled the window. */
+ continue;
+ }
/* The window isn't in the mapped or unmapped window list so add
- it. */
+ it. */
win = add_to_window_list (s, wins[i]);
-
+
/* If it's visible or iconized. "Map" it. */
if (attr.map_state == IsViewable
- || (attr.map_state == IsUnmapped
- && get_state (win) == IconicState))
- map_window (win);
+ || (attr.map_state == IsUnmapped
+ && get_state (win) == IconicState))
+ map_window (win);
}
}
@@ -4279,8 +4279,8 @@ cmd_tmpwm (int interactive, struct cmdarg **args)
for (i=0; i<num_screens; i++)
{
XSelectInput(dpy, RootWindow (dpy, screens[i].screen_num),
- PropertyChangeMask | ColormapChangeMask
- | SubstructureRedirectMask | SubstructureNotifyMask);
+ PropertyChangeMask | ColormapChangeMask
+ | SubstructureRedirectMask | SubstructureNotifyMask);
/* Map its key window */
XMapWindow (dpy, screens[i].key_window);
}
@@ -4358,14 +4358,14 @@ cmd_fdump (int interactively, struct cmdarg **args)
snum = ARG(0,number);
if (snum < 0 || num_screens <= snum)
- return cmdret_new (RET_FAILURE, "fdump: invalid argument");
+ return cmdret_new (RET_FAILURE, "fdump: invalid argument");
else
- {
- char *s = fdump (&screens[snum]);
- cmdret *ret = cmdret_new (RET_SUCCESS, "%s", s);
- free (s);
- return ret;
- }
+ {
+ char *s = fdump (&screens[snum]);
+ cmdret *ret = cmdret_new (RET_SUCCESS, "%s", s);
+ free (s);
+ return ret;
+ }
}
}
@@ -4395,13 +4395,13 @@ frestore (char *data, rp_screen *s)
{
new = frame_read (token);
if (new == NULL)
- {
- free (dup);
- return cmdret_new (RET_SUCCESS, "frestore: invalid frame format");;
- }
+ {
+ free (dup);
+ return cmdret_new (RET_SUCCESS, "frestore: invalid frame format");;
+ }
list_add_tail (&new->node, &fset);
token = strtok_r (NULL, ",", &nexttok);
- }
+ }
free (dup);
@@ -4427,37 +4427,37 @@ frestore (char *data, rp_screen *s)
PRINT_DEBUG (("restore %d %d\n", cur->number, cur->win_number));
/* Grab the frame's number, but if it already exists request a
- new one. */
+ new one. */
if (!numset_add_num (s->frames_numset, cur->number)) {
- cur->number = numset_request (s->frames_numset);
+ cur->number = numset_request (s->frames_numset);
}
/* Find the current frame based on last_access. */
if (cur->last_access > max)
- {
- s->current_frame = cur->number;
- max = cur->last_access;
- }
+ {
+ s->current_frame = cur->number;
+ max = cur->last_access;
+ }
/* Update the window the frame points to. */
if (cur->win_number != EMPTY)
- {
- win = find_window_number (cur->win_number);
- set_frames_window (cur, win);
- }
+ {
+ win = find_window_number (cur->win_number);
+ set_frames_window (cur, win);
+ }
}
/* Show the windows in the frames. */
list_for_each_entry (win, &rp_mapped_window, node)
{
if (win->frame_number != EMPTY)
- {
- maximize (win);
- unhide_window (win);
- }
+ {
+ maximize (win);
+ unhide_window (win);
+ }
}
- set_active_frame (current_frame());
+ set_active_frame (current_frame());
update_bar (s);
show_frame_indicator();
@@ -4556,34 +4556,34 @@ cmd_groups (int interactive, struct cmdarg **args)
char separator;
if (cur == rp_current_group)
- mark_start = strlen (sbuf_get (buffer));
+ mark_start = strlen (sbuf_get (buffer));
/* Pad start of group name with a space for row
- style. non-Interactive always gets a column.*/
+ style. non-Interactive always gets a column.*/
if (defaults.window_list_style == STYLE_ROW && interactive)
- sbuf_concat (buffer, " ");
+ sbuf_concat (buffer, " ");
if(cur == rp_current_group)
- separator = '*';
+ separator = '*';
else
- separator = '-';
+ separator = '-';
fmt = xsprintf ("%d%c%s", cur->number, separator, cur->name);
sbuf_concat (buffer, fmt);
/* Pad end of group name with a space for row style. */
if (defaults.window_list_style == STYLE_ROW && interactive)
- {
- sbuf_concat (buffer, " ");
- }
+ {
+ sbuf_concat (buffer, " ");
+ }
else
- {
- if (cur->node.next != &rp_groups)
- sbuf_concat (buffer, "\n");
- }
+ {
+ if (cur->node.next != &rp_groups)
+ sbuf_concat (buffer, "\n");
+ }
if (cur == rp_current_group)
- mark_end = strlen (sbuf_get (buffer));
+ mark_end = strlen (sbuf_get (buffer));
}
/* Display it or return it. */
@@ -4624,7 +4624,7 @@ cmd_addhook (int interactive, struct cmdarg **args)
{
struct list_head *hook;
struct sbuf *cmd;
-
+
hook = hook_lookup (ARG_STRING(0));
if (hook == NULL)
return cmdret_new (RET_FAILURE, "addhook: unknown hook '%s'", ARG_STRING(0));
@@ -4672,7 +4672,7 @@ cmd_listhook (int interactive, struct cmdarg **args)
{
sbuf_printf_concat(buffer, "%s", sbuf_get (cur));
if (cur->node.next != hook)
- sbuf_printf_concat(buffer, "\n");
+ sbuf_printf_concat(buffer, "\n");
}
ret = cmdret_new (RET_SUCCESS, "%s", sbuf_get (buffer));
@@ -4689,7 +4689,7 @@ cmd_gdelete (int interactive, struct cmdarg **args)
g = rp_current_group;
else
g = ARG(0,group);
-
+
switch (group_delete_group (g))
{
case GROUP_DELETE_GROUP_OK:
@@ -4707,9 +4707,9 @@ cmd_gdelete (int interactive, struct cmdarg **args)
static void
grab_rat ()
{
- XGrabPointer (dpy, current_screen()->root, True, 0,
- GrabModeAsync, GrabModeAsync,
- None, current_screen()->rat, CurrentTime);
+ XGrabPointer (dpy, current_screen()->root, True, 0,
+ GrabModeAsync, GrabModeAsync,
+ None, current_screen()->rat, CurrentTime);
}
static void
@@ -4723,8 +4723,8 @@ cmd_readkey (int interactive, struct cmdarg **args)
{
char *keysym_name;
rp_action *key_action;
- KeySym keysym; /* Key pressed */
- unsigned int mod; /* Modifiers */
+ KeySym keysym; /* Key pressed */
+ unsigned int mod; /* Modifiers */
int rat_grabbed = 0;
rp_keymap *map;
@@ -4816,16 +4816,16 @@ cmd_set (int interactive, struct cmdarg **args)
list_last (last, &set_vars, node);
list_for_each_entry (cur, &set_vars, node)
- {
- cmdret *ret;
- ret = cur->set_fn (args);
- sbuf_printf_concat (s, "%s: %s", cur->var, ret->output);
- /* Skip a newline on the last line. */
- if (cur != last)
- sbuf_concat (s, "\n");
- cmdret_free (ret);
- }
-
+ {
+ cmdret *ret;
+ ret = cur->set_fn (args);
+ sbuf_printf_concat (s, "%s: %s", cur->var, ret->output);
+ /* Skip a newline on the last line. */
+ if (cur != last)
+ sbuf_concat (s, "\n");
+ cmdret_free (ret);
+ }
+
/* Return the accumulated string. */
ret = cmdret_new (RET_SUCCESS, "%s", sbuf_get (s));
sbuf_free (s);
@@ -4848,40 +4848,40 @@ cmd_set (int interactive, struct cmdarg **args)
/* We need to tell parse_args about arg_REST and arg_SHELLCMD. */
for (i=0; i<ARG(0,variable)->nargs; i++)
- if (ARG(0,variable)->args[i].type == arg_REST
- || ARG(0,variable)->args[i].type == arg_SHELLCMD
- || ARG(0,variable)->args[i].type == arg_RAW)
- {
- raw = 1;
- nargs = i;
- break;
- }
+ if (ARG(0,variable)->args[i].type == arg_REST
+ || ARG(0,variable)->args[i].type == arg_SHELLCMD
+ || ARG(0,variable)->args[i].type == arg_RAW)
+ {
+ raw = 1;
+ nargs = i;
+ break;
+ }
/* Parse the arguments and call the function. */
if (args[1])
- input = xstrdup (args[1]->string);
+ input = xstrdup (args[1]->string);
else
- input = xstrdup ("");
+ input = xstrdup ("");
result = parse_args (input, &head, nargs, raw);
free (input);
if (result)
- goto failed;
+ goto failed;
result = parsed_input_to_args (ARG(0,variable)->nargs, ARG(0,variable)->args,
- &head, &arglist, &parsed_args);
+ &head, &arglist, &parsed_args);
if (result)
- goto failed;
+ goto failed;
/* 0 or nargs is acceptable */
if (list_size (&arglist) > 0 && list_size (&arglist) < ARG(0,variable)->nargs)
- {
- result = cmdret_new (RET_FAILURE, "not enough arguments.");
- goto failed;
- }
+ {
+ result = cmdret_new (RET_FAILURE, "not enough arguments.");
+ goto failed;
+ }
else if (list_size (&head) > ARG(0,variable)->nargs)
- {
- result = cmdret_new (RET_FAILURE, "too many arguments.");
- goto failed;
- }
+ {
+ result = cmdret_new (RET_FAILURE, "too many arguments.");
+ goto failed;
+ }
cmdargs = arg_array (&arglist);
result = ARG(0,variable)->set_fn (cmdargs);
@@ -4891,10 +4891,10 @@ cmd_set (int interactive, struct cmdarg **args)
failed:
/* Free the parsed strings */
list_for_each_safe_entry (scur, iter, tmp, &head, node)
- sbuf_free(scur);
+ sbuf_free(scur);
/* Free the args */
list_for_each_safe_entry (acur, iter, tmp, &arglist, node)
- arg_free (acur);
+ arg_free (acur);
return result;
}
@@ -4917,14 +4917,14 @@ cmd_sfdump (int interactively, struct cmdarg **args)
/* FIXME: Oooh, gross! there's a trailing comma, yuk! */
list_for_each_entry (cur, &(screens[i].frames), node)
- {
- char *tmp;
+ {
+ char *tmp;
- tmp = frame_dump (cur);
- sbuf_concat (s, tmp);
- sbuf_concat (s, tmp2);
- free (tmp);
- }
+ tmp = frame_dump (cur);
+ sbuf_concat (s, tmp);
+ sbuf_concat (s, tmp2);
+ free (tmp);
+ }
free (tmp2);
}
@@ -4946,7 +4946,7 @@ cmd_sdump (int interactive, struct cmdarg **args)
{
tmp = screen_dump (&screens[i]);
sbuf_concat (s, tmp);
- if (i + 1 != num_screens) /* No trailing comma. */
+ if (i + 1 != num_screens) /* No trailing comma. */
sbuf_concat (s, ",");
free (tmp);
}
@@ -4986,7 +4986,7 @@ cmd_cnext (int interactive, struct cmdarg **args)
rp_window *cur, *last, *win;
cur = current_window();
- if (!cur || !cur->res_class) /* Can't be done. */
+ if (!cur || !cur->res_class) /* Can't be done. */
return cmd_next (interactive, args);
/* CUR !in cycle list, so LAST marks last node. */
@@ -4994,17 +4994,17 @@ cmd_cnext (int interactive, struct cmdarg **args)
if (last)
for (win = group_next_window (rp_current_group, cur);
- win;
- win = group_next_window (rp_current_group, win))
+ win;
+ win = group_next_window (rp_current_group, win))
{
- if (win->res_class
- && strcmp (cur->res_class, win->res_class))
- {
- set_active_window_force (win);
- return cmdret_new (RET_SUCCESS, NULL);
- }
-
- if (win == last) break;
+ if (win->res_class
+ && strcmp (cur->res_class, win->res_class))
+ {
+ set_active_window_force (win);
+ return cmdret_new (RET_SUCCESS, NULL);
+ }
+
+ if (win == last) break;
}
return cmdret_new (RET_FAILURE, "%s", MESSAGE_NO_OTHER_WINDOW);
@@ -5016,7 +5016,7 @@ cmd_cprev (int interactive, struct cmdarg **args)
rp_window *cur, *last, *win;
cur = current_window();
- if (!cur || !cur->res_class) /* Can't be done. */
+ if (!cur || !cur->res_class) /* Can't be done. */
return cmd_next (interactive, args);
/* CUR !in cycle list, so LAST marks last node. */
@@ -5024,17 +5024,17 @@ cmd_cprev (int interactive, struct cmdarg **args)
if (last)
for (win = group_prev_window (rp_current_group, cur);
- win;
- win = group_prev_window (rp_current_group, win))
+ win;
+ win = group_prev_window (rp_current_group, win))
{
- if (win->res_class
- && strcmp (cur->res_class, win->res_class))
- {
- set_active_window_force (win);
- return cmdret_new (RET_SUCCESS, NULL);
- }
-
- if (win == last) break;
+ if (win->res_class
+ && strcmp (cur->res_class, win->res_class))
+ {
+ set_active_window_force (win);
+ return cmdret_new (RET_SUCCESS, NULL);
+ }
+
+ if (win == last) break;
}
return cmdret_new (RET_FAILURE, "%s", MESSAGE_NO_OTHER_WINDOW);
@@ -5046,7 +5046,7 @@ cmd_inext (int interactive, struct cmdarg **args)
rp_window *cur, *last, *win;
cur = current_window();
- if (!cur || !cur->res_class) /* Can't be done. */
+ if (!cur || !cur->res_class) /* Can't be done. */
return cmd_next (interactive, args);
/* CUR !in cycle list, so LAST marks last node. */
@@ -5054,17 +5054,17 @@ cmd_inext (int interactive, struct cmdarg **args)
if (last)
for (win = group_next_window (rp_current_group, cur);
- win;
- win = group_next_window (rp_current_group, win))
+ win;
+ win = group_next_window (rp_current_group, win))
{
- if (win->res_class
- && !strcmp (cur->res_class, win->res_class))
- {
- set_active_window_force (win);
- return cmdret_new (RET_SUCCESS, NULL);
- }
-
- if (win == last) break;
+ if (win->res_class
+ && !strcmp (cur->res_class, win->res_class))
+ {
+ set_active_window_force (win);
+ return cmdret_new (RET_SUCCESS, NULL);
+ }
+
+ if (win == last) break;
}
return cmdret_new (RET_FAILURE, "%s", MESSAGE_NO_OTHER_WINDOW);
@@ -5076,7 +5076,7 @@ cmd_iprev (int interactive, struct cmdarg **args)
rp_window *cur, *last, *win;
cur = current_window();
- if (!cur || !cur->res_class) /* Can't be done. */
+ if (!cur || !cur->res_class) /* Can't be done. */
return cmd_next (interactive, args);
/* CUR !in cycle list, so LAST marks last node. */
@@ -5084,17 +5084,17 @@ cmd_iprev (int interactive, struct cmdarg **args)
if (last)
for (win = group_prev_window (rp_current_group, cur);
- win;
- win = group_prev_window (rp_current_group, win))
+ win;
+ win = group_prev_window (rp_current_group, win))
{
- if (win->res_class
- && !strcmp (cur->res_class, win->res_class))
- {
- set_active_window_force (win);
- return cmdret_new (RET_SUCCESS, NULL);
- }
-
- if (win == last) break;
+ if (win->res_class
+ && !strcmp (cur->res_class, win->res_class))
+ {
+ set_active_window_force (win);
+ return cmdret_new (RET_SUCCESS, NULL);
+ }
+
+ if (win == last) break;
}
return cmdret_new (RET_FAILURE, "%s", MESSAGE_NO_OTHER_WINDOW);
@@ -5180,18 +5180,18 @@ cmd_prompt (int interactive, struct cmdarg **args)
{
prefix = strchr (ARG_STRING(0), ':');
if (prefix)
- {
- prefix++; /* Don't return the colon. */
- query = xmalloc (prefix - ARG_STRING(0) + 1);
- strncpy (query, ARG_STRING(0), prefix - ARG_STRING(0));
- query[prefix - ARG_STRING(0)] = 0; /* null terminate */
- output = get_more_input (query, prefix, trivial_completions);
- free (query);
- }
+ {
+ prefix++; /* Don't return the colon. */
+ query = xmalloc (prefix - ARG_STRING(0) + 1);
+ strncpy (query, ARG_STRING(0), prefix - ARG_STRING(0));
+ query[prefix - ARG_STRING(0)] = 0; /* null terminate */
+ output = get_more_input (query, prefix, trivial_completions);
+ free (query);
+ }
else
- {
- output = get_input (ARG_STRING(0), trivial_completions);
- }
+ {
+ output = get_input (ARG_STRING(0), trivial_completions);
+ }
}
ret = cmdret_new (RET_SUCCESS, "%s", output);
if (output)
@@ -5204,8 +5204,8 @@ cmd_describekey (int interactive, struct cmdarg **args)
{
char *keysym_name;
rp_action *key_action;
- KeySym keysym; /* Key pressed */
- unsigned int mod; /* Modifiers */
+ KeySym keysym; /* Key pressed */
+ unsigned int mod; /* Modifiers */
int rat_grabbed = 0;
rp_keymap *map;
@@ -5250,7 +5250,7 @@ cmdret *
cmd_dedicate (int interactive, struct cmdarg **args)
{
rp_frame *f;
-
+
f = current_frame();
if (!f) return cmdret_new (RET_SUCCESS, NULL);
@@ -5262,7 +5262,7 @@ cmd_dedicate (int interactive, struct cmdarg **args)
f->dedicated = !(f->dedicated);
return cmdret_new (RET_SUCCESS, "Consider this frame %s.",
- f->dedicated ? "chaste":"promiscuous");
+ f->dedicated ? "chaste":"promiscuous");
}
cmdret *
diff --git a/src/actions.h b/src/actions.h
index 9e323cf..afeb653 100644
--- a/src/actions.h
+++ b/src/actions.h
@@ -31,19 +31,19 @@ typedef struct user_command user_command;
/* arg_REST and arg_SHELLCMD eat the rest of the input. */
enum argtype { arg_REST,
- arg_NUMBER,
- arg_STRING,
- arg_FRAME,
- arg_WINDOW,
- arg_COMMAND,
- arg_SHELLCMD,
+ arg_NUMBER,
+ arg_STRING,
+ arg_FRAME,
+ arg_WINDOW,
+ arg_COMMAND,
+ arg_SHELLCMD,
arg_KEYMAP,
- arg_KEY,
- arg_GRAVITY,
- arg_GROUP,
- arg_HOOK,
- arg_VARIABLE,
- arg_RAW};
+ arg_KEY,
+ arg_GRAVITY,
+ arg_GROUP,
+ arg_HOOK,
+ arg_VARIABLE,
+ arg_RAW};
union arg_union {
rp_frame *frame;
diff --git a/src/bar.c b/src/bar.c
index 5cd0432..cd46a50 100644
--- a/src/bar.c
+++ b/src/bar.c
@@ -1,5 +1,5 @@
/* Functionality for a bar across the bottom of the screen listing the
- * windows currently managed.
+ * windows currently managed.
*
* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca>
*
@@ -75,7 +75,7 @@ show_bar (rp_screen *s, char *fmt)
s->bar_is_raised = BAR_IS_WINDOW_LIST;
XMapRaised (dpy, s->bar_window);
update_window_names (s, fmt);
-
+
reset_alarm();
return 1;
}
@@ -128,14 +128,14 @@ bar_y (rp_screen *s, int height)
case EastGravity:
case CenterGravity:
case WestGravity:
- y = s->top + (s->height - height
- - defaults.bar_border_width * 2) / 2;
+ y = s->top + (s->height - height
+ - defaults.bar_border_width * 2) / 2;
break;
case SouthEastGravity:
case SouthGravity:
case SouthWestGravity:
- y = s->top + (s->height - height
- - defaults.bar_border_width * 2);
+ y = s->top + (s->height - height
+ - defaults.bar_border_width * 2);
break;
}
@@ -207,7 +207,7 @@ count_lines (char* msg, int len)
if (len < 1)
return 1;
- for(i=0; i<len; i++)
+ for(i=0; i<len; i++)
{
if (msg[i] == '\n') ret++;
}
@@ -222,24 +222,24 @@ max_line_length (char* msg)
int i;
int start;
int ret = 0;
-
+
/* Count each line and keep the length of the longest one. */
- for(start=0, i=0; i <= strlen(msg); i++)
+ for(start=0, i=0; i <= strlen(msg); i++)
{
- if(msg[i] == '\n' || msg[i] == '\0')
- {
- int current_width;
-
- /* Check if this line is the longest so far. */
- current_width = XTextWidth (defaults.font, msg + start, i - start);
- if(current_width > ret)
- {
- ret = current_width;
- }
-
- /* Update the start of the new line. */
- start = i + 1;
- }
+ if(msg[i] == '\n' || msg[i] == '\0')
+ {
+ int current_width;
+
+ /* Check if this line is the longest so far. */
+ current_width = XTextWidth (defaults.font, msg + start, i - start);
+ if(current_width > ret)
+ {
+ ret = current_width;
+ }
+
+ /* Update the start of the new line. */
+ start = i + 1;
+ }
}
return ret;
@@ -259,8 +259,8 @@ pos_in_line (char* msg, int pos)
ret = 0;
for(i=pos-1; i>=0; ret++, i--)
{
- if(msg[i]=='\n')
- break;
+ if(msg[i]=='\n')
+ break;
}
return ret;
@@ -272,18 +272,18 @@ line_beginning (char* msg, int pos)
int ret = 0;
int i;
- if(pos <= 0)
+ if(pos <= 0)
return 0;
/* Go backwards until we hit a new line or the beginning of the
string. */
- for(i=pos-1; i>=0; --i)
+ for(i=pos-1; i>=0; --i)
{
if (msg[i]=='\n')
- {
- ret = i + 1;
- break;
- }
+ {
+ ret = i + 1;
+ break;
+ }
}
return ret;
@@ -300,28 +300,28 @@ draw_string (rp_screen *s, char *msg)
/* Walk through the string, print each line. */
start = 0;
line_no = 0;
- for(i=0; i < strlen(msg); ++i)
+ for(i=0; i < strlen(msg); ++i)
{
/* When we encounter a new line, print the text up to the new
- line, and move down one line. */
+ line, and move down one line. */
if (msg[i] == '\n')
- {
- XDrawString (dpy, s->bar_window, s->normal_gc,
- defaults.bar_x_padding,
- defaults.bar_y_padding + defaults.font->max_bounds.ascent
- + line_no * line_height,
- msg + start, i - start);
- line_no++;
- start = i + 1;
- }
+ {
+ XDrawString (dpy, s->bar_window, s->normal_gc,
+ defaults.bar_x_padding,
+ defaults.bar_y_padding + defaults.font->max_bounds.ascent
+ + line_no * line_height,
+ msg + start, i - start);
+ line_no++;
+ start = i + 1;
+ }
}
-
+
/* Print the last line. */
XDrawString (dpy, s->bar_window, s->normal_gc,
- defaults.bar_x_padding,
- defaults.bar_y_padding + defaults.font->max_bounds.ascent
- + line_no * line_height,
- msg + start, strlen (msg) - start);
+ defaults.bar_x_padding,
+ defaults.bar_y_padding + defaults.font->max_bounds.ascent
+ + line_no * line_height,
+ msg + start, strlen (msg) - start);
XSync (dpy, False);
}
@@ -359,9 +359,9 @@ correct_mark (int msg_len, int *mark_start, int *mark_end)
static void
prepare_bar (rp_screen *s, int width, int height)
{
- XMoveResizeWindow (dpy, s->bar_window,
- bar_x (s, width), bar_y (s, height),
- width, height);
+ XMoveResizeWindow (dpy, s->bar_window,
+ bar_x (s, width), bar_y (s, height),
+ width, height);
/* Map the bar if needed */
if (!s->bar_is_raised)
@@ -376,8 +376,8 @@ prepare_bar (rp_screen *s, int width, int height)
}
static void
-get_mark_box (char *msg, int mark_start, int mark_end,
- int *x, int *y, int *width, int *height)
+get_mark_box (char *msg, int mark_start, int mark_end,
+ int *x, int *y, int *width, int *height)
{
int start, end;
int mark_end_is_new_line = 0;
@@ -406,20 +406,20 @@ get_mark_box (char *msg, int mark_start, int mark_end,
end_line_beginning = line_beginning(msg, mark_end);
PRINT_DEBUG (("start_line = %d, end_line = %d\n", start_line, end_line));
- PRINT_DEBUG (("start_line_beginning = %d, end_line_beginning = %d\n",
- start_line_beginning, end_line_beginning));
+ PRINT_DEBUG (("start_line_beginning = %d, end_line_beginning = %d\n",
+ start_line_beginning, end_line_beginning));
if (mark_start == 0 || start_pos_in_line == 0)
start = 0;
else
- start = XTextWidth (defaults.font,
- &msg[start_line_beginning],
- start_pos_in_line) + defaults.bar_x_padding;
-
- end = XTextWidth (defaults.font,
- &msg[end_line_beginning],
- end_pos_in_line) + defaults.bar_x_padding * 2;
-
+ start = XTextWidth (defaults.font,
+ &msg[start_line_beginning],
+ start_pos_in_line) + defaults.bar_x_padding;
+
+ end = XTextWidth (defaults.font,
+ &msg[end_line_beginning],
+ end_pos_in_line) + defaults.bar_x_padding * 2;
+
if (mark_end != strlen (msg))
end -= defaults.bar_x_padding;
@@ -433,7 +433,7 @@ get_mark_box (char *msg, int mark_start, int mark_end,
{
*width = end - start;
}
-
+
*x = start;
*y = (start_line - 1) * FONT_HEIGHT (defaults.font) + defaults.bar_y_padding;
*height = (end_line - start_line + 1) * FONT_HEIGHT (defaults.font);
@@ -451,15 +451,15 @@ draw_inverse_box (rp_screen *s, int x, int y, int width, int height)
mask = GCForeground | GCFunction;
lgc = XCreateGC(dpy, s->root, mask, &lgv);
- XFillRectangle (dpy, s->bar_window, lgc,
- x, y, width, height);
+ XFillRectangle (dpy, s->bar_window, lgc,
+ x, y, width, height);
XFreeGC (dpy, lgc);
lgv.foreground = s->bg_color;
lgc = XCreateGC(dpy, s->root, mask, &lgv);
- XFillRectangle (dpy, s->bar_window, lgc,
- x, y, width, height);
+ XFillRectangle (dpy, s->bar_window, lgc,
+ x, y, width, height);
XFreeGC (dpy, lgc);
}
@@ -472,8 +472,8 @@ draw_mark (rp_screen *s, char *msg, int mark_start, int mark_end)
if (mark_end == 0 || mark_start == mark_end)
return;
- get_mark_box (msg, mark_start, mark_end,
- &x, &y, &width, &height);
+ get_mark_box (msg, mark_start, mark_end,
+ &x, &y, &width, &height);
draw_inverse_box (s, x, y, width, height);
}
diff --git a/src/communications.c b/src/communications.c
index 8c86b60..b3e95f2 100644
--- a/src/communications.c
+++ b/src/communications.c
@@ -12,7 +12,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
@@ -43,9 +43,9 @@ receive_command_result (Window w)
/* First, find out how big the property is. */
status = XGetWindowProperty (dpy, w, rp_command_result,
- 0, 0, False, XA_STRING,
- &type_ret, &format_ret, &nitems, &bytes_after,
- &result);
+ 0, 0, False, XA_STRING,
+ &type_ret, &format_ret, &nitems, &bytes_after,
+ &result);
/* Failed to retrieve property. */
if (status != Success || result == NULL)
@@ -61,9 +61,9 @@ receive_command_result (Window w)
/* Now that we have the length of the message, we can get the
whole message. */
status = XGetWindowProperty (dpy, w, rp_command_result,
- 0, (bytes_after / 4) + (bytes_after % 4 ? 1 : 0),
- True, XA_STRING, &type_ret, &format_ret, &nitems,
- &bytes_after, &result);
+ 0, (bytes_after / 4) + (bytes_after % 4 ? 1 : 0),
+ True, XA_STRING, &type_ret, &format_ret, &nitems,
+ &bytes_after, &result);
/* Failed to retrieve property. */
if (status != Success || result == NULL)
@@ -76,9 +76,9 @@ receive_command_result (Window w)
if (strlen ((char *)result))
{
if (result[0] == '1')
- printf ("%s\n", &result[1]);
+ printf ("%s\n", &result[1]);
else
- fprintf (stderr, "%s\n", &result[1]);
+ fprintf (stderr, "%s\n", &result[1]);
}
/* Free the result. */
@@ -109,11 +109,11 @@ send_command (unsigned char interactive, unsigned char *cmd, int screen_num)
XSelectInput (dpy, w, PropertyChangeMask);
XChangeProperty (dpy, w, rp_command, XA_STRING,
- 8, PropModeReplace, sbuf_get(s), strlen ((char *)cmd) + 2);
+ 8, PropModeReplace, sbuf_get(s), strlen ((char *)cmd) + 2);
- XChangeProperty (dpy, root,
- rp_command_request, XA_WINDOW,
- 8, PropModeAppend, (unsigned char *)&w, sizeof (Window));
+ XChangeProperty (dpy, root,
+ rp_command_request, XA_WINDOW,
+ 8, PropModeAppend, (unsigned char *)&w, sizeof (Window));
sbuf_free (s);
@@ -122,12 +122,12 @@ send_command (unsigned char interactive, unsigned char *cmd, int screen_num)
XEvent ev;
XMaskEvent (dpy, PropertyChangeMask, &ev);
- if (ev.xproperty.atom == rp_command_result
- && ev.xproperty.state == PropertyNewValue)
- {
- receive_command_result(ev.xproperty.window);
- done = 1;
- }
+ if (ev.xproperty.atom == rp_command_result
+ && ev.xproperty.state == PropertyNewValue)
+ {
+ receive_command_result(ev.xproperty.window);
+ done = 1;
+ }
}
XDestroyWindow (dpy, w);
diff --git a/src/completions.c b/src/completions.c
index 4c62d71..fc32c38 100644
--- a/src/completions.c
+++ b/src/completions.c
@@ -35,7 +35,7 @@ completions_new (completion_fn list_fn)
c->last_match = NULL;
c->partial = NULL;
c->virgin = 1;
-
+
return c;
}
@@ -110,12 +110,12 @@ completions_prev_match (rp_completions *c)
cur = list_prev_entry (cur, &c->completion_list, node))
{
if (str_comp (sbuf_get (cur), c->partial, strlen (c->partial)))
- {
- /* We found a match so update our last_match pointer and
- return the string. */
- c->last_match = cur;
- return sbuf_get (cur);
- }
+ {
+ /* We found a match so update our last_match pointer and
+ return the string. */
+ c->last_match = cur;
+ return sbuf_get (cur);
+ }
}
return NULL;
@@ -133,12 +133,12 @@ completions_next_match (rp_completions *c)
cur = list_next_entry (cur, &c->completion_list, node))
{
if (str_comp (sbuf_get (cur), c->partial, strlen (c->partial)))
- {
- /* We found a match so update our last_match pointer and
- return the string. */
- c->last_match = cur;
- return sbuf_get (cur);
- }
+ {
+ /* We found a match so update our last_match pointer and
+ return the string. */
+ c->last_match = cur;
+ return sbuf_get (cur);
+ }
}
return NULL;
@@ -151,22 +151,22 @@ completions_complete (rp_completions *c, char *partial, int direction)
if (c->virgin)
{
completions_update (c, partial);
-
+
/* Since it's never been completed on and c->last_match points
- to the first element of the list which may be a match. So
- check it. FIXME: This is a bit of a hack. */
+ to the first element of the list which may be a match. So
+ check it. FIXME: This is a bit of a hack. */
if (c->last_match == NULL)
- return NULL;
+ return NULL;
/* c->last_match contains the first match in the forward
- direction. So if we're looking for the previous match, then
- check the previous element from last_match. */
+ direction. So if we're looking for the previous match, then
+ check the previous element from last_match. */
if (direction == COMPLETION_PREVIOUS)
- c->last_match = list_prev_entry (c->last_match, &c->completion_list, node);
+ c->last_match = list_prev_entry (c->last_match, &c->completion_list, node);
/* Now check if last_match is a match for partial. */
if (str_comp (sbuf_get (c->last_match), c->partial, strlen (c->partial)))
- return sbuf_get (c->last_match);
+ return sbuf_get (c->last_match);
}
if (c->last_match == NULL)
diff --git a/src/conf.h b/src/conf.h
index 34fa4d5..91d2c56 100644
--- a/src/conf.h
+++ b/src/conf.h
@@ -1,4 +1,4 @@
-/* Config file for ratpoison. Edit these values and recompile.
+/* Config file for ratpoison. Edit these values and recompile.
* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca>
*
* This file is part of ratpoison.
@@ -45,7 +45,7 @@
#define RESIZE_VGROW_MODIFIER RP_CONTROL_MASK
/* Key used to shrink frame vertically when in resize mode. */
-#define RESIZE_VSHRINK_KEY XK_p
+#define RESIZE_VSHRINK_KEY XK_p
#define RESIZE_VSHRINK_MODIFIER RP_CONTROL_MASK
/* Key used to enlarge frame horizontally when in resize mode. */
@@ -53,15 +53,15 @@
#define RESIZE_HGROW_MODIFIER RP_CONTROL_MASK
/* Key used to shrink frame horizontally when in resize mode. */
-#define RESIZE_HSHRINK_KEY XK_b
+#define RESIZE_HSHRINK_KEY XK_b
#define RESIZE_HSHRINK_MODIFIER RP_CONTROL_MASK
/* Key used to shrink frame to fit it's current window. */
-#define RESIZE_SHRINK_TO_WINDOW_KEY XK_s
-#define RESIZE_SHRINK_TO_WINDOW_MODIFIER 0
+#define RESIZE_SHRINK_TO_WINDOW_KEY XK_s
+#define RESIZE_SHRINK_TO_WINDOW_MODIFIER 0
/* Key used to exit resize mode. */
-#define RESIZE_END_KEY XK_Return
+#define RESIZE_END_KEY XK_Return
#define RESIZE_END_MODIFIER 0
/* Number of history items to store. */
diff --git a/src/data.h b/src/data.h
index 695f763..ef1e80c 100644
--- a/src/data.h
+++ b/src/data.h
@@ -1,4 +1,4 @@
-/* our datatypes and global variables
+/* our datatypes and global variables
* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca>
*
* This file is part of ratpoison.
@@ -51,7 +51,7 @@ struct rp_frame
/* For determining the last frame. */
int last_access;
- /* Boolean that is set when a frame is
+ /* Boolean that is set when a frame is
`dedicated' (a.k.a. glued) to one window. */
unsigned int dedicated;
@@ -147,15 +147,15 @@ struct rp_screen
GC normal_gc;
Window root, bar_window, key_window, input_window, frame_window, help_window;
int bar_is_raised;
- int screen_num; /* Our screen number as dictated my X */
- int xine_screen_num; /* Our screen number for the Xinerama extension */
+ int screen_num; /* Our screen number as dictated my X */
+ int xine_screen_num; /* Our screen number for the Xinerama extension */
Colormap def_cmap;
Cursor rat;
unsigned long fg_color, bg_color; /* The pixel color. */
-
+
/* Here to abstract over the Xinerama vs X screens difference */
int left, top, width, height;
-
+
char *display_string;
/* A list of frames that may or may not contain windows. There should
@@ -174,7 +174,7 @@ struct rp_action
{
KeySym key;
unsigned int state;
- char *data; /* misc data to be passed to the function */
+ char *data; /* misc data to be passed to the function */
/* void (*func)(void *); */
};
@@ -211,7 +211,7 @@ struct rp_defaults
int bar_location;
int bar_timeout;
int bar_border_width;
-
+
int frame_indicator_timeout;
int frame_resize_unit;
@@ -285,10 +285,10 @@ struct rp_child_info
comes to compare modifier masks. */
#define RP_SHIFT_MASK 1
#define RP_CONTROL_MASK 2
-#define RP_META_MASK 4
-#define RP_ALT_MASK 8
-#define RP_SUPER_MASK 16
-#define RP_HYPER_MASK 32
+#define RP_META_MASK 4
+#define RP_ALT_MASK 8
+#define RP_SUPER_MASK 16
+#define RP_HYPER_MASK 32
struct modifier_info
{
@@ -299,9 +299,9 @@ struct modifier_info
unsigned int hyper_mod_mask;
/* Keep track of these because they mess up the grab and should be
- ignored. */
+ ignored. */
unsigned int num_lock_mask;
- unsigned int scroll_lock_mask;
+ unsigned int scroll_lock_mask;
};
typedef struct list_head *(*completion_fn)(char *string);
diff --git a/src/editor.c b/src/editor.c
index 6aea958..21fbe63 100644
--- a/src/editor.c
+++ b/src/editor.c
@@ -69,37 +69,37 @@ struct edit_binding
};
static edit_binding edit_bindings[] =
- { {{XK_g, RP_CONTROL_MASK}, editor_abort},
- {{XK_Escape, 0}, editor_abort},
- {{XK_f, RP_CONTROL_MASK}, editor_forward_char},
- {{XK_Right, 0}, editor_forward_char},
- {{XK_b, RP_CONTROL_MASK}, editor_backward_char},
- {{XK_Left, 0}, editor_backward_char},
- {{XK_f, RP_META_MASK}, editor_forward_word},
- {{XK_b, RP_META_MASK}, editor_backward_word},
- {{XK_a, RP_CONTROL_MASK}, editor_beginning_of_line},
- {{XK_Home, 0}, editor_beginning_of_line},
- {{XK_e, RP_CONTROL_MASK}, editor_end_of_line},
- {{XK_End, 0}, editor_end_of_line},
- {{XK_d, RP_CONTROL_MASK}, editor_delete_char},
- {{XK_Delete, 0}, editor_delete_char},
- {{XK_BackSpace, 0}, editor_backward_delete_char},
- {{XK_h, RP_CONTROL_MASK}, editor_backward_delete_char},
- {{XK_BackSpace, RP_META_MASK}, editor_backward_kill_word},
- {{XK_d, RP_META_MASK}, editor_kill_word},
- {{XK_k, RP_CONTROL_MASK}, editor_kill_line},
- {{XK_u, RP_CONTROL_MASK}, editor_backward_kill_line},
- {{XK_y, RP_CONTROL_MASK}, editor_paste_selection},
- {{XK_p, RP_CONTROL_MASK}, editor_history_previous},
- {{XK_Up, 0}, editor_history_previous},
- {{XK_n, RP_CONTROL_MASK}, editor_history_next},
- {{XK_Down, 0}, editor_history_next},
- {{XK_Return, 0}, editor_enter},
- {{XK_m, RP_CONTROL_MASK}, editor_enter},
- {{XK_KP_Enter, 0}, editor_enter},
- {{XK_Tab, 0}, editor_complete_next},
- {{XK_ISO_Left_Tab, 0}, editor_complete_prev},
- { {0, 0}, 0} };
+ { {{XK_g, RP_CONTROL_MASK}, editor_abort},
+ {{XK_Escape, 0}, editor_abort},
+ {{XK_f, RP_CONTROL_MASK}, editor_forward_char},
+ {{XK_Right, 0}, editor_forward_char},
+ {{XK_b, RP_CONTROL_MASK}, editor_backward_char},
+ {{XK_Left, 0}, editor_backward_char},
+ {{XK_f, RP_META_MASK}, editor_forward_word},
+ {{XK_b, RP_META_MASK}, editor_backward_word},
+ {{XK_a, RP_CONTROL_MASK}, editor_beginning_of_line},
+ {{XK_Home, 0}, editor_beginning_of_line},
+ {{XK_e, RP_CONTROL_MASK}, editor_end_of_line},
+ {{XK_End, 0}, editor_end_of_line},
+ {{XK_d, RP_CONTROL_MASK}, editor_delete_char},
+ {{XK_Delete, 0}, editor_delete_char},
+ {{XK_BackSpace, 0}, editor_backward_delete_char},
+ {{XK_h, RP_CONTROL_MASK}, editor_backward_delete_char},
+ {{XK_BackSpace, RP_META_MASK}, editor_backward_kill_word},
+ {{XK_d, RP_META_MASK}, editor_kill_word},
+ {{XK_k, RP_CONTROL_MASK}, editor_kill_line},
+ {{XK_u, RP_CONTROL_MASK}, editor_backward_kill_line},
+ {{XK_y, RP_CONTROL_MASK}, editor_paste_selection},
+ {{XK_p, RP_CONTROL_MASK}, editor_history_previous},
+ {{XK_Up, 0}, editor_history_previous},
+ {{XK_n, RP_CONTROL_MASK}, editor_history_next},
+ {{XK_Down, 0}, editor_history_next},
+ {{XK_Return, 0}, editor_enter},
+ {{XK_m, RP_CONTROL_MASK}, editor_enter},
+ {{XK_KP_Enter, 0}, editor_enter},
+ {{XK_Tab, 0}, editor_complete_next},
+ {{XK_ISO_Left_Tab, 0}, editor_complete_prev},
+ { {0, 0}, 0} };
rp_input_line *
input_line_new (char *prompt, char *preinput, completion_fn fn)
@@ -261,7 +261,7 @@ static edit_status
editor_kill_word (rp_input_line *line)
{
int i, diff;
-
+
if (line->position < line->length)
{
@@ -272,7 +272,7 @@ editor_kill_word (rp_input_line *line)
/* Add the word to the X11 selection. */
set_nselection (&line->buffer[line->position], diff);
-
+
for (i = line->position; i <= line->length - diff; i++)
line->buffer[i] = line->buffer[i + diff];
@@ -485,7 +485,7 @@ editor_enter (rp_input_line *line)
return EDIT_ABORT;
}
else /* result == 0 || result == 1 */
- {
+ {
history_add (expansion);
free (line->buffer);
line->buffer = expansion;
diff --git a/src/events.c b/src/events.c
index 60c4d93..7e6e9ca 100644
--- a/src/events.c
+++ b/src/events.c
@@ -7,12 +7,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* ratpoison is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
@@ -24,7 +24,7 @@
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/keysym.h>
-#include <X11/Xmd.h> /* for CARD32. */
+#include <X11/Xmd.h> /* for CARD32. */
#include <stdio.h>
#include <stdlib.h>
@@ -50,20 +50,20 @@ show_rudeness_raise_msg (rp_window *win)
if (g == rp_current_group)
{
if (win->transient)
- marked_message_printf (0, 0, MESSAGE_RAISE_TRANSIENT,
- elem->number, window_name (win));
+ marked_message_printf (0, 0, MESSAGE_RAISE_TRANSIENT,
+ elem->number, window_name (win));
else
- marked_message_printf (0, 0, MESSAGE_RAISE_WINDOW,
- elem->number, window_name (win));
+ marked_message_printf (0, 0, MESSAGE_RAISE_WINDOW,
+ elem->number, window_name (win));
}
else
{
if (win->transient)
- marked_message_printf (0, 0, MESSAGE_RAISE_TRANSIENT_GROUP,
- elem->number, window_name (win), g->name);
+ marked_message_printf (0, 0, MESSAGE_RAISE_TRANSIENT_GROUP,
+ elem->number, window_name (win), g->name);
else
- marked_message_printf (0, 0, MESSAGE_RAISE_WINDOW_GROUP,
- elem->number, window_name (win), g->name);
+ marked_message_printf (0, 0, MESSAGE_RAISE_WINDOW_GROUP,
+ elem->number, window_name (win), g->name);
}
}
@@ -93,10 +93,10 @@ new_window (XCreateWindowEvent *e)
if (is_rp_window_for_screen(e->window, s)) return;
if (s && win == NULL
- && e->window != s->key_window
- && e->window != s->bar_window
- && e->window != s->input_window
- && e->window != s->frame_window
+ && e->window != s->key_window
+ && e->window != s->bar_window
+ && e->window != s->input_window
+ && e->window != s->frame_window
&& e->window != s->help_window)
{
win = add_to_window_list (s, e->window);
@@ -104,7 +104,7 @@ new_window (XCreateWindowEvent *e)
}
}
-static void
+static void
unmap_notify (XEvent *ev)
{
rp_frame *frame;
@@ -130,15 +130,15 @@ unmap_notify (XEvent *ev)
case NormalState:
PRINT_DEBUG (("Withdrawing normal window '%s'\n", window_name (win)));
/* If the window was inside a frame, fill the frame with another
- window. */
+ window. */
frame = find_windows_frame (win);
if (frame)
- {
- cleanup_frame (frame);
- if (frame->number == win->scr->current_frame
- && current_screen() == win->scr)
- set_active_frame (frame);
- }
+ {
+ cleanup_frame (frame);
+ if (frame->number == win->scr->current_frame
+ && current_screen() == win->scr)
+ set_active_frame (frame);
+ }
withdraw_window (win);
break;
@@ -147,13 +147,13 @@ unmap_notify (XEvent *ev)
update_window_names (win->scr, defaults.window_fmt);
}
-static void
+static void
map_request (XEvent *ev)
{
rp_window *win;
win = find_window (ev->xmap.window);
- if (win == NULL)
+ if (win == NULL)
{
PRINT_DEBUG (("Map request from an unknown window.\n"));
XMapWindow (dpy, ev->xmap.window);
@@ -166,38 +166,38 @@ map_request (XEvent *ev)
{
case WithdrawnState:
if (unmanaged_window (win->w))
- {
- PRINT_DEBUG (("Mapping Unmanaged Window\n"));
- XMapWindow (dpy, win->w);
- break;
- }
+ {
+ PRINT_DEBUG (("Mapping Unmanaged Window\n"));
+ XMapWindow (dpy, win->w);
+ break;
+ }
else
- {
- PRINT_DEBUG (("Mapping Withdrawn Window\n"));
- map_window (win);
- break;
- }
+ {
+ PRINT_DEBUG (("Mapping Withdrawn Window\n"));
+ map_window (win);
+ break;
+ }
break;
case IconicState:
PRINT_DEBUG (("Mapping Iconic window\n"));
if (win->last_access == 0)
- {
- /* Depending on the rudeness level, actually map the
- window. */
- if ((rp_honour_transient_map && win->transient)
- || (rp_honour_normal_map && !win->transient))
- set_active_window (win);
- }
+ {
+ /* Depending on the rudeness level, actually map the
+ window. */
+ if ((rp_honour_transient_map && win->transient)
+ || (rp_honour_normal_map && !win->transient))
+ set_active_window (win);
+ }
else
- {
- /* Depending on the rudeness level, actually map the
- window. */
- if ((rp_honour_transient_raise && win->transient)
- || (rp_honour_normal_raise && !win->transient))
- set_active_window (win);
- else
- show_rudeness_raise_msg (win);
- }
+ {
+ /* Depending on the rudeness level, actually map the
+ window. */
+ if ((rp_honour_transient_raise && win->transient)
+ || (rp_honour_normal_raise && !win->transient))
+ set_active_window (win);
+ else
+ show_rudeness_raise_msg (win);
+ }
break;
}
}
@@ -210,7 +210,7 @@ destroy_window (XDestroyWindowEvent *ev)
win = find_window (ev->window);
if (win == NULL) return;
- ignore_badwindow++;
+ ignore_badwindow++;
/* If, somehow, the window is not withdrawn before it is destroyed,
perform the necessary steps to withdraw the window before it is
@@ -227,12 +227,12 @@ destroy_window (XDestroyWindowEvent *ev)
PRINT_DEBUG (("Destroying Normal Window (%s)\n", window_name (win)));
frame = find_windows_frame (win);
if (frame)
- {
- cleanup_frame (frame);
- if (frame->number == win->scr->current_frame
- && current_screen() == win->scr)
- set_active_frame (frame);
- }
+ {
+ cleanup_frame (frame);
+ if (frame->number == win->scr->current_frame
+ && current_screen() == win->scr)
+ set_active_frame (frame);
+ }
withdraw_window (win);
}
@@ -253,91 +253,91 @@ configure_request (XConfigureRequestEvent *e)
if (win)
{
if (e->value_mask & CWStackMode)
- {
- if (e->detail == Above && win->state != WithdrawnState)
- {
- /* Depending on the rudeness level, actually map the
- window. */
- if ((rp_honour_transient_raise && win->transient)
- || (rp_honour_normal_raise && !win->transient))
- {
- if (win->state == IconicState)
- set_active_window (win);
- else if (find_windows_frame (win))
- goto_window (win);
- }
- else if (current_window() != win)
- {
- show_rudeness_raise_msg (win);
- }
-
- }
-
- PRINT_DEBUG(("request CWStackMode %d\n", e->detail));
- }
+ {
+ if (e->detail == Above && win->state != WithdrawnState)
+ {
+ /* Depending on the rudeness level, actually map the
+ window. */
+ if ((rp_honour_transient_raise && win->transient)
+ || (rp_honour_normal_raise && !win->transient))
+ {
+ if (win->state == IconicState)
+ set_active_window (win);
+ else if (find_windows_frame (win))
+ goto_window (win);
+ }
+ else if (current_window() != win)
+ {
+ show_rudeness_raise_msg (win);
+ }
+
+ }
+
+ PRINT_DEBUG(("request CWStackMode %d\n", e->detail));
+ }
PRINT_DEBUG (("'%s' window size: %d %d %d %d %d\n", window_name (win),
- win->x, win->y, win->width, win->height, win->border));
+ win->x, win->y, win->width, win->height, win->border));
/* Collect the changes to be granted. */
if (e->value_mask & CWBorderWidth)
- {
- changes.border_width = e->border_width;
- win->border = e->border_width;
- PRINT_DEBUG(("request CWBorderWidth %d\n", e->border_width));
- }
+ {
+ changes.border_width = e->border_width;
+ win->border = e->border_width;
+ PRINT_DEBUG(("request CWBorderWidth %d\n", e->border_width));
+ }
if (e->value_mask & CWWidth)
- {
- changes.width = e->width;
- win->width = e->width;
- PRINT_DEBUG(("request CWWidth %d\n", e->width));
- }
+ {
+ changes.width = e->width;
+ win->width = e->width;
+ PRINT_DEBUG(("request CWWidth %d\n", e->width));
+ }
if (e->value_mask & CWHeight)
- {
- changes.height = e->height;
- win->height = e->height;
- PRINT_DEBUG(("request CWHeight %d\n", e->height));
- }
+ {
+ changes.height = e->height;
+ win->height = e->height;
+ PRINT_DEBUG(("request CWHeight %d\n", e->height));
+ }
if (e->value_mask & CWX)
- {
- changes.x = e->x;
- win->x = e->x;
- PRINT_DEBUG(("request CWX %d\n", e->x));
- }
+ {
+ changes.x = e->x;
+ win->x = e->x;
+ PRINT_DEBUG(("request CWX %d\n", e->x));
+ }
if (e->value_mask & CWY)
- {
- changes.y = e->y;
- win->y = e->y;
- PRINT_DEBUG(("request CWY %d\n", e->y));
- }
+ {
+ changes.y = e->y;
+ win->y = e->y;
+ PRINT_DEBUG(("request CWY %d\n", e->y));
+ }
if (e->value_mask & (CWX|CWY|CWBorderWidth|CWWidth|CWHeight))
- {
- /* Grant the request, then immediately maximize it. */
- XConfigureWindow (dpy, win->w,
- e->value_mask & (CWX|CWY|CWBorderWidth|CWWidth|CWHeight),
- &changes);
- XSync(dpy, False);
- if (win->state == NormalState)
- maximize (win);
- }
+ {
+ /* Grant the request, then immediately maximize it. */
+ XConfigureWindow (dpy, win->w,
+ e->value_mask & (CWX|CWY|CWBorderWidth|CWWidth|CWHeight),
+ &changes);
+ XSync(dpy, False);
+ if (win->state == NormalState)
+ maximize (win);
+ }
}
else
{
/* Its an unmanaged window, so give it what it wants. But don't
- change the stack mode.*/
+ change the stack mode.*/
if (e->value_mask & CWX) changes.x = e->x;
if (e->value_mask & CWY) changes.x = e->x;
if (e->value_mask & CWWidth) changes.x = e->x;
if (e->value_mask & CWHeight) changes.x = e->x;
if (e->value_mask & CWBorderWidth) changes.x = e->x;
- XConfigureWindow (dpy, e->window,
- e->value_mask & (CWX|CWY|CWBorderWidth|CWWidth|CWHeight),
- &changes);
+ XConfigureWindow (dpy, e->window,
+ e->value_mask & (CWX|CWY|CWBorderWidth|CWWidth|CWHeight),
+ &changes);
}
}
@@ -355,26 +355,26 @@ client_msg (XClientMessageEvent *ev)
win = find_window (ev->window);
if (win == NULL) return;
if (ev->format == 32 && ev->data.l[0] == IconicState)
- {
- /* FIXME: This means clients can hide themselves without the
- user's intervention. This is bad, but Emacs is the only
- program I know of that iconifies itself and this is
- generally from the user pressing C-z. */
- PRINT_DEBUG (("Iconify Request.\n"));
- if (win->state == NormalState)
- {
- rp_window *w = find_window_other(win->scr);
-
- if (w)
- set_active_window (w);
- else
- blank_frame (screen_get_frame (win->scr, win->scr->current_frame));
- }
- }
+ {
+ /* FIXME: This means clients can hide themselves without the
+ user's intervention. This is bad, but Emacs is the only
+ program I know of that iconifies itself and this is
+ generally from the user pressing C-z. */
+ PRINT_DEBUG (("Iconify Request.\n"));
+ if (win->state == NormalState)
+ {
+ rp_window *w = find_window_other(win->scr);
+
+ if (w)
+ set_active_window (w);
+ else
+ blank_frame (screen_get_frame (win->scr, win->scr->current_frame));
+ }
+ }
else
- {
- PRINT_ERROR (("Non-standard WM_CHANGE_STATE format\n"));
- }
+ {
+ PRINT_ERROR (("Non-standard WM_CHANGE_STATE format\n"));
+ }
}
}
@@ -414,13 +414,13 @@ handle_key (KeySym ks, unsigned int mod, rp_screen *s)
PRINT_DEBUG(("%s\n", key_action->data));
result = command (1, key_action->data);
-
+
if (result)
- {
- if (result->output)
- message (result->output);
- cmdret_free (result);
- }
+ {
+ if (result->output)
+ message (result->output);
+ cmdret_free (result);
+ }
}
else
{
@@ -441,7 +441,7 @@ key_press (XEvent *ev)
s = find_screen (ev->xkey.root);
#ifdef HIDE_MOUSE
- XWarpPointer (dpy, None, s->root, 0, 0, 0, 0, s->left + s->width - 2, s->top + s->height - 2);
+ XWarpPointer (dpy, None, s->root, 0, 0, 0, 0, s->left + s->width - 2, s->top + s->height - 2);
#endif
if (!s) return;
@@ -468,9 +468,9 @@ execute_remote_command (Window w)
unsigned char *req;
status = XGetWindowProperty (dpy, w, rp_command,
- 0, 0, False, XA_STRING,
- &type_ret, &format_ret, &nitems, &bytes_after,
- &req);
+ 0, 0, False, XA_STRING,
+ &type_ret, &format_ret, &nitems, &bytes_after,
+ &req);
if (status != Success || req == NULL)
{
@@ -479,13 +479,13 @@ execute_remote_command (Window w)
}
/* XGetWindowProperty always allocates one extra byte even if
- the property is zero length. */
+ the property is zero length. */
XFree (req);
status = XGetWindowProperty (dpy, w, rp_command,
- 0, (bytes_after / 4) + (bytes_after % 4 ? 1 : 0),
- True, XA_STRING, &type_ret, &format_ret, &nitems,
- &bytes_after, &req);
+ 0, (bytes_after / 4) + (bytes_after % 4 ? 1 : 0),
+ True, XA_STRING, &type_ret, &format_ret, &nitems,
+ &bytes_after, &req);
if (status != Success || req == NULL)
{
@@ -530,49 +530,49 @@ receive_command (Window root)
length = sizeof (Window) / 4 + (sizeof (Window) % 4 ?1:0);
ret = XGetWindowProperty (dpy, root,
- rp_command_request,
- offset, length,
- True, XA_WINDOW, &type_ret, &format_ret,
- &nitems,
- &bytes_after, &prop_return);
+ rp_command_request,
+ offset, length,
+ True, XA_WINDOW, &type_ret, &format_ret,
+ &nitems,
+ &bytes_after, &prop_return);
/* Update the offset to point to the next window (if there is
- another one). */
+ another one). */
offset += length;
if (ret != Success)
- {
- PRINT_ERROR (("XGetWindowProperty Failed\n"));
- if (prop_return)
- XFree (prop_return);
- break;
- }
+ {
+ PRINT_ERROR (("XGetWindowProperty Failed\n"));
+ if (prop_return)
+ XFree (prop_return);
+ break;
+ }
/* If there was no window, then we're done. */
if (prop_return == NULL)
- {
- PRINT_DEBUG (("No property to read\n"));
- break;
- }
+ {
+ PRINT_DEBUG (("No property to read\n"));
+ break;
+ }
/* We grabbed a window, so now read the command stored in
- this window and execute it. */
+ this window and execute it. */
w = *(Window *)prop_return;
XFree (prop_return);
cmd_ret = execute_remote_command (w);
/* notify the client of any text that was returned by the
- command. */
+ command. */
if (cmd_ret->output)
- result = xsprintf ("%c%s", cmd_ret->success ? '1':'0', cmd_ret->output);
+ result = xsprintf ("%c%s", cmd_ret->success ? '1':'0', cmd_ret->output);
else
- result = NULL;
+ result = NULL;
if (result)
- XChangeProperty (dpy, w, rp_command_result, XA_STRING,
- 8, PropModeReplace, (unsigned char *)result, strlen (result));
+ XChangeProperty (dpy, w, rp_command_result, XA_STRING,
+ 8, PropModeReplace, (unsigned char *)result, strlen (result));
else
- XChangeProperty (dpy, w, rp_command_result, XA_STRING,
- 8, PropModeReplace, NULL, 0);
+ XChangeProperty (dpy, w, rp_command_result, XA_STRING,
+ 8, PropModeReplace, NULL, 0);
free (result);
cmdret_free (cmd_ret);
} while (bytes_after > 0);
@@ -594,49 +594,49 @@ property_notify (XEvent *ev)
}
win = find_window (ev->xproperty.window);
-
+
if (win)
{
if (ev->xproperty.atom == _net_wm_pid)
- {
- struct rp_child_info *child_info;
+ {
+ struct rp_child_info *child_info;
- PRINT_DEBUG (("updating _NET_WM_PID\n"));
- child_info = get_child_info(win->w);
- if (child_info)
- {
+ PRINT_DEBUG (("updating _NET_WM_PID\n"));
+ child_info = get_child_info(win->w);
+ if (child_info)
+ {
if (child_info->frame)
- {
+ {
PRINT_DEBUG (("frame=%p\n", child_info->frame));
win->intended_frame_number = child_info->frame->number;
- }
- /* TODO: also adopt group information? */
- }
- } else
- switch (ev->xproperty.atom)
- {
- case XA_WM_NAME:
- PRINT_DEBUG (("updating window name\n"));
- update_window_name (win);
- update_window_names (win->scr, defaults.window_fmt);
- break;
-
- case XA_WM_NORMAL_HINTS:
- PRINT_DEBUG (("updating window normal hints\n"));
- update_normal_hints (win);
- if (win->state == NormalState)
- maximize (win);
- break;
-
- case XA_WM_TRANSIENT_FOR:
- PRINT_DEBUG (("Transient for\n"));
- win->transient = XGetTransientForHint (dpy, win->w, &win->transient_for);
- break;
-
- default:
- PRINT_DEBUG (("Unhandled property notify event: %ld\n", ev->xproperty.atom));
- break;
- }
+ }
+ /* TODO: also adopt group information? */
+ }
+ } else
+ switch (ev->xproperty.atom)
+ {
+ case XA_WM_NAME:
+ PRINT_DEBUG (("updating window name\n"));
+ update_window_name (win);
+ update_window_names (win->scr, defaults.window_fmt);
+ break;
+
+ case XA_WM_NORMAL_HINTS:
+ PRINT_DEBUG (("updating window normal hints\n"));
+ update_normal_hints (win);
+ if (win->state == NormalState)
+ maximize (win);
+ break;
+
+ case XA_WM_TRANSIENT_FOR:
+ PRINT_DEBUG (("Transient for\n"));
+ win->transient = XGetTransientForHint (dpy, win->w, &win->transient_for);
+ break;
+
+ default:
+ PRINT_DEBUG (("Unhandled property notify event: %ld\n", ev->xproperty.atom));
+ break;
+ }
}
}
@@ -652,20 +652,20 @@ colormap_notify (XEvent *ev)
XWindowAttributes attr;
/* SDL sets the colormap just before destroying the window, so
- ignore BadWindow errors. */
+ ignore BadWindow errors. */
ignore_badwindow++;
XGetWindowAttributes (dpy, win->w, &attr);
win->colormap = attr.colormap;
if (win == current_window())
- {
- XInstallColormap (dpy, win->colormap);
- }
+ {
+ XInstallColormap (dpy, win->colormap);
+ }
ignore_badwindow--;
}
-}
+}
static void
focus_change (XFocusChangeEvent *ev)
@@ -738,26 +738,26 @@ selection_request (XSelectionRequestEvent *rq)
target_list[2] = (CARD32) xa_text;
target_list[3] = (CARD32) xa_compound_text;
XChangeProperty(dpy, rq->requestor, rq->property, rq->target,
- (8 * sizeof(target_list[0])), PropModeReplace,
- (unsigned char *)target_list,
- (sizeof(target_list) / sizeof(target_list[0])));
+ (8 * sizeof(target_list[0])), PropModeReplace,
+ (unsigned char *)target_list,
+ (sizeof(target_list) / sizeof(target_list[0])));
ev.xselection.property = rq->property;
} else if (rq->target == XA_STRING
- || rq->target == xa_compound_text
- || rq->target == xa_text) {
+ || rq->target == xa_compound_text
+ || rq->target == xa_text) {
if (rq->target == XA_STRING) {
style = XStringStyle;
target = XA_STRING;
} else {
target = xa_compound_text;
style = (rq->target == xa_compound_text) ? XCompoundTextStyle
- : XStdICCTextStyle;
+ : XStdICCTextStyle;
}
cl[0] = selection.text;
XmbTextListToTextProperty(dpy, cl, 1, style, &ct);
XChangeProperty(dpy, rq->requestor, rq->property,
- target, 8, PropModeReplace,
- ct.value, ct.nitems);
+ target, 8, PropModeReplace,
+ ct.value, ct.nitems);
ev.xselection.property = rq->property;
}
XSendEvent(dpy, rq->requestor, False, 0, &ev);
@@ -875,8 +875,8 @@ handle_signals ()
/* Only hide the bar if it times out. */
if (defaults.bar_timeout > 0)
- for (i=0; i<num_screens; i++)
- hide_bar (&screens[i]);
+ for (i=0; i<num_screens; i++)
+ hide_bar (&screens[i]);
hide_frame_indicator();
alarm_signalled = 0;
@@ -889,18 +889,18 @@ handle_signals ()
/* Report and remove terminated processes. */
list_for_each_safe_entry (cur, iter, tmp, &rp_children, node)
- {
- if (cur->terminated)
- {
- /* Report any child that didn't return 0. */
- if (cur->status != 0)
- marked_message_printf (0,0, "/bin/sh -c \"%s\" finished (%d)",
- cur->cmd, cur->status);
- list_del (&cur->node);
- free (cur->cmd);
- free (cur);
- }
- }
+ {
+ if (cur->terminated)
+ {
+ /* Report any child that didn't return 0. */
+ if (cur->status != 0)
+ marked_message_printf (0,0, "/bin/sh -c \"%s\" finished (%d)",
+ cur->cmd, cur->status);
+ list_del (&cur->node);
+ free (cur->cmd);
+ free (cur);
+ }
+ }
chld_signalled = 0;
}
@@ -925,7 +925,7 @@ handle_signals ()
{
PRINT_DEBUG (("Restarting\n"));
hook_run (&rp_restart_hook);
- clean_up ();
+ clean_up ();
execvp(myargv[0], myargv);
}
@@ -957,21 +957,20 @@ listen_for_events ()
FD_ZERO (&fds);
/* Loop forever. */
- for (;;)
+ for (;;)
{
handle_signals ();
/* Handle the next event. */
FD_SET (x_fd, &fds);
XFlush(dpy);
-
+
if (QLength (dpy) > 0
- || select(x_fd+1, &fds, NULL, NULL, NULL) == 1)
- {
- XNextEvent (dpy, &rp_current_event);
- delegate_event (&rp_current_event);
- XSync(dpy, False);
- }
+ || select(x_fd+1, &fds, NULL, NULL, NULL) == 1)
+ {
+ XNextEvent (dpy, &rp_current_event);
+ delegate_event (&rp_current_event);
+ XSync(dpy, False);
+ }
}
}
-
diff --git a/src/events.h b/src/events.h
index ce1d61b..838249b 100644
--- a/src/events.h
+++ b/src/events.h
@@ -7,12 +7,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* ratpoison is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
diff --git a/src/format.c b/src/format.c
index bbe463c..a70d6fc 100644
--- a/src/format.c
+++ b/src/format.c
@@ -105,56 +105,56 @@ format_string (char *fmt, rp_window_elem *win_elem, struct sbuf *buffer)
for(; *fmt; fmt++)
{
if (*fmt == '%' && state == STATE_READ)
- {
- state = STATE_ESCAPE;
- continue;
- }
+ {
+ state = STATE_ESCAPE;
+ continue;
+ }
if ((state == STATE_ESCAPE || state == STATE_NUMBER) && isdigit(*fmt))
- {
- /* Accumulate the width one digit at a time. */
- if (state == STATE_ESCAPE)
- width = 0;
- width *= 10;
- width += *fmt - '0';
- state = STATE_NUMBER;
- continue;
- }
+ {
+ /* Accumulate the width one digit at a time. */
+ if (state == STATE_ESCAPE)
+ width = 0;
+ width *= 10;
+ width += *fmt - '0';
+ state = STATE_NUMBER;
+ continue;
+ }
found = 0;
if (state == STATE_ESCAPE || state == STATE_NUMBER)
- {
- if (*fmt == '%')
- sbuf_concat (buffer, "%");
- else
- {
- for (fip = 0; fmt_items[fip].fmt_char; fip++)
- {
- if (fmt_items[fip].fmt_char == *fmt)
- {
- sbuf_clear (retbuf);
- fmt_items[fip].fmt_fn(win_elem, retbuf);
- concat_width (buffer, sbuf_get (retbuf), width);
- found = 1;
- break;
- }
- }
- if (!found)
- {
- sbuf_printf_concat (buffer, "%%%c", *fmt);
- break;
- }
- }
- state = STATE_READ;
- width = -1;
- }
+ {
+ if (*fmt == '%')
+ sbuf_concat (buffer, "%");
+ else
+ {
+ for (fip = 0; fmt_items[fip].fmt_char; fip++)
+ {
+ if (fmt_items[fip].fmt_char == *fmt)
+ {
+ sbuf_clear (retbuf);
+ fmt_items[fip].fmt_fn(win_elem, retbuf);
+ concat_width (buffer, sbuf_get (retbuf), width);
+ found = 1;
+ break;
+ }
+ }
+ if (!found)
+ {
+ sbuf_printf_concat (buffer, "%%%c", *fmt);
+ break;
+ }
+ }
+ state = STATE_READ;
+ width = -1;
+ }
else
- {
- /* Insert the character. */
- dbuf[0] = *fmt;
- dbuf[1] = 0;
- sbuf_concat (buffer, dbuf);
- }
+ {
+ /* Insert the character. */
+ dbuf[0] = *fmt;
+ dbuf[1] = 0;
+ sbuf_concat (buffer, dbuf);
+ }
}
sbuf_free (retbuf);
#undef STATE_READ
diff --git a/src/frame.c b/src/frame.c
index 2d6c4f3..d101588 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -7,12 +7,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* ratpoison is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
@@ -171,15 +171,15 @@ frame_dump (rp_frame *frame)
win = find_window_number (frame->win_number);
s = sbuf_new (0);
- sbuf_printf (s, "(frame :number %d :x %d :y %d :width %d :height %d :window %ld :last-access %d :dedicated %d)",
- frame->number,
- frame->x,
- frame->y,
- frame->width,
- frame->height,
- win ? win->w:0,
- frame->last_access,
- frame->dedicated);
+ sbuf_printf (s, "(frame :number %d :x %d :y %d :width %d :height %d :window %ld :last-access %d :dedicated %d)",
+ frame->number,
+ frame->x,
+ frame->y,
+ frame->width,
+ frame->height,
+ win ? win->w:0,
+ frame->last_access,
+ frame->dedicated);
/* Extract the string and return it, and don't forget to free s. */
tmp = sbuf_get (s);
@@ -203,7 +203,7 @@ frame_read (char *str)
init_frame(f);
PRINT_DEBUG(("parsing '%s'\n", str));
-
+
dup = xstrdup(str);
tmp = strtok (dup, " ");
@@ -220,25 +220,25 @@ frame_read (char *str)
while (tmp)
{
if (!strcmp(tmp, ":number"))
- read_slot(f->number);
+ read_slot(f->number);
else if (!strcmp(tmp, ":x"))
- read_slot(f->x);
+ read_slot(f->x);
else if (!strcmp(tmp, ":y"))
- read_slot(f->y);
+ read_slot(f->y);
else if (!strcmp(tmp, ":width"))
- read_slot(f->width);
+ read_slot(f->width);
else if (!strcmp(tmp, ":height"))
- read_slot(f->height);
+ read_slot(f->height);
else if (!strcmp(tmp, ":window"))
- read_slot(w);
+ read_slot(w);
else if (!strcmp(tmp, ":last-access"))
- read_slot(f->last_access);
+ read_slot(f->last_access);
else if (!strcmp(tmp, ":dedicated"))
- read_slot(f->dedicated);
+ read_slot(f->dedicated);
else if (!strcmp(tmp, ")"))
- break;
+ break;
else
- PRINT_ERROR(("Unknown slot %s\n", tmp));
+ PRINT_ERROR(("Unknown slot %s\n", tmp));
/* Read the next token. */
tmp = strtok(NULL, " ");
}
diff --git a/src/frame.h b/src/frame.h
index 44c67e3..b228c4d 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* ratpoison is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
diff --git a/src/getopt.c b/src/getopt.c
index b81fc0d..d5c40f1 100644
--- a/src/getopt.c
+++ b/src/getopt.c
@@ -4,7 +4,7 @@
before changing it!
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97
- Free Software Foundation, Inc.
+ Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
@@ -70,12 +70,12 @@
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
-#ifdef __GNU_LIBRARY__
+#ifdef __GNU_LIBRARY__
/* Don't include stdlib.h for non-GNU C libraries because some of them
contain conflicting prototypes for getopt. */
#include <stdlib.h>
#include <unistd.h>
-#endif /* GNU C library. */
+#endif /* GNU C library. */
#ifdef VMS
#include <unixlib.h>
@@ -89,9 +89,9 @@
When compiling libc, the _ macro is predefined. */
#ifdef HAVE_LIBINTL_H
# include <libintl.h>
-# define _(msgid) gettext (msgid)
+# define _(msgid) gettext (msgid)
#else
-# define _(msgid) (msgid)
+# define _(msgid) (msgid)
#endif
#endif
@@ -197,13 +197,13 @@ static enum
/* Value of POSIXLY_CORRECT environment variable. */
static char *posixly_correct;
-#ifdef __GNU_LIBRARY__
+#ifdef __GNU_LIBRARY__
/* We want to avoid inclusion of string.h with non-GNU libraries
because there are many ways it can cause trouble.
On some systems, it contains special magic macros that don't work
in GCC. */
#include <string.h>
-#define my_index strchr
+#define my_index strchr
#else
/* Avoid depending on library functions or files
@@ -219,7 +219,7 @@ my_index (str, chr)
while (*str)
{
if (*str == chr)
- return (char *) str;
+ return (char *) str;
str++;
}
return 0;
@@ -278,15 +278,15 @@ text_set_element (__libc_subinit, store_args_and_env);
# endif /* text_set_element */
# define SWAP_FLAGS(ch1, ch2) \
- if (nonoption_flags_len > 0) \
- { \
- char __tmp = __getopt_nonoption_flags[ch1]; \
- __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \
- __getopt_nonoption_flags[ch2] = __tmp; \
+ if (nonoption_flags_len > 0) \
+ { \
+ char __tmp = __getopt_nonoption_flags[ch1]; \
+ __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \
+ __getopt_nonoption_flags[ch2] = __tmp; \
}
-#else /* !_LIBC */
+#else /* !_LIBC */
# define SWAP_FLAGS(ch1, ch2)
-#endif /* _LIBC */
+#endif /* _LIBC */
/* Exchange two adjacent subsequences of ARGV.
One subsequence is elements [first_nonopt,last_nonopt)
@@ -322,57 +322,57 @@ exchange (argv)
if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len)
{
/* We must extend the array. The user plays games with us and
- presents new arguments. */
+ presents new arguments. */
char *new_str = malloc (top + 1);
if (new_str == NULL)
- nonoption_flags_len = nonoption_flags_max_len = 0;
+ nonoption_flags_len = nonoption_flags_max_len = 0;
else
- {
- memset (__mempcpy (new_str, __getopt_nonoption_flags,
- nonoption_flags_max_len),
- '\0', top + 1 - nonoption_flags_max_len);
- nonoption_flags_max_len = top + 1;
- __getopt_nonoption_flags = new_str;
- }
+ {
+ memset (__mempcpy (new_str, __getopt_nonoption_flags,
+ nonoption_flags_max_len),
+ '\0', top + 1 - nonoption_flags_max_len);
+ nonoption_flags_max_len = top + 1;
+ __getopt_nonoption_flags = new_str;
+ }
}
#endif
while (top > middle && middle > bottom)
{
if (top - middle > middle - bottom)
- {
- /* Bottom segment is the short one. */
- int len = middle - bottom;
- register int i;
-
- /* Swap it with the top part of the top segment. */
- for (i = 0; i < len; i++)
- {
- tem = argv[bottom + i];
- argv[bottom + i] = argv[top - (middle - bottom) + i];
- argv[top - (middle - bottom) + i] = tem;
- SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
- }
- /* Exclude the moved bottom segment from further swapping. */
- top -= len;
- }
+ {
+ /* Bottom segment is the short one. */
+ int len = middle - bottom;
+ register int i;
+
+ /* Swap it with the top part of the top segment. */
+ for (i = 0; i < len; i++)
+ {
+ tem = argv[bottom + i];
+ argv[bottom + i] = argv[top - (middle - bottom) + i];
+ argv[top - (middle - bottom) + i] = tem;
+ SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
+ }
+ /* Exclude the moved bottom segment from further swapping. */
+ top -= len;
+ }
else
- {
- /* Top segment is the short one. */
- int len = top - middle;
- register int i;
-
- /* Swap it with the bottom part of the bottom segment. */
- for (i = 0; i < len; i++)
- {
- tem = argv[bottom + i];
- argv[bottom + i] = argv[middle + i];
- argv[middle + i] = tem;
- SWAP_FLAGS (bottom + i, middle + i);
- }
- /* Exclude the moved top segment from further swapping. */
- bottom += len;
- }
+ {
+ /* Top segment is the short one. */
+ int len = top - middle;
+ register int i;
+
+ /* Swap it with the bottom part of the bottom segment. */
+ for (i = 0; i < len; i++)
+ {
+ tem = argv[bottom + i];
+ argv[bottom + i] = argv[middle + i];
+ argv[middle + i] = tem;
+ SWAP_FLAGS (bottom + i, middle + i);
+ }
+ /* Exclude the moved top segment from further swapping. */
+ bottom += len;
+ }
}
/* Update records for the slots the non-options now occupy. */
@@ -424,25 +424,25 @@ _getopt_initialize (argc, argv, optstring)
&& argc == original_argc && argv == original_argv)
{
if (nonoption_flags_max_len == 0)
- {
- if (__getopt_nonoption_flags == NULL
- || __getopt_nonoption_flags[0] == '\0')
- nonoption_flags_max_len = -1;
- else
- {
- const char *orig_str = __getopt_nonoption_flags;
- int len = nonoption_flags_max_len = strlen (orig_str);
- if (nonoption_flags_max_len < argc)
- nonoption_flags_max_len = argc;
- __getopt_nonoption_flags =
- (char *) malloc (nonoption_flags_max_len);
- if (__getopt_nonoption_flags == NULL)
- nonoption_flags_max_len = -1;
- else
- memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
- '\0', nonoption_flags_max_len - len);
- }
- }
+ {
+ if (__getopt_nonoption_flags == NULL
+ || __getopt_nonoption_flags[0] == '\0')
+ nonoption_flags_max_len = -1;
+ else
+ {
+ const char *orig_str = __getopt_nonoption_flags;
+ int len = nonoption_flags_max_len = strlen (orig_str);
+ if (nonoption_flags_max_len < argc)
+ nonoption_flags_max_len = argc;
+ __getopt_nonoption_flags =
+ (char *) malloc (nonoption_flags_max_len);
+ if (__getopt_nonoption_flags == NULL)
+ nonoption_flags_max_len = -1;
+ else
+ memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
+ '\0', nonoption_flags_max_len - len);
+ }
+ }
nonoption_flags_len = nonoption_flags_max_len;
}
else
@@ -522,7 +522,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
if (optind == 0 || !__getopt_initialized)
{
if (optind == 0)
- optind = 1; /* Don't scan ARGV[0], the program name. */
+ optind = 1; /* Don't scan ARGV[0], the program name. */
optstring = _getopt_initialize (argc, argv, optstring);
__getopt_initialized = 1;
}
@@ -532,9 +532,9 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
from the shell indicating it is not an option. The later information
is only used when the used in the GNU libc. */
#ifdef _LIBC
-#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
- || (optind < nonoption_flags_len \
- && __getopt_nonoption_flags[optind] == '1'))
+#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
+ || (optind < nonoption_flags_len \
+ && __getopt_nonoption_flags[optind] == '1'))
#else
#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
#endif
@@ -544,76 +544,76 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
/* Advance to the next ARGV-element. */
/* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
- moved back by the user (who may also have changed the arguments). */
+ moved back by the user (who may also have changed the arguments). */
if (last_nonopt > optind)
- last_nonopt = optind;
+ last_nonopt = optind;
if (first_nonopt > optind)
- first_nonopt = optind;
+ first_nonopt = optind;
if (ordering == PERMUTE)
- {
- /* If we have just processed some options following some non-options,
- exchange them so that the options come first. */
+ {
+ /* If we have just processed some options following some non-options,
+ exchange them so that the options come first. */
- if (first_nonopt != last_nonopt && last_nonopt != optind)
- exchange ((char **) argv);
- else if (last_nonopt != optind)
- first_nonopt = optind;
+ if (first_nonopt != last_nonopt && last_nonopt != optind)
+ exchange ((char **) argv);
+ else if (last_nonopt != optind)
+ first_nonopt = optind;
- /* Skip any additional non-options
- and extend the range of non-options previously skipped. */
+ /* Skip any additional non-options
+ and extend the range of non-options previously skipped. */
- while (optind < argc && NONOPTION_P)
- optind++;
- last_nonopt = optind;
- }
+ while (optind < argc && NONOPTION_P)
+ optind++;
+ last_nonopt = optind;
+ }
/* The special ARGV-element `--' means premature end of options.
- Skip it like a null option,
- then exchange with previous non-options as if it were an option,
- then skip everything else like a non-option. */
+ Skip it like a null option,
+ then exchange with previous non-options as if it were an option,
+ then skip everything else like a non-option. */
if (optind != argc && !strcmp (argv[optind], "--"))
- {
- optind++;
+ {
+ optind++;
- if (first_nonopt != last_nonopt && last_nonopt != optind)
- exchange ((char **) argv);
- else if (first_nonopt == last_nonopt)
- first_nonopt = optind;
- last_nonopt = argc;
+ if (first_nonopt != last_nonopt && last_nonopt != optind)
+ exchange ((char **) argv);
+ else if (first_nonopt == last_nonopt)
+ first_nonopt = optind;
+ last_nonopt = argc;
- optind = argc;
- }
+ optind = argc;
+ }
/* If we have done all the ARGV-elements, stop the scan
- and back over any non-options that we skipped and permuted. */
+ and back over any non-options that we skipped and permuted. */
if (optind == argc)
- {
- /* Set the next-arg-index to point at the non-options
- that we previously skipped, so the caller will digest them. */
- if (first_nonopt != last_nonopt)
- optind = first_nonopt;
- return -1;
- }
+ {
+ /* Set the next-arg-index to point at the non-options
+ that we previously skipped, so the caller will digest them. */
+ if (first_nonopt != last_nonopt)
+ optind = first_nonopt;
+ return -1;
+ }
/* If we have come to a non-option and did not permute it,
- either stop the scan or describe it to the caller and pass it by. */
+ either stop the scan or describe it to the caller and pass it by. */
if (NONOPTION_P)
- {
- if (ordering == REQUIRE_ORDER)
- return -1;
- optarg = argv[optind++];
- return 1;
- }
+ {
+ if (ordering == REQUIRE_ORDER)
+ return -1;
+ optarg = argv[optind++];
+ return 1;
+ }
/* We have found another option-ARGV-element.
- Skip the initial punctuation. */
+ Skip the initial punctuation. */
nextchar = (argv[optind] + 1
- + (longopts != NULL && argv[optind][1] == '-'));
+ + (longopts != NULL && argv[optind][1] == '-'));
}
/* Decode the current option-ARGV-element. */
@@ -633,7 +633,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
if (longopts != NULL
&& (argv[optind][1] == '-'
- || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
+ || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
{
char *nameend;
const struct option *p;
@@ -644,124 +644,124 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
int option_index;
for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
- /* Do nothing. */ ;
+ /* Do nothing. */ ;
/* Test all long options for either exact match
- or abbreviated matches. */
+ or abbreviated matches. */
for (p = longopts, option_index = 0; p->name; p++, option_index++)
- if (!strncmp (p->name, nextchar, nameend - nextchar))
- {
- if ((unsigned int) (nameend - nextchar)
- == (unsigned int) strlen (p->name))
- {
- /* Exact match found. */
- pfound = p;
- indfound = option_index;
- exact = 1;
- break;
- }
- else if (pfound == NULL)
- {
- /* First nonexact match found. */
- pfound = p;
- indfound = option_index;
- }
- else
- /* Second or later nonexact match found. */
- ambig = 1;
- }
+ if (!strncmp (p->name, nextchar, nameend - nextchar))
+ {
+ if ((unsigned int) (nameend - nextchar)
+ == (unsigned int) strlen (p->name))
+ {
+ /* Exact match found. */
+ pfound = p;
+ indfound = option_index;
+ exact = 1;
+ break;
+ }
+ else if (pfound == NULL)
+ {
+ /* First nonexact match found. */
+ pfound = p;
+ indfound = option_index;
+ }
+ else
+ /* Second or later nonexact match found. */
+ ambig = 1;
+ }
if (ambig && !exact)
- {
- if (opterr)
- fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
- argv[0], argv[optind]);
- nextchar += strlen (nextchar);
- optind++;
- optopt = 0;
- return '?';
- }
+ {
+ if (opterr)
+ fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
+ argv[0], argv[optind]);
+ nextchar += strlen (nextchar);
+ optind++;
+ optopt = 0;
+ return '?';
+ }
if (pfound != NULL)
- {
- option_index = indfound;
- optind++;
- if (*nameend)
- {
- /* Don't test has_arg with >, because some C compilers don't
- allow it to be used on enums. */
- if (pfound->has_arg)
- optarg = nameend + 1;
- else
- {
- if (opterr)
- {
- if (argv[optind - 1][1] == '-')
- /* --option */
- fprintf (stderr,
- _("%s: option `--%s' doesn't allow an argument\n"),
- argv[0], pfound->name);
- else
- /* +option or -option */
- fprintf (stderr,
- _("%s: option `%c%s' doesn't allow an argument\n"),
- argv[0], argv[optind - 1][0], pfound->name);
- }
- nextchar += strlen (nextchar);
-
- optopt = pfound->val;
- return '?';
- }
- }
- else if (pfound->has_arg == 1)
- {
- if (optind < argc)
- optarg = argv[optind++];
- else
- {
- if (opterr)
- fprintf (stderr,
- _("%s: option `%s' requires an argument\n"),
- argv[0], argv[optind - 1]);
- nextchar += strlen (nextchar);
- optopt = pfound->val;
- return optstring[0] == ':' ? ':' : '?';
- }
- }
- nextchar += strlen (nextchar);
- if (longind != NULL)
- *longind = option_index;
- if (pfound->flag)
- {
- *(pfound->flag) = pfound->val;
- return 0;
- }
- return pfound->val;
- }
+ {
+ option_index = indfound;
+ optind++;
+ if (*nameend)
+ {
+ /* Don't test has_arg with >, because some C compilers don't
+ allow it to be used on enums. */
+ if (pfound->has_arg)
+ optarg = nameend + 1;
+ else
+ {
+ if (opterr)
+ {
+ if (argv[optind - 1][1] == '-')
+ /* --option */
+ fprintf (stderr,
+ _("%s: option `--%s' doesn't allow an argument\n"),
+ argv[0], pfound->name);
+ else
+ /* +option or -option */
+ fprintf (stderr,
+ _("%s: option `%c%s' doesn't allow an argument\n"),
+ argv[0], argv[optind - 1][0], pfound->name);
+ }
+ nextchar += strlen (nextchar);
+
+ optopt = pfound->val;
+ return '?';
+ }
+ }
+ else if (pfound->has_arg == 1)
+ {
+ if (optind < argc)
+ optarg = argv[optind++];
+ else
+ {
+ if (opterr)
+ fprintf (stderr,
+ _("%s: option `%s' requires an argument\n"),
+ argv[0], argv[optind - 1]);
+ nextchar += strlen (nextchar);
+ optopt = pfound->val;
+ return optstring[0] == ':' ? ':' : '?';
+ }
+ }
+ nextchar += strlen (nextchar);
+ if (longind != NULL)
+ *longind = option_index;
+ if (pfound->flag)
+ {
+ *(pfound->flag) = pfound->val;
+ return 0;
+ }
+ return pfound->val;
+ }
/* Can't find it as a long option. If this is not getopt_long_only,
- or the option starts with '--' or is not a valid short
- option, then it's an error.
- Otherwise interpret it as a short option. */
+ or the option starts with '--' or is not a valid short
+ option, then it's an error.
+ Otherwise interpret it as a short option. */
if (!long_only || argv[optind][1] == '-'
- || my_index (optstring, *nextchar) == NULL)
- {
- if (opterr)
- {
- if (argv[optind][1] == '-')
- /* --option */
- fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
- argv[0], nextchar);
- else
- /* +option or -option */
- fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
- argv[0], argv[optind][0], nextchar);
- }
- nextchar = (char *) "";
- optind++;
- optopt = 0;
- return '?';
- }
+ || my_index (optstring, *nextchar) == NULL)
+ {
+ if (opterr)
+ {
+ if (argv[optind][1] == '-')
+ /* --option */
+ fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
+ argv[0], nextchar);
+ else
+ /* +option or -option */
+ fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
+ argv[0], argv[optind][0], nextchar);
+ }
+ nextchar = (char *) "";
+ optind++;
+ optopt = 0;
+ return '?';
+ }
}
/* Look at and handle the next short option-character. */
@@ -776,188 +776,188 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
if (temp == NULL || c == ':')
{
- if (opterr)
- {
- if (posixly_correct)
- /* 1003.2 specifies the format of this message. */
- fprintf (stderr, _("%s: illegal option -- %c\n"),
- argv[0], c);
- else
- fprintf (stderr, _("%s: invalid option -- %c\n"),
- argv[0], c);
- }
- optopt = c;
- return '?';
+ if (opterr)
+ {
+ if (posixly_correct)
+ /* 1003.2 specifies the format of this message. */
+ fprintf (stderr, _("%s: illegal option -- %c\n"),
+ argv[0], c);
+ else
+ fprintf (stderr, _("%s: invalid option -- %c\n"),
+ argv[0], c);
+ }
+ optopt = c;
+ return '?';
}
/* Convenience. Treat POSIX -W foo same as long option --foo */
if (temp[0] == 'W' && temp[1] == ';')
{
- char *nameend;
- const struct option *p;
- const struct option *pfound = NULL;
- int exact = 0;
- int ambig = 0;
- int indfound = 0;
- int option_index;
-
- /* This is an option that requires an argument. */
- if (*nextchar != '\0')
- {
- optarg = nextchar;
- /* If we end this ARGV-element by taking the rest as an arg,
- we must advance to the next element now. */
- optind++;
- }
- else if (optind == argc)
- {
- if (opterr)
- {
- /* 1003.2 specifies the format of this message. */
- fprintf (stderr, _("%s: option requires an argument -- %c\n"),
- argv[0], c);
- }
- optopt = c;
- if (optstring[0] == ':')
- c = ':';
- else
- c = '?';
- return c;
- }
- else
- /* We already incremented `optind' once;
- increment it again when taking next ARGV-elt as argument. */
- optarg = argv[optind++];
-
- /* optarg is now the argument, see if it's in the
- table of longopts. */
-
- for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++)
- /* Do nothing. */ ;
-
- /* Test all long options for either exact match
- or abbreviated matches. */
- for (p = longopts, option_index = 0; p->name; p++, option_index++)
- if (!strncmp (p->name, nextchar, nameend - nextchar))
- {
- if ((unsigned int) (nameend - nextchar) == strlen (p->name))
- {
- /* Exact match found. */
- pfound = p;
- indfound = option_index;
- exact = 1;
- break;
- }
- else if (pfound == NULL)
- {
- /* First nonexact match found. */
- pfound = p;
- indfound = option_index;
- }
- else
- /* Second or later nonexact match found. */
- ambig = 1;
- }
- if (ambig && !exact)
- {
- if (opterr)
- fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
- argv[0], argv[optind]);
- nextchar += strlen (nextchar);
- optind++;
- return '?';
- }
- if (pfound != NULL)
- {
- option_index = indfound;
- if (*nameend)
- {
- /* Don't test has_arg with >, because some C compilers don't
- allow it to be used on enums. */
- if (pfound->has_arg)
- optarg = nameend + 1;
- else
- {
- if (opterr)
- fprintf (stderr, _("\
+ char *nameend;
+ const struct option *p;
+ const struct option *pfound = NULL;
+ int exact = 0;
+ int ambig = 0;
+ int indfound = 0;
+ int option_index;
+
+ /* This is an option that requires an argument. */
+ if (*nextchar != '\0')
+ {
+ optarg = nextchar;
+ /* If we end this ARGV-element by taking the rest as an arg,
+ we must advance to the next element now. */
+ optind++;
+ }
+ else if (optind == argc)
+ {
+ if (opterr)
+ {
+ /* 1003.2 specifies the format of this message. */
+ fprintf (stderr, _("%s: option requires an argument -- %c\n"),
+ argv[0], c);
+ }
+ optopt = c;
+ if (optstring[0] == ':')
+ c = ':';
+ else
+ c = '?';
+ return c;
+ }
+ else
+ /* We already incremented `optind' once;
+ increment it again when taking next ARGV-elt as argument. */
+ optarg = argv[optind++];
+
+ /* optarg is now the argument, see if it's in the
+ table of longopts. */
+
+ for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++)
+ /* Do nothing. */ ;
+
+ /* Test all long options for either exact match
+ or abbreviated matches. */
+ for (p = longopts, option_index = 0; p->name; p++, option_index++)
+ if (!strncmp (p->name, nextchar, nameend - nextchar))
+ {
+ if ((unsigned int) (nameend - nextchar) == strlen (p->name))
+ {
+ /* Exact match found. */
+ pfound = p;
+ indfound = option_index;
+ exact = 1;
+ break;
+ }
+ else if (pfound == NULL)
+ {
+ /* First nonexact match found. */
+ pfound = p;
+ indfound = option_index;
+ }
+ else
+ /* Second or later nonexact match found. */
+ ambig = 1;
+ }
+ if (ambig && !exact)
+ {
+ if (opterr)
+ fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
+ argv[0], argv[optind]);
+ nextchar += strlen (nextchar);
+ optind++;
+ return '?';
+ }
+ if (pfound != NULL)
+ {
+ option_index = indfound;
+ if (*nameend)
+ {
+ /* Don't test has_arg with >, because some C compilers don't
+ allow it to be used on enums. */
+ if (pfound->has_arg)
+ optarg = nameend + 1;
+ else
+ {
+ if (opterr)
+ fprintf (stderr, _("\
%s: option `-W %s' doesn't allow an argument\n"),
- argv[0], pfound->name);
-
- nextchar += strlen (nextchar);
- return '?';
- }
- }
- else if (pfound->has_arg == 1)
- {
- if (optind < argc)
- optarg = argv[optind++];
- else
- {
- if (opterr)
- fprintf (stderr,
- _("%s: option `%s' requires an argument\n"),
- argv[0], argv[optind - 1]);
- nextchar += strlen (nextchar);
- return optstring[0] == ':' ? ':' : '?';
- }
- }
- nextchar += strlen (nextchar);
- if (longind != NULL)
- *longind = option_index;
- if (pfound->flag)
- {
- *(pfound->flag) = pfound->val;
- return 0;
- }
- return pfound->val;
- }
- nextchar = NULL;
- return 'W'; /* Let the application handle it. */
+ argv[0], pfound->name);
+
+ nextchar += strlen (nextchar);
+ return '?';
+ }
+ }
+ else if (pfound->has_arg == 1)
+ {
+ if (optind < argc)
+ optarg = argv[optind++];
+ else
+ {
+ if (opterr)
+ fprintf (stderr,
+ _("%s: option `%s' requires an argument\n"),
+ argv[0], argv[optind - 1]);
+ nextchar += strlen (nextchar);
+ return optstring[0] == ':' ? ':' : '?';
+ }
+ }
+ nextchar += strlen (nextchar);
+ if (longind != NULL)
+ *longind = option_index;
+ if (pfound->flag)
+ {
+ *(pfound->flag) = pfound->val;
+ return 0;
+ }
+ return pfound->val;
+ }
+ nextchar = NULL;
+ return 'W'; /* Let the application handle it. */
}
if (temp[1] == ':')
{
- if (temp[2] == ':')
- {
- /* This is an option that accepts an argument optionally. */
- if (*nextchar != '\0')
- {
- optarg = nextchar;
- optind++;
- }
- else
- optarg = NULL;
- nextchar = NULL;
- }
- else
- {
- /* This is an option that requires an argument. */
- if (*nextchar != '\0')
- {
- optarg = nextchar;
- /* If we end this ARGV-element by taking the rest as an arg,
- we must advance to the next element now. */
- optind++;
- }
- else if (optind == argc)
- {
- if (opterr)
- {
- /* 1003.2 specifies the format of this message. */
- fprintf (stderr,
- _("%s: option requires an argument -- %c\n"),
- argv[0], c);
- }
- optopt = c;
- if (optstring[0] == ':')
- c = ':';
- else
- c = '?';
- }
- else
- /* We already incremented `optind' once;
- increment it again when taking next ARGV-elt as argument. */
- optarg = argv[optind++];
- nextchar = NULL;
- }
+ if (temp[2] == ':')
+ {
+ /* This is an option that accepts an argument optionally. */
+ if (*nextchar != '\0')
+ {
+ optarg = nextchar;
+ optind++;
+ }
+ else
+ optarg = NULL;
+ nextchar = NULL;
+ }
+ else
+ {
+ /* This is an option that requires an argument. */
+ if (*nextchar != '\0')
+ {
+ optarg = nextchar;
+ /* If we end this ARGV-element by taking the rest as an arg,
+ we must advance to the next element now. */
+ optind++;
+ }
+ else if (optind == argc)
+ {
+ if (opterr)
+ {
+ /* 1003.2 specifies the format of this message. */
+ fprintf (stderr,
+ _("%s: option requires an argument -- %c\n"),
+ argv[0], c);
+ }
+ optopt = c;
+ if (optstring[0] == ':')
+ c = ':';
+ else
+ c = '?';
+ }
+ else
+ /* We already incremented `optind' once;
+ increment it again when taking next ARGV-elt as argument. */
+ optarg = argv[optind++];
+ nextchar = NULL;
+ }
}
return c;
}
@@ -970,12 +970,12 @@ getopt (argc, argv, optstring)
const char *optstring;
{
return _getopt_internal (argc, argv, optstring,
- (const struct option *) 0,
- (int *) 0,
- 0);
+ (const struct option *) 0,
+ (int *) 0,
+ 0);
}
-#endif /* Not ELIDE_CODE. */
+#endif /* Not ELIDE_CODE. */
#ifdef TEST
@@ -996,51 +996,51 @@ main (argc, argv)
c = getopt (argc, argv, "abc:d:0123456789");
if (c == -1)
- break;
+ break;
switch (c)
- {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (digit_optind != 0 && digit_optind != this_option_optind)
- printf ("digits occur in two different argv-elements.\n");
- digit_optind = this_option_optind;
- printf ("option %c\n", c);
- break;
-
- case 'a':
- printf ("option a\n");
- break;
-
- case 'b':
- printf ("option b\n");
- break;
-
- case 'c':
- printf ("option c with value `%s'\n", optarg);
- break;
-
- case '?':
- break;
-
- default:
- printf ("?? getopt returned character code 0%o ??\n", c);
- }
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ if (digit_optind != 0 && digit_optind != this_option_optind)
+ printf ("digits occur in two different argv-elements.\n");
+ digit_optind = this_option_optind;
+ printf ("option %c\n", c);
+ break;
+
+ case 'a':
+ printf ("option a\n");
+ break;
+
+ case 'b':
+ printf ("option b\n");
+ break;
+
+ case 'c':
+ printf ("option c with value `%s'\n", optarg);
+ break;
+
+ case '?':
+ break;
+
+ default:
+ printf ("?? getopt returned character code 0%o ??\n", c);
+ }
}
if (optind < argc)
{
printf ("non-option ARGV-elements: ");
while (optind < argc)
- printf ("%s ", argv[optind++]);
+ printf ("%s ", argv[optind++]);
printf ("\n");
}
diff --git a/src/getopt.h b/src/getopt.h
index c4adc30..d0ae1c6 100644
--- a/src/getopt.h
+++ b/src/getopt.h
@@ -22,7 +22,7 @@
#ifndef _GETOPT_H
#define _GETOPT_H 1
-#ifdef __cplusplus
+#ifdef __cplusplus
extern "C" {
#endif
@@ -63,9 +63,9 @@ extern int optopt;
zero.
The field `has_arg' is:
- no_argument (or 0) if the option does not take an argument,
- required_argument (or 1) if the option requires an argument,
- optional_argument (or 2) if the option takes an optional argument.
+ no_argument (or 0) if the option does not take an argument,
+ required_argument (or 1) if the option requires an argument,
+ optional_argument (or 2) if the option takes an optional argument.
If the field `flag' is not NULL, it points to a variable that is set
to the value given in the field `val' when the option is found, but
@@ -94,9 +94,9 @@ struct option
/* Names for the values of the `has_arg' field of `struct option'. */
-#define no_argument 0
-#define required_argument 1
-#define optional_argument 2
+#define no_argument 0
+#define required_argument 1
+#define optional_argument 2
#if defined (__STDC__) && __STDC__
#ifdef __GNU_LIBRARY__
@@ -108,16 +108,16 @@ extern int getopt (int argc, char *const *argv, const char *shortopts);
extern int getopt ();
#endif /* __GNU_LIBRARY__ */
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
- const struct option *longopts, int *longind);
+ const struct option *longopts, int *longind);
extern int getopt_long_only (int argc, char *const *argv,
- const char *shortopts,
- const struct option *longopts, int *longind);
+ const char *shortopts,
+ const struct option *longopts, int *longind);
/* Internal only. Users should not call this directly. */
extern int _getopt_internal (int argc, char *const *argv,
- const char *shortopts,
- const struct option *longopts, int *longind,
- int long_only);
+ const char *shortopts,
+ const struct option *longopts, int *longind,
+ int long_only);
#else /* not __STDC__ */
extern int getopt ();
extern int getopt_long ();
@@ -126,7 +126,7 @@ extern int getopt_long_only ();
extern int _getopt_internal ();
#endif /* __STDC__ */
-#ifdef __cplusplus
+#ifdef __cplusplus
}
#endif
diff --git a/src/getopt1.c b/src/getopt1.c
index d872f65..5c1fd42 100644
--- a/src/getopt1.c
+++ b/src/getopt1.c
@@ -63,7 +63,7 @@
#include <stdlib.h>
#endif
-#ifndef NULL
+#ifndef NULL
#define NULL 0
#endif
@@ -95,7 +95,7 @@ getopt_long_only (argc, argv, options, long_options, opt_index)
}
-#endif /* Not ELIDE_CODE. */
+#endif /* Not ELIDE_CODE. */
#ifdef TEST
@@ -115,74 +115,74 @@ main (argc, argv)
int option_index = 0;
static struct option long_options[] =
{
- {"add", 1, 0, 0},
- {"append", 0, 0, 0},
- {"delete", 1, 0, 0},
- {"verbose", 0, 0, 0},
- {"create", 0, 0, 0},
- {"file", 1, 0, 0},
- {0, 0, 0, 0}
+ {"add", 1, 0, 0},
+ {"append", 0, 0, 0},
+ {"delete", 1, 0, 0},
+ {"verbose", 0, 0, 0},
+ {"create", 0, 0, 0},
+ {"file", 1, 0, 0},
+ {0, 0, 0, 0}
};
c = getopt_long (argc, argv, "abc:d:0123456789",
- long_options, &option_index);
+ long_options, &option_index);
if (c == -1)
- break;
+ break;
switch (c)
- {
- case 0:
- printf ("option %s", long_options[option_index].name);
- if (optarg)
- printf (" with arg %s", optarg);
- printf ("\n");
- break;
-
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (digit_optind != 0 && digit_optind != this_option_optind)
- printf ("digits occur in two different argv-elements.\n");
- digit_optind = this_option_optind;
- printf ("option %c\n", c);
- break;
-
- case 'a':
- printf ("option a\n");
- break;
-
- case 'b':
- printf ("option b\n");
- break;
-
- case 'c':
- printf ("option c with value `%s'\n", optarg);
- break;
-
- case 'd':
- printf ("option d with value `%s'\n", optarg);
- break;
-
- case '?':
- break;
-
- default:
- printf ("?? getopt returned character code 0%o ??\n", c);
- }
+ {
+ case 0:
+ printf ("option %s", long_options[option_index].name);
+ if (optarg)
+ printf (" with arg %s", optarg);
+ printf ("\n");
+ break;
+
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ if (digit_optind != 0 && digit_optind != this_option_optind)
+ printf ("digits occur in two different argv-elements.\n");
+ digit_optind = this_option_optind;
+ printf ("option %c\n", c);
+ break;
+
+ case 'a':
+ printf ("option a\n");
+ break;
+
+ case 'b':
+ printf ("option b\n");
+ break;
+
+ case 'c':
+ printf ("option c with value `%s'\n", optarg);
+ break;
+
+ case 'd':
+ printf ("option d with value `%s'\n", optarg);
+ break;
+
+ case '?':
+ break;
+
+ default:
+ printf ("?? getopt returned character code 0%o ??\n", c);
+ }
}
if (optind < argc)
{
printf ("non-option ARGV-elements: ");
while (optind < argc)
- printf ("%s ", argv[optind++]);
+ printf ("%s ", argv[optind++]);
printf ("\n");
}
diff --git a/src/globals.c b/src/globals.c
index b7306a6..e9755dd 100644
--- a/src/globals.c
+++ b/src/globals.c
@@ -20,7 +20,7 @@
#include "ratpoison.h"
-#include <unistd.h> /* for usleep(). */
+#include <unistd.h> /* for usleep(). */
int alarm_signalled = 0;
int kill_signalled = 0;
@@ -28,7 +28,7 @@ int hup_signalled = 0;
int chld_signalled = 0;
int rat_x;
int rat_y;
-int rat_visible = 1; /* rat is visible by default */
+int rat_visible = 1; /* rat is visible by default */
char *rp_exec_newwm = NULL;
@@ -89,7 +89,7 @@ x_export_selection ()
if (XGetSelectionOwner(dpy, XA_PRIMARY) != screens[0].key_window)
PRINT_ERROR(("can't get primary selection"));
XChangeProperty(dpy, screens[0].root, XA_CUT_BUFFER0, XA_STRING, 8,
- PropModeReplace, selection.text, selection.len);
+ PropModeReplace, selection.text, selection.len);
}
void
@@ -119,7 +119,7 @@ set_selection (char *txt)
free(selection.text);
selection.text = xstrdup (txt);
selection.len = strlen (txt);
-
+
x_export_selection();
}
@@ -155,9 +155,9 @@ get_primary_selection()
for (nread = 0, bytes_after = 1; bytes_after > 0; nread += ct.nitems) {
if ((XGetWindowProperty(dpy, current_screen()->input_window, rp_selection, (nread / 4), 4096,
- True, AnyPropertyType, &ct.encoding,
- &ct.format, &ct.nitems, &bytes_after,
- &ct.value) != Success)) {
+ True, AnyPropertyType, &ct.encoding,
+ &ct.format, &ct.nitems, &bytes_after,
+ &ct.value) != Success)) {
XFree(ct.value);
sbuf_free(s);
return NULL;
@@ -194,24 +194,24 @@ get_selection ()
/* This seems like a hack. */
while (!XCheckTypedWindowEvent (dpy, s->input_window, SelectionNotify, &ev))
- {
- if (loops == 0)
- {
- PRINT_ERROR (("selection request timed out\n"));
- return NULL;
- }
- usleep (10000);
- loops--;
- }
+ {
+ if (loops == 0)
+ {
+ PRINT_ERROR (("selection request timed out\n"));
+ return NULL;
+ }
+ usleep (10000);
+ loops--;
+ }
PRINT_DEBUG (("SelectionNotify event\n"));
property = ev.xselection.property;
if (property != None)
- return get_primary_selection ();
+ return get_primary_selection ();
else
- return get_cut_buffer ();
+ return get_cut_buffer ();
}
}
@@ -225,30 +225,30 @@ LIST_HEAD (rp_quit_hook);
LIST_HEAD (rp_restart_hook);
LIST_HEAD (rp_delete_window_hook);
-struct rp_hook_db_entry rp_hook_db[]=
- {{"key", &rp_key_hook},
- {"switchwin", &rp_switch_win_hook},
- {"switchframe", &rp_switch_frame_hook},
- {"switchgroup", &rp_switch_group_hook},
- {"deletewindow", &rp_delete_window_hook},
- {"quit", &rp_quit_hook},
- {"restart", &rp_restart_hook},
+struct rp_hook_db_entry rp_hook_db[]=
+ {{"key", &rp_key_hook},
+ {"switchwin", &rp_switch_win_hook},
+ {"switchframe", &rp_switch_frame_hook},
+ {"switchgroup", &rp_switch_group_hook},
+ {"deletewindow", &rp_delete_window_hook},
+ {"quit", &rp_quit_hook},
+ {"restart", &rp_restart_hook},
{NULL, NULL}};
void
set_rp_window_focus (rp_window *win)
{
PRINT_DEBUG (("Giving focus to '%s'\n", window_name (win)));
- XSetInputFocus (dpy, win->w,
- RevertToPointerRoot, CurrentTime);
+ XSetInputFocus (dpy, win->w,
+ RevertToPointerRoot, CurrentTime);
}
void
set_window_focus (Window window)
{
PRINT_DEBUG (("Giving focus to %ld\n", window));
- XSetInputFocus (dpy, window,
- RevertToPointerRoot, CurrentTime);
+ XSetInputFocus (dpy, window,
+ RevertToPointerRoot, CurrentTime);
}
LIST_HEAD (rp_frame_undos);
diff --git a/src/globals.h b/src/globals.h
index 080d31d..59561dc 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -37,17 +37,17 @@
#define EMPTY -1
/* Possible values for defaults.window_list_style */
-#define STYLE_ROW 0
+#define STYLE_ROW 0
#define STYLE_COLUMN 1
/* Possible values for defaults.win_name */
-#define WIN_NAME_TITLE 0
-#define WIN_NAME_RES_CLASS 1
-#define WIN_NAME_RES_NAME 2
+#define WIN_NAME_TITLE 0
+#define WIN_NAME_RES_CLASS 1
+#define WIN_NAME_RES_NAME 2
/* Possible directions to traverse the completions list. */
-#define COMPLETION_NEXT 0
-#define COMPLETION_PREVIOUS 1
+#define COMPLETION_NEXT 0
+#define COMPLETION_PREVIOUS 1
/* Error codes for group_delete_group() */
#define GROUP_DELETE_GROUP_OK 0
diff --git a/src/group.c b/src/group.c
index 759f5c9..5f2a3fd 100644
--- a/src/group.c
+++ b/src/group.c
@@ -66,7 +66,7 @@ group_new (int number, char *name)
g->numset = numset_new();
INIT_LIST_HEAD (&g->unmapped_windows);
INIT_LIST_HEAD (&g->mapped_windows);
-
+
return g;
}
@@ -111,10 +111,10 @@ groups_find_group_by_name (char *s)
list_for_each_entry (cur, &rp_groups, node)
{
if (cur->name)
- {
- if (str_comp (s, cur->name, strlen (s)))
- return cur;
- }
+ {
+ if (str_comp (s, cur->name, strlen (s)))
+ return cur;
+ }
}
return NULL;
@@ -128,7 +128,7 @@ groups_find_group_by_number (int n)
list_for_each_entry (cur, &rp_groups, node)
{
if (cur->number == n)
- return cur;
+ return cur;
}
return NULL;
@@ -145,7 +145,7 @@ groups_find_group_by_window (rp_window *win)
{
elem = group_find_window (&cur->mapped_windows, win);
if (elem)
- return cur;
+ return cur;
}
return NULL;
@@ -161,7 +161,7 @@ groups_find_group_by_group (rp_group *g)
list_for_each_entry (cur, &rp_groups, node)
{
if (cur == g)
- return cur;
+ return cur;
}
return NULL;
@@ -175,7 +175,7 @@ group_find_window (struct list_head *list, rp_window *win)
list_for_each_entry (cur, list, node)
{
if (cur->win == win)
- return cur;
+ return cur;
}
return NULL;
@@ -189,11 +189,11 @@ group_find_window_by_number (rp_group *g, int num)
list_for_each_entry (cur, &g->mapped_windows, node)
{
if (cur->number == num)
- return cur;
+ return cur;
}
return NULL;
-
+
}
@@ -207,10 +207,10 @@ group_insert_window (struct list_head *h, rp_window_elem *w)
list_for_each_entry (cur, h, node)
{
if (cur->number > w->number)
- {
- list_add_tail (&w->node, &cur->node);
- return;
- }
+ {
+ list_add_tail (&w->node, &cur->node);
+ return;
+ }
}
list_add_tail(&w->node, h);
@@ -224,7 +224,7 @@ group_in_list (struct list_head *h, rp_window_elem *w)
list_for_each_entry (cur, h, node)
{
if (cur == w)
- return 1;
+ return 1;
}
return 0;
@@ -321,10 +321,10 @@ group_del_window (rp_group *g, rp_window *win)
list_for_each_safe_entry (cur, iter, tmp, &g->unmapped_windows, node)
{
if (cur->win == win)
- {
- list_del (&cur->node);
- free (cur);
- }
+ {
+ list_del (&cur->node);
+ free (cur);
+ }
}
/* Make sure the window isn't in the list of mapped windows. This
@@ -333,7 +333,7 @@ group_del_window (rp_group *g, rp_window *win)
list_for_each_entry (cur, &g->mapped_windows, node)
{
if (cur->win == win)
- PRINT_DEBUG (("This window wasn't removed from the mapped window list.\n"));
+ PRINT_DEBUG (("This window wasn't removed from the mapped window list.\n"));
}
#endif
}
@@ -359,19 +359,19 @@ group_last_window (rp_group *g, rp_screen *s)
list_for_each_entry (cur, &g->mapped_windows, node)
{
- if (cur->win->last_access >= last_access
- && cur->win != current_window()
- && !find_windows_frame (cur->win)
- && (cur->win->scr == s || rp_have_xinerama))
- {
- most_recent = cur;
- last_access = cur->win->last_access;
- }
+ if (cur->win->last_access >= last_access
+ && cur->win != current_window()
+ && !find_windows_frame (cur->win)
+ && (cur->win->scr == s || rp_have_xinerama))
+ {
+ most_recent = cur;
+ last_access = cur->win->last_access;
+ }
}
if (most_recent)
return most_recent->win;
-
+
return NULL;
}
@@ -381,7 +381,7 @@ group_next_window (rp_group *g, rp_window *win)
rp_window_elem *cur, *we;
/* If there is no window, then get the last accessed one. */
- if (win == NULL)
+ if (win == NULL)
return group_last_window (g, current_screen());
/* If we can't find the window, then it's in a different group, so
@@ -392,14 +392,14 @@ group_next_window (rp_group *g, rp_window *win)
/* The window is in this group, so find the next one in the list
that isn't already displayed. */
- for (cur = list_next_entry (we, &g->mapped_windows, node);
- cur != we;
+ for (cur = list_next_entry (we, &g->mapped_windows, node);
+ cur != we;
cur = list_next_entry (cur, &g->mapped_windows, node))
{
if (!find_windows_frame (cur->win) && (cur->win->scr == win->scr || rp_have_xinerama))
- {
- return cur->win;
- }
+ {
+ return cur->win;
+ }
}
return NULL;
@@ -411,7 +411,7 @@ group_prev_window (rp_group *g, rp_window *win)
rp_window_elem *cur, *we;
/* If there is no window, then get the last accessed one. */
- if (win == NULL)
+ if (win == NULL)
return group_last_window (g, current_screen());
/* If we can't find the window, then it's in a different group, so
@@ -422,14 +422,14 @@ group_prev_window (rp_group *g, rp_window *win)
/* The window is in this group, so find the previous one in the list
that isn't already displayed. */
- for (cur = list_prev_entry (we, &g->mapped_windows, node);
- cur != we;
+ for (cur = list_prev_entry (we, &g->mapped_windows, node);
+ cur != we;
cur = list_prev_entry (cur, &g->mapped_windows, node))
{
if (!find_windows_frame (cur->win) && (cur->win->scr == win->scr || rp_have_xinerama))
- {
- return cur->win;
- }
+ {
+ return cur->win;
+ }
}
return NULL;
@@ -449,10 +449,10 @@ group_move_window (rp_group *to, rp_window *win)
{
we = group_find_window (&cur->mapped_windows, win);
if (we)
- {
- from = cur;
- break;
- }
+ {
+ from = cur;
+ break;
+ }
}
if (we == NULL || from == NULL)
@@ -505,7 +505,7 @@ set_current_group (rp_group *g)
return;
rp_current_group = g;
-
+
/* Call the switch group hook. */
hook_run (&rp_switch_group_hook);
}
@@ -513,26 +513,26 @@ set_current_group (rp_group *g)
int
group_delete_group (rp_group *g)
{
- if (list_empty (&(g->mapped_windows))
+ if (list_empty (&(g->mapped_windows))
&& list_empty (&(g->unmapped_windows)))
{
/* we can safely delete the group */
- if (g == rp_current_group)
- {
- rp_current_group = group_next_group ();
- }
+ if (g == rp_current_group)
+ {
+ rp_current_group = group_next_group ();
+ }
list_del (&(g->node));
group_free (g);
if (list_empty (&rp_groups))
- {
- /* Create the first group in the list (We always need at least
- one). */
- g = group_new (numset_request (group_numset), DEFAULT_GROUP_NAME);
- rp_current_group = g;
- list_add_tail (&g->node, &rp_groups);
- }
+ {
+ /* Create the first group in the list (We always need at least
+ one). */
+ g = group_new (numset_request (group_numset), DEFAULT_GROUP_NAME);
+ rp_current_group = g;
+ list_add_tail (&g->node, &rp_groups);
+ }
return GROUP_DELETE_GROUP_OK;
}
else
@@ -552,20 +552,20 @@ group_last_window_by_class (rp_group *g, char *class)
list_for_each_entry (cur, &g->mapped_windows, node)
{
- if (cur->win->last_access >= last_access
- && cur->win != current_window()
- && !find_windows_frame (cur->win)
- && (cur->win->scr == s || rp_have_xinerama)
- && strcmp(class, cur->win->res_class))
- {
- most_recent = cur;
- last_access = cur->win->last_access;
- }
+ if (cur->win->last_access >= last_access
+ && cur->win != current_window()
+ && !find_windows_frame (cur->win)
+ && (cur->win->scr == s || rp_have_xinerama)
+ && strcmp(class, cur->win->res_class))
+ {
+ most_recent = cur;
+ last_access = cur->win->last_access;
+ }
}
if (most_recent)
return most_recent->win;
-
+
return NULL;
}
@@ -580,19 +580,19 @@ group_last_window_by_class_complement (rp_group *g, char *class)
list_for_each_entry (cur, &g->mapped_windows, node)
{
- if (cur->win->last_access >= last_access
- && cur->win != current_window()
- && !find_windows_frame (cur->win)
- && (cur->win->scr == s || rp_have_xinerama)
- && !strcmp(class, cur->win->res_class))
- {
- most_recent = cur;
- last_access = cur->win->last_access;
- }
+ if (cur->win->last_access >= last_access
+ && cur->win != current_window()
+ && !find_windows_frame (cur->win)
+ && (cur->win->scr == s || rp_have_xinerama)
+ && !strcmp(class, cur->win->res_class))
+ {
+ most_recent = cur;
+ last_access = cur->win->last_access;
+ }
}
if (most_recent)
return most_recent->win;
-
+
return NULL;
}
diff --git a/src/history.c b/src/history.c
index 4f283f1..e8e513a 100644
--- a/src/history.c
+++ b/src/history.c
@@ -85,7 +85,7 @@ void
history_add (char *item)
{
HIST_ENTRY *h = history_get (history_length);
-
+
if (item == NULL || *item == '\0' || isspace (*item) || (h != NULL && !strcmp (h->line, item)))
return;
diff --git a/src/hook.c b/src/hook.c
index bbb2ce5..1b2b643 100644
--- a/src/hook.c
+++ b/src/hook.c
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* ratpoison is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
@@ -34,7 +34,7 @@ hook_add (struct list_head *hook, struct sbuf *s)
list_for_each_entry (cur, hook, node)
{
if (!strcmp (sbuf_get (cur), sbuf_get (s)))
- return;
+ return;
}
/* It's not in the list, so add it. */
@@ -51,10 +51,10 @@ hook_remove (struct list_head *hook, struct sbuf *s)
list_for_each_safe_entry (cur, iter, tmp, hook, node)
{
if (!strcmp (sbuf_get (cur), sbuf_get (s)))
- {
- list_del (&cur->node);
- sbuf_free (cur);
- }
+ {
+ list_del (&cur->node);
+ sbuf_free (cur);
+ }
}
}
@@ -77,10 +77,10 @@ hook_lookup (char *s)
for (entry = rp_hook_db; entry->name; entry++)
{
if (!strcmp (s, entry->name))
- {
- return entry->hook;
- }
+ {
+ return entry->hook;
+ }
}
-
+
return NULL;
}
diff --git a/src/hook.h b/src/hook.h
index 738bf99..da53428 100644
--- a/src/hook.h
+++ b/src/hook.h
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* ratpoison is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
diff --git a/src/input.c b/src/input.c
index df94d84..f53caff 100644
--- a/src/input.c
+++ b/src/input.c
@@ -7,12 +7,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* ratpoison is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
@@ -78,9 +78,9 @@ rp_mask_to_x11_mask (unsigned int mask)
void
update_modifier_map ()
{
- unsigned int modmasks[] =
+ unsigned int modmasks[] =
{ Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask };
- int row, col; /* The row and column in the modifier table. */
+ int row, col; /* The row and column in the modifier table. */
XModifierKeymap *mods;
rp_modifier_info.meta_mod_mask = 0;
@@ -95,56 +95,56 @@ update_modifier_map ()
for (row=3; row < 8; row++)
for (col=0; col < mods->max_keypermod; col++)
{
- KeyCode code = mods->modifiermap[(row * mods->max_keypermod) + col];
-
- if (code == 0) continue;
-
- switch (XKeycodeToKeysym(dpy, code, 0))
- {
- case XK_Meta_L:
- case XK_Meta_R:
- rp_modifier_info.meta_mod_mask |= modmasks[row - 3];
- PRINT_DEBUG (("Found Meta on %d\n",
- rp_modifier_info.meta_mod_mask));
- break;
-
- case XK_Alt_L:
- case XK_Alt_R:
- rp_modifier_info.alt_mod_mask |= modmasks[row - 3];
- PRINT_DEBUG (("Found Alt on %d\n",
- rp_modifier_info.alt_mod_mask));
- break;
-
- case XK_Super_L:
- case XK_Super_R:
- rp_modifier_info.super_mod_mask |= modmasks[row - 3];
- PRINT_DEBUG (("Found Super on %d\n",
- rp_modifier_info.super_mod_mask));
- break;
-
- case XK_Hyper_L:
- case XK_Hyper_R:
- rp_modifier_info.hyper_mod_mask |= modmasks[row - 3];
- PRINT_DEBUG (("Found Hyper on %d\n",
- rp_modifier_info.hyper_mod_mask));
- break;
-
- case XK_Num_Lock:
- rp_modifier_info.num_lock_mask |= modmasks[row - 3];
- PRINT_DEBUG (("Found NumLock on %d\n",
- rp_modifier_info.num_lock_mask));
- break;
-
- case XK_Scroll_Lock:
- rp_modifier_info.scroll_lock_mask |= modmasks[row - 3];
- PRINT_DEBUG (("Found ScrollLock on %d\n",
- rp_modifier_info.scroll_lock_mask));
- break;
- default:
- break;
- }
+ KeyCode code = mods->modifiermap[(row * mods->max_keypermod) + col];
+
+ if (code == 0) continue;
+
+ switch (XKeycodeToKeysym(dpy, code, 0))
+ {
+ case XK_Meta_L:
+ case XK_Meta_R:
+ rp_modifier_info.meta_mod_mask |= modmasks[row - 3];
+ PRINT_DEBUG (("Found Meta on %d\n",
+ rp_modifier_info.meta_mod_mask));
+ break;
+
+ case XK_Alt_L:
+ case XK_Alt_R:
+ rp_modifier_info.alt_mod_mask |= modmasks[row - 3];
+ PRINT_DEBUG (("Found Alt on %d\n",
+ rp_modifier_info.alt_mod_mask));
+ break;
+
+ case XK_Super_L:
+ case XK_Super_R:
+ rp_modifier_info.super_mod_mask |= modmasks[row - 3];
+ PRINT_DEBUG (("Found Super on %d\n",
+ rp_modifier_info.super_mod_mask));
+ break;
+
+ case XK_Hyper_L:
+ case XK_Hyper_R:
+ rp_modifier_info.hyper_mod_mask |= modmasks[row - 3];
+ PRINT_DEBUG (("Found Hyper on %d\n",
+ rp_modifier_info.hyper_mod_mask));
+ break;
+
+ case XK_Num_Lock:
+ rp_modifier_info.num_lock_mask |= modmasks[row - 3];
+ PRINT_DEBUG (("Found NumLock on %d\n",
+ rp_modifier_info.num_lock_mask));
+ break;
+
+ case XK_Scroll_Lock:
+ rp_modifier_info.scroll_lock_mask |= modmasks[row - 3];
+ PRINT_DEBUG (("Found ScrollLock on %d\n",
+ rp_modifier_info.scroll_lock_mask));
+ break;
+ default:
+ break;
+ }
}
-
+
/* Stolen from Emacs 21.0.90 - xterm.c */
/* If we couldn't find any meta keys, accept any alt keys as meta keys. */
if (! rp_modifier_info.meta_mod_mask)
@@ -189,7 +189,7 @@ grab_key (KeySym keysym, unsigned int modifiers, Window grab_window)
int i;
KeyCode keycode;
unsigned int mod;
-
+
/* Convert to a modifier mask that X Windows will understand. */
modifiers = rp_mask_to_x11_mask (modifiers);
keysym_to_keycode_mod (keysym, &keycode, &mod);
@@ -211,7 +211,7 @@ grab_key (KeySym keysym, unsigned int modifiers, Window grab_window)
for (i=0; i<8; i++)
{
XGrabKey(dpy, keycode, modifiers | mod_list[i],
- grab_window, True, GrabModeAsync, GrabModeAsync);
+ grab_window, True, GrabModeAsync, GrabModeAsync);
}
}
@@ -232,7 +232,7 @@ keysym_to_string (KeySym keysym, unsigned int modifier)
if (modifier & RP_ALT_MASK) sbuf_concat (name, "A-");
if (modifier & RP_HYPER_MASK) sbuf_concat (name, "H-");
if (modifier & RP_SUPER_MASK) sbuf_concat (name, "s-");
-
+
/* On solaris machines (perhaps other machines as well) this call
can return NULL. In this case use the "NULL" string. */
tmp = XKeysymToString (keysym);
@@ -250,7 +250,7 @@ keysym_to_string (KeySym keysym, unsigned int modifier)
/* Cooks a keycode + modifier into a keysym + modifier. This should be
used anytime meaningful key information is to be extracted from a
- KeyPress or KeyRelease event.
+ KeyPress or KeyRelease event.
returns the number of bytes in keysym_name. If you are not
interested in the keysym name pass in NULL for keysym_name and 0
@@ -261,12 +261,12 @@ cook_keycode (XKeyEvent *ev, KeySym *keysym, unsigned int *mod, char *keysym_nam
int nbytes;
int shift = 0;
KeySym lower, upper;
-
+
if (ignore_bad_mods)
{
ev->state &= ~(LockMask
- | rp_modifier_info.num_lock_mask
- | rp_modifier_info.scroll_lock_mask);
+ | rp_modifier_info.num_lock_mask
+ | rp_modifier_info.scroll_lock_mask);
}
if (len > 0) len--;
@@ -283,18 +283,18 @@ cook_keycode (XKeyEvent *ev, KeySym *keysym, unsigned int *mod, char *keysym_nam
lower = XKeycodeToKeysym (dpy, ev->keycode, 0);
upper = XKeycodeToKeysym (dpy, ev->keycode, 1);
/* If the keysym isn't affected by the shift key, then keep the
- shift modifier. */
+ shift modifier. */
if (lower == upper)
- shift = ShiftMask;
+ shift = ShiftMask;
}
*mod = ev->state;
*mod &= (rp_modifier_info.meta_mod_mask
- | rp_modifier_info.alt_mod_mask
- | rp_modifier_info.hyper_mod_mask
- | rp_modifier_info.super_mod_mask
- | ControlMask
- | shift);
+ | rp_modifier_info.alt_mod_mask
+ | rp_modifier_info.hyper_mod_mask
+ | rp_modifier_info.super_mod_mask
+ | ControlMask
+ | shift);
return nbytes;
}
@@ -319,9 +319,9 @@ read_key (KeySym *keysym, unsigned int *modifiers, char *keysym_name, int len)
static void
update_input_window (rp_screen *s, rp_input_line *line)
{
- int prompt_width = XTextWidth (defaults.font, line->prompt, strlen (line->prompt));
- int input_width = XTextWidth (defaults.font, line->buffer, line->length);
- int total_width;
+ int prompt_width = XTextWidth (defaults.font, line->prompt, strlen (line->prompt));
+ int input_width = XTextWidth (defaults.font, line->buffer, line->length);
+ int total_width;
GC lgc;
XGCValues gv;
int height;
@@ -334,35 +334,35 @@ update_input_window (rp_screen *s, rp_input_line *line)
total_width = defaults.input_window_size + prompt_width;
}
- XMoveResizeWindow (dpy, s->input_window,
- bar_x (s, total_width), bar_y (s, height), total_width,
- (FONT_HEIGHT (defaults.font) + defaults.bar_y_padding * 2));
+ XMoveResizeWindow (dpy, s->input_window,
+ bar_x (s, total_width), bar_y (s, height), total_width,
+ (FONT_HEIGHT (defaults.font) + defaults.bar_y_padding * 2));
XClearWindow (dpy, s->input_window);
XSync (dpy, False);
- XDrawString (dpy, s->input_window, s->normal_gc,
- defaults.bar_x_padding,
- defaults.bar_y_padding + defaults.font->max_bounds.ascent,
- line->prompt,
- strlen (line->prompt));
-
- XDrawString (dpy, s->input_window, s->normal_gc,
- defaults.bar_x_padding + prompt_width,
- defaults.bar_y_padding + defaults.font->max_bounds.ascent,
- line->buffer,
- line->length);
+ XDrawString (dpy, s->input_window, s->normal_gc,
+ defaults.bar_x_padding,
+ defaults.bar_y_padding + defaults.font->max_bounds.ascent,
+ line->prompt,
+ strlen (line->prompt));
+
+ XDrawString (dpy, s->input_window, s->normal_gc,
+ defaults.bar_x_padding + prompt_width,
+ defaults.bar_y_padding + defaults.font->max_bounds.ascent,
+ line->buffer,
+ line->length);
gv.function = GXxor;
gv.foreground = s->fg_color ^ s->bg_color;
lgc = XCreateGC (dpy, s->input_window, GCFunction | GCForeground, &gv);
/* Draw a cheap-o cursor - MkII */
- XFillRectangle (dpy, s->input_window, lgc,
- defaults.bar_x_padding + prompt_width + XTextWidth (defaults.font, line->buffer, line->position),
- defaults.bar_y_padding,
- XTextWidth (defaults.font, &line->buffer[line->position], 1),
- FONT_HEIGHT (defaults.font));
+ XFillRectangle (dpy, s->input_window, lgc,
+ defaults.bar_x_padding + prompt_width + XTextWidth (defaults.font, line->buffer, line->position),
+ defaults.bar_y_padding,
+ XTextWidth (defaults.font, &line->buffer[line->position], 1),
+ FONT_HEIGHT (defaults.font));
XFlush (dpy);
XFreeGC (dpy, lgc);
@@ -412,11 +412,11 @@ get_input (char *prompt, completion_fn fn)
}
char *
-get_more_input (char *prompt, char *preinput,
- completion_fn compl_fn)
+get_more_input (char *prompt, char *preinput,
+ completion_fn compl_fn)
{
/* Emacs 21 uses a 513 byte string to store the keysym name. */
- char keysym_buf[513];
+ char keysym_buf[513];
int keysym_bufsize = sizeof (keysym_buf);
int nbytes;
rp_screen *s = current_screen ();
@@ -449,18 +449,18 @@ get_more_input (char *prompt, char *preinput,
{
nbytes = read_key (&ch, &modifier, keysym_buf, keysym_bufsize);
modifier = x11_mask_to_rp_mask (modifier);
- PRINT_DEBUG (("ch = %ld, modifier = %d, keysym_buf = %s, keysym_bufsize = %d\n",
- ch, modifier, keysym_buf, keysym_bufsize));
+ PRINT_DEBUG (("ch = %ld, modifier = %d, keysym_buf = %s, keysym_bufsize = %d\n",
+ ch, modifier, keysym_buf, keysym_bufsize));
status = execute_edit_action (line, ch, modifier, keysym_buf);
if (status == EDIT_DELETE || status == EDIT_INSERT || status == EDIT_MOVE
- || status == EDIT_COMPLETE)
+ || status == EDIT_COMPLETE)
{
- /* If the text changed (and we didn't just complete
- something) then set the virgin bit. */
- if (status != EDIT_COMPLETE)
- line->compl->virgin = 1;
- /* In all cases, we need to redisplay the input string. */
+ /* If the text changed (and we didn't just complete
+ something) then set the virgin bit. */
+ if (status != EDIT_COMPLETE)
+ line->compl->virgin = 1;
+ /* In all cases, we need to redisplay the input string. */
update_input_window (s, line);
}
else if (status == EDIT_NO_OP)
@@ -487,4 +487,4 @@ get_more_input (char *prompt, char *preinput,
XUnmapWindow (dpy, s->input_window);
return final_input;
-}
+}
diff --git a/src/linkedlist.c b/src/linkedlist.c
index 51564a6..f79757b 100644
--- a/src/linkedlist.c
+++ b/src/linkedlist.c
@@ -1,4 +1,4 @@
-/* This file was taken from the Linux kernel and is
+/* This file was taken from the Linux kernel and is
* Copyright (C) 2003 Linus Torvalds
*
* Modified by Shawn Betts. Portions created by Shawn Betts are
@@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* ratpoison is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
@@ -29,15 +29,15 @@ prefetch(const void *x)
{;}
/*
- * Insert a new entry between two known consecutive entries.
+ * Insert a new entry between two known consecutive entries.
*
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
void
__list_add(struct list_head *new,
- struct list_head *prev,
- struct list_head *next)
+ struct list_head *prev,
+ struct list_head *next)
{
next->prev = new;
new->next = next;
@@ -107,7 +107,7 @@ void
list_del_init(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
- INIT_LIST_HEAD(entry);
+ INIT_LIST_HEAD(entry);
}
/**
@@ -129,7 +129,7 @@ list_move(struct list_head *list, struct list_head *head)
*/
void
list_move_tail(struct list_head *list,
- struct list_head *head)
+ struct list_head *head)
{
__list_del(list->prev, list->next);
list_add_tail(list, head);
@@ -147,7 +147,7 @@ list_empty(struct list_head *head)
void
__list_splice(struct list_head *list,
- struct list_head *head)
+ struct list_head *head)
{
struct list_head *first = list->next;
struct list_head *last = list->prev;
@@ -181,7 +181,7 @@ list_splice(struct list_head *list, struct list_head *head)
*/
void
list_splice_init(struct list_head *list,
- struct list_head *head)
+ struct list_head *head)
{
if (!list_empty(list)) {
__list_splice(list, head);
diff --git a/src/linkedlist.h b/src/linkedlist.h
index 2a60589..7f147b1 100644
--- a/src/linkedlist.h
+++ b/src/linkedlist.h
@@ -1,4 +1,4 @@
-/* This file was taken from the Linux kernel and is
+/* This file was taken from the Linux kernel and is
* Copyright (C) 2003 Linus Torvalds
*
* Modified by Shawn Betts. Portions created by Shawn Betts are
@@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* ratpoison is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
@@ -36,35 +36,35 @@
*/
struct list_head {
- struct list_head *next, *prev;
+ struct list_head *next, *prev;
};
#define LIST_HEAD_INIT(name) { &(name), &(name) }
#define LIST_HEAD(name) \
- struct list_head name = LIST_HEAD_INIT(name)
+ struct list_head name = LIST_HEAD_INIT(name)
#define INIT_LIST_HEAD(ptr) do { \
- (ptr)->next = (ptr); (ptr)->prev = (ptr); \
+ (ptr)->next = (ptr); (ptr)->prev = (ptr); \
} while (0)
/* Prototypes of C functions. */
int list_size (struct list_head *list);
void list_splice_init(struct list_head *list,
- struct list_head *head);
+ struct list_head *head);
void list_splice_init(struct list_head *list,
- struct list_head *head);
+ struct list_head *head);
void list_splice(struct list_head *list, struct list_head *head);
void __list_splice(struct list_head *list,
- struct list_head *head);
+ struct list_head *head);
int list_empty(struct list_head *head);
void list_move_tail(struct list_head *list,
- struct list_head *head);
+ struct list_head *head);
void list_move(struct list_head *list, struct list_head *head);
@@ -74,16 +74,16 @@ void __list_del(struct list_head * prev, struct list_head * next);
void list_add_tail(struct list_head *new, struct list_head *head);
void list_add(struct list_head *new, struct list_head *head);
void __list_add(struct list_head *new,
- struct list_head *prev,
- struct list_head *next);
+ struct list_head *prev,
+ struct list_head *next);
void prefetch(const void *x);
/* Return the last element in the list. */
-#define list_last(last, head, member) \
-{ \
- last = list_entry((head)->prev, typeof(*last), member); \
- if (&last->member == (head)) \
- last = NULL; \
+#define list_last(last, head, member) \
+{ \
+ last = list_entry((head)->prev, typeof(*last), member); \
+ if (&last->member == (head)) \
+ last = NULL; \
}
@@ -101,18 +101,18 @@ void prefetch(const void *x);
/**
* list_entry - get the struct for this entry
- * @ptr: the &struct list_head pointer.
- * @type: the type of the struct this is embedded in.
- * @member: the name of the list_struct within the struct.
+ * @ptr: the &struct list_head pointer.
+ * @type: the type of the struct this is embedded in.
+ * @member: the name of the list_struct within the struct.
*/
#define list_entry(ptr, type, member) \
- container_of(ptr, type, member)
+ container_of(ptr, type, member)
/**
- * __list_for_each - iterate over a list
- * @pos: the &struct list_head to use as a loop counter.
- * @head: the head for your list.
+ * __list_for_each - iterate over a list
+ * @pos: the &struct list_head to use as a loop counter.
+ * @head: the head for your list.
*
* This variant differs from list_for_each() in that it's the
* simplest possible list iteration code, no prefetching is done.
@@ -120,70 +120,70 @@ void prefetch(const void *x);
* or 1 entry) most of the time.
*/
#define list_for_each(pos, head) \
- for (pos = (head)->next; pos != (head); pos = pos->next)
+ for (pos = (head)->next; pos != (head); pos = pos->next)
/**
- * list_for_each_prev - iterate over a list backwards
- * @pos: the &struct list_head to use as a loop counter.
- * @head: the head for your list.
+ * list_for_each_prev - iterate over a list backwards
+ * @pos: the &struct list_head to use as a loop counter.
+ * @head: the head for your list.
*/
#define list_for_each_prev(pos, head) \
- for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \
- pos = pos->prev, prefetch(pos->prev))
-
+ for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \
+ pos = pos->prev, prefetch(pos->prev))
+
/**
- * list_for_each_safe - iterate over a list safe against removal of list entry
- * @pos: the &struct list_head to use as a loop counter.
- * @n: another &struct list_head to use as temporary storage
- * @head: the head for your list.
+ * list_for_each_safe - iterate over a list safe against removal of list entry
+ * @pos: the &struct list_head to use as a loop counter.
+ * @n: another &struct list_head to use as temporary storage
+ * @head: the head for your list.
*/
#define list_for_each_safe(pos, n, head) \
- for (pos = (head)->next, n = pos->next; pos != (head); \
- pos = n, n = pos->next)
+ for (pos = (head)->next, n = pos->next; pos != (head); \
+ pos = n, n = pos->next)
#define list_for_each_safe_entry(item, pos, n, head, member) \
- for (pos = (head)->next, \
+ for (pos = (head)->next, \
item = list_entry(pos, typeof(*item), member), \
n = pos->next \
- ; \
- pos != (head) \
- ; \
- pos = n, \
- item = list_entry(pos, typeof(*item), member), \
+ ; \
+ pos != (head) \
+ ; \
+ pos = n, \
+ item = list_entry(pos, typeof(*item), member), \
n = pos->next) \
/**
- * list_for_each_entry - iterate over list of given type
- * @pos: the type * to use as a loop counter.
- * @head: the head for your list.
- * @member: the name of the list_struct within the struct.
+ * list_for_each_entry - iterate over list of given type
+ * @pos: the type * to use as a loop counter.
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
*/
-#define list_for_each_entry(pos, head, member) \
- for (pos = list_entry((head)->next, typeof(*pos), member), \
- prefetch(pos->member.next); \
- &pos->member != (head); \
- pos = list_entry(pos->member.next, typeof(*pos), member), \
- prefetch(pos->member.next))
-
-#define list_for_each_entry_safe(pos, n, head, member) \
- for (pos = list_entry((head)->next, typeof(*pos), member), \
- n = list_entry(pos->member.next, typeof(*pos), member); \
- &pos->member != (head); \
- pos = n, \
- n = list_entry(pos->member.next, typeof(*pos), member))
+#define list_for_each_entry(pos, head, member) \
+ for (pos = list_entry((head)->next, typeof(*pos), member), \
+ prefetch(pos->member.next); \
+ &pos->member != (head); \
+ pos = list_entry(pos->member.next, typeof(*pos), member), \
+ prefetch(pos->member.next))
+
+#define list_for_each_entry_safe(pos, n, head, member) \
+ for (pos = list_entry((head)->next, typeof(*pos), member), \
+ n = list_entry(pos->member.next, typeof(*pos), member); \
+ &pos->member != (head); \
+ pos = n, \
+ n = list_entry(pos->member.next, typeof(*pos), member))
#define list_direction_entry(pos, head, member, direction) \
({ \
- typeof(pos) ret = NULL; \
- struct list_head *a_head = head; \
- if (pos->member.direction == a_head) { \
- ret = list_entry(a_head->direction, \
- typeof(*pos), member); \
- } else { \
- ret = list_entry(pos->member.direction, \
- typeof(*pos), member); \
- } \
- ret; \
+ typeof(pos) ret = NULL; \
+ struct list_head *a_head = head; \
+ if (pos->member.direction == a_head) { \
+ ret = list_entry(a_head->direction, \
+ typeof(*pos), member); \
+ } else { \
+ ret = list_entry(pos->member.direction, \
+ typeof(*pos), member); \
+ } \
+ ret; \
})
#define list_next_entry(pos, head, member) \
@@ -192,21 +192,20 @@ void prefetch(const void *x);
#define list_prev_entry(pos, head, member) \
list_direction_entry(pos, head, member, prev)
-#define list_for_each_entry_prev(pos, head, member) \
- for (pos = list_entry((head)->prev, typeof(*pos), member), \
- prefetch(pos->member.prev); \
- &pos->member != (head); \
- pos = list_entry(pos->member.prev, typeof(*pos), member), \
- prefetch(pos->member.prev))
+#define list_for_each_entry_prev(pos, head, member) \
+ for (pos = list_entry((head)->prev, typeof(*pos), member), \
+ prefetch(pos->member.prev); \
+ &pos->member != (head); \
+ pos = list_entry(pos->member.prev, typeof(*pos), member), \
+ prefetch(pos->member.prev))
#endif
/* Return the first element in the list. */
-#define list_first(first, head, member) \
-{ \
- first = list_entry((head)->next, typeof(*first), member); \
- if (&first->member == (head)) \
- first = NULL; \
+#define list_first(first, head, member) \
+{ \
+ first = list_entry((head)->next, typeof(*first), member); \
+ if (&first->member == (head)) \
+ first = NULL; \
}
-
diff --git a/src/main.c b/src/main.c
index 433de0d..4fced0e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -7,12 +7,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* ratpoison is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
@@ -45,15 +45,15 @@
#endif
/* Command line options */
-static struct option ratpoison_longopts[] =
- { {"help", no_argument, 0, 'h'},
- {"interactive", no_argument, 0, 'i'},
- {"version", no_argument, 0, 'v'},
- {"command", required_argument, 0, 'c'},
- {"display", required_argument, 0, 'd'},
- {"screen", required_argument, 0, 's'},
- {"file", required_argument, 0, 'f'},
- {0, 0, 0, 0} };
+static struct option ratpoison_longopts[] =
+ { {"help", no_argument, 0, 'h'},
+ {"interactive", no_argument, 0, 'i'},
+ {"version", no_argument, 0, 'v'},
+ {"command", required_argument, 0, 'c'},
+ {"display", required_argument, 0, 'd'},
+ {"screen", required_argument, 0, 's'},
+ {"file", required_argument, 0, 'f'},
+ {0, 0, 0, 0} };
static char ratpoison_opts[] = "hvic:d:s:f:";
@@ -112,9 +112,9 @@ xvsprintf (char *fmt, va_list ap)
__va_copy (ap_copy, ap);
#else
/* If there is no copy macro then this MAY work. On some systems
- this could fail because va_list is a pointer so assigning one
- to the other as below wouldn't make a copy of the data, but
- just the pointer to the data. */
+ this could fail because va_list is a pointer so assigning one
+ to the other as below wouldn't make a copy of the data, but
+ just the pointer to the data. */
ap_copy = ap;
#endif
nchars = vsnprintf (buffer, size, fmt, ap_copy);
@@ -123,11 +123,11 @@ xvsprintf (char *fmt, va_list ap)
#endif
if (nchars > -1 && nchars < size)
- return buffer;
+ return buffer;
else if (nchars > -1)
- size = nchars + 1;
+ size = nchars + 1;
else
- size *= 2;
+ size *= 2;
/* Resize the buffer and try again. */
buffer = (char *)xrealloc (buffer, size);
@@ -192,20 +192,20 @@ check_child_procs ()
{
pid = waitpid (WAIT_ANY, &status, WNOHANG);
if (pid <= 0)
- break;
+ break;
PRINT_DEBUG(("Child status: %d\n", WEXITSTATUS (status)));
/* Find the child and update its structure. */
list_for_each_entry (cur, &rp_children, node)
- {
- if (cur->pid == pid)
- {
- cur->terminated = 1;
- cur->status = WEXITSTATUS (status);
- break;
- }
- }
+ {
+ if (cur->pid == pid)
+ {
+ cur->terminated = 1;
+ cur->status = WEXITSTATUS (status);
+ break;
+ }
+ }
chld_signalled = 1;
}
@@ -218,7 +218,7 @@ chld_handler (int signum)
serrno = errno;
check_child_procs();
- errno = serrno;
+ errno = serrno;
}
int
@@ -226,11 +226,11 @@ handler (Display *d, XErrorEvent *e)
{
char error_msg[100];
- if (e->request_code == X_ChangeWindowAttributes && e->error_code == BadAccess)
+ if (e->request_code == X_ChangeWindowAttributes && e->error_code == BadAccess)
{
fprintf(stderr, "ratpoison: There can be only ONE.\n");
exit(EXIT_FAILURE);
- }
+ }
#ifdef IGNORE_BADWINDOW
return 0;
@@ -243,7 +243,7 @@ handler (Display *d, XErrorEvent *e)
/* If there is already an error to report, replace it with this new
one. */
- if (rp_error_msg)
+ if (rp_error_msg)
free (rp_error_msg);
rp_error_msg = xstrdup (error_msg);
@@ -257,26 +257,26 @@ set_sig_handler (int sig, void (*action)(int))
handler by default which is a tip of the hat to some god-aweful
ancient code. So use the POSIX sigaction call instead. */
struct sigaction act;
-
+
/* check setting for sig */
- if (sigaction (sig, NULL, &act))
+ if (sigaction (sig, NULL, &act))
{
PRINT_ERROR (("Error %d fetching SIGALRM handler\n", errno ));
- }
- else
+ }
+ else
{
/* if the existing action is to ignore then leave it intact
- otherwise add our handler */
- if (act.sa_handler != SIG_IGN)
- {
- act.sa_handler = action;
- sigemptyset(&act.sa_mask);
- act.sa_flags = 0;
- if (sigaction (sig, &act, NULL))
- {
- PRINT_ERROR (("Error %d setting SIGALRM handler\n", errno ));
- }
- }
+ otherwise add our handler */
+ if (act.sa_handler != SIG_IGN)
+ {
+ act.sa_handler = action;
+ sigemptyset(&act.sa_mask);
+ act.sa_flags = 0;
+ if (sigaction (sig, &act, NULL))
+ {
+ PRINT_ERROR (("Error %d setting SIGALRM handler\n", errno ));
+ }
+ }
}
}
@@ -287,7 +287,7 @@ print_version ()
printf ("Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts\n\n");
exit (EXIT_SUCCESS);
-}
+}
void
print_help ()
@@ -330,39 +330,39 @@ read_rc_file (FILE *file)
while (fgets (partial, n, file) != NULL)
{
if ((strlen (line) + strlen (partial)) >= linesize)
- {
- linesize *= 2;
- line = (char*) xrealloc (line, linesize);
- }
+ {
+ linesize *= 2;
+ line = (char*) xrealloc (line, linesize);
+ }
strcat (line, partial);
if (feof(file) || (*(line + strlen(line) - 1) == '\n'))
- {
- /* FIXME: this is a hack, command() should properly parse
- the command and args (ie strip whitespace, etc)
-
- We should not care if there is a newline (or vertical
- tabs or linefeeds for that matter) at the end of the
- command (or anywhere between tokens). */
- if (*(line + strlen(line) - 1) == '\n')
- *(line + strlen(line) - 1) = '\0';
-
- PRINT_DEBUG (("rcfile line: %s\n", line));
-
- /* do it */
- if (*line != '#')
- {
- cmdret *result;
- result = command (0, line);
-
- /* Gobble the result. */
- if (result)
- cmdret_free (result);
- }
-
- *line = '\0';
- }
+ {
+ /* FIXME: this is a hack, command() should properly parse
+ the command and args (ie strip whitespace, etc)
+
+ We should not care if there is a newline (or vertical
+ tabs or linefeeds for that matter) at the end of the
+ command (or anywhere between tokens). */
+ if (*(line + strlen(line) - 1) == '\n')
+ *(line + strlen(line) - 1) = '\0';
+
+ PRINT_DEBUG (("rcfile line: %s\n", line));
+
+ /* do it */
+ if (*line != '#')
+ {
+ cmdret *result;
+ result = command (0, line);
+
+ /* Gobble the result. */
+ if (result)
+ cmdret_free (result);
+ }
+
+ *line = '\0';
+ }
}
@@ -379,39 +379,39 @@ read_startup_files (char *alt_rcfile)
if (alt_rcfile)
{
if ((fileptr = fopen (alt_rcfile, "r")) == NULL)
- {
- /* we probably don't need to report this, its not an error */
- PRINT_DEBUG (("ratpoison: could not open %s\n", alt_rcfile));
- }
+ {
+ /* we probably don't need to report this, its not an error */
+ PRINT_DEBUG (("ratpoison: could not open %s\n", alt_rcfile));
+ }
}
else
{
/* first check $HOME/.ratpoisonrc and if that does not exist then try
- /etc/ratpoisonrc */
+ /etc/ratpoisonrc */
homedir = getenv ("HOME");
if (!homedir)
- {
- PRINT_ERROR (("ratpoison: $HOME not set!?\n"));
- }
+ {
+ PRINT_ERROR (("ratpoison: $HOME not set!?\n"));
+ }
else
- {
- char *filename;
- filename = xsprintf ("%s/.ratpoisonrc", homedir);
-
- if ((fileptr = fopen (filename, "r")) == NULL)
- {
- /* we probably don't need to report this, its not an error */
- PRINT_DEBUG (("ratpoison: could not open %s\n", filename));
-
- if ((fileptr = fopen ("/etc/ratpoisonrc", "r")) == NULL)
- {
- /* neither is this */
- PRINT_DEBUG (("ratpoison: could not open /etc/ratpoisonrc\n"));
- }
- }
- free (filename);
- }
+ {
+ char *filename;
+ filename = xsprintf ("%s/.ratpoisonrc", homedir);
+
+ if ((fileptr = fopen (filename, "r")) == NULL)
+ {
+ /* we probably don't need to report this, its not an error */
+ PRINT_DEBUG (("ratpoison: could not open %s\n", filename));
+
+ if ((fileptr = fopen ("/etc/ratpoisonrc", "r")) == NULL)
+ {
+ /* neither is this */
+ PRINT_DEBUG (("ratpoison: could not open /etc/ratpoisonrc\n"));
+ }
+ }
+ free (filename);
+ }
}
if (fileptr)
@@ -430,10 +430,10 @@ show_welcome_message ()
rp_action *help_action;
char *prefix, *help;
rp_keymap *map;
-
+
prefix = keysym_to_string (prefix_key.sym, prefix_key.state);
- map = find_keymap (ROOT_KEYMAP);
+ map = find_keymap (ROOT_KEYMAP);
/* Find the help key binding. */
help_action = find_keybinding_by_action ("help " ROOT_KEYMAP, map);
@@ -446,11 +446,11 @@ show_welcome_message ()
if (help)
{
/* A little kludge to use ? instead of `question' for the help
- key. */
+ key. */
if (!strcmp (help, "question"))
- marked_message_printf (0, 0, MESSAGE_WELCOME, prefix, "?");
+ marked_message_printf (0, 0, MESSAGE_WELCOME, prefix, "?");
else
- marked_message_printf (0, 0, MESSAGE_WELCOME, prefix, help);
+ marked_message_printf (0, 0, MESSAGE_WELCOME, prefix, help);
free (help);
}
@@ -458,7 +458,7 @@ show_welcome_message ()
{
marked_message_printf (0, 0, MESSAGE_WELCOME, prefix, ":help");
}
-
+
free (prefix);
}
@@ -474,7 +474,7 @@ init_defaults ()
defaults.bar_x_padding = 4;
defaults.bar_y_padding = 0;
defaults.bar_location = NorthEastGravity;
- defaults.bar_timeout = 5;
+ defaults.bar_timeout = 5;
defaults.bar_border_width = 1;
defaults.frame_indicator_timeout = 1;
@@ -482,7 +482,7 @@ init_defaults ()
defaults.padding_left = 0;
defaults.padding_right = 0;
- defaults.padding_top = 0;
+ defaults.padding_top = 0;
defaults.padding_bottom = 0;
defaults.font = XLoadQueryFont (dpy, DEFAULT_FONT);
@@ -535,44 +535,44 @@ main (int argc, char *argv[])
if (c == -1) break;
switch (c)
- {
- case 'h':
- print_help ();
- break;
- case 'v':
- print_version ();
- break;
- case 'c':
- if (!command)
- {
- command = xmalloc (sizeof(char *));
- cmd_count = 0;
- }
- else
- {
- command = xrealloc (command, sizeof (char *) * (cmd_count + 1));
- }
-
- command[cmd_count] = xstrdup (optarg);
- cmd_count++;
- break;
- case 'd':
- display = xstrdup (optarg);
- break;
- case 's':
- screen_arg = 1;
- screen_num = strtol (optarg, NULL, 10);
- break;
- case 'i':
- interactive = 1;
- break;
- case 'f':
- alt_rcfile = xstrdup (optarg);
- break;
-
- default:
- exit (EXIT_FAILURE);
- }
+ {
+ case 'h':
+ print_help ();
+ break;
+ case 'v':
+ print_version ();
+ break;
+ case 'c':
+ if (!command)
+ {
+ command = xmalloc (sizeof(char *));
+ cmd_count = 0;
+ }
+ else
+ {
+ command = xrealloc (command, sizeof (char *) * (cmd_count + 1));
+ }
+
+ command[cmd_count] = xstrdup (optarg);
+ cmd_count++;
+ break;
+ case 'd':
+ display = xstrdup (optarg);
+ break;
+ case 's':
+ screen_arg = 1;
+ screen_num = strtol (optarg, NULL, 10);
+ break;
+ case 'i':
+ interactive = 1;
+ break;
+ case 'f':
+ alt_rcfile = xstrdup (optarg);
+ break;
+
+ default:
+ exit (EXIT_FAILURE);
+ }
}
/* Report extra unparsed arguments. */
@@ -580,7 +580,7 @@ main (int argc, char *argv[])
{
fprintf (stderr, "Error: junk arguments: ");
while (optind < argc)
- fprintf (stderr, "%s ", argv[optind++]);
+ fprintf (stderr, "%s ", argv[optind++]);
fputc ('\n', stderr);
exit (EXIT_FAILURE);
}
@@ -602,14 +602,14 @@ main (int argc, char *argv[])
int i;
for (i=0; i<cmd_count; i++)
- {
- if (screen_arg)
- send_command (interactive, (unsigned char *)command[i], screen_num);
- else
- send_command (interactive, (unsigned char *)command[i], -1);
+ {
+ if (screen_arg)
+ send_command (interactive, (unsigned char *)command[i], screen_num);
+ else
+ send_command (interactive, (unsigned char *)command[i], -1);
- free (command[i]);
- }
+ free (command[i]);
+ }
free (command);
XCloseDisplay (dpy);
@@ -632,7 +632,7 @@ main (int argc, char *argv[])
PRINT_DEBUG (("_NET_SUPPORTED = %ld\n", _net_supported));
/* Setup signal handlers. */
- XSetErrorHandler(handler);
+ XSetErrorHandler(handler);
set_sig_handler (SIGALRM, alrm_handler);
set_sig_handler (SIGTERM, sighandler);
set_sig_handler (SIGINT, sighandler);
@@ -668,9 +668,9 @@ main (int argc, char *argv[])
{
rp_current_screen = 0;
for (i=0; i<num_screens; i++)
- {
- scanwins (&screens[i]);
- }
+ {
+ scanwins (&screens[i]);
+ }
}
read_startup_files (alt_rcfile);
@@ -703,7 +703,7 @@ free_screen (rp_screen *s)
{
frame_free (s, frame);
}
-
+
XDestroyWindow (dpy, s->bar_window);
XDestroyWindow (dpy, s->key_window);
XDestroyWindow (dpy, s->input_window);
@@ -732,7 +732,7 @@ clean_up ()
free_groups ();
free_window_stuff ();
-
+
for (i=0; i<num_screens; i++)
{
free_screen (&screens[i]);
@@ -759,4 +759,3 @@ clean_up ()
XSetInputFocus (dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
XCloseDisplay (dpy);
}
-
diff --git a/src/manage.c b/src/manage.c
index 7a3898f..d787c02 100644
--- a/src/manage.c
+++ b/src/manage.c
@@ -39,12 +39,12 @@ static int num_unmanaged_windows = 0;
void
clear_unmanaged_list ()
{
- if (unmanaged_window_list)
+ if (unmanaged_window_list)
{
int i;
for (i = 0; i < num_unmanaged_windows; i++)
- free(unmanaged_window_list[i]);
+ free(unmanaged_window_list[i]);
free(unmanaged_window_list);
@@ -57,23 +57,23 @@ char *
list_unmanaged_windows ()
{
char *tmp = NULL;
- if (unmanaged_window_list)
+ if (unmanaged_window_list)
{
char *tpos;
int len = 0;
int i;
for (i = 0; i < num_unmanaged_windows; i++)
- len += (strlen(unmanaged_window_list[i]) + 1);
+ len += (strlen(unmanaged_window_list[i]) + 1);
tmp = xmalloc(len + 1);
tpos = tmp;
- for (i = 0; i < num_unmanaged_windows; i++)
- {
- sprintf(tpos, "%s\n", unmanaged_window_list[i]);
- tpos += strlen(unmanaged_window_list[i])+1;
- }
+ for (i = 0; i < num_unmanaged_windows; i++)
+ {
+ sprintf(tpos, "%s\n", unmanaged_window_list[i]);
+ tpos += strlen(unmanaged_window_list[i])+1;
+ }
tpos--;
*tpos = '\0';
}
@@ -89,7 +89,7 @@ add_unmanaged_window (char *name)
tmp = xmalloc((num_unmanaged_windows + 1) * sizeof(char *));
- if (unmanaged_window_list)
+ if (unmanaged_window_list)
{
memcpy(tmp, unmanaged_window_list, num_unmanaged_windows * sizeof(char *));
free(unmanaged_window_list);
@@ -107,8 +107,8 @@ void
grab_top_level_keys (Window w)
{
#ifdef HIDE_MOUSE
- XGrabKey(dpy, AnyKey, AnyModifier, w, True,
- GrabModeAsync, GrabModeAsync);
+ XGrabKey(dpy, AnyKey, AnyModifier, w, True,
+ GrabModeAsync, GrabModeAsync);
#else
rp_keymap *map = find_keymap (TOP_KEYMAP);
int i;
@@ -166,9 +166,9 @@ current_screen ()
for (i=0; i<num_screens; i++)
{
if (screens[i].xine_screen_num == rp_current_screen)
- return &screens[i];
+ return &screens[i];
}
-
+
/* This should never happen. */
return &screens[0];
}
@@ -193,7 +193,7 @@ update_normal_hints (rp_window *win)
#endif
}
-
+
static char *
get_wmname (Window w)
@@ -206,12 +206,12 @@ get_wmname (Window w)
unsigned char *name = NULL;
char *ret;
- status = XGetWindowProperty (dpy, w, wm_name, 0L, 100L, False,
- XA_STRING, &actual_type, &actual_format,
- &n, &bytes_after, &name);
+ status = XGetWindowProperty (dpy, w, wm_name, 0L, 100L, False,
+ XA_STRING, &actual_type, &actual_format,
+ &n, &bytes_after, &name);
- PRINT_DEBUG (("XGetWindowProperty: %d %ld %d %ld %ld '%s'\n", status, actual_type,
- actual_format, n, bytes_after, name));
+ PRINT_DEBUG (("XGetWindowProperty: %d %ld %d %ld %ld '%s'\n", status, actual_type,
+ actual_format, n, bytes_after, name));
if (status != Success || name == NULL)
{
@@ -334,7 +334,7 @@ update_window_name (rp_window *win)
return 1;
}
-/* Send an artificial configure event to the window. */
+/* Send an artificial configure event to the window. */
void
send_configure (Window w, int x, int y, int width, int height, int border)
{
@@ -366,7 +366,7 @@ window_is_transient (rp_window *win)
#ifdef MAXSIZE_WINDOWS_ARE_TRANSIENTS
|| (win->hints->flags & PMaxSize
&& (win->hints->max_width < win->scr->width
- || win->hints->max_height < win->scr->height))
+ || win->hints->max_height < win->scr->height))
#endif
;
}
@@ -402,19 +402,19 @@ unmanage (rp_window *w)
list_del (&w->node);
groups_del_window (w);
- free_window (w);
+ free_window (w);
#ifdef AUTO_CLOSE
if (rp_mapped_window->next == &rp_mapped_window
&& rp_mapped_window->prev == &rp_mapped_window)
{
/* If the mapped window list is empty then we have run out of
- managed windows, so kill ratpoison. */
+ managed windows, so kill ratpoison. */
/* FIXME: The unmapped window list may also have to be checked
- in the case that the only mapped window in unmapped and
- shortly after another window is mapped most likely by the
- same app. */
+ in the case that the only mapped window in unmapped and
+ shortly after another window is mapped most likely by the
+ same app. */
kill_signalled = 1;
}
@@ -433,43 +433,43 @@ scanwins(rp_screen *s)
XQueryTree(dpy, s->root, &dw1, &dw2, &wins, &nwins);
PRINT_DEBUG (("windows: %d\n", nwins));
- for (i = 0; i < nwins; i++)
+ for (i = 0; i < nwins; i++)
{
XGetWindowAttributes(dpy, wins[i], &attr);
if (is_rp_window_for_screen(wins[i], s)
- || attr.override_redirect == True
- || unmanaged_window (wins[i])) continue;
+ || attr.override_redirect == True
+ || unmanaged_window (wins[i])) continue;
/* FIXME - with this code, windows which are entirely off-screen
* when RP starts won't ever be managed when Xinerama is enabled.
*/
- {
- XWindowAttributes root_attr;
+ {
+ XWindowAttributes root_attr;
- XGetWindowAttributes (dpy, s->root, &root_attr);
- PRINT_DEBUG (("attrs: %d %d %d %d %d %d\n", root_attr.x, root_attr.y,
- s->left, s->top, s->left + s->width, s->top + s->height));}
+ XGetWindowAttributes (dpy, s->root, &root_attr);
+ PRINT_DEBUG (("attrs: %d %d %d %d %d %d\n", root_attr.x, root_attr.y,
+ s->left, s->top, s->left + s->width, s->top + s->height));}
if (rp_have_xinerama
- && ((attr.x > s->left + s->width)
+ && ((attr.x > s->left + s->width)
|| (attr.x < s->left)
- || (attr.y > s->top + s->height)
- || (attr.y < s->top))) continue;
+ || (attr.y > s->top + s->height)
+ || (attr.y < s->top))) continue;
win = add_to_window_list (s, wins[i]);
- PRINT_DEBUG (("map_state: %s\n",
- attr.map_state == IsViewable ? "IsViewable":
- attr.map_state == IsUnviewable ? "IsUnviewable" : "IsUnmapped"));
- PRINT_DEBUG (("state: %s\n",
- get_state(win) == IconicState ? "Iconic":
- get_state(win) == NormalState ? "Normal" : "Other"));
-
+ PRINT_DEBUG (("map_state: %s\n",
+ attr.map_state == IsViewable ? "IsViewable":
+ attr.map_state == IsUnviewable ? "IsUnviewable" : "IsUnmapped"));
+ PRINT_DEBUG (("state: %s\n",
+ get_state(win) == IconicState ? "Iconic":
+ get_state(win) == NormalState ? "Normal" : "Other"));
+
/* Collect mapped and iconized windows. */
if (attr.map_state == IsViewable
- || (attr.map_state == IsUnmapped
- && get_state (win) == IconicState))
- map_window (win);
+ || (attr.map_state == IsUnmapped
+ && get_state (win) == IconicState))
+ map_window (win);
}
XFree(wins);
@@ -483,15 +483,15 @@ unmanaged_window (Window w)
if (!unmanaged_window_list) return 0;
- for (i = 0; i < num_unmanaged_windows; i++)
+ for (i = 0; i < num_unmanaged_windows; i++)
{
wname = get_wmname(w);
if (!wname) return 0;
- if (!strcmp(unmanaged_window_list[i], wname))
- {
- free(wname);
- return 1;
- }
+ if (!strcmp(unmanaged_window_list[i], wname))
+ {
+ free(wname);
+ return 1;
+ }
free(wname);
}
return 0;
@@ -502,14 +502,14 @@ void
set_state (rp_window *win, int state)
{
long data[2];
-
+
win->state = state;
data[0] = (long)win->state;
data[1] = (long)None;
XChangeProperty (dpy, win->w, wm_state, wm_state, 32,
- PropModeReplace, (unsigned char *)data, 2);
+ PropModeReplace, (unsigned char *)data, 2);
}
/* Get the WM state of the window. */
@@ -523,13 +523,13 @@ get_state (rp_window *win)
unsigned long bytes_left;
unsigned char *data;
- if (win == NULL)
+ if (win == NULL)
return state;
- if (XGetWindowProperty (dpy, win->w, wm_state, 0L, 2L,
- False, wm_state, &type, &format,
- &nitems, &bytes_left,
- &data) == Success && nitems > 0)
+ if (XGetWindowProperty (dpy, win->w, wm_state, 0L, 2L,
+ False, wm_state, &type, &format,
+ &nitems, &bytes_left,
+ &data) == Success && nitems > 0)
{
state = *(long *)data;
XFree (data);
@@ -543,7 +543,7 @@ move_window (rp_window *win)
{
rp_frame *frame;
- if (win->frame_number == EMPTY)
+ if (win->frame_number == EMPTY)
return;
frame = win_get_frame (win);
@@ -614,8 +614,8 @@ maximize_transient (rp_window *win)
/* Fit the window inside its frame (if it has one) */
if (frame)
{
- PRINT_DEBUG (("frame width=%d height=%d\n",
- frame->width, frame->height));
+ PRINT_DEBUG (("frame width=%d height=%d\n",
+ frame->width, frame->height));
if (maxx + win->border * 2 > frame->width) maxx = frame->width - win->border * 2;
if (maxy + win->border * 2 > frame->height) maxy = frame->height - win->border * 2;
@@ -630,22 +630,22 @@ maximize_transient (rp_window *win)
/* Avoid a divide by zero if width/height_inc is 0. */
if (win->hints->width_inc)
- {
- amount = maxx - win->width;
- delta = amount % win->hints->width_inc;
- amount -= delta;
- if (amount < 0 && delta) amount -= win->hints->width_inc;
- maxx = amount + win->width;
- }
+ {
+ amount = maxx - win->width;
+ delta = amount % win->hints->width_inc;
+ amount -= delta;
+ if (amount < 0 && delta) amount -= win->hints->width_inc;
+ maxx = amount + win->width;
+ }
if (win->hints->height_inc)
- {
- amount = maxy - win->height;
- delta = amount % win->hints->height_inc;
- amount -= delta;
- if (amount < 0 && delta) amount -= win->hints->height_inc;
- maxy = amount + win->height;
- }
+ {
+ amount = maxy - win->height;
+ delta = amount % win->hints->height_inc;
+ amount -= delta;
+ if (amount < 0 && delta) amount -= win->hints->height_inc;
+ maxy = amount + win->height;
+ }
}
PRINT_DEBUG (("maxsize: %d %d\n", maxx, maxy));
@@ -685,28 +685,28 @@ maximize_normal (rp_window *win)
/* Honour the window's aspect ratio. */
PRINT_DEBUG (("aspect: %ld\n", win->hints->flags & PAspect));
- if (win->hints->flags & PAspect)
+ if (win->hints->flags & PAspect)
{
float ratio = (float)maxx / maxy;
float min_ratio = (float)win->hints->min_aspect.x / win->hints->min_aspect.y;
float max_ratio = (float)win->hints->max_aspect.x / win->hints->max_aspect.y;
- PRINT_DEBUG (("ratio=%f min_ratio=%f max_ratio=%f\n",
- ratio,min_ratio,max_ratio));
- if (ratio < min_ratio)
- {
- maxy = (int) (maxx / min_ratio);
- }
- else if (ratio > max_ratio)
- {
- maxx = (int) (maxy * max_ratio);
- }
+ PRINT_DEBUG (("ratio=%f min_ratio=%f max_ratio=%f\n",
+ ratio,min_ratio,max_ratio));
+ if (ratio < min_ratio)
+ {
+ maxy = (int) (maxx / min_ratio);
+ }
+ else if (ratio > max_ratio)
+ {
+ maxx = (int) (maxy * max_ratio);
+ }
}
/* Fit the window inside its frame (if it has one) */
if (frame)
{
- PRINT_DEBUG (("frame width=%d height=%d\n",
- frame->width, frame->height));
+ PRINT_DEBUG (("frame width=%d height=%d\n",
+ frame->width, frame->height));
if (maxx > frame->width) maxx = frame->width - win->border * 2;
if (maxy > frame->height) maxy = frame->height - win->border * 2;
@@ -720,22 +720,22 @@ maximize_normal (rp_window *win)
int delta;
if (win->hints->width_inc)
- {
- amount = maxx - win->width;
- delta = amount % win->hints->width_inc;
- if (amount < 0 && delta) amount -= win->hints->width_inc;
- amount -= delta;
- maxx = amount + win->width;
- }
+ {
+ amount = maxx - win->width;
+ delta = amount % win->hints->width_inc;
+ if (amount < 0 && delta) amount -= win->hints->width_inc;
+ amount -= delta;
+ maxx = amount + win->width;
+ }
if (win->hints->height_inc)
- {
- amount = maxy - win->height;
- delta = amount % win->hints->height_inc;
- if (amount < 0 && delta) amount -= win->hints->height_inc;
- amount -= delta;
- maxy = amount + win->height;
- }
+ {
+ amount = maxy - win->height;
+ delta = amount % win->hints->height_inc;
+ if (amount < 0 && delta) amount -= win->hints->height_inc;
+ amount -= delta;
+ maxy = amount + win->height;
+ }
}
PRINT_DEBUG (("maxsize: %d %d\n", maxx, maxy));
@@ -761,8 +761,8 @@ maximize (rp_window *win)
/* Reposition the window. */
move_window (win);
- PRINT_DEBUG (("Resizing window '%s' to x:%d y:%d w:%d h:%d\n", window_name (win),
- win->x, win->y, win->width, win->height));
+ PRINT_DEBUG (("Resizing window '%s' to x:%d y:%d w:%d h:%d\n", window_name (win),
+ win->x, win->y, win->width, win->height));
/* Actually do the maximizing. */
@@ -792,8 +792,8 @@ force_maximize (rp_window *win)
if (win->hints->flags & PResizeInc)
{
XMoveResizeWindow (dpy, win->w, win->scr->left + win->x, win->scr->top + win->y,
- win->width + win->hints->width_inc,
- win->height + win->hints->height_inc);
+ win->width + win->hints->width_inc,
+ win->height + win->hints->height_inc);
}
else
{
@@ -822,7 +822,7 @@ map_window (rp_window *win)
/* Put win in the mapped window list */
list_del (&win->node);
- insert_into_list (win, &rp_mapped_window);
+ insert_into_list (win, &rp_mapped_window);
/* Update all groups. */
groups_map_window (win);
@@ -841,11 +841,11 @@ map_window (rp_window *win)
else
{
if (win->transient)
- marked_message_printf (0, 0, MESSAGE_MAP_TRANSIENT,
- win->number, window_name (win));
+ marked_message_printf (0, 0, MESSAGE_MAP_TRANSIENT,
+ win->number, window_name (win));
else
- marked_message_printf (0, 0, MESSAGE_MAP_WINDOW,
- win->number, window_name (win));
+ marked_message_printf (0, 0, MESSAGE_MAP_WINDOW,
+ win->number, window_name (win));
}
}
@@ -950,10 +950,10 @@ hide_others (rp_window *win)
list_for_each_entry (cur, &rp_mapped_window, node)
{
- if (find_windows_frame (cur)
- || cur->state != NormalState
- || cur->frame_number != frame->number)
- continue;
+ if (find_windows_frame (cur)
+ || cur->state != NormalState
+ || cur->frame_number != frame->number)
+ continue;
hide_window (cur);
}
diff --git a/src/manage.h b/src/manage.h
index 6b15f98..cdb70e4 100644
--- a/src/manage.h
+++ b/src/manage.h
@@ -1,4 +1,4 @@
-/* manage.h
+/* manage.h
* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca>
*
* This file is part of ratpoison.
@@ -7,12 +7,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* ratpoison is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
diff --git a/src/messages.h b/src/messages.h
index dfebc2a..e8ec126 100644
--- a/src/messages.h
+++ b/src/messages.h
@@ -7,12 +7,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* ratpoison is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
@@ -24,30 +24,30 @@
#include "config.h"
-#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_UNKNOWN_COMMAND ": unknown command '%s'"
-#define MESSAGE_WINDOW_INFORMATION "This is window %d (%s)"
+#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_UNKNOWN_COMMAND ": unknown command '%s'"
+#define MESSAGE_WINDOW_INFORMATION "This is window %d (%s)"
-#define MESSAGE_RAISE_TRANSIENT "Raise request from transient window %d (%s)"
-#define MESSAGE_RAISE_WINDOW "Raise request from window %d (%s)"
-#define MESSAGE_RAISE_TRANSIENT_GROUP "Raise request from transient window %d (%s) in group %s"
-#define MESSAGE_RAISE_WINDOW_GROUP "Raise request from window %d (%s) in group %s"
-#define MESSAGE_MAP_TRANSIENT "New transient window %d (%s)"
-#define MESSAGE_MAP_WINDOW "New window %d (%s)"
+#define MESSAGE_RAISE_TRANSIENT "Raise request from transient window %d (%s)"
+#define MESSAGE_RAISE_WINDOW "Raise request from window %d (%s)"
+#define MESSAGE_RAISE_TRANSIENT_GROUP "Raise request from transient window %d (%s) in group %s"
+#define MESSAGE_RAISE_WINDOW_GROUP "Raise request from window %d (%s) in group %s"
+#define MESSAGE_MAP_TRANSIENT "New transient window %d (%s)"
+#define MESSAGE_MAP_WINDOW "New window %d (%s)"
#define MESSAGE_PROMPT_SWITCH_TO_WINDOW "Switch to window: "
-#define MESSAGE_PROMPT_NEW_WINDOW_NAME "Set window's title to: "
-#define MESSAGE_PROMPT_SHELL_COMMAND "/bin/sh -c "
-#define MESSAGE_PROMPT_COMMAND ":"
-#define MESSAGE_PROMPT_SWITCH_WM "Switch to wm: "
-#define MESSAGE_PROMPT_XTERM_COMMAND MESSAGE_PROMPT_SHELL_COMMAND TERM_PROG " -e "
+#define MESSAGE_PROMPT_NEW_WINDOW_NAME "Set window's title to: "
+#define MESSAGE_PROMPT_SHELL_COMMAND "/bin/sh -c "
+#define MESSAGE_PROMPT_COMMAND ":"
+#define MESSAGE_PROMPT_SWITCH_WM "Switch to wm: "
+#define MESSAGE_PROMPT_XTERM_COMMAND MESSAGE_PROMPT_SHELL_COMMAND TERM_PROG " -e "
#define MESSAGE_PROMPT_SWITCH_TO_GROUP "Switch to group: "
#define MESSAGE_PROMPT_SELECT_VAR "Variable: "
#define MESSAGE_PROMPT_VAR_VALUE "Value: "
-#define MESSAGE_WELCOME "Welcome to ratpoison! Hit `%s %s' for help."
-#define MESSAGE_FRAME_STRING "Current Frame"
+#define MESSAGE_WELCOME "Welcome to ratpoison! Hit `%s %s' for help."
+#define MESSAGE_FRAME_STRING "Current Frame"
#endif /* ! _RATPOISON_MESSAGES_H */
diff --git a/src/number.c b/src/number.c
index ee96b42..6bb959a 100644
--- a/src/number.c
+++ b/src/number.c
@@ -7,12 +7,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* ratpoison is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
@@ -75,7 +75,7 @@ numset_add_num (struct numset *ns, int n)
PRINT_DEBUG(("ns=%p add_num %d\n", ns, n));
- if (numset_num_is_taken (ns, n))
+ if (numset_num_is_taken (ns, n))
return 0; /* failed. */
/* numset_find_empty_cell calls realloc on numbers_taken. So store
the ret val in ec then use ec as an index into the array. */
@@ -115,11 +115,11 @@ numset_release (struct numset *ns, int n)
for (i=0; i<ns->num_taken; i++)
{
- if (ns->numbers_taken[i] == n)
- {
- ns->numbers_taken[i] = -1;
- return;
- }
+ if (ns->numbers_taken[i] == n)
+ {
+ ns->numbers_taken[i] = -1;
+ return;
+ }
}
}
diff --git a/src/number.h b/src/number.h
index 585411b..bac958a 100644
--- a/src/number.h
+++ b/src/number.h
@@ -7,12 +7,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* ratpoison is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
diff --git a/src/ratpoison.h b/src/ratpoison.h
index ea8ec65..614abc5 100644
--- a/src/ratpoison.h
+++ b/src/ratpoison.h
@@ -7,12 +7,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* ratpoison is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
@@ -43,18 +43,18 @@
#define PRINT_LINE(type) printf (PACKAGE ":%s:%d: %s: ",__FILE__, __LINE__, #type)
/* Error and debug reporting macros. */
-#define PRINT_ERROR(fmt) \
-do { \
- PRINT_LINE (error); \
- printf fmt; \
- fflush (stdout); \
+#define PRINT_ERROR(fmt) \
+do { \
+ PRINT_LINE (error); \
+ printf fmt; \
+ fflush (stdout); \
} while (0)
#ifdef DEBUG
-#define PRINT_DEBUG(fmt) \
-do { \
- PRINT_LINE (debug); \
- printf fmt; \
+#define PRINT_DEBUG(fmt) \
+do { \
+ PRINT_LINE (debug); \
+ printf fmt; \
fflush (stdout); \
} while (0)
#else
diff --git a/src/sbuf.c b/src/sbuf.c
index 53c1490..8e4556d 100644
--- a/src/sbuf.c
+++ b/src/sbuf.c
@@ -7,12 +7,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* ratpoison is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
@@ -29,7 +29,7 @@ sbuf_new (size_t initsz)
{
struct sbuf *b = (struct sbuf*) xmalloc (sizeof (struct sbuf));
- if (initsz < 1)
+ if (initsz < 1)
initsz = 1;
b->data = (char*) xmalloc (initsz);
@@ -47,8 +47,8 @@ sbuf_free (struct sbuf *b)
if (b != NULL)
{
if (b->data != NULL)
- free (b->data);
-
+ free (b->data);
+
free (b);
}
}
@@ -78,7 +78,7 @@ sbuf_nconcat (struct sbuf *b, const char *str, int len)
b->data = (char*) xrealloc (b->data, minsz);
b->maxsz = minsz;
}
-
+
memcpy (b->data + b->len, str, minsz - b->len - 1);
b->len = minsz - 1;
*(b->data + b->len) = 0;
diff --git a/src/sbuf.h b/src/sbuf.h
index 071ab7d..ae4ea9c 100644
--- a/src/sbuf.h
+++ b/src/sbuf.h
@@ -7,12 +7,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* ratpoison is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
@@ -24,7 +24,7 @@
#include <stdlib.h>
-struct
+struct
sbuf
{
char *data;
diff --git a/src/screen.c b/src/screen.c
index 07446d7..4bf17c0 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* ratpoison is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
@@ -115,7 +115,7 @@ frameset_free (struct list_head *head)
list_for_each_safe_entry (frame, iter, tmp, head, node)
{
/* FIXME: what if frames has memory inside its struct
- that needs to be freed? */
+ that needs to be freed? */
free (frame);
}
}
@@ -128,9 +128,9 @@ screen_get_frame (rp_screen *s, int frame_num)
list_for_each_entry (cur, &s->frames, node)
{
if (cur->number == frame_num)
- return cur;
+ return cur;
}
-
+
return NULL;
}
@@ -143,9 +143,9 @@ screen_find_frame_by_frame (rp_screen *s, rp_frame *f)
{
PRINT_DEBUG (("cur=%p f=%p\n", cur, f));
if (cur == f)
- return cur;
+ return cur;
}
-
+
return NULL;
}
@@ -176,13 +176,13 @@ void
init_screens (int screen_arg, int screen_num)
{
int i;
-
+
/* Get the number of screens */
if (rp_have_xinerama)
num_screens = xine_screen_count;
else
num_screens = ScreenCount (dpy);
-
+
/* make sure the screen specified is valid. */
if (screen_arg)
{
@@ -190,18 +190,18 @@ init_screens (int screen_arg, int screen_num)
* disable Xinerama in this case.
*/
if (rp_have_xinerama)
- {
- fprintf (stderr, "Warning: selecting a specific Xinerama screen is not implemented.\n");
- rp_have_xinerama = 0;
- screen_num = 0;
- num_screens = ScreenCount(dpy);
- }
-
+ {
+ fprintf (stderr, "Warning: selecting a specific Xinerama screen is not implemented.\n");
+ rp_have_xinerama = 0;
+ screen_num = 0;
+ num_screens = ScreenCount(dpy);
+ }
+
if (screen_num < 0 || screen_num >= num_screens)
- {
- fprintf (stderr, "%d is an invalid screen for the display\n", screen_num);
- exit (EXIT_FAILURE);
- }
+ {
+ fprintf (stderr, "%d is an invalid screen for the display\n", screen_num);
+ exit (EXIT_FAILURE);
+ }
/* we're only going to use one screen. */
num_screens = 1;
@@ -221,9 +221,9 @@ init_screens (int screen_arg, int screen_num)
else
{
for (i=0; i<num_screens; i++)
- {
- init_screen (&screens[i], i);
- }
+ {
+ init_screen (&screens[i], i);
+ }
}
}
@@ -250,7 +250,7 @@ init_screen (rp_screen *s, int screen_num)
xine_screen_num = screen_num;
screen_num = DefaultScreen(dpy);
xinerama_get_screen_info(xine_screen_num,
- &s->left, &s->top, &s->width, &s->height);
+ &s->left, &s->top, &s->width, &s->height);
}
else
{
@@ -265,13 +265,13 @@ init_screen (rp_screen *s, int screen_num)
there is already a WM running and the X Error handler will catch
it, terminating ratpoison. */
XSelectInput(dpy, RootWindow (dpy, screen_num),
- PropertyChangeMask | ColormapChangeMask
- | SubstructureRedirectMask | SubstructureNotifyMask );
+ PropertyChangeMask | ColormapChangeMask
+ | SubstructureRedirectMask | SubstructureNotifyMask );
XSync (dpy, False);
/* Add netwm support. FIXME: I think this is busted. */
XChangeProperty (dpy, RootWindow (dpy, screen_num),
- _net_supported, XA_ATOM, 32, PropModeReplace, &_net_wm_pid, 1);
+ _net_supported, XA_ATOM, 32, PropModeReplace, &_net_wm_pid, 1);
/* Set the numset for the frames to our global numset. */
s->frames_numset = rp_frame_numset;
@@ -285,7 +285,7 @@ init_screen (rp_screen *s, int screen_num)
dot = strrchr(s->display_string, '.');
if (dot)
- sprintf(dot, ".%i", screen_num);
+ sprintf(dot, ".%i", screen_num);
}
PRINT_DEBUG (("%s\n", s->display_string));
@@ -294,7 +294,7 @@ init_screen (rp_screen *s, int screen_num)
s->xine_screen_num = xine_screen_num;
s->root = RootWindow (dpy, screen_num);
s->def_cmap = DefaultColormap (dpy, screen_num);
-
+
init_rat_cursor (s);
s->fg_color = BlackPixel (dpy, s->screen_num);
@@ -307,38 +307,38 @@ init_screen (rp_screen *s, int screen_num)
gv.line_width = 1;
gv.subwindow_mode = IncludeInferiors;
gv.font = defaults.font->fid;
- s->normal_gc = XCreateGC(dpy, s->root,
- GCForeground | GCBackground | GCFunction
- | GCLineWidth | GCSubwindowMode | GCFont,
- &gv);
+ s->normal_gc = XCreateGC(dpy, s->root,
+ GCForeground | GCBackground | GCFunction
+ | GCLineWidth | GCSubwindowMode | GCFont,
+ &gv);
/* Create the program bar window. */
s->bar_is_raised = 0;
- s->bar_window = XCreateSimpleWindow (dpy, s->root, 0, 0, 1, 1,
- defaults.bar_border_width,
- s->fg_color, s->bg_color);
+ s->bar_window = XCreateSimpleWindow (dpy, s->root, 0, 0, 1, 1,
+ defaults.bar_border_width,
+ s->fg_color, s->bg_color);
/* Setup the window that will receive all keystrokes once the prefix
key has been pressed. */
- s->key_window = XCreateSimpleWindow (dpy, s->root, 0, 0, 1, 1, 0,
- WhitePixel (dpy, s->screen_num),
- BlackPixel (dpy, s->screen_num));
+ s->key_window = XCreateSimpleWindow (dpy, s->root, 0, 0, 1, 1, 0,
+ WhitePixel (dpy, s->screen_num),
+ BlackPixel (dpy, s->screen_num));
XSelectInput (dpy, s->key_window, KeyPressMask | KeyReleaseMask);
XMapWindow (dpy, s->key_window);
/* Create the input window. */
- s->input_window = XCreateSimpleWindow (dpy, s->root, 0, 0, 1, 1,
- defaults.bar_border_width,
- s->fg_color, s->bg_color);
+ s->input_window = XCreateSimpleWindow (dpy, s->root, 0, 0, 1, 1,
+ defaults.bar_border_width,
+ s->fg_color, s->bg_color);
XSelectInput (dpy, s->input_window, KeyPressMask | KeyReleaseMask);
/* Create the frame indicator window */
- s->frame_window = XCreateSimpleWindow (dpy, s->root, 1, 1, 1, 1, defaults.bar_border_width,
- s->fg_color, s->bg_color);
+ s->frame_window = XCreateSimpleWindow (dpy, s->root, 1, 1, 1, 1, defaults.bar_border_width,
+ s->fg_color, s->bg_color);
/* Create the help window */
s->help_window = XCreateSimpleWindow (dpy, s->root, s->left, s->top, s->width,
- s->height, 0, s->fg_color, s->bg_color);
+ s->height, 0, s->fg_color, s->bg_color);
XSelectInput (dpy, s->help_window, KeyPressMask);
XSync (dpy, 0);
@@ -378,16 +378,16 @@ screen_dump (rp_screen *screen)
{
char *tmp;
struct sbuf *s;
-
+
s = sbuf_new (0);
- sbuf_printf (s, "%d %d %d %d %d %d",
- (rp_have_xinerama)?screen->xine_screen_num:screen->screen_num,
- screen->left,
- screen->top,
- screen->width,
- screen->height,
- (current_screen() == screen)?1:0 /* is current? */
- );
+ sbuf_printf (s, "%d %d %d %d %d %d",
+ (rp_have_xinerama)?screen->xine_screen_num:screen->screen_num,
+ screen->left,
+ screen->top,
+ screen->width,
+ screen->height,
+ (current_screen() == screen)?1:0 /* is current? */
+ );
/* Extract the string and return it, and don't forget to free s. */
tmp = sbuf_get (s);
diff --git a/src/screen.h b/src/screen.h
index ee5b3eb..adad4f1 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* ratpoison is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
diff --git a/src/split.c b/src/split.c
index 62da8e7..109740f 100644
--- a/src/split.c
+++ b/src/split.c
@@ -96,7 +96,7 @@ set_frames_window (rp_frame *frame, rp_window *win)
{
frame->win_number = win->number;
win->frame_number = frame->number;
-
+
/* We need to make sure that win and frame are on the same screen,
* since with Xinerama, windows can move from one screen to another.
*/
@@ -119,8 +119,8 @@ frames_screen (rp_frame *frame)
for (i=0; i<num_screens; i++)
list_for_each_entry (cur, &screens[i].frames, node)
{
- if (frame == cur)
- return &screens[i];
+ if (frame == cur)
+ return &screens[i];
}
/* This SHOULD be impossible to get to. FIXME: It'll crash higher up if we
@@ -136,9 +136,9 @@ maximize_all_windows_in_frame (rp_frame *frame)
list_for_each_entry (win, &rp_mapped_window, node)
{
if (win->frame_number == frame->number)
- {
- maximize (win);
- }
+ {
+ maximize (win);
+ }
}
}
@@ -200,14 +200,14 @@ find_last_frame ()
rp_screen *s = &screens[i];
list_for_each_entry (cur, &s->frames, node)
- {
- if (cur->number != current_screen()->current_frame
- && cur->last_access > last_access)
- {
- last_access = cur->last_access;
- last = cur;
- }
- }
+ {
+ if (cur->number != current_screen()->current_frame
+ && cur->last_access > last_access)
+ {
+ last_access = cur->last_access;
+ last = cur;
+ }
+ }
}
return last;
@@ -258,11 +258,11 @@ window_fits_in_frame (rp_window *win, rp_frame *frame)
if (win->hints->flags & PMinSize)
{
if (win->hints->min_width > frame->width
- ||
- win->hints->min_height > frame->height)
- {
- return 0;
- }
+ ||
+ win->hints->min_height > frame->height)
+ {
+ return 0;
+ }
}
return 1;
@@ -281,15 +281,15 @@ find_window_for_frame (rp_frame *frame)
list_for_each_entry (cur, &rp_current_group->mapped_windows, node)
{
if ((cur->win->scr == s || rp_have_xinerama)
- && cur->win != current_window()
- && !find_windows_frame (cur->win)
- && cur->win->last_access >= last_access
- && window_fits_in_frame (cur->win, frame)
- && cur->win->frame_number == EMPTY)
- {
- most_recent = cur;
- last_access = cur->win->last_access;
- }
+ && cur->win != current_window()
+ && !find_windows_frame (cur->win)
+ && cur->win->last_access >= last_access
+ && window_fits_in_frame (cur->win, frame)
+ && cur->win->frame_number == EMPTY)
+ {
+ most_recent = cur;
+ last_access = cur->win->last_access;
+ }
}
if (most_recent)
@@ -393,17 +393,17 @@ remove_all_splits ()
list_for_each_entry (win, &rp_mapped_window, node)
{
if (win->frame_number != s->current_frame && win->scr == s)
- hide_window (win);
+ hide_window (win);
}
/* Delete all the frames except the current one. */
list_for_each_safe_entry (frame, iter, tmp, &s->frames, node)
{
if (frame->number != s->current_frame)
- {
- list_del (&frame->node);
- frame_free (s, frame);
- }
+ {
+ list_del (&frame->node);
+ frame_free (s, frame);
+ }
}
/* Maximize the frame and the windows in the frame. */
@@ -431,11 +431,11 @@ resize_shrink_to_window (rp_frame *frame)
success. */
static int
resize_frame (rp_frame *frame, rp_frame *pusher, int diff,
- int (*c1)(rp_frame *), int (c2)(rp_frame *),
- int (*c3)(rp_frame *), int (c4)(rp_frame *),
- void (*resize1)(rp_frame *, int),
- void (*resize2)(rp_frame *, int),
- int (*resize3)(rp_frame *, rp_frame *, int))
+ int (*c1)(rp_frame *), int (c2)(rp_frame *),
+ int (*c3)(rp_frame *), int (c4)(rp_frame *),
+ void (*resize1)(rp_frame *, int),
+ void (*resize2)(rp_frame *, int),
+ int (*resize3)(rp_frame *, rp_frame *, int))
{
rp_screen *s = frames_screen (frame);
rp_frame *cur;
@@ -446,46 +446,46 @@ resize_frame (rp_frame *frame, rp_frame *pusher, int diff,
{
if (cur == frame || cur == pusher) continue;
/* If cur is touching frame along the axis that is being
- moved then this frame is affected by the resize. */
+ moved then this frame is affected by the resize. */
if ((*c1)(cur) == (*c3)(frame))
- {
- /* If the frame can't get any smaller, then fail. */
- if (diff > 0
- && abs ((*c3)(cur) - (*c1)(cur)) - diff <= defaults.window_border_width * 2)
- return -1;
- /* Test for this circumstance:
- --+
- | |+-+
- |f||c|
- | |+-+
- --+
-
- In this case, resizing cur will not affect any other
- frames, so just do the resize.
- */
- if (((*c2)(cur) >= (*c2)(frame))
- && (*c4)(cur) <= (*c4)(frame))
- {
- (*resize2)(cur, -diff);
- maximize_all_windows_in_frame (cur);
- }
- /* Otherwise, cur's corners are either strictly outside
- frame's corners, or one of them is inside and the other
- isn't. In either of these cases, resizing cur will affect
- other adjacent frames, so find them and resize them first
- (recursive step) and then resize cur. */
- else if (((*c2)(cur) < (*c2)(frame)
- && (*c4)(cur) > (*c4)(frame))
- || ((*c2)(cur) >= (*c2)(frame)
- && (*c2)(cur) < (*c4)(frame))
- || ((*c4)(cur) > (*c2)(frame)
- && (*c4)(cur) <= (*c4)(frame)))
- {
- /* Attempt to resize cur. */
- if (resize3 (cur, frame, -diff) == -1)
- return -1;
- }
- }
+ {
+ /* If the frame can't get any smaller, then fail. */
+ if (diff > 0
+ && abs ((*c3)(cur) - (*c1)(cur)) - diff <= defaults.window_border_width * 2)
+ return -1;
+ /* Test for this circumstance:
+ --+
+ | |+-+
+ |f||c|
+ | |+-+
+ --+
+
+ In this case, resizing cur will not affect any other
+ frames, so just do the resize.
+ */
+ if (((*c2)(cur) >= (*c2)(frame))
+ && (*c4)(cur) <= (*c4)(frame))
+ {
+ (*resize2)(cur, -diff);
+ maximize_all_windows_in_frame (cur);
+ }
+ /* Otherwise, cur's corners are either strictly outside
+ frame's corners, or one of them is inside and the other
+ isn't. In either of these cases, resizing cur will affect
+ other adjacent frames, so find them and resize them first
+ (recursive step) and then resize cur. */
+ else if (((*c2)(cur) < (*c2)(frame)
+ && (*c4)(cur) > (*c4)(frame))
+ || ((*c2)(cur) >= (*c2)(frame)
+ && (*c2)(cur) < (*c4)(frame))
+ || ((*c4)(cur) > (*c2)(frame)
+ && (*c4)(cur) <= (*c4)(frame)))
+ {
+ /* Attempt to resize cur. */
+ if (resize3 (cur, frame, -diff) == -1)
+ return -1;
+ }
+ }
}
/* Finally, resize the frame and the windows inside. */
@@ -505,8 +505,8 @@ static int
resize_frame_right (rp_frame *frame, rp_frame *pusher, int diff)
{
return resize_frame (frame, pusher, diff,
- frame_left, frame_top, frame_right, frame_bottom,
- frame_resize_right, frame_resize_left, resize_frame_left);
+ frame_left, frame_top, frame_right, frame_bottom,
+ frame_resize_right, frame_resize_left, resize_frame_left);
}
/* Resize frame by moving it's left side. */
@@ -514,8 +514,8 @@ static int
resize_frame_left (rp_frame *frame, rp_frame *pusher, int diff)
{
return resize_frame (frame, pusher, diff,
- frame_right, frame_top, frame_left, frame_bottom,
- frame_resize_left, frame_resize_right, resize_frame_right);
+ frame_right, frame_top, frame_left, frame_bottom,
+ frame_resize_left, frame_resize_right, resize_frame_right);
}
/* Resize frame by moving it's top side. */
@@ -523,8 +523,8 @@ static int
resize_frame_top (rp_frame *frame, rp_frame *pusher, int diff)
{
return resize_frame (frame, pusher, diff,
- frame_bottom, frame_left, frame_top, frame_right,
- frame_resize_up, frame_resize_down, resize_frame_bottom);
+ frame_bottom, frame_left, frame_top, frame_right,
+ frame_resize_up, frame_resize_down, resize_frame_bottom);
}
/* Resize frame by moving it's bottom side. */
@@ -532,8 +532,8 @@ static int
resize_frame_bottom (rp_frame *frame, rp_frame *pusher, int diff)
{
return resize_frame (frame, pusher, diff,
- frame_top, frame_left, frame_bottom, frame_right,
- frame_resize_down, frame_resize_up, resize_frame_top);
+ frame_top, frame_left, frame_bottom, frame_right,
+ frame_resize_down, frame_resize_up, resize_frame_top);
}
/* Resize frame diff pixels by expanding it to the right. If the frame
@@ -696,9 +696,9 @@ frame_overlaps (rp_frame *frame)
list_for_each_entry (cur, &s->frames, node)
{
if (cur != frame && frames_overlap (cur, frame))
- {
- return 1;
- }
+ {
+ return 1;
+ }
}
return 0;
}
@@ -729,92 +729,92 @@ remove_frame (rp_frame *frame)
int fits = 0;
/* if (cur->win_number != EMPTY) */
-/* { */
-/* PRINT_DEBUG (("Trying frame containing window '%s'\n", window_name (cur->win))); */
-/* } */
+/* { */
+/* PRINT_DEBUG (("Trying frame containing window '%s'\n", window_name (cur->win))); */
+/* } */
/* else */
-/* { */
-/* PRINT_DEBUG (("Trying some empty frame\n")); */
-/* } */
+/* { */
+/* PRINT_DEBUG (("Trying some empty frame\n")); */
+/* } */
/* Backup the frame */
memcpy (&tmp_frame, cur, sizeof (rp_frame));
if (frame_is_below (frame, cur)
- || frame_is_above (frame, cur))
- {
- if (frame_is_below (frame, cur))
- cur->y = frame->y;
- cur->height += frame->height;
- }
+ || frame_is_above (frame, cur))
+ {
+ if (frame_is_below (frame, cur))
+ cur->y = frame->y;
+ cur->height += frame->height;
+ }
PRINT_DEBUG (("Attempting vertical Frame y=%d height=%d\n", cur->y, cur->height));
PRINT_DEBUG (("New Total Area: %d\n", total_frame_area(s)));
/* If the area is bigger than before, the frame takes up too
- much space. If the current frame and the deleted frame DON'T
- overlap then the current window took up just the right amount
- of space but didn't take up the space left behind by the
- deleted window. If any active frames overlap, it could have
- taken up the right amount of space, overlaps with the deleted
- frame but obviously didn't fit. */
+ much space. If the current frame and the deleted frame DON'T
+ overlap then the current window took up just the right amount
+ of space but didn't take up the space left behind by the
+ deleted window. If any active frames overlap, it could have
+ taken up the right amount of space, overlaps with the deleted
+ frame but obviously didn't fit. */
if (total_frame_area(s) > area || !frames_overlap (cur, frame) || frame_overlaps (cur))
- {
- PRINT_DEBUG (("Didn't fit vertically\n"));
+ {
+ PRINT_DEBUG (("Didn't fit vertically\n"));
- /* Restore the current window's frame */
- memcpy (cur, &tmp_frame, sizeof (rp_frame));
- }
+ /* Restore the current window's frame */
+ memcpy (cur, &tmp_frame, sizeof (rp_frame));
+ }
else
- {
- PRINT_DEBUG (("It fit vertically!!\n"));
+ {
+ PRINT_DEBUG (("It fit vertically!!\n"));
- /* update the frame backup */
- memcpy (&tmp_frame, cur, sizeof (rp_frame));
- fits = 1;
- }
+ /* update the frame backup */
+ memcpy (&tmp_frame, cur, sizeof (rp_frame));
+ fits = 1;
+ }
if (frame_is_left (frame, cur)
- || frame_is_right (frame, cur))
- {
- if (frame_is_right (frame, cur))
- cur->x = frame->x;
- cur->width += frame->width;
- }
+ || frame_is_right (frame, cur))
+ {
+ if (frame_is_right (frame, cur))
+ cur->x = frame->x;
+ cur->width += frame->width;
+ }
PRINT_DEBUG (("Attempting horizontal Frame x=%d width=%d\n", cur->x, cur->width));
PRINT_DEBUG (("New Total Area: %d\n", total_frame_area(s)));
/* Same test as the vertical test, above. */
if (total_frame_area(s) > area || !frames_overlap (cur, frame) || frame_overlaps (cur))
- {
- PRINT_DEBUG (("Didn't fit horizontally\n"));
+ {
+ PRINT_DEBUG (("Didn't fit horizontally\n"));
- /* Restore the current window's frame */
- memcpy (cur, &tmp_frame, sizeof (rp_frame));
- }
+ /* Restore the current window's frame */
+ memcpy (cur, &tmp_frame, sizeof (rp_frame));
+ }
else
- {
- PRINT_DEBUG (("It fit horizontally!!\n"));
- fits = 1;
- }
+ {
+ PRINT_DEBUG (("It fit horizontally!!\n"));
+ fits = 1;
+ }
if (fits)
- {
- /* The current frame fits into the new space so keep its
- new frame parameters and maximize the window to fit
- the new frame size. */
- if (cur->win_number != EMPTY)
- {
- win = find_window_number (cur->win_number);
- maximize_all_windows_in_frame (cur);
- XRaiseWindow (dpy, win->w);
- }
- }
+ {
+ /* The current frame fits into the new space so keep its
+ new frame parameters and maximize the window to fit
+ the new frame size. */
+ if (cur->win_number != EMPTY)
+ {
+ win = find_window_number (cur->win_number);
+ maximize_all_windows_in_frame (cur);
+ XRaiseWindow (dpy, win->w);
+ }
+ }
else
- {
- memcpy (cur, &tmp_frame, sizeof (rp_frame));
- }
+ {
+ memcpy (cur, &tmp_frame, sizeof (rp_frame));
+ }
}
frame_free (s, frame);
@@ -859,7 +859,7 @@ set_active_frame (rp_frame *frame)
show_frame_indicator();
/* run the frame switch hook. We call it in here because this is
- when a frame switch ACTUALLY (for sure) happens. */
+ when a frame switch ACTUALLY (for sure) happens. */
hook_run (&rp_switch_frame_hook);
}
@@ -927,18 +927,18 @@ show_frame_message (char *msg)
hide_frame_indicator ();
XMoveResizeWindow (dpy, s->frame_window,
- s->left + frame->x + frame->width / 2 - width / 2,
- s->top + frame->y + frame->height / 2 - height / 2,
- width, height);
+ s->left + frame->x + frame->width / 2 - width / 2,
+ s->top + frame->y + frame->height / 2 - height / 2,
+ width, height);
XMapRaised (dpy, s->frame_window);
XClearWindow (dpy, s->frame_window);
XSync (dpy, False);
XDrawString (dpy, s->frame_window, s->normal_gc,
- defaults.bar_x_padding,
- defaults.bar_y_padding + defaults.font->max_bounds.ascent,
- msg, strlen (msg));
+ defaults.bar_x_padding,
+ defaults.bar_y_padding + defaults.font->max_bounds.ascent,
+ msg, strlen (msg));
}
rp_frame *
@@ -950,10 +950,10 @@ find_frame_up (rp_frame *frame)
list_for_each_entry (cur, &s->frames, node)
{
if (frame->y == cur->y + cur->height)
- {
- if (frame->x >= cur->x && frame->x < cur->x + cur->width)
- return cur;
- }
+ {
+ if (frame->x >= cur->x && frame->x < cur->x + cur->width)
+ return cur;
+ }
}
return NULL;
@@ -968,10 +968,10 @@ find_frame_down (rp_frame *frame)
list_for_each_entry (cur, &s->frames, node)
{
if (frame->y + frame->height == cur->y)
- {
- if (frame->x >= cur->x && frame->x < cur->x + cur->width)
- return cur;
- }
+ {
+ if (frame->x >= cur->x && frame->x < cur->x + cur->width)
+ return cur;
+ }
}
return NULL;
@@ -986,10 +986,10 @@ find_frame_left (rp_frame *frame)
list_for_each_entry (cur, &s->frames, node)
{
if (frame->x == cur->x + cur->width)
- {
- if (frame->y >= cur->y && frame->y < cur->y + cur->height)
- return cur;
- }
+ {
+ if (frame->y >= cur->y && frame->y < cur->y + cur->height)
+ return cur;
+ }
}
return NULL;
@@ -1004,10 +1004,10 @@ find_frame_right (rp_frame *frame)
list_for_each_entry (cur, &s->frames, node)
{
if (frame->x + frame->width == cur->x)
- {
- if (frame->y >= cur->y && frame->y < cur->y + cur->height)
- return cur;
- }
+ {
+ if (frame->y >= cur->y && frame->y < cur->y + cur->height)
+ return cur;
+ }
}
return NULL;
@@ -1022,14 +1022,13 @@ find_frame_number (int num)
for (i=0; i<num_screens; i++)
{
rp_screen *s = &screens[i];
-
+
list_for_each_entry (cur, &s->frames, node)
- {
- if (cur->number == num)
- return cur;
- }
+ {
+ if (cur->number == num)
+ return cur;
+ }
}
return NULL;
}
-
diff --git a/src/window.c b/src/window.c
index 89e48d1..e3a1e89 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1,4 +1,4 @@
-/* functions for handling the window list
+/* functions for handling the window list
* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca>
*
* This file is part of ratpoison.
@@ -19,7 +19,7 @@
* Boston, MA 02111-1307 USA
*/
-#include <unistd.h> /* for getsid */
+#include <unistd.h> /* for getsid */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -38,7 +38,7 @@ get_mouse_position (rp_window *win, int *mouse_x, int *mouse_y)
Window root_win, child_win;
int root_x, root_y;
unsigned int mask;
-
+
XQueryPointer (dpy, win->scr->root, &root_win, &child_win, mouse_x, mouse_y, &root_x, &root_y, &mask);
}
@@ -63,11 +63,11 @@ update_window_gravity (rp_window *win)
/* if (win->hints->win_gravity == ForgetGravity) */
/* { */
if (win->transient)
- win->gravity = defaults.trans_gravity;
+ win->gravity = defaults.trans_gravity;
else if (win->hints->flags & PMaxSize || win->hints->flags & PAspect)
- win->gravity = defaults.maxsize_gravity;
+ win->gravity = defaults.maxsize_gravity;
else
- win->gravity = defaults.win_gravity;
+ win->gravity = defaults.win_gravity;
/* } */
/* else */
/* { */
@@ -87,19 +87,19 @@ window_name (rp_window *win)
{
case WIN_NAME_RES_NAME:
if (win->res_name)
- return win->res_name;
+ return win->res_name;
else return win->user_name;
-
+
case WIN_NAME_RES_CLASS:
if (win->res_class)
- return win->res_class;
+ return win->res_class;
else return win->user_name;
/* if we're not looking for the res name or res class, then
- we're looking for the window title. */
+ we're looking for the window title. */
default:
if (win->wm_name)
- return win->wm_name;
+ return win->wm_name;
else return win->user_name;
}
@@ -122,8 +122,8 @@ get_child_info (Window w)
pid_t sid;
status = XGetWindowProperty (dpy, w, _net_wm_pid,
- 0, 0, False, XA_CARDINAL,
- &type_ret, &format_ret, &nitems, &bytes_after, &req);
+ 0, 0, False, XA_CARDINAL,
+ &type_ret, &format_ret, &nitems, &bytes_after, &req);
if (status != Success || req == NULL)
{
@@ -132,13 +132,13 @@ get_child_info (Window w)
}
/* XGetWindowProperty always allocates one extra byte even if
- the property is zero length. */
+ the property is zero length. */
XFree (req);
status = XGetWindowProperty (dpy, w, _net_wm_pid,
- 0, (bytes_after / 4) + (bytes_after % 4 ? 1 : 0),
- False, XA_CARDINAL, &type_ret, &format_ret, &nitems,
- &bytes_after, &req);
+ 0, (bytes_after / 4) + (bytes_after % 4 ? 1 : 0),
+ False, XA_CARDINAL, &type_ret, &format_ret, &nitems,
+ &bytes_after, &req);
if (status != Success || req == NULL)
{
@@ -157,9 +157,9 @@ get_child_info (Window w)
{
PRINT_DEBUG(("cur->pid=%d sid=%d\n", cur->pid, getsid (cur->pid)));
if (sid == getsid (cur->pid))
- return cur;
+ return cur;
}
-
+
return NULL;
}
@@ -225,7 +225,7 @@ add_to_window_list (rp_screen *s, Window w)
PRINT_DEBUG(("frame_num: %d\n", frame_num));
if (frame_num >= 0)
new_window->intended_frame_number = frame_num;
-
+
return new_window;
}
@@ -252,13 +252,13 @@ find_window (Window w)
win = find_window_in_list (w, &rp_mapped_window);
- if (!win)
+ if (!win)
{
win = find_window_in_list (w, &rp_unmapped_window);
if (win)
- PRINT_DEBUG (("Window found in unmapped window list\n"));
+ PRINT_DEBUG (("Window found in unmapped window list\n"));
else
- PRINT_DEBUG (("Window not found.\n"));
+ PRINT_DEBUG (("Window not found.\n"));
}
else
{
@@ -296,8 +296,8 @@ find_window_name (char *name)
list_for_each_entry (cur, &rp_current_group->mapped_windows, node)
{
- if (str_comp (name, window_name (cur->win), strlen (name)))
- return cur->win;
+ if (str_comp (name, window_name (cur->win), strlen (name)))
+ return cur->win;
}
/* didn't find it */
@@ -313,14 +313,14 @@ find_window_prev (rp_window *w)
if (!w) return NULL;
- for (cur = list_prev_entry (w, &rp_mapped_window, node);
- cur != w;
+ for (cur = list_prev_entry (w, &rp_mapped_window, node);
+ cur != w;
cur = list_prev_entry (cur, &rp_mapped_window, node))
{
if (!find_windows_frame (cur))
- {
- return cur;
- }
+ {
+ return cur;
+ }
}
return NULL;
@@ -335,14 +335,14 @@ find_window_next (rp_window *w)
if (!w) return NULL;
- for (cur = list_next_entry (w, &rp_mapped_window, node);
- cur != w;
+ for (cur = list_next_entry (w, &rp_mapped_window, node);
+ cur != w;
cur = list_next_entry (cur, &rp_mapped_window, node))
{
if (!find_windows_frame (cur))
- {
- return cur;
- }
+ {
+ return cur;
+ }
}
return NULL;
@@ -366,10 +366,10 @@ insert_into_list (rp_window *win, struct list_head *list)
list_for_each_entry (cur, list, node)
{
if (cur->number > win->number)
- {
- list_add_tail (&win->node, &cur->node);
- return;
- }
+ {
+ list_add_tail (&win->node, &cur->node);
+ return;
+ }
}
list_add_tail(&win->node, list);
@@ -381,7 +381,7 @@ save_mouse_position (rp_window *win)
Window root_win, child_win;
int root_x, root_y;
unsigned int mask;
-
+
/* In the case the XQueryPointer raises a BadWindow error, the
window is not mapped or has been destroyed so it doesn't matter
what we store in mouse_x and mouse_y since they will never be
@@ -389,8 +389,8 @@ save_mouse_position (rp_window *win)
ignore_badwindow++;
- XQueryPointer (dpy, win->w, &root_win, &child_win,
- &root_x, &root_y, &win->mouse_x, &win->mouse_y, &mask);
+ XQueryPointer (dpy, win->w, &root_win, &child_win,
+ &root_x, &root_y, &win->mouse_x, &win->mouse_y, &mask);
ignore_badwindow--;
}
@@ -417,10 +417,10 @@ give_window_focus (rp_window *win, rp_window *last_win)
if (defaults.warp)
{
PRINT_DEBUG (("Warp pointer\n"));
- XWarpPointer (dpy, None, win->w,
- 0, 0, 0, 0, win->mouse_x, win->mouse_y);
+ XWarpPointer (dpy, None, win->w,
+ 0, 0, 0, 0, win->mouse_x, win->mouse_y);
}
-
+
/* Swap colormaps */
if (last_win != NULL) XUninstallColormap (dpy, last_win->colormap);
XInstallColormap (dpy, win->colormap);
@@ -444,7 +444,7 @@ unhide_transient_for (rp_window *win)
frame = find_windows_frame (win);
transient_for = find_window (win->transient_for);
- if (transient_for == NULL)
+ if (transient_for == NULL)
{
PRINT_DEBUG (("Can't find transient_for for '%s'\n", win->name ));
return;
@@ -456,17 +456,17 @@ unhide_transient_for (rp_window *win)
maximize (transient_for);
PRINT_DEBUG (("unhide transient window: %s\n", transient_for->name));
-
+
unhide_window_below (transient_for);
- if (transient_for->transient)
- {
- unhide_transient_for (transient_for);
- }
+ if (transient_for->transient)
+ {
+ unhide_transient_for (transient_for);
+ }
set_frames_window (frame, win);
}
- else if (transient_for->transient)
+ else if (transient_for->transient)
{
unhide_transient_for (transient_for);
}
@@ -484,7 +484,7 @@ hide_transient_for_between (rp_window *win, rp_window *last)
if (!win->transient) return;
transient_for = find_window (win->transient_for);
- if (transient_for == last)
+ if (transient_for == last)
{
PRINT_DEBUG (("Can't find transient_for for '%s'\n", win->name ));
return;
@@ -496,7 +496,7 @@ hide_transient_for_between (rp_window *win, rp_window *last)
hide_window (transient_for);
}
- if (transient_for->transient)
+ if (transient_for->transient)
{
hide_transient_for (transient_for);
}
@@ -530,9 +530,9 @@ is_transient_ancestor (rp_window *win, rp_window *transient_for)
{
tmp = find_window (tmp->transient_for);
if (tmp == transient_for)
- return 1;
+ return 1;
} while (tmp && tmp->transient);
-
+
return 0;
}
#endif
@@ -540,7 +540,7 @@ is_transient_ancestor (rp_window *win, rp_window *transient_for)
/* In the current frame, set the active window to win. win will have focus. */
void set_active_window (rp_window *win)
{
- set_active_window_body(win, 0);
+ set_active_window_body(win, 0);
}
void set_active_window_force (rp_window *win)
@@ -567,29 +567,29 @@ set_active_window_body (rp_window *win, int force)
{
/* use the intended frame if we can. */
if (win->intended_frame_number >= 0)
- {
- frame = screen_get_frame (current_screen(), win->intended_frame_number);
- win->intended_frame_number = -1;
- if (frame != current_frame())
- last_frame = current_frame();
- }
+ {
+ frame = screen_get_frame (current_screen(), win->intended_frame_number);
+ win->intended_frame_number = -1;
+ if (frame != current_frame())
+ last_frame = current_frame();
+ }
if (!frame)
- frame = screen_get_frame (current_screen(), current_screen()->current_frame);
+ frame = screen_get_frame (current_screen(), current_screen()->current_frame);
}
else
{
/* use the intended frame if we can. */
if (win->intended_frame_number >= 0)
- {
- frame = screen_get_frame (win->scr, win->intended_frame_number);
- win->intended_frame_number = -1;
- if (frame != current_frame())
- last_frame = current_frame();
- }
+ {
+ frame = screen_get_frame (win->scr, win->intended_frame_number);
+ win->intended_frame_number = -1;
+ if (frame != current_frame())
+ last_frame = current_frame();
+ }
if (!frame)
- frame = screen_get_frame (win->scr, win->scr->current_frame);
+ frame = screen_get_frame (win->scr, win->scr->current_frame);
}
if (frame->dedicated && !force)
@@ -597,46 +597,46 @@ set_active_window_body (rp_window *win, int force)
/* Try to find a non-dedicated frame. */
rp_frame *cur;
rp_screen *scr;
- int done;
+ int done;
scr = (rp_have_xinerama)?&screens[rp_current_screen]:win->scr;
done = 0;
/* Try the only / current screen... */
- for (cur = list_next_entry (frame, &scr->frames, node);
- cur != frame && !done;
- cur = list_next_entry (cur, &scr->frames, node))
- {
- if (!cur->dedicated)
- {
- set_active_frame (cur);
- last_frame = frame;
- frame = cur;
- done = 1;
- }
- }
+ for (cur = list_next_entry (frame, &scr->frames, node);
+ cur != frame && !done;
+ cur = list_next_entry (cur, &scr->frames, node))
+ {
+ if (!cur->dedicated)
+ {
+ set_active_frame (cur);
+ last_frame = frame;
+ frame = cur;
+ done = 1;
+ }
+ }
/* If we have Xinerama, we can check *all* screens... */
if (rp_have_xinerama && !done)
- {
- int i;
-
- for (i=0; i<num_screens && !done; i++)
- {
- if (scr == &screens[i]) continue;
- list_for_each_entry (cur,&screens[i].frames,node)
- {
- if (!cur->dedicated)
- {
- set_active_frame (cur);
- last_frame = frame;
- frame = cur;
- done = 1; /* Break outer loop. */
- break; /* Break inner loop. */
- }
- }
- }
- }
+ {
+ int i;
+
+ for (i=0; i<num_screens && !done; i++)
+ {
+ if (scr == &screens[i]) continue;
+ list_for_each_entry (cur,&screens[i].frames,node)
+ {
+ if (!cur->dedicated)
+ {
+ set_active_frame (cur);
+ last_frame = frame;
+ frame = cur;
+ done = 1; /* Break outer loop. */
+ break; /* Break inner loop. */
+ }
+ }
+ }
+ }
}
last_win = set_frames_window (frame, win);
@@ -698,19 +698,19 @@ print_window_information (rp_group *group, rp_window *win)
of windows existing in multiple groups. */
win_elem = group_find_window (&group->mapped_windows, win);
if (win_elem)
- marked_message_printf (0, 0, MESSAGE_WINDOW_INFORMATION,
- win_elem->number, window_name (win));
+ marked_message_printf (0, 0, MESSAGE_WINDOW_INFORMATION,
+ win_elem->number, window_name (win));
else
marked_message_printf (0, 0, "%s doesn't exist in group %d\n",
- window_name(win), group->number);
+ window_name(win), group->number);
}
/* get the window list and store it in buffer delimiting each window
with delim. mark_start and mark_end will be filled with the text
positions for the start and end of the current window. */
void
-get_window_list (char *fmt, char *delim, struct sbuf *buffer,
- int *mark_start, int *mark_end)
+get_window_list (char *fmt, char *delim, struct sbuf *buffer,
+ int *mark_start, int *mark_end)
{
rp_window_elem *we;
rp_window *other_window;
@@ -726,29 +726,29 @@ get_window_list (char *fmt, char *delim, struct sbuf *buffer,
PRINT_DEBUG (("%d-%s\n", we->number, window_name (we->win)));
if (we->win == current_window())
- *mark_start = strlen (sbuf_get (buffer));
+ *mark_start = strlen (sbuf_get (buffer));
/* A hack, pad the window with a space at the beginning and end
if there is no delimiter. */
if (!delim)
- sbuf_concat (buffer, " ");
+ sbuf_concat (buffer, " ");
format_string (fmt, we, buffer);
/* A hack, pad the window with a space at the beginning and end
if there is no delimiter. */
if (!delim)
- sbuf_concat (buffer, " ");
+ sbuf_concat (buffer, " ");
/* Only put the delimiter between the windows, and not after the the last
window. */
if (delim && we->node.next != &rp_current_group->mapped_windows)
- sbuf_concat (buffer, delim);
+ sbuf_concat (buffer, delim);
- if (we->win == current_window())
- {
- *mark_end = strlen (sbuf_get (buffer));
- }
+ if (we->win == current_window())
+ {
+ *mark_end = strlen (sbuf_get (buffer));
+ }
}
if (!strcmp (sbuf_get (buffer), ""))
diff --git a/src/window.h b/src/window.h
index 3b51316..13080c1 100644
--- a/src/window.h
+++ b/src/window.h
@@ -1,4 +1,4 @@
-/* functions for managing the window list
+/* functions for managing the window list
* Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca>
*
* This file is part of ratpoison.
@@ -7,12 +7,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* ratpoison is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
@@ -58,8 +58,8 @@ void sort_window_list_by_number ();
void insert_into_list (rp_window *win, struct list_head *list);
void print_window_information (rp_group *group, rp_window *win);
-void get_window_list (char *fmt, char *delim, struct sbuf *buffer,
- int *mark_start, int *mark_end);
+void get_window_list (char *fmt, char *delim, struct sbuf *buffer,
+ int *mark_start, int *mark_end);
void init_window_stuff ();
void free_window_stuff ();
diff --git a/src/xinerama.c b/src/xinerama.c
index 3c94d56..ab3db32 100644
--- a/src/xinerama.c
+++ b/src/xinerama.c
@@ -36,48 +36,48 @@ static XineramaScreenInfo *xine_screens = NULL;
void
init_xinerama()
{
- int evbase, errbase, major, minor;
-
- rp_have_xinerama = 0;
+ int evbase, errbase, major, minor;
-#ifdef XINERAMA
- if (xine_screens) XFree(xine_screens);
+ rp_have_xinerama = 0;
- if (!XineramaQueryExtension(dpy, &evbase, &errbase)) {
- return;
- }
+#ifdef XINERAMA
+ if (xine_screens) XFree(xine_screens);
+
+ if (!XineramaQueryExtension(dpy, &evbase, &errbase)) {
+ return;
+ }
- if (!XineramaQueryVersion(dpy, &major, &minor) != Success) {
- return;
- }
+ if (!XineramaQueryVersion(dpy, &major, &minor) != Success) {
+ return;
+ }
- if (major != 1) {
- fprintf (stderr, "Warning: Xinerama version %d.%d not supported\n", major, minor);
- return;
- }
-
- if (!XineramaIsActive(dpy)) {
- return;
- }
+ if (major != 1) {
+ fprintf (stderr, "Warning: Xinerama version %d.%d not supported\n", major, minor);
+ return;
+ }
- xine_screens = XineramaQueryScreens(dpy, &xine_screen_count);
- if ((xine_screens == NULL) || (xine_screen_count < 2)) {
- return;
- }
+ if (!XineramaIsActive(dpy)) {
+ return;
+ }
- rp_have_xinerama = 1;
+ xine_screens = XineramaQueryScreens(dpy, &xine_screen_count);
+ if ((xine_screens == NULL) || (xine_screen_count < 2)) {
+ return;
+ }
+
+ rp_have_xinerama = 1;
#endif
}
void xinerama_get_screen_info(int sc, int *x, int *y, int *w, int *h)
{
#ifdef XINERAMA
- if ((sc < xine_screen_count) && (sc >= 0)) {
- *x = xine_screens[sc].x_org;
- *y = xine_screens[sc].y_org;
- *w = xine_screens[sc].width;
- *h = xine_screens[sc].height;
- }
+ if ((sc < xine_screen_count) && (sc >= 0)) {
+ *x = xine_screens[sc].x_org;
+ *y = xine_screens[sc].y_org;
+ *w = xine_screens[sc].width;
+ *h = xine_screens[sc].height;
+ }
#endif
}
@@ -85,10 +85,9 @@ void
free_xinerama()
{
#ifdef XINERAMA
- if (xine_screens) {
- XFree(xine_screens);
- }
- rp_have_xinerama = 0;
+ if (xine_screens) {
+ XFree(xine_screens);
+ }
+ rp_have_xinerama = 0;
#endif
}
-
diff --git a/src/xinerama.h b/src/xinerama.h
index a3d19c9..2785b48 100644
--- a/src/xinerama.h
+++ b/src/xinerama.h
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* ratpoison is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,