From 551ad4c27dfe5c87ce4084e454ad8ffd0049b5d7 Mon Sep 17 00:00:00 2001 From: Xruptor Date: Wed, 26 Oct 2016 09:22:16 -0400 Subject: [PATCH] Small fix for Chat Windows reverting back to defaults when alt-tabbing or changing the UI Scale. TOC Update Legion 7.1 --- XanChat.lua | 30 ++++++++++++++++++++++++------ XanChat.toc | 4 ++-- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/XanChat.lua b/XanChat.lua index 930f68b..6f24a37 100644 --- a/XanChat.lua +++ b/XanChat.lua @@ -1,15 +1,18 @@ --Some stupid custom Chat modifications for made for myself. --Sharing it with the world in case anybody wants to actually use this. ---[[------------------------ - Scrolling and Chat Links ---------------------------]] +local eFrame = CreateFrame("frame","xanChatEvent_Frame",UIParent) +eFrame:SetScript("OnEvent", function(self, event, ...) if self[event] then return self[event](self, event, ...) end end) local debugf = tekDebug and tekDebug:GetFrame("xanChat") local function Debug(...) if debugf then debugf:AddMessage(string.join(", ", tostringall(...))) end end +--[[------------------------ + Scrolling and Chat Links +--------------------------]] + local StickyTypeChannels = { SAY = 1, YELL = 0, @@ -193,9 +196,6 @@ ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", urlFilter) CORE LOAD --------------------------]] -local eFrame = CreateFrame("frame","xanChatEvent_Frame",UIParent) -eFrame:SetScript("OnEvent", function(self, event, ...) if self[event] then return self[event](self, event, ...) end end) - local dummy = function(self) self:Hide() end local msgHooks = {} @@ -629,8 +629,26 @@ function eFrame:PLAYER_LOGIN() local ver = GetAddOnMetadata("xanChat","Version") or '1.0' DEFAULT_CHAT_FRAME:AddMessage(string.format("|cFF99CC33%s|r [v|cFFDF2B2B%s|r] Loaded", "xanChat", ver or "1.0")) + + eFrame:RegisterEvent("UI_SCALE_CHANGED") eFrame:UnregisterEvent("PLAYER_LOGIN") end +--this is the fix for alt-tabbing resizing our chatboxes +function eFrame:UI_SCALE_CHANGED() + for i = 1, NUM_CHAT_WINDOWS do + local n = ("ChatFrame%d"):format(i) + local f = _G[n] + + if f then + --restore saved layout + RestoreLayout(f) + + --restore any settings + RestoreSettings(f, i) + end + end +end + if IsLoggedIn() then eFrame:PLAYER_LOGIN() else eFrame:RegisterEvent("PLAYER_LOGIN") end diff --git a/XanChat.toc b/XanChat.toc index d8842cc..5dcc166 100644 --- a/XanChat.toc +++ b/XanChat.toc @@ -1,8 +1,8 @@ -## Interface: 70000 +## Interface: 70100 ## Title: xanChat ## Notes: A very minimalistic chat modification addon. ## Author: Xruptor -## Version: 4.0 +## Version: 4.1 ## OptionalDeps: tekDebug ## SavedVariables: XCHT_DB -- 1.7.9.5