From d7784697cb47f99b119d4e5c0b6081443219e689 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 14 Nov 2008 10:36:15 +0100 Subject: [PATCH] client: check clients are different when swapping Signed-off-by: Julien Danjou --- client.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/client.c b/client.c index abd991ce..a507fc1d 100644 --- a/client.c +++ b/client.c @@ -1033,13 +1033,17 @@ luaA_client_swap(lua_State *L) { client_t **c = luaA_checkudata(L, 1, "client"); client_t **swap = luaA_checkudata(L, 2, "client"); - client_list_swap(&globalconf.clients, *swap, *c); - client_need_arrange(*c); - client_need_arrange(*swap); - /* Call hook to notify list change */ - if(globalconf.hooks.clients != LUA_REFNIL) - luaA_dofunction(L, globalconf.hooks.clients, 0, 0); + if(*c != *swap) + { + client_list_swap(&globalconf.clients, *swap, *c); + client_need_arrange(*c); + client_need_arrange(*swap); + + /* Call hook to notify list change */ + if(globalconf.hooks.clients != LUA_REFNIL) + luaA_dofunction(L, globalconf.hooks.clients, 0, 0); + } return 0; }