<commit_before>
--[[!
	\author <NAME>, <EMAIL>, Spain 

	\file
	\brief Este script permite cambiar la apariencia del cursor del MTA en base a los themes de dxgui.
]]


local function dxCreateCursor()
	local cursor = createElement("dxCursor");
	setElementData(cursor, "color", tocolor(255,255,255,getCursorAlpha()));
	setElementData(cursor, "backgroundComponent", dxGetRootPane());
	
	addEventHandler("onClientElementDestroy", cursor,
		function()
			setCursorAlpha(extractalpha(getElementData(source, "color")));
		end);
	return cursor;
end;

--// Eventos
addEventHandler("onClientResourceStart", resourceRoot, 
	function()
		local cursor = dxCreateCursor();
		setElementData(dxGetRootPane(), "cursor", cursor);
		
		addEventHandler("onClientElementDestroy", dxGetRootPane(),
			function() 
				local cursor = getElementData(dxGetRootPane(), "cursor");
				local backgroundComponent = getElementData(cursor, "backgroundComponent");
				local aux = backgroundComponent;
				while (getElementType(getElementParent(aux)) ~= "dxRootPane") and (aux ~= source) do 
					aux = getElementParent(aux);
				end;		
				if (aux == source) and (getElementType(source) ~= "dxRootPane") then 
					setElementData(cursor, "backgroundComponent", getElementParent(source));
				end; 
			end)
	end, false, "normal-1");


addEventHandler("onClientRender", root,
	function() 
		if isCursorShowing() then 
			local cursor = getElementData(dxGetRootPane(), "cursor");

			local r, g, b, a = fromcolor(getElementData(cursor, "color")); 
			if getCursorAlpha() ~= 0 then 
				a = getCursorAlpha();
				setCursorAlpha(0);
			end;
			-- get cursor position.<commit_msg>Eliminado bucle infinito que atascaba al cliente al parar el recurso dxgui<commit_after>
--[[!
	\author <NAME>, <EMAIL>, Spain 

	\file
	\brief Este script permite cambiar la apariencia del cursor del MTA en base a los themes de dxgui.
]]


local function dxCreateCursor()
	local cursor = createElement("dxCursor");
	setElementData(cursor, "color", tocolor(255,255,255,getCursorAlpha()));
	setElementData(cursor, "backgroundComponent", dxGetRootPane());
	
	addEventHandler("onClientElementDestroy", cursor,
		function()
			setCursorAlpha(extractalpha(getElementData(source, "color")));
		end);
	return cursor;
end;

--// Eventos
addEventHandler("onClientResourceStart", resourceRoot, 
	function()
		local cursor = dxCreateCursor();
		setElementData(dxGetRootPane(), "cursor", cursor);
		
		addEventHandler("onClientElementDestroy", dxGetRootPane(),
			function() 
				if getElementType(source) ~= "dxRootPane" then 
					local cursor = getElementData(dxGetRootPane(), "cursor");
					local backgroundComponent = getElementData(cursor, "backgroundComponent");
					local aux = backgroundComponent;
					while (getElementType(getElementParent(aux)) ~= "dxRootPane") and (aux ~= source) do 
						aux = getElementParent(aux);
					end;		
					if aux == source then 
						setElementData(cursor, "backgroundComponent", getElementParent(source));
					end;
				end;		
			end)
	end, false, "normal-1");


addEventHandler("onClientRender", root,
	function() 
		if isCursorShowing() then 
			local cursor = getElementData(dxGetRootPane(), "cursor");

			local r, g, b, a = fromcolor(getElementData(cursor, "color")); 
			if getCursorAlpha() ~= 0 then 
				a = getCursorAlpha();
				setCursorAlpha(0);
			end;
			-- get cursor position.
{'fraction_non_alphanumeric': 0.12793113683585633, 'fraction_numerical': 0.007123775601068566, 'mean_word_length': 4.881326352530541, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6494396', 'n_tokens_mistral': 1153, 'n_tokens_neox': 1000, 'n_words': 256}