From 0207d667014101559fe562f30d43835f96d02b9a Mon Sep 17 00:00:00 2001 From: sabetts Date: Fri, 15 Dec 2000 12:11:53 +0000 Subject: * manage.c (manage): added ColormapChangeMask and StructureNotifyMask to events listened for on managed windows. * manage.c (update_window_name): fixed memory leak. Not freeing the win->name before updating it. (manage): Gets the colormap now. --- src/manage.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'src/manage.c') diff --git a/src/manage.c b/src/manage.c index 53a58d9..153793d 100644 --- a/src/manage.c +++ b/src/manage.c @@ -109,12 +109,18 @@ get_window_name (Window w) int update_window_name (rp_window *win) { + char *newstr; char *loc; /* Don't overwrite the window name if the user specified one. */ if (win->named) return 0; - win->name = get_window_name (win->w); + newstr = get_window_name (win->w); + if (newstr != NULL) + { + free (win->name); + win->name = newstr; + } /* A bit of a hack. If there's a : in the string, crop the string off there. This is mostly brought on by netscape's @@ -149,20 +155,28 @@ send_configure (rp_window *win) void manage (rp_window *win, screen_info *s) { - XMapWindow (dpy, win->w); + XWindowAttributes attr; - if (!update_window_name (win)) return; + PRINT_DEBUG ("managing new window\n"); + + update_window_name (win); /* Get the WM Hints */ update_normal_hints (win); + /* Get the colormap */ + XGetWindowAttributes (dpy, win->w, &attr); + win->colormap = attr.colormap; + /* We successfully got the name, which means we can start managing! */ - XSelectInput (dpy, win->w, PropertyChangeMask); + XSelectInput (dpy, win->w, PropertyChangeMask | ColormapChangeMask | StructureNotifyMask); XAddToSaveSet(dpy, win->w); grab_prefix_key (win->w); maximize (win); + XMapWindow (dpy, win->w); + win->state = STATE_MAPPED; win->number = get_unique_window_number (); @@ -214,7 +228,7 @@ unmanaged_window (Window w) { wname = get_window_name (w); if (!wname) - return 1; + return 0; if (!strcmp (unmanaged_window_list[i], wname)) { free (wname); -- cgit v1.2.3