X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=theme.cpp;h=f8e0d8eff2801a5c91e220819779d652b821431a;hb=390521f709026cb1acdbde84ef77d1490da1ffa2;hp=61ead92e98bc8503a8c137f135bf89aa18c2ba27;hpb=5c12e871c54ae453cdc2eb81cb437b02c56ebb4b;p=nageru diff --git a/theme.cpp b/theme.cpp index 61ead92..f8e0d8e 100644 --- a/theme.cpp +++ b/theme.cpp @@ -469,6 +469,38 @@ Theme::get_chain(unsigned num, float t, unsigned width, unsigned height) }); } +std::string Theme::get_channel_name(unsigned channel) +{ + unique_lock lock(m); + lua_getglobal(L, "channel_name"); + lua_pushnumber(L, channel); + if (lua_pcall(L, 1, 1, 0) != 0) { + fprintf(stderr, "error running function `channel_nam': %s\n", lua_tostring(L, -1)); + exit(1); + } + + std::string ret = lua_tostring(L, -1); + lua_pop(L, 1); + assert(lua_gettop(L) == 0); + return ret; +} + +bool Theme::get_supports_set_wb(unsigned channel) +{ + unique_lock lock(m); + lua_getglobal(L, "supports_set_wb"); + lua_pushnumber(L, channel); + if (lua_pcall(L, 1, 1, 0) != 0) { + fprintf(stderr, "error running function `supports_set_wb': %s\n", lua_tostring(L, -1)); + exit(1); + } + + bool ret = checkbool(L, -1); + lua_pop(L, 1); + assert(lua_gettop(L) == 0); + return ret; +} + std::vector Theme::get_transition_names(float t) { unique_lock lock(m);