diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/events.c | 41 | ||||
-rw-r--r-- | src/group.c | 17 | ||||
-rw-r--r-- | src/group.h | 1 | ||||
-rw-r--r-- | src/messages.h | 10 |
4 files changed, 51 insertions, 18 deletions
diff --git a/src/events.c b/src/events.c index 5921244..b190bc6 100644 --- a/src/events.c +++ b/src/events.c @@ -42,6 +42,31 @@ action.c which need to forward events to other windows. */ XEvent rp_current_event; +void +show_rudeness_raise_msg (rp_window *win) +{ + rp_group *g = groups_find_group_by_window (win); + rp_window_elem *elem = group_find_window (&g->mapped_windows, win); + if (g == rp_current_group) + { + if (win->transient) + marked_message_printf (0, 0, MESSAGE_RAISE_TRANSIENT, + elem->number, window_name (win)); + else + marked_message_printf (0, 0, MESSAGE_RAISE_WINDOW, + elem->number, window_name (win)); + } + else + { + if (win->transient) + marked_message_printf (0, 0, MESSAGE_RAISE_TRANSIENT_GROUP, + elem->number, window_name (win), g->name); + else + marked_message_printf (0, 0, MESSAGE_RAISE_WINDOW_GROUP, + elem->number, window_name (win), g->name); + } +} + static void new_window (XCreateWindowEvent *e) { @@ -171,14 +196,7 @@ map_request (XEvent *ev) || (rp_honour_normal_raise && !win->transient)) set_active_window (win); else - { - if (win->transient) - marked_message_printf (0, 0, MESSAGE_RAISE_TRANSIENT, - win->number, window_name (win)); - else - marked_message_printf (0, 0, MESSAGE_RAISE_WINDOW, - win->number, window_name (win)); - } + show_rudeness_raise_msg (win); } break; } @@ -250,12 +268,7 @@ configure_request (XConfigureRequestEvent *e) } else if (current_window() != win) { - if (win->transient) - marked_message_printf (0, 0, MESSAGE_RAISE_TRANSIENT, - win->number, window_name (win)); - else - marked_message_printf (0, 0, MESSAGE_RAISE_WINDOW, - win->number, window_name (win)); + show_rudeness_raise_msg (win); } } diff --git a/src/group.c b/src/group.c index 58c4cd7..fb5b6db 100644 --- a/src/group.c +++ b/src/group.c @@ -134,6 +134,23 @@ groups_find_group_by_number (int n) return NULL; } +/* Return the first group that contains the window. */ +rp_group * +groups_find_group_by_window (rp_window *win) +{ + rp_group *cur; + rp_window_elem *elem; + + list_for_each_entry (cur, &rp_groups, node) + { + elem = group_find_window (&cur->mapped_windows, win); + if (elem) + return cur; + } + + return NULL; +} + rp_window_elem * group_find_window (struct list_head *list, rp_window *win) { diff --git a/src/group.h b/src/group.h index f0c17dd..32c277c 100644 --- a/src/group.h +++ b/src/group.h @@ -43,6 +43,7 @@ rp_window *group_prev_window (rp_group *g, rp_window *win); rp_window *group_next_window (rp_group *g, rp_window *win); rp_group *groups_find_group_by_name (char *s); rp_group *groups_find_group_by_number (int n); +rp_group *groups_find_group_by_window (rp_window *win); rp_window *group_last_window (rp_group *g, rp_screen *screen); diff --git a/src/messages.h b/src/messages.h index ceb1bf1..dfebc2a 100644 --- a/src/messages.h +++ b/src/messages.h @@ -30,10 +30,12 @@ #define MESSAGE_UNKNOWN_COMMAND ": unknown command '%s'" #define MESSAGE_WINDOW_INFORMATION "This is window %d (%s)" -#define MESSAGE_RAISE_TRANSIENT "Raise request from transient window %d (%s)" -#define MESSAGE_RAISE_WINDOW "Raise request from window %d (%s)" -#define MESSAGE_MAP_TRANSIENT "New transient window %d (%s)" -#define MESSAGE_MAP_WINDOW "New window %d (%s)" +#define MESSAGE_RAISE_TRANSIENT "Raise request from transient window %d (%s)" +#define MESSAGE_RAISE_WINDOW "Raise request from window %d (%s)" +#define MESSAGE_RAISE_TRANSIENT_GROUP "Raise request from transient window %d (%s) in group %s" +#define MESSAGE_RAISE_WINDOW_GROUP "Raise request from window %d (%s) in group %s" +#define MESSAGE_MAP_TRANSIENT "New transient window %d (%s)" +#define MESSAGE_MAP_WINDOW "New window %d (%s)" #define MESSAGE_PROMPT_SWITCH_TO_WINDOW "Switch to window: " #define MESSAGE_PROMPT_NEW_WINDOW_NAME "Set window's title to: " |