@@ -16,8 +16,9 @@ local QTIP = LibStub("LibQTip-1.0")
1616local AC = LibStub (" AceConfig-3.0" )
1717local ACD = LibStub (" AceConfigDialog-3.0" )
1818local DB = LibStub (" AceDB-3.0" )
19- local LDB = LibStub (" LibDataBroker-1.1" , true )
20- local LD = LibStub (" LibDropdown-1.0" )
19+ local LDB = LibStub (" LibDataBroker-1.1" , true )
20+ local LD = LibStub (" LibDropdown-1.0" )
21+ local MagicUtil = LibStub (" LibMagicUtil-1.0" )
2122
2223
2324local _G = _G
@@ -373,6 +374,33 @@ function mod:MAIL_SHOW()
373374 end
374375
375376 self :ShowInboxGUI ()
377+ -- Watch for mail frame changes (e.g. TSM toggling between its UI and the default)
378+ mod ._lastMailFrame = nil
379+ if not mod ._mailFrameWatcher then
380+ mod ._mailFrameWatcher = self :ScheduleRepeatingTimer (" CheckMailFrameChanged" , 0.2 )
381+ end
382+ end
383+
384+ function mod :CheckMailFrameChanged ()
385+ local mailFrame , isTSM = MagicUtil :GetMailFrame ()
386+ if mailFrame ~= mod ._lastMailFrame then
387+ mod ._lastMailFrame = mailFrame
388+ if isTSM then
389+ -- TSM active: always show inbox alongside send queue
390+ self :ShowInboxGUI ()
391+ -- Tell BulkMail2 to reposition send queue now that inbox is shown
392+ if BulkMail and BulkMail .sendQueueTooltip then
393+ BulkMail :ShowSendQueueGUI ()
394+ end
395+ else
396+ -- Switching to normal UI: show inbox only if on Inbox tab
397+ if SendMailFrame and SendMailFrame :IsShown () then
398+ self :HideInboxGUI ()
399+ else
400+ self :ShowInboxGUI ()
401+ end
402+ end
403+ end
376404end
377405
378406function mod :PLAYER_INTERACTION_MANAGER_FRAME_HIDE (_ , type )
383411
384412function mod :MAIL_CLOSED ()
385413 takeAllInProgress = false
414+ if mod ._mailFrameWatcher then
415+ self :CancelTimer (mod ._mailFrameWatcher )
416+ mod ._mailFrameWatcher = nil
417+ end
418+ mod ._lastMailFrame = nil
386419 self :HideInboxGUI ()
387420 GameTooltip :Hide ()
388421 self :UnhookAll ()
@@ -1017,12 +1050,22 @@ function mod:AdjustSizeAndPosition(tooltip)
10171050
10181051 -- Only adjust point if user hasn't moved manually. This puts it lined up with the mail window
10191052 -- or in the middle of the screen it's too large to fit from the top of the mail window and down
1020- if not tooltip .moved and MailFrame ~= nil and MailFrame :GetTop () ~= nil then
1021- local tipHeight = tooltip :GetHeight () * scale
1022- tooltip :ClearAllPoints ()
1023- -- Calculate a good offset
1024- local offx = math.min ((uiHeight - tipHeight - barHeight )/ 2 , uiHeight + 12 - MailFrame :GetTop ()* MailFrame :GetScale ())+ barHeight
1025- tooltip :SetPoint (" TOPLEFT" , UIParent , " TOPLEFT" , MailFrame :GetRight ()* MailFrame :GetScale ()/ scale , - offx / scale )
1053+ mod :RepositionTooltip (tooltip , scale , barHeight )
1054+ end
1055+
1056+ function mod :RepositionTooltip (tooltip , scale , barHeight )
1057+ if not tooltip or tooltip .moved then return end
1058+ local mailFrame , isTSM = MagicUtil :GetMailFrame ()
1059+ -- Offset down by toolbar height so the toolbar (anchored above the tooltip)
1060+ -- aligns with the top of the mail frame
1061+ local toolbarOffset = mod ._toolbar and mod ._toolbar :GetHeight () or 0
1062+ tooltip :ClearAllPoints ()
1063+ if isTSM then
1064+ tooltip :SetPoint (" TOPLEFT" , mailFrame , " TOPRIGHT" , 5 , - toolbarOffset )
1065+ elseif MailFrame and MailFrame :GetRight () then
1066+ tooltip :SetPoint (" TOPLEFT" , MailFrame , " TOPRIGHT" , 5 , - toolbarOffset )
1067+ else
1068+ tooltip :SetPoint (" TOP" , UIParent , " TOP" , 0 , - toolbarOffset )
10261069 end
10271070end
10281071
0 commit comments