From 580eb9a6ac25867422052b9a3125e8d3b21d0b36 Mon Sep 17 00:00:00 2001 From: shagu Date: Thu, 29 Jun 2023 10:54:39 +0200 Subject: [PATCH] chat: disable game function that closes chat windows The 'GetChatWindowInfo' function returns shown as 'false' while the UIParent is hidden (Alt+Z). Based on that return value, the 'FloatingChatFrame_Update' would remove every chat frame, that isn't tabbed while the interface is hidden. With this overwrite we prevent the original 'FloatingChatFrame_Update' function from being called during that time to avoid this behaviour. --- modules/chat.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/chat.lua b/modules/chat.lua index 0c48e206..195dac65 100644 --- a/modules/chat.lua +++ b/modules/chat.lua @@ -3,6 +3,19 @@ pfUI:RegisterModule("chat", "vanilla:tbc", function () local panelfont_size = C.panel.use_unitfonts == "1" and C.global.font_unit_size or C.global.font_size local rawborder, default_border = GetBorderSize("chat") + if pfUI.client <= 11200 then + -- The 'GetChatWindowInfo' function returns shown as 'false' while the UIParent is hidden (Alt+Z). + -- Based on that return value, the 'FloatingChatFrame_Update' would remove every chat frame, + -- that isn't tabbed while the interface is hidden. With this hook we prevent the original + -- 'FloatingChatFrame_Update' function from being called during that time. + + local HookFloatingChatFrame_Update = _G.FloatingChatFrame_Update + _G.FloatingChatFrame_Update = function(id, onUpdateEvent) + if not UIParent:IsShown() then return end + HookFloatingChatFrame_Update(id, onUpdateEvent) + end + end + _G.CHAT_FONT_HEIGHTS = { 8, 10, 12, 14, 16, 18, 20 } -- add dropdown menu button to ignore player