From da989d31f9c3a370769eee4599b71b8c4dbb9fa6 Mon Sep 17 00:00:00 2001 From: Jeff Abrahamson Date: Tue, 16 Sep 2014 20:52:22 +0200 Subject: [PATCH 6/6] Fix behavior when push/pull window leaves an empty frame. Fix frame color bug. Fix pullwindow keybinding error. Remove TODO about transient windows, we already did this right. --- src/actions.c | 2 +- src/window.c | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/actions.c b/src/actions.c index 668d7c6..4f4dfd6 100644 --- a/src/actions.c +++ b/src/actions.c @@ -763,7 +763,7 @@ initialize_default_keybindings (void) add_keybinding (XK_i, RP_CONTROL_MASK, "info", map); add_keybinding (XK_k, 0, "delete", map); add_keybinding (XK_k, RP_CONTROL_MASK, "delete", map); - add_keybinding (XK_l, 0, "pushwindow", map); + add_keybinding (XK_l, 0, "pullwindow", map); add_keybinding (XK_l, RP_CONTROL_MASK, "redisplay", map); add_keybinding (XK_m, 0, "lastmsg", map); add_keybinding (XK_m, RP_CONTROL_MASK, "lastmsg", map); diff --git a/src/window.c b/src/window.c index 74be244..d6789b0 100644 --- a/src/window.c +++ b/src/window.c @@ -107,30 +107,31 @@ window_name (rp_window *win) int move_window_between_frames(rp_frame *src_frame, rp_frame *dest_frame) { + rp_frame *active_frame = current_frame(); + rp_window *orig_window = find_window_number(active_frame->win_number); + rp_window *window_to_move = find_window_number(src_frame->win_number); if (!window_to_move) return -1; - rp_window *window_to_reveal = find_window_for_frame (src_frame); + rp_window *window_to_reveal = find_window_for_frame(src_frame); rp_window *window_to_cover = set_frames_window(dest_frame, window_to_move); maximize (window_to_move); unhide_window (window_to_move); - XRaiseWindow (dpy, window_to_move->w); - hide_window(window_to_cover); + if(window_to_cover) + hide_window(window_to_cover); if (!window_to_reveal) window_to_reveal = window_to_cover; + // It could happen that we are moving a window with no window to + // replace it. In that case, just leave the frame empty. + set_frames_window(src_frame, window_to_reveal); if (window_to_reveal) { - // It could happen that we are moving a window with no window to - // replace it. In that case, just leave the frame empty. - set_frames_window(src_frame, window_to_reveal); maximize (window_to_reveal); unhide_window (window_to_reveal); - XRaiseWindow (dpy, window_to_reveal->w); } - // TODO(jma): What if a window is transient? - // TODO(jma): What if we are covering a transient window? - // TODO(jma): What manages active and inactive frame coloring? Probably give_window_focus(). + rp_window *new_window = find_window_number(active_frame->win_number); + give_window_focus(new_window, orig_window); return 0; } -- 1.9.1