From 532d432d1b4f6b17755a3098a9f192802a46afcc Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Mon, 27 Jul 2020 16:11:38 +0900 Subject: [PATCH] e_mod_pol_pingpong: code cleanup Change-Id: Id66df8af61fb2a806b304eac5006172e6e251426 --- src/e_mod_pol_pingpong.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/e_mod_pol_pingpong.c b/src/e_mod_pol_pingpong.c index 154c2d7..29d870e 100644 --- a/src/e_mod_pol_pingpong.c +++ b/src/e_mod_pol_pingpong.c @@ -65,6 +65,18 @@ _pp_win_find(E_Client *ec) return NULL; } +static void +_pp_win_remove(E_Client *ec) +{ + PP_Win *ppw = NULL; + + ppw = _pp_win_find(ec); + if (!ppw) return; + + _pp_wins = eina_list_remove(_pp_wins, ppw); + _pp_win_del(ppw); +} + static Eina_Bool _cb_pong_check(void *data) { @@ -188,15 +200,10 @@ _cb_client_hide(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) { - PP_Win *ppw = NULL; E_Event_Client *ev = (E_Event_Client *)event; - E_Client *ec = ev->ec; - - ppw = _pp_win_find(ec); - if (!ppw) return ECORE_CALLBACK_PASS_ON; - _pp_wins = eina_list_remove(_pp_wins, ppw); - _pp_win_del(ppw); + if (ev->ec) + _pp_win_remove(ev->ec); return ECORE_CALLBACK_PASS_ON; } @@ -206,15 +213,10 @@ _cb_client_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) { - PP_Win *ppw = NULL; E_Event_Client *ev = (E_Event_Client *)event; - E_Client *ec = ev->ec; - - ppw = _pp_win_find(ec); - if (!ppw) return ECORE_CALLBACK_PASS_ON; - _pp_wins = eina_list_remove(_pp_wins, ppw); - _pp_win_del(ppw); + if (ev->ec) + _pp_win_remove(ev->ec); return ECORE_CALLBACK_PASS_ON; } -- 2.7.4