summaryrefslogtreecommitdiffstats
path: root/cmd-swap-window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2008-06-05 22:59:38 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2008-06-05 22:59:38 +0000
commit197347b61f4f6cfdf0da94aa3d6205e692e5954e (patch)
treee64882c3fe2a781d76d4e4545c1fc80efbcaea3b /cmd-swap-window.c
parent741f8967b40121f0364c90635bd609df9cdcd933 (diff)
Don't bork on link/swap the same window. Also extend comment.
Diffstat (limited to 'cmd-swap-window.c')
-rw-r--r--cmd-swap-window.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd-swap-window.c b/cmd-swap-window.c
index 1f473e19..8cb63ca8 100644
--- a/cmd-swap-window.c
+++ b/cmd-swap-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-swap-window.c,v 1.11 2008-06-05 21:25:00 nicm Exp $ */
+/* $Id: cmd-swap-window.c,v 1.12 2008-06-05 22:59:38 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -55,6 +55,9 @@ cmd_swap_window_exec(struct cmd *self, struct cmd_ctx *ctx)
if ((wl_dst = cmd_find_window(ctx, data->dst, &dst)) == NULL)
return;
+ if (wl_dst->window == wl_src->window)
+ goto out;
+
w = wl_dst->window;
wl_dst->window = wl_src->window;
wl_src->window = w;
@@ -68,6 +71,7 @@ cmd_swap_window_exec(struct cmd *self, struct cmd_ctx *ctx)
if (src != dst)
server_redraw_session(dst);
+out:
if (ctx->cmdclient != NULL)
server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);
}