X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=ioncore%2Fioncore_winprops.lua;h=6a6ca51eb6b1478d93c07c78889f1de6308be905;hb=ae4260bb64817c11f9a7140324cd3e3ba113e297;hp=c241d63b378a6247c7edec07ff5b9cdf78b80e67;hpb=803afbc1cd633f6c025bcd9537e9b7e9aedadd0d;p=ion3.git diff --git a/ioncore/ioncore_winprops.lua b/ioncore/ioncore_winprops.lua index c241d63..6a6ca51 100644 --- a/ioncore/ioncore_winprops.lua +++ b/ioncore/ioncore_winprops.lua @@ -3,10 +3,7 @@ -- -- Copyright (c) Tuomo Valkonen 2004-2007. -- --- 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 @@ -56,7 +53,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 +79,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 +87,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)) + -- hack for nil + 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 +114,8 @@ function ioncore.match_winprop_name(prop, cwin) return false end end + + return true end @@ -123,9 +137,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