From 24c831b03816bd9821198cc9d24f0cf9e1e7e062 Mon Sep 17 00:00:00 2001 From: "Bernhard R. Link" Date: Wed, 17 Mar 2010 16:18:07 +0100 Subject: fix swap across multiple screens exchange_with_frame now always selects the second frame given, simplifying the code (getting rid of segfaults when both were on different screens). This changes the behaviour of cmd_swap to always focus the first argument when two arguments are given. This patch also removes the screen argument of exchange_with_frame, which is now no longer needed (and cmd_swap was giving the wrong screen anyway in the case of multiple arguments given). --- src/actions.c | 10 +++++----- src/split.c | 30 ++---------------------------- src/split.h | 2 +- 3 files changed, 8 insertions(+), 34 deletions(-) diff --git a/src/actions.c b/src/actions.c index bda8002..052b099 100644 --- a/src/actions.c +++ b/src/actions.c @@ -4292,7 +4292,7 @@ cmd_exchangeup (int interactive UNUSED, struct cmdarg **args UNUSED) rp_frame *frame; if ((frame = find_frame_up (current_frame()))) - exchange_with_frame (current_screen(), current_frame(), frame); + exchange_with_frame (current_frame(), frame); return cmdret_new (RET_SUCCESS, NULL); } @@ -4303,7 +4303,7 @@ cmd_exchangedown (int interactive UNUSED, struct cmdarg **args UNUSED) rp_frame *frame; if ((frame = find_frame_down (current_frame()))) - exchange_with_frame (current_screen(), current_frame(), frame); + exchange_with_frame (current_frame(), frame); return cmdret_new (RET_SUCCESS, NULL); } @@ -4314,7 +4314,7 @@ cmd_exchangeleft (int interactive UNUSED, struct cmdarg **args UNUSED) rp_frame *frame; if ((frame = find_frame_left (current_frame()))) - exchange_with_frame (current_screen(), current_frame(), frame); + exchange_with_frame (current_frame(), frame); return cmdret_new (RET_SUCCESS, NULL); } @@ -4325,7 +4325,7 @@ cmd_exchangeright (int interactive UNUSED, struct cmdarg **args UNUSED) rp_frame *frame; if ((frame = find_frame_right (current_frame()))) - exchange_with_frame (current_screen(), current_frame(), frame); + exchange_with_frame (current_frame(), frame); return cmdret_new (RET_SUCCESS, NULL); } @@ -4347,7 +4347,7 @@ cmd_swap (int interactive UNUSED, struct cmdarg **args) return cmdret_new (RET_FAILURE, "swap: frames on different screens"); } - exchange_with_frame (current_screen(), src_frame, dest_frame); + exchange_with_frame (src_frame, dest_frame); return cmdret_new (RET_SUCCESS, NULL); } diff --git a/src/split.c b/src/split.c index fa6e08f..480fca1 100644 --- a/src/split.c +++ b/src/split.c @@ -874,16 +874,10 @@ set_active_frame (rp_frame *frame, int force_indicator) } void -exchange_with_frame (rp_screen *s, rp_frame *cur, rp_frame *frame) +exchange_with_frame (rp_frame *cur, rp_frame *frame) { rp_window *win,*last_win; - /* As a frame does not tell which screen it belongs to, - * we could only make sure the frames are not on different - * screens when xinerama is not available, if both have - * windows in it. As this is not enough the caller will - * have to check this. As I only plan to implement - * exchange_{left,right,up,down}, this will be a nop...*/ if (frame == NULL || frame == cur) return; /* Exchange the windows in the frames */ @@ -904,27 +898,7 @@ exchange_with_frame (rp_screen *s, rp_frame *cur, rp_frame *frame) /* Make the switch */ update_last_access (frame); - if (s->current_frame == cur->number) - { - s->current_frame = frame->number; - /* mark it as active */ - show_frame_indicator(0); - } - - update_bar (s); - - - XSync (dpy, False); - - hook_run (&rp_switch_frame_hook); - - /* FIXME: Remaining problems: - * - if one of the window is transient, the windows in the - * background could cause problems. - * - * - how to implement correct mouse-warping? - * (is it needed at all?) - */ + set_active_frame(frame, 0); } diff --git a/src/split.h b/src/split.h index 8332037..87bb660 100644 --- a/src/split.h +++ b/src/split.h @@ -41,7 +41,7 @@ rp_window *current_window (void); void init_frame_lists (void); void init_frame_list (rp_screen *screen); void set_active_frame (rp_frame *frame, int force_indicator); -void exchange_with_frame (rp_screen *s, rp_frame *cur, rp_frame *frame); +void exchange_with_frame (rp_frame *cur, rp_frame *frame); void blank_frame (rp_frame *frame); void show_frame_indicator (int force); void hide_frame_indicator (void); -- cgit v1.2.3