From 197347b61f4f6cfdf0da94aa3d6205e692e5954e Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 5 Jun 2008 22:59:38 +0000 Subject: Don't bork on link/swap the same window. Also extend comment. --- cmd-swap-window.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cmd-swap-window.c') 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 @@ -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); } -- cgit v1.2.3