Quantcast

Fixed a bug where chat frames would sometimes stay unlocked.

Xruptor [11-08-16 - 12:41]
Fixed a bug where chat frames would sometimes stay unlocked.
-FIXED: Forcing all chat frames to be locked after they are restored.
-FIXED: An issue where sometimes the chat index isn't passed correctly. (Thanks Blizzard :P)
Filename
XanChat.lua
XanChat.toc
diff --git a/XanChat.lua b/XanChat.lua
index 11bbf12..e10e750 100644
--- a/XanChat.lua
+++ b/XanChat.lua
@@ -324,13 +324,13 @@ local function RestoreSettings(chatFrame, index)

 	if not XCHT_DB then return end
 	if not XCHT_DB.frames then return end
-	if not XCHT_DB.frames[chatFrame:GetID()] then return end
+	if not XCHT_DB.frames[index] then return end

-	local db = XCHT_DB.frames[chatFrame:GetID()]
+	local db = XCHT_DB.frames[index]

 	if db.windowMessages then
 		--remove current window messages
-		local oldWindowMessages = { GetChatWindowMessages(chatFrame:GetID())}
+		local oldWindowMessages = { GetChatWindowMessages(index)}
 		for k=1, #oldWindowMessages do
 			RemoveChatWindowMessages(index, oldWindowMessages[k])
 		end
@@ -343,7 +343,7 @@ local function RestoreSettings(chatFrame, index)

 	if db.windowChannels then
 		--remove current window channels
-		local oldWindowChannels = { GetChatWindowChannels(chatFrame:GetID())}
+		local oldWindowChannels = { GetChatWindowChannels(index)}
 		for k=1, #oldWindowChannels do
 			RemoveChatWindowChannel(index, oldWindowChannels[k])
 		end
@@ -450,6 +450,10 @@ function eFrame:PLAYER_LOGIN()
 			--restore any settings
 			RestoreSettings(f, i)

+			--always lock the frames regardless
+			SetChatWindowLocked(i, true)
+			FCF_SetLocked(f, true)
+
 			--add font shadows
 			if XCHT_DB.addFontShadow then
 				local font, size = f:GetFont()
@@ -461,7 +465,7 @@ function eFrame:PLAYER_LOGIN()
 			f:EnableMouseWheel(true)
 			f:SetScript('OnMouseWheel', scrollChat)
 			f:SetClampRectInsets(0,0,0,0)
-
+
 			local editBox = _G[n.."EditBox"]

 			if not editBox.left then
@@ -517,7 +521,7 @@ function eFrame:PLAYER_LOGIN()
 			end

 		end
-
+
 	end

 	--show/hide the chat social buttons
@@ -666,6 +670,10 @@ function eFrame:UI_SCALE_CHANGED()

 			--restore any settings
 			RestoreSettings(f, i)
+
+			--always lock the frames regardless (using both calls just in case)
+			SetChatWindowLocked(i, true)
+			FCF_SetLocked(f, true)
 		end
 	end
 end
diff --git a/XanChat.toc b/XanChat.toc
index a614785..f04ba4d 100644
--- a/XanChat.toc
+++ b/XanChat.toc
@@ -2,7 +2,7 @@
 ## Title: xanChat
 ## Notes: A very minimalistic chat modification addon.
 ## Author: Xruptor
-## Version: 4.2
+## Version: 4.3
 ## OptionalDeps: tekDebug
 ## SavedVariables: XCHT_DB