LibDropdown-1.0

LibDropdown-1.0

153k Downloads

UIDropDownMenu_HandleGlobalMouseEvent broken on all classic versions

Road-block opened this issue ยท 1 comments

commented

UIDropDownMenu_HandleGlobalMouseEvent does not exist as a global in Vanilla/Wrath/Cata (beta)

Library errors on all of those clients and probably has for a couple years now.

Only reason I didn't notice it was I was packaging one from 2022 and had no other addon pulling in a more recent one to overwrite it.

In addition to that, despite this is a breaking change the minor (3) hasn't been incremented so which version remains in memory after LibStub is done is completely random (depends which addon embedding the library loads first)

commented
if UIDropDownMenu_HandleGlobalMouseEvent then
	hooksecurefunc("UIDropDownMenu_HandleGlobalMouseEvent", function(button, event)
		if openMenu and event == "GLOBAL_MOUSE_DOWN" and (button == "LeftButton" or button == "RightButton") then
			for i = 0, frameCount - 1 do
				if _G["LibDropdownFrame" .. i]:IsMouseOver() then return end
			end

			openMenu:Release()
		end
	end)
else
	lib.mousecallback = EventRegistry:RegisterFrameEventAndCallback("GLOBAL_MOUSE_DOWN",function(ownerID,button)
		if openMenu and (button == "LeftButton" or button == "RightButton") then
			for i = 0, frameCount - 1 do
				if _G["LibDropdownFrame" .. i]:IsMouseOver() then return end
			end

			openMenu:Release()
		end
	end)
end

might work on all versions (limited testing)