Restore context menus for Health and Info modules

Apparently we don't have to do any of this anymore (and might not have had to do it for a long time, but I missed the memo) so if we can, just use the built-in menuing stuff. Setting focus doesn't trigger taint with this.
This commit is contained in:
Parnic
2024-07-25 22:25:55 -05:00
parent 8a3f9e19d0
commit e94138d201
6 changed files with 14 additions and 7 deletions

View File

@ -1010,7 +1010,6 @@ if UnitPopupFrames then
end end
IceHUD.DropdownUnit = nil IceHUD.DropdownUnit = nil
-- todo: update for new UnitPopup_OpenMenu() API
if UnitPopup_ShowMenu then if UnitPopup_ShowMenu then
UIDropDownMenu_Initialize(IceHUD_UnitFrame_DropDown, function() UIDropDownMenu_Initialize(IceHUD_UnitFrame_DropDown, function()
if not IceHUD.DropdownUnit then if not IceHUD.DropdownUnit then

View File

@ -1,5 +1,9 @@
# Changelog # Changelog
v1.15.2:
- Re-enable right-click context menus on 11.x.
v1.15.1: v1.15.1:
- Fix error opening options. - Fix error opening options.

View File

@ -922,7 +922,7 @@ function PlayerHealth.prototype:CreateBackground(redraw)
end end
end end
if not self.frame.button.menu then if not self.frame.button.menu and UnitPopup_ShowMenu then
self.frame.button.menu = function(this, unit) self.frame.button.menu = function(this, unit)
IceHUD.DropdownUnit = unit IceHUD.DropdownUnit = unit
ToggleDropDownMenu(1, nil, IceHUD_UnitFrame_DropDown, "cursor") ToggleDropDownMenu(1, nil, IceHUD_UnitFrame_DropDown, "cursor")
@ -962,7 +962,7 @@ function PlayerHealth.prototype:EnableClickTargeting(bEnable)
self.frame.button:EnableMouse(true) self.frame.button:EnableMouse(true)
self.frame.button:RegisterForClicks("AnyUp") self.frame.button:RegisterForClicks("AnyUp")
self.frame.button:SetAttribute("type1", "target") self.frame.button:SetAttribute("type1", "target")
self.frame.button:SetAttribute("type2", "menu") self.frame.button:SetAttribute("type2", UnitPopup_ShowMenu and "menu" or "togglemenu")
self.frame.button:SetAttribute("unit", self.unit) self.frame.button:SetAttribute("unit", self.unit)
-- set up click casting -- set up click casting

View File

@ -714,7 +714,7 @@ function IceTargetHealth.prototype:CreateBackground(redraw)
end end
end end
if not self.frame.button.menu then if not self.frame.button.menu and UnitPopup_ShowMenu then
self.frame.button.menu = function(this, unit) self.frame.button.menu = function(this, unit)
IceHUD.DropdownUnit = unit IceHUD.DropdownUnit = unit
ToggleDropDownMenu(1, nil, IceHUD_UnitFrame_DropDown, "cursor") ToggleDropDownMenu(1, nil, IceHUD_UnitFrame_DropDown, "cursor")
@ -733,7 +733,7 @@ function IceTargetHealth.prototype:EnableClickTargeting(bEnable)
self.frame.button:EnableMouse(true) self.frame.button:EnableMouse(true)
self.frame.button:RegisterForClicks("AnyUp") self.frame.button:RegisterForClicks("AnyUp")
self.frame.button:SetAttribute("type1", "target") self.frame.button:SetAttribute("type1", "target")
self.frame.button:SetAttribute("type2", "menu") self.frame.button:SetAttribute("type2", UnitPopup_ShowMenu and "menu" or "togglemenu")
self.frame.button:SetAttribute("unit", self.unit) self.frame.button:SetAttribute("unit", self.unit)
-- set up click casting -- set up click casting

View File

@ -1150,7 +1150,7 @@ do -- OVERRIDE: IceTargetInfo.prototype:CreateFrame(redraw)
self.frame:SetScript("OnLeave", function(frame) self:OnLeave(frame) end) self.frame:SetScript("OnLeave", function(frame) self:OnLeave(frame) end)
self.frame:SetAttribute("type1", "target") self.frame:SetAttribute("type1", "target")
self.frame:SetAttribute("type2", "menu") self.frame:SetAttribute("type2", UnitPopup_ShowMenu and "menu" or "togglemenu")
-- set up click casting -- set up click casting
ClickCastFrames = ClickCastFrames or {} ClickCastFrames = ClickCastFrames or {}
@ -1173,7 +1173,7 @@ do -- OVERRIDE: IceTargetInfo.prototype:CreateFrame(redraw)
self.frame:SetAttribute("unit", self.unit) self.frame:SetAttribute("unit", self.unit)
if not self.frame.menu then if not self.frame.menu and UnitPopup_ShowMenu then
self.frame.menu = function(this, unit) self.frame.menu = function(this, unit)
IceHUD.DropdownUnit = unit IceHUD.DropdownUnit = unit
ToggleDropDownMenu(1, nil, IceHUD_UnitFrame_DropDown, "cursor") ToggleDropDownMenu(1, nil, IceHUD_UnitFrame_DropDown, "cursor")

View File

@ -1,5 +1,9 @@
# Changelog # Changelog
v1.15.2:
- Re-enable right-click context menus on 11.x.
v1.15.1: v1.15.1:
- Fix error opening options. - Fix error opening options.