View Single Post
05-04-09, 10:16 AM   #21
Tristanian
Andúril
Premium Member
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 279
Ok, the way I see it, nUI is hooking a function (TitanPanelBarButton_ToggleBarsShown) that does not get called on initialization, meaning on PLAYER_ENTERING_WORLD, when both top and bottom bars are enabled. On the other hand nUI is correctly hooking TitanPanelBarButton_TogglePosition that does get called on PEW, when only the top bar is present and displayed.

A quick fix (may not be perfect since I've only done basic testing), I've found is the following :

local function onTitanPanelEvent()

-- nUI_ProfileStart( ProfileCounter, "onTitanPanelEvent", event );

if IsAddOnLoaded( "Titan" ) then

hooksecurefunc( "TitanPanelBarButton_ToggleAutoHide", DetectTitanBars );
hooksecurefunc( "TitanPanelBarButton_ToggleAuxAutoHide", DetectTitanBars );
hooksecurefunc( "TitanPanelBarButton_TogglePosition", DetectTitanBars );
-- Tristanian : Hook DisplayBarsWanted instead of ToggleBarsShown, as the later
-- isn't called on PLAYER_ENTERING_WORLD and ToggleBarsShown will call DisplayBarsWanted
-- by itself.
--hooksecurefunc( "TitanPanelBarButton_ToggleBarsShown", DetectTitanBars );
hooksecurefunc( "TitanPanelBarButton_DisplayBarsWanted", DetectTitanBars );
hooksecurefunc( "TitanPanelBarButton_Hide", DetectTitanBars );
hooksecurefunc( "TitanPanelBarButton_Show", DetectTitanBars );

DetectTitanBars();

frame:UnregisterEvent( "PLAYER_ENTERING_WORLD" );

-- Titan creates this annoying bar at the bottom of the display that interferes with
-- everything even when there is no bottom bar enabled. This should clean it up.

-- Tristanian : The following lines are not required. Titan hides the TitanPanelAuxBarButtonHider
-- frame when no bottom bars are present. In addition it repositions it properly when only one bottom bar is shown. This enables the bottom bar to function properly with nUI, with or without auto-hide.

--if TitanPanelAuxBarButtonHider then
--TitanPanelAuxBarButtonHider:EnableMouse( false );
--end

end

-- nUI_ProfileStop();

end
There is still one more issue to research but I haven't got the time, since I need to raid soon :P

nUI will not play nice with a 2nd bottom bar but that can be fixed by refining the DetectTitanBars() a bit.

Last but not least, never attempt to set Titan's strata to BACKGROUND when nUI is present, it's too low and textures will overlap. It shouldn't even be needed anyway but I thought I should mention it to prevent any future issues
__________________