Skip to content

Commit 8c19c82

Browse files
committed
Fix hook issue #16
1 parent 0a70de5 commit 8c19c82

1 file changed

Lines changed: 19 additions & 8 deletions

File tree

LibDropdown-1.0/LibDropdown-1.0.lua

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
local MAJOR = "LibDropdown-1.0"
2-
local MINOR = 3
2+
local MINOR = 2024
33

44
local lib = LibStub:NewLibrary(MAJOR, MINOR)
55
if not lib then return end
@@ -1193,13 +1193,24 @@ local t = {
11931193
--[[function testlibdropdown()
11941194
LibStub("LibDropdown-1.0"):OpenAce3Menu(t)
11951195
end]]
1196+
if UIDropDownMenu_HandleGlobalMouseEvent then
1197+
hooksecurefunc("UIDropDownMenu_HandleGlobalMouseEvent", function(button, event)
1198+
if openMenu and event == "GLOBAL_MOUSE_DOWN" and (button == "LeftButton" or button == "RightButton") then
1199+
for i = 0, frameCount - 1 do
1200+
if _G["LibDropdownFrame" .. i]:IsMouseOver() then return end
1201+
end
11961202

1197-
hooksecurefunc("UIDropDownMenu_HandleGlobalMouseEvent", function(button, event)
1198-
if openMenu and event == "GLOBAL_MOUSE_DOWN" and (button == "LeftButton" or button == "RightButton") then
1199-
for i = 0, frameCount - 1 do
1200-
if _G["LibDropdownFrame" .. i]:IsMouseOver() then return end
1203+
openMenu:Release()
12011204
end
1205+
end)
1206+
else
1207+
lib.mousecallback = EventRegistry:RegisterFrameEventAndCallback("GLOBAL_MOUSE_DOWN",function(ownerID,button)
1208+
if openMenu and (button == "LeftButton" or button == "RightButton") then
1209+
for i = 0, frameCount - 1 do
1210+
if _G["LibDropdownFrame" .. i]:IsMouseOver() then return end
1211+
end
12021212

1203-
openMenu:Release()
1204-
end
1205-
end)
1213+
openMenu:Release()
1214+
end
1215+
end)
1216+
end

0 commit comments

Comments
 (0)