client: return instance and class (FS#236)
The problem seems to be that while a function can return multiple values, an index cannot. Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
7ec624cc14
commit
982a8e4c52
19
client.c
19
client.c
|
@ -1199,7 +1199,8 @@ luaA_client_newindex(lua_State *L)
|
||||||
* \return The number of elements pushed on stack.
|
* \return The number of elements pushed on stack.
|
||||||
* \luastack
|
* \luastack
|
||||||
* \lfield name The client title.
|
* \lfield name The client title.
|
||||||
* \lfield class The client class, 2 strings long.
|
* \lfield class The client class.
|
||||||
|
* \lfield instance The client instance.
|
||||||
* \lfield pid The client PID, if available.
|
* \lfield pid The client PID, if available.
|
||||||
* \lfield floating_placement The floating placement used for this client.
|
* \lfield floating_placement The floating placement used for this client.
|
||||||
* \lfield screen Client screen number.
|
* \lfield screen Client screen number.
|
||||||
|
@ -1232,13 +1233,15 @@ luaA_client_index(lua_State *L)
|
||||||
lua_pushstring(L, (*c)->name);
|
lua_pushstring(L, (*c)->name);
|
||||||
break;
|
break;
|
||||||
case A_TK_CLASS:
|
case A_TK_CLASS:
|
||||||
if(xutil_get_class_hint(globalconf.connection, (*c)->win, &hint))
|
if(!xutil_get_class_hint(globalconf.connection, (*c)->win, &hint))
|
||||||
{
|
return 0;
|
||||||
lua_pushstring(L, hint.res_name);
|
lua_pushstring(L, hint.res_class);
|
||||||
lua_pushstring(L, hint.res_class);
|
break;
|
||||||
return 2;
|
case A_TK_INSTANCE:
|
||||||
}
|
if(!xutil_get_class_hint(globalconf.connection, (*c)->win, &hint))
|
||||||
return 0;
|
return 0;
|
||||||
|
lua_pushstring(L, hint.res_name);
|
||||||
|
break;
|
||||||
case A_TK_PID:
|
case A_TK_PID:
|
||||||
prop_c = xcb_get_property_unchecked(globalconf.connection, false, (*c)->win, _NET_WM_PID, CARDINAL, 0L, 1L);
|
prop_c = xcb_get_property_unchecked(globalconf.connection, false, (*c)->win, _NET_WM_PID, CARDINAL, 0L, 1L);
|
||||||
prop_r = xcb_get_property_reply(globalconf.connection, prop_c, NULL);
|
prop_r = xcb_get_property_reply(globalconf.connection, prop_c, NULL);
|
||||||
|
|
|
@ -27,6 +27,7 @@ hide
|
||||||
honorsizehints
|
honorsizehints
|
||||||
icon_path
|
icon_path
|
||||||
image
|
image
|
||||||
|
instance
|
||||||
label
|
label
|
||||||
layout
|
layout
|
||||||
left
|
left
|
||||||
|
|
Loading…
Reference in New Issue