summaryrefslogtreecommitdiff
path: root/src/manage.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2002-01-02 12:15:08 +0000
committersabetts <sabetts>2002-01-02 12:15:08 +0000
commitd2de091a0450b16a51d4be53928a7617961a9850 (patch)
tree3d7bcf90aea19a31a70cd187a5b0979fea22d579 /src/manage.c
parent46eeb9fd620ded56fd2a5c013038ca56f22a2b4d (diff)
downloadratpoison-d2de091a0450b16a51d4be53928a7617961a9850.zip
* src/manage.h (get_state): new prototype
* src/manage.c (update_normal_hints): print only the hints that are set as debugging output. (scanwins): collect mapped and iconized windows. (get_state): new function * src/main.c (clean_up): don't map iconized windows.
Diffstat (limited to 'src/manage.c')
-rw-r--r--src/manage.c53
1 files changed, 44 insertions, 9 deletions
diff --git a/src/manage.c b/src/manage.c
index c0463ab..20356c3 100644
--- a/src/manage.c
+++ b/src/manage.c
@@ -74,10 +74,18 @@ update_normal_hints (rp_window *win)
XGetWMNormalHints (dpy, win->w, win->hints, &supplied);
- PRINT_DEBUG ("hints: minx: %d miny: %d maxx: %d maxy: %d incx: %d incy: %d\n",
- win->hints->min_width, win->hints->min_height,
- win->hints->max_width, win->hints->max_height,
- win->hints->width_inc, win->hints->height_inc);
+ /* Print debugging output for window hints. */
+#ifdef DEBUG
+ PRINT_DEBUG ("hints: ");
+ if (win->hints->flags & PMinSize)
+ PRINT_DEBUG ("minx: %d miny: %d ", win->hints->min_width, win->hints->min_height);
+
+ if (win->hints->flags & PMaxSize)
+ PRINT_DEBUG ("maxx: %d maxy: %d ", win->hints->max_width, win->hints->max_height);
+
+ if (win->hints->flags & PResizeInc)
+ PRINT_DEBUG ("incx: %d incy: %d\n", win->hints->width_inc, win->hints->height_inc);
+#endif
}
@@ -314,11 +322,12 @@ scanwins(screen_info *s)
win = add_to_window_list (s, wins[i]);
PRINT_DEBUG ("map_state: %d\n", attr.map_state);
- if (attr.map_state == IsViewable)
- {
- win->state = NormalState;
- map_window (win);
- }
+
+ /* Collect mapped and iconized windows. */
+ if (attr.map_state == IsViewable
+ || (attr.map_state == IsUnmapped
+ && get_state (win) == IconicState))
+ map_window (win);
}
XFree(wins);
@@ -360,6 +369,32 @@ set_state (rp_window *win, int state)
PropModeReplace, (unsigned char *)data, 2);
}
+/* Get the WM state of the window. */
+long
+get_state (rp_window *win)
+{
+ long state = WithdrawnState;
+ Atom type;
+ int format;
+ unsigned long nitems;
+ unsigned long bytes_left;
+ long *data;
+
+ if (win == NULL)
+ return state;
+
+ if (XGetWindowProperty (dpy, win->w, wm_state, 0L, 2L,
+ False, wm_state, &type, &format,
+ &nitems, &bytes_left,
+ (unsigned char **)&data) == Success && nitems > 0)
+ {
+ state = *data;
+ XFree (data);
+ }
+
+ return state;
+}
+
static void
move_window (rp_window *win)
{