diff options
author | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2016-11-23 03:27:44 +0100 |
---|---|---|
committer | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2016-11-23 03:27:44 +0100 |
commit | 62aa39099e0b1f8e4d86ff9239c8f52ad017ab54 (patch) | |
tree | 945b901a7e26d7b58a4dd2b7250fd54dc6b740e9 | |
parent | 47b4beb0009cb886ef83afb4f015eb79b48475e7 (diff) | |
download | ratpoison-62aa39099e0b1f8e4d86ff9239c8f52ad017ab54.zip |
Keep frame undo/redo local to actions.c
-rw-r--r-- | src/actions.c | 29 | ||||
-rw-r--r-- | src/actions.h | 2 | ||||
-rw-r--r-- | src/data.h | 8 | ||||
-rw-r--r-- | src/globals.c | 3 | ||||
-rw-r--r-- | src/globals.h | 3 | ||||
-rw-r--r-- | src/main.c | 8 |
6 files changed, 27 insertions, 26 deletions
diff --git a/src/actions.c b/src/actions.c index d278a75..ef856cf 100644 --- a/src/actions.c +++ b/src/actions.c @@ -120,11 +120,20 @@ typedef struct char *alias; } alias_t; +typedef struct rp_frame_undo +{ + char *frames; + rp_screen *screen; + struct list_head node; +} rp_frame_undo; + -static LIST_HEAD(user_commands); -static LIST_HEAD(rp_keymaps); -static LIST_HEAD(set_vars); +static LIST_HEAD (user_commands); +static LIST_HEAD (rp_keymaps); +static LIST_HEAD (set_vars); +static LIST_HEAD (rp_frame_undos); +static LIST_HEAD (rp_frame_redos); static alias_t *alias_list; static int alias_list_size; @@ -634,7 +643,7 @@ clear_frame_redos (void) } } -void +static void del_frame_undo (rp_frame_undo *u) { if (!u) return; @@ -643,6 +652,18 @@ del_frame_undo (rp_frame_undo *u) free (u); } +void +clear_frame_undos (void) +{ + while (list_size (&rp_frame_undos) > 0) + { + /* Delete the oldest node */ + rp_frame_undo *cur; + list_last (cur, &rp_frame_undos, node); + del_frame_undo (cur); + } +} + static void push_frame_undo(rp_screen *screen) { diff --git a/src/actions.h b/src/actions.h index 29cf984..0025e7f 100644 --- a/src/actions.h +++ b/src/actions.h @@ -29,9 +29,9 @@ typedef struct cmdret { char *output; int success; -void del_frame_undo (rp_frame_undo *u); } cmdret; +void clear_frame_undos (void); rp_keymap *find_keymap (char *name); void init_user_commands(void); void initialize_default_keybindings (void); @@ -390,14 +390,6 @@ struct rp_hook_db_entry struct list_head *hook; }; -typedef struct rp_frame_undo rp_frame_undo; -struct rp_frame_undo -{ - char *frames; - rp_screen *screen; - struct list_head node; -}; - typedef struct rp_xselection rp_xselection; struct rp_xselection { diff --git a/src/globals.c b/src/globals.c index 1481a5c..ddb2b89 100644 --- a/src/globals.c +++ b/src/globals.c @@ -265,9 +265,6 @@ set_window_focus (Window window) RevertToPointerRoot, CurrentTime); } -LIST_HEAD (rp_frame_undos); -LIST_HEAD (rp_frame_redos); - /* Wrapper font functions to support Xft */ diff --git a/src/globals.h b/src/globals.h index 1fb7e0f..8f0d048 100644 --- a/src/globals.h +++ b/src/globals.h @@ -198,9 +198,6 @@ extern int xine_screen_count; extern struct numset *rp_frame_numset; -extern struct list_head rp_frame_undos; -extern struct list_head rp_frame_redos; - /* Selection handling globals */ extern rp_xselection selection; void set_selection (char *txt); @@ -838,13 +838,7 @@ clean_up (void) free (screens); /* Delete the undo histories */ - while (list_size (&rp_frame_undos) > 0) - { - /* Delete the oldest node */ - rp_frame_undo *cur; - list_last (cur, &rp_frame_undos, node); - del_frame_undo (cur); - } + clear_frame_undos (); /* Free the global frame numset shared by all screens. */ numset_free (rp_frame_numset); |