diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | src/actions.c | 46 | ||||
-rw-r--r-- | src/events.c | 3 |
3 files changed, 43 insertions, 13 deletions
@@ -1,5 +1,12 @@ 2002-01-24 shawn <sabetts@vcn.bc.ca> + * src/actions.c (find_alias_index): new function + (cmd_alias): When an alias is already in the alias list, replace + it with the new alias. + + * src/events.c (configure_request): do not send a synthetic + configure notify event. + * src/actions.c (wingravity_to_string): Fix the north gravity string to return "n" not "ng". (cmd_defborder): return NULL when no (or a bad) argument is passed diff --git a/src/actions.c b/src/actions.c index 17fe2b1..2aadf38 100644 --- a/src/actions.c +++ b/src/actions.c @@ -2324,10 +2324,25 @@ cmd_defbarpadding (int interactive, void *data) return NULL; } +/* Search the alias table for a match. If a match is found, return its + index into the table. Otherwise return -1. */ +static int +find_alias_index (char *name) +{ + int i; + + for (i=0; i<alias_list_last; i++) + if (!strcmp (name, alias_list[i].name)) + return i; + + return -1; +} + char * cmd_alias (int interactive, void *data) { char *name, *alias; + int index; if (data == NULL) { @@ -2335,12 +2350,7 @@ cmd_alias (int interactive, void *data) return NULL; } - if (alias_list_last >= alias_list_size) - { - alias_list_size *= 2; - alias_list = xrealloc (alias_list, sizeof (cmd_alias) * alias_list_size); - } - + /* Parse out the arguments. */ name = strtok (data, " "); alias = strtok (NULL, "\0"); @@ -2349,10 +2359,26 @@ cmd_alias (int interactive, void *data) message (" alias: Two arguments required "); return NULL; } - - alias_list[alias_list_last].name = xstrdup (name); - alias_list[alias_list_last].alias = xstrdup (alias); - alias_list_last++; + + /* Are we updating an existing alias, or creating a new one? */ + index = find_alias_index (name); + if (index >= 0) + { + free (alias_list[index].alias); + alias_list[index].alias = xstrdup (alias); + } + else + { + if (alias_list_last >= alias_list_size) + { + alias_list_size *= 2; + alias_list = xrealloc (alias_list, sizeof (cmd_alias) * alias_list_size); + } + + alias_list[alias_list_last].name = xstrdup (name); + alias_list[alias_list_last].alias = xstrdup (alias); + alias_list_last++; + } return NULL; } diff --git a/src/events.c b/src/events.c index 1eb9149..db917e3 100644 --- a/src/events.c +++ b/src/events.c @@ -348,9 +348,6 @@ configure_request (XConfigureRequestEvent *e) XConfigureWindow (dpy, win->w, e->value_mask & (CWX|CWY|CWBorderWidth|CWWidth|CWHeight), &changes); - - send_configure (win->w, changes.x, changes.y, changes.width, changes.height, - border); } } else |