Don't bork on link/swap the same window. Also extend comment.

This commit is contained in:
Nicholas Marriott
2008-06-05 22:59:38 +00:00
parent 741f8967b4
commit 197347b61f
5 changed files with 36 additions and 16 deletions

View File

@ -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);
}