Some more detail was asked about, so tossing a more detailed explanation of Action layers for anyone that wants to use them.
-- EVENT_ACTION_LAYER_POPPED (luaindex layerIndex, luaindex activeLayerIndex)
-- EVENT_ACTION_LAYER_PUSHED (luaindex layerIndex, luaindex activeLayerIndex)
Those are events that get fired whenever an alternate screen like the bags or options screen or character conversation or anything appear on screen. You can use /zgoo events and X out all events except those to see exactly what is going on with them.
In my experience the arguments of those events is of little help, and instead I use them just as triggers to then decide to hide/show my addon's UI.
Function to stick all ActionLayer information into a table so you can easily examine it and see how it changes as you open/close other screens.
/zgoo GetAllActionLayerInfo()
to examine it easily.
Code:
function GetAllActionLayerInfo()
local num = GetNumActionLayers()
local table = {}
for i=1,num do
local layer = {}
local name, numCata = GetActionLayerInfo(i)
layer.name = name
layer.active = IsActionLayerActiveByName(name)
layer.cata = {}
layer.tostring = function(self)
return self.name..(self.active and " - ACTIVE" or "")
end
table[i] = layer
-- Do same thing for each catagory
for k=1, numCata do
local cata = {}
local cname, numAction = GetActionLayerCategoryInfo(i,k)
cata.name = cname
cata.actions = {}
cata.tostring = function(self)
return self.name
end
layer.cata[k] = cata
--Same thing for each action? Woo copy paste.
for j=1, numAction do
local action = {}
local aname, rebind, hidden = GetActionInfo(i,k,j)
action.name = aname
action.rebind = rebind
action.hidden = hidden
action.tostring = function(self)
return self.name
end
cata.actions[j] = action
end
end
end
return table
end
There are currently 15 action layers, some I personally haven't experienced so I just guessed about their use.
Code:
--[[
1. General
2. User Interface Shortcuts
3. Siege
4. Dialogs
5. Notifications
6. MouseUIMode
7. Conversation
8. Guild
9. RadialMenu
10. Death
11. Loot
12. GameMenu
13. Keybind Window
14. Addons
15. OptionsWindow
If 13/14/15 is open then
12 is open
if 8 is open then
2 is open
--]]
So then to handle the events...
Code:
function UI:HandleActionLayer()
local isActive = IsActionLayerActiveByName
local l = ActionLabels
if (( isActive(l[12]) -- GameMenu
or isActive(l[2]) -- User Interface Shortcuts
or isActive(l[5]) -- Notifications
or isActive(l[3]) -- Siege
or isActive(l[4]) ) -- Dialogs
and ADDON.sv.profile.hideoninventory
)
or (isActive(l[7]) -- Conversation
and (ADDON.sv.profile.hideonconv
)
then
if UI:UI_IsShown() then
self.hiddeninlayer = true
ADDON.Menu:Hide()
self:Hide_UI(1)
end
else
if self.hiddeninlayer then
self.hiddeninlayer = nil
self:Show_UI(1)
end
end
end
So I picked the screens I want to hide my UI and if any of those action layers are active when either event fires, I hide my UI, otherwise I show it.