X-Git-Url: https://git.decadent.org.uk/gitweb/?p=ion3.git;a=blobdiff_plain;f=ioncore%2Fioncore_winprops.lua;h=329448691c018d2078304949aec139103f49406e;hp=c241d63b378a6247c7edec07ff5b9cdf78b80e67;hb=e3aec18706513a87eaa7839dfdaf7e0fcd0d8d2a;hpb=803afbc1cd633f6c025bcd9537e9b7e9aedadd0d diff --git a/ioncore/ioncore_winprops.lua b/ioncore/ioncore_winprops.lua index c241d63..3294486 100644 --- a/ioncore/ioncore_winprops.lua +++ b/ioncore/ioncore_winprops.lua @@ -1,12 +1,9 @@ -- -- ion/share/ioncore_winprops.lua -- --- Copyright (c) Tuomo Valkonen 2004-2007. +-- Copyright (c) Tuomo Valkonen 2004-2009. -- --- Ion is free software; you can redistribute it and/or modify it under --- the terms of the GNU Lesser General Public License as published by --- the Free Software Foundation; either version 2.1 of the License, or --- (at your option) any later version. +-- See the included file LICENSE for details. -- local ioncore=_G.ioncore @@ -14,6 +11,7 @@ local ioncore=_G.ioncore local winprops={} local function ifnil(...) + local arg={...} local n=#arg local function nxt(_, i) local j=i+1 @@ -56,7 +54,7 @@ function ioncore.getwinprop(cwin) props={} pcall(function() props=winprops[c][r][i] or {} end) for idx, prop in ipairs_r(props) do - if prop:match(cwin) then + if prop:match(cwin, id) then if prop.oneshot then table.remove(props, idx) end @@ -82,7 +80,7 @@ local function ensure_winproptab(class, role, instance) end end -local function do_add_winprop(class, role, instance, name, prop) +local function do_add_winprop(class, role, instance, prop) ensure_winproptab(class, role, instance) table.insert(winprops[class][role][instance], prop) end @@ -90,10 +88,25 @@ end --DOC -- The basic name-based winprop matching criteria. -function ioncore.match_winprop_name(prop, cwin) - if not prop.name then - return true - else +function ioncore.match_winprop_dflt(prop, cwin, id) + local function chkf(p, i) + if p==nil then + return true + else + return (p==(i and true or false)) + -- hack for nil i + end + end + + if not chkf(prop.is_transient, id.is_transient) then + return false + end + + if not chkf(prop.is_dockapp, id.is_dockapp) then + return false + end + + if prop.name then local nm=cwin:name() if nm then local st, en=string.find(nm, prop.name) @@ -102,6 +115,8 @@ function ioncore.match_winprop_name(prop, cwin) return false end end + + return true end @@ -123,9 +138,9 @@ function ioncore.defwinprop(list) end if not list2.match then - list2.match=ioncore.match_winprop_name + list2.match=ioncore.match_winprop_dflt end - do_add_winprop(class, role, instance, name, list2) + do_add_winprop(class, role, instance, list2) end