summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/main.c14
-rw-r--r--src/manage.c53
-rw-r--r--src/manage.h1
3 files changed, 45 insertions, 23 deletions
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);