summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog17
-rw-r--r--src/actions.c1
-rw-r--r--src/data.h5
-rw-r--r--src/events.c60
-rw-r--r--src/window.c6
-rw-r--r--src/window.h3
6 files changed, 68 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index ff20cd2..53a30fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2006-02-26 Shawn Betts <sabetts@vcn.bc.ca>
+
+ * src/window.c (add_to_window_list): only change the window's
+ group and frame if window_mapped is 0.
+
+ * src/data.h (struct rp_child_info): new field window_mapped
+
+ * src/actions.c (spawn): init window_mapped field in child_info.
+
+2006-01-18 Bernhard R. Link <brlink@debian.org>
+
+ * src/events.c: look for _NET_WM_PID notify events and adopt the
+ intended frame number accordingly.
+
+ * src/window.c, src/window.h: make get_child_info accessible from
+ events.c
+
2006-01-04 Shawn Betts <sabetts@vcn.bc.ca>
* src/conf.h (ASPECT_WINDOWS_ARE_TRANSIENTS): new define
diff --git a/src/actions.c b/src/actions.c
index 15372be..741b69c 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -2494,6 +2494,7 @@ spawn(char *cmd, int raw)
child->frame = current_frame();
child->group = rp_current_group;
child->screen = current_screen();
+ child->window_mapped = 0;
list_add (&child->node, &rp_children);
diff --git a/src/data.h b/src/data.h
index 638697b..f2ca8eb 100644
--- a/src/data.h
+++ b/src/data.h
@@ -270,6 +270,11 @@ struct rp_child_info
rp_frame *frame;
rp_screen *screen;
+ /* Non-zero when the pid has mapped a window. This is to prevent
+ every window the program opens from getting mapped in the frame
+ it was launched from. Only the first window should do this. */
+ int window_mapped;
+
/* This structure can exist in a list. */
struct list_head node;
};
diff --git a/src/events.c b/src/events.c
index 8508af2..ded7698 100644
--- a/src/events.c
+++ b/src/events.c
@@ -597,30 +597,46 @@ property_notify (XEvent *ev)
if (win)
{
- switch (ev->xproperty.atom)
+ if (ev->xproperty.atom == _net_wm_pid)
{
- case XA_WM_NAME:
- PRINT_DEBUG (("updating window name\n"));
- update_window_name (win);
- update_window_names (win->scr);
- break;
-
- case XA_WM_NORMAL_HINTS:
- PRINT_DEBUG (("updating window normal hints\n"));
- update_normal_hints (win);
- if (win->state == NormalState)
- maximize (win);
- break;
+ struct rp_child_info *child_info;
- case XA_WM_TRANSIENT_FOR:
- PRINT_DEBUG (("Transient for\n"));
- win->transient = XGetTransientForHint (dpy, win->w, &win->transient_for);
- break;
-
- default:
- PRINT_DEBUG (("Unhandled property notify event: %ld\n", ev->xproperty.atom));
- break;
- }
+ PRINT_DEBUG (("updating _NET_WM_PID\n"));
+ child_info = get_child_info(win->w);
+ if (child_info)
+ {
+ if (child_info->frame)
+ {
+ PRINT_DEBUG (("frame=%p\n", child_info->frame));
+ win->intended_frame_number = child_info->frame->number;
+ }
+ /* TODO: also adopt group information? */
+ }
+ } else
+ switch (ev->xproperty.atom)
+ {
+ case XA_WM_NAME:
+ PRINT_DEBUG (("updating window name\n"));
+ update_window_name (win);
+ update_window_names (win->scr);
+ break;
+
+ case XA_WM_NORMAL_HINTS:
+ PRINT_DEBUG (("updating window normal hints\n"));
+ update_normal_hints (win);
+ if (win->state == NormalState)
+ maximize (win);
+ break;
+
+ case XA_WM_TRANSIENT_FOR:
+ PRINT_DEBUG (("Transient for\n"));
+ win->transient = XGetTransientForHint (dpy, win->w, &win->transient_for);
+ break;
+
+ default:
+ PRINT_DEBUG (("Unhandled property notify event: %ld\n", ev->xproperty.atom));
+ break;
+ }
}
}
diff --git a/src/window.c b/src/window.c
index 0936999..ad926f4 100644
--- a/src/window.c
+++ b/src/window.c
@@ -108,7 +108,7 @@ window_name (rp_window *win)
/* FIXME: we need to verify that the window is running on the same
host as something. otherwise there could be overlapping PIDs. */
-static struct rp_child_info *
+struct rp_child_info *
get_child_info (Window w)
{
rp_child_info *cur;
@@ -204,13 +204,15 @@ add_to_window_list (rp_screen *s, Window w)
child_info = get_child_info (w);
- if (child_info) {
+ if (child_info && !child_info->window_mapped) {
rp_frame *frame = screen_find_frame_by_frame (child_info->screen, child_info->frame);
PRINT_DEBUG(("frame=%p\n", frame));
group = groups_find_group_by_group (child_info->group);
if (frame)
frame_num = frame->number;
+ /* Only map the first window in the launch frame. */
+ child_info->window_mapped = 1;
}
/* Add the window to the group it's pid was launched in or the
diff --git a/src/window.h b/src/window.h
index 650ade1..3b51316 100644
--- a/src/window.h
+++ b/src/window.h
@@ -67,4 +67,7 @@ rp_frame *win_get_frame (rp_window *win);
void set_active_window_force (rp_window *win);
void set_active_window_body (rp_window *win, int force);
+
+struct rp_child_info *get_child_info (Window w);
+
#endif /* ! _RATPOISON_LIST_H */