summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--src/main.c14
-rw-r--r--src/manage.c53
-rw-r--r--src/manage.h1
4 files changed, 56 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index 645dc68..d87e8f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2002-01-02 shawn <sabetts@vcn.bc.ca>
+
+ * 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.
+
2001-12-21 shawn <sabetts@vcn.bc.ca>
* src/actions.h (cmd_alias): new prototype
diff --git a/src/main.c b/src/main.c
index 3a41edc..98018f9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -649,22 +649,8 @@ init_screen (screen_info *s, int screen_num)
void
clean_up ()
{
- rp_window *cur;
int i;
- /* Map any iconized windows. */
- for (cur = rp_mapped_window_sentinel->next;
- cur != rp_mapped_window_sentinel;
- cur = cur->next)
- {
- if (cur->state == IconicState)
- {
- unhide_window (cur);
- }
- }
-
- XSync (dpy, False);
-
for (i=0; i<num_screens; i++)
{
XDestroyWindow (dpy, screens[i].bar_window);
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)
{
diff --git a/src/manage.h b/src/manage.h
index 499e4f2..892751b 100644
--- a/src/manage.h
+++ b/src/manage.h
@@ -33,6 +33,7 @@ void update_normal_hints (rp_window *win);
void rename_current_window ();
void send_configure (rp_window *win);
void set_state (rp_window *win, int state);
+long get_state (rp_window *win);
void update_window_information (rp_window *win);
void map_window (rp_window *win);