Skip to content

Commit acc3775

Browse files
committed
feat: let the library reskin wait for the db loaded
1 parent 857df34 commit acc3775

File tree

2 files changed

+62
-31
lines changed

2 files changed

+62
-31
lines changed

Modules/Skins/Libraries/LibQTip.lua

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,41 @@ local TT = E:GetModule("Tooltip")
55
local type = type
66
local select = select
77

8+
function S:LibQTip_SetCell(tooltip, ...)
9+
local setCell = self.hooks[tooltip] and self.hooks[tooltip].SetCell
10+
if not setCell then
11+
return
12+
end
13+
14+
local lineNum, colNum, value = select(1, ...)
15+
16+
-- Only style if we have valid parameters and string value
17+
if type(lineNum) == "number" and type(colNum) == "number" and type(value) == "string" then
18+
local styledValue = self:StyleTextureString(value)
19+
if styledValue ~= value then
20+
-- Replace the value in the argument list
21+
return setCell(tooltip, lineNum, colNum, styledValue, select(4, ...))
22+
end
23+
end
24+
25+
-- Fall back to original method
26+
return setCell(tooltip, ...)
27+
end
28+
829
function S:ReskinLibQTip(lib)
930
for _, tt in lib:IterateTooltips() do
10-
TT:SetStyle(tt)
11-
if tt.SetCell and not self:IsHooked(tt, "SetCell") then
12-
self:RawHook(tt, "SetCell", function(tooltip, ...)
13-
local lineNum, colNum, value = select(1, ...)
14-
15-
-- Only style if we have valid parameters and string value
16-
if type(lineNum) == "number" and type(colNum) == "number" and type(value) == "string" then
17-
local styledValue = self:StyleTextureString(value)
18-
if styledValue ~= value then
19-
-- Replace the value in the argument list
20-
return self.hooks[tt].SetCell(tooltip, lineNum, colNum, styledValue, select(4, ...))
21-
end
22-
end
23-
24-
-- Call original with all original parameters
25-
return self.hooks[tt].SetCell(tooltip, ...)
26-
end)
27-
end
31+
F.WaitFor(function()
32+
return E.private.WT and E.private.WT.skins and E.private.WT.skins.libraries
33+
end, function()
34+
if not E.private.WT.skins.libraries.libQTip then
35+
return
36+
end
37+
38+
TT:SetStyle(tt)
39+
if tt.SetCell and not self:IsHooked(tt, "SetCell") then
40+
self:RawHook(tt, "SetCell", "LibQTip_SetCell")
41+
end
42+
end)
2843
end
2944
end
3045

Modules/Skins/Libraries/SecureTabs.lua

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,41 @@ local pairs = pairs
66
local function reskinTab(lib, panel)
77
if lib.tabs[panel] then
88
for _, tab in pairs(lib.tabs[panel]) do
9-
if not tab.__wind then
10-
S:Proxy("HandleTab", tab)
11-
S:ReskinTab(tab)
12-
tab:Hide()
13-
tab:Show() -- Fix the text ... issue
14-
tab.__wind = true
15-
end
9+
F.WaitFor(function()
10+
return E.private.WT and E.private.WT.skins and E.private.WT.skins.libraries
11+
end, function()
12+
if not E.private.WT.skins.libraries.secureTabs then
13+
return
14+
end
15+
16+
if not tab.__windSkin then
17+
S:Proxy("HandleTab", tab)
18+
S:ReskinTab(tab)
19+
tab:Hide()
20+
tab:Show() -- Fix the text ... issue
21+
tab.__windSkin = true
22+
end
23+
end)
1624
end
1725
end
1826
end
1927

2028
local function reskinCoverTab(lib, panel)
2129
local cover = lib.covers[panel]
22-
if cover and not cover.__wind then
23-
S:Proxy("HandleTab", cover)
24-
cover.backdrop.Center:SetAlpha(0)
25-
cover:SetPushedTextOffset(0, 0)
26-
cover.__wind = true
27-
end
30+
F.WaitFor(function()
31+
return E.private.WT and E.private.WT.skins and E.private.WT.skins.libraries
32+
end, function()
33+
if not E.private.WT.skins.libraries.secureTabs then
34+
return
35+
end
36+
37+
if cover and not cover.__windSkin then
38+
S:Proxy("HandleTab", cover)
39+
cover.backdrop.Center:SetAlpha(0)
40+
cover:SetPushedTextOffset(0, 0)
41+
cover.__windSkin = true
42+
end
43+
end)
2844
end
2945

3046
function S:SecureTabs(lib)

0 commit comments

Comments
 (0)