From e94138d20186bd5fb3033b67cb36e3424716d245 Mon Sep 17 00:00:00 2001 From: Parnic Date: Thu, 25 Jul 2024 22:25:55 -0500 Subject: [PATCH] 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. --- IceHUD.lua | 1 - changelog.md | 4 ++++ modules/PlayerHealth.lua | 4 ++-- modules/TargetHealth.lua | 4 ++-- modules/TargetInfo.lua | 4 ++-- this_version.md | 4 ++++ 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/IceHUD.lua b/IceHUD.lua index 4303096..9a41bf1 100644 --- a/IceHUD.lua +++ b/IceHUD.lua @@ -1010,7 +1010,6 @@ if UnitPopupFrames then end IceHUD.DropdownUnit = nil --- todo: update for new UnitPopup_OpenMenu() API if UnitPopup_ShowMenu then UIDropDownMenu_Initialize(IceHUD_UnitFrame_DropDown, function() if not IceHUD.DropdownUnit then diff --git a/changelog.md b/changelog.md index 56ef7b5..9f0ffc3 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Changelog +v1.15.2: + +- Re-enable right-click context menus on 11.x. + v1.15.1: - Fix error opening options. diff --git a/modules/PlayerHealth.lua b/modules/PlayerHealth.lua index c9a51da..89579de 100644 --- a/modules/PlayerHealth.lua +++ b/modules/PlayerHealth.lua @@ -922,7 +922,7 @@ function PlayerHealth.prototype:CreateBackground(redraw) 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) IceHUD.DropdownUnit = unit ToggleDropDownMenu(1, nil, IceHUD_UnitFrame_DropDown, "cursor") @@ -962,7 +962,7 @@ function PlayerHealth.prototype:EnableClickTargeting(bEnable) self.frame.button:EnableMouse(true) self.frame.button:RegisterForClicks("AnyUp") 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) -- set up click casting diff --git a/modules/TargetHealth.lua b/modules/TargetHealth.lua index a94d502..c00e1e7 100644 --- a/modules/TargetHealth.lua +++ b/modules/TargetHealth.lua @@ -714,7 +714,7 @@ function IceTargetHealth.prototype:CreateBackground(redraw) 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) IceHUD.DropdownUnit = unit ToggleDropDownMenu(1, nil, IceHUD_UnitFrame_DropDown, "cursor") @@ -733,7 +733,7 @@ function IceTargetHealth.prototype:EnableClickTargeting(bEnable) self.frame.button:EnableMouse(true) self.frame.button:RegisterForClicks("AnyUp") 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) -- set up click casting diff --git a/modules/TargetInfo.lua b/modules/TargetInfo.lua index 44de9f1..b9f7b78 100644 --- a/modules/TargetInfo.lua +++ b/modules/TargetInfo.lua @@ -1150,7 +1150,7 @@ do -- OVERRIDE: IceTargetInfo.prototype:CreateFrame(redraw) self.frame:SetScript("OnLeave", function(frame) self:OnLeave(frame) end) self.frame:SetAttribute("type1", "target") - self.frame:SetAttribute("type2", "menu") + self.frame:SetAttribute("type2", UnitPopup_ShowMenu and "menu" or "togglemenu") -- set up click casting ClickCastFrames = ClickCastFrames or {} @@ -1173,7 +1173,7 @@ do -- OVERRIDE: IceTargetInfo.prototype:CreateFrame(redraw) 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) IceHUD.DropdownUnit = unit ToggleDropDownMenu(1, nil, IceHUD_UnitFrame_DropDown, "cursor") diff --git a/this_version.md b/this_version.md index 3afbab6..7283aef 100644 --- a/this_version.md +++ b/this_version.md @@ -1,5 +1,9 @@ # Changelog +v1.15.2: + +- Re-enable right-click context menus on 11.x. + v1.15.1: - Fix error opening options.