From e0d3da455b5bf7f8162574f8dc256518d14555e8 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sat, 6 Sep 2008 13:52:05 +0200 Subject: [PATCH] client: split minimized out of hidden Signed-off-by: Julien Danjou --- client.c | 19 ++++++++++++++++++- client.h | 2 +- common/tokenize.gperf | 1 + event.c | 7 ++++--- ewmh.c | 6 ++++-- structs.h | 2 ++ widgets/tasklist.c | 1 + 7 files changed, 31 insertions(+), 7 deletions(-) diff --git a/client.c b/client.c index 447eb743a..cd33b2e61 100644 --- a/client.c +++ b/client.c @@ -251,6 +251,7 @@ client_focus(client_t *c) /* stop hiding c */ c->ishidden = false; + c->isminimized = false; /* unban the client before focusing or it will fail */ client_unban(c); @@ -1302,6 +1303,15 @@ luaA_client_newindex(lua_State *L) client_need_arrange(*c); } break; + case A_TK_MINIMIZE: + b = luaA_checkboolean(L, 3); + if(b != (*c)->isminimized) + { + client_need_arrange(*c); + (*c)->isminimized = b; + client_need_arrange(*c); + } + break; case A_TK_FULLSCREEN: client_setfullscreen(*c, luaA_checkboolean(L, 3)); break; @@ -1393,7 +1403,11 @@ luaA_client_newindex(lua_State *L) * \lfield machine The machine client is running on. * \lfield icon_name The client name when iconified. * \lfield screen Client screen number. - * \lfield hide Define if the client must be hidden, i.e. never mapped. + * \lfield hide Define if the client must be hidden, i.e. never mapped, not + * visible in taskbar. + * invisible in taskbar. + * \lfield minimize Define it the client must be iconify, i.e. only visible in + * taskbar. * \lfield icon_path Path to the icon used to identify. * \lfield floating True always floating. * \lfield honorsizehints Honor size hints, i.e. respect size ratio. @@ -1508,6 +1522,9 @@ luaA_client_index(lua_State *L) case A_TK_HIDE: lua_pushboolean(L, (*c)->ishidden); break; + case A_TK_MINIMIZE: + lua_pushboolean(L, (*c)->isminimized); + break; case A_TK_FULLSCREEN: lua_pushboolean(L, (*c)->isfullscreen); break; diff --git a/client.h b/client.h index 0b1832396..2936fa38d 100644 --- a/client.h +++ b/client.h @@ -108,7 +108,7 @@ client_isfloating(client_t *c) static inline bool client_isvisible(client_t *c, int screen) { - return (!c->ishidden && client_maybevisible(c, screen)); + return (!c->ishidden && !c->isminimized && client_maybevisible(c, screen)); } /** Check if a client has strut information. diff --git a/common/tokenize.gperf b/common/tokenize.gperf index 8e504e9a7..b3d73d458 100644 --- a/common/tokenize.gperf +++ b/common/tokenize.gperf @@ -34,6 +34,7 @@ layout left line machine +minimize mouse_enter mouse_leave mwfact diff --git a/event.c b/event.c index 40c179297..6f3a62f52 100644 --- a/event.c +++ b/event.c @@ -579,9 +579,10 @@ event_handle_maprequest(void *data __attribute__ ((unused)), } else if((c = client_getbywin(ev->window))) { - if(client_maybevisible(c, c->screen)) + /* Check that it may be visible, but not asked to be hidden */ + if(client_maybevisible(c, c->screen) && !c->ishidden) { - c->ishidden = false; + c->isminimized = false; globalconf.screens[c->screen].need_arrange = true; xcb_map_window(globalconf.connection, ev->window); /* it will be raised, so just update ourself */ @@ -760,7 +761,7 @@ event_handle_clientmessage(void *data __attribute__ ((unused)), && ev->data.data32[0] == XCB_WM_STATE_ICONIC) { client_need_arrange(c); - c->ishidden = true; + c->isminimized = true; } } else if(ev->type == _XEMBED) diff --git a/ewmh.c b/ewmh.c index e4d003892..d6bb4e4e3 100644 --- a/ewmh.c +++ b/ewmh.c @@ -296,12 +296,14 @@ ewmh_process_state_atom(client_t *c, xcb_atom_t state, int set) if(set == _NET_WM_STATE_REMOVE) { client_need_arrange(c); - c->ishidden = false; + c->isminimized = false; + client_need_arrange(c); } else if(set == _NET_WM_STATE_ADD) { client_need_arrange(c); - c->ishidden = true; + c->isminimized = true; + client_need_arrange(c); } } else if(state == _NET_WM_STATE_DEMANDS_ATTENTION) diff --git a/structs.h b/structs.h index 805d816d8..096f00701 100644 --- a/structs.h +++ b/structs.h @@ -306,6 +306,8 @@ struct client_t bool ismoving; /** True if the client is hidden */ bool ishidden; + /** True if the client is minimized */ + bool isminimized; /** True if the client is fullscreen */ bool isfullscreen; /** True if the client is above others */ diff --git a/widgets/tasklist.c b/widgets/tasklist.c index 2aa78db18..caea9db33 100644 --- a/widgets/tasklist.c +++ b/widgets/tasklist.c @@ -216,6 +216,7 @@ tasklist_draw(draw_context_t *ctx, int screen, for(c = globalconf.clients; c; c = c->next) if(!c->skiptb + && !c->ishidden && c->type != WINDOW_TYPE_SPLASH && c->type != WINDOW_TYPE_DOCK && c->type != WINDOW_TYPE_DESKTOP)