summaryrefslogtreecommitdiff
path: root/src/manage.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2000-12-15 12:11:53 +0000
committersabetts <sabetts>2000-12-15 12:11:53 +0000
commit0207d667014101559fe562f30d43835f96d02b9a (patch)
tree3fb5cf29fa9f8702890aec39903a02f8dd26ffb7 /src/manage.c
parentd58ca1579156d60e66fa038c241bbf80c1a508b8 (diff)
downloadratpoison-0207d667014101559fe562f30d43835f96d02b9a.zip
* 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.
Diffstat (limited to 'src/manage.c')
-rw-r--r--src/manage.c24
1 files changed, 19 insertions, 5 deletions
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);