summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsabetts <sabetts>2006-02-26 23:20:07 +0000
committersabetts <sabetts>2006-02-26 23:20:07 +0000
commit50171e15dbe6a51464059ad820f5a0464f3d60fa (patch)
treebd8909431b6f2884319f8821bac6bf38d7dad1e4 /src
parent23b3dd1114f608ffbef9d18b582e28e39fdce7f5 (diff)
downloadratpoison-50171e15dbe6a51464059ad820f5a0464f3d60fa.zip
* 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.
Diffstat (limited to 'src')
-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
5 files changed, 51 insertions, 24 deletions
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 */