Skip to content

Commit

Permalink
LibDialog fix
Browse files Browse the repository at this point in the history
Temporarily bumped major version until a fix is officially implemented
  • Loading branch information
evil-morfar committed May 7, 2024
1 parent 87b945b commit a6f99da
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 22 deletions.
39 changes: 24 additions & 15 deletions Libs/LibDialog-1.0/LibDialog-1.0.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ local table = _G.table
-- Library namespace.
-----------------------------------------------------------------------
local LibStub = _G.LibStub
local MAJOR = "LibDialog-1.0"
local MAJOR = "LibDialog-1.1" -- EDIT: Bump major until https://github.com/Torhal/LibDialog-1.0/issues/5 is implemented

_G.assert(LibStub, MAJOR .. " requires LibStub")
-- RCLC: Note bumped minor +1 to avoid incompabilities with old addons.
Expand Down Expand Up @@ -128,6 +128,27 @@ local icon_heap = lib.icon_heap
-----------------------------------------------------------------------
-- Helper functions.
-----------------------------------------------------------------------
local function _SetupAnchor(dialog)
local default_dialog
if _G.StaticPopup_DisplayedFrames then
default_dialog = _G.StaticPopup_DisplayedFrames[#_G.StaticPopup_DisplayedFrames]
elseif (_G.StaticPopup_HasDisplayedFrames and _G.StaticPopup_IsLastDisplayedFrame) then
if StaticPopup_HasDisplayedFrames() then
for idx = STATICPOPUP_NUMDIALOGS, 1, -1 do
local test_dialog = _G["StaticPopup" .. idx]
if StaticPopup_IsLastDisplayedFrame(test_dialog) then
default_dialog = test_dialog
end
end
end
end
if default_dialog then
dialog:SetPoint("TOP", default_dialog, "BOTTOM", 0, 0)
else
dialog:SetPoint("TOP", _G.UIParent, "TOP", 0, -135)
end
end

local function _ProcessQueue()
if #active_dialogs == MAX_DIALOGS then
return
Expand All @@ -152,13 +173,7 @@ local function _RefreshDialogAnchors()
current_dialog:ClearAllPoints()

if index == 1 then
local default_dialog = _G.StaticPopup_DisplayedFrames[#_G.StaticPopup_DisplayedFrames]

if default_dialog then
current_dialog:SetPoint("TOP", default_dialog, "BOTTOM", 0, 0)
else
current_dialog:SetPoint("TOP", _G.UIParent, "TOP", 0, -135)
end
_SetupAnchor(current_dialog)
else
current_dialog:SetPoint("TOP", active_dialogs[index - 1], "BOTTOM", 0, 0)
end
Expand Down Expand Up @@ -834,13 +849,7 @@ function lib:Spawn(reference, data)
if #active_dialogs > 0 then
dialog:SetPoint("TOP", active_dialogs[#active_dialogs], "BOTTOM", 0, 0)
else
local default_dialog = _G.StaticPopup_DisplayedFrames[#_G.StaticPopup_DisplayedFrames]

if default_dialog then
dialog:SetPoint("TOP", default_dialog, "BOTTOM", 0, 0)
else
dialog:SetPoint("TOP", _G.UIParent, "TOP", 0, -135)
end
_SetupAnchor(dialog)
end
active_dialogs[#active_dialogs + 1] = dialog
dialog:Show()
Expand Down
2 changes: 1 addition & 1 deletion Modules/History/CSVImport.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local addon = select(2, ...)
local His = addon:GetModule("RCLootHistory")
--- @type RCLootCouncilLocale
local L = LibStub("AceLocale-3.0"):GetLocale("RCLootCouncil")
local LibDialog = LibStub("LibDialog-1.0")
local LibDialog = LibStub("LibDialog-1.1")
local private = {
errorList = {
-- [i] = {line, cause}
Expand Down
2 changes: 1 addition & 1 deletion Modules/Sync.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
local addon = select(2, ...)
---@class Sync : AceSerializer-3.0
local sync = addon:NewModule("Sync", "AceSerializer-3.0")
local LibDialog = LibStub("LibDialog-1.0")
local LibDialog = LibStub("LibDialog-1.1")
local LD = LibStub("LibDeflate")
--- @type RCLootCouncilLocale
local L = LibStub("AceLocale-3.0"):GetLocale("RCLootCouncil")
Expand Down
2 changes: 1 addition & 1 deletion Modules/TradeUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ addon.TradeUI = TradeUI -- Shorthand for easier access
local ST = LibStub("ScrollingTable")
--- @type RCLootCouncilLocale
local L = LibStub("AceLocale-3.0"):GetLocale("RCLootCouncil")
local LibDialog = LibStub("LibDialog-1.0")
local LibDialog = LibStub("LibDialog-1.1")
local _G = _G
local Comms = addon.Require "Services.Comms"
local PREFIX = addon.PREFIXES.MAIN
Expand Down
2 changes: 1 addition & 1 deletion Modules/votingFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
local addon = select(2, ...)
--- @class RCVotingFrame : AceTimer-3.0, AceEvent-3.0, AceBucket-3.0
local RCVotingFrame = addon:NewModule("RCVotingFrame", "AceTimer-3.0", "AceEvent-3.0", "AceBucket-3.0")
local LibDialog = LibStub("LibDialog-1.0")
local LibDialog = LibStub("LibDialog-1.1")
--- @type RCLootCouncilLocale
local L = LibStub("AceLocale-3.0"):GetLocale("RCLootCouncil")

Expand Down
2 changes: 1 addition & 1 deletion Utils/popups.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

--- @type RCLootCouncil
local addon = select(2, ...)
local LibDialog = LibStub("LibDialog-1.0")
local LibDialog = LibStub("LibDialog-1.1")
--- @type RCLootCouncilLocale
local L = LibStub("AceLocale-3.0"):GetLocale("RCLootCouncil")

Expand Down
2 changes: 1 addition & 1 deletion __tests/__load_libs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dofile "Libs/AceComm-3.0/ChatThrottleLib.lua"
dofile "Libs/AceComm-3.0/AceComm-3.0.lua"
dofile "Libs/AceSerializer-3.0/AceSerializer-3.0.lua"

dofile "Libs/LibDialog-1.0/LibDialog-1.0.lua"
dofile "Libs/LibDialog-1.0/LibDialog-1.1.lua"
dofile "Libs/LibWindow-1.1/LibWindow-1.1.lua"
dofile "Libs/lib-st/Core.lua"
dofile "Libs/MSA-DropDownMenu-1.0/MSA-DropDownMenu-1.0.lua"
Expand Down
2 changes: 1 addition & 1 deletion core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ local addonname, addontable = ...
--- @class RCLootCouncil : AceAddon-3.0, AceConsole-3.0, AceEvent-3.0, AceHook-3.0, AceTimer-3.0, AceBucket-3.0
_G.RCLootCouncil = LibStub("AceAddon-3.0"):NewAddon(addontable, addonname, "AceConsole-3.0", "AceEvent-3.0",
"AceHook-3.0", "AceTimer-3.0", "AceBucket-3.0");
local LibDialog = LibStub("LibDialog-1.0")
local LibDialog = LibStub("LibDialog-1.1")
--- @type RCLootCouncilLocale
local L = LibStub("AceLocale-3.0"):GetLocale("RCLootCouncil")
local tooltipForParsing = CreateFrame("GameTooltip", "RCLootCouncil_Tooltip_Parse", nil, "GameTooltipTemplate")
Expand Down

0 comments on commit a6f99da

Please sign in to comment.