summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2003-02-27 12:33:00 +0000
committersabetts <sabetts>2003-02-27 12:33:00 +0000
commit293fca91a75f15c696c2f1d9dd4227f558cfc26f (patch)
tree9fa4d15ede6975b561b07d4d8004c0885c8124fd /src/main.c
parent6b341ac568efd980ddbbbfbb2c4960204879afdb (diff)
downloadratpoison-293fca91a75f15c696c2f1d9dd4227f558cfc26f.zip
* src/main.c (free_screen): new function
(clean_up): call free_screen on each screen. free the screen array. free defaults.window_fmt. * src/number.h (free_numbers): new prototype * src/number.c (free_numbers): new function * src/manage.c (get_wmname): use XGetWindowProperty to get the window name. (unmanaged_window): free wname after using it. * src/main.c (wm_name): new global (main): internalize WM_NAME atom. (clean_up): free data structures for keybindings, aliases, the bar, window numbers, and input history. * src/input.h (free_history): new prototype * src/input.c (free_history): new function * src/events.c (execute_remote_command): free properties returned by XGetWindowProperty(). * src/data.h (wm_name): new extern * src/communications.c (recieve_command_result): free properties returned by XGetWindowProperty(). * src/bar.h (free_bar): new prototype * src/bar.c (update_window_names): bar_buffer is not static. (update_window_names): free bar_buffer after using it. (marked_message): free the GC after using it. (free_bar): new function. * src/actions.h (free_keybindings): new prototype (free_aliases): likewise * src/actions.c (free_keybindings): new function (free_aliases): likewise (cmd_tmpwm): unmap the key window before calling the new wm, and remap it afterwards.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c44
1 files changed, 35 insertions, 9 deletions
diff --git a/src/main.c b/src/main.c
index 29ce345..4c31511 100644
--- a/src/main.c
+++ b/src/main.c
@@ -47,6 +47,7 @@ int rat_x;
int rat_y;
int rat_visible = 1; /* rat is visible by default */
+Atom wm_name;
Atom wm_state;
Atom wm_change_state;
Atom wm_protocols;
@@ -555,6 +556,7 @@ main (int argc, char *argv[])
}
/* Set our Atoms */
+ wm_name = XInternAtom(dpy, "WM_NAME", False);
wm_state = XInternAtom(dpy, "WM_STATE", False);
wm_change_state = XInternAtom(dpy, "WM_CHANGE_STATE", False);
wm_protocols = XInternAtom(dpy, "WM_PROTOCOLS", False);
@@ -696,25 +698,49 @@ init_screen (screen_info *s, int screen_num)
XSync (dpy, 0);
}
+static void
+free_screen (screen_info *s)
+{
+ rp_window_frame *frame;
+ struct list_head *iter, *tmp;
+
+ list_for_each_safe_entry (frame, iter, tmp, &s->rp_window_frames, node)
+ {
+ free (frame);
+ }
+
+ XDestroyWindow (dpy, s->bar_window);
+ XDestroyWindow (dpy, s->key_window);
+ XDestroyWindow (dpy, s->input_window);
+ XDestroyWindow (dpy, s->frame_window);
+ XDestroyWindow (dpy, s->help_window);
+
+ XFreeCursor (dpy, s->rat);
+ XFreeColormap (dpy, s->def_cmap);
+ XFreeGC (dpy, s->normal_gc);
+
+ free (s->display_string);
+}
+
void
clean_up ()
{
int i;
+ free_keybindings ();
+ free_aliases ();
+ free_bar ();
+ free_numbers ();
+ free_history ();
+
for (i=0; i<num_screens; i++)
{
- XDestroyWindow (dpy, screens[i].bar_window);
- XDestroyWindow (dpy, screens[i].key_window);
- XDestroyWindow (dpy, screens[i].input_window);
- XDestroyWindow (dpy, screens[i].frame_window);
- XDestroyWindow (dpy, screens[i].help_window);
-
- XFreeCursor (dpy, screens[i].rat);
- XFreeColormap (dpy, screens[i].def_cmap);
- XFreeGC (dpy, screens[i].normal_gc);
+ free_screen (&screens[i]);
}
+ free (screens);
XFreeFont (dpy, defaults.font);
+ free (defaults.window_fmt);
XSetInputFocus (dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
XCloseDisplay (dpy);