diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..cd108f176c137737348e4fcfb162b928c6b62af2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+!*.lib
\ No newline at end of file
diff --git a/Source/DisplayCluster/DisplayCluster.Build.cs b/Source/DisplayCluster/DisplayCluster.Build.cs
new file mode 100644
index 0000000000000000000000000000000000000000..d1a9b7e1f1f710e6f7e4b04463f40c301d8a68eb
--- /dev/null
+++ b/Source/DisplayCluster/DisplayCluster.Build.cs
@@ -0,0 +1,145 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+using UnrealBuildTool;
+using System.IO;
+
+public class DisplayCluster : ModuleRules
+{
+	private string ModulePath
+	{
+		get
+		{
+			//return Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name));
+			string ModuleFilename = UnrealBuildTool.RulesCompiler.GetFileNameFromType(GetType());
+			string ModuleBaseDirectory = Path.GetDirectoryName(ModuleFilename);
+			return ModuleBaseDirectory;
+		}
+	}
+
+	private string ThirdPartyPath
+	{
+		get
+		{
+			return Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/"));
+		}
+	}
+
+	public DisplayCluster(ReadOnlyTargetRules ROTargetRules) : base(ROTargetRules)
+	{
+		PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
+
+		PrivateIncludePaths.AddRange(
+			new string[] {
+				"DisplayCluster/Private",
+				"../../../../../Engine/Source/Runtime/Renderer/Private"
+			});
+
+		PublicDependencyModuleNames.AddRange(
+			new string[]
+			{
+				"Core",
+				"CoreUObject",
+				"Engine",
+				"InputCore"
+			});
+
+		PrivateDependencyModuleNames.AddRange(
+			new string[]
+			{
+				"Core",
+				"CoreUObject",
+				"Engine",
+				"HeadMountedDisplay",
+				"InputCore",
+				"Networking",
+				"OpenGLDrv",
+				"RHI",
+				"RenderCore",
+				"Slate",
+				"SlateCore",
+				"Sockets"
+			});
+
+		if ((ROTargetRules.Platform == UnrealTargetPlatform.Win64) || (ROTargetRules.Platform == UnrealTargetPlatform.Win32))
+		{
+			PrivateIncludePaths.AddRange(
+				new string[] {
+					"../../../../../Engine/Source/Runtime/Windows/D3D11RHI/Private",
+					"../../../../../Engine/Source/Runtime/Windows/D3D11RHI/Private/Windows",
+					"../../../../../Engine/Source/Runtime/D3D12RHI/Private",
+					"../../../../../Engine/Source/Runtime/D3D12RHI/Private/Windows"
+				});
+
+			PrivateDependencyModuleNames.AddRange(
+				new string[]
+				{
+					"D3D11RHI",
+					"D3D12RHI"
+				});
+		}
+		else if (ROTargetRules == UnrealTargetPlatform.Linux)
+		{
+			PrivateIncludePaths.AddRange(
+				new string[] {
+					"../../../../../Engine/Source/Runtime/OpenGLDrv/Private",
+					"../../../../../Engine/Source/Runtime/OpenGLDrv/Private/Linux",
+					"../../../../../Engine/Source/Runtime/OpenGLDrv/Public"
+				});
+
+			PrivateDependencyModuleNames.AddRange(
+				new string[]
+				{
+					"SDL2"
+				});
+		}
+
+		if (Target.bBuildEditor == true)
+		{
+			PrivateDependencyModuleNames.Add("UnrealEd");
+		}
+
+		AddEngineThirdPartyPrivateStaticDependencies(Target, "OpenGL");
+		AddEngineThirdPartyPrivateStaticDependencies(Target, "IntelMetricsDiscovery");
+
+		if ((ROTargetRules.Platform == UnrealTargetPlatform.Win64) || (ROTargetRules.Platform == UnrealTargetPlatform.Win32))
+		{
+			AddEngineThirdPartyPrivateStaticDependencies(Target, "DX11");
+			AddEngineThirdPartyPrivateStaticDependencies(Target, "DX12");
+			AddEngineThirdPartyPrivateStaticDependencies(Target, "NVAftermath");
+		}
+
+		// vrpn
+		AddDependencyVrpn(ROTargetRules);
+	}
+
+	public bool AddDependencyVrpn(ReadOnlyTargetRules ROTargetRules)
+	{
+		if ((ROTargetRules.Platform == UnrealTargetPlatform.Win64) || (ROTargetRules.Platform == UnrealTargetPlatform.Win32))
+		{
+			string PlatformString = (ROTargetRules.Platform == UnrealTargetPlatform.Win64) ? "x64" : "x86";
+			string LibrariesPath = Path.Combine(ThirdPartyPath, "VRPN", "Lib/" + PlatformString);
+
+			//@todo: There are also debug versions: vrpnd.lib and quatd.lib
+			PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "vrpn.lib"));
+			PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "quat.lib"));
+
+			PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "VRPN", "Include"));
+
+			return true;
+		}
+		else if (ROTargetRules == UnrealTargetPlatform.Linux)
+		{
+			string LibrariesPath = Path.Combine(ThirdPartyPath, "VRPN", "Lib/Linux");
+			
+			PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "libvrpn.lib"));
+			PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "libquat.lib"));
+			
+			PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "VRPN", "Include"));
+			PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "X11", "Include")); // Necessary for hardware swap sync.
+			
+			return true;
+		}
+
+		return false;
+	}
+}
diff --git a/Source/DisplayCluster/Private/Blueprints/DisplayClusterBlueprintAPIImpl.cpp b/Source/DisplayCluster/Private/Blueprints/DisplayClusterBlueprintAPIImpl.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..da155e8af0b19f16e648096ec90647b990878572
--- /dev/null
+++ b/Source/DisplayCluster/Private/Blueprints/DisplayClusterBlueprintAPIImpl.cpp
@@ -0,0 +1,473 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterBlueprintAPIImpl.h"
+
+#include "IDisplayCluster.h"
+
+#include "Cluster/IDisplayClusterClusterManager.h"
+#include "Config/IDisplayClusterConfigManager.h"
+#include "Game/IDisplayClusterGameManager.h"
+#include "Input/IDisplayClusterInputManager.h"
+#include "Render/IDisplayClusterRenderManager.h"
+#include "Render/IDisplayClusterStereoDevice.h"
+
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// DisplayCluster module API
+//////////////////////////////////////////////////////////////////////////////////////////////
+/** Return if the module has been initialized. */
+bool UDisplayClusterBlueprintAPIImpl::IsModuleInitialized()
+{
+	return IDisplayCluster::Get().IsModuleInitialized();
+}
+
+EDisplayClusterOperationMode UDisplayClusterBlueprintAPIImpl::GetOperationMode()
+{
+	return IDisplayCluster::Get().GetOperationMode();
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Cluster API
+//////////////////////////////////////////////////////////////////////////////////////////////
+bool UDisplayClusterBlueprintAPIImpl::IsMaster()
+{
+	IDisplayClusterClusterManager* const Manager = IDisplayCluster::Get().GetClusterMgr();
+	if (Manager)
+	{
+		return Manager->IsMaster();
+	}
+
+	return false;
+}
+
+bool UDisplayClusterBlueprintAPIImpl::IsSlave()
+{
+	return !IsMaster();
+}
+
+bool UDisplayClusterBlueprintAPIImpl::IsCluster()
+{
+	IDisplayClusterClusterManager* const Manager = IDisplayCluster::Get().GetClusterMgr();
+	if (Manager)
+	{
+		return Manager->IsCluster();
+	}
+
+	return false;
+}
+
+bool UDisplayClusterBlueprintAPIImpl::IsStandalone()
+{
+	return !IsCluster();
+}
+
+FString UDisplayClusterBlueprintAPIImpl::GetNodeId()
+{
+	IDisplayClusterClusterManager* const Manager = IDisplayCluster::Get().GetClusterMgr();
+	if (Manager)
+	{
+		return Manager->GetNodeId();
+	}
+
+	return FString();
+}
+
+int32 UDisplayClusterBlueprintAPIImpl::GetNodesAmount()
+{
+	IDisplayClusterClusterManager* const Manager = IDisplayCluster::Get().GetClusterMgr();
+	if (Manager)
+	{
+		return Manager->GetNodesAmount();
+	}
+
+	return 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Config API
+//////////////////////////////////////////////////////////////////////////////////////////////
+
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Game API
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Root
+ADisplayClusterPawn* UDisplayClusterBlueprintAPIImpl::GetRoot()
+{
+	IDisplayClusterGameManager* const Manager = IDisplayCluster::Get().GetGameMgr();
+	if (Manager)
+	{
+		return Manager->GetRoot();
+	}
+
+	return nullptr;
+}
+
+// Screens
+UDisplayClusterScreenComponent* UDisplayClusterBlueprintAPIImpl::GetActiveScreen()
+{
+	IDisplayClusterGameManager* const Manager = IDisplayCluster::Get().GetGameMgr();
+	if (Manager)
+	{
+		return Manager->GetActiveScreen();
+	}
+
+	return nullptr;
+}
+
+UDisplayClusterScreenComponent* UDisplayClusterBlueprintAPIImpl::GetScreenById(const FString& id)
+{
+	IDisplayClusterGameManager* const Manager = IDisplayCluster::Get().GetGameMgr();
+	if (Manager)
+	{
+		return Manager->GetScreenById(id);
+	}
+
+	return nullptr;
+}
+
+TArray<UDisplayClusterScreenComponent*> UDisplayClusterBlueprintAPIImpl::GetAllScreens()
+{
+	IDisplayClusterGameManager* const Manager = IDisplayCluster::Get().GetGameMgr();
+	if (Manager)
+	{
+		return Manager->GetAllScreens();
+	}
+
+	return TArray<UDisplayClusterScreenComponent*>();
+}
+
+int32 UDisplayClusterBlueprintAPIImpl::GetScreensAmount()
+{
+	IDisplayClusterGameManager* const Manager = IDisplayCluster::Get().GetGameMgr();
+	if (Manager)
+	{
+		return Manager->GetScreensAmount();
+	}
+
+	return 0;
+}
+
+// Cameras
+
+
+// Nodes
+UDisplayClusterSceneComponent* UDisplayClusterBlueprintAPIImpl::GetNodeById(const FString& id)
+{
+	IDisplayClusterGameManager* const Manager = IDisplayCluster::Get().GetGameMgr();
+	if (Manager)
+	{
+		return Manager->GetNodeById(id);
+	}
+
+	return nullptr;
+}
+
+TArray<UDisplayClusterSceneComponent*> UDisplayClusterBlueprintAPIImpl::GetAllNodes()
+{
+	IDisplayClusterGameManager* const Manager = IDisplayCluster::Get().GetGameMgr();
+	if (Manager)
+	{
+		return Manager->GetAllNodes();
+	}
+
+	return TArray<UDisplayClusterSceneComponent*>();
+}
+
+// Navigation
+USceneComponent* UDisplayClusterBlueprintAPIImpl::GetTranslationDirectionComponent()
+{
+	IDisplayClusterGameManager* const Manager = IDisplayCluster::Get().GetGameMgr();
+	if (Manager)
+	{
+		return Manager->GetTranslationDirectionComponent();
+	}
+
+	return nullptr;
+}
+
+void UDisplayClusterBlueprintAPIImpl::SetTranslationDirectionComponent(USceneComponent* const pComp)
+{
+	IDisplayClusterGameManager* const Manager = IDisplayCluster::Get().GetGameMgr();
+	if (Manager)
+	{
+		Manager->SetTranslationDirectionComponent(pComp);
+	}
+}
+
+void UDisplayClusterBlueprintAPIImpl::SetTranslationDirectionComponentId(const FString& id)
+{
+	IDisplayClusterGameManager* const Manager = IDisplayCluster::Get().GetGameMgr();
+	if (Manager)
+	{
+		Manager->SetTranslationDirectionComponent(id);
+	}
+}
+
+USceneComponent* UDisplayClusterBlueprintAPIImpl::GetRotateAroundComponent()
+{
+	IDisplayClusterGameManager* const Manager = IDisplayCluster::Get().GetGameMgr();
+	if (Manager)
+	{
+		return Manager->GetRotateAroundComponent();
+	}
+
+	return nullptr;
+}
+
+void UDisplayClusterBlueprintAPIImpl::SetRotateAroundComponent(USceneComponent* const pComp)
+{
+	IDisplayClusterGameManager* const Manager = IDisplayCluster::Get().GetGameMgr();
+	if (Manager)
+	{
+		Manager->SetRotateAroundComponent(pComp);
+	}
+}
+
+void UDisplayClusterBlueprintAPIImpl::SetRotateAroundComponentId(const FString& id)
+{
+	IDisplayClusterGameManager* const Manager = IDisplayCluster::Get().GetGameMgr();
+	if (Manager)
+	{
+		Manager->SetRotateAroundComponent(id);
+	}
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Input API
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Device information
+int32 UDisplayClusterBlueprintAPIImpl::GetAxisDeviceAmount()
+{
+	IDisplayClusterInputManager* const Manager = IDisplayCluster::Get().GetInputMgr();
+	if (Manager)
+	{
+		Manager->GetAxisDeviceAmount();
+	}
+
+	return 0;
+}
+
+int32 UDisplayClusterBlueprintAPIImpl::GetButtonDeviceAmount()
+{
+	IDisplayClusterInputManager* const Manager = IDisplayCluster::Get().GetInputMgr();
+	if (Manager)
+	{
+		Manager->GetButtonDeviceAmount();
+	}
+
+	return 0;
+}
+
+int32 UDisplayClusterBlueprintAPIImpl::GetTrackerDeviceAmount()
+{
+	IDisplayClusterInputManager* const Manager = IDisplayCluster::Get().GetInputMgr();
+	if (Manager)
+	{
+		Manager->GetTrackerDeviceAmount();
+	}
+
+	return 0;
+}
+
+bool UDisplayClusterBlueprintAPIImpl::GetAxisDeviceIds(TArray<FString>& IDs)
+{
+	TArray<FString> result;
+	IDisplayClusterInputManager* const Manager = IDisplayCluster::Get().GetInputMgr();
+	if (Manager)
+	{
+		return Manager->GetAxisDeviceIds(IDs);
+	}
+
+	return false;
+}
+
+bool UDisplayClusterBlueprintAPIImpl::GetButtonDeviceIds(TArray<FString>& IDs)
+{
+	IDisplayClusterInputManager* const Manager = IDisplayCluster::Get().GetInputMgr();
+	if (Manager)
+	{
+		return Manager->GetButtonDeviceIds(IDs);
+	}
+
+	return false;
+}
+
+bool UDisplayClusterBlueprintAPIImpl::GetTrackerDeviceIds(TArray<FString>& IDs)
+{
+	IDisplayClusterInputManager* const Manager = IDisplayCluster::Get().GetInputMgr();
+	if (Manager)
+	{
+		return Manager->GetTrackerDeviceIds(IDs);
+	}
+
+	return false;
+}
+
+// Buttons
+void UDisplayClusterBlueprintAPIImpl::GetButtonState(const FString& DeviceId, uint8 DeviceChannel, bool& CurState, bool& IsChannelAvailable)
+{
+	IDisplayClusterInputManager* const Manager = IDisplayCluster::Get().GetInputMgr();
+	if (Manager)
+	{
+		IsChannelAvailable = Manager->GetButtonState(DeviceId, DeviceChannel, CurState);
+	}
+}
+
+void UDisplayClusterBlueprintAPIImpl::IsButtonPressed(const FString& DeviceId, uint8 DeviceChannel, bool& CurPressed, bool& IsChannelAvailable)
+{
+	IDisplayClusterInputManager* const Manager = IDisplayCluster::Get().GetInputMgr();
+	if (Manager)
+	{
+		IsChannelAvailable = Manager->IsButtonPressed(DeviceId, DeviceChannel, CurPressed);
+	}
+}
+
+void UDisplayClusterBlueprintAPIImpl::IsButtonReleased(const FString& DeviceId, uint8 DeviceChannel, bool& CurReleased, bool& IsChannelAvailable)
+{
+	IDisplayClusterInputManager* const Manager = IDisplayCluster::Get().GetInputMgr();
+	if (Manager)
+	{
+		IsChannelAvailable = Manager->IsButtonReleased(DeviceId, DeviceChannel, CurReleased);
+	}
+}
+
+void UDisplayClusterBlueprintAPIImpl::WasButtonPressed(const FString& DeviceId, uint8 DeviceChannel, bool& WasPressed, bool& IsChannelAvailable)
+{
+	IDisplayClusterInputManager* const Manager = IDisplayCluster::Get().GetInputMgr();
+	if (Manager)
+	{
+		IsChannelAvailable = Manager->WasButtonPressed(DeviceId, DeviceChannel, WasPressed);
+	}
+}
+
+void UDisplayClusterBlueprintAPIImpl::WasButtonReleased(const FString& DeviceId, uint8 DeviceChannel, bool& WasReleased, bool& IsChannelAvailable)
+{
+	IDisplayClusterInputManager* const Manager = IDisplayCluster::Get().GetInputMgr();
+	if (Manager)
+	{
+		IsChannelAvailable = Manager->WasButtonReleased(DeviceId, DeviceChannel, WasReleased);
+	}
+}
+
+// Axes
+void UDisplayClusterBlueprintAPIImpl::GetAxis(const FString& DeviceId, uint8 DeviceChannel, float& Value, bool& IsChannelAvailable)
+{
+	IDisplayClusterInputManager* const Manager = IDisplayCluster::Get().GetInputMgr();
+	if (Manager)
+	{
+		IsChannelAvailable = Manager->GetAxis(DeviceId, DeviceChannel, Value);
+	}
+}
+
+// Trackers
+void UDisplayClusterBlueprintAPIImpl::GetTrackerLocation(const FString& DeviceId, uint8 DeviceChannel, FVector& Location, bool& IsChannelAvailable)
+{
+	IDisplayClusterInputManager* const Manager = IDisplayCluster::Get().GetInputMgr();
+	if (Manager)
+	{
+		IsChannelAvailable = Manager->GetTrackerLocation(DeviceId, DeviceChannel, Location);
+	}
+}
+
+void UDisplayClusterBlueprintAPIImpl::GetTrackerQuat(const FString& DeviceId, uint8 DeviceChannel, FQuat& Rotation, bool& IsChannelAvailable)
+{
+	IDisplayClusterInputManager* const Manager = IDisplayCluster::Get().GetInputMgr();
+	if (Manager)
+	{
+		IsChannelAvailable = Manager->GetTrackerQuat(DeviceId, DeviceChannel, Rotation);
+	}
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Render API
+//////////////////////////////////////////////////////////////////////////////////////////////
+void  UDisplayClusterBlueprintAPIImpl::SetInterpupillaryDistance(float dist)
+{
+	IDisplayClusterRenderManager* const Manager = IDisplayCluster::Get().GetRenderMgr();
+	if (Manager)
+	{
+		return Manager->GetStereoDevice()->SetInterpupillaryDistance(dist);
+	}
+
+	return;
+}
+
+float UDisplayClusterBlueprintAPIImpl::GetInterpupillaryDistance()
+{
+	IDisplayClusterRenderManager* const Manager = IDisplayCluster::Get().GetRenderMgr();
+	if (Manager)
+	{
+		return Manager->GetStereoDevice()->GetInterpupillaryDistance();
+	}
+
+	return 0.f;
+}
+
+void UDisplayClusterBlueprintAPIImpl::SetEyesSwap(bool swap)
+{
+	IDisplayClusterRenderManager* const Manager = IDisplayCluster::Get().GetRenderMgr();
+	if (Manager)
+	{
+		return Manager->GetStereoDevice()->SetEyesSwap(swap);
+	}
+
+	return;
+}
+
+bool UDisplayClusterBlueprintAPIImpl::GetEyesSwap()
+{
+	IDisplayClusterRenderManager* const Manager = IDisplayCluster::Get().GetRenderMgr();
+	if (Manager)
+	{
+		return Manager->GetStereoDevice()->GetEyesSwap();
+	}
+
+	return false;
+}
+
+bool UDisplayClusterBlueprintAPIImpl::ToggleEyesSwap()
+{
+	IDisplayClusterRenderManager* const Manager = IDisplayCluster::Get().GetRenderMgr();
+	if (Manager)
+	{
+		return Manager->GetStereoDevice()->ToggleEyesSwap();
+	}
+
+	return false;
+}
+
+void UDisplayClusterBlueprintAPIImpl::GetCullingDistance(float& NearClipPlane, float& FarClipPlane)
+{
+	IDisplayClusterRenderManager* const Manager = IDisplayCluster::Get().GetRenderMgr();
+	if (Manager)
+	{
+		IDisplayClusterStereoDevice* pDev = Manager->GetStereoDevice();
+		if (pDev)
+		{
+			return pDev->GetCullingDistance(NearClipPlane, FarClipPlane);
+		}
+	}
+
+	return;
+}
+
+void UDisplayClusterBlueprintAPIImpl::SetCullingDistance(float NearClipPlane, float FarClipPlane)
+{
+	IDisplayClusterRenderManager* const Manager = IDisplayCluster::Get().GetRenderMgr();
+	if (Manager)
+	{
+		IDisplayClusterStereoDevice* pDev = Manager->GetStereoDevice();
+		if (pDev)
+		{
+			return pDev->SetCullingDistance(NearClipPlane, FarClipPlane);
+		}
+	}
+
+	return;
+}
diff --git a/Source/DisplayCluster/Private/Blueprints/DisplayClusterBlueprintAPIImpl.h b/Source/DisplayCluster/Private/Blueprints/DisplayClusterBlueprintAPIImpl.h
new file mode 100644
index 0000000000000000000000000000000000000000..6bbbe38d164ade9dda1a076a9b66de38e59c6649
--- /dev/null
+++ b/Source/DisplayCluster/Private/Blueprints/DisplayClusterBlueprintAPIImpl.h
@@ -0,0 +1,191 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "Blueprints/IDisplayClusterBlueprintAPI.h"
+#include "DisplayClusterBlueprintAPIImpl.generated.h"
+
+
+/**
+ * Blueprint API interface implementation
+ */
+UCLASS()
+class DISPLAYCLUSTER_API UDisplayClusterBlueprintAPIImpl
+	: public UObject
+	, public IDisplayClusterBlueprintAPI
+{
+	GENERATED_BODY()
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// DisplayCluster module API
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	/** Return if the module has been initialized. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Is module initialized"), Category = "DisplayCluster")
+	virtual bool IsModuleInitialized() override;
+
+	/** Return current operation mode. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get operation mode"), Category = "DisplayCluster")
+	virtual EDisplayClusterOperationMode GetOperationMode() override;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// Cluster API
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Is master node"), Category = "DisplayCluster|Cluster")
+	virtual bool IsMaster() override;
+	
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Is slave node"), Category = "DisplayCluster|Cluster")
+	virtual bool IsSlave() override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Is cluster mode"), Category = "DisplayCluster|Cluster")
+	virtual bool IsCluster() override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Is standalone mode"), Category = "DisplayCluster|Cluster")
+	virtual bool IsStandalone() override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get node ID"), Category = "DisplayCluster|Cluster")
+	virtual FString GetNodeId() override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get nodes amount"), Category = "DisplayCluster|Cluster")
+	virtual int32 GetNodesAmount() override;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// Config API
+	//////////////////////////////////////////////////////////////////////////////////////////////
+
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// Game API
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// Root
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get root"), Category = "DisplayCluster|Game")
+	virtual ADisplayClusterPawn* GetRoot() override;
+
+	// Screens
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get active screen"), Category = "DisplayCluster|Game")
+	virtual UDisplayClusterScreenComponent* GetActiveScreen() override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get screen by ID"), Category = "DisplayCluster|Game")
+	virtual UDisplayClusterScreenComponent* GetScreenById(const FString& id) override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get all screens"), Category = "DisplayCluster|Game")
+	virtual TArray<UDisplayClusterScreenComponent*> GetAllScreens() override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get amount of screens"), Category = "DisplayCluster|Game")
+	virtual int32 GetScreensAmount() override;
+
+	// Cameras
+	/*
+	virtual UDisplayClusterCameraComponent*         GetActiveCamera() const override;
+	virtual UDisplayClusterCameraComponent*         GetCameraById(const FString& id) const override;
+	virtual TArray<UDisplayClusterCameraComponent*> GetAllCameras() const override;
+	virtual int32                        GetCamerasAmount() const override;
+	virtual void                         SetActiveCamera(int32 idx) override;
+	virtual void                         SetActiveCamera(const FString& id) override;
+	*/
+
+	// Nodes
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get node by ID"), Category = "DisplayCluster|Game")
+	virtual UDisplayClusterSceneComponent* GetNodeById(const FString& id) override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get all nodes"), Category = "DisplayCluster|Game")
+	virtual TArray<UDisplayClusterSceneComponent*> GetAllNodes() override;
+
+	// Navigation
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get translation direction component"), Category = "DisplayCluster|Game")
+	virtual USceneComponent* GetTranslationDirectionComponent() override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Set translation direction component"), Category = "DisplayCluster|Game")
+	virtual void SetTranslationDirectionComponent(USceneComponent* pComp) override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Set translation direction component by ID"), Category = "DisplayCluster|Game")
+	virtual void SetTranslationDirectionComponentId(const FString& id) override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get rotate around component"), Category = "DisplayCluster|Game")
+	virtual USceneComponent* GetRotateAroundComponent() override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Set rotate around component"), Category = "DisplayCluster|Game")
+	virtual void SetRotateAroundComponent(USceneComponent* pComp) override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Set rotate around component by ID"), Category = "DisplayCluster|Game")
+	virtual void SetRotateAroundComponentId(const FString& id) override;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// Input API
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// Device information
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get amount of VRPN axis devices"), Category = "DisplayCluster|Input")
+	virtual int32 GetAxisDeviceAmount() override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get amount of VRPN button devices"), Category = "DisplayCluster|Input")
+	virtual int32 GetButtonDeviceAmount() override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get amount of VRPN tracker devices"), Category = "DisplayCluster|Input")
+	virtual int32 GetTrackerDeviceAmount() override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get IDs of VRPN axis devices"), Category = "DisplayCluster|Input")
+	virtual bool GetAxisDeviceIds(TArray<FString>& IDs) override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get IDs of VRPN button devices"), Category = "DisplayCluster|Input")
+	virtual bool GetButtonDeviceIds(TArray<FString>& IDs) override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get IDs of VRPN tracker devices"), Category = "DisplayCluster|Input")
+	virtual bool GetTrackerDeviceIds(TArray<FString>& IDs) override;
+
+	// Buttons
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get VRPN button state"), Category = "DisplayCluster|Input")
+	virtual void GetButtonState(const FString& DeviceId, uint8 DeviceChannel, bool& CurState, bool& IsChannelAvailable) override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Is VRPN button pressed"), Category = "DisplayCluster|Input")
+	virtual void IsButtonPressed(const FString& DeviceId, uint8 DeviceChannel, bool& CurPressed, bool& IsChannelAvailable) override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Is VRPN button released"), Category = "DisplayCluster|Input")
+	virtual void IsButtonReleased(const FString& DeviceId, uint8 DeviceChannel, bool& CurReleased, bool& IsChannelAvailable) override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Was VRPN button pressed"), Category = "DisplayCluster|Input")
+	virtual void WasButtonPressed(const FString& DeviceId, uint8 DeviceChannel, bool& WasPressed, bool& IsChannelAvailable) override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Was VRPN button released"), Category = "DisplayCluster|Input")
+	virtual void WasButtonReleased(const FString& DeviceId, uint8 DeviceChannel, bool& WasReleased, bool& IsChannelAvailable) override;
+
+	// Axes
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get VRPN axis value"), Category = "DisplayCluster|Input")
+	virtual void GetAxis(const FString& DeviceId, uint8 DeviceChannel, float& Value, bool& IsAvailable) override;
+
+	// Trackers
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get VRPN tracker location"), Category = "DisplayCluster|Input")
+	virtual void GetTrackerLocation(const FString& DeviceId, uint8 DeviceChannel, FVector& Location, bool& IsChannelAvailable) override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get VRPN tracker rotation (as quaternion)"), Category = "DisplayCluster|Input")
+	virtual void GetTrackerQuat(const FString& DeviceId, uint8 DeviceChannel, FQuat& Rotation, bool& IsChannelAvailable) override;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// Render API
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Set interpuppillary distance"), Category = "DisplayCluster|Render")
+	virtual void SetInterpupillaryDistance(float dist) override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get interpuppillary distance"), Category = "DisplayCluster|Render")
+	virtual float GetInterpupillaryDistance() override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Set eye swap"), Category = "DisplayCluster|Render")
+	virtual void SetEyesSwap(bool swap) override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get eye swap"), Category = "DisplayCluster|Render")
+	virtual bool GetEyesSwap() override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Toggle eye swap"), Category = "DisplayCluster|Render")
+	virtual bool ToggleEyesSwap() override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get near and far clipping distance"), Category = "DisplayCluster|Render")
+	virtual void GetCullingDistance(float& NearClipPlane, float& FarClipPlane) override;
+
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Set near and far clipping distance"), Category = "DisplayCluster|Render")
+	virtual void SetCullingDistance(float NearClipPlane, float FarClipPlane) override;
+};
diff --git a/Source/DisplayCluster/Private/Blueprints/DisplayClusterBlueprintLib.cpp b/Source/DisplayCluster/Private/Blueprints/DisplayClusterBlueprintLib.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..826ad5e7d3d2046abe07545b49b030ddcc5e86d4
--- /dev/null
+++ b/Source/DisplayCluster/Private/Blueprints/DisplayClusterBlueprintLib.cpp
@@ -0,0 +1,17 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "Blueprints/DisplayClusterBlueprintLib.h"
+#include "DisplayClusterBlueprintAPIImpl.h"
+#include "UObject/Package.h"
+
+
+UDisplayClusterBlueprintLib::UDisplayClusterBlueprintLib(class FObjectInitializer const & ObjectInitializer)
+	: Super(ObjectInitializer)
+{
+}
+
+void UDisplayClusterBlueprintLib::GetAPI(TScriptInterface<IDisplayClusterBlueprintAPI>& OutAPI)
+{
+	static UDisplayClusterBlueprintAPIImpl* Obj = NewObject<UDisplayClusterBlueprintAPIImpl>(GetTransientPackage(), NAME_None, RF_MarkAsRootSet);
+	OutAPI = Obj;
+}
diff --git a/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterClusterNodeCtrlBase.cpp b/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterClusterNodeCtrlBase.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..442f81e4b6fc1264f90375808762a3eb21e9cec6
--- /dev/null
+++ b/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterClusterNodeCtrlBase.cpp
@@ -0,0 +1,71 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterClusterNodeCtrlBase.h"
+#include "DisplayClusterGlobals.h"
+
+#include "Config/DisplayClusterConfigTypes.h"
+#include "Misc/DisplayClusterLog.h"
+
+#include "IPDisplayCluster.h"
+#include "Config/IPDisplayClusterConfigManager.h"
+#include "Render/IPDisplayClusterRenderManager.h"
+#include "Render/IDisplayClusterStereoDevice.h"
+
+
+
+FDisplayClusterClusterNodeCtrlBase::FDisplayClusterClusterNodeCtrlBase(const FString& ctrlName, const FString& nodeName) :
+	FDisplayClusterNodeCtrlBase(ctrlName, nodeName)
+{
+
+}
+
+FDisplayClusterClusterNodeCtrlBase::~FDisplayClusterClusterNodeCtrlBase()
+{
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IPDisplayClusterNodeController
+//////////////////////////////////////////////////////////////////////////////////////////////
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterNodeCtrlBase
+//////////////////////////////////////////////////////////////////////////////////////////////
+bool FDisplayClusterClusterNodeCtrlBase::InitializeStereo()
+{
+	if (GDisplayCluster->GetOperationMode() == EDisplayClusterOperationMode::Disabled)
+	{
+		return false;
+	}
+
+	FDisplayClusterConfigViewport ViewportCfg;
+	if (!GDisplayCluster->GetPrivateConfigMgr()->GetLocalViewport(ViewportCfg))
+	{
+		UE_LOG(LogDisplayClusterRender, Error, TEXT("Viewport config not found"));
+		return false;
+	}
+
+	//@todo: Move this logic to the render manager
+	IDisplayClusterStereoDevice* const StereoDevice = GDisplayCluster->GetPrivateRenderMgr()->GetStereoDevice();
+	if (StereoDevice)
+	{
+		FDisplayClusterConfigStereo  StereoCfg  = GDisplayCluster->GetPrivateConfigMgr()->GetConfigStereo();
+		FDisplayClusterConfigGeneral GeneralCfg = GDisplayCluster->GetPrivateConfigMgr()->GetConfigGeneral();
+		FDisplayClusterConfigClusterNode ClusterNodeCfg;
+		GDisplayCluster->GetPrivateConfigMgr()->GetLocalClusterNode(ClusterNodeCfg);
+		
+
+		// Configure the device
+		StereoDevice->SetViewportArea(ViewportCfg.Loc, ViewportCfg.Size);
+		StereoDevice->SetEyesSwap(ClusterNodeCfg.EyeSwap);
+		StereoDevice->SetInterpupillaryDistance(StereoCfg.EyeDist);
+		StereoDevice->SetSwapSyncPolicy((EDisplayClusterSwapSyncPolicy)GeneralCfg.SwapSyncPolicy);
+	}
+	else
+	{
+		UE_LOG(LogDisplayClusterRender, Warning, TEXT("Stereo device not found. Stereo initialization skipped."));
+	}
+
+	return FDisplayClusterNodeCtrlBase::InitializeStereo();
+}
diff --git a/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterClusterNodeCtrlBase.h b/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterClusterNodeCtrlBase.h
new file mode 100644
index 0000000000000000000000000000000000000000..5f180908bc909165b91e925744fd721abedf8d99
--- /dev/null
+++ b/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterClusterNodeCtrlBase.h
@@ -0,0 +1,32 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "DisplayClusterNodeCtrlBase.h"
+
+
+/**
+ * Abstract cluster node controller (cluster mode).
+ */
+class FDisplayClusterClusterNodeCtrlBase
+	: public FDisplayClusterNodeCtrlBase
+{
+public:
+	FDisplayClusterClusterNodeCtrlBase(const FString& ctrlName, const FString& nodeName);
+	virtual ~FDisplayClusterClusterNodeCtrlBase() = 0;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterNodeController
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool IsStandalone() const override final
+	{ return false; }
+
+protected:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// FDisplayClusterNodeCtrlBase
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool InitializeStereo() override;
+};
+
diff --git a/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterClusterNodeCtrlMaster.cpp b/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterClusterNodeCtrlMaster.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..8011f3e19464b06ca6d487a015c5d64bcce1dc74
--- /dev/null
+++ b/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterClusterNodeCtrlMaster.cpp
@@ -0,0 +1,164 @@
+
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterClusterNodeCtrlMaster.h"
+
+#include "Config/IPDisplayClusterConfigManager.h"
+#include "Network/Service/ClusterSync/DisplayClusterClusterSyncService.h"
+#include "Network/Service/SwapSync/DisplayClusterSwapSyncService.h"
+
+#include "Misc/DisplayClusterLog.h"
+#include "DisplayClusterGlobals.h"
+#include "IPDisplayCluster.h"
+
+#include "Misc/App.h"
+
+
+FDisplayClusterClusterNodeCtrlMaster::FDisplayClusterClusterNodeCtrlMaster(const FString& ctrlName, const FString& nodeName) :
+	FDisplayClusterClusterNodeCtrlSlave(ctrlName, nodeName)
+{
+}
+
+FDisplayClusterClusterNodeCtrlMaster::~FDisplayClusterClusterNodeCtrlMaster()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IPDisplayClusterClusterSyncProtocol
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterClusterNodeCtrlMaster::GetTimecode(FTimecode& timecode, FFrameRate& frameRate)
+{
+	// This values are updated in UEngine::UpdateTimeAndHandleMaxTickRate (via UpdateTimecode).
+	timecode = FApp::GetTimecode();
+	frameRate = FApp::GetTimecodeFrameRate();
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IPDisplayClusterNodeController
+//////////////////////////////////////////////////////////////////////////////////////////////
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IPDisplayClusterNodeController
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterClusterNodeCtrlMaster::GetSyncData(FDisplayClusterMessage::DataType& data)
+{
+	// Override slave implementation with empty one.
+	// There is no need to sync on master side since it have source data being synced.
+}
+
+void FDisplayClusterClusterNodeCtrlMaster::GetInputData(FDisplayClusterMessage::DataType& data)
+{
+	// Override slave implementation with empty one.
+	// There is no need to sync on master side since it have source data being synced.
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterNodeCtrlBase
+//////////////////////////////////////////////////////////////////////////////////////////////
+bool FDisplayClusterClusterNodeCtrlMaster::InitializeServers()
+{
+	if (GDisplayCluster->GetOperationMode() == EDisplayClusterOperationMode::Disabled)
+	{
+		return false;
+	}
+
+	if (!FDisplayClusterClusterNodeCtrlSlave::InitializeServers())
+	{
+		return false;
+	}
+
+	UE_LOG(LogDisplayClusterCluster, Log, TEXT("%s - initializing master servers..."), *GetControllerName());
+
+	// Get config data
+	FDisplayClusterConfigClusterNode masterCfg;
+	if (GDisplayCluster->GetPrivateConfigMgr()->GetMasterClusterNode(masterCfg) == false)
+	{
+		UE_LOG(LogDisplayClusterCluster, Error, TEXT("No master node configuration data found"));
+		return false;
+	}
+
+	// Instantiate node servers
+	UE_LOG(LogDisplayClusterCluster, Log, TEXT("Servers: addr %s, port_cs %d, port_ss %d"), *masterCfg.Addr, masterCfg.Port_CS, masterCfg.Port_SS);
+	ClusterSyncServer.Reset(new FDisplayClusterClusterSyncService(masterCfg.Addr, masterCfg.Port_CS));
+	SwapSyncServer.Reset(new FDisplayClusterSwapSyncService(masterCfg.Addr, masterCfg.Port_SS));
+
+	return ClusterSyncServer.IsValid() && SwapSyncServer.IsValid();
+}
+
+bool FDisplayClusterClusterNodeCtrlMaster::StartServers()
+{
+	if (!FDisplayClusterClusterNodeCtrlSlave::StartServers())
+	{
+		return false;
+	}
+
+	UE_LOG(LogDisplayClusterCluster, Log, TEXT("%s - starting master servers..."), *GetControllerName());
+
+	// CS server start
+	if (ClusterSyncServer->Start())
+	{
+		UE_LOG(LogDisplayClusterCluster, Log, TEXT("%s started"), *ClusterSyncServer->GetName());
+	}
+	else
+	{
+		UE_LOG(LogDisplayClusterCluster, Error, TEXT("%s failed to start"), *ClusterSyncServer->GetName());
+	}
+
+	// SS server start
+	if (SwapSyncServer->Start())
+	{
+		UE_LOG(LogDisplayClusterCluster, Log, TEXT("%s started"), *SwapSyncServer->GetName());
+	}
+	else
+	{
+		UE_LOG(LogDisplayClusterCluster, Error, TEXT("%s failed to start"), *SwapSyncServer->GetName());
+	}
+
+	// Start the servers
+	return ClusterSyncServer->IsRunning() && SwapSyncServer->IsRunning();
+}
+
+void FDisplayClusterClusterNodeCtrlMaster::StopServers()
+{
+	FDisplayClusterClusterNodeCtrlSlave::StopServers();
+
+	ClusterSyncServer->Shutdown();
+	SwapSyncServer->Shutdown();
+}
+
+bool FDisplayClusterClusterNodeCtrlMaster::InitializeClients()
+{
+	if (!FDisplayClusterClusterNodeCtrlSlave::InitializeClients())
+	{
+		return false;
+	}
+
+	// Master clients initialization
+	// ...
+
+	return true;
+}
+
+bool FDisplayClusterClusterNodeCtrlMaster::StartClients()
+{
+	if (!FDisplayClusterClusterNodeCtrlSlave::StartClients())
+	{
+		return false;
+	}
+
+	// Master clients start
+	// ...
+
+	return true;
+}
+
+void FDisplayClusterClusterNodeCtrlMaster::StopClients()
+{
+	FDisplayClusterClusterNodeCtrlSlave::StopClients();
+
+	// Master clients stop
+	// ...
+}
+
diff --git a/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterClusterNodeCtrlMaster.h b/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterClusterNodeCtrlMaster.h
new file mode 100644
index 0000000000000000000000000000000000000000..cfe5c5a582128edee60d0d5550fbb9edf43c04bd
--- /dev/null
+++ b/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterClusterNodeCtrlMaster.h
@@ -0,0 +1,60 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "DisplayClusterClusterNodeCtrlSlave.h"
+
+#include "Network/DisplayClusterMessage.h"
+
+class FDisplayClusterClusterSyncService;
+class FDisplayClusterSwapSyncService;
+
+
+/**
+ * Master node controller implementation (cluster mode). Manages servers on master side.
+ */
+class FDisplayClusterClusterNodeCtrlMaster
+	: public FDisplayClusterClusterNodeCtrlSlave
+{
+public:
+	FDisplayClusterClusterNodeCtrlMaster(const FString& ctrlName, const FString& nodeName);
+	virtual ~FDisplayClusterClusterNodeCtrlMaster();
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterClusterSyncProtocol
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void GetTimecode(FTimecode& timecode, FFrameRate& frameRate) override;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterNodeController
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool IsSlave() const override final
+	{ return false; }
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterNodeController
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void GetSyncData(FDisplayClusterMessage::DataType& data)  override;
+	virtual void GetInputData(FDisplayClusterMessage::DataType& data) override;
+
+protected:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// FDisplayClusterNodeCtrlBase
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool InitializeServers() override;
+	virtual bool StartServers()      override;
+	virtual void StopServers()       override;
+
+	virtual bool InitializeClients() override;
+	virtual bool StartClients()      override;
+	virtual void StopClients()       override;
+
+private:
+	// Node servers
+	TUniquePtr<FDisplayClusterClusterSyncService> ClusterSyncServer;
+	TUniquePtr<FDisplayClusterSwapSyncService>    SwapSyncServer;
+};
+
diff --git a/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterClusterNodeCtrlSlave.cpp b/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterClusterNodeCtrlSlave.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..198c1fc8b3cc54fc92ed424f2e3fa3d2be357cdf
--- /dev/null
+++ b/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterClusterNodeCtrlSlave.cpp
@@ -0,0 +1,190 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterClusterNodeCtrlSlave.h"
+
+#include "Config/IPDisplayClusterConfigManager.h"
+#include "Misc/DisplayClusterLog.h"
+#include "Network/Service/ClusterSync/DisplayClusterClusterSyncClient.h"
+#include "Network/Service/SwapSync/DisplayClusterSwapSyncClient.h"
+
+#include "DisplayClusterGlobals.h"
+#include "IPDisplayCluster.h"
+
+
+FDisplayClusterClusterNodeCtrlSlave::FDisplayClusterClusterNodeCtrlSlave(const FString& ctrlName, const FString& nodeName) :
+	FDisplayClusterClusterNodeCtrlBase(ctrlName, nodeName)
+{
+}
+
+FDisplayClusterClusterNodeCtrlSlave::~FDisplayClusterClusterNodeCtrlSlave()
+{
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IPDisplayClusterNodeController
+//////////////////////////////////////////////////////////////////////////////////////////////
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IPDisplayClusterClusterSyncProtocol
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterClusterNodeCtrlSlave::WaitForGameStart()
+{
+	ClusterSyncClient->WaitForGameStart();
+}
+
+void FDisplayClusterClusterNodeCtrlSlave::WaitForFrameStart()
+{
+	ClusterSyncClient->WaitForFrameStart();
+}
+
+void FDisplayClusterClusterNodeCtrlSlave::WaitForFrameEnd()
+{
+	ClusterSyncClient->WaitForFrameEnd();
+}
+
+void FDisplayClusterClusterNodeCtrlSlave::WaitForTickEnd()
+{
+	ClusterSyncClient->WaitForTickEnd();
+}
+
+void FDisplayClusterClusterNodeCtrlSlave::WaitForTrackingUpdate()
+{
+	ClusterSyncClient->WaitForTrackingUpdate();
+}
+
+void FDisplayClusterClusterNodeCtrlSlave::GetDeltaTime(float& deltaTime)
+{
+	ClusterSyncClient->GetDeltaTime(deltaTime);
+}
+
+void FDisplayClusterClusterNodeCtrlSlave::GetTimecode(FTimecode& timecode, FFrameRate& frameRate)
+{
+	ClusterSyncClient->GetTimecode(timecode, frameRate);
+}
+
+void FDisplayClusterClusterNodeCtrlSlave::GetSyncData(FDisplayClusterMessage::DataType& data)
+{
+	ClusterSyncClient->GetSyncData(data);
+}
+
+void FDisplayClusterClusterNodeCtrlSlave::GetInputData(FDisplayClusterMessage::DataType& data)
+{
+	ClusterSyncClient->GetInputData(data);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IPDisplayClusterSwapSyncProtocol
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterClusterNodeCtrlSlave::WaitForSwapSync(double* pThreadWaitTime, double* pBarrierWaitTime)
+{
+	check(SwapSyncClient.IsValid());
+	SwapSyncClient->WaitForSwapSync(pThreadWaitTime, pBarrierWaitTime);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterNodeCtrlBase
+//////////////////////////////////////////////////////////////////////////////////////////////
+bool FDisplayClusterClusterNodeCtrlSlave::InitializeServers()
+{
+	if (!FDisplayClusterClusterNodeCtrlBase::InitializeServers())
+	{
+		return false;
+	}
+
+	// Slave servers initialization
+	// ...
+
+	return true;
+}
+
+bool FDisplayClusterClusterNodeCtrlSlave::StartServers()
+{
+	if (!FDisplayClusterClusterNodeCtrlBase::StartServers())
+	{
+		return false;
+	}
+
+	// Slave servers start
+	// ...
+
+	return true;
+}
+
+void FDisplayClusterClusterNodeCtrlSlave::StopServers()
+{
+	FDisplayClusterClusterNodeCtrlBase::StopServers();
+
+	// Slave servers stop
+	// ...
+}
+
+bool FDisplayClusterClusterNodeCtrlSlave::InitializeClients()
+{
+	if (!FDisplayClusterClusterNodeCtrlBase::InitializeClients())
+	{
+		return false;
+	}
+
+	UE_LOG(LogDisplayClusterCluster, Log, TEXT("%s - initializing slave clients..."), *GetControllerName());
+
+	// Instantiate local clients
+	ClusterSyncClient.Reset(new FDisplayClusterClusterSyncClient);
+	SwapSyncClient.Reset(new FDisplayClusterSwapSyncClient);
+
+	return ClusterSyncClient.IsValid() && SwapSyncClient.IsValid();
+}
+
+bool FDisplayClusterClusterNodeCtrlSlave::StartClients()
+{
+	if (!FDisplayClusterClusterNodeCtrlBase::StartClients())
+	{
+		return false;
+	}
+
+	UE_LOG(LogDisplayClusterCluster, Log, TEXT("%s - initializing slave clients..."), *GetControllerName());
+
+	// Master config
+	FDisplayClusterConfigClusterNode MasterCfg;
+	if (GDisplayCluster->GetPrivateConfigMgr()->GetMasterClusterNode(MasterCfg) == false)
+	{
+		UE_LOG(LogDisplayClusterCluster, Error, TEXT("No master node configuration data found"));
+		return false;
+	}
+
+	// CS client
+	if (ClusterSyncClient->Connect(MasterCfg.Addr, MasterCfg.Port_CS))
+	{
+		UE_LOG(LogDisplayClusterCluster, Log, TEXT("%s connected to the server %s:%d"), *ClusterSyncClient->GetName(), *MasterCfg.Addr, MasterCfg.Port_CS);
+	}
+	else
+	{
+		UE_LOG(LogDisplayClusterCluster, Error, TEXT("%s couldn't connect to the server %s:%d"), *ClusterSyncClient->GetName(), *MasterCfg.Addr, MasterCfg.Port_CS);
+		// No need to wait again for next client connection
+		return false;
+	}
+
+	// SS client
+	if (SwapSyncClient->Connect(MasterCfg.Addr, MasterCfg.Port_SS))
+	{
+		UE_LOG(LogDisplayClusterCluster, Log, TEXT("%s connected to the server %s:%d"), *SwapSyncClient->GetName(), *MasterCfg.Addr, MasterCfg.Port_SS);
+	}
+	else
+	{
+		UE_LOG(LogDisplayClusterCluster, Error, TEXT("%s couldn't connect to the server %s:%d"), *SwapSyncClient->GetName(), *MasterCfg.Addr, MasterCfg.Port_SS);
+		return false;
+	}
+
+	return ClusterSyncClient->IsConnected() && SwapSyncClient->IsConnected();
+}
+
+void FDisplayClusterClusterNodeCtrlSlave::StopClients()
+{
+	FDisplayClusterClusterNodeCtrlBase::StopClients();
+
+	ClusterSyncClient->Disconnect();
+	SwapSyncClient->Disconnect();
+}
diff --git a/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterClusterNodeCtrlSlave.h b/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterClusterNodeCtrlSlave.h
new file mode 100644
index 0000000000000000000000000000000000000000..366937e91bec25a1e1eb4afb532693eb5f4d250f
--- /dev/null
+++ b/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterClusterNodeCtrlSlave.h
@@ -0,0 +1,67 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "DisplayClusterClusterNodeCtrlBase.h"
+#include "Network/DisplayClusterMessage.h"
+
+class FDisplayClusterClusterSyncClient;
+class FDisplayClusterSwapSyncClient;
+
+
+/**
+ * Slave node controller implementation (cluster mode). . Manages clients on client side.
+ */
+class FDisplayClusterClusterNodeCtrlSlave
+	: public FDisplayClusterClusterNodeCtrlBase
+{
+public:
+	FDisplayClusterClusterNodeCtrlSlave(const FString& ctrlName, const FString& nodeName);
+	virtual ~FDisplayClusterClusterNodeCtrlSlave();
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterNodeController
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool IsSlave() const override
+	{ return true; }
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterClusterSyncProtocol
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void WaitForGameStart()  override final;
+	virtual void WaitForFrameStart() override final;
+	virtual void WaitForFrameEnd()   override final;
+	virtual void WaitForTickEnd()    override final;
+	virtual void WaitForTrackingUpdate() override final;
+	virtual void GetDeltaTime(float& deltaTime) override final;
+	virtual void GetTimecode(FTimecode& timecode, FFrameRate& frameRate) override;
+	virtual void GetSyncData(FDisplayClusterMessage::DataType& data)  override;
+	virtual void GetInputData(FDisplayClusterMessage::DataType& data) override;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterSwapSyncProtocol
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void WaitForSwapSync(double* pThreadWaitTime, double* pBarrierWaitTime) override final;
+
+protected:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// FDisplayClusterNodeCtrlBase
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool InitializeServers() override;
+	virtual bool StartServers()      override;
+	virtual void StopServers()       override;
+
+	virtual bool InitializeClients() override;
+	virtual bool StartClients()      override;
+	virtual void StopClients()       override;
+
+private:
+	// Cluster node clients
+	TUniquePtr<FDisplayClusterClusterSyncClient> ClusterSyncClient;
+	TUniquePtr<FDisplayClusterSwapSyncClient>    SwapSyncClient;
+};
+
diff --git a/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterNodeCtrlBase.cpp b/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterNodeCtrlBase.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..ba47db1a287f4d99ca5c06ee6a558c462f9d9e3e
--- /dev/null
+++ b/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterNodeCtrlBase.cpp
@@ -0,0 +1,56 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterNodeCtrlBase.h"
+#include "Misc/DisplayClusterLog.h"
+
+
+FDisplayClusterNodeCtrlBase::FDisplayClusterNodeCtrlBase(const FString& ctrlName, const FString& nodeName) :
+	NodeName(nodeName),
+	ControllerName(ctrlName)
+{
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IPDisplayClusterNodeController
+//////////////////////////////////////////////////////////////////////////////////////////////
+bool FDisplayClusterNodeCtrlBase::Initialize()
+{
+	if (!InitializeStereo())
+	{
+		UE_LOG(LogDisplayClusterCluster, Error, TEXT("Stereo initialization failed"));
+		return false;
+	}
+
+	if (!InitializeServers())
+	{
+		UE_LOG(LogDisplayClusterCluster, Error, TEXT("Servers initialization failed"));
+		return false;
+	}
+
+	if (!InitializeClients())
+	{
+		UE_LOG(LogDisplayClusterCluster, Error, TEXT("Clients initialization failed"));
+		return false;
+	}
+
+	if (!StartServers())
+	{
+		UE_LOG(LogDisplayClusterCluster, Error, TEXT("An error occurred during servers start"));
+		return false;
+	}
+
+	if (!StartClients())
+	{
+		UE_LOG(LogDisplayClusterCluster, Error, TEXT("An error occurred during clients start"));
+		return false;
+	}
+
+	return true;
+}
+
+void FDisplayClusterNodeCtrlBase::Release()
+{
+	StopServers();
+	StopClients();
+}
diff --git a/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterNodeCtrlBase.h b/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterNodeCtrlBase.h
new file mode 100644
index 0000000000000000000000000000000000000000..14a718796ebac0b51bf105b9864b0ba77266b447
--- /dev/null
+++ b/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterNodeCtrlBase.h
@@ -0,0 +1,70 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "IPDisplayClusterNodeController.h"
+
+class FDisplayClusterClusterManager;
+
+
+/**
+ * Abstract node controller
+ */
+class FDisplayClusterNodeCtrlBase
+	: public  IPDisplayClusterNodeController
+{
+	// This is needed to perform initialization from outside of constructor (polymorphic init)
+	friend FDisplayClusterClusterManager;
+
+public:
+	FDisplayClusterNodeCtrlBase(const FString& ctrlName, const FString& nodeName);
+
+	virtual ~FDisplayClusterNodeCtrlBase() { }
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterNodeController
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool Initialize() override final;
+	virtual void Release() override final;
+
+	virtual bool IsMaster() const override final
+	{ return !IsSlave(); }
+	
+	virtual bool IsCluster() const override final
+	{ return !IsStandalone(); }
+
+	virtual FString GetNodeId() const override final
+	{ return NodeName; }
+
+	virtual FString GetControllerName() const override final
+	{ return ControllerName; }
+
+protected:
+	virtual bool InitializeStereo()
+	{ return true; }
+
+	virtual bool InitializeServers()
+	{ return true; }
+
+	virtual bool StartServers()
+	{ return true; }
+
+	virtual void StopServers()
+	{ return; }
+
+	virtual bool InitializeClients()
+	{ return true; }
+
+	virtual bool StartClients()
+	{ return true; }
+	
+	virtual void StopClients()
+	{ return; }
+
+private:
+	const FString NodeName;
+	const FString ControllerName;
+};
+
diff --git a/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterNodeCtrlStandalone.cpp b/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterNodeCtrlStandalone.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b6358565e011c5eaa27cd2f518f8cb35c3b51a52
--- /dev/null
+++ b/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterNodeCtrlStandalone.cpp
@@ -0,0 +1,85 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterNodeCtrlStandalone.h"
+
+#include "Network/DisplayClusterMessage.h"
+#include "Render/IDisplayClusterStereoDevice.h"
+
+
+FDisplayClusterNodeCtrlStandalone::FDisplayClusterNodeCtrlStandalone(const FString& ctrlName, const FString& nodeName) :
+	FDisplayClusterNodeCtrlBase(ctrlName, nodeName)
+{
+}
+
+
+FDisplayClusterNodeCtrlStandalone::~FDisplayClusterNodeCtrlStandalone()
+{
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IPDisplayClusterClusterSyncProtocol
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterNodeCtrlStandalone::WaitForGameStart()
+{
+	// Nothing special to do here in standalone mode
+}
+
+void FDisplayClusterNodeCtrlStandalone::WaitForFrameStart()
+{
+	// Nothing special to do here in standalone mode
+}
+
+void FDisplayClusterNodeCtrlStandalone::WaitForFrameEnd()
+{
+	// Nothing special to do here in standalone mode
+}
+
+void FDisplayClusterNodeCtrlStandalone::WaitForTickEnd()
+{
+	// Nothing special to do here in standalone mode
+}
+
+void FDisplayClusterNodeCtrlStandalone::WaitForTrackingUpdate()
+{
+	// Nothing special to do here in standalone mode
+}
+
+void FDisplayClusterNodeCtrlStandalone::GetDeltaTime(float& deltaTime)
+{
+	// Nothing special to do here in standalone mode
+}
+
+void FDisplayClusterNodeCtrlStandalone::GetTimecode(FTimecode& timecode, FFrameRate& frameRate)
+{
+	// Nothing special to do here in standalone mode
+}
+
+void FDisplayClusterNodeCtrlStandalone::GetSyncData(FDisplayClusterMessage::DataType& data)
+{
+	// Nothing special to do here in standalone mode
+}
+
+void FDisplayClusterNodeCtrlStandalone::GetInputData(FDisplayClusterMessage::DataType& data)
+{
+	// Nothing special to do here in standalone mode
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IPDisplayClusterSwapSyncProtocol
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterNodeCtrlStandalone::WaitForSwapSync(double* pThreadWaitTime, double* pBarrierWaitTime)
+{
+	// Nothing special to do here in standalone mode
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterNodeCtrlBase
+//////////////////////////////////////////////////////////////////////////////////////////////
+bool FDisplayClusterNodeCtrlStandalone::InitializeStereo()
+{
+	//@todo: initialize stereo for standalone mode
+
+	return FDisplayClusterNodeCtrlBase::InitializeStereo();
+}
diff --git a/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterNodeCtrlStandalone.h b/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterNodeCtrlStandalone.h
new file mode 100644
index 0000000000000000000000000000000000000000..792b6595af357979a8383a590d543f3d416409ef
--- /dev/null
+++ b/Source/DisplayCluster/Private/Cluster/Controller/DisplayClusterNodeCtrlStandalone.h
@@ -0,0 +1,55 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "DisplayClusterNodeCtrlBase.h"
+
+class FDisplayClusterMessage;
+
+
+/**
+ * Standalone node controller (no cluster)
+ */
+class FDisplayClusterNodeCtrlStandalone
+	: public FDisplayClusterNodeCtrlBase
+{
+public:
+	FDisplayClusterNodeCtrlStandalone(const FString& ctrlName, const FString& nodeName);
+	virtual ~FDisplayClusterNodeCtrlStandalone();
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterNodeController
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool IsSlave() const override final
+	{ return false; }
+
+	virtual bool IsStandalone() const override final
+	{ return true; }
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterClusterSyncProtocol
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void WaitForGameStart() override;
+	virtual void WaitForFrameStart() override;
+	virtual void WaitForFrameEnd() override;
+	virtual void WaitForTickEnd() override;
+	virtual void WaitForTrackingUpdate() override;
+	virtual void GetDeltaTime(float& deltaTime) override;
+	virtual void GetTimecode(FTimecode& timecode, FFrameRate& frameRate) override;
+	virtual void GetSyncData(FDisplayClusterMessage::DataType& data)  override;
+	virtual void GetInputData(FDisplayClusterMessage::DataType& data) override;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterSwapSyncProtocol
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void WaitForSwapSync(double* pThreadWaitTime, double* pBarrierWaitTime) override;
+
+protected:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// FDisplayClusterNodeCtrlBase
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool InitializeStereo() override;
+};
diff --git a/Source/DisplayCluster/Private/Cluster/Controller/IPDisplayClusterNodeController.h b/Source/DisplayCluster/Private/Cluster/Controller/IPDisplayClusterNodeController.h
new file mode 100644
index 0000000000000000000000000000000000000000..8d7d14f55f6926f72235c86bc043b363796db313
--- /dev/null
+++ b/Source/DisplayCluster/Private/Cluster/Controller/IPDisplayClusterNodeController.h
@@ -0,0 +1,29 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Network/Protocol/IPDisplayClusterClusterSyncProtocol.h"
+#include "Network/Protocol/IPDisplayClusterSwapSyncProtocol.h"
+
+
+/**
+ * Node controller interface
+ */
+struct IPDisplayClusterNodeController
+	: public IPDisplayClusterClusterSyncProtocol
+	, public IPDisplayClusterSwapSyncProtocol
+{
+	virtual ~IPDisplayClusterNodeController()
+	{ }
+
+	virtual bool Initialize() = 0;
+	virtual void Release() = 0;
+
+	virtual bool IsMaster() const = 0;
+	virtual bool IsSlave() const = 0;
+	virtual bool IsStandalone() const = 0;
+	virtual bool IsCluster() const = 0;
+	virtual FString GetNodeId() const = 0;
+	virtual FString GetControllerName() const = 0;
+};
+
diff --git a/Source/DisplayCluster/Private/Cluster/DisplayClusterClusterManager.cpp b/Source/DisplayCluster/Private/Cluster/DisplayClusterClusterManager.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..bf0ef2efc1436e6d30eb170f820b8c313603c55a
--- /dev/null
+++ b/Source/DisplayCluster/Private/Cluster/DisplayClusterClusterManager.cpp
@@ -0,0 +1,448 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterClusterManager.h"
+
+#include "Cluster/IDisplayClusterClusterSyncObject.h"
+#include "Cluster/Controller/DisplayClusterNodeCtrlStandalone.h"
+#include "Cluster/Controller/DisplayClusterClusterNodeCtrlMaster.h"
+#include "Cluster/Controller/DisplayClusterClusterNodeCtrlSlave.h"
+
+#include "Config/IPDisplayClusterConfigManager.h"
+
+#include "Misc/DisplayClusterAppExit.h"
+#include "Misc/DisplayClusterLog.h"
+#include "Misc/DisplayClusterHelpers.h"
+#include "Misc/DisplayClusterTypesConverter.h"
+
+#include "Input/IPDisplayClusterInputManager.h"
+
+#include "DisplayClusterBuildConfig.h"
+#include "DisplayClusterGlobals.h"
+#include "IPDisplayCluster.h"
+
+#include "SocketSubsystem.h"
+
+
+FDisplayClusterClusterManager::FDisplayClusterClusterManager()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterCluster);
+
+	ObjectsToSync.Reserve(64);
+}
+
+FDisplayClusterClusterManager::~FDisplayClusterClusterManager()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterCluster);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IPDisplayClusterManager
+//////////////////////////////////////////////////////////////////////////////////////////////
+bool FDisplayClusterClusterManager::Init(EDisplayClusterOperationMode OperationMode)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterCluster);
+
+	CurrentOperationMode = OperationMode;
+	
+	return true;
+}
+
+void FDisplayClusterClusterManager::Release()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterCluster);
+}
+
+bool FDisplayClusterClusterManager::StartSession(const FString& configPath, const FString& nodeId)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterCluster);
+
+	ConfigPath = configPath;
+	ClusterNodeId = nodeId;
+
+	if (CurrentOperationMode == EDisplayClusterOperationMode::Cluster)
+	{
+#ifdef DISPLAY_CLUSTER_USE_AUTOMATIC_NODE_ID_RESOLVE
+		if (ClusterNodeId.IsEmpty())
+		{
+			UE_LOG(LogDisplayClusterCluster, Warning, TEXT("Node name was not specified. Trying to resolve address from available interfaces..."));
+
+			// Try to find the node ID by address (this won't work if you want to run several cluster nodes on the same address)
+			FString resolvedNodeId;
+			if (GetResolvedNodeId(resolvedNodeId))
+			{
+				DisplayClusterHelpers::str::DustCommandLineValue(resolvedNodeId);
+				ClusterNodeId = resolvedNodeId;
+			}
+			else
+			{
+				UE_LOG(LogDisplayClusterCluster, Error, TEXT("Unable to resolve node ID by local addresses"));
+				return false;
+			}
+		}
+#endif
+	}
+	else if (CurrentOperationMode == EDisplayClusterOperationMode::Standalone)
+	{
+	}
+	else if (CurrentOperationMode == EDisplayClusterOperationMode::Editor)
+	{
+		if (ConfigPath.IsEmpty() || ClusterNodeId.IsEmpty())
+		{
+			UE_LOG(LogDisplayClusterCluster, Warning, TEXT("Wrong config path and/or node ID. Using default standalone config."));
+
+#ifdef DISPLAY_CLUSTER_USE_DEBUG_STANDALONE_CONFIG
+			ConfigPath = FString(DisplayClusterStrings::misc::DbgStubConfig);
+			ClusterNodeId     = FString(DisplayClusterStrings::misc::DbgStubNodeId);
+#endif
+		}
+	}
+	else if (CurrentOperationMode == EDisplayClusterOperationMode::Disabled)
+	{
+		return true;
+	}
+	else
+	{
+		UE_LOG(LogDisplayClusterCluster, Warning, TEXT("Unknown operation mode"));
+		return false;
+	}
+
+	UE_LOG(LogDisplayClusterCluster, Log, TEXT("Node ID: %s"), *ClusterNodeId);
+
+	// Node name must be specified in cluster mode
+	if (ClusterNodeId.IsEmpty())
+	{
+		UE_LOG(LogDisplayClusterCluster, Error, TEXT("Node name was not specified"));
+		return false;
+	}
+
+	// Save nodes amount
+	NodesAmount = GDisplayCluster->GetPrivateConfigMgr()->GetClusterNodesAmount();
+
+	// Instantiate node controller
+	Controller = CreateController();
+
+	if (!Controller)
+	{
+		UE_LOG(LogDisplayClusterCluster, Error, TEXT("Couldn't create a controller."));
+		return false;
+	}
+
+	// Initialize the controller
+	UE_LOG(LogDisplayClusterCluster, Log, TEXT("Initializing the controller..."));
+	if (!Controller->Initialize())
+	{
+		UE_LOG(LogDisplayClusterCluster, Error, TEXT("Couldn't initialize a controller."));
+		Controller.Reset();
+		return false;
+	}
+
+	return true;
+}
+
+void FDisplayClusterClusterManager::EndSession()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterCluster);
+
+	{
+		FScopeLock lock(&InternalsSyncScope);
+		if (Controller)
+		{
+			Controller->Release();
+			Controller.Reset();
+		}
+	}
+}
+
+bool FDisplayClusterClusterManager::StartScene(UWorld* pWorld)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterCluster);
+
+	check(pWorld);
+	CurrentWorld = pWorld;
+
+	return true;
+}
+
+void FDisplayClusterClusterManager::EndScene()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterCluster);
+
+	{
+		FScopeLock lock(&ObjectsToSyncCritSec);
+		ObjectsToSync.Reset();
+	}
+}
+
+void FDisplayClusterClusterManager::PreTick(float DeltaSeconds)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterCluster);
+
+	// Clear cached data from previous game frame
+	{
+		FScopeLock lock(&ObjectsToSyncCritSec);
+		SyncObjectsCache.Empty(SyncObjectsCache.Num() | 0x07);
+	}
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterClusterManager
+//////////////////////////////////////////////////////////////////////////////////////////////
+IPDisplayClusterNodeController* FDisplayClusterClusterManager::GetController() const
+{
+	FScopeLock lock(&InternalsSyncScope);
+	return Controller ? Controller.Get() : nullptr;
+}
+
+bool FDisplayClusterClusterManager::IsMaster() const
+{
+	return Controller ? Controller->IsMaster() : false;
+}
+
+bool FDisplayClusterClusterManager::IsSlave() const
+{
+	return Controller ? Controller->IsSlave() : false;
+}
+
+bool FDisplayClusterClusterManager::IsStandalone() const
+{
+	return Controller ? Controller->IsStandalone() : false;
+}
+
+bool FDisplayClusterClusterManager::IsCluster() const
+{
+	return Controller ? Controller->IsCluster() : false;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IPDisplayClusterClusterManager
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterClusterManager::RegisterSyncObject(IDisplayClusterClusterSyncObject* pSyncObj)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterCluster);
+
+	{
+		FScopeLock lock(&ObjectsToSyncCritSec);
+		ObjectsToSync.Add(pSyncObj);
+	}
+
+	UE_LOG(LogDisplayClusterCluster, Log, TEXT("Registered sync object: %s"), *pSyncObj->GetSyncId());
+}
+
+void FDisplayClusterClusterManager::UnregisterSyncObject(IDisplayClusterClusterSyncObject* pSyncObj)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterCluster);
+
+	{
+		FScopeLock lock(&ObjectsToSyncCritSec);
+		ObjectsToSync.Remove(pSyncObj);
+	}
+
+	UE_LOG(LogDisplayClusterCluster, Log, TEXT("Unregistered sync object: %s"), *pSyncObj->GetSyncId());
+}
+
+void FDisplayClusterClusterManager::ExportSyncData(FDisplayClusterMessage::DataType& data) const
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterCluster);
+
+	{
+		FScopeLock lock(&ObjectsToSyncCritSec);
+
+		// Cache the data for current frame.
+		// There is on check for ObjectsToSync emptiness because we always have at least one
+		// shared transform which is AFDisplayClusterPawn.
+		if (SyncObjectsCache.Num() == 0)
+		{
+			for (auto obj : ObjectsToSync)
+			{
+				if (obj->IsDirty())
+				{
+					UE_LOG(LogDisplayClusterCluster, Verbose, TEXT("Adding object to sync: %s"), *obj->GetSyncId());
+					SyncObjectsCache.Add(obj->GetSyncId(), obj->SerializeToString());
+					obj->ClearDirty();
+				}
+			}
+		}
+	}
+
+	data = SyncObjectsCache;
+}
+
+void FDisplayClusterClusterManager::ImportSyncData(const FDisplayClusterMessage::DataType& data)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterCluster);
+
+	if (data.Num() > 0)
+	{
+		for (auto it = data.CreateConstIterator(); it; ++it)
+		{
+			UE_LOG(LogDisplayClusterCluster, Verbose, TEXT("sync-data: %s=%s"), *it->Key, *it->Value);
+		}
+
+		for (auto obj : ObjectsToSync)
+		{
+			const FString syncId = obj->GetSyncId();
+			if (!data.Contains(syncId))
+			{
+				UE_LOG(LogDisplayClusterCluster, Error, TEXT("%s not found in sync data"), *syncId);
+				continue;
+			}
+
+			UE_LOG(LogDisplayClusterCluster, Verbose, TEXT("Found %s in sync data. Applying..."), *syncId);
+			if (!obj->DeserializeFromString(data[syncId]))
+			{
+				UE_LOG(LogDisplayClusterCluster, Error, TEXT("Couldn't apply sync data for sync object %s"), *syncId);
+			}
+		}
+	}
+}
+
+void FDisplayClusterClusterManager::SyncObjects()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterCluster);
+
+	//@note:
+	// Don't use FScopeLock lock(&ObjectsToSyncCritSec) here because
+	// a) There are no race conditions at this point. We're in single-threaded mode right now (see UDisplayClusterGameEngine::Tick())
+	// b) Performance
+
+	// No need to do the sync for master
+	if (IsSlave())
+	{
+		UE_LOG(LogDisplayClusterCluster, Verbose, TEXT("Downloading synchronization data (objects)..."));
+		TMap<FString, FString> data;
+		Controller->GetSyncData(data);
+		UE_LOG(LogDisplayClusterCluster, Verbose, TEXT("Downloading finished. Available %d records (objects)."), data.Num());
+
+		// Perform data load (objects state update)
+		ImportSyncData(data);
+	}
+}
+
+void FDisplayClusterClusterManager::SyncInput()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterCluster);
+
+	// No need to do the sync for master
+	if (IsSlave())
+	{
+		UE_LOG(LogDisplayClusterCluster, Verbose, TEXT("Downloading synchronization data (input)..."));
+		TMap<FString, FString> data;
+		Controller->GetInputData(data);
+		UE_LOG(LogDisplayClusterCluster, Verbose, TEXT("Downloading finished. Available %d records (input)."), data.Num());
+
+		// Perform data load (objects state update)
+		GDisplayCluster->GetPrivateInputMgr()->ImportInputData(data);
+	}
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterClusterManager
+//////////////////////////////////////////////////////////////////////////////////////////////
+FDisplayClusterClusterManager::TController FDisplayClusterClusterManager::CreateController() const
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterCluster);
+
+	UE_LOG(LogDisplayClusterCluster, Log, TEXT("Current operation mode: %s"), *FDisplayClusterTypesConverter::ToString(CurrentOperationMode));
+
+	// Instantiate appropriate controller depending on operation mode and cluster role
+	FDisplayClusterNodeCtrlBase* pController = nullptr;
+	if (CurrentOperationMode == EDisplayClusterOperationMode::Cluster)
+	{
+		FDisplayClusterConfigClusterNode nodeCfg;
+		if (GDisplayCluster->GetPrivateConfigMgr()->GetClusterNode(ClusterNodeId, nodeCfg) == false)
+		{
+			UE_LOG(LogDisplayClusterCluster, Error, TEXT("Configuration data for node %s not found"), *ClusterNodeId);
+			return nullptr;
+		}
+
+		if (nodeCfg.IsMaster)
+		{
+			UE_LOG(LogDisplayClusterCluster, Log, TEXT("Instantiating cluster master controller..."));
+			pController = new FDisplayClusterClusterNodeCtrlMaster(FString("[CTRL-M]"), ClusterNodeId);
+		}
+		else
+		{
+			UE_LOG(LogDisplayClusterCluster, Log, TEXT("Instantiating cluster slave controller..."));
+			pController = new FDisplayClusterClusterNodeCtrlSlave(FString("[CTRL-S]"), ClusterNodeId);
+		}
+	}
+	else if (CurrentOperationMode == EDisplayClusterOperationMode::Standalone)
+	{
+		UE_LOG(LogDisplayClusterCluster, Log, TEXT("Instantiating standalone controller"));
+		pController = new FDisplayClusterNodeCtrlStandalone(FString("[CTRL-STNDA]"), FString("standalone"));
+	}
+	else if (CurrentOperationMode == EDisplayClusterOperationMode::Editor)
+	{
+		UE_LOG(LogDisplayClusterCluster, Log, TEXT("Instantiating cluster master controller..."));
+		//pController = new FDisplayClusterNodeCtrlStandalone(FString("[CTRL-STNDA]"), ClusterNodeId);
+		pController = new FDisplayClusterNodeCtrlStandalone(FString("[CTRL-STNDA]"), FString("standalone"));
+	}
+	else if (CurrentOperationMode == EDisplayClusterOperationMode::Disabled)
+	{
+		UE_LOG(LogDisplayClusterCluster, Log, TEXT("Controller is not required"));
+		return nullptr;
+	}
+	else
+	{
+		UE_LOG(LogDisplayClusterCluster, Error, TEXT("Unknown operation mode"));
+		return nullptr;
+	}
+
+	// Return the controller
+	return TController(pController);
+}
+
+bool FDisplayClusterClusterManager::GetResolvedNodeId(FString& id) const
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterCluster);
+
+	TArray<TSharedPtr<FInternetAddr>> addrs;
+	if (!ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->GetLocalAdapterAddresses(addrs))
+	{
+		UE_LOG(LogDisplayClusterCluster, Error, TEXT("Couldn't get local addresses list. Cannot find node ID by its address."));
+		FDisplayClusterAppExit::ExitApplication(FDisplayClusterAppExit::ExitType::KillImmediately, FString("Cluster manager init error"));
+		return false;
+	}
+
+	if (addrs.Num() <= 0)
+	{
+		UE_LOG(LogDisplayClusterCluster, Error, TEXT("No local addresses found"));
+		FDisplayClusterAppExit::ExitApplication(FDisplayClusterAppExit::ExitType::KillImmediately, FString("Cluster manager init error"));
+		return false;
+	}
+
+	const TArray<FDisplayClusterConfigClusterNode> cnodes = GDisplayCluster->GetPrivateConfigMgr()->GetClusterNodes();
+
+	// Look for associated node in config
+	const FDisplayClusterConfigClusterNode* const pNode = cnodes.FindByPredicate([addrs](const FDisplayClusterConfigClusterNode& node)
+	{
+		for (auto addr : addrs)
+		{
+			const FIPv4Endpoint ep(addr);
+			const FString epaddr = ep.Address.ToString();
+			UE_LOG(LogDisplayClusterCluster, Log, TEXT("Comparing addresses: %s - %s"), *epaddr, *node.Addr);
+
+			//@note: don't add "127.0.0.1" or "localhost" here. There will be a bug. It has been proved already.
+			if (epaddr == node.Addr)
+			{
+				return true;
+			}
+		}
+
+		return false;
+	});
+
+	if (!pNode)
+	{
+		UE_LOG(LogDisplayClusterCluster, Error, TEXT("Couldn't find any local address in config file"));
+		FDisplayClusterAppExit::ExitApplication(FDisplayClusterAppExit::ExitType::KillImmediately, FString("Cluster manager init error"));
+		return false;
+	}
+
+	// Ok, we found the node ID by address (this won't work if you want to run several cluster nodes on the same address)
+	id = pNode->Id;
+	return true;
+}
diff --git a/Source/DisplayCluster/Private/Cluster/DisplayClusterClusterManager.h b/Source/DisplayCluster/Private/Cluster/DisplayClusterClusterManager.h
new file mode 100644
index 0000000000000000000000000000000000000000..3391fffed5b7dc1dd797d30826aaa8ddfef908b9
--- /dev/null
+++ b/Source/DisplayCluster/Private/Cluster/DisplayClusterClusterManager.h
@@ -0,0 +1,109 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "IPDisplayClusterClusterManager.h"
+#include "Network/DisplayClusterMessage.h"
+#include "Misc/App.h"
+
+class ADisplayClusterGameMode;
+class ADisplayClusterSettings;
+
+
+/**
+ * Cluster manager. Responsible for network communication and data replication.
+ */
+class FDisplayClusterClusterManager
+	: public    IPDisplayClusterClusterManager
+{
+public:
+	FDisplayClusterClusterManager();
+	virtual ~FDisplayClusterClusterManager();
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterManager
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool Init(EDisplayClusterOperationMode OperationMode) override;
+	virtual void Release() override;
+	virtual bool StartSession(const FString& configPath, const FString& nodeId) override;
+	virtual void EndSession() override;
+	virtual bool StartScene(UWorld* pWorld) override;
+	virtual void EndScene() override;
+	virtual void PreTick(float DeltaSeconds) override;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterClusterManager
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool IsMaster()     const override;
+	virtual bool IsSlave()      const override;
+	virtual bool IsStandalone() const override;
+	virtual bool IsCluster()    const override;
+
+	virtual FString GetNodeId() const override
+	{ return ClusterNodeId; }
+
+	virtual uint32 GetNodesAmount() const override
+	{ return NodesAmount; }
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterClusterManager
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual IPDisplayClusterNodeController* GetController() const override;
+
+	virtual float GetDeltaTime() const override
+	{ return DeltaTime; }
+
+	virtual void  SetDeltaTime(float deltaTime) override
+	{ DeltaTime = deltaTime; }
+
+	virtual void GetTimecode(FTimecode& timecode, FFrameRate& frameRate) const override
+	{ timecode = FApp::GetTimecode(); frameRate = FApp::GetTimecodeFrameRate(); }
+
+	virtual void SetTimecode(const FTimecode& timecode, const FFrameRate& frameRate) override
+	{ FApp::SetTimecodeAndFrameRate(timecode, frameRate); }
+	
+	virtual void RegisterSyncObject(IDisplayClusterClusterSyncObject* pSyncObj) override;
+	virtual void UnregisterSyncObject(IDisplayClusterClusterSyncObject* pSyncObj) override;
+
+	virtual void ExportSyncData(FDisplayClusterMessage::DataType& data) const override;
+	virtual void ImportSyncData(const FDisplayClusterMessage::DataType& data) override;
+
+	virtual void SyncObjects() override;
+	virtual void SyncInput()   override;
+
+private:
+	bool GetResolvedNodeId(FString& id) const;
+
+	typedef TUniquePtr<IPDisplayClusterNodeController> TController;
+
+	// Factory method
+	TController CreateController() const;
+
+private:
+	// Controller implementation
+	TController Controller;
+	// Cluster/node props
+	uint32 NodesAmount = 0;
+	// Current time delta for sync
+	float DeltaTime = 0.f;
+
+	// Current operation mode
+	EDisplayClusterOperationMode CurrentOperationMode;
+	// Current config path
+	FString ConfigPath;
+	// Current node ID
+	FString ClusterNodeId;
+	// Current world
+	UWorld* CurrentWorld;
+
+	// Sync transforms
+	TSet<IDisplayClusterClusterSyncObject*>   ObjectsToSync;
+	mutable FDisplayClusterMessage::DataType  SyncObjectsCache;
+	mutable FCriticalSection                  ObjectsToSyncCritSec;
+
+	mutable FCriticalSection InternalsSyncScope;
+};
+
diff --git a/Source/DisplayCluster/Private/Cluster/IPDisplayClusterClusterManager.h b/Source/DisplayCluster/Private/Cluster/IPDisplayClusterClusterManager.h
new file mode 100644
index 0000000000000000000000000000000000000000..fd6af70eb7916159beb55d1f1f68fae6406a084c
--- /dev/null
+++ b/Source/DisplayCluster/Private/Cluster/IPDisplayClusterClusterManager.h
@@ -0,0 +1,42 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Misc/Timecode.h"
+#include "Misc/FrameRate.h"
+#include "Cluster/IDisplayClusterClusterManager.h"
+#include "IPDisplayClusterManager.h"
+
+#include "Network/DisplayClusterMessage.h"
+
+struct IPDisplayClusterNodeController;
+struct IDisplayClusterClusterSyncObject;
+
+
+/**
+ * Cluster manager private interface
+ */
+struct IPDisplayClusterClusterManager :
+	public IDisplayClusterClusterManager,
+	public IPDisplayClusterManager
+{
+	virtual ~IPDisplayClusterClusterManager()
+	{ }
+
+	virtual IPDisplayClusterNodeController* GetController() const = 0;
+	
+	virtual float GetDeltaTime() const = 0;
+	virtual void  SetDeltaTime(float deltaTime) = 0;
+
+	virtual void GetTimecode(FTimecode& timecode, FFrameRate& frameRate) const = 0;
+	virtual void  SetTimecode(const FTimecode& timecode, const FFrameRate& frameRate) = 0;
+	
+	virtual void RegisterSyncObject  (IDisplayClusterClusterSyncObject* pSyncObj) = 0;
+	virtual void UnregisterSyncObject(IDisplayClusterClusterSyncObject* pSyncObj) = 0;
+
+	virtual void ExportSyncData(FDisplayClusterMessage::DataType& data) const = 0;
+	virtual void ImportSyncData(const FDisplayClusterMessage::DataType& data) = 0;
+
+	virtual void SyncObjects() = 0;
+	virtual void SyncInput()   = 0;
+};
diff --git a/Source/DisplayCluster/Private/Config/Checker/DisplayClusterConfigChecker.cpp b/Source/DisplayCluster/Private/Config/Checker/DisplayClusterConfigChecker.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..dd9129b474b405a38e72e5688728404c85593f2c
--- /dev/null
+++ b/Source/DisplayCluster/Private/Config/Checker/DisplayClusterConfigChecker.cpp
@@ -0,0 +1,72 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterConfigChecker.h"
+#include "Misc/DisplayClusterLog.h"
+
+
+FDisplayClusterConfigChecker::FDisplayClusterConfigChecker()
+{
+	UE_LOG(LogDisplayClusterConfig, Verbose, TEXT("FDisplayClusterConfigManager .dtor"));
+}
+
+FDisplayClusterConfigChecker::~FDisplayClusterConfigChecker()
+{
+	UE_LOG(LogDisplayClusterConfig, Verbose, TEXT("FDisplayClusterConfigManager .dtor"));
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterConfigParserListener
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterConfigChecker::AddClusterNode(const FDisplayClusterConfigClusterNode& node)
+{
+	//UE_LOG(LogDisplayClusterConfig, Log, TEXT("Found cluster node: id=%s, addr=%s, role=%s, port_cs=%d, port_ss=%d, port_ce=%d"),
+	//	*node.Id, *node.Addr, node.IsMaster ? TEXT("master") : TEXT("slave"), node.Port_CS, node.Port_SS, node.Port_CE);
+}
+
+void FDisplayClusterConfigChecker::AddScreen(const FDisplayClusterConfigScreen& screen)
+{
+	//UE_LOG(LogDisplayClusterConfig, Log, TEXT("Found screen: id=%s, parent=%s, loc=%s, rot=%s, size=%s"),
+	//	*screen.Id, *screen.ParentId, *screen.Loc.ToString(), *screen.Rot.ToString(), *screen.Size.ToString());
+}
+
+void FDisplayClusterConfigChecker::AddViewport(const FDisplayClusterConfigViewport& viewport)
+{
+	//UE_LOG(LogDisplayClusterConfig, Log, TEXT("Found viewport: id=%s, loc=%s, size=%s"),
+	//	*viewport.Id, *viewport.Loc.ToString(), *viewport.Size.ToString());
+}
+
+void FDisplayClusterConfigChecker::AddCamera(const FDisplayClusterConfigCamera& camera)
+{
+}
+
+void FDisplayClusterConfigChecker::AddSceneNode(const FDisplayClusterConfigSceneNode& actor)
+{
+	//UE_LOG(LogDisplayClusterConfig, Log, TEXT("Found scene node: id=%s, parent=%s, type=%d, loc=%s, rot=%s"),
+	//	*actor.Id, *actor.ParentId, static_cast<int>(actor.Type), *actor.Loc.ToString(), *actor.Rot.ToString());
+}
+
+void FDisplayClusterConfigChecker::AddGeneral(const FDisplayClusterConfigGeneral& general)
+{
+}
+
+void FDisplayClusterConfigChecker::AddRender(const FDisplayClusterConfigRender& render)
+{
+}
+
+void FDisplayClusterConfigChecker::AddStereo(const FDisplayClusterConfigStereo& stereo)
+{
+}
+
+void FDisplayClusterConfigChecker::AddDebug(const FDisplayClusterConfigDebug& debug)
+{
+}
+
+void FDisplayClusterConfigChecker::AddInput(const FDisplayClusterConfigInput& input)
+{
+}
+
+void FDisplayClusterConfigChecker::AddCustom(const FDisplayClusterConfigCustom& custom)
+{
+}
+
diff --git a/Source/DisplayCluster/Private/Config/Checker/DisplayClusterConfigChecker.h b/Source/DisplayCluster/Private/Config/Checker/DisplayClusterConfigChecker.h
new file mode 100644
index 0000000000000000000000000000000000000000..4b189ff70b8300f2c856c3cccfd01ed167501122
--- /dev/null
+++ b/Source/DisplayCluster/Private/Config/Checker/DisplayClusterConfigChecker.h
@@ -0,0 +1,33 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Config/Parser/IDisplayClusterConfigParserListener.h"
+
+
+/**
+ * Helper class to analyze if config data is correct
+ */
+class FDisplayClusterConfigChecker
+	: protected IDisplayClusterConfigParserListener
+{
+public:
+	FDisplayClusterConfigChecker();
+	~FDisplayClusterConfigChecker();
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterConfigParserListener
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void AddClusterNode (const FDisplayClusterConfigClusterNode& node) override;
+	virtual void AddScreen      (const FDisplayClusterConfigScreen& screen) override;
+	virtual void AddViewport    (const FDisplayClusterConfigViewport& viewport) override;
+	virtual void AddCamera      (const FDisplayClusterConfigCamera& camera) override;
+	virtual void AddSceneNode   (const FDisplayClusterConfigSceneNode& actor) override;
+	virtual void AddGeneral     (const FDisplayClusterConfigGeneral& general) override;
+	virtual void AddRender      (const FDisplayClusterConfigRender& render) override;
+	virtual void AddStereo      (const FDisplayClusterConfigStereo& stereo) override;
+	virtual void AddDebug       (const FDisplayClusterConfigDebug& debug) override;
+	virtual void AddInput       (const FDisplayClusterConfigInput& input) override;
+	virtual void AddCustom      (const FDisplayClusterConfigCustom& custom) override;
+};
diff --git a/Source/DisplayCluster/Private/Config/DisplayClusterConfigManager.cpp b/Source/DisplayCluster/Private/Config/DisplayClusterConfigManager.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4f0a62eb6ed577357a19d852e886ec8b2eba1e73
--- /dev/null
+++ b/Source/DisplayCluster/Private/Config/DisplayClusterConfigManager.cpp
@@ -0,0 +1,465 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterConfigManager.h"
+
+#include "Cluster/IPDisplayClusterClusterManager.h"
+
+#include "Config/DisplayClusterConfigTypes.h"
+#include "Config/Parser/DisplayClusterConfigParserText.h"
+#include "Config/Parser/DisplayClusterConfigParserXml.h"
+#include "Config/Parser/DisplayClusterConfigParserDebugAuto.h"
+
+#include "DisplayClusterBuildConfig.h"
+#include "Misc/DisplayClusterLog.h"
+#include "Misc/Paths.h"
+#include "DisplayClusterGlobals.h"
+#include "DisplayClusterStrings.h"
+#include "IPDisplayCluster.h"
+
+
+FDisplayClusterConfigManager::FDisplayClusterConfigManager()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterConfig);
+}
+
+FDisplayClusterConfigManager::~FDisplayClusterConfigManager()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterConfig);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IPDisplayClusterManager
+//////////////////////////////////////////////////////////////////////////////////////////////
+bool FDisplayClusterConfigManager::Init(EDisplayClusterOperationMode OperationMode)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterConfig);
+	
+	return true;
+}
+
+void FDisplayClusterConfigManager::Release()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterConfig);
+}
+
+bool FDisplayClusterConfigManager::StartSession(const FString& configPath, const FString& nodeId)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterConfig);
+	
+	ConfigPath = configPath;
+	ClusterNodeId = nodeId;
+
+	UE_LOG(LogDisplayClusterConfig, Log, TEXT("Starting session with config: %s"), *ConfigPath);
+
+	// Load data
+	return LoadConfig(ConfigPath);
+}
+
+void FDisplayClusterConfigManager::EndSession()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterConfig);
+
+	ResetConfigData();
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterConfigManager
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Cluster nodes
+TArray<FDisplayClusterConfigClusterNode> FDisplayClusterConfigManager::GetClusterNodes() const
+{
+	return CfgClusterNodes;
+}
+
+int32 FDisplayClusterConfigManager::GetClusterNodesAmount() const
+{
+	return CfgClusterNodes.Num();
+}
+
+bool FDisplayClusterConfigManager::GetClusterNode(int32 idx, FDisplayClusterConfigClusterNode& node) const
+{
+	return GetItem(CfgClusterNodes, idx, node, FString("GetNode"));
+}
+
+bool FDisplayClusterConfigManager::GetClusterNode(const FString& id, FDisplayClusterConfigClusterNode& node) const
+{
+	return GetItem(CfgClusterNodes, id, node, FString("GetNode"));
+}
+
+bool FDisplayClusterConfigManager::GetMasterClusterNode(FDisplayClusterConfigClusterNode& node) const
+{
+	const FDisplayClusterConfigClusterNode* const pFound = CfgClusterNodes.FindByPredicate([](const FDisplayClusterConfigClusterNode& item)
+	{
+		return item.IsMaster == true;
+	});
+
+	if (!pFound)
+	{
+		UE_LOG(LogDisplayClusterConfig, Error, TEXT("Master node configuration not found"));
+		return false;
+	}
+
+	node = *pFound;
+	return true;
+}
+
+bool FDisplayClusterConfigManager::GetLocalClusterNode(FDisplayClusterConfigClusterNode& node) const
+{
+	if (GDisplayCluster->GetOperationMode() == EDisplayClusterOperationMode::Disabled)
+	{
+		return false;
+	}
+
+	const FString nodeId = GDisplayCluster->GetPrivateClusterMgr()->GetNodeId();
+	return GetItem(CfgClusterNodes, nodeId, node, FString("GetLocalNode"));
+}
+
+
+// Screens
+TArray<FDisplayClusterConfigScreen> FDisplayClusterConfigManager::GetScreens() const
+{
+	return CfgScreens;
+}
+
+int32 FDisplayClusterConfigManager::GetScreensAmount() const
+{
+	return CfgScreens.Num();
+}
+
+bool FDisplayClusterConfigManager::GetScreen(int32 idx, FDisplayClusterConfigScreen& screen) const
+{
+	return GetItem(CfgScreens, idx, screen, FString("GetScreen"));
+}
+
+bool FDisplayClusterConfigManager::GetScreen(const FString& id, FDisplayClusterConfigScreen& screen) const
+{
+	return GetItem(CfgScreens, id, screen, FString("GetScreen"));
+}
+
+bool FDisplayClusterConfigManager::GetLocalScreen(FDisplayClusterConfigScreen& screen) const
+{
+	FDisplayClusterConfigClusterNode localNode;
+	if (GetLocalClusterNode(localNode))
+	{
+		return GetItem(CfgScreens, localNode.ScreenId, screen, FString("GetLocalScreen"));
+	}
+
+	return false;
+}
+
+
+// Cameras
+TArray<FDisplayClusterConfigCamera> FDisplayClusterConfigManager::GetCameras() const
+{
+	return CfgCameras;
+}
+
+int32 FDisplayClusterConfigManager::GetCamerasAmount() const
+{
+	return CfgCameras.Num();
+}
+
+bool FDisplayClusterConfigManager::GetCamera(int32 idx, FDisplayClusterConfigCamera& camera) const
+{
+	return GetItem(CfgCameras, idx, camera, FString("GetCamera"));
+}
+
+bool FDisplayClusterConfigManager::GetCamera(const FString& id, FDisplayClusterConfigCamera& camera) const
+{
+	return GetItem(CfgCameras, id, camera, FString("GetCamera"));
+}
+
+
+// Viewports
+TArray<FDisplayClusterConfigViewport> FDisplayClusterConfigManager::GetViewports() const
+{
+	return CfgViewports;
+}
+
+int32 FDisplayClusterConfigManager::GetViewportsAmount() const
+{
+	return static_cast<uint32>(CfgViewports.Num());
+}
+
+bool FDisplayClusterConfigManager::GetViewport(int32 idx, FDisplayClusterConfigViewport& viewport) const
+{
+	return GetItem(CfgViewports, idx, viewport, FString("GetViewport"));
+}
+
+bool FDisplayClusterConfigManager::GetViewport(const FString& id, FDisplayClusterConfigViewport& viewport) const
+{
+	return GetItem(CfgViewports, id, viewport, FString("GetViewport"));
+}
+
+//@todo: remove all GetLocal* functions. Config manager doesn't have to know its place in cluster. 
+bool FDisplayClusterConfigManager::GetLocalViewport(FDisplayClusterConfigViewport& viewport) const
+{
+	FDisplayClusterConfigClusterNode localNode;
+	if (GetLocalClusterNode(localNode))
+	{
+		return GetItem(CfgViewports, localNode.ViewportId, viewport, FString("GetLocalViewport"));
+	}
+
+	return false;
+}
+
+
+// Scene nodes
+TArray<FDisplayClusterConfigSceneNode> FDisplayClusterConfigManager::GetSceneNodes() const
+{
+	return CfgSceneNodes;
+}
+
+int32 FDisplayClusterConfigManager::GetSceneNodesAmount() const
+{
+	return static_cast<uint32>(CfgSceneNodes.Num());
+}
+
+bool FDisplayClusterConfigManager::GetSceneNode(int32 idx, FDisplayClusterConfigSceneNode& actor) const
+{
+	return GetItem(CfgSceneNodes, idx, actor, FString("GetActor"));
+}
+
+bool FDisplayClusterConfigManager::GetSceneNode(const FString& id, FDisplayClusterConfigSceneNode& actor) const
+{
+	return GetItem(CfgSceneNodes, id, actor, FString("GetActor"));
+}
+
+
+// Input devices
+TArray<FDisplayClusterConfigInput> FDisplayClusterConfigManager::GetInputDevices() const
+{
+	return CfgInputDevices;
+}
+
+int32 FDisplayClusterConfigManager::GetInputDevicesAmount() const
+{
+	return CfgInputDevices.Num();
+}
+
+bool FDisplayClusterConfigManager::GetInputDevice(int32 idx, FDisplayClusterConfigInput& input) const
+{
+	return GetItem(CfgInputDevices, idx, input, FString("GetInputDevice"));
+}
+
+bool FDisplayClusterConfigManager::GetInputDevice(const FString& id, FDisplayClusterConfigInput& input) const
+{
+	return GetItem(CfgInputDevices, id, input, FString("GetInputDevice"));
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterConfigParserListener
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterConfigManager::AddClusterNode(const FDisplayClusterConfigClusterNode& cfgCNode)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterConfig);
+	UE_LOG(LogDisplayClusterConfig, Log, TEXT("Found cluster node: %s"), *cfgCNode.ToString());
+	CfgClusterNodes.Add(cfgCNode);
+}
+
+void FDisplayClusterConfigManager::AddScreen(const FDisplayClusterConfigScreen& cfgScreen)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterConfig);
+	UE_LOG(LogDisplayClusterConfig, Log, TEXT("Found screen: %s"), *cfgScreen.ToString());
+	CfgScreens.Add(cfgScreen);
+}
+
+void FDisplayClusterConfigManager::AddViewport(const FDisplayClusterConfigViewport& cfgViewport)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterConfig);
+	UE_LOG(LogDisplayClusterConfig, Log, TEXT("Found viewport: %s"), *cfgViewport.ToString());
+	CfgViewports.Add(cfgViewport);
+}
+
+void FDisplayClusterConfigManager::AddCamera(const FDisplayClusterConfigCamera& cfgCamera)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterConfig);
+	UE_LOG(LogDisplayClusterConfig, Log, TEXT("Found camera: %s"), *cfgCamera.ToString());
+	CfgCameras.Add(cfgCamera);
+}
+
+void FDisplayClusterConfigManager::AddSceneNode(const FDisplayClusterConfigSceneNode& cfgSNode)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterConfig);
+	UE_LOG(LogDisplayClusterConfig, Log, TEXT("Found scene node: %s"), *cfgSNode.ToString());
+	CfgSceneNodes.Add(cfgSNode);
+}
+
+void FDisplayClusterConfigManager::AddInput(const FDisplayClusterConfigInput& cfgInput)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterConfig);
+	UE_LOG(LogDisplayClusterConfig, Log, TEXT("Found input device: %s"), *cfgInput.ToString());
+	CfgInputDevices.Add(cfgInput);
+}
+
+void FDisplayClusterConfigManager::AddGeneral(const FDisplayClusterConfigGeneral& cfgGeneral)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterConfig);
+	UE_LOG(LogDisplayClusterConfig, Log, TEXT("Found general: %s"), *cfgGeneral.ToString());
+	CfgGeneral = cfgGeneral;
+}
+
+void FDisplayClusterConfigManager::AddRender(const FDisplayClusterConfigRender& cfgRender)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterConfig);
+	UE_LOG(LogDisplayClusterConfig, Log, TEXT("Found render: %s"), *cfgRender.ToString());
+	CfgRender = cfgRender;
+}
+
+void FDisplayClusterConfigManager::AddStereo(const FDisplayClusterConfigStereo& cfgStereo)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterConfig);
+	UE_LOG(LogDisplayClusterConfig, Log, TEXT("Found stereo: %s"), *cfgStereo.ToString());
+	CfgStereo = cfgStereo;
+}
+
+void FDisplayClusterConfigManager::AddDebug(const FDisplayClusterConfigDebug& cfgDebug)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterConfig);
+	UE_LOG(LogDisplayClusterConfig, Log, TEXT("Found debug: %s"), *cfgDebug.ToString());
+	CfgDebug = cfgDebug;
+}
+
+void FDisplayClusterConfigManager::AddCustom(const FDisplayClusterConfigCustom& cfgCustom)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterConfig);
+	UE_LOG(LogDisplayClusterConfig, Log, TEXT("Found custom: %s"), *cfgCustom.ToString());
+	CfgCustom = cfgCustom;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterConfigManager
+//////////////////////////////////////////////////////////////////////////////////////////////
+FDisplayClusterConfigManager::EConfigFileType FDisplayClusterConfigManager::GetConfigFileType(const FString& cfgPath) const
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterConfig);
+
+#ifdef DISPLAY_CLUSTER_USE_DEBUG_STANDALONE_CONFIG
+	if (cfgPath == DisplayClusterStrings::misc::DbgStubConfig)
+	{
+		UE_LOG(LogDisplayClusterConfig, Log, TEXT("Debug auto config requested"));
+		return EConfigFileType::DebugAuto;
+	}
+#endif
+
+	const FString ext = FPaths::GetExtension(cfgPath).ToLower();
+	if (ext == FString(DisplayClusterStrings::cfg::file::FileExtXml).ToLower())
+	{
+		UE_LOG(LogDisplayClusterConfig, Log, TEXT("XML config: %s"), *cfgPath);
+		return EConfigFileType::Xml;
+	}
+	else if (
+		ext == FString(DisplayClusterStrings::cfg::file::FileExtCfg1).ToLower() ||
+		ext == FString(DisplayClusterStrings::cfg::file::FileExtCfg2).ToLower() ||
+		ext == FString(DisplayClusterStrings::cfg::file::FileExtCfg3).ToLower() ||
+		ext == FString(DisplayClusterStrings::cfg::file::FileExtTxt).ToLower())
+	{
+		UE_LOG(LogDisplayClusterConfig, Log, TEXT("TXT config: %s"), *cfgPath);
+		return EConfigFileType::Text;
+	}
+
+	UE_LOG(LogDisplayClusterConfig, Warning, TEXT("Unknown file extension: %s"), *ext);
+	return EConfigFileType::Unknown;
+}
+
+bool FDisplayClusterConfigManager::LoadConfig(const FString& cfgPath)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterConfig);
+
+	// Actually the data is reset on EndFrame. This one is a safety call.
+	ResetConfigData();
+
+#ifdef DISPLAY_CLUSTER_USE_DEBUG_STANDALONE_CONFIG
+	if (cfgPath.Compare(FString(DisplayClusterStrings::misc::DbgStubConfig), ESearchCase::IgnoreCase) != 0 &&
+		FPaths::FileExists(cfgPath) == false)
+	{
+		UE_LOG(LogDisplayClusterConfig, Error, TEXT("File not found: %s"), *cfgPath);
+		return false;
+	}
+#else
+	if (FPaths::FileExists(cfgPath) == false)
+	{
+		UE_LOG(LogDisplayClusterConfig, Error, TEXT("File not found: %s"), *cfgPath);
+		return false;
+	}
+#endif
+
+	// Instantiate appropriate parser
+	TUniquePtr<FDisplayClusterConfigParser> parser;
+	switch (GetConfigFileType(cfgPath))
+	{
+	case EConfigFileType::Text:
+		parser.Reset(new FDisplayClusterConfigParserText(this));
+		break;
+
+	case EConfigFileType::Xml:
+		parser.Reset(new FDisplayClusterConfigParserXml(this));
+		break;
+
+#ifdef DISPLAY_CLUSTER_USE_DEBUG_STANDALONE_CONFIG
+	case EConfigFileType::DebugAuto:
+		bIsDebugAuto = true;
+		parser.Reset(new FDisplayClusterConfigParserDebugAuto(this));
+		break;
+#endif
+
+	default:
+		UE_LOG(LogDisplayClusterConfig, Error, TEXT("Unknown config type"));
+		return false;
+	}
+
+	return parser->ParseFile(cfgPath);
+}
+
+void FDisplayClusterConfigManager::ResetConfigData()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterConfig);
+
+	CfgClusterNodes.Reset();
+	CfgScreens.Reset();
+	CfgViewports.Reset();
+	CfgCameras.Reset();
+	CfgSceneNodes.Reset();
+	CfgInputDevices.Reset();
+
+	CfgGeneral = FDisplayClusterConfigGeneral();
+	CfgStereo  = FDisplayClusterConfigStereo();
+	CfgRender  = FDisplayClusterConfigRender();
+	CfgDebug   = FDisplayClusterConfigDebug();
+	CfgCustom  = FDisplayClusterConfigCustom();
+}
+
+template <typename DataType>
+bool FDisplayClusterConfigManager::GetItem(const TArray<DataType>& container, uint32 idx, DataType& item, const FString& logHeader) const
+{
+	if (idx >= static_cast<uint32>(container.Num()))
+	{
+		UE_LOG(LogDisplayClusterConfig, Error, TEXT("%s: index is out of bound <%d>"), *logHeader, idx);
+		return false;
+	}
+
+	item = container[static_cast<int32>(idx)];
+	return true;
+}
+
+template <typename DataType>
+bool FDisplayClusterConfigManager::GetItem(const TArray<DataType>& container, const FString& id, DataType& item, const FString& logHeader) const
+{
+	auto pFound = container.FindByPredicate([id](const DataType& _item)
+	{
+		return _item.Id == id;
+	});
+
+	if (!pFound)
+	{
+		UE_LOG(LogDisplayClusterConfig, Warning, TEXT("%s: ID not found <%s>"), *logHeader, *id);
+		return false;
+	}
+
+	item = *pFound;
+	return true;
+}
diff --git a/Source/DisplayCluster/Private/Config/DisplayClusterConfigManager.h b/Source/DisplayCluster/Private/Config/DisplayClusterConfigManager.h
new file mode 100644
index 0000000000000000000000000000000000000000..49a644388e3222c2506d6f8531d71d545a393a65
--- /dev/null
+++ b/Source/DisplayCluster/Private/Config/DisplayClusterConfigManager.h
@@ -0,0 +1,155 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "IPDisplayClusterConfigManager.h"
+
+#include "Parser/IDisplayClusterConfigParserListener.h"
+
+#include "DisplayClusterBuildConfig.h"
+
+
+class FDisplayClusterConfigParser;
+
+
+/**
+ * Config manager. Responsible for loading data from config file and providing with it to any other class.
+ */
+class FDisplayClusterConfigManager
+	: public    IPDisplayClusterConfigManager
+	, protected IDisplayClusterConfigParserListener
+{
+public:
+	FDisplayClusterConfigManager();
+	virtual ~FDisplayClusterConfigManager();
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterManager
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool Init(EDisplayClusterOperationMode OperationMode) override;
+	virtual void Release() override;
+	virtual bool StartSession(const FString& configPath, const FString& nodeId) override;
+	virtual void EndSession() override;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterConfigManager
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual TArray<FDisplayClusterConfigClusterNode> GetClusterNodes() const override;
+	virtual int32 GetClusterNodesAmount() const override;
+	virtual bool GetClusterNode(int32 idx, FDisplayClusterConfigClusterNode& node) const override;
+	virtual bool GetClusterNode(const FString& id, FDisplayClusterConfigClusterNode& node) const override;
+	virtual bool GetMasterClusterNode(FDisplayClusterConfigClusterNode& node) const override;
+	virtual bool GetLocalClusterNode(FDisplayClusterConfigClusterNode& node) const override;
+
+	virtual TArray<FDisplayClusterConfigScreen> GetScreens() const override;
+	virtual int32 GetScreensAmount() const override;
+	virtual bool GetScreen(int32 idx, FDisplayClusterConfigScreen& screen) const override;
+	virtual bool GetScreen(const FString& id, FDisplayClusterConfigScreen& screen) const override;
+	virtual bool GetLocalScreen(FDisplayClusterConfigScreen& screen) const override;
+
+	virtual TArray<FDisplayClusterConfigCamera> GetCameras() const override;
+	virtual int32 GetCamerasAmount() const override;
+	virtual bool GetCamera(int32 idx, FDisplayClusterConfigCamera& camera) const override;
+	virtual bool GetCamera(const FString& id, FDisplayClusterConfigCamera& camera) const override;
+
+	virtual TArray<FDisplayClusterConfigViewport> GetViewports() const override;
+	virtual int32 GetViewportsAmount() const override;
+	virtual bool GetViewport(int32 idx, FDisplayClusterConfigViewport& viewport) const override;
+	virtual bool GetViewport(const FString& id, FDisplayClusterConfigViewport& viewport) const override;
+	virtual bool GetLocalViewport(FDisplayClusterConfigViewport& screen) const override;
+
+	virtual TArray<FDisplayClusterConfigSceneNode> GetSceneNodes() const override;
+	virtual int32 GetSceneNodesAmount() const override;
+	virtual bool GetSceneNode(int32 idx, FDisplayClusterConfigSceneNode& actor) const override;
+	virtual bool GetSceneNode(const FString& id, FDisplayClusterConfigSceneNode& actor) const override;
+
+	virtual TArray<FDisplayClusterConfigInput> GetInputDevices() const override;
+	virtual int32 GetInputDevicesAmount() const override;
+	virtual bool GetInputDevice(int32 idx, FDisplayClusterConfigInput& input) const override;
+	virtual bool GetInputDevice(const FString& id, FDisplayClusterConfigInput& input) const override;
+
+	virtual FDisplayClusterConfigGeneral GetConfigGeneral() const override
+	{ return CfgGeneral; }
+
+	virtual FDisplayClusterConfigStereo  GetConfigStereo() const override
+	{ return CfgStereo; }
+
+	virtual FDisplayClusterConfigRender  GetConfigRender() const override
+	{ return CfgRender; }
+
+	virtual FDisplayClusterConfigDebug   GetConfigDebug() const override
+	{ return CfgDebug; }
+
+	virtual FDisplayClusterConfigCustom  GetConfigCustom() const override
+	{ return CfgCustom; }
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterConfigManager
+	//////////////////////////////////////////////////////////////////////////////////////////////
+#ifdef DISPLAY_CLUSTER_USE_DEBUG_STANDALONE_CONFIG
+	virtual bool IsRunningDebugAuto() const override
+	{ return bIsDebugAuto; }
+#endif
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterConfigParserListener
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void AddClusterNode(const FDisplayClusterConfigClusterNode& cfgCNode) override;
+	virtual void AddScreen(const FDisplayClusterConfigScreen& cfgScreen) override;
+	virtual void AddViewport(const FDisplayClusterConfigViewport& cfgViewport) override;
+	virtual void AddCamera(const FDisplayClusterConfigCamera& cfgCamera) override;
+	virtual void AddSceneNode(const FDisplayClusterConfigSceneNode& cfgSNode)  override;
+	virtual void AddGeneral(const FDisplayClusterConfigGeneral& cfgGeneral)  override;
+	virtual void AddRender(const FDisplayClusterConfigRender& cfgRender)  override;
+	virtual void AddStereo(const FDisplayClusterConfigStereo& cfgStereo)  override;
+	virtual void AddDebug(const FDisplayClusterConfigDebug& cfgDebug)  override;
+	virtual void AddInput(const FDisplayClusterConfigInput& cfgInput)  override;
+	virtual void AddCustom(const FDisplayClusterConfigCustom& cfgCustom) override;
+
+private:
+	enum class EConfigFileType
+	{
+		Unknown,
+#ifdef DISPLAY_CLUSTER_USE_DEBUG_STANDALONE_CONFIG
+		DebugAuto,
+#endif
+		Text,
+		Xml
+	};
+
+	template <typename DataType>
+	bool GetItem(const TArray<DataType>& container, uint32 idx, DataType& item, const FString& logHeader) const;
+
+	template <typename DataType>
+	bool GetItem(const TArray<DataType>& container, const FString& id, DataType& item, const FString& logHeader) const;
+
+	EConfigFileType GetConfigFileType(const FString& cfgPath) const;
+	bool LoadConfig(const FString& cfgPath);
+	void ResetConfigData();
+
+private:
+	FString ConfigPath;
+	FString ClusterNodeId;
+
+	TArray<FDisplayClusterConfigClusterNode> CfgClusterNodes;
+	TArray<FDisplayClusterConfigScreen>      CfgScreens;
+	TArray<FDisplayClusterConfigViewport>    CfgViewports;
+	TArray<FDisplayClusterConfigCamera>      CfgCameras;
+	TArray<FDisplayClusterConfigSceneNode>   CfgSceneNodes;
+	TArray<FDisplayClusterConfigInput>       CfgInputDevices;
+
+	FDisplayClusterConfigGeneral CfgGeneral;
+	FDisplayClusterConfigStereo  CfgStereo;
+	FDisplayClusterConfigRender  CfgRender;
+	FDisplayClusterConfigDebug   CfgDebug;
+	FDisplayClusterConfigCustom  CfgCustom;
+
+#ifdef DISPLAY_CLUSTER_USE_DEBUG_STANDALONE_CONFIG
+	bool bIsDebugAuto = false;
+#endif
+};
diff --git a/Source/DisplayCluster/Private/Config/DisplayClusterConfigTypes.cpp b/Source/DisplayCluster/Private/Config/DisplayClusterConfigTypes.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b8d1f095345928d34fa8ff0d6435332cad9b424b
--- /dev/null
+++ b/Source/DisplayCluster/Private/Config/DisplayClusterConfigTypes.cpp
@@ -0,0 +1,295 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "Config/DisplayClusterConfigTypes.h"
+#include "DisplayClusterStrings.h"
+#include "Misc/DisplayClusterHelpers.h"
+#include "Misc/DisplayClusterLog.h"
+
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterConfigClusterNode
+//////////////////////////////////////////////////////////////////////////////////////////////
+FString FDisplayClusterConfigClusterNode::ToString() const
+{
+	return FString::Printf(TEXT("[%s + %s=%s, %s=%s, %s=%s, %s=%s, %s=%s, %s=%d, %s=%d, %s=%s, %s=%s]"),
+		*FDisplayClusterConfigBase::ToString(),
+		DisplayClusterStrings::cfg::data::Id, *Id, 
+		DisplayClusterStrings::cfg::data::cluster::Addr, *Addr, 
+		DisplayClusterStrings::cfg::data::cluster::Master, DisplayClusterHelpers::str::BoolToStr(IsMaster), 
+		DisplayClusterStrings::cfg::data::cluster::Screen, *ScreenId,
+		DisplayClusterStrings::cfg::data::cluster::Viewport, *ViewportId, 
+		DisplayClusterStrings::cfg::data::cluster::PortCS, Port_CS,
+		DisplayClusterStrings::cfg::data::cluster::PortSS, Port_SS,
+		DisplayClusterStrings::cfg::data::cluster::Sound, DisplayClusterHelpers::str::BoolToStr(SoundEnabled),
+		DisplayClusterStrings::cfg::data::cluster::EyeSwap, DisplayClusterHelpers::str::BoolToStr(EyeSwap));
+}
+
+bool FDisplayClusterConfigClusterNode::DeserializeFromString(const FString& line)
+{
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::Id),                Id);
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::cluster::Screen),   ScreenId);
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::cluster::Viewport), ViewportId);
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::cluster::Master),   IsMaster);
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::cluster::Addr),     Addr);
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::cluster::PortCS),   Port_CS);
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::cluster::PortSS),   Port_SS);
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::cluster::Sound),    SoundEnabled);
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::cluster::EyeSwap),  EyeSwap);
+	return FDisplayClusterConfigBase::DeserializeFromString(line);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterConfigViewport
+//////////////////////////////////////////////////////////////////////////////////////////////
+FString FDisplayClusterConfigViewport::ToString() const
+{
+	return FString::Printf(TEXT("[%s + %s=%s, %s=%s, %s=%d, %s=%d]"),
+		*FDisplayClusterConfigBase::ToString(),
+		DisplayClusterStrings::cfg::data::Id, *Id,
+		DisplayClusterStrings::cfg::data::Loc, *Loc.ToString(),
+		DisplayClusterStrings::cfg::data::viewport::Width,  Size.X,
+		DisplayClusterStrings::cfg::data::viewport::Height, Size.Y);
+}
+
+bool FDisplayClusterConfigViewport::DeserializeFromString(const FString& line)
+{
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::Id),               Id);
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::viewport::PosX),   Loc.X);
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::viewport::PosY),   Loc.Y);
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::viewport::Width),  Size.X);
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::viewport::Height), Size.Y);
+	return FDisplayClusterConfigBase::DeserializeFromString(line);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterConfigSceneNode
+//////////////////////////////////////////////////////////////////////////////////////////////
+FString FDisplayClusterConfigSceneNode::ToString() const
+{
+	return FString::Printf(TEXT("[%s + %s=%s, %s=%s, %s=%s, %s=%s, %s=%s, %s=%d]"),
+		*FDisplayClusterConfigBase::ToString(),
+		DisplayClusterStrings::cfg::data::Id, *Id,
+		DisplayClusterStrings::cfg::data::ParentId, *ParentId,
+		DisplayClusterStrings::cfg::data::Loc, *Loc.ToString(),
+		DisplayClusterStrings::cfg::data::Rot, *Rot.ToString(),
+		DisplayClusterStrings::cfg::data::scene::TrackerId, *TrackerId,
+		DisplayClusterStrings::cfg::data::scene::TrackerCh, TrackerCh);
+}
+
+bool FDisplayClusterConfigSceneNode::DeserializeFromString(const FString& line)
+{
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::Id),               Id);
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::ParentId),         ParentId);
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::Loc),              Loc);
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::Rot),              Rot);
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::scene::TrackerId), TrackerId);
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::scene::TrackerCh), TrackerCh);
+	return FDisplayClusterConfigBase::DeserializeFromString(line);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterConfigScreen
+//////////////////////////////////////////////////////////////////////////////////////////////
+FString FDisplayClusterConfigScreen::ToString() const
+{
+	return FString::Printf(TEXT("[%s + %s=%s]"),
+		*FDisplayClusterConfigSceneNode::ToString(),
+		DisplayClusterStrings::cfg::data::screen::Size, *Size.ToString());
+}
+
+bool FDisplayClusterConfigScreen::DeserializeFromString(const FString& line)
+{
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::screen::Size), Size);
+	return FDisplayClusterConfigSceneNode::DeserializeFromString(line);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterConfigCamera
+//////////////////////////////////////////////////////////////////////////////////////////////
+FString FDisplayClusterConfigCamera::ToString() const
+{
+	return FString::Printf(TEXT("[%s + ]"),
+		*FDisplayClusterConfigSceneNode::ToString());
+}
+
+bool FDisplayClusterConfigCamera::DeserializeFromString(const FString& line)
+{
+	return FDisplayClusterConfigSceneNode::DeserializeFromString(line);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterConfigInput
+//////////////////////////////////////////////////////////////////////////////////////////////
+FString FDisplayClusterConfigInput::ToString() const
+{
+	return FString::Printf(TEXT("[%s + %s=%s, %s=%s, %s={%s}]"),
+		*FDisplayClusterConfigBase::ToString(),
+		DisplayClusterStrings::cfg::data::Id, *Id,
+		DisplayClusterStrings::cfg::data::input::Type, *Type,
+		TEXT("params"), *Params);
+}
+
+bool FDisplayClusterConfigInput::DeserializeFromString(const FString& line)
+{
+	// Save full string to allow an input device to parse (polymorphic)
+	Params = line;
+	FString mapping;
+
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::Id), Id);
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::input::Type), Type);
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::input::Remap), mapping);
+
+	DisplayClusterHelpers::str::DustCommandLineValue(mapping);
+
+	TArray<FString> pairs;
+	FString pair;
+	while (mapping.Split(FString(","), &pair, &mapping, ESearchCase::IgnoreCase, ESearchDir::FromStart))
+	{
+		pairs.Add(pair);
+	}
+
+	pairs.Add(mapping);
+
+	for (const auto& item : pairs)
+	{
+		FString strL, strR;
+
+		if (item.Split(FString(":"), &strL, &strR, ESearchCase::IgnoreCase, ESearchDir::FromStart))
+		{
+			const int32 l = FDisplayClusterTypesConverter::FromString<int32>(strL);
+			const int32 r = FDisplayClusterTypesConverter::FromString<int32>(strR);
+
+			if (l != r)
+			{
+				ChMap.Add(l, r);
+			}
+		}
+	}
+
+	return FDisplayClusterConfigBase::DeserializeFromString(line);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterConfigGeneral
+//////////////////////////////////////////////////////////////////////////////////////////////
+FString FDisplayClusterConfigGeneral::ToString() const
+{
+	return FString::Printf(TEXT("[%s + %s=%d]"),
+		*FDisplayClusterConfigBase::ToString(),
+		DisplayClusterStrings::cfg::data::general::SwapSyncPolicy, SwapSyncPolicy);
+}
+
+bool FDisplayClusterConfigGeneral::DeserializeFromString(const FString& line)
+{
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::general::SwapSyncPolicy), SwapSyncPolicy);
+	return FDisplayClusterConfigBase::DeserializeFromString(line);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterConfigRender
+//////////////////////////////////////////////////////////////////////////////////////////////
+FString FDisplayClusterConfigRender::ToString() const
+{
+	return FString::Printf(TEXT("%s + "),
+		*FDisplayClusterConfigBase::ToString());
+}
+
+bool FDisplayClusterConfigRender::DeserializeFromString(const FString& line)
+{
+	return FDisplayClusterConfigBase::DeserializeFromString(line);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterConfigStereo
+//////////////////////////////////////////////////////////////////////////////////////////////
+FString FDisplayClusterConfigStereo::ToString() const
+{
+	return FString::Printf(TEXT("[%s + %s=%f]"),
+		*FDisplayClusterConfigBase::ToString(),
+		DisplayClusterStrings::cfg::data::stereo::EyeDist, EyeDist);
+}
+
+bool FDisplayClusterConfigStereo::DeserializeFromString(const FString& line)
+{
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::stereo::EyeDist), EyeDist);
+	return FDisplayClusterConfigBase::DeserializeFromString(line);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterConfigDebug
+//////////////////////////////////////////////////////////////////////////////////////////////
+FString FDisplayClusterConfigDebug::ToString() const
+{
+	return FString::Printf(TEXT("[%s + %s=%s, %s=%s, %s=%f]"),
+		*FDisplayClusterConfigBase::ToString(),
+		DisplayClusterStrings::cfg::data::debug::DrawStats, DisplayClusterHelpers::str::BoolToStr(DrawStats),
+		DisplayClusterStrings::cfg::data::debug::LagSim,  DisplayClusterHelpers::str::BoolToStr(LagSimulateEnabled),
+		DisplayClusterStrings::cfg::data::debug::LagTime, LagMaxTime);
+}
+
+bool FDisplayClusterConfigDebug::DeserializeFromString(const FString& line)
+{
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::debug::DrawStats), DrawStats);
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::debug::LagSim),    LagSimulateEnabled);
+	DisplayClusterHelpers::str::ExtractCommandLineValue(line, FString(DisplayClusterStrings::cfg::data::debug::LagTime),   LagMaxTime);
+	return FDisplayClusterConfigBase::DeserializeFromString(line);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterConfigCustom
+//////////////////////////////////////////////////////////////////////////////////////////////
+FString FDisplayClusterConfigCustom::ToString() const
+{
+	FString str = FDisplayClusterConfigBase::ToString() +  FString( + "[");
+	int i = 0;
+
+	for (auto it = Args.CreateConstIterator(); it; ++it)
+	{
+		str += FString::Printf(TEXT("\nCustom argument %d: %s=%s\n"), i++, *it->Key, *it->Value);
+	}
+
+	str += FString("]");
+
+	return str;
+}
+
+bool FDisplayClusterConfigCustom::DeserializeFromString(const FString& line)
+{
+	// Non-typical way of specifying custom arguments (we don't know
+	// the argument names) forces us to perform individual parsing approach.
+	FString tmpLine = line;
+
+	// Prepare string before parsing
+	tmpLine.RemoveFromStart(DisplayClusterStrings::cfg::data::custom::Header);
+	tmpLine.TrimStartAndEndInline();
+
+	// Break into argument-value pairs
+	TArray<FString> pairs;
+	tmpLine.ParseIntoArray(pairs, TEXT(" "));
+
+	// Fill data from pairs
+	for (auto pair : pairs)
+	{
+		FString key, val;
+		if (pair.Split(FString(DisplayClusterStrings::strKeyValSeparator), &key, &val))
+		{
+			if (key.Len() > 0 && val.Len() > 0)
+			{
+				Args.Add(key, val);
+			}
+		}
+	}
+
+	return FDisplayClusterConfigBase::DeserializeFromString(line);
+}
diff --git a/Source/DisplayCluster/Private/Config/IPDisplayClusterConfigManager.h b/Source/DisplayCluster/Private/Config/IPDisplayClusterConfigManager.h
new file mode 100644
index 0000000000000000000000000000000000000000..87f6d7dbeae829ac6b9bd1ad81921c405d8e5902
--- /dev/null
+++ b/Source/DisplayCluster/Private/Config/IPDisplayClusterConfigManager.h
@@ -0,0 +1,24 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Config/IDisplayClusterConfigManager.h"
+#include "IPDisplayClusterManager.h"
+
+#include "DisplayClusterBuildConfig.h"
+
+
+/**
+ * Config manager private interface
+ */
+struct IPDisplayClusterConfigManager
+	: public IDisplayClusterConfigManager
+	, public IPDisplayClusterManager
+{
+	virtual ~IPDisplayClusterConfigManager()
+	{ }
+
+#ifdef DISPLAY_CLUSTER_USE_DEBUG_STANDALONE_CONFIG
+	virtual bool IsRunningDebugAuto() const = 0;
+#endif
+};
diff --git a/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParser.cpp b/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParser.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..73258867820d897f9edfea6937880799b0fb2f3b
--- /dev/null
+++ b/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParser.cpp
@@ -0,0 +1,80 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterConfigParser.h"
+
+
+FDisplayClusterConfigParser::FDisplayClusterConfigParser(IDisplayClusterConfigParserListener* pListener) :
+	ConfigParserListener(pListener),
+	CurrentConfigPath()
+{
+}
+
+FDisplayClusterConfigParser::~FDisplayClusterConfigParser()
+{
+}
+
+
+bool FDisplayClusterConfigParser::ParseFile(const FString& path)
+{
+	CurrentConfigPath = path;
+	return !CurrentConfigPath.IsEmpty();
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterConfigParserListener
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterConfigParser::AddClusterNode(const FDisplayClusterConfigClusterNode& node)
+{
+	ConfigParserListener->AddClusterNode(node);
+}
+
+void FDisplayClusterConfigParser::AddScreen(const FDisplayClusterConfigScreen& screen)
+{
+	ConfigParserListener->AddScreen(screen);
+}
+
+void FDisplayClusterConfigParser::AddViewport(const FDisplayClusterConfigViewport& viewport)
+{
+	ConfigParserListener->AddViewport(viewport);
+}
+
+void FDisplayClusterConfigParser::AddCamera(const FDisplayClusterConfigCamera& camera)
+{
+	ConfigParserListener->AddCamera(camera);
+}
+
+void FDisplayClusterConfigParser::AddSceneNode(const FDisplayClusterConfigSceneNode& node)
+{
+	ConfigParserListener->AddSceneNode(node);
+}
+
+void FDisplayClusterConfigParser::AddGeneral(const FDisplayClusterConfigGeneral& general)
+{
+	ConfigParserListener->AddGeneral(general);
+}
+
+void FDisplayClusterConfigParser::AddRender(const FDisplayClusterConfigRender& render)
+{
+	ConfigParserListener->AddRender(render);
+}
+
+void FDisplayClusterConfigParser::AddStereo(const FDisplayClusterConfigStereo& stereo)
+{
+	ConfigParserListener->AddStereo(stereo);
+}
+
+void FDisplayClusterConfigParser::AddDebug(const FDisplayClusterConfigDebug& debug)
+{
+	ConfigParserListener->AddDebug(debug);
+}
+
+void FDisplayClusterConfigParser::AddInput(const FDisplayClusterConfigInput& input)
+{
+	ConfigParserListener->AddInput(input);
+}
+
+void FDisplayClusterConfigParser::AddCustom(const FDisplayClusterConfigCustom& custom)
+{
+	ConfigParserListener->AddCustom(custom);
+}
diff --git a/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParser.h b/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParser.h
new file mode 100644
index 0000000000000000000000000000000000000000..85d6af36b2cd54b882baf17c86c5ce88d741997a
--- /dev/null
+++ b/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParser.h
@@ -0,0 +1,44 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "IDisplayClusterConfigParserListener.h"
+#include "Config/DisplayClusterConfigTypes.h"
+
+
+/**
+ * Abstract config parser
+ */
+class FDisplayClusterConfigParser
+	: protected IDisplayClusterConfigParserListener
+{
+public:
+	explicit FDisplayClusterConfigParser(IDisplayClusterConfigParserListener* pListener);
+	virtual ~FDisplayClusterConfigParser() = 0;
+
+public:
+	// Entry point for file parsing
+	virtual bool ParseFile(const FString& path);
+
+protected:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterConfigParserListener
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void AddClusterNode(const FDisplayClusterConfigClusterNode& node) override final;
+	virtual void AddScreen(const FDisplayClusterConfigScreen& screen)         override final;
+	virtual void AddViewport(const FDisplayClusterConfigViewport& viewport)   override final;
+	virtual void AddCamera(const FDisplayClusterConfigCamera& camera)         override final;
+	virtual void AddSceneNode(const FDisplayClusterConfigSceneNode& node)     override final;
+	virtual void AddGeneral(const FDisplayClusterConfigGeneral& general)      override final;
+	virtual void AddRender(const FDisplayClusterConfigRender& render)         override final;
+	virtual void AddStereo(const FDisplayClusterConfigStereo& stereo)         override final;
+	virtual void AddDebug(const FDisplayClusterConfigDebug& debug)            override final;
+	virtual void AddInput(const FDisplayClusterConfigInput& input)            override final;
+	virtual void AddCustom(const FDisplayClusterConfigCustom& custom)         override final;
+
+private:
+	IDisplayClusterConfigParserListener* const ConfigParserListener;
+	FString CurrentConfigPath;
+};
+
diff --git a/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParserDebugAuto.cpp b/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParserDebugAuto.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..7811eb211db899a71304774f0076b966624f7285
--- /dev/null
+++ b/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParserDebugAuto.cpp
@@ -0,0 +1,63 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterConfigParserDebugAuto.h"
+
+#include "DisplayClusterBuildConfig.h"
+#include "DisplayClusterConstants.h"
+#include "DisplayClusterStrings.h"
+#include "Config/DisplayClusterConfigTypes.h"
+
+
+FDisplayClusterConfigParserDebugAuto::FDisplayClusterConfigParserDebugAuto(IDisplayClusterConfigParserListener* pListener) :
+	FDisplayClusterConfigParser(pListener)
+{
+}
+
+bool FDisplayClusterConfigParserDebugAuto::ParseFile(const FString& path)
+{
+#ifdef DISPLAY_CLUSTER_USE_DEBUG_STANDALONE_CONFIG
+	FDisplayClusterConfigClusterNode ClusterNode;
+	ClusterNode.Id         = DisplayClusterStrings::misc::DbgStubNodeId;
+	ClusterNode.IsMaster   = true;
+	ClusterNode.Addr       = TEXT("127.0.0.1");
+	ClusterNode.Port_CS    = 41001;
+	ClusterNode.Port_SS    = 41002;
+	ClusterNode.ScreenId   = TEXT("screen_stub");;
+	ClusterNode.ViewportId = TEXT("viewport_stub");
+	ClusterNode.SoundEnabled = true;
+	ClusterNode.EyeSwap    = false;
+	AddClusterNode(ClusterNode);
+
+	const float PixelDensity = 0.6f / 1920.f;
+
+	FDisplayClusterConfigScreen Screen;
+	Screen.Id   = ClusterNode.ScreenId;
+	Screen.Loc  = FVector(0.7f, 0.f, 0.f);
+	Screen.Rot  = FRotator::ZeroRotator;
+	Screen.Size = FVector2D(PixelDensity * DisplayClusterConstants::misc::DebugAutoResX, PixelDensity * DisplayClusterConstants::misc::DebugAutoResY);
+	AddScreen(Screen);
+
+	FDisplayClusterConfigViewport Viewport;
+	Viewport.Id   = ClusterNode.ViewportId;
+	Viewport.Loc  = FIntPoint(0, 0);
+	Viewport.Size = FIntPoint(DisplayClusterConstants::misc::DebugAutoResX, DisplayClusterConstants::misc::DebugAutoResY);
+	AddViewport(Viewport);
+	
+	FDisplayClusterConfigCamera Camera;
+	Camera.Id  = TEXT("camera_stub");
+	Camera.Loc = FVector::ZeroVector;
+	Camera.Rot = FRotator::ZeroRotator;
+	AddCamera(Camera);
+
+	FDisplayClusterConfigGeneral General;
+	General.SwapSyncPolicy = 1;
+	AddGeneral(General);
+
+	FDisplayClusterConfigStereo Stereo;
+	Stereo.EyeDist = 0.064f;
+	AddStereo(Stereo);
+#endif // DISPLAY_CLUSTER_USE_DEBUG_STANDALONE_CONFIG
+		
+	return true;
+}
+
diff --git a/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParserDebugAuto.h b/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParserDebugAuto.h
new file mode 100644
index 0000000000000000000000000000000000000000..2f9deca5d2c6e67cd25cefe9804eaf34e1b441e4
--- /dev/null
+++ b/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParserDebugAuto.h
@@ -0,0 +1,21 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "DisplayClusterConfigParser.h"
+
+
+/**
+ * Auxiliary config parser. It generates hard-coded config.
+ */
+class FDisplayClusterConfigParserDebugAuto
+	: public FDisplayClusterConfigParser
+{
+public:
+	FDisplayClusterConfigParserDebugAuto(IDisplayClusterConfigParserListener* pListener);
+
+protected:
+	// Entry point for file parsing
+	virtual bool ParseFile(const FString& path) override;
+};
+
diff --git a/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParserText.cpp b/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParserText.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9bfff4eabca01a904801f58212a6e97eb05a1040
--- /dev/null
+++ b/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParserText.cpp
@@ -0,0 +1,98 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterConfigParserText.h"
+#include "Misc/FileHelper.h"
+#include "Misc/Paths.h"
+#include "Misc/DisplayClusterLog.h"
+#include "DisplayClusterStrings.h"
+
+
+FDisplayClusterConfigParserText::FDisplayClusterConfigParserText(IDisplayClusterConfigParserListener* pListener) :
+	FDisplayClusterConfigParser(pListener)
+{
+}
+
+bool FDisplayClusterConfigParserText::ParseFile(const FString& path)
+{
+	// Prepare path
+	FString cfgPath(path);
+	FPaths::NormalizeFilename(cfgPath);
+
+	// Load data
+	UE_LOG(LogDisplayClusterConfig, Log, TEXT("Parsing config file %s"), *cfgPath);
+	if (FPaths::FileExists(cfgPath))
+	{
+		TArray<FString> data;
+		if (FFileHelper::LoadANSITextFileToStrings(*cfgPath, nullptr, data) == true)
+		{
+			// Parse each line from config
+			for (auto line : data)
+			{
+				line.TrimStartAndEndInline();
+				ParseLine(line);
+			}
+
+			// Parsed, complete on base
+			return FDisplayClusterConfigParser::ParseFile(path);
+		}
+	}
+
+	// An error occurred
+	return false;
+}
+
+void FDisplayClusterConfigParserText::ParseLine(const FString& line)
+{
+	if (line.IsEmpty() || line.StartsWith(FString(DisplayClusterStrings::cfg::spec::Comment)))
+	{
+		// Skip this line
+	}
+	else if (line.StartsWith(FString(DisplayClusterStrings::cfg::data::cluster::Header)))
+	{
+		AddClusterNode(impl_parse<FDisplayClusterConfigClusterNode>(line));
+	}
+	else if (line.StartsWith(FString(DisplayClusterStrings::cfg::data::screen::Header)))
+	{
+		AddScreen(impl_parse<FDisplayClusterConfigScreen>(line));
+	}
+	else if (line.StartsWith(FString(DisplayClusterStrings::cfg::data::viewport::Header)))
+	{
+		AddViewport(impl_parse<FDisplayClusterConfigViewport>(line));
+	}
+	else if (line.StartsWith(FString(DisplayClusterStrings::cfg::data::camera::Header)))
+	{
+		AddCamera(impl_parse<FDisplayClusterConfigCamera>(line));
+	}
+	else if (line.StartsWith(FString(DisplayClusterStrings::cfg::data::scene::Header)))
+	{
+		AddSceneNode(impl_parse<FDisplayClusterConfigSceneNode>(line));
+	}
+	else if (line.StartsWith(FString(DisplayClusterStrings::cfg::data::general::Header)))
+	{
+		AddGeneral(impl_parse<FDisplayClusterConfigGeneral>(line));
+	}
+	else if (line.StartsWith(FString(DisplayClusterStrings::cfg::data::render::Header)))
+	{
+		AddRender(impl_parse<FDisplayClusterConfigRender>(line));
+	}
+	else if (line.StartsWith(FString(DisplayClusterStrings::cfg::data::stereo::Header)))
+	{
+		AddStereo(impl_parse<FDisplayClusterConfigStereo>(line));
+	}
+	else if (line.StartsWith(FString(DisplayClusterStrings::cfg::data::debug::Header)))
+	{
+		AddDebug(impl_parse<FDisplayClusterConfigDebug>(line));
+	}
+	else if (line.StartsWith(FString(DisplayClusterStrings::cfg::data::input::Header)))
+	{
+		AddInput(impl_parse<FDisplayClusterConfigInput>(line));
+	}
+	else if (line.StartsWith(FString(DisplayClusterStrings::cfg::data::custom::Header)))
+	{
+		AddCustom(impl_parse<FDisplayClusterConfigCustom>(line));
+	}
+	else
+	{
+		UE_LOG(LogDisplayClusterConfig, Warning, TEXT("Unknown config token [%s]"), *line);
+	}
+}
diff --git a/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParserText.h b/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParserText.h
new file mode 100644
index 0000000000000000000000000000000000000000..2c007261c1b64f6b1cc43daca71a52fb3e280d8f
--- /dev/null
+++ b/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParserText.h
@@ -0,0 +1,37 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "DisplayClusterConfigParser.h"
+#include "Misc/DisplayClusterLog.h"
+
+
+/**
+ * Config parser for text based config files
+ */
+class FDisplayClusterConfigParserText
+	: public FDisplayClusterConfigParser
+{
+public:
+	FDisplayClusterConfigParserText(IDisplayClusterConfigParserListener* pListener);
+
+protected:
+	// Entry point for file parsing
+	virtual bool ParseFile(const FString& path) override;
+
+	// Entry point for line parsing
+	void ParseLine(const FString& line);
+
+protected:
+	// Data type parsing
+	template <typename T>
+	inline T impl_parse(const FString& line)
+	{
+		static_assert(std::is_base_of<FDisplayClusterConfigBase, T>::value, "Only Display Cluster config types allowed");
+		T tmp; bool result = static_cast<FDisplayClusterConfigBase&>(tmp).DeserializeFromString(line);
+		UE_LOG(LogDisplayClusterConfig, Log, TEXT("Deserialization: %s"), result ? TEXT("ok") : TEXT("failed"));
+		return tmp;
+	}
+};
+
diff --git a/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParserXml.cpp b/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParserXml.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..c1b803e79108e732af20b58b2dd5832f769447ee
--- /dev/null
+++ b/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParserXml.cpp
@@ -0,0 +1,13 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterConfigParserXml.h"
+
+
+FDisplayClusterConfigParserXml::FDisplayClusterConfigParserXml(IDisplayClusterConfigParserListener* pListener) :
+	FDisplayClusterConfigParser(pListener)
+{
+}
+
+//bool FDisplayClusterConfigParserXml::ReadConfigFile(const FString& path)
+//{
+//}
diff --git a/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParserXml.h b/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParserXml.h
new file mode 100644
index 0000000000000000000000000000000000000000..59973f3850bbecd676c07df3ce592b5861b48cc9
--- /dev/null
+++ b/Source/DisplayCluster/Private/Config/Parser/DisplayClusterConfigParserXml.h
@@ -0,0 +1,28 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "DisplayClusterConfigParser.h"
+
+
+/**
+ * Config parser for XML based config files
+ */
+class FDisplayClusterConfigParserXml
+	: public FDisplayClusterConfigParser
+{
+public:
+	FDisplayClusterConfigParserXml(IDisplayClusterConfigParserListener* pListener);
+
+public:
+	// Entry point for file parsing
+	virtual bool ParseFile(const FString& path) override
+	{
+		// Not implemented yet
+		return false;
+	}
+
+protected:
+	//virtual bool ReadConfigFile(const FString& path);
+};
+
diff --git a/Source/DisplayCluster/Private/Config/Parser/IDisplayClusterConfigParserListener.h b/Source/DisplayCluster/Private/Config/Parser/IDisplayClusterConfigParserListener.h
new file mode 100644
index 0000000000000000000000000000000000000000..64bc03056542e87967c4fcfcebe1e6239ca56d9c
--- /dev/null
+++ b/Source/DisplayCluster/Private/Config/Parser/IDisplayClusterConfigParserListener.h
@@ -0,0 +1,28 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Config/DisplayClusterConfigTypes.h"
+
+
+/**
+ * Interface for parser listener. Notifies about entities found in a config file.
+ */
+struct IDisplayClusterConfigParserListener
+{
+public:
+	virtual ~IDisplayClusterConfigParserListener()
+	{ }
+
+	virtual void AddClusterNode(const FDisplayClusterConfigClusterNode& cnode) = 0;
+	virtual void AddScreen(const FDisplayClusterConfigScreen& screen) = 0;
+	virtual void AddViewport(const FDisplayClusterConfigViewport& viewport) = 0;
+	virtual void AddCamera(const FDisplayClusterConfigCamera& camera) = 0;
+	virtual void AddSceneNode(const FDisplayClusterConfigSceneNode& snode) = 0;
+	virtual void AddGeneral(const FDisplayClusterConfigGeneral& general) = 0;
+	virtual void AddRender(const FDisplayClusterConfigRender& render) = 0;
+	virtual void AddStereo(const FDisplayClusterConfigStereo& stereo) = 0;
+	virtual void AddDebug(const FDisplayClusterConfigDebug& debug) = 0;
+	virtual void AddInput(const FDisplayClusterConfigInput& input) = 0;
+	virtual void AddCustom(const FDisplayClusterConfigCustom& custom) = 0;
+};
diff --git a/Source/DisplayCluster/Private/DisplayClusterBuildConfig.h b/Source/DisplayCluster/Private/DisplayClusterBuildConfig.h
new file mode 100644
index 0000000000000000000000000000000000000000..183968b93405a9c80b57b85b66cd45c7a82dc6e4
--- /dev/null
+++ b/Source/DisplayCluster/Private/DisplayClusterBuildConfig.h
@@ -0,0 +1,13 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+// Enables automatic ID resolve by host address. This feature
+// can be used only with single DisplayCluster instance per PC.
+#define DISPLAY_CLUSTER_USE_AUTOMATIC_NODE_ID_RESOLVE
+
+// Allows to run game with stereo in easy way. You don't have
+// to have a config file and a lot of command line arguments.
+// Simple argument list would be:
+// -dc_cluster -dc_cfg=? -quad_buffer_stereo -opengl4
+#define DISPLAY_CLUSTER_USE_DEBUG_STANDALONE_CONFIG
diff --git a/Source/DisplayCluster/Private/DisplayClusterConstants.h b/Source/DisplayCluster/Private/DisplayClusterConstants.h
new file mode 100644
index 0000000000000000000000000000000000000000..abc132245985dec89e99e8dc110b0b55546a9b66
--- /dev/null
+++ b/Source/DisplayCluster/Private/DisplayClusterConstants.h
@@ -0,0 +1,30 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "DisplayClusterBuildConfig.h"
+
+
+namespace DisplayClusterConstants
+{
+	namespace net
+	{
+		static constexpr int32  ClientConnectTriesAmount    = 100;   // times
+		static constexpr float  ClientConnectRetryDelay     = 1.0f; // sec
+		static constexpr uint32 BarrierGameStartWaitTimeout = 80000; // ms
+		static constexpr uint32 BarrierWaitTimeout          = 10000; // ms
+		static constexpr int32  SocketBufferSize            = INT16_MAX; // bytes
+		static constexpr int32  MessageBufferSize           = INT16_MAX; // bytes
+	};
+
+	namespace misc
+	{
+#ifdef DISPLAY_CLUSTER_USE_DEBUG_STANDALONE_CONFIG
+		static constexpr int32 DebugAutoWinX = 0;
+		static constexpr int32 DebugAutoWinY = 0;
+		static constexpr int32 DebugAutoResX = 1920;
+		static constexpr int32 DebugAutoResY = 1080;
+#endif
+	}
+};
diff --git a/Source/DisplayCluster/Private/DisplayClusterGlobals.cpp b/Source/DisplayCluster/Private/DisplayClusterGlobals.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..f46eb28c7ce1b465abd204cd6c8ffb86a0188869
--- /dev/null
+++ b/Source/DisplayCluster/Private/DisplayClusterGlobals.cpp
@@ -0,0 +1,7 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterGlobals.h"
+
+
+IPDisplayCluster* GDisplayCluster = nullptr;
+
diff --git a/Source/DisplayCluster/Private/DisplayClusterGlobals.h b/Source/DisplayCluster/Private/DisplayClusterGlobals.h
new file mode 100644
index 0000000000000000000000000000000000000000..d51408454930d39917c012be0ec70c5561aa0c45
--- /dev/null
+++ b/Source/DisplayCluster/Private/DisplayClusterGlobals.h
@@ -0,0 +1,9 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+struct IPDisplayCluster;
+
+
+// Internal global DisplayCluster module interface
+extern IPDisplayCluster* GDisplayCluster;
diff --git a/Source/DisplayCluster/Private/DisplayClusterModule.cpp b/Source/DisplayCluster/Private/DisplayClusterModule.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d830116d503e9ca91865107015d618d0d02b6683
--- /dev/null
+++ b/Source/DisplayCluster/Private/DisplayClusterModule.cpp
@@ -0,0 +1,204 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterModule.h"
+
+#include "Cluster/DisplayClusterClusterManager.h"
+#include "Config/DisplayClusterConfigManager.h"
+#include "Game/DisplayClusterGameManager.h"
+#include "Input/DisplayClusterInputManager.h"
+#include "Render/DisplayClusterRenderManager.h"
+
+#include "Misc/DisplayClusterLog.h"
+
+#include "DisplayClusterGlobals.h"
+
+
+FDisplayClusterModule::FDisplayClusterModule()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterModule);
+
+	GDisplayCluster = this;
+}
+
+FDisplayClusterModule::~FDisplayClusterModule()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterModule);
+
+#if 1
+	GDisplayCluster = nullptr;
+#else
+	// WORKAROUND
+	// UE4 does something like that:
+	// 1. inst1 = new FDisplayClusterModule
+	// 2. inst2 = new FDisplayClusterModule
+	// 3. delete inst1
+	// To store valid pointer (inst2) I need the check below.
+	if (GDisplayCluster == this)
+	{
+		GDisplayCluster = nullptr;
+	}
+#endif
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IModuleInterface
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterModule::StartupModule()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterModule);
+
+	UE_LOG(LogDisplayClusterModule, Log, TEXT("DisplayCluster module has been started"));
+}
+
+void FDisplayClusterModule::ShutdownModule()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterModule);
+
+	// Clean everything before .dtor call
+	Release();
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IPDisplayCluster
+//////////////////////////////////////////////////////////////////////////////////////////////
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IPDisplayClusterManager
+//////////////////////////////////////////////////////////////////////////////////////////////
+bool FDisplayClusterModule::Init(EDisplayClusterOperationMode OperationMode)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterModule);
+
+	UE_LOG(LogDisplayClusterModule, Log, TEXT("Instantiating subsystem managers..."));
+
+	CurrentOperationMode = OperationMode;
+
+	// Initialize internals (the order is important)
+	Managers.Add(MgrConfig  = new FDisplayClusterConfigManager);
+	Managers.Add(MgrRender  = new FDisplayClusterRenderManager);
+	Managers.Add(MgrCluster = new FDisplayClusterClusterManager);
+	Managers.Add(MgrInput   = new FDisplayClusterInputManager);
+	Managers.Add(MgrGame    = new FDisplayClusterGameManager);
+
+	UE_LOG(LogDisplayClusterModule, Log, TEXT("Initializing subsystems to %s operation mode"), *FDisplayClusterTypesConverter::ToString(CurrentOperationMode));
+
+	bool result = true;
+	auto it = Managers.CreateIterator();
+	while (result && it)
+	{
+		result = result && (*it)->Init(CurrentOperationMode);
+		++it;
+	}
+
+	if (!result)
+	{
+		UE_LOG(LogDisplayClusterModule, Error, TEXT("An error occurred during internal initialization"));
+	}
+
+	// Set internal initialization flag
+	bIsModuleInitialized = result;
+
+	return result;
+}
+
+void FDisplayClusterModule::Release()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterModule);
+
+	UE_LOG(LogDisplayClusterModule, Log, TEXT("Cleaning up internals..."));
+
+	for (auto pMgr : Managers)
+	{
+		pMgr->Release();
+		delete pMgr;
+	}
+
+	Managers.Empty();
+}
+
+bool FDisplayClusterModule::StartSession(const FString& configPath, const FString& nodeId)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterModule);
+
+	UE_LOG(LogDisplayClusterModule, Log, TEXT("StartSession: config path is %s"), *configPath);
+
+	bool result = true;
+	auto it = Managers.CreateIterator();
+	while (result && it)
+	{
+		result = result && (*it)->StartSession(configPath, nodeId);
+		++it;
+	}
+
+	if (!result)
+	{
+		UE_LOG(LogDisplayClusterModule, Error, TEXT("An error occurred during session start"));
+	}
+
+	return result;
+}
+
+void FDisplayClusterModule::EndSession()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterModule);
+
+	UE_LOG(LogDisplayClusterModule, Log, TEXT("Stopping DisplayCluster session..."));
+
+	for (auto pMgr : Managers)
+	{
+		pMgr->EndSession();
+	}
+}
+
+bool FDisplayClusterModule::StartScene(UWorld* pWorld)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterModule);
+
+	UE_LOG(LogDisplayClusterModule, Log, TEXT("Starting game..."));
+
+	check(pWorld);
+
+	bool result = true;
+	auto it = Managers.CreateIterator();
+	while (result && it)
+	{
+		result = result && (*it)->StartScene(pWorld);
+		++it;
+	}
+
+	if (!result)
+	{
+		UE_LOG(LogDisplayClusterModule, Error, TEXT("An error occurred during game (level) start"));
+	}
+
+	return result;
+}
+
+void FDisplayClusterModule::EndScene()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterModule);
+
+	UE_LOG(LogDisplayClusterModule, Log, TEXT("Stopping game..."));
+
+	for (auto pMgr : Managers)
+	{
+		pMgr->EndScene();
+	}
+}
+
+void FDisplayClusterModule::PreTick(float DeltaSeconds)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterModule);
+
+	UE_LOG(LogDisplayClusterModule, Verbose, TEXT("PreTick: delta time - %f"), DeltaSeconds);
+
+	for (auto pMgr : Managers)
+	{
+		pMgr->PreTick(DeltaSeconds);
+	}
+}
+
+IMPLEMENT_MODULE(FDisplayClusterModule, DisplayCluster)
diff --git a/Source/DisplayCluster/Private/DisplayClusterModule.h b/Source/DisplayCluster/Private/DisplayClusterModule.h
new file mode 100644
index 0000000000000000000000000000000000000000..078bbe4db19fa4ebbd941922996d7b621e85cf11
--- /dev/null
+++ b/Source/DisplayCluster/Private/DisplayClusterModule.h
@@ -0,0 +1,93 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "IPDisplayCluster.h"
+
+#include "Cluster/IPDisplayClusterClusterManager.h"
+#include "Config/IPDisplayClusterConfigManager.h"
+#include "Game/IPDisplayClusterGameManager.h"
+#include "Input/IPDisplayClusterInputManager.h"
+#include "Render/IPDisplayClusterRenderManager.h"
+
+
+/**
+ * Display Cluster module implementation
+ */
+class FDisplayClusterModule :
+	public  IPDisplayCluster
+{
+public:
+	FDisplayClusterModule();
+	virtual ~FDisplayClusterModule();
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayCluster
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool IsModuleInitialized() const override
+	{ return bIsModuleInitialized; }
+	
+	virtual EDisplayClusterOperationMode GetOperationMode() const override
+	{ return CurrentOperationMode; }
+
+	virtual IDisplayClusterRenderManager*    GetRenderMgr()    const override { return MgrRender; }
+	virtual IDisplayClusterClusterManager*   GetClusterMgr()   const override { return MgrCluster; }
+	virtual IDisplayClusterInputManager*     GetInputMgr()     const override { return MgrInput; }
+	virtual IDisplayClusterConfigManager*    GetConfigMgr()    const override { return MgrConfig; }
+	virtual IDisplayClusterGameManager*      GetGameMgr()      const override { return MgrGame; }
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayCluster
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual IPDisplayClusterRenderManager*    GetPrivateRenderMgr()    const override { return MgrRender; }
+	virtual IPDisplayClusterClusterManager*   GetPrivateClusterMgr()   const override { return MgrCluster; }
+	virtual IPDisplayClusterInputManager*     GetPrivateInputMgr()     const override { return MgrInput; }
+	virtual IPDisplayClusterConfigManager*    GetPrivateConfigMgr()    const override { return MgrConfig; }
+	virtual IPDisplayClusterGameManager*      GetPrivateGameMgr()      const override { return MgrGame; }
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterManager
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool Init(EDisplayClusterOperationMode OperationMode) override;
+	virtual void Release() override;
+	virtual bool StartSession(const FString& configPath, const FString& nodeId) override;
+	virtual void EndSession() override;
+	virtual bool StartScene(UWorld* pWorld) override;
+	virtual void EndScene() override;
+	virtual void PreTick(float DeltaSeconds) override;
+
+private:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IModuleInterface
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void StartupModule() override;
+	virtual void ShutdownModule() override;
+#if 0
+	virtual void PreUnloadCallback() override;
+	virtual void PostLoadCallback() override;
+	virtual bool SupportsDynamicReloading() override;
+	virtual bool SupportsAutomaticShutdown() override;
+	virtual bool IsGameModule() const override;
+#endif
+
+private:
+	// Is module initialized.
+	// This flag is not the same as EDisplayClusterOperationMode::Disabled which is used when we turn off the DC functionality in a game mode.
+	bool bIsModuleInitialized = false;
+
+	// DisplayCluster subsystems
+	IPDisplayClusterClusterManager*   MgrCluster   = nullptr;
+	IPDisplayClusterRenderManager*    MgrRender    = nullptr;
+	IPDisplayClusterInputManager*     MgrInput     = nullptr;
+	IPDisplayClusterConfigManager*    MgrConfig    = nullptr;
+	IPDisplayClusterGameManager*      MgrGame      = nullptr;
+	
+	// Array of available managers
+	TArray<IPDisplayClusterManager*> Managers;
+
+	// Runtime
+	EDisplayClusterOperationMode CurrentOperationMode = EDisplayClusterOperationMode::Disabled;
+};
diff --git a/Source/DisplayCluster/Private/DisplayClusterStrings.h b/Source/DisplayCluster/Private/DisplayClusterStrings.h
new file mode 100644
index 0000000000000000000000000000000000000000..be698ed866273850fa6d61a5d61ac8ada1927b8f
--- /dev/null
+++ b/Source/DisplayCluster/Private/DisplayClusterStrings.h
@@ -0,0 +1,190 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "DisplayClusterBuildConfig.h"
+
+
+namespace DisplayClusterStrings
+{
+	// Common strings
+	static constexpr auto strKeyValSeparator = TEXT("=");
+
+	// Command line arguments
+	namespace args
+	{
+		static constexpr auto Cluster    = TEXT("dc_cluster");
+		static constexpr auto Standalone = TEXT("dc_standalone");
+		static constexpr auto Node       = TEXT("dc_node");
+		static constexpr auto Config     = TEXT("dc_cfg");
+		static constexpr auto Camera     = TEXT("dc_camera");
+
+		// Stereo device types (command line values)
+		namespace dev
+		{
+			static constexpr auto Debug = TEXT("dc_dev_debug");
+			static constexpr auto QBS   = TEXT("quad_buffer_stereo");
+			static constexpr auto TB    = TEXT("dc_dev_top_bottom");
+			static constexpr auto SbS   = TEXT("dc_dev_side_by_side");
+			static constexpr auto Mono  = TEXT("dc_dev_mono");
+		}
+	}
+
+	namespace cfg
+	{
+		// Config file extensions
+		namespace file
+		{
+			static constexpr auto FileExtCfg1 = TEXT("cfg");
+			static constexpr auto FileExtCfg2 = TEXT("conf");
+			static constexpr auto FileExtCfg3 = TEXT("config");
+			static constexpr auto FileExtTxt  = TEXT("txt");
+			static constexpr auto FileExtXml  = TEXT("xml");
+		}
+
+		// Config special constants
+		namespace spec
+		{
+			static constexpr auto Comment          = TEXT("#");
+			static constexpr auto KeyValSeparator  = TEXT("=");
+			static constexpr auto ValTrue          = TEXT("true");
+			static constexpr auto ValFalse         = TEXT("false");
+			static constexpr auto MappingDelimiter = TEXT(",");
+		}
+
+		// Config data tokens
+		namespace data
+		{
+			static constexpr auto Id       = TEXT("id");
+			static constexpr auto ParentId = TEXT("parent");
+			static constexpr auto Loc      = TEXT("loc");
+			static constexpr auto Rot      = TEXT("rot");
+
+			// Cluster tokens
+			namespace cluster
+			{
+				static constexpr auto Header   = TEXT("[cluster_node]");
+				static constexpr auto Addr     = TEXT("addr");
+				static constexpr auto Screen   = TEXT("screen");
+				static constexpr auto Viewport = TEXT("viewport");
+				static constexpr auto PortCS   = TEXT("port_cs");
+				static constexpr auto PortSS   = TEXT("port_ss");
+				static constexpr auto Master   = TEXT("master");
+				static constexpr auto Sound    = TEXT("sound");
+				static constexpr auto EyeSwap  = TEXT("eye_swap");
+				// + Id
+			}
+
+			// Screen tokens
+			namespace screen
+			{
+				static constexpr auto Header = TEXT("[screen]");
+				static constexpr auto Size   = TEXT("size");
+				// + Id, Parent, Loc, Rot
+			}
+
+			// Viewport tokens
+			namespace viewport
+			{
+				static constexpr auto Header = TEXT("[viewport]");
+				static constexpr auto PosX   = TEXT("x");
+				static constexpr auto PosY   = TEXT("y");
+				static constexpr auto Width  = TEXT("width");
+				static constexpr auto Height = TEXT("height");
+				// + Id
+			}
+
+			// Camera tokens
+			namespace camera
+			{
+				static constexpr auto Header = TEXT("[camera]");
+				// + Id, Loc, Rot, Parent
+			}
+
+			// Scene node (transforms)
+			namespace scene
+			{
+				static constexpr auto Header    = TEXT("[scene_node]");
+				static constexpr auto TrackerId = TEXT("tracker_id");
+				static constexpr auto TrackerCh = TEXT("tracker_ch");
+				// + Id, Loc, Rot, Parent
+			}
+
+			// Input tokens
+			namespace input
+			{
+				static constexpr auto Header   = TEXT("[input]");
+				static constexpr auto Type     = TEXT("type");
+				static constexpr auto Address  = TEXT("addr");
+				static constexpr auto Remap    = TEXT("remap");
+				// + Id
+
+				static constexpr auto Right = TEXT("right");
+				static constexpr auto Front = TEXT("front");
+				static constexpr auto Up    = TEXT("up");
+
+				static constexpr auto MapX  = TEXT("x");
+				static constexpr auto MapNX = TEXT("-x");
+				static constexpr auto MapY  = TEXT("y");
+				static constexpr auto MapNY = TEXT("-y");
+				static constexpr auto MapZ  = TEXT("z");
+				static constexpr auto MapNZ = TEXT("-z");
+
+				static constexpr auto DeviceTracker = TEXT("tracker");
+				static constexpr auto DeviceAnalog  = TEXT("analog");
+				static constexpr auto DeviceButtons = TEXT("buttons");
+			}
+
+			// General settings tokens
+			namespace general
+			{
+				static constexpr auto Header            = TEXT("[general]");
+				static constexpr auto SwapSyncPolicy    = TEXT("swap_sync_policy");
+			}
+
+			// Stereo tokens
+			namespace stereo
+			{
+				static constexpr auto Header  = TEXT("[stereo]");
+				static constexpr auto EyeDist = TEXT("eye_dist");
+			}
+
+			// Render tokens
+			namespace render
+			{
+				static constexpr auto Header          = TEXT("[render]");
+			}
+
+			// Debug tokens
+			namespace debug
+			{
+				static constexpr auto Header    = TEXT("[debug]");
+				static constexpr auto LagSim    = TEXT("lag_simulation");
+				static constexpr auto LagTime   = TEXT("lag_max_time");
+				static constexpr auto DrawStats = TEXT("draw_stats");
+			}
+
+			// Custom arguments
+			namespace custom
+			{
+				static constexpr auto Header     = TEXT("[custom]");
+			}
+		}
+	};
+
+	namespace rhi
+	{
+		static constexpr auto OpenGL = TEXT("OpenGL");
+		static constexpr auto D3D11  = TEXT("D3D11");
+		static constexpr auto D3D12  = TEXT("D3D12");
+	}
+
+	namespace misc
+	{
+#ifdef DISPLAY_CLUSTER_USE_DEBUG_STANDALONE_CONFIG
+		static constexpr auto DbgStubConfig = TEXT("?");
+		static constexpr auto DbgStubNodeId    = TEXT("node_stub");
+#endif
+	}
+};
diff --git a/Source/DisplayCluster/Private/Game/Classes/Basics/DisplayClusterGameEngine.cpp b/Source/DisplayCluster/Private/Game/Classes/Basics/DisplayClusterGameEngine.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..58e1ae38d84c88d799e2f2e1d22bf4513b68bbc9
--- /dev/null
+++ b/Source/DisplayCluster/Private/Game/Classes/Basics/DisplayClusterGameEngine.cpp
@@ -0,0 +1,236 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterGameEngine.h"
+
+#include "Cluster/IPDisplayClusterClusterManager.h"
+#include "Cluster/Controller/IPDisplayClusterNodeController.h"
+#include "Config/IPDisplayClusterConfigManager.h"
+#include "Input/IPDisplayClusterInputManager.h"
+
+#include "Misc/App.h"
+#include "Misc/CommandLine.h"
+#include "Misc/DisplayClusterAppExit.h"
+#include "Misc/DisplayClusterHelpers.h"
+#include "Misc/DisplayClusterLog.h"
+#include "Misc/Parse.h"
+#include "DisplayClusterBuildConfig.h"
+#include "DisplayClusterGlobals.h"
+#include "IPDisplayCluster.h"
+
+
+void UDisplayClusterGameEngine::Init(class IEngineLoop* InEngineLoop)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterEngine);
+
+	// Detect requested operation mode
+	OperationMode = DetectOperationMode();
+
+	// Initialize Display Cluster
+	if (!GDisplayCluster->Init(OperationMode))
+	{
+		FDisplayClusterAppExit::ExitApplication(FDisplayClusterAppExit::ExitType::KillImmediately, FString("Couldn't initialize DisplayCluster module"));
+	}
+
+	FString cfgPath;
+	FString nodeId;
+
+	if (OperationMode == EDisplayClusterOperationMode::Cluster)
+	{
+		// Extract config path from command line
+		if (!FParse::Value(FCommandLine::Get(), DisplayClusterStrings::args::Config, cfgPath))
+		{
+			UE_LOG(LogDisplayClusterEngine, Error, TEXT("No config file specified"));
+			FDisplayClusterAppExit::ExitApplication(FDisplayClusterAppExit::ExitType::KillImmediately, FString("Cluster mode requires config file"));
+		}
+
+		// Extract node ID from command line
+		if (!FParse::Value(FCommandLine::Get(), DisplayClusterStrings::args::Node, nodeId))
+		{
+#ifdef DISPLAY_CLUSTER_USE_AUTOMATIC_NODE_ID_RESOLVE
+			UE_LOG(LogDisplayClusterEngine, Log, TEXT("Node ID is not specified"));
+#else
+			UE_LOG(LogDisplayClusterEngine, Warning, TEXT("Node ID is not specified"));
+			FDisplayClusterAppExit::ExitApplication(FDisplayClusterAppExit::ExitType::KillImmediately, FString("Cluster mode requires node ID"));
+#endif
+		}
+	}
+	else if (OperationMode == EDisplayClusterOperationMode::Standalone)
+	{
+#ifdef DISPLAY_CLUSTER_USE_DEBUG_STANDALONE_CONFIG
+		// Save config path from command line
+		cfgPath = DisplayClusterStrings::misc::DbgStubConfig;
+		nodeId  = DisplayClusterStrings::misc::DbgStubNodeId;
+#endif
+	}
+
+	if (OperationMode == EDisplayClusterOperationMode::Cluster ||
+		OperationMode == EDisplayClusterOperationMode::Standalone)
+	{
+		DisplayClusterHelpers::str::DustCommandLineValue(cfgPath);
+		DisplayClusterHelpers::str::DustCommandLineValue(nodeId);
+
+		// Start game session
+		if (!GDisplayCluster->StartSession(cfgPath, nodeId))
+		{
+			FDisplayClusterAppExit::ExitApplication(FDisplayClusterAppExit::ExitType::KillImmediately, FString("Couldn't start DisplayCluster session"));
+		}
+
+		// Initialize internals
+		InitializeInternals();
+	}
+
+	// Initialize base stuff.
+	UGameEngine::Init(InEngineLoop);
+}
+
+EDisplayClusterOperationMode UDisplayClusterGameEngine::DetectOperationMode()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterEngine);
+
+	EDisplayClusterOperationMode OpMode = EDisplayClusterOperationMode::Disabled;
+	if (FParse::Param(FCommandLine::Get(), DisplayClusterStrings::args::Cluster))
+	{
+		OpMode = EDisplayClusterOperationMode::Cluster;
+	}
+	else if (FParse::Param(FCommandLine::Get(), DisplayClusterStrings::args::Standalone))
+	{
+		OpMode = EDisplayClusterOperationMode::Standalone;
+	}
+
+	UE_LOG(LogDisplayClusterEngine, Log, TEXT("Detected operation mode: %s"), *FDisplayClusterTypesConverter::ToString(OpMode));
+
+	return OpMode;
+}
+
+bool UDisplayClusterGameEngine::InitializeInternals()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterEngine);
+
+	// Store debug settings locally
+	CfgDebug = GDisplayCluster->GetPrivateConfigMgr()->GetConfigDebug();
+	
+	InputMgr       = GDisplayCluster->GetPrivateInputMgr();
+	ClusterMgr     = GDisplayCluster->GetPrivateClusterMgr();
+	NodeController = ClusterMgr->GetController();
+
+	FDisplayClusterConfigClusterNode nodeCfg;
+	if (GDisplayCluster->GetPrivateConfigMgr()->GetLocalClusterNode(nodeCfg))
+	{
+		UE_LOG(LogDisplayClusterEngine, Log, TEXT("Configuring sound enabled: %s"), *FDisplayClusterTypesConverter::ToString(nodeCfg.SoundEnabled));
+		bUseSound = nodeCfg.SoundEnabled;
+	}
+
+	check(ClusterMgr);
+	check(InputMgr);
+		
+	return true;
+}
+
+void UDisplayClusterGameEngine::PreExit()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterEngine);
+
+	if (OperationMode == EDisplayClusterOperationMode::Cluster ||
+		OperationMode == EDisplayClusterOperationMode::Standalone)
+	{
+		// Close current DisplayCluster session
+		GDisplayCluster->EndSession();
+	}
+
+	// Release the engine
+	UGameEngine::PreExit();
+}
+
+bool UDisplayClusterGameEngine::LoadMap(FWorldContext& WorldContext, FURL URL, class UPendingNetGame* Pending, FString& Error)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterEngine);
+
+	// Perform map loading
+	if (!Super::LoadMap(WorldContext, URL, Pending, Error))
+	{
+		return false;
+	}
+
+	if (OperationMode == EDisplayClusterOperationMode::Cluster ||
+		OperationMode == EDisplayClusterOperationMode::Standalone)
+	{
+		// Game start barrier
+		NodeController->WaitForGameStart();
+	}
+
+	return true;
+}
+
+void UDisplayClusterGameEngine::Tick(float DeltaSeconds, bool bIdleMode)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterEngine);
+
+	if (OperationMode == EDisplayClusterOperationMode::Cluster ||
+		OperationMode == EDisplayClusterOperationMode::Standalone)
+	{
+		FTimecode Timecode;
+		FFrameRate FrameRate;
+
+		// Update input device state (master only)
+		InputMgr->Update();
+
+		// Update delta time. Cluster slaves will get this value from the master few steps later
+		ClusterMgr->SetDeltaTime(DeltaSeconds);
+
+		//////////////////////////////////////////////////////////////////////////////////////////////
+		// Frame start barrier
+		NodeController->WaitForFrameStart();
+		UE_LOG(LogDisplayClusterEngine, Verbose, TEXT("Sync frame start"));
+
+		// Get DisplayCluster time delta
+		NodeController->GetDeltaTime(DeltaSeconds);
+		NodeController->GetTimecode(Timecode, FrameRate);
+		UE_LOG(LogDisplayClusterEngine, Verbose, TEXT("DisplayCluster delta time (seconds): %f"), DeltaSeconds);
+		UE_LOG(LogDisplayClusterEngine, Verbose, TEXT("DisplayCluster Timecode: %s | %s"), *Timecode.ToString(), *FrameRate.ToPrettyText().ToString());
+
+		// Update delta time in the application
+		FApp::SetDeltaTime(DeltaSeconds);
+		FApp::SetTimecodeAndFrameRate(Timecode, FrameRate);
+
+		// Update input state in the cluster
+		ClusterMgr->SyncInput();
+
+		// Perform PreTick for DisplayCluster module
+		UE_LOG(LogDisplayClusterEngine, Verbose, TEXT("Perform PreTick()"));
+		GDisplayCluster->PreTick(DeltaSeconds);
+
+		// Perform Tick() calls for scene actors
+		UE_LOG(LogDisplayClusterEngine, Verbose, TEXT("Perform Tick()"));
+		Super::Tick(DeltaSeconds, bIdleMode);
+
+		if (CfgDebug.LagSimulateEnabled)
+		{
+			const float lag = CfgDebug.LagMaxTime;
+			UE_LOG(LogDisplayClusterEngine, Log, TEXT("Simulating lag: %f seconds"), lag);
+#if 1
+			FPlatformProcess::Sleep(FMath::RandRange(0.f, lag));
+#else
+			FPlatformProcess::Sleep(lag);
+#endif
+		}
+
+#if 0
+		//////////////////////////////////////////////////////////////////////////////////////////////
+		// Tick end barrier
+		NodeController->WaitForTickEnd();
+#endif
+
+		//////////////////////////////////////////////////////////////////////////////////////////////
+		// Frame end barrier
+		NodeController->WaitForFrameEnd();
+		UE_LOG(LogDisplayClusterEngine, Verbose, TEXT("Sync frame end"));
+
+		// Sync cluster objects
+		ClusterMgr->SyncObjects();
+	}
+	else
+	{
+		Super::Tick(DeltaSeconds, bIdleMode);
+	}
+}
+
diff --git a/Source/DisplayCluster/Private/Game/Classes/Basics/DisplayClusterGameMode.cpp b/Source/DisplayCluster/Private/Game/Classes/Basics/DisplayClusterGameMode.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4717aa7fa031c910b11792bd4bf1c394b41332a3
--- /dev/null
+++ b/Source/DisplayCluster/Private/Game/Classes/Basics/DisplayClusterGameMode.cpp
@@ -0,0 +1,217 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterGameMode.h"
+
+#include "Game/IPDisplayClusterGameManager.h"
+#include "Input/IPDisplayClusterInputManager.h"
+
+#include "Misc/DisplayClusterAppExit.h"
+#include "Misc/DisplayClusterLog.h"
+#include "Misc/DisplayClusterHelpers.h"
+#include "Misc/Paths.h"
+
+#include "DisplayClusterPawn.h"
+#include "DisplayClusterSettings.h"
+
+#include "DisplayClusterStrings.h"
+#include "DisplayClusterPlayerController.h"
+#include "DisplayClusterHUD.h"
+#include "DisplayClusterGlobals.h"
+#include "IPDisplayCluster.h"
+
+
+#if WITH_EDITOR
+bool ADisplayClusterGameMode::bNeedSessionStart = true;
+bool ADisplayClusterGameMode::bSessionStarted = false;
+#endif
+
+
+ADisplayClusterGameMode::ADisplayClusterGameMode() :
+	Super()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	if (!bIsDisplayClusterActive)
+	{
+		return;
+	}
+	
+	DefaultPawnClass = ADisplayClusterPawn::StaticClass();
+	PlayerControllerClass = ADisplayClusterPlayerController::StaticClass();
+	HUDClass = ADisplayClusterHUD::StaticClass();
+}
+
+ADisplayClusterGameMode::~ADisplayClusterGameMode()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+}
+
+void ADisplayClusterGameMode::InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	Super::InitGame(MapName, Options, ErrorMessage);
+
+	if (!GDisplayCluster->IsModuleInitialized())
+	{
+		return;
+	}
+
+	UE_LOG(LogDisplayClusterGame, Log, TEXT("%s"), bIsDisplayClusterActive ?
+		TEXT("DisplayCluster feature is active for this world.") : 
+		TEXT("DisplayCluster feature has been deactivated for this world by game mode."));
+
+	if (!bIsDisplayClusterActive)
+	{
+		return;
+	}
+
+#if WITH_EDITOR
+	if (GIsEditor && ADisplayClusterGameMode::bNeedSessionStart)
+	{
+		// Look for DisplayClusterSettings actor
+		TArray<ADisplayClusterSettings*> Settings;
+		DisplayClusterHelpers::game::FindAllActors(GetWorld(), Settings);
+
+		FString NodeId;
+		FString ConfigPath;
+
+		// Extract user settings
+		if (Settings.Num() > 0)
+		{
+			NodeId     = Settings[0]->EditorNodeId;
+			ConfigPath = Settings[0]->EditorConfigPath;
+		}
+		else
+		{ 
+			UE_LOG(LogDisplayClusterGame, Warning, TEXT("No DisplayCluster settings found. Using defaults."));
+			
+			NodeId     = DisplayClusterStrings::misc::DbgStubNodeId;
+			ConfigPath = DisplayClusterStrings::misc::DbgStubConfig;
+		}
+
+		DisplayClusterHelpers::str::DustCommandLineValue(ConfigPath);
+		DisplayClusterHelpers::str::DustCommandLineValue(NodeId);
+
+		// Check if config path is relative. In this case we have to build an absolute path from a project directory.
+		if (FPaths::IsRelative(ConfigPath))
+		{
+			UE_LOG(LogDisplayClusterGame, Log, TEXT("Relative path detected. Generating absolute path..."));
+			ConfigPath = FPaths::Combine(FPaths::ProjectDir(), ConfigPath);
+			ConfigPath = FPaths::ConvertRelativePathToFull(ConfigPath);
+			UE_LOG(LogDisplayClusterGame, Log, TEXT("Absolute path: %s"), *ConfigPath);
+		}
+
+		ADisplayClusterGameMode::bSessionStarted = GDisplayCluster->StartSession(ConfigPath, NodeId);
+		if (!ADisplayClusterGameMode::bSessionStarted)
+		{
+			UE_LOG(LogDisplayClusterGame, Error, TEXT("Couldn't start DisplayCluster session"));
+			FDisplayClusterAppExit::ExitApplication(FDisplayClusterAppExit::ExitType::NormalSoft, FString("Couldn't start DisplayCluster session"));
+		}
+
+		// Subscribe to EndPIE event to close the DisplayCluster session
+		EndPIEDelegate = FEditorDelegates::EndPIE.AddUObject(this, &ADisplayClusterGameMode::OnEndPIE);
+
+		// Don't start DisplayCluster session again after LoadLevel
+		ADisplayClusterGameMode::bNeedSessionStart = false;
+	}
+#endif
+}
+
+void ADisplayClusterGameMode::StartPlay()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	if (GDisplayCluster->IsModuleInitialized() && bIsDisplayClusterActive)
+	{
+		IPDisplayClusterGameManager* const pGameMgr = GDisplayCluster->GetPrivateGameMgr();
+		if (pGameMgr)
+		{
+			// Set current DisplayClusterGameMode
+			pGameMgr->SetDisplayClusterGameMode(this);
+
+			TArray<ADisplayClusterSettings*> Settings;
+			DisplayClusterHelpers::game::FindAllActors(GetWorld(), Settings);
+
+			// Set current DisplayCluster scene settings
+			if (Settings.Num())
+			{
+				UE_LOG(LogDisplayClusterGame, Log, TEXT("Found DisplayCluster settings for this level"));
+				pGameMgr->SetDisplayClusterSceneSettings(Settings[0]);
+			}
+		}
+	}
+
+	Super::StartPlay();
+}
+
+
+void ADisplayClusterGameMode::BeginPlay()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	if (GDisplayCluster->IsModuleInitialized() && bIsDisplayClusterActive)
+	{
+		bGameStarted = GDisplayCluster->StartScene(GetWorld());
+		if (!bGameStarted)
+		{
+			UE_LOG(LogDisplayClusterGame, Error, TEXT("Couldn't start game"));
+			GetWorld()->Exec(GetWorld(), TEXT("quit"));
+		}
+	}
+
+	Super::BeginPlay();
+}
+
+void ADisplayClusterGameMode::BeginDestroy()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	if (GDisplayCluster->IsModuleInitialized() && bIsDisplayClusterActive)
+	{
+		if (bGameStarted)
+		{
+			GDisplayCluster->EndScene();
+		}
+
+		// ...
+	}
+
+	Super::BeginDestroy();
+}
+
+void ADisplayClusterGameMode::Tick(float DeltaSeconds)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	Super::Tick(DeltaSeconds);
+
+	if (!GDisplayCluster->IsModuleInitialized() || !bIsDisplayClusterActive)
+	{
+		return;
+	}
+
+#if WITH_EDITOR
+	IPDisplayClusterInputManager* const pInputMgr = GDisplayCluster->GetPrivateInputMgr();
+	if (pInputMgr)
+	{
+		pInputMgr->Update();
+	}
+
+	GDisplayCluster->PreTick(DeltaSeconds);
+#endif
+}
+
+#if WITH_EDITOR
+void ADisplayClusterGameMode::OnEndPIE(const bool bSimulate)
+{
+	if (GIsEditor)
+	{
+		FEditorDelegates::EndPIE.Remove(EndPIEDelegate);
+		GDisplayCluster->EndSession();
+
+		ADisplayClusterGameMode::bNeedSessionStart = true;
+		ADisplayClusterGameMode::bSessionStarted = false;
+	}
+}
+#endif
diff --git a/Source/DisplayCluster/Private/Game/Classes/Basics/DisplayClusterGameModeDefault.cpp b/Source/DisplayCluster/Private/Game/Classes/Basics/DisplayClusterGameModeDefault.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9d1c4e0f87e7bfa6f62108d7f20ef723daff2d45
--- /dev/null
+++ b/Source/DisplayCluster/Private/Game/Classes/Basics/DisplayClusterGameModeDefault.cpp
@@ -0,0 +1,28 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterGameModeDefault.h"
+#include "DisplayClusterPawnDefault.h"
+
+#include "Misc/DisplayClusterLog.h"
+#include "IPDisplayCluster.h"
+#include "DisplayClusterGlobals.h"
+
+
+ADisplayClusterGameModeDefault::ADisplayClusterGameModeDefault() :
+	Super()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	if (!bIsDisplayClusterActive)
+	{
+		return;
+	}
+	
+	DefaultPawnClass = ADisplayClusterPawnDefault::StaticClass();
+}
+
+ADisplayClusterGameModeDefault::~ADisplayClusterGameModeDefault()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+}
+
diff --git a/Source/DisplayCluster/Private/Game/Classes/Basics/DisplayClusterHUD.cpp b/Source/DisplayCluster/Private/Game/Classes/Basics/DisplayClusterHUD.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d2f63b55bebc48f09478fcdf5c4813855d260bd6
--- /dev/null
+++ b/Source/DisplayCluster/Private/Game/Classes/Basics/DisplayClusterHUD.cpp
@@ -0,0 +1,21 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterHUD.h"
+
+
+ADisplayClusterHUD::ADisplayClusterHUD(const FObjectInitializer& ObjectInitializer) :
+	AHUD(ObjectInitializer)
+{
+	PrimaryActorTick.bCanEverTick = true;
+}
+
+
+void ADisplayClusterHUD::BeginPlay()
+{
+	Super::BeginPlay();
+}
+
+void ADisplayClusterHUD::DrawHUD()
+{
+	Super::DrawHUD();
+}
diff --git a/Source/DisplayCluster/Private/Game/Classes/Basics/DisplayClusterPlayerController.cpp b/Source/DisplayCluster/Private/Game/Classes/Basics/DisplayClusterPlayerController.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..c14a65c04a9f2d2cd0f5dbb75587ecfd8740d9be
--- /dev/null
+++ b/Source/DisplayCluster/Private/Game/Classes/Basics/DisplayClusterPlayerController.cpp
@@ -0,0 +1,33 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterPlayerController.h"
+#include "Misc/DisplayClusterAppExit.h"
+
+
+void ADisplayClusterPlayerController::PlayerTick(float DeltaTime)
+{
+	Super::PlayerTick(DeltaTime);
+
+	if (WasInputKeyJustPressed(EKeys::Escape))
+	{
+		FDisplayClusterAppExit::ExitApplication(FDisplayClusterAppExit::ExitType::NormalSoft, FString("Exit on ESC requested"));
+	}
+}
+
+void ADisplayClusterPlayerController::BeginPlay()
+{
+	Super::BeginPlay();
+
+#if 0
+	//@todo: temporary solution. we need generic DisplayCluster access to statistics
+	//@note: next line causes crash
+	FDisplayClusterConfigDebug cfgDebug = FGDisplayCluster->GetPrivateConfigMgr()->GetConfigDebug();
+	if (cfgDebug.DrawStats)
+	{
+		UE_LOG(LogDisplayClusterGame, Log, TEXT("Activating onscreen stats"));
+		ConsoleCommand(FString("stat fps"),  true);
+		ConsoleCommand(FString("stat unit"), true);
+	}
+#endif
+}
+
diff --git a/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterCameraComponent.cpp b/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterCameraComponent.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..1e367e1058cffba3277f960526773d15eba3cb51
--- /dev/null
+++ b/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterCameraComponent.cpp
@@ -0,0 +1,36 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterCameraComponent.h"
+
+
+UDisplayClusterCameraComponent::UDisplayClusterCameraComponent(const FObjectInitializer& ObjectInitializer) :
+	UDisplayClusterSceneComponent(ObjectInitializer)
+{
+	PrimaryComponentTick.bCanEverTick = true;
+}
+
+
+void UDisplayClusterCameraComponent::BeginPlay()
+{
+	Super::BeginPlay();
+	
+	// ...
+	
+}
+
+void UDisplayClusterCameraComponent::TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction )
+{
+	Super::TickComponent( DeltaTime, TickType, ThisTickFunction );
+
+	// ...
+}
+
+void UDisplayClusterCameraComponent::SetSettings(const FDisplayClusterConfigSceneNode* pConfig)
+{
+	Super::SetSettings(pConfig);
+}
+
+bool UDisplayClusterCameraComponent::ApplySettings()
+{
+	return Super::ApplySettings();
+}
diff --git a/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterPawn.cpp b/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterPawn.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..031ae76789929af724d02d445fff41fab98ed7b7
--- /dev/null
+++ b/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterPawn.cpp
@@ -0,0 +1,131 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterPawn.h"
+
+#include "Engine/CollisionProfile.h"
+#include "Engine/World.h"
+
+#include "Camera/CameraComponent.h"
+#include "Components/SphereComponent.h"
+#include "GameFramework/PlayerController.h"
+
+#include "Cluster/IPDisplayClusterClusterManager.h"
+#include "Game/IPDisplayClusterGameManager.h"
+#include "Kismet/GameplayStatics.h"
+
+#include "DisplayClusterSceneComponentSyncParent.h"
+
+#include "IPDisplayCluster.h"
+#include "Misc/DisplayClusterLog.h"
+#include "DisplayClusterSettings.h"
+#include "DisplayClusterGameMode.h"
+#include "DisplayClusterGlobals.h"
+
+
+ADisplayClusterPawn::ADisplayClusterPawn(const FObjectInitializer& ObjectInitializer) :
+	Super(ObjectInitializer)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	// Collision component
+	CollisionComponent = CreateDefaultSubobject<USphereComponent>(TEXT("CollisionComponent0"));
+	CollisionComponent->InitSphereRadius(35.0f);
+	CollisionComponent->SetCollisionProfileName(UCollisionProfile::Pawn_ProfileName);
+	CollisionComponent->CanCharacterStepUpOn = ECB_No;
+	CollisionComponent->SetCanEverAffectNavigation(true);
+	CollisionComponent->bDynamicObstacle = true;
+	CollisionComponent->SetCollisionEnabled(ECollisionEnabled::NoCollision);
+
+	// Collision component must always be a root
+	RootComponent = CollisionComponent;
+
+	// Collision offset component
+	CollisionOffsetComponent = CreateDefaultSubobject<UDisplayClusterSceneComponent>(TEXT("DisplayCluster_offset"));
+	CollisionOffsetComponent->AttachToComponent(RootComponent, FAttachmentTransformRules(EAttachmentRule::KeepRelative, false));
+
+	// DisplayCluster sync
+	DisplayClusterSyncRoot = CreateDefaultSubobject<UDisplayClusterSceneComponentSyncParent>(TEXT("DisplayCluster_root_sync"));
+	DisplayClusterSyncRoot->AttachToComponent(RootComponent, FAttachmentTransformRules(EAttachmentRule::KeepRelative, false));
+
+	DisplayClusterSyncCollisionOffset = CreateDefaultSubobject<UDisplayClusterSceneComponentSyncParent>(TEXT("DisplayCluster_colloffset_sync"));
+	DisplayClusterSyncCollisionOffset->AttachToComponent(CollisionOffsetComponent, FAttachmentTransformRules(EAttachmentRule::KeepRelative, false));
+
+	// Camera
+	CameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("DisplayCluster_camera"));
+	CameraComponent->AttachToComponent(CollisionOffsetComponent, FAttachmentTransformRules(EAttachmentRule::KeepRelative, false));
+	CameraComponent->bUsePawnControlRotation = false;
+	CameraComponent->bAbsoluteLocation = false;
+	CameraComponent->bAbsoluteRotation = false;
+
+	PrimaryActorTick.bCanEverTick = true;
+	bFindCameraComponentWhenViewTarget = true;
+	bCanBeDamaged = false;
+	bReplicates = false;
+	SpawnCollisionHandlingMethod = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn;
+}
+
+void ADisplayClusterPawn::BeginPlay()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	Super::BeginPlay();
+
+	if (!GDisplayCluster->IsModuleInitialized())
+	{
+		return;
+	}
+
+	GameMgr = GDisplayCluster->GetPrivateGameMgr();
+	bIsCluster = (GDisplayCluster->GetOperationMode() == EDisplayClusterOperationMode::Cluster);
+
+	// No collision by default
+	CollisionComponent->SetCollisionEnabled(ECollisionEnabled::NoCollision);
+
+	// Enable collision if needed
+	if (GameMgr && GameMgr->IsDisplayClusterActive())
+	{
+		const ADisplayClusterSettings* const pDisplayClusterSettings = GameMgr->GetDisplayClusterSceneSettings();
+
+		const IPDisplayClusterClusterManager* const ClusterMgr = GDisplayCluster->GetPrivateClusterMgr();
+		if (ClusterMgr && ClusterMgr->IsMaster())
+		{
+			if (pDisplayClusterSettings && pDisplayClusterSettings->bEnableCollisions)
+			{
+				// Enable collisions
+				CollisionComponent->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
+				// Apply collision related offset to DisplayCluster hierarchy
+				const FVector CollisionOffset(0.f, 0.f, -CollisionComponent->GetUnscaledSphereRadius());
+				CollisionOffsetComponent->SetRelativeLocation(CollisionOffset);
+				UE_LOG(LogDisplayClusterGame, Log, TEXT("Collision offset: %s"), *CollisionOffset.ToString());
+			}
+		}
+		else
+		{
+			// Turn off input processing on slave nodes
+			UWorld* World = GetWorld();
+			if (World)
+			{
+				APlayerController* PlayerController = World->GetFirstPlayerController();
+				if (PlayerController)
+				{
+					UE_LOG(LogDisplayClusterGame, Log, TEXT("Deactivating input on slave node..."));
+					this->DisableInput(PlayerController);
+				}
+			}
+		}
+	}
+}
+
+void ADisplayClusterPawn::BeginDestroy()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	Super::BeginDestroy();
+}
+
+void ADisplayClusterPawn::Tick(float DeltaSeconds)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	Super::Tick(DeltaSeconds);
+}
diff --git a/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterPawnDefault.cpp b/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterPawnDefault.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..101119c7b18461e46a1dabc453a74e5607d7c9f3
--- /dev/null
+++ b/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterPawnDefault.cpp
@@ -0,0 +1,254 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterPawnDefault.h"
+
+#include "Cluster/IPDisplayClusterClusterManager.h"
+#include "Game/IPDisplayClusterGameManager.h"
+
+#include "DisplayClusterSceneComponentSyncParent.h"
+
+#include "DisplayClusterSettings.h"
+#include "DisplayClusterGameMode.h"
+#include "DisplayClusterGlobals.h"
+
+#include "Engine/World.h"
+#include "Misc/DisplayClusterLog.h"
+#include "GameFramework/WorldSettings.h"
+
+#include "IPDisplayCluster.h"
+
+
+ADisplayClusterPawnDefault::ADisplayClusterPawnDefault(const FObjectInitializer& ObjectInitializer) :
+	Super(ObjectInitializer)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	// Movement component
+	MovementComponent = CreateDefaultSubobject<UFloatingPawnMovement>(TEXT("MovementComponent0"));
+	MovementComponent->UpdatedComponent = RootComponent;
+
+	// Rotation component
+	RotatingComponent = CreateDefaultSubobject<URotatingMovementComponent>(TEXT("RotatingComponent0"));
+	RotatingComponent->UpdatedComponent = RootComponent;
+	RotatingComponent->bRotationInLocalSpace = true;
+	RotatingComponent->PivotTranslation = FVector::ZeroVector;
+	RotatingComponent->RotationRate = FRotator::ZeroRotator;
+
+	// Rotation component2
+	RotatingComponent2 = CreateDefaultSubobject<URotatingMovementComponent>(TEXT("RotatingComponent1"));
+	RotatingComponent2->UpdatedComponent = RootComponent;
+	RotatingComponent2->bRotationInLocalSpace = false;
+	RotatingComponent2->PivotTranslation = FVector::ZeroVector;
+	RotatingComponent2->RotationRate = FRotator::ZeroRotator;
+
+	BaseTurnRate = 45.f;
+	BaseLookUpRate = 45.f;
+}
+
+void ADisplayClusterPawnDefault::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	check(PlayerInputComponent);
+
+	Super::SetupPlayerInputComponent(PlayerInputComponent);
+
+	if (PlayerInputComponent)
+	{
+		PlayerInputComponent->BindAxis("MoveForward", this, &ADisplayClusterPawnDefault::MoveForward);
+		PlayerInputComponent->BindAxis("MoveRight",   this, &ADisplayClusterPawnDefault::MoveRight);
+		PlayerInputComponent->BindAxis("MoveUp",      this, &ADisplayClusterPawnDefault::MoveUp);
+		PlayerInputComponent->BindAxis("TurnRate",    this, &ADisplayClusterPawnDefault::TurnAtRate2);
+		PlayerInputComponent->BindAxis("LookUpRate",  this, &ADisplayClusterPawnDefault::LookUpAtRate);
+	}
+}
+
+void ADisplayClusterPawnDefault::BeginPlay()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	Super::BeginPlay();
+
+	if (!GDisplayCluster->IsModuleInitialized())
+	{
+		return;
+	}
+
+	GameMgr = GDisplayCluster->GetPrivateGameMgr();
+	bIsCluster = (GDisplayCluster->GetOperationMode() == EDisplayClusterOperationMode::Cluster);
+
+	bUseControllerRotationYaw   = !bIsCluster;
+	bUseControllerRotationPitch = !bIsCluster;
+	bUseControllerRotationRoll  = !bIsCluster;
+
+	// Enable collision if needed
+	if (GameMgr && GameMgr->IsDisplayClusterActive())
+	{
+		const ADisplayClusterSettings* const pDisplayClusterSettings = GameMgr->GetDisplayClusterSceneSettings();
+		if (pDisplayClusterSettings)
+		{
+			// Apply movement settings
+			MovementComponent->MaxSpeed     = pDisplayClusterSettings->MovementMaxSpeed;
+			MovementComponent->Acceleration = pDisplayClusterSettings->MovementAcceleration;
+			MovementComponent->Deceleration = pDisplayClusterSettings->MovementDeceleration;
+			MovementComponent->TurningBoost = pDisplayClusterSettings->MovementTurningBoost;
+
+			// Apply rotation settings
+			BaseTurnRate   = pDisplayClusterSettings->RotationSpeed;
+			BaseLookUpRate = pDisplayClusterSettings->RotationSpeed;
+		}
+	}
+}
+
+void ADisplayClusterPawnDefault::BeginDestroy()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	Super::BeginDestroy();
+}
+
+void ADisplayClusterPawnDefault::Tick(float DeltaSeconds)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	Super::Tick(DeltaSeconds);
+
+	const float Mult = GetWorld()->GetWorldSettings()->WorldToMeters / 100.f;
+	SetActorScale3D(FVector(Mult, Mult, Mult));
+}
+
+void ADisplayClusterPawnDefault::MoveRight(float Val)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	if (Val != 0.f)
+	{
+		UE_LOG(LogDisplayClusterGame, Verbose, TEXT("ADisplayClusterPawn::MoveRight: %f"), Val);
+
+		const USceneComponent* const pComp = (TranslationDirection ? TranslationDirection : RootComponent);
+		AddMovementInput(pComp->GetRightVector(), Val);
+	}
+}
+
+void ADisplayClusterPawnDefault::MoveForward(float Val)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	if (Val != 0.f)
+	{
+		UE_LOG(LogDisplayClusterGame, Verbose, TEXT("ADisplayClusterPawn::MoveForward: %f"), Val);
+
+		const USceneComponent* const pComp = (TranslationDirection ? TranslationDirection : RootComponent);
+		AddMovementInput(pComp->GetForwardVector(), Val);
+	}
+}
+
+void ADisplayClusterPawnDefault::MoveUp(float Val)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	if (Val != 0.f)
+	{
+		UE_LOG(LogDisplayClusterGame, Verbose, TEXT("ADisplayClusterPawn::MoveUp: %f"), Val);
+
+		const USceneComponent* const pComp = (TranslationDirection ? TranslationDirection : RootComponent);
+		AddMovementInput(pComp->GetUpVector(), Val);
+	}
+}
+
+void ADisplayClusterPawnDefault::TurnAtRate(float Rate)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	UE_LOG(LogDisplayClusterGame, Verbose, TEXT("ADisplayClusterPawn::TurnAtRate: %f"), Rate);
+
+	if (bIsCluster)
+	{
+		IPDisplayClusterGameManager* const pMgr = GDisplayCluster->GetPrivateGameMgr();
+		if (pMgr)
+		{
+			auto* const pCam = pMgr->GetActiveCamera();
+			if (pCam)
+			{
+				if (RotatingComponent->UpdatedComponent)
+				{
+					const FTransform TransformToRotate = RotatingComponent->UpdatedComponent->GetComponentTransform();
+					const FVector RotateAroundPivot = TransformToRotate.InverseTransformPositionNoScale(pCam->GetComponentLocation());
+					RotatingComponent->PivotTranslation = RotateAroundPivot;
+					RotatingComponent->RotationRate = FRotator(RotatingComponent->RotationRate.Pitch, Rate * BaseTurnRate, 0.f);
+				}
+			}
+		}
+	}
+	else
+	{
+		if (Rate != 0.f)
+		{
+			AddControllerYawInput(BaseTurnRate * Rate * GetWorld()->GetDeltaSeconds() * CustomTimeDilation);
+		}
+	}
+}
+
+void ADisplayClusterPawnDefault::TurnAtRate2(float Rate)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	UE_LOG(LogDisplayClusterGame, Verbose, TEXT("ADisplayClusterPawn::TurnAtRate2: %f"), Rate);
+
+	if (bIsCluster)
+	{
+		IPDisplayClusterGameManager* const pMgr = GDisplayCluster->GetPrivateGameMgr();
+		if (pMgr)
+		{
+			UDisplayClusterCameraComponent* const pCam = pMgr->GetActiveCamera();
+			if (pCam)
+			{
+				if (RotatingComponent2->UpdatedComponent)
+				{
+					const FTransform TransformToRotate = RotatingComponent2->UpdatedComponent->GetComponentTransform();
+					const FVector RotateAroundPivot = TransformToRotate.InverseTransformPositionNoScale(pCam->GetComponentLocation());
+					RotatingComponent2->PivotTranslation = RotateAroundPivot;
+					RotatingComponent2->RotationRate = FRotator(RotatingComponent2->RotationRate.Pitch, Rate * BaseTurnRate, 0.f);
+				}
+			}
+		}
+	}
+	else
+	{
+		if (Rate != 0.f)
+		{
+			AddControllerYawInput(BaseTurnRate * Rate * GetWorld()->GetDeltaSeconds() * CustomTimeDilation);
+		}
+	}
+}
+
+void ADisplayClusterPawnDefault::LookUpAtRate(float Rate)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	if (bIsCluster)
+	{
+		//@note: usually CAVE-like systems don't use roll and pitch rotation since it can cause dizziness.
+#if 0
+		//@todo: rotate around active camera
+		IPDisplayClusterGameManager* const pMgr = GDisplayCluster->GetPrivateGameMgr();
+		if (pMgr)
+		{
+			auto* const pCam = pMgr->GetActiveCamera();
+			if (pCam)
+			{
+				RotatingComponent->bRotationInLocalSpace = true;
+				RotatingComponent->PivotTranslation = FVector::ZeroVector;
+				RotatingComponent->RotationRate = FRotator(Rate * BaseLookUpRate, RotatingComponent->RotationRate.Yaw, 0.f);
+			}
+		}
+#endif
+	}
+	else
+	{
+		if (Rate != 0.f)
+		{
+			AddControllerPitchInput(BaseTurnRate * Rate * GetWorld()->GetDeltaSeconds() * CustomTimeDilation);
+		}
+	}
+}
diff --git a/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterSceneComponent.cpp b/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterSceneComponent.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5ec86b78c9aca9b709e50a205b0247e77a3004fa
--- /dev/null
+++ b/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterSceneComponent.cpp
@@ -0,0 +1,89 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterSceneComponent.h"
+
+#include "Config/DisplayClusterConfigTypes.h"
+#include "Game/IPDisplayClusterGameManager.h"
+#include "Input/IPDisplayClusterInputManager.h"
+#include "Misc/DisplayClusterLog.h"
+
+#include "DisplayClusterGlobals.h"
+#include "IPDisplayCluster.h"
+
+
+UDisplayClusterSceneComponent::UDisplayClusterSceneComponent(const FObjectInitializer& ObjectInitializer) :
+	USceneComponent(ObjectInitializer)
+{
+	PrimaryComponentTick.bCanEverTick = true;
+}
+
+void UDisplayClusterSceneComponent::BeginPlay()
+{
+	Super::BeginPlay();
+}
+
+void UDisplayClusterSceneComponent::BeginDestroy()
+{
+	Super::BeginDestroy();
+}
+
+void UDisplayClusterSceneComponent::TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction )
+{
+	Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
+
+	// Update transform if attached to a tracker
+	if (!Config.TrackerId.IsEmpty())
+	{
+		const IPDisplayClusterInputManager* const InputMgr = GDisplayCluster->GetPrivateInputMgr();
+		if (InputMgr)
+		{
+			FVector loc;
+			FQuat rot;
+			const bool bLocAvail = InputMgr->GetTrackerLocation(Config.TrackerId, Config.TrackerCh, loc);
+			const bool bRotAvail = InputMgr->GetTrackerQuat(Config.TrackerId, Config.TrackerCh, rot);
+
+			if (bLocAvail && bRotAvail)
+			{
+				UE_LOG(LogDisplayClusterGame, Verbose, TEXT("%s[%s] update from tracker %s:%d - {loc %s} {quat %s}"),
+					*GetName(), *GetId(), *Config.TrackerId, Config.TrackerCh, *loc.ToString(), *rot.ToString());
+
+				// Update transform
+				FHitResult hitResult;
+				this->SetRelativeLocationAndRotation(loc, rot, false, &hitResult, ETeleportType::ResetPhysics);
+				// Force child transforms update
+				UpdateChildTransforms(/*true*/);
+			}
+		}
+	}
+}
+
+void UDisplayClusterSceneComponent::SetSettings(const FDisplayClusterConfigSceneNode* pConfig)
+{
+	check(pConfig);
+
+	Config = *pConfig;
+
+	// Convert m to cm
+	Config.Loc *= 100.f;
+}
+
+bool UDisplayClusterSceneComponent::ApplySettings()
+{
+	// Take place in hierarchy
+	if (!GetParentId().IsEmpty())
+	{
+		const IPDisplayClusterGameManager* const GameMgr = GDisplayCluster->GetPrivateGameMgr();
+		if (GameMgr)
+		{
+			UE_LOG(LogDisplayClusterGame, Log, TEXT("Attaching %s to %s"), *GetId(), *GetParentId());
+			UDisplayClusterSceneComponent* const pComp = GameMgr->GetNodeById(GetParentId());
+			AttachToComponent(pComp, FAttachmentTransformRules(EAttachmentRule::KeepRelative, false));
+			//this->SetRelativeTransform(FTransform::Identity);
+		}
+	}
+
+	// Set up location and rotation
+	this->SetRelativeLocationAndRotation(Config.Loc, Config.Rot);
+
+	return true;
+}
diff --git a/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterSceneComponentSync.cpp b/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterSceneComponentSync.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9cdc6733c5bad99898c4c21e7245670d9de8bda5
--- /dev/null
+++ b/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterSceneComponentSync.cpp
@@ -0,0 +1,103 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterSceneComponentSync.h"
+
+#include "IPDisplayCluster.h"
+#include "Cluster/IPDisplayClusterClusterManager.h"
+#include "Game/IPDisplayClusterGameManager.h"
+#include "Misc/DisplayClusterLog.h"
+#include "DisplayClusterGlobals.h"
+
+
+UDisplayClusterSceneComponentSync::UDisplayClusterSceneComponentSync(const FObjectInitializer& ObjectInitializer) :
+	USceneComponent(ObjectInitializer)
+{
+	PrimaryComponentTick.bCanEverTick = true;
+}
+
+void UDisplayClusterSceneComponentSync::BeginPlay()
+{
+	Super::BeginPlay();
+
+	if (!GDisplayCluster->IsModuleInitialized())
+	{
+		return;
+	}
+
+	// Generate unique sync id
+	SyncId = GetSyncId();
+
+	GameMgr = GDisplayCluster->GetPrivateGameMgr();
+	if (GameMgr && GameMgr->IsDisplayClusterActive())
+	{
+		// Register sync object
+		ClusterMgr = GDisplayCluster->GetPrivateClusterMgr();
+		if (ClusterMgr)
+		{
+			UE_LOG(LogDisplayClusterGame, Log, TEXT("Registering sync object %s..."), *SyncId);
+			ClusterMgr->RegisterSyncObject(this);
+		}
+		else
+		{
+			UE_LOG(LogDisplayClusterGame, Warning, TEXT("Couldn't register %s scene component sync. Looks like we're in non-DisplayCluster mode."), *SyncId);
+		}
+	}
+}
+
+
+void UDisplayClusterSceneComponentSync::TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction )
+{
+	Super::TickComponent( DeltaTime, TickType, ThisTickFunction );
+
+	// ...
+}
+
+void UDisplayClusterSceneComponentSync::DestroyComponent(bool bPromoteChildren)
+{
+	if (GDisplayCluster->IsModuleInitialized())
+	{
+		if (GameMgr && GameMgr->IsDisplayClusterActive())
+		{
+			if (ClusterMgr)
+			{
+				UE_LOG(LogDisplayClusterGame, Log, TEXT("Unregistering sync object %s..."), *SyncId);
+				ClusterMgr->UnregisterSyncObject(this);
+			}
+		}
+	}
+
+	Super::DestroyComponent(bPromoteChildren);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterClusterSyncObject
+//////////////////////////////////////////////////////////////////////////////////////////////
+FString UDisplayClusterSceneComponentSync::GetSyncId() const
+{
+	return FString::Printf(TEXT("S_%s"), *GetOwner()->GetName());
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterStringSerializable
+//////////////////////////////////////////////////////////////////////////////////////////////
+FString UDisplayClusterSceneComponentSync::SerializeToString() const
+{
+	return GetSyncTransform().ToString();
+}
+
+bool UDisplayClusterSceneComponentSync::DeserializeFromString(const FString& data)
+{
+	FTransform t;
+	if (!t.InitFromString(data))
+	{
+		UE_LOG(LogDisplayClusterGame, Error, TEXT("Unable to deserialize transform data"));
+		return false;
+	}
+
+	UE_LOG(LogDisplayClusterGame, Verbose, TEXT("%s: applying transform data <%s>"), *SyncId, *t.ToHumanReadableString());
+	SetSyncTransform(t);
+
+	return true;
+}
diff --git a/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterSceneComponentSyncParent.cpp b/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterSceneComponentSyncParent.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..162d1b520879aab5873bd067df326cecd9d6e5e2
--- /dev/null
+++ b/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterSceneComponentSyncParent.cpp
@@ -0,0 +1,70 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterSceneComponentSyncParent.h"
+#include "GameFramework/Actor.h"
+
+
+UDisplayClusterSceneComponentSyncParent::UDisplayClusterSceneComponentSyncParent(const FObjectInitializer& ObjectInitializer) :
+	UDisplayClusterSceneComponentSync(ObjectInitializer)
+{
+	PrimaryComponentTick.bCanEverTick = false;
+}
+
+void UDisplayClusterSceneComponentSyncParent::BeginPlay()
+{
+	Super::BeginPlay();
+
+	// ...
+}
+
+
+void UDisplayClusterSceneComponentSyncParent::TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction )
+{
+	Super::TickComponent( DeltaTime, TickType, ThisTickFunction );
+
+	// ...
+}
+
+void UDisplayClusterSceneComponentSyncParent::DestroyComponent(bool bPromoteChildren)
+{
+	Super::DestroyComponent(bPromoteChildren);
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterClusterSyncObject
+//////////////////////////////////////////////////////////////////////////////////////////////
+FString UDisplayClusterSceneComponentSyncParent::GetSyncId() const
+{
+	return FString::Printf(TEXT("SP_%s.%s"), *GetOwner()->GetName(), *GetAttachParent()->GetName());
+}
+
+
+bool UDisplayClusterSceneComponentSyncParent::IsDirty() const
+{
+	USceneComponent* const pParent = GetAttachParent();
+	return (LastSyncLoc != pParent->RelativeLocation || LastSyncRot != pParent->RelativeRotation || LastSyncScale != pParent->RelativeScale3D);
+}
+
+void UDisplayClusterSceneComponentSyncParent::ClearDirty()
+{
+	USceneComponent* const pParent = GetAttachParent();
+	LastSyncLoc = pParent->RelativeLocation;
+	LastSyncRot = pParent->RelativeRotation;
+	LastSyncScale = pParent->RelativeScale3D;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// UDisplayClusterSceneComponentSync
+//////////////////////////////////////////////////////////////////////////////////////////////
+FTransform UDisplayClusterSceneComponentSyncParent::GetSyncTransform() const
+{
+	return GetAttachParent()->GetRelativeTransform();
+}
+
+void UDisplayClusterSceneComponentSyncParent::SetSyncTransform(const FTransform& t)
+{
+	GetAttachParent()->SetRelativeTransform(t);
+}
diff --git a/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterSceneComponentSyncThis.cpp b/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterSceneComponentSyncThis.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..6160061c64c433f86bde49902fb406bbfb679cbd
--- /dev/null
+++ b/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterSceneComponentSyncThis.cpp
@@ -0,0 +1,67 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterSceneComponentSyncThis.h"
+
+#include "GameFramework/Actor.h"
+
+
+UDisplayClusterSceneComponentSyncThis::UDisplayClusterSceneComponentSyncThis(const FObjectInitializer& ObjectInitializer) :
+	UDisplayClusterSceneComponentSync(ObjectInitializer)
+{
+	PrimaryComponentTick.bCanEverTick = false;
+}
+
+void UDisplayClusterSceneComponentSyncThis::BeginPlay()
+{
+	Super::BeginPlay();
+
+	// ...
+}
+
+
+void UDisplayClusterSceneComponentSyncThis::TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction )
+{
+	Super::TickComponent( DeltaTime, TickType, ThisTickFunction );
+
+	// ...
+}
+
+void UDisplayClusterSceneComponentSyncThis::DestroyComponent(bool bPromoteChildren)
+{
+	Super::DestroyComponent(bPromoteChildren);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterClusterSyncObject
+//////////////////////////////////////////////////////////////////////////////////////////////
+FString UDisplayClusterSceneComponentSyncThis::GetSyncId() const
+{
+	return FString::Printf(TEXT("ST_%s"), *GetOwner()->GetName());
+}
+
+bool UDisplayClusterSceneComponentSyncThis::IsDirty() const
+{
+	return (LastSyncLoc != RelativeLocation || LastSyncRot != RelativeRotation || LastSyncScale != RelativeScale3D);
+}
+
+void UDisplayClusterSceneComponentSyncThis::ClearDirty()
+{
+	LastSyncLoc = RelativeLocation;
+	LastSyncRot = RelativeRotation;
+	LastSyncScale = RelativeScale3D;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// UDisplayClusterSceneComponentSync
+//////////////////////////////////////////////////////////////////////////////////////////////
+FTransform UDisplayClusterSceneComponentSyncThis::GetSyncTransform() const
+{
+	return GetRelativeTransform();
+}
+
+void UDisplayClusterSceneComponentSyncThis::SetSyncTransform(const FTransform& t)
+{
+	SetRelativeTransform(t);
+}
diff --git a/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterScreenComponent.cpp b/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterScreenComponent.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..2cc6b0cde87da6fd1b6021f0a0ef94fbb30b3225
--- /dev/null
+++ b/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterScreenComponent.cpp
@@ -0,0 +1,92 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterScreenComponent.h"
+#include "DisplayClusterSettings.h"
+#include "Components/StaticMeshComponent.h"
+#include "Engine/GameEngine.h"
+#include "Engine/StaticMesh.h"
+#include "Materials/MaterialInterface.h"
+#include "Materials/Material.h"
+#include "UObject/ConstructorHelpers.h"
+
+#include "Game/IPDisplayClusterGameManager.h"
+#include "DisplayClusterGlobals.h"
+#include "IPDisplayCluster.h"
+#include "EngineDefines.h"
+
+
+UDisplayClusterScreenComponent::UDisplayClusterScreenComponent(const FObjectInitializer& ObjectInitializer) :
+	UDisplayClusterSceneComponent(ObjectInitializer)
+{
+	PrimaryComponentTick.bCanEverTick = true;
+
+#if WITH_EDITOR
+	if (GEngine && GEngine->IsEditor())
+	{
+		const IPDisplayClusterGameManager* const GameMgr = GDisplayCluster->GetPrivateGameMgr();
+		if (GameMgr)
+		{
+			const ADisplayClusterSettings* const pDisplayClusterSettings = GameMgr->GetDisplayClusterSceneSettings();
+			if (pDisplayClusterSettings && pDisplayClusterSettings->bEditorShowProjectionScreens)
+			{
+				ScreenGeometryComponent = CreateDefaultSubobject<UStaticMeshComponent>(FName(*(GetName() + FString("_impl"))));
+				check(ScreenGeometryComponent);
+
+				if (ScreenGeometryComponent)
+				{
+					static ConstructorHelpers::FObjectFinder<UStaticMesh> screenMesh(TEXT("StaticMesh'/Engine/BasicShapes/Cube.Cube'"));
+					static ConstructorHelpers::FObjectFinder<UMaterial>   screenMat(TEXT("Material'/Engine/Engine_MI_Shaders/M_Shader_SimpleTranslucent.M_Shader_SimpleTranslucent'"));
+
+					ScreenGeometryComponent->AttachToComponent(this, FAttachmentTransformRules(EAttachmentRule::KeepRelative, false));
+					ScreenGeometryComponent->SetStaticMesh(screenMesh.Object);
+					ScreenGeometryComponent->SetMobility(EComponentMobility::Movable);
+					ScreenGeometryComponent->SetMaterial(0, screenMat.Object);
+					ScreenGeometryComponent->SetCollisionEnabled(ECollisionEnabled::NoCollision);
+				}
+			}
+		}
+	}
+#endif
+}
+
+
+void UDisplayClusterScreenComponent::BeginPlay()
+{
+	Super::BeginPlay();
+
+	// ...
+}
+
+
+void UDisplayClusterScreenComponent::TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction )
+{
+	Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
+
+	// ...
+}
+
+void UDisplayClusterScreenComponent::SetSettings(const FDisplayClusterConfigSceneNode* pConfig)
+{
+	const FDisplayClusterConfigScreen* pScreenCfg = static_cast<const FDisplayClusterConfigScreen*>(pConfig);
+	Size = pScreenCfg->Size;
+
+	Super::SetSettings(pConfig);
+}
+
+bool UDisplayClusterScreenComponent::ApplySettings()
+{
+	Super::ApplySettings();
+
+#if WITH_EDITOR
+	if (ScreenGeometryComponent)
+	{
+		ScreenGeometryComponent->RegisterComponent();
+		ScreenGeometryComponent->AttachToComponent(this, FAttachmentTransformRules(EAttachmentRule::KeepRelative, false));
+		ScreenGeometryComponent->SetRelativeLocationAndRotation(FVector::ZeroVector, FRotator::ZeroRotator, false);
+	}
+#endif
+
+	SetRelativeScale3D(FVector(0.0001f, Size.X, Size.Y));
+
+	return true;
+}
diff --git a/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterSettings.cpp b/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterSettings.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..8811141e7a4f9bdaadc198d451833ac67a9ed029
--- /dev/null
+++ b/Source/DisplayCluster/Private/Game/Classes/Scene/DisplayClusterSettings.cpp
@@ -0,0 +1,20 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterSettings.h"
+
+
+ADisplayClusterSettings::ADisplayClusterSettings(const FObjectInitializer& ObjectInitializer) :
+	AActor(ObjectInitializer),
+	MovementMaxSpeed(1200.f),
+	MovementAcceleration(4000.f),
+	MovementDeceleration(8000.f),
+	MovementTurningBoost(8.f),
+	RotationSpeed(45.f)
+{
+	PrimaryActorTick.bCanEverTick = true;
+
+}
+
+ADisplayClusterSettings::~ADisplayClusterSettings()
+{
+}
diff --git a/Source/DisplayCluster/Private/Game/DisplayClusterGameManager.cpp b/Source/DisplayCluster/Private/Game/DisplayClusterGameManager.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..2d7a84e83a6c0c7651601195fae3cf8c98d0b449
--- /dev/null
+++ b/Source/DisplayCluster/Private/Game/DisplayClusterGameManager.cpp
@@ -0,0 +1,502 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterGameManager.h"
+
+#include "Config/IPDisplayClusterConfigManager.h"
+
+#include "DisplayClusterGameMode.h"
+#include "DisplayClusterSettings.h"
+
+#include "Kismet/GameplayStatics.h"
+#include "Misc/CommandLine.h"
+#include "Misc/DisplayClusterHelpers.h"
+#include "Misc/DisplayClusterLog.h"
+#include "Config/DisplayClusterConfigTypes.h"
+
+#include "Camera/CameraComponent.h"
+#include "Components/SceneComponent.h"
+#include "DisplayClusterCameraComponent.h"
+#include "DisplayClusterSceneComponent.h"
+
+#include "IPDisplayCluster.h"
+#include "DisplayClusterGlobals.h"
+#include "DisplayClusterStrings.h"
+
+
+FDisplayClusterGameManager::FDisplayClusterGameManager()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+}
+
+FDisplayClusterGameManager::~FDisplayClusterGameManager()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IPDisplayClusterManager
+//////////////////////////////////////////////////////////////////////////////////////////////
+bool FDisplayClusterGameManager::Init(EDisplayClusterOperationMode OperationMode)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	CurrentOperationMode = OperationMode;
+
+	return true;
+}
+
+void FDisplayClusterGameManager::Release()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+}
+
+bool FDisplayClusterGameManager::StartSession(const FString& configPath, const FString& nodeId)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	ConfigPath = configPath;
+	ClusterNodeId = nodeId;
+
+	return true;
+}
+
+void FDisplayClusterGameManager::EndSession()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+}
+
+bool FDisplayClusterGameManager::StartScene(UWorld* pWorld)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	check(pWorld);
+	CurrentWorld = pWorld;
+
+	VRRootActor = nullptr;
+	ActiveScreenComponent = nullptr;
+	ActiveCameraComponent = nullptr;
+
+	// Clean containers. We store only pointers so there is no need to do any additional
+	// operations. All components will be destroyed by the engine.
+	ScreenComponents.Reset();
+	CameraComponents.Reset();
+	SceneNodeComponents.Reset();
+
+	if (IsDisplayClusterActive())
+	{
+		//@todo: move initialization to DisplayClusterRoot side
+		if (!InitializeDisplayClusterActor())
+		{
+			UE_LOG(LogDisplayClusterGame, Error, TEXT("Couldn't initialize DisplayCluster hierarchy"));
+			return false;
+		}
+	}
+
+	return true;
+}
+
+void FDisplayClusterGameManager::EndScene()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+	FScopeLock lock(&InternalsSyncScope);
+
+	VRRootActor = nullptr;
+	ActiveScreenComponent = nullptr;
+	ActiveCameraComponent = nullptr;
+
+	// Clean containers. We store only pointers so there is no need to do any additional
+	// operations. All components will be destroyed by the engine.
+	ScreenComponents.Reset();
+	CameraComponents.Reset();
+	SceneNodeComponents.Reset();
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterGameManager
+//////////////////////////////////////////////////////////////////////////////////////////////
+ADisplayClusterPawn* FDisplayClusterGameManager::GetRoot() const
+{
+	FScopeLock lock(&InternalsSyncScope);
+	return VRRootActor;
+}
+
+TArray<UDisplayClusterScreenComponent*> FDisplayClusterGameManager::GetAllScreens() const
+{
+	FScopeLock lock(&InternalsSyncScope);
+	return GetMapValues<UDisplayClusterScreenComponent>(ScreenComponents);
+}
+
+UDisplayClusterScreenComponent* FDisplayClusterGameManager::GetActiveScreen() const
+{
+	FScopeLock lock(&InternalsSyncScope);
+	return ActiveScreenComponent;
+}
+
+UDisplayClusterScreenComponent* FDisplayClusterGameManager::GetScreenById(const FString& id) const
+{
+	FScopeLock lock(&InternalsSyncScope);
+	return GetItem<UDisplayClusterScreenComponent>(ScreenComponents, id, FString("GetScreenById"));
+}
+
+int32 FDisplayClusterGameManager::GetScreensAmount() const
+{
+	FScopeLock lock(&InternalsSyncScope);
+	return ScreenComponents.Num();
+}
+
+UDisplayClusterCameraComponent* FDisplayClusterGameManager::GetActiveCamera() const
+{
+	FScopeLock lock(&InternalsSyncScope);
+	return ActiveCameraComponent;
+}
+
+UDisplayClusterCameraComponent* FDisplayClusterGameManager::GetCameraById(const FString& id) const
+{
+	FScopeLock lock(&InternalsSyncScope);
+	return GetItem<UDisplayClusterCameraComponent>(CameraComponents, id, FString("GetCameraById"));
+}
+
+TArray<UDisplayClusterCameraComponent*> FDisplayClusterGameManager::GetAllCameras() const
+{
+	FScopeLock lock(&InternalsSyncScope);
+	return GetMapValues<UDisplayClusterCameraComponent>(CameraComponents);
+}
+
+int32 FDisplayClusterGameManager::GetCamerasAmount() const
+{
+	FScopeLock lock(&InternalsSyncScope);
+	return CameraComponents.Num();
+}
+
+void FDisplayClusterGameManager::SetActiveCamera(int32 idx)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	if (!IsDisplayClusterActive())
+	{
+		return;
+	}
+
+	FDisplayClusterConfigCamera cam;
+	if (!GDisplayCluster->GetPrivateConfigMgr()->GetCamera(idx, cam))
+	{
+		UE_LOG(LogDisplayClusterGame, Error, TEXT("Camera not found (idx=%d)"), idx);
+		return;
+	}
+
+	return SetActiveCamera(cam.Id);
+}
+
+void FDisplayClusterGameManager::SetActiveCamera(const FString& id)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	if (!IsDisplayClusterActive())
+	{
+		return;
+	}
+
+	FScopeLock lock(&InternalsSyncScope);
+
+	if (!CameraComponents.Contains(id))
+	{
+		UE_LOG(LogDisplayClusterGame, Error, TEXT("Couldn't switch camera. No such node id: %s"), *id);
+		return;
+	}
+
+	ActiveCameraComponent = CameraComponents[id];
+	VRRootActor->GetCameraComponent()->AttachToComponent(ActiveCameraComponent, FAttachmentTransformRules(EAttachmentRule::KeepRelative, false));
+	VRRootActor->GetCameraComponent()->SetRelativeLocation(FVector::ZeroVector);
+	VRRootActor->GetCameraComponent()->SetRelativeRotation(FRotator::ZeroRotator);
+
+	// Update 'rotate around' component
+	SetRotateAroundComponent(ActiveCameraComponent);
+
+	UE_LOG(LogDisplayClusterGame, Log, TEXT("Camera %s activated"), *ActiveCameraComponent->GetId());
+}
+
+UDisplayClusterSceneComponent* FDisplayClusterGameManager::GetNodeById(const FString& id) const
+{
+	FScopeLock lock(&InternalsSyncScope);
+	return GetItem<UDisplayClusterSceneComponent>(SceneNodeComponents, id, FString("GetNodeById"));
+}
+
+TArray<UDisplayClusterSceneComponent*> FDisplayClusterGameManager::GetAllNodes() const
+{
+	FScopeLock lock(&InternalsSyncScope);
+	return GetMapValues<UDisplayClusterSceneComponent>(SceneNodeComponents);
+}
+
+USceneComponent* FDisplayClusterGameManager::GetTranslationDirectionComponent() const
+{
+	if (!IsDisplayClusterActive())
+	{
+		return nullptr;
+	}
+
+	if (VRRootActor == nullptr)
+	{
+		return nullptr;
+	}
+
+	FScopeLock lock(&InternalsSyncScope);
+	UE_LOG(LogDisplayClusterGame, Verbose, TEXT("GetTranslationDirectionComponent: %s"), (VRRootActor->TranslationDirection ? *VRRootActor->TranslationDirection->GetName() : TEXT("nullptr")));
+	return VRRootActor->TranslationDirection;
+}
+
+void FDisplayClusterGameManager::SetTranslationDirectionComponent(USceneComponent* pComp)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	if (!IsDisplayClusterActive())
+	{
+		return;
+	}
+
+	if (VRRootActor == nullptr)
+	{
+		return;
+	}
+
+	FScopeLock lock(&InternalsSyncScope);
+	UE_LOG(LogDisplayClusterGame, Log, TEXT("New translation direction component set: %s"), (pComp ? *pComp->GetName() : TEXT("nullptr")));
+	VRRootActor->TranslationDirection = pComp;
+}
+
+void FDisplayClusterGameManager::SetTranslationDirectionComponent(const FString& id)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	if (!IsDisplayClusterActive())
+	{
+		return;
+	}
+
+	UE_LOG(LogDisplayClusterGame, Log, TEXT("New translation direction node id requested: %s"), *id);
+	SetTranslationDirectionComponent(GetNodeById(id));
+}
+
+USceneComponent* FDisplayClusterGameManager::GetRotateAroundComponent() const
+{
+	if (!IsDisplayClusterActive())
+	{
+		return nullptr;
+	}
+
+	if (VRRootActor == nullptr)
+	{
+		return nullptr;
+	}
+
+	FScopeLock lock(&InternalsSyncScope);
+	UE_LOG(LogDisplayClusterGame, Verbose, TEXT("GetRotateAroundComponent: %s"), (VRRootActor->RotationAround ? *VRRootActor->RotationAround->GetName() : TEXT("nullptr")));
+	return VRRootActor->RotationAround;
+}
+
+void FDisplayClusterGameManager::SetRotateAroundComponent(USceneComponent* pComp)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	if (!IsDisplayClusterActive())
+	{
+		return;
+	}
+
+	if (VRRootActor == nullptr)
+	{
+		return;
+	}
+
+	FScopeLock lock(&InternalsSyncScope);
+	UE_LOG(LogDisplayClusterGame, Log, TEXT("New rotate around component set: %s"), (pComp ? *pComp->GetName() : TEXT("nullptr")));
+	VRRootActor->RotationAround = pComp;
+}
+
+void FDisplayClusterGameManager::SetRotateAroundComponent(const FString& id)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	if (!IsDisplayClusterActive())
+	{
+		return;
+	}
+
+	if (VRRootActor == nullptr)
+	{
+		return;
+	}
+
+	FScopeLock lock(&InternalsSyncScope);
+	UE_LOG(LogDisplayClusterGame, Log, TEXT("New rotate around node id requested: %s"), *id);
+	VRRootActor->RotationAround = GetNodeById(id);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterGameManager
+//////////////////////////////////////////////////////////////////////////////////////////////
+bool FDisplayClusterGameManager::InitializeDisplayClusterActor()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterGame);
+
+	APlayerController* pController = UGameplayStatics::GetPlayerController(CurrentWorld, 0);
+	check(pController);
+	
+	VRRootActor = StaticCast<ADisplayClusterPawn*>(pController->GetPawn());
+	if (!VRRootActor)
+	{
+		// Seems the DisplayCluster features has been disabled
+		UE_LOG(LogDisplayClusterGame, Warning, TEXT("No DisplayCluster root found"));
+		return false;
+	}
+
+	if (!(CreateCameras() && CreateScreens() && CreateNodes()))
+	{
+		UE_LOG(LogDisplayClusterGame, Error, TEXT("An error occurred during DisplayCluster root initialization"));
+		return false;
+	}
+
+	// Let DisplayCluster nodes initialize ourselves
+	for (auto it = SceneNodeComponents.CreateIterator(); it; ++it)
+	{
+		if (it->Value->ApplySettings() == false)
+		{
+			UE_LOG(LogDisplayClusterGame, Warning, TEXT("Coulnd't initialize DisplayCluster node: ID=%s"), *it->Key);
+		}
+	}
+
+	// Set the first camera active by default
+	SetActiveCamera(ActiveCameraComponent->GetId());
+
+	// Check if default camera was specified in command line arguments
+	FString camId;
+	if (FParse::Value(FCommandLine::Get(), DisplayClusterStrings::args::Camera, camId))
+	{
+		DisplayClusterHelpers::str::DustCommandLineValue(camId);
+		UE_LOG(LogDisplayClusterGame, Log, TEXT("Default camera from command line arguments: %s"), *camId);
+		if (CameraComponents.Contains(camId))
+		{
+			SetActiveCamera(camId);
+		}
+	}
+
+	return true;
+}
+
+bool FDisplayClusterGameManager::CreateScreens()
+{
+	// Get local screen settings
+	FDisplayClusterConfigScreen localScreen;
+	if (GDisplayCluster->GetPrivateConfigMgr()->GetLocalScreen(localScreen) == false)
+	{
+		UE_LOG(LogDisplayClusterGame, Error, TEXT("Couldn't get projection screen settings"));
+		return false;
+	}
+
+	// Create screens
+	const TArray<FDisplayClusterConfigScreen> screens = GDisplayCluster->GetPrivateConfigMgr()->GetScreens();
+	for (const auto& screen : screens)
+	{
+		// Create screen
+		UDisplayClusterScreenComponent* pScreen = NewObject<UDisplayClusterScreenComponent>(VRRootActor, FName(*screen.Id), RF_Transient);
+		check(pScreen);
+
+		pScreen->AttachToComponent(VRRootActor->GetCollisionOffsetComponent(), FAttachmentTransformRules(EAttachmentRule::KeepRelative, false));
+		pScreen->RegisterComponent();
+
+		// Pass settings
+		pScreen->SetSettings(&screen);
+
+		// Is this active screen (for this node)?
+		if (screen.Id == localScreen.Id)
+			ActiveScreenComponent = pScreen;
+
+		// Store the screen
+		ScreenComponents.Add(screen.Id, pScreen);
+		SceneNodeComponents.Add(screen.Id, pScreen);
+	}
+
+	// Check if local screen was found
+	if (!ActiveScreenComponent)
+	{
+		UE_LOG(LogDisplayClusterGame, Error, TEXT("Local screen not found"));
+		return false;
+	}
+
+	return true;
+}
+
+bool FDisplayClusterGameManager::CreateNodes()
+{
+	// Create other nodes
+	const TArray<FDisplayClusterConfigSceneNode> nodes = GDisplayCluster->GetPrivateConfigMgr()->GetSceneNodes();
+	for (const auto& node : nodes)
+	{
+		UDisplayClusterSceneComponent* pNode = NewObject<UDisplayClusterSceneComponent>(VRRootActor, FName(*node.Id), RF_Transient);
+		check(pNode);
+
+		pNode->AttachToComponent(VRRootActor->GetCollisionOffsetComponent(), FAttachmentTransformRules(EAttachmentRule::KeepRelative, false));
+		pNode->RegisterComponent();
+
+		pNode->SetSettings(&node);
+		SceneNodeComponents.Add(node.Id, pNode);
+	}
+
+	return true;
+}
+
+bool FDisplayClusterGameManager::CreateCameras()
+{
+	const TArray<FDisplayClusterConfigCamera> cams = GDisplayCluster->GetPrivateConfigMgr()->GetCameras();
+	for (const auto& cam : cams)
+	{
+		UDisplayClusterCameraComponent* pCam = NewObject<UDisplayClusterCameraComponent>(VRRootActor, FName(*cam.Id), RF_Transient);
+		check(pCam);
+
+		pCam->AttachToComponent(VRRootActor->GetCollisionOffsetComponent(), FAttachmentTransformRules(EAttachmentRule::KeepRelative, false));
+		pCam->RegisterComponent();
+
+		pCam->SetSettings(&cam);
+		
+		CameraComponents.Add(cam.Id, pCam);
+		SceneNodeComponents.Add(cam.Id, pCam);
+
+		if (ActiveCameraComponent == nullptr)
+		{
+			ActiveCameraComponent = pCam;
+		}
+	}
+
+	// At least one camera must be set up
+	if (!ActiveCameraComponent)
+	{
+		UE_LOG(LogDisplayClusterGame, Warning, TEXT("No camera found"));
+		return false;
+	}
+
+	return CameraComponents.Num() > 0;
+}
+
+// Extracts array of values from a map
+template <typename ObjType>
+TArray<ObjType*> FDisplayClusterGameManager::GetMapValues(const TMap<FString, ObjType*>& container) const
+{
+	TArray<ObjType*> items;
+	container.GenerateValueArray(items);
+	return items;
+}
+
+// Gets item by id. Performs checks and logging.
+template <typename DataType>
+DataType* FDisplayClusterGameManager::GetItem(const TMap<FString, DataType*>& container, const FString& id, const FString& logHeader) const
+{
+	if (container.Contains(id))
+	{
+		return container[id];
+	}
+
+	UE_LOG(LogDisplayClusterGame, Warning, TEXT("%s: ID not found <%s>. Return nullptr."), *logHeader, *id);
+	return nullptr;
+}
diff --git a/Source/DisplayCluster/Private/Game/DisplayClusterGameManager.h b/Source/DisplayCluster/Private/Game/DisplayClusterGameManager.h
new file mode 100644
index 0000000000000000000000000000000000000000..f2bea767a78a2f4ad603636584850af1e08e832d
--- /dev/null
+++ b/Source/DisplayCluster/Private/Game/DisplayClusterGameManager.h
@@ -0,0 +1,127 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+
+#include "IPDisplayClusterGameManager.h"
+#include "DisplayClusterOperationMode.h"
+
+#include "DisplayClusterGameMode.h"
+#include "DisplayClusterPawn.h"
+#include "DisplayClusterSettings.h"
+#include "DisplayClusterScreenComponent.h"
+#include "DisplayClusterCameraComponent.h"
+
+
+/**
+ * Game manager. Responsible for building VR object hierarchy from a config file. Implements some in-game logic.
+ */
+class FDisplayClusterGameManager
+	: public    IPDisplayClusterGameManager
+{
+public:
+	FDisplayClusterGameManager();
+	virtual ~FDisplayClusterGameManager();
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterManager
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool Init(EDisplayClusterOperationMode OperationMode) override;
+	virtual void Release() override;
+	virtual bool StartSession(const FString& configPath, const FString& nodeId) override;
+	virtual void EndSession() override;
+	virtual bool StartScene(UWorld* pWorld) override;
+	virtual void EndScene() override;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterGameManager
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual ADisplayClusterPawn*                    GetRoot() const override;
+
+	virtual TArray<UDisplayClusterScreenComponent*> GetAllScreens() const override;
+	virtual UDisplayClusterScreenComponent*         GetActiveScreen() const override;
+	virtual UDisplayClusterScreenComponent*         GetScreenById(const FString& id) const override;
+	virtual int32                        GetScreensAmount() const override;
+
+	virtual TArray<UDisplayClusterCameraComponent*> GetAllCameras() const override;
+	virtual UDisplayClusterCameraComponent*         GetActiveCamera() const override;
+	virtual UDisplayClusterCameraComponent*         GetCameraById(const FString& id) const override;
+	virtual int32                        GetCamerasAmount() const override;
+	virtual void                         SetActiveCamera(int32 idx) override;
+	virtual void                         SetActiveCamera(const FString& id) override;
+
+	virtual TArray<UDisplayClusterSceneComponent*>  GetAllNodes() const override;
+	virtual UDisplayClusterSceneComponent*          GetNodeById(const FString& id) const override;
+
+	virtual USceneComponent*             GetTranslationDirectionComponent() const override;
+	virtual void                         SetTranslationDirectionComponent(USceneComponent* pComp) override;
+	virtual void                         SetTranslationDirectionComponent(const FString& id) override;
+
+	virtual USceneComponent*             GetRotateAroundComponent() const override;
+	virtual void                         SetRotateAroundComponent(USceneComponent* pComp) override;
+	virtual void                         SetRotateAroundComponent(const FString& id) override;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterGameManager
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool IsDisplayClusterActive() const override
+	{ return ((CurrentOperationMode != EDisplayClusterOperationMode::Disabled) && (CurrentGameMode ? CurrentGameMode->IsDisplayClusterActive() : false)); }
+	
+	virtual void SetDisplayClusterGameMode(ADisplayClusterGameMode* pGameMode) override
+	{ CurrentGameMode = pGameMode; }
+
+	virtual ADisplayClusterGameMode* GetDisplayClusterGameMode() const override
+	{ return CurrentGameMode; }
+
+	virtual void SetDisplayClusterSceneSettings(ADisplayClusterSettings* pSceneSettings) override
+	{ CurrentSceneSettings = pSceneSettings; }
+
+	virtual ADisplayClusterSettings* GetDisplayClusterSceneSettings() const override
+	{ return CurrentSceneSettings; }
+
+private:
+	// Creates DisplayCluster actor and fulfills with components hierarchy
+	bool InitializeDisplayClusterActor();
+
+	bool CreateScreens();
+	bool CreateNodes();
+	bool CreateCameras();
+
+	// Extracts array of values from a map
+	template <typename ObjType>
+	TArray<ObjType*> GetMapValues(const TMap<FString, ObjType*>& container) const;
+
+	// Gets item by id. Performs checks and logging.
+	template <typename DataType>
+	DataType* GetItem(const TMap<FString, DataType*>& container, const FString& id, const FString& logHeader) const;
+
+private:
+	// DisplayCluster root actor
+	ADisplayClusterPawn* VRRootActor = nullptr;
+	// Currently active projection screen (for this cluster node)
+	UDisplayClusterScreenComponent* ActiveScreenComponent = nullptr;
+	// Currently active camera (joint component)
+	UDisplayClusterCameraComponent* ActiveCameraComponent = nullptr;
+
+	// Available screens (from config file)
+	TMap<FString, UDisplayClusterScreenComponent*> ScreenComponents;
+	// Available cameras (from config file)
+	TMap<FString, UDisplayClusterCameraComponent*> CameraComponents;
+	// All available DisplayCluster nodes in hierarchy
+	TMap<FString, UDisplayClusterSceneComponent*> SceneNodeComponents;
+
+	EDisplayClusterOperationMode CurrentOperationMode;
+	FString ConfigPath;
+	FString ClusterNodeId;
+	UWorld* CurrentWorld;
+
+	ADisplayClusterSettings* CurrentSceneSettings = nullptr;
+	ADisplayClusterGameMode* CurrentGameMode = nullptr;
+
+	mutable FCriticalSection InternalsSyncScope;
+};
+
diff --git a/Source/DisplayCluster/Private/Game/IPDisplayClusterGameManager.h b/Source/DisplayCluster/Private/Game/IPDisplayClusterGameManager.h
new file mode 100644
index 0000000000000000000000000000000000000000..d0db9355e64b4ba200011e33510b93fa615e7d18
--- /dev/null
+++ b/Source/DisplayCluster/Private/Game/IPDisplayClusterGameManager.h
@@ -0,0 +1,29 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Game/IDisplayClusterGameManager.h"
+#include "IPDisplayClusterManager.h"
+
+class ADisplayClusterGameMode;
+class ADisplayClusterSettings;
+
+
+/**
+ * Game manager private interface
+ */
+struct IPDisplayClusterGameManager :
+	public IDisplayClusterGameManager,
+	public IPDisplayClusterManager
+{
+	virtual ~IPDisplayClusterGameManager()
+	{ }
+
+	virtual bool IsDisplayClusterActive() const = 0;
+
+	virtual void SetDisplayClusterGameMode(ADisplayClusterGameMode* pGameMode) = 0;
+	virtual ADisplayClusterGameMode* GetDisplayClusterGameMode() const = 0;
+
+	virtual void SetDisplayClusterSceneSettings(ADisplayClusterSettings* pSceneSettings) = 0;
+	virtual ADisplayClusterSettings* GetDisplayClusterSceneSettings() const = 0;
+};
diff --git a/Source/DisplayCluster/Private/IPDisplayCluster.h b/Source/DisplayCluster/Private/IPDisplayCluster.h
new file mode 100644
index 0000000000000000000000000000000000000000..19784d437131781e9238be10333399c5b5de267a
--- /dev/null
+++ b/Source/DisplayCluster/Private/IPDisplayCluster.h
@@ -0,0 +1,32 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "IDisplayCluster.h"
+#include "IPDisplayClusterManager.h"
+
+struct IPDisplayClusterRenderManager;
+struct IPDisplayClusterClusterManager;
+struct IPDisplayClusterInputManager;
+struct IPDisplayClusterConfigManager;
+struct IPDisplayClusterGameManager;
+
+class ADisplayClusterGameMode;
+class ADisplayClusterSettings;
+
+
+/**
+ * Private module interface
+ */
+struct IPDisplayCluster
+	: public IDisplayCluster
+	, public IPDisplayClusterManager
+{
+	virtual ~IPDisplayCluster() { }
+
+	virtual IPDisplayClusterRenderManager*    GetPrivateRenderMgr() const = 0;
+	virtual IPDisplayClusterClusterManager*   GetPrivateClusterMgr() const = 0;
+	virtual IPDisplayClusterInputManager*     GetPrivateInputMgr() const = 0;
+	virtual IPDisplayClusterConfigManager*    GetPrivateConfigMgr() const = 0;
+	virtual IPDisplayClusterGameManager*      GetPrivateGameMgr() const = 0;
+};
diff --git a/Source/DisplayCluster/Private/IPDisplayClusterManager.h b/Source/DisplayCluster/Private/IPDisplayClusterManager.h
new file mode 100644
index 0000000000000000000000000000000000000000..fbc0042fd93c736918b8d645f10d022b21c2523f
--- /dev/null
+++ b/Source/DisplayCluster/Private/IPDisplayClusterManager.h
@@ -0,0 +1,47 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "DisplayClusterOperationMode.h"
+
+
+class ADisplayClusterGameMode;
+class ADisplayClusterSettings;
+
+
+/**
+ * Private manager interface
+ */
+struct IPDisplayClusterManager
+{
+	virtual ~IPDisplayClusterManager() { }
+
+	// Called at start to initialize internals
+	virtual bool Init(EDisplayClusterOperationMode OperationMode)
+	{ return true; }
+
+	// Called before application/Editor exit to release internals
+	virtual void Release()
+	{ }
+
+	// Called on each session start before first level start (before the first tick)
+	virtual bool StartSession(const FString& configPath, const FString& nodeId)
+	{ return true; }
+
+	// Called on each session end at early step before exit (before UGameEngine::Preexit)
+	virtual void EndSession()
+	{ }
+
+	// Called each time a new game level starts
+	virtual bool StartScene(UWorld* pWorld)
+	{ return true; }
+
+	// Called when current level is going to be closed (i.e. when loading new map)
+	virtual void EndScene()
+	{ }
+
+	// Called every frame before world Tick
+	virtual void PreTick(float DeltaSeconds)
+	{ }
+};
diff --git a/Source/DisplayCluster/Private/Input/Devices/DisplayClusterInputDeviceBase.h b/Source/DisplayCluster/Private/Input/Devices/DisplayClusterInputDeviceBase.h
new file mode 100644
index 0000000000000000000000000000000000000000..4d0b529a4cd2a539bf1bcb67491ce654edd3bf00
--- /dev/null
+++ b/Source/DisplayCluster/Private/Input/Devices/DisplayClusterInputDeviceBase.h
@@ -0,0 +1,84 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "IDisplayClusterInputDevice.h"
+#include "DisplayClusterInputDeviceTraits.h"
+#include "Misc/DisplayClusterLog.h"
+
+#include "CoreMinimal.h"
+
+
+/**
+ * Abstract input device
+ */
+template <int DevTypeID>
+class FDisplayClusterInputDeviceBase
+	: public IDisplayClusterInputDevice
+{
+public:
+	typedef typename display_cluster_input_device_traits<DevTypeID>::dev_channel_data_type   TChannelData;
+
+public:
+	FDisplayClusterInputDeviceBase(const FDisplayClusterConfigInput& config) :
+		ConfigData(config)
+	{ }
+
+	virtual ~FDisplayClusterInputDeviceBase()
+	{ }
+
+public:
+	virtual bool GetChannelData(const uint8 channel, TChannelData& data) const
+	{
+		uint8 channelToGet = channel;
+		if (ConfigData.ChMap.Contains(channel))
+		{
+			channelToGet = (uint8)ConfigData.ChMap[channel];
+			UE_LOG(LogDisplayClusterInputVRPN, Verbose, TEXT("DevType %d, channel %d - remapped to channel %d"), DevTypeID, channel, channelToGet);
+		}
+
+		if (!DeviceData.Contains(static_cast<int32>(channelToGet)))
+		{
+			UE_LOG(LogDisplayClusterInputVRPN, Verbose, TEXT("%s - channel %d data is not available yet"), *GetId(), channelToGet);
+			return false;
+		}
+
+		data = DeviceData[static_cast<int32>(channelToGet)];
+
+		return true;
+	}
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterInputDevice
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual FString GetId() const override
+	{ return ConfigData.Id; }
+
+	virtual FString GetType() const override
+	{ return ConfigData.Type; }
+
+	virtual EDisplayClusterInputDevice GetTypeId() const override
+	{ return static_cast<EDisplayClusterInputDevice>(DevTypeID); }
+
+	virtual FDisplayClusterConfigInput GetConfig() const override
+	{ return ConfigData; }
+
+	virtual void PreUpdate() override
+	{ }
+
+	virtual void Update() override
+	{ }
+
+	virtual void PostUpdate() override
+	{ }
+
+	virtual FString ToString() const override
+	{ return FString::Printf(TEXT("DisplayCluster input device: id=%s, type=%s"), *GetId(), *GetType()); }
+
+protected:
+	// Original config data
+	const FDisplayClusterConfigInput ConfigData;
+	// Device data
+	TMap<int32, TChannelData> DeviceData;
+};
diff --git a/Source/DisplayCluster/Private/Input/Devices/DisplayClusterInputDeviceTraits.h b/Source/DisplayCluster/Private/Input/Devices/DisplayClusterInputDeviceTraits.h
new file mode 100644
index 0000000000000000000000000000000000000000..2b908d8fca6f664aaa47f5536cc49b5c3fbf9478
--- /dev/null
+++ b/Source/DisplayCluster/Private/Input/Devices/DisplayClusterInputDeviceTraits.h
@@ -0,0 +1,52 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Input/Devices/VRPN/Analog/DisplayClusterVrpnAnalogInputData.h"
+#include "Input/Devices/VRPN/Button/DisplayClusterVrpnButtonInputData.h"
+#include "Input/Devices/VRPN/Tracker/DisplayClusterVrpnTrackerInputData.h"
+
+
+/**
+ * Available types of input devices
+ */
+enum EDisplayClusterInputDevice
+{
+	VrpnAnalog = 0,
+	VrpnButton,
+	VrpnTracker
+};
+
+
+/**
+ * Input device traits
+ */
+template<int DevTypeID>
+struct display_cluster_input_device_traits { };
+
+/**
+ * Specialization for VRPN analog device
+ */
+template <>
+struct display_cluster_input_device_traits<EDisplayClusterInputDevice::VrpnAnalog>
+{
+	typedef FDisplayClusterVrpnAnalogChannelData           dev_channel_data_type;
+};
+
+/**
+ * Specialization for VRPN button device
+ */
+template <>
+struct display_cluster_input_device_traits<EDisplayClusterInputDevice::VrpnButton>
+{
+	typedef FDisplayClusterVrpnButtonChannelData           dev_channel_data_type;
+};
+
+/**
+ * Specialization for VRPN tracker device
+ */
+template <>
+struct display_cluster_input_device_traits<EDisplayClusterInputDevice::VrpnTracker>
+{
+	typedef FDisplayClusterVrpnTrackerChannelData          dev_channel_data_type;
+};
diff --git a/Source/DisplayCluster/Private/Input/Devices/IDisplayClusterInputDevice.h b/Source/DisplayCluster/Private/Input/Devices/IDisplayClusterInputDevice.h
new file mode 100644
index 0000000000000000000000000000000000000000..c318d04f4d57a83f587728bda558478a0a1fc41a
--- /dev/null
+++ b/Source/DisplayCluster/Private/Input/Devices/IDisplayClusterInputDevice.h
@@ -0,0 +1,31 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "DisplayClusterInputDeviceTraits.h"
+#include "IDisplayClusterStringSerializable.h"
+
+#include "Config/DisplayClusterConfigTypes.h"
+
+
+/**
+ * Interface for input devices
+ */
+struct IDisplayClusterInputDevice
+	: public IDisplayClusterStringSerializable
+{
+	virtual ~IDisplayClusterInputDevice() { }
+
+	virtual FString GetId() const = 0;
+	virtual FString GetType() const = 0;
+	virtual EDisplayClusterInputDevice GetTypeId() const = 0;
+	virtual FDisplayClusterConfigInput GetConfig() const = 0;
+
+	virtual bool Initialize() = 0;
+	virtual void PreUpdate() = 0;
+	virtual void Update() = 0;
+	virtual void PostUpdate() = 0;
+
+	virtual FString ToString() const = 0;
+};
+
diff --git a/Source/DisplayCluster/Private/Input/Devices/VRPN/Analog/DisplayClusterVrpnAnalogInputData.h b/Source/DisplayCluster/Private/Input/Devices/VRPN/Analog/DisplayClusterVrpnAnalogInputData.h
new file mode 100644
index 0000000000000000000000000000000000000000..b8da4c1239ccf5f490e656c1e5e580fc0e42be06
--- /dev/null
+++ b/Source/DisplayCluster/Private/Input/Devices/VRPN/Analog/DisplayClusterVrpnAnalogInputData.h
@@ -0,0 +1,13 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+
+/**
+ * VRPN analog device data type
+ */
+struct FDisplayClusterVrpnAnalogChannelData
+{
+	float axisValue;
+};
diff --git a/Source/DisplayCluster/Private/Input/Devices/VRPN/Analog/DisplayClusterVrpnAnalogInputDataHolder.cpp b/Source/DisplayCluster/Private/Input/Devices/VRPN/Analog/DisplayClusterVrpnAnalogInputDataHolder.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..a6e465ca002c523f11e942818e388570303d7be2
--- /dev/null
+++ b/Source/DisplayCluster/Private/Input/Devices/VRPN/Analog/DisplayClusterVrpnAnalogInputDataHolder.cpp
@@ -0,0 +1,61 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterVrpnAnalogInputDataHolder.h"
+#include "Misc/DisplayClusterLog.h"
+
+
+FDisplayClusterVrpnAnalogInputDataHolder::FDisplayClusterVrpnAnalogInputDataHolder(const FDisplayClusterConfigInput& config) :
+	FDisplayClusterInputDeviceBase<EDisplayClusterInputDevice::VrpnAnalog>(config)
+{
+}
+
+FDisplayClusterVrpnAnalogInputDataHolder::~FDisplayClusterVrpnAnalogInputDataHolder()
+{
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterInputDevice
+//////////////////////////////////////////////////////////////////////////////////////////////
+bool FDisplayClusterVrpnAnalogInputDataHolder::Initialize()
+{
+	return true;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterStringSerializable
+//////////////////////////////////////////////////////////////////////////////////////////////
+FString FDisplayClusterVrpnAnalogInputDataHolder::SerializeToString() const
+{
+	FString result;
+	result.Reserve(128);
+
+	for (auto it = DeviceData.CreateConstIterator(); it; ++it)
+	{
+		result += FString::Printf(TEXT("%d%s%f%s"), it->Key, SerializationDelimiter, it->Value.axisValue, SerializationDelimiter);
+	}
+
+	return result;
+}
+
+bool FDisplayClusterVrpnAnalogInputDataHolder::DeserializeFromString(const FString& data)
+{
+	TArray<FString> parsed;
+	data.ParseIntoArray(parsed, SerializationDelimiter);
+
+	if (parsed.Num() % SerializationItems)
+	{
+		UE_LOG(LogDisplayClusterInputVRPN, Error, TEXT("Wrong items amount after deserialization [%s]"), *data);
+		return false;
+	}
+
+	for (int i = 0; i < parsed.Num(); i += SerializationItems)
+	{
+		const int   ch = FCString::Atoi(*parsed[i]);
+		const float val = FCString::Atof(*parsed[i + 1]);
+		DeviceData.Add(ch, FDisplayClusterVrpnAnalogChannelData{ val });
+	}
+
+	return true;
+}
diff --git a/Source/DisplayCluster/Private/Input/Devices/VRPN/Analog/DisplayClusterVrpnAnalogInputDataHolder.h b/Source/DisplayCluster/Private/Input/Devices/VRPN/Analog/DisplayClusterVrpnAnalogInputDataHolder.h
new file mode 100644
index 0000000000000000000000000000000000000000..f1097a93c12d4727de2a8337d18d930eb17aa4fc
--- /dev/null
+++ b/Source/DisplayCluster/Private/Input/Devices/VRPN/Analog/DisplayClusterVrpnAnalogInputDataHolder.h
@@ -0,0 +1,39 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "Input/Devices/DisplayClusterInputDeviceBase.h"
+#include "Input/Devices/DisplayClusterInputDeviceTraits.h"
+
+struct FDisplayClusterConfigInput;
+
+
+/**
+ * VRPN analog device data holder. Responsible for data serialization and deserialization.
+ */
+class FDisplayClusterVrpnAnalogInputDataHolder
+	: public FDisplayClusterInputDeviceBase<EDisplayClusterInputDevice::VrpnAnalog>
+{
+public:
+	FDisplayClusterVrpnAnalogInputDataHolder(const FDisplayClusterConfigInput& config);
+	virtual ~FDisplayClusterVrpnAnalogInputDataHolder();
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterInputDevice
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool Initialize() override;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterStringSerializable
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual FString SerializeToString() const override final;
+	virtual bool    DeserializeFromString(const FString& data) override final;
+
+private:
+	// Serialization constants
+	static constexpr auto SerializationDelimiter = TEXT("@");
+	static constexpr auto SerializationItems = 2;
+};
diff --git a/Source/DisplayCluster/Private/Input/Devices/VRPN/Analog/DisplayClusterVrpnAnalogInputDevice.cpp b/Source/DisplayCluster/Private/Input/Devices/VRPN/Analog/DisplayClusterVrpnAnalogInputDevice.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b04c0595b8b15f50e95bc129dd6981e0f961ca7a
--- /dev/null
+++ b/Source/DisplayCluster/Private/Input/Devices/VRPN/Analog/DisplayClusterVrpnAnalogInputDevice.cpp
@@ -0,0 +1,75 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterVrpnAnalogInputDevice.h"
+
+#include "Misc/DisplayClusterHelpers.h"
+#include "Misc/DisplayClusterLog.h"
+
+#include "DisplayClusterStrings.h"
+
+
+FDisplayClusterVrpnAnalogInputDevice::FDisplayClusterVrpnAnalogInputDevice(const FDisplayClusterConfigInput& config) :
+	FDisplayClusterVrpnAnalogInputDataHolder(config)
+{
+}
+
+FDisplayClusterVrpnAnalogInputDevice::~FDisplayClusterVrpnAnalogInputDevice()
+{
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterInputDevice
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterVrpnAnalogInputDevice::Update()
+{
+	if (DevImpl)
+	{
+		UE_LOG(LogDisplayClusterInputVRPN, Verbose, TEXT("Updating device: %s"), *GetId());
+		DevImpl->mainloop();
+	}
+}
+
+bool FDisplayClusterVrpnAnalogInputDevice::Initialize()
+{
+	FString addr;
+	if (!DisplayClusterHelpers::str::ExtractParam(ConfigData.Params, FString(DisplayClusterStrings::cfg::data::input::Address), addr))
+	{
+		UE_LOG(LogDisplayClusterInputVRPN, Error, TEXT("%s - device address not found"), *ToString());
+		return false;
+	}
+
+	// Instantiate device implementation
+	DevImpl.Reset(new vrpn_Analog_Remote(TCHAR_TO_UTF8(*addr)));
+	
+	// Register update handler
+	if (DevImpl->register_change_handler(this, &FDisplayClusterVrpnAnalogInputDevice::HandleAnalogDevice) != 0)
+	{
+		UE_LOG(LogDisplayClusterInputVRPN, Error, TEXT("%s - couldn't register VRPN change handler"), *ToString());
+		return false;
+	}
+
+	// Base initialization
+	return FDisplayClusterVrpnAnalogInputDataHolder::Initialize();
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterVrpnAnalogInputDevice
+//////////////////////////////////////////////////////////////////////////////////////////////
+void VRPN_CALLBACK FDisplayClusterVrpnAnalogInputDevice::HandleAnalogDevice(void * userData, vrpn_ANALOGCB const an)
+{
+	auto pDev = reinterpret_cast<FDisplayClusterVrpnAnalogInputDevice*>(userData);
+
+	for (int32 i = 0; i < an.num_channel; ++i)
+	{
+		auto pItem = pDev->DeviceData.Find(i);
+		if (!pItem)
+		{
+			pItem = &pDev->DeviceData.Add(i);
+		}
+
+		pItem->axisValue = static_cast<float>(an.channel[i]);
+		UE_LOG(LogDisplayClusterInputVRPN, VeryVerbose, TEXT("Axis %s:%d - %f"), *pDev->GetId(), i, pItem->axisValue);
+	}
+}
diff --git a/Source/DisplayCluster/Private/Input/Devices/VRPN/Analog/DisplayClusterVrpnAnalogInputDevice.h b/Source/DisplayCluster/Private/Input/Devices/VRPN/Analog/DisplayClusterVrpnAnalogInputDevice.h
new file mode 100644
index 0000000000000000000000000000000000000000..a0fbd6a6b60fc8661cf3419cd8ab4a543ded38a3
--- /dev/null
+++ b/Source/DisplayCluster/Private/Input/Devices/VRPN/Analog/DisplayClusterVrpnAnalogInputDevice.h
@@ -0,0 +1,42 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "DisplayClusterVrpnAnalogInputDataHolder.h"
+
+#if PLATFORM_WINDOWS
+#include "Windows/AllowWindowsPlatformTypes.h"
+#endif
+
+#include "vrpn/vrpn_Analog.h"
+
+#if PLATFORM_WINDOWS
+#include "Windows/HideWindowsPlatformTypes.h"
+#endif
+
+
+/**
+ * VRPN analog device implementation
+ */
+class FDisplayClusterVrpnAnalogInputDevice
+	: public FDisplayClusterVrpnAnalogInputDataHolder
+{
+public:
+	FDisplayClusterVrpnAnalogInputDevice(const FDisplayClusterConfigInput& config);
+	virtual ~FDisplayClusterVrpnAnalogInputDevice();
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterInputDevice
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void Update() override;
+	virtual bool Initialize() override;
+
+private:
+	// Data update handler
+	static void VRPN_CALLBACK HandleAnalogDevice(void *userData, vrpn_ANALOGCB const tr);
+
+private:
+	// The device (PIMPL)
+	TUniquePtr<vrpn_Analog_Remote> DevImpl;
+};
diff --git a/Source/DisplayCluster/Private/Input/Devices/VRPN/Button/DisplayClusterVrpnButtonInputData.h b/Source/DisplayCluster/Private/Input/Devices/VRPN/Button/DisplayClusterVrpnButtonInputData.h
new file mode 100644
index 0000000000000000000000000000000000000000..cf8aae666bde5b0330e81e6966a7c1a4f943bd27
--- /dev/null
+++ b/Source/DisplayCluster/Private/Input/Devices/VRPN/Button/DisplayClusterVrpnButtonInputData.h
@@ -0,0 +1,15 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+
+
+/**
+ * VRPN button device data type
+ */
+struct FDisplayClusterVrpnButtonChannelData
+{
+	bool btnStateOld;
+	bool btnStateNew;
+};
diff --git a/Source/DisplayCluster/Private/Input/Devices/VRPN/Button/DisplayClusterVrpnButtonInputDataHolder.cpp b/Source/DisplayCluster/Private/Input/Devices/VRPN/Button/DisplayClusterVrpnButtonInputDataHolder.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..ca414a450aea7bec05e56a2533068f049a7fd32d
--- /dev/null
+++ b/Source/DisplayCluster/Private/Input/Devices/VRPN/Button/DisplayClusterVrpnButtonInputDataHolder.cpp
@@ -0,0 +1,62 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterVrpnButtonInputDataHolder.h"
+#include "Misc/DisplayClusterLog.h"
+
+
+FDisplayClusterVrpnButtonInputDataHolder::FDisplayClusterVrpnButtonInputDataHolder(const FDisplayClusterConfigInput& config) :
+	FDisplayClusterInputDeviceBase<EDisplayClusterInputDevice::VrpnButton>(config)
+{
+}
+
+FDisplayClusterVrpnButtonInputDataHolder::~FDisplayClusterVrpnButtonInputDataHolder()
+{
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterInputDevice
+//////////////////////////////////////////////////////////////////////////////////////////////
+bool FDisplayClusterVrpnButtonInputDataHolder::Initialize()
+{
+	return true;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterStringSerializable
+//////////////////////////////////////////////////////////////////////////////////////////////
+FString FDisplayClusterVrpnButtonInputDataHolder::SerializeToString() const
+{
+	FString result;
+	result.Reserve(64);
+
+	for (auto it = DeviceData.CreateConstIterator(); it; ++it)
+	{
+		result += FString::Printf(TEXT("%d%s%d%s%d%s"), it->Key, SerializationDelimiter, it->Value.btnStateOld, SerializationDelimiter, it->Value.btnStateNew, SerializationDelimiter);
+	}
+
+	return result;
+}
+
+bool FDisplayClusterVrpnButtonInputDataHolder::DeserializeFromString(const FString& data)
+{
+	TArray<FString> parsed;
+	data.ParseIntoArray(parsed, SerializationDelimiter);
+
+	if (parsed.Num() % SerializationItems)
+	{
+		UE_LOG(LogDisplayClusterInputVRPN, Error, TEXT("Wrong items amount after deserialization [%s]"), *data);
+		return false;
+	}
+
+	for (int i = 0; i < parsed.Num(); i += SerializationItems)
+	{
+		const int  ch = FCString::Atoi(*parsed[i]);
+		const bool stateOld = (FCString::Atoi(*parsed[i + 1]) != 0);
+		const bool stateNew = (FCString::Atoi(*parsed[i + 2]) != 0);
+		DeviceData.Add(ch, FDisplayClusterVrpnButtonChannelData{ stateOld, stateNew });
+	}
+
+	return true;
+}
diff --git a/Source/DisplayCluster/Private/Input/Devices/VRPN/Button/DisplayClusterVrpnButtonInputDataHolder.h b/Source/DisplayCluster/Private/Input/Devices/VRPN/Button/DisplayClusterVrpnButtonInputDataHolder.h
new file mode 100644
index 0000000000000000000000000000000000000000..f3ddaf4c1440d6403e490da54804662748becf80
--- /dev/null
+++ b/Source/DisplayCluster/Private/Input/Devices/VRPN/Button/DisplayClusterVrpnButtonInputDataHolder.h
@@ -0,0 +1,38 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Input/Devices/DisplayClusterInputDeviceTraits.h"
+#include "Input/Devices/DisplayClusterInputDeviceBase.h"
+
+#include "CoreMinimal.h"
+
+
+/**
+ * VRPN button device data holder. Responsible for data serialization and deserialization.
+ */
+class FDisplayClusterVrpnButtonInputDataHolder
+	: public FDisplayClusterInputDeviceBase<EDisplayClusterInputDevice::VrpnButton>
+{
+public:
+	FDisplayClusterVrpnButtonInputDataHolder(const FDisplayClusterConfigInput& config);
+	virtual ~FDisplayClusterVrpnButtonInputDataHolder();
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterInputDevice
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool Initialize() override;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterStringSerializable
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual FString SerializeToString() const override final;
+	virtual bool    DeserializeFromString(const FString& data) override final;
+
+private:
+	// Serialization constants
+	static constexpr auto SerializationDelimiter = TEXT("@");
+	static constexpr auto SerializationItems = 3;
+};
diff --git a/Source/DisplayCluster/Private/Input/Devices/VRPN/Button/DisplayClusterVrpnButtonInputDevice.cpp b/Source/DisplayCluster/Private/Input/Devices/VRPN/Button/DisplayClusterVrpnButtonInputDevice.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..eef4de74fa018e42c16c844737b8ebb0430bf1ff
--- /dev/null
+++ b/Source/DisplayCluster/Private/Input/Devices/VRPN/Button/DisplayClusterVrpnButtonInputDevice.cpp
@@ -0,0 +1,91 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterVrpnButtonInputDevice.h"
+
+#include "Misc/DisplayClusterHelpers.h"
+#include "Misc/DisplayClusterLog.h"
+
+#include "DisplayClusterStrings.h"
+
+
+FDisplayClusterVrpnButtonInputDevice::FDisplayClusterVrpnButtonInputDevice(const FDisplayClusterConfigInput& config) :
+	FDisplayClusterVrpnButtonInputDataHolder(config)
+{
+}
+
+FDisplayClusterVrpnButtonInputDevice::~FDisplayClusterVrpnButtonInputDevice()
+{
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterInputDevice
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterVrpnButtonInputDevice::PreUpdate()
+{
+	// Update 'old' states before calling mainloop
+	for (auto it = DeviceData.CreateIterator(); it; ++it)
+	{
+		it->Value.btnStateOld = it->Value.btnStateNew;
+	}
+}
+
+void FDisplayClusterVrpnButtonInputDevice::Update()
+{
+	if (DevImpl)
+	{
+		UE_LOG(LogDisplayClusterInputVRPN, Verbose, TEXT("Updating device: %s"), *GetId());
+		DevImpl->mainloop();
+	}
+}
+
+bool FDisplayClusterVrpnButtonInputDevice::Initialize()
+{
+	FString addr;
+	if (!DisplayClusterHelpers::str::ExtractParam(ConfigData.Params, FString(DisplayClusterStrings::cfg::data::input::Address), addr))
+	{
+		UE_LOG(LogDisplayClusterInputVRPN, Error, TEXT("%s - device address not found"), *ToString());
+		return false;
+	}
+
+	// Instantiate device implementation
+	DevImpl.Reset(new vrpn_Button_Remote(TCHAR_TO_UTF8(*addr)));
+	// Register update handler
+	if(DevImpl->register_change_handler(this, &FDisplayClusterVrpnButtonInputDevice::HandleButtonDevice) != 0)
+	{
+		UE_LOG(LogDisplayClusterInputVRPN, Error, TEXT("%s - couldn't register VRPN change handler"), *ToString());
+		return false;
+	}
+
+	// Base initialization
+	return FDisplayClusterVrpnButtonInputDataHolder::Initialize();
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterVrpnButtonInputDevice
+//////////////////////////////////////////////////////////////////////////////////////////////
+void VRPN_CALLBACK FDisplayClusterVrpnButtonInputDevice::HandleButtonDevice(void *userData, vrpn_BUTTONCB const b)
+{
+	auto pDev = reinterpret_cast<FDisplayClusterVrpnButtonInputDevice*>(userData);
+	
+	auto pItem = pDev->DeviceData.Find(b.button);
+	if (!pItem)
+	{
+		pItem = &pDev->DeviceData.Add(b.button);
+		// Explicit initial old state set
+		pItem->btnStateOld = false;
+	}
+
+	//@note: Actually the button can change state for several time during one update cycle. For example
+	//       it could change 0->1->0. Then we will send only the latest state and as a result the state
+	//       change won't be processed. I don't process such situations because it's not ok if button
+	//       changes the state so quickly. It's probably a contact shiver or something else. Normal button
+	//       usage will lead to state change separation between update frames.
+
+
+	// Convert button state from int to bool here. Actually VRPN has only two states for
+	// buttons (0-released, 1-pressed) but still uses int32 type for the state.
+	pItem->btnStateNew = (b.state != 0);
+	UE_LOG(LogDisplayClusterInputVRPN, VeryVerbose, TEXT("Button %s:%d - %d"), *pDev->GetId(), b.button, b.state);
+}
diff --git a/Source/DisplayCluster/Private/Input/Devices/VRPN/Button/DisplayClusterVrpnButtonInputDevice.h b/Source/DisplayCluster/Private/Input/Devices/VRPN/Button/DisplayClusterVrpnButtonInputDevice.h
new file mode 100644
index 0000000000000000000000000000000000000000..4ce726deafd8ef7fe2f9d150319ef2e9fd43178b
--- /dev/null
+++ b/Source/DisplayCluster/Private/Input/Devices/VRPN/Button/DisplayClusterVrpnButtonInputDevice.h
@@ -0,0 +1,43 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "DisplayClusterVrpnButtonInputDataHolder.h"
+
+#if PLATFORM_WINDOWS
+#include "Windows/AllowWindowsPlatformTypes.h"
+#endif
+
+#include "vrpn/vrpn_Button.h"
+
+#if PLATFORM_WINDOWS
+#include "Windows/HideWindowsPlatformTypes.h"
+#endif
+
+
+/**
+ * VRPN button device implementation
+ */
+class FDisplayClusterVrpnButtonInputDevice
+	: public FDisplayClusterVrpnButtonInputDataHolder
+{
+public:
+	FDisplayClusterVrpnButtonInputDevice(const FDisplayClusterConfigInput& config);
+	virtual ~FDisplayClusterVrpnButtonInputDevice();
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterInputDevice
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void PreUpdate() override;
+	virtual void Update() override;
+	virtual bool Initialize() override;
+
+private:
+	// Data update handler
+	static void VRPN_CALLBACK HandleButtonDevice(void *userData, vrpn_BUTTONCB const b);
+
+private:
+	// The device (PIMPL)
+	TUniquePtr<vrpn_Button_Remote> DevImpl;
+};
diff --git a/Source/DisplayCluster/Private/Input/Devices/VRPN/Tracker/DisplayClusterVrpnTrackerInputData.h b/Source/DisplayCluster/Private/Input/Devices/VRPN/Tracker/DisplayClusterVrpnTrackerInputData.h
new file mode 100644
index 0000000000000000000000000000000000000000..91f4fd3594acef44f806b4268b7620eef836a8da
--- /dev/null
+++ b/Source/DisplayCluster/Private/Input/Devices/VRPN/Tracker/DisplayClusterVrpnTrackerInputData.h
@@ -0,0 +1,15 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+
+
+/**
+ * VRPN tracker device data type
+ */
+struct FDisplayClusterVrpnTrackerChannelData
+{
+	FVector  trLoc;
+	FQuat    trQuat;
+};
diff --git a/Source/DisplayCluster/Private/Input/Devices/VRPN/Tracker/DisplayClusterVrpnTrackerInputDataHolder.cpp b/Source/DisplayCluster/Private/Input/Devices/VRPN/Tracker/DisplayClusterVrpnTrackerInputDataHolder.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..873240f19c0ae8d31812c71dbf3216f4ccdae339
--- /dev/null
+++ b/Source/DisplayCluster/Private/Input/Devices/VRPN/Tracker/DisplayClusterVrpnTrackerInputDataHolder.cpp
@@ -0,0 +1,93 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterVrpnTrackerInputDataHolder.h"
+#include "Misc/DisplayClusterLog.h"
+
+
+namespace
+{
+	// Create a FQuat from a string that is in the same format as generated by
+	// FQuat::ToString.
+	// FQuat is missing InitializeFromString member function.
+	FQuat QuatFromString(const FString& InSourceString)
+	{
+		FQuat Result;
+		const bool bSuccessful
+			=  FParse::Value( *InSourceString, TEXT("X="), Result.X )
+			&& FParse::Value( *InSourceString, TEXT("Y="), Result.Y )
+			&& FParse::Value( *InSourceString, TEXT("Z="), Result.Z )
+			&& FParse::Value( *InSourceString, TEXT("W="), Result.W );
+
+		if (!bSuccessful)
+		{
+			UE_LOG(LogDisplayClusterInputVRPN, Error, TEXT("Parsing FQuat from string '%s' failed!"), *InSourceString);
+			Result = FQuat::Identity;
+		}
+
+		return Result;
+	}
+
+} // namespace
+
+
+
+FDisplayClusterVrpnTrackerInputDataHolder::FDisplayClusterVrpnTrackerInputDataHolder(const FDisplayClusterConfigInput& config) :
+	FDisplayClusterInputDeviceBase<EDisplayClusterInputDevice::VrpnTracker>(config)
+{
+}
+
+FDisplayClusterVrpnTrackerInputDataHolder::~FDisplayClusterVrpnTrackerInputDataHolder()
+{
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterInputDevice
+//////////////////////////////////////////////////////////////////////////////////////////////
+bool FDisplayClusterVrpnTrackerInputDataHolder::Initialize()
+{
+	return true;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterStringSerializable
+//////////////////////////////////////////////////////////////////////////////////////////////
+FString FDisplayClusterVrpnTrackerInputDataHolder::SerializeToString() const
+{
+	FString result;
+	result.Reserve(256);
+
+	for (auto it = DeviceData.CreateConstIterator(); it; ++it)
+	{
+		result += FString::Printf(TEXT("%d%s%s%s%s%s"),
+			it->Key, SerializationDelimiter, *it->Value.trLoc.ToString(), SerializationDelimiter, *it->Value.trQuat.ToString(), SerializationDelimiter);
+	}
+
+	return result;
+}
+
+bool FDisplayClusterVrpnTrackerInputDataHolder::DeserializeFromString(const FString& data)
+{
+	TArray<FString> parsed;
+	data.ParseIntoArray(parsed, SerializationDelimiter);
+
+	if (parsed.Num() % SerializationItems)
+	{
+		UE_LOG(LogDisplayClusterInputVRPN, Error, TEXT("Wrong items amount after deserialization [%s]"), *data);
+		return false;
+	}
+
+	for (int i = 0; i < parsed.Num(); i += SerializationItems)
+	{
+		const int  ch = FCString::Atoi(*parsed[i]);
+		FVector  loc;
+		FQuat    quat = QuatFromString(parsed[i + 2]);
+		loc.InitFromString(parsed[i + 1]);
+
+		DeviceData.Add(ch, FDisplayClusterVrpnTrackerChannelData{ loc, quat });
+	}
+
+	return true;
+}
+
diff --git a/Source/DisplayCluster/Private/Input/Devices/VRPN/Tracker/DisplayClusterVrpnTrackerInputDataHolder.h b/Source/DisplayCluster/Private/Input/Devices/VRPN/Tracker/DisplayClusterVrpnTrackerInputDataHolder.h
new file mode 100644
index 0000000000000000000000000000000000000000..d4eb241ea0271887f2853950c69f43a1bcce0608
--- /dev/null
+++ b/Source/DisplayCluster/Private/Input/Devices/VRPN/Tracker/DisplayClusterVrpnTrackerInputDataHolder.h
@@ -0,0 +1,38 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Input/Devices/DisplayClusterInputDeviceTraits.h"
+#include "Input/Devices/DisplayClusterInputDeviceBase.h"
+
+#include "CoreMinimal.h"
+
+
+/**
+ * VRPN tracker device data holder. Responsible for data serialization and deserialization.
+ */
+class FDisplayClusterVrpnTrackerInputDataHolder
+	: public FDisplayClusterInputDeviceBase<EDisplayClusterInputDevice::VrpnTracker>
+{
+public:
+	FDisplayClusterVrpnTrackerInputDataHolder(const FDisplayClusterConfigInput& config);
+	virtual ~FDisplayClusterVrpnTrackerInputDataHolder();
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterInputDevice
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool Initialize() override;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterStringSerializable
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual FString SerializeToString() const override final;
+	virtual bool    DeserializeFromString(const FString& data) override final;
+
+private:
+	// Serialization constants
+	static constexpr auto SerializationDelimiter = TEXT("@");
+	static constexpr auto SerializationItems = 3;
+};
diff --git a/Source/DisplayCluster/Private/Input/Devices/VRPN/Tracker/DisplayClusterVrpnTrackerInputDevice.cpp b/Source/DisplayCluster/Private/Input/Devices/VRPN/Tracker/DisplayClusterVrpnTrackerInputDevice.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..1b476f7319774f15eaeda43103042a4c371aabf4
--- /dev/null
+++ b/Source/DisplayCluster/Private/Input/Devices/VRPN/Tracker/DisplayClusterVrpnTrackerInputDevice.cpp
@@ -0,0 +1,264 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterVrpnTrackerInputDevice.h"
+
+#include "Misc/DisplayClusterHelpers.h"
+#include "Misc/DisplayClusterLog.h"
+
+#include "DisplayClusterBuildConfig.h"
+#include "DisplayClusterStrings.h"
+
+
+FDisplayClusterVrpnTrackerInputDevice::FDisplayClusterVrpnTrackerInputDevice(const FDisplayClusterConfigInput& config) :
+	FDisplayClusterVrpnTrackerInputDataHolder(config)
+{
+}
+
+FDisplayClusterVrpnTrackerInputDevice::~FDisplayClusterVrpnTrackerInputDevice()
+{
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterInputDevice
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterVrpnTrackerInputDevice::PreUpdate()
+{
+	if (DevImpl)
+	{
+		UE_LOG(LogDisplayClusterInputVRPN, Verbose, TEXT("Updating device: %s"), *GetId());
+		DevImpl->mainloop();
+
+		const double StartTime = FPlatformTime::Seconds();
+		ReceivedReport = false;
+		while (!ReceivedReport && !Lost)
+		{
+			DevImpl->mainloop();
+			if (!ReceivedReport && (FPlatformTime::Seconds() - StartTime) >= LostTimeout)
+			{
+				Lost = true;
+				break;
+			}
+		}
+	}
+
+	// Perform coordinates conversion
+	for (auto it = DeviceData.CreateIterator(); it; ++it)
+	{
+		if (DirtyMap.Contains(it->Key))
+		{
+			// Convert data from updated channels only
+			if (DirtyMap[it->Key] == true)
+			{
+				TransformCoordinates(it->Value);
+				DirtyMap[it->Key] = false;
+			}
+		}
+	}
+}
+	
+bool FDisplayClusterVrpnTrackerInputDevice::Initialize()
+{
+	FString addr;
+	if (!DisplayClusterHelpers::str::ExtractParam(ConfigData.Params, DisplayClusterStrings::cfg::data::input::Address, addr))
+	{
+		UE_LOG(LogDisplayClusterInputVRPN, Error, TEXT("%s - device address not found"), *ToString());
+		return false;
+	}
+
+	// Instantiate device implementation
+	DevImpl.Reset(new vrpn_Tracker_Remote(TCHAR_TO_UTF8(*addr)));
+
+	// Register update handler
+	if (DevImpl->register_change_handler(this, &FDisplayClusterVrpnTrackerInputDevice::HandleTrackerDevice) != 0)
+	{
+		UE_LOG(LogDisplayClusterInputVRPN, Error, TEXT("%s - couldn't register VRPN change handler"), *ToString());
+		return false;
+	}
+
+	// Extract tracker location
+	FString loc;
+	if (!DisplayClusterHelpers::str::ExtractParam(ConfigData.Params, DisplayClusterStrings::cfg::data::Loc, loc, false))
+	{
+		UE_LOG(LogDisplayClusterInputVRPN, Error, TEXT("%s - tracker origin location not found"), *ToString());
+		return false;
+	}
+
+	// Extract tracker rotation
+	FString rot;
+	if (!DisplayClusterHelpers::str::ExtractParam(ConfigData.Params, DisplayClusterStrings::cfg::data::Rot, rot, false))
+	{
+		UE_LOG(LogDisplayClusterInputVRPN, Error, TEXT("%s - tracker origin rotation not found"), *ToString());
+		return false;
+	}
+
+	// Parse location
+	if (!OriginLoc.InitFromString(loc))
+	{
+		UE_LOG(LogDisplayClusterInputVRPN, Error, TEXT("%s - unable to parse the tracker origin location"), *ToString());
+		return false;
+	}
+
+	// Parse rotation
+	FRotator originRot;
+	if (!originRot.InitFromString(rot))
+	{
+		UE_LOG(LogDisplayClusterInputVRPN, Error, TEXT("%s - unable to parse the tracker origin rotation"), *ToString());
+		return false;
+	}
+	else
+	{
+		OriginQuat = originRot.Quaternion();
+	}
+
+	// Parse 'right' axis mapping
+	FString right;
+	if (!DisplayClusterHelpers::str::ExtractParam(ConfigData.Params, DisplayClusterStrings::cfg::data::input::Right, right))
+	{
+		UE_LOG(LogDisplayClusterInputVRPN, Error, TEXT("%s - 'right' axis mapping not found"), *ToString());
+		return false;
+	}
+
+	// Parse 'forward' axis mapping
+	FString front;
+	if (!DisplayClusterHelpers::str::ExtractParam(ConfigData.Params, DisplayClusterStrings::cfg::data::input::Front, front))
+	{
+		UE_LOG(LogDisplayClusterInputVRPN, Error, TEXT("%s - 'front' axis mapping not found"), *ToString());
+		return false;
+	}
+
+	// Parse 'up' axis mapping
+	FString up;
+	if (!DisplayClusterHelpers::str::ExtractParam(ConfigData.Params, DisplayClusterStrings::cfg::data::input::Up, up))
+	{
+		UE_LOG(LogDisplayClusterInputVRPN, Error, TEXT("%s - 'up' axis mapping not found"), *ToString());
+		return false;
+	}
+	
+	// Store mapping rules
+	AxisFront = String2Map(front, AxisMapType::X);
+	AxisRight = String2Map(right, AxisMapType::Y);
+	AxisUp = String2Map(up, AxisMapType::Z);
+	AxisW = ComputeAxisW(AxisFront, AxisRight, AxisUp);
+
+	// Base initialization
+	return FDisplayClusterVrpnTrackerInputDataHolder::Initialize();
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterVrpnTrackerInputDevice
+//////////////////////////////////////////////////////////////////////////////////////////////
+namespace
+{
+	// Location
+	float LocGetX(const FVector& loc)  { return  loc.X; }
+	float LocGetNX(const FVector& loc) { return -loc.X; }
+
+	float LocGetY(const FVector& loc)  { return  loc.Y; }
+	float LocGetNY(const FVector& loc) { return -loc.Y; }
+
+	float LocGetZ(const FVector& loc)  { return  loc.Z; }
+	float LocGetNZ(const FVector& loc) { return -loc.Z; }
+
+	// Rotation
+	float RotGetX(const FQuat& quat)  { return  quat.X; }
+	float RotGetNX(const FQuat& quat) { return -quat.X; }
+
+	float RotGetY(const FQuat& quat)  { return  quat.Y; }
+	float RotGetNY(const FQuat& quat) { return -quat.Y; }
+
+	float RotGetZ(const FQuat& quat)  { return  quat.Z; }
+	float RotGetNZ(const FQuat& quat) { return -quat.Z; }
+
+	float RotGetW(const FQuat& quat)  { return  quat.W; }
+	float RotGetNW(const FQuat& quat) { return -quat.W; }
+
+	typedef float(*TLocGetter)(const FVector& loc);
+	typedef float(*TRotGetter)(const FQuat&   rot);
+}
+
+FDisplayClusterVrpnTrackerInputDevice::AxisMapType FDisplayClusterVrpnTrackerInputDevice::String2Map(const FString& str, const AxisMapType defaultMap) const
+{
+	const FString mapVal = str.ToLower();
+
+	if (mapVal == DisplayClusterStrings::cfg::data::input::MapX)
+		return AxisMapType::X;
+	else if (mapVal == DisplayClusterStrings::cfg::data::input::MapNX)
+		return AxisMapType::NX;
+	else if (mapVal == DisplayClusterStrings::cfg::data::input::MapY)
+		return AxisMapType::Y;
+	else if (mapVal == DisplayClusterStrings::cfg::data::input::MapNY)
+		return AxisMapType::NY;
+	else if (mapVal == DisplayClusterStrings::cfg::data::input::MapZ)
+		return AxisMapType::Z;
+	else if (mapVal == DisplayClusterStrings::cfg::data::input::MapNZ)
+		return AxisMapType::NZ;
+	else
+	{
+		UE_LOG(LogDisplayClusterInputVRPN, Warning, TEXT("Unknown mapping type: %s"), *str);
+	}
+
+	return defaultMap;
+}
+
+FDisplayClusterVrpnTrackerInputDevice::AxisMapType FDisplayClusterVrpnTrackerInputDevice::ComputeAxisW(const AxisMapType front, const AxisMapType right, const AxisMapType up) const
+{
+	int det = 1;
+
+	if (front == AxisMapType::NX || front == AxisMapType::NY || front == AxisMapType::NZ)
+		det *= -1;
+
+	if (right == AxisMapType::NX || right == AxisMapType::NY || right == AxisMapType::NZ)
+		det *= -1;
+
+	if (up == AxisMapType::NX || up == AxisMapType::NY || up == AxisMapType::NZ)
+		det *= -1;
+
+	return (det < 0) ? AxisMapType::NW : AxisMapType::W;
+}
+
+FVector FDisplayClusterVrpnTrackerInputDevice::GetMappedLocation(const FVector& loc, const AxisMapType front, const AxisMapType right, const AxisMapType up) const
+{
+	static TLocGetter funcs[] = { &LocGetX, &LocGetNX, &LocGetY, &LocGetNY, &LocGetZ, &LocGetNZ };
+	return FVector(funcs[front](loc), funcs[right](loc), funcs[up](loc));
+}
+
+FQuat FDisplayClusterVrpnTrackerInputDevice::GetMappedQuat(const FQuat& quat, const AxisMapType front, const AxisMapType right, const AxisMapType up, const AxisMapType axisW) const
+{
+	static TRotGetter funcs[] = { &RotGetX, &RotGetNX, &RotGetY, &RotGetNY, &RotGetZ, &RotGetNZ, &RotGetW, &RotGetNW };
+	return FQuat(funcs[front](quat), funcs[right](quat), funcs[up](quat), -quat.W);// funcs[axisW](quat));
+}
+
+void FDisplayClusterVrpnTrackerInputDevice::TransformCoordinates(FDisplayClusterVrpnTrackerChannelData &data) const
+{
+	UE_LOG(LogDisplayClusterInputVRPN, VeryVerbose, TEXT("TransformCoordinates old: <loc:%s> <quat:%s>"), *data.trLoc.ToString(), *data.trQuat.ToString());
+
+	// Transform location
+	data.trLoc = OriginLoc + GetMappedLocation(data.trLoc, AxisFront, AxisRight, AxisUp);
+	data.trLoc *= 100.f;
+
+	// Transform rotation
+	data.trQuat = OriginQuat * data.trQuat;
+	data.trQuat = GetMappedQuat(data.trQuat, AxisFront, AxisRight, AxisUp, AxisW);
+
+	UE_LOG(LogDisplayClusterInputVRPN, VeryVerbose, TEXT("TransformCoordinates new: <loc:%s> <quat:%s>"), *data.trLoc.ToString(), *data.trQuat.ToString());
+}
+
+void VRPN_CALLBACK FDisplayClusterVrpnTrackerInputDevice::HandleTrackerDevice(void *userData, vrpn_TRACKERCB const tr)
+{
+	auto pDev = reinterpret_cast<FDisplayClusterVrpnTrackerInputDevice*>(userData);
+	
+	const FVector loc(tr.pos[0], tr.pos[1], tr.pos[2]);
+	const FQuat   quat(tr.quat[0], tr.quat[1], tr.quat[2], tr.quat[3]);
+
+	const FDisplayClusterVrpnTrackerChannelData data{ loc, quat };
+	auto pItem = &pDev->DeviceData.Add(tr.sensor, data);
+
+	pDev->DirtyMap.Add(static_cast<int32>(tr.sensor), true);
+
+	pDev->ReceivedReport = true;
+	pDev->Lost = false;
+
+	UE_LOG(LogDisplayClusterInputVRPN, VeryVerbose, TEXT("Tracker %s:%d {loc %s} {rot %s}"), *pDev->GetId(), tr.sensor, *pItem->trLoc.ToString(), *pItem->trQuat.ToString());
+}
diff --git a/Source/DisplayCluster/Private/Input/Devices/VRPN/Tracker/DisplayClusterVrpnTrackerInputDevice.h b/Source/DisplayCluster/Private/Input/Devices/VRPN/Tracker/DisplayClusterVrpnTrackerInputDevice.h
new file mode 100644
index 0000000000000000000000000000000000000000..c207c1c6ec6a6812ab99cd35a428676f17e7fb04
--- /dev/null
+++ b/Source/DisplayCluster/Private/Input/Devices/VRPN/Tracker/DisplayClusterVrpnTrackerInputDevice.h
@@ -0,0 +1,75 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "DisplayClusterVrpnTrackerInputDataHolder.h"
+
+#if PLATFORM_WINDOWS
+#include "Windows/AllowWindowsPlatformTypes.h"
+#endif
+
+#include "vrpn/vrpn_Tracker.h"
+
+#if PLATFORM_WINDOWS
+#include "Windows/HideWindowsPlatformTypes.h"
+#endif
+
+
+/**
+ * VRPN tracker device implementation
+ */
+class FDisplayClusterVrpnTrackerInputDevice
+	: public FDisplayClusterVrpnTrackerInputDataHolder
+{
+public:
+	FDisplayClusterVrpnTrackerInputDevice(const FDisplayClusterConfigInput& config);
+	virtual ~FDisplayClusterVrpnTrackerInputDevice();
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterInputDevice
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void PreUpdate() override;
+	virtual bool Initialize() override;
+
+protected:
+	// Per-channel dirty state
+	TMap<int32, bool> DirtyMap;
+
+	// Transform form tracker space to DisplayCluster space
+	void TransformCoordinates(FDisplayClusterVrpnTrackerChannelData& data) const;
+
+
+private:
+	// Tracker origin
+	FVector  OriginLoc  = FVector::ZeroVector;
+	FQuat    OriginQuat = FQuat::Identity;
+
+private:
+	// Coordinate system conversion
+	enum AxisMapType { X = 0, NX, Y, NY, Z, NZ, W, NW };
+
+	// Internal conversion helpers
+	AxisMapType String2Map(const FString& str, const AxisMapType defaultMap) const;
+	AxisMapType ComputeAxisW(const AxisMapType front, const AxisMapType right, const AxisMapType up) const;
+	FVector  GetMappedLocation(const FVector& loc, const AxisMapType front, const AxisMapType right, const AxisMapType up) const;
+	FQuat    GetMappedQuat(const FQuat& quat, const AxisMapType front, const AxisMapType right, const AxisMapType up, const AxisMapType axisW) const;
+
+	// Tracker space to DisplayCluster space axis mapping
+	AxisMapType AxisFront;
+	AxisMapType AxisRight;
+	AxisMapType AxisUp;
+	AxisMapType AxisW;
+
+private:
+	// Data update handler
+	static void VRPN_CALLBACK HandleTrackerDevice(void *userData, vrpn_TRACKERCB const tr);
+
+private:
+	// The device (PIMPL)
+	TUniquePtr<vrpn_Tracker_Remote> DevImpl;
+	
+	bool ReceivedReport = false;
+	bool Lost = true;
+	float LostTimeout = 0.032f; // ~2 frames
+};
diff --git a/Source/DisplayCluster/Private/Input/DisplayClusterInputManager.cpp b/Source/DisplayCluster/Private/Input/DisplayClusterInputManager.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..da90d83f5287ba4f0367846e6fd646baa92a1f7f
--- /dev/null
+++ b/Source/DisplayCluster/Private/Input/DisplayClusterInputManager.cpp
@@ -0,0 +1,498 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterInputManager.h"
+
+#include "Cluster/IPDisplayClusterClusterManager.h"
+#include "Config/IPDisplayClusterConfigManager.h"
+
+#include "Devices/VRPN/Analog/DisplayClusterVrpnAnalogInputDevice.h"
+#include "Devices/VRPN/Button/DisplayClusterVrpnButtonInputDevice.h"
+#include "Devices/VRPN/Tracker/DisplayClusterVrpnTrackerInputDevice.h"
+
+#include "Misc/DisplayClusterLog.h"
+#include "DisplayClusterGameMode.h"
+#include "DisplayClusterGlobals.h"
+#include "IPDisplayCluster.h"
+
+
+FDisplayClusterInputManager::FDisplayClusterInputManager()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterInput);
+}
+
+FDisplayClusterInputManager::~FDisplayClusterInputManager()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterInput);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IPDisplayClusterManager
+//////////////////////////////////////////////////////////////////////////////////////////////
+bool FDisplayClusterInputManager::Init(EDisplayClusterOperationMode OperationMode)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterInput);
+
+	return true;
+}
+
+void FDisplayClusterInputManager::Release()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterInput);
+}
+
+bool FDisplayClusterInputManager::StartSession(const FString& configPath, const FString& nodeId)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterInput);
+
+	ConfigPath = configPath;
+	ClusterNodeId = nodeId;
+
+	if (!InitDevices())
+	{
+		UE_LOG(LogDisplayClusterInput, Error, TEXT("Couldn't initialize input devices"));
+		return false;
+	}
+
+	return true;
+}
+
+void FDisplayClusterInputManager::EndSession()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterInput);
+
+	ReleaseDevices();
+}
+
+bool FDisplayClusterInputManager::StartScene(UWorld* pWorld)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterInput);
+
+	check(pWorld);
+	CurrentWorld = pWorld;
+
+	return true;
+}
+
+void FDisplayClusterInputManager::EndScene()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterInput);
+}
+
+void FDisplayClusterInputManager::PreTick(float DeltaSeconds)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterInput);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterInputManager
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Basic functionality (device amount)
+uint32 FDisplayClusterInputManager::GetAxisDeviceAmount() const
+{
+	FScopeLock ScopeLock(&InternalsSyncScope);
+	return GetDeviceAmount_impl<EDisplayClusterInputDevice::VrpnAnalog>();
+}
+
+uint32 FDisplayClusterInputManager::GetButtonDeviceAmount() const
+{
+	FScopeLock ScopeLock(&InternalsSyncScope);
+	return GetDeviceAmount_impl<EDisplayClusterInputDevice::VrpnButton>();
+}
+
+uint32 FDisplayClusterInputManager::GetTrackerDeviceAmount() const
+{
+	FScopeLock ScopeLock(&InternalsSyncScope);
+	return GetDeviceAmount_impl<EDisplayClusterInputDevice::VrpnTracker>();
+}
+
+// Access to the device lists
+bool FDisplayClusterInputManager::GetAxisDeviceIds(TArray<FString>& ids) const
+{
+	FScopeLock ScopeLock(&InternalsSyncScope);
+	return GetDeviceIds_impl<EDisplayClusterInputDevice::VrpnAnalog>(ids);
+}
+
+bool FDisplayClusterInputManager::GetButtonDeviceIds(TArray<FString>& ids) const
+{
+	FScopeLock ScopeLock(&InternalsSyncScope);
+	return GetDeviceIds_impl<EDisplayClusterInputDevice::VrpnButton>(ids);
+}
+
+bool FDisplayClusterInputManager::GetTrackerDeviceIds(TArray<FString>& ids) const
+{
+	FScopeLock ScopeLock(&InternalsSyncScope);
+	return GetDeviceIds_impl<EDisplayClusterInputDevice::VrpnTracker>(ids);
+}
+
+
+// Button data access
+bool FDisplayClusterInputManager::GetButtonState(const FString& devId, const uint8 btn, bool& curState) const
+{
+	FDisplayClusterVrpnButtonChannelData data;
+	if (GetButtonData(devId, btn, data))
+	{
+		curState = data.btnStateNew;
+		return true;
+	}
+
+	return false;
+}
+
+bool FDisplayClusterInputManager::IsButtonPressed(const FString& devId, const uint8 btn, bool& curPressed) const
+{
+	bool btnState;
+	if (GetButtonState(devId, btn, btnState))
+	{
+		curPressed = (btnState == true);
+		return true;
+	}
+
+	return false;
+}
+
+bool FDisplayClusterInputManager::IsButtonReleased(const FString& devId, const uint8 btn, bool& curReleased) const
+{
+	bool btnState;
+	if (GetButtonState(devId, btn, btnState))
+	{
+		curReleased = (btnState == false);
+		return true;
+	}
+
+	return false;
+}
+
+bool FDisplayClusterInputManager::WasButtonPressed(const FString& devId, const uint8 btn, bool& wasPressed) const
+{
+	FDisplayClusterVrpnButtonChannelData data;
+	if (GetButtonData(devId, btn, data))
+	{
+		wasPressed = (data.btnStateOld == false && data.btnStateNew == true);
+		return true;
+	}
+
+	return false;
+}
+
+bool FDisplayClusterInputManager::WasButtonReleased(const FString& devId, const uint8 btn, bool& wasReleased) const
+{
+	FDisplayClusterVrpnButtonChannelData data;
+	if (GetButtonData(devId, btn, data))
+	{
+		wasReleased = (data.btnStateOld == true && data.btnStateNew == false);
+		return true;
+	}
+
+	return false;
+}
+
+// Axes data access
+bool FDisplayClusterInputManager::GetAxis(const FString& devId, const uint8 axis, float& value) const
+{
+	FDisplayClusterVrpnAnalogChannelData data;
+	if (GetAxisData(devId, axis, data))
+	{
+		value = data.axisValue;
+		return true;
+	}
+
+	return false;
+}
+
+// Tracking data access
+bool FDisplayClusterInputManager::GetTrackerLocation(const FString& devId, const uint8 tr, FVector& location) const
+{
+	FDisplayClusterVrpnTrackerChannelData data;
+	if (GetTrackerData(devId, tr, data))
+	{
+		location = data.trLoc;
+		return true;
+	}
+
+	return false;
+}
+
+bool FDisplayClusterInputManager::GetTrackerQuat(const FString& devId, const uint8 tr, FQuat& rotation) const
+{
+	FDisplayClusterVrpnTrackerChannelData data;
+	if (GetTrackerData(devId, tr, data))
+	{
+		rotation = data.trQuat;
+		return true;
+	}
+
+	return false;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IPDisplayClusterInputManager
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterInputManager::Update()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterInput);
+
+	if (GDisplayCluster->GetOperationMode() == EDisplayClusterOperationMode::Disabled)
+	{
+		return;
+	}
+
+	// Perform input update on master only. Slaves' state will be replicated later.
+	if (GDisplayCluster->GetPrivateClusterMgr()->IsMaster())
+	{
+		UE_LOG(LogDisplayClusterInput, Verbose, TEXT("Input update started"));
+		{
+			FScopeLock ScopeLock(&InternalsSyncScope);
+
+			// Pre-Update
+			UE_LOG(LogDisplayClusterInput, Verbose, TEXT("Input pre-update..."));
+			for (auto classIt = Devices.CreateIterator(); classIt; ++classIt)
+			{
+				for (auto devIt = classIt->Value.CreateConstIterator(); devIt; ++devIt)
+				{
+					devIt->Value->PreUpdate();
+				}
+			}
+
+			// Update
+			UE_LOG(LogDisplayClusterInput, Verbose, TEXT("Input update..."));
+			for (auto classIt = Devices.CreateIterator(); classIt; ++classIt)
+			{
+				for (auto devIt = classIt->Value.CreateConstIterator(); devIt; ++devIt)
+				{
+					devIt->Value->Update();
+				}
+			}
+
+			// Post-Update
+			for (auto classIt = Devices.CreateIterator(); classIt; ++classIt)
+			{
+				for (auto devIt = classIt->Value.CreateConstIterator(); devIt; ++devIt)
+				{
+					devIt->Value->PostUpdate();
+				}
+			}
+		}
+		UE_LOG(LogDisplayClusterInput, Verbose, TEXT("Input update finished"));
+	
+		// Update input data cache for slave nodes
+		UpdateInputDataCache();
+	}
+}
+
+void FDisplayClusterInputManager::ExportInputData(FDisplayClusterMessage::DataType& data) const
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterInput);
+
+	// Get data from cache
+	data = PackedTransferData;
+}
+
+void FDisplayClusterInputManager::ImportInputData(const FDisplayClusterMessage::DataType& data)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterInput);
+
+	FScopeLock ScopeLock(&InternalsSyncScope);
+
+	for (auto rec : data)
+	{
+		FString strClassId;
+		FString strDevId;
+		if (rec.Key.Split(FString(SerializationDeviceTypeNameDelimiter), &strClassId, &strDevId))
+		{
+			UE_LOG(LogDisplayClusterInput, VeryVerbose, TEXT("Deserializing input device: <%s, %s>"), *rec.Key, *rec.Value);
+
+			int classId = FCString::Atoi(*strClassId);
+			if (Devices.Contains(classId))
+			{
+				if (Devices[classId].Contains(strDevId))
+				{
+					Devices[classId][strDevId]->DeserializeFromString(rec.Value);
+				}
+			}
+		}
+	}
+}
+
+
+bool FDisplayClusterInputManager::GetAxisData(const FString& devId, const uint8 channel, FDisplayClusterVrpnAnalogChannelData&  data) const
+{
+	FScopeLock ScopeLock(&InternalsSyncScope);
+	return GetChannelData_impl<EDisplayClusterInputDevice::VrpnAnalog>(devId, channel, data);
+}
+
+bool FDisplayClusterInputManager::GetButtonData(const FString& devId, const uint8 channel, FDisplayClusterVrpnButtonChannelData&  data) const
+{
+	FScopeLock ScopeLock(&InternalsSyncScope);
+	return GetChannelData_impl<EDisplayClusterInputDevice::VrpnButton>(devId, channel, data);
+}
+
+bool FDisplayClusterInputManager::GetTrackerData(const FString& devId, const uint8 channel, FDisplayClusterVrpnTrackerChannelData& data) const
+{
+	FScopeLock ScopeLock(&InternalsSyncScope);
+	return GetChannelData_impl<EDisplayClusterInputDevice::VrpnTracker>(devId, channel, data);
+}
+
+template<int DevTypeID>
+uint32 FDisplayClusterInputManager::GetDeviceAmount_impl() const
+{
+	if (!Devices.Contains(DevTypeID))
+	{
+		return 0;
+	}
+
+	return static_cast<uint32>(Devices[DevTypeID].Num());
+}
+
+template<int DevTypeID>
+bool FDisplayClusterInputManager::GetDeviceIds_impl(TArray<FString>& ids) const
+{
+	if (!Devices.Contains(DevTypeID))
+	{
+		return false;
+	}
+
+	Devices[DevTypeID].GenerateKeyArray(ids);
+	return true;
+}
+
+template<int DevTypeID>
+bool FDisplayClusterInputManager::GetChannelData_impl(const FString& devId, const uint8 channel, typename display_cluster_input_device_traits<DevTypeID>::dev_channel_data_type& data) const
+{
+	if (!Devices.Contains(DevTypeID))
+	{
+		return false;
+	}
+
+	if (!Devices[DevTypeID].Contains(devId))
+	{
+		return false;
+	}
+
+	return static_cast<FDisplayClusterInputDeviceBase<DevTypeID>*>(Devices[DevTypeID][devId].Get())->GetChannelData(channel, data);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterInputManager
+//////////////////////////////////////////////////////////////////////////////////////////////
+bool FDisplayClusterInputManager::InitDevices()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterInput);
+
+	if (GDisplayCluster->GetOperationMode() == EDisplayClusterOperationMode::Disabled)
+	{
+		return false;
+	}
+
+	FScopeLock ScopeLock(&InternalsSyncScope);
+
+	UE_LOG(LogDisplayClusterInput, Log, TEXT("Initializing input devices..."));
+
+	const TArray<FDisplayClusterConfigInput> cfgInputDevs = GDisplayCluster->GetPrivateConfigMgr()->GetInputDevices();
+
+	for (auto& cfgDev : cfgInputDevs)
+	{
+		UE_LOG(LogDisplayClusterInput, Verbose, TEXT("Creating input device: %s"), *cfgDev.ToString());
+
+		IDisplayClusterInputDevice* pDev = nullptr;
+
+		if (cfgDev.Type.Compare(FString(DisplayClusterStrings::cfg::data::input::DeviceAnalog), ESearchCase::IgnoreCase) == 0)
+		{
+			if (GDisplayCluster->GetPrivateClusterMgr()->IsMaster())
+			{
+				pDev = new FDisplayClusterVrpnAnalogInputDevice(cfgDev);
+			}
+			else
+			{
+				pDev = new FDisplayClusterVrpnAnalogInputDataHolder(cfgDev);
+			}
+		}
+		else if (cfgDev.Type.Compare(FString(DisplayClusterStrings::cfg::data::input::DeviceButtons), ESearchCase::IgnoreCase) == 0)
+		{
+			if (GDisplayCluster->GetPrivateClusterMgr()->IsMaster())
+			{
+				pDev = new FDisplayClusterVrpnButtonInputDevice(cfgDev);
+			}
+			else
+			{
+				pDev = new FDisplayClusterVrpnButtonInputDataHolder(cfgDev);
+			}
+		}
+		else if (cfgDev.Type.Compare(FString(DisplayClusterStrings::cfg::data::input::DeviceTracker), ESearchCase::IgnoreCase) == 0)
+		{
+			if (GDisplayCluster->GetPrivateClusterMgr()->IsMaster())
+			{
+				pDev = new FDisplayClusterVrpnTrackerInputDevice(cfgDev);
+			}
+			else
+			{
+				pDev = new FDisplayClusterVrpnTrackerInputDataHolder(cfgDev);
+			}
+		}
+		else
+		{
+			UE_LOG(LogDisplayClusterInput, Error, TEXT("Unsupported device type: %s"), *cfgDev.Type);
+			continue;
+		}
+
+		if (pDev && pDev->Initialize())
+		{
+			UE_LOG(LogDisplayClusterInput, Log, TEXT("Adding device: %s"), *pDev->ToString());
+			
+			auto pDevMap = Devices.Find(pDev->GetTypeId());
+			if (!pDevMap)
+			{
+				pDevMap = &Devices.Add(pDev->GetTypeId());
+			}
+
+			pDevMap->Add(cfgDev.Id, TDevice(pDev));
+		}
+		else
+		{
+			UE_LOG(LogDisplayClusterInput, Warning, TEXT("Neither data holder nor true device was instantiated for item id: %s"), *cfgDev.Id);
+
+			// It's safe to delete nullptr so no checking performed
+			delete pDev;
+
+			//@note: Allow other devices to be initialized. User will locate the problem from logs.
+			//return false;
+		}
+	}
+
+	return true;
+}
+
+void FDisplayClusterInputManager::ReleaseDevices()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterInput);
+
+	FScopeLock ScopeLock(&InternalsSyncScope);
+
+	UE_LOG(LogDisplayClusterInput, Log, TEXT("Releasing input subsystem..."));
+
+	UE_LOG(LogDisplayClusterInput, Log, TEXT("Releasing input devices..."));
+	Devices.Empty();
+}
+
+void FDisplayClusterInputManager::UpdateInputDataCache()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterInput);
+
+	FScopeLock ScopeLock(&InternalsSyncScope);
+
+	// Clear previously cached data
+	PackedTransferData.Empty(PackedTransferData.Num() | 0x07);
+
+	for (auto classIt = Devices.CreateConstIterator(); classIt; ++classIt)
+	{
+		for (auto devIt = classIt->Value.CreateConstIterator(); devIt; ++devIt)
+		{
+			const FString key = FString::Printf(TEXT("%d%s%s"), classIt->Key, SerializationDeviceTypeNameDelimiter, *devIt->Key);
+			const FString val = devIt->Value->SerializeToString();
+			UE_LOG(LogDisplayClusterInput, VeryVerbose, TEXT("Input device %d:%s serialized: <%s, %s>"), classIt->Key, *devIt->Key, *key, *val);
+			PackedTransferData.Add(key, val);
+		}
+	}
+}
diff --git a/Source/DisplayCluster/Private/Input/DisplayClusterInputManager.h b/Source/DisplayCluster/Private/Input/DisplayClusterInputManager.h
new file mode 100644
index 0000000000000000000000000000000000000000..fe1e34a9f59917f8c85da41c82adcefa0caa6bbe
--- /dev/null
+++ b/Source/DisplayCluster/Private/Input/DisplayClusterInputManager.h
@@ -0,0 +1,119 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "IPDisplayClusterInputManager.h"
+
+#include "CoreMinimal.h"
+
+#include "Devices/DisplayClusterInputDeviceTraits.h"
+#include "Network/DisplayClusterMessage.h"
+
+struct IDisplayClusterInputDevice;
+struct FDisplayClusterVrpnAnalogChannelData;
+struct FDisplayClusterVrpnButtonChannelData;
+struct FDisplayClusterVrpnTrackerChannelData;
+
+
+/**
+ * Input manager. Implements everything related to VR input devices (VRPN, etc.)
+ */
+class FDisplayClusterInputManager
+	: public    IPDisplayClusterInputManager
+{
+public:
+	FDisplayClusterInputManager();
+	virtual ~FDisplayClusterInputManager();
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterManager
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool Init(EDisplayClusterOperationMode OperationMode) override;
+	virtual void Release() override;
+	virtual bool StartSession(const FString& configPath, const FString& nodeId) override;
+	virtual void EndSession() override;
+	virtual bool StartScene(UWorld* pWorld) override;
+	virtual void EndScene() override;
+	virtual void PreTick(float DeltaSeconds);
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterInputManager
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// Device amount
+	virtual uint32 GetAxisDeviceAmount()    const override;
+	virtual uint32 GetButtonDeviceAmount()  const override;
+	virtual uint32 GetTrackerDeviceAmount() const override;
+
+	// Device IDs
+	virtual bool GetAxisDeviceIds   (TArray<FString>& ids) const override;
+	virtual bool GetButtonDeviceIds (TArray<FString>& ids) const override;
+	virtual bool GetTrackerDeviceIds(TArray<FString>& ids) const override;
+
+	// Button data access
+	virtual bool GetButtonState(const FString& devId, const uint8 btn, bool& curState)       const override;
+	virtual bool IsButtonPressed(const FString& devId, const uint8 btn, bool& curPressed)    const override;
+	virtual bool IsButtonReleased(const FString& devId, const uint8 btn, bool& curReleased)  const override;
+	virtual bool WasButtonPressed(const FString& devId, const uint8 btn, bool& wasPressed)   const override;
+	virtual bool WasButtonReleased(const FString& devId, const uint8 btn, bool& wasReleased) const override;
+
+	// Axes data access
+	virtual bool GetAxis(const FString& devId, const uint8 axis, float& value) const override;
+
+	// Tracking data access
+	virtual bool GetTrackerLocation(const FString& devId, const uint8 tr, FVector& location) const override;
+	virtual bool GetTrackerQuat(const FString& devId, const uint8 tr, FQuat& rotation) const override;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterInputManager
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void Update() override;
+
+	virtual void ExportInputData(FDisplayClusterMessage::DataType& data) const override;
+	virtual void ImportInputData(const FDisplayClusterMessage::DataType& data) override;
+
+private:
+	typedef TUniquePtr<IDisplayClusterInputDevice>    TDevice;
+	typedef TMap<FString, TDevice>         TDeviceClassMap;
+	typedef TMap<int, TDeviceClassMap>     TDeviceMap;
+
+	bool InitDevices();
+	void ReleaseDevices();
+	void UpdateInputDataCache();
+
+	// Device data
+	bool GetAxisData   (const FString& devId, const uint8 channel, FDisplayClusterVrpnAnalogChannelData&  data) const;
+	bool GetButtonData (const FString& devId, const uint8 channel, FDisplayClusterVrpnButtonChannelData&  data) const;
+	bool GetTrackerData(const FString& devId, const uint8 channel, FDisplayClusterVrpnTrackerChannelData& data) const;
+
+private:
+	// Input devices
+	TDeviceMap Devices;
+	// Input state data cache
+	FDisplayClusterMessage::DataType PackedTransferData;
+	// Current config path
+	FString ConfigPath;
+	// Current cluster node ID
+	FString ClusterNodeId;
+	// Current world
+	UWorld* CurrentWorld;
+
+	mutable FCriticalSection InternalsSyncScope;
+
+private:
+	template<int DevTypeID>
+	uint32 GetDeviceAmount_impl() const;
+
+	template<int DevTypeID>
+	bool GetDeviceIds_impl(TArray<FString>& ids) const;
+
+	template<int DevTypeID>
+	bool GetChannelData_impl(const FString& devId, const uint8 channel, typename display_cluster_input_device_traits<DevTypeID>::dev_channel_data_type& data) const;
+
+private:
+	static constexpr auto SerializationDeviceTypeNameDelimiter = TEXT(" ");
+};
+
diff --git a/Source/DisplayCluster/Private/Input/IPDisplayClusterInputManager.h b/Source/DisplayCluster/Private/Input/IPDisplayClusterInputManager.h
new file mode 100644
index 0000000000000000000000000000000000000000..bc91976b31312031074efc141b71dce02320796e
--- /dev/null
+++ b/Source/DisplayCluster/Private/Input/IPDisplayClusterInputManager.h
@@ -0,0 +1,25 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Input/IDisplayClusterInputManager.h"
+#include "IPDisplayClusterManager.h"
+
+#include "Network/DisplayClusterMessage.h"
+
+
+/**
+ * Input manager private interface
+ */
+struct IPDisplayClusterInputManager
+	: public IDisplayClusterInputManager
+	, public IPDisplayClusterManager
+{
+	virtual ~IPDisplayClusterInputManager()
+	{ }
+
+	virtual void Update() = 0;
+
+	virtual void ExportInputData(FDisplayClusterMessage::DataType& data) const = 0;
+	virtual void ImportInputData(const FDisplayClusterMessage::DataType& data) = 0;
+};
diff --git a/Source/DisplayCluster/Private/Misc/DisplayClusterAppExit.cpp b/Source/DisplayCluster/Private/Misc/DisplayClusterAppExit.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9e21491252fb148638b0f61e13a727fb89eea1c6
--- /dev/null
+++ b/Source/DisplayCluster/Private/Misc/DisplayClusterAppExit.cpp
@@ -0,0 +1,97 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterAppExit.h"
+#include "DisplayClusterLog.h"
+#include "Engine/GameEngine.h"
+
+#if WITH_EDITOR
+#include "Editor/UnrealEd/Public/UnrealEdGlobals.h"
+#include "Editor/UnrealEdEngine.h"
+#endif
+
+FCriticalSection FDisplayClusterAppExit::InternalsSyncScope;
+
+auto FDisplayClusterAppExit::ExitTypeToStr(ExitType type)
+{
+	switch (type)
+	{
+	case ExitType::KillImmediately:
+		return TEXT("KILL");
+	case ExitType::NormalSoft:
+		return TEXT("UE4_soft");
+	case ExitType::NormalForce:
+		return TEXT("UE4_force");
+	default:
+		return TEXT("unknown");
+	}
+}
+
+void FDisplayClusterAppExit::ExitApplication(ExitType exitType, const FString& strMsg)
+{
+	if (GEngine && GEngine->IsEditor())
+	{
+#if WITH_EDITOR
+		UE_LOG(LogDisplayClusterModule, Log, TEXT("PIE STOP: %s application quit requested: %s"), ExitTypeToStr(exitType), *strMsg);
+		GUnrealEd->RequestEndPlayMap();
+#endif
+		return;
+	}
+	else
+	{
+		FScopeLock lock(&InternalsSyncScope);
+
+		// We process only first call. Thus we won't have a lot of requests from different socket threads.
+		// We also will know the first requester which may be useful in step-by-step problem solving.
+		static bool bRequestedBefore = false;
+		if (bRequestedBefore == false || exitType == ExitType::KillImmediately)
+		{
+			bRequestedBefore = true;
+			UE_LOG(LogDisplayClusterModule, Log, TEXT("%s application quit requested: %s"), ExitTypeToStr(exitType), *strMsg);
+
+			GLog->Flush();
+
+#if 0
+			if (IsInGameThread())
+			{
+				GLog->FlushThreadedLogs();
+#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
+				TGuardValue<bool> GuardMainThreadBlockedOnRenderThread(GMainThreadBlockedOnRenderThread, true);
+#endif
+				SCOPE_CYCLE_COUNTER(STAT_PumpMessages);
+				FPlatformMisc::PumpMessages(false);
+			}
+#endif
+
+			switch (exitType)
+			{
+				case ExitType::KillImmediately:
+				{
+					FProcHandle hProc = FPlatformProcess::OpenProcess(FPlatformProcess::GetCurrentProcessId());
+					FPlatformProcess::TerminateProc(hProc, true);
+					break;
+				}
+
+				case ExitType::NormalSoft:
+				{
+//@todo: This is workaround for exit issue - crash on exit. Need to be checked on new UE versions.
+// <ErrorMessage>Assertion failed: NumRemoved == 1 [File:D:\work\UE4.12.5.build\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectHash.cpp] [Line: 905] &nl;&nl;</ErrorMessage>
+					FProcHandle hProc = FPlatformProcess::OpenProcess(FPlatformProcess::GetCurrentProcessId());
+					FPlatformProcess::TerminateProc(hProc, true);
+					break;
+				}
+
+				case ExitType::NormalForce:
+				{
+					FPlatformMisc::RequestExit(true);
+					break;
+				}
+
+				default:
+				{
+					UE_LOG(LogDisplayClusterModule, Warning, TEXT("Unknown exit type requested"));
+					break;
+				}
+			}
+		}
+	}
+}
diff --git a/Source/DisplayCluster/Private/Misc/DisplayClusterAppExit.h b/Source/DisplayCluster/Private/Misc/DisplayClusterAppExit.h
new file mode 100644
index 0000000000000000000000000000000000000000..e99c7cd1e315e336aa595872199318965f7620b1
--- /dev/null
+++ b/Source/DisplayCluster/Private/Misc/DisplayClusterAppExit.h
@@ -0,0 +1,32 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+
+
+/**
+ * Auxiliary class. Responsible for terminating application.
+ */
+class FDisplayClusterAppExit
+{
+public:
+	enum class ExitType
+	{
+		// Kills current process. No resource cleaning performed.
+		KillImmediately,
+		// UE4 based soft exit (game thread). Full resource cleaning.
+		NormalSoft,
+		// UE4 game termination. Error window and dump file should appear after exit.
+		NormalForce
+	};
+
+public:
+	static void ExitApplication(ExitType exitType, const FString& strMsg);
+
+private:
+	static auto ExitTypeToStr(ExitType type);
+
+private:
+	static FCriticalSection InternalsSyncScope;
+};
diff --git a/Source/DisplayCluster/Private/Misc/DisplayClusterBarrier.cpp b/Source/DisplayCluster/Private/Misc/DisplayClusterBarrier.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..609eb9de2f2c64ab8d47b4ee181e8dd4edf582c9
--- /dev/null
+++ b/Source/DisplayCluster/Private/Misc/DisplayClusterBarrier.cpp
@@ -0,0 +1,112 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterBarrier.h"
+
+#include "DisplayClusterLog.h"
+#include "Engine/EngineTypes.h"
+
+#include <chrono>
+
+
+FDisplayClusterBarrier::FDisplayClusterBarrier(uint32 threadsAmount, const FString& name, uint32 timeout) :
+	Name(name),
+	ThreadsAmount(threadsAmount),
+	ThreadsLeft(threadsAmount),
+	IterationCounter(0),
+	Timeout(timeout)
+{
+	UE_LOG(LogDisplayClusterNetwork, Log, TEXT("Initialized barrier %s with timeout %u for threads count: %u"), *Name, Timeout, ThreadsAmount);
+}
+
+FDisplayClusterBarrier::FDisplayClusterBarrier(uint32 threadsAmount, uint32 timeout) :
+	FDisplayClusterBarrier(threadsAmount, FString("noname_barrier"), timeout)
+{
+}
+
+
+FDisplayClusterBarrier::~FDisplayClusterBarrier()
+{
+	// Free currently blocked threads
+	Deactivate();
+}
+
+FDisplayClusterBarrier::WaitResult FDisplayClusterBarrier::Wait(double* pThreadWaitTime /*= nullptr*/, double* pBarrierWaitTime /*= nullptr*/)
+{
+	if (bEnabled == false)
+	{
+		UE_LOG(LogDisplayClusterNetwork, Verbose, TEXT("%s barrier is not active"), *Name);
+		return WaitResult::NotActive;
+	}
+
+	const double threadWaitTimeStart = FPlatformTime::Seconds();
+
+	{
+		std::unique_lock<std::mutex> lock{ Mutex };
+
+		size_t curIter = IterationCounter;
+
+		if (ThreadsLeft == ThreadsAmount)
+		{
+			WaitTimeStart = FPlatformTime::Seconds();
+			UE_LOG(LogDisplayClusterNetwork, VeryVerbose, TEXT("%s barrier start time: %lf"), *Name, WaitTimeStart);
+		}
+
+		// Check if all threads are in front of the barrier
+		if (--ThreadsLeft == 0)
+		{
+			UE_LOG(LogDisplayClusterNetwork, Verbose, TEXT("%s barrier trigger!"), *Name);
+			++IterationCounter;
+			ThreadsLeft = ThreadsAmount;
+
+			WaitTimeFinish = FPlatformTime::Seconds();
+			UE_LOG(LogDisplayClusterNetwork, VeryVerbose, TEXT("%s barrier finish time: %lf"), *Name, WaitTimeFinish);
+
+			WaitTimeOverall = WaitTimeFinish - WaitTimeStart;
+			UE_LOG(LogDisplayClusterNetwork, VeryVerbose, TEXT("%s barrier overall wait time: %lf"), *Name, WaitTimeOverall);
+
+			// This is the last node. Unblock the barrier.
+			CondVar.notify_all();
+		}
+		else
+		{
+			UE_LOG(LogDisplayClusterNetwork, VeryVerbose, TEXT("%s barrier waiting, %u threads left"), *Name, ThreadsLeft);
+			// Not all of threads have came here. Wait.
+			if (!CondVar.wait_for(lock, std::chrono::milliseconds(Timeout), [this, curIter] { return curIter != IterationCounter || bEnabled == false; }))
+			{
+				//@todo: no timeout result if barrier has been disabled
+				UE_LOG(LogDisplayClusterNetwork, Warning, TEXT("%s barrier waiting timeout"), *Name);
+				return WaitResult::Timeout;
+			}
+		}
+	}
+
+	const double threadWaitTimeFinish = FPlatformTime::Seconds();
+
+	if (pBarrierWaitTime)
+		*pBarrierWaitTime = WaitTimeOverall;
+
+	if (pThreadWaitTime)
+		*pThreadWaitTime = threadWaitTimeFinish - threadWaitTimeStart;
+
+	// Go ahead
+	return WaitResult::Ok;
+}
+
+void FDisplayClusterBarrier::Activate()
+{
+	std::unique_lock<std::mutex> lock{ Mutex };
+
+	IterationCounter = 0;
+	ThreadsLeft = ThreadsAmount;
+	bEnabled = true;
+	CondVar.notify_all();
+}
+
+void FDisplayClusterBarrier::Deactivate()
+{
+	std::unique_lock<std::mutex> lock{ Mutex };
+
+	bEnabled = false;
+	CondVar.notify_all();
+}
+
diff --git a/Source/DisplayCluster/Private/Misc/DisplayClusterBarrier.h b/Source/DisplayCluster/Private/Misc/DisplayClusterBarrier.h
new file mode 100644
index 0000000000000000000000000000000000000000..6f1adcec0891fc63db45a7add7a53cc26fd25789
--- /dev/null
+++ b/Source/DisplayCluster/Private/Misc/DisplayClusterBarrier.h
@@ -0,0 +1,59 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include <condition_variable>
+#include <mutex>
+
+
+/**
+ * Thread barrier
+ */
+class FDisplayClusterBarrier
+{
+public:
+	explicit FDisplayClusterBarrier(uint32 threadsAmount, uint32 timeout);
+	explicit FDisplayClusterBarrier(uint32 threadsAmount, const FString& name, uint32 timeout);
+	~FDisplayClusterBarrier();
+
+public:
+	enum class WaitResult
+	{
+		Ok,
+		NotActive,
+		Timeout
+	};
+
+public:
+	// Wait until all threads arrive
+	WaitResult Wait(double* pThreadWaitTime = nullptr, double* pBarrierWaitTime = nullptr);
+	// Enable barrier
+	void Activate();
+	// Disable barrier (no blocking operation performed anymore)
+	void Deactivate();
+
+private:
+	// Barrier name for logging
+	const FString Name;
+
+	// Barrier state
+	bool bEnabled = true;
+
+	// Amount of threads to wait at the barrier
+	const uint32 ThreadsAmount;
+	// Waiting threads amount
+	uint32 ThreadsLeft;
+	// Iteration counter (kind of barrier sync transaction)
+	size_t IterationCounter;
+
+	std::condition_variable CondVar;
+	std::mutex Mutex;
+
+	uint32 Timeout = 0;
+
+	double WaitTimeStart = 0;
+	double WaitTimeFinish = 0;
+	double WaitTimeOverall = 0;
+};
+
diff --git a/Source/DisplayCluster/Private/Misc/DisplayClusterHelpers.h b/Source/DisplayCluster/Private/Misc/DisplayClusterHelpers.h
new file mode 100644
index 0000000000000000000000000000000000000000..ad2b81aad34d0e918d5d13f6593509589b3cb66c
--- /dev/null
+++ b/Source/DisplayCluster/Private/Misc/DisplayClusterHelpers.h
@@ -0,0 +1,206 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "CoreTypes.h"
+#include "EngineUtils.h"
+
+#include "DisplayClusterStrings.h"
+
+#include "Misc/DisplayClusterTypesConverter.h"
+
+#include "Interfaces/IPv4/IPv4Address.h"
+#include "Interfaces/IPv4/IPv4Endpoint.h"
+
+
+class AActor;
+
+
+namespace DisplayClusterHelpers
+{
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// Common String helpers
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	namespace str
+	{
+		static constexpr auto StrFalse = TEXT("false");
+		static constexpr auto StrTrue  = TEXT("true");
+
+		static inline auto BoolToStr(bool bVal)
+		{
+			return (bVal ? StrTrue : StrFalse);
+		}
+
+		static void DustCommandLineValue(FString& val, bool bTrimQuotes = true)
+		{
+			val.RemoveFromStart(DisplayClusterStrings::strKeyValSeparator);
+			
+			if(bTrimQuotes)
+				val = val.TrimQuotes();
+
+			val.TrimStartAndEndInline();
+		}
+
+		template<typename T>
+		static bool ExtractCommandLineValue(const FString& line, const FString& argName, T& argVal)
+		{
+			FString tmp;
+			if (FParse::Value(*line, *argName, tmp, false))
+			{
+				DustCommandLineValue(tmp, false);
+				argVal = FDisplayClusterTypesConverter::FromString<T>(tmp);
+				return true;
+			}
+			return false;
+		}
+
+		static bool ExtractParam(const FString& source, const FString& param, FString& value, bool bTrimQuotes = true)
+		{
+			// Extract device address
+			if (!FParse::Value(*source, *param, value, false))
+				return false;
+
+			DisplayClusterHelpers::str::DustCommandLineValue(value, bTrimQuotes);
+
+			return true;
+		}
+
+#if 0
+		bool GetPair(FString& line, FString& pair)
+		{
+			if (line.IsEmpty())
+				return false;
+
+			if (line.Split(FString(" "), &pair, &line) == false)
+			{
+				pair = line;
+				line.Empty();
+				return true;
+			}
+
+			line = line.Trim().TrimTrailing();
+			pair = pair.Trim().TrimTrailing();
+
+			return true;
+		}
+
+		bool GetKeyVal(FString& line, FString& key, FString& val)
+		{
+			FString pair;
+			if (GetPair(line, pair) == false)
+				return false;
+
+			if (pair.Split(FString(DisplayClusterStrings::cfg::spec::KeyValSeparator), &key, &val) == false)
+				return false;
+
+			key = key.Trim().TrimTrailing();
+			val = val.Trim().TrimTrailing();
+
+			return true;
+		}
+#endif
+	};
+
+
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// Network helpers
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	namespace net
+	{
+		static bool GenIPv4Endpoint(const FString& addr, const int32 port, FIPv4Endpoint& ep)
+		{
+			FIPv4Address ipAddr;
+			if (!FIPv4Address::Parse(addr, ipAddr))
+				return false;
+
+			ep = FIPv4Endpoint(ipAddr, port);
+			return true;
+		}
+	};
+
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// Array helpers
+	//////////////////////////////////////////////////////////////////////////////////////////////	struct str
+	namespace arrays
+	{
+		// Max element in array
+		template<typename T>
+		T max(const T* data, int size)
+		{
+			T result = data[0];
+			for (int i = 1; i < size; i++)
+				if (result < data[i])
+					result = data[i];
+			return result;
+		}
+
+		// Max element's index in array
+		template<typename T>
+		size_t max_idx(const T* data, int size)
+		{
+			size_t idx = 0;
+			T result = data[0];
+			for (int i = 1; i < size; i++)
+				if (result < data[i])
+				{
+					result = data[i];
+					idx = i;
+				}
+			return idx;
+		}
+
+		// Min element in array
+		template<typename T>
+		T min(const T* data, int size)
+		{
+			T result = data[0];
+			for (int i = 1; i < size; i++)
+				if (result > data[i])
+					result = data[i];
+			return result;
+		}
+
+		// Min element's index in array
+		template<typename T>
+		size_t min_idx(const T* data, int size)
+		{
+			size_t idx = 0;
+			T result = data[0];
+			for (int i = 1; i < size; i++)
+				if (result > data[i])
+				{
+					result = data[i];
+					idx = i;
+				}
+			return idx;
+		}
+
+		// Helper for array size
+		template <typename T, size_t n>
+		constexpr size_t array_size(const T(&)[n])
+		{
+			return n;
+		}
+	}
+
+
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// Game helpers
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	namespace game
+	{
+		template<typename T>
+		static void FindAllActors(UWorld* World, TArray<T*>& Out)
+		{
+			for (TActorIterator<AActor> It(World, T::StaticClass()); It; ++It)
+			{
+				T* Actor = Cast<T>(*It);
+				if (Actor && !Actor->IsPendingKill())
+				{
+					Out.Add(Actor);
+				}
+			}
+		}
+	}
+};
diff --git a/Source/DisplayCluster/Private/Misc/DisplayClusterLog.cpp b/Source/DisplayCluster/Private/Misc/DisplayClusterLog.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..2337f8e5fe4b31057d26e7a86446572171ed5f1e
--- /dev/null
+++ b/Source/DisplayCluster/Private/Misc/DisplayClusterLog.cpp
@@ -0,0 +1,17 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterLog.h"
+
+// Plugin-wide log categories
+DEFINE_LOG_CATEGORY(LogDisplayClusterGameMode);
+DEFINE_LOG_CATEGORY(LogDisplayClusterEngine);
+DEFINE_LOG_CATEGORY(LogDisplayClusterModule);
+DEFINE_LOG_CATEGORY(LogDisplayClusterCluster);
+DEFINE_LOG_CATEGORY(LogDisplayClusterConfig);
+DEFINE_LOG_CATEGORY(LogDisplayClusterGame);
+DEFINE_LOG_CATEGORY(LogDisplayClusterInput);
+DEFINE_LOG_CATEGORY(LogDisplayClusterInputVRPN);
+DEFINE_LOG_CATEGORY(LogDisplayClusterNetwork);
+DEFINE_LOG_CATEGORY(LogDisplayClusterNetworkMsg);
+DEFINE_LOG_CATEGORY(LogDisplayClusterRender);
+DEFINE_LOG_CATEGORY(LogDisplayClusterBlueprint);
diff --git a/Source/DisplayCluster/Private/Misc/DisplayClusterLog.h b/Source/DisplayCluster/Private/Misc/DisplayClusterLog.h
new file mode 100644
index 0000000000000000000000000000000000000000..92810ea7c6dfa0e35d9d193341919228d9cc1bfa
--- /dev/null
+++ b/Source/DisplayCluster/Private/Misc/DisplayClusterLog.h
@@ -0,0 +1,47 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+
+// Plugin-wide log categories
+#if UE_BUILD_SHIPPING
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterGameMode,   Warning, Warning);
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterEngine,     Warning, Warning);
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterModule,     Warning, Warning);
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterCluster,    Warning, Warning);
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterConfig,     Warning, Warning);
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterGame,       Warning, Warning);
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterInput,      Warning, Warning);
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterInputVRPN,  Warning, Warning);
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterNetwork,    Warning, Warning);
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterNetworkMsg, Warning, Warning);
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterRender,     Warning, Warning);
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterBlueprint,  Warning, Warning);
+#else
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterGameMode,   Log, All);
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterEngine,     Log, All);
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterModule,     Log, All);
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterCluster,    Log, All);
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterConfig,     Log, All);
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterGame,       Log, All);
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterInput,      Log, All);
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterInputVRPN,  Log, All);
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterNetwork,    Log, All);
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterNetworkMsg, Log, All);
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterRender,     Log, All);
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterBlueprint,  Log, All);
+#endif
+
+
+//@todo: Linux@GCC will probably require other macro
+#if UE_BUILD_SHIPPING
+	#define DISPLAY_CLUSTER_FUNC_TRACE(cat) ;
+#else
+	#if PLATFORM_WINDOWS
+			#define DISPLAY_CLUSTER_FUNC_TRACE(cat)  UE_LOG(cat, VeryVerbose, TEXT(">> %s"), TEXT(__FUNCTION__))
+			//#define DISPLAY_CLUSTER_FUNC_TRACE(cat)  UE_LOG(cat, VeryVerbose, TEXT(">> %s::%s::%d"), TEXT(__FILE__), TEXT(__FUNCTION__), __LINE__)
+	#else
+		#define DISPLAY_CLUSTER_FUNC_TRACE(cat) ;
+	#endif // PLATFORM_WINDOWS
+#endif // UE_BUILD_SHIPPING
diff --git a/Source/DisplayCluster/Private/Misc/DisplayClusterTypesConverter.h b/Source/DisplayCluster/Private/Misc/DisplayClusterTypesConverter.h
new file mode 100644
index 0000000000000000000000000000000000000000..bb33c6b74704041dc789ed1f138b9005bd1eb14c
--- /dev/null
+++ b/Source/DisplayCluster/Private/Misc/DisplayClusterTypesConverter.h
@@ -0,0 +1,104 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "Misc/Timecode.h"
+#include "Misc/FrameRate.h"
+#include "DisplayClusterOperationMode.h"
+#include "DisplayClusterStrings.h"
+
+
+/**
+ * Auxiliary class with different type conversion functions
+ */
+namespace FDisplayClusterTypesConverter
+{
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// TYPE --> STRING
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	template <typename ConvertFrom>
+	FString ToString(const ConvertFrom& from);
+
+	template <> FString ToString<> (const FString& from)   { return from; }
+	template <> FString ToString<> (const bool& from)      { return (from ? DisplayClusterStrings::cfg::spec::ValTrue : DisplayClusterStrings::cfg::spec::ValFalse); }
+	template <> FString ToString<> (const int32& from)     { return FString::FromInt(from); }
+	template <> FString ToString<> (const float& from)     { return FString::SanitizeFloat(from); }
+	template <> FString ToString<> (const double& from)    { return FString::Printf(TEXT("%lf"), from); }
+	template <> FString ToString<> (const FVector& from)   { return from.ToString(); }
+	template <> FString ToString<> (const FVector2D& from) { return from.ToString(); }
+	template <> FString ToString<> (const FRotator& from)  { return from.ToString(); }
+
+	// We can't just use FTimecode ToString as that loses information.
+	template <> FString ToString<> (const FTimecode& from)	{ return FString::Printf(TEXT("%d;%d;%d;%d;%d"), from.bDropFrameFormat ? 1 : 0, from.Hours, from.Minutes, from.Seconds, from.Frames); }
+	template <> FString ToString<> (const FFrameRate& from) 	{ return FString::Printf(TEXT("%d;%d"), from.Numerator, from.Denominator); }
+
+	template <> FString ToString<> (const EDisplayClusterOperationMode& from)
+	{
+		switch (from)
+		{
+		case EDisplayClusterOperationMode::Cluster:
+			return FString("cluster");
+		case EDisplayClusterOperationMode::Standalone:
+			return FString("standalone");
+		case EDisplayClusterOperationMode::Editor:
+			return FString("editor");
+		case EDisplayClusterOperationMode::Disabled:
+			return FString("disabled");
+		default:
+			return FString("unknown");
+		}
+	}
+
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// STRING --> TYPE
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	template <typename ConvertTo>
+	ConvertTo FromString(const FString& from);
+
+	template <> FString   FromString<> (const FString& from) { return from; }
+	template <> bool      FromString<> (const FString& from) { return (from == FString("1") || from == DisplayClusterStrings::cfg::spec::ValTrue); }
+	template <> int32     FromString<> (const FString& from) { return FCString::Atoi(*from); }
+	template <> float     FromString<> (const FString& from) { return FCString::Atof(*from); }
+	template <> double    FromString<> (const FString& from) { return FCString::Atod(*from); }
+	template <> FVector   FromString<> (const FString& from) { FVector vec;  vec.InitFromString(from); return vec; }
+	template <> FVector2D FromString<> (const FString& from) { FVector2D vec;  vec.InitFromString(from); return vec; }
+	template <> FRotator  FromString<> (const FString& from) { FRotator rot; rot.InitFromString(from); return rot; }
+	template <> FTimecode FromString<> (const FString& from)
+	{
+		FTimecode timecode;
+
+		TArray<FString> parts;
+		parts.Reserve(5);
+		const int32 found = from.ParseIntoArray(parts, TEXT(";"));
+
+		// We are expecting 5 "parts" - DropFrame, Hours, Minutes, Seconds, Frames.
+		if (found == 5)
+		{
+			timecode.bDropFrameFormat = FromString<bool>(parts[0]);
+			timecode.Hours = FromString<int32>(parts[1]);
+			timecode.Minutes = FromString<int32>(parts[2]);
+			timecode.Seconds = FromString<int32>(parts[3]);
+			timecode.Frames = FromString<int32>(parts[4]);
+		}
+
+		return timecode;
+	}
+	template <> FFrameRate FromString<> (const FString& from)
+	{
+		FFrameRate frameRate;
+
+		TArray<FString> parts;
+		parts.Reserve(2);
+		const int32 found = from.ParseIntoArray(parts, TEXT(";"));
+
+		// We are expecting 2 "parts" - Numerator, Denominator.
+		if (found == 2)
+		{
+			frameRate.Numerator = FromString<int32>(parts[0]);
+			frameRate.Denominator = FromString<int32>(parts[1]);
+		}
+
+		return frameRate;
+	}
+};
diff --git a/Source/DisplayCluster/Private/Network/DisplayClusterClient.cpp b/Source/DisplayCluster/Private/Network/DisplayClusterClient.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..034b658d2efe7875970142ffb1f72f791938c5b6
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/DisplayClusterClient.cpp
@@ -0,0 +1,115 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterClient.h"
+#include "Common/TcpSocketBuilder.h"
+
+#include "Misc/DisplayClusterAppExit.h"
+#include "Misc/DisplayClusterLog.h"
+#include "Misc/ScopeLock.h"
+
+
+FDisplayClusterClient::FDisplayClusterClient(const FString& name) :
+	FDisplayClusterSocketOps(CreateSocket(name)),
+	Name(name)
+{
+}
+
+FDisplayClusterClient::~FDisplayClusterClient()
+{
+	Disconnect();
+}
+
+bool FDisplayClusterClient::Connect(const FString& addr, const int32 port, const int32 triesAmount, const float delay)
+{
+	FScopeLock lock(&GetSyncObj());
+
+	// Generate IPv4 address
+	FIPv4Address ipAddr;
+	if (!FIPv4Address::Parse(addr, ipAddr))
+	{
+		UE_LOG(LogDisplayClusterNetwork, Error, TEXT("%s couldn't parse the address [%s:%d]"), *Name, *addr, port);
+		return false;
+	}
+
+	// Generate internet address
+	TSharedRef<FInternetAddr> internetAddr = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->CreateInternetAddr();
+	internetAddr->SetIp(ipAddr.Value);
+	internetAddr->SetPort(port);
+
+	// Start connection loop
+	int32 tryIdx = 0;
+	while(GetSocket()->Connect(*internetAddr) == false)
+	{
+		UE_LOG(LogDisplayClusterNetwork, Log, TEXT("%s couldn't connect to the server %s [%d]"), *Name, *(internetAddr->ToString(true)), tryIdx++);
+		if (triesAmount > 0 && tryIdx >= triesAmount)
+		{
+			UE_LOG(LogDisplayClusterNetwork, Error, TEXT("%s connection attempts limit reached"), *Name);
+			break;
+		}
+
+		// Sleep some time before next try
+		FPlatformProcess::Sleep(delay);
+	}
+
+	return IsOpen();
+}
+
+void FDisplayClusterClient::Disconnect()
+{
+	FScopeLock lock(&GetSyncObj());
+
+	UE_LOG(LogDisplayClusterNetwork, Log, TEXT("%s disconnecting..."), *Name);
+
+	if (IsOpen())
+	{
+		GetSocket()->Close();
+	}
+}
+
+FSocket* FDisplayClusterClient::CreateSocket(const FString& name, const int32 bufSize)
+{
+	FSocket* pSock = FTcpSocketBuilder(*name).AsBlocking().WithReceiveBufferSize(bufSize).WithSendBufferSize(bufSize);
+	check(pSock);
+	return pSock;
+}
+
+bool FDisplayClusterClient::SendMsg(const FDisplayClusterMessage::Ptr& msg)
+{
+	const bool result = FDisplayClusterSocketOps::SendMsg(msg);
+	if (result == false)
+	{
+		FDisplayClusterAppExit::ExitApplication(FDisplayClusterAppExit::ExitType::NormalSoft, FString("Something wrong with connection (send). The cluster is inconsistent. Exit required."));
+	}
+
+	return result;
+}
+
+FDisplayClusterMessage::Ptr FDisplayClusterClient::RecvMsg()
+{
+	FDisplayClusterMessage::Ptr response = FDisplayClusterSocketOps::RecvMsg();
+	if (!response.IsValid())
+	{
+		FDisplayClusterAppExit::ExitApplication(FDisplayClusterAppExit::ExitType::NormalSoft, FString("Something wrong with connection (recv). The cluster is inconsistent. Exit required."));
+	}
+
+	return response;
+}
+
+FDisplayClusterMessage::Ptr FDisplayClusterClient::SendRecvMsg(const FDisplayClusterMessage::Ptr& msg)
+{
+	FDisplayClusterMessage::Ptr response;
+
+	{
+		FScopeLock lock(&GetSyncObj());
+		SendMsg(msg);
+		response = RecvMsg();
+	}
+
+	if (!response.IsValid())
+	{
+		UE_LOG(LogDisplayClusterNetworkMsg, Warning, TEXT("No response"));
+	}
+
+	return response;
+}
+
diff --git a/Source/DisplayCluster/Private/Network/DisplayClusterClient.h b/Source/DisplayCluster/Private/Network/DisplayClusterClient.h
new file mode 100644
index 0000000000000000000000000000000000000000..96e01da11d92e17eb8383e8f72b3ccf8dc5a5d53
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/DisplayClusterClient.h
@@ -0,0 +1,47 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "DisplayClusterMessage.h"
+#include "DisplayClusterSocketOps.h"
+
+#include "DisplayClusterConstants.h"
+
+
+/**
+ * TCP client
+ */
+class FDisplayClusterClient
+	: protected FDisplayClusterSocketOps
+{
+public:
+	FDisplayClusterClient(const FString& name);
+	virtual ~FDisplayClusterClient();
+
+public:
+	// Connects to a server
+	bool Connect(const FString& addr, const int32 port, const int32 triesAmount = DisplayClusterConstants::net::ClientConnectTriesAmount, const float delay = DisplayClusterConstants::net::ClientConnectRetryDelay);
+	// Terminates current connection
+	void Disconnect();
+
+	virtual bool SendMsg(const FDisplayClusterMessage::Ptr& msg) override final;
+	virtual FDisplayClusterMessage::Ptr RecvMsg() override final;
+
+	FDisplayClusterMessage::Ptr SendRecvMsg(const FDisplayClusterMessage::Ptr& msg);
+
+	virtual FString GetName() const override final
+	{ return Name; }
+
+	inline bool IsConnected() const
+	{ return IsOpen(); }
+
+protected:
+	// Creates client socket
+	FSocket* CreateSocket(const FString& name, const int32 bufSize = DisplayClusterConstants::net::SocketBufferSize);
+
+private:
+	// Client name
+	const FString Name;
+};
+
diff --git a/Source/DisplayCluster/Private/Network/DisplayClusterMessage.cpp b/Source/DisplayCluster/Private/Network/DisplayClusterMessage.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4e1a9f6f76ea4e933be7033db7ede267ff02c031
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/DisplayClusterMessage.cpp
@@ -0,0 +1,94 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterMessage.h"
+
+#include "Misc/DisplayClusterLog.h"
+
+
+FDisplayClusterMessage::FDisplayClusterMessage()
+{
+}
+
+FDisplayClusterMessage::FDisplayClusterMessage(const FString& name, const FString& type, const FString& protocol) :
+	Name(name),
+	Type(type),
+	Protocol(protocol)
+{
+}
+
+FDisplayClusterMessage::~FDisplayClusterMessage()
+{
+}
+
+
+bool FDisplayClusterMessage::Serialize(FMemoryWriter& ar)
+{
+	// Header
+	ar << Name;
+	ar << Type;
+	ar << Protocol;
+
+	TArray<FString> keys;
+	Arguments.GenerateKeyArray(keys);
+
+	// Arguments amount
+	FString strArgAmount = FString::FromInt(Arguments.Num());
+	ar << strArgAmount;
+
+	// Arguments
+	for (int i = 0; i < keys.Num(); ++i)
+	{
+		ar << keys[i];
+		ar << Arguments[keys[i]];
+	}
+
+	return true;
+}
+
+bool FDisplayClusterMessage::Deserialize(FMemoryReader& ar)
+{
+	// Header
+	ar << Name;
+	ar << Type;
+	ar << Protocol;
+
+	// Arguments amount
+	FString strArgsAmount;
+	ar << strArgsAmount;
+	const int32 amount = FCString::Atoi(*strArgsAmount);
+	check(amount >= 0);
+	
+	// Arguments
+	for (int32 i = 0; i < amount; ++i)
+	{
+		FString key;
+		FString val;
+
+		ar << key;
+		ar << val;
+
+		Arguments.Add(key, val);
+	}
+
+	UE_LOG(LogDisplayClusterNetworkMsg, VeryVerbose, TEXT("Deserialized message: %s"), *ToString());
+
+	return true;
+}
+
+FString FDisplayClusterMessage::ToString() const
+{
+	return FString::Printf(TEXT("<prot=%s type=%s name=%s args={%s}>"), *GetProtocol(), *GetType(), *GetName(), *ArgsToString());
+}
+
+FString FDisplayClusterMessage::ArgsToString() const
+{
+	FString str;
+	str.Reserve(512);
+	
+	for (auto it = Arguments.CreateConstIterator(); it; ++it)
+	{
+		str += FString::Printf(TEXT("%s=%s "), *it->Key, *it->Value);
+	}
+
+	return str;
+}
diff --git a/Source/DisplayCluster/Private/Network/DisplayClusterMessage.h b/Source/DisplayCluster/Private/Network/DisplayClusterMessage.h
new file mode 100644
index 0000000000000000000000000000000000000000..7831123bf7d01e0f8ca539c7c1cdd2e53ad25703
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/DisplayClusterMessage.h
@@ -0,0 +1,84 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "IDisplayClusterSerializable.h"
+
+#include "Serialization/MemoryReader.h"
+#include "Serialization/MemoryWriter.h"
+
+#include "Misc/DisplayClusterTypesConverter.h"
+
+
+/**
+ * Abstract network message
+ */
+class FDisplayClusterMessage
+	: IDisplayClusterSerializable
+{
+public:
+	typedef TSharedPtr<FDisplayClusterMessage> Ptr;
+	typedef TMap<FString, FString> DataType;
+
+public:
+	FDisplayClusterMessage();
+	FDisplayClusterMessage(const FString& name, const FString& type, const FString& protocol);
+
+	FDisplayClusterMessage(const FDisplayClusterMessage&) = default;
+	FDisplayClusterMessage(FDisplayClusterMessage&&)      = default;
+	
+	FDisplayClusterMessage& operator= (const FDisplayClusterMessage&) = default;
+	FDisplayClusterMessage& operator= (FDisplayClusterMessage&&)      = default;
+	
+	virtual ~FDisplayClusterMessage();
+
+public:
+	// Message head
+	inline FString GetName()     const { return Name; }
+	inline FString GetType()     const { return Type; }
+	inline FString GetProtocol() const { return Protocol; }
+
+	// Sets arguments to a message
+	template <typename ValType>
+	bool GetArg(const FString& argName, ValType& argVal) const
+	{
+		if (Arguments.Contains(argName))
+		{
+			FString strVal = Arguments[argName];
+			argVal = FDisplayClusterTypesConverter::FromString<ValType>(strVal);
+			return true;
+		}
+		return false;
+	}
+
+	// Get arguments from a message
+	template <typename ValType>
+	void SetArg(const FString& argName, const ValType& argVal)
+	{
+		Arguments.Add(argName, FDisplayClusterTypesConverter::ToString<ValType>(argVal));
+	}
+
+	// Get all arguments (be careful with the reference)
+	const DataType& GetArgs() const
+	{ return Arguments; }
+
+	void SetArgs(const DataType& data)
+	{ Arguments = data; }
+
+	// Serialization
+	virtual bool Serialize  (FMemoryWriter& ar) override;
+	virtual bool Deserialize(FMemoryReader& ar) override;
+
+	FString ToString() const;
+
+private:
+	//inline bool ExtractKeyVal(const FString& pair, FString& key, FString& val);
+	FString ArgsToString() const;
+
+private:
+	FString Name;
+	FString Type;
+	FString Protocol;
+
+	DataType Arguments;
+};
diff --git a/Source/DisplayCluster/Private/Network/DisplayClusterServer.cpp b/Source/DisplayCluster/Private/Network/DisplayClusterServer.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..c39650ca01f23225098102b76b3177d4f4fa2f62
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/DisplayClusterServer.cpp
@@ -0,0 +1,106 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterServer.h"
+
+#include "Misc/DisplayClusterLog.h"
+#include "Misc/ScopeLock.h"
+
+
+FDisplayClusterServer::FDisplayClusterServer(const FString& name, const FString& addr, const int32 port) :
+	Name(name),
+	Address(addr),
+	Port(port),
+	Listener(name + FString("_listener"))
+{
+	check(port > 0 && port < 0xffff);
+	
+	// Bind connection handler method
+	Listener.OnConnectionAccepted().BindRaw(this, &FDisplayClusterServer::ConnectionHandler);
+}
+
+FDisplayClusterServer::~FDisplayClusterServer()
+{
+	// Call from child .dtor
+	Shutdown();
+}
+
+bool FDisplayClusterServer::Start()
+{
+	FScopeLock lock(&InternalsSyncScope);
+
+	if (bIsRunning == true)
+	{
+		return true;
+	}
+
+	if (!Listener.StartListening(Address, Port))
+	{
+		UE_LOG(LogDisplayClusterNetwork, Error, TEXT("%s couldn't start the listener [%s:%d]"), *Name, *Address, Port);
+		return false;
+	}
+
+	// Update server state
+	bIsRunning = true;
+
+	return bIsRunning;
+}
+
+void FDisplayClusterServer::Shutdown()
+{
+	FScopeLock lock(&InternalsSyncScope);
+
+	if (bIsRunning == false)
+	{
+		return;
+	}
+
+	UE_LOG(LogDisplayClusterNetwork, Log, TEXT("%s stopping the service..."), *Name);
+
+	// Stop connections listening
+	Listener.StopListening();
+	// Destroy active sessions
+	Sessions.Reset();
+	// Update server state
+	bIsRunning = false;
+}
+
+bool FDisplayClusterServer::IsRunning()
+{
+	FScopeLock lock(&InternalsSyncScope);
+	return bIsRunning;
+}
+
+bool FDisplayClusterServer::ConnectionHandler(FSocket* pSock, const FIPv4Endpoint& ep)
+{
+	FScopeLock lock(&InternalsSyncScope);
+	check(pSock);
+
+	if (IsRunning() && IsConnectionAllowed(pSock, ep))
+	{
+		pSock->SetLinger(false, 0);
+		pSock->SetNonBlocking(false);
+
+		int32 newSize = static_cast<int32>(DisplayClusterConstants::net::SocketBufferSize);
+		int32 setSize;
+		pSock->SetReceiveBufferSize(newSize, setSize);
+		pSock->SetSendBufferSize(newSize, setSize);
+
+		Sessions.Add(TUniquePtr<FDisplayClusterSession>(new FDisplayClusterSession(pSock, this, GetName() + FString("_session_") + ep.ToString())));
+		return true;
+	}
+
+	return false;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterSessionListener
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterServer::NotifySessionOpen(FDisplayClusterSession* pSession)
+{
+}
+
+void FDisplayClusterServer::NotifySessionClose(FDisplayClusterSession* pSession)
+{
+}
+
+
diff --git a/Source/DisplayCluster/Private/Network/DisplayClusterServer.h b/Source/DisplayCluster/Private/Network/DisplayClusterServer.h
new file mode 100644
index 0000000000000000000000000000000000000000..49c6108fa62c3cccd0291c163d4ab725aa21d970
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/DisplayClusterServer.h
@@ -0,0 +1,79 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "IDisplayClusterSessionListener.h"
+
+#include "DisplayClusterSession.h"
+#include "DisplayClusterTcpListener.h"
+
+
+struct FIPv4Endpoint;
+
+
+/**
+ * TCP server
+ */
+class FDisplayClusterServer
+	: public IDisplayClusterSessionListener
+{
+public:
+	FDisplayClusterServer(const FString& name, const FString& addr, const int32 port);
+	virtual ~FDisplayClusterServer();
+
+public:
+	// Start server
+	virtual bool Start();
+	// Stop server
+	virtual void Shutdown();
+
+	// Returns current server state
+	bool IsRunning();
+
+	// Server name
+	inline const FString& GetName() const
+	{ return Name; }
+
+	// Server addr
+	inline const FString& GetAddr() const
+	{ return Address; }
+
+	// Server port
+	inline const int32& GetPort() const
+	{ return Port; }
+
+protected:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterSessionListener
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void NotifySessionOpen(FDisplayClusterSession* pSession) override;
+	virtual void NotifySessionClose(FDisplayClusterSession* pSession) override;
+	virtual FDisplayClusterMessage::Ptr ProcessMessage(FDisplayClusterMessage::Ptr msg) = 0;
+
+protected:
+	// Ask concrete server implementation if connection is allowed
+	virtual bool IsConnectionAllowed(FSocket* pSock, const FIPv4Endpoint& ep)
+	{ return true; }
+
+private:
+	// Handles incoming connections
+	bool ConnectionHandler(FSocket* pSock, const FIPv4Endpoint& ep);
+
+private:
+	// Server data
+	const FString Name;
+	const FString Address;
+	const int32   Port;
+
+	// Simple server state
+	bool bIsRunning = false;
+	// Socket listener
+	FDisplayClusterTcpListener Listener;
+	// Sync access
+	FCriticalSection InternalsSyncScope;
+
+	// Active sessions
+	TArray<TUniquePtr<FDisplayClusterSession>> Sessions;
+};
+
diff --git a/Source/DisplayCluster/Private/Network/DisplayClusterSession.cpp b/Source/DisplayCluster/Private/Network/DisplayClusterSession.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..1a60d1b8e95cf760cfcabcb374a94f031af1fff2
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/DisplayClusterSession.cpp
@@ -0,0 +1,68 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterSession.h"
+#include "DisplayClusterServer.h"
+#include "DisplayClusterMessage.h"
+
+#include "HAL/RunnableThread.h"
+
+#include "Misc/DisplayClusterLog.h"
+
+
+FDisplayClusterSession::FDisplayClusterSession(FSocket* pSock, IDisplayClusterSessionListener* pListener, const FString& name) :
+	FDisplayClusterSocketOps(pSock),
+	Name(name),
+	Listener(pListener)
+{
+	check(pSock);
+	check(pListener);
+
+	ThreadObj = FRunnableThread::Create(this, *(Name + FString("_thread")), 128 * 1024, TPri_Normal, FPlatformAffinity::GetPoolThreadMask());
+	ensure(ThreadObj);
+
+	Listener->NotifySessionOpen(this);
+
+	UE_LOG(LogDisplayClusterNetwork, Log, TEXT("Session %s started"), *Name);
+}
+
+FDisplayClusterSession::~FDisplayClusterSession()
+{
+	UE_LOG(LogDisplayClusterNetwork, VeryVerbose, TEXT("Session %s .dtor"), *Name);
+
+	Stop();
+	ThreadObj->WaitForCompletion();
+	delete ThreadObj;
+}
+
+void FDisplayClusterSession::Stop()
+{
+	GetSocket()->Close();
+}
+
+uint32 FDisplayClusterSession::Run()
+{
+	UE_LOG(LogDisplayClusterNetwork, Log, TEXT("Session thread %s started"), *Name);
+
+	while (IsOpen())
+	{
+		FDisplayClusterMessage::Ptr req = RecvMsg();
+		if (req.IsValid())
+		{
+			FDisplayClusterMessage::Ptr resp = Listener->ProcessMessage(req);
+			if (resp.IsValid())
+			{
+				if (SendMsg(resp))
+				{
+					// 'Transaction' has been completed successfully so we continue the processing
+					continue;
+				}
+			}
+		}
+
+		GetSocket()->Close();
+		Listener->NotifySessionClose(this);
+	}
+
+	UE_LOG(LogDisplayClusterNetwork, Log, TEXT("Session thread %s finished"), *Name);
+	return 0;
+}
diff --git a/Source/DisplayCluster/Private/Network/DisplayClusterSession.h b/Source/DisplayCluster/Private/Network/DisplayClusterSession.h
new file mode 100644
index 0000000000000000000000000000000000000000..2b4ff9af60951cd2be4a477a60372eb1fd0357bf
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/DisplayClusterSession.h
@@ -0,0 +1,35 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "HAL/Runnable.h"
+#include "DisplayClusterSocketOps.h"
+
+#include "IDisplayClusterSessionListener.h"
+
+
+/**
+ * TCP connection session
+ */
+class FDisplayClusterSession
+	: public    FRunnable
+	, protected FDisplayClusterSocketOps
+{
+public:
+	FDisplayClusterSession(FSocket* pSock, IDisplayClusterSessionListener* pListener, const FString& name = FString("DisplayClusterSession"));
+	~FDisplayClusterSession();
+
+	virtual FString GetName() const override final
+	{ return Name; }
+
+private:
+	virtual uint32 Run() override;
+	virtual void   Stop() override;
+
+private:
+	const FString        Name;
+	IDisplayClusterSessionListener* Listener = nullptr;
+	FRunnableThread* ThreadObj = nullptr;
+};
+
diff --git a/Source/DisplayCluster/Private/Network/DisplayClusterSocketOps.cpp b/Source/DisplayCluster/Private/Network/DisplayClusterSocketOps.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5f5ba80bc1dcc3493f82a0f862d8fc04bab3235f
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/DisplayClusterSocketOps.cpp
@@ -0,0 +1,194 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterSocketOps.h"
+
+#include "DisplayClusterConstants.h"
+#include "SocketSubsystem.h"
+
+#include "Misc/DisplayClusterLog.h"
+#include "Misc/ScopeLock.h"
+
+
+FDisplayClusterSocketOps::FDisplayClusterSocketOps(FSocket* pSock) :
+	Socket(pSock)
+{
+	DataBuffer.Reserve(DisplayClusterConstants::net::MessageBufferSize);
+}
+
+
+FDisplayClusterSocketOps::~FDisplayClusterSocketOps()
+{
+	ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->DestroySocket(Socket);
+}
+
+FDisplayClusterMessage::Ptr FDisplayClusterSocketOps::RecvMsg()
+{
+	FScopeLock lock(&GetSyncObj());
+
+	if (!IsOpen())
+	{
+		UE_LOG(LogDisplayClusterNetwork, Error, TEXT("%s - not connected"), *GetName());
+		return nullptr;
+	}
+
+	// Read message header
+	if (!RecvChunk(sizeof(FDisplayClusterMessageHeader), DataBuffer, FString("header-chunk")))
+	{
+		return nullptr;
+	}
+
+	// Ok. Now we can extract header data
+	FDisplayClusterMessageHeader msgHeader;
+	FMemory::Memcpy(&msgHeader, DataBuffer.GetData(), sizeof(FDisplayClusterMessageHeader));
+
+	UE_LOG(LogDisplayClusterNetwork, VeryVerbose, TEXT("%s - message header received: %s"), *GetName(), *msgHeader.ToString());
+	check(msgHeader.length > 0);
+
+	// Read message body
+	if (!RecvChunk(msgHeader.length, DataBuffer, FString("body-chunk")))
+	{
+		return nullptr;
+	}
+
+	UE_LOG(LogDisplayClusterNetwork, VeryVerbose, TEXT("%s - message body received"), *GetName());
+
+	FDisplayClusterMessage::Ptr msg(new FDisplayClusterMessage());
+	FMemoryReader ar = FMemoryReader(DataBuffer, false);
+
+	// Deserialize message from buffer
+	if (!msg->Deserialize(ar))
+	{
+		UE_LOG(LogDisplayClusterNetworkMsg, Error, TEXT("%s couldn't deserialize a message"), *GetName());
+		return nullptr;
+	}
+
+	// Succeeded
+	UE_LOG(LogDisplayClusterNetworkMsg, Verbose, TEXT("%s - received a message: %s"), *GetName(), *msg->ToString());
+	return msg;
+}
+
+bool FDisplayClusterSocketOps::RecvChunk(int32 chunkSize, TArray<uint8>& chunkBuffer, const FString& chunkName)
+{
+	int32 bytesReadAll = 0;
+	int32 bytesReadNow = 0;
+	int32 bytesReadLeft = 0;
+	const int32 bytesAll = chunkSize;
+	chunkBuffer.Empty(DisplayClusterConstants::net::MessageBufferSize);
+
+	// Receive message header at first
+	while (bytesReadAll < bytesAll)
+	{
+		// Read data
+		bytesReadLeft = bytesAll - bytesReadAll;
+		if (!Socket->Recv(chunkBuffer.GetData(), bytesReadLeft, bytesReadNow))
+		{
+			UE_LOG(LogDisplayClusterNetwork, Warning, TEXT("%s - %s recv failed - socket error. Cluster integrity disturbed."), *GetName(), *chunkName);
+			return false;
+		}
+
+		// Check amount of read data
+		if (bytesReadNow <= 0 || bytesReadNow > bytesReadLeft)
+		{
+			UE_LOG(LogDisplayClusterNetwork, Error, TEXT("%s - %s recv failed - read wrong amount of bytes: %d"), *GetName(), *chunkName, bytesReadNow);
+			return false;
+		}
+
+		bytesReadAll += bytesReadNow;
+		UE_LOG(LogDisplayClusterNetwork, VeryVerbose, TEXT("%s - %s received %d bytes, left %d bytes"), *GetName(), *chunkName, bytesReadNow, bytesAll - bytesReadAll);
+
+		// Convergence check
+		if (bytesReadAll > bytesAll)
+		{
+			UE_LOG(LogDisplayClusterNetwork, Error, TEXT("%s - %s convergence fail: overall received %d of %d"), *GetName(), *chunkName, bytesReadAll, bytesAll);
+			return false;
+		}
+	}
+
+	// Update array length (amount of bytes as array elements)
+	chunkBuffer.SetNumUninitialized(bytesReadAll);
+
+	// Operation succeeded
+	return true;
+}
+
+bool FDisplayClusterSocketOps::SendMsg(const FDisplayClusterMessage::Ptr& msg)
+{
+	FScopeLock lock(&GetSyncObj());
+
+	UE_LOG(LogDisplayClusterNetwork, Verbose, TEXT("%s - sending message: %s"), *GetName(), *msg->ToString());
+
+	if (!IsOpen())
+	{
+		UE_LOG(LogDisplayClusterNetwork, Error, TEXT("%s not connected"), *GetName());
+		return false;
+	}
+
+	// Prepare output buffer
+	DataBuffer.Empty(DisplayClusterConstants::net::MessageBufferSize);
+	DataBuffer.AddZeroed(sizeof(FDisplayClusterMessageHeader));
+	FMemoryWriter memoryWriter(DataBuffer);
+
+	// Reserve space for message header
+	memoryWriter.Seek(sizeof(FDisplayClusterMessageHeader));
+
+	// Serialize the message
+	if (!msg->Serialize(memoryWriter))
+	{
+		UE_LOG(LogDisplayClusterNetworkMsg, Error, TEXT("%s couldn't serialize a message"), *GetName());
+		return false;
+	}
+
+	// Check bounds
+	const int32 msgLength = DataBuffer.Num();
+	if (msgLength > DisplayClusterConstants::net::SocketBufferSize)
+	{
+		UE_LOG(LogDisplayClusterNetworkMsg, Error, TEXT("Outgoing message length exceeds buffer limit: length=%d > limit=%d"), msgLength, DisplayClusterConstants::net::SocketBufferSize);
+		return false;
+	}
+
+	// Initialize message header
+	FDisplayClusterMessageHeader msgHeader;
+	msgHeader.length = static_cast<int16>(msgLength & 0x7FFF) - sizeof(FDisplayClusterMessageHeader);
+	UE_LOG(LogDisplayClusterNetworkMsg, Verbose, TEXT("Outgoing message body length %d"), msgHeader.length);
+
+	// Fill packet header with message data length
+	FMemory::Memcpy(DataBuffer.GetData(), &msgHeader, sizeof(FDisplayClusterMessageHeader));
+
+	int32 bytesWriteAll  = 0;
+	int32 bytesWriteNow  = 0;
+	int32 bytesWriteLeft = 0;
+
+	while (bytesWriteAll < msgLength)
+	{
+		bytesWriteLeft = msgLength - bytesWriteAll;
+
+		// Send data
+		if (!Socket->Send(DataBuffer.GetData() + bytesWriteAll, bytesWriteLeft, bytesWriteNow))
+		{
+			UE_LOG(LogDisplayClusterNetwork, Error, TEXT("%s - couldn't send a message (length=%d)"), *GetName(), msgLength);
+			return false;
+		}
+
+		// Check amount of sent bytes
+		if (bytesWriteNow <= 0 || bytesWriteNow > bytesWriteLeft)
+		{
+			UE_LOG(LogDisplayClusterNetwork, Error, TEXT("%s - sent wrong amount of bytes: %d of %d left"), *GetName(), bytesWriteNow, bytesWriteLeft);
+			return false;
+		}
+
+		bytesWriteAll += bytesWriteNow;
+		UE_LOG(LogDisplayClusterNetwork, VeryVerbose, TEXT("%s - sent %d bytes, left %d bytes"), *GetName(), bytesWriteNow, msgLength - bytesWriteAll);
+
+		// Convergence check
+		if (bytesWriteAll > msgLength)
+		{
+			UE_LOG(LogDisplayClusterNetwork, Error, TEXT("%s - convergence failed: overall sent %d of %d"), *GetName(), bytesWriteAll, msgLength);
+			return false;
+		}
+	}
+
+	UE_LOG(LogDisplayClusterNetwork, Verbose, TEXT("%s - message sent"), *GetName());
+
+	return true;
+}
+
diff --git a/Source/DisplayCluster/Private/Network/DisplayClusterSocketOps.h b/Source/DisplayCluster/Private/Network/DisplayClusterSocketOps.h
new file mode 100644
index 0000000000000000000000000000000000000000..f8cfe3ebd753101766aa764f7873ad90f258a77c
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/DisplayClusterSocketOps.h
@@ -0,0 +1,58 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "Sockets.h"
+#include "DisplayClusterMessage.h"
+
+
+/**
+ * Socket operations (base class for client and server)
+ */
+class FDisplayClusterSocketOps
+{
+public:
+	FDisplayClusterSocketOps(FSocket* pSock);
+	virtual ~FDisplayClusterSocketOps();
+
+public:
+	virtual bool SendMsg(const FDisplayClusterMessage::Ptr& msg);
+	virtual FDisplayClusterMessage::Ptr RecvMsg();
+
+	inline FSocket* GetSocket() const
+	{ return Socket; }
+
+	inline bool IsOpen() const
+	{ return (Socket && (Socket->GetConnectionState() == ESocketConnectionState::SCS_Connected)); }
+
+	// Provides with net unit name
+	virtual FString GetName() const = 0;
+
+protected:
+	// Provides with a synchronization object for underlying operations (message send/recv)
+	inline FCriticalSection& GetSyncObj() const
+	{ return InternalsSyncScope; }
+
+private:
+	bool RecvChunk(int32 chunkSize, TArray<uint8>& chunkBuffer, const FString& chunkName = FString("DataChunk"));
+
+private:
+	struct FDisplayClusterMessageHeader
+	{
+		int16 length;
+
+		FString ToString()
+		{ return FString::Printf(TEXT("<length=%d>"), length); }
+
+	};
+
+private:
+	// Socket
+	FSocket* Socket = nullptr;
+	// Data buffer for incoming and outgoing messages
+	TArray<uint8> DataBuffer;
+	// Access sync object
+	mutable FCriticalSection InternalsSyncScope;
+};
+
diff --git a/Source/DisplayCluster/Private/Network/DisplayClusterTcpListener.cpp b/Source/DisplayCluster/Private/Network/DisplayClusterTcpListener.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..f7bc1d3ffe8c10d5aa6219816013d333d0803449
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/DisplayClusterTcpListener.cpp
@@ -0,0 +1,153 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterTcpListener.h"
+
+#include "Misc/DisplayClusterLog.h"
+#include "HAL/RunnableThread.h"
+
+#include "Common/TcpSocketBuilder.h"
+
+#include "Misc/DisplayClusterAppExit.h"
+#include "Misc/DisplayClusterHelpers.h"
+
+
+FDisplayClusterTcpListener::FDisplayClusterTcpListener(const FString& name) :
+	Name(name)
+{
+}
+
+
+FDisplayClusterTcpListener::~FDisplayClusterTcpListener()
+{
+	// Just free resources by stopping the listening
+	StopListening();
+}
+
+
+bool FDisplayClusterTcpListener::StartListening(const FString& addr, const int32 port)
+{
+	FScopeLock lock(&InternalsSyncScope);
+
+	if (bIsListening == true)
+	{
+		return true;
+	}
+
+	FIPv4Endpoint ep;
+	if (!DisplayClusterHelpers::net::GenIPv4Endpoint(addr, port, ep))
+	{
+		return false;
+	}
+
+	return StartListening(ep);
+}
+
+bool FDisplayClusterTcpListener::StartListening(const FIPv4Endpoint& ep)
+{
+	FScopeLock lock(&InternalsSyncScope);
+
+	if (bIsListening == true)
+	{
+		return true;
+	}
+
+	// Save new endpoint
+	Endpoint = ep;
+
+	// Create listening thread
+	ThreadObj = FRunnableThread::Create(this, *(Name + FString("_thread")), 1 * 1024, TPri_Normal);
+	ensure(ThreadObj);
+
+	// Update state
+	bIsListening = true;
+	
+	return bIsListening;
+}
+
+
+void FDisplayClusterTcpListener::StopListening()
+{
+	FScopeLock lock(&InternalsSyncScope);
+
+	if (bIsListening == false)
+	{
+		return;
+	}
+
+	// Ask runnable to stop
+	Stop();
+
+	// Wait for thread finish and release it then
+	if (ThreadObj)
+	{
+		ThreadObj->WaitForCompletion();
+		delete ThreadObj;
+		ThreadObj = nullptr;
+	}
+}
+
+bool FDisplayClusterTcpListener::IsActive() const
+{
+	return bIsListening;
+}
+
+bool FDisplayClusterTcpListener::Init()
+{
+	// Create socket
+	SocketObj = FTcpSocketBuilder(*Name).AsBlocking().BoundToEndpoint(Endpoint).Listening(128);
+	if (!SocketObj)
+	{
+		// Just exit. No need to perform some notification from this thread to the cluster manager to notify
+		// about this fail. Just kill the application. 
+		FDisplayClusterAppExit::ExitApplication(FDisplayClusterAppExit::ExitType::KillImmediately, FString("Couldn't start listener socket"));
+		return false;
+	}
+
+	return true;
+}
+
+uint32 FDisplayClusterTcpListener::Run()
+{
+	TSharedRef<FInternetAddr> RemoteAddress = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->CreateInternetAddr();
+
+	if (SocketObj)
+	{
+		while (FSocket* pSock = SocketObj->Accept(*RemoteAddress, TEXT("FDisplayClusterTcpListener client")))
+		{
+			if (OnConnectionAcceptedDelegate.IsBound())
+			{
+				if (!OnConnectionAcceptedDelegate.Execute(pSock, FIPv4Endpoint(RemoteAddress)))
+				{
+					pSock->Close();
+					ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->DestroySocket(pSock);
+				}
+			}
+		}
+	}
+	else
+	{
+		UE_LOG(LogDisplayClusterNetwork, Error, TEXT("Socket is not initialized"));
+		return 0;
+	}
+
+	return 0;
+}
+
+void FDisplayClusterTcpListener::Stop()
+{
+	// Close the socket to unblock thread
+	if (SocketObj)
+	{
+		SocketObj->Close();
+	}
+}
+
+void FDisplayClusterTcpListener::Exit()
+{
+	// Release the socket
+	if (SocketObj)
+	{
+		ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->DestroySocket(SocketObj);
+		SocketObj = nullptr;
+	}
+}
diff --git a/Source/DisplayCluster/Private/Network/DisplayClusterTcpListener.h b/Source/DisplayCluster/Private/Network/DisplayClusterTcpListener.h
new file mode 100644
index 0000000000000000000000000000000000000000..9e674ffd7ddcd17d0f8d5c60a0491dde08d895c9
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/DisplayClusterTcpListener.h
@@ -0,0 +1,67 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "Sockets.h"
+#include "HAL/Runnable.h"
+#include "Delegates/DelegateCombinations.h"
+#include "Interfaces/IPv4/IPv4Endpoint.h"
+#include "DisplayClusterConstants.h"
+
+
+/**
+ * TCP connection listener
+ */
+class FDisplayClusterTcpListener
+	: public FRunnable
+{
+public:
+	DECLARE_DELEGATE_RetVal_TwoParams(bool, TOnConnectionAcceptedDelegate, FSocket*, const FIPv4Endpoint&)
+
+public:
+	FDisplayClusterTcpListener(const FString& name);
+	~FDisplayClusterTcpListener();
+
+public:
+
+	bool StartListening(const FString& addr, const int32 port);
+	bool StartListening(const FIPv4Endpoint& ep);
+	void StopListening();
+
+	bool IsActive() const;
+
+	inline TOnConnectionAcceptedDelegate& OnConnectionAccepted()
+	{ return OnConnectionAcceptedDelegate; }
+
+protected:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// FRunnable
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool Init() override;
+	virtual uint32 Run() override;
+	virtual void Stop() override;
+	virtual void Exit() override;
+
+private:
+	// Creates server socket
+	FSocket* CreateSocket(const FString& name, const FString& addr, const int32 port, const int32 bufSize = DisplayClusterConstants::net::SocketBufferSize);
+	
+private:
+	// Socket name
+	FString Name;
+	// Listening socket
+	FSocket* SocketObj = nullptr;
+	// Listening endpoint
+	FIPv4Endpoint Endpoint;
+	// Holds the thread object
+	FRunnableThread* ThreadObj;
+	// Sync access
+	FCriticalSection InternalsSyncScope;
+	// Listening state
+	bool bIsListening = false;
+
+private:
+	// Holds a delegate to be invoked when an incoming connection has been accepted.
+	TOnConnectionAcceptedDelegate OnConnectionAcceptedDelegate;
+};
diff --git a/Source/DisplayCluster/Private/Network/IDisplayClusterSessionListener.h b/Source/DisplayCluster/Private/Network/IDisplayClusterSessionListener.h
new file mode 100644
index 0000000000000000000000000000000000000000..28ee4465548941bcaef69793591c6d50f446a9e0
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/IDisplayClusterSessionListener.h
@@ -0,0 +1,27 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "DisplayClusterMessage.h"
+
+class FDisplayClusterSession;
+
+
+/**
+ * TCP session listener interface
+ */
+struct IDisplayClusterSessionListener
+{
+	virtual ~IDisplayClusterSessionListener()
+	{ }
+
+	virtual void NotifySessionOpen(FDisplayClusterSession* pSession)
+	{ }
+
+	virtual void NotifySessionClose(FDisplayClusterSession* pSession)
+	{ }
+
+	// Pass a message to a concrete implementation
+	virtual FDisplayClusterMessage::Ptr ProcessMessage(FDisplayClusterMessage::Ptr msg) = 0;
+};
+
diff --git a/Source/DisplayCluster/Private/Network/Protocol/IPDisplayClusterClusterSyncProtocol.h b/Source/DisplayCluster/Private/Network/Protocol/IPDisplayClusterClusterSyncProtocol.h
new file mode 100644
index 0000000000000000000000000000000000000000..4b898dfb07bf881fd6f75606368a728d079c5089
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/Protocol/IPDisplayClusterClusterSyncProtocol.h
@@ -0,0 +1,43 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Misc/FrameRate.h"
+#include "Misc/Timecode.h"
+#include "Network/DisplayClusterMessage.h"
+
+
+/**
+ * Cluster state synchronization protocol
+ */
+class IPDisplayClusterClusterSyncProtocol
+{
+public:
+	// Game start barrier
+	virtual void WaitForGameStart() = 0;
+
+	// Frame start barrier
+	virtual void WaitForFrameStart() = 0;
+
+	// Frame end barrier
+	virtual void WaitForFrameEnd() = 0;
+
+	// Tick end barrier
+	virtual void WaitForTickEnd() = 0;
+
+	// Tracking update barrier
+	virtual void WaitForTrackingUpdate() = 0;
+
+	// Provides with time delta for current frame
+	virtual void GetDeltaTime(float& deltaTime) = 0;
+
+	// Get the Timecode value for the current frame.
+	virtual void GetTimecode(FTimecode& timecode, FFrameRate& frameRate) = 0;
+
+	// Sync objects
+	virtual void GetSyncData(FDisplayClusterMessage::DataType& data) = 0;
+
+	// Sync input
+	virtual void GetInputData(FDisplayClusterMessage::DataType& data) = 0;
+};
+
diff --git a/Source/DisplayCluster/Private/Network/Protocol/IPDisplayClusterSwapSyncProtocol.h b/Source/DisplayCluster/Private/Network/Protocol/IPDisplayClusterSwapSyncProtocol.h
new file mode 100644
index 0000000000000000000000000000000000000000..d31a1d03b5c96020420e2eb81a5921c254e79103
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/Protocol/IPDisplayClusterSwapSyncProtocol.h
@@ -0,0 +1,15 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+
+/**
+ * Swap synchronization protocol
+ */
+class IPDisplayClusterSwapSyncProtocol
+{
+public:
+	// Swap sync barrier
+	virtual void WaitForSwapSync(double* pThreadWaitTime, double* pBarrierWaitTime) = 0;
+};
+
diff --git a/Source/DisplayCluster/Private/Network/Service/ClusterSync/DisplayClusterClusterSyncClient.cpp b/Source/DisplayCluster/Private/Network/Service/ClusterSync/DisplayClusterClusterSyncClient.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b9a99fb8a444dc305ef20c3fad5e5312f9b9538f
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/Service/ClusterSync/DisplayClusterClusterSyncClient.cpp
@@ -0,0 +1,131 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterClusterSyncClient.h"
+#include "DisplayClusterClusterSyncMsg.h"
+
+#include "Misc/DisplayClusterLog.h"
+#include "Misc/ScopeLock.h"
+
+
+FDisplayClusterClusterSyncClient::FDisplayClusterClusterSyncClient() :
+	FDisplayClusterClient(FString("CLN_CS"))
+{
+}
+
+FDisplayClusterClusterSyncClient::FDisplayClusterClusterSyncClient(const FString& name) :
+	FDisplayClusterClient(name)
+{
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IPDisplayClusterClusterSyncProtocol
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterClusterSyncClient::WaitForGameStart()
+{
+	static TSharedPtr<FDisplayClusterMessage> request(new FDisplayClusterMessage(FDisplayClusterClusterSyncMsg::WaitForGameStart::name, FDisplayClusterClusterSyncMsg::TypeRequest, FDisplayClusterClusterSyncMsg::ProtocolName));
+	TSharedPtr<FDisplayClusterMessage> response;
+
+	{
+		FScopeLock lock(&GetSyncObj());
+		SendMsg(request);
+		response = RecvMsg();
+	}
+
+	if (!response.IsValid())
+	{
+		UE_LOG(LogDisplayClusterNetworkMsg, Warning, TEXT("No response"));
+		return;
+	}
+}
+
+void FDisplayClusterClusterSyncClient::WaitForFrameStart()
+{
+	static const TSharedPtr<FDisplayClusterMessage> request(new FDisplayClusterMessage(FDisplayClusterClusterSyncMsg::WaitForFrameStart::name, FDisplayClusterClusterSyncMsg::TypeRequest, FDisplayClusterClusterSyncMsg::ProtocolName));
+	TSharedPtr<FDisplayClusterMessage> response = SendRecvMsg(request);
+}
+
+void FDisplayClusterClusterSyncClient::WaitForFrameEnd()
+{
+	static const TSharedPtr<FDisplayClusterMessage> request(new FDisplayClusterMessage(FDisplayClusterClusterSyncMsg::WaitForFrameEnd::name, FDisplayClusterClusterSyncMsg::TypeRequest, FDisplayClusterClusterSyncMsg::ProtocolName));
+	TSharedPtr<FDisplayClusterMessage> response = SendRecvMsg(request);
+}
+
+void FDisplayClusterClusterSyncClient::WaitForTickEnd()
+{
+	static const TSharedPtr<FDisplayClusterMessage> request(new FDisplayClusterMessage(FDisplayClusterClusterSyncMsg::WaitForTickEnd::name, FDisplayClusterClusterSyncMsg::TypeRequest, FDisplayClusterClusterSyncMsg::ProtocolName));
+	TSharedPtr<FDisplayClusterMessage> response = SendRecvMsg(request);
+}
+
+void FDisplayClusterClusterSyncClient::WaitForTrackingUpdate()
+{
+    static const TSharedPtr<FDisplayClusterMessage> request(new FDisplayClusterMessage(FDisplayClusterClusterSyncMsg::WaitForTrackingUpdate::name, FDisplayClusterClusterSyncMsg::TypeRequest, FDisplayClusterClusterSyncMsg::ProtocolName));
+    TSharedPtr<FDisplayClusterMessage> response = SendRecvMsg(request);
+}
+
+void FDisplayClusterClusterSyncClient::GetDeltaTime(float& deltaTime)
+{
+	static const TSharedPtr<FDisplayClusterMessage> request(new FDisplayClusterMessage(FDisplayClusterClusterSyncMsg::GetDeltaTime::name, FDisplayClusterClusterSyncMsg::TypeRequest, FDisplayClusterClusterSyncMsg::ProtocolName));
+	TSharedPtr<FDisplayClusterMessage> response = SendRecvMsg(request);
+
+	if (!response.IsValid())
+	{
+		return;
+	}
+
+	// Extract sync data from response message
+	if (response->GetArg(FDisplayClusterClusterSyncMsg::GetDeltaTime::argDeltaTime, deltaTime) == false)
+	{
+		UE_LOG(LogDisplayClusterNetworkMsg, Error, TEXT("Couldn't extract an argument: %s"), FDisplayClusterClusterSyncMsg::GetDeltaTime::argDeltaTime);
+	}
+}
+
+void FDisplayClusterClusterSyncClient::GetTimecode(FTimecode& timecode, FFrameRate& frameRate)
+{
+	static const TSharedPtr<FDisplayClusterMessage> request(new FDisplayClusterMessage(FDisplayClusterClusterSyncMsg::GetTimecode::name, FDisplayClusterClusterSyncMsg::TypeRequest, FDisplayClusterClusterSyncMsg::ProtocolName));
+	TSharedPtr<FDisplayClusterMessage> response = SendRecvMsg(request);
+
+	if (!response.IsValid())
+	{
+		return;
+	}
+
+	// Extract sync data from response message
+	if (response->GetArg(FDisplayClusterClusterSyncMsg::GetTimecode::argTimecode, timecode) == false)
+	{
+		UE_LOG(LogDisplayClusterNetworkMsg, Error, TEXT("Couldn't extract an argument: %s"), FDisplayClusterClusterSyncMsg::GetTimecode::argTimecode);
+	}
+	if (response->GetArg(FDisplayClusterClusterSyncMsg::GetTimecode::argFrameRate, frameRate) == false)
+	{
+		UE_LOG(LogDisplayClusterNetworkMsg, Error, TEXT("Couldn't extract an argument: %s"), FDisplayClusterClusterSyncMsg::GetTimecode::argTimecode);
+	}
+}
+
+void FDisplayClusterClusterSyncClient::GetSyncData(FDisplayClusterMessage::DataType& data)
+{
+	static const TSharedPtr<FDisplayClusterMessage> request(new FDisplayClusterMessage(FDisplayClusterClusterSyncMsg::GetSyncData::name, FDisplayClusterClusterSyncMsg::TypeRequest, FDisplayClusterClusterSyncMsg::ProtocolName));
+	TSharedPtr<FDisplayClusterMessage> response = SendRecvMsg(request);
+
+	if (!response.IsValid())
+	{
+		return;
+	}
+
+	// Extract sync data from response message
+	data = response->GetArgs();
+}
+
+void FDisplayClusterClusterSyncClient::GetInputData(FDisplayClusterMessage::DataType& data)
+{
+	static const TSharedPtr<FDisplayClusterMessage> request(new FDisplayClusterMessage(FDisplayClusterClusterSyncMsg::GetInputData::name, FDisplayClusterClusterSyncMsg::TypeRequest, FDisplayClusterClusterSyncMsg::ProtocolName));
+	TSharedPtr<FDisplayClusterMessage> response = SendRecvMsg(request);
+
+	if (!response.IsValid())
+	{
+		return;
+	}
+
+	// Extract sync data from response message
+	data = response->GetArgs();
+}
+
diff --git a/Source/DisplayCluster/Private/Network/Service/ClusterSync/DisplayClusterClusterSyncClient.h b/Source/DisplayCluster/Private/Network/Service/ClusterSync/DisplayClusterClusterSyncClient.h
new file mode 100644
index 0000000000000000000000000000000000000000..f11b37c4ffb328d416516f2397f125984c40f4f8
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/Service/ClusterSync/DisplayClusterClusterSyncClient.h
@@ -0,0 +1,35 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Network/DisplayClusterClient.h"
+#include "Network/DisplayClusterMessage.h"
+#include "Network/Protocol/IPDisplayClusterClusterSyncProtocol.h"
+
+
+/**
+ * Cluster synchronization client
+ */
+class FDisplayClusterClusterSyncClient
+	: public FDisplayClusterClient
+	, public IPDisplayClusterClusterSyncProtocol
+{
+public:
+	FDisplayClusterClusterSyncClient();
+	FDisplayClusterClusterSyncClient(const FString& name);
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterClusterSyncProtocol
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void WaitForGameStart() override;
+	virtual void WaitForFrameStart() override;
+	virtual void WaitForFrameEnd() override;
+	virtual void WaitForTickEnd() override;
+	virtual void WaitForTrackingUpdate() override;
+	virtual void GetDeltaTime(float& deltaTime) override;
+	virtual void GetTimecode(FTimecode& timecode, FFrameRate& frameRate) override;
+	virtual void GetSyncData(FDisplayClusterMessage::DataType& data) override;
+	virtual void GetInputData(FDisplayClusterMessage::DataType& data) override;
+};
+
diff --git a/Source/DisplayCluster/Private/Network/Service/ClusterSync/DisplayClusterClusterSyncMsg.h b/Source/DisplayCluster/Private/Network/Service/ClusterSync/DisplayClusterClusterSyncMsg.h
new file mode 100644
index 0000000000000000000000000000000000000000..fcff0fc85ca198473bdd4c81932eacc4b75980ac
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/Service/ClusterSync/DisplayClusterClusterSyncMsg.h
@@ -0,0 +1,64 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+
+/**
+ * Cluster synchronization messages
+ */
+//@todo: encapsulate strings below in message classes
+namespace FDisplayClusterClusterSyncMsg
+{
+	constexpr static auto ProtocolName = "ClusterSync";
+	
+	constexpr static auto TypeRequest  = "request";
+	constexpr static auto TypeResponse = "response";
+
+	namespace WaitForGameStart
+	{
+		constexpr static auto name = "WaitForGameStart";
+	};
+
+	namespace WaitForFrameStart
+	{
+		constexpr static auto name = "WaitForFrameStart";
+	};
+
+	namespace WaitForFrameEnd
+	{
+		constexpr static auto name = "WaitForFrameEnd";
+	};
+
+	namespace WaitForTickEnd
+	{
+		constexpr static auto name = "WaitForTickEnd";
+	};
+
+	namespace WaitForTrackingUpdate
+	{
+		constexpr static auto name = "WaitForTrackingUpdate";
+	};
+
+	namespace GetDeltaTime
+	{
+		constexpr static auto name         = "GetDeltaTime";
+		constexpr static auto argDeltaTime = "DeltaTime";
+	};
+
+	namespace GetTimecode
+	{
+		constexpr static auto name         = "GetTimecode";
+		constexpr static auto argTimecode  = "Timecode";
+		constexpr static auto argFrameRate = "FrameRate";
+	}
+
+	namespace GetSyncData
+	{
+		constexpr static auto name = "GetSyncData";
+	};
+
+	namespace GetInputData
+	{
+		constexpr static auto name = "GetInputData";
+	}
+};
diff --git a/Source/DisplayCluster/Private/Network/Service/ClusterSync/DisplayClusterClusterSyncService.cpp b/Source/DisplayCluster/Private/Network/Service/ClusterSync/DisplayClusterClusterSyncService.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..40c673df139839bada2b434b495c67e8ca6fc77b
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/Service/ClusterSync/DisplayClusterClusterSyncService.cpp
@@ -0,0 +1,221 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterClusterSyncService.h"
+#include "DisplayClusterClusterSyncMsg.h"
+
+#include "Cluster/IPDisplayClusterClusterManager.h"
+#include "Input/IPDisplayClusterInputManager.h"
+
+#include "Misc/DisplayClusterAppExit.h"
+#include "Misc/DisplayClusterLog.h"
+
+#include "DisplayClusterGlobals.h"
+#include "IPDisplayCluster.h"
+
+
+FDisplayClusterClusterSyncService::FDisplayClusterClusterSyncService(const FString& addr, const int32 port) :
+	FDisplayClusterService(FString("SRV_CS"), addr, port),
+	BarrierGameStart  (GDisplayCluster->GetPrivateClusterMgr()->GetNodesAmount(), FString("GameStart_barrier"),  DisplayClusterConstants::net::BarrierGameStartWaitTimeout),
+	BarrierFrameStart (GDisplayCluster->GetPrivateClusterMgr()->GetNodesAmount(), FString("FrameStart_barrier"), DisplayClusterConstants::net::BarrierWaitTimeout),
+	BarrierFrameEnd   (GDisplayCluster->GetPrivateClusterMgr()->GetNodesAmount(), FString("FrameEnd_barrier"),   DisplayClusterConstants::net::BarrierWaitTimeout),
+	BarrierTickEnd    (GDisplayCluster->GetPrivateClusterMgr()->GetNodesAmount(), FString("TickEnd_barrier"),    DisplayClusterConstants::net::BarrierWaitTimeout),
+	BarrierTrackingUpdate(GDisplayCluster->GetPrivateClusterMgr()->GetNodesAmount(), FString("TrackingUpdate_barrier"),   DisplayClusterConstants::net::BarrierWaitTimeout)
+{
+}
+
+FDisplayClusterClusterSyncService::~FDisplayClusterClusterSyncService()
+{
+	Shutdown();
+}
+
+
+bool FDisplayClusterClusterSyncService::Start()
+{
+	BarrierGameStart.Activate();
+	BarrierFrameStart.Activate();
+	BarrierFrameEnd.Activate();
+	BarrierTickEnd.Activate();
+	BarrierTrackingUpdate.Activate();
+
+	return FDisplayClusterServer::Start();
+}
+
+void FDisplayClusterClusterSyncService::Shutdown()
+{
+	BarrierGameStart.Deactivate();
+	BarrierFrameStart.Deactivate();
+	BarrierFrameEnd.Deactivate();
+	BarrierTickEnd.Deactivate();
+	BarrierTrackingUpdate.Deactivate();
+
+	return FDisplayClusterServer::Shutdown();
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterSessionListener
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterClusterSyncService::NotifySessionOpen(FDisplayClusterSession* pSession)
+{
+	FDisplayClusterService::NotifySessionOpen(pSession);
+}
+
+void FDisplayClusterClusterSyncService::NotifySessionClose(FDisplayClusterSession* pSession)
+{
+	// Unblock waiting threads to allow current Tick() finish
+	BarrierGameStart.Deactivate();
+	BarrierFrameStart.Deactivate();
+	BarrierFrameEnd.Deactivate();
+	BarrierTickEnd.Deactivate();
+
+	FDisplayClusterService::NotifySessionClose(pSession);
+}
+
+FDisplayClusterMessage::Ptr FDisplayClusterClusterSyncService::ProcessMessage(FDisplayClusterMessage::Ptr msg)
+{
+	// Check the pointer
+	if (msg.IsValid() == false)
+	{
+		UE_LOG(LogDisplayClusterNetworkMsg, Error, TEXT("%s - Couldn't process the message"), *GetName());
+		return nullptr;
+	}
+
+	UE_LOG(LogDisplayClusterNetwork, Verbose, TEXT("%s - Processing message %s"), *GetName(), *msg->ToString());
+
+	// Check protocol and type
+	if (msg->GetProtocol() != FDisplayClusterClusterSyncMsg::ProtocolName || msg->GetType() != FDisplayClusterClusterSyncMsg::TypeRequest)
+	{
+		UE_LOG(LogDisplayClusterNetworkMsg, Error, TEXT("%s - Unsupported message type: %s"), *GetName(), *msg->ToString());
+		return nullptr;
+	}
+
+	// Initialize response message
+	FDisplayClusterMessage::Ptr response = FDisplayClusterMessage::Ptr(new FDisplayClusterMessage(msg->GetName(), FDisplayClusterClusterSyncMsg::TypeResponse, msg->GetProtocol()));
+
+	// Dispatch the message
+	const FString msgName = msg->GetName();
+	if (msgName == FDisplayClusterClusterSyncMsg::WaitForGameStart::name)
+	{
+		WaitForGameStart();
+		return response;
+	}
+	else if (msgName == FDisplayClusterClusterSyncMsg::WaitForFrameStart::name)
+	{
+		WaitForFrameStart();
+		return response;
+	}
+	else if (msgName == FDisplayClusterClusterSyncMsg::WaitForFrameEnd::name)
+	{
+		WaitForFrameEnd();
+		return response;
+	}
+	else if (msgName == FDisplayClusterClusterSyncMsg::WaitForTickEnd::name)
+	{
+		WaitForTickEnd();
+		return response;
+	}
+	else if (msgName == FDisplayClusterClusterSyncMsg::WaitForTrackingUpdate::name)
+	{
+		WaitForTrackingUpdate();
+		return response;
+	}
+	else if (msgName == FDisplayClusterClusterSyncMsg::GetDeltaTime::name)
+	{
+		float deltaTime = 0.0f;
+		GetDeltaTime(deltaTime);
+		response->SetArg(FDisplayClusterClusterSyncMsg::GetDeltaTime::argDeltaTime, deltaTime);
+		return response;
+	}
+	else if (msgName == FDisplayClusterClusterSyncMsg::GetTimecode::name)
+	{
+		FTimecode timecode;
+		FFrameRate frameRate;
+		GetTimecode(timecode, frameRate);
+		response->SetArg(FDisplayClusterClusterSyncMsg::GetTimecode::argTimecode, timecode);
+		response->SetArg(FDisplayClusterClusterSyncMsg::GetTimecode::argFrameRate, frameRate);
+		return response;
+	}
+	else if (msgName == FDisplayClusterClusterSyncMsg::GetSyncData::name)
+	{
+		FDisplayClusterMessage::DataType data;
+		GetSyncData(data);
+
+		response->SetArgs(data);
+		return response;
+	}
+	else if (msgName == FDisplayClusterClusterSyncMsg::GetInputData::name)
+	{
+		FDisplayClusterMessage::DataType data;
+		GetInputData(data);
+
+		response->SetArgs(data);
+		return response;
+	}
+
+	// Being here means that we have no appropriate dispatch logic for this message
+	UE_LOG(LogDisplayClusterNetworkMsg, Warning, TEXT("%s - A dispatcher for this message hasn't been implemented yet <%s>"), *GetName(), *msg->ToString());
+	return nullptr;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IPDisplayClusterClusterSyncProtocol
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterClusterSyncService::WaitForGameStart()
+{
+	if (BarrierGameStart.Wait() != FDisplayClusterBarrier::WaitResult::Ok)
+	{
+		FDisplayClusterAppExit::ExitApplication(FDisplayClusterAppExit::ExitType::NormalSoft, FString("Error on game start barrier. Exit required."));
+	}
+}
+
+void FDisplayClusterClusterSyncService::WaitForFrameStart()
+{
+	if (BarrierFrameStart.Wait() != FDisplayClusterBarrier::WaitResult::Ok)
+	{
+		FDisplayClusterAppExit::ExitApplication(FDisplayClusterAppExit::ExitType::NormalSoft, FString("Error on frame start barrier. Exit required."));
+	}
+}
+
+void FDisplayClusterClusterSyncService::WaitForFrameEnd()
+{
+	if (BarrierFrameEnd.Wait() != FDisplayClusterBarrier::WaitResult::Ok)
+	{
+		FDisplayClusterAppExit::ExitApplication(FDisplayClusterAppExit::ExitType::NormalSoft, FString("Error on frame end barrier. Exit required."));
+	}
+}
+
+void FDisplayClusterClusterSyncService::WaitForTickEnd()
+{
+	if (BarrierTickEnd.Wait() != FDisplayClusterBarrier::WaitResult::Ok)
+	{
+		FDisplayClusterAppExit::ExitApplication(FDisplayClusterAppExit::ExitType::NormalSoft, FString("Error on tick end barrier. Exit required."));
+	}
+}
+
+void FDisplayClusterClusterSyncService::WaitForTrackingUpdate()
+{
+	if (BarrierTickEnd.Wait() != FDisplayClusterBarrier::WaitResult::Ok)
+	{
+		FDisplayClusterAppExit::ExitApplication(FDisplayClusterAppExit::ExitType::NormalSoft, FString("Error on tracking update barrier. Exit required."));
+	}
+}
+
+void FDisplayClusterClusterSyncService::GetDeltaTime(float& deltaTime)
+{
+	deltaTime = GDisplayCluster->GetPrivateClusterMgr()->GetDeltaTime();
+}
+
+void FDisplayClusterClusterSyncService::GetTimecode(FTimecode& timecode, FFrameRate& frameRate)
+{
+	GDisplayCluster->GetPrivateClusterMgr()->GetTimecode(timecode, frameRate);
+}
+
+void FDisplayClusterClusterSyncService::GetSyncData(FDisplayClusterMessage::DataType& data)
+{
+	GDisplayCluster->GetPrivateClusterMgr()->ExportSyncData(data);
+}
+
+void FDisplayClusterClusterSyncService::GetInputData(FDisplayClusterMessage::DataType& data)
+{
+	GDisplayCluster->GetPrivateInputMgr()->ExportInputData(data);
+}
diff --git a/Source/DisplayCluster/Private/Network/Service/ClusterSync/DisplayClusterClusterSyncService.h b/Source/DisplayCluster/Private/Network/Service/ClusterSync/DisplayClusterClusterSyncService.h
new file mode 100644
index 0000000000000000000000000000000000000000..df7bb48dfa5bbde9ae65687c1a4b9adc6c666b39
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/Service/ClusterSync/DisplayClusterClusterSyncService.h
@@ -0,0 +1,62 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "Misc/DisplayClusterBarrier.h"
+#include "Network/DisplayClusterMessage.h"
+#include "Network/Service/DisplayClusterService.h"
+#include "Network/Protocol/IPDisplayClusterClusterSyncProtocol.h"
+
+
+
+/**
+ * Cluster synchronization server
+ */
+class FDisplayClusterClusterSyncService
+	: public  FDisplayClusterService
+	, private IPDisplayClusterClusterSyncProtocol
+{
+public:
+	FDisplayClusterClusterSyncService(const FString& addr, const int32 port);
+	virtual ~FDisplayClusterClusterSyncService();
+
+public:
+	virtual bool Start() override;
+	void Shutdown() override;
+
+protected:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterSessionListener
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void NotifySessionOpen(FDisplayClusterSession* pSession) override;
+	virtual void NotifySessionClose(FDisplayClusterSession* pSession) override;
+	virtual FDisplayClusterMessage::Ptr ProcessMessage(FDisplayClusterMessage::Ptr msg) override;
+
+private:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterClusterSyncProtocol
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void WaitForGameStart() override;
+	virtual void WaitForFrameStart() override;
+	virtual void WaitForFrameEnd() override;
+	virtual void WaitForTickEnd() override;
+	virtual void WaitForTrackingUpdate() override;
+	virtual void GetDeltaTime(float& deltaTime) override;
+	virtual void GetTimecode(FTimecode& timecode, FFrameRate& frameRate) override;
+	virtual void GetSyncData(FDisplayClusterMessage::DataType& data)  override;
+	virtual void GetInputData(FDisplayClusterMessage::DataType& data) override;
+
+private:
+	// Game start sync barrier
+	FDisplayClusterBarrier BarrierGameStart;
+	// Frame start barrier
+	FDisplayClusterBarrier BarrierFrameStart;
+	// Frame end barrier
+	FDisplayClusterBarrier BarrierFrameEnd;
+	// Tick end barrier
+	FDisplayClusterBarrier BarrierTickEnd;
+	// Tracking update barrier
+	FDisplayClusterBarrier BarrierTrackingUpdate;
+};
+
diff --git a/Source/DisplayCluster/Private/Network/Service/DisplayClusterService.cpp b/Source/DisplayCluster/Private/Network/Service/DisplayClusterService.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..8ec9558dc396745fa3c3349fc458b04216958566
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/Service/DisplayClusterService.cpp
@@ -0,0 +1,55 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterService.h"
+#include "Network/DisplayClusterSession.h"
+
+#include "Config/IPDisplayClusterConfigManager.h"
+#include "Config/DisplayClusterConfigTypes.h"
+
+#include "Misc/DisplayClusterAppExit.h"
+#include "DisplayClusterGlobals.h"
+#include "IPDisplayCluster.h"
+
+
+FDisplayClusterService::FDisplayClusterService(const FString& name, const FString& addr, const int32 port) :
+	FDisplayClusterServer(name, addr, port)
+{
+}
+
+bool FDisplayClusterService::IsClusterIP(const FIPv4Endpoint& ep)
+{
+	if (GDisplayCluster->GetOperationMode() == EDisplayClusterOperationMode::Disabled)
+	{
+		return false;
+	}
+
+	TArray<FDisplayClusterConfigClusterNode> nodes = GDisplayCluster->GetPrivateConfigMgr()->GetClusterNodes();
+	const FString addr = ep.Address.ToString();
+	
+	return nullptr != nodes.FindByPredicate([addr](const FDisplayClusterConfigClusterNode& node)
+	{
+		return addr == node.Addr;
+	});
+}
+
+bool FDisplayClusterService::IsConnectionAllowed(FSocket* pSock, const FIPv4Endpoint& ep)
+{
+	// By default any DisplayCluster service must be within a cluster
+	return FDisplayClusterService::IsClusterIP(ep);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterSessionListener
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterService::NotifySessionOpen(FDisplayClusterSession* pSession)
+{
+	FDisplayClusterServer::NotifySessionOpen(pSession);
+}
+
+void FDisplayClusterService::NotifySessionClose(FDisplayClusterSession* pSession)
+{
+	FDisplayClusterAppExit::ExitApplication(FDisplayClusterAppExit::ExitType::NormalSoft, GetName() + FString(" - Connection interrupted. Application exit requested."));
+	FDisplayClusterServer::NotifySessionClose(pSession);
+}
+
diff --git a/Source/DisplayCluster/Private/Network/Service/DisplayClusterService.h b/Source/DisplayCluster/Private/Network/Service/DisplayClusterService.h
new file mode 100644
index 0000000000000000000000000000000000000000..5c4950b9eb427ad31141f43e03699db6a9c3973f
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/Service/DisplayClusterService.h
@@ -0,0 +1,34 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Network/DisplayClusterServer.h"
+#include "Sockets.h"
+
+class FDisplayClusterSession;
+struct FIPv4Endpoint;
+
+
+/**
+ * Abstract DisplayCluster server
+ */
+class FDisplayClusterService
+	: public FDisplayClusterServer
+{
+public:
+	FDisplayClusterService(const FString& name, const FString& addr, const int32 port);
+
+public:
+	static bool IsClusterIP(const FIPv4Endpoint& ep);
+
+protected:
+	virtual bool IsConnectionAllowed(FSocket* pSock, const FIPv4Endpoint& ep) override;
+
+protected:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterSessionListener
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void NotifySessionOpen(FDisplayClusterSession* pSession) override;
+	virtual void NotifySessionClose(FDisplayClusterSession* pSession) override;
+};
+
diff --git a/Source/DisplayCluster/Private/Network/Service/SwapSync/DisplayClusterSwapSyncClient.cpp b/Source/DisplayCluster/Private/Network/Service/SwapSync/DisplayClusterSwapSyncClient.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..0193cda1819465ed3a432168de76ac74ff69d9bf
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/Service/SwapSync/DisplayClusterSwapSyncClient.cpp
@@ -0,0 +1,47 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterSwapSyncClient.h"
+#include "DisplayClusterSwapSyncMsg.h"
+
+#include "Misc/DisplayClusterLog.h"
+
+
+FDisplayClusterSwapSyncClient::FDisplayClusterSwapSyncClient() :
+	FDisplayClusterClient(FString("CLN_SS"))
+{
+}
+
+FDisplayClusterSwapSyncClient::FDisplayClusterSwapSyncClient(const FString& name) :
+	FDisplayClusterClient(name)
+{
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IPDisplayClusterSwapSyncProtocol
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterSwapSyncClient::WaitForSwapSync(double* pThreadWaitTime, double* pBarrierWaitTime)
+{
+	static const TSharedPtr<FDisplayClusterMessage> request(new FDisplayClusterMessage(FDisplayClusterSwapSyncMsg::WaitForSwapSync::name, FDisplayClusterSwapSyncMsg::TypeRequest, FDisplayClusterSwapSyncMsg::ProtocolName));
+	TSharedPtr<FDisplayClusterMessage> response = SendRecvMsg(request);
+
+	if (response.IsValid())
+	{
+		if (pThreadWaitTime)
+		{
+			if (!response->GetArg(FString(FDisplayClusterSwapSyncMsg::WaitForSwapSync::argThreadTime), *pThreadWaitTime))
+			{
+				UE_LOG(LogDisplayClusterNetwork, Error, TEXT("Argument %s not available"), FDisplayClusterSwapSyncMsg::WaitForSwapSync::argThreadTime);
+			}
+		}
+
+		if (pBarrierWaitTime)
+		{
+			if (!response->GetArg(FString(FDisplayClusterSwapSyncMsg::WaitForSwapSync::argBarrierTime), *pBarrierWaitTime))
+			{
+				UE_LOG(LogDisplayClusterNetwork, Error, TEXT("Argument %s not available"), FDisplayClusterSwapSyncMsg::WaitForSwapSync::argBarrierTime);
+			}
+		}
+	}
+}
+
diff --git a/Source/DisplayCluster/Private/Network/Service/SwapSync/DisplayClusterSwapSyncClient.h b/Source/DisplayCluster/Private/Network/Service/SwapSync/DisplayClusterSwapSyncClient.h
new file mode 100644
index 0000000000000000000000000000000000000000..467819b906893e90760d58388d04fbaca591c8f4
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/Service/SwapSync/DisplayClusterSwapSyncClient.h
@@ -0,0 +1,26 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Network/DisplayClusterClient.h"
+#include "Network/Protocol/IPDisplayClusterSwapSyncProtocol.h"
+
+
+/**
+ * Swap synchronization client
+ */
+class FDisplayClusterSwapSyncClient
+	: public FDisplayClusterClient
+	, public IPDisplayClusterSwapSyncProtocol
+{
+public:
+	FDisplayClusterSwapSyncClient();
+	FDisplayClusterSwapSyncClient(const FString& name);
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterSwapSyncProtocol
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void WaitForSwapSync(double* pThreadWaitTime, double* pBarrierWaitTime) override;
+};
+
diff --git a/Source/DisplayCluster/Private/Network/Service/SwapSync/DisplayClusterSwapSyncMsg.h b/Source/DisplayCluster/Private/Network/Service/SwapSync/DisplayClusterSwapSyncMsg.h
new file mode 100644
index 0000000000000000000000000000000000000000..7675dc7852c27a204a96216be2f12ac4a39ad9c3
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/Service/SwapSync/DisplayClusterSwapSyncMsg.h
@@ -0,0 +1,23 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+
+/**
+ * Swap synchronization messages
+ */
+//@todo: encapsulate strings below in message classes
+struct FDisplayClusterSwapSyncMsg
+{
+	constexpr static auto ProtocolName = "SwapSync";
+	
+	constexpr static auto TypeRequest  = "request";
+	constexpr static auto TypeResponse = "response";
+
+	struct WaitForSwapSync
+	{
+		constexpr static auto name = "WaitForSwapSync";
+		constexpr static auto argThreadTime  = "ThreadTime";
+		constexpr static auto argBarrierTime = "BarrierTime";
+	};
+};
diff --git a/Source/DisplayCluster/Private/Network/Service/SwapSync/DisplayClusterSwapSyncService.cpp b/Source/DisplayCluster/Private/Network/Service/SwapSync/DisplayClusterSwapSyncService.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..1ea45657a4e20cd194daa0f240809234fae0d4c4
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/Service/SwapSync/DisplayClusterSwapSyncService.cpp
@@ -0,0 +1,107 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterSwapSyncService.h"
+#include "DisplayClusterSwapSyncMsg.h"
+
+#include "Cluster/IPDisplayClusterClusterManager.h"
+#include "Misc/DisplayClusterAppExit.h"
+#include "Misc/DisplayClusterLog.h"
+
+#include "DisplayClusterGlobals.h"
+#include "IPDisplayCluster.h"
+
+
+FDisplayClusterSwapSyncService::FDisplayClusterSwapSyncService(const FString& addr, const int32 port) :
+	FDisplayClusterService(FString("SRV_SS"), addr, port),
+	BarrierSwap(GDisplayCluster->GetPrivateClusterMgr()->GetNodesAmount(), FString("SwapSync_barrier"), DisplayClusterConstants::net::BarrierWaitTimeout)
+{
+}
+
+FDisplayClusterSwapSyncService::~FDisplayClusterSwapSyncService()
+{
+	Shutdown();
+}
+
+
+bool FDisplayClusterSwapSyncService::Start()
+{
+	BarrierSwap.Activate();
+
+	return FDisplayClusterServer::Start();
+}
+
+void FDisplayClusterSwapSyncService::Shutdown()
+{
+	BarrierSwap.Deactivate();
+
+	return FDisplayClusterServer::Shutdown();
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterSessionListener
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterSwapSyncService::NotifySessionOpen(FDisplayClusterSession* pSession)
+{
+	FDisplayClusterService::NotifySessionOpen(pSession);
+}
+
+void FDisplayClusterSwapSyncService::NotifySessionClose(FDisplayClusterSession* pSession)
+{
+	// Unblock waiting threads to allow current Tick() finish
+	BarrierSwap.Deactivate();
+
+	FDisplayClusterService::NotifySessionClose(pSession);
+}
+
+FDisplayClusterMessage::Ptr FDisplayClusterSwapSyncService::ProcessMessage(FDisplayClusterMessage::Ptr msg)
+{
+	// Check the pointer
+	if (msg.IsValid() == false)
+	{
+		UE_LOG(LogDisplayClusterNetworkMsg, Error, TEXT("%s - Couldn't process the message"), *GetName());
+		return nullptr;
+	}
+
+	UE_LOG(LogDisplayClusterNetwork, Verbose, TEXT("%s - Processing message %s"), *GetName(), *msg->ToString());
+
+	// Check protocol and type
+	if (msg->GetProtocol() != FDisplayClusterSwapSyncMsg::ProtocolName || msg->GetType() != FDisplayClusterSwapSyncMsg::TypeRequest)
+	{
+		UE_LOG(LogDisplayClusterNetworkMsg, Error, TEXT("%s - Unsupported message type: %s"), *GetName(), *msg->ToString());
+		return nullptr;
+	}
+
+	// Initialize response message
+	FDisplayClusterMessage::Ptr response = FDisplayClusterMessage::Ptr(new FDisplayClusterMessage(msg->GetName(), FDisplayClusterSwapSyncMsg::TypeResponse, msg->GetProtocol()));
+
+	// Dispatch the message
+	if (msg->GetName() == FDisplayClusterSwapSyncMsg::WaitForSwapSync::name)
+	{
+		double tTime = 0.f;
+		double bTime = 0.f;
+
+		WaitForSwapSync(&tTime, &bTime);
+
+		response->SetArg(FString(FDisplayClusterSwapSyncMsg::WaitForSwapSync::argThreadTime),  tTime);
+		response->SetArg(FString(FDisplayClusterSwapSyncMsg::WaitForSwapSync::argBarrierTime), bTime);
+
+		return response;
+	}
+
+	// Being here means that we have no appropriate dispatch logic for this message
+	UE_LOG(LogDisplayClusterNetworkMsg, Warning, TEXT("%s - A dispatcher for this message hasn't been implemented yet <%s>"), *GetName(), *msg->ToString());
+	return nullptr;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IPDisplayClusterSwapSyncProtocol
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterSwapSyncService::WaitForSwapSync(double* pThreadWaitTime, double* pBarrierWaitTime)
+{
+	if (BarrierSwap.Wait(pThreadWaitTime, pBarrierWaitTime) != FDisplayClusterBarrier::WaitResult::Ok)
+	{
+		FDisplayClusterAppExit::ExitApplication(FDisplayClusterAppExit::ExitType::NormalSoft, FString("Error on swap barrier. Exit required."));
+	}
+}
diff --git a/Source/DisplayCluster/Private/Network/Service/SwapSync/DisplayClusterSwapSyncService.h b/Source/DisplayCluster/Private/Network/Service/SwapSync/DisplayClusterSwapSyncService.h
new file mode 100644
index 0000000000000000000000000000000000000000..c6987586f338f33539d3464d62b843042543faa5
--- /dev/null
+++ b/Source/DisplayCluster/Private/Network/Service/SwapSync/DisplayClusterSwapSyncService.h
@@ -0,0 +1,46 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+#include "CoreMinimal.h"
+#include "Network/Service/DisplayClusterService.h"
+#include "Network/Protocol/IPDisplayClusterSwapSyncProtocol.h"
+#include "Network/DisplayClusterMessage.h"
+
+#include "Misc/DisplayClusterBarrier.h"
+
+
+/**
+ * Swap synchronization server
+ */
+class FDisplayClusterSwapSyncService
+	: public  FDisplayClusterService
+	, private IPDisplayClusterSwapSyncProtocol
+{
+public:
+	FDisplayClusterSwapSyncService(const FString& addr, const int32 port);
+	virtual ~FDisplayClusterSwapSyncService();
+
+public:
+	virtual bool Start() override;
+	virtual void Shutdown() override;
+
+protected:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterSessionListener
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void NotifySessionOpen(FDisplayClusterSession* pSession) override;
+	virtual void NotifySessionClose(FDisplayClusterSession* pSession) override;
+	virtual FDisplayClusterMessage::Ptr ProcessMessage(FDisplayClusterMessage::Ptr msg) override;
+
+private:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterSwapSyncProtocol
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void WaitForSwapSync(double* pThreadWaitTime, double* pBarrierWaitTime) override;
+
+
+private:
+	// Swap sync barrier
+	FDisplayClusterBarrier BarrierSwap;
+};
+
diff --git a/Source/DisplayCluster/Private/Render/Devices/Debug/DisplayClusterDeviceDebug.cpp b/Source/DisplayCluster/Private/Render/Devices/Debug/DisplayClusterDeviceDebug.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..cb2145b322080a4886ef49b350375b172ddeb5e3
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/Debug/DisplayClusterDeviceDebug.cpp
@@ -0,0 +1,28 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterDeviceDebug.h"
+
+
+FDisplayClusterDeviceDebug::FDisplayClusterDeviceDebug()
+{
+}
+
+FDisplayClusterDeviceDebug::~FDisplayClusterDeviceDebug()
+{
+}
+
+
+void FDisplayClusterDeviceDebug::AdjustViewRect(enum EStereoscopicPass StereoPass, int32& X, int32& Y, uint32& SizeX, uint32& SizeY) const
+{
+	const int rHeight = SizeY / 4;
+
+	if (StereoPass == EStereoscopicPass::eSSP_LEFT_EYE)
+	{
+		SizeY -= rHeight;
+	}
+	else
+	{
+		Y = SizeY - rHeight;
+		SizeY = rHeight;
+	}
+}
diff --git a/Source/DisplayCluster/Private/Render/Devices/Debug/DisplayClusterDeviceDebug.h b/Source/DisplayCluster/Private/Render/Devices/Debug/DisplayClusterDeviceDebug.h
new file mode 100644
index 0000000000000000000000000000000000000000..247e7ba08ed4fba11a8c07e8ba08d21ede4f46b1
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/Debug/DisplayClusterDeviceDebug.h
@@ -0,0 +1,21 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Render/Devices/DisplayClusterDeviceBase.h"
+
+
+/**
+ * Debug stereoscopic device (for development and test purposes)
+ */
+class FDisplayClusterDeviceDebug : public FDisplayClusterDeviceBase
+{
+public:
+	FDisplayClusterDeviceDebug();
+	virtual ~FDisplayClusterDeviceDebug();
+
+protected:
+	virtual void AdjustViewRect(enum EStereoscopicPass StereoPass, int32& X, int32& Y, uint32& SizeX, uint32& SizeY) const override;
+};
+
+
diff --git a/Source/DisplayCluster/Private/Render/Devices/DisplayClusterDeviceBase.cpp b/Source/DisplayCluster/Private/Render/Devices/DisplayClusterDeviceBase.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..f3aca2994954e9b6f283a9ac5dfffeea86c70962
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/DisplayClusterDeviceBase.cpp
@@ -0,0 +1,421 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterDeviceBase.h"
+
+#include "Cluster/IPDisplayClusterClusterManager.h"
+#include "Cluster/Controller/IPDisplayClusterNodeController.h"
+#include "Config/IPDisplayClusterConfigManager.h"
+#include "Game/IPDisplayClusterGameManager.h"
+
+#include "DisplayClusterScreenComponent.h"
+
+#include "RHIStaticStates.h"
+#include "Slate/SceneViewport.h"
+
+#include "Misc/DisplayClusterHelpers.h"
+#include "Misc/DisplayClusterLog.h"
+
+#include "DisplayClusterGlobals.h"
+#include "IPDisplayCluster.h"
+
+#include <utility>
+
+
+FDisplayClusterDeviceBase::FDisplayClusterDeviceBase() :
+	FRHICustomPresent()
+{
+	UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT(".ctor FDisplayClusterDeviceBase"));
+}
+
+FDisplayClusterDeviceBase::~FDisplayClusterDeviceBase()
+{
+	UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT(".dtor FDisplayClusterDeviceBase"));
+}
+
+bool FDisplayClusterDeviceBase::Initialize()
+{
+	if (GDisplayCluster->GetOperationMode() == EDisplayClusterOperationMode::Disabled)
+	{
+		return false;
+	}
+
+	UE_LOG(LogDisplayClusterRender, Log, TEXT("Use swap interval: %d"), SwapInterval);
+
+	return true;
+}
+
+void FDisplayClusterDeviceBase::WaitForBufferSwapSync(int32& InOutSyncInterval)
+{
+	// Perform SW synchronization
+	UE_LOG(LogDisplayClusterRender, Verbose, TEXT("Waiting for swap sync..."));
+
+	// Policies below are available for any render device type
+	switch (SwapSyncPolicy)
+	{
+		case EDisplayClusterSwapSyncPolicy::None:
+		{
+			exec_BarrierWait();
+			InOutSyncInterval = 0;
+			break;
+		}
+
+		default:
+		{
+			UE_LOG(LogDisplayClusterRender, Warning, TEXT("Swap sync policy drop: %d"), (int)SwapSyncPolicy);
+			InOutSyncInterval = 0;
+			break;
+		}
+	}
+}
+
+void FDisplayClusterDeviceBase::UpdateProjectionScreenDataForThisFrame()
+{
+	UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("UpdateProjectionScreenDataForThisFrame"));
+	check(IsInGameThread());
+
+	if (GDisplayCluster->GetOperationMode() == EDisplayClusterOperationMode::Disabled)
+	{
+		return;
+	}
+
+	// Store transformations of active projection screen
+	UDisplayClusterScreenComponent* pScreen = GDisplayCluster->GetPrivateGameMgr()->GetActiveScreen();
+	if (pScreen)
+	{
+		ProjectionScreenLoc  = pScreen->GetComponentLocation();
+		ProjectionScreenRot  = pScreen->GetComponentRotation();
+		ProjectionScreenSize = pScreen->GetScreenSize();
+	}
+}
+
+void FDisplayClusterDeviceBase::exec_BarrierWait()
+{
+	if (GDisplayCluster->GetOperationMode() == EDisplayClusterOperationMode::Disabled)
+	{
+		return;
+	}
+
+	double tTime = 0.f;
+	double bTime = 0.f;
+
+	IPDisplayClusterNodeController* const pController = GDisplayCluster->GetPrivateClusterMgr()->GetController();
+	if (pController)
+	{
+		pController->WaitForSwapSync(&tTime, &bTime);
+	}
+
+	UE_LOG(LogDisplayClusterRender, Verbose, TEXT("Render barrier wait: t=%lf b=%lf"), tTime, bTime);
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IStereoRendering
+//////////////////////////////////////////////////////////////////////////////////////////////
+bool FDisplayClusterDeviceBase::IsStereoEnabled() const
+{
+	//UE_LOG(LogDisplayClusterRender, Verbose, TEXT("IsStereoEnabled"));
+	return true;
+}
+
+bool FDisplayClusterDeviceBase::IsStereoEnabledOnNextFrame() const
+{
+	//UE_LOG(LogDisplayClusterRender, Verbose, TEXT("IsStereoEnabledOnNextFrame"));
+	return true;
+}
+
+bool FDisplayClusterDeviceBase::EnableStereo(bool stereo /*= true*/)
+{
+	//UE_LOG(LogDisplayClusterRender, Verbose, TEXT("EnableStereo"));
+	return true;
+}
+
+void FDisplayClusterDeviceBase::AdjustViewRect(enum EStereoscopicPass StereoPass, int32& X, int32& Y, uint32& SizeX, uint32& SizeY) const
+{
+	X = ViewportArea.GetLocation().X;
+	SizeX = ViewportArea.GetSize().X;
+
+	Y = ViewportArea.GetLocation().Y;
+	SizeY = ViewportArea.GetSize().Y;
+}
+
+void FDisplayClusterDeviceBase::CalculateStereoViewOffset(const enum EStereoscopicPass StereoPassType, FRotator& ViewRotation, const float WorldToMeters, FVector& ViewLocation)
+{
+	//UE_LOG(LogDisplayClusterRender, Verbose, TEXT("CalculateStereoViewOffset"));
+	
+	check(IsInGameThread());
+	check(WorldToMeters > 0.f);
+
+	UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("OLD ViewLoc: %s, ViewRot: %s"), *ViewLocation.ToString(), *ViewRotation.ToString());
+	UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WorldToMeters: %f"), WorldToMeters);
+
+	CurrentWorldToMeters = WorldToMeters;
+
+	// View vector must be orthogonal to the projection plane.
+	ViewRotation = ProjectionScreenRot;
+
+	const float ScaledEyeDist = EyeDist * CurrentWorldToMeters;
+	const float EyeOffset = ScaledEyeDist / 2.f;
+	const float PassOffset = (StereoPassType == EStereoscopicPass::eSSP_LEFT_EYE ? -EyeOffset : EyeOffset);
+	const float PassOffsetSwap = (bEyeSwap == true ? -PassOffset : PassOffset);
+
+	// offset eye position along Y (right) axis of camera
+	UDisplayClusterCameraComponent* pCamera = GDisplayCluster->GetPrivateGameMgr()->GetActiveCamera();
+	if(pCamera)
+	{
+		const FString nodeId = GDisplayCluster->GetPrivateClusterMgr()->GetNodeId();
+		const FQuat eyeQuat = pCamera->GetComponentQuat();
+		ViewLocation += eyeQuat.RotateVector(FVector(0.0f, nodeId.Contains("LE") ? -EyeOffset : EyeOffset, 0.0f));
+	}
+
+	const int eyeIdx = (StereoPassType == EStereoscopicPass::eSSP_LEFT_EYE ? 0 : 1);
+	EyeLoc[eyeIdx] = ViewLocation;
+	EyeRot[eyeIdx] = ViewRotation;
+
+	UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("NEW ViewLoc: %s, ViewRot: %s"), *ViewLocation.ToString(), *ViewRotation.ToString());
+}
+
+
+FMatrix FDisplayClusterDeviceBase::GetStereoProjectionMatrix(const enum EStereoscopicPass StereoPassType) const
+{
+	//UE_LOG(LogDisplayClusterRender, Verbose, TEXT("GetStereoProjectionMatrix"));
+	
+	check(IsInGameThread());
+	check(StereoPassType != EStereoscopicPass::eSSP_FULL);
+	
+	const float n = NearClipPlane;
+	const float f = FarClipPlane;
+
+	// Half-size
+	const float hw = ProjectionScreenSize.X / 2.f * CurrentWorldToMeters;
+	const float hh = ProjectionScreenSize.Y / 2.f * CurrentWorldToMeters;
+
+	UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("StereoProjectionMatrix math: hw:%f hh:%f"), hw, hh);
+
+	// Screen corners
+	const FVector pa = ProjectionScreenLoc + ProjectionScreenRot.Quaternion().RotateVector(GetProjectionScreenGeometryLBC(StereoPassType, hw, hh)); // left bottom corner
+	const FVector pb = ProjectionScreenLoc + ProjectionScreenRot.Quaternion().RotateVector(GetProjectionScreenGeometryRBC(StereoPassType, hw, hh)); // right bottom corner
+	const FVector pc = ProjectionScreenLoc + ProjectionScreenRot.Quaternion().RotateVector(GetProjectionScreenGeometryLTC(StereoPassType, hw, hh)); // left top corner
+
+	// Screen vectors
+	FVector vr = pb - pa; // lb->rb normilized vector, right axis of projection screen
+	vr.Normalize();
+	FVector vu = pc - pa; // lb->lt normilized vector, up axis of projection screen
+	vu.Normalize();
+	FVector vn = -FVector::CrossProduct(vr, vu); // Projection plane normal. Use minus because of left-handed coordinate system
+	vn.Normalize();
+
+	const int eyeIdx = (StereoPassType == EStereoscopicPass::eSSP_LEFT_EYE ? 0 : 1);
+	const FVector pe = EyeLoc[eyeIdx];
+	const FVector va = pa - pe; // camera -> lb
+	const FVector vb = pb - pe; // camera -> rb
+	const FVector vc = pc - pe; // camera -> lt
+
+	const float d = -FVector::DotProduct(va, vn); // distance from eye to screen
+	const float ndifd = n / d;
+	const float l = FVector::DotProduct(vr, va) * ndifd; // distance to left screen edge
+	const float r = FVector::DotProduct(vr, vb) * ndifd; // distance to right screen edge
+	const float b = FVector::DotProduct(vu, va) * ndifd; // distance to bottom screen edge
+	const float t = FVector::DotProduct(vu, vc) * ndifd; // distance to top screen edge
+
+	const float mx = 2.f * n / (r - l);
+	const float my = 2.f * n / (t - b);
+	const float ma = -(r + l) / (r - l);
+	const float mb = -(t + b) / (t - b);
+	const float mc = f / (f - n);
+	const float md = -(f * n) / (f - n);
+	const float me = 1.f;
+
+	// Normal LHS
+	const FMatrix pm = FMatrix(
+		FPlane(mx, 0, 0, 0),
+		FPlane(0, my, 0, 0),
+		FPlane(ma, mb, mc, me),
+		FPlane(0, 0, md, 0));
+
+	// Invert Z-axis (UE4 uses Z-inverted LHS)
+	const FMatrix flipZ = FMatrix(
+		FPlane(1, 0,  0, 0),
+		FPlane(0, 1,  0, 0),
+		FPlane(0, 0, -1, 0),
+		FPlane(0, 0,  1, 1));
+
+	const FMatrix result(pm * flipZ);
+
+	return result;
+}
+
+void FDisplayClusterDeviceBase::InitCanvasFromView(class FSceneView* InView, class UCanvas* Canvas)
+{
+	//UE_LOG(LogDisplayClusterRender, Verbose, TEXT("InitCanvasFromView"));
+}
+
+void FDisplayClusterDeviceBase::UpdateViewport(bool bUseSeparateRenderTarget, const class FViewport& Viewport, class SViewport* ViewportWidget)
+{
+	//UE_LOG(LogDisplayClusterRender, Verbose, TEXT("UpdateViewport"));
+	check(IsInGameThread());
+
+	// Update projection screen data
+	UpdateProjectionScreenDataForThisFrame();
+
+	// Save current dimensions
+	ViewportSize = Viewport.GetSizeXY();
+	BackBuffSize = Viewport.GetRenderTargetTextureSizeXY();
+
+	// If no custom area specified the full viewport area will be used
+	if (ViewportArea.IsValid() == false)
+	{
+		ViewportArea.SetLocation(FIntPoint::ZeroValue);
+		ViewportArea.SetSize(Viewport.GetSizeXY());
+	}
+
+	// Store viewport
+	CurrentViewport = (FViewport*)&Viewport;
+	Viewport.GetViewportRHI()->SetCustomPresent(this);
+}
+
+void FDisplayClusterDeviceBase::CalculateRenderTargetSize(const class FViewport& Viewport, uint32& InOutSizeX, uint32& InOutSizeY)
+{
+	//UE_LOG(LogDisplayClusterRender, Log, TEXT("FDisplayClusterDeviceBase::CalculateRenderTargetSize"));
+	check(IsInGameThread());
+
+	InOutSizeX = Viewport.GetSizeXY().X;
+	// Add one pixel height line for right eye (will be skipped on copy)
+	InOutSizeY = Viewport.GetSizeXY().Y;
+
+	check(InOutSizeX > 0 && InOutSizeY > 0);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FRHICustomPresent
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterDeviceBase::OnBackBufferResize()
+{
+	UE_LOG(LogDisplayClusterRender, Verbose, TEXT("OnBackBufferResize"));
+
+	//@todo: see comment below
+	// if we are in the middle of rendering: prevent from calling EndFrame
+	//if (RenderContext.IsValid())
+	//{
+	//	RenderContext->bFrameBegun = false;
+	//}
+}
+
+bool FDisplayClusterDeviceBase::Present(int32& InOutSyncInterval)
+{
+	UE_LOG(LogDisplayClusterRender, Warning, TEXT("Present - default handler implementation. Check stereo device instantiation."));
+
+	// Default behavior
+	// Return false to force clean screen. This will indicate that something is going wrong
+	// or particular stereo device hasn't been implemented appropriately yet.
+	return false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterStereoDevice
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterDeviceBase::SetViewportArea(const FIntPoint& loc, const FIntPoint& size)
+{
+	UE_LOG(LogDisplayClusterRender, Log, TEXT("SetViewportArea: loc=%s size=%s"), *loc.ToString(), *size.ToString());
+
+	FScopeLock lock(&InternalsSyncScope);
+	ViewportArea.SetLocation(loc);
+	ViewportArea.SetSize(size);
+}
+
+void FDisplayClusterDeviceBase::SetDesktopStereoParams(float FOV)
+{
+	UE_LOG(LogDisplayClusterRender, Log, TEXT("SetDesktopStereoParams: FOV=%f"), FOV);
+	//@todo
+}
+
+void FDisplayClusterDeviceBase::SetDesktopStereoParams(const FVector2D& screenSize, const FIntPoint& screenRes, float screenDist)
+{
+	UE_LOG(LogDisplayClusterRender, Log, TEXT("SetDesktopStereoParams"));
+
+	FVector2D size = screenSize;
+	float dist = screenDist;
+
+	//@todo:
+}
+
+void FDisplayClusterDeviceBase::SetInterpupillaryDistance(float dist)
+{
+	UE_LOG(LogDisplayClusterRender, Log, TEXT("SetInterpupillaryDistance: %f"), dist);
+	FScopeLock lock(&InternalsSyncScope);
+	EyeDist = dist;
+}
+
+float FDisplayClusterDeviceBase::GetInterpupillaryDistance() const
+{
+	UE_LOG(LogDisplayClusterRender, Verbose, TEXT("GetInterpupillaryDistance: %f"), EyeDist);
+	FScopeLock lock(&InternalsSyncScope);
+	return EyeDist;
+}
+
+void FDisplayClusterDeviceBase::SetEyesSwap(bool swap)
+{
+	UE_LOG(LogDisplayClusterRender, Log, TEXT("SetEyesSwap: %s"), DisplayClusterHelpers::str::BoolToStr(swap));
+	FScopeLock lock(&InternalsSyncScope);
+	bEyeSwap = swap;
+}
+
+bool FDisplayClusterDeviceBase::GetEyesSwap() const
+{
+	UE_LOG(LogDisplayClusterRender, Verbose, TEXT("GetEyesSwap: %s"), DisplayClusterHelpers::str::BoolToStr(bEyeSwap));
+	FScopeLock lock(&InternalsSyncScope);
+	return bEyeSwap;
+}
+
+bool FDisplayClusterDeviceBase::ToggleEyesSwap()
+{
+	{
+		FScopeLock lock(&InternalsSyncScope);
+		bEyeSwap = !bEyeSwap;
+	}
+
+	UE_LOG(LogDisplayClusterRender, Log, TEXT("ToggleEyesSwap: swap=%s"), DisplayClusterHelpers::str::BoolToStr(bEyeSwap));
+	return bEyeSwap;
+}
+
+void FDisplayClusterDeviceBase::SetSwapSyncPolicy(EDisplayClusterSwapSyncPolicy policy)
+{
+	UE_LOG(LogDisplayClusterRender, Log, TEXT("Swap sync policy: %d"), (int)policy);
+	
+	// Since not all our devices are opengl compatible in terms of implementation
+	// we have to perform some wrapping logic for the policies.
+	switch (policy)
+	{
+		// Policies below are available for any render device type
+		case EDisplayClusterSwapSyncPolicy::None:
+			SwapSyncPolicy = policy;
+			break;
+
+		default:
+			UE_LOG(LogDisplayClusterRender, Error, TEXT("Unsupported policy type: %d"), (int)policy);
+			SwapSyncPolicy = EDisplayClusterSwapSyncPolicy::None;
+			break;
+	}
+}
+
+EDisplayClusterSwapSyncPolicy FDisplayClusterDeviceBase::GetSwapSyncPolicy() const
+{
+	UE_LOG(LogDisplayClusterRender, Verbose, TEXT("GetSwapSyncPolicy: policy=%d"), (int)SwapSyncPolicy);
+	return SwapSyncPolicy;
+}
+
+void FDisplayClusterDeviceBase::GetCullingDistance(float& NearDistance, float& FarDistance) const
+{
+	FScopeLock lock(&InternalsSyncScope);
+	NearDistance = NearClipPlane;
+	FarDistance = FarClipPlane;
+}
+
+void FDisplayClusterDeviceBase::SetCullingDistance(float NearDistance, float FarDistance)
+{
+	UE_LOG(LogDisplayClusterRender, Log, TEXT("New culling distance: NCP=%f, FCP=%f"), NearDistance, FarDistance);
+
+	FScopeLock lock(&InternalsSyncScope);
+	NearClipPlane = NearDistance;
+	FarClipPlane = FarDistance;
+}
diff --git a/Source/DisplayCluster/Private/Render/Devices/DisplayClusterDeviceBase.h b/Source/DisplayCluster/Private/Render/Devices/DisplayClusterDeviceBase.h
new file mode 100644
index 0000000000000000000000000000000000000000..2a9e8d96cf0c6c655bd30589efc935ac5cac3f65
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/DisplayClusterDeviceBase.h
@@ -0,0 +1,202 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+
+#include "RHI.h"
+#include "RHIResources.h"
+#include "StereoRendering.h"
+#include "StereoRenderTargetManager.h"
+
+#include "Render/IDisplayClusterStereoDevice.h"
+#include "Render/Devices/DisplayClusterViewportArea.h"
+
+
+/**
+ * Abstract render device
+ */
+class FDisplayClusterDeviceBase
+	: public  IStereoRendering
+	, public  IStereoRenderTargetManager
+	, public  IDisplayClusterStereoDevice
+	, public  FRHICustomPresent
+{
+public:
+	FDisplayClusterDeviceBase();
+	virtual ~FDisplayClusterDeviceBase();
+
+public:
+	virtual bool Initialize();
+
+protected:
+
+	inline uint32 GetSwapInt() const
+	{ return SwapInterval; }
+
+protected:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IStereoRendering
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool IsStereoEnabled() const override;
+	virtual bool IsStereoEnabledOnNextFrame() const override;
+	virtual bool EnableStereo(bool stereo = true) override;
+	virtual void AdjustViewRect(enum EStereoscopicPass StereoPass, int32& X, int32& Y, uint32& SizeX, uint32& SizeY) const override;
+	virtual void CalculateStereoViewOffset(const enum EStereoscopicPass StereoPassType, FRotator& ViewRotation, const float WorldToMeters, FVector& ViewLocation) override;
+	virtual FMatrix GetStereoProjectionMatrix(const enum EStereoscopicPass StereoPassType) const override;
+	virtual void InitCanvasFromView(class FSceneView* InView, class UCanvas* Canvas) override;
+	virtual IStereoRenderTargetManager* GetRenderTargetManager() override
+	{ return this; }
+
+protected:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IStereoRenderTargetManager
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	/**
+	* Whether a separate render target should be used or not.
+	* In case the stereo rendering implementation does not require special handling of separate render targets
+	* at all, it can leave out implementing this interface completely and simply let the default implementation
+	* of IStereoRendering::GetRenderTargetManager() return nullptr.
+	*/
+	virtual bool ShouldUseSeparateRenderTarget() const override
+	{ return false; }
+
+	/**
+	* Updates viewport for direct rendering of distortion. Should be called on a game thread.
+	*
+	* @param bUseSeparateRenderTarget	Set to true if a separate render target will be used. Can potentiallt be true even if ShouldUseSeparateRenderTarget() returned false earlier.
+	* @param Viewport					The Viewport instance calling this method.
+	* @param ViewportWidget			(optional) The Viewport widget containing the view. Can be used to access SWindow object.
+	*/
+	virtual void UpdateViewport(bool bUseSeparateRenderTarget, const class FViewport& Viewport, class SViewport* ViewportWidget = nullptr) override;
+
+	/**
+	* Calculates dimensions of the render target texture for direct rendering of distortion.
+	*/
+	virtual void CalculateRenderTargetSize(const class FViewport& Viewport, uint32& InOutSizeX, uint32& InOutSizeY) override;
+
+	/**
+	* Returns true, if render target texture must be re-calculated.
+	*/
+	virtual bool NeedReAllocateViewportRenderTarget(const class FViewport& Viewport) override
+	{ return false; }
+
+	/**
+	* Returns true, if render target texture must be re-calculated.
+	*/
+	virtual bool NeedReAllocateDepthTexture(const TRefCountPtr<struct IPooledRenderTarget>& DepthTarget) override
+	{ return false; }
+
+	/**
+	* Returns number of required buffered frames.
+	*/
+	virtual uint32 GetNumberOfBufferedFrames() const override
+	{ return 1; }
+
+	/**
+	* Allocates a render target texture.
+	* The default implementation always return false to indicate that the default texture allocation should be used instead.
+	*
+	* @param Index			(in) index of the buffer, changing from 0 to GetNumberOfBufferedFrames()
+	* @return				true, if texture was allocated; false, if the default texture allocation should be used.
+	*/
+	virtual bool AllocateRenderTargetTexture(uint32 Index, uint32 SizeX, uint32 SizeY, uint8 Format, uint32 NumMips, uint32 Flags, uint32 TargetableTextureFlags, FTexture2DRHIRef& OutTargetableTexture, FTexture2DRHIRef& OutShaderResourceTexture, uint32 NumSamples = 1) override
+	{ return false; }
+
+	/**
+	* Allocates a depth texture.
+	*
+	* @param Index			(in) index of the buffer, changing from 0 to GetNumberOfBufferedFrames()
+	* @return				true, if texture was allocated; false, if the default texture allocation should be used.
+	*/
+	virtual bool AllocateDepthTexture(uint32 Index, uint32 SizeX, uint32 SizeY, uint8 Format, uint32 NumMips, uint32 Flags, uint32 TargetableTextureFlags, FTexture2DRHIRef& OutTargetableTexture, FTexture2DRHIRef& OutShaderResourceTexture, uint32 NumSamples = 1) { return false; }
+
+protected:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// FRHICustomPresent
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void OnBackBufferResize() override;
+	// Called from render thread to see if a native present will be requested for this frame.
+	// @return	true if native Present will be requested for this frame; false otherwise.  Must
+	// match value subsequently returned by Present for this frame.
+	virtual bool NeedsNativePresent() override
+	{ return true; }
+
+	virtual bool Present(int32& InOutSyncInterval) override;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterStereoDevice
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void SetViewportArea(const FIntPoint& loc, const FIntPoint& size) override;
+	virtual void SetDesktopStereoParams(float FOV) override;
+	virtual void SetDesktopStereoParams(const FVector2D& screenSize, const FIntPoint& screenRes, float screenDist) override;
+	virtual void SetInterpupillaryDistance(float dist) override;
+	virtual float GetInterpupillaryDistance() const override;
+	virtual void SetEyesSwap(bool swap) override;
+	virtual bool GetEyesSwap() const override;
+	virtual bool ToggleEyesSwap() override;
+	virtual void SetSwapSyncPolicy(EDisplayClusterSwapSyncPolicy policy) override;
+	virtual EDisplayClusterSwapSyncPolicy GetSwapSyncPolicy() const override;
+	virtual void GetCullingDistance(float& NearDistance, float& FarDistance) const override;
+	virtual void SetCullingDistance(float NearDistance, float FarDistance) override;
+
+protected:
+	// Implements buffer swap synchronization mechanism
+	virtual void WaitForBufferSwapSync(int32& InOutSyncInterval);
+	// Retrieves the projections screen data for current frame
+	void UpdateProjectionScreenDataForThisFrame();
+
+	// Custom projection screen geometry (hw - half-width, hh - half-height of projection screen)
+	// Left bottom corner (from camera point view)
+	virtual FVector GetProjectionScreenGeometryLBC(const enum EStereoscopicPass StereoPassType, const float& hw, const float& hh) const
+	{ return FVector(0.f, -hw, -hh);}
+	
+	// Right bottom corner (from camera point view)
+	virtual FVector GetProjectionScreenGeometryRBC(const enum EStereoscopicPass StereoPassType, const float& hw, const float& hh) const
+	{ return FVector(0.f, hw, -hh);}
+
+	// Left top corner (from camera point view)
+	virtual FVector GetProjectionScreenGeometryLTC(const enum EStereoscopicPass StereoPassType, const float& hw, const float& hh) const
+	{ return FVector(0.f, -hw, hh);}
+
+protected:
+	void exec_BarrierWait();
+
+protected:
+	// Data access synchronization
+	mutable FCriticalSection InternalsSyncScope;
+
+	// Viewport and back buffer size
+	FIntPoint BackBuffSize = { 0, 0 };
+	FIntPoint ViewportSize = { 0, 0 };
+
+	// Stereo parameters
+	float EyeDist      = 0.064f; // meters
+	bool  bEyeSwap     = false;
+	FVector  EyeLoc[2] = { FVector::ZeroVector, FVector::ZeroVector };
+	FRotator EyeRot[2] = { FRotator::ZeroRotator, FRotator::ZeroRotator };
+
+	// Current world scale
+	float CurrentWorldToMeters = 100.f;
+
+	// Viewport area settings
+	FDisplayClusterViewportArea ViewportArea;
+
+	// Clipping plane
+	float NearClipPlane = GNearClippingPlane;
+	float FarClipPlane = 2000000.f;
+
+	// Projection screen data
+	FVector   ProjectionScreenLoc;
+	FRotator  ProjectionScreenRot;
+	FVector2D ProjectionScreenSize;
+
+	uint32 SwapInterval = 1;
+
+	// Swap sync policy
+	EDisplayClusterSwapSyncPolicy SwapSyncPolicy = EDisplayClusterSwapSyncPolicy::None;
+
+protected:
+	FViewport* CurrentViewport;
+};
diff --git a/Source/DisplayCluster/Private/Render/Devices/DisplayClusterDeviceInternals.cpp b/Source/DisplayCluster/Private/Render/Devices/DisplayClusterDeviceInternals.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..c9faa4abd76cf7eb32cc26d016494ff1d128d913
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/DisplayClusterDeviceInternals.cpp
@@ -0,0 +1,110 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterDeviceInternals.h"
+
+
+#if PLATFORM_WINDOWS
+PFNWGLSWAPINTERVALEXTPROC    DisplayCluster_wglSwapIntervalEXT_ProcAddress   = nullptr;
+
+PFNWGLJOINSWAPGROUPNVPROC      DisplayCluster_wglJoinSwapGroupNV_ProcAddress   = nullptr;
+PFNWGLBINDSWAPBARRIERNVPROC    DisplayCluster_wglBindSwapBarrierNV_ProcAddress = nullptr;
+PFNWGLQUERYSWAPGROUPNVPROC     DisplayCluster_wglQuerySwapGroupNV_ProcAddress = nullptr;
+PFNWGLQUERYMAXSWAPGROUPSNVPROC DisplayCluster_wglQueryMaxSwapGroupsNV_ProcAddress = nullptr;
+PFNWGLQUERYFRAMECOUNTNVPROC    DisplayCluster_wglQueryFrameCountNV_ProcAddress = nullptr;
+PFNWGLRESETFRAMECOUNTNVPROC    DisplayCluster_wglResetFrameCountNV_ProcAddress = nullptr;
+
+
+// Copy/pasted from OpenGLDrv.cpp
+static void DisplayClusterGetExtensionsString(FString& ExtensionsString)
+{
+	GLint ExtensionCount = 0;
+	ExtensionsString = TEXT("");
+	if (FOpenGL::SupportsIndexedExtensions())
+	{
+		glGetIntegerv(GL_NUM_EXTENSIONS, &ExtensionCount);
+		for (int32 ExtensionIndex = 0; ExtensionIndex < ExtensionCount; ++ExtensionIndex)
+		{
+			const ANSICHAR* ExtensionString = FOpenGL::GetStringIndexed(GL_EXTENSIONS, ExtensionIndex);
+
+			ExtensionsString += TEXT(" ");
+			ExtensionsString += ANSI_TO_TCHAR(ExtensionString);
+		}
+	}
+	else
+	{
+		const ANSICHAR* GlGetStringOutput = (const ANSICHAR*)glGetString(GL_EXTENSIONS);
+		if (GlGetStringOutput)
+		{
+			ExtensionsString += GlGetStringOutput;
+			ExtensionsString += TEXT(" ");
+		}
+	}
+}
+
+// https://www.opengl.org/wiki/Load_OpenGL_Functions
+static void* DisplayClusterGetGLFuncAddress(const char *name)
+{
+	HMODULE module = LoadLibraryA("opengl32.dll");
+	if (module)
+	{
+		return (void *)GetProcAddress(module, name);
+	}
+	else
+	{
+		return nullptr;
+	}
+}
+
+// Copy/pasted from OpenGLDevice.cpp
+// static void InitRHICapabilitiesForGL()
+void DisplayClusterInitCapabilitiesForGL()
+{
+	bool bWindowsSwapControlExtensionPresent = false;
+	{
+		FString ExtensionsString;
+		DisplayClusterGetExtensionsString(ExtensionsString);
+
+		if (ExtensionsString.Contains(TEXT("WGL_EXT_swap_control")))
+		{
+			bWindowsSwapControlExtensionPresent = true;
+		}
+	}
+
+#pragma warning(push)
+#pragma warning(disable:4191)
+	if (bWindowsSwapControlExtensionPresent)
+	{
+		DisplayCluster_wglSwapIntervalEXT_ProcAddress = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
+	}
+
+	DisplayCluster_wglJoinSwapGroupNV_ProcAddress      = (PFNWGLJOINSWAPGROUPNVPROC)wglGetProcAddress("wglJoinSwapGroupNV");
+	DisplayCluster_wglBindSwapBarrierNV_ProcAddress    = (PFNWGLBINDSWAPBARRIERNVPROC)wglGetProcAddress("wglBindSwapBarrierNV");
+	DisplayCluster_wglQuerySwapGroupNV_ProcAddress     = (PFNWGLQUERYSWAPGROUPNVPROC)wglGetProcAddress("wglQuerySwapGroupNV");
+	DisplayCluster_wglQueryMaxSwapGroupsNV_ProcAddress = (PFNWGLQUERYMAXSWAPGROUPSNVPROC)wglGetProcAddress("wglQueryMaxSwapGroupsNV");
+	DisplayCluster_wglQueryFrameCountNV_ProcAddress    = (PFNWGLQUERYFRAMECOUNTNVPROC)wglGetProcAddress("wglQueryFrameCountNV");
+	DisplayCluster_wglResetFrameCountNV_ProcAddress    = (PFNWGLRESETFRAMECOUNTNVPROC)wglGetProcAddress("wglResetFrameCountNV");
+
+#pragma warning(pop)
+}
+#endif
+
+
+
+#if PLATFORM_LINUX
+GLX_JoinSwapGroupNV_Func DisplayCluster_glXJoinSwapGroupNV_ProcAddress = nullptr;
+GLX_BindSwapBarrierNV_Func DisplayCluster_glXBindSwapBarrierNV_ProcAddress = nullptr;
+GLX_QuerySwapGroupNV_Func DisplayCluster_glXQuerySwapGroupNV_ProcAddress = nullptr;
+GLX_QueryMaxSwapGroupsNV_Func DisplayCluster_glXQueryMaxSwapGroupsNV_ProcAddress = nullptr;
+GLX_QueryFrameCountNV_Func DisplayCluster_glXQueryFrameCountNV_ProcAddress = nullptr;
+GLX_ResetFrameCountNV_Func DisplayCluster_glXResetFrameCountNV_ProcAddress = nullptr;
+
+void DisplayClusterInitCapabilitiesForGL()
+{
+	DisplayCluster_glXJoinSwapGroupNV_ProcAddress 			= (GLX_JoinSwapGroupNV_Func) SDL_GL_GetProcAddress("glXJoinSwapGroupNV");
+	DisplayCluster_glXBindSwapBarrierNV_ProcAddress 		= (GLX_BindSwapBarrierNV_Func) SDL_GL_GetProcAddress("glXBindSwapBarrierNV");
+	DisplayCluster_glXQuerySwapGroupNV_ProcAddress 			= (GLX_QuerySwapGroupNV_Func) SDL_GL_GetProcAddress("glXQuerySwapGroupNV");
+	DisplayCluster_glXQueryMaxSwapGroupsNV_ProcAddress 	= (GLX_QueryMaxSwapGroupsNV_Func) SDL_GL_GetProcAddress("glXQueryMaxSwapGroupsNV");
+	DisplayCluster_glXQueryFrameCountNV_ProcAddress 		= (GLX_QueryFrameCountNV_Func) SDL_GL_GetProcAddress("glXQueryFrameCountNV");
+	DisplayCluster_glXResetFrameCountNV_ProcAddress 		= (GLX_ResetFrameCountNV_Func) SDL_GL_GetProcAddress("glXResetFrameCountNV");
+}
+#endif
diff --git a/Source/DisplayCluster/Private/Render/Devices/DisplayClusterDeviceInternals.h b/Source/DisplayCluster/Private/Render/Devices/DisplayClusterDeviceInternals.h
new file mode 100644
index 0000000000000000000000000000000000000000..d35062796a563816d1a885d3e210638336c1c73f
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/DisplayClusterDeviceInternals.h
@@ -0,0 +1,133 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+
+#if PLATFORM_WINDOWS
+
+#include "D3D11RHIPrivate.h"
+#include "D3D11Util.h"
+
+//-------------------------------------------------------------------------------------------------
+// D3D12
+//-------------------------------------------------------------------------------------------------
+
+#define GetD3D11CubeFace GetD3D12CubeFace
+#define VerifyD3D11Result VerifyD3D12Result
+#define GetD3D11TextureFromRHITexture GetD3D12TextureFromRHITexture
+#define FRingAllocation FRingAllocation_D3D12
+#define GetRenderTargetFormat GetRenderTargetFormat_D3D12
+#define ED3D11ShaderOffsetBuffer ED3D12ShaderOffsetBuffer
+#define FindShaderResourceDXGIFormat FindShaderResourceDXGIFormat_D3D12
+#define FindUnorderedAccessDXGIFormat FindUnorderedAccessDXGIFormat_D3D12
+#define FindDepthStencilDXGIFormat FindDepthStencilDXGIFormat_D3D12
+#define HasStencilBits HasStencilBits_D3D12
+#define FVector4VertexDeclaration FVector4VertexDeclaration_D3D12
+#define GLOBAL_CONSTANT_BUFFER_INDEX GLOBAL_CONSTANT_BUFFER_INDEX_D3D12
+#define MAX_CONSTANT_BUFFER_SLOTS MAX_CONSTANT_BUFFER_SLOTS_D3D12
+#define FD3DGPUProfiler FD3D12GPUProfiler
+#define FRangeAllocator FRangeAllocator_D3D12
+
+#include "D3D12RHIPrivate.h"
+#include "D3D12Util.h"
+
+#undef GetD3D11CubeFace
+#undef VerifyD3D11Result
+#undef GetD3D11TextureFromRHITexture
+#undef FRingAllocation
+#undef GetRenderTargetFormat
+#undef ED3D11ShaderOffsetBuffer
+#undef FindShaderResourceDXGIFormat
+#undef FindUnorderedAccessDXGIFormat
+#undef FindDepthStencilDXGIFormat
+#undef HasStencilBits
+#undef FVector4VertexDeclaration
+#undef GLOBAL_CONSTANT_BUFFER_INDEX
+#undef MAX_CONSTANT_BUFFER_SLOTS
+#undef FD3DGPUProfiler
+#undef FRangeAllocator
+
+
+#include "../../OpenGLDrv/Public/OpenGLDrv.h"
+#include "../../OpenGLDrv/Public/OpenGLResources.h"
+#include "OpenGLResources.h"
+
+extern PFNWGLSWAPINTERVALEXTPROC      DisplayCluster_wglSwapIntervalEXT_ProcAddress;
+
+extern PFNWGLJOINSWAPGROUPNVPROC      DisplayCluster_wglJoinSwapGroupNV_ProcAddress;
+extern PFNWGLBINDSWAPBARRIERNVPROC    DisplayCluster_wglBindSwapBarrierNV_ProcAddress;
+extern PFNWGLQUERYSWAPGROUPNVPROC     DisplayCluster_wglQuerySwapGroupNV_ProcAddress;
+extern PFNWGLQUERYMAXSWAPGROUPSNVPROC DisplayCluster_wglQueryMaxSwapGroupsNV_ProcAddress;
+extern PFNWGLQUERYFRAMECOUNTNVPROC    DisplayCluster_wglQueryFrameCountNV_ProcAddress;
+extern PFNWGLRESETFRAMECOUNTNVPROC    DisplayCluster_wglResetFrameCountNV_ProcAddress;
+
+
+void DisplayClusterInitCapabilitiesForGL();
+
+// This is redeclaration of WINDOWS specific FPlatformOpenGLContext
+// which is declared in private OpenGLWindows.cpp file.
+//@note: Keep it synced with original type (Engine\Source\Runtime\OpenGLDrv\Private\Windows\OpenGLWindows.cpp)
+struct FPlatformOpenGLContext
+{
+	HWND WindowHandle;
+	HDC DeviceContext;
+	HGLRC OpenGLContext;
+	bool bReleaseWindowOnDestroy;
+	int32 SyncInterval;
+	GLuint	ViewportFramebuffer;
+	GLuint	VertexArrayObject;	// one has to be generated and set for each context (OpenGL 3.2 Core requirements)
+	GLuint	BackBufferResource;
+	GLenum	BackBufferTarget;
+};
+#endif
+
+
+
+#if PLATFORM_LINUX
+
+#define SDL_VIDEO_DRIVER_X11
+#include "SDL.h"
+#include "SDL_syswm.h"
+
+#include "../../OpenGLDrv/Public/OpenGLDrv.h"
+#include "../../OpenGLDrv/Public/OpenGLResources.h"
+#include "OpenGLResources.h"
+
+typedef bool (*GLX_JoinSwapGroupNV_Func) 			(Display* display, Window drawable, GLuint group);
+typedef bool (*GLX_BindSwapBarrierNV_Func) 		(Display* display, GLuint group, GLuint barrier);
+typedef bool (*GLX_QuerySwapGroupNV_Func) 		(Display* display, Window drawable, GLuint* group, GLuint *barrier);
+typedef bool (*GLX_QueryMaxSwapGroupsNV_Func) (Display* display, int screen, GLuint* maxGroup, GLuint* maxBarriers);
+typedef bool (*GLX_QueryFrameCountNV_Func) 		(Display* display, int screen, GLuint* count);
+typedef bool (*GLX_ResetFrameCountNV_Func) 		(Display* display, int screen);
+
+extern GLX_JoinSwapGroupNV_Func 			DisplayCluster_glXJoinSwapGroupNV_ProcAddress;
+extern GLX_BindSwapBarrierNV_Func 		DisplayCluster_glXBindSwapBarrierNV_ProcAddress;
+extern GLX_QuerySwapGroupNV_Func 			DisplayCluster_glXQuerySwapGroupNV_ProcAddress;
+extern GLX_QueryMaxSwapGroupsNV_Func 	DisplayCluster_glXQueryMaxSwapGroupsNV_ProcAddress;
+extern GLX_QueryFrameCountNV_Func 		DisplayCluster_glXQueryFrameCountNV_ProcAddress;
+extern GLX_ResetFrameCountNV_Func 		DisplayCluster_glXResetFrameCountNV_ProcAddress;
+
+
+void DisplayClusterInitCapabilitiesForGL();
+
+typedef SDL_Window* 	SDL_HWindow;
+typedef SDL_GLContext SDL_HGLContext;
+
+// This is redeclaration of LINUX specific FPlatformOpenGLContext
+// which is declared in private OpenGLWindows.cpp file.
+//@note: Keep it synced with original type (Engine\Source\Runtime\OpenGLDrv\Private\Linux\OpenGLLinux.cpp)
+struct FPlatformOpenGLContext
+{
+	SDL_HWindow    hWnd;
+	SDL_HGLContext hGLContext; // this is a (void*) pointer
+
+	bool bReleaseWindowOnDestroy;
+	int32 SyncInterval;
+	GLuint	ViewportFramebuffer;
+	GLuint	VertexArrayObject;	// one has to be generated and set for each context (OpenGL 3.2 Core requirements)
+};
+
+//@note: Place here any Linux targeted device implementations
+#endif
+
diff --git a/Source/DisplayCluster/Private/Render/Devices/DisplayClusterNativePresentHandler.cpp b/Source/DisplayCluster/Private/Render/Devices/DisplayClusterNativePresentHandler.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d5152cd44cee2c154e3b0e804d24cedbaf759c67
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/DisplayClusterNativePresentHandler.cpp
@@ -0,0 +1,21 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterNativePresentHandler.h"
+
+
+FDisplayClusterNativePresentHandler::FDisplayClusterNativePresentHandler()
+{
+}
+
+FDisplayClusterNativePresentHandler::~FDisplayClusterNativePresentHandler()
+{
+}
+
+
+bool FDisplayClusterNativePresentHandler::Present(int32& InOutSyncInterval)
+{
+	exec_BarrierWait();
+	InOutSyncInterval = 1;
+
+	return true;
+}
diff --git a/Source/DisplayCluster/Private/Render/Devices/DisplayClusterNativePresentHandler.h b/Source/DisplayCluster/Private/Render/Devices/DisplayClusterNativePresentHandler.h
new file mode 100644
index 0000000000000000000000000000000000000000..27fe184935bd4016bf2ecc8aa6219a606d25daa4
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/DisplayClusterNativePresentHandler.h
@@ -0,0 +1,22 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Render/Devices/DisplayClusterDeviceBase.h"
+
+
+/**
+ * Present stub to allow to sycnhronize a cluster with native rendering pipeline (no nDisplay stereo devices used)
+ */
+class FDisplayClusterNativePresentHandler : public FDisplayClusterDeviceBase
+{
+public:
+	FDisplayClusterNativePresentHandler();
+	virtual ~FDisplayClusterNativePresentHandler();
+
+protected:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// FRHICustomPresent
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool Present(int32& InOutSyncInterval) override;	
+};
diff --git a/Source/DisplayCluster/Private/Render/Devices/DisplayClusterViewportArea.h b/Source/DisplayCluster/Private/Render/Devices/DisplayClusterViewportArea.h
new file mode 100644
index 0000000000000000000000000000000000000000..97c33fbe4fa3763fcc7ccebb6623140126c917d7
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/DisplayClusterViewportArea.h
@@ -0,0 +1,52 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+
+/**
+ * Viewport area
+ */
+class FDisplayClusterViewportArea
+{
+public:
+	FDisplayClusterViewportArea() :
+		Location(FIntPoint::ZeroValue),
+		Size(FIntPoint::ZeroValue)
+	{ }
+
+	FDisplayClusterViewportArea(const FIntPoint& loc, const FIntPoint& size) :
+		Location(loc),
+		Size(size)
+	{ }
+
+	FDisplayClusterViewportArea(int32 x, int32 y, int32 w, int32 h) :
+		Location(FIntPoint(x, y)),
+		Size(FIntPoint(w, h))
+	{ }
+
+public:
+	bool IsValid() const
+	{ return Size.X > 0 && Size.Y > 0; }
+
+	FIntPoint GetLocation() const
+	{ return Location; }
+	
+	FIntPoint GetSize() const
+	{ return Size; }
+
+	void SetLocation(const FIntPoint& loc)
+	{ Location = loc; }
+
+	void SetLocation(int32 x, int32 y)
+	{ Location = FIntPoint(x, y); }
+
+	void SetSize(const FIntPoint& size)
+	{ Size = size; }
+
+	void SetSize(int32 w, int32 h)
+	{ Size = FIntPoint(w, h); }
+
+private:
+	FIntPoint Location;
+	FIntPoint Size;
+};
diff --git a/Source/DisplayCluster/Private/Render/Devices/Monoscopic/DisplayClusterDeviceMonoscopicD3D11.cpp b/Source/DisplayCluster/Private/Render/Devices/Monoscopic/DisplayClusterDeviceMonoscopicD3D11.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..bbfc37cc2a1e180cc2d89cc5d5172efec0981caa
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/Monoscopic/DisplayClusterDeviceMonoscopicD3D11.cpp
@@ -0,0 +1,43 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterDeviceMonoscopicD3D11.h"
+
+#if PLATFORM_WINDOWS
+#include "D3D11Viewport.h"
+#include "D3D11Resources.h"
+#endif
+
+
+FDisplayClusterDeviceMonoscopicD3D11::FDisplayClusterDeviceMonoscopicD3D11():
+	FDisplayClusterDeviceQuadBufferStereoD3D11()
+{
+
+}
+
+FDisplayClusterDeviceMonoscopicD3D11::~FDisplayClusterDeviceMonoscopicD3D11()
+{
+	
+}
+
+bool FDisplayClusterDeviceMonoscopicD3D11::Present(int32& InOutSyncInterval)
+{
+#if PLATFORM_WINDOWS
+	FD3D11Viewport* viewport = static_cast<FD3D11Viewport*>(CurrentViewport->GetViewportRHI().GetReference());
+
+#if !WITH_EDITOR
+	// Issue frame event
+	viewport->IssueFrameEvent();
+	// Wait until GPU finish last frame commands
+	viewport->WaitForFrameEventCompletion();
+#endif
+
+	// Sync all nodes
+	exec_BarrierWait();
+	
+	IDXGISwapChain* swapchain = (IDXGISwapChain*)viewport->GetSwapChain();
+	swapchain->Present(GetSwapInt(), 0);
+
+#endif
+
+	return false;
+}
diff --git a/Source/DisplayCluster/Private/Render/Devices/Monoscopic/DisplayClusterDeviceMonoscopicD3D11.h b/Source/DisplayCluster/Private/Render/Devices/Monoscopic/DisplayClusterDeviceMonoscopicD3D11.h
new file mode 100644
index 0000000000000000000000000000000000000000..2ed075fecdbacb9c09629d1751a70eb6d1bc0228
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/Monoscopic/DisplayClusterDeviceMonoscopicD3D11.h
@@ -0,0 +1,31 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoD3D11.h"
+#include "Render/Devices/DisplayClusterDeviceInternals.h"
+
+
+/**
+ * Monoscopic emulation device (DirectX 11)
+ */
+class FDisplayClusterDeviceMonoscopicD3D11 : public FDisplayClusterDeviceQuadBufferStereoD3D11
+{
+public:
+	FDisplayClusterDeviceMonoscopicD3D11();
+	virtual ~FDisplayClusterDeviceMonoscopicD3D11();
+
+public:
+	virtual bool ShouldUseSeparateRenderTarget() const override
+	{ return false; };
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IStereoRendering
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual int32 GetDesiredNumberOfViews(bool bStereoRequested) const override
+	{ return 1; }
+
+protected:
+	virtual bool Present(int32& InOutSyncInterval) override;
+};
diff --git a/Source/DisplayCluster/Private/Render/Devices/Monoscopic/DisplayClusterDeviceMonoscopicD3D12.cpp b/Source/DisplayCluster/Private/Render/Devices/Monoscopic/DisplayClusterDeviceMonoscopicD3D12.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5ef5f7664b794c474a1314addbe3246a761baf49
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/Monoscopic/DisplayClusterDeviceMonoscopicD3D12.cpp
@@ -0,0 +1,42 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterDeviceMonoscopicD3D12.h"
+
+#if PLATFORM_WINDOWS
+#include "D3D12Viewport.h"
+#include "D3D12Resources.h"
+#endif
+
+
+FDisplayClusterDeviceMonoscopicD3D12::FDisplayClusterDeviceMonoscopicD3D12():
+	FDisplayClusterDeviceQuadBufferStereoD3D12()
+{
+
+}
+
+FDisplayClusterDeviceMonoscopicD3D12::~FDisplayClusterDeviceMonoscopicD3D12()
+{
+	
+}
+
+bool FDisplayClusterDeviceMonoscopicD3D12::Present(int32& InOutSyncInterval)
+{
+#if PLATFORM_WINDOWS
+	FD3D12Viewport* viewport = static_cast<FD3D12Viewport*>(CurrentViewport->GetViewportRHI().GetReference());
+
+#if !WITH_EDITOR
+	// Issue frame event
+	viewport->IssueFrameEvent();
+	// Wait until GPU finish last frame commands
+	viewport->WaitForFrameEventCompletion();
+#endif
+
+	// Sync all nodes
+	exec_BarrierWait();
+	
+	IDXGISwapChain1* swapchain1 = (IDXGISwapChain1*)viewport->GetSwapChain();
+	swapchain1->Present(GetSwapInt(), 0);
+#endif
+
+	return false;
+}
diff --git a/Source/DisplayCluster/Private/Render/Devices/Monoscopic/DisplayClusterDeviceMonoscopicD3D12.h b/Source/DisplayCluster/Private/Render/Devices/Monoscopic/DisplayClusterDeviceMonoscopicD3D12.h
new file mode 100644
index 0000000000000000000000000000000000000000..6700c48d3aae5a4bfbf4ce4ca07687d3c0b0fda6
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/Monoscopic/DisplayClusterDeviceMonoscopicD3D12.h
@@ -0,0 +1,32 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoD3D12.h"
+#include "Render/Devices/DisplayClusterDeviceInternals.h"
+
+
+/**
+ * Monoscopic emulation device (DirectX 12)
+ */
+class FDisplayClusterDeviceMonoscopicD3D12 : public FDisplayClusterDeviceQuadBufferStereoD3D12
+{
+public:
+	FDisplayClusterDeviceMonoscopicD3D12();
+	virtual ~FDisplayClusterDeviceMonoscopicD3D12();
+
+public:
+	virtual bool ShouldUseSeparateRenderTarget() const override
+	{ return false; }
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IStereoRendering
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual int32 GetDesiredNumberOfViews(bool bStereoRequested) const override
+	{ return 1; }
+
+protected:
+	virtual bool Present(int32& InOutSyncInterval) override;
+};
diff --git a/Source/DisplayCluster/Private/Render/Devices/Monoscopic/DisplayClusterDeviceMonoscopicOpenGL.cpp b/Source/DisplayCluster/Private/Render/Devices/Monoscopic/DisplayClusterDeviceMonoscopicOpenGL.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..238d5634dffb98e6843be9ec80d748b484cd4baf
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/Monoscopic/DisplayClusterDeviceMonoscopicOpenGL.cpp
@@ -0,0 +1,89 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterDeviceMonoscopicOpenGL.h"
+#include "Render/Devices/DisplayClusterDeviceInternals.h"
+
+#include "Misc/DisplayClusterLog.h"
+
+
+
+FDisplayClusterDeviceMonoscopicOpenGL::FDisplayClusterDeviceMonoscopicOpenGL()
+{
+
+}
+
+FDisplayClusterDeviceMonoscopicOpenGL::~FDisplayClusterDeviceMonoscopicOpenGL()
+{
+
+}
+
+bool FDisplayClusterDeviceMonoscopicOpenGL::NeedReAllocateViewportRenderTarget(const class FViewport& Viewport)
+{
+	return FDisplayClusterDeviceBase::NeedReAllocateViewportRenderTarget(Viewport);
+}
+
+void FDisplayClusterDeviceMonoscopicOpenGL::CalculateRenderTargetSize(const class FViewport& Viewport, uint32& InOutSizeX, uint32& InOutSizeY)
+{
+	FDisplayClusterDeviceBase::CalculateRenderTargetSize(Viewport, InOutSizeX, InOutSizeY);
+}
+
+void FDisplayClusterDeviceMonoscopicOpenGL::AdjustViewRect(enum EStereoscopicPass StereoPass, int32& X, int32& Y, uint32& SizeX, uint32& SizeY) const
+{
+	FDisplayClusterDeviceBase::AdjustViewRect(StereoPass, X, Y, SizeX, SizeY);
+}
+
+EStereoscopicPass FDisplayClusterDeviceMonoscopicOpenGL::GetViewPassForIndex(bool bStereoRequested, uint32 ViewIndex) const
+{
+	if (ViewIndex == 0)
+		return EStereoscopicPass::eSSP_MONOSCOPIC_EYE;
+	else if (ViewIndex == 1)
+		return EStereoscopicPass::eSSP_LEFT_EYE;
+	else
+		return EStereoscopicPass::eSSP_FULL;
+}
+
+bool FDisplayClusterDeviceMonoscopicOpenGL::IsStereoEyePass(EStereoscopicPass Pass)
+{
+	return Pass != EStereoscopicPass::eSSP_FULL;
+}
+
+bool FDisplayClusterDeviceMonoscopicOpenGL::Present(int32& InOutSyncInterval)
+{
+	UE_LOG(LogDisplayClusterRender, Verbose, TEXT("FDisplayClusterDeviceQuadBufferStereoOpenGL::Present"));
+
+	const int halfSizeX = BackBuffSize.X / 2;
+	const int dstX1 = 0;
+	const int dstX2 = halfSizeX;
+
+	// Convert to left bottom origin and flip Y
+	const int dstY1 = ViewportSize.Y;
+	const int dstY2 = 0;
+
+	FOpenGLViewport* pOglViewport = static_cast<FOpenGLViewport*>(CurrentViewport->GetViewportRHI().GetReference());
+	check(pOglViewport);
+	FPlatformOpenGLContext* const pContext = pOglViewport->GetGLContext();
+
+#if PLATFORM_WINDOWS
+	check(pContext && pContext->DeviceContext);
+#elif PLATFORM_LINUX
+	check(pContext && pContext->hWnd);
+#endif
+
+	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+	glDrawBuffer(GL_BACK);
+
+	glBindFramebuffer(GL_READ_FRAMEBUFFER, pContext->ViewportFramebuffer);
+	glReadBuffer(GL_COLOR_ATTACHMENT0);
+
+	glBlitFramebuffer(
+		0, 0, halfSizeX, BackBuffSize.Y,
+		dstX1, dstY1, dstX2, dstY2,
+		GL_COLOR_BUFFER_BIT,
+		GL_NEAREST);
+	
+	// Perform buffers swap logic
+	SwapBuffers(pOglViewport, InOutSyncInterval);
+	REPORT_GL_END_BUFFER_EVENT_FOR_FRAME_DUMP();
+
+	return false;
+}
diff --git a/Source/DisplayCluster/Private/Render/Devices/Monoscopic/DisplayClusterDeviceMonoscopicOpenGL.h b/Source/DisplayCluster/Private/Render/Devices/Monoscopic/DisplayClusterDeviceMonoscopicOpenGL.h
new file mode 100644
index 0000000000000000000000000000000000000000..0703510913b73e6a376a6251ba665c398cc2368d
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/Monoscopic/DisplayClusterDeviceMonoscopicOpenGL.h
@@ -0,0 +1,38 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoOpenGL.h"
+#include "Render/Devices/DisplayClusterDeviceInternals.h"
+
+
+/**
+ * Monoscopic emulation device (OpenGL 3 and 4)
+ */
+class FDisplayClusterDeviceMonoscopicOpenGL : public FDisplayClusterDeviceQuadBufferStereoOpenGL
+{
+public:
+	FDisplayClusterDeviceMonoscopicOpenGL();
+	virtual ~FDisplayClusterDeviceMonoscopicOpenGL();
+
+public:
+	virtual bool ShouldUseSeparateRenderTarget() const override
+	{ return false; }
+
+	virtual bool NeedReAllocateViewportRenderTarget(const class FViewport& Viewport) override;	
+	virtual void CalculateRenderTargetSize(const class FViewport& Viewport, uint32& InOutSizeX, uint32& InOutSizeY) override;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IStereoRendering
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual int32 GetDesiredNumberOfViews(bool bStereoRequested) const override
+	{ return 1; }
+
+	virtual void AdjustViewRect(enum EStereoscopicPass StereoPass, int32& X, int32& Y, uint32& SizeX, uint32& SizeY) const override;
+	virtual EStereoscopicPass GetViewPassForIndex(bool bStereoRequested, uint32 ViewIndex) const override;
+	virtual bool IsStereoEyePass(EStereoscopicPass Pass) override;
+
+protected:
+	virtual bool Present(int32& InOutSyncInterval) override;
+};
diff --git a/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoBase.cpp b/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoBase.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..36495cd55b2bb35061c6dd695137291d21df92eb
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoBase.cpp
@@ -0,0 +1,93 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterDeviceQuadBufferStereoBase.h"
+
+#include "Render/Devices/DisplayClusterDeviceInternals.h"
+
+#include <utility>
+
+
+FDisplayClusterDeviceQuadBufferStereoBase::FDisplayClusterDeviceQuadBufferStereoBase() :
+	FDisplayClusterDeviceBase()
+{
+}
+
+FDisplayClusterDeviceQuadBufferStereoBase::~FDisplayClusterDeviceQuadBufferStereoBase()
+{
+}
+
+bool FDisplayClusterDeviceQuadBufferStereoBase::NeedReAllocateViewportRenderTarget(const class FViewport& Viewport)
+{
+	//UE_LOG(LogDisplayClusterRender, Log, TEXT("FDisplayClusterDeviceMonoscopic::NeedReAllocateViewportRenderTarget"));
+	check(IsInGameThread());
+
+	const FIntPoint rtSize = Viewport.GetRenderTargetTextureSizeXY();
+	uint32 newSizeX = rtSize.X;
+	uint32 newSizeY = rtSize.Y;
+
+	// Perform size calculation
+	CalculateRenderTargetSize(Viewport, newSizeX, newSizeY);
+
+	// Render target need to be re-allocated if its current size is invalid
+	if (newSizeX != rtSize.X || newSizeY != rtSize.Y)
+	{
+		return true;
+	}
+
+	// No need to re-allocate
+	return false;
+}
+
+void FDisplayClusterDeviceQuadBufferStereoBase::CalculateRenderTargetSize(const class FViewport& Viewport, uint32& InOutSizeX, uint32& InOutSizeY)
+{
+	check(IsInGameThread());
+
+	InOutSizeX = Viewport.GetSizeXY().X * 2;
+	InOutSizeY = Viewport.GetSizeXY().Y;
+
+	check(InOutSizeX > 0 && InOutSizeY > 0);
+}
+
+
+bool FDisplayClusterDeviceQuadBufferStereoBase::ShouldUseSeparateRenderTarget() const
+{
+	return true;
+}
+
+void FDisplayClusterDeviceQuadBufferStereoBase::AdjustViewRect(enum EStereoscopicPass StereoPass, int32& X, int32& Y, uint32& SizeX, uint32& SizeY) const
+{
+	const uint32 screentWidth = SizeX;
+	FDisplayClusterDeviceBase::AdjustViewRect(StereoPass, X, Y, SizeX, SizeY);
+
+	if (StereoPass == EStereoscopicPass::eSSP_RIGHT_EYE)
+	{
+		X += screentWidth;
+	}
+}
+
+/*
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterStereoDevice
+//////////////////////////////////////////////////////////////////////////////////////////////
+void FDisplayClusterDeviceQuadBufferStereoBase::SetSwapSyncPolicy(EDisplayClusterSwapSyncPolicy policy)
+{
+	FScopeLock lock(&InternalsSyncScope);
+	UE_LOG(LogDisplayClusterRender, Log, TEXT("Swap sync policy: %d"), (int)policy);
+
+	switch (policy)
+	{
+		// Policies below are supported by all child implementations
+	case EDisplayClusterSwapSyncPolicy::SoftSwapSync:
+	case EDisplayClusterSwapSyncPolicy::NvSwapSync:
+	{
+		SwapSyncPolicy = policy;
+		break;
+	}
+
+	default:
+		// Forward the policy type to the upper level
+		FDisplayClusterDeviceBase::SetSwapSyncPolicy(policy);
+		break;
+	}
+}
+*/
diff --git a/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoBase.h b/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoBase.h
new file mode 100644
index 0000000000000000000000000000000000000000..3f525b018a084a0170de88fda9dad25f0ba25c24
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoBase.h
@@ -0,0 +1,29 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "Render/Devices/DisplayClusterDeviceBase.h"
+
+
+/**
+ * Abstract frame sequenced active stereo device
+ */
+class FDisplayClusterDeviceQuadBufferStereoBase : public FDisplayClusterDeviceBase
+{
+public:
+	FDisplayClusterDeviceQuadBufferStereoBase();
+	virtual ~FDisplayClusterDeviceQuadBufferStereoBase();
+
+protected:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IStereoRendering
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool NeedReAllocateViewportRenderTarget(const class FViewport& Viewport) override;
+	virtual void AdjustViewRect(enum EStereoscopicPass StereoPass, int32& X, int32& Y, uint32& SizeX, uint32& SizeY) const override;
+	virtual bool ShouldUseSeparateRenderTarget() const override;
+	virtual void CalculateRenderTargetSize(const class FViewport& Viewport, uint32& InOutSizeX, uint32& InOutSizeY) override;	
+
+protected:
+	mutable FCriticalSection InternalsSyncScope;
+};
diff --git a/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoD3D11.cpp b/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoD3D11.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e77e7d48d018793092a2fafc89c1e0c52a56a0e6
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoD3D11.cpp
@@ -0,0 +1,110 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterDeviceQuadBufferStereoD3D11.h"
+#include "Render/Devices/DisplayClusterDeviceInternals.h"
+
+#include "Misc/DisplayClusterLog.h"
+
+#if PLATFORM_WINDOWS
+#include "D3D11Viewport.h"
+#endif
+
+#include "RHI.h"
+#include "RHICommandList.h"
+
+
+FDisplayClusterDeviceQuadBufferStereoD3D11::FDisplayClusterDeviceQuadBufferStereoD3D11() :
+	FDisplayClusterDeviceQuadBufferStereoBase()
+{
+#if PLATFORM_WINDOWS
+	dxgi_present_parameters = { 0, nullptr, nullptr, nullptr };
+#endif
+}
+
+FDisplayClusterDeviceQuadBufferStereoD3D11::~FDisplayClusterDeviceQuadBufferStereoD3D11()
+{
+}
+
+bool FDisplayClusterDeviceQuadBufferStereoD3D11::ShouldUseSeparateRenderTarget() const
+{
+	return true;
+}
+
+void FDisplayClusterDeviceQuadBufferStereoD3D11::SetSwapSyncPolicy(EDisplayClusterSwapSyncPolicy policy)
+{
+	FScopeLock lock(&InternalsSyncScope);
+	UE_LOG(LogDisplayClusterRender, Log, TEXT("Swap sync policy: %d"), (int)policy);
+
+	switch (policy)
+	{
+		case EDisplayClusterSwapSyncPolicy::SoftSwapSync:
+			SwapSyncPolicy = policy;
+			break;
+
+		default:
+			// Forward the policy type to the upper level
+			FDisplayClusterDeviceBase::SetSwapSyncPolicy(policy);
+			break;
+	}
+}
+
+bool FDisplayClusterDeviceQuadBufferStereoD3D11::Present(int32& InOutSyncInterval)
+{
+#if PLATFORM_WINDOWS
+	// get backbuffer
+	FD3D11Viewport* viewport = static_cast<FD3D11Viewport*>(CurrentViewport->GetViewportRHI().GetReference());
+
+#if !WITH_EDITOR
+	// Issue frame event
+	viewport->IssueFrameEvent();
+	// Wait until GPU finish last frame commands
+	viewport->WaitForFrameEventCompletion();
+#endif
+
+	// Sync all nodes
+	exec_BarrierWait();
+
+	// present
+	if (viewport)
+	{
+		IDXGISwapChain1* swapchain1 = (IDXGISwapChain1*)viewport->GetSwapChain();
+		swapchain1->Present1(GetSwapInt(), 0, &dxgi_present_parameters);
+	}
+#endif
+	
+	return false;
+}
+
+void FDisplayClusterDeviceQuadBufferStereoD3D11::RenderTexture_RenderThread(FRHICommandListImmediate& RHICmdList, FTexture2DRHIParamRef BackBuffer, FTexture2DRHIParamRef SrcTexture, FVector2D WindowSize) const
+{
+	check(IsInRenderingThread());
+
+	//calculate sub regions to copy
+	const int halfSizeX = BackBuffSize.X / 2;
+
+	FResolveParams copyParamsLeft;
+	copyParamsLeft.DestArrayIndex = 0;
+	copyParamsLeft.SourceArrayIndex = 0;
+	copyParamsLeft.Rect.X1 = 0;
+	copyParamsLeft.Rect.Y1 = 0;
+	copyParamsLeft.Rect.X2 = halfSizeX;
+	copyParamsLeft.Rect.Y2 = BackBuffSize.Y;
+	copyParamsLeft.DestRect.X1 = 0;
+	copyParamsLeft.DestRect.Y1 = 0;
+	copyParamsLeft.DestRect.X2 = halfSizeX;
+	copyParamsLeft.DestRect.Y2 = BackBuffSize.Y;
+
+	RHICmdList.CopyToResolveTarget(SrcTexture, BackBuffer, copyParamsLeft);
+
+	FResolveParams copyParamsRight;
+	copyParamsRight.DestArrayIndex = 1;
+	copyParamsRight.SourceArrayIndex = 0;
+
+	copyParamsRight.Rect = copyParamsLeft.Rect;
+	copyParamsRight.Rect.X1 = halfSizeX;
+	copyParamsRight.Rect.X2 = halfSizeX * 2;
+
+	copyParamsRight.DestRect = copyParamsLeft.DestRect;
+
+	RHICmdList.CopyToResolveTarget(SrcTexture, BackBuffer, copyParamsRight);
+}
diff --git a/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoD3D11.h b/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoD3D11.h
new file mode 100644
index 0000000000000000000000000000000000000000..f81d2537a9d30b3ec811bdd9ca49a8e67c79586b
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoD3D11.h
@@ -0,0 +1,34 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "DisplayClusterDeviceQuadBufferStereoBase.h"
+#include "Render/Devices/DisplayClusterDeviceInternals.h"
+
+#if PLATFORM_WINDOWS
+#include "dxgi1_2.h"
+#endif
+
+
+/**
+ * Frame sequenced active stereo (DirectX 11)
+ */
+class FDisplayClusterDeviceQuadBufferStereoD3D11 : public FDisplayClusterDeviceQuadBufferStereoBase
+{
+public:
+	FDisplayClusterDeviceQuadBufferStereoD3D11();
+	virtual ~FDisplayClusterDeviceQuadBufferStereoD3D11();
+
+protected:
+	virtual bool ShouldUseSeparateRenderTarget() const override;
+	virtual void SetSwapSyncPolicy(EDisplayClusterSwapSyncPolicy policy);
+	virtual bool Present(int32& InOutSyncInterval) override;
+
+	virtual void RenderTexture_RenderThread(FRHICommandListImmediate& RHICmdList, FTexture2DRHIParamRef BackBuffer, FTexture2DRHIParamRef SrcTexture, FVector2D WindowSize) const override;
+
+private:
+#if PLATFORM_WINDOWS
+	DXGI_PRESENT_PARAMETERS dxgi_present_parameters;
+#endif
+};
diff --git a/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoD3D12.cpp b/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoD3D12.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..a9e05c65cfbd7fb3a479224df19960c4537806dd
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoD3D12.cpp
@@ -0,0 +1,105 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterDeviceQuadBufferStereoD3D12.h"
+#include "Render/Devices/DisplayClusterDeviceInternals.h"
+
+#include "Misc/DisplayClusterLog.h"
+
+#include "RHI.h"
+#include "RHICommandList.h"
+
+
+
+FDisplayClusterDeviceQuadBufferStereoD3D12::FDisplayClusterDeviceQuadBufferStereoD3D12() :
+	FDisplayClusterDeviceQuadBufferStereoBase()
+{
+#if PLATFORM_WINDOWS
+	dxgi_present_parameters = { 0, nullptr, nullptr, nullptr };
+#endif
+}
+
+FDisplayClusterDeviceQuadBufferStereoD3D12::~FDisplayClusterDeviceQuadBufferStereoD3D12()
+{
+}
+
+bool FDisplayClusterDeviceQuadBufferStereoD3D12::ShouldUseSeparateRenderTarget() const
+{
+	return true;
+}
+
+void FDisplayClusterDeviceQuadBufferStereoD3D12::SetSwapSyncPolicy(EDisplayClusterSwapSyncPolicy policy)
+{
+	FScopeLock lock(&InternalsSyncScope);
+	UE_LOG(LogDisplayClusterRender, Log, TEXT("Swap sync policy: %d"), (int)policy);
+
+	switch (policy)
+	{
+		case EDisplayClusterSwapSyncPolicy::SoftSwapSync:
+			SwapSyncPolicy = policy;
+			break;
+
+		default:
+			// Forward the policy type to the upper level
+			FDisplayClusterDeviceBase::SetSwapSyncPolicy(policy);
+			break;
+	}
+}
+
+bool FDisplayClusterDeviceQuadBufferStereoD3D12::Present(int32& InOutSyncInterval)
+{
+#if PLATFORM_WINDOWS
+	FD3D12Viewport* viewport = static_cast<FD3D12Viewport*>(CurrentViewport->GetViewportRHI().GetReference());
+
+// This code is not used in editor and required only for packaged builds. To avoid linking issues it won't be used with editor builds.
+#if !WITH_EDITOR
+	// Issue frame event
+	viewport->IssueFrameEvent();
+	// Wait until GPU finish last frame commands
+	viewport->WaitForFrameEventCompletion();
+#endif
+
+	// Sync all nodes
+	exec_BarrierWait();
+	
+	// present	
+	IDXGISwapChain1* swapchain1 = (IDXGISwapChain1*)viewport->GetSwapChain();
+	swapchain1->Present(GetSwapInt(), 0);
+#endif
+
+	return false;
+}
+
+void FDisplayClusterDeviceQuadBufferStereoD3D12::RenderTexture_RenderThread(FRHICommandListImmediate& RHICmdList, FTexture2DRHIParamRef BackBuffer, FTexture2DRHIParamRef SrcTexture, FVector2D WindowSize) const
+{
+	check(IsInRenderingThread());
+	
+	//calculate sub regions to copy
+	const int halfSizeX = BackBuffSize.X / 2;
+		
+	FResolveParams copyParamsLeft; 
+	copyParamsLeft.DestArrayIndex = 0;
+	copyParamsLeft.SourceArrayIndex = 0;
+	copyParamsLeft.Rect.X1 = 0;
+	copyParamsLeft.Rect.Y1 = 0;
+	copyParamsLeft.Rect.X2 = halfSizeX;
+	copyParamsLeft.Rect.Y2 = BackBuffSize.Y;
+	copyParamsLeft.DestRect.X1 = 0;
+	copyParamsLeft.DestRect.Y1 = 0;
+	copyParamsLeft.DestRect.X2 = halfSizeX;
+	copyParamsLeft.DestRect.Y2 = BackBuffSize.Y;
+
+	RHICmdList.CopyToResolveTarget(SrcTexture, BackBuffer, copyParamsLeft);
+	
+	FResolveParams copyParamsRight;
+	copyParamsRight.DestArrayIndex = 1;
+	copyParamsRight.SourceArrayIndex = 0;
+	
+	copyParamsRight.Rect = copyParamsLeft.Rect;
+
+	copyParamsRight.Rect.X1 = halfSizeX;
+	copyParamsRight.Rect.X2 = halfSizeX * 2;
+
+	copyParamsRight.DestRect = copyParamsLeft.DestRect;
+
+	RHICmdList.CopyToResolveTarget(SrcTexture, BackBuffer, copyParamsRight);
+}
diff --git a/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoD3D12.h b/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoD3D12.h
new file mode 100644
index 0000000000000000000000000000000000000000..e0136753f6e0734898ed52f2d61e19104d4b59dc
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoD3D12.h
@@ -0,0 +1,37 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "DisplayClusterDeviceQuadBufferStereoBase.h"
+#include "Render/Devices/DisplayClusterDeviceInternals.h"
+
+#if PLATFORM_WINDOWS
+#include "dxgi1_2.h"
+#endif
+
+
+/**
+ * Frame sequenced active stereo (DirectX 12)
+ */
+class FDisplayClusterDeviceQuadBufferStereoD3D12 : public FDisplayClusterDeviceQuadBufferStereoBase
+{
+public:
+	FDisplayClusterDeviceQuadBufferStereoD3D12();
+	virtual ~FDisplayClusterDeviceQuadBufferStereoD3D12();
+
+protected:
+	virtual bool ShouldUseSeparateRenderTarget() const override;
+	virtual void SetSwapSyncPolicy(EDisplayClusterSwapSyncPolicy policy);
+	virtual bool Present(int32& InOutSyncInterval) override;
+
+	virtual void RenderTexture_RenderThread(FRHICommandListImmediate& RHICmdList, FTexture2DRHIParamRef BackBuffer, FTexture2DRHIParamRef SrcTexture, FVector2D WindowSize) const override;
+
+	//void CopySubregions(bool stereo, FD3D11DeviceContext* d3dContext, ID3D11Texture2D* rttD3DTexture, ID3D11RenderTargetView* leftRTV, ID3D11RenderTargetView* rightRTV);
+#if PLATFORM_WINDOWS
+	DXGI_PRESENT_PARAMETERS dxgi_present_parameters;
+#endif
+
+private:
+	//void ClearTargets(FD3D12DeviceContext* d3dContext, ID3D11RenderTargetView* leftRTV, ID3D11RenderTargetView* rightRTV);
+};
diff --git a/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoOpenGL.cpp b/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoOpenGL.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..663544d184dafd7c29c5160c7afc0b882f8c3464
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoOpenGL.cpp
@@ -0,0 +1,495 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterDeviceQuadBufferStereoOpenGL.h"
+
+#include "Render/Devices/DisplayClusterDeviceInternals.h"
+
+#include "Misc/DisplayClusterLog.h"
+
+#if PLATFORM_LINUX
+#define SDL_VIDEO_DRIVER_X11
+#include "SDL_syswm.h"
+#endif
+
+#undef None // X11 name conflict.
+
+FDisplayClusterDeviceQuadBufferStereoOpenGL::FDisplayClusterDeviceQuadBufferStereoOpenGL() :
+	FDisplayClusterDeviceQuadBufferStereoBase()
+{
+	DisplayClusterInitCapabilitiesForGL();
+}
+
+FDisplayClusterDeviceQuadBufferStereoOpenGL::~FDisplayClusterDeviceQuadBufferStereoOpenGL()
+{
+}
+
+void FDisplayClusterDeviceQuadBufferStereoOpenGL::SetSwapSyncPolicy(EDisplayClusterSwapSyncPolicy policy)
+{
+	FScopeLock lock(&InternalsSyncScope);
+	UE_LOG(LogDisplayClusterRender, Log, TEXT("Swap sync policy: %d"), (int)policy);
+
+	switch (policy)
+	{
+		// Policies below are supported by all child implementations
+		case EDisplayClusterSwapSyncPolicy::SoftSwapSync:
+		// falls through
+		case EDisplayClusterSwapSyncPolicy::NvSwapSync:
+		{
+			SwapSyncPolicy = policy;
+			break;
+		}
+
+		default:
+			// Forward the policy type to the upper level
+			FDisplayClusterDeviceBase::SetSwapSyncPolicy(policy);
+			break;
+	}
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Windows implementation
+//////////////////////////////////////////////////////////////////////////////////////////////
+#if PLATFORM_WINDOWS
+bool FDisplayClusterDeviceQuadBufferStereoOpenGL::Present(int32& InOutSyncInterval)
+{
+	UE_LOG(LogDisplayClusterRender, Verbose, TEXT("FDisplayClusterDeviceQuadBufferStereoOpenGL::Present"));
+
+	const int halfSizeX = BackBuffSize.X / 2;
+	const int dstX1 = 0;
+	const int dstX2 = halfSizeX;
+
+	// Convert to left bottom origin and flip Y
+	const int dstY1 = ViewportSize.Y;
+	const int dstY2 = 0;
+
+	FOpenGLViewport* pOglViewport = static_cast<FOpenGLViewport*>(CurrentViewport->GetViewportRHI().GetReference());
+	check(pOglViewport);
+	FPlatformOpenGLContext* const pContext = pOglViewport->GetGLContext();
+	check(pContext && pContext->DeviceContext);
+
+	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+
+	glBindFramebuffer(GL_READ_FRAMEBUFFER, pContext->ViewportFramebuffer);
+	glReadBuffer(GL_COLOR_ATTACHMENT0);
+
+	glDrawBuffer(GL_BACK_LEFT);
+	glBlitFramebuffer(
+		0, 0, halfSizeX, BackBuffSize.Y,
+		dstX1, dstY1, dstX2, dstY2,
+		GL_COLOR_BUFFER_BIT,
+		GL_NEAREST);
+
+	glDrawBuffer(GL_BACK_RIGHT);
+	glBlitFramebuffer(
+		halfSizeX, 0, BackBuffSize.X, BackBuffSize.Y,
+		dstX1, dstY1, dstX2, dstY2,
+		GL_COLOR_BUFFER_BIT,
+		GL_NEAREST);
+
+	// Perform buffers swap logic
+	SwapBuffers(pOglViewport, InOutSyncInterval);
+	REPORT_GL_END_BUFFER_EVENT_FOR_FRAME_DUMP();
+
+	return false;
+}
+#endif
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Linux implementation
+//////////////////////////////////////////////////////////////////////////////////////////////
+#if PLATFORM_LINUX
+//@todo: Implementation for Linux
+bool FDisplayClusterDeviceQuadBufferStereoOpenGL::Present(int32& InOutSyncInterval)
+{
+	// Forward to default implementation (should be a black screen)
+	return FDisplayClusterDeviceBase::Present(InOutSyncInterval);
+}
+#endif
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterDeviceBaseComplex
+//////////////////////////////////////////////////////////////////////////////////////////////
+//@todo: this should be combined somehow with FDisplayClusterDeviceBase::WaitForBufferSwapSync. It seems
+//       they both have the same purpose but there is a GL viewport.
+void FDisplayClusterDeviceQuadBufferStereoOpenGL::SwapBuffers(FOpenGLViewport* pOglViewport, int32& InOutSyncInterval)
+{
+#if PLATFORM_WINDOWS
+	check(pOglViewport && pOglViewport->GetGLContext() && pOglViewport->GetGLContext()->DeviceContext);
+#endif
+
+#if PLATFORM_LINUX
+	check(pOglViewport && pOglViewport->GetGLContext() && pOglViewport->GetGLContext()->hWnd);
+#endif
+
+	{
+		///////////////////////////////////////////////
+		// Perform swap policy
+		UE_LOG(LogDisplayClusterRender, Verbose, TEXT("Exec swap policy: %d"), (int)SwapSyncPolicy);
+		switch (SwapSyncPolicy)
+		{
+		case EDisplayClusterSwapSyncPolicy::None:
+			internal_SwapBuffersPolicyNone(pOglViewport);
+			break;
+
+		case EDisplayClusterSwapSyncPolicy::SoftSwapSync:
+			internal_SwapBuffersPolicySoftSwapSync(pOglViewport);
+			break;
+
+		case EDisplayClusterSwapSyncPolicy::NvSwapSync:
+			internal_SwapBuffersPolicyNvSwapSync(pOglViewport);
+			break;
+
+		default:
+			UE_LOG(LogDisplayClusterRender, Error, TEXT("Unknown swap sync policy: %d"), (int)SwapSyncPolicy);
+			break;
+		}
+	}
+}
+
+
+#if PLATFORM_WINDOWS
+void FDisplayClusterDeviceQuadBufferStereoOpenGL::internal_SwapBuffersPolicyNone(FOpenGLViewport* pOglViewport)
+{
+	{
+		///////////////////////////////////////////////
+		// Swap buffers
+		const double wtB = FPlatformTime::Seconds();
+		::SwapBuffers(pOglViewport->GetGLContext()->DeviceContext);
+		const double wtA = FPlatformTime::Seconds();
+
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT SWAP bef: %lf"), wtB);
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT SWAP aft: %lf"), wtA);
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT SWAP diff: %lf"), wtA - wtB);
+	}
+}
+
+void FDisplayClusterDeviceQuadBufferStereoOpenGL::internal_SwapBuffersPolicySoftSwapSync(FOpenGLViewport* pOglViewport)
+{
+	static double lastSwapBuffersTime = 0;
+
+// This code is not used in editor and required only for packaged builds. To avoid linking issues it won't be used with editor builds.
+#if !WITH_EDITOR
+	{
+		// Issue frame event
+		pOglViewport->IssueFrameEvent();
+
+		// Wait until GPU finish last frame commands
+		const double wtB = FPlatformTime::Seconds();
+		pOglViewport->WaitForFrameEventCompletion();
+		const double wtA = FPlatformTime::Seconds();
+
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT EVENT bef: %lf"), wtB);
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT EVENT aft: %lf"), wtA);
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT EVENT diff: %lf"), wtA - wtB);
+	}
+#endif
+
+	// Sync all nodes
+	exec_BarrierWait();
+
+	// Update swap interval right before swap buffers call
+	UpdateSwapInterval(GetSwapInt());
+
+	{
+		///////////////////////////////////////////////
+		// Swap buffers
+		const double wtB = FPlatformTime::Seconds();
+		::SwapBuffers(pOglViewport->GetGLContext()->DeviceContext);
+		const double wtA = FPlatformTime::Seconds();
+
+		lastSwapBuffersTime = wtA;
+
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT SWAP bef: %lf"), wtB);
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT SWAP aft: %lf"), wtA);
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT SWAP diff: %lf"), wtA - wtB);
+	}
+}
+
+void FDisplayClusterDeviceQuadBufferStereoOpenGL::internal_SwapBuffersPolicyNvSwapSync(FOpenGLViewport* pOglViewport)
+{
+	// Use barrier once during NV barriers initialization
+	if (bNvSwapInitialized == false)
+	{
+		// Use render barrier to guaranty that all nv barriers are initialized simultaneously
+		exec_BarrierWait();
+		bNvSwapInitialized = InitializeNvidiaSwapLock();
+	}
+
+	{
+		///////////////////////////////////////////////
+		// Swap buffers
+		const double wtB = FPlatformTime::Seconds();
+		::SwapBuffers(pOglViewport->GetGLContext()->DeviceContext);
+		const double wtA = FPlatformTime::Seconds();
+
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT SWAP bef: %lf"), wtB);
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT SWAP aft: %lf"), wtA);
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT SWAP diff: %lf"), wtA - wtB);
+	}
+}
+#endif // PLATFORM_WINDOWS
+
+#if PLATFORM_LINUX
+void FDisplayClusterDeviceQuadBufferStereoOpenGL::internal_SwapBuffersPolicyNone(FOpenGLViewport* pOglViewport)
+{
+	{
+		///////////////////////////////////////////////
+		// Swap buffers
+		const double wtB = FPlatformTime::Seconds();
+		SDL_GL_SwapWindow(pOglViewport->GetGLContext()->hWnd);
+		const double wtA = FPlatformTime::Seconds();
+
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT SWAP bef: %lf"), wtB);
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT SWAP aft: %lf"), wtA);
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT SWAP diff: %lf"), wtA - wtB);
+	}
+}
+
+void FDisplayClusterDeviceQuadBufferStereoOpenGL::internal_SwapBuffersPolicySoftSwapSync(FOpenGLViewport* pOglViewport)
+{
+	static double lastSwapBuffersTime = 0;
+
+// This code is not used in editor and required only for packaged builds. To avoid linking issues it won't be used with editor builds.
+#if !WITH_EDITOR
+	{
+		// Issue frame event
+		pOglViewport->IssueFrameEvent();
+
+		// Wait until GPU finish last frame commands
+		const double wtB = FPlatformTime::Seconds();
+		pOglViewport->WaitForFrameEventCompletion();
+		const double wtA = FPlatformTime::Seconds();
+
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT EVENT bef: %lf"), wtB);
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT EVENT aft: %lf"), wtA);
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT EVENT diff: %lf"), wtA - wtB);
+	}
+#endif
+
+	// Sync all nodes
+	exec_BarrierWait();
+
+	// Update swap interval right before swap buffers call
+	UpdateSwapInterval(GetSwapInt());
+
+	{
+		///////////////////////////////////////////////
+		// Swap buffers
+		const double wtB = FPlatformTime::Seconds();
+		SDL_GL_SwapWindow(pOglViewport->GetGLContext()->hWnd);
+		const double wtA = FPlatformTime::Seconds();
+
+		lastSwapBuffersTime = wtA;
+
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT SWAP bef: %lf"), wtB);
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT SWAP aft: %lf"), wtA);
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT SWAP diff: %lf"), wtA - wtB);
+	}
+}
+
+void FDisplayClusterDeviceQuadBufferStereoOpenGL::internal_SwapBuffersPolicyNvSwapSync(FOpenGLViewport* pOglViewport)
+{
+	// Use barrier once during NV barriers initialization
+	if (bNvSwapInitialized == false)
+	{
+		// Use render barrier to guaranty that all nv barriers are initialized simultaneously
+		exec_BarrierWait();
+		bNvSwapInitialized = InitializeNvidiaSwapLock();
+	}
+
+	{
+		///////////////////////////////////////////////
+		// Swap buffers
+		const double wtB = FPlatformTime::Seconds();
+		SDL_GL_SwapWindow(pOglViewport->GetGLContext()->hWnd);
+		const double wtA = FPlatformTime::Seconds();
+
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT SWAP bef: %lf"), wtB);
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT SWAP aft: %lf"), wtA);
+		UE_LOG(LogDisplayClusterRender, VeryVerbose, TEXT("WAIT SWAP diff: %lf"), wtA - wtB);
+	}
+}
+#endif // PLATFORM_LINUX
+
+void FDisplayClusterDeviceQuadBufferStereoOpenGL::UpdateSwapInterval(int32 swapInt) const
+{
+#if PLATFORM_WINDOWS
+	/*
+	https://www.opengl.org/registry/specs/EXT/wgl_swap_control.txt
+	wglSwapIntervalEXT specifies the minimum number of video frame periods
+	per buffer swap for the window associated with the current context.
+	The interval takes effect when SwapBuffers or wglSwapLayerBuffer
+	is first called subsequent to the wglSwapIntervalEXT call.
+
+	The parameter <interval> specifies the minimum number of video frames
+	that are displayed before a buffer swap will occur.
+
+	A video frame period is the time required by the monitor to display a
+	full frame of video data.  In the case of an interlaced monitor,
+	this is typically the time required to display both the even and odd
+	fields of a frame of video data.  An interval set to a value of 2
+	means that the color buffers will be swapped at most every other video
+	frame.
+
+	If <interval> is set to a value of 0, buffer swaps are not synchron-
+	ized to a video frame.  The <interval> value is silently clamped to
+	the maximum implementation-dependent value supported before being
+	stored.
+
+	The swap interval is not part of the render context state.  It cannot
+	be pushed or popped.  The current swap interval for the window
+	associated with the current context can be obtained by calling
+	wglGetSwapIntervalEXT.  The default swap interval is 1.
+	*/
+
+	// Perform that each frame
+	if (!DisplayCluster_wglSwapIntervalEXT_ProcAddress(swapInt))
+		UE_LOG(LogDisplayClusterRender, Error, TEXT("Couldn't set swap interval: %d"), swapInt);
+
+#elif PLATFORM_LINUX
+
+	if(SDL_GL_SetSwapInterval(swapInt) != 0)
+		UE_LOG(LogDisplayClusterRender, Error, TEXT("Couldn't set swap interval: %d"), swapInt);
+
+#endif
+}
+
+
+#if PLATFORM_WINDOWS
+bool FDisplayClusterDeviceQuadBufferStereoOpenGL::InitializeNvidiaSwapLock()
+{
+	if (bNvSwapInitialized)
+	{
+		return true;
+	}
+
+	if (!DisplayCluster_wglJoinSwapGroupNV_ProcAddress || !DisplayCluster_wglBindSwapBarrierNV_ProcAddress)
+	{
+		UE_LOG(LogDisplayClusterRender, Error, TEXT("Group/Barrier functions not available"));
+		return false;
+	}
+
+	if (!CurrentViewport)
+	{
+		UE_LOG(LogDisplayClusterRender, Warning, TEXT("Viewport RHI hasn't been initialized yet"))
+			return false;
+	}
+
+	FOpenGLViewport* pOglViewport = static_cast<FOpenGLViewport*>(CurrentViewport->GetViewportRHI().GetReference());
+	check(pOglViewport);
+	FPlatformOpenGLContext* const pContext = pOglViewport->GetGLContext();
+	check(pContext && pContext->DeviceContext);
+
+	GLuint maxGroups = 0;
+	GLuint maxBarriers = 0;
+
+	if (!DisplayCluster_wglQueryMaxSwapGroupsNV_ProcAddress(pContext->DeviceContext, &maxGroups, &maxBarriers))
+	{
+		UE_LOG(LogDisplayClusterRender, Error, TEXT("Couldn't query gr/br limits: %d"), glGetError());
+		return false;
+	}
+
+	UE_LOG(LogDisplayClusterRender, Log, TEXT("max_groups=%d max_barriers=%d"), (int)maxGroups, (int)maxBarriers);
+
+	if (!(maxGroups > 0 && maxBarriers > 0))
+	{
+		UE_LOG(LogDisplayClusterRender, Error, TEXT("There are no available groups or barriers"));
+		return false;
+	}
+
+	if (!DisplayCluster_wglJoinSwapGroupNV_ProcAddress(pContext->DeviceContext, 1))
+	{
+		UE_LOG(LogDisplayClusterRender, Error, TEXT("Couldn't join swap group: %d"), glGetError());
+		return false;
+	}
+	else
+	{
+		UE_LOG(LogDisplayClusterRender, Log, TEXT("Successfully joined the swap group: 1"));
+	}
+
+	if (!DisplayCluster_wglBindSwapBarrierNV_ProcAddress(1, 1))
+	{
+		UE_LOG(LogDisplayClusterRender, Error, TEXT("Couldn't bind to swap barrier: %d"), glGetError());
+		return false;
+	}
+	else
+	{
+		UE_LOG(LogDisplayClusterRender, Log, TEXT("Successfully binded to the swap barrier: 1"));
+	}
+
+	return true;
+}
+#elif PLATFORM_LINUX
+bool FDisplayClusterDeviceQuadBufferStereoOpenGL::InitializeNvidiaSwapLock()
+{
+	if (bNvSwapInitialized)
+	{
+		return true;
+	}
+
+	if (!DisplayCluster_glXJoinSwapGroupNV_ProcAddress || !DisplayCluster_glXBindSwapBarrierNV_ProcAddress)
+	{
+		UE_LOG(LogDisplayClusterRender, Error, TEXT("Group/Barrier functions not available"));
+		return false;
+	}
+
+	if (!CurrentViewport)
+	{
+		UE_LOG(LogDisplayClusterRender, Warning, TEXT("Viewport RHI hasn't been initialized yet"))
+			return false;
+	}
+
+	FOpenGLViewport* pOglViewport = static_cast<FOpenGLViewport*>(CurrentViewport->GetViewportRHI().GetReference());
+	check(pOglViewport);
+	FPlatformOpenGLContext* const pContext = pOglViewport->GetGLContext();
+	check(pContext && pContext->hWnd);
+
+	SDL_SysWMinfo info;
+	SDL_VERSION(&info.version);
+	if (SDL_GetWindowWMInfo(pContext->hWnd, &info) == false)
+	{
+		UE_LOG(LogDisplayClusterRender, Error, TEXT("Unable to get SDL_SysWMinfo"));
+		return false;
+	}
+
+	GLuint maxGroups = 0;
+	GLuint maxBarriers = 0;
+
+	if (!DisplayCluster_glXQueryMaxSwapGroupsNV_ProcAddress(info.info.x11.display, SDL_GetWindowDisplayIndex(pContext->hWnd), &maxGroups, &maxBarriers))
+	{
+		UE_LOG(LogDisplayClusterRender, Error, TEXT("Couldn't query gr/br limits: %d"), glGetError());
+		return false;
+	}
+
+	UE_LOG(LogDisplayClusterRender, Log, TEXT("max_groups=%d max_barriers=%d"), (int)maxGroups, (int)maxBarriers);
+
+	if (!(maxGroups > 0 && maxBarriers > 0))
+	{
+		UE_LOG(LogDisplayClusterRender, Error, TEXT("There are no available groups or barriers"));
+		return false;
+	}
+
+	if (!DisplayCluster_glXJoinSwapGroupNV_ProcAddress(info.info.x11.display, info.info.x11.window, 1))
+	{
+		UE_LOG(LogDisplayClusterRender, Error, TEXT("Couldn't join swap group: %d"), glGetError());
+		return false;
+	}
+	else
+	{
+		UE_LOG(LogDisplayClusterRender, Log, TEXT("Successfully joined the swap group: 1"));
+	}
+
+	if (!DisplayCluster_glXBindSwapBarrierNV_ProcAddress(info.info.x11.display, 1, 1))
+	{
+		UE_LOG(LogDisplayClusterRender, Error, TEXT("Couldn't bind to swap barrier: %d"), glGetError());
+		return false;
+	}
+	else
+	{
+		UE_LOG(LogDisplayClusterRender, Log, TEXT("Successfully binded to the swap barrier: 1"));
+	}
+
+	return true;
+}
+#endif
diff --git a/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoOpenGL.h b/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoOpenGL.h
new file mode 100644
index 0000000000000000000000000000000000000000..f9c9157403b718c5ead082834ce26f4d01f2f68a
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoOpenGL.h
@@ -0,0 +1,37 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "DisplayClusterDeviceQuadBufferStereoBase.h"
+#include "Render/Devices/DisplayClusterDeviceInternals.h"
+
+
+/**
+ * Frame sequenced active stereo (OpenGL 3 and 4)
+ */
+class FDisplayClusterDeviceQuadBufferStereoOpenGL : public FDisplayClusterDeviceQuadBufferStereoBase
+{
+public:
+	FDisplayClusterDeviceQuadBufferStereoOpenGL();
+	virtual ~FDisplayClusterDeviceQuadBufferStereoOpenGL();
+
+protected:
+	virtual void SetSwapSyncPolicy(EDisplayClusterSwapSyncPolicy policy);
+	virtual bool Present(int32& InOutSyncInterval) override;
+	void SwapBuffers(FOpenGLViewport* pOglViewport, int32& InOutSyncInterval);
+
+private:
+	// Set up swap interval for upcoming buffer swap
+	void UpdateSwapInterval(int32 swapInt) const;
+	// Joins swap groups and binds to a swap barrier
+	bool InitializeNvidiaSwapLock();
+
+	// Implementation of swap policies
+	void internal_SwapBuffersPolicyNone(FOpenGLViewport* pOglViewport);
+	void internal_SwapBuffersPolicySoftSwapSync(FOpenGLViewport* pOglViewport);
+	void internal_SwapBuffersPolicyNvSwapSync(FOpenGLViewport* pOglViewport);
+
+private:
+	// State of nv_swap initialization
+	bool bNvSwapInitialized = false;
+};
diff --git a/Source/DisplayCluster/Private/Render/Devices/SideBySide/DisplayClusterDeviceSideBySide.cpp b/Source/DisplayCluster/Private/Render/Devices/SideBySide/DisplayClusterDeviceSideBySide.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..c751f048850997075dbe8cf3c5bbf1d864ec19e8
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/SideBySide/DisplayClusterDeviceSideBySide.cpp
@@ -0,0 +1,32 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterDeviceSideBySide.h"
+
+
+FDisplayClusterDeviceSideBySide::FDisplayClusterDeviceSideBySide()
+{
+}
+
+FDisplayClusterDeviceSideBySide::~FDisplayClusterDeviceSideBySide()
+{
+}
+
+
+void FDisplayClusterDeviceSideBySide::AdjustViewRect(enum EStereoscopicPass StereoPass, int32& X, int32& Y, uint32& SizeX, uint32& SizeY) const
+{	
+	FDisplayClusterDeviceBase::AdjustViewRect(StereoPass, X, Y, SizeX, SizeY);
+				
+	SizeX /= 2;
+	if (StereoPass == EStereoscopicPass::eSSP_RIGHT_EYE)
+	{
+		X += SizeX;
+	}
+}
+
+bool FDisplayClusterDeviceSideBySide::Present(int32& InOutSyncInterval)
+{
+	// Wait for swap sync
+	WaitForBufferSwapSync(InOutSyncInterval);
+
+	return true;
+}
diff --git a/Source/DisplayCluster/Private/Render/Devices/SideBySide/DisplayClusterDeviceSideBySide.h b/Source/DisplayCluster/Private/Render/Devices/SideBySide/DisplayClusterDeviceSideBySide.h
new file mode 100644
index 0000000000000000000000000000000000000000..cff14d021fc3adeaf5ef057eb5996e45deed38c4
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/SideBySide/DisplayClusterDeviceSideBySide.h
@@ -0,0 +1,26 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Render/Devices/DisplayClusterDeviceBase.h"
+
+
+/**
+ * Side-by-side passive stereoscopic device
+ */
+class FDisplayClusterDeviceSideBySide : public FDisplayClusterDeviceBase
+{
+public:
+	FDisplayClusterDeviceSideBySide();
+	virtual ~FDisplayClusterDeviceSideBySide();
+
+protected:
+	virtual void AdjustViewRect(enum EStereoscopicPass StereoPass, int32& X, int32& Y, uint32& SizeX, uint32& SizeY) const override;
+protected:
+	
+protected:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// FRHICustomPresent
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool Present(int32& InOutSyncInterval) override;	
+};
diff --git a/Source/DisplayCluster/Private/Render/Devices/TopBottom/DisplayClusterDeviceTopBottom.cpp b/Source/DisplayCluster/Private/Render/Devices/TopBottom/DisplayClusterDeviceTopBottom.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..8ee0c5b5e5c364251dc44a926cd81e9c4a8000b6
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/TopBottom/DisplayClusterDeviceTopBottom.cpp
@@ -0,0 +1,31 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterDeviceTopBottom.h"
+
+
+FDisplayClusterDeviceTopBottom::FDisplayClusterDeviceTopBottom()
+{
+}
+
+FDisplayClusterDeviceTopBottom::~FDisplayClusterDeviceTopBottom()
+{
+}
+
+
+void FDisplayClusterDeviceTopBottom::AdjustViewRect(enum EStereoscopicPass StereoPass, int32& X, int32& Y, uint32& SizeX, uint32& SizeY) const
+{
+	SizeY /= 2;
+	if (StereoPass == EStereoscopicPass::eSSP_RIGHT_EYE)
+	{
+		Y = SizeY;
+	}
+}
+
+
+bool FDisplayClusterDeviceTopBottom::Present(int32& InOutSyncInterval)
+{
+	// Wait for swap sync
+	WaitForBufferSwapSync(InOutSyncInterval);
+
+	return true;
+}
diff --git a/Source/DisplayCluster/Private/Render/Devices/TopBottom/DisplayClusterDeviceTopBottom.h b/Source/DisplayCluster/Private/Render/Devices/TopBottom/DisplayClusterDeviceTopBottom.h
new file mode 100644
index 0000000000000000000000000000000000000000..63326e4f7bacd5c216360f711cd57299c833ef6e
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/Devices/TopBottom/DisplayClusterDeviceTopBottom.h
@@ -0,0 +1,25 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Render/Devices/DisplayClusterDeviceBase.h"
+
+
+/**
+ * Top-bottom passive stereoscopic device
+ */
+class FDisplayClusterDeviceTopBottom : public FDisplayClusterDeviceBase
+{
+public:
+	FDisplayClusterDeviceTopBottom();
+	virtual ~FDisplayClusterDeviceTopBottom();
+
+protected:
+	virtual void AdjustViewRect(enum EStereoscopicPass StereoPass, int32& X, int32& Y, uint32& SizeX, uint32& SizeY) const override;
+
+protected:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// FRHICustomPresent
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool Present(int32& InOutSyncInterval) override;
+};
diff --git a/Source/DisplayCluster/Private/Render/DisplayClusterRenderManager.cpp b/Source/DisplayCluster/Private/Render/DisplayClusterRenderManager.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..41e0fbfcae065e2f0c54d257a3a34f3d27d85d7d
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/DisplayClusterRenderManager.cpp
@@ -0,0 +1,286 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "Render/DisplayClusterRenderManager.h"
+#include "Config/IPDisplayClusterConfigManager.h"
+
+#include "Engine/GameViewportClient.h"
+#include "Engine/GameEngine.h"
+#include "Misc/DisplayClusterLog.h"
+#include "DisplayClusterStrings.h"
+#include "DisplayClusterOperationMode.h"
+
+#include "Render/Devices/DisplayClusterNativePresentHandler.h"
+#include "Render/Devices/Debug/DisplayClusterDeviceDebug.h"
+#include "Render/Devices/Monoscopic/DisplayClusterDeviceMonoscopicOpenGL.h"
+#include "Render/Devices/Monoscopic/DisplayClusterDeviceMonoscopicD3D11.h"
+#include "Render/Devices/Monoscopic/DisplayClusterDeviceMonoscopicD3D12.h"
+#include "Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoOpenGL.h"
+#include "Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoD3D11.h"
+#include "Render/Devices/QuadBufferStereo/DisplayClusterDeviceQuadBufferStereoD3D12.h"
+#include "Render/Devices/SideBySide/DisplayClusterDeviceSideBySide.h"
+#include "Render/Devices/TopBottom/DisplayClusterDeviceTopBottom.h"
+
+#include "UnrealClient.h"
+
+
+FDisplayClusterRenderManager::FDisplayClusterRenderManager()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterRender);
+}
+
+FDisplayClusterRenderManager::~FDisplayClusterRenderManager()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterRender);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IPDisplayClusterManager
+//////////////////////////////////////////////////////////////////////////////////////////////
+bool FDisplayClusterRenderManager::Init(EDisplayClusterOperationMode OperationMode)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterRender);
+
+	CurrentOperationMode = OperationMode;
+
+	return true;
+}
+
+void FDisplayClusterRenderManager::Release()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterRender);
+
+	//@note: No need to release our device. It will be released in safe way by TSharedPtr.
+}
+
+bool FDisplayClusterRenderManager::StartSession(const FString& configPath, const FString& nodeId)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterRender);
+
+	ConfigPath = configPath;
+	ClusterNodeId = nodeId;
+
+	if (!GEngine)
+	{
+#if !WITH_EDITOR
+		UE_LOG(LogDisplayClusterRender, Error, TEXT("GEngine variable not set"));
+#endif
+		return false;
+	}
+
+	UE_LOG(LogDisplayClusterRender, Log, TEXT("Instantiating stereo device..."));
+
+	FDisplayClusterDeviceBase* pDev = CreateStereoDevice();
+	if (pDev)
+	{
+		// Store ptr for internal usage
+		Device = static_cast<IDisplayClusterStereoDevice*>(pDev);
+		// Set new device in the engine
+		GEngine->StereoRenderingDevice = TSharedPtr<IStereoRendering, ESPMode::ThreadSafe>(static_cast<IStereoRendering*>(pDev));
+	}
+
+	// When session is starting in Editor the device won't be initialized so we avoid nullptr access here.
+	return (Device ? static_cast<FDisplayClusterDeviceBase*>(Device)->Initialize() : true);
+}
+
+void FDisplayClusterRenderManager::EndSession()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterRender);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// IDisplayClusterRenderManager
+//////////////////////////////////////////////////////////////////////////////////////////////
+IDisplayClusterStereoDevice* FDisplayClusterRenderManager::GetStereoDevice() const
+{
+	return Device;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// FDisplayClusterRenderManager
+//////////////////////////////////////////////////////////////////////////////////////////////
+FDisplayClusterDeviceBase* FDisplayClusterRenderManager::CreateStereoDevice()
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterRender);
+
+	FDisplayClusterDeviceBase* pDevice = nullptr;
+
+	if (CurrentOperationMode == EDisplayClusterOperationMode::Cluster || CurrentOperationMode == EDisplayClusterOperationMode::Standalone)
+	{
+		if (GDynamicRHI == nullptr)
+		{
+			UE_LOG(LogDisplayClusterRender, Error, TEXT("GDynamicRHI is null. Cannot detect RHI name."));
+			return nullptr;
+		}
+
+		// Depending on RHI name we will be using non-RHI-agnostic rendering devices
+		const FString RHIName = GDynamicRHI->GetName();
+		UE_LOG(LogDisplayClusterRender, Log, TEXT("Running %s RHI"), *RHIName);
+
+		// Debug stereo device is RHI agnostic
+		if (FParse::Param(FCommandLine::Get(), DisplayClusterStrings::args::dev::Debug))
+		{
+			UE_LOG(LogDisplayClusterRender, Log, TEXT("Instantiating debug stereo device..."));
+			pDevice = new FDisplayClusterDeviceDebug;
+		}
+		// Side-by-side device is RHI agnostic
+		else if (FParse::Param(FCommandLine::Get(), DisplayClusterStrings::args::dev::SbS))
+		{
+			UE_LOG(LogDisplayClusterRender, Log, TEXT("Instantiating side-by-side stereo device..."));
+			pDevice = new FDisplayClusterDeviceSideBySide;
+		}
+		// Top-bottom device is RHI agnostic
+		else if (FParse::Param(FCommandLine::Get(), DisplayClusterStrings::args::dev::TB))
+		{
+			UE_LOG(LogDisplayClusterRender, Log, TEXT("Instantiating top-bottom stereo device..."));
+			pDevice = new FDisplayClusterDeviceTopBottom;
+		}
+		// Quad buffer stereo
+		else if (FParse::Param(FCommandLine::Get(), DisplayClusterStrings::args::dev::QBS))
+		{
+			if (RHIName.Compare(DisplayClusterStrings::rhi::OpenGL, ESearchCase::IgnoreCase) == 0)
+			{
+				UE_LOG(LogDisplayClusterRender, Log, TEXT("Instantiating OpenGL quad buffer stereo device..."));
+				pDevice = new FDisplayClusterDeviceQuadBufferStereoOpenGL;
+			}
+			else if (RHIName.Compare(DisplayClusterStrings::rhi::D3D11, ESearchCase::IgnoreCase) == 0)
+			{
+				UE_LOG(LogDisplayClusterRender, Log, TEXT("Instantiating D3D11 quad buffer stereo device..."));
+				pDevice = new FDisplayClusterDeviceQuadBufferStereoD3D11;
+			}
+			else if (RHIName.Compare(DisplayClusterStrings::rhi::D3D12, ESearchCase::IgnoreCase) == 0)
+			{
+				UE_LOG(LogDisplayClusterRender, Log, TEXT("Instantiating D3D12 quad buffer stereo device..."));
+				pDevice = new FDisplayClusterDeviceQuadBufferStereoD3D12;
+			}
+		}
+		// Monoscopic
+		else if (FParse::Param(FCommandLine::Get(), DisplayClusterStrings::args::dev::Mono))
+		{
+			if (RHIName.Compare(DisplayClusterStrings::rhi::OpenGL, ESearchCase::IgnoreCase) == 0)
+			{
+				UE_LOG(LogDisplayClusterRender, Log, TEXT("Instantiating OpenGL monoscopic device..."));
+				pDevice = new FDisplayClusterDeviceMonoscopicOpenGL;
+			}
+			else if (RHIName.Compare(DisplayClusterStrings::rhi::D3D11, ESearchCase::IgnoreCase) == 0)
+			{
+				UE_LOG(LogDisplayClusterRender, Log, TEXT("Instantiating DX11 monoscopic device..."));
+				pDevice = new FDisplayClusterDeviceMonoscopicD3D11;
+			}
+			else if (RHIName.Compare(DisplayClusterStrings::rhi::D3D12, ESearchCase::IgnoreCase) == 0)
+			{
+				UE_LOG(LogDisplayClusterRender, Log, TEXT("Instantiating DX12 monoscopic device..."));
+				pDevice = new FDisplayClusterDeviceMonoscopicD3D12;
+			}
+		}
+		// Leave native render but inject custom present for cluster synchronization
+		else
+		{
+			UGameViewportClient::OnViewportCreated().AddRaw(this, &FDisplayClusterRenderManager::OnViewportCreatedHandler);
+		}
+
+		if (pDevice == nullptr)
+		{
+			UE_LOG(LogDisplayClusterRender, Error, TEXT("No stereo device created"));
+		}
+	}
+	else if (CurrentOperationMode == EDisplayClusterOperationMode::Editor)
+	{
+		// No stereo in editor
+		UE_LOG(LogDisplayClusterRender, Warning, TEXT("DisplayCluster stereo devices for editor mode are not allowed currently"));
+	}
+	else if (CurrentOperationMode == EDisplayClusterOperationMode::Disabled)
+	{
+		// Stereo device is not needed
+		UE_LOG(LogDisplayClusterRender, Log, TEXT("No need to instantiate stereo device"));
+	}
+	else
+	{
+		UE_LOG(LogDisplayClusterRender, Warning, TEXT("Unknown operation mode"));
+	}
+
+	return pDevice;
+}
+
+void FDisplayClusterRenderManager::OnViewportCreatedHandler()
+{
+	if (GEngine && GEngine->GameViewport)
+	{
+		if (!GEngine->GameViewport->Viewport->GetViewportRHI().IsValid())
+		{
+			GEngine->GameViewport->OnBeginDraw().AddRaw(this, &FDisplayClusterRenderManager::OnBeginDrawHandler);
+		}
+	}
+}
+
+void FDisplayClusterRenderManager::OnBeginDrawHandler()
+{
+	//@todo: this is fast solution for prototype. We shouldn't use raw handlers to be able to unsubscribe from the event.
+	static bool initialized = false;
+	if (!initialized && GEngine->GameViewport->Viewport->GetViewportRHI().IsValid())
+	{
+		NativePresentHandler  = new FDisplayClusterNativePresentHandler;
+		GEngine->GameViewport->Viewport->GetViewportRHI().GetReference()->SetCustomPresent(NativePresentHandler);
+		initialized = true;
+	}
+}
+
+void FDisplayClusterRenderManager::PreTick(float DeltaSeconds)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterRender);
+
+	// Adjust position and size of game window to match window config.
+	// This needs to happen after UGameEngine::SwitchGameWindowToUseGameViewport
+	// is called. In practice that happens from FEngineLoop::Init after a call
+	// to UGameEngine::Start - therefore this is done in PreTick on the first frame.
+	if (!bWindowAdjusted)
+	{
+		bWindowAdjusted = true;
+
+//#ifdef  DISPLAY_CLUSTER_USE_DEBUG_STANDALONE_CONFIG
+#if 0
+		if (GDisplayCluster->GetPrivateConfigMgr()->IsRunningDebugAuto())
+		{
+			UE_LOG(LogDisplayClusterRender, Log, TEXT("Running in debug auto mode. Adjusting window..."));
+			ResizeWindow(DisplayClusterConstants::misc::DebugAutoWinX, DisplayClusterConstants::misc::DebugAutoWinY, DisplayClusterConstants::misc::DebugAutoResX, DisplayClusterConstants::misc::DebugAutoResY);
+			return;
+		}
+#endif
+
+		if (FParse::Param(FCommandLine::Get(), TEXT("windowed")))
+		{
+			int32 WinX = 0;
+			int32 WinY = 0;
+			int32 ResX = 0;
+			int32 ResY = 0;
+
+			if (FParse::Value(FCommandLine::Get(), TEXT("WinX="), WinX) &&
+				FParse::Value(FCommandLine::Get(), TEXT("WinY="), WinY) &&
+				FParse::Value(FCommandLine::Get(), TEXT("ResX="), ResX) &&
+				FParse::Value(FCommandLine::Get(), TEXT("ResY="), ResY))
+			{
+				ResizeWindow(WinX, WinY, ResX, ResY);
+			}
+			else
+			{
+				UE_LOG(LogDisplayClusterRender, Error, TEXT("Wrong window pos/size arguments"));
+			}
+		}
+	}
+}
+
+void FDisplayClusterRenderManager::ResizeWindow(int32 WinX, int32 WinY, int32 ResX, int32 ResY)
+{
+	DISPLAY_CLUSTER_FUNC_TRACE(LogDisplayClusterRender);
+
+	UGameEngine* engine = Cast<UGameEngine>(GEngine);
+	TSharedPtr<SWindow> window = engine->GameViewportWindow.Pin();
+	check(window.IsValid());
+
+	UE_LOG(LogDisplayClusterRender, Log, TEXT("Adjusting game window: pos [%d, %d],  size [%d x %d]"), WinX, WinY, ResX, ResY);
+
+	// Adjust window position/size
+	window->ReshapeWindow(FVector2D(WinX, WinY), FVector2D(ResX, ResY));
+}
diff --git a/Source/DisplayCluster/Private/Render/DisplayClusterRenderManager.h b/Source/DisplayCluster/Private/Render/DisplayClusterRenderManager.h
new file mode 100644
index 0000000000000000000000000000000000000000..4fdbfb1a88e192769d033bb211b71585c4e44d24
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/DisplayClusterRenderManager.h
@@ -0,0 +1,58 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "IPDisplayClusterRenderManager.h"
+
+class FDisplayClusterDeviceBase;
+class FDisplayClusterNativePresentHandler;
+
+/**
+ * Render manager. Responsible for anything related to a visual part.
+ */
+class FDisplayClusterRenderManager
+	: public IPDisplayClusterRenderManager
+{
+public:
+	FDisplayClusterRenderManager();
+	virtual ~FDisplayClusterRenderManager();
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterManager
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual bool Init(EDisplayClusterOperationMode OperationMode) override;
+	virtual void Release() override;
+	virtual bool StartSession(const FString& configPath, const FString& nodeId) override;
+	virtual void EndSession() override;
+	virtual void PreTick(float DeltaSeconds) override;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterRenderManager
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual IDisplayClusterStereoDevice* GetStereoDevice() const override;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IPDisplayClusterRenderManager
+	//////////////////////////////////////////////////////////////////////////////////////////////
+
+private:
+	FDisplayClusterDeviceBase* CreateStereoDevice();
+	void ResizeWindow(int32 WinX, int32 WinY, int32 ResX, int32 ResY);
+	void OnViewportCreatedHandler();
+	void OnBeginDrawHandler();
+
+private:
+	EDisplayClusterOperationMode CurrentOperationMode;
+	FString ConfigPath;
+	FString ClusterNodeId;
+
+	// Interface pointer to eliminate type casting
+	IDisplayClusterStereoDevice* Device = nullptr;
+	FDisplayClusterNativePresentHandler* NativePresentHandler;
+	bool bWindowAdjusted = false;
+};
+
diff --git a/Source/DisplayCluster/Private/Render/IPDisplayClusterRenderManager.h b/Source/DisplayCluster/Private/Render/IPDisplayClusterRenderManager.h
new file mode 100644
index 0000000000000000000000000000000000000000..6a10bc111bbd8ea0e0196dbca4d0d14b0a900011
--- /dev/null
+++ b/Source/DisplayCluster/Private/Render/IPDisplayClusterRenderManager.h
@@ -0,0 +1,19 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Render/IDisplayClusterRenderManager.h"
+#include "IPDisplayClusterManager.h"
+
+
+/**
+ * Render manager interface
+ */
+struct IPDisplayClusterRenderManager
+	: public IDisplayClusterRenderManager
+	, public IPDisplayClusterManager
+{
+	virtual ~IPDisplayClusterRenderManager()
+	{ }
+
+};
diff --git a/Source/DisplayCluster/Public/Blueprints/DisplayClusterBlueprintLib.h b/Source/DisplayCluster/Public/Blueprints/DisplayClusterBlueprintLib.h
new file mode 100644
index 0000000000000000000000000000000000000000..6209af25f31167769198565fd8970bbc062bfbb9
--- /dev/null
+++ b/Source/DisplayCluster/Public/Blueprints/DisplayClusterBlueprintLib.h
@@ -0,0 +1,24 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "Kismet/BlueprintFunctionLibrary.h"
+#include "Blueprints/IDisplayClusterBlueprintAPI.h"
+#include "DisplayClusterBlueprintLib.generated.h"
+
+
+/**
+ * Blueprint API function library
+ */
+UCLASS()
+class UDisplayClusterBlueprintLib
+	: public UBlueprintFunctionLibrary
+{
+	GENERATED_UCLASS_BODY()
+
+public:
+	/** Return Display Cluster API interface. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get Display Cluster Plugin API"), Category = "DisplayCluster")
+	static void GetAPI(TScriptInterface<IDisplayClusterBlueprintAPI>& OutAPI);
+};
diff --git a/Source/DisplayCluster/Public/Blueprints/IDisplayClusterBlueprintAPI.h b/Source/DisplayCluster/Public/Blueprints/IDisplayClusterBlueprintAPI.h
new file mode 100644
index 0000000000000000000000000000000000000000..9ff25c0bbbc9ba27bbb8125bfe9a620b189c1dc9
--- /dev/null
+++ b/Source/DisplayCluster/Public/Blueprints/IDisplayClusterBlueprintAPI.h
@@ -0,0 +1,236 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "UObject/Interface.h"
+#include "DisplayClusterOperationMode.h"
+#include "IDisplayClusterBlueprintAPI.generated.h"
+
+
+UINTERFACE(meta = (CannotImplementInterfaceInBlueprint))
+class DISPLAYCLUSTER_API UDisplayClusterBlueprintAPI : public UInterface
+{
+	GENERATED_BODY()
+};
+
+
+/**
+ * Blueprint API interface
+ */
+class DISPLAYCLUSTER_API IDisplayClusterBlueprintAPI
+{
+	GENERATED_BODY()
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// DisplayCluster module API
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	/** Return if the module has been initialized. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Is module initialized"), Category = "DisplayCluster")
+	virtual bool IsModuleInitialized() = 0;
+
+	/** Return current operation mode. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get operation mode"), Category = "DisplayCluster")
+	virtual EDisplayClusterOperationMode GetOperationMode() = 0;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// Cluster API
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	/** Return if current node is a master computer in cluster. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Is master node"), Category = "DisplayCluster|Cluster")
+	virtual bool IsMaster() = 0;
+	
+	/** Return if current node is not a master computer in cluster. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Is slave node"), Category = "DisplayCluster|Cluster")
+	virtual bool IsSlave() = 0;
+
+	/** Whether application is in cluster mode or not. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Is cluster mode"), Category = "DisplayCluster|Cluster")
+	virtual bool IsCluster() = 0;
+
+	/** Whether application is in standalone mode or not. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Is standalone mode"), Category = "DisplayCluster|Cluster")
+	virtual bool IsStandalone() = 0;
+
+	/** Returns node name of the current application instance. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get node ID"), Category = "DisplayCluster|Cluster")
+	virtual FString GetNodeId() = 0;
+
+	/** Returns amount of nodes in cluster. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get nodes amount"), Category = "DisplayCluster|Cluster")
+	virtual int32 GetNodesAmount() = 0;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// Config API
+	//////////////////////////////////////////////////////////////////////////////////////////////
+
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// Game API
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// Root
+	/** Returns Cluster Pawn. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get root"), Category = "DisplayCluster|Game")
+	virtual ADisplayClusterPawn* GetRoot() = 0;
+
+	// Screens
+	/** Returns screen reference used for computing frustum output. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get active screen"), Category = "DisplayCluster|Game")
+	virtual UDisplayClusterScreenComponent* GetActiveScreen() = 0;
+
+	/** Returns screen reference by id name. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get screen by ID"), Category = "DisplayCluster|Game")
+	virtual UDisplayClusterScreenComponent* GetScreenById(const FString& id) = 0;
+
+	/** Returns array of all screen references. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get all screens"), Category = "DisplayCluster|Game")
+	virtual TArray<UDisplayClusterScreenComponent*> GetAllScreens() = 0;
+
+	/** Returns amount of screens defined in configuration file. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get amount of screens"), Category = "DisplayCluster|Game")
+	virtual int32 GetScreensAmount() = 0;
+
+	// Cameras
+	/*
+	virtual UDisplayClusterCameraComponent*         GetActiveCamera() const = 0;
+	virtual UDisplayClusterCameraComponent*         GetCameraById(const FString& id) const = 0;
+	virtual TArray<UDisplayClusterCameraComponent*> GetAllCameras() const = 0;
+	virtual int32                        GetCamerasAmount() const = 0;
+	virtual void                         SetActiveCamera(int32 idx) = 0;
+	virtual void                         SetActiveCamera(const FString& id) = 0;
+	*/
+
+	// Nodes
+	/** Returns node reference by its id name. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get node by ID"), Category = "DisplayCluster|Game")
+	virtual UDisplayClusterSceneComponent* GetNodeById(const FString& id) = 0;
+
+	/** Returns array of all nodes references by its id name. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get all nodes"), Category = "DisplayCluster|Game")
+	virtual TArray<UDisplayClusterSceneComponent*> GetAllNodes() = 0;
+
+	// Navigation
+	/** Returns scene component used for default pawn navigation. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get translation direction component"), Category = "DisplayCluster|Game")
+	virtual USceneComponent* GetTranslationDirectionComponent() = 0;
+
+	/** Set scene component to be used for default pawn navigation. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Set translation direction component"), Category = "DisplayCluster|Game")
+	virtual void SetTranslationDirectionComponent(USceneComponent* pComp) = 0;
+
+	/** Set scene component to be used for default pawn navigation by id name. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Set translation direction component by ID"), Category = "DisplayCluster|Game")
+	virtual void SetTranslationDirectionComponentId(const FString& id) = 0;
+
+	/** Return scene component used as a pivot point for rotation of the scene node hierarchy. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get rotate around component"), Category = "DisplayCluster|Game")
+	virtual USceneComponent* GetRotateAroundComponent() = 0;
+
+	/** Set scene component used as a pivot point for rotation of the scene node hierarchy. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Set rotate around component"), Category = "DisplayCluster|Game")
+	virtual void SetRotateAroundComponent(USceneComponent* pComp) = 0;
+
+	/** Set scene component used as a pivot point for rotation of the scene node hierarchy by id name. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Set rotate around component by ID"), Category = "DisplayCluster|Game")
+	virtual void SetRotateAroundComponentId(const FString& id) = 0;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// Input API
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// Device information
+	/** Return amount of VRPN axis devices. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get amount of VRPN axis devices"), Category = "DisplayCluster|Input")
+	virtual int32 GetAxisDeviceAmount() = 0;
+
+	/** Return amount of VRPN button devices. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get amount of VRPN button devices"), Category = "DisplayCluster|Input")
+	virtual int32 GetButtonDeviceAmount() = 0;
+
+	/** Return amount of VRPN tracker devices. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get amount of VRPN tracker devices"), Category = "DisplayCluster|Input")
+	virtual int32 GetTrackerDeviceAmount() = 0;
+
+	/** Return array of names of all VRPN axis devices. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get IDs of VRPN axis devices"), Category = "DisplayCluster|Input")
+	virtual bool GetAxisDeviceIds(TArray<FString>& IDs) = 0;
+
+	/** Return array of names of all VRPN button devices. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get IDs of VRPN button devices"), Category = "DisplayCluster|Input")
+	virtual bool GetButtonDeviceIds(TArray<FString>& IDs) = 0;
+
+	/** Return array of names of all VRPN tracker devices. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get IDs of VRPN tracker devices"), Category = "DisplayCluster|Input")
+	virtual bool GetTrackerDeviceIds(TArray<FString>& IDs) = 0;
+
+	// Buttons
+	/** Return state of VRPN button at specified device and channel. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get VRPN button state"), Category = "DisplayCluster|Input")
+	virtual void GetButtonState(const FString& DeviceId, uint8 DeviceChannel, bool& CurState, bool& IsChannelAvailable) = 0;
+
+	/** Return whether VRPN button is pressed at specified device and channel. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Is VRPN button pressed"), Category = "DisplayCluster|Input")
+	virtual void IsButtonPressed(const FString& DeviceId, uint8 DeviceChannel, bool& CurPressed, bool& IsChannelAvailable) = 0;
+
+	/** Return whether VRPN button is released at specified device and channel. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Is VRPN button released"), Category = "DisplayCluster|Input")
+	virtual void IsButtonReleased(const FString& DeviceId, uint8 DeviceChannel, bool& CurReleased, bool& IsChannelAvailable) = 0;
+
+	/** Return whether VRPN button was released at specified device and channel. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Was VRPN button pressed"), Category = "DisplayCluster|Input")
+	virtual void WasButtonPressed(const FString& DeviceId, uint8 DeviceChannel, bool& WasPressed, bool& IsChannelAvailable) = 0;
+
+	/** Return whether VRPN button was released at specified device and channel. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Was VRPN button released"), Category = "DisplayCluster|Input")
+	virtual void WasButtonReleased(const FString& DeviceId, uint8 DeviceChannel, bool& WasReleased, bool& IsChannelAvailable) = 0;
+
+	// Axes
+	/** Return axis value at specified device and channel. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get VRPN axis value"), Category = "DisplayCluster|Input")
+	virtual void GetAxis(const FString& DeviceId, uint8 DeviceChannel, float& Value, bool& IsAvailable) = 0;
+
+	// Trackers
+	/** Return tracker location values at specified device and channel. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get VRPN tracker location"), Category = "DisplayCluster|Input")
+	virtual void GetTrackerLocation(const FString& DeviceId, uint8 DeviceChannel, FVector& Location, bool& IsChannelAvailable) = 0;
+
+	/** Return tracker quanternion values at specified device and channel. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get VRPN tracker rotation (as quaternion)"), Category = "DisplayCluster|Input")
+	virtual void GetTrackerQuat(const FString& DeviceId, uint8 DeviceChannel, FQuat& Rotation, bool& IsChannelAvailable) = 0;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// Render API
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	/** Set eye interpupillary distance (eye separation) for stereoscopic rendering. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Set interpuppillary distance"), Category = "DisplayCluster|Render")
+	virtual void SetInterpupillaryDistance(float dist) = 0;
+
+	/** Return eye interpupillary distance (eye separation) for stereoscopic rendering. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get interpuppillary distance"), Category = "DisplayCluster|Render")
+	virtual float GetInterpupillaryDistance() = 0;
+
+	/** Swap eye rendering. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Set eye swap"), Category = "DisplayCluster|Render")
+	virtual void SetEyesSwap(bool swap) = 0;
+
+	/** Get Swap eye rendering state. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get eye swap"), Category = "DisplayCluster|Render")
+	virtual bool GetEyesSwap() = 0;
+
+	/** Toggle current eye swap state. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Toggle eye swap"), Category = "DisplayCluster|Render")
+	virtual bool ToggleEyesSwap() = 0;
+
+	/** Return near and far plane clip plane distances. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get near and far clipping distance"), Category = "DisplayCluster|Render")
+	virtual void GetCullingDistance(float& NearClipPlane, float& FarClipPlane) = 0;
+
+	/** Set near and far plane clip plane distances. */
+	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Set near and far clipping distance"), Category = "DisplayCluster|Render")
+	virtual void SetCullingDistance(float NearClipPlane, float FarClipPlane) = 0;
+};
diff --git a/Source/DisplayCluster/Public/Cluster/IDisplayClusterClusterManager.h b/Source/DisplayCluster/Public/Cluster/IDisplayClusterClusterManager.h
new file mode 100644
index 0000000000000000000000000000000000000000..9674d4772314d71c44a0978b925830de1bd681c8
--- /dev/null
+++ b/Source/DisplayCluster/Public/Cluster/IDisplayClusterClusterManager.h
@@ -0,0 +1,22 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+
+
+/**
+ * Public cluster manager interface
+ */
+struct IDisplayClusterClusterManager
+{
+	virtual ~IDisplayClusterClusterManager()
+	{ }
+
+	virtual bool IsMaster()         const = 0;
+	virtual bool IsSlave()          const = 0;
+	virtual bool IsStandalone()     const = 0;
+	virtual bool IsCluster()        const = 0;
+	virtual FString GetNodeId()     const = 0;
+	virtual uint32 GetNodesAmount() const = 0;
+};
diff --git a/Source/DisplayCluster/Public/Cluster/IDisplayClusterClusterSyncObject.h b/Source/DisplayCluster/Public/Cluster/IDisplayClusterClusterSyncObject.h
new file mode 100644
index 0000000000000000000000000000000000000000..8fdfcabbfd836935f9295acbce2dee41eaa72567
--- /dev/null
+++ b/Source/DisplayCluster/Public/Cluster/IDisplayClusterClusterSyncObject.h
@@ -0,0 +1,23 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "IDisplayClusterStringSerializable.h"
+
+
+/**
+ * Synchronizable object interface
+ */
+struct IDisplayClusterClusterSyncObject
+	: public IDisplayClusterStringSerializable
+{
+	virtual ~IDisplayClusterClusterSyncObject()
+	{ }
+
+	// Unique ID of synced object
+	virtual FString GetSyncId() const = 0;
+	// Check if object has changed since last ClearDirty call
+	virtual bool IsDirty() const = 0;
+	// Cleans dirty flag making it 'not changed yet'
+	virtual void ClearDirty() = 0;
+};
diff --git a/Source/DisplayCluster/Public/Config/DisplayClusterConfigTypes.h b/Source/DisplayCluster/Public/Config/DisplayClusterConfigTypes.h
new file mode 100644
index 0000000000000000000000000000000000000000..276cd94b8b45ae02433a0df4c0a714b2bd8dbae6
--- /dev/null
+++ b/Source/DisplayCluster/Public/Config/DisplayClusterConfigTypes.h
@@ -0,0 +1,167 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "IDisplayClusterStringSerializable.h"
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Base interface for config data holders
+//////////////////////////////////////////////////////////////////////////////////////////////
+struct FDisplayClusterConfigBase : public IDisplayClusterStringSerializable
+{
+	virtual ~FDisplayClusterConfigBase()
+	{ }
+
+	// Prints in human readable format
+	virtual FString ToString() const
+	{ return FString("[]"); }
+
+	// Currently no need to serialize the data
+	virtual FString SerializeToString() const override final
+	{ return FString(); }
+
+	// Deserialization from config file
+	virtual bool    DeserializeFromString(const FString& line) override
+	{ return true; }
+};
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Cluster node configuration (separate application)
+//////////////////////////////////////////////////////////////////////////////////////////////
+struct FDisplayClusterConfigClusterNode : public FDisplayClusterConfigBase
+{
+	FString Id;
+	FString Addr;
+	FString ScreenId;
+	FString ViewportId;
+	bool    IsMaster = false;
+	int32   Port_CS = -1;
+	int32   Port_SS = -1;
+	bool    SoundEnabled = false;
+	bool  EyeSwap = false;
+
+	virtual FString ToString() const override;
+	virtual bool    DeserializeFromString(const FString& line) override;
+};
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Viewport configuration
+//////////////////////////////////////////////////////////////////////////////////////////////
+struct FDisplayClusterConfigViewport : public FDisplayClusterConfigBase
+{
+	FString   Id;
+	FIntPoint Loc  = FIntPoint::ZeroValue;
+	FIntPoint Size = FIntPoint::ZeroValue;
+
+	virtual FString ToString() const override;
+	virtual bool    DeserializeFromString(const FString& line) override;
+};
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Scene node configuration (DisplayCluster hierarchy is built from such nodes)
+//////////////////////////////////////////////////////////////////////////////////////////////
+struct FDisplayClusterConfigSceneNode : public FDisplayClusterConfigBase
+{
+	FString  Id;
+	FString  ParentId;
+	FVector  Loc = FVector::ZeroVector;
+	FRotator Rot = FRotator::ZeroRotator;
+	FString  TrackerId;
+	int32    TrackerCh = -1;
+
+	virtual FString ToString() const override;
+	virtual bool    DeserializeFromString(const FString& line) override;
+};
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Projection screen configuration (used for asymmetric frustum calculation)
+//////////////////////////////////////////////////////////////////////////////////////////////
+struct FDisplayClusterConfigScreen : public FDisplayClusterConfigSceneNode
+{
+	FVector2D Size = FVector2D::ZeroVector;
+
+	virtual FString ToString() const override;
+	virtual bool    DeserializeFromString(const FString& line) override;
+};
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Camera configuration (DisplayCluster camera)
+//////////////////////////////////////////////////////////////////////////////////////////////
+struct FDisplayClusterConfigCamera : public FDisplayClusterConfigSceneNode
+{
+
+	virtual FString ToString() const override;
+	virtual bool    DeserializeFromString(const FString& line) override;
+};
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Input device configuration (VRPN and other possible devices)
+//////////////////////////////////////////////////////////////////////////////////////////////
+struct FDisplayClusterConfigInput : public FDisplayClusterConfigBase
+{
+	FString Id;
+	FString Type;
+	FString Params;
+	TMap<int32, int32> ChMap;
+
+	virtual FString ToString() const override;
+	virtual bool    DeserializeFromString(const FString& line) override;
+};
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// General DisplayCluster configuration
+//////////////////////////////////////////////////////////////////////////////////////////////
+struct FDisplayClusterConfigGeneral : public FDisplayClusterConfigBase
+{
+	int32 SwapSyncPolicy = 0;
+
+	virtual FString ToString() const override;
+	virtual bool    DeserializeFromString(const FString& line) override;
+};
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Render configuration
+//////////////////////////////////////////////////////////////////////////////////////////////
+struct FDisplayClusterConfigRender : public FDisplayClusterConfigBase
+{
+
+	virtual FString ToString() const override;
+	virtual bool    DeserializeFromString(const FString& line) override;
+};
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Stereo configuration
+//////////////////////////////////////////////////////////////////////////////////////////////
+struct FDisplayClusterConfigStereo : public FDisplayClusterConfigBase
+{
+	float EyeDist = 0.064f;
+
+	virtual FString ToString() const override;
+	virtual bool    DeserializeFromString(const FString& line) override;
+};
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Debug settings
+//////////////////////////////////////////////////////////////////////////////////////////////
+struct FDisplayClusterConfigDebug : public FDisplayClusterConfigBase
+{
+	bool  DrawStats = false;
+	bool  LagSimulateEnabled = false;
+	float LagMaxTime = 0.5f; // seconds
+
+	virtual FString ToString() const override;
+	virtual bool    DeserializeFromString(const FString& line) override;
+};
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Custom development settings
+//////////////////////////////////////////////////////////////////////////////////////////////
+struct FDisplayClusterConfigCustom : public FDisplayClusterConfigBase
+{
+	TMap<FString, FString> Args;
+
+	virtual FString ToString() const override;
+	virtual bool    DeserializeFromString(const FString& line) override;
+};
diff --git a/Source/DisplayCluster/Public/Config/IDisplayClusterConfigManager.h b/Source/DisplayCluster/Public/Config/IDisplayClusterConfigManager.h
new file mode 100644
index 0000000000000000000000000000000000000000..2a9ede57624a97d86041dbe1e955ded2958969ce
--- /dev/null
+++ b/Source/DisplayCluster/Public/Config/IDisplayClusterConfigManager.h
@@ -0,0 +1,55 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "DisplayClusterConfigTypes.h"
+
+
+/**
+ * Public config manager interface
+ */
+struct IDisplayClusterConfigManager
+{
+	virtual ~IDisplayClusterConfigManager()
+	{ }
+
+	virtual int32 GetClusterNodesAmount() const = 0;
+	virtual TArray<FDisplayClusterConfigClusterNode> GetClusterNodes() const = 0;
+	virtual bool GetClusterNode(int32 idx, FDisplayClusterConfigClusterNode& cnode) const = 0;
+	virtual bool GetClusterNode(const FString& id, FDisplayClusterConfigClusterNode& cnode) const = 0;
+	virtual bool GetMasterClusterNode(FDisplayClusterConfigClusterNode& cnode) const = 0;
+	virtual bool GetLocalClusterNode(FDisplayClusterConfigClusterNode& cnode) const = 0;
+
+	virtual int32 GetScreensAmount() const = 0;
+	virtual TArray<FDisplayClusterConfigScreen> GetScreens() const = 0;
+	virtual bool GetScreen(int32 idx, FDisplayClusterConfigScreen& screen) const = 0;
+	virtual bool GetScreen(const FString& id, FDisplayClusterConfigScreen& screen) const = 0;
+	virtual bool GetLocalScreen(FDisplayClusterConfigScreen& screen) const = 0;
+
+	virtual int32 GetCamerasAmount() const = 0;
+	virtual TArray<FDisplayClusterConfigCamera> GetCameras() const = 0;
+	virtual bool GetCamera(int32 idx, FDisplayClusterConfigCamera& camera) const = 0;
+	virtual bool GetCamera(const FString& id, FDisplayClusterConfigCamera& camera) const = 0;
+
+	virtual int32 GetViewportsAmount() const = 0;
+	virtual TArray<FDisplayClusterConfigViewport> GetViewports() const = 0;
+	virtual bool GetViewport(int32 idx, FDisplayClusterConfigViewport& viewport) const = 0;
+	virtual bool GetViewport(const FString& id, FDisplayClusterConfigViewport& viewport) const = 0;
+	virtual bool GetLocalViewport(FDisplayClusterConfigViewport& screen) const = 0;
+
+	virtual int32 GetSceneNodesAmount() const = 0;
+	virtual TArray<FDisplayClusterConfigSceneNode> GetSceneNodes() const = 0;
+	virtual bool GetSceneNode(int32 idx, FDisplayClusterConfigSceneNode& snode) const = 0;
+	virtual bool GetSceneNode(const FString& id, FDisplayClusterConfigSceneNode& snode) const = 0;
+
+	virtual int32 GetInputDevicesAmount() const = 0;
+	virtual TArray<FDisplayClusterConfigInput> GetInputDevices() const = 0;
+	virtual bool GetInputDevice(int32 idx, FDisplayClusterConfigInput& input) const = 0;
+	virtual bool GetInputDevice(const FString& id, FDisplayClusterConfigInput& input) const = 0;
+
+	virtual FDisplayClusterConfigGeneral GetConfigGeneral() const = 0;
+	virtual FDisplayClusterConfigStereo  GetConfigStereo()  const = 0;
+	virtual FDisplayClusterConfigRender  GetConfigRender()  const = 0;
+	virtual FDisplayClusterConfigDebug   GetConfigDebug()   const = 0;
+	virtual FDisplayClusterConfigCustom  GetConfigCustom()  const = 0;
+};
diff --git a/Source/DisplayCluster/Public/DisplayClusterCameraComponent.h b/Source/DisplayCluster/Public/DisplayClusterCameraComponent.h
new file mode 100644
index 0000000000000000000000000000000000000000..5c200889ec1f1758dcbd381ff1bc82fc97b01ad4
--- /dev/null
+++ b/Source/DisplayCluster/Public/DisplayClusterCameraComponent.h
@@ -0,0 +1,28 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "DisplayClusterSceneComponent.h"
+#include "DisplayClusterCameraComponent.generated.h"
+
+
+/**
+ * Camera component
+ */
+UCLASS( ClassGroup=(Custom) )
+class DISPLAYCLUSTER_API UDisplayClusterCameraComponent
+	: public UDisplayClusterSceneComponent
+{
+	GENERATED_BODY()
+
+public:
+	UDisplayClusterCameraComponent(const FObjectInitializer& ObjectInitializer);
+
+public:
+	virtual void SetSettings(const FDisplayClusterConfigSceneNode* pConfig) override;
+	virtual bool ApplySettings() override;
+
+public:
+	virtual void BeginPlay() override;
+	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
+};
diff --git a/Source/DisplayCluster/Public/DisplayClusterGameEngine.h b/Source/DisplayCluster/Public/DisplayClusterGameEngine.h
new file mode 100644
index 0000000000000000000000000000000000000000..2dfbdbd7f3d508d7f5cbbca70d01093c7ed26705
--- /dev/null
+++ b/Source/DisplayCluster/Public/DisplayClusterGameEngine.h
@@ -0,0 +1,44 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Engine/GameEngine.h"
+
+#include "Config/DisplayClusterConfigTypes.h"
+#include "DisplayClusterOperationMode.h"
+
+#include "DisplayClusterGameEngine.generated.h"
+
+
+struct IPDisplayClusterClusterManager;
+struct IPDisplayClusterNodeController;
+struct IPDisplayClusterInputManager;
+
+
+/**
+ * Extended game engine
+ */
+UCLASS()
+class DISPLAYCLUSTER_API UDisplayClusterGameEngine
+	: public UGameEngine
+{
+	GENERATED_BODY()
+	
+public:
+	virtual void Init(class IEngineLoop* InEngineLoop) override;
+	virtual void PreExit() override;
+	virtual void Tick(float DeltaSeconds, bool bIdleMode) override;
+	virtual bool LoadMap(FWorldContext& WorldContext, FURL URL, class UPendingNetGame* Pending, FString& Error) override;
+
+protected:
+	virtual bool InitializeInternals();
+	EDisplayClusterOperationMode DetectOperationMode();
+
+private:
+	IPDisplayClusterClusterManager* ClusterMgr = nullptr;
+	IPDisplayClusterNodeController* NodeController = nullptr;
+	IPDisplayClusterInputManager*   InputMgr = nullptr;
+
+	FDisplayClusterConfigDebug CfgDebug;
+	EDisplayClusterOperationMode OperationMode = EDisplayClusterOperationMode::Disabled;
+};
diff --git a/Source/DisplayCluster/Public/DisplayClusterGameMode.h b/Source/DisplayCluster/Public/DisplayClusterGameMode.h
new file mode 100644
index 0000000000000000000000000000000000000000..a26d37f21e773b31a3a8588e2c8a7325c3401e96
--- /dev/null
+++ b/Source/DisplayCluster/Public/DisplayClusterGameMode.h
@@ -0,0 +1,55 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#if WITH_EDITOR
+#include "Editor.h"
+#endif
+
+#include "GameFramework/GameMode.h"
+#include "DisplayClusterGameMode.generated.h"
+
+
+struct IPDisplayCluster;
+
+/**
+ * Extended game mode
+ */
+UCLASS()
+class DISPLAYCLUSTER_API ADisplayClusterGameMode
+	: public AGameMode
+{
+	GENERATED_BODY()
+	
+public:
+	ADisplayClusterGameMode();
+	virtual ~ADisplayClusterGameMode();
+
+public:
+	UFUNCTION(BlueprintCallable, Category = "DisplayCluster")
+	bool IsDisplayClusterActive() const
+	{ return bIsDisplayClusterActive; }
+
+public:
+	virtual void InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage) override;
+	virtual void StartPlay() override;
+	virtual void Tick(float DeltaSeconds) override;
+	virtual void BeginPlay() override;
+	virtual void BeginDestroy() override;
+
+protected:
+	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "DisplayCluster")
+	bool bIsDisplayClusterActive = true;
+
+protected:
+	bool bGameStarted = false;
+
+#if WITH_EDITOR
+protected:
+	static bool bNeedSessionStart;
+	static bool bSessionStarted;
+
+	FDelegateHandle EndPIEDelegate;
+	void OnEndPIE(const bool bSimulate);
+#endif
+};
diff --git a/Source/DisplayCluster/Public/DisplayClusterGameModeDefault.h b/Source/DisplayCluster/Public/DisplayClusterGameModeDefault.h
new file mode 100644
index 0000000000000000000000000000000000000000..b515c1e109bbee88aa5fc5c12601d3e4bcc78c08
--- /dev/null
+++ b/Source/DisplayCluster/Public/DisplayClusterGameModeDefault.h
@@ -0,0 +1,21 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "DisplayClusterGameMode.h"
+#include "DisplayClusterGameModeDefault.generated.h"
+
+
+/**
+ * Extended game mode with some implemented features (navigation)
+ */
+UCLASS()
+class DISPLAYCLUSTER_API ADisplayClusterGameModeDefault
+	: public ADisplayClusterGameMode
+{
+	GENERATED_BODY()
+	
+public:
+	ADisplayClusterGameModeDefault();
+	virtual ~ADisplayClusterGameModeDefault();
+};
diff --git a/Source/DisplayCluster/Public/DisplayClusterHUD.h b/Source/DisplayCluster/Public/DisplayClusterHUD.h
new file mode 100644
index 0000000000000000000000000000000000000000..2dd4406dcf5a24fbbfbd719ba97bdd9c82db62cb
--- /dev/null
+++ b/Source/DisplayCluster/Public/DisplayClusterHUD.h
@@ -0,0 +1,27 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "GameFramework/HUD.h"
+#include "DisplayClusterHUD.generated.h"
+
+
+/**
+ * Extended HUD
+ */
+UCLASS()
+class DISPLAYCLUSTER_API ADisplayClusterHUD
+	: public AHUD
+{
+	GENERATED_BODY()
+
+public:
+	ADisplayClusterHUD(const FObjectInitializer& ObjectInitializer);
+
+public:
+	virtual void BeginPlay() override;
+
+	/** Primary draw call for the HUD */
+	virtual void DrawHUD() override;
+};
+
diff --git a/Source/DisplayCluster/Public/DisplayClusterOperationMode.h b/Source/DisplayCluster/Public/DisplayClusterOperationMode.h
new file mode 100644
index 0000000000000000000000000000000000000000..52918a33a69e0a8845c00a885af40a3e3036ed45
--- /dev/null
+++ b/Source/DisplayCluster/Public/DisplayClusterOperationMode.h
@@ -0,0 +1,18 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "DisplayClusterOperationMode.generated.h"
+
+/**
+ * Display cluster operation mode
+ */
+UENUM(BlueprintType)
+enum class EDisplayClusterOperationMode : uint8
+{
+	Cluster,
+	Standalone,
+	Editor,
+	Disabled
+};
diff --git a/Source/DisplayCluster/Public/DisplayClusterPawn.h b/Source/DisplayCluster/Public/DisplayClusterPawn.h
new file mode 100644
index 0000000000000000000000000000000000000000..614a0d12670cb5655005c0a84ea938da0d88860f
--- /dev/null
+++ b/Source/DisplayCluster/Public/DisplayClusterPawn.h
@@ -0,0 +1,77 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "GameFramework/Pawn.h"
+#include "DisplayClusterPawn.generated.h"
+
+
+class UCameraComponent;
+class USphereComponent;
+class UDisplayClusterSceneComponent;
+class UDisplayClusterSceneComponentSyncParent;
+
+struct IPDisplayClusterGameManager;
+
+
+/**
+ * VR root. This pawn represents VR hierarchy in the game.
+ */
+UCLASS()
+class DISPLAYCLUSTER_API ADisplayClusterPawn
+	: public APawn
+{
+	GENERATED_UCLASS_BODY()
+
+public:
+	inline USphereComponent* GetCollisionComponent() const
+	{ return CollisionComponent; }
+
+	inline UDisplayClusterSceneComponent* GetCollisionOffsetComponent() const
+	{ return CollisionOffsetComponent; }
+
+	inline UCameraComponent* GetCameraComponent() const
+	{ return CameraComponent; }
+
+public:
+	/** Scene component. Specifies translation (DisplayCluster hierarchy navigation) direction. */
+	UPROPERTY(EditAnywhere, Category = "DisplayCluster")
+	USceneComponent* TranslationDirection;
+
+	/** Scene component. Specifies rotation center (DisplayCluster hierarchy rotation). */
+	UPROPERTY(EditAnywhere, Category = "DisplayCluster")
+	USceneComponent* RotationAround;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// APawn
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void BeginPlay() override;
+	virtual void BeginDestroy() override;
+	virtual void Tick(float DeltaSeconds) override;
+
+protected:
+	/** Camera component */
+	UPROPERTY(VisibleAnywhere, Category = "DisplayCluster")
+	UCameraComponent* CameraComponent;
+
+	/** Collision component */
+	UPROPERTY(Category = Pawn, VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
+	USphereComponent* CollisionComponent;
+
+	/** Used as 'second' root for any childs (whole hierarchy offset) */
+	UPROPERTY(Category = Pawn, VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
+	UDisplayClusterSceneComponent* CollisionOffsetComponent;
+
+private:
+	UPROPERTY()
+	UDisplayClusterSceneComponentSyncParent* DisplayClusterSyncRoot;
+	
+	UPROPERTY()
+	UDisplayClusterSceneComponentSyncParent* DisplayClusterSyncCollisionOffset;
+
+	IPDisplayClusterGameManager* GameMgr = nullptr;
+
+	bool bIsCluster;
+};
diff --git a/Source/DisplayCluster/Public/DisplayClusterPawnDefault.h b/Source/DisplayCluster/Public/DisplayClusterPawnDefault.h
new file mode 100644
index 0000000000000000000000000000000000000000..a47563f2008d498d2144bb0bd9de4961b021e2c5
--- /dev/null
+++ b/Source/DisplayCluster/Public/DisplayClusterPawnDefault.h
@@ -0,0 +1,105 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "DisplayClusterPawn.h"
+
+#include "GameFramework/FloatingPawnMovement.h"
+#include "GameFramework/RotatingMovementComponent.h"
+
+#include "DisplayClusterPawnDefault.generated.h"
+
+
+/**
+ * Extended VR root. Implements some basic features.
+ */
+UCLASS()
+class DISPLAYCLUSTER_API ADisplayClusterPawnDefault
+	: public ADisplayClusterPawn
+{
+	GENERATED_UCLASS_BODY()
+
+public:
+
+	/** Base turn rate, in deg/sec. Other scaling may affect final turn rate. */
+	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pawn")
+	float BaseTurnRate;
+
+	/** Base lookup rate, in deg/sec. Other scaling may affect final lookup rate. */
+	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pawn")
+	float BaseLookUpRate;
+
+public:
+	virtual UPawnMovementComponent* GetMovementComponent() const override
+	{ return MovementComponent; }
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// APawn
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual void BeginPlay() override;
+	virtual void BeginDestroy() override;
+	virtual void Tick(float DeltaSeconds) override;
+
+public:
+	/**
+	* Input callback to move forward in local space (or backward if Val is negative).
+	* @param Val Amount of movement in the forward direction (or backward if negative).
+	* @see APawn::AddMovementInput()
+	*/
+	UFUNCTION(BlueprintCallable, Category = "Pawn")
+	void MoveForward(float Val);
+
+	/**
+	* Input callback to strafe right in local space (or left if Val is negative).
+	* @param Val Amount of movement in the right direction (or left if negative).
+	* @see APawn::AddMovementInput()
+	*/
+	UFUNCTION(BlueprintCallable, Category = "Pawn")
+	void MoveRight(float Val);
+
+	/**
+	* Input callback to move up in world space (or down if Val is negative).
+	* @param Val Amount of movement in the world up direction (or down if negative).
+	* @see APawn::AddMovementInput()
+	*/
+	UFUNCTION(BlueprintCallable, Category = "Pawn")
+	void MoveUp(float Val);
+
+	/**
+	* Called via input to turn at a given rate.
+	* @param Rate	This is a normalized rate, i.e. 1.0 means 100% of desired turn rate
+	*/
+	UFUNCTION(BlueprintCallable, Category = "Pawn")
+	void TurnAtRate(float Rate);
+
+	UFUNCTION(BlueprintCallable, Category = "Pawn")
+	void TurnAtRate2(float Rate);
+
+	/**
+	* Called via input to look up at a given rate (or down if Rate is negative).
+	* @param Rate	This is a normalized rate, i.e. 1.0 means 100% of desired turn rate
+	*/
+	UFUNCTION(BlueprintCallable, Category = "Pawn")
+	void LookUpAtRate(float Rate);
+
+protected:
+	virtual void SetupPlayerInputComponent(UInputComponent* InInputComponent) override;
+
+protected:
+	/** Movement component */
+	UPROPERTY(Category = Pawn, VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
+	UFloatingPawnMovement* MovementComponent;
+
+	/** Rotating movement */
+	UPROPERTY(Category = Pawn, VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
+	URotatingMovementComponent* RotatingComponent;
+
+	UPROPERTY(Category = Pawn, VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
+	URotatingMovementComponent * RotatingComponent2;
+
+private:
+	IPDisplayClusterGameManager* GameMgr = nullptr;
+
+	bool bIsCluster = false;
+};
diff --git a/Source/DisplayCluster/Public/DisplayClusterPlayerController.h b/Source/DisplayCluster/Public/DisplayClusterPlayerController.h
new file mode 100644
index 0000000000000000000000000000000000000000..fd92a089d56f9a6a07e8bd089a85c7bb5dbb1b9b
--- /dev/null
+++ b/Source/DisplayCluster/Public/DisplayClusterPlayerController.h
@@ -0,0 +1,21 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "GameFramework/PlayerController.h"
+#include "DisplayClusterPlayerController.generated.h"
+
+/**
+ * Extended player controller
+ */
+UCLASS()
+class DISPLAYCLUSTER_API ADisplayClusterPlayerController
+	: public APlayerController
+{
+	GENERATED_BODY()
+
+public:
+	virtual void BeginPlay() override;
+	virtual void PlayerTick(float DeltaTime) override;
+};
+
diff --git a/Source/DisplayCluster/Public/DisplayClusterSceneComponent.h b/Source/DisplayCluster/Public/DisplayClusterSceneComponent.h
new file mode 100644
index 0000000000000000000000000000000000000000..6976fdbcb422beceb761d066da89ed6c14579582
--- /dev/null
+++ b/Source/DisplayCluster/Public/DisplayClusterSceneComponent.h
@@ -0,0 +1,43 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Components/SceneComponent.h"
+#include "Config/DisplayClusterConfigTypes.h"
+
+#include "DisplayClusterSceneComponent.generated.h"
+
+
+class UDisplayClusterSceneComponentSync;
+
+
+/**
+ * Extended scene component
+ */
+UCLASS( ClassGroup=(Custom) )
+class DISPLAYCLUSTER_API UDisplayClusterSceneComponent
+	: public USceneComponent
+{
+	GENERATED_BODY()
+
+public:
+	UDisplayClusterSceneComponent(const FObjectInitializer& ObjectInitializer);
+
+public:
+	virtual void SetSettings(const FDisplayClusterConfigSceneNode* pConfig);
+	virtual bool ApplySettings();
+
+	inline FString GetId() const
+	{ return Config.Id; }
+
+	inline FString GetParentId() const
+	{ return Config.ParentId; }
+
+public:
+	virtual void BeginPlay() override;
+	virtual void BeginDestroy() override;
+	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
+
+private:
+	FDisplayClusterConfigSceneNode Config;
+};
diff --git a/Source/DisplayCluster/Public/DisplayClusterSceneComponentSync.h b/Source/DisplayCluster/Public/DisplayClusterSceneComponentSync.h
new file mode 100644
index 0000000000000000000000000000000000000000..23bc255336334eb5c4ec97f1a4e4e578ef746cea
--- /dev/null
+++ b/Source/DisplayCluster/Public/DisplayClusterSceneComponentSync.h
@@ -0,0 +1,72 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Components/SceneComponent.h"
+#include "Cluster/IDisplayClusterClusterSyncObject.h"
+#include "DisplayClusterSceneComponentSync.generated.h"
+
+struct IPDisplayClusterGameManager;
+struct IPDisplayClusterClusterManager;
+
+
+/**
+ * Abstract synchronization component
+ */
+UCLASS(Abstract)
+class DISPLAYCLUSTER_API UDisplayClusterSceneComponentSync
+	: public USceneComponent
+	, public IDisplayClusterClusterSyncObject
+{
+	GENERATED_BODY()
+
+public:
+	UDisplayClusterSceneComponentSync(const FObjectInitializer& ObjectInitializer);
+	
+	virtual ~UDisplayClusterSceneComponentSync()
+	{ }
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterClusterSyncObject
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual FString GetSyncId() const override;
+	
+	virtual bool IsDirty() const override
+	{ return true; }
+
+	virtual void ClearDirty() override
+	{ }
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterStringSerializable
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual FString SerializeToString() const override final;
+	virtual bool    DeserializeFromString(const FString& data) override final;
+
+public:
+	virtual void BeginPlay() override;
+	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
+	virtual void DestroyComponent(bool bPromoteChildren) override;
+
+protected:
+	virtual FTransform GetSyncTransform() const
+	{ return FTransform(); }
+
+	virtual void SetSyncTransform(const FTransform& t)
+	{ }
+
+protected:
+	IPDisplayClusterGameManager*    GameMgr = nullptr;
+	IPDisplayClusterClusterManager* ClusterMgr = nullptr;
+
+protected:
+	// Caching state
+	FVector  LastSyncLoc;
+	FRotator LastSyncRot;
+	FVector  LastSyncScale;
+
+private:
+	FString SyncId;
+};
diff --git a/Source/DisplayCluster/Public/DisplayClusterSceneComponentSyncParent.h b/Source/DisplayCluster/Public/DisplayClusterSceneComponentSyncParent.h
new file mode 100644
index 0000000000000000000000000000000000000000..8005ee0528121090b628488f65b7378a39b355ef
--- /dev/null
+++ b/Source/DisplayCluster/Public/DisplayClusterSceneComponentSyncParent.h
@@ -0,0 +1,40 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "DisplayClusterSceneComponentSync.h"
+#include "DisplayClusterSceneComponentSyncParent.generated.h"
+
+
+/**
+ * Synchronization component. Synchronizes parent scene component.
+ */
+UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
+class DISPLAYCLUSTER_API UDisplayClusterSceneComponentSyncParent
+	: public UDisplayClusterSceneComponentSync
+{
+	GENERATED_BODY()
+
+public:
+	UDisplayClusterSceneComponentSyncParent(const FObjectInitializer& ObjectInitializer);
+
+public:
+	virtual void BeginPlay() override;
+	virtual void TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction ) override;
+	virtual void DestroyComponent(bool bPromoteChildren) override;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterClusterSyncObject
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual FString GetSyncId() const override;
+	virtual bool IsDirty() const override;
+	virtual void ClearDirty() override;
+
+protected:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// UDisplayClusterSceneComponentSync
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual FTransform GetSyncTransform() const override;
+	virtual void SetSyncTransform(const FTransform& t) override;
+};
diff --git a/Source/DisplayCluster/Public/DisplayClusterSceneComponentSyncThis.h b/Source/DisplayCluster/Public/DisplayClusterSceneComponentSyncThis.h
new file mode 100644
index 0000000000000000000000000000000000000000..1a7ea7b48da20af5be06621ed84923aefe70d5bb
--- /dev/null
+++ b/Source/DisplayCluster/Public/DisplayClusterSceneComponentSyncThis.h
@@ -0,0 +1,40 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "DisplayClusterSceneComponentSync.h"
+#include "DisplayClusterSceneComponentSyncThis.generated.h"
+
+
+/**
+ * Synchronization component. Synchronizes himself
+ */
+UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
+class DISPLAYCLUSTER_API UDisplayClusterSceneComponentSyncThis
+	: public UDisplayClusterSceneComponentSync
+{
+	GENERATED_BODY()
+
+public:
+	UDisplayClusterSceneComponentSyncThis(const FObjectInitializer& ObjectInitializer);
+
+public:
+	virtual void BeginPlay() override;
+	virtual void TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction ) override;
+	virtual void DestroyComponent(bool bPromoteChildren) override;
+
+public:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// IDisplayClusterClusterSyncObject
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual FString GetSyncId() const override;
+	virtual bool IsDirty() const override;
+	virtual void ClearDirty() override;
+
+protected:
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	// UDisplayClusterSceneComponentSync
+	//////////////////////////////////////////////////////////////////////////////////////////////
+	virtual FTransform GetSyncTransform() const override;
+	virtual void SetSyncTransform(const FTransform& t) override;
+};
diff --git a/Source/DisplayCluster/Public/DisplayClusterScreenComponent.h b/Source/DisplayCluster/Public/DisplayClusterScreenComponent.h
new file mode 100644
index 0000000000000000000000000000000000000000..8efd308afa2404a39587cfbca0e631d94ff6de26
--- /dev/null
+++ b/Source/DisplayCluster/Public/DisplayClusterScreenComponent.h
@@ -0,0 +1,38 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "DisplayClusterSceneComponent.h"
+#include "DisplayClusterScreenComponent.generated.h"
+
+
+/**
+ * Projection screen component
+ */
+UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
+class DISPLAYCLUSTER_API UDisplayClusterScreenComponent
+	: public UDisplayClusterSceneComponent
+{
+	GENERATED_BODY()
+
+public:
+	UDisplayClusterScreenComponent(const FObjectInitializer& ObjectInitializer);
+
+public:
+	virtual void SetSettings(const FDisplayClusterConfigSceneNode* pConfig) override;
+	virtual bool ApplySettings() override;
+
+	inline FVector2D GetScreenSize() const
+	{ return Size; }
+
+public:
+	virtual void BeginPlay() override;
+	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
+
+private:
+	FVector2D Size;
+
+	UPROPERTY(VisibleAnywhere, Category = Mesh)
+	UStaticMeshComponent* ScreenGeometryComponent = nullptr;
+};
diff --git a/Source/DisplayCluster/Public/DisplayClusterSettings.h b/Source/DisplayCluster/Public/DisplayClusterSettings.h
new file mode 100644
index 0000000000000000000000000000000000000000..fa37c4395d8ff834a8dc1efa9f80a2c63ba5a6a2
--- /dev/null
+++ b/Source/DisplayCluster/Public/DisplayClusterSettings.h
@@ -0,0 +1,51 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+
+#pragma once
+
+#include "GameFramework/Actor.h"
+#include "DisplayClusterSettings.generated.h"
+
+
+/**
+ * Per-level custom settings
+ */
+UCLASS()
+class DISPLAYCLUSTER_API ADisplayClusterSettings
+	: public AActor
+{
+	GENERATED_BODY()
+	
+public:
+	// Sets default values for this actor's properties
+	ADisplayClusterSettings(const FObjectInitializer& ObjectInitializer);
+	virtual ~ADisplayClusterSettings();
+
+public:
+	UPROPERTY(EditAnywhere, Category = "DisplayCluster (Editor only)", meta = (DisplayName = "Config file"))
+	FString EditorConfigPath;
+
+	UPROPERTY(EditAnywhere, Category = "DisplayCluster (Editor only)", meta = (DisplayName = "Node ID"))
+	FString EditorNodeId;
+
+	UPROPERTY(EditAnywhere, Category = "DisplayCluster (Editor only)", meta = (DisplayName = "Show projection screens"))
+	bool bEditorShowProjectionScreens;
+
+	UPROPERTY(EditAnywhere, Category = "DisplayCluster|Pawn", meta = (DisplayName = "Enable DisplayCluster collisions"))
+	bool bEnableCollisions;
+
+	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "DisplayCluster|Pawn|Control|Movement", meta = (DisplayName = "Max speed", ClampMin = "0.0", ClampMax = "1000000.0", UIMin = "0.0", UIMax = "1000000.0"))
+	float MovementMaxSpeed;
+
+	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "DisplayCluster|Pawn|Control|Movement", meta = (DisplayName = "Acceleration", ClampMin = "0.0", ClampMax = "1000000.0", UIMin = "0.0", UIMax = "1000000.0"))
+	float MovementAcceleration;
+
+	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "DisplayCluster|Pawn|Control|Movement", meta = (DisplayName = "Deceleration", ClampMin = "0.0", ClampMax = "1000000.0", UIMin = "0.0", UIMax = "1000000.0"))
+	float MovementDeceleration;
+
+	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "DisplayCluster|Pawn|Control|Movement", meta = (DisplayName = "Turning boost", ClampMin = "0.0", ClampMax = "1000000.0", UIMin = "0.0", UIMax = "1000000.0"))
+	float MovementTurningBoost;
+
+	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "DisplayCluster|Pawn|Control|Rotation", meta = (DisplayName = "Speed", ClampMin = "0.0", ClampMax = "360.0", UIMin = "0.0", UIMax = "360.0"))
+	float RotationSpeed;
+};
diff --git a/Source/DisplayCluster/Public/Game/IDisplayClusterGameManager.h b/Source/DisplayCluster/Public/Game/IDisplayClusterGameManager.h
new file mode 100644
index 0000000000000000000000000000000000000000..f802928c2c97c0d8020d110e3fe7a0f01bccdf14
--- /dev/null
+++ b/Source/DisplayCluster/Public/Game/IDisplayClusterGameManager.h
@@ -0,0 +1,42 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "DisplayClusterCameraComponent.h"
+#include "DisplayClusterScreenComponent.h"
+#include "DisplayClusterPawn.h"
+
+
+/**
+ * Public game manager interface
+ */
+struct IDisplayClusterGameManager
+{
+	virtual ~IDisplayClusterGameManager()
+	{ }
+
+	virtual ADisplayClusterPawn*                    GetRoot() const = 0;
+
+	virtual TArray<UDisplayClusterScreenComponent*> GetAllScreens() const = 0;
+	virtual UDisplayClusterScreenComponent*         GetActiveScreen() const = 0;
+	virtual UDisplayClusterScreenComponent*         GetScreenById(const FString& id) const = 0;
+	virtual int32                                   GetScreensAmount() const = 0;
+
+	virtual TArray<UDisplayClusterCameraComponent*> GetAllCameras() const = 0;
+	virtual UDisplayClusterCameraComponent*         GetActiveCamera() const = 0;
+	virtual UDisplayClusterCameraComponent*         GetCameraById(const FString& id) const = 0;
+	virtual int32                                   GetCamerasAmount() const = 0;
+	virtual void                                    SetActiveCamera(int32 idx) = 0;
+	virtual void                                    SetActiveCamera(const FString& id) = 0;
+
+	virtual TArray<UDisplayClusterSceneComponent*>  GetAllNodes() const = 0;
+	virtual UDisplayClusterSceneComponent*          GetNodeById(const FString& id) const = 0;
+
+	virtual USceneComponent*                        GetTranslationDirectionComponent() const = 0;
+	virtual void                                    SetTranslationDirectionComponent(USceneComponent* const pComp) = 0;
+	virtual void                                    SetTranslationDirectionComponent(const FString& id) = 0;
+
+	virtual USceneComponent*                        GetRotateAroundComponent() const = 0;
+	virtual void                                    SetRotateAroundComponent(USceneComponent* const pComp) = 0;
+	virtual void                                    SetRotateAroundComponent(const FString& id) = 0;
+};
diff --git a/Source/DisplayCluster/Public/IDisplayCluster.h b/Source/DisplayCluster/Public/IDisplayCluster.h
new file mode 100644
index 0000000000000000000000000000000000000000..6e971d3978c5c3dee3ef4f10479f8f0a9403e2b7
--- /dev/null
+++ b/Source/DisplayCluster/Public/IDisplayCluster.h
@@ -0,0 +1,98 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Modules/ModuleManager.h"
+#include "Modules/ModuleInterface.h"
+
+#include "DisplayClusterOperationMode.h"
+
+
+struct IDisplayClusterRenderManager;
+struct IDisplayClusterClusterManager;
+struct IDisplayClusterInputManager;
+struct IDisplayClusterConfigManager;
+struct IDisplayClusterGameManager;
+
+
+/**
+ * Public module interface
+ */
+struct IDisplayCluster
+	: public IModuleInterface
+{
+	static constexpr auto ModuleName = "DisplayCluster";
+
+	virtual ~IDisplayCluster() { }
+
+	/**
+	* Singleton-like access to this module's interface.  This is just for convenience!
+	* Beware of calling this during the shutdown phase, though.  Your module might have been unloaded already.
+	*
+	* @return Returns singleton instance, loading the module on demand if needed
+	*/
+	static inline IDisplayCluster& Get()
+	{
+		return FModuleManager::LoadModuleChecked<IDisplayCluster>(IDisplayCluster::ModuleName);
+	}
+
+	/**
+	* Checks to see if this module is loaded and ready.  It is only valid to call Get() if IsAvailable() returns true.
+	*
+	* @return True if the module is loaded and ready to use
+	*/
+	static inline bool IsAvailable()
+	{
+		return FModuleManager::Get().IsModuleLoaded(IDisplayCluster::ModuleName);
+	}
+
+
+	/**
+	* Checks if the module has been initialized.
+	*
+	* @return Is initialized
+	*/
+	virtual bool IsModuleInitialized() const = 0;
+
+	/**
+	* Returns current operation mode.
+	*
+	* @return Display Cluster operation mode
+	*/
+	virtual EDisplayClusterOperationMode GetOperationMode() const = 0;
+
+	/**
+	* Access to the device manager.
+	*
+	* @return Current device manager or nullptr
+	*/
+	virtual IDisplayClusterRenderManager* GetRenderMgr() const = 0;
+
+	/**
+	* Access to the cluster manager.
+	*
+	* @return Current cluster manager or nullptr
+	*/
+	virtual IDisplayClusterClusterManager* GetClusterMgr() const = 0;
+
+	/**
+	* Access to the input manager.
+	*
+	* @return Current cluster manager or nullptr
+	*/
+	virtual IDisplayClusterInputManager* GetInputMgr() const = 0;
+
+	/**
+	* Access to the config manager.
+	*
+	* @return Current config manager or nullptr
+	*/
+	virtual IDisplayClusterConfigManager* GetConfigMgr() const = 0;
+
+	/**
+	* Access to the game manager.
+	*
+	* @return Current game manager or nullptr
+	*/
+	virtual IDisplayClusterGameManager* GetGameMgr() const = 0;
+};
diff --git a/Source/DisplayCluster/Public/IDisplayClusterSerializable.h b/Source/DisplayCluster/Public/IDisplayClusterSerializable.h
new file mode 100644
index 0000000000000000000000000000000000000000..b5f1e3f097b843349f04f07bdc788a6248bacaec
--- /dev/null
+++ b/Source/DisplayCluster/Public/IDisplayClusterSerializable.h
@@ -0,0 +1,18 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Serialization/MemoryReader.h"
+#include "Serialization/MemoryWriter.h"
+
+
+/**
+ * Memory serialization interface
+ */
+struct IDisplayClusterSerializable
+{
+	virtual ~IDisplayClusterSerializable() { }
+
+	virtual bool Serialize  (FMemoryWriter& ar) = 0;
+	virtual bool Deserialize(FMemoryReader& ar) = 0;
+};
diff --git a/Source/DisplayCluster/Public/IDisplayClusterStringSerializable.h b/Source/DisplayCluster/Public/IDisplayClusterStringSerializable.h
new file mode 100644
index 0000000000000000000000000000000000000000..77e7cd158ad54cf50403db622507f46015053ab7
--- /dev/null
+++ b/Source/DisplayCluster/Public/IDisplayClusterStringSerializable.h
@@ -0,0 +1,16 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+
+/**
+ * String serialization interface
+ */
+struct IDisplayClusterStringSerializable
+{
+	virtual ~IDisplayClusterStringSerializable() { }
+
+	virtual FString SerializeToString() const = 0;
+	virtual bool    DeserializeFromString(const FString& ar) = 0;
+};
diff --git a/Source/DisplayCluster/Public/Input/IDisplayClusterInputManager.h b/Source/DisplayCluster/Public/Input/IDisplayClusterInputManager.h
new file mode 100644
index 0000000000000000000000000000000000000000..6ac0231c095ac63b96ddf9cab7b774e70b2d8ab2
--- /dev/null
+++ b/Source/DisplayCluster/Public/Input/IDisplayClusterInputManager.h
@@ -0,0 +1,42 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+
+/**
+ * Public input manager interface
+ */
+struct IDisplayClusterInputManager
+{
+	virtual ~IDisplayClusterInputManager()
+	{ }
+
+	//////////////////////////////////////////////////////////////////////////
+	// Device amount
+	virtual uint32 GetAxisDeviceAmount()    const = 0;
+	virtual uint32 GetButtonDeviceAmount()  const = 0;
+	virtual uint32 GetTrackerDeviceAmount() const = 0;
+
+	//////////////////////////////////////////////////////////////////////////
+	// Device IDs
+	virtual bool GetAxisDeviceIds   (TArray<FString>& ids) const = 0;
+	virtual bool GetButtonDeviceIds (TArray<FString>& ids) const = 0;
+	virtual bool GetTrackerDeviceIds(TArray<FString>& ids) const = 0;
+
+	//////////////////////////////////////////////////////////////////////////
+	// Button data access
+	virtual bool GetButtonState    (const FString& devId, const uint8 btn, bool& curState)    const = 0;
+	virtual bool IsButtonPressed   (const FString& devId, const uint8 btn, bool& curPressed)  const = 0;
+	virtual bool IsButtonReleased  (const FString& devId, const uint8 btn, bool& curReleased) const = 0;
+	virtual bool WasButtonPressed  (const FString& devId, const uint8 btn, bool& wasPressed)  const = 0;
+	virtual bool WasButtonReleased (const FString& devId, const uint8 btn, bool& wasReleased) const = 0;
+
+	//////////////////////////////////////////////////////////////////////////
+	// Axes data access
+	virtual bool GetAxis(const FString& devId, const uint8 axis, float& value) const = 0;
+
+	//////////////////////////////////////////////////////////////////////////
+	// Tracking data access
+	virtual bool GetTrackerLocation(const FString& devId, const uint8 tr, FVector& location) const = 0;
+	virtual bool GetTrackerQuat(const FString& devId, const uint8 tr, FQuat& rotation) const = 0;
+};
diff --git a/Source/DisplayCluster/Public/Render/IDisplayClusterRenderManager.h b/Source/DisplayCluster/Public/Render/IDisplayClusterRenderManager.h
new file mode 100644
index 0000000000000000000000000000000000000000..164089875eeed6b8bc8b4944b2edcf5286d23a56
--- /dev/null
+++ b/Source/DisplayCluster/Public/Render/IDisplayClusterRenderManager.h
@@ -0,0 +1,17 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "IDisplayClusterStereoDevice.h"
+
+
+/**
+ * Public render manager interface
+ */
+struct IDisplayClusterRenderManager
+{
+	virtual ~IDisplayClusterRenderManager()
+	{ }
+
+	virtual IDisplayClusterStereoDevice* GetStereoDevice() const = 0;
+};
diff --git a/Source/DisplayCluster/Public/Render/IDisplayClusterStereoDevice.h b/Source/DisplayCluster/Public/Render/IDisplayClusterStereoDevice.h
new file mode 100644
index 0000000000000000000000000000000000000000..5b6dec04fdb8dc5552b708559c4d31162f934ce4
--- /dev/null
+++ b/Source/DisplayCluster/Public/Render/IDisplayClusterStereoDevice.h
@@ -0,0 +1,112 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+
+
+enum class EDisplayClusterSwapSyncPolicy
+{
+	None = 0,     // no swap sync (V-sync off)
+	SoftSwapSync, // software swap synchronization over network
+	NvSwapSync    // NVIDIA hardware swap synchronization (nv_swap_lock)
+};
+
+
+/**
+ * Stereo device interface
+ */
+struct IDisplayClusterStereoDevice
+{
+	virtual ~IDisplayClusterStereoDevice()
+	{ }
+
+	/**
+	* Configuration of viewport render area (whore viewport is rendered by default)
+	*
+	* @param pos    - left up corner offset in viewport (pixels)
+	* @param size   - width and height of render rectangle (pixels)
+	*/
+	virtual void SetViewportArea(const FIntPoint& pos, const FIntPoint& size) = 0;
+
+	/**
+	* FOV based configuration of projection screen (standalone mode only)
+	*
+	* @param FOV - field of view
+	*/
+	virtual void SetDesktopStereoParams(float FOV) = 0;
+
+	/**
+	* Custom configuration of projection screen (standalone mode only)
+	*
+	* @param screenSize - width and height of your monitor's screen (meters)
+	* @param screenRes  - horizontal and vertical resolution of target monitor (pixels i.e. 1920, 1080)
+	* @param screenDist - distance between the head and monitor (meters)
+	*/
+	virtual void SetDesktopStereoParams(const FVector2D& screenSize, const FIntPoint& screenRes, float screenDist) = 0;
+
+	/**
+	* Configuration of interpupillary (interocular) distance
+	*
+	* @param dist - distance between eyes (meters, i.e. 0.064).
+	*/
+	virtual void  SetInterpupillaryDistance(float dist) = 0;
+
+	/**
+	* Returns currently used interpupillary distance.
+	*
+	* @return - distance between eyes (meters)
+	*/
+	virtual float GetInterpupillaryDistance() const = 0;
+
+	/**
+	* Configure eyes swap state
+	*
+	* @param swap - new eyes swap state. False - normal eyes left|right, true - swapped eyes right|left
+	*/
+	virtual void SetEyesSwap(bool swap) = 0;
+
+	/**
+	* Returns currently used eyes swap
+	*
+	* @return - eyes swap state. False - normal eyes left|right, true - swapped eyes right|left
+	*/
+	virtual bool GetEyesSwap() const = 0;
+
+	/**
+	* Toggles eyes swap state
+	*
+	* @return - new eyes swap state. False - normal eyes left|right, true - swapped eyes right|left
+	*/
+	virtual bool ToggleEyesSwap() = 0;
+
+	/**
+	* Set swap synchronization policy
+	*
+	* @param policy - is swap sync enabled
+	*/
+	virtual void SetSwapSyncPolicy(EDisplayClusterSwapSyncPolicy policy) = 0;
+
+	/**
+	* Returns current swap synchronization policy
+	*
+	* @return - current synchronization policy
+	*/
+	virtual EDisplayClusterSwapSyncPolicy GetSwapSyncPolicy() const = 0;
+
+	/**
+	* Get camera frustum culling
+	*
+	* @param NearDistance - near culling plane distance
+	* @param FarDistance - far culling plane distance
+	*/
+	virtual void GetCullingDistance(float& NearDistance, float& FarDistance) const = 0;
+
+	/**
+	* Set camera frustum culling
+	*
+	* @param NearDistance - near culling plane distance
+	* @param FarDistance - far culling plane distance
+	*/
+	virtual void SetCullingDistance(float NearDistance, float FarDistance) = 0;
+};
diff --git a/Source/DisplayClusterEditor/DisplayClusterEditor.Build.cs b/Source/DisplayClusterEditor/DisplayClusterEditor.Build.cs
new file mode 100644
index 0000000000000000000000000000000000000000..74618605c4dc8708de21a1628fdc25031e7cb4aa
--- /dev/null
+++ b/Source/DisplayClusterEditor/DisplayClusterEditor.Build.cs
@@ -0,0 +1,26 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+using UnrealBuildTool;
+using System.IO;
+
+public class DisplayClusterEditor : ModuleRules
+{
+	public DisplayClusterEditor(ReadOnlyTargetRules ROTargetRules) : base(ROTargetRules)
+	{
+		PrivateDependencyModuleNames.AddRange( new string[] {
+			"Core",
+			"CoreUObject",
+			"Engine",
+			"UnrealEd"
+		});
+
+		PrivateDependencyModuleNames.AddRange( new string[] {
+			"DisplayCluster"
+		});
+
+        PrivateIncludePathModuleNames.AddRange( new string[] {
+			"Settings",
+			"DisplayCluster"
+		});
+	}
+}
diff --git a/Source/DisplayClusterEditor/Private/DisplayClusterEditor.cpp b/Source/DisplayClusterEditor/Private/DisplayClusterEditor.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..542656cbc23cf1a08843bf7971df574960597e21
--- /dev/null
+++ b/Source/DisplayClusterEditor/Private/DisplayClusterEditor.cpp
@@ -0,0 +1,49 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterEditor.h"
+#include "DisplayClusterEditorSettings.h"
+
+#include "Modules/ModuleManager.h"
+#include "UObject/WeakObjectPtr.h"
+#include "UObject/Class.h"
+#include "ISettingsModule.h"
+
+
+#define LOCTEXT_NAMESPACE "DisplayClusterEditor"
+
+void FDisplayClusterEditorModule::StartupModule()
+{
+	RegisterSettings();
+}
+
+void FDisplayClusterEditorModule::ShutdownModule()
+{
+	UnregisterSettings();
+}
+
+
+void FDisplayClusterEditorModule::RegisterSettings()
+{
+	if (ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings"))
+	{				
+		SettingsModule->RegisterSettings(
+			"Project", "Plugins", "nDisplay",
+			LOCTEXT("RuntimeSettingsName", "nDisplay"),
+			LOCTEXT("RuntimeSettingsDescription", "Configure nDisplay"),
+			GetMutableDefault<UDisplayClusterEditorSettings>()
+		);
+	}
+}
+
+void FDisplayClusterEditorModule::UnregisterSettings()
+{	
+	if (ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings"))
+	{
+		SettingsModule->UnregisterSettings("Project", "Plugins", "nDisplay");
+	}
+}
+
+
+IMPLEMENT_MODULE(FDisplayClusterEditorModule, DisplayClusterEditor);
+
+#undef LOCTEXT_NAMESPACE
diff --git a/Source/DisplayClusterEditor/Private/DisplayClusterEditorEngine.cpp b/Source/DisplayClusterEditor/Private/DisplayClusterEditorEngine.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9e2f8a976ad7e16c29f2822ce3353cf9aa35a454
--- /dev/null
+++ b/Source/DisplayClusterEditor/Private/DisplayClusterEditorEngine.cpp
@@ -0,0 +1,47 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterEditorEngine.h"
+#include "DisplayClusterEditorLog.h"
+
+#include "DisplayCluster/Private/IPDisplayCluster.h"
+
+
+void UDisplayClusterEditorEngine::Init(IEngineLoop* InEngineLoop)
+{
+	UE_LOG(LogDisplayClusterEditorEngine, VeryVerbose, TEXT("UDisplayClusterEditorEngine::Init"));
+
+	// Initialize DisplayCluster module for editor mode
+	DisplayClusterModule = static_cast<IPDisplayCluster*>(&IDisplayCluster::Get());
+	if (DisplayClusterModule)
+	{
+		const bool bResult = DisplayClusterModule->Init(EDisplayClusterOperationMode::Editor);
+		if (bResult)
+		{
+			UE_LOG(LogDisplayClusterEditorEngine, Log, TEXT("DisplayCluster module has been initialized"));
+		}
+		else
+		{
+			UE_LOG(LogDisplayClusterEditorEngine, Error, TEXT("An error occured during DisplayCluster initialization"));
+		}
+	}
+	else
+	{
+		UE_LOG(LogDisplayClusterEditorEngine, Error, TEXT("Couldn't initialize DisplayCluster module"));
+	}
+
+	return Super::Init(InEngineLoop);
+}
+
+void UDisplayClusterEditorEngine::PreExit()
+{
+	UE_LOG(LogDisplayClusterEditorEngine, VeryVerbose, TEXT("UDisplayClusterEditorEngine::PreExit"));
+
+	Super::PreExit();
+}
+
+void UDisplayClusterEditorEngine::PlayInEditor(UWorld* InWorld, bool bInSimulateInEditor, FPlayInEditorOverrides Overrides)
+{
+	UE_LOG(LogDisplayClusterEditorEngine, VeryVerbose, TEXT("UDisplayClusterEditorEngine::PlayInEditor"));
+
+	Super::PlayInEditor(InWorld, bInSimulateInEditor, Overrides);
+}
diff --git a/Source/DisplayClusterEditor/Private/DisplayClusterEditorEngine.h b/Source/DisplayClusterEditor/Private/DisplayClusterEditorEngine.h
new file mode 100644
index 0000000000000000000000000000000000000000..b2dca1cd995bf45c3c479f643fc8aad5907fd66b
--- /dev/null
+++ b/Source/DisplayClusterEditor/Private/DisplayClusterEditorEngine.h
@@ -0,0 +1,29 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "Editor/UnrealEdEngine.h"
+#include "DisplayClusterEditorEngine.generated.h"
+
+struct IPDisplayCluster;
+
+
+/**
+ * Extended editor engine
+ */
+UCLASS()
+class UDisplayClusterEditorEngine
+	: public UUnrealEdEngine
+{
+	GENERATED_BODY()
+
+public:
+	virtual void Init(IEngineLoop* InEngineLoop) override;
+	virtual void PreExit() override;
+	virtual void PlayInEditor(UWorld* InWorld, bool bInSimulateInEditor, FPlayInEditorOverrides Overrides = FPlayInEditorOverrides()) override;
+
+private:
+	
+	IPDisplayCluster* DisplayClusterModule = nullptr;
+};
diff --git a/Source/DisplayClusterEditor/Private/DisplayClusterEditorLog.cpp b/Source/DisplayClusterEditor/Private/DisplayClusterEditorLog.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..63eb4c9cb589847e49acb65fdab136eb85e469c8
--- /dev/null
+++ b/Source/DisplayClusterEditor/Private/DisplayClusterEditorLog.cpp
@@ -0,0 +1,7 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterEditorLog.h"
+
+// Plugin-wide log categories
+DEFINE_LOG_CATEGORY(LogDisplayClusterEditor);
+DEFINE_LOG_CATEGORY(LogDisplayClusterEditorEngine);
diff --git a/Source/DisplayClusterEditor/Private/DisplayClusterEditorLog.h b/Source/DisplayClusterEditor/Private/DisplayClusterEditorLog.h
new file mode 100644
index 0000000000000000000000000000000000000000..546848939fcaf2dca976cd31a23567245b95db31
--- /dev/null
+++ b/Source/DisplayClusterEditor/Private/DisplayClusterEditorLog.h
@@ -0,0 +1,9 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+
+// Plugin-wide log categories
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterEditor,       Log, All);
+DECLARE_LOG_CATEGORY_EXTERN(LogDisplayClusterEditorEngine, Log, All);
diff --git a/Source/DisplayClusterEditor/Private/DisplayClusterEditorSettings.cpp b/Source/DisplayClusterEditor/Private/DisplayClusterEditorSettings.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5c1b65dc7ca3f463940e1366c34c37ad3d81b08e
--- /dev/null
+++ b/Source/DisplayClusterEditor/Private/DisplayClusterEditorSettings.cpp
@@ -0,0 +1,41 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#include "DisplayClusterEditorSettings.h"
+#include "DisplayClusterEditorEngine.h"
+#include "Misc/ConfigCacheIni.h"
+
+
+UDisplayClusterEditorSettings::UDisplayClusterEditorSettings(class FObjectInitializer const & ObjectInitializer)
+	: Super(ObjectInitializer) 
+{
+	GET_MEMBER_NAME_CHECKED(UDisplayClusterEditorSettings, bEnabled);
+}
+
+#if WITH_EDITOR
+void UDisplayClusterEditorSettings::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
+{
+	if (PropertyChangedEvent.Property != nullptr)
+	{
+		FName PropertyName(PropertyChangedEvent.Property->GetFName());
+		FString DefaultEnginePath = FString::Printf(TEXT("%sDefaultEngine.ini"), *FPaths::SourceConfigDir());
+
+		if (PropertyName == GET_MEMBER_NAME_CHECKED(UDisplayClusterEditorSettings, bEnabled))
+		{
+			if (bEnabled)
+			{
+				GConfig->SetString(TEXT("/Script/Engine.Engine"), TEXT("GameEngine"), TEXT("/Script/DisplayCluster.DisplayClusterGameEngine"), DefaultEnginePath);
+				GConfig->SetString(TEXT("/Script/Engine.Engine"), TEXT("UnrealEdEngine"), TEXT("/Script/DisplayClusterEditor.DisplayClusterEditorEngine"), DefaultEnginePath);
+			}
+			else
+			{
+				GConfig->SetString(TEXT("/Script/Engine.Engine"), TEXT("GameEngine"), TEXT("/Script/Engine.GameEngine"), DefaultEnginePath);
+				GConfig->SetString(TEXT("/Script/Engine.Engine"), TEXT("UnrealEdEngine"), TEXT("/Script/UnrealEd.UnrealEdEngine"), DefaultEnginePath);
+			}
+
+			GConfig->Flush(false, DefaultEnginePath);
+		}
+	}
+
+	Super::PostEditChangeProperty(PropertyChangedEvent);
+}
+#endif
diff --git a/Source/DisplayClusterEditor/Public/DisplayClusterEditor.h b/Source/DisplayClusterEditor/Public/DisplayClusterEditor.h
new file mode 100644
index 0000000000000000000000000000000000000000..fc30fc50fbae5d7890773eb89c8bcfa6a8b2d021
--- /dev/null
+++ b/Source/DisplayClusterEditor/Public/DisplayClusterEditor.h
@@ -0,0 +1,22 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "Modules/ModuleInterface.h"
+#include "Modules/ModuleManager.h"
+
+
+/**
+ * Display Cluster editor module
+ */
+class FDisplayClusterEditorModule :
+	public IModuleInterface
+{
+public:
+	//~ IModuleInterface interface
+	virtual void StartupModule() override;
+	virtual void ShutdownModule() override;
+
+	void RegisterSettings();
+	void UnregisterSettings();
+};
diff --git a/Source/DisplayClusterEditor/Public/DisplayClusterEditorSettings.h b/Source/DisplayClusterEditor/Public/DisplayClusterEditorSettings.h
new file mode 100644
index 0000000000000000000000000000000000000000..5bf36bff6fec2b843878c8de0be26c67cc7a117f
--- /dev/null
+++ b/Source/DisplayClusterEditor/Public/DisplayClusterEditorSettings.h
@@ -0,0 +1,29 @@
+// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "UObject/Object.h"
+#include "DisplayClusterEditorSettings.generated.h"
+
+
+/**
+ * Implements the settings for the nDisplay
+ **/
+UCLASS(config = Engine, defaultconfig)
+class DISPLAYCLUSTEREDITOR_API UDisplayClusterEditorSettings : public UObject
+{
+	GENERATED_UCLASS_BODY()
+
+	UPROPERTY(config, EditAnywhere, Category = Main)
+	bool bEnabled;
+
+public:
+	// UObject interface
+#if WITH_EDITOR
+	virtual void PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent) override;
+#endif
+
+private:
+
+};
diff --git a/ThirdParty/Vrpn/Include/vrpn/quat.h b/ThirdParty/Vrpn/Include/vrpn/quat.h
new file mode 100644
index 0000000000000000000000000000000000000000..77fd64f84c038f8493b1f2cc3af2cea9151fb696
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/quat.h
@@ -0,0 +1,546 @@
+
+/*****************************************************************************
+ *
+    quat.h -  include file for quaternion, vector and matrix routines.  
+
+    
+    Overview:
+    
+      quatlib is a library of routines that implements a grab-bag of 
+      useful routines for dealing with quaternions, vectors, and 
+      matrices.  See the quatlib man page for an overview.
+
+
+    Notes:
+
+      - to address the quaternion elements, use the Q_X, Q_Y, Q_Z and Q_W
+      #defines from this file.
+      
+      - to find out which version of the library you're using, do:
+       
+             % ident  <path>/libquat.a
+   
+      (this information is in the rcsid string in quat.c)
+    
+      - see /afs/unc/proj/hmd/src/quat/{quat,vector,matrix}.c 
+        for implementation details.
+
+
+    Conventions:
+
+      - general-purpose quaternion routines start with q_
+
+      - all non-integer values are doubles by default-  the exceptions
+         to this are old (non-open-) GL routines which use floats.
+      
+      - vector routines start with "q_vec"
+      
+      - matrix routines have the string "matrix" somewhere in their name
+
+      - all matrices are 4x4
+
+      - positive rotation directions are as follows:
+
+         about Z axis: from X axis to Y axis
+         about X axis: from Y axis to Z axis
+         about Y axis: from Z axis to X axis
+
+      - all angles are specified in radians
+
+      - destination parameter (if any) is always first argument (as in
+             Unix string routines)
+
+      - src and dest parameters can always be the same, as long as they 
+             are of the same type (copying is done if necessary) 
+
+      - naming conventions for conversion routines:
+      
+       q_{to,from}_whatever for routines involving quaternions
+       q_x_to_y for all others (ie., no "from" is used)
+
+
+   Revision History (for whole library, not just this file):
+
+   Author            Date      Comments
+   ------            --------  ----------------------------
+   Rich Holloway     09/10/01  Misc cleanup, deleted PPHIGS support,
+                               added q_xyz_quat_xform(), renamed
+                               qogl_matrix_mult_fixed() back to
+                               qogl_matrix_mult().
+   Mark Livingston   01/09/96  Added routines for OpenGL matrices
+   Rich Holloway     09/27/93  Added Gary Bishop's matrix to euler rtn
+   Rich Holloway     07/16/92  Added q_euler_to_col_matrix(), routines
+                               for working with GL matrices, added
+                               documentation for euler angle routines
+   Erik Erikson/     06/26/92  Added q_xyz_quat_compose
+   Stefan Gottschalk/
+   Russ Taylor
+   
+   Rich Holloway     05/13/92  Added Q_NULL_VECTOR, Q_ID_MATRIX
+   Jon Leech/        04/29/92  Added CM_ prototypes
+   Erik Erikson
+   
+   Rich Holloway     09/21/90  Made into library, made all matrices 4x4,
+                               added matrix routines for 
+                               4x4 (standard) or 3x4 (for PPHIGS),
+                               changed names of 
+                               routines (to avoid name conflicts with
+                               non-library routines) by prefixing
+                               everything with "q_".
+   
+   Russ Taylor        1990     Modified q_slerp to pick shortest path
+                               between two angles
+   
+   Warren Robinett   12/89     Added PPHIGS support routines
+   
+   Ken Shoemake       1985     Initial version
+   
+   RCS Header:
+   $Id: quat.h,v 2.37 2004/07/22 20:54:42 taylorr Exp $
+ *
+ *****************************************************************************/
+
+/* prevent multiple includes  */
+#ifndef Q_INCLUDED
+#define Q_INCLUDED
+
+
+/*****************************************************************************
+ *
+    #defines
+ *
+ *****************************************************************************/
+
+/* for accessing the elements of q_type and q_vec_type   */
+#define Q_X    0
+#define Q_Y    1
+#define Q_Z    2
+#define Q_W    3
+
+/* For accessing the elements of a q_vec_type describing Euler angles */
+#define Q_YAW   0
+#define Q_PITCH 1
+#define Q_ROLL  2
+
+/* tolerance for quaternion operations */
+#define  Q_EPSILON   (1e-10)
+
+/* min and max macros   */
+#define Q_MAX(x, y)       ( ((x) > (y)) ? (x) : (y) )
+#define Q_MIN(x, y)       ( ((x) < (y)) ? (x) : (y) )
+
+#define Q_ABS(x)       ( ((x) > 0 ) ? (x) : (-(x)) )
+
+/* 
+ * use local definition of PI for machines that have no def in math.h; this
+ *  value stolen from DEC Ultrix 4.1 math.h
+ */
+#define Q_PI    3.14159265358979323846
+
+#define Q_ID_QUAT   { 0.0, 0.0, 0.0, 1.0 }
+
+#define Q_ID_MATRIX { {1.0, 0.0, 0.0, 0.0}, \
+                      {0.0, 1.0, 0.0, 0.0}, \
+                      {0.0, 0.0, 1.0, 0.0}, \
+                      {0.0, 0.0, 0.0, 1.0} }
+
+#define Q_NULL_VECTOR   { 0.0, 0.0, 0.0 }
+
+/* 
+ * degree/radian conversion
+ */
+#define Q_DEG_TO_RAD(deg)       ( ((deg)*Q_PI)/180.0 )
+#define Q_RAD_TO_DEG(rad)       ( (((rad)*180.0)/Q_PI) )
+
+
+/*****************************************************************************
+ *
+    typedefs
+ *
+ *****************************************************************************/
+
+/* basic quaternion type- scalar part is last element in array    */
+typedef double q_type[4];
+
+/* basic vector type */
+typedef double q_vec_type[3];
+
+/* for row and column matrices   */
+typedef double q_matrix_type[4][4];
+
+/* for working with gl or other 4x4 float matrices  */
+typedef float  qgl_matrix_type[4][4];
+
+/* for working with OpenGL matrices - these are really just like row matrices
+ ** (i.e. same bits in same order), but the decl is a 1-D array, not 2-D, sigh
+ */
+typedef double  qogl_matrix_type[16];
+
+/* special transformation type using quaternions and vectors   */
+typedef struct  q_xyz_quat_struct {
+    q_vec_type xyz;   /* translation */
+    q_type     quat;  /* rotation    */
+} q_xyz_quat_type;
+
+
+
+/*****************************************************************************
+ *****************************************************************************
+ *
+    function declarations
+ *
+ *****************************************************************************
+ *****************************************************************************/
+
+/* On some platforms, we need to specifically tell the compiler
+ * that these functions are to have C linkage.  [why not everywhere?]
+ */
+
+#if defined(__cplusplus)
+
+#ifdef FLOW
+#define EXTERN_QUALIFICATION 
+#else
+#define EXTERN_QUALIFICATION "C"
+#endif /* FLOW */
+
+#define BEGIN_EXTERN_BLOCK extern EXTERN_QUALIFICATION {
+#define END_EXTERN_BLOCK }
+
+#else /* __cplusplus */
+
+#define BEGIN_EXTERN_BLOCK 
+#define END_EXTERN_BLOCK
+
+#endif /* __cplusplus */
+
+
+
+BEGIN_EXTERN_BLOCK
+
+/*****************************************************************************
+ *
+    strictly quaternion operations
+ *
+ *****************************************************************************/
+
+/*  prints a quaternion */
+void q_print (const q_type quat);
+
+/* make a quaternion given an axis and an angle;  x,y,z is axis of 
+ *  rotation;  angle is angle of rotation in radians (see also q_from_two_vecs)
+ *
+ *  rotation is counter-clockwise when rotation axis vector is 
+ *       pointing at you
+ *
+ * if angle or vector are 0, the identity quaternion is returned.
+ */
+void q_make (q_type destQuat,
+             double x,  double y,  double z,
+             double angle);
+void q_from_axis_angle(q_type destQuat,
+             double x,  double y,  double z,
+             double angle);
+
+/* Turn a quaternion into an axis and an angle;  x,y,z is axis of 
+ *  rotation;  angle is angle of rotation in radians.
+ *
+ *  rotation is counter-clockwise when rotation axis vector is 
+ *       pointing at you
+ *
+ *  if the identity quaternion is passed in, the angle will be
+ *  zero and the axis will be the Z axis.
+ */
+void q_to_axis_angle (double *x, double *y, double *z, double *angle,
+		      const q_type srcQuat);
+
+/*  copy srcQuat to destQuat    */
+void q_copy (q_type destQuat, const q_type srcQuat);
+
+/* normalizes quaternion;  src and dest can be same */
+void q_normalize (q_type destQuat, const q_type srcQuat);
+
+/* invert quat;  src and dest can be the same   */
+void q_invert (q_type destQuat, const q_type srcQuat);
+
+/*
+ * computes quaternion product destQuat = qLeft * qRight.
+ *        destQuat can be same as either qLeft or qRight or both.
+ */
+void q_mult (q_type destQuat, const q_type qLeft, const q_type qRight);
+
+/* conjugate quat; src and dest can be same */
+void q_conjugate (q_type destQuat, const q_type srcQuat);
+
+/* take natural log of unit quat; src and dest can be same  */
+void q_log (q_type destQuat, const q_type srcQuat);
+
+/* exponentiate quaternion, assuming scalar part 0.  src can be same as dest */
+void q_exp (q_type destQuat, const q_type srcQuat);
+
+
+/*
+ * q_slerp: Spherical linear interpolation of unit quaternions.
+ *
+ *    As t goes from 0 to 1, destQuat goes from startQ to endQuat.
+ *      This routine should always return a point along the shorter
+ *    of the two paths between the two.  That is why the vector may be
+ *    negated in the end.
+ *    
+ *    src == dest should be ok, although that doesn't seem to make much
+ *    sense here.
+ */
+void q_slerp (q_type destQuat, const q_type startQuat, const q_type endQuat, double t);
+
+/*****************************************************************************
+ *  
+    q_from_euler - converts 3 euler angles (in radians) to a quaternion
+     
+   Assumes roll is rotation about X, pitch
+   is rotation about Y, yaw is about Z.  Assumes order of 
+   yaw, pitch, roll applied as follows:
+       
+       p' = roll( pitch( yaw(p) ) )
+
+      See comments for q_euler_to_col_matrix for more on this.
+ *
+ *****************************************************************************/
+void q_from_euler (q_type destQuat, double yaw, double pitch, double roll);
+
+/* converts quat to euler angles (yaw, pitch, roll).  see
+ * q_col_matrix_to_euler() for conventions.  Note that you
+ * cannot use Q_X, Q_Y, and Q_Z to pull the elements out of
+ * the Euler as if they were rotations about these angles --
+ * this will invert X and Z.  You need to instead use Q_YAW
+ * (rotation about Z), Q_PITCH (rotation about Y) and Q_ROLL
+ * (rotation about X) to get them.
+ */
+void q_to_euler(q_vec_type yawPitchRoll, const q_type q);
+
+/*****************************************************************************
+ *
+    mixed quaternion operations:  conversions to and from vectors & matrices
+ *
+ *****************************************************************************/
+
+/* destVec = q * vec * q(inverse);  vec can be same storage as destVec  */
+void q_xform (q_vec_type destVec, const q_type q, const q_vec_type vec);
+
+/* quat/vector conversion  */
+/* create a quaternion from two vectors that rotates v1 to v2 
+ *   about an axis perpendicular to both
+ */
+void q_from_two_vecs (q_type destQuat, const q_vec_type v1, const q_vec_type v2);
+
+/* simple conversion */
+void q_from_vec (q_type destQuat, const q_vec_type srcVec);
+void q_to_vec (q_vec_type destVec, const q_type srcQuat);
+
+/* quaternion/4x4 matrix conversions   */
+void q_from_row_matrix (q_type destQuat, const q_matrix_type matrix);
+void q_from_col_matrix (q_type destQuat, const q_matrix_type matrix);
+void q_to_row_matrix (q_matrix_type destMatrix, const q_type srcQuat);
+void q_to_col_matrix (q_matrix_type destMatrix, const q_type srcQuat);
+
+/* quat/ogl conversion */
+void q_from_ogl_matrix (q_type destQuat, const qogl_matrix_type matrix);
+void q_to_ogl_matrix (qogl_matrix_type matrix, const q_type srcQuat);
+
+
+/*****************************************************************************
+ *
+    strictly vector operations
+ *
+ *****************************************************************************/
+
+/* prints a vector to stdout  */
+void q_vec_print (const q_vec_type vec);
+
+/* compatibility w/ old  */
+#define q_set_vec   q_vec_set
+
+/* sets vector equal to 3 values given */
+void q_vec_set (q_vec_type vec, double x, double y, double z);
+
+/* copies srcVec to destVec */
+void q_vec_copy (q_vec_type destVec, const q_vec_type srcVec);
+
+/* adds two vectors */
+void q_vec_add (q_vec_type destVec, const q_vec_type aVec, const q_vec_type bVec);
+
+/* destVec = v1 - v2 (v1, v2, destVec need not be distinct storage) */
+void q_vec_subtract (q_vec_type destVec, const q_vec_type v1, const q_vec_type v2);
+
+/* returns value of dot product of v1 and v2 */
+double q_vec_dot_product (const q_vec_type v1, const q_vec_type v2);
+
+/* scale a vector  (src and dest need not be distinct) */
+void q_vec_scale (q_vec_type destVec, double scaleFactor, const q_vec_type srcVec);
+
+
+/* negate a vector to point in the opposite direction */
+void q_vec_invert (q_vec_type destVec, const q_vec_type srcVec);
+
+/*  normalize a vector  (destVec and srcVec may be the same) */
+void q_vec_normalize (q_vec_type destVec, const q_vec_type srcVec);
+
+/* returns magnitude of vector   */
+double q_vec_magnitude (const q_vec_type vec);
+
+/*  returns distance between two points/vectors */
+double q_vec_distance (const q_vec_type vec1, const q_vec_type vec2);
+
+/* computes cross product of two vectors:  destVec = aVec X bVec
+ *    destVec same as aVec or bVec ok */
+void q_vec_cross_product (q_vec_type destVec,
+                          const q_vec_type aVec, const q_vec_type bVec);
+
+
+/*****************************************************************************
+ *
+    strictly matrix operations
+ *
+ *****************************************************************************/
+
+/* q_matrix_copy - copies srcMatrix to destMatrix (both matrices are 4x4)   */
+void q_matrix_copy (q_matrix_type destMatrix, const q_matrix_type srcMatrix);
+
+void qogl_matrix_copy (qogl_matrix_type dest, const qogl_matrix_type src);
+
+/* does a 4x4 matrix multiply (the input matrices are 4x4) and
+ *            puts the result in a 4x4 matrix.  src == dest ok.
+ */
+void q_matrix_mult (q_matrix_type resultMatrix,
+                    const q_matrix_type leftMatrix,
+                    const q_matrix_type rightMatrix);
+
+// for backward compatibility
+#define qogl_matrix_mult_fixed qogl_matrix_mult
+
+/*
+ * Computes result=left*right
+ * Used to be called qogl_matrix_mult_fixed because the old version
+ * did not compute the correct result. 
+ */
+void qogl_matrix_mult (qogl_matrix_type result,
+                       const qogl_matrix_type left,
+                       const qogl_matrix_type right);
+
+
+/*****************************************************************************
+ *
+   q_euler_to_col_matrix - euler angles should be in radians
+      computed assuming the order of rotation is: yaw, pitch, roll.
+   
+    This means the following:
+    
+      p' = roll( pitch( yaw(p) ) )
+    
+    or
+
+      p' = Mr * Mp * My * p
+
+    Yaw is rotation about Z axis, pitch is rotation about Y axis, and roll
+    is rotation about X axis.  In terms of these axes, then, the process is:
+    
+      p' = Mx * My * Mz * p
+ 
+    where Mx = the standard Foley and van Dam column matrix for rotation
+    about the X axis, and similarly for Y and Z.
+    
+    Thus the calling sequence in terms of X, Y, Z is:
+    
+      q_euler_to_col_matrix(destMatrix, zRot, yRot, xRot);
+ *
+ *****************************************************************************/
+void q_euler_to_col_matrix (q_matrix_type destMatrix,
+                            double yaw, double pitch, double roll);
+
+/*****************************************************************************
+ *
+    q_col_matrix_to_euler- convert a column matrix to euler angles    
+ 
+    input:
+      - vector to hold euler angles
+      - src column matrix
+    
+    output:
+      - euler angles in radians in the range -pi to pi;
+       vec[0] = yaw, vec[1] = pitch, vec[2] = roll
+       yaw is rotation about Z axis, pitch is about Y, roll -> X rot.
+    
+    notes:
+      - written by Gary Bishop
+      - you cannot use Q_X, Q_Y, and Q_Z to pull the elements out of
+        the Euler as if they were rotations about these angles --
+        this will invert X and Z.  You need to instead use Q_YAW
+        (rotation about Z), Q_PITCH (rotation about Y) and Q_ROLL
+        (rotation about X) to get them.
+ *
+ *****************************************************************************/
+void q_col_matrix_to_euler (q_vec_type yawpitchroll, const q_matrix_type colMatrix);
+
+/* prints 4x4 matrix */
+void q_print_matrix (const q_matrix_type matrix);
+
+void qogl_print_matrix (const qogl_matrix_type);
+
+
+/*****************************************************************************
+ *
+    xyz_quat routines
+ *
+ *****************************************************************************/
+
+/* invert a vector/quaternion transformation pair   */
+void q_xyz_quat_invert (q_xyz_quat_type *destPtr, const q_xyz_quat_type *srcPtr);
+
+
+/* converts a row matrix to an xyz_quat   */
+void q_row_matrix_to_xyz_quat (q_xyz_quat_type * xyzQuatPtr,
+                               const q_matrix_type     rowMatrix);
+
+/* convert an xyz_quat to a row matrix */
+void q_xyz_quat_to_row_matrix (q_matrix_type     rowMatrix,
+                               const q_xyz_quat_type * xyzQuatPtr);
+
+void q_ogl_matrix_to_xyz_quat (q_xyz_quat_type  * xyzQuatPtr,
+                               const qogl_matrix_type   matrix);
+
+void q_xyz_quat_to_ogl_matrix (qogl_matrix_type  matrix,
+                               const q_xyz_quat_type  * xyzQuatPtr);
+
+/* compose q_xyz_quat_vecs to form a third. */
+/* C_from_A_ptr may be = to either C_from_B_ptr or B_from_A_ptr (or both) */
+void q_xyz_quat_compose (q_xyz_quat_type * C_from_A_ptr,
+                         const q_xyz_quat_type * C_from_B_ptr,
+                         const q_xyz_quat_type * B_from_A_ptr);
+
+void q_xyz_quat_xform(q_vec_type dest, const q_xyz_quat_type *xf, const q_vec_type src);
+
+/*****************************************************************************
+ *
+    GL support
+ *
+ *****************************************************************************/
+
+/* convert from quat to GL 4x4 float row matrix */
+void qgl_to_matrix (qgl_matrix_type destMatrix, const q_type srcQuat);
+
+
+/* qgl_from_matrix- Convert GL 4x4 row-major rotation matrix to 
+ * unit quaternion.
+ *    - same as q_from_row_matrix, except basic type is float, not double
+ */
+void qgl_from_matrix (q_type destQuat, const qgl_matrix_type srcMatrix);
+
+/* print gl-style matrix    */
+void qgl_print_matrix (const qgl_matrix_type matrix);
+                          
+END_EXTERN_BLOCK
+
+#undef BEGIN_EXTERN_BLOCK
+#undef END_EXTERN_BLOCK
+#undef EXTERN_QUALIFICATION
+
+#endif /* Q_INCLUDED */
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_Analog.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_Analog.h
new file mode 100644
index 0000000000000000000000000000000000000000..1d0f7a286ba27a0039119dca88503a06bd8c0764
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_Analog.h
@@ -0,0 +1,210 @@
+#ifndef VRPN_ANALOG_H
+#define VRPN_ANALOG_H
+
+#include <stddef.h> // for NULL
+
+#include "vrpn_BaseClass.h"  // for vrpn_Callback_List, etc
+#include "vrpn_Configure.h"  // for VRPN_API, VRPN_CALLBACK
+#include "vrpn_Connection.h" // for vrpn_CONNECTION_LOW_LATENCY, etc
+#include "vrpn_Shared.h"     // for timeval
+#include "vrpn_Types.h"      // for vrpn_int32, vrpn_float64, etc
+
+#ifndef VRPN_CLIENT_ONLY
+#include "vrpn_Serial.h" // for ::vrpn_SER_PARITY_NONE, etc
+#endif
+
+#define vrpn_CHANNEL_MAX 128
+
+// analog status flags
+const int vrpn_ANALOG_SYNCING = (2);
+const int vrpn_ANALOG_REPORT_READY = (1);
+const int vrpn_ANALOG_PARTIAL = (0);
+const int vrpn_ANALOG_RESETTING = (-1);
+const int vrpn_ANALOG_FAIL = (-2);
+
+// Analog time value meaning "go find out what time it is right now"
+const struct timeval vrpn_ANALOG_NOW = {0, 0};
+
+class VRPN_API vrpn_Analog : public vrpn_BaseClass {
+public:
+    vrpn_Analog(const char *name, vrpn_Connection *c = NULL);
+
+    // Print the status of the analog device
+    void print(void);
+
+    vrpn_int32 getNumChannels(void) const;
+
+protected:
+    vrpn_float64 channel[vrpn_CHANNEL_MAX];
+    vrpn_float64 last[vrpn_CHANNEL_MAX];
+    vrpn_int32 num_channel;
+    struct timeval timestamp;
+    vrpn_int32 channel_m_id; //< channel message id (message from server)
+    int status;
+
+    virtual int register_types(void);
+
+    //------------------------------------------------------------------
+    // Routines used to send data from the server
+    virtual vrpn_int32 encode_to(char *buf);
+    /// Send a report only if something has changed (for servers)
+    /// Optionally, tell what time to stamp the value with
+    virtual void
+    report_changes(vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY,
+                   const struct timeval time = vrpn_ANALOG_NOW);
+    /// Send a report whether something has changed or not (for servers)
+    /// Optionally, tell what time to stamp the value with
+    virtual void
+    report(vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY,
+           const struct timeval time = vrpn_ANALOG_NOW);
+};
+
+#ifndef VRPN_CLIENT_ONLY
+class VRPN_API vrpn_Serial_Analog : public vrpn_Analog {
+public:
+    vrpn_Serial_Analog(const char *name, vrpn_Connection *connection,
+                       const char *port, int baud = 9600, int bits = 8,
+                       vrpn_SER_PARITY parity = vrpn_SER_PARITY_NONE,
+                       bool rts_flow = false);
+    ~vrpn_Serial_Analog();
+
+protected:
+    int serial_fd;
+    char portname[1024];
+    int baudrate;
+    unsigned char buffer[1024];
+    int bufcounter;
+
+    int read_available_characters(char *buffer, int bytes);
+};
+#endif
+
+// vrpn_Analog_Server
+// Tom Hudson, March 1999
+//
+// A *Sample* Analog server.  Use this or derive your own from vrpn_Analog with
+// this as a guide.
+//
+// Write whatever values you want into channels(), then call report()
+// or report_changes().  (Original spec only called for report_changes(),
+// but vrpn_Analog's assumption that "no new data = same data" doesn't
+// match the BLT stripchart assumption  of "no intervening data = ramp".
+//
+// For a sample application, see server_src/sample_analog.C
+
+class VRPN_API vrpn_Analog_Server : public vrpn_Analog {
+
+public:
+    vrpn_Analog_Server(const char *name, vrpn_Connection *c,
+                       vrpn_int32 numChannels = vrpn_CHANNEL_MAX);
+
+    /// Makes public the protected base class function
+    virtual void
+    report_changes(vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY,
+                   const struct timeval time = vrpn_ANALOG_NOW);
+
+    /// Makes public the protected base class function
+    virtual void
+    report(vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY,
+           const struct timeval time = vrpn_ANALOG_NOW);
+
+    /// For this server, the user must normally call report() or
+    /// report_changes() directly.  This mainloop() only takes
+    /// care of the things any server object should do.
+    virtual void mainloop() { server_mainloop(); };
+
+    /// Exposes an array of values for the user to write into.
+    vrpn_float64 *channels(void) { return channel; }
+
+    /// Sets the size of the array;  returns the size actually set.
+    /// (May be clamped to vrpn_CHANNEL_MAX)
+    /// This should be used before mainloop is ever called.
+    vrpn_int32 setNumChannels(vrpn_int32 sizeRequested);
+};
+
+/// Analog server that can scale and clip its range to -1..1.
+// This is useful for joysticks, to allow them to be centered and
+// scaled to cover the whole range.  Rather than writing directly
+// into the channels array, call the setChannel() method.
+
+class VRPN_API vrpn_Clipping_Analog_Server : public vrpn_Analog_Server {
+public:
+    vrpn_Clipping_Analog_Server(const char *name, vrpn_Connection *c,
+                                vrpn_int32 numChannels = vrpn_CHANNEL_MAX);
+
+    /// Set the clipping values for the specified channel.
+    /// min maps to -1, values between lowzero and highzero map to 0,
+    /// max maps to 1.  Values less than min map to -1, values larger
+    /// than max map to 1. Default for each channel is -1,0,0,1
+    /// It is possible to compress the range to [0..1] by setting the
+    /// minimum equal to the lowzero.
+    /// Returns 0 on success, -1 on failure.
+    int setClipValues(int channel, double min, double lowzero, double highzero,
+                      double max);
+
+    /// This method should be used to set the value of a channel.
+    /// It will be scaled and clipped as described in setClipValues.
+    /// It returns 0 on success and -1 on failure.
+    int setChannelValue(int channel, double value);
+
+protected:
+    typedef struct {
+        double minimum_val; // Value mapped to -1
+        double lower_zero;  // Minimum value mapped to 0
+        double upper_zero;  // Maximum value mapped to 0
+        double maximum_val; // Value mapped to 1
+    } clipvals_struct;
+
+    clipvals_struct clipvals[vrpn_CHANNEL_MAX];
+};
+
+//----------------------------------------------------------
+//************** Users deal with the following *************
+
+// User routine to handle a change in analog values.  This is called when
+// the analog callback is called (when a message from its counterpart
+// across the connection arrives).
+
+typedef struct _vrpn_ANALOGCB {
+    struct timeval msg_time;                // Timestamp of analog data
+    vrpn_int32 num_channel;                 // how many channels
+    vrpn_float64 channel[vrpn_CHANNEL_MAX]; // analog values
+} vrpn_ANALOGCB;
+
+typedef void(VRPN_CALLBACK *vrpn_ANALOGCHANGEHANDLER)(void *userdata,
+                                                      const vrpn_ANALOGCB info);
+
+// Open an analog device that is on the other end of a connection
+// and handle updates from it.  This is the type of analog device
+// that user code will deal with.
+
+class VRPN_API vrpn_Analog_Remote : public vrpn_Analog {
+public:
+    // The name of the analog device to connect to
+    // Optional argument to be used when the Remote should listen on
+    // a connection that is already open.
+    vrpn_Analog_Remote(const char *name, vrpn_Connection *c = NULL);
+
+    // This routine calls the mainloop of the connection it's on
+    virtual void mainloop();
+
+    // (un)Register a callback handler to handle analog value change
+    virtual int register_change_handler(void *userdata,
+                                        vrpn_ANALOGCHANGEHANDLER handler)
+    {
+        return d_callback_list.register_handler(userdata, handler);
+    };
+    virtual int unregister_change_handler(void *userdata,
+                                          vrpn_ANALOGCHANGEHANDLER handler)
+    {
+        return d_callback_list.unregister_handler(userdata, handler);
+    }
+
+protected:
+    vrpn_Callback_List<vrpn_ANALOGCB> d_callback_list;
+
+    static int VRPN_CALLBACK
+    handle_change_message(void *userdata, vrpn_HANDLERPARAM p);
+};
+
+#endif
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_Analog_Output.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_Analog_Output.h
new file mode 100644
index 0000000000000000000000000000000000000000..7da443cfca05779f88c9224da329f0f150deec42
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_Analog_Output.h
@@ -0,0 +1,193 @@
+// vrpn_Analog_Output.h
+// David Borland, September 2002
+//
+// These classes are for setting values for an analog output device.  The
+// vrpn_Analog was getting overloaded by trying to have functionality for both
+// reading and writing in it. If wanting to read analog values from a device, a
+// vrpn_Analog should be used, if wanting to write analog values to a device, a
+// vrpn_Analog_Output should be used. This is similar to the Tracker/Poser
+// dichotomy.
+
+#ifndef VRPN_ANALOG_OUTPUT_H
+#define VRPN_ANALOG_OUTPUT_H
+
+#include <stddef.h> // for NULL
+
+#include "vrpn_Analog.h"     // for vrpn_CHANNEL_MAX
+#include "vrpn_BaseClass.h"  // for vrpn_Callback_List, etc
+#include "vrpn_Configure.h"  // for VRPN_CALLBACK, VRPN_API
+#include "vrpn_Connection.h" // for vrpn_CONNECTION_RELIABLE, etc
+#include "vrpn_Shared.h"     // for timeval
+#include "vrpn_Types.h"      // for vrpn_int32, vrpn_float64, etc
+
+// Similar to vrpn_Analog, but messages are different
+// Members beginning with o_ are also found in vrpn_Analog, the o_ is
+// so that you can derive a class from both without getting ambiguities
+class VRPN_API vrpn_Analog_Output : public vrpn_BaseClass {
+public:
+    vrpn_Analog_Output(const char* name, vrpn_Connection* c = NULL);
+
+    // Print the status of the analog output device
+    void o_print(void);
+
+    vrpn_int32 getNumChannels() const { return o_num_channel; }
+
+protected:
+    vrpn_float64 o_channel[vrpn_CHANNEL_MAX];
+    vrpn_int32 o_num_channel;
+    struct timeval o_timestamp;
+    vrpn_int32 request_m_id;          //< Request to change message from client
+    vrpn_int32 request_channels_m_id; //< Request to change channels message
+    // from client
+    vrpn_int32 report_num_channels_m_id; //< Report of the number of active
+    // channels, from the server
+    vrpn_int32 got_connection_m_id; //< new-connection notification
+    int o_status;
+
+    virtual int register_types(void);
+};
+
+// A *Sample* Analog output server.  Use this, or derive your own server
+// from vrpn_Analog_Output with this as a guide.  You can remove the
+// user-level callback code (both the type before this class and the
+// list and the handler register/deregister) if the server is controlling
+// a device directly.
+
+class VRPN_API vrpn_Analog_Output_Server : public vrpn_Analog_Output {
+public:
+    vrpn_Analog_Output_Server(const char* name, vrpn_Connection* c,
+                              vrpn_int32 numChannels = vrpn_CHANNEL_MAX);
+    virtual ~vrpn_Analog_Output_Server(void);
+
+    virtual void mainloop() { server_mainloop(); }
+
+    /// Sets the size of the array;  returns the size actually set.
+    /// (May be clamped to vrpn_CHANNEL_MAX)
+    /// This should be used before mainloop is ever called.
+    vrpn_int32 setNumChannels(vrpn_int32 sizeRequested);
+
+    /// Exposes an array of values for the user to read from.
+    const vrpn_float64* o_channels(void) const { return o_channel; };
+
+protected:
+    virtual bool report_num_channels(
+        vrpn_uint32 class_of_service = vrpn_CONNECTION_RELIABLE);
+    virtual vrpn_int32 encode_num_channels_to(char* buf, vrpn_int32 num);
+
+    /// Responds to a request to change one of the values by
+    /// setting the channel to that value.  Derived class must
+    /// either install handlers for this routine or else make
+    /// its own routines to handle the request message.
+    static int VRPN_CALLBACK
+    handle_request_message(void* userdata, vrpn_HANDLERPARAM p);
+
+    /// Responds to a request to change a number of channels
+    /// Derived class must either install handlers for this
+    /// routine or else make its own routines to handle the
+    /// multi-channel request message.
+    static int VRPN_CALLBACK
+    handle_request_channels_message(void* userdata, vrpn_HANDLERPARAM p);
+
+    /// Used to notify us when a new connection is requested, so that
+    /// we can let the client know how many channels are active
+    static int VRPN_CALLBACK
+    handle_got_connection(void* userdata, vrpn_HANDLERPARAM p);
+};
+
+// A more complicated analog server that provides a
+// user routine to handle a change in analog values.  This is called when
+// the analog callback is called (when a message from its counterpart
+// across the connection arrives).  This callback is called whenever
+// EITHER type of change message arrives (either a single-channel change
+// or a multiple-channel change.
+
+typedef struct _vrpn_ANALOGOUTPUTCB {
+    struct timeval msg_time;     // Timestamp of analog data
+    vrpn_int32 num_channel;      // how many channels
+    const vrpn_float64* channel; // analog values (pointer to channels)
+} vrpn_ANALOGOUTPUTCB;
+
+typedef void(VRPN_CALLBACK* vrpn_ANALOGOUTPUTCHANGEHANDLER)(
+    void* userdata, const vrpn_ANALOGOUTPUTCB info);
+
+class VRPN_API vrpn_Analog_Output_Callback_Server
+    : public vrpn_Analog_Output_Server {
+public:
+    vrpn_Analog_Output_Callback_Server(
+        const char* name, vrpn_Connection* c,
+        vrpn_int32 numChannels = vrpn_CHANNEL_MAX);
+    virtual ~vrpn_Analog_Output_Callback_Server(void);
+
+    // (un)Register a callback handler to handle analog value change.
+    // These will be called whenever EITHER type of change message is
+    // received, either a single channel or multiple channels.  This is
+    // useful for applications that "have a" server, rather than derive
+    // from the server.
+    virtual int register_change_handler(void* userdata,
+                                        vrpn_ANALOGOUTPUTCHANGEHANDLER handler)
+    {
+        return d_callback_list.register_handler(userdata, handler);
+    };
+    virtual int
+    unregister_change_handler(void* userdata,
+                              vrpn_ANALOGOUTPUTCHANGEHANDLER handler)
+    {
+        return d_callback_list.unregister_handler(userdata, handler);
+    }
+
+protected:
+    /// Handles BOTH types of changes messages, and will be called
+    /// after the vrpn_Analog_Output_Server class has already filled
+    /// in the values.  It just calls the user callbacks with the
+    /// appropriate pointer to the data values.
+    static int VRPN_CALLBACK
+    handle_change_message(void* userdata, vrpn_HANDLERPARAM p);
+
+    /// List of user-level routines that need to be called back to let
+    /// them know that the values have changed.
+    vrpn_Callback_List<vrpn_ANALOGOUTPUTCB> d_callback_list;
+};
+
+// Open an analog output device that is on the other end of a connection
+// and send updates to it.  This is the type of analog output device
+// that user code will deal with.
+class VRPN_API vrpn_Analog_Output_Remote : public vrpn_Analog_Output {
+public:
+    // The name of the analog device to connect to
+    // Optional argument to be used when the Remote should listen on
+    // a connection that is already open.
+    vrpn_Analog_Output_Remote(const char* name, vrpn_Connection* c = NULL);
+    virtual ~vrpn_Analog_Output_Remote(void);
+
+    // This routine calls the mainloop of the connection it's on
+    virtual void mainloop();
+
+    // Request the analog to change its value to the one specified.
+    // Returns false on failure.
+    virtual bool request_change_channel_value(
+        unsigned int chan, vrpn_float64 val,
+        vrpn_uint32 class_of_service = vrpn_CONNECTION_RELIABLE);
+
+    // Request the analog to change values all at once.  If more values are
+    // given
+    // than we have channels, the extra values are discarded.  If less values
+    // are
+    // given than we have channels, the extra channels are set to 0.
+    // Returns false on failure
+    virtual bool request_change_channels(
+        int num, vrpn_float64* vals,
+        vrpn_uint32 class_of_service = vrpn_CONNECTION_RELIABLE);
+
+protected:
+    // How we hear about the number of active channels
+    static int VRPN_CALLBACK
+    handle_report_num_channels(void* userdata, vrpn_HANDLERPARAM p);
+
+    // Routines used to send requests from the client
+    virtual vrpn_int32 encode_change_to(char* buf, vrpn_int32 chan,
+                                        vrpn_float64 val);
+    virtual vrpn_int32 encode_change_channels_to(char* buf, vrpn_int32 num,
+                                                 vrpn_float64* vals);
+};
+
+#endif
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_Assert.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_Assert.h
new file mode 100644
index 0000000000000000000000000000000000000000..aba934364cce5265f690b9e334c6047c85516e31
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_Assert.h
@@ -0,0 +1,203 @@
+/** @file
+    @brief Header for assert macros.
+
+    Include guards intentionally omitted, to allow re-inclusion with different
+   options.
+
+    Assertions can either do nothing, call an assert handler on failure that
+   prints details to stderr, or call your compiler system's assert.
+
+    - Define `VRPN_DISABLE_ASSERTS` before including this file to forcibly
+   disable all asserts.
+    - By default, debug builds will use the standard assert method, and release
+   builds will do nothing.
+    - To unconditionally (debug and release) enable the custom assert handler,
+   define `VRPN_ENABLE_ASSERT_HANDLER`
+    - To enable the custom assert handler for debug builds only (leaving asserts
+   as no-ops in release builds), define `VRPN_ENABLE_ASSERT_DEBUG_HANDLER`
+
+
+    @date 2015
+
+    @author
+    Ryan Pavlik (incorporating some code modified from Boost)
+    Sensics, Inc.
+    <http://sensics.com/osvr>
+*/
+
+// Copyright 2015 Sensics, Inc.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+//
+// Includes code adapted from the following Boost Software License v1.0 sources:
+//  - <boost/current_function.hpp>
+//  - <boost/assert.hpp>
+
+// Undefine macro for safe multiple inclusion
+#undef VRPN_CURRENT_FUNCTION
+
+// ---------------------------------------------------------- //
+// Begin code adapted from <boost/current_function.hpp>
+// at revision 5d353ad2b of the boost.assert repository
+// https://github.com/boostorg/assert/blob/5d353ad2b92208c6ca300f4b47fdf04c87a8a593/include/boost/current_function.hpp
+//
+// Original notice follows:
+//
+//  Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
+//
+//  Distributed under the Boost Software License, Version 1.0.
+//  See accompanying file LICENSE_1_0.txt or copy at
+//  http://www.boost.org/LICENSE_1_0.txt
+//
+//  http://www.boost.org/libs/assert/current_function.html
+//
+#if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) ||    \
+    (defined(__ICC) && (__ICC >= 600)) || defined(__ghs__)
+
+#define VRPN_CURRENT_FUNCTION __PRETTY_FUNCTION__
+
+#elif defined(__DMC__) && (__DMC__ >= 0x810)
+
+#define VRPN_CURRENT_FUNCTION __PRETTY_FUNCTION__
+
+#elif defined(__FUNCSIG__)
+
+#define VRPN_CURRENT_FUNCTION __FUNCSIG__
+
+#elif(defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 600)) ||               \
+    (defined(__IBMCPP__) && (__IBMCPP__ >= 500))
+
+#define VRPN_CURRENT_FUNCTION __FUNCTION__
+
+#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x550)
+
+#define VRPN_CURRENT_FUNCTION __FUNC__
+
+#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
+
+#define VRPN_CURRENT_FUNCTION __func__
+
+#elif defined(__cplusplus) && (__cplusplus >= 201103)
+
+#define VRPN_CURRENT_FUNCTION __func__
+
+#else
+
+#define VRPN_CURRENT_FUNCTION "(unknown)"
+
+#endif
+
+// End code adapted from <boost/current_function.hpp>
+// ---------------------------------------------------------- //
+
+// ---------------------------------------------------------- //
+// Begin code adapted from <boost/assert.hpp>
+// at revision 5d353ad2b of the boost.assert repository
+// https://github.com/boostorg/assert/blob/5d353ad2b92208c6ca300f4b47fdf04c87a8a593/include/boost/assert.hpp
+//
+// Original notice follows:
+//
+//  Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+//  Copyright (c) 2007, 2014 Peter Dimov
+//  Copyright (c) Beman Dawes 2011
+//
+//  Distributed under the Boost Software License, Version 1.0.
+//  See accompanying file LICENSE_1_0.txt or copy at
+//  http://www.boost.org/LICENSE_1_0.txt
+//
+//  Note: There are no include guards. This is intentional.
+//
+//  See http://www.boost.org/libs/assert/assert.html for documentation.
+//
+
+//
+// VRPN_ASSERT, VRPN_ASSERT_MSG
+//
+
+#undef VRPN_ASSERT
+#undef VRPN_ASSERT_MSG
+
+#if defined(VRPN_DISABLE_ASSERTS) || ( defined(VRPN_ENABLE_ASSERT_DEBUG_HANDLER) && defined(NDEBUG) )
+
+#define VRPN_ASSERT(expr) ((void)0)
+#define VRPN_ASSERT_MSG(expr, msg) ((void)0)
+
+#elif defined(VRPN_ENABLE_ASSERT_HANDLER) || ( defined(VRPN_ENABLE_ASSERT_DEBUG_HANDLER) && !defined(NDEBUG) )
+
+/// @todo implementation of VRPN_LIKELY
+#ifndef VRPN_LIKELY
+#define VRPN_LIKELY(X) (X)
+#endif
+
+#ifndef VRPN_API
+#include "vrpn_Configure.h"
+#endif
+
+namespace vrpn {
+    VRPN_API void assertion_failed(char const *expr, char const *function,
+                                   char const *file, long line);
+    VRPN_API void assertion_failed_msg(char const *expr, char const *msg,
+                                       char const *function, char const *file,
+                                       long line);
+} // namespace vrpn
+
+#define VRPN_ASSERT(expr) (VRPN_LIKELY(!!(expr))? ((void)0): ::vrpn::assertion_failed(#expr, VRPN_CURRENT_FUNCTION, __FILE__, __LINE__))
+#define VRPN_ASSERT_MSG(expr, msg) (VRPN_LIKELY(!!(expr))? ((void)0): ::vrpn::assertion_failed_msg(#expr, msg, VRPN_CURRENT_FUNCTION, __FILE__, __LINE__))
+
+#else
+
+#include <assert.h> // .h to support old libraries w/o <cassert> - effect is the same
+
+#define VRPN_ASSERT(expr) assert(expr)
+#define VRPN_ASSERT_MSG(expr, msg) assert((expr) && (msg))
+
+#endif
+
+//
+// VRPN_VERIFY, VRPN_VERIFY_MSG
+//
+
+#undef VRPN_VERIFY
+#undef VRPN_VERIFY_MSG
+
+
+#if defined(VRPN_DISABLE_ASSERTS) || ( !defined(VRPN_ENABLE_ASSERT_HANDLER) && defined(NDEBUG) )
+
+# define VRPN_VERIFY(expr) ((void)(expr))
+# define VRPN_VERIFY_MSG(expr, msg) ((void)(expr))
+
+#else
+
+# define VRPN_VERIFY(expr) VRPN_ASSERT(expr)
+# define VRPN_VERIFY_MSG(expr, msg) VRPN_ASSERT_MSG(expr,msg)
+
+#endif
+
+// End code adapted from <boost/assert.hpp>
+// --
+
+// ---------
+// Documentation
+/** @def VRPN_CURRENT_FUNCTION
+    @brief Expands to the special preprocessor macro providing a useful
+    description of the current function, where available.
+*/
+/** @def VRPN_ASSERT(expr)
+    @brief Asserts the truth of @p expr according to the configuration of
+    vrpn_Assert.h at the time of inclusion. If not asserting, does not evaluate
+    expression.
+*/
+/** @def VRPN_ASSERT_MSG(expr, msg)
+    @brief Like VRPN_ASSERT(expr) but allows specification of a message to be
+    included in the case of a failed assertion.
+*/
+/** @def VRPN_VERIFY(expr)
+    @brief Typically forwards to VRPN_ASSERT, but in cases where VRPN_ASSERT
+    would expand to nothing (not evaluating the expression), VRPN_VERIFY
+    evaluates the expression but discards the result.
+*/
+/** @def VRPN_VERIFY_MSG(expr, msg)
+    @brief Like VRPN_VERIFY(expr) but allows specification of a message to be
+    included in the case of a failed assertion.
+*/
\ No newline at end of file
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_Auxiliary_Logger.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_Auxiliary_Logger.h
new file mode 100644
index 0000000000000000000000000000000000000000..e394a598c7ab26ac3c65143b3bc5002142eeb190
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_Auxiliary_Logger.h
@@ -0,0 +1,253 @@
+// This is a base class interface that has been designed for use by
+// scientific data-collection applications that make use of VRPN to
+// connect to microscope imagers and tracking system for nanoscale
+// science research at UNC.
+
+// The idea of this interface is to enable a client GUI to start and
+// stop logging of full-rate data on the server while receiving only
+// a subset of the data during the experiment for preview; this keeps
+// from overloading the network bandwidth with data and also keeps
+// the client-side log files from filling up.  When new log file(s)
+// are requested, the old log files are closed.
+
+// Note that a particular implementation of the auxiliary logger server
+// may need to know about a second connection (not the one it talks
+// to its client over) in case that is where it is doing its logging.
+
+#ifndef VRPN_AUXILIARY_LOGGER_H
+#define VRPN_AUXILIARY_LOGGER_H
+#include <string.h> // for NULL
+
+#include "vrpn_BaseClass.h" // for vrpn_Callback_List, etc
+#include "vrpn_Configure.h" // for VRPN_CALLBACK, VRPN_API
+#include "vrpn_Connection.h"
+#include "vrpn_Shared.h" // for timeval
+#include "vrpn_Types.h"  // for vrpn_int32
+
+class VRPN_API vrpn_Auxiliary_Logger : public vrpn_BaseClass {
+public:
+    vrpn_Auxiliary_Logger(const char *name, vrpn_Connection *c);
+
+protected:
+    // Handle registration of all message types we're going to deal with.
+    virtual int register_types(void);
+    vrpn_int32 request_logging_m_id; // ID of remote->server request message
+    vrpn_int32 report_logging_m_id;  // ID of server->client response message
+    vrpn_int32 request_logging_status_m_id; // ID of remote->server
+                                            // status-request message
+
+    // Pack a log description into the message whose type is passed
+    // as the parameter (this is used to pack both the request and
+    // report messages.
+    bool pack_log_message_of_type(vrpn_int32 type,
+                                  const char *local_in_logfile_name,
+                                  const char *local_out_logfile_name,
+                                  const char *remote_in_logfile_name,
+                                  const char *remote_out_logfile_name);
+
+    // Unpack a log description from a message into the four strings that
+    // were passed in (this is used to unpack both the request and the
+    // report messages).
+    // NOTE: This routine will allocate space for the strings.  The caller
+    // must delete [] this space when they are done with it to avoid
+    // memory leaks.
+    bool unpack_log_message_from_buffer(const char *buf, vrpn_int32 buflen,
+                                        char **local_in_logfile_name,
+                                        char **local_out_logfile_name,
+                                        char **remote_in_logfile_name,
+                                        char **remote_out_logfile_name);
+};
+
+// Virtual base server class for an auxiliiary logger.  An implementation must
+// implement the specified message-handling functions and must call the base-
+// class constructor to set up the calling of them.
+
+class VRPN_API vrpn_Auxiliary_Logger_Server : public vrpn_Auxiliary_Logger {
+public:
+    vrpn_Auxiliary_Logger_Server(const char *name, vrpn_Connection *c);
+
+    // Required for servers.
+    virtual void mainloop(void) { server_mainloop(); }
+
+protected:
+    // Handle a logging-request message.  The request contains four file
+    // names, two for local (to the Auxiliary server itself) and two for
+    // remote (the far side of its connection to the server).  It must
+    // also respond to the client with a message saying what logging has
+    // been set up (using the send_logging_response function).  Logging is
+    // turned off on a particular file by sending an empty-string name ("").
+    // The in/out local/remote are with respect to the connection that the
+    // logging is to occur on, which may or may not be the same one that the
+    // client has connected to the object on using the constructor above.
+    // Make sure to send a response saying what you did.
+    virtual void
+    handle_request_logging(const char *local_in_logfile_name,
+                           const char *local_out_logfile_name,
+                           const char *remote_in_logfile_name,
+                           const char *remote_out_logfile_name) = 0;
+
+    // Send a response to the client telling it what logging has been
+    // established.
+    bool send_report_logging(const char *local_in_logfile_name,
+                             const char *local_out_logfile_name,
+                             const char *remote_in_logfile_name,
+                             const char *remote_out_logfile_name)
+    {
+        if (!d_connection) {
+            return false;
+        }
+        return pack_log_message_of_type(
+            report_logging_m_id, local_in_logfile_name, local_out_logfile_name,
+            remote_in_logfile_name, remote_out_logfile_name);
+    }
+
+    // Handle dropped last connection on server object by turning off
+    // logging.  The static method basically looks up the this
+    // pointer and calls the virtual method.  A derived class should
+    // re-implement the non-static method below if it doesn't want to drop all
+    // logging or if it wants to do something else in addition.  The static
+    // method basically just calls the non-static method.
+    virtual void handle_dropped_last_connection(void);
+    vrpn_int32 dropped_last_connection_m_id; // ID of message that all
+                                             // connections dropped
+    static int VRPN_CALLBACK
+    static_handle_dropped_last_connection(void *userdata, vrpn_HANDLERPARAM p);
+
+    // Static portion of handling (unpacking) the request_logging message.  It
+    // then calls the non-static virtual method above.
+    static int VRPN_CALLBACK
+    static_handle_request_logging(void *userdata, vrpn_HANDLERPARAM p);
+
+    // Handle request for logging status.
+    virtual void handle_request_logging_status() = 0;
+    static int VRPN_CALLBACK
+    static_handle_request_logging_status(void *userdata, vrpn_HANDLERPARAM p);
+};
+
+// Generic server that will start auxiliary logs on the connection whose name
+// is passed in (which can be the same as the name of the connection it is
+// created on, but does not have to be).  The "local" in and out are with
+// respect to the new connection that is made; the "remote" in and out are with
+// respect to the named connection.  No logging is started in the constructor.
+
+class VRPN_API vrpn_Auxiliary_Logger_Server_Generic
+    : public vrpn_Auxiliary_Logger_Server {
+public:
+    // Does not start logging, just records what to log when it is started.
+    vrpn_Auxiliary_Logger_Server_Generic(const char *logger_name,
+                                         const char *connection_to_log,
+                                         vrpn_Connection *c = NULL);
+    ~vrpn_Auxiliary_Logger_Server_Generic();
+
+    // Close an existing logging connection, then (if any of the file
+    // names are non-empty) open a new logging connection to the
+    // connection we are to log (even if this process already has a
+    // connection to it) and then send back the report that we've started
+    // logging if we are able.  If we cannot open it, then fill in all
+    // blank names for the return report.
+    virtual void handle_request_logging(const char *local_in_logfile_name,
+                                        const char *local_out_logfile_name,
+                                        const char *remote_in_logfile_name,
+                                        const char *remote_out_logfile_name);
+
+    virtual void handle_request_logging_status();
+
+    // If we have an active logging connection, mainloop it and save all of its
+    // pending messages in addition to handling the base-class functions.
+    // Then call the parent class mainloop().
+    virtual void mainloop(void)
+    {
+        if (d_logging_connection) {
+            d_logging_connection->mainloop();
+            d_logging_connection->save_log_so_far();
+        }
+        vrpn_Auxiliary_Logger_Server::mainloop();
+    }
+
+protected:
+    char *d_connection_name;               // Name to connect to when logging.
+    vrpn_Connection *d_logging_connection; // Connection to use for logging.
+};
+
+//-----------------------------------------------------------
+//************** Client code uses the following *************
+
+// Type of a client routine to request new logging and to handle a
+// report of changed logging.  This callback is called when the
+// logging server reports a new set of files, which should happen
+// after each request is made.
+
+typedef struct _vrpn_AUXLOGGERCB {
+    struct timeval msg_time; // Timestamp of new logging
+    const char *
+        local_in_logfile_name; // Name of the incoming local log ("" if none).
+    const char *local_out_logfile_name;
+    const char *remote_in_logfile_name;
+    const char *remote_out_logfile_name;
+} vrpn_AUXLOGGERCB;
+
+typedef void(VRPN_CALLBACK *vrpn_AUXLOGGERREPORTHANDLER)(
+    void *userdata, const vrpn_AUXLOGGERCB info);
+
+class VRPN_API vrpn_Auxiliary_Logger_Remote : public vrpn_Auxiliary_Logger {
+public:
+    vrpn_Auxiliary_Logger_Remote(const char *name, vrpn_Connection *c = NULL);
+
+    // Send a request to the server asking it to log the following.  Each of
+    // these is with respect to the connection that the auxiliary logger server
+    // is handling, which may or may not be the one that it is connected to to
+    // receive this message; it refers to the other side of the new connection
+    // that the server establishes to do its logging.  Passing a NULL or empty
+    // string ("") to any of the entries disables that log.
+    // WARNING: If the server is set to connect to its own connection and log
+    // it, then you must explicitly request a set of empty log files to stop
+    // it logging the last time because otherwise it never gets the message
+    // that it dropped the last connection and will continue logging after the
+    // object is destroyed.
+    bool send_logging_request(const char *local_in_logfile_name,
+                              const char *local_out_logfile_name = "",
+                              const char *remote_in_logfile_name = "",
+                              const char *remote_out_logfile_name = "")
+    {
+        if (!d_connection) {
+            return false;
+        }
+        return pack_log_message_of_type(
+            request_logging_m_id, local_in_logfile_name, local_out_logfile_name,
+            remote_in_logfile_name, remote_out_logfile_name);
+    }
+
+    bool send_logging_status_request()
+    {
+        if (!d_connection) {
+            return false;
+        }
+        return pack_log_message_of_type(request_logging_status_m_id, NULL, NULL,
+                                        NULL, NULL);
+    }
+
+    // Register/unregister a callback handler for the logging response.
+    virtual int register_report_handler(void *userdata,
+                                        vrpn_AUXLOGGERREPORTHANDLER handler)
+    {
+        return d_callback_list.register_handler(userdata, handler);
+    };
+    virtual int unregister_report_handler(void *userdata,
+                                          vrpn_AUXLOGGERREPORTHANDLER handler)
+    {
+        return d_callback_list.unregister_handler(userdata, handler);
+    }
+
+    // This routine calls the mainloop of the connection it's on
+    virtual void mainloop(void);
+
+protected:
+    // Static handler for the logging report message.
+    // Use the base-class unpack method to convert the data into strings.
+    vrpn_Callback_List<vrpn_AUXLOGGERCB> d_callback_list;
+
+    static int VRPN_CALLBACK
+    handle_report_message(void *userdata, vrpn_HANDLERPARAM p);
+};
+
+#endif
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_BaseClass.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_BaseClass.h
new file mode 100644
index 0000000000000000000000000000000000000000..6de47b4e76a258b4665baa2d3f1cbae5b1e32ff2
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_BaseClass.h
@@ -0,0 +1,487 @@
+/** @file vrpn_BaseClass.h
+
+  All types of client/server/peer objects in VRPN should be derived from the
+  vrpn_BaseClass type described here.  This includes Tracker, Button, Analog,
+  Clock, Dial, ForceDevice, Sound, and Text; it should include any user-defined
+  objects as well.
+
+  This class both implements code that will be shared by most (if not all)
+  objects in the system and forms a skeleton for the definition of new objects
+  by requiring certain virtual member functions to be defined.
+
+  See the VRPN web pages or another simple type (such as vrpn_Analog) for an
+  example of how to create a new VRPN object type using this as a base class.
+*/
+
+#ifndef VRPN_BASECLASS
+#define VRPN_BASECLASS
+
+#include <stdio.h> // for NULL, fprintf, stderr, FILE
+
+#include "vrpn_Configure.h" // for VRPN_API, VRPN_CALLBACK
+#include "vrpn_Connection.h"
+#include "vrpn_Shared.h" // for timeval, vrpn_gettimeofday
+#include "vrpn_Types.h"  // for vrpn_int32, vrpn_uint32
+
+/*
+-----------------------------------------------------------------------------
+Answer to the question:
+   "Why is there both a UNIQUE and NON-UNIQUE base class?",
+   or
+   "Why can't everything from vrpn_BaseClass be moved into
+vrpn_BaseClassUnique?"
+
+   The first reason is that removing vrpn_BaseClass would require the
+   vrpn_BaseClassUnique constructor to take a name and connection object as
+   parameters, which would cause some problems due to the way virtual base
+   classes are implemented in C++.
+
+   Any class that inherits from a virtual base (either directly or several
+   generations removed) must provide an explicit call to the constructor
+   of the virtual base.  This is done because the virtual base constructor
+   is invoked from the very first class in the constructor chain.
+
+   Take for example vrpn_Tng3, which inherits vrpn_Button and vrpn_Serial_Analog
+   (and thus vrpn_Analog).  Creating a new instance of a vrpn_Tng3 object will
+   call the constructors in this order:
+       Tng3
+       BaseClassUnique  (because it is a virtual base)
+       Button
+       BaseClass   (coming from Button)
+       Serial_Analog
+       Analog
+       BaseClass   (coming from Analog)
+
+   Right now, BaseClassUnique's constructor has no parameters.  So the
+   Tng3 constructor does not have to explicitly invoke BaseClassUnique, although
+   implicitly it will call BaseClassUnique's 0-parameter constructor before
+   doing anything else.  But if BaseClass is eliminated, then BaseClassUnique's
+   constructor must do the work of creating the connection and copying the
+   service name.  So BaseClassUnique's constructor must now take a couple
+   parameters, which means that every class (including Tng3, Button, Analog, and
+Serial_Analog) would have to explicitly name the constructor for BaseClassUnique
+in the code and specify parameters for connection and service-name, even though
+only one such call to the BaseClassUnique's constructor would ever actually
+occur at runtime (that of Tng3 since it's located at the lowest level of the
+family tree; the rest of the calls would be ignored).  This would mean inserting
+"vrpn_BaseClassUnique(name,connection)" into the initializer section of every
+constructor in *every* class under the BaseClassUnique subtree.
+
+   The second reason we have both a unique and non-unique base class is that
+   the "register_types" virtual function must be called several times for
+   multiply-inherited devices, with a different virtual target in each case.
+   Presently, register_types() is called from vrpn_BaseClass::init().
+   init() may be called multiple times using a different vftable entry for
+   register_types() each time (e.g. for the Tng3 it will refer once to
+   vrpn_Analog::register_types() and once to vrpn_Button::register_types()).
+   Both init() and the pure-virtual declaration of register_types() are found
+   in BaseClass.  Moving init() up into BaseClassUnique instead of BaseClass
+   means that register_types() would have to move up as well.  And if
+   register_types() is declared in the virtual base class, BaseClassUnique,
+   it can only have one virtual target.
+
+   So it might appear that vrpn_BaseClass has no data members and would
+   therefore be easy to eliminate.  However it actually does have a data
+   member: the vftable entry for "register_types".  And this data member
+   *must* be duplicated in the case of multiply-inherited device because a
+   single object will need several distinct virtual targets for
+   "register_types".
+
+   [Jeff Feasel  19 May 2005]
+-----------------------------------------------------------------------------
+*/
+
+const int vrpn_MAX_BCADRS = 100;
+///< Internal value for number of BaseClass addresses
+
+/// Since the sending of text messages has been pulled into the base class (so
+/// that every object can send error/warning/info messages this way), these
+/// definitions have been pulled in here as well.
+typedef enum {
+    vrpn_TEXT_NORMAL = 0,
+    vrpn_TEXT_WARNING = 1,
+    vrpn_TEXT_ERROR = 2
+} vrpn_TEXT_SEVERITY;
+const unsigned vrpn_MAX_TEXT_LEN = 1024;
+
+class VRPN_API vrpn_BaseClass;
+
+/// Class that handles text/warning/error printing for all objects in the
+/// system.
+// It is a system class, with one instance of it in existence.  Each object in
+// the system registers with this class when it is constructed.  By default,
+// this class prints all Warning and Error messages to stdout, prefaced by
+// "vrpn Warning(0) from MUMBLE: ", where the 0 indicates the level of the
+// message and Warning the severity, and MUMBLE the name of the object that sent
+// the message. The user could create their own TextPrinter, and attach whatever
+// objects they want to it.
+//  NOTE: Because there is a vrpn_System_TextPrinter that all vrpn_BaseClass
+// objects talk to, and because those objects may be in multiple threads, the
+// vrpn_TextPrinter class has to be thread-safe.  This requires all user-
+// callable methods to be thread-safe because the destructor may be called
+// during a method call.
+
+class VRPN_API vrpn_TextPrinter {
+public:
+    vrpn_TextPrinter();
+    ~vrpn_TextPrinter();
+
+    /// Adds an object to the list of watched objects (multiple registration
+    /// of the same object will result in only one printing for each message
+    /// from the object). Returns 0 on success and -1 on failure.
+    /// YOU MUST REMOVE any objects from a vrpn_TextPrinter that you create
+    /// before destroying the printer if any connection objects survive,
+    /// otherwise they may call a callback function on the destroyed object.
+    int add_object(vrpn_BaseClass *o);
+
+    /// Remove an object from the list of watched objects (multiple deletions
+    /// of the object will not cause any error condition; deletions of
+    /// unregistered objects will not cause errors).
+    void remove_object(vrpn_BaseClass *o);
+
+    /// Change the level of printing for the object (sets the minimum level to
+    /// print). Default is Warnings and Errors of all levels.
+    void set_min_level_to_print(vrpn_TEXT_SEVERITY severity,
+                                vrpn_uint32 level = 0);
+
+    /// Change the ostream that will be used to print messages.  Setting a
+    /// NULL ostream results in no printing.
+    void set_ostream_to_use(FILE *o);
+
+protected:
+    /// Mutex to ensure thread safety;
+    vrpn_Semaphore d_semaphore;
+
+    /// Structure to hold the objects that are being watched.
+    class VRPN_API vrpn_TextPrinter_Watch_Entry {
+    public:
+        vrpn_BaseClass *obj; ///< Object being watched
+        vrpn_TextPrinter *me;
+        ///< Pointer to this, because used in a static function
+        vrpn_TextPrinter_Watch_Entry *next;
+        ///< Pointer to the next one in the list
+    };
+    vrpn_TextPrinter_Watch_Entry *d_first_watched_object;
+    ///< Head of list of objects being watched
+
+    FILE *d_ostream;                        ///< Output stream to use
+    vrpn_TEXT_SEVERITY d_severity_to_print; ///< Minimum severity to print
+    vrpn_uint32 d_level_to_print;           ///< Minimum level to print
+
+    /// Handles the text messages that come from the connections for
+    /// objects we are watching.
+    static int VRPN_CALLBACK
+    text_message_handler(void *userdata, vrpn_HANDLERPARAM p);
+};
+// SWIG does not like this declaration.
+#ifndef SWIG
+extern VRPN_API vrpn_TextPrinter &vrpn_System_TextPrinter;
+#endif
+
+/// INTERNAL class to hold members that there should only be one copy of
+/// even when a class inherits from multiple vrpn_BaseClasses because it
+/// inherits from multiple user-level classes.  Note that not everything in
+/// vrpnBaseClass should be here, because (for example) the registration of
+/// types should be done for each parent class.
+class VRPN_API vrpn_BaseClassUnique {
+    friend class VRPN_API vrpn_TextPrinter;
+
+public:
+    vrpn_BaseClassUnique();
+    virtual ~vrpn_BaseClassUnique();
+
+    /// Returns a pointer to the connection this object is using
+    vrpn_Connection *connectionPtr() { return d_connection; };
+
+    bool shutup; // if True, don't print the "No response from server" messages.
+
+    friend class SendTextMessageBoundCall;
+    class SendTextMessageBoundCall {
+    private:
+        vrpn_BaseClassUnique *_p;
+        vrpn_TEXT_SEVERITY _severity;
+
+    public:
+        SendTextMessageBoundCall(vrpn_BaseClassUnique *device,
+                                 vrpn_TEXT_SEVERITY type)
+            : _p(device)
+            , _severity(type)
+        {
+        }
+
+        SendTextMessageBoundCall(SendTextMessageBoundCall const &other)
+            : _p(other._p)
+            , _severity(other._severity)
+        {
+        }
+
+        int operator()(const char *msg) const
+        {
+            struct timeval timestamp;
+            vrpn_gettimeofday(&timestamp, NULL);
+            return _p->send_text_message(msg, timestamp, _severity);
+        }
+    };
+
+protected:
+    vrpn_Connection *d_connection; ///< Connection that this object talks to
+    char *d_servicename; ///< Name of this device, not including the connection
+    /// part
+
+    vrpn_int32 d_sender_id;       ///< Sender ID registered with the connection
+    vrpn_int32 d_text_message_id; ///< ID for text messages
+    vrpn_int32 d_ping_message_id; ///< Ask the server if they are there
+    vrpn_int32 d_pong_message_id; ///< Server telling that it is there
+
+    /// Registers a handler with the connection, and remembers to delete at
+    /// destruction.
+    // This is a wrapper for the vrpn_Connection call that registers
+    // message handlers.  It should be used rather than the connection's
+    // function because this one will remember to unregister all of its handlers
+    // at object deletion time.
+    int register_autodeleted_handler(vrpn_int32 type,
+                                     vrpn_MESSAGEHANDLER handler,
+                                     void *userdata,
+                                     vrpn_int32 sender = vrpn_ANY_SENDER);
+
+    /// Encodes the body of the text message into a buffer, preparing for
+    /// sending
+    static int encode_text_message_to_buffer(char *buf,
+                                             vrpn_TEXT_SEVERITY severity,
+                                             vrpn_uint32 level,
+                                             const char *msg);
+
+    /// Decodes the body of the text message from a buffer from the connection
+    static int decode_text_message_from_buffer(char *msg,
+                                               vrpn_TEXT_SEVERITY *severity,
+                                               vrpn_uint32 *level,
+                                               const char *buf);
+
+    /// Sends a NULL-terminated text message from the device d_sender_id
+    int send_text_message(const char *msg, struct timeval timestamp,
+                          vrpn_TEXT_SEVERITY type = vrpn_TEXT_NORMAL,
+                          vrpn_uint32 level = 0);
+
+    /// Returns an object you can stream into to send a text message from the
+    /// device
+    /// like send_text_message(vrpn_TEXT_WARNING) << "Value of i is: " << i;
+    /// This use requires including vrpn_SendTextMessageStreamProxy.h
+    SendTextMessageBoundCall
+    send_text_message(vrpn_TEXT_SEVERITY type = vrpn_TEXT_NORMAL)
+    {
+        return SendTextMessageBoundCall(this, type);
+    }
+
+    /// Handles functions that all servers should provide in their mainloop()
+    /// (ping/pong, for example)
+    /// Should be called by all servers in their mainloop()
+    void server_mainloop(void);
+
+    /// Handles functions that all clients should provide in their mainloop()
+    /// (warning of no server, for example)
+    /// Should be called by all clients in their mainloop()
+    void client_mainloop(void);
+
+private:
+    struct {
+        vrpn_MESSAGEHANDLER handler;
+        vrpn_int32 sender;
+        vrpn_int32 type;
+        void *userdata;
+    } d_handler_autodeletion_record[vrpn_MAX_BCADRS];
+    int d_num_autodeletions;
+
+    int d_first_mainloop; ///< First time client_mainloop() or server_mainloop()
+    /// called?
+    struct timeval d_time_first_ping; ///< When was the first ping of this
+    /// unanswered group sent?
+    struct timeval
+        d_time_last_warned; ///< When is the last time we sent a warning?
+    int d_unanswered_ping;  ///< Do we have an outstanding ping request?
+    int d_flatline;         ///< Has it been 10+ seconds without a response?
+
+    /// Used by client/server code to request/send "server is alive" (pong)
+    /// message
+    static int VRPN_CALLBACK handle_ping(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK handle_pong(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_connection_dropped(void *userdata, vrpn_HANDLERPARAM p);
+    void initiate_ping_cycle(void);
+};
+
+//---------------------------------------------------------------
+/// Class from which all user-level (and other) classes that communicate
+/// with vrpn_Connections should derive.
+
+class VRPN_API vrpn_BaseClass : virtual public vrpn_BaseClassUnique {
+
+public:
+    /// Names the device and assigns or opens connection,
+    /// calls registration methods
+    vrpn_BaseClass(const char *name, vrpn_Connection *c = NULL);
+
+    virtual ~vrpn_BaseClass();
+
+    /// Called once through each main loop iteration to handle updates.
+    /// Remote object mainloop() should call client_mainloop() and
+    /// then call d_connection->mainloop().
+    /// Server object mainloop() should service the device and then
+    /// call server_mainloop(), but should not normally call
+    /// d_connection->mainloop().
+    virtual void mainloop() = 0;
+
+protected:
+    /// Initialize things that the constructor can't. Returns 0 on
+    /// success, -1 on failure.
+    virtual int init(void);
+
+    /// Register the sender for this device (by default, the name of the
+    /// device). Return 0 on success, -1 on fail.
+    virtual int register_senders(void);
+
+    /// Register the types of messages this device sends/receives.
+    /// Return 0 on success, -1 on fail.
+    virtual int register_types(void) = 0;
+};
+
+//---------------------------------------------------------------
+// Within VRPN (and other libraries), it is wise to avoid using the
+// Standard Template Library.  This is very annoying, but required
+// by the fact that some systems have incompatible versions of STL.
+// This caused problems with any program that uses the GHOST library
+// (which had its own STL on Windows), and I've heard tell of problems
+// with other systems as well.  On the other hand, nothing says that
+// we can't have our OWN template types and use them.  This next type
+// is used to handle callback lists within objects.  It is templated
+// over the struct that is passed to the user callback.
+// See vrpn_Button.h's usage for an example.
+
+// Disables a warning that the class requires DLL linkage to be
+// used by clients of classes that include one: The classes themselves
+// have DLL linkage, the code below asks for (but apparently does not
+// get) DLL linkage, and the DLL-linked test programs work when things
+// are as they are.  Do not use this class outside of a derived class.
+#ifdef _MSC_VER
+#pragma warning(disable : 4251)
+#endif
+template <class CALLBACK_STRUCT> class VRPN_API vrpn_Callback_List {
+public:
+    typedef void(VRPN_CALLBACK *HANDLER_TYPE)(void *userdata,
+                                              const CALLBACK_STRUCT info);
+
+    /// This class requires deep copies.
+    void operator=(const vrpn_Callback_List &from)
+    {
+        // Delete any existing elements in the list.
+        CHANGELIST_ENTRY *current, *next;
+        current = d_change_list;
+        while (current != NULL) {
+            next = current->next;
+            delete current;
+            current = next;
+        }
+
+        // Copy all elements from the other list.  XXX Side effect, this inverts
+        // the order
+        current = from.d_change_list;
+        while (current != NULL) {
+            register_handler(current->userdata, current->handler);
+            current = current->next;
+        }
+    }
+
+    /// Call this to add a handler to the list.
+    int register_handler(void *userdata, HANDLER_TYPE handler)
+    {
+        CHANGELIST_ENTRY *new_entry;
+
+        // Ensure that the handler is non-NULL
+        if (handler == NULL) {
+            fprintf(stderr,
+                    "vrpn_Callback_List::register_handler(): NULL handler\n");
+            return -1;
+        }
+
+        // Allocate and initialize the new entry
+        if ((new_entry = new CHANGELIST_ENTRY) == NULL) {
+            fprintf(stderr,
+                    "vrpn_Callback_List::register_handler(): Out of memory\n");
+            return -1;
+        }
+        new_entry->handler = handler;
+        new_entry->userdata = userdata;
+
+        // Add this handler to the chain at the beginning (don't check to see
+        // if it is already there, since duplication is okay).
+        new_entry->next = d_change_list;
+        d_change_list = new_entry;
+
+        return 0;
+    };
+
+    /// Call this to remove a handler from the list (if it exists)
+    int unregister_handler(void *userdata, HANDLER_TYPE handler)
+    {
+        // The pointer at *snitch points to victim
+        CHANGELIST_ENTRY *victim, **snitch;
+
+        // Find a handler with this registry in the list (any one will do,
+        // since all duplicates are the same).
+        snitch = &d_change_list;
+        victim = *snitch;
+        while ((victim != NULL) && ((victim->handler != handler) ||
+                                    (victim->userdata != userdata))) {
+            snitch = &((*snitch)->next);
+            victim = victim->next;
+        }
+
+        // Make sure we found one
+        if (victim == NULL) {
+            fprintf(
+                stderr,
+                "vrpn_Callback_List::unregister_handler: No such handler\n");
+            return -1;
+        }
+
+        // Remove the entry from the list
+        *snitch = victim->next;
+        delete victim;
+
+        return 0;
+    };
+
+    /// This will pass the referenced parameter as a const to all the callbacks.
+    void call_handlers(const CALLBACK_STRUCT &info)
+    {
+        CHANGELIST_ENTRY *handler = d_change_list;
+        while (handler != NULL) {
+            handler->handler(handler->userdata, info);
+            handler = handler->next;
+        }
+    };
+
+    /// The list starts out empty
+    vrpn_Callback_List()
+        : d_change_list(NULL){};
+
+    /// Clear the list upon destruction if it is not empty already
+    ~vrpn_Callback_List()
+    {
+        while (d_change_list != NULL) {
+            CHANGELIST_ENTRY *next = d_change_list->next;
+            delete d_change_list;
+            d_change_list = next;
+        }
+    };
+
+protected:
+    typedef struct vrpn_CBS {
+        void *userdata;
+        HANDLER_TYPE handler;
+        struct vrpn_CBS *next;
+    } CHANGELIST_ENTRY;
+    CHANGELIST_ENTRY *d_change_list;
+};
+
+// End of defined VRPN_BASECLASS for vrpn_BaseClass.h
+#endif
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_Button.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_Button.h
new file mode 100644
index 0000000000000000000000000000000000000000..65d1d1a5e621c8a3626147b9edafba8b1810beeb
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_Button.h
@@ -0,0 +1,296 @@
+#ifndef VRPN_BUTTON_H
+#include <stddef.h> // for NULL
+
+#include "vrpn_BaseClass.h" // for vrpn_Callback_List, etc
+#include "vrpn_Configure.h" // for VRPN_API, VRPN_CALLBACK
+#include "vrpn_Shared.h"    // for timeval
+#include "vrpn_Types.h"     // for vrpn_int32, vrpn_float64, etc
+
+class VRPN_API vrpn_Connection;
+struct vrpn_HANDLERPARAM;
+
+const int vrpn_BUTTON_MAX_BUTTONS = 256;
+const int VRPN_BUTTON_BUF_SIZE = 256;
+
+// Base class for buttons.  Definition
+// of remote button class for the user is at the end.
+
+const int vrpn_BUTTON_MOMENTARY = 10;
+const int vrpn_BUTTON_TOGGLE_OFF = 20;
+const int vrpn_BUTTON_TOGGLE_ON = 21;
+const int vrpn_BUTTON_LIGHT_OFF = 30;
+const int vrpn_BUTTON_LIGHT_ON = 31;
+const int vrpn_ALL_ID = -99;
+
+/** This is the base class for both the client and server for a button
+    device (a device with one or more boolean switches).  Any server
+    should actually derive from the vrpn_Button_Filter class, described
+    next, which enables toggling any of the buttons. **/
+
+class VRPN_API vrpn_Button : public vrpn_BaseClass {
+public:
+    vrpn_Button(const char *name, vrpn_Connection *c = NULL);
+    virtual ~vrpn_Button(void);
+
+    // Print the status of the button
+    void print(void);
+
+    virtual void set_momentary(vrpn_int32 which_button);
+    virtual void set_toggle(vrpn_int32 which_button, vrpn_int32 current_state);
+    virtual void set_all_momentary(void);
+    virtual void set_all_toggle(vrpn_int32 default_state);
+
+protected:
+    unsigned char buttons[vrpn_BUTTON_MAX_BUTTONS];
+    unsigned char lastbuttons[vrpn_BUTTON_MAX_BUTTONS];
+    vrpn_int32 minrate[vrpn_BUTTON_MAX_BUTTONS];
+    vrpn_int32 num_buttons;
+    struct timeval timestamp;
+    vrpn_int32 change_message_id; // ID of change button message to connection
+    vrpn_int32 states_message_id; // ID of button-states message to connection
+    vrpn_int32 admin_message_id;  // ID of admin button message to connection
+
+    virtual int register_types(void);
+    virtual void report_changes(void);
+    virtual void report_states(void); // Calls Button or Button_Filter encode
+    virtual vrpn_int32 encode_to(char *buf, vrpn_int32 button,
+                                 vrpn_int32 state);
+    virtual vrpn_int32 encode_states_to(char *buf);
+};
+
+/** All button servers should derive from this class, which provides
+    the ability to turn any of the buttons into toggles (using messages
+    from the remote button object). **/
+
+class VRPN_API vrpn_Button_Filter : public vrpn_Button {
+public:
+    vrpn_int32 buttonstate[vrpn_BUTTON_MAX_BUTTONS];
+    virtual void set_momentary(vrpn_int32 which_button);
+    virtual void set_toggle(vrpn_int32 which_button, vrpn_int32 current_state);
+    virtual void set_all_momentary(void);
+    virtual void set_all_toggle(vrpn_int32 default_state);
+    void set_alerts(vrpn_int32);
+
+protected:
+    int send_alerts;
+    vrpn_Button_Filter(const char *, vrpn_Connection *c = NULL);
+    vrpn_int32
+        alert_message_id; // used to send back to alert button box for lights
+    virtual vrpn_int32 encode_states_to(char *buf);
+    virtual void report_changes(void);
+
+    // This method makes sure we send a states message whenever we get a ping
+    // from
+    // a client object or a new connection.
+    static int VRPN_CALLBACK
+    handle_ping_message(void *userdata, vrpn_HANDLERPARAM p);
+};
+
+#ifndef VRPN_CLIENT_ONLY
+
+// Button server that lets you set the values for the buttons directly and
+// then have it update if needed.  This class should be used by devices that
+// can have several sets of buttons in them and don't want to derive from the
+// Button class themselves.  An example is the InterSense 900 features found in
+// the Fastrak server (which may have several button devices, one for each
+// sensor).
+
+class VRPN_API vrpn_Button_Server : public vrpn_Button_Filter {
+public:
+    vrpn_Button_Server(const char *name, vrpn_Connection *c,
+                       int numbuttons = 1);
+
+    /// Tells how many buttons there are (may be clipped to MAX_BUTTONS)
+    int number_of_buttons(void);
+
+    /// Called once each time through the server program's mainloop to handle
+    /// various functions (like setting toggles, reporting changes, etc).
+    virtual void mainloop();
+
+    /// Allows the server program to set current button states (to 0 or 1)
+    int set_button(int button, int new_value);
+};
+
+// Example button server code. This button device causes its buttons to
+// be pressed and released at the interval specified (default 1/sec). It
+// has the specified number of buttons (default 1).
+// This class is derived from the vrpn_Button_Filter class, so that it
+// can be made to toggle its buttons using messages from the client.
+
+class VRPN_API vrpn_Button_Example_Server : public vrpn_Button_Filter {
+public:
+    vrpn_Button_Example_Server(const char *name, vrpn_Connection *c,
+                               int numbuttons = 1, vrpn_float64 rate = 1.0);
+
+    virtual void mainloop();
+
+protected:
+    vrpn_float64 _update_rate; // How often to toggle
+};
+
+// Button device that is connected to a parallel port and uses the
+// status bits to read from the buttons.  There can be up to 5 buttons
+// read this way.
+class VRPN_API vrpn_Button_Parallel : public vrpn_Button_Filter {
+public:
+    // Open a button connected to the local machine, talk to the
+    // outside world through the connection.
+    vrpn_Button_Parallel(const char *name, vrpn_Connection *connection,
+                         int portno, unsigned porthex = 0);
+    ~vrpn_Button_Parallel();
+
+protected:
+    int port;
+    int status;
+
+    virtual void read(void) = 0;
+#ifdef _WIN32
+    int openGiveIO(void);
+#endif // _WIN32
+};
+
+// Open a Python (or Hiball Button) that is connected to a parallel port.
+// See www.vrpn.org/UNC_python.html for a description of how to make
+// a connector that uses the parallel port this way.  Note that this
+// use of a parallel port can result in damage to the motherboard if
+// voltage spikes (static) are passed through if care is not taken.
+// This interface is intended for use at UNC.  No warranty is expressed
+// or implied for use elsewhere (use at your own risk).
+class VRPN_API vrpn_Button_Python : public vrpn_Button_Parallel {
+public:
+    vrpn_Button_Python(const char *name, vrpn_Connection *c, int p);
+    vrpn_Button_Python(const char *name, vrpn_Connection *c, int p,
+                       unsigned ph);
+
+    virtual void mainloop();
+
+protected:
+    virtual void read(void);
+    bool d_first_fail;
+};
+
+// Button device that is connected to the serial port.
+class VRPN_API vrpn_Button_Serial : public vrpn_Button_Filter {
+public:
+    vrpn_Button_Serial(const char *name, vrpn_Connection *c,
+                       const char *port = "/dev/ttyS1/", long baud = 38400);
+    virtual ~vrpn_Button_Serial();
+
+protected:
+    char portname[VRPN_BUTTON_BUF_SIZE];
+    long baudrate;
+    int serial_fd;
+    int status;
+
+    unsigned char
+        buffer[VRPN_BUTTON_BUF_SIZE]; // char read from the button so far
+    vrpn_uint32 bufcount;             // number of char in the buffer
+
+    virtual void read() = 0;
+};
+
+// Open a Fakespace Pinch Glove System that is connected to a serial port. There
+// are total of 10 buttons. Buttons 0-4 are fingers for the right hand-thumb
+// first and pinkie last-while buttons 5-9 are for the left hand-thumb first.
+// The report you get back is the finger is touching. So you will not have a
+// state where only one button is ON.
+class VRPN_API vrpn_Button_PinchGlove : public vrpn_Button_Serial {
+public:
+    vrpn_Button_PinchGlove(const char *name, vrpn_Connection *c,
+                           const char *port = "/dev/ttyS1/", long baud = 38400);
+
+    virtual void mainloop();
+
+protected:
+    bool reported_failure;
+    virtual void read();
+    void
+    report_no_timestamp(); // set the glove to report data without timestamp
+};
+
+#endif // VRPN_CLIENT_ONLY
+
+//----------------------------------------------------------
+//************** Users deal with the following *************
+
+// User routine to handle a change in button state.  This is called when
+// the button callback is called (when a message from its counterpart
+// across the connection arrives). The pinch glove has 5 different states of on
+// since it knows which fingers are touching.  This pinch glove behavior is
+// non-standard and will be removed in a future version.  Button states should
+// be considered like booleans.
+#define VRPN_BUTTON_OFF (0)
+#define VRPN_BUTTON_ON (1)
+
+typedef struct _vrpn_BUTTONCB {
+    struct timeval msg_time; // Time of button press/release
+    vrpn_int32 button;       // Which button (numbered from zero)
+    vrpn_int32 state;        // button state (0 = off, 1 = on)
+} vrpn_BUTTONCB;
+typedef void(VRPN_CALLBACK *vrpn_BUTTONCHANGEHANDLER)(void *userdata,
+                                                      const vrpn_BUTTONCB info);
+
+// This is a new button callback type that was added in VRPN 7.31.  It
+// tells the current state of all of the buttons on the device.  It is
+// called whenever a button server receives a new connection request.  It
+// is intended to deal with the issue of not knowing what state toggled
+// buttons are in when a client connects.
+typedef struct _vrpn_BUTTONSTATECB {
+    struct timeval msg_time;                    // Timestamp of analog data
+    vrpn_int32 num_buttons;                     // how many buttons
+    vrpn_int32 states[vrpn_BUTTON_MAX_BUTTONS]; // button state values
+} vrpn_BUTTONSTATESCB;
+typedef void(VRPN_CALLBACK *vrpn_BUTTONSTATESHANDLER)(
+    void *userdata, const vrpn_BUTTONSTATESCB info);
+
+// Open a button that is on the other end of a connection
+// and handle updates from it.  This is the type of button that user code will
+// deal with.
+
+class VRPN_API vrpn_Button_Remote : public vrpn_Button {
+public:
+    // The name of the button device to connect to. Optional second
+    // argument is used when you already have an open connection you
+    // want it to listen on.
+    vrpn_Button_Remote(const char *name, vrpn_Connection *cn = NULL);
+    virtual ~vrpn_Button_Remote(void);
+
+    // This routine calls the mainloop of the connection it's on
+    virtual void mainloop();
+
+    // (un)Register a callback handler to handle a button state change
+    virtual int register_change_handler(void *userdata,
+                                        vrpn_BUTTONCHANGEHANDLER handler)
+    {
+        return d_callback_list.register_handler(userdata, handler);
+    };
+    virtual int unregister_change_handler(void *userdata,
+                                          vrpn_BUTTONCHANGEHANDLER handler)
+    {
+        return d_callback_list.unregister_handler(userdata, handler);
+    }
+
+    // (un)Register a callback handler to handle buttons states reports
+    virtual int register_states_handler(void *userdata,
+                                        vrpn_BUTTONSTATESHANDLER handler)
+    {
+        return d_states_callback_list.register_handler(userdata, handler);
+    };
+    virtual int unregister_states_handler(void *userdata,
+                                          vrpn_BUTTONSTATESHANDLER handler)
+    {
+        return d_states_callback_list.unregister_handler(userdata, handler);
+    }
+
+protected:
+    vrpn_Callback_List<vrpn_BUTTONCB> d_callback_list;
+    static int VRPN_CALLBACK
+    handle_change_message(void *userdata, vrpn_HANDLERPARAM p);
+
+    vrpn_Callback_List<vrpn_BUTTONSTATESCB> d_states_callback_list;
+    static int VRPN_CALLBACK
+    handle_states_message(void *userdata, vrpn_HANDLERPARAM p);
+};
+
+#define VRPN_BUTTON_H
+#endif
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_Configure.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_Configure.h
new file mode 100644
index 0000000000000000000000000000000000000000..dc7960402de6df6d24d5b4d8889bb488b040e632
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_Configure.h
@@ -0,0 +1,544 @@
+#ifndef VRPN_CONFIGURE_H
+
+//--------------------------------------------------------------
+/* IMPORTANT NOTE: If this file is named vrpn_Configure.h, it is
+   AUTOMATICALLY GENERATED from vrpn_Configure.h.cmake_in
+   using the options selected in CMake. Do not edit this
+   autogenerated vrpn_Configure.h because your changes will be
+   overwritten.
+
+   Until all modules are fully configured using CMake, you may
+   have to edit the paths that are listed near the bottom of the
+   first section of the input file, vrpn_Configure.h.cmake_in
+   then re-run CMake to regenerate vrpn_Configure.h. */
+//--------------------------------------------------------------
+
+// If true, only build the client-side code into the VRPN library.
+// This makes it smaller and requires less linking with external
+// libraries.
+//
+// If this is defined in this header file, it means that only the
+// client library was built, so the header file was able to show
+// this specialization. If it's not defined here, that may mean both
+// libraries were built, passing the definition for the client library
+// directly to the compiler, meaning that defining it in your app
+// is up to you.
+//
+// The ifndef here means that it's always safe for you to define
+// VRPN_CLIENT_ONLY without risking re-definition warnings/errors.
+#ifndef VRPN_CLIENT_ONLY
+#define VRPN_CLIENT_ONLY
+#endif
+
+//--------------------------------------------------------------
+/* This file contains configuration options for VRPN.  The first
+   section has definition lines that can be commented in or out
+   at build time.  The second session has automaticly-generated
+   directives and should not be edited. */
+//--------------------------------------------------------------
+
+//--------------------------------------------------------//
+// EDIT BELOW THIS LINE FOR NORMAL CONFIGURATION SETTING. //
+//--------------------------------------------------------//
+
+//-----------------------
+// Default port to listen on for a server.  It used to be 4500
+// up through version 6.03, but then all sorts of VPNs started
+// using this, as did Microsoft.  Port 3883 was assigned to VRPN
+// by the Internet Assigned Numbers Authority (IANA) October, 2003.
+// Change this to make a location-specific default if you like.
+// The parentheses are to keep it from being expanded into something
+// unexpected if the code has a dot after it.
+#define vrpn_DEFAULT_LISTEN_PORT_NO (3883)
+
+//-----------------------
+// Use the std::chrono library for time, rather than gettimeofday.
+/* #undef VRPN_USE_STD_CHRONO */
+
+//-----------------------
+// Use compile-time static asserts.
+#define VRPN_USE_STATIC_ASSERTIONS
+
+//-----------------------
+// Use Winsock2 library rather than Winsock.
+#define VRPN_USE_WINSOCK2
+
+//-----------------------
+// Instructs VRPN to expose the vrpn_gettimeofday() function also
+// as gettimeofday() so that external programs can use it.  This
+// is put here for Windows.  This function should not really be
+// implemented within VRPN, but it was expedient to include it
+// when porting applications to Windows.  Turn this off if you have
+// another implementation, or if you want to only call
+// vrpn_gettimeofday() directly.
+/* #undef VRPN_EXPORT_GETTIMEOFDAY */
+
+//-----------------------
+// Tells VRPN to compile with support for the Message-Passing
+// Interface (MPI) library.  There is a configuration section below
+// that has a library path for the MPI library to link against.
+// You will need to add the path to mpi.h and other needed files
+// into your Visual Studio Tools/Options/Projects and Solutions/
+// C++ Directories include path.  The original implementation is
+// done with MPICH2, but an attempt has been made to use only
+// MPI version 1 basic functions.
+/* #undef VRPN_USE_MPI */
+
+//-----------------------
+// Tells VRPN to compile with support for the Modbus
+// library.
+/* #undef VRPN_USE_MODBUS */
+
+//-----------------------
+// Instructs VRPN to use phantom library to construct a unified
+// server, using phantom as a common device, and phantom
+// configuration in .cfg file.
+/* #undef VRPN_USE_PHANTOM_SERVER */
+
+//------------------------
+// Instructs vrpn to use SensAble's HDAPI rather than GHOST library.
+// Only used in conjuntion with VRPN_USE_PHANTOM_SERVER.
+// PLEASE SPECIFY PATH TO HDAPI IN NEXT SECTION IF YOU USE THIS.
+// Also, you need to go to the vrpn_phantom and vrpn_server projects
+// and remove the GHOST include directories from the include paths.
+// Yes, HDAPI fails if it even has them in the path (as so many other
+// things also fail).  At least we're rid of them now.  When you
+// uncomment it (to use GHOST), add the following to the include
+// directories for the vrpn_phantom project: $(SYSTEMDRIVE)\Program
+// Files\SensAble\GHOST\v4.0\include,$(SYSTEMDRIVE)\Program
+// Files\SensAble\GHOST\v4.0\external\stl,
+/* #undef VRPN_USE_HDAPI */
+
+//------------------------
+// Instructs vrpn to use Ghost 3.1 instead of Ghost 3.4.
+// Only used in conjuntion with VRPN_USE_PHANTOM_SERVER.
+// PLEASE SPECIFY PATH TO GHOSTLIB IN NEXT SECTION IF YOU USE THIS
+// (This is expected to be used on systems where Ghost 4.0 is not
+// available, such as the SGI platform.  If you are using this on
+// a Windows PC with Visual Studio, you will need to alter
+// server_src/vrpn_phantom.dsp to reference the Ghost 3.1 include
+// paths.)
+/* #undef VRPN_USE_GHOST_31 */
+
+//-----------------------
+// Instructs VRPN to use the high-performance timer code on
+// Windows, rather than the default clock which has an infrequent
+// update.  At one point in the past, an implementation of this
+// would only work correctly on some flavors of Windows and with
+// some types of CPUs.
+// There are actually two implementations
+// of the faster windows clock.  The original one, made by Hans
+// Weber, checks the clock rate to see how fast the performance
+// clock runs (it takes a second to do this when the program
+// first calls vrpn_gettimeofday()).  The second version by Haris
+// Fretzagias relies on the timing supplied by Windows.  To use
+// the second version, also define VRPN_WINDOWS_CLOCK_V2.
+#define VRPN_UNSAFE_WINDOWS_CLOCK
+#define VRPN_WINDOWS_CLOCK_V2
+
+//-----------------------
+// Instructs VRPN library and server to include code that uses
+// the DirectX SDK.  If you set this, you may to edit the
+// system configuration section below to point at the correct version
+// of DirectX.  WARNING: With the August 2006 DirectX SDK, you
+// cannot link against the debug library in Visual Studio 6.0,
+// only the release.  Hopefully, Visual Studio.NET doesn't have
+// this problem.
+// IMPORTANT!  If you define this, you need to edit the Tools/Options
+// menu:
+//    For Visual studio 6, use the Directories tab, and add the
+// include and lib paths to the TOP of the lists for all configurations.
+//    For Visual studio .NET, add to the top of the Projects and Solutions/
+//  VC++ Directories entry.
+//    This will let the code find the right version when it compiles.
+/* #undef VRPN_USE_DIRECTINPUT */
+/* #undef VRPN_USE_WINDOWS_XINPUT */
+
+// The DirectInput-based zSight tracker requires ATL for smart pointers,
+// which sadly isn't everywhere (VC Express, MXE cross compiling, ...).
+#define VRPN_HAVE_ATLBASE
+
+//-----------------------
+// Instructs VRPN library and server to include code that uses
+// the DirectShow SDK.  If you set this, you may to edit the
+// system configuration section below to point at the correct version
+// of the Platform SDK.  WARNING: With the August 2006 DirectX SDK, you
+// cannot link against the debug library in Visual Studio 6.0,
+// only the release.  Visual Studio.NET doesn't have this problem.
+/* #undef VRPN_USE_DIRECTSHOW */
+
+//-----------------------
+// Instructs the VRPN server to create an entry for the Adrienne
+// time-code generator.  This is a device that produces time values
+// from an analog video stream so that events in the virtual world
+// can be synchronized with events on a movie.  The Adrienne folder
+// should be located at the same level as the VRPN folder for the
+// code to find it.
+/* #undef VRPN_INCLUDE_TIMECODE_SERVER */
+/* #undef VRPN_ADRIENNE_INCLUDE_FILENAME */
+/* #undef VRPN_ADRIENNE_INCLUDE_HAS_EXTERN_C */
+
+//-----------------------
+// Compiles the InterSense Tracker using the
+// InterSense Interface Libraries SDK (tested for version
+// 3.45) on windows.  This should work with all Intersense trackers,
+// both the USB and the serial port versions.  The files isense.h,
+// types.h and isense.c should be put in a directory called 'isense'
+// at the same level as the vrpn directory.  The isense.dll should
+// be put either in Windows/system32 or in the location where the
+// executable lives or somewhere on the path.
+/* #undef VRPN_INCLUDE_INTERSENSE */
+
+//-----------------------
+// Instructs VRPN library and server to include code that uses
+// the National Instruments Nidaq library to control analog outputs.
+// Later in this file, we also instruct the compiler to link with
+// the National Instruments libraries if this is defined.  Either or
+// both of these can be defined, depending on which library you
+// need to use.
+/* #undef VRPN_USE_NATIONAL_INSTRUMENTS */
+/* #undef VRPN_USE_NATIONAL_INSTRUMENTS_MX */
+
+//-----------------------
+// Instructs VRPN library and server to include code that uses
+// the US Digital SEI/A2 library to control analog inputs from the
+// A2 absolute encoder.
+// Later in this file, we also instruct the compiler to link with
+// the US Digital library if this is defined.  You also need to
+// define VRPN_USE_NATIONAL_INSTRUMENTS_MX above if you want to
+// use this.
+/* #undef VRPN_USE_USDIGITAL */
+
+//-----------------------
+// Instructs VRPN to use the default room space transforms for
+// the Desktop Phantom as used in the nanoManipulator application
+// rather than the default world-origin with identity rotation.
+// Please don't anyone new use the room space transforms built
+// into VRPN -- they are a hack pulled forward from Trackerlib.
+#define DESKTOP_PHANTOM_DEFAULTS
+
+//------------------------
+// Instructs VRPN to use microscribe3D library to construct a unified
+// server
+/* #undef VRPN_USE_MICROSCRIBE */
+
+//------------------------
+// Compiles the VRPN library with the PhaseSpace Tracker using the
+// PhaseSpace OWL API on Linux and Windows.
+//
+// In Linux:
+// The PhaseSpace header files (owl.h, etc) and libraries (libowlsock)
+// should be placed in the phasespace directory at the same level as
+// the vrpn folder.  Also, PHASESPACE needs to be uncommented in the
+// server_src/Makefile so that the libraries are properly linked.
+// libowlsock.so will need to be present in the directory of the
+// final executable or in the default library path such as /usr/lib
+//
+// In Windows:
+// The PhaseSpace header files (owl.h, etc) should be placed in the
+// phasespace directory at the same level as the vrpn folder.
+// libowlsock.lib will need to be located there as well.
+// libowlsock.dll will need to be in the path or with the executable
+// at run time.  Edit the path below to say where the .lib file
+// can be found.
+//
+/* #undef VRPN_INCLUDE_PHASESPACE */
+
+//-----------------------
+// Instructs VRPN to use a DLL interface on Windows systems.
+// When using this, link with VRPNDLL.LIB (and VRPN.DLL) rather
+// than VRPN.LIB in user code.  This is experimental and is
+// under development to enable C# and other languages to pull in
+// VRPN.  This is only needed when trying to link VRPN with
+// languages other than C++ (and not even for Java).  If you don't
+// have a good reason to, don't define it.
+// Not implemented for .so-based Unix systems.
+/* #undef VRPN_USE_SHARED_LIBRARY */
+
+//------------------------
+// Instructs VRPN to use GPM Linux interface mouse interface.
+// WARNING: If you define this, then you must also edit the server_src
+// Makefile to include "-lgpm" into the SYSLIBS definition line for the
+// architecture you use this on.  We had to change this because not all
+// Linux releases included this library.
+/* #undef VRPN_USE_GPM_MOUSE */
+
+//------------------------
+// Instructs VRPN to use the Motion C API library to interface VRPN to
+// the their MotionNode tracker. Requires the shared library at run-time
+// to function. No external dependencies to build.
+/* #undef VRPN_USE_MOTIONNODE */
+
+//------------------------
+// Instructs VRPN to compile code for the Nintendo Wii Remote controller,
+// getting access to it through the Wiiuse library in Windows and Linux.
+// Note that this requires installing a bunch of other stuff, and that some
+// bluetooth stacks cause people trouble.  See the README file in the WiiUse
+// library for more info.  Also note that the
+// WiiUse library is GPL, which is more restrictive than the VRPN public-
+// domain license, so check out its license file before building this driver
+// into your code.  The original WiiUse library was abandoned and a new
+// fork by Ryan Pavlik is available at https://github.com/rpavlik/wiiuse.
+// To get the WiiUse library to compile on Visual Studio 2005 (apparently
+// not for VS 2008), you need to add the include path
+// to the driver developer kit (C:\WINDDK\3790.1830\inc\wxp) and the
+// library path to hid.lib (C:\WINDDK\3790.1830\lib\wxp\i386) to the
+// include and library directories in Visual Studio.
+// Also, edit the configuration below to point to the WiiUse include
+// file and library.
+// Note that the wiiuse.dll needs to be in the path when running a server
+// that uses WiiUse in Windows.
+/* #undef VRPN_USE_WIIUSE */
+
+// Instructs VRPN to compile code to handle Hillcrest Labs' Freespace
+// devices such as the Loop, and FRCM.  You will also need the libfreespace
+// library which is available at
+// http://libfreespace.hillcrestlabs.com/content/download.
+// There are prebuilt binaries for Windows, and source available that should
+// work on Windows, Linux or OS X.  You will need to make sure the header files
+// and library are accessible to the compiler.  libfreespace is released under
+// the LGPL and we (Hillcrest Labs) view static and dynamic linking as the same.
+// We (Hillcrest Labs) do not require code linked to libfreespace (statically or
+// dynamically) to be released under any particular license.
+/* #undef VRPN_USE_FREESPACE */
+
+//------------------------
+// Instructs VRPN to include code for the Novint Falcon haptic device.
+// Access is provided through the libnifalcon library library on Windows,
+// MacOSX and Linux. This may require additional libraries for programming
+// USB devices. Please consult the corresponding homepages.
+/* #undef VRPN_USE_LIBNIFALCON */
+
+//------------------------
+// (OBSOLETE) Instructs VRPN to compile code to use Trivisio's Colibri inertial
+// tracker.  You will also need the SDK, which is available at
+// http://www.trivisio.com/products/motiontracking/colibri#download
+// (tested on Windows).  VRPN_TRIVISIOCOLIBRI_H and
+// VRPN_TRIVISIOCOLIBRI_LIB_PATH
+// below point to the default installation locations on Windows.  Edit them
+// if installed elsewhere.  Note that Trivisio.dll and pthreadVC2.dll need to be
+// in
+// the path when running the server on Windows
+/* #undef VRPN_USE_TRIVISIOCOLIBRI */
+
+//------------------------
+// Compiles the VRPN library with the Trivisio Colibri tracker using the
+// ColibriAPI on Linux and Windows.
+//
+// In Linux:
+// The header files (colibri_api.h, etc) and library (colibri-api)
+// should be placed in the /vrpn/trivisio directory.
+// libcolibri-api.so will need to be present in the default library path
+// such as /usr/lib
+//
+// In Windows:
+// The header files (colibri_api.h, etc) should be placed in the
+// in the \vrpn\trivisio directory.
+// colibri-api.lib will need to be located there as well.
+// colibri-api.dll will need to be in the path or with the executable
+// at run time.
+/* #undef VRPN_USE_COLIBRIAPI */
+
+//------------------------
+// Instructs VRPN to attempt to use HID.  If you don't have libusb installed
+// on Linux, you'll want to turn this off so that it doesn't fail to compile.
+// This should work fine on Windows and Mac.
+/* #undef VRPN_USE_HID */
+
+//------------------------
+// Instructs VRPN to link in the source code to a local version of
+// hidapi to access HID devices.  The source code for this project
+// is included as a git submodule under submodule/hidapi.  To pull
+// this down if it is not present, use the commands:
+// 'git submodule init; git submodule update' from the vrpn directory.
+// If you have a system hidapi and you prefer to use it, then do not
+// define this here.  Otherwise, define it so that VRPN will be able
+// to access HID devices.
+// Note that on Linux you will also need to have the libusb package
+// installed in order to compile HIDAPI.  You'll also need to uncomment
+// the Makefile line in server_src that links with usb.
+/* #undef VRPN_USE_LOCAL_HIDAPI */
+
+//------------------------
+// Instructs VRPN to attempt to use LibUSB-1.0. This will compile and
+// link servers that use USB directly (as opposed to those that use it
+// through the HID interface).
+// See http://libusb.sourceforge.net for more on LibUSB-1.0.
+// Note that on Linux you will also need to have the libusb-1.0-0-dev
+// package installed so that we can compile the code.  You
+// will also need to uncommment the SYSLIBS line for HID in the
+// server_src/Makefile for this to link.
+// Note that to compile on Windows you will need to have downloaded and
+// installed
+// the libusb.h file and libusb-1.0.lib files; the default location for
+// the library is C:Program Files\libusb-1.0 and for the include file
+// is in C:Program Files\libusb-1.0\libusb.  To open a device on Windows, you
+// will need to have installed a driver that lets LibUSB open the
+// device.  Generic HID devices and devices that use a WinUSB driver
+// should work without adding a driver.  If you need to add a driver,
+// consider using the libUSB Zadig.exe program; do not do this for a
+// HID device or a device that has another driver, as it can prevent the
+// device from operating except through LibUSB.
+// Note that on Linux you will also need to have the libusb-1.0-0-dev
+// package installed so that we can compile the code.
+/* #undef VRPN_USE_LIBUSB_1_0 */
+
+// Instructs VRPN to compile code to handle JSON network messages.
+// This requires jsoncpp.
+// JSON Network (UDP) mesages are used by the vrpn widgets for Android,
+/* #undef VRPN_USE_JSONNET */
+
+//------------------------
+// Instructs VRPN to compile code to use the Arrington Research
+// ViewPoint EyeTracker.  You will also need to set VRPN_VIEWPOINT_H
+// and VRPN_VIEWPOINT_LIB_PATH below to point to the correct location
+// on your system.  Note that the VRPN server and ViewPoint calibration
+// software must use the same copy of the VPX_InterApp.dll
+/* #undef VRPN_USE_VIEWPOINT */
+#define VRPN_VIEWPOINT_H "vpx.h"
+/* #undef VRPN_VIEWPOINT_LIB_PATH */
+
+//------------------------
+// Use DevInput devices.
+/* #undef VRPN_USE_DEV_INPUT */
+
+//-------------------------
+// Use Linux kernel joystick support:
+// note that using this kernel header
+// makes the GPL apply to the server!
+/* #undef VRPN_USE_JOYLIN */
+
+//------------------------
+// Instructs VRPN to compile code to use the Polhemus Developer
+// (PDI) library to enable opening several of their trackers using
+// this interface (the G4 was the original one this was written
+// for, but new versions are available for the Fastrak and Liberty).
+/* #undef VRPN_USE_PDI */
+
+//------------------------------------------------------------------//
+// SYSTEM CONFIGURATION SECTION                                     //
+// EDIT THESE DEFINITIONS TO POINT TO OPTIONAL LIBRARIES.  THEY ARE //
+// USED BELOW TO LOCATE LIBRARIES AND INCLUDE FILES.                //
+//------------------------------------------------------------------//
+
+#define VRPN_SYSTEMDRIVE "C:"
+
+#define VRPN_PHASESPACE_LIB_PATH "../../phasespace/"
+
+#define VRPN_WIIUSE_H "wiiuse.h"
+
+#define VRPN_TRIVISIOCOLIBRI_H                                                 \
+    "C:/Program Files/Trivisio/Colibri/include/TrivisioColibri.h"
+#define VRPN_TRIVISIOCOLIBRI_LIB_PATH "C:/Program Files/Trivisio/Colibri/lib/"
+#define VRPN_GHOST_31_PATH                                                     \
+    VRPN_SYSTEMDRIVE "/Program Files/SensAble/GHOST/v3.1/lib/"
+#define VRPN_GHOST_40_PATH                                                     \
+    VRPN_SYSTEMDRIVE "/Program Files/SensAble/GHOST/v4.0/lib/"
+
+#define VRPN_NIDAQ_PATH                                                        \
+    VRPN_SYSTEMDRIVE "/Program Files/National Instruments/NI-DAQ/Lib/"
+#define VRPN_USDIGITAL_PATH VRPN_SYSTEMDRIVE "/Program Files/SEI Explorer/"
+
+//---------------------------------------------------------------//
+// DO NOT EDIT BELOW THIS LINE FOR NORMAL CONFIGURATION SETTING. //
+//---------------------------------------------------------------//
+
+// Use this macro in a file if it might be empty (compiling out completely)
+// to squash Visual Studio warning LNK4221.
+// Inspiration from
+// http://stackoverflow.com/questions/1822887/what-is-the-best-way-to-eliminate-ms-visual-c-linker-warning-warning-lnk422
+#ifdef _MSC_VER
+#define VRPN_SUPPRESS_EMPTY_OBJECT_WARNING()                                   \
+    namespace {                                                                \
+        char vrpn_SuppressEmptyObjectDummy##__LINE__;                          \
+    }
+#else
+#define VRPN_SUPPRESS_EMPTY_OBJECT_WARNING()
+#endif
+
+// autolinking pragma only works/makes sense with MSVC
+#ifdef _MSC_VER // [
+
+// Load National Instruments libraries if we are using them.
+// If this doesn't match where you have installed these libraries,
+// edit the following lines to point at the correct libraries.  Do
+// this here rather than in the project settings so that it can be
+// turned on and off using the definition above.
+// NOTE: The paths to these libraries are set in the Settings/Link tab of
+// the various project files.  The paths to the include files are in the
+// Settings/C++/preprocessor tab.
+#ifdef VRPN_USE_NATIONAL_INSTRUMENTS
+#pragma comment(lib, VRPN_NIDAQ_PATH "nidaq32.lib")
+#pragma comment(lib, VRPN_NIDAQ_PATH "nidex32.lib")
+#endif
+
+// Load US Digital libraries if we are using them.
+// If this doesn't match where you have installed these libraries,
+// edit the following lines to point at the correct libraries.  Do
+// this here rather than in the project settings so that it can be
+// turned on and off using the definition above.
+// NOTE: The paths to these libraries are set in the Settings/Link tab of
+// the various project files.  The paths to the include files are in the
+// Settings/C++/preprocessor tab.
+#ifdef VRPN_USE_USDIGITAL
+#pragma comment(lib, VRPN_USDIGITAL_PATH "SEIDrv32.lib")
+#endif
+
+// Load Microscribe-3D SDK libraries
+// If this doesn't match where you have installed these libraries,
+// edit the following lines to point at the correct libraries.  Do
+// this here rather than in the project settings so that it can be
+// turned on and off using the definition above.
+#ifdef VRPN_USE_MICROSCRIBE
+#pragma comment(lib, "armdll32.lib")
+#endif
+
+// Load Trivisio Colibri library
+#ifdef VRPN_USE_TRIVISIOCOLIBRI
+#pragma comment(lib, VRPN_TRIVISIOCOLIBRI_LIB_PATH "Trivisio.lib")
+#endif
+
+#endif // ] _MSC_VER
+
+// This will be defined in the VRPN (non-DLL) project and nothing else
+// Overrides USE_SHARED_LIBRARY to get rid of "inconsistent DLL linkage"
+// warnings.
+#ifdef VRPNDLL_NOEXPORTS
+#undef VRPN_USE_SHARED_LIBRARY
+#endif
+
+// This will be defined in the VRPN (DLL) project and nothing else
+// Forces "USE_SHARED_LIBRARY independent of definition above so that the
+// DLL will build
+#if defined(VRPNDLL_EXPORTS) && !defined(VRPN_USE_SHARED_LIBRARY)
+#define VRPN_USE_SHARED_LIBRARY
+#endif
+
+// For client code, make sure we add the proper library dependency to the linker
+#ifdef _WIN32   // [
+#ifdef _MSC_VER // [
+#ifdef VRPN_USE_WINSOCK2
+#pragma comment(lib, "ws2_32.lib") // VRPN requires the Windows Sockets library.
+#else
+#pragma comment(lib,                                                           \
+                "wsock32.lib") // VRPN requires the Windows Sockets library.
+#endif
+#endif // ] _MSC_VER
+#ifdef VRPN_USE_SHARED_LIBRARY
+#ifdef VRPNDLL_EXPORTS
+#define VRPN_API __declspec(dllexport)
+#else
+#define VRPN_API __declspec(dllimport)
+#endif
+#else
+#define VRPN_API
+#endif
+#define VRPN_CALLBACK __stdcall
+#else // ] WIN32 [
+// In the future, other architectures may need their own sections
+#define VRPN_API
+#define VRPN_CALLBACK
+#endif // ] not WIN32
+
+#define VRPN_CONFIGURE_H
+#endif
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_Connection.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_Connection.h
new file mode 100644
index 0000000000000000000000000000000000000000..e97e2c17bc7b9e67c4a9881430bac8beaaaaeb1f
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_Connection.h
@@ -0,0 +1,1185 @@
+#ifndef VRPN_CONNECTION_H
+#define VRPN_CONNECTION_H
+
+#include <stdio.h> // for NULL, sprintf
+
+#include "vrpn_Configure.h" // for VRPN_API, VRPN_CALLBACK, etc
+#include "vrpn_Shared.h"    // for SOCKET, timeval
+#include "vrpn_Types.h"     // for vrpn_int32, vrpn_uint32, etc
+#include "vrpn_EndpointContainer.h"
+
+#if !(defined(_WIN32) && defined(VRPN_USE_WINSOCK_SOCKETS))
+#include <sys/select.h> // for fd_set
+#endif
+
+struct timeval;
+
+// Don't complain about using sprintf() when using Visual Studio.
+#ifdef _MSC_VER
+#pragma warning(disable : 4995 4996)
+#endif
+
+/// This is the list of states that a connection can be in
+/// (possible values for status).  doing_okay() returns VRPN_TRUE
+/// for connections > BROKEN.
+enum vrpn_ConnectionStatus {
+    LISTEN = (1),
+    CONNECTED = (0),
+    COOKIE_PENDING = (-1),
+    TRYING_TO_CONNECT = (-2),
+    BROKEN = (-3),
+    LOGGING = (-4)
+};
+
+class VRPN_API
+    vrpn_File_Connection; // Forward declaration for get_File_Connection()
+
+/// @brief This structure is what is passed to a vrpn_Connection message
+/// callback.
+///
+/// It is used by objects, but not normally by user code.
+struct vrpn_HANDLERPARAM {
+    vrpn_int32 type;
+    vrpn_int32 sender;
+    struct timeval msg_time;
+    vrpn_int32 payload_len;
+    const char *buffer;
+};
+
+/// @brief Type of a message handler for vrpn_Connection messages.
+typedef int(VRPN_CALLBACK *vrpn_MESSAGEHANDLER)(void *userdata,
+                                                vrpn_HANDLERPARAM p);
+
+/// @brief  Type of handler for filters on logfiles is the same as connection
+/// handler
+typedef vrpn_MESSAGEHANDLER vrpn_LOGFILTER;
+
+/// VRPN buffers are aligned on 8 byte boundaries so that we can pack and
+/// unpack doubles into them on architectures that cannot handle unaligned
+/// access.
+const unsigned vrpn_ALIGN = 8;
+
+/// Types now have their storage dynamically allocated, so we can afford
+/// to have large tables.  We need at least 150-200 for the microscope
+/// project as of Jan 98, and will eventually need two to three times that
+/// number.
+/// @{
+const int vrpn_CONNECTION_MAX_SENDERS = 2000;
+const int vrpn_CONNECTION_MAX_TYPES = 2000;
+/// @}
+
+/// @brief vrpn_ANY_SENDER can be used to register callbacks on a given message
+/// type from any sender.
+
+const int vrpn_ANY_SENDER = -1;
+
+/// @brief vrpn_ANY_TYPE can be used to register callbacks for any USER type of
+/// message from a given sender.  System messages are handled separately.
+
+const int vrpn_ANY_TYPE = -1;
+
+/// @name Buffer lengths for TCP and UDP.
+///
+/// TCP is an arbitrary number that can be changed by the user
+/// using vrpn_Connection::set_tcp_outbuf_size().
+/// UDP is set based on Ethernet maximum transmission size;  trying
+/// to send a message via UDP which is longer than the MTU of any
+/// intervening physical network may cause untraceable failures,
+/// so for now we do not expose any way to change the UDP output
+/// buffer size.  (MTU = 1500 bytes, - 28 bytes of IP+UDP header)
+/// @{
+
+const int vrpn_CONNECTION_TCP_BUFLEN = 64000;
+const int vrpn_CONNECTION_UDP_BUFLEN = 1472;
+/// @}
+
+/// @brief Number of endpoints that a server connection can have.  Arbitrary
+/// limit.
+
+const int vrpn_MAX_ENDPOINTS = 256;
+
+/// @name System message types
+/// @{
+const vrpn_int32 vrpn_CONNECTION_SENDER_DESCRIPTION = (-1);
+const vrpn_int32 vrpn_CONNECTION_TYPE_DESCRIPTION = (-2);
+const vrpn_int32 vrpn_CONNECTION_UDP_DESCRIPTION = (-3);
+const vrpn_int32 vrpn_CONNECTION_LOG_DESCRIPTION = (-4);
+const vrpn_int32 vrpn_CONNECTION_DISCONNECT_MESSAGE = (-5);
+/// @}
+
+/// Classes of service for messages, specify multiple by ORing them together
+/// Priority of satisfying these should go from the top down (RELIABLE will
+/// override all others).
+/// Most of these flags may be ignored, but RELIABLE is guaranteed
+/// to be available.
+/// @{
+
+const vrpn_uint32 vrpn_CONNECTION_RELIABLE = (1 << 0);
+const vrpn_uint32 vrpn_CONNECTION_FIXED_LATENCY = (1 << 1);
+const vrpn_uint32 vrpn_CONNECTION_LOW_LATENCY = (1 << 2);
+const vrpn_uint32 vrpn_CONNECTION_FIXED_THROUGHPUT = (1 << 3);
+const vrpn_uint32 vrpn_CONNECTION_HIGH_THROUGHPUT = (1 << 4);
+
+/// @}
+
+/// @name What to log
+/// @{
+const long vrpn_LOG_NONE = (0);
+const long vrpn_LOG_INCOMING = (1 << 0);
+const long vrpn_LOG_OUTGOING = (1 << 1);
+/// @}
+
+// If defined, will filter out messages:  if the remote side hasn't
+// registered a type, messages of that type won't be sent over the
+// link.  WARNING:  auto-type-registration breaks this.
+//#define vrpn_FILTER_MESSAGES
+
+/// These are the strings that define the system-generated message
+/// types that tell when connections are received and dropped.
+/// @{
+extern VRPN_API const char *vrpn_got_first_connection;
+extern VRPN_API const char *vrpn_got_connection;
+extern VRPN_API const char *vrpn_dropped_connection;
+extern VRPN_API const char *vrpn_dropped_last_connection;
+/// @}
+
+/// @brief vrpn_CONTROL is the sender used for notification messages sent to the
+/// user
+/// from the local VRPN implementation (got_first_connection, etc.)
+/// and for control messages sent by auxiliary services.  (Such as
+/// class vrpn_Controller, which will be introduced in a future revision.)
+
+extern VRPN_API const char *vrpn_CONTROL;
+
+/// @brief Length of names within VRPN
+typedef char cName[100];
+
+/// Placed here so vrpn_FileConnection can use it too.
+struct VRPN_API vrpn_LOGLIST {
+    vrpn_HANDLERPARAM data;
+    vrpn_LOGLIST *next;
+    vrpn_LOGLIST *prev;
+};
+
+class VRPN_API vrpn_Endpoint_IP;
+class VRPN_API vrpn_Connection;
+
+/// @brief Function pointer to an endpoint allocator.
+typedef vrpn_Endpoint_IP *(*vrpn_EndpointAllocator)(
+    vrpn_Connection *connection, vrpn_int32 *numActiveConnections);
+
+namespace vrpn {
+
+    /// @brief Combines the function pointer for an Endpoint Allocator with its
+    /// two arguments into a single callable object, with the ability to
+    /// override the last parameter at call time.
+    class BoundEndpointAllocator {
+    public:
+        BoundEndpointAllocator()
+            : epa_(NULL)
+            , conn_(NULL)
+            , numActiveEndpoints_(NULL)
+        {
+        }
+        BoundEndpointAllocator(vrpn_EndpointAllocator epa,
+                               vrpn_Connection *conn,
+                               vrpn_int32 *numActiveEndpoints = NULL)
+            : epa_(epa)
+            , conn_(conn)
+            , numActiveEndpoints_(numActiveEndpoints)
+        {
+        }
+
+        typedef vrpn_Endpoint_IP *return_type;
+
+        /// @brief Default, fully pre-bound
+        return_type operator()() const
+        {
+            if (!epa_) {
+                return NULL;
+            }
+            return (*epa_)(conn_, numActiveEndpoints_);
+        }
+
+        /// @brief Overload, with alternate num active connnection pointer.
+        return_type operator()(vrpn_int32 *alternateNumActiveEndpoints) const
+        {
+            if (!epa_) {
+                return NULL;
+            }
+            return (*epa_)(conn_, alternateNumActiveEndpoints);
+        }
+
+    private:
+        vrpn_EndpointAllocator epa_;
+        vrpn_Connection *conn_;
+        vrpn_int32 *numActiveEndpoints_;
+    };
+} // namespace vrpn
+/// @todo HACK
+/// These structs must be declared outside of vrpn_Connection
+/// (although we'd like to make them protected/private members)
+/// because aCC on PixelFlow doesn't handle nested classes correctly.
+/// @{
+
+/// @brief Description of a callback entry for a user type.
+struct vrpnMsgCallbackEntry {
+    vrpn_MESSAGEHANDLER handler; ///< Routine to call
+    void *userdata;              ///< Passed along
+    vrpn_int32 sender;           ///< Only if from sender
+    vrpnMsgCallbackEntry *next;  ///< Next handler
+};
+
+struct vrpnLogFilterEntry {
+    vrpn_LOGFILTER filter; ///< routine to call
+    void *userdata;        ///< passed along
+    vrpnLogFilterEntry *next;
+};
+/// @}
+
+class VRPN_API vrpn_Connection;
+class VRPN_API vrpn_Log;
+class VRPN_API vrpn_TranslationTable;
+class VRPN_API vrpn_TypeDispatcher;
+
+/// @brief Encapsulation of the data and methods for a single generic connection
+/// to take care of one part of many clients talking to a single server.
+///
+/// This will only be used from within the vrpn_Connection class;  it should
+/// not be instantiated by users or devices.
+/// Should not be visible!
+
+class VRPN_API vrpn_Endpoint {
+
+public:
+    vrpn_Endpoint(vrpn_TypeDispatcher *dispatcher,
+                  vrpn_int32 *connectedEndpointCounter);
+    virtual ~vrpn_Endpoint(void);
+
+    /// @name Accessors
+    /// @{
+
+    /// Returns the local mapping for the remote type (-1 if none).
+    int local_type_id(vrpn_int32 remote_type) const;
+
+    /// Returns the local mapping for the remote sender (-1 if none).
+    int local_sender_id(vrpn_int32 remote_sender) const;
+
+    virtual vrpn_bool doing_okay(void) const = 0;
+    /// @}
+
+    /// @name Manipulators
+    /// @{
+
+    void init(void);
+
+    virtual int mainloop(timeval *timeout) = 0;
+
+    /// Clear out the remote mapping list. This is done when a
+    /// connection is dropped and we want to try and re-establish
+    /// it.
+    void clear_other_senders_and_types(void);
+
+    /// A new local sender or type has been established; set
+    /// the local type for it if the other side has declared it.
+    /// Return 1 if the other side has one, 0 if not.
+    int newLocalSender(const char *name, vrpn_int32 which);
+    int newLocalType(const char *name, vrpn_int32 which);
+
+    /// Adds a new remote type/sender and returns its index.
+    /// Returns -1 on error.
+    /// @{
+    int newRemoteType(cName type_name, vrpn_int32 remote_id,
+                      vrpn_int32 local_id);
+    int newRemoteSender(cName sender_name, vrpn_int32 remote_id,
+                        vrpn_int32 local_id);
+    /// @}
+
+    /// Pack a message that will be sent the next time mainloop() is called.
+    /// Turn off the RELIABLE flag if you want low-latency (UDP) send.
+    virtual int pack_message(vrpn_uint32 len, struct timeval time,
+                             vrpn_int32 type, vrpn_int32 sender,
+                             const char *buffer,
+                             vrpn_uint32 class_of_service) = 0;
+
+    /// send pending report, clear the buffer.
+    /// This function was protected, now is public, so we can use it
+    /// to send out intermediate results without calling mainloop
+    virtual int send_pending_reports(void) = 0;
+
+    int pack_log_description(void);
+    ///< Packs the log description set by setup_new_connection().
+
+    virtual int setup_new_connection(void) = 0;
+    ///< Sends the magic cookie and other information to its
+    ///< peer.  It is called by both the client and server setup routines.
+
+    virtual void poll_for_cookie(const timeval *timeout = NULL) = 0;
+    virtual int finish_new_connection_setup(void) = 0;
+
+    virtual void drop_connection(void) = 0;
+    ///< Should only be called by vrpn_Connection::drop_connection(),
+    ///< since there's more housecleaning to do at that level.  I suppose
+    ///< that argues against separating this function out.
+
+    virtual void clearBuffers(void) = 0;
+    ///< Empties out the TCP and UDP send buffers.
+    ///< Needed by vrpn_FileConnection to get at {udp,tcp}NumOut.
+
+    int pack_sender_description(vrpn_int32 which);
+    ///< Packs a sender description over our socket.
+
+    int pack_type_description(vrpn_int32 which);
+    ///< Packs a type description.
+
+    /// @}
+    int status;
+
+    /// @todo XXX These should be protected; making them so will lead to making
+    ///    the code split the functions between Endpoint and Connection
+    ///    protected:
+
+    long d_remoteLogMode;     ///< Mode to put the remote logging in
+    char *d_remoteInLogName;  ///< Name of the remote log file
+    char *d_remoteOutLogName; ///< Name of the remote log file
+
+    ///< Name of the remote host we are connected to.  This is kept for
+    ///< informational purposes.  It is printed by the ceiling server,
+    ///< for example.
+    char rhostname[150];
+
+    /// @name Logging
+    ///
+    /// TCH 19 April 00;  changed into two logs 16 Feb 01
+    /// @{
+
+    vrpn_Log *d_inLog;
+    vrpn_Log *d_outLog;
+
+    void setLogNames(const char *inName, const char *outName);
+    int openLogs(void);
+    /// @}
+
+    /// @name Routines that handle system messages
+    ///
+    /// Visible so that vrpn_Connection can pass them to the Dispatcher
+    /// @{
+    static int VRPN_CALLBACK
+    handle_sender_message(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_type_message(void *userdata, vrpn_HANDLERPARAM p);
+    /// @}
+
+    /// @name Routines to inform the endpoint of the connection of
+    /// which it is a part.
+    /// @{
+    void setConnection(vrpn_Connection *conn) { d_parent = conn; }
+    vrpn_Connection *getConnection() { return d_parent; }
+    /// @}
+
+protected:
+    virtual int dispatch(vrpn_int32 type, vrpn_int32 sender, timeval time,
+                         vrpn_uint32 payload_len, char *bufptr);
+
+    int tryToMarshall(char *outbuf, vrpn_int32 &buflen, vrpn_int32 &numOut,
+                      vrpn_uint32 len, timeval time, vrpn_int32 type,
+                      vrpn_int32 sender, const char *buffer,
+                      vrpn_uint32 classOfService);
+    ///< Calls marshall_message();  if that fails, calls
+    ///< send_pending_reports() and then marshalls again.
+    ///< Returns the number of characters successfully marshalled.
+
+    int marshall_message(char *outbuf, vrpn_uint32 outbuf_size,
+                         vrpn_uint32 initial_out, vrpn_uint32 len,
+                         struct timeval time, vrpn_int32 type,
+                         vrpn_int32 sender, const char *buffer,
+                         vrpn_uint32 sequenceNumber);
+
+    // The senders and types we know about that have been described by
+    // the other end of the connection.  Also, record the local mapping
+    // for ones that have been described with the same name locally.
+    // The arrays are indexed by the ID from the other side, and store
+    // the name and local ID that corresponds to each.
+
+    vrpn_TranslationTable *d_senders;
+    vrpn_TranslationTable *d_types;
+
+    vrpn_TypeDispatcher *d_dispatcher;
+    vrpn_int32 *d_connectionCounter;
+
+    vrpn_Connection *d_parent;
+};
+
+/// @brief Encapsulation of the data and methods for a single IP-based
+/// connection
+/// to take care of one part of many clients talking to a single server.
+///
+/// This will only be used from within the vrpn_Connection_IP class;  it should
+/// not be instantiated by users or devices.
+/// Should not be visible!
+
+class VRPN_API vrpn_Endpoint_IP : public vrpn_Endpoint {
+
+public:
+    vrpn_Endpoint_IP(vrpn_TypeDispatcher *dispatcher,
+                     vrpn_int32 *connectedEndpointCounter);
+    virtual ~vrpn_Endpoint_IP(void);
+
+    /// @name Accessors
+    /// @{
+    virtual vrpn_bool doing_okay(void) const;
+
+    /// True if the UDP outbound is open, False if not.
+    vrpn_bool outbound_udp_open(void) const;
+
+    vrpn_int32 tcp_outbuf_size(void) const;
+    vrpn_int32 udp_outbuf_size(void) const;
+    /// @}
+
+    /// @name Manipulators
+    /// @{
+
+    void init(void);
+
+    int mainloop(timeval *timeout);
+
+    /// @brief Pack a message that will be sent the next time mainloop() is
+    /// called.
+    ///
+    /// Turn off the RELIABLE flag if you want low-latency (UDP) send.
+    int pack_message(vrpn_uint32 len, struct timeval time, vrpn_int32 type,
+                     vrpn_int32 sender, const char *buffer,
+                     vrpn_uint32 class_of_service);
+
+    /// @brief send pending report, clear the buffer.
+    ///
+    /// This function was protected, now is public, so we can use it
+    /// to send out intermediate results without calling mainloop
+    virtual int send_pending_reports(void);
+
+    int pack_udp_description(int portno);
+
+    int handle_tcp_messages(const timeval *timeout);
+    int handle_udp_messages(const timeval *timeout);
+
+    int connect_tcp_to(const char *msg);
+    int connect_tcp_to(const char *addr, int port);
+    ///< Connects d_tcpSocket to the specified address (msg = "IP port");
+    ///< sets status to COOKIE_PENDING;  returns 0 on success, -1 on failure
+    int connect_udp_to(const char *addr, int port);
+    ///< Connects d_udpSocket to the specified address and port;
+    ///< returns 0 on success, sets status to BROKEN and returns -1
+    ///< on failure.
+
+    vrpn_int32 set_tcp_outbuf_size(vrpn_int32 bytecount);
+
+    int setup_new_connection(void);
+    ///< Sends the magic cookie and other information to its
+    ///< peer.  It is called by both the client and server setup routines.
+
+    void poll_for_cookie(const timeval *timeout = NULL);
+    int finish_new_connection_setup(void);
+
+    void drop_connection(void);
+    ///< Should only be called by vrpn_Connection::drop_connection(),
+    ///< since there's more housecleaning to do at that level.  I suppose
+    ///< that argues against separating this function out.
+
+    void clearBuffers(void);
+    ///< Empties out the TCP and UDP send buffers.
+    ///< Needed by vrpn_FileConnection to get at {udp,tcp}NumOut.
+
+    void setNICaddress(const char *);
+
+    /// @todo XXX These should be protected; making them so will lead to making
+    ///    the code split the functions between Endpoint and Connection
+    ///    protected:
+
+    SOCKET d_tcpSocket;
+
+    /// This section deals with when a client connection is trying to
+    /// establish (or re-establish) a connection with its server. It
+    /// keeps track of what we need to know to make this happen.
+
+    SOCKET d_tcpListenSocket;
+    int d_tcpListenPort;
+    ///< Socket and port that the client listens on
+    ///< when lobbing datagrams at the server and
+    ///< waiting for it to call back.
+
+    /// Socket to use to lob UDP requests asking for the server to
+    /// call us back.
+    SOCKET d_udpLobSocket;
+
+    char *d_remote_machine_name;    ///< Machine to call
+    int d_remote_port_number;       ///< Port to connect to on remote machine
+    timeval d_last_connect_attempt; ///< When the last UDP lob occurred
+
+    vrpn_bool d_tcp_only;
+    ///< For connections made through firewalls or NAT with the
+    ///< tcp: URL, we do not want to allow the endpoints on either
+    ///< end to open a UDP link to their counterparts.  If this is
+    ///< the case, then this flag should be set to true.
+
+protected:
+    int getOneTCPMessage(int fd, char *buf, size_t buflen);
+    int getOneUDPMessage(char *buf, size_t buflen);
+
+    SOCKET d_udpOutboundSocket;
+    SOCKET d_udpInboundSocket;
+    ///< Inbound unreliable messages come here.
+    ///< Need one for each due to different
+    ///< clock synchronization for each; we
+    ///< need to know which server each message is from.
+    ///< @todo XXX Now that we don't need multiple clocks, can we collapse this?
+
+    char *d_tcpOutbuf;
+    char *d_udpOutbuf;
+    vrpn_int32 d_tcpBuflen;
+    vrpn_int32 d_udpBuflen;
+    vrpn_int32 d_tcpNumOut;
+    vrpn_int32 d_udpNumOut;
+
+    vrpn_int32 d_tcpSequenceNumber;
+    vrpn_int32 d_udpSequenceNumber;
+
+    vrpn_float64
+        d_tcpAlignedInbuf[vrpn_CONNECTION_TCP_BUFLEN / sizeof(vrpn_float64) +
+                          1];
+    vrpn_float64
+        d_udpAlignedInbuf[vrpn_CONNECTION_UDP_BUFLEN / sizeof(vrpn_float64) +
+                          1];
+    char *d_tcpInbuf;
+    char *d_udpInbuf;
+
+    char *d_NICaddress;
+};
+
+/// @brief Generic connection class not specific to the transport mechanism.
+///
+/// It abstracts all of the common functions.  Specific implementations
+/// for IP, MPI, and other transport mechanisms follow.
+class VRPN_API vrpn_Connection {
+
+protected:
+    /// Constructor for server connection.  This cannot be called
+    /// directly any more because vrpn_Connection is an abstract base
+    /// class.  Call vrpn_create_server_connection() to make a server
+    /// of arbitrary type based on a name.
+    vrpn_Connection(const char *local_in_logfile_name,
+                    const char *local_out_logfile_name,
+                    vrpn_EndpointAllocator epa = allocateEndpoint);
+
+    /// Constructor for client connection.  This cannot be called
+    /// directly because vrpn_Connection is an abstract base class.
+    /// Call vrpn_get_connection_by_name() to create a client connection.
+    vrpn_Connection(const char *local_in_logfile_name,
+                    const char *local_out_logfile_name,
+                    const char *remote_in_logfile_name,
+                    const char *remote_out_logfile_name,
+                    vrpn_EndpointAllocator epa = allocateEndpoint);
+
+public:
+    virtual ~vrpn_Connection(void);
+
+    /// Returns vrpn_true if the connection is okay, vrpn_false if not
+    virtual vrpn_bool doing_okay(void) const;
+
+    /// Returns vrpn_true if the connection has been established, vrpn_false if
+    /// not
+    /// (For a networkless connection, this is equivalent to doing_okay()).
+    virtual vrpn_bool connected(void) const;
+
+    /// This function returns the logfile names of this connection in
+    /// the parameters.  It will allocate memory for the name of each
+    /// log file in use.  If no logging of a particular type is happening,
+    /// then *(X_Y_logname) will be set to NULL.
+    /// IMPORTANT:  code calling this function is responsible for freeing
+    /// the memory allocated for these strings.
+    void get_log_names(char **local_in_logname, char **local_out_logname,
+                       char **remote_in_logname, char **remote_out_logname);
+
+    /// Call each time through program main loop to handle receiving any
+    /// incoming messages and sending any packed messages.
+    /// Returns -1 when connection dropped due to error, 0 otherwise.
+    /// (only returns -1 once per connection drop).
+    /// Optional argument is TOTAL time to block on select() calls;
+    /// there may be multiple calls to select() per call to mainloop(),
+    /// and this timeout will be divided evenly between them.
+    virtual int mainloop(const struct timeval *timeout = NULL) = 0;
+
+    /// Get a token to use for the string name of the sender or type.
+    /// Remember to check for -1 meaning failure.
+    virtual vrpn_int32 register_sender(const char *name);
+    virtual vrpn_int32 register_message_type(const char *name);
+
+    /// Set up (or remove) a handler for a message of a given type.
+    /// Optionally, specify which sender to handle messages from.
+    /// Handlers will be called during mainloop().
+    /// Your handler should return 0 or a communication error is assumed
+    /// and the connection will be shut down.
+    virtual int register_handler(vrpn_int32 type, vrpn_MESSAGEHANDLER handler,
+                                 void *userdata,
+                                 vrpn_int32 sender = vrpn_ANY_SENDER);
+    virtual int unregister_handler(vrpn_int32 type, vrpn_MESSAGEHANDLER handler,
+                                   void *userdata,
+                                   vrpn_int32 sender = vrpn_ANY_SENDER);
+
+    /// Pack a message that will be sent the next time mainloop() is called.
+    /// Turn off the RELIABLE flag if you want low-latency (UDP) send.
+    virtual int pack_message(vrpn_uint32 len, struct timeval time,
+                             vrpn_int32 type, vrpn_int32 sender,
+                             const char *buffer, vrpn_uint32 class_of_service);
+
+    /// send pending report, clear the buffer.
+    /// This function was protected, now is public, so we can use it
+    /// to send out intermediate results without calling mainloop
+    virtual int send_pending_reports(void) = 0;
+
+    /// Returns the time since the connection opened.
+    /// Some subclasses may redefine time.
+    virtual int time_since_connection_open(struct timeval *elapsed_time);
+
+    /// returns the current time in the connection (since the epoch -- UTC
+    /// time).
+    virtual timeval get_time();
+
+    /// Returns the name of the specified sender/type, or NULL
+    /// if the parameter is invalid.  Only works for user
+    /// messages (type >= 0).
+    virtual const char *sender_name(vrpn_int32 sender);
+    virtual const char *message_type_name(vrpn_int32 type);
+
+    /// @brief Sets up a filter function for logging.
+    /// Any user message to be logged is first passed to this function,
+    /// and will only be logged if the function returns zero (XXX).
+    /// NOTE:  this only affects local logging - remote logging
+    /// is unfiltered!  Only user messages are filtered;  all system
+    /// messages are logged.
+    /// Returns nonzero on failure.
+    virtual int register_log_filter(vrpn_LOGFILTER filter, void *userdata);
+
+    /// Save any messages on any endpoints which have been logged so far.
+    virtual int save_log_so_far();
+
+    /// vrpn_File_Connection implements this as "return this" so it
+    /// can be used to detect a File_Connection and get the pointer for it
+    virtual vrpn_File_Connection *get_File_Connection(void);
+
+    /// This function should be seldom used.  It is here for the case of
+    /// the vrpn_Imager, whose servers do not follow "The VRPN Way" because
+    /// they try to jam more data into the network than there is bandwidth
+    /// to support it.  As a result, a client may call mainloop() on the
+    /// connection and have it never return -- there is always more data
+    /// in the network to read, so we never hand control back to the main
+    /// program.  The reason for the name comes from an old U.S. cartoon
+    /// called "The Jetsons".  In it, George Jetson is running on a
+    /// treadmill when it goes out of control and starts spinning so fast
+    /// that he can't even run fast enough to reach the controls and turn
+    /// it off.  He cries out to his wife, "Jane!  Stop this crazy thing!"
+    /// The parameter specifies a trigger: if more than the specified number
+    /// of messages come in on a given input channel during one mainloop()
+    /// call, the connection should stop looking for more messages.  NOTE:
+    /// this does not guarantee that only this many messages will be received,
+    /// only that the connection will stop looking for new ones on a given
+    /// channel once that many have been received (for example, UDP channels
+    /// will parse all the rest of the messages in a packet before stopping).
+    /// A value of 0 turns off the limit, and will cause all incoming messages
+    /// to be handled before returning.
+    void Jane_stop_this_crazy_thing(vrpn_uint32 stop_looking_after)
+    {
+        d_stop_processing_messages_after = stop_looking_after;
+    };
+    vrpn_uint32 get_Jane_value(void)
+    {
+        return d_stop_processing_messages_after;
+    };
+
+protected:
+    /// If this value is greater than zero, the connection should stop
+    /// looking for new messages on a given endpoint after this many
+    /// are found.
+    vrpn_uint32 d_stop_processing_messages_after;
+
+    int connectionStatus; ///< Status of the connection
+
+    /// Redefining this and passing it to constructors
+    /// allows a subclass to use a different subclass of Endpoint.
+    /// It should do NOTHING but return an endpoint
+    /// of the appropriate class;  it may not access subclass data,
+    /// since it'll be called from a constructor
+    static vrpn_Endpoint_IP *allocateEndpoint(vrpn_Connection *,
+                                              vrpn_int32 *connectedEC);
+
+#ifdef _MSC_VER
+#pragma warning(push)
+// Disable "need dll interface" warning on these members
+#pragma warning(disable : 4251)
+#endif
+    /// Function object wrapping an endpoint allocator and binding its
+    /// arguments.
+    vrpn::BoundEndpointAllocator d_boundEndpointAllocator;
+
+    /// Sockets used to talk to remote Connection(s)
+    /// and other information needed on a per-connection basis
+    vrpn::EndpointContainer d_endpoints;
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+    vrpn_int32 d_numConnectedEndpoints;
+    ///< We need to track the number of connected endpoints separately
+    ///< to properly send out got-first-connection/dropped-last-connection
+    ///< messages.  This value is *managed* by the Endpoints, but we
+    ///< need exactly one copy per Connection, so it's on the Connection.
+
+    /// @brief Routines that handle system messages
+    /// @{
+    static int VRPN_CALLBACK
+    handle_log_message(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_disconnect_message(void *userdata, vrpn_HANDLERPARAM p);
+    /// @}
+
+private:
+    void init(vrpn_EndpointAllocator
+                  epa); ///< Base initialization for all constructors.
+protected:
+    int delete_endpoint(vrpn_Endpoint *endpoint);
+    int compact_endpoints(void);
+
+    virtual int pack_sender_description(vrpn_int32 which);
+    ///< Send the sender description to ALL endpoints.
+
+    virtual int pack_type_description(vrpn_int32 which);
+    ///< Send the type description to ALL endpoints.
+
+    virtual int do_callbacks_for(vrpn_int32 type, vrpn_int32 sender,
+                                 struct timeval time, vrpn_uint32 len,
+                                 const char *buffer);
+
+    /// Returns message type ID, or -1 if unregistered
+    int message_type_is_registered(const char *) const;
+
+    /// Timekeeping - TCH 30 June 98
+    timeval start_time;
+
+    //
+    /// Counting references to this connection.
+public:
+    void addReference();
+    void removeReference();
+
+private:
+    int d_references;
+
+    //
+    /// Specify whether this connection should be deleted automatically when
+    ///  it is no longer need (reference count reaches zero).
+    /// For connections created by the VRPN code (as is done in
+    ///  get_connection_by_name) these should be auto-deleted.
+    ///  Connections created by user code should not be auto-deleted;
+    ///  that is up to the user to decide when finished.
+    /// By default, the constructor sets this to FALSE.
+    /// VRPN code (or user code) can set this to TRUE if it wants the
+    ///  connection to be deleted automatically when the last service on it
+    ///  is deleted
+public:
+    void setAutoDeleteStatus(bool setvalue) { d_autoDeleteStatus = setvalue; }
+
+private:
+    bool d_autoDeleteStatus; ///< FALSE by default.
+
+public:
+    /// Derived classes need access to d_dispatcher in their
+    /// allocateEndpoint() routine.  Several compilers won't give it to
+    /// them, even if they do inherit publicly.  Until we figure that
+    /// out, d_dispatcher needs to be public.
+
+    vrpn_TypeDispatcher *d_dispatcher;
+
+protected:
+    int doSystemCallbacksFor(vrpn_HANDLERPARAM, void *);
+
+    /// Server logging w. multiconnection - TCH July 00
+    /// Use one "hidden" endpoint for outgoing logs (?),
+    /// standard per-endpoint logs with augmented names for incoming.
+    /// To make a hidden endpoint we create d_endpoints[0] and increment
+    /// the d_numEndpoints, but DON'T pass it d_numConnectedEndpoints
+    /// (although it should be safe to do so, since it should never truly
+    /// become connected, but we might have to "fake" it to get it to log
+    /// correctly).
+
+    // vrpn_Endpoint * d_serverLogEndpoint;
+    int d_serverLogCount;
+    vrpn_int32 d_serverLogMode;
+    char *d_serverLogName;
+
+    vrpn_bool d_updateEndpoint;
+
+    virtual void updateEndpoints(void);
+    ///< This function will be called on the mainloop() iteration
+    ///< after *d_endpointAllocator is called, which lets subclasses
+    ///< do initialization.  (They can't do so during allocateEndpoint
+    ///< because it's called during the Connection constructor when
+    ///< their constructors haven't executed yet.)
+};
+
+class VRPN_API vrpn_Connection_IP : public vrpn_Connection {
+
+protected:
+    /// Make a client connection.  To access this from user code,
+    /// call vrpn_get_connection_by_name().
+    ///   Create a connection -  if server_name is not a file: name,
+    /// makes an SDI-like connection to the named remote server
+    /// (otherwise functions as a non-networked messaging hub).
+    /// Port less than zero forces default.
+    ///   Currently, server_name is an extended URL that defaults
+    /// to VRPN connections at the port, but can be file:: to read
+    /// from a file.  Other extensions should maintain this, so
+    /// that VRPN uses URLs to name things that are to be connected
+    /// to.
+    vrpn_Connection_IP(const char *server_name,
+                       int port = vrpn_DEFAULT_LISTEN_PORT_NO,
+                       const char *local_in_logfile_name = NULL,
+                       const char *local_out_logfile_name = NULL,
+                       const char *remote_in_logfile_name = NULL,
+                       const char *remote_out_logfile_name = NULL,
+                       const char *NIC_IPaddress = NULL,
+                       vrpn_EndpointAllocator epa = allocateEndpoint);
+
+public:
+    /// Make a server that listens for client connections.
+    /// DEPRECATED: Call vrpn_create_server_connection() with the
+    /// NIC name and port number you want.
+    vrpn_Connection_IP(
+        unsigned short listen_port_no = vrpn_DEFAULT_LISTEN_PORT_NO,
+        const char *local_in_logfile_name = NULL,
+        const char *local_out_logfile_name = NULL,
+        const char *NIC_IPaddress = NULL,
+        vrpn_Endpoint_IP *(*epa)(vrpn_Connection *,
+                                 vrpn_int32 *) = allocateEndpoint);
+
+    virtual ~vrpn_Connection_IP(void);
+
+    /// This is similar to check connection except that it can be
+    /// used to receive requests from before a server starts up
+    virtual int connect_to_client(const char *machine, int port);
+
+    /// Call each time through program main loop to handle receiving any
+    /// incoming messages and sending any packed messages.
+    /// Returns -1 when connection dropped due to error, 0 otherwise.
+    /// (only returns -1 once per connection drop).
+    /// Optional argument is TOTAL time to block on select() calls;
+    /// there may be multiple calls to select() per call to mainloop(),
+    /// and this timeout will be divided evenly between them.
+    virtual int mainloop(const struct timeval *timeout = NULL);
+
+protected:
+    /// If this value is greater than zero, the connection should stop
+    /// looking for new messages on a given endpoint after this many
+    /// are found.
+    vrpn_uint32 d_stop_processing_messages_after;
+
+protected:
+    friend VRPN_API vrpn_Connection *vrpn_get_connection_by_name(
+        const char *cname, const char *local_in_logfile_name,
+        const char *local_out_logfile_name, const char *remote_in_logfile_name,
+        const char *remote_out_logfile_name, const char *NIC_IPaddress,
+        bool force_connection);
+    friend VRPN_API vrpn_Connection *
+    vrpn_create_server_connection(const char *cname,
+                                  const char *local_in_logfile_name,
+                                  const char *local_out_logfile_name);
+
+    /// @name Only used for a vrpn_Connection that awaits incoming connections
+    /// @{
+    SOCKET listen_udp_sock; ///< UDP Connect requests come here
+    SOCKET listen_tcp_sock; ///< TCP Connection requests come here
+    /// @}
+
+    /// Routines that handle system messages
+    static int VRPN_CALLBACK
+    handle_UDP_message(void *userdata, vrpn_HANDLERPARAM p);
+
+    /// @brief Called by all constructors
+    void init(void);
+
+    /// @brief send pending report, clear the buffer.
+    ///
+    /// This function was protected, now is public, so we can use it
+    /// to send out intermediate results without calling mainloop
+    virtual int send_pending_reports(void);
+
+    //// This is called by a server-side process to see if there have
+    //// been any UDP packets come in asking for a connection. If there
+    //// are, it connects the TCP port and then calls handle_connection().
+    virtual void
+    server_check_for_incoming_connections(const struct timeval *timeout = NULL);
+
+    /// This routine is called by a server-side connection when a
+    /// new connection has just been established, and the tcp port
+    /// has been connected to it.
+    virtual void handle_connection(vrpn_Endpoint *endpoint);
+
+    /// Drops the connection with the given, non-NULL endpoint.  Depending on if
+    /// we're a server or a client, this may result in the endpoints needing
+    /// compacting once you're no longer iterating on the endpoint container.
+    virtual void drop_connection(vrpn_Endpoint *endpoint);
+
+    /// Like drop_connection, except it includes the call to compact the
+    /// endpoints. Only safe to call if you can guarantee no iterators are open
+    /// to the container, since compact invalidates them.
+    void drop_connection_and_compact(vrpn_Endpoint *endpoint);
+
+    char *d_NIC_IP;
+};
+
+/// @brief Constructor for a Loopback connection that will basically just
+/// pass messages between objects that are connected to it.  It offers no
+/// external connections, via IP or any other mechanism.  It is useful
+/// if you want to make the client and server in the same connection and
+/// you don't need to have anything else connect.
+
+class VRPN_API vrpn_Connection_Loopback : public vrpn_Connection {
+
+protected:
+    /// Make a client connection.  To access this from user code,
+    /// call vrpn_create_server_connection() with a service name
+    /// of 'loopback:'.
+    /// For now, we don't enable logging on a Loopback connection.
+    vrpn_Connection_Loopback();
+
+public:
+    virtual ~vrpn_Connection_Loopback(void);
+
+    /// Call each time through program main loop to handle receiving any
+    /// incoming messages and sending any packed messages.
+    /// Returns -1 on error, 0 otherwise.
+    /// Optional argument is TOTAL time to block on select() calls;
+    /// there may be multiple calls to select() per call to mainloop(),
+    /// and this timeout will be divided evenly between them.
+    virtual int mainloop(const struct timeval *timeout = NULL);
+
+    /// Returns vrpn_true if the connection is okay, vrpn_false if not
+    virtual vrpn_bool doing_okay(void) const { return vrpn_true; }
+
+    /// Returns vrpn_true if the connection has been established, vrpn_false if
+    /// not
+    /// (For a networkless connection, this is equivalent to doing_okay()).
+    virtual vrpn_bool connected(void) const { return vrpn_true; }
+
+protected:
+    friend VRPN_API vrpn_Connection *
+    vrpn_create_server_connection(const char *cname,
+                                  const char *local_in_logfile_name,
+                                  const char *local_out_logfile_name);
+
+    /// @brief send pending report, clear the buffer.
+    ///
+    /// This function was protected, now is public, so we can use it
+    /// to send out intermediate results without calling mainloop
+    virtual int send_pending_reports(void) { return 0; }
+};
+
+/// @brief Create a client connection of arbitrary type (VRPN UDP/TCP, TCP,
+/// File, Loopback, MPI).
+///
+/// WARNING:  May not be thread safe.
+/// If no IP address for the NIC to use is specified, uses the default
+/// NIC.  If the force_reopen flag is set, a new connection will be
+/// made even if there was already one to that server.
+/// When done with the object, call removeReference() on it (which will
+/// delete it if there are no other references).
+VRPN_API vrpn_Connection *vrpn_get_connection_by_name(
+    const char *cname, const char *local_in_logfile_name = NULL,
+    const char *local_out_logfile_name = NULL,
+    const char *remote_in_logfile_name = NULL,
+    const char *remote_out_logfile_name = NULL,
+    const char *NIC_IPaddress = NULL, bool force_reopen = false);
+
+/// @brief Create a server connection of arbitrary type (VRPN UDP/TCP,
+/// TCP, File, Loopback, MPI).
+///
+/// Returns NULL if the name is not understood or the connection cannot
+/// be created.
+/// WARNING:  May not be thread safe.
+/// To create a VRPN TCP/UDP server, use a name like:
+///    vrpn:machine_name_or_ip:port
+///    machine_name_or_ip:port
+///    machine_name_or_ip
+///    :port       (This port on any network card.)
+/// To create an MPI server, use a name like:
+///    mpi:MPI_COMM_WORLD
+///    mpi:comm_number
+/// When done with the object, call removeReference() on it (which will
+/// delete it if there are no other references).
+VRPN_API vrpn_Connection *
+vrpn_create_server_connection(const char *cname,
+                              const char *local_in_logfile_name = NULL,
+                              const char *local_out_logfile_name = NULL);
+
+/// Lets you make one with the default settings, or just ask for a specific
+/// port number on the default NIC on this machine.  This matches the
+/// signature on the old constructor to make it easier to port existing
+/// servers.
+inline VRPN_API vrpn_Connection *
+vrpn_create_server_connection(int port = vrpn_DEFAULT_LISTEN_PORT_NO,
+                              const char *local_in_logfile_name = NULL,
+                              const char *local_out_logfile_name = NULL,
+                              const char *NIC_NAME = NULL)
+{
+    char name[256];
+    if (NIC_NAME == NULL) {
+        sprintf(name, ":%d", port);
+    }
+    else {
+        sprintf(name, "%s:%d", NIC_NAME, port);
+    }
+    return vrpn_create_server_connection(name, local_in_logfile_name,
+                                         local_out_logfile_name);
+}
+
+/// @name Utility routines to parse names (<service>@<location specifier>)
+/// Both return new char [], and it is the caller's responsibility
+/// to delete this memory!
+/// @{
+VRPN_API char *vrpn_copy_service_name(const char *fullname);
+VRPN_API char *vrpn_copy_service_location(const char *fullname);
+/// @}
+
+/// @brief Utility routines to parse file specifiers FROM service locations
+///
+///   file:<filename>
+///
+///   file://<hostname>/<filename>
+///
+///   file:///<filename>
+VRPN_API char *vrpn_copy_file_name(const char *filespecifier);
+
+/// @name Utility routines to parse host specifiers FROM service locations
+///
+///   <hostname>
+///
+///   <hostname>:<port number>
+///
+///   x-vrpn://<hostname>
+///
+///   x-vrpn://<hostname>:<port number>
+///
+///   x-vrsh://<hostname>/<server program>,<comma-separated server arguments>
+///
+/// The caller is responsible for calling delete [] on the returned character
+/// pointer if it is not NULL.
+/// @{
+VRPN_API char *vrpn_copy_machine_name(const char *hostspecifier);
+VRPN_API int vrpn_get_port_number(const char *hostspecifier);
+VRPN_API char *vrpn_copy_rsh_program(const char *hostspecifier);
+VRPN_API char *vrpn_copy_rsh_arguments(const char *hostspecifier);
+/// @}
+
+/// @brief Utility routine to rename the service name of a given host specifier.
+char *vrpn_set_service_name(const char *specifier, const char *newServiceName);
+
+/// Checks the buffer to see if it is a valid VRPN header cookie.
+/// Returns -1 on total mismatch,
+/// 1 on minor version mismatch or other acceptable difference,
+/// and 0 on exact match.
+/// @{
+VRPN_API int check_vrpn_cookie(const char *buffer);
+VRPN_API int check_vrpn_file_cookie(const char *buffer);
+/// @}
+
+/// @brief Returns the size of the magic cookie buffer, plus any alignment
+/// overhead.
+VRPN_API size_t vrpn_cookie_size(void);
+
+VRPN_API int write_vrpn_cookie(char *buffer, size_t length,
+                               long remote_log_mode);
+
+/// @name Utility routines for reading from and writing to sockets/file
+/// descriptors
+/// @{
+#ifndef VRPN_USE_WINSOCK_SOCKETS
+int VRPN_API
+vrpn_noint_block_write(int outfile, const char buffer[], size_t length);
+int VRPN_API vrpn_noint_block_read(int infile, char buffer[], size_t length);
+int VRPN_API vrpn_noint_select(int width, fd_set *readfds, fd_set *writefds,
+                               fd_set *exceptfds, struct timeval *timeout);
+#else  /* winsock sockets */
+int VRPN_API
+vrpn_noint_block_write(SOCKET outsock, char *buffer, size_t length);
+int VRPN_API vrpn_noint_block_read(SOCKET insock, char *buffer, size_t length);
+#endif /* VRPN_USE_WINSOCK_SOCKETS */
+       /// @}
+
+/**
+ * @brief Singleton class that keeps track of all known VRPN connections
+ * and makes sure they're deleted on shutdown.
+ *
+ * We make it static to guarantee that the destructor is called
+ * on program close so that the destructors of all the vrpn_Connections
+ * that have been allocated are called so that all open logs are flushed
+ * to disk.  Each connection should add itself to this list in its
+ * constructor and should remove itself from this list in its
+ * destructor.
+ */
+
+//      This section holds data structures and functions to open
+// connections by name.
+//      The intention of this section is that it can open connections for
+// objects that are in different libraries (trackers, buttons and sound),
+// even if they all refer to the same connection.
+//	Even though each individual vrpn_Connection class is not yet thread
+// safe, so should only have its methods called from a single thread,
+// the vrpn_ConnectionManager should be thread safe to allow connections
+// to be created and destroyed by different threads.
+
+class VRPN_API vrpn_ConnectionManager {
+
+public:
+    ~vrpn_ConnectionManager(void);
+
+    /// @brief The only way to get access to an instance of this class.
+    /// Guarantees that there is only one, global object.
+    /// Also guarantees that it will be constructed the first time
+    /// this function is called, and (hopefully?) destructed when
+    /// the program terminates.
+    static vrpn_ConnectionManager &instance(void);
+
+    /// NB implementation is not particularly efficient;  we expect
+    /// to have O(10) connections, not O(1000).
+    /// @{
+    void addConnection(vrpn_Connection *, const char *name);
+    void deleteConnection(vrpn_Connection *);
+    /// @}
+
+    /// Searches through d_kcList but NOT d_anonList
+    /// (Connections constructed with no name)
+    vrpn_Connection *getByName(const char *name);
+
+private:
+    /// Mutex to ensure thread safety;
+    vrpn_Semaphore d_semaphore;
+
+    struct knownConnection {
+        char name[1000];
+        vrpn_Connection *connection;
+        knownConnection *next;
+    };
+
+    /// @brief named connections
+    knownConnection *d_kcList;
+
+    /// @brief unnamed (server) connections
+    knownConnection *d_anonList;
+
+    vrpn_ConnectionManager(void);
+
+    // @brief copy constructor undefined to prevent instantiations
+    vrpn_ConnectionManager(const vrpn_ConnectionManager &);
+
+    void deleteConnection(vrpn_Connection *, knownConnection **);
+};
+
+#endif // VRPN_CONNECTION_H
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_Dial.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_Dial.h
new file mode 100644
index 0000000000000000000000000000000000000000..829d67368e2d55b3d2e4375aee3200dd3fbd135c
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_Dial.h
@@ -0,0 +1,116 @@
+// vrpn_Dial.h
+//	This implements a Dial class. A dial is an object that spins,
+// possibly without bound. It returns the fraction of a revolution that
+// it has turned as its message type.
+
+#ifndef VRPN_DIAL_H
+#define VRPN_DIAL_H
+
+const int vrpn_DIAL_MAX = 128;
+
+#include <stddef.h> // for NULL
+
+#include "vrpn_BaseClass.h" // for vrpn_Callback_List, etc
+#include "vrpn_Configure.h" // for VRPN_API, VRPN_CALLBACK
+#include "vrpn_Shared.h"    // for timeval
+#include "vrpn_Types.h"     // for vrpn_float64, vrpn_int32
+
+class VRPN_API vrpn_Connection;
+struct vrpn_HANDLERPARAM;
+
+class VRPN_API vrpn_Dial : public vrpn_BaseClass {
+public:
+    vrpn_Dial(const char *name, vrpn_Connection *c = NULL);
+
+protected:
+    vrpn_float64 dials[vrpn_DIAL_MAX];
+    vrpn_int32 num_dials;
+    struct timeval timestamp;
+    vrpn_int32 change_m_id; // change message id
+
+    virtual int register_types(void);
+    virtual vrpn_int32 encode_to(char *buf, vrpn_int32 buflen, vrpn_int32 dial,
+                                 vrpn_float64 delta);
+    virtual void report_changes(void); // send report iff changed
+    virtual void report(void);         // send report
+};
+
+//----------------------------------------------------------
+// Example server for an array of dials
+//	This will generate an array of dials that all spin at the same
+// rate (revolutions/second), and which send reports at a different rate
+// (updates/second). A real server would send reports whenever it saw
+// dials changing, and would not have the spin_rate or update_rate parameters.
+//	This server can be used for testing to make sure a client is
+// working correctly, and to ensure that a connection to a remote server
+// is working (by running the example server with the name of the device that
+// the real server would use).
+
+class VRPN_API vrpn_Dial_Example_Server : public vrpn_Dial {
+public:
+    vrpn_Dial_Example_Server(const char *name, vrpn_Connection *c,
+                             vrpn_int32 numdials = 1,
+                             vrpn_float64 spin_rate = 1.0,
+                             vrpn_float64 update_rate = 10.0);
+    virtual void mainloop();
+
+protected:
+    vrpn_float64 _spin_rate;   // The rate at which to spin (revolutions/sec)
+    vrpn_float64 _update_rate; // The rate at which to update (reports/sec)
+    // The dials[] array within the parent is used for the values
+    // The num_dials within the parent is used
+    // The timestamp field within the parent structure is used for timing
+    // The report_changes() or report() functions within the parent are used
+};
+
+//----------------------------------------------------------
+//************** Users deal with the following *************
+
+// User routine to handle a change in dial values.  This is called when
+// the dial callback is called (when a message from its counterpart
+// across the connetion arrives).
+
+typedef struct _vrpn_DIALCB {
+    struct timeval msg_time; // Timestamp when change happened
+    vrpn_int32 dial;         // which dial changed
+    vrpn_float64 change;     // Fraction of a revolution it changed
+} vrpn_DIALCB;
+
+typedef void(VRPN_CALLBACK *vrpn_DIALCHANGEHANDLER)(void *userdata,
+                                                    const vrpn_DIALCB info);
+
+// Open a dial device that is on the other end of a connection
+// and handle updates from it.  This is the type of device
+// that user code will deal with.
+
+class VRPN_API vrpn_Dial_Remote : public vrpn_Dial {
+public:
+    // The name of the device to connect to.
+    // Optional argument to be used when the Remote MUST listen on
+    // a connection that is already open.
+    vrpn_Dial_Remote(const char *name, vrpn_Connection *c = NULL);
+    ~vrpn_Dial_Remote();
+
+    // This routine calls the mainloop of the connection it's on
+    virtual void mainloop();
+
+    // (un)Register a callback handler to handle dial updates
+    virtual int register_change_handler(void *userdata,
+                                        vrpn_DIALCHANGEHANDLER handler)
+    {
+        return d_callback_list.register_handler(userdata, handler);
+    };
+    virtual int unregister_change_handler(void *userdata,
+                                          vrpn_DIALCHANGEHANDLER handler)
+    {
+        return d_callback_list.unregister_handler(userdata, handler);
+    }
+
+protected:
+    vrpn_Callback_List<vrpn_DIALCB> d_callback_list;
+
+    static int VRPN_CALLBACK
+    handle_change_message(void *userdata, vrpn_HANDLERPARAM p);
+};
+
+#endif
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_EndpointContainer.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_EndpointContainer.h
new file mode 100644
index 0000000000000000000000000000000000000000..d58f952aba74efb308e9d5d1927975e668ef36a3
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_EndpointContainer.h
@@ -0,0 +1,364 @@
+/** @file
+    @brief Header
+
+    @date 2015
+
+    @author
+    Ryan Pavlik
+    Sensics, Inc.
+    <http://sensics.com/osvr>
+*/
+
+// Copyright 2015 Sensics, Inc.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef INCLUDED_vrpn_EndpointContainer_h_GUID_DB073DE8_5BBC_46BF_255B_71264D47A639
+#define INCLUDED_vrpn_EndpointContainer_h_GUID_DB073DE8_5BBC_46BF_255B_71264D47A639
+
+// Internal Includes
+#include "vrpn_Types.h"
+#include "vrpn_Configure.h"
+
+#include "vrpn_Assert.h"
+
+// Library/third-party includes
+// - none
+
+// Standard includes
+#include <vector>
+#include <stddef.h> // for NULL
+
+class VRPN_API vrpn_Endpoint;
+class VRPN_API vrpn_Endpoint_IP;
+
+namespace vrpn {
+
+    class EndpointIterator;
+
+    /** @brief Container for endpoints, held by pointer.
+
+    To check if we have room, use this: `if (d_endpoints.full()) {}` instead of
+    the old code looking like this: `if (which_end >= vrpn_MAX_ENDPOINTS)`
+
+    Usage example for iteration:
+
+    ~~~
+    for (vrpn::EndpointIterator it = d_endpoints.begin(), e = d_endpoints.end();
+         it != e; ++it) {
+        it->pack_type_description(which)
+    }
+    ~~~
+
+    */
+    class EndpointContainer {
+    public:
+        typedef vrpn_Endpoint_IP T;
+        typedef T &reference;
+        typedef T *pointer;
+        typedef vrpn_Endpoint *base_pointer;
+
+    private:
+        typedef std::vector<pointer> container_type;
+
+    public:
+        typedef container_type::size_type size_type;
+        typedef EndpointIterator iterator;
+        typedef EndpointIterator const_iterator;
+
+        /// @brief Constructor of empty container.
+        EndpointContainer();
+
+        /// @brief Destructor - includes a call to clear()
+        ~EndpointContainer();
+
+        /// @brief Tells each held endpoint in turn to drop the connection then
+        /// deletes it
+        void clear();
+
+        /// @brief Shorthand for get_by_index(0)
+        pointer front() const { return get_by_index(0); }
+
+        /// @brief Given the result of an endpoint allocator, if it's non-NULL,
+        /// takes ownership of it.
+        /// @return the input pointer
+        template <typename T> T *acquire(T *endpoint)
+        {
+            acquire_(endpoint);
+            return endpoint;
+        }
+
+        /// @brief Goes through and gets rid of the NULL entries.
+        void compact();
+
+        /// @brief Can we no longer accommodate a new endpoint?
+        bool full() const;
+
+        /// @brief Checks to see if an index is both in-range and pointing to a
+        /// still-extant object
+        bool is_valid(size_type i) const;
+
+        /// @brief Destroys the contained endpoint by address.
+        /// @return true if there was something for us to delete
+        bool destroy(base_pointer endpoint);
+
+        pointer get_by_index(size_type i) const;
+
+        /// @brief Get size of container including NULL elements that haven't
+        /// been compacted yet.
+        size_type get_full_container_size() const;
+
+        /// @brief Get an iterator to the beginning that skips nulls.
+        /// Invalidated by compacting.
+        iterator begin() const;
+
+        /// @brief Get an iterator suitable only for testing to see if we're
+        /// "done"
+        iterator end() const;
+
+    private:
+        /// @name Internal raw iterators and methods
+        /// @{
+        typedef container_type::iterator raw_iterator;
+        typedef container_type::const_iterator raw_const_iterator;
+        raw_iterator begin_() { return container_.begin(); }
+        raw_const_iterator begin_() const { return container_.begin(); }
+        raw_iterator end_() { return container_.end(); }
+        raw_const_iterator end_() const { return container_.end(); }
+        // @}
+        /// @name Internal helper methods
+        /// @{
+        /// @brief Implementation of acquire for the stored pointer type.
+        void acquire_(pointer endpoint);
+        /// @brief Do actual compact once we've determined it's necessary.
+        void compact_();
+
+        /// @}
+        container_type container_;
+        bool needsCompact_;
+    };
+
+#define VRPN_ECITERATOR_ASSERT_INVARIANT()                                     \
+    VRPN_ASSERT_MSG(valid() != equal_to_default_(),                            \
+                    "Class invariant for EndpointIterator")
+
+    /// @brief An iterator that goes forward in an EndpointContainer skipping
+    /// the NULLs, that also acts a bit like a pointer/smart pointer (can treat
+    /// it as a vrpn_Endpoint *)
+    ///
+    /// Because we know at design time that it iterates through pointers,
+    /// we have pointer-related operator overloads that mean there's no need to
+    /// double-dereference.
+    ///
+    /// Fulfills the InputIterator concept:
+    /// http://en.cppreference.com/w/cpp/concept/InputIterator
+    ///
+    /// All end() iterators compare equal to each other and to the
+    /// default-constructed iterator. They are the only invalid iterators:
+    /// incrementing an iterator past the end makes it the same as the
+    /// default-constructed iterator.
+    ///
+    /// That is, for all EndpointIterators it, we enforce the class invariant
+    /// `it.valid() || (it == EndpointIterator())` (and that's actually an XOR)
+    class EndpointIterator {
+    public:
+        // typedef EndpointIteratorBase<ContainerType> type;
+        typedef EndpointIterator type;
+        typedef EndpointContainer const container_type;
+        typedef container_type::pointer pointer;
+        typedef container_type::reference reference;
+        typedef container_type::size_type size_type;
+
+        /// @brief Default constructor, equal to all other default-constructed
+        /// instances and all end()
+        EndpointIterator()
+            : index_(0)
+            , container_(NULL)
+        {
+            VRPN_ASSERT_MSG(equal_to_default_(),
+                            "Default constructed value should be equal to "
+                            "default: verifies that 'equal_to_default_()' is "
+                            "equivalent to '*this == EndpointIterator()'");
+            VRPN_ASSERT_MSG(!valid(),
+                            "Default constructed value should not be valid");
+        }
+
+        /// @brief Constructor with container, points to beginning of container.
+        EndpointIterator(container_type &container)
+            : index_(0)
+            , container_(&container)
+        {
+            // Advance index as required to maintain the class invariant.
+            skip_nulls_();
+            VRPN_ECITERATOR_ASSERT_INVARIANT();
+        }
+
+        /// @brief Constructor with container and raw index into container.
+        EndpointIterator(container_type &container, size_type index)
+            : index_(index)
+            , container_(&container)
+        {
+            // Advance index as required to maintain the class invariant.
+            skip_nulls_();
+            VRPN_ECITERATOR_ASSERT_INVARIANT();
+        }
+
+        /// @brief Does this iterator refer to a valid element?
+        ///
+        /// Class invariant: valid() || (*this == type())
+        /// That is, there is only one invalid value.
+        bool valid() const
+        {
+            return container_ && container_->is_valid(index_);
+        }
+
+        /// @brief Extract the pointer (NULL if iterator is invalid)
+        pointer get_pointer() const
+        {
+            VRPN_ECITERATOR_ASSERT_INVARIANT();
+            // Only need to condition on container validity: invalid indexes
+            // safely return null from get_raw_()
+            return container_ ? (get_raw_()) : NULL;
+        }
+
+        /// @brief Implicit conversion operator to pointer.
+        operator pointer() const
+        {
+            VRPN_ECITERATOR_ASSERT_INVARIANT();
+            return get_pointer();
+        }
+
+        /// @brief prefix ++ operator, increments (and skips any nulls)
+        type &operator++()
+        {
+            /// Invariant might be invalid here, since the user might have just
+            /// deleted something.
+            if (equal_to_default_()) {
+                // Early out if we're already the end sentinel (default
+                // constructor value)
+                return *this;
+            }
+
+            // Increment until we either go out of bounds or get a non-null
+            // entry
+            index_++;
+            skip_nulls_();
+            VRPN_ECITERATOR_ASSERT_INVARIANT();
+            return *this;
+        }
+
+        /// @name Smart pointer idiom operators
+        /// @{
+        pointer operator->() const
+        {
+            VRPN_ECITERATOR_ASSERT_INVARIANT();
+            return get_pointer();
+        }
+
+        reference operator*() const
+        {
+            VRPN_ECITERATOR_ASSERT_INVARIANT();
+            return *get_raw_();
+        }
+        /// @}
+
+        /// @name Comparison operators, primarily for loop use
+        /// @{
+        bool operator==(type const &other) const
+        {
+            return (container_ == other.container_) && (index_ == other.index_);
+        }
+        bool operator!=(type const &other) const
+        {
+            return (container_ != other.container_) || (index_ != other.index_);
+        }
+        /// @}
+
+    private:
+        bool equal_to_default_() const
+        {
+            return (NULL == container_) && (index_ == 0);
+        }
+        void skip_nulls_()
+        {
+            while (index_in_bounds_() && (get_raw_() == NULL)) {
+                index_++;
+            }
+            // We may have run out of elements, so check the invariant
+            enforce_invariant_();
+        }
+        /// @brief Function to verify an iterator to enforce the class
+        /// invariant.
+        void enforce_invariant_()
+        {
+            if (!valid()) {
+                /// Assign from default-constructed iterator, to be the same as
+                /// end()
+                *this = type();
+            }
+        }
+
+        /// @brief get, without checking validity of container_ first!
+        ///
+        /// Note that the container handles cases where the index is out of
+        /// range by returning NULL, so that's safe.
+        pointer get_raw_() const { return container_->get_by_index(index_); }
+
+        /// @brief Helper to check index vs container bounds, without checking
+        /// validity of container_ first!
+        bool index_in_bounds_() const
+        {
+            return index_ < container_->get_full_container_size();
+        }
+
+        size_type index_;
+        container_type *container_;
+    };
+#undef VRPN_ECITERATOR_ASSERT_INVARIANT
+
+    // Inline Implementations //
+
+    inline bool
+    EndpointContainer::is_valid(EndpointContainer::size_type i) const
+    {
+        return (i < get_full_container_size()) && (NULL != container_[i]);
+    }
+
+    inline EndpointContainer::pointer
+    EndpointContainer::get_by_index(size_type i) const
+    {
+        if (!is_valid(i)) {
+            return NULL;
+        }
+        return container_[i];
+    }
+
+    inline EndpointContainer::size_type
+    EndpointContainer::get_full_container_size() const
+    {
+        return container_.size();
+    }
+
+    // making this condition inline so that it has minimal overhead if
+    // we don't actually need to perform a compaction.
+    inline void EndpointContainer::compact()
+    {
+        if (needsCompact_) {
+            compact_();
+        }
+    }
+
+    inline EndpointIterator EndpointContainer::begin() const
+    {
+        return EndpointIterator(*this);
+    }
+
+    inline EndpointIterator EndpointContainer::end() const
+    {
+        return EndpointIterator();
+    }
+
+} // namespace vrpn
+
+#endif // INCLUDED_vrpn_EndpointContainer_h_GUID_DB073DE8_5BBC_46BF_255B_71264D47A639
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_FileConnection.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_FileConnection.h
new file mode 100644
index 0000000000000000000000000000000000000000..be0a44d99f20cf54a4592e0c9d682d00343ceb47
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_FileConnection.h
@@ -0,0 +1,326 @@
+#ifndef VRPN_FILE_CONNECTION_H
+#define VRPN_FILE_CONNECTION_H
+
+// {{{ vrpn_File_Connection
+//
+// Tom Hudson, June 1998
+
+// This class *reads* a file written out by vrpn_Connection's logging hooks.
+
+// The interface exactly matches that of vrpn_Connection.  To do things that
+// are meaningful on log replay but not on live networks, create a
+// vrpn_File_Controller and pass your vrpn_File_Connection to its constructor,
+// or just ask the Connection for its file connection pointer and do the
+// operations directly on the FileConnection if the pointer is non-NULL.
+
+// Logfiles are recorded as *sent*, not as translated by the receiver,
+// so we still need to have all the correct names for senders and types
+// registered.
+
+// September 1998:  by default preloads the entire log file on startup.
+// This causes a delay (nontrivial for large logs) but should help smooth
+// playback.
+// }}}
+
+#include <stdio.h> // for NULL, FILE
+
+#include "vrpn_Configure.h"  // for VRPN_API, VRPN_CALLBACK
+#include "vrpn_Connection.h" // for vrpn_LOGLIST (ptr only), etc
+#include "vrpn_Shared.h"     // for timeval
+#include "vrpn_Types.h"      // for vrpn_float32, vrpn_int32, etc
+
+struct timeval;
+
+// Global variable used to indicate whether File Connections should
+// pre-load all of their records into memory when opened.  This is the
+// default behavior, but fails on very large files that eat up all
+// of the memory.  This defaults to "true".  User code should set this
+// to "false" before calling vrpn_get_connection_by_name() or creating
+// a new vrpn_File_Connection object if it wants that file connection
+// to not preload.  The value is only checked at connection creation time;
+// the connection behaves consistently once created.  This operation is
+// useful for applications that load large data files and don't want to
+// wait for them to pre-load.
+
+extern VRPN_API bool vrpn_FILE_CONNECTIONS_SHOULD_PRELOAD;
+
+// Global variable used to indicate whether File Connections should
+// keep already-read messages stored in memory.  If not, then we have
+// to re-load the file starting at the beginning on rewind.  This
+// defaults to "true".  User code should set this
+// to "false" before calling vrpn_get_connection_by_name() or creating
+// a new vrpn_File_Connection object if it wants that file connection
+// to not preload.  The value is only checked at connection creation time;
+// the connection behaves consistently once created.  This operation is
+// useful for applications that read through large data files and
+// don't have enough memory to keep them in memory at once, or for applications
+// that read through only once and have no need to go back and check.
+
+extern VRPN_API bool vrpn_FILE_CONNECTIONS_SHOULD_ACCUMULATE;
+
+// Global variable used to indicate whether File Connections should
+// play through all system messages and get to the first user message
+// when opened or reset to the beginning.  This defaults to "true".
+// User code should set this
+// to "false" before calling vrpn_get_connection_by_name() or creating
+// a new vrpn_File_Connection object if it wants that file connection
+// to not preload.  The value is only checked at connection creation time;
+// the connection behaves consistently once created.  Leaving this true
+// can help with offsets in time that happen at the beginning of files.
+
+extern VRPN_API bool vrpn_FILE_CONNECTIONS_SHOULD_SKIP_TO_USER_MESSAGES;
+
+class VRPN_API vrpn_File_Connection : public vrpn_Connection {
+public:
+    vrpn_File_Connection(const char *station_name,
+                         const char *local_in_logfile_name = NULL,
+                         const char *local_out_logfile_name = NULL);
+    virtual ~vrpn_File_Connection(void);
+
+    virtual int mainloop(const timeval *timeout = NULL);
+
+    // returns the elapsed time in the file
+    virtual int time_since_connection_open(timeval *elapsed_time);
+
+    // returns the current time in the file since the epoch (UTC time).
+    virtual timeval get_time() { return d_time; }
+
+    virtual vrpn_File_Connection *get_File_Connection(void);
+
+    // Pretend to send pending report, really just clear the buffer.
+    virtual int send_pending_reports(void);
+
+    // {{{ fileconnections-specific methods (playback control)
+public:
+    // XXX the following should not be public if we want vrpn_File_Connection
+    //     to have the same interface as vrpn_Connection
+    //
+    //     If so handler functions for messages for these operations
+    //     should be made, and functions added to vrpn_File_Controller which
+    //     generate the messages.  This seemed like it would be messy
+    //     since most of these functions have return values
+
+    // rate of 0.0 is paused, 1.0 is normal speed
+    void set_replay_rate(vrpn_float32 rate)
+    {
+        d_filetime_accum.set_replay_rate(rate);
+    }
+
+    vrpn_float32 get_replay_rate() { return d_filetime_accum.replay_rate(); }
+
+    // resets to the beginning of the file
+    // returns 0 on success
+    int reset(void);
+
+    // returns 1 if we're at the end of file
+    int eof();
+
+    // end_time for play_to_time() is an elapsed time
+    // returns -1 on error or EOF, 0 on success
+    int play_to_time(vrpn_float64 end_time);
+    int play_to_time(timeval end_time);
+
+    // end_filetime is an absolute time, corresponding to the
+    // timestamps of the entries in the file,
+    // returns -1 on error or EOF, 0 on success
+    int play_to_filetime(const timeval end_filetime);
+
+    // plays the next entry, returns -1 or error or EOF, 0 otherwise
+    int playone();
+
+    // plays at most one entry, but won't play past end_filetime
+    // returns 0 on success, 1 if at end_filetime, -1 on error or EOF
+    int playone_to_filetime(timeval end_filetime);
+
+    // returns the elapsed time of the file
+    timeval get_length();
+    double get_length_secs();
+
+    // returns the timestamp of the earliest in time user message
+    timeval get_lowest_user_timestamp();
+
+    // returns the timestamp of the greatest-in-time user message
+    timeval get_highest_user_timestamp();
+
+    // returns the name of the file
+    const char *get_filename();
+
+    // jump_to_time sets the current position to the given elapsed time
+    // return 1 if we got to the specified time and 0 if we didn't
+    int jump_to_time(vrpn_float64 newtime);
+    int jump_to_time(timeval newtime);
+
+    // jump_to_filetime sets the current position to the given absolute time
+    // return 1 if we got to the specified time and 0 if we didn't
+    int jump_to_filetime(timeval absolute_time);
+
+    // Limits the number of messages played out on any one call to mainloop.
+    // 0 => no limit.
+    // Used to stop continuous callback-handling when messages arrive
+    // at a very high rate (such as from a vrpn_Imager) or to make sure
+    // that we are able to pause after each frame in frame-by-frame
+    // playback for tracking analysis programs.
+    void limit_messages_played_back(vrpn_uint32 max_playback)
+    {
+        Jane_stop_this_crazy_thing(max_playback);
+    };
+
+    // }}}
+    // {{{ tokens for VRPN control messages (data members)
+protected:
+    vrpn_int32 d_controllerId;
+
+    vrpn_int32 d_set_replay_rate_type;
+    vrpn_int32 d_reset_type;
+    vrpn_int32 d_play_to_time_type;
+    // long d_jump_to_time_type;
+
+    // }}}
+    // {{{ time-keeping
+protected:
+    timeval d_last_told;  // Last time we printed error about no open file.
+    timeval d_time;       // current time in file
+    timeval d_start_time; // time of first record in file
+    timeval d_earliest_user_time; // time of first user message
+    vrpn_bool d_earliest_user_time_valid;
+    timeval d_highest_user_time; // time of last user message
+    vrpn_bool d_highest_user_time_valid;
+
+    // finds the timestamps of the earliest and highest-time user messages
+    void find_superlative_user_times();
+
+    // these are to be used internally when jumping around in the
+    // stream (e.g., for finding the earliest and latest timed
+    // user messages).  They assume
+    //   1) that only functions such as advance_currentLogEntry,
+    //      read_entry and manual traversal of d_logHead/d_logTail
+    //      will be used.
+    // the functions return false if they don't save or restore the bookmark
+    class VRPN_API vrpn_FileBookmark {
+    public:
+        vrpn_FileBookmark();
+        ~vrpn_FileBookmark();
+        bool valid;
+        timeval oldTime;
+        long int file_pos;                   // ftell result
+        vrpn_LOGLIST *oldCurrentLogEntryPtr; // just a pointer, useful for accum
+                                             // or preload
+        vrpn_LOGLIST *oldCurrentLogEntryCopy; // a deep copy, useful for
+                                              // no-accum, no-preload
+    };
+    bool store_stream_bookmark();
+    bool return_to_bookmark();
+    vrpn_FileBookmark d_bookmark;
+
+    // wallclock time at the (beginning of the) last call
+    // to mainloop that played back an event
+    timeval d_last_time; // XXX remove
+
+    class VRPN_API FileTime_Accumulator {
+        // accumulates the amount of time that we will advance
+        // filetime by when we next play back messages.
+        timeval d_filetime_accum_since_last_playback;
+
+        // wallclock time when d_filetime_accum_since_last_playback
+        // was last updated
+        timeval d_time_of_last_accum;
+
+        // scale factor between stream time and wallclock time
+        vrpn_float32 d_replay_rate;
+
+    public:
+        FileTime_Accumulator();
+
+        // return accumulated time since last reset
+        const timeval &accumulated(void)
+        {
+            return d_filetime_accum_since_last_playback;
+        }
+
+        // return last time accumulate_to was called
+        const timeval &time_of_last_accum(void) { return d_time_of_last_accum; }
+
+        vrpn_float32 replay_rate(void) { return d_replay_rate; }
+
+        // add (d_replay_rate * (now_time - d_time_of_last_accum))
+        // to d_filetime_accum_since_last_playback
+        // then set d_time_of_last_accum to now_time
+        void accumulate_to(const timeval &now_time);
+
+        // if current rate is non-zero, then time is accumulated
+        // before d_replay_rate is set to new_rate
+        void set_replay_rate(vrpn_float32 new_rate);
+
+        // set d_time_of_last_accum to now_time
+        // and set d_filetime_accum_since_last_playback to zero
+        void reset_at_time(const timeval &now_time);
+    };
+    FileTime_Accumulator d_filetime_accum;
+
+    // }}}
+    // {{{ actual mechanics of the logfile
+protected:
+    char *d_fileName;
+    FILE *d_file;
+
+    void play_to_user_message();
+
+    // helper function for mainloop()
+    int need_to_play(timeval filetime);
+
+    // checks the cookie at
+    // the head of the log file;
+    //  exit on error!
+    virtual int read_cookie(void);
+
+    virtual int read_entry(void); // appends entry to d_logTail
+                                  // returns 0 on success, 1 on EOF, -1 on error
+
+    // Steps the currentLogEntry pointer forward one.
+    // It handles both cases of preload and non-preload.
+    // returns 0 on success, 1 on EOF, -1 on error
+    virtual int advance_currentLogEntry(void);
+
+    virtual int close_file(void);
+
+    // }}}
+    // {{{ handlers for VRPN control messages that might come from
+    //     a File Controller object that wants to control this
+    //     File Connection.
+protected:
+    static int VRPN_CALLBACK handle_set_replay_rate(void *, vrpn_HANDLERPARAM);
+    static int VRPN_CALLBACK handle_reset(void *, vrpn_HANDLERPARAM);
+    static int VRPN_CALLBACK handle_play_to_time(void *, vrpn_HANDLERPARAM);
+
+    // }}}
+    // {{{ Maintains a doubly-linked list structure that keeps
+    //     copies of the messages from the file in memory.  If
+    //     d_accumulate is false, then there is only ever one entry
+    //     in memory (d_currentLogEntry == d_logHead == d_logTail).
+    //     If d_preload is true, then all of the records from the file
+    //     are read into the list in the constructor and we merely step
+    //     through memory when playing the streamfile.  If d_preload is
+    //     false and d_accumulate is true, then we have all of the
+    //     records up the d_currentLogEntry in memory (d_logTail points
+    //     to d_currentLogEntry but not to the last entry in the file
+    //     until we get to the end of the file).
+    //     The d_currentLogEntry should always be non-NULL unless we are
+    //     past the end of all messages... we will either have preloaded
+    //     all of them or else the read routine will attempt to load the
+    //     next message each time one is played.  The constructor fills it
+    //     in with the first message, which makes it non-NULL initially.
+    //     HOWEVER, if there are no user messages and we're asked to skip
+    //     to the first user message then it can be NULL right after the
+    //     constructor is called.
+protected:
+    vrpn_LOGLIST *d_logHead;         // the first read-in record
+    vrpn_LOGLIST *d_logTail;         // the last read-in record
+    vrpn_LOGLIST *d_currentLogEntry; // Message that we've just loaded, or are
+                                     // at right now
+    vrpn_LOGLIST *d_startEntry; // potentially after initial system messages
+    bool d_preload;             // Should THIS File Connection pre-load?
+    bool d_accumulate;          // Should THIS File Connection accumulate?
+                                // }}}
+};
+
+#endif // VRPN_FILE_CONNECTION_H
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_FileController.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_FileController.h
new file mode 100644
index 0000000000000000000000000000000000000000..1e19c06337eb23224f39c64eb2b85573901ac160
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_FileController.h
@@ -0,0 +1,47 @@
+#ifndef VRPN_FILE_CONTROLLER_H
+#define VRPN_FILE_CONTROLLER_H
+#include "vrpn_Configure.h" // for VRPN_API
+#include "vrpn_Types.h"     // for vrpn_int32, vrpn_float32
+
+class VRPN_API vrpn_Connection; // from vrpn_Connection.h
+
+// class vrpn_File_Controller
+// Tom Hudson, July 1998
+
+// Controls a file connection (logfile playback).
+// Can be attached to any vrpn_Connection.
+// vrpn_File_Connections will respond to the messages.
+
+class VRPN_API vrpn_File_Controller {
+
+public:
+    vrpn_File_Controller(vrpn_Connection *);
+    ~vrpn_File_Controller(void);
+
+    void set_replay_rate(vrpn_float32 = 1.0);
+    // Sets the rate at which the file is replayed.
+
+    void reset(void);
+    // Returns to the beginning of the file.
+    // Does NOT reset rate to 1.0.
+    // Equivalent to set_to_time(< 0L, 0L >)
+
+    void play_to_time(struct timeval t);
+    // Goes to an arbitrary elapsed time t in the file,
+    // triggering all events between the current time and t.
+    // Does not work in the past (use reset() first).
+
+    // void jump_to_time (struct timeval t);
+
+protected:
+    vrpn_Connection *d_connection;
+
+    vrpn_int32 d_myId;
+
+    vrpn_int32 d_set_replay_rate_type;
+    vrpn_int32 d_reset_type;
+    vrpn_int32 d_play_to_time_type;
+    // long d_jump_to_time_type;
+};
+
+#endif // VRPN_FILE_CONTROLLER_H
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_ForceDevice.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_ForceDevice.h
new file mode 100644
index 0000000000000000000000000000000000000000..c3cbc4df5e498cb7d11cc6dacc9d4daa0ad4a073
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_ForceDevice.h
@@ -0,0 +1,730 @@
+#ifndef FORCEDEVICE_H
+#define FORCEDEVICE_H
+
+#include <stddef.h> // for NULL
+
+#include "vrpn_BaseClass.h" // for vrpn_Callback_List, etc
+#include "vrpn_Configure.h" // for VRPN_CALLBACK, VRPN_API
+#include "vrpn_Shared.h"    // for timeval
+#include "vrpn_Types.h"     // for vrpn_int32, vrpn_float32, etc
+
+class VRPN_API vrpn_Connection;
+struct vrpn_HANDLERPARAM;
+
+#define MAXPLANE 4 // maximum number of planes in the scene
+
+// for recovery:
+#define DEFAULT_NUM_REC_CYCLES (10)
+
+// possible values for errorCode:
+#define FD_VALUE_OUT_OF_RANGE 0 // surface parameter out of range
+#define FD_DUTY_CYCLE_ERROR 1   // servo loop is taking too long
+#define FD_FORCE_ERROR 2        // max force exceeded, or motors overheated
+                                // or amplifiers not enabled
+#define FD_MISC_ERROR 3         // everything else
+#define FD_OK 4                 // no error
+
+// If defined, springs are implemented in the client as force fields.
+// If not, springs are implemented with special messages
+// and extra Ghost classes.  Either way support for the messages
+// is compiled into the parent class so that servers can support
+// both kinds of clients.
+
+// (Springs as force fields require some knotty mathematical programming
+// at the clients that I can't seem to get right, but avoid lots of
+// extra message types and an awful lot of bug-prone Ghost.)
+
+#define FD_SPRINGS_AS_FIELDS
+
+class VRPN_API vrpn_ForceDevice : public vrpn_BaseClass {
+
+public:
+    vrpn_ForceDevice(const char *name, vrpn_Connection *c);
+    virtual ~vrpn_ForceDevice(void);
+
+    void print_report(void);
+    void print_plane(void);
+
+    void setSurfaceKspring(vrpn_float32 k) { SurfaceKspring = k; }
+    void setSurfaceKdamping(vrpn_float32 d) { SurfaceKdamping = d; }
+    void setSurfaceFstatic(vrpn_float32 ks) { SurfaceFstatic = ks; }
+    void setSurfaceFdynamic(vrpn_float32 kd) { SurfaceFdynamic = kd; }
+    void setRecoveryTime(int rt) { numRecCycles = rt; }
+
+    // additional surface properties
+    void setSurfaceKadhesionNormal(vrpn_float32 k)
+    {
+        SurfaceKadhesionNormal = k;
+    }
+    void setSurfaceKadhesionLateral(vrpn_float32 k)
+    {
+        SurfaceKadhesionLateral = k;
+    }
+    void setSurfaceBuzzFrequency(vrpn_float32 freq) { SurfaceBuzzFreq = freq; }
+    void setSurfaceBuzzAmplitude(vrpn_float32 amp) { SurfaceBuzzAmp = amp; }
+    void setSurfaceTextureWavelength(vrpn_float32 wl)
+    {
+        SurfaceTextureWavelength = wl;
+    }
+    void setSurfaceTextureAmplitude(vrpn_float32 amp)
+    {
+        SurfaceTextureAmplitude = amp;
+    }
+
+    void setCustomEffect(vrpn_int32 effectId, vrpn_float32 *params = NULL,
+                         vrpn_uint32 nbParams = 0);
+
+    void setFF_Origin(vrpn_float32 x, vrpn_float32 y, vrpn_float32 z)
+    {
+        ff_origin[0] = x;
+        ff_origin[1] = y;
+        ff_origin[2] = z;
+    }
+    void setFF_Origin(vrpn_float32 x[3])
+    {
+        ff_origin[0] = x[0];
+        ff_origin[1] = x[1];
+        ff_origin[2] = x[2];
+    }
+    void setFF_Force(vrpn_float32 fx, vrpn_float32 fy, vrpn_float32 fz)
+    {
+        ff_force[0] = fx;
+        ff_force[1] = fy;
+        ff_force[2] = fz;
+    }
+    void setFF_Force(vrpn_float32 f[3])
+    {
+        ff_force[0] = f[0];
+        ff_force[1] = f[1];
+        ff_force[2] = f[2];
+    }
+    void setFF_Jacobian(vrpn_float32 dfxdx, vrpn_float32 dfxdy,
+                        vrpn_float32 dfxdz, vrpn_float32 dfydx,
+                        vrpn_float32 dfydy, vrpn_float32 dfydz,
+                        vrpn_float32 dfzdx, vrpn_float32 dfzdy,
+                        vrpn_float32 dfzdz)
+    {
+        ff_jacobian[0][0] = dfxdx;
+        ff_jacobian[0][1] = dfxdy;
+        ff_jacobian[0][2] = dfxdz;
+        ff_jacobian[1][0] = dfydx;
+        ff_jacobian[1][1] = dfydy;
+        ff_jacobian[1][2] = dfydz;
+        ff_jacobian[2][0] = dfzdx;
+        ff_jacobian[2][1] = dfzdy;
+        ff_jacobian[2][2] = dfzdz;
+    }
+    void setFF_Radius(vrpn_float32 r) { ff_radius = r; }
+
+    void set_plane(vrpn_float32 *p);
+    void set_plane(vrpn_float32 *p, vrpn_float32 d);
+    void set_plane(vrpn_float32 a, vrpn_float32 b, vrpn_float32 c,
+                   vrpn_float32 d);
+
+    void sendError(int error_code);
+
+    int getRecoveryTime(void) { return numRecCycles; }
+    int connectionAvailable(void) { return (d_connection != NULL); }
+
+    // constants for constraint messages
+
+    enum ConstraintGeometry {
+        NO_CONSTRAINT,
+        POINT_CONSTRAINT,
+        LINE_CONSTRAINT,
+        PLANE_CONSTRAINT
+    };
+
+protected:
+    virtual int register_types(void);
+
+    vrpn_int32 force_message_id;         // ID of force message to connection
+    vrpn_int32 plane_message_id;         // ID of plane equation message
+    vrpn_int32 plane_effects_message_id; // additional plane properties
+    vrpn_int32 forcefield_message_id;    // ID of force field message
+    vrpn_int32 scp_message_id;           // ID of surface contact point message
+
+    // constraint messages
+
+    vrpn_int32 enableConstraint_message_id;
+    vrpn_int32 setConstraintMode_message_id;
+    vrpn_int32 setConstraintPoint_message_id;
+    vrpn_int32 setConstraintLinePoint_message_id;
+    vrpn_int32 setConstraintLineDirection_message_id;
+    vrpn_int32 setConstraintPlanePoint_message_id;
+    vrpn_int32 setConstraintPlaneNormal_message_id;
+    vrpn_int32 setConstraintKSpring_message_id;
+    // vrpn_int32 set_constraint_message_id;// ID of constraint force message
+
+    // XXX - error messages should be put into the vrpn base class
+    // whenever someone makes one
+
+    vrpn_int32 error_message_id; // ID of force device error message
+
+    // IDs for trimesh messages
+
+    vrpn_int32 addObject_message_id;
+    vrpn_int32 addObjectExScene_message_id;
+    vrpn_int32 moveToParent_message_id;
+    vrpn_int32 setObjectPosition_message_id;
+    vrpn_int32 setObjectOrientation_message_id;
+    vrpn_int32 setObjectScale_message_id;
+    vrpn_int32 removeObject_message_id;
+    vrpn_int32 setVertex_message_id;
+    vrpn_int32 setNormal_message_id;
+    vrpn_int32 setTriangle_message_id;
+    vrpn_int32 removeTriangle_message_id;
+    vrpn_int32 updateTrimeshChanges_message_id;
+    vrpn_int32 transformTrimesh_message_id;
+    vrpn_int32 setTrimeshType_message_id;
+    vrpn_int32 clearTrimesh_message_id;
+
+    // IDs for scene messages
+    vrpn_int32 setHapticOrigin_message_id;
+    vrpn_int32 setHapticScale_message_id;
+    vrpn_int32 setSceneOrigin_message_id;
+    vrpn_int32 getNewObjectID_message_id;
+    vrpn_int32 setObjectIsTouchable_message_id;
+
+    // ajout ONDIM
+    vrpn_int32 custom_effect_message_id;
+    // fni ajout ONDIM
+
+    // ENCODING
+    // ajout ONDIM
+    static char *encode_custom_effect(vrpn_int32 &len, vrpn_uint32 effectId,
+                                      const vrpn_float32 *params,
+                                      vrpn_uint32 nbParams);
+    // fin ajout ONDIM
+    static char *encode_force(vrpn_int32 &length, const vrpn_float64 *force);
+    static char *encode_scp(vrpn_int32 &length, const vrpn_float64 *pos,
+                            const vrpn_float64 *quat);
+    static char *encode_plane(vrpn_int32 &length, const vrpn_float32 *plane,
+                              const vrpn_float32 kspring,
+                              const vrpn_float32 kdamp, const vrpn_float32 fdyn,
+                              const vrpn_float32 fstat,
+                              const vrpn_int32 plane_index,
+                              const vrpn_int32 n_rec_cycles);
+    static char *encode_surface_effects(vrpn_int32 &len,
+                                        const vrpn_float32 k_adhesion_norm,
+                                        const vrpn_float32 k_adhesion_lat,
+                                        const vrpn_float32 tex_amp,
+                                        const vrpn_float32 tex_wl,
+                                        const vrpn_float32 buzz_amp,
+                                        const vrpn_float32 buzz_freq);
+    static char *encode_vertex(vrpn_int32 &len, const vrpn_int32 objNum,
+                               const vrpn_int32 vertNum, const vrpn_float32 x,
+                               const vrpn_float32 y, const vrpn_float32 z);
+    static char *encode_normal(vrpn_int32 &len, const vrpn_int32 objNum,
+                               const vrpn_int32 vertNum, const vrpn_float32 x,
+                               const vrpn_float32 y, const vrpn_float32 z);
+    static char *encode_triangle(vrpn_int32 &len, const vrpn_int32 objNum,
+                                 const vrpn_int32 triNum,
+                                 const vrpn_int32 vert0, const vrpn_int32 vert1,
+                                 const vrpn_int32 vert2, const vrpn_int32 norm0,
+                                 const vrpn_int32 norm1,
+                                 const vrpn_int32 norm2);
+    static char *encode_removeTriangle(vrpn_int32 &len, const vrpn_int32 objNum,
+                                       const vrpn_int32 triNum);
+    static char *encode_updateTrimeshChanges(vrpn_int32 &len,
+                                             const vrpn_int32 objNum,
+                                             const vrpn_float32 kspring,
+                                             const vrpn_float32 kdamp,
+                                             const vrpn_float32 fdyn,
+                                             const vrpn_float32 fstat);
+    static char *encode_setTrimeshType(vrpn_int32 &len, const vrpn_int32 objNum,
+                                       const vrpn_int32 type);
+    static char *encode_trimeshTransform(vrpn_int32 &len,
+                                         const vrpn_int32 objNum,
+                                         const vrpn_float32 homMatrix[16]);
+
+    //*added encodes*//
+    static char *encode_addObject(vrpn_int32 &len, const vrpn_int32 objNum,
+                                  const vrpn_int32 ParentNum);
+    static char *encode_addObjectExScene(vrpn_int32 &len,
+                                         const vrpn_int32 objNum);
+    static char *encode_objectPosition(vrpn_int32 &len, const vrpn_int32 objNum,
+                                       const vrpn_float32 Pos[3]);
+    static char *encode_objectOrientation(vrpn_int32 &len,
+                                          const vrpn_int32 objNum,
+                                          const vrpn_float32 axis[3],
+                                          const vrpn_float32 angle);
+    static char *encode_objectScale(vrpn_int32 &len, const vrpn_int32 objNum,
+                                    const vrpn_float32 Scale[3]);
+    static char *encode_removeObject(vrpn_int32 &len, const vrpn_int32 objNum);
+    static char *encode_clearTrimesh(vrpn_int32 &len, const vrpn_int32 objNum);
+    static char *encode_moveToParent(vrpn_int32 &len, const vrpn_int32 objNum,
+                                     const vrpn_int32 parentNum);
+
+    static char *encode_setHapticOrigin(vrpn_int32 &len,
+                                        const vrpn_float32 Pos[3],
+                                        const vrpn_float32 axis[3],
+                                        const vrpn_float32 angle);
+    static char *encode_setSceneOrigin(vrpn_int32 &len,
+                                       const vrpn_float32 Pos[3],
+                                       const vrpn_float32 axis[3],
+                                       const vrpn_float32 angle);
+    static char *encode_setHapticScale(vrpn_int32 &len,
+                                       const vrpn_float32 Scale);
+    static char *encode_setObjectIsTouchable(vrpn_int32 &len,
+                                             const vrpn_int32 objNum,
+                                             const vrpn_bool isTouchable);
+
+    static char *encode_forcefield(vrpn_int32 &len,
+                                   const vrpn_float32 origin[3],
+                                   const vrpn_float32 force[3],
+                                   const vrpn_float32 jacobian[3][3],
+                                   const vrpn_float32 radius);
+    static char *encode_error(vrpn_int32 &len, const vrpn_int32 error_code);
+
+    // DECODING
+    // ajout ONDIM
+    static vrpn_int32 decode_custom_effect(const char *buffer,
+                                           const vrpn_int32 len,
+                                           vrpn_uint32 *effectId,
+                                           vrpn_float32 **params,
+                                           vrpn_uint32 *nbParams);
+    // fin ajout ONDIM
+    static vrpn_int32 decode_force(const char *buffer, const vrpn_int32 len,
+                                   vrpn_float64 *force);
+    static vrpn_int32 decode_scp(const char *buffer, const vrpn_int32 len,
+                                 vrpn_float64 *pos, vrpn_float64 *quat);
+    static vrpn_int32 decode_plane(const char *buffer, const vrpn_int32 len,
+                                   vrpn_float32 *plane, vrpn_float32 *kspring,
+                                   vrpn_float32 *kdamp, vrpn_float32 *fdyn,
+                                   vrpn_float32 *fstat, vrpn_int32 *plane_index,
+                                   vrpn_int32 *n_rec_cycles);
+    static vrpn_int32 decode_surface_effects(
+        const char *buffer, const vrpn_int32 len, vrpn_float32 *k_adhesion_norm,
+        vrpn_float32 *k_adhesion_lat, vrpn_float32 *tex_amp,
+        vrpn_float32 *tex_wl, vrpn_float32 *buzz_amp, vrpn_float32 *buzz_freq);
+    static vrpn_int32 decode_vertex(const char *buffer, const vrpn_int32 len,
+                                    vrpn_int32 *objNum, vrpn_int32 *vertNum,
+                                    vrpn_float32 *x, vrpn_float32 *y,
+                                    vrpn_float32 *z);
+    static vrpn_int32 decode_normal(const char *buffer, const vrpn_int32 len,
+                                    vrpn_int32 *objNum, vrpn_int32 *vertNum,
+                                    vrpn_float32 *x, vrpn_float32 *y,
+                                    vrpn_float32 *z);
+    static vrpn_int32 decode_triangle(const char *buffer, const vrpn_int32 len,
+                                      vrpn_int32 *objNum, vrpn_int32 *triNum,
+                                      vrpn_int32 *vert0, vrpn_int32 *vert1,
+                                      vrpn_int32 *vert2, vrpn_int32 *norm0,
+                                      vrpn_int32 *norm1, vrpn_int32 *norm2);
+    static vrpn_int32 decode_removeTriangle(const char *buffer,
+                                            const vrpn_int32 len,
+                                            vrpn_int32 *objNum,
+                                            vrpn_int32 *triNum);
+    static vrpn_int32
+    decode_updateTrimeshChanges(const char *buffer, const vrpn_int32 len,
+                                vrpn_int32 *objNum, vrpn_float32 *kspring,
+                                vrpn_float32 *kdamp, vrpn_float32 *fdyn,
+                                vrpn_float32 *fstat);
+    static vrpn_int32 decode_setTrimeshType(const char *buffer,
+                                            const vrpn_int32 len,
+                                            vrpn_int32 *objNum,
+                                            vrpn_int32 *type);
+    static vrpn_int32 decode_trimeshTransform(const char *buffer,
+                                              const vrpn_int32 len,
+                                              vrpn_int32 *objNum,
+                                              vrpn_float32 homMatrix[16]);
+
+    //*added decodes*//
+    static vrpn_int32 decode_addObject(const char *buffer, vrpn_int32 len,
+                                       vrpn_int32 *objNum,
+                                       vrpn_int32 *ParentNum);
+    static vrpn_int32 decode_addObjectExScene(const char *buffer,
+                                              vrpn_int32 len,
+                                              vrpn_int32 *objNum);
+    static vrpn_int32 decode_objectPosition(const char *buffer, vrpn_int32 len,
+                                            vrpn_int32 *objNum,
+                                            vrpn_float32 Pos[3]);
+    static vrpn_int32 decode_objectOrientation(const char *buffer,
+                                               vrpn_int32 len,
+                                               vrpn_int32 *objNum,
+                                               vrpn_float32 axis[3],
+                                               vrpn_float32 *angle);
+    static vrpn_int32 decode_objectScale(const char *buffer, vrpn_int32 len,
+                                         vrpn_int32 *objNum,
+                                         vrpn_float32 Scale[3]);
+    static vrpn_int32 decode_removeObject(const char *buffer, vrpn_int32 len,
+                                          vrpn_int32 *objNum);
+    static vrpn_int32 decode_clearTrimesh(const char *buffer, vrpn_int32 len,
+                                          vrpn_int32 *objNum);
+    static vrpn_int32 decode_moveToParent(const char *buffer, vrpn_int32 len,
+                                          vrpn_int32 *objNum,
+                                          vrpn_int32 *parentNum);
+
+    static vrpn_int32 decode_setHapticOrigin(const char *buffer, vrpn_int32 len,
+                                             vrpn_float32 Pos[3],
+                                             vrpn_float32 axis[3],
+                                             vrpn_float32 *angle);
+    static vrpn_int32 decode_setHapticScale(const char *buffer, vrpn_int32 len,
+                                            vrpn_float32 *Scale);
+    static vrpn_int32 decode_setSceneOrigin(const char *buffer, vrpn_int32 len,
+                                            vrpn_float32 Pos[3],
+                                            vrpn_float32 axis[3],
+                                            vrpn_float32 *angle);
+    static vrpn_int32 decode_setObjectIsTouchable(const char *buffer,
+                                                  vrpn_int32 len,
+                                                  vrpn_int32 *objNum,
+                                                  vrpn_bool *isTouchable);
+
+    static vrpn_int32
+    decode_forcefield(const char *buffer, const vrpn_int32 len,
+                      vrpn_float32 origin[3], vrpn_float32 force[3],
+                      vrpn_float32 jacobian[3][3], vrpn_float32 *radius);
+    static vrpn_int32 decode_error(const char *buffer, const vrpn_int32 len,
+                                   vrpn_int32 *error_code);
+
+    // constraint encoding & decoding
+
+    static char *encode_enableConstraint(vrpn_int32 &len, vrpn_int32 enable);
+    static vrpn_int32 decode_enableConstraint(const char *buffer,
+                                              const vrpn_int32 len,
+                                              vrpn_int32 *enable);
+
+    static char *encode_setConstraintMode(vrpn_int32 &len,
+                                          ConstraintGeometry mode);
+    static vrpn_int32 decode_setConstraintMode(const char *buffer,
+                                               const vrpn_int32 len,
+                                               ConstraintGeometry *mode);
+
+    static char *encode_setConstraintPoint(vrpn_int32 &len, vrpn_float32 x,
+                                           vrpn_float32 y, vrpn_float32 z);
+    static vrpn_int32 decode_setConstraintPoint(const char *buffer,
+                                                const vrpn_int32 len,
+                                                vrpn_float32 *x,
+                                                vrpn_float32 *y,
+                                                vrpn_float32 *z);
+
+    static char *encode_setConstraintLinePoint(vrpn_int32 &len, vrpn_float32 x,
+                                               vrpn_float32 y, vrpn_float32 z);
+    static vrpn_int32 decode_setConstraintLinePoint(const char *buffer,
+                                                    const vrpn_int32 len,
+                                                    vrpn_float32 *x,
+                                                    vrpn_float32 *y,
+                                                    vrpn_float32 *z);
+
+    static char *encode_setConstraintLineDirection(vrpn_int32 &len,
+                                                   vrpn_float32 x,
+                                                   vrpn_float32 y,
+                                                   vrpn_float32 z);
+    static vrpn_int32 decode_setConstraintLineDirection(const char *buffer,
+                                                        const vrpn_int32 len,
+                                                        vrpn_float32 *x,
+                                                        vrpn_float32 *y,
+                                                        vrpn_float32 *z);
+
+    static char *encode_setConstraintPlanePoint(vrpn_int32 &len, vrpn_float32 x,
+                                                vrpn_float32 y, vrpn_float32 z);
+    static vrpn_int32 decode_setConstraintPlanePoint(const char *buffer,
+                                                     const vrpn_int32 len,
+                                                     vrpn_float32 *x,
+                                                     vrpn_float32 *y,
+                                                     vrpn_float32 *z);
+
+    static char *encode_setConstraintPlaneNormal(vrpn_int32 &len,
+                                                 vrpn_float32 x, vrpn_float32 y,
+                                                 vrpn_float32 z);
+    static vrpn_int32 decode_setConstraintPlaneNormal(const char *buffer,
+                                                      const vrpn_int32 len,
+                                                      vrpn_float32 *x,
+                                                      vrpn_float32 *y,
+                                                      vrpn_float32 *z);
+
+    static char *encode_setConstraintKSpring(vrpn_int32 &len, vrpn_float32 k);
+    static vrpn_int32 decode_setConstraintKSpring(const char *buffer,
+                                                  const vrpn_int32 len,
+                                                  vrpn_float32 *k);
+
+    // utility functions
+
+    static char *encodePoint(vrpn_int32 &len, vrpn_float32 x, vrpn_float32 y,
+                             vrpn_float32 z);
+    static vrpn_int32 decodePoint(const char *buffer, const vrpn_int32 len,
+                                  vrpn_float32 *x, vrpn_float32 *y,
+                                  vrpn_float32 *z);
+
+    struct timeval timestamp;
+
+    vrpn_int32 which_plane;
+
+    vrpn_float64 d_force[3];
+    ///< d_force isn't used in vrpn_ForceDevice, but seems to be used
+    ///< by derived classes?  What's the meaning?
+
+    vrpn_float64 scp_pos[3];
+    vrpn_float64 scp_quat[4]; // for torque
+    vrpn_float32 plane[4];
+
+    vrpn_float32 ff_origin[3];
+    vrpn_float32 ff_force[3];
+    vrpn_float32 ff_jacobian[3][3]; // J[i][j] = dF[i]/dx[j]
+    vrpn_float32 ff_radius;
+
+    vrpn_float32 SurfaceKspring;
+    vrpn_float32 SurfaceKdamping;
+    vrpn_float32 SurfaceFstatic;
+    vrpn_float32 SurfaceFdynamic;
+    vrpn_int32 numRecCycles;
+    vrpn_int32 errorCode;
+
+    vrpn_float32 SurfaceKadhesionLateral;
+    vrpn_float32 SurfaceKadhesionNormal;
+    vrpn_float32 SurfaceBuzzFreq;
+    vrpn_float32 SurfaceBuzzAmp;
+    vrpn_float32 SurfaceTextureWavelength;
+    vrpn_float32 SurfaceTextureAmplitude;
+
+    // ajout ONDIM
+    vrpn_int32 customEffectId;
+    vrpn_float32 *customEffectParams;
+    vrpn_uint32 nbCustomEffectParams;
+    // fin ajout ONDIM
+};
+
+// User routine to handle position reports for surface contact point (SCP)
+// This is in vrpn_ForceDevice rather than vrpn_Tracker because only
+// a force feedback device should know anything about SCPs as this is a
+// part of the force feedback model. It may be preferable to use the SCP
+// rather than the tracker position for graphics so the hand position
+// doesn't appear to go below the surface making the surface look very
+// compliant.
+typedef struct _vrpn_FORCESCPCB {
+    struct timeval msg_time; // Time of the report
+    vrpn_float64 pos[3];     // position of SCP
+    vrpn_float64 quat[4];    // orientation of SCP
+} vrpn_FORCESCPCB;
+typedef void(VRPN_CALLBACK *vrpn_FORCESCPHANDLER)(void *userdata,
+                                                  const vrpn_FORCESCPCB info);
+
+typedef struct _vrpn_FORCECB {
+    struct timeval msg_time; // Time of the report
+    vrpn_float64 force[3];   // force value
+} vrpn_FORCECB;
+typedef void(VRPN_CALLBACK *vrpn_FORCECHANGEHANDLER)(void *userdata,
+                                                     const vrpn_FORCECB info);
+
+typedef struct _vrpn_FORCEERRORCB {
+    struct timeval msg_time; // time of the report
+    vrpn_int32 error_code;   // type of error
+} vrpn_FORCEERRORCB;
+typedef void(VRPN_CALLBACK *vrpn_FORCEERRORHANDLER)(
+    void *userdata, const vrpn_FORCEERRORCB info);
+
+class VRPN_API vrpn_ForceDevice_Remote : public vrpn_ForceDevice {
+public:
+    // The name of the force device to connect to.
+    // The connection argument is used only if you already have a connection
+    // the device must listen on (it is not normally used).
+    vrpn_ForceDevice_Remote(const char *name, vrpn_Connection *cn = NULL);
+    virtual ~vrpn_ForceDevice_Remote(void);
+
+    void sendSurface(void);
+    void startSurface(void);
+    void stopSurface(void);
+
+    /** functions for a single object
+     * **********************************************************/
+    // vertNum normNum and triNum start at 0
+    void setVertex(vrpn_int32 vertNum, vrpn_float32 x, vrpn_float32 y,
+                   vrpn_float32 z);
+    // NOTE: ghost doesn't take normals,
+    //       and normals still aren't implemented for Hcollide
+    void setNormal(vrpn_int32 normNum, vrpn_float32 x, vrpn_float32 y,
+                   vrpn_float32 z);
+    void setTriangle(vrpn_int32 triNum, vrpn_int32 vert0, vrpn_int32 vert1,
+                     vrpn_int32 vert2, vrpn_int32 norm0 = -1,
+                     vrpn_int32 norm1 = -1, vrpn_int32 norm2 = -1);
+    void removeTriangle(vrpn_int32 triNum);
+    // should be called to incorporate the above changes into the
+    // displayed trimesh
+    void updateTrimeshChanges();
+    // set the trimesh's homogen transform matrix (in row major order)
+    void setTrimeshTransform(vrpn_float32 homMatrix[16]);
+    void clearTrimesh(void);
+
+    /** functions for multiple objects in the haptic scene
+     * *************************************/
+    // Add an object to the haptic scene as root (parent -1 = default) or as
+    // child (ParentNum =the number of the parent)
+    void addObject(vrpn_int32 objNum, vrpn_int32 ParentNum = -1);
+    // Add an object next to the haptic scene as root
+    void addObjectExScene(vrpn_int32 objNum);
+    // vertNum normNum and triNum start at 0
+    void setObjectVertex(vrpn_int32 objNum, vrpn_int32 vertNum, vrpn_float32 x,
+                         vrpn_float32 y, vrpn_float32 z);
+    // NOTE: ghost doesn't take normals,
+    //       and normals still aren't implemented for Hcollide
+    void setObjectNormal(vrpn_int32 objNum, vrpn_int32 normNum, vrpn_float32 x,
+                         vrpn_float32 y, vrpn_float32 z);
+    void setObjectTriangle(vrpn_int32 objNum, vrpn_int32 triNum,
+                           vrpn_int32 vert0, vrpn_int32 vert1, vrpn_int32 vert2,
+                           vrpn_int32 norm0 = -1, vrpn_int32 norm1 = -1,
+                           vrpn_int32 norm2 = -1);
+    void removeObjectTriangle(vrpn_int32 objNum, vrpn_int32 triNum);
+    // should be called to incorporate the above changes into the
+    // displayed trimesh
+    void updateObjectTrimeshChanges(vrpn_int32 objNum);
+    // set the trimesh's homogen transform matrix (in row major order)
+    void setObjectTrimeshTransform(vrpn_int32 objNum,
+                                   vrpn_float32 homMatrix[16]);
+    // set position of an object
+    void setObjectPosition(vrpn_int32 objNum, vrpn_float32 Pos[3]);
+    // set orientation of an object
+    void setObjectOrientation(vrpn_int32 objNum, vrpn_float32 axis[3],
+                              vrpn_float32 angle);
+    // set Scale of an object only x scale is supported at the moment
+    void setObjectScale(vrpn_int32 objNum, vrpn_float32 Scale[3]);
+    // remove an object from the scene
+    void removeObject(vrpn_int32 objNum);
+    void clearObjectTrimesh(vrpn_int32 objNum);
+
+    /** Functions to organize the scene
+     * **********************************************************/
+    // Change The parent of an object
+    void moveToParent(vrpn_int32 objNum, vrpn_int32 ParentNum);
+    // Set the Origin of the haptic device
+    void setHapticOrigin(vrpn_float32 Pos[3], vrpn_float32 axis[3],
+                         vrpn_float32 angle);
+    // Set the scale factor of the haptic device
+    void setHapticScale(vrpn_float32 Scale);
+    // Set the Origin of the scene
+    void setSceneOrigin(vrpn_float32 Pos[3], vrpn_float32 axis[3],
+                        vrpn_float32 angle);
+    // get new ID, use only if wish to use vrpn ids and do not want to manage
+    // them yourself: ids need to be unique
+    vrpn_int32 getNewObjectID();
+    // make an object touchable or not
+    void setObjectIsTouchable(vrpn_int32 objNum, vrpn_bool IsTouchable = true);
+
+    // the next time we send a trimesh we will use the following type
+    void useHcollide();
+    void useGhost();
+
+    // Generalized constraint code.
+    // Constrains as a spring connected to a point, sliding along a line
+    // (constraint forces in a plane perpendicular to the line), or
+    // sliding along a plane (constraint forces only along the plane's
+    // normal).  LineDirection and PlaneNormal should be normalized
+    // (vector length == 1).
+
+    // Constraints are implemented as force fields, so both cannot
+    // run at once.
+
+    // XXX it would be safer if changes (especially enable/disable)
+    // had better relaxation support
+
+    void enableConstraint(vrpn_int32 enable); // zero disables
+    void setConstraintMode(ConstraintGeometry mode);
+    void setConstraintPoint(vrpn_float32 point[3]);
+    void setConstraintLinePoint(vrpn_float32 point[3]);
+    void setConstraintLineDirection(vrpn_float32 direction[3]);
+    void setConstraintPlanePoint(vrpn_float32 point[3]);
+    void setConstraintPlaneNormal(vrpn_float32 normal[3]);
+    void setConstraintKSpring(vrpn_float32 k);
+
+    // void sendConstraint (vrpn_int32 enable, vrpn_float32 x,
+    // vrpn_float32 y, vrpn_float32 z, vrpn_float32 kSpr);
+
+    // At the <origin> of the field, user feels the specified <force>.
+    // As the user moves away from the origin, the force felt changes
+    // according to the jacobian.  If the user moves further than <radius>
+    // from <origin>, the field cuts out.
+
+    // XXX it would be safer for the field to attenuate rapidly
+    // from the value at the radius if the user moves beyond the radius
+
+    void sendForceField(vrpn_float32 origin[3], vrpn_float32 force[3],
+                        vrpn_float32 jacobian[3][3], vrpn_float32 radius);
+    void sendForceField(void);
+    void stopForceField(void);
+
+    // ajout ONDIM
+    void startEffect(void);
+    void stopEffect(void);
+    // fin ajout ONDIM
+
+    // This routine calls the mainloop of the connection it is on
+    virtual void mainloop();
+
+    // (un)Register a callback handler to handle a force change
+    // and plane equation change and trimesh change
+    virtual int register_force_change_handler(void *userdata,
+                                              vrpn_FORCECHANGEHANDLER handler)
+    {
+        return d_change_list.register_handler(userdata, handler);
+    };
+    virtual int unregister_force_change_handler(void *userdata,
+                                                vrpn_FORCECHANGEHANDLER handler)
+    {
+        return d_change_list.unregister_handler(userdata, handler);
+    };
+
+    virtual int register_scp_change_handler(void *userdata,
+                                            vrpn_FORCESCPHANDLER handler)
+    {
+        return d_scp_change_list.register_handler(userdata, handler);
+    };
+    virtual int unregister_scp_change_handler(void *userdata,
+                                              vrpn_FORCESCPHANDLER handler)
+    {
+        return d_scp_change_list.unregister_handler(userdata, handler);
+    };
+
+    virtual int register_error_handler(void *userdata,
+                                       vrpn_FORCEERRORHANDLER handler)
+    {
+        return d_error_change_list.register_handler(userdata, handler);
+    };
+    virtual int unregister_error_handler(void *userdata,
+                                         vrpn_FORCEERRORHANDLER handler)
+    {
+        return d_error_change_list.unregister_handler(userdata, handler);
+    };
+
+protected:
+    vrpn_Callback_List<vrpn_FORCECB> d_change_list;
+    static int VRPN_CALLBACK
+    handle_force_change_message(void *userdata, vrpn_HANDLERPARAM p);
+
+    vrpn_Callback_List<vrpn_FORCESCPCB> d_scp_change_list;
+    static int VRPN_CALLBACK
+    handle_scp_change_message(void *userdata, vrpn_HANDLERPARAM p);
+
+    vrpn_Callback_List<vrpn_FORCEERRORCB> d_error_change_list;
+    static int VRPN_CALLBACK
+    handle_error_change_message(void *userdata, vrpn_HANDLERPARAM p);
+
+    // constraint types
+
+    vrpn_int32 d_conEnabled;
+    ConstraintGeometry d_conMode;
+    vrpn_float32 d_conPoint[3];
+    vrpn_float32 d_conLinePoint[3];
+    vrpn_float64 d_conLineDirection[3]; // (assumed) normalized
+    vrpn_float32 d_conPlanePoint[3];
+    vrpn_float64 d_conPlaneNormal[3]; // (assumed) normalized
+    vrpn_float32 d_conKSpring;
+
+    // haptic scene variables
+    vrpn_int32 m_NextAvailableObjectID;
+
+    // utility functions
+
+    void send(const char *msgbuf, vrpn_int32 len, vrpn_int32 type);
+// Takes a pointer to a buffer, the length of the buffer, and the
+// vrpn message type id to send.  Sends the buffer reliably
+// over connection AND DELETES THE BUFFER.
+
+#ifdef FD_SPRINGS_AS_FIELDS
+
+    void constraintToForceField(void);
+// takes the current cs_* settings and translates them into
+// a force field.
+
+#endif // FD_SPRINGS_AS_FIELDS
+};
+
+#endif
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_Forwarder.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_Forwarder.h
new file mode 100644
index 0000000000000000000000000000000000000000..df9f08f8bcbb7208d1ab8c23d7fb3a4622469bd0
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_Forwarder.h
@@ -0,0 +1,132 @@
+#ifndef VRPN_FORWARDER_H
+#define VRPN_FORWARDER_H
+
+#include "vrpn_Configure.h"  // for VRPN_API, VRPN_CALLBACK
+#include "vrpn_Connection.h" // for vrpn_Connection (ptr only), etc
+#include "vrpn_Types.h"      // for vrpn_int32, vrpn_uint32
+
+// vrpn_Forwarder
+// Tom Hudson, August 1998
+//
+// Class to take messages from one VRPN connection and send them out
+// on another.
+
+// Design decisions:
+//   Scale of forwarding:
+//     Could write a forwarder per stream (serviceName per instantiation)
+//     or per connection (serviceName per forward() call).  Latter is
+//     more flexible, but takes up more memory if few distinct streams need
+//     to be forwarded, has a clunkier syntax, ...
+//   Flexibility of naming:
+//     We allow users to take in a message of one name and send it out
+//     with another name;  this is useful and dangerous.
+
+// Faults:
+//   There is currently no way to specify vrpn_SENDER_ANY as a source.
+// If we do, it isn't clear what sender to specify to the destination.
+
+class VRPN_API vrpn_ConnectionForwarder {
+
+public:
+    // Set up to forward messages from <source> to <destination>
+    vrpn_ConnectionForwarder(vrpn_Connection *source,
+                             vrpn_Connection *destination);
+
+    ~vrpn_ConnectionForwarder(void);
+
+    // Begins forwarding of a message type.
+    // Forwards messages of type <sourceName> and sender <sourceServiceName>,
+    // sending them out as type <destinationName> from sender
+    // <destinationServiceName>.
+    // Return nonzero on failure.
+    int forward(const char *sourceName, const char *sourceServiceName,
+                const char *destinationName, const char *destinationServiceName,
+                vrpn_uint32 classOfService = vrpn_CONNECTION_RELIABLE);
+
+    // Stops forwarding of a message type.
+    // Return nonzero on failure.
+    int unforward(const char *sourceName, const char *sourceServiceName,
+                  const char *destinationName,
+                  const char *destinationServiceName,
+                  vrpn_uint32 classOfService = vrpn_CONNECTION_RELIABLE);
+
+private:
+    static int VRPN_CALLBACK handle_message(void *, vrpn_HANDLERPARAM);
+
+    // Translates (id, serviceId) from source to destination
+    // and looks up intended class of service.
+    // Returns nonzero if lookup fails.
+    vrpn_int32 map(vrpn_int32 *id, vrpn_int32 *serviceId,
+                   vrpn_uint32 *serviceClass);
+
+    vrpn_Connection *d_source;
+    vrpn_Connection *d_destination;
+
+    struct vrpn_CONNECTIONFORWARDERRECORD {
+
+        vrpn_CONNECTIONFORWARDERRECORD(vrpn_Connection *, vrpn_Connection *,
+                                       const char *, const char *, const char *,
+                                       const char *, vrpn_uint32);
+
+        vrpn_int32 sourceId;             // source's type id
+        vrpn_int32 sourceServiceId;      // source's sender id
+        vrpn_int32 destinationId;        // destination's type id
+        vrpn_int32 destinationServiceId; // destination's sender id
+        vrpn_uint32 classOfService;      // class of service to send
+
+        vrpn_CONNECTIONFORWARDERRECORD *next;
+    };
+
+    vrpn_CONNECTIONFORWARDERRECORD *d_list;
+};
+
+class VRPN_API vrpn_StreamForwarder {
+
+public:
+    // Set up to forward messages from sender <sourceServiceName> on <source>
+    // to <destination>, as if from sender <destinationServiceName>
+    vrpn_StreamForwarder(vrpn_Connection *source, const char *sourceServiceName,
+                         vrpn_Connection *destination,
+                         const char *destinationServiceName);
+
+    ~vrpn_StreamForwarder(void);
+
+    // Begins forwarding of a message type.
+    // Return nonzero on failure.
+    int forward(const char *sourceName, const char *destinationName,
+                vrpn_uint32 classOfService = vrpn_CONNECTION_RELIABLE);
+
+    // Stops forwarding of a message type.
+    // Return nonzero on failure.
+    int unforward(const char *sourceName, const char *destinationName,
+                  vrpn_uint32 classOfService = vrpn_CONNECTION_RELIABLE);
+
+private:
+    static int VRPN_CALLBACK handle_message(void *, vrpn_HANDLERPARAM);
+
+    // Translates (id, serviceId) from source to destination
+    // and looks up intended class of service.
+    // Returns nonzero if lookup fails.
+    vrpn_int32 map(vrpn_int32 *id, vrpn_uint32 *serviceClass);
+
+    vrpn_Connection *d_source;
+    vrpn_int32 d_sourceService;
+    vrpn_Connection *d_destination;
+    vrpn_int32 d_destinationService;
+
+    struct vrpn_STREAMFORWARDERRECORD {
+
+        vrpn_STREAMFORWARDERRECORD(vrpn_Connection *, vrpn_Connection *,
+                                   const char *, const char *, vrpn_uint32);
+
+        vrpn_int32 sourceId;        // source's type id
+        vrpn_int32 destinationId;   // destination's type id
+        vrpn_uint32 classOfService; // class of service to send
+
+        vrpn_STREAMFORWARDERRECORD *next;
+    };
+
+    vrpn_STREAMFORWARDERRECORD *d_list;
+};
+
+#endif // VRPN_FORWARDER_H
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_ForwarderController.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_ForwarderController.h
new file mode 100644
index 0000000000000000000000000000000000000000..807b49618f848f254f95318ec487529576680cef
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_ForwarderController.h
@@ -0,0 +1,131 @@
+#ifndef VRPN_FORWARDER_CONTROLLER_H
+#define VRPN_FORWARDER_CONTROLLER_H
+
+#include "vrpn_Configure.h" // for VRPN_API, VRPN_CALLBACK
+#include "vrpn_Types.h"     // for vrpn_int32
+// vrpn_Forwarder_Controller
+//
+// Tom Hudson, September 1998
+
+// Written to allow remote a client to tell a server to open another port
+// and forward some messages on it to a friend of the client's.
+
+// Any server that wishes to implement this needs only construct a
+// vrpn_Forwarder_Server for each server connection it has open and
+// to call the vrpn_Forwarder_Server mainloop frequently.
+
+// Clients can construct a vrpn_Forwarder_Controller on a connection
+// and call start_remote_forwarding(port) to tell the server to open
+// <port>, then call forward_message_type(port, name) to start forwarding
+// messages of the given name.
+
+// This isn't an ideal solution, because it means clients need access to
+// the names of the message, which they are normally insulated from.
+
+// Some of the fancier options of the Forwarder (renaming services or
+// types, changing class of service) are hidden from the user;  this
+// is meant to be a simple interface and simple first implementation.
+
+// New Forwarder_Servers are NOT constructed on connections that a
+// Forwarder_Server opens, so clients that are only listening to a
+// forwarded stream cannot open new forwarders for still other clients to
+// listen to.
+
+class VRPN_API vrpn_ConnectionForwarder;
+class VRPN_API vrpn_Connection;
+struct vrpn_HANDLERPARAM;
+
+class VRPN_API vrpn_Forwarder_Brain {
+
+public:
+    vrpn_Forwarder_Brain(vrpn_Connection *);
+    virtual ~vrpn_Forwarder_Brain(void);
+
+    // Tell a Forwarder_Server to open a vrpn_Connection on remote_port.
+
+    virtual void start_remote_forwarding(vrpn_int32 remote_port) = 0;
+
+    // Tell a Forwarder_Server to begin forwarding messages of type
+    // message_type from the sender named service_name over remote_port.
+
+    virtual void forward_message_type(vrpn_int32 remote_port,
+                                      const char *service_name,
+                                      const char *message_type) = 0;
+
+protected:
+    vrpn_Connection *d_connection;
+
+    vrpn_int32 d_myId;
+
+    vrpn_int32 d_start_forwarding_type;
+    vrpn_int32 d_forward_type;
+
+    static char *encode_start_remote_forwarding(vrpn_int32 *length,
+                                                vrpn_int32 remote_port);
+    static char *encode_forward_message_type(vrpn_int32 *length,
+                                             vrpn_int32 remote_port,
+                                             const char *service_name,
+                                             const char *message_type);
+
+    static void decode_start_remote_forwarding(const char *buffer,
+                                               vrpn_int32 *remote_port);
+    static void decode_forward_message_type(const char *buffer,
+                                            vrpn_int32 *remote_port,
+                                            char **service_name,
+                                            char **message_type);
+};
+
+// Server class
+
+// VRPN server builders who want to enable remotely-controlled forwarding in
+// their server need only create a Forwarder_Server on their server Connections
+// and call its mainloop() regularly.
+
+struct vrpn_Forwarder_List {
+    vrpn_Forwarder_List *next;
+    vrpn_int32 port;
+    vrpn_Connection *connection;
+    vrpn_ConnectionForwarder *forwarder;
+};
+
+class VRPN_API vrpn_Forwarder_Server : public vrpn_Forwarder_Brain {
+
+public:
+    vrpn_Forwarder_Server(vrpn_Connection *);
+    virtual ~vrpn_Forwarder_Server(void);
+
+    virtual void mainloop(void);
+
+    virtual void start_remote_forwarding(vrpn_int32 remote_port);
+
+    virtual void forward_message_type(vrpn_int32 remote_port,
+                                      const char *service_name,
+                                      const char *message_type);
+
+protected:
+    vrpn_Forwarder_List *d_myForwarders;
+
+private:
+    static int VRPN_CALLBACK handle_start(void *, vrpn_HANDLERPARAM);
+    static int VRPN_CALLBACK handle_forward(void *, vrpn_HANDLERPARAM);
+};
+
+// Client class
+
+// Construct a Forwarder_Controller on a connection to control a
+// Forwarder_Server on its far end.
+
+class VRPN_API vrpn_Forwarder_Controller : public vrpn_Forwarder_Brain {
+
+public:
+    vrpn_Forwarder_Controller(vrpn_Connection *);
+    ~vrpn_Forwarder_Controller(void);
+
+    virtual void start_remote_forwarding(vrpn_int32 remote_port);
+
+    virtual void forward_message_type(vrpn_int32 remote_port,
+                                      const char *service_name,
+                                      const char *message_type);
+};
+
+#endif // VRPN_FORWARDER_CONTROLLER_H
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_FunctionGenerator.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_FunctionGenerator.h
new file mode 100644
index 0000000000000000000000000000000000000000..21919ea38a99aa30b7eaaed2ac9c19daa395cb11
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_FunctionGenerator.h
@@ -0,0 +1,429 @@
+#ifndef VRPN_FUNCTIONGENERATOR_H
+#define VRPN_FUNCTIONGENERATOR_H
+
+#include <stddef.h>                     // for NULL
+
+#include "vrpn_Analog.h"                // for vrpn_CHANNEL_MAX
+#include "vrpn_BaseClass.h"             // for vrpn_Callback_List, etc
+#include "vrpn_Configure.h"             // for VRPN_CALLBACK, VRPN_API
+#include "vrpn_Connection.h"
+#include "vrpn_Shared.h"                // for timeval
+#include "vrpn_Types.h"                 // for vrpn_int32, vrpn_uint32, etc
+
+
+const vrpn_uint32 vrpn_FUNCTION_CHANNELS_MAX = vrpn_CHANNEL_MAX;
+
+extern const char* vrpn_FUNCTION_MESSAGE_TYPE_CHANNEL;
+extern const char* vrpn_FUNCTION_MESSAGE_TYPE_CHANNEL_REQUEST;
+extern const char* vrpn_FUNCTION_MESSAGE_TYPE_ALL_CHANNEL_REQUEST;
+extern const char* vrpn_FUNCTION_MESSAGE_TYPE_SAMPLE_RATE;
+extern const char* vrpn_FUNCTION_MESSAGE_TYPE_START;
+extern const char* vrpn_FUNCTION_MESSAGE_TYPE_STOP;
+extern const char* vrpn_FUNCTION_MESSAGE_TYPE_CHANNEL_REPLY;
+extern const char* vrpn_FUNCTION_MESSAGE_TYPE_START_REPLY;
+extern const char* vrpn_FUNCTION_MESSAGE_TYPE_STOP_REPLY;
+extern const char* vrpn_FUNCTION_MESSAGE_TYPE_SAMPLE_RATE_REPLY;
+extern const char* vrpn_FUNCTION_MESSAGE_TYPE_INTERPRETER_REQUEST;
+extern const char* vrpn_FUNCTION_MESSAGE_TYPE_INTERPRETER_REPLY;
+extern const char* vrpn_FUNCTION_MESSAGE_TYPE_ERROR;
+
+class VRPN_API vrpn_FunctionGenerator_channel;
+
+// a base class for all functions that vrpn_FunctionGenerator
+// can generate
+class VRPN_API vrpn_FunctionGenerator_function
+{
+public:
+	virtual ~vrpn_FunctionGenerator_function() = 0;
+
+	// concrete classes should implement this to generate the appropriate
+	// values for the function the class represents.  nValue samples should be
+	// generated beginning at time startTime, and these samples should be placed
+	// in the provided buffer.  several data members of 'channel' can modify the
+	// times for which values are generated.
+	// returns the time of the last sample generated.
+	virtual vrpn_float32 generateValues( vrpn_float32* buf, vrpn_uint32 nValues,
+										 vrpn_float32 startTime, vrpn_float32 sampleRate,
+										 vrpn_FunctionGenerator_channel* channel ) const = 0;
+
+	// concrete classes should implement this to encode their 
+	// function information into the specified buffer 'buf'.  The
+	// remaining length in the buffer is stored in 'len'.  At return,
+	// 'len' should be set to the number of characters remaining in the
+	// buffer and the number of characters written should be returned,
+	// save in case of failure, when negative should be returned.
+	virtual vrpn_int32 encode_to( char** buf, vrpn_int32& len ) const = 0;
+
+	// concrete classes should implement this to decode their
+	// function information from the specified buffer.  The remaining
+	// length in the buffer is stored in 'len'.  At return, 'len' should
+	// be set to the number of characters remaining in the the buffer 
+	// and the number of characters read should be returned, save in case
+	// of failure, when negative should be returned
+	virtual vrpn_int32 decode_from( const char** buf, vrpn_int32& len ) = 0;
+
+	virtual vrpn_FunctionGenerator_function* clone( ) const = 0;
+
+	// used when encoding/decoding to specify function type
+	enum FunctionCode
+	{
+		FUNCTION_NULL = 0,
+		FUNCTION_SCRIPT = 1
+	};
+
+	// concrete classes should implement this to return the
+	// appropriate FunctionCode, from above
+	virtual FunctionCode getFunctionCode( ) const = 0;
+
+
+};
+
+
+// the NULL function:  generate all zeros
+class VRPN_API vrpn_FunctionGenerator_function_NULL
+: public virtual vrpn_FunctionGenerator_function
+{
+public:
+	vrpn_FunctionGenerator_function_NULL( ) { }
+	virtual ~vrpn_FunctionGenerator_function_NULL( ) { }
+
+	vrpn_float32 generateValues( vrpn_float32* buf, vrpn_uint32 nValues,
+								vrpn_float32 startTime, vrpn_float32 sampleRate, 
+								vrpn_FunctionGenerator_channel* channel ) const;
+
+	vrpn_int32 encode_to( char** buf, vrpn_int32& len ) const;
+	vrpn_int32 decode_from( const char** buf, vrpn_int32& len );
+	vrpn_FunctionGenerator_function* clone( ) const;
+protected:
+	FunctionCode getFunctionCode( ) const {  return FUNCTION_NULL;  }
+
+};
+
+
+class VRPN_API vrpn_FunctionGenerator_function_script
+: public virtual vrpn_FunctionGenerator_function
+{
+public:
+	vrpn_FunctionGenerator_function_script( );
+	vrpn_FunctionGenerator_function_script( const char* script );
+	vrpn_FunctionGenerator_function_script( const vrpn_FunctionGenerator_function_script& );
+	virtual ~vrpn_FunctionGenerator_function_script();
+
+	virtual vrpn_float32 generateValues( vrpn_float32* buf, vrpn_uint32 nValues,
+								vrpn_float32 startTime, vrpn_float32 sampleRate, 
+								vrpn_FunctionGenerator_channel* channel ) const;
+
+	vrpn_int32 encode_to( char** buf, vrpn_int32& len ) const;
+	vrpn_int32 decode_from( const char** buf, vrpn_int32& len );
+	vrpn_FunctionGenerator_function* clone( ) const;
+
+	// returns a copy of the script.  caller is responsible for 
+	// calling 'delete []' to free the returned string.
+	char* getScript( ) const;
+
+	const char* getConstScript( ) const
+	{ return script; }
+
+	vrpn_bool setScript( char* script );
+
+protected:
+	FunctionCode getFunctionCode( ) const {  return FUNCTION_SCRIPT;  }
+	char* script;
+
+};
+
+
+class VRPN_API vrpn_FunctionGenerator_channel
+{
+	// note:  the channel will delete its function when the function is
+	// no longer needed (e.g., when the channel is destroyed or the function changed)
+public:
+	vrpn_FunctionGenerator_channel( );
+	vrpn_FunctionGenerator_channel( vrpn_FunctionGenerator_function* function );
+	virtual ~vrpn_FunctionGenerator_channel( );
+
+	const vrpn_FunctionGenerator_function* getFunction( ) const { return function; }
+	void setFunction( vrpn_FunctionGenerator_function* function );
+
+	// these return zero on success and negative on some failure.
+	vrpn_int32 encode_to( char** buf, vrpn_int32& len ) const;
+	vrpn_int32 decode_from( const char** buf, vrpn_int32& len );
+
+protected:
+	vrpn_FunctionGenerator_function* function;
+	
+};
+
+
+class VRPN_API vrpn_FunctionGenerator : public vrpn_BaseClass
+{
+public:
+	vrpn_FunctionGenerator( const char* name, vrpn_Connection* c = NULL );
+	virtual ~vrpn_FunctionGenerator( );
+
+	// returns the requested channel, or null if channelNum is 
+	// greater than the maximum number of channels.
+	const vrpn_FunctionGenerator_channel* getChannel( vrpn_uint32 channelNum );
+
+	vrpn_uint32 getNumChannels( ) const { return numChannels; }
+
+	vrpn_float32 getSampleRate( )
+	{  return sampleRate;  }
+
+	enum FGError 
+	{
+		NO_FG_ERROR = 0,
+		INTERPRETER_ERROR = 1, // the interpreter (for script) had some problem
+		TAKING_TOO_LONG = 2, // samples were not generated quickly enough
+		INVALID_RESULT_QUANTITY = 3, // an incorrect number of values was generated
+		INVALID_RESULT_RANGE = 4 // generated values were out of range
+	};
+
+protected:
+	vrpn_float32 sampleRate;  // samples per second
+	vrpn_uint32 numChannels;
+	vrpn_FunctionGenerator_channel* channels[vrpn_FUNCTION_CHANNELS_MAX];
+
+	vrpn_int32 channelMessageID;             // id for channel message (remote -> server)
+	vrpn_int32 requestChannelMessageID;	     // id for messages requesting channel info be sent (remote -> server)
+	vrpn_int32 requestAllChannelsMessageID;  // id for messages requesting channel info of all channels be sent (remote -> server)
+	vrpn_int32 sampleRateMessageID;		     // id for message to request a sampling rate (remote -> server)
+	vrpn_int32 startFunctionMessageID;       // id for message to start generating the function (remote -> server)
+	vrpn_int32 stopFunctionMessageID;        // id for message to stop generating the function (remote -> server)
+	vrpn_int32 requestInterpreterMessageID;  // id for message to request interpreter description (remote -> server)
+
+	vrpn_int32 channelReplyMessageID;        // id for reply for channel message (server -> remote)
+	vrpn_int32 startFunctionReplyMessageID;  // id for reply to start-function message (server -> remote)
+	vrpn_int32 stopFunctionReplyMessageID;   // id for reply to stop-function message (server -> remote)
+	vrpn_int32 sampleRateReplyMessageID;     // id for reply to request-sample-rate message (server -> remote)
+	vrpn_int32 interpreterReplyMessageID;    // id for reply to request-interpreter message (server -> remote)
+	vrpn_int32 errorMessageID;				 // id for error reports
+
+	vrpn_int32	gotConnectionMessageID;  // for new-connection message
+
+	virtual int register_types( );
+
+	char msgbuf[vrpn_CONNECTION_TCP_BUFLEN];
+	struct timeval timestamp;
+}; // end class vrpn_FunctionGenerator
+
+
+class VRPN_API vrpn_FunctionGenerator_Server : public vrpn_FunctionGenerator
+{
+public:
+	vrpn_FunctionGenerator_Server( const char* name, vrpn_uint32 numChannels = vrpn_FUNCTION_CHANNELS_MAX, vrpn_Connection* c = NULL );
+	virtual ~vrpn_FunctionGenerator_Server( );
+
+	virtual void mainloop( );
+
+	// sub-classes should implement these functions.  they will be called when messages 
+	// are received for the particular request.  at the end of these functions, servers 
+	// should call the appropriate send*Reply function, even (especially!) if the requested 
+	// change was rejected.
+	virtual void setChannel( vrpn_uint32 channelNum, vrpn_FunctionGenerator_channel* channel ) = 0;
+	virtual void start( ) = 0;
+	virtual void stop( ) = 0;
+	virtual void setSampleRate( vrpn_float32 rate ) = 0;
+
+	vrpn_uint32 setNumChannels( vrpn_uint32 numChannels );
+
+	// sub-classes should implement this function to provide a description of the type
+	// of interpreter used to interpret vrpn_FunctionGenerator_function_script
+	virtual const char* getInterpreterDescription( ) = 0;
+
+	// sub-classes should not override these methods; these take care of
+	// receiving requests
+	static int VRPN_CALLBACK handle_channel_message( void* userdata, vrpn_HANDLERPARAM p );
+	static int VRPN_CALLBACK handle_channelRequest_message( void* userdata, vrpn_HANDLERPARAM p );
+	static int VRPN_CALLBACK handle_allChannelRequest_message( void* userdata, vrpn_HANDLERPARAM p );
+	static int VRPN_CALLBACK handle_start_message( void* userdata, vrpn_HANDLERPARAM p );
+	static int VRPN_CALLBACK handle_stop_message( void* userdata, vrpn_HANDLERPARAM p );
+	static int VRPN_CALLBACK handle_sample_rate_message( void* userdata, vrpn_HANDLERPARAM p );
+	static int VRPN_CALLBACK handle_interpreter_request_message( void* userdata, vrpn_HANDLERPARAM p );
+
+protected:
+	
+	// sub-classes should call these functions to inform the remote side of
+	// changes (or of non-changes, when a requested change cannot be accepted).
+	// returns 0 on success and negative on failure.
+	int sendChannelReply( vrpn_uint32 channelNum );
+	int sendSampleRateReply( );
+	int sendStartReply( vrpn_bool started );
+	int sendStopReply( vrpn_bool stopped );
+	int sendInterpreterDescription( );
+
+	// sub-classes should use this function to report an error in function generation
+	int sendError( FGError error, vrpn_int32 channel );
+
+	vrpn_int32 decode_channel( const char* buf, const vrpn_int32 len, vrpn_uint32& channelNum,
+								vrpn_FunctionGenerator_channel& channel );
+	vrpn_int32 decode_channel_request( const char* buf, const vrpn_int32 len, vrpn_uint32& channelNum );
+	vrpn_int32 decode_sampleRate_request( const char* buf, const vrpn_int32 len, vrpn_float32& sampleRate );
+
+	vrpn_int32 encode_channel_reply( char** buf, vrpn_int32& len, const vrpn_uint32 channelNum );
+	vrpn_int32 encode_start_reply( char** buf, vrpn_int32& len, const vrpn_bool isStarted );
+	vrpn_int32 encode_stop_reply( char** buf, vrpn_int32& len, const vrpn_bool isStopped );
+	vrpn_int32 encode_sampleRate_reply( char** buf, vrpn_int32& len, const vrpn_float32 sampleRate );
+	vrpn_int32 encode_interpreterDescription_reply( char** buf, vrpn_int32& len, const char* desc );
+	vrpn_int32 encode_error_report( char** buf, vrpn_int32& len, const FGError err, const vrpn_int32 channel );
+
+}; // end class vrpn_FunctionGenerator_Server
+
+
+//----------------------------------------------------------
+// ************** Users deal with the following *************
+
+// User routine to handle function-generator channel replies.  This
+// is called when the function-generator server replies with new
+// setting for some channel.
+typedef	struct _vrpn_FUNCTION_CHANNEL_REPLY_CB
+{
+	struct timeval	msg_time;	// Time of the report
+	vrpn_uint32	channelNum;		// Which channel is being reported
+	vrpn_FunctionGenerator_channel*	channel;
+} vrpn_FUNCTION_CHANNEL_REPLY_CB;
+typedef void (VRPN_CALLBACK *vrpn_FUNCTION_CHANGE_REPLY_HANDLER)( void *userdata,
+					  const vrpn_FUNCTION_CHANNEL_REPLY_CB info );
+
+// User routine to handle function-generator start replies.  This
+// is called when the function-generator server reports that it
+// has started generating functions.
+typedef	struct _vrpn_FUNCTION_START_REPLY_CB
+{
+	struct timeval	msg_time;	// Time of the report
+	vrpn_bool isStarted;		// did the function generation start?
+} vrpn_FUNCTION_START_REPLY_CB;
+typedef void (VRPN_CALLBACK *vrpn_FUNCTION_START_REPLY_HANDLER)( void *userdata,
+					     const vrpn_FUNCTION_START_REPLY_CB info );
+
+// User routine to handle function-generator stop replies.  This
+// is called when the function-generator server reports that it
+// has stopped generating functions.
+typedef	struct _vrpn_FUNCTION_STOP_REPLY_CB
+{
+	struct timeval	msg_time;	// Time of the report
+	vrpn_bool isStopped;		// did the function generation stop?
+} vrpn_FUNCTION_STOP_REPLY_CB;
+typedef void (VRPN_CALLBACK *vrpn_FUNCTION_STOP_REPLY_HANDLER)( void *userdata,
+					     const vrpn_FUNCTION_STOP_REPLY_CB info );
+
+// User routine to handle function-generator sample-rate replies.  
+// This is called when the function-generator server reports that 
+// the function-generation sample rate has changed.
+typedef	struct _vrpn_FUNCTION_SAMPLE_RATE_REPLY_CB
+{
+	struct timeval	msg_time;	// Time of the report
+	vrpn_float32 sampleRate;		
+} vrpn_FUNCTION_SAMPLE_RATE_REPLY_CB;
+typedef void (VRPN_CALLBACK *vrpn_FUNCTION_SAMPLE_RATE_REPLY_HANDLER)( void *userdata,
+					     const vrpn_FUNCTION_SAMPLE_RATE_REPLY_CB info );
+
+
+// User routine to handle function-generator interpreter-description replies.  
+// This is called when the function-generator server reports the description
+// of its interpreter.
+typedef	struct _vrpn_FUNCTION_INTERPRETER_REPLY_CB
+{
+	struct timeval	msg_time;	// Time of the report
+	char* description;		
+} vrpn_FUNCTION_INTERPRETER_REPLY_CB;
+typedef void (VRPN_CALLBACK *vrpn_FUNCTION_INTERPRETER_REPLY_HANDLER)( void *userdata,
+					     const vrpn_FUNCTION_INTERPRETER_REPLY_CB info );
+
+
+// User routine to handle function-generator error notifications.  
+// This is called when the function-generator server reports some
+// error in the generation of a function.
+typedef	struct _vrpn_FUNCTION_ERROR_CB
+{
+	struct timeval	msg_time;	// Time of the report
+	vrpn_FunctionGenerator::FGError err;
+	vrpn_int32 channel;
+} vrpn_FUNCTION_ERROR_CB;
+typedef void (VRPN_CALLBACK *vrpn_FUNCTION_ERROR_HANDLER)( void *userdata,
+					     const vrpn_FUNCTION_ERROR_CB info );
+
+
+class VRPN_API vrpn_FunctionGenerator_Remote : public vrpn_FunctionGenerator
+{
+public:
+	vrpn_FunctionGenerator_Remote( const char* name, vrpn_Connection* c = NULL );
+	virtual ~vrpn_FunctionGenerator_Remote( ) { }
+
+	int setChannel( const vrpn_uint32 channelNum, const vrpn_FunctionGenerator_channel* channel );
+	int requestChannel( const vrpn_uint32 channelNum );
+	int requestAllChannels( );
+	int requestStart( );
+	int requestStop( );
+	int requestSampleRate( const vrpn_float32 rate );
+	int requestInterpreterDescription( );
+
+	virtual void mainloop( );
+	
+	// (un)Register a callback handler to handle a channel reply
+	virtual int register_channel_reply_handler( void *userdata,
+		vrpn_FUNCTION_CHANGE_REPLY_HANDLER handler );
+	virtual int unregister_channel_reply_handler( void *userdata,
+		vrpn_FUNCTION_CHANGE_REPLY_HANDLER handler );
+	
+	// (un)Register a callback handler to handle a start reply
+	virtual int register_start_reply_handler( void *userdata,
+		vrpn_FUNCTION_START_REPLY_HANDLER handler );
+	virtual int unregister_start_reply_handler( void *userdata,
+		vrpn_FUNCTION_START_REPLY_HANDLER handler );
+	
+	// (un)Register a callback handler to handle a stop reply
+	virtual int register_stop_reply_handler( void *userdata,
+		vrpn_FUNCTION_STOP_REPLY_HANDLER handler );
+	virtual int unregister_stop_reply_handler( void *userdata,
+		vrpn_FUNCTION_STOP_REPLY_HANDLER handler );
+	
+	// (un)Register a callback handler to handle a sample-rate reply
+	virtual int register_sample_rate_reply_handler( void *userdata,
+		vrpn_FUNCTION_SAMPLE_RATE_REPLY_HANDLER handler );
+	virtual int unregister_sample_rate_reply_handler( void *userdata,
+		vrpn_FUNCTION_SAMPLE_RATE_REPLY_HANDLER handler );
+	
+	// (un)Register a callback handler to handle an interpreter message
+	virtual int register_interpreter_reply_handler( void *userdata,
+		vrpn_FUNCTION_INTERPRETER_REPLY_HANDLER handler );
+	virtual int unregister_interpreter_reply_handler( void *userdata,
+		vrpn_FUNCTION_INTERPRETER_REPLY_HANDLER handler );
+
+	virtual int register_error_handler( void* userdata, 
+		vrpn_FUNCTION_ERROR_HANDLER handler );
+	virtual int unregister_error_handler( void* userdata,
+		vrpn_FUNCTION_ERROR_HANDLER handler );
+	
+	static int VRPN_CALLBACK handle_channelReply_message( void* userdata, vrpn_HANDLERPARAM p );
+	static int VRPN_CALLBACK handle_startReply_message( void* userdata, vrpn_HANDLERPARAM p );
+	static int VRPN_CALLBACK handle_stopReply_message( void* userdata, vrpn_HANDLERPARAM p );
+	static int VRPN_CALLBACK handle_sampleRateReply_message( void* userdata, vrpn_HANDLERPARAM p );
+	static int VRPN_CALLBACK handle_interpreterReply_message( void* userdata, vrpn_HANDLERPARAM p );
+	static int VRPN_CALLBACK handle_error_message( void* userdata, vrpn_HANDLERPARAM p );
+
+protected:
+	vrpn_Callback_List<vrpn_FUNCTION_CHANNEL_REPLY_CB> channel_reply_list;
+	vrpn_Callback_List<vrpn_FUNCTION_START_REPLY_CB> start_reply_list;
+	vrpn_Callback_List<vrpn_FUNCTION_STOP_REPLY_CB> stop_reply_list;
+	vrpn_Callback_List<vrpn_FUNCTION_SAMPLE_RATE_REPLY_CB> sample_rate_reply_list;
+	vrpn_Callback_List<vrpn_FUNCTION_INTERPRETER_REPLY_CB> interpreter_reply_list;
+	vrpn_Callback_List<vrpn_FUNCTION_ERROR_CB> error_list;
+
+
+	vrpn_int32 decode_channel_reply( const char* buf, const vrpn_int32 len, vrpn_uint32& channelNum );
+	vrpn_int32 decode_start_reply( const char* buf, const vrpn_int32 len, vrpn_bool& isStarted );
+	vrpn_int32 decode_stop_reply( const char* buf, const vrpn_int32 len, vrpn_bool& isStopped );
+	vrpn_int32 decode_sampleRate_reply( const char* buf, const vrpn_int32 len );
+	vrpn_int32 decode_interpreterDescription_reply( const char* buf, const vrpn_int32 len, char** desc );
+	vrpn_int32 decode_error_reply( const char* buf, const vrpn_int32 len, FGError& error, vrpn_int32& channel );
+
+	vrpn_int32 encode_channel( char** buf, vrpn_int32& len, const vrpn_uint32 channelNum, 
+							   const vrpn_FunctionGenerator_channel* channel );
+	vrpn_int32 encode_channel_request( char** buf, vrpn_int32& len, const vrpn_uint32 channelNum );
+	vrpn_int32 encode_sampleRate_request( char** buf, vrpn_int32& len, const vrpn_float32 sampleRate );
+
+}; // end class vrpn_FunctionGenerator_Remote
+
+
+#endif // VRPN_FUNCTIONGENERATOR_H
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_Imager.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_Imager.h
new file mode 100644
index 0000000000000000000000000000000000000000..8e85c6a4d798136701a8c98415c2be47beefc38d
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_Imager.h
@@ -0,0 +1,804 @@
+// ImagerControl (should be built into Imager, because it will always
+// be the same device).  The app doesn't have to use all of the
+// functions if they don't want to.
+// XXX Client can sent request for only subregion of image to be sent
+//     Server may ignore this message.
+// XXX Server sets region back to total region when last connection closed.
+// XXX Client can request a frame rate from the server.  This is passed on
+//     to the server code as a handled message.  Server should reset to the
+//     default when the last connection is closed.
+// XXX Binning
+// XXX integration times
+// XXX Which data sets to send (nano)
+
+// ImagerPose (may be a separate physical device from the imager)
+// XXX Lets client request new pose for imager
+
+// XXX When transcoding to a lower-bitcount resolution, should we
+// adjust the scale and offset to make best use of the bits?  Perhaps
+// a local and a global scale and offset?
+
+#ifndef VRPN_IMAGER_H
+#define VRPN_IMAGER_H
+#include <stdio.h>  // for fprintf, stderr
+#include <string.h> // for NULL, memcpy
+
+#include "vrpn_BaseClass.h" // for vrpn_Callback_List, etc
+#include "vrpn_Configure.h" // for VRPN_CALLBACK, VRPN_API
+#include "vrpn_Connection.h"
+#include "vrpn_Shared.h" // for vrpn_buffer, vrpn_unbuffer, etc
+#include "vrpn_Types.h"  // for vrpn_uint16, vrpn_int32, etc
+
+const unsigned vrpn_IMAGER_MAX_CHANNELS = 100;
+
+/// Set of constants to tell how many points you can put into a region
+/// depending on the type you are putting in there.  Useful for senders
+/// to know how large of a chunk they can send at once.
+const unsigned vrpn_IMAGER_MAX_REGIONu8 =
+    (vrpn_CONNECTION_TCP_BUFLEN
+    - 8 * sizeof(vrpn_int16)        // vrpn_Imager header size
+    - 6 * sizeof(vrpn_int32)) /     // VRPN message header
+    sizeof(vrpn_uint8);
+const unsigned vrpn_IMAGER_MAX_REGIONu16 =
+    (vrpn_CONNECTION_TCP_BUFLEN
+    - 8 * sizeof(vrpn_int16)        // vrpn_Imager header size
+    - 6 * sizeof(vrpn_int32)) /     // VRPN message header
+    sizeof(vrpn_uint16);
+const unsigned vrpn_IMAGER_MAX_REGIONu12in16 = vrpn_IMAGER_MAX_REGIONu16;
+const unsigned vrpn_IMAGER_MAX_REGIONf32 =
+    (vrpn_CONNECTION_TCP_BUFLEN
+    - 8 * sizeof(vrpn_int16)        // vrpn_Imager header size
+    - 6 * sizeof(vrpn_int32)) /     // VRPN message header
+    sizeof(vrpn_float32);
+
+/// Holds the description needed to convert from raw data to values for a
+/// channel
+class VRPN_API vrpn_Imager_Channel {
+    friend class vrpn_Imager_Remote; // provides access to compression status
+    friend class vrpn_Imager_Server; // provides access to compression status
+    friend class vrpn_Imager_Stream_Buffer; // provides access to
+                                            // buffer/unbuffer
+public:
+    vrpn_Imager_Channel(void)
+    {
+        name[0] = '\0';
+        units[0] = '\0';
+        minVal = maxVal = 0.0;
+        scale = 1;
+        offset = 0;
+        d_compression = NONE;
+    };
+
+    cName name;  //< Name of the data set stored in this channel
+    cName units; //< Units for the data set stored in this channel
+    vrpn_float32 minVal,
+        maxVal; //< Range of possible values for pixels in this channel
+    vrpn_float32 offset,
+        scale; //< Values in units are (raw_values * scale) + offset
+
+protected:
+    // The following methods are here for the derived classes and are not
+    // relevant
+    // to user code.
+    inline bool buffer(char **insertPt, vrpn_int32 *buflen) const
+    {
+        if (vrpn_buffer(insertPt, buflen, minVal) ||
+            vrpn_buffer(insertPt, buflen, maxVal) ||
+            vrpn_buffer(insertPt, buflen, offset) ||
+            vrpn_buffer(insertPt, buflen, scale) ||
+            vrpn_buffer(insertPt, buflen, (vrpn_uint32)d_compression) ||
+            vrpn_buffer(insertPt, buflen, name, sizeof(name)) ||
+            vrpn_buffer(insertPt, buflen, units, sizeof(units))) {
+            return false;
+        }
+        else {
+            return true;
+        }
+    }
+
+    inline bool unbuffer(const char **buffer)
+    {
+        vrpn_uint32 compression;
+        if (vrpn_unbuffer(buffer, &minVal) || vrpn_unbuffer(buffer, &maxVal) ||
+            vrpn_unbuffer(buffer, &offset) || vrpn_unbuffer(buffer, &scale) ||
+            vrpn_unbuffer(buffer, &compression) ||
+            vrpn_unbuffer(buffer, name, sizeof(name)) ||
+            vrpn_unbuffer(buffer, units, sizeof(units))) {
+            return false;
+        }
+        else {
+            d_compression = (ChannelCompression)compression;
+            return true;
+        }
+    }
+
+    typedef enum { NONE = 0 } ChannelCompression;
+    ChannelCompression d_compression;
+};
+
+/// Base class for Imager class
+class VRPN_API vrpn_Imager : public vrpn_BaseClass {
+public:
+    vrpn_Imager(const char *name, vrpn_Connection *c = NULL);
+
+    // Data member accessors.
+    vrpn_int32 nRows(void) const { return d_nRows; };
+    vrpn_int32 nCols(void) const { return d_nCols; };
+    vrpn_int32 nDepth(void) const { return d_nDepth; };
+    vrpn_int32 nChannels(void) const { return d_nChannels; };
+
+protected:
+    vrpn_int32 d_nRows;     //< Number of rows in the image
+    vrpn_int32 d_nCols;     //< Number of columns in the image
+    vrpn_int32 d_nDepth;    //< Number of depth stacks in the image
+    vrpn_int32 d_nChannels; //< Number of image data channels
+    vrpn_Imager_Channel d_channels[vrpn_IMAGER_MAX_CHANNELS];
+
+    virtual int register_types(void);
+    vrpn_int32 d_description_m_id; //< ID of the message type describing the
+    // range and channels
+    vrpn_int32 d_begin_frame_m_id; //< ID of the message type describing the
+    // start of a region
+    vrpn_int32 d_end_frame_m_id; //< ID of the message type describing the start
+    // of a region
+    vrpn_int32 d_discarded_frames_m_id; //< ID of the message type describing
+    // the discarding of one or more regions
+    vrpn_int32 d_throttle_frames_m_id; //< ID of the message type requesting
+    // throttling of sending.
+    vrpn_int32 d_regionu8_m_id; //< ID of the message type describing a region
+    // with 8-bit unsigned entries
+    vrpn_int32 d_regionu12in16_m_id; //< ID of the message type describing a
+    // region with 12-bit unsigned entries
+    // packed in 16 bits
+    vrpn_int32 d_regionu16_m_id; //< ID of the message type describing a region
+    // with 16-bit unsigned entries
+    vrpn_int32 d_regionf32_m_id; //< ID of the message type describing a region
+                                 // with 32-bit float entries
+};
+
+class VRPN_API vrpn_Imager_Server : public vrpn_Imager {
+public:
+    vrpn_Imager_Server(const char *name, vrpn_Connection *c, vrpn_int32 nCols,
+                       vrpn_int32 nRows, vrpn_int32 nDepth = 1);
+
+    /// Add a channel to the server, returns index of the channel or -1 on
+    /// failure.
+    int add_channel(const char *name, const char *units = "unsigned8bit",
+                    vrpn_float32 minVal = 0, vrpn_float32 maxVal = 255,
+                    vrpn_float32 scale = 1, vrpn_float32 offset = 0);
+
+    /// Servers must send begin/end frame pairs around contiguous sections of
+    /// the image
+    // to provide hints to the client about when to refresh displays and such.
+    // If they can determine when frames are missed, they should also send a
+    // description of missed frames, telling how many are skipped (default of
+    // zero means "some but don't know how many").
+    bool send_begin_frame(const vrpn_uint16 cMin, const vrpn_uint16 cMax,
+                          const vrpn_uint16 rMin, const vrpn_uint16 rMax,
+                          const vrpn_uint16 dMin = 0,
+                          const vrpn_uint16 dMax = 0,
+                          const struct timeval *time = NULL);
+    bool send_end_frame(const vrpn_uint16 cMin, const vrpn_uint16 cMax,
+                        const vrpn_uint16 rMin, const vrpn_uint16 rMax,
+                        const vrpn_uint16 dMin = 0, const vrpn_uint16 dMax = 0,
+                        const struct timeval *time = NULL);
+    bool send_discarded_frames(const vrpn_uint16 count = 0,
+                               const struct timeval *time = NULL);
+
+    /// Pack and send the region as efficiently as possible; strides are in
+    /// steps of the element being sent.
+    // These functions each take a pointer to the base of the image to be sent:
+    // its [0,0] element.
+    // If rows are being inverted, then we need to know how many rows there are
+    // in the total image.
+    bool send_region_using_base_pointer(
+        vrpn_int16 chanIndex, vrpn_uint16 cMin, vrpn_uint16 cMax,
+        vrpn_uint16 rMin, vrpn_uint16 rMax, const vrpn_uint8 *data,
+        vrpn_uint32 colStride, vrpn_uint32 rowStride, vrpn_uint16 nRows = 0,
+        bool invert_rows = false, vrpn_uint32 depthStride = 0,
+        vrpn_uint16 dMin = 0, vrpn_uint16 dMax = 0,
+        const struct timeval *time = NULL);
+    bool send_region_using_base_pointer(
+        vrpn_int16 chanIndex, vrpn_uint16 cMin, vrpn_uint16 cMax,
+        vrpn_uint16 rMin, vrpn_uint16 rMax, const vrpn_uint16 *data,
+        vrpn_uint32 colStride, vrpn_uint32 rowStride, vrpn_uint16 nRows = 0,
+        bool invert_rows = false, vrpn_uint32 depthStride = 0,
+        vrpn_uint16 dMin = 0, vrpn_uint16 dMax = 0,
+        const struct timeval *time = NULL);
+    bool send_region_using_base_pointer(
+        vrpn_int16 chanIndex, vrpn_uint16 cMin, vrpn_uint16 cMax,
+        vrpn_uint16 rMin, vrpn_uint16 rMax, const vrpn_float32 *data,
+        vrpn_uint32 colStride, vrpn_uint32 rowStride, vrpn_uint16 nRows = 0,
+        bool invert_rows = false, vrpn_uint32 depthStride = 0,
+        vrpn_uint16 dMin = 0, vrpn_uint16 dMax = 0,
+        const struct timeval *time = NULL);
+
+    /// Pack and send the region as efficiently as possible; strides are in
+    /// steps of the element being sent.
+    // These functions each take a pointer to the first of the data values to be
+    // sent.  This is a
+    // pointer to the [cMin, rMin] element of the image to be sent.  Note that
+    // if the Y value is inverted,
+    // this will NOT be a pointer to the beginning of the data block, but rather
+    // the the beginning of
+    // the last line in the data block.  Note that rowStride will be less than
+    // the number of rows in the
+    // whole image if the data is tightly packed into a block and the region
+    // does not cover all columns.
+    bool send_region_using_first_pointer(
+        vrpn_int16 chanIndex, vrpn_uint16 cMin, vrpn_uint16 cMax,
+        vrpn_uint16 rMin, vrpn_uint16 rMax, const vrpn_uint8 *data,
+        vrpn_uint32 colStride, vrpn_uint32 rowStride, vrpn_uint16 nRows = 0,
+        bool invert_rows = false, vrpn_uint32 depthStride = 0,
+        vrpn_uint16 dMin = 0, vrpn_uint16 dMax = 0,
+        const struct timeval *time = NULL);
+    bool send_region_using_first_pointer(
+        vrpn_int16 chanIndex, vrpn_uint16 cMin, vrpn_uint16 cMax,
+        vrpn_uint16 rMin, vrpn_uint16 rMax, const vrpn_uint16 *data,
+        vrpn_uint32 colStride, vrpn_uint32 rowStride, vrpn_uint16 nRows = 0,
+        bool invert_rows = false, vrpn_uint32 depthStride = 0,
+        vrpn_uint16 dMin = 0, vrpn_uint16 dMax = 0,
+        const struct timeval *time = NULL);
+    bool send_region_using_first_pointer(
+        vrpn_int16 chanIndex, vrpn_uint16 cMin, vrpn_uint16 cMax,
+        vrpn_uint16 rMin, vrpn_uint16 rMax, const vrpn_float32 *data,
+        vrpn_uint32 colStride, vrpn_uint32 rowStride, vrpn_uint16 nRows = 0,
+        bool invert_rows = false, vrpn_uint32 depthStride = 0,
+        vrpn_uint16 dMin = 0, vrpn_uint16 dMax = 0,
+        const struct timeval *time = NULL);
+
+    /// Set the resolution to a different value than it had been before.
+    /// Returns true on success.
+    bool set_resolution(vrpn_int32 nCols, vrpn_int32 nRows,
+                        vrpn_int32 nDepth = 1);
+
+    /// Sends a description of the imager so the remote can process the region
+    /// messages
+    bool send_description(void);
+
+    /// Handle baseclass ping/pong messages
+    virtual void mainloop(void);
+
+protected:
+    bool d_description_sent;     //< Has the description message been sent?
+    vrpn_int32 d_frames_to_send; //< Set to -1 if continuous, zero or positive
+    // tells how many to send and then start
+    // dropping
+    vrpn_uint16 d_dropped_due_to_throttle; //< Number of frames dropped due to
+    // the throttle request
+
+    // This method makes sure we send a description whenever we get a ping from
+    // a client object.
+    static int VRPN_CALLBACK
+    handle_ping_message(void *userdata, vrpn_HANDLERPARAM p);
+
+    // This method handles requests to throttle the number of frames.
+    static int VRPN_CALLBACK
+    handle_throttle_message(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_last_drop_message(void *userdata, vrpn_HANDLERPARAM p);
+};
+
+class VRPN_API vrpn_ImagerPose : public vrpn_BaseClass {
+public:
+    vrpn_ImagerPose(const char *name, vrpn_Connection *c = NULL);
+
+    /// Returns the origin of the coordinate system,
+    // the location of the corner of the (0,0,0) pixel.  Note that
+    // the pixel coordinate is centered in that pixel, but that the
+    // pixel extends a half-pixel into the "negative" coordinates.
+    void get_origin(vrpn_float64 *origin) const
+    {
+        memcpy(origin, d_origin, sizeof(d_origin));
+    }
+
+    /// This is the total span of the image in columns;
+    // it is how far and in what direction to go from the origin
+    // of the image to one pixel past the pixel at the end of
+    // the column that (0,0,0) is in: this is the total image
+    // width.
+    void get_dCol(vrpn_float64 *dCol) const
+    {
+        memcpy(dCol, d_dCol, sizeof(d_dCol));
+    }
+
+    /// This is the total span of the image in rows;
+    // it is how far and in what direction to go from the origin
+    // of the image to one pixel past the pixel at the end of
+    // the row that (0,0,0) is in: this is the total image height.
+    void get_dRow(vrpn_float64 *dRow) const
+    {
+        memcpy(dRow, d_dRow, sizeof(d_dRow));
+    }
+
+    /// This is the total span of the image in depth;
+    // it is how far and in what direction to go from the origin
+    // of the image to one pixel past the pixel at the end of
+    // the depth pixel that (0,0,0) is in: this is the total
+    // image depth.
+    void get_dDepth(vrpn_float64 *dDepth) const
+    {
+        memcpy(dDepth, d_dDepth, sizeof(d_dDepth));
+    }
+
+    /// This will return the location of the center of the specified
+    // pixel within the image, assuming that the image covers the
+    // space described by this imagerpose.  Note that none of the pixel
+    // centers will be at the end of the space, except where the image
+    // has no dimension (Z for a 2D image).  Returns false if there is
+    // a problem (coordinates out of bounds).
+    bool compute_pixel_center(vrpn_float64 *center, const vrpn_Imager &image,
+                              vrpn_uint16 col, vrpn_uint16 row,
+                              vrpn_uint16 depth = 0);
+
+protected:
+    vrpn_float64 d_origin[3]; //< Origin, pixel (0,0,0) in meters
+    vrpn_float64
+        d_dCol[3]; //< End of first columne in coordinate system in meters
+    vrpn_float64 d_dRow[3]; //< End of first row in coordinate system in meters
+    vrpn_float64 d_dDepth[3]; //< End of depth in coordinate system in meters
+
+    virtual int register_types(void);
+    vrpn_int32 d_description_m_id; //< ID of the message type describing the
+                                   // range and channels
+};
+
+class VRPN_API vrpn_ImagerPose_Server : public vrpn_ImagerPose {
+public:
+    vrpn_ImagerPose_Server(const char *name, const vrpn_float64 origin[3],
+                           const vrpn_float64 dCol[3],
+                           const vrpn_float64 dRow[3],
+                           const vrpn_float64 *dDepth = NULL,
+                           vrpn_Connection *c = NULL);
+
+    /// Set the range or units.  Return true on success.
+    bool set_range(const vrpn_float64 origin[3], const vrpn_float64 dCol[3],
+                   const vrpn_float64 dRow[3],
+                   const vrpn_float64 *dDepth = NULL);
+
+    /// Sends a description of the imager so the remote can process the region
+    /// messages
+    bool send_description(void);
+
+    /// Handle baseclass ping/pong messages
+    virtual void mainloop(void);
+
+protected:
+    // This method makes sure we send a description whenever we get a ping from
+    // a client object.
+    static int VRPN_CALLBACK
+    handle_ping_message(void *userdata, vrpn_HANDLERPARAM p);
+};
+
+//------------------------------------------------------------------------------
+// Users deal with things below this line.
+
+//------------------------------------------------------------------------------
+// Imager_Remote is used for passing image values (pixels), converting them
+// to physical units, and saying when regions are started and finished.
+
+const vrpn_uint16 vrpn_IMAGER_VALTYPE_UNKNOWN = 0;
+const vrpn_uint16 vrpn_IMAGER_VALTYPE_UINT8 = 1;
+// XXX Bad idea -- do not do this! const vrpn_uint16
+// vrpn_IMAGER_VALTYPE_UINT8RGB	  = 2;	// Placeholder
+// XXX Bad idea -- do not do this! const vrpn_uint16
+// vrpn_IMAGER_VALTYPE_UINT8BGR	  = 3;	// Placeholder
+const vrpn_uint16 vrpn_IMAGER_VALTYPE_UINT16 = 4;
+const vrpn_uint16 vrpn_IMAGER_VALTYPE_UINT12IN16 = 5;
+const vrpn_uint16 vrpn_IMAGER_VALTYPE_FLOAT32 = 6;
+
+class VRPN_API vrpn_Imager_Region;
+
+typedef struct _vrpn_IMAGERREGIONCB {
+    struct timeval msg_time;          //< Timestamp of the region data's change
+    const vrpn_Imager_Region *region; //< New region of the image
+} vrpn_IMAGERREGIONCB;
+
+typedef void(VRPN_CALLBACK *vrpn_IMAGERREGIONHANDLER)(
+    void *userdata, const vrpn_IMAGERREGIONCB info);
+// There is no data in the description callback other than the time; the
+// data members for the class will have been filled in, so the client should
+// call nRows() and other functions to read the new values.
+typedef void(VRPN_CALLBACK *vrpn_IMAGERDESCRIPTIONHANDLER)(
+    void *userdata, const struct timeval msg_time);
+
+typedef struct _vrpn_IMAGERBEGINFRAMECB {
+    struct timeval msg_time; //< Timestamp of the begin-frame message
+    vrpn_uint16 rMin;        //< Minimum row in the frame
+    vrpn_uint16 rMax;        //< Maximum row in the frame
+    vrpn_uint16 cMin;        //< Minimum column in the frame
+    vrpn_uint16 cMax;        //< Maximum column in the frame
+    vrpn_uint16 dMin;        //< Minimum depth in the frame
+    vrpn_uint16 dMax;        //< Maximum depth in the frame
+} vrpn_IMAGERBEGINFRAMECB;
+
+typedef struct _vrpn_IMAGERENDFRAMECB {
+    struct timeval msg_time; //< Timestamp of the end-frame message
+    vrpn_uint16 rMin;        //< Minimum row in the frame
+    vrpn_uint16 rMax;        //< Maximum row in the frame
+    vrpn_uint16 cMin;        //< Minimum column in the frame
+    vrpn_uint16 cMax;        //< Maximum column in the frame
+    vrpn_uint16 dMin;        //< Minimum depth in the frame
+    vrpn_uint16 dMax;        //< Maximum depth in the frame
+} vrpn_IMAGERENDFRAMECB;
+
+typedef struct _vrpn_IMAGERDISCARDEDFRAMESCB {
+    struct timeval msg_time; //< Timestamp of the begin-frame message
+    vrpn_uint16 count; //< Number of discarded frames (0 means "1 or more")
+} vrpn_IMAGERDISCARDEDFRAMESCB;
+
+typedef void(VRPN_CALLBACK *vrpn_IMAGERBEGINFRAMEHANDLER)(
+    void *userdata, const vrpn_IMAGERBEGINFRAMECB info);
+typedef void(VRPN_CALLBACK *vrpn_IMAGERENDFRAMEHANDLER)(
+    void *userdata, const vrpn_IMAGERENDFRAMECB info);
+typedef void(VRPN_CALLBACK *vrpn_IMAGERDISCARDEDFRAMESHANDLER)(
+    void *userdata, const vrpn_IMAGERDISCARDEDFRAMESCB info);
+
+/// Helper function to convert data for a sub-region of one channel of
+// the image.  This is passed to the user callback handler and aids in
+// getting values out of the buffer.  The region is only valid during
+// the actual callback handler, so users should not store pointers to
+// it for later use.
+class VRPN_API vrpn_Imager_Region {
+    friend class VRPN_API vrpn_Imager_Remote;
+    friend void VRPN_CALLBACK
+    java_vrpn_handle_region_change(void *userdata,
+                                   const vrpn_IMAGERREGIONCB info);
+
+public:
+    vrpn_Imager_Region(void)
+    {
+        d_chanIndex = -1;
+        d_rMin = d_rMax = d_cMin = d_cMax = 0;
+        d_valBuf = NULL;
+        d_valType = vrpn_IMAGER_VALTYPE_UNKNOWN;
+        d_valid = false;
+    }
+
+    /// Returns the number of values in the region.
+    inline vrpn_uint32 getNumVals() const
+    {
+        if (!d_valid) {
+            return 0;
+        }
+        else {
+            return (d_rMax - d_rMin + 1) * (d_cMax - d_cMin + 1);
+        }
+    }
+
+    /// Reads pixel from the region with no scale and offset applied to the
+    /// value.  Not
+    /// the most efficient way to read the pixels out -- use the block read
+    /// routines.
+    inline bool read_unscaled_pixel(vrpn_uint16 c, vrpn_uint16 r,
+                                    vrpn_uint8 &val, vrpn_uint16 d = 0) const
+    {
+        if (!d_valid || (c < d_cMin) || (c > d_cMax) || (r < d_rMin) ||
+            (r > d_rMax)) {
+            fprintf(stderr, "vrpn_Imager_Region::read_unscaled_pixel(): "
+                            "Invalid region or out of range\n");
+            return false;
+        }
+        else {
+            if (d_valType != vrpn_IMAGER_VALTYPE_UINT8) {
+                fprintf(stderr, "XXX "
+                                "vrpn_Imager_Region::read_unscaled_pixel(): "
+                                "Transcoding not implemented yet\n");
+                return false;
+            }
+            else {
+                // The data is packed in with column varying fastest, row
+                // varying next, and depth
+                // varying slowest.  Depth steps are therefore the largest
+                // steps.
+                val =
+                    ((const vrpn_uint8 *)
+                         d_valBuf)[(c - d_cMin) +
+                                   (d_cMax - d_cMin + 1) *
+                                       ((r - d_rMin) +
+                                        (d - d_dMin) * (d_rMax - d_rMin + 1))];
+            }
+        }
+        return true;
+    }
+
+    /// Reads pixel from the region with no scale and offset applied to the
+    /// value.  Not
+    // the most efficient way to read the pixels out -- use the block read
+    // routines.
+    inline bool read_unscaled_pixel(vrpn_uint16 c, vrpn_uint16 r,
+                                    vrpn_uint16 &val, vrpn_uint16 d = 0) const
+    {
+        if (!d_valid || (d < d_dMin) || (d > d_dMax) || (c < d_cMin) ||
+            (c > d_cMax) || (r < d_rMin) || (r > d_rMax)) {
+            fprintf(stderr, "vrpn_Imager_Region::read_unscaled_pixel(): "
+                            "Invalid region or out of range\n");
+            return false;
+        }
+        else {
+            if ((d_valType != vrpn_IMAGER_VALTYPE_UINT16) &&
+                (d_valType != vrpn_IMAGER_VALTYPE_UINT12IN16)) {
+                fprintf(stderr, "XXX "
+                                "vrpn_Imager_Region::read_unscaled_pixel(): "
+                                "Transcoding not implemented yet\n");
+                return false;
+            }
+            else if (vrpn_big_endian) {
+                fprintf(stderr, "XXX "
+                                "vrpn_Imager_Region::read_unscaled_pixel(): "
+                                "Not implemented on big-endian yet\n");
+                return false;
+            }
+            else {
+                // The data is packed in with column varying fastest, row
+                // varying next, and depth
+                // varying slowest.  Depth steps are therefore the largest
+                // steps.
+                val =
+                    ((const vrpn_uint16 *)
+                         d_valBuf)[(c - d_cMin) +
+                                   (d_cMax - d_cMin + 1) *
+                                       ((r - d_rMin) +
+                                        (d - d_dMin) * (d_rMax - d_rMin + 1))];
+            }
+        }
+        return true;
+    }
+
+    /// Reads pixel from the region with no scale and offset applied to the
+    /// value.  Not
+    // the most efficient way to read the pixels out -- use the block read
+    // routines.
+    inline bool read_unscaled_pixel(vrpn_uint16 c, vrpn_uint16 r,
+                                    vrpn_float32 &val, vrpn_uint16 d = 0) const
+    {
+        if (!d_valid || (d < d_dMin) || (d > d_dMax) || (c < d_cMin) ||
+            (c > d_cMax) || (r < d_rMin) || (r > d_rMax)) {
+            fprintf(stderr, "vrpn_Imager_Region::read_unscaled_pixel(): "
+                            "Invalid region or out of range\n");
+            return false;
+        }
+        else {
+            if (d_valType != vrpn_IMAGER_VALTYPE_FLOAT32) {
+                fprintf(stderr, "XXX "
+                                "vrpn_Imager_Region::read_unscaled_pixel(): "
+                                "Transcoding not implemented yet\n");
+                return false;
+            }
+            else if (vrpn_big_endian) {
+                fprintf(stderr, "XXX "
+                                "vrpn_Imager_Region::read_unscaled_pixel(): "
+                                "Not implemented on big-endian yet\n");
+                return false;
+            }
+            else {
+                // The data is packed in with column varying fastest, row
+                // varying next, and depth
+                // varying slowest.  Depth steps are therefore the largest
+                // steps.
+                val =
+                    ((const vrpn_float32 *)
+                         d_valBuf)[(c - d_cMin) +
+                                   (d_cMax - d_cMin + 1) *
+                                       ((r - d_rMin) +
+                                        (d - d_dMin) * (d_rMax - d_rMin + 1))];
+            }
+        }
+        return true;
+    }
+
+    // Bulk read routines to copy the whole region right into user structures as
+    // efficiently as possible.
+    bool decode_unscaled_region_using_base_pointer(
+        vrpn_uint8 *data, vrpn_uint32 colStride, vrpn_uint32 rowStride,
+        vrpn_uint32 depthStride = 0, vrpn_uint16 nRows = 0,
+        bool invert_rows = false, unsigned repeat = 1) const;
+    // This routine also reads 12-bits-in-16-bit values.
+    bool decode_unscaled_region_using_base_pointer(
+        vrpn_uint16 *data, vrpn_uint32 colStride, vrpn_uint32 rowStride,
+        vrpn_uint32 depthStride = 0, vrpn_uint16 nRows = 0,
+        bool invert_rows = false, unsigned repeat = 1) const;
+    bool decode_unscaled_region_using_base_pointer(
+        vrpn_float32 *data, vrpn_uint32 colStride, vrpn_uint32 rowStride,
+        vrpn_uint32 depthStride = 0, vrpn_uint16 nRows = 0,
+        bool invert_rows = false, unsigned repeat = 1) const;
+
+    // XXX Add routines to read scaled pixels.  Clamp values.
+
+    // Report the type of the values stored in the region.  The above routines
+    // use this to decode automatically, but user code may want to do different
+    // things with different types of data.
+    vrpn_uint16 get_val_type(void) const { return d_valType; }
+
+    vrpn_int16 d_chanIndex;     //< Which channel this region holds data for
+    vrpn_uint16 d_rMin, d_rMax; //< Range of indices for the rows
+    vrpn_uint16 d_cMin, d_cMax; //< Range of indices for the columns
+    vrpn_uint16 d_dMin, d_dMax; //< Range of indices for the depth
+
+protected:
+    const void *d_valBuf;  //< Pointer to the buffer of values
+    vrpn_uint16 d_valType; //< Type of the values in the buffer
+    bool d_valid;          //< Tells whether the helper can be used.
+};
+
+/// This is the class users deal with: it tells the format and the region data
+/// when it arrives.
+class VRPN_API vrpn_Imager_Remote : public vrpn_Imager {
+public:
+    vrpn_Imager_Remote(const char *name, vrpn_Connection *c = NULL);
+
+    /// Register a handler for when new data arrives (can look up info in object
+    /// when this happens)
+    virtual int register_region_handler(void *userdata,
+                                        vrpn_IMAGERREGIONHANDLER handler)
+    {
+        return d_region_list.register_handler(userdata, handler);
+    };
+    virtual int unregister_region_handler(void *userdata,
+                                          vrpn_IMAGERREGIONHANDLER handler)
+    {
+        return d_region_list.unregister_handler(userdata, handler);
+    }
+
+    /// Register a handler for when the object's description changes (if
+    /// desired).
+    virtual int
+    register_description_handler(void *userdata,
+                                 vrpn_IMAGERDESCRIPTIONHANDLER handler)
+    {
+        return d_description_list.register_handler(userdata, handler);
+    };
+    virtual int
+    unregister_description_handler(void *userdata,
+                                   vrpn_IMAGERDESCRIPTIONHANDLER handler)
+    {
+        return d_description_list.unregister_handler(userdata, handler);
+    }
+
+    /// Register a handler for frame beginning (if the application cares)
+    virtual int
+    register_begin_frame_handler(void *userdata,
+                                 vrpn_IMAGERBEGINFRAMEHANDLER handler)
+    {
+        return d_begin_frame_list.register_handler(userdata, handler);
+    };
+    virtual int
+    unregister_begin_frame_handler(void *userdata,
+                                   vrpn_IMAGERBEGINFRAMEHANDLER handler)
+    {
+        return d_begin_frame_list.unregister_handler(userdata, handler);
+    }
+
+    /// Register a handler for frame end (if the application cares)
+    virtual int register_end_frame_handler(void *userdata,
+                                           vrpn_IMAGERENDFRAMEHANDLER handler)
+    {
+        return d_end_frame_list.register_handler(userdata, handler);
+    };
+    virtual int unregister_end_frame_handler(void *userdata,
+                                             vrpn_IMAGERENDFRAMEHANDLER handler)
+    {
+        return d_end_frame_list.unregister_handler(userdata, handler);
+    }
+
+    /// Register a handler for discarded frame notifications (if the application
+    /// cares)
+    virtual int
+    register_discarded_frames_handler(void *userdata,
+                                      vrpn_IMAGERDISCARDEDFRAMESHANDLER handler)
+    {
+        return d_discarded_frames_list.register_handler(userdata, handler);
+    };
+    virtual int unregister_discarded_frames_handler(
+        void *userdata, vrpn_IMAGERDISCARDEDFRAMESHANDLER handler)
+    {
+        return d_discarded_frames_list.unregister_handler(userdata, handler);
+    }
+
+    /// Request that the server send at most N more frames until a new request
+    /// is sent.
+    // This is used to throttle senders that are incurring lots of latency by
+    // filling
+    // the network with packets and blocking.  The next request for "N" will add
+    // onto
+    // the request.  Sending "-1" means to send continuously as fast as
+    // possible,
+    // which is the default.
+    virtual bool throttle_sender(vrpn_int32 N);
+
+    /// XXX It could be nice to let the user specify separate callbacks for
+    // region size changed (which would be called only if the description had
+    // a different region size than the last time, and also the first time it
+    // is called) and channel changes (which would require keeping a copy of
+    // the old and diffing when a new description came in).  Also, the interace
+    // could hook different callbacks for different channels IDs to let the
+    // Imager do the work of sorting out any mapping changes and keeping track
+    // of which channel is handled by which callback -- like the Tracker and its
+    // sensors.  This should happen by name, rather than by index.  It might be
+    // nice to provide a delete callback when a channel is removed and an add
+    // callback when a channel is added as well, and a change callback if the
+    // name, units, scale or offset change.
+
+    /// Call this each time through the program's main loop
+    virtual void mainloop(void);
+
+    /// Accessors for the member variables: can be queried in the handler for
+    /// object changes
+    const vrpn_Imager_Channel *channel(unsigned chanNum) const;
+
+    /// have we gotten a description message yet?
+    bool is_description_valid() { return d_got_description; }
+
+protected:
+    bool d_got_description; //< Have we gotten a description yet?
+    // Lists to keep track of registered user handlers.
+    vrpn_Callback_List<struct timeval> d_description_list;
+    vrpn_Callback_List<vrpn_IMAGERREGIONCB> d_region_list;
+    vrpn_Callback_List<vrpn_IMAGERBEGINFRAMECB> d_begin_frame_list;
+    vrpn_Callback_List<vrpn_IMAGERENDFRAMECB> d_end_frame_list;
+    vrpn_Callback_List<vrpn_IMAGERDISCARDEDFRAMESCB> d_discarded_frames_list;
+
+    /// Handler for region update message from the server.
+    static int VRPN_CALLBACK
+    handle_region_message(void *userdata, vrpn_HANDLERPARAM p);
+
+    /// Handler for resolution and channel list message from the server.
+    static int VRPN_CALLBACK
+    handle_description_message(void *userdata, vrpn_HANDLERPARAM p);
+
+    /// Handler for connection dropped message
+    static int VRPN_CALLBACK
+    handle_connection_dropped_message(void *userdata, vrpn_HANDLERPARAM p);
+
+    /// Handler for begin-frame message from the server.
+    static int VRPN_CALLBACK
+    handle_begin_frame_message(void *userdata, vrpn_HANDLERPARAM p);
+
+    /// Handler for end-frame message from the server.
+    static int VRPN_CALLBACK
+    handle_end_frame_message(void *userdata, vrpn_HANDLERPARAM p);
+
+    /// Handler for discarded-frames message from the server.
+    static int VRPN_CALLBACK
+    handle_discarded_frames_message(void *userdata, vrpn_HANDLERPARAM p);
+};
+
+//------------------------------------------------------------------------------
+// ImagerPose_Remote deals with the physical size and location the pixels in
+// an image.
+
+typedef void(VRPN_CALLBACK *vrpn_IMAGERPOSEDESCRIPTIONHANDLER)(
+    void *userdata, const struct timeval msg_time);
+
+class VRPN_API vrpn_ImagerPose_Remote : public vrpn_ImagerPose {
+public:
+    vrpn_ImagerPose_Remote(const char *name, vrpn_Connection *c = NULL);
+
+    /// Register a handler for when the object's description changes (if
+    /// desired)
+    virtual int
+    register_description_handler(void *userdata,
+                                 vrpn_IMAGERDESCRIPTIONHANDLER handler)
+    {
+        return d_description_list.register_handler(userdata, handler);
+    };
+    virtual int
+    unregister_description_handler(void *userdata,
+                                   vrpn_IMAGERDESCRIPTIONHANDLER handler)
+    {
+        return d_description_list.unregister_handler(userdata, handler);
+    }
+
+    /// Call this each time through the program's main loop
+    virtual void mainloop(void);
+
+protected:
+    // Lists to keep track of registered user handlers.
+    vrpn_Callback_List<struct timeval> d_description_list;
+
+    /// Handler for resolution and channel list message from the server.
+    static int VRPN_CALLBACK
+    handle_description_message(void *userdata, vrpn_HANDLERPARAM p);
+};
+
+#endif
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_LamportClock.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_LamportClock.h
new file mode 100644
index 0000000000000000000000000000000000000000..c168b6290e4c7ef8a830d3f6ff43374f0a24d5ea
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_LamportClock.h
@@ -0,0 +1,91 @@
+#ifndef VRPN_LAMPORT_CLOCK_H
+#define VRPN_LAMPORT_CLOCK_H
+
+#include "vrpn_Configure.h"             // for VRPN_API
+#include "vrpn_Types.h"                 // for vrpn_uint32, vrpn_bool
+
+/// @class vrpn_LamportTimestamp
+/// Timestamp for a single event, produced by a vrpn_LamportClock and
+/// hopefully generally usable in place of a struct timeval.
+
+/// @class vrpn_LamportClock
+/// Implements a distributed event clock as defined by Leslie Lamport in
+/// some seminal papers I can't find my copies of, for use by people who
+/// want to sequence events without relying on synchronization of wallclocks.
+
+class VRPN_API vrpn_LamportTimestamp {
+
+  public:
+
+    vrpn_LamportTimestamp (int vectorLength, vrpn_uint32 * vector);
+    vrpn_LamportTimestamp (const vrpn_LamportTimestamp &);
+    ~vrpn_LamportTimestamp (void);
+
+    vrpn_LamportTimestamp & operator = (const vrpn_LamportTimestamp &);
+
+
+    // ACCESSORS
+
+
+    vrpn_bool operator < (const vrpn_LamportTimestamp & r) const;
+      ///< Returns vrpn_true if this timestamp precedes r.
+      ///< It'd be nice if we could throw an exception here,
+      ///< since some timestamps are incommesurate.
+
+
+    // Utility functions.
+
+    vrpn_uint32 operator [] (int i) const;
+      ///< Returns the event count for the i'th host.
+
+    int size (void) const;
+      ///< Returns the number of hosts participating in the timestamp.
+
+
+  private:
+
+    void copy (const vrpn_uint32 *);
+      ///< Used by constructors and operator = to copy values into
+      ///< d_timestamp;  don't we wish we were using STL?
+
+    int d_timestampSize;
+    vrpn_uint32 * d_timestamp;
+
+    vrpn_LamportTimestamp (void);
+      ///< UNDEFINED - not legal.
+
+};
+
+
+class VRPN_API vrpn_LamportClock {
+
+  public:
+
+    vrpn_LamportClock (int numHosts, int ourIndex);
+    ~vrpn_LamportClock (void);
+
+
+    // MANIPULATORS
+
+
+    void receive (const vrpn_LamportTimestamp &);
+      ///< Updates this clock to reflect a timestamp received from
+      ///< another clock/host.
+
+    vrpn_LamportTimestamp * getTimestampAndAdvance (void);
+      ///< Increments the current timestamp and returns it.
+
+
+  private:
+
+    int d_numHosts;
+    int d_ourIndex;
+    vrpn_uint32 * d_currentTimestamp;
+
+};
+
+
+
+#endif  // VRPN_LAMPORT_CLOCK_H
+
+
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_Mutex.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_Mutex.h
new file mode 100644
index 0000000000000000000000000000000000000000..7d27a05297e07a7e0b821379b6c493833fd2e502
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_Mutex.h
@@ -0,0 +1,333 @@
+#ifndef VRPN_MUTEX_H
+#define VRPN_MUTEX_H
+
+#include <stddef.h> // for NULL
+
+#include "vrpn_Configure.h" // for VRPN_CALLBACK, VRPN_API
+#include "vrpn_Types.h"     // for vrpn_int32, vrpn_uint32, etc
+
+class VRPN_API vrpn_Connection;
+struct vrpn_HANDLERPARAM;
+// Every time a Mutex_Remote connects to a Mutex_Server, the server assigns
+// a unique ID to the remote.
+// HACK - because vrpn doesn't let us unicast within a multicast (multiple-
+// connection server) (in any clean way), or identify at a MC server which
+// connection a message came in over, this code is fragile - it depends
+// on the fact that vrpn_Connection only allows one connection to be made
+// before triggering the got_connection callback.  If connections were somehow
+// batched, or we multithreaded vrpn_Connection, this would break.
+
+class VRPN_API vrpn_Mutex {
+
+public:
+    vrpn_Mutex(const char *name, vrpn_Connection * = NULL);
+    virtual ~vrpn_Mutex(void) = 0;
+
+    void mainloop(void);
+
+protected:
+    vrpn_Connection *d_connection;
+
+    vrpn_int32 d_myId;
+    vrpn_int32 d_requestIndex_type;
+    vrpn_int32 d_requestMutex_type;
+    vrpn_int32 d_release_type;
+    vrpn_int32 d_releaseNotification_type;
+    vrpn_int32 d_grantRequest_type;
+    vrpn_int32 d_denyRequest_type;
+    vrpn_int32 d_initialize_type;
+
+    void sendRequest(vrpn_int32 index);
+    void sendRelease(void);
+    void sendReleaseNotification(void);
+    void sendGrantRequest(vrpn_int32 index);
+    void sendDenyRequest(vrpn_int32 index);
+};
+
+class VRPN_API vrpn_Mutex_Server : public vrpn_Mutex {
+
+public:
+    vrpn_Mutex_Server(const char *name, vrpn_Connection * = NULL);
+    virtual ~vrpn_Mutex_Server(void);
+
+protected:
+    enum state { HELD, FREE };
+
+    state d_state;
+
+    vrpn_int32 d_remoteIndex;
+    ///< Counts remotes who have had IDs issued to them.
+
+    static int VRPN_CALLBACK handle_requestIndex(void *, vrpn_HANDLERPARAM);
+    static int VRPN_CALLBACK handle_requestMutex(void *, vrpn_HANDLERPARAM);
+    static int VRPN_CALLBACK handle_release(void *, vrpn_HANDLERPARAM);
+
+    static int VRPN_CALLBACK handle_gotConnection(void *, vrpn_HANDLERPARAM);
+    static int VRPN_CALLBACK
+    handle_dropLastConnection(void *, vrpn_HANDLERPARAM);
+};
+
+class VRPN_API vrpn_Mutex_Remote : public vrpn_Mutex {
+
+public:
+    vrpn_Mutex_Remote(const char *name, vrpn_Connection * = NULL);
+    virtual ~vrpn_Mutex_Remote(void);
+
+    // ACCESSORS
+
+    vrpn_bool isAvailable(void) const;
+    ///< True from when release() is called or we receive a release
+    ///< message from another process until request() is called or we
+    ///< grant the lock to another process in response to its request
+    ///< message.
+    vrpn_bool isHeldLocally(void) const;
+    ///< True from when RequestGranted callbacks are triggered until
+    ///< release() is called.
+    vrpn_bool isHeldRemotely(void) const;
+    ///< True from when we grant the lock to another process in response
+    ///< to its request message until we receive a release message from
+    ///< another process.
+
+    // MANIPULATORS
+
+    void request(void);
+    ///< Request the distributed lock.  Does not request the lock
+    ///< if !isAvailable(), instead automatically triggering DeniedCallbacks.
+
+    void release(void);
+    ///< Release the distributed lock.  Does nothing if !isHeldLocally()
+    ///< and there isn't a request pending.
+
+    void addRequestGrantedCallback(void *userdata, int (*)(void *));
+    ///< These callbacks are triggered when OUR request is granted.
+    void addRequestDeniedCallback(void *userdata, int (*)(void *));
+    ///< These callbacks are triggered when OUR request is denied.
+    void addTakeCallback(void *userdata, int (*)(void *));
+    ///< These callbacks are triggered when ANY peer gets the mutex.
+    void addReleaseCallback(void *userdata, int (*)(void *));
+    ///< These callbacks are triggered when ANY peer releases the
+    ///< mutex.
+
+protected:
+    void requestIndex(void);
+
+    enum state { OURS, REQUESTING, AVAILABLE, HELD_REMOTELY };
+
+    state d_state;
+    vrpn_int32 d_myIndex;
+    vrpn_bool d_requestBeforeInit;
+
+    static int VRPN_CALLBACK handle_grantRequest(void *, vrpn_HANDLERPARAM);
+    static int VRPN_CALLBACK handle_denyRequest(void *, vrpn_HANDLERPARAM);
+    static int VRPN_CALLBACK
+    handle_releaseNotification(void *, vrpn_HANDLERPARAM);
+
+    static int VRPN_CALLBACK handle_initialize(void *, vrpn_HANDLERPARAM);
+
+    static int VRPN_CALLBACK handle_gotConnection(void *, vrpn_HANDLERPARAM);
+
+    void triggerGrantCallbacks(void);
+    void triggerDenyCallbacks(void);
+    void triggerTakeCallbacks(void);
+    void triggerReleaseCallbacks(void);
+
+    struct mutexCallback {
+        int (*f)(void *);
+        void *userdata;
+        mutexCallback *next;
+    };
+
+    mutexCallback *d_reqGrantedCB;
+    mutexCallback *d_reqDeniedCB;
+    mutexCallback *d_takeCB;
+    mutexCallback *d_releaseCB;
+};
+
+/// vrpn_PeerMutex
+///
+///   This class provides distributed mutual exclusion between every instance
+/// with the same name for which addPeer() has been called.
+///   If a process calls request() when isAvailable() returns true,
+/// the mutex will attempt to secure a lock to whatever resource it is
+/// governing;  either RequestGranted or RequestDenied callbacks will
+/// be triggered.  If RequestGranted callbacks are triggered, the process
+/// has the lock until it explicitly calls release() (and can verify this
+/// by checking isHeldLocally()).  Once the lock-owner calls release(),
+/// Release callbacks at every peer will be triggered.
+///
+///   Like most vrpn classes, the mainloop() must be called frequently.
+///
+///   Note that none of isAvailable(), isHeldLocally(), and isHeldRemotely()
+/// are true between when request() is called and either RequestGranted or
+/// RequestDenied callbacks are triggered.
+
+// Known bugs -
+
+//   The constructor that takes a Connection as an argument will incorrectly
+// identify its IP address as the machine's default rather than the address
+// used by the Connection.  This should not cause any errors in the protocol,
+// but will bias the tiebreaking algorithm.  The same constructor will use
+// the wrong port number;  without this information the tiebreaking algorithm
+// fails.  Oops.  Use only one mutex per Connection for now.
+
+// Possible bugs -
+
+//   If on startup somebody else is holding the mutex we'll think it's
+// available.  However, if we request it they'll deny it to us and
+// we won't break.
+//   If sites don't execute the same set of addPeer() commands, they may
+// implicitly partition the network and not get true mutual exclusion.
+// This could be fixed by sending an addPeer message.
+//   If sites execute addPeer() while the lock is held, or being requested,
+// we'll break.
+//   - To fix:  send messages, but defer all executions of addPeer until the
+// lock is released.  If we want to be really careful here, on getting an
+// addPeer message when we think the lock is available we should request
+// the lock and then (if we get it) release it immediately, without
+// triggering any user callbacks.  Sounds tough to code?
+
+// Handling more than 2 sites in a mutex requires multiconnection servers.
+// It's been tested with 1-3 sites, and works fine.
+
+// This is an O(n^2) network traffic implementation;
+// for details (and how to fix if it ever becomes a problem),
+// see the implementation notes in vrpn_Mutex.C.
+
+class VRPN_API vrpn_PeerMutex {
+
+public:
+    vrpn_PeerMutex(const char *name, int port, const char *NICaddress = NULL);
+    ///< This constructor opens a new connection/port for the mutex.
+
+    ~vrpn_PeerMutex(void);
+    ///< If isHeldLocally(), calls release().
+
+    // ACCESSORS
+
+    vrpn_bool isAvailable(void) const;
+    ///< True from when release() is called or we receive a release
+    ///< message from another process until request() is called or we
+    ///< grant the lock to another process in response to its request
+    ///< message.
+    vrpn_bool isHeldLocally(void) const;
+    ///< True from when RequestGranted callbacks are triggered until
+    ///< release() is called.
+    vrpn_bool isHeldRemotely(void) const;
+    ///< True from when we grant the lock to another process in response
+    ///< to its request message until we receive a release message from
+    ///< another process.
+
+    int numPeers(void) const;
+
+    // MANIPULATORS
+
+    void mainloop(void);
+
+    void request(void);
+    ///< Request the distributed lock.  Does not request the lock
+    ///< if !isAvailable(), instead automatically triggering DeniedCallbacks.
+
+    void release(void);
+    ///< Release the distributed lock.  Does nothing if !isHeldLocally()
+    ///< and there isn't a request pending.
+
+    void addPeer(const char *stationName);
+    ///< Takes a VRPN station name of the form "<host>:<port>".
+
+    void addRequestGrantedCallback(void *userdata, int (*)(void *));
+    ///< These callbacks are triggered when OUR request is granted.
+    void addRequestDeniedCallback(void *userdata, int (*)(void *));
+    ///< These callbacks are triggered when OUR request is denied.
+    void addTakeCallback(void *userdata, int (*)(void *));
+    ///< These callbacks are triggered when ANY peer gets the mutex.
+    ///< (If several peers are competing for the mutex, and the
+    ///<  implementation issues multiple "grants", these callbacks will
+    ///<  only be triggered once between triggerings of ReleaseCallbacks.)
+    void addReleaseCallback(void *userdata, int (*)(void *));
+    ///< These callbacks are triggered when ANY peer releases the
+    ///< mutex.
+
+protected:
+    enum state { OURS, REQUESTING, AVAILABLE, HELD_REMOTELY };
+
+    char *d_mutexName;
+
+    state d_state;
+
+    int d_numPeersGrantingLock;
+    ///< Counts the number of "grants" we've received after issuing
+    ///< a request;  when this reaches d_numPeers, the lock is ours.
+
+    vrpn_Connection *d_server;
+    ///< Receive on this connection.
+    vrpn_Connection **d_peer;
+    ///< Send on these connections to other Mutex's well-known-ports.
+
+    int d_numPeers;
+    int d_numConnectionsAllocated;
+    ///< Dynamic array size for d_peer and d_peerGrantedLock.
+
+    vrpn_uint32 d_myIP;
+    vrpn_uint32 d_myPort;
+    vrpn_uint32 d_holderIP;
+    vrpn_int32 d_holderPort;
+
+    vrpn_int32 d_myId;
+    vrpn_int32 d_request_type;
+    vrpn_int32 d_release_type;
+    vrpn_int32 d_grantRequest_type;
+    vrpn_int32 d_denyRequest_type;
+    // vrpn_int32 d_losePeer_type;
+
+    static int VRPN_CALLBACK handle_request(void *, vrpn_HANDLERPARAM);
+    static int VRPN_CALLBACK handle_release(void *, vrpn_HANDLERPARAM);
+    static int VRPN_CALLBACK handle_grantRequest(void *, vrpn_HANDLERPARAM);
+    static int VRPN_CALLBACK handle_denyRequest(void *, vrpn_HANDLERPARAM);
+
+    static int VRPN_CALLBACK handle_losePeer(void *, vrpn_HANDLERPARAM);
+
+    void sendRequest(vrpn_Connection *);
+    void sendRelease(vrpn_Connection *);
+    void sendGrantRequest(vrpn_Connection *, vrpn_uint32 IPnumber,
+                          vrpn_uint32 PortNumber);
+    void sendDenyRequest(vrpn_Connection *, vrpn_uint32 IPnumber,
+                         vrpn_uint32 PortNumber);
+
+    void triggerGrantCallbacks(void);
+    void triggerDenyCallbacks(void);
+    void triggerTakeCallbacks(void);
+    void triggerReleaseCallbacks(void);
+
+    void checkGrantMutex(void);
+
+    void init(const char *name);
+
+    struct mutexCallback {
+        int (*f)(void *);
+        void *userdata;
+        mutexCallback *next;
+    };
+
+    mutexCallback *d_reqGrantedCB;
+    mutexCallback *d_reqDeniedCB;
+    mutexCallback *d_takeCB;
+    mutexCallback *d_releaseCB;
+
+    struct peerData {
+        vrpn_uint32 IPaddress;
+        vrpn_uint32 port;
+        vrpn_bool grantedLock;
+    };
+
+    peerData *d_peerData;
+    ///< Needed only to clean up when a peer shuts down (mid-request).
+    ///< It isn't currently feasible to have all this data, so instead
+    ///< we abort requests that were interrupted by a shutdown.
+
+    vrpn_PeerMutex(const char *name, vrpn_Connection *c);
+    ///< This constructor reuses a SERVER connection for the mutex.
+    ///< BUG BUG BUG - do not use this constructor;  it does not reliably
+    ///< resolve race conditions.
+};
+
+#endif // VRPN_MUTEX_H
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_Poser.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_Poser.h
new file mode 100644
index 0000000000000000000000000000000000000000..d6dd3401a41955732c9e4f1df6055df73187167a
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_Poser.h
@@ -0,0 +1,191 @@
+#ifndef vrpn_POSER_H
+#define vrpn_POSER_H
+#include <stdio.h> // for NULL
+
+// NOTE: the poser class borrows heavily from the vrpn_Tracker code.
+//       The poser is basically the inverse of a tracker.
+//       We are only handling pose and velocity updates for now...acceleration
+//       will come later, as needed.
+
+#include "vrpn_BaseClass.h" // for vrpn_Callback_List, etc
+#include "vrpn_Configure.h" // for VRPN_CALLBACK, VRPN_API
+#include "vrpn_Shared.h"    // for timeval
+#include "vrpn_Types.h"     // for vrpn_float64, vrpn_int32
+
+class VRPN_API vrpn_Connection;
+struct vrpn_HANDLERPARAM;
+
+class VRPN_API vrpn_Poser : public vrpn_BaseClass {
+public:
+    vrpn_Poser(const char* name, vrpn_Connection* c = NULL);
+
+    virtual ~vrpn_Poser(void);
+
+    void p_print();     // print the current pose
+    void p_print_vel(); // print the current velocity
+
+    // a poser server should call the following to register the
+    // default xform and workspace request handlers
+    //        int register_server_handlers(void);
+
+protected:
+    // client-->server
+    vrpn_int32 req_position_m_id;          // ID of poser position message
+    vrpn_int32 req_position_relative_m_id; // ID of poser position delta message
+    vrpn_int32 req_velocity_m_id;          // ID of poser velocity message
+    vrpn_int32 req_velocity_relative_m_id; // ID of poser velocity delta message
+
+    // Description of current state
+    vrpn_float64 p_pos[3], p_quat[4]; // Current pose, (x,y,z), (qx,qy,qz,qw)
+    vrpn_float64 p_vel[3],
+        p_vel_quat[4];          // Current velocity and dQuat/vel_quat_dt
+    vrpn_float64 p_vel_quat_dt; // delta time (in secs) for vel_quat
+    struct timeval p_timestamp; // Current timestamp
+
+    // Minimum and maximum values available for the position and velocity values
+    // of the poser.
+    vrpn_float64 p_pos_min[3], p_pos_max[3], p_pos_rot_min[3], p_pos_rot_max[3],
+        p_vel_min[3], p_vel_max[3], p_vel_rot_min[3], p_vel_rot_max[3];
+
+    virtual int register_types(void); // Called by BaseClass init()
+
+    virtual int encode_to(char* buf);     // Encodes the position
+    virtual int encode_vel_to(char* buf); // Encodes the velocity
+
+    virtual void set_pose(const struct timeval t, // Sets the pose internally
+                          const vrpn_float64 position[3],
+                          const vrpn_float64 quaternion[4]);
+    virtual void set_pose_relative(
+        const struct timeval t, // Increments the pose internally
+        const vrpn_float64
+            position_delta[3],             // pos_new = position_delta + pos_old
+        const vrpn_float64 quaternion[4]); // q_new = quaternion * q_old
+    virtual void
+    set_pose_velocity(const struct timeval t, // Sets the velocity internally
+                      const vrpn_float64 position[3],
+                      const vrpn_float64 quaternion[4],
+                      const vrpn_float64 interval);
+    virtual void set_pose_velocity_relative(
+        const struct timeval t, // Increments the velocity internally
+        const vrpn_float64
+            velocity_delta[3],            // vel_new = velocity_delta + vel_old
+        const vrpn_float64 quaternion[4], // q_new = quaternion * q_old
+        const vrpn_float64
+            interval_delta); // interval_new = interval_delta + interval_old
+};
+
+//------------------------------------------------------------------------------------
+// Server Code
+
+/// A structure for Call-Backs related to Vrpn Poser Server
+typedef struct _vrpn_POSERCB {
+    struct timeval msg_time; // Timestamp
+    /// NOTE: I think since we have different routines for handling velocity and
+    /// position poser requests,
+    /// putting poser and quaternions for both doesn't make sense. Instead, the
+    /// change handler should
+    /// take care of packing correct poser and quaternion.
+    vrpn_float64 pos[3];
+    vrpn_float64 quat[4];
+} vrpn_POSERCB;
+
+typedef void(VRPN_CALLBACK* vrpn_POSERHANDLER)(void* userdata,
+                                               const vrpn_POSERCB info);
+
+//------------------------------------------------------------------------------------
+// Server Code
+// Users supply the routines to handle requests from the client
+
+// This is a sample basic poser server
+//
+
+class VRPN_API vrpn_Poser_Server : public vrpn_Poser {
+public:
+    vrpn_Poser_Server(const char* name, vrpn_Connection* c);
+
+    /// This function should be called each time through app mainloop.
+    virtual void mainloop();
+
+    int register_change_handler(void* userdata, vrpn_POSERHANDLER handler)
+    {
+        return d_callback_list.register_handler(userdata, handler);
+    };
+    int unregister_change_handler(void* userdata, vrpn_POSERHANDLER handler)
+    {
+        return d_callback_list.unregister_handler(userdata, handler);
+    }
+
+    int register_relative_change_handler(void* userdata,
+                                         vrpn_POSERHANDLER handler)
+    {
+        return d_relative_callback_list.register_handler(userdata, handler);
+    }
+    int unregister_relative_change_handler(void* userdata,
+                                           vrpn_POSERHANDLER handler)
+    {
+        return d_relative_callback_list.unregister_handler(userdata, handler);
+    }
+
+protected:
+    static int VRPN_CALLBACK
+    handle_change_message(void* userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_relative_change_message(void* userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_vel_change_message(void* userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_relative_vel_change_message(void* userdata, vrpn_HANDLERPARAM p);
+    vrpn_Callback_List<vrpn_POSERCB> d_callback_list;
+    vrpn_Callback_List<vrpn_POSERCB> d_relative_callback_list;
+};
+
+//------------------------------------------------------------------------------------
+// Client Code
+
+// Open a poser that is on the other end of a connection for sending updates to
+// it.
+class VRPN_API vrpn_Poser_Remote : public vrpn_Poser {
+public:
+    // The name of the poser to connect to, including connection name,
+    // for example "poser@magnesium.cs.unc.edu". If you already
+    // have the connection open, you can specify it as the second parameter.
+    // This allows both servers and clients in the same thread, for example.
+    // If it is not specified, then the connection will be looked up based
+    // on the name passed in.
+    vrpn_Poser_Remote(const char* name, vrpn_Connection* c = NULL);
+
+    // unregister all of the handlers registered with the connection
+    virtual ~vrpn_Poser_Remote(void);
+
+    // This routine calls the mainloop of the connection it's on
+    virtual void mainloop();
+
+    // Routines to set the state of the poser
+    int request_pose(const struct timeval t, const vrpn_float64 position[3],
+                     const vrpn_float64 quaternion[4]);
+    int request_pose_relative(const struct timeval t,
+                              const vrpn_float64 position_delta[3],
+                              const vrpn_float64 quaternion[4]);
+    int request_pose_velocity(const struct timeval t,
+                              const vrpn_float64 velocity[3],
+                              const vrpn_float64 quaternion[4],
+                              const vrpn_float64 interval);
+    int request_pose_velocity_relative(const struct timeval t,
+                                       const vrpn_float64 velocity_delta[3],
+                                       const vrpn_float64 quaternion[4],
+                                       const vrpn_float64 interval_delta);
+
+protected:
+    virtual int
+    client_send_pose(); // Sends the current pose.  Called by request_pose
+    virtual int client_send_pose_relative(); // Sends the current pose delta.
+                                             // Called by request_pose_relative
+    virtual int client_send_pose_velocity(); // Sends the current velocity.
+                                             // Called by request_pose_velocity
+    virtual int
+    client_send_pose_velocity_relative(); // Sends the current velocity delta.
+                                          // Called by
+                                          // request_pose_velocity_relative
+};
+
+#endif
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_RedundantTransmission.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_RedundantTransmission.h
new file mode 100644
index 0000000000000000000000000000000000000000..9df9b86d9aab96123514d892d825059eaf8dbec4
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_RedundantTransmission.h
@@ -0,0 +1,214 @@
+#ifndef VRPN_REDUNDANT_TRANSMISSION_H
+#define VRPN_REDUNDANT_TRANSMISSION_H
+
+/// @class vrpn_RedundantTransmission
+/// Helper class for vrpn_Connection that automates redundant transmission
+/// for unreliable (low-latency) messages.  Call pack_messages() here instead
+/// of on your connection, and call mainloop() here before calling mainloop()
+/// on your connection.
+
+#include <stddef.h> // for NULL
+
+#include "vrpn_BaseClass.h"  // for vrpn_BaseClass
+#include "vrpn_Configure.h"  // for VRPN_API, VRPN_CALLBACK
+#include "vrpn_Connection.h" // for vrpn_Connection (ptr only), etc
+#include "vrpn_Shared.h"     // for timeval
+#include "vrpn_Types.h"      // for vrpn_uint32, vrpn_bool, etc
+
+struct timeval;
+
+class VRPN_API vrpn_RedundantTransmission {
+
+public:
+    vrpn_RedundantTransmission(vrpn_Connection *c);
+    virtual ~vrpn_RedundantTransmission(void);
+
+    // ACCESSORS
+
+    vrpn_uint32 defaultRetransmissions(void) const;
+    timeval defaultInterval(void) const;
+    vrpn_bool isEnabled(void) const;
+
+    // MANIPULATORS
+
+    virtual void mainloop(void);
+    ///< Determines which messages need to be resent and queues
+    ///< them up on the connection for transmission.
+
+    void enable(vrpn_bool);
+
+    virtual void setDefaults(vrpn_uint32 numRetransmissions,
+                             timeval transmissionInterval);
+    ///< Set default values for future calls to pack_message().
+
+    virtual int pack_message(vrpn_uint32 len, timeval time, vrpn_uint32 type,
+                             vrpn_uint32 sender, const char *buffer,
+                             vrpn_uint32 class_of_service,
+                             vrpn_int32 numRetransmissions = -1,
+                             timeval *transmissionInterval = NULL);
+    ///< If !isEnabled(), does a normal pack_message(), but if isEnabled()
+    ///< ignores class_of_service and sends it vrpn_CONNECTION_LOW_LATENCY,
+    ///< sending it an additional number of times equal to numRetransmissions
+    ///< at minimum intervals of transmissionInterval.
+    ///< Specify -1 and NULL to use default values.
+
+protected:
+    vrpn_Connection *d_connection;
+
+    struct queuedMessage {
+        vrpn_HANDLERPARAM p;
+        vrpn_uint32 remainingTransmissions;
+        timeval transmissionInterval;
+        timeval nextValidTime;
+        queuedMessage *next;
+    };
+
+    queuedMessage *d_messageList;
+    vrpn_uint32 d_numMessagesQueued;
+    ///< For debugging, mostly.
+
+    // Default values.
+
+    vrpn_uint32 d_numTransmissions;
+    timeval d_transmissionInterval;
+
+    vrpn_bool d_isEnabled;
+};
+
+struct vrpn_RedundantController_Protocol {
+
+    char *encode_set(int *len, vrpn_uint32 num, timeval interval);
+    void decode_set(const char **buf, vrpn_uint32 *num, timeval *interval);
+
+    char *encode_enable(int *len, vrpn_bool);
+    void decode_enable(const char **buf, vrpn_bool *);
+
+    void register_types(vrpn_Connection *);
+
+    vrpn_int32 d_set_type;
+    vrpn_int32 d_enable_type;
+};
+
+/// @class vrpn_RedundantController
+/// Accepts commands over a connection to control a local
+/// vrpn_RedundantTransmission's default parameters.
+
+class VRPN_API vrpn_RedundantController : public vrpn_BaseClass {
+
+public:
+    vrpn_RedundantController(vrpn_RedundantTransmission *, vrpn_Connection *);
+    ~vrpn_RedundantController(void);
+
+    void mainloop(void);
+    // Do nothing;  vrpn_BaseClass requires this.
+
+protected:
+    virtual int register_types(void);
+
+    vrpn_RedundantController_Protocol d_protocol;
+
+    static int VRPN_CALLBACK handle_set(void *, vrpn_HANDLERPARAM);
+    static int VRPN_CALLBACK handle_enable(void *, vrpn_HANDLERPARAM);
+
+    vrpn_RedundantTransmission *d_object;
+};
+
+/// @class vrpn_RedundantRemote
+/// Sends messages to a vrpn_RedundantController so that a
+/// vrpn_RedundantTransmission on a server can be controlled from a client.
+
+class VRPN_API vrpn_RedundantRemote : public vrpn_BaseClass {
+
+public:
+    vrpn_RedundantRemote(vrpn_Connection *);
+    ~vrpn_RedundantRemote(void);
+
+    void mainloop(void);
+    // Do nothing;  vrpn_BaseClass requires this.
+
+    void set(int numRetransmissions, timeval transmissionInterval);
+    void enable(vrpn_bool);
+
+protected:
+    int register_types(void);
+
+    vrpn_RedundantController_Protocol d_protocol;
+};
+
+/// @class vrpn_RedundantReceiver
+/// Helper class that eliminates duplicates;  only the first instance of
+/// a message is delivered.  Registers a callback on connection for any
+/// type it's told to monitor;  when it gets a message back, checks its
+/// list of recently-seen-timestamps for that type;  if it isn't on the
+/// list, it's dispatched and replaces the oldest item on the list.
+/// List length is limited, so
+/// if too many messages of the same type (more than VRPN_RR_LENGTH) are
+/// interleaved - if transmissionInterval * numRetransmissions >
+/// VRPN_RR_LENGTH * the normal rate of message generation - it will not
+/// detect the redundant messages.
+
+// A TypeDispatcher insists on too much control of its table for
+// us to use one here - we want to use the same indices as the
+// vrpn_Connection we're attached to, but if we had our own TypeDispatcher
+// we'd have an independent, inconsistent set of type & sender ids.
+
+#define VRPN_RR_LENGTH 8
+
+class VRPN_API vrpn_RedundantReceiver {
+
+public:
+    vrpn_RedundantReceiver(vrpn_Connection *);
+    virtual ~vrpn_RedundantReceiver(void);
+
+    virtual int register_handler(vrpn_int32 type, vrpn_MESSAGEHANDLER handler,
+                                 void *userdata,
+                                 vrpn_int32 sender = vrpn_ANY_SENDER);
+    virtual int unregister_handler(vrpn_int32 type, vrpn_MESSAGEHANDLER handler,
+                                   void *userdata,
+                                   vrpn_int32 sender = vrpn_ANY_SENDER);
+
+    void record(vrpn_bool);
+    ///< Turns "memory" (tracking statistics of redundant reception)
+    ///< on and off.
+
+    void writeMemory(const char *filename);
+    ///< Writes statistics to the named file:  timestamp of every message
+    ///< received and number of copies of that message.  Detects partial
+    ///< losses, but not when all copies are lost, since vrpn_RR doesn't
+    ///< expect messages.
+
+    void clearMemory(void);
+    ///< Throws away / resets statistics.
+
+protected:
+    vrpn_Connection *d_connection;
+
+    struct VRPN_API RRRecord {
+        RRRecord(void);
+
+        timeval timestampSeen[VRPN_RR_LENGTH];
+        int numSeen[VRPN_RR_LENGTH];
+        int nextTimestampToReplace;
+
+        vrpnMsgCallbackEntry *cb;
+        vrpn_bool handlerIsRegistered;
+    };
+
+    RRRecord d_records[vrpn_CONNECTION_MAX_TYPES];
+    RRRecord d_generic;
+
+    struct RRMemory {
+        timeval timestamp;
+        int numSeen;
+        RRMemory *next;
+    };
+
+    RRMemory *d_memory;
+    RRMemory *d_lastMemory;
+    vrpn_bool d_record;
+
+    static int VRPN_CALLBACK
+    handle_possiblyRedundantMessage(void *, vrpn_HANDLERPARAM);
+};
+
+#endif // VRPN_REDUNDANT_TRANSMISSION_H
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_Serial.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_Serial.h
new file mode 100644
index 0000000000000000000000000000000000000000..ac031fc92f6a23181c2878d466aae69adb8f0c3e
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_Serial.h
@@ -0,0 +1,91 @@
+#ifndef VRPN_SERIAL_H
+#define VRPN_SERIAL_H
+
+#include "vrpn_Configure.h" // for VRPN_API
+#include <stddef.h>         // For size_t
+
+/// @file
+///
+/// @brief vrpn_Serial: Pulls all the serial port routines into one file to make
+/// porting to
+/// new operating systems easier.
+///
+/// @author Russ Taylor, 1998
+
+typedef enum {
+    vrpn_SER_PARITY_NONE,
+    vrpn_SER_PARITY_ODD,
+    vrpn_SER_PARITY_EVEN,
+    vrpn_SER_PARITY_MARK,
+    vrpn_SER_PARITY_SPACE
+} vrpn_SER_PARITY;
+
+/// @brief Open a serial port, given its name and baud rate.
+///
+/// Default Settings are 8 bits, no parity, 1 start and stop bits with no
+/// RTS (hardware) flow control.  Also,
+/// set the port so that it will return immediately if there are no
+/// characters or less than the number of characters requested.
+///
+/// @returns the file descriptor on success,-1 on failure.
+extern VRPN_API int
+vrpn_open_commport(const char *portname, long baud, int charsize = 8,
+                   vrpn_SER_PARITY parity = vrpn_SER_PARITY_NONE,
+                   bool rts_flow = false);
+
+/// @name RTS Hardware Flow Control
+/// Set and clear functions for the RTS ("ready to send") hardware flow-
+/// control bit.  These are used on a port that is already open.  Some
+/// devices (like the Ascension Flock of Birds) use this to reset the
+/// device.  Return 0 on success, nonzero on error.
+/// @{
+extern VRPN_API int vrpn_set_rts(int comm);
+extern VRPN_API int vrpn_clear_rts(int comm);
+/// @}
+
+extern VRPN_API int vrpn_close_commport(int comm);
+
+/// @brief Throw out any characters within the input buffer.
+/// @returns 0 on success, -1 on error.
+extern VRPN_API int vrpn_flush_input_buffer(int comm);
+
+/// @brief Throw out any characters (do not send) within the output buffer
+/// @returns 0 on success, tc err codes (whatever those are) on error.
+extern VRPN_API int vrpn_flush_output_buffer(int comm);
+
+/// @brief Wait until all of the characters in the output buffer are sent, then
+/// return.
+///
+/// @returns 0 on success, -1 on error.
+extern VRPN_API int vrpn_drain_output_buffer(int comm);
+
+/// @name Read routines
+///
+/// Read up the the requested count of characters from the input buffer,
+/// return with less if less (or none) are there.  Return the number of
+/// characters read, or -1 if there is an error.  The second of these
+/// will keep looking until the timeout period expires before returning
+/// (NULL pointer will cause it to block indefinitely).
+/// @{
+extern VRPN_API int
+vrpn_read_available_characters(int comm, unsigned char *buffer, size_t count);
+extern VRPN_API int vrpn_read_available_characters(int comm,
+                                                   unsigned char *buffer,
+                                                   size_t count,
+                                                   struct timeval *timeout);
+/// @}
+
+/// @name Write routines
+///
+/// Write the specified number of characters.  Some devices can't accept writes
+/// that
+/// are too fast, so need time between characters; the write_slowly function
+/// handles
+/// this case.
+/// @}
+extern VRPN_API int vrpn_write_characters(int comm, const unsigned char *buffer,
+                                          size_t bytes);
+extern VRPN_API int vrpn_write_slowly(int comm, const unsigned char *buffer,
+                                      size_t bytes, int millisec_delay);
+
+#endif
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_SerialPort.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_SerialPort.h
new file mode 100644
index 0000000000000000000000000000000000000000..3a41e71059b7c5c42042f44ec27d2f6b37126c6f
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_SerialPort.h
@@ -0,0 +1,227 @@
+/** @file
+    @brief Header
+
+    @date 2012
+
+    @author
+    Ryan Pavlik
+    <rpavlik@iastate.edu> and <abiryan@ryand.net>
+    http://academic.cleardefinition.com/
+    Iowa State University Virtual Reality Applications Center
+    Human-Computer Interaction Graduate Program
+*/
+
+//          Copyright Iowa State University 2012.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#pragma once
+
+// Internal Includes
+#include "vrpn_Configure.h" // for VRPN_API
+#include "vrpn_Serial.h"    // for ::vrpn_SER_PARITY_NONE, etc
+
+// Library/third-party includes
+// - none
+
+// Standard includes
+#include <stdexcept> // for runtime_error, logic_error
+#include <string>    // for string
+
+/// @brief A simple class wrapping the functionality of vrpn_Serial.h with
+/// RAII, object-orientation, and optional STL types
+class VRPN_API vrpn_SerialPort {
+public:
+    typedef int file_handle_type;
+    /// @brief Construct and open port
+    /// @sa vrpn_open_commport
+    /// @throws OpenFailure
+    vrpn_SerialPort(const char *portname, long baud, int charsize = 8,
+                    vrpn_SER_PARITY parity = vrpn_SER_PARITY_NONE);
+
+    /// @brief Construct without opening
+    vrpn_SerialPort();
+
+    /// @brief Destructor - closes port if open.
+    ~vrpn_SerialPort();
+
+    /// @name Open/Close Methods
+    /// @{
+    /// @brief Open serial port
+    /// @sa vrpn_open_commport
+    /// @throws OpenFailure, AlreadyOpen
+    void open(const char *portname, long baud, int charsize = 8,
+              vrpn_SER_PARITY parity = vrpn_SER_PARITY_NONE);
+    bool is_open() const;
+
+    /// @brief Close the serial port.
+    /// @throws NotOpen, CloseFailure
+    void close();
+    /// @}
+
+    /// @name Write
+    /// @returns number of bytes written
+    /// @throws WriteFailure, NotOpen
+    /// @{
+    int write(std::string const &buffer);
+    int write(const unsigned char *buffer, int bytes);
+    /// @}
+
+    /// @name Read
+    /// @throws ReadFailure, NotOpen
+    /// @{
+    /// @brief Read available characters from input buffer, up to indicated
+    /// count.
+    int read_available_characters(unsigned char *buffer, int count);
+
+    /// @brief Read available characters from input buffer, up to indicated
+    /// count (or -1 for no limit)
+    std::string read_available_characters(int count = -1);
+
+    /// @brief Read available characters from input buffer, and wait up to the
+    /// indicated timeout for those remaining, up to indicated count.
+    int read_available_characters(unsigned char *buffer, int count,
+                                  struct timeval &timeout);
+
+    /// @brief Read available characters from input buffer, and wait up to the
+    /// indicated timeout for those remaining, up to indicated count.
+    std::string read_available_characters(int count, struct timeval &timeout);
+    /// @}
+
+    /// @name Buffer manipulation
+    /// @{
+
+    /// @brief Throw out any characters within the input buffer.
+    /// @throws FlushFailure, NotOpen
+    void flush_input_buffer();
+
+    /// @brief Throw out any characters (do not send) within the output buffer.
+    /// @throws FlushFailure, NotOpen
+    void flush_output_buffer();
+
+    /// @brief Wait until all of the characters in the output buffer are sent,
+    /// then return.
+    void drain_output_buffer();
+    /// @}
+
+    /// @name RTS
+    /// @brief Set and clear functions for the RTS ("ready to send") hardware
+    /// flow- control bit.
+    ///
+    /// These are used on a port that is already open. Some devices (like the
+    /// Ascension Flock of Birds) use this to reset the device.
+    /// @throws RTSFailure, NotOpen
+    /// @{
+    void set_rts();
+    void clear_rts();
+    void assign_rts(bool set);
+    /// @}
+
+    /// @name Serial Port Exceptions
+    /// @{
+    struct AlreadyOpen;
+    struct CloseFailure;
+    struct DrainFailure;
+    struct FlushFailure;
+    struct NotOpen;
+    struct OpenFailure;
+    struct RTSFailure;
+    struct ReadFailure;
+    struct WriteFailure;
+    /// @}
+
+private:
+    void requiresOpen() const;
+    /// @name Non-copyable
+    /// @{
+    vrpn_SerialPort(vrpn_SerialPort const &);
+    vrpn_SerialPort const &operator=(vrpn_SerialPort const &);
+    /// @}
+    file_handle_type _comm;
+    bool _rts_status;
+};
+
+struct vrpn_SerialPort::AlreadyOpen : std::logic_error {
+    AlreadyOpen()
+        : std::logic_error("Tried to open a serial port that was already open.")
+    {
+    }
+};
+
+struct vrpn_SerialPort::NotOpen : std::logic_error {
+    NotOpen()
+        : std::logic_error("Tried to use a serial port that was not yet open.")
+    {
+    }
+};
+
+struct vrpn_SerialPort::OpenFailure : std::runtime_error {
+    OpenFailure()
+        : std::runtime_error(
+              "Received an error when trying to open serial port.")
+    {
+    }
+};
+
+struct vrpn_SerialPort::CloseFailure : std::runtime_error {
+    CloseFailure()
+        : std::runtime_error(
+              "Received an error when trying to close serial port.")
+    {
+    }
+};
+
+struct vrpn_SerialPort::RTSFailure : std::runtime_error {
+    RTSFailure()
+        : std::runtime_error("Failed to modify serial port RTS status.")
+    {
+    }
+};
+
+struct vrpn_SerialPort::ReadFailure : std::runtime_error {
+    ReadFailure()
+        : std::runtime_error("Failure on serial port read.")
+    {
+    }
+};
+
+struct vrpn_SerialPort::WriteFailure : std::runtime_error {
+    WriteFailure()
+        : std::runtime_error("Failure on serial port write.")
+    {
+    }
+};
+
+struct vrpn_SerialPort::FlushFailure : std::runtime_error {
+    FlushFailure()
+        : std::runtime_error("Failure on serial port flush.")
+    {
+    }
+};
+
+struct vrpn_SerialPort::DrainFailure : std::runtime_error {
+    DrainFailure()
+        : std::runtime_error("Failure on serial port drain.")
+    {
+    }
+};
+
+inline bool vrpn_SerialPort::is_open() const { return _comm != -1; }
+
+inline void vrpn_SerialPort::assign_rts(bool set)
+{
+    if (set) {
+        set_rts();
+    }
+    else {
+        clear_rts();
+    }
+}
+
+inline void vrpn_SerialPort::requiresOpen() const
+{
+    if (!is_open()) {
+        throw NotOpen();
+    }
+}
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_Shared.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_Shared.h
new file mode 100644
index 0000000000000000000000000000000000000000..10c112b617660c09a4b9ccecb61602e4d3ad0f55
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_Shared.h
@@ -0,0 +1,495 @@
+#pragma once
+
+// Horrible hack for old HPUX compiler
+#ifdef hpux
+#ifndef true
+#define bool int
+#define true 1
+#define false 0
+#endif
+#endif
+
+#include "vrpn_Configure.h" // for VRPN_API
+#include "vrpn_Types.h"     // for vrpn_int32, vrpn_float64, etc
+#include "vrpn_Thread.h"
+#include <string.h>         // for memcpy()
+#include <stdio.h>          // for fprintf()
+
+#if defined(__ANDROID__)
+#include <bitset>
+#endif
+
+// IWYU pragma: no_include <bits/time.h>
+
+// Oct 2000: Sang-Uok changed because vrpn code was compiling but giving
+// runtime errors with cygwin 1.1. I changed the code so it only uses unix
+// code. I had to change includes in various files.
+
+// jan 2000: jeff changing the way sockets are used with cygwin.  I made this
+// change because I realized that we were using winsock stuff in some places,
+// and cygwin stuff in others.  Discovered this when our code wouldn't compile
+// in cygwin-1.0 (but it did in cygwin-b20.1).
+
+// let's start with a clean slate
+#undef VRPN_USE_WINSOCK_SOCKETS
+
+// Does cygwin use winsock sockets or unix sockets
+//#define VRPN_CYGWIN_USES_WINSOCK_SOCKETS
+
+#if defined(_WIN32) &&                                                         \
+    (!defined(__CYGWIN__) || defined(VRPN_CYGWIN_USES_WINSOCK_SOCKETS))
+#define VRPN_USE_WINSOCK_SOCKETS
+#endif
+
+#ifndef VRPN_USE_WINSOCK_SOCKETS
+// On Win32, this constant is defined as ~0 (sockets are unsigned ints)
+#define INVALID_SOCKET -1
+#define SOCKET int
+#endif
+
+#if !(defined(_WIN32) && defined(VRPN_USE_WINSOCK_SOCKETS))
+#include <sys/select.h> // for select
+#include <netinet/in.h> // for htonl, htons
+#endif
+
+#ifdef _WIN32_WCE
+#define perror(x) fprintf(stderr, "%s\n", x);
+#endif
+
+// comment from vrpn_Connection.h reads :
+//
+//   gethostbyname() fails on SOME Windows NT boxes, but not all,
+//   if given an IP octet string rather than a true name.
+//   Until we figure out WHY, we have this extra clause in here.
+//   It probably wouldn't hurt to enable it for non-NT systems
+//   as well.
+#ifdef _WIN32
+#define VRPN_USE_WINDOWS_GETHOSTBYNAME_HACK
+#endif
+
+//--------------------------------------------------------------
+// Timeval defines.  These are a bit hairy.  The basic problem is
+// that Windows doesn't implement gettimeofday(), nor does it
+// define "struct timezone", although Winsock.h does define
+// "struct timeval".  The painful solution has been to define a
+// vrpn_gettimeofday() function that takes a void * as a second
+// argument (the timezone) and have all VRPN code call this function
+// rather than gettimeofday().  On non-WINSOCK implementations,
+// we alias vrpn_gettimeofday() right back to gettimeofday(), so
+// that we are calling the system routine.  On Windows, we will
+// be using vrpn_gettimofday().  So far so good, but now user code
+// would like to not have to know the difference under windows, so
+// we have an optional VRPN configuration setting in vrpn_Configure.h
+// that exports vrpn_gettimeofday() as gettimeofday() and also
+// exports a "struct timezone" definition.  Yucky, but it works and
+// lets user code use the VRPN one as if it were the system call
+// on Windows.
+
+#if (!defined(VRPN_USE_WINSOCK_SOCKETS))
+#include <sys/time.h> // for timeval, timezone, gettimeofday
+// If we're using std::chrono, then we implement a new
+// vrpn_gettimeofday() on top of it in a platform-independent
+// manner.  Otherwise, we just use the system call.
+#ifndef VRPN_USE_STD_CHRONO
+  #define vrpn_gettimeofday gettimeofday
+#endif
+#else // winsock sockets
+
+// These are a pair of horrible hacks that instruct Windows include
+// files to (1) not define min() and max() in a way that messes up
+// standard-library calls to them, and (2) avoids pulling in a large
+// number of Windows header files.  They are not used directly within
+// the VRPN library, but rather within the Windows include files to
+// change the way they behave.
+
+#ifndef NOMINMAX
+#define NOMINMAX
+#endif
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#ifndef _WIN32_WCE
+#include <sys/timeb.h>
+#endif
+#ifdef VRPN_USE_WINSOCK2
+#include <winsock2.h> // struct timeval is defined here
+#else
+#include <winsock.h> // struct timeval is defined here
+#endif
+
+// Whether or not we export gettimeofday, we declare the
+// vrpn_gettimeofday() function on Windows.
+extern "C" VRPN_API int vrpn_gettimeofday(struct timeval *tp,
+                                          void *tzp = NULL);
+
+// If compiling under Cygnus Solutions Cygwin then these get defined by
+// including sys/time.h.  So, we will manually define only for _WIN32
+// Only do this if the Configure file has set VRPN_EXPORT_GETTIMEOFDAY,
+// so that application code can get at it.  All VRPN routines should be
+// calling vrpn_gettimeofday() directly.
+
+#if defined(VRPN_EXPORT_GETTIMEOFDAY)
+
+// manually define this too.  _WIN32 sans cygwin doesn't have gettimeofday
+#define gettimeofday vrpn_gettimeofday
+
+#endif
+#endif
+
+//--------------------------------------------------------------
+// vrpn_* timeval utility functions
+
+// IMPORTANT: timevals must be normalized to make any sense
+//
+//  * normalized means abs(tv_usec) is less than 1,000,000
+//
+//  * TimevalSum and TimevalDiff do not do the right thing if
+//    their inputs are not normalized
+//
+//  * TimevalScale now normalizes it's results [9/1999 it didn't before]
+
+// make sure tv_usec is less than 1,000,000
+extern VRPN_API struct timeval vrpn_TimevalNormalize(const struct timeval &tv);
+
+extern VRPN_API struct timeval vrpn_TimevalSum(const struct timeval &tv1,
+                                               const struct timeval &tv2);
+extern VRPN_API struct timeval vrpn_TimevalDiff(const struct timeval &tv1,
+                                                const struct timeval &tv2);
+extern VRPN_API struct timeval vrpn_TimevalScale(const struct timeval &tv,
+                                                 double scale);
+
+/// @brief Return number of microseconds between startT and endT.
+extern VRPN_API unsigned long vrpn_TimevalDuration(struct timeval endT,
+                                                   struct timeval startT);
+
+/// @brief Return the number of seconds between startT and endT as a
+/// floating-point value.
+extern VRPN_API double vrpn_TimevalDurationSeconds(struct timeval endT,
+                                                   struct timeval startT);
+
+extern VRPN_API bool vrpn_TimevalGreater(const struct timeval &tv1,
+                                         const struct timeval &tv2);
+extern VRPN_API bool vrpn_TimevalEqual(const struct timeval &tv1,
+                                       const struct timeval &tv2);
+
+extern VRPN_API double vrpn_TimevalMsecs(const struct timeval &tv1);
+
+extern VRPN_API struct timeval vrpn_MsecsTimeval(const double dMsecs);
+extern VRPN_API void vrpn_SleepMsecs(double dMilliSecs);
+
+//--------------------------------------------------------------
+// vrpn_* buffer util functions and endian-ness related
+// definitions and functions.
+
+// xform a double to/from network order -- like htonl and htons
+extern VRPN_API vrpn_float64 vrpn_htond(vrpn_float64 d);
+extern VRPN_API vrpn_float64 vrpn_ntohd(vrpn_float64 d);
+
+// From this we get the variable "vrpn_big_endian" set to true if the machine we
+// are
+// on is big endian and to false if it is little endian.  This can be used by
+// custom packing and unpacking code to bypass the buffer and unbuffer routines
+// for cases that have to be particularly fast (like video data).  It is also
+// used
+// internally by the vrpn_htond() function.
+
+static const int vrpn_int_data_for_endian_test = 1;
+static const char *vrpn_char_data_for_endian_test =
+    static_cast<const char*>(static_cast<const void *>((&vrpn_int_data_for_endian_test)));
+static const bool vrpn_big_endian = (vrpn_char_data_for_endian_test[0] != 1);
+
+// Read and write strings (not single items).
+extern VRPN_API int vrpn_buffer(char **insertPt, vrpn_int32 *buflen,
+                                const char *string, vrpn_int32 length);
+extern VRPN_API int vrpn_unbuffer(const char **buffer, char *string,
+                                  vrpn_int32 length);
+
+// Read and write timeval.
+extern VRPN_API int vrpn_unbuffer(const char **buffer, timeval *t);
+extern VRPN_API int vrpn_buffer(char **insertPt, vrpn_int32 *buflen,
+                                const timeval t);
+
+// To read and write the atomic types defined in vrpn_Types, you use the
+// templated
+// buffer and unbuffer routines below.  These have the same form as the ones for
+// timeval, but they use types vrpn_int, vrpn_uint, vrpn_int16, vrpn_uint16,
+// vrpn_int32, vrpn_uint32, vrpn_float32, and vrpn_float64.
+
+/**
+    @brief Internal header providing unbuffering facilities for a number of
+   types.
+
+    @date 2011
+
+    @author
+    Ryan Pavlik
+    <rpavlik@iastate.edu> and <abiryan@ryand.net>
+    http://academic.cleardefinition.com/
+    Iowa State University Virtual Reality Applications Center
+    Human-Computer Interaction Graduate Program
+*/
+
+//          Copyright Iowa State University 2011.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+// Tested in the context of vrpn_server and vrpn_print_devices running between
+// an SGI running Irix 6.5 MIPS 32-bit (big endian) and Mac OSX intel 64-bit
+// (little endian) machine with a NULL tracker and it worked using the SGI
+// repaired commits from 3/17/2012.
+
+/// @brief Contains overloaded hton() and ntoh() functions that forward
+/// to their correctly-typed implementations.
+namespace vrpn_byte_order {
+    namespace vrpn_detail {
+        /// Traits class to get the uint type of a given size
+        template <int TypeSize> struct uint_traits;
+
+        template <> struct uint_traits<1> {
+            typedef vrpn_uint8 type;
+        };
+        template <> struct uint_traits<2> {
+            typedef vrpn_uint16 type;
+        };
+        template <> struct uint_traits<4> {
+            typedef vrpn_uint32 type;
+        };
+    } // end of namespace vrpn_detail
+
+    /// host to network byte order for 8-bit uints is a no-op
+    inline vrpn_uint8 hton(vrpn_uint8 hostval) { return hostval; }
+
+    /// network to host byte order for 8-bit uints is a no-op
+    inline vrpn_uint8 ntoh(vrpn_uint8 netval) { return netval; }
+
+    /// host to network byte order for 16-bit uints
+    inline vrpn_uint16 hton(vrpn_uint16 hostval) { return htons(hostval); }
+
+    /// network to host byte order for 16-bit uints
+    inline vrpn_uint16 ntoh(vrpn_uint16 netval) { return ntohs(netval); }
+
+    /// host to network byte order for 32-bit uints
+    inline vrpn_uint32 hton(vrpn_uint32 hostval) { return htonl(hostval); }
+
+    /// network to host byte order for 32-bit uints
+    inline vrpn_uint32 ntoh(vrpn_uint32 netval) { return ntohl(netval); }
+
+    /// host to network byte order for 64-bit floats, using vrpn_htond
+    inline vrpn_float64 hton(vrpn_float64 hostval) { return vrpn_htond(hostval); }
+
+    /// network to host byte order for 64-bit floats, using vrpn_ntohd
+    inline vrpn_float64 ntoh(vrpn_float64 netval) { return vrpn_ntohd(netval); }
+
+    /// Templated hton that type-puns to the same-sized uint type
+    /// as a fallback for those types not explicitly defined above.
+    template <typename T> inline T hton(T input)
+    {
+        union {
+            T asInput;
+            typename vrpn_detail::uint_traits<sizeof(T)>::type asInt;
+        } inVal, outVal;
+        inVal.asInput = input;
+        outVal.asInt = hton(inVal.asInt);
+        return outVal.asInput;
+    }
+
+    /// Templated ntoh that type-puns to the same-sized uint type
+    /// as a fallback for those types not explicitly defined above.
+    template <typename T> inline T ntoh(T input)
+    {
+        union {
+            T asInput;
+            typename vrpn_detail::uint_traits<sizeof(T)>::type asInt;
+        } inVal, outVal;
+        inVal.asInput = input;
+        outVal.asInt = ntoh(inVal.asInt);
+        return outVal.asInput;
+    }
+} // end of namespace vrpn_byte_order
+
+namespace vrpn_detail {
+    template <typename T> struct remove_const {
+        typedef T type;
+    };
+
+    template <typename T> struct remove_const<const T> {
+        typedef T type;
+    };
+
+    template <bool Condition> struct vrpn_static_assert {
+    };
+    /// @brief Each static assertion needs its message in this enum, or it will
+    /// always fail.
+    template <> struct vrpn_static_assert<true> {
+        enum { SIZE_OF_BUFFER_ITEM_IS_NOT_ONE_BYTE };
+    };
+} // end of namespace vrpn_detail
+
+#ifdef VRPN_USE_STATIC_ASSERTIONS
+/// @brief Static assertion macro for limited sets of messages.
+/// Inspired by http://eigen.tuxfamily.org/dox/TopicAssertions.html
+#if defined(__GXX_EXPERIMENTAL_CXX0X__) ||                                     \
+    (defined(_MSC_VER) && (_MSC_VER >= 1600))
+#define VRPN_STATIC_ASSERT(CONDITION, MESSAGE)                                 \
+    static_assert(CONDITION, #MESSAGE)
+#else
+#define VRPN_STATIC_ASSERT(CONDITION, MESSAGE)                                 \
+    (void)(::vrpn_detail::vrpn_static_assert<CONDITION>::MESSAGE)
+#endif
+#else
+/// Fall back to normal asserts.
+#include <assert.h>
+#define VRPN_STATIC_ASSERT(CONDITION, MESSAGE) assert((CONDITION) && #MESSAGE)
+#endif
+
+/// Function template to unbuffer values from a buffer stored in little-
+/// endian byte order. Specify the type to extract T as a template parameter.
+/// The templated buffer type ByteT will be deduced automatically.
+/// The input pointer will be advanced past the unbuffered value.
+template <typename T, typename ByteT>
+static inline T vrpn_unbuffer_from_little_endian(ByteT *&input)
+{
+    using namespace vrpn_byte_order;
+
+    VRPN_STATIC_ASSERT(sizeof(ByteT) == 1, SIZE_OF_BUFFER_ITEM_IS_NOT_ONE_BYTE);
+
+    /// Union to allow type-punning
+    union {
+        typename ::vrpn_detail::remove_const<ByteT>::type bytes[sizeof(T)];
+        T typed;
+    } value;
+
+    /// Swap known little-endian into big-endian (aka network byte order)
+    for (unsigned int i = 0, j = sizeof(T) - 1; i < sizeof(T); ++i, --j) {
+        value.bytes[i] = input[j];
+    }
+
+    /// Advance input pointer
+    input += sizeof(T);
+
+    /// return value in host byte order
+    return ntoh(value.typed);
+}
+
+/// Function template to unbuffer values from a buffer stored in network
+/// byte order. Specify the type to extract T as a template parameter.
+/// The templated buffer type ByteT will be deduced automatically.
+/// The input pointer will be advanced past the unbuffered value.
+template <typename T, typename ByteT> inline T vrpn_unbuffer(ByteT *&input)
+{
+    using namespace vrpn_byte_order;
+
+    VRPN_STATIC_ASSERT(sizeof(ByteT) == 1, SIZE_OF_BUFFER_ITEM_IS_NOT_ONE_BYTE);
+
+    /// Union to allow type-punning and ensure alignment
+    union {
+        typename ::vrpn_detail::remove_const<ByteT>::type bytes[sizeof(T)];
+        T typed;
+    } value;
+
+    /// Copy bytes into union
+    memcpy(value.bytes, input, sizeof(T));
+
+    /// Advance input pointer
+    input += sizeof(T);
+
+    /// return value in host byte order
+    return ntoh(value.typed);
+}
+
+/// Function template to buffer values to a buffer stored in little-
+/// endian order. Specify the type to buffer T as a template parameter.
+/// The templated buffer type ByteT will be deduced automatically.
+/// The input pointer will be advanced past the unbuffered value.
+template <typename T, typename ByteT>
+inline int vrpn_buffer_to_little_endian(ByteT **insertPt, vrpn_int32 *buflen, const T inVal)
+{
+    using namespace vrpn_byte_order;
+
+    VRPN_STATIC_ASSERT(sizeof(ByteT) == 1, SIZE_OF_BUFFER_ITEM_IS_NOT_ONE_BYTE);
+
+    if ((insertPt == NULL) || (buflen == NULL)) {
+        fprintf(stderr, "vrpn_buffer: NULL pointer\n");
+        return -1;
+    }
+
+    if (sizeof(T) > static_cast<size_t>(*buflen)) {
+        fprintf(stderr, "vrpn_buffer: buffer not large enough\n");
+        return -1;
+    }
+
+    /// Union to allow type-punning and ensure alignment
+    union {
+        typename ::vrpn_detail::remove_const<ByteT>::type bytes[sizeof(T)];
+        T typed;
+    } value;
+
+    /// Populate union in network byte order
+    value.typed = hton(inVal);
+
+    /// Swap known big-endian (aka network byte order) into little-endian
+    for (unsigned int i = 0, j = sizeof(T) - 1; i < sizeof(T); ++i, --j) {
+        (*insertPt)[i] = value.bytes[j];
+    }
+
+    /// Advance insert pointer
+    *insertPt += sizeof(T);
+    /// Decrement buffer length
+    *buflen -= sizeof(T);
+
+    return 0;
+}
+
+/// Function template to buffer values to a buffer stored in network
+/// byte order. Specify the type to buffer T as a template parameter.
+/// The templated buffer type ByteT will be deduced automatically.
+/// The input pointer will be advanced past the unbuffered value.
+template <typename T, typename ByteT>
+inline int vrpn_buffer(ByteT **insertPt, vrpn_int32 *buflen, const T inVal)
+{
+    using namespace vrpn_byte_order;
+
+    VRPN_STATIC_ASSERT(sizeof(ByteT) == 1, SIZE_OF_BUFFER_ITEM_IS_NOT_ONE_BYTE);
+
+    if ((insertPt == NULL) || (buflen == NULL)) {
+        fprintf(stderr, "vrpn_buffer: NULL pointer\n");
+        return -1;
+    }
+
+    if (sizeof(T) > static_cast<size_t>(*buflen)) {
+        fprintf(stderr, "vrpn_buffer: buffer not large enough\n");
+        return -1;
+    }
+
+    /// Union to allow type-punning and ensure alignment
+    union {
+        typename ::vrpn_detail::remove_const<ByteT>::type bytes[sizeof(T)];
+        T typed;
+    } value;
+
+    /// Populate union in network byte order
+    value.typed = hton(inVal);
+
+    /// Copy bytes into buffer
+    memcpy(*insertPt, value.bytes, sizeof(T));
+
+    /// Advance insert pointer
+    *insertPt += sizeof(T);
+    /// Decrement buffer length
+    *buflen -= sizeof(T);
+
+    return 0;
+}
+
+template <typename T, typename ByteT>
+inline int vrpn_unbuffer(ByteT **input, T *lvalue)
+{
+    *lvalue = ::vrpn_unbuffer<T, ByteT>(*input);
+    return 0;
+}
+
+// Returns true if tests work and false if they do not.
+extern bool vrpn_test_pack_unpack(void);
+
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_SharedObject.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_SharedObject.h
new file mode 100644
index 0000000000000000000000000000000000000000..6dfa452d4411a4d1cc73be79ec9f82122a14b12f
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_SharedObject.h
@@ -0,0 +1,572 @@
+#ifndef VRPN_SHARED_OBJECT
+#define VRPN_SHARED_OBJECT
+
+#include <stddef.h> // for NULL
+
+#include "vrpn_Configure.h" // for VRPN_CALLBACK, VRPN_API
+// This *must* be here to take care of winsock2.h and sys/time.h and other
+// assorted system-dependent details.
+#include "vrpn_Shared.h" // for timeval
+#include "vrpn_Types.h"  // for vrpn_int32, vrpn_bool, etc
+
+class VRPN_API vrpn_Connection;
+struct timeval;
+struct vrpn_HANDLERPARAM;
+
+class VRPN_API vrpn_LamportClock; // from "vrpn_LamportClock.h"
+class VRPN_API vrpn_LamportTimestamp;
+
+// It's increasingly clear that we could handle all this with
+// a template, except for the fact that vrpn_Shared_String is
+// based on char *.  All we need is a String base class.
+// We could try to adopt BCString from nano's libnmb...
+
+// I'd like to implement shouldAcceptUpdate/shouldSendUpdate
+// with the Strategy pattern (Gamma/Helm/Johnson/Vlissides 1995, pg 315).
+// That would make it far, far easier to extend, but the implementation
+// looks too unweildy.
+
+class VRPN_API vrpn_Shared_String;
+class VRPN_API vrpn_Shared_float64;
+class VRPN_API vrpn_Shared_int32;
+
+typedef int(VRPN_CALLBACK *vrpnDeferredUpdateCallback)(void *userdata);
+
+typedef int(VRPN_CALLBACK *vrpnSharedIntCallback)(void *userdata,
+                                                  vrpn_int32 newValue,
+                                                  vrpn_bool isLocal);
+typedef int(VRPN_CALLBACK *vrpnSharedFloatCallback)(void *userdata,
+                                                    vrpn_float64 newValue,
+                                                    vrpn_bool isLocal);
+typedef int(VRPN_CALLBACK *vrpnSharedStringCallback)(void *userdata,
+                                                     const char *newValue,
+                                                     vrpn_bool isLocal);
+
+typedef int(VRPN_CALLBACK *vrpnTimedSharedIntCallback)(void *userdata,
+                                                       vrpn_int32 newValue,
+                                                       timeval when,
+                                                       vrpn_bool isLocal);
+typedef int(VRPN_CALLBACK *vrpnTimedSharedFloatCallback)(void *userdata,
+                                                         vrpn_float64 newValue,
+                                                         timeval when,
+                                                         vrpn_bool isLocal);
+typedef int(VRPN_CALLBACK *vrpnTimedSharedStringCallback)(void *userdata,
+                                                          const char *newValue,
+                                                          timeval when,
+                                                          vrpn_bool isLocal);
+
+// Update callbacks should return 0 on successful completion,
+// nonzero on error (which will prevent further update callbacks
+// from being invoked).
+
+typedef int(VRPN_CALLBACK *vrpnSharedIntSerializerPolicy)(
+    void *userdata, vrpn_int32 newValue, timeval when,
+    vrpn_Shared_int32 *object);
+typedef int(VRPN_CALLBACK *vrpnSharedFloatSerializerPolicy)(
+    void *userdata, vrpn_float64 newValue, timeval when,
+    vrpn_Shared_float64 *object);
+typedef int(VRPN_CALLBACK *vrpnSharedStringSerializerPolicy)(
+    void *userdata, const char *newValue, timeval when,
+    vrpn_Shared_String *object);
+
+// Policy callbacks should return 0 if the update should be accepted,
+// nonzero if it should be denied.
+
+#define VRPN_SO_DEFAULT 0x00
+#define VRPN_SO_IGNORE_IDEMPOTENT 0x01
+#define VRPN_SO_DEFER_UPDATES 0x10
+#define VRPN_SO_IGNORE_OLD 0x100
+
+// Each of these flags can be passed to all vrpn_Shared_* constructors.
+// If VRPN_SO_IGNORE_IDEMPOTENT is used, calls of operator = (v) or set(v)
+// are *ignored* if v == d_value.  No callbacks are called, no network
+// traffic takes place.
+// If VRPN_SO_DEFER_UPDATES is used, calls of operator = (v) or set(v)
+// on vrpn_Shared_*_Remote are sent to the server but not reflected
+// locally until an update message is received from the server.
+// If VRPN_SO_IGNORE_OLD is set, calls of set(v, t) are ignored if
+// t < d_lastUpdate.  This includes messages propagated over the network.
+
+// A vrpn_Shared_*_Server/Remote pair using VRPN_SO_IGNORE_OLD are
+// guaranteed to reach the same final state - after quiescence (all messages
+// sent on the network are delivered) they will yield the same value(),
+// but they are *not* guaranteed to go through the same sequence of
+// callbacks.
+
+// Using VRPN_SO_DEFER_UPDATES serializes all changes to d_value and
+// all callbacks, so it guarantees that all instances of the shared
+// variable see the same sequence of callbacks.
+
+// setSerializerPolicy() can be used to change the way VRPN_SO_DEFER_UPDATES
+// operates.  The default value described above is equivalent to calling
+// setSerializerPolicy(vrpn_ACCEPT).  Also possible are vrpn_DENY_REMOTE,
+// which causes the serializer to ignore all updates from its peers,
+// vrpn_DENY_LOCAL, which accepts updates from peers but ignores local
+// updates,
+// and vrpn_CALLBACK, which passes the update to a callback which can
+// return zero for vrpn_ACCEPT or nonzero for vrpn_DENY.
+
+enum vrpn_SerializerPolicy {
+    vrpn_ACCEPT,
+    vrpn_DENY_REMOTE,
+    vrpn_DENY_LOCAL,
+    vrpn_CALLBACK
+};
+
+// Separated out vrpn_SharedObject from common behavior of 3 classes
+// on 14 Feb 2000.  Now all we need is permission to use templates to
+// collapse them all together;  *all* the functions remaining on the
+// other classes are type-dependent and should be templatable.
+// (One exception:  the string that names the type.  This could probably
+// be cut.)
+
+class VRPN_API vrpn_SharedObject {
+
+public:
+    vrpn_SharedObject(const char *name, const char *tname, vrpn_int32 mode);
+    virtual ~vrpn_SharedObject(void);
+
+    // ACCESSORS
+
+    const char *name(void) const;
+    vrpn_bool isSerializer(void) const;
+
+    // MANIPULATORS
+
+    virtual void bindConnection(vrpn_Connection *);
+    ///< Every derived class should call this, do what it needs to,
+    ///< and ALSO call {server,remote}PostBindCleanup() to get
+    ///< myId and peerId set up and to get standard handlers registered.
+
+    void useLamportClock(vrpn_LamportClock *);
+    ///< Lamport Clocks are NOT currently integrated.  They should
+    ///< provide serialization (virtual timestamps) that work even
+    ///< when the clocks of the computers communicating are not
+    ///< roughly synchronized.
+
+    void becomeSerializer(void);
+    ///< Requests that this instance of the shared object becomes
+    ///< the serializer (i.e. lock-arbitrator), and we can then use
+    ///< setSerializerPolicy to imitate a complete lock.  Does nothing
+    ///< if we already are the serializer (isSerializer() returns true);
+    ///< otherwise initiates a 3-phase request protocol with the
+    ///< current serializer.  There currently isn't any provision for
+    ///< notification of success (or failure).
+
+    void registerDeferredUpdateCallback(vrpnDeferredUpdateCallback,
+                                        void *userdata);
+    ///< The specified function will be passed userdata when this
+    ///< particular shared object defers an update (receives a local
+    ///< update but is not the serializer and so sends the update off
+    ///< to the serializer).  Intended to allow insertion of timing
+    ///< code for those times when you really want to know how long
+    ///< every little thing is taking.
+
+protected:
+    char *d_name;
+    vrpn_int32 d_mode;
+    timeval d_lastUpdate;
+    char *d_typename; // currently int32, float64, or String
+
+    vrpn_Connection *d_connection;
+    // vrpn_int32 d_updateFromServer_type;
+    // vrpn_int32 d_updateFromRemote_type;
+    // vrpn_int32 d_myUpdate_type;  // fragile
+    vrpn_int32 d_serverId;
+    vrpn_int32 d_remoteId;
+    vrpn_int32 d_myId;   // fragile
+    vrpn_int32 d_peerId; // fragile
+    vrpn_int32 d_update_type;
+
+    vrpn_int32 d_requestSerializer_type;
+    ///< Sent to the serializer to assume its duties.
+    vrpn_int32 d_grantSerializer_type;
+    ///< Sent by the serializer to grant a request.
+    vrpn_int32 d_assumeSerializer_type;
+    ///< Sent by a new serializer once it has been notified that
+    ///< its request has been granted.
+
+    // vrpn_int32 d_updateFromServerLamport_type;
+    // vrpn_int32 d_updateFromRemoteLamport_type;
+    vrpn_int32 d_lamportUpdate_type;
+
+    vrpn_bool d_isSerializer;
+    ///< default to vrpn_TRUE for servers, FALSE for remotes
+    vrpn_bool d_isNegotiatingSerializer;
+    ///< As long as we have inorder delivery, this should be
+    ///< sufficient to keep us from getting many at once.
+
+    virtual vrpn_bool shouldSendUpdate(vrpn_bool isLocalSet,
+                                       vrpn_bool acceptedUpdate);
+
+    int yankCallbacks(vrpn_bool isLocal);
+    ///< must set d_lastUpdate BEFORE calling yankCallbacks()
+
+    static int VRPN_CALLBACK
+    handle_requestSerializer(void *, vrpn_HANDLERPARAM);
+    static int VRPN_CALLBACK handle_grantSerializer(void *, vrpn_HANDLERPARAM);
+    static int VRPN_CALLBACK handle_assumeSerializer(void *, vrpn_HANDLERPARAM);
+
+    vrpn_bool d_queueSets;
+    ///< If this is true, no set()s are processed;  instead, they
+    ///< are queued for later execution.
+    ///< NOT IMPLEMENTED
+
+    vrpn_LamportClock *d_lClock;
+    vrpn_LamportTimestamp *d_lastLamportUpdate;
+
+    struct deferredUpdateCallbackEntry {
+        vrpnDeferredUpdateCallback handler;
+        void *userdata;
+        deferredUpdateCallbackEntry *next;
+    };
+    deferredUpdateCallbackEntry *d_deferredUpdateCallbacks;
+
+    int yankDeferredUpdateCallbacks(void);
+    ///< returns -1 on error (i.e. nonzero return by a callback)
+
+    void serverPostBindCleanup(void);
+    void remotePostBindCleanup(void);
+
+    virtual void sendUpdate(void) = 0;
+    ///< Should invoke default sendUpdate() for this derived type.
+    virtual int handleUpdate(vrpn_HANDLERPARAM) = 0;
+
+    static int VRPN_CALLBACK handle_gotConnection(void *, vrpn_HANDLERPARAM);
+    ///< Register this handler in postBindCleanup();
+    ///< it calls sendUpdate() to make sure the remote has the
+    ///< correct value on first connection.
+    static int VRPN_CALLBACK handle_update(void *, vrpn_HANDLERPARAM);
+    ///< Passes arguments to handleUpdate() for this type;
+    ///< registered in postBindCleanup();
+
+private:
+    void postBindCleanup(void);
+};
+
+class VRPN_API vrpn_Shared_int32 : public vrpn_SharedObject {
+
+public:
+    vrpn_Shared_int32(const char *name, vrpn_int32 defaultValue = 0,
+                      vrpn_int32 mode = VRPN_SO_DEFAULT);
+    virtual ~vrpn_Shared_int32(void);
+
+    // ACCESSORS
+
+    vrpn_int32 value(void) const;
+    operator vrpn_int32() const;
+
+    // MANIPULATORS
+
+    vrpn_Shared_int32 &operator=(vrpn_int32 newValue);
+    // calls set(newValue, now);
+
+    vrpn_Shared_int32 &set(vrpn_int32 newValue, timeval when);
+    // calls protected set (newValue, when, vrpn_TRUE);
+
+    void register_handler(vrpnSharedIntCallback, void *);
+    void unregister_handler(vrpnSharedIntCallback, void *);
+    void register_handler(vrpnTimedSharedIntCallback, void *);
+    void unregister_handler(vrpnTimedSharedIntCallback, void *);
+    // Callbacks are (currently) called *AFTER* the assignment
+    // has been made, so any check of the value of their shared int
+    // will return newValue
+
+    void setSerializerPolicy(vrpn_SerializerPolicy policy = vrpn_ACCEPT,
+                             vrpnSharedIntSerializerPolicy f = NULL,
+                             void *userdata = NULL);
+
+protected:
+    vrpn_int32 d_value;
+
+    // callback code
+    // Could generalize this by making a class that gets passed
+    // a vrpn_HANDLERPARAM and passes whatever is needed to its callback,
+    // but it's not worth doing that unless we need a third or fourth
+    // kind of callback.
+    struct callbackEntry {
+        vrpnSharedIntCallback handler;
+        void *userdata;
+        callbackEntry *next;
+    };
+    callbackEntry *d_callbacks;
+    struct timedCallbackEntry {
+        vrpnTimedSharedIntCallback handler;
+        void *userdata;
+        timedCallbackEntry *next;
+    };
+    timedCallbackEntry *d_timedCallbacks;
+
+    vrpn_Shared_int32 &set(vrpn_int32, timeval, vrpn_bool isLocalSet,
+                           vrpn_LamportTimestamp * = NULL);
+
+    virtual vrpn_bool shouldAcceptUpdate(vrpn_int32 newValue, timeval when,
+                                         vrpn_bool isLocalSet,
+                                         vrpn_LamportTimestamp *);
+
+    virtual void sendUpdate(void);
+    void sendUpdate(vrpn_int32 newValue, timeval when);
+
+    void encode(char **buffer, vrpn_int32 *len, vrpn_int32 newValue,
+                timeval when) const;
+    void encodeLamport(char **buffer, vrpn_int32 *len, vrpn_int32 newValue,
+                       timeval when, vrpn_LamportTimestamp *t) const;
+    // We used to have sendUpdate() and encode() just read off of
+    // d_value and d_lastUpdate, but that doesn't work when we're
+    // serializing (VRPN_SO_DEFER_UPDATES), because we don't want
+    // to change the local values but do want to send the new values
+    // to the serializer.
+    void decode(const char **buffer, vrpn_int32 *len, vrpn_int32 *newValue,
+                timeval *when) const;
+    void decodeLamport(const char **buffer, vrpn_int32 *len,
+                       vrpn_int32 *newValue, timeval *when,
+                       vrpn_LamportTimestamp **t) const;
+
+    int yankCallbacks(vrpn_bool isLocal);
+    // must set d_lastUpdate BEFORE calling yankCallbacks()
+
+    // serializer policy code
+    vrpn_SerializerPolicy d_policy; // default to vrpn_ACCEPT
+    vrpnSharedIntSerializerPolicy d_policyCallback;
+    void *d_policyUserdata;
+
+    int handleUpdate(vrpn_HANDLERPARAM);
+
+    static int VRPN_CALLBACK handle_lamportUpdate(void *, vrpn_HANDLERPARAM);
+};
+
+// I don't think the derived classes should have to have operator = ()
+// defined (they didn't in the last version??), but both SGI and HP
+// compilers seem to insist on it.
+
+class VRPN_API vrpn_Shared_int32_Server : public vrpn_Shared_int32 {
+
+public:
+    vrpn_Shared_int32_Server(const char *name, vrpn_int32 defaultValue = 0,
+                             vrpn_int32 defaultMode = VRPN_SO_DEFAULT);
+    virtual ~vrpn_Shared_int32_Server(void);
+
+    vrpn_Shared_int32_Server &operator=(vrpn_int32 newValue);
+
+    virtual void bindConnection(vrpn_Connection *);
+
+protected:
+};
+
+class VRPN_API vrpn_Shared_int32_Remote : public vrpn_Shared_int32 {
+
+public:
+    vrpn_Shared_int32_Remote(const char *name, vrpn_int32 defaultValue = 0,
+                             vrpn_int32 defaultMode = VRPN_SO_DEFAULT);
+    virtual ~vrpn_Shared_int32_Remote(void);
+
+    vrpn_Shared_int32_Remote &operator=(vrpn_int32 newValue);
+
+    virtual void bindConnection(vrpn_Connection *);
+};
+
+class VRPN_API vrpn_Shared_float64 : public vrpn_SharedObject {
+
+public:
+    vrpn_Shared_float64(const char *name, vrpn_float64 defaultValue = 0.0,
+                        vrpn_int32 mode = VRPN_SO_DEFAULT);
+    virtual ~vrpn_Shared_float64(void);
+
+    // ACCESSORS
+
+    vrpn_float64 value(void) const;
+    operator vrpn_float64() const;
+
+    // MANIPULATORS
+
+    vrpn_Shared_float64 &operator=(vrpn_float64 newValue);
+    // calls set(newValue, now);
+
+    virtual vrpn_Shared_float64 &set(vrpn_float64 newValue, timeval when);
+    // calls protected set (newValue, when, vrpn_TRUE);
+
+    void register_handler(vrpnSharedFloatCallback, void *);
+    void unregister_handler(vrpnSharedFloatCallback, void *);
+    void register_handler(vrpnTimedSharedFloatCallback, void *);
+    void unregister_handler(vrpnTimedSharedFloatCallback, void *);
+    // Callbacks are (currently) called *AFTER* the assignment
+    // has been made, so any check of the value of their shared int
+    // will return newValue
+
+    void setSerializerPolicy(vrpn_SerializerPolicy policy = vrpn_ACCEPT,
+                             vrpnSharedFloatSerializerPolicy f = NULL,
+                             void *userdata = NULL);
+
+protected:
+    vrpn_float64 d_value;
+
+    // callback code
+    // Could generalize this by making a class that gets passed
+    // a vrpn_HANDLERPARAM and passes whatever is needed to its callback,
+    // but it's not worth doing that unless we need a third or fourth
+    // kind of callback.
+    struct callbackEntry {
+        vrpnSharedFloatCallback handler;
+        void *userdata;
+        callbackEntry *next;
+    };
+    callbackEntry *d_callbacks;
+    struct timedCallbackEntry {
+        vrpnTimedSharedFloatCallback handler;
+        void *userdata;
+        timedCallbackEntry *next;
+    };
+    timedCallbackEntry *d_timedCallbacks;
+
+    vrpn_SerializerPolicy d_policy; // default to vrpn_ACCEPT
+    vrpnSharedFloatSerializerPolicy d_policyCallback;
+    void *d_policyUserdata;
+
+    vrpn_Shared_float64 &set(vrpn_float64, timeval, vrpn_bool isLocalSet);
+
+    virtual vrpn_bool shouldAcceptUpdate(vrpn_float64 newValue, timeval when,
+                                         vrpn_bool isLocalSet);
+
+    virtual void sendUpdate(void);
+    void sendUpdate(vrpn_float64 newValue, timeval when);
+    void encode(char **buffer, vrpn_int32 *len, vrpn_float64 newValue,
+                timeval when) const;
+    void decode(const char **buffer, vrpn_int32 *len, vrpn_float64 *newValue,
+                timeval *when) const;
+
+    int yankCallbacks(vrpn_bool isLocal);
+    // must set d_lastUpdate BEFORE calling yankCallbacks()
+
+    int handleUpdate(vrpn_HANDLERPARAM);
+    static int VRPN_CALLBACK handle_lamportUpdate(void *, vrpn_HANDLERPARAM);
+};
+
+class VRPN_API vrpn_Shared_float64_Server : public vrpn_Shared_float64 {
+
+public:
+    vrpn_Shared_float64_Server(const char *name, vrpn_float64 defaultValue = 0,
+                               vrpn_int32 defaultMode = VRPN_SO_DEFAULT);
+    virtual ~vrpn_Shared_float64_Server(void);
+
+    vrpn_Shared_float64_Server &operator=(vrpn_float64 newValue);
+
+    virtual void bindConnection(vrpn_Connection *);
+
+protected:
+};
+
+class VRPN_API vrpn_Shared_float64_Remote : public vrpn_Shared_float64 {
+
+public:
+    vrpn_Shared_float64_Remote(const char *name, vrpn_float64 defaultValue = 0,
+                               vrpn_int32 defaultMode = VRPN_SO_DEFAULT);
+    virtual ~vrpn_Shared_float64_Remote(void);
+
+    vrpn_Shared_float64_Remote &operator=(vrpn_float64 newValue);
+
+    virtual void bindConnection(vrpn_Connection *);
+};
+
+class VRPN_API vrpn_Shared_String : public vrpn_SharedObject {
+
+public:
+    vrpn_Shared_String(const char *name, const char *defaultValue = NULL,
+                       vrpn_int32 mode = VRPN_SO_DEFAULT);
+    virtual ~vrpn_Shared_String(void);
+
+    // ACCESSORS
+
+    const char *value(void) const;
+    operator const char *() const;
+
+    // MANIPULATORS
+
+    vrpn_Shared_String &operator=(const char *newValue);
+    // calls set(newValue, now);
+
+    virtual vrpn_Shared_String &set(const char *newValue, timeval when);
+    // calls protected set (newValue, when, vrpn_TRUE);
+
+    void register_handler(vrpnSharedStringCallback, void *);
+    void unregister_handler(vrpnSharedStringCallback, void *);
+    void register_handler(vrpnTimedSharedStringCallback, void *);
+    void unregister_handler(vrpnTimedSharedStringCallback, void *);
+    // Callbacks are (currently) called *AFTER* the assignment
+    // has been made, so any check of the value of their shared int
+    // will return newValue
+
+    void setSerializerPolicy(vrpn_SerializerPolicy policy = vrpn_ACCEPT,
+                             vrpnSharedStringSerializerPolicy f = NULL,
+                             void *userdata = NULL);
+
+protected:
+    char *d_value;
+
+    // callback code
+    // Could generalize this by making a class that gets passed
+    // a vrpn_HANDLERPARAM and passes whatever is needed to its callback,
+    // but it's not worth doing that unless we need a third or fourth
+    // kind of callback.
+    struct callbackEntry {
+        vrpnSharedStringCallback handler;
+        void *userdata;
+        callbackEntry *next;
+    };
+    callbackEntry *d_callbacks;
+    struct timedCallbackEntry {
+        vrpnTimedSharedStringCallback handler;
+        void *userdata;
+        timedCallbackEntry *next;
+    };
+    timedCallbackEntry *d_timedCallbacks;
+
+    vrpn_SerializerPolicy d_policy; // default to vrpn_ACCEPT
+    vrpnSharedStringSerializerPolicy d_policyCallback;
+    void *d_policyUserdata;
+
+    vrpn_Shared_String &set(const char *, timeval, vrpn_bool isLocalSet);
+
+    virtual vrpn_bool shouldAcceptUpdate(const char *newValue, timeval when,
+                                         vrpn_bool isLocalSet);
+
+    virtual void sendUpdate(void);
+    void sendUpdate(const char *newValue, timeval when);
+    void encode(char **buffer, vrpn_int32 *len, const char *newValue,
+                timeval when) const;
+    void decode(const char **buffer, vrpn_int32 *len, char *newValue,
+                timeval *when) const;
+
+    int yankCallbacks(vrpn_bool isLocal);
+    // must set d_lastUpdate BEFORE calling yankCallbacks()
+
+    int handleUpdate(vrpn_HANDLERPARAM);
+    static int VRPN_CALLBACK handle_lamportUpdate(void *, vrpn_HANDLERPARAM);
+};
+
+class VRPN_API vrpn_Shared_String_Server : public vrpn_Shared_String {
+
+public:
+    vrpn_Shared_String_Server(const char *name, const char *defaultValue = NULL,
+                              vrpn_int32 defaultMode = VRPN_SO_DEFAULT);
+    virtual ~vrpn_Shared_String_Server(void);
+
+    vrpn_Shared_String_Server &operator=(const char *);
+
+    virtual void bindConnection(vrpn_Connection *);
+
+protected:
+};
+
+class VRPN_API vrpn_Shared_String_Remote : public vrpn_Shared_String {
+
+public:
+    vrpn_Shared_String_Remote(const char *name, const char *defaultValue = NULL,
+                              vrpn_int32 defaultMode = VRPN_SO_DEFAULT);
+    virtual ~vrpn_Shared_String_Remote(void);
+
+    vrpn_Shared_String_Remote &operator=(const char *);
+
+    virtual void bindConnection(vrpn_Connection *);
+};
+
+#endif // VRPN_SHARED_OBJECT
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_Sound.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_Sound.h
new file mode 100644
index 0000000000000000000000000000000000000000..a06ebdc989d4d7b3ada81db553e18465dd693332
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_Sound.h
@@ -0,0 +1,443 @@
+// vrpn_Sound.h
+//
+// April 12 2000 - ZK
+
+#ifndef VRPN_SOUND_H
+
+#include "vrpn_BaseClass.h" // for vrpn_BaseClass
+#include "vrpn_Configure.h" // for VRPN_CALLBACK, VRPN_API
+#include "vrpn_Shared.h"    // for timeval
+#include "vrpn_Text.h"      // for vrpn_TEXTCB, etc
+#include "vrpn_Types.h"     // for vrpn_int32, vrpn_float64, etc
+
+class VRPN_API vrpn_Connection;
+struct vrpn_HANDLERPARAM;
+
+#define MAX_MATERIAL_NAME_LENGTH 128
+#define MAX_NUMBER_SOUNDS 1024
+#define MAX_NUMBER_MATERIALS 64
+#define MAX_NUMBER_POLYGONS 2048
+#define MAX_FILENAME_LENGTH 2048
+
+// everything is on order found in these structs!
+
+typedef vrpn_int32 vrpn_SoundID;
+
+typedef struct _vrpn_PoseDef {
+    vrpn_float64 position[3];
+    vrpn_float64 orientation[4];
+    _vrpn_PoseDef()
+    {
+        position[0] = position[1] = position[2] = 0.0;
+        orientation[0] = orientation[1] = orientation[2] = 0.0;
+        orientation[3] = 1.0;
+    };
+} vrpn_PoseDef;
+
+typedef struct _vrpn_SoundDef {
+    vrpn_PoseDef pose;
+    vrpn_float64 velocity[4];
+    vrpn_float64 max_front_dist;
+    vrpn_float64 min_front_dist;
+    vrpn_float64 max_back_dist;
+    vrpn_float64 min_back_dist;
+    vrpn_float64 cone_inner_angle;
+    vrpn_float64 cone_outer_angle;
+    vrpn_float64 cone_gain;
+    vrpn_float64 dopler_scale;
+    vrpn_float64 equalization_val;
+    vrpn_float64 pitch;
+    vrpn_float32 volume; // Jason Clark calls this volume, but really it is gain!
+    _vrpn_SoundDef()
+        : max_front_dist(0)
+        , min_front_dist(0)
+        , max_back_dist(0)
+        , min_back_dist(0)
+        , cone_inner_angle(0)
+        , cone_outer_angle(0)
+        , cone_gain(0)
+        , dopler_scale(0)
+        , equalization_val(0)
+        , pitch(0)
+        , volume(0)
+    { velocity[0] = velocity[1] = velocity[2] = velocity[3] = 0.0; };
+
+} vrpn_SoundDef;
+
+typedef struct _vrpn_ListenerDef {
+    vrpn_PoseDef pose;
+    vrpn_float64 velocity[4];
+} vrpn_ListenerDef;
+
+typedef struct _vrpn_MaterialDef {
+    char material_name[MAX_MATERIAL_NAME_LENGTH];
+    vrpn_float64 transmittance_gain;
+    vrpn_float64 transmittance_highfreq;
+    vrpn_float64 reflectance_gain;
+    vrpn_float64 reflectance_highfreq;
+} vrpn_MaterialDef;
+
+typedef struct _vrpn_QuadDef {
+    vrpn_int32 subQuad; // really a bool
+    vrpn_float64 openingFactor;
+    vrpn_int32 tag;
+    vrpn_float64 vertices[4][3];
+    char material_name[MAX_MATERIAL_NAME_LENGTH];
+} vrpn_QuadDef;
+
+typedef struct _vrpn_TriDef {
+    vrpn_int32 subTri;
+    vrpn_float64 openingFactor;
+    vrpn_int32 tag;
+    vrpn_float64 vertices[3][3];
+    char material_name[MAX_MATERIAL_NAME_LENGTH];
+} vrpn_TriDef;
+
+class VRPN_API vrpn_Sound : public vrpn_BaseClass {
+
+public:
+    vrpn_Sound(const char *name, vrpn_Connection *c);
+    ~vrpn_Sound();
+
+protected:
+    vrpn_int32
+        load_sound_local; // ID of message to load a sound from server side
+    vrpn_int32
+        load_sound_remote;   // ID of message to load a sound from client side
+    vrpn_int32 unload_sound; // ID of message to unload a sound
+    vrpn_int32 play_sound;   // ID of message to play a sound
+    vrpn_int32 stop_sound;   // ID of message to stop a sound
+    vrpn_int32
+        change_sound_status; // ID of message to change the sound's status
+    vrpn_int32
+        set_listener_pose; // ID of message to set the listener's pos/orient
+    vrpn_int32
+        set_listener_velocity; // ID of message to set the listener's velocity
+    vrpn_int32 set_sound_pose; //
+    vrpn_int32 set_sound_velocity;     //
+    vrpn_int32 set_sound_distanceinfo; //
+    vrpn_int32 set_sound_coneinfo;     //
+    vrpn_int32 set_sound_doplerfactor; //
+    vrpn_int32 set_sound_eqvalue;      //
+    vrpn_int32 set_sound_pitch;
+    vrpn_int32 set_sound_volume; //
+
+    vrpn_int32 load_model_local;  // load model file from server side
+    vrpn_int32 load_model_remote; // load model file from client side
+    vrpn_int32 load_polyquad;     // ID of message to load a quad polygon
+    vrpn_int32 load_polytri;      // ID of message to load a tri polygon
+    vrpn_int32 load_material;     // ID of message to load a material definition
+    vrpn_int32 set_polyquad_vertices;
+    vrpn_int32 set_polytri_vertices;
+    vrpn_int32 set_poly_openingfactor;
+    vrpn_int32 set_poly_material;
+
+    vrpn_int32 receive_text_message;
+
+    struct timeval timestamp; // Current timestamp
+
+    int register_types(void);
+
+    /*All encodes and decodes functions are for the purpose of setting up
+      messages to be sent over the network properly (ie to put them in one
+      char buffer and to put them in proper network order and for getting
+      the messages back into a usable format once they have been received*/
+
+    /*Note encodeSound allocates space dynamically for buf, it is your
+      responsibility to free it up*/
+    vrpn_int32 encodeSound_local(const char *filename, const vrpn_SoundID id,
+                                 const vrpn_SoundDef soundDef, char **buf);
+    /*Note decodeSound allocates space dynamically for filename, it is your
+      responsibility to free it up*/
+    vrpn_int32 decodeSound_local(const char *buf, char **filename,
+                                 vrpn_SoundID *id, vrpn_SoundDef *soundDef,
+                                 const int payload);
+
+    // These two are not supported yet!
+    vrpn_int32 encodeSound_remote(const char *filename, const vrpn_SoundID id,
+                                  char **buf);
+    vrpn_int32 decodeSound_remote(const char *buf, char **filename,
+                                  vrpn_SoundID *id, const int payload);
+
+    vrpn_int32 encodeSoundID(const vrpn_SoundID id, char *buf);
+    vrpn_int32 decodeSoundID(const char *buf, vrpn_SoundID *id);
+    vrpn_int32 encodeSoundDef(const vrpn_SoundDef sound, const vrpn_SoundID id,
+                              const vrpn_int32 repeat, char *buf);
+    vrpn_int32 decodeSoundDef(const char *buf, vrpn_SoundDef *sound,
+                              vrpn_SoundID *id, vrpn_int32 *repeat);
+    vrpn_int32 encodeSoundPlay(const vrpn_SoundID id, const vrpn_int32 repeat,
+                               char *buf);
+    vrpn_int32 decodeSoundPlay(const char *buf, vrpn_SoundID *id,
+                               vrpn_int32 *repeat);
+    vrpn_int32 encodeListenerVelocity(const vrpn_float64 *velocity, char *buf);
+    vrpn_int32 decodeListenerVelocity(const char *buf, vrpn_float64 *velocity);
+    vrpn_int32 encodeListenerPose(const vrpn_PoseDef pose, char *buf);
+    vrpn_int32 decodeListenerPose(const char *buf, vrpn_PoseDef *pose);
+
+    vrpn_int32 encodeSoundPose(const vrpn_PoseDef pose, const vrpn_SoundID id,
+                               char *buf);
+    vrpn_int32 decodeSoundPose(const char *buf, vrpn_PoseDef *pose,
+                               vrpn_SoundID *id);
+    vrpn_int32 encodeSoundVelocity(const vrpn_float64 *velocity,
+                                   const vrpn_SoundID id, char *buf);
+    vrpn_int32 decodeSoundVelocity(const char *buf, vrpn_float64 *velocity,
+                                   vrpn_SoundID *id);
+    vrpn_int32 encodeSoundDistInfo(const vrpn_float64 min_back,
+                                   const vrpn_float64 max_back,
+                                   const vrpn_float64 min_front,
+                                   const vrpn_float64 max_front,
+                                   const vrpn_SoundID id, char *buf);
+    vrpn_int32 decodeSoundDistInfo(const char *buf, vrpn_float64 *min_back,
+                                   vrpn_float64 *max_back,
+                                   vrpn_float64 *min_front,
+                                   vrpn_float64 *max_front, vrpn_SoundID *id);
+    vrpn_int32 encodeSoundConeInfo(const vrpn_float64 cone_inner_angle,
+                                   const vrpn_float64 cone_outer_angle,
+                                   const vrpn_float64 cone_gain,
+                                   const vrpn_SoundID id, char *buf);
+    vrpn_int32 decodeSoundConeInfo(const char *buf,
+                                   vrpn_float64 *cone_inner_angle,
+                                   vrpn_float64 *cone_outer_angle,
+                                   vrpn_float64 *cone_gain, vrpn_SoundID *id);
+    vrpn_int32 encodeSoundDoplerScale(const vrpn_float64 doplerfactor,
+                                      const vrpn_SoundID id, char *buf);
+    vrpn_int32 decodeSoundDoplerScale(const char *buf,
+                                      vrpn_float64 *doplerfactor,
+                                      vrpn_SoundID *id);
+    vrpn_int32 encodeSoundEqFactor(const vrpn_float64 eqfactor,
+                                   const vrpn_SoundID id, char *buf);
+    vrpn_int32 decodeSoundEqFactor(const char *buf, vrpn_float64 *eqfactor,
+                                   vrpn_SoundID *id);
+    vrpn_int32 encodeSoundPitch(const vrpn_float64 pitch, const vrpn_SoundID id,
+                                char *buf);
+    vrpn_int32 decodeSoundPitch(const char *buf, vrpn_float64 *pitch,
+                                vrpn_SoundID *id);
+    vrpn_int32 encodeSoundVolume(const vrpn_float64 volume,
+                                 const vrpn_SoundID id, char *buf);
+    vrpn_int32 decodeSoundVolume(const char *buf, vrpn_float64 *volume,
+                                 vrpn_SoundID *id);
+
+    vrpn_int32 encodeLoadModel_local(const char *filename, char **buf);
+    vrpn_int32 decodeLoadModel_local(const char *buf, char **filename,
+                                     const int payload);
+
+    // Remote stuff not supported yet!
+    vrpn_int32 encodeLoadModel_remote(const char *filename, char **buf);
+    vrpn_int32 decodeLoadModel_remote(const char *buf, char **filename,
+                                      const int payload);
+
+    vrpn_int32 encodeLoadPolyQuad(const vrpn_QuadDef quad, char *buf);
+    vrpn_int32 decodeLoadPolyQuad(const char *buf, vrpn_QuadDef *quad);
+    vrpn_int32 encodeLoadPolyTri(const vrpn_TriDef tri, char *buf);
+    vrpn_int32 decodeLoadPolyTri(const char *buf, vrpn_TriDef *tri);
+    vrpn_int32 encodeLoadMaterial(const vrpn_int32 id,
+                                  const vrpn_MaterialDef material, char *buf);
+    vrpn_int32 decodeLoadMaterial(const char *buf, vrpn_MaterialDef *material,
+                                  vrpn_int32 *id);
+    vrpn_int32 encodeSetQuadVert(const vrpn_float64 vertices[4][3],
+                                 const vrpn_int32 tag, char *buf);
+    vrpn_int32 decodeSetQuadVert(const char *buf,
+                                 vrpn_float64 (*vertices)[4][3],
+                                 vrpn_int32 *tag);
+    vrpn_int32 encodeSetTriVert(const vrpn_float64 vertices[3][3],
+                                const vrpn_int32 tag, char *buf);
+    vrpn_int32 decodeSetTriVert(const char *buf, vrpn_float64 (*vertices)[3][3],
+                                vrpn_int32 *tag);
+    vrpn_int32 encodeSetPolyOF(const vrpn_float64 openingfactor,
+                               const vrpn_int32 tag, char *buf);
+    vrpn_int32 decodeSetPolyOF(const char *buf, vrpn_float64 *openingfactor,
+                               vrpn_int32 *tag);
+    vrpn_int32 encodeSetPolyMaterial(const char *material, const vrpn_int32 tag,
+                                     char *buf);
+    vrpn_int32 decodeSetPolyMaterial(const char *buf, char **material,
+                                     vrpn_int32 *tag, const int payload);
+};
+
+class VRPN_API vrpn_Sound_Client : public vrpn_Sound,
+                                   public vrpn_Text_Receiver {
+public:
+    vrpn_Sound_Client(const char *name, vrpn_Connection *c);
+    ~vrpn_Sound_Client();
+
+    // This command starts a sound playing, the repeat value indicates how
+    // many times to play it.  Continuously if repeat is set to 0
+    vrpn_int32 playSound(const vrpn_SoundID id, vrpn_int32 repeat);
+    vrpn_int32 stopSound(const vrpn_SoundID id);
+    // Loads a sound into memory on the server side, returns the ID value to be
+    // used to refer to the sound from now on.  Pass in the path and filename
+    vrpn_SoundID loadSound(const char *sound, const vrpn_SoundID id,
+                           const vrpn_SoundDef soundDef);
+    vrpn_int32 unloadSound(const vrpn_SoundID id);
+
+    // All the functions with change and sound in them, can change either an
+    // already playing sound or one yet to be played
+    vrpn_int32 setSoundVolume(const vrpn_SoundID id, const vrpn_float64 volume);
+    vrpn_int32 setSoundPose(const vrpn_SoundID id, vrpn_float64 position[3],
+                            vrpn_float64 orientation[4]);
+    vrpn_int32 setSoundVelocity(const vrpn_SoundID id,
+                                const vrpn_float64 velocity[4]);
+    vrpn_int32 setSoundDistances(const vrpn_SoundID id,
+                                 const vrpn_float64 max_front_dist,
+                                 const vrpn_float64 min_front_dist,
+                                 const vrpn_float64 max_back_dist,
+                                 const vrpn_float64 min_back_dist);
+    vrpn_int32 setSoundConeInfo(const vrpn_SoundID id,
+                                const vrpn_float64 inner_angle,
+                                const vrpn_float64 outer_angle,
+                                const vrpn_float64 gain);
+
+    vrpn_int32 setSoundDopScale(const vrpn_SoundID id, vrpn_float64 dopfactor);
+    vrpn_int32 setSoundEqValue(const vrpn_SoundID id, vrpn_float64 eq_value);
+    vrpn_int32 setSoundPitch(const vrpn_SoundID id, vrpn_float64 pitch);
+
+    vrpn_int32 setListenerPose(const vrpn_float64 position[3],
+                               const vrpn_float64 orientation[4]);
+    vrpn_int32 setListenerVelocity(const vrpn_float64 velocity[4]);
+
+    vrpn_int32 LoadModel_local(const char *filename);
+
+    // Remote stuff not supported yet!
+    vrpn_int32 LoadModel_remote(const char *data);
+
+    vrpn_int32 LoadPolyQuad(const vrpn_QuadDef quad);
+    vrpn_int32 LoadPolyTri(const vrpn_TriDef tri);
+    vrpn_int32 LoadMaterial(const vrpn_int32 id,
+                            const vrpn_MaterialDef material);
+
+    vrpn_int32 setMaterialName(const int id, const char *materialname);
+    vrpn_int32 setMaterialTransGain(const int id,
+                                    const vrpn_float64 transmittance_gain);
+    vrpn_int32 setMaterialTransHF(const int id,
+                                  const vrpn_float64 transmittance_hf);
+    vrpn_int32 setMaterialReflGain(const int id,
+                                   const vrpn_float64 reflectance_gain);
+    vrpn_int32 setMaterialReflHF(const int id,
+                                 const vrpn_float64 reflectance_hf);
+
+    vrpn_int32 setPolyOF(const int id, const vrpn_float64 OF);
+    vrpn_int32 setQuadVertices(const int id, const vrpn_float64 vertices[4][3]);
+    vrpn_int32 setPolyMaterialName(const int id, const char *materialname);
+
+    vrpn_int32 setTriVertices(const int id, const vrpn_float64 vertices[3][3]);
+
+    virtual void mainloop();
+
+    virtual void receiveTextMessage(const char *message, vrpn_uint32 type,
+                                    vrpn_uint32 level, struct timeval msg_time);
+
+protected:
+private:
+    static void VRPN_CALLBACK
+    handle_receiveTextMessage(void *userdata, const vrpn_TEXTCB t);
+};
+
+/*Note on the server design
+  The server is designed in such a way that it expects a sub-class that is
+  implemented
+  that actually implements sound functionality to have certain functions that it
+  can
+  call to tell the child to play, load, whatever.   This parent server class,
+  handles
+  all of the callback functionality and decoding, allowing child classes to only
+  have
+  to worry about sound functionality*/
+#ifndef VRPN_CLIENT_ONLY
+class VRPN_API vrpn_Sound_Server : public vrpn_Sound, public vrpn_Text_Sender {
+public:
+    vrpn_Sound_Server(const char *name, vrpn_Connection *c);
+    ~vrpn_Sound_Server();
+
+    virtual void playSound(vrpn_SoundID id, vrpn_int32 repeat,
+                           vrpn_SoundDef soundDef) = 0;
+    virtual void loadSoundLocal(char *filename, vrpn_SoundID id,
+                                vrpn_SoundDef soundDef) = 0;
+    virtual void loadSoundRemote(char *file, vrpn_SoundID id,
+                                 vrpn_SoundDef soundDef) = 0;
+    virtual void stopSound(vrpn_SoundID id) = 0;
+    virtual void unloadSound(vrpn_SoundID id) = 0;
+    virtual void changeSoundStatus(vrpn_SoundID id, vrpn_SoundDef soundDef) = 0;
+    virtual void setListenerPose(vrpn_PoseDef pose) = 0;
+    virtual void setListenerVelocity(vrpn_float64 *velocity) = 0;
+
+    virtual void setSoundPose(vrpn_SoundID id, vrpn_PoseDef pose) = 0;
+    virtual void setSoundVelocity(vrpn_SoundID id, vrpn_float64 *velocity) = 0;
+    virtual void setSoundDistInfo(vrpn_SoundID id, vrpn_float64 *distinfo) = 0;
+    virtual void setSoundConeInfo(vrpn_SoundID id, vrpn_float64 *coneinfo) = 0;
+
+    virtual void setSoundDoplerFactor(vrpn_SoundID id,
+                                      vrpn_float64 doplerfactor) = 0;
+    virtual void setSoundEqValue(vrpn_SoundID id, vrpn_float64 eqvalue) = 0;
+    virtual void setSoundPitch(vrpn_SoundID id, vrpn_float64 pitch) = 0;
+    virtual void setSoundVolume(vrpn_SoundID id, vrpn_float64 volume) = 0;
+    virtual void loadModelLocal(const char *filename) = 0;
+    virtual void loadModelRemote() = 0; // not supported
+    virtual void loadPolyQuad(vrpn_QuadDef *quad) = 0;
+    virtual void loadPolyTri(vrpn_TriDef *tri) = 0;
+    virtual void loadMaterial(vrpn_MaterialDef *material, vrpn_int32 id) = 0;
+    virtual void setPolyQuadVertices(vrpn_float64 vertices[4][3],
+                                     const vrpn_int32 id) = 0;
+    virtual void setPolyTriVertices(vrpn_float64 vertices[3][3],
+                                    const vrpn_int32 id) = 0;
+    virtual void setPolyOF(vrpn_float64 OF, vrpn_int32 tag) = 0;
+    virtual void setPolyMaterial(const char *material, vrpn_int32 tag) = 0;
+
+protected:
+private:
+    static int VRPN_CALLBACK
+    handle_loadSoundLocal(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_loadSoundRemote(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_unloadSound(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_playSound(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_stopSound(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_changeSoundStatus(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_setListenerPose(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_setListenerVelocity(void *userdata, vrpn_HANDLERPARAM p);
+
+    static int VRPN_CALLBACK
+    handle_setSoundPose(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_setSoundVelocity(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_setSoundDistanceinfo(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_setSoundConeinfo(void *userdata, vrpn_HANDLERPARAM p);
+
+    static int VRPN_CALLBACK
+    handle_setSoundDoplerfactor(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_setSoundEqvalue(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_setSoundPitch(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_setSoundVolume(void *userdata, vrpn_HANDLERPARAM p);
+
+    static int VRPN_CALLBACK
+    handle_loadModelLocal(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_loadModelRemote(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_loadPolyquad(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_loadPolytri(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_loadMaterial(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_setPolyquadVertices(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_setPolytriVertices(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_setPolyOpeningfactor(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_setPolyMaterial(void *userdata, vrpn_HANDLERPARAM p);
+};
+#endif //#ifndef VRPN_CLIENT_ONLY
+
+#define VRPN_SOUND_H
+#endif
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_Text.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_Text.h
new file mode 100644
index 0000000000000000000000000000000000000000..597d0d91196c6b01c0bf7c572b0f4d7b12983241
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_Text.h
@@ -0,0 +1,102 @@
+/* vrpn_Text.h
+    Definition of user-level access to the text sending and retrieving
+    functions within VRPN. These are wrappers around the vrpn_BaseClass
+    routines, since basic text functions have been pulled into these
+    classes.
+*/
+
+#ifndef VRPN_TEXT_H
+#include <stddef.h> // for NULL
+
+#include "vrpn_BaseClass.h"  // for vrpn_BaseClass, etc
+#include "vrpn_Configure.h"  // for VRPN_API, VRPN_CALLBACK
+#include "vrpn_Connection.h" // for vrpn_Connection, etc
+#include "vrpn_Shared.h"     // for timeval
+#include "vrpn_Types.h"      // for vrpn_uint32
+
+// text-message time value meaning "go find out what time it is right now"
+const struct timeval vrpn_TEXT_NOW = {0, 0};
+
+/// Structure passed back to user-level code from a vrpn_Text_Receiver.
+typedef struct _vrpn_TEXTCB {
+    struct timeval msg_time;         // Time of the message
+    char message[vrpn_MAX_TEXT_LEN]; // The message
+    vrpn_TEXT_SEVERITY type;
+    vrpn_uint32 level;
+} vrpn_TEXTCB;
+
+/// Description of the callback function type.
+typedef void(VRPN_CALLBACK *vrpn_TEXTHANDLER)(void *userdata,
+                                              const vrpn_TEXTCB info);
+
+//----------------------------------------------------------
+//************** Users deal with the following *************
+
+/// Allows a user to send text messages from a device (usually,
+// the send_text_message() function is protected).  It provides
+// the needed function definitions for vrpn_BaseClass.
+
+class VRPN_API vrpn_Text_Sender : public vrpn_BaseClass {
+public:
+    vrpn_Text_Sender(const char *name, vrpn_Connection *c = NULL)
+        : vrpn_BaseClass(name, c)
+    {
+        init();
+    };
+
+    /// Mainloop the connection to send the message.
+    void mainloop(void)
+    {
+        server_mainloop();
+        if (d_connection) d_connection->mainloop();
+    };
+
+    /// Send a text message.
+    int send_message(const char *msg,
+                     vrpn_TEXT_SEVERITY type = vrpn_TEXT_NORMAL,
+                     vrpn_uint32 level = 0,
+                     const struct timeval time = vrpn_TEXT_NOW);
+
+protected:
+    /// No types to register beyond the text, which is done in BaseClass.
+    virtual int register_types(void) { return 0; };
+};
+
+/// Allows a user to handle text messages directly, in addition to having the
+// standard VRPN printing functions handle them.
+
+class VRPN_API vrpn_Text_Receiver : public vrpn_BaseClass {
+public:
+    vrpn_Text_Receiver(const char *name, vrpn_Connection *c = NULL);
+    virtual ~vrpn_Text_Receiver(void);
+    virtual int register_message_handler(void *userdata,
+                                         vrpn_TEXTHANDLER handler)
+    {
+        return d_callback_list.register_handler(userdata, handler);
+    };
+
+    virtual int unregister_message_handler(void *userdata,
+                                           vrpn_TEXTHANDLER handler)
+    {
+        return d_callback_list.unregister_handler(userdata, handler);
+    }
+
+    virtual void mainloop(void)
+    {
+        if (d_connection) {
+            d_connection->mainloop();
+        };
+        client_mainloop();
+    };
+
+protected:
+    static int VRPN_CALLBACK
+    handle_message(void *userdata, vrpn_HANDLERPARAM p);
+    vrpn_Callback_List<vrpn_TEXTCB> d_callback_list;
+
+    /// No types to register beyond the text, which is done in BaseClass.
+    virtual int register_types(void) { return 0; };
+};
+
+#define VRPN_TEXT_H
+#endif
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_Thread.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_Thread.h
new file mode 100644
index 0000000000000000000000000000000000000000..4141467b1d82898ef08e7c1e4978eb9c5fdea4fa
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_Thread.h
@@ -0,0 +1,245 @@
+/** @file
+    @brief Header containing vrpn_Thread, vrpn_Semaphore (formerly in
+   vrpn_Shared.h), as well as a lock-guard class.
+
+    Semaphore and Thread classes derived from Hans Weber's classes from UNC.
+    Don't let the existence of a Thread class fool you into thinking
+    that VRPN is thread-safe.  This and the Semaphore are included as
+    building blocks towards making your own code thread-safe.  They are
+    here to enable the vrpn_Imager_Logger class to do its thing.
+
+    @date 2015
+
+    @author
+    Sensics, Inc.
+    <http://sensics.com/osvr>
+*/
+
+// Copyright 2015 Sensics, Inc.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef INCLUDED_vrpn_Thread_h_GUID_A455652F_72CE_4F8A_859E_543489012D01
+#define INCLUDED_vrpn_Thread_h_GUID_A455652F_72CE_4F8A_859E_543489012D01
+
+// Internal Includes
+#include "vrpn_Configure.h" // for VRPN_API
+
+// Library/third-party includes
+// - none
+
+// Standard includes
+
+#if defined(sgi) || (defined(_WIN32) && !defined(__CYGWIN__)) ||               \
+    defined(linux) || defined(__APPLE__)
+#define vrpn_THREADS_AVAILABLE
+#else
+#undef vrpn_THREADS_AVAILABLE
+#endif
+
+// multi process stuff
+#if defined(sgi)
+#include <task.h>
+#include <ulocks.h>
+#elif defined(_WIN32)
+#include "vrpn_WindowsH.h"
+#include <process.h>
+#else
+#include <pthread.h>   // for pthread_t
+#include <semaphore.h> // for sem_t
+#endif
+
+// make the SGI compile without tons of warnings
+#ifdef sgi
+#pragma set woff 1110, 1424, 3201
+#endif
+
+// and reset the warnings
+#ifdef sgi
+#pragma reset woff 1110, 1424, 3201
+#endif
+
+class VRPN_API vrpn_Semaphore {
+public:
+    /// @brief constructor - mutex by default (0 is a sync primitive)
+    vrpn_Semaphore(int cNumResources = 1);
+
+    /// @brief destructor
+    ~vrpn_Semaphore();
+
+    /// @brief routine to reset it (true on success, false on failure)
+    /// (may create new semaphore)
+    bool reset(int cNumResources = 1);
+
+    /// @brief Blocking acquire of resource. ("down")
+    /// @return 1 when it has acquired the resource, -1 on fail
+    int p();
+
+    /// @brief Release of resource. ("up")
+    /// @return 0 when it has released the resource, -1 on fail
+    int v();
+
+    /// @brief Non-blocking attempt to acquire resource ("down")
+    /// @return 0 if it could not access the resource
+    /// and 1 if it could (-1 on fail)
+    int condP();
+
+    /// @brief read values
+    int numResources();
+
+private:
+    /// @brief non-copyable
+    vrpn_Semaphore(const vrpn_Semaphore &);
+    /// @brief non-assignable
+    vrpn_Semaphore & operator=(const vrpn_Semaphore &);
+    /// @name common init and destroy routines
+    /// @{
+    bool init();
+    bool destroy();
+    /// @}
+
+    int cResources;
+
+    // arch specific details
+#ifdef sgi
+    // single mem area for dynamically alloced shared mem
+    static usptr_t *ppaArena;
+    static void allocArena();
+
+    // the semaphore struct in the arena
+    usema_t *ps;
+    ulock_t l;
+    bool fUsingLock;
+#elif defined(_WIN32)
+    HANDLE hSemaphore;
+#else
+    sem_t *semaphore; // Posix
+#endif
+};
+
+namespace vrpn {
+    struct try_to_lock_t {
+    };
+
+    /// @brief Dummy variable to pass to SemaphoreGuard to indicate we only want
+    /// a conditional lock.
+    const try_to_lock_t try_to_lock = {};
+    /// @brief An RAII lock/guard class for vrpn_Semaphore
+    class VRPN_API SemaphoreGuard {
+    public:
+        /// @brief Constructor that locks (p) the semaphore
+        explicit SemaphoreGuard(vrpn_Semaphore &sem);
+
+        /// @brief overload that only tries to lock (condP) - doesn't block.
+        SemaphoreGuard(vrpn_Semaphore &sem, try_to_lock_t);
+
+        /// @brief Destructor that unlocks if we've locked.
+        ~SemaphoreGuard();
+
+        /// @brief Checks to see if we locked.
+        bool locked() const { return locked_; }
+
+        /// @brief Locks the semaphore, if we haven't locked it already.
+        void lock();
+
+        /// @brief Tries to lock - returns true if we locked it.
+        bool try_to_lock();
+
+        /// @brief Unlocks the resource, if we have locked it.
+        void unlock();
+
+    private:
+        void handleLockResult_(int result);
+        /// @brief non-copyable
+        SemaphoreGuard(SemaphoreGuard const &);
+        /// @brief non-assignable
+        SemaphoreGuard &operator=(SemaphoreGuard const &);
+        bool locked_;
+        vrpn_Semaphore &sem_;
+    };
+
+} // namespace vrpn
+
+// A ptr to this struct will be passed to the
+// thread function.  The user data ptr will be in pvUD.
+// (There used to be a non-functional semaphore object
+// also in this structure, but it was removed.  This leaves
+// a struct with only one element, which is a pain but
+// at least it doesn't break existing code.  If we need
+// to add something else later, there is a place for it.
+
+// The user should create and manage any semaphore needed
+// to handle access control to the userdata.
+
+struct VRPN_API vrpn_ThreadData {
+    void *pvUD;
+};
+
+typedef void(*vrpn_THREAD_FUNC)(vrpn_ThreadData &threadData);
+
+// Don't let the existence of a Thread class fool you into thinking
+// that VRPN is thread-safe.  This and the Semaphore are included as
+// building blocks towards making your own code thread-safe.  They are
+// here to enable the vrpn_Imager_Stream_Buffer class to do its thing.
+class VRPN_API vrpn_Thread {
+public:
+    // args are the routine to run in the thread
+    // a ThreadData struct which will be passed into
+    // the thread (it will be passed as a void *).
+    vrpn_Thread(vrpn_THREAD_FUNC pfThread, vrpn_ThreadData td);
+    ~vrpn_Thread();
+
+#if defined(sgi)
+    typedef unsigned long thread_t;
+#elif defined(_WIN32)
+    typedef uintptr_t thread_t;
+#else
+    typedef pthread_t thread_t;
+#endif
+
+    // start/kill the thread (true on success, false on failure)
+    bool go();
+    bool kill();
+
+    // thread info: check if running, get proc id
+    bool running();
+    thread_t pid();
+
+    // run-time user function to test if threads are available
+    // (same value as #ifdef THREADS_AVAILABLE)
+    static bool available();
+
+    // Number of processors available on this machine.
+    static unsigned number_of_processors();
+
+    // This can be used to change the ThreadData user data ptr
+    // between calls to go (ie, when a thread object is used
+    // many times with different args).  This will take
+    // effect the next time go() is called.
+    void userData(void *pvNewUserData);
+    void *userData();
+
+protected:
+    // user func and data ptrs
+    void(*pfThread)(vrpn_ThreadData &ThreadData);
+    vrpn_ThreadData td;
+
+    // utility func for calling the specified function.
+    static void threadFuncShell(void *pvThread);
+
+    // Posix version of the utility function, makes the
+    // function prototype match.
+    static void *threadFuncShellPosix(void *pvThread);
+
+    // the process id
+    thread_t threadID;
+};
+
+// Returns true if they work and false if they do not.
+extern bool vrpn_test_threads_and_semaphores(void);
+
+
+
+#endif // INCLUDED_vrpn_Thread_h_GUID_A455652F_72CE_4F8A_859E_543489012D01
+
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_Tracker.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_Tracker.h
new file mode 100644
index 0000000000000000000000000000000000000000..0b4bdc14b976a25c403733042b41ca728d981729
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_Tracker.h
@@ -0,0 +1,518 @@
+#ifndef vrpn_TRACKER_H
+#define vrpn_TRACKER_H
+#include <stdio.h> // for NULL, FILE
+
+// NOTE: a vrpn tracker must call user callbacks with tracker data (pos and
+//       ori info) which represent the transformation xfSourceFromSensor.
+//       This means that the pos info is the position of the origin of
+//       the sensor coord sys in the source coord sys space, and the
+//       quat represents the orientation of the sensor relative to the
+//       source space (ie, its value rotates the source's axes so that
+//       they coincide with the sensor's)
+// Positions from all trackers in VRPN are reported in meters.
+// Velocities are reported in meters/second.
+// Accelerations are reported in meters/second/second.
+// These are all reported in three-element double arrays
+// in the order (X=0, Y=1, Z=2).
+// They are translated into this format from the native format for each device.
+// Orientations from all trackers in VRPN are reported in quaternions
+// (see Quatlib for more info) in four-element double arrays
+// in the order (X=0, Y=1, Z=2, W=3).
+// They are translated into this format from the native format for each device.
+
+// to use time synched tracking, just pass in a sync connection to the
+// client and the server
+
+#include "vrpn_BaseClass.h" // for vrpn_Callback_List, etc
+#include "vrpn_Configure.h" // for VRPN_CALLBACK, VRPN_API, etc
+#include "vrpn_Connection.h"
+#include "vrpn_Shared.h" // for timeval
+#include "vrpn_Types.h"  // for vrpn_float64, vrpn_int32, etc
+
+class VRPN_API vrpn_RedundantTransmission;
+
+// tracker status flags
+const int vrpn_TRACKER_SYNCING = (3);
+const int vrpn_TRACKER_AWAITING_STATION = (2);
+const int vrpn_TRACKER_REPORT_READY = (1);
+const int vrpn_TRACKER_PARTIAL = (0);
+const int vrpn_TRACKER_RESETTING = (-1);
+const int vrpn_TRACKER_FAIL = (-2);
+
+// index for the change_list that should be called for all sensors.
+// Not an in-range index.
+const int vrpn_ALL_SENSORS = -1;
+
+typedef vrpn_float64 vrpn_Tracker_Pos[3];
+typedef vrpn_float64 vrpn_Tracker_Quat[4];
+
+class VRPN_API vrpn_Tracker : public vrpn_BaseClass {
+public:
+    // vrpn_Tracker.cfg, in the "local" directory, is the default config file
+    // . You can specify a different config file in the constructor. When
+    // you do this, you must also specify a vrpn_Connection. Pass in NULL
+    // if you don't have one. This awkwardness is because C++ requires that
+    // only the rightmost arguments can use the default values, and that the
+    // order of arguments must match the base class :(
+    vrpn_Tracker(const char *name, vrpn_Connection *c = NULL,
+                 const char *tracker_cfg_file_name = NULL);
+
+    virtual ~vrpn_Tracker(void);
+
+    int read_config_file(FILE *config_file, const char *tracker_name);
+    void print_latest_report(void);
+    // a tracker server should call the following to register the
+    // default xform and workspace request handlers
+    int register_server_handlers(void);
+    void get_local_t2r(vrpn_float64 *vec, vrpn_float64 *quat);
+    void get_local_u2s(vrpn_int32 sensor, vrpn_float64 *vec,
+                       vrpn_float64 *quat);
+    static int VRPN_CALLBACK
+    handle_t2r_request(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_u2s_request(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_workspace_request(void *userdata, vrpn_HANDLERPARAM p);
+    // static int VRPN_CALLBACK handle_update_rate_request (void *,
+    // vrpn_HANDLERPARAM);
+
+protected:
+    vrpn_int32 position_m_id;           // ID of tracker position message
+    vrpn_int32 velocity_m_id;           // ID of tracker velocity message
+    vrpn_int32 accel_m_id;              // ID of tracker acceleration message
+    vrpn_int32 tracker2room_m_id;       // ID of tracker tracker2room message
+    vrpn_int32 unit2sensor_m_id;        // ID of tracker unit2sensor message
+    vrpn_int32 request_t2r_m_id;        // ID of tracker2room request message
+    vrpn_int32 request_u2s_m_id;        // ID of unit2sensor request message
+    vrpn_int32 request_workspace_m_id;  // ID of workspace request message
+    vrpn_int32 workspace_m_id;          // ID of workspace message
+    vrpn_int32 update_rate_id;          // ID of update rate message
+    vrpn_int32 connection_dropped_m_id; // ID of connection dropped message
+    vrpn_int32 reset_origin_m_id;       // ID of reset origin message
+
+    // Description of the next report to go out
+    vrpn_int32 d_sensor;              // Current sensor
+    vrpn_float64 pos[3], d_quat[4];   // Current pose, (x,y,z), (qx,qy,qz,qw)
+    vrpn_float64 vel[3], vel_quat[4]; // Cur velocity and dQuat/vel_quat_dt
+    vrpn_float64 vel_quat_dt;         // delta time (in secs) for vel_quat
+    vrpn_float64 acc[3], acc_quat[4]; // Cur accel and d2Quat/acc_quat_dt2
+    vrpn_float64 acc_quat_dt;         // delta time (in secs) for acc_quat
+    struct timeval timestamp;         // Current timestamp
+    vrpn_int32 frame_count;           // Current framecount
+
+    // The timestamp that the last report was received (Used by the Liberty
+    // Driver)
+    // Other trackers use timestamp as the watchdog, however due to variable USB
+    // latency the Liberty driver uses the device timestamp and not the computer
+    // clock
+    // at the time the report was received. This however can drift
+    // from the computer time, and hence it can cause a reset when things are
+    // working fine
+    struct timeval watchdog_timestamp;
+
+    vrpn_float64 tracker2room[3], tracker2room_quat[4]; // Current t2r xform
+    vrpn_int32 num_sensors;
+
+    // Arrays of values, one per sensor.  Includes function to ensure there are
+    // enough there for a specified number of sensors.
+    vrpn_Tracker_Pos *unit2sensor;
+    vrpn_Tracker_Quat *unit2sensor_quat; // Current u2s xforms
+    unsigned num_unit2sensors;
+    bool ensure_enough_unit2sensors(unsigned num);
+
+    // bounding box for the tracker workspace (in tracker space)
+    // these are the points with (x,y,z) minimum and maximum
+    // note: we assume the bounding box edges are aligned with the tracker
+    // coordinate system
+    vrpn_float64 workspace_min[3], workspace_max[3];
+
+    int status; // What are we doing?
+
+    virtual int register_types(void); //< Called by BaseClass init()
+    virtual int encode_to(char *buf); // Encodes the position report
+    // Not all trackers will call the velocity and acceleration packers
+    virtual int encode_vel_to(char *buf); // Encodes the velocity report
+    virtual int encode_acc_to(char *buf); // Encodes the acceleration report
+    virtual int encode_tracker2room_to(char *buf); // Encodes the tracker2room
+    virtual int encode_unit2sensor_to(char *buf);  // and unit2sensor xforms
+    virtual int encode_workspace_to(char *buf);    // Encodes workspace info
+};
+
+#ifndef VRPN_CLIENT_ONLY
+#define VRPN_TRACKER_BUF_SIZE 100
+
+class VRPN_API vrpn_Tracker_Serial : public vrpn_Tracker {
+public:
+    vrpn_Tracker_Serial(const char *name, vrpn_Connection *c,
+                        const char *port = "/dev/ttyS1", long baud = 38400);
+    virtual ~vrpn_Tracker_Serial();
+
+protected:
+    char portname[VRPN_TRACKER_BUF_SIZE];
+    long baudrate;
+    int serial_fd;
+
+    unsigned char buffer[VRPN_TRACKER_BUF_SIZE]; // Characters read in from the
+                                                 // tracker so far
+    vrpn_uint32 bufcount; // How many characters in the buffer?
+
+    /// Gets a report if one is available, returns 0 if not, 1 if complete
+    /// report.
+    virtual int get_report(void) = 0;
+
+    // Sends the report that was just read.
+    virtual void send_report(void);
+
+    /// Reset the tracker.
+    virtual void reset(void) = 0;
+
+public:
+    /// Uses the get_report, send_report, and reset routines to implement a
+    /// server
+    virtual void mainloop();
+};
+
+// This driver uses the VRPN-preferred LibUSB-1.0 to control the device.
+#if defined(VRPN_USE_LIBUSB_1_0)
+struct libusb_device_handle; // IWYU pragma: keep
+struct libusb_context;       // IWYU pragma: keep
+#define VRPN_TRACKER_USB_BUF_SIZE 1000
+
+class VRPN_API vrpn_Tracker_USB : public vrpn_Tracker {
+public:
+    vrpn_Tracker_USB(const char *name, vrpn_Connection *c, vrpn_uint16 vendor,
+                     vrpn_uint16 product, long baud = 115200);
+    virtual ~vrpn_Tracker_USB();
+
+protected:
+    struct libusb_device_handle *_device_handle; // Handle for the USB device
+    struct libusb_context *_context; // LibUSB context used for this device
+    vrpn_uint16 _vendor;             // Vendor ID for usb device
+    vrpn_uint16 _product;            // Product ID for usb device
+    long _baudrate;
+
+    vrpn_uint8 buffer[VRPN_TRACKER_USB_BUF_SIZE]; // Characters read in from the
+                                                  // tracker
+    vrpn_uint32 bufcount; // How many characters in the buffer?
+
+    /// Gets reports if some are available, returns 0 if not, 1 if complete
+    /// report(s).
+    virtual int get_report(void) = 0;
+
+    // Sends the report that was just read.
+    virtual void send_report(void);
+
+    /// Reset the tracker.
+    virtual void reset(void) = 0;
+
+public:
+    /// Uses the get_report, send_report, and reset routines to implement a
+    /// server
+    virtual void mainloop();
+};
+
+// End of VRPN_USE_LIBUSB_1_0
+#endif
+
+#endif // VRPN_CLIENT_ONLY
+
+// This is an example of a tracker server.  It basically reports the
+// position at the origin with zero velocity and acceleration over and
+// over again at the rate requested.  It is here mostly as an example of
+// how to build a tracker server, and also serves as a test object for
+// client codes and VRPN builds.
+
+class VRPN_API vrpn_Tracker_NULL : public vrpn_Tracker {
+public:
+    vrpn_Tracker_NULL(const char *name, vrpn_Connection *c,
+                      vrpn_int32 sensors = 1, vrpn_float64 Hz = 1.0);
+    virtual void mainloop();
+
+    void setRedundantTransmission(vrpn_RedundantTransmission *);
+
+protected:
+    vrpn_float64 update_rate;
+
+    vrpn_RedundantTransmission *d_redundancy;
+};
+
+// This is an example of a tracker server.  It stays at the
+// origina and spins around the specified axis at the
+// specified rate of rotation, reporting orientation and
+// orientation velocity at the specified
+// rate.  It was designed to help test the smoothness of
+// rendering for VR systems by providing a ground-truth
+// smoothly-rotating tracker source.
+
+class VRPN_API vrpn_Tracker_Spin : public vrpn_Tracker {
+public:
+  vrpn_Tracker_Spin(const char *name, vrpn_Connection *c,
+    vrpn_int32 sensors = 1, vrpn_float64 reportRateHz = 1.0,
+    vrpn_float64 axisX = 0, vrpn_float64 axisY = 0,
+    vrpn_float64 axisZ = 1, vrpn_float64 spinRateHz = 0.5);
+  virtual void mainloop();
+
+protected:
+  vrpn_float64 update_rate;
+  vrpn_float64 x, y, z, spin_rate_Hz;
+  struct timeval start;
+};
+
+// This is a tracker server that can be used by an application that
+// just wants to generate tracker reports but does not really have
+// a tracker device to drive.  Similar to the vrpn_Analog_Server, it
+// provides a quick and easy way for an application to report things.
+//
+// The application creates an object of this class, specifying the
+// number of sensors and the connection that is to be used.  It then
+// reports poses (position + quat), pose velocities, and pose
+// accelerations as desired using the provided functions.  The
+// mainloop() function needs to be called periodically even when
+// there is nothing to report.
+
+class VRPN_API vrpn_Tracker_Server : public vrpn_Tracker {
+public:
+    vrpn_Tracker_Server(const char *name, vrpn_Connection *c,
+                        vrpn_int32 sensors = 1);
+
+    /// This function should be called each time through app mainloop.
+    virtual void mainloop();
+
+    /// These functions should be called to report changes in state, once per
+    /// sensor.
+    virtual int report_pose(
+        const int sensor, const struct timeval t,
+        const vrpn_float64 position[3], const vrpn_float64 quaternion[4],
+        const vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
+    virtual int report_pose_velocity(
+        const int sensor, const struct timeval t,
+        const vrpn_float64 position[3], const vrpn_float64 quaternion[4],
+        const vrpn_float64 interval,
+        const vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
+    virtual int report_pose_acceleration(
+        const int sensor, const struct timeval t,
+        const vrpn_float64 position[3], const vrpn_float64 quaternion[4],
+        const vrpn_float64 interval,
+        const vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
+};
+
+//----------------------------------------------------------
+// ************** Users deal with the following *************
+
+// User routine to handle a tracker position update.  This is called when
+// the tracker callback is called (when a message from its counterpart
+// across the connection arrives).
+
+typedef struct _vrpn_TRACKERCB {
+    struct timeval msg_time; // Time of the report
+    vrpn_int32 sensor;       // Which sensor is reporting
+    vrpn_float64 pos[3];     // Position of the sensor
+    vrpn_float64 quat[4];    // Orientation of the sensor
+} vrpn_TRACKERCB;
+typedef void(VRPN_CALLBACK *vrpn_TRACKERCHANGEHANDLER)(
+    void *userdata, const vrpn_TRACKERCB info);
+
+// User routine to handle a tracker velocity update.  This is called when
+// the tracker callback is called (when a message from its counterpart
+// across the connetion arrives).
+
+typedef struct _vrpn_TRACKERVELCB {
+    struct timeval msg_time;  // Time of the report
+    vrpn_int32 sensor;        // Which sensor is reporting
+    vrpn_float64 vel[3];      // Velocity of the sensor
+    vrpn_float64 vel_quat[4]; // Rotation of the sensor per vel_quat_dt
+    vrpn_float64 vel_quat_dt; // delta time (in secs) for vel_quat
+} vrpn_TRACKERVELCB;
+typedef void(VRPN_CALLBACK *vrpn_TRACKERVELCHANGEHANDLER)(
+    void *userdata, const vrpn_TRACKERVELCB info);
+
+// User routine to handle a tracker acceleration update.  This is called when
+// the tracker callback is called (when a message from its counterpart
+// across the connetion arrives).
+
+typedef struct _vrpn_TRACKERACCCB {
+    struct timeval msg_time;  // Time of the report
+    vrpn_int32 sensor;        // Which sensor is reporting
+    vrpn_float64 acc[3];      // Acceleration of the sensor
+    vrpn_float64 acc_quat[4]; // Change in vel_quat of the sensor per acc_quat_dt
+    vrpn_float64 acc_quat_dt; // delta time (in secs) for acc_quat
+
+} vrpn_TRACKERACCCB;
+typedef void(VRPN_CALLBACK *vrpn_TRACKERACCCHANGEHANDLER)(
+    void *userdata, const vrpn_TRACKERACCCB info);
+
+// User routine to handle a tracker room2tracker xform update. This is called
+// when the tracker callback is called (when a message from its counterpart
+// across the connection arrives).
+
+typedef struct _vrpn_TRACKERTRACKER2ROOMCB {
+    struct timeval msg_time;           // Time of the report
+    vrpn_float64 tracker2room[3];      // position offset
+    vrpn_float64 tracker2room_quat[4]; // orientation offset
+} vrpn_TRACKERTRACKER2ROOMCB;
+typedef void(VRPN_CALLBACK *vrpn_TRACKERTRACKER2ROOMCHANGEHANDLER)(
+    void *userdata, const vrpn_TRACKERTRACKER2ROOMCB info);
+
+typedef struct _vrpn_TRACKERUNIT2SENSORCB {
+    struct timeval msg_time;          // Time of the report
+    vrpn_int32 sensor;                // Which sensor this is for
+    vrpn_float64 unit2sensor[3];      // position offset
+    vrpn_float64 unit2sensor_quat[4]; // orientation offset
+} vrpn_TRACKERUNIT2SENSORCB;
+typedef void(VRPN_CALLBACK *vrpn_TRACKERUNIT2SENSORCHANGEHANDLER)(
+    void *userdata, const vrpn_TRACKERUNIT2SENSORCB info);
+
+typedef struct _vrpn_TRACKERWORKSPACECB {
+    struct timeval msg_time;       // Time of the report
+    vrpn_float64 workspace_min[3]; // minimum corner of box (tracker CS)
+    vrpn_float64 workspace_max[3]; // maximum corner of box (tracker CS)
+} vrpn_TRACKERWORKSPACECB;
+typedef void(VRPN_CALLBACK *vrpn_TRACKERWORKSPACECHANGEHANDLER)(
+    void *userdata, const vrpn_TRACKERWORKSPACECB info);
+
+// Structure to hold all of the callback lists for one sensor
+// (also used for the "all sensors" sensor).
+class vrpn_Tracker_Sensor_Callbacks {
+public:
+    vrpn_Callback_List<vrpn_TRACKERCB> d_change;
+    vrpn_Callback_List<vrpn_TRACKERVELCB> d_velchange;
+    vrpn_Callback_List<vrpn_TRACKERACCCB> d_accchange;
+    vrpn_Callback_List<vrpn_TRACKERUNIT2SENSORCB> d_unit2sensorchange;
+
+    // This class requires deep copies.
+    void operator=(const vrpn_Tracker_Sensor_Callbacks &from)
+    {
+        d_change = from.d_change;
+        d_velchange = from.d_velchange;
+        d_accchange = from.d_accchange;
+        d_unit2sensorchange = from.d_unit2sensorchange;
+    };
+};
+
+// Open a tracker that is on the other end of a connection
+// and handle updates from it.  This is the type of tracker that user code will
+// deal with.
+
+class VRPN_API vrpn_Tracker_Remote : public vrpn_Tracker {
+public:
+    // The name of the tracker to connect to, including connection name,
+    // for example "Ceiling_tracker@ceiling.cs.unc.edu". If you already
+    // have the connection open, you can specify it as the second parameter.
+    // This allows both servers and clients in the same thread, for example.
+    // If it is not specified, then the connection will be looked up based
+    // on the name passed in.
+    vrpn_Tracker_Remote(const char *name, vrpn_Connection *c = NULL);
+
+    // unregister all of the handlers registered with the connection
+    virtual ~vrpn_Tracker_Remote(void);
+
+    // request room from tracker xforms
+    int request_t2r_xform(void);
+    // request all available sensor from unit xforms
+    int request_u2s_xform(void);
+    // request workspace bounding box
+    int request_workspace(void);
+
+    // set rate of p/v/a updates from the tracker
+    int set_update_rate(vrpn_float64 samplesPerSecond);
+
+    // reset origin to current tracker location (e.g. - to reinitialize
+    // a PHANToM in its reset position)
+    int reset_origin(void);
+
+    // This routine calls the mainloop of the connection it's on
+    virtual void mainloop();
+
+    // **** to register handlers for sensor-specific messages: ****
+    // Default is to register them for all sensors.
+
+    // (un)Register a callback handler to handle a position change
+    virtual int register_change_handler(void *userdata,
+                                        vrpn_TRACKERCHANGEHANDLER handler,
+                                        vrpn_int32 sensor = vrpn_ALL_SENSORS);
+    virtual int unregister_change_handler(void *userdata,
+                                          vrpn_TRACKERCHANGEHANDLER handler,
+                                          vrpn_int32 sensor = vrpn_ALL_SENSORS);
+
+    // (un)Register a callback handler to handle a velocity change
+    virtual int register_change_handler(void *userdata,
+                                        vrpn_TRACKERVELCHANGEHANDLER handler,
+                                        vrpn_int32 sensor = vrpn_ALL_SENSORS);
+    virtual int unregister_change_handler(void *userdata,
+                                          vrpn_TRACKERVELCHANGEHANDLER handler,
+                                          vrpn_int32 sensor = vrpn_ALL_SENSORS);
+
+    // (un)Register a callback handler to handle an acceleration change
+    virtual int register_change_handler(void *userdata,
+                                        vrpn_TRACKERACCCHANGEHANDLER handler,
+                                        vrpn_int32 sensor = vrpn_ALL_SENSORS);
+    virtual int unregister_change_handler(void *userdata,
+                                          vrpn_TRACKERACCCHANGEHANDLER handler,
+                                          vrpn_int32 sensor = vrpn_ALL_SENSORS);
+
+    // (un)Register a callback handler to handle a unit2sensor change
+    virtual int
+    register_change_handler(void *userdata,
+                            vrpn_TRACKERUNIT2SENSORCHANGEHANDLER handler,
+                            vrpn_int32 sensor = vrpn_ALL_SENSORS);
+    virtual int
+    unregister_change_handler(void *userdata,
+                              vrpn_TRACKERUNIT2SENSORCHANGEHANDLER handler,
+                              vrpn_int32 sensor = vrpn_ALL_SENSORS);
+
+    // **** to get workspace information ****
+    // (un)Register a callback handler to handle a workspace change
+    virtual int
+    register_change_handler(void *userdata,
+                            vrpn_TRACKERWORKSPACECHANGEHANDLER handler)
+    {
+        return d_workspacechange_list.register_handler(userdata, handler);
+    };
+    virtual int
+    unregister_change_handler(void *userdata,
+                              vrpn_TRACKERWORKSPACECHANGEHANDLER handler)
+    {
+        return d_workspacechange_list.unregister_handler(userdata, handler);
+    }
+
+    // (un)Register a callback handler to handle a tracker2room change
+    virtual int
+    register_change_handler(void *userdata,
+                            vrpn_TRACKERTRACKER2ROOMCHANGEHANDLER handler)
+    {
+        return d_tracker2roomchange_list.register_handler(userdata, handler);
+    };
+    virtual int
+    unregister_change_handler(void *userdata,
+                              vrpn_TRACKERTRACKER2ROOMCHANGEHANDLER handler)
+    {
+        return d_tracker2roomchange_list.unregister_handler(userdata, handler);
+    };
+
+protected:
+    // Callbacks with one per sensor (plus one for "all")
+    vrpn_Tracker_Sensor_Callbacks all_sensor_callbacks;
+    vrpn_Tracker_Sensor_Callbacks *sensor_callbacks;
+    unsigned num_sensor_callbacks;
+    bool ensure_enough_sensor_callbacks(unsigned num);
+
+    // Callbacks that are one per tracker
+    vrpn_Callback_List<vrpn_TRACKERTRACKER2ROOMCB> d_tracker2roomchange_list;
+    vrpn_Callback_List<vrpn_TRACKERWORKSPACECB> d_workspacechange_list;
+
+    static int VRPN_CALLBACK
+    handle_change_message(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_vel_change_message(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_acc_change_message(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_tracker2room_change_message(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_unit2sensor_change_message(void *userdata, vrpn_HANDLERPARAM p);
+    static int VRPN_CALLBACK
+    handle_workspace_change_message(void *userdata, vrpn_HANDLERPARAM p);
+};
+
+// End of vrpn_TRACKER_H
+#endif
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_Types.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_Types.h
new file mode 100644
index 0000000000000000000000000000000000000000..54cfa42c27effa9138ebb8fe574ae1c712af9824
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_Types.h
@@ -0,0 +1,223 @@
+#ifndef VRPN_TYPES_H
+#define VRPN_TYPES_H
+
+#include "vrpn_Configure.h"
+
+//------------------------------------------------------------------
+// Do a test for a C++ compiler first, to ensure it's the first
+// error message.  Otherwise, the error messages you get are
+// completely cryptic.
+//------------------------------------------------------------------
+#ifndef __cplusplus
+#ifndef VRPN_IGNORE_NO_CPLUSPLUS
+#error Need to compile with a C++ compiler, not a C compiler.  The problem is that in Windows, filenames are case-insensitive.  So the compiler cannot tell mumble.c from mumble.C.  Visual Studio decided to make .cpp (which used to mean run the C preprocessor) mean C++ and both .c and .C mean C.  The other problem is that when you insert a new file into a project, it FOR THAT FILE makes an override.  The project settings say C++ but if you right-click on the file itself it has an override to compile with C.  This needs to be changed for both the .C file and the .h file.
+#endif
+#endif
+
+//------------------------------------------------------------------
+//   This section contains definitions for architecture-dependent
+// types.  It is important that the data sent over a vrpn_Connection
+// be of the same size on all hosts sending and receiving it.  Since
+// C++ does not constrain the size of 'int', 'long', 'double' and
+// so forth, we create new types here that are defined correctly for
+// each architecture and use them for all data that might be sent
+// across a connection.
+//   Part of porting VRPN to a new architecture is defining the
+// types below on that architecture in such as way that the compiler
+// can determine which machine type it is on.
+//------------------------------------------------------------------
+
+#undef VRPN_ARCH
+
+#ifdef sgi
+#define VRPN_ARCH sgi
+typedef char vrpn_int8;
+typedef unsigned char vrpn_uint8;
+typedef short vrpn_int16;
+typedef unsigned short vrpn_uint16;
+typedef int vrpn_int32;
+typedef unsigned int vrpn_uint32;
+typedef float vrpn_float32;
+typedef double vrpn_float64;
+#endif
+
+#ifdef hpux
+#define VRPN_ARCH hpux
+typedef char vrpn_int8;
+typedef unsigned char vrpn_uint8;
+typedef short vrpn_int16;
+typedef unsigned short vrpn_uint16;
+typedef int vrpn_int32;
+typedef unsigned int vrpn_uint32;
+typedef float vrpn_float32;
+typedef double vrpn_float64;
+#endif
+
+// For PixelFlow aCC compiler
+#ifdef __hpux
+#undef VRPN_ARCH
+#define VRPN_ARCH __hpux
+typedef char vrpn_int8;
+typedef unsigned char vrpn_uint8;
+typedef short vrpn_int16;
+typedef unsigned short vrpn_uint16;
+typedef int vrpn_int32;
+typedef unsigned int vrpn_uint32;
+typedef float vrpn_float32;
+typedef double vrpn_float64;
+#endif
+
+#ifdef sparc
+#define VRPN_ARCH sparc
+typedef char vrpn_int8;
+typedef unsigned char vrpn_uint8;
+typedef short vrpn_int16;
+typedef unsigned short vrpn_uint16;
+typedef int vrpn_int32;
+typedef unsigned int vrpn_uint32;
+typedef float vrpn_float32;
+typedef double vrpn_float64;
+#endif
+
+#ifdef linux
+#define VRPN_ARCH linux
+typedef char vrpn_int8;
+typedef unsigned char vrpn_uint8;
+typedef short vrpn_int16;
+typedef unsigned short vrpn_uint16;
+typedef int vrpn_int32;
+typedef unsigned int vrpn_uint32;
+typedef float vrpn_float32;
+typedef double vrpn_float64;
+#endif
+
+#ifdef _AIX
+#define VRPN_ARCH aix
+typedef char vrpn_int8;
+typedef unsigned char vrpn_uint8;
+typedef short vrpn_int16;
+typedef unsigned short vrpn_uint16;
+typedef int vrpn_int32;
+typedef unsigned int vrpn_uint32;
+typedef float vrpn_float32;
+typedef double vrpn_float64;
+#endif
+
+// _WIN32 is defined for all compilers for Windows (cygnus g++ included)
+// WIN32 (sans underline) is defined only by the Windows VC++ compiler.
+//
+//     DO NOT EVER USE WIN32
+//
+// It is too hard to differentiate from _WIN32, and may not actually be
+// defined by VC++ (it's a project option).  If you use WIN32 to distinguish
+// between VC++ and cygwin/g++, may your wrists quickly develop a nerve
+// disorder that prevents you from ever typing again ;)
+//
+#ifdef _WIN32
+#define VRPN_ARCH _WIN32
+typedef char vrpn_int8;
+typedef unsigned char vrpn_uint8;
+typedef short vrpn_int16;
+typedef unsigned short vrpn_uint16;
+typedef int vrpn_int32;
+typedef unsigned int vrpn_uint32;
+typedef float vrpn_float32;
+typedef double vrpn_float64;
+#endif
+
+#if defined(FreeBSD) || defined(__FreeBSD__)
+#ifndef FreeBSD
+#define FreeBSD
+#endif
+#define VRPN_ARCH FreeBSD
+typedef char vrpn_int8;
+typedef unsigned char vrpn_uint8;
+typedef short vrpn_int16;
+typedef unsigned short vrpn_uint16;
+typedef int vrpn_int32;
+typedef unsigned int vrpn_uint32;
+typedef float vrpn_float32;
+typedef double vrpn_float64;
+#endif
+
+#ifdef __APPLE__
+#define VRPN_ARCH MacOSX
+typedef char vrpn_int8;
+typedef unsigned char vrpn_uint8;
+typedef short vrpn_int16;
+typedef unsigned short vrpn_uint16;
+typedef int vrpn_int32;
+typedef unsigned int vrpn_uint32;
+typedef float vrpn_float32;
+typedef double vrpn_float64;
+#endif
+
+// Architecture of last resort.
+#ifndef VRPN_ARCH
+#ifdef __GNUC__
+#define VRPN_ARCH _WIN32
+typedef char vrpn_int8;
+typedef unsigned char vrpn_uint8;
+typedef short vrpn_int16;
+typedef unsigned short vrpn_uint16;
+typedef int vrpn_int32;
+typedef unsigned int vrpn_uint32;
+typedef float vrpn_float32;
+typedef double vrpn_float64;
+#endif
+#endif
+
+#ifndef VRPN_ARCH
+#error Need to define architecture-dependent sizes in this file
+#endif
+
+// Prevent use of this macro outside this file;
+// if you need to distinguish more types, then define new types in this file.
+
+#undef VRPN_ARCH
+
+// *******************************************************
+// you should NOT need to modify anything below this point
+// *******************************************************
+#ifdef __cplusplus
+typedef vrpn_int16 vrpn_bool;
+
+const vrpn_int16 vrpn_true = 1;
+const vrpn_int16 vrpn_false = 0;
+const vrpn_int16 vrpn_TRUE = 1;
+const vrpn_int16 vrpn_FALSE = 0;
+const vrpn_int16 VRPN_TRUE = 1;
+const vrpn_int16 VRPN_FALSE = 0;
+#endif
+
+// should we add a success & fail?
+
+// [juliano 10/9/99] The vrpn bool variables can not actually be fully
+// optimized away, because the compiler is not allowed to assume their
+// values don't change.
+//
+//   [juliano 11/28/99] Perhaps the optimization can be done if they are
+//   static?  I don't know enough about what compilers can/cannot do today.
+//
+// If you are willing to assume templates, there is an alternative using
+// a traits class that does make the optimization possible (and likely).
+//
+// If you don't want to use templates, but still want the sizeof
+// these things be vrpn_int16, you can use macros like this.
+//
+//    #define vrpn_false /*false*/vrpn_int16(0)
+//    #define vrpn_true  /*true*/vrpn_int16(1)
+//
+// With this method, you will still be able to tell, in the
+// compiler error messages, what the real code contains.
+//
+// If you don't care about them being a different type than
+// vrpn_int16 (probably not a good idea), you can use this technique,
+// which guarantees optimizations can be performed.
+//
+//     enum vrpn_bool_constants_t{
+//         vrpn_false=0, vrpn_FALSE=0, VRPN_FALSE=0,
+//         vrpn_true=1,  vrpn_TRUE=1,  VRPN_TRUE=1 };
+//
+
+#endif // VRPN_TYPES_H
diff --git a/ThirdParty/Vrpn/Include/vrpn/vrpn_WindowsH.h b/ThirdParty/Vrpn/Include/vrpn/vrpn_WindowsH.h
new file mode 100644
index 0000000000000000000000000000000000000000..a28d3d3c6b4dc2dd2388c05b45d9d02cdf18f428
--- /dev/null
+++ b/ThirdParty/Vrpn/Include/vrpn/vrpn_WindowsH.h
@@ -0,0 +1,78 @@
+/** @file
+    @brief Header to minimally include windows.h
+
+    @date 2015
+
+    @author
+    Ryan Pavlik
+    Sensics, Inc.
+    <http://sensics.com/osvr>
+*/
+
+
+// Copyright 2015 Sensics, Inc.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef INCLUDED_vrpn_WindowsH_h_GUID_97C90BFD_D6C3_4AB3_3272_A10F7448D165
+#define INCLUDED_vrpn_WindowsH_h_GUID_97C90BFD_D6C3_4AB3_3272_A10F7448D165
+
+#ifdef _WIN32
+
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#define VRPN_WIN32_LEAN_AND_MEAN
+#endif
+
+#ifndef NOMINMAX
+#define NOMINMAX
+#define VRPN_NOMINMAX
+#endif
+
+#ifndef NOSERVICE
+#define NOSERVICE
+#define VRPN_NOSERVICE
+#endif
+
+#ifndef NOMCX
+#define NOMCX
+#define VRPN_NOMCX
+#endif
+
+#ifndef NOIME
+#define NOIME
+#define VRPN_NOIME
+#endif
+
+#include <windows.h>
+
+#ifdef VRPN_WIN32_LEAN_AND_MEAN
+#undef VRPN_WIN32_LEAN_AND_MEAN
+#undef WIN32_LEAN_AND_MEAN
+#endif
+
+#ifdef VRPN_NOMINMAX
+#undef VRPN_NOMINMAX
+#undef NOMINMAX
+#endif
+
+#ifdef VRPN_NOSERVICE
+#undef VRPN_NOSERVICE
+#undef NOSERVICE
+#endif
+
+#ifdef VRPN_NOMCX
+#undef VRPN_NOMCX
+#undef NOMCX
+#endif
+
+#ifdef VRPN_NOIME
+#undef VRPN_NOIME
+#undef NOIME
+#endif
+
+#endif // _WIN32
+
+#endif // INCLUDED_vrpn_WindowsH_h_GUID_97C90BFD_D6C3_4AB3_3272_A10F7448D165
+
diff --git a/ThirdParty/Vrpn/Lib/Linux/libquat.lib b/ThirdParty/Vrpn/Lib/Linux/libquat.lib
new file mode 100644
index 0000000000000000000000000000000000000000..dd1ba69f104100d67982eb375afab2da4ed4e026
Binary files /dev/null and b/ThirdParty/Vrpn/Lib/Linux/libquat.lib differ
diff --git a/ThirdParty/Vrpn/Lib/Linux/libvrpn.lib b/ThirdParty/Vrpn/Lib/Linux/libvrpn.lib
new file mode 100644
index 0000000000000000000000000000000000000000..ab76599b0939c81281e8508e79107b8417971595
Binary files /dev/null and b/ThirdParty/Vrpn/Lib/Linux/libvrpn.lib differ
diff --git a/ThirdParty/Vrpn/Lib/x64/quat.lib b/ThirdParty/Vrpn/Lib/x64/quat.lib
new file mode 100644
index 0000000000000000000000000000000000000000..f7e80f1cfda8fcf6516a800481aae4ba4f7c38ff
Binary files /dev/null and b/ThirdParty/Vrpn/Lib/x64/quat.lib differ
diff --git a/ThirdParty/Vrpn/Lib/x64/quatd.lib b/ThirdParty/Vrpn/Lib/x64/quatd.lib
new file mode 100644
index 0000000000000000000000000000000000000000..47ced77e2ba1696fcd90b478b0756043da313851
Binary files /dev/null and b/ThirdParty/Vrpn/Lib/x64/quatd.lib differ
diff --git a/ThirdParty/Vrpn/Lib/x64/vrpn.lib b/ThirdParty/Vrpn/Lib/x64/vrpn.lib
new file mode 100644
index 0000000000000000000000000000000000000000..68591d48c72092c087c73f87e0e1764bbcbdd540
Binary files /dev/null and b/ThirdParty/Vrpn/Lib/x64/vrpn.lib differ
diff --git a/ThirdParty/Vrpn/Lib/x64/vrpnd.lib b/ThirdParty/Vrpn/Lib/x64/vrpnd.lib
new file mode 100644
index 0000000000000000000000000000000000000000..f123a9585a6efcb5ccdf64f854c7a7204a2d9977
Binary files /dev/null and b/ThirdParty/Vrpn/Lib/x64/vrpnd.lib differ
diff --git a/ThirdParty/Vrpn/Lib/x86/quat.lib b/ThirdParty/Vrpn/Lib/x86/quat.lib
new file mode 100644
index 0000000000000000000000000000000000000000..74654daf09c103054ea2d51835b7fa72ada1363a
Binary files /dev/null and b/ThirdParty/Vrpn/Lib/x86/quat.lib differ
diff --git a/ThirdParty/Vrpn/Lib/x86/quatd.lib b/ThirdParty/Vrpn/Lib/x86/quatd.lib
new file mode 100644
index 0000000000000000000000000000000000000000..8b8d4e3ad994dcb0237ab3c96af4f6622c95039c
Binary files /dev/null and b/ThirdParty/Vrpn/Lib/x86/quatd.lib differ
diff --git a/ThirdParty/Vrpn/Lib/x86/vrpn.lib b/ThirdParty/Vrpn/Lib/x86/vrpn.lib
new file mode 100644
index 0000000000000000000000000000000000000000..5d2ae8344bd891471aed79119fd3a3542155d28f
Binary files /dev/null and b/ThirdParty/Vrpn/Lib/x86/vrpn.lib differ
diff --git a/ThirdParty/Vrpn/Lib/x86/vrpnd.lib b/ThirdParty/Vrpn/Lib/x86/vrpnd.lib
new file mode 100644
index 0000000000000000000000000000000000000000..41e4ce8e4abb31b0037dd3fa862fa3b737d45472
Binary files /dev/null and b/ThirdParty/Vrpn/Lib/x86/vrpnd.lib differ
diff --git a/ThirdParty/Vrpn/VRPN.tps b/ThirdParty/Vrpn/VRPN.tps
new file mode 100644
index 0000000000000000000000000000000000000000..83f237757480cb0808a2efc693341b2b4b6427d4
--- /dev/null
+++ b/ThirdParty/Vrpn/VRPN.tps
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>

+<TpsData xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

+  <Name>VRPN</Name>

+  <Location>/Enterprise/Plugins/Runtime/vrCluster/ThirdParty/Vrpn</Location>

+  <Function>Used by the vrCluster plugin for Enterprise.</Function>

+  <Eula>https://github.com/vrpn/vrpn/wiki/License</Eula>

+  <RedistributeTo>

+	<EndUserGroup>Licensees</EndUserGroup>

+    <EndUserGroup>Git</EndUserGroup>

+    <EndUserGroup>P4</EndUserGroup>

+  </RedistributeTo>

+  <LicenseFolder>/Engine/Source/ThirdParty/Licenses/VRPN_License.txt</LicenseFolder>

+</TpsData>
\ No newline at end of file
diff --git a/ThirdParty/X11/Include/X11/CallbackI.h b/ThirdParty/X11/Include/X11/CallbackI.h
new file mode 100644
index 0000000000000000000000000000000000000000..5d958f41a8a7336ae700e86cfa39f28304e77985
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/CallbackI.h
@@ -0,0 +1,119 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/****************************************************************
+ *
+ * Callbacks
+ *
+ ****************************************************************/
+
+typedef XrmResource **CallbackTable;
+
+#define _XtCBCalling 1
+#define _XtCBFreeAfterCalling 2
+
+_XFUNCPROTOBEGIN
+
+typedef struct internalCallbackRec {
+    unsigned short count;
+    char	   is_padded;	/* contains NULL padding for external form */
+    char	   call_state;  /* combination of _XtCB{FreeAfter}Calling */
+#ifdef LONG64
+    unsigned int   align_pad;	/* padding to align callback list */
+#endif
+    /* XtCallbackList */
+} InternalCallbackRec, *InternalCallbackList;
+
+typedef Boolean (*_XtConditionProc)(
+    XtPointer	/* data */
+);
+
+extern void _XtAddCallback(
+    InternalCallbackList*	/* callbacks */,
+    XtCallbackProc		/* callback */,
+    XtPointer 			/* closure */
+);
+
+extern void _XtAddCallbackOnce(
+    InternalCallbackList*	/* callbacks */,
+    XtCallbackProc		/* callback */,
+    XtPointer 			/* closure */
+);
+
+extern InternalCallbackList _XtCompileCallbackList(
+    XtCallbackList		/* xtcallbacks */
+);
+
+extern XtCallbackList _XtGetCallbackList(
+    InternalCallbackList*	/* callbacks */
+);
+
+extern void _XtRemoveAllCallbacks(
+    InternalCallbackList*	/* callbacks */
+);
+
+extern void _XtRemoveCallback(
+    InternalCallbackList*	/* callbacks */,
+    XtCallbackProc		/* callback */,
+    XtPointer			/* closure */
+);
+
+extern void _XtPeekCallback(
+    Widget			/* widget */,
+    XtCallbackList		/* callbacks */,
+    XtCallbackProc *		/* callback */,
+    XtPointer *			/* closure */
+);
+
+extern void _XtCallConditionalCallbackList(
+    Widget			/* widget */,
+    XtCallbackList		/* callbacks */,
+    XtPointer			/* call_data */,
+    _XtConditionProc		/* cond_proc */
+);
+
+_XFUNCPROTOEND
diff --git a/ThirdParty/X11/Include/X11/Composite.h b/ThirdParty/X11/Include/X11/Composite.h
new file mode 100644
index 0000000000000000000000000000000000000000..d33234f3ad9f91b6a6c3f509753fb7ae375e580e
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Composite.h
@@ -0,0 +1,102 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XtComposite_h
+#define _XtComposite_h
+
+typedef struct _CompositeClassRec *CompositeWidgetClass;
+
+typedef Cardinal (*XtOrderProc)(
+    Widget 	/* child */
+);
+
+_XFUNCPROTOBEGIN
+
+extern void XtManageChildren(
+    WidgetList 		/* children */,
+    Cardinal 		/* num_children */
+);
+
+extern void XtManageChild(
+    Widget 		/* child */
+);
+
+extern void XtUnmanageChildren(
+    WidgetList 		/* children */,
+    Cardinal 		/* num_children */
+);
+
+extern void XtUnmanageChild(
+    Widget 		/* child */
+);
+
+typedef void (*XtDoChangeProc)(
+    Widget		/* composite_parent */,
+    WidgetList		/* unmanage_children */,
+    Cardinal *		/* num_unmanage_children */,
+    WidgetList		/* manage_children */,
+    Cardinal *		/* num_manage_children */,
+    XtPointer		/* client_data */
+);
+
+extern void XtChangeManagedSet(
+    WidgetList		/* unmanage_children */,
+    Cardinal		/* num_unmanage_children */,
+    XtDoChangeProc	/* do_change_proc */,
+    XtPointer		/* client_data */,
+    WidgetList		/* manage_children */,
+    Cardinal		/* num_manage_children */
+);
+
+_XFUNCPROTOEND
+
+#ifndef VMS
+externalref WidgetClass compositeWidgetClass;
+#endif
+
+#endif /* _XtComposite_h */
+/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/ThirdParty/X11/Include/X11/CompositeP.h b/ThirdParty/X11/Include/X11/CompositeP.h
new file mode 100644
index 0000000000000000000000000000000000000000..b1b8559a08c803972a419a50c0c79f400982d9d4
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/CompositeP.h
@@ -0,0 +1,113 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XtCompositeP_h
+#define _XtCompositeP_h
+
+#include <X11/Composite.h>
+
+_XFUNCPROTOBEGIN
+
+/************************************************************************
+ *
+ * Additional instance fields for widgets of (sub)class 'Composite'
+ *
+ ************************************************************************/
+
+typedef struct _CompositePart {
+    WidgetList  children;	     /* array of ALL widget children	     */
+    Cardinal    num_children;	     /* total number of widget children	     */
+    Cardinal    num_slots;           /* number of slots in children array    */
+    XtOrderProc insert_position;     /* compute position of new child	     */
+} CompositePart,*CompositePtr;
+
+typedef struct _CompositeRec {
+    CorePart      core;
+    CompositePart composite;
+} CompositeRec;
+
+/*********************************************************************
+ *
+ *  Additional class fields for widgets of (sub)class 'Composite'
+ *
+ ********************************************************************/
+
+typedef struct _CompositeClassPart {
+    XtGeometryHandler geometry_manager;	  /* geometry manager for children   */
+    XtWidgetProc      change_managed;	  /* change managed state of child   */
+    XtWidgetProc      insert_child;	  /* physically add child to parent  */
+    XtWidgetProc      delete_child;	  /* physically remove child	     */
+    XtPointer	      extension;	  /* pointer to extension record     */
+} CompositeClassPart,*CompositePartPtr;
+
+typedef struct {
+    XtPointer next_extension;	/* 1st 4 mandated for all extension records */
+    XrmQuark record_type;	/* NULLQUARK; on CompositeClassPart */
+    long version;		/* must be XtCompositeExtensionVersion */
+    Cardinal record_size;	/* sizeof(CompositeClassExtensionRec) */
+    Boolean accepts_objects;
+    Boolean allows_change_managed_set;
+} CompositeClassExtensionRec, *CompositeClassExtension;
+
+
+typedef struct _CompositeClassRec {
+     CoreClassPart      core_class;
+     CompositeClassPart composite_class;
+} CompositeClassRec;
+
+externalref CompositeClassRec compositeClassRec;
+
+_XFUNCPROTOEND
+
+#define XtCompositeExtensionVersion 2L
+#define XtInheritGeometryManager ((XtGeometryHandler) _XtInherit)
+#define XtInheritChangeManaged ((XtWidgetProc) _XtInherit)
+#define XtInheritInsertChild ((XtWidgetProc) _XtInherit)
+#define XtInheritDeleteChild ((XtWidgetProc) _XtInherit)
+
+#endif /* _XtCompositeP_h */
+/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/ThirdParty/X11/Include/X11/ConstrainP.h b/ThirdParty/X11/Include/X11/ConstrainP.h
new file mode 100644
index 0000000000000000000000000000000000000000..40ff9b9f9216000bc5e0c15b3a8a2a469d90bae5
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/ConstrainP.h
@@ -0,0 +1,96 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XtConstraintP_h
+#define _XtConstraintP_h
+
+#include <X11/Constraint.h>
+
+_XFUNCPROTOBEGIN
+
+typedef struct _ConstraintPart {
+    XtPointer   mumble;		/* No new fields, keep C compiler happy */
+} ConstraintPart;
+
+typedef struct _ConstraintRec {
+    CorePart	    core;
+    CompositePart   composite;
+    ConstraintPart  constraint;
+} ConstraintRec, *ConstraintWidget;
+
+typedef struct _ConstraintClassPart {
+    XtResourceList resources;	      /* constraint resource list	     */
+    Cardinal   num_resources;         /* number of constraints in list       */
+    Cardinal   constraint_size;       /* size of constraint record           */
+    XtInitProc initialize;            /* constraint initialization           */
+    XtWidgetProc destroy;             /* constraint destroy proc             */
+    XtSetValuesFunc set_values;       /* constraint set_values proc          */
+    XtPointer	    extension;		/* pointer to extension record      */
+} ConstraintClassPart;
+
+typedef struct {
+    XtPointer next_extension;	/* 1st 4 mandated for all extension records */
+    XrmQuark record_type;	/* NULLQUARK; on ConstraintClassPart */
+    long version;		/* must be XtConstraintExtensionVersion */
+    Cardinal record_size;	/* sizeof(ConstraintClassExtensionRec) */
+    XtArgsProc get_values_hook;
+} ConstraintClassExtensionRec, *ConstraintClassExtension;
+
+typedef struct _ConstraintClassRec {
+    CoreClassPart       core_class;
+    CompositeClassPart  composite_class;
+    ConstraintClassPart constraint_class;
+} ConstraintClassRec;
+
+externalref ConstraintClassRec constraintClassRec;
+
+_XFUNCPROTOEND
+
+#define XtConstraintExtensionVersion 1L
+
+#endif /* _XtConstraintP_h */
+/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/ThirdParty/X11/Include/X11/Constraint.h b/ThirdParty/X11/Include/X11/Constraint.h
new file mode 100644
index 0000000000000000000000000000000000000000..20abeadf6b4b2b2bf18d1d3e2bd1601f8c2c894c
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Constraint.h
@@ -0,0 +1,62 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XtConstraint_h
+#define _XtConstraint_h
+
+_XFUNCPROTOBEGIN
+
+typedef struct _ConstraintClassRec *ConstraintWidgetClass;
+
+#ifndef VMS
+externalref WidgetClass constraintWidgetClass;
+#endif
+
+_XFUNCPROTOEND
+
+#endif /* _XtConstraint_h */
+/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/ThirdParty/X11/Include/X11/ConvertI.h b/ThirdParty/X11/Include/X11/ConvertI.h
new file mode 100644
index 0000000000000000000000000000000000000000..760d4776aab0f46fd2f83df5fab6e93a8dc5dff1
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/ConvertI.h
@@ -0,0 +1,96 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+_XFUNCPROTOBEGIN
+
+/* Representation types */
+
+extern	XrmQuark  _XtQString;
+
+/*
+ * Resource conversions
+ */
+
+typedef struct _ConverterRec **ConverterTable;
+
+extern void _XtAddDefaultConverters(
+    ConverterTable	/* table */
+);
+
+extern void _XtSetDefaultConverterTable(
+    ConverterTable* 		/* table */
+);
+
+extern void _XtFreeConverterTable(
+    ConverterTable 		/* table */
+);
+
+extern void _XtTableAddConverter(
+    ConverterTable		/* table */,
+    XrmRepresentation    	/* from_type */,
+    XrmRepresentation    	/* to_type */,
+    XtTypeConverter      	/* converter */,
+    XtConvertArgList     	/* convert_args */,
+    Cardinal             	/* num_args */,
+    _XtBoolean              	/* new_style */,
+    XtCacheType	    		/* cache_type */,
+    XtDestructor         	/* destructor */,
+    _XtBoolean			/* global */
+);
+
+extern Boolean _XtConvert(
+    Widget			/* widget */,
+    XrmRepresentation    	/* from_type */,
+    XrmValuePtr			/* from */,
+    XrmRepresentation		/* to_type */,
+    XrmValuePtr			/* to */,
+    XtCacheRef*			/* cache_ref_return */
+);
+
+void _XtConvertInitialize(void);
+
+_XFUNCPROTOEND
diff --git a/ThirdParty/X11/Include/X11/Core.h b/ThirdParty/X11/Include/X11/Core.h
new file mode 100644
index 0000000000000000000000000000000000000000..08a86f693719e339a24eeae47f29063f37a167d7
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Core.h
@@ -0,0 +1,65 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XtCore_h
+#define _XtCore_h
+
+_XFUNCPROTOBEGIN
+
+typedef struct _WidgetClassRec *CoreWidgetClass;
+typedef struct _WidgetRec *CoreWidget;
+externalref WidgetClass coreWidgetClass;
+
+#ifndef VMS
+externalref WidgetClass widgetClass;
+
+#endif
+
+_XFUNCPROTOEND
+
+#endif /* _XtCore_h */
+/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/ThirdParty/X11/Include/X11/CoreP.h b/ThirdParty/X11/Include/X11/CoreP.h
new file mode 100644
index 0000000000000000000000000000000000000000..a4cb16e8929d2ee8f85a506748879852c736a637
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/CoreP.h
@@ -0,0 +1,170 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef XtCoreP_h
+#define XtCoreP_h
+
+#include <X11/Core.h>
+
+_XFUNCPROTOBEGIN
+
+externalref int _XtInheritTranslations;
+
+#define XtInheritTranslations  ((String) &_XtInheritTranslations)
+#define XtInheritRealize ((XtRealizeProc) _XtInherit)
+#define XtInheritResize ((XtWidgetProc) _XtInherit)
+#define XtInheritExpose ((XtExposeProc) _XtInherit)
+#define XtInheritSetValuesAlmost ((XtAlmostProc) _XtInherit)
+#define XtInheritAcceptFocus ((XtAcceptFocusProc) _XtInherit)
+#define XtInheritQueryGeometry ((XtGeometryHandler) _XtInherit)
+#define XtInheritDisplayAccelerator ((XtStringProc) _XtInherit)
+
+/***************************************************************
+ * Widget Core Data Structures
+ *
+ *
+ **************************************************************/
+
+typedef struct _CorePart {
+    Widget	    self;		/* pointer to widget itself	     */
+    WidgetClass	    widget_class;	/* pointer to Widget's ClassRec	     */
+    Widget	    parent;		/* parent widget	  	     */
+    XrmName         xrm_name;		/* widget resource name quarkified   */
+    Boolean         being_destroyed;	/* marked for destroy		     */
+    XtCallbackList  destroy_callbacks;	/* who to call when widget destroyed */
+    XtPointer       constraints;        /* constraint record                 */
+    Position        x, y;		/* window position		     */
+    Dimension       width, height;	/* window dimensions		     */
+    Dimension       border_width;	/* window border width		     */
+    Boolean         managed;            /* is widget geometry managed?       */
+    Boolean	    sensitive;		/* is widget sensitive to user events*/
+    Boolean         ancestor_sensitive;	/* are all ancestors sensitive?      */
+    XtEventTable    event_table;	/* private to event dispatcher       */
+    XtTMRec	    tm;                 /* translation management            */
+    XtTranslations  accelerators;       /* accelerator translations          */
+    Pixel	    border_pixel;	/* window border pixel		     */
+    Pixmap          border_pixmap;	/* window border pixmap or NULL      */
+    WidgetList      popup_list;         /* list of popups                    */
+    Cardinal        num_popups;         /* how many popups                   */
+    String          name;		/* widget resource name		     */
+    Screen	    *screen;		/* window's screen		     */
+    Colormap        colormap;           /* colormap                          */
+    Window	    window;		/* window ID			     */
+    Cardinal        depth;		/* number of planes in window        */
+    Pixel	    background_pixel;	/* window background pixel	     */
+    Pixmap          background_pixmap;	/* window background pixmap or NULL  */
+    Boolean         visible;		/* is window mapped and not occluded?*/
+    Boolean	    mapped_when_managed;/* map window if it's managed?       */
+} CorePart;
+
+typedef struct _WidgetRec {
+    CorePart    core;
+ } WidgetRec, CoreRec;
+
+
+
+/******************************************************************
+ *
+ * Core Class Structure. Widgets, regardless of their class, will have
+ * these fields.  All widgets of a given class will have the same values
+ * for these fields.  Widgets of a given class may also have additional
+ * common fields.  These additional fields are included in incremental
+ * class structures, such as CommandClass.
+ *
+ * The fields that are specific to this subclass, as opposed to fields that
+ * are part of the superclass, are called "subclass fields" below.  Many
+ * procedures are responsible only for the subclass fields, and not for
+ * any superclass fields.
+ *
+ ********************************************************************/
+
+typedef struct _CoreClassPart {
+    WidgetClass     superclass;		/* pointer to superclass ClassRec   */
+    String          class_name;		/* widget resource class name       */
+    Cardinal        widget_size;	/* size in bytes of widget record   */
+    XtProc	    class_initialize;   /* class initialization proc	    */
+    XtWidgetClassProc class_part_initialize; /* dynamic initialization	    */
+    XtEnum          class_inited;       /* has class been initialized?      */
+    XtInitProc      initialize;		/* initialize subclass fields       */
+    XtArgsProc      initialize_hook;    /* notify that initialize called    */
+    XtRealizeProc   realize;		/* XCreateWindow for widget	    */
+    XtActionList    actions;		/* widget semantics name to proc map */
+    Cardinal	    num_actions;	/* number of entries in actions     */
+    XtResourceList  resources;		/* resources for subclass fields    */
+    Cardinal        num_resources;      /* number of entries in resources   */
+    XrmClass        xrm_class;		/* resource class quarkified	    */
+    Boolean         compress_motion;    /* compress MotionNotify for widget */
+    XtEnum          compress_exposure;  /* compress Expose events for widget*/
+    Boolean         compress_enterleave;/* compress enter and leave events  */
+    Boolean         visible_interest;   /* select for VisibilityNotify      */
+    XtWidgetProc    destroy;		/* free data for subclass pointers  */
+    XtWidgetProc    resize;		/* geom manager changed widget size */
+    XtExposeProc    expose;		/* rediplay window		    */
+    XtSetValuesFunc set_values;		/* set subclass resource values     */
+    XtArgsFunc      set_values_hook;    /* notify that set_values called    */
+    XtAlmostProc    set_values_almost;  /* set_values got "Almost" geo reply */
+    XtArgsProc      get_values_hook;    /* notify that get_values called    */
+    XtAcceptFocusProc accept_focus;     /* assign input focus to widget     */
+    XtVersionType   version;	        /* version of intrinsics used	    */
+    XtPointer       callback_private;   /* list of callback offsets       */
+    String          tm_table;           /* state machine                    */
+    XtGeometryHandler query_geometry;	/* return preferred geometry        */
+    XtStringProc    display_accelerator;/* display your accelerator	    */
+    XtPointer	    extension;		/* pointer to extension record      */
+ } CoreClassPart;
+
+typedef struct _WidgetClassRec {
+    CoreClassPart core_class;
+} WidgetClassRec, CoreClassRec;
+
+externalref WidgetClassRec widgetClassRec;
+#define coreClassRec widgetClassRec
+
+_XFUNCPROTOEND
+
+#endif /* _XtCoreP_h */
+/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/ThirdParty/X11/Include/X11/CreateI.h b/ThirdParty/X11/Include/X11/CreateI.h
new file mode 100644
index 0000000000000000000000000000000000000000..e00ba655076a21a1ae9b268c7992fd977f54d84d
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/CreateI.h
@@ -0,0 +1,42 @@
+#ifndef _XtcreateI_h
+#define _XtcreateI_h
+
+_XFUNCPROTOBEGIN
+
+extern Widget _XtCreateWidget(String name, WidgetClass widget_class,
+			      Widget parent, ArgList args, Cardinal num_args,
+			      XtTypedArgList typed_args,
+			      Cardinal num_typed_args);
+extern Widget _XtCreatePopupShell(String name, WidgetClass widget_class,
+				  Widget parent, ArgList args,
+				  Cardinal num_args, XtTypedArgList typed_args,
+				  Cardinal num_typed_args);
+extern Widget _XtAppCreateShell(String name, String class,
+				WidgetClass widget_class, Display *display,
+				ArgList args, Cardinal num_args,
+				XtTypedArgList typed_args,
+				Cardinal num_typed_args);
+extern Widget _XtCreateHookObj(Screen *screen);
+
+_XFUNCPROTOEND
+
+#include <stdarg.h>
+
+_XFUNCPROTOBEGIN
+
+/* VarCreate.c */
+extern Widget _XtVaOpenApplication(XtAppContext *app_context_return,
+			_Xconst char* application_class,
+			XrmOptionDescList options, Cardinal num_options,
+			int *argc_in_out, String *argv_in_out,
+			String *fallback_resources, WidgetClass widget_class,
+			va_list var_args);
+extern Widget _XtVaAppInitialize(XtAppContext *app_context_return,
+			_Xconst char* application_class,
+			XrmOptionDescList options, Cardinal num_options,
+			int *argc_in_out, String *argv_in_out,
+			String *fallback_resources, va_list var_args);
+
+_XFUNCPROTOEND
+
+#endif /* _XtcreateI_h */
diff --git a/ThirdParty/X11/Include/X11/DECkeysym.h b/ThirdParty/X11/Include/X11/DECkeysym.h
new file mode 100644
index 0000000000000000000000000000000000000000..07307169d39af3c9317eb76a06c0375236f03747
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/DECkeysym.h
@@ -0,0 +1,65 @@
+/***********************************************************
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ * DEC private keysyms
+ * (29th bit set)
+ */
+
+/* two-key compose sequence initiators, chosen to map to Latin1 characters */
+
+#define DXK_ring_accent         0x1000FEB0
+#define DXK_circumflex_accent   0x1000FE5E
+#define DXK_cedilla_accent      0x1000FE2C
+#define DXK_acute_accent        0x1000FE27
+#define DXK_grave_accent        0x1000FE60
+#define DXK_tilde               0x1000FE7E
+#define DXK_diaeresis           0x1000FE22
+
+/* special keysym for LK2** "Remove" key on editing keypad */
+
+#define DXK_Remove	0x1000FF00   /* Remove */
diff --git a/ThirdParty/X11/Include/X11/EventI.h b/ThirdParty/X11/Include/X11/EventI.h
new file mode 100644
index 0000000000000000000000000000000000000000..4aae5af43f3ffef136cce8cd2bcf25cb8f891bf3
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/EventI.h
@@ -0,0 +1,134 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ * Event.h - exported types and functions for toolkit event handler
+ *
+ * Author:	Charles Haynes
+ * 		Digital Equipment Corporation
+ * 		Western Software Laboratory
+ * Date:	Sun Dec  6 1987
+ */
+
+#ifndef _Event_h_
+#define _Event_h_
+
+typedef struct _XtGrabRec  *XtGrabList;
+
+#include "PassivGraI.h"
+
+_XFUNCPROTOBEGIN
+
+extern void _XtEventInitialize(
+    void
+);
+
+typedef struct _XtEventRec {
+     XtEventTable	next;
+     EventMask		mask;	/*  also select_data count for RecExt */
+     XtEventHandler	proc;
+     XtPointer		closure;
+     unsigned int	select:1;
+     unsigned int	has_type_specifier:1;
+     unsigned int	async:1; /* not used, here for Digital extension? */
+} XtEventRec;
+
+typedef struct _XtGrabRec {
+    XtGrabList next;
+    Widget   widget;
+    unsigned int exclusive:1;
+    unsigned int spring_loaded:1;
+}XtGrabRec;
+
+typedef struct _BlockHookRec {
+    struct _BlockHookRec* next;
+    XtAppContext app;
+    XtBlockHookProc proc;
+    XtPointer closure;
+} BlockHookRec, *BlockHook;
+
+extern void _XtFreeEventTable(
+    XtEventTable*	/* event_table */
+);
+
+extern Boolean _XtOnGrabList(
+    Widget	/* widget */,
+    XtGrabRec*	/* grabList */
+);
+
+extern void _XtRemoveAllInputs(
+    XtAppContext /* app */
+);
+
+extern void _XtRefreshMapping(
+    XEvent*	/* event */,
+    _XtBoolean	/* dispatch */
+);
+
+extern void _XtSendFocusEvent(
+    Widget	/* child */,
+    int		/* type */);
+
+extern EventMask _XtConvertTypeToMask(
+    int		/* eventType */
+);
+
+/* EventUtil.c */
+extern Widget _XtFindRemapWidget(XEvent *event, Widget widget,
+				 EventMask mask, XtPerDisplayInput pdi);
+extern void _XtUngrabBadGrabs(XEvent *event, Widget widget,
+				 EventMask mask, XtPerDisplayInput pdi);
+extern void _XtFillAncestorList(Widget **listPtr, int *maxElemsPtr,
+				int *numElemsPtr, Widget start,
+				Widget breakWidget);
+
+/* NextEvent.c */
+extern Boolean XtAppPeekEvent_SkipTimer;
+
+_XFUNCPROTOEND
+
+#endif /* _Event_h_ */
diff --git a/ThirdParty/X11/Include/X11/HPkeysym.h b/ThirdParty/X11/Include/X11/HPkeysym.h
new file mode 100644
index 0000000000000000000000000000000000000000..4a0655a237600d2a57435b9d63bc75614751c79b
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/HPkeysym.h
@@ -0,0 +1,164 @@
+/*
+
+Copyright 1987, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Hewlett Packard
+or Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+
+*/
+
+#ifndef _HPKEYSYM_H
+
+#define _HPKEYSYM_H
+
+#define hpXK_ClearLine		0x1000FF6F
+#define hpXK_InsertLine		0x1000FF70
+#define hpXK_DeleteLine		0x1000FF71
+#define hpXK_InsertChar		0x1000FF72
+#define hpXK_DeleteChar		0x1000FF73
+#define hpXK_BackTab		0x1000FF74
+#define hpXK_KP_BackTab		0x1000FF75
+#define hpXK_Modelock1		0x1000FF48
+#define hpXK_Modelock2		0x1000FF49
+#define hpXK_Reset		0x1000FF6C
+#define hpXK_System		0x1000FF6D
+#define hpXK_User		0x1000FF6E
+#define hpXK_mute_acute		0x100000A8
+#define hpXK_mute_grave		0x100000A9
+#define hpXK_mute_asciicircum	0x100000AA
+#define hpXK_mute_diaeresis	0x100000AB
+#define hpXK_mute_asciitilde	0x100000AC
+#define hpXK_lira		0x100000AF
+#define hpXK_guilder		0x100000BE
+#define hpXK_Ydiaeresis		0x100000EE
+#define hpXK_IO			0x100000EE
+#define hpXK_longminus		0x100000F6
+#define hpXK_block		0x100000FC
+
+
+#ifndef _OSF_Keysyms
+#define _OSF_Keysyms
+
+#define osfXK_Copy		0x1004FF02
+#define osfXK_Cut		0x1004FF03
+#define osfXK_Paste		0x1004FF04
+#define osfXK_BackTab		0x1004FF07
+#define osfXK_BackSpace		0x1004FF08
+#define osfXK_Clear		0x1004FF0B
+#define osfXK_Escape		0x1004FF1B
+#define osfXK_AddMode		0x1004FF31
+#define osfXK_PrimaryPaste	0x1004FF32
+#define osfXK_QuickPaste	0x1004FF33
+#define osfXK_PageLeft		0x1004FF40
+#define osfXK_PageUp		0x1004FF41
+#define osfXK_PageDown		0x1004FF42
+#define osfXK_PageRight		0x1004FF43
+#define osfXK_Activate		0x1004FF44
+#define osfXK_MenuBar		0x1004FF45
+#define osfXK_Left		0x1004FF51
+#define osfXK_Up		0x1004FF52
+#define osfXK_Right		0x1004FF53
+#define osfXK_Down		0x1004FF54
+#define osfXK_EndLine		0x1004FF57
+#define osfXK_BeginLine		0x1004FF58
+#define osfXK_EndData		0x1004FF59
+#define osfXK_BeginData		0x1004FF5A
+#define osfXK_PrevMenu		0x1004FF5B
+#define osfXK_NextMenu		0x1004FF5C
+#define osfXK_PrevField		0x1004FF5D
+#define osfXK_NextField		0x1004FF5E
+#define osfXK_Select		0x1004FF60
+#define osfXK_Insert		0x1004FF63
+#define osfXK_Undo		0x1004FF65
+#define osfXK_Menu		0x1004FF67
+#define osfXK_Cancel		0x1004FF69
+#define osfXK_Help		0x1004FF6A
+#define osfXK_SelectAll		0x1004FF71
+#define osfXK_DeselectAll	0x1004FF72
+#define osfXK_Reselect		0x1004FF73
+#define osfXK_Extend		0x1004FF74
+#define osfXK_Restore		0x1004FF78
+#define osfXK_Delete		0x1004FFFF
+
+#endif /* _OSF_Keysyms */
+
+
+/**************************************************************
+ * The use of the following macros is deprecated.
+ * They are listed below only for backwards compatibility.
+ */
+#define XK_Reset                0x1000FF6C
+#define XK_System               0x1000FF6D
+#define XK_User                 0x1000FF6E
+#define XK_ClearLine            0x1000FF6F
+#define XK_InsertLine           0x1000FF70
+#define XK_DeleteLine           0x1000FF71
+#define XK_InsertChar           0x1000FF72
+#define XK_DeleteChar           0x1000FF73
+#define XK_BackTab              0x1000FF74
+#define XK_KP_BackTab           0x1000FF75
+#define XK_Ext16bit_L           0x1000FF76
+#define XK_Ext16bit_R           0x1000FF77
+#define XK_mute_acute           0x100000a8
+#define XK_mute_grave           0x100000a9
+#define XK_mute_asciicircum     0x100000aa
+#define XK_mute_diaeresis       0x100000ab
+#define XK_mute_asciitilde      0x100000ac
+#define XK_lira                 0x100000af
+#define XK_guilder              0x100000be
+#ifndef XK_Ydiaeresis
+#define XK_Ydiaeresis           0x100000ee
+#endif
+#define XK_IO                   0x100000ee
+#define XK_longminus            0x100000f6
+#define XK_block                0x100000fc
+
+#endif /* _HPKEYSYM_H */
diff --git a/ThirdParty/X11/Include/X11/HookObjI.h b/ThirdParty/X11/Include/X11/HookObjI.h
new file mode 100644
index 0000000000000000000000000000000000000000..94c0cbbf80935f2f936c7d0afdcf28bd68cdfa60
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/HookObjI.h
@@ -0,0 +1,73 @@
+/*
+
+Copyright 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _XtHookObjI_h
+#define _XtHookObjI_h
+
+_XFUNCPROTOBEGIN
+
+/* This object is implementation-dependent and private to the library. */
+
+typedef struct _HookObjRec *HookObject;
+typedef struct _HookObjClassRec *HookObjectClass;
+
+externalref WidgetClass hookObjectClass;
+
+typedef struct _HookObjPart {
+    /* resources */
+    XtCallbackList createhook_callbacks;
+    XtCallbackList changehook_callbacks;
+    XtCallbackList confighook_callbacks;
+    XtCallbackList geometryhook_callbacks;
+    XtCallbackList destroyhook_callbacks;
+    WidgetList shells;
+    Cardinal num_shells;
+    /* private data */
+    Cardinal max_shells;
+    Screen* screen;
+}HookObjPart;
+
+typedef struct _HookObjRec {
+    ObjectPart object;
+    HookObjPart hooks;
+} HookObjRec;
+
+typedef struct _HookObjClassPart {
+    int unused;
+} HookObjClassPart;
+
+typedef struct _HookObjClassRec {
+    ObjectClassPart object_class;
+    HookObjClassPart hook_class;
+} HookObjClassRec;
+
+externalref HookObjClassRec hookObjClassRec;
+
+_XFUNCPROTOEND
+
+#endif /* ifndef _Xt_HookObjI_h */
+
+
diff --git a/ThirdParty/X11/Include/X11/ICE/ICE.h b/ThirdParty/X11/Include/X11/ICE/ICE.h
new file mode 100644
index 0000000000000000000000000000000000000000..7560647ed836b4f37891144a82f6dd90c4806a40
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/ICE/ICE.h
@@ -0,0 +1,101 @@
+/******************************************************************************
+
+
+Copyright 1993, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Author: Ralph Mor, X Consortium
+
+******************************************************************************/
+
+#ifndef _ICE_H_
+#define _ICE_H_
+
+/*
+ * Protocol Version
+ */
+
+#define IceProtoMajor 1
+#define IceProtoMinor 0
+
+
+/*
+ * Byte Order
+ */
+
+#define IceLSBfirst		0
+#define IceMSBfirst		1
+
+
+/*
+ * ICE minor opcodes
+ */
+
+#define ICE_Error 		0
+#define ICE_ByteOrder		1
+#define ICE_ConnectionSetup	2
+#define ICE_AuthRequired	3
+#define ICE_AuthReply 		4
+#define ICE_AuthNextPhase	5
+#define ICE_ConnectionReply	6
+#define ICE_ProtocolSetup	7
+#define ICE_ProtocolReply	8
+#define ICE_Ping		9
+#define ICE_PingReply		10
+#define ICE_WantToClose		11
+#define ICE_NoClose		12
+
+
+/*
+ * Error severity
+ */
+
+#define IceCanContinue		0
+#define IceFatalToProtocol	1
+#define IceFatalToConnection	2
+
+
+/*
+ * ICE error classes that are common to all protocols
+ */
+
+#define IceBadMinor	0x8000
+#define IceBadState	0x8001
+#define IceBadLength	0x8002
+#define IceBadValue	0x8003
+
+
+/*
+ * ICE error classes that are specific to the ICE protocol
+ */
+
+#define IceBadMajor			0
+#define IceNoAuth			1
+#define IceNoVersion			2
+#define IceSetupFailed			3
+#define IceAuthRejected			4
+#define IceAuthFailed			5
+#define IceProtocolDuplicate		6
+#define IceMajorOpcodeDuplicate		7
+#define IceUnknownProtocol		8
+
+#endif /* _ICE_H_ */
diff --git a/ThirdParty/X11/Include/X11/ICE/ICEconn.h b/ThirdParty/X11/Include/X11/ICE/ICEconn.h
new file mode 100644
index 0000000000000000000000000000000000000000..e5d493a045a9081e7f4a95ccd7a217a65d827d31
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/ICE/ICEconn.h
@@ -0,0 +1,250 @@
+/******************************************************************************
+
+
+Copyright 1993, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Author: Ralph Mor, X Consortium
+******************************************************************************/
+
+#ifndef _ICECONN_H_
+#define _ICECONN_H_
+
+#include <X11/ICE/ICElib.h>
+
+/*
+ * Data structures for ICE connection object
+ */
+
+typedef struct _IceSavedReplyWait {
+    IceReplyWaitInfo		*reply_wait;
+    Bool			reply_ready;
+    struct _IceSavedReplyWait	*next;
+} _IceSavedReplyWait;
+
+typedef struct _IcePingWait {
+    IcePingReplyProc		ping_reply_proc;
+    IcePointer			client_data;
+    struct _IcePingWait 	*next;
+} _IcePingWait;
+
+typedef struct {
+    char		*vendor;
+    char		*release;
+    int			version_count;
+    IcePoVersionRec	*version_recs;
+    int			auth_count;
+    char		**auth_names;
+    IcePoAuthProc	*auth_procs;
+    IceIOErrorProc	io_error_proc;
+} _IcePoProtocol;
+
+typedef struct {
+    char			*vendor;
+    char			*release;
+    int				version_count;
+    IcePaVersionRec		*version_recs;
+    IceProtocolSetupProc	protocol_setup_proc;
+    IceProtocolActivateProc	protocol_activate_proc;
+    int				auth_count;
+    char			**auth_names;
+    IcePaAuthProc		*auth_procs;
+    IceHostBasedAuthProc	host_based_auth_proc;
+    IceIOErrorProc		io_error_proc;
+} _IcePaProtocol;
+
+typedef struct {
+    char		*protocol_name;
+    _IcePoProtocol	*orig_client;
+    _IcePaProtocol   	*accept_client;
+} _IceProtocol;
+
+typedef struct {
+    Bool			in_use;
+    int				my_opcode;
+    _IceProtocol		*protocol;
+    IcePointer			client_data;
+    Bool			accept_flag;
+    union {
+	IcePaProcessMsgProc	accept_client;
+	IcePoProcessMsgProc	orig_client;
+    } process_msg_proc;
+} _IceProcessMsgInfo;
+
+typedef struct {
+    int		his_version_index;
+    int		my_version_index;
+    char	*his_vendor;
+    char	*his_release;
+    char	my_auth_index;
+    IcePointer 	my_auth_state;
+    Bool	must_authenticate;
+} _IceConnectToMeInfo;
+
+typedef struct {
+    int		his_opcode;
+    int		my_opcode;
+    int		his_version_index;
+    int		my_version_index;
+    char	*his_vendor;
+    char	*his_release;
+    char	my_auth_index;
+    IcePointer 	my_auth_state;
+    Bool	must_authenticate;
+} _IceProtoSetupToMeInfo;
+
+typedef struct {
+    Bool 	auth_active;
+    char	my_auth_index;
+    IcePointer 	my_auth_state;
+} _IceConnectToYouInfo;
+
+typedef struct {
+    int		my_opcode;
+    int		my_auth_count;
+    int		*my_auth_indices;
+    Bool 	auth_active;
+    char	my_auth_index;
+    IcePointer	my_auth_state;
+} _IceProtoSetupToYouInfo;
+
+
+struct _IceConn {
+
+    unsigned int io_ok : 1;		     /* did an IO error occur? */
+    unsigned int swap : 1;  		     /* do we need to swap on reads? */
+    unsigned int waiting_for_byteorder : 1;  /* waiting for a ByteOrder msg? */
+    unsigned int skip_want_to_close : 1;     /* avoid shutdown negotiation? */
+    unsigned int want_to_close : 1;	     /* did we send a WantToClose? */
+    unsigned int free_asap : 1;		     /* free as soon as possible */
+    unsigned int unused1 : 2;		     /* future use */
+    unsigned int unused2 : 8;		     /* future use */
+
+    IceConnectStatus connection_status; /* pending, accepted, rejected */
+
+    unsigned char my_ice_version_index; /* which version are we using? */
+
+    struct _XtransConnInfo *trans_conn; /* transport connection object */
+    unsigned long send_sequence;     	/* Sequence # of last msg sent */
+    unsigned long receive_sequence;    	/* Sequence # of last msg received */
+
+    char *connection_string;		/* network connection string */
+    char *vendor;			/* other client's vendor */
+    char *release;			/* other client's release */
+
+    char *inbuf;			/* Input buffer starting address */
+    char *inbufptr;			/* Input buffer index pointer */
+    char *inbufmax;			/* Input buffer maximum+1 address */
+
+    char *outbuf;			/* Output buffer starting address */
+    char *outbufptr;			/* Output buffer index pointer */
+    char *outbufmax;			/* Output buffer maximum+1 address */
+
+    char *scratch;			/* scratch buffer */
+    unsigned long scratch_size;		/* scratch size */
+
+    int dispatch_level;			/* IceProcessMessages dispatch level */
+
+    IcePointer context;			/* context associated with caller
+					   of IceOpenConnection */
+
+    /*
+     * Before we read a message, the major opcode of the message must be
+     * mapped to our corresponding major opcode (the two clients can use
+     * different opcodes for the same protocol).  In order to save space,
+     * we keep track of the mininum and maximum major opcodes used by the
+     * other client.  To get the information on how to process this message,
+     * we do the following...
+     *
+     * processMsgInfo = iceConn->process_msg_info[
+     *     message->majorOpcode - iceConn->his_min_opcode]
+     *
+     * Note that the number of elements in the iceConn->process_msg_info
+     * array is always (iceConn->his_max_opcode - iceConn->his_min_opcode + 1).
+     * We check process_msg_info->in_use to see if the opcode is being used.
+     */
+
+    _IceProcessMsgInfo		*process_msg_info;
+    char 			his_min_opcode;   /* [1..255] */
+    char			his_max_opcode;	  /* [1..255] */
+
+
+    /*
+     * Number of times this iceConn was returned in IceOpenConnection
+     * or IceAcceptConnection.
+     */
+
+    unsigned char		open_ref_count;
+
+
+    /*
+     * Number of active protocols.
+     */
+
+    unsigned char		proto_ref_count;
+
+
+    /*
+     * If this ICE connection was created with IceAcceptConnection,
+     * the listen_obj field is set to the listen object.  Otherwise,
+     * the listen_obj field is NULL.
+     */
+
+    IceListenObj		listen_obj;
+
+
+
+
+    /*
+     * We need to keep track of all the replies we're waiting for.
+     * Check the comments in process.c for how this works.
+     */
+
+    _IceSavedReplyWait		*saved_reply_waits;
+
+
+    /*
+     * We keep track of all Pings sent from the client.  When the Ping reply
+     * arrives, we remove it from the list.
+     */
+
+    _IcePingWait		*ping_waits;
+
+
+    /*
+     * Some state for a client doing a Connection/Protocol Setup
+     */
+
+    _IceConnectToYouInfo	*connect_to_you;
+    _IceProtoSetupToYouInfo	*protosetup_to_you;
+
+
+    /*
+     * Some state for a client receiving a Connection/Protocol Setup
+     */
+
+    _IceConnectToMeInfo		*connect_to_me;
+    _IceProtoSetupToMeInfo	*protosetup_to_me;
+
+};
+
+#endif /* _ICECONN_H_ */
diff --git a/ThirdParty/X11/Include/X11/ICE/ICElib.h b/ThirdParty/X11/Include/X11/ICE/ICElib.h
new file mode 100644
index 0000000000000000000000000000000000000000..402cbc8bd61e8706068a1c6c3d9ebbc7cf64091b
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/ICE/ICElib.h
@@ -0,0 +1,431 @@
+/******************************************************************************
+
+
+Copyright 1993, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Author: Ralph Mor, X Consortium
+******************************************************************************/
+
+#ifndef _ICELIB_H_
+#define _ICELIB_H_
+
+#include <X11/ICE/ICE.h>
+#include <X11/Xfuncproto.h>
+
+#define Bool int
+#define Status int
+#define True 1
+#define False 0
+
+typedef void *IcePointer;
+
+typedef enum {
+    IcePoAuthHaveReply,
+    IcePoAuthRejected,
+    IcePoAuthFailed,
+    IcePoAuthDoneCleanup
+} IcePoAuthStatus;
+
+typedef enum {
+    IcePaAuthContinue,
+    IcePaAuthAccepted,
+    IcePaAuthRejected,
+    IcePaAuthFailed
+} IcePaAuthStatus;
+
+typedef enum {
+    IceConnectPending,
+    IceConnectAccepted,
+    IceConnectRejected,
+    IceConnectIOError
+} IceConnectStatus;
+
+typedef enum {
+    IceProtocolSetupSuccess,
+    IceProtocolSetupFailure,
+    IceProtocolSetupIOError,
+    IceProtocolAlreadyActive
+} IceProtocolSetupStatus;
+
+typedef enum {
+    IceAcceptSuccess,
+    IceAcceptFailure,
+    IceAcceptBadMalloc
+} IceAcceptStatus;
+
+typedef enum {
+    IceClosedNow,
+    IceClosedASAP,
+    IceConnectionInUse,
+    IceStartedShutdownNegotiation
+} IceCloseStatus;
+
+typedef enum {
+    IceProcessMessagesSuccess,
+    IceProcessMessagesIOError,
+    IceProcessMessagesConnectionClosed
+} IceProcessMessagesStatus;
+
+typedef struct {
+    unsigned long	sequence_of_request;
+    int			major_opcode_of_request;
+    int			minor_opcode_of_request;
+    IcePointer		reply;
+} IceReplyWaitInfo;
+
+typedef struct _IceConn *IceConn;
+typedef struct _IceListenObj *IceListenObj;
+
+typedef void (*IceWatchProc) (
+    IceConn		/* iceConn */,
+    IcePointer		/* clientData */,
+    Bool		/* opening */,
+    IcePointer *	/* watchData */
+);
+
+typedef void (*IcePoProcessMsgProc) (
+    IceConn 		/* iceConn */,
+    IcePointer		/* clientData */,
+    int			/* opcode */,
+    unsigned long	/* length */,
+    Bool		/* swap */,
+    IceReplyWaitInfo *  /* replyWait */,
+    Bool *		/* replyReadyRet */
+);
+
+typedef void (*IcePaProcessMsgProc) (
+    IceConn 		/* iceConn */,
+    IcePointer		/* clientData */,
+    int			/* opcode */,
+    unsigned long	/* length */,
+    Bool		/* swap */
+);
+
+typedef struct {
+    int			 major_version;
+    int			 minor_version;
+    IcePoProcessMsgProc  process_msg_proc;
+} IcePoVersionRec;
+
+typedef struct {
+    int			 major_version;
+    int			 minor_version;
+    IcePaProcessMsgProc  process_msg_proc;
+} IcePaVersionRec;
+
+typedef IcePoAuthStatus (*IcePoAuthProc) (
+    IceConn		/* iceConn */,
+    IcePointer *	/* authStatePtr */,
+    Bool		/* cleanUp */,
+    Bool		/* swap */,
+    int			/* authDataLen */,
+    IcePointer		/* authData */,
+    int *		/* replyDataLenRet */,
+    IcePointer *	/* replyDataRet */,
+    char **		/* errorStringRet */
+);
+
+typedef IcePaAuthStatus (*IcePaAuthProc) (
+    IceConn		/* iceConn */,
+    IcePointer *	/* authStatePtr */,
+    Bool		/* swap */,
+    int			/* authDataLen */,
+    IcePointer		/* authData */,
+    int *		/* replyDataLenRet */,
+    IcePointer *	/* replyDataRet */,
+    char **		/* errorStringRet */
+);
+
+typedef Bool (*IceHostBasedAuthProc) (
+    char *		/* hostName */
+);
+
+typedef Status (*IceProtocolSetupProc) (
+    IceConn 		/* iceConn */,
+    int			/* majorVersion */,
+    int			/* minorVersion */,
+    char *		/* vendor */,
+    char *		/* release */,
+    IcePointer *	/* clientDataRet */,
+    char **		/* failureReasonRet */
+);
+
+typedef void (*IceProtocolActivateProc) (
+    IceConn 		/* iceConn */,
+    IcePointer		/* clientData */
+);
+
+typedef void (*IceIOErrorProc) (
+    IceConn 		/* iceConn */
+);
+
+typedef void (*IcePingReplyProc) (
+    IceConn 		/* iceConn */,
+    IcePointer		/* clientData */
+);
+
+typedef void (*IceErrorHandler) (
+    IceConn 		/* iceConn */,
+    Bool		/* swap */,
+    int			/* offendingMinorOpcode */,
+    unsigned long 	/* offendingSequence */,
+    int 		/* errorClass */,
+    int			/* severity */,
+    IcePointer		/* values */
+);
+
+typedef void (*IceIOErrorHandler) (
+    IceConn 		/* iceConn */
+);
+
+
+/*
+ * Function prototypes
+ */
+
+_XFUNCPROTOBEGIN
+
+extern int IceRegisterForProtocolSetup (
+    const char *		/* protocolName */,
+    const char *		/* vendor */,
+    const char *		/* release */,
+    int				/* versionCount */,
+    IcePoVersionRec *		/* versionRecs */,
+    int				/* authCount */,
+    const char **		/* authNames */,
+    IcePoAuthProc *		/* authProcs */,
+    IceIOErrorProc		/* IOErrorProc */
+);
+
+extern int IceRegisterForProtocolReply (
+    const char *		/* protocolName */,
+    const char *		/* vendor */,
+    const char *		/* release */,
+    int				/* versionCount */,
+    IcePaVersionRec *		/* versionRecs */,
+    int				/* authCount */,
+    const char **		/* authNames */,
+    IcePaAuthProc *		/* authProcs */,
+    IceHostBasedAuthProc	/* hostBasedAuthProc */,
+    IceProtocolSetupProc	/* protocolSetupProc */,
+    IceProtocolActivateProc	/* protocolActivateProc */,
+    IceIOErrorProc		/* IOErrorProc */
+);
+
+extern IceConn IceOpenConnection (
+    char *		/* networkIdsList */,
+    IcePointer		/* context */,
+    Bool		/* mustAuthenticate */,
+    int			/* majorOpcodeCheck */,
+    int			/* errorLength */,
+    char *		/* errorStringRet */
+);
+
+extern IcePointer IceGetConnectionContext (
+    IceConn		/* iceConn */
+);
+
+extern Status IceListenForConnections (
+    int *		/* countRet */,
+    IceListenObj **	/* listenObjsRet */,
+    int			/* errorLength */,
+    char *		/* errorStringRet */
+);
+
+extern Status IceListenForWellKnownConnections (
+    char *		/* port */,
+    int *		/* countRet */,
+    IceListenObj **	/* listenObjsRet */,
+    int			/* errorLength */,
+    char *		/* errorStringRet */
+);
+
+extern int IceGetListenConnectionNumber (
+    IceListenObj	/* listenObj */
+);
+
+extern char *IceGetListenConnectionString (
+    IceListenObj	/* listenObj */
+);
+
+extern char *IceComposeNetworkIdList (
+    int			/* count */,
+    IceListenObj *	/* listenObjs */
+);
+
+extern void IceFreeListenObjs (
+    int			/* count */,
+    IceListenObj *	/* listenObjs */
+);
+
+extern void IceSetHostBasedAuthProc (
+    IceListenObj		/* listenObj */,
+    IceHostBasedAuthProc   	/* hostBasedAuthProc */
+);
+
+extern IceConn IceAcceptConnection (
+    IceListenObj	/* listenObj */,
+    IceAcceptStatus *	/* statusRet */
+);
+
+extern void IceSetShutdownNegotiation (
+    IceConn		/* iceConn */,
+    Bool		/* negotiate */
+);
+
+extern Bool IceCheckShutdownNegotiation (
+    IceConn		/* iceConn */
+);
+
+extern IceCloseStatus IceCloseConnection (
+    IceConn		/* iceConn */
+);
+
+extern Status IceAddConnectionWatch (
+    IceWatchProc		/* watchProc */,
+    IcePointer			/* clientData */
+);
+
+extern void IceRemoveConnectionWatch (
+    IceWatchProc		/* watchProc */,
+    IcePointer			/* clientData */
+);
+
+extern IceProtocolSetupStatus IceProtocolSetup (
+    IceConn		/* iceConn */,
+    int 		/* myOpcode */,
+    IcePointer		/* clientData */,
+    Bool		/* mustAuthenticate */,
+    int	*		/* majorVersionRet */,
+    int	*		/* minorVersionRet */,
+    char **		/* vendorRet */,
+    char **		/* releaseRet */,
+    int			/* errorLength */,
+    char *		/* errorStringRet */
+);
+
+extern Status IceProtocolShutdown (
+    IceConn		/* iceConn */,
+    int			/* majorOpcode */
+);
+
+extern IceProcessMessagesStatus IceProcessMessages (
+    IceConn		/* iceConn */,
+    IceReplyWaitInfo *	/* replyWait */,
+    Bool *		/* replyReadyRet */
+);
+
+extern Status IcePing (
+   IceConn		/* iceConn */,
+   IcePingReplyProc	/* pingReplyProc */,
+   IcePointer		/* clientData */
+);
+
+extern char *IceAllocScratch (
+   IceConn		/* iceConn */,
+   unsigned long	/* size */
+);
+
+extern int IceFlush (
+   IceConn		/* iceConn */
+);
+
+extern int IceGetOutBufSize (
+   IceConn		/* iceConn */
+);
+
+extern int IceGetInBufSize (
+   IceConn		/* iceConn */
+);
+
+extern IceConnectStatus IceConnectionStatus (
+    IceConn		/* iceConn */
+);
+
+extern char *IceVendor (
+    IceConn		/* iceConn */
+);
+
+extern char *IceRelease (
+    IceConn		/* iceConn */
+);
+
+extern int IceProtocolVersion (
+    IceConn		/* iceConn */
+);
+
+extern int IceProtocolRevision (
+    IceConn		/* iceConn */
+);
+
+extern int IceConnectionNumber (
+    IceConn		/* iceConn */
+);
+
+extern char *IceConnectionString (
+    IceConn		/* iceConn */
+);
+
+extern unsigned long IceLastSentSequenceNumber (
+    IceConn		/* iceConn */
+);
+
+extern unsigned long IceLastReceivedSequenceNumber (
+    IceConn		/* iceConn */
+);
+
+extern Bool IceSwapping (
+    IceConn		/* iceConn */
+);
+
+extern IceErrorHandler IceSetErrorHandler (
+    IceErrorHandler 	/* handler */
+);
+
+extern IceIOErrorHandler IceSetIOErrorHandler (
+    IceIOErrorHandler 	/* handler */
+);
+
+extern char *IceGetPeerName (
+    IceConn		/* iceConn */
+);
+
+/*
+ * Multithread Routines
+ */
+
+extern Status IceInitThreads (
+    void
+);
+
+extern void IceAppLockConn (
+    IceConn		/* iceConn */
+);
+
+extern void IceAppUnlockConn (
+    IceConn		/* iceConn */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _ICELIB_H_ */
diff --git a/ThirdParty/X11/Include/X11/ICE/ICEmsg.h b/ThirdParty/X11/Include/X11/ICE/ICEmsg.h
new file mode 100644
index 0000000000000000000000000000000000000000..f6e712175c10a5361526e5d5f5e567728c3433b8
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/ICE/ICEmsg.h
@@ -0,0 +1,300 @@
+/******************************************************************************
+
+
+Copyright 1993, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Author: Ralph Mor, X Consortium
+******************************************************************************/
+
+#ifndef _ICEMSG_H_
+#define _ICEMSG_H_
+
+#include <X11/Xfuncproto.h>
+
+#include <X11/ICE/ICEconn.h>
+
+_XFUNCPROTOBEGIN
+
+/*
+ * Function prototypes for internal ICElib functions
+ */
+
+extern Status _IceRead (
+    IceConn		/* iceConn */,
+    unsigned long	/* nbytes */,
+    char *		/* ptr */
+);
+
+extern void _IceReadSkip (
+    IceConn		/* iceConn */,
+    unsigned long	/* nbytes */
+);
+
+extern void _IceWrite (
+    IceConn		/* iceConn */,
+    unsigned long	/* nbytes */,
+    char *		/* ptr */
+);
+
+
+extern void _IceErrorBadMinor (
+    IceConn		/* iceConn */,
+    int			/* majorOpcode */,
+    int			/* offendingMinor */,
+    int			/* severity */
+);
+
+extern void _IceErrorBadState (
+    IceConn		/* iceConn */,
+    int			/* majorOpcode */,
+    int			/* offendingMinor */,
+    int			/* severity */
+);
+
+extern void _IceErrorBadLength (
+    IceConn		/* iceConn */,
+    int			/* majorOpcode */,
+    int			/* offendingMinor */,
+    int			/* severity */
+);
+
+extern void _IceErrorBadValue (
+    IceConn		/* iceConn */,
+    int			/* majorOpcode */,
+    int			/* offendingMinor */,
+    int			/* offset */,
+    int			/* length */,
+    IcePointer		/* value */
+);
+
+extern IcePoAuthStatus _IcePoMagicCookie1Proc (
+    IceConn		/* iceConn */,
+    IcePointer *	/* authStatePtr */,
+    Bool 		/* cleanUp */,
+    Bool		/* swap */,
+    int     		/* authDataLen */,
+    IcePointer		/* authData */,
+    int *		/* replyDataLenRet */,
+    IcePointer *	/* replyDataRet */,
+    char **		/* errorStringRet */
+);
+
+extern IcePaAuthStatus _IcePaMagicCookie1Proc (
+    IceConn		/* iceConn */,
+    IcePointer *	/* authStatePtr */,
+    Bool		/* swap */,
+    int     		/* authDataLen */,
+    IcePointer		/* authData */,
+    int *		/* replyDataLenRet */,
+    IcePointer *	/* replyDataRet */,
+    char **		/* errorStringRet */
+);
+
+
+/*
+ * Macro to check if IO operations are valid on an ICE connection.
+ */
+
+#define IceValidIO(_iceConn) _iceConn->io_ok
+
+
+/*
+ * Macros for writing messages.
+ */
+
+#define IceGetHeader(_iceConn, _major, _minor, _headerSize, _msgType, _pMsg) \
+    if ((_iceConn->outbufptr + _headerSize) > _iceConn->outbufmax) \
+        IceFlush (_iceConn); \
+    _pMsg = (_msgType *) _iceConn->outbufptr; \
+    _pMsg->majorOpcode = _major; \
+    _pMsg->minorOpcode = _minor; \
+    _pMsg->length = (_headerSize - SIZEOF (iceMsg)) >> 3; \
+    _iceConn->outbufptr += _headerSize; \
+    _iceConn->send_sequence++
+
+#define IceGetHeaderExtra(_iceConn, _major, _minor, _headerSize, _extra, _msgType, _pMsg, _pData) \
+    if ((_iceConn->outbufptr + \
+	_headerSize + ((_extra) << 3)) > _iceConn->outbufmax) \
+        IceFlush (_iceConn); \
+    _pMsg = (_msgType *) _iceConn->outbufptr; \
+    if ((_iceConn->outbufptr + \
+	_headerSize + ((_extra) << 3)) <= _iceConn->outbufmax) \
+        _pData = (char *) _pMsg + _headerSize; \
+    else \
+        _pData = NULL; \
+    _pMsg->majorOpcode = _major; \
+    _pMsg->minorOpcode = _minor; \
+    _pMsg->length = ((_headerSize - SIZEOF (iceMsg)) >> 3) + (_extra); \
+    _iceConn->outbufptr += (_headerSize + ((_extra) << 3)); \
+    _iceConn->send_sequence++
+
+#define IceSimpleMessage(_iceConn, _major, _minor) \
+{ \
+    iceMsg *_pMsg; \
+    IceGetHeader (_iceConn, _major, _minor, SIZEOF (iceMsg), iceMsg, _pMsg); \
+}
+
+#define IceErrorHeader(_iceConn, _offendingMajorOpcode, _offendingMinorOpcode, _offendingSequenceNum, _severity, _errorClass, _dataLength) \
+{ \
+    iceErrorMsg	*_pMsg; \
+\
+    IceGetHeader (_iceConn, _offendingMajorOpcode, ICE_Error, \
+	SIZEOF (iceErrorMsg), iceErrorMsg, _pMsg); \
+    _pMsg->length += (_dataLength); \
+    _pMsg->offendingMinorOpcode = (CARD8) _offendingMinorOpcode; \
+    _pMsg->severity = (CARD8) _severity; \
+    _pMsg->offendingSequenceNum = (CARD32) _offendingSequenceNum; \
+    _pMsg->errorClass = (CARD16) _errorClass; \
+}
+
+
+/*
+ * Write data into the ICE output buffer.
+ */
+
+#define IceWriteData(_iceConn, _bytes, _data) \
+{ \
+    if ((_iceConn->outbufptr + (_bytes)) > _iceConn->outbufmax) \
+    { \
+	IceFlush (_iceConn); \
+        _IceWrite (_iceConn, (unsigned long) (_bytes), _data); \
+    } \
+    else \
+    { \
+        memcpy (_iceConn->outbufptr, _data, _bytes); \
+        _iceConn->outbufptr += (_bytes); \
+    } \
+}
+
+#define IceWriteData16(_iceConn, _bytes, _data) \
+    IceWriteData (_iceConn, _bytes, (char *) _data)
+
+#define IceWriteData32(_iceConn, _bytes, _data) \
+    IceWriteData (_iceConn, _bytes, (char *) _data)
+
+
+/*
+ * The IceSendData macro bypasses copying the data to the
+ * ICE connection buffer and sends the data directly.  If necessary,
+ * the ICE connection buffer is first flushed.
+ */
+
+#define IceSendData(_iceConn, _bytes, _data) \
+{ \
+    if (_iceConn->outbufptr > _iceConn->outbuf) \
+	IceFlush (_iceConn); \
+    _IceWrite (_iceConn, (unsigned long) (_bytes), _data); \
+}
+
+
+/*
+ * Write pad bytes.  Used to force 32 or 64 bit alignment.
+ * A maximum of 7 pad bytes can be specified.
+ */
+
+#define IceWritePad(_iceConn, _bytes) \
+{ \
+    if ((_iceConn->outbufptr + (_bytes)) > _iceConn->outbufmax) \
+    { \
+        char _dummy[7] = { 0 }; \
+        IceFlush (_iceConn); \
+        _IceWrite (_iceConn, (unsigned long) (_bytes), _dummy); \
+    } \
+    else \
+    { \
+        _iceConn->outbufptr += (_bytes); \
+    } \
+}
+
+
+/*
+ * Macros for reading messages.
+ */
+
+#define IceReadCompleteMessage(_iceConn, _headerSize, _msgType, _pMsg, _pData)\
+{ \
+    unsigned long _bytes; \
+    IceReadMessageHeader (_iceConn, _headerSize, _msgType, _pMsg); \
+    _bytes = (_pMsg->length << 3) - (_headerSize - SIZEOF (iceMsg)); \
+    if ((_iceConn->inbufmax - _iceConn->inbufptr) >= _bytes) \
+    { \
+	_IceRead (_iceConn, _bytes, _iceConn->inbufptr); \
+	_pData = _iceConn->inbufptr; \
+	_iceConn->inbufptr += _bytes; \
+    } \
+    else \
+    { \
+	_pData = malloc (_bytes); \
+        if (_pData) \
+	    _IceRead (_iceConn, _bytes, _pData); \
+        else \
+	    _IceReadSkip (_iceConn, _bytes); \
+    } \
+}
+
+#define IceDisposeCompleteMessage(_iceConn, _pData) \
+    if ((char *) _pData < _iceConn->inbuf || \
+	(char *) _pData >= _iceConn->inbufmax) \
+        free (_pData);
+
+
+#define IceReadSimpleMessage(_iceConn, _msgType, _pMsg) \
+    _pMsg = (_msgType *) (_iceConn->inbuf);
+
+#define IceReadMessageHeader(_iceConn, _headerSize, _msgType, _pMsg) \
+{ \
+    _IceRead (_iceConn, \
+	(unsigned long) (_headerSize - SIZEOF (iceMsg)), \
+	_iceConn->inbufptr); \
+    _pMsg = (_msgType *) (_iceConn->inbuf); \
+    _iceConn->inbufptr += (_headerSize - SIZEOF (iceMsg)); \
+}
+
+#define IceReadData(_iceConn, _bytes, _pData) \
+    _IceRead (_iceConn, (unsigned long) (_bytes), (char *) _pData); \
+
+#define IceReadData16(_iceConn, _swap, _bytes, _pData) \
+{ \
+    _IceRead (_iceConn, (unsigned long) (_bytes), (char *) _pData); \
+}
+
+#define IceReadData32(_iceConn, _swap, _bytes, _pData) \
+{ \
+    _IceRead (_iceConn, (unsigned long) (_bytes), (char *) _pData); \
+}
+
+
+/*
+ * Read pad bytes (for 32 or 64 bit alignment).
+ * A maxium of 7 pad bytes can be specified.
+ */
+
+#define IceReadPad(_iceConn, _bytes) \
+{ \
+    char _dummy[7]; \
+    _IceRead (_iceConn, (unsigned long) (_bytes), _dummy); \
+}
+
+_XFUNCPROTOEND
+
+#endif /* _ICEMSG_H_ */
diff --git a/ThirdParty/X11/Include/X11/ICE/ICEproto.h b/ThirdParty/X11/Include/X11/ICE/ICEproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..1fcbe6bb0d309f517ce12c95293269e0e4609a22
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/ICE/ICEproto.h
@@ -0,0 +1,175 @@
+/******************************************************************************
+
+
+Copyright 1993, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Author: Ralph Mor, X Consortium
+******************************************************************************/
+
+#ifndef _ICEPROTO_H_
+#define _ICEPROTO_H_
+
+#include <X11/Xmd.h>
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	data[2];
+    CARD32	length B32;
+} iceMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD16	errorClass B16;
+    CARD32	length B32;
+    CARD8	offendingMinorOpcode;
+    CARD8	severity;
+    CARD16	unused B16;
+    CARD32	offendingSequenceNum B32;
+    /* n	varying values */
+    /* p	p = pad (n, 8) */
+} iceErrorMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	byteOrder;
+    CARD8	unused;
+    CARD32	length B32;
+} iceByteOrderMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	versionCount;
+    CARD8	authCount;
+    CARD32	length B32;
+    CARD8	mustAuthenticate;
+    CARD8	unused[7];
+    /* i	STRING		vendor */
+    /* j	STRING		release */
+    /* k	LIST of STRING	authentication-protocol-names */
+    /* m	LIST of VERSION version-list */
+    /* p	p = pad (i+j+k+m, 8) */
+} iceConnectionSetupMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	authIndex;
+    CARD8	unused1;
+    CARD32	length B32;
+    CARD16	authDataLength B16;
+    CARD8	unused2[6];
+    /* n	varying data */
+    /* p	p = pad (n, 8) */
+} iceAuthRequiredMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	unused1[2];
+    CARD32	length B32;
+    CARD16	authDataLength B16;
+    CARD8	unused2[6];
+    /* n	varying data */
+    /* p	p = pad (n, 8) */
+} iceAuthReplyMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	unused1[2];
+    CARD32	length B32;
+    CARD16	authDataLength B16;
+    CARD8	unused2[6];
+    /* n	varying data */
+    /* p	p = pad (n, 8) */
+} iceAuthNextPhaseMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	versionIndex;
+    CARD8	unused;
+    CARD32	length B32;
+    /* i	STRING		vendor */
+    /* j	STRING		release */
+    /* p	p = pad (i+j, 8) */
+} iceConnectionReplyMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	protocolOpcode;
+    CARD8	mustAuthenticate;
+    CARD32	length B32;
+    CARD8	versionCount;
+    CARD8	authCount;
+    CARD8	unused[6];
+    /* i	STRING		protocol-name */
+    /* j	STRING		vendor */
+    /* k	STRING		release */
+    /* m	LIST of STRING	authentication-protocol-names */
+    /* n	LIST of VERSION version-list */
+    /* p        p = pad (i+j+k+m+n, 8) */
+} iceProtocolSetupMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	versionIndex;
+    CARD8	protocolOpcode;
+    CARD32	length B32;
+    /* i	STRING		vendor */
+    /* j	STRING		release */
+    /* p	p = pad (i+j, 8) */
+} iceProtocolReplyMsg;
+
+typedef iceMsg  icePingMsg;
+typedef iceMsg  icePingReplyMsg;
+typedef iceMsg  iceWantToCloseMsg;
+typedef iceMsg  iceNoCloseMsg;
+
+
+/*
+ * SIZEOF values.  These better be multiples of 8.
+ */
+
+#define sz_iceMsg			8
+#define sz_iceErrorMsg			16
+#define sz_iceByteOrderMsg		8
+#define sz_iceConnectionSetupMsg        16
+#define sz_iceAuthRequiredMsg		16
+#define sz_iceAuthReplyMsg		16
+#define sz_iceAuthNextPhaseMsg		16
+#define sz_iceConnectionReplyMsg	8
+#define sz_iceProtocolSetupMsg		16
+#define sz_iceProtocolReplyMsg		8
+#define sz_icePingMsg			8
+#define sz_icePingReplyMsg		8
+#define sz_iceWantToCloseMsg		8
+#define sz_iceNoCloseMsg		8
+
+#endif /* _ICEPROTO_H_ */
diff --git a/ThirdParty/X11/Include/X11/ICE/ICEutil.h b/ThirdParty/X11/Include/X11/ICE/ICEutil.h
new file mode 100644
index 0000000000000000000000000000000000000000..dbf14909fbeca531b45de6bd583291e77771459d
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/ICE/ICEutil.h
@@ -0,0 +1,124 @@
+/******************************************************************************
+
+
+Copyright 1993, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Author: Ralph Mor, X Consortium
+******************************************************************************/
+
+#ifndef _ICEUTIL_H_
+#define _ICEUTIL_H_
+
+#include <X11/Xfuncproto.h>
+
+#include <stdio.h>
+
+_XFUNCPROTOBEGIN
+
+/*
+ * Data structure for entry in ICE authority file
+ */
+
+typedef struct {
+    char    	    *protocol_name;
+    unsigned short  protocol_data_length;
+    char   	    *protocol_data;
+    char    	    *network_id;
+    char    	    *auth_name;
+    unsigned short  auth_data_length;
+    char   	    *auth_data;
+} IceAuthFileEntry;
+
+
+/*
+ * Authentication data maintained in memory.
+ */
+
+typedef struct {
+    char    	    *protocol_name;
+    char	    *network_id;
+    char    	    *auth_name;
+    unsigned short  auth_data_length;
+    char   	    *auth_data;
+} IceAuthDataEntry;
+
+
+/*
+ * Return values from IceLockAuthFile
+ */
+
+#define IceAuthLockSuccess	0   /* lock succeeded */
+#define IceAuthLockError	1   /* lock unexpectely failed, check errno */
+#define IceAuthLockTimeout	2   /* lock failed, timeouts expired */
+
+
+/*
+ * Function Prototypes
+ */
+
+extern char *IceAuthFileName (
+    void
+);
+
+extern int IceLockAuthFile (
+    const char *	/* file_name */,
+    int			/* retries */,
+    int			/* timeout */,
+    long		/* dead */
+);
+
+extern void IceUnlockAuthFile (
+    const char *	/* file_name */
+);
+
+extern IceAuthFileEntry *IceReadAuthFileEntry (
+    FILE *		/* auth_file */
+);
+
+extern void IceFreeAuthFileEntry (
+    IceAuthFileEntry *	/* auth */
+);
+
+extern Status IceWriteAuthFileEntry (
+    FILE *		/* auth_file */,
+    IceAuthFileEntry *	/* auth */
+);
+
+extern IceAuthFileEntry *IceGetAuthFileEntry (
+    const char *	/* protocol_name */,
+    const char *	/* network_id */,
+    const char *	/* auth_name */
+);
+
+extern char *IceGenerateMagicCookie (
+    int			/* len */
+);
+
+extern void IceSetPaAuthData (
+    int			/* numEntries */,
+    IceAuthDataEntry *	/* entries */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _ICEUTIL_H_ */
diff --git a/ThirdParty/X11/Include/X11/ImUtil.h b/ThirdParty/X11/Include/X11/ImUtil.h
new file mode 100644
index 0000000000000000000000000000000000000000..ffdba1a939913bb50c2f589c99c015c89a3c936b
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/ImUtil.h
@@ -0,0 +1,30 @@
+
+#ifndef _X11_IMUTIL_H_
+#define _X11_IMUTIL_H_
+
+extern int
+_XGetScanlinePad(
+    Display *dpy,
+    int depth);
+
+extern int
+_XGetBitsPerPixel(
+ Display *dpy,
+ int depth);
+
+extern int
+_XSetImage(
+    XImage *srcimg,
+    register XImage *dstimg,
+    register int x,
+    register int y);
+
+extern int
+_XReverse_Bytes(
+    register unsigned char *bpt,
+    register int nb);
+extern void
+_XInitImageFuncPtrs(
+    register XImage *image);
+
+#endif /* _X11_IMUTIL_H_ */
diff --git a/ThirdParty/X11/Include/X11/InitialI.h b/ThirdParty/X11/Include/X11/InitialI.h
new file mode 100644
index 0000000000000000000000000000000000000000..0827df0a7ee75d9c5bf213b01f4ffa493955bc99
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/InitialI.h
@@ -0,0 +1,430 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XtinitialI_h
+#define _XtinitialI_h
+
+/****************************************************************
+ *
+ * Displays
+ *
+ ****************************************************************/
+
+#ifndef X_NOT_POSIX
+#ifdef _POSIX_SOURCE
+#include <limits.h>
+#else
+#define _POSIX_SOURCE
+#include <limits.h>
+#undef _POSIX_SOURCE
+#endif
+#endif
+#ifndef PATH_MAX
+#ifdef WIN32
+#define PATH_MAX 512
+#else
+#include <sys/param.h>
+#endif
+#ifndef PATH_MAX
+#ifdef MAXPATHLEN
+#define PATH_MAX MAXPATHLEN
+#else
+#define PATH_MAX 1024
+#endif
+#endif
+#endif
+
+#include <X11/Xos.h>
+#include <X11/Xpoll.h>
+
+_XFUNCPROTOBEGIN
+
+typedef struct _TimerEventRec {
+        struct timeval        te_timer_value;
+	struct _TimerEventRec *te_next;
+	XtTimerCallbackProc   te_proc;
+	XtAppContext	      app;
+	XtPointer	      te_closure;
+} TimerEventRec;
+
+typedef struct _InputEvent {
+	XtInputCallbackProc   ie_proc;
+	XtPointer	      ie_closure;
+	struct _InputEvent    *ie_next;
+	struct _InputEvent    *ie_oq;
+	XtAppContext	      app;
+	int		      ie_source;
+	XtInputMask	      ie_condition;
+} InputEvent;
+
+typedef struct _SignalEventRec {
+	XtSignalCallbackProc  se_proc;
+	XtPointer	      se_closure;
+	struct _SignalEventRec *se_next;
+	XtAppContext	      app;
+	Boolean		      se_notice;
+} SignalEventRec;
+
+typedef struct _WorkProcRec {
+	XtWorkProc proc;
+	XtPointer closure;
+	struct _WorkProcRec *next;
+	XtAppContext app;
+} WorkProcRec;
+
+
+typedef struct
+{
+#ifndef USE_POLL
+  	fd_set rmask;
+	fd_set wmask;
+	fd_set emask;
+#endif
+	int	nfds;
+} FdStruct;
+
+typedef struct _LangProcRec {
+    XtLanguageProc	proc;
+    XtPointer		closure;
+} LangProcRec;
+
+typedef struct _ProcessContextRec {
+    XtAppContext	defaultAppContext;
+    XtAppContext	appContextList;
+    ConverterTable	globalConverterTable;
+    LangProcRec		globalLangProcRec;
+} ProcessContextRec, *ProcessContext;
+
+typedef struct {
+    char*	start;
+    char*	current;
+    int		bytes_remaining;
+} Heap;
+
+typedef struct _DestroyRec DestroyRec;
+
+
+typedef struct _XtAppStruct {
+    XtAppContext next;		/* link to next app in process context */
+    ProcessContext process;	/* back pointer to our process context */
+    InternalCallbackList destroy_callbacks;
+    Display **list;
+    TimerEventRec *timerQueue;
+    WorkProcRec *workQueue;
+    InputEvent **input_list;
+    InputEvent *outstandingQueue;
+    SignalEventRec *signalQueue;
+    XrmDatabase errorDB;
+    XtErrorMsgHandler errorMsgHandler, warningMsgHandler;
+    XtErrorHandler errorHandler, warningHandler;
+    struct _ActionListRec *action_table;
+    ConverterTable converterTable;
+    unsigned long selectionTimeout;
+    FdStruct fds;
+    short count;			/* num of assigned entries in list */
+    short max;				/* allocate size of list */
+    short last;
+    short input_count;
+    short input_max;			/* elts input_list init'd with */
+    Boolean sync, being_destroyed, error_inited;
+#ifndef NO_IDENTIFY_WINDOWS
+    Boolean identify_windows;		/* debugging hack */
+#endif
+    Heap heap;
+    String * fallback_resources;	/* Set by XtAppSetFallbackResources. */
+    struct _ActionHookRec* action_hook_list;
+    struct _BlockHookRec* block_hook_list;
+    int destroy_list_size;		/* state data for 2-phase destroy */
+    int destroy_count;
+    int dispatch_level;
+    DestroyRec* destroy_list;
+    Widget in_phase2_destroy;
+    LangProcRec langProcRec;
+    struct _TMBindCacheRec * free_bindings;
+    String display_name_tried;
+    Display **dpy_destroy_list;
+    int dpy_destroy_count;
+    Boolean exit_flag;
+    Boolean rebuild_fdlist;
+#ifdef XTHREADS
+    LockPtr lock_info;
+    ThreadAppProc lock;
+    ThreadAppProc unlock;
+    ThreadAppYieldLockProc yield_lock;
+    ThreadAppRestoreLockProc restore_lock;
+    ThreadAppProc free_lock;
+#endif
+} XtAppStruct;
+
+extern void _XtHeapInit(Heap* heap);
+extern void _XtHeapFree(Heap* heap);
+
+#ifdef XTTRACEMEMORY
+
+
+extern char *_XtHeapMalloc(
+    Heap*	/* heap */,
+    Cardinal	/* size */,
+    char *	/* file */,
+    int		/* line */
+);
+
+#define _XtHeapAlloc(heap,bytes) _XtHeapMalloc(heap, bytes, __FILE__, __LINE__)
+
+#else /* XTTRACEMEMORY */
+
+extern char* _XtHeapAlloc(
+    Heap*	/* heap */,
+    Cardinal	/* size */
+);
+
+#endif /* XTTRACEMEMORY */
+
+extern void _XtSetDefaultErrorHandlers(
+    XtErrorMsgHandler*	/* errMsg */,
+    XtErrorMsgHandler*	/* warnMsg */,
+    XtErrorHandler*	/* err */,
+    XtErrorHandler*	/* warn */
+);
+
+extern void _XtSetDefaultSelectionTimeout(
+    unsigned long* /* timeout */
+);
+
+extern XtAppContext _XtDefaultAppContext(
+    void
+);
+
+extern ProcessContext _XtGetProcessContext(
+    void
+);
+
+Display *
+_XtAppInit(
+    XtAppContext*	/* app_context_return */,
+    String		/* application_class */,
+    XrmOptionDescRec*	/* options */,
+    Cardinal		/* num_options */,
+    int*		/* argc_in_out */,
+    String**		/* argv_in_out */,
+    String*		/* fallback_resources */
+);
+
+extern void _XtDestroyAppContexts(
+    void
+);
+
+extern void _XtCloseDisplays(
+    XtAppContext	/* app */
+);
+
+extern int _XtAppDestroyCount;
+
+extern int _XtWaitForSomething(
+    XtAppContext	/* app */,
+    _XtBoolean 		/* ignoreEvents */,
+    _XtBoolean 		/* ignoreTimers */,
+    _XtBoolean 		/* ignoreInputs */,
+    _XtBoolean		/* ignoreSignals */,
+    _XtBoolean 		/* block */,
+#ifdef XTHREADS
+    _XtBoolean		/* drop_lock */,
+#endif
+    unsigned long*	/* howlong */
+);
+
+typedef struct _CaseConverterRec *CaseConverterPtr;
+typedef struct _CaseConverterRec {
+    KeySym		start;		/* first KeySym valid in converter */
+    KeySym		stop;		/* last KeySym valid in converter */
+    XtCaseProc		proc;		/* case converter function */
+    CaseConverterPtr	next;		/* next converter record */
+} CaseConverterRec;
+
+typedef struct _ExtensionSelectorRec {
+    XtExtensionSelectProc proc;
+    int min, max;
+    XtPointer client_data;
+} ExtSelectRec;
+
+typedef struct _XtPerDisplayStruct {
+    InternalCallbackList destroy_callbacks;
+    Region region;
+    CaseConverterPtr case_cvt;		/* user-registered case converters */
+    XtKeyProc defaultKeycodeTranslator;
+    XtAppContext appContext;
+    unsigned long keysyms_serial;      /* for tracking MappingNotify events */
+    KeySym *keysyms;                   /* keycode to keysym table */
+    int keysyms_per_keycode;           /* number of keysyms for each keycode*/
+    int min_keycode, max_keycode;      /* range of keycodes */
+    KeySym *modKeysyms;                /* keysym values for modToKeysysm */
+    ModToKeysymTable *modsToKeysyms;   /* modifiers to Keysysms index table*/
+    unsigned char isModifier[32];      /* key-is-modifier-p bit table */
+    KeySym lock_meaning;	       /* Lock modifier meaning */
+    Modifiers mode_switch;	       /* keyboard group modifiers */
+    Modifiers num_lock;		       /* keyboard numlock modifiers */
+    Boolean being_destroyed;
+    Boolean rv;			       /* reverse_video resource */
+    XrmName name;		       /* resolved app name */
+    XrmClass class;		       /* application class */
+    Heap heap;
+    struct _GCrec *GClist;	       /* support for XtGetGC */
+    Drawable **pixmap_tab;             /* ditto for XtGetGC */
+    String language;		       /* XPG language string */
+    XEvent last_event;		       /* last event dispatched */
+    Time last_timestamp;	       /* from last event dispatched */
+    int multi_click_time;	       /* for XtSetMultiClickTime */
+    struct _TMKeyContextRec* tm_context;     /* for XtGetActionKeysym */
+    InternalCallbackList mapping_callbacks;  /* special case for TM */
+    XtPerDisplayInputRec pdi;	       /* state for modal grabs & kbd focus */
+    struct _WWTable *WWtable;	       /* window to widget table */
+    XrmDatabase *per_screen_db;        /* per screen resource databases */
+    XrmDatabase cmd_db;		       /* db from command line, if needed */
+    XrmDatabase server_db;	       /* resource property else .Xdefaults */
+    XtEventDispatchProc* dispatcher_list;
+    ExtSelectRec* ext_select_list;
+    int ext_select_count;
+    Widget hook_object;
+#ifndef X_NO_RESOURCE_CONFIGURATION_MANAGEMENT
+    Atom rcm_init;			/* ResConfig - initialize */
+    Atom rcm_data;			/* ResConfig - data atom */
+#endif
+} XtPerDisplayStruct, *XtPerDisplay;
+
+typedef struct _PerDisplayTable {
+	Display *dpy;
+	XtPerDisplayStruct perDpy;
+	struct _PerDisplayTable *next;
+} PerDisplayTable, *PerDisplayTablePtr;
+
+extern PerDisplayTablePtr _XtperDisplayList;
+
+extern XtPerDisplay _XtSortPerDisplayList(
+    Display* /* dpy */
+);
+
+extern XtPerDisplay _XtGetPerDisplay(
+    Display*		/* dpy */
+);
+
+extern XtPerDisplayInputRec* _XtGetPerDisplayInput(
+    Display* 		/* dpy */
+);
+
+#if 0
+#ifdef DEBUG
+#define _XtGetPerDisplay(display) \
+    ((_XtperDisplayList != NULL && (_XtperDisplayList->dpy == (display))) \
+     ? &_XtperDisplayList->perDpy \
+     : _XtSortPerDisplayList(display))
+#define _XtGetPerDisplayInput(display) \
+    ((_XtperDisplayList != NULL && (_XtperDisplayList->dpy == (display))) \
+     ? &_XtperDisplayList->perDpy.pdi \
+     : &_XtSortPerDisplayList(display)->pdi)
+#else
+#define _XtGetPerDisplay(display) \
+    ((_XtperDisplayList->dpy == (display)) \
+     ? &_XtperDisplayList->perDpy \
+     : _XtSortPerDisplayList(display))
+#define _XtGetPerDisplayInput(display) \
+    ((_XtperDisplayList->dpy == (display)) \
+     ? &_XtperDisplayList->perDpy.pdi \
+     : &_XtSortPerDisplayList(display)->pdi)
+#endif /*DEBUG*/
+#endif
+
+extern void _XtDisplayInitialize(
+    Display*		/* dpy */,
+    XtPerDisplay	/* pd */,
+    _Xconst char*	/* name */,
+    XrmOptionDescRec*	/* urlist */,
+    Cardinal 		/* num_urs */,
+    int*		/* argc */,
+    char** 		/* argv */
+);
+
+extern void _XtCacheFlushTag(
+    XtAppContext /* app */,
+    XtPointer	 /* tag */
+);
+
+extern void _XtFreeActions(
+    struct _ActionListRec* /* action_table */
+);
+
+extern void _XtDoPhase2Destroy(
+    XtAppContext /* app */,
+    int		 /* dispatch_level */
+);
+
+extern void _XtDoFreeBindings(
+    XtAppContext /* app */
+);
+
+extern void _XtExtensionSelect(
+    Widget /* widget */
+);
+
+#define _XtSafeToDestroy(app) ((app)->dispatch_level == 0)
+
+extern void _XtAllocWWTable(
+    XtPerDisplay pd
+);
+
+extern void _XtFreeWWTable(
+    XtPerDisplay pd
+);
+
+extern String _XtGetUserName(String dest, int len);
+extern XrmDatabase _XtPreparseCommandLine(XrmOptionDescRec *urlist,
+			Cardinal num_urs, int argc, String *argv,
+			String *applName, String *displayName,
+			String *language);
+
+_XFUNCPROTOEND
+
+#endif /* _XtinitialI_h */
diff --git a/ThirdParty/X11/Include/X11/Intrinsic.h b/ThirdParty/X11/Include/X11/Intrinsic.h
new file mode 100644
index 0000000000000000000000000000000000000000..794b820d3a8de5607f35a8c026b8ae7663d0e4ce
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Intrinsic.h
@@ -0,0 +1,2585 @@
+/***********************************************************
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
+
+			All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _XtIntrinsic_h
+#define _XtIntrinsic_h
+
+#include	<X11/Xlib.h>
+#include	<X11/Xutil.h>
+#include	<X11/Xresource.h>
+#include	<X11/Xfuncproto.h>
+#ifdef XT_BC
+#include <X11/Xos.h>		/* for R4 compatibility */
+#else
+#include <X11/Xosdefs.h>
+#include <string.h>		/* for XtNewString */
+#endif /* XT_BC else */
+
+#define XtSpecificationRelease 6
+
+typedef char *String;
+
+/* We do this in order to get "const" declarations to work right.  We
+ * use _XtString instead of String so that C++ applications can
+ * #define String to something else if they choose, to avoid conflicts
+ * with other C++ libraries.
+ */
+#define _XtString char*
+
+/* _Xt names are private to Xt implementation, do not use in client code */
+#if NeedWidePrototypes
+#define _XtBoolean	int
+#define _XtDimension	unsigned int
+#define _XtKeyCode	unsigned int
+#define _XtPosition	int
+#define _XtXtEnum	unsigned int
+#else
+#define _XtBoolean	Boolean
+#define _XtDimension	Dimension
+#define _XtKeyCode	KeyCode
+#define _XtPosition	Position
+#define _XtXtEnum	XtEnum
+#endif /* NeedWidePrototypes */
+
+#include <stddef.h>
+
+#ifdef VMS
+#define externalref globalref
+#define externaldef(psect) globaldef {"psect"} noshare
+#else
+#define externalref extern
+#define externaldef(psect)
+#endif /* VMS */
+
+#ifndef FALSE
+#define FALSE 0
+#define TRUE 1
+#endif
+
+#define XtNumber(arr)		((Cardinal) (sizeof(arr) / sizeof(arr[0])))
+
+typedef struct _WidgetRec *Widget;
+typedef Widget *WidgetList;
+typedef struct _WidgetClassRec *WidgetClass;
+typedef struct _CompositeRec *CompositeWidget;
+typedef struct _XtActionsRec *XtActionList;
+typedef struct _XtEventRec *XtEventTable;
+
+typedef struct _XtAppStruct *XtAppContext;
+typedef unsigned long	XtValueMask;
+typedef unsigned long	XtIntervalId;
+typedef unsigned long	XtInputId;
+typedef unsigned long	XtWorkProcId;
+typedef unsigned long	XtSignalId;
+typedef unsigned int	XtGeometryMask;
+typedef unsigned long	XtGCMask;   /* Mask of values that are used by widget*/
+typedef unsigned long	Pixel;	    /* Index into colormap		*/
+typedef int		XtCacheType;
+#define			XtCacheNone	  0x001
+#define			XtCacheAll	  0x002
+#define			XtCacheByDisplay  0x003
+#define			XtCacheRefCount	  0x100
+
+/****************************************************************
+ *
+ * System Dependent Definitions; see spec for specific range
+ * requirements.  Do not assume every implementation uses the
+ * same base types!
+ *
+ *
+ * XtArgVal ought to be a union of XtPointer, char *, long, int *, and proc *
+ * but casting to union types is not really supported.
+ *
+ * So the typedef for XtArgVal should be chosen such that
+ *
+ *	sizeof (XtArgVal) >=	sizeof(XtPointer)
+ *				sizeof(char *)
+ *				sizeof(long)
+ *				sizeof(int *)
+ *				sizeof(proc *)
+ *
+ * ArgLists rely heavily on the above typedef.
+ *
+ ****************************************************************/
+typedef char		Boolean;
+typedef long		XtArgVal;
+typedef unsigned char	XtEnum;
+
+typedef unsigned int	Cardinal;
+typedef unsigned short	Dimension;  /* Size in pixels			*/
+typedef short		Position;   /* Offset from 0 coordinate		*/
+
+typedef void*		XtPointer;
+
+/* The type Opaque is NOT part of the Xt standard, do NOT use it. */
+/* (It remains here only for backward compatibility.) */
+typedef XtPointer	Opaque;
+
+#include <X11/Core.h>
+#include <X11/Composite.h>
+#include <X11/Constraint.h>
+#include <X11/Object.h>
+#include <X11/RectObj.h>
+
+typedef struct _TranslationData *XtTranslations;
+typedef struct _TranslationData *XtAccelerators;
+typedef unsigned int Modifiers;
+
+typedef void (*XtActionProc)(
+    Widget 		/* widget */,
+    XEvent*		/* event */,
+    String*		/* params */,
+    Cardinal*		/* num_params */
+);
+
+typedef XtActionProc* XtBoundActions;
+
+typedef struct _XtActionsRec{
+    String	 string;
+    XtActionProc proc;
+} XtActionsRec;
+
+typedef enum {
+/* address mode		parameter representation    */
+/* ------------		------------------------    */
+    XtAddress,		/* address		    */
+    XtBaseOffset,	/* offset		    */
+    XtImmediate,	/* constant		    */
+    XtResourceString,	/* resource name string	    */
+    XtResourceQuark,	/* resource name quark	    */
+    XtWidgetBaseOffset,	/* offset from ancestor	    */
+    XtProcedureArg	/* procedure to invoke	    */
+} XtAddressMode;
+
+typedef struct {
+    XtAddressMode   address_mode;
+    XtPointer	    address_id;
+    Cardinal	    size;
+} XtConvertArgRec, *XtConvertArgList;
+
+typedef void (*XtConvertArgProc)(
+    Widget 		/* widget */,
+    Cardinal*		/* size */,
+    XrmValue*		/* value */
+);
+
+typedef struct {
+    XtGeometryMask request_mode;
+    Position x, y;
+    Dimension width, height, border_width;
+    Widget sibling;
+    int stack_mode;   /* Above, Below, TopIf, BottomIf, Opposite, DontChange */
+} XtWidgetGeometry;
+
+/* Additions to Xlib geometry requests: ask what would happen, don't do it */
+#define XtCWQueryOnly	(1 << 7)
+
+/* Additions to Xlib stack modes: don't change stack order */
+#define XtSMDontChange	5
+
+typedef void (*XtConverter)( /* obsolete */
+    XrmValue*		/* args */,
+    Cardinal*		/* num_args */,
+    XrmValue*		/* from */,
+    XrmValue*		/* to */
+);
+
+typedef Boolean (*XtTypeConverter)(
+    Display*		/* dpy */,
+    XrmValue*		/* args */,
+    Cardinal*		/* num_args */,
+    XrmValue*		/* from */,
+    XrmValue*		/* to */,
+    XtPointer*		/* converter_data */
+);
+
+typedef void (*XtDestructor)(
+    XtAppContext	/* app */,
+    XrmValue*		/* to */,
+    XtPointer 		/* converter_data */,
+    XrmValue*		/* args */,
+    Cardinal*		/* num_args */
+);
+
+typedef Opaque XtCacheRef;
+
+typedef Opaque XtActionHookId;
+
+typedef void (*XtActionHookProc)(
+    Widget		/* w */,
+    XtPointer		/* client_data */,
+    String		/* action_name */,
+    XEvent*		/* event */,
+    String*		/* params */,
+    Cardinal*		/* num_params */
+);
+
+typedef unsigned long XtBlockHookId;
+
+typedef void (*XtBlockHookProc)(
+    XtPointer		/* client_data */
+);
+
+typedef void (*XtKeyProc)(
+    Display*		/* dpy */,
+    _XtKeyCode 		/* keycode */,
+    Modifiers		/* modifiers */,
+    Modifiers*		/* modifiers_return */,
+    KeySym*		/* keysym_return */
+);
+
+typedef void (*XtCaseProc)(
+    Display*		/* display */,
+    KeySym		/* keysym */,
+    KeySym*		/* lower_return */,
+    KeySym*		/* upper_return */
+);
+
+typedef void (*XtEventHandler)(
+    Widget 		/* widget */,
+    XtPointer 		/* closure */,
+    XEvent*		/* event */,
+    Boolean*		/* continue_to_dispatch */
+);
+typedef unsigned long EventMask;
+
+typedef enum {XtListHead, XtListTail } XtListPosition;
+
+typedef unsigned long	XtInputMask;
+#define XtInputNoneMask		0L
+#define XtInputReadMask		(1L<<0)
+#define XtInputWriteMask	(1L<<1)
+#define XtInputExceptMask	(1L<<2)
+
+typedef void (*XtTimerCallbackProc)(
+    XtPointer 		/* closure */,
+    XtIntervalId*	/* id */
+);
+
+typedef void (*XtInputCallbackProc)(
+    XtPointer 		/* closure */,
+    int*		/* source */,
+    XtInputId*		/* id */
+);
+
+typedef void (*XtSignalCallbackProc)(
+    XtPointer		/* closure */,
+    XtSignalId*		/* id */
+);
+
+typedef struct {
+    String	name;
+    XtArgVal	value;
+} Arg, *ArgList;
+
+typedef XtPointer	XtVarArgsList;
+
+typedef void (*XtCallbackProc)(
+    Widget 		/* widget */,
+    XtPointer 		/* closure */,	/* data the application registered */
+    XtPointer 		/* call_data */	/* callback specific data */
+);
+
+typedef struct _XtCallbackRec {
+    XtCallbackProc  callback;
+    XtPointer	    closure;
+} XtCallbackRec, *XtCallbackList;
+
+typedef enum {
+	XtCallbackNoList,
+	XtCallbackHasNone,
+	XtCallbackHasSome
+} XtCallbackStatus;
+
+typedef enum  {
+    XtGeometryYes,	  /* Request accepted. */
+    XtGeometryNo,	  /* Request denied. */
+    XtGeometryAlmost,	  /* Request denied, but willing to take replyBox. */
+    XtGeometryDone	  /* Request accepted and done. */
+} XtGeometryResult;
+
+typedef enum {XtGrabNone, XtGrabNonexclusive, XtGrabExclusive} XtGrabKind;
+
+typedef struct {
+    Widget  shell_widget;
+    Widget  enable_widget;
+} XtPopdownIDRec, *XtPopdownID;
+
+typedef struct _XtResource {
+    String	resource_name;	/* Resource name			    */
+    String	resource_class;	/* Resource class			    */
+    String	resource_type;	/* Representation type desired		    */
+    Cardinal	resource_size;	/* Size in bytes of representation	    */
+    Cardinal	resource_offset;/* Offset from base to put resource value   */
+    String	default_type;	/* representation type of specified default */
+    XtPointer	default_addr;	/* Address of default resource		    */
+} XtResource, *XtResourceList;
+
+typedef void (*XtResourceDefaultProc)(
+    Widget	/* widget */,
+    int		/* offset */,
+    XrmValue*	/* value */
+);
+
+typedef String (*XtLanguageProc)(
+    Display*	/* dpy */,
+    String	/* xnl */,
+    XtPointer	/* client_data */
+);
+
+typedef void (*XtErrorMsgHandler)(
+    String 		/* name */,
+    String		/* type */,
+    String		/* class */,
+    String		/* default */,
+    String*		/* params */,
+    Cardinal*		/* num_params */
+);
+
+typedef void (*XtErrorHandler)(
+  String		/* msg */
+);
+
+typedef void (*XtCreatePopupChildProc)(
+    Widget	/* shell */
+);
+
+typedef Boolean (*XtWorkProc)(
+    XtPointer 		/* closure */	/* data the application registered */
+);
+
+typedef struct {
+    char match;
+    String substitution;
+} SubstitutionRec, *Substitution;
+
+typedef Boolean (*XtFilePredicate)(
+   String /* filename */
+);
+
+typedef XtPointer XtRequestId;
+
+typedef Boolean (*XtConvertSelectionProc)(
+    Widget 		/* widget */,
+    Atom*		/* selection */,
+    Atom*		/* target */,
+    Atom*		/* type_return */,
+    XtPointer*		/* value_return */,
+    unsigned long*	/* length_return */,
+    int*		/* format_return */
+);
+
+typedef void (*XtLoseSelectionProc)(
+    Widget 		/* widget */,
+    Atom*		/* selection */
+);
+
+typedef void (*XtSelectionDoneProc)(
+    Widget 		/* widget */,
+    Atom*		/* selection */,
+    Atom*		/* target */
+);
+
+typedef void (*XtSelectionCallbackProc)(
+    Widget 		/* widget */,
+    XtPointer 		/* closure */,
+    Atom*		/* selection */,
+    Atom*		/* type */,
+    XtPointer 		/* value */,
+    unsigned long*	/* length */,
+    int*		/* format */
+);
+
+typedef void (*XtLoseSelectionIncrProc)(
+    Widget 		/* widget */,
+    Atom*		/* selection */,
+    XtPointer 		/* client_data */
+);
+
+typedef void (*XtSelectionDoneIncrProc)(
+    Widget 		/* widget */,
+    Atom*		/* selection */,
+    Atom*		/* target */,
+    XtRequestId*	/* receiver_id */,
+    XtPointer 		/* client_data */
+);
+
+typedef Boolean (*XtConvertSelectionIncrProc)(
+    Widget 		/* widget */,
+    Atom*		/* selection */,
+    Atom*		/* target */,
+    Atom*		/* type */,
+    XtPointer*		/* value */,
+    unsigned long*	/* length */,
+    int*		/* format */,
+    unsigned long*	/* max_length */,
+    XtPointer 		/* client_data */,
+    XtRequestId*	/* receiver_id */
+);
+
+typedef void (*XtCancelConvertSelectionProc)(
+    Widget 		/* widget */,
+    Atom*		/* selection */,
+    Atom*		/* target */,
+    XtRequestId*	/* receiver_id */,
+    XtPointer 		/* client_data */
+);
+
+typedef Boolean (*XtEventDispatchProc)(
+    XEvent*		/* event */
+);
+
+typedef void (*XtExtensionSelectProc)(
+    Widget		/* widget */,
+    int*		/* event_types */,
+    XtPointer*		/* select_data */,
+    int			/* count */,
+    XtPointer		/* client_data */
+);
+
+/***************************************************************
+ *
+ * Exported Interfaces
+ *
+ ****************************************************************/
+
+_XFUNCPROTOBEGIN
+
+extern Boolean XtConvertAndStore(
+    Widget 		/* widget */,
+    _Xconst _XtString 	/* from_type */,
+    XrmValue*		/* from */,
+    _Xconst _XtString 	/* to_type */,
+    XrmValue*		/* to_in_out */
+);
+
+extern Boolean XtCallConverter(
+    Display*		/* dpy */,
+    XtTypeConverter 	/* converter */,
+    XrmValuePtr 	/* args */,
+    Cardinal 		/* num_args */,
+    XrmValuePtr 	/* from */,
+    XrmValue*		/* to_in_out */,
+    XtCacheRef*		/* cache_ref_return */
+);
+
+extern Boolean XtDispatchEvent(
+    XEvent* 		/* event */
+);
+
+extern Boolean XtCallAcceptFocus(
+    Widget 		/* widget */,
+    Time*		/* time */
+);
+
+extern Boolean XtPeekEvent( /* obsolete */
+    XEvent*		/* event_return */
+);
+
+extern Boolean XtAppPeekEvent(
+    XtAppContext 	/* app_context */,
+    XEvent*		/* event_return */
+);
+
+extern Boolean XtIsSubclass(
+    Widget 		/* widget */,
+    WidgetClass 	/* widgetClass */
+);
+
+extern Boolean XtIsObject(
+    Widget 		/* object */
+);
+
+extern Boolean _XtCheckSubclassFlag( /* implementation-private */
+    Widget		/* object */,
+    _XtXtEnum		/* type_flag */
+);
+
+extern Boolean _XtIsSubclassOf( /* implementation-private */
+    Widget		/* object */,
+    WidgetClass		/* widget_class */,
+    WidgetClass		/* flag_class */,
+    _XtXtEnum		/* type_flag */
+);
+
+extern Boolean XtIsManaged(
+    Widget 		/* rectobj */
+);
+
+extern Boolean XtIsRealized(
+    Widget 		/* widget */
+);
+
+extern Boolean XtIsSensitive(
+    Widget 		/* widget */
+);
+
+extern Boolean XtOwnSelection(
+    Widget 		/* widget */,
+    Atom 		/* selection */,
+    Time 		/* time */,
+    XtConvertSelectionProc /* convert */,
+    XtLoseSelectionProc	/* lose */,
+    XtSelectionDoneProc /* done */
+);
+
+extern Boolean XtOwnSelectionIncremental(
+    Widget 		/* widget */,
+    Atom 		/* selection */,
+    Time 		/* time */,
+    XtConvertSelectionIncrProc	/* convert_callback */,
+    XtLoseSelectionIncrProc	/* lose_callback */,
+    XtSelectionDoneIncrProc	/* done_callback */,
+    XtCancelConvertSelectionProc /* cancel_callback */,
+    XtPointer 		/* client_data */
+);
+
+extern XtGeometryResult XtMakeResizeRequest(
+    Widget 		/* widget */,
+    _XtDimension	/* width */,
+    _XtDimension	/* height */,
+    Dimension*		/* width_return */,
+    Dimension*		/* height_return */
+);
+
+extern void XtTranslateCoords(
+    Widget 		/* widget */,
+    _XtPosition		/* x */,
+    _XtPosition		/* y */,
+    Position*		/* rootx_return */,
+    Position*		/* rooty_return */
+);
+
+extern KeySym* XtGetKeysymTable(
+    Display*		/* dpy */,
+    KeyCode*		/* min_keycode_return */,
+    int*		/* keysyms_per_keycode_return */
+);
+
+extern void XtKeysymToKeycodeList(
+    Display*		/* dpy */,
+    KeySym 		/* keysym */,
+    KeyCode**		/* keycodes_return */,
+    Cardinal*		/* keycount_return */
+);
+
+extern void XtStringConversionWarning( /* obsolete */
+    _Xconst _XtString	/* from_value */,
+    _Xconst _XtString	/* to_type */
+);
+
+extern void XtDisplayStringConversionWarning(
+    Display*	 	/* dpy */,
+    _Xconst _XtString	/* from_value */,
+    _Xconst _XtString	/* to_type */
+);
+
+externalref XtConvertArgRec const colorConvertArgs[];
+externalref XtConvertArgRec const screenConvertArg[];
+
+extern void XtAppAddConverter( /* obsolete */
+    XtAppContext	/* app_context */,
+    _Xconst _XtString	/* from_type */,
+    _Xconst _XtString	/* to_type */,
+    XtConverter 	/* converter */,
+    XtConvertArgList	/* convert_args */,
+    Cardinal 		/* num_args */
+);
+
+extern void XtAddConverter( /* obsolete */
+    _Xconst _XtString	/* from_type */,
+    _Xconst _XtString 	/* to_type */,
+    XtConverter 	/* converter */,
+    XtConvertArgList 	/* convert_args */,
+    Cardinal 		/* num_args */
+);
+
+extern void XtSetTypeConverter(
+    _Xconst _XtString 	/* from_type */,
+    _Xconst _XtString 	/* to_type */,
+    XtTypeConverter 	/* converter */,
+    XtConvertArgList 	/* convert_args */,
+    Cardinal 		/* num_args */,
+    XtCacheType 	/* cache_type */,
+    XtDestructor 	/* destructor */
+);
+
+extern void XtAppSetTypeConverter(
+    XtAppContext 	/* app_context */,
+    _Xconst _XtString 	/* from_type */,
+    _Xconst _XtString 	/* to_type */,
+    XtTypeConverter 	/* converter */,
+    XtConvertArgList 	/* convert_args */,
+    Cardinal 		/* num_args */,
+    XtCacheType 	/* cache_type */,
+    XtDestructor 	/* destructor */
+);
+
+extern void XtConvert( /* obsolete */
+    Widget 		/* widget */,
+    _Xconst _XtString 	/* from_type */,
+    XrmValue*		/* from */,
+    _Xconst _XtString 	/* to_type */,
+    XrmValue*		/* to_return */
+);
+
+extern void XtDirectConvert( /* obsolete */
+    XtConverter 	/* converter */,
+    XrmValuePtr 	/* args */,
+    Cardinal 		/* num_args */,
+    XrmValuePtr 	/* from */,
+    XrmValue*		/* to_return */
+);
+
+/****************************************************************
+ *
+ * Translation Management
+ *
+ ****************************************************************/
+
+extern XtTranslations XtParseTranslationTable(
+    _Xconst _XtString	/* table */
+);
+
+extern XtAccelerators XtParseAcceleratorTable(
+    _Xconst _XtString	/* source */
+);
+
+extern void XtOverrideTranslations(
+    Widget 		/* widget */,
+    XtTranslations 	/* translations */
+);
+
+extern void XtAugmentTranslations(
+    Widget 		/* widget */,
+    XtTranslations 	/* translations */
+);
+
+extern void XtInstallAccelerators(
+    Widget 		/* destination */,
+    Widget		/* source */
+);
+
+extern void XtInstallAllAccelerators(
+    Widget 		/* destination */,
+    Widget		/* source */
+);
+
+extern void XtUninstallTranslations(
+    Widget 		/* widget */
+);
+
+extern void XtAppAddActions(
+    XtAppContext 	/* app_context */,
+    XtActionList 	/* actions */,
+    Cardinal 		/* num_actions */
+);
+
+extern void XtAddActions( /* obsolete */
+    XtActionList 	/* actions */,
+    Cardinal 		/* num_actions */
+);
+
+extern XtActionHookId XtAppAddActionHook(
+    XtAppContext 	/* app_context */,
+    XtActionHookProc 	/* proc */,
+    XtPointer 		/* client_data */
+);
+
+extern void XtRemoveActionHook(
+    XtActionHookId 	/* id */
+);
+
+extern void XtGetActionList(
+    WidgetClass		/* widget_class */,
+    XtActionList*	/* actions_return */,
+    Cardinal*		/* num_actions_return */
+);
+
+extern void XtCallActionProc(
+    Widget		/* widget */,
+    _Xconst _XtString	/* action */,
+    XEvent*		/* event */,
+    String*		/* params */,
+    Cardinal		/* num_params */
+);
+
+extern void XtRegisterGrabAction(
+    XtActionProc 	/* action_proc */,
+    _XtBoolean 		/* owner_events */,
+    unsigned int 	/* event_mask */,
+    int			/* pointer_mode */,
+    int	 		/* keyboard_mode */
+);
+
+extern void XtSetMultiClickTime(
+    Display*		/* dpy */,
+    int 		/* milliseconds */
+);
+
+extern int XtGetMultiClickTime(
+    Display*		/* dpy */
+);
+
+extern KeySym XtGetActionKeysym(
+    XEvent*		/* event */,
+    Modifiers*		/* modifiers_return */
+);
+
+/***************************************************************
+ *
+ * Keycode and Keysym procedures for translation management
+ *
+ ****************************************************************/
+
+extern void XtTranslateKeycode(
+    Display*		/* dpy */,
+    _XtKeyCode 		/* keycode */,
+    Modifiers 		/* modifiers */,
+    Modifiers*		/* modifiers_return */,
+    KeySym*		/* keysym_return */
+);
+
+extern void XtTranslateKey(
+    Display*		/* dpy */,
+    _XtKeyCode		/* keycode */,
+    Modifiers		/* modifiers */,
+    Modifiers*		/* modifiers_return */,
+    KeySym*		/* keysym_return */
+);
+
+extern void XtSetKeyTranslator(
+    Display*		/* dpy */,
+    XtKeyProc 		/* proc */
+);
+
+extern void XtRegisterCaseConverter(
+    Display*		/* dpy */,
+    XtCaseProc 		/* proc */,
+    KeySym 		/* start */,
+    KeySym 		/* stop */
+);
+
+extern void XtConvertCase(
+    Display*		/* dpy */,
+    KeySym 		/* keysym */,
+    KeySym*		/* lower_return */,
+    KeySym*		/* upper_return */
+);
+
+/****************************************************************
+ *
+ * Event Management
+ *
+ ****************************************************************/
+
+/* XtAllEvents is valid only for XtRemoveEventHandler and
+ * XtRemoveRawEventHandler; don't use it to select events!
+ */
+#define XtAllEvents ((EventMask) -1L)
+
+extern void XtAddEventHandler(
+    Widget 		/* widget */,
+    EventMask 		/* event_mask */,
+    _XtBoolean 		/* nonmaskable */,
+    XtEventHandler 	/* proc */,
+    XtPointer 		/* closure */
+);
+
+extern void XtRemoveEventHandler(
+    Widget 		/* widget */,
+    EventMask 		/* event_mask */,
+    _XtBoolean 		/* nonmaskable */,
+    XtEventHandler 	/* proc */,
+    XtPointer 		/* closure */
+);
+
+extern void XtAddRawEventHandler(
+    Widget 		/* widget */,
+    EventMask 		/* event_mask */,
+    _XtBoolean 		/* nonmaskable */,
+    XtEventHandler 	/* proc */,
+    XtPointer 		/* closure */
+);
+
+extern void XtRemoveRawEventHandler(
+    Widget 		/* widget */,
+    EventMask 		/* event_mask */,
+    _XtBoolean 		/* nonmaskable */,
+    XtEventHandler 	/* proc */,
+    XtPointer 		/* closure */
+);
+
+extern void XtInsertEventHandler(
+    Widget 		/* widget */,
+    EventMask 		/* event_mask */,
+    _XtBoolean 		/* nonmaskable */,
+    XtEventHandler 	/* proc */,
+    XtPointer 		/* closure */,
+    XtListPosition 	/* position */
+);
+
+extern void XtInsertRawEventHandler(
+    Widget 		/* widget */,
+    EventMask 		/* event_mask */,
+    _XtBoolean 		/* nonmaskable */,
+    XtEventHandler 	/* proc */,
+    XtPointer 		/* closure */,
+    XtListPosition 	/* position */
+);
+
+extern XtEventDispatchProc XtSetEventDispatcher(
+    Display*		/* dpy */,
+    int			/* event_type */,
+    XtEventDispatchProc	/* proc */
+);
+
+extern Boolean XtDispatchEventToWidget(
+    Widget		/* widget */,
+    XEvent*		/* event */
+);
+
+extern void XtInsertEventTypeHandler(
+    Widget		/* widget */,
+    int			/* type */,
+    XtPointer		/* select_data */,
+    XtEventHandler	/* proc */,
+    XtPointer		/* closure */,
+    XtListPosition	/* position */
+);
+
+extern void XtRemoveEventTypeHandler(
+    Widget		/* widget */,
+    int			/* type */,
+    XtPointer		/* select_data */,
+    XtEventHandler	/* proc */,
+    XtPointer		/* closure */
+);
+
+extern EventMask XtBuildEventMask(
+    Widget 		/* widget */
+);
+
+extern void XtRegisterExtensionSelector(
+    Display*		/* dpy */,
+    int			/* min_event_type */,
+    int			/* max_event_type */,
+    XtExtensionSelectProc /* proc */,
+    XtPointer		/* client_data */
+);
+
+extern void XtAddGrab(
+    Widget 		/* widget */,
+    _XtBoolean 		/* exclusive */,
+    _XtBoolean 		/* spring_loaded */
+);
+
+extern void XtRemoveGrab(
+    Widget 		/* widget */
+);
+
+extern void XtProcessEvent( /* obsolete */
+    XtInputMask 		/* mask */
+);
+
+extern void XtAppProcessEvent(
+    XtAppContext 		/* app_context */,
+    XtInputMask 		/* mask */
+);
+
+extern void XtMainLoop( /* obsolete */
+    void
+);
+
+extern void XtAppMainLoop(
+    XtAppContext 		/* app_context */
+);
+
+extern void XtAddExposureToRegion(
+    XEvent*		/* event */,
+    Region 		/* region */
+);
+
+extern void XtSetKeyboardFocus(
+    Widget		/* subtree */,
+    Widget 		/* descendent */
+);
+
+extern Widget XtGetKeyboardFocusWidget(
+    Widget		/* widget */
+);
+
+extern XEvent* XtLastEventProcessed(
+    Display*		/* dpy */
+);
+
+extern Time XtLastTimestampProcessed(
+    Display*		/* dpy */
+);
+
+/****************************************************************
+ *
+ * Event Gathering Routines
+ *
+ ****************************************************************/
+
+extern XtIntervalId XtAddTimeOut( /* obsolete */
+    unsigned long 	/* interval */,
+    XtTimerCallbackProc /* proc */,
+    XtPointer 		/* closure */
+);
+
+extern XtIntervalId XtAppAddTimeOut(
+    XtAppContext 	/* app_context */,
+    unsigned long 	/* interval */,
+    XtTimerCallbackProc /* proc */,
+    XtPointer 		/* closure */
+);
+
+extern void XtRemoveTimeOut(
+    XtIntervalId 	/* timer */
+);
+
+extern XtInputId XtAddInput( /* obsolete */
+    int 		/* source */,
+    XtPointer 		/* condition */,
+    XtInputCallbackProc /* proc */,
+    XtPointer 		/* closure */
+);
+
+extern XtInputId XtAppAddInput(
+    XtAppContext       	/* app_context */,
+    int 		/* source */,
+    XtPointer 		/* condition */,
+    XtInputCallbackProc /* proc */,
+    XtPointer 		/* closure */
+);
+
+extern void XtRemoveInput(
+    XtInputId 		/* id */
+);
+
+extern XtSignalId XtAddSignal(
+    XtSignalCallbackProc /* proc */,
+    XtPointer		/* closure */);
+
+extern XtSignalId XtAppAddSignal(
+    XtAppContext       	/* app_context */,
+    XtSignalCallbackProc /* proc */,
+    XtPointer 		/* closure */
+);
+
+extern void XtRemoveSignal(
+    XtSignalId 		/* id */
+);
+
+extern void XtNoticeSignal(
+    XtSignalId		/* id */
+);
+
+extern void XtNextEvent( /* obsolete */
+    XEvent* 		/* event */
+);
+
+extern void XtAppNextEvent(
+    XtAppContext 	/* app_context */,
+    XEvent*		/* event_return */
+);
+
+#define XtIMXEvent		1
+#define XtIMTimer		2
+#define XtIMAlternateInput	4
+#define XtIMSignal		8
+#define XtIMAll (XtIMXEvent | XtIMTimer | XtIMAlternateInput | XtIMSignal)
+
+extern Boolean XtPending( /* obsolete */
+    void
+);
+
+extern XtInputMask XtAppPending(
+    XtAppContext 	/* app_context */
+);
+
+extern XtBlockHookId XtAppAddBlockHook(
+    XtAppContext 	/* app_context */,
+    XtBlockHookProc 	/* proc */,
+    XtPointer 		/* client_data */
+);
+
+extern void XtRemoveBlockHook(
+    XtBlockHookId 	/* id */
+);
+
+/****************************************************************
+ *
+ * Random utility routines
+ *
+ ****************************************************************/
+
+#define XtIsRectObj(object)	(_XtCheckSubclassFlag(object, (XtEnum)0x02))
+#define XtIsWidget(object)	(_XtCheckSubclassFlag(object, (XtEnum)0x04))
+#define XtIsComposite(widget)	(_XtCheckSubclassFlag(widget, (XtEnum)0x08))
+#define XtIsConstraint(widget)	(_XtCheckSubclassFlag(widget, (XtEnum)0x10))
+#define XtIsShell(widget)	(_XtCheckSubclassFlag(widget, (XtEnum)0x20))
+
+#undef XtIsOverrideShell
+extern Boolean XtIsOverrideShell(Widget /* object */);
+#define XtIsOverrideShell(widget) \
+    (_XtIsSubclassOf(widget, (WidgetClass)overrideShellWidgetClass, \
+		     (WidgetClass)shellWidgetClass, (XtEnum)0x20))
+
+#define XtIsWMShell(widget)	(_XtCheckSubclassFlag(widget, (XtEnum)0x40))
+
+#undef XtIsVendorShell
+extern Boolean XtIsVendorShell(Widget /* object */);
+#define XtIsVendorShell(widget)	\
+    (_XtIsSubclassOf(widget, (WidgetClass)vendorShellWidgetClass, \
+		     (WidgetClass)wmShellWidgetClass, (XtEnum)0x40))
+
+#undef XtIsTransientShell
+extern Boolean XtIsTransientShell(Widget /* object */);
+#define XtIsTransientShell(widget) \
+    (_XtIsSubclassOf(widget, (WidgetClass)transientShellWidgetClass, \
+		     (WidgetClass)wmShellWidgetClass, (XtEnum)0x40))
+#define XtIsTopLevelShell(widget) (_XtCheckSubclassFlag(widget, (XtEnum)0x80))
+
+#undef XtIsApplicationShell
+extern Boolean XtIsApplicationShell(Widget /* object */);
+#define XtIsApplicationShell(widget) \
+    (_XtIsSubclassOf(widget, (WidgetClass)applicationShellWidgetClass, \
+		     (WidgetClass)topLevelShellWidgetClass, (XtEnum)0x80))
+
+#undef XtIsSessionShell
+extern Boolean XtIsSessionShell(Widget /* object */);
+#define XtIsSessionShell(widget) \
+    (_XtIsSubclassOf(widget, (WidgetClass)sessionShellWidgetClass, \
+		     (WidgetClass)topLevelShellWidgetClass, (XtEnum)0x80))
+
+extern void XtRealizeWidget(
+    Widget 		/* widget */
+);
+
+void XtUnrealizeWidget(
+    Widget 		/* widget */
+);
+
+extern void XtDestroyWidget(
+    Widget 		/* widget */
+);
+
+extern void XtSetSensitive(
+    Widget 		/* widget */,
+    _XtBoolean 		/* sensitive */
+);
+
+extern void XtSetMappedWhenManaged(
+    Widget 		/* widget */,
+    _XtBoolean 		/* mapped_when_managed */
+);
+
+extern Widget XtNameToWidget(
+    Widget 		/* reference */,
+    _Xconst _XtString	/* names */
+);
+
+extern Widget XtWindowToWidget(
+    Display*		/* display */,
+    Window 		/* window */
+);
+
+extern XtPointer XtGetClassExtension(
+    WidgetClass		/* object_class */,
+    Cardinal		/* byte_offset */,
+    XrmQuark		/* type */,
+    long		/* version */,
+    Cardinal		/* record_size */
+);
+
+/***************************************************************
+ *
+ * Arg lists
+ *
+ ****************************************************************/
+
+
+#define XtSetArg(arg, n, d) \
+    ((void)( (arg).name = (n), (arg).value = (XtArgVal)(d) ))
+
+extern ArgList XtMergeArgLists(
+    ArgList 		/* args1 */,
+    Cardinal 		/* num_args1 */,
+    ArgList 		/* args2 */,
+    Cardinal 		/* num_args2 */
+);
+
+/***************************************************************
+ *
+ * Vararg lists
+ *
+ ****************************************************************/
+
+#define XtVaNestedList  "XtVaNestedList"
+#define XtVaTypedArg    "XtVaTypedArg"
+
+extern XtVarArgsList XtVaCreateArgsList(
+    XtPointer		/*unused*/, ...
+) _X_SENTINEL(0);
+
+/*************************************************************
+ *
+ * Information routines
+ *
+ ************************************************************/
+
+#ifndef _XtIntrinsicP_h
+
+/* We're not included from the private file, so define these */
+
+extern Display *XtDisplay(
+    Widget 		/* widget */
+);
+
+extern Display *XtDisplayOfObject(
+    Widget 		/* object */
+);
+
+extern Screen *XtScreen(
+    Widget 		/* widget */
+);
+
+extern Screen *XtScreenOfObject(
+    Widget 		/* object */
+);
+
+extern Window XtWindow(
+    Widget 		/* widget */
+);
+
+extern Window XtWindowOfObject(
+    Widget 		/* object */
+);
+
+extern String XtName(
+    Widget 		/* object */
+);
+
+extern WidgetClass XtSuperclass(
+    Widget 		/* object */
+);
+
+extern WidgetClass XtClass(
+    Widget 		/* object */
+);
+
+extern Widget XtParent(
+    Widget 		/* widget */
+);
+
+#endif /*_XtIntrinsicP_h*/
+
+#undef XtMapWidget
+extern void XtMapWidget(Widget /* w */);
+#define XtMapWidget(widget)	XMapWindow(XtDisplay(widget), XtWindow(widget))
+
+#undef XtUnmapWidget
+extern void XtUnmapWidget(Widget /* w */);
+#define XtUnmapWidget(widget)	\
+		XUnmapWindow(XtDisplay(widget), XtWindow(widget))
+
+extern void XtAddCallback(
+    Widget 		/* widget */,
+    _Xconst _XtString 	/* callback_name */,
+    XtCallbackProc 	/* callback */,
+    XtPointer 		/* closure */
+);
+
+extern void XtRemoveCallback(
+    Widget 		/* widget */,
+    _Xconst _XtString 	/* callback_name */,
+    XtCallbackProc 	/* callback */,
+    XtPointer 		/* closure */
+);
+
+extern void XtAddCallbacks(
+    Widget 		/* widget */,
+    _Xconst _XtString	/* callback_name */,
+    XtCallbackList 	/* callbacks */
+);
+
+extern void XtRemoveCallbacks(
+    Widget 		/* widget */,
+    _Xconst _XtString 	/* callback_name */,
+    XtCallbackList 	/* callbacks */
+);
+
+extern void XtRemoveAllCallbacks(
+    Widget 		/* widget */,
+    _Xconst _XtString 	/* callback_name */
+);
+
+
+extern void XtCallCallbacks(
+    Widget 		/* widget */,
+    _Xconst _XtString 	/* callback_name */,
+    XtPointer 		/* call_data */
+);
+
+extern void XtCallCallbackList(
+    Widget		/* widget */,
+    XtCallbackList 	/* callbacks */,
+    XtPointer 		/* call_data */
+);
+
+extern XtCallbackStatus XtHasCallbacks(
+    Widget 		/* widget */,
+    _Xconst _XtString 	/* callback_name */
+);
+
+/****************************************************************
+ *
+ * Geometry Management
+ *
+ ****************************************************************/
+
+
+extern XtGeometryResult XtMakeGeometryRequest(
+    Widget 		/* widget */,
+    XtWidgetGeometry*	/* request */,
+    XtWidgetGeometry*	/* reply_return */
+);
+
+extern XtGeometryResult XtQueryGeometry(
+    Widget 		/* widget */,
+    XtWidgetGeometry*	/* intended */,
+    XtWidgetGeometry*	/* preferred_return */
+);
+
+extern Widget XtCreatePopupShell(
+    _Xconst _XtString	/* name */,
+    WidgetClass 	/* widgetClass */,
+    Widget 		/* parent */,
+    ArgList 		/* args */,
+    Cardinal 		/* num_args */
+);
+
+extern Widget XtVaCreatePopupShell(
+    _Xconst _XtString	/* name */,
+    WidgetClass		/* widgetClass */,
+    Widget		/* parent */,
+    ...
+) _X_SENTINEL(0);
+
+extern void XtPopup(
+    Widget 		/* popup_shell */,
+    XtGrabKind 		/* grab_kind */
+);
+
+extern void XtPopupSpringLoaded(
+    Widget 		/* popup_shell */
+);
+
+extern void XtCallbackNone(
+    Widget 		/* widget */,
+    XtPointer 		/* closure */,
+    XtPointer 		/* call_data */
+);
+
+extern void XtCallbackNonexclusive(
+    Widget 		/* widget */,
+    XtPointer 		/* closure */,
+    XtPointer 		/* call_data */
+);
+
+extern void XtCallbackExclusive(
+    Widget 		/* widget */,
+    XtPointer 		/* closure */,
+    XtPointer 		/* call_data */
+);
+
+extern void XtPopdown(
+    Widget 		/* popup_shell */
+);
+
+extern void XtCallbackPopdown(
+    Widget 		/* widget */,
+    XtPointer 		/* closure */,
+    XtPointer 		/* call_data */
+);
+
+extern void XtMenuPopupAction(
+    Widget 		/* widget */,
+    XEvent*		/* event */,
+    String*		/* params */,
+    Cardinal*		/* num_params */
+);
+
+extern Widget XtCreateWidget(
+    _Xconst _XtString 	/* name */,
+    WidgetClass 	/* widget_class */,
+    Widget 		/* parent */,
+    ArgList 		/* args */,
+    Cardinal 		/* num_args */
+);
+
+extern Widget XtCreateManagedWidget(
+    _Xconst _XtString 	/* name */,
+    WidgetClass 	/* widget_class */,
+    Widget 		/* parent */,
+    ArgList 		/* args */,
+    Cardinal 		/* num_args */
+);
+
+extern Widget XtVaCreateWidget(
+    _Xconst _XtString	/* name */,
+    WidgetClass		/* widget */,
+    Widget		/* parent */,
+    ...
+) _X_SENTINEL(0);
+
+extern Widget XtVaCreateManagedWidget(
+    _Xconst _XtString	/* name */,
+    WidgetClass		/* widget_class */,
+    Widget		/* parent */,
+    ...
+) _X_SENTINEL(0);
+
+extern Widget XtCreateApplicationShell( /* obsolete */
+    _Xconst _XtString 	/* name */,
+    WidgetClass 	/* widget_class */,
+    ArgList 		/* args */,
+    Cardinal 		/* num_args */
+);
+
+extern Widget XtAppCreateShell(
+    _Xconst _XtString	/* application_name */,
+    _Xconst _XtString	/* application_class */,
+    WidgetClass 	/* widget_class */,
+    Display*		/* display */,
+    ArgList 		/* args */,
+    Cardinal 		/* num_args */
+);
+
+extern Widget XtVaAppCreateShell(
+    _Xconst _XtString	/* application_name */,
+    _Xconst _XtString	/* application_class */,
+    WidgetClass		/* widget_class */,
+    Display*		/* display */,
+    ...
+) _X_SENTINEL(0);
+
+/****************************************************************
+ *
+ * Toolkit initialization
+ *
+ ****************************************************************/
+
+extern void XtToolkitInitialize(
+    void
+);
+
+extern XtLanguageProc XtSetLanguageProc(
+    XtAppContext	/* app_context */,
+    XtLanguageProc	/* proc */,
+    XtPointer		/* client_data */
+);
+
+extern void XtDisplayInitialize(
+    XtAppContext 	/* app_context */,
+    Display*		/* dpy */,
+    _Xconst _XtString	/* application_name */,
+    _Xconst _XtString	/* application_class */,
+    XrmOptionDescRec* 	/* options */,
+    Cardinal 		/* num_options */,
+    int*		/* argc */,
+    char**		/* argv */
+);
+
+extern Widget XtOpenApplication(
+    XtAppContext*	/* app_context_return */,
+    _Xconst _XtString	/* application_class */,
+    XrmOptionDescList 	/* options */,
+    Cardinal 		/* num_options */,
+    int*		/* argc_in_out */,
+    String*		/* argv_in_out */,
+    String*		/* fallback_resources */,
+    WidgetClass		/* widget_class */,
+    ArgList 		/* args */,
+    Cardinal 		/* num_args */
+);
+
+extern Widget XtVaOpenApplication(
+    XtAppContext*	/* app_context_return */,
+    _Xconst _XtString	/* application_class */,
+    XrmOptionDescList	/* options */,
+    Cardinal		/* num_options */,
+    int*		/* argc_in_out */,
+    String*		/* argv_in_out */,
+    String*		/* fallback_resources */,
+    WidgetClass		/* widget_class */,
+    ...
+) _X_SENTINEL(0);
+
+extern Widget XtAppInitialize( /* obsolete */
+    XtAppContext*	/* app_context_return */,
+    _Xconst _XtString	/* application_class */,
+    XrmOptionDescList 	/* options */,
+    Cardinal 		/* num_options */,
+    int*		/* argc_in_out */,
+    String*		/* argv_in_out */,
+    String*		/* fallback_resources */,
+    ArgList 		/* args */,
+    Cardinal 		/* num_args */
+);
+
+extern Widget XtVaAppInitialize( /* obsolete */
+    XtAppContext*	/* app_context_return */,
+    _Xconst _XtString	/* application_class */,
+    XrmOptionDescList	/* options */,
+    Cardinal		/* num_options */,
+    int*		/* argc_in_out */,
+    String*		/* argv_in_out */,
+    String*		/* fallback_resources */,
+    ...
+) _X_SENTINEL(0);
+
+extern Widget XtInitialize( /* obsolete */
+    _Xconst _XtString 	/* shell_name */,
+    _Xconst _XtString 	/* application_class */,
+    XrmOptionDescRec* 	/* options */,
+    Cardinal 		/* num_options */,
+    int*		/* argc */,
+    char**		/* argv */
+);
+
+extern Display *XtOpenDisplay(
+    XtAppContext 	/* app_context */,
+    _Xconst _XtString	/* display_string */,
+    _Xconst _XtString	/* application_name */,
+    _Xconst _XtString	/* application_class */,
+    XrmOptionDescRec*	/* options */,
+    Cardinal 		/* num_options */,
+    int*		/* argc */,
+    char**		/* argv */
+);
+
+extern XtAppContext XtCreateApplicationContext(
+    void
+);
+
+extern void XtAppSetFallbackResources(
+    XtAppContext 	/* app_context */,
+    String*		/* specification_list */
+);
+
+extern void XtDestroyApplicationContext(
+    XtAppContext 	/* app_context */
+);
+
+extern void XtInitializeWidgetClass(
+    WidgetClass 	/* widget_class */
+);
+
+extern XtAppContext XtWidgetToApplicationContext(
+    Widget 		/* widget */
+);
+
+extern XtAppContext XtDisplayToApplicationContext(
+    Display*		/* dpy */
+);
+
+extern XrmDatabase XtDatabase(
+    Display*		/* dpy */
+);
+
+extern XrmDatabase XtScreenDatabase(
+    Screen*		/* screen */
+);
+
+extern void XtCloseDisplay(
+    Display*		/* dpy */
+);
+
+extern void XtGetApplicationResources(
+    Widget 		/* widget */,
+    XtPointer 		/* base */,
+    XtResourceList 	/* resources */,
+    Cardinal 		/* num_resources */,
+    ArgList 		/* args */,
+    Cardinal 		/* num_args */
+);
+
+extern void XtVaGetApplicationResources(
+    Widget		/* widget */,
+    XtPointer		/* base */,
+    XtResourceList	/* resources */,
+    Cardinal		/* num_resources */,
+    ...
+) _X_SENTINEL(0);
+
+extern void XtGetSubresources(
+    Widget 		/* widget */,
+    XtPointer 		/* base */,
+    _Xconst _XtString 	/* name */,
+    _Xconst _XtString 	/* class */,
+    XtResourceList 	/* resources */,
+    Cardinal 		/* num_resources */,
+    ArgList 		/* args */,
+    Cardinal 		/* num_args */
+);
+
+extern void XtVaGetSubresources(
+    Widget		/* widget */,
+    XtPointer		/* base */,
+    _Xconst _XtString	/* name */,
+    _Xconst _XtString	/* class */,
+    XtResourceList	/* resources */,
+    Cardinal		/* num_resources */,
+    ...
+) _X_SENTINEL(0);
+
+extern void XtSetValues(
+    Widget 		/* widget */,
+    ArgList 		/* args */,
+    Cardinal 		/* num_args */
+);
+
+extern void XtVaSetValues(
+    Widget		/* widget */,
+    ...
+) _X_SENTINEL(0);
+
+extern void XtGetValues(
+    Widget 		/* widget */,
+    ArgList 		/* args */,
+    Cardinal 		/* num_args */
+);
+
+extern void XtVaGetValues(
+    Widget		/* widget */,
+    ...
+) _X_SENTINEL(0);
+
+extern void XtSetSubvalues(
+    XtPointer 		/* base */,
+    XtResourceList 	/* resources */,
+    Cardinal 		/* num_resources */,
+    ArgList 		/* args */,
+    Cardinal 		/* num_args */
+);
+
+extern void XtVaSetSubvalues(
+    XtPointer		/* base */,
+    XtResourceList	/* resources */,
+    Cardinal		/* num_resources */,
+    ...
+) _X_SENTINEL(0);
+
+extern void XtGetSubvalues(
+    XtPointer 		/* base */,
+    XtResourceList 	/* resources */,
+    Cardinal 		/* num_resources */,
+    ArgList 		/* args */,
+    Cardinal 		/* num_args */
+);
+
+extern void XtVaGetSubvalues(
+    XtPointer		/* base */,
+    XtResourceList	/* resources */,
+    Cardinal		/* num_resources */,
+    ...
+) _X_SENTINEL(0);
+
+extern void XtGetResourceList(
+    WidgetClass 	/* widget_class */,
+    XtResourceList*	/* resources_return */,
+    Cardinal*		/* num_resources_return */
+);
+
+extern void XtGetConstraintResourceList(
+    WidgetClass 	/* widget_class */,
+    XtResourceList*	/* resources_return */,
+    Cardinal*		/* num_resources_return */
+);
+
+#define XtUnspecifiedPixmap	((Pixmap)2)
+#define XtUnspecifiedShellInt	(-1)
+#define XtUnspecifiedWindow	((Window)2)
+#define XtUnspecifiedWindowGroup ((Window)3)
+#define XtCurrentDirectory	"XtCurrentDirectory"
+#define XtDefaultForeground	"XtDefaultForeground"
+#define XtDefaultBackground	"XtDefaultBackground"
+#define XtDefaultFont		"XtDefaultFont"
+#define XtDefaultFontSet	"XtDefaultFontSet"
+
+#define XtOffset(p_type,field) \
+	((Cardinal) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
+
+#ifdef offsetof
+#define XtOffsetOf(s_type,field) offsetof(s_type,field)
+#else
+#define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
+#endif
+
+/*************************************************************
+ *
+ * Session Management
+ *
+ ************************************************************/
+
+typedef struct _XtCheckpointTokenRec {
+    int		save_type;
+    int		interact_style;
+    Boolean	shutdown;
+    Boolean	fast;
+    Boolean	cancel_shutdown;
+    int		phase;
+    int		interact_dialog_type;	/* return */
+    Boolean	request_cancel;		/* return */
+    Boolean	request_next_phase;	/* return */
+    Boolean	save_success;		/* return */
+    int		type;		/* implementation private */
+    Widget	widget;		/* implementation private */
+} XtCheckpointTokenRec, *XtCheckpointToken;
+
+XtCheckpointToken XtSessionGetToken(
+    Widget		/* widget */
+);
+
+void XtSessionReturnToken(
+    XtCheckpointToken	/* token */
+);
+
+/*************************************************************
+ *
+ * Error Handling
+ *
+ ************************************************************/
+
+extern XtErrorMsgHandler XtAppSetErrorMsgHandler(
+    XtAppContext 	/* app_context */,
+    XtErrorMsgHandler 	/* handler */
+);
+
+extern void XtSetErrorMsgHandler( /* obsolete */
+    XtErrorMsgHandler 	/* handler */
+);
+
+extern XtErrorMsgHandler XtAppSetWarningMsgHandler(
+    XtAppContext 	/* app_context */,
+    XtErrorMsgHandler 	/* handler */
+);
+
+extern void XtSetWarningMsgHandler( /* obsolete */
+    XtErrorMsgHandler 	/* handler */
+);
+
+extern void XtAppErrorMsg(
+    XtAppContext 	/* app_context */,
+    _Xconst _XtString 	/* name */,
+    _Xconst _XtString	/* type */,
+    _Xconst _XtString	/* class */,
+    _Xconst _XtString	/* default */,
+    String*		/* params */,
+    Cardinal*		/* num_params */
+);
+
+extern void XtErrorMsg( /* obsolete */
+    _Xconst _XtString 	/* name */,
+    _Xconst _XtString	/* type */,
+    _Xconst _XtString	/* class */,
+    _Xconst _XtString	/* default */,
+    String*		/* params */,
+    Cardinal*		/* num_params */
+);
+
+extern void XtAppWarningMsg(
+    XtAppContext 	/* app_context */,
+    _Xconst _XtString 	/* name */,
+    _Xconst _XtString 	/* type */,
+    _Xconst _XtString 	/* class */,
+    _Xconst _XtString 	/* default */,
+    String*		/* params */,
+    Cardinal*		/* num_params */
+);
+
+extern void XtWarningMsg( /* obsolete */
+    _Xconst _XtString	/* name */,
+    _Xconst _XtString	/* type */,
+    _Xconst _XtString	/* class */,
+    _Xconst _XtString	/* default */,
+    String*		/* params */,
+    Cardinal*		/* num_params */
+);
+
+extern XtErrorHandler XtAppSetErrorHandler(
+    XtAppContext 	/* app_context */,
+    XtErrorHandler 	/* handler */
+);
+
+extern void XtSetErrorHandler( /* obsolete */
+    XtErrorHandler 	/* handler */
+);
+
+extern XtErrorHandler XtAppSetWarningHandler(
+    XtAppContext 	/* app_context */,
+    XtErrorHandler 	/* handler */
+);
+
+extern void XtSetWarningHandler( /* obsolete */
+    XtErrorHandler 	/* handler */
+);
+
+extern void XtAppError(
+    XtAppContext 	/* app_context */,
+    _Xconst _XtString	/* message */
+);
+
+extern void XtError( /* obsolete */
+    _Xconst _XtString	/* message */
+);
+
+extern void XtAppWarning(
+    XtAppContext 	/* app_context */,
+    _Xconst _XtString	/* message */
+);
+
+extern void XtWarning( /* obsolete */
+    _Xconst _XtString	/* message */
+);
+
+extern XrmDatabase *XtAppGetErrorDatabase(
+    XtAppContext 	/* app_context */
+);
+
+extern XrmDatabase *XtGetErrorDatabase( /* obsolete */
+    void
+);
+
+extern void XtAppGetErrorDatabaseText(
+    XtAppContext 	/* app_context */,
+    _Xconst _XtString	/* name */,
+    _Xconst _XtString	/* type */,
+    _Xconst _XtString	/* class */,
+    _Xconst _XtString 	/* default */,
+    String 		/* buffer_return */,
+    int 		/* nbytes */,
+    XrmDatabase 	/* database */
+);
+
+extern void XtGetErrorDatabaseText( /* obsolete */
+    _Xconst _XtString	/* name */,
+    _Xconst _XtString	/* type */,
+    _Xconst _XtString	/* class */,
+    _Xconst _XtString 	/* default */,
+    String 		/* buffer_return */,
+    int 		/* nbytes */
+);
+
+/****************************************************************
+ *
+ * Memory Management
+ *
+ ****************************************************************/
+
+extern char *XtMalloc(
+    Cardinal 		/* size */
+);
+
+extern char *XtCalloc(
+    Cardinal		/* num */,
+    Cardinal 		/* size */
+);
+
+extern char *XtRealloc(
+    char* 		/* ptr */,
+    Cardinal 		/* num */
+);
+
+extern void XtFree(
+    char*		/* ptr */
+);
+
+#ifndef _X_RESTRICT_KYWD
+# define _X_RESTRICT_KYWD
+#endif
+extern Cardinal XtAsprintf(
+    String *new_string,
+    _Xconst char * _X_RESTRICT_KYWD format,
+    ...
+) _X_ATTRIBUTE_PRINTF(2,3);
+
+#ifdef XTTRACEMEMORY
+
+extern char *_XtMalloc( /* implementation-private */
+    Cardinal	/* size */,
+    char *	/* file */,
+    int	        /* line */
+);
+
+extern char *_XtRealloc( /* implementation-private */
+    char *	/* ptr */,
+    Cardinal    /* size */,
+    char *	/* file */,
+    int		/* line */
+);
+
+extern char *_XtCalloc( /* implementation-private */
+    Cardinal	/* num */,
+    Cardinal 	/* size */,
+    char *	/* file */,
+    int		/* line */
+);
+
+extern void _XtFree( /* implementation-private */
+    char *	/* ptr */
+);
+
+#define XtMalloc(size) _XtMalloc(size, __FILE__, __LINE__)
+#define XtRealloc(ptr,size) _XtRealloc(ptr, size, __FILE__, __LINE__)
+#define XtCalloc(num,size) _XtCalloc(num, size, __FILE__, __LINE__)
+#define XtFree(ptr) _XtFree(ptr)
+
+#endif /* ifdef XTTRACEMEMORY */
+
+#define XtNew(type) ((type *) XtMalloc((unsigned) sizeof(type)))
+
+#undef XtNewString
+extern String XtNewString(String /* str */);
+#define XtNewString(str) \
+    ((str) != NULL ? (strcpy(XtMalloc((unsigned)strlen(str) + 1), str)) : NULL)
+
+/*************************************************************
+ *
+ *  Work procs
+ *
+ **************************************************************/
+
+extern XtWorkProcId XtAddWorkProc( /* obsolete */
+    XtWorkProc 		/* proc */,
+    XtPointer 		/* closure */
+);
+
+extern XtWorkProcId XtAppAddWorkProc(
+    XtAppContext 	/* app_context */,
+    XtWorkProc 		/* proc */,
+    XtPointer 		/* closure */
+);
+
+extern void  XtRemoveWorkProc(
+    XtWorkProcId 	/* id */
+);
+
+
+/****************************************************************
+ *
+ * Graphic Context Management
+ *****************************************************************/
+
+extern GC XtGetGC(
+    Widget 		/* widget */,
+    XtGCMask 		/* valueMask */,
+    XGCValues* 		/* values */
+);
+
+extern GC XtAllocateGC(
+    Widget 		/* widget */,
+    Cardinal		/* depth */,
+    XtGCMask 		/* valueMask */,
+    XGCValues* 		/* values */,
+    XtGCMask		/* dynamicMask */,
+    XtGCMask		/* unusedMask */
+);
+
+/* This implementation of XtDestroyGC differs from the formal specification
+ * for historic backwards compatibility reasons.  As other implementations
+ * may conform to the spec, use of XtReleaseGC is strongly encouraged.
+ */
+extern void XtDestroyGC( /* obsolete */
+    GC 			/* gc */
+);
+
+extern void XtReleaseGC(
+    Widget 		/* object */,
+    GC 			/* gc */
+);
+
+
+
+extern void XtAppReleaseCacheRefs(
+    XtAppContext	/* app_context */,
+    XtCacheRef*		/* cache_ref */
+);
+
+extern void XtCallbackReleaseCacheRef(
+    Widget 		/* widget */,
+    XtPointer 		/* closure */,	/* XtCacheRef */
+    XtPointer 		/* call_data */
+);
+
+extern void XtCallbackReleaseCacheRefList(
+    Widget 		/* widget */,
+    XtPointer 		/* closure */,	/* XtCacheRef* */
+    XtPointer 		/* call_data */
+);
+
+extern void XtSetWMColormapWindows(
+    Widget 		/* widget */,
+    Widget*		/* list */,
+    Cardinal		/* count */
+);
+
+extern String XtFindFile(
+    _Xconst _XtString	/* path */,
+    Substitution	/* substitutions */,
+    Cardinal 		/* num_substitutions */,
+    XtFilePredicate	/* predicate */
+);
+
+extern String XtResolvePathname(
+    Display*		/* dpy */,
+    _Xconst _XtString	/* type */,
+    _Xconst _XtString	/* filename */,
+    _Xconst _XtString	/* suffix */,
+    _Xconst _XtString	/* path */,
+    Substitution	/* substitutions */,
+    Cardinal		/* num_substitutions */,
+    XtFilePredicate 	/* predicate */
+);
+
+/****************************************************************
+ *
+ * Selections
+ *
+ *****************************************************************/
+
+#define XT_CONVERT_FAIL (Atom)0x80000001
+
+extern void XtDisownSelection(
+    Widget 		/* widget */,
+    Atom 		/* selection */,
+    Time 		/* time */
+);
+
+extern void XtGetSelectionValue(
+    Widget 		/* widget */,
+    Atom 		/* selection */,
+    Atom 		/* target */,
+    XtSelectionCallbackProc /* callback */,
+    XtPointer 		/* closure */,
+    Time 		/* time */
+);
+
+extern void XtGetSelectionValues(
+    Widget 		/* widget */,
+    Atom 		/* selection */,
+    Atom*		/* targets */,
+    int 		/* count */,
+    XtSelectionCallbackProc /* callback */,
+    XtPointer*		/* closures */,
+    Time 		/* time */
+);
+
+extern void XtAppSetSelectionTimeout(
+    XtAppContext 	/* app_context */,
+    unsigned long 	/* timeout */
+);
+
+extern void XtSetSelectionTimeout( /* obsolete */
+    unsigned long 	/* timeout */
+);
+
+extern unsigned long XtAppGetSelectionTimeout(
+    XtAppContext 	/* app_context */
+);
+
+extern unsigned long XtGetSelectionTimeout( /* obsolete */
+    void
+);
+
+extern XSelectionRequestEvent *XtGetSelectionRequest(
+    Widget 		/* widget */,
+    Atom 		/* selection */,
+    XtRequestId 	/* request_id */
+);
+
+extern void XtGetSelectionValueIncremental(
+    Widget 		/* widget */,
+    Atom 		/* selection */,
+    Atom 		/* target */,
+    XtSelectionCallbackProc /* selection_callback */,
+    XtPointer 		/* client_data */,
+    Time 		/* time */
+);
+
+extern void XtGetSelectionValuesIncremental(
+    Widget 		/* widget */,
+    Atom 		/* selection */,
+    Atom*		/* targets */,
+    int 		/* count */,
+    XtSelectionCallbackProc /* callback */,
+    XtPointer*		/* client_data */,
+    Time 		/* time */
+);
+
+extern void XtSetSelectionParameters(
+    Widget		/* requestor */,
+    Atom		/* selection */,
+    Atom		/* type */,
+    XtPointer		/* value */,
+    unsigned long	/* length */,
+    int			/* format */
+);
+
+extern void XtGetSelectionParameters(
+    Widget		/* owner */,
+    Atom		/* selection */,
+    XtRequestId		/* request_id */,
+    Atom*		/* type_return */,
+    XtPointer*		/* value_return */,
+    unsigned long*	/* length_return */,
+    int*		/* format_return */
+);
+
+extern void XtCreateSelectionRequest(
+    Widget		/* requestor */,
+    Atom		/* selection */
+);
+
+extern void XtSendSelectionRequest(
+    Widget		/* requestor */,
+    Atom		/* selection */,
+    Time		/* time */
+);
+
+extern void XtCancelSelectionRequest(
+    Widget		/* requestor */,
+    Atom		/* selection */
+);
+
+extern Atom XtReservePropertyAtom(
+    Widget		/* widget */
+);
+
+extern void XtReleasePropertyAtom(
+    Widget		/* widget */,
+    Atom		/* selection */
+);
+
+extern void XtGrabKey(
+    Widget 		/* widget */,
+    _XtKeyCode 		/* keycode */,
+    Modifiers	 	/* modifiers */,
+    _XtBoolean 		/* owner_events */,
+    int 		/* pointer_mode */,
+    int 		/* keyboard_mode */
+);
+
+extern void XtUngrabKey(
+    Widget 		/* widget */,
+    _XtKeyCode 		/* keycode */,
+    Modifiers	 	/* modifiers */
+);
+
+extern int XtGrabKeyboard(
+    Widget 		/* widget */,
+    _XtBoolean 		/* owner_events */,
+    int 		/* pointer_mode */,
+    int 		/* keyboard_mode */,
+    Time 		/* time */
+);
+
+extern void XtUngrabKeyboard(
+    Widget 		/* widget */,
+    Time 		/* time */
+);
+
+extern void XtGrabButton(
+    Widget 		/* widget */,
+    int 		/* button */,
+    Modifiers	 	/* modifiers */,
+    _XtBoolean 		/* owner_events */,
+    unsigned int	/* event_mask */,
+    int 		/* pointer_mode */,
+    int 		/* keyboard_mode */,
+    Window 		/* confine_to */,
+    Cursor 		/* cursor */
+);
+
+extern void XtUngrabButton(
+    Widget 		/* widget */,
+    unsigned int	/* button */,
+    Modifiers	 	/* modifiers */
+);
+
+extern int XtGrabPointer(
+    Widget 		/* widget */,
+    _XtBoolean 		/* owner_events */,
+    unsigned int	/* event_mask */,
+    int 		/* pointer_mode */,
+    int 		/* keyboard_mode */,
+    Window 		/* confine_to */,
+    Cursor 		/* cursor */,
+    Time 		/* time */
+);
+
+extern void XtUngrabPointer(
+    Widget 		/* widget */,
+    Time 		/* time */
+);
+
+extern void XtGetApplicationNameAndClass(
+    Display*		/* dpy */,
+    String*		/* name_return */,
+    String*		/* class_return */
+);
+
+extern void XtRegisterDrawable(
+    Display*		/* dpy */,
+    Drawable		/* drawable */,
+    Widget		/* widget */
+);
+
+extern void XtUnregisterDrawable(
+    Display*		/* dpy */,
+    Drawable		/* drawable */
+);
+
+extern Widget XtHooksOfDisplay(
+    Display*		/* dpy */
+);
+
+typedef struct {
+    String type;
+    Widget widget;
+    ArgList args;
+    Cardinal num_args;
+} XtCreateHookDataRec, *XtCreateHookData;
+
+typedef struct {
+    String type;
+    Widget widget;
+    XtPointer event_data;
+    Cardinal num_event_data;
+} XtChangeHookDataRec, *XtChangeHookData;
+
+typedef struct {
+    Widget old, req;
+    ArgList args;
+    Cardinal num_args;
+} XtChangeHookSetValuesDataRec, *XtChangeHookSetValuesData;
+
+typedef struct {
+    String type;
+    Widget widget;
+    XtGeometryMask changeMask;
+    XWindowChanges changes;
+} XtConfigureHookDataRec, *XtConfigureHookData;
+
+typedef struct {
+    String type;
+    Widget widget;
+    XtWidgetGeometry* request;
+    XtWidgetGeometry* reply;
+    XtGeometryResult result;
+} XtGeometryHookDataRec, *XtGeometryHookData;
+
+typedef struct {
+    String type;
+    Widget widget;
+} XtDestroyHookDataRec, *XtDestroyHookData;
+
+extern void XtGetDisplays(
+    XtAppContext	/* app_context */,
+    Display***		/* dpy_return */,
+    Cardinal*		/* num_dpy_return */
+);
+
+extern Boolean XtToolkitThreadInitialize(
+    void
+);
+
+extern void XtAppSetExitFlag(
+    XtAppContext	/* app_context */
+);
+
+extern Boolean XtAppGetExitFlag(
+    XtAppContext	/* app_context */
+);
+
+extern void XtAppLock(
+    XtAppContext	/* app_context */
+);
+
+extern void XtAppUnlock(
+    XtAppContext	/* app_context */
+);
+
+/*
+ *	Predefined Resource Converters
+ */
+
+
+/* String converters */
+
+extern Boolean XtCvtStringToAcceleratorTable(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtStringToAtom(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* Display */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtStringToBool(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtStringToBoolean(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtStringToCommandArgArray(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtStringToCursor(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* Display */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtStringToDimension(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtStringToDirectoryString(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtStringToDisplay(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtStringToFile(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtStringToFloat(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtStringToFont(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* Display */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtStringToFontSet(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* Display, locale */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtStringToFontStruct(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* Display */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtStringToGravity(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtStringToInitialState(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtStringToInt(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtStringToPixel(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* Screen, Colormap */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+#define XtCvtStringToPosition XtCvtStringToShort
+
+extern Boolean XtCvtStringToRestartStyle(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtStringToShort(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtStringToTranslationTable(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtStringToUnsignedChar(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtStringToVisual(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* Screen, depth */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+/* int converters */
+
+extern Boolean XtCvtIntToBool(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtIntToBoolean(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtIntToColor(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* Screen, Colormap */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+#define XtCvtIntToDimension XtCvtIntToShort
+
+extern Boolean XtCvtIntToFloat(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtIntToFont(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtIntToPixel(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtIntToPixmap(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+#define XtCvtIntToPosition XtCvtIntToShort
+
+extern Boolean XtCvtIntToShort(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+extern Boolean XtCvtIntToUnsignedChar(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+/* Color converter */
+
+extern Boolean XtCvtColorToPixel(
+    Display*	/* dpy */,
+    XrmValuePtr /* args */,	/* none */
+    Cardinal*   /* num_args */,
+    XrmValuePtr	/* fromVal */,
+    XrmValuePtr	/* toVal */,
+    XtPointer*	/* closure_ret */
+);
+
+/* Pixel converter */
+
+#define XtCvtPixelToColor XtCvtIntToColor
+
+
+_XFUNCPROTOEND
+
+#endif /*_XtIntrinsic_h*/
+/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/ThirdParty/X11/Include/X11/IntrinsicI.h b/ThirdParty/X11/Include/X11/IntrinsicI.h
new file mode 100644
index 0000000000000000000000000000000000000000..845ab483a5cb5261d981c6664ab14ccb44784665
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/IntrinsicI.h
@@ -0,0 +1,229 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XtintrinsicI_h
+#define _XtintrinsicI_h
+
+#include "Xtos.h"
+#include "IntrinsicP.h"
+#ifdef WIN32
+#define _WILLWINSOCK_
+#endif
+#include <X11/Xos.h>
+
+#include "Object.h"
+#include "RectObj.h"
+#include "ObjectP.h"
+#include "RectObjP.h"
+
+#include "ConvertI.h"
+#include "TranslateI.h"
+
+#define RectObjClassFlag	0x02
+#define WidgetClassFlag		0x04
+#define CompositeClassFlag	0x08
+#define ConstraintClassFlag	0x10
+#define ShellClassFlag		0x20
+#define WMShellClassFlag	0x40
+#define TopLevelClassFlag	0x80
+
+/*
+ * The following macros, though very handy, are not suitable for
+ * IntrinsicP.h as they violate the rule that arguments are to
+ * be evaluated exactly once.
+ */
+
+#define XtDisplayOfObject(object) \
+    (XtIsWidget(object) ? (object)->core.screen->display : \
+    _XtIsHookObject(object) ? ((HookObject)(object))->hooks.screen->display : \
+    _XtWindowedAncestor(object)->core.screen->display)
+
+#define XtScreenOfObject(object) \
+    (XtIsWidget(object) ? (object)->core.screen : \
+    _XtIsHookObject(object) ? ((HookObject)(object))->hooks.screen : \
+    _XtWindowedAncestor(object)->core.screen)
+
+#define XtWindowOfObject(object) \
+    ((XtIsWidget(object) ? (object) : _XtWindowedAncestor(object)) \
+     ->core.window)
+
+#define XtIsManaged(object) \
+    (XtIsRectObj(object) ? (object)->core.managed : False)
+
+#define XtIsSensitive(object) \
+    (XtIsRectObj(object) ? ((object)->core.sensitive && \
+			    (object)->core.ancestor_sensitive) : False)
+
+
+/****************************************************************
+ *
+ * Byte utilities
+ *
+ ****************************************************************/
+
+#define _XBCOPYFUNC _XtBcopy
+#include <X11/Xfuncs.h>
+
+#define XtMemmove(dst, src, size)	\
+    if ((char *)(dst) != (char *)(src)) {		    \
+	(void) memcpy((char *) (dst), (char *) (src), (int) (size)); \
+    }
+
+#define XtBZero(dst, size) 	\
+	bzero((char *) (dst), (int) (size))
+
+#define XtMemcmp(b1, b2, size) 		\
+	memcmp((char *) (b1), (char *) (b2), (int) (size))
+
+
+/****************************************************************
+ *
+ * Stack cache allocation/free
+ *
+ ****************************************************************/
+
+#define XtStackAlloc(size, stack_cache_array)     \
+    ((size) <= sizeof(stack_cache_array)	  \
+    ?  (XtPointer)(stack_cache_array)		  \
+    :  XtMalloc((unsigned)(size)))
+
+#define XtStackFree(pointer, stack_cache_array) \
+    { if ((pointer) != ((XtPointer)(stack_cache_array))) XtFree(pointer); }
+
+/***************************************************************
+ *
+ * Filename defines
+ *
+ **************************************************************/
+
+/* used by XtResolvePathname */
+#ifndef XFILESEARCHPATHDEFAULT
+#define XFILESEARCHPATHDEFAULT "/usr/lib/X11/%L/%T/%N%S:/usr/lib/X11/%l/%T/%N%S:/usr/lib/X11/%T/%N%S"
+#endif
+
+/* the following two were both "X Toolkit " prior to R4 */
+#ifndef XTERROR_PREFIX
+#define XTERROR_PREFIX ""
+#endif
+
+#ifndef XTWARNING_PREFIX
+#define XTWARNING_PREFIX ""
+#endif
+
+#ifndef ERRORDB
+#define ERRORDB "/usr/lib/X11/XtErrorDB"
+#endif
+
+_XFUNCPROTOBEGIN
+
+extern String XtCXtToolkitError;
+
+extern void _XtAllocError(
+    String	/* alloc_type */
+);
+
+extern void _XtCompileResourceList(
+    XtResourceList 	/* resources */,
+    Cardinal 		/* num_resources */
+);
+
+extern XtGeometryResult _XtMakeGeometryRequest(
+    Widget 		/* widget */,
+    XtWidgetGeometry*	/* request */,
+    XtWidgetGeometry*	/* reply_return */,
+    Boolean*		/* clear_rect_obj */
+);
+
+extern Boolean _XtIsHookObject(
+    Widget      /* widget */
+);
+
+extern void _XtAddShellToHookObj(
+    Widget      /* widget */
+);
+
+/* GCManager.c */
+extern void _XtGClistFree(Display *dpy, XtPerDisplay pd);
+
+/** GeoTattler stuff */
+
+#ifdef XT_GEO_TATTLER
+
+extern void _XtGeoTab (int);
+extern void _XtGeoTrace (
+			    Widget widget,
+			    ...
+) _X_ATTRIBUTE_PRINTF(2,3);
+
+#define CALLGEOTAT(f) f
+
+#else /* XT_GEO_TATTLER */
+
+#define CALLGEOTAT(f)
+
+#endif /* XT_GEO_TATTLER */
+
+#ifndef XTTRACEMEMORY
+
+extern char* __XtMalloc (
+    unsigned	/* size */
+);
+extern char* __XtCalloc (
+    unsigned	/* num */,
+    unsigned	/* size */
+);
+
+#else
+
+#define __XtMalloc XtMalloc
+#define __XtCalloc XtCalloc
+#endif
+
+_XFUNCPROTOEND
+
+#endif /* _XtintrinsicI_h */
+/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/ThirdParty/X11/Include/X11/IntrinsicP.h b/ThirdParty/X11/Include/X11/IntrinsicP.h
new file mode 100644
index 0000000000000000000000000000000000000000..f2ded6f74c4bb55592b90e94515ad323ca095d33
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/IntrinsicP.h
@@ -0,0 +1,329 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XtintrinsicP_h
+#define _XtintrinsicP_h
+
+#include <X11/Intrinsic.h>
+
+/*
+ * Field sizes and offsets of XrmResource must match those of XtResource.
+ * Type long is used instead of XrmQuark here because XrmQuark and String
+ * are not the same size on all systems.
+ */
+typedef struct {
+    long	xrm_name;	  /* Resource name quark		*/
+    long	xrm_class;	  /* Resource class quark		*/
+    long	xrm_type;	  /* Resource representation type quark */
+    Cardinal	xrm_size;	  /* Size in bytes of representation	*/
+    int		xrm_offset;	  /* -offset-1				*/
+    long	xrm_default_type; /* Default representation type quark	*/
+    XtPointer	xrm_default_addr; /* Default resource address		*/
+} XrmResource, *XrmResourceList;
+
+typedef unsigned long XtVersionType;
+
+#define XT_VERSION 11
+#ifndef XT_REVISION
+#define XT_REVISION 6
+#endif
+#define XtVersion (XT_VERSION * 1000 + XT_REVISION)
+#define XtVersionDontCheck 0
+
+typedef void (*XtProc)(
+    void
+);
+
+typedef void (*XtWidgetClassProc)(
+    WidgetClass /* class */
+);
+
+typedef void (*XtWidgetProc)(
+    Widget	/* widget */
+);
+
+typedef Boolean (*XtAcceptFocusProc)(
+    Widget	/* widget */,
+    Time*	/* time */
+);
+
+typedef void (*XtArgsProc)(
+    Widget	/* widget */,
+    ArgList	/* args */,
+    Cardinal*	/* num_args */
+);
+
+typedef void (*XtInitProc)(
+    Widget	/* request */,
+    Widget	/* new */,
+    ArgList	/* args */,
+    Cardinal*	/* num_args */
+);
+
+typedef Boolean (*XtSetValuesFunc)(
+    Widget 	/* old */,
+    Widget 	/* request */,
+    Widget 	/* new */,
+    ArgList 	/* args */,
+    Cardinal*	/* num_args */
+);
+
+typedef Boolean (*XtArgsFunc)(
+    Widget	/* widget */,
+    ArgList	/* args */,
+    Cardinal*	/* num_args */
+);
+
+typedef void (*XtAlmostProc)(
+    Widget		/* old */,
+    Widget		/* new */,
+    XtWidgetGeometry*	/* request */,
+    XtWidgetGeometry*	/* reply */
+);
+
+typedef void (*XtExposeProc)(
+    Widget	/* widget */,
+    XEvent*	/* event */,
+    Region	/* region */
+);
+
+/* compress_exposure options*/
+#define XtExposeNoCompress		((XtEnum)False)
+#define XtExposeCompressSeries		((XtEnum)True)
+#define XtExposeCompressMultiple	2
+#define XtExposeCompressMaximal		3
+
+/* modifiers */
+#define XtExposeGraphicsExpose	  	0x10
+#define XtExposeGraphicsExposeMerged	0x20
+#define XtExposeNoExpose	  	0x40
+#define XtExposeNoRegion		0x80
+
+typedef void (*XtRealizeProc)(
+    Widget 		  /* widget */,
+    XtValueMask* 	  /* mask */,
+    XSetWindowAttributes* /* attributes */
+);
+
+typedef XtGeometryResult (*XtGeometryHandler)(
+    Widget		/* widget */,
+    XtWidgetGeometry*	/* request */,
+    XtWidgetGeometry*	/* reply */
+);
+
+typedef void (*XtStringProc)(
+    Widget	/* widget */,
+    String	/* str */
+);
+
+typedef struct {
+    String	name;	/* resource name */
+    String	type;	/* representation type name */
+    XtArgVal	value;	/* representation */
+    int		size;	/* size of representation */
+} XtTypedArg, *XtTypedArgList;
+
+typedef void (*XtAllocateProc)(
+    WidgetClass		/* widget_class */,
+    Cardinal *		/* constraint_size */,
+    Cardinal *		/* more_bytes */,
+    ArgList		/* args */,
+    Cardinal *		/* num_args */,
+    XtTypedArgList	/* typed_args */,
+    Cardinal *		/* num_typed_args */,
+    Widget *		/* widget_return */,
+    XtPointer *		/* more_bytes_return */
+);
+
+typedef void (*XtDeallocateProc)(
+    Widget		/* widget */,
+    XtPointer		/* more_bytes */
+);
+
+struct _XtStateRec;	/* Forward declare before use for C++ */
+
+typedef struct _XtTMRec {
+    XtTranslations  translations;	/* private to Translation Manager    */
+    XtBoundActions  proc_table;		/* procedure bindings for actions    */
+    struct _XtStateRec *current_state;  /* Translation Manager state ptr     */
+    unsigned long   lastEventTime;
+} XtTMRec, *XtTM;
+
+#include <X11/CoreP.h>
+#include <X11/CompositeP.h>
+#include <X11/ConstrainP.h>
+#include <X11/ObjectP.h>
+#include <X11/RectObjP.h>
+
+#define XtDisplay(widget)	DisplayOfScreen((widget)->core.screen)
+#define XtScreen(widget)	((widget)->core.screen)
+#define XtWindow(widget)	((widget)->core.window)
+
+#define XtClass(widget)		((widget)->core.widget_class)
+#define XtSuperclass(widget)	(XtClass(widget)->core_class.superclass)
+#define XtIsRealized(object)	(XtWindowOfObject(object) != None)
+#define XtParent(widget)	((widget)->core.parent)
+
+#undef XtIsRectObj
+extern Boolean XtIsRectObj(Widget);
+#define XtIsRectObj(obj) \
+    (((Object)(obj))->object.widget_class->core_class.class_inited & 0x02)
+
+#undef XtIsWidget
+extern Boolean XtIsWidget(Widget);
+#define XtIsWidget(obj) \
+    (((Object)(obj))->object.widget_class->core_class.class_inited & 0x04)
+
+#undef XtIsComposite
+extern Boolean XtIsComposite(Widget);
+#define XtIsComposite(obj) \
+    (((Object)(obj))->object.widget_class->core_class.class_inited & 0x08)
+
+#undef XtIsConstraint
+extern Boolean XtIsConstraint(Widget);
+#define XtIsConstraint(obj) \
+    (((Object)(obj))->object.widget_class->core_class.class_inited & 0x10)
+
+#undef XtIsShell
+extern Boolean XtIsShell(Widget);
+#define XtIsShell(obj) \
+    (((Object)(obj))->object.widget_class->core_class.class_inited & 0x20)
+
+#undef XtIsWMShell
+extern Boolean XtIsWMShell(Widget);
+#define XtIsWMShell(obj) \
+    (((Object)(obj))->object.widget_class->core_class.class_inited & 0x40)
+
+#undef XtIsTopLevelShell
+extern Boolean XtIsTopLevelShell(Widget);
+#define XtIsTopLevelShell(obj) \
+    (((Object)(obj))->object.widget_class->core_class.class_inited & 0x80)
+
+#ifdef DEBUG
+#define XtCheckSubclass(w, widget_class_ptr, message)	\
+	if (!XtIsSubclass(((Widget)(w)), (widget_class_ptr))) {	\
+	    String params[3];				\
+	    Cardinal num_params = 3;			\
+	    params[0] = ((Widget)(w))->core.widget_class->core_class.class_name;\
+	    params[1] = (widget_class_ptr)->core_class.class_name;	     \
+	    params[2] = (message);					     \
+	    XtAppErrorMsg(XtWidgetToApplicationContext((Widget)(w)),	     \
+		    "subclassMismatch", "xtCheckSubclass", "XtToolkitError", \
+		    "Widget class %s found when subclass of %s expected: %s",\
+		    params, &num_params);		\
+	}
+#else
+#define XtCheckSubclass(w, widget_class, message)	/* nothing */
+#endif
+
+_XFUNCPROTOBEGIN
+
+extern Widget _XtWindowedAncestor( /* internal; implementation-dependent */
+    Widget 		/* object */
+);
+
+#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(LIBXT_COMPILATION)
+__declspec(dllimport)
+#else
+extern
+#endif
+void _XtInherit(
+    void
+);
+
+extern void _XtHandleFocus(
+    Widget		/* widget */,
+    XtPointer		/* client_data */,
+    XEvent *		/* event */,
+    Boolean *		/* cont */);
+
+extern void XtCreateWindow(
+    Widget 		/* widget */,
+    unsigned int 	/* window_class */,
+    Visual*		/* visual */,
+    XtValueMask		/* value_mask */,
+    XSetWindowAttributes* /* attributes */
+);
+
+extern void XtResizeWidget(
+    Widget 		/* widget */,
+    _XtDimension	/* width */,
+    _XtDimension	/* height */,
+    _XtDimension	/* border_width */
+);
+
+extern void XtMoveWidget(
+    Widget 		/* widget */,
+    _XtPosition		/* x */,
+    _XtPosition		/* y */
+);
+
+extern void XtConfigureWidget(
+    Widget 		/* widget */,
+    _XtPosition		/* x */,
+    _XtPosition		/* y */,
+    _XtDimension	/* width */,
+    _XtDimension	/* height */,
+    _XtDimension	/* border_width */
+);
+
+extern void XtResizeWindow(
+    Widget 		/* widget */
+);
+
+extern void XtProcessLock(
+    void
+);
+
+extern void XtProcessUnlock(
+    void
+);
+
+_XFUNCPROTOEND
+
+#endif /* _XtIntrinsicP_h */
+/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/ThirdParty/X11/Include/X11/Object.h b/ThirdParty/X11/Include/X11/Object.h
new file mode 100644
index 0000000000000000000000000000000000000000..4be1f39704cf7d2bfe359deb8b00a52e8f548a43
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Object.h
@@ -0,0 +1,63 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XtObject_h
+#define _XtObject_h
+
+_XFUNCPROTOBEGIN
+
+typedef struct _ObjectRec *Object;
+typedef struct _ObjectClassRec *ObjectClass;
+
+#ifndef VMS
+externalref WidgetClass objectClass;
+#endif
+
+_XFUNCPROTOEND
+
+#endif /* _XtObject_h */
+/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/ThirdParty/X11/Include/X11/ObjectP.h b/ThirdParty/X11/Include/X11/ObjectP.h
new file mode 100644
index 0000000000000000000000000000000000000000..6e296f7756718b09eea33b6deab0188e8671af2b
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/ObjectP.h
@@ -0,0 +1,141 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _Xt_ObjectP_h_
+#define _Xt_ObjectP_h_
+
+#include <X11/Object.h>
+
+_XFUNCPROTOBEGIN
+
+/**********************************************************
+ * Object Instance Data Structures
+ *
+ **********************************************************/
+/* these fields match CorePart and can not be changed */
+
+typedef struct _ObjectPart {
+    Widget          self;               /* pointer to widget itself          */
+    WidgetClass     widget_class;       /* pointer to Widget's ClassRec      */
+    Widget          parent;             /* parent widget                     */
+    XrmName         xrm_name;           /* widget resource name quarkified   */
+    Boolean         being_destroyed;    /* marked for destroy                */
+    XtCallbackList  destroy_callbacks;  /* who to call when widget destroyed */
+    XtPointer       constraints;        /* constraint record                 */
+} ObjectPart;
+
+typedef struct _ObjectRec {
+    ObjectPart  object;
+} ObjectRec;
+
+/********************************************************
+ * Object Class Data Structures
+ *
+ ********************************************************/
+/* these fields match CoreClassPart and can not be changed */
+/* ideally these structures would only contain the fields required;
+   but because the CoreClassPart cannot be changed at this late date
+   extraneous fields are necessary to make the field offsets match */
+
+typedef struct _ObjectClassPart {
+
+    WidgetClass     superclass;         /* pointer to superclass ClassRec   */
+    String          class_name;         /* widget resource class name       */
+    Cardinal        widget_size;        /* size in bytes of widget record   */
+    XtProc          class_initialize;   /* class initialization proc        */
+    XtWidgetClassProc class_part_initialize; /* dynamic initialization      */
+    XtEnum          class_inited;       /* has class been initialized?      */
+    XtInitProc      initialize;         /* initialize subclass fields       */
+    XtArgsProc      initialize_hook;    /* notify that initialize called    */
+    XtProc          obj1;		/* NULL                             */
+    XtPointer       obj2;               /* NULL                             */
+    Cardinal        obj3;               /* NULL                             */
+    XtResourceList  resources;          /* resources for subclass fields    */
+    Cardinal        num_resources;      /* number of entries in resources   */
+    XrmClass        xrm_class;          /* resource class quarkified        */
+    Boolean         obj4;               /* NULL                             */
+    XtEnum          obj5;               /* NULL                             */
+    Boolean         obj6;               /* NULL				    */
+    Boolean         obj7;               /* NULL                             */
+    XtWidgetProc    destroy;            /* free data for subclass pointers  */
+    XtProc          obj8;               /* NULL                             */
+    XtProc          obj9;               /* NULL			            */
+    XtSetValuesFunc set_values;         /* set subclass resource values     */
+    XtArgsFunc      set_values_hook;    /* notify that set_values called    */
+    XtProc          obj10;              /* NULL                             */
+    XtArgsProc      get_values_hook;    /* notify that get_values called    */
+    XtProc          obj11;              /* NULL                             */
+    XtVersionType   version;            /* version of intrinsics used       */
+    XtPointer       callback_private;   /* list of callback offsets         */
+    String          obj12;              /* NULL                             */
+    XtProc          obj13;              /* NULL                             */
+    XtProc          obj14;              /* NULL                             */
+    XtPointer       extension;          /* pointer to extension record      */
+}ObjectClassPart;
+
+typedef struct {
+    XtPointer next_extension;	/* 1st 4 required for all extension records */
+    XrmQuark record_type;	/* NULLQUARK; when on ObjectClassPart */
+    long version;		/* must be XtObjectExtensionVersion */
+    Cardinal record_size;	/* sizeof(ObjectClassExtensionRec) */
+    XtAllocateProc allocate;
+    XtDeallocateProc deallocate;
+} ObjectClassExtensionRec, *ObjectClassExtension;
+
+typedef struct _ObjectClassRec {
+    ObjectClassPart object_class;
+} ObjectClassRec;
+
+externalref ObjectClassRec objectClassRec;
+
+_XFUNCPROTOEND
+
+#define XtObjectExtensionVersion 1L
+#define XtInheritAllocate ((XtAllocateProc) _XtInherit)
+#define XtInheritDeallocate ((XtDeallocateProc) _XtInherit)
+
+#endif /*_Xt_ObjectP_h_*/
diff --git a/ThirdParty/X11/Include/X11/PM/PM.h b/ThirdParty/X11/Include/X11/PM/PM.h
new file mode 100644
index 0000000000000000000000000000000000000000..c96644c5fec5dd763fe15ad56dc058f7c1e6b270
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/PM/PM.h
@@ -0,0 +1,54 @@
+/* $Xorg: PM.h,v 1.4 2001/02/09 02:05:34 xorgcvs Exp $ */
+
+/*
+Copyright 1996, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+*/
+
+/*		Proxy Management Protocol		*/
+
+#ifndef _PM_H_
+#define _PM_H_
+
+#define PM_PROTOCOL_NAME "PROXY_MANAGEMENT"
+
+#define PM_MAJOR_VERSION 1
+#define PM_MINOR_VERSION 0
+
+/*
+ * PM minor opcodes
+ */
+#define PM_Error		ICE_Error /* == 0 */
+#define PM_GetProxyAddr		1
+#define PM_GetProxyAddrReply	2
+#define PM_StartProxy		3
+
+/*
+ * status return codes for GetProxyAddrReply
+ */
+#define		   PM_Unable	0
+#define		   PM_Success	1
+#define            PM_Failure	2
+
+#endif /* _PM_H_ */
diff --git a/ThirdParty/X11/Include/X11/PM/PMproto.h b/ThirdParty/X11/Include/X11/PM/PMproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..754e460c5f727b7f9b7ad080a96d5d2b452dd653
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/PM/PMproto.h
@@ -0,0 +1,74 @@
+/* $Xorg: PMproto.h,v 1.4 2001/02/09 02:05:34 xorgcvs Exp $ */
+
+/*
+Copyright 1996, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+*/
+
+/*		Proxy Management Protocol		*/
+
+#ifndef _PMPROTO_H_
+#define _PMPROTO_H_
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;	/* == 1 */
+    CARD16	authLen B16;
+    CARD32	length B32;
+    /* STRING	   proxy-service */
+    /* STRING	   server-address */
+    /* STRING	   host-address */
+    /* STRING	   start-options */
+    /* STRING	   auth-name (if authLen > 0) */
+    /* LISTofCARD8 auth-data (if authLen > 0) */
+} pmGetProxyAddrMsg;
+
+#define sz_pmGetProxyAddrMsg 8
+
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;	/* == 2 */
+    CARD8	status;
+    CARD8	unused;
+    CARD32	length B32;
+    /* STRING	proxy-address */
+    /* STRING	failure-reason */
+} pmGetProxyAddrReplyMsg;
+
+#define sz_pmGetProxyAddrReplyMsg 8
+
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;	/* == 3 */
+    CARD16	unused B16;
+    CARD32	length B32;
+    /* STRING	  proxy-service */
+} pmStartProxyMsg;
+
+#define sz_pmStartProxyMsg 8
+
+
+#endif /* _PMPROTO_H_ */
diff --git a/ThirdParty/X11/Include/X11/PassivGraI.h b/ThirdParty/X11/Include/X11/PassivGraI.h
new file mode 100644
index 0000000000000000000000000000000000000000..6b8cb52f70e027c92b08afda10713eca4201c234
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/PassivGraI.h
@@ -0,0 +1,185 @@
+/********************************************************
+
+Copyright 1988 by Hewlett-Packard Company
+Copyright 1987, 1988, 1989 by Digital Equipment Corporation, Maynard
+
+Permission to use, copy, modify, and distribute this software
+and its documentation for any purpose and without fee is hereby
+granted, provided that the above copyright notice appear in all
+copies and that both that copyright notice and this permission
+notice appear in supporting documentation, and that the names of
+Hewlett-Packard or Digital not be used in advertising or
+publicity pertaining to distribution of the software without specific,
+written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+
+/*
+
+Copyright 1987, 1988, 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _PDI_h_
+#define _PDI_h_
+
+
+#define KEYBOARD TRUE
+#define POINTER  FALSE
+
+_XFUNCPROTOBEGIN
+
+typedef enum {
+    XtNoServerGrab,
+    XtPassiveServerGrab,
+    XtActiveServerGrab,
+    XtPseudoPassiveServerGrab,
+    XtPseudoActiveServerGrab
+}XtServerGrabType;
+
+typedef struct _XtServerGrabRec {
+    struct _XtServerGrabRec 	*next;
+    Widget			widget;
+    unsigned int		ownerEvents:1;
+    unsigned int		pointerMode:1;
+    unsigned int		keyboardMode:1;
+    unsigned int		hasExt:1;
+    unsigned int		confineToIsWidgetWin:1;
+    KeyCode			keybut;
+    unsigned short		modifiers;
+    unsigned short		eventMask;
+} XtServerGrabRec, *XtServerGrabPtr;
+
+typedef struct _XtGrabExtRec {
+    Mask			*pKeyButMask;
+    Mask			*pModifiersMask;
+    Window			confineTo;
+    Cursor			cursor;
+} XtServerGrabExtRec, *XtServerGrabExtPtr;
+
+#define GRABEXT(p) ((XtServerGrabExtPtr)((p)+1))
+
+typedef struct _XtDeviceRec{
+    XtServerGrabRec	grab; 	/* need copy in order to protect
+				   during grab */
+    XtServerGrabType	grabType;
+}XtDeviceRec, *XtDevice;
+
+#define XtMyAncestor	0
+#define XtMyDescendant	1
+#define XtMyCousin	2
+#define XtMySelf	3
+#define XtUnrelated	4
+typedef char XtGeneology; /* do not use an enum makes PerWidgetInput larger */
+
+typedef struct {
+    Widget		focusKid;
+    XtServerGrabPtr	keyList, ptrList;
+    Widget		queryEventDescendant;
+    unsigned int	map_handler_added:1;
+    unsigned int	realize_handler_added:1;
+    unsigned int	active_handler_added:1;
+    unsigned int	haveFocus:1;
+    XtGeneology		focalPoint;
+}XtPerWidgetInputRec, *XtPerWidgetInput;
+
+typedef struct XtPerDisplayInputRec{
+    XtGrabList 	grabList;
+    XtDeviceRec keyboard, pointer;
+    KeyCode	activatingKey;
+    Widget 	*trace;
+    int		traceDepth, traceMax;
+    Widget 	focusWidget;
+}XtPerDisplayInputRec, *XtPerDisplayInput;
+
+#define IsServerGrab(g) ((g == XtPassiveServerGrab) ||\
+			 (g == XtActiveServerGrab))
+
+#define IsAnyGrab(g) ((g == XtPassiveServerGrab) ||\
+		      (g == XtActiveServerGrab)  ||\
+		      (g == XtPseudoPassiveServerGrab))
+
+#define IsEitherPassiveGrab(g) ((g == XtPassiveServerGrab) ||\
+				(g == XtPseudoPassiveServerGrab))
+
+#define IsPseudoGrab(g) ((g == XtPseudoPassiveServerGrab))
+
+extern void _XtDestroyServerGrabs(
+    Widget		/* w */,
+    XtPointer		/* pwi */, /*XtPerWidgetInput*/
+    XtPointer		/* call_data */
+);
+
+extern XtPerWidgetInput _XtGetPerWidgetInput(
+    Widget	/* widget */,
+    _XtBoolean	/* create */
+);
+
+extern XtServerGrabPtr _XtCheckServerGrabsOnWidget(
+    XEvent*		/* event */,
+    Widget		/* widget */,
+    _XtBoolean		/* isKeyboard */
+);
+
+/*
+extern XtGrabList* _XtGetGrabList( XtPerDisplayInput );
+*/
+
+#define _XtGetGrabList(pdi) (&(pdi)->grabList)
+
+extern void _XtFreePerWidgetInput(
+    Widget		/* w */,
+    XtPerWidgetInput	/* pwi */
+);
+
+extern Widget _XtProcessKeyboardEvent(
+    XKeyEvent*		/* event */,
+    Widget		/* widget */,
+    XtPerDisplayInput	/* pdi */
+);
+
+extern Widget _XtProcessPointerEvent(
+    XButtonEvent*	/* event */,
+    Widget		/* widget */,
+    XtPerDisplayInput	/* pdi */
+);
+
+extern void _XtRegisterPassiveGrabs(
+    Widget		/* widget */
+);
+
+extern void _XtClearAncestorCache(
+    Widget		/* widget */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _PDI_h_ */
diff --git a/ThirdParty/X11/Include/X11/RectObj.h b/ThirdParty/X11/Include/X11/RectObj.h
new file mode 100644
index 0000000000000000000000000000000000000000..fba883a5776124632ea7844511b147715205da2b
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/RectObj.h
@@ -0,0 +1,63 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XtRect_h
+#define _XtRect_h
+
+_XFUNCPROTOBEGIN
+
+typedef struct _RectObjRec *RectObj;
+typedef struct _RectObjClassRec *RectObjClass;
+
+#ifndef VMS
+externalref WidgetClass rectObjClass;
+#endif
+
+_XFUNCPROTOEND
+
+#endif /* _XtRect_h */
+/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/ThirdParty/X11/Include/X11/RectObjP.h b/ThirdParty/X11/Include/X11/RectObjP.h
new file mode 100644
index 0000000000000000000000000000000000000000..bb5a7d3f87a7d2ded5d0703e4eb93bfe72ce9231
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/RectObjP.h
@@ -0,0 +1,131 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _Xt_RectObjP_h_
+#define _Xt_RectObjP_h_
+
+#include <X11/RectObj.h>
+#include <X11/ObjectP.h>
+
+_XFUNCPROTOBEGIN
+
+/**********************************************************
+ * Rectangle Object Instance Data Structures
+ *
+ **********************************************************/
+/* these fields match CorePart and can not be changed */
+
+typedef struct _RectObjPart {
+    Position        x, y;               /* rectangle position               */
+    Dimension       width, height;      /* rectangle dimensions             */
+    Dimension       border_width;       /* rectangle border width           */
+    Boolean         managed;            /* is widget geometry managed?       */
+    Boolean         sensitive;          /* is widget sensitive to user events*/
+    Boolean         ancestor_sensitive; /* are all ancestors sensitive?      */
+}RectObjPart;
+
+typedef struct _RectObjRec {
+    ObjectPart object;
+    RectObjPart rectangle;
+} RectObjRec;
+
+
+
+/********************************************************
+ * Rectangle Object Class Data Structures
+ *
+ ********************************************************/
+/* these fields match CoreClassPart and can not be changed */
+/* ideally these structures would only contain the fields required;
+   but because the CoreClassPart cannot be changed at this late date
+   extraneous fields are necessary to make the field offsets match */
+
+typedef struct _RectObjClassPart {
+
+    WidgetClass     superclass;         /* pointer to superclass ClassRec   */
+    String          class_name;         /* widget resource class name       */
+    Cardinal        widget_size;        /* size in bytes of widget record   */
+    XtProc          class_initialize;   /* class initialization proc        */
+    XtWidgetClassProc class_part_initialize; /* dynamic initialization      */
+    XtEnum          class_inited;       /* has class been initialized?      */
+    XtInitProc      initialize;         /* initialize subclass fields       */
+    XtArgsProc      initialize_hook;    /* notify that initialize called    */
+    XtProc          rect1;		/* NULL                             */
+    XtPointer       rect2;              /* NULL                             */
+    Cardinal        rect3;              /* NULL                             */
+    XtResourceList  resources;          /* resources for subclass fields    */
+    Cardinal        num_resources;      /* number of entries in resources   */
+    XrmClass        xrm_class;          /* resource class quarkified        */
+    Boolean         rect4;              /* NULL                             */
+    XtEnum          rect5;              /* NULL                             */
+    Boolean         rect6;              /* NULL				    */
+    Boolean         rect7;              /* NULL                             */
+    XtWidgetProc    destroy;            /* free data for subclass pointers  */
+    XtWidgetProc    resize;             /* geom manager changed widget size */
+    XtExposeProc    expose;             /* rediplay rectangle               */
+    XtSetValuesFunc set_values;         /* set subclass resource values     */
+    XtArgsFunc      set_values_hook;    /* notify that set_values called    */
+    XtAlmostProc    set_values_almost;  /* set values almost for geometry   */
+    XtArgsProc      get_values_hook;    /* notify that get_values called    */
+    XtProc          rect9;              /* NULL                             */
+    XtVersionType   version;            /* version of intrinsics used       */
+    XtPointer       callback_private;   /* list of callback offsets         */
+    String          rect10;             /* NULL                             */
+    XtGeometryHandler query_geometry;   /* return preferred geometry        */
+    XtProc          rect11;             /* NULL                             */
+    XtPointer       extension;          /* pointer to extension record      */
+} RectObjClassPart;
+
+typedef struct _RectObjClassRec {
+    RectObjClassPart rect_class;
+} RectObjClassRec;
+
+externalref RectObjClassRec rectObjClassRec;
+
+_XFUNCPROTOEND
+
+#endif /*_Xt_RectObjP_h_*/
diff --git a/ThirdParty/X11/Include/X11/ResConfigP.h b/ThirdParty/X11/Include/X11/ResConfigP.h
new file mode 100644
index 0000000000000000000000000000000000000000..1e1d85a301dc7e09e1ee52f8c36366798cb8d3a6
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/ResConfigP.h
@@ -0,0 +1,76 @@
+/*
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*****************************************************************
+
+(C) COPYRIGHT International Business Machines Corp. 1992,1997
+    All Rights Reserved
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+THE IBM CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the IBM Corporation shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from the IBM
+Corporation.
+
+******************************************************************/
+
+#ifndef _RESCONFIGP_H
+#define _RESCONFIGP_H
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+/*
+ * Atom names for resource configuration management customization tool.
+ */
+#define RCM_DATA "Custom Data"
+#define RCM_INIT "Custom Init"
+
+extern void _XtResourceConfigurationEH(
+	Widget 		/* w */,
+	XtPointer 	/* client_data */,
+	XEvent * 	/* event */
+);
+
+_XFUNCPROTOEND
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/ResourceI.h b/ThirdParty/X11/Include/X11/ResourceI.h
new file mode 100644
index 0000000000000000000000000000000000000000..4533f0642a3f2a06d0a755e7ac458a028094dd1e
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/ResourceI.h
@@ -0,0 +1,100 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/****************************************************************
+ *
+ * Resources
+ *
+ ****************************************************************/
+
+#ifndef _XtresourceI_h
+#define _XtresourceI_h
+
+#define StringToQuark(string) XrmStringToQuark(string)
+#define StringToName(string) XrmStringToName(string)
+#define StringToClass(string) XrmStringToClass(string)
+
+_XFUNCPROTOBEGIN
+
+extern void _XtDependencies(
+    XtResourceList  * /* class_resp */,
+    Cardinal	    * /* class_num_resp */,
+    XrmResourceList * /* super_res */,
+    Cardinal	     /* super_num_res */,
+    Cardinal	     /* super_widget_size */);
+
+extern void _XtResourceDependencies(
+    WidgetClass  /* wc */
+);
+
+extern void _XtConstraintResDependencies(
+    ConstraintWidgetClass  /* wc */
+);
+
+extern XtCacheRef* _XtGetResources(
+    Widget	    /* w */,
+    ArgList	    /* args */,
+    Cardinal	    /* num_args */,
+    XtTypedArgList  /* typed_args */,
+    Cardinal*	    /* num_typed_args */
+);
+
+extern void _XtCopyFromParent(
+    Widget		/* widget */,
+    int			/* offset */,
+    XrmValue*		/* value */
+);
+
+extern void _XtCopyToArg(char *src, XtArgVal *dst, unsigned int size);
+extern void _XtCopyFromArg(XtArgVal src, char *dst, unsigned int size);
+extern XrmResourceList* _XtCreateIndirectionTable(XtResourceList resources,
+						  Cardinal num_resources);
+extern void _XtResourceListInitialize(void);
+
+_XFUNCPROTOEND
+
+#endif /* _XtresourceI_h */
diff --git a/ThirdParty/X11/Include/X11/SM/SM.h b/ThirdParty/X11/Include/X11/SM/SM.h
new file mode 100644
index 0000000000000000000000000000000000000000..1af5ae839435f66b4272086511517df57fa9e806
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/SM/SM.h
@@ -0,0 +1,128 @@
+/*
+
+Copyright 1993, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author: Ralph Mor, X Consortium
+ */
+
+#ifndef _SM_H_
+#define _SM_H_
+
+/*
+ * Protocol Version
+ */
+
+#define SmProtoMajor	1
+#define SmProtoMinor	0
+
+
+/*
+ * Interact Style
+ */
+
+#define SmInteractStyleNone	0
+#define SmInteractStyleErrors	1
+#define SmInteractStyleAny	2
+
+
+/*
+ * Dialog Type
+ */
+
+#define SmDialogError		0
+#define SmDialogNormal		1
+
+
+/*
+ * Save Type
+ */
+
+#define SmSaveGlobal	0
+#define SmSaveLocal	1
+#define SmSaveBoth	2
+
+
+/*
+ * Restart Style Hints
+ */
+
+#define SmRestartIfRunning	0
+#define SmRestartAnyway		1
+#define SmRestartImmediately	2
+#define SmRestartNever		3
+
+
+/*
+ * Property names
+ */
+
+#define SmCloneCommand		"CloneCommand"
+#define SmCurrentDirectory	"CurrentDirectory"
+#define SmDiscardCommand	"DiscardCommand"
+#define SmEnvironment		"Environment"
+#define SmProcessID		"ProcessID"
+#define SmProgram		"Program"
+#define SmRestartCommand	"RestartCommand"
+#define SmResignCommand		"ResignCommand"
+#define SmRestartStyleHint	"RestartStyleHint"
+#define SmShutdownCommand	"ShutdownCommand"
+#define SmUserID		"UserID"
+
+
+/*
+ * Property types
+ */
+
+#define SmCARD8			"CARD8"
+#define SmARRAY8		"ARRAY8"
+#define SmLISTofARRAY8		"LISTofARRAY8"
+
+
+/*
+ * SM minor opcodes
+ */
+
+#define SM_Error			0
+#define SM_RegisterClient 		1
+#define SM_RegisterClientReply 		2
+#define SM_SaveYourself 		3
+#define SM_SaveYourselfRequest 		4
+#define SM_InteractRequest 		5
+#define SM_Interact 			6
+#define SM_InteractDone 		7
+#define SM_SaveYourselfDone 		8
+#define SM_Die 				9
+#define SM_ShutdownCancelled		10
+#define SM_CloseConnection 		11
+#define SM_SetProperties 		12
+#define SM_DeleteProperties 		13
+#define SM_GetProperties 		14
+#define SM_PropertiesReply 		15
+#define SM_SaveYourselfPhase2Request	16
+#define SM_SaveYourselfPhase2		17
+#define SM_SaveComplete			18
+
+#endif /* _SM_H_ */
diff --git a/ThirdParty/X11/Include/X11/SM/SMlib.h b/ThirdParty/X11/Include/X11/SM/SMlib.h
new file mode 100644
index 0000000000000000000000000000000000000000..b88ddc0ff44d432118237a07db8958686894aad0
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/SM/SMlib.h
@@ -0,0 +1,543 @@
+/*
+
+Copyright 1993, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author: Ralph Mor, X Consortium
+ */
+
+#ifndef _SMLIB_H_
+#define _SMLIB_H_
+
+#include <X11/SM/SM.h>
+#include <X11/ICE/ICElib.h>
+
+
+/*
+ * Generic SM pointer
+ */
+
+typedef IcePointer SmPointer;
+
+
+/*
+ * Connection objects.  Defined in SMlibint.h
+ */
+
+typedef struct _SmcConn *SmcConn;
+typedef struct _SmsConn *SmsConn;
+
+
+/*
+ * Session Management property
+ */
+
+typedef struct {
+    int		length;		/* length (in bytes) of the value */
+    SmPointer   value;		/* the value */
+} SmPropValue;
+
+typedef struct {
+    char	*name;		/* name of property */
+    char	*type;		/* type of property */
+    int		num_vals;	/* number of values in property */
+    SmPropValue *vals;		/* the values */
+} SmProp;
+
+
+
+/*
+ * SmcCloseConnection status return
+ */
+
+typedef enum {
+    SmcClosedNow,
+    SmcClosedASAP,
+    SmcConnectionInUse
+} SmcCloseStatus;
+
+
+
+/*
+ * Client callbacks
+ */
+
+typedef void (*SmcSaveYourselfProc) (
+    SmcConn		/* smcConn */,
+    SmPointer		/* clientData */,
+    int  		/* saveType */,
+    Bool		/* shutdown */,
+    int			/* interactStyle */,
+    Bool		/* fast */
+);
+
+typedef void (*SmcSaveYourselfPhase2Proc) (
+    SmcConn		/* smcConn */,
+    SmPointer		/* clientData */
+);
+
+typedef void (*SmcInteractProc) (
+    SmcConn		/* smcConn */,
+    SmPointer		/* clientData */
+);
+
+typedef void (*SmcDieProc) (
+    SmcConn		/* smcConn */,
+    SmPointer		/* clientData */
+);
+
+typedef void (*SmcShutdownCancelledProc) (
+    SmcConn		/* smcConn */,
+    SmPointer		/* clientData */
+);
+
+typedef void (*SmcSaveCompleteProc) (
+    SmcConn		/* smcConn */,
+    SmPointer		/* clientData */
+);
+
+typedef void (*SmcPropReplyProc) (
+    SmcConn		/* smcConn */,
+    SmPointer		/* clientData */,
+    int			/* numProps */,
+    SmProp **		/* props */
+);
+
+
+/*
+ * Callbacks set up at SmcOpenConnection time
+ */
+
+typedef struct {
+
+    struct {
+	SmcSaveYourselfProc	 callback;
+	SmPointer		 client_data;
+    } save_yourself;
+
+    struct {
+	SmcDieProc		 callback;
+	SmPointer		 client_data;
+    } die;
+
+    struct {
+	SmcSaveCompleteProc	 callback;
+	SmPointer		 client_data;
+    } save_complete;
+
+    struct {
+	SmcShutdownCancelledProc callback;
+	SmPointer		 client_data;
+    } shutdown_cancelled;
+
+} SmcCallbacks;
+
+#define SmcSaveYourselfProcMask		(1L << 0)
+#define SmcDieProcMask			(1L << 1)
+#define SmcSaveCompleteProcMask		(1L << 2)
+#define SmcShutdownCancelledProcMask	(1L << 3)
+
+
+
+/*
+ * Session manager callbacks
+ */
+
+typedef Status (*SmsRegisterClientProc) (
+    SmsConn 		/* smsConn */,
+    SmPointer		/* managerData */,
+    char *		/* previousId */
+);
+
+typedef void (*SmsInteractRequestProc) (
+    SmsConn		/* smsConn */,
+    SmPointer		/* managerData */,
+    int			/* dialogType */
+);
+
+typedef void (*SmsInteractDoneProc) (
+    SmsConn		/* smsConn */,
+    SmPointer		/* managerData */,
+    Bool		/* cancelShutdown */
+);
+
+typedef void (*SmsSaveYourselfRequestProc) (
+    SmsConn		/* smsConn */,
+    SmPointer		/* managerData */,
+    int  		/* saveType */,
+    Bool		/* shutdown */,
+    int			/* interactStyle */,
+    Bool		/* fast */,
+    Bool		/* global */
+);
+
+typedef void (*SmsSaveYourselfPhase2RequestProc) (
+    SmsConn		/* smsConn */,
+    SmPointer		/* managerData */
+);
+
+typedef void (*SmsSaveYourselfDoneProc) (
+    SmsConn		/* smsConn */,
+    SmPointer		/* managerData */,
+    Bool		/* success */
+);
+
+typedef void (*SmsCloseConnectionProc) (
+    SmsConn		/* smsConn */,
+    SmPointer		/* managerData */,
+    int			/* count */,
+    char **		/* reasonMsgs */
+);
+
+typedef void (*SmsSetPropertiesProc) (
+    SmsConn		/* smsConn */,
+    SmPointer		/* managerData */,
+    int			/* numProps */,
+    SmProp **		/* props */
+);
+
+typedef void (*SmsDeletePropertiesProc) (
+    SmsConn		/* smsConn */,
+    SmPointer		/* managerData */,
+    int			/* numProps */,
+    char **		/* propNames */
+);
+
+typedef void (*SmsGetPropertiesProc) (
+    SmsConn		/* smsConn */,
+    SmPointer		/* managerData */
+);
+
+
+/*
+ * Callbacks set up by a session manager when a new client connects.
+ */
+
+typedef struct {
+
+    struct {
+	SmsRegisterClientProc	callback;
+	SmPointer		manager_data;
+    } register_client;
+
+    struct {
+	SmsInteractRequestProc	callback;
+	SmPointer		manager_data;
+    } interact_request;
+
+    struct {
+	SmsInteractDoneProc	callback;
+	SmPointer		manager_data;
+    } interact_done;
+
+    struct {
+	SmsSaveYourselfRequestProc	callback;
+	SmPointer			manager_data;
+    } save_yourself_request;
+
+    struct {
+	SmsSaveYourselfPhase2RequestProc	callback;
+	SmPointer				manager_data;
+    } save_yourself_phase2_request;
+
+    struct {
+	SmsSaveYourselfDoneProc	callback;
+	SmPointer		manager_data;
+    } save_yourself_done;
+
+    struct {
+	SmsCloseConnectionProc	callback;
+	SmPointer		manager_data;
+    } close_connection;
+
+    struct {
+	SmsSetPropertiesProc	callback;
+	SmPointer		manager_data;
+    } set_properties;
+
+    struct {
+	SmsDeletePropertiesProc	callback;
+	SmPointer		manager_data;
+    } delete_properties;
+
+    struct {
+	SmsGetPropertiesProc	callback;
+	SmPointer		manager_data;
+    } get_properties;
+
+} SmsCallbacks;
+
+
+#define SmsRegisterClientProcMask		(1L << 0)
+#define SmsInteractRequestProcMask		(1L << 1)
+#define SmsInteractDoneProcMask			(1L << 2)
+#define SmsSaveYourselfRequestProcMask  	(1L << 3)
+#define SmsSaveYourselfP2RequestProcMask	(1L << 4)
+#define SmsSaveYourselfDoneProcMask		(1L << 5)
+#define SmsCloseConnectionProcMask		(1L << 6)
+#define SmsSetPropertiesProcMask		(1L << 7)
+#define SmsDeletePropertiesProcMask		(1L << 8)
+#define SmsGetPropertiesProcMask		(1L << 9)
+
+
+
+typedef Status (*SmsNewClientProc) (
+    SmsConn 		/* smsConn */,
+    SmPointer		/* managerData */,
+    unsigned long *	/* maskRet */,
+    SmsCallbacks *	/* callbacksRet */,
+    char **		/* failureReasonRet */
+);
+
+
+
+/*
+ * Error handlers
+ */
+
+typedef void (*SmcErrorHandler) (
+    SmcConn		/* smcConn */,
+    Bool		/* swap */,
+    int			/* offendingMinorOpcode */,
+    unsigned long 	/* offendingSequence */,
+    int 		/* errorClass */,
+    int			/* severity */,
+    SmPointer		/* values */
+);
+
+typedef void (*SmsErrorHandler) (
+    SmsConn		/* smsConn */,
+    Bool		/* swap */,
+    int			/* offendingMinorOpcode */,
+    unsigned long 	/* offendingSequence */,
+    int 		/* errorClass */,
+    int			/* severity */,
+    SmPointer		/* values */
+);
+
+
+
+/*
+ * Function Prototypes
+ */
+
+_XFUNCPROTOBEGIN
+
+extern SmcConn SmcOpenConnection (
+    char *		/* networkIdsList */,
+    SmPointer		/* context */,
+    int			/* xsmpMajorRev */,
+    int			/* xsmpMinorRev */,
+    unsigned long	/* mask */,
+    SmcCallbacks *	/* callbacks */,
+    const char *	/* previousId */,
+    char **		/* clientIdRet */,
+    int			/* errorLength */,
+    char *		/* errorStringRet */
+);
+
+extern SmcCloseStatus SmcCloseConnection (
+    SmcConn		/* smcConn */,
+    int			/* count */,
+    char **		/* reasonMsgs */
+);
+
+extern void SmcModifyCallbacks (
+    SmcConn		/* smcConn */,
+    unsigned long	/* mask */,
+    SmcCallbacks *	/* callbacks */
+);
+
+extern void SmcSetProperties (
+    SmcConn		/* smcConn */,
+    int      	        /* numProps */,
+    SmProp **		/* props */
+);
+
+extern void SmcDeleteProperties (
+    SmcConn		/* smcConn */,
+    int      	        /* numProps */,
+    char **		/* propNames */
+);
+
+extern Status SmcGetProperties (
+    SmcConn		/* smcConn */,
+    SmcPropReplyProc	/* propReplyProc */,
+    SmPointer		/* clientData */
+);
+
+extern Status SmcInteractRequest (
+    SmcConn		/* smcConn */,
+    int			/* dialogType */,
+    SmcInteractProc	/* interactProc */,
+    SmPointer		/* clientData */
+);
+
+extern void SmcInteractDone (
+    SmcConn		/* smcConn */,
+    Bool 		/* cancelShutdown */
+);
+
+extern void SmcRequestSaveYourself (
+    SmcConn		/* smcConn */,
+    int			/* saveType */,
+    Bool 		/* shutdown */,
+    int			/* interactStyle */,
+    Bool		/* fast */,
+    Bool		/* global */
+);
+
+extern Status SmcRequestSaveYourselfPhase2 (
+    SmcConn			/* smcConn */,
+    SmcSaveYourselfPhase2Proc	/* saveYourselfPhase2Proc */,
+    SmPointer			/* clientData */
+);
+
+extern void SmcSaveYourselfDone (
+    SmcConn		/* smcConn */,
+    Bool		/* success */
+);
+
+extern int SmcProtocolVersion (
+    SmcConn		/* smcConn */
+);
+
+extern int SmcProtocolRevision (
+    SmcConn		/* smcConn */
+);
+
+extern char *SmcVendor (
+    SmcConn		/* smcConn */
+);
+
+extern char *SmcRelease (
+    SmcConn		/* smcConn */
+);
+
+extern char *SmcClientID (
+    SmcConn		/* smcConn */
+);
+
+extern IceConn SmcGetIceConnection (
+    SmcConn		/* smcConn */
+);
+
+extern Status SmsInitialize (
+    const char *		/* vendor */,
+    const char *		/* release */,
+    SmsNewClientProc		/* newClientProc */,
+    SmPointer			/* managerData */,
+    IceHostBasedAuthProc	/* hostBasedAuthProc */,
+    int				/* errorLength */,
+    char *			/* errorStringRet */
+);
+
+extern char *SmsClientHostName (
+    SmsConn		/* smsConn */
+);
+
+extern char *SmsGenerateClientID (
+    SmsConn		/* smsConn */
+);
+
+extern Status SmsRegisterClientReply (
+    SmsConn		/* smsConn */,
+    char *		/* clientId */
+);
+
+extern void SmsSaveYourself (
+    SmsConn		/* smsConn */,
+    int			/* saveType */,
+    Bool 		/* shutdown */,
+    int			/* interactStyle */,
+    Bool		/* fast */
+);
+
+extern void SmsSaveYourselfPhase2 (
+    SmsConn		/* smsConn */
+);
+
+extern void SmsInteract (
+    SmsConn		/* smsConn */
+);
+
+extern void SmsDie (
+    SmsConn		/* smsConn */
+);
+
+extern void SmsSaveComplete (
+    SmsConn		/* smsConn */
+);
+
+extern void SmsShutdownCancelled (
+    SmsConn		/* smsConn */
+);
+
+extern void SmsReturnProperties (
+    SmsConn		/* smsConn */,
+    int			/* numProps */,
+    SmProp **		/* props */
+);
+
+extern void SmsCleanUp (
+    SmsConn		/* smsConn */
+);
+
+extern int SmsProtocolVersion (
+    SmsConn		/* smsConn */
+);
+
+extern int SmsProtocolRevision (
+    SmsConn		/* smsConn */
+);
+
+extern char *SmsClientID (
+    SmsConn		/* smsConn */
+);
+
+extern IceConn SmsGetIceConnection (
+    SmsConn		/* smsConn */
+);
+
+extern SmcErrorHandler SmcSetErrorHandler (
+    SmcErrorHandler 	/* handler */
+);
+
+extern SmsErrorHandler SmsSetErrorHandler (
+    SmsErrorHandler 	/* handler */
+);
+
+extern void SmFreeProperty (
+    SmProp *		/* prop */
+);
+
+extern void SmFreeReasons (
+    int			/* count */,
+    char **		/* reasonMsgs */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _SMLIB_H_ */
diff --git a/ThirdParty/X11/Include/X11/SM/SMproto.h b/ThirdParty/X11/Include/X11/SM/SMproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..228e0ce0665b3403a2678acb6f272f7547345802
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/SM/SMproto.h
@@ -0,0 +1,206 @@
+/*
+
+Copyright 1993, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author: Ralph Mor, X Consortium
+ */
+
+#ifndef _SMPROTO_H_
+#define _SMPROTO_H_
+
+#include <X11/Xmd.h>
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	unused[2];
+    CARD32	length B32;
+    /* n	ARRAY8		previousId */
+} smRegisterClientMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	unused[2];
+    CARD32	length B32;
+    /* n	ARRAY8		clientId */
+} smRegisterClientReplyMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	unused1[2];
+    CARD32	length B32;
+    CARD8	saveType;
+    CARD8	shutdown;
+    CARD8	interactStyle;
+    CARD8	fast;
+    CARD8	unused2[4];
+} smSaveYourselfMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	unused1[2];
+    CARD32	length B32;
+    CARD8	saveType;
+    CARD8	shutdown;
+    CARD8	interactStyle;
+    CARD8	fast;
+    CARD8	global;
+    CARD8	unused2[3];
+} smSaveYourselfRequestMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	dialogType;
+    CARD8	unused;
+    CARD32	length B32;
+} smInteractRequestMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	unused[2];
+    CARD32	length B32;
+} smInteractMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	cancelShutdown;
+    CARD8	unused;
+    CARD32	length B32;
+} smInteractDoneMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8       success;
+    CARD8	unused;
+    CARD32	length B32;
+} smSaveYourselfDoneMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	unused[2];
+    CARD32	length B32;
+} smDieMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	unused[2];
+    CARD32	length B32;
+} smShutdownCancelledMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	unused[2];
+    CARD32	length B32;
+    /* b	LISTofARRAY8	reasons */
+} smCloseConnectionMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	unused[2];
+    CARD32	length B32;
+    /* a	LISTofPROPERTY	properties */
+} smSetPropertiesMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	unused[2];
+    CARD32	length B32;
+    /* a	LISTofARRAY8	property names */
+} smDeletePropertiesMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	unused[2];
+    CARD32	length B32;
+} smGetPropertiesMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	unused[2];
+    CARD32	length B32;
+    /* a	LISTofPROPERTY	properties */
+} smPropertiesReplyMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	unused[2];
+    CARD32	length B32;
+} smSaveYourselfPhase2RequestMsg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	unused[2];
+    CARD32	length B32;
+} smSaveYourselfPhase2Msg;
+
+typedef struct {
+    CARD8	majorOpcode;
+    CARD8	minorOpcode;
+    CARD8	unused[2];
+    CARD32	length B32;
+} smSaveCompleteMsg;
+
+
+/*
+ * SIZEOF values.  These better be multiples of 8.
+ */
+
+#define sz_smRegisterClientMsg 			8
+#define sz_smRegisterClientReplyMsg 		8
+#define sz_smSaveYourselfMsg 			16
+#define sz_smSaveYourselfRequestMsg		16
+#define sz_smInteractRequestMsg 		8
+#define sz_smInteractMsg 			8
+#define sz_smInteractDoneMsg 			8
+#define sz_smSaveYourselfDoneMsg 		8
+#define sz_smDieMsg 				8
+#define sz_smShutdownCancelledMsg 		8
+#define sz_smCloseConnectionMsg 		8
+#define sz_smSetPropertiesMsg 			8
+#define sz_smDeletePropertiesMsg 		8
+#define sz_smGetPropertiesMsg 			8
+#define sz_smPropertiesReplyMsg 		8
+#define sz_smSaveYourselfPhase2RequestMsg	8
+#define sz_smSaveYourselfPhase2Msg 		8
+#define sz_smSaveCompleteMsg 			8
+
+#endif /* _SMPROTO_H_ */
diff --git a/ThirdParty/X11/Include/X11/SelectionI.h b/ThirdParty/X11/Include/X11/SelectionI.h
new file mode 100644
index 0000000000000000000000000000000000000000..7f39b8799b7829129213ae4a74472a139a20a688
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/SelectionI.h
@@ -0,0 +1,168 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XtselectionI_h
+#define _XtselectionI_h
+
+#include "Intrinsic.h"
+
+typedef struct _RequestRec *Request;
+typedef struct _SelectRec *Select;
+
+typedef struct _RequestRec {
+   Select ctx;		      /* logical owner */
+   Widget widget;	      /* widget actually receiving Selection events */
+   Window requestor;
+   Atom property;
+   Atom target;
+   Atom type;
+   int format;
+   XtPointer value;
+   unsigned long bytelength;
+   unsigned long offset;
+   XtIntervalId timeout;
+   XSelectionRequestEvent event; /* for XtGetSelectionRequest */
+   Boolean allSent;
+} RequestRec;
+
+typedef struct {
+  Atom prop;
+  Boolean avail;
+} SelectionPropRec, *SelectionProp;
+
+typedef struct {
+  Display *dpy;
+  Atom incr_atom, indirect_atom, timestamp_atom;
+  int propCount;
+  SelectionProp list;
+} PropListRec, *PropList;
+
+typedef struct _SelectRec {
+    Atom selection; 			/* constant */
+    Display *dpy; 			/* constant */
+    Widget widget;
+    Time time;
+    unsigned long serial;
+    XtConvertSelectionProc convert;
+    XtLoseSelectionProc loses;
+    XtSelectionDoneProc notify;
+    XtCancelConvertSelectionProc owner_cancel;
+    XtPointer owner_closure;
+    PropList prop_list;
+    Request req;			/* state for local non-incr xfer */
+    int ref_count;			/* of active transfers */
+    unsigned int incremental:1;
+    unsigned int free_when_done:1;
+    unsigned int was_disowned:1;
+} SelectRec;
+
+typedef struct _ParamRec {
+    Atom selection;
+    Atom param;
+} ParamRec, *Param;
+
+typedef struct _ParamInfoRec {
+    unsigned int count;
+    Param paramlist;
+} ParamInfoRec, *ParamInfo;
+
+typedef struct _QueuedRequestRec {
+    Atom selection;
+    Atom target;
+    Atom param;
+    XtSelectionCallbackProc callback;
+    XtPointer closure;
+    Time time;
+    Boolean incremental;
+} QueuedRequestRec, *QueuedRequest;
+
+typedef struct _QueuedRequestInfoRec {
+    int count;
+    Atom *selections;
+    QueuedRequest *requests;
+} QueuedRequestInfoRec, *QueuedRequestInfo;
+
+typedef struct {
+    XtSelectionCallbackProc *callbacks;
+    XtPointer *req_closure;
+    Atom property;
+    Atom *target;
+    Atom type;
+    int format;
+    char *value;
+    int bytelength;
+    int offset;
+    XtIntervalId timeout;
+    XtEventHandler proc;
+    Widget widget;
+    Time time;
+    Select ctx;
+    Boolean *incremental;
+    int current;
+} CallBackInfoRec, *CallBackInfo;
+
+typedef struct {
+  Atom target;
+  Atom property;
+} IndirectPair;
+
+#define IndirectPairWordSize 2
+
+typedef struct {
+  int active_transfer_count;
+} RequestWindowRec;
+
+#define MAX_SELECTION_INCR(dpy) (((65536 < XMaxRequestSize(dpy)) ? \
+	(65536 << 2)  : (XMaxRequestSize(dpy) << 2))-100)
+
+#define MATCH_SELECT(event, info) ((event->time == info->time) && \
+	    (event->requestor == XtWindow(info->widget)) && \
+	    (event->selection == info->ctx->selection) && \
+	    (event->target == *info->target))
+
+#endif /* _XtselectionI_h */
+/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/ThirdParty/X11/Include/X11/Shell.h b/ThirdParty/X11/Include/X11/Shell.h
new file mode 100644
index 0000000000000000000000000000000000000000..97e605aa7b40775ab69ff200f0c2d3a700a9006c
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Shell.h
@@ -0,0 +1,562 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XtShell_h
+#define _XtShell_h
+
+#include <X11/SM/SMlib.h>
+#include <X11/Intrinsic.h>
+
+/***********************************************************************
+ *
+ * Shell Widget
+ *
+ ***********************************************************************/
+/*
+ * Shell-specific resources names, classes, and a representation type.
+ */
+
+#ifndef XTSTRINGDEFINES
+#define _XtShell_h_Const const
+#endif
+
+/* $Xorg: makestrs.c,v 1.6 2001/02/09 02:03:17 xorgcvs Exp $ */
+/* This file is automatically generated. */
+/* Default ABI version -- Do not edit */
+#ifdef XTSTRINGDEFINES
+#define XtNiconName "iconName"
+#define XtCIconName "IconName"
+#define XtNiconPixmap "iconPixmap"
+#define XtCIconPixmap "IconPixmap"
+#define XtNiconWindow "iconWindow"
+#define XtCIconWindow "IconWindow"
+#define XtNiconMask "iconMask"
+#define XtCIconMask "IconMask"
+#define XtNwindowGroup "windowGroup"
+#define XtCWindowGroup "WindowGroup"
+#define XtNvisual "visual"
+#define XtCVisual "Visual"
+#define XtNtitleEncoding "titleEncoding"
+#define XtCTitleEncoding "TitleEncoding"
+#define XtNsaveUnder "saveUnder"
+#define XtCSaveUnder "SaveUnder"
+#define XtNtransient "transient"
+#define XtCTransient "Transient"
+#define XtNoverrideRedirect "overrideRedirect"
+#define XtCOverrideRedirect "OverrideRedirect"
+#define XtNtransientFor "transientFor"
+#define XtCTransientFor "TransientFor"
+#define XtNiconNameEncoding "iconNameEncoding"
+#define XtCIconNameEncoding "IconNameEncoding"
+#define XtNallowShellResize "allowShellResize"
+#define XtCAllowShellResize "AllowShellResize"
+#define XtNcreatePopupChildProc "createPopupChildProc"
+#define XtCCreatePopupChildProc "CreatePopupChildProc"
+#define XtNtitle "title"
+#define XtCTitle "Title"
+#ifndef XtRAtom
+#define XtRAtom "Atom"
+#endif
+#define XtNargc "argc"
+#define XtCArgc "Argc"
+#define XtNargv "argv"
+#define XtCArgv "Argv"
+#define XtNiconX "iconX"
+#define XtCIconX "IconX"
+#define XtNiconY "iconY"
+#define XtCIconY "IconY"
+#define XtNinput "input"
+#define XtCInput "Input"
+#define XtNiconic "iconic"
+#define XtCIconic "Iconic"
+#define XtNinitialState "initialState"
+#define XtCInitialState "InitialState"
+#define XtNgeometry "geometry"
+#define XtCGeometry "Geometry"
+#define XtNbaseWidth "baseWidth"
+#define XtCBaseWidth "BaseWidth"
+#define XtNbaseHeight "baseHeight"
+#define XtCBaseHeight "BaseHeight"
+#define XtNwinGravity "winGravity"
+#define XtCWinGravity "WinGravity"
+#define XtNminWidth "minWidth"
+#define XtCMinWidth "MinWidth"
+#define XtNminHeight "minHeight"
+#define XtCMinHeight "MinHeight"
+#define XtNmaxWidth "maxWidth"
+#define XtCMaxWidth "MaxWidth"
+#define XtNmaxHeight "maxHeight"
+#define XtCMaxHeight "MaxHeight"
+#define XtNwidthInc "widthInc"
+#define XtCWidthInc "WidthInc"
+#define XtNheightInc "heightInc"
+#define XtCHeightInc "HeightInc"
+#define XtNminAspectY "minAspectY"
+#define XtCMinAspectY "MinAspectY"
+#define XtNmaxAspectY "maxAspectY"
+#define XtCMaxAspectY "MaxAspectY"
+#define XtNminAspectX "minAspectX"
+#define XtCMinAspectX "MinAspectX"
+#define XtNmaxAspectX "maxAspectX"
+#define XtCMaxAspectX "MaxAspectX"
+#define XtNwmTimeout "wmTimeout"
+#define XtCWmTimeout "WmTimeout"
+#define XtNwaitForWm "waitforwm"
+#define XtCWaitForWm "Waitforwm"
+#define XtNwaitforwm "waitforwm"
+#define XtCWaitforwm "Waitforwm"
+#define XtNclientLeader "clientLeader"
+#define XtCClientLeader "ClientLeader"
+#define XtNwindowRole "windowRole"
+#define XtCWindowRole "WindowRole"
+#define XtNurgency "urgency"
+#define XtCUrgency "Urgency"
+#define XtNcancelCallback "cancelCallback"
+#define XtNcloneCommand "cloneCommand"
+#define XtCCloneCommand "CloneCommand"
+#define XtNconnection "connection"
+#define XtCConnection "Connection"
+#define XtNcurrentDirectory "currentDirectory"
+#define XtCCurrentDirectory "CurrentDirectory"
+#define XtNdieCallback "dieCallback"
+#define XtNdiscardCommand "discardCommand"
+#define XtCDiscardCommand "DiscardCommand"
+#define XtNenvironment "environment"
+#define XtCEnvironment "Environment"
+#define XtNinteractCallback "interactCallback"
+#define XtNjoinSession "joinSession"
+#define XtCJoinSession "JoinSession"
+#define XtNprogramPath "programPath"
+#define XtCProgramPath "ProgramPath"
+#define XtNresignCommand "resignCommand"
+#define XtCResignCommand "ResignCommand"
+#define XtNrestartCommand "restartCommand"
+#define XtCRestartCommand "RestartCommand"
+#define XtNrestartStyle "restartStyle"
+#define XtCRestartStyle "RestartStyle"
+#define XtNsaveCallback "saveCallback"
+#define XtNsaveCompleteCallback "saveCompleteCallback"
+#define XtNsessionID "sessionID"
+#define XtCSessionID "SessionID"
+#define XtNshutdownCommand "shutdownCommand"
+#define XtCShutdownCommand "ShutdownCommand"
+#define XtNerrorCallback "errorCallback"
+#else
+extern _XtShell_h_Const char XtShellStrings[];
+#ifndef XtNiconName
+#define XtNiconName ((char*)&XtShellStrings[0])
+#endif
+#ifndef XtCIconName
+#define XtCIconName ((char*)&XtShellStrings[9])
+#endif
+#ifndef XtNiconPixmap
+#define XtNiconPixmap ((char*)&XtShellStrings[18])
+#endif
+#ifndef XtCIconPixmap
+#define XtCIconPixmap ((char*)&XtShellStrings[29])
+#endif
+#ifndef XtNiconWindow
+#define XtNiconWindow ((char*)&XtShellStrings[40])
+#endif
+#ifndef XtCIconWindow
+#define XtCIconWindow ((char*)&XtShellStrings[51])
+#endif
+#ifndef XtNiconMask
+#define XtNiconMask ((char*)&XtShellStrings[62])
+#endif
+#ifndef XtCIconMask
+#define XtCIconMask ((char*)&XtShellStrings[71])
+#endif
+#ifndef XtNwindowGroup
+#define XtNwindowGroup ((char*)&XtShellStrings[80])
+#endif
+#ifndef XtCWindowGroup
+#define XtCWindowGroup ((char*)&XtShellStrings[92])
+#endif
+#ifndef XtNvisual
+#define XtNvisual ((char*)&XtShellStrings[104])
+#endif
+#ifndef XtCVisual
+#define XtCVisual ((char*)&XtShellStrings[111])
+#endif
+#ifndef XtNtitleEncoding
+#define XtNtitleEncoding ((char*)&XtShellStrings[118])
+#endif
+#ifndef XtCTitleEncoding
+#define XtCTitleEncoding ((char*)&XtShellStrings[132])
+#endif
+#ifndef XtNsaveUnder
+#define XtNsaveUnder ((char*)&XtShellStrings[146])
+#endif
+#ifndef XtCSaveUnder
+#define XtCSaveUnder ((char*)&XtShellStrings[156])
+#endif
+#ifndef XtNtransient
+#define XtNtransient ((char*)&XtShellStrings[166])
+#endif
+#ifndef XtCTransient
+#define XtCTransient ((char*)&XtShellStrings[176])
+#endif
+#ifndef XtNoverrideRedirect
+#define XtNoverrideRedirect ((char*)&XtShellStrings[186])
+#endif
+#ifndef XtCOverrideRedirect
+#define XtCOverrideRedirect ((char*)&XtShellStrings[203])
+#endif
+#ifndef XtNtransientFor
+#define XtNtransientFor ((char*)&XtShellStrings[220])
+#endif
+#ifndef XtCTransientFor
+#define XtCTransientFor ((char*)&XtShellStrings[233])
+#endif
+#ifndef XtNiconNameEncoding
+#define XtNiconNameEncoding ((char*)&XtShellStrings[246])
+#endif
+#ifndef XtCIconNameEncoding
+#define XtCIconNameEncoding ((char*)&XtShellStrings[263])
+#endif
+#ifndef XtNallowShellResize
+#define XtNallowShellResize ((char*)&XtShellStrings[280])
+#endif
+#ifndef XtCAllowShellResize
+#define XtCAllowShellResize ((char*)&XtShellStrings[297])
+#endif
+#ifndef XtNcreatePopupChildProc
+#define XtNcreatePopupChildProc ((char*)&XtShellStrings[314])
+#endif
+#ifndef XtCCreatePopupChildProc
+#define XtCCreatePopupChildProc ((char*)&XtShellStrings[335])
+#endif
+#ifndef XtNtitle
+#define XtNtitle ((char*)&XtShellStrings[356])
+#endif
+#ifndef XtCTitle
+#define XtCTitle ((char*)&XtShellStrings[362])
+#endif
+#ifndef XtRAtom
+#define XtRAtom ((char*)&XtShellStrings[368])
+#endif
+#ifndef XtNargc
+#define XtNargc ((char*)&XtShellStrings[373])
+#endif
+#ifndef XtCArgc
+#define XtCArgc ((char*)&XtShellStrings[378])
+#endif
+#ifndef XtNargv
+#define XtNargv ((char*)&XtShellStrings[383])
+#endif
+#ifndef XtCArgv
+#define XtCArgv ((char*)&XtShellStrings[388])
+#endif
+#ifndef XtNiconX
+#define XtNiconX ((char*)&XtShellStrings[393])
+#endif
+#ifndef XtCIconX
+#define XtCIconX ((char*)&XtShellStrings[399])
+#endif
+#ifndef XtNiconY
+#define XtNiconY ((char*)&XtShellStrings[405])
+#endif
+#ifndef XtCIconY
+#define XtCIconY ((char*)&XtShellStrings[411])
+#endif
+#ifndef XtNinput
+#define XtNinput ((char*)&XtShellStrings[417])
+#endif
+#ifndef XtCInput
+#define XtCInput ((char*)&XtShellStrings[423])
+#endif
+#ifndef XtNiconic
+#define XtNiconic ((char*)&XtShellStrings[429])
+#endif
+#ifndef XtCIconic
+#define XtCIconic ((char*)&XtShellStrings[436])
+#endif
+#ifndef XtNinitialState
+#define XtNinitialState ((char*)&XtShellStrings[443])
+#endif
+#ifndef XtCInitialState
+#define XtCInitialState ((char*)&XtShellStrings[456])
+#endif
+#ifndef XtNgeometry
+#define XtNgeometry ((char*)&XtShellStrings[469])
+#endif
+#ifndef XtCGeometry
+#define XtCGeometry ((char*)&XtShellStrings[478])
+#endif
+#ifndef XtNbaseWidth
+#define XtNbaseWidth ((char*)&XtShellStrings[487])
+#endif
+#ifndef XtCBaseWidth
+#define XtCBaseWidth ((char*)&XtShellStrings[497])
+#endif
+#ifndef XtNbaseHeight
+#define XtNbaseHeight ((char*)&XtShellStrings[507])
+#endif
+#ifndef XtCBaseHeight
+#define XtCBaseHeight ((char*)&XtShellStrings[518])
+#endif
+#ifndef XtNwinGravity
+#define XtNwinGravity ((char*)&XtShellStrings[529])
+#endif
+#ifndef XtCWinGravity
+#define XtCWinGravity ((char*)&XtShellStrings[540])
+#endif
+#ifndef XtNminWidth
+#define XtNminWidth ((char*)&XtShellStrings[551])
+#endif
+#ifndef XtCMinWidth
+#define XtCMinWidth ((char*)&XtShellStrings[560])
+#endif
+#ifndef XtNminHeight
+#define XtNminHeight ((char*)&XtShellStrings[569])
+#endif
+#ifndef XtCMinHeight
+#define XtCMinHeight ((char*)&XtShellStrings[579])
+#endif
+#ifndef XtNmaxWidth
+#define XtNmaxWidth ((char*)&XtShellStrings[589])
+#endif
+#ifndef XtCMaxWidth
+#define XtCMaxWidth ((char*)&XtShellStrings[598])
+#endif
+#ifndef XtNmaxHeight
+#define XtNmaxHeight ((char*)&XtShellStrings[607])
+#endif
+#ifndef XtCMaxHeight
+#define XtCMaxHeight ((char*)&XtShellStrings[617])
+#endif
+#ifndef XtNwidthInc
+#define XtNwidthInc ((char*)&XtShellStrings[627])
+#endif
+#ifndef XtCWidthInc
+#define XtCWidthInc ((char*)&XtShellStrings[636])
+#endif
+#ifndef XtNheightInc
+#define XtNheightInc ((char*)&XtShellStrings[645])
+#endif
+#ifndef XtCHeightInc
+#define XtCHeightInc ((char*)&XtShellStrings[655])
+#endif
+#ifndef XtNminAspectY
+#define XtNminAspectY ((char*)&XtShellStrings[665])
+#endif
+#ifndef XtCMinAspectY
+#define XtCMinAspectY ((char*)&XtShellStrings[676])
+#endif
+#ifndef XtNmaxAspectY
+#define XtNmaxAspectY ((char*)&XtShellStrings[687])
+#endif
+#ifndef XtCMaxAspectY
+#define XtCMaxAspectY ((char*)&XtShellStrings[698])
+#endif
+#ifndef XtNminAspectX
+#define XtNminAspectX ((char*)&XtShellStrings[709])
+#endif
+#ifndef XtCMinAspectX
+#define XtCMinAspectX ((char*)&XtShellStrings[720])
+#endif
+#ifndef XtNmaxAspectX
+#define XtNmaxAspectX ((char*)&XtShellStrings[731])
+#endif
+#ifndef XtCMaxAspectX
+#define XtCMaxAspectX ((char*)&XtShellStrings[742])
+#endif
+#ifndef XtNwmTimeout
+#define XtNwmTimeout ((char*)&XtShellStrings[753])
+#endif
+#ifndef XtCWmTimeout
+#define XtCWmTimeout ((char*)&XtShellStrings[763])
+#endif
+#ifndef XtNwaitForWm
+#define XtNwaitForWm ((char*)&XtShellStrings[773])
+#endif
+#ifndef XtCWaitForWm
+#define XtCWaitForWm ((char*)&XtShellStrings[783])
+#endif
+#ifndef XtNwaitforwm
+#define XtNwaitforwm ((char*)&XtShellStrings[793])
+#endif
+#ifndef XtCWaitforwm
+#define XtCWaitforwm ((char*)&XtShellStrings[803])
+#endif
+#ifndef XtNclientLeader
+#define XtNclientLeader ((char*)&XtShellStrings[813])
+#endif
+#ifndef XtCClientLeader
+#define XtCClientLeader ((char*)&XtShellStrings[826])
+#endif
+#ifndef XtNwindowRole
+#define XtNwindowRole ((char*)&XtShellStrings[839])
+#endif
+#ifndef XtCWindowRole
+#define XtCWindowRole ((char*)&XtShellStrings[850])
+#endif
+#ifndef XtNurgency
+#define XtNurgency ((char*)&XtShellStrings[861])
+#endif
+#ifndef XtCUrgency
+#define XtCUrgency ((char*)&XtShellStrings[869])
+#endif
+#ifndef XtNcancelCallback
+#define XtNcancelCallback ((char*)&XtShellStrings[877])
+#endif
+#ifndef XtNcloneCommand
+#define XtNcloneCommand ((char*)&XtShellStrings[892])
+#endif
+#ifndef XtCCloneCommand
+#define XtCCloneCommand ((char*)&XtShellStrings[905])
+#endif
+#ifndef XtNconnection
+#define XtNconnection ((char*)&XtShellStrings[918])
+#endif
+#ifndef XtCConnection
+#define XtCConnection ((char*)&XtShellStrings[929])
+#endif
+#ifndef XtNcurrentDirectory
+#define XtNcurrentDirectory ((char*)&XtShellStrings[940])
+#endif
+#ifndef XtCCurrentDirectory
+#define XtCCurrentDirectory ((char*)&XtShellStrings[957])
+#endif
+#ifndef XtNdieCallback
+#define XtNdieCallback ((char*)&XtShellStrings[974])
+#endif
+#ifndef XtNdiscardCommand
+#define XtNdiscardCommand ((char*)&XtShellStrings[986])
+#endif
+#ifndef XtCDiscardCommand
+#define XtCDiscardCommand ((char*)&XtShellStrings[1001])
+#endif
+#ifndef XtNenvironment
+#define XtNenvironment ((char*)&XtShellStrings[1016])
+#endif
+#ifndef XtCEnvironment
+#define XtCEnvironment ((char*)&XtShellStrings[1028])
+#endif
+#ifndef XtNinteractCallback
+#define XtNinteractCallback ((char*)&XtShellStrings[1040])
+#endif
+#ifndef XtNjoinSession
+#define XtNjoinSession ((char*)&XtShellStrings[1057])
+#endif
+#ifndef XtCJoinSession
+#define XtCJoinSession ((char*)&XtShellStrings[1069])
+#endif
+#ifndef XtNprogramPath
+#define XtNprogramPath ((char*)&XtShellStrings[1081])
+#endif
+#ifndef XtCProgramPath
+#define XtCProgramPath ((char*)&XtShellStrings[1093])
+#endif
+#ifndef XtNresignCommand
+#define XtNresignCommand ((char*)&XtShellStrings[1105])
+#endif
+#ifndef XtCResignCommand
+#define XtCResignCommand ((char*)&XtShellStrings[1119])
+#endif
+#ifndef XtNrestartCommand
+#define XtNrestartCommand ((char*)&XtShellStrings[1133])
+#endif
+#ifndef XtCRestartCommand
+#define XtCRestartCommand ((char*)&XtShellStrings[1148])
+#endif
+#ifndef XtNrestartStyle
+#define XtNrestartStyle ((char*)&XtShellStrings[1163])
+#endif
+#ifndef XtCRestartStyle
+#define XtCRestartStyle ((char*)&XtShellStrings[1176])
+#endif
+#ifndef XtNsaveCallback
+#define XtNsaveCallback ((char*)&XtShellStrings[1189])
+#endif
+#ifndef XtNsaveCompleteCallback
+#define XtNsaveCompleteCallback ((char*)&XtShellStrings[1202])
+#endif
+#ifndef XtNsessionID
+#define XtNsessionID ((char*)&XtShellStrings[1223])
+#endif
+#ifndef XtCSessionID
+#define XtCSessionID ((char*)&XtShellStrings[1233])
+#endif
+#ifndef XtNshutdownCommand
+#define XtNshutdownCommand ((char*)&XtShellStrings[1243])
+#endif
+#ifndef XtCShutdownCommand
+#define XtCShutdownCommand ((char*)&XtShellStrings[1259])
+#endif
+#ifndef XtNerrorCallback
+#define XtNerrorCallback ((char*)&XtShellStrings[1275])
+#endif
+#endif /* XTSTRINGDEFINES */
+
+#ifndef XTSTRINGDEFINES
+#undef _XtShell_h_Const
+#endif
+
+/* Class record constants */
+
+typedef struct _ShellClassRec *ShellWidgetClass;
+typedef struct _OverrideShellClassRec *OverrideShellWidgetClass;
+typedef struct _WMShellClassRec *WMShellWidgetClass;
+typedef struct _TransientShellClassRec *TransientShellWidgetClass;
+typedef struct _TopLevelShellClassRec *TopLevelShellWidgetClass;
+typedef struct _ApplicationShellClassRec *ApplicationShellWidgetClass;
+typedef struct _SessionShellClassRec *SessionShellWidgetClass;
+
+#ifndef SHELL
+externalref WidgetClass shellWidgetClass;
+externalref WidgetClass overrideShellWidgetClass;
+externalref WidgetClass wmShellWidgetClass;
+externalref WidgetClass transientShellWidgetClass;
+externalref WidgetClass topLevelShellWidgetClass;
+externalref WidgetClass applicationShellWidgetClass;
+externalref WidgetClass sessionShellWidgetClass;
+#endif
+
+#endif /* _XtShell_h */
+/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/ThirdParty/X11/Include/X11/ShellI.h b/ThirdParty/X11/Include/X11/ShellI.h
new file mode 100644
index 0000000000000000000000000000000000000000..c1ee0b159e1c1fbb4677a549d6aa58a5cf25ca36
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/ShellI.h
@@ -0,0 +1,10 @@
+#ifndef _XtShellInternal_h
+#define _XtShellInternal_h
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+extern void _XtShellGetCoordinates(Widget widget, Position *x, Position *y);
+
+#endif /* _XtShellInternal_h */
diff --git a/ThirdParty/X11/Include/X11/ShellP.h b/ThirdParty/X11/Include/X11/ShellP.h
new file mode 100644
index 0000000000000000000000000000000000000000..51ac3a06326792e56414002441b7ec9f781b33d8
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/ShellP.h
@@ -0,0 +1,434 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ * ShellP.h - Private definitions for Shell widget
+ *
+ * Author:	Paul Asente
+ * 		Digital Equipment Corporation
+ * 		Western Software Laboratory
+ * Date:	Thu Dec 3, 1987
+ */
+
+#ifndef _XtShellPrivate_h
+#define _XtShellPrivate_h
+
+#include <X11/Shell.h>
+
+/* *****
+ * ***** VendorP.h is included later on; it needs fields defined in the first
+ * ***** part of this header file
+ * *****
+ */
+
+_XFUNCPROTOBEGIN
+
+/***********************************************************************
+ *
+ * Shell Widget Private Data
+ *
+ ***********************************************************************/
+
+/* New fields for the Shell widget class record */
+
+typedef struct {
+    XtPointer       extension;          /* pointer to extension record      */
+} ShellClassPart;
+
+typedef struct {
+    XtPointer next_extension;	/* 1st 4 mandated for all extension records */
+    XrmQuark record_type;	/* NULLQUARK; on ShellClassPart */
+    long version;		/* must be XtShellExtensionVersion */
+    Cardinal record_size;	/* sizeof(ShellClassExtensionRec) */
+    XtGeometryHandler root_geometry_manager;
+} ShellClassExtensionRec, *ShellClassExtension;
+
+#define XtShellExtensionVersion 1L
+#define XtInheritRootGeometryManager ((XtGeometryHandler)_XtInherit)
+
+typedef struct _ShellClassRec {
+  	CoreClassPart      core_class;
+	CompositeClassPart composite_class;
+	ShellClassPart  shell_class;
+} ShellClassRec;
+
+externalref ShellClassRec shellClassRec;
+
+/* New fields for the shell widget */
+
+typedef struct {
+	char       *geometry;
+	XtCreatePopupChildProc	create_popup_child_proc;
+	XtGrabKind	grab_kind;
+	Boolean	    spring_loaded;
+	Boolean	    popped_up;
+	Boolean	    allow_shell_resize;
+	Boolean     client_specified; /* re-using old name */
+#define _XtShellPositionValid	((Boolean)(1<<0))
+#define _XtShellNotReparented	((Boolean)(1<<1))
+#define _XtShellPPositionOK	((Boolean)(1<<2))
+#define _XtShellGeometryParsed	((Boolean)(1<<3))
+	Boolean	    save_under;
+	Boolean	    override_redirect;
+
+	XtCallbackList popup_callback;
+	XtCallbackList popdown_callback;
+	Visual*     visual;
+} ShellPart;
+
+typedef  struct {
+	CorePart 	core;
+	CompositePart 	composite;
+	ShellPart 	shell;
+} ShellRec, *ShellWidget;
+
+/***********************************************************************
+ *
+ * OverrideShell Widget Private Data
+ *
+ ***********************************************************************/
+
+/* New fields for the OverrideShell widget class record */
+
+typedef struct {
+    XtPointer       extension;          /* pointer to extension record      */
+} OverrideShellClassPart;
+
+typedef struct _OverrideShellClassRec {
+  	CoreClassPart      core_class;
+	CompositeClassPart composite_class;
+	ShellClassPart  shell_class;
+	OverrideShellClassPart  override_shell_class;
+} OverrideShellClassRec;
+
+externalref OverrideShellClassRec overrideShellClassRec;
+
+/* No new fields for the override shell widget */
+
+typedef struct {int frabjous;} OverrideShellPart;
+
+typedef  struct {
+	CorePart 	core;
+	CompositePart 	composite;
+	ShellPart 	shell;
+	OverrideShellPart override;
+} OverrideShellRec, *OverrideShellWidget;
+
+/***********************************************************************
+ *
+ * WMShell Widget Private Data
+ *
+ ***********************************************************************/
+
+/* New fields for the WMShell widget class record */
+
+typedef struct {
+    XtPointer       extension;          /* pointer to extension record      */
+} WMShellClassPart;
+
+typedef struct _WMShellClassRec {
+  	CoreClassPart      core_class;
+	CompositeClassPart composite_class;
+	ShellClassPart  shell_class;
+	WMShellClassPart wm_shell_class;
+} WMShellClassRec;
+
+externalref WMShellClassRec wmShellClassRec;
+
+/* New fields for the WM shell widget */
+
+typedef struct {
+	char	   *title;
+	int 	    wm_timeout;
+	Boolean	    wait_for_wm;
+	Boolean	    transient;
+	Boolean     urgency;
+	Widget      client_leader;
+	String      window_role;
+	struct _OldXSizeHints {	/* pre-R4 Xlib structure */
+	    long flags;
+	    int x, y;
+	    int width, height;
+	    int min_width, min_height;
+	    int max_width, max_height;
+	    int width_inc, height_inc;
+	    struct {
+		    int x;
+		    int y;
+	    } min_aspect, max_aspect;
+	} size_hints;
+	XWMHints    wm_hints;
+	int base_width, base_height;
+	int win_gravity;
+	Atom title_encoding;
+} WMShellPart;
+
+typedef  struct {
+	CorePart 	core;
+	CompositePart 	composite;
+	ShellPart 	shell;
+	WMShellPart	wm;
+} WMShellRec, *WMShellWidget;
+
+_XFUNCPROTOEND
+
+#include <X11/VendorP.h>
+
+_XFUNCPROTOBEGIN
+
+/***********************************************************************
+ *
+ * TransientShell Widget Private Data
+ *
+ ***********************************************************************/
+
+/* New fields for the TransientShell widget class record */
+
+typedef struct {
+    XtPointer       extension;          /* pointer to extension record      */
+} TransientShellClassPart;
+
+typedef struct _TransientShellClassRec {
+  	CoreClassPart      core_class;
+	CompositeClassPart composite_class;
+	ShellClassPart  shell_class;
+	WMShellClassPart   wm_shell_class;
+	VendorShellClassPart vendor_shell_class;
+	TransientShellClassPart transient_shell_class;
+} TransientShellClassRec;
+
+externalref TransientShellClassRec transientShellClassRec;
+
+/* New fields for the transient shell widget */
+
+typedef struct {
+	Widget transient_for;
+} TransientShellPart;
+
+typedef  struct {
+	CorePart 	core;
+	CompositePart 	composite;
+	ShellPart 	shell;
+	WMShellPart	wm;
+	VendorShellPart	vendor;
+	TransientShellPart transient;
+} TransientShellRec, *TransientShellWidget;
+
+/***********************************************************************
+ *
+ * TopLevelShell Widget Private Data
+ *
+ ***********************************************************************/
+
+/* New fields for the TopLevelShell widget class record */
+
+typedef struct {
+    XtPointer       extension;          /* pointer to extension record      */
+} TopLevelShellClassPart;
+
+typedef struct _TopLevelShellClassRec {
+  	CoreClassPart      core_class;
+	CompositeClassPart composite_class;
+	ShellClassPart  shell_class;
+	WMShellClassPart   wm_shell_class;
+	VendorShellClassPart vendor_shell_class;
+	TopLevelShellClassPart top_level_shell_class;
+} TopLevelShellClassRec;
+
+externalref TopLevelShellClassRec topLevelShellClassRec;
+
+/* New fields for the top level shell widget */
+
+typedef struct {
+	char	   *icon_name;
+	Boolean	    iconic;
+	Atom	    icon_name_encoding;
+} TopLevelShellPart;
+
+typedef  struct {
+	CorePart 	core;
+	CompositePart 	composite;
+	ShellPart 	shell;
+	WMShellPart	wm;
+	VendorShellPart	vendor;
+	TopLevelShellPart topLevel;
+} TopLevelShellRec, *TopLevelShellWidget;
+
+/***********************************************************************
+ *
+ * ApplicationShell Widget Private Data
+ *
+ ***********************************************************************/
+
+/* New fields for the ApplicationShell widget class record */
+
+typedef struct {
+    XtPointer       extension;          /* pointer to extension record      */
+} ApplicationShellClassPart;
+
+typedef struct _ApplicationShellClassRec {
+  	CoreClassPart      core_class;
+	CompositeClassPart composite_class;
+	ShellClassPart  shell_class;
+	WMShellClassPart   wm_shell_class;
+	VendorShellClassPart vendor_shell_class;
+	TopLevelShellClassPart top_level_shell_class;
+	ApplicationShellClassPart application_shell_class;
+} ApplicationShellClassRec;
+
+externalref ApplicationShellClassRec applicationShellClassRec;
+
+/* New fields for the application shell widget */
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    char *c_class;
+#else
+    char *class;
+#endif
+    XrmClass xrm_class;
+    int argc;
+    char **argv;
+} ApplicationShellPart;
+
+typedef  struct {
+	CorePart 	core;
+	CompositePart 	composite;
+	ShellPart 	shell;
+	WMShellPart	wm;
+	VendorShellPart	vendor;
+	TopLevelShellPart topLevel;
+	ApplicationShellPart application;
+} ApplicationShellRec, *ApplicationShellWidget;
+
+/***********************************************************************
+ *
+ * SessionShell Widget Private Data
+ *
+ ***********************************************************************/
+
+/* New fields for the SessionShell widget class record */
+
+typedef struct {
+    XtPointer       extension;          /* pointer to extension record */
+} SessionShellClassPart;
+
+typedef struct _SessionShellClassRec {
+  	CoreClassPart      core_class;
+	CompositeClassPart composite_class;
+	ShellClassPart  shell_class;
+	WMShellClassPart   wm_shell_class;
+	VendorShellClassPart vendor_shell_class;
+	TopLevelShellClassPart top_level_shell_class;
+	ApplicationShellClassPart application_shell_class;
+	SessionShellClassPart session_shell_class;
+} SessionShellClassRec;
+
+externalref SessionShellClassRec sessionShellClassRec;
+
+typedef struct _XtSaveYourselfRec *XtSaveYourself; /* implementation-private */
+
+/* New fields for the session shell widget */
+
+typedef struct {
+    SmcConn         connection;
+    String          session_id;
+    String*         restart_command;
+    String*         clone_command;
+    String*         discard_command;
+    String*         resign_command;
+    String*         shutdown_command;
+    String*         environment;
+    String          current_dir;
+    String          program_path;
+    unsigned char   restart_style;
+    unsigned char   checkpoint_state;
+    Boolean         join_session;
+    XtCallbackList  save_callbacks;
+    XtCallbackList  interact_callbacks;
+    XtCallbackList  cancel_callbacks;
+    XtCallbackList  save_complete_callbacks;
+    XtCallbackList  die_callbacks;
+    XtCallbackList  error_callbacks;
+    XtSaveYourself  save;
+    XtInputId       input_id;
+    XtPointer       ses20;
+    XtPointer       ses19;
+    XtPointer       ses18;
+    XtPointer       ses17;
+    XtPointer       ses16;
+    XtPointer       ses15;
+    XtPointer       ses14;
+    XtPointer       ses13;
+    XtPointer       ses12;
+    XtPointer       ses11;
+    XtPointer       ses10;
+    XtPointer       ses9;
+    XtPointer       ses8;
+    XtPointer       ses7;
+    XtPointer       ses6;
+    XtPointer       ses5;
+    XtPointer       ses4;
+    XtPointer       ses3;
+    XtPointer       ses2;
+    XtPointer       ses1;
+} SessionShellPart;
+
+typedef  struct {
+	CorePart 	core;
+	CompositePart 	composite;
+	ShellPart 	shell;
+	WMShellPart	wm;
+	VendorShellPart	vendor;
+	TopLevelShellPart topLevel;
+	ApplicationShellPart application;
+	SessionShellPart session;
+} SessionShellRec, *SessionShellWidget;
+
+_XFUNCPROTOEND
+
+#endif /* _XtShellPrivate_h */
diff --git a/ThirdParty/X11/Include/X11/StringDefs.h b/ThirdParty/X11/Include/X11/StringDefs.h
new file mode 100644
index 0000000000000000000000000000000000000000..569506bf859e01aea4154ef2298db1a3774aa0ee
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/StringDefs.h
@@ -0,0 +1,1085 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XtStringDefs_h_
+#define _XtStringDefs_h_
+
+#ifndef XTSTRINGDEFINES
+#define _XtStringDefs_h_Const const
+#endif
+
+/* $Xorg: makestrs.c,v 1.6 2001/02/09 02:03:17 xorgcvs Exp $ */
+/* This file is automatically generated. */
+/* Default ABI version -- Do not edit */
+#ifdef XTSTRINGDEFINES
+#define XtNaccelerators "accelerators"
+#define XtNallowHoriz "allowHoriz"
+#define XtNallowVert "allowVert"
+#define XtNancestorSensitive "ancestorSensitive"
+#define XtNbackground "background"
+#define XtNbackgroundPixmap "backgroundPixmap"
+#define XtNbitmap "bitmap"
+#define XtNborderColor "borderColor"
+#define XtNborder "borderColor"
+#define XtNborderPixmap "borderPixmap"
+#define XtNborderWidth "borderWidth"
+#define XtNcallback "callback"
+#define XtNchildren "children"
+#define XtNcolormap "colormap"
+#define XtNdepth "depth"
+#define XtNdestroyCallback "destroyCallback"
+#define XtNeditType "editType"
+#define XtNfile "file"
+#define XtNfont "font"
+#define XtNforceBars "forceBars"
+#define XtNforeground "foreground"
+#define XtNfunction "function"
+#define XtNheight "height"
+#define XtNhighlight "highlight"
+#define XtNhSpace "hSpace"
+#define XtNindex "index"
+#define XtNinitialResourcesPersistent "initialResourcesPersistent"
+#define XtNinnerHeight "innerHeight"
+#define XtNinnerWidth "innerWidth"
+#define XtNinnerWindow "innerWindow"
+#define XtNinsertPosition "insertPosition"
+#define XtNinternalHeight "internalHeight"
+#define XtNinternalWidth "internalWidth"
+#define XtNjumpProc "jumpProc"
+#define XtNjustify "justify"
+#define XtNknobHeight "knobHeight"
+#define XtNknobIndent "knobIndent"
+#define XtNknobPixel "knobPixel"
+#define XtNknobWidth "knobWidth"
+#define XtNlabel "label"
+#define XtNlength "length"
+#define XtNlowerRight "lowerRight"
+#define XtNmappedWhenManaged "mappedWhenManaged"
+#define XtNmenuEntry "menuEntry"
+#define XtNname "name"
+#define XtNnotify "notify"
+#define XtNnumChildren "numChildren"
+#define XtNorientation "orientation"
+#define XtNparameter "parameter"
+#define XtNpixmap "pixmap"
+#define XtNpopupCallback "popupCallback"
+#define XtNpopdownCallback "popdownCallback"
+#define XtNresize "resize"
+#define XtNreverseVideo "reverseVideo"
+#define XtNscreen "screen"
+#define XtNscrollProc "scrollProc"
+#define XtNscrollDCursor "scrollDCursor"
+#define XtNscrollHCursor "scrollHCursor"
+#define XtNscrollLCursor "scrollLCursor"
+#define XtNscrollRCursor "scrollRCursor"
+#define XtNscrollUCursor "scrollUCursor"
+#define XtNscrollVCursor "scrollVCursor"
+#define XtNselection "selection"
+#define XtNselectionArray "selectionArray"
+#define XtNsensitive "sensitive"
+#define XtNshown "shown"
+#define XtNspace "space"
+#define XtNstring "string"
+#define XtNtextOptions "textOptions"
+#define XtNtextSink "textSink"
+#define XtNtextSource "textSource"
+#define XtNthickness "thickness"
+#define XtNthumb "thumb"
+#define XtNthumbProc "thumbProc"
+#define XtNtop "top"
+#define XtNtranslations "translations"
+#define XtNunrealizeCallback "unrealizeCallback"
+#define XtNupdate "update"
+#define XtNuseBottom "useBottom"
+#define XtNuseRight "useRight"
+#define XtNvalue "value"
+#define XtNvSpace "vSpace"
+#define XtNwidth "width"
+#define XtNwindow "window"
+#define XtNx "x"
+#define XtNy "y"
+#define XtCAccelerators "Accelerators"
+#define XtCBackground "Background"
+#define XtCBitmap "Bitmap"
+#define XtCBoolean "Boolean"
+#define XtCBorderColor "BorderColor"
+#define XtCBorderWidth "BorderWidth"
+#define XtCCallback "Callback"
+#define XtCColormap "Colormap"
+#define XtCColor "Color"
+#define XtCCursor "Cursor"
+#define XtCDepth "Depth"
+#define XtCEditType "EditType"
+#define XtCEventBindings "EventBindings"
+#define XtCFile "File"
+#define XtCFont "Font"
+#define XtCForeground "Foreground"
+#define XtCFraction "Fraction"
+#define XtCFunction "Function"
+#define XtCHeight "Height"
+#define XtCHSpace "HSpace"
+#define XtCIndex "Index"
+#define XtCInitialResourcesPersistent "InitialResourcesPersistent"
+#define XtCInsertPosition "InsertPosition"
+#define XtCInterval "Interval"
+#define XtCJustify "Justify"
+#define XtCKnobIndent "KnobIndent"
+#define XtCKnobPixel "KnobPixel"
+#define XtCLabel "Label"
+#define XtCLength "Length"
+#define XtCMappedWhenManaged "MappedWhenManaged"
+#define XtCMargin "Margin"
+#define XtCMenuEntry "MenuEntry"
+#define XtCNotify "Notify"
+#define XtCOrientation "Orientation"
+#define XtCParameter "Parameter"
+#define XtCPixmap "Pixmap"
+#define XtCPosition "Position"
+#define XtCReadOnly "ReadOnly"
+#define XtCResize "Resize"
+#define XtCReverseVideo "ReverseVideo"
+#define XtCScreen "Screen"
+#define XtCScrollProc "ScrollProc"
+#define XtCScrollDCursor "ScrollDCursor"
+#define XtCScrollHCursor "ScrollHCursor"
+#define XtCScrollLCursor "ScrollLCursor"
+#define XtCScrollRCursor "ScrollRCursor"
+#define XtCScrollUCursor "ScrollUCursor"
+#define XtCScrollVCursor "ScrollVCursor"
+#define XtCSelection "Selection"
+#define XtCSensitive "Sensitive"
+#define XtCSelectionArray "SelectionArray"
+#define XtCSpace "Space"
+#define XtCString "String"
+#define XtCTextOptions "TextOptions"
+#define XtCTextPosition "TextPosition"
+#define XtCTextSink "TextSink"
+#define XtCTextSource "TextSource"
+#define XtCThickness "Thickness"
+#define XtCThumb "Thumb"
+#define XtCTranslations "Translations"
+#define XtCValue "Value"
+#define XtCVSpace "VSpace"
+#define XtCWidth "Width"
+#define XtCWindow "Window"
+#define XtCX "X"
+#define XtCY "Y"
+#define XtRAcceleratorTable "AcceleratorTable"
+#ifndef XtRAtom
+#define XtRAtom "Atom"
+#endif
+#define XtRBitmap "Bitmap"
+#define XtRBool "Bool"
+#define XtRBoolean "Boolean"
+#define XtRCallback "Callback"
+#define XtRCallProc "CallProc"
+#define XtRCardinal "Cardinal"
+#define XtRColor "Color"
+#define XtRColormap "Colormap"
+#define XtRCursor "Cursor"
+#define XtRDimension "Dimension"
+#define XtRDisplay "Display"
+#define XtREditMode "EditMode"
+#define XtREnum "Enum"
+#define XtRFile "File"
+#define XtRFloat "Float"
+#define XtRFont "Font"
+#define XtRFontStruct "FontStruct"
+#define XtRFunction "Function"
+#define XtRGeometry "Geometry"
+#define XtRImmediate "Immediate"
+#define XtRInitialState "InitialState"
+#define XtRInt "Int"
+#define XtRJustify "Justify"
+#define XtRLongBoolean "Bool"
+#define XtRObject "Object"
+#define XtROrientation "Orientation"
+#define XtRPixel "Pixel"
+#define XtRPixmap "Pixmap"
+#define XtRPointer "Pointer"
+#define XtRPosition "Position"
+#define XtRScreen "Screen"
+#define XtRShort "Short"
+#define XtRString "String"
+#define XtRStringArray "StringArray"
+#define XtRStringTable "StringTable"
+#define XtRUnsignedChar "UnsignedChar"
+#define XtRTranslationTable "TranslationTable"
+#define XtRVisual "Visual"
+#define XtRWidget "Widget"
+#define XtRWidgetClass "WidgetClass"
+#define XtRWidgetList "WidgetList"
+#define XtRWindow "Window"
+#define XtEoff "off"
+#define XtEfalse "false"
+#define XtEno "no"
+#define XtEon "on"
+#define XtEtrue "true"
+#define XtEyes "yes"
+#define XtEvertical "vertical"
+#define XtEhorizontal "horizontal"
+#define XtEtextRead "read"
+#define XtEtextAppend "append"
+#define XtEtextEdit "edit"
+#define XtExtdefaultbackground "xtdefaultbackground"
+#define XtExtdefaultforeground "xtdefaultforeground"
+#define XtExtdefaultfont "xtdefaultfont"
+#define XtNfontSet "fontSet"
+#define XtRFontSet "FontSet"
+#define XtCFontSet "FontSet"
+#define XtRGravity "Gravity"
+#define XtNcreateHook "createHook"
+#define XtNchangeHook "changeHook"
+#define XtNconfigureHook "configureHook"
+#define XtNgeometryHook "geometryHook"
+#define XtNdestroyHook "destroyHook"
+#define XtNshells "shells"
+#define XtNnumShells "numShells"
+#define XtRCommandArgArray "CommandArgArray"
+#define XtRDirectoryString "DirectoryString"
+#define XtREnvironmentArray "EnvironmentArray"
+#define XtRRestartStyle "RestartStyle"
+#define XtRSmcConn "SmcConn"
+#define XtHcreate "Xtcreate"
+#define XtHsetValues "XtsetValues"
+#define XtHmanageChildren "XtmanageChildren"
+#define XtHunmanageChildren "XtunmanageChildren"
+#define XtHmanageSet "XtmanageSet"
+#define XtHunmanageSet "XtunmanageSet"
+#define XtHrealizeWidget "XtrealizeWidget"
+#define XtHunrealizeWidget "XtunrealizeWidget"
+#define XtHaddCallback "XtaddCallback"
+#define XtHaddCallbacks "XtaddCallbacks"
+#define XtHremoveCallback "XtremoveCallback"
+#define XtHremoveCallbacks "XtremoveCallbacks"
+#define XtHremoveAllCallbacks "XtremoveAllCallbacks"
+#define XtHaugmentTranslations "XtaugmentTranslations"
+#define XtHoverrideTranslations "XtoverrideTranslations"
+#define XtHuninstallTranslations "XtuninstallTranslations"
+#define XtHsetKeyboardFocus "XtsetKeyboardFocus"
+#define XtHsetWMColormapWindows "XtsetWMColormapWindows"
+#define XtHsetMappedWhenManaged "XtsetMappedWhenManaged"
+#define XtHmapWidget "XtmapWidget"
+#define XtHunmapWidget "XtunmapWidget"
+#define XtHpopup "Xtpopup"
+#define XtHpopupSpringLoaded "XtpopupSpringLoaded"
+#define XtHpopdown "Xtpopdown"
+#define XtHconfigure "Xtconfigure"
+#define XtHpreGeometry "XtpreGeometry"
+#define XtHpostGeometry "XtpostGeometry"
+#define XtHdestroy "Xtdestroy"
+#else
+extern _XtStringDefs_h_Const char XtStrings[];
+#ifndef XtNaccelerators
+#define XtNaccelerators ((char*)&XtStrings[0])
+#endif
+#ifndef XtNallowHoriz
+#define XtNallowHoriz ((char*)&XtStrings[13])
+#endif
+#ifndef XtNallowVert
+#define XtNallowVert ((char*)&XtStrings[24])
+#endif
+#ifndef XtNancestorSensitive
+#define XtNancestorSensitive ((char*)&XtStrings[34])
+#endif
+#ifndef XtNbackground
+#define XtNbackground ((char*)&XtStrings[52])
+#endif
+#ifndef XtNbackgroundPixmap
+#define XtNbackgroundPixmap ((char*)&XtStrings[63])
+#endif
+#ifndef XtNbitmap
+#define XtNbitmap ((char*)&XtStrings[80])
+#endif
+#ifndef XtNborderColor
+#define XtNborderColor ((char*)&XtStrings[87])
+#endif
+#ifndef XtNborder
+#define XtNborder ((char*)&XtStrings[99])
+#endif
+#ifndef XtNborderPixmap
+#define XtNborderPixmap ((char*)&XtStrings[111])
+#endif
+#ifndef XtNborderWidth
+#define XtNborderWidth ((char*)&XtStrings[124])
+#endif
+#ifndef XtNcallback
+#define XtNcallback ((char*)&XtStrings[136])
+#endif
+#ifndef XtNchildren
+#define XtNchildren ((char*)&XtStrings[145])
+#endif
+#ifndef XtNcolormap
+#define XtNcolormap ((char*)&XtStrings[154])
+#endif
+#ifndef XtNdepth
+#define XtNdepth ((char*)&XtStrings[163])
+#endif
+#ifndef XtNdestroyCallback
+#define XtNdestroyCallback ((char*)&XtStrings[169])
+#endif
+#ifndef XtNeditType
+#define XtNeditType ((char*)&XtStrings[185])
+#endif
+#ifndef XtNfile
+#define XtNfile ((char*)&XtStrings[194])
+#endif
+#ifndef XtNfont
+#define XtNfont ((char*)&XtStrings[199])
+#endif
+#ifndef XtNforceBars
+#define XtNforceBars ((char*)&XtStrings[204])
+#endif
+#ifndef XtNforeground
+#define XtNforeground ((char*)&XtStrings[214])
+#endif
+#ifndef XtNfunction
+#define XtNfunction ((char*)&XtStrings[225])
+#endif
+#ifndef XtNheight
+#define XtNheight ((char*)&XtStrings[234])
+#endif
+#ifndef XtNhighlight
+#define XtNhighlight ((char*)&XtStrings[241])
+#endif
+#ifndef XtNhSpace
+#define XtNhSpace ((char*)&XtStrings[251])
+#endif
+#ifndef XtNindex
+#define XtNindex ((char*)&XtStrings[258])
+#endif
+#ifndef XtNinitialResourcesPersistent
+#define XtNinitialResourcesPersistent ((char*)&XtStrings[264])
+#endif
+#ifndef XtNinnerHeight
+#define XtNinnerHeight ((char*)&XtStrings[291])
+#endif
+#ifndef XtNinnerWidth
+#define XtNinnerWidth ((char*)&XtStrings[303])
+#endif
+#ifndef XtNinnerWindow
+#define XtNinnerWindow ((char*)&XtStrings[314])
+#endif
+#ifndef XtNinsertPosition
+#define XtNinsertPosition ((char*)&XtStrings[326])
+#endif
+#ifndef XtNinternalHeight
+#define XtNinternalHeight ((char*)&XtStrings[341])
+#endif
+#ifndef XtNinternalWidth
+#define XtNinternalWidth ((char*)&XtStrings[356])
+#endif
+#ifndef XtNjumpProc
+#define XtNjumpProc ((char*)&XtStrings[370])
+#endif
+#ifndef XtNjustify
+#define XtNjustify ((char*)&XtStrings[379])
+#endif
+#ifndef XtNknobHeight
+#define XtNknobHeight ((char*)&XtStrings[387])
+#endif
+#ifndef XtNknobIndent
+#define XtNknobIndent ((char*)&XtStrings[398])
+#endif
+#ifndef XtNknobPixel
+#define XtNknobPixel ((char*)&XtStrings[409])
+#endif
+#ifndef XtNknobWidth
+#define XtNknobWidth ((char*)&XtStrings[419])
+#endif
+#ifndef XtNlabel
+#define XtNlabel ((char*)&XtStrings[429])
+#endif
+#ifndef XtNlength
+#define XtNlength ((char*)&XtStrings[435])
+#endif
+#ifndef XtNlowerRight
+#define XtNlowerRight ((char*)&XtStrings[442])
+#endif
+#ifndef XtNmappedWhenManaged
+#define XtNmappedWhenManaged ((char*)&XtStrings[453])
+#endif
+#ifndef XtNmenuEntry
+#define XtNmenuEntry ((char*)&XtStrings[471])
+#endif
+#ifndef XtNname
+#define XtNname ((char*)&XtStrings[481])
+#endif
+#ifndef XtNnotify
+#define XtNnotify ((char*)&XtStrings[486])
+#endif
+#ifndef XtNnumChildren
+#define XtNnumChildren ((char*)&XtStrings[493])
+#endif
+#ifndef XtNorientation
+#define XtNorientation ((char*)&XtStrings[505])
+#endif
+#ifndef XtNparameter
+#define XtNparameter ((char*)&XtStrings[517])
+#endif
+#ifndef XtNpixmap
+#define XtNpixmap ((char*)&XtStrings[527])
+#endif
+#ifndef XtNpopupCallback
+#define XtNpopupCallback ((char*)&XtStrings[534])
+#endif
+#ifndef XtNpopdownCallback
+#define XtNpopdownCallback ((char*)&XtStrings[548])
+#endif
+#ifndef XtNresize
+#define XtNresize ((char*)&XtStrings[564])
+#endif
+#ifndef XtNreverseVideo
+#define XtNreverseVideo ((char*)&XtStrings[571])
+#endif
+#ifndef XtNscreen
+#define XtNscreen ((char*)&XtStrings[584])
+#endif
+#ifndef XtNscrollProc
+#define XtNscrollProc ((char*)&XtStrings[591])
+#endif
+#ifndef XtNscrollDCursor
+#define XtNscrollDCursor ((char*)&XtStrings[602])
+#endif
+#ifndef XtNscrollHCursor
+#define XtNscrollHCursor ((char*)&XtStrings[616])
+#endif
+#ifndef XtNscrollLCursor
+#define XtNscrollLCursor ((char*)&XtStrings[630])
+#endif
+#ifndef XtNscrollRCursor
+#define XtNscrollRCursor ((char*)&XtStrings[644])
+#endif
+#ifndef XtNscrollUCursor
+#define XtNscrollUCursor ((char*)&XtStrings[658])
+#endif
+#ifndef XtNscrollVCursor
+#define XtNscrollVCursor ((char*)&XtStrings[672])
+#endif
+#ifndef XtNselection
+#define XtNselection ((char*)&XtStrings[686])
+#endif
+#ifndef XtNselectionArray
+#define XtNselectionArray ((char*)&XtStrings[696])
+#endif
+#ifndef XtNsensitive
+#define XtNsensitive ((char*)&XtStrings[711])
+#endif
+#ifndef XtNshown
+#define XtNshown ((char*)&XtStrings[721])
+#endif
+#ifndef XtNspace
+#define XtNspace ((char*)&XtStrings[727])
+#endif
+#ifndef XtNstring
+#define XtNstring ((char*)&XtStrings[733])
+#endif
+#ifndef XtNtextOptions
+#define XtNtextOptions ((char*)&XtStrings[740])
+#endif
+#ifndef XtNtextSink
+#define XtNtextSink ((char*)&XtStrings[752])
+#endif
+#ifndef XtNtextSource
+#define XtNtextSource ((char*)&XtStrings[761])
+#endif
+#ifndef XtNthickness
+#define XtNthickness ((char*)&XtStrings[772])
+#endif
+#ifndef XtNthumb
+#define XtNthumb ((char*)&XtStrings[782])
+#endif
+#ifndef XtNthumbProc
+#define XtNthumbProc ((char*)&XtStrings[788])
+#endif
+#ifndef XtNtop
+#define XtNtop ((char*)&XtStrings[798])
+#endif
+#ifndef XtNtranslations
+#define XtNtranslations ((char*)&XtStrings[802])
+#endif
+#ifndef XtNunrealizeCallback
+#define XtNunrealizeCallback ((char*)&XtStrings[815])
+#endif
+#ifndef XtNupdate
+#define XtNupdate ((char*)&XtStrings[833])
+#endif
+#ifndef XtNuseBottom
+#define XtNuseBottom ((char*)&XtStrings[840])
+#endif
+#ifndef XtNuseRight
+#define XtNuseRight ((char*)&XtStrings[850])
+#endif
+#ifndef XtNvalue
+#define XtNvalue ((char*)&XtStrings[859])
+#endif
+#ifndef XtNvSpace
+#define XtNvSpace ((char*)&XtStrings[865])
+#endif
+#ifndef XtNwidth
+#define XtNwidth ((char*)&XtStrings[872])
+#endif
+#ifndef XtNwindow
+#define XtNwindow ((char*)&XtStrings[878])
+#endif
+#ifndef XtNx
+#define XtNx ((char*)&XtStrings[885])
+#endif
+#ifndef XtNy
+#define XtNy ((char*)&XtStrings[887])
+#endif
+#ifndef XtCAccelerators
+#define XtCAccelerators ((char*)&XtStrings[889])
+#endif
+#ifndef XtCBackground
+#define XtCBackground ((char*)&XtStrings[902])
+#endif
+#ifndef XtCBitmap
+#define XtCBitmap ((char*)&XtStrings[913])
+#endif
+#ifndef XtCBoolean
+#define XtCBoolean ((char*)&XtStrings[920])
+#endif
+#ifndef XtCBorderColor
+#define XtCBorderColor ((char*)&XtStrings[928])
+#endif
+#ifndef XtCBorderWidth
+#define XtCBorderWidth ((char*)&XtStrings[940])
+#endif
+#ifndef XtCCallback
+#define XtCCallback ((char*)&XtStrings[952])
+#endif
+#ifndef XtCColormap
+#define XtCColormap ((char*)&XtStrings[961])
+#endif
+#ifndef XtCColor
+#define XtCColor ((char*)&XtStrings[970])
+#endif
+#ifndef XtCCursor
+#define XtCCursor ((char*)&XtStrings[976])
+#endif
+#ifndef XtCDepth
+#define XtCDepth ((char*)&XtStrings[983])
+#endif
+#ifndef XtCEditType
+#define XtCEditType ((char*)&XtStrings[989])
+#endif
+#ifndef XtCEventBindings
+#define XtCEventBindings ((char*)&XtStrings[998])
+#endif
+#ifndef XtCFile
+#define XtCFile ((char*)&XtStrings[1012])
+#endif
+#ifndef XtCFont
+#define XtCFont ((char*)&XtStrings[1017])
+#endif
+#ifndef XtCForeground
+#define XtCForeground ((char*)&XtStrings[1022])
+#endif
+#ifndef XtCFraction
+#define XtCFraction ((char*)&XtStrings[1033])
+#endif
+#ifndef XtCFunction
+#define XtCFunction ((char*)&XtStrings[1042])
+#endif
+#ifndef XtCHeight
+#define XtCHeight ((char*)&XtStrings[1051])
+#endif
+#ifndef XtCHSpace
+#define XtCHSpace ((char*)&XtStrings[1058])
+#endif
+#ifndef XtCIndex
+#define XtCIndex ((char*)&XtStrings[1065])
+#endif
+#ifndef XtCInitialResourcesPersistent
+#define XtCInitialResourcesPersistent ((char*)&XtStrings[1071])
+#endif
+#ifndef XtCInsertPosition
+#define XtCInsertPosition ((char*)&XtStrings[1098])
+#endif
+#ifndef XtCInterval
+#define XtCInterval ((char*)&XtStrings[1113])
+#endif
+#ifndef XtCJustify
+#define XtCJustify ((char*)&XtStrings[1122])
+#endif
+#ifndef XtCKnobIndent
+#define XtCKnobIndent ((char*)&XtStrings[1130])
+#endif
+#ifndef XtCKnobPixel
+#define XtCKnobPixel ((char*)&XtStrings[1141])
+#endif
+#ifndef XtCLabel
+#define XtCLabel ((char*)&XtStrings[1151])
+#endif
+#ifndef XtCLength
+#define XtCLength ((char*)&XtStrings[1157])
+#endif
+#ifndef XtCMappedWhenManaged
+#define XtCMappedWhenManaged ((char*)&XtStrings[1164])
+#endif
+#ifndef XtCMargin
+#define XtCMargin ((char*)&XtStrings[1182])
+#endif
+#ifndef XtCMenuEntry
+#define XtCMenuEntry ((char*)&XtStrings[1189])
+#endif
+#ifndef XtCNotify
+#define XtCNotify ((char*)&XtStrings[1199])
+#endif
+#ifndef XtCOrientation
+#define XtCOrientation ((char*)&XtStrings[1206])
+#endif
+#ifndef XtCParameter
+#define XtCParameter ((char*)&XtStrings[1218])
+#endif
+#ifndef XtCPixmap
+#define XtCPixmap ((char*)&XtStrings[1228])
+#endif
+#ifndef XtCPosition
+#define XtCPosition ((char*)&XtStrings[1235])
+#endif
+#ifndef XtCReadOnly
+#define XtCReadOnly ((char*)&XtStrings[1244])
+#endif
+#ifndef XtCResize
+#define XtCResize ((char*)&XtStrings[1253])
+#endif
+#ifndef XtCReverseVideo
+#define XtCReverseVideo ((char*)&XtStrings[1260])
+#endif
+#ifndef XtCScreen
+#define XtCScreen ((char*)&XtStrings[1273])
+#endif
+#ifndef XtCScrollProc
+#define XtCScrollProc ((char*)&XtStrings[1280])
+#endif
+#ifndef XtCScrollDCursor
+#define XtCScrollDCursor ((char*)&XtStrings[1291])
+#endif
+#ifndef XtCScrollHCursor
+#define XtCScrollHCursor ((char*)&XtStrings[1305])
+#endif
+#ifndef XtCScrollLCursor
+#define XtCScrollLCursor ((char*)&XtStrings[1319])
+#endif
+#ifndef XtCScrollRCursor
+#define XtCScrollRCursor ((char*)&XtStrings[1333])
+#endif
+#ifndef XtCScrollUCursor
+#define XtCScrollUCursor ((char*)&XtStrings[1347])
+#endif
+#ifndef XtCScrollVCursor
+#define XtCScrollVCursor ((char*)&XtStrings[1361])
+#endif
+#ifndef XtCSelection
+#define XtCSelection ((char*)&XtStrings[1375])
+#endif
+#ifndef XtCSensitive
+#define XtCSensitive ((char*)&XtStrings[1385])
+#endif
+#ifndef XtCSelectionArray
+#define XtCSelectionArray ((char*)&XtStrings[1395])
+#endif
+#ifndef XtCSpace
+#define XtCSpace ((char*)&XtStrings[1410])
+#endif
+#ifndef XtCString
+#define XtCString ((char*)&XtStrings[1416])
+#endif
+#ifndef XtCTextOptions
+#define XtCTextOptions ((char*)&XtStrings[1423])
+#endif
+#ifndef XtCTextPosition
+#define XtCTextPosition ((char*)&XtStrings[1435])
+#endif
+#ifndef XtCTextSink
+#define XtCTextSink ((char*)&XtStrings[1448])
+#endif
+#ifndef XtCTextSource
+#define XtCTextSource ((char*)&XtStrings[1457])
+#endif
+#ifndef XtCThickness
+#define XtCThickness ((char*)&XtStrings[1468])
+#endif
+#ifndef XtCThumb
+#define XtCThumb ((char*)&XtStrings[1478])
+#endif
+#ifndef XtCTranslations
+#define XtCTranslations ((char*)&XtStrings[1484])
+#endif
+#ifndef XtCValue
+#define XtCValue ((char*)&XtStrings[1497])
+#endif
+#ifndef XtCVSpace
+#define XtCVSpace ((char*)&XtStrings[1503])
+#endif
+#ifndef XtCWidth
+#define XtCWidth ((char*)&XtStrings[1510])
+#endif
+#ifndef XtCWindow
+#define XtCWindow ((char*)&XtStrings[1516])
+#endif
+#ifndef XtCX
+#define XtCX ((char*)&XtStrings[1523])
+#endif
+#ifndef XtCY
+#define XtCY ((char*)&XtStrings[1525])
+#endif
+#ifndef XtRAcceleratorTable
+#define XtRAcceleratorTable ((char*)&XtStrings[1527])
+#endif
+#ifndef XtRAtom
+#define XtRAtom ((char*)&XtStrings[1544])
+#endif
+#ifndef XtRBitmap
+#define XtRBitmap ((char*)&XtStrings[1549])
+#endif
+#ifndef XtRBool
+#define XtRBool ((char*)&XtStrings[1556])
+#endif
+#ifndef XtRBoolean
+#define XtRBoolean ((char*)&XtStrings[1561])
+#endif
+#ifndef XtRCallback
+#define XtRCallback ((char*)&XtStrings[1569])
+#endif
+#ifndef XtRCallProc
+#define XtRCallProc ((char*)&XtStrings[1578])
+#endif
+#ifndef XtRCardinal
+#define XtRCardinal ((char*)&XtStrings[1587])
+#endif
+#ifndef XtRColor
+#define XtRColor ((char*)&XtStrings[1596])
+#endif
+#ifndef XtRColormap
+#define XtRColormap ((char*)&XtStrings[1602])
+#endif
+#ifndef XtRCursor
+#define XtRCursor ((char*)&XtStrings[1611])
+#endif
+#ifndef XtRDimension
+#define XtRDimension ((char*)&XtStrings[1618])
+#endif
+#ifndef XtRDisplay
+#define XtRDisplay ((char*)&XtStrings[1628])
+#endif
+#ifndef XtREditMode
+#define XtREditMode ((char*)&XtStrings[1636])
+#endif
+#ifndef XtREnum
+#define XtREnum ((char*)&XtStrings[1645])
+#endif
+#ifndef XtRFile
+#define XtRFile ((char*)&XtStrings[1650])
+#endif
+#ifndef XtRFloat
+#define XtRFloat ((char*)&XtStrings[1655])
+#endif
+#ifndef XtRFont
+#define XtRFont ((char*)&XtStrings[1661])
+#endif
+#ifndef XtRFontStruct
+#define XtRFontStruct ((char*)&XtStrings[1666])
+#endif
+#ifndef XtRFunction
+#define XtRFunction ((char*)&XtStrings[1677])
+#endif
+#ifndef XtRGeometry
+#define XtRGeometry ((char*)&XtStrings[1686])
+#endif
+#ifndef XtRImmediate
+#define XtRImmediate ((char*)&XtStrings[1695])
+#endif
+#ifndef XtRInitialState
+#define XtRInitialState ((char*)&XtStrings[1705])
+#endif
+#ifndef XtRInt
+#define XtRInt ((char*)&XtStrings[1718])
+#endif
+#ifndef XtRJustify
+#define XtRJustify ((char*)&XtStrings[1722])
+#endif
+#ifndef XtRLongBoolean
+#define XtRLongBoolean ((char*)&XtStrings[1730])
+#endif
+#ifndef XtRObject
+#define XtRObject ((char*)&XtStrings[1735])
+#endif
+#ifndef XtROrientation
+#define XtROrientation ((char*)&XtStrings[1742])
+#endif
+#ifndef XtRPixel
+#define XtRPixel ((char*)&XtStrings[1754])
+#endif
+#ifndef XtRPixmap
+#define XtRPixmap ((char*)&XtStrings[1760])
+#endif
+#ifndef XtRPointer
+#define XtRPointer ((char*)&XtStrings[1767])
+#endif
+#ifndef XtRPosition
+#define XtRPosition ((char*)&XtStrings[1775])
+#endif
+#ifndef XtRScreen
+#define XtRScreen ((char*)&XtStrings[1784])
+#endif
+#ifndef XtRShort
+#define XtRShort ((char*)&XtStrings[1791])
+#endif
+#ifndef XtRString
+#define XtRString ((char*)&XtStrings[1797])
+#endif
+#ifndef XtRStringArray
+#define XtRStringArray ((char*)&XtStrings[1804])
+#endif
+#ifndef XtRStringTable
+#define XtRStringTable ((char*)&XtStrings[1816])
+#endif
+#ifndef XtRUnsignedChar
+#define XtRUnsignedChar ((char*)&XtStrings[1828])
+#endif
+#ifndef XtRTranslationTable
+#define XtRTranslationTable ((char*)&XtStrings[1841])
+#endif
+#ifndef XtRVisual
+#define XtRVisual ((char*)&XtStrings[1858])
+#endif
+#ifndef XtRWidget
+#define XtRWidget ((char*)&XtStrings[1865])
+#endif
+#ifndef XtRWidgetClass
+#define XtRWidgetClass ((char*)&XtStrings[1872])
+#endif
+#ifndef XtRWidgetList
+#define XtRWidgetList ((char*)&XtStrings[1884])
+#endif
+#ifndef XtRWindow
+#define XtRWindow ((char*)&XtStrings[1895])
+#endif
+#ifndef XtEoff
+#define XtEoff ((char*)&XtStrings[1902])
+#endif
+#ifndef XtEfalse
+#define XtEfalse ((char*)&XtStrings[1906])
+#endif
+#ifndef XtEno
+#define XtEno ((char*)&XtStrings[1912])
+#endif
+#ifndef XtEon
+#define XtEon ((char*)&XtStrings[1915])
+#endif
+#ifndef XtEtrue
+#define XtEtrue ((char*)&XtStrings[1918])
+#endif
+#ifndef XtEyes
+#define XtEyes ((char*)&XtStrings[1923])
+#endif
+#ifndef XtEvertical
+#define XtEvertical ((char*)&XtStrings[1927])
+#endif
+#ifndef XtEhorizontal
+#define XtEhorizontal ((char*)&XtStrings[1936])
+#endif
+#ifndef XtEtextRead
+#define XtEtextRead ((char*)&XtStrings[1947])
+#endif
+#ifndef XtEtextAppend
+#define XtEtextAppend ((char*)&XtStrings[1952])
+#endif
+#ifndef XtEtextEdit
+#define XtEtextEdit ((char*)&XtStrings[1959])
+#endif
+#ifndef XtExtdefaultbackground
+#define XtExtdefaultbackground ((char*)&XtStrings[1964])
+#endif
+#ifndef XtExtdefaultforeground
+#define XtExtdefaultforeground ((char*)&XtStrings[1984])
+#endif
+#ifndef XtExtdefaultfont
+#define XtExtdefaultfont ((char*)&XtStrings[2004])
+#endif
+#ifndef XtNfontSet
+#define XtNfontSet ((char*)&XtStrings[2018])
+#endif
+#ifndef XtRFontSet
+#define XtRFontSet ((char*)&XtStrings[2026])
+#endif
+#ifndef XtCFontSet
+#define XtCFontSet ((char*)&XtStrings[2034])
+#endif
+#ifndef XtRGravity
+#define XtRGravity ((char*)&XtStrings[2042])
+#endif
+#ifndef XtNcreateHook
+#define XtNcreateHook ((char*)&XtStrings[2050])
+#endif
+#ifndef XtNchangeHook
+#define XtNchangeHook ((char*)&XtStrings[2061])
+#endif
+#ifndef XtNconfigureHook
+#define XtNconfigureHook ((char*)&XtStrings[2072])
+#endif
+#ifndef XtNgeometryHook
+#define XtNgeometryHook ((char*)&XtStrings[2086])
+#endif
+#ifndef XtNdestroyHook
+#define XtNdestroyHook ((char*)&XtStrings[2099])
+#endif
+#ifndef XtNshells
+#define XtNshells ((char*)&XtStrings[2111])
+#endif
+#ifndef XtNnumShells
+#define XtNnumShells ((char*)&XtStrings[2118])
+#endif
+#ifndef XtRCommandArgArray
+#define XtRCommandArgArray ((char*)&XtStrings[2128])
+#endif
+#ifndef XtRDirectoryString
+#define XtRDirectoryString ((char*)&XtStrings[2144])
+#endif
+#ifndef XtREnvironmentArray
+#define XtREnvironmentArray ((char*)&XtStrings[2160])
+#endif
+#ifndef XtRRestartStyle
+#define XtRRestartStyle ((char*)&XtStrings[2177])
+#endif
+#ifndef XtRSmcConn
+#define XtRSmcConn ((char*)&XtStrings[2190])
+#endif
+#ifndef XtHcreate
+#define XtHcreate ((char*)&XtStrings[2198])
+#endif
+#ifndef XtHsetValues
+#define XtHsetValues ((char*)&XtStrings[2207])
+#endif
+#ifndef XtHmanageChildren
+#define XtHmanageChildren ((char*)&XtStrings[2219])
+#endif
+#ifndef XtHunmanageChildren
+#define XtHunmanageChildren ((char*)&XtStrings[2236])
+#endif
+#ifndef XtHmanageSet
+#define XtHmanageSet ((char*)&XtStrings[2255])
+#endif
+#ifndef XtHunmanageSet
+#define XtHunmanageSet ((char*)&XtStrings[2267])
+#endif
+#ifndef XtHrealizeWidget
+#define XtHrealizeWidget ((char*)&XtStrings[2281])
+#endif
+#ifndef XtHunrealizeWidget
+#define XtHunrealizeWidget ((char*)&XtStrings[2297])
+#endif
+#ifndef XtHaddCallback
+#define XtHaddCallback ((char*)&XtStrings[2315])
+#endif
+#ifndef XtHaddCallbacks
+#define XtHaddCallbacks ((char*)&XtStrings[2329])
+#endif
+#ifndef XtHremoveCallback
+#define XtHremoveCallback ((char*)&XtStrings[2344])
+#endif
+#ifndef XtHremoveCallbacks
+#define XtHremoveCallbacks ((char*)&XtStrings[2361])
+#endif
+#ifndef XtHremoveAllCallbacks
+#define XtHremoveAllCallbacks ((char*)&XtStrings[2379])
+#endif
+#ifndef XtHaugmentTranslations
+#define XtHaugmentTranslations ((char*)&XtStrings[2400])
+#endif
+#ifndef XtHoverrideTranslations
+#define XtHoverrideTranslations ((char*)&XtStrings[2422])
+#endif
+#ifndef XtHuninstallTranslations
+#define XtHuninstallTranslations ((char*)&XtStrings[2445])
+#endif
+#ifndef XtHsetKeyboardFocus
+#define XtHsetKeyboardFocus ((char*)&XtStrings[2469])
+#endif
+#ifndef XtHsetWMColormapWindows
+#define XtHsetWMColormapWindows ((char*)&XtStrings[2488])
+#endif
+#ifndef XtHsetMappedWhenManaged
+#define XtHsetMappedWhenManaged ((char*)&XtStrings[2511])
+#endif
+#ifndef XtHmapWidget
+#define XtHmapWidget ((char*)&XtStrings[2534])
+#endif
+#ifndef XtHunmapWidget
+#define XtHunmapWidget ((char*)&XtStrings[2546])
+#endif
+#ifndef XtHpopup
+#define XtHpopup ((char*)&XtStrings[2560])
+#endif
+#ifndef XtHpopupSpringLoaded
+#define XtHpopupSpringLoaded ((char*)&XtStrings[2568])
+#endif
+#ifndef XtHpopdown
+#define XtHpopdown ((char*)&XtStrings[2588])
+#endif
+#ifndef XtHconfigure
+#define XtHconfigure ((char*)&XtStrings[2598])
+#endif
+#ifndef XtHpreGeometry
+#define XtHpreGeometry ((char*)&XtStrings[2610])
+#endif
+#ifndef XtHpostGeometry
+#define XtHpostGeometry ((char*)&XtStrings[2624])
+#endif
+#ifndef XtHdestroy
+#define XtHdestroy ((char*)&XtStrings[2639])
+#endif
+#endif /* XTSTRINGDEFINES */
+
+#ifndef XTSTRINGDEFINES
+#undef _XtStringDefs_h_Const
+#endif
+
+#endif /* _XtStringDefs_h_ */
diff --git a/ThirdParty/X11/Include/X11/Sunkeysym.h b/ThirdParty/X11/Include/X11/Sunkeysym.h
new file mode 100644
index 0000000000000000000000000000000000000000..78d1286bb94743b4af6837f21ecef87d62ce5c34
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Sunkeysym.h
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 1991, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+/************************************************************
+
+Copyright 1991, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+***********************************************************/
+
+/*
+ * Floating Accent
+ */
+
+#define	SunXK_FA_Grave		0x1005FF00
+#define	SunXK_FA_Circum		0x1005FF01
+#define	SunXK_FA_Tilde		0x1005FF02
+#define	SunXK_FA_Acute		0x1005FF03
+#define	SunXK_FA_Diaeresis	0x1005FF04
+#define	SunXK_FA_Cedilla	0x1005FF05
+
+/*
+ * Miscellaneous Functions
+ */
+
+#define	SunXK_F36		0x1005FF10	/* Labeled F11 */
+#define	SunXK_F37		0x1005FF11	/* Labeled F12 */
+
+#define SunXK_Sys_Req   	0x1005FF60
+#define SunXK_Print_Screen	0x0000FF61	/* Same as XK_Print */
+
+/*
+ * International & Multi-Key Character Composition
+ */
+
+#define SunXK_Compose		0x0000FF20	/* Same as XK_Multi_key */
+#define SunXK_AltGraph		0x0000FF7E	/* Same as XK_Mode_switch */
+
+/*
+ * Cursor Control
+ */
+
+#define SunXK_PageUp		0x0000FF55 	/* Same as XK_Prior */
+#define SunXK_PageDown		0x0000FF56	/* Same as XK_Next */
+
+/*
+ * Open Look Functions
+ */
+
+#define SunXK_Undo		0x0000FF65	/* Same as XK_Undo */
+#define SunXK_Again		0x0000FF66	/* Same as XK_Redo */
+#define SunXK_Find		0x0000FF68	/* Same as XK_Find */
+#define SunXK_Stop		0x0000FF69	/* Same as XK_Cancel */
+#define SunXK_Props		0x1005FF70
+#define SunXK_Front		0x1005FF71
+#define SunXK_Copy		0x1005FF72
+#define SunXK_Open		0x1005FF73
+#define SunXK_Paste		0x1005FF74
+#define SunXK_Cut		0x1005FF75
+
+#define SunXK_PowerSwitch		0x1005FF76
+#define SunXK_AudioLowerVolume		0x1005FF77
+#define SunXK_AudioMute			0x1005FF78
+#define SunXK_AudioRaiseVolume		0x1005FF79
+#define SunXK_VideoDegauss		0x1005FF7A
+#define SunXK_VideoLowerBrightness	0x1005FF7B
+#define SunXK_VideoRaiseBrightness	0x1005FF7C
+#define SunXK_PowerSwitchShift		0x1005FF7D
diff --git a/ThirdParty/X11/Include/X11/ThreadsI.h b/ThirdParty/X11/Include/X11/ThreadsI.h
new file mode 100644
index 0000000000000000000000000000000000000000..ff6dee3da3edf96f7db037aba5d0776ad4a8b2a8
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/ThreadsI.h
@@ -0,0 +1,129 @@
+/************************************************************
+
+Copyright (c) 1993, Oracle and/or its affiliates. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+********************************************************/
+
+/*
+
+Copyright 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/* $XFree86: xc/lib/Xt/ThreadsI.h,v 3.5 2001/12/14 19:56:31 dawes Exp $ */
+
+#ifndef _XtThreadsI_h
+#define _XtThreadsI_h
+
+#include <X11/XlibConf.h>
+
+#ifdef XTHREADS
+
+typedef struct _LockRec *LockPtr;
+
+typedef void (*ThreadAppProc)(
+    XtAppContext /* app */
+);
+
+typedef void (*ThreadAppYieldLockProc)(
+    XtAppContext, /* app */
+    Boolean*, /* push_thread */
+    Boolean*, /* pushed_thread */
+    int* /* level */
+);
+
+typedef void (*ThreadAppRestoreLockProc)(
+    XtAppContext /* app */,
+    int, /* level */
+    Boolean* /* pushed_thread */
+);
+
+_XFUNCPROTOBEGIN
+
+extern void (*_XtProcessLock)(
+    void
+);
+
+extern void (*_XtProcessUnlock)(
+    void
+);
+
+extern void (*_XtInitAppLock)(
+    XtAppContext /* app */
+);
+
+_XFUNCPROTOEND
+
+#define INIT_APP_LOCK(app) if(_XtInitAppLock) (*_XtInitAppLock)(app)
+#define FREE_APP_LOCK(app) if(app && app->free_lock)(*app->free_lock)(app)
+
+#define LOCK_PROCESS if(_XtProcessLock)(*_XtProcessLock)()
+#define UNLOCK_PROCESS if(_XtProcessUnlock)(*_XtProcessUnlock)()
+#define LOCK_APP(app) if(app && app->lock)(*app->lock)(app)
+#define UNLOCK_APP(app) if(app && app->unlock)(*app->unlock)(app)
+
+#define YIELD_APP_LOCK(app,push,pushed,level)\
+	 if(app && app->yield_lock) (*app->yield_lock)(app,push,pushed,level)
+#define RESTORE_APP_LOCK(app,level,pushed)\
+	 if(app && app->restore_lock) (*app->restore_lock)(app,level,pushed)
+
+#define WIDGET_TO_APPCON(w) \
+    XtAppContext app = (w && _XtProcessLock ? \
+	XtWidgetToApplicationContext(w) : NULL)
+
+#define DPY_TO_APPCON(d) \
+    XtAppContext app = (_XtProcessLock ? XtDisplayToApplicationContext(d): NULL)
+
+#else /* defined(XTHREADS) */
+
+#define LOCK_PROCESS
+#define UNLOCK_PROCESS
+#define LOCK_APP(app)
+#define UNLOCK_APP(app)
+
+#define INIT_APP_LOCK(app)
+#define FREE_APP_LOCK(app)
+
+#define WIDGET_TO_APPCON(w)
+#define DPY_TO_APPCON(d)
+
+#endif /* !defined(XTHREADS) */
+#endif /* _XtThreadsI_h */
diff --git a/ThirdParty/X11/Include/X11/TranslateI.h b/ThirdParty/X11/Include/X11/TranslateI.h
new file mode 100644
index 0000000000000000000000000000000000000000..7da70b9d953beeabd0eae207a5084990b2c59a23
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/TranslateI.h
@@ -0,0 +1,606 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ * TranslateI.h - Header file private to translation management
+ *
+ * Author:	Gabe Beged-Dov, HP
+ *
+ * Former Author:	Charles Haynes
+ * 		Digital Equipment Corporation
+ * 		Western Research Laboratory
+ * Date:	Sat Aug 29 1987
+ */
+
+/*#define REFCNT_TRANSLATIONS*/
+#define CACHE_TRANSLATIONS
+
+#define TM_NO_MATCH (-2)
+
+#define _XtRStateTablePair "_XtStateTablePair"
+
+typedef unsigned char TMByteCard;
+typedef unsigned short TMShortCard;
+typedef unsigned long TMLongCard;
+typedef short TMShortInt;
+
+typedef struct _TMTypeMatchRec *TMTypeMatch;
+typedef struct _TMModifierMatchRec *TMModifierMatch;
+typedef struct _TMEventRec *TMEventPtr;
+
+typedef Boolean (*MatchProc)(TMTypeMatch typeMatch,
+			     TMModifierMatch modMatch,
+			     TMEventPtr eventSeq);
+
+typedef struct _ModToKeysymTable {
+    Modifiers mask;
+    int count;
+    int idx;
+} ModToKeysymTable;
+
+typedef struct _LateBindings {
+    unsigned int knot:1;
+    unsigned int pair:1;
+    unsigned short ref_count;	/* garbage collection */
+    KeySym keysym;
+} LateBindings, *LateBindingsPtr;
+
+typedef short ModifierMask;
+
+typedef struct _ActionsRec *ActionPtr;
+typedef struct _ActionsRec {
+    int idx;			/* index into quarkTable to find proc */
+    String *params;		/* pointer to array of params */
+    Cardinal num_params;	/* number of params */
+    ActionPtr next;		/* next action to perform */
+} ActionRec;
+
+typedef struct _XtStateRec *StatePtr;
+typedef struct _XtStateRec {
+    unsigned int	isCycleStart:1;
+    unsigned int	isCycleEnd:1;
+    TMShortCard		typeIndex;
+    TMShortCard		modIndex;
+    ActionPtr		actions;	/* rhs list of actions to perform */
+    StatePtr 		nextLevel;
+}StateRec;
+
+
+#define XtTableReplace	0
+#define XtTableAugment	1
+#define XtTableOverride	2
+#define XtTableUnmerge  3
+
+typedef unsigned int _XtTranslateOp;
+
+/*
+ * New Definitions
+ */
+typedef struct _TMModifierMatchRec{
+    TMLongCard	 modifiers;
+    TMLongCard	 modifierMask;
+    LateBindingsPtr lateModifiers;
+    Boolean	 standard;
+}TMModifierMatchRec;
+
+typedef struct _TMTypeMatchRec{
+    TMLongCard	 eventType;
+    TMLongCard	 eventCode;
+    TMLongCard	 eventCodeMask;
+    MatchProc	 matchEvent;
+}TMTypeMatchRec;
+
+typedef struct _TMBranchHeadRec {
+    unsigned int	isSimple:1;
+    unsigned int	hasActions:1;
+    unsigned int	hasCycles:1;
+    unsigned int	more:13;
+    TMShortCard		typeIndex;
+    TMShortCard		modIndex;
+}TMBranchHeadRec, *TMBranchHead;
+
+/* NOTE: elements of this structure must match those of
+ * TMComplexStateTreeRec and TMParseStateTreeRec.
+ */
+typedef struct _TMSimpleStateTreeRec{
+    unsigned int	isSimple:1;
+    unsigned int	isAccelerator:1;
+    unsigned int	mappingNotifyInterest:1;
+    unsigned int	refCount:13;
+    TMShortCard		numBranchHeads;
+    TMShortCard		numQuarks;   /* # of entries in quarkTbl */
+    TMShortCard		unused;	     /* to ensure same alignment */
+    TMBranchHeadRec	*branchHeadTbl;
+    XrmQuark		*quarkTbl;  /* table of quarkified rhs*/
+}TMSimpleStateTreeRec, *TMSimpleStateTree;
+
+/* NOTE: elements of this structure must match those of
+ * TMSimpleStateTreeRec and TMParseStateTreeRec.
+ */
+typedef struct _TMComplexStateTreeRec{
+    unsigned int	isSimple:1;
+    unsigned int	isAccelerator:1;
+    unsigned int	mappingNotifyInterest:1;
+    unsigned int	refCount:13;
+    TMShortCard		numBranchHeads;
+    TMShortCard		numQuarks;   /* # of entries in quarkTbl */
+    TMShortCard		numComplexBranchHeads;
+    TMBranchHeadRec	*branchHeadTbl;
+    XrmQuark		*quarkTbl;  /* table of quarkified rhs*/
+    StatePtr		*complexBranchHeadTbl;
+}TMComplexStateTreeRec, *TMComplexStateTree;
+
+/* NOTE: elements of this structure must match those of
+ * TMSimpleStateTreeRec and TMComplexStateTreeRec.
+ */
+typedef struct _TMParseStateTreeRec{
+    unsigned int	isSimple:1;
+    unsigned int	isAccelerator:1;
+    unsigned int	mappingNotifyInterest:1;
+    unsigned int	isStackQuarks:1;
+    unsigned int	isStackBranchHeads:1;
+    unsigned int	isStackComplexBranchHeads:1;
+    unsigned int	unused:10; /* to ensure correct alignment */
+    TMShortCard		numBranchHeads;
+    TMShortCard		numQuarks;   /* # of entries in quarkTbl */
+    TMShortCard		numComplexBranchHeads;
+    TMBranchHeadRec	*branchHeadTbl;
+    XrmQuark		*quarkTbl;  /* table of quarkified rhs*/
+    StatePtr		*complexBranchHeadTbl;
+    TMShortCard		branchHeadTblSize;
+    TMShortCard		quarkTblSize; /*total size of quarkTbl */
+    TMShortCard		complexBranchHeadTblSize;
+    StatePtr		head;
+}TMParseStateTreeRec, *TMParseStateTree;
+
+typedef union _TMStateTreeRec{
+    TMSimpleStateTreeRec	simple;
+    TMParseStateTreeRec		parse;
+    TMComplexStateTreeRec	complex;
+}*TMStateTree, **TMStateTreePtr, **TMStateTreeList;
+
+typedef struct _TMSimpleBindProcsRec {
+    XtActionProc	*procs;
+}TMSimpleBindProcsRec, *TMSimpleBindProcs;
+
+typedef struct _TMComplexBindProcsRec {
+    Widget	 	widget;		/*widgetID to pass to action Proc*/
+    XtTranslations	aXlations;
+    XtActionProc	*procs;
+}TMComplexBindProcsRec, *TMComplexBindProcs;
+
+typedef struct _TMSimpleBindDataRec {
+    unsigned int		isComplex:1;	/* must be first */
+    TMSimpleBindProcsRec	bindTbl[1];	/* variable length */
+}TMSimpleBindDataRec, *TMSimpleBindData;
+
+typedef struct _TMComplexBindDataRec {
+    unsigned int		isComplex:1;	/* must be first */
+    struct _ATranslationData	*accel_context;	/* for GetValues */
+    TMComplexBindProcsRec	bindTbl[1]; 	/* variable length */
+}TMComplexBindDataRec, *TMComplexBindData;
+
+typedef union _TMBindDataRec{
+    TMSimpleBindDataRec		simple;
+    TMComplexBindDataRec	complex;
+}*TMBindData;
+
+typedef struct _TranslationData{
+    unsigned char		hasBindings;	/* must be first */
+    unsigned char		operation; /*replace,augment,override*/
+    TMShortCard			numStateTrees;
+    struct _TranslationData    	*composers[2];
+    EventMask			eventMask;
+    TMStateTree			stateTreeTbl[1]; /* variable length */
+}TranslationData;
+
+/*
+ * ATranslations is returned by GetValues for translations that contain
+ * accelerators.  The TM can differentiate between this and TranslationData
+ * (that don't have a bindTbl) by looking at the first field (hasBindings)
+ * of either structure.  All ATranslationData structures associated with a
+ * widget are chained off the BindData record of the widget.
+ */
+typedef struct _ATranslationData{
+    unsigned char		hasBindings;	/* must be first */
+    unsigned char		operation;
+    struct _TranslationData	*xlations;  /* actual translations */
+    struct _ATranslationData	*next;      /* chain the contexts together */
+    TMComplexBindProcsRec	bindTbl[1]; /* accelerator bindings */
+}ATranslationData, *ATranslations;
+
+typedef struct _TMConvertRec {
+    XtTranslations	old; /* table to merge into */
+    XtTranslations	new; /* table to merge from */
+} TMConvertRec;
+
+#define _XtEventTimerEventType ((TMLongCard)~0L)
+#define KeysymModMask		(1L<<27) /* private to TM */
+#define AnyButtonMask		(1L<<28) /* private to TM */
+
+typedef struct _EventRec {
+    TMLongCard modifiers;
+    TMLongCard modifierMask;
+    LateBindingsPtr lateModifiers;
+    TMLongCard eventType;
+    TMLongCard eventCode;
+    TMLongCard eventCodeMask;
+    MatchProc matchEvent;
+    Boolean standard;
+} Event;
+
+typedef struct _EventSeqRec *EventSeqPtr;
+typedef struct _EventSeqRec {
+    Event event;	/* X event description */
+    StatePtr state;	/* private to state table builder */
+    EventSeqPtr next;	/* next event on line */
+    ActionPtr actions;	/* r.h.s.   list of actions to perform */
+} EventSeqRec;
+
+typedef EventSeqRec EventRec;
+typedef EventSeqPtr EventPtr;
+
+typedef struct _TMEventRec {
+    XEvent *xev;
+    Event event;
+}TMEventRec;
+
+typedef struct _ActionHookRec {
+    struct _ActionHookRec* next; /* must remain first */
+    XtAppContext app;
+    XtActionHookProc proc;
+    XtPointer closure;
+} ActionHookRec, *ActionHook;
+
+/* choose a number between 2 and 8 */
+#define TMKEYCACHELOG2 6
+#define TMKEYCACHESIZE (1<<TMKEYCACHELOG2)
+
+typedef struct _KeyCacheRec {
+    unsigned char modifiers_return[256]; /* constant per KeyCode, key proc */
+    KeyCode keycode[TMKEYCACHESIZE];
+    unsigned char modifiers[TMKEYCACHESIZE];
+    KeySym keysym[TMKEYCACHESIZE];
+} TMKeyCache;
+
+typedef struct _TMKeyContextRec {
+    XEvent *event;
+    unsigned long serial;
+    KeySym keysym;
+    Modifiers modifiers;
+    TMKeyCache keycache;  /* keep this last, to keep offsets to others small */
+} TMKeyContextRec, *TMKeyContext;
+
+typedef struct _TMGlobalRec{
+    TMTypeMatchRec 		**typeMatchSegmentTbl;
+    TMShortCard			numTypeMatches;
+    TMShortCard			numTypeMatchSegments;
+    TMShortCard			typeMatchSegmentTblSize;
+    TMModifierMatchRec 		**modMatchSegmentTbl;
+    TMShortCard			numModMatches;
+    TMShortCard			numModMatchSegments;
+    TMShortCard			modMatchSegmentTblSize;
+    Boolean			newMatchSemantics;
+#ifdef TRACE_TM
+    XtTranslations		*tmTbl;
+    TMShortCard			numTms;
+    TMShortCard			tmTblSize;
+    struct _TMBindCacheRec	**bindCacheTbl;
+    TMShortCard			numBindCache;
+    TMShortCard			bindCacheTblSize;
+    TMShortCard			numLateBindings;
+    TMShortCard			numBranchHeads;
+    TMShortCard			numComplexStates;
+    TMShortCard			numComplexActions;
+#endif /* TRACE_TM */
+}TMGlobalRec;
+
+_XFUNCPROTOBEGIN
+
+extern TMGlobalRec _XtGlobalTM;
+
+#define TM_MOD_SEGMENT_SIZE 	16
+#define TM_TYPE_SEGMENT_SIZE 	16
+
+#define TMGetTypeMatch(idx) \
+  ((TMTypeMatch) \
+   &((_XtGlobalTM.typeMatchSegmentTbl[((idx) >> 4)])[(idx) & 15]))
+#define TMGetModifierMatch(idx) \
+  ((TMModifierMatch) \
+   &((_XtGlobalTM.modMatchSegmentTbl[(idx) >> 4])[(idx) & 15]))
+
+/* Useful Access Macros */
+#define TMNewMatchSemantics() (_XtGlobalTM.newMatchSemantics)
+#define TMBranchMore(branch) (branch->more)
+#define TMComplexBranchHead(tree, br) \
+  (((TMComplexStateTree)tree)->complexBranchHeadTbl[TMBranchMore(br)])
+
+#define TMGetComplexBindEntry(bindData, idx) \
+  ((TMComplexBindProcs)&(((TMComplexBindData)bindData)->bindTbl[idx]))
+
+#define TMGetSimpleBindEntry(bindData, idx) \
+  ((TMSimpleBindProcs)&(((TMSimpleBindData)bindData)->bindTbl[idx]))
+
+
+#define _InitializeKeysymTables(dpy, pd) \
+    if (pd->keysyms == NULL) \
+        _XtBuildKeysymTables(dpy, pd)
+
+/*
+ * Internal Functions
+ */
+
+extern void _XtPopup(
+    Widget      /* widget */,
+    XtGrabKind  /* grab_kind */,
+    _XtBoolean	/* spring_loaded */
+);
+
+extern String _XtPrintXlations(
+    Widget		/* w */,
+    XtTranslations 	/* xlations */,
+    Widget		/* accelWidget */,
+    _XtBoolean		/* includeRHS */
+);
+
+extern void _XtRegisterGrabs(
+    Widget	/* widget */
+);
+
+extern XtPointer _XtInitializeActionData(
+    struct _XtActionsRec *	/* actions */,
+    Cardinal 			/* count */,
+    _XtBoolean			/* inPlace */
+);
+
+extern void _XtAddEventSeqToStateTree(
+    EventSeqPtr		/* eventSeq */,
+    TMParseStateTree	/* stateTree */
+);
+
+extern Boolean _XtMatchUsingStandardMods(
+    TMTypeMatch		/* typeMatch */,
+    TMModifierMatch	/* modMatch */,
+    TMEventPtr		/* eventSeq */
+);
+
+extern Boolean _XtMatchUsingDontCareMods(
+    TMTypeMatch		/* typeMatch */,
+    TMModifierMatch	/* modMatch */,
+    TMEventPtr		/* eventSeq */
+);
+
+extern Boolean _XtRegularMatch(
+    TMTypeMatch		/* typeMatch */,
+    TMModifierMatch	/* modMatch */,
+    TMEventPtr		/* eventSeq */
+);
+
+extern Boolean _XtMatchAtom(
+    TMTypeMatch		/* typeMatch */,
+    TMModifierMatch	/* modMatch */,
+    TMEventPtr		/* eventSeq */
+);
+
+extern void _XtTranslateEvent(
+    Widget		/* widget */,
+    XEvent*		/* event */
+);
+
+#include "CallbackI.h"
+#include "EventI.h"
+#include "HookObjI.h"
+#include "PassivGraI.h"
+#include "ThreadsI.h"
+#include "InitialI.h"
+#include "ResourceI.h"
+#include "StringDefs.h"
+
+extern void _XtBuildKeysymTables(Display *dpy, XtPerDisplay pd);
+
+#ifndef NO_MIT_HACKS
+extern void  _XtDisplayTranslations(
+    Widget		/* widget */,
+    XEvent*		/* event */,
+    String*		/* params */,
+    Cardinal*		/* num_params */
+);
+
+extern void  _XtDisplayAccelerators(
+    Widget		/* widget */,
+    XEvent*		/* event */,
+    String*		/* params */,
+    Cardinal*		/* num_params */
+);
+
+extern void _XtDisplayInstalledAccelerators(
+    Widget		/* widget */,
+    XEvent*		/* event */,
+    String*		/* params */,
+    Cardinal*		/* num_params */
+);
+#endif /* ifndef NO_MIT_HACKS */
+
+extern void _XtPopupInitialize(
+    XtAppContext	/* app_context */
+);
+
+extern void _XtBindActions(
+    Widget	/* widget */,
+    XtTM 	/* tm_rec */
+);
+
+extern Boolean _XtComputeLateBindings(
+    Display*		/* dpy */,
+    LateBindingsPtr	/* lateModifiers */,
+    Modifiers*		/* computed */,
+    Modifiers*		/* computedMask */
+);
+
+extern XtTranslations _XtCreateXlations(
+    TMStateTree *	/* stateTrees */,
+    TMShortCard		/* numStateTrees */,
+    XtTranslations 	/* first */,
+    XtTranslations	/* second */
+);
+
+extern Boolean _XtCvtMergeTranslations(
+    Display*	/* dpy */,
+    XrmValuePtr	/* args */,
+    Cardinal*	/* num_args */,
+    XrmValuePtr	/* from */,
+    XrmValuePtr	/* to */,
+    XtPointer*	/* closure_ret */
+);
+
+void _XtRemoveStateTreeByIndex(
+    XtTranslations	/* xlations */,
+    TMShortCard	/* i */);
+
+void _XtFreeTranslations(
+    XtAppContext	/* app */,
+    XrmValuePtr		/* toVal */,
+    XtPointer		/* closure */,
+    XrmValuePtr		/* args */,
+    Cardinal*		/* num_args */
+);
+
+extern TMShortCard _XtGetModifierIndex(
+    Event*	/* event */
+);
+
+extern TMShortCard _XtGetQuarkIndex(
+    TMParseStateTree	/* stateTreePtr */,
+    XrmQuark		/* quark */
+);
+
+extern XtTranslations _XtGetTranslationValue(
+    Widget		/* widget */
+);
+
+extern TMShortCard _XtGetTypeIndex(
+    Event*	/* event */
+);
+
+extern void _XtGrabInitialize(
+    XtAppContext	/* app */
+);
+
+extern void _XtInstallTranslations(
+    Widget		/* widget */
+);
+
+extern void _XtRemoveTranslations(
+    Widget		/* widget */
+);
+
+extern void _XtDestroyTMData(
+    Widget		/* widget */
+);
+
+extern void _XtMergeTranslations(
+    Widget		/* widget */,
+    XtTranslations	/* newXlations */,
+    _XtTranslateOp	/* operation */
+);
+
+extern void _XtActionInitialize(
+    XtAppContext	/* app */
+);
+
+extern TMStateTree _XtParseTreeToStateTree(
+    TMParseStateTree 	/* parseTree */
+);
+
+extern String _XtPrintActions(
+    ActionRec*	/* actions */,
+    XrmQuark*	/* quarkTbl */
+);
+
+extern String _XtPrintState(
+    TMStateTree	/* stateTree */,
+    TMBranchHead /* branchHead */);
+
+extern String _XtPrintEventSeq(
+    EventSeqPtr	/* eventSeq */,
+    Display*	/* dpy */
+);
+
+typedef Boolean (*_XtTraversalProc)(
+    StatePtr	/* state */,
+    XtPointer	/* data */
+);
+
+extern void _XtTraverseStateTree(
+    TMStateTree		/* tree */,
+    _XtTraversalProc	/* func */,
+    XtPointer		/* data */
+);
+
+extern void _XtTranslateInitialize(
+    void
+);
+
+extern void _XtAddTMConverters(
+    ConverterTable	/* table */
+);
+
+extern void _XtUnbindActions(
+    Widget		/* widget */,
+    XtTranslations	/* xlations */,
+    TMBindData		/* bindData */
+);
+
+extern void _XtUnmergeTranslations(
+    Widget		/* widget */,
+    XtTranslations 	/* xlations */
+);
+
+/* TMKey.c */
+extern void _XtAllocTMContext(XtPerDisplay pd);
+
+_XFUNCPROTOEND
diff --git a/ThirdParty/X11/Include/X11/VarargsI.h b/ThirdParty/X11/Include/X11/VarargsI.h
new file mode 100644
index 0000000000000000000000000000000000000000..790a27135b212f0729796a1c5a29a2f231034db0
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/VarargsI.h
@@ -0,0 +1,66 @@
+/*
+
+Copyright 1985, 1986, 1987, 1988, 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _VarargsI_h_
+#define _VarargsI_h_
+
+#include <stdarg.h>
+
+/* private routines */
+
+_XFUNCPROTOBEGIN
+
+extern void _XtCountVaList(
+    va_list /*var*/, int* /*total_count*/, int* /*typed_count*/
+);
+
+extern void _XtVaToArgList(
+   Widget /*widget*/, va_list /*var*/, int /*max_count*/, ArgList* /*args_return*/, Cardinal* /*num_args_return*/
+);
+
+extern void _XtVaToTypedArgList(
+    va_list /*var*/, int /*count*/, XtTypedArgList* /*args_return*/, Cardinal* /*num_args_return*/
+);
+
+extern XtTypedArgList _XtVaCreateTypedArgList(
+    va_list /*var*/, int /*count*/
+);
+
+extern void _XtFreeArgList(
+    ArgList /*args*/, int /*total_count*/, int /*typed_count*/
+);
+
+extern void _XtGetApplicationResources(
+    Widget /*w*/, XtPointer /*base*/, XtResourceList /*resources*/, Cardinal /*num_resources*/, ArgList /*args*/, Cardinal /*num_args*/, XtTypedArgList /*typed_args*/, Cardinal /*num_typed_args*/
+);
+
+extern void _XtGetSubresources(
+    Widget /*w*/, XtPointer /*base*/, const char* /*name*/, const char* /*class*/, XtResourceList /*resources*/, Cardinal /*num_resources*/, ArgList /*args*/, Cardinal /*num_args*/, XtTypedArgList /*typed_args*/, Cardinal /*num_typed_args*/
+);
+
+_XFUNCPROTOEND
+
+#endif /* _VarargsI_h_ */
diff --git a/ThirdParty/X11/Include/X11/Vendor.h b/ThirdParty/X11/Include/X11/Vendor.h
new file mode 100644
index 0000000000000000000000000000000000000000..6d783c64554efe7653d3e76f69664a6a3eeda2fa
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Vendor.h
@@ -0,0 +1,70 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XtVendor_h
+#define _XtVendor_h
+
+#include <X11/Intrinsic.h>
+
+/***********************************************************************
+ *
+ * VendorShell Widget
+ *
+ ***********************************************************************/
+
+/* Class record constants */
+
+typedef struct _VendorShellClassRec *VendorShellWidgetClass;
+
+_XFUNCPROTOBEGIN
+
+externalref WidgetClass vendorShellWidgetClass;
+
+_XFUNCPROTOEND
+
+#endif /* _XtVendor_h */
+/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/ThirdParty/X11/Include/X11/VendorP.h b/ThirdParty/X11/Include/X11/VendorP.h
new file mode 100644
index 0000000000000000000000000000000000000000..4eb94041c415c095e9d1b53592b3bfb947c1b8b2
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/VendorP.h
@@ -0,0 +1,102 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ * VendorP.h - Private definitions for VendorShell widget
+ *
+ * Author:	Paul Asente
+ * 		Digital Equipment Corporation
+ * 		Western Software Laboratory
+ * Date:	Thu Dec 3, 1987
+ */
+
+/***********************************************************************
+ *
+ * VendorShell Widget Private Data
+ *
+ ***********************************************************************/
+
+#ifndef  _XtVendorPrivate_h
+#define _XtVendorPrivate_h
+
+#include <X11/Vendor.h>
+
+/* New fields for the VendorShell widget class record */
+
+_XFUNCPROTOBEGIN
+
+typedef struct {
+    XtPointer       extension;          /* pointer to extension record      */
+} VendorShellClassPart;
+
+typedef struct _VendorShellClassRec {
+  	CoreClassPart      core_class;
+	CompositeClassPart composite_class;
+	ShellClassPart  shell_class;
+	WMShellClassPart   wm_shell_class;
+	VendorShellClassPart vendor_shell_class;
+} VendorShellClassRec;
+
+externalref VendorShellClassRec vendorShellClassRec;
+
+/* New fields for the vendor shell widget. */
+
+typedef struct {
+	int		vendor_specific;
+} VendorShellPart;
+
+typedef  struct {
+	CorePart 	core;
+	CompositePart 	composite;
+	ShellPart 	shell;
+	WMShellPart	wm;
+	VendorShellPart	vendor;
+} VendorShellRec, *VendorShellWidget;
+
+_XFUNCPROTOEND
+
+#endif  /* _XtVendorPrivate_h */
diff --git a/ThirdParty/X11/Include/X11/X.h b/ThirdParty/X11/Include/X11/X.h
new file mode 100644
index 0000000000000000000000000000000000000000..5cf695d7b778ebfe96290b6e6125a9c2c14943ed
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/X.h
@@ -0,0 +1,717 @@
+/* Definitions for the X window system likely to be used by applications */
+
+#ifndef X_H
+#define X_H
+
+/***********************************************************
+
+Copyright 1987, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#define X_PROTOCOL	11		/* current protocol version */
+#define X_PROTOCOL_REVISION 0		/* current minor version */
+
+/* Resources */
+
+/*
+ * _XSERVER64 must ONLY be defined when compiling X server sources on
+ * systems where unsigned long is not 32 bits, must NOT be used in
+ * client or library code.
+ */
+#ifndef _XSERVER64
+#  ifndef _XTYPEDEF_XID
+#    define _XTYPEDEF_XID
+typedef unsigned long XID;
+#  endif
+#  ifndef _XTYPEDEF_MASK
+#    define _XTYPEDEF_MASK
+typedef unsigned long Mask;
+#  endif
+#  ifndef _XTYPEDEF_ATOM
+#    define _XTYPEDEF_ATOM
+typedef unsigned long Atom;		/* Also in Xdefs.h */
+#  endif
+typedef unsigned long VisualID;
+typedef unsigned long Time;
+#else
+#  include <X11/Xmd.h>
+#  ifndef _XTYPEDEF_XID
+#    define _XTYPEDEF_XID
+typedef CARD32 XID;
+#  endif
+#  ifndef _XTYPEDEF_MASK
+#    define _XTYPEDEF_MASK
+typedef CARD32 Mask;
+#  endif
+#  ifndef _XTYPEDEF_ATOM
+#    define _XTYPEDEF_ATOM
+typedef CARD32 Atom;
+#  endif
+typedef CARD32 VisualID;
+typedef CARD32 Time;
+#endif
+
+typedef XID Window;
+typedef XID Drawable;
+#ifndef _XTYPEDEF_FONT
+#  define _XTYPEDEF_FONT
+typedef XID Font;
+#endif
+typedef XID Pixmap;
+typedef XID Cursor;
+typedef XID Colormap;
+typedef XID GContext;
+typedef XID KeySym;
+
+typedef unsigned char KeyCode;
+
+/*****************************************************************
+ * RESERVED RESOURCE AND CONSTANT DEFINITIONS
+ *****************************************************************/
+
+#ifndef None
+#define None                 0L	/* universal null resource or null atom */
+#endif
+
+#define ParentRelative       1L	/* background pixmap in CreateWindow
+				    and ChangeWindowAttributes */
+
+#define CopyFromParent       0L	/* border pixmap in CreateWindow
+				       and ChangeWindowAttributes
+				   special VisualID and special window
+				       class passed to CreateWindow */
+
+#define PointerWindow        0L	/* destination window in SendEvent */
+#define InputFocus           1L	/* destination window in SendEvent */
+
+#define PointerRoot          1L	/* focus window in SetInputFocus */
+
+#define AnyPropertyType      0L	/* special Atom, passed to GetProperty */
+
+#define AnyKey		     0L	/* special Key Code, passed to GrabKey */
+
+#define AnyButton            0L	/* special Button Code, passed to GrabButton */
+
+#define AllTemporary         0L	/* special Resource ID passed to KillClient */
+
+#define CurrentTime          0L	/* special Time */
+
+#define NoSymbol	     0L	/* special KeySym */
+
+/***************************************************************** 
+ * EVENT DEFINITIONS 
+ *****************************************************************/
+
+/* Input Event Masks. Used as event-mask window attribute and as arguments
+   to Grab requests.  Not to be confused with event names.  */
+
+#define NoEventMask			0L
+#define KeyPressMask			(1L<<0)  
+#define KeyReleaseMask			(1L<<1)  
+#define ButtonPressMask			(1L<<2)  
+#define ButtonReleaseMask		(1L<<3)  
+#define EnterWindowMask			(1L<<4)  
+#define LeaveWindowMask			(1L<<5)  
+#define PointerMotionMask		(1L<<6)  
+#define PointerMotionHintMask		(1L<<7)  
+#define Button1MotionMask		(1L<<8)  
+#define Button2MotionMask		(1L<<9)  
+#define Button3MotionMask		(1L<<10) 
+#define Button4MotionMask		(1L<<11) 
+#define Button5MotionMask		(1L<<12) 
+#define ButtonMotionMask		(1L<<13) 
+#define KeymapStateMask			(1L<<14)
+#define ExposureMask			(1L<<15) 
+#define VisibilityChangeMask		(1L<<16) 
+#define StructureNotifyMask		(1L<<17) 
+#define ResizeRedirectMask		(1L<<18) 
+#define SubstructureNotifyMask		(1L<<19) 
+#define SubstructureRedirectMask	(1L<<20) 
+#define FocusChangeMask			(1L<<21) 
+#define PropertyChangeMask		(1L<<22) 
+#define ColormapChangeMask		(1L<<23) 
+#define OwnerGrabButtonMask		(1L<<24) 
+
+/* Event names.  Used in "type" field in XEvent structures.  Not to be
+confused with event masks above.  They start from 2 because 0 and 1
+are reserved in the protocol for errors and replies. */
+
+#define KeyPress		2
+#define KeyRelease		3
+#define ButtonPress		4
+#define ButtonRelease		5
+#define MotionNotify		6
+#define EnterNotify		7
+#define LeaveNotify		8
+#define FocusIn			9
+#define FocusOut		10
+#define KeymapNotify		11
+#define Expose			12
+#define GraphicsExpose		13
+#define NoExpose		14
+#define VisibilityNotify	15
+#define CreateNotify		16
+#define DestroyNotify		17
+#define UnmapNotify		18
+#define MapNotify		19
+#define MapRequest		20
+#define ReparentNotify		21
+#define ConfigureNotify		22
+#define ConfigureRequest	23
+#define GravityNotify		24
+#define ResizeRequest		25
+#define CirculateNotify		26
+#define CirculateRequest	27
+#define PropertyNotify		28
+#define SelectionClear		29
+#define SelectionRequest	30
+#define SelectionNotify		31
+#define ColormapNotify		32
+#define ClientMessage		33
+#define MappingNotify		34
+#define GenericEvent		35
+#define LASTEvent		36	/* must be bigger than any event # */
+
+
+/* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer,
+   state in various key-, mouse-, and button-related events. */
+
+#define ShiftMask		(1<<0)
+#define LockMask		(1<<1)
+#define ControlMask		(1<<2)
+#define Mod1Mask		(1<<3)
+#define Mod2Mask		(1<<4)
+#define Mod3Mask		(1<<5)
+#define Mod4Mask		(1<<6)
+#define Mod5Mask		(1<<7)
+
+/* modifier names.  Used to build a SetModifierMapping request or
+   to read a GetModifierMapping request.  These correspond to the
+   masks defined above. */
+#define ShiftMapIndex		0
+#define LockMapIndex		1
+#define ControlMapIndex		2
+#define Mod1MapIndex		3
+#define Mod2MapIndex		4
+#define Mod3MapIndex		5
+#define Mod4MapIndex		6
+#define Mod5MapIndex		7
+
+
+/* button masks.  Used in same manner as Key masks above. Not to be confused
+   with button names below. */
+
+#define Button1Mask		(1<<8)
+#define Button2Mask		(1<<9)
+#define Button3Mask		(1<<10)
+#define Button4Mask		(1<<11)
+#define Button5Mask		(1<<12)
+
+#define AnyModifier		(1<<15)  /* used in GrabButton, GrabKey */
+
+
+/* button names. Used as arguments to GrabButton and as detail in ButtonPress
+   and ButtonRelease events.  Not to be confused with button masks above.
+   Note that 0 is already defined above as "AnyButton".  */
+
+#define Button1			1
+#define Button2			2
+#define Button3			3
+#define Button4			4
+#define Button5			5
+
+/* Notify modes */
+
+#define NotifyNormal		0
+#define NotifyGrab		1
+#define NotifyUngrab		2
+#define NotifyWhileGrabbed	3
+
+#define NotifyHint		1	/* for MotionNotify events */
+		       
+/* Notify detail */
+
+#define NotifyAncestor		0
+#define NotifyVirtual		1
+#define NotifyInferior		2
+#define NotifyNonlinear		3
+#define NotifyNonlinearVirtual	4
+#define NotifyPointer		5
+#define NotifyPointerRoot	6
+#define NotifyDetailNone	7
+
+/* Visibility notify */
+
+#define VisibilityUnobscured		0
+#define VisibilityPartiallyObscured	1
+#define VisibilityFullyObscured		2
+
+/* Circulation request */
+
+#define PlaceOnTop		0
+#define PlaceOnBottom		1
+
+/* protocol families */
+
+#define FamilyInternet		0	/* IPv4 */
+#define FamilyDECnet		1
+#define FamilyChaos		2
+#define FamilyInternet6		6	/* IPv6 */
+
+/* authentication families not tied to a specific protocol */
+#define FamilyServerInterpreted 5
+
+/* Property notification */
+
+#define PropertyNewValue	0
+#define PropertyDelete		1
+
+/* Color Map notification */
+
+#define ColormapUninstalled	0
+#define ColormapInstalled	1
+
+/* GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes */
+
+#define GrabModeSync		0
+#define GrabModeAsync		1
+
+/* GrabPointer, GrabKeyboard reply status */
+
+#define GrabSuccess		0
+#define AlreadyGrabbed		1
+#define GrabInvalidTime		2
+#define GrabNotViewable		3
+#define GrabFrozen		4
+
+/* AllowEvents modes */
+
+#define AsyncPointer		0
+#define SyncPointer		1
+#define ReplayPointer		2
+#define AsyncKeyboard		3
+#define SyncKeyboard		4
+#define ReplayKeyboard		5
+#define AsyncBoth		6
+#define SyncBoth		7
+
+/* Used in SetInputFocus, GetInputFocus */
+
+#define RevertToNone		(int)None
+#define RevertToPointerRoot	(int)PointerRoot
+#define RevertToParent		2
+
+/*****************************************************************
+ * ERROR CODES 
+ *****************************************************************/
+
+#define Success		   0	/* everything's okay */
+#define BadRequest	   1	/* bad request code */
+#define BadValue	   2	/* int parameter out of range */
+#define BadWindow	   3	/* parameter not a Window */
+#define BadPixmap	   4	/* parameter not a Pixmap */
+#define BadAtom		   5	/* parameter not an Atom */
+#define BadCursor	   6	/* parameter not a Cursor */
+#define BadFont		   7	/* parameter not a Font */
+#define BadMatch	   8	/* parameter mismatch */
+#define BadDrawable	   9	/* parameter not a Pixmap or Window */
+#define BadAccess	  10	/* depending on context:
+				 - key/button already grabbed
+				 - attempt to free an illegal 
+				   cmap entry 
+				- attempt to store into a read-only 
+				   color map entry.
+ 				- attempt to modify the access control
+				   list from other than the local host.
+				*/
+#define BadAlloc	  11	/* insufficient resources */
+#define BadColor	  12	/* no such colormap */
+#define BadGC		  13	/* parameter not a GC */
+#define BadIDChoice	  14	/* choice not in range or already used */
+#define BadName		  15	/* font or color name doesn't exist */
+#define BadLength	  16	/* Request length incorrect */
+#define BadImplementation 17	/* server is defective */
+
+#define FirstExtensionError	128
+#define LastExtensionError	255
+
+/*****************************************************************
+ * WINDOW DEFINITIONS 
+ *****************************************************************/
+
+/* Window classes used by CreateWindow */
+/* Note that CopyFromParent is already defined as 0 above */
+
+#define InputOutput		1
+#define InputOnly		2
+
+/* Window attributes for CreateWindow and ChangeWindowAttributes */
+
+#define CWBackPixmap		(1L<<0)
+#define CWBackPixel		(1L<<1)
+#define CWBorderPixmap		(1L<<2)
+#define CWBorderPixel           (1L<<3)
+#define CWBitGravity		(1L<<4)
+#define CWWinGravity		(1L<<5)
+#define CWBackingStore          (1L<<6)
+#define CWBackingPlanes	        (1L<<7)
+#define CWBackingPixel	        (1L<<8)
+#define CWOverrideRedirect	(1L<<9)
+#define CWSaveUnder		(1L<<10)
+#define CWEventMask		(1L<<11)
+#define CWDontPropagate	        (1L<<12)
+#define CWColormap		(1L<<13)
+#define CWCursor	        (1L<<14)
+
+/* ConfigureWindow structure */
+
+#define CWX			(1<<0)
+#define CWY			(1<<1)
+#define CWWidth			(1<<2)
+#define CWHeight		(1<<3)
+#define CWBorderWidth		(1<<4)
+#define CWSibling		(1<<5)
+#define CWStackMode		(1<<6)
+
+
+/* Bit Gravity */
+
+#define ForgetGravity		0
+#define NorthWestGravity	1
+#define NorthGravity		2
+#define NorthEastGravity	3
+#define WestGravity		4
+#define CenterGravity		5
+#define EastGravity		6
+#define SouthWestGravity	7
+#define SouthGravity		8
+#define SouthEastGravity	9
+#define StaticGravity		10
+
+/* Window gravity + bit gravity above */
+
+#define UnmapGravity		0
+
+/* Used in CreateWindow for backing-store hint */
+
+#define NotUseful               0
+#define WhenMapped              1
+#define Always                  2
+
+/* Used in GetWindowAttributes reply */
+
+#define IsUnmapped		0
+#define IsUnviewable		1
+#define IsViewable		2
+
+/* Used in ChangeSaveSet */
+
+#define SetModeInsert           0
+#define SetModeDelete           1
+
+/* Used in ChangeCloseDownMode */
+
+#define DestroyAll              0
+#define RetainPermanent         1
+#define RetainTemporary         2
+
+/* Window stacking method (in configureWindow) */
+
+#define Above                   0
+#define Below                   1
+#define TopIf                   2
+#define BottomIf                3
+#define Opposite                4
+
+/* Circulation direction */
+
+#define RaiseLowest             0
+#define LowerHighest            1
+
+/* Property modes */
+
+#define PropModeReplace         0
+#define PropModePrepend         1
+#define PropModeAppend          2
+
+/*****************************************************************
+ * GRAPHICS DEFINITIONS
+ *****************************************************************/
+
+/* graphics functions, as in GC.alu */
+
+#define	GXclear			0x0		/* 0 */
+#define GXand			0x1		/* src AND dst */
+#define GXandReverse		0x2		/* src AND NOT dst */
+#define GXcopy			0x3		/* src */
+#define GXandInverted		0x4		/* NOT src AND dst */
+#define	GXnoop			0x5		/* dst */
+#define GXxor			0x6		/* src XOR dst */
+#define GXor			0x7		/* src OR dst */
+#define GXnor			0x8		/* NOT src AND NOT dst */
+#define GXequiv			0x9		/* NOT src XOR dst */
+#define GXinvert		0xa		/* NOT dst */
+#define GXorReverse		0xb		/* src OR NOT dst */
+#define GXcopyInverted		0xc		/* NOT src */
+#define GXorInverted		0xd		/* NOT src OR dst */
+#define GXnand			0xe		/* NOT src OR NOT dst */
+#define GXset			0xf		/* 1 */
+
+/* LineStyle */
+
+#define LineSolid		0
+#define LineOnOffDash		1
+#define LineDoubleDash		2
+
+/* capStyle */
+
+#define CapNotLast		0
+#define CapButt			1
+#define CapRound		2
+#define CapProjecting		3
+
+/* joinStyle */
+
+#define JoinMiter		0
+#define JoinRound		1
+#define JoinBevel		2
+
+/* fillStyle */
+
+#define FillSolid		0
+#define FillTiled		1
+#define FillStippled		2
+#define FillOpaqueStippled	3
+
+/* fillRule */
+
+#define EvenOddRule		0
+#define WindingRule		1
+
+/* subwindow mode */
+
+#define ClipByChildren		0
+#define IncludeInferiors	1
+
+/* SetClipRectangles ordering */
+
+#define Unsorted		0
+#define YSorted			1
+#define YXSorted		2
+#define YXBanded		3
+
+/* CoordinateMode for drawing routines */
+
+#define CoordModeOrigin		0	/* relative to the origin */
+#define CoordModePrevious       1	/* relative to previous point */
+
+/* Polygon shapes */
+
+#define Complex			0	/* paths may intersect */
+#define Nonconvex		1	/* no paths intersect, but not convex */
+#define Convex			2	/* wholly convex */
+
+/* Arc modes for PolyFillArc */
+
+#define ArcChord		0	/* join endpoints of arc */
+#define ArcPieSlice		1	/* join endpoints to center of arc */
+
+/* GC components: masks used in CreateGC, CopyGC, ChangeGC, OR'ed into
+   GC.stateChanges */
+
+#define GCFunction              (1L<<0)
+#define GCPlaneMask             (1L<<1)
+#define GCForeground            (1L<<2)
+#define GCBackground            (1L<<3)
+#define GCLineWidth             (1L<<4)
+#define GCLineStyle             (1L<<5)
+#define GCCapStyle              (1L<<6)
+#define GCJoinStyle		(1L<<7)
+#define GCFillStyle		(1L<<8)
+#define GCFillRule		(1L<<9) 
+#define GCTile			(1L<<10)
+#define GCStipple		(1L<<11)
+#define GCTileStipXOrigin	(1L<<12)
+#define GCTileStipYOrigin	(1L<<13)
+#define GCFont 			(1L<<14)
+#define GCSubwindowMode		(1L<<15)
+#define GCGraphicsExposures     (1L<<16)
+#define GCClipXOrigin		(1L<<17)
+#define GCClipYOrigin		(1L<<18)
+#define GCClipMask		(1L<<19)
+#define GCDashOffset		(1L<<20)
+#define GCDashList		(1L<<21)
+#define GCArcMode		(1L<<22)
+
+#define GCLastBit		22
+/*****************************************************************
+ * FONTS 
+ *****************************************************************/
+
+/* used in QueryFont -- draw direction */
+
+#define FontLeftToRight		0
+#define FontRightToLeft		1
+
+#define FontChange		255
+
+/*****************************************************************
+ *  IMAGING 
+ *****************************************************************/
+
+/* ImageFormat -- PutImage, GetImage */
+
+#define XYBitmap		0	/* depth 1, XYFormat */
+#define XYPixmap		1	/* depth == drawable depth */
+#define ZPixmap			2	/* depth == drawable depth */
+
+/*****************************************************************
+ *  COLOR MAP STUFF 
+ *****************************************************************/
+
+/* For CreateColormap */
+
+#define AllocNone		0	/* create map with no entries */
+#define AllocAll		1	/* allocate entire map writeable */
+
+
+/* Flags used in StoreNamedColor, StoreColors */
+
+#define DoRed			(1<<0)
+#define DoGreen			(1<<1)
+#define DoBlue			(1<<2)
+
+/*****************************************************************
+ * CURSOR STUFF
+ *****************************************************************/
+
+/* QueryBestSize Class */
+
+#define CursorShape		0	/* largest size that can be displayed */
+#define TileShape		1	/* size tiled fastest */
+#define StippleShape		2	/* size stippled fastest */
+
+/***************************************************************** 
+ * KEYBOARD/POINTER STUFF
+ *****************************************************************/
+
+#define AutoRepeatModeOff	0
+#define AutoRepeatModeOn	1
+#define AutoRepeatModeDefault	2
+
+#define LedModeOff		0
+#define LedModeOn		1
+
+/* masks for ChangeKeyboardControl */
+
+#define KBKeyClickPercent	(1L<<0)
+#define KBBellPercent		(1L<<1)
+#define KBBellPitch		(1L<<2)
+#define KBBellDuration		(1L<<3)
+#define KBLed			(1L<<4)
+#define KBLedMode		(1L<<5)
+#define KBKey			(1L<<6)
+#define KBAutoRepeatMode	(1L<<7)
+
+#define MappingSuccess     	0
+#define MappingBusy        	1
+#define MappingFailed		2
+
+#define MappingModifier		0
+#define MappingKeyboard		1
+#define MappingPointer		2
+
+/*****************************************************************
+ * SCREEN SAVER STUFF 
+ *****************************************************************/
+
+#define DontPreferBlanking	0
+#define PreferBlanking		1
+#define DefaultBlanking		2
+
+#define DisableScreenSaver	0
+#define DisableScreenInterval	0
+
+#define DontAllowExposures	0
+#define AllowExposures		1
+#define DefaultExposures	2
+
+/* for ForceScreenSaver */
+
+#define ScreenSaverReset 0
+#define ScreenSaverActive 1
+
+/*****************************************************************
+ * HOSTS AND CONNECTIONS
+ *****************************************************************/
+
+/* for ChangeHosts */
+
+#define HostInsert		0
+#define HostDelete		1
+
+/* for ChangeAccessControl */
+
+#define EnableAccess		1      
+#define DisableAccess		0
+
+/* Display classes  used in opening the connection 
+ * Note that the statically allocated ones are even numbered and the
+ * dynamically changeable ones are odd numbered */
+
+#define StaticGray		0
+#define GrayScale		1
+#define StaticColor		2
+#define PseudoColor		3
+#define TrueColor		4
+#define DirectColor		5
+
+
+/* Byte order  used in imageByteOrder and bitmapBitOrder */
+
+#define LSBFirst		0
+#define MSBFirst		1
+
+#endif /* X_H */
diff --git a/ThirdParty/X11/Include/X11/XF86keysym.h b/ThirdParty/X11/Include/X11/XF86keysym.h
new file mode 100644
index 0000000000000000000000000000000000000000..8b5646ea1710e70f3969f73f58208ffae48d7426
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/XF86keysym.h
@@ -0,0 +1,220 @@
+/*
+ * XFree86 vendor specific keysyms.
+ *
+ * The XFree86 keysym range is 0x10080001 - 0x1008FFFF.
+ *
+ * X.Org will not be adding to the XF86 set of keysyms, though they have
+ * been adopted and are considered a "standard" part of X keysym definitions.
+ * XFree86 never properly commented these keysyms, so we have done our
+ * best to explain the semantic meaning of these keys.
+ *
+ * XFree86 has removed their mail archives of the period, that might have
+ * shed more light on some of these definitions. Until/unless we resurrect
+ * these archives, these are from memory and usage.
+ */
+
+/*
+ * ModeLock
+ *
+ * This one is old, and not really used any more since XKB offers this
+ * functionality.
+ */
+
+#define XF86XK_ModeLock		0x1008FF01	/* Mode Switch Lock */
+
+/* Backlight controls. */
+#define XF86XK_MonBrightnessUp   0x1008FF02  /* Monitor/panel brightness */
+#define XF86XK_MonBrightnessDown 0x1008FF03  /* Monitor/panel brightness */
+#define XF86XK_KbdLightOnOff     0x1008FF04  /* Keyboards may be lit     */
+#define XF86XK_KbdBrightnessUp   0x1008FF05  /* Keyboards may be lit     */
+#define XF86XK_KbdBrightnessDown 0x1008FF06  /* Keyboards may be lit     */
+
+/*
+ * Keys found on some "Internet" keyboards.
+ */
+#define XF86XK_Standby		0x1008FF10   /* System into standby mode   */
+#define XF86XK_AudioLowerVolume	0x1008FF11   /* Volume control down        */
+#define XF86XK_AudioMute	0x1008FF12   /* Mute sound from the system */
+#define XF86XK_AudioRaiseVolume	0x1008FF13   /* Volume control up          */
+#define XF86XK_AudioPlay	0x1008FF14   /* Start playing of audio >   */
+#define XF86XK_AudioStop	0x1008FF15   /* Stop playing audio         */
+#define XF86XK_AudioPrev	0x1008FF16   /* Previous track             */
+#define XF86XK_AudioNext	0x1008FF17   /* Next track                 */
+#define XF86XK_HomePage		0x1008FF18   /* Display user's home page   */
+#define XF86XK_Mail		0x1008FF19   /* Invoke user's mail program */
+#define XF86XK_Start		0x1008FF1A   /* Start application          */
+#define XF86XK_Search		0x1008FF1B   /* Search                     */
+#define XF86XK_AudioRecord	0x1008FF1C   /* Record audio application   */
+
+/* These are sometimes found on PDA's (e.g. Palm, PocketPC or elsewhere)   */
+#define XF86XK_Calculator	0x1008FF1D   /* Invoke calculator program  */
+#define XF86XK_Memo		0x1008FF1E   /* Invoke Memo taking program */
+#define XF86XK_ToDoList		0x1008FF1F   /* Invoke To Do List program  */
+#define XF86XK_Calendar		0x1008FF20   /* Invoke Calendar program    */
+#define XF86XK_PowerDown	0x1008FF21   /* Deep sleep the system      */
+#define XF86XK_ContrastAdjust	0x1008FF22   /* Adjust screen contrast     */
+#define XF86XK_RockerUp		0x1008FF23   /* Rocker switches exist up   */
+#define XF86XK_RockerDown	0x1008FF24   /* and down                   */
+#define XF86XK_RockerEnter	0x1008FF25   /* and let you press them     */
+
+/* Some more "Internet" keyboard symbols */
+#define XF86XK_Back		0x1008FF26   /* Like back on a browser     */
+#define XF86XK_Forward		0x1008FF27   /* Like forward on a browser  */
+#define XF86XK_Stop		0x1008FF28   /* Stop current operation     */
+#define XF86XK_Refresh		0x1008FF29   /* Refresh the page           */
+#define XF86XK_PowerOff		0x1008FF2A   /* Power off system entirely  */
+#define XF86XK_WakeUp		0x1008FF2B   /* Wake up system from sleep  */
+#define XF86XK_Eject            0x1008FF2C   /* Eject device (e.g. DVD)    */
+#define XF86XK_ScreenSaver      0x1008FF2D   /* Invoke screensaver         */
+#define XF86XK_WWW              0x1008FF2E   /* Invoke web browser         */
+#define XF86XK_Sleep            0x1008FF2F   /* Put system to sleep        */
+#define XF86XK_Favorites	0x1008FF30   /* Show favorite locations    */
+#define XF86XK_AudioPause	0x1008FF31   /* Pause audio playing        */
+#define XF86XK_AudioMedia	0x1008FF32   /* Launch media collection app */
+#define XF86XK_MyComputer	0x1008FF33   /* Display "My Computer" window */
+#define XF86XK_VendorHome	0x1008FF34   /* Display vendor home web site */
+#define XF86XK_LightBulb	0x1008FF35   /* Light bulb keys exist       */
+#define XF86XK_Shop		0x1008FF36   /* Display shopping web site   */
+#define XF86XK_History		0x1008FF37   /* Show history of web surfing */
+#define XF86XK_OpenURL		0x1008FF38   /* Open selected URL           */
+#define XF86XK_AddFavorite	0x1008FF39   /* Add URL to favorites list   */
+#define XF86XK_HotLinks		0x1008FF3A   /* Show "hot" links            */
+#define XF86XK_BrightnessAdjust	0x1008FF3B   /* Invoke brightness adj. UI   */
+#define XF86XK_Finance		0x1008FF3C   /* Display financial site      */
+#define XF86XK_Community	0x1008FF3D   /* Display user's community    */
+#define XF86XK_AudioRewind	0x1008FF3E   /* "rewind" audio track        */
+#define XF86XK_BackForward	0x1008FF3F   /* ??? */
+#define XF86XK_Launch0		0x1008FF40   /* Launch Application          */
+#define XF86XK_Launch1		0x1008FF41   /* Launch Application          */
+#define XF86XK_Launch2		0x1008FF42   /* Launch Application          */
+#define XF86XK_Launch3		0x1008FF43   /* Launch Application          */
+#define XF86XK_Launch4		0x1008FF44   /* Launch Application          */
+#define XF86XK_Launch5		0x1008FF45   /* Launch Application          */
+#define XF86XK_Launch6		0x1008FF46   /* Launch Application          */
+#define XF86XK_Launch7		0x1008FF47   /* Launch Application          */
+#define XF86XK_Launch8		0x1008FF48   /* Launch Application          */
+#define XF86XK_Launch9		0x1008FF49   /* Launch Application          */
+#define XF86XK_LaunchA		0x1008FF4A   /* Launch Application          */
+#define XF86XK_LaunchB		0x1008FF4B   /* Launch Application          */
+#define XF86XK_LaunchC		0x1008FF4C   /* Launch Application          */
+#define XF86XK_LaunchD		0x1008FF4D   /* Launch Application          */
+#define XF86XK_LaunchE		0x1008FF4E   /* Launch Application          */
+#define XF86XK_LaunchF		0x1008FF4F   /* Launch Application          */
+
+#define XF86XK_ApplicationLeft	0x1008FF50   /* switch to application, left */
+#define XF86XK_ApplicationRight	0x1008FF51   /* switch to application, right*/
+#define XF86XK_Book		0x1008FF52   /* Launch bookreader           */
+#define XF86XK_CD		0x1008FF53   /* Launch CD/DVD player        */
+#define XF86XK_Calculater	0x1008FF54   /* Launch Calculater           */
+#define XF86XK_Clear		0x1008FF55   /* Clear window, screen        */
+#define XF86XK_Close		0x1008FF56   /* Close window                */
+#define XF86XK_Copy		0x1008FF57   /* Copy selection              */
+#define XF86XK_Cut		0x1008FF58   /* Cut selection               */
+#define XF86XK_Display		0x1008FF59   /* Output switch key           */
+#define XF86XK_DOS		0x1008FF5A   /* Launch DOS (emulation)      */
+#define XF86XK_Documents	0x1008FF5B   /* Open documents window       */
+#define XF86XK_Excel		0x1008FF5C   /* Launch spread sheet         */
+#define XF86XK_Explorer		0x1008FF5D   /* Launch file explorer        */
+#define XF86XK_Game		0x1008FF5E   /* Launch game                 */
+#define XF86XK_Go		0x1008FF5F   /* Go to URL                   */
+#define XF86XK_iTouch		0x1008FF60   /* Logitch iTouch- don't use   */
+#define XF86XK_LogOff		0x1008FF61   /* Log off system              */
+#define XF86XK_Market		0x1008FF62   /* ??                          */
+#define XF86XK_Meeting		0x1008FF63   /* enter meeting in calendar   */
+#define XF86XK_MenuKB		0x1008FF65   /* distingush keyboard from PB */
+#define XF86XK_MenuPB		0x1008FF66   /* distinuish PB from keyboard */
+#define XF86XK_MySites		0x1008FF67   /* Favourites                  */
+#define XF86XK_New		0x1008FF68   /* New (folder, document...    */
+#define XF86XK_News		0x1008FF69   /* News                        */
+#define XF86XK_OfficeHome	0x1008FF6A   /* Office home (old Staroffice)*/
+#define XF86XK_Open		0x1008FF6B   /* Open                        */
+#define XF86XK_Option		0x1008FF6C   /* ?? */
+#define XF86XK_Paste		0x1008FF6D   /* Paste                       */
+#define XF86XK_Phone		0x1008FF6E   /* Launch phone; dial number   */
+#define XF86XK_Q		0x1008FF70   /* Compaq's Q - don't use      */
+#define XF86XK_Reply		0x1008FF72   /* Reply e.g., mail            */
+#define XF86XK_Reload		0x1008FF73   /* Reload web page, file, etc. */
+#define XF86XK_RotateWindows	0x1008FF74   /* Rotate windows e.g. xrandr  */
+#define XF86XK_RotationPB	0x1008FF75   /* don't use                   */
+#define XF86XK_RotationKB	0x1008FF76   /* don't use                   */
+#define XF86XK_Save		0x1008FF77   /* Save (file, document, state */
+#define XF86XK_ScrollUp		0x1008FF78   /* Scroll window/contents up   */
+#define XF86XK_ScrollDown	0x1008FF79   /* Scrool window/contentd down */
+#define XF86XK_ScrollClick	0x1008FF7A   /* Use XKB mousekeys instead   */
+#define XF86XK_Send		0x1008FF7B   /* Send mail, file, object     */
+#define XF86XK_Spell		0x1008FF7C   /* Spell checker               */
+#define XF86XK_SplitScreen	0x1008FF7D   /* Split window or screen      */
+#define XF86XK_Support		0x1008FF7E   /* Get support (??)            */
+#define XF86XK_TaskPane		0x1008FF7F   /* Show tasks */
+#define XF86XK_Terminal		0x1008FF80   /* Launch terminal emulator    */
+#define XF86XK_Tools		0x1008FF81   /* toolbox of desktop/app.     */
+#define XF86XK_Travel		0x1008FF82   /* ?? */
+#define XF86XK_UserPB		0x1008FF84   /* ?? */
+#define XF86XK_User1KB		0x1008FF85   /* ?? */
+#define XF86XK_User2KB		0x1008FF86   /* ?? */
+#define XF86XK_Video		0x1008FF87   /* Launch video player       */
+#define XF86XK_WheelButton	0x1008FF88   /* button from a mouse wheel */
+#define XF86XK_Word		0x1008FF89   /* Launch word processor     */
+#define XF86XK_Xfer		0x1008FF8A
+#define XF86XK_ZoomIn		0x1008FF8B   /* zoom in view, map, etc.   */
+#define XF86XK_ZoomOut		0x1008FF8C   /* zoom out view, map, etc.  */
+
+#define XF86XK_Away		0x1008FF8D   /* mark yourself as away     */
+#define XF86XK_Messenger	0x1008FF8E   /* as in instant messaging   */
+#define XF86XK_WebCam		0x1008FF8F   /* Launch web camera app.    */
+#define XF86XK_MailForward	0x1008FF90   /* Forward in mail           */
+#define XF86XK_Pictures		0x1008FF91   /* Show pictures             */
+#define XF86XK_Music		0x1008FF92   /* Launch music application  */
+
+#define XF86XK_Battery		0x1008FF93   /* Display battery information */
+#define XF86XK_Bluetooth	0x1008FF94   /* Enable/disable Bluetooth    */
+#define XF86XK_WLAN		0x1008FF95   /* Enable/disable WLAN         */
+#define XF86XK_UWB		0x1008FF96   /* Enable/disable UWB	    */
+
+#define XF86XK_AudioForward	0x1008FF97   /* fast-forward audio track    */
+#define XF86XK_AudioRepeat	0x1008FF98   /* toggle repeat mode          */
+#define XF86XK_AudioRandomPlay	0x1008FF99   /* toggle shuffle mode         */
+#define XF86XK_Subtitle		0x1008FF9A   /* cycle through subtitle      */
+#define XF86XK_AudioCycleTrack	0x1008FF9B   /* cycle through audio tracks  */
+#define XF86XK_CycleAngle	0x1008FF9C   /* cycle through angles        */
+#define XF86XK_FrameBack	0x1008FF9D   /* video: go one frame back    */
+#define XF86XK_FrameForward	0x1008FF9E   /* video: go one frame forward */
+#define XF86XK_Time		0x1008FF9F   /* display, or shows an entry for time seeking */
+#define XF86XK_Select		0x1008FFA0   /* Select button on joypads and remotes */
+#define XF86XK_View		0x1008FFA1   /* Show a view options/properties */
+#define XF86XK_TopMenu		0x1008FFA2   /* Go to a top-level menu in a video */
+
+#define XF86XK_Red		0x1008FFA3   /* Red button                  */
+#define XF86XK_Green		0x1008FFA4   /* Green button                */
+#define XF86XK_Yellow		0x1008FFA5   /* Yellow button               */
+#define XF86XK_Blue             0x1008FFA6   /* Blue button                 */
+
+#define XF86XK_Suspend		0x1008FFA7   /* Sleep to RAM                */
+#define XF86XK_Hibernate	0x1008FFA8   /* Sleep to disk               */
+#define XF86XK_TouchpadToggle	0x1008FFA9   /* Toggle between touchpad/trackstick */
+#define XF86XK_TouchpadOn	0x1008FFB0   /* The touchpad got switched on */
+#define XF86XK_TouchpadOff	0x1008FFB1   /* The touchpad got switched off */
+
+#define XF86XK_AudioMicMute	0x1008FFB2   /* Mute the Mic from the system */
+
+/* Keys for special action keys (hot keys) */
+/* Virtual terminals on some operating systems */
+#define XF86XK_Switch_VT_1	0x1008FE01
+#define XF86XK_Switch_VT_2	0x1008FE02
+#define XF86XK_Switch_VT_3	0x1008FE03
+#define XF86XK_Switch_VT_4	0x1008FE04
+#define XF86XK_Switch_VT_5	0x1008FE05
+#define XF86XK_Switch_VT_6	0x1008FE06
+#define XF86XK_Switch_VT_7	0x1008FE07
+#define XF86XK_Switch_VT_8	0x1008FE08
+#define XF86XK_Switch_VT_9	0x1008FE09
+#define XF86XK_Switch_VT_10	0x1008FE0A
+#define XF86XK_Switch_VT_11	0x1008FE0B
+#define XF86XK_Switch_VT_12	0x1008FE0C
+
+#define XF86XK_Ungrab		0x1008FE20   /* force ungrab               */
+#define XF86XK_ClearGrab	0x1008FE21   /* kill application with grab */
+#define XF86XK_Next_VMode	0x1008FE22   /* next video mode available  */
+#define XF86XK_Prev_VMode	0x1008FE23   /* prev. video mode available */
+#define XF86XK_LogWindowTree	0x1008FE24   /* print window tree to log   */
+#define XF86XK_LogGrabInfo	0x1008FE25   /* print all active grabs to log */
diff --git a/ThirdParty/X11/Include/X11/XKBlib.h b/ThirdParty/X11/Include/X11/XKBlib.h
new file mode 100644
index 0000000000000000000000000000000000000000..8f6c72c1225841a12d94c5abbcde66c73c50ed58
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/XKBlib.h
@@ -0,0 +1,1149 @@
+/************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef _X11_XKBLIB_H_
+#define _X11_XKBLIB_H_
+
+#include <X11/Xlib.h>
+#include <X11/extensions/XKBstr.h>
+
+typedef struct _XkbAnyEvent {
+	int 		type;		/* XkbAnyEvent */
+	unsigned long 	serial;		/* # of last req processed by server */
+	Bool 		send_event;	/* is this from a SendEvent request? */
+	Display *	display;	/* Display the event was read from */
+	Time 		time;		/* milliseconds */
+	int 		xkb_type;	/* XKB event minor code */
+	unsigned int 	device;		/* device ID */
+} XkbAnyEvent;
+
+typedef struct _XkbNewKeyboardNotify {
+	int 		type;		/* XkbAnyEvent */
+	unsigned long 	serial;		/* of last req processed by server */
+	Bool 		send_event;	/* is this from a SendEvent request? */
+	Display *	display;	/* Display the event was read from */
+	Time 		time;		/* milliseconds */
+	int 		xkb_type;	/* XkbNewKeyboardNotify */
+	int	 	device;		/* device ID */
+	int	 	old_device;	/* device ID of previous keyboard */
+	int	 	min_key_code;	/* minimum key code */
+	int		max_key_code;	/* maximum key code */
+	int	 	old_min_key_code;/* min key code of previous kbd */
+	int		old_max_key_code;/* max key code of previous kbd */
+	unsigned int	changed;	/* changed aspects of the keyboard */
+	char	 	req_major;	/* major and minor opcode of req */
+	char	 	req_minor;	/* that caused change, if applicable */
+} XkbNewKeyboardNotifyEvent;
+
+typedef struct _XkbMapNotifyEvent {
+	int 		type;		/* XkbAnyEvent */
+	unsigned long 	serial;		/* of last req processed by server */
+	Bool 		send_event;	/* is this from a SendEvent request */
+	Display *	display;	/* Display the event was read from */
+	Time 		time;		/* milliseconds */
+	int 		xkb_type;	/* XkbMapNotify */
+	int 		device;		/* device ID */
+	unsigned int 	changed;	/* fields which have been changed */
+	unsigned int 	flags;		/* reserved */
+	int 		first_type;	/* first changed key type */
+	int 		num_types;	/* number of changed key types */
+	KeyCode		min_key_code;
+	KeyCode		max_key_code;
+	KeyCode		first_key_sym;
+	KeyCode		first_key_act;
+	KeyCode		first_key_behavior;
+	KeyCode		first_key_explicit;
+	KeyCode		first_modmap_key;
+	KeyCode		first_vmodmap_key;
+	int		num_key_syms;
+	int		num_key_acts;
+	int		num_key_behaviors;
+	int		num_key_explicit;
+	int 		num_modmap_keys;
+	int 		num_vmodmap_keys;
+	unsigned int 	vmods;		/* mask of changed virtual mods */
+} XkbMapNotifyEvent;
+
+typedef struct _XkbStateNotifyEvent {
+	int 		type;		/* XkbAnyEvent */
+	unsigned long 	serial;		/* # of last req processed by server */
+	Bool 		send_event;	/* is this from a SendEvent request? */
+	Display *	display;	/* Display the event was read from */
+	Time 		time;		/* milliseconds */
+	int 		xkb_type;	/* XkbStateNotify */
+	int 		device;		/* device ID */
+	unsigned int 	changed;	/* mask of changed state components */
+	int 		group;		/* keyboard group */
+	int 		base_group;	/* base keyboard group */
+	int 		latched_group;	/* latched keyboard group */
+	int 		locked_group;	/* locked keyboard group */
+	unsigned int	mods;		/* modifier state */
+	unsigned int 	base_mods;	/* base modifier state */
+	unsigned int	latched_mods;	/* latched modifiers */
+	unsigned int	locked_mods;	/* locked modifiers */
+	int 		compat_state;	/* compatibility state */
+	unsigned char	grab_mods;	/* mods used for grabs */
+	unsigned char	compat_grab_mods;/* grab mods for non-XKB clients */
+	unsigned char	lookup_mods;	/* mods sent to clients */
+	unsigned char	compat_lookup_mods; /* mods sent to non-XKB clients */
+	int 		ptr_buttons;	/* pointer button state */
+	KeyCode		keycode;	/* keycode that caused the change */
+	char 		event_type;	/* KeyPress or KeyRelease */
+	char 		req_major;	/* Major opcode of request */
+	char 		req_minor;	/* Minor opcode of request */
+} XkbStateNotifyEvent;
+
+typedef struct _XkbControlsNotify {
+	int 		type;		/* XkbAnyEvent */
+	unsigned long 	serial;		/* of last req processed by server */
+	Bool 		send_event;	/* is this from a SendEvent request? */
+	Display *	display;	/* Display the event was read from */
+	Time 		time;		/* milliseconds */
+	int 		xkb_type;	/* XkbControlsNotify */
+	int 		device;		/* device ID */
+	unsigned int	changed_ctrls;	/* controls with changed sub-values */
+	unsigned int 	enabled_ctrls;	/* controls currently enabled */
+	unsigned int	enabled_ctrl_changes;/* controls just {en,dis}abled */
+	int 		num_groups;	/* total groups on keyboard */
+	KeyCode		keycode;	/* key that caused change or 0 */
+	char 		event_type;	/* type of event that caused change */
+	char 		req_major;	/* if keycode==0, major and minor */
+	char 		req_minor;	/* opcode of req that caused change */
+} XkbControlsNotifyEvent;
+
+typedef struct _XkbIndicatorNotify {
+	int 		type;		/* XkbAnyEvent */
+	unsigned long 	serial;		/* of last req processed by server */
+	Bool 		send_event;	/* is this from a SendEvent request? */
+	Display *	display;	/* Display the event was read from */
+	Time 		time;		/* milliseconds */
+	int 		xkb_type;	/* XkbIndicatorNotify */
+	int 		device;		/* device ID */
+	unsigned int	changed;	/* indicators with new state or map */
+	unsigned int	state;	 	/* current state of all indicators */
+} XkbIndicatorNotifyEvent;
+
+typedef struct _XkbNamesNotify {
+	int 		type;		/* XkbAnyEvent */
+	unsigned long 	serial;		/* of last req processed by server */
+	Bool 		send_event;	/* is this from a SendEvent request? */
+	Display *	display;	/* Display the event was read from */
+	Time 		time;		/* milliseconds */
+	int 		xkb_type;	/* XkbNamesNotify */
+	int	 	device;		/* device ID */
+	unsigned int 	changed;	/* names that have changed */
+	int	 	first_type;	/* first key type with new name */
+	int	 	num_types;	/* number of key types with new names */
+	int	 	first_lvl;	/* first key type new new level names */
+	int	 	num_lvls;	/* # of key types w/new level names */
+	int	 	num_aliases;	/* total number of key aliases*/
+	int	 	num_radio_groups;/* total number of radio groups */
+	unsigned int 	changed_vmods;	/* virtual modifiers with new names */
+	unsigned int 	changed_groups;	/* groups with new names */
+	unsigned int 	changed_indicators;/* indicators with new names */
+	int		first_key;	/* first key with new name */
+	int		num_keys;	/* number of keys with new names */
+} XkbNamesNotifyEvent;
+
+typedef struct _XkbCompatMapNotify {
+	int 		type;		/* XkbAnyEvent */
+	unsigned long 	serial;		/* of last req processed by server */
+	Bool 		send_event;	/* is this from a SendEvent request? */
+	Display *	display;	/* Display the event was read from */
+	Time 		time;		/* milliseconds */
+	int 		xkb_type;	/* XkbCompatMapNotify */
+	int	 	device;		/* device ID */
+	unsigned int 	changed_groups; /* groups with new compat maps */
+	int	 	first_si;	/* first new symbol interp */
+	int	 	num_si;		/* number of new symbol interps */
+	int	 	num_total_si;	/* total # of symbol interps */
+} XkbCompatMapNotifyEvent;
+
+typedef struct _XkbBellNotify {
+	int 		type;		/* XkbAnyEvent */
+	unsigned long 	serial;		/* of last req processed by server */
+	Bool 		send_event;	/* is this from a SendEvent request? */
+	Display *	display;	/* Display the event was read from */
+	Time 		time;		/* milliseconds */
+	int 		xkb_type;	/* XkbBellNotify */
+	int	 	device;		/* device ID */
+	int	 	percent;	/* requested volume as a % of maximum */
+	int	 	pitch;		/* requested pitch in Hz */
+	int	 	duration;	/* requested duration in useconds */
+	int	 	bell_class;	/* (input extension) feedback class */
+	int	 	bell_id;	/* (input extension) ID of feedback */
+	Atom 		name;		/* "name" of requested bell */
+	Window 		window;		/* window associated with event */
+	Bool		event_only;	/* "event only" requested */
+} XkbBellNotifyEvent;
+
+typedef struct _XkbActionMessage {
+	int 		type;		/* XkbAnyEvent */
+	unsigned long 	serial;		/* of last req processed by server */
+	Bool 		send_event;	/* is this from a SendEvent request? */
+	Display *	display;	/* Display the event was read from */
+	Time 		time;		/* milliseconds */
+	int 		xkb_type;	/* XkbActionMessage */
+	int	 	device;		/* device ID */
+	KeyCode		keycode;	/* key that generated the event */
+	Bool 		press;		/* true if act caused by key press */
+	Bool 		key_event_follows;/* true if key event also generated */
+	int		group;		/* effective group */
+	unsigned int	mods;		/* effective mods */
+	char 		message[XkbActionMessageLength+1];
+					/* message -- leave space for NUL */
+} XkbActionMessageEvent;
+
+typedef struct _XkbAccessXNotify {
+	int 		type;		/* XkbAnyEvent */
+	unsigned long 	serial;		/* of last req processed by server */
+	Bool 		send_event;	/* is this from a SendEvent request? */
+	Display *	display;	/* Display the event was read from */
+	Time 		time;		/* milliseconds */
+	int 		xkb_type;	/* XkbAccessXNotify */
+	int	 	device;		/* device ID */
+	int	 	detail;		/* XkbAXN_* */
+	int	 	keycode;	/* key of event */
+	int	 	sk_delay;	/* current slow keys delay */
+	int		debounce_delay;	/* current debounce delay */
+} XkbAccessXNotifyEvent;
+
+typedef struct _XkbExtensionDeviceNotify {
+	int 		type;		/* XkbAnyEvent */
+	unsigned long 	serial;		/* of last req processed by server */
+	Bool 		send_event;	/* is this from a SendEvent request? */
+	Display *	display;	/* Display the event was read from */
+	Time 		time;		/* milliseconds */
+	int 		xkb_type;	/* XkbExtensionDeviceNotify */
+	int	 	device;		/* device ID */
+	unsigned int	reason;		/* reason for the event */
+	unsigned int	supported;	/* mask of supported features */
+	unsigned int	unsupported;	/* mask of unsupported features */
+					/* that some app tried to use */
+	int	 	first_btn;	/* first button that changed */
+	int	 	num_btns;	/* range of buttons changed */
+	unsigned int	leds_defined;   /* indicators with names or maps */
+	unsigned int	led_state;	/* current state of the indicators */
+	int		led_class;	/* feedback class for led changes */
+	int		led_id;   	/* feedback id for led changes */
+} XkbExtensionDeviceNotifyEvent;
+
+typedef union _XkbEvent {
+	int				type;
+	XkbAnyEvent			any;
+	XkbNewKeyboardNotifyEvent	new_kbd;
+	XkbMapNotifyEvent		map;
+	XkbStateNotifyEvent		state;
+	XkbControlsNotifyEvent		ctrls;
+	XkbIndicatorNotifyEvent 	indicators;
+	XkbNamesNotifyEvent		names;
+	XkbCompatMapNotifyEvent		compat;
+	XkbBellNotifyEvent		bell;
+	XkbActionMessageEvent		message;
+	XkbAccessXNotifyEvent		accessx;
+	XkbExtensionDeviceNotifyEvent 	device;
+	XEvent				core;
+} XkbEvent;
+
+typedef struct	_XkbKbdDpyState	XkbKbdDpyStateRec,*XkbKbdDpyStatePtr;
+
+	/* XkbOpenDisplay error codes */
+#define	XkbOD_Success		0
+#define	XkbOD_BadLibraryVersion	1
+#define	XkbOD_ConnectionRefused	2
+#define	XkbOD_NonXkbServer	3
+#define	XkbOD_BadServerVersion	4
+
+	/* Values for XlibFlags */
+#define	XkbLC_ForceLatin1Lookup		(1<<0)
+#define	XkbLC_ConsumeLookupMods		(1<<1)
+#define	XkbLC_AlwaysConsumeShiftAndLock (1<<2)
+#define	XkbLC_IgnoreNewKeyboards	(1<<3)
+#define	XkbLC_ControlFallback		(1<<4)
+#define	XkbLC_ConsumeKeysOnComposeFail	(1<<29)
+#define	XkbLC_ComposeLED		(1<<30)
+#define	XkbLC_BeepOnComposeFail		(1<<31)
+
+#define	XkbLC_AllComposeControls	(0xc0000000)
+#define	XkbLC_AllControls		(0xc000001f)
+
+_XFUNCPROTOBEGIN
+
+extern	Bool	XkbIgnoreExtension(
+	Bool			/* ignore */
+);
+
+extern	Display *XkbOpenDisplay(
+	char *			/* name */,
+	int *			/* ev_rtrn */,
+	int *			/* err_rtrn */,
+	int *			/* major_rtrn */,
+	int *			/* minor_rtrn */,
+	int *			/* reason */
+);
+
+extern	Bool	XkbQueryExtension(
+	Display *		/* dpy */,
+	int *			/* opcodeReturn */,
+	int *			/* eventBaseReturn */,
+	int *			/* errorBaseReturn */,
+	int *			/* majorRtrn */,
+	int *			/* minorRtrn */
+);
+
+extern	Bool	XkbUseExtension(
+	Display *		/* dpy */,
+	int *			/* major_rtrn */,
+	int *			/* minor_rtrn */
+);
+
+extern	Bool	XkbLibraryVersion(
+	int *			/* libMajorRtrn */,
+	int *			/* libMinorRtrn */
+);
+
+extern	unsigned int	XkbSetXlibControls(
+	Display*		/* dpy */,
+	unsigned int		/* affect */,
+	unsigned int		/* values */
+);
+
+extern	unsigned int	XkbGetXlibControls(
+	Display*		/* dpy */
+);
+
+extern	unsigned int	XkbXlibControlsImplemented(void);
+
+typedef	Atom	(*XkbInternAtomFunc)(
+	Display *		/* dpy */,
+	_Xconst char *		/* name */,
+	Bool			/* only_if_exists */
+);
+
+typedef char *	(*XkbGetAtomNameFunc)(
+	Display *		/* dpy */,
+	Atom			/* atom */
+);
+
+extern void		XkbSetAtomFuncs(
+	XkbInternAtomFunc	/* getAtom */,
+	XkbGetAtomNameFunc	/* getName */
+);
+
+extern	KeySym XkbKeycodeToKeysym(
+		Display *	/* dpy */,
+#if NeedWidePrototypes
+		 unsigned int 	/* kc */,
+#else
+		 KeyCode 	/* kc */,
+#endif
+		 int 		/* group */,
+		 int		/* level */
+);
+
+extern	unsigned int	XkbKeysymToModifiers(
+    Display *			/* dpy */,
+    KeySym 			/* ks */
+);
+
+extern	Bool		XkbLookupKeySym(
+    Display *			/* dpy */,
+    KeyCode 			/* keycode */,
+    unsigned int 		/* modifiers */,
+    unsigned int *		/* modifiers_return */,
+    KeySym *			/* keysym_return */
+);
+
+extern	int		XkbLookupKeyBinding(
+    Display *			/* dpy */,
+    KeySym 			/* sym_rtrn */,
+    unsigned int 		/* mods */,
+    char *			/* buffer */,
+    int 			/* nbytes */,
+    int * 			/* extra_rtrn */
+);
+
+extern	Bool		XkbTranslateKeyCode(
+    XkbDescPtr			/* xkb */,
+    KeyCode 			/* keycode */,
+    unsigned int 		/* modifiers */,
+    unsigned int *		/* modifiers_return */,
+    KeySym *			/* keysym_return */
+);
+
+extern	int		XkbTranslateKeySym(
+    Display *			/* dpy */,
+    register KeySym *		/* sym_return */,
+    unsigned int 		/* modifiers */,
+    char *			/* buffer */,
+    int 			/* nbytes */,
+    int *			/* extra_rtrn */
+);
+
+extern	Bool	XkbSetAutoRepeatRate(
+	Display *		/* dpy */,
+	unsigned int		/* deviceSpec */,
+	unsigned int		/* delay */,
+	unsigned int		/* interval */
+);
+
+extern	Bool	XkbGetAutoRepeatRate(
+	Display *		/* dpy */,
+	unsigned int		/* deviceSpec */,
+	unsigned int *		/* delayRtrn */,
+	unsigned int *		/* intervalRtrn */
+);
+
+extern	Bool	XkbChangeEnabledControls(
+	Display *		/* dpy */,
+	unsigned int		/* deviceSpec */,
+	unsigned int		/* affect */,
+	unsigned int		/* values */
+);
+
+extern	Bool	XkbDeviceBell(
+	Display *		/* dpy */,
+	Window			/* win */,
+	int			/* deviceSpec */,
+	int			/* bellClass */,
+	int			/* bellID */,
+	int			/* percent */,
+	Atom			/* name */
+);
+
+extern	Bool	XkbForceDeviceBell(
+	Display *		/* dpy */,
+	int			/* deviceSpec */,
+	int			/* bellClass */,
+	int			/* bellID */,
+	int			/* percent */
+);
+
+extern	Bool	XkbDeviceBellEvent(
+	Display *		/* dpy */,
+	Window			/* win */,
+	int			/* deviceSpec */,
+	int			/* bellClass */,
+	int			/* bellID */,
+	int			/* percent */,
+	Atom			/* name */
+);
+
+extern	Bool	XkbBell(
+	Display *		/* dpy */,
+	Window			/* win */,
+	int			/* percent */,
+	Atom			/* name */
+);
+
+extern	Bool	XkbForceBell(
+	Display *		/* dpy */,
+	int			/* percent */
+);
+
+extern	Bool	XkbBellEvent(
+	Display *		/* dpy */,
+	Window			/* win */,
+	int			/* percent */,
+	Atom			/* name */
+);
+
+extern	Bool	XkbSelectEvents(
+	Display *		/* dpy */,
+	unsigned int		/* deviceID */,
+	unsigned int 		/* affect */,
+	unsigned int 		/* values */
+);
+
+extern	Bool	XkbSelectEventDetails(
+	Display *		/* dpy */,
+	unsigned int 		/* deviceID */,
+	unsigned int 		/* eventType */,
+	unsigned long 		/* affect */,
+	unsigned long 		/* details */
+);
+
+extern	void	XkbNoteMapChanges(
+    XkbMapChangesPtr		/* old */,
+    XkbMapNotifyEvent	*	/* new */,
+    unsigned int	 	/* wanted */
+);
+
+extern	void	XkbNoteNameChanges(
+    XkbNameChangesPtr		/* old */,
+    XkbNamesNotifyEvent	*	/* new */,
+    unsigned int	 	/* wanted */
+);
+
+extern	Status	XkbGetIndicatorState(
+	Display *		/* dpy */,
+	unsigned int		/* deviceSpec */,
+	unsigned int *		/* pStateRtrn */
+);
+
+extern	Status	XkbGetDeviceIndicatorState(
+	Display *		/* dpy */,
+	unsigned int		/* deviceSpec */,
+	unsigned int		/* ledClass */,
+	unsigned int		/* ledID */,
+	unsigned int *		/* pStateRtrn */
+);
+
+extern	Status	 XkbGetIndicatorMap(
+	Display *		/* dpy */,
+	unsigned long		/* which */,
+	XkbDescPtr		/* desc */
+);
+
+extern	Bool	 XkbSetIndicatorMap(
+	Display *		/* dpy */,
+	unsigned long 		/* which */,
+	XkbDescPtr		/* desc */
+);
+
+#define	XkbNoteIndicatorMapChanges(o,n,w) \
+				((o)->map_changes|=((n)->map_changes&(w)))
+#define	XkbNoteIndicatorStateChanges(o,n,w)\
+				((o)->state_changes|=((n)->state_changes&(w)))
+#define	XkbGetIndicatorMapChanges(d,x,c) \
+				(XkbGetIndicatorMap((d),(c)->map_changes,x))
+#define	XkbChangeIndicatorMaps(d,x,c) \
+				(XkbSetIndicatorMap((d),(c)->map_changes,x))
+
+extern	Bool	XkbGetNamedIndicator(
+	Display *		/* dpy */,
+	Atom			/* name */,
+	int *			/* pNdxRtrn */,
+	Bool *			/* pStateRtrn */,
+	XkbIndicatorMapPtr	/* pMapRtrn */,
+	Bool *			/* pRealRtrn */
+);
+
+extern	Bool	XkbGetNamedDeviceIndicator(
+	Display *		/* dpy */,
+	unsigned int		/* deviceSpec */,
+	unsigned int		/* ledClass */,
+	unsigned int		/* ledID */,
+	Atom			/* name */,
+	int *			/* pNdxRtrn */,
+	Bool *			/* pStateRtrn */,
+	XkbIndicatorMapPtr	/* pMapRtrn */,
+	Bool *			/* pRealRtrn */
+);
+
+extern	Bool	XkbSetNamedIndicator(
+	Display *		/* dpy */,
+	Atom			/* name */,
+	Bool			/* changeState */,
+	Bool 			/* state */,
+	Bool			/* createNewMap */,
+	XkbIndicatorMapPtr	/* pMap */
+);
+
+extern	Bool	XkbSetNamedDeviceIndicator(
+	Display *		/* dpy */,
+	unsigned int		/* deviceSpec */,
+	unsigned int		/* ledClass */,
+	unsigned int		/* ledID */,
+	Atom			/* name */,
+	Bool			/* changeState */,
+	Bool 			/* state */,
+	Bool			/* createNewMap */,
+	XkbIndicatorMapPtr	/* pMap */
+);
+
+extern	Bool	XkbLockModifiers(
+	Display *		/* dpy */,
+	unsigned int 		/* deviceSpec */,
+	unsigned int 		/* affect */,
+	unsigned int 		/* values */
+);
+
+extern	Bool	XkbLatchModifiers(
+	Display *		/* dpy */,
+	unsigned int 		/* deviceSpec */,
+	unsigned int 		/* affect */,
+	unsigned int 		/* values */
+);
+
+extern	Bool	XkbLockGroup(
+	Display *		/* dpy */,
+	unsigned int 		/* deviceSpec */,
+	unsigned int 		/* group */
+);
+
+extern	Bool	XkbLatchGroup(
+	Display *		/* dpy */,
+	unsigned int 		/* deviceSpec */,
+	unsigned int 		/* group */
+);
+
+extern	Bool	XkbSetServerInternalMods(
+	Display *		/* dpy */,
+	unsigned int 		/* deviceSpec */,
+	unsigned int 		/* affectReal */,
+	unsigned int 		/* realValues */,
+	unsigned int		/* affectVirtual */,
+	unsigned int		/* virtualValues */
+);
+
+extern	Bool	XkbSetIgnoreLockMods(
+	Display *		/* dpy */,
+	unsigned int 		/* deviceSpec */,
+	unsigned int 		/* affectReal */,
+	unsigned int 		/* realValues */,
+	unsigned int		/* affectVirtual */,
+	unsigned int		/* virtualValues */
+);
+
+
+extern	Bool	XkbVirtualModsToReal(
+	XkbDescPtr		/* xkb */,
+	unsigned int		/* virtual_mask */,
+	unsigned int *		/* mask_rtrn */
+);
+
+extern	Bool	XkbComputeEffectiveMap(
+	XkbDescPtr 		/* xkb */,
+	XkbKeyTypePtr		/* type */,
+	unsigned char *		/* map_rtrn */
+);
+
+extern	Status XkbInitCanonicalKeyTypes(
+    XkbDescPtr			/* xkb */,
+    unsigned int		/* which */,
+    int				/* keypadVMod */
+);
+
+extern	XkbDescPtr XkbAllocKeyboard(
+	void
+);
+
+extern	void	XkbFreeKeyboard(
+	XkbDescPtr		/* xkb */,
+	unsigned int		/* which */,
+	Bool			/* freeDesc */
+);
+
+extern	Status XkbAllocClientMap(
+	XkbDescPtr		/* xkb */,
+	unsigned int		/* which */,
+	unsigned int		/* nTypes */
+);
+
+extern	Status XkbAllocServerMap(
+	XkbDescPtr		/* xkb */,
+	unsigned int		/* which */,
+	unsigned int		/* nActions */
+);
+
+extern	void	XkbFreeClientMap(
+    XkbDescPtr			/* xkb */,
+    unsigned int		/* what */,
+    Bool			/* freeMap */
+);
+
+extern	void	XkbFreeServerMap(
+    XkbDescPtr			/* xkb */,
+    unsigned int		/* what */,
+    Bool			/* freeMap */
+);
+
+extern	XkbKeyTypePtr	XkbAddKeyType(
+    XkbDescPtr			/* xkb */,
+    Atom			/* name */,
+    int				/* map_count */,
+    Bool			/* want_preserve */,
+    int				/* num_lvls */
+);
+
+extern	Status XkbAllocIndicatorMaps(
+	XkbDescPtr		/* xkb */
+);
+
+extern	void XkbFreeIndicatorMaps(
+    XkbDescPtr			/* xkb */
+);
+
+extern	XkbDescPtr XkbGetMap(
+	Display *		/* dpy */,
+	unsigned int 		/* which */,
+	unsigned int 		/* deviceSpec */
+);
+
+extern	Status	XkbGetUpdatedMap(
+	Display *		/* dpy */,
+	unsigned int 		/* which */,
+	XkbDescPtr		/* desc */
+);
+
+extern	Status	XkbGetMapChanges(
+    Display *			/* dpy */,
+    XkbDescPtr			/* xkb */,
+    XkbMapChangesPtr		/* changes */
+);
+
+
+extern	Status	XkbRefreshKeyboardMapping(
+    XkbMapNotifyEvent *		/* event */
+);
+
+extern	Status	XkbGetKeyTypes(
+    Display *			/* dpy */,
+    unsigned int		/* first */,
+    unsigned int 		/* num */,
+    XkbDescPtr			/* xkb */
+);
+
+extern	Status	XkbGetKeySyms(
+    Display *			/* dpy */,
+    unsigned int		/* first */,
+    unsigned int		/* num */,
+    XkbDescPtr			/* xkb */
+);
+
+extern	Status	XkbGetKeyActions(
+    Display *			/* dpy */,
+    unsigned int 		/* first */,
+    unsigned int 		/* num */,
+    XkbDescPtr			/* xkb */
+);
+
+extern	Status	XkbGetKeyBehaviors(
+	Display *		/* dpy */,
+	unsigned int 		/* firstKey */,
+	unsigned int		/* nKeys */,
+	XkbDescPtr		/* desc */
+);
+
+extern	Status	XkbGetVirtualMods(
+	Display *		/* dpy */,
+	unsigned int 		/* which */,
+	XkbDescPtr		/* desc */
+);
+
+extern	Status	XkbGetKeyExplicitComponents(
+	Display *		/* dpy */,
+	unsigned int 		/* firstKey */,
+	unsigned int		/* nKeys */,
+	XkbDescPtr		/* desc */
+);
+
+extern	Status	XkbGetKeyModifierMap(
+	Display *		/* dpy */,
+	unsigned int 		/* firstKey */,
+	unsigned int		/* nKeys */,
+	XkbDescPtr		/* desc */
+);
+
+extern	Status	XkbGetKeyVirtualModMap(
+	Display *		/* dpy */,
+	unsigned int		/* first */,
+	unsigned int		/* num */,
+	XkbDescPtr		/* xkb */
+);
+
+extern	Status	XkbAllocControls(
+	XkbDescPtr		/* xkb */,
+	unsigned int		/* which*/
+);
+
+extern	void	XkbFreeControls(
+	XkbDescPtr		/* xkb */,
+	unsigned int		/* which */,
+	Bool			/* freeMap */
+);
+
+extern	Status	XkbGetControls(
+	Display *		/* dpy */,
+	unsigned long		/* which */,
+	XkbDescPtr		/* desc */
+);
+
+extern	Bool	XkbSetControls(
+	Display *		/* dpy */,
+	unsigned long		/* which */,
+	XkbDescPtr		/* desc */
+);
+
+extern	void	XkbNoteControlsChanges(
+    XkbControlsChangesPtr	/* old */,
+    XkbControlsNotifyEvent *	/* new */,
+    unsigned int	 	/* wanted */
+);
+
+#define	XkbGetControlsChanges(d,x,c)	XkbGetControls(d,(c)->changed_ctrls,x)
+#define	XkbChangeControls(d,x,c)	XkbSetControls(d,(c)->changed_ctrls,x)
+
+extern	Status	XkbAllocCompatMap(
+    XkbDescPtr			/* xkb */,
+    unsigned int		/* which */,
+    unsigned int		/* nInterpret */
+);
+
+extern	void	XkbFreeCompatMap(
+    XkbDescPtr			/* xkb */,
+    unsigned int		/* which */,
+    Bool			/* freeMap */
+);
+
+extern Status XkbGetCompatMap(
+	Display *		/* dpy */,
+	unsigned int 		/* which */,
+	XkbDescPtr 		/* xkb */
+);
+
+extern Bool XkbSetCompatMap(
+	Display *		/* dpy */,
+	unsigned int 		/* which */,
+	XkbDescPtr 		/* xkb */,
+	Bool			/* updateActions */
+);
+
+extern	XkbSymInterpretPtr XkbAddSymInterpret(
+	XkbDescPtr		/* xkb */,
+	XkbSymInterpretPtr	/* si */,
+	Bool			/* updateMap */,
+	XkbChangesPtr		/* changes */
+);
+
+extern	Status XkbAllocNames(
+	XkbDescPtr		/* xkb */,
+	unsigned int		/* which */,
+	int			/* nTotalRG */,
+	int			/* nTotalAliases */
+);
+
+extern	Status	XkbGetNames(
+	Display *		/* dpy */,
+	unsigned int		/* which */,
+	XkbDescPtr		/* desc */
+);
+
+extern	Bool	XkbSetNames(
+	Display *		/* dpy */,
+	unsigned int		/* which */,
+	unsigned int		/* firstType */,
+	unsigned int		/* nTypes */,
+	XkbDescPtr		/* desc */
+);
+
+extern	Bool	XkbChangeNames(
+	Display *		/* dpy */,
+	XkbDescPtr		/* xkb */,
+	XkbNameChangesPtr	/* changes */
+);
+
+extern	void XkbFreeNames(
+	XkbDescPtr		/* xkb */,
+	unsigned int		/* which */,
+	Bool			/* freeMap */
+);
+
+
+extern	Status	XkbGetState(
+	Display *		/* dpy */,
+	unsigned int 		/* deviceSpec */,
+	XkbStatePtr		/* rtrnState */
+);
+
+extern	Bool	XkbSetMap(
+	Display *		/* dpy */,
+	unsigned int		/* which */,
+	XkbDescPtr		/* desc */
+);
+
+extern	Bool	XkbChangeMap(
+	Display*		/* dpy */,
+	XkbDescPtr		/* desc */,
+	XkbMapChangesPtr	/* changes */
+);
+
+extern	Bool	XkbSetDetectableAutoRepeat(
+	Display *		/* dpy */,
+	Bool			/* detectable */,
+	Bool *			/* supported */
+);
+
+extern	Bool	XkbGetDetectableAutoRepeat(
+	Display *		/* dpy */,
+	Bool *			/* supported */
+);
+
+extern	Bool	XkbSetAutoResetControls(
+    Display *			/* dpy */,
+    unsigned int 		/* changes */,
+    unsigned int *		/* auto_ctrls */,
+    unsigned int *		/* auto_values */
+);
+
+extern	Bool	XkbGetAutoResetControls(
+    Display *			/* dpy */,
+    unsigned int *		/* auto_ctrls */,
+    unsigned int *		/* auto_ctrl_values */
+);
+
+extern	Bool	XkbSetPerClientControls(
+    Display *			/* dpy */,
+    unsigned int		/* change */,
+    unsigned int *		/* values */
+);
+
+extern	Bool	XkbGetPerClientControls(
+    Display *			/* dpy */,
+    unsigned int *		/* ctrls */
+);
+
+extern Status XkbCopyKeyType(
+    XkbKeyTypePtr	/* from */,
+    XkbKeyTypePtr	/* into */
+);
+
+extern Status XkbCopyKeyTypes(
+    XkbKeyTypePtr	/* from */,
+    XkbKeyTypePtr	/* into */,
+    int			/* num_types */
+);
+
+extern	Status	XkbResizeKeyType(
+    XkbDescPtr		/* xkb */,
+    int			/* type_ndx */,
+    int			/* map_count */,
+    Bool		/* want_preserve */,
+    int			/* new_num_lvls */
+);
+
+extern	KeySym *XkbResizeKeySyms(
+	XkbDescPtr		/* desc */,
+	int 			/* forKey */,
+	int 			/* symsNeeded */
+);
+
+extern	XkbAction *XkbResizeKeyActions(
+	XkbDescPtr		/* desc */,
+	int 			/* forKey */,
+	int 			/* actsNeeded */
+);
+
+extern	Status XkbChangeTypesOfKey(
+	XkbDescPtr		/* xkb */,
+	int 			/* key */,
+	int			/* num_groups */,
+	unsigned int		/* groups */,
+	int *			/* newTypes */,
+	XkbMapChangesPtr	/* pChanges */
+);
+
+extern  Status   XkbChangeKeycodeRange(
+	XkbDescPtr		/* xkb */,
+	int			/* minKC */,
+	int			/* maxKC */,
+	XkbChangesPtr		/* changes */
+);
+
+/***====================================================================***/
+
+extern	XkbComponentListPtr	XkbListComponents(
+	Display *		/* dpy */,
+	unsigned int		/* deviceSpec */,
+	XkbComponentNamesPtr	/* ptrns */,
+	int *			/* max_inout */
+);
+
+extern	void XkbFreeComponentList(
+	XkbComponentListPtr	/* list */
+);
+
+extern	XkbDescPtr XkbGetKeyboard(
+	Display *		/* dpy */,
+	unsigned int 		/* which */,
+	unsigned int 		/* deviceSpec */
+);
+
+extern XkbDescPtr XkbGetKeyboardByName(
+    Display *			/* dpy */,
+    unsigned int		/* deviceSpec */,
+    XkbComponentNamesPtr	/* names */,
+    unsigned int 		/* want */,
+    unsigned int 		/* need */,
+    Bool			/* load */
+);
+
+/***====================================================================***/
+
+extern	int	XkbKeyTypesForCoreSymbols(	/* returns # of groups */
+    XkbDescPtr	/* xkb */,			/* keyboard device */
+    int		/* map_width */,		/* width of core KeySym array */
+    KeySym *	/* core_syms */,		/* always mapWidth symbols */
+    unsigned int	/* protected */,	/* explicit key types */
+    int *	/* types_inout */,		/* always four type indices */
+    KeySym * 	/* xkb_syms_rtrn */		/* must have enough space */
+);
+
+extern	Bool	XkbApplyCompatMapToKey(	/* False only on error */
+    XkbDescPtr		/* xkb */,		/* keymap to be edited */
+    KeyCode		/* key */,		/* key to be updated */
+    XkbChangesPtr	/* changes */		/* resulting changes to map */
+);
+
+extern	Bool	XkbUpdateMapFromCore( /* False only on error */
+    XkbDescPtr		/* xkb */,		/* XKB keyboard to be edited */
+    KeyCode		/* first_key */,	/* first changed key */
+    int			/* num_keys */, 	/* number of changed keys */
+    int			/* map_width */,	/* width of core keymap */
+    KeySym *		/* core_keysyms */,	/* symbols from core keymap */
+    XkbChangesPtr	/* changes */		/* resulting changes */
+);
+
+/***====================================================================***/
+
+extern	XkbDeviceLedInfoPtr	XkbAddDeviceLedInfo(
+	XkbDeviceInfoPtr	/* devi */,
+	unsigned int		/* ledClass */,
+	unsigned int		/* ledId */
+);
+
+extern	Status			XkbResizeDeviceButtonActions(
+	XkbDeviceInfoPtr	/* devi */,
+	unsigned int		/* newTotal */
+);
+
+extern	XkbDeviceInfoPtr	XkbAllocDeviceInfo(
+	unsigned int		/* deviceSpec */,
+	unsigned int		/* nButtons */,
+	unsigned int		/* szLeds */
+);
+
+extern	void XkbFreeDeviceInfo(
+	XkbDeviceInfoPtr	/* devi */,
+	unsigned int		/* which */,
+	Bool			/* freeDevI */
+);
+
+extern	void	XkbNoteDeviceChanges(
+    XkbDeviceChangesPtr			/* old */,
+    XkbExtensionDeviceNotifyEvent *	/* new */,
+    unsigned int	 		/* wanted */
+);
+
+extern	XkbDeviceInfoPtr XkbGetDeviceInfo(
+	Display *		/* dpy */,
+	unsigned int 		/* which */,
+	unsigned int		/* deviceSpec */,
+	unsigned int		/* ledClass */,
+	unsigned int		/* ledID */
+);
+
+extern	Status	XkbGetDeviceInfoChanges(
+	Display *		/* dpy */,
+	XkbDeviceInfoPtr	/* devi */,
+	XkbDeviceChangesPtr 	/* changes */
+);
+
+extern	Status	XkbGetDeviceButtonActions(
+	Display *		/* dpy */,
+	XkbDeviceInfoPtr	/* devi */,
+	Bool			/* all */,
+	unsigned int		/* first */,
+	unsigned int		/* nBtns */
+);
+
+extern	Status	XkbGetDeviceLedInfo(
+	Display *		/* dpy */,
+	XkbDeviceInfoPtr	/* devi */,
+	unsigned int		/* ledClass (class, XIDflt, XIAll) */,
+	unsigned int		/* ledId (id, XIDflt, XIAll) */,
+	unsigned int		/* which (XkbXI_Indicator{Names,Map}Mask */
+);
+
+extern	Bool	XkbSetDeviceInfo(
+	Display *		/* dpy */,
+	unsigned int		/* which */,
+	XkbDeviceInfoPtr	/* devi */
+);
+
+extern	Bool	XkbChangeDeviceInfo(
+	Display*		/* dpy */,
+	XkbDeviceInfoPtr	/* desc */,
+	XkbDeviceChangesPtr	/* changes */
+);
+
+extern  Bool XkbSetDeviceLedInfo(
+	Display *		/* dpy */,
+	XkbDeviceInfoPtr	/* devi */,
+	unsigned int 		/* ledClass */,
+	unsigned int		/* ledID */,
+	unsigned int		/* which */
+);
+
+extern	Bool XkbSetDeviceButtonActions(
+	Display *		/* dpy */,
+	XkbDeviceInfoPtr	/* devi */,
+	unsigned int		/* first */,
+	unsigned int		/* nBtns */
+);
+
+/***====================================================================***/
+
+extern	char	XkbToControl(
+	char		/* c */
+);
+
+/***====================================================================***/
+
+extern	Bool XkbSetDebuggingFlags(
+    Display *		/* dpy */,
+    unsigned int	/* mask */,
+    unsigned int	/* flags */,
+    char *		/* msg */,
+    unsigned int	/* ctrls_mask */,
+    unsigned int	/* ctrls */,
+    unsigned int *	/* rtrn_flags */,
+    unsigned int *	/* rtrn_ctrls */
+);
+
+extern	Bool XkbApplyVirtualModChanges(
+   XkbDescPtr		/* xkb */,
+   unsigned int		/* changed */,
+   XkbChangesPtr	/* changes */
+);
+
+extern Bool XkbUpdateActionVirtualMods(
+	XkbDescPtr		/* xkb */,
+	XkbAction *		/* act */,
+	unsigned int		/* changed */
+);
+
+extern void XkbUpdateKeyTypeVirtualMods(
+	XkbDescPtr		/* xkb */,
+	XkbKeyTypePtr		/* type */,
+	unsigned int		/* changed */,
+	XkbChangesPtr		/* changes */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _X11_XKBLIB_H_ */
diff --git a/ThirdParty/X11/Include/X11/XWDFile.h b/ThirdParty/X11/Include/X11/XWDFile.h
new file mode 100644
index 0000000000000000000000000000000000000000..50e17df3d69c9d53586d2e89cd7389c94d260a29
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/XWDFile.h
@@ -0,0 +1,113 @@
+/*
+
+Copyright 1985, 1986, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * XWDFile.h	MIT Project Athena, X Window system window raster
+ *		image dumper, dump file format header file.
+ *
+ *  Author:	Tony Della Fera, DEC
+ *		27-Jun-85
+ * 
+ * Modifier:    William F. Wyatt, SAO
+ *              18-Nov-86  - version 6 for saving/restoring color maps
+ */
+
+#ifndef XWDFILE_H
+#define XWDFILE_H
+
+#include <X11/Xmd.h>
+
+#define XWD_FILE_VERSION 7
+#define sz_XWDheader 100
+#define sz_XWDColor 12
+
+typedef CARD32 xwdval;		/* for old broken programs */
+
+/* Values in the file are most significant byte first. */
+
+typedef struct _xwd_file_header {
+	/* header_size = SIZEOF(XWDheader) + length of null-terminated
+	 * window name. */
+	CARD32 header_size B32;		
+
+	CARD32 file_version B32;	/* = XWD_FILE_VERSION above */
+	CARD32 pixmap_format B32;	/* ZPixmap or XYPixmap */
+	CARD32 pixmap_depth B32;	/* Pixmap depth */
+	CARD32 pixmap_width B32;	/* Pixmap width */
+	CARD32 pixmap_height B32;	/* Pixmap height */
+	CARD32 xoffset B32;		/* Bitmap x offset, normally 0 */
+	CARD32 byte_order B32;		/* of image data: MSBFirst, LSBFirst */
+
+	/* bitmap_unit applies to bitmaps (depth 1 format XY) only.
+	 * It is the number of bits that each scanline is padded to. */
+	CARD32 bitmap_unit B32;		
+
+	CARD32 bitmap_bit_order B32;	/* bitmaps only: MSBFirst, LSBFirst */
+
+	/* bitmap_pad applies to pixmaps (non-bitmaps) only.
+	 * It is the number of bits that each scanline is padded to. */
+	CARD32 bitmap_pad B32;		
+
+	CARD32 bits_per_pixel B32;	/* Bits per pixel */
+
+	/* bytes_per_line is pixmap_width padded to bitmap_unit (bitmaps)
+	 * or bitmap_pad (pixmaps).  It is the delta (in bytes) to get
+	 * to the same x position on an adjacent row. */
+	CARD32 bytes_per_line B32;
+	CARD32 visual_class B32;	/* Class of colormap */
+	CARD32 red_mask B32;		/* Z red mask */
+	CARD32 green_mask B32;		/* Z green mask */
+	CARD32 blue_mask B32;		/* Z blue mask */
+	CARD32 bits_per_rgb B32;	/* Log2 of distinct color values */
+	CARD32 colormap_entries B32;	/* Number of entries in colormap; not used? */
+	CARD32 ncolors B32;		/* Number of XWDColor structures */
+	CARD32 window_width B32;	/* Window width */
+	CARD32 window_height B32;	/* Window height */
+	CARD32 window_x B32;		/* Window upper left X coordinate */
+	CARD32 window_y B32;		/* Window upper left Y coordinate */
+	CARD32 window_bdrwidth B32;	/* Window border width */
+} XWDFileHeader;
+
+/* Null-terminated window name follows the above structure. */
+
+/* Next comes XWDColor structures, at offset XWDFileHeader.header_size in
+ * the file.  XWDFileHeader.ncolors tells how many XWDColor structures
+ * there are.
+ */
+
+typedef struct {
+        CARD32	pixel B32;
+        CARD16	red B16;
+	CARD16	green B16;
+	CARD16	blue B16;
+        CARD8	flags;
+        CARD8	pad;
+} XWDColor;
+
+/* Last comes the image data in the format described by XWDFileHeader. */
+
+#endif /* XWDFILE_H */
+
diff --git a/ThirdParty/X11/Include/X11/Xalloca.h b/ThirdParty/X11/Include/X11/Xalloca.h
new file mode 100644
index 0000000000000000000000000000000000000000..1919884bb80d215c0e682979f8105daa4f8dd768
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xalloca.h
@@ -0,0 +1,121 @@
+/*
+
+Copyright 1995, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+/*
+ * The purpose of this header is to define the macros ALLOCATE_LOCAL and
+ * DEALLOCATE_LOCAL appropriately for the platform being compiled on.
+ * These macros are used to make fast, function-local memory allocations.
+ * Their characteristics are as follows:
+ *
+ * void *ALLOCATE_LOCAL(int size)
+ *    Returns a pointer to size bytes of memory, or NULL if the allocation
+ *    failed.  The memory must be freed with DEALLOCATE_LOCAL before the
+ *    function that made the allocation returns.  You should not ask for
+ *    large blocks of memory with this function, since on many platforms
+ *    the memory comes from the stack, which may have limited size.
+ *
+ * void DEALLOCATE_LOCAL(void *)
+ *    Frees the memory allocated by ALLOCATE_LOCAL.  Omission of this
+ *    step may be harmless on some platforms, but will result in
+ *    memory leaks or worse on others.
+ *
+ * Before including this file, you should define two macros,
+ * ALLOCATE_LOCAL_FALLBACK and DEALLOCATE_LOCAL_FALLBACK, that have the
+ * same characteristics as ALLOCATE_LOCAL and DEALLOCATE_LOCAL.  The
+ * header uses the fallbacks if it doesn't know a "better" way to define
+ * ALLOCATE_LOCAL and DEALLOCATE_LOCAL.  Typical usage would be:
+ *
+ *    #define ALLOCATE_LOCAL_FALLBACK(_size) malloc(_size)
+ *    #define DEALLOCATE_LOCAL_FALLBACK(_ptr) free(_ptr)
+ *    #include "Xalloca.h"
+ */
+
+#ifndef XALLOCA_H
+#define XALLOCA_H 1
+
+#ifndef INCLUDE_ALLOCA_H
+/* Need to add more here to match Imake *.cf's */
+# if defined(HAVE_ALLOCA_H) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+#  define INCLUDE_ALLOCA_H
+# endif
+#endif
+
+#ifdef INCLUDE_ALLOCA_H
+#  include <alloca.h>
+#endif
+
+#ifndef NO_ALLOCA
+/*
+ * os-dependent definition of local allocation and deallocation
+ * If you want something other than (DE)ALLOCATE_LOCAL_FALLBACK
+ * for ALLOCATE/DEALLOCATE_LOCAL then you add that in here.
+ */
+
+
+#  ifdef __GNUC__
+#    ifndef alloca
+#      define alloca __builtin_alloca
+#    endif /* !alloca */
+#    define ALLOCATE_LOCAL(size) alloca((int)(size))
+#  else /* ! __GNUC__ */
+
+/*
+ * warning: old mips alloca (pre 2.10) is unusable, new one is built in
+ * Test is easy, the new one is named __builtin_alloca and comes
+ * from alloca.h which #defines alloca.
+ */
+#      if defined(__sun) || defined(alloca)
+/*
+ * Some System V boxes extract alloca.o from /lib/libPW.a; if you
+ * decide that you don't want to use alloca, you might want to fix it here.
+ */
+/* alloca might be a macro taking one arg (hi, Sun!), so give it one. */
+#        if !defined(__cplusplus)
+#          define __Xnullarg		/* as nothing */
+           extern void *alloca(__Xnullarg);
+#        endif
+#        define ALLOCATE_LOCAL(size) alloca((int)(size))
+#      endif /* who does alloca */
+#  endif /* __GNUC__ */
+
+#endif /* NO_ALLOCA */
+
+#if !defined(ALLOCATE_LOCAL)
+#  if defined(ALLOCATE_LOCAL_FALLBACK) && defined(DEALLOCATE_LOCAL_FALLBACK)
+#    define ALLOCATE_LOCAL(_size)  ALLOCATE_LOCAL_FALLBACK(_size)
+#    define DEALLOCATE_LOCAL(_ptr) DEALLOCATE_LOCAL_FALLBACK(_ptr)
+#  else /* no fallbacks supplied; error */
+#    define ALLOCATE_LOCAL(_size)  ALLOCATE_LOCAL_FALLBACK undefined!
+#    define DEALLOCATE_LOCAL(_ptr) DEALLOCATE_LOCAL_FALLBACK undefined!
+#  endif /* defined(ALLOCATE_LOCAL_FALLBACK && DEALLOCATE_LOCAL_FALLBACK) */
+#else
+#  if !defined(DEALLOCATE_LOCAL)
+#    define DEALLOCATE_LOCAL(_ptr) do {} while(0)
+#  endif
+#endif /* defined(ALLOCATE_LOCAL) */
+
+#endif /* XALLOCA_H */
diff --git a/ThirdParty/X11/Include/X11/Xarch.h b/ThirdParty/X11/Include/X11/Xarch.h
new file mode 100644
index 0000000000000000000000000000000000000000..f80c580995ba5f31b410ffd23f718ef9d3de31c8
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xarch.h
@@ -0,0 +1,94 @@
+#ifndef _XARCH_H_
+# define _XARCH_H_
+
+/*
+ * Copyright 1997 Metro Link Incorporated
+ *
+ *                           All Rights Reserved
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of the above listed copyright holder(s)
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission.  The above listed
+ * copyright holder(s) make(s) no representations about the suitability of
+ * this software for any purpose.  It is provided "as is" without express or
+ * implied warranty.
+ *
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/*
+ * Determine the machine's byte order.
+ */
+
+/* See if it is set in the imake config first */
+# ifdef X_BYTE_ORDER
+
+#  define X_BIG_ENDIAN 4321
+#  define X_LITTLE_ENDIAN 1234
+
+# else
+
+#  if defined(SVR4) || defined(__SVR4)
+#   include <sys/types.h>
+#   include <sys/byteorder.h>
+#  elif defined(CSRG_BASED)
+#   if defined(__NetBSD__) || defined(__OpenBSD__)
+#    include <sys/types.h>
+#   endif
+#   include <machine/endian.h>
+#  elif defined(linux)
+#   if defined __STRICT_ANSI__
+#    undef __STRICT_ANSI__
+#    include <endian.h>
+#    define __STRICT_ANSI__
+#   else
+#    include <endian.h>
+#   endif
+/* 'endian.h' might have been included before 'Xarch.h' */
+#   if !defined(LITTLE_ENDIAN) && defined(__LITTLE_ENDIAN)
+#    define LITTLE_ENDIAN __LITTLE_ENDIAN
+#   endif
+#   if !defined(BIG_ENDIAN) && defined(__BIG_ENDIAN)
+#    define BIG_ENDIAN __BIG_ENDIAN
+#   endif
+#   if !defined(PDP_ENDIAN) && defined(__PDP_ENDIAN)
+#    define PDP_ENDIAN __PDP_ENDIAN
+#   endif
+#   if !defined(BYTE_ORDER) && defined(__BYTE_ORDER)
+#    define BYTE_ORDER __BYTE_ORDER
+#   endif
+#  endif
+
+#  ifndef BYTE_ORDER
+#   define LITTLE_ENDIAN 1234
+#   define BIG_ENDIAN    4321
+
+#   if defined(__sun) && defined(__SVR4)
+#    include <sys/isa_defs.h>
+#    ifdef _LITTLE_ENDIAN
+#     define BYTE_ORDER LITTLE_ENDIAN
+#    endif
+#    ifdef _BIG_ENDIAN
+#     define BYTE_ORDER BIG_ENDIAN
+#    endif
+#   endif /* sun */
+#  endif /* BYTE_ORDER */
+
+#  define X_BYTE_ORDER BYTE_ORDER
+#  define X_BIG_ENDIAN BIG_ENDIAN
+#  define X_LITTLE_ENDIAN LITTLE_ENDIAN
+
+# endif /* not in imake config */
+
+#endif /* _XARCH_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xatom.h b/ThirdParty/X11/Include/X11/Xatom.h
new file mode 100644
index 0000000000000000000000000000000000000000..485a4236db858364b3b9b7c2d7495c9984a1ba7c
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xatom.h
@@ -0,0 +1,79 @@
+#ifndef XATOM_H
+#define XATOM_H 1
+
+/* THIS IS A GENERATED FILE
+ *
+ * Do not change!  Changing this file implies a protocol change!
+ */
+
+#define XA_PRIMARY ((Atom) 1)
+#define XA_SECONDARY ((Atom) 2)
+#define XA_ARC ((Atom) 3)
+#define XA_ATOM ((Atom) 4)
+#define XA_BITMAP ((Atom) 5)
+#define XA_CARDINAL ((Atom) 6)
+#define XA_COLORMAP ((Atom) 7)
+#define XA_CURSOR ((Atom) 8)
+#define XA_CUT_BUFFER0 ((Atom) 9)
+#define XA_CUT_BUFFER1 ((Atom) 10)
+#define XA_CUT_BUFFER2 ((Atom) 11)
+#define XA_CUT_BUFFER3 ((Atom) 12)
+#define XA_CUT_BUFFER4 ((Atom) 13)
+#define XA_CUT_BUFFER5 ((Atom) 14)
+#define XA_CUT_BUFFER6 ((Atom) 15)
+#define XA_CUT_BUFFER7 ((Atom) 16)
+#define XA_DRAWABLE ((Atom) 17)
+#define XA_FONT ((Atom) 18)
+#define XA_INTEGER ((Atom) 19)
+#define XA_PIXMAP ((Atom) 20)
+#define XA_POINT ((Atom) 21)
+#define XA_RECTANGLE ((Atom) 22)
+#define XA_RESOURCE_MANAGER ((Atom) 23)
+#define XA_RGB_COLOR_MAP ((Atom) 24)
+#define XA_RGB_BEST_MAP ((Atom) 25)
+#define XA_RGB_BLUE_MAP ((Atom) 26)
+#define XA_RGB_DEFAULT_MAP ((Atom) 27)
+#define XA_RGB_GRAY_MAP ((Atom) 28)
+#define XA_RGB_GREEN_MAP ((Atom) 29)
+#define XA_RGB_RED_MAP ((Atom) 30)
+#define XA_STRING ((Atom) 31)
+#define XA_VISUALID ((Atom) 32)
+#define XA_WINDOW ((Atom) 33)
+#define XA_WM_COMMAND ((Atom) 34)
+#define XA_WM_HINTS ((Atom) 35)
+#define XA_WM_CLIENT_MACHINE ((Atom) 36)
+#define XA_WM_ICON_NAME ((Atom) 37)
+#define XA_WM_ICON_SIZE ((Atom) 38)
+#define XA_WM_NAME ((Atom) 39)
+#define XA_WM_NORMAL_HINTS ((Atom) 40)
+#define XA_WM_SIZE_HINTS ((Atom) 41)
+#define XA_WM_ZOOM_HINTS ((Atom) 42)
+#define XA_MIN_SPACE ((Atom) 43)
+#define XA_NORM_SPACE ((Atom) 44)
+#define XA_MAX_SPACE ((Atom) 45)
+#define XA_END_SPACE ((Atom) 46)
+#define XA_SUPERSCRIPT_X ((Atom) 47)
+#define XA_SUPERSCRIPT_Y ((Atom) 48)
+#define XA_SUBSCRIPT_X ((Atom) 49)
+#define XA_SUBSCRIPT_Y ((Atom) 50)
+#define XA_UNDERLINE_POSITION ((Atom) 51)
+#define XA_UNDERLINE_THICKNESS ((Atom) 52)
+#define XA_STRIKEOUT_ASCENT ((Atom) 53)
+#define XA_STRIKEOUT_DESCENT ((Atom) 54)
+#define XA_ITALIC_ANGLE ((Atom) 55)
+#define XA_X_HEIGHT ((Atom) 56)
+#define XA_QUAD_WIDTH ((Atom) 57)
+#define XA_WEIGHT ((Atom) 58)
+#define XA_POINT_SIZE ((Atom) 59)
+#define XA_RESOLUTION ((Atom) 60)
+#define XA_COPYRIGHT ((Atom) 61)
+#define XA_NOTICE ((Atom) 62)
+#define XA_FONT_NAME ((Atom) 63)
+#define XA_FAMILY_NAME ((Atom) 64)
+#define XA_FULL_NAME ((Atom) 65)
+#define XA_CAP_HEIGHT ((Atom) 66)
+#define XA_WM_CLASS ((Atom) 67)
+#define XA_WM_TRANSIENT_FOR ((Atom) 68)
+
+#define XA_LAST_PREDEFINED ((Atom) 68)
+#endif /* XATOM_H */
diff --git a/ThirdParty/X11/Include/X11/Xauth.h b/ThirdParty/X11/Include/X11/Xauth.h
new file mode 100644
index 0000000000000000000000000000000000000000..a707bed8cc519b361518578a08621ff9b2dbaf88
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xauth.h
@@ -0,0 +1,149 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _Xauth_h
+#define _Xauth_h
+
+/* struct xauth is full of implicit padding to properly align the pointers
+   after the length fields.   We can't clean that up without breaking ABI,
+   so tell clang not to bother complaining about it. */
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+#endif
+
+typedef struct xauth {
+    unsigned short   family;
+    unsigned short   address_length;
+    char    	    *address;
+    unsigned short   number_length;
+    char    	    *number;
+    unsigned short   name_length;
+    char    	    *name;
+    unsigned short   data_length;
+    char   	    *data;
+} Xauth;
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+#ifndef _XAUTH_STRUCT_ONLY
+
+# include   <X11/Xfuncproto.h>
+# include   <X11/Xfuncs.h>
+
+# include   <stdio.h>
+
+# define FamilyLocal (256)	/* not part of X standard (i.e. X.h) */
+# define FamilyWild  (65535)
+# define FamilyNetname    (254)   /* not part of X standard */
+# define FamilyKrb5Principal (253) /* Kerberos 5 principal name */
+# define FamilyLocalHost (252)	/* for local non-net authentication */
+
+
+_XFUNCPROTOBEGIN
+
+char *XauFileName(void);
+
+Xauth *XauReadAuth(
+FILE*	/* auth_file */
+);
+
+int XauLockAuth(
+_Xconst char*	/* file_name */,
+int		/* retries */,
+int		/* timeout */,
+long		/* dead */
+);
+
+int XauUnlockAuth(
+_Xconst char*	/* file_name */
+);
+
+int XauWriteAuth(
+FILE*		/* auth_file */,
+Xauth*		/* auth */
+);
+
+Xauth *XauGetAuthByAddr(
+#if NeedWidePrototypes
+unsigned int	/* family */,
+unsigned int	/* address_length */,
+#else
+unsigned short	/* family */,
+unsigned short	/* address_length */,
+#endif
+_Xconst char*	/* address */,
+#if NeedWidePrototypes
+unsigned int	/* number_length */,
+#else
+unsigned short	/* number_length */,
+#endif
+_Xconst char*	/* number */,
+#if NeedWidePrototypes
+unsigned int	/* name_length */,
+#else
+unsigned short	/* name_length */,
+#endif
+_Xconst char*	/* name */
+);
+
+Xauth *XauGetBestAuthByAddr(
+#if NeedWidePrototypes
+unsigned int	/* family */,
+unsigned int	/* address_length */,
+#else
+unsigned short	/* family */,
+unsigned short	/* address_length */,
+#endif
+_Xconst char*	/* address */,
+#if NeedWidePrototypes
+unsigned int	/* number_length */,
+#else
+unsigned short	/* number_length */,
+#endif
+_Xconst char*	/* number */,
+int		/* types_length */,
+char**		/* type_names */,
+_Xconst int*	/* type_lengths */
+);
+
+void XauDisposeAuth(
+Xauth*		/* auth */
+);
+
+_XFUNCPROTOEND
+
+/* Return values from XauLockAuth */
+
+# define LOCK_SUCCESS	0	/* lock succeeded */
+# define LOCK_ERROR	1	/* lock unexpectely failed, check errno */
+# define LOCK_TIMEOUT	2	/* lock failed, timeouts expired */
+
+#endif /* _XAUTH_STRUCT_ONLY */
+
+#endif /* _Xauth_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/AllWidgets.h b/ThirdParty/X11/Include/X11/Xaw/AllWidgets.h
new file mode 100644
index 0000000000000000000000000000000000000000..5c125d53fbd7c8fd50c4d701a968faa1eb4ac68c
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/AllWidgets.h
@@ -0,0 +1,37 @@
+/*
+ *
+Copyright 1990, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+#ifndef _XawAllWidgets_h
+#define _XawAllWidgets_h
+
+#include <X11/Xmu/WidgetNode.h>
+
+/*
+ * This file matches the generated AllWidgets.c
+ */
+extern XmuWidgetNode XawWidgetArray[];
+extern int           XawWidgetCount;
+
+#endif /* _XawAllWidgets_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/AsciiSink.h b/ThirdParty/X11/Include/X11/Xaw/AsciiSink.h
new file mode 100644
index 0000000000000000000000000000000000000000..27d8f48c5d177cd74f6bf9fbda13547ca97c425c
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/AsciiSink.h
@@ -0,0 +1,77 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XawAsciiSink_h
+#define _XawAsciiSink_h
+
+/*
+ * AsciiSink Object
+ */
+
+#include <X11/Xaw/TextSink.h>
+
+/* Resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ echo                Output             Boolean         True
+ displayNonprinting  Output             Boolean         True
+
+*/
+
+#define XtCOutput "Output"
+
+#define XtNdisplayNonprinting "displayNonprinting"
+#define XtNecho "echo"
+
+/* Class record constants */
+extern WidgetClass asciiSinkObjectClass;
+
+typedef struct _AsciiSinkClassRec *AsciiSinkObjectClass;
+typedef struct _AsciiSinkRec      *AsciiSinkObject;
+
+#endif /* _XawAsciiSink_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/AsciiSinkP.h b/ThirdParty/X11/Include/X11/Xaw/AsciiSinkP.h
new file mode 100644
index 0000000000000000000000000000000000000000..4bf440acb4c8158bcaadc6e1c518a5403f0f529a
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/AsciiSinkP.h
@@ -0,0 +1,95 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XawAsciiSinkP_h
+#define _XawAsciiSinkP_h
+
+/*
+ * AsciiSink Object Private Data
+ */
+#include <X11/Xaw/TextSinkP.h>
+#include <X11/Xaw/AsciiSink.h>
+
+/* New fields for the AsciiSink object class record */
+typedef struct _AsciiSinkClassPart {
+    XtPointer extension;
+} AsciiSinkClassPart;
+
+/* Full class record declaration */
+typedef struct _AsciiSinkClassRec {
+    ObjectClassPart     object_class;
+    TextSinkClassPart	text_sink_class;
+    AsciiSinkClassPart	ascii_sink_class;
+} AsciiSinkClassRec;
+
+extern AsciiSinkClassRec asciiSinkClassRec;
+
+/* New fields for the AsciiSink object record */
+typedef struct {
+    /* resources */
+    XFontStruct *font;          /* Font to draw in. */
+    Boolean echo;
+    Boolean display_nonprinting;
+
+    /* private */
+    GC normgc, invgc, xorgc;
+    XawTextPosition cursor_position;
+    XawTextInsertState laststate;
+    short cursor_x, cursor_y;	/* Cursor Location. */
+#ifndef OLDXAW
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} AsciiSinkPart;
+
+/* Full instance record declaration */
+typedef struct _AsciiSinkRec {
+    ObjectPart          object;
+    TextSinkPart	text_sink;
+    AsciiSinkPart	ascii_sink;
+} AsciiSinkRec;
+
+#endif /* _XawAsciiSinkP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/AsciiSrc.h b/ThirdParty/X11/Include/X11/Xaw/AsciiSrc.h
new file mode 100644
index 0000000000000000000000000000000000000000..08c5f8c26f341e3745d3a0834139825742eb680a
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/AsciiSrc.h
@@ -0,0 +1,172 @@
+/*
+
+Copyright 1989, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+
+/*
+ * AsciiSrc.h - Public Header file for Ascii Text Source.
+ *
+ * This is the public header file for the Ascii Text Source.
+ * It is intended to be used with the Text widget, the simplest way to use
+ * this text source is to use the AsciiText Object.
+ *
+ * Date:    June 29, 1989
+ *
+ * By:      Chris D. Peterson
+ *          MIT X Consortium
+ *          kit@expo.lcs.mit.edu
+ */
+
+
+#ifndef _XawAsciiSrc_h
+#define _XawAsciiSrc_h
+
+#include <X11/Xaw/TextSrc.h>
+
+/* Resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ dataCompression     DataCompression	Boolean		True
+ length		     Length		int		(internal)
+ pieceSize	     PieceSize		int		BUFSIZ
+ string		     String		String		NULL
+ type		     Type		XawAsciiType	XawAsciiString
+ useStringInPlace    UseStringInPlace	Boolean		False
+
+*/
+
+extern WidgetClass asciiSrcObjectClass;
+
+typedef struct _AsciiSrcClassRec *AsciiSrcObjectClass;
+typedef struct _AsciiSrcRec      *AsciiSrcObject;
+
+#define AsciiSourceObjectClass AsciiSrcObjectClass
+#define AsciiSourceObject      AsciiSrcObject
+
+/*
+ * Resource Definitions
+ */
+#define XtCDataCompression "DataCompression"
+#define XtCPieceSize "PieceSize"
+#define XtCType "Type"
+#define XtCUseStringInPlace "UseStringInPlace"
+
+#define XtNdataCompression "dataCompression"
+#define XtNpieceSize "pieceSize"
+#define XtNtype "type"
+#define XtNuseStringInPlace "useStringInPlace"
+
+#define XtRAsciiType "AsciiType"
+
+#define XtEstring "string"
+#define XtEfile "file"
+
+typedef enum {
+  XawAsciiFile,
+  XawAsciiString
+} XawAsciiType;
+
+/*
+ * Public routines
+ */
+
+_XFUNCPROTOBEGIN
+
+/*
+ * Function:
+ *	XawAsciiSourceFreeString
+ *
+ * Parameters:
+ *	w - AsciiSrc object
+ *
+ * Description:
+ *	  Frees the string returned by a get values call
+ *		     on the string when the source is of type string.
+ */
+void XawAsciiSourceFreeString
+(
+ Widget		w
+ );
+
+/*
+ * Function:
+ *	XawAsciiSave
+ *
+ * Arguments:
+ *	w - asciiSrc Object.
+ *
+ * Description:
+ *	Saves all the pieces into a file or string as required.
+ *
+ * Returns:
+ *	True if the save was successful
+ */
+Bool XawAsciiSave
+(
+ Widget		w
+ );
+
+/*
+ * Function:
+ *	XawAsciiSaveAsFile
+ *
+ * Parameters:
+ *	w    - asciiSrc object
+ *	name - name of the file to save this file into
+ *
+ * Description:
+ *	Save the current buffer as a file.
+ *
+ * Returns:
+ *	True if the save was successful
+ */
+Bool XawAsciiSaveAsFile
+(
+ Widget		w,
+ _Xconst char	*name
+ );
+
+/*
+ * Function:
+ *	XawAsciiSourceChanged
+ *
+ * Parameters:
+ *	w - asciiSource object
+ *
+ * Description:
+ *	Returns true if the source has changed since last saved.
+ *
+ * Returns:
+ *	a Boolean (see description)
+ */
+Bool XawAsciiSourceChanged
+(
+ Widget		w
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XawAsciiSrc_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/AsciiSrcP.h b/ThirdParty/X11/Include/X11/Xaw/AsciiSrcP.h
new file mode 100644
index 0000000000000000000000000000000000000000..1f3f06eecafe5819f70b2051731ab98ec5276eca
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/AsciiSrcP.h
@@ -0,0 +1,139 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ * AsciiSrcP.h - Private Header for Ascii Text Source.
+ *
+ * This is the private header file for the Ascii Text Source.
+ * It is intended to be used with the Text widget, the simplest way to use
+ * this text source is to use the AsciiText Object.
+ *
+ * Date:    June 29, 1989
+ *
+ * By:      Chris D. Peterson
+ *          MIT X Consortium
+ *          kit@expo.lcs.mit.edu
+ */
+
+#ifndef _XawAsciiSrcP_h
+#define _XawAsciiSrcP_h
+
+#include <X11/Xaw/TextSrcP.h>
+#include <X11/Xaw/AsciiSrc.h>
+
+#ifdef L_tmpnam
+#define TMPSIZ L_tmpnam
+#else
+#ifdef PATH_MAX
+#define TMPSIZ PATH_MAX
+#else
+#define TMPSIZ 1024		/* bytes to allocate for tmpnam */
+#endif
+#endif
+
+typedef struct _Piece {		/* Piece of the text file of BUFSIZ allocated
+				   characters */
+    char *text;			/* The text in this buffer */
+    XawTextPosition used;	/* The number of characters of this buffer
+				   that have been used */
+    struct _Piece *prev, *next;	/* linked list pointers */
+} Piece;
+
+typedef struct _AsciiSrcClassPart {
+    XtPointer extension;
+} AsciiSrcClassPart;
+
+/* Full class record */
+typedef struct _AsciiSrcClassRec {
+    ObjectClassPart     object_class;
+    TextSrcClassPart	text_src_class;
+    AsciiSrcClassPart	ascii_src_class;
+} AsciiSrcClassRec;
+
+extern AsciiSrcClassRec asciiSrcClassRec;
+
+/* New fields for the AsciiSrc object */
+typedef struct _AsciiSrcPart {
+    /* resources */
+    char *string;		/* either the string, or the
+				   file name, depending upon the type */
+    XawAsciiType type;		/* either string or disk */
+    XawTextPosition piece_size;	/* Size of text buffer for each piece */
+    Boolean data_compression;	/* compress to minimum memory automatically
+				   on save? */
+#ifdef OLDXAW
+    XtCallbackList callback;
+#endif
+    Boolean use_string_in_place;/* Use the string passed in place */
+    int ascii_length;		/* length field for ascii string emulation */
+
+#ifdef ASCII_DISK
+    String filename;		/* name of file for Compatability */
+#endif /* ASCII_DISK */
+
+    /* private */
+    Boolean is_tempfile;	/* Is this a temporary file? */
+#ifdef OLDXAW
+    Boolean changes;
+#endif
+    Boolean allocated_string;	/* Have I allocated the
+				   string in ascii_src->string? */
+    XawTextPosition length;	/* length of file */
+    Piece *first_piece;		/* first piece of the text */
+#ifndef OLDXAW
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} AsciiSrcPart;
+
+/* instance record */
+typedef struct _AsciiSrcRec {
+    ObjectPart    object;
+    TextSrcPart   text_src;
+    AsciiSrcPart  ascii_src;
+} AsciiSrcRec;
+
+#endif /* _XawAsciiSrcP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/AsciiText.h b/ThirdParty/X11/Include/X11/Xaw/AsciiText.h
new file mode 100644
index 0000000000000000000000000000000000000000..b0b3cd9a6cec202f2b8cd29a60ae1cd79c08b18d
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/AsciiText.h
@@ -0,0 +1,123 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ * AsciiText.h - Public header file for AsciiText Widget
+ *
+ * This Widget is intended to be used as a simple front end to the
+ * text widget with an ascii source and ascii sink attached to it
+ *
+ * Date:    June 29, 1989
+ *
+ * By:      Chris D. Peterson
+ *          MIT X Consortium
+ *          kit@expo.lcs.mit.edu
+ */
+#ifndef _AsciiText_h
+#define _AsciiText_h
+
+#include <X11/Xaw/Text.h>
+#include <X11/Xaw/AsciiSrc.h>
+#include <X11/Xaw/MultiSrc.h>
+
+/* Resources:
+
+ Name		     Class		RepType		  Default Value
+ ----		     -----		-------		  -------------
+ autoFill	     AutoFill		Boolean		  False
+ background	     Background		Pixel		  XtDefaultBackground
+ border		     BorderColor	Pixel		  XtDefaultForeground
+ borderWidth	     BorderWidth	Dimension	  1
+ bottomMargin	     Margin		Position	  2
+ cursor		     Cursor		Cursor		  xterm
+ destroyCallback     Callback		Pointer		  NULL
+ displayCaret	     Output		Boolean		  True
+ displayPosition     TextPosition	int		  0
+ editType	     EditType		XawTextEditType	  XawtextRead
+ font		     Font		XFontStruct*	  Fixed
+ foreground	     Foreground		Pixel		  Black
+ height		     Height		Dimension	  font height
+ insertPosition	     TextPosition	int		  0
+ international	     International		Boolean		false
+ leftMargin	     Margin		Position	  2
+ mappedWhenManaged   MappedWhenManaged	Boolean		  True
+ resize		     Resize		XawTextResizeMode XawtextResizeNever
+ rightMargin	     Margin		Position	  4
+ scrollHorizontal    Scroll		XawTextScrollMode XawtextScrollNever
+ scrollVertical	     Scroll		XawTextScrollMode XawtextScrollNever
+ selectTypes	     SelectTypes	Pointer		  pos/word/line/par/all
+ selection	     Selection		Pointer		  (empty selection)
+ sensitive	     Sensitive		Boolean		  True
+ sink		     TextSink		Widget		  (none)
+ source		     TextSource		Widget		  (none)
+ string		     String		String		  NULL
+ topMargin	     Margin		Position	  2
+ width		     Width		Dimension	  100
+ wrap		     Wrap		XawTextWrapMode	  XawtextWrapNever
+ x		     Position		Position	  0
+ y		     Position		Position	  0
+
+ (see also *Src.h and *Sink.h)
+*/
+
+typedef struct _AsciiTextClassRec	*AsciiTextWidgetClass;
+typedef struct _AsciiRec	        *AsciiWidget;
+
+extern WidgetClass asciiTextWidgetClass;
+
+/*
+ * Disk and String Emulation Info
+ */
+#ifdef ASCII_STRING
+extern WidgetClass asciiStringWidgetClass;
+#endif
+
+#ifdef ASCII_DISK
+extern WidgetClass asciiDiskWidgetClass;
+#endif
+
+#endif /* _AsciiText_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/AsciiTextP.h b/ThirdParty/X11/Include/X11/Xaw/AsciiTextP.h
new file mode 100644
index 0000000000000000000000000000000000000000..f91c362410099c4b29892aecf129f23509fb40b3
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/AsciiTextP.h
@@ -0,0 +1,164 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ * AsciiText.c - Private header file for AsciiText Widget.
+ *
+ * This Widget is intended to be used as a simple front end to the
+ * text widget with an ascii source and ascii sink attached to it.
+ *
+ * Date:    June 29, 1989
+ *
+ * By:      Chris D. Peterson
+ *          MIT X Consortium
+ *          kit@expo.lcs.mit.edu
+ */
+
+#ifndef _AsciiTextP_h
+#define _AsciiTextP_h
+
+#include <X11/Xaw/TextP.h>
+#include <X11/Xaw/AsciiText.h>
+#include <X11/Xaw/AsciiSrc.h>
+#include <X11/Xaw/MultiSrc.h>
+
+typedef struct {
+  XtPointer extension;
+} AsciiClassPart;
+
+typedef struct _AsciiTextClassRec {
+    CoreClassPart	core_class;
+    SimpleClassPart	simple_class;
+    TextClassPart	text_class;
+    AsciiClassPart	ascii_class;
+} AsciiTextClassRec;
+
+extern AsciiTextClassRec asciiTextClassRec;
+
+typedef struct {
+    int resource;
+#ifndef OLDXAW
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} AsciiPart;
+
+typedef struct _AsciiRec {
+    CorePart		core;
+    SimplePart		simple;
+    TextPart		text;
+    AsciiPart		ascii;
+} AsciiRec;
+
+/*
+ * Ascii String Emulation widget
+ */
+#ifdef ASCII_STRING
+typedef struct {
+  XtPointer extension;
+} AsciiStringClassPart;
+
+typedef struct _AsciiStringClassRec {
+    CoreClassPart	core_class;
+    SimpleClassPart	simple_class;
+    TextClassPart	text_class;
+    AsciiClassPart	ascii_class;
+    AsciiStringClassPart string_class;
+} AsciiStringClassRec;
+
+extern AsciiStringClassRec asciiStringClassRec;
+
+typedef struct {
+    int resource;
+#ifndef OLDXAW
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} AsciiStringPart;
+
+typedef struct _AsciiStringRec {
+    CorePart		core;
+    SimplePart		simple;
+    TextPart		text;
+    AsciiPart           ascii;
+    AsciiStringPart     ascii_str;
+} AsciiStringRec;
+#endif /* ASCII_STRING */
+
+#ifdef ASCII_DISK
+/*
+ * Ascii Disk Emulation widget
+ */
+typedef struct {
+    XtPointer extension;
+} AsciiDiskClassPart;
+
+typedef struct _AsciiDiskClassRec {
+    CoreClassPart	core_class;
+    SimpleClassPart	simple_class;
+    TextClassPart	text_class;
+    AsciiClassPart	ascii_class;
+    AsciiDiskClassPart	disk_class;
+} AsciiDiskClassRec;
+
+extern AsciiDiskClassRec asciiDiskClassRec;
+
+typedef struct {
+    char resource;
+#ifndef OLDXAW
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} AsciiDiskPart;
+
+typedef struct _AsciiDiskRec {
+    CorePart		core;
+    SimplePart		simple;
+    TextPart		text;
+    AsciiPart           ascii;
+    AsciiDiskPart       ascii_disk;
+} AsciiDiskRec;
+#endif /* ASCII_DISK */
+
+#endif /* _AsciiTextP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/Box.h b/ThirdParty/X11/Include/X11/Xaw/Box.h
new file mode 100644
index 0000000000000000000000000000000000000000..9eb1884d9f927a1a82dbb8feeca0031d8e1744dc
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/Box.h
@@ -0,0 +1,102 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XawBox_h
+#define _XawBox_h
+
+#include <X11/Xmu/Converters.h>
+
+/*
+ * Box Widget (subclass of CompositeClass)
+ */
+
+/* Resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ background	     Background		Pixel		XtDefaultBackground
+ border		     BorderColor	Pixel		XtDefaultForeground
+ borderWidth	     BorderWidth	Dimension	1
+ destroyCallback     Callback		Pointer		NULL
+ displayList	     DisplayList	XawDisplayList*	NULL
+ hSpace		     HSpace		Dimension	4
+ height		     Height		Dimension	0
+ mappedWhenManaged   MappedWhenManaged	Boolean		True
+ orientation	     Orientation	XtOrientation	vertical
+ vSpace		     VSpace		Dimension	4
+ width		     Width		Dimension	0
+ x		     Position		Position	0
+ y		     Position		Position	0
+
+*/
+
+#ifndef _XtStringDefs_h_
+#define XtNhSpace "hSpace"
+#define XtNvSpace "vSpace"
+#endif
+
+#ifndef OLDXAW
+#ifndef XawNdisplayList
+#define XawNdisplayList "displayList"
+#endif
+
+#ifndef XawCDisplayList
+#define XawCDisplayList "DisplayList"
+#endif
+
+#ifndef XawRDisplayList
+#define XawRDisplayList "XawDisplayList"
+#endif
+#endif /* OLDXAW */
+
+/* Class record constants */
+extern WidgetClass boxWidgetClass;
+
+typedef struct _BoxClassRec *BoxWidgetClass;
+typedef struct _BoxRec      *BoxWidget;
+
+#endif /* _XawBox_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/BoxP.h b/ThirdParty/X11/Include/X11/Xaw/BoxP.h
new file mode 100644
index 0000000000000000000000000000000000000000..b3c2573b1f4fc7bcf7f2bfdda1a146a34db5a221
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/BoxP.h
@@ -0,0 +1,97 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XawBoxP_h
+#define _XawBoxP_h
+
+/*
+ * Box Widget Private Data
+ */
+#include <X11/Xaw/Box.h>
+#include <X11/Xmu/Converters.h>
+#include <X11/Xaw/XawInit.h>
+
+/* New fields for the Box widget class record */
+typedef struct {
+    XtPointer extension;
+} BoxClassPart;
+
+/* Full class record declaration */
+typedef struct _BoxClassRec {
+    CoreClassPart	core_class;
+    CompositeClassPart  composite_class;
+    BoxClassPart	box_class;
+} BoxClassRec;
+
+extern BoxClassRec boxClassRec;
+
+/* New fields for the Box widget record */
+typedef struct {
+    /* resources */
+    Dimension h_space, v_space;
+    XtOrientation orientation;
+
+    /* private state */
+    Dimension preferred_width, preferred_height;
+    Dimension last_query_width, last_query_height;
+    XtGeometryMask last_query_mode;
+#ifndef OLDXAW
+    XawDisplayList *display_list;
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} BoxPart;
+
+/*
+ * Full instance record declaration
+ */
+typedef struct _BoxRec {
+    CorePart	    core;
+    CompositePart   composite;
+    BoxPart	    box;
+} BoxRec;
+
+#endif /* _XawBoxP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/Cardinals.h b/ThirdParty/X11/Include/X11/Xaw/Cardinals.h
new file mode 100644
index 0000000000000000000000000000000000000000..9a754c165882d958a7cd8831ee2f8bb2068200e5
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/Cardinals.h
@@ -0,0 +1,42 @@
+/*
+
+Copyright 1985, 1986, 1987, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _Cardinals_h
+#define _Cardinals_h
+
+#define ZERO	((Cardinal)0)
+#define ONE	((Cardinal)1)
+#define TWO	((Cardinal)2)
+#define THREE	((Cardinal)3)
+#define FOUR	((Cardinal)4)
+#define FIVE	((Cardinal)5)
+#define SIX	((Cardinal)6)
+#define SEVEN	((Cardinal)7)
+#define EIGHT	((Cardinal)8)
+#define NINE	((Cardinal)9)
+#define TEN	((Cardinal)10)
+
+#endif /* _Cardinals_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/Command.h b/ThirdParty/X11/Include/X11/Xaw/Command.h
new file mode 100644
index 0000000000000000000000000000000000000000..7011fde6e579d361e18f14b422b6b0e8c4c1fdc4
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/Command.h
@@ -0,0 +1,116 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XawCommand_h
+#define _XawCommand_h
+
+#include <X11/Xaw/Label.h>
+
+/* Command widget resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ accelerators	     Accelerators	AcceleratorTable NULL
+ ancestorSensitive   AncestorSensitive	Boolean		True
+ background	     Background		Pixel		XtDefaultBackground
+ backgroundPixmap    Pixmap		Pixmap		XtUnspecifiedPixmap
+ bitmap		     Pixmap		Pixmap		None
+ borderColor	     BorderColor	Pixel		XtDefaultForeground
+ borderPixmap	     Pixmap		Pixmap		XtUnspecifiedPixmap
+ borderWidth	     BorderWidth	Dimension	1
+ callback	     Callback		XtCallbackList	NULL
+ colormap	     Colormap		Colormap	parent's colormap
+ cornerRoundPercent  CornerRoundPercent	Dimension	25
+ cursor		     Cursor		Cursor		None
+ cursorName	     Cursor		String		NULL
+ depth		     Depth		int		parent's depth
+ destroyCallback     Callback		XtCallbackList	NULL
+ displayList	     DisplayList	XawDisplayList*	NULL
+ encoding	     Encoding		UnsignedChar	XawTextEncoding8bit
+ font		     Font		XFontStruct*	XtDefaultFont
+ foreground	     Foreground		Pixel		XtDefaultForeground
+ height		     Height		Dimension	text height
+ highlightThickness  Thickness		Dimension	0 if shaped, else 2
+ insensitiveBorder   Insensitive	Pixmap		Gray
+ internalHeight	     Height		Dimension	2
+ internalWidth	     Width		Dimension	4
+ justify	     Justify		XtJustify	XtJustifyCenter
+ label		     Label		String		NULL
+ leftBitmap	     LeftBitmap		Pixmap		None
+ mappedWhenManaged   MappedWhenManaged	Boolean		True
+ pointerColor	     Foreground		Pixel		XtDefaultForeground
+ pointerColorBackground Background	Pixel		XtDefaultBackground
+ resize		     Resize		Boolean		True
+ screen		     Screen		Screen		parent's Screen
+ sensitive	     Sensitive		Boolean		True
+ shapeStyle	     ShapeStyle		ShapeStyle	Rectangle
+ translations	     Translations	TranslationTable see doc or source
+ width		     Width		Dimension	text width
+ x		     Position		Position	0
+ y		     Position		Position	0
+
+*/
+
+#define XtNhighlightThickness "highlightThickness"
+
+#define XtNshapeStyle "shapeStyle"
+#define XtCShapeStyle "ShapeStyle"
+#define XtRShapeStyle "ShapeStyle"
+#define XtNcornerRoundPercent "cornerRoundPercent"
+#define XtCCornerRoundPercent "CornerRoundPercent"
+
+#define XawShapeRectangle XmuShapeRectangle
+#define XawShapeOval XmuShapeOval
+#define XawShapeEllipse XmuShapeEllipse
+#define XawShapeRoundedRectangle XmuShapeRoundedRectangle
+
+extern WidgetClass     commandWidgetClass;
+
+typedef struct _CommandClassRec   *CommandWidgetClass;
+typedef struct _CommandRec        *CommandWidget;
+
+#endif /* _XawCommand_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/CommandP.h b/ThirdParty/X11/Include/X11/Xaw/CommandP.h
new file mode 100644
index 0000000000000000000000000000000000000000..d0be64edfd5ff5dd19997ebb027b34485dc41b1c
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/CommandP.h
@@ -0,0 +1,111 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XawCommandP_h
+#define _XawCommandP_h
+
+/*
+ * Command Widget Private Data
+ */
+#include <X11/Xaw/Command.h>
+#include <X11/Xaw/LabelP.h>
+
+typedef enum {
+    HighlightNone,		/* Do not highlight */
+    HighlightWhenUnset,		/* Highlight only when unset, this is
+				   to preserve current command widget
+				   functionality */
+    HighlightAlways		/* Always highlight, lets the toggle widget
+				   and other subclasses do the right thing */
+} XtCommandHighlight;
+
+/* New fields for the Command widget class record */
+typedef struct _CommandClass {
+    XtPointer extension;
+} CommandClassPart;
+
+/* Full class record declaration */
+typedef struct _CommandClassRec {
+    CoreClassPart	core_class;
+    SimpleClassPart	simple_class;
+    LabelClassPart	label_class;
+    CommandClassPart    command_class;
+} CommandClassRec;
+
+extern CommandClassRec commandClassRec;
+
+/* New fields for the Command widget record */
+typedef struct {
+    /* resources */
+    Dimension   highlight_thickness;
+    XtCallbackList callbacks;
+
+    /* private state */
+    Pixmap	gray_pixmap;
+    GC		normal_GC;
+    GC		inverse_GC;
+    Boolean	set;
+    XtCommandHighlight	highlighted;
+
+    /* more resources */
+    int			shape_style;
+    Dimension		corner_round;
+
+#ifndef OLDXAW
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} CommandPart;
+
+/* Full widget declaration */
+typedef struct _CommandRec {
+    CorePart         core;
+    SimplePart	     simple;
+    LabelPart	     label;
+    CommandPart      command;
+} CommandRec;
+
+#endif /* _XawCommandP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/Dialog.h b/ThirdParty/X11/Include/X11/Xaw/Dialog.h
new file mode 100644
index 0000000000000000000000000000000000000000..442d2d2f77e7dc7c25e00fccda1023308d9848ed
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/Dialog.h
@@ -0,0 +1,98 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XawDialog_h
+#define _XawDialog_h
+
+#include <X11/Xaw/Form.h>
+
+/* Resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ background	     Background		Pixel		XtDefaultBackground
+ borderColor	     BorderColor	Pixel		XtDefaultForeground
+ borderWidth	     BorderWidth	Dimension	1
+ destroyCallback     Callback		Pointer		NULL
+ height		     Height		Dimension	computed at create
+ icon		     Icon		Pixmap		0
+ label		     Label		String		NULL
+ mappedWhenManaged   MappedWhenManaged	Boolean		True
+ sensitive	     Sensitive		Boolean		True
+ value		     Value		String		NULL
+ width		     Width		Dimension	computed at create
+ x		     Position		Position	0
+ y		     Position		Position	0
+
+*/
+
+#define XtCIcon "Icon"
+#define XtNicon "icon"
+
+typedef struct _DialogClassRec	*DialogWidgetClass;
+typedef struct _DialogRec	*DialogWidget;
+
+extern WidgetClass dialogWidgetClass;
+
+_XFUNCPROTOBEGIN
+
+void XawDialogAddButton
+(
+ Widget			dialog,
+ _Xconst char		*name,
+ XtCallbackProc		function,
+ XtPointer		client_data
+ );
+
+char *XawDialogGetValueString
+(
+ Widget			w
+);
+
+_XFUNCPROTOEND
+
+#endif /* _XawDialog_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/DialogP.h b/ThirdParty/X11/Include/X11/Xaw/DialogP.h
new file mode 100644
index 0000000000000000000000000000000000000000..8fb47353c088b2afc956c1d480e54d841e836673
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/DialogP.h
@@ -0,0 +1,100 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _DialogP_h
+#define _DialogP_h
+
+#include <X11/Xaw/Dialog.h>
+#include <X11/Xaw/FormP.h>
+
+typedef struct {
+    XtPointer extension;
+} DialogClassPart;
+
+typedef struct _DialogClassRec {
+    CoreClassPart	core_class;
+    CompositeClassPart	composite_class;
+    ConstraintClassPart	constraint_class;
+    FormClassPart	form_class;
+    DialogClassPart	dialog_class;
+} DialogClassRec;
+
+extern DialogClassRec dialogClassRec;
+
+typedef struct _DialogPart {
+    /* resources */
+    String	label;		/* description of the dialog	 */
+    String	value;		/* for the user response	 */
+    Pixmap	icon;		/* icon bitmap			 */
+
+    /* private */
+    Widget	iconW;		/* widget to display the icon	 */
+    Widget	labelW;		/* widget to display description */
+    Widget	valueW;		/* user response TextWidget	 */
+#ifndef OLDXAW
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} DialogPart;
+
+typedef struct _DialogRec {
+    CorePart		core;
+    CompositePart	composite;
+    ConstraintPart	constraint;
+    FormPart		form;
+    DialogPart		dialog;
+} DialogRec;
+
+typedef struct {
+    XtPointer extension;
+} DialogConstraintsPart;
+
+typedef struct _DialogConstraintsRec {
+    FormConstraintsPart	  form;
+    DialogConstraintsPart dialog;
+} DialogConstraintsRec, *DialogConstraints;
+
+#endif /* _DialogP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/Form.h b/ThirdParty/X11/Include/X11/Xaw/Form.h
new file mode 100644
index 0000000000000000000000000000000000000000..71a0bcceeb9343e3b6b5d094905ba33ce31301fd
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/Form.h
@@ -0,0 +1,167 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XawForm_h
+#define _XawForm_h
+
+#include <X11/Intrinsic.h>
+
+/* Resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ background	     Background		Pixel		XtDefaultBackground
+ border		     BorderColor	Pixel		XtDefaultForeground
+ borderWidth	     BorderWidth	Dimension	1
+ defaultDistance     Thickness		int		4
+ destroyCallback     Callback		Pointer		NULL
+ displayList	     DisplayList	XawDisplayList*	NULL
+ height		     Height		Dimension	computed at realize
+ mappedWhenManaged   MappedWhenManaged	Boolean		True
+ sensitive	     Sensitive		Boolean		True
+ width		     Width		Dimension	computed at realize
+ x		     Position		Position	0
+ y		     Position		Position	0
+
+*/
+
+/* Constraint parameters:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ bottom		     Edge		XtEdgeType	XtRubber
+ fromHoriz	     Widget		Widget		(left edge of form)
+ fromVert	     Widget		Widget		(top of form)
+ horizDistance	     Thickness		int		defaultDistance
+ left		     Edge		XtEdgeType	XtRubber
+ resizable	     Boolean		Boolean		False
+ right		     Edge		XtEdgeType	XtRubber
+ top		     Edge		XtEdgeType	XtRubber
+ vertDistance	     Thickness		int		defaultDistance
+
+*/
+
+
+#ifndef _XtStringDefs_h_
+#define XtNtop "top"
+#define XtRWidget "Widget"
+#endif
+
+#define XtNdefaultDistance "defaultDistance"
+#define XtNbottom "bottom"
+#define XtNleft "left"
+#define XtNright "right"
+#define XtNfromHoriz "fromHoriz"
+#define XtNfromVert "fromVert"
+#define XtNhorizDistance "horizDistance"
+#define XtNvertDistance "vertDistance"
+#define XtNresizable "resizable"
+
+#define XtCEdge "Edge"
+#define XtCWidget "Widget"
+
+typedef enum {
+    XawChainTop,		/* Keep this edge a constant distance from
+				   the top of the form */
+    XawChainBottom,		/* Keep this edge a constant distance from
+				   the bottom of the form */
+    XawChainLeft,		/* Keep this edge a constant distance from
+				   the left of the form */
+    XawChainRight,		/* Keep this edge a constant distance from
+				   the right of the form */
+    XawRubber			/* Keep this edge a proportional distance
+				   from the edges of the form */
+} XawEdgeType;
+
+#define XtEdgeType XawEdgeType
+
+#define XtChainTop XawChainTop
+#define XtChainBottom XawChainBottom
+#define XtChainLeft XawChainLeft
+#define XtChainRight XawChainRight
+#define XtRubber XawRubber
+
+#define XtEchainLeft		"chainLeft"
+#define XtEchainRight		"chainRight"
+#define XtEchainTop		"chainTop"
+#define XtEchainBottom		"chainBottom"
+#define XtErubber		"rubber"
+
+#ifndef OLDXAW
+#ifndef XawNdisplayList
+#define XawNdisplayList "displayList"
+#endif
+
+#ifndef XawCDisplayList
+#define XawCDisplayList "DisplayList"
+#endif
+
+#ifndef XawRDisplayList
+#define XawRDisplayList "XawDisplayList"
+#endif
+#endif
+
+typedef struct _FormClassRec	*FormWidgetClass;
+typedef struct _FormRec		*FormWidget;
+
+extern WidgetClass formWidgetClass;
+
+_XFUNCPROTOBEGIN
+
+void XawFormDoLayout
+(
+ Widget		w,
+#if NeedWidePrototypes
+ Bool		do_layout
+#else
+ Boolean	do_layout
+#endif
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XawForm_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/FormP.h b/ThirdParty/X11/Include/X11/Xaw/FormP.h
new file mode 100644
index 0000000000000000000000000000000000000000..43a58e9d3f2602122f04a9f6df9aefa28fe6e377
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/FormP.h
@@ -0,0 +1,139 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/* Form widget private definitions */
+
+#ifndef _XawFormP_h
+#define _XawFormP_h
+
+#include <X11/Xfuncproto.h>
+
+#include <X11/Xaw/Form.h>
+#include <X11/Xaw/XawInit.h>
+
+_XFUNCPROTOBEGIN
+
+#define XtREdgeType "EdgeType"
+
+typedef enum {
+    LayoutPending,
+    LayoutInProgress,
+    LayoutDone
+} LayoutState;
+
+#define XtInheritLayout							\
+((Boolean (*)(FormWidget, unsigned int, unsigned int, Bool))_XtInherit)
+
+typedef struct {
+    Boolean(*layout)(FormWidget, unsigned int, unsigned int, Bool);
+#ifndef OLDXAW
+    XtPointer extension;
+#endif
+} FormClassPart;
+
+typedef struct _FormClassRec {
+    CoreClassPart	core_class;
+    CompositeClassPart	composite_class;
+    ConstraintClassPart	constraint_class;
+    FormClassPart	form_class;
+} FormClassRec;
+
+extern FormClassRec formClassRec;
+
+typedef struct _FormPart {
+    /* resources */
+    int		default_spacing;    /* default distance between children */
+
+    /* private */
+    Dimension	old_width, old_height; /* reference value for *_virtual  */
+    int		no_refigure;	    /* no re-layout while > 0		 */
+    Boolean	needs_relayout;	    /* next time no_refigure == 0	 */
+    Boolean	resize_in_layout;   /* should layout() do geom request?  */
+    Dimension	preferred_width, preferred_height; /* cached from layout */
+    Boolean	resize_is_no_op;    /* Causes resize to take not action  */
+#ifndef OLDXAW
+    XawDisplayList *display_list;
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} FormPart;
+
+typedef struct _FormRec {
+    CorePart		core;
+    CompositePart	composite;
+    ConstraintPart	constraint;
+    FormPart		form;
+} FormRec;
+
+typedef struct _FormConstraintsPart {
+    /* resources */
+    XtEdgeType top, bottom, left, right;/* where to drag edge on resize */
+    int		dx;		/* desired horiz offset			*/
+    int		dy;		/* desired vertical offset		*/
+    Widget	horiz_base;	/* measure dx from here if non-null	*/
+    Widget	vert_base;	/* measure dy from here if non-null	*/
+    Boolean	allow_resize;	/* True if child may request resize	*/
+
+    /* private */
+    short	virtual_width, virtual_height;
+    Position	new_x, new_y;
+    LayoutState	layout_state;	/* temporary layout state		*/
+    Boolean	deferred_resize;/* was resized while no_refigure is set */
+#ifndef OLDXAW
+    short	virtual_x, virtual_y;
+    XtPointer	pad[2];		/* leave some space for further optimizations
+				 * in the form widget geometry
+				 */
+#endif
+} FormConstraintsPart;
+
+typedef struct _FormConstraintsRec {
+    FormConstraintsPart	form;
+} FormConstraintsRec, *FormConstraints;
+
+_XFUNCPROTOEND
+
+#endif /* _XawFormP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/Grip.h b/ThirdParty/X11/Include/X11/Xaw/Grip.h
new file mode 100644
index 0000000000000000000000000000000000000000..e8892ae60a86326799935c66561affc815da8bd9
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/Grip.h
@@ -0,0 +1,96 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ *  Grip.h - Public Definitions for Grip widget (used by VPane Widget)
+ *
+ */
+
+#ifndef _XawGrip_h
+#define _XawGrip_h
+
+#include <X11/Xaw/Simple.h>
+
+/* Resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ foreground	     Foreground		Pixel		XtDefaultForeground
+ border		     BorderColor	Pixel		XtDefaultForeground
+ borderWidth	     BorderWidth	Dimension	0
+ callback	     Callback		Pointer		GripAction
+ cursor		     Cursor		Cursor		None
+ cursorName	     Cursor		String		NULL
+ destroyCallback     Callback		Pointer		NULL
+ height		     Height		Dimension	8
+ mappedWhenManaged   MappedWhenManaged	Boolean		True
+ pointerColor	     Foreground		Pixel		XtDefaultForeground
+ pointerColorBackground Background	Pixel		XtDefaultBackground
+ sensitive	     Sensitive		Boolean		True
+ width		     Width		Dimension	8
+ x		     Position		Position	0
+ y		     Position		Position	0
+
+*/
+
+#define XtNgripTranslations "gripTranslations"
+
+typedef struct _XawGripCallData {
+    XEvent *event;			/* the event causing the GripAction */
+    String *params;			/* the TranslationTable params */
+    Cardinal num_params;		/* count of params */
+} XawGripCallDataRec, *XawGripCallData,
+  GripCallDataRec, *GripCallData; /* supported for R4 compatibility */
+
+/* Class Record Constant */
+
+extern WidgetClass gripWidgetClass;
+
+typedef struct _GripClassRec *GripWidgetClass;
+typedef struct _GripRec      *GripWidget;
+
+#endif /* _XawGrip_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/GripP.h b/ThirdParty/X11/Include/X11/Xaw/GripP.h
new file mode 100644
index 0000000000000000000000000000000000000000..427948afd60e6cba49c42f044746bedcc4f0ab4c
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/GripP.h
@@ -0,0 +1,85 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XawGripP_h
+#define _XawGripP_h
+
+#include <X11/Xaw/Grip.h>
+#include <X11/Xaw/SimpleP.h>
+
+#define DEFAULT_GRIP_SIZE 8
+
+/* New fields for the Grip widget class */
+typedef struct {
+    XtPointer extension;
+} GripClassPart;
+
+/* Full Class record */
+typedef struct _GripClassRec {
+    CoreClassPart    core_class;
+    SimpleClassPart  simple_class;
+    GripClassPart    grip_class;
+} GripClassRec;
+
+extern GripClassRec gripClassRec;
+
+/* New fields for the Grip widget */
+typedef struct {
+    XtCallbackList grip_action;
+#ifndef OLDXAW
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} GripPart;
+
+/* Full instance record */
+typedef struct _GripRec {
+    CorePart	core;
+    SimplePart	simple;
+    GripPart	grip;
+} GripRec;
+
+#endif /* _XawGripP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/Label.h b/ThirdParty/X11/Include/X11/Xaw/Label.h
new file mode 100644
index 0000000000000000000000000000000000000000..175f1c120600090fc81dce54978376cac14be9e6
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/Label.h
@@ -0,0 +1,132 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XawLabel_h
+#define _XawLabel_h
+
+/*
+ * Label Widget
+ */
+
+#include <X11/Xaw/Simple.h>
+
+/* Resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ background	     Background		Pixel		XtDefaultBackground
+ bitmap		     Pixmap		Pixmap		None
+ border		     BorderColor	Pixel		XtDefaultForeground
+ borderWidth	     BorderWidth	Dimension	1
+ cursor		     Cursor		Cursor		None
+ cursorName	     Cursor		String		NULL
+ destroyCallback     Callback		XtCallbackList	NULL
+ encoding	     Encoding		UnsignedChar	XawTextEncoding8bit
+ font		     Font		XFontStruct*	XtDefaultFont
+ foreground	     Foreground		Pixel		XtDefaultForeground
+ height		     Height		Dimension	text height
+ insensitiveBorder   Insensitive	Pixmap		Gray
+ internalHeight	     Height		Dimension	2
+ internalWidth	     Width		Dimension	4
+ justify	     Justify		XtJustify	XtJustifyCenter
+ label		     Label		String		NULL
+ leftBitmap	     LeftBitmap		Pixmap		None
+ mappedWhenManaged   MappedWhenManaged	Boolean		True
+ pointerColor	     Foreground		Pixel		XtDefaultForeground
+ pointerColorBackground Background	Pixel		XtDefaultBackground
+ resize		     Resize		Boolean		True
+ sensitive	     Sensitive		Boolean		True
+ width		     Width		Dimension	text width
+ x		     Position		Position	0
+ y		     Position		Position	0
+
+*/
+
+#define XawTextEncoding8bit	0
+#define XawTextEncodingChar2b	1
+
+#define XtNleftBitmap "leftBitmap"
+#define XtCLeftBitmap "LeftBitmap"
+#define XtNencoding "encoding"
+#define XtCEncoding "Encoding"
+
+#ifndef XtNfontSet
+#define XtNfontSet "fontSet"
+#endif
+
+#ifndef XtCFontSet
+#define XtCFontSet "FontSet"
+#endif
+
+#ifndef _XtStringDefs_h_
+#define XtNbitmap "bitmap"
+#define XtNforeground "foreground"
+#define XtNlabel "label"
+#define XtNfont "font"
+#define XtNinternalWidth "internalWidth"
+#define XtNinternalHeight "internalHeight"
+#define XtNresize "resize"
+#define XtCResize "Resize"
+#define XtCBitmap "Bitmap"
+#endif
+
+#ifndef XtNlabelX
+#define XtNlabelX "labelX"
+#endif
+
+#ifndef XtNlabelY
+#define XtNlabelY "labelY"
+#endif
+
+/* Class record constants */
+
+extern WidgetClass labelWidgetClass;
+
+typedef struct _LabelClassRec *LabelWidgetClass;
+typedef struct _LabelRec      *LabelWidget;
+
+#endif /* _XawLabel_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/LabelP.h b/ThirdParty/X11/Include/X11/Xaw/LabelP.h
new file mode 100644
index 0000000000000000000000000000000000000000..e8cc611a026ae8c5fea921ae6b0cb65a09f55da9
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/LabelP.h
@@ -0,0 +1,115 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XawLabelP_h
+#define _XawLabelP_h
+
+/*
+ * Label Widget Private Data
+ */
+#include <X11/Xaw/Label.h>
+#include <X11/Xaw/SimpleP.h>
+
+/* New fields for the Label widget class record */
+typedef struct {
+    XtPointer extension;
+} LabelClassPart;
+
+/* Full class record declaration */
+typedef struct _LabelClassRec {
+    CoreClassPart	core_class;
+    SimpleClassPart	simple_class;
+    LabelClassPart	label_class;
+} LabelClassRec;
+
+extern LabelClassRec labelClassRec;
+
+/* New fields for the Label widget record */
+typedef struct {
+    /* resources */
+    Pixel	foreground;
+    XFontStruct	*font;
+    XFontSet	fontset;
+    char	*label;
+    XtJustify	justify;
+    Dimension	internal_width;
+    Dimension	internal_height;
+    Pixmap	pixmap;
+    Boolean	resize;
+    unsigned char encoding;
+    Pixmap	left_bitmap;
+
+    /* private state */
+    GC		normal_GC;
+    GC          gray_GC;
+    Pixmap	stipple;
+    Position	label_x;
+    Position	label_y;
+    Dimension	label_width;
+    Dimension	label_height;
+    Dimension	label_len;
+    int		lbm_y;			/* where in label */
+    unsigned int lbm_width, lbm_height;	 /* size of pixmap */
+#ifndef OLDXAW
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} LabelPart;
+
+/*
+ * Full instance record declaration
+ */
+typedef struct _LabelRec {
+    CorePart	core;
+    SimplePart	simple;
+    LabelPart	label;
+} LabelRec;
+
+#define LEFT_OFFSET(lw) ((lw)->label.left_bitmap \
+			 ? (lw)->label.lbm_width + (lw)->label.internal_width \
+			 : 0)
+
+#endif /* _XawLabelP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/List.h b/ThirdParty/X11/Include/X11/Xaw/List.h
new file mode 100644
index 0000000000000000000000000000000000000000..7fc59f4fe05ae76f66bd439573b39e377932033b
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/List.h
@@ -0,0 +1,234 @@
+/*
+Copyright 1989, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+*/
+
+/*  This is the List widget, it is useful to display a list, without the
+ *  overhead of having a widget for each item in the list.  It allows
+ *  the user to select an item in a list and notifies the application through
+ *  a callback function.
+ *
+ *	Created:	8/13/88
+ *	By:		Chris D. Peterson
+ *                      MIT X Consortium
+ */
+
+#ifndef _XawList_h
+#define _XawList_h
+
+#include <X11/Xaw/Simple.h>
+
+/* Resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ background	     Background		Pixel		XtDefaultBackground
+ borderColor	     BorderColor	Pixel		XtDefaultForeground
+ borderWidth	     BorderWidth	Dimension	1
+ callback            Callback           XtCallbackList  NULL       **6
+ columnSpacing       Spacing            Dimension       6
+ cursor		     Cursor		Cursor		left_ptr
+ cursorName	     Cursor		String		NULL
+ defaultColumns      Columns            int             2          **5
+ destroyCallback     Callback		Pointer		NULL
+ font		     Font		XFontStruct*	XtDefaultFont
+ forceColumns        Columns            Boolean         False      **5
+ foreground	     Foreground		Pixel		XtDefaultForeground
+ height		     Height		Dimension	0          **1
+ insensitiveBorder   Insensitive	Pixmap		Gray
+ internalHeight	     Height		Dimension	2
+ internalWidth	     Width		Dimension	4
+ list		     List		String*		NULL	   **2
+ longest             Longest            int             0          **3  **4
+ mappedWhenManaged   MappedWhenManaged	Boolean		True
+ numberStrings       NumberStrings      int             0          **4
+ pasteBuffer         Boolean            Boolean         False
+ pointerColor	     Foreground		Pixel		XtDefaultForeground
+ pointerColorBackground Background	Pixel		XtDefaultBackground
+ rowSpacing          Spacing            Dimension       4
+ sensitive	     Sensitive		Boolean		True
+ verticalList        Boolean            Boolean         False
+ width		     Width		Dimension	0          **1
+ x		     Position		Position	0
+ y		     Position		Position	0
+
+ **1 - If the Width or Height of the list widget is zero (0) then the value
+       is set to the minimum size necessay to fit the entire list.
+
+       If both Width and Height are zero then they are adjusted to fit the
+       entire list that is created width the number of default columns
+       specified in the defaultColumns resource.
+
+ **2 - This is an array of strings the specify elements of the list.
+       This resource must be specified.
+       (What good is a list widget without a list??  :-)
+
+ **3 - Longest is the length of the widest string in pixels.
+
+ **4 - If either of these values are zero (0) then the list widget calculates
+       the correct value.
+
+       (This allows you to make startup faster if you already have
+        this information calculated)
+
+       NOTE: If the numberStrings value is zero the list must
+             be NULL terminated.
+
+ **5 - By setting the List.Columns resource you can force the application to
+       have a given number of columns.
+
+ **6 - This returns the name and index of the item selected in an
+       XawListReturnStruct that is pointed to by the client_data
+       in the CallbackProc.
+
+*/
+
+/*
+ * Value returned when there are no highlighted objects
+ */
+#define XAW_LIST_NONE -1
+
+#define XtCList "List"
+#define XtCSpacing "Spacing"
+#define XtCColumns "Columns"
+#define XtCLongest "Longest"
+#define XtCNumberStrings "NumberStrings"
+
+#define XtNcursor "cursor"
+#define XtNcolumnSpacing "columnSpacing"
+#define XtNdefaultColumns "defaultColumns"
+#define XtNforceColumns "forceColumns"
+#define XtNlist "list"
+#define XtNlongest "longest"
+#define XtNnumberStrings "numberStrings"
+#define XtNpasteBuffer "pasteBuffer"
+#define XtNrowSpacing "rowSpacing"
+#define XtNverticalList "verticalList"
+#define XtNshowCurrent "showCurrent"
+
+#ifndef XtNfontSet
+#define XtNfontSet "fontSet"
+#endif
+
+#ifndef XtCFontSet
+#define XtCFontSet "FontSet"
+#endif
+
+extern WidgetClass listWidgetClass;
+
+typedef struct _ListClassRec *ListWidgetClass;
+typedef struct _ListRec      *ListWidget;
+
+/* list return structure */
+typedef struct _XawListReturnStruct {
+  String string;
+  int list_index;
+} XawListReturnStruct;
+
+_XFUNCPROTOBEGIN
+
+/*
+ * Function:
+ *	XawListChange
+ *
+ * Parameters:
+ *	w	- list widget
+ *	list	- new list
+ *	nitems	- number of items in the list
+ *	longest - length (in Pixels) of the longest element in the list
+ *	resize	- if True the the list widget will try to resize itself
+ *
+ * Description:
+ *	Changes the list being used and shown.
+ *
+ * Note:
+ *	If nitems of longest are <= 0 then they will be caluculated
+ *	If nitems is <= 0 then the list needs to be NULL terminated
+ */
+void XawListChange
+(
+ Widget			w,
+ String			*list,
+ int			nitems,
+ int			longest,
+#if NeedWidePrototypes
+ int			resize
+#else
+ Boolean		resize
+#endif
+ );
+
+/*
+ * Function:
+ *	XawListUnhighlight
+ *
+ * Parameters:
+ *	w - list widget
+ *
+ * Description:
+ *	Unlights the current highlighted element.
+ */
+void XawListUnhighlight
+(
+ Widget			w
+ );
+
+/*
+ * Function:
+ *	XawListHighlight
+ *
+ * Parameters:
+ *	w    - list widget
+ *	item - item to highlight
+ *
+ * Description:
+ *	Highlights the given item.
+ */
+void XawListHighlight
+(
+ Widget			w,
+ int			item
+ );
+
+
+/*
+ * Function:
+ *	XawListShowCurrent
+ *
+ * Paraneters:
+ *	w - list widget
+ *
+ * Description:
+ *	Returns the currently highlighted object.
+ *
+ * Returns:
+ *	The info about the currently highlighted object
+ */
+
+XawListReturnStruct *XawListShowCurrent
+(
+ Widget			w
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XawList_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/ListP.h b/ThirdParty/X11/Include/X11/Xaw/ListP.h
new file mode 100644
index 0000000000000000000000000000000000000000..5f5398223e770ba5d08cb93f8a8d10197fac6d0b
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/ListP.h
@@ -0,0 +1,115 @@
+/*
+Copyright 1989, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+*/
+
+
+/*
+ * This is a List widget.  It allows the user to select an item in a list and
+ * notifies the application through a callback function.
+ *
+ *	Created:	8/13/88
+ *	By:		Chris D. Peterson
+ *                      MIT - Project Athena
+ */
+
+#ifndef _XawListP_h
+#define _XawListP_h
+
+/*
+ * List Widget Private Data
+ */
+#include <X11/Xaw/SimpleP.h>
+#include <X11/Xaw/List.h>
+
+#define NO_HIGHLIGHT            XAW_LIST_NONE
+#define OUT_OF_RANGE            -1
+#define OKAY                     0
+
+/* New fields for the List widget class */
+typedef struct {
+    XtPointer extension;
+} ListClassPart;
+
+/* Full class record */
+typedef struct _ListClassRec {
+    CoreClassPart	core_class;
+    SimpleClassPart	simple_class;
+    ListClassPart	list_class;
+} ListClassRec;
+
+extern ListClassRec listClassRec;
+
+/* New fields for the List widget */
+typedef struct {
+    /* resources */
+    Pixel foreground;
+    Dimension internal_width;		/* if not 3d, user sets directly */
+    Dimension internal_height;
+    Dimension column_space;		/* half of *_space is add on
+					   top/bot/left of */
+    Dimension row_space;		/* each item's text bounding box
+					   half added to longest for right */
+    int default_cols;
+    Boolean force_cols;
+    Boolean paste;
+    Boolean vertical_cols;
+    int longest;			/* in pixels */
+    int nitems;
+    XFontStruct	*font;
+    XFontSet fontset;			/* Sheeran, Omron KK, 93/03/05 */
+    String *list;			/* for i18n, always in multibyte
+					   format */
+    XtCallbackList callback;
+
+    /* private */
+    int is_highlighted;			/* set to the item currently
+					   highlighted */
+    int highlight;			/* set to the item that should be
+					   highlighted */
+    int col_width;			/* width of each column */
+    int row_height;			/* height of each row */
+    int nrows;				/* number of rows in the list */
+    int ncols;				/* number of columns in the list */
+    GC normgc;
+    GC revgc;
+    GC graygc;
+    int freedoms;			/* flags for resizing height
+					   and width */
+#ifndef OLDXAW
+    int selected;
+    Boolean show_current;
+    char pad1[(sizeof(XtPointer) - sizeof(Boolean)) +
+		 (sizeof(XtPointer) - sizeof(int))];
+    XtPointer pad2[2];	/* for future use and keep binary compatability */
+#endif
+} ListPart;
+
+
+/* Full instance record */
+typedef struct _ListRec {
+    CorePart	core;
+    SimplePart	simple;
+    ListPart	list;
+} ListRec;
+
+#endif /* _XawListP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/MenuButtoP.h b/ThirdParty/X11/Include/X11/Xaw/MenuButtoP.h
new file mode 100644
index 0000000000000000000000000000000000000000..8ee3195c54ac76c96477e2aa526cc91bf6ebb9ee
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/MenuButtoP.h
@@ -0,0 +1,79 @@
+/*
+ *
+Copyright 1989,1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+/*
+ * MenuButtonP.h - Private Header file for MenuButton widget.
+ *
+ * This is the private header file for the Athena MenuButton widget.
+ * It is intended to provide an easy method of activating pulldown menus.
+ *
+ * Date:    May 2, 1989
+ *
+ * By:      Chris D. Peterson
+ *          MIT X Consortium
+ *          kit@expo.lcs.mit.edu
+ */
+
+#ifndef _XawMenuButtonP_h
+#define _XawMenuButtonP_h
+
+#include <X11/Xaw/MenuButton.h>
+#include <X11/Xaw/CommandP.h>
+
+/* New fields for the MenuButton widget class */
+typedef struct _MenuButtonClass {
+    XtPointer extension;
+} MenuButtonClassPart;
+
+/* class record declaration */
+typedef struct _MenuButtonClassRec {
+    CoreClassPart	    core_class;
+    SimpleClassPart	    simple_class;
+    LabelClassPart	    label_class;
+    CommandClassPart	    command_class;
+    MenuButtonClassPart	    menuButton_class;
+} MenuButtonClassRec;
+
+extern MenuButtonClassRec menuButtonClassRec;
+
+/* New fields for the MenuButton widget */
+typedef struct {
+    /* resources */
+    String menu_name;
+#ifndef OLDXAW
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} MenuButtonPart;
+
+/* widget declaration */
+typedef struct _MenuButtonRec {
+    CorePart         core;
+    SimplePart	     simple;
+    LabelPart	     label;
+    CommandPart	     command;
+    MenuButtonPart   menu_button;
+} MenuButtonRec;
+
+#endif /* _XawMenuButtonP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/MenuButton.h b/ThirdParty/X11/Include/X11/Xaw/MenuButton.h
new file mode 100644
index 0000000000000000000000000000000000000000..93f096306a6406183eed9057f397ba0b0d778c6f
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/MenuButton.h
@@ -0,0 +1,89 @@
+/*
+ *
+Copyright 1989, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+/***********************************************************************
+ *
+ * MenuButton Widget
+ *
+ ***********************************************************************/
+
+/*
+ * MenuButton.h - Public Header file for MenuButton widget.
+ *
+ * This is the public header file for the Athena MenuButton widget.
+ * It is intended to provide an easy method of activating pulldown menus.
+ *
+ * Date:    May 2, 1989
+ *
+ * By:      Chris D. Peterson
+ *          MIT X Consortium
+ *          kit@expo.lcs.mit.edu
+ */
+
+#ifndef _XawMenuButton_h
+#define _XawMenuButton_h
+
+#include <X11/Xaw/Command.h>
+
+/* Resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ background	     Background		Pixel		XtDefaultBackground
+ bitmap		     Pixmap		Pixmap		None
+ border		     BorderColor	Pixel		XtDefaultForeground
+ borderWidth	     BorderWidth	Dimension	1
+ callback	     Callback		Pointer		NULL
+ cursor		     Cursor		Cursor		None
+ destroyCallback     Callback		Pointer		NULL
+ displayList	     DisplayList	XawDisplayList*	NULL
+ font		     Font		XFontStruct*	XtDefaultFont
+ foreground	     Foreground		Pixel		XtDefaultForeground
+ height		     Height		Dimension	text height
+ highlightThickness  Thickness		Dimension	2
+ insensitiveBorder   Insensitive	Pixmap		Gray
+ internalHeight	     Height		Dimension	2
+ internalWidth	     Width		Dimension	4
+ justify	     Justify		XtJustify	XtJustifyCenter
+ label		     Label		String		NULL
+ mappedWhenManaged   MappedWhenManaged	Boolean		True
+ menuName            MenuName           String          "menu"
+ resize		     Resize		Boolean		True
+ sensitive	     Sensitive		Boolean		True
+ width		     Width		Dimension	text width
+ x		     Position		Position	0
+ y		     Position		Position	0
+
+*/
+
+#define XtNmenuName "menuName"
+#define XtCMenuName "MenuName"
+
+extern WidgetClass     menuButtonWidgetClass;
+
+typedef struct _MenuButtonClassRec   *MenuButtonWidgetClass;
+typedef struct _MenuButtonRec        *MenuButtonWidget;
+
+#endif /* _XawMenuButton_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/MultiSink.h b/ThirdParty/X11/Include/X11/Xaw/MultiSink.h
new file mode 100644
index 0000000000000000000000000000000000000000..3519acc7a5b10cdff77356dec0d0a64eb9a70ce6
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/MultiSink.h
@@ -0,0 +1,110 @@
+/*
+ * Copyright 1991 by OMRON Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name OMRON is not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  OMRON makes no representations
+ * about the suitability of this software for any purpose.  It is provided
+ * "as is" without express or implied warranty.
+ *
+ * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ *      Author: Li Yuhong	 OMRON Corporation
+ */
+
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XawMultiSink_h
+#define _XawMultiSink_h
+
+/*
+ * MultiSink Object
+ */
+
+#include <X11/Xaw/TextSink.h>
+
+/* Resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ echo                Output             Boolean         True
+ displayNonprinting  Output             Boolean         True
+ fontSet             FontSet            XFontSet        XtDefaultFontSet
+
+*/
+
+#define XtCOutput "Output"
+
+#define XtNdisplayNonprinting "displayNonprinting"
+#define XtNecho "echo"
+
+#ifndef XtNfontSet		/*Sheeran, Omron KK, 93/03/04*/
+#define XtNfontSet		"fontSet"
+#endif
+
+#ifndef XtCFontSet		/*Sheeran, Omron KK, 93/03/04*/
+#define XtCFontSet		"FontSet"
+#endif
+
+/* Class record constants */
+extern WidgetClass multiSinkObjectClass;
+
+typedef struct _MultiSinkClassRec *MultiSinkObjectClass;
+typedef struct _MultiSinkRec      *MultiSinkObject;
+
+#endif /* _XawMultiSink_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/MultiSinkP.h b/ThirdParty/X11/Include/X11/Xaw/MultiSinkP.h
new file mode 100644
index 0000000000000000000000000000000000000000..019f5f4b80e2ba7cc1e1a0fe93057113d218c717
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/MultiSinkP.h
@@ -0,0 +1,138 @@
+/*
+ * Copyright 1991 by OMRON Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name OMRON not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  OMRON make no representations
+ * about the suitability of this software for any purpose.  It is provided
+ * "as is" without express or implied warranty.
+ *
+ * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ *      Author: Li Yuhong	 OMRON Corporation
+ */
+
+
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XawMultiSinkP_h
+#define _XawMultiSinkP_h
+
+#include <X11/Xfuncproto.h>
+
+/*
+ * MultiSink Object Private Data
+ */
+#include <X11/Xaw/TextSinkP.h>
+#include <X11/Xaw/MultiSink.h>
+
+/* new fields for the MultiSink object class */
+typedef struct _MultiSinkClassPart {
+    XtPointer extension;
+} MultiSinkClassPart;
+
+/* Full class record declaration */
+typedef struct _MultiSinkClassRec {
+    ObjectClassPart     object_class;
+    TextSinkClassPart	text_sink_class;
+    MultiSinkClassPart	multi_sink_class;
+} MultiSinkClassRec;
+
+extern MultiSinkClassRec multiSinkClassRec;
+
+/* New fields for the MultiSink object record */
+typedef struct {
+    /* resources */
+    Boolean echo;
+    Boolean display_nonprinting;
+
+    /* private */
+    GC normgc, invgc, xorgc;
+    XawTextPosition cursor_position;
+    XawTextInsertState laststate;
+    short cursor_x, cursor_y;		/* Cursor Location */
+    XFontSet fontset;			/* font set to draw */
+#ifndef OLDXAW
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} MultiSinkPart;
+
+/* Full instance record declaration */
+typedef struct _MultiSinkRec {
+    ObjectPart          object;
+    TextSinkPart	text_sink;
+    MultiSinkPart	multi_sink;
+} MultiSinkRec;
+
+/*
+ * Semi-private functions
+ * for use by other Xaw modules only
+ */
+_XFUNCPROTOBEGIN
+
+void _XawMultiSinkPosToXY
+(
+ Widget			w,
+ XawTextPosition	pos,
+ Position		*x,
+ Position		*y
+);
+
+_XFUNCPROTOEND
+
+#endif /* _XawMultiSinkP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/MultiSrc.h b/ThirdParty/X11/Include/X11/Xaw/MultiSrc.h
new file mode 100644
index 0000000000000000000000000000000000000000..628da0cc8a9a75e830141bef8fd9f73a6831d73e
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/MultiSrc.h
@@ -0,0 +1,130 @@
+/*
+ * Copyright 1991 by OMRON Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name OMRON not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  OMRON makes no representations
+ * about the suitability of this software for any purpose.  It is provided
+ * "as is" without express or implied warranty.
+ *
+ * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ *      Author: Li Yuhong	 OMRON Corporation
+ */
+
+/*
+
+Copyright 1989, 1991, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * This file was modified from AsciiSrc.h.
+ *
+ * By Li Yuhong, Sept. 18, 1990
+ */
+
+#ifndef _XawMultiSrc_h
+#define _XawMultiSrc_h
+
+#include <X11/Xaw/TextSrc.h>
+
+/* Resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ dataCompression     DataCompression	Boolean		True
+ length		     Length		int		(internal)
+ pieceSize	     PieceSize		int		BUFSIZ
+ string		     String		String		NULL
+ type		     Type		XawAsciiType	XawAsciiString
+ useStringInPlace    UseStringInPlace	Boolean		False
+
+*/
+
+extern WidgetClass multiSrcObjectClass;
+
+typedef struct _MultiSrcClassRec *MultiSrcObjectClass;
+typedef struct _MultiSrcRec      *MultiSrcObject;
+
+#define MultiSourceObjectClass MultiSrcObjectClass
+#define MultiSourceObject      MultiSrcObject
+
+#define XtCDataCompression "DataCompression"
+#define XtCPieceSize "PieceSize"
+#define XtCType "Type"
+#define XtCUseStringInPlace "UseStringInPlace"
+
+#define XtNdataCompression "dataCompression"
+#define XtNpieceSize "pieceSize"
+#define XtNtype "type"
+#define XtNuseStringInPlace "useStringInPlace"
+
+#define XtRMultiType "MultiType"
+
+#define XtEstring "string"
+#define XtEfile "file"
+
+/************************************************************
+ *
+ * THESE ROUTINES ARE NOT PUBLIC: Source should call
+ *
+ * the AsciiSrc API which currently forwards requests here.
+ *
+ * future versions (like theres going to be an R7 Xaw!) may
+ *
+ * eliminate this file or at least these functions entirely.
+ *
+ ************************************************************/
+
+_XFUNCPROTOBEGIN
+
+void XawMultiSourceFreeString
+(
+ Widget			w
+ );
+
+Bool _XawMultiSave
+(
+ Widget			w
+);
+
+Bool _XawMultiSaveAsFile
+(
+ Widget			w,
+ _Xconst char		*name
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XawMultiSrc_h  */
diff --git a/ThirdParty/X11/Include/X11/Xaw/MultiSrcP.h b/ThirdParty/X11/Include/X11/Xaw/MultiSrcP.h
new file mode 100644
index 0000000000000000000000000000000000000000..95642a43b96e49b54947903acdf71fc3a517db06
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/MultiSrcP.h
@@ -0,0 +1,179 @@
+/*
+ * Copyright 1991 by OMRON Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name OMRON not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  OMRON make no representations
+ * about the suitability of this software for any purpose.  It is provided
+ * "as is" without express or implied warranty.
+ *
+ * OMRON DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ *      Author: Li Yuhong	 OMRON Corporation
+ */
+
+
+/***********************************************************
+
+Copyright 1987, 1988, 1991, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ * MultiSrcP.h - Private Header for Multi Text Source.
+ *
+ * This is the private header file for the Multi Text Source.
+ * It is intended to be used with the Text widget, the simplest way to use
+ * this text source is to use the MultiText Object.
+ *
+ * Date:    June 29, 1989
+ *
+ * By:      Chris D. Peterson
+ *          MIT X Consortium
+ *          kit@expo.lcs.mit.edu
+ */
+
+/*
+ * This file was changed from AsciiSrcP.h.
+ *
+ * By Li Yuhong, Sept. 18, 1990
+ */
+
+#ifndef _XawMultiSrcP_h
+#define _XawMultiSrcP_h
+
+#include <X11/Xfuncproto.h>
+#include <X11/Xaw/TextSrcP.h>
+#include <X11/Xaw/MultiSrc.h>
+
+#ifdef L_tmpnam
+#define TMPSIZ L_tmpnam
+#else
+#ifdef PATH_MAX
+#define TMPSIZ PATH_MAX
+#else
+#define TMPSIZ 1024		/* bytes to allocate for tmpnam */
+#endif
+#endif
+
+typedef struct _MultiPiece {	/* Piece of the text file of BUFSIZ allocated
+				   characters */
+    wchar_t* text;		/* The text in this buffer */
+    XawTextPosition used;	/* The number of characters of this buffer
+				   that have been used */
+    struct _MultiPiece *prev, *next;	/* linked list pointers */
+} MultiPiece;
+
+/* New fields for the MultiSrc object class */
+typedef struct _MultiSrcClassPart {
+    XtPointer extension;
+} MultiSrcClassPart;
+
+/* Full class record */
+typedef struct _MultiSrcClassRec {
+    ObjectClassPart     object_class;
+    TextSrcClassPart	text_src_class;
+    MultiSrcClassPart	multi_src_class;
+} MultiSrcClassRec;
+
+extern MultiSrcClassRec multiSrcClassRec;
+
+/* New fields for the MultiSrc object */
+typedef struct _MultiSrcPart {
+    /* resources */
+    XIC ic;			/* for X Input Method */
+    XtPointer string;		/* either the string, or the file name, depend-
+				   ing upon the `type'.  ALWAYS IN MB FORMAT */
+    XawAsciiType type;		/* either string or disk */
+    XawTextPosition piece_size;	/* Size of text buffer for each piece */
+    Boolean data_compression;	/* compress to minimum memory automatically
+				   on save? */
+#ifdef OLDXAW
+    XtCallbackList callback;
+#endif
+    Boolean use_string_in_place;/* Use the string passed in place */
+    int multi_length;		/* length field for multi string emulation */
+
+    /* private */
+
+    Boolean is_tempfile;	  /* Is this a temporary file? */
+#ifdef OLDXAW
+    Boolean changes;
+#endif
+    Boolean allocated_string;	/* Have I allocated the
+				   string in multi_src->string? */
+    XawTextPosition length;	/* length of file - IN CHARACTERS, NOT BYTES */
+    MultiPiece *first_piece;	/* first piece of the text */
+#ifndef OLDXAW
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} MultiSrcPart;
+
+/* Full instance record */
+typedef struct _MultiSrcRec {
+  ObjectPart    object;
+  TextSrcPart	text_src;
+  MultiSrcPart	multi_src;
+} MultiSrcRec;
+
+_XFUNCPROTOBEGIN
+
+void _XawMultiSourceFreeString
+(
+ Widget		w
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XawMultiSrcP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/Paned.h b/ThirdParty/X11/Include/X11/Xaw/Paned.h
new file mode 100644
index 0000000000000000000000000000000000000000..4b7e1158f1a2020727312e30db1842f171caf9a6
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/Paned.h
@@ -0,0 +1,258 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ * Paned.h - Paned Composite Widget's public header file.
+ *
+ * Updated and significantly modifided from the Athena VPaned Widget.
+ *
+ * Date:    March 1, 1989
+ *
+ * By:      Chris D. Peterson
+ *          MIT X Consortium
+ *          kit@expo.lcs.mit.edu
+ */
+
+#ifndef _XawPaned_h
+#define _XawPaned_h
+
+#include <X11/Intrinsic.h>
+#include <X11/Xmu/Converters.h>
+
+/* RESOURCES:
+
+ Name		         Class		   RepType	    Default Value
+ ----		         -----		   -------	    -------------
+ background	         Background	   Pixel	    XtDefaultBackground
+ betweenCursor	         Cursor	           Cursor	    **
+ border		         BorderColor       Pixel	    XtDefaultForeground
+ borderWidth	         BorderWidth       Dimension	    1
+ cursor		         Cursor	           Cursor	    None
+ destroyCallback         Callback	   Pointer	    NULL
+ height		         Height	           Dimension	    0
+ gripIndent	         GripIndent	   Position	    16
+ gripCursor	         Cursor	           Cursor	    **
+ horizontalGripCursol    Cursor	           Cursor	    sb_h_double_arrow
+ horizontalBetweencursor Cursor	           Cursor	    sb_up_arrow
+ internalBorderColor     BorderColor	   Pixel	    XtDefaultForeground
+ internalBorderWidth     BorderWidth	   Position	    1
+ leftCursor	         Cursor	           Cursor	    sb_left_arrow
+ lowerCursor	         Cursor	           Cursor	    sb_down_arrow
+ mappedWhenManaged       MappedWhenManaged Boolean	    True
+ orientation             Orientation       XtOrientation    XtorientVertical
+ refigureMode	         Boolean	   Boolean	    On
+ rightCursor	         Cursor	           Cursor           sb_right_arrow
+ sensitive	         Sensitive	   Boolean	    True
+ upperCursor	         Cursor	           Cursor	    sb_up_arrow
+ verticalBetweenCursor   Cursor	           Cursor           sb_left_arrow
+ verticalGripCursor      Cursor	           Cursor           sb_v_double_arrow
+ width		         Width	           Dimension	    0
+ x		         Position	   Position	    0
+ y		         Position	   Position	    0
+
+** These resources now are set to the vertical or horizontal cursor
+   depending upon orientation, by default.  If a value is specified here
+   then that cursor will be used reguardless of orientation.
+
+
+CONSTRAINT RESOURCES:
+
+ Name		      Class		RepType		Default Value
+ ----		      -----		-------		-------------
+ allowResize	      Boolean	        Boolean         False
+ max		      Max	        Dimension	unlimited
+ min		      Min		Dimension	Grip Size
+ preferredPaneSize    PreferredPaneSize Dimension	PANED_ASK_CHILD
+ resizeToPreferred    Boolean		Boolean		False
+ showGrip	      ShowGrip		Boolean		True
+ skipAdjust	      Boolean	        Boolean         False
+
+*/
+
+#define PANED_ASK_CHILD 0
+#define PANED_GRIP_SIZE 0
+
+#define XtNallowResize "allowResize"
+#define XtNbetweenCursor "betweenCursor"
+#define XtNverticalBetweenCursor "verticalBetweenCursor"
+#define XtNhorizontalBetweenCursor "horizontalBetweenCursor"
+#define XtNgripCursor "gripCursor"
+#define XtNgripIndent "gripIndent"
+#define XtNhorizontalGripCursor "horizontalGripCursor"
+#define XtNinternalBorderColor "internalBorderColor"
+#define XtNinternalBorderWidth "internalBorderWidth"
+#define XtNleftCursor "leftCursor"
+#define XtNlowerCursor "lowerCursor"
+#define XtNrefigureMode "refigureMode"
+#define XtNposition "position"
+#define XtNmin "min"
+#define XtNmax "max"
+#define XtNpreferredPaneSize "preferredPaneSize"
+#define XtNresizeToPreferred "resizeToPreferred"
+#define XtNrightCursor "rightCursor"
+#define XtNshowGrip "showGrip"
+#define XtNskipAdjust "skipAdjust"
+#define XtNupperCursor "upperCursor"
+#define XtNverticalGripCursor "verticalGripCursor"
+
+#define XtCGripIndent "GripIndent"
+#define XtCMin "Min"
+#define XtCMax "Max"
+#define XtCPreferredPaneSize "PreferredPaneSize"
+#define XtCShowGrip "ShowGrip"
+
+/* Class record constant */
+extern WidgetClass panedWidgetClass;
+
+typedef struct _PanedClassRec	*PanedWidgetClass;
+typedef struct _PanedRec	*PanedWidget;
+
+/*
+ *  Public Procedures
+ */
+
+_XFUNCPROTOBEGIN
+
+/*
+ * Function:
+ *	XawPanedSetMinMax
+ *
+ * Parameters:
+ *	widget - widget that is a child of the Paned widget
+ *	min    - new min and max size for the pane
+ *	max    - ""
+ *
+ * Description:
+ *	Sets the min and max size for a pane.
+ */
+void XawPanedSetMinMax
+(
+ Widget			w,
+ int			min,
+ int			max
+ );
+
+/*
+ * Function:
+ *	XawPanedGetMinMax
+ *
+ * Parameters:
+ *	widget - widget that is a child of the Paned widget
+ *	min    - return the current min and max size for the pane
+ *	max    - ""
+ *
+ * Description:
+ *	Gets the min and max size for a pane.
+ */
+void XawPanedGetMinMax
+(
+ Widget			w,
+ int			*min_return,
+ int			*max_return
+ );
+
+/*
+ * Function:
+ *	XawPanedSetRefigureMode
+ *
+ * Parameters:
+ *	w    - paned widget
+ *	mode - if False then inhibit refigure
+ *
+ * Description:
+ *	  Allows a flag to be set the will inhibit  the paned widgets
+ *	relayout routine.
+ */
+void XawPanedSetRefigureMode
+(
+ Widget			w,
+#if NeedWidePrototypes
+ int			mode
+#else
+ Boolean		mode
+#endif
+ );
+
+/*
+ * Function:
+ *	XawPanedGetNumSub
+ *
+ * Parameters:
+ *	w - paned widget
+ *
+ * Returns:
+ *	Number of panes in the paned widget.
+ */
+int XawPanedGetNumSub
+(
+ Widget			w
+ );
+
+/*
+ * Function:
+ *	XawPanedAllowResize
+ *
+ * Parameters:
+ *	widget - child of the paned widget
+ *
+ * Description:
+ *	  Allows a flag to be set that determines if the paned widget will
+ *	allow geometry requests from this child
+ */
+void XawPanedAllowResize
+(
+ Widget			w,
+#if NeedWidePrototypes
+ int			allow_resize
+#else
+ Boolean		allow_resize
+#endif
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XawPaned_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/PanedP.h b/ThirdParty/X11/Include/X11/Xaw/PanedP.h
new file mode 100644
index 0000000000000000000000000000000000000000..4e40eafb651cdd6c81734f8c8174c666ca8b6abb
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/PanedP.h
@@ -0,0 +1,176 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ * Updated and significantly modified from the Athena VPaned Widget.
+ *
+ * Date:    March 1, 1989
+ *
+ * By:      Chris D. Peterson
+ *          MIT X Consortium
+ *          kit@expo.lcs.mit.edu
+ */
+
+#ifndef _XawPanedP_h
+#define _XawPanedP_h
+
+#include <X11/Xaw/Paned.h>
+
+/* New fields for the Paned widget class record */
+typedef struct _PanedClassPart {
+    XtPointer extension;
+} PanedClassPart;
+
+/* Full Class record declaration */
+typedef struct _PanedClassRec {
+    CoreClassPart       core_class;
+    CompositeClassPart  composite_class;
+    ConstraintClassPart constraint_class;
+    PanedClassPart      paned_class;
+} PanedClassRec;
+
+extern PanedClassRec panedClassRec;
+
+/* Paned constraint record */
+typedef struct _PanedConstraintsPart {
+    /* Resources */
+    Dimension	min;		/* Minimum height */
+    Dimension	max;		/* Maximum height */
+    Boolean	allow_resize;	/* True if child resize requests are ok */
+    Boolean	show_grip;	/* True if child will have grip below it,
+				   when it is not the bottom pane */
+    Boolean skip_adjust;	/* True if child's height should not be
+				   changed without explicit user action */
+    int		position;	/* position location in Paned (relative to
+				   other children) ** NIY ** */
+    Dimension   preferred_size;	/* The Preferred size of the pane.
+				   If this is zero then ask child for size*/
+    Boolean     resize_to_pref;	/* resize this pane to its preferred size
+				   on a resize or change managed after
+				   realize */
+
+    /* Private state */
+    Position	delta;		/* Desired Location */
+    Position	olddelta;	/* The last value of dy */
+    Boolean     paned_adjusted_me; /* Has the vpaned adjusted this widget w/o
+				     user interaction to make things fit? */
+    Dimension	wp_size;	/* widget's preferred size */
+    int size;			/* the size the widget will actually get */
+    Widget	grip;		/* The grip for this child */
+} PanedConstraintsPart, *Pane;
+
+typedef struct _PanedConstraintsRec {
+    PanedConstraintsPart paned;
+} PanedConstraintsRec, *PanedConstraints;
+
+/*
+ * The Pane Stack Structure
+ */
+typedef struct _PaneStack {
+    struct _PaneStack *next;	/* The next element on the stack */
+    Pane pane;			/* The pane in this element on the stack */
+    int start_size;		/* The size of this element when it
+				   was pushed onto the stack */
+} PaneStack;
+
+/* New Fields for the Paned widget record */
+typedef struct {
+    /* resources */
+    Position    grip_indent;               /* Location of grips (offset
+					      from right margin) */
+    Boolean     refiguremode;              /* Whether to refigure changes
+					      right now */
+    XtTranslations grip_translations;      /* grip translation table */
+    Pixel	internal_bp;		/* color of internal borders */
+    Dimension	internal_bw;		/* internal border width */
+    XtOrientation orientation;		/* Orientation of paned widget */
+
+    Cursor	cursor;		           /* Cursor for paned window */
+    Cursor	grip_cursor;               /* inactive grip cursor */
+    Cursor	v_grip_cursor;             /* inactive vert grip cursor */
+    Cursor	h_grip_cursor;             /* inactive horiz grip cursor */
+    Cursor	adjust_this_cursor;        /* active grip cursor: T */
+    Cursor	v_adjust_this_cursor;      /* active vert grip cursor: T */
+    Cursor	h_adjust_this_cursor;      /* active horiz grip cursor: T */
+
+    /* vertical */
+    Cursor	adjust_upper_cursor;      /* active grip cursor: U */
+    Cursor	adjust_lower_cursor;      /* active grip cursor: D */
+
+    /* horizontal */
+    Cursor	adjust_left_cursor;        /* active grip cursor: U */
+    Cursor	adjust_right_cursor;       /* active grip cursor: D */
+
+    /* private */
+    Boolean	recursively_called;        /* for ChangeManaged */
+    Boolean	resize_children_to_pref;   /* override constrain resources
+					      and resize all children to
+					   preferred size */
+    int         start_loc;	           /* mouse origin when adjusting */
+    Widget      whichadd;                  /* Which pane to add changes to */
+    Widget      whichsub;                  /* Which pane to sub changes from */
+    GC          normgc;                    /* GC to use when drawing borders */
+    GC          invgc;                     /* GC to use when erasing borders */
+    GC		flipgc;			   /* GC to use when animating borders */
+    int		num_panes;                 /* count of managed panes */
+    PaneStack	*stack;			   /* The pane stack for this widget */
+#ifndef OLDXAW
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} PanedPart;
+
+/*
+ * Full instance record declaration
+ */
+typedef struct _PanedRec {
+    CorePart	   core;
+    CompositePart  composite;
+    ConstraintPart constraint;
+    PanedPart	   paned;
+} PanedRec;
+
+#endif /* _XawPanedP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/Panner.h b/ThirdParty/X11/Include/X11/Xaw/Panner.h
new file mode 100644
index 0000000000000000000000000000000000000000..dd376027e0dafee1d231621e9171bb2f54f5f5af
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/Panner.h
@@ -0,0 +1,105 @@
+/*
+ *
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author:  Jim Fulton, MIT X Consortium
+ */
+
+#ifndef _XawPanner_h
+#define _XawPanner_h
+
+#include <X11/Intrinsic.h>
+#include <X11/Xaw/Reports.h>
+
+/*****************************************************************************
+ *
+ * Panner Widget (subclass of Simple)
+ *
+ * This widget is used to represent navigation in a 2d coordinate system
+ *
+ * Resources:
+ *
+ *  Name		Class		Type		Default
+ *  ----		-----		----		-------
+ *
+ *  allowOff		AllowOff	Boolean		FALSE
+ *  background		Background	Pixel		XtDefaultBackground
+ *  backgroundStipple	BackgroundStipple	String	NULL
+ *  canvasWidth		CanvasWidth	Dimension	0
+ *  canvasHeight	CanvasHeight	Dimension	0
+ *  defaultScale	DefaultScale	Dimension	8 percent
+ *  foreground		Foreground	Pixel		XtDefaultBackground
+ *  internalSpace	InternalSpace	Dimension	4
+ *  lineWidth		LineWidth	Dimension	0
+ *  reportCallback	ReportCallback	XtCallbackList	NULL
+ *  resize		Resize		Boolean		TRUE
+ *  rubberBand		RubberBand	Boolean		FALSE
+ *  shadowColor		ShadowColor	Pixel		XtDefaultForeground
+ *  shadowThickness	ShadowThickness	Dimension	2
+ *  sliderX		SliderX		Position	0
+ *  sliderY		SliderY		Position	0
+ *  sliderWidth		SliderWidth	Dimension	0
+ *  sliderHeight	SliderHeight	Dimension	0
+ *
+ *****************************************************************************/
+
+#ifndef _XtStringDefs_h_
+#define XtNresize "resize"
+#define XtCResize "Resize"
+#endif
+
+#define XtNallowOff "allowOff"
+#define XtCAllowOff "AllowOff"
+#define XtNbackgroundStipple "backgroundStipple"
+#define XtCBackgroundStipple "BackgroundStipple"
+#define XtNdefaultScale "defaultScale"
+#define XtCDefaultScale "DefaultScale"
+#define XtNcanvasWidth "canvasWidth"
+#define XtCCanvasWidth "CanvasWidth"
+#define XtNcanvasHeight "canvasHeight"
+#define XtCCanvasHeight "CanvasHeight"
+#define XtNinternalSpace "internalSpace"
+#define XtCInternalSpace "InternalSpace"
+#define XtNlineWidth "lineWidth"
+#define XtCLineWidth "LineWidth"
+#define XtNrubberBand "rubberBand"
+#define XtCRubberBand "RubberBand"
+#define XtNshadowThickness "shadowThickness"
+#define XtCShadowThickness "ShadowThickness"
+#define XtNshadowColor "shadowColor"
+#define XtCShadowColor "ShadowColor"
+#define XtNsliderX "sliderX"
+#define XtCSliderX "SliderX"
+#define XtNsliderY "sliderY"
+#define XtCSliderY "SliderY"
+#define XtNsliderWidth "sliderWidth"
+#define XtCSliderWidth "SliderWidth"
+#define XtNsliderHeight "sliderHeight"
+#define XtCSliderHeight "SliderHeight"
+
+extern WidgetClass pannerWidgetClass;
+
+typedef struct _PannerClassRec *PannerWidgetClass;
+typedef struct _PannerRec      *PannerWidget;
+
+#endif /* _XawPanner_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/PannerP.h b/ThirdParty/X11/Include/X11/Xaw/PannerP.h
new file mode 100644
index 0000000000000000000000000000000000000000..8a7f5803d7de5d758741aa5b24f9884610183759
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/PannerP.h
@@ -0,0 +1,106 @@
+/*
+ *
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author:  Jim Fulton, MIT X Consortium
+ */
+
+#ifndef _XawPannerP_h
+#define _XawPannerP_h
+
+#include <X11/Xaw/Panner.h>
+#include <X11/Xaw/SimpleP.h>
+
+/* new fields in widget class */
+typedef struct {
+    XtPointer extension;
+} PannerClassPart;
+
+/* Panner widget class */
+typedef struct _PannerClassRec {
+    CoreClassPart core_class;
+    SimpleClassPart simple_class;
+    PannerClassPart panner_class;
+} PannerClassRec;
+
+/* new fields in widget */
+typedef struct {
+    /* resources */
+    XtCallbackList report_callbacks;	/* callback/Callback */
+    Boolean allow_off;			/* allowOff/AllowOff */
+    Boolean resize_to_pref;		/* resizeToPreferred/Boolean */
+    Pixel foreground;			/* foreground/Foreground */
+    Pixel shadow_color;			/* shadowColor/ShadowColor */
+    Dimension shadow_thickness;		/* shadowThickness/ShadowThickness */
+    Dimension default_scale;		/* defaultScale/DefaultScale */
+    Dimension line_width;		/* lineWidth/LineWidth */
+    Dimension canvas_width;		/* canvasWidth/CanvasWidth */
+    Dimension canvas_height;		/* canvasHeight/CanvasHeight */
+    Position slider_x;			/* sliderX/SliderX */
+    Position slider_y;			/* sliderY/SliderY */
+    Dimension slider_width;		/* sliderWidth/SliderWidth */
+    Dimension slider_height;		/* sliderHeight/SliderHeight */
+    Dimension internal_border;		/* internalBorderWidth/BorderWidth */
+    String stipple_name;		/* backgroundStipple/BackgroundStipple
+					 */
+    /* private */
+    GC slider_gc;			/* background of slider */
+    GC shadow_gc;			/* edge of slider and shadow */
+    GC xor_gc;				/* for doing XOR tmp graphics */
+    double haspect, vaspect;		/* aspect ratio of core to canvas */
+    Boolean rubber_band;		/* true = rubber band, false = move */
+    struct {
+	Boolean doing;			/* tmp graphics in progress */
+	Boolean showing;		/* true if tmp graphics displayed */
+	Position startx, starty;	/* initial position of slider */
+	Position dx, dy;		/* offset loc for tmp graphics */
+	Position x, y;			/* location for tmp graphics */
+    } tmp;
+    Position knob_x, knob_y;		/* real upper left of knob in canvas */
+    Dimension knob_width, knob_height;	/* real size of knob in canvas */
+    Boolean shadow_valid;		/* true if rects are valid */
+    XRectangle shadow_rects[2];		/* location of shadows */
+    Position last_x, last_y;		/* previous location of knob */
+#ifndef OLDXAW
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} PannerPart;
+
+typedef struct _PannerRec {
+    CorePart core;
+    SimplePart simple;
+    PannerPart panner;
+} PannerRec;
+
+#define PANNER_HSCALE(pw,val)	((pw)->panner.haspect * ((double)(val)))
+#define PANNER_VSCALE(pw,val)	((pw)->panner.vaspect * ((double)(val)))
+
+#define PANNER_DSCALE(pw,val) (Dimension)  \
+((((unsigned long)(val)) * (unsigned long)pw->panner.default_scale) / 100L)
+
+#define PANNER_DEFAULT_SCALE	8		/* percent */
+#define PANNER_OUTOFRANGE -30000
+
+extern PannerClassRec pannerClassRec;
+
+#endif /* _XawPannerP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/Porthole.h b/ThirdParty/X11/Include/X11/Xaw/Porthole.h
new file mode 100644
index 0000000000000000000000000000000000000000..2dbcf18906c6cbf59f2f0b18dc9e09eb7f215cb0
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/Porthole.h
@@ -0,0 +1,61 @@
+/*
+ *
+Copyright 1990, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author:  Jim Fulton, MIT X Consortium
+ */
+
+#ifndef _XawPorthole_h
+#define _XawPorthole_h
+
+#include <X11/Intrinsic.h>
+#include <X11/Xaw/Reports.h>
+
+/*****************************************************************************
+ *
+ * Porthole Widget (subclass of Composite)
+ *
+ * This widget is similar to a viewport without scrollbars.  Child movement
+ * is done by external panners or scrollbars.
+ *
+ * Parameters:
+ *
+ *  Name		Class		Type		Default
+ *  ----		-----		----		-------
+ *
+ *  background		Background	Pixel		XtDefaultBackground
+ *  border	        BorderColor	Pixel		XtDefaultForeground
+ *  borderWidth		BorderWidth	Dimension	1
+ *  height		Height		Dimension	0
+ *  reportCallback	ReportCallback	Pointer		NULL
+ *  width		Width		Dimension	0
+ *  x			Position	Position	0
+ *  y			Position	Position	0
+ *
+ *****************************************************************************/
+
+extern WidgetClass portholeWidgetClass;
+typedef struct _PortholeClassRec *PortholeWidgetClass;
+typedef struct _PortholeRec      *PortholeWidget;
+
+#endif /* _XawPorthole_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/PortholeP.h b/ThirdParty/X11/Include/X11/Xaw/PortholeP.h
new file mode 100644
index 0000000000000000000000000000000000000000..31bd65f9712fcfcb3015c5c4ed8edfd6c093f31f
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/PortholeP.h
@@ -0,0 +1,62 @@
+/*
+ *
+Copyright 1990, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author:  Jim Fulton, MIT X Consortium
+ */
+
+#ifndef _XawPortholeP_h
+#define _XawPortholeP_h
+
+#include <X11/Xaw/Porthole.h>
+
+/* new fields in widget class */
+typedef struct {
+    XtPointer extension;
+} PortholeClassPart;
+
+/* widget class */
+typedef struct _PortholeClassRec {
+    CoreClassPart core_class;
+    CompositeClassPart composite_class;
+    PortholeClassPart porthole_class;
+} PortholeClassRec;
+
+/* new fields in widget */
+typedef struct {
+    /* resources */
+    XtCallbackList report_callbacks;	/* callback/Callback */
+#ifndef OLDXAW
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} PortholePart;
+
+typedef struct _PortholeRec {
+    CorePart core;
+    CompositePart composite;
+    PortholePart porthole;
+} PortholeRec;
+
+extern PortholeClassRec portholeClassRec;
+
+#endif /* _XawPortholeP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/Repeater.h b/ThirdParty/X11/Include/X11/Xaw/Repeater.h
new file mode 100644
index 0000000000000000000000000000000000000000..6b712cacede6423d3baffa626e91e9d50ad70b76
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/Repeater.h
@@ -0,0 +1,73 @@
+/*
+ *
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author:  Jim Fulton, MIT X Consortium
+ */
+
+#ifndef _XawRepeater_h
+#define _XawRepeater_h
+
+#include <X11/Xaw/Command.h>
+
+/*****************************************************************************
+ *
+ * Repeater Widget (subclass of Command)
+ *
+ * This widget is a push button that repeatedly fires when held down
+ *
+ * Parameters:
+ *
+ *  Name		Class		Type		Default
+ *  ----		-----		----		-------
+ *
+ *  decay		Decay		int		5 milliseconds
+ *  flash		Boolean		Boolean		FALSE
+ *  initialDelay	Delay		int		200 milliseconds
+ *  minimumDelay	MinimumDelay	int		10 milliseconds
+ *  repeatDelay		Delay		int		50 milliseconds
+ *  startCallback	StartCallback	XtCallbackList	NULL
+ *  stopCallback	StopCallback	XtCallbackList	NULL
+ *
+ *****************************************************************************/
+
+#define XtNdecay "decay"
+#define XtCDecay "Decay"
+#define XtNinitialDelay "initialDelay"
+#define XtCDelay "Delay"
+#define XtNminimumDelay "minimumDelay"
+#define XtCMinimumDelay "MinimumDelay"
+#define XtNrepeatDelay "repeatDelay"
+#define XtNflash "flash"
+#define XtNstartCallback "startCallback"
+#define XtCStartCallback "StartCallback"
+#define XtNstopCallback "stopCallback"
+#define XtCStopCallback "StopCallback"
+
+
+extern WidgetClass repeaterWidgetClass;
+
+typedef struct _RepeaterClassRec *RepeaterWidgetClass;
+typedef struct _RepeaterRec      *RepeaterWidget;
+
+#endif /* _XawRepeater_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/RepeaterP.h b/ThirdParty/X11/Include/X11/Xaw/RepeaterP.h
new file mode 100644
index 0000000000000000000000000000000000000000..3eebf82dd06aaccf8fcd0f9008c3757914b853f0
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/RepeaterP.h
@@ -0,0 +1,82 @@
+/*
+ *
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author:  Jim Fulton, MIT X Consortium
+ */
+
+#ifndef _XawRepeaterP_h
+#define _XawRepeaterP_h
+
+#include <X11/Xaw/CommandP.h>
+#include <X11/Xaw/Repeater.h>
+
+/* new fields in widget class */
+typedef struct {
+    XtPointer extension;
+} RepeaterClassPart;
+
+/* repeater widget class */
+typedef struct _RepeaterClassRec {
+    CoreClassPart core_class;
+    SimpleClassPart simple_class;
+    LabelClassPart label_class;
+    CommandClassPart command_class;
+    RepeaterClassPart repeater_class;
+} RepeaterClassRec;
+
+typedef struct {
+    /* resources */
+    int initial_delay;			/* initialDelay/Delay */
+    int repeat_delay;			/* repeatDelay/Delay */
+    int minimum_delay;			/* minimumDelay/MinimumDelay */
+    int decay;				/* decay to minimum delay */
+    Boolean flash;			/* flash/Boolean */
+    XtCallbackList start_callbacks;	/* startCallback/StartCallback */
+    XtCallbackList stop_callbacks;	/* stopCallback/StopCallback */
+
+    /* private */
+    int next_delay;			/* next amount for timer */
+    XtIntervalId timer;			/* timer that will fire */
+#ifndef OLDXAW
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} RepeaterPart;
+
+typedef struct _RepeaterRec {
+    CorePart core;
+    SimplePart simple;
+    LabelPart label;
+    CommandPart command;
+    RepeaterPart repeater;
+} RepeaterRec;
+
+					/* milliseconds */
+#define REP_DEF_DECAY			5
+#define REP_DEF_INITIAL_DELAY		200
+#define REP_DEF_MINIMUM_DELAY		10
+#define REP_DEF_REPEAT_DELAY		50
+
+extern RepeaterClassRec repeaterClassRec;
+
+#endif /* _XawRepeaterP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/Reports.h b/ThirdParty/X11/Include/X11/Xaw/Reports.h
new file mode 100644
index 0000000000000000000000000000000000000000..14a65865f3d1749d442eb50e861c6f61fcc5efe3
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/Reports.h
@@ -0,0 +1,55 @@
+/*
+ *
+Copyright 1990, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+#ifndef _Xaw_Reports_h
+#define _Xaw_Reports_h
+
+#include <X11/Intrinsic.h>
+
+/*
+ * XawPannerReport - this structure is used by the reportCallback of the
+ * Panner, Porthole, Viewport, and Scrollbar widgets to report its position.
+ * All fields must be filled in, although the changed field may be used as
+ * a hint as to which fields have been altered since the last report.
+ */
+typedef struct {
+    unsigned int changed;		/* mask, see below */
+    Position slider_x, slider_y;	/* location of slider within outer */
+    Dimension slider_width, slider_height;  /* size of slider */
+    Dimension canvas_width, canvas_height;  /* size of canvas */
+} XawPannerReport;
+
+#define XawPRSliderX		(1 << 0)
+#define XawPRSliderY		(1 << 1)
+#define XawPRSliderWidth	(1 << 2)
+#define XawPRSliderHeight	(1 << 3)
+#define XawPRCanvasWidth	(1 << 4)
+#define XawPRCanvasHeight	(1 << 5)
+#define XawPRAll		(63)	/* union of above */
+
+#define XtNreportCallback "reportCallback"
+#define XtCReportCallback "reportCallback"
+
+#endif /* _Xaw_Reports_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/Scrollbar.h b/ThirdParty/X11/Include/X11/Xaw/Scrollbar.h
new file mode 100644
index 0000000000000000000000000000000000000000..904aad90883a8ece9046f2626d040da4e247d515
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/Scrollbar.h
@@ -0,0 +1,133 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _Scrollbar_h
+#define _Scrollbar_h
+
+/*
+ * Scrollbar Widget
+ */
+
+#include <X11/Xmu/Converters.h>
+#include <X11/Xfuncproto.h>
+
+/* Scrollbar resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ accelerators	     Accelerators	AcceleratorTable NULL
+ ancestorSensitive   AncestorSensitive	Boolean		True
+ background	     Background		Pixel		XtDefaultBackground
+ backgroundPixmap    Pixmap		Pixmap		XtUnspecifiedPixmap
+ borderColor	     BorderColor	Pixel		XtDefaultForeground
+ borderPixmap	     Pixmap		Pixmap		XtUnspecifiedPixmap
+ borderWidth	     BorderWidth	Dimension	1
+ colormap	     Colormap		Colormap	parent's colormap
+ cursor		     Cursor		Cursor		None
+ cursorName	     Cursor		String		NULL
+ depth		     Depth		int		parent's depth
+ destroyCallback     Callback		XtCallbackList	NULL
+ foreground	     Foreground		Pixel		XtDefaultForeground
+ height		     Height		Dimension	length or thickness
+ insensitiveBorder   Insensitive	Pixmap		GreyPixmap
+ jumpProc	     Callback		XtCallbackList	NULL
+ length		     Length		Dimension	1
+ mappedWhenManaged   MappedWhenManaged	Boolean		True
+ minimumThumb	     MinimumThumb	Dimension	7
+ orientation	     Orientation	XtOrientation	XtorientVertical
+ pointerColor	     Foreground		Pixel		XtDefaultForeground
+ pointerColorBackground Background	Pixel		XtDefaultBackground
+ screen		     Screen		Screen		parent's screen
+ scrollDCursor	     Cursor		Cursor		XC_sb_down_arrow
+ scrollHCursor	     Cursor		Cursor		XC_sb_h_double_arrow
+ scrollLCursor	     Cursor		Cursor		XC_sb_left_arrow
+ scrollProc	     Callback		XtCallbackList	NULL
+ scrollRCursor	     Cursor		Cursor		XC_sb_right_arrow
+ scrollUCursor	     Cursor		Cursor		XC_sb_up_arrow
+ scrollVCursor	     Cursor		Cursor		XC_sb_v_double_arrow
+ sensitive	     Sensitive		Boolean		True
+ shown		     Shown		Float		0.0
+ thickness	     Thickness		Dimension	14
+ thumb		     Thumb		Bitmap		GreyPixmap
+ thumbProc	     Callback		XtCallbackList	NULL
+ topOfThumb	     TopOfThumb		Float		0.0
+ translations	     Translations	TranslationTable see source or doc
+ width		     Width		Dimension	thickness or length
+ x		     Position		Position	0
+ y		     Position		Position	0
+
+*/
+
+#define XtCMinimumThumb "MinimumThumb"
+#define XtCShown "Shown"
+#define XtCTopOfThumb "TopOfThumb"
+
+#define XtNminimumThumb "minimumThumb"
+#define XtNtopOfThumb "topOfThumb"
+
+typedef struct _ScrollbarRec	  *ScrollbarWidget;
+typedef struct _ScrollbarClassRec *ScrollbarWidgetClass;
+
+extern WidgetClass scrollbarWidgetClass;
+
+_XFUNCPROTOBEGIN
+
+void XawScrollbarSetThumb
+(
+ Widget			scrollbar,
+#if NeedWidePrototypes
+ double			top,
+ double			shown
+#else
+ float			top,
+ float			shown
+#endif
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _Scrollbar_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/ScrollbarP.h b/ThirdParty/X11/Include/X11/Xaw/ScrollbarP.h
new file mode 100644
index 0000000000000000000000000000000000000000..b36472d4d41083e0fc720e3a8cabb1dd9e2550d4
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/ScrollbarP.h
@@ -0,0 +1,103 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _ScrollbarP_h
+#define _ScrollbarP_h
+
+#include <X11/Xaw/Scrollbar.h>
+#include <X11/Xaw/SimpleP.h>
+
+typedef struct {
+    /* resources */
+    Pixel	   foreground;	/* thumb foreground color */
+    XtOrientation  orientation;	/* horizontal or vertical */
+    XtCallbackList scrollProc;	/* proportional scroll */
+    XtCallbackList thumbProc;	/* jump (to position) scroll */
+    XtCallbackList jumpProc;	/* same as thumbProc but pass data by ref */
+    Pixmap	   thumb;			/* thumb pixmap */
+    Cursor	   upCursor;	/* scroll up cursor */
+    Cursor	   downCursor;	/* scroll down cursor */
+    Cursor	   leftCursor;	/* scroll left cursor */
+    Cursor	   rightCursor;	/* scroll right cursor */
+    Cursor	   verCursor;	/* scroll vertical cursor */
+    Cursor	   horCursor;	/* scroll horizontal cursor */
+    float	   top;
+    float	   shown;
+    Dimension	   length;	/* either height or width */
+    Dimension	   thickness;	/* either width or height */
+    Dimension	   min_thumb;	/* minium size for the thumb */
+
+     /* private */
+    Cursor	   inactiveCursor; /* The normal cursor for scrollbar */
+    char	   direction;	/* a scroll has started; which direction */
+    GC		   gc;		/* a (shared) gc */
+    Position	   topLoc;	/* Pixel that corresponds to top */
+    Dimension	   shownLength;	/* Num pixels corresponding to shown */
+#ifndef OLDXAW
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} ScrollbarPart;
+
+typedef struct _ScrollbarRec {
+    CorePart		core;
+    SimplePart		simple;
+    ScrollbarPart	scrollbar;
+} ScrollbarRec;
+
+typedef struct {
+  XtPointer extension;
+} ScrollbarClassPart;
+
+typedef struct _ScrollbarClassRec {
+    CoreClassPart		core_class;
+    SimpleClassPart		simple_class;
+    ScrollbarClassPart		scrollbar_class;
+} ScrollbarClassRec;
+
+extern ScrollbarClassRec scrollbarClassRec;
+
+#endif /* _ScrollbarP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/Simple.h b/ThirdParty/X11/Include/X11/Xaw/Simple.h
new file mode 100644
index 0000000000000000000000000000000000000000..ff38f16cc8f3ec46c52cb68993b2bfec5cec1e83
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/Simple.h
@@ -0,0 +1,113 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _Simple_h
+#define _Simple_h
+
+#include <X11/Xmu/Converters.h>
+
+/* Resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ background	     Background		Pixel		XtDefaultBackground
+ border		     BorderColor	Pixel		XtDefaultForeground
+ borderWidth	     BorderWidth	Dimension	1
+ cursor		     Cursor		Cursor		None
+ cursorName	     Cursor		String		NULL
+ destroyCallback     Callback		Pointer		NULL
+ displayList	     DisplayList	XawDisplayList*	NULL
+ height		     Height		Dimension	0
+ insensitiveBorder   Insensitive	Pixmap		Gray
+ mappedWhenManaged   MappedWhenManaged	Boolean		True
+ pointerColor        Foreground         Pixel           XtDefaultForeground
+ pointerColorBackground Background      Pixel           XtDefaultBackground
+ sensitive	     Sensitive		Boolean		True
+ tip		     Tip		String		NULL
+ width		     Width		Dimension	0
+ x		     Position		Position	0
+ y		     Position		Position	0
+
+*/
+
+#define XtNcursor "cursor"
+#define XtNcursorName "cursorName"
+#define XtNinsensitiveBorder "insensitiveBorder"
+
+#define XtCInsensitive "Insensitive"
+
+#ifndef XtCInternational
+#define XtCInternational "International"
+#endif
+
+#ifndef XtNinternational
+#define XtNinternational "international"
+#endif
+
+#ifndef OLDXAW
+#ifndef XawNdisplayList
+#define XawNdisplayList "displayList"
+#endif
+
+#ifndef XawCDisplayList
+#define XawCDisplayList "DisplayList"
+#endif
+
+#ifndef XawRDisplayList
+#define XawRDisplayList "XawDisplayList"
+#endif
+
+#define XtNtip		"tip"
+#define XtCTip		"Tip"
+#endif	/* OLDXAW */
+
+typedef struct _SimpleClassRec	*SimpleWidgetClass;
+typedef struct _SimpleRec	*SimpleWidget;
+
+extern WidgetClass simpleWidgetClass;
+
+#endif /* _Simple_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/SimpleMenP.h b/ThirdParty/X11/Include/X11/Xaw/SimpleMenP.h
new file mode 100644
index 0000000000000000000000000000000000000000..e01c151eaa038da48f1e025209294fad5f3352b7
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/SimpleMenP.h
@@ -0,0 +1,99 @@
+/*
+ *
+Copyright 1989, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ */
+
+/*
+ * SimpleMenuP.h - Private Header file for SimpleMenu widget.
+ *
+ * Date:    April 3, 1989
+ *
+ * By:      Chris D. Peterson
+ *          MIT X Consortium
+ *          kit@expo.lcs.mit.edu
+ */
+
+#ifndef _SimpleMenuP_h
+#define _SimpleMenuP_h
+
+#include <X11/Xaw/SimpleMenu.h>
+#include <X11/Xaw/SmeP.h>
+#include <X11/ShellP.h>
+#include <X11/Xaw/XawInit.h>
+
+typedef struct {
+    XtPointer extension;		/* For future needs */
+} SimpleMenuClassPart;
+
+typedef struct _SimpleMenuClassRec {
+    CoreClassPart	    core_class;
+    CompositeClassPart	    composite_class;
+    ShellClassPart	    shell_class;
+    OverrideShellClassPart  override_shell_class;
+    SimpleMenuClassPart	    simpleMenu_class;
+} SimpleMenuClassRec;
+
+extern SimpleMenuClassRec simpleMenuClassRec;
+
+typedef struct _SimpleMenuPart {
+  /* resources */
+    String	label_string;	/* The string for the label or NULL */
+    SmeObject	label;		/* If label_string is non-NULL then this is
+				   the label widget */
+    WidgetClass	label_class;	/* Widget Class of the menu label object */
+    Dimension	top_margin;	/* Top and bottom margins */
+    Dimension	bottom_margin;
+    Dimension	row_height;	/* height of each row (menu entry) */
+    Cursor	cursor;		/* The menu's cursor */
+    SmeObject	popup_entry;	/* The entry to position the cursor on for
+				   when using XawPositionSimpleMenu */
+    Boolean	menu_on_screen;	/* Force the menus to be fully on the screen*/
+    int		backing_store;	/* What type of backing store to use */
+
+    /* private */
+    Boolean	recursive_set_values; /* contain a possible infinite loop */
+    Boolean	menu_width;	/* If true then force width to remain
+				   core.width */
+    Boolean	menu_height;	/* Just like menu_width, but for height */
+    SmeObject	entry_set;	/* The entry that is currently set or
+				   highlighted */
+#ifndef OLDXAW
+    Dimension	left_margin;
+    Dimension	right_margin;
+    XawDisplayList *display_list;
+    Widget	sub_menu;
+    unsigned	char state;
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} SimpleMenuPart;
+
+typedef struct _SimpleMenuRec {
+    CorePart		core;
+    CompositePart	composite;
+    ShellPart		shell;
+    OverrideShellPart	override;
+    SimpleMenuPart	simple_menu;
+} SimpleMenuRec;
+
+#endif /* _SimpleMenuP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/SimpleMenu.h b/ThirdParty/X11/Include/X11/Xaw/SimpleMenu.h
new file mode 100644
index 0000000000000000000000000000000000000000..79f7216ef52191f290a8f9f99291a015d1a97d02
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/SimpleMenu.h
@@ -0,0 +1,171 @@
+/*
+ *
+Copyright 1989, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author:  Chris D. Peterson, MIT X Consortium
+ */
+
+/*
+ * SimpleMenu.h - Public Header file for SimpleMenu widget.
+ *
+ * This is the public header file for the Athena SimpleMenu widget.
+ * It is intended to provide one pane pulldown and popup menus within
+ * the framework of the X Toolkit.  As the name implies it is a first and
+ * by no means complete implementation of menu code. It does not attempt to
+ * fill the needs of all applications, but does allow a resource oriented
+ * interface to menus.
+ *
+ * Date:    April 3, 1989
+ *
+ * By:      Chris D. Peterson
+ *          MIT X Consortium
+ *          kit@expo.lcs.mit.edu
+ */
+
+#ifndef _SimpleMenu_h
+#define _SimpleMenu_h
+
+#include <X11/Shell.h>
+#include <X11/Xmu/Converters.h>
+
+/*
+ * SimpleMenu widget
+ */
+
+/* Resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ background	     Background		Pixel		XtDefaultBackground
+ backgroundPixmap    BackgroundPixmap	Pixmap          None
+ borderColor	     BorderColor	Pixel		XtDefaultForeground
+ borderPixmap	     BorderPixmap	Pixmap		None
+ borderWidth	     BorderWidth	Dimension	1
+ bottomMargin        VerticalMargins    Dimension       VerticalSpace
+ columnWidth         ColumnWidth        Dimension       Width of widest text
+ cursor              Cursor             Cursor          None
+ destroyCallback     Callback		Pointer		NULL
+ displayList	     DisplayList	XawDisplayList*	NULL
+ height		     Height		Dimension	0
+ label               Label              String          NULL (No label)
+ labelClass          LabelClass         Pointer         smeBSBObjectClass
+ leftMargin	     HorizontalMargins	Dimension	0
+ mappedWhenManaged   MappedWhenManaged	Boolean		True
+ rightMargin	     HorizontalMargins	Dimension	0
+ rowHeight           RowHeight          Dimension       Height of Font
+ sensitive	     Sensitive		Boolean		True
+ topMargin           VerticalMargins    Dimension       VerticalSpace
+ width		     Width		Dimension	0
+ x		     Position		Position	0
+ y		     Position		Position	0
+
+*/
+
+typedef struct _SimpleMenuClassRec*	SimpleMenuWidgetClass;
+typedef struct _SimpleMenuRec*		SimpleMenuWidget;
+
+extern WidgetClass simpleMenuWidgetClass;
+
+#define XtNcursor "cursor"
+#define XtNbottomMargin "bottomMargin"
+#define XtNcolumnWidth "columnWidth"
+#define XtNlabelClass "labelClass"
+#define XtNmenuOnScreen "menuOnScreen"
+#define XtNpopupOnEntry "popupOnEntry"
+#define XtNrowHeight "rowHeight"
+#define XtNtopMargin "topMargin"
+#define XtNleftMargin "leftMargin"
+#define XtNrightMargin "rightMargin"
+
+#define XtCColumnWidth "ColumnWidth"
+#define XtCLabelClass "LabelClass"
+#define XtCMenuOnScreen "MenuOnScreen"
+#define XtCPopupOnEntry "PopupOnEntry"
+#define XtCRowHeight "RowHeight"
+
+#define XtCVerticalMargins "VerticalMargins"
+
+#ifndef OLDXAW
+#define XtCHorizontalMargins "HorizontalMargins"
+#define XawNdisplayList "displayList"
+#define XawCDisplayList "DisplayList"
+#define XawRDisplayList "XawDisplayList"
+#endif
+
+/*
+ * Public Functions
+ */
+
+_XFUNCPROTOBEGIN
+
+/*
+ * Function:
+ *	XawSimpleMenuAddGlobalActions
+ *
+ * Parameters:
+ *	app_con - appcontext
+ *
+ * Description:
+ *	Adds the global actions to the simple menu widget.
+ */
+void XawSimpleMenuAddGlobalActions
+(
+ XtAppContext		app_con
+ );
+
+/*
+ * Function:
+ *	XawSimpleMenuGetActiveEntry
+ *
+ * Parameters:
+ *	w - smw widget
+ *
+ * Description:
+ *	Gets the currently active (set) entry.
+ *
+ * Returns:
+ *	The currently set entry or NULL if none is set
+ */
+Widget XawSimpleMenuGetActiveEntry
+(
+ Widget			w
+ );
+
+/*
+ * Function:
+ *	XawSimpleMenuClearActiveEntry
+ *
+ * Parameters:
+ *	w - smw widget
+ *
+ * Description:
+ *	Unsets the currently active (set) entry.
+ */
+void XawSimpleMenuClearActiveEntry
+(
+ Widget			w
+);
+
+_XFUNCPROTOEND
+
+#endif /* _SimpleMenu_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/SimpleP.h b/ThirdParty/X11/Include/X11/Xaw/SimpleP.h
new file mode 100644
index 0000000000000000000000000000000000000000..d8011621a5f76560a2397ed0638aba2e18e2a6ca
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/SimpleP.h
@@ -0,0 +1,98 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _SimpleP_h
+#define _SimpleP_h
+
+#include <X11/Xfuncproto.h>
+
+#include <X11/Xaw/Simple.h>
+
+_XFUNCPROTOBEGIN
+
+#include <X11/Xaw/XawInit.h>
+
+typedef struct {
+    Bool (*change_sensitive)(Widget);
+#ifndef OLDXAW
+    XtPointer extension;
+#endif
+} SimpleClassPart;
+
+#define XtInheritChangeSensitive	((Bool (*)(Widget))_XtInherit)
+
+typedef struct _SimpleClassRec {
+    CoreClassPart	core_class;
+    SimpleClassPart	simple_class;
+} SimpleClassRec;
+
+extern SimpleClassRec simpleClassRec;
+
+typedef struct {
+    /* resources */
+    Cursor cursor;
+    Pixmap insensitive_border;
+    String cursor_name;			/* cursor specified by name */
+    Pixel pointer_fg, pointer_bg;	/* Pointer colors */
+    Boolean international;
+
+    /* private */
+#ifndef OLDXAW
+    XawDisplayList *display_list;
+    String tip;
+    XtPointer pad[3];	/* for future use and keep binary compatability */
+#endif
+} SimplePart;
+
+typedef struct _SimpleRec {
+    CorePart	core;
+    SimplePart	simple;
+} SimpleRec;
+
+_XFUNCPROTOEND
+
+#endif /* _SimpleP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/Sme.h b/ThirdParty/X11/Include/X11/Xaw/Sme.h
new file mode 100644
index 0000000000000000000000000000000000000000..b395ae7b8af0d0755d3bf024308b4d746abddf85
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/Sme.h
@@ -0,0 +1,71 @@
+/*
+ *
+Copyright 1989, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+/*
+ * This is the public header file for the Athena Sme object.
+ * It is intended to be used with the simple menu widget.
+ *
+ * Date:    April 3, 1989
+ *
+ * By:      Chris D. Peterson
+ *          MIT X Consortium
+ *          kit@expo.lcs.mit.edu
+ */
+
+#ifndef _Sme_h
+#define _Sme_h
+
+#include <X11/Intrinsic.h>
+#include <X11/RectObj.h>
+
+/* Resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ callback            Callback		Pointer		NULL
+ destroyCallback     Callback		Pointer		NULL
+ height		     Height		Dimension	0
+ sensitive	     Sensitive		Boolean		True
+ width		     Width		Dimension	0
+ x		     Position		Position	0
+ y		     Position		Position	0
+
+*/
+
+#ifndef XtCInternational
+#define XtCInternational	"International"
+#endif
+
+#ifndef XtNinternational
+#define XtNinternational	"international"
+#endif
+
+
+typedef struct _SmeClassRec *SmeObjectClass;
+typedef struct _SmeRec *SmeObject;
+
+extern WidgetClass smeObjectClass;
+
+#endif /* _Sme_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/SmeBSB.h b/ThirdParty/X11/Include/X11/Xaw/SmeBSB.h
new file mode 100644
index 0000000000000000000000000000000000000000..ab6fda7a8603ea8e28025116e62f1c2167eb791b
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/SmeBSB.h
@@ -0,0 +1,96 @@
+/*
+ *
+Copyright 1989, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+/*
+ * SmeBSB.h - Public Header file for SmeBSB object.
+ *
+ * This is the public header file for the Athena BSB Sme object.
+ * It is intended to be used with the simple menu widget.  This object
+ * provides bitmap - string - bitmap style entries.
+ *
+ * Date:    April 3, 1989
+ *
+ * By:      Chris D. Peterson
+ *          MIT X Consortium
+ *          kit@expo.lcs.mit.edu
+ */
+
+#ifndef _SmeBSB_h
+#define _SmeBSB_h
+
+#include <X11/Xmu/Converters.h>
+#include <X11/Xaw/Sme.h>
+
+/* BSB Menu Entry Resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ callback            Callback           Callback        NULL
+ destroyCallback     Callback		Pointer		NULL
+ font                Font               XFontStruct *   XtDefaultFont
+ foreground          Foreground         Pixel           XtDefaultForeground
+ height		     Height		Dimension	0
+ label               Label              String          Name of entry
+ leftBitmap          LeftBitmap         Pixmap          None
+ leftMargin          HorizontalMargins  Dimension       4
+ menuName	     MenuName		String		NULL
+ rightBitmap         RightBitmap        Pixmap          None
+ rightMargin         HorizontalMargins  Dimension       4
+ sensitive	     Sensitive		Boolean		True
+ vertSpace           VertSpace          int             25
+ width		     Width		Dimension	0
+ x		     Position		Position	0
+ y		     Position		Position	0
+
+*/
+
+typedef struct _SmeBSBClassRec    *SmeBSBObjectClass;
+typedef struct _SmeBSBRec         *SmeBSBObject;
+
+extern WidgetClass smeBSBObjectClass;
+
+#define XtNleftBitmap "leftBitmap"
+#define XtNleftMargin "leftMargin"
+#define XtNrightBitmap "rightBitmap"
+#define XtNrightMargin "rightMargin"
+#define XtNvertSpace   "vertSpace"
+
+#define XtNmenuName "menuName"
+#define XtCMenuName "MenuName"
+
+#ifndef XtNfontSet
+#define XtNfontSet		"fontSet"
+#endif
+
+#ifndef XtCFontSet
+#define XtCFontSet		"FontSet"
+#endif
+
+#define XtCLeftBitmap "LeftBitmap"
+#define XtCHorizontalMargins "HorizontalMargins"
+#define XtCRightBitmap "RightBitmap"
+#define XtCVertSpace   "VertSpace"
+
+#endif /* _SmeBSB_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/SmeBSBP.h b/ThirdParty/X11/Include/X11/Xaw/SmeBSBP.h
new file mode 100644
index 0000000000000000000000000000000000000000..3df9b882af73d8146629c4fe13cd1cea986a9066
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/SmeBSBP.h
@@ -0,0 +1,92 @@
+/*
+ *
+Copyright 1989, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author:  Chris D. Peterson, MIT X Consortium
+ */
+
+#ifndef _XawSmeBSBP_h
+#define _XawSmeBSBP_h
+
+/*
+ * Sme Object Private Data
+ */
+#include <X11/Xaw/SmeP.h>
+#include <X11/Xaw/SmeBSB.h>
+
+typedef struct _SmeBSBClassPart {
+    XtPointer extension;
+} SmeBSBClassPart;
+
+/* Full class record declaration */
+typedef struct _SmeBSBClassRec {
+    RectObjClassPart	rect_class;
+    SmeClassPart	sme_class;
+    SmeBSBClassPart	sme_bsb_class;
+} SmeBSBClassRec;
+
+extern SmeBSBClassRec smeBSBClassRec;
+
+/* New fields for the Sme Object record */
+typedef struct {
+    /* resources */
+    String label;			/* The entry label */
+    int vert_space;			/* extra vert space to leave, as a
+					   percentage of the font height of
+					   the label */
+    Pixmap left_bitmap, right_bitmap;	/* bitmaps to show */
+    Dimension left_margin, right_margin;/* left and right margins */
+    Pixel foreground;			/* foreground color */
+    XFontStruct *font;			/* The font to show label in */
+    XFontSet fontset;			/* or fontset */
+    XtJustify justify;			/* Justification for the label. */
+
+    /* private */
+    Boolean set_values_area_cleared;	/* do we need to unhighlight? */
+    GC norm_gc;				/* noral color gc */
+    GC rev_gc;				/* reverse color gc */
+    GC norm_gray_gc;			/* Normal color (grayed out) gc */
+    GC invert_gc;			/* gc for flipping colors */
+    Dimension left_bitmap_width;	/* size of each bitmap */
+    Dimension left_bitmap_height;
+    Dimension right_bitmap_width;
+    Dimension right_bitmap_height;
+
+#ifndef OLDXAW
+    /* new resources */
+    String menu_name;			/* name of nested sub menu or NULL */
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} SmeBSBPart;
+
+/*
+ * Full instance record declaration
+ */
+typedef struct _SmeBSBRec {
+    ObjectPart	object;
+    RectObjPart	rectangle;
+    SmePart	sme;
+    SmeBSBPart	sme_bsb;
+} SmeBSBRec;
+
+#endif /* _XawSmeBSBP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/SmeLine.h b/ThirdParty/X11/Include/X11/Xaw/SmeLine.h
new file mode 100644
index 0000000000000000000000000000000000000000..af4406f3d0c15f3584dce2907520e3b5a4c1a57c
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/SmeLine.h
@@ -0,0 +1,69 @@
+/*
+ *
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ */
+
+/*
+ * This is the public header file for the Athena SmeLine object.
+ * It is intended to be used with the simple menu widget.
+ *
+ * Date:    April 3, 1989
+ *
+ * By:      Chris D. Peterson
+ *          MIT X Consortium
+ *          kit@expo.lcs.mit.edu
+ */
+
+#ifndef _SmeLine_h
+#define _SmeLine_h
+
+#include <X11/Xaw/Sme.h>
+#include <X11/Xmu/Converters.h>
+
+/* Resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ callback            Callback		Pointer		NULL
+ destroyCallback     Callback		Pointer		NULL
+ height		     Height		Dimension	0
+ sensitive	     Sensitive		Boolean		True
+ width		     Width		Dimension	0
+ x		     Position		Position	0
+ y		     Position		Position	0
+
+*/
+
+#define XtCLineWidth "LineWidth"
+#define XtCStipple "Stipple"
+
+#define XtNlineWidth "lineWidth"
+#define XtNstipple "stipple"
+
+typedef struct _SmeLineClassRec *SmeLineObjectClass;
+typedef struct _SmeLineRec *SmeLineObject;
+
+extern WidgetClass smeLineObjectClass;
+
+#endif /* _SmeLine_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/SmeLineP.h b/ThirdParty/X11/Include/X11/Xaw/SmeLineP.h
new file mode 100644
index 0000000000000000000000000000000000000000..ae9f1d559d58be9a6a071cb3510ec55cb02c4fd6
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/SmeLineP.h
@@ -0,0 +1,73 @@
+/*
+ *
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author:  Chris D. Peterson, MIT X Consortium
+ */
+
+#ifndef _XawSmeLineP_h
+#define _XawSmeLineP_h
+
+/*
+ * SmeLine Widget Private Data
+ */
+#include <X11/Xaw/SmeP.h>
+#include <X11/Xaw/SmeLine.h>
+
+/* New fields for the SmeLine widget class */
+typedef struct _SmeLineClassPart {
+    XtPointer extension;
+} SmeLineClassPart;
+
+/* Full class record */
+typedef struct _SmeLineClassRec {
+    RectObjClassPart    rect_class;
+    SmeClassPart	sme_class;
+    SmeLineClassPart	sme_line_class;
+} SmeLineClassRec;
+
+extern SmeLineClassRec smeLineClassRec;
+
+/* New fields for the SmeLine widget */
+typedef struct {
+    /* resources */
+    Pixel foreground;		/* Foreground color */
+    Pixmap stipple;		/* Line Stipple */
+    Dimension line_width;	/* Width of the line */
+
+    /* private */
+    GC gc;			/* Graphics context for drawing line */
+#ifndef OLDXAW
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} SmeLinePart;
+
+/* Full instance record */
+typedef struct _SmeLineRec {
+    ObjectPart	object;
+    RectObjPart	rectangle;
+    SmePart	sme;
+    SmeLinePart	sme_line;
+} SmeLineRec;
+
+#endif /* _XawSmeLineP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/SmeP.h b/ThirdParty/X11/Include/X11/Xaw/SmeP.h
new file mode 100644
index 0000000000000000000000000000000000000000..bd4bd9da7355359263adf0241ac9fdff93e295a5
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/SmeP.h
@@ -0,0 +1,88 @@
+/*
+ *
+Copyright 1989, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+/*
+ * This is the private header file for the Athena Sme object.
+ * This object is intended to be used with the simple menu widget.
+ *
+ * Date:    April 3, 1989
+ *
+ * By:      Chris D. Peterson
+ *          MIT X Consortium
+ *          kit@expo.lcs.mit.edu
+ */
+
+#ifndef _XawSmeP_h
+#define _XawSmeP_h
+
+/*
+ * Sme Widget Private Data
+ */
+#include <X11/Xfuncproto.h>
+
+#include <X11/Xaw/Sme.h>
+
+_XFUNCPROTOBEGIN
+
+/* New fields for the Sme widget class */
+typedef struct _SmeClassPart {
+    XtWidgetProc highlight;
+    XtWidgetProc unhighlight;
+    XtWidgetProc notify;
+    XtPointer	 extension;
+} SmeClassPart;
+
+/* Full class record */
+typedef struct _SmeClassRec {
+    RectObjClassPart    rect_class;
+    SmeClassPart	sme_class;
+} SmeClassRec;
+
+extern SmeClassRec smeClassRec;
+
+/* New fields for the Sme widget */
+typedef struct {
+    /* resources */
+    XtCallbackList callbacks;
+    Boolean international;
+#ifndef OLDXAW
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} SmePart;
+
+/* Full instance record */
+typedef struct _SmeRec {
+    ObjectPart	object;
+    RectObjPart	rectangle;
+    SmePart	sme;
+} SmeRec;
+
+#define XtInheritHighlight	((XtWidgetProc)_XtInherit)
+#define XtInheritUnhighlight XtInheritHighlight
+#define XtInheritNotify      XtInheritHighlight
+
+_XFUNCPROTOEND
+
+#endif /* _XawSmeP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/StripCharP.h b/ThirdParty/X11/Include/X11/Xaw/StripCharP.h
new file mode 100644
index 0000000000000000000000000000000000000000..a0085b43dd6135dedff36bf17fbf15f0edd43adc
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/StripCharP.h
@@ -0,0 +1,104 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XawStripChartP_h
+#define _XawStripChartP_h
+
+#include <X11/Xaw/StripChart.h>
+#include <X11/Xaw/SimpleP.h>
+
+#define NO_GCS 0
+#define FOREGROUND	(1 << 0)
+#define HIGHLIGHT	(1 << 1)
+#define ALL_GCS (FOREGROUND | HIGHLIGHT)
+
+/* new fields for the stripChart widget */
+typedef struct {
+    /* resources */
+    Pixel fgpixel;		/* color index for graph */
+    Pixel hipixel;		/* color index for lines */
+    GC fgGC;			/* graphics context for fgpixel */
+    GC hiGC;			/* graphics context for hipixel */
+
+    /* private */
+    int update;			/* update frequence */
+    int scale;			/* scale factor */
+    int min_scale;		/* smallest scale factor */
+    int interval;		/* data point interval */
+    XPoint *points;		/* Poly point for repairing graph lines */
+    double max_value;		/* Max Value in window */
+    double valuedata[2048];	/* record of data points */
+    XtIntervalId interval_id;
+    XtCallbackList get_value;	/* proc to call to fetch load pt */
+    int jump_val;		/* Amount to jump on each scroll */
+#ifndef OLDXAW
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} StripChartPart;
+
+/* instance record declaration */
+typedef struct _StripChartRec {
+    CorePart core;
+    SimplePart simple;
+    StripChartPart strip_chart;
+} StripChartRec;
+
+/* new fields for the StripChart widget class record */
+typedef struct {
+    XtPointer extension;
+} StripChartClassPart;
+
+/* class record declaration */
+typedef struct _StripChartClassRec {
+    CoreClassPart core_class;
+    SimpleClassPart simple_class;
+    StripChartClassPart strip_chart_class;
+} StripChartClassRec;
+
+extern StripChartClassRec stripChartClassRec;
+
+#endif /* _XawStripChartP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/StripChart.h b/ThirdParty/X11/Include/X11/Xaw/StripChart.h
new file mode 100644
index 0000000000000000000000000000000000000000..17e92999191071d1c0a511e961e25180c4157562
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/StripChart.h
@@ -0,0 +1,116 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XawStripChart_h
+#define _XawStripChart_h
+
+#include <X11/Intrinsic.h>
+
+/***********************************************************************
+ *
+ * StripChart Widget
+ *
+ ***********************************************************************/
+
+/* StripChart resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ accelerators	     Accelerators	AcceleratorTable NULL
+ ancestorSensitive   AncestorSensitive	Boolean		True
+ background	     Background		Pixel		XtDefaultBackground
+ backgroundPixmap    Pixmap		Pixmap		XtUnspecifiedPixmap
+ borderColor	     BorderColor	Pixel		XtDefaultForeground
+ borderPixmap	     Pixmap		Pixmap		XtUnspecifiedPixmap
+ borderWidth	     BorderWidth	Dimension	1
+ colormap	     Colormap		Colormap	parent's colormap
+ cursor		     Cursor		Cursor		None
+ cursorName	     Cursor		String		NULL
+ depth		     Depth		int		parent's depth
+ destroyCallback     Callback		XtCallbackList	NULL
+ foreground	     Foreground		Pixel		XtDefaultForeground
+ getValue	     Callback		XtCallbackList	NULL
+ height		     Height		Dimension	120
+ highlight	     Foreground		Pixel		XtDefaultForeground
+ insensitiveBorder   Insensitive	Pixmap		GreyPixmap
+ jumpScroll	     JumpScroll		int		1/2 width
+ mappedWhenManaged   MappedWhenManaged	Boolean		True
+ minScale	     Scale		int		1
+ pointerColor	     Foreground		Pixel		XtDefaultForeground
+ pointerColorBackground Background	Pixel		XtDefaultBackground
+ screen		     Screen		Screen		parent's screen
+ sensitive	     Sensitive		Boolean		True
+ translations	     Translations	TranslationTable NULL
+ update		     Interval		int		10 (seconds)
+ width		     Width		Dimension	120
+ x		     Position		Position	0
+ y		     Position		Position	0
+
+*/
+
+#define DEFAULT_JUMP -1
+
+#ifndef _XtStringDefs_h_
+#define XtNhighlight "highlight"
+#define XtNupdate "update"
+#endif
+
+#define XtCJumpScroll "JumpScroll"
+#define XtCScale "Scale"
+
+#define XtNgetValue "getValue"
+#define XtNjumpScroll "jumpScroll"
+#define XtNminScale "minScale"
+#define XtNscale "scale"
+#define XtNvmunix "vmunix"
+
+typedef struct _StripChartRec *StripChartWidget;
+typedef struct _StripChartClassRec *StripChartWidgetClass;
+
+extern WidgetClass stripChartWidgetClass;
+
+#endif /* _XawStripChart_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/Template.c b/ThirdParty/X11/Include/X11/Xaw/Template.c
new file mode 100644
index 0000000000000000000000000000000000000000..6553c9535a819b82dfb0543dcf59e25531841c45
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/Template.c
@@ -0,0 +1,195 @@
+/*
+
+Copyright 1987, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/IntrinsicP.h>
+#include <X11/StringDefs.h>
+#include <X11/Xaw/TemplateP.h>
+
+/*
+ * Class Methods
+ */
+static void TemplateInitialize(Widget, Widget, ArgList, Cardinal*);
+
+/*
+ * Prototypes
+ */
+static Bool TemplateFunction(TemplateWidget, int, int, Bool);
+
+/*
+ * Actions
+ */
+static void TemplateAction(Widget, XEvent*, String*, Cardinal*);
+
+/*
+ * Initialization
+ */
+#define offset(field) XtOffsetOf(TemplateRec, template.field)
+static XtResource resources[] = {
+/*{
+    name,
+    class,
+    type,
+    size,
+    offset,
+    default_type,
+    default_addr
+  },*/
+  {
+    XtNtemplateResource,
+    XtCTemplateResource,
+    XtRTemplateResource,
+    sizeof(char*),
+    offset(resource),
+    XtRString,
+    (XtPointer)"default"
+  },
+};
+#undef offset
+
+static XtActionsRec actions[] =
+{
+    /*{name,		procedure},*/
+    {"template",	TemplateAction},
+};
+
+static char translations[] =
+"<Key>:"	"template()\n"
+;
+
+#define Superclass	(&widgetClassRec)
+TemplateClassRec templateClassRec = {
+  /* core */
+  {
+    (WidgetClass)Superclass,		/* superclass */
+    "Template",				/* class_name */
+    sizeof(TemplateRec),		/* widget_size */
+    NULL,				/* class_initialize */
+    NULL,				/* class_part_initialize */
+    False,				/* class_inited */
+    TemplateInitialize,			/* initialize */
+    NULL,				/* initialize_hook */
+    XtInheritRealize,			/* realize */
+    actions,				/* actions */
+    XtNumber(actions),			/* num_actions */
+    resources,				/* resources */
+    XtNumber(resources),		/* num_resources */
+    NULLQUARK,				/* xrm_class */
+    True,				/* compress_motion */
+    True,				/* compress_exposure */
+    True,				/* compress_enterleave */
+    False,				/* visible_interest */
+    NULL,				/* destroy */
+    NULL,				/* resize */
+    NULL,				/* expose */
+    NULL,				/* set_values */
+    NULL,				/* set_values_hook */
+    XtInheritSetValuesAlmost,		/* set_values_almost */
+    NULL,				/* get_values_hook */
+    NULL,				/* accept_focus */
+    XtVersion,				/* version */
+    NULL,				/* callback_private */
+    translations,			/* tm_table */
+    XtInheritQueryGeometry,		/* query_geometry */
+    XtInheritDisplayAccelerator,	/* display_accelerator */
+    NULL,				/* extension */
+  },
+  /* template */
+  {
+    NULL,				/* extension */
+  }
+};
+
+WidgetClass templateWidgetClass = (WidgetClass)&templateClassRec;
+
+/*
+ * Implementation
+ */
+/*
+ * Function:
+ *	TemplateInitialize
+ *
+ * Parameters:
+ *	request - requested widget
+ *	w	- the widget
+ *	args	- arguments
+ *	num_args - number of arguments
+ *
+ * Description:
+ *	Initializes widget instance.
+ */
+/*ARGSUSED*/
+static void
+TemplateInitialize(Widget request, Widget w, ArgList args, Cardinal *num_args)
+{
+    TemplateWidget tw = (TemplateWidget)w;
+
+    tw->template.private = NULL;
+}
+
+/*
+ * Function:
+ *	TemplateFunction
+ *
+ * Parameters:
+ *	tw    - template widget
+ *	x     - x coordinate
+ *	y     - y coordinate
+ *	force - force action
+ *
+ * Description:
+ *	This function does nothing.
+ *
+ * Return:
+ *	Parameter force
+ */
+/*ARGSUSED*/
+static Bool
+TemplateFunction(TemplateWidget tw, int x, int y, Bool force)
+{
+    return (force);
+}
+
+/*
+ * Function:
+ *	TemplateAction
+ *
+ * Parameters:
+ *	w	   - template widget
+ *	event	   - event that caused this action
+ *	params	   - parameters
+ *	num_params - number of parameters
+ *
+ * Description:
+ *	This function does nothing.
+ */
+/*ARGSUSED*/
+static void
+TemplateAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
+{
+}
diff --git a/ThirdParty/X11/Include/X11/Xaw/Template.h b/ThirdParty/X11/Include/X11/Xaw/Template.h
new file mode 100644
index 0000000000000000000000000000000000000000..c4bb34b73c10eab73c0297176ab4788dbbfd72cc
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/Template.h
@@ -0,0 +1,67 @@
+/*
+
+Copyright 1987, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _Template_h
+#define _Template_h
+
+#include <X11/Intrinsic.h>
+
+/****************************************************************
+ *
+ * Template widget
+ *
+ ****************************************************************/
+
+/* Resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ background	     Background		Pixel		XtDefaultBackground
+ border		     BorderColor	Pixel		XtDefaultForeground
+ borderWidth	     BorderWidth	Dimension	1
+ destroyCallback     Callback		Pointer		NULL
+ height		     Height		Dimension	0
+ mappedWhenManaged   MappedWhenManaged	Boolean		True
+ sensitive	     Sensitive		Boolean		True
+ width		     Width		Dimension	0
+ x		     Position		Position	0
+ y		     Position		Position	0
+
+*/
+
+/* define any special resource names here that are not in <X11/StringDefs.h> */
+#define XtNtemplateResource "templateResource"
+
+#define XtCTemplateResource "TemplateResource"
+
+/* declare specific TemplateWidget class and instance datatypes */
+typedef struct _TemplateClassRec *TemplateWidgetClass;
+typedef struct _TemplateRec *TemplateWidget;
+
+/* declare the class constant */
+extern WidgetClass templateWidgetClass;
+
+#endif /* _Template_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/TemplateP.h b/ThirdParty/X11/Include/X11/Xaw/TemplateP.h
new file mode 100644
index 0000000000000000000000000000000000000000..0031d1d869819c99f9987db0243e0838c8614593
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/TemplateP.h
@@ -0,0 +1,65 @@
+/*
+
+Copyright 1987, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _TemplateP_h
+#define _TemplateP_h
+
+#include <X11/Xaw/Template.h>
+
+/* include superclass private header file */
+#include <X11/CoreP.h>
+
+/* define unique representation types not found in <X11/StringDefs.h> */
+#define XtRTemplateResource "TemplateResource"
+
+typedef struct {
+    XtPointer extension;
+} TemplateClassPart;
+
+typedef struct _TemplateClassRec {
+    CoreClassPart	core_class;
+    TemplateClassPart	template_class;
+} TemplateClassRec;
+
+extern TemplateClassRec templateClassRec;
+
+typedef struct {
+    /* resources */
+    char* resource;
+    /* private */
+    char *private;
+} TemplatePart;
+
+typedef struct _TemplateRec {
+    CorePart		core;
+#if defined(__cplusplus) || defined(c_plusplus)
+    TemplatePart	c_template;
+#else
+    TemplatePart	template;
+#endif
+} TemplateRec;
+
+#endif /* _TemplateP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/Text.h b/ThirdParty/X11/Include/X11/Xaw/Text.h
new file mode 100644
index 0000000000000000000000000000000000000000..78c1478947456432e64048c61c81d01db6e39538
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/Text.h
@@ -0,0 +1,370 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XawText_h
+#define _XawText_h
+
+#include <X11/Xaw/Simple.h>
+
+/*
+
+ Class:		textWidgetClass
+ Class Name:	Text
+ Superclass:	Simple
+
+ Resources added by the Text widget:
+
+ Name		     Class	     RepType		Default Value
+ ----		     -----	     -------		-------------
+ autoFill	    AutoFill	     Boolean		False
+ bottomMargin	    Margin	     Position		2
+ displayPosition    TextPosition     XawTextPosition	0
+ insertPosition	    TextPosition     XawTextPosition	0
+ justify	    JustifyMode	     JustifyMode	left
+ leftColumn	    Column	     Column		0
+ rightColumn	    Column	     Column		0
+ leftMargin	    Margin	     Position		2
+ rightMargin	    Margin	     Position		4
+ positionCallback   Callback	     Callback		NULL
+ scrollHorizontal   Scroll	     Boolean		False
+ scrollVertical     Scroll	     Boolean		False
+ selectTypes        SelectTypes      Pointer            see documentation
+ textSink	    TextSink	     Widget		NULL
+ textSource	    TextSource	     Widget		NULL
+ topMargin	    Margin	     Position		2
+ unrealizeCallback  Callback	     Callback		NULL
+ wrap		    Wrap	     XawTextWrapMode	XawTextWrapNever
+
+*/
+
+typedef long XawTextPosition;
+
+#ifndef notdef
+typedef enum {
+  XawtextScrollNever,
+  XawtextScrollWhenNeeded,
+  XawtextScrollAlways
+} XawTextScrollMode;
+
+typedef enum {
+  XawtextResizeNever,
+  XawtextResizeWidth,
+  XawtextResizeHeight,
+  XawtextResizeBoth
+} XawTextResizeMode;
+#endif
+
+typedef enum {
+  XawtextWrapNever,
+  XawtextWrapLine,
+  XawtextWrapWord
+} XawTextWrapMode;
+
+typedef enum {
+  XawsdLeft,
+  XawsdRight
+} XawTextScanDirection;
+
+typedef enum {
+  XawtextRead,
+  XawtextAppend,
+  XawtextEdit
+} XawTextEditType;
+
+typedef enum {
+  XawselectNull,
+  XawselectPosition,
+  XawselectChar,
+  XawselectWord,
+  XawselectLine,
+  XawselectParagraph,
+  XawselectAll,
+  XawselectAlphaNumeric
+} XawTextSelectType;
+
+typedef enum {
+    XawjustifyLeft,
+    XawjustifyRight,
+    XawjustifyCenter,
+    XawjustifyFull
+} XawTextJustifyMode;
+
+typedef struct {
+    int  firstPos;
+    int  length;
+    char *ptr;
+    unsigned long format;
+} XawTextBlock, *XawTextBlockPtr;
+
+#ifndef OLDXAW
+typedef struct {
+    int line_number;
+    int column_number;
+    XawTextPosition insert_position;
+    XawTextPosition last_position;
+    Boolean overwrite_mode;
+} XawTextPositionInfo;
+
+typedef struct {
+    XawTextPosition left, right;
+    XawTextBlock *block;
+} XawTextPropertyInfo;
+
+typedef struct _XawTextAnchor XawTextAnchor;
+typedef struct _XawTextEntity XawTextEntity;
+typedef struct _XawTextProperty XawTextProperty;
+typedef struct _XawTextPropertyList XawTextPropertyList;
+#endif
+
+#include <X11/Xaw/TextSink.h>
+#include <X11/Xaw/TextSrc.h>
+
+#define XtEtextScrollNever "never"
+#define XtEtextScrollWhenNeeded "whenneeded"
+#define XtEtextScrollAlways "always"
+#define XtEtextResizeNever "never"
+#define XtEtextResizeWidth "width"
+#define XtEtextResizeHeight "height"
+#define XtEtextResizeBoth "both"
+
+#define XtEtextWrapNever	"never"
+#define XtEtextWrapLine		"line"
+#define XtEtextWrapWord		"word"
+
+#define XtNautoFill "autoFill"
+#define XtNbottomMargin "bottomMargin"
+#define XtNdialogHOffset "dialogHOffset"
+#define XtNdialogVOffset "dialogVOffset"
+#define XtNdisplayCaret "displayCaret"
+#define XtNdisplayPosition "displayPosition"
+#define XtNleftMargin "leftMargin"
+#define XtNrightMargin "rightMargin"
+#define XtNpositionCallback "positionCallback"
+#define XtNscrollVertical "scrollVertical"
+#define XtNscrollHorizontal "scrollHorizontal"
+#define XtNselectTypes "selectTypes"
+#define XtNtopMargin "topMargin"
+#define XtNwrap "wrap"
+
+#define XtCColumn		"Column"
+#define XtNleftColumn		"leftColumn"
+#define XtNrightColumn		"rightColumn"
+
+#define XtCJustifyMode		XtCJustify
+#define XtNjustifyMode		XtNjustify
+#define XtEtextJustifyLeft	"left"
+#define XtEtextJustifyRight	"right"
+#define XtEtextJustifyCenter	"center"
+#define XtEtextJustifyFull	"full"
+
+#define XtCAutoFill "AutoFill"
+#define XtCSelectTypes "SelectTypes"
+#define XtCWrap "Wrap"
+#ifndef notdef
+#define XtCScroll		"Scroll"
+#endif
+
+#ifndef _XtStringDefs_h_
+#define XtNinsertPosition "insertPosition"
+#ifndef notdef
+#define XtNresize "resize"
+#define XtCResize "Resize"
+#endif
+#define XtNselection		"selection"
+#endif
+
+/* return Error code for XawTextSearch */
+#define XawTextSearchError      (-12345L)
+
+/* return codes from XawTextReplace */
+#define XawReplaceError	       -1
+#define XawEditDone		0
+#define XawEditError		1
+#define XawPositionError	2
+
+/* XrmQuark is not unsigned long */
+#define XawTextFormat(tw,fmt) ((unsigned long)_XawTextFormat(tw) == (fmt))
+
+extern unsigned long FMT8BIT;
+extern unsigned long XawFmt8Bit;
+extern unsigned long XawFmtWide;
+
+extern WidgetClass textWidgetClass;
+
+typedef struct _TextClassRec *TextWidgetClass;
+typedef struct _TextRec      *TextWidget;
+
+_XFUNCPROTOBEGIN
+
+XrmQuark _XawTextFormat
+(
+ TextWidget		tw
+ );
+
+void XawTextDisplay
+(
+ Widget			w
+ );
+
+void XawTextEnableRedisplay
+(
+ Widget			w
+ );
+
+void XawTextDisableRedisplay
+(
+ Widget			w
+ );
+
+void XawTextSetSelectionArray
+(
+ Widget			w,
+ XawTextSelectType	*sarray
+ );
+
+void XawTextGetSelectionPos
+(
+ Widget			w,
+ XawTextPosition	*begin_return,
+ XawTextPosition	*end_return
+ );
+
+void XawTextSetSource
+(
+ Widget			w,
+ Widget			source,
+ XawTextPosition	top
+ );
+
+int XawTextReplace
+(
+ Widget			w,
+ XawTextPosition	start,
+ XawTextPosition	end,
+ XawTextBlock		*text
+ );
+
+XawTextPosition XawTextTopPosition
+(
+ Widget			w
+ );
+
+XawTextPosition XawTextLastPosition
+(
+ Widget			w
+ );
+
+void XawTextSetInsertionPoint
+(
+ Widget			w,
+ XawTextPosition	position
+ );
+
+XawTextPosition XawTextGetInsertionPoint
+(
+ Widget			w
+ );
+
+void XawTextUnsetSelection
+(
+ Widget			w
+ );
+
+void XawTextSetSelection
+(
+ Widget			w,
+ XawTextPosition	left,
+ XawTextPosition	right
+ );
+
+void XawTextInvalidate
+(
+ Widget			w,
+ XawTextPosition	from,
+ XawTextPosition	to
+);
+
+Widget XawTextGetSource
+(
+ Widget			w
+ );
+
+Widget XawTextGetSink
+(
+ Widget			w
+ );
+
+XawTextPosition XawTextSearch
+(
+ Widget			w,
+#if NeedWidePrototypes
+ int			dir,
+#else
+ XawTextScanDirection	dir,
+#endif
+ XawTextBlock		*text
+ );
+
+void XawTextDisplayCaret
+(
+ Widget			w,
+#if NeedWidePrototypes
+ int			visible
+#else
+ Boolean		visible
+#endif
+ );
+
+_XFUNCPROTOEND
+
+/*
+ * For R3 compatability only
+ */
+#include <X11/Xaw/AsciiSrc.h>
+#include <X11/Xaw/AsciiSink.h>
+
+#endif /* _XawText_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/TextP.h b/ThirdParty/X11/Include/X11/Xaw/TextP.h
new file mode 100644
index 0000000000000000000000000000000000000000..60f462421781e751d48c152b7e78ce98af9ebaab
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/TextP.h
@@ -0,0 +1,317 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XawTextP_h
+#define _XawTextP_h
+
+#include <X11/Xfuncproto.h>
+
+#include <X11/Xaw/Text.h>
+#include <X11/Xaw/SimpleP.h>
+
+_XFUNCPROTOBEGIN
+
+#define MAXCUT	30000	/* Maximum number of characters that can be cut */
+
+#define XawTextGetLastPosition(ctx)				\
+	XawTextSourceScan((ctx)->text.source, 0,		\
+			  XawstAll, XawsdRight, 1, True)
+#define GETLASTPOS	XawTextGetLastPosition(ctx)
+
+#define zeroPosition ((XawTextPosition)0)
+
+extern XtActionsRec _XawTextActionsTable[];
+extern Cardinal _XawTextActionsTableCount;
+
+extern char _XawDefaultTextTranslations[];
+
+#define XawLF	  0x0a
+#define XawCR	  0x0d
+#define XawTAB	  0x09
+#define XawBS	  0x08
+#define XawSP	  0x20
+#define XawDEL	  0x7f
+#define XawESC	  0x1b
+#define XawBSLASH '\\'
+
+/* constants that subclasses may want to know */
+#define DEFAULT_TEXT_HEIGHT ((Dimension)~0)
+#define DEFAULT_TAB_SIZE	8
+
+/* displayable text management data structures */
+typedef struct {
+    XawTextPosition position;
+    Position y;
+#ifndef OLDXAW
+    unsigned int textWidth;
+#else
+    Dimension textWidth;
+#endif
+} XawTextLineTableEntry, *XawTextLineTableEntryPtr;
+
+typedef struct {
+    XawTextPosition left, right;
+    XawTextSelectType type;
+    Atom *selections;
+    int atom_count;
+    int array_size;
+} XawTextSelection;
+
+typedef struct _XawTextSelectionSalt {
+    struct _XawTextSelectionSalt *next;
+    XawTextSelection	s;
+    /*
+     * The element "contents" stores the CT string which is gotten in the
+     * function _XawTextSaltAwaySelection()
+    */
+    char		*contents;
+    int			length;
+} XawTextSelectionSalt;
+
+#ifndef OLDXAW
+typedef struct _XawTextKillRing {
+    struct _XawTextKillRing *next;
+    char *contents;
+    int length;
+    unsigned refcount;
+    unsigned long format;
+} XawTextKillRing;
+
+extern XawTextKillRing *xaw_text_kill_ring;
+#endif
+
+/* Line Tables are n+1 long - last position displayed is in last lt entry */
+typedef struct {
+    XawTextPosition top;	 /* Top of the displayed text */
+    int lines;			 /* How many lines in this table */
+#ifndef OLDXAW
+    int base_line;		 /* line number of first entry */
+#endif
+    XawTextLineTableEntry *info; /* A dynamic array, one entry per line  */
+} XawTextLineTable, *XawTextLineTablePtr;
+
+typedef struct _XawTextMargin {
+    Position left, right, top, bottom;
+} XawTextMargin;
+
+typedef struct _XmuScanline XmuTextUpdate;
+
+#define VMargins(ctx)  ((ctx)->text.margin.top + (ctx)->text.margin.bottom)
+#define HMargins(ctx)  ((ctx)->text.left_margin + (ctx)->text.margin.right)
+#define RVMargins(ctx) ((ctx)->text.r_margin.top + (ctx)->text.r_margin.bottom)
+#define RHMargins(ctx) ((ctx)->text.r_margin.left + (ctx)->text.r_margin.right)
+
+#define IsPositionVisible(ctx, pos) \
+(pos >= ctx->text.lt.info[0].position && \
+		 pos < ctx->text.lt.info[ctx->text.lt.lines].position)
+
+/*
+ * Search & Replace data structure
+ */
+struct SearchAndReplace {
+    Boolean selection_changed;	/* flag so that the selection cannot be
+				   changed out from underneath query-replace.*/
+    Widget search_popup;	/* The poppup widget that allows searches.*/
+    Widget label1;		/* The label widgets for the search window. */
+    Widget label2;
+    Widget left_toggle;		/* The left search toggle radioGroup. */
+    Widget right_toggle;	/* The right search toggle radioGroup. */
+    Widget rep_label;		/* The Replace label string. */
+    Widget rep_text;		/* The Replace text field. */
+    Widget search_text;		/* The Search text field. */
+    Widget rep_one;		/* The Replace one button. */
+    Widget rep_all;		/* The Replace all button. */
+#ifndef OLDXAW
+    Widget case_sensitive;	/* The "Case Sensitive" toggle */
+#endif
+};
+
+/* New fields for the Text widget class record */
+typedef struct {
+  XtPointer extension;
+} TextClassPart;
+
+/* Full class record declaration */
+typedef struct _TextClassRec {
+    CoreClassPart	core_class;
+    SimpleClassPart	simple_class;
+    TextClassPart	text_class;
+} TextClassRec;
+
+extern TextClassRec textClassRec;
+
+/* New fields for the Text widget record */
+typedef struct _TextPart {
+    /* resources */
+    Widget source, sink;
+    XawTextPosition insertPos;
+    XawTextSelection s;
+    XawTextSelectType *sarray;		     /* Array to cycle for selections */
+    XawTextSelectionSalt *salt;		     /* salted away selections */
+    int left_margin;
+    int dialog_horiz_offset, dialog_vert_offset; /* position for popup dialog */
+    Boolean display_caret;		     /* insertion pt visible iff T */
+    Boolean auto_fill;			     /* Auto fill mode? */
+    XawTextScrollMode scroll_vert, scroll_horiz;
+    XawTextWrapMode wrap;		     /* The type of wrapping */
+    XawTextResizeMode resize;
+    XawTextMargin r_margin;		     /* The real margins */
+#ifndef OLDXAW
+    XtCallbackList position_callbacks;
+#else
+    XtPointer pad1;
+#endif
+
+    /* private state */
+    XawTextMargin margin;		     /* The current margins */
+    XawTextLineTable lt;
+    XawTextScanDirection extendDir;
+    XawTextSelection origSel;		     /* the selection being modified */
+    Time lasttime;			     /* timestamp of last processed action */
+    Time time;				     /* time of last key or button action */
+    Position ev_x, ev_y;		     /* x, y coords for key or button action */
+    Widget vbar, hbar;			     /* The scroll bars (none = NULL) */
+    struct SearchAndReplace *search;	     /* Search and replace structure */
+    Widget file_insert;			     /* The file insert popup widget */
+    XmuTextUpdate *update;		     /* Position intervals to update */
+#ifndef OLDXAW
+    int line_number;
+    short column_number;
+    unsigned char kill_ring;
+    Boolean selection_state;
+#else
+    XtPointer pad2;
+    int pad3;
+#endif
+    int from_left;			     /* Cursor position */
+    XawTextPosition lastPos;		     /* Last position of source */
+    GC gc;
+    Boolean showposition;		     /* True if we need to show the position */
+    Boolean hasfocus;			     /* TRUE if we currently have input focus*/
+    Boolean update_disabled;		     /* TRUE if display updating turned off */
+    Boolean clear_to_eol;		     /* Clear to eol when painting text? */
+    XawTextPosition old_insert;		     /* Last insertPos for batched updates */
+    short mult;				     /* Multiplier */
+#ifndef OLDXAW
+    XawTextKillRing *kill_ring_ptr;
+#else
+    XtPointer pad4;
+#endif
+
+    /* private state, shared w/Source and Sink */
+    Boolean redisplay_needed;		     /* in SetValues */
+    XawTextSelectionSalt *salt2;	     /* salted away selections */
+
+#ifndef OLDXAW
+    char numeric;
+    char source_changed;
+    Boolean overwrite;                      /* Overwrite mode */
+
+    /* new resources and states, for text edition
+     * Note: a fixed width font is required for these resources/states.
+     */
+    short left_column, right_column;
+    XawTextJustifyMode justify;
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} TextPart;
+
+#define XtRWrapMode	"WrapMode"
+#define XtRScrollMode	"ScrollMode"
+#define XtRResizeMode	"ResizeMode"
+#define XtRJustifyMode	"JustifyMode"
+
+/* full instance record */
+typedef struct _TextRec {
+    CorePart	core;
+    SimplePart	simple;
+    TextPart	text;
+} TextRec;
+
+/*
+ * Semi-private functions
+ * for use by other Xaw modules only
+ */
+void _XawTextBuildLineTable
+(
+ TextWidget		ctx,
+ XawTextPosition	top_pos,
+ _XtBoolean		force_rebuild
+ );
+
+char *_XawTextGetSTRING
+(
+ TextWidget		ctx,
+ XawTextPosition	left,
+ XawTextPosition	right
+ );
+
+void _XawTextSaltAwaySelection
+(
+ TextWidget		ctx,
+ Atom			*selections,
+ int			num_atoms
+ );
+
+void _XawTextPosToXY
+(
+ Widget			w,
+ XawTextPosition	pos,
+ Position		*x,
+ Position		*y
+ );
+
+void _XawTextNeedsUpdating
+(
+ TextWidget		ctx,
+ XawTextPosition	left,
+ XawTextPosition	right
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XawTextP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/TextSink.h b/ThirdParty/X11/Include/X11/Xaw/TextSink.h
new file mode 100644
index 0000000000000000000000000000000000000000..f3dd968556e3770320289d0230dd390b132a6070
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/TextSink.h
@@ -0,0 +1,359 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XawTextSink_h
+#define _XawTextSink_h
+
+#include <X11/Xaw/Text.h>
+
+/***********************************************************************
+ *
+ * TextSink Object
+ *
+ ***********************************************************************/
+
+/* Resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ font                Font            XFontStruct *      XtDefaultFont
+ foreground          Foreground      Pixel              XtDefaultForeground
+ background          Background      Pixel              XtDefaultBackground
+ cursorColor	     Color	      Pixel		XtDefaultForeground
+*/
+
+/* Class record constants */
+
+extern WidgetClass textSinkObjectClass;
+
+typedef struct _TextSinkClassRec *TextSinkObjectClass;
+typedef struct _TextSinkRec      *TextSinkObject;
+
+typedef enum {XawisOn, XawisOff} XawTextInsertState;
+
+#ifndef OLDXAW
+#ifndef XtNcursorColor
+#define XtNcursorColor		"cursorColor"
+#endif
+
+#define XawNtextProperties	"textProperties"
+#define XawCTextProperties	"TextProperties"
+#define XawRTextProperties	"XawTextProperties"
+#endif
+
+/*
+ * Public Functions
+ */
+_XFUNCPROTOBEGIN
+
+/*
+ * Function:
+ *	XawTextSinkDisplayText
+ *
+ * Parameters:
+ *	w	  - the TextSink Object
+ *	x	  - location to start drawing text
+ *	y	  - ""
+ *	pos1	  - location of starting and ending points in the text buffer
+ *	pos2	  - ""
+ *	highlight - hightlight this text?
+ *
+ * Description:
+ *	Stub function that in subclasses will display text.
+ *
+ * Note:
+ *	  This function doesn't actually display anything, it is only a place
+ *	holder.
+ */
+void XawTextSinkDisplayText
+(
+ Widget			w,
+#if NeedWidePrototypes
+ int			x,
+ int			y,
+#else
+ Position		x,
+ Position		y,
+#endif
+ XawTextPosition	pos1,
+ XawTextPosition	pos2,
+#if NeedWidePrototypes
+ int			highlight
+#else
+ Boolean		highlight
+#endif
+ );
+
+/*
+ * Function:
+ *	XawTextSinkInsertCursor
+ *
+ * Parameters:
+ *	w	- the TextSink Object.
+ *	x	- location for the cursor.
+ *	y	- ""
+ *	state	- whether to turn the cursor on, or off
+ *
+ * Description:
+ *	Places the InsertCursor.
+ *
+ * Note:
+ *	  This function doesn't actually display anything, it is only a place
+ *	holder.
+ */
+void XawTextSinkInsertCursor
+(
+ Widget			w,
+#if NeedWidePrototypes
+ int			x,
+ int			y,
+ int			state
+#else
+ Position		x,
+ Position		y,
+ XawTextInsertState	state
+#endif
+ );
+
+/*
+ * Function:
+ *	XawTextSinkClearToBackground
+ *
+ * Parameters:
+ *	w	- TextSink Object
+ *	x	- location of area to clear
+ *	y	- ""
+ *	width	- size of area to clear
+ *	height	- ""
+ *
+ * Description:
+ *	Clears a region of the sink to the background color.
+ *
+ * Note:
+ *	  This function doesn't actually display anything, it is only a place
+ *	holder.
+ */
+void XawTextSinkClearToBackground
+(
+ Widget			w,
+#if NeedWidePrototypes
+ int			x,
+ int			y,
+ unsigned int		width,
+ unsigned int		height
+#else
+ Position		x,
+ Position		y,
+ Dimension		width,
+ Dimension		height
+#endif
+ );
+
+/*
+ * Function:
+ *	XawTextSinkFindPosition
+ *
+ * Parameters:
+ *	w		- TextSink Object
+ *	fromPos		- reference position
+ *	fromX		- reference location
+ *	width		- width of section to paint text
+ *	stopAtWordBreak - returned position is a word break?
+ *	resPos		- Position to return
+ *	resWidth	- Width actually used
+ *	resHeight	- Height actually used
+ *
+ * Description:
+ *	Finds a position in the text.
+ */
+void XawTextSinkFindPosition
+(
+ Widget			w,
+ XawTextPosition	fromPos,
+ int			fromX,
+ int			width,
+#if NeedWidePrototypes
+ int			stopAtWordBreak,
+#else
+ Boolean		stopAtWordBreak,
+#endif
+ XawTextPosition*	pos_return,
+ int			*width_return,
+ int			*height_return
+ );
+
+/*
+ * Function:
+ *	XawTextSinkFindDistance
+ *
+ * Parameters:
+ *	w		- TextSink Object
+ *	fromPos		- starting Position
+ *	fromX		- x location of starting Position
+ *	toPos		- end Position
+ *	resWidth	- Distance between fromPos and toPos
+ *	resPos		- Acutal toPos used
+ *	resHeight	- Height required by this text
+ *
+ * Description:
+ *	Find the Pixel Distance between two text Positions.
+ */
+void XawTextSinkFindDistance
+(
+ Widget			w,
+ XawTextPosition	fromPos,
+ int			fromX,
+ XawTextPosition	toPos,
+ int			*width_return,
+ XawTextPosition	*pos_return,
+ int			*height_return
+ );
+
+/*
+ * Function:
+ *	XawTextSinkResolve
+ *
+ * Parameters:
+ *	w	- TextSink Object
+ *	pos	- reference Position
+ *	fromx	- reference Location
+ *	width	- width to move
+ *	resPos	- resulting position
+ *
+ * Description:
+ *	Resloves a location to a position.
+ */
+void XawTextSinkResolve
+(
+ Widget			w,
+ XawTextPosition	fromPos,
+ int			fromX,
+ int			width,
+ XawTextPosition	*pos_return
+ );
+
+/*
+ * Function:
+ *	XawTextSinkMaxLines
+ *
+ * Parameters:
+ *	w	- TextSink Object
+ *	height	- height to fit lines into
+ *
+ * Returns:
+ *	Number of lines that will fit
+ *
+ * Description:
+ *	Finds the Maximum number of lines that will fit in a given height.
+ */
+int XawTextSinkMaxLines
+(
+ Widget			w,
+#if NeedWidePrototypes
+ unsigned int		height
+#else
+ Dimension		height
+#endif
+ );
+
+/*
+ * Function:
+ *	XawTextSinkMaxHeight
+ *
+ * Parameters:
+ *	w	- TextSink Object
+ *	lines	- number of lines
+ *
+ * Returns:
+ *	Height
+ *
+ * Description:
+ *	Finds the Minium height that will contain a given number lines.
+ */
+int XawTextSinkMaxHeight
+(
+ Widget			w,
+ int			lines
+);
+
+/*
+ * Function:
+ *	XawTextSinkSetTabs
+ *
+ * Parameters:
+ *	w		- TextSink Object
+ *	tab_count	- number of tabs in the list
+ *	tabs		- text positions of the tabs
+ * Description:
+ *	Sets the Tab stops.
+ */
+void XawTextSinkSetTabs
+(
+ Widget			w,
+ int			tab_count,
+ int			*tabs
+);
+
+/*
+ * Function:
+ *	XawTextSinkGetCursorBounds
+ *
+ * Parameters:
+ *	w	- TextSink Object
+ *	rect	- X rectance containing the cursor bounds
+ * Description:
+ *	Finds the bounding box for the insert curor (caret).
+ */
+void XawTextSinkGetCursorBounds
+(
+ Widget			w,
+ XRectangle		*rect_return
+);
+
+_XFUNCPROTOEND
+
+#endif /* _XawTextSink_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/TextSinkP.h b/ThirdParty/X11/Include/X11/Xaw/TextSinkP.h
new file mode 100644
index 0000000000000000000000000000000000000000..78f41d29c7dda690829544d54f9ee197f66e1416
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/TextSinkP.h
@@ -0,0 +1,300 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XawTextSinkP_h
+#define _XawTextSinkP_h
+
+/*
+ * TextSink Object Private Data
+ */
+#include <X11/Xaw/TextSink.h>
+#include <X11/Xaw/TextP.h>	/* This sink works with the Text widget */
+#include <X11/Xaw/TextSrcP.h>	/* This sink works with the Text Source */
+#include <X11/Xmu/Xmu.h>
+
+#ifndef OLDXAW
+/* font/fontset defined? */
+#define XAW_TPROP_FONT		(1<<0)
+#define XAW_TPROP_FONTSET	(1<<1)
+
+/* extra attributes */
+#define XAW_TPROP_FOREGROUND	(1<<2)
+#define XAW_TPROP_BACKGROUND	(1<<3)
+#define XAW_TPROP_FPIXMAP	(1<<4)
+#define XAW_TPROP_BPIXMAP	(1<<5)
+#define XAW_TPROP_UNDERLINE	(1<<6)
+#define XAW_TPROP_OVERSTRIKE	(1<<7)
+#define XAW_TPROP_SUBSCRIPT	(1<<8)
+#define XAW_TPROP_SUPERSCRIPT	(1<<9)
+
+/* xlfd attributes */
+#define XAW_TPROP_FOUNDRY	(1<<0)
+#define XAW_TPROP_FAMILY	(1<<1)
+#define XAW_TPROP_WEIGHT	(1<<2)
+#define XAW_TPROP_SLANT		(1<<3)
+#define XAW_TPROP_SETWIDTH	(1<<4)
+#define XAW_TPROP_ADDSTYLE	(1<<5)
+#define XAW_TPROP_PIXELSIZE	(1<<6)
+#define XAW_TPROP_POINTSIZE	(1<<7)
+#define XAW_TPROP_RESX		(1<<8)
+#define XAW_TPROP_RESY		(1<<9)
+#define XAW_TPROP_SPACING	(1<<10)
+#define XAW_TPROP_AVGWIDTH	(1<<11)
+#define XAW_TPROP_REGISTRY	(1<<12)
+#define XAW_TPROP_ENCODING	(1<<13)
+struct _XawTextProperty {	/* to be extended/modified */
+    XrmQuark identifier, code;
+    unsigned long mask;
+    XFontStruct *font;
+    XFontSet fontset;
+    Pixel foreground, background;
+    Pixmap foreground_pixmap, background_pixmap;
+    XrmQuark xlfd;
+
+    unsigned long xlfd_mask;
+    XrmQuark foundry, family, weight, slant, setwidth, addstyle, pixel_size,
+	     point_size, res_x, res_y, spacing, avgwidth, registry, encoding;
+
+    short underline_position, underline_thickness;
+};
+
+struct _XawTextPropertyList {
+    XrmQuark identifier;
+    Screen *screen;
+    Colormap colormap;
+    int depth;
+    XawTextProperty **properties;
+    Cardinal num_properties;
+    XawTextPropertyList *next;
+};
+
+typedef struct _XawTextPaintStruct XawTextPaintStruct;
+struct _XawTextPaintStruct {
+    XawTextPaintStruct *next;
+    int x, y, width;
+    char *text;			/* formatted text */
+    Cardinal length;		/* length of text */
+    XawTextProperty *property;
+    int max_ascent, max_descent;
+    XmuArea *backtabs;
+    Boolean highlight;
+};
+
+typedef struct {
+    XmuArea *clip, *hightabs;			/* clip list */
+    XawTextPaintStruct *paint, *bearings;	/* drawing information */
+} XawTextPaintList;
+
+typedef struct {
+    XtPointer next_extension;
+    XrmQuark record_type;
+    long version;
+    Cardinal record_size;
+    Bool (*BeginPaint)(Widget);
+    void (*PreparePaint)(Widget, int, int,
+			 XawTextPosition, XawTextPosition, Bool);
+    void (*DoPaint)(Widget);
+    Bool (*EndPaint)(Widget);
+} TextSinkExtRec, *TextSinkExt;
+#endif
+
+typedef void (*_XawSinkDisplayTextProc)
+     (Widget, int, int, XawTextPosition, XawTextPosition, Bool);
+
+typedef void (*_XawSinkInsertCursorProc)
+     (Widget, int, int, XawTextInsertState);
+
+typedef void (*_XawSinkClearToBackgroundProc)
+     (Widget, int, int, unsigned int, unsigned int);
+
+typedef void (*_XawSinkFindPositionProc)
+     (Widget, XawTextPosition, int, int, Bool, XawTextPosition*, int*, int*);
+
+typedef void (*_XawSinkFindDistanceProc)
+     (Widget, XawTextPosition, int, XawTextPosition, int*,
+      XawTextPosition*, int*);
+
+typedef void (*_XawSinkResolveProc)
+     (Widget, XawTextPosition, int, int, XawTextPosition*);
+
+typedef int  (*_XawSinkMaxLinesProc)
+     (Widget, unsigned int);
+
+typedef int  (*_XawSinkMaxHeightProc)
+     (Widget, int);
+
+typedef void (*_XawSinkSetTabsProc)
+     (Widget, int, short*);
+
+typedef void (*_XawSinkGetCursorBoundsProc)
+     (Widget, XRectangle*);
+
+typedef struct _TextSinkClassPart {
+    _XawSinkDisplayTextProc DisplayText;
+    _XawSinkInsertCursorProc InsertCursor;
+    _XawSinkClearToBackgroundProc ClearToBackground;
+    _XawSinkFindPositionProc FindPosition;
+    _XawSinkFindDistanceProc FindDistance;
+    _XawSinkResolveProc Resolve;
+    _XawSinkMaxLinesProc MaxLines;
+    _XawSinkMaxHeightProc MaxHeight;
+    _XawSinkSetTabsProc	SetTabs;
+    _XawSinkGetCursorBoundsProc GetCursorBounds;
+#ifndef OLDXAW
+    TextSinkExt extension;
+#endif
+} TextSinkClassPart;
+
+/* Full class record */
+typedef struct _TextSinkClassRec {
+    ObjectClassPart     object_class;
+    TextSinkClassPart	text_sink_class;
+} TextSinkClassRec;
+
+extern TextSinkClassRec textSinkClassRec;
+
+/* New fields for the TextSink object */
+typedef struct {
+    /* resources */
+    Pixel foreground;		/* Foreground color */
+    Pixel background;		/* Background color */
+
+    /* private */
+    Position *tabs;		/* The tab stops as pixel values */
+    short *char_tabs;		/* The tabs stops as character values */
+    int tab_count;		/* number of items in tabs */
+
+#ifndef OLDXAW
+    /* more resources */
+    Pixel cursor_color;
+    XawTextPropertyList *properties;
+    XawTextPaintList *paint;
+    XtPointer pad[2];	/* for future use and keep binary compatability */
+#endif
+} TextSinkPart;
+
+/* Full instance record */
+typedef struct _TextSinkRec {
+    ObjectPart	 object;
+    TextSinkPart text_sink;
+} TextSinkRec;
+
+/* Semi private routines */
+#ifndef OLDXAW
+XawTextPropertyList *XawTextSinkConvertPropertyList
+(
+ String			 name,
+ String			 spec,
+ Screen			*screen,
+ Colormap		 Colormap,
+ int			 depth
+ );
+
+XawTextProperty *XawTextSinkGetProperty
+(
+ Widget			 w,
+ XrmQuark		 property
+ );
+
+XawTextProperty *XawTextSinkCopyProperty
+(
+ Widget			w,
+ XrmQuark		property
+ );
+
+XawTextProperty *XawTextSinkAddProperty
+(
+ Widget			 w,
+ XawTextProperty	*property
+ );
+
+XawTextProperty *XawTextSinkCombineProperty
+(
+ Widget			 w,
+ XawTextProperty	*result_in_out,
+ XawTextProperty	*property,
+ Bool			 override
+ );
+
+Bool XawTextSinkBeginPaint
+(
+ Widget			w
+ );
+
+void XawTextSinkPreparePaint
+(
+ Widget			w,
+ int			y,
+ int			line,
+ XawTextPosition	from,
+ XawTextPosition	to,
+ Bool			highlight
+);
+
+void XawTextSinkDoPaint
+(
+ Widget			w
+ );
+
+Bool XawTextSinkEndPaint
+(
+ Widget			w
+ );
+#endif
+
+#define XtInheritDisplayText	   ((_XawSinkDisplayTextProc)_XtInherit)
+#define XtInheritInsertCursor	   ((_XawSinkInsertCursorProc)_XtInherit)
+#define XtInheritClearToBackground ((_XawSinkClearToBackgroundProc)_XtInherit)
+#define XtInheritFindPosition	   ((_XawSinkFindPositionProc)_XtInherit)
+#define XtInheritFindDistance	   ((_XawSinkFindDistanceProc)_XtInherit)
+#define XtInheritResolve	   ((_XawSinkResolveProc)_XtInherit)
+#define XtInheritMaxLines	   ((_XawSinkMaxLinesProc)_XtInherit)
+#define XtInheritMaxHeight	   ((_XawSinkMaxHeightProc)_XtInherit)
+#define XtInheritSetTabs	   ((_XawSinkSetTabsProc)_XtInherit)
+#define XtInheritGetCursorBounds   ((_XawSinkGetCursorBoundsProc)_XtInherit)
+
+#endif /* _XawTextSinkP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/TextSrc.h b/ThirdParty/X11/Include/X11/Xaw/TextSrc.h
new file mode 100644
index 0000000000000000000000000000000000000000..2c65e6677c5d1d432411f1572df7669a35a63ab2
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/TextSrc.h
@@ -0,0 +1,275 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XawTextSrc_h
+#define _XawTextSrc_h
+
+#include <X11/Xaw/Text.h>
+
+/* Resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ callback	     Callback		Callback	NULL
+ editType	     EditType		XawTextEditType	XawtextRead
+ enableUndo	     Undo		Boolean		False
+ sourceChanged	     Changed		Boolean		False
+
+*/
+
+/* Class record constants */
+extern WidgetClass textSrcObjectClass;
+
+typedef struct _TextSrcClassRec *TextSrcObjectClass;
+typedef struct _TextSrcRec      *TextSrcObject;
+
+typedef enum {
+    XawstPositions,
+    XawstWhiteSpace,
+    XawstEOL,
+    XawstParagraph,
+    XawstAll,
+    XawstAlphaNumeric
+  } XawTextScanType;
+
+typedef enum {
+    Normal,
+    Selected
+} highlightType;
+
+typedef enum {
+    XawsmTextSelect,
+    XawsmTextExtend
+} XawTextSelectionMode;
+
+typedef enum {
+    XawactionStart,
+    XawactionAdjust,
+    XawactionEnd
+} XawTextSelectionAction;
+
+#define XawTextReadError -1
+#define XawTextScanError -1
+
+#ifndef OLDXAW
+#define XtNenableUndo		"enableUndo"
+#define XtCUndo			"Undo"
+
+#define XtNsourceChanged	"sourceChanged"
+#define XtCChanged		"Changed"
+
+#define XtNpropertyCallback	"propertyCallback"
+#endif
+
+/*
+ * Public Functions
+ */
+_XFUNCPROTOBEGIN
+
+/*
+ * Function:
+ *	XawTextSourceRead
+ *
+ * Parameters:
+ *	w      - TextSrc Object
+ *	pos    - position of the text to retreive
+ *	text   - text block that will contain returned text
+ *	length - maximum number of characters to read
+ *
+ * Description:
+ *	This function reads the source.
+ *
+ * Returns:
+ *	The number of characters read into the buffer
+ */
+XawTextPosition XawTextSourceRead
+(
+ Widget			w,
+ XawTextPosition	pos,
+ XawTextBlock		*text_return,
+ int			length
+ );
+
+/*
+ * Function:
+ *	XawTextSourceReplace
+ *
+ * Parameters:
+ *	src	 - Text Source Object
+ *	startPos - ends of text that will be removed
+ *	endPos	 - ""
+ *	text	 - new text to be inserted into buffer at startPos
+ *
+ * Description:
+ *	Replaces a block of text with new text
+ *
+ * Returns:
+ *	XawEditError or XawEditDone
+ */
+int XawTextSourceReplace
+(
+ Widget			w,
+ XawTextPosition	start,
+ XawTextPosition	end,
+ XawTextBlock		*text
+ );
+
+/*
+ * Function:
+ *	XawTextSourceScan
+ *
+ * Parameters:
+ *	w	 - TextSrc Object
+ *	position - position to start scanning
+ *	type	 - type of thing to scan for
+ *	dir	 - direction to scan
+ *	count	 - which occurance if this thing to search for
+ *	include	 - whether or not to include the character found in
+ *		   the position that is returned.
+ *
+ * Description:
+ *	Scans the text source for the number and type of item specified.
+ *
+ * Returns:
+ *	The position of the text
+ */
+XawTextPosition XawTextSourceScan
+(
+ Widget			w,
+ XawTextPosition	position,
+#if NeedWidePrototypes
+ int			type,
+ int			dir,
+ int			count,
+ int			include
+#else
+ XawTextScanType	type,
+ XawTextScanDirection	dir,
+ int			count,
+ Boolean		include
+#endif
+ );
+
+/*
+ * Function:
+ *	XawTextSourceSearch
+ *
+ * Parameters:
+ *	w	 - TextSource Object
+ *	position - position to start scanning
+ *	dir	 - direction to search
+ *	text	 - the text block to search for
+ *
+ * Description:
+ *	Searchs the text source for the text block passed.
+ *
+ * Returns:
+ *	The position of the text we are searching for or XawTextSearchError
+ */
+XawTextPosition XawTextSourceSearch
+(
+ Widget			w,
+ XawTextPosition	position,
+#if NeedWidePrototypes
+ int			dir,
+#else
+ XawTextScanDirection	dir,
+#endif
+ XawTextBlock		*text
+ );
+
+/*
+ * Function:
+ *	XawTextSourceConvertSelection
+ *
+ * Parameters:
+ *	w	  - TextSrc object
+ *	selection - current selection atom
+ *	target	  - current target atom
+ *	type	  - type to conver the selection to
+ *	value	  - return value that has been converted
+ *	length	  - ""
+ *	format	  - format of the returned value
+ *
+ * Returns:
+ *	True if the selection has been converted
+ */
+Boolean XawTextSourceConvertSelection
+(
+ Widget			w,
+ Atom			*selection,
+ Atom			*target,
+ Atom			*type,
+ XtPointer		*value_return,
+ unsigned long		*length_return,
+ int			*format_return
+ );
+
+/*
+ * Function:
+ *	XawTextSourceSetSelection
+ *
+ * Parameters:
+ *	w	  - TextSrc object
+ *	left	  - bounds of the selection
+ *	right	  - ""
+ *	selection - selection atom
+ *
+ * Description:
+ *	Allows special setting of the selection.
+ */
+void XawTextSourceSetSelection
+(
+ Widget			w,
+ XawTextPosition	start,
+ XawTextPosition	end,
+ Atom			selection
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XawTextSrc_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/TextSrcP.h b/ThirdParty/X11/Include/X11/Xaw/TextSrcP.h
new file mode 100644
index 0000000000000000000000000000000000000000..27514c218c5c288fec6281703a428ef05b59a02c
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/TextSrcP.h
@@ -0,0 +1,258 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XawTextSrcP_h
+#define _XawTextSrcP_h
+
+/*
+ * TextSrc Object Private Data
+ */
+#include <X11/Xfuncproto.h>
+
+#include <X11/Xaw/TextSrc.h>
+#include <X11/Xaw/TextP.h>	/* This source works with the Text widget */
+
+_XFUNCPROTOBEGIN
+
+#ifndef OLDXAW
+struct _XawTextAnchor {
+    XawTextPosition position;
+    XawTextEntity *entities, *cache;
+};
+
+#define	XAW_TENTF_HIDE		0x0001
+#define XAW_TENTF_READ		0x0002
+#define XAW_TENTF_REPLACE	0x0004
+struct _XawTextEntity {
+    short type;
+    short flags;
+    XawTextEntity *next;
+    XtPointer data;
+    XawTextPosition offset;	/* from the anchor */
+    Cardinal length;
+    XrmQuark property;
+};
+#endif
+
+#if 0	/* no longer used */
+/* New fields for the TextSrc object class */
+typedef struct {
+  XtPointer		next_extension;
+  XrmQuark		record_type;
+  long			version;
+  Cardinal		record_size;
+  int			(*Input)();
+} TextSrcExtRec, *TextSrcExt;
+#endif
+
+typedef XawTextPosition (*_XawSrcReadProc)
+     (Widget, XawTextPosition, XawTextBlock*, int);
+
+typedef int (*_XawSrcReplaceProc)
+     (Widget, XawTextPosition, XawTextPosition, XawTextBlock*);
+
+typedef XawTextPosition (*_XawSrcScanProc)
+     (Widget, XawTextPosition, XawTextScanType, XawTextScanDirection,
+      int, Bool);
+
+typedef XawTextPosition (*_XawSrcSearchProc)
+     (Widget, XawTextPosition, XawTextScanDirection, XawTextBlock*);
+
+typedef void (*_XawSrcSetSelectionProc)
+     (Widget, XawTextPosition, XawTextPosition, Atom);
+
+typedef Boolean (*_XawSrcConvertSelectionProc)
+     (Widget, Atom*, Atom*, Atom*, XtPointer*, unsigned long*, int*);
+
+typedef struct _TextSrcClassPart {
+    _XawSrcReadProc Read;
+    _XawSrcReplaceProc Replace;
+    _XawSrcScanProc Scan;
+    _XawSrcSearchProc Search;
+    _XawSrcSetSelectionProc SetSelection;
+    _XawSrcConvertSelectionProc ConvertSelection;
+#ifndef OLDXAW
+    XtPointer extension;
+#endif
+} TextSrcClassPart;
+
+/* Full class record */
+typedef struct _TextSrcClassRec {
+    ObjectClassPart     object_class;
+    TextSrcClassPart	textSrc_class;
+} TextSrcClassRec;
+
+extern TextSrcClassRec textSrcClassRec;
+
+#ifndef OLDXAW
+typedef struct _XawTextUndo XawTextUndo;
+#endif
+
+/* New fields for the TextSrc object */
+typedef struct {
+    /* resources */
+    XawTextEditType	edit_mode;
+    XrmQuark text_format;		/* 2 formats: FMT8BIT for Ascii
+					   FMTWIDE for ISO 10646 */
+#ifndef OLDXAW
+    XtCallbackList callback;		/* A callback list to call when the
+					   source is changed */
+    Boolean changed;
+    Boolean enable_undo;
+
+    /* private state */
+    Boolean undo_state;			/* to protect undo manipulation */
+    XawTextUndo *undo;
+    WidgetList text;			/* TextWidget's using this source */
+    Cardinal num_text;
+    XtCallbackList property_callback;
+    XawTextAnchor **anchors;
+    int num_anchors;
+    XtPointer pad[1];	/* for future use and keep binary compatability */
+#endif
+} TextSrcPart;
+
+/* Full instance record */
+typedef struct _TextSrcRec {
+    ObjectPart	object;
+    TextSrcPart	textSrc;
+} TextSrcRec;
+
+/*
+ * Semiprivate declarations of functions used in other modules
+ */
+char* _XawTextWCToMB
+(
+ Display	*display,
+ wchar_t	*wstr,
+ int		*len_in_out
+ );
+
+wchar_t* _XawTextMBToWC
+(
+ Display	*display,
+ char		*str,
+ int		*len_in_out
+ );
+
+#ifndef OLDXAW
+XawTextAnchor *XawTextSourceAddAnchor
+(
+ Widget			source,
+ XawTextPosition	position
+ );
+
+XawTextAnchor *XawTextSourceFindAnchor
+(
+ Widget			source,
+ XawTextPosition	position
+ );
+
+XawTextAnchor *XawTextSourceNextAnchor
+(
+ Widget			 source,
+ XawTextAnchor		*anchor
+ );
+
+XawTextAnchor *XawTextSourcePrevAnchor
+(
+ Widget			 source,
+ XawTextAnchor		*anchor
+ );
+
+XawTextAnchor *XawTextSourceRemoveAnchor
+(
+ Widget			 source,
+ XawTextAnchor		*anchor
+ );
+
+Bool XawTextSourceAnchorAndEntity
+(
+ Widget			  w,
+ XawTextPosition	  position,
+ XawTextAnchor		**anchor_return,
+ XawTextEntity		**entity_return
+ );
+
+XawTextEntity *XawTextSourceAddEntity
+(
+ Widget			source,
+ int			type,
+ int			flags,
+ XtPointer		data,
+ XawTextPosition	position,
+ Cardinal		length,
+ XrmQuark		property
+ );
+
+void XawTextSourceClearEntities
+(
+ Widget			w,
+ XawTextPosition	left,
+ XawTextPosition	right
+ );
+#endif
+
+#if 0	/* no longer used */
+typedef XawTextPosition (*_XawTextPositionFunc)();
+#endif
+
+#define XtInheritInput			((_XawTextPositionFunc)_XtInherit)
+#define XtInheritRead			((_XawSrcReadProc)_XtInherit)
+#define XtInheritReplace		((_XawSrcReplaceProc)_XtInherit)
+#define XtInheritScan			((_XawSrcScanProc)_XtInherit)
+#define XtInheritSearch			((_XawSrcSearchProc)_XtInherit)
+#define XtInheritSetSelection		((_XawSrcSetSelectionProc)_XtInherit)
+#define XtInheritConvertSelection     ((_XawSrcConvertSelectionProc)_XtInherit)
+#if 0
+#define XtTextSrcExtVersion	      1
+#define XtTextSrcExtTypeString        "XT_TEXTSRC_EXT"
+#endif
+
+_XFUNCPROTOEND
+
+#endif /* _XawTextSrcP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/Tip.h b/ThirdParty/X11/Include/X11/Xaw/Tip.h
new file mode 100644
index 0000000000000000000000000000000000000000..5400234dc386d967d193a6eecfe327760451d553
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/Tip.h
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 1999 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ *
+ * Author: Paulo César Pereira de Andrade
+ */
+
+#ifndef _XawTip_h
+#define _XawTip_h
+
+/*
+ * Tip Widget
+ */
+
+#include <X11/Xaw/Simple.h>
+
+/* Resources:
+
+  Name		    Class		RepType		Default Value
+  ----		    -----		-------		-------------
+  background	    Background		Pixel		XtDefaultBackground
+  backgroundPixmap  BackgroundPixmap	Pixmap		XtUnspecifiedPixmap
+  border	    BorderColor		Pixel		XtDefaultForeground
+  borderWidth	    BorderWidth		Dimension	1
+  bottomMargin	    VerticalMargins	Dimension	2
+  destroyCallback   Callback		XtCallbackList	NULL
+  displayList	    DisplayList		XawDisplayList*	NULL
+  font		    Font		XFontStruct*	XtDefaultFont
+  foreground	    Foreground		Pixel		XtDefaultForeground
+  height	    Height		Dimension	text height
+  leftMargin	    HorizontalMargins	Dimension	6
+  rightMargin	    HorizontalMargins	Dimension	6
+  timeout	    Timeout		Int		500
+  topMargin	    VerticalMargins	Dimension	2
+  width		    Width		Dimension	text width
+  x		    Position		Position	0
+  y		    Position		Position	0
+
+*/
+
+typedef struct _TipClassRec *TipWidgetClass;
+typedef struct _TipRec *TipWidget;
+
+extern WidgetClass tipWidgetClass;
+
+#define XtNbottomMargin		"bottomMargin"
+#define XawNdisplayList		"displayList"
+#define XtNencoding		"encoding"
+#define XtNleftMargin		"leftMargin"
+#define XtNrightMargin		"rightMargin"
+#define XtNtimeout		"timeout"
+#define XtNtopMargin		"topMargin"
+#define XtNtip			"tip"
+
+#define XawCDisplayList		"DisplayList"
+#define XtCHorizontalMargins	"HorizontalMargins"
+#define XtCTimeout		"Timeout"
+#define XtCVerticalMargins	"VerticalMargins"
+#define XtCTip			"Tip"
+
+#define XawRDisplayList		"XawDisplayList"
+
+/*
+ * Public Functions
+ */
+/*
+ * Function:
+ *	XawTipEnable
+ *
+ * Parameters:
+ *	w - widget
+ *
+ * Description:
+ *	Enables the tip event handler for this widget.
+ */
+void XawTipEnable
+(
+ Widget		w
+ );
+
+/*
+ * Function:
+ *	XawTipEnable
+ *
+ * Parameters:
+ *	w - widget
+ *
+ * Description:
+ *	Disables the tip event handler for this widget.
+ */
+void XawTipDisable
+(
+ Widget		w
+ );
+
+#endif /* _XawTip_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/TipP.h b/ThirdParty/X11/Include/X11/Xaw/TipP.h
new file mode 100644
index 0000000000000000000000000000000000000000..48c688be4c0a75178f246692d78276831a718008
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/TipP.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 1999 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ *
+ * Author: Paulo César Pereira de Andrade
+ */
+
+#ifndef _XawTipP_h
+#define _XawTipP_h
+
+#include <X11/Xaw/Tip.h>
+#include <X11/CoreP.h>
+#include <X11/Xaw/XawInit.h>
+
+typedef struct {
+    XtPointer extension;
+} TipClassPart;
+
+typedef struct _TipClassRec {
+    CoreClassPart core_class;
+    TipClassPart tip_class;
+} TipClassRec;
+
+extern TipClassRec tipClassRec;
+
+typedef struct _TipPart {
+    /* resources */
+    Pixel foreground;
+    XFontStruct	*font;
+    XFontSet fontset;
+    Dimension top_margin;
+    Dimension bottom_margin;
+    Dimension left_margin;
+    Dimension right_margin;
+    int backing_store;
+    int timeout;
+    XawDisplayList *display_list;
+
+    /* private */
+    GC gc;
+    XtIntervalId timer;
+    String label;
+    Boolean international;
+    unsigned char encoding;
+    XtPointer pad[4];
+} TipPart;
+
+typedef struct _TipRec {
+    CorePart core;
+    TipPart tip;
+} TipRec;
+
+#endif /* _XawTipP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/Toggle.h b/ThirdParty/X11/Include/X11/Xaw/Toggle.h
new file mode 100644
index 0000000000000000000000000000000000000000..f6c6b970e91c3231e0c931f61ae16ac9b6adf93f
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/Toggle.h
@@ -0,0 +1,179 @@
+/*
+ *
+Copyright 1989, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+/*
+ * ToggleP.h - Private definitions for Toggle widget
+ *
+ * Author: Chris D. Peterson
+ *         MIT X Consortium
+ *         kit@expo.lcs.mit.edu
+ *
+ * Date:   January 12, 1989
+ */
+
+#ifndef _XawToggle_h
+#define _XawToggle_h
+
+#include <X11/Xaw/Command.h>
+
+/* Resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ radioGroup          RadioGroup         Widget          NULL              +
+ radioData           RadioData          Pointer         (XPointer) Widget  ++
+ state               State              Boolean         Off
+
+ background	     Background		Pixel		XtDefaultBackground
+ bitmap		     Pixmap		Pixmap		None
+ border		     BorderColor	Pixel		XtDefaultForeground
+ borderWidth	     BorderWidth	Dimension	1
+ callback	     Callback		Pointer		NULL
+ cursor		     Cursor		Cursor		None
+ destroyCallback     Callback		Pointer		NULL
+ displayList	     DisplayList	XawDisplayList*	NULL
+ font		     Font		XFontStructx*	XtDefaultFont
+ foreground	     Foreground		Pixel		XtDefaultForeground
+ height		     Height		Dimension	text height
+ highlightThickness  Thickness		Dimension	2
+ insensitiveBorder   Insensitive	Pixmap		Gray
+ internalHeight	     Height		Dimension	2
+ internalWidth	     Width		Dimension	4
+ justify	     Justify		XtJustify	XtJustifyCenter
+ label		     Label		String		NULL
+ mappedWhenManaged   MappedWhenManaged	Boolean		True
+ resize		     Resize		Boolean		True
+ sensitive	     Sensitive		Boolean		True
+ width		     Width		Dimension	text width
+ x		     Position		Position	0
+ y		     Position		Position	0
+
++ To use the toggle as a radio toggle button, set this resource to point to
+  any other widget in the radio group.
+
+++ This is the data returned from a call to XtToggleGetCurrent, by default
+   this is set to the name of toggle widget.
+
+*/
+
+/*
+ * These should be in StringDefs.h but aren't so we will define
+ * them here if they are needed
+ */
+#define XtCWidget "Widget"
+#define XtCState "State"
+#define XtCRadioGroup "RadioGroup"
+#define XtCRadioData "RadioData"
+
+#ifndef _XtStringDefs_h_
+#define XtRWidget "Widget"
+#endif
+
+#define XtNstate "state"
+#define XtNradioGroup "radioGroup"
+#define XtNradioData "radioData"
+
+extern WidgetClass               toggleWidgetClass;
+
+typedef struct _ToggleClassRec   *ToggleWidgetClass;
+typedef struct _ToggleRec        *ToggleWidget;
+
+/*
+ * Public Functions
+ */
+
+_XFUNCPROTOBEGIN
+
+/*
+ * Function:
+ *	XawToggleChangeRadioGroup
+ *
+ * Parameters:
+ *	w	    - toggle widget to change lists
+ *	radio_group - any widget in the new list
+ *
+ * Description:
+ *	Allows a toggle widget to change radio lists.
+ */
+void XawToggleChangeRadioGroup
+(
+ Widget		w,
+ Widget		radio_group
+ );
+
+/*
+ * Function:
+ *	XawToggleGetCurrent
+ *
+ * Parameters:
+ *	radio_group - any toggle widget in the toggle list
+ *
+ * Description:
+ *	  Returns the RadioData associated with the toggle
+ *                   widget that is currently active in a toggle list.
+ * Returns:
+ *	The XtNradioData associated with the toggle widget
+ */
+
+XtPointer XawToggleGetCurrent
+(
+ Widget		radio_group
+ );
+
+/*
+ * Function:
+ *	XawToggleSetCurrent
+ *
+ * Parameters:
+ *	radio_group - any toggle widget in the toggle list
+ *	radio_data - radio data of the toggle widget to set
+ *
+ * Description:
+ *	Sets the Toggle widget associated with the radio_data specified.
+ */
+void XawToggleSetCurrent
+(
+ Widget		radio_group,
+ XtPointer	radio_data
+ );
+
+/*
+ * Function:
+ *	XawToggleUnsetCurrent
+ *
+ * Parameters:
+ *	radio_group - any toggle widget in the toggle list
+ *
+ * Description:
+ *	Unsets all Toggles in the radio_group specified.
+ */
+void XawToggleUnsetCurrent
+(
+ Widget		radio_group
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XawToggle_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/ToggleP.h b/ThirdParty/X11/Include/X11/Xaw/ToggleP.h
new file mode 100644
index 0000000000000000000000000000000000000000..a81659801ed1851bf4fc1cf6149068512031da82
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/ToggleP.h
@@ -0,0 +1,92 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author: Chris D. Peterson
+ *         MIT X Consortium
+ *         kit@expo.lcs.mit.edu
+ *
+ * Date:   January 12, 1989
+ *
+ */
+
+#ifndef _XawToggleP_h
+#define _XawToggleP_h
+
+#include <X11/Xaw/Toggle.h>
+#include <X11/Xaw/CommandP.h>
+
+/*
+ * Toggle Widget Private Data
+ */
+#define streq(a, b)	(strcmp((a), (b)) == 0)
+
+typedef struct _RadioGroup {
+    struct _RadioGroup *prev, *next; /* Pointers to other elements in group  */
+    Widget widget;		     /* Widget corrosponding to this element */
+} RadioGroup;
+
+/* New fields for the Toggle widget class */
+typedef struct _ToggleClass  {
+    XtActionProc Set;
+    XtActionProc Unset;
+    XtPointer extension;
+} ToggleClassPart;
+
+/* class record declaration */
+typedef struct _ToggleClassRec {
+    CoreClassPart	core_class;
+    SimpleClassPart	simple_class;
+    LabelClassPart	label_class;
+    CommandClassPart	command_class;
+    ToggleClassPart	toggle_class;
+} ToggleClassRec;
+
+extern ToggleClassRec toggleClassRec;
+
+/* New fields for the Toggle widget */
+typedef struct {
+    /* resources */
+    Widget widget;
+    XtPointer radio_data;
+
+    /* private */
+    RadioGroup *radio_group;
+#ifndef OLDXAW
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} TogglePart;
+
+/* Full widget declaration */
+typedef struct _ToggleRec {
+    CorePart	core;
+    SimplePart	simple;
+    LabelPart	label;
+    CommandPart	command;
+    TogglePart	toggle;
+} ToggleRec;
+
+#endif /* _XawToggleP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/Tree.h b/ThirdParty/X11/Include/X11/Xaw/Tree.h
new file mode 100644
index 0000000000000000000000000000000000000000..1747a7844f8402e703c832a31fb96a5cd3d5be89
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/Tree.h
@@ -0,0 +1,135 @@
+/*
+ *
+
+Copyright 1990, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+ * Copyright 1989 Prentice Hall
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose and without fee is hereby granted, provided that the above
+ * copyright notice appear in all copies and that both the copyright notice
+ * and this permission notice appear in supporting documentation.
+ *
+ * Prentice Hall and the authors disclaim all warranties with regard
+ * to this software, including all implied warranties of merchantability and
+ * fitness.  In no event shall Prentice Hall or the authors be liable
+ * for any special, indirect or cosequential damages or any damages whatsoever
+ * resulting from loss of use, data or profits, whether in an action of
+ * contract, negligence or other tortious action, arising out of or in
+ * connection with the use or performance of this software.
+ *
+ * Authors:  Jim Fulton, MIT X Consortium,
+ *           based on a version by Douglas Young, Prentice Hall
+ *
+ * This widget is based on the Tree widget described on pages 397-419 of
+ * Douglas Young's book "The X Window System, Programming and Applications
+ * with Xt OSF/Motif Edition."  The layout code has been rewritten to use
+ * additional blank space to make the structure of the graph easier to see
+ * as well as to support vertical trees.
+ */
+
+#ifndef _XawTree_h
+#define _XawTree_h
+
+#include <X11/Xmu/Converters.h>
+
+/******************************************************************************
+ *
+ * Tree Widget (subclass of ConstraintClass)
+ *
+ ******************************************************************************
+ *
+ * Parameters:
+ *
+ *  Name                Class              Type            Default
+ *  ----                -----              ----            -------
+ *
+ *  autoReconfigure     AutoReconfigure    Boolean         FALSE
+ *  background          Background         Pixel           XtDefaultBackground
+ *  foreground          Foreground         Pixel           XtDefaultForeground
+ *  gravity             Gravity            XtGravity       West
+ *  hSpace              HSpace             Dimension       20
+ *  lineWidth           LineWidth          Dimension       0
+ *  vSpace              VSpace             Dimension       6
+ *
+ *
+ * Constraint Resources attached to children:
+ *
+ *  treeGC              TreeGC             GC              NULL
+ *  treeParent          TreeParent         Widget          NULL
+ *
+ *
+ *****************************************************************************/
+
+                                        /* new instance field names */
+#ifndef _XtStringDefs_h_
+#define XtNhSpace "hSpace"
+#define XtNvSpace "vSpace"
+#define XtCHSpace "HSpace"
+#define XtCVSpace "VSpace"
+#endif
+
+#define XtNautoReconfigure "autoReconfigure"
+#define XtNlineWidth "lineWidth"
+#define XtNtreeGC "treeGC"
+#define XtNtreeParent "treeParent"
+#define XtNgravity "gravity"
+
+                                        /* new class field names */
+#define XtCAutoReconfigure "AutoReconfigure"
+#define XtCLineWidth "LineWidth"
+#define XtCTreeGC "TreeGC"
+#define XtCTreeParent "TreeParent"
+#define XtCGravity "Gravity"
+
+#define XtRGC "GC"
+
+#ifndef OLDXAW
+#ifndef XawNdisplayList
+#define XawNdisplayList "displayList"
+#endif
+
+#ifndef XawCDisplayList
+#define XawCDisplayList "DisplayList"
+#endif
+
+#ifndef XawRDisplayList
+#define XawRDisplayList "XawDisplayList"
+#endif
+#endif
+                                        /* external declarations */
+extern WidgetClass treeWidgetClass;
+
+typedef struct _TreeClassRec *TreeWidgetClass;
+typedef struct _TreeRec      *TreeWidget;
+
+_XFUNCPROTOBEGIN
+
+void XawTreeForceLayout
+(
+ Widget		tree
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XawTree_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/TreeP.h b/ThirdParty/X11/Include/X11/Xaw/TreeP.h
new file mode 100644
index 0000000000000000000000000000000000000000..01d2bdc88aca26d866fadec65b60459d4e1a1b8e
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/TreeP.h
@@ -0,0 +1,137 @@
+/*
+
+Copyright 1990, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+ * Copyright 1989 Prentice Hall
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose and without fee is hereby granted, provided that the above
+ * copyright notice appear in all copies and that both the copyright notice
+ * and this permission notice appear in supporting documentation.
+ *
+ * Prentice Hall and the authors disclaim all warranties with regard
+ * to this software, including all implied warranties of merchantability and
+ * fitness.  In no event shall Prentice Hall or the authors be liable
+ * for any special, indirect or cosequential damages or any damages whatsoever
+ * resulting from loss of use, data or profits, whether in an action of
+ * contract, negligence or other tortious action, arising out of or in
+ * connection with the use or performance of this software.
+ *
+ * Authors:  Jim Fulton, MIT X Consortium,
+ *           based on a version by Douglas Young, Prentice Hall
+ *
+ * This widget is based on the Tree widget described on pages 397-419 of
+ * Douglas Young's book "The X Window System, Programming and Applications
+ * with Xt OSF/Motif Edition."  The layout code has been rewritten to use
+ * additional blank space to make the structure of the graph easier to see
+ * as well as to support vertical trees.
+ */
+
+#ifndef _XawTreeP_h
+#define _XawTreeP_h
+
+#include <X11/Xaw/Tree.h>
+
+typedef struct _TreeClassPart {
+    XtPointer extension;
+} TreeClassPart;
+
+typedef struct _TreeClassRec {
+    CoreClassPart core_class;
+    CompositeClassPart composite_class;
+    ConstraintClassPart constraint_class;
+    TreeClassPart tree_class;
+} TreeClassRec;
+
+extern TreeClassRec treeClassRec;
+
+typedef struct {
+    /* fields available through resources */
+    Dimension hpad;			/* hSpace/HSpace */
+    Dimension vpad;			/* vSpace/VSpace */
+    Dimension line_width;		/* lineWidth/LineWidth */
+    Pixel foreground;			/* foreground/Foreground */
+    XtGravity gravity;			/* gravity/Gravity */
+    Boolean auto_reconfigure;		/* autoReconfigure/AutoReconfigure */
+    /* private fields */
+    GC gc;				/* used to draw lines */
+    Widget tree_root;			/* hidden root off all children */
+    Dimension *largest;			/* list of largest per depth */
+    int n_largest;			/* number of elements in largest */
+    Dimension maxwidth, maxheight;	/* for shrink wrapping */
+#ifndef OLDXAW
+    XawDisplayList *display_list;
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} TreePart;
+
+
+typedef struct _TreeRec {
+    CorePart core;
+    CompositePart composite;
+    ConstraintPart constraint;
+    TreePart tree;
+}  TreeRec;
+
+
+/*
+ * structure attached to all children
+ */
+typedef struct _TreeConstraintsPart {
+    /* resources */
+    Widget parent;			/* treeParent/TreeParent */
+    GC gc;				/* treeGC/TreeGC */
+    /* private data */
+    Widget *children;
+    int n_children;
+    int max_children;
+    Dimension bbsubwidth, bbsubheight;	/* bounding box of sub tree */
+    Dimension bbwidth, bbheight;	/* bounding box including node */
+    Position x, y;
+#ifndef OLDXAW
+    XtPointer pad[2];	/* leave some space for future optimizations, and
+			 * keep binary compatability
+			 */
+#endif
+} TreeConstraintsPart;
+
+typedef struct _TreeConstraintsRec {
+   TreeConstraintsPart tree;
+} TreeConstraintsRec, *TreeConstraints;
+
+
+/*
+ * useful macros
+ */
+
+#define TREE_CONSTRAINT(w) \
+                   ((TreeConstraints)((w)->core.constraints))
+
+#define TREE_INITIAL_DEPTH 10		/* for allocating largest array */
+#define TREE_HORIZONTAL_DEFAULT_SPACING 20
+#define TREE_VERTICAL_DEFAULT_SPACING 6
+
+#endif /* _XawTreeP_h */
+
+
+
diff --git a/ThirdParty/X11/Include/X11/Xaw/VendorEP.h b/ThirdParty/X11/Include/X11/Xaw/VendorEP.h
new file mode 100644
index 0000000000000000000000000000000000000000..b91f10a8126850014205ccfda57e0d48c2655074
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/VendorEP.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright 1991 by OMRON Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of OMRON not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  OMRON makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ *	Author:	Seiji Kuwari	OMRON Corporation
+ *				kuwa@omron.co.jp
+ *				kuwa%omron.co.jp@uunet.uu.net
+ */
+
+/*
+
+Copyright 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _VendorEP_h
+#define _VendorEP_h
+
+#include <X11/Xaw/XawImP.h>
+
+typedef struct {
+    XtPointer	extension;
+} XawVendorShellExtClassPart;
+
+typedef	struct _VendorShellExtClassRec {
+    ObjectClassPart	object_class;
+    XawVendorShellExtClassPart	vendor_shell_ext_class;
+} XawVendorShellExtClassRec;
+
+typedef struct {
+    Widget	parent;
+    XawImPart	im;
+    XawIcPart	ic;
+#ifndef OLDXAW
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} XawVendorShellExtPart;
+
+typedef	struct XawVendorShellExtRec {
+    ObjectPart	object;
+    XawVendorShellExtPart	vendor_ext;
+} XawVendorShellExtRec, *XawVendorShellExtWidget;
+
+#endif	/* _VendorEP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/Viewport.h b/ThirdParty/X11/Include/X11/Xaw/Viewport.h
new file mode 100644
index 0000000000000000000000000000000000000000..36fab449602d90d0cba352a32adcab57befda8be
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/Viewport.h
@@ -0,0 +1,118 @@
+/************************************************************
+
+Copyright 1987, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+
+#ifndef _XawViewport_h
+#define _XawViewport_h
+
+#include <X11/Xaw/Form.h>
+#include <X11/Xaw/Reports.h>
+
+/* Resources:
+
+ Name		     Class		RepType		Default Value
+ ----		     -----		-------		-------------
+ allowHoriz	     Boolean		Boolean		False
+ allowVert	     Boolean		Boolean		False
+ background	     Background		Pixel		XtDefaultBackground
+ border		     BorderColor	Pixel		XtDefaultForeground
+ borderWidth	     BorderWidth	Dimension	1
+ destroyCallback     Callback		Pointer		NULL
+ forceBars	     Boolean		Boolean		False
+ height		     Height		Dimension	0
+ mappedWhenManaged   MappedWhenManaged	Boolean		True
+ reportCallback	     ReportCallback	Pointer		NULL
+ sensitive	     Sensitive		Boolean		True
+ useBottom	     Boolean		Boolean		False
+ useRight	     Boolean		Boolean		False
+ width		     Width		Dimension	0
+ x		     Position		Position	0
+ y		     Position		Position	0
+
+*/
+
+#ifndef _XtStringDefs_h_
+#define XtNforceBars "forceBars"
+#define XtNallowHoriz "allowHoriz"
+#define XtNallowVert "allowVert"
+#define XtNuseBottom "useBottom"
+#define XtNuseRight "useRight"
+#endif
+
+extern WidgetClass viewportWidgetClass;
+
+typedef struct _ViewportClassRec *ViewportWidgetClass;
+typedef struct _ViewportRec  *ViewportWidget;
+
+_XFUNCPROTOBEGIN
+
+void XawViewportSetLocation
+(
+ Widget			gw,
+#if NeedWidePrototypes
+ double			xoff,
+ double			yoff
+#else
+ float			xoff,
+ float			yoff
+#endif
+ );
+
+void XawViewportSetCoordinates
+(
+ Widget			gw,
+#if NeedWidePrototypes
+ int			x,
+ int			y
+#else
+ Position		x,
+ Position		y
+#endif
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XawViewport_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/ViewportP.h b/ThirdParty/X11/Include/X11/Xaw/ViewportP.h
new file mode 100644
index 0000000000000000000000000000000000000000..2aeb8a5df5511d7f87aa0efec808b13811566b04
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/ViewportP.h
@@ -0,0 +1,107 @@
+/*
+ * Private declarations for ViewportWidgetClass
+ */
+
+/************************************************************
+
+Copyright 1987, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+
+#ifndef _ViewportP_h
+#define _ViewportP_h
+
+#include <X11/Xaw/Viewport.h>
+#include <X11/Xaw/FormP.h>
+
+typedef struct {
+    XtPointer extension;
+} ViewportClassPart;
+
+typedef struct _ViewportClassRec {
+    CoreClassPart	core_class;
+    CompositeClassPart	composite_class;
+    ConstraintClassPart	constraint_class;
+    FormClassPart	form_class;
+    ViewportClassPart	viewport_class;
+} ViewportClassRec;
+
+extern ViewportClassRec viewportClassRec;
+
+typedef struct _ViewportPart {
+    /* resources */
+    Boolean forcebars;		/* Whether we should always display
+				   the selected scrollbars */
+    Boolean allowhoriz;		/* Whether we allow horizontal scrollbars */
+    Boolean allowvert;		/* Whether we allow vertical scrollbars */
+    Boolean usebottom;		/* True if horiz bars appear at bottom */
+    Boolean useright;		/* True if vert bars appear at right */
+    XtCallbackList report_callbacks;/* when size/position changes */
+
+    /* private */
+    Widget clip, child;		/* The clipping and (scrolled) child widgets */
+    Widget horiz_bar, vert_bar;	/* What scrollbars we currently have */
+#ifndef OLDXAW
+    XtPointer pad[4];	/* for future use and keep binary compatability */
+#endif
+} ViewportPart;
+
+typedef struct _ViewportRec {
+    CorePart		core;
+    CompositePart	composite;
+    ConstraintPart	constraint;
+    FormPart		form;
+    ViewportPart	viewport;
+} ViewportRec;
+
+typedef struct {
+    Bool reparented;		/* True if child has been re-parented */
+} ViewportConstraintsPart;
+
+typedef struct _ViewportConstraintsRec {
+    FormConstraintsPart		form;
+    ViewportConstraintsPart	viewport;
+} ViewportConstraintsRec, *ViewportConstraints;
+
+#endif /* _ViewportP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/XawImP.h b/ThirdParty/X11/Include/X11/Xaw/XawImP.h
new file mode 100644
index 0000000000000000000000000000000000000000..a03eef60e807589297b915c997fb8606cebaa31d
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/XawImP.h
@@ -0,0 +1,210 @@
+/*
+ * Copyright 1991 by OMRON Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of OMRON not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  OMRON makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ *	Author:	Seiji Kuwari	OMRON Corporation
+ *				kuwa@omron.co.jp
+ *				kuwa%omron.co.jp@uunet.uu.net
+ */
+
+/*
+
+Copyright 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _XawImP_h
+#define _XawImP_h
+
+#define XtNinputMethod		"inputMethod"
+#define XtCInputMethod		"InputMethod"
+#define XtNpreeditType		"preeditType"
+#define XtCPreeditType		"PreeditType"
+#define XtNopenIm		"openIm"
+#define XtCOpenIm		"OpenIm"
+#define XtNsharedIc		"sharedIc"
+#define XtCSharedIc		"SharedIc"
+
+#include <X11/Xaw/Text.h>
+
+#define	CIICFocus	(1 << 0)
+#define	CIFontSet	(1 << 1)
+#define	CIFg		(1 << 2)
+#define	CIBg		(1 << 3)
+#define	CIBgPixmap	(1 << 4)
+#define	CICursorP	(1 << 5)
+#define	CILineS		(1 << 6)
+
+typedef	struct _XawImPart {
+    XIM			xim;
+    XrmResourceList	resources;
+    Cardinal		num_resources;
+    Boolean		open_im;
+    Boolean		initialized;
+    Dimension		area_height;
+    String		input_method;
+    String		preedit_type;
+} XawImPart;
+
+typedef struct _XawIcTablePart {
+    Widget		widget;
+    XIC			xic;
+    XIMStyle		input_style;
+    unsigned long	flg;
+    unsigned long	prev_flg;
+    Boolean		ic_focused;
+    XFontSet		font_set;
+    Pixel		foreground;
+    Pixel		background;
+    Pixmap		bg_pixmap;
+    XawTextPosition	cursor_position;
+    unsigned long	line_spacing;
+    Boolean		openic_error;
+    struct _XawIcTablePart *next;
+} XawIcTablePart, *XawIcTableList;
+
+typedef	struct _XawIcPart {
+    XIMStyle		input_style;
+    Boolean		shared_ic;
+    XawIcTableList	shared_ic_table;
+    XawIcTableList	current_ic_table;
+    XawIcTableList	ic_table;
+} XawIcPart;
+
+typedef	struct _contextDataRec {
+    Widget		parent;
+    Widget		ve;
+} contextDataRec;
+
+typedef	struct _contextErrDataRec {
+    Widget		widget;
+    XIM			xim;
+} contextErrDataRec;
+
+void _XawImResizeVendorShell
+(
+ Widget			w
+ );
+
+Dimension _XawImGetShellHeight
+(
+ Widget			w
+);
+
+void _XawImRealize
+(
+ Widget			w
+ );
+
+void _XawImInitialize
+(
+ Widget			w,
+ Widget			ext
+ );
+
+void _XawImReconnect
+(
+ Widget			w
+ );
+
+void _XawImRegister
+(
+ Widget			w
+ );
+
+void _XawImUnregister
+(
+ Widget			w
+ );
+
+void _XawImSetValues
+(
+ Widget			w,
+ ArgList		args,
+ Cardinal		num_args
+ );
+
+void _XawImSetFocusValues
+(
+ Widget			w,
+ ArgList		args,
+ Cardinal		num_args
+);
+
+void _XawImUnsetFocus
+(
+ Widget			w
+ );
+
+int _XawImWcLookupString
+(
+ Widget			w,
+ XKeyPressedEvent	*event,
+ wchar_t		*buffer_return,
+ int			bytes_buffer,
+ KeySym			*keysym_return
+ );
+
+int _XawLookupString
+(
+ Widget			w,
+ XKeyEvent		*event,
+ char			*buffer_return,
+ int			buffer_size,
+ KeySym			*keysym_return
+ );
+
+int _XawImGetImAreaHeight
+(
+ Widget			w
+ );
+
+void _XawImCallVendorShellExtResize
+(
+ Widget			w
+ );
+
+void _XawImDestroy
+(
+ Widget			w,
+ Widget			ext
+ );
+
+#endif	/* _XawImP_h */
diff --git a/ThirdParty/X11/Include/X11/Xaw/XawInit.h b/ThirdParty/X11/Include/X11/Xaw/XawInit.h
new file mode 100644
index 0000000000000000000000000000000000000000..73226b26b0532e4aa2a7a0670d9a01e76ac1de7a
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xaw/XawInit.h
@@ -0,0 +1,62 @@
+/*
+ *
+Copyright 1989, 1994, 1998  The Open Group
+Copyright 2003-2004 Roland Mainz <roland.mainz@nrubsig.org>
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+#ifndef _XawInit_h
+#define _XawInit_h
+
+#define XawVendor	XVENDORNAMESHORT
+
+#ifdef OLDXAW
+#define XawVersion	6700002L
+#else
+#define	XawVersion	7000002L
+
+typedef struct _XawDL XawDisplayList;
+#endif /* OLDXAW */
+
+#include <X11/Intrinsic.h>
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+void XawInitializeWidgetSet(void);
+#ifndef OLDXAW
+void XawInitializeDefaultConverters(void);
+#endif
+
+extern Widget XawOpenApplication(
+    XtAppContext *app_context_return,
+    Display      *dpy,
+    Screen       *screen,
+    String        application_name,
+    String        application_class,
+    WidgetClass   widget_class,
+    int          *argc,
+    String       *argv
+);
+
+_XFUNCPROTOEND
+
+#endif /* _XawInit_h */
diff --git a/ThirdParty/X11/Include/X11/Xcms.h b/ThirdParty/X11/Include/X11/Xcms.h
new file mode 100644
index 0000000000000000000000000000000000000000..66318541069b07a34a7c48d7be989d9c8774989c
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xcms.h
@@ -0,0 +1,815 @@
+
+/*
+ * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
+ * 	All Rights Reserved
+ *
+ * This file is a component of an X Window System-specific implementation
+ * of Xcms based on the TekColor Color Management System.  Permission is
+ * hereby granted to use, copy, modify, sell, and otherwise distribute this
+ * software and its documentation for any purpose and without fee, provided
+ * that this copyright, permission, and disclaimer notice is reproduced in
+ * all copies of this software and in supporting documentation.  TekColor
+ * is a trademark of Tektronix, Inc.
+ *
+ * Tektronix makes no representation about the suitability of this software
+ * for any purpose.  It is provided "as is" and with all faults.
+ *
+ * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
+ * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE.  IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE.
+ *
+ *
+ *	DESCRIPTION
+ *		Public include file for X Color Management System
+ */
+#ifndef _X11_XCMS_H_
+#define _X11_XCMS_H_
+
+#include <X11/Xlib.h>
+
+/* The Xcms structs are full of implicit padding to properly align members.
+   We can't clean that up without breaking ABI, so tell clang not to bother
+   complaining about it. */
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+#endif
+
+    /*
+     * XCMS Status Values
+     */
+#define XcmsFailure			0
+#define XcmsSuccess			1
+#define XcmsSuccessWithCompression	2
+
+    /*
+     * Color Space Format ID's
+     *    Color Space ID's are of XcmsColorFormat type.
+     *
+     *    bit 31
+     *	    0 == Device-Independent
+     *	    1 == Device-Dependent
+     *
+     *    bit 30:
+     *	    0 == Registered with X Consortium
+     *	    1 == Unregistered
+     */
+#define XcmsUndefinedFormat	(XcmsColorFormat)0x00000000
+#define XcmsCIEXYZFormat	(XcmsColorFormat)0x00000001
+#define XcmsCIEuvYFormat	(XcmsColorFormat)0x00000002
+#define XcmsCIExyYFormat	(XcmsColorFormat)0x00000003
+#define XcmsCIELabFormat	(XcmsColorFormat)0x00000004
+#define XcmsCIELuvFormat	(XcmsColorFormat)0x00000005
+#define XcmsTekHVCFormat	(XcmsColorFormat)0x00000006
+#define XcmsRGBFormat		(XcmsColorFormat)0x80000000
+#define XcmsRGBiFormat		(XcmsColorFormat)0x80000001
+
+    /*
+     * State of XcmsPerScrnInfo
+     */
+#define XcmsInitNone		0x00	/* no initialization attempted */
+#define XcmsInitSuccess		0x01	/* initialization successful */
+#define XcmsInitFailure		0xff	/* failure, use defaults */
+
+#define DisplayOfCCC(ccc)		((ccc)->dpy)
+#define ScreenNumberOfCCC(ccc)		((ccc)->screenNumber)
+#define VisualOfCCC(ccc)		((ccc)->visual)
+#define ClientWhitePointOfCCC(ccc)	(&(ccc)->clientWhitePt)
+#define ScreenWhitePointOfCCC(ccc)	(&(ccc)->pPerScrnInfo->screenWhitePt)
+#define FunctionSetOfCCC(ccc)		((ccc)->pPerScrnInfo->functionSet)
+
+typedef unsigned long XcmsColorFormat;	/* Color Space Format ID */
+
+typedef double XcmsFloat;
+
+    /*
+     * Device RGB
+     */
+typedef struct {
+    unsigned short red;		/* scaled from 0x0000 to 0xffff */
+    unsigned short green;	/* scaled from 0x0000 to 0xffff */
+    unsigned short blue;	/* scaled from 0x0000 to 0xffff */
+} XcmsRGB;
+
+    /*
+     * RGB Intensity
+     */
+typedef struct {
+    XcmsFloat red;	/* 0.0 - 1.0 */
+    XcmsFloat green;	/* 0.0 - 1.0 */
+    XcmsFloat blue;	/* 0.0 - 1.0 */
+} XcmsRGBi;
+
+    /*
+     * CIE XYZ
+     */
+typedef struct {
+    XcmsFloat X;
+    XcmsFloat Y;
+    XcmsFloat Z;
+} XcmsCIEXYZ;
+
+    /*
+     * CIE u'v'Y
+     */
+typedef struct {
+    XcmsFloat u_prime;		/* 0.0 - 1.0 */
+    XcmsFloat v_prime;		/* 0.0 - 1.0 */
+    XcmsFloat Y;		/* 0.0 - 1.0 */
+} XcmsCIEuvY;
+
+    /*
+     * CIE xyY
+     */
+typedef struct {
+    XcmsFloat x;		/* 0.0 - 1.0 */
+    XcmsFloat y;		/* 0.0 - 1.0 */
+    XcmsFloat Y;		/* 0.0 - 1.0 */
+} XcmsCIExyY;
+
+    /*
+     * CIE L*a*b*
+     */
+typedef struct {
+    XcmsFloat L_star;		/* 0.0 - 100.0 */
+    XcmsFloat a_star;
+    XcmsFloat b_star;
+} XcmsCIELab;
+
+    /*
+     * CIE L*u*v*
+     */
+typedef struct {
+    XcmsFloat L_star;		/* 0.0 - 100.0 */
+    XcmsFloat u_star;
+    XcmsFloat v_star;
+} XcmsCIELuv;
+
+    /*
+     * TekHVC
+     */
+typedef struct {
+    XcmsFloat H;		/* 0.0 - 360.0 */
+    XcmsFloat V;		/* 0.0 - 100.0 */
+    XcmsFloat C;		/* 0.0 - 100.0 */
+} XcmsTekHVC;
+
+    /*
+     * PAD
+     */
+typedef struct {
+    XcmsFloat pad0;
+    XcmsFloat pad1;
+    XcmsFloat pad2;
+    XcmsFloat pad3;
+} XcmsPad;
+
+
+    /*
+     * XCMS Color Structure
+     */
+typedef struct {
+    union {
+	XcmsRGB RGB;
+	XcmsRGBi RGBi;
+	XcmsCIEXYZ CIEXYZ;
+	XcmsCIEuvY CIEuvY;
+	XcmsCIExyY CIExyY;
+	XcmsCIELab CIELab;
+	XcmsCIELuv CIELuv;
+	XcmsTekHVC TekHVC;
+	XcmsPad Pad;
+    } spec;			/* the color specification	*/
+    unsigned long pixel;	/* pixel value (as needed)	*/
+    XcmsColorFormat	format;		/* the specification format	*/
+} XcmsColor;
+
+
+    /*
+     * XCMS Per Screen related data
+     */
+
+typedef struct _XcmsPerScrnInfo {
+    XcmsColor	screenWhitePt;	/* Screen White point */
+    XPointer	functionSet;	/* pointer to Screen Color Characterization */
+				/*      Function Set structure		*/
+    XPointer	screenData;	/* pointer to corresponding Screen Color*/
+				/*	Characterization Data		*/
+    unsigned char state;   /* XcmsInitNone, XcmsInitSuccess, XcmsInitFailure */
+    char	pad[3];
+} XcmsPerScrnInfo;
+
+typedef struct _XcmsCCC *XcmsCCC;
+
+typedef Status (*XcmsCompressionProc)(		/* Gamut Compression Proc */
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* colors_in_out */,
+    unsigned int	/* ncolors */,
+    unsigned int	/* index */,
+    Bool*		/* compression_flags_return */
+);
+
+typedef Status (*XcmsWhiteAdjustProc)(	 	/* White Point Adjust Proc */
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* initial_white_point*/,
+    XcmsColor*		/* target_white_point*/,
+    XcmsColorFormat	/* target_format */,
+    XcmsColor*		/* colors_in_out */,
+    unsigned int	/* ncolors */,
+    Bool*		/* compression_flags_return */
+);
+
+    /*
+     * XCMS Color Conversion Context
+     */
+typedef struct _XcmsCCC {
+    Display	*dpy;			/* X Display */
+    int		screenNumber;		/* X screen number */
+    Visual	*visual;		/* X Visual */
+    XcmsColor	clientWhitePt;		/* Client White Point */
+    XcmsCompressionProc	gamutCompProc;	/* Gamut Compression Function */
+    XPointer	gamutCompClientData;	/* Gamut Comp Func Client Data */
+    XcmsWhiteAdjustProc	whitePtAdjProc;	/* White Point Adjustment Function */
+    XPointer	whitePtAdjClientData;	/* White Pt Adj Func Client Data */
+    XcmsPerScrnInfo *pPerScrnInfo;	/* pointer to per screen information */
+					/*  associated with the above display */
+					/*  screenNumber */
+} XcmsCCCRec;
+
+typedef Status (*XcmsScreenInitProc)(	/* Screen Initialization Proc */
+    Display*		/* dpy */,
+    int			/* screen_number */,
+    XcmsPerScrnInfo*	/* screen_info */
+);
+
+typedef void (*XcmsScreenFreeProc)(
+    XPointer		/* screenData */
+);
+
+    /*
+     * Function List Pointer -- pointer to an array of function pointers.
+     *    The end of list is indicated by a NULL pointer.
+     */
+/*
+ * XXX:  The use of the XcmsConversionProc type is broken.  The
+ *       device-independent colour conversion code uses it as:
+
+typedef Status (*XcmsConversionProc)(XcmsCCC, XcmsColor *, XcmsColor *,
+				     unsigned int);
+
+ *       while the device-dependent code uses it as:
+
+typedef Status (*XcmsConversionProc)(XcmsCCC, XcmsColor *, unsigned int,
+				     Bool *);
+
+ *       Until this is reworked, it's probably best to leave it unprotoized.
+ *       The code works regardless.
+ */
+typedef Status (*XcmsDDConversionProc)( /* using device-dependent version */
+    XcmsCCC             /* ccc */,
+    XcmsColor*          /* pcolors_in_out */,
+    unsigned int        /* ncolors */,
+    Bool*               /* pCompressed */
+    );
+
+typedef Status (*XcmsDIConversionProc)( /* using device-independent version */
+    XcmsCCC             /* ccc */,
+    XcmsColor*          /* white_point */,
+    XcmsColor*          /* pcolors_in_out */,
+    unsigned int        /* ncolors */
+    );
+
+typedef XcmsDIConversionProc XcmsConversionProc;
+typedef XcmsConversionProc *XcmsFuncListPtr;
+
+typedef int (*XcmsParseStringProc)(	/* Color String Parsing Proc */
+    char*		/* color_string */,
+    XcmsColor*		/* color_return */
+);
+
+    /*
+     * Color Space -- per Color Space related data (Device-Independent
+     *    or Device-Dependent)
+     */
+typedef struct _XcmsColorSpace {
+    const char *prefix;		/* Prefix of string format.		*/
+    XcmsColorFormat id;		/* Format ID number.			*/
+    XcmsParseStringProc parseString;
+				/* String format parsing function	*/
+    XcmsFuncListPtr to_CIEXYZ;	/* Pointer to an array of function 	*/
+				/*   pointers such that when the	*/
+				/*   functions are executed in sequence	*/
+				/*   will convert a XcmsColor structure	*/
+				/*   from this color space to CIEXYZ	*/
+				/*   space.				*/
+    XcmsFuncListPtr from_CIEXYZ;/* Pointer to an array of function 	*/
+				/*   pointers such that when the	*/
+				/*   functions are executed in sequence	*/
+				/*   will convert a XcmsColor structure	*/
+				/*   from CIEXYZ space to this color	*/
+				/*   space.				*/
+    int inverse_flag;		/* If 1, indicates that for 0 <= i < n	*/
+				/*   where n is the number of function	*/
+				/*   pointers in the lists to_CIEXYZ	*/
+				/*   and from_CIEXYZ; for each function */
+				/*   to_CIEXYZ[i] its inverse function	*/
+				/*   is from_CIEXYZ[n - i].		*/
+
+} XcmsColorSpace;
+
+    /*
+     * Screen Color Characterization Function Set -- per device class
+     *    color space conversion functions.
+     */
+typedef struct _XcmsFunctionSet {
+    XcmsColorSpace **DDColorSpaces;
+				/* Pointer to an array of pointers to	*/
+				/*   Device-DEPENDENT color spaces	*/
+				/*   understood by this SCCFuncSet.	*/
+    XcmsScreenInitProc screenInitProc;
+				/* Screen initialization function that	*/
+				/*   reads Screen Color Characterization*/
+				/*   Data off properties on the screen's*/
+				/*   root window.			*/
+    XcmsScreenFreeProc screenFreeProc;
+				/* Function that frees the SCCData	*/
+				/*   structures.			*/
+} XcmsFunctionSet;
+
+_XFUNCPROTOBEGIN
+
+extern Status XcmsAddColorSpace (
+    XcmsColorSpace*	/* pColorSpace */
+);
+
+extern Status XcmsAddFunctionSet (
+    XcmsFunctionSet*	/* functionSet */
+);
+
+extern Status XcmsAllocColor (
+    Display*		/* dpy */,
+    Colormap		/* colormap */,
+    XcmsColor*		/* color_in_out */,
+    XcmsColorFormat		/* result_format */
+);
+
+extern Status XcmsAllocNamedColor (
+    Display*		/* dpy */,
+    Colormap		/* colormap */,
+    _Xconst char*	/* color_string */,
+    XcmsColor*		/* color_scrn_return */,
+    XcmsColor*		/* color_exact_return */,
+    XcmsColorFormat		/* result_format */
+);
+
+extern XcmsCCC XcmsCCCOfColormap (
+    Display*		/* dpy */,
+    Colormap		/* colormap */
+);
+
+extern Status XcmsCIELabClipab(
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* colors_in_out */,
+    unsigned int	/* ncolors */,
+    unsigned int	/* index */,
+    Bool*		/* compression_flags_return */
+);
+
+extern Status XcmsCIELabClipL(
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* colors_in_out */,
+    unsigned int	/* ncolors */,
+    unsigned int	/* index */,
+    Bool*		/* compression_flags_return */
+);
+
+extern Status XcmsCIELabClipLab(
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* colors_in_out */,
+    unsigned int	/* ncolors */,
+    unsigned int	/* index */,
+    Bool*		/* compression_flags_return */
+);
+
+extern Status XcmsCIELabQueryMaxC (
+    XcmsCCC		/* ccc */,
+    XcmsFloat		/* hue_angle */,
+    XcmsFloat		/* L_star */,
+    XcmsColor*		/* color_return */
+);
+
+extern Status XcmsCIELabQueryMaxL (
+    XcmsCCC		/* ccc */,
+    XcmsFloat		/* hue_angle */,
+    XcmsFloat		/* chroma */,
+    XcmsColor*		/* color_return */
+);
+
+extern Status XcmsCIELabQueryMaxLC (
+    XcmsCCC		/* ccc */,
+    XcmsFloat		/* hue_angle */,
+    XcmsColor*		/* color_return */
+);
+
+extern Status XcmsCIELabQueryMinL (
+    XcmsCCC		/* ccc */,
+    XcmsFloat		/* hue_angle */,
+    XcmsFloat		/* chroma */,
+    XcmsColor*		/* color_return */
+);
+
+extern Status XcmsCIELabToCIEXYZ (
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* white_point */,
+    XcmsColor*		/* colors */,
+    unsigned int	/* ncolors */
+);
+
+extern Status XcmsCIELabWhiteShiftColors(
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* initial_white_point*/,
+    XcmsColor*		/* target_white_point*/,
+    XcmsColorFormat	/* target_format */,
+    XcmsColor*		/* colors_in_out */,
+    unsigned int	/* ncolors */,
+    Bool*		/* compression_flags_return */
+);
+
+extern Status XcmsCIELuvClipL(
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* colors_in_out */,
+    unsigned int	/* ncolors */,
+    unsigned int	/* index */,
+    Bool*		/* compression_flags_return */
+);
+
+extern Status XcmsCIELuvClipLuv(
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* colors_in_out */,
+    unsigned int	/* ncolors */,
+    unsigned int	/* index */,
+    Bool*		/* compression_flags_return */
+);
+
+extern Status XcmsCIELuvClipuv(
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* colors_in_out */,
+    unsigned int	/* ncolors */,
+    unsigned int	/* index */,
+    Bool*		/* compression_flags_return */
+);
+
+extern Status XcmsCIELuvQueryMaxC (
+    XcmsCCC		/* ccc */,
+    XcmsFloat		/* hue_angle */,
+    XcmsFloat		/* L_star */,
+    XcmsColor*		/* color_return */
+);
+
+extern Status XcmsCIELuvQueryMaxL (
+    XcmsCCC		/* ccc */,
+    XcmsFloat		/* hue_angle */,
+    XcmsFloat		/* chroma */,
+    XcmsColor*		/* color_return */
+);
+
+extern Status XcmsCIELuvQueryMaxLC (
+    XcmsCCC		/* ccc */,
+    XcmsFloat		/* hue_angle */,
+    XcmsColor*		/* color_return */
+);
+
+extern Status XcmsCIELuvQueryMinL (
+    XcmsCCC		/* ccc */,
+    XcmsFloat		/* hue_angle */,
+    XcmsFloat		/* chroma */,
+    XcmsColor*		/* color_return */
+);
+
+extern Status XcmsCIELuvToCIEuvY (
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* white_point */,
+    XcmsColor*		/* colors */,
+    unsigned int	/* ncolors */
+);
+
+extern Status XcmsCIELuvWhiteShiftColors(
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* initial_white_point*/,
+    XcmsColor*		/* target_white_point*/,
+    XcmsColorFormat	/* target_format */,
+    XcmsColor*		/* colors_in_out */,
+    unsigned int	/* ncolors */,
+    Bool*		/* compression_flags_return */
+);
+
+extern Status XcmsCIEXYZToCIELab (
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* white_point */,
+    XcmsColor*		/* colors */,
+    unsigned int	/* ncolors */
+);
+
+extern Status XcmsCIEXYZToCIEuvY (
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* white_point */,
+    XcmsColor*		/* colors */,
+    unsigned int	/* ncolors */
+);
+
+extern Status XcmsCIEXYZToCIExyY (
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* white_point */,
+    XcmsColor*		/* colors */,
+    unsigned int	/* ncolors */
+);
+
+extern Status XcmsCIEXYZToRGBi (
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* colors */,
+    unsigned int	/* ncolors */,
+    Bool*		/* compression_flags_return */
+);
+
+extern Status XcmsCIEuvYToCIELuv (
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* white_point */,
+    XcmsColor*		/* colors */,
+    unsigned int	/* ncolors */
+);
+
+extern Status XcmsCIEuvYToCIEXYZ (
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* white_point */,
+    XcmsColor*		/* colors */,
+    unsigned int	/* ncolors */
+);
+
+extern Status XcmsCIEuvYToTekHVC (
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* white_point */,
+    XcmsColor*		/* colors */,
+    unsigned int	/* ncolors */
+);
+
+extern Status XcmsCIExyYToCIEXYZ (
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* white_point */,
+    XcmsColor*		/* colors */,
+    unsigned int	/* ncolors */
+);
+
+extern XcmsColor *XcmsClientWhitePointOfCCC (
+    XcmsCCC		/* ccc */
+);
+
+extern Status XcmsConvertColors (
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* colorArry_in_out */,
+    unsigned int	/* nColors */,
+    XcmsColorFormat		/* targetFormat */,
+    Bool*		/* compArry_return */
+);
+
+extern XcmsCCC XcmsCreateCCC (
+    Display*		/* dpy */,
+    int			/* screenNumber */,
+    Visual*		/* visual */,
+    XcmsColor*		/* clientWhitePt */,
+    XcmsCompressionProc /* gamutCompProc */,
+    XPointer		/* gamutCompClientData */,
+    XcmsWhiteAdjustProc	/* whitePtAdjProc */,
+    XPointer		/* whitePtAdjClientData */
+);
+
+extern XcmsCCC XcmsDefaultCCC (
+    Display*		/* dpy */,
+    int			/* screenNumber */
+);
+
+extern Display *XcmsDisplayOfCCC (
+    XcmsCCC		/* ccc */
+);
+
+extern XcmsColorFormat XcmsFormatOfPrefix (
+    char*		/* prefix */
+);
+
+extern void XcmsFreeCCC (
+    XcmsCCC		/* ccc */
+);
+
+extern Status XcmsLookupColor (
+    Display*		/* dpy */,
+    Colormap		/* colormap */,
+    _Xconst char*	/* color_string */,
+    XcmsColor*		/* pColor_exact_in_out */,
+    XcmsColor*		/* pColor_scrn_in_out */,
+    XcmsColorFormat		/* result_format */
+);
+
+extern char *XcmsPrefixOfFormat (
+    XcmsColorFormat		/* id */
+);
+
+extern Status XcmsQueryBlack (
+    XcmsCCC		/* ccc */,
+    XcmsColorFormat	/* target_format */,
+    XcmsColor*		/* color_return */
+);
+
+extern Status XcmsQueryBlue (
+    XcmsCCC		/* ccc */,
+    XcmsColorFormat	/* target_format */,
+    XcmsColor*		/* color_return */
+);
+
+extern Status XcmsQueryColor (
+    Display*		/* dpy */,
+    Colormap		/* colormap */,
+    XcmsColor*		/* pColor_in_out */,
+    XcmsColorFormat		/* result_format */
+);
+
+extern Status XcmsQueryColors (
+    Display*		/* dpy */,
+    Colormap		/* colormap */,
+    XcmsColor*		/* colorArry_in_out */,
+    unsigned int	/* nColors */,
+    XcmsColorFormat	/* result_format */
+);
+
+extern Status XcmsQueryGreen (
+    XcmsCCC		/* ccc */,
+    XcmsColorFormat	/* target_format */,
+    XcmsColor*		/* color_return */
+);
+
+extern Status XcmsQueryRed (
+    XcmsCCC		/* ccc */,
+    XcmsColorFormat	/* target_format */,
+    XcmsColor*		/* color_return */
+);
+
+extern Status XcmsQueryWhite (
+    XcmsCCC		/* ccc */,
+    XcmsColorFormat	/* target_format */,
+    XcmsColor*		/* color_return */
+);
+
+extern Status XcmsRGBiToCIEXYZ (
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* colors */,
+    unsigned int	/* ncolors */,
+    Bool*		/* compression_flags_return */
+);
+
+extern Status XcmsRGBiToRGB (
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* colors */,
+    unsigned int	/* ncolors */,
+    Bool*		/* compression_flags_return */
+);
+
+extern Status XcmsRGBToRGBi (
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* colors */,
+    unsigned int	/* ncolors */,
+    Bool*		/* compression_flags_return */
+);
+
+extern int XcmsScreenNumberOfCCC (
+    XcmsCCC		/* ccc */
+);
+
+extern XcmsColor *XcmsScreenWhitePointOfCCC (
+    XcmsCCC		/* ccc */
+);
+
+extern XcmsCCC XcmsSetCCCOfColormap(
+    Display*		/* dpy */,
+    Colormap		/* colormap */,
+    XcmsCCC		/* ccc */
+);
+
+extern XcmsCompressionProc XcmsSetCompressionProc (
+    XcmsCCC		/* ccc */,
+    XcmsCompressionProc	/* compression_proc */,
+    XPointer		/* client_data */
+);
+
+extern XcmsWhiteAdjustProc XcmsSetWhiteAdjustProc (
+    XcmsCCC		/* ccc */,
+    XcmsWhiteAdjustProc	/* white_adjust_proc */,
+    XPointer		/* client_data */
+);
+
+extern Status XcmsSetWhitePoint (
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* color */
+);
+
+extern Status XcmsStoreColor (
+    Display*		/* dpy */,
+    Colormap		/* colormap */,
+    XcmsColor*		/* pColor_in */
+);
+
+extern Status XcmsStoreColors (
+    Display*		/* dpy */,
+    Colormap		/* colormap */,
+    XcmsColor*		/* colorArry_in */,
+    unsigned int	/* nColors */,
+    Bool*		/* compArry_return */
+);
+
+extern Status XcmsTekHVCClipC(
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* colors_in_out */,
+    unsigned int	/* ncolors */,
+    unsigned int	/* index */,
+    Bool*		/* compression_flags_return */
+);
+
+extern Status XcmsTekHVCClipV(
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* colors_in_out */,
+    unsigned int	/* ncolors */,
+    unsigned int	/* index */,
+    Bool*		/* compression_flags_return */
+);
+
+extern Status XcmsTekHVCClipVC(
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* colors_in_out */,
+    unsigned int	/* ncolors */,
+    unsigned int	/* index */,
+    Bool*		/* compression_flags_return */
+);
+
+extern Status XcmsTekHVCQueryMaxC (
+    XcmsCCC		/* ccc */,
+    XcmsFloat		/* hue */,
+    XcmsFloat		/* value */,
+    XcmsColor*		/* color_return */
+);
+
+extern Status XcmsTekHVCQueryMaxV (
+    XcmsCCC		/* ccc */,
+    XcmsFloat		/* hue */,
+    XcmsFloat		/* chroma */,
+    XcmsColor*		/* color_return */
+);
+
+extern Status XcmsTekHVCQueryMaxVC (
+    XcmsCCC		/* ccc */,
+    XcmsFloat		/* hue */,
+    XcmsColor*		/* color_return */
+);
+
+extern Status XcmsTekHVCQueryMaxVSamples (
+    XcmsCCC		/* ccc */,
+    XcmsFloat		/* hue */,
+    XcmsColor*		/* colors_return */,
+    unsigned int	/* nsamples */
+);
+
+extern Status XcmsTekHVCQueryMinV (
+    XcmsCCC		/* ccc */,
+    XcmsFloat		/* hue */,
+    XcmsFloat		/* chroma */,
+    XcmsColor*		/* color_return */
+);
+
+extern Status XcmsTekHVCToCIEuvY (
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* white_point */,
+    XcmsColor*		/* colors */,
+    unsigned int	/* ncolors */
+);
+
+extern Status XcmsTekHVCWhiteShiftColors(
+    XcmsCCC		/* ccc */,
+    XcmsColor*		/* initial_white_point*/,
+    XcmsColor*		/* target_white_point*/,
+    XcmsColorFormat	/* target_format */,
+    XcmsColor*		/* colors_in_out */,
+    unsigned int	/* ncolors */,
+    Bool*		/* compression_flags_return */
+);
+
+extern Visual *XcmsVisualOfCCC (
+    XcmsCCC		/* ccc */
+);
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+_XFUNCPROTOEND
+
+#endif /* _X11_XCMS_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xcursor/Xcursor.h b/ThirdParty/X11/Include/X11/Xcursor/Xcursor.h
new file mode 100644
index 0000000000000000000000000000000000000000..f3bc43dc388159cc3c295b449071b268c2de4f11
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xcursor/Xcursor.h
@@ -0,0 +1,500 @@
+/* include/X11/Xcursor/Xcursor.h.  Generated from Xcursor.h.in by configure.  */
+/*
+ * Copyright © 2002 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _XCURSOR_H_
+#define _XCURSOR_H_
+#include <stdio.h>
+#include <X11/Xfuncproto.h>
+#include <X11/Xlib.h>
+
+typedef int		XcursorBool;
+typedef unsigned int	XcursorUInt;
+
+typedef XcursorUInt	XcursorDim;
+typedef XcursorUInt	XcursorPixel;
+
+#define XcursorTrue	1
+#define XcursorFalse	0
+
+/*
+ * Cursor files start with a header.  The header
+ * contains a magic number, a version number and a
+ * table of contents which has type and offset information
+ * for the remaining tables in the file.
+ *
+ * File minor versions increment for compatible changes
+ * File major versions increment for incompatible changes (never, we hope)
+ *
+ * Chunks of the same type are always upward compatible.  Incompatible
+ * changes are made with new chunk types; the old data can remain under
+ * the old type.  Upward compatible changes can add header data as the
+ * header lengths are specified in the file.
+ *
+ *  File:
+ *	FileHeader
+ *	LISTofChunk
+ *
+ *  FileHeader:
+ *	CARD32		magic	    magic number
+ *	CARD32		header	    bytes in file header
+ *	CARD32		version	    file version
+ *	CARD32		ntoc	    number of toc entries
+ *	LISTofFileToc   toc	    table of contents
+ *
+ *  FileToc:
+ *	CARD32		type	    entry type
+ *	CARD32		subtype	    entry subtype (size for images)
+ *	CARD32		position    absolute file position
+ */
+
+#define XCURSOR_MAGIC	0x72756358  /* "Xcur" LSBFirst */
+
+/*
+ * Current Xcursor version number.  Will be substituted by configure
+ * from the version in the libXcursor configure.ac file.
+ */
+
+#define XCURSOR_LIB_MAJOR 1
+#define XCURSOR_LIB_MINOR 1
+#define XCURSOR_LIB_REVISION 14
+#define XCURSOR_LIB_VERSION	((XCURSOR_LIB_MAJOR * 10000) + \
+				 (XCURSOR_LIB_MINOR * 100) + \
+				 (XCURSOR_LIB_REVISION))
+
+/*
+ * This version number is stored in cursor files; changes to the
+ * file format require updating this version number
+ */
+#define XCURSOR_FILE_MAJOR	1
+#define XCURSOR_FILE_MINOR	0
+#define XCURSOR_FILE_VERSION	((XCURSOR_FILE_MAJOR << 16) | (XCURSOR_FILE_MINOR))
+#define XCURSOR_FILE_HEADER_LEN	(4 * 4)
+#define XCURSOR_FILE_TOC_LEN	(3 * 4)
+
+typedef struct _XcursorFileToc {
+    XcursorUInt	    type;	/* chunk type */
+    XcursorUInt	    subtype;	/* subtype (size for images) */
+    XcursorUInt	    position;	/* absolute position in file */
+} XcursorFileToc;
+
+typedef struct _XcursorFileHeader {
+    XcursorUInt	    magic;	/* magic number */
+    XcursorUInt	    header;	/* byte length of header */
+    XcursorUInt	    version;	/* file version number */
+    XcursorUInt	    ntoc;	/* number of toc entries */
+    XcursorFileToc  *tocs;	/* table of contents */
+} XcursorFileHeader;
+
+/*
+ * The rest of the file is a list of chunks, each tagged by type
+ * and version.
+ *
+ *  Chunk:
+ *	ChunkHeader
+ *	<extra type-specific header fields>
+ *	<type-specific data>
+ *
+ *  ChunkHeader:
+ *	CARD32	    header	bytes in chunk header + type header
+ *	CARD32	    type	chunk type
+ *	CARD32	    subtype	chunk subtype
+ *	CARD32	    version	chunk type version
+ */
+
+#define XCURSOR_CHUNK_HEADER_LEN    (4 * 4)
+
+typedef struct _XcursorChunkHeader {
+    XcursorUInt	    header;	/* bytes in chunk header */
+    XcursorUInt	    type;	/* chunk type */
+    XcursorUInt	    subtype;	/* chunk subtype (size for images) */
+    XcursorUInt	    version;	/* version of this type */
+} XcursorChunkHeader;
+
+/*
+ * Here's a list of the known chunk types
+ */
+
+/*
+ * Comments consist of a 4-byte length field followed by
+ * UTF-8 encoded text
+ *
+ *  Comment:
+ *	ChunkHeader header	chunk header
+ *	CARD32	    length	bytes in text
+ *	LISTofCARD8 text	UTF-8 encoded text
+ */
+
+#define XCURSOR_COMMENT_TYPE	    0xfffe0001
+#define XCURSOR_COMMENT_VERSION	    1
+#define XCURSOR_COMMENT_HEADER_LEN  (XCURSOR_CHUNK_HEADER_LEN + (1 *4))
+#define XCURSOR_COMMENT_COPYRIGHT   1
+#define XCURSOR_COMMENT_LICENSE	    2
+#define XCURSOR_COMMENT_OTHER	    3
+#define XCURSOR_COMMENT_MAX_LEN	    0x100000
+
+typedef struct _XcursorComment {
+    XcursorUInt	    version;
+    XcursorUInt	    comment_type;
+    char	    *comment;
+} XcursorComment;
+
+/*
+ * Each cursor image occupies a separate image chunk.
+ * The length of the image header follows the chunk header
+ * so that future versions can extend the header without
+ * breaking older applications
+ *
+ *  Image:
+ *	ChunkHeader	header	chunk header
+ *	CARD32		width	actual width
+ *	CARD32		height	actual height
+ *	CARD32		xhot	hot spot x
+ *	CARD32		yhot	hot spot y
+ *	CARD32		delay	animation delay
+ *	LISTofCARD32	pixels	ARGB pixels
+ */
+
+#define XCURSOR_IMAGE_TYPE    	    0xfffd0002
+#define XCURSOR_IMAGE_VERSION	    1
+#define XCURSOR_IMAGE_HEADER_LEN    (XCURSOR_CHUNK_HEADER_LEN + (5*4))
+#define XCURSOR_IMAGE_MAX_SIZE	    0x7fff	/* 32767x32767 max cursor size */
+
+typedef struct _XcursorImage {
+    XcursorUInt	    version;	/* version of the image data */
+    XcursorDim	    size;	/* nominal size for matching */
+    XcursorDim	    width;	/* actual width */
+    XcursorDim	    height;	/* actual height */
+    XcursorDim	    xhot;	/* hot spot x (must be inside image) */
+    XcursorDim	    yhot;	/* hot spot y (must be inside image) */
+    XcursorUInt	    delay;	/* animation delay to next frame (ms) */
+    XcursorPixel    *pixels;	/* pointer to pixels */
+} XcursorImage;
+
+/*
+ * Other data structures exposed by the library API
+ */
+typedef struct _XcursorImages {
+    int		    nimage;	/* number of images */
+    XcursorImage    **images;	/* array of XcursorImage pointers */
+    char	    *name;	/* name used to load images */
+} XcursorImages;
+
+typedef struct _XcursorCursors {
+    Display	    *dpy;	/* Display holding cursors */
+    int		    ref;	/* reference count */
+    int		    ncursor;	/* number of cursors */
+    Cursor	    *cursors;	/* array of cursors */
+} XcursorCursors;
+
+typedef struct _XcursorAnimate {
+    XcursorCursors   *cursors;	/* list of cursors to use */
+    int		    sequence;	/* which cursor is next */
+} XcursorAnimate;
+
+typedef struct _XcursorFile XcursorFile;
+
+struct _XcursorFile {
+    void    *closure;
+    int	    (*read)  (XcursorFile *file, unsigned char *buf, int len);
+    int	    (*write) (XcursorFile *file, unsigned char *buf, int len);
+    int	    (*seek)  (XcursorFile *file, long offset, int whence);
+};
+
+typedef struct _XcursorComments {
+    int		    ncomment;	/* number of comments */
+    XcursorComment  **comments;	/* array of XcursorComment pointers */
+} XcursorComments;
+
+#define XCURSOR_CORE_THEME  "core"
+
+_XFUNCPROTOBEGIN
+
+/*
+ * Manage Image objects
+ */
+XcursorImage *
+XcursorImageCreate (int width, int height);
+
+void
+XcursorImageDestroy (XcursorImage *image);
+
+/*
+ * Manage Images objects
+ */
+XcursorImages *
+XcursorImagesCreate (int size);
+
+void
+XcursorImagesDestroy (XcursorImages *images);
+
+void
+XcursorImagesSetName (XcursorImages *images, const char *name);
+
+/*
+ * Manage Cursor objects
+ */
+XcursorCursors *
+XcursorCursorsCreate (Display *dpy, int size);
+
+void
+XcursorCursorsDestroy (XcursorCursors *cursors);
+
+/*
+ * Manage Animate objects
+ */
+XcursorAnimate *
+XcursorAnimateCreate (XcursorCursors *cursors);
+
+void
+XcursorAnimateDestroy (XcursorAnimate *animate);
+
+Cursor
+XcursorAnimateNext (XcursorAnimate *animate);
+
+/*
+ * Manage Comment objects
+ */
+XcursorComment *
+XcursorCommentCreate (XcursorUInt comment_type, int length);
+
+void
+XcursorCommentDestroy (XcursorComment *comment);
+
+XcursorComments *
+XcursorCommentsCreate (int size);
+
+void
+XcursorCommentsDestroy (XcursorComments *comments);
+
+/*
+ * XcursorFile/Image APIs
+ */
+XcursorImage *
+XcursorXcFileLoadImage (XcursorFile *file, int size);
+
+XcursorImages *
+XcursorXcFileLoadImages (XcursorFile *file, int size);
+
+XcursorImages *
+XcursorXcFileLoadAllImages (XcursorFile *file);
+
+XcursorBool
+XcursorXcFileLoad (XcursorFile	    *file,
+		   XcursorComments  **commentsp,
+		   XcursorImages    **imagesp);
+
+XcursorBool
+XcursorXcFileSave (XcursorFile		    *file,
+		   const XcursorComments    *comments,
+		   const XcursorImages	    *images);
+
+/*
+ * FILE/Image APIs
+ */
+XcursorImage *
+XcursorFileLoadImage (FILE *file, int size);
+
+XcursorImages *
+XcursorFileLoadImages (FILE *file, int size);
+
+XcursorImages *
+XcursorFileLoadAllImages (FILE *file);
+
+XcursorBool
+XcursorFileLoad (FILE		    *file,
+		 XcursorComments    **commentsp,
+		 XcursorImages	    **imagesp);
+
+XcursorBool
+XcursorFileSaveImages (FILE *file, const XcursorImages *images);
+
+XcursorBool
+XcursorFileSave (FILE *			file,
+		 const XcursorComments	*comments,
+		 const XcursorImages	*images);
+
+/*
+ * Filename/Image APIs
+ */
+XcursorImage *
+XcursorFilenameLoadImage (const char *filename, int size);
+
+XcursorImages *
+XcursorFilenameLoadImages (const char *filename, int size);
+
+XcursorImages *
+XcursorFilenameLoadAllImages (const char *filename);
+
+XcursorBool
+XcursorFilenameLoad (const char		*file,
+		     XcursorComments	**commentsp,
+		     XcursorImages	**imagesp);
+
+XcursorBool
+XcursorFilenameSaveImages (const char *filename, const XcursorImages *images);
+
+XcursorBool
+XcursorFilenameSave (const char		    *file,
+		     const XcursorComments  *comments,
+		     const XcursorImages    *images);
+
+/*
+ * Library/Image APIs
+ */
+XcursorImage *
+XcursorLibraryLoadImage (const char *library, const char *theme, int size);
+
+XcursorImages *
+XcursorLibraryLoadImages (const char *library, const char *theme, int size);
+
+/*
+ * Library/shape API
+ */
+
+const char *
+XcursorLibraryPath (void);
+
+int
+XcursorLibraryShape (const char *library);
+
+/*
+ * Image/Cursor APIs
+ */
+
+Cursor
+XcursorImageLoadCursor (Display *dpy, const XcursorImage *image);
+
+XcursorCursors *
+XcursorImagesLoadCursors (Display *dpy, const XcursorImages *images);
+
+Cursor
+XcursorImagesLoadCursor (Display *dpy, const XcursorImages *images);
+
+/*
+ * Filename/Cursor APIs
+ */
+Cursor
+XcursorFilenameLoadCursor (Display *dpy, const char *file);
+
+XcursorCursors *
+XcursorFilenameLoadCursors (Display *dpy, const char *file);
+
+/*
+ * Library/Cursor APIs
+ */
+Cursor
+XcursorLibraryLoadCursor (Display *dpy, const char *file);
+
+XcursorCursors *
+XcursorLibraryLoadCursors (Display *dpy, const char *file);
+
+/*
+ * Shape/Image APIs
+ */
+
+XcursorImage *
+XcursorShapeLoadImage (unsigned int shape, const char *theme, int size);
+
+XcursorImages *
+XcursorShapeLoadImages (unsigned int shape, const char *theme, int size);
+
+/*
+ * Shape/Cursor APIs
+ */
+Cursor
+XcursorShapeLoadCursor (Display *dpy, unsigned int shape);
+
+XcursorCursors *
+XcursorShapeLoadCursors (Display *dpy, unsigned int shape);
+
+/*
+ * This is the function called by Xlib when attempting to
+ * load cursors from XCreateGlyphCursor.  The interface must
+ * not change as Xlib loads 'libXcursor.so' instead of
+ * a specific major version
+ */
+Cursor
+XcursorTryShapeCursor (Display	    *dpy,
+		       Font	    source_font,
+		       Font	    mask_font,
+		       unsigned int source_char,
+		       unsigned int mask_char,
+		       XColor _Xconst *foreground,
+		       XColor _Xconst *background);
+
+void
+XcursorNoticeCreateBitmap (Display	*dpy,
+			   Pixmap	pid,
+			   unsigned int width,
+			   unsigned int height);
+
+void
+XcursorNoticePutBitmap (Display	    *dpy,
+			Drawable    draw,
+			XImage	    *image);
+
+Cursor
+XcursorTryShapeBitmapCursor (Display		*dpy,
+			     Pixmap		source,
+			     Pixmap		mask,
+			     XColor		*foreground,
+			     XColor		*background,
+			     unsigned int	x,
+			     unsigned int	y);
+
+#define XCURSOR_BITMAP_HASH_SIZE    16
+
+void
+XcursorImageHash (XImage	*image,
+		  unsigned char	hash[XCURSOR_BITMAP_HASH_SIZE]);
+
+/*
+ * Display information APIs
+ */
+XcursorBool
+XcursorSupportsARGB (Display *dpy);
+
+XcursorBool
+XcursorSupportsAnim (Display *dpy);
+
+XcursorBool
+XcursorSetDefaultSize (Display *dpy, int size);
+
+int
+XcursorGetDefaultSize (Display *dpy);
+
+XcursorBool
+XcursorSetTheme (Display *dpy, const char *theme);
+
+char *
+XcursorGetTheme (Display *dpy);
+
+XcursorBool
+XcursorGetThemeCore (Display *dpy);
+
+XcursorBool
+XcursorSetThemeCore (Display *dpy, XcursorBool theme_core);
+
+_XFUNCPROTOEND
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/Xdefs.h b/ThirdParty/X11/Include/X11/Xdefs.h
new file mode 100644
index 0000000000000000000000000000000000000000..e25a2082162ad4e7fb7dacfb41d99d93cc8f89f5
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xdefs.h
@@ -0,0 +1,108 @@
+/***********************************************************
+
+Copyright (c) 1999  The XFree86 Project Inc.
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The XFree86 Project
+Inc. shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from The XFree86 Project Inc..
+
+*/
+
+/**
+ ** Types definitions shared between server and clients 
+ **/
+
+#ifndef _XDEFS_H
+#define _XDEFS_H
+
+#ifdef _XSERVER64
+#include <X11/Xmd.h>
+#endif 
+
+#ifndef _XTYPEDEF_ATOM
+#  define _XTYPEDEF_ATOM
+#  ifndef _XSERVER64
+typedef unsigned long Atom;
+#  else
+typedef CARD32 Atom;
+#  endif
+#endif
+
+#ifndef Bool
+#  ifndef _XTYPEDEF_BOOL
+#   define _XTYPEDEF_BOOL
+typedef int Bool;
+#  endif
+#endif
+
+#ifndef _XTYPEDEF_POINTER
+#  define _XTYPEDEF_POINTER
+typedef void *pointer;
+#endif
+
+#ifndef _XTYPEDEF_CLIENTPTR
+typedef struct _Client *ClientPtr;
+#  define _XTYPEDEF_CLIENTPTR
+#endif
+
+#ifndef _XTYPEDEF_XID
+#  define _XTYPEDEF_XID
+#  ifndef _XSERVER64
+typedef unsigned long XID;
+#  else
+typedef CARD32 XID;
+#  endif
+#endif
+
+#ifndef _XTYPEDEF_MASK
+#  define _XTYPEDEF_MASK
+#  ifndef _XSERVER64
+typedef unsigned long Mask;
+#  else
+typedef CARD32 Mask;
+#  endif
+#endif
+
+#ifndef _XTYPEDEF_FONTPTR
+#  define _XTYPEDEF_FONTPTR
+typedef struct _Font *FontPtr; /* also in fonts/include/font.h */
+#endif
+
+#ifndef _XTYPEDEF_FONT
+#  define _XTYPEDEF_FONT
+typedef XID	Font;
+#endif
+
+#ifndef _XTYPEDEF_FSID
+#  ifndef _XSERVER64
+typedef unsigned long FSID;
+#  else
+typedef CARD32 FSID;
+#  endif
+#endif
+
+typedef FSID AccContext;
+
+/* OS independent time value 
+   XXX Should probably go in Xos.h */
+typedef struct timeval **OSTimePtr;
+
+
+typedef void (* BlockHandlerProcPtr)(void * /* blockData */,
+				     OSTimePtr /* pTimeout */,
+				     void * /* pReadmask */);
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/Xdmcp.h b/ThirdParty/X11/Include/X11/Xdmcp.h
new file mode 100644
index 0000000000000000000000000000000000000000..0b531de785c6209e4e26e1036c1112efcdcb1fc7
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xdmcp.h
@@ -0,0 +1,181 @@
+/*
+ * Copyright 1989 Network Computing Devices, Inc., Mountain View, California.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of N.C.D. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  N.C.D. makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ */
+
+#ifndef _XDMCP_H_
+#define _XDMCP_H_
+
+#include <X11/Xmd.h>
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+#define XDM_PROTOCOL_VERSION	1
+#define XDM_UDP_PORT		177
+
+/* IANA has assigned FF0X:0:0:0:0:0:0:12B as the permanently assigned
+ * multicast addresses for XDMCP, where X in the prefix may be replaced
+ * by any valid scope identifier, such as 1 for Node-Local, 2 for Link-Local,
+ * 5 for Site-Local, and so on.  We set the default here to the Link-Local
+ * version to most closely match the old IPv4 subnet broadcast behavior.
+ * Both xdm and X -query allow specifying a different address if a different
+ * scope is defined.
+ */
+#define XDM_DEFAULT_MCAST_ADDR6	"ff02:0:0:0:0:0:0:12b"
+
+#define XDM_MAX_MSGLEN		8192
+#define XDM_MIN_RTX		2
+#define XDM_MAX_RTX		32
+#define XDM_RTX_LIMIT		7
+#define XDM_KA_RTX_LIMIT	4
+#define XDM_DEF_DORMANCY	(3 * 60)	/* 3 minutes */
+#define XDM_MAX_DORMANCY	(24 * 60 * 60)	/* 24 hours */
+
+typedef enum {
+    BROADCAST_QUERY = 1, QUERY, INDIRECT_QUERY, FORWARD_QUERY,
+    WILLING, UNWILLING, REQUEST, ACCEPT, DECLINE, MANAGE, REFUSE,
+    FAILED, KEEPALIVE, ALIVE
+} xdmOpCode;
+
+typedef enum {
+    XDM_QUERY, XDM_BROADCAST, XDM_INDIRECT, XDM_COLLECT_QUERY,
+    XDM_COLLECT_BROADCAST_QUERY, XDM_COLLECT_INDIRECT_QUERY,
+    XDM_START_CONNECTION, XDM_AWAIT_REQUEST_RESPONSE,
+    XDM_AWAIT_MANAGE_RESPONSE, XDM_MANAGE, XDM_RUN_SESSION, XDM_OFF,
+    XDM_AWAIT_USER_INPUT, XDM_KEEPALIVE, XDM_AWAIT_ALIVE_RESPONSE,
+#if defined(IPv6) && defined(AF_INET6)
+    XDM_MULTICAST, XDM_COLLECT_MULTICAST_QUERY,
+#endif
+    XDM_KEEP_ME_LAST
+} xdmcp_states;
+
+#ifdef NOTDEF
+/* table of hosts */
+
+#define XDM_MAX_STR_LEN 21
+#define XDM_MAX_HOSTS 20
+struct xdm_host_table {
+  struct sockaddr_in sockaddr;
+  char name[XDM_MAX_STR_LEN];
+  char status[XDM_MAX_STR_LEN];
+};
+#endif /* NOTDEF */
+
+typedef CARD8	*CARD8Ptr;
+typedef CARD16	*CARD16Ptr;
+typedef CARD32	*CARD32Ptr;
+
+typedef struct _ARRAY8 {
+    CARD16	length;
+    CARD8Ptr	data;
+} ARRAY8, *ARRAY8Ptr;
+
+typedef struct _ARRAY16 {
+    CARD8	length;
+    CARD16Ptr	data;
+} ARRAY16, *ARRAY16Ptr;
+
+typedef struct _ARRAY32 {
+    CARD8	length;
+    CARD32Ptr	data;
+} ARRAY32, *ARRAY32Ptr;
+
+typedef struct _ARRAYofARRAY8 {
+    CARD8	length;
+    ARRAY8Ptr	data;
+} ARRAYofARRAY8, *ARRAYofARRAY8Ptr;
+
+typedef struct _XdmcpHeader {
+    CARD16  version, opcode, length;
+} XdmcpHeader, *XdmcpHeaderPtr;
+
+typedef struct _XdmcpBuffer {
+    BYTE    *data;
+    int	    size;		/* size of buffer pointed by to data */
+    int	    pointer;		/* current index into data */
+    int	    count;		/* bytes read from network into data */
+} XdmcpBuffer, *XdmcpBufferPtr;
+
+typedef struct _XdmAuthKey {
+    BYTE    data[8];
+} XdmAuthKeyRec, *XdmAuthKeyPtr;
+
+
+/* implementation-independent network address structure.
+   Equiv to sockaddr* for sockets. */
+
+typedef char *XdmcpNetaddr;
+
+extern int XdmcpWriteARRAY16(XdmcpBufferPtr buffer, const ARRAY16Ptr array);
+extern int XdmcpWriteARRAY32(XdmcpBufferPtr buffer, const ARRAY32Ptr array);
+extern int XdmcpWriteARRAY8(XdmcpBufferPtr buffer, const ARRAY8Ptr array);
+extern int XdmcpWriteARRAYofARRAY8(XdmcpBufferPtr buffer, const ARRAYofARRAY8Ptr array);
+extern int XdmcpWriteCARD16(XdmcpBufferPtr buffer, unsigned value);
+extern int XdmcpWriteCARD32(XdmcpBufferPtr buffer, unsigned value);
+extern int XdmcpWriteCARD8(XdmcpBufferPtr buffer, unsigned value);
+extern int XdmcpWriteHeader(XdmcpBufferPtr  buffer, const XdmcpHeaderPtr  header);
+
+extern int XdmcpFlush(int fd, XdmcpBufferPtr buffer, XdmcpNetaddr to, int tolen);
+
+extern int XdmcpReadARRAY16(XdmcpBufferPtr buffer, ARRAY16Ptr array);
+extern int XdmcpReadARRAY32(XdmcpBufferPtr buffer, ARRAY32Ptr array);
+extern int XdmcpReadARRAY8(XdmcpBufferPtr buffer, ARRAY8Ptr array);
+extern int XdmcpReadARRAYofARRAY8(XdmcpBufferPtr buffer, ARRAYofARRAY8Ptr array);
+extern int XdmcpReadCARD16(XdmcpBufferPtr buffer, CARD16Ptr valuep);
+extern int XdmcpReadCARD32(XdmcpBufferPtr buffer, CARD32Ptr valuep);
+extern int XdmcpReadCARD8(XdmcpBufferPtr buffer, CARD8Ptr valuep);
+extern int XdmcpReadHeader(XdmcpBufferPtr buffer, XdmcpHeaderPtr header);
+
+extern int XdmcpFill(int fd, XdmcpBufferPtr buffer, XdmcpNetaddr from, int *fromlen);
+
+extern int XdmcpReadRemaining(const XdmcpBufferPtr buffer);
+
+extern void XdmcpDisposeARRAY8(ARRAY8Ptr array);
+extern void XdmcpDisposeARRAY16(ARRAY16Ptr array);
+extern void XdmcpDisposeARRAY32(ARRAY32Ptr array);
+extern void XdmcpDisposeARRAYofARRAY8(ARRAYofARRAY8Ptr array);
+
+extern int XdmcpCopyARRAY8(const ARRAY8Ptr src, ARRAY8Ptr dst);
+
+extern int XdmcpARRAY8Equal(const ARRAY8Ptr array1, const ARRAY8Ptr array2);
+
+extern void XdmcpGenerateKey (XdmAuthKeyPtr key);
+extern void XdmcpIncrementKey (XdmAuthKeyPtr key);
+extern void XdmcpDecrementKey (XdmAuthKeyPtr key);
+#ifdef HASXDMAUTH
+extern void XdmcpWrap(unsigned char *input, unsigned char *wrapper, unsigned char *output, int bytes);
+extern void XdmcpUnwrap(unsigned char *input, unsigned char *wrapper, unsigned char *output, int bytes);
+#endif
+
+#ifndef TRUE
+#define TRUE	1
+#define FALSE	0
+#endif
+
+extern int XdmcpCompareKeys (const XdmAuthKeyPtr a, const XdmAuthKeyPtr b);
+
+extern int XdmcpAllocARRAY16 (ARRAY16Ptr array, int length);
+extern int XdmcpAllocARRAY32 (ARRAY32Ptr array, int length);
+extern int XdmcpAllocARRAY8 (ARRAY8Ptr array, int length);
+extern int XdmcpAllocARRAYofARRAY8 (ARRAYofARRAY8Ptr array, int length);
+
+extern int XdmcpReallocARRAY16 (ARRAY16Ptr array, int length);
+extern int XdmcpReallocARRAY32 (ARRAY32Ptr array, int length);
+extern int XdmcpReallocARRAY8 (ARRAY8Ptr array, int length);
+extern int XdmcpReallocARRAYofARRAY8 (ARRAYofARRAY8Ptr array, int length);
+
+_XFUNCPROTOEND
+
+#endif /* _XDMCP_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xft/Xft.h b/ThirdParty/X11/Include/X11/Xft/Xft.h
new file mode 100644
index 0000000000000000000000000000000000000000..300949335442f7edd8d47b1be6d5824e6500c887
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xft/Xft.h
@@ -0,0 +1,618 @@
+/* include/X11/Xft/Xft.h.  Generated from Xft.h.in by configure.  */
+/*
+ * Copyright © 2000 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _XFT_H_
+#define _XFT_H_
+
+/*
+ * Current Xft version number, set from version in the Xft configure.ac file.
+ */
+/* #undef will be substituted by configure */
+#define XFT_MAJOR 2
+#define XFT_MINOR 3
+#define XFT_REVISION 2
+
+#define XFT_VERSION	((XFT_MAJOR * 10000) + (XFT_MINOR * 100) + (XFT_REVISION))
+#define XftVersion	XFT_VERSION
+
+#include <stdarg.h>
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include <fontconfig/fontconfig.h>
+#include <X11/extensions/Xrender.h>
+
+#include <X11/Xfuncproto.h>
+/* #include <X11/Xosdefs.h>*/
+#ifndef _X_SENTINEL
+# define _X_SENTINEL(x)
+#endif
+
+#ifndef _XFT_NO_COMPAT_
+#include <X11/Xft/XftCompat.h>
+#endif
+
+#define XFT_CORE		"core"
+#define XFT_RENDER		"render"
+#define XFT_XLFD		"xlfd"
+#define XFT_MAX_GLYPH_MEMORY	"maxglyphmemory"
+#define XFT_MAX_UNREF_FONTS	"maxunreffonts"
+
+extern FT_Library	_XftFTlibrary;
+
+typedef struct _XftFontInfo XftFontInfo;
+
+typedef struct _XftFont {
+    int		ascent;
+    int		descent;
+    int		height;
+    int		max_advance_width;
+    FcCharSet	*charset;
+    FcPattern	*pattern;
+} XftFont;
+
+typedef struct _XftDraw XftDraw;
+
+typedef struct _XftColor {
+    unsigned long   pixel;
+    XRenderColor    color;
+} XftColor;
+
+typedef struct _XftCharSpec {
+    FcChar32	    ucs4;
+    short	    x;
+    short	    y;
+} XftCharSpec;
+
+typedef struct _XftCharFontSpec {
+    XftFont	    *font;
+    FcChar32	    ucs4;
+    short	    x;
+    short	    y;
+} XftCharFontSpec;
+
+typedef struct _XftGlyphSpec {
+    FT_UInt	    glyph;
+    short	    x;
+    short	    y;
+} XftGlyphSpec;
+
+typedef struct _XftGlyphFontSpec {
+    XftFont	    *font;
+    FT_UInt	    glyph;
+    short	    x;
+    short	    y;
+} XftGlyphFontSpec;
+
+_XFUNCPROTOBEGIN
+
+
+/* xftcolor.c */
+Bool
+XftColorAllocName (Display  *dpy,
+		   _Xconst Visual   *visual,
+		   Colormap cmap,
+		   _Xconst char	    *name,
+		   XftColor *result);
+
+Bool
+XftColorAllocValue (Display	    *dpy,
+		    Visual	    *visual,
+		    Colormap	    cmap,
+		    _Xconst XRenderColor    *color,
+		    XftColor	    *result);
+
+void
+XftColorFree (Display	*dpy,
+	      Visual	*visual,
+	      Colormap	cmap,
+	      XftColor	*color);
+
+/* xftdpy.c */
+Bool
+XftDefaultHasRender (Display *dpy);
+
+Bool
+XftDefaultSet (Display *dpy, FcPattern *defaults);
+
+void
+XftDefaultSubstitute (Display *dpy, int screen, FcPattern *pattern);
+
+/* xftdraw.c */
+
+XftDraw *
+XftDrawCreate (Display   *dpy,
+	       Drawable  drawable,
+	       Visual    *visual,
+	       Colormap  colormap);
+
+XftDraw *
+XftDrawCreateBitmap (Display  *dpy,
+		     Pixmap   bitmap);
+
+XftDraw *
+XftDrawCreateAlpha (Display *dpy,
+		    Pixmap  pixmap,
+		    int	    depth);
+
+void
+XftDrawChange (XftDraw	*draw,
+	       Drawable	drawable);
+
+Display *
+XftDrawDisplay (XftDraw *draw);
+
+Drawable
+XftDrawDrawable (XftDraw *draw);
+
+Colormap
+XftDrawColormap (XftDraw *draw);
+
+Visual *
+XftDrawVisual (XftDraw *draw);
+
+void
+XftDrawDestroy (XftDraw	*draw);
+
+Picture
+XftDrawPicture (XftDraw *draw);
+
+Picture
+XftDrawSrcPicture (XftDraw *draw, _Xconst XftColor *color);
+
+void
+XftDrawGlyphs (XftDraw		*draw,
+	       _Xconst XftColor	*color,
+	       XftFont		*pub,
+	       int		x,
+	       int		y,
+	       _Xconst FT_UInt	*glyphs,
+	       int		nglyphs);
+
+void
+XftDrawString8 (XftDraw		    *draw,
+		_Xconst XftColor    *color,
+		XftFont		    *pub,
+		int		    x,
+		int		    y,
+		_Xconst FcChar8	    *string,
+		int		    len);
+
+void
+XftDrawString16 (XftDraw	    *draw,
+		 _Xconst XftColor   *color,
+		 XftFont	    *pub,
+		 int		    x,
+		 int		    y,
+		 _Xconst FcChar16   *string,
+		 int		    len);
+
+void
+XftDrawString32 (XftDraw	    *draw,
+		 _Xconst XftColor   *color,
+		 XftFont	    *pub,
+		 int		    x,
+		 int		    y,
+		 _Xconst FcChar32   *string,
+		 int		    len);
+
+void
+XftDrawStringUtf8 (XftDraw	    *draw,
+		   _Xconst XftColor *color,
+		   XftFont	    *pub,
+		   int		    x,
+		   int		    y,
+		   _Xconst FcChar8  *string,
+		   int		    len);
+
+void
+XftDrawStringUtf16 (XftDraw		*draw,
+		    _Xconst XftColor	*color,
+		    XftFont		*pub,
+		    int			x,
+		    int			y,
+		    _Xconst FcChar8	*string,
+		    FcEndian		endian,
+		    int			len);
+
+void
+XftDrawCharSpec (XftDraw		*draw,
+		 _Xconst XftColor	*color,
+		 XftFont		*pub,
+		 _Xconst XftCharSpec	*chars,
+		 int			len);
+
+void
+XftDrawCharFontSpec (XftDraw			*draw,
+		     _Xconst XftColor		*color,
+		     _Xconst XftCharFontSpec	*chars,
+		     int			len);
+
+void
+XftDrawGlyphSpec (XftDraw		*draw,
+		  _Xconst XftColor	*color,
+		  XftFont		*pub,
+		  _Xconst XftGlyphSpec	*glyphs,
+		  int			len);
+
+void
+XftDrawGlyphFontSpec (XftDraw			*draw,
+		      _Xconst XftColor		*color,
+		      _Xconst XftGlyphFontSpec	*glyphs,
+		      int			len);
+
+void
+XftDrawRect (XftDraw		*draw,
+	     _Xconst XftColor	*color,
+	     int		x,
+	     int		y,
+	     unsigned int	width,
+	     unsigned int	height);
+
+
+Bool
+XftDrawSetClip (XftDraw	    *draw,
+		Region	    r);
+
+
+Bool
+XftDrawSetClipRectangles (XftDraw		*draw,
+			  int			xOrigin,
+			  int			yOrigin,
+			  _Xconst XRectangle	*rects,
+			  int			n);
+
+void
+XftDrawSetSubwindowMode (XftDraw    *draw,
+			 int	    mode);
+
+/* xftextent.c */
+
+void
+XftGlyphExtents (Display	    *dpy,
+		 XftFont	    *pub,
+		 _Xconst FT_UInt    *glyphs,
+		 int		    nglyphs,
+		 XGlyphInfo	    *extents);
+
+void
+XftTextExtents8 (Display	    *dpy,
+		 XftFont	    *pub,
+		 _Xconst FcChar8    *string,
+		 int		    len,
+		 XGlyphInfo	    *extents);
+
+void
+XftTextExtents16 (Display	    *dpy,
+		  XftFont	    *pub,
+		  _Xconst FcChar16  *string,
+		  int		    len,
+		  XGlyphInfo	    *extents);
+
+void
+XftTextExtents32 (Display	    *dpy,
+		  XftFont	    *pub,
+		  _Xconst FcChar32  *string,
+		  int		    len,
+		  XGlyphInfo	    *extents);
+
+void
+XftTextExtentsUtf8 (Display	    *dpy,
+		    XftFont	    *pub,
+		    _Xconst FcChar8 *string,
+		    int		    len,
+		    XGlyphInfo	    *extents);
+
+void
+XftTextExtentsUtf16 (Display		*dpy,
+		     XftFont		*pub,
+		     _Xconst FcChar8	*string,
+		     FcEndian		endian,
+		     int		len,
+		     XGlyphInfo		*extents);
+
+/* xftfont.c */
+FcPattern *
+XftFontMatch (Display		*dpy,
+	      int		screen,
+	      _Xconst FcPattern *pattern,
+	      FcResult		*result);
+
+XftFont *
+XftFontOpen (Display *dpy, int screen, ...) _X_SENTINEL(0);
+
+XftFont *
+XftFontOpenName (Display *dpy, int screen, _Xconst char *name);
+
+XftFont *
+XftFontOpenXlfd (Display *dpy, int screen, _Xconst char *xlfd);
+
+/* xftfreetype.c */
+
+FT_Face
+XftLockFace (XftFont *pub);
+
+void
+XftUnlockFace (XftFont *pub);
+
+XftFontInfo *
+XftFontInfoCreate (Display *dpy, _Xconst FcPattern *pattern);
+
+void
+XftFontInfoDestroy (Display *dpy, XftFontInfo *fi);
+
+FcChar32
+XftFontInfoHash (_Xconst XftFontInfo *fi);
+
+FcBool
+XftFontInfoEqual (_Xconst XftFontInfo *a, _Xconst XftFontInfo *b);
+
+XftFont *
+XftFontOpenInfo (Display	*dpy,
+		 FcPattern	*pattern,
+		 XftFontInfo	*fi);
+
+XftFont *
+XftFontOpenPattern (Display *dpy, FcPattern *pattern);
+
+XftFont *
+XftFontCopy (Display *dpy, XftFont *pub);
+
+void
+XftFontClose (Display *dpy, XftFont *pub);
+
+FcBool
+XftInitFtLibrary(void);
+
+/* xftglyphs.c */
+void
+XftFontLoadGlyphs (Display	    *dpy,
+		   XftFont	    *pub,
+		   FcBool	    need_bitmaps,
+		   _Xconst FT_UInt  *glyphs,
+		   int		    nglyph);
+
+void
+XftFontUnloadGlyphs (Display		*dpy,
+		     XftFont		*pub,
+		     _Xconst FT_UInt	*glyphs,
+		     int		nglyph);
+
+#define XFT_NMISSING		256
+
+FcBool
+XftFontCheckGlyph (Display  *dpy,
+		   XftFont  *pub,
+		   FcBool   need_bitmaps,
+		   FT_UInt  glyph,
+		   FT_UInt  *missing,
+		   int	    *nmissing);
+
+FcBool
+XftCharExists (Display	    *dpy,
+	       XftFont	    *pub,
+	       FcChar32    ucs4);
+
+FT_UInt
+XftCharIndex (Display	    *dpy,
+	      XftFont	    *pub,
+	      FcChar32	    ucs4);
+
+/* xftinit.c */
+FcBool
+XftInit (_Xconst char *config);
+
+int
+XftGetVersion (void);
+
+/* xftlist.c */
+
+FcFontSet *
+XftListFonts (Display	*dpy,
+	      int	screen,
+	      ...) _X_SENTINEL(0);
+
+/* xftname.c */
+FcPattern
+*XftNameParse (_Xconst char *name);
+
+/* xftrender.c */
+void
+XftGlyphRender (Display		*dpy,
+		int		op,
+		Picture		src,
+		XftFont		*pub,
+		Picture		dst,
+		int		srcx,
+		int		srcy,
+		int		x,
+		int		y,
+		_Xconst FT_UInt	*glyphs,
+		int		nglyphs);
+
+void
+XftGlyphSpecRender (Display		    *dpy,
+		    int			    op,
+		    Picture		    src,
+		    XftFont		    *pub,
+		    Picture		    dst,
+		    int			    srcx,
+		    int			    srcy,
+		    _Xconst XftGlyphSpec    *glyphs,
+		    int			    nglyphs);
+
+void
+XftCharSpecRender (Display		*dpy,
+		   int			op,
+		   Picture		src,
+		   XftFont		*pub,
+		   Picture		dst,
+		   int			srcx,
+		   int			srcy,
+		   _Xconst XftCharSpec	*chars,
+		   int			len);
+
+void
+XftGlyphFontSpecRender (Display			    *dpy,
+			int			    op,
+			Picture			    src,
+			Picture			    dst,
+			int			    srcx,
+			int			    srcy,
+			_Xconst XftGlyphFontSpec    *glyphs,
+			int			    nglyphs);
+
+void
+XftCharFontSpecRender (Display			*dpy,
+		       int			op,
+		       Picture			src,
+		       Picture			dst,
+		       int			srcx,
+		       int			srcy,
+		       _Xconst XftCharFontSpec	*chars,
+		       int			len);
+
+void
+XftTextRender8 (Display		*dpy,
+		int		op,
+		Picture		src,
+		XftFont		*pub,
+		Picture		dst,
+		int		srcx,
+		int		srcy,
+		int		x,
+		int		y,
+		_Xconst FcChar8	*string,
+		int		len);
+
+void
+XftTextRender16 (Display	    *dpy,
+		 int		    op,
+		 Picture	    src,
+		 XftFont	    *pub,
+		 Picture	    dst,
+		 int		    srcx,
+		 int		    srcy,
+		 int		    x,
+		 int		    y,
+		 _Xconst FcChar16   *string,
+		 int		    len);
+
+void
+XftTextRender16BE (Display	    *dpy,
+		   int		    op,
+		   Picture	    src,
+		   XftFont	    *pub,
+		   Picture	    dst,
+		   int		    srcx,
+		   int		    srcy,
+		   int		    x,
+		   int		    y,
+		   _Xconst FcChar8  *string,
+		   int		    len);
+
+void
+XftTextRender16LE (Display	    *dpy,
+		   int		    op,
+		   Picture	    src,
+		   XftFont	    *pub,
+		   Picture	    dst,
+		   int		    srcx,
+		   int		    srcy,
+		   int		    x,
+		   int		    y,
+		   _Xconst FcChar8  *string,
+		   int		    len);
+
+void
+XftTextRender32 (Display	    *dpy,
+		 int		    op,
+		 Picture	    src,
+		 XftFont	    *pub,
+		 Picture	    dst,
+		 int		    srcx,
+		 int		    srcy,
+		 int		    x,
+		 int		    y,
+		 _Xconst FcChar32   *string,
+		 int		    len);
+
+void
+XftTextRender32BE (Display	    *dpy,
+		   int		    op,
+		   Picture	    src,
+		   XftFont	    *pub,
+		   Picture	    dst,
+		   int		    srcx,
+		   int		    srcy,
+		   int		    x,
+		   int		    y,
+		   _Xconst FcChar8  *string,
+		   int		    len);
+
+void
+XftTextRender32LE (Display	    *dpy,
+		   int		    op,
+		   Picture	    src,
+		   XftFont	    *pub,
+		   Picture	    dst,
+		   int		    srcx,
+		   int		    srcy,
+		   int		    x,
+		   int		    y,
+		   _Xconst FcChar8  *string,
+		   int		    len);
+
+void
+XftTextRenderUtf8 (Display	    *dpy,
+		   int		    op,
+		   Picture	    src,
+		   XftFont	    *pub,
+		   Picture	    dst,
+		   int		    srcx,
+		   int		    srcy,
+		   int		    x,
+		   int		    y,
+		   _Xconst FcChar8  *string,
+		   int		    len);
+
+void
+XftTextRenderUtf16 (Display	    *dpy,
+		    int		    op,
+		    Picture	    src,
+		    XftFont	    *pub,
+		    Picture	    dst,
+		    int		    srcx,
+		    int		    srcy,
+		    int		    x,
+		    int		    y,
+		    _Xconst FcChar8 *string,
+		    FcEndian	    endian,
+		    int		    len);
+
+/* xftxlfd.c */
+FcPattern *
+XftXlfdParse (_Xconst char *xlfd_orig, Bool ignore_scalable, Bool complete);
+
+_XFUNCPROTOEND
+
+#endif /* _XFT_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xft/XftCompat.h b/ThirdParty/X11/Include/X11/Xft/XftCompat.h
new file mode 100644
index 0000000000000000000000000000000000000000..0fced03a5ee884e2eece0f682d30aa8a12a5ce8a
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xft/XftCompat.h
@@ -0,0 +1,163 @@
+/*
+ * Copyright © 2001 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _XFTCOMPAT_H_
+#define _XFTCOMPAT_H_
+#include <X11/Xfuncproto.h>
+
+/*
+ * Compatibility definitions -- map Fc names to Xft names
+ */
+
+typedef FcChar8	    XftChar8;
+typedef FcChar16    XftChar16;
+typedef FcChar32    XftChar32;
+
+#define XFT_FAMILY	FC_FAMILY
+#define XFT_STYLE	FC_STYLE
+#define XFT_SLANT	FC_SLANT
+#define XFT_WEIGHT	FC_WEIGHT
+#define XFT_SIZE	FC_SIZE
+#define XFT_PIXEL_SIZE	FC_PIXEL_SIZE
+#define XFT_SPACING	FC_SPACING
+#define XFT_FOUNDRY	FC_FOUNDRY
+#define XFT_ANTIALIAS	FC_ANTIALIAS
+#define XFT_FILE	FC_FILE
+#define XFT_INDEX	FC_INDEX
+#define XFT_RASTERIZER	FC_RASTERIZER
+#define XFT_OUTLINE	FC_OUTLINE
+#define XFT_SCALABLE	FC_SCALABLE
+#define XFT_RGBA	FC_RGBA
+
+/* defaults from resources */
+#define XFT_SCALE	FC_SCALE
+#define XFT_MINSPACE	FC_MINSPACE
+#define XFT_DPI		FC_DPI
+
+/* specific to FreeType rasterizer */
+#define XFT_CHAR_WIDTH	FC_CHAR_WIDTH
+#define XFT_CHAR_HEIGHT	FC_CHAR_HEIGHT
+#define XFT_MATRIX	FC_MATRIX
+
+#define XFT_WEIGHT_LIGHT	FC_WEIGHT_LIGHT
+#define XFT_WEIGHT_MEDIUM	FC_WEIGHT_MEDIUM
+#define XFT_WEIGHT_DEMIBOLD	FC_WEIGHT_DEMIBOLD
+#define XFT_WEIGHT_BOLD		FC_WEIGHT_BOLD
+#define XFT_WEIGHT_BLACK	FC_WEIGHT_BLACK
+
+#define XFT_SLANT_ROMAN		FC_SLANT_ROMAN
+#define XFT_SLANT_ITALIC	FC_SLANT_ITALIC
+#define XFT_SLANT_OBLIQUE	FC_SLANT_OBLIQUE
+
+#define XFT_PROPORTIONAL	FC_PROPORTIONAL
+#define XFT_MONO		FC_MONO
+#define XFT_CHARCELL		FC_CHARCELL
+
+#define XFT_RGBA_UNKNOWN	FC_RGBA_UNKNOWN
+#define XFT_RGBA_RGB		FC_RGBA_RGB
+#define XFT_RGBA_BGR		FC_RGBA_BGR
+#define XFT_RGBA_VRGB		FC_RGBA_VRGB
+#define XFT_RGBA_VBGR		FC_RGBA_VBGR
+#define XFT_RGBA_NONE		FC_RGBA_NONE
+
+/*
+ * Old constants
+ */
+#define XFT_ENCODING		"encoding"
+
+typedef FcType XftType;
+
+typedef FcMatrix XftMatrix;
+
+#define XftMatrixInit(m)	FcMatrixInit(m)
+
+typedef FcResult    XftResult;
+
+#define XftResultMatch		FcResultMatch
+#define XftResultNoMatch	FcResultNoMatch
+#define XftResultTypeMismatch	FcResultTypeMismatch
+#define XftResultNoId		FcResultNoId
+
+typedef FcValue		XftValue;
+typedef FcPattern	XftPattern;
+typedef FcFontSet	XftFontSet;
+typedef FcObjectSet	XftObjectSet;
+
+#define XftGlyphExists		XftCharExists
+
+#define XftObjectSetCreate	FcObjectSetCreate
+#define XftObjectSetAdd		FcObjectSetAdd
+#define XftObjectSetDestroy	FcObjectSetDestroy
+#define XftObjectSetVaBuild	FcObjectSetVaBuild
+#define XftObjectSetBuild	FcObjectSetBuild
+
+#define XftFontSetMatch		FcFontSetMatch
+#define XftFontSetDestroy	FcFontSetDestroy
+
+#define XftMatrixEqual		FcMatrixEqual
+#define XftMatrixMultiply	FcMatrixMultiply
+#define XftMatrixRotate		FcMatrixRotate
+#define XftMatrixScale		FcMatrixScale
+#define XftMatrixShear		FcMatrixShear
+
+#define XftPatternCreate	FcPatternCreate
+#define XftPatternDuplicate	FcPatternDuplicate
+#define XftValueDestroy		FcValueDestroy
+#define XftValueListDestroy	FcValueListDestroy
+#define XftPatternDestroy	FcPatternDestroy
+#define XftPatternFind		FcPatternFind
+#define XftPatternAdd		FcPatternAdd
+#define XftPatternGet		FcPatternGet
+#define XftPatternDel		FcPatternDel
+#define XftPatternAddInteger	FcPatternAddInteger
+#define XftPatternAddDouble	FcPatternAddDouble
+#define XftPatternAddString(p,e,s)	FcPatternAddString(p,e,(FcChar8 *)(s))
+#define XftPatternAddMatrix	FcPatternAddMatrix
+#define XftPatternAddBool	FcPatternAddBool
+#define XftPatternGetInteger	FcPatternGetInteger
+#define XftPatternGetDouble	FcPatternGetDouble
+#define XftPatternGetString(p,e,i,n)	FcPatternGetString(p,e,i,(FcChar8 **) (n))
+#define XftPatternGetMatrix	FcPatternGetMatrix
+#define XftPatternGetBool	FcPatternGetBool
+#define XftPatternVaBuild	FcPatternVaBuild
+#define XftPatternBuild		FcPatternBuild
+
+#define XftUtf8ToUcs4		FcUtf8ToUcs4
+#define XftUtf8Len		FcUtf8Len
+
+#define XftTypeVoid	FcTypeVoid
+#define XftTypeInteger	FcTypeInteger
+#define XftTypeDouble	FcTypeDouble
+#define XftTypeString	FcTypeString
+#define XftTypeBool	FcTypeBool
+#define XftTypeMatrix	FcTypeMatrix
+
+#define XftConfigSubstitute(p) FcConfigSubstitute (0, p, FcMatchPattern)
+
+_XFUNCPROTOBEGIN
+
+FcBool
+XftNameUnparse (XftPattern *pat, char *dest, int len);
+
+_XFUNCPROTOEND
+
+#endif /* _XFTCOMPAT_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xfuncproto.h b/ThirdParty/X11/Include/X11/Xfuncproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..61fa8fa35d5b0f52e1968a3efbc711c639e36623
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xfuncproto.h
@@ -0,0 +1,221 @@
+/* Xfuncproto.h.  Generated from Xfuncproto.h.in by configure.  */
+/*
+ *
+Copyright 1989, 1991, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ */
+
+/* Definitions to make function prototypes manageable */
+
+#ifndef _XFUNCPROTO_H_
+#define _XFUNCPROTO_H_
+
+#ifndef NeedFunctionPrototypes
+#define NeedFunctionPrototypes 1
+#endif /* NeedFunctionPrototypes */
+
+#ifndef NeedVarargsPrototypes
+#define NeedVarargsPrototypes 1
+#endif /* NeedVarargsPrototypes */
+
+#if NeedFunctionPrototypes
+
+#ifndef NeedNestedPrototypes
+#define NeedNestedPrototypes 1
+#endif /* NeedNestedPrototypes */
+
+#ifndef _Xconst
+#define _Xconst const
+#endif /* _Xconst */
+
+/* Function prototype configuration (see configure for more info) */
+#ifndef NARROWPROTO
+#define NARROWPROTO /**/
+#endif
+#ifndef FUNCPROTO
+#define FUNCPROTO 15
+#endif
+
+#ifndef NeedWidePrototypes
+#ifdef NARROWPROTO
+#define NeedWidePrototypes 0
+#else
+#define NeedWidePrototypes 1		/* default to make interropt. easier */
+#endif
+#endif /* NeedWidePrototypes */
+
+#endif /* NeedFunctionPrototypes */
+
+#ifndef _XFUNCPROTOBEGIN
+#if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */
+#define _XFUNCPROTOBEGIN extern "C" {	/* do not leave open across includes */
+#define _XFUNCPROTOEND }
+#else
+#define _XFUNCPROTOBEGIN
+#define _XFUNCPROTOEND
+#endif
+#endif /* _XFUNCPROTOBEGIN */
+
+/* http://clang.llvm.org/docs/LanguageExtensions.html#has-attribute */
+#ifndef __has_attribute
+# define __has_attribute(x) 0  /* Compatibility with non-clang compilers. */
+#endif
+#ifndef __has_feature
+# define __has_feature(x) 0    /* Compatibility with non-clang compilers. */
+#endif
+#ifndef __has_extension
+# define __has_extension(x) 0  /* Compatibility with non-clang compilers. */
+#endif
+
+/* Added in X11R6.9, so available in any version of modular xproto */
+#if __has_attribute(__sentinel__) || (defined(__GNUC__) && (__GNUC__ >= 4))
+# define _X_SENTINEL(x) __attribute__ ((__sentinel__(x)))
+#else
+# define _X_SENTINEL(x)
+#endif /* GNUC >= 4 */
+
+/* Added in X11R6.9, so available in any version of modular xproto */
+#if (__has_attribute(visibility) || (defined(__GNUC__) && (__GNUC__ >= 4))) \
+    && !defined(__CYGWIN__) && !defined(__MINGW32__)
+# define _X_EXPORT      __attribute__((visibility("default")))
+# define _X_HIDDEN      __attribute__((visibility("hidden")))
+# define _X_INTERNAL    __attribute__((visibility("internal")))
+#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
+# define _X_EXPORT      __global
+# define _X_HIDDEN      __hidden
+# define _X_INTERNAL    __hidden
+#else /* not gcc >= 4 and not Sun Studio >= 8 */
+# define _X_EXPORT
+# define _X_HIDDEN
+# define _X_INTERNAL
+#endif /* GNUC >= 4 */
+
+/* Branch prediction hints for individual conditionals */
+/* requires xproto >= 7.0.9 */
+#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303)
+# define _X_LIKELY(x)   __builtin_expect(!!(x), 1)
+# define _X_UNLIKELY(x) __builtin_expect(!!(x), 0)
+#else /* not gcc >= 3.3 */
+# define _X_LIKELY(x)   (x)
+# define _X_UNLIKELY(x) (x)
+#endif
+
+/* Bulk branch prediction hints via marking error path functions as "cold" */
+/* requires xproto >= 7.0.25 */
+#if __has_attribute(__cold__) || \
+    (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403)) /* 4.3+ */
+# define _X_COLD __attribute__((__cold__))
+#else
+# define _X_COLD /* nothing */
+#endif
+
+/* Added in X11R6.9, so available in any version of modular xproto */
+#if __has_attribute(deprecated) \
+    || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 301)) \
+    || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5130))
+# define _X_DEPRECATED  __attribute__((deprecated))
+#else /* not gcc >= 3.1 */
+# define _X_DEPRECATED
+#endif
+
+/* requires xproto >= 7.0.30 */
+#if __has_extension(attribute_deprecated_with_message) || \
+                (defined(__GNUC__) && ((__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5))))
+# define _X_DEPRECATED_MSG(_msg) __attribute__((deprecated(_msg)))
+#else
+# define _X_DEPRECATED_MSG(_msg) _X_DEPRECATED
+#endif
+
+/* requires xproto >= 7.0.17 */
+#if __has_attribute(noreturn) \
+    || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)) \
+    || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+# define _X_NORETURN __attribute((noreturn))
+#else
+# define _X_NORETURN
+#endif /* GNUC  */
+
+/* Added in X11R6.9, so available in any version of modular xproto */
+#if __has_attribute(__format__) \
+    || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203)
+# define _X_ATTRIBUTE_PRINTF(x,y) __attribute__((__format__(__printf__,x,y)))
+#else /* not gcc >= 2.3 */
+# define _X_ATTRIBUTE_PRINTF(x,y)
+#endif
+
+/* requires xproto >= 7.0.22 - since this uses either gcc or C99 variable
+   argument macros, must be only used inside #ifdef _X_NONNULL guards, as
+   many legacy X clients are compiled in C89 mode still. */
+#if __has_attribute(nonnull) \
+    && defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */
+#define _X_NONNULL(...)  __attribute__((nonnull(__VA_ARGS__)))
+#elif __has_attribute(nonnull) \
+    || defined(__GNUC__) &&  ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303)
+#define _X_NONNULL(args...)  __attribute__((nonnull(args)))
+#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */
+#define _X_NONNULL(...)  /* */
+#endif
+
+/* requires xproto >= 7.0.22 */
+#if __has_attribute(__unused__) \
+    || defined(__GNUC__) &&  ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)
+#define _X_UNUSED  __attribute__((__unused__))
+#else
+#define _X_UNUSED  /* */
+#endif
+
+/* C99 keyword "inline" or equivalent extensions in pre-C99 compilers */
+/* requires xproto >= 7.0.9
+   (introduced in 7.0.8 but didn't support all compilers until 7.0.9) */
+#if defined(inline) /* assume autoconf set it correctly */ || \
+   (defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L)) /* C99 */ || \
+   (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550))
+# define _X_INLINE inline
+#elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */
+# define _X_INLINE __inline__
+#else
+# define _X_INLINE
+#endif
+
+/* C99 keyword "restrict" or equivalent extensions in pre-C99 compilers */
+/* requires xproto >= 7.0.21 */
+#ifndef _X_RESTRICT_KYWD
+# if defined(restrict) /* assume autoconf set it correctly */ || \
+    (defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */ \
+     && !defined(__cplusplus)) /* Workaround g++ issue on Solaris */
+#  define _X_RESTRICT_KYWD  restrict
+# elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */
+#  define _X_RESTRICT_KYWD __restrict__
+# else
+#  define _X_RESTRICT_KYWD
+# endif
+#endif
+
+/* requires xproto >= 7.0.30 */
+#if __has_attribute(no_sanitize_thread)
+# define _X_NOTSAN __attribute__((no_sanitize_thread))
+#else
+# define _X_NOTSAN
+#endif
+
+#endif /* _XFUNCPROTO_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xfuncs.h b/ThirdParty/X11/Include/X11/Xfuncs.h
new file mode 100644
index 0000000000000000000000000000000000000000..b7c40294c986ebe16c55865eab86d76e9e4854ba
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xfuncs.h
@@ -0,0 +1,69 @@
+/*
+ * 
+Copyright 1990, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ */
+
+#ifndef _XFUNCS_H_
+# define _XFUNCS_H_
+
+# include <X11/Xosdefs.h>
+
+/* the old Xfuncs.h, for pre-R6 */
+# if !(defined(XFree86LOADER) && defined(IN_MODULE))
+
+#  ifdef X_USEBFUNCS
+void bcopy();
+void bzero();
+int bcmp();
+#  else
+#   if defined(SYSV) && !defined(__SCO__) && !defined(__sun) && !defined(__UNIXWARE__) && !defined(_AIX)
+#    include <memory.h>
+void bcopy();
+#    define bzero(b,len) memset(b, 0, len)
+#    define bcmp(b1,b2,len) memcmp(b1, b2, len)
+#   else
+#    include <string.h>
+#    if defined(__SCO__) || defined(__sun) || defined(__UNIXWARE__) || defined(__CYGWIN__) || defined(_AIX) || defined(__APPLE__)
+#     include <strings.h>
+#    endif
+#    define _XFUNCS_H_INCLUDED_STRING_H
+#   endif
+#  endif /* X_USEBFUNCS */
+
+/* the new Xfuncs.h */
+
+/* the ANSI C way */
+#  ifndef _XFUNCS_H_INCLUDED_STRING_H
+#   include <string.h>
+#  endif
+#  undef bzero
+#  define bzero(b,len) memset(b,0,len)
+
+#  if defined WIN32 && defined __MINGW32__
+#   define bcopy(b1,b2,len) memmove(b2, b1, (size_t)(len))
+#  endif
+
+# endif /* !(defined(XFree86LOADER) && defined(IN_MODULE)) */
+
+#endif /* _XFUNCS_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xlib-xcb.h b/ThirdParty/X11/Include/X11/Xlib-xcb.h
new file mode 100644
index 0000000000000000000000000000000000000000..a21e2bef0dc403499e0dcee3e76a44c0f75d3a08
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xlib-xcb.h
@@ -0,0 +1,20 @@
+/* Copyright (C) 2003-2006 Jamey Sharp, Josh Triplett
+ * This file is licensed under the MIT license. See the file COPYING. */
+
+#ifndef _X11_XLIB_XCB_H_
+#define _X11_XLIB_XCB_H_
+
+#include <xcb/xcb.h>
+#include <X11/Xlib.h>
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+xcb_connection_t *XGetXCBConnection(Display *dpy);
+
+enum XEventQueueOwner { XlibOwnsEventQueue = 0, XCBOwnsEventQueue };
+void XSetEventQueueOwner(Display *dpy, enum XEventQueueOwner owner);
+
+_XFUNCPROTOEND
+
+#endif /* _X11_XLIB_XCB_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xlib.h b/ThirdParty/X11/Include/X11/Xlib.h
new file mode 100644
index 0000000000000000000000000000000000000000..84403f79eeaa8b9b1872aeb978a161c35b636ce9
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xlib.h
@@ -0,0 +1,4015 @@
+/*
+
+Copyright 1985, 1986, 1987, 1991, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+
+/*
+ *	Xlib.h - Header definition and support file for the C subroutine
+ *	interface library (Xlib) to the X Window System Protocol (V11).
+ *	Structures and symbols starting with "_" are private to the library.
+ */
+#ifndef _X11_XLIB_H_
+#define _X11_XLIB_H_
+
+#define XlibSpecificationRelease 6
+
+#include <sys/types.h>
+
+#if defined(__SCO__) || defined(__UNIXWARE__)
+#include <stdint.h>
+#endif
+
+#include <X11/X.h>
+
+/* applications should not depend on these two headers being included! */
+#include <X11/Xfuncproto.h>
+#include <X11/Xosdefs.h>
+
+#ifndef X_WCHAR
+#include <stddef.h>
+#else
+#ifdef __UNIXOS2__
+#include <stdlib.h>
+#else
+/* replace this with #include or typedef appropriate for your system */
+typedef unsigned long wchar_t;
+#endif
+#endif
+
+
+extern int
+_Xmblen(
+    char *str,
+    int len
+    );
+
+/* API mentioning "UTF8" or "utf8" is an XFree86 extension, introduced in
+   November 2000. Its presence is indicated through the following macro. */
+#define X_HAVE_UTF8_STRING 1
+
+/* The Xlib structs are full of implicit padding to properly align members.
+   We can't clean that up without breaking ABI, so tell clang not to bother
+   complaining about it. */
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+#endif
+
+typedef char *XPointer;
+
+#define Bool int
+#define Status int
+#define True 1
+#define False 0
+
+#define QueuedAlready 0
+#define QueuedAfterReading 1
+#define QueuedAfterFlush 2
+
+#define ConnectionNumber(dpy) 	(((_XPrivDisplay)(dpy))->fd)
+#define RootWindow(dpy, scr) 	(ScreenOfDisplay(dpy,scr)->root)
+#define DefaultScreen(dpy) 	(((_XPrivDisplay)(dpy))->default_screen)
+#define DefaultRootWindow(dpy) 	(ScreenOfDisplay(dpy,DefaultScreen(dpy))->root)
+#define DefaultVisual(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_visual)
+#define DefaultGC(dpy, scr) 	(ScreenOfDisplay(dpy,scr)->default_gc)
+#define BlackPixel(dpy, scr) 	(ScreenOfDisplay(dpy,scr)->black_pixel)
+#define WhitePixel(dpy, scr) 	(ScreenOfDisplay(dpy,scr)->white_pixel)
+#define AllPlanes 		((unsigned long)~0L)
+#define QLength(dpy) 		(((_XPrivDisplay)(dpy))->qlen)
+#define DisplayWidth(dpy, scr) 	(ScreenOfDisplay(dpy,scr)->width)
+#define DisplayHeight(dpy, scr) (ScreenOfDisplay(dpy,scr)->height)
+#define DisplayWidthMM(dpy, scr)(ScreenOfDisplay(dpy,scr)->mwidth)
+#define DisplayHeightMM(dpy, scr)(ScreenOfDisplay(dpy,scr)->mheight)
+#define DisplayPlanes(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_depth)
+#define DisplayCells(dpy, scr) 	(DefaultVisual(dpy,scr)->map_entries)
+#define ScreenCount(dpy) 	(((_XPrivDisplay)(dpy))->nscreens)
+#define ServerVendor(dpy) 	(((_XPrivDisplay)(dpy))->vendor)
+#define ProtocolVersion(dpy) 	(((_XPrivDisplay)(dpy))->proto_major_version)
+#define ProtocolRevision(dpy) 	(((_XPrivDisplay)(dpy))->proto_minor_version)
+#define VendorRelease(dpy) 	(((_XPrivDisplay)(dpy))->release)
+#define DisplayString(dpy) 	(((_XPrivDisplay)(dpy))->display_name)
+#define DefaultDepth(dpy, scr) 	(ScreenOfDisplay(dpy,scr)->root_depth)
+#define DefaultColormap(dpy, scr)(ScreenOfDisplay(dpy,scr)->cmap)
+#define BitmapUnit(dpy) 	(((_XPrivDisplay)(dpy))->bitmap_unit)
+#define BitmapBitOrder(dpy) 	(((_XPrivDisplay)(dpy))->bitmap_bit_order)
+#define BitmapPad(dpy) 		(((_XPrivDisplay)(dpy))->bitmap_pad)
+#define ImageByteOrder(dpy) 	(((_XPrivDisplay)(dpy))->byte_order)
+#define NextRequest(dpy)	(((_XPrivDisplay)(dpy))->request + 1)
+#define LastKnownRequestProcessed(dpy)	(((_XPrivDisplay)(dpy))->last_request_read)
+
+/* macros for screen oriented applications (toolkit) */
+#define ScreenOfDisplay(dpy, scr)(&((_XPrivDisplay)(dpy))->screens[scr])
+#define DefaultScreenOfDisplay(dpy) ScreenOfDisplay(dpy,DefaultScreen(dpy))
+#define DisplayOfScreen(s)	((s)->display)
+#define RootWindowOfScreen(s)	((s)->root)
+#define BlackPixelOfScreen(s)	((s)->black_pixel)
+#define WhitePixelOfScreen(s)	((s)->white_pixel)
+#define DefaultColormapOfScreen(s)((s)->cmap)
+#define DefaultDepthOfScreen(s)	((s)->root_depth)
+#define DefaultGCOfScreen(s)	((s)->default_gc)
+#define DefaultVisualOfScreen(s)((s)->root_visual)
+#define WidthOfScreen(s)	((s)->width)
+#define HeightOfScreen(s)	((s)->height)
+#define WidthMMOfScreen(s)	((s)->mwidth)
+#define HeightMMOfScreen(s)	((s)->mheight)
+#define PlanesOfScreen(s)	((s)->root_depth)
+#define CellsOfScreen(s)	(DefaultVisualOfScreen((s))->map_entries)
+#define MinCmapsOfScreen(s)	((s)->min_maps)
+#define MaxCmapsOfScreen(s)	((s)->max_maps)
+#define DoesSaveUnders(s)	((s)->save_unders)
+#define DoesBackingStore(s)	((s)->backing_store)
+#define EventMaskOfScreen(s)	((s)->root_input_mask)
+
+/*
+ * Extensions need a way to hang private data on some structures.
+ */
+typedef struct _XExtData {
+	int number;		/* number returned by XRegisterExtension */
+	struct _XExtData *next;	/* next item on list of data for structure */
+	int (*free_private)(	/* called to free private storage */
+	struct _XExtData *extension
+	);
+	XPointer private_data;	/* data private to this extension. */
+} XExtData;
+
+/*
+ * This file contains structures used by the extension mechanism.
+ */
+typedef struct {		/* public to extension, cannot be changed */
+	int extension;		/* extension number */
+	int major_opcode;	/* major op-code assigned by server */
+	int first_event;	/* first event number for the extension */
+	int first_error;	/* first error number for the extension */
+} XExtCodes;
+
+/*
+ * Data structure for retrieving info about pixmap formats.
+ */
+
+typedef struct {
+    int depth;
+    int bits_per_pixel;
+    int scanline_pad;
+} XPixmapFormatValues;
+
+
+/*
+ * Data structure for setting graphics context.
+ */
+typedef struct {
+	int function;		/* logical operation */
+	unsigned long plane_mask;/* plane mask */
+	unsigned long foreground;/* foreground pixel */
+	unsigned long background;/* background pixel */
+	int line_width;		/* line width */
+	int line_style;	 	/* LineSolid, LineOnOffDash, LineDoubleDash */
+	int cap_style;	  	/* CapNotLast, CapButt,
+				   CapRound, CapProjecting */
+	int join_style;	 	/* JoinMiter, JoinRound, JoinBevel */
+	int fill_style;	 	/* FillSolid, FillTiled,
+				   FillStippled, FillOpaeueStippled */
+	int fill_rule;	  	/* EvenOddRule, WindingRule */
+	int arc_mode;		/* ArcChord, ArcPieSlice */
+	Pixmap tile;		/* tile pixmap for tiling operations */
+	Pixmap stipple;		/* stipple 1 plane pixmap for stipping */
+	int ts_x_origin;	/* offset for tile or stipple operations */
+	int ts_y_origin;
+        Font font;	        /* default text font for text operations */
+	int subwindow_mode;     /* ClipByChildren, IncludeInferiors */
+	Bool graphics_exposures;/* boolean, should exposures be generated */
+	int clip_x_origin;	/* origin for clipping */
+	int clip_y_origin;
+	Pixmap clip_mask;	/* bitmap clipping; other calls for rects */
+	int dash_offset;	/* patterned/dashed line information */
+	char dashes;
+} XGCValues;
+
+/*
+ * Graphics context.  The contents of this structure are implementation
+ * dependent.  A GC should be treated as opaque by application code.
+ */
+
+typedef struct _XGC
+#ifdef XLIB_ILLEGAL_ACCESS
+{
+    XExtData *ext_data;	/* hook for extension to hang data */
+    GContext gid;	/* protocol ID for graphics context */
+    /* there is more to this structure, but it is private to Xlib */
+}
+#endif
+*GC;
+
+/*
+ * Visual structure; contains information about colormapping possible.
+ */
+typedef struct {
+	XExtData *ext_data;	/* hook for extension to hang data */
+	VisualID visualid;	/* visual id of this visual */
+#if defined(__cplusplus) || defined(c_plusplus)
+	int c_class;		/* C++ class of screen (monochrome, etc.) */
+#else
+	int class;		/* class of screen (monochrome, etc.) */
+#endif
+	unsigned long red_mask, green_mask, blue_mask;	/* mask values */
+	int bits_per_rgb;	/* log base 2 of distinct color values */
+	int map_entries;	/* color map entries */
+} Visual;
+
+/*
+ * Depth structure; contains information for each possible depth.
+ */
+typedef struct {
+	int depth;		/* this depth (Z) of the depth */
+	int nvisuals;		/* number of Visual types at this depth */
+	Visual *visuals;	/* list of visuals possible at this depth */
+} Depth;
+
+/*
+ * Information about the screen.  The contents of this structure are
+ * implementation dependent.  A Screen should be treated as opaque
+ * by application code.
+ */
+
+struct _XDisplay;		/* Forward declare before use for C++ */
+
+typedef struct {
+	XExtData *ext_data;	/* hook for extension to hang data */
+	struct _XDisplay *display;/* back pointer to display structure */
+	Window root;		/* Root window id. */
+	int width, height;	/* width and height of screen */
+	int mwidth, mheight;	/* width and height of  in millimeters */
+	int ndepths;		/* number of depths possible */
+	Depth *depths;		/* list of allowable depths on the screen */
+	int root_depth;		/* bits per pixel */
+	Visual *root_visual;	/* root visual */
+	GC default_gc;		/* GC for the root root visual */
+	Colormap cmap;		/* default color map */
+	unsigned long white_pixel;
+	unsigned long black_pixel;	/* White and Black pixel values */
+	int max_maps, min_maps;	/* max and min color maps */
+	int backing_store;	/* Never, WhenMapped, Always */
+	Bool save_unders;
+	long root_input_mask;	/* initial root input mask */
+} Screen;
+
+/*
+ * Format structure; describes ZFormat data the screen will understand.
+ */
+typedef struct {
+	XExtData *ext_data;	/* hook for extension to hang data */
+	int depth;		/* depth of this image format */
+	int bits_per_pixel;	/* bits/pixel at this depth */
+	int scanline_pad;	/* scanline must padded to this multiple */
+} ScreenFormat;
+
+/*
+ * Data structure for setting window attributes.
+ */
+typedef struct {
+    Pixmap background_pixmap;	/* background or None or ParentRelative */
+    unsigned long background_pixel;	/* background pixel */
+    Pixmap border_pixmap;	/* border of the window */
+    unsigned long border_pixel;	/* border pixel value */
+    int bit_gravity;		/* one of bit gravity values */
+    int win_gravity;		/* one of the window gravity values */
+    int backing_store;		/* NotUseful, WhenMapped, Always */
+    unsigned long backing_planes;/* planes to be preseved if possible */
+    unsigned long backing_pixel;/* value to use in restoring planes */
+    Bool save_under;		/* should bits under be saved? (popups) */
+    long event_mask;		/* set of events that should be saved */
+    long do_not_propagate_mask;	/* set of events that should not propagate */
+    Bool override_redirect;	/* boolean value for override-redirect */
+    Colormap colormap;		/* color map to be associated with window */
+    Cursor cursor;		/* cursor to be displayed (or None) */
+} XSetWindowAttributes;
+
+typedef struct {
+    int x, y;			/* location of window */
+    int width, height;		/* width and height of window */
+    int border_width;		/* border width of window */
+    int depth;          	/* depth of window */
+    Visual *visual;		/* the associated visual structure */
+    Window root;        	/* root of screen containing window */
+#if defined(__cplusplus) || defined(c_plusplus)
+    int c_class;		/* C++ InputOutput, InputOnly*/
+#else
+    int class;			/* InputOutput, InputOnly*/
+#endif
+    int bit_gravity;		/* one of bit gravity values */
+    int win_gravity;		/* one of the window gravity values */
+    int backing_store;		/* NotUseful, WhenMapped, Always */
+    unsigned long backing_planes;/* planes to be preserved if possible */
+    unsigned long backing_pixel;/* value to be used when restoring planes */
+    Bool save_under;		/* boolean, should bits under be saved? */
+    Colormap colormap;		/* color map to be associated with window */
+    Bool map_installed;		/* boolean, is color map currently installed*/
+    int map_state;		/* IsUnmapped, IsUnviewable, IsViewable */
+    long all_event_masks;	/* set of events all people have interest in*/
+    long your_event_mask;	/* my event mask */
+    long do_not_propagate_mask; /* set of events that should not propagate */
+    Bool override_redirect;	/* boolean value for override-redirect */
+    Screen *screen;		/* back pointer to correct screen */
+} XWindowAttributes;
+
+/*
+ * Data structure for host setting; getting routines.
+ *
+ */
+
+typedef struct {
+	int family;		/* for example FamilyInternet */
+	int length;		/* length of address, in bytes */
+	char *address;		/* pointer to where to find the bytes */
+} XHostAddress;
+
+/*
+ * Data structure for ServerFamilyInterpreted addresses in host routines
+ */
+typedef struct {
+	int typelength;		/* length of type string, in bytes */
+	int valuelength;	/* length of value string, in bytes */
+	char *type;		/* pointer to where to find the type string */
+	char *value;		/* pointer to where to find the address */
+} XServerInterpretedAddress;
+
+/*
+ * Data structure for "image" data, used by image manipulation routines.
+ */
+typedef struct _XImage {
+    int width, height;		/* size of image */
+    int xoffset;		/* number of pixels offset in X direction */
+    int format;			/* XYBitmap, XYPixmap, ZPixmap */
+    char *data;			/* pointer to image data */
+    int byte_order;		/* data byte order, LSBFirst, MSBFirst */
+    int bitmap_unit;		/* quant. of scanline 8, 16, 32 */
+    int bitmap_bit_order;	/* LSBFirst, MSBFirst */
+    int bitmap_pad;		/* 8, 16, 32 either XY or ZPixmap */
+    int depth;			/* depth of image */
+    int bytes_per_line;		/* accelarator to next line */
+    int bits_per_pixel;		/* bits per pixel (ZPixmap) */
+    unsigned long red_mask;	/* bits in z arrangment */
+    unsigned long green_mask;
+    unsigned long blue_mask;
+    XPointer obdata;		/* hook for the object routines to hang on */
+    struct funcs {		/* image manipulation routines */
+	struct _XImage *(*create_image)(
+		struct _XDisplay* /* display */,
+		Visual*		/* visual */,
+		unsigned int	/* depth */,
+		int		/* format */,
+		int		/* offset */,
+		char*		/* data */,
+		unsigned int	/* width */,
+		unsigned int	/* height */,
+		int		/* bitmap_pad */,
+		int		/* bytes_per_line */);
+	int (*destroy_image)        (struct _XImage *);
+	unsigned long (*get_pixel)  (struct _XImage *, int, int);
+	int (*put_pixel)            (struct _XImage *, int, int, unsigned long);
+	struct _XImage *(*sub_image)(struct _XImage *, int, int, unsigned int, unsigned int);
+	int (*add_pixel)            (struct _XImage *, long);
+	} f;
+} XImage;
+
+/*
+ * Data structure for XReconfigureWindow
+ */
+typedef struct {
+    int x, y;
+    int width, height;
+    int border_width;
+    Window sibling;
+    int stack_mode;
+} XWindowChanges;
+
+/*
+ * Data structure used by color operations
+ */
+typedef struct {
+	unsigned long pixel;
+	unsigned short red, green, blue;
+	char flags;  /* do_red, do_green, do_blue */
+	char pad;
+} XColor;
+
+/*
+ * Data structures for graphics operations.  On most machines, these are
+ * congruent with the wire protocol structures, so reformatting the data
+ * can be avoided on these architectures.
+ */
+typedef struct {
+    short x1, y1, x2, y2;
+} XSegment;
+
+typedef struct {
+    short x, y;
+} XPoint;
+
+typedef struct {
+    short x, y;
+    unsigned short width, height;
+} XRectangle;
+
+typedef struct {
+    short x, y;
+    unsigned short width, height;
+    short angle1, angle2;
+} XArc;
+
+
+/* Data structure for XChangeKeyboardControl */
+
+typedef struct {
+        int key_click_percent;
+        int bell_percent;
+        int bell_pitch;
+        int bell_duration;
+        int led;
+        int led_mode;
+        int key;
+        int auto_repeat_mode;   /* On, Off, Default */
+} XKeyboardControl;
+
+/* Data structure for XGetKeyboardControl */
+
+typedef struct {
+        int key_click_percent;
+	int bell_percent;
+	unsigned int bell_pitch, bell_duration;
+	unsigned long led_mask;
+	int global_auto_repeat;
+	char auto_repeats[32];
+} XKeyboardState;
+
+/* Data structure for XGetMotionEvents.  */
+
+typedef struct {
+        Time time;
+	short x, y;
+} XTimeCoord;
+
+/* Data structure for X{Set,Get}ModifierMapping */
+
+typedef struct {
+ 	int max_keypermod;	/* The server's max # of keys per modifier */
+ 	KeyCode *modifiermap;	/* An 8 by max_keypermod array of modifiers */
+} XModifierKeymap;
+
+
+/*
+ * Display datatype maintaining display specific data.
+ * The contents of this structure are implementation dependent.
+ * A Display should be treated as opaque by application code.
+ */
+#ifndef XLIB_ILLEGAL_ACCESS
+typedef struct _XDisplay Display;
+#endif
+
+struct _XPrivate;		/* Forward declare before use for C++ */
+struct _XrmHashBucketRec;
+
+typedef struct
+#ifdef XLIB_ILLEGAL_ACCESS
+_XDisplay
+#endif
+{
+	XExtData *ext_data;	/* hook for extension to hang data */
+	struct _XPrivate *private1;
+	int fd;			/* Network socket. */
+	int private2;
+	int proto_major_version;/* major version of server's X protocol */
+	int proto_minor_version;/* minor version of servers X protocol */
+	char *vendor;		/* vendor of the server hardware */
+        XID private3;
+	XID private4;
+	XID private5;
+	int private6;
+	XID (*resource_alloc)(	/* allocator function */
+		struct _XDisplay*
+	);
+	int byte_order;		/* screen byte order, LSBFirst, MSBFirst */
+	int bitmap_unit;	/* padding and data requirements */
+	int bitmap_pad;		/* padding requirements on bitmaps */
+	int bitmap_bit_order;	/* LeastSignificant or MostSignificant */
+	int nformats;		/* number of pixmap formats in list */
+	ScreenFormat *pixmap_format;	/* pixmap format list */
+	int private8;
+	int release;		/* release of the server */
+	struct _XPrivate *private9, *private10;
+	int qlen;		/* Length of input event queue */
+	unsigned long last_request_read; /* seq number of last event read */
+	unsigned long request;	/* sequence number of last request. */
+	XPointer private11;
+	XPointer private12;
+	XPointer private13;
+	XPointer private14;
+	unsigned max_request_size; /* maximum number 32 bit words in request*/
+	struct _XrmHashBucketRec *db;
+	int (*private15)(
+		struct _XDisplay*
+		);
+	char *display_name;	/* "host:display" string used on this connect*/
+	int default_screen;	/* default screen for operations */
+	int nscreens;		/* number of screens on this server*/
+	Screen *screens;	/* pointer to list of screens */
+	unsigned long motion_buffer;	/* size of motion buffer */
+	unsigned long private16;
+	int min_keycode;	/* minimum defined keycode */
+	int max_keycode;	/* maximum defined keycode */
+	XPointer private17;
+	XPointer private18;
+	int private19;
+	char *xdefaults;	/* contents of defaults from server */
+	/* there is more to this structure, but it is private to Xlib */
+}
+#ifdef XLIB_ILLEGAL_ACCESS
+Display,
+#endif
+*_XPrivDisplay;
+
+#undef _XEVENT_
+#ifndef _XEVENT_
+/*
+ * Definitions of specific events.
+ */
+typedef struct {
+	int type;		/* of event */
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window window;	        /* "event" window it is reported relative to */
+	Window root;	        /* root window that the event occurred on */
+	Window subwindow;	/* child window */
+	Time time;		/* milliseconds */
+	int x, y;		/* pointer x, y coordinates in event window */
+	int x_root, y_root;	/* coordinates relative to root */
+	unsigned int state;	/* key or button mask */
+	unsigned int keycode;	/* detail */
+	Bool same_screen;	/* same screen flag */
+} XKeyEvent;
+typedef XKeyEvent XKeyPressedEvent;
+typedef XKeyEvent XKeyReleasedEvent;
+
+typedef struct {
+	int type;		/* of event */
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window window;	        /* "event" window it is reported relative to */
+	Window root;	        /* root window that the event occurred on */
+	Window subwindow;	/* child window */
+	Time time;		/* milliseconds */
+	int x, y;		/* pointer x, y coordinates in event window */
+	int x_root, y_root;	/* coordinates relative to root */
+	unsigned int state;	/* key or button mask */
+	unsigned int button;	/* detail */
+	Bool same_screen;	/* same screen flag */
+} XButtonEvent;
+typedef XButtonEvent XButtonPressedEvent;
+typedef XButtonEvent XButtonReleasedEvent;
+
+typedef struct {
+	int type;		/* of event */
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window window;	        /* "event" window reported relative to */
+	Window root;	        /* root window that the event occurred on */
+	Window subwindow;	/* child window */
+	Time time;		/* milliseconds */
+	int x, y;		/* pointer x, y coordinates in event window */
+	int x_root, y_root;	/* coordinates relative to root */
+	unsigned int state;	/* key or button mask */
+	char is_hint;		/* detail */
+	Bool same_screen;	/* same screen flag */
+} XMotionEvent;
+typedef XMotionEvent XPointerMovedEvent;
+
+typedef struct {
+	int type;		/* of event */
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window window;	        /* "event" window reported relative to */
+	Window root;	        /* root window that the event occurred on */
+	Window subwindow;	/* child window */
+	Time time;		/* milliseconds */
+	int x, y;		/* pointer x, y coordinates in event window */
+	int x_root, y_root;	/* coordinates relative to root */
+	int mode;		/* NotifyNormal, NotifyGrab, NotifyUngrab */
+	int detail;
+	/*
+	 * NotifyAncestor, NotifyVirtual, NotifyInferior,
+	 * NotifyNonlinear,NotifyNonlinearVirtual
+	 */
+	Bool same_screen;	/* same screen flag */
+	Bool focus;		/* boolean focus */
+	unsigned int state;	/* key or button mask */
+} XCrossingEvent;
+typedef XCrossingEvent XEnterWindowEvent;
+typedef XCrossingEvent XLeaveWindowEvent;
+
+typedef struct {
+	int type;		/* FocusIn or FocusOut */
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window window;		/* window of event */
+	int mode;		/* NotifyNormal, NotifyWhileGrabbed,
+				   NotifyGrab, NotifyUngrab */
+	int detail;
+	/*
+	 * NotifyAncestor, NotifyVirtual, NotifyInferior,
+	 * NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer,
+	 * NotifyPointerRoot, NotifyDetailNone
+	 */
+} XFocusChangeEvent;
+typedef XFocusChangeEvent XFocusInEvent;
+typedef XFocusChangeEvent XFocusOutEvent;
+
+/* generated on EnterWindow and FocusIn  when KeyMapState selected */
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window window;
+	char key_vector[32];
+} XKeymapEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window window;
+	int x, y;
+	int width, height;
+	int count;		/* if non-zero, at least this many more */
+} XExposeEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Drawable drawable;
+	int x, y;
+	int width, height;
+	int count;		/* if non-zero, at least this many more */
+	int major_code;		/* core is CopyArea or CopyPlane */
+	int minor_code;		/* not defined in the core */
+} XGraphicsExposeEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Drawable drawable;
+	int major_code;		/* core is CopyArea or CopyPlane */
+	int minor_code;		/* not defined in the core */
+} XNoExposeEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window window;
+	int state;		/* Visibility state */
+} XVisibilityEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window parent;		/* parent of the window */
+	Window window;		/* window id of window created */
+	int x, y;		/* window location */
+	int width, height;	/* size of window */
+	int border_width;	/* border width */
+	Bool override_redirect;	/* creation should be overridden */
+} XCreateWindowEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window event;
+	Window window;
+} XDestroyWindowEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window event;
+	Window window;
+	Bool from_configure;
+} XUnmapEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window event;
+	Window window;
+	Bool override_redirect;	/* boolean, is override set... */
+} XMapEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window parent;
+	Window window;
+} XMapRequestEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window event;
+	Window window;
+	Window parent;
+	int x, y;
+	Bool override_redirect;
+} XReparentEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window event;
+	Window window;
+	int x, y;
+	int width, height;
+	int border_width;
+	Window above;
+	Bool override_redirect;
+} XConfigureEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window event;
+	Window window;
+	int x, y;
+} XGravityEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window window;
+	int width, height;
+} XResizeRequestEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window parent;
+	Window window;
+	int x, y;
+	int width, height;
+	int border_width;
+	Window above;
+	int detail;		/* Above, Below, TopIf, BottomIf, Opposite */
+	unsigned long value_mask;
+} XConfigureRequestEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window event;
+	Window window;
+	int place;		/* PlaceOnTop, PlaceOnBottom */
+} XCirculateEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window parent;
+	Window window;
+	int place;		/* PlaceOnTop, PlaceOnBottom */
+} XCirculateRequestEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window window;
+	Atom atom;
+	Time time;
+	int state;		/* NewValue, Deleted */
+} XPropertyEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window window;
+	Atom selection;
+	Time time;
+} XSelectionClearEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window owner;
+	Window requestor;
+	Atom selection;
+	Atom target;
+	Atom property;
+	Time time;
+} XSelectionRequestEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window requestor;
+	Atom selection;
+	Atom target;
+	Atom property;		/* ATOM or None */
+	Time time;
+} XSelectionEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window window;
+	Colormap colormap;	/* COLORMAP or None */
+#if defined(__cplusplus) || defined(c_plusplus)
+	Bool c_new;		/* C++ */
+#else
+	Bool new;
+#endif
+	int state;		/* ColormapInstalled, ColormapUninstalled */
+} XColormapEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window window;
+	Atom message_type;
+	int format;
+	union {
+		char b[20];
+		short s[10];
+		long l[5];
+		} data;
+} XClientMessageEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window window;		/* unused */
+	int request;		/* one of MappingModifier, MappingKeyboard,
+				   MappingPointer */
+	int first_keycode;	/* first keycode */
+	int count;		/* defines range of change w. first_keycode*/
+} XMappingEvent;
+
+typedef struct {
+	int type;
+	Display *display;	/* Display the event was read from */
+	XID resourceid;		/* resource id */
+	unsigned long serial;	/* serial number of failed request */
+	unsigned char error_code;	/* error code of failed request */
+	unsigned char request_code;	/* Major op-code of failed request */
+	unsigned char minor_code;	/* Minor op-code of failed request */
+} XErrorEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;/* Display the event was read from */
+	Window window;	/* window on which event was requested in event mask */
+} XAnyEvent;
+
+
+/***************************************************************
+ *
+ * GenericEvent.  This event is the standard event for all newer extensions.
+ */
+
+typedef struct
+    {
+    int            type;         /* of event. Always GenericEvent */
+    unsigned long  serial;       /* # of last request processed */
+    Bool           send_event;   /* true if from SendEvent request */
+    Display        *display;     /* Display the event was read from */
+    int            extension;    /* major opcode of extension that caused the event */
+    int            evtype;       /* actual event type. */
+    } XGenericEvent;
+
+typedef struct {
+    int            type;         /* of event. Always GenericEvent */
+    unsigned long  serial;       /* # of last request processed */
+    Bool           send_event;   /* true if from SendEvent request */
+    Display        *display;     /* Display the event was read from */
+    int            extension;    /* major opcode of extension that caused the event */
+    int            evtype;       /* actual event type. */
+    unsigned int   cookie;
+    void           *data;
+} XGenericEventCookie;
+
+/*
+ * this union is defined so Xlib can always use the same sized
+ * event structure internally, to avoid memory fragmentation.
+ */
+typedef union _XEvent {
+        int type;		/* must not be changed; first element */
+	XAnyEvent xany;
+	XKeyEvent xkey;
+	XButtonEvent xbutton;
+	XMotionEvent xmotion;
+	XCrossingEvent xcrossing;
+	XFocusChangeEvent xfocus;
+	XExposeEvent xexpose;
+	XGraphicsExposeEvent xgraphicsexpose;
+	XNoExposeEvent xnoexpose;
+	XVisibilityEvent xvisibility;
+	XCreateWindowEvent xcreatewindow;
+	XDestroyWindowEvent xdestroywindow;
+	XUnmapEvent xunmap;
+	XMapEvent xmap;
+	XMapRequestEvent xmaprequest;
+	XReparentEvent xreparent;
+	XConfigureEvent xconfigure;
+	XGravityEvent xgravity;
+	XResizeRequestEvent xresizerequest;
+	XConfigureRequestEvent xconfigurerequest;
+	XCirculateEvent xcirculate;
+	XCirculateRequestEvent xcirculaterequest;
+	XPropertyEvent xproperty;
+	XSelectionClearEvent xselectionclear;
+	XSelectionRequestEvent xselectionrequest;
+	XSelectionEvent xselection;
+	XColormapEvent xcolormap;
+	XClientMessageEvent xclient;
+	XMappingEvent xmapping;
+	XErrorEvent xerror;
+	XKeymapEvent xkeymap;
+	XGenericEvent xgeneric;
+	XGenericEventCookie xcookie;
+	long pad[24];
+} XEvent;
+#endif
+
+#define XAllocID(dpy) ((*((_XPrivDisplay)(dpy))->resource_alloc)((dpy)))
+
+/*
+ * per character font metric information.
+ */
+typedef struct {
+    short	lbearing;	/* origin to left edge of raster */
+    short	rbearing;	/* origin to right edge of raster */
+    short	width;		/* advance to next char's origin */
+    short	ascent;		/* baseline to top edge of raster */
+    short	descent;	/* baseline to bottom edge of raster */
+    unsigned short attributes;	/* per char flags (not predefined) */
+} XCharStruct;
+
+/*
+ * To allow arbitrary information with fonts, there are additional properties
+ * returned.
+ */
+typedef struct {
+    Atom name;
+    unsigned long card32;
+} XFontProp;
+
+typedef struct {
+    XExtData	*ext_data;	/* hook for extension to hang data */
+    Font        fid;            /* Font id for this font */
+    unsigned	direction;	/* hint about direction the font is painted */
+    unsigned	min_char_or_byte2;/* first character */
+    unsigned	max_char_or_byte2;/* last character */
+    unsigned	min_byte1;	/* first row that exists */
+    unsigned	max_byte1;	/* last row that exists */
+    Bool	all_chars_exist;/* flag if all characters have non-zero size*/
+    unsigned	default_char;	/* char to print for undefined character */
+    int         n_properties;   /* how many properties there are */
+    XFontProp	*properties;	/* pointer to array of additional properties*/
+    XCharStruct	min_bounds;	/* minimum bounds over all existing char*/
+    XCharStruct	max_bounds;	/* maximum bounds over all existing char*/
+    XCharStruct	*per_char;	/* first_char to last_char information */
+    int		ascent;		/* log. extent above baseline for spacing */
+    int		descent;	/* log. descent below baseline for spacing */
+} XFontStruct;
+
+/*
+ * PolyText routines take these as arguments.
+ */
+typedef struct {
+    char *chars;		/* pointer to string */
+    int nchars;			/* number of characters */
+    int delta;			/* delta between strings */
+    Font font;			/* font to print it in, None don't change */
+} XTextItem;
+
+typedef struct {		/* normal 16 bit characters are two bytes */
+    unsigned char byte1;
+    unsigned char byte2;
+} XChar2b;
+
+typedef struct {
+    XChar2b *chars;		/* two byte characters */
+    int nchars;			/* number of characters */
+    int delta;			/* delta between strings */
+    Font font;			/* font to print it in, None don't change */
+} XTextItem16;
+
+
+typedef union { Display *display;
+		GC gc;
+		Visual *visual;
+		Screen *screen;
+		ScreenFormat *pixmap_format;
+		XFontStruct *font; } XEDataObject;
+
+typedef struct {
+    XRectangle      max_ink_extent;
+    XRectangle      max_logical_extent;
+} XFontSetExtents;
+
+/* unused:
+typedef void (*XOMProc)();
+ */
+
+typedef struct _XOM *XOM;
+typedef struct _XOC *XOC, *XFontSet;
+
+typedef struct {
+    char           *chars;
+    int             nchars;
+    int             delta;
+    XFontSet        font_set;
+} XmbTextItem;
+
+typedef struct {
+    wchar_t        *chars;
+    int             nchars;
+    int             delta;
+    XFontSet        font_set;
+} XwcTextItem;
+
+#define XNRequiredCharSet "requiredCharSet"
+#define XNQueryOrientation "queryOrientation"
+#define XNBaseFontName "baseFontName"
+#define XNOMAutomatic "omAutomatic"
+#define XNMissingCharSet "missingCharSet"
+#define XNDefaultString "defaultString"
+#define XNOrientation "orientation"
+#define XNDirectionalDependentDrawing "directionalDependentDrawing"
+#define XNContextualDrawing "contextualDrawing"
+#define XNFontInfo "fontInfo"
+
+typedef struct {
+    int charset_count;
+    char **charset_list;
+} XOMCharSetList;
+
+typedef enum {
+    XOMOrientation_LTR_TTB,
+    XOMOrientation_RTL_TTB,
+    XOMOrientation_TTB_LTR,
+    XOMOrientation_TTB_RTL,
+    XOMOrientation_Context
+} XOrientation;
+
+typedef struct {
+    int num_orientation;
+    XOrientation *orientation;	/* Input Text description */
+} XOMOrientation;
+
+typedef struct {
+    int num_font;
+    XFontStruct **font_struct_list;
+    char **font_name_list;
+} XOMFontInfo;
+
+typedef struct _XIM *XIM;
+typedef struct _XIC *XIC;
+
+typedef void (*XIMProc)(
+    XIM,
+    XPointer,
+    XPointer
+);
+
+typedef Bool (*XICProc)(
+    XIC,
+    XPointer,
+    XPointer
+);
+
+typedef void (*XIDProc)(
+    Display*,
+    XPointer,
+    XPointer
+);
+
+typedef unsigned long XIMStyle;
+
+typedef struct {
+    unsigned short count_styles;
+    XIMStyle *supported_styles;
+} XIMStyles;
+
+#define XIMPreeditArea		0x0001L
+#define XIMPreeditCallbacks	0x0002L
+#define XIMPreeditPosition	0x0004L
+#define XIMPreeditNothing	0x0008L
+#define XIMPreeditNone		0x0010L
+#define XIMStatusArea		0x0100L
+#define XIMStatusCallbacks	0x0200L
+#define XIMStatusNothing	0x0400L
+#define XIMStatusNone		0x0800L
+
+#define XNVaNestedList "XNVaNestedList"
+#define XNQueryInputStyle "queryInputStyle"
+#define XNClientWindow "clientWindow"
+#define XNInputStyle "inputStyle"
+#define XNFocusWindow "focusWindow"
+#define XNResourceName "resourceName"
+#define XNResourceClass "resourceClass"
+#define XNGeometryCallback "geometryCallback"
+#define XNDestroyCallback "destroyCallback"
+#define XNFilterEvents "filterEvents"
+#define XNPreeditStartCallback "preeditStartCallback"
+#define XNPreeditDoneCallback "preeditDoneCallback"
+#define XNPreeditDrawCallback "preeditDrawCallback"
+#define XNPreeditCaretCallback "preeditCaretCallback"
+#define XNPreeditStateNotifyCallback "preeditStateNotifyCallback"
+#define XNPreeditAttributes "preeditAttributes"
+#define XNStatusStartCallback "statusStartCallback"
+#define XNStatusDoneCallback "statusDoneCallback"
+#define XNStatusDrawCallback "statusDrawCallback"
+#define XNStatusAttributes "statusAttributes"
+#define XNArea "area"
+#define XNAreaNeeded "areaNeeded"
+#define XNSpotLocation "spotLocation"
+#define XNColormap "colorMap"
+#define XNStdColormap "stdColorMap"
+#define XNForeground "foreground"
+#define XNBackground "background"
+#define XNBackgroundPixmap "backgroundPixmap"
+#define XNFontSet "fontSet"
+#define XNLineSpace "lineSpace"
+#define XNCursor "cursor"
+
+#define XNQueryIMValuesList "queryIMValuesList"
+#define XNQueryICValuesList "queryICValuesList"
+#define XNVisiblePosition "visiblePosition"
+#define XNR6PreeditCallback "r6PreeditCallback"
+#define XNStringConversionCallback "stringConversionCallback"
+#define XNStringConversion "stringConversion"
+#define XNResetState "resetState"
+#define XNHotKey "hotKey"
+#define XNHotKeyState "hotKeyState"
+#define XNPreeditState "preeditState"
+#define XNSeparatorofNestedList "separatorofNestedList"
+
+#define XBufferOverflow		-1
+#define XLookupNone		1
+#define XLookupChars		2
+#define XLookupKeySym		3
+#define XLookupBoth		4
+
+typedef void *XVaNestedList;
+
+typedef struct {
+    XPointer client_data;
+    XIMProc callback;
+} XIMCallback;
+
+typedef struct {
+    XPointer client_data;
+    XICProc callback;
+} XICCallback;
+
+typedef unsigned long XIMFeedback;
+
+#define XIMReverse		1L
+#define XIMUnderline		(1L<<1)
+#define XIMHighlight		(1L<<2)
+#define XIMPrimary	 	(1L<<5)
+#define XIMSecondary		(1L<<6)
+#define XIMTertiary	 	(1L<<7)
+#define XIMVisibleToForward 	(1L<<8)
+#define XIMVisibleToBackword 	(1L<<9)
+#define XIMVisibleToCenter 	(1L<<10)
+
+typedef struct _XIMText {
+    unsigned short length;
+    XIMFeedback *feedback;
+    Bool encoding_is_wchar;
+    union {
+	char *multi_byte;
+	wchar_t *wide_char;
+    } string;
+} XIMText;
+
+typedef	unsigned long	 XIMPreeditState;
+
+#define	XIMPreeditUnKnown	0L
+#define	XIMPreeditEnable	1L
+#define	XIMPreeditDisable	(1L<<1)
+
+typedef	struct	_XIMPreeditStateNotifyCallbackStruct {
+    XIMPreeditState state;
+} XIMPreeditStateNotifyCallbackStruct;
+
+typedef	unsigned long	 XIMResetState;
+
+#define	XIMInitialState		1L
+#define	XIMPreserveState	(1L<<1)
+
+typedef unsigned long XIMStringConversionFeedback;
+
+#define	XIMStringConversionLeftEdge	(0x00000001)
+#define	XIMStringConversionRightEdge	(0x00000002)
+#define	XIMStringConversionTopEdge	(0x00000004)
+#define	XIMStringConversionBottomEdge	(0x00000008)
+#define	XIMStringConversionConcealed	(0x00000010)
+#define	XIMStringConversionWrapped	(0x00000020)
+
+typedef struct _XIMStringConversionText {
+    unsigned short length;
+    XIMStringConversionFeedback *feedback;
+    Bool encoding_is_wchar;
+    union {
+	char *mbs;
+	wchar_t *wcs;
+    } string;
+} XIMStringConversionText;
+
+typedef	unsigned short	XIMStringConversionPosition;
+
+typedef	unsigned short	XIMStringConversionType;
+
+#define	XIMStringConversionBuffer	(0x0001)
+#define	XIMStringConversionLine		(0x0002)
+#define	XIMStringConversionWord		(0x0003)
+#define	XIMStringConversionChar		(0x0004)
+
+typedef	unsigned short	XIMStringConversionOperation;
+
+#define	XIMStringConversionSubstitution	(0x0001)
+#define	XIMStringConversionRetrieval	(0x0002)
+
+typedef enum {
+    XIMForwardChar, XIMBackwardChar,
+    XIMForwardWord, XIMBackwardWord,
+    XIMCaretUp, XIMCaretDown,
+    XIMNextLine, XIMPreviousLine,
+    XIMLineStart, XIMLineEnd,
+    XIMAbsolutePosition,
+    XIMDontChange
+} XIMCaretDirection;
+
+typedef struct _XIMStringConversionCallbackStruct {
+    XIMStringConversionPosition position;
+    XIMCaretDirection direction;
+    XIMStringConversionOperation operation;
+    unsigned short factor;
+    XIMStringConversionText *text;
+} XIMStringConversionCallbackStruct;
+
+typedef struct _XIMPreeditDrawCallbackStruct {
+    int caret;		/* Cursor offset within pre-edit string */
+    int chg_first;	/* Starting change position */
+    int chg_length;	/* Length of the change in character count */
+    XIMText *text;
+} XIMPreeditDrawCallbackStruct;
+
+typedef enum {
+    XIMIsInvisible,	/* Disable caret feedback */
+    XIMIsPrimary,	/* UI defined caret feedback */
+    XIMIsSecondary	/* UI defined caret feedback */
+} XIMCaretStyle;
+
+typedef struct _XIMPreeditCaretCallbackStruct {
+    int position;		 /* Caret offset within pre-edit string */
+    XIMCaretDirection direction; /* Caret moves direction */
+    XIMCaretStyle style;	 /* Feedback of the caret */
+} XIMPreeditCaretCallbackStruct;
+
+typedef enum {
+    XIMTextType,
+    XIMBitmapType
+} XIMStatusDataType;
+
+typedef struct _XIMStatusDrawCallbackStruct {
+    XIMStatusDataType type;
+    union {
+	XIMText *text;
+	Pixmap  bitmap;
+    } data;
+} XIMStatusDrawCallbackStruct;
+
+typedef struct _XIMHotKeyTrigger {
+    KeySym	 keysym;
+    int		 modifier;
+    int		 modifier_mask;
+} XIMHotKeyTrigger;
+
+typedef struct _XIMHotKeyTriggers {
+    int			 num_hot_key;
+    XIMHotKeyTrigger	*key;
+} XIMHotKeyTriggers;
+
+typedef	unsigned long	 XIMHotKeyState;
+
+#define	XIMHotKeyStateON	(0x0001L)
+#define	XIMHotKeyStateOFF	(0x0002L)
+
+typedef struct {
+    unsigned short count_values;
+    char **supported_values;
+} XIMValuesList;
+
+_XFUNCPROTOBEGIN
+
+#if defined(WIN32) && !defined(_XLIBINT_)
+#define _Xdebug (*_Xdebug_p)
+#endif
+
+extern int _Xdebug;
+
+extern XFontStruct *XLoadQueryFont(
+    Display*		/* display */,
+    _Xconst char*	/* name */
+);
+
+extern XFontStruct *XQueryFont(
+    Display*		/* display */,
+    XID			/* font_ID */
+);
+
+
+extern XTimeCoord *XGetMotionEvents(
+    Display*		/* display */,
+    Window		/* w */,
+    Time		/* start */,
+    Time		/* stop */,
+    int*		/* nevents_return */
+);
+
+extern XModifierKeymap *XDeleteModifiermapEntry(
+    XModifierKeymap*	/* modmap */,
+#if NeedWidePrototypes
+    unsigned int	/* keycode_entry */,
+#else
+    KeyCode		/* keycode_entry */,
+#endif
+    int			/* modifier */
+);
+
+extern XModifierKeymap	*XGetModifierMapping(
+    Display*		/* display */
+);
+
+extern XModifierKeymap	*XInsertModifiermapEntry(
+    XModifierKeymap*	/* modmap */,
+#if NeedWidePrototypes
+    unsigned int	/* keycode_entry */,
+#else
+    KeyCode		/* keycode_entry */,
+#endif
+    int			/* modifier */
+);
+
+extern XModifierKeymap *XNewModifiermap(
+    int			/* max_keys_per_mod */
+);
+
+extern XImage *XCreateImage(
+    Display*		/* display */,
+    Visual*		/* visual */,
+    unsigned int	/* depth */,
+    int			/* format */,
+    int			/* offset */,
+    char*		/* data */,
+    unsigned int	/* width */,
+    unsigned int	/* height */,
+    int			/* bitmap_pad */,
+    int			/* bytes_per_line */
+);
+extern Status XInitImage(
+    XImage*		/* image */
+);
+extern XImage *XGetImage(
+    Display*		/* display */,
+    Drawable		/* d */,
+    int			/* x */,
+    int			/* y */,
+    unsigned int	/* width */,
+    unsigned int	/* height */,
+    unsigned long	/* plane_mask */,
+    int			/* format */
+);
+extern XImage *XGetSubImage(
+    Display*		/* display */,
+    Drawable		/* d */,
+    int			/* x */,
+    int			/* y */,
+    unsigned int	/* width */,
+    unsigned int	/* height */,
+    unsigned long	/* plane_mask */,
+    int			/* format */,
+    XImage*		/* dest_image */,
+    int			/* dest_x */,
+    int			/* dest_y */
+);
+
+/*
+ * X function declarations.
+ */
+extern Display *XOpenDisplay(
+    _Xconst char*	/* display_name */
+);
+
+extern void XrmInitialize(
+    void
+);
+
+extern char *XFetchBytes(
+    Display*		/* display */,
+    int*		/* nbytes_return */
+);
+extern char *XFetchBuffer(
+    Display*		/* display */,
+    int*		/* nbytes_return */,
+    int			/* buffer */
+);
+extern char *XGetAtomName(
+    Display*		/* display */,
+    Atom		/* atom */
+);
+extern Status XGetAtomNames(
+    Display*		/* dpy */,
+    Atom*		/* atoms */,
+    int			/* count */,
+    char**		/* names_return */
+);
+extern char *XGetDefault(
+    Display*		/* display */,
+    _Xconst char*	/* program */,
+    _Xconst char*	/* option */
+);
+extern char *XDisplayName(
+    _Xconst char*	/* string */
+);
+extern char *XKeysymToString(
+    KeySym		/* keysym */
+);
+
+extern int (*XSynchronize(
+    Display*		/* display */,
+    Bool		/* onoff */
+))(
+    Display*		/* display */
+);
+extern int (*XSetAfterFunction(
+    Display*		/* display */,
+    int (*) (
+	     Display*	/* display */
+            )		/* procedure */
+))(
+    Display*		/* display */
+);
+extern Atom XInternAtom(
+    Display*		/* display */,
+    _Xconst char*	/* atom_name */,
+    Bool		/* only_if_exists */
+);
+extern Status XInternAtoms(
+    Display*		/* dpy */,
+    char**		/* names */,
+    int			/* count */,
+    Bool		/* onlyIfExists */,
+    Atom*		/* atoms_return */
+);
+extern Colormap XCopyColormapAndFree(
+    Display*		/* display */,
+    Colormap		/* colormap */
+);
+extern Colormap XCreateColormap(
+    Display*		/* display */,
+    Window		/* w */,
+    Visual*		/* visual */,
+    int			/* alloc */
+);
+extern Cursor XCreatePixmapCursor(
+    Display*		/* display */,
+    Pixmap		/* source */,
+    Pixmap		/* mask */,
+    XColor*		/* foreground_color */,
+    XColor*		/* background_color */,
+    unsigned int	/* x */,
+    unsigned int	/* y */
+);
+extern Cursor XCreateGlyphCursor(
+    Display*		/* display */,
+    Font		/* source_font */,
+    Font		/* mask_font */,
+    unsigned int	/* source_char */,
+    unsigned int	/* mask_char */,
+    XColor _Xconst *	/* foreground_color */,
+    XColor _Xconst *	/* background_color */
+);
+extern Cursor XCreateFontCursor(
+    Display*		/* display */,
+    unsigned int	/* shape */
+);
+extern Font XLoadFont(
+    Display*		/* display */,
+    _Xconst char*	/* name */
+);
+extern GC XCreateGC(
+    Display*		/* display */,
+    Drawable		/* d */,
+    unsigned long	/* valuemask */,
+    XGCValues*		/* values */
+);
+extern GContext XGContextFromGC(
+    GC			/* gc */
+);
+extern void XFlushGC(
+    Display*		/* display */,
+    GC			/* gc */
+);
+extern Pixmap XCreatePixmap(
+    Display*		/* display */,
+    Drawable		/* d */,
+    unsigned int	/* width */,
+    unsigned int	/* height */,
+    unsigned int	/* depth */
+);
+extern Pixmap XCreateBitmapFromData(
+    Display*		/* display */,
+    Drawable		/* d */,
+    _Xconst char*	/* data */,
+    unsigned int	/* width */,
+    unsigned int	/* height */
+);
+extern Pixmap XCreatePixmapFromBitmapData(
+    Display*		/* display */,
+    Drawable		/* d */,
+    char*		/* data */,
+    unsigned int	/* width */,
+    unsigned int	/* height */,
+    unsigned long	/* fg */,
+    unsigned long	/* bg */,
+    unsigned int	/* depth */
+);
+extern Window XCreateSimpleWindow(
+    Display*		/* display */,
+    Window		/* parent */,
+    int			/* x */,
+    int			/* y */,
+    unsigned int	/* width */,
+    unsigned int	/* height */,
+    unsigned int	/* border_width */,
+    unsigned long	/* border */,
+    unsigned long	/* background */
+);
+extern Window XGetSelectionOwner(
+    Display*		/* display */,
+    Atom		/* selection */
+);
+extern Window XCreateWindow(
+    Display*		/* display */,
+    Window		/* parent */,
+    int			/* x */,
+    int			/* y */,
+    unsigned int	/* width */,
+    unsigned int	/* height */,
+    unsigned int	/* border_width */,
+    int			/* depth */,
+    unsigned int	/* class */,
+    Visual*		/* visual */,
+    unsigned long	/* valuemask */,
+    XSetWindowAttributes*	/* attributes */
+);
+extern Colormap *XListInstalledColormaps(
+    Display*		/* display */,
+    Window		/* w */,
+    int*		/* num_return */
+);
+extern char **XListFonts(
+    Display*		/* display */,
+    _Xconst char*	/* pattern */,
+    int			/* maxnames */,
+    int*		/* actual_count_return */
+);
+extern char **XListFontsWithInfo(
+    Display*		/* display */,
+    _Xconst char*	/* pattern */,
+    int			/* maxnames */,
+    int*		/* count_return */,
+    XFontStruct**	/* info_return */
+);
+extern char **XGetFontPath(
+    Display*		/* display */,
+    int*		/* npaths_return */
+);
+extern char **XListExtensions(
+    Display*		/* display */,
+    int*		/* nextensions_return */
+);
+extern Atom *XListProperties(
+    Display*		/* display */,
+    Window		/* w */,
+    int*		/* num_prop_return */
+);
+extern XHostAddress *XListHosts(
+    Display*		/* display */,
+    int*		/* nhosts_return */,
+    Bool*		/* state_return */
+);
+_X_DEPRECATED
+extern KeySym XKeycodeToKeysym(
+    Display*		/* display */,
+#if NeedWidePrototypes
+    unsigned int	/* keycode */,
+#else
+    KeyCode		/* keycode */,
+#endif
+    int			/* index */
+);
+extern KeySym XLookupKeysym(
+    XKeyEvent*		/* key_event */,
+    int			/* index */
+);
+extern KeySym *XGetKeyboardMapping(
+    Display*		/* display */,
+#if NeedWidePrototypes
+    unsigned int	/* first_keycode */,
+#else
+    KeyCode		/* first_keycode */,
+#endif
+    int			/* keycode_count */,
+    int*		/* keysyms_per_keycode_return */
+);
+extern KeySym XStringToKeysym(
+    _Xconst char*	/* string */
+);
+extern long XMaxRequestSize(
+    Display*		/* display */
+);
+extern long XExtendedMaxRequestSize(
+    Display*		/* display */
+);
+extern char *XResourceManagerString(
+    Display*		/* display */
+);
+extern char *XScreenResourceString(
+	Screen*		/* screen */
+);
+extern unsigned long XDisplayMotionBufferSize(
+    Display*		/* display */
+);
+extern VisualID XVisualIDFromVisual(
+    Visual*		/* visual */
+);
+
+/* multithread routines */
+
+extern Status XInitThreads(
+    void
+);
+
+extern void XLockDisplay(
+    Display*		/* display */
+);
+
+extern void XUnlockDisplay(
+    Display*		/* display */
+);
+
+/* routines for dealing with extensions */
+
+extern XExtCodes *XInitExtension(
+    Display*		/* display */,
+    _Xconst char*	/* name */
+);
+
+extern XExtCodes *XAddExtension(
+    Display*		/* display */
+);
+extern XExtData *XFindOnExtensionList(
+    XExtData**		/* structure */,
+    int			/* number */
+);
+extern XExtData **XEHeadOfExtensionList(
+    XEDataObject	/* object */
+);
+
+/* these are routines for which there are also macros */
+extern Window XRootWindow(
+    Display*		/* display */,
+    int			/* screen_number */
+);
+extern Window XDefaultRootWindow(
+    Display*		/* display */
+);
+extern Window XRootWindowOfScreen(
+    Screen*		/* screen */
+);
+extern Visual *XDefaultVisual(
+    Display*		/* display */,
+    int			/* screen_number */
+);
+extern Visual *XDefaultVisualOfScreen(
+    Screen*		/* screen */
+);
+extern GC XDefaultGC(
+    Display*		/* display */,
+    int			/* screen_number */
+);
+extern GC XDefaultGCOfScreen(
+    Screen*		/* screen */
+);
+extern unsigned long XBlackPixel(
+    Display*		/* display */,
+    int			/* screen_number */
+);
+extern unsigned long XWhitePixel(
+    Display*		/* display */,
+    int			/* screen_number */
+);
+extern unsigned long XAllPlanes(
+    void
+);
+extern unsigned long XBlackPixelOfScreen(
+    Screen*		/* screen */
+);
+extern unsigned long XWhitePixelOfScreen(
+    Screen*		/* screen */
+);
+extern unsigned long XNextRequest(
+    Display*		/* display */
+);
+extern unsigned long XLastKnownRequestProcessed(
+    Display*		/* display */
+);
+extern char *XServerVendor(
+    Display*		/* display */
+);
+extern char *XDisplayString(
+    Display*		/* display */
+);
+extern Colormap XDefaultColormap(
+    Display*		/* display */,
+    int			/* screen_number */
+);
+extern Colormap XDefaultColormapOfScreen(
+    Screen*		/* screen */
+);
+extern Display *XDisplayOfScreen(
+    Screen*		/* screen */
+);
+extern Screen *XScreenOfDisplay(
+    Display*		/* display */,
+    int			/* screen_number */
+);
+extern Screen *XDefaultScreenOfDisplay(
+    Display*		/* display */
+);
+extern long XEventMaskOfScreen(
+    Screen*		/* screen */
+);
+
+extern int XScreenNumberOfScreen(
+    Screen*		/* screen */
+);
+
+typedef int (*XErrorHandler) (	    /* WARNING, this type not in Xlib spec */
+    Display*		/* display */,
+    XErrorEvent*	/* error_event */
+);
+
+extern XErrorHandler XSetErrorHandler (
+    XErrorHandler	/* handler */
+);
+
+
+typedef int (*XIOErrorHandler) (    /* WARNING, this type not in Xlib spec */
+    Display*		/* display */
+);
+
+extern XIOErrorHandler XSetIOErrorHandler (
+    XIOErrorHandler	/* handler */
+);
+
+
+extern XPixmapFormatValues *XListPixmapFormats(
+    Display*		/* display */,
+    int*		/* count_return */
+);
+extern int *XListDepths(
+    Display*		/* display */,
+    int			/* screen_number */,
+    int*		/* count_return */
+);
+
+/* ICCCM routines for things that don't require special include files; */
+/* other declarations are given in Xutil.h                             */
+extern Status XReconfigureWMWindow(
+    Display*		/* display */,
+    Window		/* w */,
+    int			/* screen_number */,
+    unsigned int	/* mask */,
+    XWindowChanges*	/* changes */
+);
+
+extern Status XGetWMProtocols(
+    Display*		/* display */,
+    Window		/* w */,
+    Atom**		/* protocols_return */,
+    int*		/* count_return */
+);
+extern Status XSetWMProtocols(
+    Display*		/* display */,
+    Window		/* w */,
+    Atom*		/* protocols */,
+    int			/* count */
+);
+extern Status XIconifyWindow(
+    Display*		/* display */,
+    Window		/* w */,
+    int			/* screen_number */
+);
+extern Status XWithdrawWindow(
+    Display*		/* display */,
+    Window		/* w */,
+    int			/* screen_number */
+);
+extern Status XGetCommand(
+    Display*		/* display */,
+    Window		/* w */,
+    char***		/* argv_return */,
+    int*		/* argc_return */
+);
+extern Status XGetWMColormapWindows(
+    Display*		/* display */,
+    Window		/* w */,
+    Window**		/* windows_return */,
+    int*		/* count_return */
+);
+extern Status XSetWMColormapWindows(
+    Display*		/* display */,
+    Window		/* w */,
+    Window*		/* colormap_windows */,
+    int			/* count */
+);
+extern void XFreeStringList(
+    char**		/* list */
+);
+extern int XSetTransientForHint(
+    Display*		/* display */,
+    Window		/* w */,
+    Window		/* prop_window */
+);
+
+/* The following are given in alphabetical order */
+
+extern int XActivateScreenSaver(
+    Display*		/* display */
+);
+
+extern int XAddHost(
+    Display*		/* display */,
+    XHostAddress*	/* host */
+);
+
+extern int XAddHosts(
+    Display*		/* display */,
+    XHostAddress*	/* hosts */,
+    int			/* num_hosts */
+);
+
+extern int XAddToExtensionList(
+    struct _XExtData**	/* structure */,
+    XExtData*		/* ext_data */
+);
+
+extern int XAddToSaveSet(
+    Display*		/* display */,
+    Window		/* w */
+);
+
+extern Status XAllocColor(
+    Display*		/* display */,
+    Colormap		/* colormap */,
+    XColor*		/* screen_in_out */
+);
+
+extern Status XAllocColorCells(
+    Display*		/* display */,
+    Colormap		/* colormap */,
+    Bool	        /* contig */,
+    unsigned long*	/* plane_masks_return */,
+    unsigned int	/* nplanes */,
+    unsigned long*	/* pixels_return */,
+    unsigned int 	/* npixels */
+);
+
+extern Status XAllocColorPlanes(
+    Display*		/* display */,
+    Colormap		/* colormap */,
+    Bool		/* contig */,
+    unsigned long*	/* pixels_return */,
+    int			/* ncolors */,
+    int			/* nreds */,
+    int			/* ngreens */,
+    int			/* nblues */,
+    unsigned long*	/* rmask_return */,
+    unsigned long*	/* gmask_return */,
+    unsigned long*	/* bmask_return */
+);
+
+extern Status XAllocNamedColor(
+    Display*		/* display */,
+    Colormap		/* colormap */,
+    _Xconst char*	/* color_name */,
+    XColor*		/* screen_def_return */,
+    XColor*		/* exact_def_return */
+);
+
+extern int XAllowEvents(
+    Display*		/* display */,
+    int			/* event_mode */,
+    Time		/* time */
+);
+
+extern int XAutoRepeatOff(
+    Display*		/* display */
+);
+
+extern int XAutoRepeatOn(
+    Display*		/* display */
+);
+
+extern int XBell(
+    Display*		/* display */,
+    int			/* percent */
+);
+
+extern int XBitmapBitOrder(
+    Display*		/* display */
+);
+
+extern int XBitmapPad(
+    Display*		/* display */
+);
+
+extern int XBitmapUnit(
+    Display*		/* display */
+);
+
+extern int XCellsOfScreen(
+    Screen*		/* screen */
+);
+
+extern int XChangeActivePointerGrab(
+    Display*		/* display */,
+    unsigned int	/* event_mask */,
+    Cursor		/* cursor */,
+    Time		/* time */
+);
+
+extern int XChangeGC(
+    Display*		/* display */,
+    GC			/* gc */,
+    unsigned long	/* valuemask */,
+    XGCValues*		/* values */
+);
+
+extern int XChangeKeyboardControl(
+    Display*		/* display */,
+    unsigned long	/* value_mask */,
+    XKeyboardControl*	/* values */
+);
+
+extern int XChangeKeyboardMapping(
+    Display*		/* display */,
+    int			/* first_keycode */,
+    int			/* keysyms_per_keycode */,
+    KeySym*		/* keysyms */,
+    int			/* num_codes */
+);
+
+extern int XChangePointerControl(
+    Display*		/* display */,
+    Bool		/* do_accel */,
+    Bool		/* do_threshold */,
+    int			/* accel_numerator */,
+    int			/* accel_denominator */,
+    int			/* threshold */
+);
+
+extern int XChangeProperty(
+    Display*		/* display */,
+    Window		/* w */,
+    Atom		/* property */,
+    Atom		/* type */,
+    int			/* format */,
+    int			/* mode */,
+    _Xconst unsigned char*	/* data */,
+    int			/* nelements */
+);
+
+extern int XChangeSaveSet(
+    Display*		/* display */,
+    Window		/* w */,
+    int			/* change_mode */
+);
+
+extern int XChangeWindowAttributes(
+    Display*		/* display */,
+    Window		/* w */,
+    unsigned long	/* valuemask */,
+    XSetWindowAttributes* /* attributes */
+);
+
+extern Bool XCheckIfEvent(
+    Display*		/* display */,
+    XEvent*		/* event_return */,
+    Bool (*) (
+	       Display*			/* display */,
+               XEvent*			/* event */,
+               XPointer			/* arg */
+             )		/* predicate */,
+    XPointer		/* arg */
+);
+
+extern Bool XCheckMaskEvent(
+    Display*		/* display */,
+    long		/* event_mask */,
+    XEvent*		/* event_return */
+);
+
+extern Bool XCheckTypedEvent(
+    Display*		/* display */,
+    int			/* event_type */,
+    XEvent*		/* event_return */
+);
+
+extern Bool XCheckTypedWindowEvent(
+    Display*		/* display */,
+    Window		/* w */,
+    int			/* event_type */,
+    XEvent*		/* event_return */
+);
+
+extern Bool XCheckWindowEvent(
+    Display*		/* display */,
+    Window		/* w */,
+    long		/* event_mask */,
+    XEvent*		/* event_return */
+);
+
+extern int XCirculateSubwindows(
+    Display*		/* display */,
+    Window		/* w */,
+    int			/* direction */
+);
+
+extern int XCirculateSubwindowsDown(
+    Display*		/* display */,
+    Window		/* w */
+);
+
+extern int XCirculateSubwindowsUp(
+    Display*		/* display */,
+    Window		/* w */
+);
+
+extern int XClearArea(
+    Display*		/* display */,
+    Window		/* w */,
+    int			/* x */,
+    int			/* y */,
+    unsigned int	/* width */,
+    unsigned int	/* height */,
+    Bool		/* exposures */
+);
+
+extern int XClearWindow(
+    Display*		/* display */,
+    Window		/* w */
+);
+
+extern int XCloseDisplay(
+    Display*		/* display */
+);
+
+extern int XConfigureWindow(
+    Display*		/* display */,
+    Window		/* w */,
+    unsigned int	/* value_mask */,
+    XWindowChanges*	/* values */
+);
+
+extern int XConnectionNumber(
+    Display*		/* display */
+);
+
+extern int XConvertSelection(
+    Display*		/* display */,
+    Atom		/* selection */,
+    Atom 		/* target */,
+    Atom		/* property */,
+    Window		/* requestor */,
+    Time		/* time */
+);
+
+extern int XCopyArea(
+    Display*		/* display */,
+    Drawable		/* src */,
+    Drawable		/* dest */,
+    GC			/* gc */,
+    int			/* src_x */,
+    int			/* src_y */,
+    unsigned int	/* width */,
+    unsigned int	/* height */,
+    int			/* dest_x */,
+    int			/* dest_y */
+);
+
+extern int XCopyGC(
+    Display*		/* display */,
+    GC			/* src */,
+    unsigned long	/* valuemask */,
+    GC			/* dest */
+);
+
+extern int XCopyPlane(
+    Display*		/* display */,
+    Drawable		/* src */,
+    Drawable		/* dest */,
+    GC			/* gc */,
+    int			/* src_x */,
+    int			/* src_y */,
+    unsigned int	/* width */,
+    unsigned int	/* height */,
+    int			/* dest_x */,
+    int			/* dest_y */,
+    unsigned long	/* plane */
+);
+
+extern int XDefaultDepth(
+    Display*		/* display */,
+    int			/* screen_number */
+);
+
+extern int XDefaultDepthOfScreen(
+    Screen*		/* screen */
+);
+
+extern int XDefaultScreen(
+    Display*		/* display */
+);
+
+extern int XDefineCursor(
+    Display*		/* display */,
+    Window		/* w */,
+    Cursor		/* cursor */
+);
+
+extern int XDeleteProperty(
+    Display*		/* display */,
+    Window		/* w */,
+    Atom		/* property */
+);
+
+extern int XDestroyWindow(
+    Display*		/* display */,
+    Window		/* w */
+);
+
+extern int XDestroySubwindows(
+    Display*		/* display */,
+    Window		/* w */
+);
+
+extern int XDoesBackingStore(
+    Screen*		/* screen */
+);
+
+extern Bool XDoesSaveUnders(
+    Screen*		/* screen */
+);
+
+extern int XDisableAccessControl(
+    Display*		/* display */
+);
+
+
+extern int XDisplayCells(
+    Display*		/* display */,
+    int			/* screen_number */
+);
+
+extern int XDisplayHeight(
+    Display*		/* display */,
+    int			/* screen_number */
+);
+
+extern int XDisplayHeightMM(
+    Display*		/* display */,
+    int			/* screen_number */
+);
+
+extern int XDisplayKeycodes(
+    Display*		/* display */,
+    int*		/* min_keycodes_return */,
+    int*		/* max_keycodes_return */
+);
+
+extern int XDisplayPlanes(
+    Display*		/* display */,
+    int			/* screen_number */
+);
+
+extern int XDisplayWidth(
+    Display*		/* display */,
+    int			/* screen_number */
+);
+
+extern int XDisplayWidthMM(
+    Display*		/* display */,
+    int			/* screen_number */
+);
+
+extern int XDrawArc(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    int			/* x */,
+    int			/* y */,
+    unsigned int	/* width */,
+    unsigned int	/* height */,
+    int			/* angle1 */,
+    int			/* angle2 */
+);
+
+extern int XDrawArcs(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    XArc*		/* arcs */,
+    int			/* narcs */
+);
+
+extern int XDrawImageString(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    int			/* x */,
+    int			/* y */,
+    _Xconst char*	/* string */,
+    int			/* length */
+);
+
+extern int XDrawImageString16(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    int			/* x */,
+    int			/* y */,
+    _Xconst XChar2b*	/* string */,
+    int			/* length */
+);
+
+extern int XDrawLine(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    int			/* x1 */,
+    int			/* y1 */,
+    int			/* x2 */,
+    int			/* y2 */
+);
+
+extern int XDrawLines(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    XPoint*		/* points */,
+    int			/* npoints */,
+    int			/* mode */
+);
+
+extern int XDrawPoint(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    int			/* x */,
+    int			/* y */
+);
+
+extern int XDrawPoints(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    XPoint*		/* points */,
+    int			/* npoints */,
+    int			/* mode */
+);
+
+extern int XDrawRectangle(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    int			/* x */,
+    int			/* y */,
+    unsigned int	/* width */,
+    unsigned int	/* height */
+);
+
+extern int XDrawRectangles(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    XRectangle*		/* rectangles */,
+    int			/* nrectangles */
+);
+
+extern int XDrawSegments(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    XSegment*		/* segments */,
+    int			/* nsegments */
+);
+
+extern int XDrawString(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    int			/* x */,
+    int			/* y */,
+    _Xconst char*	/* string */,
+    int			/* length */
+);
+
+extern int XDrawString16(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    int			/* x */,
+    int			/* y */,
+    _Xconst XChar2b*	/* string */,
+    int			/* length */
+);
+
+extern int XDrawText(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    int			/* x */,
+    int			/* y */,
+    XTextItem*		/* items */,
+    int			/* nitems */
+);
+
+extern int XDrawText16(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    int			/* x */,
+    int			/* y */,
+    XTextItem16*	/* items */,
+    int			/* nitems */
+);
+
+extern int XEnableAccessControl(
+    Display*		/* display */
+);
+
+extern int XEventsQueued(
+    Display*		/* display */,
+    int			/* mode */
+);
+
+extern Status XFetchName(
+    Display*		/* display */,
+    Window		/* w */,
+    char**		/* window_name_return */
+);
+
+extern int XFillArc(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    int			/* x */,
+    int			/* y */,
+    unsigned int	/* width */,
+    unsigned int	/* height */,
+    int			/* angle1 */,
+    int			/* angle2 */
+);
+
+extern int XFillArcs(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    XArc*		/* arcs */,
+    int			/* narcs */
+);
+
+extern int XFillPolygon(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    XPoint*		/* points */,
+    int			/* npoints */,
+    int			/* shape */,
+    int			/* mode */
+);
+
+extern int XFillRectangle(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    int			/* x */,
+    int			/* y */,
+    unsigned int	/* width */,
+    unsigned int	/* height */
+);
+
+extern int XFillRectangles(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    XRectangle*		/* rectangles */,
+    int			/* nrectangles */
+);
+
+extern int XFlush(
+    Display*		/* display */
+);
+
+extern int XForceScreenSaver(
+    Display*		/* display */,
+    int			/* mode */
+);
+
+extern int XFree(
+    void*		/* data */
+);
+
+extern int XFreeColormap(
+    Display*		/* display */,
+    Colormap		/* colormap */
+);
+
+extern int XFreeColors(
+    Display*		/* display */,
+    Colormap		/* colormap */,
+    unsigned long*	/* pixels */,
+    int			/* npixels */,
+    unsigned long	/* planes */
+);
+
+extern int XFreeCursor(
+    Display*		/* display */,
+    Cursor		/* cursor */
+);
+
+extern int XFreeExtensionList(
+    char**		/* list */
+);
+
+extern int XFreeFont(
+    Display*		/* display */,
+    XFontStruct*	/* font_struct */
+);
+
+extern int XFreeFontInfo(
+    char**		/* names */,
+    XFontStruct*	/* free_info */,
+    int			/* actual_count */
+);
+
+extern int XFreeFontNames(
+    char**		/* list */
+);
+
+extern int XFreeFontPath(
+    char**		/* list */
+);
+
+extern int XFreeGC(
+    Display*		/* display */,
+    GC			/* gc */
+);
+
+extern int XFreeModifiermap(
+    XModifierKeymap*	/* modmap */
+);
+
+extern int XFreePixmap(
+    Display*		/* display */,
+    Pixmap		/* pixmap */
+);
+
+extern int XGeometry(
+    Display*		/* display */,
+    int			/* screen */,
+    _Xconst char*	/* position */,
+    _Xconst char*	/* default_position */,
+    unsigned int	/* bwidth */,
+    unsigned int	/* fwidth */,
+    unsigned int	/* fheight */,
+    int			/* xadder */,
+    int			/* yadder */,
+    int*		/* x_return */,
+    int*		/* y_return */,
+    int*		/* width_return */,
+    int*		/* height_return */
+);
+
+extern int XGetErrorDatabaseText(
+    Display*		/* display */,
+    _Xconst char*	/* name */,
+    _Xconst char*	/* message */,
+    _Xconst char*	/* default_string */,
+    char*		/* buffer_return */,
+    int			/* length */
+);
+
+extern int XGetErrorText(
+    Display*		/* display */,
+    int			/* code */,
+    char*		/* buffer_return */,
+    int			/* length */
+);
+
+extern Bool XGetFontProperty(
+    XFontStruct*	/* font_struct */,
+    Atom		/* atom */,
+    unsigned long*	/* value_return */
+);
+
+extern Status XGetGCValues(
+    Display*		/* display */,
+    GC			/* gc */,
+    unsigned long	/* valuemask */,
+    XGCValues*		/* values_return */
+);
+
+extern Status XGetGeometry(
+    Display*		/* display */,
+    Drawable		/* d */,
+    Window*		/* root_return */,
+    int*		/* x_return */,
+    int*		/* y_return */,
+    unsigned int*	/* width_return */,
+    unsigned int*	/* height_return */,
+    unsigned int*	/* border_width_return */,
+    unsigned int*	/* depth_return */
+);
+
+extern Status XGetIconName(
+    Display*		/* display */,
+    Window		/* w */,
+    char**		/* icon_name_return */
+);
+
+extern int XGetInputFocus(
+    Display*		/* display */,
+    Window*		/* focus_return */,
+    int*		/* revert_to_return */
+);
+
+extern int XGetKeyboardControl(
+    Display*		/* display */,
+    XKeyboardState*	/* values_return */
+);
+
+extern int XGetPointerControl(
+    Display*		/* display */,
+    int*		/* accel_numerator_return */,
+    int*		/* accel_denominator_return */,
+    int*		/* threshold_return */
+);
+
+extern int XGetPointerMapping(
+    Display*		/* display */,
+    unsigned char*	/* map_return */,
+    int			/* nmap */
+);
+
+extern int XGetScreenSaver(
+    Display*		/* display */,
+    int*		/* timeout_return */,
+    int*		/* interval_return */,
+    int*		/* prefer_blanking_return */,
+    int*		/* allow_exposures_return */
+);
+
+extern Status XGetTransientForHint(
+    Display*		/* display */,
+    Window		/* w */,
+    Window*		/* prop_window_return */
+);
+
+extern int XGetWindowProperty(
+    Display*		/* display */,
+    Window		/* w */,
+    Atom		/* property */,
+    long		/* long_offset */,
+    long		/* long_length */,
+    Bool		/* delete */,
+    Atom		/* req_type */,
+    Atom*		/* actual_type_return */,
+    int*		/* actual_format_return */,
+    unsigned long*	/* nitems_return */,
+    unsigned long*	/* bytes_after_return */,
+    unsigned char**	/* prop_return */
+);
+
+extern Status XGetWindowAttributes(
+    Display*		/* display */,
+    Window		/* w */,
+    XWindowAttributes*	/* window_attributes_return */
+);
+
+extern int XGrabButton(
+    Display*		/* display */,
+    unsigned int	/* button */,
+    unsigned int	/* modifiers */,
+    Window		/* grab_window */,
+    Bool		/* owner_events */,
+    unsigned int	/* event_mask */,
+    int			/* pointer_mode */,
+    int			/* keyboard_mode */,
+    Window		/* confine_to */,
+    Cursor		/* cursor */
+);
+
+extern int XGrabKey(
+    Display*		/* display */,
+    int			/* keycode */,
+    unsigned int	/* modifiers */,
+    Window		/* grab_window */,
+    Bool		/* owner_events */,
+    int			/* pointer_mode */,
+    int			/* keyboard_mode */
+);
+
+extern int XGrabKeyboard(
+    Display*		/* display */,
+    Window		/* grab_window */,
+    Bool		/* owner_events */,
+    int			/* pointer_mode */,
+    int			/* keyboard_mode */,
+    Time		/* time */
+);
+
+extern int XGrabPointer(
+    Display*		/* display */,
+    Window		/* grab_window */,
+    Bool		/* owner_events */,
+    unsigned int	/* event_mask */,
+    int			/* pointer_mode */,
+    int			/* keyboard_mode */,
+    Window		/* confine_to */,
+    Cursor		/* cursor */,
+    Time		/* time */
+);
+
+extern int XGrabServer(
+    Display*		/* display */
+);
+
+extern int XHeightMMOfScreen(
+    Screen*		/* screen */
+);
+
+extern int XHeightOfScreen(
+    Screen*		/* screen */
+);
+
+extern int XIfEvent(
+    Display*		/* display */,
+    XEvent*		/* event_return */,
+    Bool (*) (
+	       Display*			/* display */,
+               XEvent*			/* event */,
+               XPointer			/* arg */
+             )		/* predicate */,
+    XPointer		/* arg */
+);
+
+extern int XImageByteOrder(
+    Display*		/* display */
+);
+
+extern int XInstallColormap(
+    Display*		/* display */,
+    Colormap		/* colormap */
+);
+
+extern KeyCode XKeysymToKeycode(
+    Display*		/* display */,
+    KeySym		/* keysym */
+);
+
+extern int XKillClient(
+    Display*		/* display */,
+    XID			/* resource */
+);
+
+extern Status XLookupColor(
+    Display*		/* display */,
+    Colormap		/* colormap */,
+    _Xconst char*	/* color_name */,
+    XColor*		/* exact_def_return */,
+    XColor*		/* screen_def_return */
+);
+
+extern int XLowerWindow(
+    Display*		/* display */,
+    Window		/* w */
+);
+
+extern int XMapRaised(
+    Display*		/* display */,
+    Window		/* w */
+);
+
+extern int XMapSubwindows(
+    Display*		/* display */,
+    Window		/* w */
+);
+
+extern int XMapWindow(
+    Display*		/* display */,
+    Window		/* w */
+);
+
+extern int XMaskEvent(
+    Display*		/* display */,
+    long		/* event_mask */,
+    XEvent*		/* event_return */
+);
+
+extern int XMaxCmapsOfScreen(
+    Screen*		/* screen */
+);
+
+extern int XMinCmapsOfScreen(
+    Screen*		/* screen */
+);
+
+extern int XMoveResizeWindow(
+    Display*		/* display */,
+    Window		/* w */,
+    int			/* x */,
+    int			/* y */,
+    unsigned int	/* width */,
+    unsigned int	/* height */
+);
+
+extern int XMoveWindow(
+    Display*		/* display */,
+    Window		/* w */,
+    int			/* x */,
+    int			/* y */
+);
+
+extern int XNextEvent(
+    Display*		/* display */,
+    XEvent*		/* event_return */
+);
+
+extern int XNoOp(
+    Display*		/* display */
+);
+
+extern Status XParseColor(
+    Display*		/* display */,
+    Colormap		/* colormap */,
+    _Xconst char*	/* spec */,
+    XColor*		/* exact_def_return */
+);
+
+extern int XParseGeometry(
+    _Xconst char*	/* parsestring */,
+    int*		/* x_return */,
+    int*		/* y_return */,
+    unsigned int*	/* width_return */,
+    unsigned int*	/* height_return */
+);
+
+extern int XPeekEvent(
+    Display*		/* display */,
+    XEvent*		/* event_return */
+);
+
+extern int XPeekIfEvent(
+    Display*		/* display */,
+    XEvent*		/* event_return */,
+    Bool (*) (
+	       Display*		/* display */,
+               XEvent*		/* event */,
+               XPointer		/* arg */
+             )		/* predicate */,
+    XPointer		/* arg */
+);
+
+extern int XPending(
+    Display*		/* display */
+);
+
+extern int XPlanesOfScreen(
+    Screen*		/* screen */
+);
+
+extern int XProtocolRevision(
+    Display*		/* display */
+);
+
+extern int XProtocolVersion(
+    Display*		/* display */
+);
+
+
+extern int XPutBackEvent(
+    Display*		/* display */,
+    XEvent*		/* event */
+);
+
+extern int XPutImage(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    XImage*		/* image */,
+    int			/* src_x */,
+    int			/* src_y */,
+    int			/* dest_x */,
+    int			/* dest_y */,
+    unsigned int	/* width */,
+    unsigned int	/* height */
+);
+
+extern int XQLength(
+    Display*		/* display */
+);
+
+extern Status XQueryBestCursor(
+    Display*		/* display */,
+    Drawable		/* d */,
+    unsigned int        /* width */,
+    unsigned int	/* height */,
+    unsigned int*	/* width_return */,
+    unsigned int*	/* height_return */
+);
+
+extern Status XQueryBestSize(
+    Display*		/* display */,
+    int			/* class */,
+    Drawable		/* which_screen */,
+    unsigned int	/* width */,
+    unsigned int	/* height */,
+    unsigned int*	/* width_return */,
+    unsigned int*	/* height_return */
+);
+
+extern Status XQueryBestStipple(
+    Display*		/* display */,
+    Drawable		/* which_screen */,
+    unsigned int	/* width */,
+    unsigned int	/* height */,
+    unsigned int*	/* width_return */,
+    unsigned int*	/* height_return */
+);
+
+extern Status XQueryBestTile(
+    Display*		/* display */,
+    Drawable		/* which_screen */,
+    unsigned int	/* width */,
+    unsigned int	/* height */,
+    unsigned int*	/* width_return */,
+    unsigned int*	/* height_return */
+);
+
+extern int XQueryColor(
+    Display*		/* display */,
+    Colormap		/* colormap */,
+    XColor*		/* def_in_out */
+);
+
+extern int XQueryColors(
+    Display*		/* display */,
+    Colormap		/* colormap */,
+    XColor*		/* defs_in_out */,
+    int			/* ncolors */
+);
+
+extern Bool XQueryExtension(
+    Display*		/* display */,
+    _Xconst char*	/* name */,
+    int*		/* major_opcode_return */,
+    int*		/* first_event_return */,
+    int*		/* first_error_return */
+);
+
+extern int XQueryKeymap(
+    Display*		/* display */,
+    char [32]		/* keys_return */
+);
+
+extern Bool XQueryPointer(
+    Display*		/* display */,
+    Window		/* w */,
+    Window*		/* root_return */,
+    Window*		/* child_return */,
+    int*		/* root_x_return */,
+    int*		/* root_y_return */,
+    int*		/* win_x_return */,
+    int*		/* win_y_return */,
+    unsigned int*       /* mask_return */
+);
+
+extern int XQueryTextExtents(
+    Display*		/* display */,
+    XID			/* font_ID */,
+    _Xconst char*	/* string */,
+    int			/* nchars */,
+    int*		/* direction_return */,
+    int*		/* font_ascent_return */,
+    int*		/* font_descent_return */,
+    XCharStruct*	/* overall_return */
+);
+
+extern int XQueryTextExtents16(
+    Display*		/* display */,
+    XID			/* font_ID */,
+    _Xconst XChar2b*	/* string */,
+    int			/* nchars */,
+    int*		/* direction_return */,
+    int*		/* font_ascent_return */,
+    int*		/* font_descent_return */,
+    XCharStruct*	/* overall_return */
+);
+
+extern Status XQueryTree(
+    Display*		/* display */,
+    Window		/* w */,
+    Window*		/* root_return */,
+    Window*		/* parent_return */,
+    Window**		/* children_return */,
+    unsigned int*	/* nchildren_return */
+);
+
+extern int XRaiseWindow(
+    Display*		/* display */,
+    Window		/* w */
+);
+
+extern int XReadBitmapFile(
+    Display*		/* display */,
+    Drawable 		/* d */,
+    _Xconst char*	/* filename */,
+    unsigned int*	/* width_return */,
+    unsigned int*	/* height_return */,
+    Pixmap*		/* bitmap_return */,
+    int*		/* x_hot_return */,
+    int*		/* y_hot_return */
+);
+
+extern int XReadBitmapFileData(
+    _Xconst char*	/* filename */,
+    unsigned int*	/* width_return */,
+    unsigned int*	/* height_return */,
+    unsigned char**	/* data_return */,
+    int*		/* x_hot_return */,
+    int*		/* y_hot_return */
+);
+
+extern int XRebindKeysym(
+    Display*		/* display */,
+    KeySym		/* keysym */,
+    KeySym*		/* list */,
+    int			/* mod_count */,
+    _Xconst unsigned char*	/* string */,
+    int			/* bytes_string */
+);
+
+extern int XRecolorCursor(
+    Display*		/* display */,
+    Cursor		/* cursor */,
+    XColor*		/* foreground_color */,
+    XColor*		/* background_color */
+);
+
+extern int XRefreshKeyboardMapping(
+    XMappingEvent*	/* event_map */
+);
+
+extern int XRemoveFromSaveSet(
+    Display*		/* display */,
+    Window		/* w */
+);
+
+extern int XRemoveHost(
+    Display*		/* display */,
+    XHostAddress*	/* host */
+);
+
+extern int XRemoveHosts(
+    Display*		/* display */,
+    XHostAddress*	/* hosts */,
+    int			/* num_hosts */
+);
+
+extern int XReparentWindow(
+    Display*		/* display */,
+    Window		/* w */,
+    Window		/* parent */,
+    int			/* x */,
+    int			/* y */
+);
+
+extern int XResetScreenSaver(
+    Display*		/* display */
+);
+
+extern int XResizeWindow(
+    Display*		/* display */,
+    Window		/* w */,
+    unsigned int	/* width */,
+    unsigned int	/* height */
+);
+
+extern int XRestackWindows(
+    Display*		/* display */,
+    Window*		/* windows */,
+    int			/* nwindows */
+);
+
+extern int XRotateBuffers(
+    Display*		/* display */,
+    int			/* rotate */
+);
+
+extern int XRotateWindowProperties(
+    Display*		/* display */,
+    Window		/* w */,
+    Atom*		/* properties */,
+    int			/* num_prop */,
+    int			/* npositions */
+);
+
+extern int XScreenCount(
+    Display*		/* display */
+);
+
+extern int XSelectInput(
+    Display*		/* display */,
+    Window		/* w */,
+    long		/* event_mask */
+);
+
+extern Status XSendEvent(
+    Display*		/* display */,
+    Window		/* w */,
+    Bool		/* propagate */,
+    long		/* event_mask */,
+    XEvent*		/* event_send */
+);
+
+extern int XSetAccessControl(
+    Display*		/* display */,
+    int			/* mode */
+);
+
+extern int XSetArcMode(
+    Display*		/* display */,
+    GC			/* gc */,
+    int			/* arc_mode */
+);
+
+extern int XSetBackground(
+    Display*		/* display */,
+    GC			/* gc */,
+    unsigned long	/* background */
+);
+
+extern int XSetClipMask(
+    Display*		/* display */,
+    GC			/* gc */,
+    Pixmap		/* pixmap */
+);
+
+extern int XSetClipOrigin(
+    Display*		/* display */,
+    GC			/* gc */,
+    int			/* clip_x_origin */,
+    int			/* clip_y_origin */
+);
+
+extern int XSetClipRectangles(
+    Display*		/* display */,
+    GC			/* gc */,
+    int			/* clip_x_origin */,
+    int			/* clip_y_origin */,
+    XRectangle*		/* rectangles */,
+    int			/* n */,
+    int			/* ordering */
+);
+
+extern int XSetCloseDownMode(
+    Display*		/* display */,
+    int			/* close_mode */
+);
+
+extern int XSetCommand(
+    Display*		/* display */,
+    Window		/* w */,
+    char**		/* argv */,
+    int			/* argc */
+);
+
+extern int XSetDashes(
+    Display*		/* display */,
+    GC			/* gc */,
+    int			/* dash_offset */,
+    _Xconst char*	/* dash_list */,
+    int			/* n */
+);
+
+extern int XSetFillRule(
+    Display*		/* display */,
+    GC			/* gc */,
+    int			/* fill_rule */
+);
+
+extern int XSetFillStyle(
+    Display*		/* display */,
+    GC			/* gc */,
+    int			/* fill_style */
+);
+
+extern int XSetFont(
+    Display*		/* display */,
+    GC			/* gc */,
+    Font		/* font */
+);
+
+extern int XSetFontPath(
+    Display*		/* display */,
+    char**		/* directories */,
+    int			/* ndirs */
+);
+
+extern int XSetForeground(
+    Display*		/* display */,
+    GC			/* gc */,
+    unsigned long	/* foreground */
+);
+
+extern int XSetFunction(
+    Display*		/* display */,
+    GC			/* gc */,
+    int			/* function */
+);
+
+extern int XSetGraphicsExposures(
+    Display*		/* display */,
+    GC			/* gc */,
+    Bool		/* graphics_exposures */
+);
+
+extern int XSetIconName(
+    Display*		/* display */,
+    Window		/* w */,
+    _Xconst char*	/* icon_name */
+);
+
+extern int XSetInputFocus(
+    Display*		/* display */,
+    Window		/* focus */,
+    int			/* revert_to */,
+    Time		/* time */
+);
+
+extern int XSetLineAttributes(
+    Display*		/* display */,
+    GC			/* gc */,
+    unsigned int	/* line_width */,
+    int			/* line_style */,
+    int			/* cap_style */,
+    int			/* join_style */
+);
+
+extern int XSetModifierMapping(
+    Display*		/* display */,
+    XModifierKeymap*	/* modmap */
+);
+
+extern int XSetPlaneMask(
+    Display*		/* display */,
+    GC			/* gc */,
+    unsigned long	/* plane_mask */
+);
+
+extern int XSetPointerMapping(
+    Display*		/* display */,
+    _Xconst unsigned char*	/* map */,
+    int			/* nmap */
+);
+
+extern int XSetScreenSaver(
+    Display*		/* display */,
+    int			/* timeout */,
+    int			/* interval */,
+    int			/* prefer_blanking */,
+    int			/* allow_exposures */
+);
+
+extern int XSetSelectionOwner(
+    Display*		/* display */,
+    Atom	        /* selection */,
+    Window		/* owner */,
+    Time		/* time */
+);
+
+extern int XSetState(
+    Display*		/* display */,
+    GC			/* gc */,
+    unsigned long 	/* foreground */,
+    unsigned long	/* background */,
+    int			/* function */,
+    unsigned long	/* plane_mask */
+);
+
+extern int XSetStipple(
+    Display*		/* display */,
+    GC			/* gc */,
+    Pixmap		/* stipple */
+);
+
+extern int XSetSubwindowMode(
+    Display*		/* display */,
+    GC			/* gc */,
+    int			/* subwindow_mode */
+);
+
+extern int XSetTSOrigin(
+    Display*		/* display */,
+    GC			/* gc */,
+    int			/* ts_x_origin */,
+    int			/* ts_y_origin */
+);
+
+extern int XSetTile(
+    Display*		/* display */,
+    GC			/* gc */,
+    Pixmap		/* tile */
+);
+
+extern int XSetWindowBackground(
+    Display*		/* display */,
+    Window		/* w */,
+    unsigned long	/* background_pixel */
+);
+
+extern int XSetWindowBackgroundPixmap(
+    Display*		/* display */,
+    Window		/* w */,
+    Pixmap		/* background_pixmap */
+);
+
+extern int XSetWindowBorder(
+    Display*		/* display */,
+    Window		/* w */,
+    unsigned long	/* border_pixel */
+);
+
+extern int XSetWindowBorderPixmap(
+    Display*		/* display */,
+    Window		/* w */,
+    Pixmap		/* border_pixmap */
+);
+
+extern int XSetWindowBorderWidth(
+    Display*		/* display */,
+    Window		/* w */,
+    unsigned int	/* width */
+);
+
+extern int XSetWindowColormap(
+    Display*		/* display */,
+    Window		/* w */,
+    Colormap		/* colormap */
+);
+
+extern int XStoreBuffer(
+    Display*		/* display */,
+    _Xconst char*	/* bytes */,
+    int			/* nbytes */,
+    int			/* buffer */
+);
+
+extern int XStoreBytes(
+    Display*		/* display */,
+    _Xconst char*	/* bytes */,
+    int			/* nbytes */
+);
+
+extern int XStoreColor(
+    Display*		/* display */,
+    Colormap		/* colormap */,
+    XColor*		/* color */
+);
+
+extern int XStoreColors(
+    Display*		/* display */,
+    Colormap		/* colormap */,
+    XColor*		/* color */,
+    int			/* ncolors */
+);
+
+extern int XStoreName(
+    Display*		/* display */,
+    Window		/* w */,
+    _Xconst char*	/* window_name */
+);
+
+extern int XStoreNamedColor(
+    Display*		/* display */,
+    Colormap		/* colormap */,
+    _Xconst char*	/* color */,
+    unsigned long	/* pixel */,
+    int			/* flags */
+);
+
+extern int XSync(
+    Display*		/* display */,
+    Bool		/* discard */
+);
+
+extern int XTextExtents(
+    XFontStruct*	/* font_struct */,
+    _Xconst char*	/* string */,
+    int			/* nchars */,
+    int*		/* direction_return */,
+    int*		/* font_ascent_return */,
+    int*		/* font_descent_return */,
+    XCharStruct*	/* overall_return */
+);
+
+extern int XTextExtents16(
+    XFontStruct*	/* font_struct */,
+    _Xconst XChar2b*	/* string */,
+    int			/* nchars */,
+    int*		/* direction_return */,
+    int*		/* font_ascent_return */,
+    int*		/* font_descent_return */,
+    XCharStruct*	/* overall_return */
+);
+
+extern int XTextWidth(
+    XFontStruct*	/* font_struct */,
+    _Xconst char*	/* string */,
+    int			/* count */
+);
+
+extern int XTextWidth16(
+    XFontStruct*	/* font_struct */,
+    _Xconst XChar2b*	/* string */,
+    int			/* count */
+);
+
+extern Bool XTranslateCoordinates(
+    Display*		/* display */,
+    Window		/* src_w */,
+    Window		/* dest_w */,
+    int			/* src_x */,
+    int			/* src_y */,
+    int*		/* dest_x_return */,
+    int*		/* dest_y_return */,
+    Window*		/* child_return */
+);
+
+extern int XUndefineCursor(
+    Display*		/* display */,
+    Window		/* w */
+);
+
+extern int XUngrabButton(
+    Display*		/* display */,
+    unsigned int	/* button */,
+    unsigned int	/* modifiers */,
+    Window		/* grab_window */
+);
+
+extern int XUngrabKey(
+    Display*		/* display */,
+    int			/* keycode */,
+    unsigned int	/* modifiers */,
+    Window		/* grab_window */
+);
+
+extern int XUngrabKeyboard(
+    Display*		/* display */,
+    Time		/* time */
+);
+
+extern int XUngrabPointer(
+    Display*		/* display */,
+    Time		/* time */
+);
+
+extern int XUngrabServer(
+    Display*		/* display */
+);
+
+extern int XUninstallColormap(
+    Display*		/* display */,
+    Colormap		/* colormap */
+);
+
+extern int XUnloadFont(
+    Display*		/* display */,
+    Font		/* font */
+);
+
+extern int XUnmapSubwindows(
+    Display*		/* display */,
+    Window		/* w */
+);
+
+extern int XUnmapWindow(
+    Display*		/* display */,
+    Window		/* w */
+);
+
+extern int XVendorRelease(
+    Display*		/* display */
+);
+
+extern int XWarpPointer(
+    Display*		/* display */,
+    Window		/* src_w */,
+    Window		/* dest_w */,
+    int			/* src_x */,
+    int			/* src_y */,
+    unsigned int	/* src_width */,
+    unsigned int	/* src_height */,
+    int			/* dest_x */,
+    int			/* dest_y */
+);
+
+extern int XWidthMMOfScreen(
+    Screen*		/* screen */
+);
+
+extern int XWidthOfScreen(
+    Screen*		/* screen */
+);
+
+extern int XWindowEvent(
+    Display*		/* display */,
+    Window		/* w */,
+    long		/* event_mask */,
+    XEvent*		/* event_return */
+);
+
+extern int XWriteBitmapFile(
+    Display*		/* display */,
+    _Xconst char*	/* filename */,
+    Pixmap		/* bitmap */,
+    unsigned int	/* width */,
+    unsigned int	/* height */,
+    int			/* x_hot */,
+    int			/* y_hot */
+);
+
+extern Bool XSupportsLocale (void);
+
+extern char *XSetLocaleModifiers(
+    const char*		/* modifier_list */
+);
+
+extern XOM XOpenOM(
+    Display*			/* display */,
+    struct _XrmHashBucketRec*	/* rdb */,
+    _Xconst char*		/* res_name */,
+    _Xconst char*		/* res_class */
+);
+
+extern Status XCloseOM(
+    XOM			/* om */
+);
+
+extern char *XSetOMValues(
+    XOM			/* om */,
+    ...
+) _X_SENTINEL(0);
+
+extern char *XGetOMValues(
+    XOM			/* om */,
+    ...
+) _X_SENTINEL(0);
+
+extern Display *XDisplayOfOM(
+    XOM			/* om */
+);
+
+extern char *XLocaleOfOM(
+    XOM			/* om */
+);
+
+extern XOC XCreateOC(
+    XOM			/* om */,
+    ...
+) _X_SENTINEL(0);
+
+extern void XDestroyOC(
+    XOC			/* oc */
+);
+
+extern XOM XOMOfOC(
+    XOC			/* oc */
+);
+
+extern char *XSetOCValues(
+    XOC			/* oc */,
+    ...
+) _X_SENTINEL(0);
+
+extern char *XGetOCValues(
+    XOC			/* oc */,
+    ...
+) _X_SENTINEL(0);
+
+extern XFontSet XCreateFontSet(
+    Display*		/* display */,
+    _Xconst char*	/* base_font_name_list */,
+    char***		/* missing_charset_list */,
+    int*		/* missing_charset_count */,
+    char**		/* def_string */
+);
+
+extern void XFreeFontSet(
+    Display*		/* display */,
+    XFontSet		/* font_set */
+);
+
+extern int XFontsOfFontSet(
+    XFontSet		/* font_set */,
+    XFontStruct***	/* font_struct_list */,
+    char***		/* font_name_list */
+);
+
+extern char *XBaseFontNameListOfFontSet(
+    XFontSet		/* font_set */
+);
+
+extern char *XLocaleOfFontSet(
+    XFontSet		/* font_set */
+);
+
+extern Bool XContextDependentDrawing(
+    XFontSet		/* font_set */
+);
+
+extern Bool XDirectionalDependentDrawing(
+    XFontSet		/* font_set */
+);
+
+extern Bool XContextualDrawing(
+    XFontSet		/* font_set */
+);
+
+extern XFontSetExtents *XExtentsOfFontSet(
+    XFontSet		/* font_set */
+);
+
+extern int XmbTextEscapement(
+    XFontSet		/* font_set */,
+    _Xconst char*	/* text */,
+    int			/* bytes_text */
+);
+
+extern int XwcTextEscapement(
+    XFontSet		/* font_set */,
+    _Xconst wchar_t*	/* text */,
+    int			/* num_wchars */
+);
+
+extern int Xutf8TextEscapement(
+    XFontSet		/* font_set */,
+    _Xconst char*	/* text */,
+    int			/* bytes_text */
+);
+
+extern int XmbTextExtents(
+    XFontSet		/* font_set */,
+    _Xconst char*	/* text */,
+    int			/* bytes_text */,
+    XRectangle*		/* overall_ink_return */,
+    XRectangle*		/* overall_logical_return */
+);
+
+extern int XwcTextExtents(
+    XFontSet		/* font_set */,
+    _Xconst wchar_t*	/* text */,
+    int			/* num_wchars */,
+    XRectangle*		/* overall_ink_return */,
+    XRectangle*		/* overall_logical_return */
+);
+
+extern int Xutf8TextExtents(
+    XFontSet		/* font_set */,
+    _Xconst char*	/* text */,
+    int			/* bytes_text */,
+    XRectangle*		/* overall_ink_return */,
+    XRectangle*		/* overall_logical_return */
+);
+
+extern Status XmbTextPerCharExtents(
+    XFontSet		/* font_set */,
+    _Xconst char*	/* text */,
+    int			/* bytes_text */,
+    XRectangle*		/* ink_extents_buffer */,
+    XRectangle*		/* logical_extents_buffer */,
+    int			/* buffer_size */,
+    int*		/* num_chars */,
+    XRectangle*		/* overall_ink_return */,
+    XRectangle*		/* overall_logical_return */
+);
+
+extern Status XwcTextPerCharExtents(
+    XFontSet		/* font_set */,
+    _Xconst wchar_t*	/* text */,
+    int			/* num_wchars */,
+    XRectangle*		/* ink_extents_buffer */,
+    XRectangle*		/* logical_extents_buffer */,
+    int			/* buffer_size */,
+    int*		/* num_chars */,
+    XRectangle*		/* overall_ink_return */,
+    XRectangle*		/* overall_logical_return */
+);
+
+extern Status Xutf8TextPerCharExtents(
+    XFontSet		/* font_set */,
+    _Xconst char*	/* text */,
+    int			/* bytes_text */,
+    XRectangle*		/* ink_extents_buffer */,
+    XRectangle*		/* logical_extents_buffer */,
+    int			/* buffer_size */,
+    int*		/* num_chars */,
+    XRectangle*		/* overall_ink_return */,
+    XRectangle*		/* overall_logical_return */
+);
+
+extern void XmbDrawText(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    int			/* x */,
+    int			/* y */,
+    XmbTextItem*	/* text_items */,
+    int			/* nitems */
+);
+
+extern void XwcDrawText(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    int			/* x */,
+    int			/* y */,
+    XwcTextItem*	/* text_items */,
+    int			/* nitems */
+);
+
+extern void Xutf8DrawText(
+    Display*		/* display */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    int			/* x */,
+    int			/* y */,
+    XmbTextItem*	/* text_items */,
+    int			/* nitems */
+);
+
+extern void XmbDrawString(
+    Display*		/* display */,
+    Drawable		/* d */,
+    XFontSet		/* font_set */,
+    GC			/* gc */,
+    int			/* x */,
+    int			/* y */,
+    _Xconst char*	/* text */,
+    int			/* bytes_text */
+);
+
+extern void XwcDrawString(
+    Display*		/* display */,
+    Drawable		/* d */,
+    XFontSet		/* font_set */,
+    GC			/* gc */,
+    int			/* x */,
+    int			/* y */,
+    _Xconst wchar_t*	/* text */,
+    int			/* num_wchars */
+);
+
+extern void Xutf8DrawString(
+    Display*		/* display */,
+    Drawable		/* d */,
+    XFontSet		/* font_set */,
+    GC			/* gc */,
+    int			/* x */,
+    int			/* y */,
+    _Xconst char*	/* text */,
+    int			/* bytes_text */
+);
+
+extern void XmbDrawImageString(
+    Display*		/* display */,
+    Drawable		/* d */,
+    XFontSet		/* font_set */,
+    GC			/* gc */,
+    int			/* x */,
+    int			/* y */,
+    _Xconst char*	/* text */,
+    int			/* bytes_text */
+);
+
+extern void XwcDrawImageString(
+    Display*		/* display */,
+    Drawable		/* d */,
+    XFontSet		/* font_set */,
+    GC			/* gc */,
+    int			/* x */,
+    int			/* y */,
+    _Xconst wchar_t*	/* text */,
+    int			/* num_wchars */
+);
+
+extern void Xutf8DrawImageString(
+    Display*		/* display */,
+    Drawable		/* d */,
+    XFontSet		/* font_set */,
+    GC			/* gc */,
+    int			/* x */,
+    int			/* y */,
+    _Xconst char*	/* text */,
+    int			/* bytes_text */
+);
+
+extern XIM XOpenIM(
+    Display*			/* dpy */,
+    struct _XrmHashBucketRec*	/* rdb */,
+    char*			/* res_name */,
+    char*			/* res_class */
+);
+
+extern Status XCloseIM(
+    XIM /* im */
+);
+
+extern char *XGetIMValues(
+    XIM /* im */, ...
+) _X_SENTINEL(0);
+
+extern char *XSetIMValues(
+    XIM /* im */, ...
+) _X_SENTINEL(0);
+
+extern Display *XDisplayOfIM(
+    XIM /* im */
+);
+
+extern char *XLocaleOfIM(
+    XIM /* im*/
+);
+
+extern XIC XCreateIC(
+    XIM /* im */, ...
+) _X_SENTINEL(0);
+
+extern void XDestroyIC(
+    XIC /* ic */
+);
+
+extern void XSetICFocus(
+    XIC /* ic */
+);
+
+extern void XUnsetICFocus(
+    XIC /* ic */
+);
+
+extern wchar_t *XwcResetIC(
+    XIC /* ic */
+);
+
+extern char *XmbResetIC(
+    XIC /* ic */
+);
+
+extern char *Xutf8ResetIC(
+    XIC /* ic */
+);
+
+extern char *XSetICValues(
+    XIC /* ic */, ...
+) _X_SENTINEL(0);
+
+extern char *XGetICValues(
+    XIC /* ic */, ...
+) _X_SENTINEL(0);
+
+extern XIM XIMOfIC(
+    XIC /* ic */
+);
+
+extern Bool XFilterEvent(
+    XEvent*	/* event */,
+    Window	/* window */
+);
+
+extern int XmbLookupString(
+    XIC			/* ic */,
+    XKeyPressedEvent*	/* event */,
+    char*		/* buffer_return */,
+    int			/* bytes_buffer */,
+    KeySym*		/* keysym_return */,
+    Status*		/* status_return */
+);
+
+extern int XwcLookupString(
+    XIC			/* ic */,
+    XKeyPressedEvent*	/* event */,
+    wchar_t*		/* buffer_return */,
+    int			/* wchars_buffer */,
+    KeySym*		/* keysym_return */,
+    Status*		/* status_return */
+);
+
+extern int Xutf8LookupString(
+    XIC			/* ic */,
+    XKeyPressedEvent*	/* event */,
+    char*		/* buffer_return */,
+    int			/* bytes_buffer */,
+    KeySym*		/* keysym_return */,
+    Status*		/* status_return */
+);
+
+extern XVaNestedList XVaCreateNestedList(
+    int /*unused*/, ...
+) _X_SENTINEL(0);
+
+/* internal connections for IMs */
+
+extern Bool XRegisterIMInstantiateCallback(
+    Display*			/* dpy */,
+    struct _XrmHashBucketRec*	/* rdb */,
+    char*			/* res_name */,
+    char*			/* res_class */,
+    XIDProc			/* callback */,
+    XPointer			/* client_data */
+);
+
+extern Bool XUnregisterIMInstantiateCallback(
+    Display*			/* dpy */,
+    struct _XrmHashBucketRec*	/* rdb */,
+    char*			/* res_name */,
+    char*			/* res_class */,
+    XIDProc			/* callback */,
+    XPointer			/* client_data */
+);
+
+typedef void (*XConnectionWatchProc)(
+    Display*			/* dpy */,
+    XPointer			/* client_data */,
+    int				/* fd */,
+    Bool			/* opening */,	 /* open or close flag */
+    XPointer*			/* watch_data */ /* open sets, close uses */
+);
+
+
+extern Status XInternalConnectionNumbers(
+    Display*			/* dpy */,
+    int**			/* fd_return */,
+    int*			/* count_return */
+);
+
+extern void XProcessInternalConnection(
+    Display*			/* dpy */,
+    int				/* fd */
+);
+
+extern Status XAddConnectionWatch(
+    Display*			/* dpy */,
+    XConnectionWatchProc	/* callback */,
+    XPointer			/* client_data */
+);
+
+extern void XRemoveConnectionWatch(
+    Display*			/* dpy */,
+    XConnectionWatchProc	/* callback */,
+    XPointer			/* client_data */
+);
+
+extern void XSetAuthorization(
+    char *			/* name */,
+    int				/* namelen */,
+    char *			/* data */,
+    int				/* datalen */
+);
+
+extern int _Xmbtowc(
+    wchar_t *			/* wstr */,
+    char *			/* str */,
+    int				/* len */
+);
+
+extern int _Xwctomb(
+    char *			/* str */,
+    wchar_t			/* wc */
+);
+
+extern Bool XGetEventData(
+    Display*			/* dpy */,
+    XGenericEventCookie*	/* cookie*/
+);
+
+extern void XFreeEventData(
+    Display*			/* dpy */,
+    XGenericEventCookie*	/* cookie*/
+);
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+_XFUNCPROTOEND
+
+#endif /* _X11_XLIB_H_ */
diff --git a/ThirdParty/X11/Include/X11/XlibConf.h b/ThirdParty/X11/Include/X11/XlibConf.h
new file mode 100644
index 0000000000000000000000000000000000000000..9f9b940310b63a93628f0136f4fa4d4bac21ec55
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/XlibConf.h
@@ -0,0 +1,38 @@
+/* include/X11/XlibConf.h.  Generated from XlibConf.h.in by configure.  */
+/*
+ * Copyright © 2005 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _XLIBCONF_H_
+#define _XLIBCONF_H_
+/*
+ * This header file exports defines necessary to correctly
+ * use Xlibint.h both inside Xlib and by external libraries
+ * such as extensions.
+ */
+
+/* Threading support? */
+#define XTHREADS 1
+
+/* Use multi-threaded libc functions? */
+#define XUSE_MTSAFE_API 1
+
+#endif /* _XLIBCONF_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xlibint.h b/ThirdParty/X11/Include/X11/Xlibint.h
new file mode 100644
index 0000000000000000000000000000000000000000..6b95bcf7d33a3482fa1eb0b36c55e8b89e8de26c
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xlibint.h
@@ -0,0 +1,1444 @@
+
+/*
+
+Copyright 1984, 1985, 1987, 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+
+#ifndef _X11_XLIBINT_H_
+#define _X11_XLIBINT_H_ 1
+
+/*
+ *	Xlibint.h - Header definition and support file for the internal
+ *	support routines used by the C subroutine interface
+ *	library (Xlib) to the X Window System.
+ *
+ *	Warning, there be dragons here....
+ */
+
+#include <stdint.h>
+#include <X11/Xlib.h>
+#include <X11/Xproto.h>		/* to declare xEvent */
+#include <X11/XlibConf.h>	/* for configured options like XTHREADS */
+
+/* The Xlib structs are full of implicit padding to properly align members.
+   We can't clean that up without breaking ABI, so tell clang not to bother
+   complaining about it. */
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+#endif
+
+#ifdef WIN32
+#define _XFlush _XFlushIt
+#endif
+
+struct _XGC
+{
+    XExtData *ext_data;	/* hook for extension to hang data */
+    GContext gid;	/* protocol ID for graphics context */
+    Bool rects;		/* boolean: TRUE if clipmask is list of rectangles */
+    Bool dashes;	/* boolean: TRUE if dash-list is really a list */
+    unsigned long dirty;/* cache dirty bits */
+    XGCValues values;	/* shadow structure of values */
+};
+
+struct _XDisplay
+{
+	XExtData *ext_data;	/* hook for extension to hang data */
+	struct _XFreeFuncs *free_funcs; /* internal free functions */
+	int fd;			/* Network socket. */
+	int conn_checker;         /* ugly thing used by _XEventsQueued */
+	int proto_major_version;/* maj. version of server's X protocol */
+	int proto_minor_version;/* minor version of server's X protocol */
+	char *vendor;		/* vendor of the server hardware */
+        XID resource_base;	/* resource ID base */
+	XID resource_mask;	/* resource ID mask bits */
+	XID resource_id;	/* allocator current ID */
+	int resource_shift;	/* allocator shift to correct bits */
+	XID (*resource_alloc)(	/* allocator function */
+		struct _XDisplay*
+		);
+	int byte_order;		/* screen byte order, LSBFirst, MSBFirst */
+	int bitmap_unit;	/* padding and data requirements */
+	int bitmap_pad;		/* padding requirements on bitmaps */
+	int bitmap_bit_order;	/* LeastSignificant or MostSignificant */
+	int nformats;		/* number of pixmap formats in list */
+	ScreenFormat *pixmap_format;	/* pixmap format list */
+	int vnumber;		/* Xlib's X protocol version number. */
+	int release;		/* release of the server */
+	struct _XSQEvent *head, *tail;	/* Input event queue. */
+	int qlen;		/* Length of input event queue */
+	unsigned long last_request_read; /* seq number of last event read */
+	unsigned long request;	/* sequence number of last request. */
+	char *last_req;		/* beginning of last request, or dummy */
+	char *buffer;		/* Output buffer starting address. */
+	char *bufptr;		/* Output buffer index pointer. */
+	char *bufmax;		/* Output buffer maximum+1 address. */
+	unsigned max_request_size; /* maximum number 32 bit words in request*/
+	struct _XrmHashBucketRec *db;
+	int (*synchandler)(	/* Synchronization handler */
+		struct _XDisplay*
+		);
+	char *display_name;	/* "host:display" string used on this connect*/
+	int default_screen;	/* default screen for operations */
+	int nscreens;		/* number of screens on this server*/
+	Screen *screens;	/* pointer to list of screens */
+	unsigned long motion_buffer;	/* size of motion buffer */
+	volatile unsigned long flags;	   /* internal connection flags */
+	int min_keycode;	/* minimum defined keycode */
+	int max_keycode;	/* maximum defined keycode */
+	KeySym *keysyms;	/* This server's keysyms */
+	XModifierKeymap *modifiermap;	/* This server's modifier keymap */
+	int keysyms_per_keycode;/* number of rows */
+	char *xdefaults;	/* contents of defaults from server */
+	char *scratch_buffer;	/* place to hang scratch buffer */
+	unsigned long scratch_length;	/* length of scratch buffer */
+	int ext_number;		/* extension number on this display */
+	struct _XExten *ext_procs; /* extensions initialized on this display */
+	/*
+	 * the following can be fixed size, as the protocol defines how
+	 * much address space is available.
+	 * While this could be done using the extension vector, there
+	 * may be MANY events processed, so a search through the extension
+	 * list to find the right procedure for each event might be
+	 * expensive if many extensions are being used.
+	 */
+	Bool (*event_vec[128])(	/* vector for wire to event */
+		Display *	/* dpy */,
+		XEvent *	/* re */,
+		xEvent *	/* event */
+		);
+	Status (*wire_vec[128])( /* vector for event to wire */
+		Display *	/* dpy */,
+		XEvent *	/* re */,
+		xEvent *	/* event */
+		);
+	KeySym lock_meaning;	   /* for XLookupString */
+	struct _XLockInfo *lock;   /* multi-thread state, display lock */
+	struct _XInternalAsync *async_handlers; /* for internal async */
+	unsigned long bigreq_size; /* max size of big requests */
+	struct _XLockPtrs *lock_fns; /* pointers to threads functions */
+	void (*idlist_alloc)(	   /* XID list allocator function */
+		Display *	/* dpy */,
+		XID *		/* ids */,
+		int		/* count */
+		);
+	/* things above this line should not move, for binary compatibility */
+	struct _XKeytrans *key_bindings; /* for XLookupString */
+	Font cursor_font;	   /* for XCreateFontCursor */
+	struct _XDisplayAtoms *atoms; /* for XInternAtom */
+	unsigned int mode_switch;  /* keyboard group modifiers */
+	unsigned int num_lock;  /* keyboard numlock modifiers */
+	struct _XContextDB *context_db; /* context database */
+	Bool (**error_vec)(	/* vector for wire to error */
+		Display     *	/* display */,
+		XErrorEvent *	/* he */,
+		xError      *	/* we */
+		);
+	/*
+	 * Xcms information
+	 */
+	struct {
+	   XPointer defaultCCCs;  /* pointer to an array of default XcmsCCC */
+	   XPointer clientCmaps;  /* pointer to linked list of XcmsCmapRec */
+	   XPointer perVisualIntensityMaps;
+				  /* linked list of XcmsIntensityMap */
+	} cms;
+	struct _XIMFilter *im_filters;
+	struct _XSQEvent *qfree; /* unallocated event queue elements */
+	unsigned long next_event_serial_num; /* inserted into next queue elt */
+	struct _XExten *flushes; /* Flush hooks */
+	struct _XConnectionInfo *im_fd_info; /* _XRegisterInternalConnection */
+	int im_fd_length;	/* number of im_fd_info */
+	struct _XConnWatchInfo *conn_watchers; /* XAddConnectionWatch */
+	int watcher_count;	/* number of conn_watchers */
+	XPointer filedes;	/* struct pollfd cache for _XWaitForReadable */
+	int (*savedsynchandler)( /* user synchandler when Xlib usurps */
+		Display *	/* dpy */
+		);
+	XID resource_max;	/* allocator max ID */
+	int xcmisc_opcode;	/* major opcode for XC-MISC */
+	struct _XkbInfoRec *xkb_info; /* XKB info */
+	struct _XtransConnInfo *trans_conn; /* transport connection object */
+	struct _X11XCBPrivate *xcb; /* XCB glue private data */
+
+	/* Generic event cookie handling */
+	unsigned int next_cookie; /* next event cookie */
+	/* vector for wire to generic event, index is (extension - 128) */
+	Bool (*generic_event_vec[128])(
+		Display *	/* dpy */,
+		XGenericEventCookie *	/* Xlib event */,
+		xEvent *	/* wire event */);
+	/* vector for event copy, index is (extension - 128) */
+	Bool (*generic_event_copy_vec[128])(
+		Display *	/* dpy */,
+		XGenericEventCookie *	/* in */,
+		XGenericEventCookie *   /* out*/);
+	void *cookiejar;  /* cookie events returned but not claimed */
+#ifndef LONG64
+	unsigned long last_request_read_upper32bit;
+	unsigned long request_upper32bit;
+#endif
+};
+
+#define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n)
+
+/*
+ * access "last_request_read" and "request" with 64bit
+ * warning: the value argument of the SET-macros must not
+ * have any side-effects because it may get called twice.
+ */
+#ifndef LONG64
+/* accessors for 32-bit unsigned long */
+
+#define X_DPY_GET_REQUEST(dpy) \
+    ( \
+        ((uint64_t)(((struct _XDisplay*)dpy)->request)) \
+	+ (((uint64_t)(((struct _XDisplay*)dpy)->request_upper32bit)) << 32) \
+    )
+
+#define X_DPY_SET_REQUEST(dpy, value) \
+    ( \
+        (((struct _XDisplay*)dpy)->request = \
+            (value) & 0xFFFFFFFFUL), \
+        (((struct _XDisplay*)dpy)->request_upper32bit = \
+            ((uint64_t)(value)) >> 32), \
+	(void)0 /* don't use the result */ \
+    )
+
+#define X_DPY_GET_LAST_REQUEST_READ(dpy) \
+    ( \
+        ((uint64_t)(((struct _XDisplay*)dpy)->last_request_read)) \
+        + ( \
+            ((uint64_t)( \
+                ((struct _XDisplay*)dpy)->last_request_read_upper32bit \
+            )) << 32 \
+        ) \
+    )
+
+#define X_DPY_SET_LAST_REQUEST_READ(dpy, value) \
+    ( \
+        (((struct _XDisplay*)dpy)->last_request_read = \
+            (value) & 0xFFFFFFFFUL), \
+        (((struct _XDisplay*)dpy)->last_request_read_upper32bit = \
+            ((uint64_t)(value)) >> 32), \
+	(void)0 /* don't use the result */ \
+    )
+
+/*
+ * widen a 32-bit sequence number to a 64 sequence number.
+ * This macro makes the following assumptions:
+ * - ulseq refers to a sequence that has already been sent
+ * - ulseq means the most recent possible sequence number
+ *   with these lower 32 bits.
+ *
+ * The following optimization is used:
+ * The comparison result is taken a 0 or 1 to avoid a branch.
+ */
+#define X_DPY_WIDEN_UNSIGNED_LONG_SEQ(dpy, ulseq) \
+    ( \
+        ((uint64_t)ulseq) \
+        + \
+        (( \
+            ((uint64_t)(((struct _XDisplay*)dpy)->request_upper32bit)) \
+            - (uint64_t)( \
+                (ulseq) > (((struct _XDisplay*)dpy)->request) \
+	    ) \
+        ) << 32) \
+    )
+
+#define X_DPY_REQUEST_INCREMENT(dpy) \
+    ( \
+        ((struct _XDisplay*)dpy)->request++, \
+        ( \
+            (((struct _XDisplay*)dpy)->request == 0) ? ( \
+                ((struct _XDisplay*)dpy)->request_upper32bit++ \
+	    ) : 0 \
+        ), \
+	(void)0 /* don't use the result */ \
+    )
+
+
+#define X_DPY_REQUEST_DECREMENT(dpy) \
+    ( \
+	( \
+            (((struct _XDisplay*)dpy)->request == 0) ? (\
+                ((struct _XDisplay*)dpy)->request--, /* wrap */ \
+                ((struct _XDisplay*)dpy)->request_upper32bit-- \
+            ) : ( \
+                ((struct _XDisplay*)dpy)->request-- \
+            ) \
+	), \
+	(void)0 /* don't use the result */ \
+    )
+
+#else
+/* accessors for 64-bit unsigned long */
+#define X_DPY_GET_REQUEST(dpy) \
+    (((struct _XDisplay*)dpy)->request)
+#define X_DPY_SET_REQUEST(dpy, value) \
+    ((struct _XDisplay*)dpy)->request = (value)
+
+#define X_DPY_GET_LAST_REQUEST_READ(dpy) \
+    (((struct _XDisplay*)dpy)->last_request_read)
+#define X_DPY_SET_LAST_REQUEST_READ(dpy, value) \
+    ((struct _XDisplay*)dpy)->last_request_read = (value)
+
+#define X_DPY_WIDEN_UNSIGNED_LONG_SEQ(dpy, ulseq) ulseq
+
+#define X_DPY_REQUEST_INCREMENT(dpy) ((struct _XDisplay*)dpy)->request++
+#define X_DPY_REQUEST_DECREMENT(dpy) ((struct _XDisplay*)dpy)->request--
+#endif
+
+
+#ifndef _XEVENT_
+/*
+ * _QEvent datatype for use in input queueing.
+ */
+typedef struct _XSQEvent
+{
+    struct _XSQEvent *next;
+    XEvent event;
+    unsigned long qserial_num;	/* so multi-threaded code can find new ones */
+} _XQEvent;
+#endif
+
+#include <X11/Xproto.h>
+#ifdef __sgi
+#define _SGI_MP_SOURCE  /* turn this on to get MP safe errno */
+#endif
+#include <errno.h>
+#define _XBCOPYFUNC _Xbcopy
+#include <X11/Xfuncs.h>
+#include <X11/Xosdefs.h>
+
+/* Utek leaves kernel macros around in include files (bleah) */
+#ifdef dirty
+#undef dirty
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+/*
+ * The following definitions can be used for locking requests in multi-threaded
+ * address spaces.
+ */
+#ifdef XTHREADS
+/* Author: Stephen Gildea, MIT X Consortium
+ *
+ * declarations for C Threads locking
+ */
+
+typedef struct _LockInfoRec *LockInfoPtr;
+
+/* interfaces for locking.c */
+struct _XLockPtrs {
+    /* used by all, including extensions; do not move */
+    void (*lock_display)(
+		Display *dpy
+#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
+		, char *file
+		, int line
+#endif
+	);
+    void (*unlock_display)(
+		Display *dpy
+#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
+		, char *file
+		, int line
+#endif
+	);
+};
+
+#if defined(WIN32) && !defined(_XLIBINT_)
+#define _XCreateMutex_fn (*_XCreateMutex_fn_p)
+#define _XFreeMutex_fn (*_XFreeMutex_fn_p)
+#define _XLockMutex_fn (*_XLockMutex_fn_p)
+#define _XUnlockMutex_fn (*_XUnlockMutex_fn_p)
+#define _Xglobal_lock (*_Xglobal_lock_p)
+#endif
+
+/* in XlibInt.c */
+extern void (*_XCreateMutex_fn)(
+    LockInfoPtr /* lock */
+);
+extern void (*_XFreeMutex_fn)(
+    LockInfoPtr /* lock */
+);
+extern void (*_XLockMutex_fn)(
+    LockInfoPtr	/* lock */
+#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
+    , char * /* file */
+    , int /* line */
+#endif
+);
+extern void (*_XUnlockMutex_fn)(
+    LockInfoPtr	/* lock */
+#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
+    , char * /* file */
+    , int /* line */
+#endif
+);
+
+extern LockInfoPtr _Xglobal_lock;
+
+#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
+#define LockDisplay(d)	     if ((d)->lock_fns) (*(d)->lock_fns->lock_display)((d),__FILE__,__LINE__)
+#define UnlockDisplay(d)     if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)((d),__FILE__,__LINE__)
+#define _XLockMutex(lock)		if (_XLockMutex_fn) (*_XLockMutex_fn)(lock,__FILE__,__LINE__)
+#define _XUnlockMutex(lock)	if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock,__FILE__,__LINE__)
+#else
+/* used everywhere, so must be fast if not using threads */
+#define LockDisplay(d)	     if ((d)->lock_fns) (*(d)->lock_fns->lock_display)(d)
+#define UnlockDisplay(d)     if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)(d)
+#define _XLockMutex(lock)		if (_XLockMutex_fn) (*_XLockMutex_fn)(lock)
+#define _XUnlockMutex(lock)	if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock)
+#endif
+#define _XCreateMutex(lock)	if (_XCreateMutex_fn) (*_XCreateMutex_fn)(lock);
+#define _XFreeMutex(lock)	if (_XFreeMutex_fn) (*_XFreeMutex_fn)(lock);
+
+#else /* XTHREADS */
+#define LockDisplay(dis)
+#define _XLockMutex(lock)
+#define _XUnlockMutex(lock)
+#define UnlockDisplay(dis)
+#define _XCreateMutex(lock)
+#define _XFreeMutex(lock)
+#endif
+
+#define Xfree(ptr) free((ptr))
+
+/*
+ * Note that some machines do not return a valid pointer for malloc(0), in
+ * which case we provide an alternate under the control of the
+ * define MALLOC_0_RETURNS_NULL.  This is necessary because some
+ * Xlib code expects malloc(0) to return a valid pointer to storage.
+ */
+#if defined(MALLOC_0_RETURNS_NULL) || defined(__clang_analyzer__)
+
+# define Xmalloc(size) malloc(((size) == 0 ? 1 : (size)))
+# define Xrealloc(ptr, size) realloc((ptr), ((size) == 0 ? 1 : (size)))
+# define Xcalloc(nelem, elsize) calloc(((nelem) == 0 ? 1 : (nelem)), (elsize))
+
+#else
+
+# define Xmalloc(size) malloc((size))
+# define Xrealloc(ptr, size) realloc((ptr), (size))
+# define Xcalloc(nelem, elsize) calloc((nelem), (elsize))
+
+#endif
+
+#include <stddef.h>
+
+#define LOCKED 1
+#define UNLOCKED 0
+
+#ifndef BUFSIZE
+#define BUFSIZE 2048			/* X output buffer size. */
+#endif
+#ifndef PTSPERBATCH
+#define PTSPERBATCH 1024		/* point batching */
+#endif
+#ifndef WLNSPERBATCH
+#define WLNSPERBATCH 50			/* wide line batching */
+#endif
+#ifndef ZLNSPERBATCH
+#define ZLNSPERBATCH 1024		/* thin line batching */
+#endif
+#ifndef WRCTSPERBATCH
+#define WRCTSPERBATCH 10		/* wide line rectangle batching */
+#endif
+#ifndef ZRCTSPERBATCH
+#define ZRCTSPERBATCH 256		/* thin line rectangle batching */
+#endif
+#ifndef FRCTSPERBATCH
+#define FRCTSPERBATCH 256		/* filled rectangle batching */
+#endif
+#ifndef FARCSPERBATCH
+#define FARCSPERBATCH 256		/* filled arc batching */
+#endif
+#ifndef CURSORFONT
+#define CURSORFONT "cursor"		/* standard cursor fonts */
+#endif
+
+/*
+ * Display flags
+ */
+#define XlibDisplayIOError	(1L << 0)
+#define XlibDisplayClosing	(1L << 1)
+#define XlibDisplayNoXkb	(1L << 2)
+#define XlibDisplayPrivSync	(1L << 3)
+#define XlibDisplayProcConni	(1L << 4) /* in _XProcessInternalConnection */
+#define XlibDisplayReadEvents	(1L << 5) /* in _XReadEvents */
+#define XlibDisplayReply	(1L << 5) /* in _XReply */
+#define XlibDisplayWriting	(1L << 6) /* in _XFlushInt, _XSend */
+#define XlibDisplayDfltRMDB     (1L << 7) /* mark if RM db from XGetDefault */
+
+/*
+ * X Protocol packetizing macros.
+ */
+
+/* Leftover from CRAY support - was defined empty on all non-Cray systems */
+#define WORD64ALIGN
+
+/**
+ * Return a len-sized request buffer for the request type. This function may
+ * flush the output queue.
+ *
+ * @param dpy The display connection
+ * @param type The request type
+ * @param len Length of the request in bytes
+ *
+ * @returns A pointer to the request buffer with a few default values
+ * initialized.
+ */
+extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len);
+
+/* GetReqSized is the same as GetReq but allows the caller to specify the
+ * size in bytes. 'sz' must be a multiple of 4! */
+
+#define GetReqSized(name, sz, req) \
+	req = (x##name##Req *) _XGetRequest(dpy, X_##name, sz)
+
+/*
+ * GetReq - Get the next available X request packet in the buffer and
+ * return it.
+ *
+ * "name" is the name of the request, e.g. CreatePixmap, OpenFont, etc.
+ * "req" is the name of the request pointer.
+ *
+ */
+
+#define GetReq(name, req) \
+	GetReqSized(name, SIZEOF(x##name##Req), req)
+
+/* GetReqExtra is the same as GetReq, but allocates "n" additional
+   bytes after the request. "n" must be a multiple of 4!  */
+
+#define GetReqExtra(name, n, req) \
+        GetReqSized(name, SIZEOF(x##name##Req) + n, req)
+
+/*
+ * GetResReq is for those requests that have a resource ID
+ * (Window, Pixmap, GContext, etc.) as their single argument.
+ * "rid" is the name of the resource.
+ */
+
+#define GetResReq(name, rid, req) \
+	req = (xResourceReq *) _XGetRequest(dpy, X_##name, SIZEOF(xResourceReq)); \
+	req->id = (rid)
+
+/*
+ * GetEmptyReq is for those requests that have no arguments
+ * at all.
+ */
+
+#define GetEmptyReq(name, req) \
+	req = (xReq *) _XGetRequest(dpy, X_##name, SIZEOF(xReq))
+
+/*
+ * MakeBigReq sets the CARD16 "req->length" to 0 and inserts a new CARD32
+ * length, after req->length, before the data in the request.  The new length
+ * includes the "n" extra 32-bit words.
+ *
+ * Do not use MakeBigReq if there is no data already in the request.
+ * req->length must already be >= 2.
+ */
+#ifdef LONG64
+#define MakeBigReq(req,n) \
+    { \
+    CARD64 _BRdat; \
+    CARD32 _BRlen = req->length - 1; \
+    req->length = 0; \
+    _BRdat = ((CARD32 *)req)[_BRlen]; \
+    memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \
+    ((CARD32 *)req)[1] = _BRlen + n + 2; \
+    Data32(dpy, &_BRdat, 4); \
+    }
+#else
+#define MakeBigReq(req,n) \
+    { \
+    CARD32 _BRdat; \
+    CARD32 _BRlen = req->length - 1; \
+    req->length = 0; \
+    _BRdat = ((CARD32 *)req)[_BRlen]; \
+    memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \
+    ((CARD32 *)req)[1] = _BRlen + n + 2; \
+    Data32(dpy, &_BRdat, 4); \
+    }
+#endif
+
+/*
+ * SetReqLen increases the count of 32-bit words in the request by "n",
+ * or by "badlen" if "n" is too large.
+ *
+ * Do not use SetReqLen if "req" does not already have data after the
+ * xReq header.  req->length must already be >= 2.
+ */
+#ifndef __clang_analyzer__
+#define SetReqLen(req,n,badlen) \
+    if ((req->length + n) > (unsigned)65535) { \
+	if (dpy->bigreq_size) { \
+	    MakeBigReq(req,n) \
+	} else { \
+	    n = badlen; \
+	    req->length += n; \
+	} \
+    } else \
+	req->length += n
+#else
+#define SetReqLen(req,n,badlen) \
+    req->length += n
+#endif
+
+#define SyncHandle() \
+	if (dpy->synchandler) (*dpy->synchandler)(dpy)
+
+extern void _XFlushGCCache(Display *dpy, GC gc);
+#define FlushGC(dpy, gc) \
+	if ((gc)->dirty) _XFlushGCCache((dpy), (gc))
+/*
+ * Data - Place data in the buffer and pad the end to provide
+ * 32 bit word alignment.  Transmit if the buffer fills.
+ *
+ * "dpy" is a pointer to a Display.
+ * "data" is a pointer to a data buffer.
+ * "len" is the length of the data buffer.
+ */
+#ifndef DataRoutineIsProcedure
+#define Data(dpy, data, len) {\
+	if (dpy->bufptr + (len) <= dpy->bufmax) {\
+		memcpy(dpy->bufptr, data, (int)len);\
+		dpy->bufptr += ((len) + 3) & ~3;\
+	} else\
+		_XSend(dpy, data, len);\
+}
+#endif /* DataRoutineIsProcedure */
+
+
+/* Allocate bytes from the buffer.  No padding is done, so if
+ * the length is not a multiple of 4, the caller must be
+ * careful to leave the buffer aligned after sending the
+ * current request.
+ *
+ * "type" is the type of the pointer being assigned to.
+ * "ptr" is the pointer being assigned to.
+ * "n" is the number of bytes to allocate.
+ *
+ * Example:
+ *    xTextElt *elt;
+ *    BufAlloc (xTextElt *, elt, nbytes)
+ */
+
+#define BufAlloc(type, ptr, n) \
+    if (dpy->bufptr + (n) > dpy->bufmax) \
+        _XFlush (dpy); \
+    ptr = (type) dpy->bufptr; \
+    memset(ptr, '\0', n); \
+    dpy->bufptr += (n);
+
+#define Data16(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len))
+#define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len))
+#define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len))
+#ifdef LONG64
+#define Data32(dpy, data, len) _XData32(dpy, (_Xconst long *)data, len)
+extern int _XData32(
+	     Display *dpy,
+	     register _Xconst long *data,
+	     unsigned len
+);
+extern void _XRead32(
+	     Display *dpy,
+	     register long *data,
+	     long len
+);
+#else
+#define Data32(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len))
+#define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len))
+#endif
+
+#define PackData16(dpy,data,len) Data16 (dpy, data, len)
+#define PackData32(dpy,data,len) Data32 (dpy, data, len)
+
+/* Xlib manual is bogus */
+#define PackData(dpy,data,len) PackData16 (dpy, data, len)
+
+#define min(a,b) (((a) < (b)) ? (a) : (b))
+#define max(a,b) (((a) > (b)) ? (a) : (b))
+
+#define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \
+			     (((cs)->rbearing|(cs)->lbearing| \
+			       (cs)->ascent|(cs)->descent) == 0))
+
+/*
+ * CI_GET_CHAR_INFO_1D - return the charinfo struct for the indicated 8bit
+ * character.  If the character is in the column and exists, then return the
+ * appropriate metrics (note that fonts with common per-character metrics will
+ * return min_bounds).  If none of these hold true, try again with the default
+ * char.
+ */
+#define CI_GET_CHAR_INFO_1D(fs,col,def,cs) \
+{ \
+    cs = def; \
+    if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
+	if (fs->per_char == NULL) { \
+	    cs = &fs->min_bounds; \
+	} else { \
+	    cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \
+	    if (CI_NONEXISTCHAR(cs)) cs = def; \
+	} \
+    } \
+}
+
+#define CI_GET_DEFAULT_INFO_1D(fs,cs) \
+  CI_GET_CHAR_INFO_1D (fs, fs->default_char, NULL, cs)
+
+
+
+/*
+ * CI_GET_CHAR_INFO_2D - return the charinfo struct for the indicated row and
+ * column.  This is used for fonts that have more than row zero.
+ */
+#define CI_GET_CHAR_INFO_2D(fs,row,col,def,cs) \
+{ \
+    cs = def; \
+    if (row >= fs->min_byte1 && row <= fs->max_byte1 && \
+	col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
+	if (fs->per_char == NULL) { \
+	    cs = &fs->min_bounds; \
+	} else { \
+	    cs = &fs->per_char[((row - fs->min_byte1) * \
+			        (fs->max_char_or_byte2 - \
+				 fs->min_char_or_byte2 + 1)) + \
+			       (col - fs->min_char_or_byte2)]; \
+	    if (CI_NONEXISTCHAR(cs)) cs = def; \
+        } \
+    } \
+}
+
+#define CI_GET_DEFAULT_INFO_2D(fs,cs) \
+{ \
+    unsigned int r = (fs->default_char >> 8); \
+    unsigned int c = (fs->default_char & 0xff); \
+    CI_GET_CHAR_INFO_2D (fs, r, c, NULL, cs); \
+}
+
+
+/* srcvar must be a variable for large architecture version */
+#define OneDataCard32(dpy,dstaddr,srcvar) \
+  { *(CARD32 *)(dstaddr) = (srcvar); }
+
+
+typedef struct _XInternalAsync {
+    struct _XInternalAsync *next;
+    /*
+     * handler arguments:
+     * rep is the generic reply that caused this handler
+     * to be invoked.  It must also be passed to _XGetAsyncReply.
+     * buf and len are opaque values that must be passed to
+     * _XGetAsyncReply or _XGetAsyncData.
+     * data is the closure stored in this struct.
+     * The handler returns True iff it handled this reply.
+     */
+    Bool (*handler)(
+		    Display*	/* dpy */,
+		    xReply*	/* rep */,
+		    char*	/* buf */,
+		    int		/* len */,
+		    XPointer	/* data */
+		    );
+    XPointer data;
+} _XAsyncHandler;
+
+/*
+ * This struct is part of the ABI and is defined by value
+ * in user-code. This means that we cannot make
+ * the sequence-numbers 64bit.
+ */
+typedef struct _XAsyncEState {
+    unsigned long min_sequence_number;
+    unsigned long max_sequence_number;
+    unsigned char error_code;
+    unsigned char major_opcode;
+    unsigned short minor_opcode;
+    unsigned char last_error_received;
+    int error_count;
+} _XAsyncErrorState;
+
+extern void _XDeqAsyncHandler(Display *dpy, _XAsyncHandler *handler);
+#define DeqAsyncHandler(dpy,handler) { \
+    if (dpy->async_handlers == (handler)) \
+	dpy->async_handlers = (handler)->next; \
+    else \
+	_XDeqAsyncHandler(dpy, handler); \
+    }
+
+typedef void (*FreeFuncType) (
+    Display*	/* display */
+);
+
+typedef int (*FreeModmapType) (
+    XModifierKeymap*	/* modmap */
+);
+
+/*
+ * This structure is private to the library.
+ */
+typedef struct _XFreeFuncs {
+    FreeFuncType atoms;		/* _XFreeAtomTable */
+    FreeModmapType modifiermap;	/* XFreeModifiermap */
+    FreeFuncType key_bindings;	/* _XFreeKeyBindings */
+    FreeFuncType context_db;	/* _XFreeContextDB */
+    FreeFuncType defaultCCCs;	/* _XcmsFreeDefaultCCCs */
+    FreeFuncType clientCmaps;	/* _XcmsFreeClientCmaps */
+    FreeFuncType intensityMaps;	/* _XcmsFreeIntensityMaps */
+    FreeFuncType im_filters;	/* _XFreeIMFilters */
+    FreeFuncType xkb;		/* _XkbFreeInfo */
+} _XFreeFuncRec;
+
+/* types for InitExt.c */
+typedef int (*CreateGCType) (
+    Display*	/* display */,
+    GC		/* gc */,
+    XExtCodes*	/* codes */
+);
+
+typedef int (*CopyGCType)(
+    Display*	/* display */,
+    GC		/* gc */,
+    XExtCodes*	/* codes */
+);
+
+typedef int (*FlushGCType) (
+    Display*	/* display */,
+    GC		/* gc */,
+    XExtCodes*	/* codes */
+);
+
+typedef int (*FreeGCType) (
+    Display*	/* display */,
+    GC		/* gc */,
+    XExtCodes*	/* codes */
+);
+
+typedef int (*CreateFontType) (
+    Display*	/* display */,
+    XFontStruct* /* fs */,
+    XExtCodes*	/* codes */
+);
+
+typedef int (*FreeFontType) (
+    Display*	/* display */,
+    XFontStruct* /* fs */,
+    XExtCodes*	/* codes */
+);
+
+typedef int (*CloseDisplayType) (
+    Display*	/* display */,
+    XExtCodes*	/* codes */
+);
+
+typedef int (*ErrorType) (
+    Display*	/* display */,
+    xError*	/* err */,
+    XExtCodes*	/* codes */,
+    int*	/* ret_code */
+);
+
+typedef char* (*ErrorStringType) (
+    Display*	/* display */,
+    int		/* code */,
+    XExtCodes*	/* codes */,
+    char*	/* buffer */,
+    int		/* nbytes */
+);
+
+typedef void (*PrintErrorType)(
+    Display*	/* display */,
+    XErrorEvent* /* ev */,
+    void*	/* fp */
+);
+
+typedef void (*BeforeFlushType)(
+    Display*	/* display */,
+    XExtCodes*	/* codes */,
+    _Xconst char* /* data */,
+    long	/* len */
+);
+
+/*
+ * This structure is private to the library.
+ */
+typedef struct _XExten {		/* private to extension mechanism */
+	struct _XExten *next;		/* next in list */
+	XExtCodes codes;		/* public information, all extension told */
+	CreateGCType create_GC;		/* routine to call when GC created */
+	CopyGCType copy_GC;		/* routine to call when GC copied */
+	FlushGCType flush_GC;		/* routine to call when GC flushed */
+	FreeGCType free_GC;		/* routine to call when GC freed */
+	CreateFontType create_Font;	/* routine to call when Font created */
+	FreeFontType free_Font;		/* routine to call when Font freed */
+	CloseDisplayType close_display;	/* routine to call when connection closed */
+	ErrorType error;		/* who to call when an error occurs */
+	ErrorStringType error_string;	/* routine to supply error string */
+	char *name;			/* name of this extension */
+	PrintErrorType error_values;	/* routine to supply error values */
+	BeforeFlushType before_flush;	/* routine to call when sending data */
+	struct _XExten *next_flush;	/* next in list of those with flushes */
+} _XExtension;
+
+/* Temporary definition until we can depend on an xproto release with it */
+#ifdef _X_COLD
+# define _XLIB_COLD _X_COLD
+#elif defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403) /* 4.3+ */
+# define _XLIB_COLD __attribute__((__cold__))
+#else
+# define _XLIB_COLD /* nothing */
+#endif
+
+/* extension hooks */
+
+#ifdef DataRoutineIsProcedure
+extern void Data(Display *dpy, char *data, long len);
+#endif
+extern int _XError(
+    Display*	/* dpy */,
+    xError*	/* rep */
+);
+extern int _XIOError(
+    Display*	/* dpy */
+) _X_NORETURN;
+extern int (*_XIOErrorFunction)(
+    Display*	/* dpy */
+);
+extern int (*_XErrorFunction)(
+    Display*		/* dpy */,
+    XErrorEvent*	/* error_event */
+);
+extern void _XEatData(
+    Display*		/* dpy */,
+    unsigned long	/* n */
+) _XLIB_COLD;
+extern void _XEatDataWords(
+    Display*		/* dpy */,
+    unsigned long	/* n */
+) _XLIB_COLD;
+#if defined(__SUNPRO_C) /* Studio compiler alternative to "cold" attribute */
+# pragma rarely_called(_XEatData, _XEatDataWords)
+#endif
+extern char *_XAllocScratch(
+    Display*		/* dpy */,
+    unsigned long	/* nbytes */
+);
+extern char *_XAllocTemp(
+    Display*		/* dpy */,
+    unsigned long	/* nbytes */
+);
+extern void _XFreeTemp(
+    Display*		/* dpy */,
+    char*		/* buf */,
+    unsigned long	/* nbytes */
+);
+extern Visual *_XVIDtoVisual(
+    Display*	/* dpy */,
+    VisualID	/* id */
+);
+extern unsigned long _XSetLastRequestRead(
+    Display*		/* dpy */,
+    xGenericReply*	/* rep */
+);
+extern int _XGetHostname(
+    char*	/* buf */,
+    int		/* maxlen */
+);
+extern Screen *_XScreenOfWindow(
+    Display*	/* dpy */,
+    Window	/* w */
+);
+extern Bool _XAsyncErrorHandler(
+    Display*	/* dpy */,
+    xReply*	/* rep */,
+    char*	/* buf */,
+    int		/* len */,
+    XPointer	/* data */
+);
+extern char *_XGetAsyncReply(
+    Display*	/* dpy */,
+    char*	/* replbuf */,
+    xReply*	/* rep */,
+    char*	/* buf */,
+    int		/* len */,
+    int		/* extra */,
+    Bool	/* discard */
+);
+extern void _XGetAsyncData(
+    Display*	/* dpy */,
+    char *	/* data */,
+    char *	/* buf */,
+    int		/* len */,
+    int		/* skip */,
+    int		/* datalen */,
+    int		/* discardtotal */
+);
+extern void _XFlush(
+    Display*	/* dpy */
+);
+extern int _XEventsQueued(
+    Display*	/* dpy */,
+    int 	/* mode */
+);
+extern void _XReadEvents(
+    Display*	/* dpy */
+);
+extern int _XRead(
+    Display*	/* dpy */,
+    char*	/* data */,
+    long	/* size */
+);
+extern void _XReadPad(
+    Display*	/* dpy */,
+    char*	/* data */,
+    long	/* size */
+);
+extern void _XSend(
+    Display*		/* dpy */,
+    _Xconst char*	/* data */,
+    long		/* size */
+);
+extern Status _XReply(
+    Display*	/* dpy */,
+    xReply*	/* rep */,
+    int		/* extra */,
+    Bool	/* discard */
+);
+extern void _XEnq(
+    Display*	/* dpy */,
+    xEvent*	/* event */
+);
+extern void _XDeq(
+    Display*	/* dpy */,
+    _XQEvent*	/* prev */,
+    _XQEvent*	/* qelt */
+);
+
+extern Bool _XUnknownWireEvent(
+    Display*	/* dpy */,
+    XEvent*	/* re */,
+    xEvent*	/* event */
+);
+
+extern Bool _XUnknownWireEventCookie(
+    Display*	/* dpy */,
+    XGenericEventCookie*	/* re */,
+    xEvent*	/* event */
+);
+
+extern Bool _XUnknownCopyEventCookie(
+    Display*	/* dpy */,
+    XGenericEventCookie*	/* in */,
+    XGenericEventCookie*	/* out */
+);
+
+extern Status _XUnknownNativeEvent(
+    Display*	/* dpy */,
+    XEvent*	/* re */,
+    xEvent*	/* event */
+);
+
+extern Bool _XWireToEvent(Display *dpy, XEvent *re, xEvent *event);
+extern Bool _XDefaultWireError(Display *display, XErrorEvent *he, xError *we);
+extern Bool _XPollfdCacheInit(Display *dpy);
+extern void _XPollfdCacheAdd(Display *dpy, int fd);
+extern void _XPollfdCacheDel(Display *dpy, int fd);
+extern XID _XAllocID(Display *dpy);
+extern void _XAllocIDs(Display *dpy, XID *ids, int count);
+
+extern int _XFreeExtData(
+    XExtData*	/* extension */
+);
+
+extern int (*XESetCreateGC(
+    Display*		/* display */,
+    int			/* extension */,
+    int (*) (
+	      Display*			/* display */,
+	      GC			/* gc */,
+	      XExtCodes*		/* codes */
+	    )		/* proc */
+))(
+    Display*, GC, XExtCodes*
+);
+
+extern int (*XESetCopyGC(
+    Display*		/* display */,
+    int			/* extension */,
+    int (*) (
+	      Display*			/* display */,
+              GC			/* gc */,
+              XExtCodes*		/* codes */
+            )		/* proc */
+))(
+    Display*, GC, XExtCodes*
+);
+
+extern int (*XESetFlushGC(
+    Display*		/* display */,
+    int			/* extension */,
+    int (*) (
+	      Display*			/* display */,
+              GC			/* gc */,
+              XExtCodes*		/* codes */
+            )		/* proc */
+))(
+    Display*, GC, XExtCodes*
+);
+
+extern int (*XESetFreeGC(
+    Display*		/* display */,
+    int			/* extension */,
+    int (*) (
+	      Display*			/* display */,
+              GC			/* gc */,
+              XExtCodes*		/* codes */
+            )		/* proc */
+))(
+    Display*, GC, XExtCodes*
+);
+
+extern int (*XESetCreateFont(
+    Display*		/* display */,
+    int			/* extension */,
+    int (*) (
+	      Display*			/* display */,
+              XFontStruct*		/* fs */,
+              XExtCodes*		/* codes */
+            )		/* proc */
+))(
+    Display*, XFontStruct*, XExtCodes*
+);
+
+extern int (*XESetFreeFont(
+    Display*		/* display */,
+    int			/* extension */,
+    int (*) (
+	      Display*			/* display */,
+              XFontStruct*		/* fs */,
+              XExtCodes*		/* codes */
+            )		/* proc */
+))(
+    Display*, XFontStruct*, XExtCodes*
+);
+
+extern int (*XESetCloseDisplay(
+    Display*		/* display */,
+    int			/* extension */,
+    int (*) (
+	      Display*			/* display */,
+              XExtCodes*		/* codes */
+            )		/* proc */
+))(
+    Display*, XExtCodes*
+);
+
+extern int (*XESetError(
+    Display*		/* display */,
+    int			/* extension */,
+    int (*) (
+	      Display*			/* display */,
+              xError*			/* err */,
+              XExtCodes*		/* codes */,
+              int*			/* ret_code */
+            )		/* proc */
+))(
+    Display*, xError*, XExtCodes*, int*
+);
+
+extern char* (*XESetErrorString(
+    Display*		/* display */,
+    int			/* extension */,
+    char* (*) (
+	        Display*		/* display */,
+                int			/* code */,
+                XExtCodes*		/* codes */,
+                char*			/* buffer */,
+                int			/* nbytes */
+              )		/* proc */
+))(
+    Display*, int, XExtCodes*, char*, int
+);
+
+extern void (*XESetPrintErrorValues (
+    Display*		/* display */,
+    int			/* extension */,
+    void (*)(
+	      Display*			/* display */,
+	      XErrorEvent*		/* ev */,
+	      void*			/* fp */
+	     )		/* proc */
+))(
+    Display*, XErrorEvent*, void*
+);
+
+extern Bool (*XESetWireToEvent(
+    Display*		/* display */,
+    int			/* event_number */,
+    Bool (*) (
+	       Display*			/* display */,
+               XEvent*			/* re */,
+               xEvent*			/* event */
+             )		/* proc */
+))(
+    Display*, XEvent*, xEvent*
+);
+
+extern Bool (*XESetWireToEventCookie(
+    Display*		/* display */,
+    int			/* extension */,
+    Bool (*) (
+	       Display*			/* display */,
+               XGenericEventCookie*	/* re */,
+               xEvent*			/* event */
+             )		/* proc */
+))(
+    Display*, XGenericEventCookie*, xEvent*
+);
+
+extern Bool (*XESetCopyEventCookie(
+    Display*		/* display */,
+    int			/* extension */,
+    Bool (*) (
+	       Display*			/* display */,
+               XGenericEventCookie*	/* in */,
+               XGenericEventCookie*	/* out */
+             )		/* proc */
+))(
+    Display*, XGenericEventCookie*, XGenericEventCookie*
+);
+
+
+extern Status (*XESetEventToWire(
+    Display*		/* display */,
+    int			/* event_number */,
+    Status (*) (
+	      Display*			/* display */,
+              XEvent*			/* re */,
+              xEvent*			/* event */
+            )		/* proc */
+))(
+    Display*, XEvent*, xEvent*
+);
+
+extern Bool (*XESetWireToError(
+    Display*		/* display */,
+    int			/* error_number */,
+    Bool (*) (
+	       Display*			/* display */,
+	       XErrorEvent*		/* he */,
+	       xError*			/* we */
+            )		/* proc */
+))(
+    Display*, XErrorEvent*, xError*
+);
+
+extern void (*XESetBeforeFlush(
+    Display*		/* display */,
+    int			/* error_number */,
+    void (*) (
+	       Display*			/* display */,
+	       XExtCodes*		/* codes */,
+	       _Xconst char*		/* data */,
+	       long			/* len */
+            )		/* proc */
+))(
+    Display*, XExtCodes*, _Xconst char*, long
+);
+
+/* internal connections for IMs */
+
+typedef void (*_XInternalConnectionProc)(
+    Display*			/* dpy */,
+    int				/* fd */,
+    XPointer			/* call_data */
+);
+
+
+extern Status _XRegisterInternalConnection(
+    Display*			/* dpy */,
+    int				/* fd */,
+    _XInternalConnectionProc	/* callback */,
+    XPointer			/* call_data */
+);
+
+extern void _XUnregisterInternalConnection(
+    Display*			/* dpy */,
+    int				/* fd */
+);
+
+extern void _XProcessInternalConnection(
+    Display*			/* dpy */,
+    struct _XConnectionInfo*	/* conn_info */
+);
+
+/* Display structure has pointers to these */
+
+struct _XConnectionInfo {	/* info from _XRegisterInternalConnection */
+    int fd;
+    _XInternalConnectionProc read_callback;
+    XPointer call_data;
+    XPointer *watch_data;	/* set/used by XConnectionWatchProc */
+    struct _XConnectionInfo *next;
+};
+
+struct _XConnWatchInfo {	/* info from XAddConnectionWatch */
+    XConnectionWatchProc fn;
+    XPointer client_data;
+    struct _XConnWatchInfo *next;
+};
+
+#ifdef __UNIXOS2__
+extern char* __XOS2RedirRoot(
+    char*
+);
+#endif
+
+extern int _XTextHeight(
+    XFontStruct*	/* font_struct */,
+    _Xconst char*	/* string */,
+    int			/* count */
+);
+
+extern int _XTextHeight16(
+    XFontStruct*	/* font_struct */,
+    _Xconst XChar2b*	/* string */,
+    int			/* count */
+);
+
+#if defined(WIN32)
+
+extern int _XOpenFile(
+    _Xconst char*	/* path */,
+    int			/* flags */
+);
+
+extern int _XOpenFileMode(
+    _Xconst char*	/* path */,
+    int			/* flags */,
+    mode_t              /* mode */
+);
+
+extern void* _XFopenFile(
+    _Xconst char*	/* path */,
+    _Xconst char*	/* mode */
+);
+
+extern int _XAccessFile(
+    _Xconst char*	/* path */
+);
+#else
+#define _XOpenFile(path,flags) open(path,flags)
+#define _XOpenFileMode(path,flags,mode) open(path,flags,mode)
+#define _XFopenFile(path,mode) fopen(path,mode)
+#endif
+
+/* EvToWire.c */
+extern Status _XEventToWire(Display *dpy, XEvent *re, xEvent *event);
+
+extern int _XF86LoadQueryLocaleFont(
+    Display*		/* dpy */,
+    _Xconst char*	/* name*/,
+    XFontStruct**	/* xfp*/,
+    Font*		/* fidp */
+);
+
+extern void _XProcessWindowAttributes (
+    register Display *dpy,
+    xChangeWindowAttributesReq *req,
+    register unsigned long valuemask,
+    register XSetWindowAttributes *attributes);
+
+extern int _XDefaultError(
+        Display *dpy,
+        XErrorEvent *event);
+
+extern int _XDefaultIOError(
+        Display *dpy);
+
+extern void _XSetClipRectangles (
+    register Display *dpy,
+    GC gc,
+    int clip_x_origin, int clip_y_origin,
+    XRectangle *rectangles,
+    int n,
+    int ordering);
+
+Status _XGetWindowAttributes(
+    register Display *dpy,
+    Window w,
+    XWindowAttributes *attr);
+
+int _XPutBackEvent (
+    register Display *dpy,
+    register XEvent *event);
+
+extern Bool _XIsEventCookie(
+        Display *dpy,
+        XEvent *ev);
+
+extern void _XFreeEventCookies(
+        Display *dpy);
+
+extern void _XStoreEventCookie(
+        Display *dpy,
+        XEvent *ev);
+
+extern Bool _XFetchEventCookie(
+        Display *dpy,
+        XGenericEventCookie *ev);
+
+extern Bool _XCopyEventCookie(
+        Display *dpy,
+        XGenericEventCookie *in,
+        XGenericEventCookie *out);
+
+/* lcFile.c */
+
+extern void xlocaledir(
+    char *buf,
+    int buf_len
+);
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+_XFUNCPROTOEND
+
+#endif /* _X11_XLIBINT_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xlocale.h b/ThirdParty/X11/Include/X11/Xlocale.h
new file mode 100644
index 0000000000000000000000000000000000000000..db46e70cb508404547ca6a47edf97bc2498cf2ea
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xlocale.h
@@ -0,0 +1,37 @@
+/*
+
+Copyright 1991, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+
+#ifndef _X11_XLOCALE_H_
+#define _X11_XLOCALE_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/Xosdefs.h>
+
+#include <locale.h>
+
+#endif /* _X11_XLOCALE_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xmd.h b/ThirdParty/X11/Include/X11/Xmd.h
new file mode 100644
index 0000000000000000000000000000000000000000..492465e6c4ae7bad5a097e69fb8934d534ceda17
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmd.h
@@ -0,0 +1,142 @@
+/***********************************************************
+
+Copyright 1987, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+#ifndef XMD_H
+# define XMD_H 1
+/*
+ *  Xmd.h: MACHINE DEPENDENT DECLARATIONS.
+ */
+
+/*
+ * Special per-machine configuration flags.
+ */
+# if defined(__sun) && defined(__SVR4)
+#  include <sys/isa_defs.h> /* Solaris: defines _LP64 if necessary */
+# endif
+
+# if defined (_LP64) || defined(__LP64__) || \
+     defined(__alpha) || defined(__alpha__) || \
+     defined(__ia64__) || defined(ia64) || \
+     defined(__sparc64__) || \
+     defined(__s390x__) || \
+     defined(__amd64__) || defined(amd64) || \
+     defined(__powerpc64__)
+#  if !defined(__ILP32__) /* amd64-x32 is 32bit */
+#   define LONG64				/* 32/64-bit architecture */
+#  endif /* !__ILP32__ */
+# endif
+
+/*
+ * Definition of macro used to set constants for size of network structures;
+ * machines with preprocessors that can't handle all of the sz_ symbols
+ * can define this macro to be sizeof(x) if and only if their compiler doesn't
+ * pad out structures (esp. the xTextElt structure which contains only two
+ * one-byte fields).  Network structures should always define sz_symbols.
+ *
+ * The sz_ prefix is used instead of something more descriptive so that the
+ * symbols are no more than 32 characters long (which causes problems for some
+ * compilers and preprocessors).
+ *
+ * The extra indirection is to get macro arguments to expand correctly before
+ * the concatenation, rather than afterward.
+ */
+# define _SIZEOF(x) sz_##x
+# define SIZEOF(x) _SIZEOF(x)
+
+/*
+ * Bitfield suffixes for the protocol structure elements, if you
+ * need them.  Note that bitfields are not guaranteed to be signed
+ * (or even unsigned) according to ANSI C.
+ */
+# define B32 /* bitfield not needed on architectures with native 32-bit type */
+# define B16 /* bitfield not needed on architectures with native 16-bit type */
+# ifdef LONG64
+typedef long INT64;
+typedef int INT32;
+# else
+typedef long INT32;
+# endif
+typedef short INT16;
+
+typedef signed char    INT8;
+
+# ifdef LONG64
+typedef unsigned long CARD64;
+typedef unsigned int CARD32;
+# else
+typedef unsigned long long CARD64;
+typedef unsigned long CARD32;
+# endif
+typedef unsigned short CARD16;
+typedef unsigned char  CARD8;
+
+typedef CARD32		BITS32;
+typedef CARD16		BITS16;
+
+typedef CARD8		BYTE;
+typedef CARD8		BOOL;
+
+/*
+ * was definitions for sign-extending bitfields on architectures without
+ * native types smaller than 64-bit, now just backwards compatibility
+ */
+# define cvtINT8toInt(val) (val)
+# define cvtINT16toInt(val) (val)
+# define cvtINT32toInt(val) (val)
+# define cvtINT8toShort(val) (val)
+# define cvtINT16toShort(val) (val)
+# define cvtINT32toShort(val) (val)
+# define cvtINT8toLong(val) (val)
+# define cvtINT16toLong(val) (val)
+# define cvtINT32toLong(val) (val)
+
+/*
+ * this version should leave result of type (t *), but that should only be
+ * used when not in MUSTCOPY
+ */
+# define NEXTPTR(p,t) (((t *)(p)) + 1)
+
+#endif /* XMD_H */
diff --git a/ThirdParty/X11/Include/X11/Xmu/Atoms.h b/ThirdParty/X11/Include/X11/Xmu/Atoms.h
new file mode 100644
index 0000000000000000000000000000000000000000..fc59b31802080c0140a76636aaef693235872800
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmu/Atoms.h
@@ -0,0 +1,123 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_ATOMS_H_
+#define _XMU_ATOMS_H_
+
+#include <X11/Intrinsic.h>
+#include <X11/Xfuncproto.h>
+
+typedef struct _AtomRec *AtomPtr;
+
+extern AtomPtr
+    _XA_ATOM_PAIR,
+    _XA_CHARACTER_POSITION,
+    _XA_CLASS,
+    _XA_CLIENT_WINDOW,
+    _XA_CLIPBOARD,
+    _XA_COMPOUND_TEXT,
+    _XA_DECNET_ADDRESS,
+    _XA_DELETE,
+    _XA_FILENAME,
+    _XA_HOSTNAME,
+    _XA_IP_ADDRESS,
+    _XA_LENGTH,
+    _XA_LIST_LENGTH,
+    _XA_NAME,
+    _XA_NET_ADDRESS,
+    _XA_NULL,
+    _XA_OWNER_OS,
+    _XA_SPAN,
+    _XA_TARGETS,
+    _XA_TEXT,
+    _XA_TIMESTAMP,
+    _XA_USER,
+    _XA_UTF8_STRING;
+
+#define XA_ATOM_PAIR(d)		XmuInternAtom(d, _XA_ATOM_PAIR)
+#define XA_CHARACTER_POSITION(d) XmuInternAtom(d, _XA_CHARACTER_POSITION)
+#define XA_CLASS(d)		XmuInternAtom(d, _XA_CLASS)
+#define XA_CLIENT_WINDOW(d)	XmuInternAtom(d, _XA_CLIENT_WINDOW)
+#define XA_CLIPBOARD(d)		XmuInternAtom(d, _XA_CLIPBOARD)
+#define XA_COMPOUND_TEXT(d)	XmuInternAtom(d, _XA_COMPOUND_TEXT)
+#define XA_DECNET_ADDRESS(d)	XmuInternAtom(d, _XA_DECNET_ADDRESS)
+#define XA_DELETE(d)		XmuInternAtom(d, _XA_DELETE)
+#define XA_FILENAME(d)		XmuInternAtom(d, _XA_FILENAME)
+#define XA_HOSTNAME(d)		XmuInternAtom(d, _XA_HOSTNAME)
+#define XA_IP_ADDRESS(d)	XmuInternAtom(d, _XA_IP_ADDRESS)
+#define XA_LENGTH(d)		XmuInternAtom(d, _XA_LENGTH)
+#define XA_LIST_LENGTH(d)	XmuInternAtom(d, _XA_LIST_LENGTH)
+#define XA_NAME(d)		XmuInternAtom(d, _XA_NAME)
+#define XA_NET_ADDRESS(d)	XmuInternAtom(d, _XA_NET_ADDRESS)
+#define XA_NULL(d)		XmuInternAtom(d, _XA_NULL)
+#define XA_OWNER_OS(d)		XmuInternAtom(d, _XA_OWNER_OS)
+#define XA_SPAN(d)		XmuInternAtom(d, _XA_SPAN)
+#define XA_TARGETS(d)		XmuInternAtom(d, _XA_TARGETS)
+#define XA_TEXT(d)		XmuInternAtom(d, _XA_TEXT)
+#define XA_TIMESTAMP(d)		XmuInternAtom(d, _XA_TIMESTAMP)
+#define XA_USER(d)		XmuInternAtom(d, _XA_USER)
+#define XA_UTF8_STRING(d)	XmuInternAtom(d, _XA_UTF8_STRING)
+
+_XFUNCPROTOBEGIN
+
+char *XmuGetAtomName
+(
+ Display	*dpy,
+ Atom		atom
+ );
+
+Atom XmuInternAtom
+(
+ Display	*dpy,
+ AtomPtr	atom_ptr
+ );
+
+void XmuInternStrings
+(
+ Display	*dpy,
+ String		*names,
+ Cardinal    	count,
+ Atom		*atoms_return
+);
+
+AtomPtr XmuMakeAtom
+(
+ _Xconst char	*name
+ );
+
+char *XmuNameOfAtom
+(
+ AtomPtr	atom_ptr
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_ATOMS_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xmu/CharSet.h b/ThirdParty/X11/Include/X11/Xmu/CharSet.h
new file mode 100644
index 0000000000000000000000000000000000000000..9d9e53a8fae787cdace0b767813f2f1756761e71
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmu/CharSet.h
@@ -0,0 +1,73 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_CHARSET_H_
+#define _XMU_CHARSET_H_
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+void XmuCopyISOLatin1Lowered
+(
+ char		*dst_return,
+ _Xconst char	*src
+ );
+
+void XmuCopyISOLatin1Uppered
+(
+ char		*dst_return,
+ _Xconst char	*src
+ );
+
+int XmuCompareISOLatin1
+(
+ _Xconst char	*first,
+ _Xconst char	*second
+ );
+
+void XmuNCopyISOLatin1Lowered
+(
+ char		*dst_return,
+ _Xconst char	*src,
+ int		 size
+ );
+
+void XmuNCopyISOLatin1Uppered
+(
+ char		*dst_return,
+ _Xconst char	*src,
+ int		size
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_CHARSET_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xmu/CloseHook.h b/ThirdParty/X11/Include/X11/Xmu/CloseHook.h
new file mode 100644
index 0000000000000000000000000000000000000000..1b895a96e0b24afd1533b8937931d8205a71efd5
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmu/CloseHook.h
@@ -0,0 +1,70 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_CLOSEHOOK_H_
+#define _XMU_CLOSEHOOK_H_
+
+#include <X11/Xlib.h>
+#include <X11/Xfuncproto.h>
+#include <X11/Xlibint.h>
+
+typedef XPointer CloseHook;
+
+typedef int (*XmuCloseHookProc)(Display *dpy, XPointer data);
+
+_XFUNCPROTOBEGIN
+
+CloseHook XmuAddCloseDisplayHook
+(
+ Display		*dpy,
+ XmuCloseHookProc	proc,
+ XPointer		arg
+ );
+
+Bool XmuLookupCloseDisplayHook
+(
+ Display		*dpy,
+ CloseHook		handle,
+ XmuCloseHookProc	proc,
+ XPointer		arg
+ );
+
+Bool XmuRemoveCloseDisplayHook
+(
+ Display		*dpy,
+ CloseHook		handle,
+ XmuCloseHookProc	proc,
+ XPointer		arg
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_CLOSEHOOK_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xmu/Converters.h b/ThirdParty/X11/Include/X11/Xmu/Converters.h
new file mode 100644
index 0000000000000000000000000000000000000000..19ece564cfa307c4b0540ee9b56d092e92fce93e
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmu/Converters.h
@@ -0,0 +1,277 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_STRCONVERT_H_
+#define _XMU_STRCONVERT_H_
+
+#include <X11/Intrinsic.h>
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+void XmuCvtFunctionToCallback
+(
+ XrmValue		*args,
+ Cardinal		*num_args,
+ XrmValuePtr		fromVal,
+ XrmValuePtr		toVal
+ );
+
+#define XtNbackingStore "backingStore"
+#define XtCBackingStore "BackingStore"
+#define XtRBackingStore "BackingStore"
+#define XtEnotUseful "notUseful"
+#define XtEwhenMapped "whenMapped"
+#define XtEalways "always"
+#define XtEdefault "default"
+void XmuCvtStringToBackingStore
+(
+ XrmValue		*args,
+ Cardinal		*num_args,
+ XrmValuePtr		fromVal,
+ XrmValuePtr		toVal
+ );
+
+Boolean XmuCvtBackingStoreToString
+(
+ Display		*dpy,
+ XrmValue		*args,
+ Cardinal		*num_args,
+ XrmValuePtr		fromVal,
+ XrmValuePtr		toVal,
+ XtPointer		*converter_data
+ );
+
+void XmuCvtStringToCursor
+(
+ XrmValue		*args,
+ Cardinal		*num_args,
+ XrmValuePtr		fromVal,
+ XrmValuePtr		toVal
+ );
+
+#define XtRColorCursor "ColorCursor"
+#define XtNpointerColor "pointerColor"
+#define XtNpointerColorBackground "pointerColorBackground"
+Boolean XmuCvtStringToColorCursor
+(
+ Display		*dpy,
+ XrmValue		*args,
+ Cardinal		*num_args,
+ XrmValuePtr		fromVal,
+ XrmValuePtr		toVal,
+ XtPointer		*converter_data
+ );
+
+typedef int XtGravity;
+
+#ifndef XtRGravity
+#define XtRGravity "Gravity"
+#endif
+#define XtEForget "forget"
+#define XtENorthWest "northwest"
+#define XtENorth "north"
+#define XtENorthEast "northeast"
+#define XtEWest "west"
+#define XtECenter "center"
+#define XtEEast "east"
+#define XtESouthWest "southwest"
+#define XtESouth "south"
+#define XtESouthEast "southeast"
+#define XtEStatic "static"
+#define XtEUnmap "unmap"
+void XmuCvtStringToGravity
+(
+ XrmValue		*args,
+ Cardinal		*num_args,
+ XrmValuePtr		fromVal,
+ XrmValuePtr		toVal
+ );
+
+Boolean XmuCvtGravityToString
+(
+ Display		*dpy,
+ XrmValue		*args,
+ Cardinal		*num_args,
+ XrmValuePtr		fromVal,
+ XrmValuePtr		toVal,
+ XtPointer		*converter_data
+ );
+
+typedef enum {
+    XtJustifyLeft,       /* justify text to left side of button   */
+    XtJustifyCenter,     /* justify text in center of button      */
+    XtJustifyRight       /* justify text to right side of button  */
+} XtJustify;
+#ifndef XtRJustify
+#define XtRJustify "Justify"
+#endif
+#define XtEleft "left"
+#define XtEcenter "center"
+#define XtEright "right"
+#define XtEtop "top"
+#define XtEbottom "bottom"
+void XmuCvtStringToJustify
+(
+ XrmValue		*args,
+ Cardinal		*num_args,
+ XrmValuePtr		fromVal,
+ XrmValuePtr		toVal
+ );
+
+Boolean XmuCvtJustifyToString
+(
+ Display		*dpy,
+ XrmValue		*args,
+ Cardinal		*num_args,
+ XrmValuePtr		fromVal,
+ XrmValuePtr		toVal,
+ XtPointer		*converter_data
+ );
+
+#define XtRLong "Long"
+void XmuCvtStringToLong
+(
+ XrmValue		*args,
+ Cardinal		*num_args,
+ XrmValuePtr		fromVal,
+ XrmValuePtr		toVal
+ );
+Boolean XmuCvtLongToString
+(
+ Display		*dpy,
+ XrmValue		*args,
+ Cardinal		*num_args,
+ XrmValuePtr		fromVal,
+ XrmValuePtr		toVal,
+ XtPointer		*converter_data
+ );
+
+typedef enum {
+  XtorientHorizontal,
+  XtorientVertical
+} XtOrientation;
+void XmuCvtStringToOrientation
+(
+ XrmValue		*args,
+ Cardinal		*num_args,
+ XrmValuePtr		fromVal,
+ XrmValuePtr		toVal
+ );
+
+Boolean XmuCvtOrientationToString
+(
+ Display		*dpy,
+ XrmValue		*args,
+ Cardinal		*num_args,
+ XrmValuePtr		fromVal,
+ XrmValuePtr		toVal,
+ XtPointer		*converter_data
+ );
+
+void XmuCvtStringToBitmap
+(
+ XrmValue		*args,
+ Cardinal		*num_args,
+ XrmValuePtr		fromVal,
+ XrmValuePtr		toVal
+ );
+
+#define XtRShapeStyle "ShapeStyle"
+#define XtERectangle "Rectangle"
+#define XtEOval "Oval"
+#define XtEEllipse "Ellipse"
+#define XtERoundedRectangle "RoundedRectangle"
+
+#define XmuShapeRectangle 1
+#define XmuShapeOval 2
+#define XmuShapeEllipse 3
+#define XmuShapeRoundedRectangle 4
+
+Boolean XmuCvtStringToShapeStyle
+(
+ Display		*dpy,
+ XrmValue		*args,
+ Cardinal		*num_args,
+ XrmValuePtr		fromVal,
+ XrmValuePtr		toVal,
+ XtPointer		*converter_data
+ );
+
+Boolean XmuCvtShapeStyleToString
+(
+ Display		*dpy,
+ XrmValue		*args,
+ Cardinal		*num_args,
+ XrmValuePtr		fromVal,
+ XrmValuePtr		toVal,
+ XtPointer		*converter_data
+ );
+
+Boolean XmuReshapeWidget
+(
+ Widget			w,
+ int			shape_style,
+ int			corner_width,
+ int			corner_height
+ );
+
+void XmuCvtStringToWidget
+(
+ XrmValue		*args,
+ Cardinal		*num_args,
+ XrmValuePtr		fromVal,
+ XrmValuePtr		toVal
+ );
+
+Boolean XmuNewCvtStringToWidget
+(
+ Display		*display,
+ XrmValue		*args,
+ Cardinal		*num_args,
+ XrmValue		*fromVal,
+ XrmValue		*toVal,
+ XtPointer		*converter_data
+ );
+
+Boolean XmuCvtWidgetToString
+(
+ Display		*dpy,
+ XrmValue		*args,
+ Cardinal		*num_args,
+ XrmValue		*fromVal,
+ XrmValue		*toVal,
+ XtPointer		*converter_data
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_STRCONVERT_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xmu/CurUtil.h b/ThirdParty/X11/Include/X11/Xmu/CurUtil.h
new file mode 100644
index 0000000000000000000000000000000000000000..ab577a252909f250cb15eea84ff46c0e440204db
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmu/CurUtil.h
@@ -0,0 +1,46 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_CURUTIL_H_
+#define _XMU_CURUTIL_H_
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+int XmuCursorNameToIndex
+(
+ _Xconst char	*name
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_CURUTIL_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xmu/CvtCache.h b/ThirdParty/X11/Include/X11/Xmu/CvtCache.h
new file mode 100644
index 0000000000000000000000000000000000000000..714a4984efcdf26f744a0a2b85232432e62a4d1d
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmu/CvtCache.h
@@ -0,0 +1,59 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ *			       Public Interfaces
+ *
+ * XmuCvtCache *XmuCvtCacheLookupDisplay (dpy)
+ *     Display *dpy;
+ */
+
+#ifndef _XMU_CVTCACHE_H_
+#define _XMU_CVTCACHE_H_
+
+#include <X11/Xmu/DisplayQue.h>
+#include <X11/Xfuncproto.h>
+
+typedef struct _XmuCvtCache {
+    struct {
+	char **bitmapFilePath;
+    } string_to_bitmap;
+    /* add other per-display data that needs to be cached */
+} XmuCvtCache;
+
+_XFUNCPROTOBEGIN
+
+XmuCvtCache *_XmuCCLookupDisplay
+(
+ Display	*dpy
+ );
+
+extern void _XmuStringToBitmapInitCache(XmuCvtCache *c);
+extern void _XmuStringToBitmapFreeCache(XmuCvtCache *c);
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_CVTCACHE_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xmu/DisplayQue.h b/ThirdParty/X11/Include/X11/Xmu/DisplayQue.h
new file mode 100644
index 0000000000000000000000000000000000000000..ffc82a2c03afa14ef7133e52603d399f2f29808b
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmu/DisplayQue.h
@@ -0,0 +1,152 @@
+/*
+
+Copyright 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _XMU_DISPLAYQUE_H_
+#define _XMU_DISPLAYQUE_H_
+
+#include <X11/Xmu/CloseHook.h>
+#include <X11/Xfuncproto.h>
+
+/*
+ *			      Public Entry Points
+ *
+ *
+ * XmuDisplayQueue *XmuDQCreate (closefunc, freefunc, data)
+ *     XmuCloseDisplayQueueProc closefunc;
+ *     XmuFreeDisplayQueueProc freefunc;
+ *     XPointer data;
+ *
+ *         Creates and returns a queue into which displays may be placed.  When
+ *         the display is closed, the closefunc (if non-NULL) is upcalled with
+ *         as follows:
+ *
+ *                 (*closefunc) (queue, entry)
+ *
+ *         The freeproc, if non-NULL, is called whenever the last display is
+ *         closed, notifying the creator that display queue may be released
+ *         using XmuDQDestroy.
+ *
+ *
+ * Bool XmuDQDestroy (q, docallbacks)
+ *     XmuDisplayQueue *q;
+ *     Bool docallbacks;
+ *
+ *         Releases all memory for the indicated display queue.  If docallbacks
+ *         is true, then the closefunc (if non-NULL) is called for each
+ *         display.
+ *
+ *
+ * XmuDisplayQueueEntry *XmuDQLookupDisplay (q, dpy)
+ *     XmuDisplayQueue *q;
+ *     Display *dpy;
+ *
+ *         Returns the queue entry for the specified display or NULL if the
+ *         display is not in the queue.
+ *
+ *
+ * XmuDisplayQueueEntry *XmuDQAddDisplay (q, dpy, data)
+ *     XmuDisplayQueue *q;
+ *     Display *dpy;
+ *     XPointer data;
+ *
+ *         Adds the indicated display to the end of the queue or NULL if it
+ *         is unable to allocate memory.  The data field may be used by the
+ *         caller to attach arbitrary data to this display in this queue.  The
+ *         caller should use XmuDQLookupDisplay to make sure that the display
+ *         hasn't already been added.
+ *
+ *
+ * Bool XmuDQRemoveDisplay (q, dpy)
+ *     XmuDisplayQueue *q;
+ *     Display *dpy;
+ *
+ *         Removes the specified display from the given queue.  If the
+ *         indicated display is not found on this queue, False is returned,
+ *         otherwise True is returned.
+ */
+
+typedef struct _XmuDisplayQueue XmuDisplayQueue;
+typedef struct _XmuDisplayQueueEntry XmuDisplayQueueEntry;
+
+typedef int (*XmuCloseDisplayQueueProc)(XmuDisplayQueue *queue,
+					XmuDisplayQueueEntry *entry);
+
+typedef int (*XmuFreeDisplayQueueProc)(XmuDisplayQueue *queue);
+
+struct _XmuDisplayQueueEntry {
+    struct _XmuDisplayQueueEntry *prev, *next;
+    Display *display;
+    CloseHook closehook;
+    XPointer data;
+};
+
+struct _XmuDisplayQueue {
+    int nentries;
+    XmuDisplayQueueEntry *head, *tail;
+    XmuCloseDisplayQueueProc closefunc;
+    XmuFreeDisplayQueueProc freefunc;
+    XPointer data;
+};
+
+_XFUNCPROTOBEGIN
+
+XmuDisplayQueue *XmuDQCreate
+(
+ XmuCloseDisplayQueueProc	closefunc,
+ XmuFreeDisplayQueueProc	freefunc,
+ XPointer			data
+ );
+
+Bool XmuDQDestroy
+(
+ XmuDisplayQueue		*q,
+ Bool				docallbacks
+ );
+
+XmuDisplayQueueEntry *XmuDQLookupDisplay
+(
+ XmuDisplayQueue		*q,
+ Display			*dpy
+ );
+
+XmuDisplayQueueEntry *XmuDQAddDisplay
+(
+ XmuDisplayQueue		*q,
+ Display			*dpy,
+ XPointer			data
+ );
+
+Bool XmuDQRemoveDisplay
+(
+ XmuDisplayQueue		*q,
+ Display			*dpy
+ );
+
+_XFUNCPROTOEND
+
+#define XmuDQNDisplays(q) ((q)->nentries)
+
+#endif /* _XMU_DISPLAYQUE_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xmu/Drawing.h b/ThirdParty/X11/Include/X11/Xmu/Drawing.h
new file mode 100644
index 0000000000000000000000000000000000000000..717292aec798f55957f65792a8c8abd1affb9a69
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmu/Drawing.h
@@ -0,0 +1,158 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_DRAWING_H_
+#define _XMU_DRAWING_H_
+
+#include <X11/Xlib.h>
+#include <X11/Xfuncproto.h>
+
+#include <stdio.h>
+#if ! defined(_XtIntrinsic_h) && ! defined(PIXEL_ALREADY_TYPEDEFED)
+typedef unsigned long Pixel;
+#endif
+
+_XFUNCPROTOBEGIN
+
+void XmuDrawRoundedRectangle
+(
+ Display		*dpy,
+ Drawable	 	draw,
+ GC 			gc,
+ int			x,
+ int			y,
+ int			w,
+ int			h,
+ int			ew,
+ int			eh
+ );
+
+void XmuFillRoundedRectangle
+(
+ Display		*dpy,
+ Drawable 		draw,
+ GC 			gc,
+ int			x,
+ int			y,
+ int			w,
+ int			h,
+ int			ew,
+ int			eh
+ );
+
+void XmuDrawLogo
+(
+ Display		*dpy,
+ Drawable 		drawable,
+ GC			gcFore,
+ GC			gcBack,
+ int			x,
+ int			y,
+ unsigned int		width,
+ unsigned int		height
+ );
+
+Pixmap XmuCreatePixmapFromBitmap
+(
+ Display		*dpy,
+ Drawable 		d,
+ Pixmap 		bitmap,
+ unsigned int		width,
+ unsigned int		height,
+ unsigned int		depth,
+ unsigned long		fore,
+ unsigned long		back
+);
+
+Pixmap XmuCreateStippledPixmap
+(
+ Screen			*screen,
+ Pixel			fore,
+ Pixel			back,
+ unsigned int		depth
+ );
+
+void XmuReleaseStippledPixmap
+(
+ Screen			*screen,
+ Pixmap 		pixmap
+ );
+
+Pixmap XmuLocateBitmapFile
+(
+ Screen			*screen,
+ _Xconst char		*name,
+ char			*srcname_return,
+ int 			srcnamelen,
+ int			*width_return,
+ int			*height_return,
+ int			*xhot_return,
+ int			*yhot_return
+ );
+
+Pixmap XmuLocatePixmapFile
+(
+ Screen			*screen,
+ _Xconst char		*name,
+ unsigned long		fore,
+ unsigned long		back,
+ unsigned int		depth,
+ char			*srcname_return,
+ int 			srcnamelen,
+ int			*width_return,
+ int			*height_return,
+ int			*xhot_return,
+ int			*yhot_return
+ );
+
+int XmuReadBitmapData
+(
+ FILE			*fstream,
+ unsigned int		*width_return,
+ unsigned int		*height_return,
+ unsigned char		**datap_return,
+ int			*xhot_return,
+ int			*yhot_return
+);
+
+int XmuReadBitmapDataFromFile
+(
+ _Xconst char		*filename,
+ unsigned int		*width_return,
+ unsigned int		*height_return,
+ unsigned char		**datap_return,
+ int			*xhot_return,
+ int			*yhot_return
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_DRAWING_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xmu/Editres.h b/ThirdParty/X11/Include/X11/Xmu/Editres.h
new file mode 100644
index 0000000000000000000000000000000000000000..0c1ffe0753c97019727e0a4131c78734f4d07ea1
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmu/Editres.h
@@ -0,0 +1,39 @@
+/*
+
+Copyright 1991, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+void _XEditResCheckMessages
+(
+ Widget			w,
+ XtPointer		data,
+ XEvent			*event,
+ Boolean		*cont
+);
+
+_XFUNCPROTOEND
diff --git a/ThirdParty/X11/Include/X11/Xmu/EditresP.h b/ThirdParty/X11/Include/X11/Xmu/EditresP.h
new file mode 100644
index 0000000000000000000000000000000000000000..ed9dd41eae262605600adc19d6628475f00df59c
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmu/EditresP.h
@@ -0,0 +1,406 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author:  Chris D. Peterson, MIT X Consortium
+ */
+
+/************************************************************
+
+		The Editres Protocol
+
+
+  The Client message sent to the application is:
+
+  ATOM = "ResEditor" 		--- RES_EDITOR_NAME
+
+  FORMAT = 32                   --- RES_EDIT_SEND_EVENT_FORMAT
+
+  l[0] = timestamp
+  l[1] = command atom name
+  l[2] = ident of command
+  l[3] = protocol version number to use
+
+
+
+  The binary protocol has the following format:
+
+	Card8:		8-bit unsingned integer
+	Card16:		16-bit unsingned integer
+	Card32:		32-bit unsingned integer
+	Int16:		16-bit signed integer
+	Window:		32-bit value
+	Widget:		32-bit value
+	String8:        ListOfCard8
+
+	[a][b][c] represent an exclusive list of choices.
+
+	All widgets are passed as a list of widgets, containing the
+	full instance heirarch of this widget.  The hierarchy is ordered
+	from parent to child.  Thus the first element of each list is
+	the root of the widget tree (this makes verifying that the widget
+	still exists, MUCH faster).
+
+	ListOfFoo comprises a list of things in the following format:
+
+	number:			Card16
+	<number> things:	????
+
+  This is a synchronous protocol, every request MUST be followed by a
+  reply.
+
+  Request:
+
+	Serial Number:	Card8
+	Op Code:	Card8 -	{ SendWidgetTree = 0,
+				  SetValues = 1,
+				  GetResources = 2,
+				  GetGeometry = 3,
+				  FindChild = 4,
+				  GetValues = 5 }
+	Length:		Card32
+	Data:
+
+   Reply:
+
+	Serial Number:	Card8
+	Type:		Card8 - { Formatted = 0,
+	                          Unformatted = 1,
+				  ProtocolMismatch = 2
+				}
+	Length:		Card32
+
+
+   Byte Order:
+
+	All Fields are MSB -> LSB
+
+    Data:
+
+    	Formatted:
+
+        	The data contains the reply information for the request as
+		specified below if the reply type is "Formatted".  The return
+		values for the other reply types are shown below.
+
+        Unformatted:
+
+		Message:	String8
+
+	ProtocolMismatch:
+
+		RequestedVersion:   	Card8
+
+------------------------------------------------------------
+
+   SendWidgetTree:
+
+	--->
+
+	Number of Entries:	Card16
+	Entry:
+		widget:		ListOfWidgets
+		name:		String8
+		class:		String8
+		window:		Card32
+         	toolkit:        String8
+
+	Send Widget Tree returns the toolkit type, and a fuly specified list
+        of widgets for each widget in the tree.  This is enough information
+        to completely reconstruct the entire widget heirarchy.
+
+	The window return value contains the Xid of the window currently
+	used by this widget.  If the widget is unrealized then 0 is returned,
+	and if widget is a non-windowed object a value of 2 is returned.
+
+   SetValues:
+
+	name:	String8
+	type:	String8
+	value:  String8
+	Number of Entries:	Card16
+	Entry:
+		widget:		ListOfWidgets
+
+	--->
+
+	Number of Entries:	Card16
+	Entry:
+		widget:		ListOfWidgets
+		message:	String8
+
+	SetValues will allow the same resource to be set on a number of
+	widgets.  This function will return an error message if the SetValues
+	request caused an Xt error.
+
+  GetValues:
+
+        names:                ListOfString8
+        widget:               Widget
+
+        --->
+	novalues:             ListOfCard16
+	values:               ListOfString8
+
+        GetValues will allow a number of resource values to be read
+        on a particular widget.  The request specifies the names of
+	the resources wanted and the widget id these resources are
+	from.  The reply returns a list of indices from the requests
+	name list of resources for which a value can not be returned.
+	It also returns a list of returned values, in the order of the
+        requests names list, skipping those indices present in novalues.
+
+   GetResources:
+
+	Number of Entries:	Card16
+	Entry
+		widget:		ListOfWidgets:
+
+	---->
+
+	Number of Entries:	Card16
+	Entry
+		Widget:			ListOfWidgets:
+		Error:			Bool
+
+		[ Message:		String 8 ]
+		[ Number of Resources:	Card16
+		Resource:
+			Kind:	{normal, constraint}
+			Name:	String8
+			Class:	String8
+			Type:	String8 ]
+
+	GetResource retrieves the kind, name, class and type for every
+	widget passed to it.  If an error occured with the resource fetch
+	Error will be set to True for the given widget and a message
+	is returned rather than the resource info.
+
+  GetGeometry:
+
+	Number of Entries:	Card16
+	Entry
+		Widget:		ListOfWidgets:
+
+	---->
+
+	Number of Entries:	Card16
+	Entry
+		Widget:			ListOfWidgets:
+		Error:			Bool
+
+		[ message:		String 8 ]
+		[ mapped:       Boolean
+		  X: 		Int16
+		  Y:  		Int16
+		  Width: 	Card16
+	      	  Height:	Card16
+		  BorderWidth:	Card16 ]
+
+	GetGeometry retreives the mapping state, x, y, width, height
+	and border width for each widget specified.  If an error occured
+	with the geometry fetch "Error" will be set to True for the given
+	widget and a message is returned rather than the geometry info.
+	X an Y corrospond to the root coordinates of the upper left corner
+	of the widget (outside the window border).
+
+  FindChild:
+
+	Widget:		ListOfWidgets
+	X:		Int16
+	Y:		Int16
+
+	--->
+
+	Widget:		ListOfWidgets
+
+	Find Child returns a descendent of the widget specified that
+	is at the root coordinates specified.
+
+	NOTE:
+
+	The returned widget is undefined if the point is contained in
+	two or more mapped widgets, or in two overlapping Rect objs.
+
+  GetValues:
+
+        names:                ListOfString8
+        widget:               Widget
+
+        --->
+
+	values:               ListOfString8
+
+        GetValues will allow a number of resource values to be read
+        on a particular widget.  Currently only InterViews 3.0.1 Styles
+	and their attributes are supported.  In addition, the current
+	user interface  only supports the return of 1 resource.  The ability
+	to specify and return multiple resources is defined for future editres
+	interfaces where some or all of a widgets resource values are returned
+	and displayed at once.
+
+
+************************************************************/
+
+#include <X11/Intrinsic.h>
+#include <X11/Xfuncproto.h>
+
+#define XER_NBBY 8		/* number of bits in a byte */
+#define BYTE_MASK 255
+
+#define HEADER_SIZE 6
+
+#define EDITRES_IS_OBJECT 2
+#define EDITRES_IS_UNREALIZED 0
+
+/*
+ * Format for atoms
+ */
+#define EDITRES_FORMAT             8
+#define EDITRES_SEND_EVENT_FORMAT 32
+
+/*
+ * Atoms
+ */
+#define EDITRES_NAME         "Editres"
+#define EDITRES_COMMAND_ATOM "EditresCommand"
+#define EDITRES_COMM_ATOM    "EditresComm"
+#define EDITRES_CLIENT_VALUE "EditresClientVal"
+#define EDITRES_PROTOCOL_ATOM "EditresProtocol"
+
+typedef enum {
+  SendWidgetTree = 0,
+	       SetValues      = 1,
+	       GetResources   = 2,
+	       GetGeometry    = 3,
+	       FindChild      = 4,
+	       GetValues      = 5
+} EditresCommand;
+
+typedef enum {
+  NormalResource     = 0,
+  ConstraintResource = 1
+} ResourceType;
+
+/*
+ * The type of a resource identifier
+ */
+typedef unsigned char ResIdent;
+
+typedef enum {
+  PartialSuccess   = 0,
+  Failure	   = 1,
+  ProtocolMismatch = 2
+} EditResError;
+
+typedef struct _WidgetInfo {
+    unsigned short num_widgets;
+  unsigned long *ids;
+    Widget real_widget;
+} WidgetInfo;
+
+typedef struct _ProtocolStream {
+    unsigned long size, alloc;
+    unsigned char *real_top, *top, *current;
+} ProtocolStream;
+
+/************************************************************
+ * Function definitions for reading and writing protocol requests
+ ************************************************************/
+_XFUNCPROTOBEGIN
+
+void _XEditResPutString8
+(
+ ProtocolStream		*stream,
+ _Xconst char		*str
+ );
+
+void _XEditResPut8
+(
+ ProtocolStream		*stream,
+ unsigned int		value
+ );
+
+void _XEditResPut16
+(
+ ProtocolStream		*stream,
+ unsigned int		value
+ );
+
+void _XEditResPut32
+(
+ ProtocolStream		*stream,
+ unsigned long		value
+ );
+
+void _XEditResPutWidgetInfo
+(
+ ProtocolStream		*stream,
+ WidgetInfo		*info
+ );
+
+void _XEditResResetStream
+(
+ ProtocolStream		*stream
+ );
+
+Bool _XEditResGet8
+(
+ ProtocolStream		*stream,
+ unsigned char		*value
+ );
+
+Bool _XEditResGet16
+(
+ ProtocolStream		*stream,
+ unsigned short		*value
+ );
+
+Bool _XEditResGetSigned16
+(
+ ProtocolStream		*stream,
+ short			*value
+ );
+
+Bool _XEditResGet32
+(
+ ProtocolStream		*stream,
+ unsigned long		*value
+ );
+
+Bool _XEditResGetString8
+(
+ ProtocolStream		*stream,
+ char			**str
+ );
+
+Bool _XEditResGetWidgetInfo
+(
+ ProtocolStream		*stream,
+ WidgetInfo		*info
+ );
+
+_XFUNCPROTOEND
diff --git a/ThirdParty/X11/Include/X11/Xmu/Error.h b/ThirdParty/X11/Include/X11/Xmu/Error.h
new file mode 100644
index 0000000000000000000000000000000000000000..e275fea1d9abbef0afaf8d16e2c43797d84f3a40
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmu/Error.h
@@ -0,0 +1,56 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_ERROR_H_
+#define _XMU_ERROR_H_
+
+#include <stdio.h>
+#include <X11/Xlib.h>
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+int XmuPrintDefaultErrorMessage
+(
+ Display		*dpy,
+ XErrorEvent		*event,
+ FILE			*fp
+ );
+
+int XmuSimpleErrorHandler
+(
+ Display		*dpy,
+ XErrorEvent		*errorp
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_ERROR_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xmu/ExtAgent.h b/ThirdParty/X11/Include/X11/Xmu/ExtAgent.h
new file mode 100644
index 0000000000000000000000000000000000000000..b300140122725e1fffb9184b7dd4b8eed3ae6759
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmu/ExtAgent.h
@@ -0,0 +1,41 @@
+/*
+
+Copyright 1994,1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#include <X11/Intrinsic.h>
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+extern void XmuRegisterExternalAgent
+(
+ Widget		w,
+ XtPointer	data,
+ XEvent		*event,
+ Boolean	*cont
+ );
+
+_XFUNCPROTOEND
+
diff --git a/ThirdParty/X11/Include/X11/Xmu/Initer.h b/ThirdParty/X11/Include/X11/Xmu/Initer.h
new file mode 100644
index 0000000000000000000000000000000000000000..415885d0da849dc716fd0d65c610905ddfe60788
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmu/Initer.h
@@ -0,0 +1,55 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_INITER_H_
+#define _XMU_INITER_H_
+
+#include <X11/Intrinsic.h>
+#include <X11/Xfuncproto.h>
+
+typedef void (*XmuInitializerProc)(XtAppContext app_context, XPointer data);
+
+_XFUNCPROTOBEGIN
+
+void XmuCallInitializers
+(
+ XtAppContext		app_context
+ );
+
+void XmuAddInitializer
+(
+ XmuInitializerProc	func,
+ XPointer		data
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_INITER_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xmu/Lookup.h b/ThirdParty/X11/Include/X11/Xmu/Lookup.h
new file mode 100644
index 0000000000000000000000000000000000000000..e99b8b1e5d1d2ea43ad91027f1b1cf43b6e51e34
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmu/Lookup.h
@@ -0,0 +1,124 @@
+/************************************************************
+
+Copyright 1999 by Thomas E. Dickey <dickey@clark.net>
+
+                        All Rights Reserved
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name(s) of the above copyright
+holders shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization.
+
+********************************************************/
+
+#ifndef included_xmu_lookup_h
+#define included_xmu_lookup_h 1
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+extern int XmuLookupString(
+		XKeyEvent *event,
+		unsigned char *buffer,
+		int nbytes,
+		KeySym *keysym,
+		XComposeStatus *status,
+		unsigned long keysymSet);
+
+extern int XmuLookupLatin1(
+		XKeyEvent *event,
+		unsigned char *buffer,
+		int nbytes,
+		KeySym *keysym,
+		XComposeStatus *status);
+
+extern int XmuLookupLatin2(
+		XKeyEvent *event,
+		unsigned char *buffer,
+		int nbytes,
+		KeySym *keysym,
+		XComposeStatus *status);
+
+extern int XmuLookupLatin3(
+		XKeyEvent *event,
+		unsigned char *buffer,
+		int nbytes,
+		KeySym *keysym,
+		XComposeStatus *status);
+
+extern int XmuLookupLatin4(
+		XKeyEvent *event,
+		unsigned char *buffer,
+		int nbytes,
+		KeySym *keysym,
+		XComposeStatus *status);
+
+extern int XmuLookupKana(
+		XKeyEvent *event,
+		unsigned char *buffer,
+		int nbytes,
+		KeySym *keysym,
+		XComposeStatus *status);
+
+extern int XmuLookupJISX0201(
+		XKeyEvent *event,
+		unsigned char *buffer,
+		int nbytes,
+		KeySym *keysym,
+		XComposeStatus *status);
+
+extern int XmuLookupArabic(
+		XKeyEvent *event,
+		unsigned char *buffer,
+		int nbytes,
+		KeySym *keysym,
+		XComposeStatus *status);
+
+extern int XmuLookupCyrillic(
+		XKeyEvent *event,
+		unsigned char *buffer,
+		int nbytes,
+		KeySym *keysym,
+		XComposeStatus *status);
+
+extern int XmuLookupGreek(
+		XKeyEvent *event,
+		unsigned char *buffer,
+		int nbytes,
+		KeySym *keysym,
+		XComposeStatus *status);
+
+extern int XmuLookupAPL(
+		XKeyEvent *event,
+		unsigned char *buffer,
+		int nbytes,
+		KeySym *keysym,
+		XComposeStatus *status);
+
+extern int XmuLookupHebrew(
+		XKeyEvent *event,
+		unsigned char *buffer,
+		int nbytes,
+		KeySym *keysym,
+		XComposeStatus *status);
+
+#endif /* included_xmu_lookup_h */
diff --git a/ThirdParty/X11/Include/X11/Xmu/Misc.h b/ThirdParty/X11/Include/X11/Xmu/Misc.h
new file mode 100644
index 0000000000000000000000000000000000000000..6ae6227c487a8be2953ab700f79d24585fd6632b
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmu/Misc.h
@@ -0,0 +1,63 @@
+/*
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/***********************************************************
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/* Various useful constant and macro definitions */
+
+#ifndef _Xmu_Misc_h
+#define _Xmu_Misc_h
+
+#define MAXDIMENSION	((1 << 31)-1)
+
+#define Max(x, y)	(((x) > (y)) ? (x) : (y))
+#define Min(x, y)	(((x) < (y)) ? (x) : (y))
+#define AssignMax(x, y)	{if ((y) > (x)) x = (y);}
+#define AssignMin(x, y)	{if ((y) < (x)) x = (y);}
+
+#endif /*_Xmu_Misc_h*/
diff --git a/ThirdParty/X11/Include/X11/Xmu/StdCmap.h b/ThirdParty/X11/Include/X11/Xmu/StdCmap.h
new file mode 100644
index 0000000000000000000000000000000000000000..326167375742c27548ef974b30d7835e419adcb7
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmu/StdCmap.h
@@ -0,0 +1,116 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_STDCMAP_H_
+#define _XMU_STDCMAP_H_
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+Status XmuAllStandardColormaps
+(
+ Display		*dpy
+ );
+
+Status XmuCreateColormap
+(
+ Display		*dpy,
+ XStandardColormap	*colormap
+ );
+
+void XmuDeleteStandardColormap
+(
+ Display		*dpy,
+ int			screen,
+ Atom			property
+ );
+
+Status XmuGetColormapAllocation
+(
+ XVisualInfo		*vinfo,
+ Atom			property,
+ unsigned long		*red_max_return,
+ unsigned long		*green_max_return,
+ unsigned long		*blue_max_return
+ );
+
+Status XmuLookupStandardColormap
+(
+ Display		*dpy,
+ int			screen,
+ VisualID		visualid,
+ unsigned int		depth,
+ Atom			property,
+ Bool			replace,
+ Bool			retain
+ );
+
+XStandardColormap *XmuStandardColormap
+(
+ Display		*dpy,
+ int			screen,
+ VisualID		visualid,
+ unsigned int		depth,
+ Atom			property,
+ Colormap		cmap,
+ unsigned long		red_max,
+ unsigned long		green_max,
+ unsigned long		blue_max
+ );
+
+Status XmuVisualStandardColormaps
+(
+ Display		*dpy,
+ int			screen,
+ VisualID		visualid,
+ unsigned int		depth,
+ Bool			replace,
+ Bool			retain
+ );
+
+Bool XmuDistinguishableColors
+(
+ XColor			*colors,
+ int			count
+ );
+
+Bool XmuDistinguishablePixels
+(
+ Display		*dpy,
+ Colormap		cmap,
+ unsigned long		*pixels,
+ int			count
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_STDCMAP_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xmu/StdSel.h b/ThirdParty/X11/Include/X11/Xmu/StdSel.h
new file mode 100644
index 0000000000000000000000000000000000000000..b7808753f39f1f98aac742d0ef5fbf3ce3d6ef92
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmu/StdSel.h
@@ -0,0 +1,54 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_SELECTION_H_
+#define _XMU_SELECTION_H_
+
+#include <X11/Intrinsic.h>
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+Boolean XmuConvertStandardSelection
+(
+ Widget			w,
+ Time			timev,
+ Atom			*selection,
+ Atom			*target,
+ Atom			*type_return,
+ XPointer		*value_return,
+ unsigned long		*length_return,
+ int			*format_return
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_SELECTION_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xmu/SysUtil.h b/ThirdParty/X11/Include/X11/Xmu/SysUtil.h
new file mode 100644
index 0000000000000000000000000000000000000000..da5b189f4f6ee7bb08413253ecd4af19646629a9
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmu/SysUtil.h
@@ -0,0 +1,53 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _SYSUTIL_H_
+#define _SYSUTIL_H_
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+int XmuGetHostname
+(
+    char		*buf_return,
+    int			maxlen
+);
+
+#ifndef _XMU_H_
+int XmuSnprintf
+(
+ char			*str,
+ int			size,
+ _Xconst char		*fmt,
+    ...
+ )
+_X_ATTRIBUTE_PRINTF(3,4);
+#endif
+
+_XFUNCPROTOEND
+
+#endif /* _SYSUTIL_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xmu/WhitePoint.h b/ThirdParty/X11/Include/X11/Xmu/WhitePoint.h
new file mode 100644
index 0000000000000000000000000000000000000000..9f41c4221e00dd367b2432787e70bafdbaa6114f
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmu/WhitePoint.h
@@ -0,0 +1,63 @@
+/*
+
+Copyright 1991, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+
+/*
+ *
+ *	DESCRIPTION
+ *		This file contains a series of standard white point values.
+ */
+#define CIE_A_u		0.2560
+#define CIE_A_v		0.5243
+#define CIE_A_Y		1.0000
+
+#define CIE_B_u		0.2137
+#define CIE_B_v		0.4852
+#define CIE_B_Y		1.0000
+
+#define CIE_C_u		0.2009
+#define CIE_C_v		0.4609
+#define CIE_C_Y		1.0000
+
+#define CIE_D55_u	0.2044
+#define CIE_D55_v	0.4808
+#define CIE_D55_Y	1.0000
+
+#define CIE_D65_u	0.1978
+#define CIE_D65_v	0.4684
+#define CIE_D65_Y	1.0000
+
+#define CIE_D75_u	0.1935
+#define CIE_D75_v	0.4586
+#define CIE_D75_Y	1.0000
+
+#define ASTM_D50_u	0.2092
+#define ASTM_D50_v	0.4881
+#define ASTM_D50_Y	1.0000
+
+#define WP_9300K_u	0.1884
+#define WP_9300K_v	0.4463
+#define WP_9300K_Y	1.0000
diff --git a/ThirdParty/X11/Include/X11/Xmu/WidgetNode.h b/ThirdParty/X11/Include/X11/Xmu/WidgetNode.h
new file mode 100644
index 0000000000000000000000000000000000000000..f9d2cb57f4387eead182e52ba1646f82ee031ade
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmu/WidgetNode.h
@@ -0,0 +1,95 @@
+/*
+
+Copyright 1990, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author:  Jim Fulton, MIT X Consortium
+ */
+
+#ifndef _XmuWidgetNode_h
+#define _XmuWidgetNode_h
+
+#include <X11/Intrinsic.h>
+#include <X11/Xfuncproto.h>
+
+/*
+ * This is usually initialized by setting the first two fields and letting
+ * rest be implicitly nulled (by genlist.sh, for example)
+ */
+typedef struct _XmuWidgetNode {
+    char *label;			/* mixed case name */
+    WidgetClass *widget_class_ptr;	/* addr of widget class */
+    struct _XmuWidgetNode *superclass;	/* superclass of widget_class */
+    struct _XmuWidgetNode *children, *siblings;	/* subclass links */
+    char *lowered_label;		/* lowercase version of label */
+    char *lowered_classname;		/* lowercase version of class_name */
+    Bool have_resources;		/* resources have been fetched */
+    XtResourceList resources;		/* extracted resource database */
+    struct _XmuWidgetNode **resourcewn;	/* where resources come from */
+    Cardinal nresources;		/* number of resources */
+    XtResourceList constraints;		/* extracted constraint resources */
+    struct _XmuWidgetNode **constraintwn;  /* where constraints come from */
+    Cardinal nconstraints;		/* number of constraint resources */
+    XtPointer data;			/* extra data */
+} XmuWidgetNode;
+
+#define XmuWnClass(wn) ((wn)->widget_class_ptr[0])
+#define XmuWnClassname(wn) (XmuWnClass(wn)->core_class.class_name)
+#define XmuWnSuperclass(wn) ((XmuWnClass(wn))->core_class.superclass)
+
+					/* external interfaces */
+_XFUNCPROTOBEGIN
+
+void XmuWnInitializeNodes
+(
+ XmuWidgetNode		*nodearray,
+ int			nnodes
+ );
+
+void XmuWnFetchResources
+(
+ XmuWidgetNode		*node,
+ Widget			toplevel,
+ XmuWidgetNode		*topnode
+ );
+
+int XmuWnCountOwnedResources
+(
+ XmuWidgetNode		*node,
+ XmuWidgetNode		*ownernode,
+ Bool			constraints
+ );
+
+XmuWidgetNode *XmuWnNameToNode
+(
+ XmuWidgetNode		*nodelist,
+ int			nnodes,
+ _Xconst char		*name
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XmuWidgetNode_h */
+
diff --git a/ThirdParty/X11/Include/X11/Xmu/WinUtil.h b/ThirdParty/X11/Include/X11/Xmu/WinUtil.h
new file mode 100644
index 0000000000000000000000000000000000000000..3d187b9b8734b8c5997d593881b125af6e9bceb0
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmu/WinUtil.h
@@ -0,0 +1,61 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_WINDOWUTIL_H_
+#define _XMU_WINDOWUTIL_H_
+
+#include <X11/Xutil.h>
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+Window XmuClientWindow
+(
+ Display	*dpy,
+ Window 	win
+ );
+
+Bool XmuUpdateMapHints
+(
+ Display	*dpy,
+ Window		win,
+ XSizeHints	*hints
+ );
+
+Screen *XmuScreenOfWindow
+(
+ Display	*dpy,
+ Window 	w
+);
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_WINDOWUTIL_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xmu/Xct.h b/ThirdParty/X11/Include/X11/Xmu/Xct.h
new file mode 100644
index 0000000000000000000000000000000000000000..514ad7fea2396ff386181d3871a0dc09885c9604
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmu/Xct.h
@@ -0,0 +1,165 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _Xct_h
+#define _Xct_h
+
+#include <X11/Xfuncproto.h>
+
+#define XctVersion 1
+
+typedef unsigned char *XctString;
+
+typedef enum {
+    XctUnspecified,
+    XctLeftToRight,
+    XctRightToLeft
+} XctHDirection;
+
+typedef unsigned long XctFlags;
+
+/* These are bits in XctFlags. */
+
+#define XctSingleSetSegments	0x0001
+   /* This means that returned segments should contain characters from only
+    * one set (C0, C1, GL, GR).  When this is requested, XctSegment is never
+    * returned, instead XctC0Segment, XctC1Segment, XctGlSegment, and
+    * XctGRSegment are returned.  C0 and C1 segments are always returned as
+    * singleton characters.
+    */
+
+#define XctProvideExtensions	0x0002
+   /* This means that if the Compound Text string is from a higher version
+    * than this code is implemented to, then syntactically correct but unknown
+    * control sequences should be returned as XctExtension items.  If this
+    * flag is not set, and the Compound Text string version indicates that
+    * extensions cannot be ignored, then each unknown control sequence will be
+    * reported as an XctError.
+    */
+
+#define XctAcceptC0Extensions	0x0004
+   /* This means that if the Compound Text string is from a higher version
+    * than this code is implemented to, then unknown C0 characters should be
+    * treated as if they were legal, and returned as C0 characters (regardless
+    * of how XctProvideExtensions is set).  If this flag is not set, then all
+    * unknown C0 characters are treated according to XctProvideExtensions.
+    */
+
+#define XctAcceptC1Extensions	0x0008
+   /* This means that if the Compound Text string is from a higher version
+    * than this code is implemented to, then unknown C0 characters should be
+    * treated as if they were legal, and returned as C0 characters (regardless
+    * of how XctProvideExtensions is set).  If this flag is not set, then all
+    * unknown C0 characters are treated according to XctProvideExtensions.
+    */
+
+#define XctHideDirection	0x0010
+   /* This means that horizontal direction changes should be reported as
+    * XctHorizontal items.  If this flag is not set, then direction changes are
+    * not returned as items, but the current direction is still maintained and
+    * reported for other items.
+    */
+
+#define XctFreeString		0x0020
+   /* This means that XctFree should free the Compound Text string (that was
+    * passed to XctCreate.  If this flag is not set, the string is not freed.
+    */
+
+#define XctShiftMultiGRToGL	0x0040
+   /* Translate GR segments on-the-fly into GL segments for the GR sets:
+    * GB2312.1980-1, JISX0208.1983-1, and KSC5601.1987-1.
+    */
+
+/* This is the return type for XctNextItem. */
+typedef enum {
+    XctSegment,		/* used when XctSingleSetSegments is not requested */
+    XctC0Segment,	/* used when XctSingleSetSegments is requested */
+    XctGLSegment,	/* used when XctSingleSetSegments is requested */
+    XctC1Segment,	/* used when XctSingleSetSegments is requested */
+    XctGRSegment,	/* used when XctSingleSetSegments is requested */
+    XctExtendedSegment,	/* an extended segment */
+    XctExtension,	/* used when XctProvideExtensions is requested */
+    XctHorizontal,	/* horizontal direction or depth change */
+    XctEndOfText,	/* end of text string */
+    XctError		/* syntactic or semantic error */
+} XctResult;
+
+typedef struct _XctRec {
+    XctString		total_string;	/* as given to XctCreate */
+    int			total_length;	/* as given to XctCreate */
+    XctFlags		flags;		/* as given to XctCreate */
+    int			version;	/* indicates the version of the CT spec
+					 * the string was produced from */
+    int			can_ignore_exts;/* non-zero if ignoring extensions is
+					 * acceptable, else zero */
+    XctString		item;		/* item returned from XctNextItem */
+    unsigned		item_length;	/* length of item in bytes */
+    int			char_size;	/* number of bytes per character in
+					 * item, with zero meaning variable */
+    char		*encoding;	/* Encoding name for item */
+    XctHDirection	horizontal;	/* direction of item */
+    unsigned		horz_depth;	/* current direction nesting depth */
+    char		*GL;		/* "{I} F" string for current GL */
+    char		*GL_encoding;	/* Encoding name for current GL */
+    int			GL_set_size;	/* 94 or 96 */
+    int			GL_char_size;	/* number of bytes per GL character */
+    char		*GR;		/* "{I} F" string for current GR */
+    char		*GR_encoding;	/* Encoding name for current GR */
+    int			GR_set_size;	/* 94 or 96 */
+    int			GR_char_size;	/* number of bytes per GR character */
+    char		*GLGR_encoding;	/* Encoding name for current GL+GR,
+					 * if known */
+    struct _XctPriv	*priv;		/* private to parser, don't peek */
+} *XctData;
+
+/* these are the external routines */
+_XFUNCPROTOBEGIN
+
+XctData XctCreate
+(
+ _Xconst unsigned char	*string,
+ int			length,
+ XctFlags		flags
+);
+
+XctResult XctNextItem
+(
+ XctData		data
+);
+
+void XctFree
+(
+ XctData		data
+ );
+
+void XctReset
+(
+ XctData		data
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _Xct_h */
diff --git a/ThirdParty/X11/Include/X11/Xmu/Xmu.h b/ThirdParty/X11/Include/X11/Xmu/Xmu.h
new file mode 100644
index 0000000000000000000000000000000000000000..e49ad6fe9177615c7b35a1bbf85c1581c77c0aa2
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xmu/Xmu.h
@@ -0,0 +1,122 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_H_
+#define _XMU_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/Intrinsic.h>
+#include <X11/Xmu/Atoms.h>		/* _XA_... */
+#include <X11/Xmu/CharSet.h>		/* CopyISOLatin1Lowered */
+#include <X11/Xmu/Converters.h>		/* CvtStringTo... */
+#include <X11/Xmu/Drawing.h>		/* DrawRoundedRect, DrawLogo */
+#include <X11/Xmu/Error.h>		/* PrintDefaultError */
+#include <X11/Xmu/StdSel.h>		/* ConvertStandardSelection */
+
+/*
+ * clip lists
+ */
+typedef struct _XmuSegment {
+  int x1, x2;
+  struct _XmuSegment *next;
+} XmuSegment;
+
+typedef struct _XmuScanline {
+  int y;
+  XmuSegment *segment;
+  struct _XmuScanline *next;
+} XmuScanline;
+
+typedef struct _XmuArea {
+  XmuScanline *scanline;
+} XmuArea;
+
+#define XmuCreateArea()		XmuNewArea(0, 0, 0, 0)
+#define XmuAreaOr(dst, src)	XmuAreaOrXor((dst), (src), True)
+#define XmuAreaXor(dst, src)	XmuAreaOrXor((dst), (src), False)
+
+#define XmuDestroyArea(a)					\
+		  do {						\
+		    XmuDestroyScanlineList((a)->scanline);	\
+		    XtFree((char *)(a));			\
+		  } while (0)
+
+#define FreeArea(a)						\
+		  do {						\
+		    XmuDestroyScanlineList((a)->scanline);	\
+		    a->scanline = (Scanline *)0;		\
+		  } while (0)
+
+#define XmuValidSegment(s)	((s)->x1 < (s)->x2)
+#define XmuSegmentEqu(s1, s2)	((s1)->x1 == (s2)->x1 && (s1)->x2 == (s2)->x2)
+#define XmuDestroySegment(s)	XtFree((char *)(s))
+
+#define XmuDestroyScanline(s)					\
+		  do {						\
+		    XmuDestroySegmentList((s)->segment);	\
+		    XtFree((char*)(s));				\
+		  } while (0)
+
+XmuArea *XmuNewArea(int, int, int, int);
+XmuArea *XmuAreaDup(XmuArea*);
+XmuArea *XmuAreaCopy(XmuArea*, XmuArea*);
+XmuArea *XmuAreaNot(XmuArea*, int, int, int, int);
+XmuArea *XmuAreaOrXor(XmuArea*, XmuArea*, Bool);
+XmuArea *XmuAreaAnd(XmuArea*, XmuArea*);
+Bool XmuValidArea(XmuArea*);
+Bool XmuValidScanline(XmuScanline*);
+Bool XmuScanlineEqu(XmuScanline*, XmuScanline*);
+XmuSegment *XmuNewSegment(int, int);
+void XmuDestroySegmentList(XmuSegment*);
+XmuScanline *XmuScanlineCopy(XmuScanline*, XmuScanline*);
+Bool XmuAppendSegment(XmuSegment*, XmuSegment*);
+XmuScanline *XmuOptimizeScanline(XmuScanline*);
+XmuScanline *XmuScanlineNot(XmuScanline *scanline, int, int);
+XmuScanline *XmuScanlineOr(XmuScanline*, XmuScanline*);
+XmuScanline *XmuScanlineAnd(XmuScanline*, XmuScanline*);
+XmuScanline *XmuScanlineXor(XmuScanline*, XmuScanline*);
+XmuScanline *XmuNewScanline(int, int, int);
+void XmuDestroyScanlineList(XmuScanline*);
+XmuArea *XmuOptimizeArea(XmuArea *area);
+
+#ifndef notdef
+XmuScanline *XmuScanlineOrSegment(XmuScanline*, XmuSegment*);
+XmuScanline *XmuScanlineAndSegment(XmuScanline*, XmuSegment*);
+XmuScanline *XmuScanlineXorSegment(XmuScanline*, XmuSegment*);
+#endif /* notdef */
+
+#ifndef _SYSUTIL_H_
+int XmuSnprintf(char *str, int size, _Xconst char *fmt, ...)
+    _X_ATTRIBUTE_PRINTF(3,4);
+#endif
+
+#endif /* _XMU_H_ */
+
diff --git a/ThirdParty/X11/Include/X11/Xos.h b/ThirdParty/X11/Include/X11/Xos.h
new file mode 100644
index 0000000000000000000000000000000000000000..28dfc673aa933c7d4652c5e812be0a65270b8e76
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xos.h
@@ -0,0 +1,148 @@
+/*
+ *
+Copyright 1987, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * The X Window System is a Trademark of The Open Group.
+ *
+ */
+
+/* This is a collection of things to try and minimize system dependencies
+ * in a "significant" number of source files.
+ */
+
+#ifndef _XOS_H_
+# define _XOS_H_
+
+# include <X11/Xosdefs.h>
+
+/*
+ * Get major data types (esp. caddr_t)
+ */
+
+# include <sys/types.h>
+
+# if defined(__SCO__) || defined(__UNIXWARE__)
+#  include <stdint.h>
+# endif
+
+
+/*
+ * Just about everyone needs the strings routines.  We provide both forms here,
+ * index/rindex and strchr/strrchr, so any systems that don't provide them all
+ * need to have #defines here.
+ *
+ * These macros are defined this way, rather than, e.g.:
+ *    #defined index(s,c) strchr(s,c)
+ * because someone might be using them as function pointers, and such
+ * a change would break compatibility for anyone who's relying on them
+ * being the way they currently are. So we're stuck with them this way,
+ * which can be really inconvenient. :-(
+ */
+
+# include <string.h>
+# if defined(__SCO__) || defined(__UNIXWARE__) || defined(__sun) || defined(__CYGWIN__) || defined(_AIX) || defined(__APPLE__)
+#  include <strings.h>
+# else
+#  ifndef index
+#   define index(s,c) (strchr((s),(c)))
+#  endif
+#  ifndef rindex
+#   define rindex(s,c) (strrchr((s),(c)))
+#  endif
+# endif
+
+/*
+ * Get open(2) constants
+ */
+# if defined(X_NOT_POSIX)
+#  include <fcntl.h>
+#  if defined(USL) || defined(__i386__) && (defined(SYSV) || defined(SVR4))
+#   include <unistd.h>
+#  endif
+#  ifdef WIN32
+#   include <X11/Xw32defs.h>
+#  else
+#   include <sys/file.h>
+#  endif
+# else /* X_NOT_POSIX */
+#  include <fcntl.h>
+#  include <unistd.h>
+# endif /* X_NOT_POSIX else */
+
+/*
+ * Get struct timeval and struct tm
+ */
+
+# if defined(_POSIX_SOURCE) && defined(SVR4)
+/* need to omit _POSIX_SOURCE in order to get what we want in SVR4 */
+#  undef _POSIX_SOURCE
+#  include <sys/time.h>
+#  define _POSIX_SOURCE
+# elif defined(WIN32)
+#  include <time.h>
+#  if !defined(_WINSOCKAPI_) && !defined(_WILLWINSOCK_) && !defined(_TIMEVAL_DEFINED) && !defined(_STRUCT_TIMEVAL)
+struct timeval {
+    long    tv_sec;         /* seconds */
+    long    tv_usec;        /* and microseconds */
+};
+#   define _TIMEVAL_DEFINED
+#  endif
+#  include <sys/timeb.h>
+#  define gettimeofday(t) \
+{ \
+    struct _timeb _gtodtmp; \
+    _ftime (&_gtodtmp); \
+    (t)->tv_sec = _gtodtmp.time; \
+    (t)->tv_usec = _gtodtmp.millitm * 1000; \
+}
+# else
+#  include <sys/time.h>
+#  include <time.h>
+# endif /* defined(_POSIX_SOURCE) && defined(SVR4) */
+
+/* define X_GETTIMEOFDAY macro, a portable gettimeofday() */
+# if defined(_XOPEN_XPG4) || defined(_XOPEN_UNIX) /* _XOPEN_UNIX is XPG4.2 */
+#  define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0)
+# else
+#  if defined(SVR4) || defined(__SVR4) || defined(WIN32)
+#   define X_GETTIMEOFDAY(t) gettimeofday(t)
+#  else
+#   define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0)
+#  endif
+# endif /* XPG4 else */
+
+
+# ifdef __GNU__
+#  define PATH_MAX 4096
+#  define MAXPATHLEN 4096
+#  define OPEN_MAX 256 /* We define a reasonable limit.  */
+# endif
+
+/* use POSIX name for signal */
+# if defined(X_NOT_POSIX) && defined(SYSV) && !defined(SIGCHLD)
+#  define SIGCHLD SIGCLD
+# endif
+
+# include <X11/Xarch.h>
+
+#endif /* _XOS_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xos_r.h b/ThirdParty/X11/Include/X11/Xos_r.h
new file mode 100644
index 0000000000000000000000000000000000000000..f963b64100899d438880b5e0b94af0a8c0198c18
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xos_r.h
@@ -0,0 +1,1095 @@
+/*
+Copyright 1996, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+*/
+
+/*
+ * Various and sundry Thread-Safe functions used by X11, Motif, and CDE.
+ *
+ * Use this file in MT-safe code where you would have included
+ *	<dirent.h>	for readdir()
+ *	<grp.h>		for getgrgid() or getgrnam()
+ *	<netdb.h>	for gethostbyname(), gethostbyaddr(), or getservbyname()
+ *	<pwd.h>		for getpwnam() or getpwuid()
+ *	<string.h>	for strtok()
+ *	<time.h>	for asctime(), ctime(), localtime(), or gmtime()
+ *	<unistd.h>	for getlogin() or ttyname()
+ * or their thread-safe analogs.
+ *
+ * If you are on a platform that defines XTHREADS but does not have
+ * MT-safe system API (e.g. UnixWare) you must define _Xos_processLock
+ * and _Xos_processUnlock macros before including this header.
+ *
+ * For convenience XOS_USE_XLIB_LOCKING or XOS_USE_XT_LOCKING may be defined
+ * to obtain either Xlib-only or Xt-based versions of these macros.  These
+ * macros won't result in truly thread-safe calls, but they are better than
+ * nothing.  If you do not want locking in this situation define
+ * XOS_USE_NO_LOCKING.
+ *
+ * NOTE: On systems lacking appropriate _r functions Gethostbyname(),
+ *	Gethostbyaddr(), and Getservbyname() do NOT copy the host or
+ *	protocol lists!
+ *
+ * NOTE: On systems lacking appropriate _r functions Getgrgid() and
+ *	Getgrnam() do NOT copy the list of group members!
+ *
+ * This header is nominally intended to simplify porting X11, Motif, and
+ * CDE; it may be useful to other people too.  The structure below is
+ * complicated, mostly because P1003.1c (the IEEE POSIX Threads spec)
+ * went through lots of drafts, and some vendors shipped systems based
+ * on draft API that were changed later.  Unfortunately POSIX did not
+ * provide a feature-test macro for distinguishing each of the drafts.
+ */
+
+/*
+ * This header has several parts.  Search for "Effective prototypes"
+ * to locate the beginning of a section.
+ */
+
+/* This header can be included multiple times with different defines! */
+#ifndef _XOS_R_H_
+# define _XOS_R_H_
+
+# include <X11/Xos.h>
+# include <X11/Xfuncs.h>
+
+# ifndef X_NOT_POSIX
+#  ifdef _POSIX_SOURCE
+#   include <limits.h>
+#  else
+#   define _POSIX_SOURCE
+#   include <limits.h>
+#   undef _POSIX_SOURCE
+#  endif
+#  ifndef LINE_MAX
+#   define X_LINE_MAX 2048
+#  else
+#   define X_LINE_MAX LINE_MAX
+#  endif
+# endif
+#endif /* _XOS_R_H */
+
+#ifndef WIN32
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+# if defined(XOS_USE_XLIB_LOCKING)
+#  ifndef XAllocIDs /* Xlibint.h does not have multiple include protection */
+typedef struct _LockInfoRec *LockInfoPtr;
+extern LockInfoPtr _Xglobal_lock;
+#  endif
+#  ifndef _Xos_isThreadInitialized
+#   define _Xos_isThreadInitialized	(_Xglobal_lock)
+#  endif
+#  if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
+#   ifndef XAllocIDs /* Xlibint.h does not have multiple include protection */
+#    include <X11/Xfuncproto.h>	/* for NeedFunctionPrototypes */
+extern void (*_XLockMutex_fn)(
+#    if NeedFunctionPrototypes
+    LockInfoPtr	/* lock */, char * /* file */, int /* line */
+#    endif
+);
+extern void (*_XUnlockMutex_fn)(
+#    if NeedFunctionPrototypes
+    LockInfoPtr	/* lock */, char * /* file */, int /* line */
+#    endif
+);
+#   endif
+#   ifndef _Xos_processLock
+#    define _Xos_processLock	\
+  (_XLockMutex_fn ? (*_XLockMutex_fn)(_Xglobal_lock,__FILE__,__LINE__) : 0)
+#   endif
+#   ifndef _Xos_processUnlock
+#    define _Xos_processUnlock	\
+  (_XUnlockMutex_fn ? (*_XUnlockMutex_fn)(_Xglobal_lock,__FILE__,__LINE__) : 0)
+#   endif
+#  else
+#   ifndef XAllocIDs /* Xlibint.h does not have multiple include protection */
+#    include <X11/Xfuncproto.h>	/* for NeedFunctionPrototypes */
+extern void (*_XLockMutex_fn)(
+#    if NeedFunctionPrototypes
+    LockInfoPtr	/* lock */
+#    endif
+);
+extern void (*_XUnlockMutex_fn)(
+#    if NeedFunctionPrototypes
+    LockInfoPtr	/* lock */
+#    endif
+);
+#   endif
+#   ifndef _Xos_processLock
+#    define _Xos_processLock	\
+  (_XLockMutex_fn ? ((*_XLockMutex_fn)(_Xglobal_lock), 0) : 0)
+#   endif
+#   ifndef _Xos_processUnlock
+#    define _Xos_processUnlock	\
+  (_XUnlockMutex_fn ? ((*_XUnlockMutex_fn)(_Xglobal_lock), 0) : 0)
+#   endif
+#  endif
+# elif defined(XOS_USE_XT_LOCKING)
+#  ifndef _XtThreadsI_h
+extern void (*_XtProcessLock)(void);
+#  endif
+#  ifndef _XtintrinsicP_h
+#   include <X11/Xfuncproto.h>	/* for NeedFunctionPrototypes */
+extern void XtProcessLock(
+#   if NeedFunctionPrototypes
+    void
+#   endif
+);
+extern void XtProcessUnlock(
+#   if NeedFunctionPrototypes
+    void
+#   endif
+);
+#  endif
+#  ifndef _Xos_isThreadInitialized
+#   define _Xos_isThreadInitialized	_XtProcessLock
+#  endif
+#  ifndef _Xos_processLock
+#   define _Xos_processLock		XtProcessLock()
+#  endif
+#  ifndef _Xos_processUnlock
+#   define _Xos_processUnlock		XtProcessUnlock()
+#  endif
+# elif defined(XOS_USE_NO_LOCKING)
+#  ifndef _Xos_isThreadInitialized
+#   define _Xos_isThreadInitialized	0
+#  endif
+#  ifndef _Xos_processLock
+#   define _Xos_processLock		0
+#  endif
+#  ifndef _Xos_processUnlock
+#   define _Xos_processUnlock		0
+#  endif
+# endif
+
+#endif /* !defined WIN32 */
+
+/*
+ * Solaris defines the POSIX thread-safe feature test macro, but
+ * uses the older SVR4 thread-safe functions unless the POSIX ones
+ * are specifically requested.  Fix the feature test macro.
+ */
+#if defined(__sun) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && \
+	(_POSIX_C_SOURCE - 0 < 199506L) && !defined(_POSIX_PTHREAD_SEMANTICS)
+# undef _POSIX_THREAD_SAFE_FUNCTIONS
+#endif
+
+/***** <pwd.h> wrappers *****/
+
+/*
+ * Effective prototypes for <pwd.h> wrappers:
+ *
+ * #define X_INCLUDE_PWD_H
+ * #define XOS_USE_..._LOCKING
+ * #include <X11/Xos_r.h>
+ *
+ * typedef ... _Xgetpwparams;
+ *
+ * struct passwd* _XGetpwnam(const char *name, _Xgetpwparams);
+ * struct passwd* _XGetpwuid(uid_t uid, _Xgetpwparams);
+ */
+
+#if defined(X_INCLUDE_PWD_H) && !defined(_XOS_INCLUDED_PWD_H)
+# include <pwd.h>
+# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_PWDAPI)
+#  define XOS_USE_MTSAFE_PWDAPI 1
+# endif
+#endif
+
+#undef X_NEEDS_PWPARAMS
+#if !defined(X_INCLUDE_PWD_H) || defined(_XOS_INCLUDED_PWD_H)
+/* Do nothing */
+
+#elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API)
+/* Use regular, unsafe API. */
+# if defined(X_NOT_POSIX) && !defined(__i386__) && !defined(SYSV)
+extern struct passwd *getpwuid(), *getpwnam();
+# endif
+typedef int _Xgetpwparams;	/* dummy */
+# define _XGetpwuid(u,p)	getpwuid((u))
+# define _XGetpwnam(u,p)	getpwnam((u))
+
+#elif !defined(XOS_USE_MTSAFE_PWDAPI) || defined(XNO_MTSAFE_PWDAPI)
+/* UnixWare 2.0, or other systems with thread support but no _r API. */
+# define X_NEEDS_PWPARAMS
+typedef struct {
+  struct passwd pws;
+  char   pwbuf[1024];
+  struct passwd* pwp;
+  size_t len;
+} _Xgetpwparams;
+
+/*
+ * NetBSD and FreeBSD, at least, are missing several of the unixware passwd
+ * fields.
+ */
+
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \
+    defined(__APPLE__) || defined(__DragonFly__)
+static __inline__ void _Xpw_copyPasswd(_Xgetpwparams p)
+{
+   memcpy(&(p).pws, (p).pwp, sizeof(struct passwd));
+
+   (p).pws.pw_name = (p).pwbuf;
+   (p).len = strlen((p).pwp->pw_name);
+   strcpy((p).pws.pw_name, (p).pwp->pw_name);
+
+   (p).pws.pw_passwd = (p).pws.pw_name + (p).len + 1;
+   (p).len = strlen((p).pwp->pw_passwd);
+   strcpy((p).pws.pw_passwd,(p).pwp->pw_passwd);
+
+   (p).pws.pw_class = (p).pws.pw_passwd + (p).len + 1;
+   (p).len = strlen((p).pwp->pw_class);
+   strcpy((p).pws.pw_class, (p).pwp->pw_class);
+
+   (p).pws.pw_gecos = (p).pws.pw_class + (p).len + 1;
+   (p).len = strlen((p).pwp->pw_gecos);
+   strcpy((p).pws.pw_gecos, (p).pwp->pw_gecos);
+
+   (p).pws.pw_dir = (p).pws.pw_gecos + (p).len + 1;
+   (p).len = strlen((p).pwp->pw_dir);
+   strcpy((p).pws.pw_dir, (p).pwp->pw_dir);
+
+   (p).pws.pw_shell = (p).pws.pw_dir + (p).len + 1;
+   (p).len = strlen((p).pwp->pw_shell);
+   strcpy((p).pws.pw_shell, (p).pwp->pw_shell);
+
+   (p).pwp = &(p).pws;
+}
+
+#else
+# define _Xpw_copyPasswd(p) \
+   (memcpy(&(p).pws, (p).pwp, sizeof(struct passwd)), \
+    ((p).pws.pw_name = (p).pwbuf), \
+    ((p).len = strlen((p).pwp->pw_name)), \
+    strcpy((p).pws.pw_name, (p).pwp->pw_name), \
+    ((p).pws.pw_passwd = (p).pws.pw_name + (p).len + 1), \
+    ((p).len = strlen((p).pwp->pw_passwd)), \
+    strcpy((p).pws.pw_passwd,(p).pwp->pw_passwd), \
+    ((p).pws.pw_age = (p).pws.pw_passwd + (p).len + 1), \
+    ((p).len = strlen((p).pwp->pw_age)), \
+    strcpy((p).pws.pw_age, (p).pwp->pw_age), \
+    ((p).pws.pw_comment = (p).pws.pw_age + (p).len + 1), \
+    ((p).len = strlen((p).pwp->pw_comment)), \
+    strcpy((p).pws.pw_comment, (p).pwp->pw_comment), \
+    ((p).pws.pw_gecos = (p).pws.pw_comment + (p).len + 1), \
+    ((p).len = strlen((p).pwp->pw_gecos)), \
+    strcpy((p).pws.pw_gecos, (p).pwp->pw_gecos), \
+    ((p).pws.pw_dir = (p).pws.pw_comment + (p).len + 1), \
+    ((p).len = strlen((p).pwp->pw_dir)), \
+    strcpy((p).pws.pw_dir, (p).pwp->pw_dir), \
+    ((p).pws.pw_shell = (p).pws.pw_dir + (p).len + 1), \
+    ((p).len = strlen((p).pwp->pw_shell)), \
+    strcpy((p).pws.pw_shell, (p).pwp->pw_shell), \
+    ((p).pwp = &(p).pws), \
+    0 )
+#endif
+# define _XGetpwuid(u,p) \
+( (_Xos_processLock), \
+  (((p).pwp = getpwuid((u))) ? _Xpw_copyPasswd(p), 0 : 0), \
+  (_Xos_processUnlock), \
+  (p).pwp )
+# define _XGetpwnam(u,p) \
+( (_Xos_processLock), \
+  (((p).pwp = getpwnam((u))) ? _Xpw_copyPasswd(p), 0 : 0), \
+  (_Xos_processUnlock), \
+  (p).pwp )
+
+#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(__APPLE__)
+# define X_NEEDS_PWPARAMS
+typedef struct {
+  struct passwd pws;
+  char pwbuf[X_LINE_MAX];
+} _Xgetpwparams;
+# if defined(_POSIX_REENTRANT_FUNCTIONS) || !defined(SVR4)
+#   define _XGetpwuid(u,p) \
+((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws)
+#   define _XGetpwnam(u,p) \
+((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws)
+# else /* SVR4 */
+#  define _XGetpwuid(u,p) \
+((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == NULL) ? NULL : &(p).pws)
+#  define _XGetpwnam(u,p) \
+((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == NULL) ? NULL : &(p).pws)
+# endif /* SVR4 */
+
+#else /* _POSIX_THREAD_SAFE_FUNCTIONS */
+# define X_NEEDS_PWPARAMS
+typedef struct {
+  struct passwd pws;
+  char pwbuf[X_LINE_MAX];
+  struct passwd* pwp;
+} _Xgetpwparams;
+typedef int _Xgetpwret;
+# define _XGetpwuid(u,p) \
+((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf),&(p).pwp) == 0) ? \
+ (p).pwp : NULL)
+# define _XGetpwnam(u,p) \
+((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf),&(p).pwp) == 0) ? \
+ (p).pwp : NULL)
+#endif /* X_INCLUDE_PWD_H */
+
+#if defined(X_INCLUDE_PWD_H) && !defined(_XOS_INCLUDED_PWD_H)
+# define _XOS_INCLUDED_PWD_H
+#endif
+
+
+/***** <netdb.h> wrappers *****/
+
+/*
+ * Effective prototypes for <netdb.h> wrappers:
+ *
+ * NOTE: On systems lacking the appropriate _r functions Gethostbyname(),
+ *	Gethostbyaddr(), and Getservbyname() do NOT copy the host or
+ *	protocol lists!
+ *
+ * #define X_INCLUDE_NETDB_H
+ * #define XOS_USE_..._LOCKING
+ * #include <X11/Xos_r.h>
+ *
+ * typedef ... _Xgethostbynameparams;
+ * typedef ... _Xgetservbynameparams;
+ *
+ * struct hostent* _XGethostbyname(const char* name,_Xgethostbynameparams);
+ * struct hostent* _XGethostbyaddr(const char* addr, int len, int type,
+ *				   _Xgethostbynameparams);
+ * struct servent* _XGetservbyname(const char* name, const char* proto,
+ *				 _Xgetservbynameparams);
+ */
+
+#undef XTHREADS_NEEDS_BYNAMEPARAMS
+#if defined(X_INCLUDE_NETDB_H) && !defined(_XOS_INCLUDED_NETDB_H) \
+    && !defined(WIN32)
+# include <netdb.h>
+# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_NETDBAPI)
+#  define XOS_USE_MTSAFE_NETDBAPI 1
+# endif
+#endif
+
+#if !defined(X_INCLUDE_NETDB_H) || defined(_XOS_INCLUDED_NETDB_H)
+/* Do nothing. */
+
+#elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API)
+/* Use regular, unsafe API. */
+typedef int _Xgethostbynameparams; /* dummy */
+typedef int _Xgetservbynameparams; /* dummy */
+# define _XGethostbyname(h,hp)		gethostbyname((h))
+# define _XGethostbyaddr(a,al,t,hp)	gethostbyaddr((a),(al),(t))
+# define _XGetservbyname(s,p,sp)	getservbyname((s),(p))
+
+#elif !defined(XOS_USE_MTSAFE_NETDBAPI) || defined(XNO_MTSAFE_NETDBAPI)
+/* WARNING:  The h_addr_list and s_aliases values are *not* copied! */
+
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
+#include <sys/param.h>
+#endif
+
+typedef struct {
+  struct hostent hent;
+  char           h_name[MAXHOSTNAMELEN];
+  struct hostent *hptr;
+} _Xgethostbynameparams;
+typedef struct {
+  struct servent sent;
+  char           s_name[255];
+  char		 s_proto[255];
+  struct servent *sptr;
+} _Xgetservbynameparams;
+
+# define XTHREADS_NEEDS_BYNAMEPARAMS
+
+# define _Xg_copyHostent(hp) \
+   (memcpy(&(hp).hent, (hp).hptr, sizeof(struct hostent)), \
+    strcpy((hp).h_name, (hp).hptr->h_name), \
+    ((hp).hent.h_name = (hp).h_name), \
+    ((hp).hptr = &(hp).hent), \
+     0 )
+# define _Xg_copyServent(sp) \
+   (memcpy(&(sp).sent, (sp).sptr, sizeof(struct servent)), \
+    strcpy((sp).s_name, (sp).sptr->s_name), \
+    ((sp).sent.s_name = (sp).s_name), \
+    strcpy((sp).s_proto, (sp).sptr->s_proto), \
+    ((sp).sent.s_proto = (sp).s_proto), \
+    ((sp).sptr = &(sp).sent), \
+    0 )
+# define _XGethostbyname(h,hp) \
+   ((_Xos_processLock), \
+    (((hp).hptr = gethostbyname((h))) ? _Xg_copyHostent(hp) : 0), \
+    (_Xos_processUnlock), \
+    (hp).hptr )
+# define _XGethostbyaddr(a,al,t,hp) \
+   ((_Xos_processLock), \
+    (((hp).hptr = gethostbyaddr((a),(al),(t))) ? _Xg_copyHostent(hp) : 0), \
+    (_Xos_processUnlock), \
+    (hp).hptr )
+# define _XGetservbyname(s,p,sp) \
+   ((_Xos_processLock), \
+    (((sp).sptr = getservbyname((s),(p))) ? _Xg_copyServent(sp) : 0), \
+    (_Xos_processUnlock), \
+    (sp).sptr )
+
+#elif defined(XUSE_NETDB_R_API)
+/*
+ * POSIX does not specify _r equivalents for <netdb.h> API, but some
+ * vendors provide them anyway.  Use them only when explicitly asked.
+ */
+# ifdef _POSIX_REENTRANT_FUNCTIONS
+#  ifndef _POSIX_THREAD_SAFE_FUNCTIONS
+#  endif
+# endif
+# ifdef _POSIX_THREAD_SAFE_FUNCTIONS
+#  define X_POSIX_THREAD_SAFE_FUNCTIONS 1
+# endif
+
+# define XTHREADS_NEEDS_BYNAMEPARAMS
+
+# ifndef X_POSIX_THREAD_SAFE_FUNCTIONS
+typedef struct {
+    struct hostent      hent;
+    char                hbuf[X_LINE_MAX];
+    int                 herr;
+} _Xgethostbynameparams;
+typedef struct {
+    struct servent      sent;
+    char                sbuf[X_LINE_MAX];
+} _Xgetservbynameparams;
+#  define _XGethostbyname(h,hp) \
+  gethostbyname_r((h),&(hp).hent,(hp).hbuf,sizeof((hp).hbuf),&(hp).herr)
+#  define _XGethostbyaddr(a,al,t,hp) \
+  gethostbyaddr_r((a),(al),(t),&(hp).hent,(hp).hbuf,sizeof((hp).hbuf),&(hp).herr)
+#  define _XGetservbyname(s,p,sp) \
+  getservbyname_r((s),(p),&(sp).sent,(sp).sbuf,sizeof((sp).sbuf))
+# else
+typedef struct {
+  struct hostent      hent;
+  struct hostent_data hdata;
+} _Xgethostbynameparams;
+typedef struct {
+  struct servent      sent;
+  struct servent_data sdata;
+} _Xgetservbynameparams;
+#  define _XGethostbyname(h,hp) \
+  (bzero((char*)&(hp).hdata,sizeof((hp).hdata)),	\
+   ((gethostbyname_r((h),&(hp).hent,&(hp).hdata) == -1) ? NULL : &(hp).hent))
+#  define _XGethostbyaddr(a,al,t,hp) \
+  (bzero((char*)&(hp).hdata,sizeof((hp).hdata)),	\
+   ((gethostbyaddr_r((a),(al),(t),&(hp).hent,&(hp).hdata) == -1) ? NULL : &(hp).hent))
+#  define _XGetservbyname(s,p,sp) \
+  (bzero((char*)&(sp).sdata,sizeof((sp).sdata)),	\
+   ((getservbyname_r((s),(p),&(sp).sent,&(sp).sdata) == -1) ? NULL : &(sp).sent) )
+# endif
+# ifdef X_POSIX_THREAD_SAFE_FUNCTIONS
+#  undef X_POSIX_THREAD_SAFE_FUNCTIONS
+# endif
+
+#else
+/* The regular API is assumed to be MT-safe under POSIX. */
+typedef int _Xgethostbynameparams; /* dummy */
+typedef int _Xgetservbynameparams; /* dummy */
+# define _XGethostbyname(h,hp)		gethostbyname((h))
+# define _XGethostbyaddr(a,al,t,hp)	gethostbyaddr((a),(al),(t))
+# define _XGetservbyname(s,p,sp)	getservbyname((s),(p))
+#endif /* X_INCLUDE_NETDB_H */
+
+#if defined(X_INCLUDE_NETDB_H) && !defined(_XOS_INCLUDED_NETDB_H)
+# define _XOS_INCLUDED_NETDB_H
+#endif
+
+
+/***** <dirent.h> wrappers *****/
+
+/*
+ * Effective prototypes for <dirent.h> wrappers:
+ *
+ * #define X_INCLUDE_DIRENT_H
+ * #define XOS_USE_..._LOCKING
+ * #include <X11/Xos_r.h>
+ *
+ * typedef ... _Xreaddirparams;
+ *
+ * struct dirent *_XReaddir(DIR *dir_pointer, _Xreaddirparams);
+ */
+
+#if defined(X_INCLUDE_DIRENT_H) && !defined(_XOS_INCLUDED_DIRENT_H)
+# include <sys/types.h>
+# if !defined(X_NOT_POSIX) || defined(SYSV)
+#  include <dirent.h>
+# else
+#  include <sys/dir.h>
+#  ifndef dirent
+#   define dirent direct
+#  endif
+# endif
+# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_DIRENTAPI)
+#  define XOS_USE_MTSAFE_DIRENTAPI 1
+# endif
+#endif
+
+#if !defined(X_INCLUDE_DIRENT_H) || defined(_XOS_INCLUDED_DIRENT_H)
+/* Do nothing. */
+
+#elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API)
+/* Use regular, unsafe API. */
+typedef int _Xreaddirparams;	/* dummy */
+# define _XReaddir(d,p)	readdir(d)
+
+#elif !defined(XOS_USE_MTSAFE_DIRENTAPI) || defined(XNO_MTSAFE_DIRENTAPI)
+/* Systems with thread support but no _r API. */
+typedef struct {
+  struct dirent *result;
+  struct dirent dir_entry;
+# ifdef _POSIX_PATH_MAX
+  char buf[_POSIX_PATH_MAX];
+# elif defined(NAME_MAX)
+  char buf[NAME_MAX];
+# else
+  char buf[255];
+# endif
+} _Xreaddirparams;
+
+# define _XReaddir(d,p)	\
+ ( (_Xos_processLock),						 \
+   (((p).result = readdir((d))) ?				 \
+    (memcpy(&((p).dir_entry), (p).result, (p).result->d_reclen), \
+     ((p).result = &(p).dir_entry), 0) :			 \
+    0),								 \
+   (_Xos_processUnlock),					 \
+   (p).result )
+
+#else
+typedef struct {
+  struct dirent *result;
+  struct dirent dir_entry;
+# ifdef _POSIX_PATH_MAX
+  char buf[_POSIX_PATH_MAX];
+# elif defined(NAME_MAX)
+  char buf[NAME_MAX];
+# else
+  char buf[255];
+# endif
+} _Xreaddirparams;
+
+# if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(__APPLE__)
+/* POSIX final API, returns (int)0 on success. */
+#  define _XReaddir(d,p)						\
+    (readdir_r((d), &((p).dir_entry), &((p).result)) ? NULL : (p).result)
+# elif defined(_POSIX_REENTRANT_FUNCTIONS)
+/* POSIX draft API, returns (int)0 on success. */
+#  define _XReaddir(d,p)	\
+    (readdir_r((d),&((p).dir_entry)) ? NULL : &((p).dir_entry))
+# elif defined(SVR4)
+/* Pre-POSIX API, returns non-NULL on success. */
+#  define _XReaddir(d,p)	(readdir_r((d), &(p).dir_entry))
+# else
+/* We have no idea what is going on.  Fake it all using process locks. */
+#  define _XReaddir(d,p)	\
+    ( (_Xos_processLock),						\
+      (((p).result = readdir((d))) ?					\
+       (memcpy(&((p).dir_entry), (p).result, (p).result->d_reclen),	\
+	((p).result = &(p).dir_entry), 0) :				\
+       0),								\
+      (_Xos_processUnlock),						\
+      (p).result )
+# endif
+#endif /* X_INCLUDE_DIRENT_H */
+
+#if defined(X_INCLUDE_DIRENT_H) && !defined(_XOS_INCLUDED_DIRENT_H)
+# define _XOS_INCLUDED_DIRENT_H
+#endif
+
+
+/***** <unistd.h> wrappers *****/
+
+/*
+ * Effective prototypes for <unistd.h> wrappers:
+ *
+ * #define X_INCLUDE_UNISTD_H
+ * #define XOS_USE_..._LOCKING
+ * #include <X11/Xos_r.h>
+ *
+ * typedef ... _Xgetloginparams;
+ * typedef ... _Xttynameparams;
+ *
+ * char *_XGetlogin(_Xgetloginparams);
+ * char *_XTtyname(int, _Xttynameparams);
+ */
+
+#if defined(X_INCLUDE_UNISTD_H) && !defined(_XOS_INCLUDED_UNISTD_H)
+/* <unistd.h> already included by <X11/Xos.h> */
+# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_UNISTDAPI)
+#  define XOS_USE_MTSAFE_UNISTDAPI 1
+# endif
+#endif
+
+#if !defined(X_INCLUDE_UNISTD_H) || defined(_XOS_INCLUDED_UNISTD_H)
+/* Do nothing. */
+
+#elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API)
+/* Use regular, unsafe API. */
+typedef int _Xgetloginparams;	/* dummy */
+typedef int _Xttynameparams;	/* dummy */
+# define _XGetlogin(p)	getlogin()
+# define _XTtyname(f)	ttyname((f))
+
+#elif !defined(XOS_USE_MTSAFE_UNISTDAPI) || defined(XNO_MTSAFE_UNISTDAPI)
+/* Systems with thread support but no _r API. */
+typedef struct {
+  char *result;
+# if defined(MAXLOGNAME)
+  char buf[MAXLOGNAME];
+# elif defined(LOGIN_NAME_MAX)
+  char buf[LOGIN_NAME_MAX];
+# else
+  char buf[64];
+# endif
+} _Xgetloginparams;
+typedef struct {
+  char *result;
+# ifdef TTY_NAME_MAX
+  char buf[TTY_NAME_MAX];
+# elif defined(_POSIX_TTY_NAME_MAX)
+  char buf[_POSIX_TTY_NAME_MAX];
+# elif defined(_POSIX_PATH_MAX)
+  char buf[_POSIX_PATH_MAX];
+# else
+  char buf[256];
+# endif
+} _Xttynameparams;
+
+# define _XGetlogin(p) \
+ ( (_Xos_processLock), \
+   (((p).result = getlogin()) ? \
+    (strncpy((p).buf, (p).result, sizeof((p).buf)), \
+     ((p).buf[sizeof((p).buf)-1] = '\0'), \
+     ((p).result = (p).buf), 0) : 0), \
+   (_Xos_processUnlock), \
+   (p).result )
+#define _XTtyname(f,p) \
+ ( (_Xos_processLock), \
+   (((p).result = ttyname(f)) ? \
+    (strncpy((p).buf, (p).result, sizeof((p).buf)), \
+     ((p).buf[sizeof((p).buf)-1] = '\0'), \
+     ((p).result = (p).buf), 0) : 0), \
+   (_Xos_processUnlock), \
+   (p).result )
+
+#elif defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_POSIX_REENTRANT_FUNCTIONS)
+/* POSIX API.
+ *
+ * extern int getlogin_r(char *, size_t);
+ * extern int ttyname_r(int, char *, size_t);
+ */
+typedef struct {
+# if defined(MAXLOGNAME)
+  char buf[MAXLOGNAME];
+# elif defined(LOGIN_NAME_MAX)
+  char buf[LOGIN_NAME_MAX];
+# else
+  char buf[64];
+# endif
+} _Xgetloginparams;
+typedef struct {
+# ifdef TTY_NAME_MAX
+  char buf[TTY_NAME_MAX];
+# elif defined(_POSIX_TTY_NAME_MAX)
+  char buf[_POSIX_TTY_NAME_MAX];
+# elif defined(_POSIX_PATH_MAX)
+  char buf[_POSIX_PATH_MAX];
+# else
+  char buf[256];
+# endif
+} _Xttynameparams;
+
+# define _XGetlogin(p)	(getlogin_r((p).buf, sizeof((p).buf)) ? NULL : (p).buf)
+# define _XTtyname(f,p)	\
+	(ttyname_r((f), (p).buf, sizeof((p).buf)) ? NULL : (p).buf)
+
+#else
+/* Pre-POSIX API.
+ *
+ * extern char *getlogin_r(char *, size_t);
+ * extern char *ttyname_r(int, char *, size_t);
+ */
+typedef struct {
+# if defined(MAXLOGNAME)
+  char buf[MAXLOGNAME];
+# elif defined(LOGIN_NAME_MAX)
+  char buf[LOGIN_NAME_MAX];
+# else
+  char buf[64];
+# endif
+} _Xgetloginparams;
+typedef struct {
+# ifdef TTY_NAME_MAX
+  char buf[TTY_NAME_MAX];
+# elif defined(_POSIX_TTY_NAME_MAX)
+  char buf[_POSIX_TTY_NAME_MAX];
+# elif defined(_POSIX_PATH_MAX)
+  char buf[_POSIX_PATH_MAX];
+# else
+  char buf[256];
+# endif
+} _Xttynameparams;
+
+# define _XGetlogin(p)	getlogin_r((p).buf, sizeof((p).buf))
+# define _XTtyname(f,p)	ttyname_r((f), (p).buf, sizeof((p).buf))
+#endif /* X_INCLUDE_UNISTD_H */
+
+#if defined(X_INCLUDE_UNISTD_H) && !defined(_XOS_INCLUDED_UNISTD_H)
+# define _XOS_INCLUDED_UNISTD_H
+#endif
+
+
+/***** <string.h> wrappers *****/
+
+/*
+ * Effective prototypes for <string.h> wrappers:
+ *
+ * #define X_INCLUDE_STRING_H
+ * #define XOS_USE_..._LOCKING
+ * #include <X11/Xos_r.h>
+ *
+ * typedef ... _Xstrtokparams;
+ *
+ * char *_XStrtok(char *, const char*, _Xstrtokparams);
+ */
+
+#if defined(X_INCLUDE_STRING_H) && !defined(_XOS_INCLUDED_STRING_H)
+/* <string.h> has already been included by <X11/Xos.h> */
+# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_STRINGAPI)
+#  define XOS_USE_MTSAFE_STRINGAPI 1
+# endif
+#endif
+
+#if !defined(X_INCLUDE_STRING_H) || defined(_XOS_INCLUDED_STRING_H)
+/* Do nothing. */
+
+#elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API)
+/* Use regular, unsafe API. */
+typedef int _Xstrtokparams;	/* dummy */
+# define _XStrtok(s1,s2,p) \
+ ( p = 0, (void)p, strtok((s1),(s2)) )
+
+#elif !defined(XOS_USE_MTSAFE_STRINGAPI) || defined(XNO_MTSAFE_STRINGAPI)
+/* Systems with thread support but no _r API. */
+typedef char *_Xstrtokparams;
+# define _XStrtok(s1,s2,p) \
+ ( (_Xos_processLock), \
+   ((p) = strtok((s1),(s2))), \
+   (_Xos_processUnlock), \
+   (p) )
+
+#else
+/* POSIX or pre-POSIX API. */
+typedef char * _Xstrtokparams;
+# define _XStrtok(s1,s2,p)	strtok_r((s1),(s2),&(p))
+#endif /* X_INCLUDE_STRING_H */
+
+
+/***** <time.h> wrappers *****/
+
+/*
+ * Effective prototypes for <time.h> wrappers:
+ *
+ * #define X_INCLUDE_TIME_H
+ * #define XOS_USE_..._LOCKING
+ * #include <X11/Xos_r.h>
+ *
+ * typedef ... _Xatimeparams;
+ * typedef ... _Xctimeparams;
+ * typedef ... _Xgtimeparams;
+ * typedef ... _Xltimeparams;
+ *
+ * char *_XAsctime(const struct tm *, _Xatimeparams);
+ * char *_XCtime(const time_t *, _Xctimeparams);
+ * struct tm *_XGmtime(const time_t *, _Xgtimeparams);
+ * struct tm *_XLocaltime(const time_t *, _Xltimeparams);
+ */
+
+#if defined(X_INCLUDE_TIME_H) && !defined(_XOS_INCLUDED_TIME_H)
+# include <time.h>
+# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_TIMEAPI)
+#  define XOS_USE_MTSAFE_TIMEAPI 1
+# endif
+#endif
+
+#if !defined(X_INCLUDE_TIME_H) || defined(_XOS_INCLUDED_TIME_H)
+/* Do nothing. */
+
+#elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API)
+/* Use regular, unsafe API. */
+typedef int _Xatimeparams;	/* dummy */
+# define _XAsctime(t,p)		asctime((t))
+typedef int _Xctimeparams;	/* dummy */
+# define _XCtime(t,p)		ctime((t))
+typedef int _Xgtimeparams;	/* dummy */
+# define _XGmtime(t,p)		gmtime((t))
+typedef int _Xltimeparams;	/* dummy */
+# define _XLocaltime(t,p)	localtime((t))
+
+#elif !defined(XOS_USE_MTSAFE_TIMEAPI) || defined(XNO_MTSAFE_TIMEAPI)
+/* Systems with thread support but no _r API. */
+typedef struct {
+# ifdef TIMELEN
+  char buf[TIMELEN];
+# else
+  char buf[26];
+# endif
+  char *result;
+} _Xctimeparams, _Xatimeparams;
+typedef struct {
+  struct tm buf;
+  struct tm *result;
+} _Xgtimeparams, _Xltimeparams;
+# define _XAsctime(t,p) \
+ ( (_Xos_processLock), \
+   (((p).result = asctime((t))) ? \
+    (strncpy((p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \
+    0), \
+   (_Xos_processUnlock), \
+   (p).result )
+# define _XCtime(t,p) \
+ ( (_Xos_processLock), \
+   (((p).result = ctime((t))) ? \
+    (strncpy((p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \
+    0), \
+   (_Xos_processUnlock), \
+   (p).result )
+# define _XGmtime(t,p) \
+ ( (_Xos_processLock), \
+   (((p).result = gmtime(t)) ? \
+    (memcpy(&(p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \
+    0), \
+   (_Xos_processUnlock), \
+   (p).result )
+# define _XLocaltime(t,p) \
+ ( (_Xos_processLock), \
+   (((p).result = localtime(t)) ? \
+    (memcpy(&(p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \
+    0), \
+   (_Xos_processUnlock), \
+   (p).result )
+
+#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) &&  defined(hpV4)
+/* Returns (int)0 on success.
+ *
+ * extern int asctime_r(const struct tm *timeptr, char *buffer, int buflen);
+ * extern int ctime_r(const time_t *timer, char *buffer, int buflen);
+ * extern int gmtime_r(const time_t *timer, struct tm *result);
+ * extern int localtime_r(const time_t *timer, struct tm *result);
+ */
+# ifdef TIMELEN
+typedef char _Xatimeparams[TIMELEN];
+typedef char _Xctimeparams[TIMELEN];
+# else
+typedef char _Xatimeparams[26];
+typedef char _Xctimeparams[26];
+# endif
+typedef struct tm _Xgtimeparams;
+typedef struct tm _Xltimeparams;
+# define _XAsctime(t,p)		(asctime_r((t),(p),sizeof((p))) ? NULL : (p))
+# define _XCtime(t,p)		(ctime_r((t),(p),sizeof((p))) ? NULL : (p))
+# define _XGmtime(t,p)		(gmtime_r((t),&(p)) ? NULL : &(p))
+# define _XLocaltime(t,p)	(localtime_r((t),&(p)) ? NULL : &(p))
+
+#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(__sun)
+/* Returns NULL on failure.  Solaris 2.5
+ *
+ * extern char *asctime_r(const struct tm *tm,char *buf, int buflen);
+ * extern char *ctime_r(const time_t *clock, char *buf, int buflen);
+ * extern struct tm *gmtime_r(const time_t *clock, struct tm *res);
+ * extern struct tm *localtime_r(const time_t *clock, struct tm *res);
+ */
+# ifdef TIMELEN
+typedef char _Xatimeparams[TIMELEN];
+typedef char _Xctimeparams[TIMELEN];
+# else
+typedef char _Xatimeparams[26];
+typedef char _Xctimeparams[26];
+# endif
+typedef struct tm _Xgtimeparams;
+typedef struct tm _Xltimeparams;
+# define _XAsctime(t,p)		asctime_r((t),(p),sizeof((p)))
+# define _XCtime(t,p)		ctime_r((t),(p),sizeof((p)))
+# define _XGmtime(t,p)		gmtime_r((t),&(p))
+# define _XLocaltime(t,p)	localtime_r((t),&(p))
+
+#else /* defined(_POSIX_THREAD_SAFE_FUNCTIONS) */
+/* POSIX final API.
+ * extern char *asctime_r(const struct tm *timeptr, char *buffer);
+ * extern char *ctime_r(const time_t *timer, char *buffer);
+ * extern struct tm *gmtime_r(const time_t *timer, struct tm *result);
+ * extern struct tm *localtime_r(const time_t *timer, struct tm *result);
+ */
+# ifdef TIMELEN
+typedef char _Xatimeparams[TIMELEN];
+typedef char _Xctimeparams[TIMELEN];
+# else
+typedef char _Xatimeparams[26];
+typedef char _Xctimeparams[26];
+# endif
+typedef struct tm _Xgtimeparams;
+typedef struct tm _Xltimeparams;
+# define _XAsctime(t,p)		asctime_r((t),(p))
+# define _XCtime(t,p)		ctime_r((t),(p))
+# define _XGmtime(t,p)		gmtime_r((t),&(p))
+# define _XLocaltime(t,p)	localtime_r((t),&(p))
+#endif /* X_INCLUDE_TIME_H */
+
+#if defined(X_INCLUDE_TIME_H) && !defined(_XOS_INCLUDED_TIME_H)
+# define _XOS_INCLUDED_TIME_H
+#endif
+
+
+/***** <grp.h> wrappers *****/
+
+/*
+ * Effective prototypes for <grp.h> wrappers:
+ *
+ * NOTE: On systems lacking appropriate _r functions Getgrgid() and
+ *	Getgrnam() do NOT copy the list of group members!
+ *
+ * Remember that fgetgrent(), setgrent(), getgrent(), and endgrent()
+ * are not included in POSIX.
+ *
+ * #define X_INCLUDE_GRP_H
+ * #define XOS_USE_..._LOCKING
+ * #include <X11/Xos_r.h>
+ *
+ * typedef ... _Xgetgrparams;
+ *
+ * struct group *_XGetgrgid(gid_t, _Xgetgrparams);
+ * struct group *_XGetgrnam(const char *, _Xgetgrparams);
+ */
+
+#if defined(X_INCLUDE_GRP_H) && !defined(_XOS_INCLUDED_GRP_H)
+# include <grp.h>
+# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_GRPAPI)
+#  define XOS_USE_MTSAFE_GRPAPI 1
+# endif
+#endif
+
+#if !defined(X_INCLUDE_GRP_H) || defined(_XOS_INCLUDED_GRP_H)
+/* Do nothing. */
+
+#elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API)
+/* Use regular, unsafe API. */
+typedef int _Xgetgrparams;	/* dummy */
+#define _XGetgrgid(g,p)	getgrgid((g))
+#define _XGetgrnam(n,p)	getgrnam((n))
+
+#elif !defined(XOS_USE_MTSAFE_GRPAPI) || defined(XNO_MTSAFE_GRPAPI)
+/* Systems with thread support but no _r API.  UnixWare 2.0. */
+typedef struct {
+  struct group grp;
+  char buf[X_LINE_MAX];	/* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */
+  struct group *pgrp;
+  size_t len;
+} _Xgetgrparams;
+#ifdef SVR4
+/* Copy the gr_passwd field too. */
+# define _Xgrp_copyGroup(p) \
+ ( memcpy(&(p).grp, (p).pgrp, sizeof(struct group)), \
+   ((p).grp.gr_name = (p).buf), \
+   ((p).len = strlen((p).pgrp->gr_name)), \
+   strcpy((p).grp.gr_name, (p).pgrp->gr_name), \
+   ((p).grp.gr_passwd = (p).grp.gr_name + (p).len + 1), \
+   ((p).pgrp = &(p).grp), \
+   0 )
+#else
+# define _Xgrp_copyGroup(p) \
+ ( memcpy(&(p).grp, (p).pgrp, sizeof(struct group)), \
+   ((p).grp.gr_name = (p).buf), \
+   strcpy((p).grp.gr_name, (p).pgrp->gr_name), \
+   ((p).pgrp = &(p).grp), \
+   0 )
+#endif
+#define _XGetgrgid(g,p) \
+ ( (_Xos_processLock), \
+   (((p).pgrp = getgrgid((g))) ? _Xgrp_copyGroup(p) : 0), \
+   (_Xos_processUnlock), \
+   (p).pgrp )
+#define _XGetgrnam(n,p) \
+ ( (_Xos_processLock), \
+   (((p).pgrp = getgrnam((n))) ? _Xgrp_copyGroup(p) : 0), \
+   (_Xos_processUnlock), \
+   (p).pgrp )
+
+#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(__sun)
+/* Non-POSIX API.  Solaris.
+ *
+ * extern struct group *getgrgid_r(gid_t, struct group *, char *, int);
+ * extern struct group *getgrnam_r(const char *, struct group *, char *, int);
+ */
+typedef struct {
+  struct group grp;
+  char buf[X_LINE_MAX];	/* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */
+} _Xgetgrparams;
+#define _XGetgrgid(g,p)	getgrgid_r((g), &(p).grp, (p).buf, sizeof((p).buf))
+#define _XGetgrnam(n,p)	getgrnam_r((n), &(p).grp, (p).buf, sizeof((p).buf))
+
+#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS)
+/* Non-POSIX API.
+ * extern int getgrgid_r(gid_t, struct group *, char *, int);
+ * extern int getgrnam_r(const char *, struct group *, char *, int);
+ */
+typedef struct {
+  struct group grp;
+  char buf[X_LINE_MAX];	/* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */
+} _Xgetgrparams;
+#define _XGetgrgid(g,p)	\
+ ((getgrgid_r((g), &(p).grp, (p).buf, sizeof((p).buf)) ? NULL : &(p).grp))
+#define _XGetgrnam(n,p)	\
+ ((getgrnam_r((n), &(p).grp, (p).buf, sizeof((p).buf)) ? NULL : &(p).grp))
+
+#else
+/* POSIX final API.
+ *
+ * int getgrgid_r(gid_t, struct group *, char *, size_t, struct group **);
+ * int getgrnam_r(const char *, struct group *, char *, size_t, struct group **);
+ */
+typedef struct {
+  struct group grp;
+  char buf[X_LINE_MAX];	/* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */
+  struct group *result;
+} _Xgetgrparams;
+
+#define _XGetgrgid(g,p)	\
+ ((getgrgid_r((g), &(p).grp, (p).buf, sizeof((p).buf), &(p).result) ? \
+   NULL : (p).result))
+#define _XGetgrnam(n,p)	\
+ ((getgrnam_r((n), &(p).grp, (p).buf, sizeof((p).buf), &(p).result) ? \
+   NULL : (p).result))
+#endif
+
+#if defined(X_INCLUDE_GRP_H) && !defined(_XOS_INCLUDED_GRP_H)
+# define _XOS_INCLUDED_GRP_H
+#endif
+
+
+#ifdef __cplusplus
+}  /* Close scope of 'extern "C"' declaration which encloses file. */
+#endif
diff --git a/ThirdParty/X11/Include/X11/Xosdefs.h b/ThirdParty/X11/Include/X11/Xosdefs.h
new file mode 100644
index 0000000000000000000000000000000000000000..33eaee4360c49e26d5d45e47b5e415bdb09fb01c
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xosdefs.h
@@ -0,0 +1,116 @@
+/*
+ * O/S-dependent (mis)feature macro definitions
+ *
+Copyright 1991, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+#ifndef _XOSDEFS_H_
+# define _XOSDEFS_H_
+
+/*
+ * X_NOT_POSIX means does not have POSIX header files.  Lack of this
+ * symbol does NOT mean that the POSIX environment is the default.
+ * You may still have to define _POSIX_SOURCE to get it.
+ */
+
+
+# ifdef _SCO_DS
+#  ifndef __SCO__
+#   define __SCO__
+#  endif
+# endif
+
+# ifdef __i386__
+#  ifdef SYSV
+#   if !defined(__SCO__) && \
+	!defined(__UNIXWARE__) && !defined(__sun)
+#    if !defined(_POSIX_SOURCE)
+#     define X_NOT_POSIX
+#    endif
+#   endif
+#  endif
+# endif
+
+# ifdef __sun
+/* Imake configs define SVR4 on Solaris, but cc & gcc only define __SVR4
+ * This check allows non-Imake configured programs to build correctly.
+ */
+#  if defined(__SVR4) && !defined(SVR4)
+#   define SVR4 1
+#  endif
+#  ifdef SVR4
+/* define this to whatever it needs to be */
+#   define X_POSIX_C_SOURCE 199300L
+#  endif
+# endif
+
+# ifdef WIN32
+#  ifndef _POSIX_
+#   define X_NOT_POSIX
+#  endif
+# endif
+
+
+# ifdef __APPLE__
+#  define NULL_NOT_ZERO
+
+/* Defining any of these will sanitize the namespace to JUST want is defined by
+ * that particular standard.  If that happens, we don't get some expected
+ * prototypes, typedefs, etc (like fd_mask).  We can define _DARWIN_C_SOURCE to
+ * loosen our belts a tad.
+ */
+#  if defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE)
+#   ifndef _DARWIN_C_SOURCE
+#    define _DARWIN_C_SOURCE
+#   endif
+#  endif
+
+# endif
+
+# ifdef __GNU__
+#  ifndef PATH_MAX
+#   define PATH_MAX 4096
+#  endif
+#  ifndef MAXPATHLEN
+#   define MAXPATHLEN 4096
+#  endif
+# endif
+
+# if defined(__SCO__) || defined(__UNIXWARE__)
+#  ifndef PATH_MAX
+#   define PATH_MAX	1024
+#  endif
+#  ifndef MAXPATHLEN
+#   define MAXPATHLEN	1024
+#  endif
+# endif
+
+# if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) \
+	|| defined(__APPLE__) || defined(__DragonFly__)
+#  ifndef CSRG_BASED
+#   define CSRG_BASED
+#  endif
+# endif
+
+#endif /* _XOSDEFS_H_ */
+
diff --git a/ThirdParty/X11/Include/X11/Xpoll.h b/ThirdParty/X11/Include/X11/Xpoll.h
new file mode 100644
index 0000000000000000000000000000000000000000..0940865be2b55363e260dfcd3aac161f64806c44
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xpoll.h
@@ -0,0 +1,230 @@
+/*
+
+Copyright 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+
+/*
+ * Copyright © 2005 Daniel Stone
+ * 
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Daniel Stone not be used in advertising
+ * or publicity pertaining to distribution of the software without specific,
+ * written prior permission.  Daniel Stone makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * DANIEL STONE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * DANIEL STONE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+
+#ifndef _XPOLL_H_
+#define _XPOLL_H_
+
+#if !defined(WIN32) || defined(__CYGWIN__)
+
+#ifndef USE_POLL
+
+#include <X11/Xos.h>
+
+#include <sys/select.h>  /* Get the FD_* macros. */
+
+#include <X11/Xmd.h>
+
+#ifdef CSRG_BASED
+#include <sys/param.h>
+# if BSD < 199103
+typedef long fd_mask;
+# endif
+#endif
+
+#if defined(FD_SETSIZE) && FD_SETSIZE < 512
+# define XFD_SETSIZE	FD_SETSIZE
+#else
+# define XFD_SETSIZE	512
+# ifndef FD_SETSIZE
+#  define FD_SETSIZE	XFD_SETSIZE
+# endif
+#endif
+
+#ifndef NBBY
+#define NBBY	8		/* number of bits in a byte */
+#endif
+
+#ifndef NFDBITS
+#define NFDBITS (sizeof(fd_mask) * NBBY)	/* bits per mask */
+#endif
+
+#ifndef howmany
+#define howmany(x,y)	(((x)+((y)-1))/(y))
+#endif
+
+#if defined(BSD) && BSD < 198911 
+typedef struct fd_set {
+	fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
+} fd_set;
+#endif
+
+# define Select(n,r,w,e,t) select(n,(fd_set*)r,(fd_set*)w,(fd_set*)e,(struct timeval*)t)
+
+#define __X_FDS_BITS __fds_bits
+
+#ifndef __FDS_BITS
+# define __FDS_BITS(p)  ((p)->__X_FDS_BITS)
+#endif
+
+#define __XFDS_BITS(p, n) (__FDS_BITS(p))[n]
+
+#ifndef FD_SET
+#define FD_SET(n, p)    (__XFDS_BITS(p, ((n)/NFDBITS)) |= ((fd_mask)1 << ((n) % NFDBITS)))
+#endif
+#ifndef FD_CLR
+#define FD_CLR(n, p)    (__XFDS_BITS((p), ((n)/NFDBITS)) &= ~((fd_mask)1 << ((n) % NFDBITS)))
+#endif
+#ifndef FD_ISSET
+#define FD_ISSET(n, p)  ((__XFDS_BITS((p), ((n)/NFDBITS))) & ((fd_mask)1 << ((n) % NFDBITS)))
+#endif
+#ifndef FD_ZERO
+#define FD_ZERO(p)      bzero((char *)(p), sizeof(*(p)))
+#endif
+
+/*
+ * The howmany(FD_SETSIZE, NFDBITS) computes the number of elements in the
+ * array. before accessing an element in the array we check it exists.
+ * If it does not exist then the compiler discards the code to access it. 
+ */
+#define XFD_ANYSET(p) \
+        ((howmany(FD_SETSIZE, NFDBITS) > 0 && (__XFDS_BITS(p, 0))) || \
+        (howmany(FD_SETSIZE, NFDBITS) > 1 && (__XFDS_BITS(p, 1))) || \
+        (howmany(FD_SETSIZE, NFDBITS) > 2 && (__XFDS_BITS(p, 2))) || \
+        (howmany(FD_SETSIZE, NFDBITS) > 3 && (__XFDS_BITS(p, 3))) || \
+        (howmany(FD_SETSIZE, NFDBITS) > 4 && (__XFDS_BITS(p, 4))) || \
+        (howmany(FD_SETSIZE, NFDBITS) > 5 && (__XFDS_BITS(p, 5))) || \
+        (howmany(FD_SETSIZE, NFDBITS) > 6 && (__XFDS_BITS(p, 6))) || \
+        (howmany(FD_SETSIZE, NFDBITS) > 7 && (__XFDS_BITS(p, 7))) || \
+        (howmany(FD_SETSIZE, NFDBITS) > 8 && (__XFDS_BITS(p, 8))) || \
+        (howmany(FD_SETSIZE, NFDBITS) > 9 && (__XFDS_BITS(p, 9))) || \
+        (howmany(FD_SETSIZE, NFDBITS) > 10 && (__XFDS_BITS(p, 10))) || \
+        (howmany(FD_SETSIZE, NFDBITS) > 11 && (__XFDS_BITS(p, 11))) || \
+        (howmany(FD_SETSIZE, NFDBITS) > 12 && (__XFDS_BITS(p, 12))) || \
+        (howmany(FD_SETSIZE, NFDBITS) > 13 && (__XFDS_BITS(p, 13))) || \
+        (howmany(FD_SETSIZE, NFDBITS) > 14 && (__XFDS_BITS(p, 14))) || \
+        (howmany(FD_SETSIZE, NFDBITS) > 15 && (__XFDS_BITS(p, 15))))
+
+
+#define XFD_COPYSET(src,dst) { \
+        int __i__; \
+		for (__i__ = 0; __i__ < howmany(FD_SETSIZE, NFDBITS); __i__++) \
+            __XFDS_BITS((dst), __i__) = __XFDS_BITS((src), __i__); \
+        }
+#define XFD_ANDSET(dst,b1,b2) { \
+        int __i__; \
+        for (__i__ = 0; __i__ < howmany(FD_SETSIZE, NFDBITS); __i__++) \
+            __XFDS_BITS((dst), __i__) = ((__XFDS_BITS((b1), __i__)) & (__XFDS_BITS((b2), __i__))); \
+        }
+#define XFD_ORSET(dst,b1,b2) { \
+        int __i__; \
+        for (__i__ = 0; __i__ < howmany(FD_SETSIZE, NFDBITS); __i__++) \
+		__XFDS_BITS((dst), __i__) = ((__XFDS_BITS((b1), __i__)) | (__XFDS_BITS((b2), __i__))); \
+        }        
+#define XFD_UNSET(dst,b1) { \
+        int __i__; \
+        for (__i__ = 0; __i__ < howmany(FD_SETSIZE, NFDBITS); __i__++) \
+    		__XFDS_BITS((dst), __i__) &= ~(__XFDS_BITS((b1), __i__)); \
+        }
+
+#else /* USE_POLL */
+#include <sys/poll.h>
+#endif /* USE_POLL */
+
+#else /* WIN32 */
+
+#define XFD_SETSIZE	512
+#ifndef FD_SETSIZE
+#define FD_SETSIZE	XFD_SETSIZE
+#endif
+#include <X11/Xwinsock.h>
+
+#define Select(n,r,w,e,t) select(0,(fd_set*)r,(fd_set*)w,(fd_set*)e,(struct timeval*)t)
+
+#define XFD_SETCOUNT(p)	(((fd_set FAR *)(p))->fd_count)
+#define XFD_FD(p,i) (((fd_set FAR *)(p))->fd_array[i])
+#define XFD_ANYSET(p)	XFD_SETCOUNT(p)
+
+#define XFD_COPYSET(src,dst) { \
+    u_int __i; \
+    FD_ZERO(dst); \
+    for (__i = 0; __i < XFD_SETCOUNT(src) ; __i++) { \
+        XFD_FD(dst,__i) = XFD_FD(src,__i); \
+    } \
+    XFD_SETCOUNT(dst) = XFD_SETCOUNT(src); \
+}
+
+#define XFD_ANDSET(dst,b1,b2) { \
+    u_int __i; \
+    FD_ZERO(dst); \
+    for (__i = 0; __i < XFD_SETCOUNT(b1) ; __i++) { \
+        if (FD_ISSET(XFD_FD(b1,__i), b2)) \
+	   FD_SET(XFD_FD(b1,__i), dst); \
+    } \
+}
+
+#define XFD_ORSET(dst,b1,b2) { \
+    u_int __i; \
+    if (dst != b1) XFD_COPYSET(b1,dst); \
+    for (__i = 0; __i < XFD_SETCOUNT(b2) ; __i++) { \
+        if (!FD_ISSET(XFD_FD(b2,__i), dst)) \
+	   FD_SET(XFD_FD(b2,__i), dst); \
+    } \
+}
+
+/* this one is really sub-optimal */
+#define XFD_UNSET(dst,b1) { \
+    u_int __i; \
+    for (__i = 0; __i < XFD_SETCOUNT(b1) ; __i++) { \
+	FD_CLR(XFD_FD(b1,__i), dst); \
+    } \
+}
+
+/* we have to pay the price of having an array here, unlike with bitmasks
+   calling twice FD_SET with the same fd is not transparent, so be careful */
+#undef FD_SET
+#define FD_SET(fd,set) do { \
+    if (XFD_SETCOUNT(set) < FD_SETSIZE && !FD_ISSET(fd,set)) \
+        XFD_FD(set,XFD_SETCOUNT(set)++)=(fd); \
+} while(0)
+
+#define getdtablesize() FD_SETSIZE 
+
+#endif /* WIN32 */
+
+#endif /* _XPOLL_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xproto.h b/ThirdParty/X11/Include/X11/Xproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..6cdea89cd023a9e1d1ed6bb34187cc1e51447f82
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xproto.h
@@ -0,0 +1,2157 @@
+/* Definitions for the X window system used by server and c bindings */
+
+/*
+ * This packet-construction scheme makes the following assumptions:
+ *
+ * 1. The compiler is able
+ * to generate code which addresses one- and two-byte quantities.
+ * In the worst case, this would be done with bit-fields.  If bit-fields
+ * are used it may be necessary to reorder the request fields in this file,
+ * depending on the order in which the machine assigns bit fields to
+ * machine words.  There may also be a problem with sign extension,
+ * as K+R specify that bitfields are always unsigned.
+ *
+ * 2. 2- and 4-byte fields in packet structures must be ordered by hand
+ * such that they are naturally-aligned, so that no compiler will ever
+ * insert padding bytes.
+ *
+ * 3. All packets are hand-padded to a multiple of 4 bytes, for
+ * the same reason.
+ */
+
+#ifndef XPROTO_H
+#define XPROTO_H
+
+/***********************************************************
+
+Copyright 1987, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#include <X11/Xmd.h>
+#include <X11/Xprotostr.h>
+
+/*
+ * Define constants for the sizes of the network packets.  The sz_ prefix is
+ * used instead of something more descriptive so that the symbols are no more
+ * than 32 characters in length (which causes problems for some compilers).
+ */
+#define sz_xSegment 8
+#define sz_xPoint 4
+#define sz_xRectangle 8
+#define sz_xArc 12
+#define sz_xConnClientPrefix 12
+#define sz_xConnSetupPrefix 8
+#define sz_xConnSetup 32
+#define sz_xPixmapFormat 8
+#define sz_xDepth 8
+#define sz_xVisualType 24
+#define sz_xWindowRoot 40
+#define sz_xTimecoord 8
+#define sz_xHostEntry 4
+#define sz_xCharInfo 12
+#define sz_xFontProp 8
+#define sz_xTextElt 2
+#define sz_xColorItem 12
+#define sz_xrgb 8
+#define sz_xGenericReply 32
+#define sz_xGetWindowAttributesReply 44
+#define sz_xGetGeometryReply 32
+#define sz_xQueryTreeReply 32
+#define sz_xInternAtomReply 32
+#define sz_xGetAtomNameReply 32
+#define sz_xGetPropertyReply 32
+#define sz_xListPropertiesReply 32
+#define sz_xGetSelectionOwnerReply 32
+#define sz_xGrabPointerReply 32
+#define sz_xQueryPointerReply 32
+#define sz_xGetMotionEventsReply 32
+#define sz_xTranslateCoordsReply 32
+#define sz_xGetInputFocusReply 32
+#define sz_xQueryKeymapReply 40
+#define sz_xQueryFontReply 60
+#define sz_xQueryTextExtentsReply 32
+#define sz_xListFontsReply 32
+#define sz_xGetFontPathReply 32
+#define sz_xGetImageReply 32
+#define sz_xListInstalledColormapsReply 32
+#define sz_xAllocColorReply 32
+#define sz_xAllocNamedColorReply 32
+#define sz_xAllocColorCellsReply 32
+#define sz_xAllocColorPlanesReply 32
+#define sz_xQueryColorsReply 32
+#define sz_xLookupColorReply 32
+#define sz_xQueryBestSizeReply 32
+#define sz_xQueryExtensionReply 32
+#define sz_xListExtensionsReply 32
+#define sz_xSetMappingReply 32
+#define sz_xGetKeyboardControlReply 52
+#define sz_xGetPointerControlReply 32
+#define sz_xGetScreenSaverReply 32
+#define sz_xListHostsReply 32
+#define sz_xSetModifierMappingReply 32
+#define sz_xError 32
+#define sz_xEvent 32
+#define sz_xKeymapEvent 32
+#define sz_xReq 4
+#define sz_xResourceReq 8
+#define sz_xCreateWindowReq 32
+#define sz_xChangeWindowAttributesReq 12
+#define sz_xChangeSaveSetReq 8
+#define sz_xReparentWindowReq 16
+#define sz_xConfigureWindowReq 12
+#define sz_xCirculateWindowReq 8
+#define sz_xInternAtomReq 8
+#define sz_xChangePropertyReq 24
+#define sz_xDeletePropertyReq 12
+#define sz_xGetPropertyReq 24
+#define sz_xSetSelectionOwnerReq 16
+#define sz_xConvertSelectionReq 24
+#define sz_xSendEventReq 44
+#define sz_xGrabPointerReq 24
+#define sz_xGrabButtonReq 24
+#define sz_xUngrabButtonReq 12
+#define sz_xChangeActivePointerGrabReq 16
+#define sz_xGrabKeyboardReq 16
+#define sz_xGrabKeyReq 16
+#define sz_xUngrabKeyReq 12
+#define sz_xAllowEventsReq 8
+#define sz_xGetMotionEventsReq 16
+#define sz_xTranslateCoordsReq 16
+#define sz_xWarpPointerReq 24
+#define sz_xSetInputFocusReq 12
+#define sz_xOpenFontReq 12
+#define sz_xQueryTextExtentsReq 8
+#define sz_xListFontsReq 8
+#define sz_xSetFontPathReq 8
+#define sz_xCreatePixmapReq 16
+#define sz_xCreateGCReq 16
+#define sz_xChangeGCReq 12
+#define sz_xCopyGCReq 16
+#define sz_xSetDashesReq 12
+#define sz_xSetClipRectanglesReq 12
+#define sz_xCopyAreaReq 28
+#define sz_xCopyPlaneReq 32
+#define sz_xPolyPointReq 12
+#define sz_xPolySegmentReq 12
+#define sz_xFillPolyReq 16
+#define sz_xPutImageReq 24
+#define sz_xGetImageReq 20
+#define sz_xPolyTextReq 16
+#define sz_xImageTextReq 16
+#define sz_xCreateColormapReq 16
+#define sz_xCopyColormapAndFreeReq 12
+#define sz_xAllocColorReq 16
+#define sz_xAllocNamedColorReq 12
+#define sz_xAllocColorCellsReq 12
+#define sz_xAllocColorPlanesReq 16
+#define sz_xFreeColorsReq 12
+#define sz_xStoreColorsReq 8
+#define sz_xStoreNamedColorReq 16
+#define sz_xQueryColorsReq 8
+#define sz_xLookupColorReq 12
+#define sz_xCreateCursorReq 32
+#define sz_xCreateGlyphCursorReq 32
+#define sz_xRecolorCursorReq 20
+#define sz_xQueryBestSizeReq 12
+#define sz_xQueryExtensionReq 8
+#define sz_xChangeKeyboardControlReq 8
+#define sz_xBellReq 4
+#define sz_xChangePointerControlReq 12
+#define sz_xSetScreenSaverReq 12
+#define sz_xChangeHostsReq 8
+#define sz_xListHostsReq 4
+#define sz_xChangeModeReq 4
+#define sz_xRotatePropertiesReq 12
+#define sz_xReply 32
+#define sz_xGrabKeyboardReply 32
+#define sz_xListFontsWithInfoReply 60
+#define sz_xSetPointerMappingReply 32
+#define sz_xGetKeyboardMappingReply 32
+#define sz_xGetPointerMappingReply 32
+#define sz_xGetModifierMappingReply 32
+#define sz_xListFontsWithInfoReq 8
+#define sz_xPolyLineReq 12
+#define sz_xPolyArcReq 12
+#define sz_xPolyRectangleReq 12
+#define sz_xPolyFillRectangleReq 12
+#define sz_xPolyFillArcReq 12
+#define sz_xPolyText8Req 16
+#define sz_xPolyText16Req 16
+#define sz_xImageText8Req 16
+#define sz_xImageText16Req 16
+#define sz_xSetPointerMappingReq 4
+#define sz_xForceScreenSaverReq 4
+#define sz_xSetCloseDownModeReq 4
+#define sz_xClearAreaReq 16
+#define sz_xSetAccessControlReq 4
+#define sz_xGetKeyboardMappingReq 8
+#define sz_xSetModifierMappingReq 4
+#define sz_xPropIconSize 24
+#define sz_xChangeKeyboardMappingReq 8
+
+
+/* For the purpose of the structure definitions in this file,
+we must redefine the following types in terms of Xmd.h's types, which may
+include bit fields.  All of these are #undef'd at the end of this file,
+restoring the definitions in X.h.  */
+
+#define Window CARD32
+#define Drawable CARD32
+#define Font CARD32
+#define Pixmap CARD32
+#define Cursor CARD32
+#define Colormap CARD32
+#define GContext CARD32
+#define Atom CARD32
+#define VisualID CARD32
+#define Time CARD32
+#define KeyCode CARD8
+#define KeySym CARD32
+
+#define X_TCP_PORT 6000     /* add display number */
+
+#define xTrue        1
+#define xFalse       0
+
+
+typedef CARD16 KeyButMask;
+
+/***************** 
+   Connection setup structures.  See Chapter 8: Connection Setup
+   of the X Window System Protocol specification for details.
+*****************/
+
+/* Client initiates handshake with this data, followed by the strings
+ * for the auth protocol & data.
+ */
+typedef struct {
+    CARD8	byteOrder;
+    BYTE	pad;
+    CARD16	majorVersion B16, minorVersion B16;
+    CARD16	nbytesAuthProto B16;	/* Authorization protocol */
+    CARD16	nbytesAuthString B16;	/* Authorization string */
+    CARD16	pad2 B16;
+} xConnClientPrefix;
+
+/* Server response to xConnClientPrefix.
+ *
+ * If success == Success, this is followed by xConnSetup and
+ * numRoots xWindowRoot structs.
+ *
+ * If success == Failure, this is followed by a reason string.
+ *
+ * The protocol also defines a case of success == Authenticate, but
+ * that doesn't seem to have ever been implemented by the X Consortium.
+ */
+typedef struct {
+    CARD8          success;
+    BYTE           lengthReason; /*num bytes in string following if failure */
+    CARD16         majorVersion B16, 
+                   minorVersion B16;
+    CARD16         length B16;  /* 1/4 additional bytes in setup info */
+} xConnSetupPrefix;
+
+
+typedef struct {
+    CARD32         release B32;
+    CARD32         ridBase B32, 
+                   ridMask B32;
+    CARD32         motionBufferSize B32;
+    CARD16         nbytesVendor B16;  /* number of bytes in vendor string */
+    CARD16         maxRequestSize B16;
+    CARD8          numRoots;          /* number of roots structs to follow */
+    CARD8          numFormats;        /* number of pixmap formats */
+    CARD8          imageByteOrder;        /* LSBFirst, MSBFirst */
+    CARD8          bitmapBitOrder;        /* LeastSignificant, MostSign...*/
+    CARD8          bitmapScanlineUnit,     /* 8, 16, 32 */
+                   bitmapScanlinePad;     /* 8, 16, 32 */
+    KeyCode	   minKeyCode, maxKeyCode;
+    CARD32	   pad2 B32;
+} xConnSetup;
+
+typedef struct {
+    CARD8          depth;
+    CARD8          bitsPerPixel;
+    CARD8          scanLinePad;
+    CARD8          pad1;
+    CARD32	   pad2 B32;
+} xPixmapFormat;
+
+/* window root */
+
+typedef struct {
+    CARD8 	depth;
+    CARD8 	pad1;
+    CARD16	nVisuals B16;  /* number of xVisualType structures following */
+    CARD32	pad2 B32;
+    } xDepth;
+
+typedef struct {
+    VisualID visualID B32;
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8 c_class;
+#else
+    CARD8 class;
+#endif
+    CARD8 bitsPerRGB;
+    CARD16 colormapEntries B16;
+    CARD32 redMask B32, greenMask B32, blueMask B32;
+    CARD32 pad B32;
+    } xVisualType;
+
+typedef struct {
+    Window         windowId B32;
+    Colormap       defaultColormap B32;
+    CARD32         whitePixel B32, blackPixel B32;
+    CARD32         currentInputMask B32;   
+    CARD16         pixWidth B16, pixHeight B16;
+    CARD16         mmWidth B16, mmHeight B16;
+    CARD16         minInstalledMaps B16, maxInstalledMaps B16;
+    VisualID       rootVisualID B32;
+    CARD8          backingStore;
+    BOOL           saveUnders;
+    CARD8          rootDepth;
+    CARD8          nDepths;  /* number of xDepth structures following */
+} xWindowRoot;
+
+
+/*****************************************************************
+ * Structure Defns
+ *   Structures needed for replies 
+ *****************************************************************/
+
+/* Used in GetMotionEvents */
+
+typedef struct {
+    CARD32 time B32;
+    INT16 x B16, y B16;
+} xTimecoord;
+
+typedef struct {
+    CARD8 family;
+    BYTE pad;
+    CARD16 length B16;
+} xHostEntry;
+
+typedef struct {
+    INT16 leftSideBearing B16,
+	  rightSideBearing B16,
+	  characterWidth B16,
+	  ascent B16,
+	  descent B16;
+    CARD16 attributes B16;
+} xCharInfo;
+
+typedef struct {
+    Atom name B32;
+    CARD32 value B32;
+} xFontProp;
+
+/*
+ * non-aligned big-endian font ID follows this struct
+ */
+typedef struct {           /* followed by string */
+    CARD8 len;	/* number of *characters* in string, or FontChange (255)
+		   for font change, or 0 if just delta given */
+    INT8 delta;
+} xTextElt;
+
+
+typedef struct {        
+    CARD32 pixel B32;
+    CARD16 red B16, green B16, blue B16;
+    CARD8 flags;  /* DoRed, DoGreen, DoBlue booleans */
+    CARD8 pad;
+} xColorItem;
+
+
+typedef struct {
+    CARD16 red B16, green B16, blue B16, pad B16;
+} xrgb;
+
+typedef CARD8 KEYCODE;
+
+
+/*****************
+ * XRep:
+ *    meant to be 32 byte quantity 
+ *****************/
+
+/* GenericReply is the common format of all replies.  The "data" items
+   are specific to each individual reply type. */
+
+typedef struct {	
+    BYTE type;              /* X_Reply */
+    BYTE data1;             /* depends on reply type */
+    CARD16 sequenceNumber B16;  /* of last request received by server */
+    CARD32 length B32;      /* 4 byte quantities beyond size of GenericReply */
+    CARD32 data00 B32;
+    CARD32 data01 B32;
+    CARD32 data02 B32;
+    CARD32 data03 B32;
+    CARD32 data04 B32;
+    CARD32 data05 B32;
+    } xGenericReply;
+
+/* Individual reply formats. */
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    CARD8 backingStore;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;	/* NOT 0; this is an extra-large reply */
+    VisualID visualID B32;
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD16 c_class B16;
+#else
+    CARD16 class B16;
+#endif
+    CARD8 bitGravity;
+    CARD8 winGravity;
+    CARD32 backingBitPlanes B32;
+    CARD32 backingPixel B32;
+    BOOL saveUnder;
+    BOOL mapInstalled;
+    CARD8 mapState;
+    BOOL override;
+    Colormap colormap B32;
+    CARD32 allEventMasks B32;
+    CARD32 yourEventMask B32;
+    CARD16 doNotPropagateMask B16;
+    CARD16 pad B16;
+    } xGetWindowAttributesReply;
+
+typedef struct {
+    BYTE type;   /* X_Reply */
+    CARD8 depth;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;  /* 0 */
+    Window root B32;
+    INT16 x B16, y B16;
+    CARD16 width B16, height B16;
+    CARD16 borderWidth B16;
+    CARD16 pad1 B16;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    } xGetGeometryReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    BYTE pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    Window root B32, parent B32;
+    CARD16 nChildren B16;
+    CARD16 pad2 B16;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    } xQueryTreeReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    BYTE pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32; /* 0 */
+    Atom atom B32;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    } xInternAtomReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    BYTE pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;  /* of additional bytes */
+    CARD16 nameLength B16;  /* # of characters in name */
+    CARD16 pad2 B16;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    CARD32 pad7 B32;
+    } xGetAtomNameReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    CARD8 format;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32; /* of additional bytes */
+    Atom propertyType B32;
+    CARD32 bytesAfter B32;
+    CARD32 nItems B32; /* # of 8, 16, or 32-bit entities in reply */
+    CARD32 pad1 B32;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    } xGetPropertyReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    BYTE pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD16 nProperties B16;
+    CARD16 pad2 B16;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    CARD32 pad7 B32;
+    } xListPropertiesReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    BYTE pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;  /* 0 */
+    Window owner B32;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    } xGetSelectionOwnerReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    BYTE status;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;  /* 0 */
+    CARD32 pad1 B32;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    } xGrabPointerReply;
+
+typedef xGrabPointerReply xGrabKeyboardReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    BOOL sameScreen;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;  /* 0 */
+    Window root B32, child B32;
+    INT16 rootX B16, rootY B16, winX B16, winY B16;
+    CARD16 mask B16;
+    CARD16 pad1 B16;
+    CARD32 pad B32;
+    } xQueryPointerReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    BYTE pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD32 nEvents B32;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    } xGetMotionEventsReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    BOOL sameScreen;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32; /* 0 */
+    Window child B32;
+    INT16 dstX B16, dstY B16;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    } xTranslateCoordsReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    CARD8 revertTo;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;  /* 0 */
+    Window focus B32;
+    CARD32 pad1 B32;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    } xGetInputFocusReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    BYTE pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;  /* 2, NOT 0; this is an extra-large reply */
+    BYTE map[32];
+    } xQueryKeymapReply;
+
+/* Warning: this MUST match (up to component renaming) xListFontsWithInfoReply */
+typedef struct _xQueryFontReply {
+    BYTE type;  /* X_Reply */
+    BYTE pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;  /* definitely > 0, even if "nCharInfos" is 0 */
+    xCharInfo minBounds; 
+    CARD32 walign1 B32;
+    xCharInfo maxBounds; 
+    CARD32 walign2 B32;
+    CARD16 minCharOrByte2 B16, maxCharOrByte2 B16;
+    CARD16 defaultChar B16;
+    CARD16 nFontProps B16;  /* followed by this many xFontProp structures */
+    CARD8 drawDirection;
+    CARD8 minByte1, maxByte1;
+    BOOL allCharsExist;
+    INT16 fontAscent B16, fontDescent B16;
+    CARD32 nCharInfos B32; /* followed by this many xCharInfo structures */
+} xQueryFontReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    CARD8 drawDirection;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;  /* 0 */
+    INT16 fontAscent B16, fontDescent B16;
+    INT16 overallAscent B16, overallDescent B16;
+    INT32 overallWidth B32, overallLeft B32, overallRight B32;
+    CARD32 pad B32;
+    } xQueryTextExtentsReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    BYTE pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD16 nFonts B16;
+    CARD16 pad2 B16;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    CARD32 pad7 B32;
+    } xListFontsReply;
+
+/* Warning: this MUST match (up to component renaming) xQueryFontReply */
+typedef struct {
+    BYTE type;  /* X_Reply */
+    CARD8 nameLength;  /* 0 indicates end-of-reply-sequence */
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;  /* definitely > 0, even if "nameLength" is 0 */
+    xCharInfo minBounds; 
+    CARD32 walign1 B32;
+    xCharInfo maxBounds; 
+    CARD32 walign2 B32;
+    CARD16 minCharOrByte2 B16, maxCharOrByte2 B16;
+    CARD16 defaultChar B16;
+    CARD16 nFontProps B16;  /* followed by this many xFontProp structures */
+    CARD8 drawDirection;
+    CARD8 minByte1, maxByte1;
+    BOOL allCharsExist;
+    INT16 fontAscent B16, fontDescent B16;
+    CARD32 nReplies B32;   /* hint as to how many more replies might be coming */
+} xListFontsWithInfoReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    BYTE pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD16 nPaths B16;
+    CARD16 pad2 B16;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    CARD32 pad7 B32;
+    } xGetFontPathReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    CARD8 depth;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    VisualID visual B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    CARD32 pad7 B32;
+    } xGetImageReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    BYTE pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD16 nColormaps B16;
+    CARD16 pad2 B16;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    CARD32 pad7 B32;
+    } xListInstalledColormapsReply;
+
+typedef struct {
+    BYTE type; /* X_Reply */
+    BYTE pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;   /* 0 */
+    CARD16 red B16, green B16, blue B16;
+    CARD16 pad2 B16;
+    CARD32 pixel B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    } xAllocColorReply;
+
+typedef struct {
+    BYTE type; /* X_Reply */
+    BYTE pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;  /* 0 */
+    CARD32 pixel B32;
+    CARD16 exactRed B16, exactGreen B16, exactBlue B16;
+    CARD16 screenRed B16, screenGreen B16, screenBlue B16;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    } xAllocNamedColorReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    BYTE pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD16 nPixels B16, nMasks B16;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    CARD32 pad7 B32;
+    } xAllocColorCellsReply;
+
+typedef struct {
+    BYTE type; /* X_Reply */
+    BYTE pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD16 nPixels B16;
+    CARD16 pad2 B16;
+    CARD32 redMask B32, greenMask B32, blueMask B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    } xAllocColorPlanesReply;
+
+typedef struct {
+    BYTE type; /* X_Reply */
+    BYTE pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD16 nColors B16;
+    CARD16 pad2 B16;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    CARD32 pad7 B32;
+    } xQueryColorsReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    BYTE pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;  /* 0 */
+    CARD16 exactRed B16, exactGreen B16, exactBlue B16;
+    CARD16 screenRed B16, screenGreen B16, screenBlue B16;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    } xLookupColorReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    BYTE pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;  /* 0 */
+    CARD16 width B16, height B16;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    CARD32 pad7 B32;
+    } xQueryBestSizeReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    BYTE pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32; /* 0 */
+    BOOL  present;
+    CARD8 major_opcode;
+    CARD8 first_event;
+    CARD8 first_error;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    CARD32 pad7 B32;
+    } xQueryExtensionReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    CARD8 nExtensions;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    CARD32 pad7 B32;
+    } xListExtensionsReply;
+
+
+typedef struct {
+    BYTE   type;  /* X_Reply */
+    CARD8  success;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    CARD32 pad7 B32;
+    } xSetMappingReply;
+typedef xSetMappingReply xSetPointerMappingReply;
+typedef xSetMappingReply xSetModifierMappingReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    CARD8 nElts;  /* how many elements does the map have */
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    CARD32 pad7 B32;
+    } xGetPointerMappingReply;
+
+typedef struct {
+    BYTE type;
+    CARD8 keySymsPerKeyCode;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    CARD32 pad7 B32;
+} xGetKeyboardMappingReply;    
+
+typedef struct {
+    BYTE type;
+    CARD8 numKeyPerModifier;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD32 pad1 B32;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+} xGetModifierMappingReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    BOOL globalAutoRepeat;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;  /* 5 */
+    CARD32 ledMask B32;
+    CARD8 keyClickPercent, bellPercent;
+    CARD16 bellPitch B16, bellDuration B16;
+    CARD16 pad B16;
+    BYTE map[32];  /* bit masks start here */
+    } xGetKeyboardControlReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    BYTE pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;  /* 0 */
+    CARD16 accelNumerator B16, accelDenominator B16;
+    CARD16 threshold B16;
+    CARD16 pad2 B16;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    } xGetPointerControlReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    BYTE pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;  /* 0 */
+    CARD16 timeout B16, interval B16;
+    BOOL preferBlanking;
+    BOOL allowExposures;
+    CARD16 pad2 B16;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    } xGetScreenSaverReply;
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    BOOL enabled;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD16 nHosts B16;
+    CARD16 pad1 B16;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    CARD32 pad7 B32;
+    } xListHostsReply;
+
+
+
+
+/*****************************************************************
+ * Xerror
+ *    All errors  are 32 bytes 
+ *****************************************************************/
+
+typedef struct {
+    BYTE type;                  /* X_Error */
+    BYTE errorCode;
+    CARD16 sequenceNumber B16;       /* the nth request from this client */
+    CARD32 resourceID B32;
+    CARD16 minorCode B16;
+    CARD8 majorCode;
+    BYTE pad1;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    CARD32 pad7 B32;
+} xError;
+
+/*****************************************************************
+ * xEvent
+ *    All events are 32 bytes
+ *****************************************************************/
+
+typedef struct _xEvent {
+    union {
+	struct {
+	    BYTE type;
+	    BYTE detail;
+	    CARD16 sequenceNumber B16;
+	    } u;
+	struct {
+            CARD32 pad00 B32;
+	    Time time B32;
+	    Window root B32, event B32, child B32;
+	    INT16 rootX B16, rootY B16, eventX B16, eventY B16;
+	    KeyButMask state B16;
+	    BOOL sameScreen;		
+	    BYTE pad1;
+	} keyButtonPointer;
+	struct {
+            CARD32 pad00 B32;
+            Time time B32;
+	    Window root B32, event B32, child B32;
+	    INT16 rootX B16, rootY B16, eventX B16, eventY B16;
+	    KeyButMask state B16;
+	    BYTE mode; 			/* really XMode */
+	    BYTE flags;		/* sameScreen and focus booleans, packed together */
+#define ELFlagFocus        (1<<0)
+#define ELFlagSameScreen   (1<<1)
+	} enterLeave;
+	struct {
+            CARD32 pad00 B32;
+	    Window window B32;
+	    BYTE mode; 			/* really XMode */
+	    BYTE pad1, pad2, pad3;
+	} focus;
+	struct {
+            CARD32 pad00 B32;
+	    Window window B32;
+	    CARD16 x B16, y B16, width B16, height B16;
+	    CARD16 count B16;
+	    CARD16 pad2 B16;
+	} expose;
+	struct {
+            CARD32 pad00 B32;
+	    Drawable drawable B32;
+	    CARD16 x B16, y B16, width B16, height B16;
+	    CARD16 minorEvent B16;
+	    CARD16 count B16;
+	    BYTE majorEvent;
+	    BYTE pad1, pad2, pad3;
+	} graphicsExposure;
+	struct {
+            CARD32 pad00 B32;
+	    Drawable drawable B32;
+	    CARD16 minorEvent B16;
+	    BYTE majorEvent;
+	    BYTE bpad;
+	} noExposure;
+	struct {
+            CARD32 pad00 B32;
+	    Window window B32;
+	    CARD8 state;
+	    BYTE pad1, pad2, pad3;
+	} visibility;
+	struct {
+            CARD32 pad00 B32;
+	    Window parent B32, window B32;
+	    INT16 x B16, y B16;
+	    CARD16 width B16, height B16, borderWidth B16;
+	    BOOL override;
+	    BYTE bpad;
+        } createNotify;
+/*
+ * The event fields in the structures for DestroyNotify, UnmapNotify,
+ * MapNotify, ReparentNotify, ConfigureNotify, CirculateNotify, GravityNotify,
+ * must be at the same offset because server internal code is depending upon
+ * this to patch up the events before they are delivered.
+ * Also note that MapRequest, ConfigureRequest and CirculateRequest have
+ * the same offset for the event window.
+ */
+	struct {
+            CARD32 pad00 B32;
+	    Window event B32, window B32;
+	} destroyNotify;
+	struct {
+            CARD32 pad00 B32;
+	    Window event B32, window B32;
+	    BOOL fromConfigure;
+	    BYTE pad1, pad2, pad3;
+        } unmapNotify;
+	struct {
+            CARD32 pad00 B32;
+	    Window event B32, window B32;
+	    BOOL override;
+	    BYTE pad1, pad2, pad3;
+        } mapNotify;
+	struct {
+            CARD32 pad00 B32;
+	    Window parent B32, window B32;
+        } mapRequest;
+	struct {
+            CARD32 pad00 B32;
+	    Window event B32, window B32, parent B32;
+	    INT16 x B16, y B16;
+	    BOOL override;
+	    BYTE pad1, pad2, pad3;
+	} reparent;
+	struct {
+            CARD32 pad00 B32;
+	    Window event B32, window B32, aboveSibling B32;
+	    INT16 x B16, y B16;
+	    CARD16 width B16, height B16, borderWidth B16;
+	    BOOL override;		
+	    BYTE bpad;
+	} configureNotify;
+	struct {
+            CARD32 pad00 B32;
+	    Window parent B32, window B32, sibling B32;
+	    INT16 x B16, y B16;
+	    CARD16 width B16, height B16, borderWidth B16;
+	    CARD16 valueMask B16;
+	    CARD32 pad1 B32;
+	} configureRequest;
+	struct {
+            CARD32 pad00 B32;
+	    Window event B32, window B32;
+	    INT16 x B16, y B16;
+	    CARD32 pad1 B32, pad2 B32, pad3 B32, pad4 B32;
+	} gravity;
+	struct {
+            CARD32 pad00 B32;
+	    Window window B32;
+	    CARD16 width B16, height B16;
+	} resizeRequest;
+	struct {
+/* The event field in the circulate record is really the parent when this
+   is used as a CirculateRequest instead of a CirculateNotify */
+            CARD32 pad00 B32;
+	    Window event B32, window B32, parent B32;
+	    BYTE place;			/* Top or Bottom */
+	    BYTE pad1, pad2, pad3;
+	} circulate;
+	struct {
+            CARD32 pad00 B32;
+	    Window window B32;
+	    Atom atom B32;
+	    Time time B32;
+	    BYTE state;			/* NewValue or Deleted */
+	    BYTE pad1;
+	    CARD16 pad2 B16;
+	} property;
+	struct {
+            CARD32 pad00 B32;
+            Time time B32;     
+	    Window window B32;
+	    Atom atom B32;
+	} selectionClear;
+	struct {
+            CARD32 pad00 B32;
+            Time time B32;    
+	    Window owner B32, requestor B32;
+	    Atom selection B32, target B32, property B32;
+	} selectionRequest;
+	struct {
+            CARD32 pad00 B32;
+            Time time B32;   
+	    Window requestor B32;
+	    Atom selection B32, target B32, property B32;
+	} selectionNotify;
+	struct {
+            CARD32 pad00 B32;
+	    Window window B32;
+	    Colormap colormap B32;
+#if defined(__cplusplus) || defined(c_plusplus)
+	    BOOL c_new;
+#else
+	    BOOL new;
+#endif
+	    BYTE state;			/* Installed or UnInstalled */
+	    BYTE pad1, pad2;
+	} colormap;
+	struct {
+	    CARD32 pad00 B32;
+	    CARD8 request;
+	    KeyCode firstKeyCode;
+	    CARD8 count;
+	    BYTE pad1;
+	} mappingNotify;
+	struct {
+            CARD32 pad00 B32;
+	    Window window B32;
+	    union {
+		struct {
+		    Atom type B32;
+		    INT32 longs0 B32;
+		    INT32 longs1 B32;
+		    INT32 longs2 B32;
+		    INT32 longs3 B32;
+		    INT32 longs4 B32;
+		} l;
+		struct {
+		    Atom type B32;
+		    INT16 shorts0 B16;
+		    INT16 shorts1 B16;
+		    INT16 shorts2 B16;
+		    INT16 shorts3 B16;
+		    INT16 shorts4 B16;
+		    INT16 shorts5 B16;
+		    INT16 shorts6 B16;
+		    INT16 shorts7 B16;
+		    INT16 shorts8 B16;
+		    INT16 shorts9 B16;
+		} s;
+		struct {
+		    Atom type B32;
+		    INT8 bytes[20];
+		} b;
+	    } u; 
+	} clientMessage;
+    } u;
+} xEvent;
+
+/*********************************************************
+ *
+ * Generic event
+ * 
+ * Those events are not part of the core protocol spec and can be used by
+ * various extensions.
+ * type is always GenericEvent
+ * extension is the minor opcode of the extension the event belongs to.
+ * evtype is the actual event type, unique __per extension__. 
+ *
+ * GenericEvents can be longer than 32 bytes, with the length field
+ * specifying the number of 4 byte blocks after the first 32 bytes. 
+ *
+ *
+ */
+typedef struct 
+{
+    BYTE    type;
+    CARD8   extension;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD16  evtype B16;
+    CARD16  pad2 B16;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+    CARD32  pad6 B32;
+    CARD32  pad7 B32;
+} xGenericEvent;
+
+
+
+/* KeymapNotify events are not included in the above union because they
+   are different from all other events: they do not have a "detail"
+   or "sequenceNumber", so there is room for a 248-bit key mask. */
+
+typedef struct {
+    BYTE type;
+    BYTE map[31];
+    } xKeymapEvent;
+
+#define XEventSize (sizeof(xEvent))
+
+/* XReply is the union of all the replies above whose "fixed part"
+fits in 32 bytes.  It does NOT include GetWindowAttributesReply,
+QueryFontReply, QueryKeymapReply, or GetKeyboardControlReply 
+ListFontsWithInfoReply */
+
+typedef union {
+    xGenericReply generic;
+    xGetGeometryReply geom;
+    xQueryTreeReply tree;
+    xInternAtomReply atom;
+    xGetAtomNameReply atomName;
+    xGetPropertyReply property;
+    xListPropertiesReply listProperties;
+    xGetSelectionOwnerReply selection;
+    xGrabPointerReply grabPointer;
+    xGrabKeyboardReply grabKeyboard;
+    xQueryPointerReply pointer;
+    xGetMotionEventsReply motionEvents;
+    xTranslateCoordsReply coords;
+    xGetInputFocusReply inputFocus;
+    xQueryTextExtentsReply textExtents;
+    xListFontsReply fonts;
+    xGetFontPathReply fontPath;
+    xGetImageReply image;
+    xListInstalledColormapsReply colormaps;
+    xAllocColorReply allocColor;
+    xAllocNamedColorReply allocNamedColor;
+    xAllocColorCellsReply colorCells;
+    xAllocColorPlanesReply colorPlanes;
+    xQueryColorsReply colors;
+    xLookupColorReply lookupColor;
+    xQueryBestSizeReply bestSize;
+    xQueryExtensionReply extension;
+    xListExtensionsReply extensions;
+    xSetModifierMappingReply setModifierMapping;
+    xGetModifierMappingReply getModifierMapping;
+    xSetPointerMappingReply setPointerMapping;
+    xGetKeyboardMappingReply getKeyboardMapping;
+    xGetPointerMappingReply getPointerMapping;
+    xGetPointerControlReply pointerControl;
+    xGetScreenSaverReply screenSaver;
+    xListHostsReply hosts;
+    xError error;
+    xEvent event;
+} xReply;
+
+
+
+/*****************************************************************
+ * REQUESTS
+ *****************************************************************/
+
+
+/* Request structure */
+
+typedef struct _xReq {
+	CARD8 reqType;
+	CARD8 data;            /* meaning depends on request type */
+	CARD16 length B16;         /* length in 4 bytes quantities 
+				  of whole request, including this header */
+} xReq;
+
+/*****************************************************************
+ *  structures that follow request. 
+ *****************************************************************/
+
+/* ResourceReq is used for any request which has a resource ID 
+   (or Atom or Time) as its one and only argument.  */
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    CARD32 id B32;  /* a Window, Drawable, Font, GContext, Pixmap, etc. */
+    } xResourceReq;
+
+typedef struct {
+    CARD8 reqType;
+    CARD8 depth;
+    CARD16 length B16;
+    Window wid B32, parent B32;
+    INT16 x B16, y B16;
+    CARD16 width B16, height B16, borderWidth B16;  
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD16 c_class B16;
+#else
+    CARD16 class B16;
+#endif
+    VisualID visual B32;
+    CARD32 mask B32;
+} xCreateWindowReq;
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Window window B32;
+    CARD32 valueMask B32; 
+} xChangeWindowAttributesReq;
+
+typedef struct {
+    CARD8 reqType;
+    BYTE mode;
+    CARD16 length B16;
+    Window window B32;
+} xChangeSaveSetReq;
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Window window B32, parent B32;
+    INT16 x B16, y B16;
+} xReparentWindowReq;
+
+typedef struct {
+    CARD8 reqType;
+    CARD8 pad;
+    CARD16 length B16;
+    Window window B32;
+    CARD16 mask B16;
+    CARD16 pad2 B16;
+} xConfigureWindowReq;
+
+typedef struct {
+    CARD8 reqType;
+    CARD8 direction;
+    CARD16 length B16;
+    Window window B32;
+} xCirculateWindowReq;
+
+typedef struct {    /* followed by padded string */
+    CARD8 reqType;
+    BOOL onlyIfExists;
+    CARD16 length B16;
+    CARD16 nbytes  B16;    /* number of bytes in string */
+    CARD16 pad B16;
+} xInternAtomReq;
+
+typedef struct {
+    CARD8 reqType;
+    CARD8 mode;
+    CARD16 length B16;
+    Window window B32;
+    Atom property B32, type B32;
+    CARD8 format;
+    BYTE pad[3];
+    CARD32 nUnits B32;     /* length of stuff following, depends on format */
+} xChangePropertyReq;
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Window window B32;
+    Atom property B32;
+} xDeletePropertyReq;
+
+typedef struct {
+    CARD8 reqType;
+#if defined(__cplusplus) || defined(c_plusplus)
+    BOOL c_delete;
+#else
+    BOOL delete;
+#endif
+    CARD16 length B16;
+    Window window B32;
+    Atom property B32, type B32;
+    CARD32 longOffset B32;
+    CARD32 longLength B32;
+} xGetPropertyReq;
+ 
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Window window B32;
+    Atom selection B32;
+    Time time B32;
+} xSetSelectionOwnerReq;
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Window requestor B32;
+    Atom selection B32, target B32, property B32;
+    Time time B32;
+    } xConvertSelectionReq;
+
+typedef struct {
+    CARD8 reqType;
+    BOOL propagate;
+    CARD16 length B16;
+    Window destination B32;
+    CARD32 eventMask B32;
+    xEvent event;
+} xSendEventReq;
+
+typedef struct {
+    CARD8 reqType;
+    BOOL ownerEvents;
+    CARD16 length B16;
+    Window grabWindow B32;
+    CARD16 eventMask B16;
+    BYTE pointerMode, keyboardMode;
+    Window confineTo B32;
+    Cursor cursor B32;
+    Time time B32;
+} xGrabPointerReq;
+
+typedef struct {
+    CARD8 reqType;
+    BOOL ownerEvents;
+    CARD16 length B16;
+    Window grabWindow B32;
+    CARD16 eventMask B16;
+    BYTE pointerMode, keyboardMode;
+    Window confineTo B32;
+    Cursor cursor B32;
+    CARD8 button;
+    BYTE pad;
+    CARD16 modifiers B16;
+} xGrabButtonReq;
+
+typedef struct {
+    CARD8 reqType;
+    CARD8 button;
+    CARD16 length B16;
+    Window grabWindow B32;
+    CARD16 modifiers B16;
+    CARD16 pad B16;
+} xUngrabButtonReq;
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Cursor cursor B32;
+    Time time B32;
+    CARD16 eventMask B16;
+    CARD16 pad2 B16;
+} xChangeActivePointerGrabReq;
+
+typedef struct {
+    CARD8 reqType;
+    BOOL ownerEvents;
+    CARD16 length B16;
+    Window grabWindow B32;
+    Time time B32;
+    BYTE pointerMode, keyboardMode;  
+    CARD16 pad B16;
+} xGrabKeyboardReq;
+
+typedef struct {
+    CARD8 reqType;
+    BOOL ownerEvents;
+    CARD16 length B16;
+    Window grabWindow B32;
+    CARD16 modifiers B16;
+    CARD8 key;
+    BYTE pointerMode, keyboardMode;  
+    BYTE pad1, pad2, pad3;
+} xGrabKeyReq;
+
+typedef struct {
+    CARD8 reqType;
+    CARD8 key;
+    CARD16 length B16;
+    Window grabWindow B32;
+    CARD16 modifiers B16;
+    CARD16 pad B16;
+} xUngrabKeyReq;
+
+typedef struct {
+    CARD8 reqType;
+    CARD8 mode;
+    CARD16 length B16;
+    Time time B32;
+} xAllowEventsReq;
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Window window B32;
+    Time start B32, stop B32;
+} xGetMotionEventsReq;
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Window srcWid B32, dstWid B32;
+    INT16 srcX B16, srcY B16;
+} xTranslateCoordsReq;
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Window srcWid B32, dstWid B32;
+    INT16 srcX B16, srcY B16;
+    CARD16 srcWidth B16, srcHeight B16;
+    INT16 dstX B16, dstY B16;
+} xWarpPointerReq;
+
+typedef struct {
+    CARD8 reqType;
+    CARD8 revertTo;
+    CARD16 length B16;
+    Window focus B32;
+    Time time B32;
+} xSetInputFocusReq;
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Font fid B32;
+    CARD16 nbytes B16;
+    BYTE pad1, pad2;	/* string follows on word boundary */
+} xOpenFontReq;
+
+typedef struct {
+    CARD8 reqType;
+    BOOL oddLength;
+    CARD16 length B16;
+    Font fid B32;
+    } xQueryTextExtentsReq;
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    CARD16 maxNames B16;
+    CARD16 nbytes B16;  /* followed immediately by string bytes */
+} xListFontsReq;
+
+typedef xListFontsReq xListFontsWithInfoReq;
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    CARD16 nFonts B16;
+    BYTE pad1, pad2;	/* LISTofSTRING8 follows on word boundary */
+} xSetFontPathReq;
+
+typedef struct {
+    CARD8 reqType;
+    CARD8 depth;
+    CARD16 length B16;
+    Pixmap pid B32;
+    Drawable drawable B32;
+    CARD16 width B16, height B16;
+} xCreatePixmapReq;
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    GContext gc B32;
+    Drawable drawable B32;
+    CARD32 mask B32;
+} xCreateGCReq;
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    GContext gc B32;
+    CARD32 mask B32;
+} xChangeGCReq;    
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    GContext srcGC B32, dstGC B32;
+    CARD32 mask B32;
+} xCopyGCReq;    
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    GContext gc B32;
+    CARD16 dashOffset B16;
+    CARD16 nDashes B16;        /* length LISTofCARD8 of values following */
+} xSetDashesReq;    
+
+typedef struct {
+    CARD8 reqType;
+    BYTE ordering;
+    CARD16 length B16;
+    GContext gc B32;
+    INT16 xOrigin B16, yOrigin B16;
+} xSetClipRectanglesReq;    
+
+typedef struct {
+    CARD8 reqType;
+    BOOL exposures;
+    CARD16 length B16;
+    Window window B32;
+    INT16 x B16, y B16;
+    CARD16 width B16, height B16;
+} xClearAreaReq;
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Drawable srcDrawable B32, dstDrawable B32;
+    GContext gc B32;
+    INT16 srcX B16, srcY B16, dstX B16, dstY B16;
+    CARD16 width B16, height B16;
+} xCopyAreaReq;    
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Drawable srcDrawable B32, dstDrawable B32;
+    GContext gc B32;
+    INT16 srcX B16, srcY B16, dstX B16, dstY B16;
+    CARD16 width B16, height B16;
+    CARD32 bitPlane B32;
+} xCopyPlaneReq;    
+
+typedef struct {
+    CARD8 reqType;
+    BYTE coordMode;
+    CARD16 length B16;
+    Drawable drawable B32;
+    GContext gc B32;
+} xPolyPointReq;    
+
+typedef xPolyPointReq xPolyLineReq;  /* same request structure */
+
+/* The following used for PolySegment, PolyRectangle, PolyArc, PolyFillRectangle, PolyFillArc */
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Drawable drawable B32;
+    GContext gc B32;
+} xPolySegmentReq;    
+
+typedef xPolySegmentReq xPolyArcReq;
+typedef xPolySegmentReq xPolyRectangleReq;
+typedef xPolySegmentReq xPolyFillRectangleReq;
+typedef xPolySegmentReq xPolyFillArcReq;
+
+typedef struct _FillPolyReq {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Drawable drawable B32;
+    GContext gc B32;
+    BYTE shape;
+    BYTE coordMode;
+    CARD16 pad1 B16;
+} xFillPolyReq;    
+
+
+typedef struct _PutImageReq {
+    CARD8 reqType;
+    CARD8 format;
+    CARD16 length B16;
+    Drawable drawable B32;
+    GContext gc B32;
+    CARD16 width B16, height B16;
+    INT16 dstX B16, dstY B16;
+    CARD8 leftPad;
+    CARD8 depth;
+    CARD16 pad B16;
+} xPutImageReq;    
+
+typedef struct {
+    CARD8 reqType;
+    CARD8 format;
+    CARD16 length B16;
+    Drawable drawable B32;
+    INT16 x B16, y B16;
+    CARD16 width B16, height B16;
+    CARD32 planeMask B32;
+} xGetImageReq;    
+
+/* the following used by PolyText8 and PolyText16 */
+
+typedef struct {
+    CARD8 reqType;
+    CARD8 pad;
+    CARD16 length B16;
+    Drawable drawable B32;
+    GContext gc B32;
+    INT16 x B16, y B16;		/* items (xTextElt) start after struct */
+} xPolyTextReq;    
+
+typedef xPolyTextReq xPolyText8Req;
+typedef xPolyTextReq xPolyText16Req;
+
+typedef struct {
+    CARD8 reqType;
+    BYTE nChars;
+    CARD16 length B16;
+    Drawable drawable B32;
+    GContext gc B32;
+    INT16 x B16, y B16;
+} xImageTextReq;    
+
+typedef xImageTextReq xImageText8Req;
+typedef xImageTextReq xImageText16Req;
+
+typedef struct {
+    CARD8 reqType;
+    BYTE alloc;
+    CARD16 length B16;
+    Colormap mid B32;
+    Window window B32;
+    VisualID visual B32;
+} xCreateColormapReq;    
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Colormap mid B32;
+    Colormap srcCmap B32;
+} xCopyColormapAndFreeReq;    
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Colormap cmap B32;
+    CARD16 red B16, green B16, blue B16;
+    CARD16 pad2 B16;
+} xAllocColorReq;    
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Colormap cmap B32;
+    CARD16 nbytes B16;  /* followed by structure */
+    BYTE pad1, pad2;
+} xAllocNamedColorReq;    
+
+typedef struct {
+    CARD8 reqType;
+    BOOL contiguous;
+    CARD16 length B16;
+    Colormap cmap B32;
+    CARD16 colors B16, planes B16;
+} xAllocColorCellsReq;    
+
+typedef struct {
+    CARD8 reqType;
+    BOOL contiguous;
+    CARD16 length B16;
+    Colormap cmap B32;
+    CARD16 colors B16, red B16, green B16, blue B16;
+} xAllocColorPlanesReq;    
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Colormap cmap B32;
+    CARD32 planeMask B32;
+} xFreeColorsReq;    
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Colormap cmap B32;
+} xStoreColorsReq;    
+
+typedef struct {
+    CARD8 reqType;
+    CARD8 flags;   /* DoRed, DoGreen, DoBlue, as in xColorItem */
+    CARD16 length B16;
+    Colormap cmap B32;
+    CARD32 pixel B32;
+    CARD16 nbytes B16;  /* number of name string bytes following structure */
+    BYTE pad1, pad2;
+    } xStoreNamedColorReq;
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Colormap cmap B32;
+} xQueryColorsReq;    
+
+typedef struct {    /* followed  by string of length len */
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Colormap cmap B32;
+    CARD16 nbytes B16;  /* number of string bytes following structure*/
+    BYTE pad1, pad2;
+} xLookupColorReq;    
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Cursor cid B32;
+    Pixmap source B32, mask B32;
+    CARD16 foreRed B16, foreGreen B16, foreBlue B16;
+    CARD16 backRed B16, backGreen B16, backBlue B16;
+    CARD16 x B16, y B16;
+} xCreateCursorReq;    
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Cursor cid B32;
+    Font source B32, mask B32;
+    CARD16 sourceChar B16, maskChar B16;
+    CARD16 foreRed B16, foreGreen B16, foreBlue B16;
+    CARD16 backRed B16, backGreen B16, backBlue B16;
+} xCreateGlyphCursorReq;    
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Cursor cursor B32;
+    CARD16 foreRed B16, foreGreen B16, foreBlue B16;
+    CARD16 backRed B16, backGreen B16, backBlue B16;
+} xRecolorCursorReq;    
+
+typedef struct {
+    CARD8 reqType;
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8 c_class;
+#else
+    CARD8 class;
+#endif
+    CARD16 length B16;
+    Drawable drawable B32;
+    CARD16 width B16, height B16;
+} xQueryBestSizeReq;    
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    CARD16 nbytes B16;  /* number of string bytes following structure */
+    BYTE pad1, pad2;
+} xQueryExtensionReq;
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   numKeyPerModifier;
+    CARD16  length B16;
+} xSetModifierMappingReq;
+
+typedef struct {
+    CARD8 reqType;
+    CARD8 nElts;  /* how many elements in the map */
+    CARD16 length B16;
+} xSetPointerMappingReq;
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    KeyCode firstKeyCode;
+    CARD8 count;
+    CARD16 pad1 B16;
+} xGetKeyboardMappingReq;    
+
+typedef struct {
+    CARD8 reqType;
+    CARD8 keyCodes;
+    CARD16 length B16;
+    KeyCode firstKeyCode;
+    CARD8 keySymsPerKeyCode;
+    CARD16 pad1 B16;
+} xChangeKeyboardMappingReq;
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    CARD32 mask B32;
+} xChangeKeyboardControlReq;    
+
+typedef struct {
+    CARD8 reqType;
+    INT8 percent;  /* -100 to 100 */
+    CARD16 length B16;
+} xBellReq;    
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    INT16 accelNum B16, accelDenum B16;
+    INT16 threshold B16;             
+    BOOL doAccel, doThresh;
+} xChangePointerControlReq;    
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    INT16 timeout B16, interval B16;
+    BYTE preferBlank, allowExpose;  
+    CARD16 pad2 B16;
+} xSetScreenSaverReq;    
+
+typedef struct {
+    CARD8 reqType;
+    BYTE mode;
+    CARD16 length B16;
+    CARD8 hostFamily;
+    BYTE pad;
+    CARD16 hostLength B16;
+} xChangeHostsReq;    
+
+typedef struct {
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    } xListHostsReq;
+
+typedef struct {
+    CARD8 reqType;
+    BYTE mode;
+    CARD16 length B16;
+    } xChangeModeReq;
+
+typedef xChangeModeReq xSetAccessControlReq;
+typedef xChangeModeReq xSetCloseDownModeReq;
+typedef xChangeModeReq xForceScreenSaverReq;
+
+typedef struct { /* followed by LIST of ATOM */
+    CARD8 reqType;
+    BYTE pad;
+    CARD16 length B16;
+    Window window B32;
+    CARD16 nAtoms B16;
+    INT16 nPositions B16;
+    } xRotatePropertiesReq;
+    
+
+
+/* Reply codes */
+
+#define X_Reply		1		/* Normal reply */
+#define X_Error		0		/* Error */
+
+/* Request codes */
+
+#define X_CreateWindow                  1              
+#define X_ChangeWindowAttributes        2        
+#define X_GetWindowAttributes           3     
+#define X_DestroyWindow                 4
+#define X_DestroySubwindows             5   
+#define X_ChangeSaveSet                 6
+#define X_ReparentWindow                7
+#define X_MapWindow                     8
+#define X_MapSubwindows                 9
+#define X_UnmapWindow                  10
+#define X_UnmapSubwindows              11  
+#define X_ConfigureWindow              12  
+#define X_CirculateWindow              13  
+#define X_GetGeometry                  14
+#define X_QueryTree                    15
+#define X_InternAtom                   16
+#define X_GetAtomName                  17
+#define X_ChangeProperty               18 
+#define X_DeleteProperty               19 
+#define X_GetProperty                  20
+#define X_ListProperties               21 
+#define X_SetSelectionOwner            22    
+#define X_GetSelectionOwner            23    
+#define X_ConvertSelection             24   
+#define X_SendEvent                    25
+#define X_GrabPointer                  26
+#define X_UngrabPointer                27
+#define X_GrabButton                   28
+#define X_UngrabButton                 29
+#define X_ChangeActivePointerGrab      30          
+#define X_GrabKeyboard                 31
+#define X_UngrabKeyboard               32 
+#define X_GrabKey                      33
+#define X_UngrabKey                    34
+#define X_AllowEvents                  35       
+#define X_GrabServer                   36      
+#define X_UngrabServer                 37        
+#define X_QueryPointer                 38        
+#define X_GetMotionEvents              39           
+#define X_TranslateCoords              40                
+#define X_WarpPointer                  41       
+#define X_SetInputFocus                42         
+#define X_GetInputFocus                43         
+#define X_QueryKeymap                  44       
+#define X_OpenFont                     45    
+#define X_CloseFont                    46     
+#define X_QueryFont                    47
+#define X_QueryTextExtents             48     
+#define X_ListFonts                    49  
+#define X_ListFontsWithInfo    	       50 
+#define X_SetFontPath                  51 
+#define X_GetFontPath                  52 
+#define X_CreatePixmap                 53        
+#define X_FreePixmap                   54      
+#define X_CreateGC                     55    
+#define X_ChangeGC                     56    
+#define X_CopyGC                       57  
+#define X_SetDashes                    58     
+#define X_SetClipRectangles            59             
+#define X_FreeGC                       60  
+#define X_ClearArea                    61             
+#define X_CopyArea                     62    
+#define X_CopyPlane                    63     
+#define X_PolyPoint                    64     
+#define X_PolyLine                     65    
+#define X_PolySegment                  66       
+#define X_PolyRectangle                67         
+#define X_PolyArc                      68   
+#define X_FillPoly                     69    
+#define X_PolyFillRectangle            70             
+#define X_PolyFillArc                  71       
+#define X_PutImage                     72    
+#define X_GetImage                     73 
+#define X_PolyText8                    74     
+#define X_PolyText16                   75      
+#define X_ImageText8                   76      
+#define X_ImageText16                  77       
+#define X_CreateColormap               78          
+#define X_FreeColormap                 79        
+#define X_CopyColormapAndFree          80               
+#define X_InstallColormap              81           
+#define X_UninstallColormap            82             
+#define X_ListInstalledColormaps       83                  
+#define X_AllocColor                   84      
+#define X_AllocNamedColor              85           
+#define X_AllocColorCells              86           
+#define X_AllocColorPlanes             87            
+#define X_FreeColors                   88      
+#define X_StoreColors                  89       
+#define X_StoreNamedColor              90           
+#define X_QueryColors                  91       
+#define X_LookupColor                  92       
+#define X_CreateCursor                 93        
+#define X_CreateGlyphCursor            94             
+#define X_FreeCursor                   95      
+#define X_RecolorCursor                96         
+#define X_QueryBestSize                97         
+#define X_QueryExtension               98          
+#define X_ListExtensions               99          
+#define X_ChangeKeyboardMapping        100
+#define X_GetKeyboardMapping           101
+#define X_ChangeKeyboardControl        102                
+#define X_GetKeyboardControl           103             
+#define X_Bell                         104
+#define X_ChangePointerControl         105
+#define X_GetPointerControl            106
+#define X_SetScreenSaver               107          
+#define X_GetScreenSaver               108          
+#define X_ChangeHosts                  109       
+#define X_ListHosts                    110     
+#define X_SetAccessControl             111               
+#define X_SetCloseDownMode             112
+#define X_KillClient                   113 
+#define X_RotateProperties	       114
+#define X_ForceScreenSaver	       115
+#define X_SetPointerMapping            116
+#define X_GetPointerMapping            117
+#define X_SetModifierMapping	       118
+#define X_GetModifierMapping	       119
+#define X_NoOperation                  127
+
+/* restore these definitions back to the typedefs in X.h */
+#undef Window
+#undef Drawable
+#undef Font
+#undef Pixmap
+#undef Cursor
+#undef Colormap
+#undef GContext
+#undef Atom
+#undef VisualID
+#undef Time
+#undef KeyCode
+#undef KeySym
+
+#endif /* XPROTO_H */
diff --git a/ThirdParty/X11/Include/X11/Xprotostr.h b/ThirdParty/X11/Include/X11/Xprotostr.h
new file mode 100644
index 0000000000000000000000000000000000000000..a9e854d3701c727e2244f2751144712d204b1961
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xprotostr.h
@@ -0,0 +1,77 @@
+#ifndef XPROTOSTRUCTS_H
+#define XPROTOSTRUCTS_H
+
+/***********************************************************
+
+Copyright 1987, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+#include <X11/Xmd.h>
+
+/* Used by PolySegment */
+
+typedef struct _xSegment {
+    INT16 x1 B16, y1 B16, x2 B16, y2 B16;
+} xSegment;
+
+/* POINT */
+
+typedef struct _xPoint {
+	INT16		x B16, y B16;
+} xPoint;
+
+typedef struct _xRectangle {
+    INT16 x B16, y B16;
+    CARD16  width B16, height B16;
+} xRectangle;
+
+/*  ARC  */
+
+typedef struct _xArc {
+    INT16 x B16, y B16;
+    CARD16   width B16, height B16;
+    INT16   angle1 B16, angle2 B16;
+} xArc;
+
+#endif /* XPROTOSTRUCTS_H */
diff --git a/ThirdParty/X11/Include/X11/Xregion.h b/ThirdParty/X11/Include/X11/Xregion.h
new file mode 100644
index 0000000000000000000000000000000000000000..cf10f86df48c2a3a7225058f55fa625bd4b3e65a
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xregion.h
@@ -0,0 +1,190 @@
+/************************************************************************
+
+Copyright 1987, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+************************************************************************/
+
+#ifndef _X11_XREGION_H_
+#define _X11_XREGION_H_
+
+typedef struct {
+    short x1, x2, y1, y2;
+} Box, BOX, BoxRec, *BoxPtr;
+
+typedef struct {
+    short x, y, width, height;
+}RECTANGLE, RectangleRec, *RectanglePtr;
+
+#define TRUE 1
+#define FALSE 0
+#define MAXSHORT 32767
+#define MINSHORT -MAXSHORT
+#ifndef MAX
+#define MAX(a,b) (((a) > (b)) ? (a) : (b))
+#endif
+#ifndef MIN
+#define MIN(a,b) (((a) < (b)) ? (a) : (b))
+#endif
+
+
+/*
+ *   clip region
+ */
+
+typedef struct _XRegion {
+    long size;
+    long numRects;
+    BOX *rects;
+    BOX extents;
+} REGION;
+
+/* Xutil.h contains the declaration:
+ * typedef struct _XRegion *Region;
+ */
+
+/*  1 if two BOXs overlap.
+ *  0 if two BOXs do not overlap.
+ *  Remember, x2 and y2 are not in the region
+ */
+#define EXTENTCHECK(r1, r2) \
+	((r1)->x2 > (r2)->x1 && \
+	 (r1)->x1 < (r2)->x2 && \
+	 (r1)->y2 > (r2)->y1 && \
+	 (r1)->y1 < (r2)->y2)
+
+/*
+ *  update region extents
+ */
+#define EXTENTS(r,idRect){\
+            if((r)->x1 < (idRect)->extents.x1)\
+              (idRect)->extents.x1 = (r)->x1;\
+            if((r)->y1 < (idRect)->extents.y1)\
+              (idRect)->extents.y1 = (r)->y1;\
+            if((r)->x2 > (idRect)->extents.x2)\
+              (idRect)->extents.x2 = (r)->x2;\
+            if((r)->y2 > (idRect)->extents.y2)\
+              (idRect)->extents.y2 = (r)->y2;\
+        }
+
+/*
+ *   Check to see if there is enough memory in the present region.
+ */
+#define MEMCHECK(reg, rect, firstrect){\
+        if ((reg)->numRects >= ((reg)->size - 1)){\
+          BoxPtr tmpRect = Xrealloc ((firstrect), \
+                                     (2 * (sizeof(BOX)) * ((reg)->size))); \
+          if (tmpRect == NULL) \
+            return(0);\
+          (firstrect) = tmpRect; \
+          (reg)->size *= 2;\
+          (rect) = &(firstrect)[(reg)->numRects];\
+         }\
+       }
+
+/*  this routine checks to see if the previous rectangle is the same
+ *  or subsumes the new rectangle to add.
+ */
+
+#define CHECK_PREVIOUS(Reg, R, Rx1, Ry1, Rx2, Ry2)\
+               (!(((Reg)->numRects > 0)&&\
+                  ((R-1)->y1 == (Ry1)) &&\
+                  ((R-1)->y2 == (Ry2)) &&\
+                  ((R-1)->x1 <= (Rx1)) &&\
+                  ((R-1)->x2 >= (Rx2))))
+
+/*  add a rectangle to the given Region */
+#define ADDRECT(reg, r, rx1, ry1, rx2, ry2){\
+    if (((rx1) < (rx2)) && ((ry1) < (ry2)) &&\
+        CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\
+              (r)->x1 = (rx1);\
+              (r)->y1 = (ry1);\
+              (r)->x2 = (rx2);\
+              (r)->y2 = (ry2);\
+              EXTENTS((r), (reg));\
+              (reg)->numRects++;\
+              (r)++;\
+            }\
+        }
+
+
+
+/*  add a rectangle to the given Region */
+#define ADDRECTNOX(reg, r, rx1, ry1, rx2, ry2){\
+            if ((rx1 < rx2) && (ry1 < ry2) &&\
+                CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\
+              (r)->x1 = (rx1);\
+              (r)->y1 = (ry1);\
+              (r)->x2 = (rx2);\
+              (r)->y2 = (ry2);\
+              (reg)->numRects++;\
+              (r)++;\
+            }\
+        }
+
+#define EMPTY_REGION(pReg) pReg->numRects = 0
+
+#define REGION_NOT_EMPTY(pReg) pReg->numRects
+
+#define INBOX(r, x, y) \
+      ( ( ((r).x2 >  x)) && \
+        ( ((r).x1 <= x)) && \
+        ( ((r).y2 >  y)) && \
+        ( ((r).y1 <= y)) )
+
+/*
+ * number of points to buffer before sending them off
+ * to scanlines() :  Must be an even number
+ */
+#define NUMPTSTOBUFFER 200
+
+/*
+ * used to allocate buffers for points and link
+ * the buffers together
+ */
+typedef struct _POINTBLOCK {
+    XPoint pts[NUMPTSTOBUFFER];
+    struct _POINTBLOCK *next;
+} POINTBLOCK;
+
+#endif /* _X11_XREGION_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xresource.h b/ThirdParty/X11/Include/X11/Xresource.h
new file mode 100644
index 0000000000000000000000000000000000000000..6dbb3ce46456496a1aa057c8f423835ab4a96e37
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xresource.h
@@ -0,0 +1,358 @@
+
+/***********************************************************
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _X11_XRESOURCE_H_
+#define _X11_XRESOURCE_H_
+
+#ifndef _XP_PRINT_SERVER_
+#include <X11/Xlib.h>
+#endif
+
+/****************************************************************
+ ****************************************************************
+ ***                                                          ***
+ ***                                                          ***
+ ***          X Resource Manager Intrinsics                   ***
+ ***                                                          ***
+ ***                                                          ***
+ ****************************************************************
+ ****************************************************************/
+
+_XFUNCPROTOBEGIN
+
+/****************************************************************
+ *
+ * Memory Management
+ *
+ ****************************************************************/
+
+extern char *Xpermalloc(
+    unsigned int	/* size */
+);
+
+/****************************************************************
+ *
+ * Quark Management
+ *
+ ****************************************************************/
+
+typedef int       XrmQuark, *XrmQuarkList;
+#define NULLQUARK ((XrmQuark) 0)
+
+typedef char *XrmString;
+#define NULLSTRING ((XrmString) 0)
+
+/* find quark for string, create new quark if none already exists */
+extern XrmQuark XrmStringToQuark(
+    _Xconst char* 	/* string */
+);
+
+extern XrmQuark XrmPermStringToQuark(
+    _Xconst char* 	/* string */
+);
+
+/* find string for quark */
+extern XrmString XrmQuarkToString(
+    XrmQuark 		/* quark */
+);
+
+extern XrmQuark XrmUniqueQuark(
+    void
+);
+
+#define XrmStringsEqual(a1, a2) (strcmp(a1, a2) == 0)
+
+
+/****************************************************************
+ *
+ * Conversion of Strings to Lists
+ *
+ ****************************************************************/
+
+typedef enum {XrmBindTightly, XrmBindLoosely} XrmBinding, *XrmBindingList;
+
+extern void XrmStringToQuarkList(
+    _Xconst char*	/* string */,
+    XrmQuarkList	/* quarks_return */
+);
+
+extern void XrmStringToBindingQuarkList(
+    _Xconst char*	/* string */,
+    XrmBindingList	/* bindings_return */,
+    XrmQuarkList	/* quarks_return */
+);
+
+/****************************************************************
+ *
+ * Name and Class lists.
+ *
+ ****************************************************************/
+
+typedef XrmQuark     XrmName;
+typedef XrmQuarkList XrmNameList;
+#define XrmNameToString(name)		XrmQuarkToString(name)
+#define XrmStringToName(string)		XrmStringToQuark(string)
+#define XrmStringToNameList(str, name)	XrmStringToQuarkList(str, name)
+
+typedef XrmQuark     XrmClass;
+typedef XrmQuarkList XrmClassList;
+#define XrmClassToString(c_class)	XrmQuarkToString(c_class)
+#define XrmStringToClass(c_class)	XrmStringToQuark(c_class)
+#define XrmStringToClassList(str,c_class) XrmStringToQuarkList(str, c_class)
+
+
+
+/****************************************************************
+ *
+ * Resource Representation Types and Values
+ *
+ ****************************************************************/
+
+typedef XrmQuark     XrmRepresentation;
+#define XrmStringToRepresentation(string)   XrmStringToQuark(string)
+#define	XrmRepresentationToString(type)   XrmQuarkToString(type)
+
+typedef struct {
+    unsigned int    size;
+    XPointer	    addr;
+} XrmValue, *XrmValuePtr;
+
+
+/****************************************************************
+ *
+ * Resource Manager Functions
+ *
+ ****************************************************************/
+
+typedef struct _XrmHashBucketRec *XrmHashBucket;
+typedef XrmHashBucket *XrmHashTable;
+typedef XrmHashTable XrmSearchList[];
+typedef struct _XrmHashBucketRec *XrmDatabase;
+
+
+extern void XrmDestroyDatabase(
+    XrmDatabase		/* database */
+);
+
+extern void XrmQPutResource(
+    XrmDatabase*	/* database */,
+    XrmBindingList	/* bindings */,
+    XrmQuarkList	/* quarks */,
+    XrmRepresentation	/* type */,
+    XrmValue*		/* value */
+);
+
+extern void XrmPutResource(
+    XrmDatabase*	/* database */,
+    _Xconst char*	/* specifier */,
+    _Xconst char*	/* type */,
+    XrmValue*		/* value */
+);
+
+extern void XrmQPutStringResource(
+    XrmDatabase*	/* database */,
+    XrmBindingList      /* bindings */,
+    XrmQuarkList	/* quarks */,
+    _Xconst char*	/* value */
+);
+
+extern void XrmPutStringResource(
+    XrmDatabase*	/* database */,
+    _Xconst char*	/* specifier */,
+    _Xconst char*	/* value */
+);
+
+extern void XrmPutLineResource(
+    XrmDatabase*	/* database */,
+    _Xconst char*	/* line */
+);
+
+extern Bool XrmQGetResource(
+    XrmDatabase		/* database */,
+    XrmNameList		/* quark_name */,
+    XrmClassList	/* quark_class */,
+    XrmRepresentation*	/* quark_type_return */,
+    XrmValue*		/* value_return */
+);
+
+extern Bool XrmGetResource(
+    XrmDatabase		/* database */,
+    _Xconst char*	/* str_name */,
+    _Xconst char*	/* str_class */,
+    char**		/* str_type_return */,
+    XrmValue*		/* value_return */
+);
+
+extern Bool XrmQGetSearchList(
+    XrmDatabase		/* database */,
+    XrmNameList		/* names */,
+    XrmClassList	/* classes */,
+    XrmSearchList	/* list_return */,
+    int			/* list_length */
+);
+
+extern Bool XrmQGetSearchResource(
+    XrmSearchList	/* list */,
+    XrmName		/* name */,
+    XrmClass		/* class */,
+    XrmRepresentation*	/* type_return */,
+    XrmValue*		/* value_return */
+);
+
+/****************************************************************
+ *
+ * Resource Database Management
+ *
+ ****************************************************************/
+
+#ifndef _XP_PRINT_SERVER_
+
+extern void XrmSetDatabase(
+    Display*		/* display */,
+    XrmDatabase		/* database */
+);
+
+extern XrmDatabase XrmGetDatabase(
+    Display*		/* display */
+);
+
+#endif /* !_XP_PRINT_SERVER_ */
+
+extern XrmDatabase XrmGetFileDatabase(
+    _Xconst char*	/* filename */
+);
+
+extern Status XrmCombineFileDatabase(
+    _Xconst char* 	/* filename */,
+    XrmDatabase*	/* target */,
+    Bool		/* override */
+);
+
+extern XrmDatabase XrmGetStringDatabase(
+    _Xconst char*	/* data */  /*  null terminated string */
+);
+
+extern void XrmPutFileDatabase(
+    XrmDatabase		/* database */,
+    _Xconst char*	/* filename */
+);
+
+extern void XrmMergeDatabases(
+    XrmDatabase		/* source_db */,
+    XrmDatabase*	/* target_db */
+);
+
+extern void XrmCombineDatabase(
+    XrmDatabase		/* source_db */,
+    XrmDatabase*	/* target_db */,
+    Bool		/* override */
+);
+
+#define XrmEnumAllLevels 0
+#define XrmEnumOneLevel  1
+
+extern Bool XrmEnumerateDatabase(
+    XrmDatabase		/* db */,
+    XrmNameList		/* name_prefix */,
+    XrmClassList	/* class_prefix */,
+    int			/* mode */,
+    Bool (*)(
+	     XrmDatabase*	/* db */,
+	     XrmBindingList	/* bindings */,
+	     XrmQuarkList	/* quarks */,
+	     XrmRepresentation*	/* type */,
+	     XrmValue*		/* value */,
+	     XPointer		/* closure */
+	     )		/* proc */,
+    XPointer		/* closure */
+);
+
+extern const char *XrmLocaleOfDatabase(
+    XrmDatabase 	/* database */
+);
+
+
+/****************************************************************
+ *
+ * Command line option mapping to resource entries
+ *
+ ****************************************************************/
+
+typedef enum {
+    XrmoptionNoArg,	/* Value is specified in OptionDescRec.value	    */
+    XrmoptionIsArg,     /* Value is the option string itself		    */
+    XrmoptionStickyArg, /* Value is characters immediately following option */
+    XrmoptionSepArg,    /* Value is next argument in argv		    */
+    XrmoptionResArg,	/* Resource and value in next argument in argv      */
+    XrmoptionSkipArg,   /* Ignore this option and the next argument in argv */
+    XrmoptionSkipLine,  /* Ignore this option and the rest of argv	    */
+    XrmoptionSkipNArgs	/* Ignore this option and the next
+			   OptionDescRes.value arguments in argv */
+} XrmOptionKind;
+
+typedef struct {
+    char	    *option;	    /* Option abbreviation in argv	    */
+    char	    *specifier;     /* Resource specifier		    */
+    XrmOptionKind   argKind;	    /* Which style of option it is	    */
+    XPointer	    value;	    /* Value to provide if XrmoptionNoArg   */
+} XrmOptionDescRec, *XrmOptionDescList;
+
+
+extern void XrmParseCommand(
+    XrmDatabase*	/* database */,
+    XrmOptionDescList	/* table */,
+    int			/* table_count */,
+    _Xconst char*	/* name */,
+    int*		/* argc_in_out */,
+    char**		/* argv_in_out */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _X11_XRESOURCE_H_ */
+/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/ThirdParty/X11/Include/X11/Xthreads.h b/ThirdParty/X11/Include/X11/Xthreads.h
new file mode 100644
index 0000000000000000000000000000000000000000..2027127eb9347d12ba2a6bf4b08de5249eb18e60
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xthreads.h
@@ -0,0 +1,314 @@
+/*
+ *
+Copyright 1993, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ * *
+ */
+
+#ifndef _XTHREADS_H_
+# define _XTHREADS_H_
+
+/* Redefine these to XtMalloc/XtFree or whatever you want before including
+ * this header file.
+ */
+# ifndef xmalloc
+#  define xmalloc malloc
+# endif
+# ifndef xfree
+#  define xfree free
+# endif
+
+# ifdef CTHREADS
+#  include <cthreads.h>
+typedef cthread_t xthread_t;
+typedef struct condition xcondition_rec;
+typedef struct mutex xmutex_rec;
+#  define xthread_init() cthread_init()
+#  define xthread_self cthread_self
+#  define xthread_fork(func,closure) cthread_fork(func,closure)
+#  define xthread_yield() cthread_yield()
+#  define xthread_exit(v) cthread_exit(v)
+#  define xthread_set_name(t,str) cthread_set_name(t,str)
+#  define xmutex_init(m) mutex_init(m)
+#  define xmutex_clear(m) mutex_clear(m)
+#  define xmutex_lock(m) mutex_lock(m)
+#  define xmutex_unlock(m) mutex_unlock(m)
+#  define xmutex_set_name(m,str) mutex_set_name(m,str)
+#  define xcondition_init(cv) condition_init(cv)
+#  define xcondition_clear(cv) condition_clear(cv)
+#  define xcondition_wait(cv,m) condition_wait(cv,m)
+#  define xcondition_signal(cv) condition_signal(cv)
+#  define xcondition_broadcast(cv) condition_broadcast(cv)
+#  define xcondition_set_name(cv,str) condition_set_name(cv,str)
+# else /* !CTHREADS */
+#  if defined(SVR4)
+#   include <thread.h>
+#   include <synch.h>
+typedef thread_t xthread_t;
+typedef thread_key_t xthread_key_t;
+typedef cond_t xcondition_rec;
+typedef mutex_t xmutex_rec;
+#   if defined(__UNIXWARE__)
+extern xthread_t (*_x11_thr_self)();
+#    define xthread_self  (_x11_thr_self)
+#   else
+#    define xthread_self thr_self
+#   endif
+#   define xthread_fork(func,closure) thr_create(NULL,0,func,closure,THR_NEW_LWP|THR_DETACHED,NULL)
+#   define xthread_yield() thr_yield()
+#   define xthread_exit(v) thr_exit(v)
+#   define xthread_key_create(kp,d) thr_keycreate(kp,d)
+#   ifdef __sun
+#    define xthread_key_delete(k) 0
+#   else
+#    define xthread_key_delete(k) thr_keydelete(k)
+#   endif
+#   define xthread_set_specific(k,v) thr_setspecific(k,v)
+#   define xthread_get_specific(k,vp) thr_getspecific(k,vp)
+#   define xmutex_init(m) mutex_init(m,USYNC_THREAD,0)
+#   define xmutex_clear(m) mutex_destroy(m)
+#   define xmutex_lock(m) mutex_lock(m)
+#   define xmutex_unlock(m) mutex_unlock(m)
+#   define xcondition_init(cv) cond_init(cv,USYNC_THREAD,0)
+#   define xcondition_clear(cv) cond_destroy(cv)
+#   define xcondition_wait(cv,m) cond_wait(cv,m)
+#   define xcondition_signal(cv) cond_signal(cv)
+#   define xcondition_broadcast(cv) cond_broadcast(cv)
+#  else /* !SVR4 */
+#   ifdef WIN32
+#    include <X11/Xwindows.h>
+typedef DWORD xthread_t;
+typedef DWORD xthread_key_t;
+struct _xthread_waiter {
+    HANDLE sem;
+    struct _xthread_waiter *next;
+};
+typedef struct {
+    CRITICAL_SECTION cs;
+    struct _xthread_waiter *waiters;
+} xcondition_rec;
+typedef CRITICAL_SECTION xmutex_rec;
+extern void _Xthread_init(void);
+#    define xthread_init() _Xthread_init()
+#    define xthread_self GetCurrentThreadId
+#    define xthread_fork(func,closure) { \
+    DWORD _tmptid; \
+    CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)func, (LPVOID)closure, 0, \
+		 &_tmptid); \
+}
+#    define xthread_yield() Sleep(0)
+#    define xthread_exit(v) ExitThread((DWORD)(v))
+#    define xthread_key_create(kp,d) *(kp) = TlsAlloc()
+#    define xthread_key_delete(k) TlsFree(k)
+#    define xthread_set_specific(k,v) TlsSetValue(k,v)
+#    define xthread_get_specific(k,vp) TlsGetValue(k)
+#    define xmutex_init(m) InitializeCriticalSection(m)
+#    define xmutex_clear(m) DeleteCriticalSection(m)
+#    define _XMUTEX_NESTS
+#    define xmutex_lock(m) EnterCriticalSection(m)
+#    define xmutex_unlock(m) LeaveCriticalSection(m)
+#    define xcondition_init(cv) { \
+    InitializeCriticalSection(&(cv)->cs); \
+    (cv)->waiters = NULL; \
+}
+#    define xcondition_clear(cv) DeleteCriticalSection(&(cv)->cs)
+extern struct _xthread_waiter *_Xthread_waiter();
+#    define xcondition_wait(cv,m) { \
+    struct _xthread_waiter *_tmpthr = _Xthread_waiter(); \
+    EnterCriticalSection(&(cv)->cs); \
+    _tmpthr->next = (cv)->waiters; \
+    (cv)->waiters = _tmpthr; \
+    LeaveCriticalSection(&(cv)->cs); \
+    LeaveCriticalSection(m); \
+    WaitForSingleObject(_tmpthr->sem, INFINITE); \
+    EnterCriticalSection(m); \
+}
+#    define xcondition_signal(cv) { \
+    EnterCriticalSection(&(cv)->cs); \
+    if ((cv)->waiters) { \
+        ReleaseSemaphore((cv)->waiters->sem, 1, NULL); \
+	(cv)->waiters = (cv)->waiters->next; \
+    } \
+    LeaveCriticalSection(&(cv)->cs); \
+}
+#    define xcondition_broadcast(cv) { \
+    struct _xthread_waiter *_tmpthr; \
+    EnterCriticalSection(&(cv)->cs); \
+    for (_tmpthr = (cv)->waiters; _tmpthr; _tmpthr = _tmpthr->next) \
+	ReleaseSemaphore(_tmpthr->sem, 1, NULL); \
+    (cv)->waiters = NULL; \
+    LeaveCriticalSection(&(cv)->cs); \
+}
+#   else /* !WIN32 */
+#    ifdef USE_TIS_SUPPORT
+/*
+ * TIS support is intended for thread safe libraries.
+ * This should not be used for general client programming.
+ */
+#     include <tis.h>
+typedef pthread_t xthread_t;
+typedef pthread_key_t xthread_key_t;
+typedef pthread_cond_t xcondition_rec;
+typedef pthread_mutex_t xmutex_rec;
+#     define xthread_self tis_self
+#     define xthread_fork(func,closure) { pthread_t _tmpxthr; \
+        pthread_create(&_tmpxthr,NULL,func,closure); }
+#     define xthread_yield() pthread_yield_np()
+#     define xthread_exit(v) pthread_exit(v)
+#     define xthread_key_create(kp,d) tis_key_create(kp,d)
+#     define xthread_key_delete(k) tis_key_delete(k)
+#     define xthread_set_specific(k,v) tis_setspecific(k,v)
+#     define xthread_get_specific(k,vp) *(vp) = tis_getspecific(k)
+#     define XMUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
+#     define xmutex_init(m) tis_mutex_init(m)
+#     define xmutex_clear(m) tis_mutex_destroy(m)
+#     define xmutex_lock(m) tis_mutex_lock(m)
+#     define xmutex_unlock(m) tis_mutex_unlock(m)
+#     define xcondition_init(c) tis_cond_init(c)
+#     define xcondition_clear(c) tis_cond_destroy(c)
+#     define xcondition_wait(c,m) tis_cond_wait(c,m)
+#     define xcondition_signal(c) tis_cond_signal(c)
+#     define xcondition_broadcast(c) tis_cond_broadcast(c)
+#    else
+#     ifdef USE_NBSD_THREADLIB
+/*
+ * NetBSD threadlib support is intended for thread safe libraries.
+ * This should not be used for general client programming.
+ */
+#      include <threadlib.h>
+typedef thr_t xthread_t;
+typedef thread_key_t xthread_key_t;
+typedef cond_t xcondition_rec;
+typedef mutex_t xmutex_rec;
+#      define xthread_self thr_self
+#      define xthread_fork(func,closure) { thr_t _tmpxthr; \
+	/* XXX Create it detached?  --thorpej */ \
+	thr_create(&_tmpxthr,NULL,func,closure); }
+#      define xthread_yield() thr_yield()
+#      define xthread_exit(v) thr_exit(v)
+#      define xthread_key_create(kp,d) thr_keycreate(kp,d)
+#      define xthread_key_delete(k) thr_keydelete(k)
+#      define xthread_set_specific(k,v) thr_setspecific(k,v)
+#      define xthread_get_specific(k,vp) *(vp) = thr_getspecific(k)
+#      define XMUTEX_INITIALIZER MUTEX_INITIALIZER
+#      define xmutex_init(m) mutex_init(m, 0)
+#      define xmutex_clear(m) mutex_destroy(m)
+#      define xmutex_lock(m) mutex_lock(m)
+#      define xmutex_unlock(m) mutex_unlock(m)
+#      define xcondition_init(c) cond_init(c, 0, 0)
+#      define xcondition_clear(c) cond_destroy(c)
+#      define xcondition_wait(c,m) cond_wait(c,m)
+#      define xcondition_signal(c) cond_signal(c)
+#      define xcondition_broadcast(c) cond_broadcast(c)
+#     else
+#      include <pthread.h>
+typedef pthread_t xthread_t;
+typedef pthread_key_t xthread_key_t;
+typedef pthread_cond_t xcondition_rec;
+typedef pthread_mutex_t xmutex_rec;
+#      define xthread_self pthread_self
+#      define xthread_yield() pthread_yield()
+#      define xthread_exit(v) pthread_exit(v)
+#      define xthread_set_specific(k,v) pthread_setspecific(k,v)
+#      define xmutex_clear(m) pthread_mutex_destroy(m)
+#      define xmutex_lock(m) pthread_mutex_lock(m)
+#      define xmutex_unlock(m) pthread_mutex_unlock(m)
+#      ifndef XPRE_STANDARD_API
+#       define xthread_key_create(kp,d) pthread_key_create(kp,d)
+#       define xthread_key_delete(k) pthread_key_delete(k)
+#       define xthread_get_specific(k,vp) *(vp) = pthread_getspecific(k)
+#       define xthread_fork(func,closure) { pthread_t _tmpxthr; \
+	pthread_create(&_tmpxthr,NULL,func,closure); }
+#       define XMUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
+#       define xmutex_init(m) pthread_mutex_init(m, NULL)
+#       define xcondition_init(c) pthread_cond_init(c, NULL)
+#      else /* XPRE_STANDARD_API */
+#       define xthread_key_create(kp,d) pthread_keycreate(kp,d)
+#       define xthread_key_delete(k) 0
+#       define xthread_get_specific(k,vp) pthread_getspecific(k,vp)
+#       define xthread_fork(func,closure) { pthread_t _tmpxthr; \
+	pthread_create(&_tmpxthr,pthread_attr_default,func,closure); }
+#       define xmutex_init(m) pthread_mutex_init(m, pthread_mutexattr_default)
+#       define xcondition_init(c) pthread_cond_init(c, pthread_condattr_default)
+#      endif /* XPRE_STANDARD_API */
+#      define xcondition_clear(c) pthread_cond_destroy(c)
+#      define xcondition_wait(c,m) pthread_cond_wait(c,m)
+#      define xcondition_signal(c) pthread_cond_signal(c)
+#      define xcondition_broadcast(c) pthread_cond_broadcast(c)
+#      if defined(_DECTHREADS_)
+static xthread_t _X_no_thread_id;
+#       define xthread_have_id(id) !pthread_equal(id, _X_no_thread_id)
+#       define xthread_clear_id(id) id = _X_no_thread_id
+#       define xthread_equal(id1,id2) pthread_equal(id1, id2)
+#      endif /* _DECTHREADS_ */
+#      if defined(__linux__)
+#       define xthread_have_id(id) !pthread_equal(id, 0)
+#       define xthread_clear_id(id) id = 0
+#       define xthread_equal(id1,id2) pthread_equal(id1, id2)
+#      endif /* linux */
+#      if defined(_CMA_VENDOR_) && defined(_CMA__IBM) && (_CMA_VENDOR_ == _CMA__IBM)
+#       ifdef DEBUG		/* too much of a hack to enable normally */
+/* see also cma__obj_set_name() */
+#        define xmutex_set_name(m,str) ((char**)(m)->field1)[5] = (str)
+#        define xcondition_set_name(cv,str) ((char**)(cv)->field1)[5] = (str)
+#       endif /* DEBUG */
+#      endif /* _CMA_VENDOR_ == _CMA__IBM */
+#     endif /* USE_NBSD_THREADLIB */
+#    endif /* USE_TIS_SUPPORT */
+#   endif /* WIN32 */
+#  endif /* SVR4 */
+# endif /* CTHREADS */
+typedef xcondition_rec *xcondition_t;
+typedef xmutex_rec *xmutex_t;
+# ifndef xcondition_malloc
+#  define xcondition_malloc() (xcondition_t)xmalloc(sizeof(xcondition_rec))
+# endif
+# ifndef xcondition_free
+#  define xcondition_free(c) xfree((char *)c)
+# endif
+# ifndef xmutex_malloc
+#  define xmutex_malloc() (xmutex_t)xmalloc(sizeof(xmutex_rec))
+# endif
+# ifndef xmutex_free
+#  define xmutex_free(m) xfree((char *)m)
+# endif
+# ifndef xthread_have_id
+#  define xthread_have_id(id) id
+# endif
+# ifndef xthread_clear_id
+#  define xthread_clear_id(id) id = 0
+# endif
+# ifndef xthread_equal
+#  define xthread_equal(id1,id2) ((id1) == (id2))
+# endif
+/* aids understood by some debuggers */
+# ifndef xthread_set_name
+#  define xthread_set_name(t,str)
+# endif
+# ifndef xmutex_set_name
+#  define xmutex_set_name(m,str)
+# endif
+# ifndef xcondition_set_name
+#  define xcondition_set_name(cv,str)
+# endif
+
+#endif /* _XTHREADS_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xtos.h b/ThirdParty/X11/Include/X11/Xtos.h
new file mode 100644
index 0000000000000000000000000000000000000000..64b2da838dbe9de9feeb02d9aa1decfcba1ecaff
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xtos.h
@@ -0,0 +1,69 @@
+/***********************************************************
+
+Copyright 1987, 1988, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _Xtos_h
+#define _Xtos_h
+
+#define ALLOCATE_LOCAL_FALLBACK(_size) XtMalloc((unsigned long)(_size))
+#define DEALLOCATE_LOCAL_FALLBACK(_ptr) XtFree((XtPointer)(_ptr))
+#include <X11/Xalloca.h>
+
+
+#if defined (_LP64) || \
+    defined(__alpha) || defined(__alpha__) || \
+    defined(__ia64__) || defined(ia64) || \
+    defined(__sparc64__) || \
+    defined(__s390x__) || \
+    (defined(__hppa__) && defined(__LP64__)) || \
+    defined(__amd64__) || defined(amd64) || \
+    defined(__powerpc64__) || \
+    (defined(sgi) && (_MIPS_SZLONG == 64))
+#define LONG64
+#endif
+
+#endif /* _Xtos_h */
+/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/ThirdParty/X11/Include/X11/Xutil.h b/ThirdParty/X11/Include/X11/Xutil.h
new file mode 100644
index 0000000000000000000000000000000000000000..62cdf555633647ca1e471d3669abe5d03c745bb0
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xutil.h
@@ -0,0 +1,838 @@
+
+/***********************************************************
+
+Copyright 1987, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _X11_XUTIL_H_
+#define _X11_XUTIL_H_
+
+/* You must include <X11/Xlib.h> before including this file */
+#include <X11/Xlib.h>
+#include <X11/keysym.h>
+
+/* The Xlib structs are full of implicit padding to properly align members.
+   We can't clean that up without breaking ABI, so tell clang not to bother
+   complaining about it. */
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+#endif
+
+/*
+ * Bitmask returned by XParseGeometry().  Each bit tells if the corresponding
+ * value (x, y, width, height) was found in the parsed string.
+ */
+#define NoValue		0x0000
+#define XValue  	0x0001
+#define YValue		0x0002
+#define WidthValue  	0x0004
+#define HeightValue  	0x0008
+#define AllValues 	0x000F
+#define XNegative 	0x0010
+#define YNegative 	0x0020
+
+/*
+ * new version containing base_width, base_height, and win_gravity fields;
+ * used with WM_NORMAL_HINTS.
+ */
+typedef struct {
+    	long flags;	/* marks which fields in this structure are defined */
+	int x, y;		/* obsolete for new window mgrs, but clients */
+	int width, height;	/* should set so old wm's don't mess up */
+	int min_width, min_height;
+	int max_width, max_height;
+    	int width_inc, height_inc;
+	struct {
+		int x;	/* numerator */
+		int y;	/* denominator */
+	} min_aspect, max_aspect;
+	int base_width, base_height;		/* added by ICCCM version 1 */
+	int win_gravity;			/* added by ICCCM version 1 */
+} XSizeHints;
+
+/*
+ * The next block of definitions are for window manager properties that
+ * clients and applications use for communication.
+ */
+
+/* flags argument in size hints */
+#define USPosition	(1L << 0) /* user specified x, y */
+#define USSize		(1L << 1) /* user specified width, height */
+
+#define PPosition	(1L << 2) /* program specified position */
+#define PSize		(1L << 3) /* program specified size */
+#define PMinSize	(1L << 4) /* program specified minimum size */
+#define PMaxSize	(1L << 5) /* program specified maximum size */
+#define PResizeInc	(1L << 6) /* program specified resize increments */
+#define PAspect		(1L << 7) /* program specified min and max aspect ratios */
+#define PBaseSize	(1L << 8) /* program specified base for incrementing */
+#define PWinGravity	(1L << 9) /* program specified window gravity */
+
+/* obsolete */
+#define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect)
+
+
+
+typedef struct {
+	long flags;	/* marks which fields in this structure are defined */
+	Bool input;	/* does this application rely on the window manager to
+			get keyboard input? */
+	int initial_state;	/* see below */
+	Pixmap icon_pixmap;	/* pixmap to be used as icon */
+	Window icon_window; 	/* window to be used as icon */
+	int icon_x, icon_y; 	/* initial position of icon */
+	Pixmap icon_mask;	/* icon mask bitmap */
+	XID window_group;	/* id of related window group */
+	/* this structure may be extended in the future */
+} XWMHints;
+
+/* definition for flags of XWMHints */
+
+#define InputHint 		(1L << 0)
+#define StateHint 		(1L << 1)
+#define IconPixmapHint		(1L << 2)
+#define IconWindowHint		(1L << 3)
+#define IconPositionHint 	(1L << 4)
+#define IconMaskHint		(1L << 5)
+#define WindowGroupHint		(1L << 6)
+#define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \
+IconPositionHint|IconMaskHint|WindowGroupHint)
+#define XUrgencyHint		(1L << 8)
+
+/* definitions for initial window state */
+#define WithdrawnState 0	/* for windows that are not mapped */
+#define NormalState 1	/* most applications want to start this way */
+#define IconicState 3	/* application wants to start as an icon */
+
+/*
+ * Obsolete states no longer defined by ICCCM
+ */
+#define DontCareState 0	/* don't know or care */
+#define ZoomState 2	/* application wants to start zoomed */
+#define InactiveState 4	/* application believes it is seldom used; */
+			/* some wm's may put it on inactive menu */
+
+
+/*
+ * new structure for manipulating TEXT properties; used with WM_NAME,
+ * WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND.
+ */
+typedef struct {
+    unsigned char *value;		/* same as Property routines */
+    Atom encoding;			/* prop type */
+    int format;				/* prop data format: 8, 16, or 32 */
+    unsigned long nitems;		/* number of data items in value */
+} XTextProperty;
+
+#define XNoMemory -1
+#define XLocaleNotSupported -2
+#define XConverterNotFound -3
+
+typedef enum {
+    XStringStyle,		/* STRING */
+    XCompoundTextStyle,		/* COMPOUND_TEXT */
+    XTextStyle,			/* text in owner's encoding (current locale)*/
+    XStdICCTextStyle,		/* STRING, else COMPOUND_TEXT */
+    /* The following is an XFree86 extension, introduced in November 2000 */
+    XUTF8StringStyle		/* UTF8_STRING */
+} XICCEncodingStyle;
+
+typedef struct {
+	int min_width, min_height;
+	int max_width, max_height;
+	int width_inc, height_inc;
+} XIconSize;
+
+typedef struct {
+	char *res_name;
+	char *res_class;
+} XClassHint;
+
+#ifdef XUTIL_DEFINE_FUNCTIONS
+extern int XDestroyImage(
+        XImage *ximage);
+extern unsigned long XGetPixel(
+        XImage *ximage,
+        int x, int y);
+extern int XPutPixel(
+        XImage *ximage,
+        int x, int y,
+        unsigned long pixel);
+extern XImage *XSubImage(
+        XImage *ximage,
+        int x, int y,
+        unsigned int width, unsigned int height);
+extern int XAddPixel(
+        XImage *ximage,
+        long value);
+#else
+/*
+ * These macros are used to give some sugar to the image routines so that
+ * naive people are more comfortable with them.
+ */
+#define XDestroyImage(ximage) \
+	((*((ximage)->f.destroy_image))((ximage)))
+#define XGetPixel(ximage, x, y) \
+	((*((ximage)->f.get_pixel))((ximage), (x), (y)))
+#define XPutPixel(ximage, x, y, pixel) \
+	((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel)))
+#define XSubImage(ximage, x, y, width, height)  \
+	((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height)))
+#define XAddPixel(ximage, value) \
+	((*((ximage)->f.add_pixel))((ximage), (value)))
+#endif
+
+/*
+ * Compose sequence status structure, used in calling XLookupString.
+ */
+typedef struct _XComposeStatus {
+    XPointer compose_ptr;	/* state table pointer */
+    int chars_matched;		/* match state */
+} XComposeStatus;
+
+/*
+ * Keysym macros, used on Keysyms to test for classes of symbols
+ */
+#define IsKeypadKey(keysym) \
+  (((KeySym)(keysym) >= XK_KP_Space) && ((KeySym)(keysym) <= XK_KP_Equal))
+
+#define IsPrivateKeypadKey(keysym) \
+  (((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF))
+
+#define IsCursorKey(keysym) \
+  (((KeySym)(keysym) >= XK_Home)     && ((KeySym)(keysym) <  XK_Select))
+
+#define IsPFKey(keysym) \
+  (((KeySym)(keysym) >= XK_KP_F1)     && ((KeySym)(keysym) <= XK_KP_F4))
+
+#define IsFunctionKey(keysym) \
+  (((KeySym)(keysym) >= XK_F1)       && ((KeySym)(keysym) <= XK_F35))
+
+#define IsMiscFunctionKey(keysym) \
+  (((KeySym)(keysym) >= XK_Select)   && ((KeySym)(keysym) <= XK_Break))
+
+#ifdef XK_XKB_KEYS
+#define IsModifierKey(keysym) \
+  ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \
+   || (((KeySym)(keysym) >= XK_ISO_Lock) && \
+       ((KeySym)(keysym) <= XK_ISO_Level5_Lock)) \
+   || ((KeySym)(keysym) == XK_Mode_switch) \
+   || ((KeySym)(keysym) == XK_Num_Lock))
+#else
+#define IsModifierKey(keysym) \
+  ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \
+   || ((KeySym)(keysym) == XK_Mode_switch) \
+   || ((KeySym)(keysym) == XK_Num_Lock))
+#endif
+/*
+ * opaque reference to Region data type
+ */
+typedef struct _XRegion *Region;
+
+/* Return values from XRectInRegion() */
+
+#define RectangleOut 0
+#define RectangleIn  1
+#define RectanglePart 2
+
+
+/*
+ * Information used by the visual utility routines to find desired visual
+ * type from the many visuals a display may support.
+ */
+
+typedef struct {
+  Visual *visual;
+  VisualID visualid;
+  int screen;
+  int depth;
+#if defined(__cplusplus) || defined(c_plusplus)
+  int c_class;					/* C++ */
+#else
+  int class;
+#endif
+  unsigned long red_mask;
+  unsigned long green_mask;
+  unsigned long blue_mask;
+  int colormap_size;
+  int bits_per_rgb;
+} XVisualInfo;
+
+#define VisualNoMask		0x0
+#define VisualIDMask 		0x1
+#define VisualScreenMask	0x2
+#define VisualDepthMask		0x4
+#define VisualClassMask		0x8
+#define VisualRedMaskMask	0x10
+#define VisualGreenMaskMask	0x20
+#define VisualBlueMaskMask	0x40
+#define VisualColormapSizeMask	0x80
+#define VisualBitsPerRGBMask	0x100
+#define VisualAllMask		0x1FF
+
+/*
+ * This defines a window manager property that clients may use to
+ * share standard color maps of type RGB_COLOR_MAP:
+ */
+typedef struct {
+	Colormap colormap;
+	unsigned long red_max;
+	unsigned long red_mult;
+	unsigned long green_max;
+	unsigned long green_mult;
+	unsigned long blue_max;
+	unsigned long blue_mult;
+	unsigned long base_pixel;
+	VisualID visualid;		/* added by ICCCM version 1 */
+	XID killid;			/* added by ICCCM version 1 */
+} XStandardColormap;
+
+#define ReleaseByFreeingColormap ((XID) 1L)  /* for killid field above */
+
+
+/*
+ * return codes for XReadBitmapFile and XWriteBitmapFile
+ */
+#define BitmapSuccess		0
+#define BitmapOpenFailed 	1
+#define BitmapFileInvalid 	2
+#define BitmapNoMemory		3
+
+/****************************************************************
+ *
+ * Context Management
+ *
+ ****************************************************************/
+
+
+/* Associative lookup table return codes */
+
+#define XCSUCCESS 0	/* No error. */
+#define XCNOMEM   1    /* Out of memory */
+#define XCNOENT   2    /* No entry in table */
+
+typedef int XContext;
+
+#define XUniqueContext()       ((XContext) XrmUniqueQuark())
+#define XStringToContext(string)   ((XContext) XrmStringToQuark(string))
+
+_XFUNCPROTOBEGIN
+
+/* The following declarations are alphabetized. */
+
+extern XClassHint *XAllocClassHint (
+    void
+);
+
+extern XIconSize *XAllocIconSize (
+    void
+);
+
+extern XSizeHints *XAllocSizeHints (
+    void
+);
+
+extern XStandardColormap *XAllocStandardColormap (
+    void
+);
+
+extern XWMHints *XAllocWMHints (
+    void
+);
+
+extern int XClipBox(
+    Region		/* r */,
+    XRectangle*		/* rect_return */
+);
+
+extern Region XCreateRegion(
+    void
+);
+
+extern const char *XDefaultString (void);
+
+extern int XDeleteContext(
+    Display*		/* display */,
+    XID			/* rid */,
+    XContext		/* context */
+);
+
+extern int XDestroyRegion(
+    Region		/* r */
+);
+
+extern int XEmptyRegion(
+    Region		/* r */
+);
+
+extern int XEqualRegion(
+    Region		/* r1 */,
+    Region		/* r2 */
+);
+
+extern int XFindContext(
+    Display*		/* display */,
+    XID			/* rid */,
+    XContext		/* context */,
+    XPointer*		/* data_return */
+);
+
+extern Status XGetClassHint(
+    Display*		/* display */,
+    Window		/* w */,
+    XClassHint*		/* class_hints_return */
+);
+
+extern Status XGetIconSizes(
+    Display*		/* display */,
+    Window		/* w */,
+    XIconSize**		/* size_list_return */,
+    int*		/* count_return */
+);
+
+extern Status XGetNormalHints(
+    Display*		/* display */,
+    Window		/* w */,
+    XSizeHints*		/* hints_return */
+);
+
+extern Status XGetRGBColormaps(
+    Display*		/* display */,
+    Window		/* w */,
+    XStandardColormap** /* stdcmap_return */,
+    int*		/* count_return */,
+    Atom		/* property */
+);
+
+extern Status XGetSizeHints(
+    Display*		/* display */,
+    Window		/* w */,
+    XSizeHints*		/* hints_return */,
+    Atom		/* property */
+);
+
+extern Status XGetStandardColormap(
+    Display*		/* display */,
+    Window		/* w */,
+    XStandardColormap*	/* colormap_return */,
+    Atom		/* property */
+);
+
+extern Status XGetTextProperty(
+    Display*		/* display */,
+    Window		/* window */,
+    XTextProperty*	/* text_prop_return */,
+    Atom		/* property */
+);
+
+extern XVisualInfo *XGetVisualInfo(
+    Display*		/* display */,
+    long		/* vinfo_mask */,
+    XVisualInfo*	/* vinfo_template */,
+    int*		/* nitems_return */
+);
+
+extern Status XGetWMClientMachine(
+    Display*		/* display */,
+    Window		/* w */,
+    XTextProperty*	/* text_prop_return */
+);
+
+extern XWMHints *XGetWMHints(
+    Display*		/* display */,
+    Window		/* w */
+);
+
+extern Status XGetWMIconName(
+    Display*		/* display */,
+    Window		/* w */,
+    XTextProperty*	/* text_prop_return */
+);
+
+extern Status XGetWMName(
+    Display*		/* display */,
+    Window		/* w */,
+    XTextProperty*	/* text_prop_return */
+);
+
+extern Status XGetWMNormalHints(
+    Display*		/* display */,
+    Window		/* w */,
+    XSizeHints*		/* hints_return */,
+    long*		/* supplied_return */
+);
+
+extern Status XGetWMSizeHints(
+    Display*		/* display */,
+    Window		/* w */,
+    XSizeHints*		/* hints_return */,
+    long*		/* supplied_return */,
+    Atom		/* property */
+);
+
+extern Status XGetZoomHints(
+    Display*		/* display */,
+    Window		/* w */,
+    XSizeHints*		/* zhints_return */
+);
+
+extern int XIntersectRegion(
+    Region		/* sra */,
+    Region		/* srb */,
+    Region		/* dr_return */
+);
+
+extern void XConvertCase(
+    KeySym		/* sym */,
+    KeySym*		/* lower */,
+    KeySym*		/* upper */
+);
+
+extern int XLookupString(
+    XKeyEvent*		/* event_struct */,
+    char*		/* buffer_return */,
+    int			/* bytes_buffer */,
+    KeySym*		/* keysym_return */,
+    XComposeStatus*	/* status_in_out */
+);
+
+extern Status XMatchVisualInfo(
+    Display*		/* display */,
+    int			/* screen */,
+    int			/* depth */,
+    int			/* class */,
+    XVisualInfo*	/* vinfo_return */
+);
+
+extern int XOffsetRegion(
+    Region		/* r */,
+    int			/* dx */,
+    int			/* dy */
+);
+
+extern Bool XPointInRegion(
+    Region		/* r */,
+    int			/* x */,
+    int			/* y */
+);
+
+extern Region XPolygonRegion(
+    XPoint*		/* points */,
+    int			/* n */,
+    int			/* fill_rule */
+);
+
+extern int XRectInRegion(
+    Region		/* r */,
+    int			/* x */,
+    int			/* y */,
+    unsigned int	/* width */,
+    unsigned int	/* height */
+);
+
+extern int XSaveContext(
+    Display*		/* display */,
+    XID			/* rid */,
+    XContext		/* context */,
+    _Xconst char*	/* data */
+);
+
+extern int XSetClassHint(
+    Display*		/* display */,
+    Window		/* w */,
+    XClassHint*		/* class_hints */
+);
+
+extern int XSetIconSizes(
+    Display*		/* display */,
+    Window		/* w */,
+    XIconSize*		/* size_list */,
+    int			/* count */
+);
+
+extern int XSetNormalHints(
+    Display*		/* display */,
+    Window		/* w */,
+    XSizeHints*		/* hints */
+);
+
+extern void XSetRGBColormaps(
+    Display*		/* display */,
+    Window		/* w */,
+    XStandardColormap*	/* stdcmaps */,
+    int			/* count */,
+    Atom		/* property */
+);
+
+extern int XSetSizeHints(
+    Display*		/* display */,
+    Window		/* w */,
+    XSizeHints*		/* hints */,
+    Atom		/* property */
+);
+
+extern int XSetStandardProperties(
+    Display*		/* display */,
+    Window		/* w */,
+    _Xconst char*	/* window_name */,
+    _Xconst char*	/* icon_name */,
+    Pixmap		/* icon_pixmap */,
+    char**		/* argv */,
+    int			/* argc */,
+    XSizeHints*		/* hints */
+);
+
+extern void XSetTextProperty(
+    Display*		/* display */,
+    Window		/* w */,
+    XTextProperty*	/* text_prop */,
+    Atom		/* property */
+);
+
+extern void XSetWMClientMachine(
+    Display*		/* display */,
+    Window		/* w */,
+    XTextProperty*	/* text_prop */
+);
+
+extern int XSetWMHints(
+    Display*		/* display */,
+    Window		/* w */,
+    XWMHints*		/* wm_hints */
+);
+
+extern void XSetWMIconName(
+    Display*		/* display */,
+    Window		/* w */,
+    XTextProperty*	/* text_prop */
+);
+
+extern void XSetWMName(
+    Display*		/* display */,
+    Window		/* w */,
+    XTextProperty*	/* text_prop */
+);
+
+extern void XSetWMNormalHints(
+    Display*		/* display */,
+    Window		/* w */,
+    XSizeHints*		/* hints */
+);
+
+extern void XSetWMProperties(
+    Display*		/* display */,
+    Window		/* w */,
+    XTextProperty*	/* window_name */,
+    XTextProperty*	/* icon_name */,
+    char**		/* argv */,
+    int			/* argc */,
+    XSizeHints*		/* normal_hints */,
+    XWMHints*		/* wm_hints */,
+    XClassHint*		/* class_hints */
+);
+
+extern void XmbSetWMProperties(
+    Display*		/* display */,
+    Window		/* w */,
+    _Xconst char*	/* window_name */,
+    _Xconst char*	/* icon_name */,
+    char**		/* argv */,
+    int			/* argc */,
+    XSizeHints*		/* normal_hints */,
+    XWMHints*		/* wm_hints */,
+    XClassHint*		/* class_hints */
+);
+
+extern void Xutf8SetWMProperties(
+    Display*		/* display */,
+    Window		/* w */,
+    _Xconst char*	/* window_name */,
+    _Xconst char*	/* icon_name */,
+    char**		/* argv */,
+    int			/* argc */,
+    XSizeHints*		/* normal_hints */,
+    XWMHints*		/* wm_hints */,
+    XClassHint*		/* class_hints */
+);
+
+extern void XSetWMSizeHints(
+    Display*		/* display */,
+    Window		/* w */,
+    XSizeHints*		/* hints */,
+    Atom		/* property */
+);
+
+extern int XSetRegion(
+    Display*		/* display */,
+    GC			/* gc */,
+    Region		/* r */
+);
+
+extern void XSetStandardColormap(
+    Display*		/* display */,
+    Window		/* w */,
+    XStandardColormap*	/* colormap */,
+    Atom		/* property */
+);
+
+extern int XSetZoomHints(
+    Display*		/* display */,
+    Window		/* w */,
+    XSizeHints*		/* zhints */
+);
+
+extern int XShrinkRegion(
+    Region		/* r */,
+    int			/* dx */,
+    int			/* dy */
+);
+
+extern Status XStringListToTextProperty(
+    char**		/* list */,
+    int			/* count */,
+    XTextProperty*	/* text_prop_return */
+);
+
+extern int XSubtractRegion(
+    Region		/* sra */,
+    Region		/* srb */,
+    Region		/* dr_return */
+);
+
+extern int XmbTextListToTextProperty(
+    Display*		display,
+    char**		list,
+    int			count,
+    XICCEncodingStyle	style,
+    XTextProperty*	text_prop_return
+);
+
+extern int XwcTextListToTextProperty(
+    Display*		display,
+    wchar_t**		list,
+    int			count,
+    XICCEncodingStyle	style,
+    XTextProperty*	text_prop_return
+);
+
+extern int Xutf8TextListToTextProperty(
+    Display*		display,
+    char**		list,
+    int			count,
+    XICCEncodingStyle	style,
+    XTextProperty*	text_prop_return
+);
+
+extern void XwcFreeStringList(
+    wchar_t**		list
+);
+
+extern Status XTextPropertyToStringList(
+    XTextProperty*	/* text_prop */,
+    char***		/* list_return */,
+    int*		/* count_return */
+);
+
+extern int XmbTextPropertyToTextList(
+    Display*		display,
+    const XTextProperty* text_prop,
+    char***		list_return,
+    int*		count_return
+);
+
+extern int XwcTextPropertyToTextList(
+    Display*		display,
+    const XTextProperty* text_prop,
+    wchar_t***		list_return,
+    int*		count_return
+);
+
+extern int Xutf8TextPropertyToTextList(
+    Display*		display,
+    const XTextProperty* text_prop,
+    char***		list_return,
+    int*		count_return
+);
+
+extern int XUnionRectWithRegion(
+    XRectangle*		/* rectangle */,
+    Region		/* src_region */,
+    Region		/* dest_region_return */
+);
+
+extern int XUnionRegion(
+    Region		/* sra */,
+    Region		/* srb */,
+    Region		/* dr_return */
+);
+
+extern int XWMGeometry(
+    Display*		/* display */,
+    int			/* screen_number */,
+    _Xconst char*	/* user_geometry */,
+    _Xconst char*	/* default_geometry */,
+    unsigned int	/* border_width */,
+    XSizeHints*		/* hints */,
+    int*		/* x_return */,
+    int*		/* y_return */,
+    int*		/* width_return */,
+    int*		/* height_return */,
+    int*		/* gravity_return */
+);
+
+extern int XXorRegion(
+    Region		/* sra */,
+    Region		/* srb */,
+    Region		/* dr_return */
+);
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+_XFUNCPROTOEND
+
+#endif /* _X11_XUTIL_H_ */
diff --git a/ThirdParty/X11/Include/X11/Xw32defs.h b/ThirdParty/X11/Include/X11/Xw32defs.h
new file mode 100644
index 0000000000000000000000000000000000000000..b2e4b33ae8c704cae7a3d1fa380d06aed5a1d432
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xw32defs.h
@@ -0,0 +1,79 @@
+#ifndef _XW32DEFS_H
+# define  _XW32DEFS_H
+
+# ifdef __GNUC__ /* mingw is more close to unix than msvc */
+#  if !defined(__daddr_t_defined) 
+typedef char *caddr_t;
+#  endif
+#  define lstat stat
+
+# else
+typedef char *caddr_t;
+
+#  define access	   _access
+#  define alloca	   _alloca
+#  define chdir	_chdir
+#  define chmod	   _chmod
+#  define close	   _close
+#  define creat	   _creat
+#  define dup	   _dup
+#  define dup2	   _dup2
+#  define environ     _environ
+#  define execl	 _execl
+#  define execle	 _execle
+#  define execlp	 _execlp
+#  define execlpe  _execlpe
+#  define execv	 _execv
+#  define execve	 _execve
+#  define execvp	 _execvp
+#  define execvpe  _execvpe
+#  define fdopen	  _fdopen
+#  define fileno	  _fileno
+#  define fstat	 _fstat
+#  define getcwd	_getcwd
+#  define getpid	 _getpid
+#  define hypot		_hypot
+#  define isascii __isascii
+#  define isatty	   _isatty
+#  define lseek	   _lseek
+#  define mkdir	_mkdir
+#  define mktemp	   _mktemp
+#  define open	   _open
+#  define putenv	    _putenv
+#  define read	   _read
+#  define rmdir	_rmdir
+#  define sleep(x) Sleep((x) * 1000)
+#  define stat	 _stat
+#  define sys_errlist _sys_errlist
+#  define sys_nerr    _sys_nerr
+#  define umask	   _umask
+#  define unlink	   _unlink
+#  define write	   _write
+#  define random   rand
+#  define srandom  srand
+
+#  define O_RDONLY    _O_RDONLY
+#  define O_WRONLY    _O_WRONLY
+#  define O_RDWR	    _O_RDWR
+#  define O_APPEND    _O_APPEND
+#  define O_CREAT     _O_CREAT
+#  define O_TRUNC     _O_TRUNC
+#  define O_EXCL	    _O_EXCL
+#  define O_TEXT	    _O_TEXT
+#  define O_BINARY    _O_BINARY
+#  define O_RAW	    _O_BINARY
+
+#  define S_IFMT	 _S_IFMT
+#  define S_IFDIR  _S_IFDIR
+#  define S_IFCHR  _S_IFCHR
+#  define S_IFREG  _S_IFREG
+#  define S_IREAD  _S_IREAD
+#  define S_IWRITE _S_IWRITE
+#  define S_IEXEC  _S_IEXEC
+
+#  define	F_OK	0
+#  define	X_OK	1
+#  define	W_OK	2
+#  define	R_OK	4
+# endif /* __GNUC__ */
+#endif
diff --git a/ThirdParty/X11/Include/X11/Xwindows.h b/ThirdParty/X11/Include/X11/Xwindows.h
new file mode 100644
index 0000000000000000000000000000000000000000..70e1debd51b1efc9dcfa62234af4c70742f1ed0e
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xwindows.h
@@ -0,0 +1,114 @@
+/*
+
+Copyright 1996, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
+ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
+SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL-
+ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization from
+The Open Group.
+
+*/
+
+/*
+ * This header file has the sole purpose of allowing the inclusion of
+ * windows.h without getting any name conflicts with X headers code, by
+ * renaming or disabling the conflicting definitions from windows.h
+ */
+
+/*
+ * Mingw.org versions of the Windows API headers actually avoid
+ * making the conflicting definitions if XFree86Server is defined, so we
+ * need to remember if that was defined and undefine it during including
+ * windows.h (so the conflicting definitions get wrapped correctly), and
+ * then redefine it afterwards. (This was never the correct thing to
+ * do as it's no help at all to X11 clients which also need to use the
+ * Win32 API)
+ */
+#undef _XFree86Server
+#ifdef XFree86Server
+# define _XFree86Server
+# undef XFree86Server
+#endif
+
+/*
+ * There doesn't seem to be a good way to wrap the min/max macros from
+ * windows.h, so we simply avoid defining them completely, allowing any
+ * pre-existing definition to stand.
+ *
+ */
+#define NOMINMAX
+
+/*
+ * mingw-w64 headers define BOOL as a typedef, protecting against macros
+ * mingw.org headers define BOOL in terms of WINBOOL
+ * ... so try to come up with something which works with both :-)
+ */
+#define _NO_BOOL_TYPEDEF
+#define BOOL WINBOOL
+#define INT32 wINT32
+#ifdef __x86_64__
+#define INT64 wINT64
+#define LONG64 wLONG64
+#endif
+#undef Status
+#define Status wStatus
+#define ATOM wATOM
+#define BYTE wBYTE
+#define FreeResource wFreeResource
+#include <windows.h>
+#undef NOMINMAX
+#undef Status
+#define Status int
+#undef BYTE
+#undef BOOL
+#undef INT32
+#undef INT64
+#undef LONG64
+#undef ATOM
+#undef FreeResource
+#undef CreateWindowA
+
+/*
+ * Older version of this header used to name the windows API bool type wBOOL,
+ * rather than more standard name WINBOOL
+ */
+#define wBOOL WINBOOL
+
+#ifdef RESOURCE_H
+# undef RT_FONT
+# undef RT_CURSOR
+# define RT_FONT         ((RESTYPE)4)
+# define RT_CURSOR       ((RESTYPE)5)
+#endif
+
+#ifndef __CYGWIN__
+#define sleep(x) Sleep((x) * 1000)
+#endif
+
+#if defined(WIN32) && (!defined(PATH_MAX) || PATH_MAX < 1024)
+# undef PATH_MAX
+# define PATH_MAX 1024
+#endif
+
+#ifdef _XFree86Server
+# define XFree86Server
+# undef _XFree86Server
+#endif
+
diff --git a/ThirdParty/X11/Include/X11/Xwinsock.h b/ThirdParty/X11/Include/X11/Xwinsock.h
new file mode 100644
index 0000000000000000000000000000000000000000..a81dd7a25bd29bca786571a3eed1ed1884ddadae
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/Xwinsock.h
@@ -0,0 +1,77 @@
+/*
+
+Copyright 1996, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
+ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
+SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL-
+ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization from
+The Open Group.
+
+*/
+
+/*
+ * This header file has for sole purpose to allow to include winsock.h
+ * without getting any name conflicts with our code.
+ * Conflicts come from the fact that including winsock.h actually pulls
+ * in the whole Windows API...
+ */
+
+#undef _XFree86Server
+#ifdef XFree86Server 
+# define _XFree86Server
+# undef XFree86Server
+#endif
+
+/*
+ * mingw-w64 headers define BOOL as a typedef, protecting against macros
+ * mingw.org headers define BOOL in terms of WINBOOL
+ * ... so try to come up with something which works with both :-)
+ */
+#define _NO_BOOL_TYPEDEF
+#define BOOL WINBOOL
+#define INT32 wINT32
+#undef Status
+#define Status wStatus
+#define ATOM wATOM
+#define BYTE wBYTE
+#define FreeResource wFreeResource
+#include <winsock2.h>
+#undef Status
+#define Status int
+#undef BYTE
+#undef BOOL
+#undef INT32
+#undef ATOM
+#undef FreeResource
+#undef CreateWindowA
+#undef RT_FONT
+#undef RT_CURSOR
+
+/*
+ * Older version of this header used to name the windows API bool type wBOOL,
+ * rather than more standard name WINBOOL
+ */
+#define wBOOL WINBOOL
+
+#ifdef _XFree86Server
+# define XFree86Server
+# undef _XFree86Server
+#endif
+
diff --git a/ThirdParty/X11/Include/X11/ap_keysym.h b/ThirdParty/X11/Include/X11/ap_keysym.h
new file mode 100644
index 0000000000000000000000000000000000000000..9a11971170a9f3d967cba63bd76d2edc914fb438
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/ap_keysym.h
@@ -0,0 +1,51 @@
+/******************************************************************
+Copyright 1987 by Apollo Computer Inc., Chelmsford, Massachusetts.
+Copyright 1989 by Hewlett-Packard Company.
+
+                        All Rights Reserved
+
+Permission to use, duplicate, change, and distribute this software and
+its documentation for any purpose and without fee is granted, provided
+that the above copyright notice appear in such copy and that this
+copyright notice appear in all supporting documentation, and that the
+names of Apollo Computer Inc., the Hewlett-Packard Company, or the X
+Consortium not be used in advertising or publicity pertaining to
+distribution of the software without written prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+PURPOSE.  Hewlett-Packard shall not be liable for errors 
+contained herein or direct, indirect, special, incidental or 
+consequential damages in connection with the furnishing, 
+performance, or use of this material.
+
+This software is not subject to any license of the American
+Telephone and Telegraph Company or of the Regents of the
+University of California.
+******************************************************************/
+
+#define apXK_LineDel            0x1000FF00
+#define apXK_CharDel            0x1000FF01
+#define apXK_Copy               0x1000FF02
+#define apXK_Cut                0x1000FF03
+#define apXK_Paste              0x1000FF04
+#define apXK_Move               0x1000FF05
+#define apXK_Grow               0x1000FF06
+#define apXK_Cmd                0x1000FF07
+#define apXK_Shell              0x1000FF08
+#define apXK_LeftBar            0x1000FF09
+#define apXK_RightBar           0x1000FF0A
+#define apXK_LeftBox            0x1000FF0B
+#define apXK_RightBox           0x1000FF0C
+#define apXK_UpBox              0x1000FF0D
+#define apXK_DownBox            0x1000FF0E
+#define apXK_Pop                0x1000FF0F
+#define apXK_Read               0x1000FF10
+#define apXK_Edit               0x1000FF11
+#define apXK_Save               0x1000FF12
+#define apXK_Exit               0x1000FF13
+#define apXK_Repeat             0x1000FF14
+
+#define apXK_KP_parenleft       0x1000FFA8
+#define apXK_KP_parenright      0x1000FFA9
diff --git a/ThirdParty/X11/Include/X11/cursorfont.h b/ThirdParty/X11/Include/X11/cursorfont.h
new file mode 100644
index 0000000000000000000000000000000000000000..c69d508f4916dcd5be7a7dce097a14cb4413f431
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/cursorfont.h
@@ -0,0 +1,111 @@
+/*
+
+Copyright 1987, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+
+#ifndef _X11_CURSORFONT_H_
+#define _X11_CURSORFONT_H_
+
+#define XC_num_glyphs 154
+#define XC_X_cursor 0
+#define XC_arrow 2
+#define XC_based_arrow_down 4
+#define XC_based_arrow_up 6
+#define XC_boat 8
+#define XC_bogosity 10
+#define XC_bottom_left_corner 12
+#define XC_bottom_right_corner 14
+#define XC_bottom_side 16
+#define XC_bottom_tee 18
+#define XC_box_spiral 20
+#define XC_center_ptr 22
+#define XC_circle 24
+#define XC_clock 26
+#define XC_coffee_mug 28
+#define XC_cross 30
+#define XC_cross_reverse 32
+#define XC_crosshair 34
+#define XC_diamond_cross 36
+#define XC_dot 38
+#define XC_dotbox 40
+#define XC_double_arrow 42
+#define XC_draft_large 44
+#define XC_draft_small 46
+#define XC_draped_box 48
+#define XC_exchange 50
+#define XC_fleur 52
+#define XC_gobbler 54
+#define XC_gumby 56
+#define XC_hand1 58
+#define XC_hand2 60
+#define XC_heart 62
+#define XC_icon 64
+#define XC_iron_cross 66
+#define XC_left_ptr 68
+#define XC_left_side 70
+#define XC_left_tee 72
+#define XC_leftbutton 74
+#define XC_ll_angle 76
+#define XC_lr_angle 78
+#define XC_man 80
+#define XC_middlebutton 82
+#define XC_mouse 84
+#define XC_pencil 86
+#define XC_pirate 88
+#define XC_plus 90
+#define XC_question_arrow 92
+#define XC_right_ptr 94
+#define XC_right_side 96
+#define XC_right_tee 98
+#define XC_rightbutton 100
+#define XC_rtl_logo 102
+#define XC_sailboat 104
+#define XC_sb_down_arrow 106
+#define XC_sb_h_double_arrow 108
+#define XC_sb_left_arrow 110
+#define XC_sb_right_arrow 112
+#define XC_sb_up_arrow 114
+#define XC_sb_v_double_arrow 116
+#define XC_shuttle 118
+#define XC_sizing 120
+#define XC_spider 122
+#define XC_spraycan 124
+#define XC_star 126
+#define XC_target 128
+#define XC_tcross 130
+#define XC_top_left_arrow 132
+#define XC_top_left_corner 134
+#define XC_top_right_corner 136
+#define XC_top_side 138
+#define XC_top_tee 140
+#define XC_trek 142
+#define XC_ul_angle 144
+#define XC_umbrella 146
+#define XC_ur_angle 148
+#define XC_watch 150
+#define XC_xterm 152
+
+#endif /* _X11_CURSORFONT_H_ */
diff --git a/ThirdParty/X11/Include/X11/dri/xf86dri.h b/ThirdParty/X11/Include/X11/dri/xf86dri.h
new file mode 100644
index 0000000000000000000000000000000000000000..00fb8babeef61f9dfcc87eddd052ce2acd4251b7
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/dri/xf86dri.h
@@ -0,0 +1,65 @@
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright 2000 VA Linux Systems, Inc.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/**
+ * \file xf86dri.h
+ * Protocol numbers and function prototypes for DRI X protocol.
+ *
+ * \author Kevin E. Martin <martin@valinux.com>
+ * \author Jens Owen <jens@tungstengraphics.com>
+ * \author Rickard E. (Rik) Faith <faith@valinux.com>
+ */
+
+#ifndef _XF86DRI_H_
+#define _XF86DRI_H_
+
+#include <xf86drm.h>
+
+#define X_XF86DRIQueryVersion			0
+#define X_XF86DRIQueryDirectRenderingCapable	1
+#define X_XF86DRIOpenConnection			2
+#define X_XF86DRICloseConnection		3
+#define X_XF86DRIGetClientDriverName		4
+#define X_XF86DRICreateContext			5
+#define X_XF86DRIDestroyContext			6
+#define X_XF86DRICreateDrawable			7
+#define X_XF86DRIDestroyDrawable		8
+#define X_XF86DRIGetDrawableInfo		9
+#define X_XF86DRIGetDeviceInfo			10
+#define X_XF86DRIAuthConnection                 11
+#define X_XF86DRIOpenFullScreen                 12   /* Deprecated */
+#define X_XF86DRICloseFullScreen                13   /* Deprecated */
+
+#define XF86DRINumberEvents		0
+
+#define XF86DRIClientNotLocal		0
+#define XF86DRIOperationNotSupported	1
+#define XF86DRINumberErrors		(XF86DRIOperationNotSupported + 1)
+
+#endif /* _XF86DRI_H_ */
+
diff --git a/ThirdParty/X11/Include/X11/dri/xf86driproto.h b/ThirdParty/X11/Include/X11/dri/xf86driproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..b834bd1a1a030bf376c4483d3059761e9b78c2a3
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/dri/xf86driproto.h
@@ -0,0 +1,342 @@
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright 2000 VA Linux Systems, Inc.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ *   Kevin E. Martin <martin@valinux.com>
+ *   Jens Owen <jens@tungstengraphics.com>
+ *   Rickard E. (Rik) Fiath <faith@valinux.com>
+ *
+ */
+
+#ifndef _XF86DRISTR_H_
+#define _XF86DRISTR_H_
+
+#include "xf86dri.h"
+
+#define XF86DRINAME "XFree86-DRI"
+
+/* The DRI version number.  This was originally set to be the same of the
+ * XFree86 version number.  However, this version is really indepedent of
+ * the XFree86 version.
+ *
+ * Version History:
+ *    4.0.0: Original
+ *    4.0.1: Patch to bump clipstamp when windows are destroyed, 28 May 02
+ *    4.1.0: Add transition from single to multi in DRMInfo rec, 24 Jun 02
+ */
+#define XF86DRI_MAJOR_VERSION	4
+#define XF86DRI_MINOR_VERSION	1
+#define XF86DRI_PATCH_VERSION	0
+
+typedef struct _XF86DRIQueryVersion {
+    CARD8	reqType;		/* always DRIReqCode */
+    CARD8	driReqType;		/* always X_DRIQueryVersion */
+    CARD16	length B16;
+} xXF86DRIQueryVersionReq;
+#define sz_xXF86DRIQueryVersionReq	4
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	majorVersion B16;	/* major version of DRI protocol */
+    CARD16	minorVersion B16;	/* minor version of DRI protocol */
+    CARD32	patchVersion B32;       /* patch version of DRI protocol */
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xXF86DRIQueryVersionReply;
+#define sz_xXF86DRIQueryVersionReply	32
+
+typedef struct _XF86DRIQueryDirectRenderingCapable {
+    CARD8	reqType;		/* always DRIReqCode */
+    CARD8	driReqType;		/* X_DRIQueryDirectRenderingCapable */
+    CARD16	length B16;
+    CARD32	screen B32;
+} xXF86DRIQueryDirectRenderingCapableReq;
+#define sz_xXF86DRIQueryDirectRenderingCapableReq	8
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    BOOL	isCapable;
+    BOOL	pad2;
+    BOOL	pad3;
+    BOOL	pad4;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+    CARD32	pad7 B32;
+    CARD32	pad8 B32;
+    CARD32	pad9 B32;
+} xXF86DRIQueryDirectRenderingCapableReply;
+#define sz_xXF86DRIQueryDirectRenderingCapableReply	32
+
+typedef struct _XF86DRIOpenConnection {
+    CARD8	reqType;		/* always DRIReqCode */
+    CARD8	driReqType;		/* always X_DRIOpenConnection */
+    CARD16	length B16;
+    CARD32	screen B32;
+} xXF86DRIOpenConnectionReq;
+#define sz_xXF86DRIOpenConnectionReq	8
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	hSAREALow B32;
+    CARD32	hSAREAHigh B32;
+    CARD32	busIdStringLength B32;
+    CARD32	pad6 B32;
+    CARD32	pad7 B32;
+    CARD32	pad8 B32;
+} xXF86DRIOpenConnectionReply;
+#define sz_xXF86DRIOpenConnectionReply	32
+
+typedef struct _XF86DRIAuthConnection {
+    CARD8	reqType;		/* always DRIReqCode */
+    CARD8	driReqType;		/* always X_DRICloseConnection */
+    CARD16	length B16;
+    CARD32	screen B32;
+    CARD32      magic B32;
+} xXF86DRIAuthConnectionReq;
+#define sz_xXF86DRIAuthConnectionReq	12
+
+typedef struct {
+    BYTE        type;
+    BOOL        pad1;
+    CARD16      sequenceNumber B16;
+    CARD32      length B32;
+    CARD32      authenticated B32;
+    CARD32      pad2 B32;
+    CARD32      pad3 B32;
+    CARD32      pad4 B32;
+    CARD32      pad5 B32;
+    CARD32      pad6 B32;
+} xXF86DRIAuthConnectionReply;
+#define zx_xXF86DRIAuthConnectionReply  32
+
+typedef struct _XF86DRICloseConnection {
+    CARD8	reqType;		/* always DRIReqCode */
+    CARD8	driReqType;		/* always X_DRICloseConnection */
+    CARD16	length B16;
+    CARD32	screen B32;
+} xXF86DRICloseConnectionReq;
+#define sz_xXF86DRICloseConnectionReq	8
+
+typedef struct _XF86DRIGetClientDriverName {
+    CARD8	reqType;		/* always DRIReqCode */
+    CARD8	driReqType;		/* always X_DRIGetClientDriverName */
+    CARD16	length B16;
+    CARD32	screen B32;
+} xXF86DRIGetClientDriverNameReq;
+#define sz_xXF86DRIGetClientDriverNameReq	8
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	ddxDriverMajorVersion B32;
+    CARD32	ddxDriverMinorVersion B32;
+    CARD32	ddxDriverPatchVersion B32;
+    CARD32	clientDriverNameLength B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xXF86DRIGetClientDriverNameReply;
+#define sz_xXF86DRIGetClientDriverNameReply	32
+
+typedef struct _XF86DRICreateContext {
+    CARD8	reqType;		/* always DRIReqCode */
+    CARD8	driReqType;		/* always X_DRICreateContext */
+    CARD16	length B16;
+    CARD32	screen B32;
+    CARD32	visual B32;
+    CARD32	context B32;
+} xXF86DRICreateContextReq;
+#define sz_xXF86DRICreateContextReq	16
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	hHWContext B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xXF86DRICreateContextReply;
+#define sz_xXF86DRICreateContextReply	32
+
+typedef struct _XF86DRIDestroyContext {
+    CARD8	reqType;		/* always DRIReqCode */
+    CARD8	driReqType;		/* always X_DRIDestroyContext */
+    CARD16	length B16;
+    CARD32	screen B32;
+    CARD32	context B32;
+} xXF86DRIDestroyContextReq;
+#define sz_xXF86DRIDestroyContextReq	12
+
+typedef struct _XF86DRICreateDrawable {
+    CARD8	reqType;		/* always DRIReqCode */
+    CARD8	driReqType;		/* always X_DRICreateDrawable */
+    CARD16	length B16;
+    CARD32	screen B32;
+    CARD32	drawable B32;
+} xXF86DRICreateDrawableReq;
+#define sz_xXF86DRICreateDrawableReq	12
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	hHWDrawable B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xXF86DRICreateDrawableReply;
+#define sz_xXF86DRICreateDrawableReply	32
+
+typedef struct _XF86DRIDestroyDrawable {
+    CARD8	reqType;		/* always DRIReqCode */
+    CARD8	driReqType;		/* always X_DRIDestroyDrawable */
+    CARD16	length B16;
+    CARD32	screen B32;
+    CARD32	drawable B32;
+} xXF86DRIDestroyDrawableReq;
+#define sz_xXF86DRIDestroyDrawableReq	12
+
+typedef struct _XF86DRIGetDrawableInfo {
+    CARD8	reqType;		/* always DRIReqCode */
+    CARD8	driReqType;		/* always X_DRIGetDrawableInfo */
+    CARD16	length B16;
+    CARD32	screen B32;
+    CARD32	drawable B32;
+} xXF86DRIGetDrawableInfoReq;
+#define sz_xXF86DRIGetDrawableInfoReq	12
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	drawableTableIndex B32;
+    CARD32	drawableTableStamp B32;
+    INT16	drawableX B16;
+    INT16	drawableY B16;
+    INT16	drawableWidth B16;
+    INT16	drawableHeight B16;
+    CARD32	numClipRects B32;
+    INT16       backX B16;
+    INT16       backY B16;
+    CARD32      numBackClipRects B32;
+} xXF86DRIGetDrawableInfoReply;
+
+#define sz_xXF86DRIGetDrawableInfoReply	36
+
+
+typedef struct _XF86DRIGetDeviceInfo {
+    CARD8	reqType;		/* always DRIReqCode */
+    CARD8	driReqType;		/* always X_DRIGetDeviceInfo */
+    CARD16	length B16;
+    CARD32	screen B32;
+} xXF86DRIGetDeviceInfoReq;
+#define sz_xXF86DRIGetDeviceInfoReq	8
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	hFrameBufferLow B32;
+    CARD32	hFrameBufferHigh B32;
+    CARD32	framebufferOrigin B32;
+    CARD32	framebufferSize B32;
+    CARD32	framebufferStride B32;
+    CARD32	devPrivateSize B32;
+} xXF86DRIGetDeviceInfoReply;
+#define sz_xXF86DRIGetDeviceInfoReply	32
+
+typedef struct _XF86DRIOpenFullScreen {
+    CARD8       reqType;	/* always DRIReqCode */
+    CARD8       driReqType;	/* always X_DRIOpenFullScreen */
+    CARD16      length B16;
+    CARD32      screen B32;
+    CARD32      drawable B32;
+} xXF86DRIOpenFullScreenReq;
+#define sz_xXF86DRIOpenFullScreenReq    12
+
+typedef struct {
+    BYTE        type;
+    BOOL        pad1;
+    CARD16      sequenceNumber B16;
+    CARD32      length B32;
+    CARD32      isFullScreen B32;
+    CARD32      pad2 B32;
+    CARD32      pad3 B32;
+    CARD32      pad4 B32;
+    CARD32      pad5 B32;
+    CARD32      pad6 B32;
+} xXF86DRIOpenFullScreenReply;
+#define sz_xXF86DRIOpenFullScreenReply  32
+
+typedef struct _XF86DRICloseFullScreen {
+    CARD8       reqType;	/* always DRIReqCode */
+    CARD8       driReqType;	/* always X_DRICloseFullScreen */
+    CARD16      length B16;
+    CARD32      screen B32;
+    CARD32      drawable B32;
+} xXF86DRICloseFullScreenReq;
+#define sz_xXF86DRICloseFullScreenReq   12
+
+typedef struct {
+    BYTE        type;
+    BOOL        pad1;
+    CARD16      sequenceNumber B16;
+    CARD32      length B32;
+    CARD32      pad2 B32;
+    CARD32      pad3 B32;
+    CARD32      pad4 B32;
+    CARD32      pad5 B32;
+    CARD32      pad6 B32;
+    CARD32      pad7 B32;
+} xXF86DRICloseFullScreenReply;
+#define sz_xXF86DRICloseFullScreenReply  32
+
+
+#endif /* _XF86DRISTR_H_ */
diff --git a/ThirdParty/X11/Include/X11/dri/xf86dristr.h b/ThirdParty/X11/Include/X11/dri/xf86dristr.h
new file mode 100644
index 0000000000000000000000000000000000000000..048491eed62b7608a85156b1b20969ba3dafa122
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/dri/xf86dristr.h
@@ -0,0 +1,3 @@
+#warning "xf86dristr.h is obsolete and may be removed in the future."
+#warning "include <X11/dri/xf86driproto.h> for the protocol defines."
+#include <X11/dri/xf86driproto.h>
diff --git a/ThirdParty/X11/Include/X11/extensions/EVI.h b/ThirdParty/X11/Include/X11/extensions/EVI.h
new file mode 100644
index 0000000000000000000000000000000000000000..7f3f733e624b7b222e6d724cf6d1b917a6717f3c
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/EVI.h
@@ -0,0 +1,36 @@
+/************************************************************
+Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+********************************************************/
+
+#ifndef _EVI_H_
+#define _EVI_H_
+
+#define XEVI_TRANSPARENCY_NONE		0
+#define XEVI_TRANSPARENCY_PIXEL		1
+#define XEVI_TRANSPARENCY_MASK		2
+
+#define EVINAME "Extended-Visual-Information"
+
+#define XEVI_MAJOR_VERSION	1	/* current version numbers */
+#define XEVI_MINOR_VERSION	0
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/EVIproto.h b/ThirdParty/X11/Include/X11/extensions/EVIproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..afa282a53de59e7906bd2f97b6c36cb8bc6c9250
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/EVIproto.h
@@ -0,0 +1,96 @@
+/************************************************************
+Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+********************************************************/
+
+#ifndef _EVIPROTO_H_
+#define _EVIPROTO_H_
+
+#include <X11/extensions/EVI.h>
+
+#define X_EVIQueryVersion		0
+#define X_EVIGetVisualInfo		1
+
+#define VisualID CARD32
+
+typedef CARD32 VisualID32;
+#define sz_VisualID32 4
+
+typedef struct _xExtendedVisualInfo {
+    VisualID	core_visual_id B32;
+    INT8	screen;
+    INT8	level;
+    CARD8	transparency_type;
+    CARD8	pad0;
+    CARD32	transparency_value B32;
+    CARD8	min_hw_colormaps;
+    CARD8	max_hw_colormaps;
+    CARD16	num_colormap_conflicts B16;
+} xExtendedVisualInfo;
+#define sz_xExtendedVisualInfo 16
+
+typedef struct _XEVIQueryVersion {
+    CARD8	reqType;		/* always XEVIReqCode */
+    CARD8	xeviReqType;		/* always X_EVIQueryVersion */
+    CARD16	length B16;
+} xEVIQueryVersionReq;
+#define sz_xEVIQueryVersionReq	4
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8 	unused;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	majorVersion B16;	/* major version of EVI protocol */
+    CARD16	minorVersion B16;	/* minor version of EVI protocol */
+    CARD32	pad0 B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+} xEVIQueryVersionReply;
+#define sz_xEVIQueryVersionReply	32
+
+typedef struct _XEVIGetVisualInfoReq {
+    CARD8	reqType;	/* always XEVIReqCode */
+    CARD8	xeviReqType;	/* always X_EVIGetVisualInfo */
+    CARD16      length B16;
+    CARD32 	n_visual B32;
+} xEVIGetVisualInfoReq;
+#define sz_xEVIGetVisualInfoReq	8
+
+typedef struct _XEVIGetVisualInfoReply {
+    BYTE	type;  /* X_Reply */
+    CARD8	unused;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	n_info B32;
+    CARD32	n_conflicts B32;
+    CARD32	pad0 B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+} xEVIGetVisualInfoReply;
+#define sz_xEVIGetVisualInfoReply	32
+
+#undef VisualID
+
+#endif /* _EVIPROTO_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/MITMisc.h b/ThirdParty/X11/Include/X11/extensions/MITMisc.h
new file mode 100644
index 0000000000000000000000000000000000000000..4cfb334ee43b880c67fa03c48b729e4ddc85d8b2
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/MITMisc.h
@@ -0,0 +1,54 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM OR X PROJECT TEAM BLESSING */
+
+#ifndef _XMITMISC_H_
+#define _XMITMISC_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/mitmiscconst.h>
+
+_XFUNCPROTOBEGIN
+
+Bool XMITMiscQueryExtension(
+    Display*		/* dpy */,
+    int*		/* event_basep */,
+    int*		/* error_basep */
+);
+
+Status XMITMiscSetBugMode(
+    Display*		/* dpy */,
+    Bool		/* onOff */
+);
+
+Bool XMITMiscGetBugMode(
+    Display*		/* dpy */
+);
+
+_XFUNCPROTOEND
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/Print.h b/ThirdParty/X11/Include/X11/extensions/Print.h
new file mode 100644
index 0000000000000000000000000000000000000000..4c1b387647cd24f78023deaa4c8e972100abf9ff
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/Print.h
@@ -0,0 +1,552 @@
+/* $Xorg: Print.h,v 1.3 2000/08/18 04:05:44 coskrey Exp $ */
+/******************************************************************************
+ ******************************************************************************
+ **
+ ** File:         Print.h
+ **
+ ** Description:  Definitions needed by the server, library, and
+ **               clients.  Subportion restricted to library and
+ **               clients.
+ **
+ **               Server, Library, Client portion has:
+ **                  o All sz_* defines
+ **                  o Revision and Name defines
+ **                  o Common defines and constants (e.g. Keywords, Masks)
+ **                  o Extension version structure
+ **
+ **               Library and client subportion has:
+ **                  o Convience Marcos
+ **                  o Client side data structures
+ **                  o Client side event structures (non wire)
+ **                  o Library function prototypes
+ **                  o some private stuff denoted with _whatever
+ **
+ **               Printstr.h for server and library, but NOT clients.
+ **
+ ******************************************************************************
+ **
+ ** (c) Copyright 1996 Hewlett-Packard Company
+ ** (c) Copyright 1996 International Business Machines Corp.
+ ** (c) Copyright 1996 Sun Microsystems, Inc.
+ ** (c) Copyright 1996 Novell, Inc.
+ ** (c) Copyright 1996 Digital Equipment Corp.
+ ** (c) Copyright 1996 Fujitsu Limited
+ ** (c) Copyright 1996 Hitachi, Ltd.
+ **
+ ** Permission is hereby granted, free of charge, to any person obtaining a copy
+ ** of this software and associated documentation files (the "Software"), to deal
+ ** in the Software without restriction, including without limitation the rights
+ ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ ** copies of the Software, and to permit persons to whom the Software is
+ ** furnished to do so, subject to the following conditions:
+ **
+ ** The above copyright notice and this permission notice shall be included in
+ ** all copies or substantial portions of the Software.
+ **
+ ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+ ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ **
+ ** Except as contained in this notice, the names of the copyright holders shall
+ ** not be used in advertising or otherwise to promote the sale, use or other
+ ** dealings in this Software without prior written authorization from said
+ ** copyright holders.
+ **
+ ******************************************************************************
+ *****************************************************************************/
+/* $XFree86: xc/include/extensions/Print.h,v 1.4 2000/01/25 18:37:31 dawes Exp $ */
+
+#ifndef _XpPrint_H_
+#define _XpPrint_H_
+
+#ifndef _XP_PRINT_SERVER_
+#include <X11/Xlib.h>
+#include <X11/Xresource.h>
+#include <X11/Xauth.h>
+#endif /* _XP_PRINT_SERVER_ */
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+/******************************************************************************
+ *
+ * Definitions used by the server, library and client.
+ */
+
+/********************************************************************
+ *
+ * Naming and versioning information.
+ */
+#define XP_PRINTNAME  "XpExtension"
+
+/*
+ * Add a define below for each major extension release.
+ */
+#define XP_DONT_CHECK		0
+#define XP_INITIAL_RELEASE	1
+
+/*
+ * For each single entry above, create one major/minor pair.
+ */
+#define XP_PROTO_MAJOR		1
+#define XP_PROTO_MINOR		0
+
+/*
+ * Identify current version.
+ */
+#define XP_MAJOR_VERSION	XP_PROTO_MAJOR
+#define XP_MINOR_VERSION	XP_PROTO_MINOR
+
+/*
+ * Misc version defines.
+ */
+#define XP_ABSENT		0	/* Prior to XP Print support */
+#define XP_PRESENT		1	/* With XP Print support */
+
+/********************************************************************
+ *
+ * Xp Print Error codes.
+ */
+#define XP_ERRORS		3	/* number of error types */
+
+#define XPBadContext		0	/* Print Context invalid or missing */
+#define XPBadSequence		1	/* Illegal sequence of XP operations */
+#define XPBadResourceID		2	/* X-resource not valid */
+
+/********************************************************************
+ *
+ * Xp Print Event masks and codes.
+ *
+ */
+#define XP_EVENTS		2	/* number of event types */
+
+#define XPNoEventMask		0	/* not an event - just a null mask */
+#define XPPrintMask		(1L<<0)
+#define XPAttributeMask		(1L<<1)
+
+#define XPPrintNotify		0	/* contains "detail" - see below */
+#define XPAttributeNotify	1	/* contains "detail" - see below */
+
+#define XPStartJobNotify	0	/* value for "detail" in XPPrintNotify*/
+#define XPEndJobNotify		1
+#define XPStartDocNotify	2
+#define XPEndDocNotify		3
+#define XPStartPageNotify	4
+#define XPEndPageNotify		5
+
+/********************************************************************
+ *
+ * Xp Print Attribute Object codes (subset of ISO DPA 10175).  The
+ * Xp Server can get and set any of the values, while the Xp Library
+ * may only be able to set a subset of the attribute objects.
+ *
+ * note: the codes are also used as "detail" for XPAttributeNotify
+ *
+ * note: XPPageAttr is not defined in ISO DPA 10175.  It is unique
+ * to Xp, and its attributes are a proper subset of XPDocAttr.
+ */
+typedef unsigned char XPAttributes;	/* type of Xp*Attr codes */
+
+#define XP_ATTRIBUTES		5	/* those attrs currently supported */
+
+#define XPJobAttr		1	/* get/set */
+#define XPDocAttr		2	/* get/set */
+#define XPPageAttr		3	/* get/set - subset of XPDocAttr */
+#define XPPrinterAttr		4	/* get only (library) */
+#define XPServerAttr		5	/* get only (library), no
+					   context needed */
+
+/*
+ * note: ISO DPA 10175 defines a number of "attribute objects", of
+ *       which POSIX 1387.4 and the SI Xp will only support a
+ *       subset.
+ */
+#define XPMediumAttr		6	/* DPA-Object Medium */
+#define XPFontAttr		7	/* DPA-Object Font */
+#define XPResAttr		8	/* DPA-Object Resource */
+#define XPTransAttr		9	/* DPA-Object Transfer method */
+#define XPDelAttr		10	/* DPA-Object Delivery method */
+#define XPAuxSPkg		11	/* DPA-Object Auxiliary sheet package */
+#define XPAuxS			12	/* DPA-Object Auxiliary sheet */
+#define XPFinishAttr		13	/* DPA-Object Finishing */
+#define XPOutputAttr		14	/* DPA-Object Output method */
+#define XPImpAttr		15	/* DPA-Object Imposition */
+#define XPSchedAttr		16	/* DPA-Object Scheduler */
+#define XPIntJobAttr		17	/* DPA-Object Initial value job */
+#define XPIntDocAttr		18	/* DPA-Object Initial value document */
+#define XPResConAttr		19	/* DPA-Object Resource context */
+
+
+/*
+ * Replacement rules for XpSetAttributes
+ */
+typedef unsigned char XPAttrReplacement;
+#define	XPAttrReplace		1
+#define XPAttrMerge		2
+
+
+/*
+ * Return codes for XpGetDocumentData
+ */
+typedef unsigned char XPGetDocStatus;
+#define XPGetDocFinished	0	/* normal termination */
+#define XPGetDocSecondConsumer	1	/* setup error */
+#define XPGetDocError		2	/* runtime error, see generated error */
+
+
+/*
+ * Save data types for XpStartJob.
+ */
+typedef unsigned char XPSaveData;
+#define XPSpool			1	/* Job data sent to spooler */
+#define XPGetData		2	/* Job data via XpGetDocumentData */
+
+
+/*
+ * Document types for XpStartDoc.
+ */
+typedef unsigned char XPDocumentType;
+#define	XPDocNormal		1	/* Doc data handled by Xserver */
+#define	XPDocRaw		2	/* Doc data passed through Xserver */
+
+
+/********************************************************************
+ *
+ * Xp Print Property Names
+ */
+
+
+#ifndef _XP_PRINT_SERVER_
+
+/******************************************************************************
+ *
+ * Definitions used by the library and clients only.
+ */
+
+/*******************************************************************
+ *
+ * General API defines and such.
+ */
+
+/*
+ * Print Context for XpInitContext and related calls.
+ */
+typedef XID XPContext;
+
+/*
+ * Struct for XpGetPrinterList.
+ */
+typedef struct {
+    char	*name;		/* name */
+    char	*desc;		/* localized description */
+} XPPrinterRec, *XPPrinterList;
+
+/*
+ * Typedefs for XpGetDocumentData
+ */
+typedef void (*XPSaveProc)( Display *display,
+                            XPContext context,
+                            unsigned char *data,
+                            unsigned int data_len,
+                            XPointer client_data);
+
+typedef void (*XPFinishProc)( Display *display,
+                              XPContext context,
+                              XPGetDocStatus status,
+                              XPointer client_data);
+
+/*
+ * Typedefs for XpSetLocaleHinter and XpGetLocaleHinter
+ */
+typedef char * (*XPHinterProc)(void);
+
+#if 0
+/*******************************************************************
+ *
+ * Extension version structures.
+ *
+ **** this structure is now defined localy in the one file that uses it
+ **** in order to avoid clashes with its definition in XI.h
+ */
+typedef struct {
+        int     present;
+        short   major_version;
+        short   minor_version;
+} XExtensionVersion;
+#endif
+
+/********************************************************************
+ *
+ * Event structs for clients.
+ *
+ * note: these events are relative to a print context, and
+ * not to a window as in core X.
+ */
+typedef struct {
+    int            type;       /* base + XPPrintNotify */
+    unsigned long  serial;     /* # of last request processed by server */
+    Bool           send_event; /* true if from a SendEvent request */
+    Display        *display;   /* Display the event was read from */
+    XPContext      context;    /* print context where operation was requested */
+    Bool           cancel;     /* was detailed event canceled */
+    int            detail;     /* XPStartJobNotify, XPEndJobNotify,
+                                  XPStartDocNotify, XPEndDocNotify,
+                                  XPStartPageNotify, XPEndPageNotify */
+} XPPrintEvent;
+
+typedef struct {
+    int            type;       /* base + XPAttributeNotify */
+    unsigned long  serial;     /* # of last request processed by server */
+    Bool           send_event; /* true if from a SendEvent request */
+    Display        *display;   /* Display the event was read from */
+    XPContext      context;    /* print context where operation was requested */
+    int            detail;     /* XPJobAttr, XPDocAttr, XPPageAttr,
+                                  XPPrinterAttr, XPSpoolerAttr,
+                                  XPMediumAttr, XPServerAttr */
+} XPAttributeEvent;
+
+typedef struct {
+    int            type;       /* base + XPDataReadyNotify */
+    unsigned long  serial;     /* # of last request processed by server */
+    Bool           send_event; /* true if from a SendEvent request */
+    Display        *display;   /* Display the event was read from */
+    XPContext      context;    /* print context where operation was requested */
+    unsigned long  available;  /* bytes available for retrieval */
+} XPDataReadyEvent;
+
+
+/**********************************************************
+ *
+ * Function prototypes for library side.
+ */
+
+extern XPContext XpCreateContext (
+    Display		*display,
+    char		*printer_name
+);
+
+extern void XpSetContext (
+    Display		*display,
+    XPContext     	print_context
+);
+
+extern XPContext XpGetContext (
+    Display		*display
+);
+
+extern void XpDestroyContext (
+    Display		*display,
+    XPContext     	print_context
+);
+
+extern Screen *XpGetScreenOfContext (
+    Display		*display,
+    XPContext     	print_context
+);
+
+extern Status XpGetPageDimensions (
+    Display		*display,
+    XPContext     	print_context,
+    unsigned short	*width,			/* return value */
+    unsigned short	*height,		/* return value */
+    XRectangle		*reproducible_area	/* return value */
+);
+
+extern void XpStartJob (
+    Display		*display,
+    XPSaveData		save_data
+);
+
+extern void XpEndJob (
+    Display		*display
+);
+
+extern void XpCancelJob (
+    Display		*display,
+    Bool		discard
+);
+
+extern void XpStartDoc (
+    Display		*display,
+    XPDocumentType	type
+);
+
+extern void XpEndDoc (
+    Display		*display
+);
+
+extern void XpCancelDoc (
+    Display		*display,
+    Bool		discard
+);
+
+extern void XpPutDocumentData (
+    Display		*display,
+    Drawable		drawable,
+    unsigned char	*data,
+    int			data_len,
+    char		*doc_fmt,
+    char		*options
+);
+
+extern Status XpGetDocumentData (
+    Display		*display,
+    XPContext		context,
+    XPSaveProc		save_proc,
+    XPFinishProc	finish_proc,
+    XPointer		client_data
+);
+
+extern void XpStartPage (
+    Display		*display,
+    Window		window
+);
+
+extern void XpEndPage (
+    Display		*display
+);
+
+extern void XpCancelPage (
+    Display		*display,
+    Bool		discard
+);
+
+extern void XpSelectInput (
+    Display		*display,
+    XPContext     	print_context,
+    unsigned long	event_mask
+);
+
+extern unsigned long XpInputSelected (
+    Display		*display,
+    XPContext     	print_context,
+    unsigned long	*all_events_mask
+);
+
+extern Bool XpSetImageResolution (
+    Display		*display,
+    XPContext     	print_context,
+    int			image_res,
+    int			*prev_res
+);
+
+extern int XpGetImageResolution (
+    Display		*display,
+    XPContext     	print_context
+);
+
+extern char *XpGetAttributes (
+    Display		*display,
+    XPContext     	print_context,
+    XPAttributes	type
+);
+
+extern void XpSetAttributes (
+    Display		*display,
+    XPContext     	print_context,
+    XPAttributes	type,
+    char		*pool,
+    XPAttrReplacement	replacement_rule
+);
+
+extern char *XpGetOneAttribute (
+    Display		*display,
+    XPContext     	print_context,
+    XPAttributes	type,
+    char		*attribute_name
+);
+
+extern XPPrinterList XpGetPrinterList (
+    Display		*display,
+    char		*printer_name,
+    int			*list_count		/* return value */
+);
+
+extern void XpFreePrinterList (
+    XPPrinterList	printer_list
+);
+
+extern void XpRehashPrinterList (
+    Display		*display
+);
+
+extern Status XpQueryVersion (
+    Display		*display,
+    short		*major_version,		/* return value */
+    short		*minor_version		/* return value */
+);
+
+extern Bool XpQueryExtension (
+    Display		*display,
+    int			*event_base_return,	/* return value */
+    int			*error_base_return	/* return value */
+);
+
+extern Screen **XpQueryScreens (
+    Display		*display,
+    int			*list_count		/* return value */
+);
+
+extern Status XpGetPdmStartParams (
+    Display		*print_display,
+    Window		print_window,
+    XPContext		print_context,
+    Display		*video_display,
+    Window		video_window,
+    Display		**selection_display,	/* return value */
+    Atom		*selection,		/* return value */
+    Atom		*type,			/* return value */
+    int			*format,		/* return value */
+    unsigned char	**data,			/* return value */
+    int			*nelements		/* return value */
+);
+
+extern Status XpGetAuthParams (
+    Display		*print_display,
+    Display		*video_display,
+    Display		**selection_display,	/* return value */
+    Atom		*selection,		/* return value */
+    Atom		*target			/* return value */
+);
+
+extern Status XpSendAuth (
+    Display		*display,
+    Window		window
+);
+
+extern Status XpSendOneTicket (
+    Display		*display,
+    Window		window,
+    Xauth		*ticket,
+    Bool		more
+);
+
+extern void XpSetLocaleHinter (
+    XPHinterProc hinter_proc,
+    char         *hinter_desc
+);
+
+extern char *XpGetLocaleHinter (
+    XPHinterProc *hinter_proc
+);
+
+extern char *XpGetLocaleNetString(void);
+
+extern char *XpNotifyPdm (
+    Display		*print_display,
+    Window		print_window,
+    XPContext     	print_context,
+    Display		*video_display,
+    Window		video_window,
+    Bool		auth_flag
+);
+
+#endif /* _XP_PRINT_SERVER_ */
+
+_XFUNCPROTOEND
+
+#endif /* _XpPrint_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/Printstr.h b/ThirdParty/X11/Include/X11/extensions/Printstr.h
new file mode 100644
index 0000000000000000000000000000000000000000..8fc995811f74f7bda955ceab4358efebb1c03861
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/Printstr.h
@@ -0,0 +1,783 @@
+/* $Xorg: Printstr.h,v 1.3 2000/08/18 04:05:44 coskrey Exp $ */
+/******************************************************************************
+ ******************************************************************************
+ **
+ ** File:         Printstr.h
+ **
+ ** Description: Definitions needed by the server and library, but
+ **              not clients.
+ **
+ **              Print.h for server, library and clients.
+ **
+ ******************************************************************************
+ **
+ ** (c) Copyright 1996 Hewlett-Packard Company
+ ** (c) Copyright 1996 International Business Machines Corp.
+ ** (c) Copyright 1996 Sun Microsystems, Inc.
+ ** (c) Copyright 1996 Novell, Inc.
+ ** (c) Copyright 1996 Digital Equipment Corp.
+ ** (c) Copyright 1996 Fujitsu Limited
+ ** (c) Copyright 1996 Hitachi, Ltd.
+ **
+ ** Permission is hereby granted, free of charge, to any person obtaining a copy
+ ** of this software and associated documentation files (the "Software"), to deal
+ ** in the Software without restriction, including without limitation the rights
+ ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ ** copies of the Software, and to permit persons to whom the Software is
+ ** furnished to do so, subject to the following conditions:
+ **
+ ** The above copyright notice and this permission notice shall be included in
+ ** all copies or substantial portions of the Software.
+ **
+ ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+ ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ **
+ ** Except as contained in this notice, the names of the copyright holders shall
+ ** not be used in advertising or otherwise to promote the sale, use or other
+ ** dealings in this Software without prior written authorization from said
+ ** copyright holders.
+ **
+ ******************************************************************************
+ *****************************************************************************/
+/* $XFree86: xc/include/extensions/Printstr.h,v 1.5 2001/08/01 00:44:35 tsi Exp $ */
+
+
+#ifndef _XpPrintstr_H_
+#define _XpPrintstr_H_
+
+/*
+ * NEED_EVENTS and NEED_REPLIES are hacks to limit the linker symbol-table
+ * size.   When function prototypes are needed from Print.h, this sets up
+ * a cascading dependency on Printstr.h and eventually Xproto.h to provide
+ * the event and reply struct definitions.
+ */
+#ifndef NEED_EVENTS
+#define NEED_EVENTS
+#endif /* NEED_EVENTS */
+
+#define NEED_REPLIES
+
+#include <X11/Xproto.h>
+#ifndef _XP_PRINT_SERVER_
+#include <X11/Xlib.h>
+#endif /* _XP_PRINT_SERVER_ */
+
+/*
+ * Pull in other definitions.  Print.h will hide some things if we're
+ * doing server side work.
+ */
+#include <X11/extensions/Print.h>
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+/******************************************************************************
+ *
+ * Protocol requests constants and alignment values
+ *
+ * Note: Xlib macro's expect X_ABC where ABC is the name of the
+ * protocol request.
+ */
+#define X_PrintQueryVersion		0
+#define X_PrintGetPrinterList		1
+#define X_PrintCreateContext		2
+#define X_PrintSetContext		3
+#define X_PrintGetContext		4
+#define X_PrintDestroyContext		5
+#define X_PrintGetContextScreen		6
+#define X_PrintStartJob			7
+#define X_PrintEndJob			8
+#define X_PrintStartDoc			9
+#define X_PrintEndDoc			10
+#define X_PrintPutDocumentData		11
+#define X_PrintGetDocumentData		12
+#define X_PrintStartPage		13
+#define X_PrintEndPage			14
+#define X_PrintSelectInput		15
+#define X_PrintInputSelected		16
+#define X_PrintGetAttributes		17
+#define X_PrintSetAttributes		18
+#define X_PrintGetOneAttribute		19
+#define X_PrintRehashPrinterList	20
+#define X_PrintGetPageDimensions	21
+#define X_PrintQueryScreens		22
+#define X_PrintSetImageResolution	23
+#define X_PrintGetImageResolution	24
+
+/********************************************************************
+ *
+ * Protocol data types
+ */
+#define PCONTEXT CARD32
+#define WINDOW   CARD32
+#define DRAWABLE CARD32
+#define BITMASK  CARD32
+
+/******************************************************************************
+ *
+ * Event wire struct definitions
+ *
+ * Note: Xlib macro's expect xABC struct names and sz_xABC size
+ * constants where ABC is the name of the protocol request.
+ */
+
+
+/*********************************************************************
+ *
+ * Events.
+ *
+ * See Print.h for the protocol "type" values.
+ */
+typedef struct _xPrintPrintEvent {
+	BYTE type;		/* XPPrintNotify + extEntry->eventBase */
+	BYTE detail;		/* XPStartJobNotify, XPEndJobNotify,
+				   XPStartDocNotify, XPEndDocNotify,
+				   XPStartPageNotify, XPEndPageNotify */
+	CARD16 sequenceNumber B16;
+	PCONTEXT printContext B32; /* print context */
+	BOOL   cancel;		/* canceled flag */
+	CARD8  pad1;		/* rest is unused */
+	CARD16 pad2 B16;
+	CARD32 pad3 B32;
+	CARD32 pad4 B32;
+	CARD32 pad5 B32;
+	CARD32 pad6 B32;
+	CARD32 pad7 B32;
+} xPrintPrintEvent;
+#define sz_xPrintPrintEvent 32;
+
+typedef struct _xPrintAttributeEvent {
+	BYTE   type;		/* XPAttributeNotify + extEntry->eventBase */
+	BYTE   detail;		/* XPJobAttr, XPDocAttr, XPPageAttr,
+				   XPPrinterAttr, XPSpoolerAttr,
+				   XPMediumAttr, XPServerAttr */
+	CARD16 sequenceNumber B16;
+	PCONTEXT printContext B32; /* print context */
+	CARD32 pad1 B32;
+	CARD32 pad2 B32;
+	CARD32 pad3 B32;
+	CARD32 pad4 B32;
+	CARD32 pad5 B32;
+	CARD32 pad6 B32;
+} xPrintAttributeEvent;
+#define sz_xPrintAttributeEvent 32;
+
+
+/*********************************************************************
+ *
+ * Requests
+ */
+typedef struct _PrintQueryVersion {
+	CARD8	reqType;		/* always PrintReqCode */
+	CARD8	printReqType;		/* always X_PrintQueryVersion */
+	CARD16	length B16;
+} xPrintQueryVersionReq;
+#define sz_xPrintQueryVersionReq	4
+
+typedef struct {
+	BYTE	type;			/* X_Reply */
+	CARD8	unused;			/* not used */
+	CARD16	sequenceNumber B16;
+	CARD32	length B32;
+	CARD16	majorVersion B16;	/* major version of Xp protocol */
+	CARD16	minorVersion B16;	/* minor version of Xp protocol */
+	CARD32	pad1 B32;
+	CARD32	pad2 B32;
+	CARD32	pad3 B32;
+	CARD32	pad4 B32;
+	CARD32	pad5 B32;
+} xPrintQueryVersionReply;
+#define sz_xPrintQueryVersionReply	32
+
+
+typedef struct _PrintGetPrinterList {
+	CARD8	reqType;		/* always PrintReqCode */
+	CARD8	printReqType;		/* always X_PrintGetPrinterList */
+	CARD16	length B16;
+	CARD32	printerNameLen B32;	/* length of printer name */
+	CARD32	localeLen B32;		/* length of locale string */
+
+	/* variable portion *****************************************
+	STRING8	printerName;		 * printer name *
+	BYTE	pad(printerNameLen)	 * unused *
+	STRING8	locale;			 * locale *
+	BYTE	pad(localeLen)		 * unused *
+	************************************************************/
+} xPrintGetPrinterListReq;
+#define sz_xPrintGetPrinterListReq	12
+
+typedef struct {
+	BYTE	type;			/* X_Reply */
+	CARD8	unused;			/* not used */
+	CARD16	sequenceNumber B16;
+	CARD32	length B32;
+	CARD32	listCount B32;		/* of PRINTER recs below */
+	CARD32	pad1 B32;
+	CARD32	pad2 B32;
+	CARD32	pad3 B32;
+	CARD32	pad4 B32;
+	CARD32	pad5 B32;
+
+	/* variable portion *****************************************
+	CARD32	nameLen B32;		* length of name in bytes *
+	STRING8	name;			* name *
+	BYTE	pad(nameLen)		* unused *
+
+	CARD32	descLen B32;		* length of desc in bytes *
+	STRING8	desc;			* localized description *
+	BYTE	pad(descLen)		* unused *
+	************************************************************/
+} xPrintGetPrinterListReply;
+#define sz_xPrintGetPrinterListReply	32
+
+
+typedef struct _PrintRehashPrinterList {
+	CARD8	reqType;		/* always PrintReqCode */
+	CARD8	printReqType;		/* always X_PrintRehashPrinterList */
+	CARD16	length B16;
+} xPrintRehashPrinterListReq;
+#define sz_xPrintRehashPrinterListReq	4
+
+
+typedef struct _PrintCreateContext {
+	CARD8	reqType;		/* always PrintReqCode */
+	CARD8	printReqType;		/* always X_PrintInitSetContext */
+	CARD16	length B16;
+	CARD32	contextID B32;		/* ID for context */
+	CARD32	printerNameLen B32;	/* length of printerName in bytes */
+	CARD32	localeLen B32;		/* length of locale in bytes */
+
+	/* variable portion *****************************************
+	STRING8	printerName		 * printer name *
+	BYTE	pad(printerNameLen)	 * unused *
+	STRING8	locale			 * locale *
+	BYTE	pad(locale)		 * unused *
+	************************************************************/
+} xPrintCreateContextReq;
+#define sz_xPrintCreateContextReq	16
+
+
+typedef struct _PrintSetContext {
+	CARD8	reqType;		/* always PrintReqCode */
+	CARD8	printReqType;		/* always X_PrintSetContext */
+	CARD16	length B16;
+	PCONTEXT printContext B32;	/* print context */
+} xPrintSetContextReq;
+#define sz_xPrintSetContextReq		8
+
+
+typedef struct _PrintGetContext {
+	CARD8	reqType;		/* always PrintReqCode */
+	CARD8	printReqType;		/* always X_PrintGetContext */
+	CARD16	length B16;
+} xPrintGetContextReq;
+#define sz_xPrintGetContextReq		4
+
+typedef struct {
+	BYTE	type;			/* X_Reply */
+	CARD8	unused;			/* not used */
+	CARD16	sequenceNumber B16;
+	CARD32	length B32;
+	PCONTEXT printContext B32;	/* print context */
+	CARD32	pad1 B32;
+	CARD32	pad2 B32;
+	CARD32	pad3 B32;
+	CARD32	pad4 B32;
+	CARD32	pad5 B32;
+} xPrintGetContextReply;
+#define sz_xPrintGetContextReply	32
+
+
+typedef struct _PrintDestroyContext {
+	CARD8	reqType;		/* always PrintReqCode */
+	CARD8	printReqType;		/* always X_PrintDestroyContext */
+	CARD16	length B16;
+	PCONTEXT printContext B32;	/* print context */
+} xPrintDestroyContextReq;
+#define sz_xPrintDestroyContextReq	8
+
+
+typedef struct _PrintGetContextScreen {
+	CARD8	reqType;		/* always PrintReqCode */
+	CARD8	printReqType;		/* always X_PrintGetContextScreen */
+	CARD16	length B16;
+	PCONTEXT printContext B32;	/* print context */
+} xPrintGetContextScreenReq;
+#define sz_xPrintGetContextScreenReq	8
+
+typedef struct {
+	BYTE	type;			/* X_Reply */
+	CARD8	unused;			/* not used */
+	CARD16	sequenceNumber B16;
+	CARD32	length B32;
+	WINDOW  rootWindow;		/* screenPtr represented as rootWin */
+	CARD32	pad1 B32;
+	CARD32	pad2 B32;
+	CARD32	pad3 B32;
+	CARD32	pad4 B32;
+	CARD32	pad5 B32;
+} xPrintGetContextScreenReply;
+#define sz_xPrintGetContextScreenReply	32
+
+
+typedef struct _PrintStartJob {
+	CARD8	reqType;		/* always PrintReqCode */
+	CARD8	printReqType;		/* always X_PrintStartJob */
+	CARD16	length B16;
+	CARD8	saveData;		/* save data boolean */
+	CARD8	pad1;
+	CARD16	pad2 B16;
+} xPrintStartJobReq;
+#define sz_xPrintStartJobReq		8
+
+typedef struct _PrintEndJob {
+	CARD8	reqType;		/* always PrintReqCode */
+	CARD8	printReqType;		/* always X_PrintEndJob */
+	CARD16	length B16;
+	BOOL	cancel;			/* cancel boolean */
+	CARD8	pad1;
+	CARD16	pad2 B16;
+} xPrintEndJobReq;
+#define sz_xPrintEndJobReq		8
+
+
+typedef struct _PrintStartDoc {
+	CARD8	reqType;		/* always PrintReqCode */
+	CARD8	printReqType;		/* always X_PrintStartDoc */
+	CARD16	length B16;
+	CARD8	type;			/* type for document */
+	CARD8	pad1;
+	CARD16	pad2 B16;
+} xPrintStartDocReq;
+#define sz_xPrintStartDocReq		8
+
+typedef struct _PrintEndDoc {
+	CARD8	reqType;		/* always PrintReqCode */
+	CARD8	printReqType;		/* always X_PrintEndDoc */
+	CARD16	length B16;
+	BOOL	cancel;			/* cancel boolean */
+	CARD8	pad1;
+	CARD16	pad2 B16;
+} xPrintEndDocReq;
+#define sz_xPrintEndDocReq		8
+
+
+typedef struct _PrintPutDocumentData {
+	CARD8	reqType;		/* always PrintReqCode */
+	CARD8	printReqType;		/* always X_PrintPutDocumentData */
+	CARD16	length B16;
+	DRAWABLE drawable B32;		/* target drawable */
+	CARD32	len_data B32;		/* big len in bytes */
+	CARD16	len_fmt;		/* len in bytes */
+	CARD16	len_options;		/* len in bytes */
+
+	/* variable portion *****************************************
+	LISTofBYTE	data;		 * data *
+	BYTE		pad(len_data)	 * unused *
+	STRING8		doc_fmt;	 * ISO compliant desc of data type *
+	BYTE		pad(len_fmt)	 * unused *
+	STRING8		options;	 * additional device-dependent desc *
+	BYTE		pad(len_options) * unused *
+	************************************************************/
+} xPrintPutDocumentDataReq;
+#define sz_xPrintPutDocumentDataReq	16
+
+
+typedef struct _PrintGetDocumentData {
+	CARD8	reqType;		/* always PrintReqCode */
+	CARD8	printReqType;		/* always X_PrintGetDocumentData */
+	CARD16	length B16;
+	PCONTEXT printContext B32;	/* print context */
+	CARD32	maxBufferSize B32;	/* maximum buffer size requested */
+} xPrintGetDocumentDataReq;
+#define sz_xPrintGetDocumentDataReq	12
+
+typedef struct {
+	BYTE	type;			/* X_Reply */
+	CARD8	unused;			/* not used */
+	CARD16	sequenceNumber B16;
+	CARD32	length B32;
+	CARD32	statusCode B32;		/* status code for reply */
+	CARD32	finishedFlag B32;	/* is this the last reply */
+	CARD32	dataLen B32;		/* data length */
+	CARD32	pad1 B32;
+	CARD32	pad2 B32;
+	CARD32	pad3 B32;
+
+	/* variable portion *****************************************
+	LISTofBYTE	data;		 * data *
+	BYTE		pad(count)	 * unused *
+	************************************************************/
+} xPrintGetDocumentDataReply;
+#define sz_xPrintGetDocumentDataReply	32
+
+
+typedef struct _PrintStartPage {
+	CARD8	reqType;		/* always PrintReqCode */
+	CARD8	printReqType;		/* always X_PrintStartPage */
+	CARD16	length B16;
+	WINDOW	window B32;		/* window */
+} xPrintStartPageReq;
+#define sz_xPrintStartPageReq		8
+
+typedef struct _PrintEndPage {
+	CARD8	reqType;		/* always PrintReqCode */
+	CARD8	printReqType;		/* always X_PrintEndPage */
+	CARD16	length B16;
+	BOOL	cancel;			/* cancel boolean */
+	CARD8	pad1;
+	CARD16	pad2 B16;
+} xPrintEndPageReq;
+#define sz_xPrintEndPageReq		8
+
+
+typedef struct _PrintSelectInput {
+        CARD8   reqType;        	/* always PrintReqCode */
+	CARD8   printReqType;		/* always X_PrintSelectInput */
+	CARD16	length B16;
+	PCONTEXT printContext B32;	/* print context */
+	BITMASK	eventMask B32;
+} xPrintSelectInputReq;
+#define sz_xPrintSelectInputReq		12
+
+
+typedef struct _PrintInputSelected {
+        CARD8   reqType;        	/* always PrintReqCode */
+	CARD8   printReqType;		/* always X_PrintInputSelected */
+	CARD16	length B16;
+	PCONTEXT printContext B32;	/* print context */
+} xPrintInputSelectedReq;
+#define sz_xPrintInputSelectedReq	8
+
+typedef struct {
+	BYTE	type;			/* X_Reply */
+	CARD8	unused;			/* not used */
+	CARD16	sequenceNumber B16;
+	CARD32	length B32;
+	BITMASK	eventMask B32;		/* your event mask */
+	BITMASK	allEventsMask B32;	/* all event mask */
+	CARD32	pad1 B32;
+	CARD32	pad2 B32;
+	CARD32	pad3 B32;
+	CARD32	pad4 B32;
+} xPrintInputSelectedReply;
+#define sz_xPrintInputSelectedReply	32
+
+typedef struct _PrintGetAttributes {
+        CARD8   reqType;        	/* always PrintReqCode */
+	CARD8   printReqType;		/* always X_PrintGetAttributes */
+	CARD16	length B16;
+	PCONTEXT printContext B32;	/* print context */
+        CARD8   type;			/* type */
+        CARD8   pad1;			/* unused */
+        CARD16  pad2 B16;		/* unused */
+} xPrintGetAttributesReq;
+#define sz_xPrintGetAttributesReq	12
+
+typedef struct {
+	BYTE	type;			/* X_Reply */
+	CARD8	unused;			/* not used */
+	CARD16	sequenceNumber B16;
+	CARD32	length B32;
+	CARD32	stringLen B32;		/* length of xrm db string */
+	CARD32	pad1 B32;
+	CARD32	pad2 B32;
+	CARD32	pad3 B32;
+	CARD32	pad4 B32;
+	CARD32	pad5 B32;
+
+        /* variable portion *****************************************
+	STRING8	string;                  * xrm db as a string *
+	BYTE	pad(stringLen)           * unused *
+        ************************************************************/
+} xPrintGetAttributesReply;
+#define sz_xPrintGetAttributesReply	32
+
+
+typedef struct _PrintSetAttributes {
+        CARD8   reqType;        	/* always PrintReqCode */
+	CARD8   printReqType;		/* always X_PrintSetAttributes */
+	CARD16	length B16;
+	PCONTEXT printContext B32;	/* print context */
+	CARD32	stringLen B32;		/* length of xrm db string */
+        CARD8   type;                   /* type */
+	CARD8   rule;			/* replacement rule */
+	CARD16  pad1 B16;		/* unused */
+
+        /* variable portion *****************************************
+	STRING8	string;                  * xrm db as a string *
+	BYTE	pad(stringLen)           * unused *
+        ************************************************************/
+} xPrintSetAttributesReq;
+#define sz_xPrintSetAttributesReq	16
+
+
+typedef struct _PrintGetOneAttribute {
+        CARD8   reqType;        	/* always PrintReqCode */
+	CARD8   printReqType;		/* always X_PrintGetOneAttribute */
+	CARD16	length B16;
+	PCONTEXT printContext B32;	/* print context */
+	CARD32	nameLen;		/* length of name string */
+        CARD8   type;			/* type */
+        CARD8   pad1;			/* unused */
+        CARD16  pad2 B16;		/* unused */
+
+        /* variable portion *****************************************
+	STRING8	name;			 * name as a string *
+	BYTE	pad(name)		 * unused *
+        ************************************************************/
+} xPrintGetOneAttributeReq;
+#define sz_xPrintGetOneAttributeReq	16
+
+typedef struct {
+	BYTE	type;			/* X_Reply */
+	CARD8	unused;			/* not used */
+	CARD16	sequenceNumber B16;
+	CARD32	length B32;
+	CARD32	valueLen B32;		/* length of value string */
+	CARD32	pad1 B32;
+	CARD32	pad2 B32;
+	CARD32	pad3 B32;
+	CARD32	pad4 B32;
+	CARD32	pad5 B32;
+
+        /* variable portion *****************************************
+	STRING8	value;			 * value as a string *
+	BYTE	pad(value)		 * unused *
+        ************************************************************/
+} xPrintGetOneAttributeReply;
+#define sz_xPrintGetOneAttributeReply	32
+
+
+typedef struct _PrintGetPageDimensions {
+	CARD8	reqType;		/* always PrintReqCode */
+	CARD8	printReqType;		/* always X_PrintGetPageDimensions */
+	CARD16	length B16;
+	PCONTEXT printContext B32;	/* print context */
+} xPrintGetPageDimensionsReq;
+#define sz_xPrintGetPageDimensionsReq	8
+
+typedef struct {
+	BYTE	type;			/* X_Reply */
+	CARD8	unused;			/* not used */
+	CARD16	sequenceNumber B16;
+	CARD32	length B32;
+	CARD16	width;			/* total pixel width */
+	CARD16	height;			/* total pixel height */
+	CARD16	rx;			/* reproducable x pixel offset */
+	CARD16	ry;			/* reproducable y pixel offset */
+	CARD16	rwidth;			/* reproducable x pixel width */
+	CARD16	rheight;		/* reproducable y pixel width */
+	CARD32	pad1 B32;
+	CARD32	pad2 B32;
+	CARD32	pad3 B32;
+} xPrintGetPageDimensionsReply;
+#define sz_xPrintGetPageDimensionsReply	32
+
+
+typedef struct _PrintQueryScreens {
+	CARD8	reqType;		/* always PrintReqCode */
+	CARD8	printReqType;		/* always X_PrintQueryScreens */
+	CARD16	length B16;
+} xPrintQueryScreensReq;
+#define sz_xPrintQueryScreensReq	4
+
+typedef struct {
+	BYTE	type;			/* X_Reply */
+	CARD8	unused;			/* not used */
+	CARD16	sequenceNumber B16;
+	CARD32	length B32;
+	CARD32	listCount;		/* number of screens following */
+	CARD32	pad1 B32;
+	CARD32	pad2 B32;
+	CARD32	pad3 B32;
+	CARD32	pad4 B32;
+	CARD32	pad5 B32;
+
+        /* variable portion *****************************************
+	WINDOW	rootWindow;		 * root window of screen *
+        ************************************************************/
+} xPrintQueryScreensReply;
+#define sz_xPrintQueryScreensReply	32
+
+typedef struct _PrintSetImageResolution {
+	CARD8	reqType;		/* always PrintReqCode */
+	CARD8	printReqType;		/* always X_PrintSetImageResolution */
+	CARD16	length B16;
+	PCONTEXT printContext B32;	/* print context */
+	CARD16 imageRes B16;		/* image resolution */
+	CARD16 pad1 B16;
+} xPrintSetImageResolutionReq;
+#define sz_xPrintSetImageResolutionReq	12
+
+typedef struct {
+	BYTE	type;			/* X_Reply */
+	BOOL	status;			/* accepted or not */
+	CARD16	sequenceNumber B16;
+	CARD32	length B32;
+	CARD16	prevRes B16;		/* previous resolution */
+	CARD16	pad1 B32;
+	CARD32	pad2 B32;
+	CARD32	pad3 B32;
+	CARD32	pad4 B32;
+	CARD32	pad5 B32;
+	CARD32	pad6 B32;
+} xPrintSetImageResolutionReply;
+#define sz_xPrintSetImageResolutionReply 32
+
+typedef struct _PrintGetImageResolution {
+	CARD8	reqType;		/* always PrintReqCode */
+	CARD8	printReqType;		/* always X_PrintGetImageResolution */
+	CARD16	length B16;
+	PCONTEXT printContext B32;	/* print context */
+} xPrintGetImageResolutionReq;
+#define sz_xPrintGetImageResolutionReq	8
+
+typedef struct {
+	BYTE	type;			/* X_Reply */
+	CARD8	unused;
+	CARD16	sequenceNumber B16;
+	CARD32	length B32;
+	CARD16	imageRes B16;		/* image resolution */
+	CARD16	pad1 B32;
+	CARD32	pad2 B32;
+	CARD32	pad3 B32;
+	CARD32	pad4 B32;
+	CARD32	pad5 B32;
+	CARD32	pad6 B32;
+} xPrintGetImageResolutionReply;
+#define sz_xPrintGetImageResolutionReply 32
+
+#ifndef _XP_PRINT_SERVER_
+/***********************************************************************
+ *
+ * Library-only definitions.
+ */
+extern XPHinterProc  _xp_hinter_proc;
+extern char         *_xp_hinter_desc;
+extern int           _xp_hinter_init;
+
+#else /* _XP_PRINT_SERVER_ */
+
+/***********************************************************************
+ *
+ * Server-only definitions shared between the extension and DDX layers.
+ *
+ */
+
+/*
+ * Internal return code used to indicate that the requesting
+ * client has been suspended.
+ */
+#define Suspended 84
+
+struct _XpContext;
+
+extern void XpRegisterPrinterScreen(
+    ScreenPtr pScreen,
+    int (*CreateContext)(struct _XpContext *));
+
+typedef struct _xpprintFuncs {
+    int (*StartJob)(
+	struct _XpContext *	/* pContext */,
+	Bool			/* sendClientData */,
+	ClientPtr		/* client */);
+    int (*EndJob)(struct _XpContext *, int);
+    int (*StartDoc)(
+	struct _XpContext *	/* pContext */,
+	XPDocumentType		/* type */);
+    int (*EndDoc)(struct _XpContext *, int);
+    int (*StartPage)(
+	struct _XpContext *	/* pContext */,
+	WindowPtr		/* pWin */);
+    int (*EndPage)(
+	struct _XpContext *	/* pContext */,
+	WindowPtr		/* pWin */);
+    int (*PutDocumentData)(
+	struct _XpContext *	/* pContext */,
+	DrawablePtr		/* pDraw */,
+	char *			/* pData */,
+	int			/* len_data */,
+	char *			/* pDoc_fmt */,
+	int			/* len_fmt */,
+	char *			/* pOptions */,
+	int			/* len_options */,
+	ClientPtr		/* client */);
+    int (*GetDocumentData)(
+	struct _XpContext *	/* pContext */,
+	ClientPtr		/* client */,
+	int			/* maxBufferSize */);
+    int (*DestroyContext)(
+	struct _XpContext *);	/* pContext */
+    char *(*GetAttributes)(
+	struct _XpContext *,
+	XPAttributes 		/* pool */);
+    char *(*GetOneAttribute)(
+	struct _XpContext *	/* pContext */,
+	XPAttributes 		/* pool */,
+	char *			/* attrs */);
+    int (*SetAttributes)(
+	struct _XpContext *	/* pContext */,
+	XPAttributes 		/* pool */,
+	char *			/* attrs */);
+    int (*AugmentAttributes)(
+	struct _XpContext *	/* pContext */,
+	XPAttributes 		/* pool */,
+	char *			/* attrs */);
+    int (*GetMediumDimensions)(
+	struct _XpContext *	/* pPrintContext */,
+	CARD16 *		/* pWidth */,
+	CARD16 *		/* pHeight */);
+    int (*GetReproducibleArea)(
+	struct _XpContext *	/* pPrintContext */,
+	xRectangle *		/* pRect */);
+    int (*SetImageResolution)(
+	struct _XpContext *	/* pPrintContext */,
+	int			/* imageRes */,
+	Bool *			/* pStatus */);
+} XpDriverFuncs, *XpDriverFuncsPtr;
+
+/*
+ * Each print context is represented by one of the following structs
+ * associated with a resource ID of type RTcontext .  A pointer to
+ * the context is placed in the Xp extension's devPrivates
+ * element in each client * which establishes a context via
+ * either initContext or setContext.
+ * The context pointer is also placed in the struct indicated by the
+ * RTpage resource associated with each StartPage'd window.
+ */
+typedef struct _XpContext {
+        XID contextID;
+        char *printerName;
+        int screenNum;          /* screen containing the printer */
+        struct _XpClient *clientHead; /* list of clients */
+        CARD32 state;
+        VisualID pageWin;
+        DevUnion *devPrivates;
+        XpDriverFuncs funcs;
+	ClientPtr clientSlept;
+	int imageRes;
+} XpContextRec, *XpContextPtr;
+
+#include <X11/fonts/fontstruct.h>	/* FontResolutionPtr */
+
+extern Bool XpAllocateContextPrivate(int, unsigned);
+extern FontResolutionPtr XpGetClientResolutions(ClientPtr, int *);
+extern XpContextPtr XpContextOfClient(ClientPtr);
+extern XpContextPtr XpGetPrintContext(ClientPtr);
+extern int XpAllocateContextPrivateIndex(void);
+extern int XpRehashPrinterList(void);
+extern void XpSetFontResFunc(ClientPtr);
+extern void XpUnsetFontResFunc(ClientPtr);
+extern void XpRegisterInitFunc(ScreenPtr, char *, int (*)(struct _XpContext *));
+
+#endif /* _XP_PRINT_SERVER_ */
+
+_XFUNCPROTOEND
+
+#endif /* _XpPrintstr_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/XEVI.h b/ThirdParty/X11/Include/X11/extensions/XEVI.h
new file mode 100644
index 0000000000000000000000000000000000000000..9ca441200cdb8cce3f253b6182fc5c47e8deb20a
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XEVI.h
@@ -0,0 +1,61 @@
+/************************************************************
+Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+********************************************************/
+
+#ifndef _XEVI_H_
+#define _XEVI_H_
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/EVI.h>
+
+typedef struct {
+    VisualID		core_visual_id;
+    int			screen;
+    int			level;
+    unsigned int	transparency_type;
+    unsigned int	transparency_value;
+    unsigned int	min_hw_colormaps;
+    unsigned int	max_hw_colormaps;
+    unsigned int	num_colormap_conflicts;
+    VisualID*		colormap_conflicts;
+} ExtendedVisualInfo;
+
+_XFUNCPROTOBEGIN
+
+Bool XeviQueryExtension(
+    Display*            /* dpy */
+);
+Status XeviQueryVersion(
+    Display*		/* dpy */,
+    int*		/* majorVersion */,
+    int*		/* minorVersion */
+);
+Status XeviGetVisualInfo(
+    Display*		 	/* dpy */,
+    VisualID*			/* visual_query */,
+    int				/* nVisual_query */,
+    ExtendedVisualInfo**	/* extendedVisualInfo_return */,
+    int*			/* nInfo_return */
+);
+
+_XFUNCPROTOEND
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/XI.h b/ThirdParty/X11/Include/X11/extensions/XI.h
new file mode 100644
index 0000000000000000000000000000000000000000..7b443997ca4d315b7e89e16453d3c37193af525c
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XI.h
@@ -0,0 +1,308 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+			All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+
+/* Definitions used by the server, library and client */
+
+#ifndef _XI_H_
+#define _XI_H_
+
+#define sz_xGetExtensionVersionReq             8
+#define sz_xGetExtensionVersionReply           32
+#define sz_xListInputDevicesReq			4
+#define sz_xListInputDevicesReply		32
+#define sz_xOpenDeviceReq			8
+#define sz_xOpenDeviceReply			32
+#define sz_xCloseDeviceReq			8
+#define sz_xSetDeviceModeReq			8
+#define sz_xSetDeviceModeReply			32
+#define sz_xSelectExtensionEventReq		12
+#define sz_xGetSelectedExtensionEventsReq	8
+#define sz_xGetSelectedExtensionEventsReply	32
+#define sz_xChangeDeviceDontPropagateListReq	12
+#define sz_xGetDeviceDontPropagateListReq	8
+#define sz_xGetDeviceDontPropagateListReply	32
+#define sz_xGetDeviceMotionEventsReq		16
+#define sz_xGetDeviceMotionEventsReply		32
+#define sz_xChangeKeyboardDeviceReq		8
+#define sz_xChangeKeyboardDeviceReply		32
+#define sz_xChangePointerDeviceReq		8
+#define sz_xChangePointerDeviceReply		32
+#define sz_xGrabDeviceReq			20
+#define sz_xGrabDeviceReply			32
+#define sz_xUngrabDeviceReq			12
+#define sz_xGrabDeviceKeyReq			20
+#define sz_xGrabDeviceKeyReply			32
+#define sz_xUngrabDeviceKeyReq			16
+#define sz_xGrabDeviceButtonReq			20
+#define sz_xGrabDeviceButtonReply		32
+#define sz_xUngrabDeviceButtonReq		16
+#define sz_xAllowDeviceEventsReq		12
+#define sz_xGetDeviceFocusReq			8
+#define sz_xGetDeviceFocusReply			32
+#define sz_xSetDeviceFocusReq			16
+#define sz_xGetFeedbackControlReq		8
+#define sz_xGetFeedbackControlReply		32
+#define sz_xChangeFeedbackControlReq		12
+#define sz_xGetDeviceKeyMappingReq		8
+#define sz_xGetDeviceKeyMappingReply		32
+#define sz_xChangeDeviceKeyMappingReq		8
+#define sz_xGetDeviceModifierMappingReq		8
+#define sz_xSetDeviceModifierMappingReq		8
+#define sz_xSetDeviceModifierMappingReply	32
+#define sz_xGetDeviceButtonMappingReq		8
+#define sz_xGetDeviceButtonMappingReply		32
+#define sz_xSetDeviceButtonMappingReq		8
+#define sz_xSetDeviceButtonMappingReply		32
+#define sz_xQueryDeviceStateReq			8
+#define sz_xQueryDeviceStateReply		32
+#define sz_xSendExtensionEventReq		16
+#define sz_xDeviceBellReq			8
+#define sz_xSetDeviceValuatorsReq		8
+#define sz_xSetDeviceValuatorsReply		32
+#define sz_xGetDeviceControlReq			8
+#define sz_xGetDeviceControlReply		32
+#define sz_xChangeDeviceControlReq		8
+#define sz_xChangeDeviceControlReply		32
+#define sz_xListDevicePropertiesReq             8
+#define sz_xListDevicePropertiesReply           32
+#define sz_xChangeDevicePropertyReq             20
+#define sz_xDeleteDevicePropertyReq             12
+#define sz_xGetDevicePropertyReq                24
+#define sz_xGetDevicePropertyReply              32
+
+#define INAME		"XInputExtension"
+
+#define XI_KEYBOARD	"KEYBOARD"
+#define XI_MOUSE	"MOUSE"
+#define XI_TABLET	"TABLET"
+#define XI_TOUCHSCREEN	"TOUCHSCREEN"
+#define XI_TOUCHPAD	"TOUCHPAD"
+#define XI_BARCODE	"BARCODE"
+#define XI_BUTTONBOX	"BUTTONBOX"
+#define XI_KNOB_BOX	"KNOB_BOX"
+#define XI_ONE_KNOB	"ONE_KNOB"
+#define XI_NINE_KNOB	"NINE_KNOB"
+#define XI_TRACKBALL	"TRACKBALL"
+#define XI_QUADRATURE	"QUADRATURE"
+#define XI_ID_MODULE	"ID_MODULE"
+#define XI_SPACEBALL	"SPACEBALL"
+#define XI_DATAGLOVE	"DATAGLOVE"
+#define XI_EYETRACKER	"EYETRACKER"
+#define XI_CURSORKEYS	"CURSORKEYS"
+#define XI_FOOTMOUSE	"FOOTMOUSE"
+#define XI_JOYSTICK	"JOYSTICK"
+
+/* Indices into the versions[] array (XExtInt.c). Used as a index to
+ * retrieve the minimum version of XI from _XiCheckExtInit */
+#define Dont_Check			0
+#define XInput_Initial_Release		1
+#define XInput_Add_XDeviceBell		2
+#define XInput_Add_XSetDeviceValuators	3
+#define XInput_Add_XChangeDeviceControl	4
+#define XInput_Add_DevicePresenceNotify	5
+#define XInput_Add_DeviceProperties	6
+/* DO NOT ADD TO HERE -> XI2 */
+
+#define XI_Absent		0
+#define XI_Present		1
+
+#define XI_Initial_Release_Major		1
+#define XI_Initial_Release_Minor		0
+
+#define XI_Add_XDeviceBell_Major		1
+#define XI_Add_XDeviceBell_Minor		1
+
+#define XI_Add_XSetDeviceValuators_Major	1
+#define XI_Add_XSetDeviceValuators_Minor	2
+
+#define XI_Add_XChangeDeviceControl_Major	1
+#define XI_Add_XChangeDeviceControl_Minor	3
+
+#define XI_Add_DevicePresenceNotify_Major	1
+#define XI_Add_DevicePresenceNotify_Minor	4
+
+#define XI_Add_DeviceProperties_Major		1
+#define XI_Add_DeviceProperties_Minor		5
+
+#define DEVICE_RESOLUTION	1
+#define DEVICE_ABS_CALIB        2
+#define DEVICE_CORE             3
+#define DEVICE_ENABLE           4
+#define DEVICE_ABS_AREA         5
+
+#define NoSuchExtension		1
+
+#define COUNT			0
+#define CREATE			1
+
+#define NewPointer		0
+#define NewKeyboard		1
+
+#define XPOINTER		0
+#define XKEYBOARD		1
+
+#define UseXKeyboard		0xFF
+
+#define IsXPointer		0
+#define IsXKeyboard		1
+#define IsXExtensionDevice	2
+#define IsXExtensionKeyboard    3
+#define IsXExtensionPointer     4
+
+#define AsyncThisDevice		0
+#define SyncThisDevice		1
+#define ReplayThisDevice	2
+#define AsyncOtherDevices	3
+#define AsyncAll		4
+#define SyncAll			5
+
+#define FollowKeyboard 		3
+#ifndef RevertToFollowKeyboard
+#define RevertToFollowKeyboard 	3
+#endif
+
+#define DvAccelNum              (1L << 0)
+#define DvAccelDenom            (1L << 1)
+#define DvThreshold             (1L << 2)
+
+#define DvKeyClickPercent	(1L<<0)
+#define DvPercent		(1L<<1)
+#define DvPitch			(1L<<2)
+#define DvDuration		(1L<<3)
+#define DvLed			(1L<<4)
+#define DvLedMode		(1L<<5)
+#define DvKey			(1L<<6)
+#define DvAutoRepeatMode	(1L<<7)
+
+#define DvString                (1L << 0)
+
+#define DvInteger               (1L << 0)
+
+#define DeviceMode              (1L << 0)
+#define Relative                0
+#define Absolute                1
+
+#define ProximityState          (1L << 1)
+#define InProximity             (0L << 1)
+#define OutOfProximity          (1L << 1)
+
+#define AddToList               0
+#define DeleteFromList          1
+
+#define KeyClass  		0
+#define ButtonClass  		1
+#define ValuatorClass  		2
+#define FeedbackClass  		3
+#define ProximityClass  	4
+#define FocusClass  		5
+#define OtherClass  		6
+#define AttachClass             7
+
+#define KbdFeedbackClass  	0
+#define PtrFeedbackClass  	1
+#define StringFeedbackClass  	2
+#define IntegerFeedbackClass  	3
+#define LedFeedbackClass  	4
+#define BellFeedbackClass  	5
+
+#define _devicePointerMotionHint 0
+#define _deviceButton1Motion	 1
+#define _deviceButton2Motion	 2
+#define _deviceButton3Motion	 3
+#define _deviceButton4Motion	 4
+#define _deviceButton5Motion	 5
+#define _deviceButtonMotion	 6
+#define _deviceButtonGrab	 7
+#define _deviceOwnerGrabButton	 8
+#define _noExtensionEvent	 9
+
+#define _devicePresence		 0
+
+#define _deviceEnter             0
+#define _deviceLeave             1
+
+/* Device presence notify states */
+#define DeviceAdded              0
+#define DeviceRemoved            1
+#define DeviceEnabled            2
+#define DeviceDisabled           3
+#define DeviceUnrecoverable      4
+#define DeviceControlChanged     5
+
+/* XI Errors */
+#define XI_BadDevice	0
+#define XI_BadEvent	1
+#define XI_BadMode	2
+#define XI_DeviceBusy	3
+#define XI_BadClass	4
+
+/*
+ * Make XEventClass be a CARD32 for 64 bit servers.  Don't affect client
+ * definition of XEventClass since that would be a library interface change.
+ * See the top of X.h for more _XSERVER64 magic.
+ *
+ * But, don't actually use the CARD32 type.  We can't get it defined here
+ * without polluting the namespace.
+ */
+#ifdef _XSERVER64
+typedef	unsigned int	XEventClass;
+#else
+typedef	unsigned long	XEventClass;
+#endif
+
+/*******************************************************************
+ *
+ * Extension version structure.
+ *
+ */
+
+typedef struct {
+        int   	present;
+        short	major_version;
+        short	minor_version;
+} XExtensionVersion;
+
+#endif /* _XI_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/XI2.h b/ThirdParty/X11/Include/X11/extensions/XI2.h
new file mode 100644
index 0000000000000000000000000000000000000000..5a1c66a949479979a5266bf5c9aa9650e91139b7
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XI2.h
@@ -0,0 +1,245 @@
+/*
+ * Copyright © 2009 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef _XI2_H_
+#define _XI2_H_
+
+#define XInput_2_0                              7
+/* DO NOT ADD TO THIS LIST. These are libXi-specific defines.
+   See commit libXi-1.4.2-21-ge8531dd */
+
+#define XI_2_Major                              2
+#define XI_2_Minor                              3
+
+/* Property event flags */
+#define XIPropertyDeleted                       0
+#define XIPropertyCreated                       1
+#define XIPropertyModified                      2
+
+/* Property modes */
+#define XIPropModeReplace                       0
+#define XIPropModePrepend                       1
+#define XIPropModeAppend                        2
+
+/* Special property type used for XIGetProperty */
+#define XIAnyPropertyType                       0L
+
+/* Enter/Leave and Focus In/Out modes */
+#define XINotifyNormal                          0
+#define XINotifyGrab                            1
+#define XINotifyUngrab                          2
+#define XINotifyWhileGrabbed                    3
+#define XINotifyPassiveGrab                     4
+#define XINotifyPassiveUngrab                   5
+
+/* Enter/Leave and focus In/out detail */
+#define XINotifyAncestor                        0
+#define XINotifyVirtual                         1
+#define XINotifyInferior                        2
+#define XINotifyNonlinear                       3
+#define XINotifyNonlinearVirtual                4
+#define XINotifyPointer                         5
+#define XINotifyPointerRoot                     6
+#define XINotifyDetailNone                      7
+
+/* Grab modes */
+#define XIGrabModeSync                          0
+#define XIGrabModeAsync                         1
+#define XIGrabModeTouch                         2
+
+/* Grab reply status codes */
+#define XIGrabSuccess                           0
+#define XIAlreadyGrabbed                        1
+#define XIGrabInvalidTime                       2
+#define XIGrabNotViewable                       3
+#define XIGrabFrozen                            4
+
+/* Grab owner events values */
+#define XIOwnerEvents                           True
+#define XINoOwnerEvents                         False
+
+/* Passive grab types */
+#define XIGrabtypeButton                        0
+#define XIGrabtypeKeycode                       1
+#define XIGrabtypeEnter                         2
+#define XIGrabtypeFocusIn                       3
+#define XIGrabtypeTouchBegin                    4
+
+/* Passive grab modifier */
+#define XIAnyModifier                           (1U << 31)
+#define XIAnyButton                             0
+#define XIAnyKeycode                            0
+
+/* XIAllowEvents event-modes */
+#define XIAsyncDevice                           0
+#define XISyncDevice                            1
+#define XIReplayDevice                          2
+#define XIAsyncPairedDevice                     3
+#define XIAsyncPair                             4
+#define XISyncPair                              5
+#define XIAcceptTouch                           6
+#define XIRejectTouch                           7
+
+/* DeviceChangedEvent change reasons */
+#define XISlaveSwitch                           1
+#define XIDeviceChange                          2
+
+/* Hierarchy flags */
+#define XIMasterAdded                           (1 << 0)
+#define XIMasterRemoved                         (1 << 1)
+#define XISlaveAdded                            (1 << 2)
+#define XISlaveRemoved                          (1 << 3)
+#define XISlaveAttached                         (1 << 4)
+#define XISlaveDetached                         (1 << 5)
+#define XIDeviceEnabled                         (1 << 6)
+#define XIDeviceDisabled                        (1 << 7)
+
+/* ChangeHierarchy constants */
+#define XIAddMaster                             1
+#define XIRemoveMaster                          2
+#define XIAttachSlave                           3
+#define XIDetachSlave                           4
+
+#define XIAttachToMaster                        1
+#define XIFloating                              2
+
+/* Valuator modes */
+#define XIModeRelative                          0
+#define XIModeAbsolute                          1
+
+/* Device types */
+#define XIMasterPointer                         1
+#define XIMasterKeyboard                        2
+#define XISlavePointer                          3
+#define XISlaveKeyboard                         4
+#define XIFloatingSlave                         5
+
+/* Device classes: classes that are not identical to Xi 1.x classes must be
+ * numbered starting from 8. */
+#define XIKeyClass                              0
+#define XIButtonClass                           1
+#define XIValuatorClass                         2
+#define XIScrollClass                           3
+#define XITouchClass                            8
+
+/* Scroll class types */
+#define XIScrollTypeVertical                    1
+#define XIScrollTypeHorizontal                  2
+
+/* Scroll class flags */
+#define XIScrollFlagNoEmulation                 (1 << 0)
+#define XIScrollFlagPreferred                   (1 << 1)
+
+/* Device event flags (common) */
+/* Device event flags (key events only) */
+#define XIKeyRepeat                             (1 << 16)
+/* Device event flags (pointer events only) */
+#define XIPointerEmulated                       (1 << 16)
+/* Device event flags (touch events only) */
+#define XITouchPendingEnd                       (1 << 16)
+#define XITouchEmulatingPointer                 (1 << 17)
+
+/* Barrier event flags */
+#define XIBarrierPointerReleased                (1 << 0)
+#define XIBarrierDeviceIsGrabbed                (1 << 1)
+
+
+/* Touch modes */
+#define XIDirectTouch                           1
+#define XIDependentTouch                        2
+
+/* XI2 event mask macros */
+#define XISetMask(ptr, event)   (((unsigned char*)(ptr))[(event)>>3] |=  (1 << ((event) & 7)))
+#define XIClearMask(ptr, event) (((unsigned char*)(ptr))[(event)>>3] &= ~(1 << ((event) & 7)))
+#define XIMaskIsSet(ptr, event) (((unsigned char*)(ptr))[(event)>>3] &   (1 << ((event) & 7)))
+#define XIMaskLen(event)        (((event) >> 3) + 1)
+
+/* Fake device ID's for event selection */
+#define XIAllDevices                            0
+#define XIAllMasterDevices                      1
+
+/* Event types */
+#define XI_DeviceChanged                 1
+#define XI_KeyPress                      2
+#define XI_KeyRelease                    3
+#define XI_ButtonPress                   4
+#define XI_ButtonRelease                 5
+#define XI_Motion                        6
+#define XI_Enter                         7
+#define XI_Leave                         8
+#define XI_FocusIn                       9
+#define XI_FocusOut                      10
+#define XI_HierarchyChanged              11
+#define XI_PropertyEvent                 12
+#define XI_RawKeyPress                   13
+#define XI_RawKeyRelease                 14
+#define XI_RawButtonPress                15
+#define XI_RawButtonRelease              16
+#define XI_RawMotion                     17
+#define XI_TouchBegin                    18 /* XI 2.2 */
+#define XI_TouchUpdate                   19
+#define XI_TouchEnd                      20
+#define XI_TouchOwnership                21
+#define XI_RawTouchBegin                 22
+#define XI_RawTouchUpdate                23
+#define XI_RawTouchEnd                   24
+#define XI_BarrierHit                    25 /* XI 2.3 */
+#define XI_BarrierLeave                  26
+#define XI_LASTEVENT                     XI_BarrierLeave
+/* NOTE: XI2LASTEVENT in xserver/include/inputstr.h must be the same value
+ * as XI_LASTEVENT if the server is supposed to handle masks etc. for this
+ * type of event. */
+
+/* Event masks.
+ * Note: the protocol spec defines a mask to be of (1 << type). Clients are
+ * free to create masks by bitshifting instead of using these defines.
+ */
+#define XI_DeviceChangedMask             (1 << XI_DeviceChanged)
+#define XI_KeyPressMask                  (1 << XI_KeyPress)
+#define XI_KeyReleaseMask                (1 << XI_KeyRelease)
+#define XI_ButtonPressMask               (1 << XI_ButtonPress)
+#define XI_ButtonReleaseMask             (1 << XI_ButtonRelease)
+#define XI_MotionMask                    (1 << XI_Motion)
+#define XI_EnterMask                     (1 << XI_Enter)
+#define XI_LeaveMask                     (1 << XI_Leave)
+#define XI_FocusInMask                   (1 << XI_FocusIn)
+#define XI_FocusOutMask                  (1 << XI_FocusOut)
+#define XI_HierarchyChangedMask          (1 << XI_HierarchyChanged)
+#define XI_PropertyEventMask             (1 << XI_PropertyEvent)
+#define XI_RawKeyPressMask               (1 << XI_RawKeyPress)
+#define XI_RawKeyReleaseMask             (1 << XI_RawKeyRelease)
+#define XI_RawButtonPressMask            (1 << XI_RawButtonPress)
+#define XI_RawButtonReleaseMask          (1 << XI_RawButtonRelease)
+#define XI_RawMotionMask                 (1 << XI_RawMotion)
+#define XI_TouchBeginMask                (1 << XI_TouchBegin)
+#define XI_TouchEndMask                  (1 << XI_TouchEnd)
+#define XI_TouchOwnershipChangedMask     (1 << XI_TouchOwnership)
+#define XI_TouchUpdateMask               (1 << XI_TouchUpdate)
+#define XI_RawTouchBeginMask             (1 << XI_RawTouchBegin)
+#define XI_RawTouchEndMask               (1 << XI_RawTouchEnd)
+#define XI_RawTouchUpdateMask            (1 << XI_RawTouchUpdate)
+#define XI_BarrierHitMask                (1 << XI_BarrierHit)
+#define XI_BarrierLeaveMask              (1 << XI_BarrierLeave)
+
+#endif /* _XI2_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/XI2proto.h b/ThirdParty/X11/Include/X11/extensions/XI2proto.h
new file mode 100644
index 0000000000000000000000000000000000000000..4cdaa0dfb23536d10661619df7a8ae07a2aa8a50
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XI2proto.h
@@ -0,0 +1,1091 @@
+/*
+ * Copyright © 2009 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+/* Conventions for this file:
+ * Names:
+ * structs: always typedef'd, prefixed with xXI, CamelCase
+ * struct members: lower_case_with_underscores
+ *        Exceptions: reqType, ReqType, repType, RepType, sequenceNumber are
+ *        named as such for historical reasons.
+ * request opcodes: X_XIRequestName as CamelCase
+ * defines: defines used in client applications must go in XI2.h
+ *          defines used only in protocol handling: XISOMENAME
+ *
+ * Data types: unless there is a historical name for a datatype (e.g.
+ * Window), use stdint types specifying the size of the datatype.
+ * historical data type names must be defined and undefined at the top and
+ * end of the file.
+ *
+ * General:
+ * spaces, not tabs.
+ * structs specific to a request or reply added before the request
+ *      definition. structs used in more than one request, reply or event
+ *      appended to the common structs section before the definition of the
+ *      first request.
+ * members of structs vertically aligned on column 16 if datatypes permit.
+ *      otherwise alingned on next available 8n column.
+ */
+
+/**
+ * Protocol definitions for the XI2 protocol.
+ * This file should not be included by clients that merely use XI2, but do not
+ * need the wire protocol. Such clients should include XI2.h, or the matching
+ * header from the library.
+ *
+ */
+#ifndef _XI2PROTO_H_
+#define _XI2PROTO_H_
+
+#include <X11/Xproto.h>
+#include <X11/X.h>
+#include <X11/extensions/XI2.h>
+#include <stdint.h>
+
+/* make sure types have right sizes for protocol structures. */
+#define Window  uint32_t
+#define Time    uint32_t
+#define Atom    uint32_t
+#define Cursor  uint32_t
+#define Barrier uint32_t
+
+/**
+ * XI2 Request opcodes
+ */
+#define X_XIQueryPointer                40
+#define X_XIWarpPointer                 41
+#define X_XIChangeCursor                42
+#define X_XIChangeHierarchy             43
+#define X_XISetClientPointer            44
+#define X_XIGetClientPointer            45
+#define X_XISelectEvents                46
+#define X_XIQueryVersion                47
+#define X_XIQueryDevice                 48
+#define X_XISetFocus                    49
+#define X_XIGetFocus                    50
+#define X_XIGrabDevice                  51
+#define X_XIUngrabDevice                52
+#define X_XIAllowEvents                 53
+#define X_XIPassiveGrabDevice           54
+#define X_XIPassiveUngrabDevice         55
+#define X_XIListProperties              56
+#define X_XIChangeProperty              57
+#define X_XIDeleteProperty              58
+#define X_XIGetProperty                 59
+#define X_XIGetSelectedEvents           60
+#define X_XIBarrierReleasePointer       61
+
+/** Number of XI requests */
+#define XI2REQUESTS (X_XIBarrierReleasePointer - X_XIQueryPointer + 1)
+/** Number of XI2 events */
+#define XI2EVENTS   (XI_LASTEVENT + 1)
+
+/*************************************************************************************
+ *                                                                                   *
+ *                               COMMON STRUCTS                                      *
+ *                                                                                   *
+ *************************************************************************************/
+/** Fixed point 16.16 */
+typedef int32_t FP1616;
+
+/** Fixed point 32.32 */
+typedef struct {
+    int32_t     integral;
+    uint32_t    frac;
+} FP3232;
+
+/**
+ * Struct to describe a device.
+ *
+ * For a MasterPointer or a MasterKeyboard, 'attachment' specifies the
+ * paired master device.
+ * For a SlaveKeyboard or SlavePointer, 'attachment' specifies the master
+ * device this device is attached to.
+ * For a FloatingSlave, 'attachment' is undefined.
+ */
+typedef struct {
+    uint16_t    deviceid;
+    uint16_t    use;            /**< ::XIMasterPointer, ::XIMasterKeyboard,
+                                     ::XISlavePointer, ::XISlaveKeyboard,
+                                     ::XIFloatingSlave */
+    uint16_t    attachment;     /**< Current attachment or pairing.*/
+    uint16_t    num_classes;    /**< Number of classes following this struct. */
+    uint16_t    name_len;       /**< Length of name in bytes. */
+    uint8_t     enabled;        /**< TRUE if device is enabled. */
+    uint8_t     pad;
+} xXIDeviceInfo;
+
+/**
+ * Default template for a device class.
+ * A device class is equivalent to a device's capabilities. Multiple classes
+ * are supported per device.
+ */
+typedef struct {
+    uint16_t    type;           /**< One of *class */
+    uint16_t    length;         /**< Length in 4 byte units */
+    uint16_t    sourceid;       /**< source device for this class */
+    uint16_t    pad;
+} xXIAnyInfo;
+
+/**
+ * Denotes button capability on a device.
+ * Struct is followed by num_buttons * Atom that names the buttons in the
+ * device-native setup (i.e. ignoring button mappings).
+ */
+typedef struct {
+    uint16_t    type;           /**< Always ButtonClass */
+    uint16_t    length;         /**< Length in 4 byte units */
+    uint16_t    sourceid;       /**< source device for this class */
+    uint16_t    num_buttons;    /**< Number of buttons provided */
+} xXIButtonInfo;
+
+/**
+ * Denotes key capability on a device.
+ * Struct is followed by num_keys * CARD32 that lists the keycodes available
+ * on the device.
+ */
+typedef struct {
+    uint16_t    type;           /**< Always KeyClass */
+    uint16_t    length;         /**< Length in 4 byte units */
+    uint16_t    sourceid;       /**< source device for this class */
+    uint16_t    num_keycodes;   /**< Number of keys provided */
+} xXIKeyInfo;
+
+/**
+ * Denotes an valuator capability on a device.
+ * One XIValuatorInfo describes exactly one valuator (axis) on the device.
+ */
+typedef struct {
+    uint16_t    type;           /**< Always ValuatorClass       */
+    uint16_t    length;         /**< Length in 4 byte units */
+    uint16_t    sourceid;       /**< source device for this class */
+    uint16_t    number;         /**< Valuator number            */
+    Atom        label;          /**< Axis label                 */
+    FP3232      min;            /**< Min value                  */
+    FP3232      max;            /**< Max value                  */
+    FP3232      value;          /**< Last published value       */
+    uint32_t    resolution;     /**< Resolutions in units/m     */
+    uint8_t     mode;           /**< ModeRelative or ModeAbsolute */
+    uint8_t     pad1;
+    uint16_t    pad2;
+} xXIValuatorInfo;
+
+/***
+ * Denotes a scroll valuator on a device.
+ * One XIScrollInfo describes exactly one scroll valuator that must have a
+ * XIValuatorInfo struct.
+ */
+typedef struct {
+    uint16_t    type;           /**< Always ValuatorClass         */
+    uint16_t    length;         /**< Length in 4 byte units       */
+    uint16_t    sourceid;       /**< source device for this class */
+    uint16_t    number;         /**< Valuator number              */
+    uint16_t    scroll_type;    /**< ::XIScrollTypeVertical, ::XIScrollTypeHorizontal */
+    uint16_t    pad0;
+    uint32_t    flags;          /**< ::XIScrollFlagEmulate, ::XIScrollFlagPreferred   */
+    FP3232      increment;      /**< Increment for one unit of scrolling              */
+} xXIScrollInfo;
+
+/**
+ * Denotes multitouch capability on a device.
+ */
+typedef struct {
+    uint16_t    type;           /**< Always TouchClass */
+    uint16_t    length;         /**< Length in 4 byte units */
+    uint16_t    sourceid;       /**< source device for this class */
+    uint8_t     mode;           /**< DirectTouch or DependentTouch */
+    uint8_t     num_touches;    /**< Maximum number of touches (0==unlimited) */
+} xXITouchInfo;
+
+/**
+ * Used to select for events on a given window.
+ * Struct is followed by (mask_len * CARD8), with each bit set representing
+ * the event mask for the given type. A mask bit represents an event type if
+ * (mask == (1 << type)).
+ */
+typedef struct {
+    uint16_t    deviceid;       /**< Device id to select for        */
+    uint16_t    mask_len;       /**< Length of mask in 4 byte units */
+} xXIEventMask;
+
+/**
+ * XKB modifier information.
+ * The effective modifier is a binary mask of base, latched, and locked
+ * modifiers.
+ */
+typedef struct
+{
+    uint32_t    base_mods;              /**< Logically pressed modifiers */
+    uint32_t    latched_mods;           /**< Logically latched modifiers */
+    uint32_t    locked_mods;            /**< Logically locked modifiers */
+    uint32_t    effective_mods;         /**< Effective modifiers */
+} xXIModifierInfo;
+
+/**
+ * XKB group information.
+ * The effective group is the mathematical sum of base, latched, and locked
+ * group after group wrapping is taken into account.
+ */
+typedef struct
+{
+    uint8_t     base_group;             /**< Logically "pressed" group */
+    uint8_t     latched_group;          /**< Logically latched group */
+    uint8_t     locked_group;           /**< Logically locked group */
+    uint8_t     effective_group;        /**< Effective group */
+} xXIGroupInfo;
+
+
+/*************************************************************************************
+ *                                                                                   *
+ *                                   REQUESTS                                        *
+ *                                                                                   *
+ *************************************************************************************/
+
+/**
+ * Query the server for the supported X Input extension version.
+ */
+
+typedef struct {
+    uint8_t     reqType;                /**< Input extension major code */
+    uint8_t     ReqType;                /**< Always ::X_XIQueryVersion */
+    uint16_t    length;                 /**< Length in 4 byte units */
+    uint16_t    major_version;
+    uint16_t    minor_version;
+} xXIQueryVersionReq;
+#define sz_xXIQueryVersionReq                     8
+
+typedef struct {
+    uint8_t     repType;                /**< ::X_Reply */
+    uint8_t     RepType;                /**< Always ::X_XIQueryVersion */
+    uint16_t    sequenceNumber;
+    uint32_t    length;
+    uint16_t    major_version;
+    uint16_t    minor_version;
+    uint32_t    pad1;
+    uint32_t    pad2;
+    uint32_t    pad3;
+    uint32_t    pad4;
+    uint32_t    pad5;
+} xXIQueryVersionReply;
+#define sz_xXIQueryVersionReply             32
+
+/**
+ * Query the server for information about a specific device or all input
+ * devices.
+ */
+typedef struct {
+    uint8_t     reqType;                /**< Input extension major code */
+    uint8_t     ReqType;                /**< Always ::X_XIQueryDevice */
+    uint16_t    length;                 /**< Length in 4 byte units */
+    uint16_t    deviceid;
+    uint16_t    pad;
+} xXIQueryDeviceReq;
+#define sz_xXIQueryDeviceReq                    8
+
+typedef struct {
+    uint8_t     repType;                /**< ::X_Reply */
+    uint8_t     RepType;                /**< Always ::X_XIQueryDevice */
+    uint16_t    sequenceNumber;
+    uint32_t    length;
+    uint16_t    num_devices;
+    uint16_t    pad0;
+    uint32_t    pad1;
+    uint32_t    pad2;
+    uint32_t    pad3;
+    uint32_t    pad4;
+    uint32_t    pad5;
+} xXIQueryDeviceReply;
+#define sz_xXIQueryDeviceReply                  32
+
+/**
+ * Select for events on a given window.
+ */
+typedef struct {
+    uint8_t     reqType;                /**< Input extension major code */
+    uint8_t     ReqType;                /**< Always ::X_XISelectEvents */
+    uint16_t    length;                 /**< Length in 4 byte units */
+    Window      win;
+    uint16_t    num_masks;
+    uint16_t    pad;
+} xXISelectEventsReq;
+#define sz_xXISelectEventsReq                  12
+
+/**
+ * Query for selected events on a given window.
+ */
+typedef struct {
+    uint8_t     reqType;                /**< Input extension major code */
+    uint8_t     ReqType;                /**< Always ::X_XIGetSelectedEvents */
+    uint16_t    length;                 /**< Length in 4 byte units */
+    Window      win;
+} xXIGetSelectedEventsReq;
+#define sz_xXIGetSelectedEventsReq              8
+
+typedef struct {
+    uint8_t     repType;                /**< Input extension major opcode */
+    uint8_t     RepType;                /**< Always ::X_XIGetSelectedEvents */
+    uint16_t    sequenceNumber;
+    uint32_t    length;
+    uint16_t    num_masks;              /**< Number of xXIEventMask structs
+                                             trailing the reply */
+    uint16_t    pad0;
+    uint32_t    pad1;
+    uint32_t    pad2;
+    uint32_t    pad3;
+    uint32_t    pad4;
+    uint32_t    pad5;
+} xXIGetSelectedEventsReply;
+#define sz_xXIGetSelectedEventsReply            32
+
+/**
+ * Query the given device's screen/window coordinates.
+ */
+
+typedef struct {
+    uint8_t     reqType;                /**< Input extension major code */
+    uint8_t     ReqType;                /**< Always ::X_XIQueryPointer */
+    uint16_t    length;                 /**< Length in 4 byte units */
+    Window      win;
+    uint16_t    deviceid;
+    uint16_t    pad1;
+} xXIQueryPointerReq;
+#define sz_xXIQueryPointerReq                   12
+
+
+typedef struct {
+    uint8_t     repType;                /**< Input extension major opcode */
+    uint8_t     RepType;                /**< Always ::X_XIQueryPointer */
+    uint16_t    sequenceNumber;
+    uint32_t    length;
+    Window      root;
+    Window      child;
+    FP1616      root_x;
+    FP1616      root_y;
+    FP1616      win_x;
+    FP1616      win_y;
+    uint8_t     same_screen;
+    uint8_t     pad0;
+    uint16_t    buttons_len;
+    xXIModifierInfo mods;
+    xXIGroupInfo group;
+} xXIQueryPointerReply;
+#define sz_xXIQueryPointerReply                 56
+
+/**
+ * Warp the given device's pointer to the specified position.
+ */
+
+typedef struct {
+    uint8_t     reqType;                /**< Input extension major code */
+    uint8_t     ReqType;                /**< Always ::X_XIWarpPointer   */
+    uint16_t    length;                 /**< Length in 4 byte units */
+    Window      src_win;
+    Window      dst_win;
+    FP1616      src_x;
+    FP1616      src_y;
+    uint16_t    src_width;
+    uint16_t    src_height;
+    FP1616      dst_x;
+    FP1616      dst_y;
+    uint16_t    deviceid;
+    uint16_t    pad1;
+} xXIWarpPointerReq;
+#define sz_xXIWarpPointerReq                    36
+
+/**
+ * Change the given device's sprite to the given cursor.
+ */
+
+typedef struct {
+    uint8_t     reqType;                /**< Input extension major code */
+    uint8_t     ReqType;                /**< Always ::X_XIChangeCursor  */
+    uint16_t    length;                 /**< Length in 4 byte units */
+    Window      win;
+    Cursor      cursor;
+    uint16_t    deviceid;
+    uint16_t    pad1;
+} xXIChangeCursorReq;
+#define sz_xXIChangeCursorReq                           16
+
+/**
+ * Modify the device hierarchy.
+ */
+
+typedef struct {
+    uint8_t     reqType;                /**< Input extension major code */
+    uint8_t     ReqType;                /**< Always ::X_XIChangeHierarchy */
+    uint16_t    length;                 /**< Length in 4 byte units */
+    uint8_t     num_changes;
+    uint8_t     pad0;
+    uint16_t    pad1;
+} xXIChangeHierarchyReq;
+#define sz_xXIChangeHierarchyReq                        8
+
+/**
+ * Generic header for any hierarchy change.
+ */
+typedef struct {
+    uint16_t    type;
+    uint16_t    length;                 /**< Length in 4 byte units */
+} xXIAnyHierarchyChangeInfo;
+
+/**
+ * Create a new master device.
+ * Name of new master follows struct (4-byte padded)
+ */
+typedef struct {
+    uint16_t    type;                   /**< Always ::XIAddMaster */
+    uint16_t    length;                 /**< 2 + (namelen + padding)/4 */
+    uint16_t    name_len;
+    uint8_t     send_core;
+    uint8_t     enable;
+} xXIAddMasterInfo;
+
+/**
+ * Delete a master device. Will automatically delete the master device paired
+ * with the given master device.
+ */
+typedef struct {
+    uint16_t    type;            /**< Always ::XIRemoveMaster */
+    uint16_t    length;          /**< 3 */
+    uint16_t    deviceid;
+    uint8_t     return_mode;     /**< ::XIAttachToMaster, ::XIFloating */
+    uint8_t     pad;
+    uint16_t    return_pointer;  /**< Pointer to attach slave ptr devices to */
+    uint16_t    return_keyboard; /**< keyboard to attach slave keybd devices to*/
+} xXIRemoveMasterInfo;
+
+/**
+ * Attach an SD to a new device.
+ * NewMaster has to be of same type (pointer->pointer, keyboard->keyboard);
+ */
+typedef struct {
+    uint16_t    type;           /**< Always ::XIAttachSlave */
+    uint16_t    length;         /**< 2 */
+    uint16_t    deviceid;
+    uint16_t    new_master;     /**< id of new master device */
+} xXIAttachSlaveInfo;
+
+/**
+ * Detach an SD from its current master device.
+ */
+typedef struct {
+    uint16_t    type;           /**< Always ::XIDetachSlave */
+    uint16_t    length;         /**< 2 */
+    uint16_t    deviceid;
+    uint16_t    pad;
+} xXIDetachSlaveInfo;
+
+
+/**
+ * Set the window/client's ClientPointer.
+ */
+typedef struct {
+    uint8_t     reqType;
+    uint8_t     ReqType;                /**< Always ::X_XISetClientPointer */
+    uint16_t    length;                 /**< Length in 4 byte units */
+    Window      win;
+    uint16_t    deviceid;
+    uint16_t    pad1;
+} xXISetClientPointerReq;
+#define sz_xXISetClientPointerReq                 12
+
+/**
+ * Query the given window/client's ClientPointer setting.
+ */
+typedef struct {
+    uint8_t     reqType;
+    uint8_t     ReqType;                /**< Always ::X_GetClientPointer */
+    uint16_t    length;                 /**< Length in 4 byte units */
+    Window      win;
+} xXIGetClientPointerReq;
+#define sz_xXIGetClientPointerReq                 8
+
+typedef struct {
+    uint8_t     repType;                /**< Input extension major opcode */
+    uint8_t     RepType;                /**< Always ::X_GetClientPointer */
+    uint16_t    sequenceNumber;
+    uint32_t    length;
+    BOOL        set;                    /**< client pointer is set? */
+    uint8_t     pad0;
+    uint16_t    deviceid;
+    uint32_t    pad1;
+    uint32_t    pad2;
+    uint32_t    pad3;
+    uint32_t    pad4;
+    uint32_t    pad5;
+} xXIGetClientPointerReply;
+#define sz_xXIGetClientPointerReply               32
+
+/**
+ * Set the input focus to the specified window.
+ */
+typedef struct {
+    uint8_t     reqType;
+    uint8_t     ReqType;                /**< Always ::X_XISetFocus */
+    uint16_t    length;                 /**< Length in 4 byte units */
+    Window      focus;
+    Time        time;
+    uint16_t    deviceid;
+    uint16_t    pad0;
+} xXISetFocusReq;
+#define sz_xXISetFocusReq                       16
+
+/**
+ * Query the current input focus.
+ */
+typedef struct {
+    uint8_t     reqType;
+    uint8_t     ReqType;                /**< Always ::X_XIGetDeviceFocus */
+    uint16_t    length;                 /**< Length in 4 byte units */
+    uint16_t    deviceid;
+    uint16_t    pad0;
+} xXIGetFocusReq;
+#define sz_xXIGetFocusReq                       8
+
+typedef struct {
+    uint8_t     repType;                /**< Input extension major opcode */
+    uint8_t     RepType;                /**< Always ::X_XIGetFocus */
+    uint16_t    sequenceNumber;
+    uint32_t    length;
+    Window      focus;
+    uint32_t    pad1;
+    uint32_t    pad2;
+    uint32_t    pad3;
+    uint32_t    pad4;
+    uint32_t    pad5;
+} xXIGetFocusReply;
+#define sz_xXIGetFocusReply                     32
+
+
+/**
+ * Grab the given device.
+ */
+typedef struct {
+    uint8_t     reqType;
+    uint8_t     ReqType;                /**< Always ::X_XIGrabDevice */
+    uint16_t    length;                 /**< Length in 4 byte units */
+    Window      grab_window;
+    Time        time;
+    Cursor      cursor;
+    uint16_t    deviceid;
+    uint8_t     grab_mode;
+    uint8_t     paired_device_mode;
+    uint8_t     owner_events;
+    uint8_t     pad;
+    uint16_t    mask_len;
+} xXIGrabDeviceReq;
+#define sz_xXIGrabDeviceReq                     24
+
+/**
+ * Return codes from a XIPassiveGrabDevice request.
+ */
+typedef struct {
+    uint32_t    modifiers;              /**< Modifier state */
+    uint8_t     status;                 /**< Grab status code */
+    uint8_t     pad0;
+    uint16_t    pad1;
+} xXIGrabModifierInfo;
+
+typedef struct {
+    uint8_t     repType;                /**< Input extension major opcode */
+    uint8_t     RepType;                /**< Always ::X_XIGrabDevice */
+    uint16_t    sequenceNumber;
+    uint32_t    length;
+    uint8_t     status;
+    uint8_t     pad0;
+    uint16_t    pad1;
+    uint32_t    pad2;
+    uint32_t    pad3;
+    uint32_t    pad4;
+    uint32_t    pad5;
+    uint32_t    pad6;
+} xXIGrabDeviceReply;
+#define sz_xXIGrabDeviceReply                  32
+
+/**
+ * Ungrab the specified device.
+ *
+ */
+typedef struct {
+    uint8_t     reqType;
+    uint8_t     ReqType;                /**< Always ::X_XIUngrabDevice */
+    uint16_t    length;                 /**< Length in 4 byte units */
+    Time        time;
+    uint16_t    deviceid;
+    uint16_t    pad;
+} xXIUngrabDeviceReq;
+#define sz_xXIUngrabDeviceReq                   12
+
+
+/**
+ * Allow or replay events on the specified grabbed device.
+ */
+typedef struct {
+    uint8_t     reqType;
+    uint8_t     ReqType;                /**< Always ::X_XIAllowEvents */
+    uint16_t    length;                 /**< Length in 4 byte units */
+    Time        time;
+    uint16_t    deviceid;
+    uint8_t     mode;
+    uint8_t     pad;
+} xXIAllowEventsReq;
+#define sz_xXIAllowEventsReq                   12
+
+/**
+ * Allow or replay events on the specified grabbed device.
+ * Since XI 2.2
+ */
+typedef struct {
+    uint8_t     reqType;
+    uint8_t     ReqType;                /**< Always ::X_XIAllowEvents */
+    uint16_t    length;                 /**< Length in 4 byte units */
+    Time        time;
+    uint16_t    deviceid;
+    uint8_t     mode;
+    uint8_t     pad;
+    uint32_t    touchid;                /**< Since XI 2.2 */
+    Window      grab_window;            /**< Since XI 2.2 */
+} xXI2_2AllowEventsReq;
+#define sz_xXI2_2AllowEventsReq                20
+
+
+/**
+ * Passively grab the device.
+ */
+typedef struct {
+    uint8_t     reqType;
+    uint8_t     ReqType;                /**< Always ::X_XIPassiveGrabDevice */
+    uint16_t    length;                 /**< Length in 4 byte units */
+    Time        time;
+    Window      grab_window;
+    Cursor      cursor;
+    uint32_t    detail;
+    uint16_t    deviceid;
+    uint16_t    num_modifiers;
+    uint16_t    mask_len;
+    uint8_t     grab_type;
+    uint8_t     grab_mode;
+    uint8_t     paired_device_mode;
+    uint8_t     owner_events;
+    uint16_t    pad1;
+} xXIPassiveGrabDeviceReq;
+#define sz_xXIPassiveGrabDeviceReq              32
+
+typedef struct {
+    uint8_t     repType;                /**< Input extension major opcode */
+    uint8_t     RepType;                /**< Always ::X_XIPassiveGrabDevice */
+    uint16_t    sequenceNumber;
+    uint32_t    length;
+    uint16_t    num_modifiers;
+    uint16_t    pad1;
+    uint32_t    pad2;
+    uint32_t    pad3;
+    uint32_t    pad4;
+    uint32_t    pad5;
+    uint32_t    pad6;
+} xXIPassiveGrabDeviceReply;
+#define sz_xXIPassiveGrabDeviceReply            32
+
+/**
+ * Delete a passive grab for the given device.
+ */
+typedef struct {
+    uint8_t     reqType;
+    uint8_t     ReqType;                /**< Always ::X_XIPassiveUngrabDevice */
+    uint16_t    length;                 /**< Length in 4 byte units */
+    Window      grab_window;
+    uint32_t    detail;
+    uint16_t    deviceid;
+    uint16_t    num_modifiers;
+    uint8_t     grab_type;
+    uint8_t     pad0;
+    uint16_t    pad1;
+} xXIPassiveUngrabDeviceReq;
+#define sz_xXIPassiveUngrabDeviceReq            20
+
+/**
+ * List all device properties on the specified device.
+ */
+typedef struct {
+    uint8_t     reqType;
+    uint8_t     ReqType;                /**< Always ::X_XIListProperties */
+    uint16_t    length;                 /**< Length in 4 byte units */
+    uint16_t    deviceid;
+    uint16_t    pad;
+} xXIListPropertiesReq;
+#define sz_xXIListPropertiesReq                 8
+
+typedef struct {
+    uint8_t     repType;                /**< Input extension major opcode */
+    uint8_t     RepType;                /**< Always ::X_XIListProperties */
+    uint16_t    sequenceNumber;
+    uint32_t    length;
+    uint16_t    num_properties;
+    uint16_t    pad0;
+    uint32_t    pad1;
+    uint32_t    pad2;
+    uint32_t    pad3;
+    uint32_t    pad4;
+    uint32_t    pad5;
+} xXIListPropertiesReply;
+#define sz_xXIListPropertiesReply               32
+
+/**
+ * Change a property on the specified device.
+ */
+typedef struct {
+    uint8_t     reqType;
+    uint8_t     ReqType;                /**< Always ::X_XIChangeProperty */
+    uint16_t    length;                 /**< Length in 4 byte units */
+    uint16_t    deviceid;
+    uint8_t     mode;
+    uint8_t     format;
+    Atom        property;
+    Atom        type;
+    uint32_t    num_items;
+} xXIChangePropertyReq;
+#define sz_xXIChangePropertyReq                 20
+
+/**
+ * Delete the specified property.
+ */
+typedef struct {
+    uint8_t     reqType;
+    uint8_t     ReqType;                /**< Always X_XIDeleteProperty */
+    uint16_t    length;                 /**< Length in 4 byte units */
+    uint16_t    deviceid;
+    uint16_t    pad0;
+    Atom        property;
+} xXIDeletePropertyReq;
+#define sz_xXIDeletePropertyReq                 12
+
+/**
+ * Query the specified property's values.
+ */
+typedef struct {
+    uint8_t     reqType;
+    uint8_t     ReqType;                /**< Always X_XIGetProperty */
+    uint16_t    length;                 /**< Length in 4 byte units */
+    uint16_t    deviceid;
+#if defined(__cplusplus) || defined(c_plusplus)
+    uint8_t     c_delete;
+#else
+    uint8_t     delete;
+#endif
+    uint8_t     pad0;
+    Atom        property;
+    Atom        type;
+    uint32_t    offset;
+    uint32_t    len;
+} xXIGetPropertyReq;
+#define sz_xXIGetPropertyReq                    24
+
+typedef struct {
+    uint8_t     repType;                /**< Input extension major opcode */
+    uint8_t     RepType;                /**< Always X_XIGetProperty */
+    uint16_t    sequenceNumber;
+    uint32_t    length;
+    Atom        type;
+    uint32_t    bytes_after;
+    uint32_t    num_items;
+    uint8_t     format;
+    uint8_t     pad0;
+    uint16_t    pad1;
+    uint32_t    pad2;
+    uint32_t    pad3;
+} xXIGetPropertyReply;
+#define sz_xXIGetPropertyReply               32
+
+typedef struct {
+    uint16_t    deviceid;
+    uint16_t    pad;
+    Barrier     barrier;
+    uint32_t    eventid;
+} xXIBarrierReleasePointerInfo;
+
+typedef struct {
+    uint8_t     reqType;                /**< Input extension major opcode */
+    uint8_t     ReqType;                /**< Always X_XIBarrierReleasePointer */
+    uint16_t    length;
+    uint32_t    num_barriers;
+    /* array of xXIBarrierReleasePointerInfo */
+} xXIBarrierReleasePointerReq;
+#define sz_xXIBarrierReleasePointerReq       8
+
+/*************************************************************************************
+ *                                                                                   *
+ *                                      EVENTS                                       *
+ *                                                                                   *
+ *************************************************************************************/
+
+/**
+ * Generic XI2 event header. All XI2 events use the same header.
+ */
+typedef struct
+{
+    uint8_t     type;
+    uint8_t     extension;              /**< XI extension offset */
+    uint16_t    sequenceNumber;
+    uint32_t    length;
+    uint16_t    evtype;
+    uint16_t    deviceid;
+    Time        time;
+} xXIGenericDeviceEvent;
+
+/**
+ * Device hierarchy information.
+ */
+typedef struct
+{
+    uint16_t    deviceid;
+    uint16_t    attachment;             /**< ID of master or paired device */
+    uint8_t     use;                    /**< ::XIMasterKeyboard,
+                                             ::XIMasterPointer,
+                                             ::XISlaveKeyboard,
+                                             ::XISlavePointer,
+                                             ::XIFloatingSlave */
+    BOOL        enabled;                /**< TRUE if the device is enabled */
+    uint16_t    pad;
+    uint32_t    flags;                  /**< ::XIMasterAdded, ::XIMasterRemoved,
+                                             ::XISlaveAttached, ::XISlaveDetached,
+                                             ::XISlaveAdded, ::XISlaveRemoved,
+                                             ::XIDeviceEnabled, ::XIDeviceDisabled */
+} xXIHierarchyInfo;
+
+/**
+ * The device hierarchy has been modified. This event includes the device
+ * hierarchy after the modification has been applied.
+ */
+typedef struct
+{
+    uint8_t     type;                   /**< Always GenericEvent */
+    uint8_t     extension;              /**< XI extension offset */
+    uint16_t    sequenceNumber;
+    uint32_t    length;                 /**< Length in 4 byte units */
+    uint16_t    evtype;                 /**< ::XI_Hierarchy */
+    uint16_t    deviceid;
+    Time        time;
+    uint32_t    flags;                  /**< ::XIMasterAdded, ::XIMasterDeleted,
+                                             ::XISlaveAttached, ::XISlaveDetached,
+                                             ::XISlaveAdded, ::XISlaveRemoved,
+                                             ::XIDeviceEnabled, ::XIDeviceDisabled */
+    uint16_t    num_info;
+    uint16_t    pad0;
+    uint32_t    pad1;
+    uint32_t    pad2;
+} xXIHierarchyEvent;
+
+/**
+ * A device has changed capabilities.
+ */
+typedef struct
+{
+    uint8_t     type;                   /**< Always GenericEvent */
+    uint8_t     extension;              /**< XI extension offset */
+    uint16_t    sequenceNumber;
+    uint32_t    length;                 /**< Length in 4 byte units */
+    uint16_t    evtype;                 /**< XI_DeviceChanged */
+    uint16_t    deviceid;               /**< Device that has changed */
+    Time        time;
+    uint16_t    num_classes;            /**< Number of classes that have changed */
+    uint16_t    sourceid;               /**< Source of the new classes */
+    uint8_t     reason;                 /**< ::XISlaveSwitch, ::XIDeviceChange */
+    uint8_t     pad0;
+    uint16_t    pad1;
+    uint32_t    pad2;
+    uint32_t    pad3;
+} xXIDeviceChangedEvent;
+
+/**
+ * The owner of a touch stream has passed on ownership to another client.
+ */
+typedef struct
+{
+    uint8_t     type;               /**< Always GenericEvent */
+    uint8_t     extension;          /**< XI extension offset */
+    uint16_t    sequenceNumber;
+    uint32_t    length;             /**< Length in 4 byte units */
+    uint16_t    evtype;             /**< XI_TouchOwnership */
+    uint16_t    deviceid;           /**< Device that has changed */
+    Time        time;
+    uint32_t    touchid;
+    Window      root;
+    Window      event;
+    Window      child;
+/* └──────── 32 byte boundary ────────┘ */
+    uint16_t    sourceid;
+    uint16_t    pad0;
+    uint32_t    flags;
+    uint32_t    pad1;
+    uint32_t    pad2;
+} xXITouchOwnershipEvent;
+
+/**
+ * Default input event for pointer, keyboard or touch input.
+ */
+typedef struct
+{
+    uint8_t     type;                   /**< Always GenericEvent */
+    uint8_t     extension;              /**< XI extension offset */
+    uint16_t    sequenceNumber;
+    uint32_t    length;                 /**< Length in 4 byte uints */
+    uint16_t    evtype;
+    uint16_t    deviceid;
+    Time        time;
+    uint32_t    detail;                 /**< Keycode or button */
+    Window      root;
+    Window      event;
+    Window      child;
+/* └──────── 32 byte boundary ────────┘ */
+    FP1616      root_x;                 /**< Always screen coords, 16.16 fixed point */
+    FP1616      root_y;
+    FP1616      event_x;                /**< Always screen coords, 16.16 fixed point */
+    FP1616      event_y;
+    uint16_t    buttons_len;            /**< Len of button flags in 4 b units */
+    uint16_t    valuators_len;          /**< Len of val. flags in 4 b units */
+    uint16_t    sourceid;               /**< The source device */
+    uint16_t    pad0;
+    uint32_t    flags;                  /**< ::XIKeyRepeat */
+    xXIModifierInfo     mods;
+    xXIGroupInfo        group;
+} xXIDeviceEvent;
+
+
+/**
+ * Sent when an input event is generated. RawEvents include valuator
+ * information in both device-specific data (i.e. unaccelerated) and
+ * processed data (i.e. accelerated, if applicable).
+ */
+typedef struct
+{
+    uint8_t     type;                   /**< Always GenericEvent */
+    uint8_t     extension;              /**< XI extension offset */
+    uint16_t    sequenceNumber;
+    uint32_t    length;                 /**< Length in 4 byte uints */
+    uint16_t    evtype;                 /**< ::XI_RawEvent */
+    uint16_t    deviceid;
+    Time        time;
+    uint32_t    detail;
+    uint16_t    sourceid;               /**< The source device (XI 2.1) */
+    uint16_t    valuators_len;          /**< Length of trailing valuator
+                                             mask in 4 byte units */
+    uint32_t    flags;                  /**< ::XIKeyRepeat */
+    uint32_t    pad2;
+} xXIRawEvent;
+
+/**
+ * Note that the layout of root, event, child, root_x, root_y, event_x,
+ * event_y must be identical to the xXIDeviceEvent.
+ */
+typedef struct
+{
+    uint8_t     type;                   /**< Always GenericEvent */
+    uint8_t     extension;              /**< XI extension offset */
+    uint16_t    sequenceNumber;
+    uint32_t    length;                 /**< Length in 4 byte uints */
+    uint16_t    evtype;                 /**< ::XI_Enter */
+    uint16_t    deviceid;
+    Time        time;
+    uint16_t    sourceid;
+    uint8_t     mode;
+    uint8_t     detail;
+    Window      root;
+    Window      event;
+    Window      child;
+/* └──────── 32 byte boundary ────────┘ */
+    FP1616      root_x;
+    FP1616      root_y;
+    FP1616      event_x;
+    FP1616      event_y;
+    BOOL        same_screen;
+    BOOL        focus;
+    uint16_t    buttons_len;            /**< Length of trailing button mask
+                                             in 4 byte units */
+    xXIModifierInfo     mods;
+    xXIGroupInfo        group;
+} xXIEnterEvent;
+
+typedef xXIEnterEvent xXILeaveEvent;
+typedef xXIEnterEvent xXIFocusInEvent;
+typedef xXIEnterEvent xXIFocusOutEvent;
+
+/**
+ * Sent when a device property is created, modified or deleted. Does not
+ * include property data, the client is required to query the data.
+ */
+typedef struct
+{
+    uint8_t     type;                   /**< Always GenericEvent */
+    uint8_t     extension;              /**< XI extension offset */
+    uint16_t    sequenceNumber;
+    uint32_t    length;                 /**< Length in 4 byte units */
+    uint16_t    evtype;                 /**< ::XI_PropertyEvent */
+    uint16_t    deviceid;
+    Time        time;
+    Atom        property;
+    uint8_t     what;                   /**< ::XIPropertyDeleted,
+                                             ::XIPropertyCreated,
+                                             ::XIPropertyMotified */
+    uint8_t     pad0;
+    uint16_t    pad1;
+    uint32_t    pad2;
+    uint32_t    pad3;
+} xXIPropertyEvent;
+
+typedef struct
+{
+    uint8_t     type;                   /**< Always GenericEvent */
+    uint8_t     extension;              /**< XI extension offset */
+    uint16_t    sequenceNumber;
+    uint32_t    length;                 /**< Length in 4 byte units */
+    uint16_t    evtype;                 /**< ::XI_BarrierHit or ::XI_BarrierLeave */
+    uint16_t    deviceid;
+    Time        time;
+    uint32_t    eventid;
+    Window      root;
+    Window      event;
+    Barrier     barrier;
+/* └──────── 32 byte boundary ────────┘ */
+    uint32_t    dtime;
+    uint32_t    flags;                  /**< ::XIBarrierPointerReleased
+                                             ::XIBarrierDeviceIsGrabbed */
+    uint16_t    sourceid;
+    int16_t     pad;
+    FP1616      root_x;
+    FP1616      root_y;
+    FP3232      dx;
+    FP3232      dy;
+} xXIBarrierEvent;
+
+typedef xXIBarrierEvent xXIBarrierHitEvent;
+typedef xXIBarrierEvent xXIBarrierPointerReleasedEvent;
+typedef xXIBarrierEvent xXIBarrierLeaveEvent;
+
+#undef Window
+#undef Time
+#undef Atom
+#undef Cursor
+#undef Barrier
+
+#endif /* _XI2PROTO_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/XInput.h b/ThirdParty/X11/Include/X11/extensions/XInput.h
new file mode 100644
index 0000000000000000000000000000000000000000..b17f3884d887eaabccb17bf6a27295b4781ae19b
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XInput.h
@@ -0,0 +1,1277 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+			All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+
+/* Definitions used by the library and client */
+
+#ifndef _XINPUT_H_
+#define _XINPUT_H_
+
+#include <X11/Xlib.h>
+#include <X11/extensions/XI.h>
+
+#define _deviceKeyPress		0
+#define _deviceKeyRelease	1
+
+#define _deviceButtonPress	0
+#define _deviceButtonRelease	1
+
+#define _deviceMotionNotify	0
+
+#define _deviceFocusIn		0
+#define _deviceFocusOut		1
+
+#define _proximityIn		0
+#define _proximityOut		1
+
+#define _deviceStateNotify	0
+#define _deviceMappingNotify	1
+#define _changeDeviceNotify	2
+/* Space of 3 between is necessary! Reserved for DeviceKeyStateNotify,
+   DeviceButtonStateNotify, DevicePresenceNotify (essentially unused). This
+   code has to be in sync with FixExtensionEvents() in xserver/Xi/extinit.c */
+#define _propertyNotify		6
+
+#define FindTypeAndClass(d,type,_class,classid,offset) \
+    { int _i; XInputClassInfo *_ip; \
+    type = 0; _class = 0; \
+    for (_i=0, _ip= ((XDevice *) d)->classes; \
+	 _i< ((XDevice *) d)->num_classes; \
+	 _i++, _ip++) \
+	if (_ip->input_class == classid) \
+	    {type =  _ip->event_type_base + offset; \
+	     _class =  ((XDevice *) d)->device_id << 8 | type;}}
+
+#define DeviceKeyPress(d,type,_class) \
+    FindTypeAndClass(d, type, _class, KeyClass, _deviceKeyPress)
+
+#define DeviceKeyRelease(d,type,_class) \
+    FindTypeAndClass(d, type, _class, KeyClass, _deviceKeyRelease)
+
+#define DeviceButtonPress(d,type,_class) \
+    FindTypeAndClass(d, type, _class, ButtonClass, _deviceButtonPress)
+
+#define DeviceButtonRelease(d,type,_class) \
+    FindTypeAndClass(d, type, _class, ButtonClass, _deviceButtonRelease)
+
+#define DeviceMotionNotify(d,type,_class) \
+    FindTypeAndClass(d, type, _class, ValuatorClass, _deviceMotionNotify)
+
+#define DeviceFocusIn(d,type,_class) \
+    FindTypeAndClass(d, type, _class, FocusClass, _deviceFocusIn)
+
+#define DeviceFocusOut(d,type,_class) \
+    FindTypeAndClass(d, type, _class, FocusClass, _deviceFocusOut)
+
+#define ProximityIn(d,type,_class) \
+    FindTypeAndClass(d, type, _class, ProximityClass, _proximityIn)
+
+#define ProximityOut(d,type,_class) \
+    FindTypeAndClass(d, type, _class, ProximityClass, _proximityOut)
+
+#define DeviceStateNotify(d,type,_class) \
+    FindTypeAndClass(d, type, _class, OtherClass, _deviceStateNotify)
+
+#define DeviceMappingNotify(d,type,_class) \
+    FindTypeAndClass(d, type, _class, OtherClass, _deviceMappingNotify)
+
+#define ChangeDeviceNotify(d,type,_class) \
+    FindTypeAndClass(d, type, _class, OtherClass, _changeDeviceNotify)
+
+#define DevicePropertyNotify(d, type, _class) \
+    FindTypeAndClass(d, type, _class, OtherClass, _propertyNotify)
+
+#define DevicePointerMotionHint(d,type,_class) \
+    { _class =  ((XDevice *) d)->device_id << 8 | _devicePointerMotionHint;}
+
+#define DeviceButton1Motion(d,type,_class) \
+    { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton1Motion;}
+
+#define DeviceButton2Motion(d,type,_class) \
+    { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton2Motion;}
+
+#define DeviceButton3Motion(d,type,_class) \
+    { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton3Motion;}
+
+#define DeviceButton4Motion(d,type, _class) \
+    { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton4Motion;}
+
+#define DeviceButton5Motion(d,type,_class) \
+    { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton5Motion;}
+
+#define DeviceButtonMotion(d,type, _class) \
+    { _class =  ((XDevice *) d)->device_id << 8 | _deviceButtonMotion;}
+
+#define DeviceOwnerGrabButton(d,type,_class) \
+    { _class =  ((XDevice *) d)->device_id << 8 | _deviceOwnerGrabButton;}
+
+#define DeviceButtonPressGrab(d,type,_class) \
+    { _class =  ((XDevice *) d)->device_id << 8 | _deviceButtonGrab;}
+
+#define NoExtensionEvent(d,type,_class) \
+    { _class =  ((XDevice *) d)->device_id << 8 | _noExtensionEvent;}
+
+
+/* We need the declaration for DevicePresence. */
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+    extern int _XiGetDevicePresenceNotifyEvent(Display *);
+    extern void _xibaddevice( Display *dpy, int *error);
+    extern void _xibadclass( Display *dpy, int *error);
+    extern void _xibadevent( Display *dpy, int *error);
+    extern void _xibadmode( Display *dpy, int *error);
+    extern void _xidevicebusy( Display *dpy, int *error);
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#define DevicePresence(dpy, type, _class)                       \
+    {                                                           \
+        type = _XiGetDevicePresenceNotifyEvent(dpy);            \
+        _class =  (0x10000 | _devicePresence);                  \
+    }
+
+/* Errors */
+#define BadDevice(dpy,error) _xibaddevice(dpy, &error)
+
+#define BadClass(dpy,error) _xibadclass(dpy, &error)
+
+#define BadEvent(dpy,error) _xibadevent(dpy, &error)
+
+#define BadMode(dpy,error) _xibadmode(dpy, &error)
+
+#define DeviceBusy(dpy,error) _xidevicebusy(dpy, &error)
+
+typedef struct _XAnyClassinfo *XAnyClassPtr;
+
+/***************************************************************
+ *
+ * DeviceKey events.  These events are sent by input devices that
+ * support input class Keys.
+ * The location of the X pointer is reported in the coordinate
+ * fields of the x,y and x_root,y_root fields.
+ *
+ */
+
+typedef struct 
+    {
+    int            type;         /* of event */
+    unsigned long  serial;       /* # of last request processed */
+    Bool           send_event;   /* true if from SendEvent request */
+    Display        *display;     /* Display the event was read from */
+    Window         window;       /* "event" window reported relative to */
+    XID            deviceid;
+    Window         root;         /* root window event occured on */
+    Window         subwindow;    /* child window */
+    Time           time;         /* milliseconds */
+    int            x, y;         /* x, y coordinates in event window */
+    int            x_root;       /* coordinates relative to root */
+    int            y_root;       /* coordinates relative to root */
+    unsigned int   state;        /* key or button mask */
+    unsigned int   keycode;      /* detail */
+    Bool           same_screen;  /* same screen flag */
+    unsigned int   device_state; /* device key or button mask */
+    unsigned char  axes_count;
+    unsigned char  first_axis;
+    int            axis_data[6];
+    } XDeviceKeyEvent;
+
+typedef XDeviceKeyEvent XDeviceKeyPressedEvent;
+typedef XDeviceKeyEvent XDeviceKeyReleasedEvent;
+
+/*******************************************************************
+ *
+ * DeviceButton events.  These events are sent by extension devices
+ * that support input class Buttons.
+ *
+ */
+
+typedef struct {
+    int           type;         /* of event */
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    Window        window;       /* "event" window reported relative to */
+    XID           deviceid;
+    Window        root;         /* root window that the event occured on */
+    Window        subwindow;    /* child window */
+    Time          time;         /* milliseconds */
+    int           x, y;         /* x, y coordinates in event window */
+    int           x_root;       /* coordinates relative to root */
+    int           y_root;       /* coordinates relative to root */
+    unsigned int  state;        /* key or button mask */
+    unsigned int  button;       /* detail */
+    Bool          same_screen;  /* same screen flag */
+    unsigned int  device_state; /* device key or button mask */
+    unsigned char axes_count;
+    unsigned char first_axis;
+    int           axis_data[6];
+    } XDeviceButtonEvent;
+
+typedef XDeviceButtonEvent XDeviceButtonPressedEvent;
+typedef XDeviceButtonEvent XDeviceButtonReleasedEvent;
+
+/*******************************************************************
+ *
+ * DeviceMotionNotify event.  These events are sent by extension devices
+ * that support input class Valuators.
+ *
+ */
+
+typedef struct 
+    {
+    int           type;        /* of event */
+    unsigned long serial;      /* # of last request processed by server */
+    Bool          send_event;  /* true if from a SendEvent request */
+    Display       *display;    /* Display the event was read from */
+    Window        window;      /* "event" window reported relative to */
+    XID           deviceid;
+    Window        root;        /* root window that the event occured on */
+    Window        subwindow;   /* child window */
+    Time          time;        /* milliseconds */
+    int           x, y;        /* x, y coordinates in event window */
+    int           x_root;      /* coordinates relative to root */
+    int           y_root;      /* coordinates relative to root */
+    unsigned int  state;       /* key or button mask */
+    char          is_hint;     /* detail */
+    Bool          same_screen; /* same screen flag */
+    unsigned int  device_state; /* device key or button mask */
+    unsigned char axes_count;
+    unsigned char first_axis;
+    int           axis_data[6];
+    } XDeviceMotionEvent;
+
+/*******************************************************************
+ *
+ * DeviceFocusChange events.  These events are sent when the focus
+ * of an extension device that can be focused is changed.
+ *
+ */
+
+typedef struct 
+    {
+    int           type;       /* of event */
+    unsigned long serial;     /* # of last request processed by server */
+    Bool          send_event; /* true if from a SendEvent request */
+    Display       *display;   /* Display the event was read from */
+    Window        window;     /* "event" window reported relative to */
+    XID           deviceid;
+    int           mode;       /* NotifyNormal, NotifyGrab, NotifyUngrab */
+    int           detail;
+	/*
+	 * NotifyAncestor, NotifyVirtual, NotifyInferior, 
+	 * NotifyNonLinear,NotifyNonLinearVirtual, NotifyPointer,
+	 * NotifyPointerRoot, NotifyDetailNone 
+	 */
+    Time                time;
+    } XDeviceFocusChangeEvent;
+
+typedef XDeviceFocusChangeEvent XDeviceFocusInEvent;
+typedef XDeviceFocusChangeEvent XDeviceFocusOutEvent;
+
+/*******************************************************************
+ *
+ * ProximityNotify events.  These events are sent by those absolute
+ * positioning devices that are capable of generating proximity information.
+ *
+ */
+
+typedef struct 
+    {
+    int             type;      /* ProximityIn or ProximityOut */        
+    unsigned long   serial;    /* # of last request processed by server */
+    Bool            send_event; /* true if this came from a SendEvent request */
+    Display         *display;  /* Display the event was read from */
+    Window          window;      
+    XID	            deviceid;
+    Window          root;            
+    Window          subwindow;      
+    Time            time;            
+    int             x, y;            
+    int             x_root, y_root;  
+    unsigned int    state;           
+    Bool            same_screen;     
+    unsigned int    device_state; /* device key or button mask */
+    unsigned char   axes_count;
+    unsigned char   first_axis;
+    int             axis_data[6];
+    } XProximityNotifyEvent;
+typedef XProximityNotifyEvent XProximityInEvent;
+typedef XProximityNotifyEvent XProximityOutEvent;
+
+/*******************************************************************
+ *
+ * DeviceStateNotify events are generated on EnterWindow and FocusIn 
+ * for those clients who have selected DeviceState.
+ *
+ */
+
+typedef struct
+    {
+#if defined(__cplusplus) || defined(c_plusplus)
+    unsigned char	c_class;
+#else
+    unsigned char	class;
+#endif
+    unsigned char	length;
+    } XInputClass;
+
+typedef struct {
+    int           type;
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    Window        window;
+    XID           deviceid;
+    Time          time;
+    int           num_classes;
+    char	  data[64];
+} XDeviceStateNotifyEvent;	
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    unsigned char	c_class;
+#else
+    unsigned char	class;
+#endif
+    unsigned char	length;
+    unsigned char	num_valuators;
+    unsigned char	mode;
+    int        		valuators[6];
+} XValuatorStatus;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    unsigned char	c_class;
+#else
+    unsigned char	class;
+#endif
+    unsigned char	length;
+    short		num_keys;
+    char        	keys[32];
+} XKeyStatus;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    unsigned char	c_class;
+#else
+    unsigned char	class;
+#endif
+    unsigned char	length;
+    short		num_buttons;
+    char        	buttons[32];
+} XButtonStatus;
+
+/*******************************************************************
+ *
+ * DeviceMappingNotify event.  This event is sent when the key mapping,
+ * modifier mapping, or button mapping of an extension device is changed.
+ *
+ */
+
+typedef struct {
+    int           type;
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    Window        window;       /* unused */
+    XID           deviceid;
+    Time          time;
+    int           request;      /* one of MappingModifier, MappingKeyboard,
+                                    MappingPointer */
+    int           first_keycode;/* first keycode */
+    int           count;        /* defines range of change w. first_keycode*/
+} XDeviceMappingEvent;
+
+/*******************************************************************
+ *
+ * ChangeDeviceNotify event.  This event is sent when an 
+ * XChangeKeyboard or XChangePointer request is made.
+ *
+ */
+
+typedef struct {
+    int           type;
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    Window        window;       /* unused */
+    XID           deviceid;
+    Time          time;
+    int           request;      /* NewPointer or NewKeyboard */
+} XChangeDeviceNotifyEvent;
+
+/*******************************************************************
+ *
+ * DevicePresenceNotify event.  This event is sent when the list of
+ * input devices changes, in which case devchange will be false, and
+ * no information about the change will be contained in the event;
+ * the client should use XListInputDevices() to learn what has changed.
+ *
+ * If devchange is true, an attribute that the server believes is
+ * important has changed on a device, and the client should use
+ * XGetDeviceControl to examine the device.  If control is non-zero,
+ * then that control has changed meaningfully.
+ */
+
+typedef struct {
+    int           type;
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    Window        window;       /* unused */
+    Time          time;
+    Bool          devchange;
+    XID           deviceid;
+    XID           control;
+} XDevicePresenceNotifyEvent;
+
+/*
+ * Notifies the client that a property on a device has changed value. The
+ * client is expected to query the server for updated value of the property.
+ */
+typedef struct {
+    int           type;
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    Window        window;       /* unused */
+    Time          time;
+    XID           deviceid;     /* id of the device that changed */
+    Atom          atom;         /* the property that changed */
+    int           state;        /* PropertyNewValue or PropertyDeleted */
+} XDevicePropertyNotifyEvent;
+
+
+/*******************************************************************
+ *
+ * Control structures for input devices that support input class
+ * Feedback.  These are used by the XGetFeedbackControl and 
+ * XChangeFeedbackControl functions.
+ *
+ */
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+     XID            c_class;
+#else
+     XID            class;
+#endif
+     int            length;
+     XID            id;
+} XFeedbackState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     click;
+    int     percent;
+    int     pitch;
+    int     duration;
+    int     led_mask;
+    int     global_auto_repeat;
+    char    auto_repeats[32];
+} XKbdFeedbackState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     accelNum;
+    int     accelDenom;
+    int     threshold;
+} XPtrFeedbackState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     resolution;
+    int     minVal;
+    int     maxVal;
+} XIntegerFeedbackState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     max_symbols;
+    int     num_syms_supported;
+    KeySym  *syms_supported;
+} XStringFeedbackState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     percent;
+    int     pitch;
+    int     duration;
+} XBellFeedbackState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     led_values;
+    int     led_mask;
+} XLedFeedbackState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+     XID            c_class;
+#else
+     XID            class;
+#endif
+     int            length;
+     XID	    id;
+} XFeedbackControl;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     accelNum;
+    int     accelDenom;
+    int     threshold;
+} XPtrFeedbackControl;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     click;
+    int     percent;
+    int     pitch;
+    int     duration;
+    int     led_mask;
+    int     led_value;
+    int     key;
+    int     auto_repeat_mode;
+} XKbdFeedbackControl;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     num_keysyms;
+    KeySym  *syms_to_display;
+} XStringFeedbackControl;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     int_to_display;
+} XIntegerFeedbackControl;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     percent;
+    int     pitch;
+    int     duration;
+} XBellFeedbackControl;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     led_mask;
+    int     led_values;
+} XLedFeedbackControl;
+
+/*******************************************************************
+ *
+ * Device control structures.
+ *
+ */
+
+typedef struct {
+     XID            control;
+     int            length;
+} XDeviceControl;
+
+typedef struct {
+     XID            control;
+     int            length;
+     int            first_valuator;
+     int            num_valuators;
+     int            *resolutions;
+} XDeviceResolutionControl;
+
+typedef struct {
+     XID            control;
+     int            length;
+     int            num_valuators;
+     int            *resolutions;
+     int            *min_resolutions;
+     int            *max_resolutions;
+} XDeviceResolutionState;
+
+typedef struct {
+    XID             control;
+    int             length;
+    int             min_x;
+    int             max_x;
+    int             min_y;
+    int             max_y;
+    int             flip_x;
+    int             flip_y;
+    int             rotation;
+    int             button_threshold;
+} XDeviceAbsCalibControl, XDeviceAbsCalibState;
+
+typedef struct {
+    XID             control;
+    int             length;
+    int             offset_x;
+    int             offset_y;
+    int             width;
+    int             height;
+    int             screen;
+    XID             following;
+} XDeviceAbsAreaControl, XDeviceAbsAreaState;
+
+typedef struct {
+    XID             control;
+    int             length;
+    int             status;
+} XDeviceCoreControl;
+
+typedef struct {
+    XID             control;
+    int             length;
+    int             status;
+    int             iscore;
+} XDeviceCoreState;
+
+typedef struct {
+    XID             control;
+    int             length;
+    int             enable;
+} XDeviceEnableControl, XDeviceEnableState;
+
+/*******************************************************************
+ *
+ * An array of XDeviceList structures is returned by the 
+ * XListInputDevices function.  Each entry contains information
+ * about one input device.  Among that information is an array of 
+ * pointers to structures that describe the characteristics of 
+ * the input device.
+ *
+ */
+
+typedef struct _XAnyClassinfo {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID 	c_class;
+#else
+    XID 	class;
+#endif
+    int 	length;
+    } XAnyClassInfo;
+
+typedef struct _XDeviceInfo *XDeviceInfoPtr;
+
+typedef struct _XDeviceInfo
+    {
+    XID                 id;        
+    Atom                type;
+    char                *name;
+    int                 num_classes;
+    int                 use;
+    XAnyClassPtr 	inputclassinfo;
+    } XDeviceInfo;
+
+typedef struct _XKeyInfo *XKeyInfoPtr;
+
+typedef struct _XKeyInfo
+    {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID			c_class;
+#else
+    XID			class;
+#endif
+    int			length;
+    unsigned short      min_keycode;
+    unsigned short      max_keycode;
+    unsigned short      num_keys;
+    } XKeyInfo;
+
+typedef struct _XButtonInfo *XButtonInfoPtr;
+
+typedef struct _XButtonInfo {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID		c_class;
+#else
+    XID		class;
+#endif
+    int		length;
+    short 	num_buttons;
+    } XButtonInfo;
+
+typedef struct _XAxisInfo *XAxisInfoPtr;
+
+typedef struct _XAxisInfo {
+    int 	resolution;
+    int 	min_value;
+    int 	max_value;
+    } XAxisInfo;
+
+typedef struct _XValuatorInfo *XValuatorInfoPtr;
+
+typedef struct	_XValuatorInfo
+    {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID			c_class;
+#else
+    XID			class;
+#endif
+    int			length;
+    unsigned char       num_axes;
+    unsigned char       mode;
+    unsigned long       motion_buffer;
+    XAxisInfoPtr        axes;
+    } XValuatorInfo;
+
+/*******************************************************************
+ *
+ * An XDevice structure is returned by the XOpenDevice function.  
+ * It contains an array of pointers to XInputClassInfo structures.
+ * Each contains information about a class of input supported by the
+ * device, including a pointer to an array of data for each type of event
+ * the device reports.
+ *
+ */
+
+
+typedef struct {
+        unsigned char   input_class;
+        unsigned char   event_type_base;
+} XInputClassInfo;
+
+typedef struct {
+        XID                    device_id;
+        int                    num_classes;
+        XInputClassInfo        *classes;
+} XDevice;
+
+
+/*******************************************************************
+ *
+ * The following structure is used to return information for the 
+ * XGetSelectedExtensionEvents function.
+ *
+ */
+
+typedef struct {
+        XEventClass     event_type;
+        XID             device;
+} XEventList;
+
+/*******************************************************************
+ *
+ * The following structure is used to return motion history data from 
+ * an input device that supports the input class Valuators.
+ * This information is returned by the XGetDeviceMotionEvents function.
+ *
+ */
+
+typedef struct {
+        Time   time;
+        int    *data;
+} XDeviceTimeCoord;
+
+
+/*******************************************************************
+ *
+ * Device state structure.
+ * This is returned by the XQueryDeviceState request.
+ *
+ */
+
+typedef struct {
+        XID		device_id;
+        int		num_classes;
+        XInputClass	*data;
+} XDeviceState;
+
+/*******************************************************************
+ *
+ * Note that the mode field is a bitfield that reports the Proximity
+ * status of the device as well as the mode.  The mode field should
+ * be OR'd with the mask DeviceMode and compared with the values
+ * Absolute and Relative to determine the mode, and should be OR'd
+ * with the mask ProximityState and compared with the values InProximity
+ * and OutOfProximity to determine the proximity state.
+ *
+ */
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    unsigned char	c_class;
+#else
+    unsigned char	class;
+#endif
+    unsigned char	length;
+    unsigned char	num_valuators;
+    unsigned char	mode;
+    int        		*valuators;
+} XValuatorState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    unsigned char	c_class;
+#else
+    unsigned char	class;
+#endif
+    unsigned char	length;
+    short		num_keys;
+    char        	keys[32];
+} XKeyState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    unsigned char	c_class;
+#else
+    unsigned char	class;
+#endif
+    unsigned char	length;
+    short		num_buttons;
+    char        	buttons[32];
+} XButtonState;
+
+
+
+/*******************************************************************
+ *
+ * Function definitions.
+ *
+ */
+
+_XFUNCPROTOBEGIN
+
+extern int	XChangeKeyboardDevice(
+    Display*		/* display */,
+    XDevice*		/* device */
+);
+
+extern int	XChangePointerDevice(
+    Display*		/* display */,
+    XDevice*		/* device */,
+    int			/* xaxis */,
+    int			/* yaxis */
+);
+
+extern int	XGrabDevice(
+    Display*		/* display */,
+    XDevice*		/* device */,
+    Window		/* grab_window */,
+    Bool		/* ownerEvents */,
+    int			/* event count */,
+    XEventClass*	/* event_list */,
+    int			/* this_device_mode */,
+    int			/* other_devices_mode */,
+    Time		/* time */
+);
+
+extern int	XUngrabDevice(
+    Display*		/* display */,
+    XDevice*		/* device */,
+    Time 		/* time */
+);
+
+extern int	XGrabDeviceKey(
+    Display*		/* display */,
+    XDevice*		/* device */,
+    unsigned int	/* key */,
+    unsigned int	/* modifiers */,
+    XDevice*		/* modifier_device */,
+    Window		/* grab_window */,
+    Bool		/* owner_events */,
+    unsigned int	/* event_count */,
+    XEventClass*	/* event_list */,
+    int			/* this_device_mode */,
+    int			/* other_devices_mode */
+);
+
+extern int	XUngrabDeviceKey(
+    Display*		/* display */,
+    XDevice*		/* device */,
+    unsigned int	/* key */,
+    unsigned int	/* modifiers */,
+    XDevice*		/* modifier_dev */,
+    Window		/* grab_window */
+);
+
+extern int	XGrabDeviceButton(
+    Display*		/* display */,
+    XDevice*		/* device */,
+    unsigned int	/* button */,
+    unsigned int	/* modifiers */,
+    XDevice*		/* modifier_device */,
+    Window		/* grab_window */,
+    Bool		/* owner_events */,
+    unsigned int	/* event_count */,
+    XEventClass*	/* event_list */,
+    int			/* this_device_mode */,
+    int			/* other_devices_mode */
+);
+
+extern int	XUngrabDeviceButton(
+    Display*		/* display */,
+    XDevice*		/* device */,
+    unsigned int	/* button */,
+    unsigned int	/* modifiers */,
+    XDevice*		/* modifier_dev */,
+    Window		/* grab_window */
+);
+
+extern int	XAllowDeviceEvents(
+    Display*		/* display */,
+    XDevice*		/* device */,
+    int			/* event_mode */,
+    Time		/* time */
+);
+
+extern int	XGetDeviceFocus(
+    Display*		/* display */,
+    XDevice*		/* device */,
+    Window*		/* focus */,
+    int*		/* revert_to */,
+    Time*		/* time */
+);
+
+extern int	XSetDeviceFocus(
+    Display*		/* display */,
+    XDevice*		/* device */,
+    Window		/* focus */,
+    int			/* revert_to */,
+    Time		/* time */
+);
+
+extern XFeedbackState	*XGetFeedbackControl(
+    Display*		/* display */,
+    XDevice*		/* device */,
+    int*		/* num_feedbacks */
+);
+
+extern void	XFreeFeedbackList(
+    XFeedbackState*	/* list */
+);
+
+extern int	XChangeFeedbackControl(
+    Display*		/* display */,
+    XDevice*		/* device */,
+    unsigned long	/* mask */,
+    XFeedbackControl*	/* f */
+);
+
+extern int	XDeviceBell(
+    Display*		/* display */,
+    XDevice*		/* device */,
+    XID			/* feedbackclass */,
+    XID			/* feedbackid */,
+    int			/* percent */
+);
+
+extern KeySym	*XGetDeviceKeyMapping(
+    Display*		/* display */,
+    XDevice*		/* device */,
+#if NeedWidePrototypes
+    unsigned int	/* first */,
+#else
+    KeyCode		/* first */,
+#endif
+    int			/* keycount */,
+    int*		/* syms_per_code */
+);
+
+extern int	XChangeDeviceKeyMapping(
+    Display*		/* display */,
+    XDevice*		/* device */,
+    int			/* first */,
+    int			/* syms_per_code */,
+    KeySym*		/* keysyms */,
+    int			/* count */
+);
+
+extern XModifierKeymap	*XGetDeviceModifierMapping(
+    Display*		/* display */,
+    XDevice*		/* device */
+);
+
+extern int	XSetDeviceModifierMapping(
+    Display*		/* display */,
+    XDevice*		/* device */,
+    XModifierKeymap*	/* modmap */
+);
+
+extern int	XSetDeviceButtonMapping(
+    Display*		/* display */,
+    XDevice*		/* device */,
+    unsigned char*	/* map[] */,
+    int			/* nmap */
+);
+
+extern int	XGetDeviceButtonMapping(
+    Display*		/* display */,
+    XDevice*		/* device */,
+    unsigned char*	/* map[] */,
+    unsigned int	/* nmap */
+);
+
+extern XDeviceState	*XQueryDeviceState(
+    Display*		/* display */,
+    XDevice*		/* device */
+);
+
+extern void	XFreeDeviceState(
+    XDeviceState*	/* list */
+);
+
+extern XExtensionVersion	*XGetExtensionVersion(
+    Display*		/* display */,
+    _Xconst char*	/* name */
+);
+
+extern XDeviceInfo	*XListInputDevices(
+    Display*		/* display */,
+    int*		/* ndevices */
+);
+
+extern void	XFreeDeviceList(
+    XDeviceInfo*	/* list */
+);
+
+extern XDevice	*XOpenDevice(
+    Display*		/* display */,
+    XID			/* id */
+);
+
+extern int	XCloseDevice(
+    Display*		/* display */,
+    XDevice*		/* device */
+);
+
+extern int	XSetDeviceMode(
+    Display*		/* display */,
+    XDevice*		/* device */,
+    int			/* mode */
+);
+
+extern int	XSetDeviceValuators(
+    Display*		/* display */,
+    XDevice*		/* device */,
+    int*		/* valuators */,
+    int			/* first_valuator */,
+    int			/* num_valuators */
+);
+
+extern XDeviceControl	*XGetDeviceControl(
+    Display*		/* display */,
+    XDevice*		/* device */,
+    int			/* control */
+);
+
+extern int	XChangeDeviceControl(
+    Display*		/* display */,
+    XDevice*		/* device */,
+    int			/* control */,
+    XDeviceControl*	/* d */
+);
+
+extern int	XSelectExtensionEvent(
+    Display*		/* display */,
+    Window		/* w */,
+    XEventClass*	/* event_list */,
+    int			/* count */
+);
+
+extern int XGetSelectedExtensionEvents(
+    Display*		/* display */,
+    Window		/* w */,
+    int*		/* this_client_count */,
+    XEventClass**	/* this_client_list */,
+    int*		/* all_clients_count */,
+    XEventClass**	/* all_clients_list */
+);
+
+extern int	XChangeDeviceDontPropagateList(
+    Display*		/* display */,
+    Window		/* window */,
+    int			/* count */,
+    XEventClass*	/* events */,
+    int			/* mode */
+);
+
+extern XEventClass	*XGetDeviceDontPropagateList(
+    Display*		/* display */,
+    Window		/* window */,
+    int*		/* count */
+);
+
+extern Status	XSendExtensionEvent(
+    Display*		/* display */,
+    XDevice*		/* device */,
+    Window		/* dest */,
+    Bool		/* prop */,
+    int			/* count */,
+    XEventClass*	/* list */,
+    XEvent*		/* event */
+);
+
+extern XDeviceTimeCoord	*XGetDeviceMotionEvents(
+    Display*		/* display */,
+    XDevice*		/* device */,
+    Time		/* start */,
+    Time		/* stop */,
+    int*		/* nEvents */,
+    int*		/* mode */,
+    int*		/* axis_count */
+);
+
+extern void	XFreeDeviceMotionEvents(
+    XDeviceTimeCoord*	/* events */
+);
+
+extern void	XFreeDeviceControl(
+    XDeviceControl*	/* control */
+);
+
+extern Atom*   XListDeviceProperties(
+    Display*            /* dpy */,
+    XDevice*            /* dev */,
+    int*                /* nprops_return */
+);
+
+extern void XChangeDeviceProperty(
+    Display*            /* dpy */,
+    XDevice*            /* dev */,
+    Atom                /* property */,
+    Atom                /* type */,
+    int                 /* format */,
+    int                 /* mode */,
+    _Xconst unsigned char * /*data */,
+    int                 /* nelements */
+);
+
+extern void
+XDeleteDeviceProperty(
+    Display*            /* dpy */,
+    XDevice*            /* dev */,
+    Atom                /* property */
+);
+
+extern Status
+XGetDeviceProperty(
+     Display*           /* dpy*/,
+     XDevice*           /* dev*/,
+     Atom               /* property*/,
+     long               /* offset*/,
+     long               /* length*/,
+     Bool               /* delete*/,
+     Atom               /* req_type*/,
+     Atom*              /* actual_type*/,
+     int*               /* actual_format*/,
+     unsigned long*     /* nitems*/,
+     unsigned long*     /* bytes_after*/,
+     unsigned char**    /* prop*/
+);
+
+_XFUNCPROTOEND
+
+#endif /* _XINPUT_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/XInput2.h b/ThirdParty/X11/Include/X11/extensions/XInput2.h
new file mode 100644
index 0000000000000000000000000000000000000000..33670ebf20c10682c19e982884a75659e1cf96d4
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XInput2.h
@@ -0,0 +1,657 @@
+/*
+ * Copyright © 2009 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+/* Definitions used by the library and client */
+
+#ifndef _XINPUT2_H_
+#define _XINPUT2_H_
+
+#include <X11/Xlib.h>
+#include <X11/extensions/XI2.h>
+#include <X11/extensions/Xge.h>
+#include <X11/extensions/Xfixes.h> /* PointerBarrier */
+
+/*******************************************************************
+ *
+ */
+typedef struct {
+    int                 type;
+    char*               name;
+    Bool                send_core;
+    Bool                enable;
+} XIAddMasterInfo;
+
+typedef struct {
+    int                 type;
+    int                 deviceid;
+    int                 return_mode; /* AttachToMaster, Floating */
+    int                 return_pointer;
+    int                 return_keyboard;
+} XIRemoveMasterInfo;
+
+typedef struct {
+    int                 type;
+    int                 deviceid;
+    int                 new_master;
+} XIAttachSlaveInfo;
+
+typedef struct {
+    int                 type;
+    int                 deviceid;
+} XIDetachSlaveInfo;
+
+typedef union {
+    int                   type; /* must be first element */
+    XIAddMasterInfo       add;
+    XIRemoveMasterInfo    remove;
+    XIAttachSlaveInfo     attach;
+    XIDetachSlaveInfo     detach;
+} XIAnyHierarchyChangeInfo;
+
+typedef struct
+{
+    int    base;
+    int    latched;
+    int    locked;
+    int    effective;
+} XIModifierState;
+
+typedef XIModifierState XIGroupState;
+
+typedef struct {
+    int           mask_len;
+    unsigned char *mask;
+} XIButtonState;
+
+typedef struct {
+    int           mask_len;
+    unsigned char *mask;
+    double        *values;
+} XIValuatorState;
+
+
+typedef struct
+{
+    int                 deviceid;
+    int                 mask_len;
+    unsigned char*      mask;
+} XIEventMask;
+
+typedef struct
+{
+    int         type;
+    int         sourceid;
+} XIAnyClassInfo;
+
+typedef struct
+{
+    int         type;
+    int         sourceid;
+    int         num_buttons;
+    Atom        *labels;
+    XIButtonState state;
+} XIButtonClassInfo;
+
+typedef struct
+{
+    int         type;
+    int         sourceid;
+    int         num_keycodes;
+    int         *keycodes;
+} XIKeyClassInfo;
+
+typedef struct
+{
+    int         type;
+    int         sourceid;
+    int         number;
+    Atom        label;
+    double      min;
+    double      max;
+    double      value;
+    int         resolution;
+    int         mode;
+} XIValuatorClassInfo;
+
+/* new in XI 2.1 */
+typedef struct
+{
+    int         type;
+    int         sourceid;
+    int         number;
+    int         scroll_type;
+    double      increment;
+    int         flags;
+} XIScrollClassInfo;
+
+typedef struct
+{
+    int         type;
+    int         sourceid;
+    int         mode;
+    int         num_touches;
+} XITouchClassInfo;
+
+typedef struct
+{
+    int                 deviceid;
+    char                *name;
+    int                 use;
+    int                 attachment;
+    Bool                enabled;
+    int                 num_classes;
+    XIAnyClassInfo      **classes;
+} XIDeviceInfo;
+
+typedef struct
+{
+    int                 modifiers;
+    int                 status;
+} XIGrabModifiers;
+
+typedef unsigned int BarrierEventID;
+
+typedef struct
+{
+    int                 deviceid;
+    PointerBarrier      barrier;
+    BarrierEventID      eventid;
+} XIBarrierReleasePointerInfo;
+
+/**
+ * Generic XI2 event. All XI2 events have the same header.
+ */
+typedef struct {
+    int           type;         /* GenericEvent */
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    int           extension;    /* XI extension offset */
+    int           evtype;
+    Time          time;
+} XIEvent;
+
+
+typedef struct {
+    int           deviceid;
+    int           attachment;
+    int           use;
+    Bool          enabled;
+    int           flags;
+} XIHierarchyInfo;
+
+/*
+ * Notifies the client that the device hierarchy has been changed. The client
+ * is expected to re-query the server for the device hierarchy.
+ */
+typedef struct {
+    int           type;         /* GenericEvent */
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    int           extension;    /* XI extension offset */
+    int           evtype;       /* XI_HierarchyChanged */
+    Time          time;
+    int           flags;
+    int           num_info;
+    XIHierarchyInfo *info;
+} XIHierarchyEvent;
+
+/*
+ * Notifies the client that the classes have been changed. This happens when
+ * the slave device that sends through the master changes.
+ */
+typedef struct {
+    int           type;         /* GenericEvent */
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    int           extension;    /* XI extension offset */
+    int           evtype;       /* XI_DeviceChanged */
+    Time          time;
+    int           deviceid;     /* id of the device that changed */
+    int           sourceid;     /* Source for the new classes. */
+    int           reason;       /* Reason for the change */
+    int           num_classes;
+    XIAnyClassInfo **classes; /* same as in XIDeviceInfo */
+} XIDeviceChangedEvent;
+
+typedef struct {
+    int           type;         /* GenericEvent */
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    int           extension;    /* XI extension offset */
+    int           evtype;
+    Time          time;
+    int           deviceid;
+    int           sourceid;
+    int           detail;
+    Window        root;
+    Window        event;
+    Window        child;
+    double        root_x;
+    double        root_y;
+    double        event_x;
+    double        event_y;
+    int           flags;
+    XIButtonState       buttons;
+    XIValuatorState     valuators;
+    XIModifierState     mods;
+    XIGroupState        group;
+} XIDeviceEvent;
+
+typedef struct {
+    int           type;         /* GenericEvent */
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    int           extension;    /* XI extension offset */
+    int           evtype;       /* XI_RawKeyPress, XI_RawKeyRelease, etc. */
+    Time          time;
+    int           deviceid;
+    int           sourceid;     /* Bug: Always 0. https://bugs.freedesktop.org//show_bug.cgi?id=34240 */
+    int           detail;
+    int           flags;
+    XIValuatorState valuators;
+    double        *raw_values;
+} XIRawEvent;
+
+typedef struct {
+    int           type;         /* GenericEvent */
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    int           extension;    /* XI extension offset */
+    int           evtype;
+    Time          time;
+    int           deviceid;
+    int           sourceid;
+    int           detail;
+    Window        root;
+    Window        event;
+    Window        child;
+    double        root_x;
+    double        root_y;
+    double        event_x;
+    double        event_y;
+    int           mode;
+    Bool          focus;
+    Bool          same_screen;
+    XIButtonState       buttons;
+    XIModifierState     mods;
+    XIGroupState        group;
+} XIEnterEvent;
+
+typedef XIEnterEvent XILeaveEvent;
+typedef XIEnterEvent XIFocusInEvent;
+typedef XIEnterEvent XIFocusOutEvent;
+
+typedef struct {
+    int           type;         /* GenericEvent */
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    int           extension;    /* XI extension offset */
+    int           evtype;       /* XI_PropertyEvent */
+    Time          time;
+    int           deviceid;     /* id of the device that changed */
+    Atom          property;
+    int           what;
+} XIPropertyEvent;
+
+typedef struct {
+    int           type;         /* GenericEvent */
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    int           extension;    /* XI extension offset */
+    int           evtype;
+    Time          time;
+    int           deviceid;
+    int           sourceid;
+    unsigned int  touchid;
+    Window        root;
+    Window        event;
+    Window        child;
+    int           flags;
+} XITouchOwnershipEvent;
+
+typedef struct {
+    int           type;         /* GenericEvent */
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    int           extension;    /* XI extension offset */
+    int           evtype;
+    Time          time;
+    int           deviceid;
+    int           sourceid;
+    Window        event;
+    Window        root;
+    double        root_x;
+    double        root_y;
+    double        dx;
+    double        dy;
+    int           dtime;
+    int           flags;
+    PointerBarrier barrier;
+    BarrierEventID eventid;
+} XIBarrierEvent;
+
+_XFUNCPROTOBEGIN
+
+extern Bool     XIQueryPointer(
+    Display*            display,
+    int                 deviceid,
+    Window              win,
+    Window*             root,
+    Window*             child,
+    double*             root_x,
+    double*             root_y,
+    double*             win_x,
+    double*             win_y,
+    XIButtonState       *buttons,
+    XIModifierState     *mods,
+    XIGroupState        *group
+);
+
+extern Bool     XIWarpPointer(
+    Display*            display,
+    int                 deviceid,
+    Window              src_win,
+    Window              dst_win,
+    double              src_x,
+    double              src_y,
+    unsigned int        src_width,
+    unsigned int        src_height,
+    double              dst_x,
+    double              dst_y
+);
+
+extern Status   XIDefineCursor(
+    Display*            display,
+    int                 deviceid,
+    Window              win,
+    Cursor              cursor
+);
+
+extern Status   XIUndefineCursor(
+    Display*            display,
+    int                 deviceid,
+    Window              win
+);
+
+extern Status   XIChangeHierarchy(
+    Display*            display,
+    XIAnyHierarchyChangeInfo*  changes,
+    int                 num_changes
+);
+
+extern Status   XISetClientPointer(
+    Display*            dpy,
+    Window              win,
+    int                 deviceid
+);
+
+extern Bool     XIGetClientPointer(
+    Display*            dpy,
+    Window              win,
+    int*                deviceid
+);
+
+extern int      XISelectEvents(
+     Display*            dpy,
+     Window              win,
+     XIEventMask         *masks,
+     int                 num_masks
+);
+
+extern XIEventMask *XIGetSelectedEvents(
+     Display*            dpy,
+     Window              win,
+     int                 *num_masks_return
+);
+
+extern Status XIQueryVersion(
+     Display*           dpy,
+     int*               major_version_inout,
+     int*               minor_version_inout
+);
+
+extern XIDeviceInfo* XIQueryDevice(
+     Display*           dpy,
+     int                deviceid,
+     int*               ndevices_return
+);
+
+extern Status XISetFocus(
+     Display*           dpy,
+     int                deviceid,
+     Window             focus,
+     Time               time
+);
+
+extern Status XIGetFocus(
+     Display*           dpy,
+     int                deviceid,
+     Window             *focus_return);
+
+extern Status XIGrabDevice(
+     Display*           dpy,
+     int                deviceid,
+     Window             grab_window,
+     Time               time,
+     Cursor             cursor,
+     int                grab_mode,
+     int                paired_device_mode,
+     Bool               owner_events,
+     XIEventMask        *mask
+);
+
+extern Status XIUngrabDevice(
+     Display*           dpy,
+     int                deviceid,
+     Time               time
+);
+
+extern Status XIAllowEvents(
+    Display*            display,
+    int                 deviceid,
+    int                 event_mode,
+    Time                time
+);
+
+extern Status XIAllowTouchEvents(
+    Display*            display,
+    int                 deviceid,
+    unsigned int        touchid,
+    Window              grab_window,
+    int                 event_mode
+);
+
+extern int XIGrabButton(
+    Display*            display,
+    int                 deviceid,
+    int                 button,
+    Window              grab_window,
+    Cursor              cursor,
+    int                 grab_mode,
+    int                 paired_device_mode,
+    int                 owner_events,
+    XIEventMask         *mask,
+    int                 num_modifiers,
+    XIGrabModifiers     *modifiers_inout
+);
+
+extern int XIGrabKeycode(
+    Display*            display,
+    int                 deviceid,
+    int                 keycode,
+    Window              grab_window,
+    int                 grab_mode,
+    int                 paired_device_mode,
+    int                 owner_events,
+    XIEventMask         *mask,
+    int                 num_modifiers,
+    XIGrabModifiers     *modifiers_inout
+);
+
+extern int XIGrabEnter(
+    Display*            display,
+    int                 deviceid,
+    Window              grab_window,
+    Cursor              cursor,
+    int                 grab_mode,
+    int                 paired_device_mode,
+    int                 owner_events,
+    XIEventMask         *mask,
+    int                 num_modifiers,
+    XIGrabModifiers     *modifiers_inout
+);
+
+extern int XIGrabFocusIn(
+    Display*            display,
+    int                 deviceid,
+    Window              grab_window,
+    int                 grab_mode,
+    int                 paired_device_mode,
+    int                 owner_events,
+    XIEventMask         *mask,
+    int                 num_modifiers,
+    XIGrabModifiers     *modifiers_inout
+);
+
+extern int XIGrabTouchBegin(
+    Display*            display,
+    int                 deviceid,
+    Window              grab_window,
+    int                 owner_events,
+    XIEventMask         *mask,
+    int                 num_modifiers,
+    XIGrabModifiers     *modifiers_inout
+);
+
+extern Status XIUngrabButton(
+    Display*            display,
+    int                 deviceid,
+    int                 button,
+    Window              grab_window,
+    int                 num_modifiers,
+    XIGrabModifiers     *modifiers
+);
+
+extern Status XIUngrabKeycode(
+    Display*            display,
+    int                 deviceid,
+    int                 keycode,
+    Window              grab_window,
+    int                 num_modifiers,
+    XIGrabModifiers     *modifiers
+);
+
+extern Status XIUngrabEnter(
+    Display*            display,
+    int                 deviceid,
+    Window              grab_window,
+    int                 num_modifiers,
+    XIGrabModifiers     *modifiers
+);
+
+extern Status XIUngrabFocusIn(
+    Display*            display,
+    int                 deviceid,
+    Window              grab_window,
+    int                 num_modifiers,
+    XIGrabModifiers     *modifiers
+);
+
+extern Status XIUngrabTouchBegin(
+    Display*            display,
+    int                 deviceid,
+    Window              grab_window,
+    int                 num_modifiers,
+    XIGrabModifiers     *modifiers
+);
+
+extern Atom *XIListProperties(
+    Display*            display,
+    int                 deviceid,
+    int                 *num_props_return
+);
+
+extern void XIChangeProperty(
+    Display*            display,
+    int                 deviceid,
+    Atom                property,
+    Atom                type,
+    int                 format,
+    int                 mode,
+    unsigned char       *data,
+    int                 num_items
+);
+
+extern void
+XIDeleteProperty(
+    Display*            display,
+    int                 deviceid,
+    Atom                property
+);
+
+extern Status
+XIGetProperty(
+    Display*            display,
+    int                 deviceid,
+    Atom                property,
+    long                offset,
+    long                length,
+    Bool                delete_property,
+    Atom                type,
+    Atom                *type_return,
+    int                 *format_return,
+    unsigned long       *num_items_return,
+    unsigned long       *bytes_after_return,
+    unsigned char       **data
+);
+
+extern void
+XIBarrierReleasePointers(
+    Display*                    display,
+    XIBarrierReleasePointerInfo *barriers,
+    int                         num_barriers
+);
+
+extern void
+XIBarrierReleasePointer(
+    Display*                    display,
+    int                         deviceid,
+    PointerBarrier              barrier,
+    BarrierEventID              eventid
+);
+
+extern void XIFreeDeviceInfo(XIDeviceInfo       *info);
+
+_XFUNCPROTOEND
+
+#endif /* XINPUT2_H */
diff --git a/ThirdParty/X11/Include/X11/extensions/XIproto.h b/ThirdParty/X11/Include/X11/extensions/XIproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..82323d8992c11b2391947e402406e988133d7c63
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XIproto.h
@@ -0,0 +1,1758 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+			All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+
+#ifndef _XIPROTO_H
+#define _XIPROTO_H
+
+#include <X11/Xproto.h>
+#include <X11/X.h>
+
+/* make sure types have right sizes for protocol structures. */
+#define Window CARD32
+#define Time CARD32
+#define KeyCode CARD8
+#define Mask CARD32
+#define Atom CARD32
+#define Cursor CARD32
+
+/*********************************************************
+ *
+ * number of events, errors, and extension name.
+ *
+ */
+
+#define MORE_EVENTS	0x80
+#define DEVICE_BITS	0x7F
+
+#define InputClassBits	0x3F	/* bits in mode field for input classes */
+#define ModeBitsShift	6	/* amount to shift the remaining bits   */
+
+#define numInputClasses 7
+
+#define IEVENTS         17       /* does NOT include generic events */
+#define IERRORS         5
+#define IREQUESTS       39
+
+#define CLIENT_REQ      1
+
+typedef struct  _XExtEventInfo
+    {
+    Mask	mask;
+    BYTE	type;
+    BYTE	word;
+    } XExtEventInfo;
+
+#ifndef _XITYPEDEF_POINTER
+typedef void *Pointer;
+#endif
+
+struct tmask
+    {
+    Mask	mask;
+    void        *dev;
+    };
+
+/*********************************************************
+ *
+ * Event constants used by library.
+ *
+ */
+
+#define XI_DeviceValuator		0
+#define XI_DeviceKeyPress		1
+#define XI_DeviceKeyRelease		2
+#define XI_DeviceButtonPress		3
+#define XI_DeviceButtonRelease		4
+#define XI_DeviceMotionNotify		5
+#define XI_DeviceFocusIn		6
+#define XI_DeviceFocusOut		7
+#define XI_ProximityIn			8
+#define XI_ProximityOut			9
+#define XI_DeviceStateNotify		10
+#define XI_DeviceMappingNotify		11
+#define XI_ChangeDeviceNotify		12
+#define XI_DeviceKeystateNotify		13
+#define XI_DeviceButtonstateNotify	14
+#define XI_DevicePresenceNotify		15
+#define XI_DevicePropertyNotify         16
+
+/*********************************************************
+ *
+ * Protocol request constants
+ *
+ */
+
+#define X_GetExtensionVersion		1
+#define X_ListInputDevices		2
+#define X_OpenDevice			3
+#define X_CloseDevice			4
+#define X_SetDeviceMode			5
+#define X_SelectExtensionEvent		6
+#define X_GetSelectedExtensionEvents	7
+#define X_ChangeDeviceDontPropagateList 8
+#define X_GetDeviceDontPropagateList	9
+#define X_GetDeviceMotionEvents		10
+#define X_ChangeKeyboardDevice		11
+#define X_ChangePointerDevice		12
+#define X_GrabDevice			13
+#define X_UngrabDevice			14
+#define X_GrabDeviceKey			15
+#define X_UngrabDeviceKey		16
+#define X_GrabDeviceButton		17
+#define X_UngrabDeviceButton		18
+#define X_AllowDeviceEvents		19
+#define X_GetDeviceFocus		20
+#define X_SetDeviceFocus		21
+#define X_GetFeedbackControl		22
+#define X_ChangeFeedbackControl		23
+#define X_GetDeviceKeyMapping		24
+#define X_ChangeDeviceKeyMapping	25
+#define X_GetDeviceModifierMapping	26
+#define X_SetDeviceModifierMapping	27
+#define X_GetDeviceButtonMapping	28
+#define X_SetDeviceButtonMapping	29
+#define X_QueryDeviceState		30
+#define X_SendExtensionEvent		31
+#define X_DeviceBell			32
+#define X_SetDeviceValuators		33
+#define X_GetDeviceControl		34
+#define X_ChangeDeviceControl		35
+/* XI 1.5 */
+#define X_ListDeviceProperties          36
+#define X_ChangeDeviceProperty          37
+#define X_DeleteDeviceProperty          38
+#define X_GetDeviceProperty             39
+
+/*********************************************************
+ *
+ * Protocol request and reply structures.
+ *
+ * GetExtensionVersion.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;       /* input extension major code   */
+    CARD8	ReqType;       /* always X_GetExtensionVersion */
+    CARD16	length B16;
+    CARD16	nbytes B16;
+    CARD8	pad1, pad2;
+} xGetExtensionVersionReq;
+
+typedef struct {
+    CARD8	repType;	/* X_Reply			*/
+    CARD8	RepType;	/* always X_GetExtensionVersion */
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	major_version B16;
+    CARD16	minor_version B16;
+    BOOL	present;
+    CARD8	pad1, pad2, pad3;
+    CARD32	pad01 B32;
+    CARD32	pad02 B32;
+    CARD32	pad03 B32;
+    CARD32	pad04 B32;
+} xGetExtensionVersionReply;
+
+/*********************************************************
+ *
+ * ListInputDevices.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;	/* always X_ListInputDevices	*/
+    CARD16	length B16;
+} xListInputDevicesReq;
+
+typedef struct {
+    CARD8	repType;	/* X_Reply			*/
+    CARD8	RepType;        /* always X_ListInputDevices	*/
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD8	ndevices;
+    CARD8	pad1, pad2, pad3;
+    CARD32	pad01 B32;
+    CARD32	pad02 B32;
+    CARD32	pad03 B32;
+    CARD32	pad04 B32;
+    CARD32	pad05 B32;
+} xListInputDevicesReply;
+
+typedef struct _xDeviceInfo *xDeviceInfoPtr;
+
+typedef struct _xAnyClassinfo *xAnyClassPtr;
+
+typedef struct _xAnyClassinfo {
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8	c_class;
+#else
+    CARD8	class;
+#endif
+    CARD8	length;
+    } xAnyClassInfo;
+
+typedef struct _xDeviceInfo {
+    CARD32	type B32;
+    CARD8	id;
+    CARD8	num_classes;
+    CARD8	use;      /* IsXPointer | IsXKeyboard | IsXExtension... */
+    CARD8	attached; /* id of master dev (if IsXExtension..) */
+    } xDeviceInfo;
+
+typedef struct _xKeyInfo *xKeyInfoPtr;
+
+typedef struct _xKeyInfo {
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8	c_class;
+#else
+    CARD8	class;
+#endif
+    CARD8	length;
+    KeyCode	min_keycode;
+    KeyCode	max_keycode;
+    CARD16	num_keys B16;
+    CARD8	pad1,pad2;
+    } xKeyInfo;
+
+typedef struct _xButtonInfo *xButtonInfoPtr;
+
+typedef struct _xButtonInfo {
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8	c_class;
+#else
+    CARD8	class;
+#endif
+    CARD8	length;
+    CARD16	num_buttons B16;
+    } xButtonInfo;
+
+typedef struct _xValuatorInfo *xValuatorInfoPtr;
+
+typedef struct _xValuatorInfo {
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8	c_class;
+#else
+    CARD8	class;
+#endif
+    CARD8	length;
+    CARD8	num_axes;
+    CARD8	mode;
+    CARD32	motion_buffer_size B32;
+    } xValuatorInfo;
+
+typedef struct _xAxisInfo *xAxisInfoPtr;
+
+typedef struct _xAxisInfo {
+    CARD32	resolution B32;
+    CARD32	min_value B32;
+    CARD32	max_value B32;
+    } xAxisInfo;
+
+/*********************************************************
+ *
+ * OpenDevice.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;        /* always X_OpenDevice		*/
+    CARD16	length B16;
+    CARD8       deviceid;
+    BYTE	pad1, pad2, pad3;
+} xOpenDeviceReq;
+
+typedef struct {
+    CARD8	repType;	/* X_Reply			*/
+    CARD8	RepType;	/* always X_OpenDevice		*/
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD8	num_classes;
+    BYTE	pad1, pad2, pad3;
+    CARD32	pad00 B32;
+    CARD32	pad01 B32;
+    CARD32	pad02 B32;
+    CARD32	pad03 B32;
+    CARD32	pad04 B32;
+    } xOpenDeviceReply;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8	c_class;
+#else
+    CARD8	class;
+#endif
+    CARD8	event_type_base;
+    } xInputClassInfo;
+
+/*********************************************************
+ *
+ * CloseDevice.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;        /* always X_CloseDevice	*/
+    CARD16	length B16;
+    CARD8       deviceid;
+    BYTE	pad1, pad2, pad3;
+} xCloseDeviceReq;
+
+/*********************************************************
+ *
+ * SetDeviceMode.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;	/* always X_SetDeviceMode	*/
+    CARD16	length B16;
+    CARD8       deviceid;
+    CARD8       mode;
+    BYTE	pad1, pad2;
+} xSetDeviceModeReq;
+
+typedef struct {
+    CARD8	repType;	/* X_Reply			*/
+    CARD8	RepType;	/* always X_SetDeviceMode	*/
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD8	status;
+    BYTE	pad1, pad2, pad3;
+    CARD32	pad01 B32;
+    CARD32	pad02 B32;
+    CARD32	pad03 B32;
+    CARD32	pad04 B32;
+    CARD32	pad05 B32;
+} xSetDeviceModeReply;
+
+/*********************************************************
+ *
+ * SelectExtensionEvent.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;        /* always X_SelectExtensionEvent */
+    CARD16	length B16;
+    Window	window B32;
+    CARD16	count B16;
+    CARD16	pad00 B16;
+} xSelectExtensionEventReq;
+
+/*********************************************************
+ *
+ * GetSelectedExtensionEvent.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;        /* X_GetSelectedExtensionEvents */
+    CARD16	length B16;
+    Window	window B32;
+} xGetSelectedExtensionEventsReq;
+
+typedef struct {
+    CARD8	repType;	/* X_Reply			*/
+    CARD8	RepType;	/* GetSelectedExtensionEvents	*/
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	this_client_count B16;
+    CARD16	all_clients_count B16;
+    CARD32	pad01 B32;
+    CARD32	pad02 B32;
+    CARD32	pad03 B32;
+    CARD32	pad04 B32;
+    CARD32	pad05 B32;
+} xGetSelectedExtensionEventsReply;
+
+/*********************************************************
+ *
+ * ChangeDeviceDontPropagateList.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;        /* X_ChangeDeviceDontPropagateList */
+    CARD16	length B16;
+    Window	window B32;
+    CARD16	count B16;
+    CARD8	mode;
+    BYTE	pad;
+} xChangeDeviceDontPropagateListReq;
+
+/*********************************************************
+ *
+ * GetDeviceDontPropagateList.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;        /* X_GetDeviceDontPropagateList */
+    CARD16	length B16;
+    Window	window B32;
+} xGetDeviceDontPropagateListReq;
+
+typedef struct {
+    CARD8	repType;	/* X_Reply			*/
+    CARD8	RepType;        /* GetDeviceDontPropagateList   */
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	count B16;
+    CARD16	pad00 B16;
+    CARD32	pad01 B32;
+    CARD32	pad02 B32;
+    CARD32	pad03 B32;
+    CARD32	pad04 B32;
+    CARD32	pad05 B32;
+    } xGetDeviceDontPropagateListReply;
+
+/*********************************************************
+ *
+ * GetDeviceMotionEvents.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;        /* always X_GetDeviceMotionEvents*/
+    CARD16	length B16;
+    Time	start B32;
+    Time	stop B32;
+    CARD8	deviceid;
+    BYTE	pad1, pad2, pad3;
+} xGetDeviceMotionEventsReq;
+
+typedef struct {
+    CARD8	repType;	/* X_Reply */
+    CARD8	RepType;        /* always X_GetDeviceMotionEvents  */
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	nEvents B32;
+    CARD8	axes;
+    CARD8	mode;
+    BYTE	pad1, pad2;
+    CARD32	pad01 B32;
+    CARD32	pad02 B32;
+    CARD32	pad03 B32;
+    CARD32	pad04 B32;
+} xGetDeviceMotionEventsReply;
+
+/*********************************************************
+ *
+ * ChangeKeyboardDevice.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;        /* X_ChangeKeyboardDevice	*/
+    CARD16	length B16;
+    CARD8	deviceid;
+    BYTE	pad1, pad2, pad3;
+} xChangeKeyboardDeviceReq;
+
+typedef struct {
+    CARD8	repType;	/* X_Reply			*/
+    CARD8	RepType;        /* always X_ChangeKeyboardDevice*/
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;  /* 0 */
+    CARD8	status;
+    BYTE	pad1, pad2, pad3;
+    CARD32	pad01 B32;
+    CARD32	pad02 B32;
+    CARD32	pad03 B32;
+    CARD32	pad04 B32;
+    CARD32	pad05 B32;
+    } xChangeKeyboardDeviceReply;
+
+/*********************************************************
+ *
+ * ChangePointerDevice.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;        /* X_ChangePointerDevice	*/
+    CARD16	length B16;
+    CARD8	xaxis;
+    CARD8	yaxis;
+    CARD8	deviceid;
+    BYTE	pad1;
+} xChangePointerDeviceReq;
+
+typedef struct {
+    CARD8	repType;	/* X_Reply			*/
+    CARD8	RepType;        /* always X_ChangePointerDevice */
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;  /* 0 */
+    CARD8	status;
+    BYTE	pad1, pad2, pad3;
+    CARD32	pad01 B32;
+    CARD32	pad02 B32;
+    CARD32	pad03 B32;
+    CARD32	pad04 B32;
+    CARD32	pad05 B32;
+    } xChangePointerDeviceReply;
+
+/*********************************************************
+ *
+ * GrabDevice.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;        /* always X_GrabDevice */
+    CARD16	length B16;
+    Window	grabWindow B32;
+    Time	time B32;
+    CARD16	event_count B16;
+    CARD8	this_device_mode;
+    CARD8	other_devices_mode;
+    BOOL	ownerEvents;
+    CARD8	deviceid;
+    CARD16	pad01 B16;
+} xGrabDeviceReq;
+
+typedef struct {
+    CARD8	repType;	/* X_Reply			*/
+    CARD8	RepType;        /* always X_GrabDevice	*/
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;  /* 0 */
+    CARD8	status;
+    BYTE	pad1, pad2, pad3;
+    CARD32	pad01 B32;
+    CARD32	pad02 B32;
+    CARD32	pad03 B32;
+    CARD32	pad04 B32;
+    CARD32	pad05 B32;
+    } xGrabDeviceReply;
+
+/*********************************************************
+ *
+ * UngrabDevice.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;        /* always X_UnGrabDevice	*/
+    CARD16	length B16;
+    Time	time B32;
+    CARD8	deviceid;
+    BYTE	pad1, pad2, pad3;
+} xUngrabDeviceReq;
+
+/*********************************************************
+ *
+ * GrabDeviceKey.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;        /* always X_GrabDeviceKey	*/
+    CARD16	length B16;
+    Window	grabWindow B32;
+    CARD16	event_count B16;
+    CARD16	modifiers B16;
+    CARD8	modifier_device;
+    CARD8	grabbed_device;
+    CARD8	key;
+    BYTE	this_device_mode;
+    BYTE	other_devices_mode;
+    BOOL	ownerEvents;
+    BYTE	pad1, pad2;
+} xGrabDeviceKeyReq;
+
+/*********************************************************
+ *
+ * UngrabDeviceKey.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;        /* always X_UngrabDeviceKey	*/
+    CARD16	length B16;
+    Window	grabWindow B32;
+    CARD16	modifiers B16;
+    CARD8	modifier_device;
+    CARD8	key;
+    CARD8	grabbed_device;
+    BYTE	pad1, pad2, pad3;
+} xUngrabDeviceKeyReq;
+
+/*********************************************************
+ *
+ * GrabDeviceButton.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;        /* always X_GrabDeviceButton	*/
+    CARD16	length B16;
+    Window	grabWindow B32;
+    CARD8	grabbed_device;
+    CARD8	modifier_device;
+    CARD16	event_count B16;
+    CARD16	modifiers B16;
+    BYTE	this_device_mode;
+    BYTE	other_devices_mode;
+    CARD8	button;
+    BOOL	ownerEvents;
+    BYTE	pad1, pad2;
+} xGrabDeviceButtonReq;
+
+/*********************************************************
+ *
+ * UngrabDeviceButton.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;        /* always X_UngrabDeviceButton	*/
+    CARD16	length B16;
+    Window	grabWindow B32;
+    CARD16	modifiers B16;
+    CARD8	modifier_device;
+    CARD8	button;
+    CARD8	grabbed_device;
+    BYTE	pad1, pad2, pad3;
+} xUngrabDeviceButtonReq;
+
+/*********************************************************
+ *
+ * AllowDeviceEvents.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;        /* always X_AllowDeviceEvents	*/
+    CARD16	length B16;
+    Time	time B32;
+    CARD8	mode;
+    CARD8	deviceid;
+    BYTE	pad1, pad2;
+} xAllowDeviceEventsReq;
+
+/*********************************************************
+ *
+ * GetDeviceFocus.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;        /* input extension major code   */
+    CARD8	ReqType;        /* always X_GetDeviceFocus	*/
+    CARD16	length B16;
+    CARD8	deviceid;
+    BYTE	pad1, pad2, pad3;
+} xGetDeviceFocusReq;
+
+typedef struct {
+    CARD8	repType;	/* X_Reply			*/
+    CARD8	RepType;        /* always X_GetDeviceFocus	*/
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	focus B32;
+    Time	time B32;
+    CARD8	revertTo;
+    BYTE	pad1, pad2, pad3;
+    CARD32	pad01 B32;
+    CARD32	pad02 B32;
+    CARD32	pad03 B32;
+    } xGetDeviceFocusReply;
+
+/*********************************************************
+ *
+ * SetDeviceFocus.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;        /* input extension major code   */
+    CARD8	ReqType;        /* always X_SetDeviceFocus	*/
+    CARD16	length B16;
+    Window	focus B32;
+    Time	time B32;
+    CARD8	revertTo;
+    CARD8	device;
+    CARD16	pad01 B16;
+} xSetDeviceFocusReq;
+
+/*********************************************************
+ *
+ * GetFeedbackControl.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;        /* X_GetFeedbackControl	*/
+    CARD16	length B16;
+    CARD8	deviceid;
+    BYTE	pad1, pad2, pad3;
+} xGetFeedbackControlReq;
+
+typedef struct {
+    CARD8	repType;	/* X_Reply			*/
+    CARD8	RepType;        /* always X_GetFeedbackControl	*/
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	num_feedbacks B16;
+    CARD16	pad01 B16;
+    CARD32	pad02 B32;
+    CARD32	pad03 B32;
+    CARD32	pad04 B32;
+    CARD32	pad05 B32;
+    CARD32	pad06 B32;
+} xGetFeedbackControlReply;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8	c_class;	/* feedback class		*/
+#else
+    CARD8	class;		/* feedback class		*/
+#endif
+    CARD8	id;		/* feedback id		*/
+    CARD16	length B16;	/* feedback length		*/
+} xFeedbackState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8   c_class;
+#else
+    CARD8   class;
+#endif
+    CARD8   id;
+    CARD16  length B16;
+    CARD16  pitch B16;
+    CARD16  duration B16;
+    CARD32  led_mask B32;
+    CARD32  led_values B32;
+    BOOL    global_auto_repeat;
+    CARD8   click;
+    CARD8   percent;
+    BYTE    pad;
+    BYTE    auto_repeats[32];
+} xKbdFeedbackState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8   c_class;
+#else
+    CARD8   class;
+#endif
+    CARD8   id;
+    CARD16  length B16;
+    CARD8   pad1,pad2;
+    CARD16  accelNum B16;
+    CARD16  accelDenom B16;
+    CARD16  threshold B16;
+} xPtrFeedbackState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8	c_class;	/* feedback class id		*/
+#else
+    CARD8	class;		/* feedback class id		*/
+#endif
+    CARD8	id;
+    CARD16	length B16;	/* feedback length		*/
+    CARD32	resolution B32;
+    INT32	min_value B32;
+    INT32	max_value B32;
+} xIntegerFeedbackState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8	c_class;	/* feedback class id		*/
+#else
+    CARD8	class;		/* feedback class id		*/
+#endif
+    CARD8	id;
+    CARD16	length B16;	/* feedback length		*/
+    CARD16	max_symbols B16;
+    CARD16	num_syms_supported B16;
+} xStringFeedbackState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8	c_class;	/* feedback class id		*/
+#else
+    CARD8	class;		/* feedback class id		*/
+#endif
+    CARD8	id;
+    CARD16	length B16;	/* feedback length		*/
+    CARD8	percent;
+    BYTE	pad1, pad2, pad3;
+    CARD16	pitch B16;
+    CARD16	duration B16;
+} xBellFeedbackState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8	c_class;	/* feedback class id		*/
+#else
+    CARD8	class;		/* feedback class id		*/
+#endif
+    CARD8	id;
+    CARD16	length B16;	/* feedback length		*/
+    CARD32	led_mask B32;
+    CARD32	led_values B32;
+} xLedFeedbackState;
+
+/*********************************************************
+ *
+ * ChangeFeedbackControl.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;        /* X_ChangeFeedbackControl	*/
+    CARD16	length B16;
+    CARD32	mask B32;
+    CARD8	deviceid;
+    CARD8	feedbackid;
+    BYTE	pad1, pad2;
+} xChangeFeedbackControlReq;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8	c_class;	/* feedback class id		*/
+#else
+    CARD8	class;		/* feedback class id		*/
+#endif
+    CARD8	id;		/* feedback id		*/
+    CARD16	length B16;	/* feedback length		*/
+} xFeedbackCtl;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8	c_class;	/* feedback class id		*/
+#else
+    CARD8	class;		/* feedback class id		*/
+#endif
+    CARD8	id;		/* feedback length		*/
+    CARD16	length B16;	/* feedback length		*/
+    KeyCode	key;
+    CARD8	auto_repeat_mode;
+    INT8	click;
+    INT8	percent;
+    INT16	pitch B16;
+    INT16	duration B16;
+    CARD32	led_mask B32;
+    CARD32	led_values B32;
+} xKbdFeedbackCtl;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8	c_class;	/* feedback class id		*/
+#else
+    CARD8	class;		/* feedback class id		*/
+#endif
+    CARD8	id;		/* feedback id		*/
+    CARD16	length B16;	/* feedback length		*/
+    CARD8	pad1,pad2;
+    INT16	num B16;
+    INT16	denom B16;
+    INT16	thresh B16;
+} xPtrFeedbackCtl;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8	c_class;	/* feedback class id		*/
+#else
+    CARD8	class;		/* feedback class id		*/
+#endif
+    CARD8	id;		/* feedback id		*/
+    CARD16	length B16;	/* feedback length		*/
+    INT32	int_to_display B32;
+} xIntegerFeedbackCtl;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8	c_class;	/* feedback class id		*/
+#else
+    CARD8	class;		/* feedback class id		*/
+#endif
+    CARD8	id;		/* feedback id		*/
+    CARD16	length B16;	/* feedback length		*/
+    CARD8	pad1,pad2;
+    CARD16	num_keysyms B16;
+} xStringFeedbackCtl;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8	c_class;	/* feedback class id		*/
+#else
+    CARD8	class;		/* feedback class id		*/
+#endif
+    CARD8	id;		/* feedback id		*/
+    CARD16	length B16;	/* feedback length		*/
+    INT8	percent;
+    BYTE	pad1, pad2, pad3;
+    INT16	pitch B16;
+    INT16	duration B16;
+} xBellFeedbackCtl;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8	c_class;	/* feedback class id		*/
+#else
+    CARD8	class;		/* feedback class id		*/
+#endif
+    CARD8	id;		/* feedback id		*/
+    CARD16	length B16;	/* feedback length		*/
+    CARD32	led_mask B32;
+    CARD32	led_values B32;
+} xLedFeedbackCtl;
+
+/*********************************************************
+ *
+ * GetDeviceKeyMapping.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;        /* input extension major code   */
+    CARD8	ReqType;	/* always X_GetDeviceKeyMapping */
+    CARD16	length B16;
+    CARD8	deviceid;
+    KeyCode	firstKeyCode;
+    CARD8	count;
+    BYTE	pad1;
+} xGetDeviceKeyMappingReq;
+
+typedef struct {
+    CARD8	repType;	/* X_Reply			*/
+    CARD8	RepType;	/* always X_GetDeviceKeyMapping */
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD8	keySymsPerKeyCode;
+    CARD8	pad0;
+    CARD16	pad1 B16;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xGetDeviceKeyMappingReply;
+
+/*********************************************************
+ *
+ * ChangeDeviceKeyMapping.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;        /* input extension major code   */
+    CARD8	ReqType;        /* always X_ChangeDeviceKeyMapping */
+    CARD16	length B16;
+    CARD8	deviceid;
+    KeyCode	firstKeyCode;
+    CARD8	keySymsPerKeyCode;
+    CARD8	keyCodes;
+} xChangeDeviceKeyMappingReq;
+
+/*********************************************************
+ *
+ * GetDeviceModifierMapping.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;        /* input extension major code   */
+    CARD8	ReqType;        /* always X_GetDeviceModifierMapping */
+    CARD16	length B16;
+    CARD8	deviceid;
+    BYTE	pad1, pad2, pad3;
+} xGetDeviceModifierMappingReq;
+
+typedef struct {
+    CARD8	repType;	/* X_Reply */
+    CARD8	RepType;        /* always X_GetDeviceModifierMapping */
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD8	numKeyPerModifier;
+    CARD8	pad0;
+    CARD16	pad1 B16;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xGetDeviceModifierMappingReply;
+
+/*********************************************************
+ *
+ * SetDeviceModifierMapping.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;        /* input extension major code   */
+    CARD8	ReqType;        /* always X_SetDeviceModifierMapping */
+    CARD16	length B16;
+    CARD8	deviceid;
+    CARD8	numKeyPerModifier;
+    CARD16	pad1 B16;
+} xSetDeviceModifierMappingReq;
+
+typedef struct {
+    CARD8	repType;	/* X_Reply */
+    CARD8	RepType;        /* always X_SetDeviceModifierMapping */
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD8	success;
+    CARD8	pad0;
+    CARD16	pad1 B16;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xSetDeviceModifierMappingReply;
+
+/*********************************************************
+ *
+ * GetDeviceButtonMapping.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;        /* X_GetDeviceButtonMapping     */
+    CARD16	length B16;
+    CARD8	deviceid;
+    BYTE	pad1, pad2, pad3;
+} xGetDeviceButtonMappingReq;
+
+typedef struct {
+    CARD8	repType;	/* X_Reply */
+    CARD8	RepType;        /* always X_GetDeviceButtonMapping */
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD8	nElts;
+    BYTE	pad1, pad2, pad3;
+    CARD32	pad01 B32;
+    CARD32	pad02 B32;
+    CARD32	pad03 B32;
+    CARD32	pad04 B32;
+    CARD32	pad05 B32;
+} xGetDeviceButtonMappingReply;
+
+/*********************************************************
+ *
+ * SetDeviceButtonMapping.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;        /* X_SetDeviceButtonMapping     */
+    CARD16	length B16;
+    CARD8	deviceid;
+    CARD8	map_length;
+    BYTE	pad1, pad2;
+} xSetDeviceButtonMappingReq;
+
+typedef struct {
+    CARD8	repType;		/* X_Reply */
+    CARD8	RepType;	/* always X_SetDeviceButtonMapping */
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD8	status;
+    BYTE	pad0;
+    CARD16	pad1 B16;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xSetDeviceButtonMappingReply;
+
+/*********************************************************
+ *
+ * QueryDeviceState.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	ReqType;        /* always X_QueryDeviceState */
+    CARD16	length B16;
+    CARD8	deviceid;
+    BYTE	pad1, pad2, pad3;
+} xQueryDeviceStateReq;
+
+typedef struct {
+    CARD8	repType;		/* X_Reply */
+    CARD8	RepType;	/* always X_QueryDeviceState	*/
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD8	num_classes;
+    BYTE	pad0;
+    CARD16	pad1 B16;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xQueryDeviceStateReply;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8	c_class;
+#else
+    CARD8	class;
+#endif
+    CARD8	length;
+    CARD8	num_keys;
+    BYTE	pad1;
+    CARD8	keys[32];
+} xKeyState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8	c_class;
+#else
+    CARD8	class;
+#endif
+    CARD8	length;
+    CARD8	num_buttons;
+    BYTE	pad1;
+    CARD8	buttons[32];
+} xButtonState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD8	c_class;
+#else
+    CARD8	class;
+#endif
+    CARD8	length;
+    CARD8	num_valuators;
+    CARD8	mode;
+} xValuatorState;
+
+/*********************************************************
+ *
+ * SendExtensionEvent.
+ * THIS REQUEST MUST BE KEPT A MULTIPLE OF 8 BYTES IN LENGTH!
+ * MORE EVENTS MAY FOLLOW AND THEY MUST BE QUAD-ALIGNED!
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	ReqType;        /* always X_SendExtensionEvent */
+    CARD16	length B16;
+    Window	destination B32;
+    CARD8	deviceid;
+    BOOL	propagate;
+    CARD16	count B16;
+    CARD8	num_events;
+    BYTE	pad1,pad2,pad3;
+} xSendExtensionEventReq;
+
+/*********************************************************
+ *
+ * DeviceBell.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	ReqType;        /* always X_DeviceBell */
+    CARD16	length B16;
+    CARD8	deviceid;
+    CARD8	feedbackid;
+    CARD8	feedbackclass;
+    INT8	percent;
+} xDeviceBellReq;
+
+/*********************************************************
+ *
+ * SetDeviceValuators.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;	/* always X_SetDeviceValuators	*/
+    CARD16	length B16;
+    CARD8       deviceid;
+    CARD8       first_valuator;
+    CARD8       num_valuators;
+    BYTE	pad1;
+} xSetDeviceValuatorsReq;
+
+typedef struct {
+    CARD8	repType;	/* X_Reply			*/
+    CARD8	RepType;	/* always X_SetDeviceValuators	*/
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD8	status;
+    BYTE	pad1, pad2, pad3;
+    CARD32	pad01 B32;
+    CARD32	pad02 B32;
+    CARD32	pad03 B32;
+    CARD32	pad04 B32;
+    CARD32	pad05 B32;
+} xSetDeviceValuatorsReply;
+
+/*********************************************************
+ *
+ * GetDeviceControl.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;	/* always X_GetDeviceControl	*/
+    CARD16	length B16;
+    CARD16      control B16;
+    CARD8       deviceid;
+    BYTE	pad2;
+} xGetDeviceControlReq;
+
+typedef struct {
+    CARD8	repType;	/* X_Reply			*/
+    CARD8	RepType;	/* always X_GetDeviceControl	*/
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD8	status;
+    BYTE	pad1, pad2, pad3;
+    CARD32	pad01 B32;
+    CARD32	pad02 B32;
+    CARD32	pad03 B32;
+    CARD32	pad04 B32;
+    CARD32	pad05 B32;
+} xGetDeviceControlReply;
+
+typedef struct {
+    CARD16	control B16;	/* control type		*/
+    CARD16	length B16;	/* control length		*/
+} xDeviceState;
+
+typedef struct {
+    CARD16	control B16;		/* control type		*/
+    CARD16	length B16;		/* control length		*/
+    CARD32	num_valuators B32;	/* number of valuators		*/
+} xDeviceResolutionState;
+
+typedef struct {
+     CARD16         control B16;
+     CARD16         length B16;
+     INT32          min_x B32;
+     INT32          max_x B32;
+     INT32          min_y B32;
+     INT32          max_y B32;
+     CARD32         flip_x B32;
+     CARD32         flip_y B32;
+     CARD32         rotation B32;
+     CARD32         button_threshold B32;
+} xDeviceAbsCalibState;
+
+typedef struct {
+     CARD16         control B16;
+     CARD16         length B16;
+     CARD32         offset_x B32;
+     CARD32         offset_y B32;
+     CARD32         width B32;
+     CARD32         height B32;
+     CARD32         screen B32;
+     CARD32         following B32;
+} xDeviceAbsAreaState;
+
+typedef struct {
+    CARD16      control B16;            /* control type                 */
+    CARD16      length  B16;            /* control length               */
+    CARD8       status;
+    CARD8       iscore;
+    CARD16      pad1 B16;
+} xDeviceCoreState;
+
+typedef struct {
+    CARD16      control B16;            /* control type                 */
+    CARD16      length  B16;            /* control length               */
+    CARD8       enable;
+    CARD8       pad0;
+    CARD16      pad1 B16;
+} xDeviceEnableState;
+
+/*********************************************************
+ *
+ * ChangeDeviceControl.
+ *
+ */
+
+typedef struct {
+    CARD8	reqType;	/* input extension major code	*/
+    CARD8	ReqType;	/* always X_ChangeDeviceControl */
+    CARD16	length B16;
+    CARD16      control B16;
+    CARD8       deviceid;
+    BYTE        pad0;
+} xChangeDeviceControlReq;
+
+typedef struct {
+    CARD8	repType;	/* X_Reply			*/
+    CARD8	RepType;	/* always X_ChangeDeviceControl	*/
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD8	status;
+    BYTE	pad1, pad2, pad3;
+    CARD32	pad01 B32;
+    CARD32	pad02 B32;
+    CARD32	pad03 B32;
+    CARD32	pad04 B32;
+    CARD32	pad05 B32;
+} xChangeDeviceControlReply;
+
+typedef struct {
+    CARD16	control B16;	/* control type		*/
+    CARD16	length B16;	/* control length		*/
+} xDeviceCtl;
+
+typedef struct {
+    CARD16	control B16;		/* control type		*/
+    CARD16	length B16;		/* control length		*/
+    CARD8	first_valuator;		/* first valuator to change     */
+    CARD8	num_valuators;		/* number of valuators to change*/
+    CARD8	pad1,pad2;
+} xDeviceResolutionCtl;
+
+typedef struct {
+     CARD16         control B16;
+     CARD16         length B16;
+     INT32          min_x;
+     INT32          max_x;
+     INT32          min_y;
+     INT32          max_y;
+     CARD32         flip_x;
+     CARD32         flip_y;
+     CARD32         rotation;
+     CARD32         button_threshold;
+} xDeviceAbsCalibCtl;
+
+typedef struct {
+     CARD16         control B16;
+     CARD16         length B16;
+     CARD32         offset_x;
+     CARD32         offset_y;
+     INT32          width;
+     INT32          height;
+     INT32          screen;
+     CARD32         following;
+} xDeviceAbsAreaCtl;
+
+typedef struct {
+    CARD16          control B16;
+    CARD16          length  B16;
+    CARD8           status;
+    CARD8           pad0;
+    CARD16          pad1 B16;
+} xDeviceCoreCtl;
+
+typedef struct {
+    CARD16          control B16;
+    CARD16          length  B16;
+    CARD8           enable;
+    CARD8           pad0;
+    CARD16          pad1 B16;
+} xDeviceEnableCtl;
+
+/* XI 1.5 */
+
+/*********************************************************
+ *
+ * ListDeviceProperties.
+ *
+ */
+
+typedef struct {
+    CARD8       reqType;        /* input extension major opcode */
+    CARD8       ReqType;        /* always X_ListDeviceProperties */
+    CARD16      length B16;
+    CARD8       deviceid;
+    CARD8       pad0;
+    CARD16      pad1 B16;
+} xListDevicePropertiesReq;
+
+typedef struct {
+    CARD8       repType;        /* X_Reply                       */
+    CARD8       RepType;        /* always X_ListDeviceProperties */
+    CARD16      sequenceNumber B16;
+    CARD32      length B32;
+    CARD16      nAtoms B16;
+    CARD16      pad1 B16;
+    CARD32      pad2 B32;
+    CARD32      pad3 B32;
+    CARD32      pad4 B32;
+    CARD32      pad5 B32;
+    CARD32      pad6 B32;
+} xListDevicePropertiesReply;
+
+/*********************************************************
+ *
+ * ChangeDeviceProperty.
+ *
+ */
+
+typedef struct {
+    CARD8       reqType;        /* input extension major opcode */
+    CARD8       ReqType;        /* always X_ChangeDeviceProperty */
+    CARD16      length B16;
+    Atom        property B32;
+    Atom        type B32;
+    CARD8       deviceid;
+    CARD8       format;
+    CARD8       mode;
+    CARD8       pad;
+    CARD32      nUnits B32;
+} xChangeDevicePropertyReq;
+
+/*********************************************************
+ *
+ * DeleteDeviceProperty.
+ *
+ */
+
+typedef struct {
+    CARD8       reqType;        /* input extension major opcode */
+    CARD8       ReqType;        /* always X_DeleteDeviceProperty */
+    CARD16      length B16;
+    Atom        property B32;
+    CARD8       deviceid;
+    CARD8       pad0;
+    CARD16      pad1 B16;
+} xDeleteDevicePropertyReq;
+
+/*********************************************************
+ *
+ * GetDeviceProperty.
+ *
+ */
+
+typedef struct {
+    CARD8       reqType;        /* input extension major opcode */
+    CARD8       ReqType;        /* always X_GetDeviceProperty */
+    CARD16      length B16;
+    Atom        property B32;
+    Atom        type B32;
+    CARD32      longOffset B32;
+    CARD32      longLength B32;
+    CARD8       deviceid;
+#if defined(__cplusplus) || defined(c_plusplus)
+    BOOL        c_delete;
+#else
+    BOOL        delete;
+#endif
+    CARD16      pad;
+} xGetDevicePropertyReq;
+
+typedef struct {
+    CARD8       repType;        /* X_Reply                        */
+    CARD8       RepType;        /* always X_GetDeviceProperty   */
+    CARD16      sequenceNumber B16;
+    CARD32      length B32;
+    Atom        propertyType B32;
+    CARD32      bytesAfter B32;
+    CARD32      nItems B32;
+    CARD8       format;
+    CARD8       deviceid;
+    CARD16      pad1 B16;
+    CARD32      pad2 B32;
+    CARD32      pad3 B32;
+} xGetDevicePropertyReply;
+
+
+/**********************************************************
+ *
+ * Input extension events.
+ *
+ * DeviceValuator
+ *
+ */
+
+typedef struct
+    {
+    BYTE	type;
+    CARD8       deviceid;
+    CARD16	sequenceNumber B16;
+    KeyButMask  device_state B16;
+    CARD8	num_valuators;
+    CARD8       first_valuator;
+    INT32	valuator0 B32;
+    INT32	valuator1 B32;
+    INT32	valuator2 B32;
+    INT32	valuator3 B32;
+    INT32	valuator4 B32;
+    INT32	valuator5 B32;
+    }  deviceValuator;
+
+/**********************************************************
+ *
+ * DeviceKeyButtonPointer.
+ *
+ * Used for: DeviceKeyPress, DeviceKeyRelease,
+ *	     DeviceButtonPress, DeviceButtonRelease,
+ *	     ProximityIn, ProximityOut
+ *	     DeviceMotionNotify,
+ *
+ */
+
+typedef struct
+    {
+    BYTE	type;
+    BYTE        detail;
+    CARD16	sequenceNumber B16;
+    Time        time B32;
+    Window      root B32;
+    Window      event B32;
+    Window      child B32;
+    INT16       root_x B16;
+    INT16       root_y B16;
+    INT16       event_x B16;
+    INT16       event_y B16;
+    KeyButMask  state B16;
+    BOOL        same_screen;
+    CARD8       deviceid;
+    }  deviceKeyButtonPointer;
+
+/**********************************************************
+ *
+ * DeviceFocus.
+ *
+ */
+
+typedef struct
+    {
+    BYTE	type;
+    BYTE        detail;
+    CARD16	sequenceNumber B16;
+    Time        time B32;
+    Window      window B32;
+    BYTE	mode;
+    CARD8       deviceid;
+    BYTE	pad1, pad2;
+    CARD32	pad00 B32;
+    CARD32	pad01 B32;
+    CARD32	pad02 B32;
+    CARD32	pad03 B32;
+    }  deviceFocus;
+
+/**********************************************************
+ *
+ * DeviceStateNotify.
+ *
+ * Note that the two high-order bits in the classes_reported
+ * field are the proximity state (InProximity or OutOfProximity),
+ * and the device mode (Absolute or Relative), respectively.
+ *
+ */
+
+typedef struct
+    {
+    BYTE	type;
+    BYTE        deviceid;
+    CARD16	sequenceNumber B16;
+    Time        time B32;
+    CARD8	num_keys;
+    CARD8	num_buttons;
+    CARD8	num_valuators;
+    CARD8       classes_reported;
+    CARD8       buttons[4];
+    CARD8       keys[4];
+    INT32	valuator0 B32;
+    INT32	valuator1 B32;
+    INT32	valuator2 B32;
+    }  deviceStateNotify;
+
+/**********************************************************
+ *
+ * DeviceKeyStateNotify.
+ *
+ */
+
+typedef struct
+    {
+    BYTE	type;
+    BYTE        deviceid;
+    CARD16	sequenceNumber B16;
+    CARD8       keys[28];
+    }  deviceKeyStateNotify;
+
+/**********************************************************
+ *
+ * DeviceButtonStateNotify.
+ *
+ */
+
+typedef struct
+    {
+    BYTE	type;
+    BYTE        deviceid;
+    CARD16	sequenceNumber B16;
+    CARD8       buttons[28];
+    }  deviceButtonStateNotify;
+
+/**********************************************************
+ *
+ * DeviceMappingNotify.
+ * Fields must be kept in sync with core mappingnotify event.
+ *
+ */
+
+typedef struct
+    {
+    BYTE	type;
+    BYTE        deviceid;
+    CARD16	sequenceNumber B16;
+    CARD8       request;
+    KeyCode     firstKeyCode;
+    CARD8       count;
+    BYTE        pad1;
+    Time        time B32;
+    CARD32	pad00 B32;
+    CARD32	pad01 B32;
+    CARD32	pad02 B32;
+    CARD32	pad03 B32;
+    CARD32	pad04 B32;
+    }  deviceMappingNotify;
+
+/**********************************************************
+ *
+ * ChangeDeviceNotify.
+ *
+ */
+
+typedef struct
+    {
+    BYTE	type;
+    BYTE        deviceid;
+    CARD16	sequenceNumber B16;
+    Time        time B32;
+    CARD8       request;
+    BYTE        pad1, pad2, pad3;
+    CARD32	pad00 B32;
+    CARD32	pad01 B32;
+    CARD32	pad02 B32;
+    CARD32	pad03 B32;
+    CARD32	pad04 B32;
+    }  changeDeviceNotify;
+
+/**********************************************************
+ *
+ * devicePresenceNotify.
+ *
+ */
+
+typedef struct
+    {
+    BYTE	type;
+    BYTE        pad00;
+    CARD16	sequenceNumber B16;
+    Time        time B32;
+    BYTE        devchange; /* Device{Added|Removed|Enabled|Disabled|ControlChanged} */
+    BYTE        deviceid;
+    CARD16      control B16;
+    CARD32	pad02 B32;
+    CARD32	pad03 B32;
+    CARD32	pad04 B32;
+    CARD32	pad05 B32;
+    CARD32	pad06 B32;
+    }  devicePresenceNotify;
+
+
+/*********************************************************
+ * DevicePropertyNotifyEvent
+ *
+ * Sent whenever a device's property changes.
+ *
+ */
+
+typedef struct
+    {
+    BYTE        type;
+    BYTE        state;               /* NewValue or Deleted */
+    CARD16      sequenceNumber B16;
+    CARD32      time B32;
+    Atom        atom B32;            /* affected property */
+    CARD32      pad0 B32;
+    CARD32      pad1 B32;
+    CARD32      pad2 B32;
+    CARD32      pad3 B32;
+    CARD16      pad5 B16;
+    CARD8       pad4;
+    CARD8       deviceid;            /* id of device */
+    } devicePropertyNotify;
+
+#undef Window
+#undef Time
+#undef KeyCode
+#undef Mask
+#undef Atom
+#undef Cursor
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/XKB.h b/ThirdParty/X11/Include/X11/extensions/XKB.h
new file mode 100644
index 0000000000000000000000000000000000000000..ee4f74076eaafab4a7e1da0b56e6bfa16ca69961
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XKB.h
@@ -0,0 +1,786 @@
+/************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be 
+used in advertising or publicity pertaining to distribution 
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability 
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef _XKB_H_
+#define	_XKB_H_
+
+    /*
+     * XKB request codes, used in:
+     *  -  xkbReqType field of all requests
+     *  -  requestMinor field of some events
+     */
+#define	X_kbUseExtension		 0
+#define	X_kbSelectEvents	 	 1
+#define	X_kbBell			 3
+#define	X_kbGetState			 4
+#define	X_kbLatchLockState		 5
+#define	X_kbGetControls			 6
+#define	X_kbSetControls			 7
+#define	X_kbGetMap			 8
+#define	X_kbSetMap			 9
+#define	X_kbGetCompatMap		10
+#define	X_kbSetCompatMap		11
+#define	X_kbGetIndicatorState		12
+#define	X_kbGetIndicatorMap		13
+#define	X_kbSetIndicatorMap		14
+#define	X_kbGetNamedIndicator		15
+#define	X_kbSetNamedIndicator		16
+#define	X_kbGetNames			17
+#define	X_kbSetNames			18
+#define	X_kbGetGeometry			19
+#define	X_kbSetGeometry			20
+#define	X_kbPerClientFlags		21
+#define	X_kbListComponents		22
+#define	X_kbGetKbdByName		23
+#define	X_kbGetDeviceInfo		24
+#define	X_kbSetDeviceInfo		25
+#define	X_kbSetDebuggingFlags		101
+
+    /*
+     * In the X sense, XKB reports only one event.
+     * The type field of all XKB events is XkbEventCode
+     */
+#define	XkbEventCode			0
+#define	XkbNumberEvents			(XkbEventCode+1)
+
+    /*
+     * XKB has a minor event code so it can use one X event code for 
+     * multiple purposes.  
+     *  - reported in the xkbType field of all XKB events.
+     *  - XkbSelectEventDetails: Indicates the event for which event details 
+     *    are being changed
+     */
+#define	XkbNewKeyboardNotify		0
+#define XkbMapNotify			1
+#define	XkbStateNotify			2
+#define XkbControlsNotify		3
+#define	XkbIndicatorStateNotify		4
+#define	XkbIndicatorMapNotify		5
+#define	XkbNamesNotify			6
+#define XkbCompatMapNotify		7
+#define	XkbBellNotify			8
+#define	XkbActionMessage		9
+#define	XkbAccessXNotify		10
+#define	XkbExtensionDeviceNotify	11
+
+    /*
+     * Event Mask:
+     *  - XkbSelectEvents:  Specifies event interest.
+     */
+#define	XkbNewKeyboardNotifyMask	(1L << 0)
+#define XkbMapNotifyMask		(1L << 1)
+#define	XkbStateNotifyMask		(1L << 2)
+#define XkbControlsNotifyMask		(1L << 3)
+#define	XkbIndicatorStateNotifyMask	(1L << 4)
+#define	XkbIndicatorMapNotifyMask	(1L << 5)
+#define	XkbNamesNotifyMask		(1L << 6)
+#define XkbCompatMapNotifyMask		(1L << 7)
+#define	XkbBellNotifyMask		(1L << 8)
+#define	XkbActionMessageMask		(1L << 9)
+#define	XkbAccessXNotifyMask		(1L << 10)
+#define	XkbExtensionDeviceNotifyMask	(1L << 11)
+#define	XkbAllEventsMask		(0xFFF)
+
+    /*
+     * NewKeyboardNotify event details:
+     */
+#define	XkbNKN_KeycodesMask		(1L << 0)
+#define	XkbNKN_GeometryMask		(1L << 1)
+#define	XkbNKN_DeviceIDMask		(1L << 2)
+#define	XkbAllNewKeyboardEventsMask	(0x7)
+
+    /*
+     * AccessXNotify event types:
+     *  - The 'what' field of AccessXNotify events reports the
+     *    reason that the event was generated.
+     */
+#define	XkbAXN_SKPress			0
+#define	XkbAXN_SKAccept			1
+#define	XkbAXN_SKReject			2
+#define	XkbAXN_SKRelease		3
+#define	XkbAXN_BKAccept			4
+#define	XkbAXN_BKReject			5
+#define	XkbAXN_AXKWarning		6
+
+    /*
+     * AccessXNotify details:
+     * - Used as an event detail mask to limit the conditions under which
+     *   AccessXNotify events are reported
+     */
+#define	XkbAXN_SKPressMask		(1L << 0)
+#define	XkbAXN_SKAcceptMask		(1L << 1)
+#define	XkbAXN_SKRejectMask		(1L << 2)
+#define	XkbAXN_SKReleaseMask		(1L << 3)
+#define	XkbAXN_BKAcceptMask		(1L << 4)
+#define	XkbAXN_BKRejectMask		(1L << 5)
+#define	XkbAXN_AXKWarningMask		(1L << 6)
+#define	XkbAllAccessXEventsMask		(0x7f)
+
+    /*
+     * Miscellaneous event details:
+     * - event detail masks for assorted events that don't reall
+     *   have any details.
+     */
+#define	XkbAllStateEventsMask		XkbAllStateComponentsMask
+#define	XkbAllMapEventsMask		XkbAllMapComponentsMask
+#define	XkbAllControlEventsMask		XkbAllControlsMask
+#define	XkbAllIndicatorEventsMask	XkbAllIndicatorsMask
+#define	XkbAllNameEventsMask		XkbAllNamesMask
+#define	XkbAllCompatMapEventsMask	XkbAllCompatMask
+#define	XkbAllBellEventsMask		(1L << 0)
+#define	XkbAllActionMessagesMask	(1L << 0)
+
+    /*
+     * XKB reports one error:  BadKeyboard
+     * A further reason for the error is encoded into to most significant
+     * byte of the resourceID for the error:
+     *    XkbErr_BadDevice - the device in question was not found
+     *    XkbErr_BadClass  - the device was found but it doesn't belong to 
+     *                       the appropriate class.
+     *    XkbErr_BadId     - the device was found and belongs to the right
+     *                       class, but not feedback with a matching id was
+     *                       found.
+     * The low byte of the resourceID for this error contains the device
+     * id, class specifier or feedback id that failed.
+     */
+#define	XkbKeyboard			0
+#define	XkbNumberErrors			1
+
+#define	XkbErr_BadDevice	0xff
+#define	XkbErr_BadClass		0xfe
+#define	XkbErr_BadId		0xfd
+
+    /*
+     * Keyboard Components Mask:
+     * - Specifies the components that follow a GetKeyboardByNameReply
+     */
+#define	XkbClientMapMask		(1L << 0)
+#define	XkbServerMapMask		(1L << 1)
+#define	XkbCompatMapMask		(1L << 2)
+#define	XkbIndicatorMapMask		(1L << 3)
+#define	XkbNamesMask			(1L << 4)
+#define	XkbGeometryMask			(1L << 5)
+#define	XkbControlsMask			(1L << 6)
+#define	XkbAllComponentsMask		(0x7f)
+
+    /*
+     * State detail mask:
+     *  - The 'changed' field of StateNotify events reports which of
+     *    the keyboard state components have changed.
+     *  - Used as an event detail mask to limit the conditions under
+     *    which StateNotify events are reported.
+     */
+#define	XkbModifierStateMask		(1L << 0)
+#define	XkbModifierBaseMask		(1L << 1)
+#define	XkbModifierLatchMask		(1L << 2)
+#define	XkbModifierLockMask		(1L << 3)
+#define	XkbGroupStateMask		(1L << 4)
+#define	XkbGroupBaseMask		(1L << 5)
+#define	XkbGroupLatchMask		(1L << 6)
+#define XkbGroupLockMask		(1L << 7)
+#define	XkbCompatStateMask		(1L << 8)
+#define	XkbGrabModsMask			(1L << 9)
+#define	XkbCompatGrabModsMask		(1L << 10)
+#define	XkbLookupModsMask		(1L << 11)
+#define	XkbCompatLookupModsMask		(1L << 12)
+#define	XkbPointerButtonMask		(1L << 13)
+#define	XkbAllStateComponentsMask	(0x3fff)
+
+    /*
+     * Controls detail masks:
+     *  The controls specified in XkbAllControlsMask:
+     *  - The 'changed' field of ControlsNotify events reports which of 
+     *    the keyboard controls have changed.
+     *  - The 'changeControls' field of the SetControls request specifies
+     *    the controls for which values are to be changed.
+     *  - Used as an event detail mask to limit the conditions under 
+     *    which ControlsNotify events are reported.
+     *
+     *  The controls specified in the XkbAllBooleanCtrlsMask:
+     *  - The 'enabledControls' field of ControlsNotify events reports the
+     *    current status of the boolean controls.
+     *  - The 'enabledControlsChanges' field of ControlsNotify events reports
+     *    any boolean controls that have been turned on or off.
+     *  - The 'affectEnabledControls' and 'enabledControls' fields of the
+     *    kbSetControls request change the set of enabled controls.
+     *  - The 'accessXTimeoutMask' and 'accessXTimeoutValues' fields of
+     *    an XkbControlsRec specify the controls to be changed if the keyboard
+     *    times out and the values to which they should be changed.
+     *  - The 'autoCtrls' and 'autoCtrlsValues' fields of the PerClientFlags 
+     *    request specifies the specify the controls to be reset when the
+     *    client exits and the values to which they should be reset.
+     *  - The 'ctrls' field of an indicator map specifies the controls
+     *    that drive the indicator.
+     *  - Specifies the boolean controls affected by the SetControls and
+     *    LockControls key actions.
+     */
+#define	XkbRepeatKeysMask	 (1L << 0)
+#define	XkbSlowKeysMask		 (1L << 1)
+#define	XkbBounceKeysMask	 (1L << 2)
+#define	XkbStickyKeysMask	 (1L << 3)
+#define	XkbMouseKeysMask	 (1L << 4)
+#define	XkbMouseKeysAccelMask	 (1L << 5)
+#define	XkbAccessXKeysMask	 (1L << 6)
+#define	XkbAccessXTimeoutMask	 (1L << 7)
+#define	XkbAccessXFeedbackMask	 (1L << 8)
+#define	XkbAudibleBellMask	 (1L << 9)
+#define	XkbOverlay1Mask		 (1L << 10)
+#define	XkbOverlay2Mask		 (1L << 11)
+#define	XkbIgnoreGroupLockMask	 (1L << 12)
+#define	XkbGroupsWrapMask	 (1L << 27)
+#define	XkbInternalModsMask	 (1L << 28)
+#define	XkbIgnoreLockModsMask	 (1L << 29)
+#define	XkbPerKeyRepeatMask	 (1L << 30)
+#define	XkbControlsEnabledMask	 (1L << 31)
+
+#define	XkbAccessXOptionsMask    (XkbStickyKeysMask|XkbAccessXFeedbackMask)
+
+#define	XkbAllBooleanCtrlsMask	 (0x00001FFF)
+#define	XkbAllControlsMask	 (0xF8001FFF)
+#define	XkbAllControlEventsMask	 XkbAllControlsMask
+
+    /*
+     * AccessX Options Mask
+     *  - The 'accessXOptions' field of an XkbControlsRec specifies the
+     *    AccessX options that are currently in effect.
+     *  - The 'accessXTimeoutOptionsMask' and 'accessXTimeoutOptionsValues'
+     *    fields of an XkbControlsRec specify the Access X options to be 
+     *    changed if the keyboard times out and the values to which they 
+     *    should be changed.
+     */
+#define	XkbAX_SKPressFBMask	(1L << 0)
+#define	XkbAX_SKAcceptFBMask	(1L << 1)
+#define	XkbAX_FeatureFBMask	(1L << 2)
+#define	XkbAX_SlowWarnFBMask	(1L << 3)
+#define	XkbAX_IndicatorFBMask	(1L << 4)
+#define	XkbAX_StickyKeysFBMask	(1L << 5)
+#define	XkbAX_TwoKeysMask	(1L << 6)
+#define	XkbAX_LatchToLockMask	(1L << 7)
+#define	XkbAX_SKReleaseFBMask	(1L << 8)
+#define	XkbAX_SKRejectFBMask	(1L << 9)
+#define	XkbAX_BKRejectFBMask	(1L << 10)
+#define	XkbAX_DumbBellFBMask	(1L << 11)
+#define	XkbAX_FBOptionsMask	(0xF3F)
+#define	XkbAX_SKOptionsMask	(0x0C0)
+#define	XkbAX_AllOptionsMask	(0xFFF)
+
+    /*
+     * XkbUseCoreKbd is used to specify the core keyboard without having
+     * 			to look up its X input extension identifier.
+     * XkbUseCorePtr is used to specify the core pointer without having
+     *			to look up its X input extension identifier.
+     * XkbDfltXIClass is used to specify "don't care" any place that the
+     *			XKB protocol is looking for an X Input Extension 
+     *			device class.
+     * XkbDfltXIId is used to specify "don't care" any place that the
+     *			XKB protocol is looking for an X Input Extension
+     *			feedback identifier.
+     * XkbAllXIClasses is used to get information about all device indicators,
+     *			whether they're part of the indicator feedback class
+     *			or the keyboard feedback class.
+     * XkbAllXIIds is used to get information about all device indicator
+     *			feedbacks without having to list them.
+     * XkbXINone is used to indicate that no class or id has been specified.
+     * XkbLegalXILedClass(c)  True if 'c' specifies a legal class with LEDs
+     * XkbLegalXIBellClass(c) True if 'c' specifies a legal class with bells
+     * XkbExplicitXIDevice(d) True if 'd' explicitly specifies a device
+     * XkbExplicitXIClass(c)  True if 'c' explicitly specifies a device class
+     * XkbExplicitXIId(c)     True if 'i' explicitly specifies a device id
+     * XkbSingleXIClass(c)    True if 'c' specifies exactly one device class, 
+     *                        including the default.
+     * XkbSingleXIId(i)       True if 'i' specifies exactly one device 
+     *	                      identifier, including the default.
+     */
+#define	XkbUseCoreKbd		0x0100
+#define	XkbUseCorePtr		0x0200
+#define	XkbDfltXIClass		0x0300
+#define	XkbDfltXIId		0x0400
+#define	XkbAllXIClasses		0x0500
+#define	XkbAllXIIds		0x0600
+#define	XkbXINone		0xff00
+
+#define	XkbLegalXILedClass(c)	(((c)==KbdFeedbackClass)||\
+					((c)==LedFeedbackClass)||\
+					((c)==XkbDfltXIClass)||\
+					((c)==XkbAllXIClasses))
+#define	XkbLegalXIBellClass(c)	(((c)==KbdFeedbackClass)||\
+					((c)==BellFeedbackClass)||\
+					((c)==XkbDfltXIClass)||\
+					((c)==XkbAllXIClasses))
+#define	XkbExplicitXIDevice(c)	(((c)&(~0xff))==0)
+#define	XkbExplicitXIClass(c)	(((c)&(~0xff))==0)
+#define	XkbExplicitXIId(c)	(((c)&(~0xff))==0)
+#define	XkbSingleXIClass(c)	((((c)&(~0xff))==0)||((c)==XkbDfltXIClass))
+#define	XkbSingleXIId(c)	((((c)&(~0xff))==0)||((c)==XkbDfltXIId))
+
+#define	XkbNoModifier		0xff
+#define	XkbNoShiftLevel		0xff
+#define	XkbNoShape		0xff
+#define	XkbNoIndicator		0xff
+
+#define	XkbNoModifierMask	0
+#define	XkbAllModifiersMask	0xff
+#define	XkbAllVirtualModsMask	0xffff
+
+#define	XkbNumKbdGroups		4
+#define	XkbMaxKbdGroup		(XkbNumKbdGroups-1)
+
+#define	XkbMaxMouseKeysBtn	4
+
+    /*
+     * Group Index and Mask:
+     *  - Indices into the kt_index array of a key type.
+     *  - Mask specifies types to be changed for XkbChangeTypesOfKey
+     */
+#define	XkbGroup1Index		0
+#define	XkbGroup2Index		1
+#define	XkbGroup3Index		2
+#define	XkbGroup4Index		3
+#define	XkbAnyGroup		254
+#define	XkbAllGroups		255
+
+#define	XkbGroup1Mask		(1<<0)
+#define	XkbGroup2Mask		(1<<1)
+#define	XkbGroup3Mask		(1<<2)
+#define	XkbGroup4Mask		(1<<3)
+#define	XkbAnyGroupMask		(1<<7)
+#define	XkbAllGroupsMask	(0xf)
+
+    /*
+     * BuildCoreState: Given a keyboard group and a modifier state,
+     *                 construct the value to be reported an event.
+     * GroupForCoreState:  Given the state reported in an event,
+     *                 determine the keyboard group.
+     * IsLegalGroup:   Returns TRUE if 'g' is a valid group index.
+     */
+#define	XkbBuildCoreState(m,g)	((((g)&0x3)<<13)|((m)&0xff))
+#define XkbGroupForCoreState(s)	(((s)>>13)&0x3)
+#define	XkbIsLegalGroup(g)	(((g)>=0)&&((g)<XkbNumKbdGroups))
+
+    /*
+     * GroupsWrap values:
+     *  - The 'groupsWrap' field of an XkbControlsRec specifies the
+     *    treatment of out of range groups.
+     *  - Bits 6 and 7 of the group info field of a key symbol map
+     *    specify the interpretation of out of range groups for the
+     *    corresponding key.
+     */
+#define	XkbWrapIntoRange	(0x00)
+#define	XkbClampIntoRange	(0x40)
+#define	XkbRedirectIntoRange	(0x80)
+
+    /*
+     * Action flags:  Reported in the 'flags' field of most key actions.
+     * Interpretation depends on the type of the action; not all actions
+     * accept all flags.
+     *
+     * Option			Used for Actions
+     * ------			----------------
+     * ClearLocks		SetMods, LatchMods, SetGroup, LatchGroup
+     * LatchToLock		SetMods, LatchMods, SetGroup, LatchGroup
+     * LockNoLock		LockMods, ISOLock, LockPtrBtn, LockDeviceBtn
+     * LockNoUnlock		LockMods, ISOLock, LockPtrBtn, LockDeviceBtn
+     * UseModMapMods		SetMods, LatchMods, LockMods, ISOLock
+     * GroupAbsolute		SetGroup, LatchGroup, LockGroup, ISOLock
+     * UseDfltButton		PtrBtn, LockPtrBtn
+     * NoAcceleration		MovePtr
+     * MoveAbsoluteX		MovePtr
+     * MoveAbsoluteY		MovePtr
+     * ISODfltIsGroup		ISOLock
+     * ISONoAffectMods		ISOLock
+     * ISONoAffectGroup		ISOLock
+     * ISONoAffectPtr		ISOLock
+     * ISONoAffectCtrls		ISOLock
+     * MessageOnPress		ActionMessage
+     * MessageOnRelease		ActionMessage
+     * MessageGenKeyEvent	ActionMessage
+     * AffectDfltBtn		SetPtrDflt
+     * DfltBtnAbsolute		SetPtrDflt
+     * SwitchApplication	SwitchScreen
+     * SwitchAbsolute		SwitchScreen
+     */
+
+#define	XkbSA_ClearLocks	(1L << 0)
+#define	XkbSA_LatchToLock	(1L << 1)
+
+#define	XkbSA_LockNoLock	(1L << 0)
+#define	XkbSA_LockNoUnlock	(1L << 1)
+
+#define	XkbSA_UseModMapMods	(1L << 2)
+
+#define	XkbSA_GroupAbsolute	(1L << 2)
+#define	XkbSA_UseDfltButton	0
+
+#define	XkbSA_NoAcceleration	(1L << 0)
+#define	XkbSA_MoveAbsoluteX	(1L << 1)
+#define	XkbSA_MoveAbsoluteY	(1L << 2)
+
+#define	XkbSA_ISODfltIsGroup 	 (1L << 7)
+#define	XkbSA_ISONoAffectMods	 (1L << 6)
+#define	XkbSA_ISONoAffectGroup	 (1L << 5)
+#define	XkbSA_ISONoAffectPtr	 (1L << 4)
+#define	XkbSA_ISONoAffectCtrls	 (1L << 3)
+#define	XkbSA_ISOAffectMask	 (0x78)
+
+#define	XkbSA_MessageOnPress	 (1L << 0)
+#define	XkbSA_MessageOnRelease	 (1L << 1)
+#define	XkbSA_MessageGenKeyEvent (1L << 2)
+
+#define	XkbSA_AffectDfltBtn	1
+#define	XkbSA_DfltBtnAbsolute	(1L << 2)
+
+#define	XkbSA_SwitchApplication	(1L << 0)
+#define	XkbSA_SwitchAbsolute	(1L << 2)
+
+    /*
+     * The following values apply to the SA_DeviceValuator 
+     * action only.  Valuator operations specify the action 
+     * to be taken.   Values specified in the action are 
+     * multiplied by 2^scale before they are applied.
+     */
+#define	XkbSA_IgnoreVal		(0x00)
+#define	XkbSA_SetValMin		(0x10)
+#define	XkbSA_SetValCenter	(0x20)
+#define	XkbSA_SetValMax		(0x30)
+#define	XkbSA_SetValRelative	(0x40)
+#define	XkbSA_SetValAbsolute	(0x50)
+#define	XkbSA_ValOpMask		(0x70)
+#define	XkbSA_ValScaleMask	(0x07)
+#define	XkbSA_ValOp(a)		((a)&XkbSA_ValOpMask)
+#define	XkbSA_ValScale(a)	((a)&XkbSA_ValScaleMask)
+
+    /*
+     * Action types: specifies the type of a key action.  Reported in the
+     * type field of all key actions.
+     */
+#define	XkbSA_NoAction		0x00
+#define	XkbSA_SetMods		0x01
+#define	XkbSA_LatchMods		0x02
+#define	XkbSA_LockMods		0x03
+#define	XkbSA_SetGroup		0x04
+#define	XkbSA_LatchGroup	0x05
+#define	XkbSA_LockGroup		0x06
+#define	XkbSA_MovePtr		0x07
+#define	XkbSA_PtrBtn		0x08
+#define	XkbSA_LockPtrBtn	0x09
+#define	XkbSA_SetPtrDflt	0x0a
+#define	XkbSA_ISOLock		0x0b
+#define	XkbSA_Terminate		0x0c
+#define	XkbSA_SwitchScreen	0x0d
+#define	XkbSA_SetControls	0x0e
+#define	XkbSA_LockControls	0x0f
+#define	XkbSA_ActionMessage	0x10
+#define	XkbSA_RedirectKey	0x11
+#define	XkbSA_DeviceBtn		0x12
+#define	XkbSA_LockDeviceBtn	0x13
+#define	XkbSA_DeviceValuator	0x14
+#define	XkbSA_LastAction	XkbSA_DeviceValuator
+#define	XkbSA_NumActions	(XkbSA_LastAction+1)
+
+#define	XkbSA_XFree86Private	0x86
+
+    /*
+     * Specifies the key actions that clear latched groups or modifiers.
+     */
+#define	XkbSA_BreakLatch \
+	((1<<XkbSA_NoAction)|(1<<XkbSA_PtrBtn)|(1<<XkbSA_LockPtrBtn)|\
+	(1<<XkbSA_Terminate)|(1<<XkbSA_SwitchScreen)|(1<<XkbSA_SetControls)|\
+	(1<<XkbSA_LockControls)|(1<<XkbSA_ActionMessage)|\
+	(1<<XkbSA_RedirectKey)|(1<<XkbSA_DeviceBtn)|(1<<XkbSA_LockDeviceBtn))
+	 
+    /*
+     * Macros to classify key actions
+     */
+#define	XkbIsModAction(a)	(((a)->type>=Xkb_SASetMods)&&((a)->type<=XkbSA_LockMods))
+#define	XkbIsGroupAction(a)	(((a)->type>=XkbSA_SetGroup)&&((a)->type<=XkbSA_LockGroup))
+#define	XkbIsPtrAction(a)	(((a)->type>=XkbSA_MovePtr)&&((a)->type<=XkbSA_SetPtrDflt))
+
+
+    /*
+     * Key Behavior Qualifier:
+     *    KB_Permanent indicates that the behavior describes an unalterable
+     *    characteristic of the keyboard, not an XKB software-simulation of
+     *    the listed behavior.
+     * Key Behavior Types:  
+     *    Specifies the behavior of the underlying key.
+     */
+#define	XkbKB_Permanent		0x80
+#define	XkbKB_OpMask		0x7f
+
+#define	XkbKB_Default		0x00
+#define	XkbKB_Lock		0x01
+#define	XkbKB_RadioGroup	0x02
+#define	XkbKB_Overlay1		0x03
+#define	XkbKB_Overlay2		0x04
+
+#define	XkbKB_RGAllowNone	0x80
+
+    /*
+     * Various macros which describe the range of legal keycodes.
+     */
+#define	XkbMinLegalKeyCode	8
+#define	XkbMaxLegalKeyCode	255
+#define	XkbMaxKeyCount		(XkbMaxLegalKeyCode-XkbMinLegalKeyCode+1)
+#define	XkbPerKeyBitArraySize	((XkbMaxLegalKeyCode+1)/8)
+/* Seems kinda silly to check that an unsigned char is <= 255... */
+#define	XkbIsLegalKeycode(k)	((k)>=XkbMinLegalKeyCode)
+
+    /*
+     * Assorted constants and limits.
+     */
+#define	XkbNumModifiers		8
+#define	XkbNumVirtualMods	16
+#define	XkbNumIndicators	32
+#define	XkbAllIndicatorsMask	(0xffffffff)
+#define	XkbMaxRadioGroups	32
+#define	XkbAllRadioGroupsMask	(0xffffffff)
+#define	XkbMaxShiftLevel	63
+#define	XkbMaxSymsPerKey	(XkbMaxShiftLevel*XkbNumKbdGroups)
+#define	XkbRGMaxMembers		12
+#define	XkbActionMessageLength	6
+#define	XkbKeyNameLength	4
+#define	XkbMaxRedirectCount	8
+
+#define	XkbGeomPtsPerMM		10
+#define	XkbGeomMaxColors	32
+#define	XkbGeomMaxLabelColors	3
+#define	XkbGeomMaxPriority	255
+
+    /*
+     * Key Type index and mask for the four standard key types.
+     */
+#define	XkbOneLevelIndex	0
+#define	XkbTwoLevelIndex	1
+#define	XkbAlphabeticIndex	2
+#define	XkbKeypadIndex		3
+#define	XkbLastRequiredType	XkbKeypadIndex
+#define	XkbNumRequiredTypes	(XkbLastRequiredType+1)
+#define	XkbMaxKeyTypes		255
+
+#define	XkbOneLevelMask		(1<<0)
+#define	XkbTwoLevelMask		(1<<1)
+#define	XkbAlphabeticMask	(1<<2)
+#define	XkbKeypadMask		(1<<3)
+#define	XkbAllRequiredTypes	(0xf)
+
+#define	XkbShiftLevel(n)	((n)-1)
+#define	XkbShiftLevelMask(n)	(1<<((n)-1))
+
+    /*
+     * Extension name and version information
+     */
+#define	XkbName "XKEYBOARD"
+#define	XkbMajorVersion	1
+#define	XkbMinorVersion	0
+
+    /*
+     * Explicit map components:
+     *  - Used in the 'explicit' field of an XkbServerMap.  Specifies
+     *    the keyboard components that should _not_ be updated automatically
+     *    in response to core protocol keyboard mapping requests.
+     */
+#define	XkbExplicitKeyTypesMask	  (0x0f)
+#define	XkbExplicitKeyType1Mask	  (1<<0)
+#define	XkbExplicitKeyType2Mask	  (1<<1)
+#define	XkbExplicitKeyType3Mask	  (1<<2)
+#define	XkbExplicitKeyType4Mask	  (1<<3)
+#define	XkbExplicitInterpretMask  (1<<4)
+#define	XkbExplicitAutoRepeatMask (1<<5)
+#define	XkbExplicitBehaviorMask	  (1<<6)
+#define	XkbExplicitVModMapMask	  (1<<7)
+#define	XkbAllExplicitMask	  (0xff)
+
+    /*
+     * Map components masks:
+     * Those in AllMapComponentsMask:
+     *  - Specifies the individual fields to be loaded or changed for the
+     *    GetMap and SetMap requests.
+     * Those in ClientInfoMask:
+     *  - Specifies the components to be allocated by XkbAllocClientMap.
+     * Those in ServerInfoMask:
+     *  - Specifies the components to be allocated by XkbAllocServerMap.
+     */
+#define	XkbKeyTypesMask		(1<<0)
+#define	XkbKeySymsMask		(1<<1)
+#define	XkbModifierMapMask	(1<<2)
+#define	XkbExplicitComponentsMask (1<<3)
+#define XkbKeyActionsMask	(1<<4)
+#define	XkbKeyBehaviorsMask	(1<<5)
+#define	XkbVirtualModsMask	(1<<6)
+#define	XkbVirtualModMapMask	(1<<7)
+
+#define	XkbAllClientInfoMask	(XkbKeyTypesMask|XkbKeySymsMask|XkbModifierMapMask)
+#define	XkbAllServerInfoMask	(XkbExplicitComponentsMask|XkbKeyActionsMask|XkbKeyBehaviorsMask|XkbVirtualModsMask|XkbVirtualModMapMask)
+#define	XkbAllMapComponentsMask	(XkbAllClientInfoMask|XkbAllServerInfoMask)
+
+    /*
+     * Symbol interpretations flags:
+     *  - Used in the flags field of a symbol interpretation
+     */
+#define	XkbSI_AutoRepeat	(1<<0)
+#define	XkbSI_LockingKey	(1<<1)
+
+    /*
+     * Symbol interpretations match specification:
+     *  - Used in the match field of a symbol interpretation to specify 
+     *    the conditions under which an interpretation is used.
+     */
+#define	XkbSI_LevelOneOnly	(0x80)
+#define	XkbSI_OpMask		(0x7f)
+#define	XkbSI_NoneOf		(0)
+#define	XkbSI_AnyOfOrNone	(1)
+#define	XkbSI_AnyOf		(2)
+#define	XkbSI_AllOf		(3)
+#define	XkbSI_Exactly		(4)
+
+    /*
+     * Indicator map flags:
+     *  - Used in the flags field of an indicator map to indicate the
+     *    conditions under which and indicator can be changed and the
+     *    effects of changing the indicator.
+     */
+#define	XkbIM_NoExplicit	(1L << 7)
+#define	XkbIM_NoAutomatic	(1L << 6)
+#define	XkbIM_LEDDrivesKB	(1L << 5)
+
+    /*
+     * Indicator map component specifications:
+     *  - Used by the 'which_groups' and 'which_mods' fields of an indicator
+     *    map to specify which keyboard components should be used to drive
+     *    the indicator.
+     */
+#define	XkbIM_UseBase		(1L << 0)
+#define	XkbIM_UseLatched	(1L << 1)
+#define	XkbIM_UseLocked		(1L << 2)
+#define	XkbIM_UseEffective	(1L << 3)
+#define	XkbIM_UseCompat		(1L << 4)
+
+#define	XkbIM_UseNone	  0
+#define	XkbIM_UseAnyGroup (XkbIM_UseBase|XkbIM_UseLatched|XkbIM_UseLocked\
+                           |XkbIM_UseEffective)
+#define	XkbIM_UseAnyMods  (XkbIM_UseAnyGroup|XkbIM_UseCompat)
+
+    /*
+     * Compatibility Map Compontents:
+     *  - Specifies the components to be allocated in XkbAllocCompatMap.
+     */
+#define	XkbSymInterpMask	(1<<0)
+#define	XkbGroupCompatMask	(1<<1)
+#define	XkbAllCompatMask	(0x3)
+
+    /*
+     * Names component mask:
+     *  - Specifies the names to be loaded or changed for the GetNames and
+     *    SetNames requests.
+     *  - Specifies the names that have changed in a NamesNotify event.
+     *  - Specifies the names components to be allocated by XkbAllocNames.
+     */
+#define	XkbKeycodesNameMask	(1<<0)
+#define	XkbGeometryNameMask	(1<<1)
+#define	XkbSymbolsNameMask	(1<<2)
+#define	XkbPhysSymbolsNameMask	(1<<3)
+#define	XkbTypesNameMask	(1<<4)
+#define	XkbCompatNameMask 	(1<<5)
+#define	XkbKeyTypeNamesMask	(1<<6)
+#define	XkbKTLevelNamesMask	(1<<7)
+#define	XkbIndicatorNamesMask	(1<<8)
+#define	XkbKeyNamesMask		(1<<9)
+#define	XkbKeyAliasesMask	(1<<10)
+#define	XkbVirtualModNamesMask	(1<<11)
+#define	XkbGroupNamesMask	(1<<12)
+#define	XkbRGNamesMask		(1<<13)
+#define	XkbComponentNamesMask	(0x3f)
+#define	XkbAllNamesMask		(0x3fff)
+
+    /*
+     * GetByName components:
+     *  - Specifies desired or necessary components to GetKbdByName request.
+     *  - Reports the components that were found in a GetKbdByNameReply
+     */
+#define	XkbGBN_TypesMask		(1L << 0)
+#define	XkbGBN_CompatMapMask		(1L << 1)
+#define	XkbGBN_ClientSymbolsMask	(1L << 2)
+#define	XkbGBN_ServerSymbolsMask	(1L << 3)
+#define	XkbGBN_SymbolsMask (XkbGBN_ClientSymbolsMask|XkbGBN_ServerSymbolsMask)
+#define	XkbGBN_IndicatorMapMask		(1L << 4)
+#define	XkbGBN_KeyNamesMask		(1L << 5)
+#define	XkbGBN_GeometryMask		(1L << 6)
+#define	XkbGBN_OtherNamesMask		(1L << 7)
+#define	XkbGBN_AllComponentsMask	(0xff)
+
+     /*
+      * ListComponents flags
+      */
+#define	XkbLC_Hidden			(1L <<  0)
+#define	XkbLC_Default			(1L <<  1)
+#define	XkbLC_Partial			(1L <<  2)
+
+#define	XkbLC_AlphanumericKeys		(1L <<  8)
+#define	XkbLC_ModifierKeys		(1L <<  9)
+#define	XkbLC_KeypadKeys		(1L << 10)
+#define	XkbLC_FunctionKeys		(1L << 11)
+#define	XkbLC_AlternateGroup		(1L << 12)
+
+    /*
+     * X Input Extension Interactions
+     * - Specifies the possible interactions between XKB and the X input
+     *   extension
+     * - Used to request (XkbGetDeviceInfo) or change (XKbSetDeviceInfo)
+     *   XKB information about an extension device.
+     * - Reports the list of supported optional features in the reply to
+     *   XkbGetDeviceInfo or in an XkbExtensionDeviceNotify event.
+     * XkbXI_UnsupportedFeature is reported in XkbExtensionDeviceNotify
+     * events to indicate an attempt to use an unsupported feature.
+     */
+#define	XkbXI_KeyboardsMask		(1L << 0)
+#define	XkbXI_ButtonActionsMask		(1L << 1)
+#define	XkbXI_IndicatorNamesMask	(1L << 2)
+#define	XkbXI_IndicatorMapsMask		(1L << 3)
+#define	XkbXI_IndicatorStateMask	(1L << 4)
+#define	XkbXI_UnsupportedFeatureMask	(1L << 15)
+#define	XkbXI_AllFeaturesMask		(0x001f)
+#define	XkbXI_AllDeviceFeaturesMask	(0x001e)
+
+#define	XkbXI_IndicatorsMask		(0x001c)
+#define	XkbAllExtensionDeviceEventsMask (0x801f)
+
+    /*
+     * Per-Client Flags:
+     *  - Specifies flags to be changed by the PerClientFlags request.
+     */
+#define	XkbPCF_DetectableAutoRepeatMask	(1L << 0)
+#define	XkbPCF_GrabsUseXKBStateMask	(1L << 1)
+#define	XkbPCF_AutoResetControlsMask	(1L << 2)
+#define	XkbPCF_LookupStateWhenGrabbed	(1L << 3)
+#define	XkbPCF_SendEventUsesXKBState	(1L << 4)
+#define	XkbPCF_AllFlagsMask		(0x1F)
+
+    /*
+     * Debugging flags and controls
+     */
+#define	XkbDF_DisableLocks	(1<<0)
+
+#endif /* _XKB_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/XKBbells.h b/ThirdParty/X11/Include/X11/extensions/XKBbells.h
new file mode 100644
index 0000000000000000000000000000000000000000..585b36a05f4c0b59657d9da115ad975180913548
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XKBbells.h
@@ -0,0 +1,141 @@
+#ifndef _XKBBELLS_H_
+#define	_XKBBELLS_H_ 1
+
+/************************************************************
+ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc.
+
+ Permission to use, copy, modify, and distribute this
+ software and its documentation for any purpose and without
+ fee is hereby granted, provided that the above copyright
+ notice appear in all copies and that both that copyright
+ notice and this permission notice appear in supporting
+ documentation, and that the name of Silicon Graphics not be
+ used in advertising or publicity pertaining to distribution
+ of the software without specific prior written permission.
+ Silicon Graphics makes no representation about the suitability
+ of this software for any purpose. It is provided "as is"
+ without any express or implied warranty.
+
+ SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+ GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+ THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+ ********************************************************/
+
+#define	XkbBN_Info			"Info"
+#define	XkbBN_Warning			"Warning"
+#define	XkbBN_MinorError		"MinorError"
+#define	XkbBN_MajorError		"MajorError"
+#define	XkbBN_BadValue			"BadValue"
+#define	XkbBN_InvalidLocation		"InvalidLocation"
+#define	XkbBN_Question			"Question"
+#define	XkbBN_Start			"Start"
+#define	XkbBN_End			"End"
+#define	XkbBN_Success			"Success"
+#define	XkbBN_Failure			"Failure"
+#define	XkbBN_Wait			"Wait"
+#define	XkbBN_Proceed			"Proceed"
+#define	XkbBN_Ignore			"Ignore"
+#define	XkbBN_Iconify			"Iconify"
+#define	XkbBN_Deiconify			"Deconify"
+#define	XkbBN_Open			"Open"
+#define	XkbBN_Close			"Close"
+#define	XkbBN_TerminalBell		"TerminalBell"
+#define	XkbBN_MarginBell		"MarginBell"
+#define	XkbBN_CursorStuck		"CursorStuck"
+#define	XkbBN_NewMail			"NewMail"
+#define	XkbBN_LaunchApp			"LaunchApp"
+#define	XkbBN_AppDeath			"AppDeath"
+#define	XkbBN_ImAlive			"ImAlive"
+#define	XkbBN_ClockChimeHour		"ClockChimeHour"
+#define	XkbBN_ClockChimeHalf		"ClockChimeHalf"
+#define	XkbBN_ClockChimeQuarter		"ClockChimeQuarter"
+#define	XkbBN_RepeatingLastBell		"RepeatingLastBell"
+#define XkbBN_ComposeFail		"ComposeFail"
+#define	XkbBN_AX_FeatureOn		"AX_FeatureOn"
+#define	XkbBN_AX_FeatureOff		"AX_FeatureOff"
+#define	XkbBN_AX_FeatureChange		"AX_FeatureChange"
+#define	XkbBN_AX_IndicatorOn		"AX_IndicatorOn"
+#define	XkbBN_AX_IndicatorOff		"AX_IndicatorOff"
+#define	XkbBN_AX_IndicatorChange	"AX_IndicatorChange"
+#define	XkbBN_AX_SlowKeysWarning	"AX_SlowKeysWarning"
+#define	XkbBN_AX_SlowKeyPress		"AX_SlowKeyPress"
+#define	XkbBN_AX_SlowKeyAccept		"AX_SlowKeyAccept"
+#define	XkbBN_AX_SlowKeyReject		"AX_SlowKeyReject"
+#define	XkbBN_AX_SlowKeyRelease		"AX_SlowKeyRelease"
+#define	XkbBN_AX_BounceKeyReject	"AX_BounceKeyReject"
+#define	XkbBN_AX_StickyLatch		"AX_StickyLatch"
+#define	XkbBN_AX_StickyLock		"AX_StickyLock"
+#define	XkbBN_AX_StickyUnlock		"AX_StickyUnlock"
+
+#define	XkbBI_Info			0
+#define	XkbBI_Warning			1
+#define	XkbBI_MinorError		2
+#define	XkbBI_MajorError		3
+#define	XkbBI_BadValue			4
+#define	XkbBI_InvalidLocation		5
+#define	XkbBI_Question			6
+#define	XkbBI_Start			7
+#define	XkbBI_End			8
+#define	XkbBI_Success			9
+#define	XkbBI_Failure			10
+#define	XkbBI_Wait			11
+#define	XkbBI_Proceed			12
+#define	XkbBI_Ignore			13
+#define	XkbBI_Iconify			14
+#define	XkbBI_Deiconify			15
+#define	XkbBI_Open			16
+#define	XkbBI_Close			17
+#define	XkbBI_TerminalBell		18
+#define	XkbBI_MarginBell		19
+#define	XkbBI_CursorStuck		20
+#define	XkbBI_NewMail			21
+#define	XkbBI_LaunchApp			22
+#define	XkbBI_AppDeath			23
+#define	XkbBI_ImAlive			24
+#define	XkbBI_ClockChimeHour		25
+#define	XkbBI_ClockChimeHalf		26
+#define	XkbBI_ClockChimeQuarter		27
+#define	XkbBI_RepeatingLastBell		28
+#define	XkbBI_ComposeFail		29
+#define	XkbBI_AX_FeatureOn		30
+#define	XkbBI_AX_FeatureOff		31
+#define	XkbBI_AX_FeatureChange		32
+#define	XkbBI_AX_IndicatorOn		33
+#define	XkbBI_AX_IndicatorOff		34
+#define	XkbBI_AX_IndicatorChange	35
+#define	XkbBI_AX_SlowKeysWarning	36
+#define	XkbBI_AX_SlowKeyPress		37
+#define	XkbBI_AX_SlowKeyAccept		38
+#define	XkbBI_AX_SlowKeyReject		39
+#define	XkbBI_AX_SlowKeyRelease		40
+#define	XkbBI_AX_BounceKeyReject	41
+#define	XkbBI_AX_StickyLatch		42
+#define	XkbBI_AX_StickyLock		43
+#define	XkbBI_AX_StickyUnlock		44
+#define	XkbBI_NumBells			45
+
+_XFUNCPROTOBEGIN
+
+extern	Bool XkbStdBell(
+	Display *	/* dpy */,
+	Window		/* win */,
+	int		/* percent */,
+	int		/* bellDef */
+);
+
+extern	Bool XkbStdBellEvent(
+	Display *	/* dpy */,
+	Window		/* win */,
+	int		/* percent */,
+	int		/* bellDef */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _XKBBELLS_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/XKBconfig.h b/ThirdParty/X11/Include/X11/extensions/XKBconfig.h
new file mode 100644
index 0000000000000000000000000000000000000000..668a358388b3813249d9c4fa9846879fa09c5db9
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XKBconfig.h
@@ -0,0 +1,278 @@
+#ifndef _XKBCONFIG_H_
+#define	_XKBCONFIG_H_ 1
+
+/************************************************************
+ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc.
+
+ Permission to use, copy, modify, and distribute this
+ software and its documentation for any purpose and without
+ fee is hereby granted, provided that the above copyright
+ notice appear in all copies and that both that copyright
+ notice and this permission notice appear in supporting
+ documentation, and that the name of Silicon Graphics not be
+ used in advertising or publicity pertaining to distribution
+ of the software without specific prior written permission.
+ Silicon Graphics makes no representation about the suitability
+ of this software for any purpose. It is provided "as is"
+ without any express or implied warranty.
+
+ SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+ GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+ THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+ ********************************************************/
+
+
+typedef struct _XkbConfigRtrn	*XkbConfigRtrnPtr;
+typedef struct _XkbConfigField	*XkbConfigFieldPtr;
+typedef struct _XkbConfigFields	*XkbConfigFieldsPtr;
+
+typedef Bool (*XkbConfigParseFunc)(
+	FILE *				/* file */,
+	XkbConfigFieldsPtr		/* fields */,
+	XkbConfigFieldPtr		/* field */,
+	XkbDescPtr			/* xkb */,
+	XkbConfigRtrnPtr		/* rtrn */
+);
+
+#define	XkbCF_Check	0
+#define	XkbCF_Apply	1
+#define	XkbCF_CleanUp	2
+#define	XkbCF_Destroy	3
+
+typedef	Bool (*XkbConfigFinishFunc)(
+	XkbConfigFieldsPtr		/* fields */,
+	XkbDescPtr			/* xkb */,
+	XkbConfigRtrnPtr		/* rtrn */,
+	int				/* what */
+);
+
+typedef struct _XkbConfigRtrnPriv {
+	int				cfg_id;
+	XPointer			priv;
+	struct _XkbConfigRtrnPriv *	next;
+} XkbConfigRtrnPrivRec,*XkbConfigRtrnPrivPtr;
+
+typedef struct _XkbConfigModInfo {
+	Bool			replace;
+	unsigned char		mods;
+	unsigned char		mods_clear;
+	unsigned short		vmods;
+	unsigned short		vmods_clear;
+} XkbConfigModInfoRec,*XkbConfigModInfoPtr;
+
+typedef struct _XkbConfigUnboundMod {
+	unsigned char		what;
+	unsigned char		mods;
+	unsigned short		vmods;
+	short			merge;
+	char *			name;
+} XkbConfigUnboundModRec,*XkbConfigUnboundModPtr;
+
+#define	XkbCF_MergeSet			0
+#define	XkbCF_MergeAdd			1
+#define	XkbCF_MergeRemove		2
+
+#define	XkbCF_InitialMods		(1L<<0)
+#define	XkbCF_InternalMods		(1L<<1)
+#define	XkbCF_IgnoreLockMods		(1L<<2)
+#define	XkbCF_InitialCtrls		(1L<<3)
+#define	XkbCF_AccessXTimeout		(1L<<4)
+#define	XkbCF_AccessXTimeoutCtrlsOn	(1L<<5)
+#define	XkbCF_AccessXTimeoutCtrlsOff	(1L<<6)
+#define	XkbCF_AccessXTimeoutOptsOn	(1L<<7)
+#define	XkbCF_AccessXTimeoutOptsOff	(1L<<8)
+#define	XkbCF_GroupsWrap		(1L<<9)
+#define	XkbCF_InitialOpts		(1L<<10)
+
+typedef struct _XkbConfigRtrn {
+	unsigned		defined;
+	int			error;
+	int			line;
+
+	int			click_volume;
+	int			bell_volume;
+	int			bell_pitch;
+	int			bell_duration;
+	int			repeat_delay;
+	int			repeat_interval;
+
+	char *			rules_file;
+	char *			model;
+	char *			layout;
+	char *			variant;
+	char *			options;
+
+	char *			keymap;
+	char *			keycodes;
+	char *			geometry;
+	char *			phys_symbols;
+	char *			symbols;
+	char *			types;
+	char *			compat;
+
+	Bool			replace_initial_ctrls;
+	unsigned long		initial_ctrls;
+	unsigned long		initial_ctrls_clear;
+
+	Bool			replace_initial_opts;
+	unsigned short		initial_opts;
+	unsigned short		initial_opts_clear;
+
+	XkbConfigModInfoRec	initial_mods;
+	XkbConfigModInfoRec	internal_mods;
+	XkbConfigModInfoRec	ignore_lock_mods;
+
+	short			num_unbound_mods;
+	short			sz_unbound_mods;
+	XkbConfigUnboundModPtr	unbound_mods;
+
+	int			groups_wrap;
+	int			slow_keys_delay;
+	int			debounce_delay;
+	int			mk_delay;
+	int			mk_interval;
+	int			mk_time_to_max;
+	int			mk_max_speed;
+	int			mk_curve;
+	int			ax_timeout;
+
+	Bool			replace_axt_ctrls_on;
+	Bool			replace_axt_ctrls_off;
+	unsigned long		axt_ctrls_on;
+	unsigned long		axt_ctrls_off;
+	unsigned long		axt_ctrls_ignore;
+
+	Bool			replace_axt_opts_off;
+	Bool			replace_axt_opts_on;
+	unsigned short		axt_opts_off;
+	unsigned short		axt_opts_on;
+	unsigned short		axt_opts_ignore;
+	XkbConfigRtrnPrivPtr	priv;
+} XkbConfigRtrnRec;
+
+typedef struct _XkbConfigField {
+	char *		field;
+	unsigned char	field_id;
+} XkbConfigFieldRec;
+
+typedef struct _XkbConfigFields {
+	unsigned short		cfg_id;
+	unsigned short		num_fields;
+	XkbConfigFieldPtr	fields;
+	XkbConfigParseFunc	parser;
+	XkbConfigFinishFunc	finish;
+	XPointer		priv;
+	struct _XkbConfigFields *next;
+} XkbConfigFieldsRec;
+
+#define	XkbCF_EOF			-1
+#define	XkbCF_Unknown			 0
+#define	XkbCF_EOL			 1
+#define	XkbCF_Semi			 2
+#define	XkbCF_Equals			 3
+#define	XkbCF_PlusEquals		 4
+#define	XkbCF_MinusEquals		 5
+#define	XkbCF_Plus			 6
+#define	XkbCF_Minus			 7
+#define	XkbCF_String			10
+#define	XkbCF_Ident			11
+#define	XkbCF_Integer			12
+
+#define	XkbCF_UnterminatedString	100
+#define	XkbCF_BadAlloc			101
+#define	XkbCF_MissingIdent		102
+#define	XkbCF_MissingEquals		103
+#define	XkbCF_ExpectedEOS		104
+#define	XkbCF_ExpectedBoolean		105
+#define	XkbCF_ExpectedInteger		106
+#define	XkbCF_ExpectedString		107
+#define	XkbCF_ExpectedModifier		108
+#define	XkbCF_ExpectedControl		109
+#define	XkbCF_ExpectedAXOption		110
+#define	XkbCF_ExpectedOperator		111
+#define	XkbCF_ExpectedOORGroupBehavior	112
+
+typedef union {
+	int		ival;
+	char *		str;
+} XkbCFScanResultRec,*XkbCFScanResultPtr;
+
+extern	XkbConfigFieldsPtr	XkbCFDflts;
+
+_XFUNCPROTOBEGIN
+
+extern int XkbCFScan(
+	FILE *			/* file */,
+	XkbCFScanResultPtr	/* val_rtrn */,
+	XkbConfigRtrnPtr	/* rtrn */
+);
+
+extern XkbConfigFieldsPtr XkbCFDup(
+	XkbConfigFieldsPtr	/* fields */
+);
+
+extern XkbConfigFieldsPtr XkbCFFree(
+	XkbConfigFieldsPtr	/* fields */,
+	Bool			/* all */
+);
+
+extern	XkbConfigUnboundModPtr XkbCFAddModByName(
+	XkbConfigRtrnPtr	/* rtrn */,
+	int			/* what */,
+	char *			/* name */,
+	Bool			/* merge */,
+	XkbConfigUnboundModPtr	/* last */
+);
+
+extern	Bool XkbCFBindMods(
+	XkbConfigRtrnPtr	/* rtrn */,
+	XkbDescPtr		/* xkb */
+);
+
+extern	Bool XkbCFApplyMods(
+	XkbConfigRtrnPtr	/* rtrn */,
+	int			/* what */,
+	XkbConfigModInfoPtr	/* info */
+);
+
+extern	Bool XkbCFApplyRtrnValues(
+	XkbConfigRtrnPtr	/* rtrn */,
+	XkbConfigFieldsPtr	/* fields */,
+	XkbDescPtr		/* xkb */
+);
+
+extern	XkbConfigRtrnPrivPtr XkbCFAddPrivate(
+	XkbConfigRtrnPtr	/* rtrn */,
+	XkbConfigFieldsPtr	/* fields */,
+	XPointer		/* ptr */
+);
+
+extern void XkbCFFreeRtrn(
+	XkbConfigRtrnPtr	/* rtrn */,
+	XkbConfigFieldsPtr	/* fields */,
+	XkbDescPtr		/* xkb */
+);
+
+extern Bool XkbCFParse(
+	FILE *			/* file */,
+	XkbConfigFieldsPtr	/* fields */,
+	XkbDescPtr		/* xkb */,
+	XkbConfigRtrnPtr	/* rtrn */
+);
+
+extern	void XkbCFReportError(
+	FILE *			/* file */,
+	char *			/* name */,
+	int			/* error */,
+	int			/* line */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _XKBCONFIG_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/XKBfile.h b/ThirdParty/X11/Include/X11/extensions/XKBfile.h
new file mode 100644
index 0000000000000000000000000000000000000000..1455463e69d172cdc039684aee250e374687489f
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XKBfile.h
@@ -0,0 +1,490 @@
+
+#ifndef _XKBFILE_H_
+#define	_XKBFILE_H_ 1
+
+/************************************************************
+ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
+
+ Permission to use, copy, modify, and distribute this
+ software and its documentation for any purpose and without
+ fee is hereby granted, provided that the above copyright
+ notice appear in all copies and that both that copyright
+ notice and this permission notice appear in supporting
+ documentation, and that the name of Silicon Graphics not be
+ used in advertising or publicity pertaining to distribution
+ of the software without specific prior written permission.
+ Silicon Graphics makes no representation about the suitability
+ of this software for any purpose. It is provided "as is"
+ without any express or implied warranty.
+
+ SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+ GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+ THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+ ********************************************************/
+
+/***====================================================================***/
+
+#define	XkbXKMFile	0
+#define	XkbCFile	1
+#define	XkbXKBFile	2
+#define	XkbMessage	3
+
+#define	XkbMapDefined		(1<<0)
+#define	XkbStateDefined		(1<<1)
+
+typedef struct _XkbFileInfo {
+    unsigned		type;
+    unsigned		defined;
+    XkbDescPtr	 	xkb;
+} XkbFileInfo,*XkbFileInfoPtr;
+
+typedef void	(*XkbFileAddOnFunc)(
+    FILE *		/* file */,
+    XkbFileInfo *	/* result */,
+    Bool		/* topLevel */,
+    Bool		/* showImplicit */,
+    int			/* fileSection */,
+    void *		/* priv */
+);
+
+/***====================================================================***/
+
+#define	_XkbSuccess			0
+#define	_XkbErrMissingNames		1
+#define	_XkbErrMissingTypes		2
+#define	_XkbErrMissingReqTypes		3
+#define	_XkbErrMissingSymbols		4
+#define	_XkbErrMissingVMods		5
+#define	_XkbErrMissingIndicators	6
+#define	_XkbErrMissingCompatMap		7
+#define	_XkbErrMissingSymInterps	8
+#define	_XkbErrMissingGeometry		9
+#define	_XkbErrIllegalDoodad		10
+#define	_XkbErrIllegalTOCType		11
+#define	_XkbErrIllegalContents		12
+#define	_XkbErrEmptyFile		13
+#define	_XkbErrFileNotFound		14
+#define	_XkbErrFileCannotOpen		15
+#define	_XkbErrBadValue			16
+#define	_XkbErrBadMatch			17
+#define	_XkbErrBadTypeName		18
+#define	_XkbErrBadTypeWidth		19
+#define	_XkbErrBadFileType		20
+#define	_XkbErrBadFileVersion		21
+#define	_XkbErrBadFileFormat		22
+#define	_XkbErrBadAlloc			23
+#define	_XkbErrBadLength		24
+#define	_XkbErrXReqFailure		25
+#define	_XkbErrBadImplementation	26
+
+extern const char *	_XkbErrMessages[];
+extern unsigned		_XkbErrCode;
+extern const char *	_XkbErrLocation;
+extern unsigned		_XkbErrData;
+
+/***====================================================================***/
+
+_XFUNCPROTOBEGIN
+
+extern	char *	XkbIndentText(
+    unsigned	/* size */
+);
+
+extern	char *	XkbAtomText(
+    Display *	/* dpy */,
+    Atom 	/* atm */,
+    unsigned	/* format */
+);
+
+extern char *	XkbKeysymText(
+    KeySym	/* sym */,
+    unsigned	/* format */
+);
+
+extern char *	XkbStringText(
+    char *	/* str */,
+    unsigned	/* format */
+);
+
+extern char *	XkbKeyNameText(
+    char *	/* name */,
+    unsigned	/* format */
+);
+
+extern char *
+XkbModIndexText(
+    unsigned	/* ndx */,
+    unsigned	/* format */
+);
+
+extern char *
+XkbModMaskText(
+    unsigned	/* mask */,
+    unsigned	/* format */
+);
+
+extern char *	XkbVModIndexText(
+    Display *	/* dpy */,
+    XkbDescPtr	/* xkb */,
+    unsigned	/* ndx */,
+    unsigned	/* format */
+);
+
+extern	char *	XkbVModMaskText(
+    Display *	/* dpy */,
+    XkbDescPtr	/* xkb */,
+    unsigned	/* modMask */,
+    unsigned	/* mask */,
+    unsigned	/* format */
+);
+
+extern char *	XkbConfigText(
+    unsigned 	/* config */,
+    unsigned 	/* format */
+);
+
+extern char *	XkbSIMatchText(
+    unsigned	/* type */,
+    unsigned	/* format */
+);
+
+extern char *	XkbIMWhichStateMaskText(
+    unsigned	/* use_which */,
+    unsigned	/* format */
+);
+
+extern char *	XkbAccessXDetailText(
+    unsigned	/* state */,
+    unsigned	/* format */
+);
+
+extern char *	XkbNKNDetailMaskText(
+    unsigned	/* detail */,
+    unsigned	/* format */
+);
+
+extern char *	XkbControlsMaskText(
+    unsigned	/* ctrls */,
+    unsigned	/* format */
+);
+
+extern char *	XkbGeomFPText(
+    int		/* val */,
+    unsigned 	/* format */
+);
+
+extern char *	XkbDoodadTypeText(
+    unsigned	/* type */,
+    unsigned	/* format */
+);
+
+extern char *	XkbActionTypeText(
+    unsigned	/* type */,
+    unsigned	/* format */
+);
+
+extern char *	XkbActionText(
+    Display *	/* dpy */,
+    XkbDescPtr	/* xkb */,
+    XkbAction *	/* action */,
+    unsigned	/* format */
+);
+
+extern char *	XkbBehaviorText(
+    XkbDescPtr 		/* xkb */,
+    XkbBehavior *	/* behavior */,
+    unsigned		/* format */
+);
+
+/***====================================================================***/
+
+#define	_XkbKSLower	(1<<0)
+#define	_XkbKSUpper	(1<<1)
+
+#define	XkbKSIsLower(k)		(_XkbKSCheckCase(k)&_XkbKSLower)
+#define	XkbKSIsUpper(k)		(_XkbKSCheckCase(k)&_XkbKSUpper)
+#define XkbKSIsKeypad(k)	(((k)>=XK_KP_Space)&&((k)<=XK_KP_Equal))
+#define	XkbKSIsDeadKey(k)	\
+		(((k)>=XK_dead_grave)&&((k)<=XK_dead_semivoiced_sound))
+
+extern	unsigned _XkbKSCheckCase(
+   KeySym	/* sym */
+);
+
+extern	int	 XkbFindKeycodeByName(
+    XkbDescPtr	/* xkb */,
+    char *	/* name */,
+    Bool	/* use_aliases */
+);
+
+extern	Bool	XkbLookupGroupAndLevel(
+    XkbDescPtr	/* xkb */,
+    int		/* key */,
+    int	*	/* mods_inout */,
+    int *	/* grp_inout */,
+    int	*	/* lvl_rtrn */
+);
+
+/***====================================================================***/
+
+
+extern Bool	XkbLookupCanonicalRGBColor(
+    char *	/* def */,
+    XColor *	/* color */
+);
+
+
+/***====================================================================***/
+
+extern	char *	XkbAtomGetString(
+    Display *	/* dpy */,
+    Atom 	/* atm */
+);
+
+extern	Atom	XkbInternAtom(
+    Display *	/* dpy */,
+    const char */* name */,
+    Bool	/* onlyIfExists */
+);
+
+extern	Status	XkbChangeKbdDisplay(
+    Display *		/* newDpy */,
+    XkbFileInfo *	/* result */
+);
+
+extern	Atom	XkbChangeAtomDisplay(
+    Display *	/* oldDpy */,
+    Display *	/* newDpy */,
+    Atom	/* atm */
+);
+
+extern	void	XkbInitAtoms(
+    Display *	/* dpy */
+);
+
+/***====================================================================***/
+
+#ifdef _XKBGEOM_H_
+
+#define	XkbDW_Unknown	0
+#define	XkbDW_Doodad	1
+#define	XkbDW_Section	2
+typedef struct _XkbDrawable {
+	int		type;
+	int		priority;
+	union {
+	    XkbDoodadPtr	doodad;
+	    XkbSectionPtr	section;
+	} u;
+	struct _XkbDrawable *	next;
+} XkbDrawableRec,*XkbDrawablePtr;
+
+extern	XkbDrawablePtr
+XkbGetOrderedDrawables(
+    XkbGeometryPtr	/* geom */,
+    XkbSectionPtr	/* section */
+);
+
+extern	void
+XkbFreeOrderedDrawables(
+    XkbDrawablePtr	/* draw */
+);
+
+#endif
+
+/***====================================================================***/
+
+extern	unsigned	XkbConvertGetByNameComponents(
+    Bool		/* toXkm */,
+    unsigned 		/* orig */
+);
+
+extern	unsigned	XkbConvertXkbComponents(
+    Bool		/* toXkm */,
+    unsigned 		/* orig */
+);
+
+extern	Bool	XkbDetermineFileType(
+    XkbFileInfo *	/* xkb */,
+    int			/* format */,
+    int *		/* opts_missing */
+);
+
+extern	Bool	XkbNameMatchesPattern(
+    char *		/* name */,
+    char *		/* pattern */
+);
+
+/***====================================================================***/
+
+extern	Bool	XkbWriteXKBKeycodes(
+    FILE *		/* file */,
+    XkbFileInfo *	/* result */,
+    Bool		/* topLevel */,
+    Bool		/* showImplicit */,
+    XkbFileAddOnFunc	/* addOn */,
+    void *		/* priv */
+);
+
+extern	Bool	XkbWriteXKBKeyTypes(
+    FILE *		/* file */,
+    XkbFileInfo *	/* result */,
+    Bool		/* topLevel */,
+    Bool		/* showImplicit */,
+    XkbFileAddOnFunc	/* addOn */,
+    void *		/* priv */
+);
+
+extern	Bool	XkbWriteXKBCompatMap(
+    FILE *		/* file */,
+    XkbFileInfo *	/* result */,
+    Bool		/* topLevel */,
+    Bool		/* showImplicit */,
+    XkbFileAddOnFunc	/* addOn */,
+    void *		/* priv */
+);
+
+extern	Bool	XkbWriteXKBSymbols(
+    FILE *		/* file */,
+    XkbFileInfo *	/* result */,
+    Bool		/* topLevel */,
+    Bool		/* showImplicit */,
+    XkbFileAddOnFunc	/* addOn */,
+    void *		/* priv */
+);
+
+extern	Bool	XkbWriteXKBGeometry(
+    FILE *		/* file */,
+    XkbFileInfo *	/* result */,
+    Bool		/* topLevel */,
+    Bool		/* showImplicit */,
+    XkbFileAddOnFunc	/* addOn */,
+    void *		/* priv */
+);
+
+extern	Bool	XkbWriteXKBSemantics(
+    FILE *		/* file */,
+    XkbFileInfo *	/* result */,
+    Bool		/* topLevel */,
+    Bool		/* showImplicit */,
+    XkbFileAddOnFunc	/* addOn */,
+    void *		/* priv */
+);
+
+extern	Bool	XkbWriteXKBLayout(
+    FILE *		/* file */,
+    XkbFileInfo *	/* result */,
+    Bool		/* topLevel */,
+    Bool		/* showImplicit */,
+    XkbFileAddOnFunc	/* addOn */,
+    void *		/* priv */
+);
+
+extern	Bool	XkbWriteXKBKeymap(
+    FILE *		/* file */,
+    XkbFileInfo *	/* result */,
+    Bool		/* topLevel */,
+    Bool		/* showImplicit */,
+    XkbFileAddOnFunc	/* addOn */,
+    void *		/* priv */
+);
+
+extern	Bool	XkbWriteXKBFile(
+    FILE *		/* file */,
+    XkbFileInfo *	/* result */,
+    Bool		/* showImplicit */,
+    XkbFileAddOnFunc	/* addOn */,
+    void *		/* priv */
+);
+
+extern	Bool	XkbWriteCFile(
+    FILE *		/* file */,
+    char *		/* name */,
+    XkbFileInfo *	/* info */
+);
+
+extern	Bool	XkbWriteXKMFile(
+    FILE *		/* file */,
+    XkbFileInfo *	/* result */
+);
+
+extern	Bool	XkbWriteToServer(
+    XkbFileInfo *	/* result */
+);
+
+extern	void	XkbEnsureSafeMapName(
+    char *		/* name */
+);
+
+extern	Bool	XkbWriteXKBKeymapForNames(
+    FILE *			/* file */,
+    XkbComponentNamesPtr	/* names */,
+    Display *			/* dpy */,
+    XkbDescPtr			/* xkb */,
+    unsigned			/* want */,
+    unsigned			/* need */
+);
+
+extern	Status	XkbMergeFile(
+    XkbDescPtr			/* xkb */,
+    XkbFileInfo			/* finfo */
+);
+
+/***====================================================================***/
+
+extern Bool	XkmProbe(
+    FILE *		/* file */
+);
+
+extern unsigned XkbReadFromServer(
+    Display *		/* dpy */,
+    unsigned		/* need */,
+    unsigned		/* want */,
+    XkbFileInfo *	/* result */
+);
+
+extern unsigned	XkmReadFile(
+    FILE *		/* file */,
+    unsigned		/* need */,
+    unsigned		/* want */,
+    XkbFileInfo *	/* result */
+);
+
+#ifdef _XKMFORMAT_H_
+
+extern Bool	XkmReadTOC(
+    FILE *              /* file */,
+    xkmFileInfo *       /* file_info */,
+    int                 /* max_toc */,
+    xkmSectionInfo *    /* toc */
+);
+
+extern xkmSectionInfo *XkmFindTOCEntry(
+    xkmFileInfo *       /* finfo */,
+    xkmSectionInfo *    /* toc */,
+    unsigned            /* type */
+);
+
+extern Bool	XkmReadFileSection(
+    FILE *              /* file */,
+    xkmSectionInfo *    /* toc */,
+    XkbFileInfo *       /* result */,
+    unsigned *          /* loaded_rtrn */
+);
+
+extern char *	XkmReadFileSectionName(
+    FILE *		/* file */,
+    xkmSectionInfo *	/* toc */
+);
+
+#endif /* _XKMFORMAT_H  */
+
+_XFUNCPROTOEND
+
+#endif /* _XKBFILE_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/XKBgeom.h b/ThirdParty/X11/Include/X11/extensions/XKBgeom.h
new file mode 100644
index 0000000000000000000000000000000000000000..f60385296bd3d0329554183a753fcc86ce0e6d4a
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XKBgeom.h
@@ -0,0 +1,657 @@
+/************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be 
+used in advertising or publicity pertaining to distribution 
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability 
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef _XKBGEOM_H_
+#define	_XKBGEOM_H_
+
+#include <X11/extensions/XKBstr.h>
+
+#ifdef XKB_IN_SERVER
+#define XkbAddGeomKeyAlias 		SrvXkbAddGeomKeyAlias
+#define XkbAddGeomColor 		SrvXkbAddGeomColor
+#define XkbAddGeomDoodad		SrvXkbAddGeomDoodad
+#define XkbAddGeomKey			SrvXkbAddGeomKey
+#define XkbAddGeomOutline		SrvXkbAddGeomOutline
+#define XkbAddGeomOverlay		SrvXkbAddGeomOverlay
+#define XkbAddGeomOverlayRow		SrvXkbAddGeomOverlayRow
+#define	XkbAddGeomOverlayKey		SrvXkbAddGeomOverlayKey
+#define XkbAddGeomProperty		SrvXkbAddGeomProperty
+#define XkbAddGeomRow			SrvXkbAddGeomRow
+#define XkbAddGeomSection		SrvXkbAddGeomSection
+#define XkbAddGeomShape			SrvXkbAddGeomShape
+#define XkbAllocGeomKeyAliases		SrvXkbAllocGeomKeyAliases
+#define XkbAllocGeomColors		SrvXkbAllocGeomColors
+#define XkbAllocGeomDoodads		SrvXkbAllocGeomDoodads
+#define XkbAllocGeomKeys		SrvXkbAllocGeomKeys
+#define XkbAllocGeomOutlines		SrvXkbAllocGeomOutlines
+#define XkbAllocGeomPoints		SrvXkbAllocGeomPoints
+#define XkbAllocGeomProps		SrvXkbAllocGeomProps
+#define XkbAllocGeomRows		SrvXkbAllocGeomRows
+#define XkbAllocGeomSectionDoodads	SrvXkbAllocGeomSectionDoodads
+#define XkbAllocGeomSections		SrvXkbAllocGeomSections
+#define	XkbAllocGeomOverlays		SrvXkbAllocGeomOverlays
+#define	XkbAllocGeomOverlayRows		SrvXkbAllocGeomOverlayRows
+#define	XkbAllocGeomOverlayKeys		SrvXkbAllocGeomOverlayKeys
+#define XkbAllocGeomShapes		SrvXkbAllocGeomShapes
+#define XkbAllocGeometry		SrvXkbAllocGeometry
+#define XkbFreeGeomKeyAliases		SrvXkbFreeGeomKeyAliases
+#define XkbFreeGeomColors		SrvXkbFreeGeomColors
+#define XkbFreeGeomDoodads		SrvXkbFreeGeomDoodads
+#define XkbFreeGeomProperties		SrvXkbFreeGeomProperties
+#define	XkbFreeGeomOverlayKeys		SrvXkbFreeGeomOverlayKeys
+#define	XkbFreeGeomOverlayRows		SrvXkbFreeGeomOverlayRows
+#define	XkbFreeGeomOverlays		SrvXkbFreeGeomOverlays
+#define	XkbFreeGeomKeys			SrvXkbFreeGeomKeys
+#define	XkbFreeGeomRows			SrvXkbFreeGeomRows
+#define XkbFreeGeomSections		SrvXkbFreeGeomSections
+#define	XkbFreeGeomPoints		SrvXkbFreeGeomPoints
+#define	XkbFreeGeomOutlines		SrvXkbFreeGeomOutlines
+#define XkbFreeGeomShapes		SrvXkbFreeGeomShapes
+#define XkbFreeGeometry			SrvXkbFreeGeometry
+#endif
+
+typedef	struct _XkbProperty {
+	char	*name;
+	char	*value;
+} XkbPropertyRec,*XkbPropertyPtr;
+
+typedef struct _XkbColor {
+	unsigned int 	pixel;
+	char *		spec;
+} XkbColorRec,*XkbColorPtr;
+
+typedef	struct _XkbPoint {
+	short	x;
+	short	y;
+} XkbPointRec, *XkbPointPtr;
+
+typedef struct	_XkbBounds {
+	short	x1,y1;
+	short	x2,y2;
+} XkbBoundsRec, *XkbBoundsPtr;
+#define	XkbBoundsWidth(b)	(((b)->x2)-((b)->x1))
+#define	XkbBoundsHeight(b)	(((b)->y2)-((b)->y1))
+
+typedef struct _XkbOutline {
+	unsigned short	num_points;
+	unsigned short	sz_points;
+	unsigned short	corner_radius;
+	XkbPointPtr	points;
+} XkbOutlineRec, *XkbOutlinePtr;
+
+typedef struct _XkbShape {
+	Atom	 	 name;
+	unsigned short	 num_outlines;
+	unsigned short	 sz_outlines;
+	XkbOutlinePtr	 outlines;
+	XkbOutlinePtr	 approx;
+	XkbOutlinePtr	 primary;
+	XkbBoundsRec	 bounds;
+} XkbShapeRec, *XkbShapePtr;
+#define	XkbOutlineIndex(s,o)	((int)((o)-&(s)->outlines[0]))
+
+typedef struct _XkbShapeDoodad {
+	Atom		 name;
+	unsigned char	 type;
+	unsigned char	 priority;
+	short		 top;
+	short		 left;
+	short	 	 angle;
+	unsigned short	 color_ndx;
+	unsigned short	 shape_ndx;
+} XkbShapeDoodadRec, *XkbShapeDoodadPtr;
+#define	XkbShapeDoodadColor(g,d)	(&(g)->colors[(d)->color_ndx])
+#define	XkbShapeDoodadShape(g,d)	(&(g)->shapes[(d)->shape_ndx])
+#define	XkbSetShapeDoodadColor(g,d,c)	((d)->color_ndx= (c)-&(g)->colors[0])
+#define	XkbSetShapeDoodadShape(g,d,s)	((d)->shape_ndx= (s)-&(g)->shapes[0])
+
+typedef struct _XkbTextDoodad {
+	Atom		 name;
+	unsigned char	 type;
+	unsigned char	 priority;
+	short	 	 top;
+	short	 	 left;
+	short	 	 angle;
+	short	 	 width;
+	short		 height;
+	unsigned short	 color_ndx;
+	char *		 text;
+	char *		 font;
+} XkbTextDoodadRec, *XkbTextDoodadPtr;
+#define	XkbTextDoodadColor(g,d)	(&(g)->colors[(d)->color_ndx])
+#define	XkbSetTextDoodadColor(g,d,c)	((d)->color_ndx= (c)-&(g)->colors[0])
+
+typedef struct _XkbIndicatorDoodad {
+	Atom		 name;
+	unsigned char	 type;
+	unsigned char	 priority;
+	short	 	 top;
+	short	 	 left;
+	short		 angle;
+	unsigned short	 shape_ndx;
+	unsigned short	 on_color_ndx;
+	unsigned short	 off_color_ndx;
+} XkbIndicatorDoodadRec, *XkbIndicatorDoodadPtr;
+#define	XkbIndicatorDoodadShape(g,d)	(&(g)->shapes[(d)->shape_ndx])
+#define	XkbIndicatorDoodadOnColor(g,d)	(&(g)->colors[(d)->on_color_ndx])
+#define	XkbIndicatorDoodadOffColor(g,d)	(&(g)->colors[(d)->off_color_ndx])
+#define	XkbSetIndicatorDoodadOnColor(g,d,c) \
+				((d)->on_color_ndx= (c)-&(g)->colors[0])
+#define	XkbSetIndicatorDoodadOffColor(g,d,c) \
+				((d)->off_color_ndx= (c)-&(g)->colors[0])
+#define	XkbSetIndicatorDoodadShape(g,d,s) \
+				((d)->shape_ndx= (s)-&(g)->shapes[0])
+
+typedef struct _XkbLogoDoodad {
+	Atom		 name;
+	unsigned char	 type;
+	unsigned char	 priority;
+	short		 top;
+	short		 left;
+	short	 	 angle;
+	unsigned short	 color_ndx;
+	unsigned short	 shape_ndx;
+	char *		 logo_name;
+} XkbLogoDoodadRec, *XkbLogoDoodadPtr;
+#define	XkbLogoDoodadColor(g,d)		(&(g)->colors[(d)->color_ndx])
+#define	XkbLogoDoodadShape(g,d)		(&(g)->shapes[(d)->shape_ndx])
+#define	XkbSetLogoDoodadColor(g,d,c)	((d)->color_ndx= (c)-&(g)->colors[0])
+#define	XkbSetLogoDoodadShape(g,d,s)	((d)->shape_ndx= (s)-&(g)->shapes[0])
+
+typedef struct _XkbAnyDoodad {
+	Atom		 name;
+	unsigned char	 type;
+	unsigned char	 priority;
+	short	 	 top;
+	short	 	 left;
+	short		 angle;
+} XkbAnyDoodadRec, *XkbAnyDoodadPtr;
+
+typedef union _XkbDoodad {
+	XkbAnyDoodadRec		any;
+	XkbShapeDoodadRec	shape;
+	XkbTextDoodadRec	text;
+	XkbIndicatorDoodadRec	indicator;
+	XkbLogoDoodadRec	logo;
+} XkbDoodadRec, *XkbDoodadPtr;
+
+#define	XkbUnknownDoodad	0
+#define	XkbOutlineDoodad	1
+#define	XkbSolidDoodad		2
+#define	XkbTextDoodad		3
+#define	XkbIndicatorDoodad	4
+#define	XkbLogoDoodad		5
+
+typedef struct _XkbKey {
+	XkbKeyNameRec	 name;
+	short		 gap;
+	unsigned char	 shape_ndx;
+	unsigned char	 color_ndx;
+} XkbKeyRec, *XkbKeyPtr;
+#define	XkbKeyShape(g,k)	(&(g)->shapes[(k)->shape_ndx])
+#define	XkbKeyColor(g,k)	(&(g)->colors[(k)->color_ndx])
+#define	XkbSetKeyShape(g,k,s)	((k)->shape_ndx= (s)-&(g)->shapes[0])
+#define	XkbSetKeyColor(g,k,c)	((k)->color_ndx= (c)-&(g)->colors[0])
+
+typedef struct _XkbRow {
+	short	 	top;
+	short	 	left;
+	unsigned short	num_keys;
+	unsigned short	sz_keys;
+	int		vertical;
+	XkbKeyPtr	keys;
+	XkbBoundsRec	bounds;
+} XkbRowRec, *XkbRowPtr;
+
+typedef struct _XkbSection {
+	Atom		 name;
+	unsigned char	 priority;
+	short	 	 top;
+	short	 	 left;
+	unsigned short	 width;
+	unsigned short	 height;
+	short	 	 angle;
+	unsigned short	 num_rows;
+	unsigned short	 num_doodads;
+	unsigned short	 num_overlays;
+	unsigned short	 sz_rows;
+	unsigned short	 sz_doodads;
+	unsigned short	 sz_overlays;
+	XkbRowPtr	 rows;
+	XkbDoodadPtr	 doodads;
+	XkbBoundsRec	 bounds;
+	struct _XkbOverlay *overlays;
+} XkbSectionRec, *XkbSectionPtr;
+
+typedef	struct _XkbOverlayKey {
+	XkbKeyNameRec	over;
+	XkbKeyNameRec	under;
+} XkbOverlayKeyRec,*XkbOverlayKeyPtr;
+
+typedef struct _XkbOverlayRow {
+	unsigned short		row_under;
+	unsigned short		num_keys;
+	unsigned short		sz_keys;
+	XkbOverlayKeyPtr	keys;
+} XkbOverlayRowRec,*XkbOverlayRowPtr;
+
+typedef struct _XkbOverlay {
+	Atom			name;
+	XkbSectionPtr		section_under;
+	unsigned short		num_rows;
+	unsigned short		sz_rows;
+	XkbOverlayRowPtr	rows;
+	XkbBoundsPtr		bounds;
+} XkbOverlayRec,*XkbOverlayPtr;
+
+typedef struct _XkbGeometry {
+	Atom		 name;
+	unsigned short	 width_mm;
+	unsigned short	 height_mm;
+	char *		 label_font;
+	XkbColorPtr	 label_color;
+	XkbColorPtr	 base_color;
+	unsigned short	 sz_properties;
+	unsigned short	 sz_colors;
+	unsigned short	 sz_shapes;
+	unsigned short   sz_sections;
+	unsigned short	 sz_doodads;
+	unsigned short	 sz_key_aliases;
+	unsigned short	 num_properties;
+	unsigned short	 num_colors;
+	unsigned short	 num_shapes;
+	unsigned short	 num_sections;
+	unsigned short	 num_doodads;
+	unsigned short	 num_key_aliases;
+	XkbPropertyPtr	 properties;
+	XkbColorPtr	 colors;
+	XkbShapePtr	 shapes;
+	XkbSectionPtr	 sections;
+	XkbDoodadPtr	 doodads;
+	XkbKeyAliasPtr	 key_aliases;
+} XkbGeometryRec;
+#define	XkbGeomColorIndex(g,c)	((int)((c)-&(g)->colors[0]))
+
+#define	XkbGeomPropertiesMask	(1<<0)
+#define	XkbGeomColorsMask	(1<<1)
+#define	XkbGeomShapesMask	(1<<2)
+#define	XkbGeomSectionsMask	(1<<3)
+#define	XkbGeomDoodadsMask	(1<<4)
+#define	XkbGeomKeyAliasesMask	(1<<5)
+#define	XkbGeomAllMask		(0x3f)
+
+typedef struct _XkbGeometrySizes {
+	unsigned int	which;
+	unsigned short	num_properties;
+	unsigned short	num_colors;
+	unsigned short	num_shapes;
+	unsigned short	num_sections;
+	unsigned short	num_doodads;
+	unsigned short	num_key_aliases;
+} XkbGeometrySizesRec,*XkbGeometrySizesPtr;
+
+_XFUNCPROTOBEGIN
+
+extern	XkbPropertyPtr
+XkbAddGeomProperty(
+    XkbGeometryPtr	/* geom */,
+    char *		/* name */,
+    char *		/* value */
+);
+
+extern	XkbKeyAliasPtr
+XkbAddGeomKeyAlias(
+    XkbGeometryPtr	/* geom */,
+    char *		/* alias */,
+    char *		/* real */
+);
+
+extern	XkbColorPtr
+XkbAddGeomColor(
+    XkbGeometryPtr	/* geom */,
+    char *		/* spec */,
+    unsigned int	/* pixel */
+);
+
+extern	XkbOutlinePtr
+XkbAddGeomOutline(
+    XkbShapePtr		/* shape */,
+    int			/* sz_points */
+);
+
+extern XkbShapePtr
+XkbAddGeomShape(
+    XkbGeometryPtr	/* geom */,
+    Atom		/* name */,
+    int			/* sz_outlines */
+);
+
+extern XkbKeyPtr
+XkbAddGeomKey(
+    XkbRowPtr		/* row */
+);
+
+extern XkbRowPtr
+XkbAddGeomRow(
+    XkbSectionPtr	/* section */,
+    int			/* sz_keys */
+);
+
+extern XkbSectionPtr
+XkbAddGeomSection(
+    XkbGeometryPtr	/* geom */,
+    Atom		/* name */,
+    int			/* sz_rows */,
+    int			/* sz_doodads */,
+    int			/* sz_overlays */
+);
+
+extern XkbOverlayPtr
+XkbAddGeomOverlay(
+    XkbSectionPtr	/* section */,
+    Atom		/* name */,
+    int			/* sz_rows */
+);
+
+extern XkbOverlayRowPtr
+XkbAddGeomOverlayRow(
+    XkbOverlayPtr	/* overlay */,
+    int			/* row_under */,
+    int			/* sz_keys */
+);
+
+extern XkbOverlayKeyPtr
+XkbAddGeomOverlayKey(
+    XkbOverlayPtr	/* overlay */,
+    XkbOverlayRowPtr	/* row */,
+    char *		/* over */,
+    char *		/* under */
+);
+
+extern XkbDoodadPtr
+XkbAddGeomDoodad(
+    XkbGeometryPtr	/* geom */,
+    XkbSectionPtr	/* section */,
+    Atom		/* name */
+);
+
+
+extern void
+XkbFreeGeomKeyAliases(
+    XkbGeometryPtr	/* geom */,
+    int			/* first */,
+    int			/* count */,
+    Bool		/* freeAll */
+);
+
+extern void
+XkbFreeGeomColors(
+    XkbGeometryPtr	/* geom */,
+    int			/* first */,
+    int			/* count */,
+    Bool		/* freeAll */
+);
+
+extern void
+XkbFreeGeomDoodads(
+    XkbDoodadPtr	/* doodads */,
+    int			/* nDoodads */,
+    Bool		/* freeAll */
+);
+
+
+extern void
+XkbFreeGeomProperties(
+    XkbGeometryPtr	/* geom */,
+    int			/* first */,
+    int			/* count */,
+    Bool		/* freeAll */
+);
+
+extern void
+XkbFreeGeomOverlayKeys(
+    XkbOverlayRowPtr	/* row */,
+    int			/* first */,
+    int			/* count */,
+    Bool		/* freeAll */
+);
+
+extern void
+XkbFreeGeomOverlayRows(
+    XkbOverlayPtr	/* overlay */,
+    int			/* first */,
+    int			/* count */,
+    Bool		/* freeAll */
+);
+
+extern void
+XkbFreeGeomOverlays(
+    XkbSectionPtr	/* section */,
+    int			/* first */,
+    int			/* count */,
+    Bool		/* freeAll */
+);
+
+extern void
+XkbFreeGeomKeys(
+    XkbRowPtr		/* row */,
+    int			/* first */,
+    int			/* count */,
+    Bool		/* freeAll */
+);
+
+extern void
+XkbFreeGeomRows(
+    XkbSectionPtr	/* section */,
+    int			/* first */,
+    int			/* count */,
+    Bool		/* freeAll */
+);
+
+extern void
+XkbFreeGeomSections(
+    XkbGeometryPtr	/* geom */,
+    int			/* first */,
+    int			/* count */,
+    Bool		/* freeAll */
+);
+
+
+extern void
+XkbFreeGeomPoints(
+    XkbOutlinePtr	/* outline */,
+    int			/* first */,
+    int			/* count */,
+    Bool		/* freeAll */
+);
+
+extern void
+XkbFreeGeomOutlines(
+    XkbShapePtr		/* shape */,
+    int			/* first */,
+    int			/* count */,
+    Bool		/* freeAll */
+);
+
+extern void
+XkbFreeGeomShapes(
+    XkbGeometryPtr	/* geom */,
+    int			/* first */,
+    int			/* count */,
+    Bool		/* freeAll */
+);
+
+extern void
+XkbFreeGeometry(
+    XkbGeometryPtr	/* geom */,
+    unsigned int	/* which */,
+    Bool		/* freeMap */
+);
+
+extern Status
+XkbAllocGeomProps(
+    XkbGeometryPtr	/* geom */,
+    int			/* nProps */
+);
+
+extern Status
+XkbAllocGeomKeyAliases(
+    XkbGeometryPtr	/* geom */,
+    int			/* nAliases */
+);
+
+extern Status
+XkbAllocGeomColors(
+    XkbGeometryPtr	/* geom */,
+    int			/* nColors */
+);
+
+extern Status
+XkbAllocGeomShapes(
+    XkbGeometryPtr	/* geom */,
+    int			/* nShapes */
+);
+
+extern Status
+XkbAllocGeomSections(
+    XkbGeometryPtr	/* geom */,
+    int			/* nSections */
+);
+
+extern Status
+XkbAllocGeomOverlays(
+    XkbSectionPtr	/* section */,
+    int			/* num_needed */
+);
+
+extern Status
+XkbAllocGeomOverlayRows(
+    XkbOverlayPtr	/* overlay */,
+    int			/* num_needed */
+);
+
+extern Status
+XkbAllocGeomOverlayKeys(
+    XkbOverlayRowPtr	/* row */,
+    int			/* num_needed */
+);
+
+extern Status
+XkbAllocGeomDoodads(
+    XkbGeometryPtr	/* geom */,
+    int			/* nDoodads */
+);
+
+extern Status
+XkbAllocGeomSectionDoodads(
+    XkbSectionPtr	/* section */,
+    int			/* nDoodads */
+);
+
+extern Status
+XkbAllocGeomOutlines(
+    XkbShapePtr		/* shape */,
+    int			/* nOL */
+);
+
+extern Status
+XkbAllocGeomRows(
+    XkbSectionPtr	/* section */,
+    int			/* nRows */
+);
+
+extern Status
+XkbAllocGeomPoints(
+    XkbOutlinePtr	/* ol */,
+    int			/* nPts */
+);
+
+extern Status
+XkbAllocGeomKeys(
+    XkbRowPtr		/* row */,
+    int			/* nKeys */
+);
+
+extern	Status
+XkbAllocGeometry(
+	XkbDescPtr		/* xkb */,
+	XkbGeometrySizesPtr	/* sizes */
+);
+
+extern	Status
+XkbSetGeometry(
+	Display *		/* dpy */,
+	unsigned		/* deviceSpec */,
+	XkbGeometryPtr		/* geom */
+);
+
+extern	Bool
+XkbComputeShapeTop(
+	XkbShapePtr		/* shape */,
+	XkbBoundsPtr		/* bounds */
+);
+
+extern	Bool
+XkbComputeShapeBounds(
+	XkbShapePtr		/* shape */
+);
+
+extern	Bool
+XkbComputeRowBounds(
+	XkbGeometryPtr		/* geom */,
+	XkbSectionPtr		/* section */,
+	XkbRowPtr		/* row */
+);
+
+extern	Bool
+XkbComputeSectionBounds(
+	XkbGeometryPtr		/* geom */,
+	XkbSectionPtr		/* section */
+);
+
+extern	char *
+XkbFindOverlayForKey(
+	XkbGeometryPtr		/* geom */,
+	XkbSectionPtr		/* wanted */,
+	char *			/* under */
+);
+
+extern	Status
+XkbGetGeometry(
+    Display *			/* dpy */,
+    XkbDescPtr			/* xkb */
+);
+
+extern	Status
+XkbGetNamedGeometry(
+    Display *			/* dpy */,
+    XkbDescPtr			/* xkb */,
+    Atom			/* name */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _XKBSTR_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/XKBproto.h b/ThirdParty/X11/Include/X11/extensions/XKBproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..b867659ce51afc0cdbb626b6bf117c1ce5fe2c0f
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XKBproto.h
@@ -0,0 +1,1281 @@
+/************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be 
+used in advertising or publicity pertaining to distribution 
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability 
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef _XKBPROTO_H_
+#define	_XKBPROTO_H_
+
+#include <X11/Xmd.h>
+#include <X11/extensions/XKB.h>
+
+#define Window CARD32
+#define Atom CARD32
+#define Time CARD32
+#define KeyCode CARD8
+#define KeySym CARD32
+
+#define	XkbPaddedSize(n)	((((unsigned int)(n)+3) >> 2) << 2)
+
+typedef struct _xkbUseExtension {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* always X_KBUseExtension */
+    CARD16	length B16;
+    CARD16	wantedMajor B16;
+    CARD16	wantedMinor B16;
+} xkbUseExtensionReq;
+#define	sz_xkbUseExtensionReq	8
+
+typedef struct _xkbUseExtensionReply {
+    BYTE	type;		/* X_Reply */
+    BOOL	supported;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	serverMajor B16;
+    CARD16	serverMinor B16;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xkbUseExtensionReply;
+#define	sz_xkbUseExtensionReply	32
+
+typedef	struct _xkbSelectEvents {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* X_KBSelectEvents */
+    CARD16	length B16;
+    CARD16	deviceSpec B16;
+    CARD16	affectWhich B16;
+    CARD16	clear B16;
+    CARD16	selectAll B16;
+    CARD16	affectMap B16;
+    CARD16	map B16;
+} xkbSelectEventsReq;
+#define	sz_xkbSelectEventsReq	16
+
+typedef struct _xkbBell {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* X_KBBell */
+    CARD16	length B16;
+    CARD16	deviceSpec B16;
+    CARD16	bellClass B16;
+    CARD16	bellID B16;
+    INT8	percent;
+    BOOL	forceSound;
+    BOOL	eventOnly;
+    CARD8	pad1;
+    INT16	pitch B16;
+    INT16	duration B16;
+    CARD16	pad2 B16;
+    Atom	name B32;
+    Window	window B32;
+} xkbBellReq;
+#define	sz_xkbBellReq		28
+
+typedef struct _xkbGetState {
+	CARD8		reqType;
+	CARD8		xkbReqType;	/* always X_KBGetState */
+	CARD16		length B16;
+	CARD16		deviceSpec B16;
+	CARD16		pad B16;
+} xkbGetStateReq;
+#define	sz_xkbGetStateReq	8
+
+typedef	struct _xkbGetStateReply {
+    BYTE	type;
+    BYTE	deviceID;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD8	mods;
+    CARD8	baseMods;
+    CARD8	latchedMods;
+    CARD8	lockedMods;
+    CARD8	group;
+    CARD8	lockedGroup;
+    INT16	baseGroup B16;
+    INT16	latchedGroup B16;
+    CARD8	compatState;
+    CARD8	grabMods;
+    CARD8	compatGrabMods;
+    CARD8	lookupMods;
+    CARD8	compatLookupMods;
+    CARD8	pad1;
+    CARD16	ptrBtnState B16;
+    CARD16	pad2 B16;
+    CARD32	pad3 B32;
+} xkbGetStateReply;
+#define	sz_xkbGetStateReply	32
+
+typedef struct _xkbLatchLockState {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* always X_KBLatchLockState */
+    CARD16	length B16;
+    CARD16	deviceSpec B16;
+    CARD8	affectModLocks;
+    CARD8	modLocks;
+    BOOL	lockGroup;
+    CARD8	groupLock;
+    CARD8	affectModLatches;
+    CARD8	modLatches;
+    CARD8	pad;
+    BOOL	latchGroup;
+    INT16	groupLatch B16;
+} xkbLatchLockStateReq;
+#define	sz_xkbLatchLockStateReq		16
+
+typedef struct _xkbGetControls {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* always X_KBGetControls */
+    CARD16	length B16;
+    CARD16	deviceSpec B16;
+    CARD16	pad B16;
+} xkbGetControlsReq;
+#define	sz_xkbGetControlsReq	8
+
+typedef struct _xkbGetControlsReply {
+    BYTE	type;		/* X_Reply */
+    CARD8	deviceID;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD8	mkDfltBtn;
+    CARD8	numGroups;
+    CARD8	groupsWrap;
+    CARD8	internalMods;
+    CARD8	ignoreLockMods;
+    CARD8	internalRealMods;
+    CARD8	ignoreLockRealMods;
+    CARD8	pad1;
+    CARD16	internalVMods B16;
+    CARD16	ignoreLockVMods B16;
+    CARD16	repeatDelay B16;
+    CARD16	repeatInterval B16;
+    CARD16	slowKeysDelay B16;
+    CARD16	debounceDelay B16;
+    CARD16	mkDelay B16;
+    CARD16	mkInterval B16;
+    CARD16	mkTimeToMax B16;
+    CARD16	mkMaxSpeed B16;
+    INT16	mkCurve B16;
+    CARD16	axOptions B16;
+    CARD16	axTimeout B16;
+    CARD16	axtOptsMask B16;
+    CARD16	axtOptsValues B16;
+    CARD16	pad2 B16;
+    CARD32	axtCtrlsMask B32;
+    CARD32	axtCtrlsValues B32;
+    CARD32	enabledCtrls B32;
+    BYTE	perKeyRepeat[XkbPerKeyBitArraySize];
+} xkbGetControlsReply;
+#define	sz_xkbGetControlsReply	92
+
+typedef struct _xkbSetControls {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* always X_KBSetControls */
+    CARD16	length B16;
+    CARD16	deviceSpec B16;
+    CARD8	affectInternalMods;
+    CARD8	internalMods;
+    CARD8	affectIgnoreLockMods;
+    CARD8	ignoreLockMods;
+    CARD16	affectInternalVMods B16;
+    CARD16	internalVMods B16;
+    CARD16	affectIgnoreLockVMods B16;
+    CARD16	ignoreLockVMods B16;
+    CARD8	mkDfltBtn;
+    CARD8	groupsWrap;
+    CARD16	axOptions B16;
+    CARD16	pad1 B16;
+    CARD32	affectEnabledCtrls B32;
+    CARD32	enabledCtrls B32;
+    CARD32	changeCtrls B32;
+    CARD16	repeatDelay B16;
+    CARD16	repeatInterval B16;
+    CARD16	slowKeysDelay B16;
+    CARD16	debounceDelay B16;
+    CARD16	mkDelay B16;
+    CARD16	mkInterval B16;
+    CARD16	mkTimeToMax B16;
+    CARD16	mkMaxSpeed B16;
+    INT16	mkCurve B16;
+    CARD16	axTimeout B16;
+    CARD32	axtCtrlsMask B32;
+    CARD32	axtCtrlsValues B32;
+    CARD16	axtOptsMask B16;
+    CARD16	axtOptsValues B16;
+    BYTE	perKeyRepeat[XkbPerKeyBitArraySize];
+} xkbSetControlsReq;
+#define	sz_xkbSetControlsReq	100
+
+typedef	struct _xkbKTMapEntryWireDesc {
+    BOOL	active;
+    CARD8	mask;
+    CARD8	level;
+    CARD8	realMods;
+    CARD16	virtualMods B16;
+    CARD16	pad B16;
+} xkbKTMapEntryWireDesc;
+#define sz_xkbKTMapEntryWireDesc	8
+
+typedef struct _xkbKTSetMapEntryWireDesc {
+    CARD8	level;
+    CARD8	realMods;
+    CARD16	virtualMods B16;
+} xkbKTSetMapEntryWireDesc;
+#define	sz_xkbKTSetMapEntryWireDesc	4
+
+typedef struct _xkbModsWireDesc {
+    CARD8	mask;		/* GetMap only */
+    CARD8	realMods;
+    CARD16	virtualMods B16;
+} xkbModsWireDesc;
+#define	sz_xkbModsWireDesc	4
+
+typedef struct _xkbKeyTypeWireDesc {
+    CARD8	mask;
+    CARD8	realMods;
+    CARD16	virtualMods B16;
+    CARD8	numLevels;
+    CARD8	nMapEntries;
+    BOOL	preserve;
+    CARD8	pad;
+} xkbKeyTypeWireDesc;
+#define	sz_xkbKeyTypeWireDesc	8
+
+typedef struct _xkbSymMapWireDesc {
+    CARD8	ktIndex[XkbNumKbdGroups];
+    CARD8	groupInfo;
+    CARD8	width;
+    CARD16	nSyms B16;
+} xkbSymMapWireDesc;
+#define	sz_xkbSymMapWireDesc	8
+
+typedef struct _xkbVModMapWireDesc {
+    KeyCode	key;
+    CARD8	pad;
+    CARD16	vmods B16;
+} xkbVModMapWireDesc;
+#define	sz_xkbVModMapWireDesc	4
+
+typedef struct _xkbBehaviorWireDesc {
+	CARD8	key;
+	CARD8	type;
+	CARD8	data;
+	CARD8	pad;
+} xkbBehaviorWireDesc;
+#define	sz_xkbBehaviorWireDesc	4
+
+typedef	struct _xkbActionWireDesc {
+    CARD8	type;
+    CARD8	data[7];
+} xkbActionWireDesc;
+#define	sz_xkbActionWireDesc	8
+
+typedef struct _xkbGetMap {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* always X_KBGetMap */
+    CARD16	length B16;
+    CARD16	deviceSpec B16;
+    CARD16	full B16;
+    CARD16	partial B16;
+    CARD8	firstType;
+    CARD8	nTypes;
+    KeyCode	firstKeySym;
+    CARD8	nKeySyms;
+    KeyCode	firstKeyAct;
+    CARD8	nKeyActs;
+    KeyCode	firstKeyBehavior;
+    CARD8	nKeyBehaviors;
+    CARD16	virtualMods B16;
+    KeyCode	firstKeyExplicit;
+    CARD8	nKeyExplicit;
+    KeyCode	firstModMapKey;
+    CARD8	nModMapKeys;
+    KeyCode	firstVModMapKey;
+    CARD8	nVModMapKeys;
+    CARD16	pad1 B16;
+} xkbGetMapReq;
+#define	sz_xkbGetMapReq	28
+
+typedef struct _xkbGetMapReply {
+    CARD8	type;		/* always X_Reply */
+    CARD8	deviceID;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	pad1 B16;
+    KeyCode	minKeyCode;
+    KeyCode	maxKeyCode;
+    CARD16	present B16;
+    CARD8	firstType;
+    CARD8	nTypes;
+    CARD8	totalTypes;
+    KeyCode	firstKeySym;
+    CARD16	totalSyms B16;
+    CARD8	nKeySyms;
+    KeyCode	firstKeyAct;
+    CARD16	totalActs B16;
+    CARD8	nKeyActs;
+    KeyCode	firstKeyBehavior;
+    CARD8	nKeyBehaviors;
+    CARD8	totalKeyBehaviors;
+    KeyCode	firstKeyExplicit;
+    CARD8	nKeyExplicit;
+    CARD8	totalKeyExplicit;
+    KeyCode	firstModMapKey;
+    CARD8	nModMapKeys;
+    CARD8	totalModMapKeys;
+    KeyCode	firstVModMapKey;
+    CARD8	nVModMapKeys;
+    CARD8	totalVModMapKeys;
+    CARD8	pad2;
+    CARD16	virtualMods B16;
+} xkbGetMapReply;
+#define	sz_xkbGetMapReply		40
+
+#define	XkbSetMapResizeTypes		(1L<<0)
+#define	XkbSetMapRecomputeActions	(1L<<1)
+#define	XkbSetMapAllFlags		(0x3)
+
+typedef struct _xkbSetMap {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* always X_KBSetMap */
+    CARD16	length B16;
+    CARD16	deviceSpec B16;
+    CARD16	present B16;
+    CARD16	flags B16;
+    KeyCode	minKeyCode;
+    KeyCode	maxKeyCode;
+    CARD8	firstType;
+    CARD8	nTypes;
+    KeyCode	firstKeySym;
+    CARD8	nKeySyms;
+    CARD16	totalSyms B16;
+    KeyCode	firstKeyAct;
+    CARD8	nKeyActs;
+    CARD16	totalActs B16;
+    KeyCode	firstKeyBehavior;
+    CARD8	nKeyBehaviors;
+    CARD8	totalKeyBehaviors;
+    KeyCode	firstKeyExplicit;
+    CARD8	nKeyExplicit;
+    CARD8	totalKeyExplicit;
+    KeyCode	firstModMapKey;
+    CARD8	nModMapKeys;
+    CARD8	totalModMapKeys;
+    KeyCode	firstVModMapKey;
+    CARD8	nVModMapKeys;
+    CARD8	totalVModMapKeys;
+    CARD16	virtualMods B16;
+} xkbSetMapReq;
+#define	sz_xkbSetMapReq	36
+
+typedef struct _xkbSymInterpretWireDesc {
+    CARD32		sym B32;
+    CARD8		mods;
+    CARD8		match;
+    CARD8		virtualMod;
+    CARD8		flags;
+    xkbActionWireDesc	act;
+} xkbSymInterpretWireDesc;
+#define	sz_xkbSymInterpretWireDesc	16
+
+typedef struct _xkbGetCompatMap {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* always X_KBGetCompatMap */
+    CARD16	length B16;
+    CARD16	deviceSpec B16;
+    CARD8	groups;
+    BOOL	getAllSI;
+    CARD16	firstSI B16;
+    CARD16	nSI B16;
+} xkbGetCompatMapReq;
+#define	sz_xkbGetCompatMapReq	12
+
+typedef struct _xkbGetCompatMapReply {
+    CARD8	type;		/* always X_Reply */
+    CARD8	deviceID;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD8	groups;
+    CARD8	pad1;
+    CARD16	firstSI B16;
+    CARD16	nSI B16;
+    CARD16	nTotalSI B16;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xkbGetCompatMapReply;
+#define	sz_xkbGetCompatMapReply		32
+
+typedef struct _xkbSetCompatMap {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* always X_KBSetCompatMap */
+    CARD16	length B16;
+    CARD16	deviceSpec B16;
+    CARD8	pad1;
+    BOOL	recomputeActions;
+    BOOL	truncateSI;
+    CARD8	groups;
+    CARD16	firstSI B16;
+    CARD16	nSI B16;
+    CARD16	pad2 B16;
+} xkbSetCompatMapReq;
+#define	sz_xkbSetCompatMapReq	16
+
+typedef struct _xkbGetIndicatorState {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* always X_KBGetIndicatorState */
+    CARD16	length B16;
+    CARD16	deviceSpec B16;
+    CARD16	pad1 B16;
+} xkbGetIndicatorStateReq;
+#define	sz_xkbGetIndicatorStateReq	8
+
+typedef struct _xkbGetIndicatorStateReply {
+    CARD8	type;		/* always X_Reply */
+    CARD8	deviceID;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	state B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xkbGetIndicatorStateReply;
+#define	sz_xkbGetIndicatorStateReply	32
+
+typedef struct _xkbGetIndicatorMap {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* always X_KBGetIndicatorMap */
+    CARD16	length B16;
+    CARD16	deviceSpec B16;
+    CARD16	pad B16;
+    CARD32	which B32;
+} xkbGetIndicatorMapReq;
+#define	sz_xkbGetIndicatorMapReq	12
+
+typedef struct _xkbGetIndicatorMapReply {
+    CARD8	type;		/* always X_Reply */
+    CARD8	deviceID;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	which B32;
+    CARD32	realIndicators B32;
+    CARD8	nIndicators;
+    CARD8	pad1;
+    CARD16	pad2 B16;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xkbGetIndicatorMapReply;
+#define	sz_xkbGetIndicatorMapReply	32
+
+typedef struct _xkbIndicatorMapWireDesc {
+    CARD8	flags;
+    CARD8	whichGroups;
+    CARD8	groups;
+    CARD8	whichMods;
+    CARD8	mods;
+    CARD8	realMods;
+    CARD16	virtualMods B16;
+    CARD32	ctrls B32;
+} xkbIndicatorMapWireDesc;
+#define	sz_xkbIndicatorMapWireDesc	12
+
+typedef struct _xkbSetIndicatorMap {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* always X_KBSetIndicatorMap */
+    CARD16	length B16;
+    CARD16	deviceSpec B16;
+    CARD16	pad1 B16;
+    CARD32	which B32;
+} xkbSetIndicatorMapReq;
+#define	sz_xkbSetIndicatorMapReq	12
+
+typedef struct _xkbGetNamedIndicator {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* X_KBGetNamedIndicator */
+    CARD16	length B16;
+    CARD16	deviceSpec B16;
+    CARD16	ledClass B16;
+    CARD16	ledID B16;
+    CARD16	pad1 B16;
+    Atom	indicator B32;
+} xkbGetNamedIndicatorReq;
+#define	sz_xkbGetNamedIndicatorReq		16
+
+typedef	struct _xkbGetNamedIndicatorReply {
+    BYTE	type;
+    BYTE	deviceID;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    Atom	indicator B32;
+    BOOL	found;
+    BOOL	on;
+    BOOL	realIndicator;
+    CARD8	ndx;
+    CARD8	flags;
+    CARD8	whichGroups;
+    CARD8	groups;
+    CARD8	whichMods;
+    CARD8	mods;
+    CARD8	realMods;
+    CARD16	virtualMods B16;
+    CARD32	ctrls B32;
+    BOOL	supported;
+    CARD8	pad1;
+    CARD16	pad2 B16;
+} xkbGetNamedIndicatorReply;
+#define	sz_xkbGetNamedIndicatorReply	32
+
+typedef struct _xkbSetNamedIndicator {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* X_KBSetNamedIndicator */
+    CARD16	length B16;
+    CARD16	deviceSpec B16;
+    CARD16	ledClass B16;
+    CARD16	ledID B16;
+    CARD16	pad1 B16;
+    Atom	indicator B32;
+    BOOL	setState;
+    BOOL	on;
+    BOOL	setMap;
+    BOOL	createMap;
+    CARD8	pad2;
+    CARD8	flags;
+    CARD8	whichGroups;
+    CARD8	groups;
+    CARD8	whichMods;
+    CARD8	realMods;
+    CARD16	virtualMods B16;
+    CARD32	ctrls B32;
+} xkbSetNamedIndicatorReq;
+#define	sz_xkbSetNamedIndicatorReq	32
+
+typedef struct _xkbGetNames {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* always X_KBGetNames */
+    CARD16	length B16;
+    CARD16	deviceSpec B16;
+    CARD16	pad B16;
+    CARD32	which B32;
+} xkbGetNamesReq;
+#define	sz_xkbGetNamesReq		12
+
+typedef	struct _xkbGetNamesReply {
+    BYTE	type;
+    BYTE	deviceID;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	which B32;
+    KeyCode	minKeyCode;
+    KeyCode	maxKeyCode;
+    CARD8	nTypes;
+    CARD8	groupNames;
+    CARD16	virtualMods B16;
+    KeyCode	firstKey;
+    CARD8	nKeys;
+    CARD32	indicators B32;
+    CARD8	nRadioGroups;
+    CARD8	nKeyAliases;
+    CARD16	nKTLevels B16;
+    CARD32	pad3 B32;
+} xkbGetNamesReply;
+#define	sz_xkbGetNamesReply	32
+
+typedef struct _xkbSetNames {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* always X_KBSetNames */
+    CARD16	length B16;
+    CARD16	deviceSpec B16;
+    CARD16	virtualMods B16;
+    CARD32	which B32;
+    CARD8	firstType;
+    CARD8	nTypes;
+    CARD8	firstKTLevel;
+    CARD8	nKTLevels;
+    CARD32	indicators B32;
+    CARD8	groupNames;
+    CARD8	nRadioGroups;
+    KeyCode	firstKey;
+    CARD8	nKeys;
+    CARD8	nKeyAliases;
+    CARD8	pad1;
+    CARD16	totalKTLevelNames B16;
+} xkbSetNamesReq;
+#define	sz_xkbSetNamesReq	28
+
+typedef struct _xkbPointWireDesc {
+    INT16	x B16;
+    INT16	y B16;
+} xkbPointWireDesc;
+#define	sz_xkbPointWireDesc	4
+
+typedef struct _xkbOutlineWireDesc {
+    CARD8	nPoints;
+    CARD8	cornerRadius;
+    CARD16	pad B16;
+} xkbOutlineWireDesc;
+#define	sz_xkbOutlineWireDesc	4
+
+typedef struct _xkbShapeWireDesc {
+    Atom	name B32;
+    CARD8	nOutlines;
+    CARD8	primaryNdx;
+    CARD8	approxNdx;
+    CARD8	pad;
+} xkbShapeWireDesc;
+#define	sz_xkbShapeWireDesc	8
+
+typedef struct _xkbSectionWireDesc {
+    Atom	name B32;
+    INT16	top B16;
+    INT16	left B16;
+    CARD16	width B16;
+    CARD16	height B16;
+    INT16	angle B16;
+    CARD8	priority;
+    CARD8	nRows;
+    CARD8	nDoodads;
+    CARD8	nOverlays;
+    CARD16	pad B16;
+} xkbSectionWireDesc;
+#define	sz_xkbSectionWireDesc	20
+
+typedef struct _xkbRowWireDesc {
+    INT16	top B16;
+    INT16	left B16;
+    CARD8	nKeys;
+    BOOL	vertical;
+    CARD16	pad B16;
+} xkbRowWireDesc;
+#define	sz_xkbRowWireDesc	8
+
+typedef struct _xkbKeyWireDesc {
+    CARD8	name[XkbKeyNameLength];
+    INT16	gap B16;
+    CARD8	shapeNdx;
+    CARD8	colorNdx;
+} xkbKeyWireDesc;
+#define	sz_xkbKeyWireDesc	8
+
+typedef struct _xkbOverlayWireDesc {
+    Atom	name B32;
+    CARD8	nRows;
+    CARD8	pad1;
+    CARD16	pad2 B16;
+} xkbOverlayWireDesc;
+#define	sz_xkbOverlayWireDesc	8
+
+typedef struct _xkbOverlayRowWireDesc {
+   CARD8	rowUnder;
+   CARD8	nKeys;
+   CARD16	pad1 B16;
+} xkbOverlayRowWireDesc;
+#define	sz_xkbOverlayRowWireDesc	4
+
+typedef struct _xkbOverlayKeyWireDesc {
+   CARD8	over[XkbKeyNameLength];
+   CARD8	under[XkbKeyNameLength];
+} xkbOverlayKeyWireDesc;
+#define	sz_xkbOverlayKeyWireDesc	8
+
+typedef struct _xkbShapeDoodadWireDesc {
+    Atom	name B32;
+    CARD8	type;
+    CARD8	priority;
+    INT16	top B16;
+    INT16	left B16;
+    INT16	angle B16;
+    CARD8	colorNdx;
+    CARD8	shapeNdx;
+    CARD16	pad1 B16;
+    CARD32	pad2 B32;
+} xkbShapeDoodadWireDesc;
+#define	sz_xkbShapeDoodadWireDesc	20
+
+typedef struct _xkbTextDoodadWireDesc {
+    Atom	name B32;
+    CARD8	type;
+    CARD8	priority;
+    INT16	top B16;
+    INT16	left B16;
+    INT16	angle B16;
+    CARD16	width B16;
+    CARD16	height B16;
+    CARD8	colorNdx;
+    CARD8	pad1;
+    CARD16	pad2 B16;
+} xkbTextDoodadWireDesc;
+#define	sz_xkbTextDoodadWireDesc	20
+
+typedef struct _xkbIndicatorDoodadWireDesc {
+    Atom	name B32;
+    CARD8	type;
+    CARD8	priority;
+    INT16	top B16;
+    INT16	left B16;
+    INT16	angle B16;
+    CARD8	shapeNdx;
+    CARD8	onColorNdx;
+    CARD8	offColorNdx;
+    CARD8	pad1;
+    CARD32	pad2 B32;
+} xkbIndicatorDoodadWireDesc;
+#define	sz_xkbIndicatorDoodadWireDesc	20
+
+typedef struct _xkbLogoDoodadWireDesc {
+    Atom	name B32;
+    CARD8	type;
+    CARD8	priority;
+    INT16	top B16;
+    INT16	left B16;
+    INT16	angle B16;
+    CARD8	colorNdx;
+    CARD8	shapeNdx;
+    CARD16	pad1 B16;
+    CARD32	pad2 B32;
+} xkbLogoDoodadWireDesc;
+#define	sz_xkbLogoDoodadWireDesc	20
+
+typedef struct _xkbAnyDoodadWireDesc {
+    Atom	name B32;
+    CARD8	type;
+    CARD8	priority;
+    INT16	top B16;
+    INT16	left B16;
+    INT16	angle B16;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+} xkbAnyDoodadWireDesc;
+#define	sz_xkbAnyDoodadWireDesc	20
+
+typedef union _xkbDoodadWireDesc {
+    xkbAnyDoodadWireDesc	any;
+    xkbShapeDoodadWireDesc	shape;
+    xkbTextDoodadWireDesc	text;
+    xkbIndicatorDoodadWireDesc	indicator;
+    xkbLogoDoodadWireDesc	logo;
+} xkbDoodadWireDesc;
+#define	sz_xkbDoodadWireDesc	20
+
+typedef struct _xkbGetGeometry {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* always X_KBGetGeometry */
+    CARD16	length B16;
+    CARD16	deviceSpec B16;
+    CARD16	pad B16;
+    Atom	name B32;
+} xkbGetGeometryReq;
+#define	sz_xkbGetGeometryReq	12
+
+typedef struct _xkbGetGeometryReply {
+    CARD8	type;		/* always X_Reply */
+    CARD8	deviceID;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    Atom	name B32;
+    BOOL	found;
+    CARD8	pad;
+    CARD16	widthMM B16;
+    CARD16	heightMM B16;
+    CARD16	nProperties B16;
+    CARD16	nColors B16;
+    CARD16	nShapes B16;
+    CARD16	nSections B16;
+    CARD16	nDoodads B16;
+    CARD16	nKeyAliases B16;
+    CARD8	baseColorNdx;
+    CARD8	labelColorNdx;
+} xkbGetGeometryReply;
+#define	sz_xkbGetGeometryReply	32
+
+typedef struct _xkbSetGeometry {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* always X_KBSetGeometry */
+    CARD16	length B16;
+    CARD16	deviceSpec B16;
+    CARD8	nShapes;
+    CARD8	nSections;
+    Atom	name B32;
+    CARD16	widthMM B16;
+    CARD16	heightMM B16;
+    CARD16	nProperties B16;
+    CARD16	nColors B16;
+    CARD16	nDoodads B16;
+    CARD16	nKeyAliases B16;
+    CARD8	baseColorNdx;
+    CARD8	labelColorNdx;
+    CARD16	pad B16;
+} xkbSetGeometryReq;
+#define	sz_xkbSetGeometryReq	28
+
+typedef struct _xkbPerClientFlags {
+    CARD8	reqType;
+    CARD8	xkbReqType;/* always X_KBPerClientFlags */
+    CARD16	length B16;
+    CARD16	deviceSpec B16;
+    CARD16	pad1 B16;
+    CARD32	change B32;
+    CARD32	value B32;
+    CARD32	ctrlsToChange B32;
+    CARD32	autoCtrls B32;
+    CARD32	autoCtrlValues B32;
+} xkbPerClientFlagsReq;
+#define	sz_xkbPerClientFlagsReq	28
+
+typedef struct _xkbPerClientFlagsReply {
+    CARD8	type;		/* always X_Reply */
+    CARD8	deviceID;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	supported B32;
+    CARD32	value B32;
+    CARD32	autoCtrls B32;
+    CARD32	autoCtrlValues B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+} xkbPerClientFlagsReply;
+#define	sz_xkbPerClientFlagsReply	32
+
+typedef struct _xkbListComponents {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* always X_KBListComponents */
+    CARD16	length B16;
+    CARD16	deviceSpec B16;
+    CARD16	maxNames B16;
+} xkbListComponentsReq;
+#define	sz_xkbListComponentsReq	8
+
+typedef struct _xkbListComponentsReply {
+    CARD8	type;		/* always X_Reply */
+    CARD8	deviceID;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	nKeymaps B16;
+    CARD16	nKeycodes B16;
+    CARD16	nTypes B16;
+    CARD16	nCompatMaps B16;
+    CARD16	nSymbols B16;
+    CARD16	nGeometries B16;
+    CARD16	extra B16;
+    CARD16	pad1 B16;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+} xkbListComponentsReply;
+#define	sz_xkbListComponentsReply	32
+
+typedef struct _xkbGetKbdByName {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* always X_KBGetKbdByName */
+    CARD16	length B16;
+    CARD16	deviceSpec B16;
+    CARD16	need B16;	/* combination of XkbGBN_* */
+    CARD16	want B16;	/* combination of XkbGBN_* */
+    BOOL	load;
+    CARD8	pad;
+} xkbGetKbdByNameReq;
+#define	sz_xkbGetKbdByNameReq	12
+
+typedef struct _xkbGetKbdByNameReply {
+    CARD8	type;		/* always X_Reply */
+    CARD8	deviceID;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    KeyCode	minKeyCode;
+    KeyCode	maxKeyCode;
+    BOOL	loaded;
+    BOOL	newKeyboard;
+    CARD16	found B16;	/* combination of XkbGBN_* */
+    CARD16	reported B16;	/* combination of XkbAllComponents */
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+} xkbGetKbdByNameReply;
+#define	sz_xkbGetKbdByNameReply	32
+
+typedef	struct _xkbDeviceLedsWireDesc {
+    CARD16	ledClass B16;
+    CARD16	ledID B16;
+    CARD32	namesPresent B32;
+    CARD32	mapsPresent B32;
+    CARD32	physIndicators B32;
+    CARD32	state B32;
+} xkbDeviceLedsWireDesc;
+#define sz_xkbDeviceLedsWireDesc	20
+
+typedef struct _xkbGetDeviceInfo {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* always X_KBGetDeviceInfo */
+    CARD16	length B16;
+    CARD16	deviceSpec B16;
+    CARD16	wanted B16;
+    BOOL	allBtns;
+    CARD8	firstBtn;
+    CARD8	nBtns;
+    CARD8	pad;
+    CARD16	ledClass B16;
+    CARD16	ledID B16;
+} xkbGetDeviceInfoReq;
+#define	sz_xkbGetDeviceInfoReq	16
+
+typedef struct _xkbGetDeviceInfoReply {
+    CARD8	type;		/* always X_Reply */
+    CARD8	deviceID;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	present B16;
+    CARD16	supported B16;
+    CARD16	unsupported B16;
+    CARD16	nDeviceLedFBs B16;
+    CARD8	firstBtnWanted;
+    CARD8	nBtnsWanted;
+    CARD8	firstBtnRtrn;
+    CARD8	nBtnsRtrn;
+    CARD8	totalBtns;
+    BOOL	hasOwnState;
+    CARD16	dfltKbdFB B16;
+    CARD16	dfltLedFB B16;
+    CARD16	pad B16;
+    Atom	devType B32;
+} xkbGetDeviceInfoReply;
+#define	sz_xkbGetDeviceInfoReply	32
+
+typedef struct _xkbSetDeviceInfo {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* always X_KBSetDeviceInfo */
+    CARD16	length B16;
+    CARD16	deviceSpec B16;
+    CARD8	firstBtn;
+    CARD8	nBtns;
+    CARD16	change B16;
+    CARD16	nDeviceLedFBs B16;
+} xkbSetDeviceInfoReq;
+#define	sz_xkbSetDeviceInfoReq	12
+
+typedef struct _xkbSetDebuggingFlags {
+    CARD8	reqType;
+    CARD8	xkbReqType;	/* always X_KBSetDebuggingFlags */
+    CARD16	length B16;
+    CARD16	msgLength B16;
+    CARD16	pad B16;
+    CARD32	affectFlags B32;
+    CARD32	flags B32;
+    CARD32	affectCtrls B32;
+    CARD32	ctrls B32;
+} xkbSetDebuggingFlagsReq;
+#define	sz_xkbSetDebuggingFlagsReq	24
+
+typedef struct _xkbSetDebuggingFlagsReply {
+    BYTE	type;		/* X_Reply */
+    CARD8	pad0;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	currentFlags B32;
+    CARD32	currentCtrls B32;
+    CARD32	supportedFlags B32;
+    CARD32	supportedCtrls B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+} xkbSetDebuggingFlagsReply;
+#define	sz_xkbSetDebuggingFlagsReply	32
+
+	/*
+	 * X KEYBOARD EXTENSION EVENT STRUCTURES
+	 */
+
+typedef struct _xkbAnyEvent {
+    BYTE	type;
+    BYTE	xkbType;
+    CARD16	sequenceNumber B16;
+    Time	time B32;
+    CARD8	deviceID;
+    CARD8	pad1;
+    CARD16	pad2 B16;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+    CARD32	pad7 B32;
+} xkbAnyEvent;
+#define	sz_xkbAnyEvent 32
+
+typedef	struct _xkbNewKeyboardNotify {
+    BYTE	type;
+    BYTE	xkbType;
+    CARD16	sequenceNumber B16;
+    Time	time B32;
+    CARD8	deviceID;
+    CARD8	oldDeviceID;
+    KeyCode	minKeyCode;
+    KeyCode	maxKeyCode;
+    KeyCode	oldMinKeyCode;
+    KeyCode	oldMaxKeyCode;
+    CARD8	requestMajor;
+    CARD8	requestMinor;
+    CARD16	changed B16;
+    CARD8	detail;
+    CARD8	pad1;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+} xkbNewKeyboardNotify;
+#define	sz_xkbNewKeyboardNotify	32
+
+typedef	struct _xkbMapNotify {
+    BYTE	type;
+    BYTE	xkbType;
+    CARD16	sequenceNumber B16;
+    Time	time B32;
+    CARD8	deviceID;
+    CARD8	ptrBtnActions;
+    CARD16	changed B16;
+    KeyCode	minKeyCode;
+    KeyCode	maxKeyCode;
+    CARD8	firstType;
+    CARD8	nTypes;
+    KeyCode	firstKeySym;
+    CARD8	nKeySyms;
+    KeyCode	firstKeyAct;
+    CARD8	nKeyActs;
+    KeyCode	firstKeyBehavior;
+    CARD8	nKeyBehaviors;
+    KeyCode	firstKeyExplicit;
+    CARD8	nKeyExplicit;
+    KeyCode	firstModMapKey;
+    CARD8	nModMapKeys;
+    KeyCode	firstVModMapKey;
+    CARD8	nVModMapKeys;
+    CARD16	virtualMods B16;
+    CARD16	pad1 B16;
+} xkbMapNotify;
+#define	sz_xkbMapNotify	32
+
+typedef	struct _xkbStateNotify {
+    BYTE	type;
+    BYTE	xkbType;
+    CARD16	sequenceNumber B16;
+    Time	time B32;
+    CARD8	deviceID;
+    CARD8	mods;
+    CARD8	baseMods;
+    CARD8	latchedMods;
+    CARD8	lockedMods;
+    CARD8	group;
+    INT16	baseGroup B16;
+    INT16	latchedGroup B16;
+    CARD8	lockedGroup;
+    CARD8	compatState;
+    CARD8	grabMods;
+    CARD8	compatGrabMods;
+    CARD8	lookupMods;
+    CARD8	compatLookupMods;
+    CARD16	ptrBtnState B16;
+    CARD16	changed B16;
+    KeyCode	keycode;
+    CARD8	eventType;
+    CARD8	requestMajor;
+    CARD8	requestMinor;
+} xkbStateNotify;
+#define	sz_xkbStateNotify	32
+
+typedef struct _xkbControlsNotify {
+    BYTE	type;
+    BYTE	xkbType;
+    CARD16	sequenceNumber B16;
+    Time	time B32;
+    CARD8	deviceID;
+    CARD8	numGroups;
+    CARD16	pad1 B16;
+    CARD32	changedControls B32;
+    CARD32	enabledControls B32;
+    CARD32	enabledControlChanges B32;
+    KeyCode	keycode;
+    CARD8	eventType;
+    CARD8	requestMajor;
+    CARD8	requestMinor;
+    CARD32	pad2 B32;
+} xkbControlsNotify;
+#define	sz_xkbControlsNotify	32
+
+typedef struct _xkbIndicatorNotify {
+    BYTE	type;
+    BYTE	xkbType;
+    CARD16	sequenceNumber B16;
+    Time	time B32;
+    CARD8	deviceID;
+    CARD8	pad1;
+    CARD16	pad2 B16;
+    CARD32	state B32;
+    CARD32	changed B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xkbIndicatorNotify;
+#define	sz_xkbIndicatorNotify	32
+
+typedef struct _xkbNamesNotify {
+    BYTE	type;
+    BYTE	xkbType;
+    CARD16	sequenceNumber B16;
+    Time	time B32;
+    CARD8	deviceID;
+    CARD8	pad1;
+    CARD16	changed B16;
+    CARD8	firstType;
+    CARD8	nTypes;
+    CARD8	firstLevelName;
+    CARD8	nLevelNames;
+    CARD8	pad2;
+    CARD8	nRadioGroups;
+    CARD8	nAliases;
+    CARD8	changedGroupNames;
+    CARD16	changedVirtualMods B16;
+    CARD8	firstKey;
+    CARD8	nKeys;
+    CARD32	changedIndicators B32;
+    CARD32	pad3 B32;
+} xkbNamesNotify;
+#define	sz_xkbNamesNotify	32
+
+typedef struct _xkbCompatMapNotify {
+    BYTE	type;
+    BYTE	xkbType;
+    CARD16	sequenceNumber B16;
+    Time	time B32;
+    CARD8	deviceID;
+    CARD8	changedGroups;
+    CARD16	firstSI B16;
+    CARD16	nSI B16;
+    CARD16	nTotalSI B16;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+} xkbCompatMapNotify;
+#define sz_xkbCompatMapNotify	32
+
+typedef struct _xkbBellNotify {
+    BYTE	type;
+    BYTE	xkbType;
+    CARD16	sequenceNumber B16;
+    Time	time B32;
+    CARD8	deviceID;
+    CARD8	bellClass;
+    CARD8	bellID;
+    CARD8	percent;
+    CARD16	pitch B16;
+    CARD16	duration B16;
+    Atom	name B32;
+    Window	window B32;
+    BOOL	eventOnly;
+    CARD8	pad1;
+    CARD16	pad2 B16;
+    CARD32	pad3 B32;
+} xkbBellNotify;
+#define	sz_xkbBellNotify	32
+
+typedef struct _xkbActionMessage {
+    BYTE	type;
+    BYTE	xkbType;
+    CARD16	sequenceNumber B16;
+    Time	time B32;
+    CARD8	deviceID;
+    KeyCode	keycode;
+    BOOL	press;
+    BOOL	keyEventFollows;
+    CARD8	mods;
+    CARD8	group;
+    CARD8	message[8];
+    CARD16	pad1 B16;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+} xkbActionMessage;
+#define	sz_xkbActionMessage		32
+
+typedef struct _xkbAccessXNotify {
+    BYTE	type;
+    BYTE	xkbType;
+    CARD16	sequenceNumber B16;
+    Time	time B32;
+    CARD8	deviceID;
+    KeyCode	keycode;
+    CARD16	detail B16;
+    CARD16	slowKeysDelay B16;
+    CARD16	debounceDelay B16;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+} xkbAccessXNotify;
+#define	sz_xkbAccessXNotify	32
+
+typedef struct _xkbExtensionDeviceNotify {
+    BYTE	type;
+    BYTE	xkbType;
+    CARD16	sequenceNumber B16;
+    Time	time B32;
+    CARD8	deviceID;
+    CARD8	pad1;
+    CARD16	reason B16;
+    CARD16	ledClass B16;
+    CARD16	ledID B16;
+    CARD32	ledsDefined B32;
+    CARD32	ledState B32;
+    CARD8	firstBtn;
+    CARD8	nBtns;
+    CARD16	supported B16;
+    CARD16	unsupported B16;
+    CARD16	pad3 B16;
+} xkbExtensionDeviceNotify;
+#define	sz_xkbExtensionDeviceNotify		32
+
+typedef struct _xkbEvent {
+    union {
+	xkbAnyEvent		any;
+	xkbNewKeyboardNotify	new_kbd;
+	xkbMapNotify		map;
+	xkbStateNotify		state;
+	xkbControlsNotify	ctrls;
+	xkbIndicatorNotify	indicators;
+	xkbNamesNotify		names;
+	xkbCompatMapNotify	compat;
+	xkbBellNotify		bell;
+	xkbActionMessage	message;
+	xkbAccessXNotify	accessx;
+	xkbExtensionDeviceNotify device;
+    } u;
+} xkbEvent;
+#define sz_xkbEvent	32
+
+#undef Window
+#undef Atom
+#undef Time
+#undef KeyCode
+#undef KeySym
+
+#endif /* _XKBPROTO_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/XKBrules.h b/ThirdParty/X11/Include/X11/extensions/XKBrules.h
new file mode 100644
index 0000000000000000000000000000000000000000..47360569afe79a388856e35634f1657b16a9a36a
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XKBrules.h
@@ -0,0 +1,197 @@
+#ifndef _XKBRULES_H_
+#define	_XKBRULES_H_ 1
+
+/************************************************************
+ Copyright (c) 1996 by Silicon Graphics Computer Systems, Inc.
+
+ Permission to use, copy, modify, and distribute this
+ software and its documentation for any purpose and without
+ fee is hereby granted, provided that the above copyright
+ notice appear in all copies and that both that copyright
+ notice and this permission notice appear in supporting
+ documentation, and that the name of Silicon Graphics not be
+ used in advertising or publicity pertaining to distribution
+ of the software without specific prior written permission.
+ Silicon Graphics makes no representation about the suitability
+ of this software for any purpose. It is provided "as is"
+ without any express or implied warranty.
+
+ SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+ GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+ THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+ ********************************************************/
+
+/***====================================================================***/
+
+typedef struct _XkbRF_VarDefs {
+	char *			model;
+	char *			layout;
+	char *			variant;
+	char *			options;
+	unsigned short		sz_extra;
+	unsigned short		num_extra;
+	char *			extra_names;
+	char **			extra_values;
+} XkbRF_VarDefsRec,*XkbRF_VarDefsPtr;
+
+typedef struct _XkbRF_VarDesc {
+	char *			name;
+	char *			desc;
+} XkbRF_VarDescRec, *XkbRF_VarDescPtr;
+
+typedef struct _XkbRF_DescribeVars {
+	int			sz_desc;
+	int			num_desc;
+	XkbRF_VarDescPtr	desc;
+} XkbRF_DescribeVarsRec,*XkbRF_DescribeVarsPtr;
+
+typedef struct _XkbRF_Rule {
+	int			number;
+        int			layout_num;
+        int			variant_num;
+	char *			model;
+	char *			layout;
+	char *			variant;
+	char *			option;
+	/* yields */
+	char *			keycodes;
+	char *			symbols;
+	char *			types;
+	char *			compat;
+	char *			geometry;
+	char *			keymap;
+	unsigned		flags;
+} XkbRF_RuleRec,*XkbRF_RulePtr;
+
+typedef struct _XkbRF_Group {
+	int			number;
+	char *			name;
+	char *			words;
+} XkbRF_GroupRec, *XkbRF_GroupPtr;
+
+#define	XkbRF_PendingMatch	(1L<<1)
+#define	XkbRF_Option		(1L<<2)
+#define	XkbRF_Append		(1L<<3)
+#define	XkbRF_Normal		(1L<<4)
+#define	XkbRF_Invalid		(1L<<5)
+
+typedef struct _XkbRF_Rules {
+	XkbRF_DescribeVarsRec	models;
+	XkbRF_DescribeVarsRec	layouts;
+	XkbRF_DescribeVarsRec	variants;
+	XkbRF_DescribeVarsRec	options;
+	unsigned short		sz_extra;
+	unsigned short		num_extra;
+	char **			extra_names;
+	XkbRF_DescribeVarsPtr	extra;
+
+	unsigned short		sz_rules;
+	unsigned short		num_rules;
+	XkbRF_RulePtr		rules;
+	unsigned short		sz_groups;
+	unsigned short		num_groups;
+        XkbRF_GroupPtr		groups;
+} XkbRF_RulesRec, *XkbRF_RulesPtr;
+
+/***====================================================================***/
+
+_XFUNCPROTOBEGIN
+
+extern Bool	XkbRF_GetComponents(
+    XkbRF_RulesPtr		/* rules */,
+    XkbRF_VarDefsPtr		/* var_defs */,
+    XkbComponentNamesPtr	/* names */
+);
+
+extern XkbRF_RulePtr	XkbRF_AddRule(
+    XkbRF_RulesPtr	/* rules */
+);
+
+extern XkbRF_GroupPtr XkbRF_AddGroup(XkbRF_RulesPtr  rules);
+
+extern Bool	XkbRF_LoadRules(
+    FILE *		/* file */,
+    XkbRF_RulesPtr	/* rules */
+);
+
+extern Bool XkbRF_LoadRulesByName(
+    char *		/* base */,
+    char *		/* locale */,
+    XkbRF_RulesPtr	/* rules */
+);
+
+/***====================================================================***/
+
+extern XkbRF_VarDescPtr	XkbRF_AddVarDesc(
+    XkbRF_DescribeVarsPtr	/* vars */
+);
+
+extern XkbRF_VarDescPtr	XkbRF_AddVarDescCopy(
+    XkbRF_DescribeVarsPtr	/* vars */,
+    XkbRF_VarDescPtr		/* copy_from */
+);
+
+extern XkbRF_DescribeVarsPtr XkbRF_AddVarToDescribe(
+    XkbRF_RulesPtr		/* rules */,
+    char *			/* name */
+);
+
+extern Bool	XkbRF_LoadDescriptions(
+    FILE *		/* file */,
+    XkbRF_RulesPtr	/* rules */
+);
+
+extern Bool XkbRF_LoadDescriptionsByName(
+    char *		/* base */,
+    char *		/* locale */,
+    XkbRF_RulesPtr	/* rules */
+);
+
+extern XkbRF_RulesPtr XkbRF_Load(
+    char *		/* base */,
+    char *		/* locale */,
+    Bool		/* wantDesc */,
+    Bool		/* wantRules */
+);
+
+extern XkbRF_RulesPtr XkbRF_Create(
+    int			/* sz_rules */,
+    int			/* sz_extra */
+);
+
+/***====================================================================***/
+
+extern void XkbRF_Free(
+    XkbRF_RulesPtr	/* rules */,
+    Bool		/* freeRules */
+);
+
+
+/***====================================================================***/
+
+#define	_XKB_RF_NAMES_PROP_ATOM		"_XKB_RULES_NAMES"
+#define	_XKB_RF_NAMES_PROP_MAXLEN	1024
+
+
+extern Bool XkbRF_GetNamesProp(
+   Display *		/* dpy */,
+   char **		/* rules_file_rtrn */,
+   XkbRF_VarDefsPtr	/* var_defs_rtrn */
+);
+
+extern Bool XkbRF_SetNamesProp(
+   Display *		/* dpy */,
+   char *		/* rules_file */,
+   XkbRF_VarDefsPtr	/* var_defs */
+);
+
+
+_XFUNCPROTOEND
+
+#endif /* _XKBRULES_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/XKBsrv.h b/ThirdParty/X11/Include/X11/extensions/XKBsrv.h
new file mode 100644
index 0000000000000000000000000000000000000000..be7e9784ae4acf7c1b9c63289d1323e32d0eb6e2
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XKBsrv.h
@@ -0,0 +1,1184 @@
+/************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be 
+used in advertising or publicity pertaining to distribution 
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability 
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef _XKBSRV_H_
+#define	_XKBSRV_H_
+
+#ifdef XKB_IN_SERVER
+#define XkbAllocClientMap		SrvXkbAllocClientMap
+#define XkbAllocServerMap		SrvXkbAllocServerMap
+#define XkbChangeTypesOfKey		SrvXkbChangeTypesOfKey
+#define	XkbAddKeyType			SrvXkbAddKeyType
+#define XkbCopyKeyType			SrvXkbCopyKeyType
+#define XkbCopyKeyTypes			SrvXkbCopyKeyTypes
+#define XkbFreeClientMap		SrvXkbFreeClientMap
+#define XkbFreeServerMap		SrvXkbFreeServerMap
+#define XkbInitCanonicalKeyTypes	SrvXkbInitCanonicalKeyTypes
+#define	XkbKeyTypesForCoreSymbols	SrvXkbKeyTypesForCoreSymbols
+#define	XkbApplyCompatMapToKey		SrvXkbApplyCompatMapToKey
+#define	XkbUpdateMapFromCore		SrvXkbUpdateMapFromCore
+#define XkbResizeKeyActions		SrvXkbResizeKeyActions
+#define XkbResizeKeySyms		SrvXkbResizeKeySyms
+#define XkbResizeKeyType		SrvXkbResizeKeyType
+#define XkbAllocCompatMap		SrvXkbAllocCompatMap
+#define XkbAllocControls		SrvXkbAllocControls
+#define XkbAllocIndicatorMaps		SrvXkbAllocIndicatorMaps
+#define XkbAllocKeyboard		SrvXkbAllocKeyboard
+#define XkbAllocNames			SrvXkbAllocNames
+#define XkbFreeCompatMap		SrvXkbFreeCompatMap
+#define XkbFreeControls			SrvXkbFreeControls
+#define XkbFreeIndicatorMaps		SrvXkbFreeIndicatorMaps
+#define XkbFreeKeyboard			SrvXkbFreeKeyboard
+#define XkbFreeNames			SrvXkbFreeNames
+#define	XkbAddDeviceLedInfo		SrvXkbAddDeviceLedInfo
+#define	XkbAllocDeviceInfo		SrvXkbAllocDeviceInfo
+#define	XkbFreeDeviceInfo		SrvXkbFreeDeviceInfo
+#define	XkbResizeDeviceButtonActions	SrvXkbResizeDeviceButtonActions
+#define XkbLatchModifiers		SrvXkbLatchModifiers
+#define XkbLatchGroup			SrvXkbLatchGroup
+#define XkbVirtualModsToReal		SrvXkbVirtualModsToReal
+#define	XkbChangeKeycodeRange		SrvXkbChangeKeycodeRange
+#define	XkbApplyVirtualModChanges	SrvXkbApplyVirtualModChanges
+#define	XkbUpdateActionVirtualMods	SrvXkbUpdateActionVirtualMods
+#define XkbUpdateKeyTypeVirtualMods	SrvXkbUpdateKeyTypeVirtualMods
+#endif
+
+#include <X11/extensions/XKBstr.h>
+#include <X11/extensions/XKBproto.h>
+#include "inputstr.h"
+
+typedef struct _XkbInterest {
+	DeviceIntPtr		dev;
+	ClientPtr		client;
+	XID			resource;
+	struct _XkbInterest *	next;
+	CARD16			extDevNotifyMask;
+	CARD16			stateNotifyMask;
+	CARD16			namesNotifyMask;
+	CARD32 			ctrlsNotifyMask;
+	CARD8			compatNotifyMask;
+	BOOL			bellNotifyMask;
+	BOOL			actionMessageMask;
+	CARD16			accessXNotifyMask;
+	CARD32			iStateNotifyMask;
+	CARD32			iMapNotifyMask;
+	CARD16			altSymsNotifyMask;
+	CARD32			autoCtrls;
+	CARD32			autoCtrlValues;
+} XkbInterestRec,*XkbInterestPtr;
+
+typedef struct _XkbRadioGroup {
+	CARD8		flags;
+	CARD8		nMembers;
+	CARD8		dfltDown;
+	CARD8		currentDown;
+	CARD8		members[XkbRGMaxMembers];
+} XkbRadioGroupRec, *XkbRadioGroupPtr;
+
+typedef struct	_XkbEventCause {
+	CARD8		kc;
+	CARD8		event;
+	CARD8		mjr;
+	CARD8		mnr;
+	ClientPtr	client;
+} XkbEventCauseRec,*XkbEventCausePtr;
+#define	XkbSetCauseKey(c,k,e)	{ (c)->kc= (k),(c)->event= (e),\
+				  (c)->mjr= (c)->mnr= 0; \
+				  (c)->client= NULL; }
+#define	XkbSetCauseReq(c,j,n,cl) { (c)->kc= (c)->event= 0,\
+				  (c)->mjr= (j),(c)->mnr= (n);\
+				  (c)->client= (cl); }
+#define	XkbSetCauseCoreReq(c,e,cl) XkbSetCauseReq(c,e,0,cl)
+#define	XkbSetCauseXkbReq(c,e,cl)  XkbSetCauseReq(c,XkbReqCode,e,cl)
+#define	XkbSetCauseUnknown(c)	   XkbSetCauseKey(c,0,0)
+
+#define	_OFF_TIMER		0
+#define	_KRG_WARN_TIMER		1
+#define	_KRG_TIMER		2
+#define	_SK_TIMEOUT_TIMER	3
+#define	_ALL_TIMEOUT_TIMER	4
+
+#define	_BEEP_NONE		0
+#define	_BEEP_FEATURE_ON	1
+#define	_BEEP_FEATURE_OFF	2
+#define	_BEEP_FEATURE_CHANGE	3
+#define	_BEEP_SLOW_WARN		4
+#define	_BEEP_SLOW_PRESS	5
+#define	_BEEP_SLOW_ACCEPT	6
+#define	_BEEP_SLOW_REJECT	7
+#define	_BEEP_SLOW_RELEASE	8
+#define	_BEEP_STICKY_LATCH	9
+#define	_BEEP_STICKY_LOCK	10
+#define	_BEEP_STICKY_UNLOCK	11
+#define	_BEEP_LED_ON		12
+#define	_BEEP_LED_OFF		13
+#define	_BEEP_LED_CHANGE	14
+#define	_BEEP_BOUNCE_REJECT	15
+
+typedef struct _XkbSrvInfo {
+	XkbStateRec	 prev_state;
+	XkbStateRec	 state;
+	XkbDescPtr	 desc;
+
+	DeviceIntPtr	 device;
+	KbdCtrlProcPtr	 kbdProc;
+
+	XkbRadioGroupPtr radioGroups;
+	CARD8		 nRadioGroups;
+	CARD8		 clearMods;
+	CARD8		 setMods;
+	INT16		 groupChange;
+
+	CARD16		 dfltPtrDelta;
+
+	double		 mouseKeysCurve;
+	double		 mouseKeysCurveFactor;
+	INT16		 mouseKeysDX;
+	INT16		 mouseKeysDY;
+	CARD8		 mouseKeysFlags;
+	Bool		 mouseKeysAccel;
+	CARD8		 mouseKeysCounter;
+
+	CARD8		 lockedPtrButtons;
+	CARD8		 shiftKeyCount;
+	KeyCode		 mouseKey;
+	KeyCode		 inactiveKey;
+	KeyCode		 slowKey;
+	KeyCode		 repeatKey;
+	CARD8		 krgTimerActive;
+	CARD8		 beepType;
+	CARD8		 beepCount;
+
+	CARD32		 flags;
+	CARD32		 lastPtrEventTime;
+	CARD32		 lastShiftEventTime;
+	OsTimerPtr	 beepTimer;
+	OsTimerPtr	 mouseKeyTimer;
+	OsTimerPtr	 slowKeysTimer;
+	OsTimerPtr	 bounceKeysTimer;
+	OsTimerPtr	 repeatKeyTimer;
+	OsTimerPtr	 krgTimer;
+} XkbSrvInfoRec, *XkbSrvInfoPtr;
+
+#define	XkbSLI_IsDefault	(1L<<0)
+#define	XkbSLI_HasOwnState	(1L<<1)
+
+typedef struct	_XkbSrvLedInfo {
+	CARD16			flags;
+	CARD16			class;
+	CARD16			id;
+	union {
+	    KbdFeedbackPtr	kf;
+	    LedFeedbackPtr	lf;
+	} 			fb;
+
+	CARD32			physIndicators;
+	CARD32			autoState;
+	CARD32			explicitState;
+	CARD32			effectiveState;
+
+	CARD32			mapsPresent;
+	CARD32			namesPresent;
+	XkbIndicatorMapPtr	maps;
+	Atom *			names;
+
+	CARD32			usesBase;
+	CARD32			usesLatched;
+	CARD32			usesLocked;
+	CARD32			usesEffective;
+	CARD32			usesCompat;
+	CARD32			usesControls;
+
+	CARD32			usedComponents;
+} XkbSrvLedInfoRec, *XkbSrvLedInfoPtr;
+
+/*
+ * Settings for xkbClientFlags field (used by DIX)
+ * These flags _must_ not overlap with XkbPCF_*
+ */
+#define	_XkbClientInitialized		(1<<15)
+
+#define	_XkbWantsDetectableAutoRepeat(c)\
+	((c)->xkbClientFlags&XkbPCF_DetectableAutoRepeatMask)
+
+/*
+ * Settings for flags field
+ */
+#define	_XkbStateNotifyInProgress	(1<<0)
+
+typedef struct
+{
+    ProcessInputProc processInputProc;
+    ProcessInputProc realInputProc;
+    DeviceUnwrapProc unwrapProc;
+} xkbDeviceInfoRec, *xkbDeviceInfoPtr;
+
+#define WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \
+	device->public.processInputProc = proc; \
+	oldprocs->processInputProc = \
+	oldprocs->realInputProc = device->public.realInputProc; \
+	device->public.realInputProc = proc; \
+	oldprocs->unwrapProc = device->unwrapProc; \
+	device->unwrapProc = unwrapproc;
+
+#define COND_WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \
+	if (device->public.processInputProc == device->public.realInputProc)\
+	    device->public.processInputProc = proc; \
+	oldprocs->processInputProc = \
+	oldprocs->realInputProc = device->public.realInputProc; \
+	device->public.realInputProc = proc; \
+	oldprocs->unwrapProc = device->unwrapProc; \
+	device->unwrapProc = unwrapproc;
+
+#define UNWRAP_PROCESS_INPUT_PROC(device, oldprocs) \
+	device->public.processInputProc = oldprocs->processInputProc; \
+	device->public.realInputProc = oldprocs->realInputProc; \
+	device->unwrapProc = oldprocs->unwrapProc;
+
+#define XKBDEVICEINFO(dev) ((xkbDeviceInfoPtr) (dev)->devPrivates[xkbDevicePrivateIndex].ptr)
+
+/***====================================================================***/
+
+
+/***====================================================================***/
+
+#define XkbAX_KRGMask	 (XkbSlowKeysMask|XkbBounceKeysMask)
+#define	XkbAllFilteredEventsMask \
+	(XkbAccessXKeysMask|XkbRepeatKeysMask|XkbMouseKeysAccelMask|XkbAX_KRGMask)
+
+/***====================================================================***/
+
+extern int	XkbReqCode;
+extern int	XkbEventBase;
+extern int	XkbKeyboardErrorCode;
+extern int	XkbDisableLockActions;
+extern char *	XkbBaseDirectory;
+extern char *	XkbBinDirectory;
+extern char *	XkbInitialMap;
+extern int	_XkbClientMajor;
+extern int	_XkbClientMinor;
+extern unsigned	int XkbXIUnsupported;
+
+extern char *	XkbModelUsed,*XkbLayoutUsed,*XkbVariantUsed,*XkbOptionsUsed;
+extern Bool	noXkbExtension;
+extern Bool	XkbWantRulesProp;
+
+extern pointer	XkbLastRepeatEvent;
+
+extern CARD32	xkbDebugFlags;
+extern CARD32	xkbDebugCtrls;
+
+#define	_XkbAlloc(s)		xalloc((s))
+#define	_XkbCalloc(n,s)		Xcalloc((n)*(s))
+#define	_XkbRealloc(o,s)	Xrealloc((o),(s))
+#define	_XkbTypedAlloc(t)	((t *)xalloc(sizeof(t)))
+#define	_XkbTypedCalloc(n,t)	((t *)Xcalloc((n)*sizeof(t)))
+#define	_XkbTypedRealloc(o,n,t) \
+	((o)?(t *)Xrealloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t))
+#define	_XkbClearElems(a,f,l,t)	bzero(&(a)[f],((l)-(f)+1)*sizeof(t))
+#define	_XkbFree(p)		Xfree(p)
+
+#define	_XkbLibError(c,l,d) \
+	{ _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); }
+#define	_XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff)))
+#define	_XkbErrCode3(a,b,c)	_XkbErrCode2(a,(((unsigned int)(b))<<16)|(c))
+#define	_XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d)))
+
+extern	int	DeviceKeyPress,DeviceKeyRelease;
+extern	int	DeviceButtonPress,DeviceButtonRelease;
+
+#ifdef XINPUT
+#define	_XkbIsPressEvent(t)	(((t)==KeyPress)||((t)==DeviceKeyPress))
+#define	_XkbIsReleaseEvent(t)	(((t)==KeyRelease)||((t)==DeviceKeyRelease))
+#else
+#define	_XkbIsPressEvent(t)	((t)==KeyPress)
+#define	_XkbIsReleaseEvent(t)	((t)==KeyRelease)
+#endif
+
+#define	_XkbCoreKeycodeInRange(c,k)	(((k)>=(c)->curKeySyms.minKeyCode)&&\
+					 ((k)<=(c)->curKeySyms.maxKeyCode))
+#define	_XkbCoreNumKeys(c)	((c)->curKeySyms.maxKeyCode-\
+				 (c)->curKeySyms.minKeyCode+1)
+
+#define	XConvertCase(s,l,u)	XkbConvertCase(s,l,u)
+#undef	IsKeypadKey
+#define	IsKeypadKey(s)		XkbKSIsKeypad(s)
+
+typedef int Status;
+typedef pointer XPointer;
+typedef struct _XDisplay Display;
+
+#ifndef True
+#define	True	1
+#define	False	0
+#endif
+
+#ifndef PATH_MAX
+#ifdef MAXPATHLEN
+#define	PATH_MAX MAXPATHLEN
+#else
+#define	PATH_MAX 1024
+#endif
+#endif
+
+_XFUNCPROTOBEGIN
+
+extern void XkbUseMsg(
+    void
+);
+
+extern int XkbProcessArguments(
+    int				/* argc */,
+    char **			/* argv */,
+    int				/* i */
+);
+
+extern	void	XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc);
+
+extern	void	XkbFreeCompatMap(
+    XkbDescPtr			/* xkb */,
+    unsigned int		/* which */,
+    Bool			/* freeMap */
+);
+
+extern	void XkbFreeNames(
+	XkbDescPtr		/* xkb */,
+	unsigned int		/* which */,
+	Bool			/* freeMap */
+);
+
+extern DeviceIntPtr _XkbLookupAnyDevice(
+    int			/* id */,
+    int *		/* why_rtrn */
+);
+
+extern DeviceIntPtr _XkbLookupKeyboard(
+    int			/* id */,
+    int *		/* why_rtrn */
+);
+
+extern DeviceIntPtr _XkbLookupBellDevice(
+    int			/* id */,
+    int *		/* why_rtrn */
+);
+
+extern DeviceIntPtr _XkbLookupLedDevice(
+    int			/* id */,
+    int *		/* why_rtrn */
+);
+
+extern DeviceIntPtr _XkbLookupButtonDevice(
+    int			/* id */,
+    int *		/* why_rtrn */
+);
+
+extern	XkbDescPtr XkbAllocKeyboard(
+	void
+);
+
+extern	Status XkbAllocClientMap(
+	XkbDescPtr		/* xkb */,
+	unsigned int		/* which */,
+	unsigned int		/* nTypes */
+);
+
+extern	Status XkbAllocServerMap(
+	XkbDescPtr		/* xkb */,
+	unsigned int		/* which */,
+	unsigned int		/* nNewActions */
+);
+
+extern	void	XkbFreeClientMap(
+    XkbDescPtr			/* xkb */,
+    unsigned int		/* what */,
+    Bool			/* freeMap */
+);
+
+extern	void	XkbFreeServerMap(
+    XkbDescPtr			/* xkb */,
+    unsigned int		/* what */,
+    Bool			/* freeMap */
+);
+
+extern	Status XkbAllocIndicatorMaps(
+	XkbDescPtr		/* xkb */
+);
+
+extern	Status	XkbAllocCompatMap(
+    XkbDescPtr			/* xkb */,
+    unsigned int		/* which */,
+    unsigned int		/* nInterpret */
+);
+
+extern	Status XkbAllocNames(
+	XkbDescPtr		/* xkb */,
+	unsigned int		/* which */,
+	int			/* nTotalRG */,
+	int			/* nTotalAliases */
+);
+
+extern	Status	XkbAllocControls(
+	XkbDescPtr		/* xkb */,
+	unsigned int		/* which*/
+);
+
+extern	Status	XkbCopyKeyType(
+    XkbKeyTypePtr		/* from */,
+    XkbKeyTypePtr		/* into */
+);
+
+extern	Status	XkbCopyKeyTypes(
+    XkbKeyTypePtr		/* from */,
+    XkbKeyTypePtr		/* into */,
+    int				/* num_types */
+);
+
+extern	Status	XkbResizeKeyType(
+    XkbDescPtr		/* xkb */,
+    int			/* type_ndx */,
+    int			/* map_count */,
+    Bool		/* want_preserve */,
+    int			/* new_num_lvls */
+);
+
+extern	void	XkbFreeKeyboard(
+	XkbDescPtr		/* xkb */,
+	unsigned int		/* which */,
+	Bool			/* freeDesc */
+);
+
+extern  void XkbSetActionKeyMods(
+	XkbDescPtr		/* xkb */,
+	XkbAction *		/* act */,
+	unsigned int 		/* mods */
+);
+
+extern Bool XkbCheckActionVMods(
+	XkbDescPtr		/* xkb */,
+	XkbAction *		/* act */,
+	unsigned int 		/* changed */
+);
+
+extern Bool XkbApplyVModChanges(
+    XkbSrvInfoPtr	/* xkbi */,
+    unsigned int	/* changed */,
+    XkbChangesPtr	/* pChanges */,
+    unsigned int *	/* needChecksRtrn */,
+    XkbEventCausePtr	/* cause */
+);
+
+extern void XkbApplyVModChangesToAllDevices(
+    DeviceIntPtr	/* dev */,
+    XkbDescPtr 		/* xkb */,
+    unsigned int 	/* changed */,
+    XkbEventCausePtr	/* cause */
+);
+
+extern	unsigned int XkbMaskForVMask(
+    XkbDescPtr		/* xkb */,
+    unsigned int	/* vmask */
+);
+
+extern Bool XkbVirtualModsToReal(
+	XkbDescPtr	/* xkb */,
+	unsigned int	/* virtua_mask */,
+	unsigned int *	/* mask_rtrn */
+);
+
+extern	unsigned int	XkbAdjustGroup(
+    int			/* group */,
+    XkbControlsPtr	/* ctrls */
+);
+
+extern KeySym *XkbResizeKeySyms(
+    XkbDescPtr		/* xkb */,
+    int 		/* key */,
+    int 		/* needed */
+);
+
+extern XkbAction *XkbResizeKeyActions(
+    XkbDescPtr		/* xkb */,
+    int 		/* key */,
+    int 		/* needed */
+);
+
+extern void XkbUpdateKeyTypesFromCore(
+    DeviceIntPtr	/* pXDev */,
+    KeyCode 		/* first */,
+    CARD8 		/* num */,
+    XkbChangesPtr	/* pChanges */
+);
+
+extern	void XkbUpdateDescActions(	
+    XkbDescPtr		/* xkb */,
+    KeyCode		/* first */,
+    CARD8		/* num */,
+    XkbChangesPtr	/* changes */
+);
+
+extern void XkbUpdateActions(
+    DeviceIntPtr	/* pXDev */,
+    KeyCode 		/* first */,
+    CARD8 		/* num */,
+    XkbChangesPtr  	/* pChanges */,
+    unsigned int *	/* needChecksRtrn */,
+    XkbEventCausePtr	/* cause */
+);
+
+extern void XkbUpdateCoreDescription(
+    DeviceIntPtr	/* keybd */,
+    Bool		/* resize */
+);
+
+extern void XkbApplyMappingChange(
+    DeviceIntPtr	/* pXDev */,
+    CARD8 		/* request */,
+    KeyCode 		/* firstKey */,
+    CARD8 		/* num */,
+    ClientPtr		/* client */
+);
+
+extern void XkbSetIndicators(
+    DeviceIntPtr		/* pXDev */,
+    CARD32			/* affect */,
+    CARD32			/* values */,
+    XkbEventCausePtr		/* cause */
+);
+
+extern void XkbUpdateIndicators(
+    DeviceIntPtr		/* keybd */,
+    CARD32		 	/* changed */,
+    Bool			/* check_edevs */,
+    XkbChangesPtr		/* pChanges */,
+    XkbEventCausePtr		/* cause */
+);
+
+extern XkbSrvLedInfoPtr XkbAllocSrvLedInfo(
+    DeviceIntPtr		/* dev */,
+    KbdFeedbackPtr		/* kf */,
+    LedFeedbackPtr		/* lf */,
+    unsigned int		/* needed_parts */
+);
+
+extern XkbSrvLedInfoPtr XkbFindSrvLedInfo(
+    DeviceIntPtr		/* dev */,
+    unsigned int		/* class */,
+    unsigned int		/* id */,
+    unsigned int		/* needed_parts */
+);
+
+extern void XkbApplyLedNameChanges(
+    DeviceIntPtr		/* dev */,
+    XkbSrvLedInfoPtr		/* sli */,
+    unsigned int		/* changed_names */,
+    xkbExtensionDeviceNotify *	/* ed */,
+    XkbChangesPtr		/* changes */,
+    XkbEventCausePtr		/* cause */
+);
+
+extern void XkbApplyLedMapChanges(
+    DeviceIntPtr		/* dev */,
+    XkbSrvLedInfoPtr		/* sli */,
+    unsigned int		/* changed_maps */,
+    xkbExtensionDeviceNotify *	/* ed */,
+    XkbChangesPtr		/* changes */,
+    XkbEventCausePtr		/* cause */
+);
+
+extern void XkbApplyLedStateChanges(
+    DeviceIntPtr		/* dev */,
+    XkbSrvLedInfoPtr		/* sli */,
+    unsigned int		/* changed_leds */,
+    xkbExtensionDeviceNotify *	/* ed */,
+    XkbChangesPtr		/* changes */,
+    XkbEventCausePtr		/* cause */
+);
+
+extern void XkbUpdateLedAutoState(
+    DeviceIntPtr		/* dev */,
+    XkbSrvLedInfoPtr		/* sli */,
+    unsigned int		/* maps_to_check */,
+    xkbExtensionDeviceNotify *	/* ed */,
+    XkbChangesPtr		/* changes */,
+    XkbEventCausePtr		/* cause */
+);
+
+extern void XkbFlushLedEvents(	
+    DeviceIntPtr		/* dev */,
+    DeviceIntPtr		/* kbd */,
+    XkbSrvLedInfoPtr		/* sli */,
+    xkbExtensionDeviceNotify *	/* ed */,
+    XkbChangesPtr		/* changes */,
+    XkbEventCausePtr		/* cause */
+);
+
+extern void XkbUpdateAllDeviceIndicators(
+    XkbChangesPtr		/* changes */,
+    XkbEventCausePtr		/* cause */
+);
+
+extern unsigned int XkbIndicatorsToUpdate(
+    DeviceIntPtr		/* dev */,
+    unsigned long		/* state_changes */,
+    Bool			/* enabled_ctrl_changes */
+);
+
+extern void XkbComputeDerivedState(
+    XkbSrvInfoPtr		/* xkbi */
+);
+
+extern void XkbCheckSecondaryEffects(
+    XkbSrvInfoPtr		/* xkbi */,
+    unsigned int		/* which */,
+    XkbChangesPtr		/* changes */,
+    XkbEventCausePtr		/* cause */
+);
+
+extern void XkbCheckIndicatorMaps(
+    DeviceIntPtr		/* dev */,
+    XkbSrvLedInfoPtr		/* sli */,
+    unsigned int		/* which */
+);
+
+extern unsigned int XkbStateChangedFlags(
+    XkbStatePtr			/* old */,
+    XkbStatePtr			/* new */
+);
+
+extern	void XkbSendStateNotify(
+       DeviceIntPtr	/* kbd */,
+       xkbStateNotify *	/* pSN */
+);
+
+extern	void XkbSendMapNotify(
+       DeviceIntPtr	/* kbd */,
+       xkbMapNotify *	/* ev */
+);
+
+extern	int  XkbComputeControlsNotify(
+	DeviceIntPtr		/* kbd */,
+	XkbControlsPtr		/* old */,
+	XkbControlsPtr		/* new */,
+	xkbControlsNotify *	/* pCN */,
+	Bool			/* forceCtrlProc */
+);
+
+extern	void XkbSendControlsNotify(
+       DeviceIntPtr		/* kbd */,
+       xkbControlsNotify *	/* ev */
+);
+
+extern	void XkbSendCompatMapNotify(
+	DeviceIntPtr		/* kbd */,
+	xkbCompatMapNotify *	/* ev */
+);
+
+extern	void XkbSendIndicatorNotify(
+       DeviceIntPtr		/* kbd */,
+       int			/* xkbType */,
+       xkbIndicatorNotify *	/* ev */
+);
+
+extern	void XkbHandleBell(
+       BOOL		/* force */,
+       BOOL		/* eventOnly */,
+       DeviceIntPtr	/* kbd */,
+       CARD8		/* percent */,
+       pointer 		/* ctrl */,
+       CARD8		/* class */,
+       Atom		/* name */,
+       WindowPtr	/* pWin */,
+       ClientPtr	/* pClient */
+);
+
+extern	void XkbSendAccessXNotify(
+       DeviceIntPtr		/* kbd */,
+       xkbAccessXNotify *	/* pEv */
+);
+
+extern	void XkbSendNamesNotify(
+       DeviceIntPtr	/* kbd */,
+       xkbNamesNotify *	/* ev */
+);
+
+extern	void XkbSendCompatNotify(
+       DeviceIntPtr		/* kbd */,
+       xkbCompatMapNotify *	/* ev */
+);
+
+extern	void XkbSendActionMessage(
+       DeviceIntPtr		/* kbd */,
+       xkbActionMessage *	/* ev */
+);
+
+extern	void XkbSendExtensionDeviceNotify(
+       DeviceIntPtr			/* kbd */,
+       ClientPtr			/* client */,
+       xkbExtensionDeviceNotify *	/* ev */
+);
+
+extern void XkbSendNotification(
+    DeviceIntPtr		/* kbd */,
+    XkbChangesPtr		/* pChanges */,
+    XkbEventCausePtr		/* cause */
+);
+
+extern void XkbProcessKeyboardEvent(
+    struct _xEvent * 		/* xE */,
+    DeviceIntPtr		/* keybd */,
+    int 			/* count */
+);
+
+extern void XkbProcessOtherEvent(
+    struct _xEvent * 		/* xE */,
+    DeviceIntPtr		/* keybd */,
+    int 			/* count */
+);
+
+extern void XkbHandleActions(
+    DeviceIntPtr		/* dev */,
+    DeviceIntPtr		/* kbd */,
+    struct _xEvent * 		/* xE */,
+    int 			/* count */
+);
+
+extern Bool XkbEnableDisableControls(
+    XkbSrvInfoPtr	/* xkbi */,
+    unsigned long	/* change */,
+    unsigned long	/* newValues */,
+    XkbChangesPtr	/* changes */,
+    XkbEventCausePtr	/* cause */
+);
+
+extern void AccessXInit(
+    DeviceIntPtr        /* dev */
+);
+
+extern Bool AccessXFilterPressEvent(
+    register struct _xEvent *	/* xE */,
+    register DeviceIntPtr	/* keybd */,
+    int				/* count */
+);
+
+extern Bool AccessXFilterReleaseEvent(
+    register struct _xEvent *	/* xE */,
+    register DeviceIntPtr	/* keybd */,
+    int				/* count */
+);
+
+extern void AccessXCancelRepeatKey(
+    XkbSrvInfoPtr	/* xkbi */,
+    KeyCode		/* key */
+);
+
+extern void AccessXComputeCurveFactor(
+    XkbSrvInfoPtr	/* xkbi */,
+    XkbControlsPtr	/* ctrls */
+);
+
+extern	XkbDeviceLedInfoPtr	XkbAddDeviceLedInfo(
+	XkbDeviceInfoPtr	/* devi */,
+	unsigned int		/* ledClass */,
+	unsigned int		/* ledId */
+);
+
+extern	XkbDeviceInfoPtr	XkbAllocDeviceInfo(
+	unsigned int		/* deviceSpec */,
+	unsigned int		/* nButtons */,
+	unsigned int		/* szLeds */
+);
+
+extern	void XkbFreeDeviceInfo(
+	XkbDeviceInfoPtr	/* devi */,
+	unsigned int		/* which */,
+	Bool			/* freeDevI */
+);
+
+extern Status XkbResizeDeviceButtonActions(
+	XkbDeviceInfoPtr        /* devi */,
+	unsigned int            /* newTotal */
+);
+
+extern	XkbInterestPtr XkbFindClientResource(
+       DevicePtr	/* inDev */,
+       ClientPtr	/* client */
+);
+
+extern	XkbInterestPtr XkbAddClientResource(
+       DevicePtr	/* inDev */,
+       ClientPtr	/* client */,
+       XID		/* id */
+);
+
+extern	int XkbRemoveClient(
+       DevicePtr	/* inDev */,
+       ClientPtr	/* client */
+);
+
+extern	int XkbRemoveResourceClient(
+       DevicePtr	/* inDev */,
+       XID		/* id */
+);
+
+extern int XkbDDXInitDevice(
+    DeviceIntPtr        /* dev */
+);
+
+extern	int XkbDDXAccessXBeep(
+    DeviceIntPtr        /* dev */,
+    unsigned int	/* what */,
+    unsigned int	/* which */
+);
+
+extern	void XkbDDXKeyClick(
+    DeviceIntPtr	/* dev */,
+    int			/* keycode */,
+    int			/* synthetic */
+);
+
+extern 	int XkbDDXUsesSoftRepeat(
+    DeviceIntPtr	/* dev */
+);
+
+extern	void XkbDDXKeybdCtrlProc(
+	DeviceIntPtr	/* dev */,
+	KeybdCtrl *	/* ctrl */
+);
+
+extern void XkbDDXChangeControls(
+	DeviceIntPtr	/* dev */,
+	XkbControlsPtr 	/* old */,
+	XkbControlsPtr 	/* new */
+);
+
+extern void XkbDDXUpdateIndicators(
+	DeviceIntPtr	/* keybd */,
+	CARD32		/* newState */
+);
+
+extern void XkbDDXUpdateDeviceIndicators(
+	DeviceIntPtr		/* dev */,
+	XkbSrvLedInfoPtr	/* sli */,
+	CARD32			/* newState */
+);
+
+extern void XkbDDXFakePointerButton(
+	int 		/* event */,
+	int		/* button */
+);
+
+extern void XkbDDXFakePointerMotion(
+ 	unsigned int	/* flags */,
+	int		/* x */,
+	int		/* y */
+);
+
+extern void XkbDDXFakeDeviceButton(
+	DeviceIntPtr	/* dev */,
+	Bool		/* press */,
+	int		/* button */
+);
+
+extern int XkbDDXTerminateServer(
+	DeviceIntPtr	/* dev */,
+	KeyCode		/* key */,
+	XkbAction *	/* act */
+);
+
+extern int XkbDDXSwitchScreen(
+	DeviceIntPtr	/* dev */,
+	KeyCode		/* key */,
+	XkbAction *	/* act */
+);
+
+extern int XkbDDXPrivate(
+	DeviceIntPtr	/* dev */,
+	KeyCode		/* key */,
+	XkbAction *	/* act */
+);
+
+extern void XkbDisableComputedAutoRepeats(
+	DeviceIntPtr 	/* pXDev */,
+	unsigned int	/* key */
+);
+
+extern void XkbSetRepeatKeys(
+	DeviceIntPtr 	/* pXDev */,
+	int		/* key */,
+	int	 	/* onoff */
+);
+
+extern	int XkbLatchModifiers(
+	DeviceIntPtr 	/* pXDev */,
+	CARD8 		/* mask */,
+	CARD8 		/* latches */
+);
+
+extern	int XkbLatchGroup(
+	DeviceIntPtr  	/* pXDev */,
+	int	  	/* group */
+);
+
+extern	void XkbClearAllLatchesAndLocks(
+	DeviceIntPtr		/* dev */,
+	XkbSrvInfoPtr		/* xkbi */,
+	Bool			/* genEv */,
+	XkbEventCausePtr	/* cause */
+);
+
+extern	void	XkbSetRulesDflts(
+	char *			/* rulesFile */,
+	char *			/* model */,
+	char *			/* layout */,
+	char *			/* variant */,
+	char *			/* options */
+);
+
+extern	void	XkbInitDevice(
+	DeviceIntPtr 	/* pXDev */
+);
+
+extern	Bool	XkbInitKeyboardDeviceStruct(
+	DeviceIntPtr 		/* pXDev */,
+	XkbComponentNamesPtr	/* pNames */,
+	KeySymsPtr		/* pSyms */,
+	CARD8 			/* pMods */[],
+	BellProcPtr		/* bellProc */,
+	KbdCtrlProcPtr		/* ctrlProc */
+);
+
+extern	int SProcXkbDispatch(
+	ClientPtr		/* client */
+);
+
+extern XkbGeometryPtr XkbLookupNamedGeometry(
+	DeviceIntPtr		/* dev */,
+	Atom			/* name */,
+	Bool *			/* shouldFree */
+);
+
+extern char *	_XkbDupString(
+	char *			/* str */
+);
+
+extern void	XkbConvertCase(
+	KeySym 			/* sym */,
+	KeySym *		/* lower */,
+	KeySym *		/* upper */
+);
+
+extern	Status	 XkbChangeKeycodeRange(	
+	XkbDescPtr		/* xkb */,
+	int 			/* minKC */,
+	int 			/* maxKC */,
+	XkbChangesPtr		/* changes */
+);
+
+extern int XkbFinishDeviceInit(
+	DeviceIntPtr		/* pXDev */
+);
+
+extern void XkbFreeSrvLedInfo(
+	XkbSrvLedInfoPtr	/* sli */
+);
+
+extern void XkbFreeInfo(
+	XkbSrvInfoPtr		/* xkbi */
+);
+
+extern Status XkbChangeTypesOfKey(
+	XkbDescPtr		/* xkb */,
+	int			/* key */,
+	int			/* nGroups */,
+	unsigned int		/* groups */,
+	int *			/* newTypesIn */,
+	XkbMapChangesPtr	/* changes */
+);
+
+extern XkbKeyTypePtr XkbAddKeyType(
+	XkbDescPtr		/* xkb */,
+	Atom			/* name */,
+	int			/* map_count */,
+	Bool			/* want_preserve */,
+	int			/* num_lvls */
+);
+
+extern Status XkbInitCanonicalKeyTypes(
+	XkbDescPtr		/* xkb */,
+	unsigned int		/* which */,
+	int			/* keypadVMod */
+);
+
+extern int XkbKeyTypesForCoreSymbols(
+	XkbDescPtr		/* xkb */,
+	int			/* map_width */,
+	KeySym *		/* core_syms */,
+	unsigned int		/* protected */,
+	int *			/* types_inout */,
+	KeySym *		/* xkb_syms_rtrn */
+);
+
+extern Bool XkbApplyCompatMapToKey(
+	XkbDescPtr		/* xkb */,
+	KeyCode			/* key */,
+	XkbChangesPtr		/* changes */
+);
+
+extern Bool XkbUpdateMapFromCore(
+	XkbDescPtr		/* xkb */,
+	KeyCode			/* first_key */,
+	int			/* num_keys */,
+	int			/* map_width */,
+	KeySym *		/* core_keysyms */,
+	XkbChangesPtr		/* changes */
+);
+
+extern void XkbFreeControls(
+	XkbDescPtr		/* xkb */,
+	unsigned int		/* which */,
+	Bool			/* freeMap */
+);
+
+extern void XkbFreeIndicatorMaps(
+	XkbDescPtr		/* xkb */
+);
+
+extern Bool XkbApplyVirtualModChanges(
+	XkbDescPtr		/* xkb */,
+	unsigned int		/* changed */,
+	XkbChangesPtr		/* changes */
+);
+
+extern Bool XkbUpdateActionVirtualMods(
+	XkbDescPtr		/* xkb */,
+	XkbAction *		/* act */,
+	unsigned int		/* changed */
+);
+
+extern void XkbUpdateKeyTypeVirtualMods(
+	XkbDescPtr		/* xkb */,
+	XkbKeyTypePtr		/* type */,
+	unsigned int		/* changed */,
+	XkbChangesPtr		/* changes */
+);
+
+extern void XkbSendNewKeyboardNotify(
+	DeviceIntPtr		/* kbd */,
+	xkbNewKeyboardNotify *	/* pNKN */
+);
+
+#ifdef XKBSRV_NEED_FILE_FUNCS
+
+#include <X11/extensions/XKMformat.h>
+#include <X11/extensions/XKBfile.h>
+#include <X11/extensions/XKBrules.h>
+
+#define	_XkbListKeymaps		0
+#define	_XkbListKeycodes	1
+#define	_XkbListTypes		2
+#define	_XkbListCompat		3
+#define	_XkbListSymbols		4
+#define	_XkbListGeometry	5
+#define	_XkbListNumComponents	6
+
+typedef struct _XkbSrvListInfo {
+	int		szPool;
+	int		nPool;
+	char *		pool;
+
+	int		maxRtrn;
+	int		nTotal;
+
+	char *		pattern[_XkbListNumComponents];
+	int		nFound[_XkbListNumComponents];
+} XkbSrvListInfoRec,*XkbSrvListInfoPtr;
+
+char *
+XkbGetRulesDflts(
+	XkbRF_VarDefsPtr	/* defs */
+);
+
+extern void	XkbSetRulesUsed(
+	XkbRF_VarDefsPtr	/* defs */
+);
+
+
+extern	Status	XkbDDXList(
+	DeviceIntPtr		/* dev */,
+	XkbSrvListInfoPtr	/* listing */,
+	ClientPtr		/* client */
+);
+
+extern	unsigned int XkbDDXLoadKeymapByNames(
+	DeviceIntPtr		/* keybd */,
+	XkbComponentNamesPtr	/* names */,
+	unsigned int		/* want */,
+	unsigned int		/* need */,
+	XkbFileInfoPtr		/* finfoRtrn */,
+	char *			/* keymapNameRtrn */,
+	int 			/* keymapNameRtrnLen */
+);
+
+extern	Bool XkbDDXNamesFromRules(
+	DeviceIntPtr		/* keybd */,
+	char *			/* rules */,
+	XkbRF_VarDefsPtr	/* defs */,
+	XkbComponentNamesPtr	/* names */
+);
+
+extern	FILE *XkbDDXOpenConfigFile(
+	char *	/* mapName */,
+	char *	/* fileNameRtrn */,
+	int	/* fileNameRtrnLen */
+);
+
+extern	Bool XkbDDXApplyConfig(
+	XPointer	/* cfg_in */,
+	XkbSrvInfoPtr	/* xkbi */
+);
+
+extern XPointer XkbDDXPreloadConfig(
+	char **			/* rulesFileRtrn */,
+	XkbRF_VarDefsPtr	/* defs */,
+	XkbComponentNamesPtr	/* names */,
+	DeviceIntPtr		/* dev */
+);
+
+extern	int _XkbStrCaseCmp(
+	char *			/* str1 */,
+	char *			/* str2 */
+);
+
+#endif /* XKBSRV_NEED_FILE_FUNCS */
+
+
+_XFUNCPROTOEND
+
+#define	XkbAtomGetString(d,s)	NameForAtom(s)
+
+#endif /* _XKBSRV_H_ */
+
+
diff --git a/ThirdParty/X11/Include/X11/extensions/XKBstr.h b/ThirdParty/X11/Include/X11/extensions/XKBstr.h
new file mode 100644
index 0000000000000000000000000000000000000000..e519e657d138beead2853beab1dc0f9f0b9b4250
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XKBstr.h
@@ -0,0 +1,613 @@
+/************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be 
+used in advertising or publicity pertaining to distribution 
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability 
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef _XKBSTR_H_
+#define	_XKBSTR_H_
+
+#include <X11/extensions/XKB.h>
+
+#define	XkbCharToInt(v)		((v)&0x80?(int)((v)|(~0xff)):(int)((v)&0x7f))
+#define	XkbIntTo2Chars(i,h,l)	(((h)=((i>>8)&0xff)),((l)=((i)&0xff)))
+
+#if defined(WORD64) && defined(UNSIGNEDBITFIELDS)
+#define	Xkb2CharsToInt(h,l)	((h)&0x80?(int)(((h)<<8)|(l)|(~0xffff)):\
+					  (int)(((h)<<8)|(l)&0x7fff))
+#else
+#define	Xkb2CharsToInt(h,l)	((short)(((h)<<8)|(l)))
+#endif
+
+	/*
+	 * Common data structures and access macros
+	 */
+
+typedef struct _XkbStateRec {
+	unsigned char	group;
+	unsigned char   locked_group;
+	unsigned short	base_group;
+	unsigned short	latched_group;
+	unsigned char	mods;
+	unsigned char	base_mods;
+	unsigned char	latched_mods;
+	unsigned char	locked_mods;
+	unsigned char	compat_state;
+	unsigned char	grab_mods;
+	unsigned char	compat_grab_mods;
+	unsigned char	lookup_mods;
+	unsigned char	compat_lookup_mods;
+	unsigned short	ptr_buttons;
+} XkbStateRec,*XkbStatePtr;
+#define	XkbModLocks(s)	 ((s)->locked_mods)
+#define	XkbStateMods(s)	 ((s)->base_mods|(s)->latched_mods|XkbModLocks(s))
+#define	XkbGroupLock(s)	 ((s)->locked_group)
+#define	XkbStateGroup(s) ((s)->base_group+(s)->latched_group+XkbGroupLock(s))
+#define	XkbStateFieldFromRec(s)	XkbBuildCoreState((s)->lookup_mods,(s)->group)
+#define	XkbGrabStateFromRec(s)	XkbBuildCoreState((s)->grab_mods,(s)->group)
+
+typedef struct _XkbMods {
+	unsigned char	mask;	/* effective mods */
+	unsigned char	real_mods;
+	unsigned short	vmods;
+} XkbModsRec,*XkbModsPtr;
+
+typedef struct _XkbKTMapEntry {
+	Bool		active;
+	unsigned char	level;
+	XkbModsRec	mods;
+} XkbKTMapEntryRec,*XkbKTMapEntryPtr;
+
+typedef struct _XkbKeyType {
+	XkbModsRec		mods;
+	unsigned char	  	num_levels;
+	unsigned char	  	map_count;
+	XkbKTMapEntryPtr  	map;
+	XkbModsPtr  		preserve;
+	Atom		  	name;
+	Atom *			level_names;
+} XkbKeyTypeRec, *XkbKeyTypePtr;
+
+#define	XkbNumGroups(g)			((g)&0x0f)
+#define	XkbOutOfRangeGroupInfo(g)	((g)&0xf0)
+#define	XkbOutOfRangeGroupAction(g)	((g)&0xc0)
+#define	XkbOutOfRangeGroupNumber(g)	(((g)&0x30)>>4)
+#define	XkbSetGroupInfo(g,w,n)	(((w)&0xc0)|(((n)&3)<<4)|((g)&0x0f))
+#define	XkbSetNumGroups(g,n)	(((g)&0xf0)|((n)&0x0f))
+
+	/*
+	 * Structures and access macros used primarily by the server
+	 */
+
+typedef struct _XkbBehavior {
+	unsigned char	type;
+	unsigned char	data;
+} XkbBehavior;
+
+#define	XkbAnyActionDataSize 7
+typedef	struct _XkbAnyAction {
+	unsigned char	type;
+	unsigned char	data[XkbAnyActionDataSize];
+} XkbAnyAction;
+
+typedef struct _XkbModAction {
+	unsigned char	type;
+	unsigned char	flags;
+	unsigned char	mask;
+	unsigned char	real_mods;
+	unsigned char	vmods1;
+	unsigned char	vmods2;
+} XkbModAction;
+#define	XkbModActionVMods(a)      \
+	((short)(((a)->vmods1<<8)|((a)->vmods2)))
+#define	XkbSetModActionVMods(a,v) \
+	(((a)->vmods1=(((v)>>8)&0xff)),(a)->vmods2=((v)&0xff))
+
+typedef struct _XkbGroupAction {
+	unsigned char	type;
+	unsigned char	flags;
+	char		group_XXX;
+} XkbGroupAction;
+#define	XkbSAGroup(a)		(XkbCharToInt((a)->group_XXX))
+#define	XkbSASetGroup(a,g)	((a)->group_XXX=(g))
+
+typedef struct _XkbISOAction {
+	unsigned char	type;
+	unsigned char	flags;
+	unsigned char	mask;
+	unsigned char	real_mods;
+	char		group_XXX;
+	unsigned char	affect;
+	unsigned char	vmods1;
+	unsigned char	vmods2;
+} XkbISOAction;
+
+typedef struct _XkbPtrAction {
+	unsigned char	type;
+	unsigned char	flags;
+	unsigned char	high_XXX;
+	unsigned char	low_XXX;
+	unsigned char	high_YYY;
+	unsigned char	low_YYY;
+} XkbPtrAction;
+#define	XkbPtrActionX(a)      (Xkb2CharsToInt((a)->high_XXX,(a)->low_XXX))
+#define	XkbPtrActionY(a)      (Xkb2CharsToInt((a)->high_YYY,(a)->low_YYY))
+#define	XkbSetPtrActionX(a,x) (XkbIntTo2Chars(x,(a)->high_XXX,(a)->low_XXX))
+#define	XkbSetPtrActionY(a,y) (XkbIntTo2Chars(y,(a)->high_YYY,(a)->low_YYY))
+
+typedef struct _XkbPtrBtnAction {
+	unsigned char	type;
+	unsigned char	flags;
+	unsigned char	count;
+	unsigned char	button;
+} XkbPtrBtnAction;
+
+typedef struct _XkbPtrDfltAction {
+	unsigned char	type;
+	unsigned char	flags;
+	unsigned char	affect;
+	char		valueXXX;
+} XkbPtrDfltAction;
+#define	XkbSAPtrDfltValue(a)		(XkbCharToInt((a)->valueXXX))
+#define	XkbSASetPtrDfltValue(a,c)	((a)->valueXXX= ((c)&0xff))
+
+typedef struct _XkbSwitchScreenAction {
+	unsigned char	type;
+	unsigned char	flags;
+	char		screenXXX;
+} XkbSwitchScreenAction;
+#define	XkbSAScreen(a)			(XkbCharToInt((a)->screenXXX))
+#define	XkbSASetScreen(a,s)		((a)->screenXXX= ((s)&0xff))
+
+typedef struct _XkbCtrlsAction {
+	unsigned char	type;
+	unsigned char	flags;
+	unsigned char	ctrls3;
+	unsigned char	ctrls2;
+	unsigned char	ctrls1;
+	unsigned char	ctrls0;
+} XkbCtrlsAction;
+#define	XkbActionSetCtrls(a,c)	(((a)->ctrls3=(((c)>>24)&0xff)),\
+					((a)->ctrls2=(((c)>>16)&0xff)),\
+					((a)->ctrls1=(((c)>>8)&0xff)),\
+					((a)->ctrls0=((c)&0xff)))
+#define	XkbActionCtrls(a) ((((unsigned int)(a)->ctrls3)<<24)|\
+			   (((unsigned int)(a)->ctrls2)<<16)|\
+			   (((unsigned int)(a)->ctrls1)<<8)|\
+			   ((unsigned int)((a)->ctrls0)))
+
+typedef struct _XkbMessageAction {
+	unsigned char	type;
+	unsigned char	flags;
+	unsigned char	message[6];
+} XkbMessageAction;
+
+typedef struct	_XkbRedirectKeyAction {
+	unsigned char	type;
+	unsigned char	new_key;
+	unsigned char	mods_mask;
+	unsigned char	mods;
+	unsigned char	vmods_mask0;
+	unsigned char	vmods_mask1;
+	unsigned char	vmods0;
+	unsigned char	vmods1;
+} XkbRedirectKeyAction;
+
+#define	XkbSARedirectVMods(a)		((((unsigned int)(a)->vmods1)<<8)|\
+					((unsigned int)(a)->vmods0))
+#define	XkbSARedirectSetVMods(a,m)	(((a)->vmods_mask1=(((m)>>8)&0xff)),\
+					 ((a)->vmods_mask0=((m)&0xff)))
+#define	XkbSARedirectVModsMask(a)	((((unsigned int)(a)->vmods_mask1)<<8)|\
+					((unsigned int)(a)->vmods_mask0))
+#define	XkbSARedirectSetVModsMask(a,m)	(((a)->vmods_mask1=(((m)>>8)&0xff)),\
+					 ((a)->vmods_mask0=((m)&0xff)))
+
+typedef struct _XkbDeviceBtnAction {
+	unsigned char	type;
+	unsigned char	flags;
+	unsigned char	count;
+	unsigned char	button;
+	unsigned char	device;
+} XkbDeviceBtnAction;
+
+typedef struct _XkbDeviceValuatorAction {
+	unsigned char	type;
+	unsigned char	device;
+	unsigned char	v1_what;
+	unsigned char	v1_ndx;
+	unsigned char	v1_value;
+	unsigned char	v2_what;
+	unsigned char	v2_ndx;
+	unsigned char	v2_value;
+} XkbDeviceValuatorAction;
+
+typedef	union _XkbAction {
+	XkbAnyAction		any;
+	XkbModAction		mods;
+	XkbGroupAction		group;
+	XkbISOAction		iso;
+	XkbPtrAction		ptr;
+	XkbPtrBtnAction		btn;
+	XkbPtrDfltAction	dflt;
+	XkbSwitchScreenAction	screen;
+	XkbCtrlsAction		ctrls;
+	XkbMessageAction	msg;
+	XkbRedirectKeyAction	redirect;
+	XkbDeviceBtnAction	devbtn;
+	XkbDeviceValuatorAction	devval;
+	unsigned char 		type;
+} XkbAction;
+
+typedef	struct _XkbControls {
+	unsigned char	mk_dflt_btn;
+	unsigned char	num_groups;
+	unsigned char	groups_wrap;
+	XkbModsRec	internal;
+	XkbModsRec	ignore_lock;
+	unsigned int	enabled_ctrls;
+	unsigned short	repeat_delay;
+	unsigned short	repeat_interval;
+	unsigned short	slow_keys_delay;
+	unsigned short	debounce_delay;
+	unsigned short	mk_delay;
+	unsigned short	mk_interval;
+	unsigned short	mk_time_to_max;
+	unsigned short	mk_max_speed;
+		 short	mk_curve;
+	unsigned short	ax_options;
+	unsigned short	ax_timeout;
+	unsigned short	axt_opts_mask;
+	unsigned short	axt_opts_values;
+	unsigned int	axt_ctrls_mask;
+	unsigned int	axt_ctrls_values;
+	unsigned char	per_key_repeat[XkbPerKeyBitArraySize];
+} XkbControlsRec, *XkbControlsPtr;
+
+#define	XkbAX_AnyFeedback(c)	((c)->enabled_ctrls&XkbAccessXFeedbackMask)
+#define	XkbAX_NeedOption(c,w)	((c)->ax_options&(w))
+#define	XkbAX_NeedFeedback(c,w)	(XkbAX_AnyFeedback(c)&&XkbAX_NeedOption(c,w))
+
+typedef struct _XkbServerMapRec {
+	unsigned short		 num_acts;
+	unsigned short		 size_acts;
+	XkbAction		*acts;
+
+	XkbBehavior		*behaviors;
+	unsigned short		*key_acts;
+#if defined(__cplusplus) || defined(c_plusplus)
+	/* explicit is a C++ reserved word */
+	unsigned char		*c_explicit;
+#else
+	unsigned char		*explicit;
+#endif
+	unsigned char		 vmods[XkbNumVirtualMods];
+	unsigned short		*vmodmap;
+} XkbServerMapRec, *XkbServerMapPtr;
+
+#define	XkbSMKeyActionsPtr(m,k) (&(m)->acts[(m)->key_acts[k]])
+
+	/*
+	 * Structures and access macros used primarily by clients
+	 */
+
+typedef	struct _XkbSymMapRec {
+	unsigned char	 kt_index[XkbNumKbdGroups];
+	unsigned char	 group_info;
+	unsigned char	 width;
+	unsigned short	 offset;
+} XkbSymMapRec, *XkbSymMapPtr;
+
+typedef struct _XkbClientMapRec {
+	unsigned char		 size_types;
+	unsigned char		 num_types;
+	XkbKeyTypePtr		 types;
+
+	unsigned short		 size_syms;
+	unsigned short		 num_syms;
+	KeySym			*syms;
+	XkbSymMapPtr		 key_sym_map;
+
+	unsigned char		*modmap;
+} XkbClientMapRec, *XkbClientMapPtr;
+
+#define	XkbCMKeyGroupInfo(m,k)  ((m)->key_sym_map[k].group_info)
+#define	XkbCMKeyNumGroups(m,k)	 (XkbNumGroups((m)->key_sym_map[k].group_info))
+#define	XkbCMKeyGroupWidth(m,k,g) (XkbCMKeyType(m,k,g)->num_levels)
+#define	XkbCMKeyGroupsWidth(m,k) ((m)->key_sym_map[k].width)
+#define	XkbCMKeyTypeIndex(m,k,g) ((m)->key_sym_map[k].kt_index[g&0x3])
+#define	XkbCMKeyType(m,k,g)	 (&(m)->types[XkbCMKeyTypeIndex(m,k,g)])
+#define	XkbCMKeyNumSyms(m,k) (XkbCMKeyGroupsWidth(m,k)*XkbCMKeyNumGroups(m,k))
+#define	XkbCMKeySymsOffset(m,k)	((m)->key_sym_map[k].offset)
+#define	XkbCMKeySymsPtr(m,k)	(&(m)->syms[XkbCMKeySymsOffset(m,k)])
+
+	/*
+	 * Compatibility structures and access macros
+	 */
+
+typedef struct _XkbSymInterpretRec {
+	KeySym		sym;
+	unsigned char	flags;
+	unsigned char	match;
+	unsigned char	mods;
+	unsigned char	virtual_mod;
+	XkbAnyAction	act;
+} XkbSymInterpretRec,*XkbSymInterpretPtr;
+
+typedef struct _XkbCompatMapRec {
+	XkbSymInterpretPtr	 sym_interpret;
+	XkbModsRec		 groups[XkbNumKbdGroups];
+	unsigned short		 num_si;
+	unsigned short		 size_si;
+} XkbCompatMapRec, *XkbCompatMapPtr;
+
+typedef struct _XkbIndicatorMapRec {
+	unsigned char	flags;
+	unsigned char	which_groups;
+	unsigned char	groups;
+	unsigned char	which_mods;
+	XkbModsRec	mods;
+	unsigned int	ctrls;
+} XkbIndicatorMapRec, *XkbIndicatorMapPtr;
+
+#define	XkbIM_IsAuto(i)	((((i)->flags&XkbIM_NoAutomatic)==0)&&\
+			    (((i)->which_groups&&(i)->groups)||\
+			     ((i)->which_mods&&(i)->mods.mask)||\
+			     ((i)->ctrls)))
+#define	XkbIM_InUse(i)	(((i)->flags)||((i)->which_groups)||\
+					((i)->which_mods)||((i)->ctrls))
+	
+
+typedef struct _XkbIndicatorRec {
+	unsigned long	  	phys_indicators;
+	XkbIndicatorMapRec	maps[XkbNumIndicators];
+} XkbIndicatorRec,*XkbIndicatorPtr;
+
+typedef	struct _XkbKeyNameRec {
+	char	name[XkbKeyNameLength];
+} XkbKeyNameRec,*XkbKeyNamePtr;
+
+typedef struct _XkbKeyAliasRec {
+	char	real[XkbKeyNameLength];
+	char	alias[XkbKeyNameLength];
+} XkbKeyAliasRec,*XkbKeyAliasPtr;
+
+	/*
+	 * Names for everything 
+	 */
+typedef struct _XkbNamesRec {
+	Atom		  keycodes;
+	Atom		  geometry;
+	Atom		  symbols;
+	Atom              types;
+	Atom		  compat;
+	Atom		  vmods[XkbNumVirtualMods];
+	Atom		  indicators[XkbNumIndicators];
+	Atom		  groups[XkbNumKbdGroups];
+	XkbKeyNamePtr	  keys;
+	XkbKeyAliasPtr	  key_aliases;
+	Atom		 *radio_groups;
+	Atom		  phys_symbols;
+
+	unsigned char	  num_keys;
+	unsigned char	  num_key_aliases;
+	unsigned short	  num_rg;
+} XkbNamesRec,*XkbNamesPtr;
+
+typedef	struct _XkbGeometry	*XkbGeometryPtr;
+	/*
+	 * Tie it all together into one big keyboard description
+	 */
+typedef	struct _XkbDesc {
+	struct _XDisplay *	dpy;
+	unsigned short	 	flags;
+	unsigned short		device_spec;
+	KeyCode			min_key_code;
+	KeyCode			max_key_code;
+
+	XkbControlsPtr		ctrls;
+	XkbServerMapPtr		server;
+	XkbClientMapPtr		map;
+	XkbIndicatorPtr		indicators;
+	XkbNamesPtr		names;
+	XkbCompatMapPtr		compat;
+	XkbGeometryPtr		geom;
+} XkbDescRec, *XkbDescPtr;
+#define	XkbKeyKeyTypeIndex(d,k,g)	(XkbCMKeyTypeIndex((d)->map,k,g))
+#define	XkbKeyKeyType(d,k,g)		(XkbCMKeyType((d)->map,k,g))
+#define	XkbKeyGroupWidth(d,k,g)		(XkbCMKeyGroupWidth((d)->map,k,g))
+#define	XkbKeyGroupsWidth(d,k)		(XkbCMKeyGroupsWidth((d)->map,k))
+#define	XkbKeyGroupInfo(d,k)		(XkbCMKeyGroupInfo((d)->map,(k)))
+#define	XkbKeyNumGroups(d,k)		(XkbCMKeyNumGroups((d)->map,(k)))
+#define	XkbKeyNumSyms(d,k)		(XkbCMKeyNumSyms((d)->map,(k)))
+#define	XkbKeySymsPtr(d,k)		(XkbCMKeySymsPtr((d)->map,(k)))
+#define	XkbKeySym(d,k,n)		(XkbKeySymsPtr(d,k)[n])
+#define	XkbKeySymEntry(d,k,sl,g) \
+	(XkbKeySym(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl))))
+#define	XkbKeyAction(d,k,n) \
+	(XkbKeyHasActions(d,k)?&XkbKeyActionsPtr(d,k)[n]:NULL)
+#define	XkbKeyActionEntry(d,k,sl,g) \
+	(XkbKeyHasActions(d,k)?\
+		XkbKeyAction(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl))):NULL)
+
+#define	XkbKeyHasActions(d,k)	((d)->server->key_acts[k]!=0)
+#define	XkbKeyNumActions(d,k)	(XkbKeyHasActions(d,k)?XkbKeyNumSyms(d,k):1)
+#define	XkbKeyActionsPtr(d,k)	(XkbSMKeyActionsPtr((d)->server,k))
+#define	XkbKeycodeInRange(d,k)	(((k)>=(d)->min_key_code)&&\
+				 ((k)<=(d)->max_key_code))
+#define	XkbNumKeys(d)		((d)->max_key_code-(d)->min_key_code+1)
+
+
+	/*
+	 * The following structures can be used to track changes
+	 * to a keyboard device
+	 */
+typedef struct _XkbMapChanges {
+	unsigned short		 changed;
+	KeyCode			 min_key_code;
+	KeyCode			 max_key_code;
+	unsigned char		 first_type;
+	unsigned char		 num_types;
+	KeyCode			 first_key_sym;
+	unsigned char		 num_key_syms;
+	KeyCode			 first_key_act;
+	unsigned char		 num_key_acts;
+	KeyCode			 first_key_behavior;
+	unsigned char		 num_key_behaviors;
+	KeyCode 		 first_key_explicit;
+	unsigned char		 num_key_explicit;
+	KeyCode			 first_modmap_key;
+	unsigned char		 num_modmap_keys;
+	KeyCode			 first_vmodmap_key;
+	unsigned char		 num_vmodmap_keys;
+	unsigned char		 pad;
+	unsigned short		 vmods;
+} XkbMapChangesRec,*XkbMapChangesPtr;
+
+typedef struct _XkbControlsChanges {
+	unsigned int 		 changed_ctrls;
+	unsigned int		 enabled_ctrls_changes;
+	Bool			 num_groups_changed;
+} XkbControlsChangesRec,*XkbControlsChangesPtr;
+
+typedef struct _XkbIndicatorChanges {
+	unsigned int		 state_changes;
+	unsigned int		 map_changes;
+} XkbIndicatorChangesRec,*XkbIndicatorChangesPtr;
+
+typedef struct _XkbNameChanges {
+	unsigned int 		changed;
+	unsigned char		first_type;
+	unsigned char		num_types;
+	unsigned char		first_lvl;
+	unsigned char		num_lvls;
+	unsigned char		num_aliases;
+	unsigned char		num_rg;
+	unsigned char		first_key;
+	unsigned char		num_keys;
+	unsigned short		changed_vmods;
+	unsigned long		changed_indicators;
+	unsigned char		changed_groups;
+} XkbNameChangesRec,*XkbNameChangesPtr;
+
+typedef struct _XkbCompatChanges {
+	unsigned char		changed_groups;
+	unsigned short		first_si;
+	unsigned short		num_si;
+} XkbCompatChangesRec,*XkbCompatChangesPtr;
+
+typedef struct _XkbChanges {
+	unsigned short		 device_spec;
+	unsigned short		 state_changes;
+	XkbMapChangesRec	 map;
+	XkbControlsChangesRec	 ctrls;
+	XkbIndicatorChangesRec	 indicators;
+	XkbNameChangesRec	 names;
+	XkbCompatChangesRec	 compat;
+} XkbChangesRec, *XkbChangesPtr;
+
+	/*
+	 * These data structures are used to construct a keymap from 
+	 * a set of components or to list components in the server
+	 * database.
+	 */
+typedef struct _XkbComponentNames {
+	char *			 keymap;
+	char *			 keycodes;
+	char *			 types;
+	char *			 compat;
+	char *			 symbols;
+	char *			 geometry;
+} XkbComponentNamesRec, *XkbComponentNamesPtr;
+
+typedef struct _XkbComponentName {
+	unsigned short		flags;
+	char *			name;
+} XkbComponentNameRec,*XkbComponentNamePtr;
+
+typedef struct _XkbComponentList {
+	int			num_keymaps;
+	int			num_keycodes;
+	int			num_types;
+	int			num_compat;
+	int			num_symbols;
+	int			num_geometry;
+	XkbComponentNamePtr	keymaps;
+	XkbComponentNamePtr 	keycodes;
+	XkbComponentNamePtr	types;
+	XkbComponentNamePtr	compat;
+	XkbComponentNamePtr	symbols;
+	XkbComponentNamePtr	geometry;
+} XkbComponentListRec, *XkbComponentListPtr;
+
+	/*
+	 * The following data structures describe and track changes to a 
+	 * non-keyboard extension device 
+	 */
+typedef struct _XkbDeviceLedInfo {
+	unsigned short			led_class;
+	unsigned short			led_id;
+	unsigned int			phys_indicators;
+	unsigned int			maps_present;
+	unsigned int			names_present;
+	unsigned int			state;
+	Atom 				names[XkbNumIndicators];
+	XkbIndicatorMapRec		maps[XkbNumIndicators];
+} XkbDeviceLedInfoRec,*XkbDeviceLedInfoPtr;
+
+typedef struct _XkbDeviceInfo {
+	char *			name;
+	Atom			type;
+	unsigned short		device_spec;
+	Bool			has_own_state;
+	unsigned short		supported;
+	unsigned short		unsupported;
+
+	unsigned short		num_btns;
+	XkbAction *		btn_acts;
+
+	unsigned short		sz_leds;
+	unsigned short		num_leds;
+	unsigned short		dflt_kbd_fb;
+	unsigned short		dflt_led_fb;
+	XkbDeviceLedInfoPtr	leds;
+} XkbDeviceInfoRec,*XkbDeviceInfoPtr;
+
+#define	XkbXI_DevHasBtnActs(d)	(((d)->num_btns>0)&&((d)->btn_acts!=NULL))
+#define	XkbXI_LegalDevBtn(d,b)	(XkbXI_DevHasBtnActs(d)&&((b)<(d)->num_btns))
+#define	XkbXI_DevHasLeds(d)	(((d)->num_leds>0)&&((d)->leds!=NULL))
+
+typedef struct _XkbDeviceLedChanges {
+	unsigned short		led_class;
+	unsigned short		led_id;
+	unsigned int		defined; /* names or maps changed */
+	struct _XkbDeviceLedChanges *next;
+} XkbDeviceLedChangesRec,*XkbDeviceLedChangesPtr;
+
+typedef struct _XkbDeviceChanges {
+	unsigned int		changed;
+	unsigned short		first_btn;
+	unsigned short		num_btns;
+	XkbDeviceLedChangesRec 	leds;
+} XkbDeviceChangesRec,*XkbDeviceChangesPtr;
+
+#endif /* _XKBSTR_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/XKM.h b/ThirdParty/X11/Include/X11/extensions/XKM.h
new file mode 100644
index 0000000000000000000000000000000000000000..da272e04a2eaed02217e7667223659e5756557c1
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XKM.h
@@ -0,0 +1,69 @@
+/************************************************************
+ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
+
+ Permission to use, copy, modify, and distribute this
+ software and its documentation for any purpose and without
+ fee is hereby granted, provided that the above copyright
+ notice appear in all copies and that both that copyright
+ notice and this permission notice appear in supporting
+ documentation, and that the name of Silicon Graphics not be
+ used in advertising or publicity pertaining to distribution
+ of the software without specific prior written permission.
+ Silicon Graphics makes no representation about the suitability
+ of this software for any purpose. It is provided "as is"
+ without any express or implied warranty.
+
+ SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+ GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+ THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+ ********************************************************/
+#ifndef XKM_H
+#define	XKM_H 1
+
+#define	XkmFileVersion		15
+
+#define	XkmIllegalFile		-1
+#define	XkmSemanticsFile	20
+#define	XkmLayoutFile		21
+#define	XkmKeymapFile		22
+#define	XkmGeometryFile		23
+
+#define	XkmTypesIndex		0
+#define	XkmCompatMapIndex	1
+#define	XkmSymbolsIndex		2
+#define	XkmIndicatorsIndex	3
+#define	XkmKeyNamesIndex	4
+#define	XkmGeometryIndex	5
+#define	XkmVirtualModsIndex	6
+#define	XkmLastIndex		XkmVirtualModsIndex
+
+#define	XkmTypesMask		(1<<0)
+#define	XkmCompatMapMask	(1<<1)
+#define	XkmSymbolsMask		(1<<2)
+#define	XkmIndicatorsMask	(1<<3)
+#define	XkmKeyNamesMask		(1<<4)
+#define	XkmGeometryMask		(1<<5)
+#define	XkmVirtualModsMask	(1<<6)
+#define	XkmLegalIndexMask	(0x7f)
+#define	XkmAllIndicesMask	(0x7f)
+
+#define	XkmSemanticsRequired	(XkmCompatMapMask)
+#define	XkmSemanticsOptional	(XkmTypesMask|XkmVirtualModsMask|XkmIndicatorsMask)
+#define	XkmSemanticsLegal	(XkmSemanticsRequired|XkmSemanticsOptional)
+#define	XkmLayoutRequired	(XkmKeyNamesMask|XkmSymbolsMask|XkmTypesMask)
+#define	XkmLayoutOptional	(XkmVirtualModsMask|XkmGeometryMask)
+#define	XkmLayoutLegal		(XkmLayoutRequired|XkmLayoutOptional)
+#define	XkmKeymapRequired	(XkmSemanticsRequired|XkmLayoutRequired)
+#define	XkmKeymapOptional	((XkmSemanticsOptional|XkmLayoutOptional)&(~XkmKeymapRequired))
+#define	XkmKeymapLegal		(XkmKeymapRequired|XkmKeymapOptional)
+
+#define	XkmLegalSection(m)	(((m)&(~XkmKeymapLegal))==0)
+#define	XkmSingleSection(m)	(XkmLegalSection(m)&&(((m)&(~(m)+1))==(m)))
+
+#endif /* XKM_H */
diff --git a/ThirdParty/X11/Include/X11/extensions/XKMformat.h b/ThirdParty/X11/Include/X11/extensions/XKMformat.h
new file mode 100644
index 0000000000000000000000000000000000000000..8dae18fabf32e9e4a5abe00a761ecab9e319d5a3
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XKMformat.h
@@ -0,0 +1,299 @@
+/************************************************************
+ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
+
+ Permission to use, copy, modify, and distribute this
+ software and its documentation for any purpose and without
+ fee is hereby granted, provided that the above copyright
+ notice appear in all copies and that both that copyright
+ notice and this permission notice appear in supporting
+ documentation, and that the name of Silicon Graphics not be
+ used in advertising or publicity pertaining to distribution
+ of the software without specific prior written permission.
+ Silicon Graphics makes no representation about the suitability
+ of this software for any purpose. It is provided "as is"
+ without any express or implied warranty.
+
+ SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+ GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+ THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+ ********************************************************/
+
+#ifndef _XKMFORMAT_H_
+#define	_XKMFORMAT_H_ 1
+
+#include <X11/extensions/XKB.h>
+#include <X11/extensions/XKBproto.h>
+#include <X11/extensions/XKM.h>
+
+typedef	struct _xkmFileInfo {
+	CARD8		type;
+	CARD8		min_kc;
+	CARD8		max_kc;
+	CARD8		num_toc;
+	CARD16		present B16;
+	CARD16		pad B16;
+} xkmFileInfo;
+#define	sz_xkmFileInfo	8
+
+typedef	struct _xkmSectionInfo {
+	CARD16		type B16;
+	CARD16		format B16;
+	CARD16		size B16;
+	CARD16		offset B16;
+} xkmSectionInfo;
+#define	sz_xkmSectionInfo	8
+
+typedef struct _xkmKeyTypeDesc {
+	CARD8		realMods;
+	CARD8		numLevels;
+	CARD16		virtualMods B16;
+	CARD8		nMapEntries;
+	CARD8		nLevelNames;
+	CARD8		preserve;
+	CARD8		pad;
+} xkmKeyTypeDesc;
+#define	sz_xkmKeyTypeDesc	8
+
+typedef struct _xkmKTMapEntryDesc {
+	CARD8		level;
+	CARD8		realMods;
+	CARD16		virtualMods B16;
+} xkmKTMapEntryDesc;
+#define	sz_xkmKTMapEntryDesc	4
+
+typedef struct _xkmModsDesc {
+	CARD8		realMods;
+	CARD8		pad;
+	CARD16		virtualMods B16;
+} xkmModsDesc;
+#define	sz_xkmModsDesc	4
+
+typedef struct _xkmVModMapDesc {
+	CARD8		key;
+	CARD8		pad;
+	CARD16		vmods B16;
+} xkmVModMapDesc;
+#define	sz_xkmVModMapDesc	4
+
+typedef struct _xkmSymInterpretDesc {
+	CARD32		sym B32;
+	CARD8		mods;
+	CARD8		match;
+	CARD8		virtualMod;
+	CARD8		flags;
+	CARD8		actionType;
+	CARD8		actionData[7];
+} xkmSymInterpretDesc;
+#define	sz_xkmSymInterpretDesc	16
+
+typedef struct _xkmBehaviorDesc {
+	CARD8		type;
+	CARD8		data;
+	CARD16		pad B16;
+} xkmBehaviorDesc;
+#define	sz_xkmBehaviorDesc	4
+
+typedef struct _xkmActionDesc {
+	CARD8		type;
+	CARD8		data[7];
+} xkmActionDesc;
+#define	sz_xkmActionDesc	8
+
+#define	XkmKeyHasTypes		(0x0f)
+#define	XkmKeyHasGroup1Type	(1<<0)
+#define	XkmKeyHasGroup2Type	(1<<1)
+#define	XkmKeyHasGroup3Type	(1<<2)
+#define	XkmKeyHasGroup4Type	(1<<3)
+#define	XkmKeyHasActions	(1<<4)
+#define	XkmKeyHasBehavior	(1<<5)
+#define	XkmRepeatingKey		(1<<6)
+#define	XkmNonRepeatingKey	(1<<7)
+
+typedef struct _xkmKeySymMapDesc {
+	CARD8		width;
+	CARD8		num_groups;
+	CARD8		modifier_map;
+	CARD8		flags;
+} xkmKeySymMapDesc;
+#define sz_xkmKeySymMapDesc	4
+
+typedef struct _xkmIndicatorMapDesc {
+	CARD8		indicator;
+	CARD8		flags;
+	CARD8		which_mods;
+	CARD8		real_mods;
+	CARD16		vmods B16;
+	CARD8		which_groups;
+	CARD8		groups;
+	CARD32		ctrls B32;
+} xkmIndicatorMapDesc;
+#define sz_xkmIndicatorMapDesc	12
+
+typedef struct _xkmGeometryDesc {
+	CARD16		width_mm B16;
+	CARD16		height_mm B16;
+	CARD8		base_color_ndx;
+	CARD8		label_color_ndx;
+	CARD16		num_properties B16;
+	CARD16		num_colors B16;
+	CARD16		num_shapes B16;
+	CARD16		num_sections B16;
+	CARD16		num_doodads B16;
+	CARD16		num_key_aliases B16;
+	CARD16		pad1 B16;
+} xkmGeometryDesc;
+#define	sz_xkmGeometryDesc	20
+
+typedef struct _xkmPointDesc {
+	INT16		x B16;
+	INT16		y B16;
+} xkmPointDesc;
+#define	sz_xkmPointDesc		4
+
+typedef	struct _xkmOutlineDesc {
+	CARD8		num_points;
+	CARD8		corner_radius;
+	CARD16		pad B16;
+} xkmOutlineDesc;
+#define	sz_xkmOutlineDesc	4
+
+typedef struct _xkmShapeDesc {
+	CARD8		num_outlines;
+	CARD8		primary_ndx;
+	CARD8		approx_ndx;
+	CARD8		pad;
+} xkmShapeDesc;
+#define	sz_xkmShapeDesc	4
+
+typedef struct _xkmSectionDesc {
+	INT16		top B16;
+	INT16		left B16;
+	CARD16		width B16;
+	CARD16		height B16;
+	INT16		angle B16;
+	CARD8		priority;
+	CARD8		num_rows;
+	CARD8		num_doodads;
+	CARD8		num_overlays;
+	CARD16		pad2 B16;
+} xkmSectionDesc;
+#define	sz_xkmSectionDesc	16
+
+typedef struct _xkmRowDesc {
+	INT16		top B16;
+	INT16		left B16;
+	CARD8		num_keys;
+	BOOL		vertical;
+	CARD16		pad B16;
+} xkmRowDesc;
+#define	sz_xkmRowDesc		8
+
+typedef struct _xkmKeyDesc {
+	CARD8		name[XkbKeyNameLength];
+	INT16		gap B16;
+	CARD8		shape_ndx;
+	CARD8		color_ndx;
+} xkmKeyDesc;
+#define	sz_xkmKeyDesc		8
+
+typedef struct _xkmOverlayDesc {
+	CARD8		num_rows;
+	CARD8		pad1;
+	CARD16		pad2 B16;
+} xkmOverlayDesc;
+#define	sz_xkmOverlayDesc	4
+
+typedef struct _xkmOverlayRowDesc {
+	CARD8		row_under;
+	CARD8		num_keys;
+	CARD16		pad B16;
+} xkmOverlayRowDesc;
+#define	sz_xkmOverlayRowDesc	4
+
+typedef struct _xkmOverlayKeyDesc {
+	char		over[XkbKeyNameLength];
+	char		under[XkbKeyNameLength];
+} xkmOverlayKeyDesc;
+#define sz_xkmOverlayKeyDesc	8
+
+typedef struct _xkmShapeDoodadDesc {
+	CARD8		type;
+	CARD8		priority;
+	INT16		top B16;
+	INT16		left B16;
+	INT16		angle B16;
+	CARD8		color_ndx;
+	CARD8		shape_ndx;
+	CARD16		pad B16;
+	CARD32		pad1 B32;
+} xkmShapeDoodadDesc;
+#define	sz_xkmShapeDoodadDesc	16
+
+typedef struct _xkmTextDoodadDesc {
+	CARD8	 	type;
+	CARD8	 	priority;
+	INT16	 	top B16;
+	INT16	 	left B16;
+	INT16	 	angle B16;
+	CARD16		width B16;
+	CARD16		height B16;
+	CARD8	 	color_ndx;
+	CARD8		pad1;
+	CARD16		pad2 B16;
+} xkmTextDoodadDesc;
+#define	sz_xkmTextDoodadDesc	16
+
+typedef struct _xkmIndicatorDoodadDesc {
+	CARD8		type;
+	CARD8		priority;
+	INT16		top B16;
+	INT16		left B16;
+	CARD8		shape_ndx;
+	CARD8		on_color_ndx;
+	CARD8		off_color_ndx;
+	CARD8		pad1;
+	CARD16		pad2 B16;
+	CARD32		pad3 B32;
+} xkmIndicatorDoodadDesc;
+#define	sz_xkmIndicatorDoodadDesc	16
+
+typedef struct _xkmLogoDoodadDesc {
+	CARD8		type;
+	CARD8		priority;
+	INT16		top B16;
+	INT16		left B16;
+	INT16		angle B16;
+	CARD8		color_ndx;
+	CARD8		shape_ndx;
+	CARD16		pad B16;
+	CARD32		pad1 B32;
+} xkmLogoDoodadDesc;
+#define	sz_xkmLogoDoodadDesc	16
+
+typedef struct _xkmAnyDoodadDesc {
+	CARD8		type;
+	CARD8		priority;
+	INT16		top B16;
+	INT16		left B16;
+	CARD16		pad1 B16;
+	CARD32		pad2 B32;
+	CARD32		pad3 B32;
+} xkmAnyDoodadDesc;
+#define	sz_xkmAnyDoodadDesc		16
+
+typedef union _xkmDoodadDesc {
+	xkmAnyDoodadDesc	any;
+	xkmShapeDoodadDesc	shape;
+	xkmTextDoodadDesc	text;
+	xkmIndicatorDoodadDesc	indicator;
+	xkmLogoDoodadDesc	logo;
+} xkmDoodadDesc;
+#define	sz_xkmDoodadDesc		16
+
+#endif /* _XKMFORMAT_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/XLbx.h b/ThirdParty/X11/Include/X11/extensions/XLbx.h
new file mode 100644
index 0000000000000000000000000000000000000000..1af4f9ce2cd6e4e9b8b95acfba3056fa0fd46cab
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XLbx.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright 1992 Network Computing Devices
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of NCD. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  NCD. makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifndef _XLBX_H_
+#define _XLBX_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/Xdefs.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/lbx.h>
+
+_XFUNCPROTOBEGIN
+
+Bool XLbxQueryExtension(
+    Display*		/* dpy */,
+    int*		/* requestp */,
+    int*		/* event_basep */,
+    int*		/* error_basep */
+);
+
+Bool XLbxQueryVersion(
+    Display*		/* dpy */,
+    int*		/* majorVersion */,
+    int*		/* minorVersion */
+);
+
+int XLbxGetEventBase(Display *dpy);
+
+_XFUNCPROTOEND
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/XResproto.h b/ThirdParty/X11/Include/X11/extensions/XResproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..d7e20b1a119bc06db740e6dd1cbef39a04185775
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XResproto.h
@@ -0,0 +1,227 @@
+/*
+   Copyright (c) 2002  XFree86 Inc
+*/
+
+#ifndef _XRESPROTO_H
+#define _XRESPROTO_H
+
+#define XRES_MAJOR_VERSION 1
+#define XRES_MINOR_VERSION 2
+
+#define XRES_NAME "X-Resource"
+
+/* v1.0 */
+#define X_XResQueryVersion            0
+#define X_XResQueryClients            1
+#define X_XResQueryClientResources    2
+#define X_XResQueryClientPixmapBytes  3
+
+/* Version 1.1 has been accidentally released from the version           */
+/* control and while it doesn't have differences to version 1.0, the     */
+/* next version is labeled 1.2 in order to remove the risk of confusion. */
+
+/* v1.2 */
+#define X_XResQueryClientIds          4
+#define X_XResQueryResourceBytes      5
+
+typedef struct {
+   CARD32 resource_base;
+   CARD32 resource_mask;
+} xXResClient;
+#define sz_xXResClient 8
+
+typedef struct {
+   CARD32 resource_type;
+   CARD32 count;
+} xXResType;
+#define sz_xXResType 8
+
+/* XResQueryVersion */
+
+typedef struct _XResQueryVersion {
+   CARD8   reqType;
+   CARD8   XResReqType; 
+   CARD16  length B16;
+   CARD8   client_major;
+   CARD8   client_minor;
+   CARD16  unused B16;           
+} xXResQueryVersionReq;
+#define sz_xXResQueryVersionReq 8
+
+typedef struct {
+   CARD8   type;
+   CARD8   pad1;
+   CARD16  sequenceNumber B16; 
+   CARD32  length B32;
+   CARD16  server_major B16;      
+   CARD16  server_minor B16;      
+   CARD32  pad2 B32;
+   CARD32  pad3 B32;
+   CARD32  pad4 B32;
+   CARD32  pad5 B32;
+   CARD32  pad6 B32; 
+} xXResQueryVersionReply;
+#define sz_xXResQueryVersionReply  32
+
+/* XResQueryClients */
+
+typedef struct _XResQueryClients {
+   CARD8   reqType;
+   CARD8   XResReqType;       
+   CARD16  length B16;
+} xXResQueryClientsReq;
+#define sz_xXResQueryClientsReq 4
+
+typedef struct {
+   CARD8   type;
+   CARD8   pad1;     
+   CARD16  sequenceNumber B16;  
+   CARD32  length B32;
+   CARD32  num_clients B32;
+   CARD32  pad2 B32;
+   CARD32  pad3 B32;
+   CARD32  pad4 B32;
+   CARD32  pad5 B32;
+   CARD32  pad6 B32;        
+} xXResQueryClientsReply;
+#define sz_xXResQueryClientsReply  32
+
+/* XResQueryClientResources */
+
+typedef struct _XResQueryClientResources {
+   CARD8   reqType;
+   CARD8   XResReqType;
+   CARD16  length B16;
+   CARD32  xid B32;
+} xXResQueryClientResourcesReq;
+#define sz_xXResQueryClientResourcesReq 8
+
+typedef struct {
+   CARD8   type;
+   CARD8   pad1;     
+   CARD16  sequenceNumber B16;  
+   CARD32  length B32;
+   CARD32  num_types B32;
+   CARD32  pad2 B32;
+   CARD32  pad3 B32;
+   CARD32  pad4 B32;
+   CARD32  pad5 B32;
+   CARD32  pad6 B32;
+} xXResQueryClientResourcesReply;
+#define sz_xXResQueryClientResourcesReply  32
+
+/* XResQueryClientPixmapBytes */
+
+typedef struct _XResQueryClientPixmapBytes {
+   CARD8   reqType;
+   CARD8   XResReqType;
+   CARD16  length B16;
+   CARD32  xid B32;
+} xXResQueryClientPixmapBytesReq;
+#define sz_xXResQueryClientPixmapBytesReq 8
+
+typedef struct {
+   CARD8   type;
+   CARD8   pad1;
+   CARD16  sequenceNumber B16;
+   CARD32  length B32;
+   CARD32  bytes B32;
+   CARD32  bytes_overflow B32;
+   CARD32  pad2 B32;
+   CARD32  pad3 B32;
+   CARD32  pad4 B32;
+   CARD32  pad5 B32;
+} xXResQueryClientPixmapBytesReply;
+#define sz_xXResQueryClientPixmapBytesReply  32
+
+/* v1.2 XResQueryClientIds */
+
+#define X_XResClientXIDMask      0x01
+#define X_XResLocalClientPIDMask 0x02
+
+typedef struct _XResClientIdSpec {
+   CARD32  client B32;
+   CARD32  mask B32;
+} xXResClientIdSpec;
+#define sz_xXResClientIdSpec 8
+
+typedef struct _XResClientIdValue {
+   xXResClientIdSpec spec;
+   CARD32  length B32;
+   // followed by length CARD32s
+} xXResClientIdValue;
+#define sz_xResClientIdValue (sz_xXResClientIdSpec + 4)
+
+typedef struct _XResQueryClientIds {
+   CARD8   reqType;
+   CARD8   XResReqType;
+   CARD16  length B16;
+   CARD32  numSpecs B32;
+   // followed by numSpecs times XResClientIdSpec
+} xXResQueryClientIdsReq;
+#define sz_xXResQueryClientIdsReq 8
+
+typedef struct {
+   CARD8   type;
+   CARD8   pad1;
+   CARD16  sequenceNumber B16;
+   CARD32  length B32;
+   CARD32  numIds B32;
+   CARD32  pad2 B32;
+   CARD32  pad3 B32;
+   CARD32  pad4 B32;
+   CARD32  pad5 B32;
+   CARD32  pad6 B32;
+   // followed by numIds times XResClientIdValue
+} xXResQueryClientIdsReply;
+#define sz_xXResQueryClientIdsReply  32
+
+/* v1.2 XResQueryResourceBytes */
+
+typedef struct _XResResourceIdSpec {
+   CARD32  resource;
+   CARD32  type;
+} xXResResourceIdSpec;
+#define sz_xXResResourceIdSpec 8
+
+typedef struct _XResQueryResourceBytes {
+   CARD8   reqType;
+   CARD8   XResReqType;
+   CARD16  length B16;
+   CARD32  client B32;
+   CARD32  numSpecs B32;
+   // followed by numSpecs times XResResourceIdSpec
+} xXResQueryResourceBytesReq;
+#define sz_xXResQueryResourceBytesReq 12
+
+typedef struct _XResResourceSizeSpec {
+   xXResResourceIdSpec spec;
+   CARD32  bytes B32;
+   CARD32  refCount B32;
+   CARD32  useCount B32;
+} xXResResourceSizeSpec;
+#define sz_xXResResourceSizeSpec (sz_xXResResourceIdSpec + 12)
+
+typedef struct _XResResourceSizeValue {
+   xXResResourceSizeSpec size;
+   CARD32  numCrossReferences B32;
+   // followed by numCrossReferences times XResResourceSizeSpec
+} xXResResourceSizeValue;
+#define sz_xXResResourceSizeValue (sz_xXResResourceSizeSpec + 4)
+
+typedef struct {
+   CARD8   type;
+   CARD8   pad1;
+   CARD16  sequenceNumber B16;
+   CARD32  length B32;
+   CARD32  numSizes B32;
+   CARD32  pad2 B32;
+   CARD32  pad3 B32;
+   CARD32  pad4 B32;
+   CARD32  pad5 B32;
+   CARD32  pad6 B32;
+   // followed by numSizes times XResResourceSizeValue
+} xXResQueryResourceBytesReply;
+#define sz_xXResQueryResourceBytesReply  32
+
+#endif /* _XRESPROTO_H */
diff --git a/ThirdParty/X11/Include/X11/extensions/XShm.h b/ThirdParty/X11/Include/X11/extensions/XShm.h
new file mode 100644
index 0000000000000000000000000000000000000000..23f065115ea2a3ef85d7349f9fccd0206cb633e0
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XShm.h
@@ -0,0 +1,135 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
+
+#ifndef _XSHM_H_
+#define _XSHM_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/shm.h>
+
+#ifndef _XSHM_SERVER_
+typedef unsigned long ShmSeg;
+
+typedef struct {
+    int	type;		    /* of event */
+    unsigned long serial;   /* # of last request processed by server */
+    Bool send_event;	    /* true if this came frome a SendEvent request */
+    Display *display;	    /* Display the event was read from */
+    Drawable drawable;	    /* drawable of request */
+    int major_code;	    /* ShmReqCode */
+    int minor_code;	    /* X_ShmPutImage */
+    ShmSeg shmseg;	    /* the ShmSeg used in the request */
+    unsigned long offset;   /* the offset into ShmSeg used in the request */
+} XShmCompletionEvent;
+
+typedef struct {
+    ShmSeg shmseg;	/* resource id */
+    int shmid;		/* kernel id */
+    char *shmaddr;	/* address in client */
+    Bool readOnly;	/* how the server should attach it */
+} XShmSegmentInfo;
+
+_XFUNCPROTOBEGIN
+
+Bool XShmQueryExtension(
+    Display*		/* dpy */
+);
+
+int XShmGetEventBase(
+    Display* 		/* dpy */
+);
+
+Bool XShmQueryVersion(
+    Display*		/* dpy */,
+    int*		/* majorVersion */,
+    int*		/* minorVersion */,
+    Bool*		/* sharedPixmaps */
+);
+
+int XShmPixmapFormat(
+    Display*		/* dpy */
+);
+
+Bool XShmAttach(
+    Display*		/* dpy */,
+    XShmSegmentInfo*	/* shminfo */
+);
+
+Bool XShmDetach(
+    Display*		/* dpy */,
+    XShmSegmentInfo*	/* shminfo */
+);
+
+Bool XShmPutImage(
+    Display*		/* dpy */,
+    Drawable		/* d */,
+    GC			/* gc */,
+    XImage*		/* image */,
+    int			/* src_x */,
+    int			/* src_y */,
+    int			/* dst_x */,
+    int			/* dst_y */,
+    unsigned int	/* src_width */,
+    unsigned int	/* src_height */,
+    Bool		/* send_event */
+);
+
+Bool XShmGetImage(
+    Display*		/* dpy */,
+    Drawable		/* d */,
+    XImage*		/* image */,
+    int			/* x */,
+    int			/* y */,
+    unsigned long	/* plane_mask */
+);
+
+XImage *XShmCreateImage(
+    Display*		/* dpy */,
+    Visual*		/* visual */,
+    unsigned int	/* depth */,
+    int			/* format */,
+    char*		/* data */,
+    XShmSegmentInfo*	/* shminfo */,
+    unsigned int	/* width */,
+    unsigned int	/* height */
+);
+
+Pixmap XShmCreatePixmap(
+    Display*		/* dpy */,
+    Drawable		/* d */,
+    char*		/* data */,
+    XShmSegmentInfo*	/* shminfo */,
+    unsigned int	/* width */,
+    unsigned int	/* height */,
+    unsigned int	/* depth */
+);
+
+_XFUNCPROTOEND
+#endif /* _XSHM_SERVER_ */
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/XTest.h b/ThirdParty/X11/Include/X11/extensions/XTest.h
new file mode 100644
index 0000000000000000000000000000000000000000..f973aebb4b9ead5c6c1f8a1efab3fad84c869e57
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XTest.h
@@ -0,0 +1,144 @@
+/*
+
+Copyright 1992, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _XTEST_H_
+#define _XTEST_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/xtestconst.h>
+#include <X11/extensions/XInput.h>
+
+_XFUNCPROTOBEGIN
+
+Bool XTestQueryExtension(
+    Display*		/* dpy */,
+    int*		/* event_basep */,
+    int*		/* error_basep */,
+    int*		/* majorp */,
+    int*		/* minorp */
+);
+
+Bool XTestCompareCursorWithWindow(
+    Display*		/* dpy */,
+    Window		/* window */,
+    Cursor		/* cursor */
+);
+
+Bool XTestCompareCurrentCursorWithWindow(
+    Display*		/* dpy */,
+    Window		/* window */
+);
+
+extern int XTestFakeKeyEvent(
+    Display*		/* dpy */,
+    unsigned int	/* keycode */,
+    Bool		/* is_press */,
+    unsigned long	/* delay */
+);
+
+extern int XTestFakeButtonEvent(
+    Display*		/* dpy */,
+    unsigned int	/* button */,
+    Bool		/* is_press */,
+    unsigned long	/* delay */
+);
+
+extern int XTestFakeMotionEvent(
+    Display*		/* dpy */,
+    int			/* screen */,
+    int			/* x */,
+    int			/* y */,
+    unsigned long	/* delay */
+);
+
+extern int XTestFakeRelativeMotionEvent(
+    Display*		/* dpy */,
+    int			/* x */,
+    int			/* y */,
+    unsigned long	/* delay */
+);
+
+extern int XTestFakeDeviceKeyEvent(
+    Display*		/* dpy */,
+    XDevice*		/* dev */,
+    unsigned int	/* keycode */,
+    Bool		/* is_press */,
+    int*		/* axes */,
+    int			/* n_axes */,
+    unsigned long	/* delay */
+);
+
+extern int XTestFakeDeviceButtonEvent(
+    Display*		/* dpy */,
+    XDevice*		/* dev */,
+    unsigned int	/* button */,
+    Bool		/* is_press */,
+    int*		/* axes */,
+    int			/* n_axes */,
+    unsigned long	/* delay */
+);
+
+extern int XTestFakeProximityEvent(
+    Display*		/* dpy */,
+    XDevice*		/* dev */,
+    Bool		/* in_prox */,
+    int*		/* axes */,
+    int			/* n_axes */,
+    unsigned long	/* delay */
+);
+
+extern int XTestFakeDeviceMotionEvent(
+    Display*		/* dpy */,
+    XDevice*		/* dev */,
+    Bool		/* is_relative */,
+    int			/* first_axis */,
+    int*		/* axes */,
+    int			/* n_axes */,
+    unsigned long	/* delay */
+);
+
+extern int XTestGrabControl(
+    Display*		/* dpy */,
+    Bool		/* impervious */
+);
+
+void XTestSetGContextOfGC(
+    GC			/* gc */,
+    GContext		/* gid */
+);
+
+void XTestSetVisualIDOfVisual(
+    Visual*		/* visual */,
+    VisualID		/* visualid */
+);
+
+Status XTestDiscard(
+    Display*		/* dpy */
+);
+
+_XFUNCPROTOEND
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/Xag.h b/ThirdParty/X11/Include/X11/extensions/Xag.h
new file mode 100644
index 0000000000000000000000000000000000000000..9f69f7875a0083f582ef96232b068c801b5971bf
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/Xag.h
@@ -0,0 +1,90 @@
+/*
+Copyright 1996, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+*/
+
+#ifndef _XAG_H_
+#define _XAG_H_
+
+#include <X11/extensions/ag.h>
+#include <X11/Xfuncproto.h>
+
+#include <stdarg.h>
+
+_XFUNCPROTOBEGIN
+
+typedef XID XAppGroup;
+
+Bool XagQueryVersion(
+    Display*			/* dpy */,
+    int*			/* major_version */,
+    int*			/* minor_version */
+);
+
+Status XagCreateEmbeddedApplicationGroup(
+    Display*			/* dpy */,
+    VisualID			/* root_visual */,
+    Colormap			/* default_colormap */,
+    unsigned long		/* black_pixel */,
+    unsigned long		/* white_pixel */,
+    XAppGroup*			/* app_group_return */
+);
+
+Status XagCreateNonembeddedApplicationGroup(
+    Display*			/* dpy */,
+    XAppGroup*			/* app_group_return */
+);
+
+Status XagDestroyApplicationGroup(
+    Display*			/* dpy */,
+    XAppGroup			/* app_group */
+);
+
+Status XagGetApplicationGroupAttributes(
+    Display*			/* dpy */,
+    XAppGroup			/* app_group */,
+    ...
+);
+
+Status XagQueryApplicationGroup(
+    Display*			/* dpy */,
+    XID				/* resource_base */,
+    XAppGroup*			/* app_group_ret */
+);
+
+Status XagCreateAssociation(
+    Display*			/* dpy */,
+    Window*			/* window_ret */,
+    void*			/* system_window */
+);
+
+Status XagDestroyAssociation(
+    Display*			/* dpy */,
+    Window			/* window */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _XAG_H_ */
+
diff --git a/ThirdParty/X11/Include/X11/extensions/Xcomposite.h b/ThirdParty/X11/Include/X11/extensions/Xcomposite.h
new file mode 100644
index 0000000000000000000000000000000000000000..9e4fcb1cfb266cc865277d5e21dc383f70c6fc0f
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/Xcomposite.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+/*
+ * Copyright © 2003 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _XCOMPOSITE_H_
+#define _XCOMPOSITE_H_
+
+#include <X11/extensions/composite.h>
+#include <X11/extensions/Xfixes.h>
+#include <X11/Xfuncproto.h>
+
+/*
+ * This revision number also appears in configure.ac, they have
+ * to be manually synchronized
+ */
+#define XCOMPOSITE_MAJOR	COMPOSITE_MAJOR
+#define XCOMPOSITE_MINOR	COMPOSITE_MINOR
+#define XCOMPOSITE_REVISION	2
+#define XCOMPOSITE_VERSION	((XCOMPOSITE_MAJOR * 10000) + (XCOMPOSITE_MINOR * 100) + (XCOMPOSITE_REVISION))
+
+_XFUNCPROTOBEGIN
+
+Bool XCompositeQueryExtension (Display *dpy,
+                               int *event_base_return,
+                               int *error_base_return);
+
+Status XCompositeQueryVersion (Display *dpy,
+                               int     *major_version_return,
+                               int     *minor_version_return);
+
+int XCompositeVersion (void);
+
+void
+XCompositeRedirectWindow (Display *dpy, Window window, int update);
+
+void
+XCompositeRedirectSubwindows (Display *dpy, Window window, int update);
+
+void
+XCompositeUnredirectWindow (Display *dpy, Window window, int update);
+
+void
+XCompositeUnredirectSubwindows (Display *dpy, Window window, int update);
+
+XserverRegion
+XCompositeCreateRegionFromBorderClip (Display *dpy, Window window);
+
+Pixmap
+XCompositeNameWindowPixmap (Display *dpy, Window window);
+
+Window
+XCompositeGetOverlayWindow (Display *dpy, Window window);
+
+void
+XCompositeReleaseOverlayWindow (Display *dpy, Window window);
+
+_XFUNCPROTOEND
+
+#endif /* _XCOMPOSITE_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/Xcup.h b/ThirdParty/X11/Include/X11/extensions/Xcup.h
new file mode 100644
index 0000000000000000000000000000000000000000..c8074cf3d877efd7fcdc078d0c7cbfbf4302af5c
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/Xcup.h
@@ -0,0 +1,58 @@
+/*
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _XCUP_H_
+#define _XCUP_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/cup.h>
+
+_XFUNCPROTOBEGIN
+
+Bool XcupQueryVersion(
+    Display*			/* dpy */,
+    int*			/* major_version */,
+    int*			/* minor_version */
+);
+
+Status XcupGetReservedColormapEntries(
+    Display*			/* dpy */,
+    int				/* screen */,
+    XColor**			/* colors_out */,
+    int*			/* ncolors */
+);
+
+Status XcupStoreColors(
+    Display*			/* dpy */,
+    Colormap			/* colormap */,
+    XColor*			/* colors */,
+    int				/* ncolors */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _XCUP_H_ */
+
diff --git a/ThirdParty/X11/Include/X11/extensions/Xdamage.h b/ThirdParty/X11/Include/X11/extensions/Xdamage.h
new file mode 100644
index 0000000000000000000000000000000000000000..b3a5a066c75120f6184a211ccc6837b82c3e5fd9
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/Xdamage.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright © 2003 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _XDAMAGE_H_
+#define _XDAMAGE_H_
+
+#include <X11/extensions/damagewire.h>
+#include <X11/extensions/Xfixes.h>
+#include <X11/Xfuncproto.h>
+
+#define XDAMAGE_1_1_INTERFACE
+
+typedef XID Damage;
+
+typedef struct {
+    int type;			/* event base */
+    unsigned long serial;
+    Bool send_event;
+    Display *display;
+    Drawable drawable;
+    Damage damage;
+    int level;
+    Bool more;			/* more events will be delivered immediately */
+    Time timestamp;
+    XRectangle area;
+    XRectangle geometry;
+} XDamageNotifyEvent;
+
+_XFUNCPROTOBEGIN
+
+Bool XDamageQueryExtension (Display *dpy,
+                            int *event_base_return,
+                            int *error_base_return);
+
+Status XDamageQueryVersion (Display *dpy,
+			    int     *major_version_return,
+			    int     *minor_version_return);
+
+Damage
+XDamageCreate (Display	*dpy, Drawable drawable, int level);
+
+void
+XDamageDestroy (Display *dpy, Damage damage);
+
+void
+XDamageSubtract (Display *dpy, Damage damage,
+		 XserverRegion repair, XserverRegion parts);
+
+void
+XDamageAdd (Display *dpy, Drawable drawable, XserverRegion region);
+
+_XFUNCPROTOEND
+
+#endif /* _XDAMAGE_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/Xdbe.h b/ThirdParty/X11/Include/X11/extensions/Xdbe.h
new file mode 100644
index 0000000000000000000000000000000000000000..5c842a445a2bb797149272aeb728a0c01e2b631d
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/Xdbe.h
@@ -0,0 +1,138 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994, 1995  Hewlett-Packard Company
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Hewlett-Packard
+ * Company shall not be used in advertising or otherwise to promote the
+ * sale, use or other dealings in this Software without prior written
+ * authorization from the Hewlett-Packard Company.
+ *
+ *     Header file for Xlib-related DBE
+ *
+ *****************************************************************************/
+
+#ifndef XDBE_H
+#define XDBE_H
+
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/dbe.h>
+
+typedef struct
+{
+    VisualID    visual;    /* one visual ID that supports double-buffering */
+    int         depth;     /* depth of visual in bits                      */
+    int         perflevel; /* performance level of visual                  */
+}
+XdbeVisualInfo;
+
+typedef struct
+{
+    int                 count;          /* number of items in visual_depth   */
+    XdbeVisualInfo      *visinfo;       /* list of visuals & depths for scrn */
+}
+XdbeScreenVisualInfo;
+
+
+typedef Drawable XdbeBackBuffer;
+
+typedef unsigned char XdbeSwapAction;
+
+typedef struct
+{
+    Window		swap_window;    /* window for which to swap buffers   */
+    XdbeSwapAction	swap_action;    /* swap action to use for swap_window */
+}
+XdbeSwapInfo;
+
+typedef struct
+{
+    Window	window;			/* window that buffer belongs to */
+}
+XdbeBackBufferAttributes;
+
+typedef struct
+{
+    int			type;
+    Display		*display;	/* display the event was read from */
+    XdbeBackBuffer	buffer;		/* resource id                     */
+    unsigned long	serial;		/* serial number of failed request */
+    unsigned char	error_code;	/* error base + XdbeBadBuffer      */
+    unsigned char	request_code;	/* major opcode of failed request  */
+    unsigned char	minor_code;	/* minor opcode of failed request  */
+}
+XdbeBufferError;
+
+/* _XFUNCPROTOBEGIN and _XFUNCPROTOEND are defined as noops
+ * (for non-C++ builds) in X11/Xfuncproto.h.
+ */
+_XFUNCPROTOBEGIN
+
+extern Status XdbeQueryExtension(
+    Display*		/* dpy                  */,
+    int*		/* major_version_return */,
+    int*		/* minor_version_return */
+);
+
+extern XdbeBackBuffer XdbeAllocateBackBufferName(
+    Display*		/* dpy         */,
+    Window		/* window      */,
+    XdbeSwapAction	/* swap_action */
+);
+
+extern Status XdbeDeallocateBackBufferName(
+    Display*		/* dpy    */,
+    XdbeBackBuffer	/* buffer */
+);
+
+extern Status XdbeSwapBuffers(
+    Display*		/* dpy         */,
+    XdbeSwapInfo*	/* swap_info   */,
+    int			/* num_windows */
+);
+
+extern Status XdbeBeginIdiom(
+    Display*		/* dpy */
+);
+
+extern Status XdbeEndIdiom(
+    Display*		/* dpy */
+);
+
+extern XdbeScreenVisualInfo *XdbeGetVisualInfo(
+    Display*		/* dpy               */,
+    Drawable*		/* screen_specifiers */,
+    int*		/* num_screens       */
+);
+
+extern void XdbeFreeVisualInfo(
+    XdbeScreenVisualInfo*	/* visual_info */
+);
+
+extern XdbeBackBufferAttributes *XdbeGetBackBufferAttributes(
+    Display*		/* dpy    */,
+    XdbeBackBuffer	/* buffer */
+);
+
+_XFUNCPROTOEND
+
+#endif /* XDBE_H */
+
diff --git a/ThirdParty/X11/Include/X11/extensions/Xeviestr.h b/ThirdParty/X11/Include/X11/extensions/Xeviestr.h
new file mode 100644
index 0000000000000000000000000000000000000000..78871f10979f3b4771e696df1be204182ac76614
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/Xeviestr.h
@@ -0,0 +1,3 @@
+#warning "Xeviestr.h is obsolete and may be removed in the future."
+#warning "include <X11/extensions/evieproto.h> for the protocol defines."
+#include <X11/extensions/evieproto.h>
diff --git a/ThirdParty/X11/Include/X11/extensions/Xext.h b/ThirdParty/X11/Include/X11/extensions/Xext.h
new file mode 100644
index 0000000000000000000000000000000000000000..858592b78baedb2764d06b3a29268d9b15580e29
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/Xext.h
@@ -0,0 +1,53 @@
+/*
+ *
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+#ifndef _XEXT_H_
+#define _XEXT_H_
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+typedef int (*XextErrorHandler) (
+    Display *		/* dpy */,
+    _Xconst char*	/* ext_name */,
+    _Xconst char*	/* reason */
+);
+
+extern XextErrorHandler XSetExtensionErrorHandler(
+    XextErrorHandler	/* handler */
+);
+
+extern int XMissingExtension(
+    Display*		/* dpy */,
+    _Xconst char*	/* ext_name */
+);
+
+_XFUNCPROTOEND
+
+#define X_EXTENSION_UNKNOWN "unknown"
+#define X_EXTENSION_MISSING "missing"
+
+#endif /* _XEXT_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/Xfixes.h b/ThirdParty/X11/Include/X11/extensions/Xfixes.h
new file mode 100644
index 0000000000000000000000000000000000000000..8995d147b69dec4c59c0aab4bf51a9d447374953
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/Xfixes.h
@@ -0,0 +1,269 @@
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2011 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+/*
+ * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _XFIXES_H_
+#define _XFIXES_H_
+
+#include <X11/extensions/xfixeswire.h>
+
+#include <X11/Xfuncproto.h>
+#include <X11/Xlib.h>
+
+/*
+ * This revision number also appears in configure.ac, they have
+ * to be manually synchronized
+ */
+#define XFIXES_REVISION	1
+#define XFIXES_VERSION	((XFIXES_MAJOR * 10000) + (XFIXES_MINOR * 100) + (XFIXES_REVISION))
+
+typedef struct {
+    int type;			/* event base */
+    unsigned long serial;
+    Bool send_event;
+    Display *display;
+    Window window;
+    int subtype;
+    Window owner;
+    Atom selection;
+    Time timestamp;
+    Time selection_timestamp;
+} XFixesSelectionNotifyEvent;
+
+typedef struct {
+    int type;			/* event base */
+    unsigned long serial;
+    Bool send_event;
+    Display *display;
+    Window window;
+    int subtype;
+    unsigned long cursor_serial;
+    Time timestamp;
+    Atom cursor_name;
+} XFixesCursorNotifyEvent;
+
+typedef struct {
+    short	    x, y;
+    unsigned short  width, height;
+    unsigned short  xhot, yhot;
+    unsigned long   cursor_serial;
+    unsigned long   *pixels;
+#if XFIXES_MAJOR >= 2
+    Atom	    atom;		    /* Version >= 2 only */
+    const char	    *name;		    /* Version >= 2 only */
+#endif
+} XFixesCursorImage;
+
+#if XFIXES_MAJOR >= 2
+/* Version 2 types */
+
+typedef XID XserverRegion;
+
+typedef struct {
+    short	    x, y;
+    unsigned short  width, height;
+    unsigned short  xhot, yhot;
+    unsigned long   cursor_serial;
+    unsigned long   *pixels;
+    Atom	    atom;
+    const char	    *name;
+} XFixesCursorImageAndName;
+
+#endif
+
+_XFUNCPROTOBEGIN
+
+Bool XFixesQueryExtension (Display *dpy,
+			    int *event_base_return,
+			    int *error_base_return);
+Status XFixesQueryVersion (Display *dpy,
+			    int     *major_version_return,
+			    int     *minor_version_return);
+
+int XFixesVersion (void);
+
+void
+XFixesChangeSaveSet (Display	*dpy,
+		     Window	win,
+		     int	mode,
+		     int	target,
+		     int	map);
+
+void
+XFixesSelectSelectionInput (Display	    *dpy,
+			    Window	    win,
+			    Atom	    selection,
+			    unsigned long   eventMask);
+
+void
+XFixesSelectCursorInput (Display	*dpy,
+			 Window		win,
+			 unsigned long	eventMask);
+
+XFixesCursorImage *
+XFixesGetCursorImage (Display *dpy);
+
+#if XFIXES_MAJOR >= 2
+/* Version 2 functions */
+
+XserverRegion
+XFixesCreateRegion (Display *dpy, XRectangle *rectangles, int nrectangles);
+
+XserverRegion
+XFixesCreateRegionFromBitmap (Display *dpy, Pixmap bitmap);
+
+XserverRegion
+XFixesCreateRegionFromWindow (Display *dpy, Window window, int kind);
+
+XserverRegion
+XFixesCreateRegionFromGC (Display *dpy, GC gc);
+
+XserverRegion
+XFixesCreateRegionFromPicture (Display *dpy, XID picture);
+
+void
+XFixesDestroyRegion (Display *dpy, XserverRegion region);
+
+void
+XFixesSetRegion (Display *dpy, XserverRegion region,
+		 XRectangle *rectangles, int nrectangles);
+
+void
+XFixesCopyRegion (Display *dpy, XserverRegion dst, XserverRegion src);
+
+void
+XFixesUnionRegion (Display *dpy, XserverRegion dst,
+		   XserverRegion src1, XserverRegion src2);
+
+void
+XFixesIntersectRegion (Display *dpy, XserverRegion dst,
+		       XserverRegion src1, XserverRegion src2);
+
+void
+XFixesSubtractRegion (Display *dpy, XserverRegion dst,
+		      XserverRegion src1, XserverRegion src2);
+
+void
+XFixesInvertRegion (Display *dpy, XserverRegion dst,
+		    XRectangle *rect, XserverRegion src);
+
+void
+XFixesTranslateRegion (Display *dpy, XserverRegion region, int dx, int dy);
+
+void
+XFixesRegionExtents (Display *dpy, XserverRegion dst, XserverRegion src);
+
+XRectangle *
+XFixesFetchRegion (Display *dpy, XserverRegion region, int *nrectanglesRet);
+
+XRectangle *
+XFixesFetchRegionAndBounds (Display *dpy, XserverRegion region,
+			    int *nrectanglesRet,
+			    XRectangle *bounds);
+
+void
+XFixesSetGCClipRegion (Display *dpy, GC gc,
+		       int clip_x_origin, int clip_y_origin,
+		       XserverRegion region);
+
+void
+XFixesSetWindowShapeRegion (Display *dpy, Window win, int shape_kind,
+			    int x_off, int y_off, XserverRegion region);
+
+void
+XFixesSetPictureClipRegion (Display *dpy, XID picture,
+			    int clip_x_origin, int clip_y_origin,
+			    XserverRegion region);
+
+void
+XFixesSetCursorName (Display *dpy, Cursor cursor, const char *name);
+
+const char *
+XFixesGetCursorName (Display *dpy, Cursor cursor, Atom *atom);
+
+void
+XFixesChangeCursor (Display *dpy, Cursor source, Cursor destination);
+
+void
+XFixesChangeCursorByName (Display *dpy, Cursor source, const char *name);
+
+#endif	/* XFIXES_MAJOR >= 2 */
+
+#if XFIXES_MAJOR >= 3
+
+void
+XFixesExpandRegion (Display *dpy, XserverRegion dst, XserverRegion src,
+		    unsigned left, unsigned right,
+		    unsigned top, unsigned bottom);
+
+#endif	/* XFIXES_MAJOR >= 3 */
+
+#if XFIXES_MAJOR >= 4
+/* Version 4.0 externs */
+
+void
+XFixesHideCursor (Display *dpy, Window win);
+
+void
+XFixesShowCursor (Display *dpy, Window win);
+
+#endif /* XFIXES_MAJOR >= 4 */
+
+#if XFIXES_MAJOR >= 5
+
+typedef XID PointerBarrier;
+
+PointerBarrier
+XFixesCreatePointerBarrier(Display *dpy, Window w, int x1, int y1,
+			   int x2, int y2, int directions,
+			   int num_devices, int *devices);
+
+void
+XFixesDestroyPointerBarrier(Display *dpy, PointerBarrier b);
+
+#endif /* XFIXES_MAJOR >= 5 */
+
+_XFUNCPROTOEND
+
+#endif /* _XFIXES_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/Xge.h b/ThirdParty/X11/Include/X11/extensions/Xge.h
new file mode 100644
index 0000000000000000000000000000000000000000..76b5a6a01995eaa9e42c0fb856bd7f577ce7f644
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/Xge.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright � 2007-2008 Peter Hutterer
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Peter Hutterer, University of South Australia, NICTA
+ *
+ */
+
+
+/* XGE Client interfaces */
+
+#ifndef _XGE_H_
+#define _XGE_H_
+
+#include <X11/Xlib.h>
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+/**
+ * Generic Event mask.
+ * To be used whenever a list of masks per extension has to be provided.
+ *
+ * But, don't actually use the CARD{8,16,32} types.  We can't get them them
+ * defined here without polluting the namespace.
+ */
+typedef struct {
+    unsigned char       extension;
+    unsigned char       pad0;
+    unsigned short      pad1;
+    unsigned int      evmask;
+} XGenericEventMask;
+
+Bool XGEQueryExtension(Display* dpy, int *event_basep, int *err_basep);
+Bool XGEQueryVersion(Display* dpy, int *major, int* minor);
+
+_XFUNCPROTOEND
+
+#endif /* _XGE_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/Xinerama.h b/ThirdParty/X11/Include/X11/extensions/Xinerama.h
new file mode 100644
index 0000000000000000000000000000000000000000..8c0f8296ac137377226a1e069508f992e6358689
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/Xinerama.h
@@ -0,0 +1,74 @@
+/*
+
+Copyright 2003  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _Xinerama_h
+#define _Xinerama_h
+
+#include <X11/Xlib.h>
+
+typedef struct {
+   int   screen_number;
+   short x_org;
+   short y_org;
+   short width;
+   short height;
+} XineramaScreenInfo;
+
+_XFUNCPROTOBEGIN
+
+Bool XineramaQueryExtension (
+   Display *dpy,
+   int     *event_base,
+   int     *error_base
+);
+
+Status XineramaQueryVersion(
+   Display *dpy,
+   int     *major_versionp,
+   int     *minor_versionp
+);
+
+Bool XineramaIsActive(Display *dpy);
+
+
+/*
+   Returns the number of heads and a pointer to an array of
+   structures describing the position and size of the individual
+   heads.  Returns NULL and number = 0 if Xinerama is not active.
+
+   Returned array should be freed with XFree().
+*/
+
+XineramaScreenInfo *
+XineramaQueryScreens(
+   Display *dpy,
+   int     *number
+);
+
+_XFUNCPROTOEND
+
+#endif /* _Xinerama_h */
+
diff --git a/ThirdParty/X11/Include/X11/extensions/Xrandr.h b/ThirdParty/X11/Include/X11/extensions/Xrandr.h
new file mode 100644
index 0000000000000000000000000000000000000000..65940bbdb184f531a371f90e9ec3fa4adeb31f4e
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/Xrandr.h
@@ -0,0 +1,587 @@
+/*
+ * Copyright © 2000 Compaq Computer Corporation, Inc.
+ * Copyright © 2002 Hewlett-Packard Company, Inc.
+ * Copyright © 2006 Intel Corporation
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ *
+ * Author:  Jim Gettys, HP Labs, Hewlett-Packard, Inc.
+ *	    Keith Packard, Intel Corporation
+ */
+
+#ifndef _XRANDR_H_
+#define _XRANDR_H_
+
+#include <X11/extensions/randr.h>
+#include <X11/extensions/Xrender.h>
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+typedef XID RROutput;
+typedef XID RRCrtc;
+typedef XID RRMode;
+typedef XID RRProvider;
+
+typedef struct {
+    int	width, height;
+    int	mwidth, mheight;
+} XRRScreenSize;
+
+/*
+ *  Events.
+ */
+
+typedef struct {
+    int type;			/* event base */
+    unsigned long serial;	/* # of last request processed by server */
+    Bool send_event;		/* true if this came from a SendEvent request */
+    Display *display;		/* Display the event was read from */
+    Window window;		/* window which selected for this event */
+    Window root;		/* Root window for changed screen */
+    Time timestamp;		/* when the screen change occurred */
+    Time config_timestamp;	/* when the last configuration change */
+    SizeID size_index;
+    SubpixelOrder subpixel_order;
+    Rotation rotation;
+    int width;
+    int height;
+    int mwidth;
+    int mheight;
+} XRRScreenChangeNotifyEvent;
+
+typedef struct {
+    int type;			/* event base */
+    unsigned long serial;	/* # of last request processed by server */
+    Bool send_event;		/* true if this came from a SendEvent request */
+    Display *display;		/* Display the event was read from */
+    Window window;		/* window which selected for this event */
+    int subtype;		/* RRNotify_ subtype */
+} XRRNotifyEvent;
+
+typedef struct {
+    int type;			/* event base */
+    unsigned long serial;	/* # of last request processed by server */
+    Bool send_event;		/* true if this came from a SendEvent request */
+    Display *display;		/* Display the event was read from */
+    Window window;		/* window which selected for this event */
+    int subtype;		/* RRNotify_OutputChange */
+    RROutput output;		/* affected output */
+    RRCrtc crtc;	    	/* current crtc (or None) */
+    RRMode mode;	    	/* current mode (or None) */
+    Rotation rotation;		/* current rotation of associated crtc */
+    Connection connection;	/* current connection status */
+    SubpixelOrder subpixel_order;
+} XRROutputChangeNotifyEvent;
+
+typedef struct {
+    int type;			/* event base */
+    unsigned long serial;	/* # of last request processed by server */
+    Bool send_event;		/* true if this came from a SendEvent request */
+    Display *display;		/* Display the event was read from */
+    Window window;		/* window which selected for this event */
+    int subtype;		/* RRNotify_CrtcChange */
+    RRCrtc crtc;    		/* current crtc (or None) */
+    RRMode mode;	    	/* current mode (or None) */
+    Rotation rotation;		/* current rotation of associated crtc */
+    int x, y;			/* position */
+    unsigned int width, height;	/* size */
+} XRRCrtcChangeNotifyEvent;
+
+typedef struct {
+    int type;			/* event base */
+    unsigned long serial;	/* # of last request processed by server */
+    Bool send_event;		/* true if this came from a SendEvent request */
+    Display *display;		/* Display the event was read from */
+    Window window;		/* window which selected for this event */
+    int subtype;		/* RRNotify_OutputProperty */
+    RROutput output;		/* related output */
+    Atom property;		/* changed property */
+    Time timestamp;		/* time of change */
+    int state;			/* NewValue, Deleted */
+} XRROutputPropertyNotifyEvent;
+
+typedef struct {
+    int type;			/* event base */
+    unsigned long serial;	/* # of last request processed by server */
+    Bool send_event;		/* true if this came from a SendEvent request */
+    Display *display;		/* Display the event was read from */
+    Window window;		/* window which selected for this event */
+    int subtype;		/* RRNotify_ProviderChange */
+    RRProvider provider; 	/* current provider (or None) */
+    Time timestamp;		/* time of change */
+    unsigned int current_role;
+} XRRProviderChangeNotifyEvent;
+
+typedef struct {
+    int type;			/* event base */
+    unsigned long serial;	/* # of last request processed by server */
+    Bool send_event;		/* true if this came from a SendEvent request */
+    Display *display;		/* Display the event was read from */
+    Window window;		/* window which selected for this event */
+    int subtype;		/* RRNotify_ProviderProperty */
+    RRProvider provider;		/* related provider */
+    Atom property;		/* changed property */
+    Time timestamp;		/* time of change */
+    int state;			/* NewValue, Deleted */
+} XRRProviderPropertyNotifyEvent;
+
+typedef struct {
+    int type;			/* event base */
+    unsigned long serial;	/* # of last request processed by server */
+    Bool send_event;		/* true if this came from a SendEvent request */
+    Display *display;		/* Display the event was read from */
+    Window window;		/* window which selected for this event */
+    int subtype;		/* RRNotify_ResourceChange */
+    Time timestamp;		/* time of change */
+} XRRResourceChangeNotifyEvent;
+
+/* internal representation is private to the library */
+typedef struct _XRRScreenConfiguration XRRScreenConfiguration;
+
+Bool XRRQueryExtension (Display *dpy,
+			int *event_base_return,
+			int *error_base_return);
+Status XRRQueryVersion (Display *dpy,
+			    int     *major_version_return,
+			    int     *minor_version_return);
+
+XRRScreenConfiguration *XRRGetScreenInfo (Display *dpy,
+					  Window window);
+
+void XRRFreeScreenConfigInfo (XRRScreenConfiguration *config);
+
+/*
+ * Note that screen configuration changes are only permitted if the client can
+ * prove it has up to date configuration information.  We are trying to
+ * insist that it become possible for screens to change dynamically, so
+ * we want to ensure the client knows what it is talking about when requesting
+ * changes.
+ */
+Status XRRSetScreenConfig (Display *dpy,
+			   XRRScreenConfiguration *config,
+			   Drawable draw,
+			   int size_index,
+			   Rotation rotation,
+			   Time timestamp);
+
+/* added in v1.1, sorry for the lame name */
+Status XRRSetScreenConfigAndRate (Display *dpy,
+				  XRRScreenConfiguration *config,
+				  Drawable draw,
+				  int size_index,
+				  Rotation rotation,
+				  short rate,
+				  Time timestamp);
+
+
+Rotation XRRConfigRotations(XRRScreenConfiguration *config, Rotation *current_rotation);
+
+Time XRRConfigTimes (XRRScreenConfiguration *config, Time *config_timestamp);
+
+XRRScreenSize *XRRConfigSizes(XRRScreenConfiguration *config, int *nsizes);
+
+short *XRRConfigRates (XRRScreenConfiguration *config, int sizeID, int *nrates);
+
+SizeID XRRConfigCurrentConfiguration (XRRScreenConfiguration *config,
+			      Rotation *rotation);
+
+short XRRConfigCurrentRate (XRRScreenConfiguration *config);
+
+int XRRRootToScreen(Display *dpy, Window root);
+
+/*
+ * returns the screen configuration for the specified screen; does a lazy
+ * evalution to delay getting the information, and caches the result.
+ * These routines should be used in preference to XRRGetScreenInfo
+ * to avoid unneeded round trips to the X server.  These are new
+ * in protocol version 0.1.
+ */
+
+
+void XRRSelectInput(Display *dpy, Window window, int mask);
+
+/*
+ * the following are always safe to call, even if RandR is not implemented
+ * on a screen
+ */
+
+
+Rotation XRRRotations(Display *dpy, int screen, Rotation *current_rotation);
+XRRScreenSize *XRRSizes(Display *dpy, int screen, int *nsizes);
+short *XRRRates (Display *dpy, int screen, int sizeID, int *nrates);
+Time XRRTimes (Display *dpy, int screen, Time *config_timestamp);
+
+
+/* Version 1.2 additions */
+
+/* despite returning a Status, this returns 1 for success */
+Status
+XRRGetScreenSizeRange (Display *dpy, Window window,
+		       int *minWidth, int *minHeight,
+		       int *maxWidth, int *maxHeight);
+
+void
+XRRSetScreenSize (Display *dpy, Window window,
+		  int width, int height,
+		  int mmWidth, int mmHeight);
+
+typedef unsigned long XRRModeFlags;
+
+typedef struct _XRRModeInfo {
+    RRMode		id;
+    unsigned int	width;
+    unsigned int	height;
+    unsigned long	dotClock;
+    unsigned int	hSyncStart;
+    unsigned int	hSyncEnd;
+    unsigned int	hTotal;
+    unsigned int	hSkew;
+    unsigned int	vSyncStart;
+    unsigned int	vSyncEnd;
+    unsigned int	vTotal;
+    char		*name;
+    unsigned int	nameLength;
+    XRRModeFlags	modeFlags;
+} XRRModeInfo;
+
+typedef struct _XRRScreenResources {
+    Time	timestamp;
+    Time	configTimestamp;
+    int		ncrtc;
+    RRCrtc	*crtcs;
+    int		noutput;
+    RROutput	*outputs;
+    int		nmode;
+    XRRModeInfo	*modes;
+} XRRScreenResources;
+
+XRRScreenResources *
+XRRGetScreenResources (Display *dpy, Window window);
+
+void
+XRRFreeScreenResources (XRRScreenResources *resources);
+
+typedef struct _XRROutputInfo {
+    Time	    timestamp;
+    RRCrtc	    crtc;
+    char	    *name;
+    int		    nameLen;
+    unsigned long   mm_width;
+    unsigned long   mm_height;
+    Connection	    connection;
+    SubpixelOrder   subpixel_order;
+    int		    ncrtc;
+    RRCrtc	    *crtcs;
+    int		    nclone;
+    RROutput	    *clones;
+    int		    nmode;
+    int		    npreferred;
+    RRMode	    *modes;
+} XRROutputInfo;
+
+XRROutputInfo *
+XRRGetOutputInfo (Display *dpy, XRRScreenResources *resources, RROutput output);
+
+void
+XRRFreeOutputInfo (XRROutputInfo *outputInfo);
+
+Atom *
+XRRListOutputProperties (Display *dpy, RROutput output, int *nprop);
+
+typedef struct {
+    Bool    pending;
+    Bool    range;
+    Bool    immutable;
+    int	    num_values;
+    long    *values;
+} XRRPropertyInfo;
+
+XRRPropertyInfo *
+XRRQueryOutputProperty (Display *dpy, RROutput output, Atom property);
+
+void
+XRRConfigureOutputProperty (Display *dpy, RROutput output, Atom property,
+			    Bool pending, Bool range, int num_values,
+			    long *values);
+
+void
+XRRChangeOutputProperty (Display *dpy, RROutput output,
+			 Atom property, Atom type,
+			 int format, int mode,
+			 _Xconst unsigned char *data, int nelements);
+
+void
+XRRDeleteOutputProperty (Display *dpy, RROutput output, Atom property);
+
+int
+XRRGetOutputProperty (Display *dpy, RROutput output,
+		      Atom property, long offset, long length,
+		      Bool _delete, Bool pending, Atom req_type,
+		      Atom *actual_type, int *actual_format,
+		      unsigned long *nitems, unsigned long *bytes_after,
+		      unsigned char **prop);
+
+XRRModeInfo *
+XRRAllocModeInfo (_Xconst char *name, int nameLength);
+
+RRMode
+XRRCreateMode (Display *dpy, Window window, XRRModeInfo *modeInfo);
+
+void
+XRRDestroyMode (Display *dpy, RRMode mode);
+
+void
+XRRAddOutputMode (Display *dpy, RROutput output, RRMode mode);
+
+void
+XRRDeleteOutputMode (Display *dpy, RROutput output, RRMode mode);
+
+void
+XRRFreeModeInfo (XRRModeInfo *modeInfo);
+
+typedef struct _XRRCrtcInfo {
+    Time	    timestamp;
+    int		    x, y;
+    unsigned int    width, height;
+    RRMode	    mode;
+    Rotation	    rotation;
+    int		    noutput;
+    RROutput	    *outputs;
+    Rotation	    rotations;
+    int		    npossible;
+    RROutput	    *possible;
+} XRRCrtcInfo;
+
+XRRCrtcInfo *
+XRRGetCrtcInfo (Display *dpy, XRRScreenResources *resources, RRCrtc crtc);
+
+void
+XRRFreeCrtcInfo (XRRCrtcInfo *crtcInfo);
+
+Status
+XRRSetCrtcConfig (Display *dpy,
+		  XRRScreenResources *resources,
+		  RRCrtc crtc,
+		  Time timestamp,
+		  int x, int y,
+		  RRMode mode,
+		  Rotation rotation,
+		  RROutput *outputs,
+		  int noutputs);
+
+int
+XRRGetCrtcGammaSize (Display *dpy, RRCrtc crtc);
+
+typedef struct _XRRCrtcGamma {
+    int		    size;
+    unsigned short  *red;
+    unsigned short  *green;
+    unsigned short  *blue;
+} XRRCrtcGamma;
+
+XRRCrtcGamma *
+XRRGetCrtcGamma (Display *dpy, RRCrtc crtc);
+
+XRRCrtcGamma *
+XRRAllocGamma (int size);
+
+void
+XRRSetCrtcGamma (Display *dpy, RRCrtc crtc, XRRCrtcGamma *gamma);
+
+void
+XRRFreeGamma (XRRCrtcGamma *gamma);
+
+/* Version 1.3 additions */
+
+XRRScreenResources *
+XRRGetScreenResourcesCurrent (Display *dpy, Window window);
+
+void
+XRRSetCrtcTransform (Display	*dpy,
+		     RRCrtc	crtc,
+		     XTransform	*transform,
+		     _Xconst char *filter,
+		     XFixed	*params,
+		     int	nparams);
+
+typedef struct _XRRCrtcTransformAttributes {
+    XTransform	pendingTransform;
+    char	*pendingFilter;
+    int		pendingNparams;
+    XFixed	*pendingParams;
+    XTransform	currentTransform;
+    char	*currentFilter;
+    int		currentNparams;
+    XFixed	*currentParams;
+} XRRCrtcTransformAttributes;
+
+/*
+ * Get current crtc transforms and filters.
+ * Pass *attributes to XFree to free
+ */
+Status
+XRRGetCrtcTransform (Display	*dpy,
+		     RRCrtc	crtc,
+		     XRRCrtcTransformAttributes **attributes);
+
+/*
+ * intended to take RRScreenChangeNotify,  or
+ * ConfigureNotify (on the root window)
+ * returns 1 if it is an event type it understands, 0 if not
+ */
+int XRRUpdateConfiguration(XEvent *event);
+
+typedef struct _XRRPanning {
+    Time            timestamp;
+    unsigned int left;
+    unsigned int top;
+    unsigned int width;
+    unsigned int height;
+    unsigned int track_left;
+    unsigned int track_top;
+    unsigned int track_width;
+    unsigned int track_height;
+    int          border_left;
+    int          border_top;
+    int          border_right;
+    int          border_bottom;
+} XRRPanning;
+
+XRRPanning *
+XRRGetPanning (Display *dpy, XRRScreenResources *resources, RRCrtc crtc);
+
+void
+XRRFreePanning (XRRPanning *panning);
+
+Status
+XRRSetPanning (Display *dpy,
+	       XRRScreenResources *resources,
+	       RRCrtc crtc,
+	       XRRPanning *panning);
+
+void
+XRRSetOutputPrimary(Display *dpy,
+		    Window window,
+		    RROutput output);
+
+RROutput
+XRRGetOutputPrimary(Display *dpy,
+		    Window window);
+
+typedef struct _XRRProviderResources {
+    Time timestamp;
+    int nproviders;
+    RRProvider *providers;
+} XRRProviderResources;
+
+XRRProviderResources *
+XRRGetProviderResources(Display *dpy, Window window);
+
+void
+XRRFreeProviderResources(XRRProviderResources *resources);
+
+typedef struct _XRRProviderInfo {
+    unsigned int capabilities;
+    int ncrtcs;
+    RRCrtc	*crtcs;
+    int noutputs;
+    RROutput    *outputs;
+    char	    *name;
+    int nassociatedproviders;
+    RRProvider *associated_providers;
+    unsigned int *associated_capability;
+    int		    nameLen;
+} XRRProviderInfo;
+  
+XRRProviderInfo *
+XRRGetProviderInfo(Display *dpy, XRRScreenResources *resources, RRProvider provider);
+
+void
+XRRFreeProviderInfo(XRRProviderInfo *provider);
+
+int
+XRRSetProviderOutputSource(Display *dpy, XID provider, XID source_provider);
+
+int
+XRRSetProviderOffloadSink(Display *dpy, XID provider, XID sink_provider);
+
+Atom *
+XRRListProviderProperties (Display *dpy, RRProvider provider, int *nprop);
+
+XRRPropertyInfo *
+XRRQueryProviderProperty (Display *dpy, RRProvider provider, Atom property);
+
+void
+XRRConfigureProviderProperty (Display *dpy, RRProvider provider, Atom property,
+			    Bool pending, Bool range, int num_values,
+			    long *values);
+			
+void
+XRRChangeProviderProperty (Display *dpy, RRProvider provider,
+			 Atom property, Atom type,
+			 int format, int mode,
+			 _Xconst unsigned char *data, int nelements);
+
+void
+XRRDeleteProviderProperty (Display *dpy, RRProvider provider, Atom property);
+
+int
+XRRGetProviderProperty (Display *dpy, RRProvider provider,
+			Atom property, long offset, long length,
+			Bool _delete, Bool pending, Atom req_type,
+			Atom *actual_type, int *actual_format,
+			unsigned long *nitems, unsigned long *bytes_after,
+			unsigned char **prop);
+
+
+typedef struct _XRRMonitorInfo {
+    Atom name;
+    Bool primary;
+    Bool automatic;
+    int noutput;
+    int x;
+    int y;
+    int width;
+    int height;
+    int mwidth;
+    int mheight;
+    RROutput *outputs;
+} XRRMonitorInfo;
+
+XRRMonitorInfo *
+XRRAllocateMonitor(Display *dpy, int noutput);
+
+XRRMonitorInfo *
+XRRGetMonitors(Display *dpy, Window window, Bool get_active, int *nmonitors);
+
+void
+XRRSetMonitor(Display *dpy, Window window, XRRMonitorInfo *monitor);
+
+void
+XRRDeleteMonitor(Display *dpy, Window window, Atom name);
+
+void
+XRRFreeMonitors(XRRMonitorInfo *monitors);
+
+_XFUNCPROTOEND
+
+#endif /* _XRANDR_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/Xrender.h b/ThirdParty/X11/Include/X11/extensions/Xrender.h
new file mode 100644
index 0000000000000000000000000000000000000000..1d1cd086ec36ef17ec781bae6593b1ab6387fcf9
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/Xrender.h
@@ -0,0 +1,528 @@
+/*
+ *
+ * Copyright © 2000 SuSE, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of SuSE not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  SuSE makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author:  Keith Packard, SuSE, Inc.
+ */
+
+#ifndef _XRENDER_H_
+#define _XRENDER_H_
+
+#include <X11/Xlib.h>
+#include <X11/Xfuncproto.h>
+#include <X11/Xosdefs.h>
+#include <X11/Xutil.h>
+
+#include <X11/extensions/render.h>
+
+typedef struct {
+    short   red;
+    short   redMask;
+    short   green;
+    short   greenMask;
+    short   blue;
+    short   blueMask;
+    short   alpha;
+    short   alphaMask;
+} XRenderDirectFormat;
+
+typedef struct {
+    PictFormat		id;
+    int			type;
+    int			depth;
+    XRenderDirectFormat	direct;
+    Colormap		colormap;
+} XRenderPictFormat;
+
+#define PictFormatID	    (1 << 0)
+#define PictFormatType	    (1 << 1)
+#define PictFormatDepth	    (1 << 2)
+#define PictFormatRed	    (1 << 3)
+#define PictFormatRedMask   (1 << 4)
+#define PictFormatGreen	    (1 << 5)
+#define PictFormatGreenMask (1 << 6)
+#define PictFormatBlue	    (1 << 7)
+#define PictFormatBlueMask  (1 << 8)
+#define PictFormatAlpha	    (1 << 9)
+#define PictFormatAlphaMask (1 << 10)
+#define PictFormatColormap  (1 << 11)
+
+typedef struct _XRenderPictureAttributes {
+    int 		repeat;
+    Picture		alpha_map;
+    int			alpha_x_origin;
+    int			alpha_y_origin;
+    int			clip_x_origin;
+    int			clip_y_origin;
+    Pixmap		clip_mask;
+    Bool		graphics_exposures;
+    int			subwindow_mode;
+    int			poly_edge;
+    int			poly_mode;
+    Atom		dither;
+    Bool		component_alpha;
+} XRenderPictureAttributes;
+
+typedef struct {
+    unsigned short   red;
+    unsigned short   green;
+    unsigned short   blue;
+    unsigned short   alpha;
+} XRenderColor;
+
+typedef struct _XGlyphInfo {
+    unsigned short  width;
+    unsigned short  height;
+    short	    x;
+    short	    y;
+    short	    xOff;
+    short	    yOff;
+} XGlyphInfo;
+
+typedef struct _XGlyphElt8 {
+    GlyphSet		    glyphset;
+    _Xconst char	    *chars;
+    int			    nchars;
+    int			    xOff;
+    int			    yOff;
+} XGlyphElt8;
+
+typedef struct _XGlyphElt16 {
+    GlyphSet		    glyphset;
+    _Xconst unsigned short  *chars;
+    int			    nchars;
+    int			    xOff;
+    int			    yOff;
+} XGlyphElt16;
+
+typedef struct _XGlyphElt32 {
+    GlyphSet		    glyphset;
+    _Xconst unsigned int    *chars;
+    int			    nchars;
+    int			    xOff;
+    int			    yOff;
+} XGlyphElt32;
+
+typedef double	XDouble;
+
+typedef struct _XPointDouble {
+    XDouble  x, y;
+} XPointDouble;
+
+#define XDoubleToFixed(f)    ((XFixed) ((f) * 65536))
+#define XFixedToDouble(f)    (((XDouble) (f)) / 65536)
+
+typedef int XFixed;
+
+typedef struct _XPointFixed {
+    XFixed  x, y;
+} XPointFixed;
+
+typedef struct _XLineFixed {
+    XPointFixed	p1, p2;
+} XLineFixed;
+
+typedef struct _XTriangle {
+    XPointFixed	p1, p2, p3;
+} XTriangle;
+
+typedef struct _XCircle {
+    XFixed x;
+    XFixed y;
+    XFixed radius;
+} XCircle;
+
+typedef struct _XTrapezoid {
+    XFixed  top, bottom;
+    XLineFixed	left, right;
+} XTrapezoid;
+
+typedef struct _XTransform {
+    XFixed  matrix[3][3];
+} XTransform;
+
+typedef struct _XFilters {
+    int	    nfilter;
+    char    **filter;
+    int	    nalias;
+    short   *alias;
+} XFilters;
+
+typedef struct _XIndexValue {
+    unsigned long    pixel;
+    unsigned short   red, green, blue, alpha;
+} XIndexValue;
+
+typedef struct _XAnimCursor {
+    Cursor	    cursor;
+    unsigned long   delay;
+} XAnimCursor;
+
+typedef struct _XSpanFix {
+    XFixed	    left, right, y;
+} XSpanFix;
+
+typedef struct _XTrap {
+    XSpanFix	    top, bottom;
+} XTrap;
+
+typedef struct _XLinearGradient {
+    XPointFixed p1;
+    XPointFixed p2;
+} XLinearGradient;
+
+typedef struct _XRadialGradient {
+    XCircle inner;
+    XCircle outer;
+} XRadialGradient;
+
+typedef struct _XConicalGradient {
+    XPointFixed center;
+    XFixed angle; /* in degrees */
+} XConicalGradient;
+
+_XFUNCPROTOBEGIN
+
+Bool XRenderQueryExtension (Display *dpy, int *event_basep, int *error_basep);
+
+Status XRenderQueryVersion (Display *dpy,
+			    int     *major_versionp,
+			    int     *minor_versionp);
+
+Status XRenderQueryFormats (Display *dpy);
+
+int XRenderQuerySubpixelOrder (Display *dpy, int screen);
+
+Bool XRenderSetSubpixelOrder (Display *dpy, int screen, int subpixel);
+
+XRenderPictFormat *
+XRenderFindVisualFormat (Display *dpy, _Xconst Visual *visual);
+
+XRenderPictFormat *
+XRenderFindFormat (Display			*dpy,
+		   unsigned long		mask,
+		   _Xconst XRenderPictFormat	*templ,
+		   int				count);
+
+#define PictStandardARGB32  0
+#define PictStandardRGB24   1
+#define PictStandardA8	    2
+#define PictStandardA4	    3
+#define PictStandardA1	    4
+#define PictStandardNUM	    5
+
+XRenderPictFormat *
+XRenderFindStandardFormat (Display		*dpy,
+			   int			format);
+
+XIndexValue *
+XRenderQueryPictIndexValues(Display			*dpy,
+			    _Xconst XRenderPictFormat	*format,
+			    int				*num);
+
+Picture
+XRenderCreatePicture (Display				*dpy,
+		      Drawable				drawable,
+		      _Xconst XRenderPictFormat		*format,
+		      unsigned long			valuemask,
+		      _Xconst XRenderPictureAttributes	*attributes);
+
+void
+XRenderChangePicture (Display				*dpy,
+		      Picture				picture,
+		      unsigned long			valuemask,
+		      _Xconst XRenderPictureAttributes  *attributes);
+
+void
+XRenderSetPictureClipRectangles (Display	    *dpy,
+				 Picture	    picture,
+				 int		    xOrigin,
+				 int		    yOrigin,
+				 _Xconst XRectangle *rects,
+				 int		    n);
+
+void
+XRenderSetPictureClipRegion (Display	    *dpy,
+			     Picture	    picture,
+			     Region	    r);
+
+void
+XRenderSetPictureTransform (Display	    *dpy,
+			    Picture	    picture,
+			    XTransform	    *transform);
+
+void
+XRenderFreePicture (Display                   *dpy,
+		    Picture                   picture);
+
+void
+XRenderComposite (Display   *dpy,
+		  int	    op,
+		  Picture   src,
+		  Picture   mask,
+		  Picture   dst,
+		  int	    src_x,
+		  int	    src_y,
+		  int	    mask_x,
+		  int	    mask_y,
+		  int	    dst_x,
+		  int	    dst_y,
+		  unsigned int	width,
+		  unsigned int	height);
+
+GlyphSet
+XRenderCreateGlyphSet (Display *dpy, _Xconst XRenderPictFormat *format);
+
+GlyphSet
+XRenderReferenceGlyphSet (Display *dpy, GlyphSet existing);
+
+void
+XRenderFreeGlyphSet (Display *dpy, GlyphSet glyphset);
+
+void
+XRenderAddGlyphs (Display		*dpy,
+		  GlyphSet		glyphset,
+		  _Xconst Glyph		*gids,
+		  _Xconst XGlyphInfo	*glyphs,
+		  int			nglyphs,
+		  _Xconst char		*images,
+		  int			nbyte_images);
+
+void
+XRenderFreeGlyphs (Display	    *dpy,
+		   GlyphSet	    glyphset,
+		   _Xconst Glyph    *gids,
+		   int		    nglyphs);
+
+void
+XRenderCompositeString8 (Display		    *dpy,
+			 int			    op,
+			 Picture		    src,
+			 Picture		    dst,
+			 _Xconst XRenderPictFormat  *maskFormat,
+			 GlyphSet		    glyphset,
+			 int			    xSrc,
+			 int			    ySrc,
+			 int			    xDst,
+			 int			    yDst,
+			 _Xconst char		    *string,
+			 int			    nchar);
+
+void
+XRenderCompositeString16 (Display		    *dpy,
+			  int			    op,
+			  Picture		    src,
+			  Picture		    dst,
+			  _Xconst XRenderPictFormat *maskFormat,
+			  GlyphSet		    glyphset,
+			  int			    xSrc,
+			  int			    ySrc,
+			  int			    xDst,
+			  int			    yDst,
+			  _Xconst unsigned short    *string,
+			  int			    nchar);
+
+void
+XRenderCompositeString32 (Display		    *dpy,
+			  int			    op,
+			  Picture		    src,
+			  Picture		    dst,
+			  _Xconst XRenderPictFormat *maskFormat,
+			  GlyphSet		    glyphset,
+			  int			    xSrc,
+			  int			    ySrc,
+			  int			    xDst,
+			  int			    yDst,
+			  _Xconst unsigned int	    *string,
+			  int			    nchar);
+
+void
+XRenderCompositeText8 (Display			    *dpy,
+		       int			    op,
+		       Picture			    src,
+		       Picture			    dst,
+		       _Xconst XRenderPictFormat    *maskFormat,
+		       int			    xSrc,
+		       int			    ySrc,
+		       int			    xDst,
+		       int			    yDst,
+		       _Xconst XGlyphElt8	    *elts,
+		       int			    nelt);
+
+void
+XRenderCompositeText16 (Display			    *dpy,
+			int			    op,
+			Picture			    src,
+			Picture			    dst,
+			_Xconst XRenderPictFormat   *maskFormat,
+			int			    xSrc,
+			int			    ySrc,
+			int			    xDst,
+			int			    yDst,
+			_Xconst XGlyphElt16	    *elts,
+			int			    nelt);
+
+void
+XRenderCompositeText32 (Display			    *dpy,
+			int			    op,
+			Picture			    src,
+			Picture			    dst,
+			_Xconst XRenderPictFormat   *maskFormat,
+			int			    xSrc,
+			int			    ySrc,
+			int			    xDst,
+			int			    yDst,
+			_Xconst XGlyphElt32	    *elts,
+			int			    nelt);
+
+void
+XRenderFillRectangle (Display		    *dpy,
+		      int		    op,
+		      Picture		    dst,
+		      _Xconst XRenderColor  *color,
+		      int		    x,
+		      int		    y,
+		      unsigned int	    width,
+		      unsigned int	    height);
+
+void
+XRenderFillRectangles (Display		    *dpy,
+		       int		    op,
+		       Picture		    dst,
+		       _Xconst XRenderColor *color,
+		       _Xconst XRectangle   *rectangles,
+		       int		    n_rects);
+
+void
+XRenderCompositeTrapezoids (Display		*dpy,
+			    int			op,
+			    Picture		src,
+			    Picture		dst,
+			    _Xconst XRenderPictFormat	*maskFormat,
+			    int			xSrc,
+			    int			ySrc,
+			    _Xconst XTrapezoid	*traps,
+			    int			ntrap);
+
+void
+XRenderCompositeTriangles (Display		*dpy,
+			   int			op,
+			   Picture		src,
+			   Picture		dst,
+			    _Xconst XRenderPictFormat	*maskFormat,
+			   int			xSrc,
+			   int			ySrc,
+			   _Xconst XTriangle	*triangles,
+			   int			ntriangle);
+
+void
+XRenderCompositeTriStrip (Display		*dpy,
+			  int			op,
+			  Picture		src,
+			  Picture		dst,
+			    _Xconst XRenderPictFormat	*maskFormat,
+			  int			xSrc,
+			  int			ySrc,
+			  _Xconst XPointFixed	*points,
+			  int			npoint);
+
+void
+XRenderCompositeTriFan (Display			*dpy,
+			int			op,
+			Picture			src,
+			Picture			dst,
+			_Xconst XRenderPictFormat	*maskFormat,
+			int			xSrc,
+			int			ySrc,
+			_Xconst XPointFixed	*points,
+			int			npoint);
+
+void
+XRenderCompositeDoublePoly (Display		    *dpy,
+			    int			    op,
+			    Picture		    src,
+			    Picture		    dst,
+			    _Xconst XRenderPictFormat	*maskFormat,
+			    int			    xSrc,
+			    int			    ySrc,
+			    int			    xDst,
+			    int			    yDst,
+			    _Xconst XPointDouble    *fpoints,
+			    int			    npoints,
+			    int			    winding);
+Status
+XRenderParseColor(Display	*dpy,
+		  char		*spec,
+		  XRenderColor	*def);
+
+Cursor
+XRenderCreateCursor (Display	    *dpy,
+		     Picture	    source,
+		     unsigned int   x,
+		     unsigned int   y);
+
+XFilters *
+XRenderQueryFilters (Display *dpy, Drawable drawable);
+
+void
+XRenderSetPictureFilter (Display    *dpy,
+			 Picture    picture,
+			 const char *filter,
+			 XFixed	    *params,
+			 int	    nparams);
+
+Cursor
+XRenderCreateAnimCursor (Display	*dpy,
+			 int		ncursor,
+			 XAnimCursor	*cursors);
+
+
+void
+XRenderAddTraps (Display	    *dpy,
+		 Picture	    picture,
+		 int		    xOff,
+		 int		    yOff,
+		 _Xconst XTrap	    *traps,
+		 int		    ntrap);
+
+Picture XRenderCreateSolidFill (Display *dpy,
+                                const XRenderColor *color);
+
+Picture XRenderCreateLinearGradient (Display *dpy,
+                                     const XLinearGradient *gradient,
+                                     const XFixed *stops,
+                                     const XRenderColor *colors,
+                                     int nstops);
+
+Picture XRenderCreateRadialGradient (Display *dpy,
+                                     const XRadialGradient *gradient,
+                                     const XFixed *stops,
+                                     const XRenderColor *colors,
+                                     int nstops);
+
+Picture XRenderCreateConicalGradient (Display *dpy,
+                                      const XConicalGradient *gradient,
+                                      const XFixed *stops,
+                                      const XRenderColor *colors,
+                                      int nstops);
+
+_XFUNCPROTOEND
+
+#endif /* _XRENDER_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/Xv.h b/ThirdParty/X11/Include/X11/extensions/Xv.h
new file mode 100644
index 0000000000000000000000000000000000000000..f662df6aeb7e4522e3a743680e40a7285440302a
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/Xv.h
@@ -0,0 +1,128 @@
+/***********************************************************
+Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
+and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Digital or MIT not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef XV_H
+#define XV_H
+/*
+** File:
+**
+**   Xv.h --- Xv shared library and server header file
+**
+** Author:
+**
+**   David Carver (Digital Workstation Engineering/Project Athena)
+**
+** Revisions:
+**
+**   05.15.91 Carver
+**     - version 2.0 upgrade
+**
+**   01.24.91 Carver
+**     - version 1.4 upgrade
+**
+*/
+
+#include <X11/X.h>
+
+#define XvName "XVideo"
+#define XvVersion 2
+#define XvRevision 2
+
+/* Symbols */
+
+typedef XID XvPortID;
+typedef XID XvEncodingID;
+
+#define XvNone 0
+
+#define XvInput          0
+#define XvOutput         1
+
+#define XvInputMask      (1<<XvInput)
+#define XvOutputMask     (1<<XvOutput)
+#define XvVideoMask	 0x00000004
+#define XvStillMask	 0x00000008
+#define XvImageMask	 0x00000010
+
+/* These two are not client viewable */
+#define XvPixmapMask	 0x00010000
+#define XvWindowMask	 0x00020000
+
+
+#define XvGettable	0x01
+#define XvSettable	0x02
+
+#define XvRGB		0
+#define XvYUV		1
+
+#define XvPacked	0
+#define XvPlanar	1
+
+#define XvTopToBottom	0
+#define XvBottomToTop	1
+
+
+/* Events */
+
+#define XvVideoNotify 0
+#define XvPortNotify 1
+#define XvNumEvents 2
+
+/* Video Notify Reasons */
+
+#define XvStarted 0
+#define XvStopped 1
+#define XvBusy 2
+#define XvPreempted 3
+#define XvHardError 4
+#define XvLastReason 4
+
+#define XvNumReasons (XvLastReason + 1)
+
+#define XvStartedMask     (1<<XvStarted)
+#define XvStoppedMask     (1<<XvStopped)
+#define XvBusyMask        (1<<XvBusy)
+#define XvPreemptedMask   (1<<XvPreempted)
+#define XvHardErrorMask   (1<<XvHardError)
+
+#define XvAnyReasonMask   ((1<<XvNumReasons) - 1)
+#define XvNoReasonMask    0
+
+/* Errors */
+
+#define XvBadPort 0
+#define XvBadEncoding 1
+#define XvBadControl 2
+#define XvNumErrors 3
+
+/* Status */
+
+#define XvBadExtension 1
+#define XvAlreadyGrabbed 2
+#define XvInvalidTime 3
+#define XvBadReply 4
+#define XvBadAlloc 5
+
+#endif /* XV_H */
+
diff --git a/ThirdParty/X11/Include/X11/extensions/XvMC.h b/ThirdParty/X11/Include/X11/extensions/XvMC.h
new file mode 100644
index 0000000000000000000000000000000000000000..47cc6dbbc3274ad420458a74cd3038fbd7bab344
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XvMC.h
@@ -0,0 +1,138 @@
+#ifndef _XVMC_H_
+#define _XVMC_H_
+
+#include <X11/X.h>
+#include <X11/extensions/Xv.h>
+
+#define XvMCName "XVideo-MotionCompensation"
+#define XvMCNumEvents 0
+#define XvMCNumErrors 3
+#define XvMCVersion 1
+#define XvMCRevision 1
+
+#define XvMCBadContext          0
+#define XvMCBadSurface          1
+#define XvMCBadSubpicture       2
+
+/* Chroma formats */
+#define XVMC_CHROMA_FORMAT_420          0x00000001
+#define XVMC_CHROMA_FORMAT_422          0x00000002
+#define XVMC_CHROMA_FORMAT_444          0x00000003
+
+/* XvMCSurfaceInfo Flags */
+#define XVMC_OVERLAID_SURFACE                   0x00000001
+#define XVMC_BACKEND_SUBPICTURE                 0x00000002
+#define XVMC_SUBPICTURE_INDEPENDENT_SCALING     0x00000004
+#define XVMC_INTRA_UNSIGNED                     0x00000008
+
+/* Motion Compensation types */
+#define XVMC_MOCOMP                     0x00000000
+#define XVMC_IDCT                       0x00010000
+
+#define XVMC_MPEG_1                     0x00000001
+#define XVMC_MPEG_2                     0x00000002
+#define XVMC_H263                       0x00000003
+#define XVMC_MPEG_4                     0x00000004
+
+#define XVMC_MB_TYPE_MOTION_FORWARD     0x02
+#define XVMC_MB_TYPE_MOTION_BACKWARD    0x04
+#define XVMC_MB_TYPE_PATTERN            0x08
+#define XVMC_MB_TYPE_INTRA              0x10
+
+#define XVMC_PREDICTION_FIELD           0x01
+#define XVMC_PREDICTION_FRAME           0x02
+#define XVMC_PREDICTION_DUAL_PRIME      0x03
+#define XVMC_PREDICTION_16x8            0x02
+#define XVMC_PREDICTION_4MV             0x04
+
+#define XVMC_SELECT_FIRST_FORWARD       0x01
+#define XVMC_SELECT_FIRST_BACKWARD      0x02
+#define XVMC_SELECT_SECOND_FORWARD      0x04
+#define XVMC_SELECT_SECOND_BACKWARD     0x08
+
+#define XVMC_DCT_TYPE_FRAME             0x00
+#define XVMC_DCT_TYPE_FIELD             0x01
+
+#define XVMC_TOP_FIELD          0x00000001
+#define XVMC_BOTTOM_FIELD       0x00000002
+#define XVMC_FRAME_PICTURE      (XVMC_TOP_FIELD | XVMC_BOTTOM_FIELD)
+
+#define XVMC_SECOND_FIELD       0x00000004
+
+#define XVMC_DIRECT             0x00000001
+
+#define XVMC_RENDERING          0x00000001
+#define XVMC_DISPLAYING         0x00000002
+
+
+typedef struct {
+   int surface_type_id;
+   int chroma_format;
+   unsigned short max_width;
+   unsigned short max_height;
+   unsigned short subpicture_max_width;
+   unsigned short subpicture_max_height;
+   int mc_type;
+   int flags;
+} XvMCSurfaceInfo;
+
+typedef struct {
+   XID context_id;
+   int surface_type_id;
+   unsigned short width;
+   unsigned short height;
+   XvPortID port;
+   int flags;
+   void * privData;  /* private to the library */
+} XvMCContext;
+
+typedef struct {
+  XID surface_id;
+  XID context_id;
+  int surface_type_id;
+  unsigned short width;
+  unsigned short height;
+  void *privData;  /* private to the library */
+} XvMCSurface;
+
+typedef struct {
+  XID subpicture_id;
+  XID context_id;
+  int xvimage_id;
+  unsigned short width;
+  unsigned short height;
+  int num_palette_entries;
+  int entry_bytes;
+  char component_order[4];
+  void *privData;    /* private to the library */
+} XvMCSubpicture;
+
+typedef struct {
+  unsigned int num_blocks;
+  XID context_id;
+  void *privData;
+  short *blocks;
+} XvMCBlockArray;
+
+typedef struct {
+   unsigned short x;
+   unsigned short y;
+   unsigned char macroblock_type;
+   unsigned char motion_type;
+   unsigned char motion_vertical_field_select;
+   unsigned char dct_type;
+   short PMV[2][2][2];
+   unsigned int index;
+   unsigned short coded_block_pattern;
+   unsigned short pad0;
+} XvMCMacroBlock;
+
+
+typedef struct {
+  unsigned int num_blocks;
+  XID context_id;
+  void *privData;
+  XvMCMacroBlock *macro_blocks;
+} XvMCMacroBlockArray;
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/XvMCproto.h b/ThirdParty/X11/Include/X11/extensions/XvMCproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..43ec688b9eb565a1fc0b9e264015fe80b1bd0bf0
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/XvMCproto.h
@@ -0,0 +1,226 @@
+#ifndef _XVMCPROTO_H_
+#define _XVMCPROTO_H_
+
+#define xvmc_QueryVersion		0
+#define xvmc_ListSurfaceTypes		1
+#define xvmc_CreateContext		2
+#define xvmc_DestroyContext		3
+#define xvmc_CreateSurface		4
+#define xvmc_DestroySurface		5
+#define xvmc_CreateSubpicture		6
+#define xvmc_DestroySubpicture		7
+#define xvmc_ListSubpictureTypes	8
+#define xvmc_GetDRInfo                  9
+#define xvmc_LastRequest		xvmc_GetDRInfo
+
+#define xvmcNumRequest			(xvmc_LastRequest + 1)
+
+
+typedef struct {
+  CARD32 surface_type_id B32;
+  CARD16 chroma_format B16;
+  CARD16 pad0 B16;
+  CARD16 max_width B16;
+  CARD16 max_height B16;
+  CARD16 subpicture_max_width B16;
+  CARD16 subpicture_max_height B16;
+  CARD32 mc_type B32;
+  CARD32 flags B32;
+} xvmcSurfaceInfo;
+#define sz_xvmcSurfaceInfo 24;
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvmcReqType;
+  CARD16 length B16;
+} xvmcQueryVersionReq;
+#define sz_xvmcQueryVersionReq 4;
+
+typedef struct {
+  BYTE type;  /* X_Reply */
+  BYTE padb1;
+  CARD16 sequenceNumber B16;
+  CARD32 length B32;
+  CARD32 major B32;
+  CARD32 minor B32;
+  CARD32 padl4 B32;
+  CARD32 padl5 B32;
+  CARD32 padl6 B32;
+  CARD32 padl7 B32;
+} xvmcQueryVersionReply;
+#define sz_xvmcQueryVersionReply 32
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvmcReqType;
+  CARD16 length B16;
+  CARD32 port B32;
+} xvmcListSurfaceTypesReq;
+#define sz_xvmcListSurfaceTypesReq 8;
+
+typedef struct {
+  BYTE type;  /* X_Reply */
+  BYTE padb1;
+  CARD16 sequenceNumber B16;
+  CARD32 length B32;
+  CARD32 num   B32;
+  CARD32 padl3 B32;
+  CARD32 padl4 B32;
+  CARD32 padl5 B32;
+  CARD32 padl6 B32;
+  CARD32 padl7 B32;
+} xvmcListSurfaceTypesReply;
+#define sz_xvmcListSurfaceTypesReply 32
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvmcReqType;
+  CARD16 length B16;
+  CARD32 context_id B32;
+  CARD32 port B32;
+  CARD32 surface_type_id B32;
+  CARD16 width B16;
+  CARD16 height B16;
+  CARD32 flags B32;
+} xvmcCreateContextReq;
+#define sz_xvmcCreateContextReq 24;
+
+typedef struct {
+  BYTE type;  /* X_Reply */
+  BYTE padb1;
+  CARD16 sequenceNumber B16;
+  CARD32 length B32;
+  CARD16 width_actual B16;
+  CARD16 height_actual B16;
+  CARD32 flags_return B32;
+  CARD32 padl4 B32;
+  CARD32 padl5 B32;
+  CARD32 padl6 B32;
+  CARD32 padl7 B32;
+} xvmcCreateContextReply;
+#define sz_xvmcCreateContextReply 32
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvmcReqType;
+  CARD16 length B16;
+  CARD32 context_id B32;
+} xvmcDestroyContextReq;
+#define sz_xvmcDestroyContextReq 8;
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvmcReqType;
+  CARD16 length B16;
+  CARD32 surface_id B32;
+  CARD32 context_id B32;
+} xvmcCreateSurfaceReq;
+#define sz_xvmcCreateSurfaceReq 12;
+
+typedef struct {
+  BYTE type;  /* X_Reply */
+  BYTE padb1;
+  CARD16 sequenceNumber B16;
+  CARD32 length B32;
+  CARD32 padl2 B32;
+  CARD32 padl3 B32;
+  CARD32 padl4 B32;
+  CARD32 padl5 B32;
+  CARD32 padl6 B32;
+  CARD32 padl7 B32;
+} xvmcCreateSurfaceReply;
+#define sz_xvmcCreateSurfaceReply 32
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvmcReqType;
+  CARD16 length B16;
+  CARD32 surface_id B32;
+} xvmcDestroySurfaceReq;
+#define sz_xvmcDestroySurfaceReq 8;
+
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvmcReqType;
+  CARD16 length B16;
+  CARD32 subpicture_id B32;
+  CARD32 context_id B32;
+  CARD32 xvimage_id B32;
+  CARD16 width B16;
+  CARD16 height B16;
+} xvmcCreateSubpictureReq;
+#define sz_xvmcCreateSubpictureReq 20;
+
+typedef struct {
+  BYTE type;  /* X_Reply */
+  BYTE padb1;
+  CARD16 sequenceNumber B16;
+  CARD32 length B32;
+  CARD16 width_actual B16;
+  CARD16 height_actual B16;
+  CARD16 num_palette_entries B16;
+  CARD16 entry_bytes B16;
+  CARD8  component_order[4];
+  CARD32 padl5 B32;
+  CARD32 padl6 B32;
+  CARD32 padl7 B32;
+} xvmcCreateSubpictureReply;
+#define sz_xvmcCreateSubpictureReply 32
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvmcReqType;
+  CARD16 length B16;
+  CARD32 subpicture_id B32;
+} xvmcDestroySubpictureReq;
+#define sz_xvmcDestroySubpictureReq 8;
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvmcReqType;
+  CARD16 length B16;
+  CARD32 port B32;
+  CARD32 surface_type_id B32;
+} xvmcListSubpictureTypesReq;
+#define sz_xvmcListSubpictureTypesReq 12;
+
+typedef struct {
+  BYTE type;  /* X_Reply */
+  BYTE padb1;
+  CARD16 sequenceNumber B16;
+  CARD32 length B32;
+  CARD32 num B32;
+  CARD32 padl2 B32;
+  CARD32 padl3 B32;
+  CARD32 padl4 B32;
+  CARD32 padl5 B32;
+  CARD32 padl6 B32;
+} xvmcListSubpictureTypesReply;
+#define sz_xvmcListSubpictureTypesReply 32
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvmcReqType;
+  CARD16 length B16;
+  CARD32 port B32;
+  CARD32 shmKey B32;
+  CARD32 magic B32;
+} xvmcGetDRInfoReq;
+#define sz_xvmcGetDRInfoReq 16;
+
+typedef struct {
+  BYTE type;  /* X_Reply */
+  BYTE padb1;
+  CARD16 sequenceNumber B16;
+  CARD32 length B32;
+  CARD32 major B32;
+  CARD32 minor B32;
+  CARD32 patchLevel B32;
+  CARD32 nameLen B32;
+  CARD32 busIDLen B32;
+  CARD32 isLocal B32;
+} xvmcGetDRInfoReply;
+#define sz_xvmcGetDRInfoReply 32
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/Xvlib.h b/ThirdParty/X11/Include/X11/extensions/Xvlib.h
new file mode 100644
index 0000000000000000000000000000000000000000..32b98bff7cfe6a4dd5b701deba2f1b759db83dd8
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/Xvlib.h
@@ -0,0 +1,382 @@
+/***********************************************************
+Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
+and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Digital or MIT not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef XVLIB_H
+#define XVLIB_H
+/*
+** File:
+**
+**   Xvlib.h --- Xv library public header file
+**
+** Author:
+**
+**   David Carver (Digital Workstation Engineering/Project Athena)
+**
+** Revisions:
+**
+**   26.06.91 Carver
+**     - changed XvFreeAdaptors to XvFreeAdaptorInfo
+**     - changed XvFreeEncodings to XvFreeEncodingInfo
+**
+**   11.06.91 Carver
+**     - changed SetPortControl to SetPortAttribute
+**     - changed GetPortControl to GetPortAttribute
+**     - changed QueryBestSize
+**
+**   05.15.91 Carver
+**     - version 2.0 upgrade
+**
+**   01.24.91 Carver
+**     - version 1.4 upgrade
+**
+*/
+
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/Xv.h>
+#include <X11/extensions/XShm.h>
+
+typedef struct {
+    int numerator;
+    int denominator;
+} XvRational;
+
+typedef struct {
+    int flags;                  /* XvGettable, XvSettable */
+    int min_value;
+    int max_value;
+    char *name;
+} XvAttribute;
+
+typedef struct {
+    XvEncodingID encoding_id;
+    char *name;
+    unsigned long width;
+    unsigned long height;
+    XvRational rate;
+    unsigned long num_encodings;
+} XvEncodingInfo;
+
+typedef struct {
+    char depth;
+    unsigned long visual_id;
+} XvFormat;
+
+typedef struct {
+    XvPortID base_id;
+    unsigned long num_ports;
+    char type;
+    char *name;
+    unsigned long num_formats;
+    XvFormat *formats;
+    unsigned long num_adaptors;
+} XvAdaptorInfo;
+
+typedef struct {
+    int type;
+    unsigned long serial;       /* # of last request processed by server */
+    Bool send_event;            /* true if this came from a SendEvent request */
+    Display *display;           /* Display the event was read from */
+    Drawable drawable;          /* drawable */
+    unsigned long reason;       /* what generated this event */
+    XvPortID port_id;           /* what port */
+    Time time;                  /* milliseconds */
+} XvVideoNotifyEvent;
+
+typedef struct {
+    int type;
+    unsigned long serial;       /* # of last request processed by server */
+    Bool send_event;            /* true if this came from a SendEvent request */
+    Display *display;           /* Display the event was read from */
+    XvPortID port_id;           /* what port */
+    Time time;                  /* milliseconds */
+    Atom attribute;             /* atom that identifies attribute */
+    long value;                 /* value of attribute */
+} XvPortNotifyEvent;
+
+typedef union {
+    int type;
+    XvVideoNotifyEvent xvvideo;
+    XvPortNotifyEvent xvport;
+    long pad[24];
+} XvEvent;
+
+typedef struct {
+    int id;                     /* Unique descriptor for the format */
+    int type;                   /* XvRGB, XvYUV */
+    int byte_order;             /* LSBFirst, MSBFirst */
+    char guid[16];              /* Globally Unique IDentifier */
+    int bits_per_pixel;
+    int format;                 /* XvPacked, XvPlanar */
+    int num_planes;
+
+    /* for RGB formats only */
+    int depth;
+    unsigned int red_mask;
+    unsigned int green_mask;
+    unsigned int blue_mask;
+
+    /* for YUV formats only */
+    unsigned int y_sample_bits;
+    unsigned int u_sample_bits;
+    unsigned int v_sample_bits;
+    unsigned int horz_y_period;
+    unsigned int horz_u_period;
+    unsigned int horz_v_period;
+    unsigned int vert_y_period;
+    unsigned int vert_u_period;
+    unsigned int vert_v_period;
+    char component_order[32];   /* eg. UYVY */
+    int scanline_order;         /* XvTopToBottom, XvBottomToTop */
+} XvImageFormatValues;
+
+typedef struct {
+    int id;
+    int width, height;
+    int data_size;              /* bytes */
+    int num_planes;
+    int *pitches;               /* bytes */
+    int *offsets;               /* bytes */
+    char *data;
+    XPointer obdata;
+} XvImage;
+
+_XFUNCPROTOBEGIN
+
+extern int XvQueryExtension(
+    Display *                   /* display */,
+    unsigned int *              /* p_version */,
+    unsigned int *              /* p_revision */,
+    unsigned int *              /* p_requestBase */,
+    unsigned int *              /* p_eventBase */,
+    unsigned int *              /* p_errorBase */
+);
+
+extern int XvQueryAdaptors(
+    Display *                   /* display */,
+    Window                      /* window */,
+    unsigned int *              /* p_nAdaptors */,
+    XvAdaptorInfo **            /* p_pAdaptors */
+);
+
+extern int XvQueryEncodings(
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    unsigned int *              /* p_nEncoding */,
+    XvEncodingInfo **           /* p_pEncoding */
+);
+
+extern int XvPutVideo(
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    Drawable                    /* d */,
+    GC                          /* gc */,
+    int                         /* vx */,
+    int                         /* vy */,
+    unsigned int                /* vw */,
+    unsigned int                /* vh */,
+    int                         /* dx */,
+    int                         /* dy */,
+    unsigned int                /* dw */,
+    unsigned int                /* dh */
+);
+
+extern int XvPutStill(
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    Drawable                    /* d */,
+    GC                          /* gc */,
+    int                         /* vx */,
+    int                         /* vy */,
+    unsigned int                /* vw */,
+    unsigned int                /* vh */,
+    int                         /* dx */,
+    int                         /* dy */,
+    unsigned int                /* dw */,
+    unsigned int                /* dh */
+);
+
+extern int XvGetVideo(
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    Drawable                    /* d */,
+    GC                          /* gc */,
+    int                         /* vx */,
+    int                         /* vy */,
+    unsigned int                /* vw */,
+    unsigned int                /* vh */,
+    int                         /* dx */,
+    int                         /* dy */,
+    unsigned int                /* dw */,
+    unsigned int                /* dh */
+);
+
+extern int XvGetStill(
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    Drawable                    /* d */,
+    GC                          /* gc */,
+    int                         /* vx */,
+    int                         /* vy */,
+    unsigned int                /* vw */,
+    unsigned int                /* vh */,
+    int                         /* dx */,
+    int                         /* dy */,
+    unsigned int                /* dw */,
+    unsigned int                /* dh */
+);
+
+extern int XvStopVideo(
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    Drawable                    /* drawable */
+);
+
+extern int XvGrabPort(
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    Time                        /* time */
+);
+
+extern int XvUngrabPort(
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    Time                        /* time */
+);
+
+extern int XvSelectVideoNotify(
+    Display *                   /* display */,
+    Drawable                    /* drawable */,
+    Bool                        /* onoff */
+);
+
+extern int XvSelectPortNotify(
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    Bool                        /* onoff */
+);
+
+extern int XvSetPortAttribute(
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    Atom                        /* attribute */,
+    int                         /* value */
+);
+
+extern int XvGetPortAttribute(
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    Atom                        /* attribute */,
+    int *                       /* p_value */
+);
+
+extern int XvQueryBestSize(
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    Bool                        /* motion */,
+    unsigned int                /* vid_w */,
+    unsigned int                /* vid_h */,
+    unsigned int                /* drw_w */,
+    unsigned int                /* drw_h */,
+    unsigned int *              /* p_actual_width */,
+    unsigned int *              /* p_actual_width */
+);
+
+extern XvAttribute *XvQueryPortAttributes(
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    int *                       /* number */
+);
+
+
+extern void XvFreeAdaptorInfo(
+    XvAdaptorInfo *             /* adaptors */
+);
+
+extern void XvFreeEncodingInfo(
+    XvEncodingInfo *            /* encodings */
+);
+
+
+extern XvImageFormatValues *XvListImageFormats (
+    Display     *display,
+    XvPortID    port_id,
+    int         *count_return
+);
+
+extern XvImage *XvCreateImage (
+    Display *display,
+    XvPortID port,
+    int id,
+    char *data,
+    int width,
+    int height
+);
+
+extern int XvPutImage (
+    Display *display,
+    XvPortID id,
+    Drawable d,
+    GC gc,
+    XvImage *image,
+    int src_x,
+    int src_y,
+    unsigned int src_w,
+    unsigned int src_h,
+    int dest_x,
+    int dest_y,
+    unsigned int dest_w,
+    unsigned int dest_h
+);
+
+extern int XvShmPutImage (
+    Display *display,
+    XvPortID id,
+    Drawable d,
+    GC gc,
+    XvImage *image,
+    int src_x,
+    int src_y,
+    unsigned int src_w,
+    unsigned int src_h,
+    int dest_x,
+    int dest_y,
+    unsigned int dest_w,
+    unsigned int dest_h,
+    Bool send_event
+);
+
+extern XvImage *XvShmCreateImage (
+    Display *display,
+    XvPortID port,
+    int id,
+    char *data,
+    int width,
+    int height,
+    XShmSegmentInfo *shminfo
+);
+
+
+_XFUNCPROTOEND
+
+#endif /* XVLIB_H */
diff --git a/ThirdParty/X11/Include/X11/extensions/Xvproto.h b/ThirdParty/X11/Include/X11/extensions/Xvproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..94bd9cc669c20f54193a85a7063b8bbac867093c
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/Xvproto.h
@@ -0,0 +1,603 @@
+/***********************************************************
+Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
+and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Digital or MIT not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef XVPROTO_H
+#define XVPROTO_H
+/*
+** File:
+**
+**   Xvproto.h --- Xv protocol header file
+**
+** Author:
+**
+**   David Carver (Digital Workstation Engineering/Project Athena)
+**
+** Revisions:
+**
+**   11.06.91 Carver
+**     - changed SetPortControl to SetPortAttribute
+**     - changed GetPortControl to GetPortAttribute
+**     - changed QueryBestSize
+**
+**   15.05.91 Carver
+**     - version 2.0 upgrade
+**
+**   24.01.91 Carver
+**     - version 1.4 upgrade
+**
+*/
+
+#include <X11/Xmd.h>
+
+/* Symbols: These are undefined at the end of this file to restore the
+   values they have in Xv.h */
+
+#define XvPortID CARD32
+#define XvEncodingID CARD32
+#define ShmSeg CARD32
+#define VisualID CARD32
+#define Drawable CARD32
+#define GContext CARD32
+#define Time CARD32
+#define Atom CARD32
+
+/* Structures */
+
+typedef struct {
+  INT32 numerator B32;
+  INT32 denominator B32;
+} xvRational;
+#define sz_xvRational 8
+
+typedef struct {
+  XvPortID base_id B32;
+  CARD16 name_size B16;
+  CARD16 num_ports B16;
+  CARD16 num_formats B16;
+  CARD8 type;
+  CARD8 pad;
+} xvAdaptorInfo;
+#define sz_xvAdaptorInfo 12
+
+typedef struct {
+  XvEncodingID encoding B32;
+  CARD16 name_size B16;
+  CARD16 width B16, height B16;
+  CARD16 pad B16;
+  xvRational rate;
+} xvEncodingInfo;
+#define sz_xvEncodingInfo (12 + sz_xvRational)
+
+typedef struct {
+  VisualID visual B32;
+  CARD8 depth;
+  CARD8 pad1;
+  CARD16 pad2 B16;
+} xvFormat;
+#define sz_xvFormat 8
+
+typedef struct {
+  CARD32 flags B32;
+  INT32 min B32;
+  INT32 max B32;
+  CARD32 size  B32;
+} xvAttributeInfo;
+#define sz_xvAttributeInfo 16
+
+typedef struct {
+  CARD32 id B32;
+  CARD8 type;
+  CARD8 byte_order;
+  CARD16 pad1 B16;
+  CARD8 guid[16];
+  CARD8 bpp;
+  CARD8 num_planes;
+  CARD16 pad2 B16;
+  CARD8 depth;
+  CARD8 pad3;
+  CARD16 pad4 B16;
+  CARD32 red_mask B32;
+  CARD32 green_mask B32;
+  CARD32 blue_mask B32;
+  CARD8 format;
+  CARD8 pad5;
+  CARD16 pad6 B16;
+  CARD32 y_sample_bits B32;
+  CARD32 u_sample_bits B32;
+  CARD32 v_sample_bits B32;
+  CARD32 horz_y_period B32;
+  CARD32 horz_u_period B32;
+  CARD32 horz_v_period B32;
+  CARD32 vert_y_period B32;
+  CARD32 vert_u_period B32;
+  CARD32 vert_v_period B32;
+  CARD8 comp_order[32];
+  CARD8 scanline_order;
+  CARD8 pad7;
+  CARD16 pad8 B16;
+  CARD32 pad9 B32;
+  CARD32 pad10 B32;
+} xvImageFormatInfo;
+#define sz_xvImageFormatInfo 128
+
+
+/* Requests */
+
+#define xv_QueryExtension                  0
+#define	xv_QueryAdaptors                   1
+#define	xv_QueryEncodings                  2
+#define xv_GrabPort                        3
+#define xv_UngrabPort                      4
+#define xv_PutVideo                        5
+#define xv_PutStill                        6
+#define xv_GetVideo                        7
+#define xv_GetStill                        8
+#define xv_StopVideo                       9
+#define xv_SelectVideoNotify              10
+#define xv_SelectPortNotify               11
+#define xv_QueryBestSize                  12
+#define xv_SetPortAttribute               13
+#define xv_GetPortAttribute               14
+#define xv_QueryPortAttributes            15
+#define xv_ListImageFormats               16
+#define xv_QueryImageAttributes           17
+#define xv_PutImage                       18
+#define xv_ShmPutImage                    19
+#define xv_LastRequest                    xv_ShmPutImage
+
+#define xvNumRequests                     (xv_LastRequest + 1)
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvReqType;
+  CARD16 length B16;
+} xvQueryExtensionReq;
+#define sz_xvQueryExtensionReq 4
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvReqType;
+  CARD16 length B16;
+  CARD32 window B32;
+} xvQueryAdaptorsReq;
+#define sz_xvQueryAdaptorsReq 8
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvReqType;
+  CARD16 length B16;
+  CARD32 port B32;
+} xvQueryEncodingsReq;
+#define sz_xvQueryEncodingsReq 8
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvReqType;
+  CARD16 length B16;
+  XvPortID port B32;
+  Drawable drawable B32;
+  GContext gc B32;
+  INT16 vid_x B16;
+  INT16 vid_y B16;
+  CARD16 vid_w B16;
+  CARD16 vid_h B16;
+  INT16 drw_x B16;
+  INT16 drw_y B16;
+  CARD16 drw_w B16;
+  CARD16 drw_h B16;
+} xvPutVideoReq;
+#define sz_xvPutVideoReq 32
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvReqType;
+  CARD16 length B16;
+  XvPortID port B32;
+  Drawable drawable B32;
+  GContext gc B32;
+  INT16 vid_x B16;
+  INT16 vid_y B16;
+  CARD16 vid_w B16;
+  CARD16 vid_h B16;
+  INT16 drw_x B16;
+  INT16 drw_y B16;
+  CARD16 drw_w B16;
+  CARD16 drw_h B16;
+} xvPutStillReq;
+#define sz_xvPutStillReq 32
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvReqType;
+  CARD16 length B16;
+  XvPortID port B32;
+  Drawable drawable B32;
+  GContext gc B32;
+  INT16 vid_x B16;
+  INT16 vid_y B16;
+  CARD16 vid_w B16;
+  CARD16 vid_h B16;
+  INT16 drw_x B16;
+  INT16 drw_y B16;
+  CARD16 drw_w B16;
+  CARD16 drw_h B16;
+} xvGetVideoReq;
+#define sz_xvGetVideoReq 32
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvReqType;
+  CARD16 length B16;
+  XvPortID port B32;
+  Drawable drawable B32;
+  GContext gc B32;
+  INT16 vid_x B16;
+  INT16 vid_y B16;
+  CARD16 vid_w B16;
+  CARD16 vid_h B16;
+  INT16 drw_x B16;
+  INT16 drw_y B16;
+  CARD16 drw_w B16;
+  CARD16 drw_h B16;
+} xvGetStillReq;
+#define sz_xvGetStillReq 32
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvReqType;
+  CARD16 length B16;
+  XvPortID port B32;
+  Time time B32;
+} xvGrabPortReq;
+#define sz_xvGrabPortReq 12
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvReqType;
+  CARD16 length B16;
+  XvPortID port B32;
+  Time time B32;
+} xvUngrabPortReq;
+#define sz_xvUngrabPortReq 12
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvReqType;
+  CARD16 length B16;
+  Drawable drawable B32;
+  BOOL onoff;
+  CARD8 pad1;
+  CARD16 pad2;
+} xvSelectVideoNotifyReq;
+#define sz_xvSelectVideoNotifyReq 12
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvReqType;
+  CARD16 length B16;
+  XvPortID port B32;
+  BOOL onoff;
+  CARD8 pad1;
+  CARD16 pad2;
+} xvSelectPortNotifyReq;
+#define sz_xvSelectPortNotifyReq 12
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvReqType;
+  CARD16 length B16;
+  XvPortID port B32;
+  Drawable drawable B32;
+} xvStopVideoReq;
+#define sz_xvStopVideoReq 12
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvReqType;
+  CARD16 length B16;
+  XvPortID port B32;
+  Atom attribute B32;
+  INT32 value B32;
+} xvSetPortAttributeReq;
+#define sz_xvSetPortAttributeReq 16
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvReqType;
+  CARD16 length B16;
+  XvPortID port B32;
+  Atom attribute B32;
+} xvGetPortAttributeReq;
+#define sz_xvGetPortAttributeReq 12
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvReqType;
+  CARD16 length B16;
+  XvPortID port B32;
+  CARD16 vid_w B16;
+  CARD16 vid_h B16;
+  CARD16 drw_w B16;
+  CARD16 drw_h B16;
+  CARD8 motion;
+  CARD8 pad1;
+  CARD16 pad2 B16;
+} xvQueryBestSizeReq;
+#define sz_xvQueryBestSizeReq 20
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvReqType;
+  CARD16 length B16;
+  XvPortID port B32;
+} xvQueryPortAttributesReq;
+#define sz_xvQueryPortAttributesReq 8
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvReqType;
+  CARD16 length B16;
+  XvPortID port B32;
+  Drawable drawable B32;
+  GContext gc B32;
+  CARD32 id B32;
+  INT16 src_x B16;
+  INT16 src_y B16;
+  CARD16 src_w B16;
+  CARD16 src_h B16;
+  INT16 drw_x B16;
+  INT16 drw_y B16;
+  CARD16 drw_w B16;
+  CARD16 drw_h B16;
+  CARD16 width B16;
+  CARD16 height B16;
+} xvPutImageReq;
+#define sz_xvPutImageReq 40
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvReqType;
+  CARD16 length B16;
+  XvPortID port B32;
+  Drawable drawable B32;
+  GContext gc B32;
+  ShmSeg shmseg B32;
+  CARD32 id B32;
+  CARD32 offset B32;
+  INT16 src_x B16;
+  INT16 src_y B16;
+  CARD16 src_w B16;
+  CARD16 src_h B16;
+  INT16 drw_x B16;
+  INT16 drw_y B16;
+  CARD16 drw_w B16;
+  CARD16 drw_h B16;
+  CARD16 width B16;
+  CARD16 height B16;
+  CARD8 send_event;
+  CARD8 pad1;
+  CARD16 pad2 B16;
+} xvShmPutImageReq;
+#define sz_xvShmPutImageReq 52
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvReqType;
+  CARD16 length B16;
+  XvPortID port B32;
+} xvListImageFormatsReq;
+#define sz_xvListImageFormatsReq 8
+
+typedef struct {
+  CARD8 reqType;
+  CARD8 xvReqType;
+  CARD16 length B16;
+  CARD32 port B32;
+  CARD32 id B32;
+  CARD16 width B16;
+  CARD16 height B16;
+} xvQueryImageAttributesReq;
+#define sz_xvQueryImageAttributesReq 16
+
+
+/* Replies */
+
+typedef struct _QueryExtensionReply {
+  BYTE type;   /* X_Reply */
+  CARD8 padb1;
+  CARD16 sequenceNumber B16;
+  CARD32 length B32;
+  CARD16 version B16;
+  CARD16 revision B16;
+  CARD32 padl4 B32;
+  CARD32 padl5 B32;
+  CARD32 padl6 B32;
+  CARD32 padl7 B32;
+  CARD32 padl8 B32;
+} xvQueryExtensionReply;
+#define sz_xvQueryExtensionReply 32
+
+typedef struct _QueryAdaptorsReply {
+  BYTE type;   /* X_Reply */
+  CARD8 padb1;
+  CARD16 sequenceNumber B16;
+  CARD32 length B32;
+  CARD16 num_adaptors B16;
+  CARD16 pads3 B16;
+  CARD32 padl4 B32;
+  CARD32 padl5 B32;
+  CARD32 padl6 B32;
+  CARD32 padl7 B32;
+  CARD32 padl8 B32;
+} xvQueryAdaptorsReply;
+#define sz_xvQueryAdaptorsReply 32
+
+typedef struct _QueryEncodingsReply {
+  BYTE type;   /* X_Reply */
+  CARD8 padb1;
+  CARD16 sequenceNumber B16;
+  CARD32 length B32;
+  CARD16 num_encodings B16;
+  CARD16 padl3 B16;
+  CARD32 padl4 B32;
+  CARD32 padl5 B32;
+  CARD32 padl6 B32;
+  CARD32 padl7 B32;
+  CARD32 padl8 B32;
+} xvQueryEncodingsReply;
+#define sz_xvQueryEncodingsReply 32
+
+typedef struct {
+  BYTE type;  /* X_Reply */
+  BYTE result;
+  CARD16 sequenceNumber B16;
+  CARD32 length B32;  /* 0 */
+  CARD32 padl3 B32;
+  CARD32 padl4 B32;
+  CARD32 padl5 B32;
+  CARD32 padl6 B32;
+  CARD32 padl7 B32;
+  CARD32 padl8 B32;
+} xvGrabPortReply;
+#define sz_xvGrabPortReply 32
+
+typedef struct {
+  BYTE type;  /* X_Reply */
+  BYTE padb1;
+  CARD16 sequenceNumber B16;
+  CARD32 length B32;  /* 0 */
+  INT32 value B32;
+  CARD32 padl4 B32;
+  CARD32 padl5 B32;
+  CARD32 padl6 B32;
+  CARD32 padl7 B32;
+  CARD32 padl8 B32;
+} xvGetPortAttributeReply;
+#define sz_xvGetPortAttributeReply 32
+
+typedef struct {
+  BYTE type;  /* X_Reply */
+  BYTE padb1;
+  CARD16 sequenceNumber B16;
+  CARD32 length B32;  /* 0 */
+  CARD16 actual_width B16;
+  CARD16 actual_height B16;
+  CARD32 padl4 B32;
+  CARD32 padl5 B32;
+  CARD32 padl6 B32;
+  CARD32 padl7 B32;
+  CARD32 padl8 B32;
+} xvQueryBestSizeReply;
+#define sz_xvQueryBestSizeReply 32
+
+typedef struct {
+  BYTE type;  /* X_Reply */
+  BYTE padb1;
+  CARD16 sequenceNumber B16;
+  CARD32 length B32;  /* 0 */
+  CARD32 num_attributes B32;
+  CARD32 text_size B32;
+  CARD32 padl5 B32;
+  CARD32 padl6 B32;
+  CARD32 padl7 B32;
+  CARD32 padl8 B32;
+} xvQueryPortAttributesReply;
+#define sz_xvQueryPortAttributesReply 32
+
+typedef struct {
+  BYTE type;  /* X_Reply */
+  BYTE padb1;
+  CARD16 sequenceNumber B16;
+  CARD32 length B32;
+  CARD32 num_formats B32;
+  CARD32 padl4 B32;
+  CARD32 padl5 B32;
+  CARD32 padl6 B32;
+  CARD32 padl7 B32;
+  CARD32 padl8 B32;
+} xvListImageFormatsReply;
+#define sz_xvListImageFormatsReply 32
+
+typedef struct {
+  BYTE type;  /* X_Reply */
+  BYTE padb1;
+  CARD16 sequenceNumber B16;
+  CARD32 length B32;
+  CARD32 num_planes B32;
+  CARD32 data_size B32;
+  CARD16 width B16;
+  CARD16 height B16;
+  CARD32 padl6 B32;
+  CARD32 padl7 B32;
+  CARD32 padl8 B32;
+} xvQueryImageAttributesReply;
+#define sz_xvQueryImageAttributesReply 32
+
+/* DEFINE EVENT STRUCTURE */
+
+typedef struct {
+  union {
+    struct {
+      BYTE type;
+      BYTE detail;
+      CARD16 sequenceNumber B16;
+    } u;
+    struct {
+      BYTE type;
+      BYTE reason;
+      CARD16 sequenceNumber B16;
+      Time time B32;
+      Drawable drawable B32;
+      XvPortID port B32;
+      CARD32 padl5 B32;
+      CARD32 padl6 B32;
+      CARD32 padl7 B32;
+      CARD32 padl8 B32;
+    } videoNotify;
+    struct {
+      BYTE type;
+      BYTE padb1;
+      CARD16 sequenceNumber B16;
+      Time time B32;
+      XvPortID port B32;
+      Atom attribute B32;
+      INT32 value B32;
+      CARD32 padl6 B32;
+      CARD32 padl7 B32;
+      CARD32 padl8 B32;
+    } portNotify;
+  } u;
+} xvEvent;
+
+#undef XvPortID
+#undef XvEncodingID
+#undef ShmSeg
+#undef VisualID
+#undef Drawable
+#undef GContext
+#undef Time
+#undef Atom
+
+#endif /* XVPROTO_H */
+
diff --git a/ThirdParty/X11/Include/X11/extensions/ag.h b/ThirdParty/X11/Include/X11/extensions/ag.h
new file mode 100644
index 0000000000000000000000000000000000000000..be5883a3e6635eb820306e91f296532299edb1e3
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/ag.h
@@ -0,0 +1,52 @@
+/*
+Copyright 1996, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+*/
+
+#ifndef _AG_H_
+#define _AG_H_
+
+#define XAGNAME "XC-APPGROUP"
+
+#define XAG_MAJOR_VERSION	1	/* current version numbers */
+#define XAG_MINOR_VERSION	0
+
+#define XagWindowTypeX11	0
+#define XagWindowTypeMacintosh	1
+#define XagWindowTypeWin32	2
+#define XagWindowTypeWin16	3
+
+#define XagBadAppGroup			0
+#define XagNumberErrors			(XagBadAppGroup + 1)
+
+#define XagNsingleScreen		7
+#define XagNdefaultRoot			1
+#define XagNrootVisual			2
+#define XagNdefaultColormap		3
+#define XagNblackPixel			4
+#define XagNwhitePixel			5
+#define XagNappGroupLeader		6
+
+#endif /* _AG_H_ */
+
diff --git a/ThirdParty/X11/Include/X11/extensions/agproto.h b/ThirdParty/X11/Include/X11/extensions/agproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..1086661266af079ea9a63f1624cee558c167593a
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/agproto.h
@@ -0,0 +1,178 @@
+/*
+Copyright 1996, 1998, 2001  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+*/
+
+#ifndef _AGPROTO_H_ /* { */
+#define _AGPROTO_H_
+
+#include <X11/extensions/ag.h>
+
+#define X_XagQueryVersion		0
+#define X_XagCreate			1
+#define X_XagDestroy			2
+#define X_XagGetAttr			3
+#define X_XagQuery			4
+#define X_XagCreateAssoc		5
+#define X_XagDestroyAssoc		6
+
+#define XAppGroup CARD32
+
+/*
+* Redefine some basic types used by structures defined herein.  This allows
+* both the library and server to view communicated data as 32-bit entities,
+* thus preventing problems on 64-bit architectures where libXext sees this
+* data as 64 bits and the server sees it as 32 bits.
+*/
+
+#define Colormap CARD32
+#define VisualID CARD32
+#define Window CARD32
+
+typedef struct _XagQueryVersion {
+    CARD8	reqType;	/* always XagReqCode */
+    CARD8	xagReqType;	/* always X_XagQueryVersion */
+    CARD16	length B16;
+    CARD16	client_major_version B16;
+    CARD16	client_minor_version B16;
+} xXagQueryVersionReq;
+#define sz_xXagQueryVersionReq		8
+
+typedef struct {
+    BYTE	type;		/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequence_number B16;
+    CARD32	length B32;
+    CARD16	server_major_version B16;
+    CARD16	server_minor_version B16;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xXagQueryVersionReply;
+#define sz_xXagQueryVersionReply	32
+
+/* Set AppGroup Attributes masks */
+#define XagSingleScreenMask		1 << 0
+#define XagDefaultRootMask		1 << XagNdefaultRoot
+#define XagRootVisualMask		1 << XagNrootVisual
+#define XagDefaultColormapMask		1 << XagNdefaultColormap
+#define XagBlackPixelMask		1 << XagNblackPixel
+#define XagWhitePixelMask		1 << XagNwhitePixel
+#define XagAppGroupLeaderMask		1 << XagNappGroupLeader
+
+typedef struct _XagCreate {
+    CARD8	reqType;	/* always XagReqCode */
+    CARD8	xagReqType;	/* always X_XagCreate */
+    CARD16	length B16;
+    XAppGroup	app_group B32;
+    CARD32	attrib_mask B32; /* LISTofVALUE follows */
+} xXagCreateReq;
+#define sz_xXagCreateReq		12
+
+typedef struct _XagDestroy {
+    CARD8	reqType;	/* always XagReqCode */
+    CARD8	xagReqType;	/* always X_XagDestroy */
+    CARD16	length B16;
+    XAppGroup	app_group  B32;
+} xXagDestroyReq;
+#define sz_xXagDestroyReq		8
+
+typedef struct _XagGetAttr {
+    CARD8	reqType;	/* always XagReqCode */
+    CARD8	xagReqType;	/* always X_XagGetAttr */
+    CARD16	length B16;
+    XAppGroup	app_group B32;
+} xXagGetAttrReq;
+#define sz_xXagGetAttrReq		8
+
+typedef struct {
+    BYTE	type;		/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequence_number B16;
+    CARD32	length B32;
+    Window	default_root B32;
+    VisualID	root_visual B32;
+    Colormap	default_colormap B32;
+    CARD32	black_pixel B32;
+    CARD32	white_pixel B32;
+    BOOL	single_screen;
+    BOOL	app_group_leader;
+    CARD16	pad2 B16;
+} xXagGetAttrReply;
+#define sz_xXagGetAttrReply		32
+
+typedef struct _XagQuery {
+    CARD8	reqType;	/* always XagReqCode */
+    CARD8	xagReqType;	/* always X_XagQuery */
+    CARD16	length B16;
+    CARD32	resource B32;
+} xXagQueryReq;
+#define sz_xXagQueryReq			8
+
+typedef struct {
+    BYTE	type;		/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequence_number B16;
+    CARD32	length B32;
+    XAppGroup	app_group B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xXagQueryReply;
+#define sz_xXagQueryReply		32
+
+typedef struct _XagCreateAssoc {
+    CARD8	reqType;	/* always XagReqCode */
+    CARD8	xagReqType;	/* always X_XagCreateAssoc */
+    CARD16	length B16;
+    Window	window B32;
+    CARD16	window_type B16;
+    CARD16	system_window_len B16; /* LISTofCARD8 follows */
+} xXagCreateAssocReq;
+#define sz_xXagCreateAssocReq		12
+
+typedef struct _XagDestroyAssoc {
+    CARD8	reqType;	/* always XagReqCode */
+    CARD8	xagReqType;	/* always X_XagDestroyAssoc */
+    CARD16	length B16;
+    Window	window B32;
+} xXagDestroyAssocReq;
+#define sz_xXagDestroyAssocReq		8
+
+#undef XAppGroup
+/*
+ * Cancel the previous redefinition of the basic types, thus restoring their
+ * X.h definitions.
+ */
+
+#undef Window
+#undef Colormap
+#undef VisualID
+
+#endif /* } _AGPROTO_H_ */
+
diff --git a/ThirdParty/X11/Include/X11/extensions/bigreqsproto.h b/ThirdParty/X11/Include/X11/extensions/bigreqsproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..bd0f8e568aab40e6501663f9a7323f7b2bfb88bc
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/bigreqsproto.h
@@ -0,0 +1,67 @@
+/*
+
+Copyright 1992, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _BIGREQSPROTO_H_
+#define _BIGREQSPROTO_H_
+
+#define X_BigReqEnable		0
+
+#define XBigReqNumberEvents	0
+
+#define XBigReqNumberErrors	0
+
+#define XBigReqExtensionName	"BIG-REQUESTS"
+
+typedef struct {
+    CARD8	reqType;	/* always XBigReqCode */
+    CARD8	brReqType;	/* always X_BigReqEnable */
+    CARD16	length B16;
+} xBigReqEnableReq;
+#define sz_xBigReqEnableReq 4
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	pad0;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	max_request_size B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xBigReqEnableReply;
+#define sz_xBigReqEnableReply 32
+
+
+typedef struct {
+	CARD8 reqType;
+	CARD8 data;
+	CARD16 zero B16;
+        CARD32 length B32;
+} xBigReq;
+
+#endif /* _BIGREQSPROTO_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/bigreqstr.h b/ThirdParty/X11/Include/X11/extensions/bigreqstr.h
new file mode 100644
index 0000000000000000000000000000000000000000..0a023dbf1c4044af188c6921cd883a9bedd579eb
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/bigreqstr.h
@@ -0,0 +1,3 @@
+#warning "bigreqstr.h is obsolete and may be removed in the future."
+#warning "include <X11/extensions/bigreqsproto.h> for the protocol defines."
+#include <X11/extensions/bigreqsproto.h>
diff --git a/ThirdParty/X11/Include/X11/extensions/composite.h b/ThirdParty/X11/Include/X11/extensions/composite.h
new file mode 100644
index 0000000000000000000000000000000000000000..e460118b7551cda51f16d60fc802df8e3762b078
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/composite.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+/*
+ * Copyright © 2003 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _COMPOSITE_H_
+#define _COMPOSITE_H_
+
+#include <X11/extensions/xfixeswire.h>
+
+#define COMPOSITE_NAME				"Composite"
+#define COMPOSITE_MAJOR				0
+#define COMPOSITE_MINOR				4
+
+#define CompositeRedirectAutomatic		0
+#define CompositeRedirectManual			1
+
+#define X_CompositeQueryVersion			0
+#define X_CompositeRedirectWindow		1
+#define X_CompositeRedirectSubwindows		2
+#define X_CompositeUnredirectWindow		3
+#define X_CompositeUnredirectSubwindows		4
+#define X_CompositeCreateRegionFromBorderClip	5
+#define X_CompositeNameWindowPixmap		6
+#define X_CompositeGetOverlayWindow             7
+#define X_CompositeReleaseOverlayWindow         8
+
+#define CompositeNumberRequests	    (X_CompositeReleaseOverlayWindow + 1)
+
+#define CompositeNumberEvents			0
+
+#endif /* _COMPOSITE_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/compositeproto.h b/ThirdParty/X11/Include/X11/extensions/compositeproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..0417f2ce3d4181ba3d8e614065cb6cc247275e90
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/compositeproto.h
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+/*
+ * Copyright © 2003 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _COMPOSITEPROTO_H_
+#define _COMPOSITEPROTO_H_
+
+#include <X11/Xmd.h>
+#include <X11/extensions/composite.h>
+
+#define Window CARD32
+#define Region CARD32
+#define Pixmap CARD32
+
+/* 
+ * requests and replies
+ */
+typedef struct {
+    CARD8   reqType;
+    CARD8   compositeReqType;
+    CARD16  length B16;
+    CARD32  majorVersion B32;
+    CARD32  minorVersion B32;
+} xCompositeQueryVersionReq;
+
+#define sz_xCompositeQueryVersionReq   12
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  majorVersion B32;
+    CARD32  minorVersion B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+} xCompositeQueryVersionReply;
+
+#define sz_xCompositeQueryVersionReply	32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   compositeReqType;
+    CARD16  length B16;
+    Window  window B32;
+    CARD8   update;
+    CARD8   pad1;
+    CARD16  pad2 B16;
+} xCompositeRedirectWindowReq;
+
+#define sz_xCompositeRedirectWindowReq	12
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   compositeReqType;
+    CARD16  length B16;
+    Window  window B32;
+    CARD8   update;
+    CARD8   pad1;
+    CARD16  pad2 B16;
+} xCompositeRedirectSubwindowsReq;
+
+#define sz_xCompositeRedirectSubwindowsReq	    12
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   compositeReqType;
+    CARD16  length B16;
+    Window  window B32;
+    CARD8   update;
+    CARD8   pad1;
+    CARD16  pad2 B16;
+} xCompositeUnredirectWindowReq;
+
+#define sz_xCompositeUnredirectWindowReq    12
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   compositeReqType;
+    CARD16  length B16;
+    Window  window B32;
+    CARD8   update;
+    CARD8   pad1;
+    CARD16  pad2 B16;
+} xCompositeUnredirectSubwindowsReq;
+
+#define sz_xCompositeUnredirectSubwindowsReq   12
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   compositeReqType;
+    CARD16  length B16;
+    Region  region B32;
+    Window  window B32;
+} xCompositeCreateRegionFromBorderClipReq;
+
+#define sz_xCompositeCreateRegionFromBorderClipReq  12
+
+/* Version 0.2 additions */
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   compositeReqType;
+    CARD16  length;
+    Window  window B32;
+    Pixmap  pixmap B32;
+} xCompositeNameWindowPixmapReq;
+
+#define sz_xCompositeNameWindowPixmapReq	    12
+
+/* Version 0.3 additions */
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   compositeReqType;
+    CARD16  length B16;
+    Window  window B32;
+} xCompositeGetOverlayWindowReq;
+
+#define sz_xCompositeGetOverlayWindowReq sizeof(xCompositeGetOverlayWindowReq)
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    Window  overlayWin B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+    CARD32  pad6 B32;
+} xCompositeGetOverlayWindowReply;
+
+#define sz_xCompositeGetOverlayWindowReply sizeof(xCompositeGetOverlayWindowReply)
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   compositeReqType;
+    CARD16  length B16;
+    Window  window B32;
+} xCompositeReleaseOverlayWindowReq;
+
+#define sz_xCompositeReleaseOverlayWindowReq sizeof(xCompositeReleaseOverlayWindowReq)
+
+#undef Window
+#undef Region
+#undef Pixmap
+
+#endif /* _COMPOSITEPROTO_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/cup.h b/ThirdParty/X11/Include/X11/extensions/cup.h
new file mode 100644
index 0000000000000000000000000000000000000000..cbbc34bf8e9f7d1225b7bbb4fa11d163cf599725
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/cup.h
@@ -0,0 +1,38 @@
+/*
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _CUP_H_
+#define _CUP_H_
+
+#define XCUPNAME "TOG-CUP"
+
+#define XCUP_MAJOR_VERSION	1	/* current version numbers */
+#define XCUP_MINOR_VERSION	0
+
+#define XcupNumberErrors			0
+
+#endif /* _CUP_H_ */
+
diff --git a/ThirdParty/X11/Include/X11/extensions/cupproto.h b/ThirdParty/X11/Include/X11/extensions/cupproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..f61c9f0a7e5902e7aff43e48b595883fad4c6a72
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/cupproto.h
@@ -0,0 +1,105 @@
+/*
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _XCUPPROTO_H_ /* { */
+#define _XCUPPROTO_H_
+
+#include <X11/extensions/cup.h>
+
+#define X_XcupQueryVersion			0
+#define X_XcupGetReservedColormapEntries	1
+#define X_XcupStoreColors			2
+
+typedef struct _XcupQueryVersion {
+    CARD8	reqType;	/* always XcupReqCode */
+    CARD8	xcupReqType;	/* always X_XcupQueryVersion */
+    CARD16	length B16;
+    CARD16	client_major_version B16;
+    CARD16	client_minor_version B16;
+} xXcupQueryVersionReq;
+#define sz_xXcupQueryVersionReq		8
+
+typedef struct {
+    BYTE	type;		/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequence_number B16;
+    CARD32	length B32;
+    CARD16	server_major_version B16;
+    CARD16	server_minor_version B16;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xXcupQueryVersionReply;
+#define sz_xXcupQueryVersionReply	32
+
+typedef struct _XcupGetReservedColormapEntries {
+    CARD8	reqType;	/* always XcupReqCode */
+    CARD8	xcupReqType;	/* always X_XcupGetReservedColormapEntries */
+    CARD16	length B16;
+    CARD32	screen B32;
+} xXcupGetReservedColormapEntriesReq;
+#define sz_xXcupGetReservedColormapEntriesReq 8
+
+typedef struct {
+    BYTE	type;		/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequence_number B16;
+    CARD32	length B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+    CARD32	pad7 B32;
+} xXcupGetReservedColormapEntriesReply;
+#define sz_xXcupGetReservedColormapEntriesReply		32
+
+typedef struct _XcupStoreColors {
+    CARD8	reqType;	/* always XcupReqCode */
+    CARD8	xcupReqType;	/* always X_XcupStoreColors */
+    CARD16	length B16;
+    CARD32	cmap B32;
+} xXcupStoreColorsReq;
+#define sz_xXcupStoreColorsReq		8
+
+typedef struct {
+    BYTE	type;		/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequence_number B16;
+    CARD32	length B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+    CARD32	pad7 B32;
+} xXcupStoreColorsReply;
+#define sz_xXcupStoreColorsReply	32
+
+#endif /* } _XCUPPROTO_H_ */
+
diff --git a/ThirdParty/X11/Include/X11/extensions/damageproto.h b/ThirdParty/X11/Include/X11/extensions/damageproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..107e19271ccf514a306669c0f9ab355bbd929479
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/damageproto.h
@@ -0,0 +1,158 @@
+/*
+ * Copyright © 2003 Keith Packard
+ * Copyright © 2007 Eric Anholt
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _DAMAGEPROTO_H_
+#define _DAMAGEPROTO_H_
+
+#include <X11/Xmd.h>
+#include <X11/extensions/xfixesproto.h>
+#include <X11/extensions/damagewire.h>
+
+#define Window CARD32
+#define Drawable CARD32
+#define Font CARD32
+#define Pixmap CARD32
+#define Cursor CARD32
+#define Colormap CARD32
+#define GContext CARD32
+#define Atom CARD32
+#define VisualID CARD32
+#define Time CARD32
+#define KeyCode CARD8
+#define KeySym CARD32
+#define Picture CARD32
+#define Region CARD32
+#define Damage CARD32
+
+/************** Version 0 ******************/
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   damageReqType;
+    CARD16  length B16;
+} xDamageReq;
+
+/* 
+ * requests and replies
+ */
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   damageReqType;
+    CARD16  length B16;
+    CARD32  majorVersion B32;
+    CARD32  minorVersion B32;
+} xDamageQueryVersionReq;
+
+#define sz_xDamageQueryVersionReq   12
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  majorVersion B32;
+    CARD32  minorVersion B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+} xDamageQueryVersionReply;
+
+#define sz_xDamageQueryVersionReply	32
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	damageReqType;
+    CARD16	length B16;
+    Damage	damage B32;
+    Drawable	drawable B32;
+    CARD8	level;
+    CARD8	pad1;
+    CARD16	pad2 B16;
+} xDamageCreateReq;
+
+#define sz_xDamageCreateReq		16
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	damageReqType;
+    CARD16	length B16;
+    Damage	damage B32;
+} xDamageDestroyReq;
+
+#define sz_xDamageDestroyReq		8
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	damageReqType;
+    CARD16	length B16;
+    Damage	damage B32;
+    Region	repair B32;
+    Region	parts B32;
+} xDamageSubtractReq;
+
+#define sz_xDamageSubtractReq		16
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	damageReqType;
+    CARD16	length B16;
+    Drawable	drawable B32;
+    Region	region B32;
+} xDamageAddReq;
+
+#define sz_xDamageAddReq		12
+
+/* Events */
+
+#define DamageNotifyMore    0x80
+
+typedef struct {
+    CARD8	type;
+    CARD8	level;
+    CARD16	sequenceNumber B16;
+    Drawable	drawable B32;
+    Damage	damage B32;
+    Time	timestamp B32;
+    xRectangle	area;
+    xRectangle	geometry;
+} xDamageNotifyEvent;
+
+#undef Damage
+#undef Region
+#undef Picture
+#undef Window
+#undef Drawable
+#undef Font
+#undef Pixmap
+#undef Cursor
+#undef Colormap
+#undef GContext
+#undef Atom
+#undef VisualID
+#undef Time
+#undef KeyCode
+#undef KeySym
+
+#endif /* _DAMAGEPROTO_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/damagewire.h b/ThirdParty/X11/Include/X11/extensions/damagewire.h
new file mode 100644
index 0000000000000000000000000000000000000000..d90a0dd7c490dbe52693ebbffb1afa5c1abfaea3
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/damagewire.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright © 2003 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _DAMAGEWIRE_H_
+#define _DAMAGEWIRE_H_
+
+#define	DAMAGE_NAME	"DAMAGE"
+#define DAMAGE_MAJOR	1
+#define DAMAGE_MINOR	1
+
+/************* Version 1 ****************/
+
+/* Constants */
+#define XDamageReportRawRectangles	0
+#define XDamageReportDeltaRectangles	1
+#define XDamageReportBoundingBox	2
+#define XDamageReportNonEmpty		3
+
+/* Requests */
+#define X_DamageQueryVersion		0
+#define X_DamageCreate			1
+#define X_DamageDestroy			2
+#define X_DamageSubtract		3
+#define X_DamageAdd			4
+
+#define XDamageNumberRequests		(X_DamageAdd + 1)
+
+/* Events */
+#define XDamageNotify			0
+
+#define XDamageNumberEvents		(XDamageNotify + 1)
+
+/* Errors */
+#define BadDamage			0
+#define XDamageNumberErrors		(BadDamage + 1)
+
+#endif /* _DAMAGEWIRE_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/dbe.h b/ThirdParty/X11/Include/X11/extensions/dbe.h
new file mode 100644
index 0000000000000000000000000000000000000000..7968552d3206caedb7ffd9b477ab97afae25f582
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/dbe.h
@@ -0,0 +1,57 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994, 1995  Hewlett-Packard Company
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Hewlett-Packard
+ * Company shall not be used in advertising or otherwise to promote the
+ * sale, use or other dealings in this Software without prior written
+ * authorization from the Hewlett-Packard Company.
+ *
+ *     Header file for Xlib-related DBE
+ *
+ *****************************************************************************/
+
+#ifndef DBE_H
+#define DBE_H
+
+/* Values for swap_action field of XdbeSwapInfo structure */
+#define XdbeUndefined    0
+#define XdbeBackground   1
+#define XdbeUntouched    2
+#define XdbeCopied       3
+
+/* Errors */
+#define XdbeBadBuffer    0
+
+#define DBE_PROTOCOL_NAME "DOUBLE-BUFFER"
+
+/* Current version numbers */
+#define DBE_MAJOR_VERSION       1
+#define DBE_MINOR_VERSION       0
+
+/* Used when adding extension; also used in Xdbe macros */
+#define DbeNumberEvents			0
+#define DbeBadBuffer			0
+#define DbeNumberErrors			(DbeBadBuffer + 1)
+
+#endif /* DBE_H */
+
diff --git a/ThirdParty/X11/Include/X11/extensions/dbeproto.h b/ThirdParty/X11/Include/X11/extensions/dbeproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..784926e3361d73f2613781460c1a261f2c4fcacf
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/dbeproto.h
@@ -0,0 +1,224 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994, 1995  Hewlett-Packard Company
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Hewlett-Packard
+ * Company shall not be used in advertising or otherwise to promote the
+ * sale, use or other dealings in this Software without prior written
+ * authorization from the Hewlett-Packard Company.
+ *
+ *     Header file for Xlib-related DBE
+ *
+ *****************************************************************************/
+
+#ifndef DBE_PROTO_H
+#define DBE_PROTO_H
+
+#include <X11/extensions/dbe.h>
+
+/* Request values used in (S)ProcDbeDispatch() */
+#define X_DbeGetVersion                 0
+#define X_DbeAllocateBackBufferName     1
+#define X_DbeDeallocateBackBufferName   2
+#define X_DbeSwapBuffers                3
+#define X_DbeBeginIdiom                 4
+#define X_DbeEndIdiom                   5
+#define X_DbeGetVisualInfo              6
+#define X_DbeGetBackBufferAttributes    7
+
+typedef CARD8  xDbeSwapAction;
+typedef CARD32 xDbeBackBuffer;
+
+/* TYPEDEFS */
+
+/* Protocol data types */
+
+typedef struct
+{
+    CARD32		window B32;	/* window      */
+    xDbeSwapAction	swapAction;	/* swap action */
+    CARD8		pad1;		/* unused      */
+    CARD16		pad2 B16;
+
+} xDbeSwapInfo;
+
+typedef struct
+{
+    CARD32	visualID B32;	/* associated visual      */
+    CARD8	depth;		/* depth of visual        */
+    CARD8	perfLevel;	/* performance level hint */
+    CARD16	pad1 B16;
+
+} xDbeVisInfo;
+#define sz_xDbeVisInfo	8
+
+typedef struct
+{
+    CARD32	n B32;	/* number of visual info items in list  */
+
+} xDbeScreenVisInfo;	/* followed by n xDbeVisInfo items */
+
+typedef struct
+{
+    CARD32	window B32;	/* window */
+
+} xDbeBufferAttributes;
+
+
+/* Requests and replies */
+
+typedef struct
+{
+    CARD8	reqType;	/* major-opcode: always codes->major_opcode */
+    CARD8	dbeReqType;	/* minor-opcode: always X_DbeGetVersion (0) */
+    CARD16	length B16;	/* request length: (2)                      */
+    CARD8	majorVersion;	/* client-major-version                     */
+    CARD8	minorVersion;	/* client-minor-version                     */
+    CARD16	unused B16;	/* unused                                   */
+
+} xDbeGetVersionReq;
+#define sz_xDbeGetVersionReq	8
+
+typedef struct
+{
+    BYTE	type;			/* Reply: X_Reply (1)   */
+    CARD8	unused;			/* unused               */
+    CARD16	sequenceNumber B16;	/* sequence number      */
+    CARD32	length B32;		/* reply length: (0)    */
+    CARD8	majorVersion;		/* server-major-version */
+    CARD8	minorVersion;		/* server-minor-version */
+    CARD16	pad1 B16;		/* unused               */
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+
+} xDbeGetVersionReply;
+#define sz_xDbeGetVersionReply	32
+
+typedef struct
+{
+    CARD8		reqType;	/* major-opcode: codes->major_opcode */
+    CARD8		dbeReqType;	/* X_DbeAllocateBackBufferName (1)   */
+    CARD16		length B16;	/* request length: (4)               */
+    CARD32		window B32;	/* window                            */
+    xDbeBackBuffer	buffer B32;	/* back buffer name                  */
+    xDbeSwapAction	swapAction;	/* swap action hint                  */
+    CARD8		pad1;		/* unused                            */
+    CARD16		pad2 B16;
+
+} xDbeAllocateBackBufferNameReq;
+#define sz_xDbeAllocateBackBufferNameReq	16
+
+typedef struct
+{
+    CARD8		reqType;	/* major-opcode: codes->major_opcode */
+    CARD8		dbeReqType;	/* X_DbeDeallocateBackBufferName (2) */
+    CARD16		length B16;	/* request length: (2)               */
+    xDbeBackBuffer	buffer B32;	/* back buffer name                  */
+
+} xDbeDeallocateBackBufferNameReq;
+#define sz_xDbeDeallocateBackBufferNameReq	8
+
+typedef struct
+{
+    CARD8	reqType;	/* major-opcode: always codes->major_opcode  */
+    CARD8	dbeReqType;	/* minor-opcode: always X_DbeSwapBuffers (3) */
+    CARD16	length B16;	/* request length: (2+2n)                    */
+    CARD32	n B32;		/* n, number of window/swap action pairs     */
+
+} xDbeSwapBuffersReq;		/* followed by n window/swap action pairs    */
+#define sz_xDbeSwapBuffersReq	8
+
+typedef struct
+{
+    CARD8	reqType;	/* major-opcode: always codes->major_opcode */
+    CARD8	dbeReqType;	/* minor-opcode: always X_DbeBeginIdom (4)  */
+    CARD16	length B16;	/* request length: (1)                      */
+
+} xDbeBeginIdiomReq;
+#define sz_xDbeBeginIdiomReq	4
+
+typedef struct
+{
+    CARD8	reqType;	/* major-opcode: always codes->major_opcode */
+    CARD8	dbeReqType;	/* minor-opcode: always X_DbeEndIdom (5)    */
+    CARD16	length B16;	/* request length: (1)                      */
+
+} xDbeEndIdiomReq;
+#define sz_xDbeEndIdiomReq	4
+
+typedef struct
+{
+    CARD8	reqType;	/* always codes->major_opcode     */
+    CARD8	dbeReqType;	/* always X_DbeGetVisualInfo (6)  */
+    CARD16	length B16;	/* request length: (2+n)          */
+    CARD32	n B32;		/* n, number of drawables in list */
+
+} xDbeGetVisualInfoReq;		/* followed by n drawables        */
+#define sz_xDbeGetVisualInfoReq	8
+
+typedef struct
+{
+    BYTE	type;			/* Reply: X_Reply (1)                */
+    CARD8	unused;			/* unused                            */
+    CARD16	sequenceNumber B16;	/* sequence number                   */
+    CARD32	length B32;		/* reply length                      */
+    CARD32	m;			/* m, number of visual infos in list */
+    CARD32	pad1 B32;		/* unused                            */
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+
+} xDbeGetVisualInfoReply;		/* followed by m visual infos        */
+#define sz_xDbeGetVisualInfoReply	32
+
+typedef struct
+{
+    CARD8		reqType;	/* always codes->major_opcode       */
+    CARD8		dbeReqType;	/* X_DbeGetBackBufferAttributes (7) */
+    CARD16		length B16;	/* request length: (2)              */
+    xDbeBackBuffer	buffer B32;	/* back buffer name                 */
+
+} xDbeGetBackBufferAttributesReq;
+#define sz_xDbeGetBackBufferAttributesReq	8
+
+typedef struct
+{
+    BYTE	type;			/* Reply: X_Reply (1) */
+    CARD8	unused;			/* unused             */
+    CARD16	sequenceNumber B16;	/* sequence number    */
+    CARD32	length B32;		/* reply length: (0)  */
+    CARD32	attributes;		/* attributes         */
+    CARD32	pad1 B32;		/* unused             */
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+
+} xDbeGetBackBufferAttributesReply;
+#define sz_xDbeGetBackBufferAttributesReply	32
+
+#endif /* DBE_PROTO_H */
+
diff --git a/ThirdParty/X11/Include/X11/extensions/dmx.h b/ThirdParty/X11/Include/X11/extensions/dmx.h
new file mode 100644
index 0000000000000000000000000000000000000000..8cbd4d3672f0e527867063236857da5d587845b9
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/dmx.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ *   Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * This file describes the interface to the client-side libdmx.a
+ * library.  All DMX-aware client-side applications should include this
+ * file. */
+
+#ifndef _DMX_H_
+#define _DMX_H_
+
+/* These values must be larger than LastExtensionError.
+   The values in dmxext.h and dmxproto.h *MUST* match. */
+#define DmxBadXinerama         1001
+#define DmxBadValue            1002
+#define DmxBadReply            1003
+
+#define DMXScreenWindowWidth   (1L<<0)
+#define DMXScreenWindowHeight  (1L<<1)
+#define DMXScreenWindowXoffset (1L<<2)
+#define DMXScreenWindowYoffset (1L<<3)
+#define DMXRootWindowWidth     (1L<<4)
+#define DMXRootWindowHeight    (1L<<5)
+#define DMXRootWindowXoffset   (1L<<6)
+#define DMXRootWindowYoffset   (1L<<7)
+#define DMXRootWindowXorigin   (1L<<8)
+#define DMXRootWindowYorigin   (1L<<9)
+
+#define DMXDesktopWidth        (1L<<0)
+#define DMXDesktopHeight       (1L<<1)
+#define DMXDesktopShiftX       (1L<<2)
+#define DMXDesktopShiftY       (1L<<3)
+
+#define DMXInputType           (1L<<0)
+#define DMXInputPhysicalScreen (1L<<1)
+#define DMXInputSendsCore      (1L<<2)
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/dmxproto.h b/ThirdParty/X11/Include/X11/extensions/dmxproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..4bb160e1dd28b46d126af7196207761360328eb4
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/dmxproto.h
@@ -0,0 +1,445 @@
+/*
+ * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ *   Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * This file describes the structures necessary to implement the wire
+ * protocol for the DMX protocol extension.  It should be included only
+ * in files that implement the client-side (or server-side) part of the
+ * protocol (i.e., client-side applications should \b not include this
+ * file). */
+
+#ifndef _DMXSTR_H_
+#define _DMXSTR_H_
+
+#define DMX_EXTENSION_NAME  "DMX"
+#define DMX_EXTENSION_MAJOR 2
+#define DMX_EXTENSION_MINOR 2
+#define DMX_EXTENSION_PATCH 20040604
+
+/* These values must be larger than LastExtensionError.
+   The values in dmxext.h and dmxproto.h *MUST* match. */
+#define DMX_BAD_XINERAMA     1001
+#define DMX_BAD_VALUE        1002
+
+#define X_DMXQueryVersion                   0
+#define X_DMXGetScreenCount                 1
+#define X_DMXGetScreenInformationDEPRECATED 2
+#define X_DMXGetWindowAttributes            3
+#define X_DMXGetInputCount                  4
+#define X_DMXGetInputAttributes             5
+#define X_DMXForceWindowCreationDEPRECATED  6
+#define X_DMXReconfigureScreenDEPRECATED    7
+#define X_DMXSync                           8
+#define X_DMXForceWindowCreation            9
+#define X_DMXGetScreenAttributes           10
+#define X_DMXChangeScreensAttributes       11
+#define X_DMXAddScreen                     12
+#define X_DMXRemoveScreen                  13
+#define X_DMXGetDesktopAttributes          14
+#define X_DMXChangeDesktopAttributes       15
+#define X_DMXAddInput                      16
+#define X_DMXRemoveInput                   17
+
+/** Wire-level description of DMXQueryVersion protocol request. */
+typedef struct {
+    CARD8   reqType;            /* dmxcode */
+    CARD8   dmxReqType;         /* X_DMXQueryVersion */
+    CARD16  length B16;
+} xDMXQueryVersionReq;
+#define sz_xDMXQueryVersionReq 4
+
+/** Wire-level description of DMXQueryVersion protocol reply. */
+typedef struct {
+    BYTE    type;               /* X_Reply */
+    CARD8   ununsed;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  majorVersion B32;
+    CARD32  minorVersion B32;
+    CARD32  patchVersion B32;
+    CARD32  pad0 B32;
+    CARD32  pad1 B32;
+    CARD32  pad2 B32;
+} xDMXQueryVersionReply;
+#define sz_xDMXQueryVersionReply 32
+
+/** Wire-level description of DMXSync protocol request. */
+typedef struct {
+    CARD8   reqType;            /* DMXCode */
+    CARD8   dmxReqType;         /* X_DMXSync */
+    CARD16  length B16;
+} xDMXSyncReq;
+#define sz_xDMXSyncReq 4
+
+/** Wire-level description of DMXSync protocol reply. */
+typedef struct {
+    BYTE    type;               /* X_Reply */
+    CARD8   unused;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  status B32;
+    CARD32  pad0 B32;
+    CARD32  pad1 B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+} xDMXSyncReply;
+#define sz_xDMXSyncReply 32
+
+/** Wire-level description of DMXForceWindowCreation protocol request. */
+typedef struct {
+    CARD8   reqType;            /* DMXCode */
+    CARD8   dmxReqType;         /* X_DMXForceWindowCreation */
+    CARD16  length B16;
+    CARD32  window B32;
+} xDMXForceWindowCreationReq;
+#define sz_xDMXForceWindowCreationReq 8
+
+/** Wire-level description of DMXForceWindowCreation protocol reply. */
+typedef struct {
+    BYTE    type;               /* X_Reply */
+    CARD8   unused;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  status B32;
+    CARD32  pad0 B32;
+    CARD32  pad1 B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+} xDMXForceWindowCreationReply;
+#define sz_xDMXForceWindowCreationReply 32
+
+/** Wire-level description of DMXGetScreenCount protocol request. */
+typedef struct {
+    CARD8   reqType;            /* DMXCode */
+    CARD8   dmxReqType;         /* X_DMXGetScreenCount */
+    CARD16  length B16;
+} xDMXGetScreenCountReq;
+#define sz_xDMXGetScreenCountReq 4
+
+/** Wire-level description of DMXGetScreenCount protocol reply. */
+typedef struct {
+    BYTE    type;               /* X_Reply */
+    CARD8   unused;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  screenCount B32;
+    CARD32  pad0 B32;
+    CARD32  pad1 B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+} xDMXGetScreenCountReply;
+#define sz_xDMXGetScreenCountReply 32
+
+/** Wire-level description of DMXGetScreenAttributes protocol request. */
+typedef struct {
+    CARD8   reqType;            /* DMXCode */
+    CARD8   dmxReqType;         /* X_DMXGetScreenAttributes */
+    CARD16  length B16;
+    CARD32  physicalScreen B32;
+} xDMXGetScreenAttributesReq;
+#define sz_xDMXGetScreenAttributesReq 8
+
+/** Wire-level description of DMXGetScreenAttributes protocol reply. */
+typedef struct {
+    BYTE    type;               /* X_Reply */
+    CARD8   unused;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  displayNameLength B32;
+    CARD32  logicalScreen B32;
+
+    CARD16  screenWindowWidth B16;
+    CARD16  screenWindowHeight B16;
+    INT16   screenWindowXoffset B16;
+    INT16   screenWindowYoffset B16;
+
+    CARD16  rootWindowWidth B16;
+    CARD16  rootWindowHeight B16;
+    INT16   rootWindowXoffset B16;
+    INT16   rootWindowYoffset B16;
+    INT16   rootWindowXorigin B16;
+    INT16   rootWindowYorigin B16;
+} xDMXGetScreenAttributesReply;
+#define sz_xDMXGetScreenAttributesReply 36
+
+/** Wire-level description of DMXChangeScreensAttributes protocol request. */
+typedef struct {
+    CARD8   reqType;            /* DMXCode */
+    CARD8   dmxReqType;         /* X_DMXChangeScreensAttributes */
+    CARD16  length B16;
+    CARD32  screenCount B32;
+    CARD32  maskCount B32;
+} xDMXChangeScreensAttributesReq;
+#define sz_xDMXChangeScreensAttributesReq 12
+
+/** Wire-level description of DMXChangeScreensAttributes protocol reply. */
+typedef struct {
+    BYTE    type;               /* X_Reply */
+    CARD8   unused;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  status B32;
+    CARD32  errorScreen B32;
+    CARD32  pad0 B32;
+    CARD32  pad1 B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+} xDMXChangeScreensAttributesReply;
+#define sz_xDMXChangeScreensAttributesReply 32
+
+/** Wire-level description of DMXAddScreen protocol request. */
+typedef struct {
+    CARD8   reqType;            /* DMXCode */
+    CARD8   dmxReqType;         /* X_DMXAddScreen */
+    CARD16  length B16;
+    CARD32  displayNameLength B32;
+    CARD32  physicalScreen B32;
+    CARD32  valueMask B32;
+} xDMXAddScreenReq;
+#define sz_xDMXAddScreenReq 16
+
+/** Wire-level description of DMXAddScreen protocol reply. */
+typedef struct {
+    BYTE    type;               /* X_Reply */
+    CARD8   unused;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  status B32;
+    CARD32  physicalScreen B32;
+    CARD32  pad0 B32;
+    CARD32  pad1 B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+} xDMXAddScreenReply;
+#define sz_xDMXAddScreenReply 32
+
+/** Wire-level description of DMXRemoveScreen protocol request. */
+typedef struct {
+    CARD8   reqType;            /* DMXCode */
+    CARD8   dmxReqType;         /* X_DMXRemoveScreen */
+    CARD16  length B16;
+    CARD32  physicalScreen B32;
+} xDMXRemoveScreenReq;
+#define sz_xDMXRemoveScreenReq 8
+
+/** Wire-level description of DMXRemoveScreen protocol reply. */
+typedef struct {
+    BYTE    type;               /* X_Reply */
+    CARD8   unused;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  status B32;
+    CARD32  pad0 B32;
+    CARD32  pad1 B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+} xDMXRemoveScreenReply;
+#define sz_xDMXRemoveScreenReply 32
+
+/** Wire-level description of DMXGetWindowAttributes protocol request. */
+typedef struct {
+    CARD8   reqType;            /* DMXCode */
+    CARD8   dmxReqType;         /* X_DMXGetWindowAttributes */
+    CARD16  length B16;
+    CARD32  window B32;
+} xDMXGetWindowAttributesReq;
+#define sz_xDMXGetWindowAttributesReq 8
+
+/** Wire-level description of DMXGetWindowAttributes protocol reply. */
+typedef struct {
+    BYTE    type;               /* X_Reply */
+    CARD8   unused;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  screenCount B32;
+    CARD32  pad0 B32;
+    CARD32  pad1 B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+} xDMXGetWindowAttributesReply;
+#define sz_xDMXGetWindowAttributesReply 32
+
+/** Wire-level description of DMXGetDesktopAttributes protocol request. */
+typedef struct {
+    CARD8   reqType;            /* DMXCode */
+    CARD8   dmxReqType;         /* X_DMXGetDesktopAttributes */
+    CARD16  length B16;
+} xDMXGetDesktopAttributesReq;
+#define sz_xDMXGetDesktopAttributesReq 4
+
+/** Wire-level description of DMXGetDesktopAttributes protocol reply. */
+typedef struct {
+    BYTE    type;               /* X_Reply */
+    CARD8   unused;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    INT16   width;
+    INT16   height;
+    INT16   shiftX;
+    INT16   shiftY;
+    CARD32  pad0 B32;
+    CARD32  pad1 B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+} xDMXGetDesktopAttributesReply;
+#define sz_xDMXGetDesktopAttributesReply 32
+
+/** Wire-level description of DMXChangeDesktopAttributes protocol request. */
+typedef struct {
+    CARD8   reqType;            /* DMXCode */
+    CARD8   dmxReqType;         /* X_DMXChangeDesktopAttributes */
+    CARD16  length B16;
+    CARD32  valueMask B32;
+} xDMXChangeDesktopAttributesReq;
+#define sz_xDMXChangeDesktopAttributesReq 8
+
+/** Wire-level description of DMXChangeDesktopAttributes protocol reply. */
+typedef struct {
+    BYTE    type;               /* X_Reply */
+    CARD8   unused;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  status B32;
+    CARD32  pad0 B32;
+    CARD32  pad1 B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+} xDMXChangeDesktopAttributesReply;
+#define sz_xDMXChangeDesktopAttributesReply 32
+
+/** Wire-level description of DMXGetInputCount protocol request. */
+typedef struct {
+    CARD8   reqType;            /* DMXCode */
+    CARD8   dmxReqType;         /* X_DMXGetInputCount */
+    CARD16  length B16;
+} xDMXGetInputCountReq;
+#define sz_xDMXGetInputCountReq 4
+
+/** Wire-level description of DMXGetInputCount protocol reply. */
+typedef struct {
+    BYTE    type;               /* X_Reply */
+    CARD8   unused;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  inputCount B32;
+    CARD32  pad0 B32;
+    CARD32  pad1 B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+} xDMXGetInputCountReply;
+#define sz_xDMXGetInputCountReply 32
+
+/** Wire-level description of DMXGetInputAttributes protocol request. */
+typedef struct {
+    CARD8   reqType;            /* DMXCode */
+    CARD8   dmxReqType;         /* X_DMXGetInputAttributes */
+    CARD16  length B16;
+    CARD32  deviceId B32;
+} xDMXGetInputAttributesReq;
+#define sz_xDMXGetInputAttributesReq 8
+
+/** Wire-level description of DMXGetInputAttributes protocol reply. */
+typedef struct {
+    BYTE    type;               /* X_Reply */
+    CARD8   unused;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  inputType B32;
+    CARD32  physicalScreen B32;
+    CARD32  physicalId B32;
+    CARD32  nameLength B32;
+    BOOL    isCore;
+    BOOL    sendsCore;
+    BOOL    detached;
+    CARD8   pad0;
+    CARD32  pad1 B32;
+} xDMXGetInputAttributesReply;
+#define sz_xDMXGetInputAttributesReply 32
+
+/** Wire-level description of DMXAddInput protocol request. */
+typedef struct {
+    CARD8   reqType;            /* DMXCode */
+    CARD8   dmxReqType;         /* X_DMXAddInput */
+    CARD16  length B16;
+    CARD32  displayNameLength B32;
+    CARD32  valueMask;
+} xDMXAddInputReq;
+#define sz_xDMXAddInputReq 12
+
+/** Wire-level description of DMXAddInput protocol reply. */
+typedef struct {
+    BYTE    type;               /* X_Reply */
+    CARD8   unused;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  status B32;
+    CARD32  physicalId B32;
+    CARD32  pad0 B32;
+    CARD32  pad1 B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+} xDMXAddInputReply;
+#define sz_xDMXAddInputReply 32
+
+/** Wire-level description of DMXRemoveInput protocol request. */
+typedef struct {
+    CARD8   reqType;            /* DMXCode */
+    CARD8   dmxReqType;         /* X_DMXRemoveInput */
+    CARD16  length B16;
+    CARD32  physicalId B32;
+} xDMXRemoveInputReq;
+#define sz_xDMXRemoveInputReq 8
+
+/** Wire-level description of DMXRemoveInput protocol reply. */
+typedef struct {
+    BYTE     type;
+    CARD8    unused;
+    CARD16   sequenceNumber B16;
+    CARD32   length B32;
+    CARD32   status B32;
+    CARD32   pad0 B32;
+    CARD32   pad1 B32;
+    CARD32   pad2 B32;
+    CARD32   pad3 B32;
+    CARD32   pad4 B32;
+} xDMXRemoveInputReply;
+#define sz_xDMXRemoveInputReply 32
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/dpms.h b/ThirdParty/X11/Include/X11/extensions/dpms.h
new file mode 100644
index 0000000000000000000000000000000000000000..f85e6a725281028db8501f754e5501739bb0ce37
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/dpms.h
@@ -0,0 +1,53 @@
+/*****************************************************************
+
+Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of Digital Equipment Corporation
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from Digital
+Equipment Corporation.
+
+******************************************************************/
+
+#ifndef _X11_EXTENSIONS_DPMS_H
+#define _X11_EXTENSIONS_DPMS_H 1
+
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/extensions/dpmsconst.h>
+
+#ifndef DPMS_SERVER
+_XFUNCPROTOBEGIN
+
+extern Bool DPMSQueryExtension(Display *, int *, int *);
+extern Status DPMSGetVersion(Display *, int *, int *);
+extern Bool DPMSCapable(Display *);
+extern Status DPMSSetTimeouts(Display *, CARD16, CARD16, CARD16);
+extern Bool DPMSGetTimeouts(Display *, CARD16 *, CARD16 *, CARD16 *);
+extern Status DPMSEnable(Display *);
+extern Status DPMSDisable(Display *);
+extern Status DPMSForceLevel(Display *, CARD16);
+extern Status DPMSInfo(Display *, CARD16 *, BOOL *);
+
+_XFUNCPROTOEND
+#endif
+
+#endif /* !_X11_EXTENSIONS_DPMS_H */
+
diff --git a/ThirdParty/X11/Include/X11/extensions/dpmsconst.h b/ThirdParty/X11/Include/X11/extensions/dpmsconst.h
new file mode 100644
index 0000000000000000000000000000000000000000..75f05867773ac6d1b18e0e36091c6b8daa3028ad
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/dpmsconst.h
@@ -0,0 +1,43 @@
+/*****************************************************************
+
+Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of Digital Equipment Corporation
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from Digital
+Equipment Corporation.
+
+******************************************************************/
+
+#ifndef _DPMSCONST_H
+#define _DPMSCONST_H 1
+
+#define DPMSMajorVersion	1
+#define DPMSMinorVersion	1
+
+#define DPMSExtensionName	"DPMS"
+
+#define DPMSModeOn	0
+#define DPMSModeStandby	1
+#define DPMSModeSuspend	2
+#define DPMSModeOff	3
+
+#endif /* !_DPMSCONST_H */
+
diff --git a/ThirdParty/X11/Include/X11/extensions/dpmsproto.h b/ThirdParty/X11/Include/X11/extensions/dpmsproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..63fd3fc0ef6392f6c3cb8106baa77205bc726c98
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/dpmsproto.h
@@ -0,0 +1,175 @@
+/*****************************************************************
+
+Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of Digital Equipment Corporation
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from Digital
+Equipment Corporation.
+
+******************************************************************/
+
+#ifndef _DPMSPROTO_H_
+#define _DPMSPROTO_H_
+
+#include <X11/extensions/dpmsconst.h>
+
+#define X_DPMSGetVersion	0
+#define X_DPMSCapable		1
+#define X_DPMSGetTimeouts	2
+#define X_DPMSSetTimeouts	3
+#define X_DPMSEnable		4
+#define X_DPMSDisable		5
+#define X_DPMSForceLevel       	6
+#define X_DPMSInfo       	7
+
+#define DPMSNumberEvents	0
+
+#define DPMSNumberErrors	0
+
+
+typedef struct {
+    CARD8	reqType;	/* always DPMSCode */
+    CARD8	dpmsReqType;	/* always X_DPMSGetVersion */
+    CARD16	length B16;
+    CARD16	majorVersion B16;
+    CARD16	minorVersion B16;
+} xDPMSGetVersionReq;
+#define sz_xDPMSGetVersionReq 8
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	pad0;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	majorVersion B16;
+    CARD16	minorVersion B16;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xDPMSGetVersionReply;
+#define sz_xDPMSGetVersionReply 32
+
+typedef struct {
+    CARD8	reqType;	/* always DPMSCode */
+    CARD8	dpmsReqType;	/* always X_DPMSCapable */
+    CARD16	length B16;
+} xDPMSCapableReq;
+#define sz_xDPMSCapableReq 4
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	pad0;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    BOOL	capable;
+    CARD8	pad1;
+    CARD16	pad2 B16;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+    CARD32	pad7 B32;
+} xDPMSCapableReply;
+#define sz_xDPMSCapableReply 32
+
+typedef struct {
+    CARD8	reqType;	/* always DPMSCode */
+    CARD8	dpmsReqType;	/* always X_DPMSGetTimeouts */
+    CARD16	length B16;
+} xDPMSGetTimeoutsReq;
+#define sz_xDPMSGetTimeoutsReq 4
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	pad0;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	standby B16;
+    CARD16	suspend B16;
+    CARD16	off B16;
+    CARD16	pad1 B16;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xDPMSGetTimeoutsReply;
+#define sz_xDPMSGetTimeoutsReply 32
+
+typedef struct {
+    CARD8	reqType;	/* always DPMSCode */
+    CARD8	dpmsReqType;	/* always X_DPMSSetTimeouts */
+    CARD16	length B16;
+    CARD16	standby B16;
+    CARD16	suspend B16;
+    CARD16	off B16;
+    CARD16	pad0 B16;
+} xDPMSSetTimeoutsReq;
+#define sz_xDPMSSetTimeoutsReq 12
+
+typedef struct {
+    CARD8	reqType;	/* always DPMSCode */
+    CARD8	dpmsReqType;	/* always X_DPMSEnable */
+    CARD16	length B16;
+} xDPMSEnableReq;
+#define sz_xDPMSEnableReq 4
+
+typedef struct {
+    CARD8	reqType;	/* always DPMSCode */
+    CARD8	dpmsReqType;	/* always X_DPMSDisable */
+    CARD16	length B16;
+} xDPMSDisableReq;
+#define sz_xDPMSDisableReq 4
+
+typedef struct {
+    CARD8	reqType;	/* always DPMSCode */
+    CARD8	dpmsReqType;	/* always X_DPMSForceLevel */
+    CARD16	length B16;
+    CARD16	level B16;	/* power level requested */
+    CARD16	pad0 B16;
+} xDPMSForceLevelReq;
+#define sz_xDPMSForceLevelReq 8
+
+typedef struct {
+    CARD8	reqType;	/* always DPMSCode */
+    CARD8	dpmsReqType;	/* always X_DPMSInfo */
+    CARD16	length B16;
+} xDPMSInfoReq;
+#define sz_xDPMSInfoReq 4
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	pad0;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	power_level B16;
+    BOOL	state;
+    CARD8	pad1;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xDPMSInfoReply;
+#define sz_xDPMSInfoReply 32
+
+#endif /* _DPMSPROTO_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/dri2proto.h b/ThirdParty/X11/Include/X11/extensions/dri2proto.h
new file mode 100644
index 0000000000000000000000000000000000000000..128b807b12d225a8186c179ac2dac6d913ff638b
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/dri2proto.h
@@ -0,0 +1,357 @@
+/*
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Soft-
+ * ware"), to deal in the Software without restriction, including without
+ * limitation the rights to use, copy, modify, merge, publish, distribute,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, provided that the above copyright
+ * notice(s) and this permission notice appear in all copies of the Soft-
+ * ware and that both the above copyright notice(s) and this permission
+ * notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
+ * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
+ * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
+ * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
+ * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
+ * MANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder shall
+ * not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization of
+ * the copyright holder.
+ *
+ * Authors:
+ *   Kristian Høgsberg (krh@redhat.com)
+ */
+
+#ifndef _DRI2_PROTO_H_
+#define _DRI2_PROTO_H_
+
+#define DRI2_NAME			"DRI2"
+#define DRI2_MAJOR			1
+#define DRI2_MINOR			4
+
+#define DRI2NumberErrors		0
+#define DRI2NumberEvents		2
+#define DRI2NumberRequests		14
+
+#define X_DRI2QueryVersion		0
+#define X_DRI2Connect			1
+#define X_DRI2Authenticate		2
+#define X_DRI2CreateDrawable		3
+#define X_DRI2DestroyDrawable		4
+#define X_DRI2GetBuffers		5
+#define X_DRI2CopyRegion		6
+#define X_DRI2GetBuffersWithFormat	7
+#define X_DRI2SwapBuffers		8
+#define X_DRI2GetMSC			9
+#define X_DRI2WaitMSC			10
+#define X_DRI2WaitSBC			11
+#define X_DRI2SwapInterval		12
+#define X_DRI2GetParam			13
+
+/*
+ * Events
+ */
+#define DRI2_BufferSwapComplete	0
+#define DRI2_InvalidateBuffers	1
+
+typedef struct {
+    CARD32  attachment B32;
+    CARD32  name B32;
+    CARD32  pitch B32;
+    CARD32  cpp B32;
+    CARD32  flags B32;
+} xDRI2Buffer;
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri2ReqType;
+    CARD16  length B16;
+    CARD32  majorVersion B32;
+    CARD32  minorVersion B32;
+} xDRI2QueryVersionReq;
+#define sz_xDRI2QueryVersionReq   12
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  majorVersion B32;
+    CARD32  minorVersion B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+} xDRI2QueryVersionReply;
+#define sz_xDRI2QueryVersionReply	32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri2ReqType;
+    CARD16  length B16;
+    CARD32  window B32;
+    CARD32  driverType B32;
+} xDRI2ConnectReq;
+#define sz_xDRI2ConnectReq	12
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  driverNameLength B32;
+    CARD32  deviceNameLength B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+} xDRI2ConnectReply;
+#define sz_xDRI2ConnectReply	32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri2ReqType;
+    CARD16  length B16;
+    CARD32  window B32;
+    CARD32  magic B32;
+} xDRI2AuthenticateReq;
+#define sz_xDRI2AuthenticateReq   12
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  authenticated B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+    CARD32  pad6 B32;
+} xDRI2AuthenticateReply;
+#define sz_xDRI2AuthenticateReply	32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri2ReqType;
+    CARD16  length B16;
+    CARD32  drawable B32;
+} xDRI2CreateDrawableReq;
+#define sz_xDRI2CreateDrawableReq   8
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri2ReqType;
+    CARD16  length B16;
+    CARD32  drawable B32;
+} xDRI2DestroyDrawableReq;
+#define sz_xDRI2DestroyDrawableReq   8
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri2ReqType;
+    CARD16  length B16;
+    CARD32  drawable B32;
+    CARD32  count B32;
+} xDRI2GetBuffersReq;
+#define sz_xDRI2GetBuffersReq   12
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  width B32;
+    CARD32  height B32;
+    CARD32  count B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+} xDRI2GetBuffersReply;
+#define sz_xDRI2GetBuffersReply	32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri2ReqType;
+    CARD16  length B16;
+    CARD32  drawable B32;
+    CARD32  region B32;
+    CARD32  dest B32;
+    CARD32  src B32;
+} xDRI2CopyRegionReq;
+#define sz_xDRI2CopyRegionReq   20
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+    CARD32  pad6 B32;
+    CARD32  pad7 B32;
+} xDRI2CopyRegionReply;
+#define sz_xDRI2CopyRegionReply	32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri2ReqType;
+    CARD16  length B16;
+    CARD32  drawable B32;
+    CARD32  target_msc_hi B32;
+    CARD32  target_msc_lo B32;
+    CARD32  divisor_hi B32;
+    CARD32  divisor_lo B32;
+    CARD32  remainder_hi B32;
+    CARD32  remainder_lo B32;
+} xDRI2SwapBuffersReq;
+#define sz_xDRI2SwapBuffersReq  32
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  swap_hi B32;
+    CARD32  swap_lo B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+} xDRI2SwapBuffersReply;
+#define sz_xDRI2SwapBuffersReply 32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri2ReqType;
+    CARD16  length B16;
+    CARD32  drawable B32;
+} xDRI2GetMSCReq;
+#define sz_xDRI2GetMSCReq 8
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri2ReqType;
+    CARD16  length B16;
+    CARD32  drawable B32;
+    CARD32  target_msc_hi B32;
+    CARD32  target_msc_lo B32;
+    CARD32  divisor_hi B32;
+    CARD32  divisor_lo B32;
+    CARD32  remainder_hi B32;
+    CARD32  remainder_lo B32;
+} xDRI2WaitMSCReq;
+#define sz_xDRI2WaitMSCReq 32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri2ReqType;
+    CARD16  length B16;
+    CARD32  drawable B32;
+    CARD32  target_sbc_hi B32;
+    CARD32  target_sbc_lo B32;
+} xDRI2WaitSBCReq;
+#define sz_xDRI2WaitSBCReq 16
+
+typedef struct {
+    CARD8   type;
+    CARD8   pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  ust_hi B32;
+    CARD32  ust_lo B32;
+    CARD32  msc_hi B32;
+    CARD32  msc_lo B32;
+    CARD32  sbc_hi B32;
+    CARD32  sbc_lo B32;
+} xDRI2MSCReply;
+#define sz_xDRI2MSCReply 32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri2ReqType;
+    CARD16  length B16;
+    CARD32  drawable B32;
+    CARD32  interval B32;
+} xDRI2SwapIntervalReq;
+#define sz_xDRI2SwapIntervalReq 12
+
+typedef struct {
+    CARD8 type;
+    CARD8 pad;
+    CARD16 sequenceNumber B16;
+    CARD16 event_type B16;
+    CARD16 pad2;
+    CARD32 drawable B32;
+    CARD32 ust_hi B32;
+    CARD32 ust_lo B32;
+    CARD32 msc_hi B32;
+    CARD32 msc_lo B32;
+    CARD32 sbc_hi B32;
+    CARD32 sbc_lo B32;
+} xDRI2BufferSwapComplete;
+#define sz_xDRI2BufferSwapComplete 32
+
+typedef struct {
+    CARD8 type;
+    CARD8 pad;
+    CARD16 sequenceNumber B16;
+    CARD16 event_type B16;
+    CARD16 pad2;
+    CARD32 drawable B32;
+    CARD32 ust_hi B32;
+    CARD32 ust_lo B32;
+    CARD32 msc_hi B32;
+    CARD32 msc_lo B32;
+    CARD32 sbc B32;
+} xDRI2BufferSwapComplete2;
+#define sz_xDRI2BufferSwapComplete2 32
+
+typedef struct {
+    CARD8 type;
+    CARD8 pad;
+    CARD16 sequenceNumber B16;
+    CARD32 drawable B32;
+    CARD32 pad1 B32;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+} xDRI2InvalidateBuffers;
+#define sz_xDRI2InvalidateBuffers 32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri2ReqType;
+    CARD16  length B16;
+    CARD32  drawable B32;
+    CARD32  param B32;
+} xDRI2GetParamReq;
+#define sz_xDRI2GetParamReq 12
+
+typedef struct {
+    BYTE    type; /*X_Reply*/
+    BOOL    is_param_recognized;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  value_hi B32;
+    CARD32  value_lo B32;
+    CARD32  pad1 B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+} xDRI2GetParamReply;
+#define sz_xDRI2GetParamReply 32
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/dri2tokens.h b/ThirdParty/X11/Include/X11/extensions/dri2tokens.h
new file mode 100644
index 0000000000000000000000000000000000000000..bdca8665165a8b94039cce5155618571f931b7bc
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/dri2tokens.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Soft-
+ * ware"), to deal in the Software without restriction, including without
+ * limitation the rights to use, copy, modify, merge, publish, distribute,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, provided that the above copyright
+ * notice(s) and this permission notice appear in all copies of the Soft-
+ * ware and that both the above copyright notice(s) and this permission
+ * notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
+ * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
+ * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
+ * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
+ * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
+ * MANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder shall
+ * not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization of
+ * the copyright holder.
+ *
+ * Authors:
+ *   Kristian Høgsberg (krh@redhat.com)
+ */
+
+#ifndef _DRI2_TOKENS_H_
+#define _DRI2_TOKENS_H_
+
+#define DRI2BufferFrontLeft		0
+#define DRI2BufferBackLeft		1
+#define DRI2BufferFrontRight		2
+#define DRI2BufferBackRight		3
+#define DRI2BufferDepth			4
+#define DRI2BufferStencil		5
+#define DRI2BufferAccum			6
+#define DRI2BufferFakeFrontLeft		7
+#define DRI2BufferFakeFrontRight	8
+#define DRI2BufferDepthStencil		9
+#define DRI2BufferHiz			10
+
+/* keep bits 16 and above for prime IDs */
+#define DRI2DriverPrimeMask             7 /* 0 - 7 - allows for 6 devices*/
+#define DRI2DriverPrimeShift           16
+#define DRI2DriverPrimeId(x)         (((x) >> DRI2DriverPrimeShift) & (DRI2DriverPrimeMask))
+
+#define DRI2DriverDRI			0
+#define DRI2DriverVDPAU			1
+
+/* Event sub-types for the swap complete event */
+#define DRI2_EXCHANGE_COMPLETE		0x1
+#define DRI2_BLIT_COMPLETE		0x2
+#define DRI2_FLIP_COMPLETE		0x3
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/dri3proto.h b/ThirdParty/X11/Include/X11/extensions/dri3proto.h
new file mode 100644
index 0000000000000000000000000000000000000000..ceddee8ce6fcfae75fd79b2a286e5ca168041362
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/dri3proto.h
@@ -0,0 +1,167 @@
+/*
+ * Copyright © 2013 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _DRI3_PROTO_H_
+#define _DRI3_PROTO_H_
+
+#define DRI3_NAME			"DRI3"
+#define DRI3_MAJOR			1
+#define DRI3_MINOR			0
+
+#define DRI3NumberErrors		0
+#define DRI3NumberEvents		0
+
+#define X_DRI3QueryVersion		0
+#define X_DRI3Open			1
+#define X_DRI3PixmapFromBuffer          2
+#define X_DRI3BufferFromPixmap          3
+#define X_DRI3FenceFromFD               4
+#define X_DRI3FDFromFence               5
+
+#define DRI3NumberRequests		6
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri3ReqType;
+    CARD16  length B16;
+    CARD32  majorVersion B32;
+    CARD32  minorVersion B32;
+} xDRI3QueryVersionReq;
+#define sz_xDRI3QueryVersionReq   12
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  majorVersion B32;
+    CARD32  minorVersion B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+} xDRI3QueryVersionReply;
+#define sz_xDRI3QueryVersionReply	32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri3ReqType;
+    CARD16  length B16;
+    CARD32  drawable B32;
+    CARD32  provider B32;
+} xDRI3OpenReq;
+#define sz_xDRI3OpenReq	12
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    CARD8   nfd;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+    CARD32  pad6 B32;
+    CARD32  pad7 B32;
+} xDRI3OpenReply;
+#define sz_xDRI3OpenReply	32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri3ReqType;
+    CARD16  length B16;
+    CARD32  pixmap B32;
+    CARD32  drawable B32;
+    CARD32  size B32;
+    CARD16  width B16;
+    CARD16  height B16;
+    CARD16  stride B16;
+    CARD8   depth;
+    CARD8   bpp;
+} xDRI3PixmapFromBufferReq;
+
+#define sz_xDRI3PixmapFromBufferReq     24
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri3ReqType;
+    CARD16  length B16;
+    CARD32  pixmap B32;
+} xDRI3BufferFromPixmapReq;
+#define sz_xDRI3BufferFromPixmapReq     8
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    CARD8   nfd;    /* Number of file descriptors returned (1) */
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  size B32;
+    CARD16  width B16;
+    CARD16  height B16;
+    CARD16  stride B16;
+    CARD8   depth;
+    CARD8   bpp;
+    CARD32  pad20 B32;
+    CARD32  pad24 B32;
+    CARD32  pad28 B32;
+} xDRI3BufferFromPixmapReply;
+#define sz_xDRI3BufferFromPixmapReply   32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri3ReqType;
+    CARD16  length B16;
+    CARD32  drawable B32;
+    CARD32  fence B32;
+    BOOL    initially_triggered;
+    CARD8   pad13;
+    CARD16  pad14 B16;
+} xDRI3FenceFromFDReq;
+
+#define sz_xDRI3FenceFromFDReq  16
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri3ReqType;
+    CARD16  length B16;
+    CARD32  drawable B32;
+    CARD32  fence B32;
+} xDRI3FDFromFenceReq;
+
+#define sz_xDRI3FDFromFenceReq  12
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    CARD8   nfd;    /* Number of file descriptors returned (1) */
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  pad08 B32;
+    CARD32  pad12 B32;
+    CARD32  pad16 B32;
+    CARD32  pad20 B32;
+    CARD32  pad24 B32;
+    CARD32  pad28 B32;
+} xDRI3FDFromFenceReply;
+
+#define sz_xDRI3FDFromFenceReply   32
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/evieproto.h b/ThirdParty/X11/Include/X11/extensions/evieproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..649c91adbf2b8a348de334c3261d2eabd9bc3344
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/evieproto.h
@@ -0,0 +1,156 @@
+/************************************************************
+
+Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+************************************************************/
+
+#ifndef _XEVIEPROTO_H_
+#define _XEVIEPROTO_H_
+
+#define XEVIENAME "XEVIE"
+
+#define XEVIE_MAJOR_VERSION 1
+#define XEVIE_MINOR_VERSION 0
+
+#define X_XevieQueryVersion			0
+#define X_XevieStart				1
+#define X_XevieEnd				2
+#define X_XevieSend				3
+#define X_XevieSelectInput			4
+
+#define XevieNumberErrors			0
+
+typedef struct _XevieQueryVersion {
+    CARD8   reqType;
+    CARD8   xevieReqType;
+    CARD16  length B16;
+    CARD16  client_major_version B16;
+    CARD16  client_minor_version B16;
+} xXevieQueryVersionReq;
+#define sz_xXevieQueryVersionReq            8
+
+typedef struct {
+    BYTE    type;
+    BOOL    pad1;
+    CARD16  sequence_number B16;
+    CARD32  length B32;
+    CARD16  server_major_version B16;
+    CARD16  server_minor_version B16;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+    CARD32  pad6 B32;
+} xXevieQueryVersionReply;
+#define sz_xXevieQueryVersionReply  32
+
+typedef struct _XevieStart {
+    CARD8   reqType;
+    CARD8   xevieReqType;
+    CARD16  length B16;
+    CARD32  screen B32;
+} xXevieStartReq;
+#define sz_xXevieStartReq 8
+
+typedef struct {
+    BYTE    type;
+    BOOL    pad1;
+    CARD16  sequence_number B16;
+    CARD32  length B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+    CARD32  pad6 B32;
+    CARD32  pad7 B32;
+} xXevieStartReply;
+#define sz_xXevieStartReply         32
+
+typedef struct _XevieEnd {
+    CARD8   reqType;
+    CARD8   xevieReqType;
+    CARD16  length B16;
+    CARD32  cmap B32;
+} xXevieEndReq;
+#define sz_xXevieEndReq             8
+
+typedef struct {
+    BYTE    type;           /* X_Reply */
+    BOOL    pad1;
+    CARD16  sequence_number B16;
+    CARD32  length B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+    CARD32  pad6 B32;
+    CARD32  pad7 B32;
+} xXevieEndReply;
+#define sz_xXevieEndReply   32
+
+typedef struct _XevieSend {
+    CARD8       reqType;
+    CARD8       xevieReqType;
+    CARD16      length B16;
+    xEvent      event;
+    CARD32      dataType B32;
+} xXevieSendReq;
+#define sz_xXevieSendReq           104
+
+typedef struct {
+    BYTE        type;
+    BOOL        pad1;
+    CARD16      sequence_number B16;
+    CARD32      length B32;
+    CARD32      pad2 B32;
+    CARD32      pad3 B32;
+    CARD32      pad4 B32;
+    CARD32      pad5 B32;
+    CARD32      pad6 B32;
+    CARD32      pad7 B32;
+} xXevieSendReply;
+#define sz_xXevieSendReply        32
+
+typedef struct _XevieSelectInput {
+    CARD8  reqType;
+    CARD8  xevieReqType;
+    CARD16      length B16;
+    CARD32 event_mask B32;
+} xXevieSelectInputReq;
+#define sz_xXevieSelectInputReq          8
+
+typedef struct {
+    BYTE   type;
+    BOOL   pad1;
+    CARD16 sequence_number B16;
+    CARD32 length B32;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    CARD32 pad7 B32;
+} xXevieSelectInputReply;
+#define sz_xXevieSelectInputReply        32
+
+#endif /* } _XEVIEPROTO_H_ */
+
diff --git a/ThirdParty/X11/Include/X11/extensions/extutil.h b/ThirdParty/X11/Include/X11/extensions/extutil.h
new file mode 100644
index 0000000000000000000000000000000000000000..b22843068ff60bbad21b0b608786d66a78a52fdc
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/extutil.h
@@ -0,0 +1,190 @@
+/*
+ *
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author:  Jim Fulton, MIT The Open Group
+ *
+ *                     Xlib Extension-Writing Utilities
+ *
+ * This package contains utilities for writing the client API for various
+ * protocol extensions.  THESE INTERFACES ARE NOT PART OF THE X STANDARD AND
+ * ARE SUBJECT TO CHANGE!
+ */
+
+#ifndef _EXTUTIL_H_
+#define _EXTUTIL_H_
+
+#include <X11/extensions/Xext.h>
+
+/*
+ * We need to keep a list of open displays since the Xlib display list isn't
+ * public.  We also have to per-display info in a separate block since it isn't
+ * stored directly in the Display structure.
+ */
+typedef struct _XExtDisplayInfo {
+    struct _XExtDisplayInfo *next;	/* keep a linked list */
+    Display *display;			/* which display this is */
+    XExtCodes *codes;			/* the extension protocol codes */
+    XPointer data;			/* extra data for extension to use */
+} XExtDisplayInfo;
+
+typedef struct _XExtensionInfo {
+    XExtDisplayInfo *head;		/* start of list */
+    XExtDisplayInfo *cur;		/* most recently used */
+    int ndisplays;			/* number of displays */
+} XExtensionInfo;
+
+typedef struct _XExtensionHooks {
+    int (*create_gc)(
+	      Display*			/* display */,
+	      GC			/* gc */,
+	      XExtCodes*		/* codes */
+);
+    int (*copy_gc)(
+	      Display*			/* display */,
+              GC			/* gc */,
+              XExtCodes*		/* codes */
+);
+    int (*flush_gc)(
+	      Display*			/* display */,
+              GC			/* gc */,
+              XExtCodes*		/* codes */
+);
+    int (*free_gc)(
+	      Display*			/* display */,
+              GC			/* gc */,
+              XExtCodes*		/* codes */
+);
+    int (*create_font)(
+	      Display*			/* display */,
+              XFontStruct*		/* fs */,
+              XExtCodes*		/* codes */
+);
+    int (*free_font)(
+	      Display*			/* display */,
+              XFontStruct*		/* fs */,
+              XExtCodes*		/* codes */
+);
+    int (*close_display)(
+	      Display*			/* display */,
+              XExtCodes*		/* codes */
+);
+    Bool (*wire_to_event)(
+	       Display*			/* display */,
+               XEvent*			/* re */,
+               xEvent*			/* event */
+);
+    Status (*event_to_wire)(
+	      Display*			/* display */,
+              XEvent*			/* re */,
+              xEvent*			/* event */
+);
+    int (*error)(
+	      Display*			/* display */,
+              xError*			/* err */,
+              XExtCodes*		/* codes */,
+              int*			/* ret_code */
+);
+    char *(*error_string)(
+	        Display*		/* display */,
+                int			/* code */,
+                XExtCodes*		/* codes */,
+                char*			/* buffer */,
+                int			/* nbytes */
+);
+} XExtensionHooks;
+
+extern XExtensionInfo *XextCreateExtension(
+    void
+);
+extern void XextDestroyExtension(
+    XExtensionInfo*	/* info */
+);
+extern XExtDisplayInfo *XextAddDisplay(
+    XExtensionInfo*	/* extinfo */,
+    Display*		/* dpy */,
+    _Xconst char*	/* ext_name */,
+    XExtensionHooks*	/* hooks */,
+    int			/* nevents */,
+    XPointer		/* data */
+);
+extern int XextRemoveDisplay(
+    XExtensionInfo*	/* extinfo */,
+    Display*		/* dpy */
+);
+extern XExtDisplayInfo *XextFindDisplay(
+    XExtensionInfo*	/* extinfo */,
+    Display*		/* dpy */
+);
+
+#define XextHasExtension(i) ((i) && ((i)->codes))
+#define XextCheckExtension(dpy,i,name,val) \
+  if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return val; }
+#define XextSimpleCheckExtension(dpy,i,name) \
+  if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; }
+
+
+/*
+ * helper macros to generate code that is common to all extensions; caller
+ * should prefix it with static if extension source is in one file; this
+ * could be a utility function, but have to stack 6 unused arguments for
+ * something that is called many, many times would be bad.
+ */
+#define XEXT_GENERATE_FIND_DISPLAY(proc,extinfo,extname,hooks,nev,data) \
+XExtDisplayInfo *proc (Display *dpy) \
+{ \
+    XExtDisplayInfo *dpyinfo; \
+    if (!extinfo) { if (!(extinfo = XextCreateExtension())) return NULL; } \
+    if (!(dpyinfo = XextFindDisplay (extinfo, dpy))) \
+      dpyinfo = XextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \
+    return dpyinfo; \
+}
+
+#define XEXT_FIND_DISPLAY_PROTO(proc) \
+	XExtDisplayInfo *proc(Display *dpy)
+
+#define XEXT_GENERATE_CLOSE_DISPLAY(proc,extinfo) \
+int proc (Display *dpy, XExtCodes *codes) \
+{ \
+    return XextRemoveDisplay (extinfo, dpy); \
+}
+
+#define XEXT_CLOSE_DISPLAY_PROTO(proc) \
+	int proc(Display *dpy, XExtCodes *codes)
+
+#define XEXT_GENERATE_ERROR_STRING(proc,extname,nerr,errl) \
+char *proc (Display *dpy, int code, XExtCodes *codes, char *buf, int n) \
+{  \
+    code -= codes->first_error;  \
+    if (code >= 0 && code < nerr) { \
+	char tmp[256]; \
+	snprintf (tmp, sizeof(tmp), "%s.%d", extname, code);            \
+	XGetErrorDatabaseText (dpy, "XProtoError", tmp, errl[code], buf, n); \
+	return buf; \
+    } \
+    return (char *)0; \
+}
+
+#define XEXT_ERROR_STRING_PROTO(proc) \
+	char *proc(Display *dpy, int code, XExtCodes *codes, char *buf, int n)
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/ge.h b/ThirdParty/X11/Include/X11/extensions/ge.h
new file mode 100644
index 0000000000000000000000000000000000000000..aca1d8a241c5ec0951cfbdbc9734a4905d09c523
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/ge.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright © 2007-2008 Peter Hutterer
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Peter Hutterer, University of South Australia, NICTA
+ *
+ */
+
+#ifndef _GE_H_
+#define _GE_H_
+
+#define GE_NAME         "Generic Event Extension"
+#define GE_MAJOR        1
+#define GE_MINOR        0
+
+/*********************************************************
+ *
+ * Requests
+ *
+ */
+
+#define X_GEQueryVersion        0
+
+#define GENumberRequests       (X_GEQueryVersion + 1)
+
+/*********************************************************
+ *
+ * Events
+ *
+ */
+
+#define GENumberEvents        0
+
+/*********************************************************
+ *
+ * Errors
+ *
+ */
+
+#define GENumberErrors        0
+
+#endif /* _GE_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/geproto.h b/ThirdParty/X11/Include/X11/extensions/geproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..c8860dd87edddf02469ba8231ea4ab6bb8d5ef78
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/geproto.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright © 2007-2008 Peter Hutterer
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Peter Hutterer, University of South Australia, NICTA
+ *
+ */
+
+#ifndef _GEPROTO_H_
+#define _GEPROTO_H_
+
+#include<X11/Xproto.h>
+#include<X11/X.h>
+#include<X11/extensions/ge.h>
+
+
+/*********************************************************
+ *
+ * Protocol request constants
+ *
+ */
+
+#define X_GEGetExtensionVersion 1
+
+/*********************************************************
+ *
+ * XGE protocol requests/replies
+ *
+ */
+
+/* generic request */
+typedef struct {
+    CARD8   reqType;
+    CARD8   ReqType;
+    CARD16  length B16;
+} xGEReq;
+
+
+/* QueryVersion */
+typedef struct {
+    CARD8	reqType;       /* input extension major code   */
+    CARD8	ReqType;       /* always X_GEQueryVersion */
+    CARD16	length B16;
+    CARD16      majorVersion B16;
+    CARD16      minorVersion B16;
+} xGEQueryVersionReq;
+
+#define sz_xGEQueryVersionReq    8
+
+typedef struct {
+    CARD8	repType;	/* X_Reply			*/
+    CARD8	RepType;	/* always X_GEQueryVersion */
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	majorVersion B16;
+    CARD16	minorVersion B16;
+    CARD32	pad00 B32;
+    CARD32	pad01 B32;
+    CARD32	pad02 B32;
+    CARD32	pad03 B32;
+    CARD32	pad04 B32;
+} xGEQueryVersionReply;
+
+#define sz_xGEQueryVersionReply    32
+
+#endif /* _GEPROTO_H_ */
+
diff --git a/ThirdParty/X11/Include/X11/extensions/lbx.h b/ThirdParty/X11/Include/X11/extensions/lbx.h
new file mode 100644
index 0000000000000000000000000000000000000000..ecd24ff1fa5127aec70687fd44f1a6b789cdea9d
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/lbx.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright 1992 Network Computing Devices
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of NCD. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  NCD. makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifndef _LBX_H_
+#define _LBX_H_
+
+#define LBXNAME "LBX"
+
+#define LBX_MAJOR_VERSION	1
+#define LBX_MINOR_VERSION	0
+
+#define LbxNumberReqs			44
+#define LbxEvent			0
+#define LbxQuickMotionDeltaEvent	1
+#define LbxNumberEvents			2
+
+/* This is always the master client */
+#define LbxMasterClientIndex		0
+
+/* LbxEvent lbxType sub-fields */
+#define LbxSwitchEvent			0
+#define LbxCloseEvent			1
+#define LbxDeltaEvent			2
+#define LbxInvalidateTagEvent		3
+#define LbxSendTagDataEvent		4
+#define LbxListenToOne			5
+#define LbxListenToAll			6
+#define LbxMotionDeltaEvent		7
+#define LbxReleaseCmapEvent		8
+#define LbxFreeCellsEvent		9
+
+/*
+ * Lbx image compression methods
+ *
+ * No compression is always assigned the value of 0.
+ *
+ * The rest of the compression method opcodes are assigned dynamically
+ * at option negotiation time.
+ */
+
+#define LbxImageCompressNone		0
+
+
+#define BadLbxClient			0
+#define LbxNumberErrors			(BadLbxClient + 1)
+
+/* tagged data types */
+#define	LbxTagTypeModmap		1
+#define	LbxTagTypeKeymap		2
+#define	LbxTagTypeProperty		3
+#define	LbxTagTypeFont			4
+#define	LbxTagTypeConnInfo		5
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/lbxproto.h b/ThirdParty/X11/Include/X11/extensions/lbxproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..a1ae62ba4b04c75312d3da09316d1405c8ee3591
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/lbxproto.h
@@ -0,0 +1,975 @@
+/*
+ * Copyright 1992 Network Computing Devices
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of NCD. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  NCD. makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifndef _LBXPROTO_H_
+#define _LBXPROTO_H_
+
+#include <X11/extensions/lbx.h>
+/*
+ * NOTE:  any changes or additions to the opcodes needs to be reflected
+ * in the lbxCacheable array in Xserver/lbx/lbxmain.c
+ */
+
+#define X_LbxQueryVersion		0
+#define X_LbxStartProxy			1
+#define X_LbxStopProxy			2
+#define X_LbxSwitch			3
+#define X_LbxNewClient			4
+#define X_LbxCloseClient		5
+#define X_LbxModifySequence		6
+#define X_LbxAllowMotion		7
+#define X_LbxIncrementPixel		8
+#define X_LbxDelta			9
+#define	X_LbxGetModifierMapping		10
+#define	X_LbxInvalidateTag		12
+#define X_LbxPolyPoint			13
+#define X_LbxPolyLine			14
+#define X_LbxPolySegment		15
+#define X_LbxPolyRectangle		16
+#define X_LbxPolyArc			17
+#define X_LbxFillPoly			18
+#define X_LbxPolyFillRectangle		19
+#define X_LbxPolyFillArc		20
+#define	X_LbxGetKeyboardMapping		21
+#define	X_LbxQueryFont			22
+#define	X_LbxChangeProperty		23
+#define	X_LbxGetProperty		24
+#define	X_LbxTagData			25
+
+#define X_LbxCopyArea			26
+#define X_LbxCopyPlane			27
+#define X_LbxPolyText8			28
+#define X_LbxPolyText16			29
+#define X_LbxImageText8			30
+#define X_LbxImageText16		31
+
+#define X_LbxQueryExtension		32
+#define X_LbxPutImage			33
+#define X_LbxGetImage			34
+
+#define X_LbxBeginLargeRequest		35
+#define X_LbxLargeRequestData		36
+#define X_LbxEndLargeRequest		37
+
+#define X_LbxInternAtoms		38
+#define X_LbxGetWinAttrAndGeom		39
+
+#define X_LbxGrabCmap			40
+#define X_LbxReleaseCmap		41
+#define X_LbxAllocColor			42
+
+#define X_LbxSync			43
+
+/*
+ * Redefine some basic types used by structures defined herein.  This removes
+ * any possibility on 64-bit architectures of one entity viewing communicated
+ * data as 32-bit quantities and another entity viewing the same data as 64-bit
+ * quantities.
+ */
+#define XID CARD32
+#define Atom CARD32
+#define Colormap CARD32
+#define Drawable CARD32
+#define VisualID CARD32
+#define Window CARD32
+
+typedef struct {
+    BOOL	success;		/* TRUE */
+    BOOL	changeType;
+    CARD16	majorVersion B16,
+		minorVersion B16;
+    CARD16	length B16;		/* 1/4 additional bytes in setup info */
+    CARD32	tag B32;
+} xLbxConnSetupPrefix;
+
+typedef struct _LbxQueryVersion {
+    CARD8	reqType;		/* always LbxReqCode */
+    CARD8	lbxReqType;		/* always X_LbxQueryVersion */
+    CARD16	length B16;
+} xLbxQueryVersionReq;
+#define sz_xLbxQueryVersionReq	4
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	unused;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	majorVersion B16;	/* major version of LBX protocol */
+    CARD16	minorVersion B16;	/* minor version of LBX protocol */
+    CARD32	pad0 B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+} xLbxQueryVersionReply;
+#define sz_xLbxQueryVersionReply	32
+
+typedef struct _LbxStartProxy {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxStartProxy */
+    CARD16	length B16;
+} xLbxStartProxyReq;
+#define sz_xLbxStartProxyReq	    4
+
+typedef struct _LbxStopProxy {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxStopProxy */
+    CARD16	length B16;
+} xLbxStopProxyReq;
+#define sz_xLbxStopProxyReq	    4
+
+typedef struct _LbxSwitch {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxSwitch */
+    CARD16	length B16;
+    CARD32	client B32;	/* new client */
+} xLbxSwitchReq;
+#define sz_xLbxSwitchReq	8
+
+typedef struct _LbxNewClient {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxNewClient */
+    CARD16	length B16;
+    CARD32	client B32;	/* new client */
+} xLbxNewClientReq;
+#define sz_xLbxNewClientReq	8
+
+typedef struct _LbxCloseClient {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxCloseClient */
+    CARD16	length B16;
+    CARD32	client B32;	/* new client */
+} xLbxCloseClientReq;
+#define sz_xLbxCloseClientReq	8
+
+typedef struct _LbxModifySequence {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxModifySequence */
+    CARD16	length B16;
+    CARD32	adjust B32;
+} xLbxModifySequenceReq;
+#define sz_xLbxModifySequenceReq    8
+
+typedef struct _LbxAllowMotion {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxAllowMotion */
+    CARD16	length B16;
+    CARD32	num B32;
+} xLbxAllowMotionReq;
+#define sz_xLbxAllowMotionReq    8
+
+typedef struct {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxGrabCmap */
+    CARD16	length B16;
+    Colormap	cmap B32;
+} xLbxGrabCmapReq;
+#define sz_xLbxGrabCmapReq	8
+
+#define LBX_SMART_GRAB		0x80
+#define LBX_AUTO_RELEASE	0x40
+#define LBX_3CHANNELS		0x20
+#define LBX_2BYTE_PIXELS	0x10
+#define LBX_RGB_BITS_MASK	0x0f
+
+#define LBX_LIST_END		0
+#define LBX_PIXEL_PRIVATE	1
+#define LBX_PIXEL_SHARED	2
+#define LBX_PIXEL_RANGE_PRIVATE	3
+#define LBX_PIXEL_RANGE_SHARED	4
+#define LBX_NEXT_CHANNEL	5
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	flags;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	pad0 B16;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B16;
+} xLbxGrabCmapReply;
+#define sz_xLbxGrabCmapReply	32
+#define sz_xLbxGrabCmapReplyHdr	8
+
+
+typedef struct {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxReleaseCmap */
+    CARD16	length B16;
+    Colormap	cmap B32;
+} xLbxReleaseCmapReq;
+#define sz_xLbxReleaseCmapReq	8
+
+typedef struct {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxAllocColor */
+    CARD16	length B16;
+    Colormap	cmap B32;
+    CARD32	pixel B32;
+    CARD16	red B16, green B16, blue B16;
+    CARD16	pad B16;
+} xLbxAllocColorReq;
+#define sz_xLbxAllocColorReq	20
+
+typedef struct _LbxIncrementPixel {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxIncrementPixel */
+    CARD16	length B16;
+    CARD32	cmap B32;
+    CARD32	pixel B32;
+} xLbxIncrementPixelReq;
+#define sz_xLbxIncrementPixelReq    12
+
+typedef struct _LbxDelta {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxDelta */
+    CARD16	length B16;
+    CARD8	diffs;		/* number of diffs */
+    CARD8	cindex;		/* cache index */
+				/* list of diffs follows */
+} xLbxDeltaReq;
+#define sz_xLbxDeltaReq    6
+
+typedef struct _LbxGetModifierMapping {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxGetModifierMapping */
+    CARD16	length B16;
+} xLbxGetModifierMappingReq;
+#define	sz_xLbxGetModifierMappingReq	4
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	keyspermod;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	tag B32;
+    CARD32	pad0 B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+} xLbxGetModifierMappingReply;
+#define sz_xLbxGetModifierMappingReply	32
+
+typedef struct _LbxGetKeyboardMapping {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxGetKeyboardMapping */
+    CARD16	length B16;
+    KeyCode	firstKeyCode;
+    CARD8	count;
+    CARD16	pad1 B16;
+} xLbxGetKeyboardMappingReq;
+#define	sz_xLbxGetKeyboardMappingReq	8
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	keysperkeycode;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	tag B32;
+    CARD32	pad0 B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+} xLbxGetKeyboardMappingReply;
+#define sz_xLbxGetKeyboardMappingReply	32
+
+typedef struct _LbxQueryFont {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxQueryFont */
+    CARD16	length B16;
+    CARD32	fid B32;
+} xLbxQueryFontReq;
+#define	sz_xLbxQueryFontReq	8
+
+typedef struct _LbxInternAtoms {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxInternAtoms */
+    CARD16	length B16;
+    CARD16	num B16;
+} xLbxInternAtomsReq;
+#define sz_xLbxInternAtomsReq	6
+
+typedef struct {
+    BYTE	type;		/* X_Reply */
+    CARD8	unused;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	atomsStart B32;
+    CARD32	pad0 B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+} xLbxInternAtomsReply;
+#define sz_xLbxInternAtomsReply		32
+#define sz_xLbxInternAtomsReplyHdr	8
+
+
+typedef struct _LbxGetWinAttrAndGeom {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxGetWinAttrAndGeom */
+    CARD16	length B16;
+    CARD32	id B32;		/* window id */
+} xLbxGetWinAttrAndGeomReq;
+#define sz_xLbxGetWinAttrAndGeomReq 8
+
+typedef struct {
+    BYTE type;  /* X_Reply */
+    CARD8 backingStore;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;	/* NOT 0; this is an extra-large reply */
+    VisualID visualID B32;
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD16 c_class B16;
+#else
+    CARD16 class B16;
+#endif
+    CARD8 bitGravity;
+    CARD8 winGravity;
+    CARD32 backingBitPlanes B32;
+    CARD32 backingPixel B32;
+    BOOL saveUnder;
+    BOOL mapInstalled;
+    CARD8 mapState;
+    BOOL override;
+    Colormap colormap B32;
+    CARD32 allEventMasks B32;
+    CARD32 yourEventMask B32;
+    CARD16 doNotPropagateMask B16;
+    CARD16 pad1 B16;
+    Window root B32;
+    INT16 x B16, y B16;
+    CARD16 width B16, height B16;
+    CARD16 borderWidth B16;
+    CARD8 depth;
+    CARD8 pad2;
+} xLbxGetWinAttrAndGeomReply;
+#define sz_xLbxGetWinAttrAndGeomReply 60
+
+
+typedef struct {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxSync */
+    CARD16	length B16;
+} xLbxSyncReq;
+#define sz_xLbxSyncReq	4
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	pad0;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xLbxSyncReply;
+#define sz_xLbxSyncReply 32
+
+
+/* an LBX squished charinfo packs the data in a CARD32 as follows */
+#define	LBX_WIDTH_SHIFT		26
+#define	LBX_LEFT_SHIFT		20
+#define	LBX_RIGHT_SHIFT		13
+#define	LBX_ASCENT_SHIFT	7
+#define	LBX_DESCENT_SHIFT	0
+
+#define	LBX_WIDTH_BITS		6
+#define	LBX_LEFT_BITS		6
+#define	LBX_RIGHT_BITS		7
+#define	LBX_ASCENT_BITS		6
+#define	LBX_DESCENT_BITS	7
+
+#define	LBX_WIDTH_MASK		0xfc000000
+#define	LBX_LEFT_MASK		0x03f00000
+#define	LBX_RIGHT_MASK		0x000fe000
+#define	LBX_ASCENT_MASK		0x00001f80
+#define	LBX_DESCENT_MASK	0x0000007f
+
+#define	LBX_MASK_BITS(val, n)	((unsigned int) ((val) & ((1 << (n)) - 1)))
+
+typedef struct {
+    CARD32	metrics B32;
+} xLbxCharInfo;
+
+/* note that this is identical to xQueryFontReply except for missing
+ * first 2 words
+ */
+typedef struct {
+    xCharInfo minBounds;
+/* XXX do we need to leave this gunk? */
+#ifndef WORD64
+    CARD32 walign1 B32;
+#endif
+    xCharInfo maxBounds;
+#ifndef WORD64
+    CARD32 walign2 B32;
+#endif
+    CARD16 minCharOrByte2 B16, maxCharOrByte2 B16;
+    CARD16 defaultChar B16;
+    CARD16 nFontProps B16;  /* followed by this many xFontProp structures */
+    CARD8 drawDirection;
+    CARD8 minByte1, maxByte1;
+    BOOL allCharsExist;
+    INT16 fontAscent B16, fontDescent B16;
+    CARD32 nCharInfos B32; /* followed by this many xLbxCharInfo structures */
+} xLbxFontInfo;
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	compression;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	tag B32;
+    CARD32	pad0 B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    /* X_QueryFont sticks much of the data in the base reply packet,
+     * but we hope that it won't be needed, (and it won't fit in 32 bytes
+     * with the tag anyways)
+     *
+     * if any additional data is needed, its sent in a xLbxFontInfo
+     */
+} xLbxQueryFontReply;
+#define sz_xLbxQueryFontReply	32
+
+typedef struct _LbxChangeProperty {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxChangeProperty */
+    CARD16	length B16;
+    Window	window B32;
+    Atom	property B32;
+    Atom	type B32;
+    CARD8	format;
+    CARD8	mode;
+    BYTE	pad[2];
+    CARD32	nUnits B32;
+} xLbxChangePropertyReq;
+#define	sz_xLbxChangePropertyReq	24
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	pad;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	tag B32;
+    CARD32	pad0 B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+} xLbxChangePropertyReply;
+#define sz_xLbxChangePropertyReply	32
+
+typedef struct _LbxGetProperty {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxGetProperty */
+    CARD16	length B16;
+    Window	window B32;
+    Atom	property B32;
+    Atom	type B32;
+    CARD8	delete;
+    BYTE	pad[3];
+    CARD32	longOffset B32;
+    CARD32	longLength B32;
+} xLbxGetPropertyReq;
+#define	sz_xLbxGetPropertyReq	28
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	format;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    Atom	propertyType B32;
+    CARD32	bytesAfter B32;
+    CARD32	nItems B32;
+    CARD32	tag B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+} xLbxGetPropertyReply;
+#define sz_xLbxGetPropertyReply	32
+
+typedef struct _LbxTagData {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxTagData */
+    CARD16	length B16;
+    XID		tag B32;
+    CARD32	real_length B32;
+    /* data */
+} xLbxTagDataReq;
+#define	sz_xLbxTagDataReq	12
+
+typedef struct _LbxInvalidateTag {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxInvalidateTag */
+    CARD16	length B16;
+    CARD32	tag B32;
+} xLbxInvalidateTagReq;
+#define	sz_xLbxInvalidateTagReq	8
+
+typedef struct _LbxPutImage {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxPutImage */
+    CARD16	length B16;
+    CARD8	compressionMethod;
+    CARD8	cacheEnts;
+    CARD8	bitPacked;
+    /* rest is variable */
+} xLbxPutImageReq;
+#define sz_xLbxPutImageReq	7
+
+typedef struct {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxGetImage */
+    CARD16	length B16;
+    Drawable	drawable B32;
+    INT16	x B16, y B16;
+    CARD16	width B16, height B16;
+    CARD32	planeMask B32;
+    CARD8	format;
+    CARD8	pad1;
+    CARD16	pad2 B16;
+} xLbxGetImageReq;
+
+#define sz_xLbxGetImageReq 24
+
+typedef struct {
+    BYTE type;			/* X_Reply */
+    CARD8 depth;
+    CARD16 sequenceNumber B16;
+    CARD32 lbxLength B32;
+    CARD32 xLength B32;
+    VisualID visual B32;
+    CARD8 compressionMethod;
+    CARD8 pad1;
+    CARD16 pad2 B16;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+} xLbxGetImageReply;
+
+#define sz_xLbxGetImageReply 32
+
+/* Following used for LbxPolyPoint, LbxPolyLine, LbxPolySegment,
+   LbxPolyRectangle, LbxPolyArc, LbxPolyFillRectangle and LbxPolyFillArc */
+
+#define GFX_CACHE_SIZE  15
+
+#define GFXdCacheEnt(e)	    ((e) & 0xf)
+#define GFXgCacheEnt(e)	    (((e) >> 4) & 0xf)
+#define GFXCacheEnts(d,g)   (((d) & 0xf) | (((g) & 0xf) << 4))
+
+#define GFXCacheNone   0xf
+
+typedef struct _LbxPolyPoint {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;
+    CARD16	length B16;
+    CARD8	cacheEnts;
+    CARD8	padBytes;
+} xLbxPolyPointReq;
+
+#define sz_xLbxPolyPointReq	6
+
+typedef xLbxPolyPointReq xLbxPolyLineReq;
+typedef xLbxPolyPointReq xLbxPolySegmentReq;
+typedef xLbxPolyPointReq xLbxPolyRectangleReq;
+typedef xLbxPolyPointReq xLbxPolyArcReq;
+typedef xLbxPolyPointReq xLbxPolyFillRectangleReq;
+typedef xLbxPolyPointReq xLbxPolyFillArcReq;
+
+#define sz_xLbxPolyLineReq		sz_xLbxPolyPointReq
+#define sz_xLbxPolySegmentReq		sz_xLbxPolyPointReq
+#define sz_xLbxPolyRectangleReq		sz_xLbxPolyPointReq
+#define sz_xLbxPolyArcReq		sz_xLbxPolyPointReq
+#define sz_xLbxPolyFillRectangleReq	sz_xLbxPolyPointReq
+#define sz_xLbxPolyFillArc		sz_xLbxPolyPointReq
+
+typedef struct _LbxFillPoly {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;
+    CARD16	length B16;
+    CARD8	cacheEnts;
+    BYTE	shape;
+    CARD8	padBytes;
+} xLbxFillPolyReq;
+#define sz_xLbxFillPolyReq	7
+
+typedef struct _LbxCopyArea {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;
+    CARD16	length B16;
+    CARD8	srcCache;	/* source drawable */
+    CARD8	cacheEnts;	/* dest drawable and gc */
+    /* followed by encoded src x, src y, dst x, dst y, width, height */
+} xLbxCopyAreaReq;
+
+#define sz_xLbxCopyAreaReq  6
+
+typedef struct _LbxCopyPlane {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;
+    CARD16	length B16;
+    CARD32	bitPlane B32;
+    CARD8	srcCache;	/* source drawable */
+    CARD8	cacheEnts;	/* dest drawable and gc */
+    /* followed by encoded src x, src y, dst x, dst y, width, height */
+} xLbxCopyPlaneReq;
+
+#define sz_xLbxCopyPlaneReq  10
+
+typedef struct _LbxPolyText {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;
+    CARD16	length B16;
+    CARD8	cacheEnts;
+    /* followed by encoded src x, src y coordinates and text elts */
+} xLbxPolyTextReq;
+
+#define sz_xLbxPolyTextReq  5
+
+typedef xLbxPolyTextReq xLbxPolyText8Req;
+typedef xLbxPolyTextReq xLbxPolyText16Req;
+
+#define sz_xLbxPolyTextReq	5
+#define sz_xLbxPolyText8Req	5
+#define sz_xLbxPolyText16Req	5
+
+typedef struct _LbxImageText {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;
+    CARD16	length B16;
+    CARD8	cacheEnts;
+    CARD8	nChars;
+    /* followed by encoded src x, src y coordinates and string */
+} xLbxImageTextReq;
+
+typedef xLbxImageTextReq xLbxImageText8Req;
+typedef xLbxImageTextReq xLbxImageText16Req;
+
+#define sz_xLbxImageTextReq	6
+#define sz_xLbxImageText8Req	6
+#define sz_xLbxImageText16Req	6
+
+typedef struct {
+    CARD8       offset;
+    CARD8       diff;
+} xLbxDiffItem;
+#define sz_xLbxDiffItem    2
+
+typedef struct {
+    BYTE	type;		/* X_Reply */
+    CARD8	nOpts;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	optDataStart B32;
+    CARD32	pad0 B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+} xLbxStartReply;
+#define sz_xLbxStartReply	32
+#define sz_xLbxStartReplyHdr	8
+
+typedef struct _LbxQueryExtension {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxQueryExtension */
+    CARD16	length B16;
+    CARD32	nbytes B32;
+} xLbxQueryExtensionReq;
+#define	sz_xLbxQueryExtensionReq	8
+
+typedef struct _LbxQueryExtensionReply {
+    BYTE	type;			/* X_Reply */
+    CARD8	numReqs;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    BOOL	present;
+    CARD8	major_opcode;
+    CARD8	first_event;
+    CARD8	first_error;
+    CARD32	pad0 B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+
+    /* reply & event generating requests */
+} xLbxQueryExtensionReply;
+#define sz_xLbxQueryExtensionReply	32
+
+
+typedef struct _LbxBeginLargeRequest {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxBeginLargeRequest */
+    CARD16	length B16;
+    CARD32	largeReqLength B32;
+} xLbxBeginLargeRequestReq;
+#define	sz_BeginLargeRequestReq 8
+
+typedef struct _LbxLargeRequestData {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxLargeRequestData */
+    CARD16	length B16;
+    /* followed by LISTofCARD8 data */
+} xLbxLargeRequestDataReq;
+#define	sz_LargeRequestDataReq 4
+
+typedef struct _LbxEndLargeRequest {
+    CARD8	reqType;	/* always LbxReqCode */
+    CARD8	lbxReqType;	/* always X_LbxEndLargeRequest */
+    CARD16	length B16;
+} xLbxEndLargeRequestReq;
+#define	sz_EndLargeRequestReq 4
+
+
+
+typedef struct _LbxSwitchEvent {
+    BYTE	type;		/* always eventBase + LbxEvent */
+    BYTE	lbxType;	/* LbxSwitchEvent */
+    CARD16	pad B16;
+    CARD32	client B32;
+} xLbxSwitchEvent;
+#define sz_xLbxSwitchEvent	8
+
+typedef struct _LbxCloseEvent {
+    BYTE	type;		/* always eventBase + LbxEvent */
+    BYTE	lbxType;	/* LbxCloseEvent */
+    CARD16	sequenceNumber B16;
+    CARD32	client B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xLbxCloseEvent;
+#define sz_xLbxCloseEvent	32
+
+typedef struct _LbxInvalidateTagEvent {
+    BYTE	type;		/* always eventBase + LbxEvent */
+    BYTE	lbxType;	/* LbxInvalidateTagEvent */
+    CARD16	sequenceNumber B16;
+    CARD32	tag B32;
+    CARD32	tagType B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xLbxInvalidateTagEvent;
+#define sz_xLbxInvalidateTagEvent 32
+
+typedef struct _LbxSendTagDataEvent {
+    BYTE	type;		/* always eventBase + LbxEvent */
+    BYTE	lbxType;	/* LbxSendTagDataEvent */
+    CARD16	sequenceNumber B16;
+    CARD32	tag B32;
+    CARD32	tagType B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xLbxSendTagDataEvent;
+#define sz_xLbxSendTagDataEvent 32
+
+typedef struct _LbxListenToOneEvent {
+    BYTE	type;		/* always eventBase + LbxEvent */
+    BYTE	lbxType;	/* LbxListenToOneEvent */
+    CARD16	sequenceNumber B16;
+    CARD32	client B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xLbxListenToOneEvent;
+#define sz_xLbxListenToOneEvent 32
+
+typedef struct _LbxListenToAllEvent {
+    BYTE	type;		/* always eventBase + LbxEvent */
+    BYTE	lbxType;	/* LbxListenToAllEvent */
+    CARD16	sequenceNumber B16;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+    CARD32	pad7 B32;
+} xLbxListenToAllEvent;
+#define sz_xLbxListenToOneEvent 32
+
+typedef struct _LbxReleaseCmapEvent {
+    BYTE	type;		/* always eventBase + LbxEvent */
+    BYTE	lbxType;	/* LbxReleaseCmapEvent */
+    CARD16	sequenceNumber B16;
+    Colormap	colormap B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xLbxReleaseCmapEvent;
+#define sz_xLbxReleaseCmapEvent	32
+
+
+typedef struct _LbxFreeCellsEvent {
+    BYTE	type;		/* always eventBase + LbxEvent */
+    BYTE	lbxType;	/* LbxFreeCellsEvent */
+    CARD16	sequenceNumber B16;
+    Colormap	colormap B32;
+    CARD32	pixelStart B32;
+    CARD32	pixelEnd B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+} xLbxFreeCellsEvent;
+#define sz_xLbxFreeCellsEvent	32
+
+
+/*
+ * squished X event sizes.  If these change, be sure to update lbxquish.c
+ * and unsquish.c appropriately
+ *
+ * lbxsz_* is the padded squished length
+ * lbxupsz_* is the unpadded squished length
+ */
+
+#define	  lbxsz_KeyButtonEvent		32
+#define	lbxupsz_KeyButtonEvent		31
+
+#define	  lbxsz_EnterLeaveEvent		32
+#define	lbxupsz_EnterLeaveEvent		32
+
+#define	  lbxsz_FocusEvent		12
+#define	lbxupsz_FocusEvent		9
+
+#define	  lbxsz_KeymapEvent		32
+#define	lbxupsz_KeymapEvent		32
+
+#define	  lbxsz_ExposeEvent		20
+#define	lbxupsz_ExposeEvent		18
+
+#define	  lbxsz_GfxExposeEvent		24
+#define	lbxupsz_GfxExposeEvent		21
+
+#define	  lbxsz_NoExposeEvent		12
+#define	lbxupsz_NoExposeEvent		11
+
+#define	  lbxsz_VisibilityEvent		12
+#define	lbxupsz_VisibilityEvent		9
+
+#define	  lbxsz_CreateNotifyEvent	24
+#define	lbxupsz_CreateNotifyEvent	23
+
+#define	  lbxsz_DestroyNotifyEvent	12
+#define	lbxupsz_DestroyNotifyEvent	12
+
+#define	  lbxsz_UnmapNotifyEvent	16
+#define	lbxupsz_UnmapNotifyEvent	13
+
+#define	  lbxsz_MapNotifyEvent		16
+#define	lbxupsz_MapNotifyEvent		13
+
+#define	  lbxsz_MapRequestEvent		12
+#define	lbxupsz_MapRequestEvent		12
+
+#define	  lbxsz_ReparentEvent		24
+#define	lbxupsz_ReparentEvent		21
+
+#define	  lbxsz_ConfigureNotifyEvent	28
+#define	lbxupsz_ConfigureNotifyEvent	27
+
+#define	  lbxsz_ConfigureRequestEvent	28
+#define	lbxupsz_ConfigureRequestEvent	28
+
+#define	  lbxsz_GravityEvent		16
+#define	lbxupsz_GravityEvent		16
+
+#define	  lbxsz_ResizeRequestEvent	12
+#define	lbxupsz_ResizeRequestEvent	12
+
+#define	  lbxsz_CirculateEvent		20
+#define	lbxupsz_CirculateEvent		17
+
+#define	  lbxsz_PropertyEvent		20
+#define	lbxupsz_PropertyEvent		17
+
+#define	  lbxsz_SelectionClearEvent	16
+#define	lbxupsz_SelectionClearEvent	16
+
+#define	  lbxsz_SelectionRequestEvent	28
+#define	lbxupsz_SelectionRequestEvent	28
+
+#define	  lbxsz_SelectionNotifyEvent	24
+#define	lbxupsz_SelectionNotifyEvent	24
+
+#define	  lbxsz_ColormapEvent		16
+#define	lbxupsz_ColormapEvent		14
+
+#define	  lbxsz_MappingNotifyEvent	8
+#define	lbxupsz_MappingNotifyEvent	7
+
+#define	  lbxsz_ClientMessageEvent	32
+#define	lbxupsz_ClientMessageEvent	32
+
+#define	lbxsz_UnknownEvent		32
+
+#ifdef DEBUG
+
+#define DBG_SWITCH	0x00000001
+#define DBG_CLOSE	0x00000002
+#define DBG_IO		0x00000004
+#define DBG_READ_REQ	0x00000008
+#define DBG_LEN		0x00000010
+#define DBG_BLOCK	0x00000020
+#define DBG_CLIENT	0x00000040
+#define DBG_DELTA	0x00000080
+#endif
+/*
+ * Cancel the previous redefinition of the basic types, thus restoring their
+ * X.h definitions.
+ */
+
+#undef XID
+#undef Atom
+#undef Colormap
+#undef Drawable
+#undef VisualID
+#undef Window
+
+#endif	/* _LBXPROTO_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/mitmiscconst.h b/ThirdParty/X11/Include/X11/extensions/mitmiscconst.h
new file mode 100644
index 0000000000000000000000000000000000000000..adc5f94200bc3c5f71de5b00e43a31478ffe144d
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/mitmiscconst.h
@@ -0,0 +1,38 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM OR X PROJECT TEAM BLESSING */
+
+
+#ifndef _MITMISCCONST_H_
+#define _MITMISCCONST_H_
+
+#define MITMiscNumberEvents		0
+#define MITMiscNumberErrors		0
+
+#define MITMISCNAME "MIT-SUNDRY-NONSTANDARD"
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/mitmiscproto.h b/ThirdParty/X11/Include/X11/extensions/mitmiscproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..18c202a845ac25c97601673d1cf36df04cfda547
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/mitmiscproto.h
@@ -0,0 +1,68 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM OR X PROJECT TEAM BLESSING */
+
+#ifndef _MITMISCPROTO_H_
+#define _MITMISCPROTO_H_
+
+#include <X11/extensions/mitmiscconst.h>
+
+#define X_MITSetBugMode			0
+#define X_MITGetBugMode			1
+
+typedef struct _SetBugMode {
+    CARD8	reqType;	/* always MITReqCode */
+    CARD8	mitReqType;	/* always X_MITSetBugMode */
+    CARD16	length B16;
+    BOOL	onOff;
+    BYTE	pad0;
+    CARD16	pad1;
+} xMITSetBugModeReq;
+#define sz_xMITSetBugModeReq	8
+
+typedef struct _GetBugMode {
+    CARD8	reqType;	/* always MITReqCode */
+    CARD8	mitReqType;	/* always X_MITGetBugMode */
+    CARD16	length B16;
+} xMITGetBugModeReq;
+#define sz_xMITGetBugModeReq	4
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	onOff;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	pad0 B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xMITGetBugModeReply;
+#define sz_xMITGetBugModeReply	32
+
+#endif /* _MITMISCPROTO_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/multibuf.h b/ThirdParty/X11/Include/X11/extensions/multibuf.h
new file mode 100644
index 0000000000000000000000000000000000000000..27165f08ab65a72bee53beb7cd19a35d2b8c63e3
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/multibuf.h
@@ -0,0 +1,207 @@
+/*
+ *
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+#ifndef _MULTIBUF_H_
+#define _MULTIBUF_H_
+
+#include <X11/Xfuncproto.h>
+
+#include <X11/extensions/multibufconst.h>
+
+#define MbufGetReq(name,req,info) GetReq (name, req); \
+	req->reqType = info->codes->major_opcode; \
+	req->mbufReqType = X_##name;
+
+/*
+ * Extra definitions that will only be needed in the client
+ */
+typedef XID Multibuffer;
+
+typedef struct {
+    int	type;		    /* of event */
+    unsigned long serial;   /* # of last request processed by server */
+    int send_event;	    /* true if this came frome a SendEvent request */
+    Display *display;	    /* Display the event was read from */
+    Multibuffer buffer;	    /* buffer of event */
+    int	state;		    /* see Clobbered constants above */
+} XmbufClobberNotifyEvent;
+
+typedef struct {
+    int	type;		    /* of event */
+    unsigned long serial;   /* # of last request processed by server */
+    int send_event;	    /* true if this came frome a SendEvent request */
+    Display *display;	    /* Display the event was read from */
+    Multibuffer buffer;	    /* buffer of event */
+} XmbufUpdateNotifyEvent;
+
+
+/*
+ * per-window attributes that can be got
+ */
+typedef struct {
+    int displayed_index;	/* which buffer is being displayed */
+    int update_action;		/* Undefined, Background, Untouched, Copied */
+    int update_hint;		/* Frequent, Intermittent, Static */
+    int window_mode;		/* Mono, Stereo */
+    int nbuffers;		/* Number of buffers */
+    Multibuffer *buffers;	/* Buffers */
+} XmbufWindowAttributes;
+
+/*
+ * per-window attributes that can be set
+ */
+typedef struct {
+    int update_hint;		/* Frequent, Intermittent, Static */
+} XmbufSetWindowAttributes;
+
+
+/*
+ * per-buffer attributes that can be got
+ */
+typedef struct {
+    Window window;		/* which window this belongs to */
+    unsigned long event_mask;	/* events that have been selected */
+    int buffer_index;		/* which buffer is this */
+    int side;			/* Mono, Left, Right */
+} XmbufBufferAttributes;
+
+/*
+ * per-buffer attributes that can be set
+ */
+typedef struct {
+    unsigned long event_mask;	/* events that have been selected */
+} XmbufSetBufferAttributes;
+
+
+/*
+ * per-screen buffer info (there will be lists of them)
+ */
+typedef struct {
+    VisualID visualid;		/* visual usuable at this depth */
+    int max_buffers;		/* most buffers for this visual */
+    int depth;			/* depth of buffers to be created */
+} XmbufBufferInfo;
+
+_XFUNCPROTOBEGIN
+
+extern Bool XmbufQueryExtension(
+    Display*		/* dpy */,
+    int*		/* event_base_return */,
+    int*		/* error_base_return */
+);
+
+extern Status XmbufGetVersion(
+    Display*		/* dpy */,
+    int*		/* major_version_return */,
+    int*		/* minor_version_return */
+);
+
+extern int XmbufCreateBuffers(
+    Display*		/* dpy */,
+    Window		/* w */,
+    int			/* count */,
+    int			/* update_action */,
+    int			/* update_hint */,
+    Multibuffer*	/* buffers */
+);
+
+extern void XmbufDestroyBuffers(
+    Display*		/* dpy */,
+    Window		/* window */
+);
+
+extern void XmbufDisplayBuffers(
+    Display*		/* dpy */,
+    int			/* count */,
+    Multibuffer*	/* buffers */,
+    int			/* min_delay */,
+    int			/* max_delay */
+);
+
+extern Status XmbufGetWindowAttributes(
+    Display*			/* dpy */,
+    Window			/* w */,
+    XmbufWindowAttributes*	/* attr */
+);
+
+extern void XmbufChangeWindowAttributes(
+    Display*			/* dpy */,
+    Window			/* w */,
+    unsigned long		/* valuemask */,
+    XmbufSetWindowAttributes*	/* attr */
+);
+
+extern Status XmbufGetBufferAttributes(
+    Display*			/* dpy */,
+    Multibuffer			/* b */,
+    XmbufBufferAttributes*	/* attr */
+);
+
+extern void XmbufChangeBufferAttributes(
+    Display*			/* dpy */,
+    Multibuffer			/* b */,
+    unsigned long		/* valuemask */,
+    XmbufSetBufferAttributes*	/* attr */
+);
+
+extern Status XmbufGetScreenInfo(
+    Display*			/* dpy */,
+    Drawable			/* d */,
+    int*			/* nmono_return */,
+    XmbufBufferInfo**		/* mono_info_return */,
+    int*			/* nstereo_return */,
+    XmbufBufferInfo**		/* stereo_info_return */
+);
+
+extern Window XmbufCreateStereoWindow(
+    Display*			/* dpy */,
+    Window			/* parent */,
+    int				/* x */,
+    int				/* y */,
+    unsigned int		/* width */,
+    unsigned int		/* height */,
+    unsigned int		/* border_width */,
+    int				/* depth */,
+    unsigned int		/* class */,
+    Visual*			/* visual */,
+    unsigned long		/* valuemask */,
+    XSetWindowAttributes*	/* attr */,
+    Multibuffer*		/* leftp */,
+    Multibuffer*		/* rightp */
+);
+
+extern void XmbufClearBufferArea(
+    Display*			/* dpy */,
+    Multibuffer			/* buffer */,
+    int				/* x */,
+    int				/* y */,
+    unsigned int		/* width */,
+    unsigned int		/* height */,
+    Bool			/* exposures */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _MULTIBUF_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/multibufconst.h b/ThirdParty/X11/Include/X11/extensions/multibufconst.h
new file mode 100644
index 0000000000000000000000000000000000000000..2d1238c31fd8cde7633ded6690aec9c1c50c04a4
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/multibufconst.h
@@ -0,0 +1,83 @@
+/*
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+#ifndef _MULTIBUFCONST_H_
+#define _MULTIBUFCONST_H_
+
+#define MULTIBUFFER_PROTOCOL_NAME "Multi-Buffering"
+
+#define MULTIBUFFER_MAJOR_VERSION	1	/* current version numbers */
+#define MULTIBUFFER_MINOR_VERSION	1	/* has ClearImageBufferArea */
+
+/*
+ * update_action field
+ */
+#define MultibufferUpdateActionUndefined	0
+#define MultibufferUpdateActionBackground	1
+#define MultibufferUpdateActionUntouched	2
+#define MultibufferUpdateActionCopied		3
+
+/*
+ * update_hint field
+ */
+#define MultibufferUpdateHintFrequent		0
+#define MultibufferUpdateHintIntermittent	1
+#define MultibufferUpdateHintStatic		2
+
+/*
+ * valuemask fields
+ */
+#define MultibufferWindowUpdateHint	(1L << 0)
+#define MultibufferBufferEventMask	(1L << 0)
+
+/*
+ * mono vs. stereo and left vs. right
+ */
+#define MultibufferModeMono		0
+#define MultibufferModeStereo		1
+#define MultibufferSideMono		0
+#define MultibufferSideLeft	  	1
+#define MultibufferSideRight		2
+
+/*
+ * clobber state
+ */
+#define MultibufferUnclobbered		0
+#define MultibufferPartiallyClobbered	1
+#define MultibufferFullyClobbered	2
+
+/*
+ * event stuff
+ */
+#define MultibufferClobberNotifyMask	0x02000000
+#define MultibufferUpdateNotifyMask	0x04000000
+
+#define MultibufferClobberNotify	0
+#define MultibufferUpdateNotify		1
+#define MultibufferNumberEvents		(MultibufferUpdateNotify + 1)
+
+#define MultibufferBadBuffer		0
+#define MultibufferNumberErrors		(MultibufferBadBuffer + 1)
+
+#endif /* _MULTIBUFCONST_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/multibufproto.h b/ThirdParty/X11/Include/X11/extensions/multibufproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..e2184d3a82fe3711ee28f153d4a680cd94ad5f80
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/multibufproto.h
@@ -0,0 +1,295 @@
+/*
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+#ifndef _MULTIBUFPROTO_H_
+#define _MULTIBUFPROTO_H_
+
+#include <X11/extensions/multibufconst.h>
+
+/*
+ * Protocol requests constants and alignment values
+ */
+
+#define Window CARD32
+#define Drawable CARD32
+#define VisualID CARD32
+#define Multibuffer CARD32
+
+#define X_MbufGetBufferVersion		0
+#define X_MbufCreateImageBuffers	1
+#define X_MbufDestroyImageBuffers	2
+#define X_MbufDisplayImageBuffers	3
+#define X_MbufSetMBufferAttributes	4
+#define X_MbufGetMBufferAttributes	5
+#define X_MbufSetBufferAttributes	6
+#define X_MbufGetBufferAttributes	7
+#define X_MbufGetBufferInfo		8
+#define X_MbufCreateStereoWindow	9
+#define X_MbufClearImageBufferArea	10
+
+
+typedef struct xMbufBufferInfo {
+	CARD32	visualID B32;		/* associated visual */
+	CARD16	maxBuffers B16;		/* maximum supported buffers */
+	CARD8	depth;			/* depth of visual (redundant) */
+	CARD8	unused;
+} xMbufBufferInfo;
+#define sz_xMbufBufferInfo 8
+
+typedef struct {
+    BYTE    type;
+    BYTE    unused;
+    CARD16  sequenceNumber B16;
+    CARD32  buffer B32;			/* affected buffer */
+    BYTE    state;			/* current status */
+    CARD8   unused1;
+    CARD16  unused2 B16;
+    CARD32  unused3 B32;
+    CARD32  unused4 B32;
+    CARD32  unused5 B32;
+    CARD32  unused6 B32;
+    CARD32  unused7 B32;
+} xMbufClobberNotifyEvent;
+
+typedef struct {
+    BYTE    type;
+    BYTE    unused;
+    CARD16  sequenceNumber B16;
+    CARD32  buffer B32;			/* affected buffer */
+    CARD32  timeStamp B32;		/* update time */
+    CARD32  unused1 B32;
+    CARD32  unused2 B32;
+    CARD32  unused3 B32;
+    CARD32  unused4 B32;
+    CARD32  unused5 B32;
+    CARD32  unused6 B32;
+} xMbufUpdateNotifyEvent;
+
+typedef struct {
+    CARD8	reqType;		/* always codes->major_opcode */
+    CARD8	mbufReqType;		/* always X_MbufGetBufferVersion */
+    CARD16	length B16;
+} xMbufGetBufferVersionReq;
+#define sz_xMbufGetBufferVersionReq	4
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	unused;			/* not used */
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD8	majorVersion;	/* major version of Multi-Buffering protocol */
+    CARD8	minorVersion;	/* minor version of Multi-Buffering protocol */
+    CARD16	pad1 B16;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xMbufGetBufferVersionReply;
+#define sz_xMbufGetBufferVersionReply	32
+
+typedef struct {
+    CARD8	reqType;	/* always codes->major_opcode */
+    CARD8	mbufReqType;	/* always X_MbufCreateImageBuffers */
+    CARD16	length B16;
+    CARD32	window B32;	/* associated window */
+    CARD8	updateAction;	/* action at update */
+    CARD8	updateHint;	/* hint as to frequency of updates */
+    CARD16	unused;
+} xMbufCreateImageBuffersReq;	/* followed by buffer ids */
+#define sz_xMbufCreateImageBuffersReq	12
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	unused;			/* not used */
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	numberBuffer B16;	/* number successfully allocated */
+    CARD16	unused1 B16;
+    CARD32	unused2 B32;
+    CARD32	unused3 B32;
+    CARD32	unused4 B32;
+    CARD32	unused5 B32;
+    CARD32	unused6 B32;
+} xMbufCreateImageBuffersReply;
+#define sz_xMbufCreateImageBuffersReply 32
+
+typedef struct {
+    CARD8	reqType;	/* always codes->major_opcode */
+    CARD8	mbufReqType;	/* always X_MbufDestroyImageBuffers */
+    CARD16	length B16;
+    CARD32	window B32;	/* associated window */
+} xMbufDestroyImageBuffersReq;
+#define sz_xMbufDestroyImageBuffersReq	8
+
+typedef struct {
+    CARD8	reqType;	/* always codes->major_opcode */
+    CARD8	mbufReqType;	/* always X_MbufDisplayImageBuffers */
+    CARD16	length B16;
+    CARD16	minDelay B16;	/* minimum time between last update and now */
+    CARD16	maxDelay B16;	/* maximum time between last update and now */
+} xMbufDisplayImageBuffersReq;	/* followed by list of buffers */
+#define sz_xMbufDisplayImageBuffersReq	8
+
+typedef struct {
+    CARD8	reqType;	/* always codes->major_opcode */
+    CARD8	mbufReqType;	/* always X_MbufSetMBufferAttributes */
+    CARD16	length B16;
+    CARD32	window B32;	/* associated window */
+    CARD32	valueMask B32;	/* modified entries */
+} xMbufSetMBufferAttributesReq;	/* followed by values */
+#define sz_xMbufSetMBufferAttributesReq 12
+
+typedef struct {
+    CARD8	reqType;	/* always codes->major_opcode */
+    CARD8	mbufReqType;	/* always X_MbufGetMBufferAttributes */
+    CARD16	length B16;
+    CARD32	window B32;	/* associated window */
+} xMbufGetMBufferAttributesReq;
+#define sz_xMbufGetMBufferAttributesReq 8
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	unused;			/* not used */
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	displayedBuffer B16;	/* currently visible buffer */
+    CARD8	updateAction;
+    CARD8	updateHint;
+    CARD8	windowMode;
+    CARD8	unused0;
+    CARD16	unused1 B16;
+    CARD32	unused2 B32;
+    CARD32	unused3 B32;
+    CARD32	unused4 B32;
+    CARD32	unused5 B32;
+} xMbufGetMBufferAttributesReply;
+#define sz_xMbufGetMBufferAttributesReply 32
+
+typedef struct {
+    CARD8	reqType;	/* always codes->major_opcode */
+    CARD8	mbufReqType;	/* always X_MbufSetBufferAttributes */
+    CARD16	length B16;
+    CARD32	buffer B32;
+    CARD32	valueMask B32;
+} xMbufSetBufferAttributesReq;	/* followed by values */
+#define sz_xMbufSetBufferAttributesReq 12
+
+typedef struct {
+    CARD8	reqType;	/* always codes->major_opcode */
+    CARD8	mbufReqType;	/* always X_MbufGetBufferAttributes */
+    CARD16	length B16;
+    CARD32	buffer B32;
+} xMbufGetBufferAttributesReq;
+#define sz_xMbufGetBufferAttributesReq 8
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	unused;			/* not used */
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	window B32;
+    CARD32	eventMask B32;
+    CARD16	bufferIndex B16;
+    CARD8	side;
+    CARD8	unused0;
+    CARD32	unused1 B32;
+    CARD32	unused2 B32;
+    CARD32	unused3 B32;
+} xMbufGetBufferAttributesReply;
+#define sz_xMbufGetBufferAttributesReply 32
+
+typedef struct {
+    CARD8	reqType;	/* always codes->major_opcode */
+    CARD8	mbufReqType;	/* always X_MbufGetBufferInfo */
+    CARD16	length B16;
+    Drawable	drawable B32;
+} xMbufGetBufferInfoReq;
+#define sz_xMbufGetBufferInfoReq 8
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	unused;			/* not used */
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	normalInfo B16;
+    CARD16	stereoInfo B16;
+    CARD32	unused1 B32;
+    CARD32	unused2 B32;
+    CARD32	unused3 B32;
+    CARD32	unused4 B32;
+    CARD32	unused5 B32;
+} xMbufGetBufferInfoReply;			/* followed by buffer infos */
+#define sz_xMbufGetBufferInfoReply 32
+
+
+typedef struct {
+    CARD8	reqType;	/* always codes->major_opcode */
+    CARD8	mbufReqType;	/* always X_MbufCreateStereoWindow */
+    CARD16	length B16;
+    CARD8	unused0;
+    CARD8	unused1;
+    CARD8	unused2;
+    CARD8	depth;
+    Window	wid B32;
+    Window	parent B32;
+    Multibuffer	left B32;	/* associated buffers */
+    Multibuffer	right B32;
+    INT16	x B16;
+    INT16	y B16;
+    CARD16	width B16;
+    CARD16	height B16;
+    CARD16	borderWidth B16;
+#if defined(__cplusplus) || defined(c_plusplus)
+    CARD16	c_class B16;
+#else
+    CARD16	class B16;
+#endif
+    VisualID	visual B32;
+    CARD32	mask B32;
+} xMbufCreateStereoWindowReq;		/* followed by value list */
+#define sz_xMbufCreateStereoWindowReq 44
+
+typedef struct {
+    CARD8     reqType;        /* always codes->major_opcode */
+    CARD8     mbufReqType;    /* always X_MbufClearImageBufferArea */
+    CARD16    length B16;
+    Multibuffer       buffer B32;
+    INT16     x B16;
+    INT16     y B16;
+    CARD16    width B16;
+    CARD16    height B16;
+    CARD8     unused0;
+    CARD8     unused1;
+    CARD8     unused2;
+    BOOL      exposures;
+} xMbufClearImageBufferAreaReq;
+#define sz_xMbufClearImageBufferAreaReq 20
+
+#undef Window
+#undef Drawable
+#undef VisualID
+#undef Multibuffer
+
+#endif /* _MULTIBUFPROTO_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/panoramiXext.h b/ThirdParty/X11/Include/X11/extensions/panoramiXext.h
new file mode 100644
index 0000000000000000000000000000000000000000..8312a173b56fa46b5248e0f32f31c296ab247474
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/panoramiXext.h
@@ -0,0 +1,85 @@
+/*****************************************************************
+Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of Digital Equipment Corporation
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from Digital
+Equipment Corporation.
+******************************************************************/
+/*
+ *	PanoramiX definitions
+ */
+
+/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */
+
+#ifndef _panoramiXext_h
+#define _panoramiXext_h
+
+#include <X11/Xfuncproto.h>
+
+typedef struct {
+    Window  window;         /* PanoramiX window - may not exist */
+    int	    screen;
+    int     State;          /* PanoramiXOff, PanoramiXOn */
+    int	    width;	    /* width of this screen */
+    int     height;	    /* height of this screen */
+    int     ScreenCount;    /* real physical number of screens */
+    XID     eventMask;      /* selected events for this client */
+} XPanoramiXInfo;
+
+_XFUNCPROTOBEGIN
+
+extern Bool XPanoramiXQueryExtension (
+    Display *		/* dpy */,
+    int *		/* event_base_return */,
+    int *		/* error_base_return */
+);
+
+extern Status XPanoramiXQueryVersion(
+    Display *		/* dpy */,
+    int *		/* major_version_return */,
+    int *		/* minor_version_return */
+);
+
+extern XPanoramiXInfo *XPanoramiXAllocInfo (
+    void
+);
+
+extern Status XPanoramiXGetState (
+    Display *		/* dpy */,
+    Drawable		/* drawable */,
+    XPanoramiXInfo *	/* panoramiX_info */
+);
+
+extern Status XPanoramiXGetScreenCount (
+    Display *		/* dpy */,
+    Drawable		/* drawable */,
+    XPanoramiXInfo *	/* panoramiX_info */
+);
+
+extern Status XPanoramiXGetScreenSize (
+    Display *		/* dpy */,
+    Drawable		/* drawable */,
+    int			/* screen_num */,
+    XPanoramiXInfo *	/* panoramiX_info */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _panoramiXext_h */
diff --git a/ThirdParty/X11/Include/X11/extensions/panoramiXproto.h b/ThirdParty/X11/Include/X11/extensions/panoramiXproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..6fd1a02665cd685b65b5eb53b9bfcfeee0a383e7
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/panoramiXproto.h
@@ -0,0 +1,193 @@
+/*****************************************************************
+Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of Digital Equipment Corporation
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from Digital
+Equipment Corporation.
+******************************************************************/
+
+/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */
+
+#ifndef _PANORAMIXPROTO_H_
+#define _PANORAMIXPROTO_H_
+
+#define PANORAMIX_MAJOR_VERSION         1       /* current version number */
+#define PANORAMIX_MINOR_VERSION         1
+
+#define PANORAMIX_PROTOCOL_NAME "XINERAMA"
+
+#define X_PanoramiXQueryVersion		0
+#define X_PanoramiXGetState		1
+#define X_PanoramiXGetScreenCount	2
+#define X_PanoramiXGetScreenSize	3
+
+#define X_XineramaIsActive		4
+#define X_XineramaQueryScreens		5
+
+typedef struct _PanoramiXQueryVersion {
+	CARD8	reqType;		/* always PanoramiXReqCode */
+	CARD8	panoramiXReqType;	/* always X_PanoramiXQueryVersion */
+	CARD16	length B16;
+	CARD8	clientMajor;
+	CARD8	clientMinor;
+	CARD16	unused B16;           
+} xPanoramiXQueryVersionReq;
+
+#define sz_xPanoramiXQueryVersionReq	8
+
+typedef struct {
+	CARD8	type;			/* must be X_Reply */
+	CARD8	pad1;			/* unused	*/
+	CARD16	sequenceNumber  B16;	/* last sequence number */
+	CARD32	length  B32;		/* 0 */
+	CARD16	majorVersion  B16;	
+	CARD16	minorVersion  B16;	
+	CARD32	pad2	B32;		/* unused */
+	CARD32	pad3	B32;		/* unused */
+	CARD32	pad4	B32;		/* unused */
+	CARD32	pad5	B32;		/* unused */
+	CARD32	pad6	B32;		/* unused */
+} xPanoramiXQueryVersionReply;
+
+#define sz_xPanoramiXQueryVersionReply	32
+
+
+typedef	struct	_PanoramiXGetState {
+        CARD8   reqType;	        /* always PanoramiXReqCode */
+        CARD8   panoramiXReqType;    	/* always X_PanoramiXGetState */
+        CARD16  length B16;
+	CARD32  window B32;
+} xPanoramiXGetStateReq;
+#define sz_xPanoramiXGetStateReq	8	
+
+typedef struct {
+	BYTE	type;
+	BYTE	state;
+	CARD16	sequenceNumber B16;
+	CARD32	length	B32;
+	CARD32  window  B32;
+	CARD32	pad1	B32;		/* unused */
+	CARD32	pad2	B32;		/* unused */
+	CARD32	pad3	B32;		/* unused */
+	CARD32	pad4	B32;		/* unused */
+	CARD32	pad5	B32;		/* unused */
+} xPanoramiXGetStateReply;
+
+#define sz_panoramiXGetStateReply	32
+
+typedef	struct	_PanoramiXGetScreenCount {
+        CARD8   reqType;             /* always PanoramiXReqCode */
+        CARD8   panoramiXReqType;    /* always X_PanoramiXGetScreenCount */
+        CARD16  length B16;
+	CARD32  window B32;
+} xPanoramiXGetScreenCountReq;
+#define sz_xPanoramiXGetScreenCountReq	8
+
+typedef struct {
+	BYTE	type;
+	BYTE	ScreenCount;
+	CARD16	sequenceNumber B16;
+	CARD32	length B32;
+	CARD32  window  B32;
+	CARD32	pad1	B32;		/* unused */
+	CARD32	pad2	B32;		/* unused */
+	CARD32	pad3	B32;		/* unused */
+	CARD32	pad4	B32;		/* unused */
+	CARD32	pad5	B32;		/* unused */
+} xPanoramiXGetScreenCountReply;
+#define sz_panoramiXGetScreenCountReply	32
+
+typedef	struct	_PanoramiXGetScreenSize {
+        CARD8   reqType;                /* always PanoramiXReqCode */
+        CARD8   panoramiXReqType;	/* always X_PanoramiXGetState */
+        CARD16  length B16;
+	CARD32  window B32;
+	CARD32	screen B32;
+} xPanoramiXGetScreenSizeReq;
+#define sz_xPanoramiXGetScreenSizeReq	12	
+
+typedef struct {
+	BYTE	type;
+	CARD8	pad1;			
+	CARD16	sequenceNumber B16;
+	CARD32	length	B32;
+	CARD32	width	B32;
+	CARD32	height	B32;
+	CARD32  window  B32;
+	CARD32  screen  B32;
+	CARD32	pad2	B32;		/* unused */
+	CARD32	pad3	B32;		/* unused */
+} xPanoramiXGetScreenSizeReply;
+#define sz_panoramiXGetScreenSizeReply 32	
+
+/************  Alternate protocol  ******************/
+
+typedef struct {
+        CARD8   reqType;
+        CARD8   panoramiXReqType;
+        CARD16  length B16;
+} xXineramaIsActiveReq;
+#define sz_xXineramaIsActiveReq 4
+
+typedef struct {
+	BYTE	type;
+	CARD8	pad1;			
+	CARD16	sequenceNumber B16;
+	CARD32	length	B32;
+	CARD32	state	B32;
+	CARD32	pad2	B32;
+	CARD32  pad3  	B32;
+	CARD32  pad4  	B32;
+	CARD32	pad5	B32;
+	CARD32	pad6	B32;
+} xXineramaIsActiveReply;
+#define sz_XineramaIsActiveReply 32	
+
+
+typedef struct {
+        CARD8   reqType;
+        CARD8   panoramiXReqType;
+        CARD16  length B16;
+} xXineramaQueryScreensReq;
+#define sz_xXineramaQueryScreensReq 4
+
+typedef struct {
+	BYTE	type;
+	CARD8	pad1;			
+	CARD16	sequenceNumber B16;
+	CARD32	length	B32;
+	CARD32	number	B32;
+	CARD32	pad2	B32;
+	CARD32  pad3  	B32;
+	CARD32  pad4  	B32;
+	CARD32	pad5	B32;
+	CARD32	pad6	B32;
+} xXineramaQueryScreensReply;
+#define sz_XineramaQueryScreensReply 32	
+
+typedef struct {
+	INT16   x_org   B16;
+	INT16   y_org   B16;
+	CARD16  width   B16;
+	CARD16  height  B16;
+} xXineramaScreenInfo;
+#define sz_XineramaScreenInfo 8
+
+#endif 
diff --git a/ThirdParty/X11/Include/X11/extensions/presentproto.h b/ThirdParty/X11/Include/X11/extensions/presentproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..ee65fa47e868fc77ae5386751d177728b6fb9e16
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/presentproto.h
@@ -0,0 +1,246 @@
+/*
+ * Copyright © 2013 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _PRESENT_PROTO_H_
+#define _PRESENT_PROTO_H_
+
+#include <X11/extensions/presenttokens.h>
+
+#define Window CARD32
+#define Pixmap CARD32
+#define Region CARD32
+#define XSyncFence CARD32
+#define EventID CARD32
+
+typedef struct {
+    Window  window B32;
+    CARD32  serial B32;
+} xPresentNotify;
+#define sz_xPresentNotify               8
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   presentReqType;
+    CARD16  length B16;
+    CARD32  majorVersion B32;
+    CARD32  minorVersion B32;
+} xPresentQueryVersionReq;
+#define sz_xPresentQueryVersionReq   12
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  majorVersion B32;
+    CARD32  minorVersion B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+} xPresentQueryVersionReply;
+#define sz_xPresentQueryVersionReply	32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   presentReqType;
+    CARD16  length B16;
+    Window  window B32;
+
+    Pixmap  pixmap B32;
+    CARD32  serial B32;
+
+    Region  valid B32;
+    Region  update B32;
+
+    INT16   x_off B16;
+    INT16   y_off B16;
+    CARD32  target_crtc B32;
+
+    XSyncFence wait_fence B32;
+    XSyncFence idle_fence B32;
+
+    CARD32  options B32;
+    CARD32  pad1 B32;
+
+    CARD64  target_msc;
+    CARD64  divisor;
+    CARD64  remainder;
+    /* followed by a LISTofPRESENTNOTIFY */
+} xPresentPixmapReq;
+#define sz_xPresentPixmapReq	72
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   presentReqType;
+    CARD16  length B16;
+    Window  window B32;
+
+    CARD32  serial B32;
+    CARD32  pad0 B32;
+
+    CARD64  target_msc;
+    CARD64  divisor;
+    CARD64  remainder;
+} xPresentNotifyMSCReq;
+#define sz_xPresentNotifyMSCReq	40
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   presentReqType;
+    CARD16  length B16;
+    CARD32  eid B32;
+    CARD32  window B32;
+    CARD32  eventMask B32;
+} xPresentSelectInputReq;
+#define sz_xPresentSelectInputReq   16
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   presentReqType;
+    CARD16  length B16;
+    CARD32  target B32;
+} xPresentQueryCapabilitiesReq;
+#define sz_xPresentQueryCapabilitiesReq   8
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  capabilities B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+    CARD32  pad6 B32;
+    CARD32  pad7 B32;
+} xPresentQueryCapabilitiesReply;
+#define sz_xPresentQueryCapabilitiesReply       32
+
+/*
+ * Events
+ *
+ * All Present events are X Generic Events
+ */
+
+typedef struct {
+    CARD8 type;
+    CARD8 extension;
+    CARD16 sequenceNumber B16;
+    CARD32 length;
+    CARD16 evtype B16;
+    CARD16 pad2;
+    CARD32 eid B32;
+    CARD32 window B32;
+    INT16  x B16;
+    INT16  y B16;
+    CARD16 width B16;
+    CARD16 height B16;
+    INT16  off_x B16;
+    INT16  off_y B16;
+
+    CARD16 pixmap_width B16;
+    CARD16 pixmap_height B16;
+    CARD32 pixmap_flags B32;
+} xPresentConfigureNotify;
+#define sz_xPresentConfigureNotify 40
+
+typedef struct {
+    CARD8 type;
+    CARD8 extension;
+    CARD16 sequenceNumber B16;
+    CARD32 length;
+    CARD16 evtype B16;
+    CARD8  kind;
+    CARD8  mode;
+    CARD32 eid B32;
+    Window window B32;
+    CARD32 serial B32;
+    CARD64 ust;
+
+    CARD64 msc;
+} xPresentCompleteNotify;
+#define sz_xPresentCompleteNotify 40
+
+typedef struct {
+    CARD8 type;
+    CARD8 extension;
+    CARD16 sequenceNumber B16;
+    CARD32 length;
+    CARD16 evtype B16;
+    CARD16 pad2 B16;
+    CARD32 eid B32;
+    Window window B32;
+    CARD32 serial B32;
+    Pixmap pixmap B32;
+    CARD32 idle_fence B32;
+} xPresentIdleNotify;
+#define sz_xPresentIdleNotify   32
+
+typedef struct {
+    CARD8 type;
+    CARD8 extension;
+    CARD16 sequenceNumber B16;
+    CARD32 length;
+    CARD16 evtype B16;
+    CARD8 update_window;
+    CARD8 pad1;
+    CARD32 eid B32;
+    Window event_window B32;
+    Window window B32;
+    Pixmap pixmap B32;
+    CARD32 serial B32;
+    
+    /* 32-byte boundary */
+
+    Region valid_region B32;
+    Region update_region B32;
+
+    xRectangle valid_rect;
+
+    xRectangle update_rect;
+
+    INT16 x_off B16;
+    INT16 y_off B16;
+    CARD32 target_crtc B32;
+
+    XSyncFence wait_fence B32;
+    XSyncFence idle_fence B32;
+
+    CARD32 options B32;
+    CARD32 pad2 B32;
+
+    CARD64 target_msc;
+    CARD64 divisor;
+    CARD64 remainder;
+
+} xPresentRedirectNotify;
+
+#define sz_xPresentRedirectNotify 104
+
+#undef Window
+#undef Pixmap
+#undef Region
+#undef XSyncFence
+#undef EventID
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/presenttokens.h b/ThirdParty/X11/Include/X11/extensions/presenttokens.h
new file mode 100644
index 0000000000000000000000000000000000000000..807dbcfa5f979137f9db84d6162ae1bab736cf3e
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/presenttokens.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright © 2013 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _PRESENT_TOKENS_H_
+#define _PRESENT_TOKENS_H_
+
+#define PRESENT_NAME			"Present"
+#define PRESENT_MAJOR			1
+#define PRESENT_MINOR			0
+
+#define PresentNumberErrors		0
+#define PresentNumberEvents		0
+
+/* Requests */
+#define X_PresentQueryVersion		0
+#define X_PresentPixmap			1
+#define X_PresentNotifyMSC		2
+#define X_PresentSelectInput		3
+#define X_PresentQueryCapabilities      4
+
+#define PresentNumberRequests		5
+
+/* Present operation options */
+#define PresentOptionNone               0
+#define PresentOptionAsync              (1 << 0)
+#define PresentOptionCopy               (1 << 1)
+#define PresentOptionUST                (1 << 2)
+
+#define PresentAllOptions       (PresentOptionAsync | \
+                                 PresentOptionCopy | \
+                                 PresentOptionUST)
+
+/* Present capabilities */
+
+#define PresentCapabilityNone           0
+#define PresentCapabilityAsync          1
+#define PresentCapabilityFence          2
+#define PresentCapabilityUST            4
+
+#define PresentAllCapabilities  (PresentCapabilityAsync | \
+                                 PresentCapabilityFence | \
+                                 PresentCapabilityUST)
+
+/* Events */
+#define PresentConfigureNotify	0
+#define PresentCompleteNotify	1
+#define PresentIdleNotify       2
+#define PresentRedirectNotify	3
+
+/* Event Masks */
+#define PresentConfigureNotifyMask      1
+#define PresentCompleteNotifyMask       2
+#define PresentIdleNotifyMask           4
+#define PresentRedirectNotifyMask       8
+
+#define PresentAllEvents   (PresentConfigureNotifyMask |        \
+                            PresentCompleteNotifyMask |         \
+                            PresentIdleNotifyMask |             \
+                            PresentRedirectNotifyMask)
+
+/* Complete Kinds */
+
+#define PresentCompleteKindPixmap       0
+#define PresentCompleteKindNotifyMSC    1
+
+/* Complete Modes */
+
+#define PresentCompleteModeCopy         0
+#define PresentCompleteModeFlip         1
+#define PresentCompleteModeSkip         2
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/randr.h b/ThirdParty/X11/Include/X11/extensions/randr.h
new file mode 100644
index 0000000000000000000000000000000000000000..6fcda87488cef859797c7e2269dbb1b1fed14b6e
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/randr.h
@@ -0,0 +1,198 @@
+/*
+ * Copyright © 2000 Compaq Computer Corporation
+ * Copyright © 2002 Hewlett Packard Company
+ * Copyright © 2006 Intel Corporation
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ *
+ * Author:  Jim Gettys, HP Labs, Hewlett-Packard, Inc.
+ *	    Keith Packard, Intel Corporation
+ */
+
+#ifndef _RANDR_H_
+#define _RANDR_H_
+
+typedef unsigned short	Rotation;
+typedef unsigned short	SizeID;
+typedef unsigned short	SubpixelOrder;
+typedef unsigned short	Connection;
+typedef unsigned short	XRandrRotation;
+typedef unsigned short	XRandrSizeID;
+typedef unsigned short	XRandrSubpixelOrder;
+typedef unsigned long	XRandrModeFlags;
+
+#define RANDR_NAME		"RANDR"
+#define RANDR_MAJOR		1
+#define RANDR_MINOR		5
+
+#define RRNumberErrors		4
+#define RRNumberEvents		2
+#define RRNumberRequests	45
+
+#define X_RRQueryVersion	0
+/* we skip 1 to make old clients fail pretty immediately */
+#define X_RROldGetScreenInfo	1
+#define X_RR1_0SetScreenConfig	2
+/* V1.0 apps share the same set screen config request id */
+#define X_RRSetScreenConfig	2
+#define X_RROldScreenChangeSelectInput	3
+/* 3 used to be ScreenChangeSelectInput; deprecated */
+#define X_RRSelectInput		4
+#define X_RRGetScreenInfo	5
+
+/* V1.2 additions */
+#define X_RRGetScreenSizeRange	    6
+#define X_RRSetScreenSize	    7
+#define X_RRGetScreenResources	    8
+#define X_RRGetOutputInfo	    9
+#define X_RRListOutputProperties    10
+#define X_RRQueryOutputProperty	    11
+#define X_RRConfigureOutputProperty 12
+#define X_RRChangeOutputProperty    13
+#define X_RRDeleteOutputProperty    14
+#define X_RRGetOutputProperty	    15
+#define X_RRCreateMode		    16
+#define X_RRDestroyMode		    17
+#define X_RRAddOutputMode	    18
+#define X_RRDeleteOutputMode	    19
+#define X_RRGetCrtcInfo		    20
+#define X_RRSetCrtcConfig	    21
+#define X_RRGetCrtcGammaSize	    22
+#define X_RRGetCrtcGamma	    23
+#define X_RRSetCrtcGamma	    24
+
+/* V1.3 additions */
+#define X_RRGetScreenResourcesCurrent	25
+#define X_RRSetCrtcTransform	    26
+#define X_RRGetCrtcTransform	    27
+#define X_RRGetPanning		    28
+#define X_RRSetPanning		    29
+#define X_RRSetOutputPrimary	    30
+#define X_RRGetOutputPrimary	    31
+
+#define RRTransformUnit		    (1L << 0)
+#define RRTransformScaleUp	    (1L << 1)
+#define RRTransformScaleDown	    (1L << 2)
+#define RRTransformProjective	    (1L << 3)
+
+/* v1.4 */
+#define X_RRGetProviders	      32
+#define X_RRGetProviderInfo	      33
+#define X_RRSetProviderOffloadSink    34
+#define X_RRSetProviderOutputSource   35
+#define X_RRListProviderProperties    36
+#define X_RRQueryProviderProperty     37
+#define X_RRConfigureProviderProperty 38
+#define X_RRChangeProviderProperty    39
+#define X_RRDeleteProviderProperty    40
+#define X_RRGetProviderProperty	      41
+
+/* v1.5 */
+#define X_RRGetMonitors		      42
+#define X_RRSetMonitor		      43
+#define X_RRDeleteMonitor	      44
+
+/* Event selection bits */
+#define RRScreenChangeNotifyMask  (1L << 0)
+/* V1.2 additions */
+#define RRCrtcChangeNotifyMask	    (1L << 1)
+#define RROutputChangeNotifyMask    (1L << 2)
+#define RROutputPropertyNotifyMask  (1L << 3)
+/* V1.4 additions */
+#define RRProviderChangeNotifyMask   (1L << 4)
+#define RRProviderPropertyNotifyMask (1L << 5)
+#define RRResourceChangeNotifyMask   (1L << 6)
+
+/* Event codes */
+#define RRScreenChangeNotify	0
+/* V1.2 additions */
+#define RRNotify		    1
+/* RRNotify Subcodes */
+#define  RRNotify_CrtcChange	    0
+#define  RRNotify_OutputChange	    1
+#define  RRNotify_OutputProperty    2
+#define  RRNotify_ProviderChange    3
+#define  RRNotify_ProviderProperty  4
+#define  RRNotify_ResourceChange    5
+/* used in the rotation field; rotation and reflection in 0.1 proto. */
+#define RR_Rotate_0		1
+#define RR_Rotate_90		2
+#define RR_Rotate_180		4
+#define RR_Rotate_270		8
+
+/* new in 1.0 protocol, to allow reflection of screen */
+
+#define RR_Reflect_X		16
+#define RR_Reflect_Y		32
+
+#define RRSetConfigSuccess		0
+#define RRSetConfigInvalidConfigTime	1
+#define RRSetConfigInvalidTime		2
+#define RRSetConfigFailed		3
+
+/* new in 1.2 protocol */
+
+#define RR_HSyncPositive	0x00000001
+#define RR_HSyncNegative	0x00000002
+#define RR_VSyncPositive	0x00000004
+#define RR_VSyncNegative	0x00000008
+#define RR_Interlace		0x00000010
+#define RR_DoubleScan		0x00000020
+#define RR_CSync		0x00000040
+#define RR_CSyncPositive	0x00000080
+#define RR_CSyncNegative	0x00000100
+#define RR_HSkewPresent		0x00000200
+#define RR_BCast		0x00000400
+#define RR_PixelMultiplex	0x00000800
+#define RR_DoubleClock		0x00001000
+#define RR_ClockDivideBy2	0x00002000
+
+#define RR_Connected		0
+#define RR_Disconnected		1
+#define RR_UnknownConnection	2
+
+#define BadRROutput		0
+#define BadRRCrtc		1
+#define BadRRMode		2
+#define BadRRProvider		3
+
+/* Conventional RandR output properties */
+
+#define RR_PROPERTY_BACKLIGHT		"Backlight"
+#define RR_PROPERTY_RANDR_EDID		"EDID"
+#define RR_PROPERTY_SIGNAL_FORMAT	"SignalFormat"
+#define RR_PROPERTY_SIGNAL_PROPERTIES	"SignalProperties"
+#define RR_PROPERTY_CONNECTOR_TYPE	"ConnectorType"
+#define RR_PROPERTY_CONNECTOR_NUMBER	"ConnectorNumber"
+#define RR_PROPERTY_COMPATIBILITY_LIST	"CompatibilityList"
+#define RR_PROPERTY_CLONE_LIST		"CloneList"
+#define RR_PROPERTY_BORDER		"Border"
+#define RR_PROPERTY_BORDER_DIMENSIONS	"BorderDimensions"
+#define RR_PROPERTY_GUID		"GUID"
+#define RR_PROPERTY_RANDR_TILE		"TILE"
+
+/* roles this device can carry out */
+#define RR_Capability_None 0
+#define RR_Capability_SourceOutput 1
+#define RR_Capability_SinkOutput 2
+#define RR_Capability_SourceOffload 4
+#define RR_Capability_SinkOffload 8
+
+#endif	/* _RANDR_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/randrproto.h b/ThirdParty/X11/Include/X11/extensions/randrproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..114a6248e5174f253d2b92110c14ecdbe7cef8eb
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/randrproto.h
@@ -0,0 +1,1096 @@
+/*
+ * Copyright © 2000 Compaq Computer Corporation
+ * Copyright © 2002 Hewlett-Packard Company
+ * Copyright © 2006 Intel Corporation
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ *
+ * Author:  Jim Gettys, Hewlett-Packard Company, Inc.
+ *	    Keith Packard, Intel Corporation
+ */
+
+/* note that RANDR 1.0 is incompatible with version 0.0, or 0.1 */
+/* V1.0 removes depth switching from the protocol */
+#ifndef _XRANDRP_H_
+#define _XRANDRP_H_
+
+#include <X11/extensions/randr.h>
+#include <X11/extensions/renderproto.h>
+
+#define Window CARD32
+#define Drawable CARD32
+#define Font CARD32
+#define Pixmap CARD32
+#define Cursor CARD32
+#define Colormap CARD32
+#define GContext CARD32
+#define Atom CARD32
+#define Time CARD32
+#define KeyCode CARD8
+#define KeySym CARD32
+#define RROutput CARD32
+#define RRMode CARD32
+#define RRCrtc CARD32
+#define RRProvider CARD32
+#define RRModeFlags CARD32
+#define Atom CARD32
+
+#define Rotation CARD16
+#define SizeID CARD16
+#define SubpixelOrder CARD16
+
+/*
+ * data structures
+ */
+
+typedef struct {
+    CARD16 widthInPixels B16;
+    CARD16 heightInPixels B16;
+    CARD16 widthInMillimeters B16;
+    CARD16 heightInMillimeters B16;
+} xScreenSizes;
+#define sz_xScreenSizes 8
+
+/* 
+ * requests and replies
+ */
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   randrReqType;
+    CARD16  length B16;
+    CARD32  majorVersion B32;
+    CARD32  minorVersion B32;
+} xRRQueryVersionReq;
+#define sz_xRRQueryVersionReq   12
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  majorVersion B32;
+    CARD32  minorVersion B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+} xRRQueryVersionReply;
+#define sz_xRRQueryVersionReply	32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   randrReqType;
+    CARD16  length B16;
+    Window  window B32;
+} xRRGetScreenInfoReq;
+#define sz_xRRGetScreenInfoReq   8
+
+/* 
+ * the xRRScreenInfoReply structure is followed by:
+ *
+ * the size information
+ */
+
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    setOfRotations;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    Window  root B32;
+    Time    timestamp B32;
+    Time    configTimestamp B32;
+    CARD16  nSizes B16;
+    SizeID  sizeID B16;
+    Rotation  rotation B16;
+    CARD16  rate B16;
+    CARD16  nrateEnts B16;
+    CARD16  pad B16;
+} xRRGetScreenInfoReply;
+#define sz_xRRGetScreenInfoReply	32
+
+typedef struct {
+    CARD8    reqType;
+    CARD8    randrReqType;
+    CARD16   length B16;
+    Drawable drawable B32;
+    Time     timestamp B32;
+    Time     configTimestamp B32;
+    SizeID   sizeID B16;
+    Rotation rotation B16;
+} xRR1_0SetScreenConfigReq;
+#define sz_xRR1_0SetScreenConfigReq   20
+
+typedef struct {
+    CARD8    reqType;
+    CARD8    randrReqType;
+    CARD16   length B16;
+    Drawable drawable B32;
+    Time     timestamp B32;
+    Time     configTimestamp B32;
+    SizeID   sizeID B16;
+    Rotation rotation B16;
+    CARD16   rate B16;
+    CARD16   pad B16;
+} xRRSetScreenConfigReq;
+#define sz_xRRSetScreenConfigReq   24
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    CARD8   status;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    Time    newTimestamp B32;  
+    Time    newConfigTimestamp B32;
+    Window  root;
+    CARD16  subpixelOrder B16;
+    CARD16  pad4 B16;
+    CARD32  pad5 B32;
+    CARD32  pad6 B32;
+} xRRSetScreenConfigReply;
+#define sz_xRRSetScreenConfigReply 32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   randrReqType;
+    CARD16  length B16;
+    Window  window B32;
+    CARD16  enable B16;
+    CARD16  pad2 B16;
+} xRRSelectInputReq;
+#define sz_xRRSelectInputReq   12
+
+/*
+ * Additions for version 1.2
+ */
+
+typedef struct _xRRModeInfo {
+    RRMode		id B32;
+    CARD16		width B16;
+    CARD16		height B16;
+    CARD32		dotClock B32;
+    CARD16		hSyncStart B16;
+    CARD16		hSyncEnd B16;
+    CARD16		hTotal B16;
+    CARD16		hSkew B16;
+    CARD16		vSyncStart B16;
+    CARD16		vSyncEnd B16;
+    CARD16		vTotal B16;
+    CARD16		nameLength B16;
+    RRModeFlags		modeFlags B32;
+} xRRModeInfo;
+#define sz_xRRModeInfo		    32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   randrReqType;
+    CARD16  length B16;
+    Window  window B32;
+} xRRGetScreenSizeRangeReq;
+#define sz_xRRGetScreenSizeRangeReq 8
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    CARD8   pad;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD16  minWidth B16;
+    CARD16  minHeight B16;
+    CARD16  maxWidth B16;
+    CARD16  maxHeight B16;
+    CARD32  pad0 B32;
+    CARD32  pad1 B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+} xRRGetScreenSizeRangeReply;
+#define sz_xRRGetScreenSizeRangeReply 32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   randrReqType;
+    CARD16  length B16;
+    Window  window B32;
+    CARD16  width B16;
+    CARD16  height B16;
+    CARD32  widthInMillimeters B32;
+    CARD32  heightInMillimeters B32;
+} xRRSetScreenSizeReq;
+#define sz_xRRSetScreenSizeReq	    20
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   randrReqType;
+    CARD16  length B16;
+    Window  window B32;
+} xRRGetScreenResourcesReq;
+#define sz_xRRGetScreenResourcesReq 8
+
+typedef struct {
+    BYTE	type;
+    CARD8	pad;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    Time	timestamp B32;
+    Time	configTimestamp B32;
+    CARD16	nCrtcs B16;
+    CARD16	nOutputs B16;
+    CARD16	nModes B16;
+    CARD16	nbytesNames B16;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+} xRRGetScreenResourcesReply;
+#define sz_xRRGetScreenResourcesReply	32
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RROutput	output B32;
+    Time	configTimestamp B32;
+} xRRGetOutputInfoReq;
+#define sz_xRRGetOutputInfoReq		12
+
+typedef struct {
+    BYTE	type;
+    CARD8	status;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    Time	timestamp B32;
+    RRCrtc	crtc B32;
+    CARD32	mmWidth B32;
+    CARD32	mmHeight B32;
+    CARD8	connection;
+    CARD8	subpixelOrder;
+    CARD16	nCrtcs B16;
+    CARD16	nModes B16;
+    CARD16	nPreferred B16;
+    CARD16	nClones B16;
+    CARD16	nameLength B16;
+} xRRGetOutputInfoReply;
+#define sz_xRRGetOutputInfoReply	36
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RROutput	output B32;
+} xRRListOutputPropertiesReq; 
+#define sz_xRRListOutputPropertiesReq	8
+
+typedef struct {
+    BYTE	type;
+    CARD8	pad0;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	nAtoms B16;
+    CARD16	pad1 B16;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xRRListOutputPropertiesReply;
+#define sz_xRRListOutputPropertiesReply	32
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RROutput	output B32;
+    Atom	property B32;
+} xRRQueryOutputPropertyReq; 
+#define sz_xRRQueryOutputPropertyReq	12
+
+typedef struct {
+    BYTE	type;
+    BYTE	pad0;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    BOOL	pending;
+    BOOL	range;
+    BOOL	immutable;
+    BYTE	pad1;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xRRQueryOutputPropertyReply;
+#define sz_xRRQueryOutputPropertyReply	32
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RROutput	output B32;
+    Atom	property B32;
+    BOOL	pending;
+    BOOL	range;
+    CARD16	pad B16;
+} xRRConfigureOutputPropertyReq; 
+#define sz_xRRConfigureOutputPropertyReq	16
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RROutput	output B32;
+    Atom	property B32;
+    Atom	type B32;
+    CARD8	format;
+    CARD8	mode;
+    CARD16	pad;
+    CARD32	nUnits B32;
+} xRRChangeOutputPropertyReq;
+#define sz_xRRChangeOutputPropertyReq	24
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RROutput	output B32;
+    Atom	property B32;
+} xRRDeleteOutputPropertyReq;
+#define sz_xRRDeleteOutputPropertyReq	12
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RROutput	output B32;
+    Atom	property B32;
+    Atom	type B32;
+    CARD32	longOffset B32;
+    CARD32	longLength B32;
+#ifdef __cplusplus
+    BOOL	_delete;
+#else
+    BOOL	delete;
+#endif
+    BOOL	pending;
+    CARD16	pad1 B16;
+} xRRGetOutputPropertyReq;
+#define sz_xRRGetOutputPropertyReq	28
+
+typedef struct {
+    BYTE	type;
+    CARD8	format;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    Atom	propertyType B32;
+    CARD32	bytesAfter B32;
+    CARD32	nItems B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+} xRRGetOutputPropertyReply;
+#define sz_xRRGetOutputPropertyReply	32
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    Window	window B32;
+    xRRModeInfo	modeInfo;
+} xRRCreateModeReq; 
+#define sz_xRRCreateModeReq		40
+
+typedef struct {
+    BYTE	type;
+    CARD8	pad0;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    RRMode	mode B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xRRCreateModeReply;
+#define sz_xRRCreateModeReply		32
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RRMode	mode B32;
+} xRRDestroyModeReq;
+#define sz_xRRDestroyModeReq		8
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RROutput	output B32;
+    RRMode	mode B32;
+} xRRAddOutputModeReq;
+#define sz_xRRAddOutputModeReq		12
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RROutput	output B32;
+    RRMode	mode B32;
+} xRRDeleteOutputModeReq;
+#define sz_xRRDeleteOutputModeReq	12
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RRCrtc	crtc B32;
+    Time	configTimestamp B32;
+} xRRGetCrtcInfoReq; 
+#define sz_xRRGetCrtcInfoReq		12
+
+typedef struct {
+    BYTE	type;
+    CARD8	status;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    Time	timestamp B32;
+    INT16	x B16;
+    INT16	y B16;
+    CARD16	width B16;
+    CARD16	height B16;
+    RRMode	mode B32;
+    Rotation	rotation B16;
+    Rotation	rotations B16;
+    CARD16	nOutput B16;
+    CARD16	nPossibleOutput B16;
+} xRRGetCrtcInfoReply;
+#define sz_xRRGetCrtcInfoReply		32
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RRCrtc	crtc B32;
+    Time	timestamp B32;
+    Time    	configTimestamp B32;
+    INT16	x B16;
+    INT16	y B16;
+    RRMode	mode B32;
+    Rotation	rotation B16;
+    CARD16	pad B16;
+} xRRSetCrtcConfigReq; 
+#define sz_xRRSetCrtcConfigReq		28
+
+typedef struct {
+    BYTE	type;
+    CARD8	status;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    Time	newTimestamp B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B16;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xRRSetCrtcConfigReply;
+#define sz_xRRSetCrtcConfigReply	32
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RRCrtc	crtc B32;
+} xRRGetCrtcGammaSizeReq; 
+#define sz_xRRGetCrtcGammaSizeReq	8
+
+typedef struct {
+    BYTE	type;
+    CARD8	status;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	size B16;
+    CARD16	pad1 B16;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xRRGetCrtcGammaSizeReply;
+#define sz_xRRGetCrtcGammaSizeReply	32
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RRCrtc	crtc B32;
+} xRRGetCrtcGammaReq; 
+#define sz_xRRGetCrtcGammaReq		8
+
+typedef struct {
+    BYTE	type;
+    CARD8	status;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	size B16;
+    CARD16	pad1 B16;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xRRGetCrtcGammaReply;
+#define sz_xRRGetCrtcGammaReply		32
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RRCrtc	crtc B32;
+    CARD16	size B16;
+    CARD16	pad1 B16;
+} xRRSetCrtcGammaReq;
+#define sz_xRRSetCrtcGammaReq		12
+
+/*
+ * Additions for V1.3
+ */
+
+typedef xRRGetScreenResourcesReq xRRGetScreenResourcesCurrentReq;
+
+#define sz_xRRGetScreenResourcesCurrentReq sz_xRRGetScreenResourcesReq
+
+typedef xRRGetScreenResourcesReply xRRGetScreenResourcesCurrentReply;
+#define sz_xRRGetScreenResourcesCurrentReply	sz_xRRGetScreenResourcesReply
+
+typedef struct {
+    CARD8		reqType;
+    CARD8		randrReqType;
+    CARD16		length B16;
+    RRCrtc		crtc B32;
+    xRenderTransform	transform;
+    CARD16		nbytesFilter;	/* number of bytes in filter name */
+    CARD16		pad B16;
+} xRRSetCrtcTransformReq;
+
+#define sz_xRRSetCrtcTransformReq	48
+
+typedef struct {
+    CARD8		reqType;
+    CARD8		randrReqType;
+    CARD16		length B16;
+    RRCrtc		crtc B32;
+} xRRGetCrtcTransformReq;
+
+#define sz_xRRGetCrtcTransformReq	8
+
+typedef struct {
+    BYTE		type;
+    CARD8		status;
+    CARD16		sequenceNumber B16;
+    CARD32		length B32;
+    xRenderTransform	pendingTransform;
+    BYTE		hasTransforms;
+    CARD8		pad0;
+    CARD16		pad1 B16;
+    xRenderTransform	currentTransform;
+    CARD32		pad2 B32;
+    CARD16		pendingNbytesFilter B16;    /* number of bytes in filter name */
+    CARD16		pendingNparamsFilter B16;   /* number of filter params */
+    CARD16		currentNbytesFilter B16;    /* number of bytes in filter name */
+    CARD16		currentNparamsFilter B16;   /* number of filter params */
+} xRRGetCrtcTransformReply;
+
+#define sz_xRRGetCrtcTransformReply	96
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    Window	window B32;
+    RROutput	output B32;
+} xRRSetOutputPrimaryReq;
+#define sz_xRRSetOutputPrimaryReq	12
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    Window	window B32;
+} xRRGetOutputPrimaryReq;
+#define sz_xRRGetOutputPrimaryReq	8
+
+typedef struct {
+    BYTE	type;
+    CARD8	pad;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    RROutput	output B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xRRGetOutputPrimaryReply;
+#define sz_xRRGetOutputPrimaryReply	32
+
+/*
+ * Additions for V1.4
+ */
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    Window	window B32;
+} xRRGetProvidersReq;
+#define sz_xRRGetProvidersReq 8
+
+typedef struct {
+    BYTE	type;
+    CARD8	pad;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    Time	timestamp B32;
+    CARD16	nProviders;
+    CARD16	pad1 B16;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xRRGetProvidersReply;
+#define sz_xRRGetProvidersReply 32
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RRProvider	provider B32;
+    Time	configTimestamp B32;
+} xRRGetProviderInfoReq;
+#define sz_xRRGetProviderInfoReq 12
+
+typedef struct {
+    BYTE	type;
+    CARD8	status;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    Time	timestamp B32;
+    CARD32	capabilities B32;
+    CARD16	nCrtcs B16;
+    CARD16	nOutputs B16;
+    CARD16	nAssociatedProviders B16;
+    CARD16	nameLength B16;
+    CARD32      pad1 B32;
+    CARD32      pad2 B32;
+} xRRGetProviderInfoReply;
+#define sz_xRRGetProviderInfoReply 32
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RRProvider  provider B32;
+    RRProvider  source_provider B32;
+    Time	configTimestamp B32;
+} xRRSetProviderOutputSourceReq;
+#define sz_xRRSetProviderOutputSourceReq 16
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RRProvider  provider B32;
+    RRProvider  sink_provider B32;
+    Time	configTimestamp B32;
+} xRRSetProviderOffloadSinkReq;
+#define sz_xRRSetProviderOffloadSinkReq 16
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RRProvider	provider B32;
+} xRRListProviderPropertiesReq; 
+#define sz_xRRListProviderPropertiesReq	8
+
+typedef struct {
+    BYTE	type;
+    CARD8	pad0;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	nAtoms B16;
+    CARD16	pad1 B16;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xRRListProviderPropertiesReply;
+#define sz_xRRListProviderPropertiesReply	32
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RRProvider	provider B32;
+    Atom	property B32;
+} xRRQueryProviderPropertyReq; 
+#define sz_xRRQueryProviderPropertyReq	12
+
+typedef struct {
+    BYTE	type;
+    BYTE	pad0;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    BOOL	pending;
+    BOOL	range;
+    BOOL	immutable;
+    BYTE	pad1;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xRRQueryProviderPropertyReply;
+#define sz_xRRQueryProviderPropertyReply	32
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RRProvider	provider B32;
+    Atom	property B32;
+    BOOL	pending;
+    BOOL	range;
+    CARD16	pad B16;
+} xRRConfigureProviderPropertyReq; 
+#define sz_xRRConfigureProviderPropertyReq	16
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RRProvider	provider B32;
+    Atom	property B32;
+    Atom	type B32;
+    CARD8	format;
+    CARD8	mode;
+    CARD16	pad;
+    CARD32	nUnits B32;
+} xRRChangeProviderPropertyReq;
+#define sz_xRRChangeProviderPropertyReq	24
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RRProvider	provider B32;
+    Atom	property B32;
+} xRRDeleteProviderPropertyReq;
+#define sz_xRRDeleteProviderPropertyReq	12
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RRProvider	provider B32;
+    Atom	property B32;
+    Atom	type B32;
+    CARD32	longOffset B32;
+    CARD32	longLength B32;
+#ifdef __cplusplus
+    BOOL	_delete;
+#else
+    BOOL	delete;
+#endif
+    BOOL	pending;
+    CARD16	pad1 B16;
+} xRRGetProviderPropertyReq;
+#define sz_xRRGetProviderPropertyReq	28
+
+typedef struct {
+    BYTE	type;
+    CARD8	format;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    Atom	propertyType B32;
+    CARD32	bytesAfter B32;
+    CARD32	nItems B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+} xRRGetProviderPropertyReply;
+#define sz_xRRGetProviderPropertyReply	32
+
+/*
+ * event
+ */
+typedef struct {
+    CARD8 type;				/* always evBase + ScreenChangeNotify */
+    CARD8 rotation;			/* new rotation */
+    CARD16 sequenceNumber B16;
+    Time timestamp B32;			/* time screen was changed */
+    Time configTimestamp B32;		/* time config data was changed */
+    Window root B32;			/* root window */
+    Window window B32;			/* window requesting notification */
+    SizeID sizeID B16;			/* new size ID */
+    CARD16 subpixelOrder B16;		/* subpixel order */
+    CARD16 widthInPixels B16;		/* new size */
+    CARD16 heightInPixels B16;
+    CARD16 widthInMillimeters B16;
+    CARD16 heightInMillimeters B16;
+} xRRScreenChangeNotifyEvent;
+#define sz_xRRScreenChangeNotifyEvent	32
+
+typedef struct {
+    CARD8 type;				/* always evBase + RRNotify */
+    CARD8 subCode;			/* RRNotify_CrtcChange */
+    CARD16 sequenceNumber B16;
+    Time timestamp B32;			/* time crtc was changed */
+    Window window B32;			/* window requesting notification */
+    RRCrtc crtc B32;			/* affected CRTC */
+    RRMode mode B32;			/* current mode */
+    CARD16 rotation B16;		/* rotation and reflection */
+    CARD16 pad1 B16;			/* unused */
+    INT16 x B16;			/* new location */
+    INT16 y B16;
+    CARD16 width B16;			/* new size */
+    CARD16 height B16;
+} xRRCrtcChangeNotifyEvent;
+#define sz_xRRCrtcChangeNotifyEvent	32
+
+typedef struct {
+    CARD8 type;				/* always evBase + RRNotify */
+    CARD8 subCode;			/* RRNotify_OutputChange */
+    CARD16 sequenceNumber B16;
+    Time timestamp B32;			/* time output was changed */
+    Time configTimestamp B32;		/* time config was changed */
+    Window window B32;			/* window requesting notification */
+    RROutput output B32;		/* affected output */
+    RRCrtc crtc B32;			/* current crtc */
+    RRMode mode B32;			/* current mode */
+    CARD16 rotation B16;		/* rotation and reflection */
+    CARD8 connection;			/* connection status */
+    CARD8 subpixelOrder;		/* subpixel order */
+} xRROutputChangeNotifyEvent;
+#define sz_xRROutputChangeNotifyEvent	32
+
+typedef struct {
+    CARD8 type;				/* always evBase + RRNotify */
+    CARD8 subCode;			/* RRNotify_OutputProperty */
+    CARD16 sequenceNumber B16;
+    Window window B32;			/* window requesting notification */
+    RROutput output B32;		/* affected output */
+    Atom atom B32;			/* property name */
+    Time timestamp B32;			/* time crtc was changed */
+    CARD8 state;			/* NewValue or Deleted */
+    CARD8 pad1;
+    CARD16 pad2 B16;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+} xRROutputPropertyNotifyEvent;
+#define sz_xRROutputPropertyNotifyEvent	32
+
+typedef struct {
+    CARD8 type;				/* always evBase + RRNotify */
+    CARD8 subCode;			/* RRNotify_ProviderChange */
+    CARD16 sequenceNumber B16;
+    Time timestamp B32;			/* time provider was changed */
+    Window window B32;			/* window requesting notification */
+    RRProvider provider B32;		/* affected provider */
+    CARD32 pad1 B32;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+} xRRProviderChangeNotifyEvent;
+#define sz_xRRProviderChangeNotifyEvent	32
+
+typedef struct {
+    CARD8 type;				/* always evBase + RRNotify */
+    CARD8 subCode;			/* RRNotify_ProviderProperty */
+    CARD16 sequenceNumber B16;
+    Window window B32;			/* window requesting notification */
+    RRProvider provider B32;		/* affected provider */
+    Atom atom B32;			/* property name */
+    Time timestamp B32;			/* time provider was changed */
+    CARD8 state;			/* NewValue or Deleted */
+    CARD8 pad1;
+    CARD16 pad2 B16;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+} xRRProviderPropertyNotifyEvent;
+#define sz_xRRProviderPropertyNotifyEvent	32
+
+typedef struct {
+    CARD8 type;				/* always evBase + RRNotify */
+    CARD8 subCode;			/* RRNotify_ResourceChange */
+    CARD16 sequenceNumber B16;
+    Time timestamp B32;			/* time resource was changed */
+    Window window B32;			/* window requesting notification */
+    CARD32 pad1 B32;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+} xRRResourceChangeNotifyEvent;
+#define sz_xRRResourceChangeNotifyEvent	32
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RRCrtc	crtc B32;
+} xRRGetPanningReq; 
+#define sz_xRRGetPanningReq		8
+
+typedef struct {
+    BYTE	type;
+    CARD8	status;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    Time	timestamp B32;
+    CARD16	left B16;
+    CARD16	top B16;
+    CARD16	width B16;
+    CARD16	height B16;
+    CARD16	track_left B16;
+    CARD16	track_top B16;
+    CARD16	track_width B16;
+    CARD16	track_height B16;
+    INT16	border_left B16;
+    INT16	border_top B16;
+    INT16	border_right B16;
+    INT16	border_bottom B16;
+} xRRGetPanningReply;
+#define sz_xRRGetPanningReply		36
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    RRCrtc	crtc B32;
+    Time	timestamp B32;
+    CARD16	left B16;
+    CARD16	top B16;
+    CARD16	width B16;
+    CARD16	height B16;
+    CARD16	track_left B16;
+    CARD16	track_top B16;
+    CARD16	track_width B16;
+    CARD16	track_height B16;
+    INT16	border_left B16;
+    INT16	border_top B16;
+    INT16	border_right B16;
+    INT16	border_bottom B16;
+} xRRSetPanningReq; 
+#define sz_xRRSetPanningReq		36
+
+typedef struct {
+    BYTE	type;
+    CARD8	status;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    Time	newTimestamp B32;
+    CARD32      pad1 B32;
+    CARD32      pad2 B32;
+    CARD32      pad3 B32;
+    CARD32      pad4 B32;
+    CARD32      pad5 B32;
+} xRRSetPanningReply;
+#define sz_xRRSetPanningReply	32
+
+typedef struct {
+    Atom	name B32;
+    BOOL	primary;
+    BOOL	automatic;
+    CARD16	noutput B16;
+    INT16	x B16;
+    INT16	y B16;
+    CARD16	width B16;
+    CARD16	height B16;
+    CARD32	widthInMillimeters B32;
+    CARD32	heightInMillimeters B32;
+} xRRMonitorInfo;
+#define sz_xRRMonitorInfo	24
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    Window	window B32;
+    BOOL	get_active;
+    CARD8	pad;
+    CARD16	pad2;
+} xRRGetMonitorsReq;
+#define sz_xRRGetMonitorsReq	12
+
+typedef struct {
+    BYTE	type;
+    CARD8	status;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    Time	timestamp B32;
+    CARD32	nmonitors B32;
+    CARD32	noutputs B32;
+    CARD32      pad1 B32;
+    CARD32      pad2 B32;
+    CARD32      pad3 B32;
+} xRRGetMonitorsReply;
+#define sz_xRRGetMonitorsReply	32
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    Window	window B32;
+    xRRMonitorInfo	monitor;
+} xRRSetMonitorReq;
+#define sz_xRRSetMonitorReq	32
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	randrReqType;
+    CARD16	length B16;
+    Window	window B32;
+    Atom	name B32;
+} xRRDeleteMonitorReq;
+#define sz_xRRDeleteMonitorReq	12
+
+#undef RRModeFlags
+#undef RRCrtc
+#undef RRMode
+#undef RROutput
+#undef RRMode
+#undef RRCrtc
+#undef RRProvider
+#undef Drawable
+#undef Window
+#undef Font
+#undef Pixmap
+#undef Cursor
+#undef Colormap
+#undef GContext
+#undef Atom
+#undef Time
+#undef KeyCode
+#undef KeySym
+#undef Rotation
+#undef SizeID
+#undef SubpixelOrder
+#undef Atom
+
+#endif /* _XRANDRP_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/record.h b/ThirdParty/X11/Include/X11/extensions/record.h
new file mode 100644
index 0000000000000000000000000000000000000000..e82b06ccabd2881c21b60a8300b4328e5f45ddf3
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/record.h
@@ -0,0 +1,183 @@
+/***************************************************************************
+ * Copyright 1995 Network Computing Devices
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Network Computing Devices
+ * not be used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ *
+ * NETWORK COMPUTING DEVICES DISCLAIMs ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE
+ * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ **************************************************************************/
+
+#ifndef _RECORD_H_
+#define _RECORD_H_
+
+#include <X11/extensions/recordconst.h>
+
+typedef unsigned long   XRecordClientSpec;
+typedef unsigned long	XRecordContext;
+
+typedef struct
+{
+    unsigned char	first;
+    unsigned char	last;
+} XRecordRange8;
+
+typedef struct
+{
+    unsigned short	first;
+    unsigned short	last;
+} XRecordRange16;
+
+typedef struct
+{
+    XRecordRange8	ext_major;
+    XRecordRange16	ext_minor;
+} XRecordExtRange;
+
+typedef struct
+{
+    XRecordRange8     core_requests;	/* core X requests */
+    XRecordRange8     core_replies;	/* core X replies */
+    XRecordExtRange   ext_requests;	/* extension requests */
+    XRecordExtRange   ext_replies;	/* extension replies */
+    XRecordRange8     delivered_events;	/* delivered core and ext events */
+    XRecordRange8     device_events;	/* all core and ext device events */
+    XRecordRange8     errors;		/* core X and ext errors */
+    Bool	      client_started;	/* connection setup reply */
+    Bool              client_died;	/* notice of client disconnect */
+} XRecordRange;
+
+typedef struct
+{
+    XRecordClientSpec	client;
+    unsigned long	nranges;
+    XRecordRange	**ranges;
+} XRecordClientInfo;
+
+typedef struct
+{
+    Bool		enabled;
+    int			datum_flags;
+    unsigned long	nclients;
+    XRecordClientInfo	**client_info;
+} XRecordState;
+
+typedef struct
+{
+    XID		id_base;
+    Time		server_time;
+    unsigned long	client_seq;
+    int			category;
+    Bool		client_swapped;
+    unsigned char	*data;
+    unsigned long	data_len;	/* in 4-byte units */
+} XRecordInterceptData;
+
+_XFUNCPROTOBEGIN
+
+/*********************************************************
+ *
+ * Prototypes
+ *
+ */
+
+XID XRecordIdBaseMask(
+    Display *dpy
+);
+
+extern Status XRecordQueryVersion(
+    Display*			/* dpy */,
+    int*			/* cmajor_return */,
+    int*			/* cminor_return */
+);
+
+extern XRecordContext XRecordCreateContext(
+    Display*			/* dpy */,
+    int				/* datum_flags */,
+    XRecordClientSpec*		/* clients */,
+    int				/* nclients */,
+    XRecordRange**              /* ranges */,
+    int				/* nranges */
+);
+
+extern XRecordRange *XRecordAllocRange(
+    void
+);
+
+extern Status XRecordRegisterClients(
+    Display*			/* dpy */,
+    XRecordContext		/* context */,
+    int				/* datum_flags */,
+    XRecordClientSpec*		/* clients */,
+    int				/* nclients */,
+    XRecordRange**		/* ranges */,
+    int				/* nranges */
+);
+
+extern Status XRecordUnregisterClients(
+    Display*			/* dpy */,
+    XRecordContext		/* context */,
+    XRecordClientSpec*		/* clients */,
+    int				/* nclients */
+);
+
+extern Status XRecordGetContext(
+    Display*			/* dpy */,
+    XRecordContext		/* context */,
+    XRecordState**		/* state_return */
+);
+
+extern void XRecordFreeState(
+XRecordState*			/* state */
+);
+
+typedef void (*XRecordInterceptProc) (
+    XPointer			/* closure */,
+    XRecordInterceptData*	/* recorded_data */
+);
+
+extern Status XRecordEnableContext(
+    Display*			/* dpy */,
+    XRecordContext		/* context */,
+    XRecordInterceptProc	/* callback */,
+    XPointer			/* closure */
+);
+
+extern Status XRecordEnableContextAsync(
+    Display*			/* dpy */,
+    XRecordContext		/* context */,
+    XRecordInterceptProc	/* callback */,
+    XPointer			/* closure */
+);
+
+extern void XRecordProcessReplies(
+    Display*			/* dpy */
+);
+
+extern void XRecordFreeData(
+XRecordInterceptData*	/* data */
+);
+
+extern Status XRecordDisableContext(
+    Display*			/* dpy */,
+    XRecordContext		/* context */
+);
+
+extern Status XRecordFreeContext(
+    Display*			/* dpy */,
+    XRecordContext		/* context */
+);
+
+_XFUNCPROTOEND
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/recordconst.h b/ThirdParty/X11/Include/X11/extensions/recordconst.h
new file mode 100644
index 0000000000000000000000000000000000000000..4819de77e61feea7f2487eca1ba54be03df7b34e
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/recordconst.h
@@ -0,0 +1,54 @@
+/***************************************************************************
+ * Copyright 1995 Network Computing Devices
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Network Computing Devices 
+ * not be used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ *
+ * NETWORK COMPUTING DEVICES DISCLAIMs ALL WARRANTIES WITH REGARD TO 
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
+ * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE 
+ * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ **************************************************************************/
+
+#ifndef _RECORDCONST_H_
+#define _RECORDCONST_H_
+
+#define RECORD_NAME			"RECORD"
+#define RECORD_MAJOR_VERSION		1
+#define RECORD_MINOR_VERSION		13
+#define RECORD_LOWEST_MAJOR_VERSION	1
+#define RECORD_LOWEST_MINOR_VERSION	12
+
+#define XRecordBadContext       0	/* Not a valid RC */
+
+#define RecordNumErrors         (XRecordBadContext + 1)
+#define RecordNumEvents		0L
+
+/*
+ * Constants for arguments of various requests
+ */
+#define	XRecordFromServerTime		0x01
+#define	XRecordFromClientTime		0x02
+#define	XRecordFromClientSequence	0x04
+
+#define XRecordCurrentClients		1
+#define XRecordFutureClients		2
+#define XRecordAllClients		3
+
+#define XRecordFromServer           	0
+#define XRecordFromClient               1
+#define XRecordClientStarted           	2
+#define XRecordClientDied               3
+#define XRecordStartOfData		4
+#define XRecordEndOfData		5
+
+
+#endif /* _RECORD_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/recordproto.h b/ThirdParty/X11/Include/X11/extensions/recordproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..01bc9529f6ecf20d19b89374883ddaa0649e4aee
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/recordproto.h
@@ -0,0 +1,306 @@
+/***************************************************************************
+ * Copyright 1995 Network Computing Devices
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Network Computing Devices
+ * not be used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ *
+ * NETWORK COMPUTING DEVICES DISCLAIMs ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE
+ * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ **************************************************************************/
+
+#ifndef _RECORDPROTO_H_
+#define _RECORDPROTO_H_
+
+#include <X11/extensions/recordconst.h>
+
+/* only difference between 1.12 and 1.13 is byte order of device events,
+   which the library doesn't deal with. */
+
+/*********************************************************
+ *
+ * Protocol request constants
+ *
+ */
+#define X_RecordQueryVersion    0     /* First request from client */
+#define X_RecordCreateContext   1     /* Create client RC */
+#define X_RecordRegisterClients 2     /* Add to client RC */
+#define X_RecordUnregisterClients 3   /* Delete from client RC */
+#define X_RecordGetContext      4     /* Query client RC */
+#define X_RecordEnableContext   5     /* Enable interception and reporting */
+#define X_RecordDisableContext  6     /* Disable interception and reporting */
+#define X_RecordFreeContext     7     /* Free client RC */
+
+#define sz_XRecordRange		32
+#define sz_XRecordClientInfo 	12
+#define sz_XRecordState 	16
+#define sz_XRecordDatum 	32
+
+
+#define XRecordGlobaldef
+#define XRecordGlobalref extern
+
+#define RecordMaxEvent     	(128L-1L)
+#define RecordMinDeviceEvent	(2L)
+#define RecordMaxDeviceEvent	(6L)
+#define RecordMaxError          (256L-1L)
+#define RecordMaxCoreRequest    (128L-1L)
+#define RecordMaxExtRequest     (256L-1L)
+#define RecordMinExtRequest     (129L-1L)
+
+#define RECORD_RC 		CARD32
+#define RECORD_XIDBASE		CARD32
+#define RECORD_CLIENTSPEC	CARD32
+#define RECORD_ELEMENT_HEADER	CARD8
+
+typedef RECORD_CLIENTSPEC RecordClientSpec, *RecordClientSpecPtr;
+
+typedef struct
+{
+    CARD8	first;
+    CARD8	last;
+} RECORD_RANGE8;
+
+typedef struct
+{
+    CARD16	first B16;
+    CARD16	last B16;
+} RECORD_RANGE16;
+
+typedef struct
+{
+    RECORD_RANGE8	majorCode;
+    RECORD_RANGE16	minorCode;
+} RECORD_EXTRANGE;
+
+typedef struct
+{
+    RECORD_RANGE8	coreRequests;
+    RECORD_RANGE8	coreReplies;
+    RECORD_EXTRANGE	extRequests;
+    RECORD_EXTRANGE	extReplies;
+    RECORD_RANGE8	deliveredEvents;
+    RECORD_RANGE8	deviceEvents;
+    RECORD_RANGE8	errors;
+    BOOL		clientStarted;
+    BOOL		clientDied;
+} RECORDRANGE;
+#define sz_RECORDRANGE 	24
+
+/* typedef RECORDRANGE xRecordRange, *xRecordRangePtr;
+#define sz_xRecordRange 24 */
+
+/* Cannot have structures within structures going over the wire */
+typedef struct
+{
+    CARD8       	coreRequestsFirst;
+    CARD8       	coreRequestsLast;
+    CARD8       	coreRepliesFirst;
+    CARD8       	coreRepliesLast;
+    CARD8  		extRequestsMajorFirst;
+    CARD8		extRequestsMajorLast;
+    CARD16  		extRequestsMinorFirst B16;
+    CARD16  		extRequestsMinorLast B16;
+    CARD8  		extRepliesMajorFirst;
+    CARD8		extRepliesMajorLast;
+    CARD16  		extRepliesMinorFirst B16;
+    CARD16  		extRepliesMinorLast B16;
+    CARD8       	deliveredEventsFirst;
+    CARD8       	deliveredEventsLast;
+    CARD8		deviceEventsFirst;
+    CARD8		deviceEventsLast;
+    CARD8       	errorsFirst;
+    CARD8       	errorsLast;
+    BOOL                clientStarted;
+    BOOL		clientDied;
+} xRecordRange;
+#define sz_xRecordRange 24
+
+typedef struct
+{
+    RECORD_CLIENTSPEC	clientResource B32;
+    CARD32		nRanges B32;
+/* LISTofRECORDRANGE */
+} RECORD_CLIENT_INFO;
+
+typedef RECORD_CLIENT_INFO xRecordClientInfo;
+
+/*
+ * Initialize
+ */
+typedef struct {
+    CARD8       reqType;
+    CARD8       recordReqType;
+    CARD16      length B16;
+    CARD16      majorVersion B16;
+    CARD16      minorVersion B16;
+} xRecordQueryVersionReq;
+#define sz_xRecordQueryVersionReq 	8
+
+typedef struct
+{
+    CARD8   type;
+    CARD8   pad0;
+    CARD16  sequenceNumber B16;
+    CARD32  length	 B32;
+    CARD16  majorVersion B16;
+    CARD16  minorVersion B16;
+    CARD32  pad1	 B32;
+    CARD32  pad2	 B32;
+    CARD32  pad3	 B32;
+    CARD32  pad4	 B32;
+    CARD32  pad5	 B32;
+ } xRecordQueryVersionReply;
+#define sz_xRecordQueryVersionReply  	32
+
+/*
+ * Create RC
+ */
+typedef struct
+{
+    CARD8     		reqType;
+    CARD8     		recordReqType;
+    CARD16    		length B16;
+    RECORD_RC		context B32;
+    RECORD_ELEMENT_HEADER elementHeader;
+    CARD8		pad;
+    CARD16		pad0 B16;
+    CARD32		nClients B32;
+    CARD32              nRanges B32;
+/* LISTofRECORD_CLIENTSPEC */
+/* LISTofRECORDRANGE */
+} xRecordCreateContextReq;
+#define sz_xRecordCreateContextReq 	20
+
+/*
+ * Add to  RC
+ */
+typedef struct
+{
+    CARD8     		reqType;
+    CARD8     		recordReqType;
+    CARD16    		length B16;
+    RECORD_RC		context B32;
+    RECORD_ELEMENT_HEADER elementHeader;
+    CARD8		pad;
+    CARD16		pad0 B16;
+    CARD32		nClients B32;
+    CARD32              nRanges B32;
+/* LISTofRECORD_CLIENTSPEC */
+/* LISTofRECORDRANGE */
+} xRecordRegisterClientsReq;
+#define sz_xRecordRegisterClientsReq 	20
+
+/*
+ * Delete from RC
+ */
+typedef struct
+{
+    CARD8     		reqType;
+    CARD8     		recordReqType;
+    CARD16    		length B16;
+    RECORD_RC		context B32;
+    CARD32		nClients B32;
+/* LISTofRECORD_CLIENTSPEC */
+} xRecordUnregisterClientsReq;
+#define sz_xRecordUnregisterClientsReq 	12
+
+/*
+ * Query RC
+ */
+typedef struct
+{
+    CARD8     	reqType;
+    CARD8     	recordReqType;
+    CARD16    	length B16;
+    RECORD_RC	context B32;
+} xRecordGetContextReq;
+#define sz_xRecordGetContextReq 		8
+
+typedef struct
+{
+    CARD8   	type;
+    BOOL    	enabled;
+    CARD16  	sequenceNumber B16;
+    CARD32  	length	 B32;
+    RECORD_ELEMENT_HEADER  elementHeader;
+    CARD8	pad;
+    CARD16	pad0 B16;
+    CARD32  	nClients B32;
+    CARD32  	pad1 B32;
+    CARD32  	pad2 B32;
+    CARD32  	pad3 B32;
+    CARD32  	pad4 B32;
+/* LISTofCLIENT_INFO */ 		/* intercepted-clients */
+} xRecordGetContextReply;
+#define sz_xRecordGetContextReply  	32
+
+/*
+ * Enable data interception
+ */
+typedef struct
+{
+    CARD8     	reqType;
+    CARD8     	recordReqType;
+    CARD16    	length B16;
+    RECORD_RC	context B32;
+} xRecordEnableContextReq;
+#define sz_xRecordEnableContextReq 	8
+
+typedef struct
+{
+    CARD8		type;
+    CARD8		category;
+    CARD16		sequenceNumber B16;
+    CARD32		length B32;
+    RECORD_ELEMENT_HEADER  elementHeader;
+    BOOL		clientSwapped;
+    CARD16		pad1 B16;
+    RECORD_XIDBASE 	idBase B32;
+    CARD32		serverTime B32;
+    CARD32		recordedSequenceNumber B32;
+    CARD32		pad3 B32;
+    CARD32		pad4 B32;
+    /* BYTE		data; */
+} xRecordEnableContextReply;
+#define sz_xRecordEnableContextReply 	32
+
+/*
+ * Disable data interception
+ */
+typedef struct
+{
+    CARD8     	reqType;
+    CARD8     	recordReqType;
+    CARD16    	length B16;
+    RECORD_RC 	context B32;
+} xRecordDisableContextReq;
+#define sz_xRecordDisableContextReq	8
+
+/*
+ * Free RC
+ */
+typedef struct
+{
+    CARD8     	reqType;
+    CARD8     	recordReqType;
+    CARD16    	length B16;
+    RECORD_RC 	context B32;
+} xRecordFreeContextReq;
+#define sz_xRecordFreeContextReq 	8
+
+#undef RECORD_RC
+#undef RECORD_XIDBASE
+#undef RECORD_ELEMENT_HEADER
+#undef RECORD_CLIENTSPEC
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/recordstr.h b/ThirdParty/X11/Include/X11/extensions/recordstr.h
new file mode 100644
index 0000000000000000000000000000000000000000..7f269b77e3af4cfbdf7a13163a681e6c69a654e8
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/recordstr.h
@@ -0,0 +1,4 @@
+#warning "recordstr.h is obsolete and may be removed in the future."
+#warning "include <X11/extensions/record.h> for the library interfaces."
+#warning "include <X11/extensions/recordproto.h> for the protocol defines."
+#include <X11/extensions/recordproto.h>
diff --git a/ThirdParty/X11/Include/X11/extensions/render.h b/ThirdParty/X11/Include/X11/extensions/render.h
new file mode 100644
index 0000000000000000000000000000000000000000..7e35bd66378bb9eaf95ea301f28c153379c1d5ad
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/render.h
@@ -0,0 +1,212 @@
+/*
+ * $XFree86: xc/include/extensions/render.h,v 1.10 2002/11/06 22:47:49 keithp Exp $
+ *
+ * Copyright © 2000 SuSE, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of SuSE not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  SuSE makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author:  Keith Packard, SuSE, Inc.
+ */
+
+#ifndef _RENDER_H_
+#define _RENDER_H_
+
+#include <X11/Xdefs.h>
+
+typedef XID		Glyph;
+typedef XID		GlyphSet;
+typedef XID		Picture;
+typedef XID		PictFormat;
+
+#define RENDER_NAME	"RENDER"
+#define RENDER_MAJOR	0
+#define RENDER_MINOR	11
+
+#define X_RenderQueryVersion		    0
+#define X_RenderQueryPictFormats	    1
+#define X_RenderQueryPictIndexValues	    2	/* 0.7 */
+#define X_RenderQueryDithers		    3
+#define X_RenderCreatePicture		    4
+#define X_RenderChangePicture		    5
+#define X_RenderSetPictureClipRectangles    6
+#define X_RenderFreePicture		    7
+#define X_RenderComposite		    8
+#define X_RenderScale			    9
+#define X_RenderTrapezoids		    10
+#define X_RenderTriangles		    11
+#define X_RenderTriStrip		    12
+#define X_RenderTriFan			    13
+#define X_RenderColorTrapezoids		    14
+#define X_RenderColorTriangles		    15
+/* #define X_RenderTransform		    16 */
+#define X_RenderCreateGlyphSet		    17
+#define X_RenderReferenceGlyphSet	    18
+#define X_RenderFreeGlyphSet		    19
+#define X_RenderAddGlyphs		    20
+#define X_RenderAddGlyphsFromPicture	    21
+#define X_RenderFreeGlyphs		    22
+#define X_RenderCompositeGlyphs8	    23
+#define X_RenderCompositeGlyphs16	    24
+#define X_RenderCompositeGlyphs32	    25
+#define X_RenderFillRectangles		    26
+/* 0.5 */
+#define X_RenderCreateCursor		    27
+/* 0.6 */
+#define X_RenderSetPictureTransform	    28
+#define X_RenderQueryFilters		    29
+#define X_RenderSetPictureFilter	    30
+/* 0.8 */
+#define X_RenderCreateAnimCursor	    31
+/* 0.9 */
+#define X_RenderAddTraps		    32
+/* 0.10 */
+#define X_RenderCreateSolidFill             33
+#define X_RenderCreateLinearGradient        34
+#define X_RenderCreateRadialGradient        35
+#define X_RenderCreateConicalGradient       36
+#define RenderNumberRequests		    (X_RenderCreateConicalGradient+1)
+
+#define BadPictFormat			    0
+#define BadPicture			    1
+#define BadPictOp			    2
+#define BadGlyphSet			    3
+#define BadGlyph			    4
+#define RenderNumberErrors		    (BadGlyph+1)
+
+#define PictTypeIndexed			    0
+#define PictTypeDirect			    1
+
+#define PictOpMinimum			    0
+#define PictOpClear			    0
+#define PictOpSrc			    1
+#define PictOpDst			    2
+#define PictOpOver			    3
+#define PictOpOverReverse		    4
+#define PictOpIn			    5
+#define PictOpInReverse			    6
+#define PictOpOut			    7
+#define PictOpOutReverse		    8
+#define PictOpAtop			    9
+#define PictOpAtopReverse		    10
+#define PictOpXor			    11
+#define PictOpAdd			    12
+#define PictOpSaturate			    13
+#define PictOpMaximum			    13
+
+/*
+ * Operators only available in version 0.2
+ */
+#define PictOpDisjointMinimum			    0x10
+#define PictOpDisjointClear			    0x10
+#define PictOpDisjointSrc			    0x11
+#define PictOpDisjointDst			    0x12
+#define PictOpDisjointOver			    0x13
+#define PictOpDisjointOverReverse		    0x14
+#define PictOpDisjointIn			    0x15
+#define PictOpDisjointInReverse			    0x16
+#define PictOpDisjointOut			    0x17
+#define PictOpDisjointOutReverse		    0x18
+#define PictOpDisjointAtop			    0x19
+#define PictOpDisjointAtopReverse		    0x1a
+#define PictOpDisjointXor			    0x1b
+#define PictOpDisjointMaximum			    0x1b
+
+#define PictOpConjointMinimum			    0x20
+#define PictOpConjointClear			    0x20
+#define PictOpConjointSrc			    0x21
+#define PictOpConjointDst			    0x22
+#define PictOpConjointOver			    0x23
+#define PictOpConjointOverReverse		    0x24
+#define PictOpConjointIn			    0x25
+#define PictOpConjointInReverse			    0x26
+#define PictOpConjointOut			    0x27
+#define PictOpConjointOutReverse		    0x28
+#define PictOpConjointAtop			    0x29
+#define PictOpConjointAtopReverse		    0x2a
+#define PictOpConjointXor			    0x2b
+#define PictOpConjointMaximum			    0x2b
+
+/*
+ * Operators only available in version 0.11
+ */
+#define PictOpBlendMinimum			    0x30
+#define PictOpMultiply				    0x30
+#define PictOpScreen				    0x31
+#define PictOpOverlay				    0x32
+#define PictOpDarken				    0x33
+#define PictOpLighten				    0x34
+#define PictOpColorDodge			    0x35
+#define PictOpColorBurn				    0x36
+#define PictOpHardLight				    0x37
+#define PictOpSoftLight				    0x38
+#define PictOpDifference			    0x39
+#define PictOpExclusion				    0x3a
+#define PictOpHSLHue				    0x3b
+#define PictOpHSLSaturation			    0x3c
+#define PictOpHSLColor				    0x3d
+#define PictOpHSLLuminosity			    0x3e
+#define PictOpBlendMaximum			    0x3e
+
+#define PolyEdgeSharp			    0
+#define PolyEdgeSmooth			    1
+
+#define PolyModePrecise			    0
+#define PolyModeImprecise		    1
+
+#define CPRepeat			    (1 << 0)
+#define CPAlphaMap			    (1 << 1)
+#define CPAlphaXOrigin			    (1 << 2)
+#define CPAlphaYOrigin			    (1 << 3)
+#define CPClipXOrigin			    (1 << 4)
+#define CPClipYOrigin			    (1 << 5)
+#define CPClipMask			    (1 << 6)
+#define CPGraphicsExposure		    (1 << 7)
+#define CPSubwindowMode			    (1 << 8)
+#define CPPolyEdge			    (1 << 9)
+#define CPPolyMode			    (1 << 10)
+#define CPDither			    (1 << 11)
+#define CPComponentAlpha		    (1 << 12)
+#define CPLastBit			    12
+
+/* Filters included in 0.6 */
+#define FilterNearest			    "nearest"
+#define FilterBilinear			    "bilinear"
+/* Filters included in 0.10 */
+#define FilterConvolution		    "convolution"
+
+#define FilterFast			    "fast"
+#define FilterGood			    "good"
+#define FilterBest			    "best"
+
+#define FilterAliasNone			    -1
+
+/* Subpixel orders included in 0.6 */
+#define SubPixelUnknown			    0
+#define SubPixelHorizontalRGB		    1
+#define SubPixelHorizontalBGR		    2
+#define SubPixelVerticalRGB		    3
+#define SubPixelVerticalBGR		    4
+#define SubPixelNone			    5
+
+/* Extended repeat attributes included in 0.10 */
+#define RepeatNone                          0
+#define RepeatNormal                        1
+#define RepeatPad                           2
+#define RepeatReflect                       3
+
+#endif	/* _RENDER_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/renderproto.h b/ThirdParty/X11/Include/X11/extensions/renderproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..ffe06395d081b96f0a18dc49b5760a6ac3f0436d
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/renderproto.h
@@ -0,0 +1,663 @@
+/*
+ * $XFree86: xc/include/extensions/renderproto.h,v 1.12 2002/09/26 02:56:48 keithp Exp $
+ *
+ * Copyright © 2000 SuSE, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of SuSE not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  SuSE makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author:  Keith Packard, SuSE, Inc.
+ */
+
+#ifndef _XRENDERP_H_
+#define _XRENDERP_H_
+
+#include <X11/Xmd.h>
+#include <X11/extensions/render.h>
+
+#define Window CARD32
+#define Drawable CARD32
+#define Font CARD32
+#define Pixmap CARD32
+#define Cursor CARD32
+#define Colormap CARD32
+#define GContext CARD32
+#define Atom CARD32
+#define VisualID CARD32
+#define Time CARD32
+#define KeyCode CARD8
+#define KeySym CARD32
+
+#define Picture	    CARD32
+#define PictFormat  CARD32
+#define Fixed	    INT32
+#define Glyphset    CARD32
+
+/*
+ * data structures
+ */
+
+typedef struct {
+    CARD16  red B16;
+    CARD16  redMask B16;
+    CARD16  green B16;
+    CARD16  greenMask B16;
+    CARD16  blue B16;
+    CARD16  blueMask B16;
+    CARD16  alpha B16;
+    CARD16  alphaMask B16;
+} xDirectFormat;
+
+#define sz_xDirectFormat    16
+
+typedef struct {
+    PictFormat	id B32;
+    CARD8	type;
+    CARD8	depth;
+    CARD16	pad1 B16;
+    xDirectFormat   direct;
+    Colormap	colormap;
+} xPictFormInfo;
+
+#define sz_xPictFormInfo    28
+
+typedef struct {
+    VisualID	visual;
+    PictFormat	format;
+} xPictVisual;
+
+#define sz_xPictVisual	    8
+
+typedef struct {
+    CARD8	depth;
+    CARD8	pad1;
+    CARD16	nPictVisuals B16;
+    CARD32	pad2 B32;
+} xPictDepth;
+
+#define sz_xPictDepth	8
+
+typedef struct {
+    CARD32	nDepth B32;
+    PictFormat	fallback B32;
+} xPictScreen;
+
+#define sz_xPictScreen	8
+
+typedef struct {
+    CARD32	pixel B32;
+    CARD16	red B16;
+    CARD16	green B16;
+    CARD16	blue B16;
+    CARD16	alpha B16;
+} xIndexValue;
+
+#define sz_xIndexValue	12
+
+typedef struct {
+    CARD16	red B16;
+    CARD16	green B16;
+    CARD16	blue B16;
+    CARD16	alpha B16;
+} xRenderColor;
+
+#define sz_xRenderColor	8
+
+typedef struct {
+    Fixed	x B32;
+    Fixed	y B32;
+} xPointFixed;
+
+#define sz_xPointFixed	8
+
+typedef struct {
+    xPointFixed	p1;
+    xPointFixed p2;
+} xLineFixed;
+
+#define sz_xLineFixed	16
+
+typedef struct {
+    xPointFixed	p1, p2, p3;
+} xTriangle;
+
+#define sz_xTriangle	24
+
+typedef struct {
+    Fixed	top B32;
+    Fixed	bottom B32;
+    xLineFixed	left;
+    xLineFixed	right;
+} xTrapezoid;
+
+#define sz_xTrapezoid	40
+
+typedef struct {
+    CARD16  width B16;
+    CARD16  height B16;
+    INT16   x B16;
+    INT16   y B16;
+    INT16   xOff B16;
+    INT16   yOff B16;
+} xGlyphInfo;
+
+#define sz_xGlyphInfo	12
+
+typedef struct {
+    CARD8   len;
+    CARD8   pad1;
+    CARD16  pad2;
+    INT16   deltax;
+    INT16   deltay;
+} xGlyphElt;
+
+#define sz_xGlyphElt	8
+
+typedef struct {
+    Fixed   l, r, y;
+} xSpanFix;
+
+#define sz_xSpanFix	12
+
+typedef struct {
+    xSpanFix	top, bot;
+} xTrap;
+
+#define sz_xTrap	24
+
+/*
+ * requests and replies
+ */
+typedef struct {
+    CARD8   reqType;
+    CARD8   renderReqType;
+    CARD16  length B16;
+    CARD32  majorVersion B32;
+    CARD32  minorVersion B32;
+} xRenderQueryVersionReq;
+
+#define sz_xRenderQueryVersionReq   12
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  majorVersion B32;
+    CARD32  minorVersion B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+} xRenderQueryVersionReply;
+
+#define sz_xRenderQueryVersionReply	32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   renderReqType;
+    CARD16  length B16;
+} xRenderQueryPictFormatsReq;
+
+#define sz_xRenderQueryPictFormatsReq	4
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  numFormats B32;
+    CARD32  numScreens B32;
+    CARD32  numDepths B32;
+    CARD32  numVisuals B32;
+    CARD32  numSubpixel B32;	    /* Version 0.6 */
+    CARD32  pad5 B32;
+} xRenderQueryPictFormatsReply;
+
+#define sz_xRenderQueryPictFormatsReply	32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   renderReqType;
+    CARD16  length B16;
+    PictFormat	format B32;
+} xRenderQueryPictIndexValuesReq;
+
+#define sz_xRenderQueryPictIndexValuesReq   8
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  numIndexValues;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+    CARD32  pad6 B32;
+} xRenderQueryPictIndexValuesReply;
+
+#define sz_xRenderQueryPictIndexValuesReply 32
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	renderReqType;
+    CARD16	length B16;
+    Picture	pid B32;
+    Drawable	drawable B32;
+    PictFormat	format B32;
+    CARD32	mask B32;
+} xRenderCreatePictureReq;
+
+#define sz_xRenderCreatePictureReq	    20
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	renderReqType;
+    CARD16	length B16;
+    Picture	picture B32;
+    CARD32	mask B32;
+} xRenderChangePictureReq;
+
+#define sz_xRenderChangePictureReq	    12
+
+typedef struct {
+    CARD8       reqType;
+    CARD8       renderReqType;
+    CARD16      length B16;
+    Picture     picture B32;
+    INT16	xOrigin B16;
+    INT16	yOrigin B16;
+} xRenderSetPictureClipRectanglesReq;
+
+#define sz_xRenderSetPictureClipRectanglesReq	    12
+
+typedef struct {
+    CARD8       reqType;
+    CARD8       renderReqType;
+    CARD16      length B16;
+    Picture     picture B32;
+} xRenderFreePictureReq;
+
+#define sz_xRenderFreePictureReq	    8
+
+typedef struct {
+    CARD8       reqType;
+    CARD8       renderReqType;
+    CARD16      length B16;
+    CARD8	op;
+    CARD8	pad1;
+    CARD16	pad2 B16;
+    Picture	src B32;
+    Picture	mask B32;
+    Picture	dst B32;
+    INT16	xSrc B16;
+    INT16	ySrc B16;
+    INT16	xMask B16;
+    INT16	yMask B16;
+    INT16	xDst B16;
+    INT16	yDst B16;
+    CARD16	width B16;
+    CARD16	height B16;
+} xRenderCompositeReq;
+
+#define sz_xRenderCompositeReq		    36
+
+typedef struct {
+    CARD8       reqType;
+    CARD8       renderReqType;
+    CARD16      length B16;
+    Picture	src B32;
+    Picture	dst B32;
+    CARD32	colorScale B32;
+    CARD32	alphaScale B32;
+    INT16	xSrc B16;
+    INT16	ySrc B16;
+    INT16	xDst B16;
+    INT16	yDst B16;
+    CARD16	width B16;
+    CARD16	height B16;
+} xRenderScaleReq;
+
+#define sz_xRenderScaleReq			    32
+
+typedef struct {
+    CARD8       reqType;
+    CARD8       renderReqType;
+    CARD16      length B16;
+    CARD8	op;
+    CARD8	pad1;
+    CARD16	pad2 B16;
+    Picture	src B32;
+    Picture	dst B32;
+    PictFormat	maskFormat B32;
+    INT16	xSrc B16;
+    INT16	ySrc B16;
+} xRenderTrapezoidsReq;
+
+#define sz_xRenderTrapezoidsReq			    24
+
+typedef struct {
+    CARD8       reqType;
+    CARD8       renderReqType;
+    CARD16      length B16;
+    CARD8	op;
+    CARD8	pad1;
+    CARD16	pad2 B16;
+    Picture	src B32;
+    Picture	dst B32;
+    PictFormat	maskFormat B32;
+    INT16	xSrc B16;
+    INT16	ySrc B16;
+} xRenderTrianglesReq;
+
+#define sz_xRenderTrianglesReq			    24
+
+typedef struct {
+    CARD8       reqType;
+    CARD8       renderReqType;
+    CARD16      length B16;
+    CARD8	op;
+    CARD8	pad1;
+    CARD16	pad2 B16;
+    Picture	src B32;
+    Picture	dst B32;
+    PictFormat	maskFormat B32;
+    INT16	xSrc B16;
+    INT16	ySrc B16;
+} xRenderTriStripReq;
+
+#define sz_xRenderTriStripReq			    24
+
+typedef struct {
+    CARD8       reqType;
+    CARD8       renderReqType;
+    CARD16      length B16;
+    CARD8	op;
+    CARD8	pad1;
+    CARD16	pad2 B16;
+    Picture	src B32;
+    Picture	dst B32;
+    PictFormat	maskFormat B32;
+    INT16	xSrc B16;
+    INT16	ySrc B16;
+} xRenderTriFanReq;
+
+#define sz_xRenderTriFanReq			    24
+
+typedef struct {
+    CARD8       reqType;
+    CARD8       renderReqType;
+    CARD16      length B16;
+    Glyphset	gsid B32;
+    PictFormat	format B32;
+} xRenderCreateGlyphSetReq;
+
+#define sz_xRenderCreateGlyphSetReq		    12
+
+typedef struct {
+    CARD8       reqType;
+    CARD8       renderReqType;
+    CARD16      length B16;
+    Glyphset    gsid B32;
+    Glyphset    existing B32;
+} xRenderReferenceGlyphSetReq;
+
+#define sz_xRenderReferenceGlyphSetReq		    24
+
+typedef struct {
+    CARD8       reqType;
+    CARD8       renderReqType;
+    CARD16      length B16;
+    Glyphset    glyphset B32;
+} xRenderFreeGlyphSetReq;
+
+#define sz_xRenderFreeGlyphSetReq		    8
+
+typedef struct {
+    CARD8       reqType;
+    CARD8       renderReqType;
+    CARD16      length B16;
+    Glyphset    glyphset B32;
+    CARD32	nglyphs;
+} xRenderAddGlyphsReq;
+
+#define sz_xRenderAddGlyphsReq			    12
+
+typedef struct {
+    CARD8       reqType;
+    CARD8       renderReqType;
+    CARD16      length B16;
+    Glyphset    glyphset B32;
+} xRenderFreeGlyphsReq;
+
+#define sz_xRenderFreeGlyphsReq			    8
+
+typedef struct {
+    CARD8       reqType;
+    CARD8       renderReqType;
+    CARD16      length B16;
+    CARD8	op;
+    CARD8	pad1;
+    CARD16	pad2 B16;
+    Picture	src B32;
+    Picture	dst B32;
+    PictFormat	maskFormat B32;
+    Glyphset    glyphset B32;
+    INT16	xSrc B16;
+    INT16	ySrc B16;
+} xRenderCompositeGlyphsReq, xRenderCompositeGlyphs8Req,
+xRenderCompositeGlyphs16Req, xRenderCompositeGlyphs32Req;
+
+#define sz_xRenderCompositeGlyphs8Req		    28
+#define sz_xRenderCompositeGlyphs16Req		    28
+#define sz_xRenderCompositeGlyphs32Req		    28
+
+/* 0.1 and higher */
+
+typedef struct {
+    CARD8	reqType;
+    CARD8       renderReqType;
+    CARD16      length B16;
+    CARD8	op;
+    CARD8	pad1;
+    CARD16	pad2 B16;
+    Picture	dst B32;
+    xRenderColor    color;
+} xRenderFillRectanglesReq;
+
+#define sz_xRenderFillRectanglesReq		    20
+
+/* 0.5 and higher */
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	renderReqType;
+    CARD16	length B16;
+    Cursor	cid B32;
+    Picture	src B32;
+    CARD16	x B16;
+    CARD16	y B16;
+} xRenderCreateCursorReq;
+
+#define sz_xRenderCreateCursorReq		    16
+
+/* 0.6 and higher */
+
+/*
+ * This can't use an array because 32-bit values may be in bitfields
+ */
+typedef struct {
+    Fixed	matrix11 B32;
+    Fixed	matrix12 B32;
+    Fixed	matrix13 B32;
+    Fixed	matrix21 B32;
+    Fixed	matrix22 B32;
+    Fixed	matrix23 B32;
+    Fixed	matrix31 B32;
+    Fixed	matrix32 B32;
+    Fixed	matrix33 B32;
+} xRenderTransform;
+
+#define sz_xRenderTransform 36
+
+typedef struct {
+    CARD8		reqType;
+    CARD8		renderReqType;
+    CARD16		length B16;
+    Picture		picture B32;
+    xRenderTransform	transform;
+} xRenderSetPictureTransformReq;
+
+#define sz_xRenderSetPictureTransformReq	    44
+
+typedef struct {
+    CARD8		reqType;
+    CARD8		renderReqType;
+    CARD16		length B16;
+    Drawable		drawable B32;
+} xRenderQueryFiltersReq;
+
+#define sz_xRenderQueryFiltersReq		    8
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  numAliases B32;	/* LISTofCARD16 */
+    CARD32  numFilters B32;	/* LISTofSTRING8 */
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+} xRenderQueryFiltersReply;
+
+#define sz_xRenderQueryFiltersReply		    32
+
+typedef struct {
+    CARD8		reqType;
+    CARD8		renderReqType;
+    CARD16		length B16;
+    Picture		picture B32;
+    CARD16		nbytes B16; /* number of bytes in name */
+    CARD16		pad B16;
+} xRenderSetPictureFilterReq;
+
+#define sz_xRenderSetPictureFilterReq		    12
+
+/* 0.8 and higher */
+
+typedef struct {
+    Cursor		cursor B32;
+    CARD32		delay B32;
+} xAnimCursorElt;
+
+#define sz_xAnimCursorElt			    8
+
+typedef struct {
+    CARD8		reqType;
+    CARD8		renderReqType;
+    CARD16		length B16;
+    Cursor		cid B32;
+} xRenderCreateAnimCursorReq;
+
+#define sz_xRenderCreateAnimCursorReq		    8
+
+/* 0.9 and higher */
+
+typedef struct {
+    CARD8		reqType;
+    CARD8		renderReqType;
+    CARD16		length B16;
+    Picture		picture;
+    INT16		xOff B16;
+    INT16		yOff B16;
+} xRenderAddTrapsReq;
+
+#define sz_xRenderAddTrapsReq			    12
+
+/* 0.10 and higher */
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	renderReqType;
+    CARD16	length B16;
+    Picture	pid B32;
+    xRenderColor color;
+} xRenderCreateSolidFillReq;
+
+#define sz_xRenderCreateSolidFillReq                 16
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	renderReqType;
+    CARD16	length B16;
+    Picture	pid B32;
+    xPointFixed p1;
+    xPointFixed p2;
+    CARD32      nStops;
+} xRenderCreateLinearGradientReq;
+
+#define sz_xRenderCreateLinearGradientReq                 28
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	renderReqType;
+    CARD16	length B16;
+    Picture	pid B32;
+    xPointFixed inner;
+    xPointFixed outer;
+    Fixed       inner_radius;
+    Fixed       outer_radius;
+    CARD32      nStops;
+} xRenderCreateRadialGradientReq;
+
+#define sz_xRenderCreateRadialGradientReq                 36
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	renderReqType;
+    CARD16	length B16;
+    Picture	pid B32;
+    xPointFixed center;
+    Fixed       angle; /* in degrees */
+    CARD32      nStops;
+} xRenderCreateConicalGradientReq;
+
+#define sz_xRenderCreateConicalGradientReq                 24
+
+#undef Window
+#undef Drawable
+#undef Font
+#undef Pixmap
+#undef Cursor
+#undef Colormap
+#undef GContext
+#undef Atom
+#undef VisualID
+#undef Time
+#undef KeyCode
+#undef KeySym
+
+#undef Picture
+#undef PictFormat
+#undef Fixed
+#undef Glyphset
+
+#endif /* _XRENDERP_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/saver.h b/ThirdParty/X11/Include/X11/extensions/saver.h
new file mode 100644
index 0000000000000000000000000000000000000000..e8da62560163a837bf403595f778ed537e461531
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/saver.h
@@ -0,0 +1,52 @@
+/*
+Copyright (c) 1992  X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+ *
+ * Author:  Keith Packard, MIT X Consortium
+ */
+
+#ifndef _SAVER_H_
+#define _SAVER_H_
+
+#define ScreenSaverName	"MIT-SCREEN-SAVER"
+#define ScreenSaverPropertyName "_MIT_SCREEN_SAVER_ID"
+
+#define ScreenSaverNotifyMask	0x00000001
+#define ScreenSaverCycleMask	0x00000002
+
+#define ScreenSaverMajorVersion	1
+#define ScreenSaverMinorVersion	1
+
+#define ScreenSaverOff		0
+#define ScreenSaverOn		1
+#define ScreenSaverCycle	2
+#define ScreenSaverDisabled	3
+
+#define ScreenSaverBlanked	0
+#define ScreenSaverInternal	1
+#define ScreenSaverExternal	2
+
+#define ScreenSaverNotify	0
+#define ScreenSaverNumberEvents	1
+
+#endif /* _SAVER_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/saverproto.h b/ThirdParty/X11/Include/X11/extensions/saverproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..7197084cc4fd3a7903c3a83175799ad62df4b9c3
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/saverproto.h
@@ -0,0 +1,175 @@
+/*
+Copyright (c) 1992  X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+ *
+ * Author:  Keith Packard, MIT X Consortium
+ */
+
+#ifndef _SAVERPROTO_H_
+#define _SAVERPROTO_H_
+
+#include <X11/extensions/saver.h>
+
+#define Window CARD32
+#define Drawable CARD32
+#define Font CARD32
+#define Pixmap CARD32
+#define Cursor CARD32
+#define Colormap CARD32
+#define GContext CARD32
+#define Atom CARD32
+#define VisualID CARD32
+#define Time CARD32
+#define KeyCode CARD8
+#define KeySym CARD32
+
+#define X_ScreenSaverQueryVersion   0
+
+typedef struct _ScreenSaverQueryVersion {
+    CARD8 reqType;		/* always ScreenSaverReqCode */
+    CARD8 saverReqType;		/* always X_ScreenSaverQueryVersion */
+    CARD16 length B16;
+    CARD8 clientMajor;
+    CARD8 clientMinor;
+    CARD16 unused B16;	
+} xScreenSaverQueryVersionReq;
+#define sz_xScreenSaverQueryVersionReq	8
+
+typedef struct {
+    CARD8 type;			/* X_Reply */
+    CARD8 unused;			/* not used */
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD16 majorVersion B16;	/* major version of protocol */
+    CARD16 minorVersion B16;	/* minor version of protocol */
+    CARD32 pad0 B32;
+    CARD32 pad1 B32;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+} xScreenSaverQueryVersionReply;
+#define sz_xScreenSaverQueryVersionReply	32
+
+#define X_ScreenSaverQueryInfo   1
+
+typedef struct _ScreenSaverQueryInfo {
+    CARD8 reqType;		/* always ScreenSaverReqCode */
+    CARD8 saverReqType;		/* always X_ScreenSaverQueryInfo */
+    CARD16 length B16;
+    Drawable drawable B32;
+} xScreenSaverQueryInfoReq;
+#define sz_xScreenSaverQueryInfoReq	8
+
+typedef struct {
+    CARD8 type;			/* X_Reply */
+    BYTE state;			/* Off, On */
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    Window window B32;
+    CARD32 tilOrSince B32;
+    CARD32 idle B32;
+    CARD32 eventMask B32;
+    BYTE kind;			/* Blanked, Internal, External */
+    CARD8 pad0;
+    CARD16 pad1 B16;
+    CARD32 pad2 B32;
+} xScreenSaverQueryInfoReply;
+#define sz_xScreenSaverQueryInfoReply	32
+
+#define X_ScreenSaverSelectInput   2
+
+typedef struct _ScreenSaverSelectInput {
+    CARD8 reqType;		/* always ScreenSaverReqCode */
+    CARD8 saverReqType;		/* always X_ScreenSaverSelectInput */
+    CARD16 length B16;
+    Drawable drawable B32;
+    CARD32 eventMask B32;
+} xScreenSaverSelectInputReq;
+#define sz_xScreenSaverSelectInputReq	12
+
+#define X_ScreenSaverSetAttributes   3
+
+typedef struct _ScreenSaverSetAttributes {
+    CARD8 reqType;		/* always ScreenSaverReqCode */
+    CARD8 saverReqType;		/* always X_ScreenSaverSetAttributes */
+    CARD16 length B16;
+    Drawable drawable B32;
+    INT16 x B16, y B16;
+    CARD16 width B16, height B16, borderWidth B16;
+    BYTE c_class;
+    CARD8 depth;
+    VisualID visualID B32;
+    CARD32 mask B32;
+} xScreenSaverSetAttributesReq;
+#define sz_xScreenSaverSetAttributesReq	28
+
+#define X_ScreenSaverUnsetAttributes   4
+
+typedef struct _ScreenSaverUnsetAttributes {
+    CARD8 reqType;		/* always ScreenSaverReqCode */
+    CARD8 saverReqType;		/* always X_ScreenSaverUnsetAttributes */
+    CARD16 length B16;
+    Drawable drawable B32;
+} xScreenSaverUnsetAttributesReq;
+#define sz_xScreenSaverUnsetAttributesReq	8
+
+#define X_ScreenSaverSuspend   5
+
+typedef struct _ScreenSaverSuspend {
+    CARD8 reqType;
+    CARD8 saverReqType;
+    CARD16 length B16;
+    Bool suspend B32;
+} xScreenSaverSuspendReq;
+#define sz_xScreenSaverSuspendReq	8
+
+typedef struct _ScreenSaverNotify {
+    CARD8 type;			/* always eventBase + ScreenSaverNotify */
+    BYTE state;			/* off, on, cycle */
+    CARD16 sequenceNumber B16;
+    Time timestamp B32;
+    Window root B32;
+    Window window B32;		/* screen saver window */
+    BYTE kind;			/* blanked, internal, external */
+    BYTE forced;
+    CARD16 pad0 B16;
+    CARD32 pad1 B32;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+} xScreenSaverNotifyEvent;
+#define sz_xScreenSaverNotifyEvent	32
+
+#undef Window
+#undef Drawable
+#undef Font
+#undef Pixmap
+#undef Cursor
+#undef Colormap
+#undef GContext
+#undef Atom
+#undef VisualID
+#undef Time
+#undef KeyCode
+#undef KeySym
+
+#endif /* _SAVERPROTO_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/scrnsaver.h b/ThirdParty/X11/Include/X11/extensions/scrnsaver.h
new file mode 100644
index 0000000000000000000000000000000000000000..654aef6495a330b9d85ba65166a9eb2176ff193f
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/scrnsaver.h
@@ -0,0 +1,134 @@
+/*
+ *
+Copyright (c) 1992  X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+ *
+ * Author:  Keith Packard, MIT X Consortium
+ */
+
+#ifndef _SCRNSAVER_H_
+#define _SCRNSAVER_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/saver.h>
+
+typedef struct {
+    int	type;		    /* of event */
+    unsigned long serial;   /* # of last request processed by server */
+    Bool send_event;	    /* true if this came frome a SendEvent request */
+    Display *display;	    /* Display the event was read from */
+    Window window;	    /* screen saver window */
+    Window root;	    /* root window of event screen */
+    int state;		    /* ScreenSaverOff, ScreenSaverOn, ScreenSaverCycle*/
+    int kind;		    /* ScreenSaverBlanked, ...Internal, ...External */
+    Bool forced;	    /* extents of new region */
+    Time time;		    /* event timestamp */
+} XScreenSaverNotifyEvent;
+
+typedef struct {
+    Window  window;	    /* screen saver window - may not exist */
+    int	    state;	    /* ScreenSaverOff, ScreenSaverOn, ScreenSaverDisabled*/
+    int	    kind;	    /* ScreenSaverBlanked, ...Internal, ...External */
+    unsigned long    til_or_since;   /* time til or since screen saver */
+    unsigned long    idle;	    /* total time since last user input */
+    unsigned long   eventMask; /* currently selected events for this client */
+} XScreenSaverInfo;
+
+_XFUNCPROTOBEGIN
+
+extern Bool XScreenSaverQueryExtension (
+    Display*	/* display */,
+    int*	/* event_base */,
+    int*	/* error_base */
+);
+
+extern Status XScreenSaverQueryVersion (
+    Display*	/* display */,
+    int*	/* major_version */,
+    int*	/* minor_version */
+);
+
+extern XScreenSaverInfo *XScreenSaverAllocInfo (
+    void
+);
+
+extern Status XScreenSaverQueryInfo (
+    Display*		/* display */,
+    Drawable		/* drawable */,
+    XScreenSaverInfo*	/* info */
+);
+
+extern void XScreenSaverSelectInput (
+    Display*	/* display */,
+    Drawable	/* drawable */,
+    unsigned long   /* eventMask */
+);
+
+extern void XScreenSaverSetAttributes (
+    Display*		    /* display */,
+    Drawable		    /* drawable */,
+    int			    /* x */,
+    int			    /* y */,
+    unsigned int	    /* width */,
+    unsigned int	    /* height */,
+    unsigned int	    /* border_width */,
+    int			    /* depth */,
+    unsigned int	    /* class */,
+    Visual *		    /* visual */,
+    unsigned long	    /* valuemask */,
+    XSetWindowAttributes *  /* attributes */
+);
+
+extern void XScreenSaverUnsetAttributes (
+    Display*	/* display */,
+    Drawable	/* drawable */
+);
+
+extern Status XScreenSaverRegister (
+    Display*	/* display */,
+    int		/* screen */,
+    XID		/* xid */,
+    Atom	/* type */
+);
+
+extern Status XScreenSaverUnregister (
+    Display*	/* display */,
+    int		/* screen */
+);
+
+extern Status XScreenSaverGetRegistered (
+    Display*	/* display */,
+    int		/* screen */,
+    XID*	/* xid */,
+    Atom*	/* type */
+);
+
+extern void XScreenSaverSuspend (
+    Display*	/* display */,
+    Bool 	/* suspend */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _SCRNSAVER_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/secur.h b/ThirdParty/X11/Include/X11/extensions/secur.h
new file mode 100644
index 0000000000000000000000000000000000000000..ca27b29e6fe672d913a001b8d6c64bad9aafc20e
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/secur.h
@@ -0,0 +1,61 @@
+/*
+Copyright 1996, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+*/
+
+#ifndef _SECUR_H
+#define _SECUR_H
+
+#define SECURITY_EXTENSION_NAME		"SECURITY"
+#define SECURITY_MAJOR_VERSION		1
+#define SECURITY_MINOR_VERSION		0
+
+#define XSecurityNumberEvents		1
+#define XSecurityNumberErrors		2
+#define XSecurityBadAuthorization	0
+#define XSecurityBadAuthorizationProtocol 1
+
+/* trust levels */
+#define XSecurityClientTrusted		0
+#define XSecurityClientUntrusted	1
+
+/* authorization attribute masks */
+#define XSecurityTimeout		(1<<0)
+#define XSecurityTrustLevel		(1<<1)
+#define XSecurityGroup  		(1<<2)
+#define XSecurityEventMask		(1<<3)
+#define XSecurityAllAuthorizationAttributes \
+ (XSecurityTimeout | XSecurityTrustLevel | XSecurityGroup | XSecurityEventMask)
+
+/* event masks */
+#define XSecurityAuthorizationRevokedMask (1<<0)
+#define XSecurityAllEventMasks XSecurityAuthorizationRevokedMask
+
+/* event offsets */
+#define XSecurityAuthorizationRevoked 0
+
+#define XSecurityAuthorizationName	"XC-QUERY-SECURITY-1"
+#define XSecurityAuthorizationNameLen	19
+
+#endif /* _SECUR_H */
diff --git a/ThirdParty/X11/Include/X11/extensions/security.h b/ThirdParty/X11/Include/X11/extensions/security.h
new file mode 100644
index 0000000000000000000000000000000000000000..f5541310b7fae20aab544b89941b2a0f844bd875
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/security.h
@@ -0,0 +1,77 @@
+/*
+Copyright 1996, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+*/
+
+#ifndef _SECURITY_H
+#define _SECURITY_H
+
+#define _XAUTH_STRUCT_ONLY
+#include <X11/Xauth.h>
+
+#include <X11/extensions/secur.h>
+
+_XFUNCPROTOBEGIN
+
+Status XSecurityQueryExtension (
+    Display *dpy,
+    int *major_version_return,
+    int *minor_version_return);
+
+Xauth *XSecurityAllocXauth(void);
+
+void XSecurityFreeXauth(Xauth *auth);
+
+/* type for returned auth ids */
+typedef unsigned long XSecurityAuthorization;
+
+typedef struct {
+    unsigned int timeout;
+    unsigned int trust_level;
+    XID          group;
+    long	 event_mask;
+} XSecurityAuthorizationAttributes;
+
+Xauth *XSecurityGenerateAuthorization(
+    Display *dpy,
+    Xauth *auth_in,
+    unsigned long valuemask,
+    XSecurityAuthorizationAttributes *attributes,
+    XSecurityAuthorization *auth_id_return);
+
+Status XSecurityRevokeAuthorization(
+    Display *dpy,
+    XSecurityAuthorization auth_id);
+
+_XFUNCPROTOEND
+
+typedef struct {
+    int type;		      /* event base + XSecurityAuthorizationRevoked */
+    unsigned long serial;     /* # of last request processed by server */
+    Bool send_event;	      /* true if this came from a SendEvent request */
+    Display *display;	      /* Display the event was read from */
+    XSecurityAuthorization auth_id; /* revoked authorization id */
+} XSecurityAuthorizationRevokedEvent;
+
+#endif /* _SECURITY_H */
diff --git a/ThirdParty/X11/Include/X11/extensions/securproto.h b/ThirdParty/X11/Include/X11/extensions/securproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..409a4c5d0487152768f9d2abbe29dadd801628cb
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/securproto.h
@@ -0,0 +1,110 @@
+/*
+Copyright 1996, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+*/
+
+#ifndef _SECURPROTO_H
+#define _SECURPROTO_H
+
+#include <X11/extensions/secur.h>
+
+#define X_SecurityQueryVersion		0
+#define X_SecurityGenerateAuthorization 1
+#define X_SecurityRevokeAuthorization   2
+
+typedef struct {
+    CARD8       reqType;
+    CARD8       securityReqType;
+    CARD16      length B16;
+    CARD16      majorVersion B16;
+    CARD16      minorVersion B16;
+} xSecurityQueryVersionReq;
+#define sz_xSecurityQueryVersionReq 	8
+
+typedef struct {
+    CARD8   type;
+    CARD8   pad0;
+    CARD16  sequenceNumber B16;
+    CARD32  length	 B32;
+    CARD16  majorVersion B16;
+    CARD16  minorVersion B16;
+    CARD32  pad1	 B32;
+    CARD32  pad2	 B32;
+    CARD32  pad3	 B32;
+    CARD32  pad4	 B32;
+    CARD32  pad5	 B32;
+ } xSecurityQueryVersionReply;
+#define sz_xSecurityQueryVersionReply  	32
+
+typedef struct {
+    CARD8       reqType;
+    CARD8       securityReqType;
+    CARD16      length B16;
+    CARD16	nbytesAuthProto B16;
+    CARD16	nbytesAuthData B16;
+    CARD32	valueMask B32;
+    /* auth protocol name padded to 4 bytes */
+    /* auth protocol data padded to 4 bytes */
+    /* list of CARD32 values, if any */
+} xSecurityGenerateAuthorizationReq;
+#define sz_xSecurityGenerateAuthorizationReq 12
+
+typedef struct {
+    CARD8   type;
+    CARD8   pad0;
+    CARD16  sequenceNumber B16;
+    CARD32  length	 B32;
+    CARD32  authId	 B32;
+    CARD16  dataLength   B16;
+    CARD16  pad1	 B16;
+    CARD32  pad2	 B32;
+    CARD32  pad3	 B32;
+    CARD32  pad4	 B32;
+    CARD32  pad5	 B32;
+ } xSecurityGenerateAuthorizationReply;
+#define sz_xSecurityGenerateAuthorizationReply  	32
+
+typedef struct {
+    CARD8       reqType;
+    CARD8       securityReqType;
+    CARD16      length B16;
+    CARD32	authId B32;
+} xSecurityRevokeAuthorizationReq;
+#define sz_xSecurityRevokeAuthorizationReq 8
+
+typedef struct _xSecurityAuthorizationRevokedEvent {
+    BYTE	type;
+    BYTE	detail;
+    CARD16	sequenceNumber B16;
+    CARD32	authId B32;
+    CARD32	pad0	 B32;
+    CARD32	pad1	 B32;
+    CARD32	pad2	 B32;
+    CARD32	pad3	 B32;
+    CARD32	pad4	 B32;
+    CARD32	pad5	 B32;
+} xSecurityAuthorizationRevokedEvent;
+#define sz_xSecurityAuthorizationRevokedEvent 32
+
+#endif /* _SECURPROTO_H */
diff --git a/ThirdParty/X11/Include/X11/extensions/shape.h b/ThirdParty/X11/Include/X11/extensions/shape.h
new file mode 100644
index 0000000000000000000000000000000000000000..66af5b1b4480bfcbbbcfe94cd1cb697eff6114fa
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/shape.h
@@ -0,0 +1,152 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+#ifndef _SHAPE_H_
+#define _SHAPE_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/shapeconst.h>
+
+#ifndef _SHAPE_SERVER_
+#include <X11/Xutil.h>
+
+typedef struct {
+    int	type;		    /* of event */
+    unsigned long serial;   /* # of last request processed by server */
+    Bool send_event;	    /* true if this came frome a SendEvent request */
+    Display *display;	    /* Display the event was read from */
+    Window window;	    /* window of event */
+    int kind;		    /* ShapeBounding or ShapeClip */
+    int x, y;		    /* extents of new region */
+    unsigned width, height;
+    Time time;		    /* server timestamp when region changed */
+    Bool shaped;	    /* true if the region exists */
+} XShapeEvent;
+
+_XFUNCPROTOBEGIN
+
+extern Bool XShapeQueryExtension (
+    Display*	/* display */,
+    int*	/* event_base */,
+    int*	/* error_base */
+);
+
+extern Status XShapeQueryVersion (
+    Display*	/* display */,
+    int*	/* major_version */,
+    int*	/* minor_version */
+);
+
+extern void XShapeCombineRegion (
+    Display*	/* display */,
+    Window	/* dest */,
+    int		/* dest_kind */,
+    int		/* x_off */,
+    int		/* y_off */,
+    Region	/* region */,
+    int		/* op */
+);
+
+extern void XShapeCombineRectangles (
+    Display*	/* display */,
+    Window	/* dest */,
+    int		/* dest_kind */,
+    int		/* x_off */,
+    int		/* y_off */,
+    XRectangle*	/* rectangles */,
+    int		/* n_rects */,
+    int		/* op */,
+    int		/* ordering */
+);
+
+extern void XShapeCombineMask (
+    Display*	/* display */,
+    Window	/* dest */,
+    int		/* dest_kind */,
+    int		/* x_off */,
+    int		/* y_off */,
+    Pixmap	/* src */,
+    int		/* op */
+);
+
+extern void XShapeCombineShape (
+    Display*	/* display */,
+    Window	/* dest */,
+    int		/* dest_kind */,
+    int		/* x_off */,
+    int		/* y_off */,
+    Window	/* src */,
+    int		/* src_kind */,
+    int		/* op */
+);
+
+extern void XShapeOffsetShape (
+    Display*	/* display */,
+    Window	/* dest */,
+    int		/* dest_kind */,
+    int		/* x_off */,
+    int		/* y_off */
+);
+
+extern Status XShapeQueryExtents (
+    Display*		/* display */,
+    Window		/* window */,
+    Bool*		/* bounding_shaped */,
+    int*		/* x_bounding */,
+    int*		/* y_bounding */,
+    unsigned int*	/* w_bounding */,
+    unsigned int*	/* h_bounding */,
+    Bool*		/* clip_shaped */,
+    int*		/* x_clip */,
+    int*		/* y_clip */,
+    unsigned int*	/* w_clip */,
+    unsigned int*	/* h_clip */
+);
+
+extern void XShapeSelectInput (
+    Display*		/* display */,
+    Window		/* window */,
+    unsigned long	/* mask */
+);
+
+extern unsigned long XShapeInputSelected (
+    Display*	/* display */,
+    Window	/* window */
+);
+
+extern XRectangle *XShapeGetRectangles (
+    Display*	/* display */,
+    Window	/* window */,
+    int		/* kind */,
+    int*	/* count */,
+    int*	/* ordering */
+);
+
+_XFUNCPROTOEND
+
+#endif /* !_SHAPE_SERVER_ */
+
+#endif /* _SHAPE_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/shapeconst.h b/ThirdParty/X11/Include/X11/extensions/shapeconst.h
new file mode 100644
index 0000000000000000000000000000000000000000..9088956f1b90e79163ef997d731aa1d1d1b4a9b2
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/shapeconst.h
@@ -0,0 +1,55 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+#ifndef _SHAPECONST_H_
+#define _SHAPECONST_H_
+
+/*
+ * Protocol requests constants and alignment values
+ * These would really be in SHAPE's X.h and Xproto.h equivalents
+ */
+
+#define SHAPENAME "SHAPE"
+
+#define SHAPE_MAJOR_VERSION	1	/* current version numbers */
+#define SHAPE_MINOR_VERSION	1
+
+#define ShapeSet			0
+#define ShapeUnion			1
+#define ShapeIntersect			2
+#define ShapeSubtract			3
+#define ShapeInvert			4
+
+#define ShapeBounding			0
+#define ShapeClip			1
+#define ShapeInput			2
+
+#define ShapeNotifyMask			(1L << 0)
+#define ShapeNotify			0
+
+#define ShapeNumberEvents		(ShapeNotify + 1)
+
+#endif /* _SHAPECONST_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/shapeproto.h b/ThirdParty/X11/Include/X11/extensions/shapeproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..49bd1a1a4f9b7c98e239c6d21574c255603bf46a
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/shapeproto.h
@@ -0,0 +1,237 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+#ifndef _SHAPEPROTO_H_
+#define _SHAPEPROTO_H_
+
+#include <X11/extensions/shapeconst.h>
+
+/*
+ * Protocol requests constants and alignment values
+ * These would really be in SHAPE's X.h and Xproto.h equivalents
+ */
+
+#define Window CARD32
+#define Time CARD32
+
+#define X_ShapeQueryVersion		0
+#define X_ShapeRectangles		1
+#define X_ShapeMask			2
+#define X_ShapeCombine			3
+#define X_ShapeOffset			4
+#define X_ShapeQueryExtents		5
+#define X_ShapeSelectInput		6
+#define X_ShapeInputSelected		7
+#define X_ShapeGetRectangles		8
+
+typedef struct _ShapeQueryVersion {
+	CARD8	reqType;		/* always ShapeReqCode */
+	CARD8	shapeReqType;		/* always X_ShapeQueryVersion */
+	CARD16	length B16;
+} xShapeQueryVersionReq;
+#define sz_xShapeQueryVersionReq	4
+
+typedef struct {
+	BYTE	type;			/* X_Reply */
+	CARD8	unused;			/* not used */
+	CARD16	sequenceNumber B16;
+	CARD32	length B32;
+	CARD16	majorVersion B16;	/* major version of SHAPE protocol */
+	CARD16	minorVersion B16;	/* minor version of SHAPE protocol */
+	CARD32	pad0 B32;
+	CARD32	pad1 B32;
+	CARD32	pad2 B32;
+	CARD32	pad3 B32;
+	CARD32	pad4 B32;
+} xShapeQueryVersionReply;
+#define sz_xShapeQueryVersionReply	32
+
+typedef struct _ShapeRectangles {
+	CARD8	reqType;	/* always ShapeReqCode */
+	CARD8	shapeReqType;	/* always X_ShapeRectangles */
+	CARD16	length B16;
+	CARD8	op;		/* Set, ... */
+	CARD8	destKind;	/* ShapeBounding or ShapeClip */
+	CARD8	ordering;	/* UnSorted, YSorted, YXSorted, YXBanded */
+	CARD8	pad0;		/* not used */
+	Window	dest B32;
+	INT16	xOff B16;
+	INT16	yOff B16;
+} xShapeRectanglesReq;		/* followed by xRects */
+#define sz_xShapeRectanglesReq	16
+
+typedef struct _ShapeMask {
+	CARD8	reqType;	/* always ShapeReqCode */
+	CARD8	shapeReqType;	/* always X_ShapeMask */
+	CARD16	length B16;
+
+	CARD8	op;		/* Set, ... */
+	CARD8	destKind;	/* ShapeBounding or ShapeClip */
+	CARD16	junk B16;	/* not used */
+
+	Window	dest B32;
+	INT16	xOff B16;
+	INT16	yOff B16;
+	CARD32	src B32;	/* 1 bit pixmap */
+} xShapeMaskReq;
+#define sz_xShapeMaskReq	20
+
+typedef struct _ShapeCombine {
+	CARD8	reqType;	/* always ShapeReqCode */
+	CARD8	shapeReqType;	/* always X_ShapeCombine */
+	CARD16	length B16;
+	CARD8	op;		/* Set, ... */
+	CARD8	destKind;	/* ShapeBounding or ShapeClip */
+	CARD8	srcKind;	/* ShapeBounding or ShapeClip */
+	CARD8	junk;		/* not used */
+	Window	dest B32;
+	INT16	xOff B16;
+	INT16	yOff B16;
+	Window	src B32;
+} xShapeCombineReq;
+#define sz_xShapeCombineReq	20
+
+typedef struct _ShapeOffset {
+	CARD8	reqType;	/* always ShapeReqCode */
+	CARD8	shapeReqType;	/* always X_ShapeOffset */
+	CARD16	length B16;
+	CARD8	destKind;	/* ShapeBounding or ShapeClip */
+	CARD8	junk1;		/* not used */
+	CARD16	junk2 B16;	/* not used */
+	Window	dest B32;
+	INT16	xOff B16;
+	INT16	yOff B16;
+} xShapeOffsetReq;
+#define sz_xShapeOffsetReq	16
+
+typedef struct _ShapeQueryExtents {
+	CARD8	reqType;	/* always ShapeReqCode */
+	CARD8	shapeReqType;	/* always X_ShapeQueryExtents */
+	CARD16	length B16;
+	Window	window B32;
+} xShapeQueryExtentsReq;
+#define sz_xShapeQueryExtentsReq	8
+
+typedef struct {
+	BYTE	type;			/* X_Reply */
+	CARD8	unused;			/* not used */
+	CARD16	sequenceNumber B16;
+	CARD32	length B32;		/* 0 */
+	CARD8	boundingShaped;		/* window has bounding shape */
+	CARD8	clipShaped;		/* window has clip shape */
+	CARD16	unused1 B16;
+	INT16	xBoundingShape B16;	/* extents of bounding shape */
+	INT16	yBoundingShape B16;
+	CARD16	widthBoundingShape B16;
+	CARD16	heightBoundingShape B16;
+	INT16	xClipShape B16;		/* extents of clip shape */
+	INT16	yClipShape B16;
+	CARD16	widthClipShape B16;
+	CARD16	heightClipShape B16;
+	CARD32	pad1 B32;
+} xShapeQueryExtentsReply;
+#define sz_xShapeQueryExtentsReply	32
+
+typedef struct _ShapeSelectInput {
+	CARD8	reqType;	/* always ShapeReqCode */
+	CARD8	shapeReqType;	/* always X_ShapeSelectInput */
+	CARD16	length B16;
+	Window	window B32;
+	BYTE	enable;		/* xTrue -> send events */
+	BYTE	pad1;
+	CARD16	pad2 B16;
+} xShapeSelectInputReq;
+#define sz_xShapeSelectInputReq	12
+
+typedef struct _ShapeNotify {
+	BYTE	type;		/* always eventBase + ShapeNotify */
+	BYTE	kind;		/* either ShapeBounding or ShapeClip */
+	CARD16	sequenceNumber B16;
+	Window	window B32;
+	INT16	x B16;
+	INT16	y B16;		/* extents of new shape */
+	CARD16	width B16;
+	CARD16	height B16;
+	Time	time B32;	/* time of change */
+	BYTE	shaped;		/* set when a shape actual exists */
+	BYTE	pad0;
+	CARD16	pad1 B16;
+	CARD32	pad2 B32;
+	CARD32	pad3 B32;
+} xShapeNotifyEvent;
+#define sz_xShapeNotifyEvent	32
+
+typedef struct _ShapeInputSelected {
+	CARD8	reqType;	/* always ShapeReqCode */
+	CARD8	shapeReqType;	/* always X_ShapeInputSelected */
+	CARD16	length B16;
+	Window	window B32;
+} xShapeInputSelectedReq;
+#define sz_xShapeInputSelectedReq 8
+
+typedef struct {
+	BYTE	type;			/* X_Reply */
+	CARD8	enabled;		/* current status */
+	CARD16	sequenceNumber B16;
+	CARD32	length B32;		/* 0 */
+	CARD32	pad1 B32;		/* unused */
+	CARD32	pad2 B32;
+	CARD32	pad3 B32;
+	CARD32	pad4 B32;
+	CARD32	pad5 B32;
+	CARD32	pad6 B32;
+} xShapeInputSelectedReply;
+#define sz_xShapeInputSelectedReply	32
+
+typedef struct _ShapeGetRectangles {
+    CARD8   reqType;		/* always ShapeReqCode */
+    CARD8   shapeReqType;	/* always X_ShapeGetRectangles */
+    CARD16  length B16;
+    Window  window B32;
+    CARD8   kind;		/* ShapeBounding or ShapeClip */
+    CARD8   junk1;
+    CARD16  junk2 B16;
+} xShapeGetRectanglesReq;
+#define sz_xShapeGetRectanglesReq	12
+
+typedef struct {
+	BYTE	type;			/* X_Reply */
+	CARD8	ordering;	/* UnSorted, YSorted, YXSorted, YXBanded */
+	CARD16	sequenceNumber B16;
+	CARD32	length B32;		/* not zero */
+	CARD32	nrects B32;		/* number of rectangles */
+	CARD32 pad1 B32;
+	CARD32 pad2 B32;
+	CARD32 pad3 B32;
+	CARD32 pad4 B32;
+	CARD32 pad5 B32;
+} xShapeGetRectanglesReply;		/* followed by xRectangles */
+#define sz_xShapeGetRectanglesReply 32
+
+#undef Window
+#undef Time
+
+#endif /* _SHAPEPROTO_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/shapestr.h b/ThirdParty/X11/Include/X11/extensions/shapestr.h
new file mode 100644
index 0000000000000000000000000000000000000000..20fde1dbe690dfcd6c4151fc760fa7d2881d71e8
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/shapestr.h
@@ -0,0 +1,8 @@
+#ifndef _SHAPESTR_H_
+#define _SHAPESTR_H_
+
+#warning "shapestr.h is obsolete and may be removed in the future."
+#warning "include <X11/extensions/shapeproto.h> for the protocol defines."
+#include <X11/extensions/shapeproto.h>
+
+#endif /* _SHAPESTR_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/shm.h b/ThirdParty/X11/Include/X11/extensions/shm.h
new file mode 100644
index 0000000000000000000000000000000000000000..be49f5e977a3f288ae392d2cf68897e3c6587583
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/shm.h
@@ -0,0 +1,44 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
+
+#ifndef _SHM_H_
+#define _SHM_H_
+
+#define SHMNAME "MIT-SHM"
+
+#define SHM_MAJOR_VERSION	1	/* current version numbers */
+#define SHM_MINOR_VERSION	2
+
+#define ShmCompletion			0
+#define ShmNumberEvents			(ShmCompletion + 1)
+
+#define BadShmSeg			0
+#define ShmNumberErrors			(BadShmSeg + 1)
+
+
+#endif /* _SHM_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/shmproto.h b/ThirdParty/X11/Include/X11/extensions/shmproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..8136aa9f72fd8effe7bf4a138803ee8613c504e6
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/shmproto.h
@@ -0,0 +1,229 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
+
+#ifndef _SHMPROTO_H_
+#define _SHMPROTO_H_
+
+#include <X11/extensions/shm.h>
+
+#define ShmSeg CARD32
+#define Drawable CARD32
+#define VisualID CARD32
+#define GContext CARD32
+#define Pixmap CARD32
+
+#define X_ShmQueryVersion		0
+#define X_ShmAttach			1
+#define X_ShmDetach			2
+#define X_ShmPutImage			3
+#define X_ShmGetImage			4
+#define X_ShmCreatePixmap		5
+#define X_ShmAttachFd                   6
+#define X_ShmCreateSegment              7
+
+typedef struct _ShmQueryVersion {
+    CARD8	reqType;		/* always ShmReqCode */
+    CARD8	shmReqType;		/* always X_ShmQueryVersion */
+    CARD16	length B16;
+} xShmQueryVersionReq;
+#define sz_xShmQueryVersionReq	4
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	sharedPixmaps;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	majorVersion B16;	/* major version of SHM protocol */
+    CARD16	minorVersion B16;	/* minor version of SHM protocol */
+    CARD16	uid B16;
+    CARD16	gid B16;
+    CARD8	pixmapFormat;
+    CARD8	pad0;
+    CARD16	pad1 B16;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+} xShmQueryVersionReply;
+#define sz_xShmQueryVersionReply	32
+
+typedef struct _ShmAttach {
+    CARD8	reqType;	/* always ShmReqCode */
+    CARD8	shmReqType;	/* always X_ShmAttach */
+    CARD16	length B16;
+    ShmSeg	shmseg B32;
+    CARD32	shmid B32;
+    BOOL	readOnly;
+    BYTE	pad0;
+    CARD16	pad1 B16;
+} xShmAttachReq;
+#define sz_xShmAttachReq	16
+
+typedef struct _ShmDetach {
+    CARD8	reqType;	/* always ShmReqCode */
+    CARD8	shmReqType;	/* always X_ShmDetach */
+    CARD16	length B16;
+    ShmSeg	shmseg B32;
+} xShmDetachReq;
+#define sz_xShmDetachReq	8
+
+typedef struct _ShmPutImage {
+    CARD8	reqType;	/* always ShmReqCode */
+    CARD8	shmReqType;	/* always X_ShmPutImage */
+    CARD16	length B16;
+    Drawable	drawable B32;
+    GContext	gc B32;
+    CARD16	totalWidth B16;
+    CARD16	totalHeight B16;
+    CARD16	srcX B16;
+    CARD16	srcY B16;
+    CARD16	srcWidth B16;
+    CARD16	srcHeight B16;
+    INT16	dstX B16;
+    INT16	dstY B16;
+    CARD8	depth;
+    CARD8	format;
+    CARD8	sendEvent;
+    CARD8	bpad;
+    ShmSeg	shmseg B32;
+    CARD32	offset B32;
+} xShmPutImageReq;
+#define sz_xShmPutImageReq	40
+
+typedef struct _ShmGetImage {
+    CARD8	reqType;	/* always ShmReqCode */
+    CARD8	shmReqType;	/* always X_ShmGetImage */
+    CARD16	length B16;
+    Drawable	drawable B32;
+    INT16	x B16;
+    INT16	y B16;
+    CARD16	width B16;
+    CARD16	height B16;
+    CARD32	planeMask B32;
+    CARD8	format;
+    CARD8	pad0;
+    CARD8	pad1;
+    CARD8	pad2;
+    ShmSeg	shmseg B32;
+    CARD32	offset B32;
+} xShmGetImageReq;
+#define sz_xShmGetImageReq	32
+
+typedef struct _ShmGetImageReply {
+    BYTE	type;  /* X_Reply */
+    CARD8	depth;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    VisualID	visual B32;
+    CARD32	size B32;
+    CARD32	pad0 B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+} xShmGetImageReply;
+#define sz_xShmGetImageReply	32
+
+typedef struct _ShmCreatePixmap {
+    CARD8	reqType;	/* always ShmReqCode */
+    CARD8	shmReqType;	/* always X_ShmCreatePixmap */
+    CARD16	length B16;
+    Pixmap	pid B32;
+    Drawable	drawable B32;
+    CARD16	width B16;
+    CARD16	height B16;
+    CARD8	depth;
+    CARD8	pad0;
+    CARD8	pad1;
+    CARD8	pad2;
+    ShmSeg	shmseg B32;
+    CARD32	offset B32;
+} xShmCreatePixmapReq;
+#define sz_xShmCreatePixmapReq 28
+
+typedef struct _ShmCompletion {
+    BYTE	type;		/* always eventBase + ShmCompletion */
+    BYTE	bpad0;
+    CARD16	sequenceNumber B16;
+    Drawable	drawable B32;
+    CARD16	minorEvent B16;
+    BYTE	majorEvent;
+    BYTE	bpad1;
+    ShmSeg	shmseg B32;
+    CARD32	offset B32;
+    CARD32	pad0 B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+} xShmCompletionEvent;
+#define sz_xShmCompletionEvent	32
+
+/* Version 1.2 additions */
+typedef struct _ShmAttachFd {
+    CARD8	reqType;	/* always ShmReqCode */
+    CARD8	shmReqType;	/* always X_ShmAttachFd */
+    CARD16	length B16;
+    ShmSeg	shmseg B32;
+    BOOL	readOnly;
+    BYTE	pad0;
+    CARD16	pad1 B16;
+} xShmAttachFdReq;
+/* File descriptor is passed with this request */
+#define sz_xShmAttachFdReq	12
+
+typedef struct _ShmCreateSegment {
+    CARD8	reqType;	/* always ShmReqCode */
+    CARD8	shmReqType;	/* always X_ShmAttachFd */
+    CARD16	length B16;
+    ShmSeg	shmseg B32;
+    CARD32      size B32;
+    BOOL	readOnly;
+    BYTE	pad0;
+    CARD16	pad1 B16;
+} xShmCreateSegmentReq;
+#define sz_xShmCreateSegmentReq 16
+
+typedef struct {
+    CARD8	type;			/* must be X_Reply */
+    CARD8	nfd;			/* must be 1	*/
+    CARD16	sequenceNumber  B16;	/* last sequence number */
+    CARD32	length  B32;		/* 0 */
+    CARD32	pad2	B32;		/* unused */
+    CARD32	pad3	B32;		/* unused */
+    CARD32	pad4	B32;		/* unused */
+    CARD32	pad5	B32;		/* unused */
+    CARD32	pad6	B32;		/* unused */
+    CARD32	pad7	B32;		/* unused */
+} xShmCreateSegmentReply;
+/* File descriptor is passed with this reply */
+#define sz_xShmCreateSegmentReply	32
+
+#undef ShmSeg
+#undef Drawable
+#undef VisualID
+#undef GContext
+#undef Pixmap
+
+#endif /* _SHMPROTO_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/shmstr.h b/ThirdParty/X11/Include/X11/extensions/shmstr.h
new file mode 100644
index 0000000000000000000000000000000000000000..78f37596259cacee5ce59ab4704a194be3466a6c
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/shmstr.h
@@ -0,0 +1,63 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
+
+#ifndef _SHMSTR_H_
+#define _SHMSTR_H_
+
+#include <X11/extensions/shmproto.h>
+
+#ifdef _XSHM_SERVER_
+#define XSHM_PUT_IMAGE_ARGS \
+    DrawablePtr		/* dst */, \
+    GCPtr		/* pGC */, \
+    int			/* depth */, \
+    unsigned int	/* format */, \
+    int			/* w */, \
+    int			/* h */, \
+    int			/* sx */, \
+    int			/* sy */, \
+    int			/* sw */, \
+    int			/* sh */, \
+    int			/* dx */, \
+    int			/* dy */, \
+    char *		/* data */
+
+#define XSHM_CREATE_PIXMAP_ARGS \
+    ScreenPtr	/* pScreen */, \
+    int		/* width */, \
+    int		/* height */, \
+    int		/* depth */, \
+    char *	/* addr */
+
+typedef struct _ShmFuncs {
+    PixmapPtr	(* CreatePixmap)(XSHM_CREATE_PIXMAP_ARGS);
+    void	(* PutImage)(XSHM_PUT_IMAGE_ARGS);
+} ShmFuncs, *ShmFuncsPtr;
+#endif
+
+#endif /* _SHMSTR_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/sync.h b/ThirdParty/X11/Include/X11/extensions/sync.h
new file mode 100644
index 0000000000000000000000000000000000000000..31b1be064a977dfab44f6e8e876230d67e215869
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/sync.h
@@ -0,0 +1,375 @@
+/*
+
+Copyright 1991, 1993, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/***********************************************************
+Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
+and Olivetti Research Limited, Cambridge, England.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Digital or Olivetti
+not be used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+
+******************************************************************/
+
+#ifndef _SYNC_H_
+#define _SYNC_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/syncconst.h>
+
+#ifdef _SYNC_SERVER
+#include <X11/extensions/syncproto.h>
+#else
+
+_XFUNCPROTOBEGIN
+/* get rid of macros so we can define corresponding functions */
+#undef XSyncIntToValue
+#undef XSyncIntsToValue
+#undef XSyncValueGreaterThan
+#undef XSyncValueLessThan
+#undef XSyncValueGreaterOrEqual
+#undef XSyncValueLessOrEqual
+#undef XSyncValueEqual
+#undef XSyncValueIsNegative
+#undef XSyncValueIsZero
+#undef XSyncValueIsPositive
+#undef XSyncValueLow32
+#undef XSyncValueHigh32
+#undef XSyncValueAdd
+#undef XSyncValueSubtract
+#undef XSyncMaxValue
+#undef XSyncMinValue
+
+extern void XSyncIntToValue(
+    XSyncValue* /*pv*/,
+    int /*i*/
+);
+
+extern void XSyncIntsToValue(
+    XSyncValue* /*pv*/,
+    unsigned int /*l*/,
+    int /*h*/
+);
+
+extern Bool XSyncValueGreaterThan(
+    XSyncValue /*a*/,
+    XSyncValue /*b*/
+);
+
+extern Bool XSyncValueLessThan(
+    XSyncValue /*a*/,
+    XSyncValue /*b*/
+);
+
+extern Bool XSyncValueGreaterOrEqual(
+    XSyncValue /*a*/,
+    XSyncValue /*b*/
+);
+
+extern Bool XSyncValueLessOrEqual(
+    XSyncValue /*a*/,
+    XSyncValue /*b*/
+);
+
+extern Bool XSyncValueEqual(
+    XSyncValue /*a*/,
+    XSyncValue /*b*/
+);
+
+extern Bool XSyncValueIsNegative(
+    XSyncValue /*v*/
+);
+
+extern Bool XSyncValueIsZero(
+    XSyncValue /*a*/
+);
+
+extern Bool XSyncValueIsPositive(
+    XSyncValue /*v*/
+);
+
+extern unsigned int XSyncValueLow32(
+    XSyncValue /*v*/
+);
+
+extern int XSyncValueHigh32(
+    XSyncValue /*v*/
+);
+
+extern void XSyncValueAdd(
+    XSyncValue* /*presult*/,
+    XSyncValue /*a*/,
+    XSyncValue /*b*/,
+    int* /*poverflow*/
+);
+
+extern void XSyncValueSubtract(
+    XSyncValue* /*presult*/,
+    XSyncValue /*a*/,
+    XSyncValue /*b*/,
+    int* /*poverflow*/
+);
+
+extern void XSyncMaxValue(
+    XSyncValue* /*pv*/
+);
+
+extern void XSyncMinValue(
+    XSyncValue* /*pv*/
+);
+
+_XFUNCPROTOEND
+
+
+typedef struct _XSyncSystemCounter {
+    char *name;			/* null-terminated name of system counter */
+    XSyncCounter counter;	/* counter id of this system counter */
+    XSyncValue resolution;	/* resolution of this system counter */
+} XSyncSystemCounter;
+
+
+typedef struct {
+    XSyncCounter counter;	/* counter to trigger on */
+    XSyncValueType value_type;	/* absolute/relative */
+    XSyncValue wait_value;	/* value to compare counter to */
+    XSyncTestType test_type;	/* pos/neg comparison/transtion */
+} XSyncTrigger;
+
+typedef struct {
+    XSyncTrigger trigger;	/* trigger for await */
+    XSyncValue event_threshold; /* send event if past threshold */
+} XSyncWaitCondition;
+
+
+typedef struct {
+    XSyncTrigger trigger;
+    XSyncValue  delta;
+    Bool events;
+    XSyncAlarmState state;
+} XSyncAlarmAttributes;
+
+/*
+ *  Events
+ */
+
+typedef struct {
+    int type;			/* event base + XSyncCounterNotify */
+    unsigned long serial;	/* # of last request processed by server */
+    Bool send_event;		/* true if this came from a SendEvent request */
+    Display *display;		/* Display the event was read from */
+    XSyncCounter counter;	/* counter involved in await */
+    XSyncValue wait_value;	/* value being waited for */
+    XSyncValue counter_value;	/* counter value when this event was sent */
+    Time time;			/* milliseconds */
+    int count;			/* how many more events to come */
+    Bool destroyed;		/* True if counter was destroyed */
+} XSyncCounterNotifyEvent;
+
+typedef struct {
+    int type;			/* event base + XSyncAlarmNotify */
+    unsigned long serial;	/* # of last request processed by server */
+    Bool send_event;		/* true if this came from a SendEvent request */
+    Display *display;		/* Display the event was read from */
+    XSyncAlarm alarm;		/* alarm that triggered */
+    XSyncValue counter_value;	/* value that triggered the alarm */
+    XSyncValue alarm_value;	/* test  value of trigger in alarm */
+    Time time;			/* milliseconds */
+    XSyncAlarmState state;	/* new state of alarm */
+} XSyncAlarmNotifyEvent;
+
+/*
+ *  Errors
+ */
+
+typedef struct {
+    int type;
+    Display *display;		/* Display the event was read from */
+    XSyncAlarm alarm;		/* resource id */
+    unsigned long serial;	/* serial number of failed request */
+    unsigned char error_code;	/* error base + XSyncBadAlarm */
+    unsigned char request_code;	/* Major op-code of failed request */
+    unsigned char minor_code;	/* Minor op-code of failed request */
+} XSyncAlarmError;
+
+typedef struct {
+    int type;
+    Display *display;		/* Display the event was read from */
+    XSyncCounter counter;	/* resource id */
+    unsigned long serial;	/* serial number of failed request */
+    unsigned char error_code;	/* error base + XSyncBadCounter */
+    unsigned char request_code;	/* Major op-code of failed request */
+    unsigned char minor_code;	/* Minor op-code of failed request */
+} XSyncCounterError;
+
+/*
+ *  Prototypes
+ */
+
+_XFUNCPROTOBEGIN
+
+extern Status XSyncQueryExtension(
+    Display* /*dpy*/,
+    int* /*event_base_return*/,
+    int* /*error_base_return*/
+);
+
+extern Status XSyncInitialize(
+    Display* /*dpy*/,
+    int* /*major_version_return*/,
+    int* /*minor_version_return*/
+);
+
+extern XSyncSystemCounter *XSyncListSystemCounters(
+    Display* /*dpy*/,
+    int* /*n_counters_return*/
+);
+
+extern void XSyncFreeSystemCounterList(
+    XSyncSystemCounter* /*list*/
+);
+
+extern XSyncCounter XSyncCreateCounter(
+    Display* /*dpy*/,
+    XSyncValue /*initial_value*/
+);
+
+extern Status XSyncSetCounter(
+    Display* /*dpy*/,
+    XSyncCounter /*counter*/,
+    XSyncValue /*value*/
+);
+
+extern Status XSyncChangeCounter(
+    Display* /*dpy*/,
+    XSyncCounter /*counter*/,
+    XSyncValue /*value*/
+);
+
+extern Status XSyncDestroyCounter(
+    Display* /*dpy*/,
+    XSyncCounter /*counter*/
+);
+
+extern Status XSyncQueryCounter(
+    Display* /*dpy*/,
+    XSyncCounter /*counter*/,
+    XSyncValue* /*value_return*/
+);
+
+extern Status XSyncAwait(
+    Display* /*dpy*/,
+    XSyncWaitCondition* /*wait_list*/,
+    int /*n_conditions*/
+);
+
+extern XSyncAlarm XSyncCreateAlarm(
+    Display* /*dpy*/,
+    unsigned long /*values_mask*/,
+    XSyncAlarmAttributes* /*values*/
+);
+
+extern Status XSyncDestroyAlarm(
+    Display* /*dpy*/,
+    XSyncAlarm /*alarm*/
+);
+
+extern Status XSyncQueryAlarm(
+    Display* /*dpy*/,
+    XSyncAlarm /*alarm*/,
+    XSyncAlarmAttributes* /*values_return*/
+);
+
+extern Status XSyncChangeAlarm(
+    Display* /*dpy*/,
+    XSyncAlarm /*alarm*/,
+    unsigned long /*values_mask*/,
+    XSyncAlarmAttributes* /*values*/
+);
+
+extern Status XSyncSetPriority(
+    Display* /*dpy*/,
+    XID /*client_resource_id*/,
+    int /*priority*/
+);
+
+extern Status XSyncGetPriority(
+    Display* /*dpy*/,
+    XID /*client_resource_id*/,
+    int* /*return_priority*/
+);
+
+extern XSyncFence XSyncCreateFence(
+    Display* /*dpy*/,
+    Drawable /*d*/,
+    Bool /*initially_triggered*/
+);
+
+extern Bool XSyncTriggerFence(
+    Display* /*dpy*/,
+    XSyncFence /*fence*/
+);
+
+extern Bool XSyncResetFence(
+    Display* /*dpy*/,
+    XSyncFence /*fence*/
+);
+
+extern Bool XSyncDestroyFence(
+    Display* /*dpy*/,
+    XSyncFence /*fence*/
+);
+
+extern Bool XSyncQueryFence(
+    Display* /*dpy*/,
+    XSyncFence /*fence*/,
+    Bool* /*triggered*/
+);
+
+extern Bool XSyncAwaitFence(
+    Display* /*dpy*/,
+    const XSyncFence* /*fence_list*/,
+    int /*n_fences*/
+);
+
+_XFUNCPROTOEND
+
+#endif /* _SYNC_SERVER */
+
+#endif /* _SYNC_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/syncconst.h b/ThirdParty/X11/Include/X11/extensions/syncconst.h
new file mode 100644
index 0000000000000000000000000000000000000000..3acc387e33939579c2596e98e5b4ef058b8f08a9
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/syncconst.h
@@ -0,0 +1,181 @@
+/*
+
+Copyright 1991, 1993, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/***********************************************************
+Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
+and Olivetti Research Limited, Cambridge, England.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Digital or Olivetti
+not be used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+
+******************************************************************/
+
+#ifndef _SYNCCONST_H_
+#define _SYNCCONST_H_
+
+#define SYNC_NAME "SYNC"
+
+#define SYNC_MAJOR_VERSION	3
+#define SYNC_MINOR_VERSION	1
+
+
+#define XSyncCounterNotify              0
+#define XSyncAlarmNotify		1
+#define XSyncAlarmNotifyMask 		(1L << XSyncAlarmNotify)
+
+#define XSyncNumberEvents		2L
+
+#define XSyncBadCounter			0L
+#define XSyncBadAlarm			1L
+#define XSyncBadFence           2L
+#define XSyncNumberErrors		(XSyncBadFence + 1)
+
+/*
+ * Flags for Alarm Attributes
+ */
+#define XSyncCACounter			(1L<<0)
+#define XSyncCAValueType		(1L<<1)
+#define XSyncCAValue			(1L<<2)
+#define XSyncCATestType			(1L<<3)
+#define XSyncCADelta			(1L<<4)
+#define XSyncCAEvents			(1L<<5)
+
+/*  The _XSync macros below are for library internal use only.  They exist
+ *  so that if we have to make a fix, we can change it in this one place
+ *  and have both the macro and function variants inherit the fix.
+ */
+
+#define _XSyncIntToValue(pv, i)     ((pv)->hi=((i<0)?~0:0),(pv)->lo=(i))
+#define _XSyncIntsToValue(pv, l, h) ((pv)->lo = (l), (pv)->hi = (h))
+#define _XSyncValueGreaterThan(a, b)\
+    ((a).hi>(b).hi || ((a).hi==(b).hi && (a).lo>(b).lo))
+#define _XSyncValueLessThan(a, b)\
+    ((a).hi<(b).hi || ((a).hi==(b).hi && (a).lo<(b).lo))
+#define _XSyncValueGreaterOrEqual(a, b)\
+    ((a).hi>(b).hi || ((a).hi==(b).hi && (a).lo>=(b).lo))
+#define _XSyncValueLessOrEqual(a, b)\
+    ((a).hi<(b).hi || ((a).hi==(b).hi && (a).lo<=(b).lo))
+#define _XSyncValueEqual(a, b)	((a).lo==(b).lo && (a).hi==(b).hi)
+#define _XSyncValueIsNegative(v) (((v).hi & 0x80000000) ? 1 : 0)
+#define _XSyncValueIsZero(a)	((a).lo==0 && (a).hi==0)
+#define _XSyncValueIsPositive(v) (((v).hi & 0x80000000) ? 0 : 1)
+#define _XSyncValueLow32(v)	((v).lo)
+#define _XSyncValueHigh32(v)	((v).hi)
+#define _XSyncValueAdd(presult,a,b,poverflow) {\
+	int t = (a).lo;\
+	Bool signa = XSyncValueIsNegative(a);\
+	Bool signb = XSyncValueIsNegative(b);\
+	((presult)->lo = (a).lo + (b).lo);\
+	((presult)->hi = (a).hi + (b).hi);\
+	if (t>(presult)->lo) (presult)->hi++;\
+	*poverflow = ((signa == signb) && !(signa == XSyncValueIsNegative(*presult)));\
+     }
+#define _XSyncValueSubtract(presult,a,b,poverflow) {\
+	int t = (a).lo;\
+	Bool signa = XSyncValueIsNegative(a);\
+	Bool signb = XSyncValueIsNegative(b);\
+	((presult)->lo = (a).lo - (b).lo);\
+	((presult)->hi = (a).hi - (b).hi);\
+	if (t<(presult)->lo) (presult)->hi--;\
+	*poverflow = ((signa == signb) && !(signa == XSyncValueIsNegative(*presult)));\
+     }
+#define _XSyncMaxValue(pv) ((pv)->hi = 0x7fffffff, (pv)->lo = 0xffffffff)
+#define _XSyncMinValue(pv) ((pv)->hi = 0x80000000, (pv)->lo = 0)
+
+/*
+ *  These are the publically usable macros.  If you want the function version
+ *  of one of these, just #undef the macro to uncover the function.
+ *  (This is the same convention that the ANSI C library uses.)
+ */
+
+#define XSyncIntToValue(pv, i) _XSyncIntToValue(pv, i)
+#define XSyncIntsToValue(pv, l, h) _XSyncIntsToValue(pv, l, h)
+#define XSyncValueGreaterThan(a, b) _XSyncValueGreaterThan(a, b)
+#define XSyncValueLessThan(a, b) _XSyncValueLessThan(a, b)
+#define XSyncValueGreaterOrEqual(a, b) _XSyncValueGreaterOrEqual(a, b)
+#define XSyncValueLessOrEqual(a, b) _XSyncValueLessOrEqual(a, b)
+#define XSyncValueEqual(a, b) _XSyncValueEqual(a, b)
+#define XSyncValueIsNegative(v) _XSyncValueIsNegative(v)
+#define XSyncValueIsZero(a) _XSyncValueIsZero(a)
+#define XSyncValueIsPositive(v) _XSyncValueIsPositive(v)
+#define XSyncValueLow32(v) _XSyncValueLow32(v)
+#define XSyncValueHigh32(v) _XSyncValueHigh32(v)
+#define XSyncValueAdd(presult,a,b,poverflow) _XSyncValueAdd(presult,a,b,poverflow)
+#define XSyncValueSubtract(presult,a,b,poverflow) _XSyncValueSubtract(presult,a,b,poverflow)
+#define XSyncMaxValue(pv) _XSyncMaxValue(pv)
+#define XSyncMinValue(pv) _XSyncMinValue(pv)
+
+/*
+ * Constants for the value_type argument of various requests
+ */
+typedef enum {
+    XSyncAbsolute,
+    XSyncRelative
+} XSyncValueType;
+
+/*
+ * Alarm Test types
+ */
+typedef enum {
+    XSyncPositiveTransition,
+    XSyncNegativeTransition,
+    XSyncPositiveComparison,
+    XSyncNegativeComparison
+} XSyncTestType;
+
+/*
+ * Alarm state constants
+ */
+typedef enum {
+    XSyncAlarmActive,
+    XSyncAlarmInactive,
+    XSyncAlarmDestroyed
+} XSyncAlarmState;
+
+
+typedef XID XSyncCounter;
+typedef XID XSyncAlarm;
+typedef XID XSyncFence;
+typedef struct _XSyncValue {
+    int hi;
+    unsigned int lo;
+} XSyncValue;
+#endif /* _SYNCCONST_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/syncproto.h b/ThirdParty/X11/Include/X11/extensions/syncproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..1453e4401c58687cb044ccfc3aec82fbf7b2a29d
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/syncproto.h
@@ -0,0 +1,474 @@
+/*
+
+Copyright 1991, 1993, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/***********************************************************
+Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
+and Olivetti Research Limited, Cambridge, England.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Digital or Olivetti
+not be used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+
+******************************************************************/
+
+#ifndef _SYNCPROTO_H_
+#define _SYNCPROTO_H_
+
+#include <X11/extensions/syncconst.h>
+
+#define X_SyncInitialize		0
+#define X_SyncListSystemCounters	1
+#define X_SyncCreateCounter		2
+#define X_SyncSetCounter		3
+#define X_SyncChangeCounter		4
+#define X_SyncQueryCounter              5
+#define X_SyncDestroyCounter		6
+#define X_SyncAwait			7
+#define X_SyncCreateAlarm               8
+#define X_SyncChangeAlarm	        9
+#define X_SyncQueryAlarm	       10
+#define X_SyncDestroyAlarm	       11
+#define X_SyncSetPriority   	       12
+#define X_SyncGetPriority   	       13
+#define X_SyncCreateFence	       14
+#define X_SyncTriggerFence	       15
+#define X_SyncResetFence	       16
+#define X_SyncDestroyFence	       17
+#define X_SyncQueryFence	       18
+#define X_SyncAwaitFence	       19
+
+/* cover up types from sync.h to make sure they're the right size for
+ * protocol packaging.  These will be undef'ed after all the protocol
+ * structures are defined.
+ */
+#define XSyncCounter CARD32
+#define XSyncAlarm   CARD32
+#define XSyncFence   CARD32
+#define Drawable     CARD32
+
+/*
+ * Initialize
+ */
+typedef struct _xSyncInitialize {
+    CARD8	reqType;
+    CARD8	syncReqType;
+    CARD16	length B16;
+    CARD8	majorVersion;
+    CARD8	minorVersion;
+    CARD16	pad B16;
+} xSyncInitializeReq;
+#define sz_xSyncInitializeReq		8
+
+typedef struct {
+    BYTE	type;
+    CARD8	unused;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD8	majorVersion;
+    CARD8	minorVersion;
+    CARD16	pad B16;
+    CARD32	pad0 B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+} xSyncInitializeReply;
+#define sz_xSyncInitializeReply	32
+
+/*
+ * ListSystemCounters
+ */
+typedef struct _xSyncListSystemCounters
+{
+    CARD8	reqType;
+    CARD8	syncReqType;
+    CARD16	length B16;
+} xSyncListSystemCountersReq;
+#define sz_xSyncListSystemCountersReq	4
+
+typedef struct {
+    BYTE	type;
+    CARD8	unused;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    INT32	nCounters B32;
+    CARD32	pad0 B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+} xSyncListSystemCountersReply;
+#define sz_xSyncListSystemCountersReply	32
+
+typedef struct {
+    XSyncCounter counter B32;
+    INT32	resolution_hi B32;
+    CARD32	resolution_lo B32;
+    CARD16	name_length B16;
+} xSyncSystemCounter;
+#define sz_xSyncSystemCounter 14
+
+/*
+ * Create Counter
+ */
+typedef struct _xSyncCreateCounterReq {
+    CARD8	reqType;
+    CARD8	syncReqType;
+    CARD16	length B16;
+    XSyncCounter cid B32;
+    INT32       initial_value_hi B32;
+    CARD32	initial_value_lo B32;
+} xSyncCreateCounterReq;
+#define sz_xSyncCreateCounterReq	16
+
+/*
+ * Change Counter
+ */
+typedef struct _xSyncChangeCounterReq {
+    CARD8	reqType;
+    CARD8	syncReqType;
+    CARD16	length B16;
+    XSyncCounter cid B32;
+    INT32       value_hi B32;
+    CARD32	value_lo B32;
+} xSyncChangeCounterReq;
+#define sz_xSyncChangeCounterReq	16
+
+/*
+ * Set Counter
+ */
+typedef struct _xSyncSetCounterReq {
+    CARD8	reqType;
+    CARD8	syncReqType;
+    CARD16	length B16;
+    XSyncCounter cid B32;
+    INT32       value_hi B32;
+    CARD32	value_lo B32;
+} xSyncSetCounterReq;
+#define sz_xSyncSetCounterReq	16
+
+/*
+ * Destroy Counter
+ */
+typedef struct _xSyncDestroyCounterReq {
+    CARD8	reqType;
+    CARD8	syncReqType;
+    CARD16	length B16;
+    XSyncCounter counter B32;
+} xSyncDestroyCounterReq;
+#define sz_xSyncDestroyCounterReq	8
+
+/*
+ * Query Counter
+ */
+typedef struct _xSyncQueryCounterReq {
+    CARD8	reqType;
+    CARD8	syncReqType;
+    CARD16	length B16;
+    XSyncCounter counter B32;
+} xSyncQueryCounterReq;
+#define sz_xSyncQueryCounterReq		8
+
+
+typedef struct {
+    BYTE	type;
+    CARD8	unused;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    INT32	value_hi B32;
+    CARD32	value_lo B32;
+    CARD32	pad0 B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+} xSyncQueryCounterReply;
+#define sz_xSyncQueryCounterReply	32
+
+/*
+ * Await
+ */
+typedef struct _xSyncAwaitReq {
+    CARD8	reqType;
+    CARD8	syncReqType;
+    CARD16	length B16;
+} xSyncAwaitReq;
+#define sz_xSyncAwaitReq		4
+
+typedef struct _xSyncWaitCondition {
+    XSyncCounter counter B32;
+    CARD32	value_type B32;
+    INT32       wait_value_hi B32;
+    CARD32      wait_value_lo B32;
+    CARD32	test_type B32;
+    INT32	event_threshold_hi B32;
+    CARD32	event_threshold_lo B32;
+} xSyncWaitCondition;
+#define sz_xSyncWaitCondition		28
+
+/*
+ * Create Alarm
+ */
+typedef struct _xSyncCreateAlarmReq {
+    CARD8	reqType;
+    CARD8	syncReqType;
+    CARD16	length B16;
+    XSyncAlarm	id B32;
+    CARD32      valueMask B32;
+} xSyncCreateAlarmReq;
+#define sz_xSyncCreateAlarmReq		12
+
+/*
+ * Destroy Alarm
+ */
+typedef struct _xSyncDestroyAlarmReq {
+    CARD8	reqType;
+    CARD8	syncReqType;
+    CARD16	length B16;
+    XSyncAlarm	alarm B32;
+} xSyncDestroyAlarmReq;
+#define sz_xSyncDestroyAlarmReq		8
+
+/*
+ * Query Alarm
+ */
+typedef struct _xSyncQueryAlarmReq {
+    CARD8	reqType;
+    CARD8	syncReqType;
+    CARD16	length B16;
+    XSyncAlarm	alarm B32;
+} xSyncQueryAlarmReq;
+#define sz_xSyncQueryAlarmReq		8
+
+typedef struct {
+    BYTE	type;
+    CARD8	unused;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    XSyncCounter counter B32;
+    CARD32	value_type B32;
+    INT32	wait_value_hi B32;
+    CARD32	wait_value_lo B32;
+    CARD32	test_type      B32;
+    INT32	delta_hi B32;
+    CARD32	delta_lo B32;
+    BOOL        events;
+    BYTE        state;
+    BYTE	pad0;
+    BYTE	pad1;
+} xSyncQueryAlarmReply;
+#define sz_xSyncQueryAlarmReply		40
+
+/*
+ * Change Alarm
+ */
+typedef struct _xSyncChangeAlarmReq {
+    CARD8	reqType;
+    CARD8	syncReqType;
+    CARD16	length B16;
+    XSyncAlarm	alarm B32;
+    CARD32	valueMask B32;
+} xSyncChangeAlarmReq;
+#define sz_xSyncChangeAlarmReq		12
+
+/*
+ * SetPriority
+ */
+typedef struct _xSyncSetPriority{
+    CARD8   	reqType;
+    CARD8   	syncReqType;
+    CARD16  	length B16;
+    CARD32  	id B32;
+    INT32  	priority B32;
+} xSyncSetPriorityReq;
+#define sz_xSyncSetPriorityReq	    	12
+
+/*
+ * Get Priority
+ */
+typedef struct _xSyncGetPriority{
+    CARD8   	reqType;
+    CARD8   	syncReqType;
+    CARD16  	length B16;
+    CARD32  	id B32; /*XXX XID? */
+} xSyncGetPriorityReq;
+#define sz_xSyncGetPriorityReq	    	 8
+
+typedef struct {
+    BYTE	type;
+    CARD8	unused;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    INT32  	priority B32;
+    CARD32  	pad0 B32;
+    CARD32  	pad1 B32;
+    CARD32  	pad2 B32;
+    CARD32  	pad3 B32;
+    CARD32  	pad4 B32;
+} xSyncGetPriorityReply;
+#define sz_xSyncGetPriorityReply	32
+
+/*
+ * Create Fence
+ */
+typedef struct _xSyncCreateFenceReq {
+    CARD8	reqType;
+    CARD8	syncReqType;
+    CARD16	length B16;
+    Drawable	d B32;
+    XSyncFence	fid B32;
+    BOOL	initially_triggered;
+    CARD8	pad0;
+    CARD16	pad1;
+} xSyncCreateFenceReq;
+#define sz_xSyncCreateFenceReq		16
+
+/*
+ * Put a fence object in the "triggered" state.
+ */
+typedef struct _xSyncTriggerFenceReq {
+    CARD8	reqType;
+    CARD8	syncReqType;
+    CARD16	length B16;
+    XSyncFence	fid B32;
+} xSyncTriggerFenceReq;
+#define sz_xSyncTriggerFenceReq		8
+
+/*
+ * Put a fence in the "untriggered" state.
+ */
+typedef struct _xSyncResetFenceReq {
+    CARD8	reqType;
+    CARD8	syncReqType;
+    CARD16	length B16;
+    XSyncFence	fid B32;
+} xSyncResetFenceReq;
+#define sz_xSyncResetFenceReq		8
+
+/*
+ * Destroy a fence object
+ */
+typedef struct _xSyncDestroyFenceReq {
+    CARD8	reqType;
+    CARD8	syncReqType;
+    CARD16	length B16;
+    XSyncFence	fid B32;
+} xSyncDestroyFenceReq;
+#define sz_xSyncDestroyFenceReq		8
+
+/*
+ * Query a fence object
+ */
+typedef struct _xSyncQueryFenceReq {
+    CARD8	reqType;
+    CARD8	syncReqType;
+    CARD16	length B16;
+    XSyncFence	fid B32;
+} xSyncQueryFenceReq;
+#define sz_xSyncQueryFenceReq		8
+
+/*
+ * Wait for any of a list of fence sync objects
+ * to reach the "triggered" state.
+ */
+typedef struct _xSyncAwaitFenceReq {
+    CARD8	reqType;
+    CARD8	syncReqType;
+    CARD16	length B16;
+} xSyncAwaitFenceReq;
+#define sz_xSyncAwaitFenceReq		4
+
+typedef struct {
+    BYTE	type;
+    CARD8	unused;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    BOOL	triggered;
+    BYTE	pad0;
+    CARD16	pad1 B16;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xSyncQueryFenceReply;
+#define sz_xSyncQueryFenceReply		32
+
+/*
+ * Events
+ */
+
+typedef struct _xSyncCounterNotifyEvent {
+    BYTE	type;
+    BYTE	kind;
+    CARD16	sequenceNumber B16;
+    XSyncCounter counter B32;
+    INT32	wait_value_hi B32;
+    CARD32	wait_value_lo B32;
+    INT32	counter_value_hi B32;
+    CARD32	counter_value_lo B32;
+    CARD32	time B32;
+    CARD16	count B16;
+    BOOL	destroyed;
+    BYTE        pad0;
+} xSyncCounterNotifyEvent;
+
+typedef struct _xSyncAlarmNotifyEvent {
+    BYTE	type;
+    BYTE	kind;
+    CARD16	sequenceNumber B16;
+    XSyncAlarm	alarm B32;
+    INT32	counter_value_hi B32;
+    CARD32	counter_value_lo B32;
+    INT32	alarm_value_hi B32;
+    CARD32	alarm_value_lo B32;
+    CARD32	time B32;
+    CARD8       state;
+    BYTE        pad0;
+    BYTE        pad1;
+    BYTE        pad2;
+} xSyncAlarmNotifyEvent;
+
+#undef XSyncCounter
+#undef XSyncAlarm
+#undef XSyncFence
+#undef Drawable
+
+
+#endif /* _SYNCPROTO_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/syncstr.h b/ThirdParty/X11/Include/X11/extensions/syncstr.h
new file mode 100644
index 0000000000000000000000000000000000000000..25a48277ea6d8828eec0d98b45eb7b6cf838ccfd
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/syncstr.h
@@ -0,0 +1,182 @@
+/*
+
+Copyright 1991, 1993, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/***********************************************************
+Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
+and Olivetti Research Limited, Cambridge, England.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the names of Digital or Olivetti
+not be used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+
+******************************************************************/
+
+#ifndef _SYNCSTR_H_
+#define _SYNCSTR_H_
+
+#include <X11/extensions/syncproto.h>
+
+#ifdef _SYNC_SERVER
+
+#define CARD64 XSyncValue /* XXX temporary! need real 64 bit values for Alpha */
+
+typedef struct _SyncCounter {
+    ClientPtr		client;	/* Owning client. 0 for system counters */
+    XSyncCounter	id;		/* resource ID */
+    CARD64		value;		/* counter value */
+    struct _SyncTriggerList *pTriglist;	/* list of triggers */
+    Bool		beingDestroyed; /* in process of going away */
+    struct _SysCounterInfo *pSysCounterInfo; /* NULL if not a system counter */
+} SyncCounter;
+
+/*
+ * The System Counter interface
+ */
+
+typedef enum {
+    XSyncCounterNeverChanges,
+    XSyncCounterNeverIncreases,
+    XSyncCounterNeverDecreases,
+    XSyncCounterUnrestricted
+} SyncCounterType;
+
+typedef struct _SysCounterInfo {
+    char	*name;
+    CARD64	resolution;
+    CARD64	bracket_greater;
+    CARD64	bracket_less;
+    SyncCounterType counterType;  /* how can this counter change */
+    void        (*QueryValue)(
+			      pointer /*pCounter*/,
+			      CARD64 * /*freshvalue*/
+);
+    void	(*BracketValues)(
+				 pointer /*pCounter*/,
+				 CARD64 * /*lessthan*/,
+				 CARD64 * /*greaterthan*/
+);
+} SysCounterInfo;
+
+
+
+typedef struct _SyncTrigger {
+    SyncCounter *pCounter;
+    CARD64	wait_value;	/* wait value */
+    unsigned int value_type;     /* Absolute or Relative */
+    unsigned int test_type;	/* transition or Comparision type */
+    CARD64	test_value;	/* trigger event threshold value */
+    Bool	(*CheckTrigger)(
+				struct _SyncTrigger * /*pTrigger*/,
+				CARD64 /*newval*/
+				);
+    void	(*TriggerFired)(
+				struct _SyncTrigger * /*pTrigger*/
+				);
+    void	(*CounterDestroyed)(
+				struct _SyncTrigger * /*pTrigger*/
+				    );
+} SyncTrigger;
+
+typedef struct _SyncTriggerList {
+    SyncTrigger *pTrigger;
+    struct _SyncTriggerList *next;
+} SyncTriggerList;
+
+typedef struct _SyncAlarmClientList {
+    ClientPtr	client;
+    XID		delete_id;
+    struct _SyncAlarmClientList *next;
+} SyncAlarmClientList;
+
+typedef struct _SyncAlarm {
+    SyncTrigger trigger;
+    ClientPtr	client;
+    XSyncAlarm 	alarm_id;
+    CARD64	delta;
+    int		events;
+    int		state;
+    SyncAlarmClientList *pEventClients;
+} SyncAlarm;
+
+typedef struct {
+    ClientPtr	client;
+    CARD32 	delete_id;
+    int		num_waitconditions;
+} SyncAwaitHeader;
+
+typedef struct {
+    SyncTrigger trigger;
+    CARD64	event_threshold;
+    SyncAwaitHeader *pHeader;
+} SyncAwait;
+
+typedef union {
+    SyncAwaitHeader header;
+    SyncAwait	    await;
+} SyncAwaitUnion;
+
+
+extern pointer SyncCreateSystemCounter(
+    char *	/* name */,
+    CARD64  	/* inital_value */,
+    CARD64  	/* resolution */,
+    SyncCounterType /* change characterization */,
+    void        (* /*QueryValue*/ ) (
+        pointer /* pCounter */,
+        CARD64 * /* pValue_return */), /* XXX prototype */
+    void        (* /*BracketValues*/) (
+        pointer /* pCounter */, 
+        CARD64 * /* pbracket_less */,
+        CARD64 * /* pbracket_greater */)
+);
+
+extern void SyncChangeCounter(
+    SyncCounter *	/* pCounter*/,
+    CARD64  		/* new_value */
+);
+
+extern void SyncDestroySystemCounter(
+    pointer pCounter
+);
+extern void InitServertime(void);
+
+#endif /* _SYNC_SERVER */
+
+#endif /* _SYNCSTR_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/vldXvMC.h b/ThirdParty/X11/Include/X11/extensions/vldXvMC.h
new file mode 100644
index 0000000000000000000000000000000000000000..fbd251e0526aae12499f50a14a3429227cc60dd2
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/vldXvMC.h
@@ -0,0 +1,174 @@
+/*****************************************************************************
+ * VLD XvMC Nonstandard extension API.
+ *
+ * Copyright (c) 2004 The Unichrome Project. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHOR(S) OR COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Author: Thomas Hellström, 2004.
+ */
+
+
+#ifndef _VLDXVMC_H
+#define _VLDXVMC_H
+
+#include <X11/Xlib.h>
+#include <X11/extensions/XvMC.h>
+
+/*
+ * New "Motion compensation type".
+ */
+
+#define XVMC_VLD 0x0020000
+
+/*
+ * Below Flags to be passed in the XvMCMpegControl structure 'flag' field.
+ */
+
+#define XVMC_PROGRESSIVE_SEQUENCE 0x00000010
+
+/*
+ * Zig-Zag Scan / Alternative Scan.
+ */
+
+#define XVMC_ZIG_ZAG_SCAN         0x00000000
+#define XVMC_ALTERNATE_SCAN       0x00000100
+
+/*
+ * Frame DCT and frame prediction are used. /
+ * Field prediction
+ */
+
+#define XVMC_PRED_DCT_FRAME       0x00000040
+#define XVMC_PRED_DCT_FIELD       0x00000000
+
+/*
+ * Top / Bottom field first
+ */
+
+#define XVMC_TOP_FIELD_FIRST      0x00000080
+#define XVMC_BOTTOM_FIELD_FIRST   0x00000000
+
+/*
+ * Motion vectors coded in intra macroblocks
+ */
+
+#define XVMC_CONCEALMENT_MOTION_VECTORS 0x00000200
+
+/*
+ * Which of two mappings between quantiser_scale_code
+ * and quantiser_scale shall apply.
+ */
+
+#define XVMC_Q_SCALE_TYPE         0x00000400
+
+/*
+ * Intra VLC Format: Bit = 0,  Bit = 1
+ * Intra blocks      B-14      B-15
+ * Non-intra blocks  B-14      B-14
+ */
+#define XVMC_INTRA_VLC_FORMAT     0x00000800
+
+/*
+ * Also XVMC_SECOND_FIELD should be set in flags if active.
+ */
+
+#define XVMC_I_PICTURE 1
+#define XVMC_P_PICTURE 2
+#define XVMC_B_PICTURE 3
+
+typedef struct _XvMCMpegControl{
+    unsigned
+        BVMV_range,        /* Backward vertical motion vector range */
+	BHMV_range,        /* Backward horizontal motion vector range */
+	FVMV_range,        /* Forward vertical motion vector range */
+	FHMV_range,        /* Forward horizontal motion vector range */
+	picture_structure, /* XVMC_TOP_FIELD, XVMC_BOTTOM_FIELD,
+			    *  XVMC_FRAME_PICTURE
+			    */
+	intra_dc_precision, /* 0x00 - 0x03 corresponds to 8 to 11 bits prec. */
+	picture_coding_type,/* XVMC_X_PICTURE */
+	mpeg_coding,        /* XVMC_MPEG_2 */
+	flags;              /* See above */
+}XvMCMpegControl;
+
+
+/*
+ * The following function is called BEFORE starting sending slices to the
+ * lib. It grabs the decoder hardware and prepares it for coming slices.
+ * The function XvMCSyncSurface will release the hardware for other contexts
+ * in addition to it's current functionality.
+ */
+
+extern Status XvMCBeginSurface(Display *display,
+			       XvMCContext *context,
+			       XvMCSurface *target_surface,
+			       XvMCSurface *past_surface,
+			       XvMCSurface *future_surface,
+			       const XvMCMpegControl *control);
+
+
+/*
+ * The quantizer matrix structure. This should be filled in by the user and
+ * uploaded whenever a change is needed. The lib initializes with
+ * default matrices and will automatically load the hardware with new matrices
+ * on decoder context switches. To load data, set the corresponding load flag
+ * to true and fill in the values. The VIA MPEG2 engine only uses the
+ * intra_quantiser_matrix and the non_intra_quantiser_matrix.
+ */
+
+typedef struct _XvMCQMatrix {
+    int load_intra_quantiser_matrix;
+    int load_non_intra_quantiser_matrix;
+    int load_chroma_intra_quantiser_matrix;
+    int load_chroma_non_intra_quantiser_matrix;
+    unsigned char intra_quantiser_matrix[64];
+    unsigned char non_intra_quantiser_matrix[64];
+    unsigned char chroma_intra_quantiser_matrix[64];
+    unsigned char chroma_non_intra_quantiser_matrix[64];
+} XvMCQMatrix;
+
+/*
+ * Upload a XvMCQMatrix structure to the clientlib.
+ * The hardware will start using it the next XvMCBeginSurface.
+ */
+
+extern Status XvMCLoadQMatrix(Display *display, XvMCContext *context,
+			      const XvMCQMatrix *qmx);
+
+
+/*
+ * Put a slice to the decoder. The hardware will start processing it
+ * immediately.
+ */
+
+extern Status XvMCPutSlice(Display *display,XvMCContext *context,
+			   char *slice, int nBytes);
+/*
+ * Put a slice without the slice start code to the decoder.
+ * The hardware will start processing it
+ * immediately. This function is for client optimization.
+ * XvMCPutSlice(display,context,slice,nBytes) is equivalent to
+ * XvMCPutSlice2(display,context,slice+4,nBytes-4,slice[3]);
+ */
+
+extern Status XvMCPutSlice2(Display *display,XvMCContext *context,
+			   char *slice, int nBytes, int sliceCode);
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/xcmiscproto.h b/ThirdParty/X11/Include/X11/extensions/xcmiscproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..482c2dc42726ddb02ee85ca1ec4e4802962163c3
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xcmiscproto.h
@@ -0,0 +1,110 @@
+/*
+
+Copyright 1993, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _XCMISCPROTO_H_
+#define _XCMISCPROTO_H_
+
+#define X_XCMiscGetVersion	0
+#define X_XCMiscGetXIDRange	1
+#define X_XCMiscGetXIDList	2
+
+#define XCMiscNumberEvents	0
+
+#define XCMiscNumberErrors	0
+
+#define XCMiscMajorVersion	1
+#define XCMiscMinorVersion	1
+
+#define XCMiscExtensionName	"XC-MISC"
+
+typedef struct {
+    CARD8	reqType;	/* always XCMiscCode */
+    CARD8	miscReqType;	/* always X_XCMiscGetVersion */
+    CARD16	length B16;
+    CARD16	majorVersion B16;
+    CARD16	minorVersion B16;
+} xXCMiscGetVersionReq;
+#define sz_xXCMiscGetVersionReq 8
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	pad0;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	majorVersion B16;
+    CARD16	minorVersion B16;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xXCMiscGetVersionReply;
+#define sz_xXCMiscGetVersionReply 32
+
+typedef struct {
+    CARD8	reqType;	/* always XCMiscCode */
+    CARD8	miscReqType;	/* always X_XCMiscGetXIDRange */
+    CARD16	length B16;
+} xXCMiscGetXIDRangeReq;
+#define sz_xXCMiscGetXIDRangeReq 4
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	pad0;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	start_id B32;
+    CARD32	count B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+} xXCMiscGetXIDRangeReply;
+#define sz_xXCMiscGetXIDRangeReply 32
+
+typedef struct {
+    CARD8	reqType;	/* always XCMiscCode */
+    CARD8	miscReqType;	/* always X_XCMiscGetXIDList */
+    CARD16	length B16;
+    CARD32	count B32;	/* number of IDs requested */
+} xXCMiscGetXIDListReq;
+#define sz_xXCMiscGetXIDListReq 8
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	pad0;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	count B32;	/* number of IDs requested */
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xXCMiscGetXIDListReply;
+#define sz_xXCMiscGetXIDListReply 32
+
+#endif /* _XCMISCPROTO_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/xcmiscstr.h b/ThirdParty/X11/Include/X11/extensions/xcmiscstr.h
new file mode 100644
index 0000000000000000000000000000000000000000..c2b643308cce88d36d2df62fefa831f67d0a4874
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xcmiscstr.h
@@ -0,0 +1,3 @@
+#warning "xcmiscstr.h is obsolete and may be removed in the future."
+#warning "include <X11/extensions/xcmiscproto.h> for the protocol defines."
+#include <X11/extensions/xcmiscproto.h>
diff --git a/ThirdParty/X11/Include/X11/extensions/xf86bigfont.h b/ThirdParty/X11/Include/X11/extensions/xf86bigfont.h
new file mode 100644
index 0000000000000000000000000000000000000000..1bf47e92d1d8ba56c5772df032665abcfd03e6fb
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xf86bigfont.h
@@ -0,0 +1,20 @@
+/*
+ * Declarations for the BIGFONT extension.
+ *
+ * Copyright (c) 1999-2000  Bruno Haible
+ * Copyright (c) 1999-2000  The XFree86 Project, Inc.
+ */
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD */
+
+#ifndef _XF86BIGFONT_H_
+#define _XF86BIGFONT_H_
+
+#define X_XF86BigfontQueryVersion	0
+#define X_XF86BigfontQueryFont		1
+
+#define XF86BigfontNumberEvents		0
+
+#define XF86BigfontNumberErrors		0
+
+#endif /* _XF86BIGFONT_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/xf86bigfproto.h b/ThirdParty/X11/Include/X11/extensions/xf86bigfproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..c041c9aaf644527fe7464ceca412b28566fed61b
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xf86bigfproto.h
@@ -0,0 +1,92 @@
+/*
+ * Declarations of request structures for the BIGFONT extension.
+ *
+ * Copyright (c) 1999-2000  Bruno Haible
+ * Copyright (c) 1999-2000  The XFree86 Project, Inc.
+ */
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD */
+
+#ifndef _XF86BIGFPROTO_H_
+#define _XF86BIGFPROTO_H_
+
+#include <X11/extensions/xf86bigfont.h>
+
+#define XF86BIGFONTNAME			"XFree86-Bigfont"
+
+#define XF86BIGFONT_MAJOR_VERSION	1	/* current version numbers */
+#define XF86BIGFONT_MINOR_VERSION	1
+
+typedef struct _XF86BigfontQueryVersion {
+    CARD8	reqType;		/* always XF86BigfontReqCode */
+    CARD8	xf86bigfontReqType;	/* always X_XF86BigfontQueryVersion */
+    CARD16	length B16;
+} xXF86BigfontQueryVersionReq;
+#define sz_xXF86BigfontQueryVersionReq	4
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	capabilities;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	majorVersion B16;	/* major version of XFree86-Bigfont */
+    CARD16	minorVersion B16;	/* minor version of XFree86-Bigfont */
+    CARD32	uid B32;
+    CARD32	gid B32;
+    CARD32	signature B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+} xXF86BigfontQueryVersionReply;
+#define sz_xXF86BigfontQueryVersionReply 32
+
+/* Bit masks that can be set in the capabilities */
+#define XF86Bigfont_CAP_LocalShm 1
+
+typedef struct _XF86BigfontQueryFont {
+    CARD8	reqType;		/* always XF86BigfontReqCode */
+    CARD8	xf86bigfontReqType;	/* always X_XF86BigfontQueryFont */
+    CARD16	length B16;
+    CARD32	id B32;
+    CARD32	flags B32;
+} xXF86BigfontQueryFontReq;
+#define sz_xXF86BigfontQueryFontReq	12
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    xCharInfo	minBounds;
+#ifndef WORD64
+    CARD32	walign1 B32;
+#endif
+    xCharInfo	maxBounds;
+#ifndef WORD64
+    CARD32	walign2 B32;
+#endif
+    CARD16	minCharOrByte2 B16;
+    CARD16	maxCharOrByte2 B16;
+    CARD16	defaultChar B16;
+    CARD16	nFontProps B16;
+    CARD8	drawDirection;
+    CARD8	minByte1;
+    CARD8	maxByte1;
+    BOOL	allCharsExist;
+    INT16	fontAscent B16;
+    INT16	fontDescent B16;
+    CARD32	nCharInfos B32;
+    CARD32	nUniqCharInfos B32;
+    CARD32	shmid B32;
+    CARD32	shmsegoffset B32;
+    /* followed by nFontProps xFontProp structures */
+    /* and if nCharInfos > 0 && shmid == -1,
+       followed by nUniqCharInfos xCharInfo structures
+       and then by nCharInfos CARD16 indices (each >= 0, < nUniqCharInfos)
+       and then, if nCharInfos is odd, one more CARD16 for padding. */
+} xXF86BigfontQueryFontReply;
+#define sz_xXF86BigfontQueryFontReply	72
+
+/* Bit masks that can be set in the flags */
+#define XF86Bigfont_FLAGS_Shm 1
+
+#endif /* _XF86BIGFPROTO_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/xf86bigfstr.h b/ThirdParty/X11/Include/X11/extensions/xf86bigfstr.h
new file mode 100644
index 0000000000000000000000000000000000000000..cf6735d499b0830c59eee706da7435f7be24f506
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xf86bigfstr.h
@@ -0,0 +1,3 @@
+#warning "xf86bigfstr.h is obsolete and may be removed in the future."
+#warning "include <X11/extensions/xf86bigfproto.h> for the protocol defines."
+#include <X11/extensions/xf86bigfproto.h>
diff --git a/ThirdParty/X11/Include/X11/extensions/xf86dga.h b/ThirdParty/X11/Include/X11/extensions/xf86dga.h
new file mode 100644
index 0000000000000000000000000000000000000000..7b5d635f923ee27110225186af31d9bf8094d9a9
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xf86dga.h
@@ -0,0 +1,13 @@
+#ifdef _XF86DGA_SERVER_
+
+#warning "xf86dga.h is obsolete and may be removed in the future."
+#warning "include <X11/extensions/xf86dgaconst.h> instead."
+#include <X11/extensions/xf86dgaconst.h>
+
+#else
+
+#warning "xf86dga.h is obsolete and may be removed in the future."
+#warning "include <X11/extensions/Xxf86dga.h> instead."
+#include <X11/extensions/Xxf86dga.h>
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/xf86dga1const.h b/ThirdParty/X11/Include/X11/extensions/xf86dga1const.h
new file mode 100644
index 0000000000000000000000000000000000000000..eca06f6af1c9c81f8b085ad2ac05efb95460dab5
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xf86dga1const.h
@@ -0,0 +1,36 @@
+/*
+
+Copyright (c) 1995  Jon Tombs
+Copyright (c) 1995  XFree86 Inc
+
+*/
+
+/************************************************************************
+
+   THIS IS THE OLD DGA API AND IS OBSOLETE.  PLEASE DO NOT USE IT ANYMORE
+
+************************************************************************/
+
+#ifndef _XF86DGA1CONST_H_
+#define _XF86DGA1CONST_H_
+
+#define X_XF86DGAQueryVersion		0
+#define X_XF86DGAGetVideoLL		1
+#define X_XF86DGADirectVideo		2
+#define X_XF86DGAGetViewPortSize	3
+#define X_XF86DGASetViewPort		4
+#define X_XF86DGAGetVidPage		5
+#define X_XF86DGASetVidPage		6
+#define X_XF86DGAInstallColormap	7
+#define X_XF86DGAQueryDirectVideo	8
+#define X_XF86DGAViewPortChanged	9
+
+#define XF86DGADirectPresent		0x0001
+#define XF86DGADirectGraphics		0x0002
+#define XF86DGADirectMouse		0x0004
+#define XF86DGADirectKeyb		0x0008
+#define XF86DGAHasColormap		0x0100
+#define XF86DGADirectColormap		0x0200
+
+
+#endif /* _XF86DGA1CONST_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/xf86dga1proto.h b/ThirdParty/X11/Include/X11/extensions/xf86dga1proto.h
new file mode 100644
index 0000000000000000000000000000000000000000..5c53cb218c38433889353cda05acd5c354e0ac93
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xf86dga1proto.h
@@ -0,0 +1,195 @@
+/*
+
+Copyright (c) 1995  Jon Tombs
+Copyright (c) 1995  XFree86 Inc.
+
+*/
+
+#ifndef _XF86DGAPROTO1_H_
+#define _XF86DGAPROTO1_H_
+
+#include <X11/extensions/xf86dga1const.h>
+
+typedef struct _XF86DGAQueryVersion {
+    CARD8	reqType;		/* always DGAReqCode */
+    CARD8	dgaReqType;		/* always X_DGAQueryVersion */
+    CARD16	length B16;
+} xXF86DGAQueryVersionReq;
+#define sz_xXF86DGAQueryVersionReq	4
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	majorVersion B16;	/* major version of DGA protocol */
+    CARD16	minorVersion B16;	/* minor version of DGA protocol */
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xXF86DGAQueryVersionReply;
+#define sz_xXF86DGAQueryVersionReply	32
+
+typedef struct _XF86DGAGetVideoLL {
+    CARD8	reqType;		/* always DGAReqCode */
+    CARD8	dgaReqType;		/* always X_XF86DGAGetVideoLL */
+    CARD16	length B16;
+    CARD16	screen B16;
+    CARD16      pad B16;
+} xXF86DGAGetVideoLLReq;
+#define sz_xXF86DGAGetVideoLLReq	8
+
+typedef struct _XF86DGAInstallColormap{
+    CARD8	reqType;
+    CARD8	dgaReqType;
+    CARD16	length B16;
+    CARD16	screen B16;
+    CARD16	pad2; 
+    CARD32	id B32;  /* colormap. */
+} xXF86DGAInstallColormapReq;
+#define sz_xXF86DGAInstallColormapReq        12
+
+
+typedef struct {
+    BYTE	type;
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	offset B32;
+    CARD32	width B32;
+    CARD32	bank_size B32;
+    CARD32	ram_size B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xXF86DGAGetVideoLLReply;
+#define sz_xXF86DGAGetVideoLLReply	32
+
+typedef struct _XF86DGADirectVideo {
+    CARD8	reqType;		/* always DGAReqCode */
+    CARD8	dgaReqType;		/* always X_XF86DGADirectVideo */
+    CARD16	length B16;
+    CARD16	screen B16;
+    CARD16	enable B16;
+} xXF86DGADirectVideoReq;
+#define sz_xXF86DGADirectVideoReq	8
+
+
+typedef struct _XF86DGAGetViewPortSize {
+    CARD8	reqType;		/* always DGAReqCode */
+    CARD8	dgaReqType;		/* always X_XF86DGAGetViewPort */
+    CARD16	length B16;
+    CARD16	screen B16;
+    CARD16      pad B16;
+} xXF86DGAGetViewPortSizeReq;
+#define sz_xXF86DGAGetViewPortSizeReq	8
+
+typedef struct {
+    BYTE	type;
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	width B32;
+    CARD32	height B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xXF86DGAGetViewPortSizeReply;
+#define sz_xXF86DGAGetViewPortSizeReply	32
+
+typedef struct _XF86DGASetViewPort {
+    CARD8	reqType;		/* always DGAReqCode */
+    CARD8	dgaReqType;		/* always X_XF86DGASetViewPort */
+    CARD16	length B16;
+    CARD16	screen B16;
+    CARD16	pad B16;
+    CARD32      x B32;
+    CARD32	y B32;
+} xXF86DGASetViewPortReq;
+#define sz_xXF86DGASetViewPortReq	16
+
+typedef struct _XF86DGAGetVidPage {
+    CARD8	reqType;		/* always DGAReqCode */
+    CARD8	dgaReqType;		/* always X_XF86DGAGetVidPage */
+    CARD16	length B16;
+    CARD16	screen B16;
+    CARD16      pad B16;
+} xXF86DGAGetVidPageReq;
+#define sz_xXF86DGAGetVidPageReq	8
+
+typedef struct {
+    BYTE	type;
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	vpage B32;
+    CARD32	pad B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xXF86DGAGetVidPageReply;
+#define sz_xXF86DGAGetVidPageReply	32
+
+
+typedef struct _XF86DGASetVidPage {
+    CARD8	reqType;		/* always DGAReqCode */
+    CARD8	dgaReqType;		/* always X_XF86DGASetVidPage */
+    CARD16	length B16;
+    CARD16	screen B16;
+    CARD16      vpage B16;
+} xXF86DGASetVidPageReq;
+#define sz_xXF86DGASetVidPageReq	8
+
+
+typedef struct _XF86DGAQueryDirectVideo {
+    CARD8	reqType;		/* always DGAReqCode */
+    CARD8	dgaReqType;		/* always X_DGAQueryVersion */
+    CARD16	length B16;
+    CARD16	screen B16;
+    CARD16      pad B16;
+} xXF86DGAQueryDirectVideoReq;
+#define sz_xXF86DGAQueryDirectVideoReq	8
+
+typedef struct {
+    BYTE	type;
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	flags B32;
+    CARD32	pad B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xXF86DGAQueryDirectVideoReply;
+#define sz_xXF86DGAQueryDirectVideoReply 32
+
+
+typedef struct _XF86DGAViewPortChanged {
+    CARD8	reqType;		/* always DGAReqCode */
+    CARD8	dgaReqType;		/* always X_DGAQueryVersion */
+    CARD16	length B16;
+    CARD16	screen B16;
+    CARD16      n B16;
+} xXF86DGAViewPortChangedReq;
+#define sz_xXF86DGAViewPortChangedReq	8
+
+typedef struct {
+    BYTE	type;
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	result B32;
+    CARD32	pad B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xXF86DGAViewPortChangedReply;
+#define sz_xXF86DGAViewPortChangedReply 32
+
+#endif /* _XF86DGAPROTO1_H_ */
+
diff --git a/ThirdParty/X11/Include/X11/extensions/xf86dga1str.h b/ThirdParty/X11/Include/X11/extensions/xf86dga1str.h
new file mode 100644
index 0000000000000000000000000000000000000000..d8e73e8cae514b3d12dfc2959187002fce33ce58
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xf86dga1str.h
@@ -0,0 +1,3 @@
+#warning "xf86dga1str.h is obsolete and may be removed in the future."
+#warning "include <X11/extensions/xf86dga1proto.h> for the protocol defines."
+#include <X11/extensions/xf86dga1proto.h>
diff --git a/ThirdParty/X11/Include/X11/extensions/xf86dgaconst.h b/ThirdParty/X11/Include/X11/extensions/xf86dgaconst.h
new file mode 100644
index 0000000000000000000000000000000000000000..63829bc42da26717fda2d223011212543f38cd14
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xf86dgaconst.h
@@ -0,0 +1,96 @@
+/*
+   Copyright (c) 1999  XFree86 Inc
+*/
+
+#ifndef _XF86DGACONST_H_
+#define _XF86DGACONST_H_
+
+#include <X11/extensions/xf86dga1const.h>
+
+#define X_XDGAQueryVersion		0
+
+/* 1 through 9 are in xf86dga1.h */
+
+/* 10 and 11 are reserved to avoid conflicts with rogue DGA extensions */
+
+#define X_XDGAQueryModes		12
+#define X_XDGASetMode			13
+#define X_XDGASetViewport		14
+#define X_XDGAInstallColormap		15
+#define X_XDGASelectInput		16
+#define X_XDGAFillRectangle		17
+#define X_XDGACopyArea			18
+#define X_XDGACopyTransparentArea	19
+#define X_XDGAGetViewportStatus		20
+#define X_XDGASync			21
+#define X_XDGAOpenFramebuffer		22
+#define X_XDGACloseFramebuffer		23
+#define X_XDGASetClientVersion		24
+#define X_XDGAChangePixmapMode		25
+#define X_XDGACreateColormap		26
+
+
+#define XDGAConcurrentAccess	0x00000001
+#define XDGASolidFillRect	0x00000002
+#define XDGABlitRect		0x00000004
+#define XDGABlitTransRect	0x00000008
+#define XDGAPixmap    		0x00000010
+
+#define XDGAInterlaced          0x00010000
+#define XDGADoublescan          0x00020000
+
+#define XDGAFlipImmediate	0x00000001
+#define XDGAFlipRetrace		0x00000002
+
+#define XDGANeedRoot		0x00000001
+
+#define XF86DGANumberEvents		7
+
+#define XDGAPixmapModeLarge		0
+#define XDGAPixmapModeSmall		1
+
+#define XF86DGAClientNotLocal		0
+#define XF86DGANoDirectVideoMode	1
+#define XF86DGAScreenNotActive		2
+#define XF86DGADirectNotActivated	3
+#define XF86DGAOperationNotSupported	4
+#define XF86DGANumberErrors		(XF86DGAOperationNotSupported + 1)
+
+
+typedef struct {
+   int num;		/* A unique identifier for the mode (num > 0) */
+   char *name;		/* name of mode given in the XF86Config */
+   float verticalRefresh;
+   int flags;		/* DGA_CONCURRENT_ACCESS, etc... */
+   int imageWidth;	/* linear accessible portion (pixels) */
+   int imageHeight;
+   int pixmapWidth;	/* Xlib accessible portion (pixels) */
+   int pixmapHeight;	/* both fields ignored if no concurrent access */
+   int bytesPerScanline; 
+   int byteOrder;	/* MSBFirst, LSBFirst */
+   int depth;		
+   int bitsPerPixel;
+   unsigned long redMask;
+   unsigned long greenMask;
+   unsigned long blueMask;
+   short visualClass;
+   int viewportWidth;
+   int viewportHeight;
+   int xViewportStep;	/* viewport position granularity */
+   int yViewportStep;
+   int maxViewportX;	/* max viewport origin */
+   int maxViewportY;
+   int viewportFlags;	/* types of page flipping possible */
+   int reserved1;
+   int reserved2;
+} XDGAMode;
+
+
+typedef struct {
+   XDGAMode mode;
+   unsigned char *data;
+   Pixmap pixmap;
+} XDGADevice;
+
+
+#endif /* _XF86DGACONST_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/xf86dgaproto.h b/ThirdParty/X11/Include/X11/extensions/xf86dgaproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..8b7f13d28d79bbb953cc9e197712c1ec8c0b368d
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xf86dgaproto.h
@@ -0,0 +1,344 @@
+/*
+
+Copyright (c) 1995  Jon Tombs
+Copyright (c) 1995  XFree86 Inc.
+
+*/
+
+#ifndef _XF86DGAPROTO_H_
+#define _XF86DGAPROTO_H_
+
+#include <X11/extensions/xf86dga1proto.h>
+#include <X11/extensions/xf86dgaconst.h>
+
+#define XF86DGANAME "XFree86-DGA"
+
+#define XDGA_MAJOR_VERSION	2	/* current version numbers */
+#define XDGA_MINOR_VERSION	0
+
+
+typedef struct _XDGAQueryVersion {
+    CARD8	reqType;		/* always DGAReqCode */
+    CARD8	dgaReqType;		/* always X_DGAQueryVersion */
+    CARD16	length B16;
+} xXDGAQueryVersionReq;
+#define sz_xXDGAQueryVersionReq		4
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	majorVersion B16;	/* major version of DGA protocol */
+    CARD16	minorVersion B16;	/* minor version of DGA protocol */
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xXDGAQueryVersionReply;
+#define sz_xXDGAQueryVersionReply	32
+
+typedef struct _XDGAQueryModes {
+    CARD8	reqType;
+    CARD8	dgaReqType;
+    CARD16	length B16;
+    CARD32	screen B32;
+} xXDGAQueryModesReq;
+#define sz_xXDGAQueryModesReq		8
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	number B32;		/* number of modes available */
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xXDGAQueryModesReply;
+#define sz_xXDGAQueryModesReply	32
+
+
+typedef struct _XDGASetMode {
+    CARD8	reqType;
+    CARD8	dgaReqType;
+    CARD16	length B16;
+    CARD32	screen B32;
+    CARD32	mode B32;		/* mode number to init */
+    CARD32	pid B32;		/* Pixmap descriptor */
+} xXDGASetModeReq;
+#define sz_xXDGASetModeReq		16
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	offset B32;		/* offset into framebuffer map */
+    CARD32	flags B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xXDGASetModeReply;
+#define sz_xXDGASetModeReply	32
+
+typedef struct {
+   CARD8	byte_order;
+   CARD8	depth;
+   CARD16 	num B16;
+   CARD16	bpp B16;
+   CARD16	name_size B16;
+   CARD32	vsync_num B32;
+   CARD32	vsync_den B32;
+   CARD32	flags B32;
+   CARD16	image_width B16;
+   CARD16	image_height B16;
+   CARD16	pixmap_width B16;
+   CARD16	pixmap_height B16;
+   CARD32	bytes_per_scanline B32;
+   CARD32	red_mask B32;
+   CARD32	green_mask B32;
+   CARD32	blue_mask B32;
+   CARD16	visual_class B16;
+   CARD16	pad1 B16;
+   CARD16	viewport_width B16;
+   CARD16	viewport_height B16;
+   CARD16	viewport_xstep B16;
+   CARD16	viewport_ystep B16;
+   CARD16	viewport_xmax B16;
+   CARD16	viewport_ymax B16;
+   CARD32	viewport_flags B32;
+   CARD32	reserved1 B32;
+   CARD32	reserved2 B32;
+} xXDGAModeInfo;
+#define sz_xXDGAModeInfo 72
+
+typedef struct _XDGAOpenFramebuffer {
+    CARD8	reqType;
+    CARD8	dgaReqType;
+    CARD16	length B16;
+    CARD32	screen B32;
+} xXDGAOpenFramebufferReq;
+#define sz_xXDGAOpenFramebufferReq	8
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;		/* device name size if there is one */
+    CARD32	mem1 B32;		/* physical memory */	
+    CARD32	mem2 B32;		/* spillover for _alpha_ */
+    CARD32	size B32;		/* size of map in bytes */
+    CARD32	offset B32;		/* optional offset into device */
+    CARD32	extra B32;		/* extra info associated with the map */
+    CARD32	pad2 B32;
+} xXDGAOpenFramebufferReply;
+#define sz_xXDGAOpenFramebufferReply	32
+
+
+typedef struct _XDGACloseFramebuffer {
+    CARD8	reqType;
+    CARD8	dgaReqType;
+    CARD16	length B16;
+    CARD32	screen B32;
+} xXDGACloseFramebufferReq;
+#define sz_xXDGACloseFramebufferReq	8
+
+
+typedef struct _XDGASetViewport {
+    CARD8	reqType;
+    CARD8	dgaReqType;
+    CARD16	length B16;
+    CARD32	screen B32;
+    CARD16	x B16;
+    CARD16	y B16;
+    CARD32	flags B32;
+} xXDGASetViewportReq;
+#define sz_xXDGASetViewportReq	16
+
+
+typedef struct _XDGAInstallColormap {
+    CARD8	reqType;
+    CARD8	dgaReqType;
+    CARD16	length B16;
+    CARD32	screen B32;
+    CARD32	cmap B32;
+} xXDGAInstallColormapReq;
+#define sz_xXDGAInstallColormapReq	12
+
+typedef struct _XDGASelectInput {
+    CARD8	reqType;
+    CARD8	dgaReqType;
+    CARD16	length B16;
+    CARD32	screen B32;
+    CARD32	mask B32;
+} xXDGASelectInputReq;
+#define sz_xXDGASelectInputReq	12
+
+typedef struct _XDGAFillRectangle {
+    CARD8	reqType;
+    CARD8	dgaReqType;
+    CARD16	length B16;
+    CARD32	screen B32;
+    CARD16	x B16;
+    CARD16	y B16;
+    CARD16	width B16;
+    CARD16	height B16;
+    CARD32	color B32;
+} xXDGAFillRectangleReq;
+#define sz_xXDGAFillRectangleReq	20
+
+
+typedef struct _XDGACopyArea {
+    CARD8	reqType;
+    CARD8	dgaReqType;
+    CARD16	length B16;
+    CARD32	screen B32;
+    CARD16	srcx B16;
+    CARD16	srcy B16;
+    CARD16	width B16;
+    CARD16	height B16;
+    CARD16	dstx B16;
+    CARD16	dsty B16;
+} xXDGACopyAreaReq;
+#define sz_xXDGACopyAreaReq	20
+
+typedef struct _XDGACopyTransparentArea {
+    CARD8	reqType;
+    CARD8	dgaReqType;
+    CARD16	length B16;
+    CARD32	screen B32;
+    CARD16	srcx B16;
+    CARD16	srcy B16;
+    CARD16	width B16;
+    CARD16	height B16;
+    CARD16	dstx B16;
+    CARD16	dsty B16;
+    CARD32	key B32;
+} xXDGACopyTransparentAreaReq;
+#define sz_xXDGACopyTransparentAreaReq	24
+
+
+typedef struct _XDGAGetViewportStatus {
+    CARD8	reqType;
+    CARD8	dgaReqType;
+    CARD16	length B16;
+    CARD32	screen B32;
+} xXDGAGetViewportStatusReq;
+#define sz_xXDGAGetViewportStatusReq	8
+
+typedef struct {
+    BYTE	type;			
+    BOOL	pad1;	
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	status B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xXDGAGetViewportStatusReply;
+#define sz_xXDGAGetViewportStatusReply	32
+
+typedef struct _XDGASync {
+    CARD8	reqType;
+    CARD8	dgaReqType;
+    CARD16	length B16;
+    CARD32	screen B32;
+} xXDGASyncReq;
+#define sz_xXDGASyncReq	8
+
+typedef struct {
+    BYTE	type;			
+    BOOL	pad1;	
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+    CARD32	pad7 B32;
+} xXDGASyncReply;
+#define sz_xXDGASyncReply	32
+
+typedef struct _XDGASetClientVersion {
+    CARD8	reqType;
+    CARD8	dgaReqType;
+    CARD16	length B16;
+    CARD16	major B16;
+    CARD16	minor B16;
+} xXDGASetClientVersionReq;
+#define sz_xXDGASetClientVersionReq	8
+
+
+typedef struct {
+    CARD8	reqType;
+    CARD8	dgaReqType;
+    CARD16	length B16;
+    CARD32	screen B32;
+    CARD16	x B16;
+    CARD16	y B16;
+    CARD32	flags B32;
+} xXDGAChangePixmapModeReq;
+#define sz_xXDGAChangePixmapModeReq	16
+
+typedef struct {
+    BYTE	type;			
+    BOOL	pad1;	
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	x B16;
+    CARD16	y B16;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+    CARD32	pad7 B32;
+} xXDGAChangePixmapModeReply;
+#define sz_xXDGAChangePixmapModeReply	32
+
+typedef struct _XDGACreateColormap {
+    CARD8	reqType;
+    CARD8	dgaReqType;
+    CARD16	length B16;
+    CARD32	screen B32;
+    CARD32	id B32;
+    CARD32	mode B32;
+    CARD8	alloc;
+    CARD8	pad1;
+    CARD16	pad2;
+} xXDGACreateColormapReq;
+#define sz_xXDGACreateColormapReq	20
+
+
+typedef struct {
+  union {
+    struct {
+      BYTE type;
+      BYTE detail;
+      CARD16 sequenceNumber B16;
+    } u;
+    struct {
+      CARD32 pad0 B32;
+      CARD32 time B32;
+      INT16 dx B16;
+      INT16 dy B16;
+      INT16 screen B16;
+      CARD16 state B16;
+      CARD32 pad1 B32;
+      CARD32 pad2 B32;
+      CARD32 pad3 B32;
+      CARD32 pad4 B32;
+    } event;
+  } u;
+} dgaEvent;
+
+
+#endif /* _XF86DGAPROTO_H_ */
+
diff --git a/ThirdParty/X11/Include/X11/extensions/xf86dgastr.h b/ThirdParty/X11/Include/X11/extensions/xf86dgastr.h
new file mode 100644
index 0000000000000000000000000000000000000000..f4809d1a591d4b50016f1fda6d0a6b464e3e3c3d
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xf86dgastr.h
@@ -0,0 +1,3 @@
+#warning "xf86dgastr.h is obsolete and may be removed in the future."
+#warning "include <X11/extensions/xf86dgaproto.h> for the protocol defines."
+#include <X11/extensions/xf86dgaproto.h>
diff --git a/ThirdParty/X11/Include/X11/extensions/xf86misc.h b/ThirdParty/X11/Include/X11/extensions/xf86misc.h
new file mode 100644
index 0000000000000000000000000000000000000000..f5d7a5664d63e2e482dccb3e5c6a36b68e7808ba
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xf86misc.h
@@ -0,0 +1,172 @@
+/* $XFree86: xc/include/extensions/xf86misc.h,v 3.16 2002/11/20 04:04:56 dawes Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996  The XFree86 Project, Inc
+ */
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD */
+
+#ifndef _XF86MISC_H_
+#define _XF86MISC_H_
+
+#include <X11/Xfuncproto.h>
+
+#define X_XF86MiscQueryVersion		0
+#ifdef _XF86MISC_SAVER_COMPAT_
+#define X_XF86MiscGetSaver		1
+#define X_XF86MiscSetSaver		2
+#endif
+#define X_XF86MiscGetMouseSettings	3
+#define X_XF86MiscGetKbdSettings	4
+#define X_XF86MiscSetMouseSettings	5
+#define X_XF86MiscSetKbdSettings	6
+#define X_XF86MiscSetGrabKeysState	7
+#define X_XF86MiscSetClientVersion      8
+#define X_XF86MiscGetFilePaths		9
+#define X_XF86MiscPassMessage		10
+
+#define XF86MiscNumberEvents		0
+
+#define XF86MiscBadMouseProtocol	0
+#define XF86MiscBadMouseBaudRate	1
+#define XF86MiscBadMouseFlags		2
+#define XF86MiscBadMouseCombo		3
+#define XF86MiscBadKbdType		4
+#define XF86MiscModInDevDisabled	5
+#define XF86MiscModInDevClientNotLocal	6
+#define XF86MiscNoModule                7
+#define XF86MiscNumberErrors		(XF86MiscNoModule + 1)
+
+/* Never renumber these */
+#define MTYPE_MICROSOFT		0
+#define MTYPE_MOUSESYS		1
+#define MTYPE_MMSERIES		2
+#define MTYPE_LOGITECH		3
+#define MTYPE_BUSMOUSE		4
+#define MTYPE_LOGIMAN		5
+#define MTYPE_PS_2		6
+#define MTYPE_MMHIT		7
+#define MTYPE_GLIDEPOINT	8
+#define MTYPE_IMSERIAL		9
+#define MTYPE_THINKING		10
+#define MTYPE_IMPS2		11
+#define MTYPE_THINKINGPS2	12
+#define MTYPE_MMANPLUSPS2	13
+#define MTYPE_GLIDEPOINTPS2	14
+#define MTYPE_NETPS2		15
+#define MTYPE_NETSCROLLPS2	16
+#define MTYPE_SYSMOUSE		17
+#define MTYPE_AUTOMOUSE		18
+#define MTYPE_ACECAD		19
+#define MTYPE_EXPPS2            20
+
+#define MTYPE_XQUEUE		127
+#define MTYPE_OSMOUSE		126
+#define MTYPE_UNKNOWN		125
+
+#define KTYPE_UNKNOWN		0
+#define KTYPE_84KEY		1
+#define KTYPE_101KEY		2
+#define KTYPE_OTHER		3
+#define KTYPE_XQUEUE		4
+
+#define MF_CLEAR_DTR		1
+#define MF_CLEAR_RTS		2
+#define MF_REOPEN		128
+
+#ifndef _XF86MISC_SERVER_
+
+/* return values for XF86MiscSetGrabKeysState */
+#define MiscExtGrabStateSuccess	0	/* No errors */
+#define MiscExtGrabStateLocked	1	/* A client already requested that
+					 * grabs cannot be removed/killed */
+#define MiscExtGrabStateAlready	2	/* Request for enabling/disabling
+					 * grab removeal/kill already done */
+
+_XFUNCPROTOBEGIN
+
+typedef struct {
+    char*	device;
+    int		type;
+    int		baudrate;
+    int		samplerate;
+    int		resolution;
+    int		buttons;
+    Bool	emulate3buttons;
+    int		emulate3timeout;
+    Bool	chordmiddle;
+    int		flags;
+} XF86MiscMouseSettings;
+
+typedef struct {
+    int		type;
+    int		rate;
+    int		delay;
+    Bool	servnumlock;
+} XF86MiscKbdSettings;
+
+typedef struct {
+    char*	configfile;
+    char*	modulepath;
+    char*	logfile;
+} XF86MiscFilePaths;
+
+Bool XF86MiscQueryVersion(
+    Display*		/* dpy */,
+    int*		/* majorVersion */,
+    int*		/* minorVersion */
+);
+
+Bool XF86MiscQueryExtension(
+    Display*		/* dpy */,
+    int*		/* event_base */,
+    int*		/* error_base */
+);
+
+Bool XF86MiscSetClientVersion(
+    Display *dpy	/* dpy */
+);
+
+Status XF86MiscGetMouseSettings(
+    Display*			/* dpy */,
+    XF86MiscMouseSettings*	/* mouse info */
+);
+
+Status XF86MiscGetKbdSettings(
+    Display*			/* dpy */,
+    XF86MiscKbdSettings*	/* keyboard info */
+);
+
+Status XF86MiscSetMouseSettings(
+    Display*			/* dpy */,
+    XF86MiscMouseSettings*	/* mouse info */
+);
+
+Status XF86MiscSetKbdSettings(
+    Display*			/* dpy */,
+    XF86MiscKbdSettings*	/* keyboard info */
+);
+
+int XF86MiscSetGrabKeysState(
+    Display*			/* dpy */,
+    Bool			/* enabled */
+);
+
+Status XF86MiscGetFilePaths(
+    Display*			/* dpy */,
+    XF86MiscFilePaths*		/* file paths/locations */
+);
+
+Status XF86MiscPassMessage(
+    Display*			/* dpy */,
+    int				/* screen */,
+    const char*			/* message name/type */,
+    const char*			/* message contents/value */,
+    char **			/* returned message */
+);
+
+_XFUNCPROTOEND
+
+#endif
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/xf86mscstr.h b/ThirdParty/X11/Include/X11/extensions/xf86mscstr.h
new file mode 100644
index 0000000000000000000000000000000000000000..637d3a5a09f64de3859f225825d8eed21282557b
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xf86mscstr.h
@@ -0,0 +1,238 @@
+/* $XFree86: xc/include/extensions/xf86mscstr.h,v 3.12 2002/11/20 04:04:56 dawes Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996  The XFree86 Project, Inc
+ */
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD */
+
+#ifndef _XF86MISCSTR_H_
+#define _XF86MISCSTR_H_
+
+#include <X11/extensions/xf86misc.h>
+
+#define XF86MISCNAME		"XFree86-Misc"
+
+#define XF86MISC_MAJOR_VERSION	0	/* current version numbers */
+#define XF86MISC_MINOR_VERSION	9
+
+typedef struct _XF86MiscQueryVersion {
+    CARD8	reqType;		/* always XF86MiscReqCode */
+    CARD8	xf86miscReqType;	/* always X_XF86MiscQueryVersion */
+    CARD16	length B16;
+} xXF86MiscQueryVersionReq;
+#define sz_xXF86MiscQueryVersionReq	4
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	majorVersion B16;	/* major version of XFree86-Misc */
+    CARD16	minorVersion B16;	/* minor version of XFree86-Misc */
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xXF86MiscQueryVersionReply;
+#define sz_xXF86MiscQueryVersionReply	32
+
+#ifdef _XF86MISC_SAVER_COMPAT_
+typedef struct _XF86MiscGetSaver {
+    CARD8       reqType;                /* always XF86MiscReqCode */
+    CARD8       xf86miscReqType;     /* always X_XF86MiscGetSaver */
+    CARD16      length B16; 
+    CARD16      screen B16;
+    CARD16      pad B16;
+} xXF86MiscGetSaverReq;
+#define sz_xXF86MiscGetSaverReq	8
+
+typedef struct _XF86MiscSetSaver {
+    CARD8	reqType;		/* always XF86MiscReqCode */
+    CARD8	xf86miscReqType;	/* always X_XF86MiscSetSaver */
+    CARD16	length B16;
+    CARD16	screen B16;
+    CARD16	pad B16;
+    CARD32	suspendTime B32;
+    CARD32	offTime B32;
+} xXF86MiscSetSaverReq;
+#define sz_xXF86MiscSetSaverReq	16
+
+typedef struct {
+    BYTE	type;
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	suspendTime B32;
+    CARD32	offTime B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xXF86MiscGetSaverReply;
+#define sz_xXF86MiscGetSaverReply	32
+#endif
+
+typedef struct _XF86MiscGetMouseSettings {
+    CARD8	reqType;		/* always XF86MiscReqCode */
+    CARD8	xf86miscReqType;	/* always X_XF86MiscGetMouseSettings */
+    CARD16	length B16;
+} xXF86MiscGetMouseSettingsReq;
+#define sz_xXF86MiscGetMouseSettingsReq	4
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	mousetype B32;
+    CARD32	baudrate B32;
+    CARD32	samplerate B32;
+    CARD32	resolution B32;
+    CARD32	buttons B32;
+    BOOL	emulate3buttons;
+    BOOL	chordmiddle;
+    CARD16	pad2 B16;
+    CARD32	emulate3timeout B32;
+    CARD32	flags B32;
+    CARD32	devnamelen B32;		/* strlen(device)+1 */
+} xXF86MiscGetMouseSettingsReply;
+#define sz_xXF86MiscGetMouseSettingsReply	44
+
+typedef struct _XF86MiscGetKbdSettings {
+    CARD8	reqType;		/* always XF86MiscReqCode */
+    CARD8	xf86miscReqType;	/* always X_XF86MiscGetKbdSettings */
+    CARD16	length B16;
+} xXF86MiscGetKbdSettingsReq;
+#define sz_xXF86MiscGetKbdSettingsReq	4
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	kbdtype B32;
+    CARD32	rate B32;
+    CARD32	delay B32;
+    BOOL	servnumlock;
+    BOOL	pad2;
+    CARD16	pad3 B16;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xXF86MiscGetKbdSettingsReply;
+#define sz_xXF86MiscGetKbdSettingsReply	32
+
+typedef struct _XF86MiscSetMouseSettings {
+    CARD8	reqType;		/* always XF86MiscReqCode */
+    CARD8	xf86miscReqType;	/* always X_XF86MiscSetMouseSettings */
+    CARD16	length B16;
+    CARD32	mousetype B32;
+    CARD32	baudrate B32;
+    CARD32	samplerate B32;
+    CARD32	resolution B32;
+    CARD32	buttons B32;
+    BOOL	emulate3buttons;
+    BOOL	chordmiddle;
+    CARD16	devnamelen B16;
+    CARD32	emulate3timeout B32;
+    CARD32	flags B32;
+} xXF86MiscSetMouseSettingsReq;
+#define sz_xXF86MiscSetMouseSettingsReq	36
+
+typedef struct _XF86MiscSetKbdSettings {
+    CARD8	reqType;		/* always XF86MiscReqCode */
+    CARD8	xf86miscReqType;	/* always X_XF86MiscSetKbdSettings */
+    CARD16	length B16;
+    CARD32	kbdtype B32;
+    CARD32	rate B32;
+    CARD32	delay B32;
+    BOOL	servnumlock;
+    BOOL	pad1;
+    CARD16	pad2 B16;
+} xXF86MiscSetKbdSettingsReq;
+#define sz_xXF86MiscSetKbdSettingsReq	20
+
+typedef struct _XF86MiscSetGrabKeysState {
+    CARD8	reqType;		/* always XF86MiscReqCode */
+    CARD8	xf86miscReqType;	/* always X_XF86MiscSetKbdSettings */
+    CARD16	length B16;
+    BOOL	enable;
+    BOOL	pad1;
+    CARD16	pad2 B16;
+} xXF86MiscSetGrabKeysStateReq;
+#define sz_xXF86MiscSetGrabKeysStateReq	8
+
+typedef struct {
+    BYTE	type;
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	status B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xXF86MiscSetGrabKeysStateReply;
+#define sz_xXF86MiscSetGrabKeysStateReply	32
+
+typedef struct _XF86MiscSetClientVersion {
+    CARD8	reqType;		/* always XF86MiscReqCode */
+    CARD8	xf86miscReqType;
+    CARD16	length B16;
+    CARD16	major B16;
+    CARD16	minor B16;
+} xXF86MiscSetClientVersionReq;
+#define sz_xXF86MiscSetClientVersionReq	8
+
+typedef struct _XF86MiscGetFilePaths {
+    CARD8	reqType;		/* always XF86MiscReqCode */
+    CARD8	xf86miscReqType;	/* always X_XF86MiscGetFilePaths */
+    CARD16	length B16;
+} xXF86MiscGetFilePathsReq;
+#define sz_xXF86MiscGetFilePathsReq	4
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	configlen B16;
+    CARD16	modulelen B16;
+    CARD16	loglen B16;
+    CARD16	pad2 B16;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xXF86MiscGetFilePathsReply;
+#define sz_xXF86MiscGetFilePathsReply	32
+
+typedef struct _XF86MiscPassMessage {
+    CARD8	reqType;		/* always XF86MiscReqCode */
+    CARD8	xf86miscReqType;	/* always X_XF86MiscPassMessage */
+    CARD16	length B16;
+    CARD16	typelen B16;
+    CARD16	vallen B16;
+    CARD16      screen B16;
+    CARD16      pad B16;
+} xXF86MiscPassMessageReq;
+#define sz_xXF86MiscPassMessageReq	12
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BYTE	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	mesglen B16;
+    CARD16	pad2 B16;
+    CARD32	status B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xXF86MiscPassMessageReply;
+#define sz_xXF86MiscPassMessageReply	32
+
+#endif /* _XF86MISCSTR_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/xf86vm.h b/ThirdParty/X11/Include/X11/extensions/xf86vm.h
new file mode 100644
index 0000000000000000000000000000000000000000..ddf4dacbb0b94ba36df249e58a5946a07b5df7d4
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xf86vm.h
@@ -0,0 +1,65 @@
+/*
+
+Copyright 1995  Kaleb S. KEITHLEY
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES 
+OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of Kaleb S. KEITHLEY 
+shall not be used in advertising or otherwise to promote the sale, use 
+or other dealings in this Software without prior written authorization
+from Kaleb S. KEITHLEY
+
+*/
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
+
+#ifndef _XF86VM_H_
+#define _XF86VM_H_
+
+#include <X11/Xmd.h>
+
+
+#define CLKFLAG_PROGRAMABLE		1
+
+#ifdef XF86VIDMODE_EVENTS
+#define XF86VidModeNotify		0
+#define XF86VidModeNumberEvents		(XF86VidModeNotify + 1)
+
+#define XF86VidModeNotifyMask		0x00000001
+
+#define XF86VidModeNonEvent		0
+#define XF86VidModeModeChange		1
+#else
+#define XF86VidModeNumberEvents		0
+#endif
+
+#define XF86VidModeBadClock		0
+#define XF86VidModeBadHTimings		1
+#define XF86VidModeBadVTimings		2
+#define XF86VidModeModeUnsuitable	3
+#define XF86VidModeExtensionDisabled	4
+#define XF86VidModeClientNotLocal	5
+#define XF86VidModeZoomLocked		6
+#define XF86VidModeNumberErrors		(XF86VidModeZoomLocked + 1)
+
+#define XF86VM_READ_PERMISSION	1
+#define XF86VM_WRITE_PERMISSION	2
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/xf86vmode.h b/ThirdParty/X11/Include/X11/extensions/xf86vmode.h
new file mode 100644
index 0000000000000000000000000000000000000000..a7a3c5d71b6b90f7f257fa6cc56f2094a7de1416
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xf86vmode.h
@@ -0,0 +1,298 @@
+/*
+
+Copyright 1995  Kaleb S. KEITHLEY
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES
+OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of Kaleb S. KEITHLEY
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+from Kaleb S. KEITHLEY
+
+*/
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
+
+#ifndef _XF86VIDMODE_H_
+#define _XF86VIDMODE_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/Xmd.h>
+#include <X11/extensions/xf86vm.h>
+
+#define CLKFLAG_PROGRAMABLE		1
+
+#ifdef XF86VIDMODE_EVENTS
+#define XF86VidModeNotify		0
+#define XF86VidModeNumberEvents		(XF86VidModeNotify + 1)
+
+#define XF86VidModeNotifyMask		0x00000001
+
+#define XF86VidModeNonEvent		0
+#define XF86VidModeModeChange		1
+#else
+#define XF86VidModeNumberEvents		0
+#endif
+
+#define XF86VidModeBadClock		0
+#define XF86VidModeBadHTimings		1
+#define XF86VidModeBadVTimings		2
+#define XF86VidModeModeUnsuitable	3
+#define XF86VidModeExtensionDisabled	4
+#define XF86VidModeClientNotLocal	5
+#define XF86VidModeZoomLocked		6
+#define XF86VidModeNumberErrors		(XF86VidModeZoomLocked + 1)
+
+#define XF86VM_READ_PERMISSION	1
+#define XF86VM_WRITE_PERMISSION	2
+
+#ifndef _XF86VIDMODE_SERVER_
+
+typedef struct {
+    unsigned short	hdisplay;
+    unsigned short	hsyncstart;
+    unsigned short	hsyncend;
+    unsigned short	htotal;
+    unsigned short	hskew;
+    unsigned short	vdisplay;
+    unsigned short	vsyncstart;
+    unsigned short	vsyncend;
+    unsigned short	vtotal;
+    unsigned int	flags;
+    int			privsize;
+#if defined(__cplusplus) || defined(c_plusplus)
+    /* private is a C++ reserved word */
+    INT32		*c_private;
+#else
+    INT32		*private;
+#endif
+} XF86VidModeModeLine;
+
+typedef struct {
+    unsigned int	dotclock;
+    unsigned short	hdisplay;
+    unsigned short	hsyncstart;
+    unsigned short	hsyncend;
+    unsigned short	htotal;
+    unsigned short	hskew;
+    unsigned short	vdisplay;
+    unsigned short	vsyncstart;
+    unsigned short	vsyncend;
+    unsigned short	vtotal;
+    unsigned int	flags;
+    int			privsize;
+#if defined(__cplusplus) || defined(c_plusplus)
+    /* private is a C++ reserved word */
+    INT32		*c_private;
+#else
+    INT32		*private;
+#endif
+} XF86VidModeModeInfo;
+
+typedef struct {
+    float		hi;
+    float		lo;
+} XF86VidModeSyncRange;
+
+typedef struct {
+    char*			vendor;
+    char*			model;
+    float			EMPTY;
+    unsigned char		nhsync;
+    XF86VidModeSyncRange*	hsync;
+    unsigned char		nvsync;
+    XF86VidModeSyncRange*	vsync;
+} XF86VidModeMonitor;
+
+typedef struct {
+    int type;			/* of event */
+    unsigned long serial;	/* # of last request processed by server */
+    Bool send_event;		/* true if this came from a SendEvent req */
+    Display *display;		/* Display the event was read from */
+    Window root;		/* root window of event screen */
+    int state;			/* What happened */
+    int kind;			/* What happened */
+    Bool forced;		/* extents of new region */
+    Time time;			/* event timestamp */
+} XF86VidModeNotifyEvent;
+
+typedef struct {
+    float red;			/* Red Gamma value */
+    float green;		/* Green Gamma value */
+    float blue;			/* Blue Gamma value */
+} XF86VidModeGamma;
+
+
+#define XF86VidModeSelectNextMode(disp, scr) \
+	XF86VidModeSwitchMode(disp, scr, 1)
+#define XF86VidModeSelectPrevMode(disp, scr) \
+	XF86VidModeSwitchMode(disp, scr, -1)
+
+_XFUNCPROTOBEGIN
+
+Bool XF86VidModeQueryVersion(
+    Display*		/* dpy */,
+    int*		/* majorVersion */,
+    int*		/* minorVersion */
+);
+
+Bool XF86VidModeQueryExtension(
+    Display*		/* dpy */,
+    int*		/* event_base */,
+    int*		/* error_base */
+);
+
+Bool XF86VidModeSetClientVersion(
+    Display*		/* dpy */
+);
+
+Bool XF86VidModeGetModeLine(
+    Display*			/* dpy */,
+    int				/* screen */,
+    int*			/* dotclock */,
+    XF86VidModeModeLine*	/* modeline */
+);
+
+Bool XF86VidModeGetAllModeLines(
+    Display*			/* dpy */,
+    int				/* screen */,
+    int*			/* modecount */,
+    XF86VidModeModeInfo***	/* modelinesPtr */
+);
+
+Bool XF86VidModeAddModeLine(
+    Display*			/* dpy */,
+    int				/* screen */,
+    XF86VidModeModeInfo*	/* new modeline */,
+    XF86VidModeModeInfo*	/* after modeline */
+);
+
+Bool XF86VidModeDeleteModeLine(
+    Display*			/* dpy */,
+    int				/* screen */,
+    XF86VidModeModeInfo*	/* modeline */
+);
+
+Bool XF86VidModeModModeLine(
+    Display*			/* dpy */,
+    int				/* screen */,
+    XF86VidModeModeLine*	/* modeline */
+);
+
+Status XF86VidModeValidateModeLine(
+    Display*			/* dpy */,
+    int				/* screen */,
+    XF86VidModeModeInfo*	/* modeline */
+);
+
+Bool XF86VidModeSwitchMode(
+    Display*		/* dpy */,
+    int			/* screen */,
+    int			/* zoom */
+);
+
+Bool XF86VidModeSwitchToMode(
+    Display*			/* dpy */,
+    int				/* screen */,
+    XF86VidModeModeInfo*	/* modeline */
+);
+
+Bool XF86VidModeLockModeSwitch(
+    Display*		/* dpy */,
+    int			/* screen */,
+    int			/* lock */
+);
+
+Bool XF86VidModeGetMonitor(
+    Display*		/* dpy */,
+    int			/* screen */,
+    XF86VidModeMonitor*	/* monitor */
+);
+
+Bool XF86VidModeGetViewPort(
+    Display*		/* dpy */,
+    int			/* screen */,
+    int*		/* x return */,
+    int*		/* y return */
+);
+
+Bool XF86VidModeSetViewPort(
+    Display*		/* dpy */,
+    int			/* screen */,
+    int			/* x */,
+    int			/* y */
+);
+
+Bool XF86VidModeGetDotClocks(
+    Display*		/* dpy */,
+    int			/* screen */,
+    int*		/* flags return */,
+    int*		/* number of clocks return */,
+    int*		/* max dot clock return */,
+    int**		/* clocks return */
+);
+
+Bool XF86VidModeGetGamma(
+    Display*			/* dpy */,
+    int				/* screen */,
+    XF86VidModeGamma*		/* Gamma */
+);
+
+Bool XF86VidModeSetGamma(
+    Display*			/* dpy */,
+    int				/* screen */,
+    XF86VidModeGamma*		/* Gamma */
+);
+
+Bool XF86VidModeSetGammaRamp(
+    Display*                    /* dpy */,
+    int                         /* screen */,
+    int				/* size */,
+    unsigned short*             /* red array */,
+    unsigned short*             /* green array */,
+    unsigned short*             /* blue array */
+);
+
+Bool XF86VidModeGetGammaRamp(
+    Display*                    /* dpy */,
+    int                         /* screen */,
+    int                         /* size */,
+    unsigned short*             /* red array */,
+    unsigned short*             /* green array */,
+    unsigned short*             /* blue array */
+);
+
+Bool XF86VidModeGetGammaRampSize(
+    Display*                    /* dpy */,
+    int                         /* screen */,
+    int*                        /* size */
+);
+
+Bool XF86VidModeGetPermissions(
+    Display*                    /* dpy */,
+    int                         /* screen */,
+    int*			/* permissions */
+);
+
+_XFUNCPROTOEND
+
+#endif
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/xf86vmproto.h b/ThirdParty/X11/Include/X11/extensions/xf86vmproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..0d3955c41f1c504abc4ad2fc8872da038db20de0
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xf86vmproto.h
@@ -0,0 +1,583 @@
+/*
+
+Copyright 1995  Kaleb S. KEITHLEY
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES 
+OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of Kaleb S. KEITHLEY 
+shall not be used in advertising or otherwise to promote the sale, use 
+or other dealings in this Software without prior written authorization
+from Kaleb S. KEITHLEY
+
+*/
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
+
+#ifndef _XF86VIDMODEPROTO_H_
+#define _XF86VIDMODEPROTO_H_
+
+#include <X11/extensions/xf86vm.h>
+
+#define XF86VIDMODENAME "XFree86-VidModeExtension"
+
+#define XF86VIDMODE_MAJOR_VERSION	2	/* current version numbers */
+#define XF86VIDMODE_MINOR_VERSION	2
+
+#define X_XF86VidModeQueryVersion	0
+#define X_XF86VidModeGetModeLine	1
+#define X_XF86VidModeModModeLine	2
+#define X_XF86VidModeSwitchMode		3
+#define X_XF86VidModeGetMonitor		4
+#define X_XF86VidModeLockModeSwitch	5
+#define X_XF86VidModeGetAllModeLines	6
+#define X_XF86VidModeAddModeLine	7
+#define X_XF86VidModeDeleteModeLine	8
+#define X_XF86VidModeValidateModeLine	9
+#define X_XF86VidModeSwitchToMode	10
+#define X_XF86VidModeGetViewPort	11
+#define X_XF86VidModeSetViewPort	12
+/* new for version 2.x of this extension */
+#define X_XF86VidModeGetDotClocks	13
+#define X_XF86VidModeSetClientVersion	14
+#define X_XF86VidModeSetGamma		15
+#define X_XF86VidModeGetGamma		16
+#define X_XF86VidModeGetGammaRamp	17
+#define X_XF86VidModeSetGammaRamp	18
+#define X_XF86VidModeGetGammaRampSize	19
+#define X_XF86VidModeGetPermissions	20
+/*
+ * major version 0 == uses parameter-to-wire functions in XFree86 libXxf86vm.
+ * major version 1 == uses parameter-to-wire functions hard-coded in xvidtune
+ *                    client.
+ * major version 2 == uses new protocol version in XFree86 4.0.
+ */
+
+typedef struct _XF86VidModeQueryVersion {
+    CARD8	reqType;		/* always XF86VidModeReqCode */
+    CARD8	xf86vidmodeReqType;	/* always X_XF86VidModeQueryVersion */
+    CARD16	length B16;
+} xXF86VidModeQueryVersionReq;
+#define sz_xXF86VidModeQueryVersionReq	4
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	majorVersion B16;	/* major version of XF86VidMode */
+    CARD16	minorVersion B16;	/* minor version of XF86VidMode */
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xXF86VidModeQueryVersionReply;
+#define sz_xXF86VidModeQueryVersionReply	32
+
+typedef struct _XF86VidModeGetModeLine {
+    CARD8	reqType;		/* always XF86VidModeReqCode */
+    CARD8	xf86vidmodeReqType;
+    CARD16	length B16;
+    CARD16	screen B16;
+    CARD16	pad B16;
+} xXF86VidModeGetModeLineReq,
+  xXF86VidModeGetAllModeLinesReq,
+  xXF86VidModeGetMonitorReq,
+  xXF86VidModeGetViewPortReq,
+  xXF86VidModeGetDotClocksReq,
+  xXF86VidModeGetPermissionsReq;
+#define sz_xXF86VidModeGetModeLineReq		8
+#define sz_xXF86VidModeGetAllModeLinesReq	8
+#define sz_xXF86VidModeGetMonitorReq		8
+#define sz_xXF86VidModeGetViewPortReq		8
+#define sz_xXF86VidModeGetDotClocksReq		8
+#define sz_xXF86VidModeGetPermissionsReq	8
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	dotclock B32;
+    CARD16	hdisplay B16;
+    CARD16	hsyncstart B16;
+    CARD16	hsyncend B16;
+    CARD16	htotal B16;
+    CARD16	hskew B16;
+    CARD16	vdisplay B16;
+    CARD16	vsyncstart B16;
+    CARD16	vsyncend B16;
+    CARD16	vtotal B16;
+    CARD16	pad2 B16;
+    CARD32	flags B32;
+    CARD32	reserved1 B32;
+    CARD32	reserved2 B32;
+    CARD32	reserved3 B32;
+    CARD32	privsize B32;
+} xXF86VidModeGetModeLineReply;
+#define sz_xXF86VidModeGetModeLineReply	52
+
+/* 0.x version */
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	dotclock B32;
+    CARD16	hdisplay B16;
+    CARD16	hsyncstart B16;
+    CARD16	hsyncend B16;
+    CARD16	htotal B16;
+    CARD16	vdisplay B16;
+    CARD16	vsyncstart B16;
+    CARD16	vsyncend B16;
+    CARD16	vtotal B16;
+    CARD32	flags B32;
+    CARD32	privsize B32;
+} xXF86OldVidModeGetModeLineReply;
+#define sz_xXF86OldVidModeGetModeLineReply	36
+
+typedef struct {
+    CARD32	dotclock B32;
+    CARD16	hdisplay B16;
+    CARD16	hsyncstart B16;
+    CARD16	hsyncend B16;
+    CARD16	htotal B16;
+    CARD32	hskew B16;
+    CARD16	vdisplay B16;
+    CARD16	vsyncstart B16;
+    CARD16	vsyncend B16;
+    CARD16	vtotal B16;
+    CARD16	pad1 B16;
+    CARD32	flags B32;
+    CARD32	reserved1 B32;
+    CARD32	reserved2 B32;
+    CARD32	reserved3 B32;
+    CARD32	privsize B32;
+} xXF86VidModeModeInfo;
+
+/* 0.x version */
+typedef struct {
+    CARD32	dotclock B32;
+    CARD16	hdisplay B16;
+    CARD16	hsyncstart B16;
+    CARD16	hsyncend B16;
+    CARD16	htotal B16;
+    CARD16	vdisplay B16;
+    CARD16	vsyncstart B16;
+    CARD16	vsyncend B16;
+    CARD16	vtotal B16;
+    CARD32	flags B32;
+    CARD32	privsize B32;
+} xXF86OldVidModeModeInfo;
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	modecount B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xXF86VidModeGetAllModeLinesReply;
+#define sz_xXF86VidModeGetAllModeLinesReply	32
+
+typedef struct _XF86VidModeAddModeLine {
+    CARD8	reqType;		/* always XF86VidModeReqCode */
+    CARD8	xf86vidmodeReqType;	/* always X_XF86VidModeAddMode */
+    CARD16	length B16;
+    CARD32	screen B32;		/* could be CARD16 but need the pad */
+    CARD32	dotclock B32;
+    CARD16	hdisplay B16;
+    CARD16	hsyncstart B16;
+    CARD16	hsyncend B16;
+    CARD16	htotal B16;
+    CARD16	hskew B16;
+    CARD16	vdisplay B16;
+    CARD16	vsyncstart B16;
+    CARD16	vsyncend B16;
+    CARD16	vtotal B16;
+    CARD16	pad1 B16;
+    CARD32	flags B32;
+    CARD32	reserved1 B32;
+    CARD32	reserved2 B32;
+    CARD32	reserved3 B32;
+    CARD32	privsize B32;
+    CARD32	after_dotclock B32;
+    CARD16	after_hdisplay B16;
+    CARD16	after_hsyncstart B16;
+    CARD16	after_hsyncend B16;
+    CARD16	after_htotal B16;
+    CARD16	after_hskew B16;
+    CARD16	after_vdisplay B16;
+    CARD16	after_vsyncstart B16;
+    CARD16	after_vsyncend B16;
+    CARD16	after_vtotal B16;
+    CARD16	pad2 B16;
+    CARD32	after_flags B32;
+    CARD32	reserved4 B32;
+    CARD32	reserved5 B32;
+    CARD32	reserved6 B32;
+} xXF86VidModeAddModeLineReq;
+#define sz_xXF86VidModeAddModeLineReq	92
+
+/* 0.x version */
+typedef struct _XF86OldVidModeAddModeLine {
+    CARD8	reqType;		/* always XF86VidModeReqCode */
+    CARD8	xf86vidmodeReqType;	/* always X_XF86VidModeAddMode */
+    CARD16	length B16;
+    CARD32	screen B32;		/* could be CARD16 but need the pad */
+    CARD32	dotclock B32;
+    CARD16	hdisplay B16;
+    CARD16	hsyncstart B16;
+    CARD16	hsyncend B16;
+    CARD16	htotal B16;
+    CARD16	vdisplay B16;
+    CARD16	vsyncstart B16;
+    CARD16	vsyncend B16;
+    CARD16	vtotal B16;
+    CARD32	flags B32;
+    CARD32	privsize B32;
+    CARD32	after_dotclock B32;
+    CARD16	after_hdisplay B16;
+    CARD16	after_hsyncstart B16;
+    CARD16	after_hsyncend B16;
+    CARD16	after_htotal B16;
+    CARD16	after_vdisplay B16;
+    CARD16	after_vsyncstart B16;
+    CARD16	after_vsyncend B16;
+    CARD16	after_vtotal B16;
+    CARD32	after_flags B32;
+} xXF86OldVidModeAddModeLineReq;
+#define sz_xXF86OldVidModeAddModeLineReq	60
+
+typedef struct _XF86VidModeModModeLine {
+    CARD8	reqType;		/* always XF86VidModeReqCode */
+    CARD8	xf86vidmodeReqType;	/* always X_XF86VidModeModModeLine */
+    CARD16	length B16;
+    CARD32	screen B32;		/* could be CARD16 but need the pad */
+    CARD16	hdisplay B16;
+    CARD16	hsyncstart B16;
+    CARD16	hsyncend B16;
+    CARD16	htotal B16;
+    CARD16	hskew B16;
+    CARD16	vdisplay B16;
+    CARD16	vsyncstart B16;
+    CARD16	vsyncend B16;
+    CARD16	vtotal B16;
+    CARD16	pad1 B16;
+    CARD32	flags B32;
+    CARD32	reserved1 B32;
+    CARD32	reserved2 B32;
+    CARD32	reserved3 B32;
+    CARD32	privsize B32;
+} xXF86VidModeModModeLineReq;
+#define sz_xXF86VidModeModModeLineReq	48
+
+/* 0.x version */
+typedef struct _XF86OldVidModeModModeLine {
+    CARD8	reqType;		/* always XF86OldVidModeReqCode */
+    CARD8	xf86vidmodeReqType;	/* always X_XF86OldVidModeModModeLine */
+    CARD16	length B16;
+    CARD32	screen B32;		/* could be CARD16 but need the pad */
+    CARD16	hdisplay B16;
+    CARD16	hsyncstart B16;
+    CARD16	hsyncend B16;
+    CARD16	htotal B16;
+    CARD16	vdisplay B16;
+    CARD16	vsyncstart B16;
+    CARD16	vsyncend B16;
+    CARD16	vtotal B16;
+    CARD32	flags B32;
+    CARD32	privsize B32;
+} xXF86OldVidModeModModeLineReq;
+#define sz_xXF86OldVidModeModModeLineReq	32
+
+typedef struct _XF86VidModeValidateModeLine {
+    CARD8	reqType;		/* always XF86VidModeReqCode */
+    CARD8	xf86vidmodeReqType;
+    CARD16	length B16;
+    CARD32	screen B32;		/* could be CARD16 but need the pad */
+    CARD32	dotclock B32;
+    CARD16	hdisplay B16;
+    CARD16	hsyncstart B16;
+    CARD16	hsyncend B16;
+    CARD16	htotal B16;
+    CARD16	hskew B16;
+    CARD16	vdisplay B16;
+    CARD16	vsyncstart B16;
+    CARD16	vsyncend B16;
+    CARD16	vtotal B16;
+    CARD16	pad1 B16;
+    CARD32	flags B32;
+    CARD32	reserved1 B32;
+    CARD32	reserved2 B32;
+    CARD32	reserved3 B32;
+    CARD32	privsize B32;
+} xXF86VidModeDeleteModeLineReq,
+  xXF86VidModeValidateModeLineReq,
+  xXF86VidModeSwitchToModeReq;
+#define sz_xXF86VidModeDeleteModeLineReq	52
+#define sz_xXF86VidModeValidateModeLineReq	52
+#define sz_xXF86VidModeSwitchToModeReq		52
+
+/* 0.x version */
+typedef struct _XF86OldVidModeValidateModeLine {
+    CARD8	reqType;		/* always XF86OldVidModeReqCode */
+    CARD8	xf86vidmodeReqType;
+    CARD16	length B16;
+    CARD32	screen B32;		/* could be CARD16 but need the pad */
+    CARD32	dotclock B32;
+    CARD16	hdisplay B16;
+    CARD16	hsyncstart B16;
+    CARD16	hsyncend B16;
+    CARD16	htotal B16;
+    CARD16	vdisplay B16;
+    CARD16	vsyncstart B16;
+    CARD16	vsyncend B16;
+    CARD16	vtotal B16;
+    CARD32	flags B32;
+    CARD32	privsize B32;
+} xXF86OldVidModeDeleteModeLineReq,
+  xXF86OldVidModeValidateModeLineReq,
+  xXF86OldVidModeSwitchToModeReq;
+#define sz_xXF86OldVidModeDeleteModeLineReq	36
+#define sz_xXF86OldVidModeValidateModeLineReq	36
+#define sz_xXF86OldVidModeSwitchToModeReq	36
+
+typedef struct _XF86VidModeSwitchMode {
+    CARD8	reqType;		/* always XF86VidModeReqCode */
+    CARD8	xf86vidmodeReqType;	/* always X_XF86VidModeSwitchMode */
+    CARD16	length B16;
+    CARD16	screen B16;
+    CARD16	zoom B16;
+} xXF86VidModeSwitchModeReq;
+#define sz_xXF86VidModeSwitchModeReq	8
+
+typedef struct _XF86VidModeLockModeSwitch {
+    CARD8	reqType;		/* always XF86VidModeReqCode */
+    CARD8	xf86vidmodeReqType;	/* always X_XF86VidModeLockModeSwitch */
+    CARD16	length B16;
+    CARD16	screen B16;
+    CARD16	lock B16;
+} xXF86VidModeLockModeSwitchReq;
+#define sz_xXF86VidModeLockModeSwitchReq	8
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	status B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xXF86VidModeValidateModeLineReply;
+#define sz_xXF86VidModeValidateModeLineReply	32
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD8	vendorLength;
+    CARD8	modelLength;
+    CARD8	nhsync;
+    CARD8	nvsync;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xXF86VidModeGetMonitorReply;
+#define sz_xXF86VidModeGetMonitorReply	32
+
+typedef struct {
+    BYTE	type;
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	x B32;
+    CARD32	y B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xXF86VidModeGetViewPortReply;
+#define sz_xXF86VidModeGetViewPortReply	32
+
+typedef struct _XF86VidModeSetViewPort {
+    CARD8	reqType;		/* always VidModeReqCode */
+    CARD8	xf86vidmodeReqType;	/* always X_XF86VidModeSetViewPort */
+    CARD16	length B16;
+    CARD16	screen B16;
+    CARD16	pad B16;
+    CARD32      x B32;
+    CARD32	y B32;
+} xXF86VidModeSetViewPortReq;
+#define sz_xXF86VidModeSetViewPortReq	16
+
+typedef struct {
+    BYTE	type;
+    BOOL	pad1;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	flags B32;
+    CARD32	clocks B32;
+    CARD32	maxclocks B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+} xXF86VidModeGetDotClocksReply;
+#define sz_xXF86VidModeGetDotClocksReply	32
+
+typedef struct _XF86VidModeSetClientVersion {
+    CARD8	reqType;		/* always XF86VidModeReqCode */
+    CARD8	xf86vidmodeReqType;
+    CARD16	length B16;
+    CARD16	major B16;
+    CARD16	minor B16;
+} xXF86VidModeSetClientVersionReq;
+#define sz_xXF86VidModeSetClientVersionReq	8
+
+typedef struct _XF86VidModeGetGamma {
+    CARD8	reqType;		/* always XF86VidModeReqCode */
+    CARD8	xf86vidmodeReqType;
+    CARD16	length B16;
+    CARD16	screen B16;
+    CARD16	pad B16;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+    CARD32	pad6 B32;
+} xXF86VidModeGetGammaReq;
+#define sz_xXF86VidModeGetGammaReq		32
+
+typedef struct {
+    BYTE	type;
+    BOOL	pad;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	red B32;
+    CARD32	green B32;
+    CARD32	blue B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+} xXF86VidModeGetGammaReply;
+#define sz_xXF86VidModeGetGammaReply		32
+
+typedef struct _XF86VidModeSetGamma {
+    CARD8	reqType;		/* always XF86VidModeReqCode */
+    CARD8	xf86vidmodeReqType;
+    CARD16	length B16;
+    CARD16	screen B16;
+    CARD16	pad B16;
+    CARD32	red B32;
+    CARD32	green B32;
+    CARD32	blue B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+} xXF86VidModeSetGammaReq;
+#define sz_xXF86VidModeSetGammaReq		32
+
+
+typedef struct _XF86VidModeSetGammaRamp {
+    CARD8       reqType;                /* always XF86VidModeReqCode */
+    CARD8       xf86vidmodeReqType;
+    CARD16      length B16;
+    CARD16      screen B16;
+    CARD16      size B16;
+} xXF86VidModeSetGammaRampReq;
+#define sz_xXF86VidModeSetGammaRampReq             8 
+
+typedef struct _XF86VidModeGetGammaRamp {
+    CARD8       reqType;                /* always XF86VidModeReqCode */
+    CARD8       xf86vidmodeReqType;
+    CARD16      length B16;
+    CARD16      screen B16;
+    CARD16      size B16;
+} xXF86VidModeGetGammaRampReq;
+#define sz_xXF86VidModeGetGammaRampReq             8
+
+typedef struct {
+    BYTE        type;
+    BOOL        pad;
+    CARD16      sequenceNumber B16;
+    CARD32      length B32;
+    CARD16      size B16;
+    CARD16      pad0 B16;
+    CARD32      pad1 B32;
+    CARD32      pad2 B32;
+    CARD32      pad3 B32;
+    CARD32      pad4 B32;
+    CARD32      pad5 B32;
+} xXF86VidModeGetGammaRampReply;
+#define sz_xXF86VidModeGetGammaRampReply            32
+
+typedef struct _XF86VidModeGetGammaRampSize {
+    CARD8       reqType;                /* always XF86VidModeReqCode */
+    CARD8       xf86vidmodeReqType;
+    CARD16      length B16;
+    CARD16      screen B16;
+    CARD16      pad B16;
+} xXF86VidModeGetGammaRampSizeReq;
+#define sz_xXF86VidModeGetGammaRampSizeReq             8
+
+typedef struct {
+    BYTE        type;
+    BOOL        pad;
+    CARD16      sequenceNumber B16;
+    CARD32      length B32;
+    CARD16      size B16;
+    CARD16      pad0 B16;
+    CARD32      pad1 B32;
+    CARD32      pad2 B32;
+    CARD32      pad3 B32;
+    CARD32      pad4 B32;
+    CARD32      pad5 B32;
+} xXF86VidModeGetGammaRampSizeReply;
+#define sz_xXF86VidModeGetGammaRampSizeReply            32
+
+typedef struct {
+    BYTE        type;
+    BOOL        pad;
+    CARD16      sequenceNumber B16;
+    CARD32      length B32;
+    CARD32      permissions B32;
+    CARD32      pad1 B32;
+    CARD32      pad2 B32;
+    CARD32      pad3 B32;
+    CARD32      pad4 B32;
+    CARD32      pad5 B32;
+} xXF86VidModeGetPermissionsReply;
+#define sz_xXF86VidModeGetPermissionsReply            32
+
+
+#endif /* _XF86VIDMODEPROTO_H_ */
+
diff --git a/ThirdParty/X11/Include/X11/extensions/xf86vmstr.h b/ThirdParty/X11/Include/X11/extensions/xf86vmstr.h
new file mode 100644
index 0000000000000000000000000000000000000000..f521335b3c4f40ed87d205b8db68ce552c157249
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xf86vmstr.h
@@ -0,0 +1,3 @@
+#warning "xf86vmstr.h is obsolete and may be removed in the future."
+#warning "include <X11/extensions/xf86vmproto.h> for the protocol defines."
+#include <X11/extensions/xf86vmproto.h>
diff --git a/ThirdParty/X11/Include/X11/extensions/xfixesproto.h b/ThirdParty/X11/Include/X11/extensions/xfixesproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..fcf409a6e981373bd70a2619fbe1c1d7a1dcce5d
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xfixesproto.h
@@ -0,0 +1,551 @@
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2010 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+/*
+ * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _XFIXESPROTO_H_
+#define _XFIXESPROTO_H_
+
+#include <X11/Xmd.h>
+#include <X11/extensions/xfixeswire.h>
+#include <X11/extensions/shapeconst.h>
+
+#define Window CARD32
+#define Drawable CARD32
+#define Font CARD32
+#define Pixmap CARD32
+#define Cursor CARD32
+#define Colormap CARD32
+#define GContext CARD32
+#define Atom CARD32
+#define VisualID CARD32
+#define Time CARD32
+#define KeyCode CARD8
+#define KeySym CARD32
+#define Picture CARD32
+
+/*************** Version 1 ******************/
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+} xXFixesReq;
+
+/* 
+ * requests and replies
+ */
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    CARD32  majorVersion B32;
+    CARD32  minorVersion B32;
+} xXFixesQueryVersionReq;
+
+#define sz_xXFixesQueryVersionReq   12
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  majorVersion B32;
+    CARD32  minorVersion B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+} xXFixesQueryVersionReply;
+
+#define sz_xXFixesQueryVersionReply	32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    BYTE    mode;	    /* SetModeInsert/SetModeDelete*/
+    BYTE    target;	    /* SaveSetNearest/SaveSetRoot*/
+    BYTE    map;	    /* SaveSetMap/SaveSetUnmap */
+    BYTE    pad1;
+    Window  window;
+} xXFixesChangeSaveSetReq;
+
+#define sz_xXFixesChangeSaveSetReq	12
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Window  window  B32;
+    Atom    selection B32;
+    CARD32  eventMask B32;
+} xXFixesSelectSelectionInputReq;
+
+#define sz_xXFixesSelectSelectionInputReq   16
+
+typedef struct {
+    CARD8   type;
+    CARD8   subtype;
+    CARD16  sequenceNumber B16;
+    Window  window B32;
+    Window  owner B32;
+    Atom    selection B32;
+    Time    timestamp B32;
+    Time    selectionTimestamp B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+} xXFixesSelectionNotifyEvent;
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Window  window B32;
+    CARD32  eventMask B32;
+} xXFixesSelectCursorInputReq;
+
+#define sz_xXFixesSelectCursorInputReq	12
+
+typedef struct {
+    CARD8   type;
+    CARD8   subtype;
+    CARD16  sequenceNumber B16;
+    Window  window B32;
+    CARD32  cursorSerial B32;
+    Time    timestamp;
+    Atom    name B32;	    /* Version 2 */
+    CARD32  pad1 B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+} xXFixesCursorNotifyEvent;
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+} xXFixesGetCursorImageReq;
+
+#define sz_xXFixesGetCursorImageReq 4
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    INT16   x B16;
+    INT16   y B16;
+    CARD16  width B16;
+    CARD16  height B16;
+    CARD16  xhot B16;
+    CARD16  yhot B16;
+    CARD32  cursorSerial B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+} xXFixesGetCursorImageReply;
+
+#define sz_xXFixesGetCursorImageReply	32
+
+/*************** Version 2 ******************/
+
+#define Region CARD32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Region  region B32;
+    /* LISTofRECTANGLE */
+} xXFixesCreateRegionReq;
+
+#define sz_xXFixesCreateRegionReq	8
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Region  region B32;
+    Pixmap  bitmap B32;
+} xXFixesCreateRegionFromBitmapReq;
+
+#define sz_xXFixesCreateRegionFromBitmapReq	12
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Region  region B32;
+    Window  window B32;
+    CARD8   kind;
+    CARD8   pad1;
+    CARD16  pad2 B16;
+} xXFixesCreateRegionFromWindowReq;
+
+#define sz_xXFixesCreateRegionFromWindowReq	16
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Region  region B32;
+    GContext gc B32;
+} xXFixesCreateRegionFromGCReq;
+
+#define sz_xXFixesCreateRegionFromGCReq	12
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Region  region B32;
+    Picture picture B32;
+} xXFixesCreateRegionFromPictureReq;
+
+#define sz_xXFixesCreateRegionFromPictureReq	12
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Region  region B32;
+} xXFixesDestroyRegionReq;
+
+#define sz_xXFixesDestroyRegionReq	8
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Region  region B32;
+    /* LISTofRECTANGLE */
+} xXFixesSetRegionReq;
+
+#define sz_xXFixesSetRegionReq		8
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Region  source B32;
+    Region  destination B32;
+} xXFixesCopyRegionReq;
+
+#define sz_xXFixesCopyRegionReq		12
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Region  source1 B32;
+    Region  source2 B32;
+    Region  destination B32;
+} xXFixesCombineRegionReq,
+  xXFixesUnionRegionReq,
+  xXFixesIntersectRegionReq,
+  xXFixesSubtractRegionReq;
+
+#define sz_xXFixesCombineRegionReq	16
+#define sz_xXFixesUnionRegionReq	sz_xXFixesCombineRegionReq
+#define sz_xXFixesIntersectRegionReq	sz_xXFixesCombineRegionReq
+#define sz_xXFixesSubtractRegionReq	sz_xXFixesCombineRegionReq
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Region  source B32;
+    INT16   x B16, y B16;
+    CARD16  width B16, height B16;
+    Region  destination B32;
+} xXFixesInvertRegionReq;
+
+#define sz_xXFixesInvertRegionReq	20
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Region  region B32;
+    INT16   dx B16, dy B16;
+} xXFixesTranslateRegionReq;
+
+#define sz_xXFixesTranslateRegionReq	12
+    
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Region  source B32;
+    Region  destination B32;
+} xXFixesRegionExtentsReq;
+
+#define sz_xXFixesRegionExtentsReq	12
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Region  region B32;
+} xXFixesFetchRegionReq;
+
+#define sz_xXFixesFetchRegionReq	8
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    INT16   x B16, y B16;
+    CARD16  width B16, height B16;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+} xXFixesFetchRegionReply;
+
+#define sz_xXFixesFetchRegionReply	32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    GContext	gc B32;
+    Region  region B32;
+    INT16   xOrigin B16, yOrigin B16;
+} xXFixesSetGCClipRegionReq;
+
+#define sz_xXFixesSetGCClipRegionReq	16
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Window  dest;
+    BYTE    destKind;
+    CARD8   pad1;
+    CARD16  pad2 B16;
+    INT16   xOff B16, yOff B16;
+    Region  region;
+} xXFixesSetWindowShapeRegionReq;
+
+#define sz_xXFixesSetWindowShapeRegionReq	20
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Picture picture B32;
+    Region  region B32;
+    INT16   xOrigin B16, yOrigin B16;
+} xXFixesSetPictureClipRegionReq;
+
+#define sz_xXFixesSetPictureClipRegionReq   16
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Cursor  cursor B32;
+    CARD16  nbytes B16;
+    CARD16  pad B16;
+} xXFixesSetCursorNameReq;
+
+#define sz_xXFixesSetCursorNameReq	    12
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Cursor  cursor B32;
+} xXFixesGetCursorNameReq;
+
+#define sz_xXFixesGetCursorNameReq	    8
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    Atom    atom B32;
+    CARD16  nbytes B16;
+    CARD16  pad2 B16;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+    CARD32  pad6 B32;
+} xXFixesGetCursorNameReply;
+
+#define sz_xXFixesGetCursorNameReply	    32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+} xXFixesGetCursorImageAndNameReq;
+
+#define sz_xXFixesGetCursorImageAndNameReq  4
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    INT16   x B16;
+    INT16   y B16;
+    CARD16  width B16;
+    CARD16  height B16;
+    CARD16  xhot B16;
+    CARD16  yhot B16;
+    CARD32  cursorSerial B32;
+    Atom    cursorName B32;
+    CARD16  nbytes B16;
+    CARD16  pad B16;
+} xXFixesGetCursorImageAndNameReply;
+
+#define sz_xXFixesGetCursorImageAndNameReply	32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Cursor  source B32;
+    Cursor  destination B32;
+} xXFixesChangeCursorReq;
+
+#define sz_xXFixesChangeCursorReq	12
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Cursor  source B32;
+    CARD16  nbytes;
+    CARD16  pad;
+} xXFixesChangeCursorByNameReq;
+
+#define sz_xXFixesChangeCursorByNameReq	12
+
+/*************** Version 3 ******************/
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Region  source B32;
+    Region  destination B32;
+    CARD16  left B16;
+    CARD16  right B16;
+    CARD16  top B16;
+    CARD16  bottom B16;
+} xXFixesExpandRegionReq;
+
+#define sz_xXFixesExpandRegionReq	20
+
+/*************** Version 4.0 ******************/
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Window  window B32;
+} xXFixesHideCursorReq;
+
+#define sz_xXFixesHideCursorReq	sizeof(xXFixesHideCursorReq)
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Window  window B32;
+} xXFixesShowCursorReq;
+
+#define sz_xXFixesShowCursorReq	sizeof(xXFixesShowCursorReq)
+
+/*************** Version 5.0 ******************/
+
+#define Barrier CARD32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Barrier barrier B32;
+    Window  window B32;
+    INT16   x1 B16;
+    INT16   y1 B16;
+    INT16   x2 B16;
+    INT16   y2 B16;
+    CARD32  directions;
+    CARD16  pad B16;
+    CARD16  num_devices B16;
+    /* array of CARD16 devices */
+} xXFixesCreatePointerBarrierReq;
+
+#define sz_xXFixesCreatePointerBarrierReq 28
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   xfixesReqType;
+    CARD16  length B16;
+    Barrier barrier B32;
+} xXFixesDestroyPointerBarrierReq;
+
+#define sz_xXFixesDestroyPointerBarrierReq 8
+
+#undef Barrier
+#undef Region
+#undef Picture
+#undef Window
+#undef Drawable
+#undef Font
+#undef Pixmap
+#undef Cursor
+#undef Colormap
+#undef GContext
+#undef Atom
+#undef VisualID
+#undef Time
+#undef KeyCode
+#undef KeySym
+
+#endif /* _XFIXESPROTO_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/xfixeswire.h b/ThirdParty/X11/Include/X11/extensions/xfixeswire.h
new file mode 100644
index 0000000000000000000000000000000000000000..432349a9232a24cf861a9c0f8819850b82db2284
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xfixeswire.h
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2010 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+/*
+ * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+#ifndef _XFIXESWIRE_H_
+#define _XFIXESWIRE_H_
+
+#define XFIXES_NAME	"XFIXES"
+#define XFIXES_MAJOR	5
+#define XFIXES_MINOR	0
+
+/*************** Version 1 ******************/
+#define X_XFixesQueryVersion		    0
+#define X_XFixesChangeSaveSet		    1
+#define X_XFixesSelectSelectionInput	    2
+#define X_XFixesSelectCursorInput	    3
+#define X_XFixesGetCursorImage		    4
+/*************** Version 2 ******************/
+#define X_XFixesCreateRegion		    5
+#define X_XFixesCreateRegionFromBitmap	    6
+#define X_XFixesCreateRegionFromWindow	    7
+#define X_XFixesCreateRegionFromGC	    8
+#define X_XFixesCreateRegionFromPicture	    9
+#define X_XFixesDestroyRegion		    10
+#define X_XFixesSetRegion		    11
+#define X_XFixesCopyRegion		    12
+#define X_XFixesUnionRegion		    13
+#define X_XFixesIntersectRegion		    14
+#define X_XFixesSubtractRegion		    15
+#define X_XFixesInvertRegion		    16
+#define X_XFixesTranslateRegion		    17
+#define X_XFixesRegionExtents		    18
+#define X_XFixesFetchRegion		    19
+#define X_XFixesSetGCClipRegion		    20
+#define X_XFixesSetWindowShapeRegion	    21
+#define X_XFixesSetPictureClipRegion	    22
+#define X_XFixesSetCursorName		    23
+#define X_XFixesGetCursorName		    24
+#define X_XFixesGetCursorImageAndName	    25
+#define X_XFixesChangeCursor		    26
+#define X_XFixesChangeCursorByName	    27
+/*************** Version 3 ******************/
+#define X_XFixesExpandRegion		    28
+/*************** Version 4 ******************/
+#define X_XFixesHideCursor		    29
+#define X_XFixesShowCursor		    30
+/*************** Version 5 ******************/
+#define X_XFixesCreatePointerBarrier	    31
+#define X_XFixesDestroyPointerBarrier	    32
+
+#define XFixesNumberRequests		    (X_XFixesDestroyPointerBarrier+1)
+
+/* Selection events share one event number */
+#define XFixesSelectionNotify		    0
+
+/* Within the selection, the 'subtype' field distinguishes */
+#define XFixesSetSelectionOwnerNotify	    0
+#define XFixesSelectionWindowDestroyNotify  1
+#define XFixesSelectionClientCloseNotify    2
+
+#define XFixesSetSelectionOwnerNotifyMask	(1L << 0)
+#define XFixesSelectionWindowDestroyNotifyMask	(1L << 1)
+#define XFixesSelectionClientCloseNotifyMask	(1L << 2)
+
+/* There's only one cursor event so far */
+#define XFixesCursorNotify		    1
+
+#define XFixesDisplayCursorNotify	    0
+
+#define XFixesDisplayCursorNotifyMask	    (1L << 0)
+
+#define XFixesNumberEvents		    (2)
+
+/* errors */
+#define BadRegion			    0
+#define BadBarrier			    1
+#define XFixesNumberErrors		    (BadBarrier+1)
+
+#define SaveSetNearest			    0
+#define SaveSetRoot			    1
+
+#define SaveSetMap			    0
+#define SaveSetUnmap			    1
+
+/*************** Version 2 ******************/
+
+#define WindowRegionBounding		    0
+#define WindowRegionClip		    1
+
+/*************** Version 5 ******************/
+
+#define BarrierPositiveX		    (1L << 0)
+#define BarrierPositiveY		    (1L << 1)
+#define BarrierNegativeX		    (1L << 2)
+#define BarrierNegativeY		    (1L << 3)
+
+#endif	/* _XFIXESWIRE_H_ */
diff --git a/ThirdParty/X11/Include/X11/extensions/xtestconst.h b/ThirdParty/X11/Include/X11/extensions/xtestconst.h
new file mode 100644
index 0000000000000000000000000000000000000000..e74b9042ec2d25fb54e1458940e7d32536e5cc9f
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xtestconst.h
@@ -0,0 +1,41 @@
+/*
+
+Copyright 1992, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _XTEST_CONST_H_
+#define _XTEST_CONST_H_
+
+#define XTestNumberEvents	0
+
+#define XTestNumberErrors	0
+
+#define XTestCurrentCursor ((Cursor)1)
+
+#define XTestMajorVersion	2
+#define XTestMinorVersion	2
+
+#define XTestExtensionName	"XTEST"
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/extensions/xtestext1.h b/ThirdParty/X11/Include/X11/extensions/xtestext1.h
new file mode 100644
index 0000000000000000000000000000000000000000..67d015bb0ba78689b665ec3e3bea79407fdc01f4
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xtestext1.h
@@ -0,0 +1,98 @@
+/*
+ * xtestext1.h
+ *
+ * X11 Input Synthesis Extension include file
+ */
+
+/*
+
+
+Copyright 1986, 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett-Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+Hewlett-Packard makes no representations about the
+suitability of this software for any purpose.  It is provided
+"as is" without express or implied warranty.
+
+This software is not subject to any license of the American
+Telephone and Telegraph Company or of the Regents of the
+University of California.
+
+*/
+
+#ifndef _XTESTEXT1_H
+#define _XTESTEXT1_H
+/*
+ * the typedefs for CARD8, CARD16, and CARD32 are defined in Xmd.h
+ */
+
+#include <X11/extensions/xtestext1const.h>
+/*
+ * This is the definition for the input action host format event structure.
+ * This is the form that a client using this extension will see when
+ * it receives an input action event.
+ */
+typedef struct {
+        int     type;           /* always XTestInputActionType */
+	Display *display;
+	Window  window;
+        CARD8   actions[XTestACTIONS_SIZE];
+} XTestInputActionEvent;
+
+/*
+ * This is the definition for the xTestFakeAck host format event structure.
+ * This is the form that a client using this extension will see when
+ * it receives an XTestFakeAck event.
+ */
+typedef struct {
+        int     type;           /* always XTestFakeAckType */
+	Display *display;
+	Window  window;
+} XTestFakeAckEvent;
+
+_XFUNCPROTOBEGIN
+
+int XTestFakeInput(register Display *dpy, char *action_list_addr, int action_list_size, int ack_flag);
+int XTestGetInput(register Display *dpy, int action_handling);
+int XTestQueryInputSize(register Display *dpy, unsigned long *size_return);
+int XTestPressKey(Display *display, int device_id, unsigned long delay, unsigned int keycode, unsigned int key_action);
+int XTestPressButton(Display * display, int device_id, unsigned long delay, unsigned int button_number, unsigned int button_action);
+int XTestMovePointer(Display *display, int device_id, unsigned long delay[], int x[], int y[], unsigned int count);
+int XTestFlush(Display *display);
+int XTestStopInput(register Display *dpy);
+int XTestReset(register Display *dpy);
+
+_XFUNCPROTOEND
+
+#endif /* _XTESTEXT1_H */
diff --git a/ThirdParty/X11/Include/X11/extensions/xtestext1const.h b/ThirdParty/X11/Include/X11/extensions/xtestext1const.h
new file mode 100644
index 0000000000000000000000000000000000000000..656edc6ba15b68aa2fc92c4d20638d015483b05e
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xtestext1const.h
@@ -0,0 +1,160 @@
+/*
+ * xtestext1.h
+ *
+ * X11 Input Synthesis Extension include file
+ */
+
+/*
+
+
+Copyright 1986, 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett-Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+Hewlett-Packard makes no representations about the
+suitability of this software for any purpose.  It is provided
+"as is" without express or implied warranty.
+
+This software is not subject to any license of the American
+Telephone and Telegraph Company or of the Regents of the
+University of California.
+
+*/
+
+#ifndef _XTESTEXT1CONST_H
+#define _XTESTEXT1CONST_H 1
+
+#define XTestMAX_ACTION_LIST_SIZE       64
+#define XTestACTIONS_SIZE	28
+
+
+/*
+ * used in the XTestPressButton and XTestPressKey functions
+ */
+#define XTestPRESS                      1 << 0
+#define XTestRELEASE                    1 << 1
+#define XTestSTROKE                     1 << 2
+
+/*
+ * When doing a key or button stroke, the number of milliseconds
+ * to delay between the press and the release of a key or button
+ * in the XTestPressButton and XTestPressKey functions.
+ */
+
+#define XTestSTROKE_DELAY_TIME		10
+
+/*
+ * used in the XTestGetInput function
+ */
+#define XTestEXCLUSIVE                  1 << 0
+#define XTestPACKED_ACTIONS             1 << 1
+#define XTestPACKED_MOTION              1 << 2
+
+/*
+ * used in the XTestFakeInput function
+ */
+#define XTestFAKE_ACK_NOT_NEEDED        0
+#define XTestFAKE_ACK_REQUEST           1
+
+/*
+ * used in the XTest extension initialization routine
+ */
+#define XTestEXTENSION_NAME             "XTestExtension1"
+#define XTestEVENT_COUNT                2
+
+/*
+ * This is the definition for the format of the header byte
+ * in the input action structures.
+ */
+#define XTestACTION_TYPE_MASK   0x03    /* bits 0 and 1          */
+#define XTestKEY_STATE_MASK     0x04    /* bit 2 (key action)    */
+#define XTestX_SIGN_BIT_MASK    0x04    /* bit 2 (motion action) */
+#define XTestY_SIGN_BIT_MASK    0x08    /* bit 3 (motion action) */
+#define XTestDEVICE_ID_MASK     0xf0    /* bits 4 through 7      */
+
+#define XTestMAX_DEVICE_ID	0x0f
+#define XTestPackDeviceID(x)	(((x) & XTestMAX_DEVICE_ID) << 4)
+#define XTestUnpackDeviceID(x)	(((x) & XTestDEVICE_ID_MASK) >> 4)
+
+/*
+ * These are the possible action types.
+ */
+#define XTestDELAY_ACTION       0
+#define XTestKEY_ACTION         1
+#define XTestMOTION_ACTION      2
+#define XTestJUMP_ACTION        3
+
+/*
+ * These are the definitions for key/button motion input actions.
+ */
+#define XTestKEY_UP             0x04
+#define XTestKEY_DOWN           0x00
+
+/*
+ * These are the definitions for pointer relative motion input
+ * actions.
+ *
+ * The sign bits for the x and y relative motions are contained
+ * in the header byte.  The x and y relative motions are packed
+ * into one byte to make things fit in 32 bits.  If the relative
+ * motion range is larger than +/-15, use the pointer jump action.
+ */
+#define XTestMOTION_MAX            15
+#define XTestMOTION_MIN            -15
+
+#define XTestX_NEGATIVE            0x04
+#define XTestY_NEGATIVE            0x08
+
+#define XTestX_MOTION_MASK         0x0f
+#define XTestY_MOTION_MASK         0xf0
+
+#define XTestPackXMotionValue(x)   ((x) & XTestX_MOTION_MASK)
+#define XTestPackYMotionValue(x)   (((x) << 4) & XTestY_MOTION_MASK)
+
+#define XTestUnpackXMotionValue(x) ((x) & XTestX_MOTION_MASK)
+#define XTestUnpackYMotionValue(x) (((x) & XTestY_MOTION_MASK) >> 4)
+/*
+ * These are the definitions for a long delay input action.  It is
+ * used when more than XTestSHORT_DELAY_TIME milliseconds of delay
+ * (approximately one minute) is needed.
+ *
+ * The device ID for a delay is always set to XTestDELAY_DEVICE_ID.
+ * This guarantees that a header byte with a value of 0 is not
+ * a valid header, so it can be used as a flag to indicate that
+ * there are no more input actions in an XTestInputAction event.
+ */
+
+#define XTestSHORT_DELAY_TIME	0xffff
+#define XTestDELAY_DEVICE_ID    0x0f
+
+#endif /* _XTESTEXT1CONST_H */
diff --git a/ThirdParty/X11/Include/X11/extensions/xtestext1proto.h b/ThirdParty/X11/Include/X11/extensions/xtestext1proto.h
new file mode 100644
index 0000000000000000000000000000000000000000..e9bdee09f2a7867f32006251a65be5b34767e270
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xtestext1proto.h
@@ -0,0 +1,221 @@
+/*
+ * xtestext1.h
+ *
+ * X11 Input Synthesis Extension include file
+ */
+
+/*
+Copyright 1986, 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett-Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+Hewlett-Packard makes no representations about the
+suitability of this software for any purpose.  It is provided
+"as is" without express or implied warranty.
+
+This software is not subject to any license of the American
+Telephone and Telegraph Company or of the Regents of the
+University of California.
+
+*/
+
+#ifndef _XTESTEXT1PROTO_H
+#define _XTESTEXT1PROTO_H 1
+
+#include <X11/extensions/xtestext1const.h>
+
+/*
+ * the typedefs for CARD8, CARD16, and CARD32 are defined in Xmd.h
+ */
+
+/*
+ * XTest request type values
+ *
+ * used in the XTest extension protocol requests
+ */
+#define X_TestFakeInput                  1
+#define X_TestGetInput                   2
+#define X_TestStopInput                  3
+#define X_TestReset                      4
+#define X_TestQueryInputSize             5
+
+/*
+ * This defines the maximum size of a list of input actions
+ * to be sent to the server.  It should always be a multiple of
+ * 4 so that the entire xTestFakeInputReq structure size is a
+ * multiple of 4.
+ */
+
+typedef struct {
+        CARD8   reqType;        /* always XTestReqCode             */
+        CARD8   XTestReqType;   /* always X_TestFakeInput           */
+        CARD16  length B16;     /* 2 + XTestMAX_ACTION_LIST_SIZE/4 */
+        CARD32  ack B32;
+        CARD8   action_list[XTestMAX_ACTION_LIST_SIZE];
+} xTestFakeInputReq;
+#define sz_xTestFakeInputReq (XTestMAX_ACTION_LIST_SIZE + 8)
+
+typedef struct {
+        CARD8   reqType;        /* always XTestReqCode  */
+        CARD8   XTestReqType;   /* always X_TestGetInput */
+        CARD16  length B16;     /* 2                    */
+        CARD32  mode B32;
+} xTestGetInputReq;
+#define sz_xTestGetInputReq 8
+
+typedef struct {
+        CARD8   reqType;        /* always XTestReqCode   */
+        CARD8   XTestReqType;   /* always X_TestStopInput */
+        CARD16  length B32;     /* 1                     */
+} xTestStopInputReq;
+#define sz_xTestStopInputReq 4
+
+typedef struct {
+        CARD8   reqType;        /* always XTestReqCode */
+        CARD8   XTestReqType;   /* always X_TestReset   */
+        CARD16  length B16;     /* 1                   */
+} xTestResetReq;
+#define sz_xTestResetReq 4
+
+typedef struct {
+        CARD8   reqType;        /* always XTestReqCode        */
+        CARD8   XTestReqType;   /* always X_TestQueryInputSize */
+        CARD16  length B16;     /* 1                          */
+} xTestQueryInputSizeReq;
+#define sz_xTestQueryInputSizeReq 4
+
+/*
+ * This is the definition of the reply for the xTestQueryInputSize
+ * request.  It should remain the same minimum size as other replies
+ * (32 bytes).
+ */
+typedef struct {
+        CARD8   type;           /* always X_Reply  */
+        CARD8   pad1;
+        CARD16  sequenceNumber B16;
+        CARD32  length B32;     /* always 0 */
+        CARD32  size_return B32;
+        CARD32  pad2 B32;
+        CARD32  pad3 B32;
+        CARD32  pad4 B32;
+        CARD32  pad5 B32;
+        CARD32  pad6 B32;
+} xTestQueryInputSizeReply;
+
+/*
+ * This is the definition for the input action wire event structure.
+ * This event is sent to the client when the server has one or
+ * more user input actions to report to the client.  It must
+ * remain the same size as all other wire events (32 bytes).
+ */
+typedef struct {
+        CARD8   type;           /* always XTestInputActionType */
+        CARD8   pad00;
+        CARD16  sequenceNumber B16;
+        CARD8   actions[XTestACTIONS_SIZE];
+} xTestInputActionEvent;
+
+/*
+ * This is the definition for the xTestFakeAck wire event structure.
+ * This event is sent to the client when the server has completely
+ * processed its input action buffer, and is ready for more.
+ * It must remain the same size as all other wire events (32 bytes).
+ */
+typedef struct {
+        CARD8   type;           /* always XTestFakeAckType */
+        CARD8   pad00;
+        CARD16  sequenceNumber B16;
+        CARD32  pad02 B32;
+        CARD32  pad03 B32;
+        CARD32  pad04 B32;
+        CARD32  pad05 B32;
+        CARD32  pad06 B32;
+        CARD32  pad07 B32;
+        CARD32  pad08 B32;
+} xTestFakeAckEvent;
+
+/*
+ * These are the definitions for key/button motion input actions.
+ */
+typedef struct {
+        CARD8   header;         /* which device, key up/down */
+        CARD8   keycode;        /* which key/button to move  */
+        CARD16  delay_time B16; /* how long to delay (in ms) */
+} XTestKeyInfo;
+
+/*
+ * This is the definition for pointer jump input actions.
+ */
+typedef struct {
+        CARD8   header;         /* which pointer             */
+        CARD8   pad1;           /* unused padding byte       */
+        CARD16  jumpx B16;      /* x coord to jump to        */
+        CARD16  jumpy B16;      /* y coord to jump to        */
+        CARD16  delay_time B16; /* how long to delay (in ms) */
+} XTestJumpInfo;
+
+/*
+ * These are the definitions for pointer relative motion input
+ * actions.
+ *
+ * The sign bits for the x and y relative motions are contained
+ * in the header byte.  The x and y relative motions are packed
+ * into one byte to make things fit in 32 bits.  If the relative
+ * motion range is larger than +/-15, use the pointer jump action.
+ */
+
+typedef struct {
+        CARD8   header;         /* which pointer             */
+        CARD8   motion_data;    /* x,y relative motion       */
+        CARD16  delay_time B16; /* how long to delay (in ms) */
+} XTestMotionInfo;
+
+/*
+ * These are the definitions for a long delay input action.  It is
+ * used when more than XTestSHORT_DELAY_TIME milliseconds of delay
+ * (approximately one minute) is needed.
+ *
+ * The device ID for a delay is always set to XTestDELAY_DEVICE_ID.
+ * This guarantees that a header byte with a value of 0 is not
+ * a valid header, so it can be used as a flag to indicate that
+ * there are no more input actions in an XTestInputAction event.
+ */
+
+typedef struct {
+        CARD8   header;         /* always XTestDELAY_DEVICE_ID */
+        CARD8   pad1;           /* unused padding byte         */
+        CARD16  pad2 B16;       /* unused padding word         */
+        CARD32  delay_time B32; /* how long to delay (in ms)   */
+} XTestDelayInfo;
+
+#endif /* _XTESTEXT1PROTO_H */
diff --git a/ThirdParty/X11/Include/X11/extensions/xtestproto.h b/ThirdParty/X11/Include/X11/extensions/xtestproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..4f8db2652fe1e1cd92f9103280988a7cbac942c3
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/extensions/xtestproto.h
@@ -0,0 +1,124 @@
+/*
+
+Copyright 1992, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _XTESTPROTO_H_
+#define _XTESTPROTO_H_
+
+#include <X11/extensions/xtestconst.h>
+
+#define Window CARD32
+#define Time CARD32
+#define Cursor CARD32
+
+#define X_XTestGetVersion	0
+#define X_XTestCompareCursor	1
+#define X_XTestFakeInput	2
+#define X_XTestGrabControl	3
+
+typedef struct {
+    CARD8	reqType;	/* always XTestReqCode */
+    CARD8	xtReqType;	/* always X_XTestGetVersion */
+    CARD16	length B16;
+    CARD8	majorVersion;
+    CARD8	pad;
+    CARD16	minorVersion B16;
+} xXTestGetVersionReq;
+#define sz_xXTestGetVersionReq 8
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    CARD8	majorVersion;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	minorVersion B16;
+    CARD16	pad0 B16;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xXTestGetVersionReply;
+#define sz_xXTestGetVersionReply 32
+
+typedef struct {
+    CARD8	reqType;	/* always XTestReqCode */
+    CARD8	xtReqType;	/* always X_XTestCompareCursor */
+    CARD16	length B16;
+    Window	window B32;
+    Cursor	cursor B32;
+} xXTestCompareCursorReq;
+#define sz_xXTestCompareCursorReq 12
+
+typedef struct {
+    BYTE	type;			/* X_Reply */
+    BOOL	same;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD32	pad0 B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    CARD32	pad3 B32;
+    CARD32	pad4 B32;
+    CARD32	pad5 B32;
+} xXTestCompareCursorReply;
+#define sz_xXTestCompareCursorReply 32
+
+/* used only on the client side */
+typedef struct {
+    CARD8	reqType;	/* always XTestReqCode */
+    CARD8	xtReqType;	/* always X_XTestFakeInput */
+    CARD16	length B16;
+    BYTE	type;
+    BYTE	detail;
+    CARD16	pad0 B16;
+    Time	time B32;
+    Window	root B32;
+    CARD32	pad1 B32;
+    CARD32	pad2 B32;
+    INT16	rootX B16, rootY B16;
+    CARD32	pad3 B32;
+    CARD16	pad4 B16;
+    CARD8	pad5;
+    CARD8	deviceid;
+} xXTestFakeInputReq;
+#define sz_xXTestFakeInputReq 36
+
+typedef struct {
+    CARD8	reqType;	/* always XTestReqCode */
+    CARD8	xtReqType;	/* always X_XTestGrabControl */
+    CARD16	length B16;
+    BOOL	impervious;
+    CARD8	pad0;
+    CARD8	pad1;
+    CARD8	pad2;
+} xXTestGrabControlReq;
+#define sz_xXTestGrabControlReq 8
+
+#undef Window
+#undef Time
+#undef Cursor
+
+#endif /* _XTESTPROTO_H_ */
diff --git a/ThirdParty/X11/Include/X11/fonts/FS.h b/ThirdParty/X11/Include/X11/fonts/FS.h
new file mode 100644
index 0000000000000000000000000000000000000000..605b5a83131404fce4b1366c5538b2f36d0dff26
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/fonts/FS.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright 1990, 1991 Network Computing Devices;
+ * Portions Copyright 1987 by Digital Equipment Corporation 
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Network Computing Devices or Digital
+ * not be used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ * Network Computing Devices and Digital make no representations 
+ * about the suitability of this software for any purpose.  It is provided 
+ * "as is" without express or implied warranty.
+ *
+ * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
+ * OR DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+
+/*
+
+Portions Copyright 1987, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _FS_H_
+#define	_FS_H_
+
+#include <X11/Xdefs.h>
+#include <X11/fonts/fsmasks.h>
+
+#define	FS_PROTOCOL		2
+#define	FS_PROTOCOL_MINOR	0
+
+#ifndef X_PROTOCOL
+/* protocol familes */
+#define FamilyInternet          0
+#define FamilyDECnet            1
+#define FamilyChaos             2
+#define FamilyInternet6         6
+
+
+typedef unsigned int    FSDrawDirection;
+#endif
+
+#ifndef None
+#define	None		0L
+#endif
+
+#define	LeftToRightDrawDirection	0
+#define	RightToLeftDrawDirection	1
+
+/* font info flags */
+#define	FontInfoAllCharsExist		(1L << 0)
+#define	FontInfoInkInside		(1L << 1)
+#define	FontInfoHorizontalOverlap	(1L << 2)
+
+/* auth status flags */
+#define	AuthSuccess	0
+#define	AuthContinue	1
+#define	AuthBusy	2
+#define	AuthDenied	3
+
+/* property types */
+#define	PropTypeString		0
+#define	PropTypeUnsigned	1
+#define	PropTypeSigned		2
+
+#ifndef LSBFirst
+/* byte order */
+#define LSBFirst                0
+#define MSBFirst                1
+#endif
+
+/* event masks */
+#define	CatalogueChangeNotifyMask	(1L << 0)
+#define	FontChangeNotifyMask		(1L << 1)
+
+/* errors */
+#define	FSSuccess		-1
+#define	FSBadRequest		0
+#define	FSBadFormat		1
+#define	FSBadFont		2
+#define	FSBadRange		3
+#define	FSBadEventMask		4
+#define	FSBadAccessContext	5
+#define	FSBadIDChoice		6
+#define	FSBadName		7
+#define	FSBadResolution		8
+#define	FSBadAlloc		9
+#define	FSBadLength		10
+#define	FSBadImplementation	11
+
+#define	FirstExtensionError	128
+#define	LastExtensionError	255
+
+/* events */
+#define	KeepAlive		0
+#define	CatalogueChangeNotify	1
+#define	FontChangeNotify	2
+#define FSLASTEvent		3
+
+#endif				/* _FS_H_ */
diff --git a/ThirdParty/X11/Include/X11/fonts/FSproto.h b/ThirdParty/X11/Include/X11/fonts/FSproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..028156fba722d34277600bc43d8ae5a197487285
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/fonts/FSproto.h
@@ -0,0 +1,814 @@
+/*
+ 
+Copyright 1990, 1991, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+ * Copyright 1990, 1991 Network Computing Devices;
+ * Portions Copyright 1987 by Digital Equipment Corporation 
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Network Computing Devices, or Digital
+ * not be used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ *
+ * NETWORK COMPUTING DEVICES, AND DIGITAL DISCLAIM ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES,
+ * OR DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+
+#ifndef _FS_PROTO_H_
+#define _FS_PROTO_H_
+
+#include <X11/fonts/FS.h>
+
+#define sz_fsPropOffset 20
+#define sz_fsPropInfo 8
+#define sz_fsResolution 6
+
+#define sz_fsChar2b 2
+#define sz_fsChar2b_version1 2
+#define sz_fsOffset32 8
+#define sz_fsRange		4
+
+#define	sz_fsXCharInfo		12
+#define	sz_fsXFontInfoHeader		40
+
+#define	sz_fsConnClientPrefix	8
+#define	sz_fsConnSetup		12
+#define	sz_fsConnSetupExtra	8
+#define	sz_fsConnSetupAccept	12
+
+/* request sizes */
+#define	sz_fsReq		4
+#define	sz_fsListExtensionsReq	4
+#define	sz_fsResourceReq	8
+
+#define	sz_fsNoopReq			4
+#define	sz_fsListExtensionReq		4
+#define	sz_fsQueryExtensionReq		4
+#define	sz_fsListCataloguesReq		12
+#define	sz_fsSetCataloguesReq		4
+#define	sz_fsGetCataloguesReq		4
+#define	sz_fsSetEventMaskReq		8
+#define	sz_fsGetEventMaskReq		4
+#define	sz_fsCreateACReq		8
+#define	sz_fsFreeACReq			8
+#define	sz_fsSetAuthorizationReq	8
+#define	sz_fsSetResolutionReq		4
+#define	sz_fsGetResolutionReq		4
+#define	sz_fsListFontsReq		12
+#define	sz_fsListFontsWithXInfoReq	12
+#define	sz_fsOpenBitmapFontReq		16
+#define	sz_fsQueryXInfoReq		8
+#define	sz_fsQueryXExtents8Req		12
+#define	sz_fsQueryXExtents16Req		12
+#define	sz_fsQueryXBitmaps8Req		16
+#define	sz_fsQueryXBitmaps16Req		16
+#define	sz_fsCloseReq			8
+
+/* reply sizes */
+#define	sz_fsReply			8
+#define	sz_fsGenericReply		8
+
+#define	sz_fsListExtensionsReply	8
+#define	sz_fsQueryExtensionReply	20
+#define	sz_fsListCataloguesReply	16
+#define	sz_fsGetCataloguesReply		8
+#define	sz_fsGetEventMaskReply		12
+#define	sz_fsCreateACReply		12
+#define	sz_fsGetResolutionReply		8
+#define	sz_fsListFontsReply		16
+#define	sz_fsListFontsWithXInfoReply	(12 + sz_fsXFontInfoHeader)
+#define	sz_fsOpenBitmapFontReply	16
+#define	sz_fsQueryXInfoReply		(8 + sz_fsXFontInfoHeader)
+#define	sz_fsQueryXExtents8Reply	12
+#define	sz_fsQueryXExtents16Reply	12
+#define	sz_fsQueryXBitmaps8Reply	20
+#define	sz_fsQueryXBitmaps16Reply	20
+
+#define	sz_fsError		16
+#define	sz_fsEvent		12
+#define sz_fsKeepAliveEvent 	12
+
+#define	fsTrue	1
+#define	fsFalse	0
+
+/* temp decls */
+#define	Mask		CARD32
+#define	Font		CARD32
+#define	AccContext	CARD32
+
+typedef CARD32	fsTimestamp;
+
+#ifdef NOTDEF /* in fsmasks.h */
+typedef CARD32	fsBitmapFormat;
+typedef CARD32	fsBitmapFormatMask;
+#endif
+ 
+#define sz_fsBitmapFormat	4
+
+typedef struct {
+    INT16 	left B16,
+                right B16;
+    INT16 	width B16;
+    INT16 	ascent B16,
+                descent B16;
+    CARD16 	attributes B16;
+}           fsXCharInfo;
+
+typedef struct {
+    CARD8       high;
+    CARD8       low;
+}           fsChar2b;
+
+typedef struct {
+    CARD8       low;
+    CARD8       high;
+}           fsChar2b_version1;
+
+typedef struct {
+    CARD8	min_char_high;
+    CARD8	min_char_low;
+    CARD8	max_char_high;
+    CARD8	max_char_low;
+}           fsRange;
+
+typedef struct	{
+    CARD32	position B32;
+    CARD32	length B32;
+}	    fsOffset32;
+
+typedef struct {
+    fsOffset32	name;
+    fsOffset32	value;
+    CARD8 	type;
+    BYTE        pad0;
+    CARD16	pad1 B16;
+}           fsPropOffset;
+
+typedef struct {
+    CARD32	num_offsets B32;
+    CARD32	data_len B32;
+    /* offsets */
+    /* data */
+}	    fsPropInfo;
+
+typedef struct {
+    CARD16	x_resolution B16;
+    CARD16	y_resolution B16;
+    CARD16	point_size B16;
+}	    fsResolution;
+
+  
+typedef struct {
+    CARD32	flags B32;
+    CARD8	char_range_min_char_high;
+    CARD8	char_range_min_char_low;
+    CARD8	char_range_max_char_high;
+    CARD8	char_range_max_char_low;
+
+    CARD8	draw_direction;
+    CARD8	pad;
+    CARD8	default_char_high;
+    CARD8	default_char_low;
+    INT16	min_bounds_left B16;
+    INT16	min_bounds_right B16;
+
+    INT16	min_bounds_width B16;
+    INT16	min_bounds_ascent B16;
+    INT16	min_bounds_descent B16;
+    CARD16	min_bounds_attributes B16;
+
+    INT16	max_bounds_left B16;
+    INT16	max_bounds_right B16;
+    INT16	max_bounds_width B16;
+    INT16	max_bounds_ascent B16;
+
+    INT16	max_bounds_descent B16;
+    CARD16	max_bounds_attributes B16;
+    INT16	font_ascent B16;
+    INT16	font_descent B16;
+    /* propinfo */
+}           fsXFontInfoHeader;
+
+
+/* requests */
+
+typedef struct {
+    BYTE        byteOrder;
+    CARD8       num_auths;
+    CARD16 	major_version B16;
+    CARD16 	minor_version B16;
+    CARD16 	auth_len B16;
+    /* auth data */
+}           fsConnClientPrefix;
+
+typedef struct {
+    CARD16      status B16;
+    CARD16 	major_version B16;
+    CARD16 	minor_version B16;
+    CARD8	num_alternates;
+    CARD8	auth_index;
+    CARD16	alternate_len B16;
+    CARD16	auth_len B16;
+    /* alternates */
+    /* auth data */
+}           fsConnSetup;
+
+typedef struct {
+    CARD32	length B32;
+    CARD16      status B16;
+    CARD16	pad B16;
+    /* more auth data */
+}           fsConnSetupExtra;
+
+typedef struct {
+    CARD32	length B32;
+    CARD16	max_request_len B16;
+    CARD16	vendor_len B16;
+    CARD32	release_number B32;
+    /* vendor string */
+}	    fsConnSetupAccept;
+
+typedef struct {
+    CARD8       reqType;
+    CARD8       data;
+    CARD16 	length B16;
+}           fsReq;
+
+/*
+ * The fsFakeReq structure is never used in the protocol; it is prepended
+ * to incoming packets when setting up a connection so we can index
+ * through InitialVector.  To avoid alignment problems, it is padded
+ * to the size of a word on the largest machine this code runs on.
+ * Hence no sz_fsFakeReq constant is necessary.
+ */
+typedef struct {
+    CARD8       reqType;
+    CARD8       data;
+    CARD16 	length B16;
+    CARD32	pad B32;	/* to fill out to multiple of 64 bits */
+}           fsFakeReq;
+
+typedef struct {
+    CARD8       reqType;
+    BYTE        pad;
+    CARD16      length B16;
+    Font        id B32;
+}           fsResourceReq;
+
+typedef fsReq	fsNoopReq;
+typedef fsReq	fsListExtensionsReq;
+
+typedef struct {
+    CARD8       reqType;
+    BYTE        nbytes;
+    CARD16 	length B16;
+    /* name */
+}           fsQueryExtensionReq;
+
+typedef struct {
+    CARD8       reqType;
+    CARD8       data;
+    CARD16 	length B16;
+    CARD32 	maxNames B32;
+    CARD16 	nbytes B16;
+    CARD16 	pad2 B16;
+    /* pattern */
+}	    fsListCataloguesReq;
+
+typedef struct {
+    CARD8       reqType;
+    BYTE        num_catalogues;
+    CARD16 	length B16;
+    /* catalogues */
+}           fsSetCataloguesReq;
+
+typedef fsReq	fsGetCataloguesReq;
+
+typedef struct {
+    CARD8       reqType;
+    CARD8       ext_opcode;
+    CARD16 	length B16;
+    Mask	event_mask;
+}           fsSetEventMaskReq;
+
+typedef struct {
+    CARD8       reqType;
+    CARD8       ext_opcode;
+    CARD16 	length B16;
+}           fsGetEventMaskReq;
+
+typedef struct {
+    CARD8       reqType;
+    BYTE        num_auths;
+    CARD16      length B16;
+    AccContext  acid B32;
+    /* auth protocols */
+}           fsCreateACReq;
+
+typedef fsResourceReq	fsFreeACReq;
+typedef fsResourceReq	fsSetAuthorizationReq;
+
+typedef struct {
+    CARD8	reqType;
+    BYTE	num_resolutions;
+    CARD16	length B16;
+    /* resolutions */
+}	    fsSetResolutionReq;
+
+typedef fsReq	fsGetResolutionReq;
+
+typedef struct {
+    CARD8       reqType;
+    BYTE        pad;
+    CARD16 	length B16;
+    CARD32 	maxNames B32;
+    CARD16 	nbytes B16;
+    CARD16 	pad2 B16;
+    /* pattern */
+}           fsListFontsReq;
+
+typedef fsListFontsReq fsListFontsWithXInfoReq;
+
+typedef struct {
+    CARD8       reqType;
+    BYTE        pad;
+    CARD16 	length B16;
+    Font 	fid B32;
+    fsBitmapFormatMask format_mask B32;
+    fsBitmapFormat format_hint B32;
+    /* pattern */
+}           fsOpenBitmapFontReq;
+
+typedef fsResourceReq fsQueryXInfoReq;
+
+typedef struct {
+    CARD8       reqType;
+    BOOL        range;
+    CARD16 	length B16;
+    Font 	fid B32;
+    CARD32	num_ranges B32;
+    /* list of chars */
+}           fsQueryXExtents8Req;
+
+typedef fsQueryXExtents8Req	fsQueryXExtents16Req;
+
+typedef struct {
+    CARD8       reqType;
+    BOOL	range;
+    CARD16 	length B16;
+    Font 	fid B32;
+    fsBitmapFormat format B32;
+    CARD32	num_ranges B32;
+    /* list of chars */
+}           fsQueryXBitmaps8Req;
+
+typedef fsQueryXBitmaps8Req	fsQueryXBitmaps16Req;
+
+typedef fsResourceReq fsCloseReq;
+
+
+/* replies */
+typedef struct {
+    BYTE        type;
+    BYTE        data1;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+}           fsGenericReply;
+
+typedef struct {
+    BYTE        type;
+    CARD8       nExtensions;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    /* extension names */
+}           fsListExtensionsReply;
+
+typedef struct {
+    BYTE        type;
+    CARD8       present;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    CARD16	major_version B16;
+    CARD16	minor_version B16;
+    CARD8       major_opcode;
+    CARD8       first_event;
+    CARD8       num_events;
+    CARD8       first_error;
+    CARD8       num_errors;
+    CARD8	pad1;
+    CARD16	pad2 B16;
+}           fsQueryExtensionReply;
+
+typedef struct {
+    BYTE        type;
+    BYTE        pad;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    CARD32	num_replies B32;
+    CARD32	num_catalogues B32;
+    /* catalog names */
+}	    fsListCataloguesReply;
+
+typedef struct {
+    BYTE        type;
+    CARD8       num_catalogues;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    /* catalogue names */
+}           fsGetCataloguesReply;
+
+typedef struct {
+    BYTE        type;
+    BYTE        pad1;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    CARD32 	event_mask B32;
+}	    fsGetEventMaskReply;
+
+typedef struct {
+    BYTE	type;
+    CARD8	auth_index;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    CARD16	status B16;
+    CARD16	pad B16;
+    /* auth data */
+}	    fsCreateACReply;
+
+typedef struct {
+    CARD32	length B32;
+    CARD16	status B16;
+    CARD16	pad B16;
+    /* auth data */
+}	    fsCreateACExtraReply;
+
+typedef struct {
+    BYTE	type;
+    CARD8	num_resolutions;
+    CARD16	sequenceNumber B16;
+    CARD32	length B32;
+    /* resolutions */
+}	    fsGetResolutionReply;
+
+typedef struct {
+    BYTE        type;
+    BYTE        pad1;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    CARD32	following B32;
+    CARD32 	nFonts B32;
+    /* font names */
+}           fsListFontsReply;
+
+/*
+ * this one is messy.  the reply itself is variable length (unknown
+ * number of replies) and the contents of each is variable (unknown
+ * number of properties)
+ *
+ */
+
+typedef struct {
+    BYTE        type;
+    CARD8       nameLength;	/* 0 is end-of-reply */
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    CARD32 	nReplies B32;
+    CARD32	font_header_flags B32;
+    CARD8	font_hdr_char_range_min_char_high;
+    CARD8	font_hdr_char_range_min_char_low;
+    CARD8	font_hdr_char_range_max_char_high;
+    CARD8	font_hdr_char_range_max_char_low;
+    CARD8	font_header_draw_direction;
+    CARD8	font_header_pad;
+    CARD8	font_header_default_char_high;
+    CARD8	font_header_default_char_low;
+    INT16	font_header_min_bounds_left B16;
+    INT16	font_header_min_bounds_right B16;
+    INT16	font_header_min_bounds_width B16;
+    INT16	font_header_min_bounds_ascent B16;
+    INT16	font_header_min_bounds_descent B16;
+    CARD16	font_header_min_bounds_attributes B16;
+    INT16	font_header_max_bounds_left B16;
+    INT16	font_header_max_bounds_right B16;
+    INT16	font_header_max_bounds_width B16;
+    INT16	font_header_max_bounds_ascent B16;
+    INT16	font_header_max_bounds_descent B16;
+    CARD16	font_header_max_bounds_attributes B16;
+    INT16	font_header_font_ascent B16;
+    INT16	font_header_font_descent B16;
+    /* propinfo */
+    /* name */
+}           fsListFontsWithXInfoReply;
+    
+typedef struct {
+    BYTE        type;
+    CARD8       otherid_valid;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    CARD32	otherid B32;
+    BYTE	cachable;
+    BYTE	pad1;
+    CARD16	pad2 B16;
+}           fsOpenBitmapFontReply;
+
+typedef struct {
+    BYTE        type;
+    CARD8       pad0;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    CARD32	font_header_flags B32;
+    CARD8	font_hdr_char_range_min_char_high;
+    CARD8	font_hdr_char_range_min_char_low;
+    CARD8	font_hdr_char_range_max_char_high;
+    CARD8	font_hdr_char_range_max_char_low;
+    CARD8	font_header_draw_direction;
+    CARD8	font_header_pad;
+    CARD8	font_header_default_char_high;
+    CARD8	font_header_default_char_low;
+    INT16	font_header_min_bounds_left B16;
+    INT16	font_header_min_bounds_right B16;
+    INT16	font_header_min_bounds_width B16;
+    INT16	font_header_min_bounds_ascent B16;
+    INT16	font_header_min_bounds_descent B16;
+    CARD16	font_header_min_bounds_attributes B16;
+    INT16	font_header_max_bounds_left B16;
+    INT16	font_header_max_bounds_right B16;
+    INT16	font_header_max_bounds_width B16;
+    INT16	font_header_max_bounds_ascent B16;
+    INT16	font_header_max_bounds_descent B16;
+    CARD16	font_header_max_bounds_attributes B16;
+    INT16	font_header_font_ascent B16;
+    INT16	font_header_font_descent B16;
+    /* propinfo */
+}           fsQueryXInfoReply;
+
+typedef struct {
+    BYTE        type;
+    CARD8       pad0;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    CARD32      num_extents B32;
+    /* extents */
+}           fsQueryXExtents8Reply;
+
+typedef fsQueryXExtents8Reply	fsQueryXExtents16Reply;
+
+typedef struct {
+    BYTE        type;
+    CARD8       pad0;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    CARD32	replies_hint B32;
+    CARD32 	num_chars B32;
+    CARD32	nbytes B32;
+    /* offsets */
+    /* glyphs */
+}           fsQueryXBitmaps8Reply;
+
+typedef fsQueryXBitmaps8Reply	fsQueryXBitmaps16Reply;
+
+typedef union {
+    fsGenericReply generic;
+    fsListExtensionsReply extensions;
+    fsGetResolutionReply getres;
+}           fsReply;
+
+/* errors */
+typedef struct {
+    BYTE        type;
+    BYTE        request;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    fsTimestamp	timestamp;
+    CARD8	major_opcode;
+    CARD8	minor_opcode;
+    CARD16	pad B16;
+}	    fsError;
+
+typedef struct {
+    BYTE        type;
+    BYTE        request;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    fsTimestamp	timestamp;
+    CARD8	major_opcode;
+    CARD8	minor_opcode;
+    CARD16	pad B16;
+}	    fsRequestError;
+
+typedef struct {
+    BYTE        type;
+    BYTE        request;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    fsTimestamp	timestamp;
+    CARD8	major_opcode;
+    CARD8	minor_opcode;
+    CARD16	pad B16;
+    fsBitmapFormat	format B32;
+}	    fsFormatError;
+
+typedef struct {
+    BYTE        type;
+    BYTE        request;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    fsTimestamp	timestamp;
+    CARD8	major_opcode;
+    CARD8	minor_opcode;
+    CARD16	pad B16;
+    Font	fontid;
+}	    fsFontError;
+
+typedef struct {
+    BYTE        type;
+    BYTE        request;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    fsTimestamp	timestamp;
+    CARD8	major_opcode;
+    CARD8	minor_opcode;
+    CARD16	pad B16;
+    fsRange	range;
+}	    fsRangeError;
+
+typedef struct {
+    BYTE        type;
+    BYTE        request;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    fsTimestamp	timestamp;
+    CARD8	major_opcode;
+    CARD8	minor_opcode;
+    CARD16	pad B16;
+    Mask	event_mask;
+}	    fsEventMaskError;
+
+typedef struct {
+    BYTE        type;
+    BYTE        request;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    fsTimestamp	timestamp;
+    CARD8	major_opcode;
+    CARD8	minor_opcode;
+    CARD16	pad B16;
+    AccContext	acid;
+}	    fsAccessContextError;
+
+typedef struct {
+    BYTE        type;
+    BYTE        request;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    fsTimestamp	timestamp;
+    CARD8	major_opcode;
+    CARD8	minor_opcode;
+    CARD16	pad B16;
+    Font	fontid;
+}	    fsIDChoiceError;
+
+typedef struct {
+    BYTE        type;
+    BYTE        request;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    fsTimestamp	timestamp;
+    CARD8	major_opcode;
+    CARD8	minor_opcode;
+    CARD16	pad B16;
+}	    fsNameError;
+
+typedef struct {
+    BYTE        type;
+    BYTE        request;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    fsTimestamp	timestamp;
+    CARD8	major_opcode;
+    CARD8	minor_opcode;
+    fsResolution resolution;
+}	    fsResolutionError;
+
+typedef struct {
+    BYTE        type;
+    BYTE        request;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    fsTimestamp	timestamp;
+    CARD8	major_opcode;
+    CARD8	minor_opcode;
+    CARD16	pad B16;
+}	    fsAllocError;
+
+typedef struct {
+    BYTE        type;
+    BYTE        request;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    fsTimestamp	timestamp;
+    CARD8	major_opcode;
+    CARD8	minor_opcode;
+    CARD16	pad B16;
+    CARD32	bad_length B32;
+}	    fsLengthError;
+
+typedef struct {
+    BYTE        type;
+    BYTE        request;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    fsTimestamp	timestamp;
+    CARD8	major_opcode;
+    CARD8	minor_opcode;
+    CARD16	pad B16;
+}	    fsImplementationError;
+
+/* events */
+typedef struct {
+    BYTE        type;
+    BYTE        event_code;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    fsTimestamp	timestamp;
+}	    fsKeepAliveEvent;
+
+typedef struct {
+    BYTE        type;
+    BYTE        event_code;
+    CARD16 	sequenceNumber B16;
+    CARD32 	length B32;
+    fsTimestamp	timestamp;
+    BOOL	added;
+    BOOL	deleted;
+    CARD16	pad B16;
+}	    fsCatalogueChangeNotifyEvent;
+
+typedef fsCatalogueChangeNotifyEvent	fsFontChangeNotifyEvent;
+
+typedef fsCatalogueChangeNotifyEvent	fsEvent;
+
+/* reply codes */
+#define	FS_Reply		0	/* normal reply */
+#define	FS_Error		1	/* error */
+#define	FS_Event		2
+
+/* request codes */
+#define		FS_Noop			0
+#define		FS_ListExtensions	1
+#define		FS_QueryExtension	2
+#define		FS_ListCatalogues	3
+#define		FS_SetCatalogues	4
+#define		FS_GetCatalogues	5
+#define		FS_SetEventMask		6
+#define		FS_GetEventMask		7
+#define		FS_CreateAC		8
+#define		FS_FreeAC		9
+#define		FS_SetAuthorization	10
+#define		FS_SetResolution	11
+#define		FS_GetResolution	12
+#define		FS_ListFonts		13
+#define		FS_ListFontsWithXInfo	14
+#define		FS_OpenBitmapFont	15
+#define		FS_QueryXInfo		16
+#define		FS_QueryXExtents8	17
+#define		FS_QueryXExtents16	18
+#define		FS_QueryXBitmaps8	19
+#define		FS_QueryXBitmaps16	20
+#define		FS_CloseFont		21
+
+/* restore decls */
+#undef	Mask
+#undef	Font
+#undef  AccContext
+
+#endif				/* _FS_PROTO_H_ */
diff --git a/ThirdParty/X11/Include/X11/fonts/font.h b/ThirdParty/X11/Include/X11/fonts/font.h
new file mode 100644
index 0000000000000000000000000000000000000000..a8346558ba0347d8a9fb0a8da72d6eb52d4883a8
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/fonts/font.h
@@ -0,0 +1,166 @@
+/***********************************************************
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef FONT_H
+#define FONT_H
+
+#ifndef BitmapFormatByteOrderMask
+#include	"fsmasks.h"
+#endif
+
+/* data structures */
+#ifndef _XTYPEDEF_FONTPTR
+typedef struct _Font *FontPtr;
+#define _XTYPEDEF_FONTPTR
+#endif
+
+typedef struct _FontInfo *FontInfoPtr;
+typedef struct _FontProp *FontPropPtr;
+typedef struct _ExtentInfo *ExtentInfoPtr;
+typedef struct _FontPathElement *FontPathElementPtr;
+
+#ifndef _XTYPEDEF_CHARINFOPTR
+typedef struct _CharInfo *CharInfoPtr;
+#define _XTYPEDEF_CHARINFOPTR
+#endif
+
+typedef struct _FontNames *FontNamesPtr;
+typedef struct _FontResolution *FontResolutionPtr;
+
+#define NullCharInfo	((CharInfoPtr) 0)
+#define NullFont	((FontPtr) 0)
+#define NullFontInfo	((FontInfoPtr) 0)
+
+ /* draw direction */
+#define LeftToRight 0
+#define RightToLeft 1
+#define BottomToTop 2
+#define TopToBottom 3
+typedef int DrawDirection;
+
+#define NO_SUCH_CHAR	-1
+
+
+#define	FontAliasType	0x1000
+
+#define	AllocError	80
+#define	StillWorking	81
+#define	FontNameAlias	82
+#define	BadFontName	83
+#define	Suspended	84
+#define	Successful	85
+#define	BadFontPath	86
+#define	BadCharRange	87
+#define	BadFontFormat	88
+#define	FPEResetFailed	89	/* for when an FPE reset won't work */
+
+/* OpenFont flags */
+#define FontLoadInfo	0x0001
+#define FontLoadProps	0x0002
+#define FontLoadMetrics	0x0004
+#define FontLoadBitmaps	0x0008
+#define FontLoadAll	0x000f
+#define	FontOpenSync	0x0010
+#define FontReopen	0x0020
+
+/* Query flags */
+#define	LoadAll		0x1
+#define	FinishRamge	0x2
+#define       EightBitFont    0x4
+#define       SixteenBitFont  0x8
+
+/* Glyph Caching Modes */
+#define CACHING_OFF 0
+#define CACHE_16_BIT_GLYPHS 1
+#define CACHE_ALL_GLYPHS 2
+#define DEFAULT_GLYPH_CACHING_MODE CACHE_16_BIT_GLYPHS
+extern int glyphCachingMode;
+
+struct _Client;
+
+extern int StartListFontsWithInfo(
+    struct _Client * /*client*/,
+    int /*length*/,
+    unsigned char * /*pattern*/,
+    int /*max_names*/
+);
+
+extern FontNamesPtr MakeFontNamesRecord(
+    unsigned /* size */
+);
+
+extern void FreeFontNames(
+    FontNamesPtr /* pFN*/
+);
+
+extern int  AddFontNamesName(
+    FontNamesPtr /* names */,
+    char * /* name */,
+    int /* length */
+);
+
+#if 0 /* unused */
+extern int  FontToFSError();
+extern FontResolutionPtr GetClientResolution();
+#endif
+
+typedef struct _FontPatternCache    *FontPatternCachePtr;
+
+extern FontPatternCachePtr  MakeFontPatternCache (
+    void
+);
+
+extern void		    FreeFontPatternCache (
+    FontPatternCachePtr /* cache */
+);
+
+extern void		    EmptyFontPatternCache (
+    FontPatternCachePtr /* cache */
+);
+
+extern void		    CacheFontPattern (
+    FontPatternCachePtr /* cache */,
+    const char * /* pattern */,
+    int /* patlen */,
+    FontPtr /* pFont */
+);
+extern FontResolutionPtr GetClientResolutions(
+    int * /* num */
+);
+
+extern FontPtr		    FindCachedFontPattern (
+    FontPatternCachePtr /* cache */,
+    const char * /* pattern */,
+    int /* patlen */
+);
+
+extern void		    RemoveCachedFontPattern (
+    FontPatternCachePtr /* cache */,
+    FontPtr /* pFont */
+);
+
+typedef enum {
+    Linear8Bit, TwoD8Bit, Linear16Bit, TwoD16Bit
+}           FontEncoding;
+
+#endif				/* FONT_H */
diff --git a/ThirdParty/X11/Include/X11/fonts/fontproto.h b/ThirdParty/X11/Include/X11/fonts/fontproto.h
new file mode 100644
index 0000000000000000000000000000000000000000..490629e1d2757fcbec06060f7bc772311b61f4c3
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/fonts/fontproto.h
@@ -0,0 +1,91 @@
+/***********************************************************
+
+Copyright (c) 1999  The XFree86 Project Inc.
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The XFree86 Project
+Inc. shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from The XFree86 Project Inc..
+
+*/
+#ifndef _FONTPROTO_H
+#define _FONTPROTO_H
+
+/* Externally provided functions required by libXfont */
+
+extern int RegisterFPEFunctions ( NameCheckFunc name_func, 
+				  InitFpeFunc init_func, 
+				  FreeFpeFunc free_func, 
+				  ResetFpeFunc reset_func, 
+				  OpenFontFunc open_func, 
+				  CloseFontFunc close_func, 
+				  ListFontsFunc list_func, 
+				  StartLfwiFunc start_lfwi_func, 
+				  NextLfwiFunc next_lfwi_func, 
+				  WakeupFpeFunc wakeup_func, 
+				  ClientDiedFunc client_died, 
+				  LoadGlyphsFunc load_glyphs, 
+				  StartLaFunc start_list_alias_func, 
+				  NextLaFunc next_list_alias_func, 
+				  SetPathFunc set_path_func);
+
+extern int GetDefaultPointSize ( void );
+
+extern int init_fs_handlers ( FontPathElementPtr fpe, 
+			      BlockHandlerProcPtr block_handler);
+extern void remove_fs_handlers ( FontPathElementPtr fpe, 
+				 BlockHandlerProcPtr block_handler, 
+				 Bool all );
+
+extern int client_auth_generation ( ClientPtr client );
+
+#ifndef ___CLIENTSIGNAL_DEFINED___
+#define ___CLIENTSIGNAL_DEFINED___
+extern Bool ClientSignal ( ClientPtr client );
+#endif /* ___CLIENTSIGNAL_DEFINED___ */
+
+extern void DeleteFontClientID ( Font id );
+extern Font GetNewFontClientID ( void );
+extern int StoreFontClientFont ( FontPtr pfont, Font id );
+extern void FontFileRegisterFpeFunctions ( void );
+extern void FontFileCheckRegisterFpeFunctions ( void );
+
+extern Bool XpClientIsBitmapClient ( ClientPtr client );
+extern Bool XpClientIsPrintClient( ClientPtr client, FontPathElementPtr fpe );
+extern void PrinterFontRegisterFpeFunctions ( void );
+
+extern void fs_register_fpe_functions ( void );
+extern void check_fs_register_fpe_functions ( void );
+
+/* util/private.c */
+extern FontPtr  CreateFontRec (void);
+extern void  DestroyFontRec (FontPtr font);
+extern Bool     _FontSetNewPrivate (FontPtr        /* pFont */,
+				    int            /* n */,
+				    void *         /* ptr */);
+extern int      AllocateFontPrivateIndex (void);
+extern void ResetFontPrivateIndex (void);
+
+/* Type1/t1funcs.c */
+extern void Type1RegisterFontFileFunctions(void);
+extern void CIDRegisterFontFileFunctions(void);
+
+/* Speedo/spfuncs.c */
+extern void SpeedoRegisterFontFileFunctions(void);
+
+/* FreeType/ftfuncs.c */
+extern void FreeTypeRegisterFontFileFunctions(void);
+
+#endif
diff --git a/ThirdParty/X11/Include/X11/fonts/fontstruct.h b/ThirdParty/X11/Include/X11/fonts/fontstruct.h
new file mode 100644
index 0000000000000000000000000000000000000000..55c89daea7c8f3560a120279b5deb7b05705fb2c
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/fonts/fontstruct.h
@@ -0,0 +1,297 @@
+/***********************************************************
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef FONTSTR_H
+#define FONTSTR_H
+
+#include <X11/Xproto.h>
+#include "font.h"
+#include <X11/Xfuncproto.h>
+#include <X11/Xdefs.h>
+
+/*
+ * This version of the server font data strucutre is only for describing
+ * the in memory data structure. The file structure is not necessarily a
+ * copy of this. That is up to the compiler and the OS layer font loading
+ * machinery.
+ */
+
+#define GLYPHPADOPTIONS 4	/* 1, 2, 4, or 8 */
+
+typedef struct _FontProp {
+    long        name;
+    long        value;		/* assumes ATOM is not larger than INT32 */
+}           FontPropRec;
+
+typedef struct _FontResolution {
+    unsigned short x_resolution;
+    unsigned short y_resolution;
+    unsigned short point_size;
+}           FontResolutionRec;
+
+typedef struct _ExtentInfo {
+    DrawDirection drawDirection;
+    int         fontAscent;
+    int         fontDescent;
+    int         overallAscent;
+    int         overallDescent;
+    int         overallWidth;
+    int         overallLeft;
+    int         overallRight;
+}           ExtentInfoRec;
+
+typedef struct _CharInfo {
+    xCharInfo   metrics;	/* info preformatted for Queries */
+    char       *bits;		/* pointer to glyph image */
+}           CharInfoRec;
+
+/*
+ * Font is created at font load time. It is specific to a single encoding.
+ * e.g. not all of the glyphs in a font may be part of a single encoding.
+ */
+
+typedef struct _FontInfo {
+    unsigned short firstCol;
+    unsigned short lastCol;
+    unsigned short firstRow;
+    unsigned short lastRow;
+    unsigned short defaultCh;
+    unsigned int noOverlap:1;
+    unsigned int terminalFont:1;
+    unsigned int constantMetrics:1;
+    unsigned int constantWidth:1;
+    unsigned int inkInside:1;
+    unsigned int inkMetrics:1;
+    unsigned int allExist:1;
+    unsigned int drawDirection:2;
+    unsigned int cachable:1;
+    unsigned int anamorphic:1;
+    short       maxOverlap;
+    short       pad;
+    xCharInfo   maxbounds;
+    xCharInfo   minbounds;
+    xCharInfo   ink_maxbounds;
+    xCharInfo   ink_minbounds;
+    short       fontAscent;
+    short       fontDescent;
+    int         nprops;
+    FontPropPtr props;
+    char       *isStringProp;
+}           FontInfoRec;
+
+typedef struct _Font {
+    int         refcnt;
+    FontInfoRec info;
+    char        bit;
+    char        byte;
+    char        glyph;
+    char        scan;
+    fsBitmapFormat format;
+    int         (*get_glyphs) (FontPtr         /* font */,
+			       unsigned long   /* count */,
+			       unsigned char * /* chars */,
+			       FontEncoding    /* encoding */,
+			       unsigned long * /* count */,
+			       CharInfoPtr *   /* glyphs */);
+    int         (*get_metrics) (FontPtr         /* font */,
+				unsigned long   /* count */,
+				unsigned char * /* chars */,
+				FontEncoding    /* encoding */,
+				unsigned long * /* count */,
+				xCharInfo **    /* glyphs */);
+    void        (*unload_font) (FontPtr         /* font */);
+    void        (*unload_glyphs) (FontPtr         /* font */);
+    FontPathElementPtr fpe;
+    void        *svrPrivate;
+    void        *fontPrivate;
+    void        *fpePrivate;
+    int		maxPrivate;
+    void        **devPrivates;
+}           FontRec;
+
+#define FontGetPrivate(pFont,n) ((n) > (pFont)->maxPrivate ? (void *) 0 : \
+			     (pFont)->devPrivates[n])
+
+#define FontSetPrivate(pFont,n,ptr) ((n) > (pFont)->maxPrivate ? \
+			_FontSetNewPrivate (pFont, n, ptr) : \
+			((((pFont)->devPrivates[n] = (ptr)) != 0) || TRUE))
+
+typedef struct _FontNames {
+    int         nnames;
+    int         size;
+    int        *length;
+    char      **names;
+}           FontNamesRec;
+
+
+/* External view of font paths */
+typedef struct _FontPathElement {
+    int         name_length;
+#if FONT_PATH_ELEMENT_NAME_CONST
+    const
+#endif
+    char        *name;
+    int         type;
+    int         refcount;
+    void        *private;
+}           FontPathElementRec;
+
+typedef Bool (*NameCheckFunc) (const char *name);
+typedef int (*InitFpeFunc) (FontPathElementPtr fpe);
+typedef int (*FreeFpeFunc) (FontPathElementPtr fpe);
+typedef int (*ResetFpeFunc) (FontPathElementPtr fpe);
+typedef int (*OpenFontFunc) ( void *client,
+			      FontPathElementPtr fpe,
+			      Mask flags,
+			      const char* name,
+			      int namelen,
+			      fsBitmapFormat format,
+			      fsBitmapFormatMask fmask,
+			      XID id,
+			      FontPtr* pFont,
+			      char** aliasName,
+			      FontPtr non_cachable_font);
+typedef void (*CloseFontFunc) (FontPathElementPtr fpe, FontPtr pFont);
+typedef int (*ListFontsFunc) (void *client,
+			      FontPathElementPtr fpe,
+			      const char* pat,
+			      int len,
+			      int max,
+			      FontNamesPtr names);
+
+typedef int (*StartLfwiFunc) (void *client,
+			      FontPathElementPtr fpe,
+			      const char* pat,
+			      int len,
+			      int max,
+			      void ** privatep);
+
+typedef int (*NextLfwiFunc) (void *client,
+			     FontPathElementPtr fpe,
+			     char** name,
+			     int* namelen,
+			     FontInfoPtr* info,
+			     int* numFonts,
+			     void *private);
+
+typedef int (*WakeupFpeFunc) (FontPathElementPtr fpe,
+			      unsigned long* LastSelectMask);
+
+typedef void (*ClientDiedFunc) (void *client,
+			       FontPathElementPtr fpe);
+
+typedef int (*LoadGlyphsFunc) (void *client,
+			       FontPtr pfont,
+			       Bool range_flag,
+			       unsigned int nchars,
+			       int item_size,
+			       unsigned char* data);
+
+typedef int (*StartLaFunc) (void *client,
+			    FontPathElementPtr fpe,
+			    const char* pat,
+			    int len,
+			    int max,
+			    void ** privatep);
+
+typedef int (*NextLaFunc) (void *client,
+			   FontPathElementPtr fpe,
+			   char** namep,
+			   int* namelenp,
+			   char** resolvedp,
+			   int* resolvedlenp,
+			   void *private);
+
+typedef void (*SetPathFunc)(void);
+
+typedef struct _FPEFunctions {
+    NameCheckFunc       name_check;
+    InitFpeFunc 	init_fpe;
+    ResetFpeFunc	reset_fpe;
+    FreeFpeFunc         free_fpe;
+    OpenFontFunc        open_font;
+    CloseFontFunc       close_font;
+    ListFontsFunc       list_fonts;
+    StartLaFunc         start_list_fonts_and_aliases;
+    NextLaFunc          list_next_font_or_alias;
+    StartLfwiFunc       start_list_fonts_with_info;
+    NextLfwiFunc        list_next_font_with_info;
+    WakeupFpeFunc       wakeup_fpe;
+    ClientDiedFunc 	client_died;
+		/* for load_glyphs, range_flag = 0 ->
+			nchars = # of characters in data
+			item_size = bytes/char
+			data = list of characters
+		   range_flag = 1 ->
+			nchars = # of fsChar2b's in data
+			item_size is ignored
+			data = list of fsChar2b's */
+    LoadGlyphsFunc	load_glyphs;
+    SetPathFunc		set_path_hook;
+} FPEFunctionsRec, FPEFunctions;
+
+/*
+ * Various macros for computing values based on contents of
+ * the above structures
+ */
+
+#define	GLYPHWIDTHPIXELS(pci) \
+	((pci)->metrics.rightSideBearing - (pci)->metrics.leftSideBearing)
+
+#define	GLYPHHEIGHTPIXELS(pci) \
+ 	((pci)->metrics.ascent + (pci)->metrics.descent)
+
+#define	GLYPHWIDTHBYTES(pci)	(((GLYPHWIDTHPIXELS(pci))+7) >> 3)
+
+#define GLYPHWIDTHPADDED(bc)	(((bc)+7) & ~0x7)
+
+#define BYTES_PER_ROW(bits, nbytes) \
+	((nbytes) == 1 ? (((bits)+7)>>3)	/* pad to 1 byte */ \
+	:(nbytes) == 2 ? ((((bits)+15)>>3)&~1)	/* pad to 2 bytes */ \
+	:(nbytes) == 4 ? ((((bits)+31)>>3)&~3)	/* pad to 4 bytes */ \
+	:(nbytes) == 8 ? ((((bits)+63)>>3)&~7)	/* pad to 8 bytes */ \
+	: 0)
+
+#define BYTES_FOR_GLYPH(ci,pad)	(GLYPHHEIGHTPIXELS(ci) * \
+				 BYTES_PER_ROW(GLYPHWIDTHPIXELS(ci),pad))
+/*
+ * Macros for computing different bounding boxes for fonts; from
+ * the font protocol
+ */
+
+#define FONT_MAX_ASCENT(pi)	((pi)->fontAscent > (pi)->ink_maxbounds.ascent ? \
+			    (pi)->fontAscent : (pi)->ink_maxbounds.ascent)
+#define FONT_MAX_DESCENT(pi)	((pi)->fontDescent > (pi)->ink_maxbounds.descent ? \
+			    (pi)->fontDescent : (pi)->ink_maxbounds.descent)
+#define FONT_MAX_HEIGHT(pi)	(FONT_MAX_ASCENT(pi) + FONT_MAX_DESCENT(pi))
+#define FONT_MIN_LEFT(pi)	((pi)->ink_minbounds.leftSideBearing < 0 ? \
+			    (pi)->ink_minbounds.leftSideBearing : 0)
+#define FONT_MAX_RIGHT(pi)	((pi)->ink_maxbounds.rightSideBearing > \
+				(pi)->ink_maxbounds.characterWidth ? \
+			    (pi)->ink_maxbounds.rightSideBearing : \
+				(pi)->ink_maxbounds.characterWidth)
+#define FONT_MAX_WIDTH(pi)	(FONT_MAX_RIGHT(pi) - FONT_MIN_LEFT(pi))
+
+#include "fontproto.h"
+
+#endif				/* FONTSTR_H */
diff --git a/ThirdParty/X11/Include/X11/fonts/fsmasks.h b/ThirdParty/X11/Include/X11/fonts/fsmasks.h
new file mode 100644
index 0000000000000000000000000000000000000000..c86be830e1737f3eb4aa04d192c10486b2496e28
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/fonts/fsmasks.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright 1990, 1991 Network Computing Devices;
+ * Portions Copyright 1987 by Digital Equipment Corporation 
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Network Computing Devices or Digital
+ * not be used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ * Network Computing Devices and Digital make no representations 
+ * about the suitability of this software for any purpose.  It is provided 
+ * "as is" without express or implied warranty.
+ *
+ * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
+ * OR DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+
+/*
+
+Portions Copyright 1987, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+
+/*
+ * masks & values used by the font lib and the font server
+ */
+
+#ifndef _FSMASKS_H_
+#define _FSMASKS_H_
+
+#include <X11/Xmd.h>
+
+/* font format macros */
+#define BitmapFormatByteOrderMask       (1L << 0)
+#define BitmapFormatBitOrderMask        (1L << 1)
+#define BitmapFormatImageRectMask       (3L << 2)
+#define BitmapFormatScanlinePadMask     (3L << 8)
+#define BitmapFormatScanlineUnitMask    (3L << 12)
+
+#define BitmapFormatByteOrderLSB        (0)
+#define BitmapFormatByteOrderMSB        (1L << 0)
+#define BitmapFormatBitOrderLSB         (0)
+#define BitmapFormatBitOrderMSB         (1L << 1)
+
+#define BitmapFormatImageRectMin        (0L << 2)
+#define BitmapFormatImageRectMaxWidth   (1L << 2)
+#define BitmapFormatImageRectMax        (2L << 2)
+
+#define BitmapFormatScanlinePad8        (0L << 8)
+#define BitmapFormatScanlinePad16       (1L << 8)
+#define BitmapFormatScanlinePad32       (2L << 8)
+#define BitmapFormatScanlinePad64       (3L << 8)
+
+#define BitmapFormatScanlineUnit8       (0L << 12)
+#define BitmapFormatScanlineUnit16      (1L << 12)
+#define BitmapFormatScanlineUnit32      (2L << 12)
+#define BitmapFormatScanlineUnit64      (3L << 12)
+
+#define BitmapFormatMaskByte            (1L << 0)
+#define BitmapFormatMaskBit             (1L << 1)
+#define BitmapFormatMaskImageRectangle  (1L << 2)
+#define BitmapFormatMaskScanLinePad     (1L << 3)
+#define BitmapFormatMaskScanLineUnit    (1L << 4)
+
+typedef CARD32 fsBitmapFormat;
+typedef CARD32 fsBitmapFormatMask;
+
+#endif	/* _FSMASKS_H_ */
diff --git a/ThirdParty/X11/Include/X11/keysym.h b/ThirdParty/X11/Include/X11/keysym.h
new file mode 100644
index 0000000000000000000000000000000000000000..4f584886cbb135693eb8ec761e85963781434e0d
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/keysym.h
@@ -0,0 +1,74 @@
+/***********************************************************
+
+Copyright 1987, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/* default keysyms */
+#define XK_MISCELLANY
+#define XK_XKB_KEYS
+#define XK_LATIN1
+#define XK_LATIN2
+#define XK_LATIN3
+#define XK_LATIN4
+#define XK_LATIN8
+#define XK_LATIN9
+#define XK_CAUCASUS
+#define XK_GREEK
+#define XK_KATAKANA
+#define XK_ARABIC
+#define XK_CYRILLIC
+#define XK_HEBREW
+#define XK_THAI
+#define XK_KOREAN
+#define XK_ARMENIAN
+#define XK_GEORGIAN
+#define XK_VIETNAMESE
+#define XK_CURRENCY
+#define XK_MATHEMATICAL
+#define XK_BRAILLE
+#define XK_SINHALA
+
+#include <X11/keysymdef.h>
+
diff --git a/ThirdParty/X11/Include/X11/keysymdef.h b/ThirdParty/X11/Include/X11/keysymdef.h
new file mode 100644
index 0000000000000000000000000000000000000000..147ecf552968eb030769c41642b0e8a8850d1bf2
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/keysymdef.h
@@ -0,0 +1,2497 @@
+/***********************************************************
+Copyright 1987, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ * The "X11 Window System Protocol" standard defines in Appendix A the
+ * keysym codes. These 29-bit integer values identify characters or
+ * functions associated with each key (e.g., via the visible
+ * engraving) of a keyboard layout. This file assigns mnemonic macro
+ * names for these keysyms.
+ *
+ * This file is also compiled (by src/util/makekeys.c in libX11) into
+ * hash tables that can be accessed with X11 library functions such as
+ * XStringToKeysym() and XKeysymToString().
+ *
+ * Where a keysym corresponds one-to-one to an ISO 10646 / Unicode
+ * character, this is noted in a comment that provides both the U+xxxx
+ * Unicode position, as well as the official Unicode name of the
+ * character.
+ *
+ * Where the correspondence is either not one-to-one or semantically
+ * unclear, the Unicode position and name are enclosed in
+ * parentheses. Such legacy keysyms should be considered deprecated
+ * and are not recommended for use in future keyboard mappings.
+ *
+ * For any future extension of the keysyms with characters already
+ * found in ISO 10646 / Unicode, the following algorithm shall be
+ * used. The new keysym code position will simply be the character's
+ * Unicode number plus 0x01000000. The keysym values in the range
+ * 0x01000100 to 0x0110ffff are reserved to represent Unicode
+ * characters in the range U+0100 to U+10FFFF.
+ * 
+ * While most newer Unicode-based X11 clients do already accept
+ * Unicode-mapped keysyms in the range 0x01000100 to 0x0110ffff, it
+ * will remain necessary for clients -- in the interest of
+ * compatibility with existing servers -- to also understand the
+ * existing legacy keysym values in the range 0x0100 to 0x20ff.
+ *
+ * Where several mnemonic names are defined for the same keysym in this
+ * file, all but the first one listed should be considered deprecated.
+ *
+ * Mnemonic names for keysyms are defined in this file with lines
+ * that match one of these Perl regular expressions:
+ *
+ *    /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*\/\* U+([0-9A-F]{4,6}) (.*) \*\/\s*$/
+ *    /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*\/\*\(U+([0-9A-F]{4,6}) (.*)\)\*\/\s*$/
+ *    /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*(\/\*\s*(.*)\s*\*\/)?\s*$/
+ *
+ * Before adding new keysyms, please do consider the following: In
+ * addition to the keysym names defined in this file, the
+ * XStringToKeysym() and XKeysymToString() functions will also handle
+ * any keysym string of the form "U0020" to "U007E" and "U00A0" to
+ * "U10FFFF" for all possible Unicode characters. In other words,
+ * every possible Unicode character has already a keysym string
+ * defined algorithmically, even if it is not listed here. Therefore,
+ * defining an additional keysym macro is only necessary where a
+ * non-hexadecimal mnemonic name is needed, or where the new keysym
+ * does not represent any existing Unicode character.
+ *
+ * When adding new keysyms to this file, do not forget to also update the
+ * following as needed:
+ *
+ *   - the mappings in src/KeyBind.c in the repo
+ *     git://anongit.freedesktop.org/xorg/lib/libX11.git
+ *
+ *   - the protocol specification in specs/keysyms.xml
+ *     in the repo git://anongit.freedesktop.org/xorg/proto/x11proto.git
+ *
+ */
+
+#define XK_VoidSymbol                  0xffffff  /* Void symbol */
+
+#ifdef XK_MISCELLANY
+/*
+ * TTY function keys, cleverly chosen to map to ASCII, for convenience of
+ * programming, but could have been arbitrary (at the cost of lookup
+ * tables in client code).
+ */
+
+#define XK_BackSpace                     0xff08  /* Back space, back char */
+#define XK_Tab                           0xff09
+#define XK_Linefeed                      0xff0a  /* Linefeed, LF */
+#define XK_Clear                         0xff0b
+#define XK_Return                        0xff0d  /* Return, enter */
+#define XK_Pause                         0xff13  /* Pause, hold */
+#define XK_Scroll_Lock                   0xff14
+#define XK_Sys_Req                       0xff15
+#define XK_Escape                        0xff1b
+#define XK_Delete                        0xffff  /* Delete, rubout */
+
+
+
+/* International & multi-key character composition */
+
+#define XK_Multi_key                     0xff20  /* Multi-key character compose */
+#define XK_Codeinput                     0xff37
+#define XK_SingleCandidate               0xff3c
+#define XK_MultipleCandidate             0xff3d
+#define XK_PreviousCandidate             0xff3e
+
+/* Japanese keyboard support */
+
+#define XK_Kanji                         0xff21  /* Kanji, Kanji convert */
+#define XK_Muhenkan                      0xff22  /* Cancel Conversion */
+#define XK_Henkan_Mode                   0xff23  /* Start/Stop Conversion */
+#define XK_Henkan                        0xff23  /* Alias for Henkan_Mode */
+#define XK_Romaji                        0xff24  /* to Romaji */
+#define XK_Hiragana                      0xff25  /* to Hiragana */
+#define XK_Katakana                      0xff26  /* to Katakana */
+#define XK_Hiragana_Katakana             0xff27  /* Hiragana/Katakana toggle */
+#define XK_Zenkaku                       0xff28  /* to Zenkaku */
+#define XK_Hankaku                       0xff29  /* to Hankaku */
+#define XK_Zenkaku_Hankaku               0xff2a  /* Zenkaku/Hankaku toggle */
+#define XK_Touroku                       0xff2b  /* Add to Dictionary */
+#define XK_Massyo                        0xff2c  /* Delete from Dictionary */
+#define XK_Kana_Lock                     0xff2d  /* Kana Lock */
+#define XK_Kana_Shift                    0xff2e  /* Kana Shift */
+#define XK_Eisu_Shift                    0xff2f  /* Alphanumeric Shift */
+#define XK_Eisu_toggle                   0xff30  /* Alphanumeric toggle */
+#define XK_Kanji_Bangou                  0xff37  /* Codeinput */
+#define XK_Zen_Koho                      0xff3d  /* Multiple/All Candidate(s) */
+#define XK_Mae_Koho                      0xff3e  /* Previous Candidate */
+
+/* 0xff31 thru 0xff3f are under XK_KOREAN */
+
+/* Cursor control & motion */
+
+#define XK_Home                          0xff50
+#define XK_Left                          0xff51  /* Move left, left arrow */
+#define XK_Up                            0xff52  /* Move up, up arrow */
+#define XK_Right                         0xff53  /* Move right, right arrow */
+#define XK_Down                          0xff54  /* Move down, down arrow */
+#define XK_Prior                         0xff55  /* Prior, previous */
+#define XK_Page_Up                       0xff55
+#define XK_Next                          0xff56  /* Next */
+#define XK_Page_Down                     0xff56
+#define XK_End                           0xff57  /* EOL */
+#define XK_Begin                         0xff58  /* BOL */
+
+
+/* Misc functions */
+
+#define XK_Select                        0xff60  /* Select, mark */
+#define XK_Print                         0xff61
+#define XK_Execute                       0xff62  /* Execute, run, do */
+#define XK_Insert                        0xff63  /* Insert, insert here */
+#define XK_Undo                          0xff65
+#define XK_Redo                          0xff66  /* Redo, again */
+#define XK_Menu                          0xff67
+#define XK_Find                          0xff68  /* Find, search */
+#define XK_Cancel                        0xff69  /* Cancel, stop, abort, exit */
+#define XK_Help                          0xff6a  /* Help */
+#define XK_Break                         0xff6b
+#define XK_Mode_switch                   0xff7e  /* Character set switch */
+#define XK_script_switch                 0xff7e  /* Alias for mode_switch */
+#define XK_Num_Lock                      0xff7f
+
+/* Keypad functions, keypad numbers cleverly chosen to map to ASCII */
+
+#define XK_KP_Space                      0xff80  /* Space */
+#define XK_KP_Tab                        0xff89
+#define XK_KP_Enter                      0xff8d  /* Enter */
+#define XK_KP_F1                         0xff91  /* PF1, KP_A, ... */
+#define XK_KP_F2                         0xff92
+#define XK_KP_F3                         0xff93
+#define XK_KP_F4                         0xff94
+#define XK_KP_Home                       0xff95
+#define XK_KP_Left                       0xff96
+#define XK_KP_Up                         0xff97
+#define XK_KP_Right                      0xff98
+#define XK_KP_Down                       0xff99
+#define XK_KP_Prior                      0xff9a
+#define XK_KP_Page_Up                    0xff9a
+#define XK_KP_Next                       0xff9b
+#define XK_KP_Page_Down                  0xff9b
+#define XK_KP_End                        0xff9c
+#define XK_KP_Begin                      0xff9d
+#define XK_KP_Insert                     0xff9e
+#define XK_KP_Delete                     0xff9f
+#define XK_KP_Equal                      0xffbd  /* Equals */
+#define XK_KP_Multiply                   0xffaa
+#define XK_KP_Add                        0xffab
+#define XK_KP_Separator                  0xffac  /* Separator, often comma */
+#define XK_KP_Subtract                   0xffad
+#define XK_KP_Decimal                    0xffae
+#define XK_KP_Divide                     0xffaf
+
+#define XK_KP_0                          0xffb0
+#define XK_KP_1                          0xffb1
+#define XK_KP_2                          0xffb2
+#define XK_KP_3                          0xffb3
+#define XK_KP_4                          0xffb4
+#define XK_KP_5                          0xffb5
+#define XK_KP_6                          0xffb6
+#define XK_KP_7                          0xffb7
+#define XK_KP_8                          0xffb8
+#define XK_KP_9                          0xffb9
+
+
+
+/*
+ * Auxiliary functions; note the duplicate definitions for left and right
+ * function keys;  Sun keyboards and a few other manufacturers have such
+ * function key groups on the left and/or right sides of the keyboard.
+ * We've not found a keyboard with more than 35 function keys total.
+ */
+
+#define XK_F1                            0xffbe
+#define XK_F2                            0xffbf
+#define XK_F3                            0xffc0
+#define XK_F4                            0xffc1
+#define XK_F5                            0xffc2
+#define XK_F6                            0xffc3
+#define XK_F7                            0xffc4
+#define XK_F8                            0xffc5
+#define XK_F9                            0xffc6
+#define XK_F10                           0xffc7
+#define XK_F11                           0xffc8
+#define XK_L1                            0xffc8
+#define XK_F12                           0xffc9
+#define XK_L2                            0xffc9
+#define XK_F13                           0xffca
+#define XK_L3                            0xffca
+#define XK_F14                           0xffcb
+#define XK_L4                            0xffcb
+#define XK_F15                           0xffcc
+#define XK_L5                            0xffcc
+#define XK_F16                           0xffcd
+#define XK_L6                            0xffcd
+#define XK_F17                           0xffce
+#define XK_L7                            0xffce
+#define XK_F18                           0xffcf
+#define XK_L8                            0xffcf
+#define XK_F19                           0xffd0
+#define XK_L9                            0xffd0
+#define XK_F20                           0xffd1
+#define XK_L10                           0xffd1
+#define XK_F21                           0xffd2
+#define XK_R1                            0xffd2
+#define XK_F22                           0xffd3
+#define XK_R2                            0xffd3
+#define XK_F23                           0xffd4
+#define XK_R3                            0xffd4
+#define XK_F24                           0xffd5
+#define XK_R4                            0xffd5
+#define XK_F25                           0xffd6
+#define XK_R5                            0xffd6
+#define XK_F26                           0xffd7
+#define XK_R6                            0xffd7
+#define XK_F27                           0xffd8
+#define XK_R7                            0xffd8
+#define XK_F28                           0xffd9
+#define XK_R8                            0xffd9
+#define XK_F29                           0xffda
+#define XK_R9                            0xffda
+#define XK_F30                           0xffdb
+#define XK_R10                           0xffdb
+#define XK_F31                           0xffdc
+#define XK_R11                           0xffdc
+#define XK_F32                           0xffdd
+#define XK_R12                           0xffdd
+#define XK_F33                           0xffde
+#define XK_R13                           0xffde
+#define XK_F34                           0xffdf
+#define XK_R14                           0xffdf
+#define XK_F35                           0xffe0
+#define XK_R15                           0xffe0
+
+/* Modifiers */
+
+#define XK_Shift_L                       0xffe1  /* Left shift */
+#define XK_Shift_R                       0xffe2  /* Right shift */
+#define XK_Control_L                     0xffe3  /* Left control */
+#define XK_Control_R                     0xffe4  /* Right control */
+#define XK_Caps_Lock                     0xffe5  /* Caps lock */
+#define XK_Shift_Lock                    0xffe6  /* Shift lock */
+
+#define XK_Meta_L                        0xffe7  /* Left meta */
+#define XK_Meta_R                        0xffe8  /* Right meta */
+#define XK_Alt_L                         0xffe9  /* Left alt */
+#define XK_Alt_R                         0xffea  /* Right alt */
+#define XK_Super_L                       0xffeb  /* Left super */
+#define XK_Super_R                       0xffec  /* Right super */
+#define XK_Hyper_L                       0xffed  /* Left hyper */
+#define XK_Hyper_R                       0xffee  /* Right hyper */
+#endif /* XK_MISCELLANY */
+
+/*
+ * Keyboard (XKB) Extension function and modifier keys
+ * (from Appendix C of "The X Keyboard Extension: Protocol Specification")
+ * Byte 3 = 0xfe
+ */
+
+#ifdef XK_XKB_KEYS
+#define XK_ISO_Lock                      0xfe01
+#define XK_ISO_Level2_Latch              0xfe02
+#define XK_ISO_Level3_Shift              0xfe03
+#define XK_ISO_Level3_Latch              0xfe04
+#define XK_ISO_Level3_Lock               0xfe05
+#define XK_ISO_Level5_Shift              0xfe11
+#define XK_ISO_Level5_Latch              0xfe12
+#define XK_ISO_Level5_Lock               0xfe13
+#define XK_ISO_Group_Shift               0xff7e  /* Alias for mode_switch */
+#define XK_ISO_Group_Latch               0xfe06
+#define XK_ISO_Group_Lock                0xfe07
+#define XK_ISO_Next_Group                0xfe08
+#define XK_ISO_Next_Group_Lock           0xfe09
+#define XK_ISO_Prev_Group                0xfe0a
+#define XK_ISO_Prev_Group_Lock           0xfe0b
+#define XK_ISO_First_Group               0xfe0c
+#define XK_ISO_First_Group_Lock          0xfe0d
+#define XK_ISO_Last_Group                0xfe0e
+#define XK_ISO_Last_Group_Lock           0xfe0f
+
+#define XK_ISO_Left_Tab                  0xfe20
+#define XK_ISO_Move_Line_Up              0xfe21
+#define XK_ISO_Move_Line_Down            0xfe22
+#define XK_ISO_Partial_Line_Up           0xfe23
+#define XK_ISO_Partial_Line_Down         0xfe24
+#define XK_ISO_Partial_Space_Left        0xfe25
+#define XK_ISO_Partial_Space_Right       0xfe26
+#define XK_ISO_Set_Margin_Left           0xfe27
+#define XK_ISO_Set_Margin_Right          0xfe28
+#define XK_ISO_Release_Margin_Left       0xfe29
+#define XK_ISO_Release_Margin_Right      0xfe2a
+#define XK_ISO_Release_Both_Margins      0xfe2b
+#define XK_ISO_Fast_Cursor_Left          0xfe2c
+#define XK_ISO_Fast_Cursor_Right         0xfe2d
+#define XK_ISO_Fast_Cursor_Up            0xfe2e
+#define XK_ISO_Fast_Cursor_Down          0xfe2f
+#define XK_ISO_Continuous_Underline      0xfe30
+#define XK_ISO_Discontinuous_Underline   0xfe31
+#define XK_ISO_Emphasize                 0xfe32
+#define XK_ISO_Center_Object             0xfe33
+#define XK_ISO_Enter                     0xfe34
+
+#define XK_dead_grave                    0xfe50
+#define XK_dead_acute                    0xfe51
+#define XK_dead_circumflex               0xfe52
+#define XK_dead_tilde                    0xfe53
+#define XK_dead_perispomeni              0xfe53  /* alias for dead_tilde */
+#define XK_dead_macron                   0xfe54
+#define XK_dead_breve                    0xfe55
+#define XK_dead_abovedot                 0xfe56
+#define XK_dead_diaeresis                0xfe57
+#define XK_dead_abovering                0xfe58
+#define XK_dead_doubleacute              0xfe59
+#define XK_dead_caron                    0xfe5a
+#define XK_dead_cedilla                  0xfe5b
+#define XK_dead_ogonek                   0xfe5c
+#define XK_dead_iota                     0xfe5d
+#define XK_dead_voiced_sound             0xfe5e
+#define XK_dead_semivoiced_sound         0xfe5f
+#define XK_dead_belowdot                 0xfe60
+#define XK_dead_hook                     0xfe61
+#define XK_dead_horn                     0xfe62
+#define XK_dead_stroke                   0xfe63
+#define XK_dead_abovecomma               0xfe64
+#define XK_dead_psili                    0xfe64  /* alias for dead_abovecomma */
+#define XK_dead_abovereversedcomma       0xfe65
+#define XK_dead_dasia                    0xfe65  /* alias for dead_abovereversedcomma */
+#define XK_dead_doublegrave              0xfe66
+#define XK_dead_belowring                0xfe67
+#define XK_dead_belowmacron              0xfe68
+#define XK_dead_belowcircumflex          0xfe69
+#define XK_dead_belowtilde               0xfe6a
+#define XK_dead_belowbreve               0xfe6b
+#define XK_dead_belowdiaeresis           0xfe6c
+#define XK_dead_invertedbreve            0xfe6d
+#define XK_dead_belowcomma               0xfe6e
+#define XK_dead_currency                 0xfe6f
+
+/* extra dead elements for German T3 layout */
+#define XK_dead_lowline                  0xfe90
+#define XK_dead_aboveverticalline        0xfe91
+#define XK_dead_belowverticalline        0xfe92
+#define XK_dead_longsolidusoverlay       0xfe93
+
+/* dead vowels for universal syllable entry */
+#define XK_dead_a                        0xfe80
+#define XK_dead_A                        0xfe81
+#define XK_dead_e                        0xfe82
+#define XK_dead_E                        0xfe83
+#define XK_dead_i                        0xfe84
+#define XK_dead_I                        0xfe85
+#define XK_dead_o                        0xfe86
+#define XK_dead_O                        0xfe87
+#define XK_dead_u                        0xfe88
+#define XK_dead_U                        0xfe89
+#define XK_dead_small_schwa              0xfe8a
+#define XK_dead_capital_schwa            0xfe8b
+
+#define XK_dead_greek                    0xfe8c
+
+#define XK_First_Virtual_Screen          0xfed0
+#define XK_Prev_Virtual_Screen           0xfed1
+#define XK_Next_Virtual_Screen           0xfed2
+#define XK_Last_Virtual_Screen           0xfed4
+#define XK_Terminate_Server              0xfed5
+
+#define XK_AccessX_Enable                0xfe70
+#define XK_AccessX_Feedback_Enable       0xfe71
+#define XK_RepeatKeys_Enable             0xfe72
+#define XK_SlowKeys_Enable               0xfe73
+#define XK_BounceKeys_Enable             0xfe74
+#define XK_StickyKeys_Enable             0xfe75
+#define XK_MouseKeys_Enable              0xfe76
+#define XK_MouseKeys_Accel_Enable        0xfe77
+#define XK_Overlay1_Enable               0xfe78
+#define XK_Overlay2_Enable               0xfe79
+#define XK_AudibleBell_Enable            0xfe7a
+
+#define XK_Pointer_Left                  0xfee0
+#define XK_Pointer_Right                 0xfee1
+#define XK_Pointer_Up                    0xfee2
+#define XK_Pointer_Down                  0xfee3
+#define XK_Pointer_UpLeft                0xfee4
+#define XK_Pointer_UpRight               0xfee5
+#define XK_Pointer_DownLeft              0xfee6
+#define XK_Pointer_DownRight             0xfee7
+#define XK_Pointer_Button_Dflt           0xfee8
+#define XK_Pointer_Button1               0xfee9
+#define XK_Pointer_Button2               0xfeea
+#define XK_Pointer_Button3               0xfeeb
+#define XK_Pointer_Button4               0xfeec
+#define XK_Pointer_Button5               0xfeed
+#define XK_Pointer_DblClick_Dflt         0xfeee
+#define XK_Pointer_DblClick1             0xfeef
+#define XK_Pointer_DblClick2             0xfef0
+#define XK_Pointer_DblClick3             0xfef1
+#define XK_Pointer_DblClick4             0xfef2
+#define XK_Pointer_DblClick5             0xfef3
+#define XK_Pointer_Drag_Dflt             0xfef4
+#define XK_Pointer_Drag1                 0xfef5
+#define XK_Pointer_Drag2                 0xfef6
+#define XK_Pointer_Drag3                 0xfef7
+#define XK_Pointer_Drag4                 0xfef8
+#define XK_Pointer_Drag5                 0xfefd
+
+#define XK_Pointer_EnableKeys            0xfef9
+#define XK_Pointer_Accelerate            0xfefa
+#define XK_Pointer_DfltBtnNext           0xfefb
+#define XK_Pointer_DfltBtnPrev           0xfefc
+
+/* Single-Stroke Multiple-Character N-Graph Keysyms For The X Input Method */
+
+#define XK_ch                            0xfea0
+#define XK_Ch                            0xfea1
+#define XK_CH                            0xfea2
+#define XK_c_h                           0xfea3
+#define XK_C_h                           0xfea4
+#define XK_C_H                           0xfea5
+
+#endif /* XK_XKB_KEYS */
+
+/*
+ * 3270 Terminal Keys
+ * Byte 3 = 0xfd
+ */
+
+#ifdef XK_3270
+#define XK_3270_Duplicate                0xfd01
+#define XK_3270_FieldMark                0xfd02
+#define XK_3270_Right2                   0xfd03
+#define XK_3270_Left2                    0xfd04
+#define XK_3270_BackTab                  0xfd05
+#define XK_3270_EraseEOF                 0xfd06
+#define XK_3270_EraseInput               0xfd07
+#define XK_3270_Reset                    0xfd08
+#define XK_3270_Quit                     0xfd09
+#define XK_3270_PA1                      0xfd0a
+#define XK_3270_PA2                      0xfd0b
+#define XK_3270_PA3                      0xfd0c
+#define XK_3270_Test                     0xfd0d
+#define XK_3270_Attn                     0xfd0e
+#define XK_3270_CursorBlink              0xfd0f
+#define XK_3270_AltCursor                0xfd10
+#define XK_3270_KeyClick                 0xfd11
+#define XK_3270_Jump                     0xfd12
+#define XK_3270_Ident                    0xfd13
+#define XK_3270_Rule                     0xfd14
+#define XK_3270_Copy                     0xfd15
+#define XK_3270_Play                     0xfd16
+#define XK_3270_Setup                    0xfd17
+#define XK_3270_Record                   0xfd18
+#define XK_3270_ChangeScreen             0xfd19
+#define XK_3270_DeleteWord               0xfd1a
+#define XK_3270_ExSelect                 0xfd1b
+#define XK_3270_CursorSelect             0xfd1c
+#define XK_3270_PrintScreen              0xfd1d
+#define XK_3270_Enter                    0xfd1e
+#endif /* XK_3270 */
+
+/*
+ * Latin 1
+ * (ISO/IEC 8859-1 = Unicode U+0020..U+00FF)
+ * Byte 3 = 0
+ */
+#ifdef XK_LATIN1
+#define XK_space                         0x0020  /* U+0020 SPACE */
+#define XK_exclam                        0x0021  /* U+0021 EXCLAMATION MARK */
+#define XK_quotedbl                      0x0022  /* U+0022 QUOTATION MARK */
+#define XK_numbersign                    0x0023  /* U+0023 NUMBER SIGN */
+#define XK_dollar                        0x0024  /* U+0024 DOLLAR SIGN */
+#define XK_percent                       0x0025  /* U+0025 PERCENT SIGN */
+#define XK_ampersand                     0x0026  /* U+0026 AMPERSAND */
+#define XK_apostrophe                    0x0027  /* U+0027 APOSTROPHE */
+#define XK_quoteright                    0x0027  /* deprecated */
+#define XK_parenleft                     0x0028  /* U+0028 LEFT PARENTHESIS */
+#define XK_parenright                    0x0029  /* U+0029 RIGHT PARENTHESIS */
+#define XK_asterisk                      0x002a  /* U+002A ASTERISK */
+#define XK_plus                          0x002b  /* U+002B PLUS SIGN */
+#define XK_comma                         0x002c  /* U+002C COMMA */
+#define XK_minus                         0x002d  /* U+002D HYPHEN-MINUS */
+#define XK_period                        0x002e  /* U+002E FULL STOP */
+#define XK_slash                         0x002f  /* U+002F SOLIDUS */
+#define XK_0                             0x0030  /* U+0030 DIGIT ZERO */
+#define XK_1                             0x0031  /* U+0031 DIGIT ONE */
+#define XK_2                             0x0032  /* U+0032 DIGIT TWO */
+#define XK_3                             0x0033  /* U+0033 DIGIT THREE */
+#define XK_4                             0x0034  /* U+0034 DIGIT FOUR */
+#define XK_5                             0x0035  /* U+0035 DIGIT FIVE */
+#define XK_6                             0x0036  /* U+0036 DIGIT SIX */
+#define XK_7                             0x0037  /* U+0037 DIGIT SEVEN */
+#define XK_8                             0x0038  /* U+0038 DIGIT EIGHT */
+#define XK_9                             0x0039  /* U+0039 DIGIT NINE */
+#define XK_colon                         0x003a  /* U+003A COLON */
+#define XK_semicolon                     0x003b  /* U+003B SEMICOLON */
+#define XK_less                          0x003c  /* U+003C LESS-THAN SIGN */
+#define XK_equal                         0x003d  /* U+003D EQUALS SIGN */
+#define XK_greater                       0x003e  /* U+003E GREATER-THAN SIGN */
+#define XK_question                      0x003f  /* U+003F QUESTION MARK */
+#define XK_at                            0x0040  /* U+0040 COMMERCIAL AT */
+#define XK_A                             0x0041  /* U+0041 LATIN CAPITAL LETTER A */
+#define XK_B                             0x0042  /* U+0042 LATIN CAPITAL LETTER B */
+#define XK_C                             0x0043  /* U+0043 LATIN CAPITAL LETTER C */
+#define XK_D                             0x0044  /* U+0044 LATIN CAPITAL LETTER D */
+#define XK_E                             0x0045  /* U+0045 LATIN CAPITAL LETTER E */
+#define XK_F                             0x0046  /* U+0046 LATIN CAPITAL LETTER F */
+#define XK_G                             0x0047  /* U+0047 LATIN CAPITAL LETTER G */
+#define XK_H                             0x0048  /* U+0048 LATIN CAPITAL LETTER H */
+#define XK_I                             0x0049  /* U+0049 LATIN CAPITAL LETTER I */
+#define XK_J                             0x004a  /* U+004A LATIN CAPITAL LETTER J */
+#define XK_K                             0x004b  /* U+004B LATIN CAPITAL LETTER K */
+#define XK_L                             0x004c  /* U+004C LATIN CAPITAL LETTER L */
+#define XK_M                             0x004d  /* U+004D LATIN CAPITAL LETTER M */
+#define XK_N                             0x004e  /* U+004E LATIN CAPITAL LETTER N */
+#define XK_O                             0x004f  /* U+004F LATIN CAPITAL LETTER O */
+#define XK_P                             0x0050  /* U+0050 LATIN CAPITAL LETTER P */
+#define XK_Q                             0x0051  /* U+0051 LATIN CAPITAL LETTER Q */
+#define XK_R                             0x0052  /* U+0052 LATIN CAPITAL LETTER R */
+#define XK_S                             0x0053  /* U+0053 LATIN CAPITAL LETTER S */
+#define XK_T                             0x0054  /* U+0054 LATIN CAPITAL LETTER T */
+#define XK_U                             0x0055  /* U+0055 LATIN CAPITAL LETTER U */
+#define XK_V                             0x0056  /* U+0056 LATIN CAPITAL LETTER V */
+#define XK_W                             0x0057  /* U+0057 LATIN CAPITAL LETTER W */
+#define XK_X                             0x0058  /* U+0058 LATIN CAPITAL LETTER X */
+#define XK_Y                             0x0059  /* U+0059 LATIN CAPITAL LETTER Y */
+#define XK_Z                             0x005a  /* U+005A LATIN CAPITAL LETTER Z */
+#define XK_bracketleft                   0x005b  /* U+005B LEFT SQUARE BRACKET */
+#define XK_backslash                     0x005c  /* U+005C REVERSE SOLIDUS */
+#define XK_bracketright                  0x005d  /* U+005D RIGHT SQUARE BRACKET */
+#define XK_asciicircum                   0x005e  /* U+005E CIRCUMFLEX ACCENT */
+#define XK_underscore                    0x005f  /* U+005F LOW LINE */
+#define XK_grave                         0x0060  /* U+0060 GRAVE ACCENT */
+#define XK_quoteleft                     0x0060  /* deprecated */
+#define XK_a                             0x0061  /* U+0061 LATIN SMALL LETTER A */
+#define XK_b                             0x0062  /* U+0062 LATIN SMALL LETTER B */
+#define XK_c                             0x0063  /* U+0063 LATIN SMALL LETTER C */
+#define XK_d                             0x0064  /* U+0064 LATIN SMALL LETTER D */
+#define XK_e                             0x0065  /* U+0065 LATIN SMALL LETTER E */
+#define XK_f                             0x0066  /* U+0066 LATIN SMALL LETTER F */
+#define XK_g                             0x0067  /* U+0067 LATIN SMALL LETTER G */
+#define XK_h                             0x0068  /* U+0068 LATIN SMALL LETTER H */
+#define XK_i                             0x0069  /* U+0069 LATIN SMALL LETTER I */
+#define XK_j                             0x006a  /* U+006A LATIN SMALL LETTER J */
+#define XK_k                             0x006b  /* U+006B LATIN SMALL LETTER K */
+#define XK_l                             0x006c  /* U+006C LATIN SMALL LETTER L */
+#define XK_m                             0x006d  /* U+006D LATIN SMALL LETTER M */
+#define XK_n                             0x006e  /* U+006E LATIN SMALL LETTER N */
+#define XK_o                             0x006f  /* U+006F LATIN SMALL LETTER O */
+#define XK_p                             0x0070  /* U+0070 LATIN SMALL LETTER P */
+#define XK_q                             0x0071  /* U+0071 LATIN SMALL LETTER Q */
+#define XK_r                             0x0072  /* U+0072 LATIN SMALL LETTER R */
+#define XK_s                             0x0073  /* U+0073 LATIN SMALL LETTER S */
+#define XK_t                             0x0074  /* U+0074 LATIN SMALL LETTER T */
+#define XK_u                             0x0075  /* U+0075 LATIN SMALL LETTER U */
+#define XK_v                             0x0076  /* U+0076 LATIN SMALL LETTER V */
+#define XK_w                             0x0077  /* U+0077 LATIN SMALL LETTER W */
+#define XK_x                             0x0078  /* U+0078 LATIN SMALL LETTER X */
+#define XK_y                             0x0079  /* U+0079 LATIN SMALL LETTER Y */
+#define XK_z                             0x007a  /* U+007A LATIN SMALL LETTER Z */
+#define XK_braceleft                     0x007b  /* U+007B LEFT CURLY BRACKET */
+#define XK_bar                           0x007c  /* U+007C VERTICAL LINE */
+#define XK_braceright                    0x007d  /* U+007D RIGHT CURLY BRACKET */
+#define XK_asciitilde                    0x007e  /* U+007E TILDE */
+
+#define XK_nobreakspace                  0x00a0  /* U+00A0 NO-BREAK SPACE */
+#define XK_exclamdown                    0x00a1  /* U+00A1 INVERTED EXCLAMATION MARK */
+#define XK_cent                          0x00a2  /* U+00A2 CENT SIGN */
+#define XK_sterling                      0x00a3  /* U+00A3 POUND SIGN */
+#define XK_currency                      0x00a4  /* U+00A4 CURRENCY SIGN */
+#define XK_yen                           0x00a5  /* U+00A5 YEN SIGN */
+#define XK_brokenbar                     0x00a6  /* U+00A6 BROKEN BAR */
+#define XK_section                       0x00a7  /* U+00A7 SECTION SIGN */
+#define XK_diaeresis                     0x00a8  /* U+00A8 DIAERESIS */
+#define XK_copyright                     0x00a9  /* U+00A9 COPYRIGHT SIGN */
+#define XK_ordfeminine                   0x00aa  /* U+00AA FEMININE ORDINAL INDICATOR */
+#define XK_guillemotleft                 0x00ab  /* U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */
+#define XK_notsign                       0x00ac  /* U+00AC NOT SIGN */
+#define XK_hyphen                        0x00ad  /* U+00AD SOFT HYPHEN */
+#define XK_registered                    0x00ae  /* U+00AE REGISTERED SIGN */
+#define XK_macron                        0x00af  /* U+00AF MACRON */
+#define XK_degree                        0x00b0  /* U+00B0 DEGREE SIGN */
+#define XK_plusminus                     0x00b1  /* U+00B1 PLUS-MINUS SIGN */
+#define XK_twosuperior                   0x00b2  /* U+00B2 SUPERSCRIPT TWO */
+#define XK_threesuperior                 0x00b3  /* U+00B3 SUPERSCRIPT THREE */
+#define XK_acute                         0x00b4  /* U+00B4 ACUTE ACCENT */
+#define XK_mu                            0x00b5  /* U+00B5 MICRO SIGN */
+#define XK_paragraph                     0x00b6  /* U+00B6 PILCROW SIGN */
+#define XK_periodcentered                0x00b7  /* U+00B7 MIDDLE DOT */
+#define XK_cedilla                       0x00b8  /* U+00B8 CEDILLA */
+#define XK_onesuperior                   0x00b9  /* U+00B9 SUPERSCRIPT ONE */
+#define XK_masculine                     0x00ba  /* U+00BA MASCULINE ORDINAL INDICATOR */
+#define XK_guillemotright                0x00bb  /* U+00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */
+#define XK_onequarter                    0x00bc  /* U+00BC VULGAR FRACTION ONE QUARTER */
+#define XK_onehalf                       0x00bd  /* U+00BD VULGAR FRACTION ONE HALF */
+#define XK_threequarters                 0x00be  /* U+00BE VULGAR FRACTION THREE QUARTERS */
+#define XK_questiondown                  0x00bf  /* U+00BF INVERTED QUESTION MARK */
+#define XK_Agrave                        0x00c0  /* U+00C0 LATIN CAPITAL LETTER A WITH GRAVE */
+#define XK_Aacute                        0x00c1  /* U+00C1 LATIN CAPITAL LETTER A WITH ACUTE */
+#define XK_Acircumflex                   0x00c2  /* U+00C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX */
+#define XK_Atilde                        0x00c3  /* U+00C3 LATIN CAPITAL LETTER A WITH TILDE */
+#define XK_Adiaeresis                    0x00c4  /* U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS */
+#define XK_Aring                         0x00c5  /* U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE */
+#define XK_AE                            0x00c6  /* U+00C6 LATIN CAPITAL LETTER AE */
+#define XK_Ccedilla                      0x00c7  /* U+00C7 LATIN CAPITAL LETTER C WITH CEDILLA */
+#define XK_Egrave                        0x00c8  /* U+00C8 LATIN CAPITAL LETTER E WITH GRAVE */
+#define XK_Eacute                        0x00c9  /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */
+#define XK_Ecircumflex                   0x00ca  /* U+00CA LATIN CAPITAL LETTER E WITH CIRCUMFLEX */
+#define XK_Ediaeresis                    0x00cb  /* U+00CB LATIN CAPITAL LETTER E WITH DIAERESIS */
+#define XK_Igrave                        0x00cc  /* U+00CC LATIN CAPITAL LETTER I WITH GRAVE */
+#define XK_Iacute                        0x00cd  /* U+00CD LATIN CAPITAL LETTER I WITH ACUTE */
+#define XK_Icircumflex                   0x00ce  /* U+00CE LATIN CAPITAL LETTER I WITH CIRCUMFLEX */
+#define XK_Idiaeresis                    0x00cf  /* U+00CF LATIN CAPITAL LETTER I WITH DIAERESIS */
+#define XK_ETH                           0x00d0  /* U+00D0 LATIN CAPITAL LETTER ETH */
+#define XK_Eth                           0x00d0  /* deprecated */
+#define XK_Ntilde                        0x00d1  /* U+00D1 LATIN CAPITAL LETTER N WITH TILDE */
+#define XK_Ograve                        0x00d2  /* U+00D2 LATIN CAPITAL LETTER O WITH GRAVE */
+#define XK_Oacute                        0x00d3  /* U+00D3 LATIN CAPITAL LETTER O WITH ACUTE */
+#define XK_Ocircumflex                   0x00d4  /* U+00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX */
+#define XK_Otilde                        0x00d5  /* U+00D5 LATIN CAPITAL LETTER O WITH TILDE */
+#define XK_Odiaeresis                    0x00d6  /* U+00D6 LATIN CAPITAL LETTER O WITH DIAERESIS */
+#define XK_multiply                      0x00d7  /* U+00D7 MULTIPLICATION SIGN */
+#define XK_Oslash                        0x00d8  /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+#define XK_Ooblique                      0x00d8  /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+#define XK_Ugrave                        0x00d9  /* U+00D9 LATIN CAPITAL LETTER U WITH GRAVE */
+#define XK_Uacute                        0x00da  /* U+00DA LATIN CAPITAL LETTER U WITH ACUTE */
+#define XK_Ucircumflex                   0x00db  /* U+00DB LATIN CAPITAL LETTER U WITH CIRCUMFLEX */
+#define XK_Udiaeresis                    0x00dc  /* U+00DC LATIN CAPITAL LETTER U WITH DIAERESIS */
+#define XK_Yacute                        0x00dd  /* U+00DD LATIN CAPITAL LETTER Y WITH ACUTE */
+#define XK_THORN                         0x00de  /* U+00DE LATIN CAPITAL LETTER THORN */
+#define XK_Thorn                         0x00de  /* deprecated */
+#define XK_ssharp                        0x00df  /* U+00DF LATIN SMALL LETTER SHARP S */
+#define XK_agrave                        0x00e0  /* U+00E0 LATIN SMALL LETTER A WITH GRAVE */
+#define XK_aacute                        0x00e1  /* U+00E1 LATIN SMALL LETTER A WITH ACUTE */
+#define XK_acircumflex                   0x00e2  /* U+00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX */
+#define XK_atilde                        0x00e3  /* U+00E3 LATIN SMALL LETTER A WITH TILDE */
+#define XK_adiaeresis                    0x00e4  /* U+00E4 LATIN SMALL LETTER A WITH DIAERESIS */
+#define XK_aring                         0x00e5  /* U+00E5 LATIN SMALL LETTER A WITH RING ABOVE */
+#define XK_ae                            0x00e6  /* U+00E6 LATIN SMALL LETTER AE */
+#define XK_ccedilla                      0x00e7  /* U+00E7 LATIN SMALL LETTER C WITH CEDILLA */
+#define XK_egrave                        0x00e8  /* U+00E8 LATIN SMALL LETTER E WITH GRAVE */
+#define XK_eacute                        0x00e9  /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */
+#define XK_ecircumflex                   0x00ea  /* U+00EA LATIN SMALL LETTER E WITH CIRCUMFLEX */
+#define XK_ediaeresis                    0x00eb  /* U+00EB LATIN SMALL LETTER E WITH DIAERESIS */
+#define XK_igrave                        0x00ec  /* U+00EC LATIN SMALL LETTER I WITH GRAVE */
+#define XK_iacute                        0x00ed  /* U+00ED LATIN SMALL LETTER I WITH ACUTE */
+#define XK_icircumflex                   0x00ee  /* U+00EE LATIN SMALL LETTER I WITH CIRCUMFLEX */
+#define XK_idiaeresis                    0x00ef  /* U+00EF LATIN SMALL LETTER I WITH DIAERESIS */
+#define XK_eth                           0x00f0  /* U+00F0 LATIN SMALL LETTER ETH */
+#define XK_ntilde                        0x00f1  /* U+00F1 LATIN SMALL LETTER N WITH TILDE */
+#define XK_ograve                        0x00f2  /* U+00F2 LATIN SMALL LETTER O WITH GRAVE */
+#define XK_oacute                        0x00f3  /* U+00F3 LATIN SMALL LETTER O WITH ACUTE */
+#define XK_ocircumflex                   0x00f4  /* U+00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX */
+#define XK_otilde                        0x00f5  /* U+00F5 LATIN SMALL LETTER O WITH TILDE */
+#define XK_odiaeresis                    0x00f6  /* U+00F6 LATIN SMALL LETTER O WITH DIAERESIS */
+#define XK_division                      0x00f7  /* U+00F7 DIVISION SIGN */
+#define XK_oslash                        0x00f8  /* U+00F8 LATIN SMALL LETTER O WITH STROKE */
+#define XK_ooblique                      0x00f8  /* U+00F8 LATIN SMALL LETTER O WITH STROKE */
+#define XK_ugrave                        0x00f9  /* U+00F9 LATIN SMALL LETTER U WITH GRAVE */
+#define XK_uacute                        0x00fa  /* U+00FA LATIN SMALL LETTER U WITH ACUTE */
+#define XK_ucircumflex                   0x00fb  /* U+00FB LATIN SMALL LETTER U WITH CIRCUMFLEX */
+#define XK_udiaeresis                    0x00fc  /* U+00FC LATIN SMALL LETTER U WITH DIAERESIS */
+#define XK_yacute                        0x00fd  /* U+00FD LATIN SMALL LETTER Y WITH ACUTE */
+#define XK_thorn                         0x00fe  /* U+00FE LATIN SMALL LETTER THORN */
+#define XK_ydiaeresis                    0x00ff  /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+#endif /* XK_LATIN1 */
+
+/*
+ * Latin 2
+ * Byte 3 = 1
+ */
+
+#ifdef XK_LATIN2
+#define XK_Aogonek                       0x01a1  /* U+0104 LATIN CAPITAL LETTER A WITH OGONEK */
+#define XK_breve                         0x01a2  /* U+02D8 BREVE */
+#define XK_Lstroke                       0x01a3  /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+#define XK_Lcaron                        0x01a5  /* U+013D LATIN CAPITAL LETTER L WITH CARON */
+#define XK_Sacute                        0x01a6  /* U+015A LATIN CAPITAL LETTER S WITH ACUTE */
+#define XK_Scaron                        0x01a9  /* U+0160 LATIN CAPITAL LETTER S WITH CARON */
+#define XK_Scedilla                      0x01aa  /* U+015E LATIN CAPITAL LETTER S WITH CEDILLA */
+#define XK_Tcaron                        0x01ab  /* U+0164 LATIN CAPITAL LETTER T WITH CARON */
+#define XK_Zacute                        0x01ac  /* U+0179 LATIN CAPITAL LETTER Z WITH ACUTE */
+#define XK_Zcaron                        0x01ae  /* U+017D LATIN CAPITAL LETTER Z WITH CARON */
+#define XK_Zabovedot                     0x01af  /* U+017B LATIN CAPITAL LETTER Z WITH DOT ABOVE */
+#define XK_aogonek                       0x01b1  /* U+0105 LATIN SMALL LETTER A WITH OGONEK */
+#define XK_ogonek                        0x01b2  /* U+02DB OGONEK */
+#define XK_lstroke                       0x01b3  /* U+0142 LATIN SMALL LETTER L WITH STROKE */
+#define XK_lcaron                        0x01b5  /* U+013E LATIN SMALL LETTER L WITH CARON */
+#define XK_sacute                        0x01b6  /* U+015B LATIN SMALL LETTER S WITH ACUTE */
+#define XK_caron                         0x01b7  /* U+02C7 CARON */
+#define XK_scaron                        0x01b9  /* U+0161 LATIN SMALL LETTER S WITH CARON */
+#define XK_scedilla                      0x01ba  /* U+015F LATIN SMALL LETTER S WITH CEDILLA */
+#define XK_tcaron                        0x01bb  /* U+0165 LATIN SMALL LETTER T WITH CARON */
+#define XK_zacute                        0x01bc  /* U+017A LATIN SMALL LETTER Z WITH ACUTE */
+#define XK_doubleacute                   0x01bd  /* U+02DD DOUBLE ACUTE ACCENT */
+#define XK_zcaron                        0x01be  /* U+017E LATIN SMALL LETTER Z WITH CARON */
+#define XK_zabovedot                     0x01bf  /* U+017C LATIN SMALL LETTER Z WITH DOT ABOVE */
+#define XK_Racute                        0x01c0  /* U+0154 LATIN CAPITAL LETTER R WITH ACUTE */
+#define XK_Abreve                        0x01c3  /* U+0102 LATIN CAPITAL LETTER A WITH BREVE */
+#define XK_Lacute                        0x01c5  /* U+0139 LATIN CAPITAL LETTER L WITH ACUTE */
+#define XK_Cacute                        0x01c6  /* U+0106 LATIN CAPITAL LETTER C WITH ACUTE */
+#define XK_Ccaron                        0x01c8  /* U+010C LATIN CAPITAL LETTER C WITH CARON */
+#define XK_Eogonek                       0x01ca  /* U+0118 LATIN CAPITAL LETTER E WITH OGONEK */
+#define XK_Ecaron                        0x01cc  /* U+011A LATIN CAPITAL LETTER E WITH CARON */
+#define XK_Dcaron                        0x01cf  /* U+010E LATIN CAPITAL LETTER D WITH CARON */
+#define XK_Dstroke                       0x01d0  /* U+0110 LATIN CAPITAL LETTER D WITH STROKE */
+#define XK_Nacute                        0x01d1  /* U+0143 LATIN CAPITAL LETTER N WITH ACUTE */
+#define XK_Ncaron                        0x01d2  /* U+0147 LATIN CAPITAL LETTER N WITH CARON */
+#define XK_Odoubleacute                  0x01d5  /* U+0150 LATIN CAPITAL LETTER O WITH DOUBLE ACUTE */
+#define XK_Rcaron                        0x01d8  /* U+0158 LATIN CAPITAL LETTER R WITH CARON */
+#define XK_Uring                         0x01d9  /* U+016E LATIN CAPITAL LETTER U WITH RING ABOVE */
+#define XK_Udoubleacute                  0x01db  /* U+0170 LATIN CAPITAL LETTER U WITH DOUBLE ACUTE */
+#define XK_Tcedilla                      0x01de  /* U+0162 LATIN CAPITAL LETTER T WITH CEDILLA */
+#define XK_racute                        0x01e0  /* U+0155 LATIN SMALL LETTER R WITH ACUTE */
+#define XK_abreve                        0x01e3  /* U+0103 LATIN SMALL LETTER A WITH BREVE */
+#define XK_lacute                        0x01e5  /* U+013A LATIN SMALL LETTER L WITH ACUTE */
+#define XK_cacute                        0x01e6  /* U+0107 LATIN SMALL LETTER C WITH ACUTE */
+#define XK_ccaron                        0x01e8  /* U+010D LATIN SMALL LETTER C WITH CARON */
+#define XK_eogonek                       0x01ea  /* U+0119 LATIN SMALL LETTER E WITH OGONEK */
+#define XK_ecaron                        0x01ec  /* U+011B LATIN SMALL LETTER E WITH CARON */
+#define XK_dcaron                        0x01ef  /* U+010F LATIN SMALL LETTER D WITH CARON */
+#define XK_dstroke                       0x01f0  /* U+0111 LATIN SMALL LETTER D WITH STROKE */
+#define XK_nacute                        0x01f1  /* U+0144 LATIN SMALL LETTER N WITH ACUTE */
+#define XK_ncaron                        0x01f2  /* U+0148 LATIN SMALL LETTER N WITH CARON */
+#define XK_odoubleacute                  0x01f5  /* U+0151 LATIN SMALL LETTER O WITH DOUBLE ACUTE */
+#define XK_rcaron                        0x01f8  /* U+0159 LATIN SMALL LETTER R WITH CARON */
+#define XK_uring                         0x01f9  /* U+016F LATIN SMALL LETTER U WITH RING ABOVE */
+#define XK_udoubleacute                  0x01fb  /* U+0171 LATIN SMALL LETTER U WITH DOUBLE ACUTE */
+#define XK_tcedilla                      0x01fe  /* U+0163 LATIN SMALL LETTER T WITH CEDILLA */
+#define XK_abovedot                      0x01ff  /* U+02D9 DOT ABOVE */
+#endif /* XK_LATIN2 */
+
+/*
+ * Latin 3
+ * Byte 3 = 2
+ */
+
+#ifdef XK_LATIN3
+#define XK_Hstroke                       0x02a1  /* U+0126 LATIN CAPITAL LETTER H WITH STROKE */
+#define XK_Hcircumflex                   0x02a6  /* U+0124 LATIN CAPITAL LETTER H WITH CIRCUMFLEX */
+#define XK_Iabovedot                     0x02a9  /* U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE */
+#define XK_Gbreve                        0x02ab  /* U+011E LATIN CAPITAL LETTER G WITH BREVE */
+#define XK_Jcircumflex                   0x02ac  /* U+0134 LATIN CAPITAL LETTER J WITH CIRCUMFLEX */
+#define XK_hstroke                       0x02b1  /* U+0127 LATIN SMALL LETTER H WITH STROKE */
+#define XK_hcircumflex                   0x02b6  /* U+0125 LATIN SMALL LETTER H WITH CIRCUMFLEX */
+#define XK_idotless                      0x02b9  /* U+0131 LATIN SMALL LETTER DOTLESS I */
+#define XK_gbreve                        0x02bb  /* U+011F LATIN SMALL LETTER G WITH BREVE */
+#define XK_jcircumflex                   0x02bc  /* U+0135 LATIN SMALL LETTER J WITH CIRCUMFLEX */
+#define XK_Cabovedot                     0x02c5  /* U+010A LATIN CAPITAL LETTER C WITH DOT ABOVE */
+#define XK_Ccircumflex                   0x02c6  /* U+0108 LATIN CAPITAL LETTER C WITH CIRCUMFLEX */
+#define XK_Gabovedot                     0x02d5  /* U+0120 LATIN CAPITAL LETTER G WITH DOT ABOVE */
+#define XK_Gcircumflex                   0x02d8  /* U+011C LATIN CAPITAL LETTER G WITH CIRCUMFLEX */
+#define XK_Ubreve                        0x02dd  /* U+016C LATIN CAPITAL LETTER U WITH BREVE */
+#define XK_Scircumflex                   0x02de  /* U+015C LATIN CAPITAL LETTER S WITH CIRCUMFLEX */
+#define XK_cabovedot                     0x02e5  /* U+010B LATIN SMALL LETTER C WITH DOT ABOVE */
+#define XK_ccircumflex                   0x02e6  /* U+0109 LATIN SMALL LETTER C WITH CIRCUMFLEX */
+#define XK_gabovedot                     0x02f5  /* U+0121 LATIN SMALL LETTER G WITH DOT ABOVE */
+#define XK_gcircumflex                   0x02f8  /* U+011D LATIN SMALL LETTER G WITH CIRCUMFLEX */
+#define XK_ubreve                        0x02fd  /* U+016D LATIN SMALL LETTER U WITH BREVE */
+#define XK_scircumflex                   0x02fe  /* U+015D LATIN SMALL LETTER S WITH CIRCUMFLEX */
+#endif /* XK_LATIN3 */
+
+
+/*
+ * Latin 4
+ * Byte 3 = 3
+ */
+
+#ifdef XK_LATIN4
+#define XK_kra                           0x03a2  /* U+0138 LATIN SMALL LETTER KRA */
+#define XK_kappa                         0x03a2  /* deprecated */
+#define XK_Rcedilla                      0x03a3  /* U+0156 LATIN CAPITAL LETTER R WITH CEDILLA */
+#define XK_Itilde                        0x03a5  /* U+0128 LATIN CAPITAL LETTER I WITH TILDE */
+#define XK_Lcedilla                      0x03a6  /* U+013B LATIN CAPITAL LETTER L WITH CEDILLA */
+#define XK_Emacron                       0x03aa  /* U+0112 LATIN CAPITAL LETTER E WITH MACRON */
+#define XK_Gcedilla                      0x03ab  /* U+0122 LATIN CAPITAL LETTER G WITH CEDILLA */
+#define XK_Tslash                        0x03ac  /* U+0166 LATIN CAPITAL LETTER T WITH STROKE */
+#define XK_rcedilla                      0x03b3  /* U+0157 LATIN SMALL LETTER R WITH CEDILLA */
+#define XK_itilde                        0x03b5  /* U+0129 LATIN SMALL LETTER I WITH TILDE */
+#define XK_lcedilla                      0x03b6  /* U+013C LATIN SMALL LETTER L WITH CEDILLA */
+#define XK_emacron                       0x03ba  /* U+0113 LATIN SMALL LETTER E WITH MACRON */
+#define XK_gcedilla                      0x03bb  /* U+0123 LATIN SMALL LETTER G WITH CEDILLA */
+#define XK_tslash                        0x03bc  /* U+0167 LATIN SMALL LETTER T WITH STROKE */
+#define XK_ENG                           0x03bd  /* U+014A LATIN CAPITAL LETTER ENG */
+#define XK_eng                           0x03bf  /* U+014B LATIN SMALL LETTER ENG */
+#define XK_Amacron                       0x03c0  /* U+0100 LATIN CAPITAL LETTER A WITH MACRON */
+#define XK_Iogonek                       0x03c7  /* U+012E LATIN CAPITAL LETTER I WITH OGONEK */
+#define XK_Eabovedot                     0x03cc  /* U+0116 LATIN CAPITAL LETTER E WITH DOT ABOVE */
+#define XK_Imacron                       0x03cf  /* U+012A LATIN CAPITAL LETTER I WITH MACRON */
+#define XK_Ncedilla                      0x03d1  /* U+0145 LATIN CAPITAL LETTER N WITH CEDILLA */
+#define XK_Omacron                       0x03d2  /* U+014C LATIN CAPITAL LETTER O WITH MACRON */
+#define XK_Kcedilla                      0x03d3  /* U+0136 LATIN CAPITAL LETTER K WITH CEDILLA */
+#define XK_Uogonek                       0x03d9  /* U+0172 LATIN CAPITAL LETTER U WITH OGONEK */
+#define XK_Utilde                        0x03dd  /* U+0168 LATIN CAPITAL LETTER U WITH TILDE */
+#define XK_Umacron                       0x03de  /* U+016A LATIN CAPITAL LETTER U WITH MACRON */
+#define XK_amacron                       0x03e0  /* U+0101 LATIN SMALL LETTER A WITH MACRON */
+#define XK_iogonek                       0x03e7  /* U+012F LATIN SMALL LETTER I WITH OGONEK */
+#define XK_eabovedot                     0x03ec  /* U+0117 LATIN SMALL LETTER E WITH DOT ABOVE */
+#define XK_imacron                       0x03ef  /* U+012B LATIN SMALL LETTER I WITH MACRON */
+#define XK_ncedilla                      0x03f1  /* U+0146 LATIN SMALL LETTER N WITH CEDILLA */
+#define XK_omacron                       0x03f2  /* U+014D LATIN SMALL LETTER O WITH MACRON */
+#define XK_kcedilla                      0x03f3  /* U+0137 LATIN SMALL LETTER K WITH CEDILLA */
+#define XK_uogonek                       0x03f9  /* U+0173 LATIN SMALL LETTER U WITH OGONEK */
+#define XK_utilde                        0x03fd  /* U+0169 LATIN SMALL LETTER U WITH TILDE */
+#define XK_umacron                       0x03fe  /* U+016B LATIN SMALL LETTER U WITH MACRON */
+#endif /* XK_LATIN4 */
+
+/*
+ * Latin 8
+ */
+#ifdef XK_LATIN8
+#define XK_Wcircumflex                0x1000174  /* U+0174 LATIN CAPITAL LETTER W WITH CIRCUMFLEX */
+#define XK_wcircumflex                0x1000175  /* U+0175 LATIN SMALL LETTER W WITH CIRCUMFLEX */
+#define XK_Ycircumflex                0x1000176  /* U+0176 LATIN CAPITAL LETTER Y WITH CIRCUMFLEX */
+#define XK_ycircumflex                0x1000177  /* U+0177 LATIN SMALL LETTER Y WITH CIRCUMFLEX */
+#define XK_Babovedot                  0x1001e02  /* U+1E02 LATIN CAPITAL LETTER B WITH DOT ABOVE */
+#define XK_babovedot                  0x1001e03  /* U+1E03 LATIN SMALL LETTER B WITH DOT ABOVE */
+#define XK_Dabovedot                  0x1001e0a  /* U+1E0A LATIN CAPITAL LETTER D WITH DOT ABOVE */
+#define XK_dabovedot                  0x1001e0b  /* U+1E0B LATIN SMALL LETTER D WITH DOT ABOVE */
+#define XK_Fabovedot                  0x1001e1e  /* U+1E1E LATIN CAPITAL LETTER F WITH DOT ABOVE */
+#define XK_fabovedot                  0x1001e1f  /* U+1E1F LATIN SMALL LETTER F WITH DOT ABOVE */
+#define XK_Mabovedot                  0x1001e40  /* U+1E40 LATIN CAPITAL LETTER M WITH DOT ABOVE */
+#define XK_mabovedot                  0x1001e41  /* U+1E41 LATIN SMALL LETTER M WITH DOT ABOVE */
+#define XK_Pabovedot                  0x1001e56  /* U+1E56 LATIN CAPITAL LETTER P WITH DOT ABOVE */
+#define XK_pabovedot                  0x1001e57  /* U+1E57 LATIN SMALL LETTER P WITH DOT ABOVE */
+#define XK_Sabovedot                  0x1001e60  /* U+1E60 LATIN CAPITAL LETTER S WITH DOT ABOVE */
+#define XK_sabovedot                  0x1001e61  /* U+1E61 LATIN SMALL LETTER S WITH DOT ABOVE */
+#define XK_Tabovedot                  0x1001e6a  /* U+1E6A LATIN CAPITAL LETTER T WITH DOT ABOVE */
+#define XK_tabovedot                  0x1001e6b  /* U+1E6B LATIN SMALL LETTER T WITH DOT ABOVE */
+#define XK_Wgrave                     0x1001e80  /* U+1E80 LATIN CAPITAL LETTER W WITH GRAVE */
+#define XK_wgrave                     0x1001e81  /* U+1E81 LATIN SMALL LETTER W WITH GRAVE */
+#define XK_Wacute                     0x1001e82  /* U+1E82 LATIN CAPITAL LETTER W WITH ACUTE */
+#define XK_wacute                     0x1001e83  /* U+1E83 LATIN SMALL LETTER W WITH ACUTE */
+#define XK_Wdiaeresis                 0x1001e84  /* U+1E84 LATIN CAPITAL LETTER W WITH DIAERESIS */
+#define XK_wdiaeresis                 0x1001e85  /* U+1E85 LATIN SMALL LETTER W WITH DIAERESIS */
+#define XK_Ygrave                     0x1001ef2  /* U+1EF2 LATIN CAPITAL LETTER Y WITH GRAVE */
+#define XK_ygrave                     0x1001ef3  /* U+1EF3 LATIN SMALL LETTER Y WITH GRAVE */
+#endif /* XK_LATIN8 */
+
+/*
+ * Latin 9
+ * Byte 3 = 0x13
+ */
+
+#ifdef XK_LATIN9
+#define XK_OE                            0x13bc  /* U+0152 LATIN CAPITAL LIGATURE OE */
+#define XK_oe                            0x13bd  /* U+0153 LATIN SMALL LIGATURE OE */
+#define XK_Ydiaeresis                    0x13be  /* U+0178 LATIN CAPITAL LETTER Y WITH DIAERESIS */
+#endif /* XK_LATIN9 */
+
+/*
+ * Katakana
+ * Byte 3 = 4
+ */
+
+#ifdef XK_KATAKANA
+#define XK_overline                      0x047e  /* U+203E OVERLINE */
+#define XK_kana_fullstop                 0x04a1  /* U+3002 IDEOGRAPHIC FULL STOP */
+#define XK_kana_openingbracket           0x04a2  /* U+300C LEFT CORNER BRACKET */
+#define XK_kana_closingbracket           0x04a3  /* U+300D RIGHT CORNER BRACKET */
+#define XK_kana_comma                    0x04a4  /* U+3001 IDEOGRAPHIC COMMA */
+#define XK_kana_conjunctive              0x04a5  /* U+30FB KATAKANA MIDDLE DOT */
+#define XK_kana_middledot                0x04a5  /* deprecated */
+#define XK_kana_WO                       0x04a6  /* U+30F2 KATAKANA LETTER WO */
+#define XK_kana_a                        0x04a7  /* U+30A1 KATAKANA LETTER SMALL A */
+#define XK_kana_i                        0x04a8  /* U+30A3 KATAKANA LETTER SMALL I */
+#define XK_kana_u                        0x04a9  /* U+30A5 KATAKANA LETTER SMALL U */
+#define XK_kana_e                        0x04aa  /* U+30A7 KATAKANA LETTER SMALL E */
+#define XK_kana_o                        0x04ab  /* U+30A9 KATAKANA LETTER SMALL O */
+#define XK_kana_ya                       0x04ac  /* U+30E3 KATAKANA LETTER SMALL YA */
+#define XK_kana_yu                       0x04ad  /* U+30E5 KATAKANA LETTER SMALL YU */
+#define XK_kana_yo                       0x04ae  /* U+30E7 KATAKANA LETTER SMALL YO */
+#define XK_kana_tsu                      0x04af  /* U+30C3 KATAKANA LETTER SMALL TU */
+#define XK_kana_tu                       0x04af  /* deprecated */
+#define XK_prolongedsound                0x04b0  /* U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK */
+#define XK_kana_A                        0x04b1  /* U+30A2 KATAKANA LETTER A */
+#define XK_kana_I                        0x04b2  /* U+30A4 KATAKANA LETTER I */
+#define XK_kana_U                        0x04b3  /* U+30A6 KATAKANA LETTER U */
+#define XK_kana_E                        0x04b4  /* U+30A8 KATAKANA LETTER E */
+#define XK_kana_O                        0x04b5  /* U+30AA KATAKANA LETTER O */
+#define XK_kana_KA                       0x04b6  /* U+30AB KATAKANA LETTER KA */
+#define XK_kana_KI                       0x04b7  /* U+30AD KATAKANA LETTER KI */
+#define XK_kana_KU                       0x04b8  /* U+30AF KATAKANA LETTER KU */
+#define XK_kana_KE                       0x04b9  /* U+30B1 KATAKANA LETTER KE */
+#define XK_kana_KO                       0x04ba  /* U+30B3 KATAKANA LETTER KO */
+#define XK_kana_SA                       0x04bb  /* U+30B5 KATAKANA LETTER SA */
+#define XK_kana_SHI                      0x04bc  /* U+30B7 KATAKANA LETTER SI */
+#define XK_kana_SU                       0x04bd  /* U+30B9 KATAKANA LETTER SU */
+#define XK_kana_SE                       0x04be  /* U+30BB KATAKANA LETTER SE */
+#define XK_kana_SO                       0x04bf  /* U+30BD KATAKANA LETTER SO */
+#define XK_kana_TA                       0x04c0  /* U+30BF KATAKANA LETTER TA */
+#define XK_kana_CHI                      0x04c1  /* U+30C1 KATAKANA LETTER TI */
+#define XK_kana_TI                       0x04c1  /* deprecated */
+#define XK_kana_TSU                      0x04c2  /* U+30C4 KATAKANA LETTER TU */
+#define XK_kana_TU                       0x04c2  /* deprecated */
+#define XK_kana_TE                       0x04c3  /* U+30C6 KATAKANA LETTER TE */
+#define XK_kana_TO                       0x04c4  /* U+30C8 KATAKANA LETTER TO */
+#define XK_kana_NA                       0x04c5  /* U+30CA KATAKANA LETTER NA */
+#define XK_kana_NI                       0x04c6  /* U+30CB KATAKANA LETTER NI */
+#define XK_kana_NU                       0x04c7  /* U+30CC KATAKANA LETTER NU */
+#define XK_kana_NE                       0x04c8  /* U+30CD KATAKANA LETTER NE */
+#define XK_kana_NO                       0x04c9  /* U+30CE KATAKANA LETTER NO */
+#define XK_kana_HA                       0x04ca  /* U+30CF KATAKANA LETTER HA */
+#define XK_kana_HI                       0x04cb  /* U+30D2 KATAKANA LETTER HI */
+#define XK_kana_FU                       0x04cc  /* U+30D5 KATAKANA LETTER HU */
+#define XK_kana_HU                       0x04cc  /* deprecated */
+#define XK_kana_HE                       0x04cd  /* U+30D8 KATAKANA LETTER HE */
+#define XK_kana_HO                       0x04ce  /* U+30DB KATAKANA LETTER HO */
+#define XK_kana_MA                       0x04cf  /* U+30DE KATAKANA LETTER MA */
+#define XK_kana_MI                       0x04d0  /* U+30DF KATAKANA LETTER MI */
+#define XK_kana_MU                       0x04d1  /* U+30E0 KATAKANA LETTER MU */
+#define XK_kana_ME                       0x04d2  /* U+30E1 KATAKANA LETTER ME */
+#define XK_kana_MO                       0x04d3  /* U+30E2 KATAKANA LETTER MO */
+#define XK_kana_YA                       0x04d4  /* U+30E4 KATAKANA LETTER YA */
+#define XK_kana_YU                       0x04d5  /* U+30E6 KATAKANA LETTER YU */
+#define XK_kana_YO                       0x04d6  /* U+30E8 KATAKANA LETTER YO */
+#define XK_kana_RA                       0x04d7  /* U+30E9 KATAKANA LETTER RA */
+#define XK_kana_RI                       0x04d8  /* U+30EA KATAKANA LETTER RI */
+#define XK_kana_RU                       0x04d9  /* U+30EB KATAKANA LETTER RU */
+#define XK_kana_RE                       0x04da  /* U+30EC KATAKANA LETTER RE */
+#define XK_kana_RO                       0x04db  /* U+30ED KATAKANA LETTER RO */
+#define XK_kana_WA                       0x04dc  /* U+30EF KATAKANA LETTER WA */
+#define XK_kana_N                        0x04dd  /* U+30F3 KATAKANA LETTER N */
+#define XK_voicedsound                   0x04de  /* U+309B KATAKANA-HIRAGANA VOICED SOUND MARK */
+#define XK_semivoicedsound               0x04df  /* U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK */
+#define XK_kana_switch                   0xff7e  /* Alias for mode_switch */
+#endif /* XK_KATAKANA */
+
+/*
+ * Arabic
+ * Byte 3 = 5
+ */
+
+#ifdef XK_ARABIC
+#define XK_Farsi_0                    0x10006f0  /* U+06F0 EXTENDED ARABIC-INDIC DIGIT ZERO */
+#define XK_Farsi_1                    0x10006f1  /* U+06F1 EXTENDED ARABIC-INDIC DIGIT ONE */
+#define XK_Farsi_2                    0x10006f2  /* U+06F2 EXTENDED ARABIC-INDIC DIGIT TWO */
+#define XK_Farsi_3                    0x10006f3  /* U+06F3 EXTENDED ARABIC-INDIC DIGIT THREE */
+#define XK_Farsi_4                    0x10006f4  /* U+06F4 EXTENDED ARABIC-INDIC DIGIT FOUR */
+#define XK_Farsi_5                    0x10006f5  /* U+06F5 EXTENDED ARABIC-INDIC DIGIT FIVE */
+#define XK_Farsi_6                    0x10006f6  /* U+06F6 EXTENDED ARABIC-INDIC DIGIT SIX */
+#define XK_Farsi_7                    0x10006f7  /* U+06F7 EXTENDED ARABIC-INDIC DIGIT SEVEN */
+#define XK_Farsi_8                    0x10006f8  /* U+06F8 EXTENDED ARABIC-INDIC DIGIT EIGHT */
+#define XK_Farsi_9                    0x10006f9  /* U+06F9 EXTENDED ARABIC-INDIC DIGIT NINE */
+#define XK_Arabic_percent             0x100066a  /* U+066A ARABIC PERCENT SIGN */
+#define XK_Arabic_superscript_alef    0x1000670  /* U+0670 ARABIC LETTER SUPERSCRIPT ALEF */
+#define XK_Arabic_tteh                0x1000679  /* U+0679 ARABIC LETTER TTEH */
+#define XK_Arabic_peh                 0x100067e  /* U+067E ARABIC LETTER PEH */
+#define XK_Arabic_tcheh               0x1000686  /* U+0686 ARABIC LETTER TCHEH */
+#define XK_Arabic_ddal                0x1000688  /* U+0688 ARABIC LETTER DDAL */
+#define XK_Arabic_rreh                0x1000691  /* U+0691 ARABIC LETTER RREH */
+#define XK_Arabic_comma                  0x05ac  /* U+060C ARABIC COMMA */
+#define XK_Arabic_fullstop            0x10006d4  /* U+06D4 ARABIC FULL STOP */
+#define XK_Arabic_0                   0x1000660  /* U+0660 ARABIC-INDIC DIGIT ZERO */
+#define XK_Arabic_1                   0x1000661  /* U+0661 ARABIC-INDIC DIGIT ONE */
+#define XK_Arabic_2                   0x1000662  /* U+0662 ARABIC-INDIC DIGIT TWO */
+#define XK_Arabic_3                   0x1000663  /* U+0663 ARABIC-INDIC DIGIT THREE */
+#define XK_Arabic_4                   0x1000664  /* U+0664 ARABIC-INDIC DIGIT FOUR */
+#define XK_Arabic_5                   0x1000665  /* U+0665 ARABIC-INDIC DIGIT FIVE */
+#define XK_Arabic_6                   0x1000666  /* U+0666 ARABIC-INDIC DIGIT SIX */
+#define XK_Arabic_7                   0x1000667  /* U+0667 ARABIC-INDIC DIGIT SEVEN */
+#define XK_Arabic_8                   0x1000668  /* U+0668 ARABIC-INDIC DIGIT EIGHT */
+#define XK_Arabic_9                   0x1000669  /* U+0669 ARABIC-INDIC DIGIT NINE */
+#define XK_Arabic_semicolon              0x05bb  /* U+061B ARABIC SEMICOLON */
+#define XK_Arabic_question_mark          0x05bf  /* U+061F ARABIC QUESTION MARK */
+#define XK_Arabic_hamza                  0x05c1  /* U+0621 ARABIC LETTER HAMZA */
+#define XK_Arabic_maddaonalef            0x05c2  /* U+0622 ARABIC LETTER ALEF WITH MADDA ABOVE */
+#define XK_Arabic_hamzaonalef            0x05c3  /* U+0623 ARABIC LETTER ALEF WITH HAMZA ABOVE */
+#define XK_Arabic_hamzaonwaw             0x05c4  /* U+0624 ARABIC LETTER WAW WITH HAMZA ABOVE */
+#define XK_Arabic_hamzaunderalef         0x05c5  /* U+0625 ARABIC LETTER ALEF WITH HAMZA BELOW */
+#define XK_Arabic_hamzaonyeh             0x05c6  /* U+0626 ARABIC LETTER YEH WITH HAMZA ABOVE */
+#define XK_Arabic_alef                   0x05c7  /* U+0627 ARABIC LETTER ALEF */
+#define XK_Arabic_beh                    0x05c8  /* U+0628 ARABIC LETTER BEH */
+#define XK_Arabic_tehmarbuta             0x05c9  /* U+0629 ARABIC LETTER TEH MARBUTA */
+#define XK_Arabic_teh                    0x05ca  /* U+062A ARABIC LETTER TEH */
+#define XK_Arabic_theh                   0x05cb  /* U+062B ARABIC LETTER THEH */
+#define XK_Arabic_jeem                   0x05cc  /* U+062C ARABIC LETTER JEEM */
+#define XK_Arabic_hah                    0x05cd  /* U+062D ARABIC LETTER HAH */
+#define XK_Arabic_khah                   0x05ce  /* U+062E ARABIC LETTER KHAH */
+#define XK_Arabic_dal                    0x05cf  /* U+062F ARABIC LETTER DAL */
+#define XK_Arabic_thal                   0x05d0  /* U+0630 ARABIC LETTER THAL */
+#define XK_Arabic_ra                     0x05d1  /* U+0631 ARABIC LETTER REH */
+#define XK_Arabic_zain                   0x05d2  /* U+0632 ARABIC LETTER ZAIN */
+#define XK_Arabic_seen                   0x05d3  /* U+0633 ARABIC LETTER SEEN */
+#define XK_Arabic_sheen                  0x05d4  /* U+0634 ARABIC LETTER SHEEN */
+#define XK_Arabic_sad                    0x05d5  /* U+0635 ARABIC LETTER SAD */
+#define XK_Arabic_dad                    0x05d6  /* U+0636 ARABIC LETTER DAD */
+#define XK_Arabic_tah                    0x05d7  /* U+0637 ARABIC LETTER TAH */
+#define XK_Arabic_zah                    0x05d8  /* U+0638 ARABIC LETTER ZAH */
+#define XK_Arabic_ain                    0x05d9  /* U+0639 ARABIC LETTER AIN */
+#define XK_Arabic_ghain                  0x05da  /* U+063A ARABIC LETTER GHAIN */
+#define XK_Arabic_tatweel                0x05e0  /* U+0640 ARABIC TATWEEL */
+#define XK_Arabic_feh                    0x05e1  /* U+0641 ARABIC LETTER FEH */
+#define XK_Arabic_qaf                    0x05e2  /* U+0642 ARABIC LETTER QAF */
+#define XK_Arabic_kaf                    0x05e3  /* U+0643 ARABIC LETTER KAF */
+#define XK_Arabic_lam                    0x05e4  /* U+0644 ARABIC LETTER LAM */
+#define XK_Arabic_meem                   0x05e5  /* U+0645 ARABIC LETTER MEEM */
+#define XK_Arabic_noon                   0x05e6  /* U+0646 ARABIC LETTER NOON */
+#define XK_Arabic_ha                     0x05e7  /* U+0647 ARABIC LETTER HEH */
+#define XK_Arabic_heh                    0x05e7  /* deprecated */
+#define XK_Arabic_waw                    0x05e8  /* U+0648 ARABIC LETTER WAW */
+#define XK_Arabic_alefmaksura            0x05e9  /* U+0649 ARABIC LETTER ALEF MAKSURA */
+#define XK_Arabic_yeh                    0x05ea  /* U+064A ARABIC LETTER YEH */
+#define XK_Arabic_fathatan               0x05eb  /* U+064B ARABIC FATHATAN */
+#define XK_Arabic_dammatan               0x05ec  /* U+064C ARABIC DAMMATAN */
+#define XK_Arabic_kasratan               0x05ed  /* U+064D ARABIC KASRATAN */
+#define XK_Arabic_fatha                  0x05ee  /* U+064E ARABIC FATHA */
+#define XK_Arabic_damma                  0x05ef  /* U+064F ARABIC DAMMA */
+#define XK_Arabic_kasra                  0x05f0  /* U+0650 ARABIC KASRA */
+#define XK_Arabic_shadda                 0x05f1  /* U+0651 ARABIC SHADDA */
+#define XK_Arabic_sukun                  0x05f2  /* U+0652 ARABIC SUKUN */
+#define XK_Arabic_madda_above         0x1000653  /* U+0653 ARABIC MADDAH ABOVE */
+#define XK_Arabic_hamza_above         0x1000654  /* U+0654 ARABIC HAMZA ABOVE */
+#define XK_Arabic_hamza_below         0x1000655  /* U+0655 ARABIC HAMZA BELOW */
+#define XK_Arabic_jeh                 0x1000698  /* U+0698 ARABIC LETTER JEH */
+#define XK_Arabic_veh                 0x10006a4  /* U+06A4 ARABIC LETTER VEH */
+#define XK_Arabic_keheh               0x10006a9  /* U+06A9 ARABIC LETTER KEHEH */
+#define XK_Arabic_gaf                 0x10006af  /* U+06AF ARABIC LETTER GAF */
+#define XK_Arabic_noon_ghunna         0x10006ba  /* U+06BA ARABIC LETTER NOON GHUNNA */
+#define XK_Arabic_heh_doachashmee     0x10006be  /* U+06BE ARABIC LETTER HEH DOACHASHMEE */
+#define XK_Farsi_yeh                  0x10006cc  /* U+06CC ARABIC LETTER FARSI YEH */
+#define XK_Arabic_farsi_yeh           0x10006cc  /* U+06CC ARABIC LETTER FARSI YEH */
+#define XK_Arabic_yeh_baree           0x10006d2  /* U+06D2 ARABIC LETTER YEH BARREE */
+#define XK_Arabic_heh_goal            0x10006c1  /* U+06C1 ARABIC LETTER HEH GOAL */
+#define XK_Arabic_switch                 0xff7e  /* Alias for mode_switch */
+#endif /* XK_ARABIC */
+
+/*
+ * Cyrillic
+ * Byte 3 = 6
+ */
+#ifdef XK_CYRILLIC
+#define XK_Cyrillic_GHE_bar           0x1000492  /* U+0492 CYRILLIC CAPITAL LETTER GHE WITH STROKE */
+#define XK_Cyrillic_ghe_bar           0x1000493  /* U+0493 CYRILLIC SMALL LETTER GHE WITH STROKE */
+#define XK_Cyrillic_ZHE_descender     0x1000496  /* U+0496 CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER */
+#define XK_Cyrillic_zhe_descender     0x1000497  /* U+0497 CYRILLIC SMALL LETTER ZHE WITH DESCENDER */
+#define XK_Cyrillic_KA_descender      0x100049a  /* U+049A CYRILLIC CAPITAL LETTER KA WITH DESCENDER */
+#define XK_Cyrillic_ka_descender      0x100049b  /* U+049B CYRILLIC SMALL LETTER KA WITH DESCENDER */
+#define XK_Cyrillic_KA_vertstroke     0x100049c  /* U+049C CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE */
+#define XK_Cyrillic_ka_vertstroke     0x100049d  /* U+049D CYRILLIC SMALL LETTER KA WITH VERTICAL STROKE */
+#define XK_Cyrillic_EN_descender      0x10004a2  /* U+04A2 CYRILLIC CAPITAL LETTER EN WITH DESCENDER */
+#define XK_Cyrillic_en_descender      0x10004a3  /* U+04A3 CYRILLIC SMALL LETTER EN WITH DESCENDER */
+#define XK_Cyrillic_U_straight        0x10004ae  /* U+04AE CYRILLIC CAPITAL LETTER STRAIGHT U */
+#define XK_Cyrillic_u_straight        0x10004af  /* U+04AF CYRILLIC SMALL LETTER STRAIGHT U */
+#define XK_Cyrillic_U_straight_bar    0x10004b0  /* U+04B0 CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE */
+#define XK_Cyrillic_u_straight_bar    0x10004b1  /* U+04B1 CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE */
+#define XK_Cyrillic_HA_descender      0x10004b2  /* U+04B2 CYRILLIC CAPITAL LETTER HA WITH DESCENDER */
+#define XK_Cyrillic_ha_descender      0x10004b3  /* U+04B3 CYRILLIC SMALL LETTER HA WITH DESCENDER */
+#define XK_Cyrillic_CHE_descender     0x10004b6  /* U+04B6 CYRILLIC CAPITAL LETTER CHE WITH DESCENDER */
+#define XK_Cyrillic_che_descender     0x10004b7  /* U+04B7 CYRILLIC SMALL LETTER CHE WITH DESCENDER */
+#define XK_Cyrillic_CHE_vertstroke    0x10004b8  /* U+04B8 CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE */
+#define XK_Cyrillic_che_vertstroke    0x10004b9  /* U+04B9 CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE */
+#define XK_Cyrillic_SHHA              0x10004ba  /* U+04BA CYRILLIC CAPITAL LETTER SHHA */
+#define XK_Cyrillic_shha              0x10004bb  /* U+04BB CYRILLIC SMALL LETTER SHHA */
+
+#define XK_Cyrillic_SCHWA             0x10004d8  /* U+04D8 CYRILLIC CAPITAL LETTER SCHWA */
+#define XK_Cyrillic_schwa             0x10004d9  /* U+04D9 CYRILLIC SMALL LETTER SCHWA */
+#define XK_Cyrillic_I_macron          0x10004e2  /* U+04E2 CYRILLIC CAPITAL LETTER I WITH MACRON */
+#define XK_Cyrillic_i_macron          0x10004e3  /* U+04E3 CYRILLIC SMALL LETTER I WITH MACRON */
+#define XK_Cyrillic_O_bar             0x10004e8  /* U+04E8 CYRILLIC CAPITAL LETTER BARRED O */
+#define XK_Cyrillic_o_bar             0x10004e9  /* U+04E9 CYRILLIC SMALL LETTER BARRED O */
+#define XK_Cyrillic_U_macron          0x10004ee  /* U+04EE CYRILLIC CAPITAL LETTER U WITH MACRON */
+#define XK_Cyrillic_u_macron          0x10004ef  /* U+04EF CYRILLIC SMALL LETTER U WITH MACRON */
+
+#define XK_Serbian_dje                   0x06a1  /* U+0452 CYRILLIC SMALL LETTER DJE */
+#define XK_Macedonia_gje                 0x06a2  /* U+0453 CYRILLIC SMALL LETTER GJE */
+#define XK_Cyrillic_io                   0x06a3  /* U+0451 CYRILLIC SMALL LETTER IO */
+#define XK_Ukrainian_ie                  0x06a4  /* U+0454 CYRILLIC SMALL LETTER UKRAINIAN IE */
+#define XK_Ukranian_je                   0x06a4  /* deprecated */
+#define XK_Macedonia_dse                 0x06a5  /* U+0455 CYRILLIC SMALL LETTER DZE */
+#define XK_Ukrainian_i                   0x06a6  /* U+0456 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I */
+#define XK_Ukranian_i                    0x06a6  /* deprecated */
+#define XK_Ukrainian_yi                  0x06a7  /* U+0457 CYRILLIC SMALL LETTER YI */
+#define XK_Ukranian_yi                   0x06a7  /* deprecated */
+#define XK_Cyrillic_je                   0x06a8  /* U+0458 CYRILLIC SMALL LETTER JE */
+#define XK_Serbian_je                    0x06a8  /* deprecated */
+#define XK_Cyrillic_lje                  0x06a9  /* U+0459 CYRILLIC SMALL LETTER LJE */
+#define XK_Serbian_lje                   0x06a9  /* deprecated */
+#define XK_Cyrillic_nje                  0x06aa  /* U+045A CYRILLIC SMALL LETTER NJE */
+#define XK_Serbian_nje                   0x06aa  /* deprecated */
+#define XK_Serbian_tshe                  0x06ab  /* U+045B CYRILLIC SMALL LETTER TSHE */
+#define XK_Macedonia_kje                 0x06ac  /* U+045C CYRILLIC SMALL LETTER KJE */
+#define XK_Ukrainian_ghe_with_upturn     0x06ad  /* U+0491 CYRILLIC SMALL LETTER GHE WITH UPTURN */
+#define XK_Byelorussian_shortu           0x06ae  /* U+045E CYRILLIC SMALL LETTER SHORT U */
+#define XK_Cyrillic_dzhe                 0x06af  /* U+045F CYRILLIC SMALL LETTER DZHE */
+#define XK_Serbian_dze                   0x06af  /* deprecated */
+#define XK_numerosign                    0x06b0  /* U+2116 NUMERO SIGN */
+#define XK_Serbian_DJE                   0x06b1  /* U+0402 CYRILLIC CAPITAL LETTER DJE */
+#define XK_Macedonia_GJE                 0x06b2  /* U+0403 CYRILLIC CAPITAL LETTER GJE */
+#define XK_Cyrillic_IO                   0x06b3  /* U+0401 CYRILLIC CAPITAL LETTER IO */
+#define XK_Ukrainian_IE                  0x06b4  /* U+0404 CYRILLIC CAPITAL LETTER UKRAINIAN IE */
+#define XK_Ukranian_JE                   0x06b4  /* deprecated */
+#define XK_Macedonia_DSE                 0x06b5  /* U+0405 CYRILLIC CAPITAL LETTER DZE */
+#define XK_Ukrainian_I                   0x06b6  /* U+0406 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I */
+#define XK_Ukranian_I                    0x06b6  /* deprecated */
+#define XK_Ukrainian_YI                  0x06b7  /* U+0407 CYRILLIC CAPITAL LETTER YI */
+#define XK_Ukranian_YI                   0x06b7  /* deprecated */
+#define XK_Cyrillic_JE                   0x06b8  /* U+0408 CYRILLIC CAPITAL LETTER JE */
+#define XK_Serbian_JE                    0x06b8  /* deprecated */
+#define XK_Cyrillic_LJE                  0x06b9  /* U+0409 CYRILLIC CAPITAL LETTER LJE */
+#define XK_Serbian_LJE                   0x06b9  /* deprecated */
+#define XK_Cyrillic_NJE                  0x06ba  /* U+040A CYRILLIC CAPITAL LETTER NJE */
+#define XK_Serbian_NJE                   0x06ba  /* deprecated */
+#define XK_Serbian_TSHE                  0x06bb  /* U+040B CYRILLIC CAPITAL LETTER TSHE */
+#define XK_Macedonia_KJE                 0x06bc  /* U+040C CYRILLIC CAPITAL LETTER KJE */
+#define XK_Ukrainian_GHE_WITH_UPTURN     0x06bd  /* U+0490 CYRILLIC CAPITAL LETTER GHE WITH UPTURN */
+#define XK_Byelorussian_SHORTU           0x06be  /* U+040E CYRILLIC CAPITAL LETTER SHORT U */
+#define XK_Cyrillic_DZHE                 0x06bf  /* U+040F CYRILLIC CAPITAL LETTER DZHE */
+#define XK_Serbian_DZE                   0x06bf  /* deprecated */
+#define XK_Cyrillic_yu                   0x06c0  /* U+044E CYRILLIC SMALL LETTER YU */
+#define XK_Cyrillic_a                    0x06c1  /* U+0430 CYRILLIC SMALL LETTER A */
+#define XK_Cyrillic_be                   0x06c2  /* U+0431 CYRILLIC SMALL LETTER BE */
+#define XK_Cyrillic_tse                  0x06c3  /* U+0446 CYRILLIC SMALL LETTER TSE */
+#define XK_Cyrillic_de                   0x06c4  /* U+0434 CYRILLIC SMALL LETTER DE */
+#define XK_Cyrillic_ie                   0x06c5  /* U+0435 CYRILLIC SMALL LETTER IE */
+#define XK_Cyrillic_ef                   0x06c6  /* U+0444 CYRILLIC SMALL LETTER EF */
+#define XK_Cyrillic_ghe                  0x06c7  /* U+0433 CYRILLIC SMALL LETTER GHE */
+#define XK_Cyrillic_ha                   0x06c8  /* U+0445 CYRILLIC SMALL LETTER HA */
+#define XK_Cyrillic_i                    0x06c9  /* U+0438 CYRILLIC SMALL LETTER I */
+#define XK_Cyrillic_shorti               0x06ca  /* U+0439 CYRILLIC SMALL LETTER SHORT I */
+#define XK_Cyrillic_ka                   0x06cb  /* U+043A CYRILLIC SMALL LETTER KA */
+#define XK_Cyrillic_el                   0x06cc  /* U+043B CYRILLIC SMALL LETTER EL */
+#define XK_Cyrillic_em                   0x06cd  /* U+043C CYRILLIC SMALL LETTER EM */
+#define XK_Cyrillic_en                   0x06ce  /* U+043D CYRILLIC SMALL LETTER EN */
+#define XK_Cyrillic_o                    0x06cf  /* U+043E CYRILLIC SMALL LETTER O */
+#define XK_Cyrillic_pe                   0x06d0  /* U+043F CYRILLIC SMALL LETTER PE */
+#define XK_Cyrillic_ya                   0x06d1  /* U+044F CYRILLIC SMALL LETTER YA */
+#define XK_Cyrillic_er                   0x06d2  /* U+0440 CYRILLIC SMALL LETTER ER */
+#define XK_Cyrillic_es                   0x06d3  /* U+0441 CYRILLIC SMALL LETTER ES */
+#define XK_Cyrillic_te                   0x06d4  /* U+0442 CYRILLIC SMALL LETTER TE */
+#define XK_Cyrillic_u                    0x06d5  /* U+0443 CYRILLIC SMALL LETTER U */
+#define XK_Cyrillic_zhe                  0x06d6  /* U+0436 CYRILLIC SMALL LETTER ZHE */
+#define XK_Cyrillic_ve                   0x06d7  /* U+0432 CYRILLIC SMALL LETTER VE */
+#define XK_Cyrillic_softsign             0x06d8  /* U+044C CYRILLIC SMALL LETTER SOFT SIGN */
+#define XK_Cyrillic_yeru                 0x06d9  /* U+044B CYRILLIC SMALL LETTER YERU */
+#define XK_Cyrillic_ze                   0x06da  /* U+0437 CYRILLIC SMALL LETTER ZE */
+#define XK_Cyrillic_sha                  0x06db  /* U+0448 CYRILLIC SMALL LETTER SHA */
+#define XK_Cyrillic_e                    0x06dc  /* U+044D CYRILLIC SMALL LETTER E */
+#define XK_Cyrillic_shcha                0x06dd  /* U+0449 CYRILLIC SMALL LETTER SHCHA */
+#define XK_Cyrillic_che                  0x06de  /* U+0447 CYRILLIC SMALL LETTER CHE */
+#define XK_Cyrillic_hardsign             0x06df  /* U+044A CYRILLIC SMALL LETTER HARD SIGN */
+#define XK_Cyrillic_YU                   0x06e0  /* U+042E CYRILLIC CAPITAL LETTER YU */
+#define XK_Cyrillic_A                    0x06e1  /* U+0410 CYRILLIC CAPITAL LETTER A */
+#define XK_Cyrillic_BE                   0x06e2  /* U+0411 CYRILLIC CAPITAL LETTER BE */
+#define XK_Cyrillic_TSE                  0x06e3  /* U+0426 CYRILLIC CAPITAL LETTER TSE */
+#define XK_Cyrillic_DE                   0x06e4  /* U+0414 CYRILLIC CAPITAL LETTER DE */
+#define XK_Cyrillic_IE                   0x06e5  /* U+0415 CYRILLIC CAPITAL LETTER IE */
+#define XK_Cyrillic_EF                   0x06e6  /* U+0424 CYRILLIC CAPITAL LETTER EF */
+#define XK_Cyrillic_GHE                  0x06e7  /* U+0413 CYRILLIC CAPITAL LETTER GHE */
+#define XK_Cyrillic_HA                   0x06e8  /* U+0425 CYRILLIC CAPITAL LETTER HA */
+#define XK_Cyrillic_I                    0x06e9  /* U+0418 CYRILLIC CAPITAL LETTER I */
+#define XK_Cyrillic_SHORTI               0x06ea  /* U+0419 CYRILLIC CAPITAL LETTER SHORT I */
+#define XK_Cyrillic_KA                   0x06eb  /* U+041A CYRILLIC CAPITAL LETTER KA */
+#define XK_Cyrillic_EL                   0x06ec  /* U+041B CYRILLIC CAPITAL LETTER EL */
+#define XK_Cyrillic_EM                   0x06ed  /* U+041C CYRILLIC CAPITAL LETTER EM */
+#define XK_Cyrillic_EN                   0x06ee  /* U+041D CYRILLIC CAPITAL LETTER EN */
+#define XK_Cyrillic_O                    0x06ef  /* U+041E CYRILLIC CAPITAL LETTER O */
+#define XK_Cyrillic_PE                   0x06f0  /* U+041F CYRILLIC CAPITAL LETTER PE */
+#define XK_Cyrillic_YA                   0x06f1  /* U+042F CYRILLIC CAPITAL LETTER YA */
+#define XK_Cyrillic_ER                   0x06f2  /* U+0420 CYRILLIC CAPITAL LETTER ER */
+#define XK_Cyrillic_ES                   0x06f3  /* U+0421 CYRILLIC CAPITAL LETTER ES */
+#define XK_Cyrillic_TE                   0x06f4  /* U+0422 CYRILLIC CAPITAL LETTER TE */
+#define XK_Cyrillic_U                    0x06f5  /* U+0423 CYRILLIC CAPITAL LETTER U */
+#define XK_Cyrillic_ZHE                  0x06f6  /* U+0416 CYRILLIC CAPITAL LETTER ZHE */
+#define XK_Cyrillic_VE                   0x06f7  /* U+0412 CYRILLIC CAPITAL LETTER VE */
+#define XK_Cyrillic_SOFTSIGN             0x06f8  /* U+042C CYRILLIC CAPITAL LETTER SOFT SIGN */
+#define XK_Cyrillic_YERU                 0x06f9  /* U+042B CYRILLIC CAPITAL LETTER YERU */
+#define XK_Cyrillic_ZE                   0x06fa  /* U+0417 CYRILLIC CAPITAL LETTER ZE */
+#define XK_Cyrillic_SHA                  0x06fb  /* U+0428 CYRILLIC CAPITAL LETTER SHA */
+#define XK_Cyrillic_E                    0x06fc  /* U+042D CYRILLIC CAPITAL LETTER E */
+#define XK_Cyrillic_SHCHA                0x06fd  /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */
+#define XK_Cyrillic_CHE                  0x06fe  /* U+0427 CYRILLIC CAPITAL LETTER CHE */
+#define XK_Cyrillic_HARDSIGN             0x06ff  /* U+042A CYRILLIC CAPITAL LETTER HARD SIGN */
+#endif /* XK_CYRILLIC */
+
+/*
+ * Greek
+ * (based on an early draft of, and not quite identical to, ISO/IEC 8859-7)
+ * Byte 3 = 7
+ */
+
+#ifdef XK_GREEK
+#define XK_Greek_ALPHAaccent             0x07a1  /* U+0386 GREEK CAPITAL LETTER ALPHA WITH TONOS */
+#define XK_Greek_EPSILONaccent           0x07a2  /* U+0388 GREEK CAPITAL LETTER EPSILON WITH TONOS */
+#define XK_Greek_ETAaccent               0x07a3  /* U+0389 GREEK CAPITAL LETTER ETA WITH TONOS */
+#define XK_Greek_IOTAaccent              0x07a4  /* U+038A GREEK CAPITAL LETTER IOTA WITH TONOS */
+#define XK_Greek_IOTAdieresis            0x07a5  /* U+03AA GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */
+#define XK_Greek_IOTAdiaeresis           0x07a5  /* old typo */
+#define XK_Greek_OMICRONaccent           0x07a7  /* U+038C GREEK CAPITAL LETTER OMICRON WITH TONOS */
+#define XK_Greek_UPSILONaccent           0x07a8  /* U+038E GREEK CAPITAL LETTER UPSILON WITH TONOS */
+#define XK_Greek_UPSILONdieresis         0x07a9  /* U+03AB GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA */
+#define XK_Greek_OMEGAaccent             0x07ab  /* U+038F GREEK CAPITAL LETTER OMEGA WITH TONOS */
+#define XK_Greek_accentdieresis          0x07ae  /* U+0385 GREEK DIALYTIKA TONOS */
+#define XK_Greek_horizbar                0x07af  /* U+2015 HORIZONTAL BAR */
+#define XK_Greek_alphaaccent             0x07b1  /* U+03AC GREEK SMALL LETTER ALPHA WITH TONOS */
+#define XK_Greek_epsilonaccent           0x07b2  /* U+03AD GREEK SMALL LETTER EPSILON WITH TONOS */
+#define XK_Greek_etaaccent               0x07b3  /* U+03AE GREEK SMALL LETTER ETA WITH TONOS */
+#define XK_Greek_iotaaccent              0x07b4  /* U+03AF GREEK SMALL LETTER IOTA WITH TONOS */
+#define XK_Greek_iotadieresis            0x07b5  /* U+03CA GREEK SMALL LETTER IOTA WITH DIALYTIKA */
+#define XK_Greek_iotaaccentdieresis      0x07b6  /* U+0390 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS */
+#define XK_Greek_omicronaccent           0x07b7  /* U+03CC GREEK SMALL LETTER OMICRON WITH TONOS */
+#define XK_Greek_upsilonaccent           0x07b8  /* U+03CD GREEK SMALL LETTER UPSILON WITH TONOS */
+#define XK_Greek_upsilondieresis         0x07b9  /* U+03CB GREEK SMALL LETTER UPSILON WITH DIALYTIKA */
+#define XK_Greek_upsilonaccentdieresis   0x07ba  /* U+03B0 GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS */
+#define XK_Greek_omegaaccent             0x07bb  /* U+03CE GREEK SMALL LETTER OMEGA WITH TONOS */
+#define XK_Greek_ALPHA                   0x07c1  /* U+0391 GREEK CAPITAL LETTER ALPHA */
+#define XK_Greek_BETA                    0x07c2  /* U+0392 GREEK CAPITAL LETTER BETA */
+#define XK_Greek_GAMMA                   0x07c3  /* U+0393 GREEK CAPITAL LETTER GAMMA */
+#define XK_Greek_DELTA                   0x07c4  /* U+0394 GREEK CAPITAL LETTER DELTA */
+#define XK_Greek_EPSILON                 0x07c5  /* U+0395 GREEK CAPITAL LETTER EPSILON */
+#define XK_Greek_ZETA                    0x07c6  /* U+0396 GREEK CAPITAL LETTER ZETA */
+#define XK_Greek_ETA                     0x07c7  /* U+0397 GREEK CAPITAL LETTER ETA */
+#define XK_Greek_THETA                   0x07c8  /* U+0398 GREEK CAPITAL LETTER THETA */
+#define XK_Greek_IOTA                    0x07c9  /* U+0399 GREEK CAPITAL LETTER IOTA */
+#define XK_Greek_KAPPA                   0x07ca  /* U+039A GREEK CAPITAL LETTER KAPPA */
+#define XK_Greek_LAMDA                   0x07cb  /* U+039B GREEK CAPITAL LETTER LAMDA */
+#define XK_Greek_LAMBDA                  0x07cb  /* U+039B GREEK CAPITAL LETTER LAMDA */
+#define XK_Greek_MU                      0x07cc  /* U+039C GREEK CAPITAL LETTER MU */
+#define XK_Greek_NU                      0x07cd  /* U+039D GREEK CAPITAL LETTER NU */
+#define XK_Greek_XI                      0x07ce  /* U+039E GREEK CAPITAL LETTER XI */
+#define XK_Greek_OMICRON                 0x07cf  /* U+039F GREEK CAPITAL LETTER OMICRON */
+#define XK_Greek_PI                      0x07d0  /* U+03A0 GREEK CAPITAL LETTER PI */
+#define XK_Greek_RHO                     0x07d1  /* U+03A1 GREEK CAPITAL LETTER RHO */
+#define XK_Greek_SIGMA                   0x07d2  /* U+03A3 GREEK CAPITAL LETTER SIGMA */
+#define XK_Greek_TAU                     0x07d4  /* U+03A4 GREEK CAPITAL LETTER TAU */
+#define XK_Greek_UPSILON                 0x07d5  /* U+03A5 GREEK CAPITAL LETTER UPSILON */
+#define XK_Greek_PHI                     0x07d6  /* U+03A6 GREEK CAPITAL LETTER PHI */
+#define XK_Greek_CHI                     0x07d7  /* U+03A7 GREEK CAPITAL LETTER CHI */
+#define XK_Greek_PSI                     0x07d8  /* U+03A8 GREEK CAPITAL LETTER PSI */
+#define XK_Greek_OMEGA                   0x07d9  /* U+03A9 GREEK CAPITAL LETTER OMEGA */
+#define XK_Greek_alpha                   0x07e1  /* U+03B1 GREEK SMALL LETTER ALPHA */
+#define XK_Greek_beta                    0x07e2  /* U+03B2 GREEK SMALL LETTER BETA */
+#define XK_Greek_gamma                   0x07e3  /* U+03B3 GREEK SMALL LETTER GAMMA */
+#define XK_Greek_delta                   0x07e4  /* U+03B4 GREEK SMALL LETTER DELTA */
+#define XK_Greek_epsilon                 0x07e5  /* U+03B5 GREEK SMALL LETTER EPSILON */
+#define XK_Greek_zeta                    0x07e6  /* U+03B6 GREEK SMALL LETTER ZETA */
+#define XK_Greek_eta                     0x07e7  /* U+03B7 GREEK SMALL LETTER ETA */
+#define XK_Greek_theta                   0x07e8  /* U+03B8 GREEK SMALL LETTER THETA */
+#define XK_Greek_iota                    0x07e9  /* U+03B9 GREEK SMALL LETTER IOTA */
+#define XK_Greek_kappa                   0x07ea  /* U+03BA GREEK SMALL LETTER KAPPA */
+#define XK_Greek_lamda                   0x07eb  /* U+03BB GREEK SMALL LETTER LAMDA */
+#define XK_Greek_lambda                  0x07eb  /* U+03BB GREEK SMALL LETTER LAMDA */
+#define XK_Greek_mu                      0x07ec  /* U+03BC GREEK SMALL LETTER MU */
+#define XK_Greek_nu                      0x07ed  /* U+03BD GREEK SMALL LETTER NU */
+#define XK_Greek_xi                      0x07ee  /* U+03BE GREEK SMALL LETTER XI */
+#define XK_Greek_omicron                 0x07ef  /* U+03BF GREEK SMALL LETTER OMICRON */
+#define XK_Greek_pi                      0x07f0  /* U+03C0 GREEK SMALL LETTER PI */
+#define XK_Greek_rho                     0x07f1  /* U+03C1 GREEK SMALL LETTER RHO */
+#define XK_Greek_sigma                   0x07f2  /* U+03C3 GREEK SMALL LETTER SIGMA */
+#define XK_Greek_finalsmallsigma         0x07f3  /* U+03C2 GREEK SMALL LETTER FINAL SIGMA */
+#define XK_Greek_tau                     0x07f4  /* U+03C4 GREEK SMALL LETTER TAU */
+#define XK_Greek_upsilon                 0x07f5  /* U+03C5 GREEK SMALL LETTER UPSILON */
+#define XK_Greek_phi                     0x07f6  /* U+03C6 GREEK SMALL LETTER PHI */
+#define XK_Greek_chi                     0x07f7  /* U+03C7 GREEK SMALL LETTER CHI */
+#define XK_Greek_psi                     0x07f8  /* U+03C8 GREEK SMALL LETTER PSI */
+#define XK_Greek_omega                   0x07f9  /* U+03C9 GREEK SMALL LETTER OMEGA */
+#define XK_Greek_switch                  0xff7e  /* Alias for mode_switch */
+#endif /* XK_GREEK */
+
+/*
+ * Technical
+ * (from the DEC VT330/VT420 Technical Character Set, http://vt100.net/charsets/technical.html)
+ * Byte 3 = 8
+ */
+
+#ifdef XK_TECHNICAL
+#define XK_leftradical                   0x08a1  /* U+23B7 RADICAL SYMBOL BOTTOM */
+#define XK_topleftradical                0x08a2  /*(U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT)*/
+#define XK_horizconnector                0x08a3  /*(U+2500 BOX DRAWINGS LIGHT HORIZONTAL)*/
+#define XK_topintegral                   0x08a4  /* U+2320 TOP HALF INTEGRAL */
+#define XK_botintegral                   0x08a5  /* U+2321 BOTTOM HALF INTEGRAL */
+#define XK_vertconnector                 0x08a6  /*(U+2502 BOX DRAWINGS LIGHT VERTICAL)*/
+#define XK_topleftsqbracket              0x08a7  /* U+23A1 LEFT SQUARE BRACKET UPPER CORNER */
+#define XK_botleftsqbracket              0x08a8  /* U+23A3 LEFT SQUARE BRACKET LOWER CORNER */
+#define XK_toprightsqbracket             0x08a9  /* U+23A4 RIGHT SQUARE BRACKET UPPER CORNER */
+#define XK_botrightsqbracket             0x08aa  /* U+23A6 RIGHT SQUARE BRACKET LOWER CORNER */
+#define XK_topleftparens                 0x08ab  /* U+239B LEFT PARENTHESIS UPPER HOOK */
+#define XK_botleftparens                 0x08ac  /* U+239D LEFT PARENTHESIS LOWER HOOK */
+#define XK_toprightparens                0x08ad  /* U+239E RIGHT PARENTHESIS UPPER HOOK */
+#define XK_botrightparens                0x08ae  /* U+23A0 RIGHT PARENTHESIS LOWER HOOK */
+#define XK_leftmiddlecurlybrace          0x08af  /* U+23A8 LEFT CURLY BRACKET MIDDLE PIECE */
+#define XK_rightmiddlecurlybrace         0x08b0  /* U+23AC RIGHT CURLY BRACKET MIDDLE PIECE */
+#define XK_topleftsummation              0x08b1
+#define XK_botleftsummation              0x08b2
+#define XK_topvertsummationconnector     0x08b3
+#define XK_botvertsummationconnector     0x08b4
+#define XK_toprightsummation             0x08b5
+#define XK_botrightsummation             0x08b6
+#define XK_rightmiddlesummation          0x08b7
+#define XK_lessthanequal                 0x08bc  /* U+2264 LESS-THAN OR EQUAL TO */
+#define XK_notequal                      0x08bd  /* U+2260 NOT EQUAL TO */
+#define XK_greaterthanequal              0x08be  /* U+2265 GREATER-THAN OR EQUAL TO */
+#define XK_integral                      0x08bf  /* U+222B INTEGRAL */
+#define XK_therefore                     0x08c0  /* U+2234 THEREFORE */
+#define XK_variation                     0x08c1  /* U+221D PROPORTIONAL TO */
+#define XK_infinity                      0x08c2  /* U+221E INFINITY */
+#define XK_nabla                         0x08c5  /* U+2207 NABLA */
+#define XK_approximate                   0x08c8  /* U+223C TILDE OPERATOR */
+#define XK_similarequal                  0x08c9  /* U+2243 ASYMPTOTICALLY EQUAL TO */
+#define XK_ifonlyif                      0x08cd  /* U+21D4 LEFT RIGHT DOUBLE ARROW */
+#define XK_implies                       0x08ce  /* U+21D2 RIGHTWARDS DOUBLE ARROW */
+#define XK_identical                     0x08cf  /* U+2261 IDENTICAL TO */
+#define XK_radical                       0x08d6  /* U+221A SQUARE ROOT */
+#define XK_includedin                    0x08da  /* U+2282 SUBSET OF */
+#define XK_includes                      0x08db  /* U+2283 SUPERSET OF */
+#define XK_intersection                  0x08dc  /* U+2229 INTERSECTION */
+#define XK_union                         0x08dd  /* U+222A UNION */
+#define XK_logicaland                    0x08de  /* U+2227 LOGICAL AND */
+#define XK_logicalor                     0x08df  /* U+2228 LOGICAL OR */
+#define XK_partialderivative             0x08ef  /* U+2202 PARTIAL DIFFERENTIAL */
+#define XK_function                      0x08f6  /* U+0192 LATIN SMALL LETTER F WITH HOOK */
+#define XK_leftarrow                     0x08fb  /* U+2190 LEFTWARDS ARROW */
+#define XK_uparrow                       0x08fc  /* U+2191 UPWARDS ARROW */
+#define XK_rightarrow                    0x08fd  /* U+2192 RIGHTWARDS ARROW */
+#define XK_downarrow                     0x08fe  /* U+2193 DOWNWARDS ARROW */
+#endif /* XK_TECHNICAL */
+
+/*
+ * Special
+ * (from the DEC VT100 Special Graphics Character Set)
+ * Byte 3 = 9
+ */
+
+#ifdef XK_SPECIAL
+#define XK_blank                         0x09df
+#define XK_soliddiamond                  0x09e0  /* U+25C6 BLACK DIAMOND */
+#define XK_checkerboard                  0x09e1  /* U+2592 MEDIUM SHADE */
+#define XK_ht                            0x09e2  /* U+2409 SYMBOL FOR HORIZONTAL TABULATION */
+#define XK_ff                            0x09e3  /* U+240C SYMBOL FOR FORM FEED */
+#define XK_cr                            0x09e4  /* U+240D SYMBOL FOR CARRIAGE RETURN */
+#define XK_lf                            0x09e5  /* U+240A SYMBOL FOR LINE FEED */
+#define XK_nl                            0x09e8  /* U+2424 SYMBOL FOR NEWLINE */
+#define XK_vt                            0x09e9  /* U+240B SYMBOL FOR VERTICAL TABULATION */
+#define XK_lowrightcorner                0x09ea  /* U+2518 BOX DRAWINGS LIGHT UP AND LEFT */
+#define XK_uprightcorner                 0x09eb  /* U+2510 BOX DRAWINGS LIGHT DOWN AND LEFT */
+#define XK_upleftcorner                  0x09ec  /* U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT */
+#define XK_lowleftcorner                 0x09ed  /* U+2514 BOX DRAWINGS LIGHT UP AND RIGHT */
+#define XK_crossinglines                 0x09ee  /* U+253C BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */
+#define XK_horizlinescan1                0x09ef  /* U+23BA HORIZONTAL SCAN LINE-1 */
+#define XK_horizlinescan3                0x09f0  /* U+23BB HORIZONTAL SCAN LINE-3 */
+#define XK_horizlinescan5                0x09f1  /* U+2500 BOX DRAWINGS LIGHT HORIZONTAL */
+#define XK_horizlinescan7                0x09f2  /* U+23BC HORIZONTAL SCAN LINE-7 */
+#define XK_horizlinescan9                0x09f3  /* U+23BD HORIZONTAL SCAN LINE-9 */
+#define XK_leftt                         0x09f4  /* U+251C BOX DRAWINGS LIGHT VERTICAL AND RIGHT */
+#define XK_rightt                        0x09f5  /* U+2524 BOX DRAWINGS LIGHT VERTICAL AND LEFT */
+#define XK_bott                          0x09f6  /* U+2534 BOX DRAWINGS LIGHT UP AND HORIZONTAL */
+#define XK_topt                          0x09f7  /* U+252C BOX DRAWINGS LIGHT DOWN AND HORIZONTAL */
+#define XK_vertbar                       0x09f8  /* U+2502 BOX DRAWINGS LIGHT VERTICAL */
+#endif /* XK_SPECIAL */
+
+/*
+ * Publishing
+ * (these are probably from a long forgotten DEC Publishing
+ * font that once shipped with DECwrite)
+ * Byte 3 = 0x0a
+ */
+
+#ifdef XK_PUBLISHING
+#define XK_emspace                       0x0aa1  /* U+2003 EM SPACE */
+#define XK_enspace                       0x0aa2  /* U+2002 EN SPACE */
+#define XK_em3space                      0x0aa3  /* U+2004 THREE-PER-EM SPACE */
+#define XK_em4space                      0x0aa4  /* U+2005 FOUR-PER-EM SPACE */
+#define XK_digitspace                    0x0aa5  /* U+2007 FIGURE SPACE */
+#define XK_punctspace                    0x0aa6  /* U+2008 PUNCTUATION SPACE */
+#define XK_thinspace                     0x0aa7  /* U+2009 THIN SPACE */
+#define XK_hairspace                     0x0aa8  /* U+200A HAIR SPACE */
+#define XK_emdash                        0x0aa9  /* U+2014 EM DASH */
+#define XK_endash                        0x0aaa  /* U+2013 EN DASH */
+#define XK_signifblank                   0x0aac  /*(U+2423 OPEN BOX)*/
+#define XK_ellipsis                      0x0aae  /* U+2026 HORIZONTAL ELLIPSIS */
+#define XK_doubbaselinedot               0x0aaf  /* U+2025 TWO DOT LEADER */
+#define XK_onethird                      0x0ab0  /* U+2153 VULGAR FRACTION ONE THIRD */
+#define XK_twothirds                     0x0ab1  /* U+2154 VULGAR FRACTION TWO THIRDS */
+#define XK_onefifth                      0x0ab2  /* U+2155 VULGAR FRACTION ONE FIFTH */
+#define XK_twofifths                     0x0ab3  /* U+2156 VULGAR FRACTION TWO FIFTHS */
+#define XK_threefifths                   0x0ab4  /* U+2157 VULGAR FRACTION THREE FIFTHS */
+#define XK_fourfifths                    0x0ab5  /* U+2158 VULGAR FRACTION FOUR FIFTHS */
+#define XK_onesixth                      0x0ab6  /* U+2159 VULGAR FRACTION ONE SIXTH */
+#define XK_fivesixths                    0x0ab7  /* U+215A VULGAR FRACTION FIVE SIXTHS */
+#define XK_careof                        0x0ab8  /* U+2105 CARE OF */
+#define XK_figdash                       0x0abb  /* U+2012 FIGURE DASH */
+#define XK_leftanglebracket              0x0abc  /*(U+27E8 MATHEMATICAL LEFT ANGLE BRACKET)*/
+#define XK_decimalpoint                  0x0abd  /*(U+002E FULL STOP)*/
+#define XK_rightanglebracket             0x0abe  /*(U+27E9 MATHEMATICAL RIGHT ANGLE BRACKET)*/
+#define XK_marker                        0x0abf
+#define XK_oneeighth                     0x0ac3  /* U+215B VULGAR FRACTION ONE EIGHTH */
+#define XK_threeeighths                  0x0ac4  /* U+215C VULGAR FRACTION THREE EIGHTHS */
+#define XK_fiveeighths                   0x0ac5  /* U+215D VULGAR FRACTION FIVE EIGHTHS */
+#define XK_seveneighths                  0x0ac6  /* U+215E VULGAR FRACTION SEVEN EIGHTHS */
+#define XK_trademark                     0x0ac9  /* U+2122 TRADE MARK SIGN */
+#define XK_signaturemark                 0x0aca  /*(U+2613 SALTIRE)*/
+#define XK_trademarkincircle             0x0acb
+#define XK_leftopentriangle              0x0acc  /*(U+25C1 WHITE LEFT-POINTING TRIANGLE)*/
+#define XK_rightopentriangle             0x0acd  /*(U+25B7 WHITE RIGHT-POINTING TRIANGLE)*/
+#define XK_emopencircle                  0x0ace  /*(U+25CB WHITE CIRCLE)*/
+#define XK_emopenrectangle               0x0acf  /*(U+25AF WHITE VERTICAL RECTANGLE)*/
+#define XK_leftsinglequotemark           0x0ad0  /* U+2018 LEFT SINGLE QUOTATION MARK */
+#define XK_rightsinglequotemark          0x0ad1  /* U+2019 RIGHT SINGLE QUOTATION MARK */
+#define XK_leftdoublequotemark           0x0ad2  /* U+201C LEFT DOUBLE QUOTATION MARK */
+#define XK_rightdoublequotemark          0x0ad3  /* U+201D RIGHT DOUBLE QUOTATION MARK */
+#define XK_prescription                  0x0ad4  /* U+211E PRESCRIPTION TAKE */
+#define XK_permille                      0x0ad5  /* U+2030 PER MILLE SIGN */
+#define XK_minutes                       0x0ad6  /* U+2032 PRIME */
+#define XK_seconds                       0x0ad7  /* U+2033 DOUBLE PRIME */
+#define XK_latincross                    0x0ad9  /* U+271D LATIN CROSS */
+#define XK_hexagram                      0x0ada
+#define XK_filledrectbullet              0x0adb  /*(U+25AC BLACK RECTANGLE)*/
+#define XK_filledlefttribullet           0x0adc  /*(U+25C0 BLACK LEFT-POINTING TRIANGLE)*/
+#define XK_filledrighttribullet          0x0add  /*(U+25B6 BLACK RIGHT-POINTING TRIANGLE)*/
+#define XK_emfilledcircle                0x0ade  /*(U+25CF BLACK CIRCLE)*/
+#define XK_emfilledrect                  0x0adf  /*(U+25AE BLACK VERTICAL RECTANGLE)*/
+#define XK_enopencircbullet              0x0ae0  /*(U+25E6 WHITE BULLET)*/
+#define XK_enopensquarebullet            0x0ae1  /*(U+25AB WHITE SMALL SQUARE)*/
+#define XK_openrectbullet                0x0ae2  /*(U+25AD WHITE RECTANGLE)*/
+#define XK_opentribulletup               0x0ae3  /*(U+25B3 WHITE UP-POINTING TRIANGLE)*/
+#define XK_opentribulletdown             0x0ae4  /*(U+25BD WHITE DOWN-POINTING TRIANGLE)*/
+#define XK_openstar                      0x0ae5  /*(U+2606 WHITE STAR)*/
+#define XK_enfilledcircbullet            0x0ae6  /*(U+2022 BULLET)*/
+#define XK_enfilledsqbullet              0x0ae7  /*(U+25AA BLACK SMALL SQUARE)*/
+#define XK_filledtribulletup             0x0ae8  /*(U+25B2 BLACK UP-POINTING TRIANGLE)*/
+#define XK_filledtribulletdown           0x0ae9  /*(U+25BC BLACK DOWN-POINTING TRIANGLE)*/
+#define XK_leftpointer                   0x0aea  /*(U+261C WHITE LEFT POINTING INDEX)*/
+#define XK_rightpointer                  0x0aeb  /*(U+261E WHITE RIGHT POINTING INDEX)*/
+#define XK_club                          0x0aec  /* U+2663 BLACK CLUB SUIT */
+#define XK_diamond                       0x0aed  /* U+2666 BLACK DIAMOND SUIT */
+#define XK_heart                         0x0aee  /* U+2665 BLACK HEART SUIT */
+#define XK_maltesecross                  0x0af0  /* U+2720 MALTESE CROSS */
+#define XK_dagger                        0x0af1  /* U+2020 DAGGER */
+#define XK_doubledagger                  0x0af2  /* U+2021 DOUBLE DAGGER */
+#define XK_checkmark                     0x0af3  /* U+2713 CHECK MARK */
+#define XK_ballotcross                   0x0af4  /* U+2717 BALLOT X */
+#define XK_musicalsharp                  0x0af5  /* U+266F MUSIC SHARP SIGN */
+#define XK_musicalflat                   0x0af6  /* U+266D MUSIC FLAT SIGN */
+#define XK_malesymbol                    0x0af7  /* U+2642 MALE SIGN */
+#define XK_femalesymbol                  0x0af8  /* U+2640 FEMALE SIGN */
+#define XK_telephone                     0x0af9  /* U+260E BLACK TELEPHONE */
+#define XK_telephonerecorder             0x0afa  /* U+2315 TELEPHONE RECORDER */
+#define XK_phonographcopyright           0x0afb  /* U+2117 SOUND RECORDING COPYRIGHT */
+#define XK_caret                         0x0afc  /* U+2038 CARET */
+#define XK_singlelowquotemark            0x0afd  /* U+201A SINGLE LOW-9 QUOTATION MARK */
+#define XK_doublelowquotemark            0x0afe  /* U+201E DOUBLE LOW-9 QUOTATION MARK */
+#define XK_cursor                        0x0aff
+#endif /* XK_PUBLISHING */
+
+/*
+ * APL
+ * Byte 3 = 0x0b
+ */
+
+#ifdef XK_APL
+#define XK_leftcaret                     0x0ba3  /*(U+003C LESS-THAN SIGN)*/
+#define XK_rightcaret                    0x0ba6  /*(U+003E GREATER-THAN SIGN)*/
+#define XK_downcaret                     0x0ba8  /*(U+2228 LOGICAL OR)*/
+#define XK_upcaret                       0x0ba9  /*(U+2227 LOGICAL AND)*/
+#define XK_overbar                       0x0bc0  /*(U+00AF MACRON)*/
+#define XK_downtack                      0x0bc2  /* U+22A4 DOWN TACK */
+#define XK_upshoe                        0x0bc3  /*(U+2229 INTERSECTION)*/
+#define XK_downstile                     0x0bc4  /* U+230A LEFT FLOOR */
+#define XK_underbar                      0x0bc6  /*(U+005F LOW LINE)*/
+#define XK_jot                           0x0bca  /* U+2218 RING OPERATOR */
+#define XK_quad                          0x0bcc  /* U+2395 APL FUNCTIONAL SYMBOL QUAD */
+#define XK_uptack                        0x0bce  /* U+22A5 UP TACK */
+#define XK_circle                        0x0bcf  /* U+25CB WHITE CIRCLE */
+#define XK_upstile                       0x0bd3  /* U+2308 LEFT CEILING */
+#define XK_downshoe                      0x0bd6  /*(U+222A UNION)*/
+#define XK_rightshoe                     0x0bd8  /*(U+2283 SUPERSET OF)*/
+#define XK_leftshoe                      0x0bda  /*(U+2282 SUBSET OF)*/
+#define XK_lefttack                      0x0bdc  /* U+22A3 LEFT TACK */
+#define XK_righttack                     0x0bfc  /* U+22A2 RIGHT TACK */
+#endif /* XK_APL */
+
+/*
+ * Hebrew
+ * Byte 3 = 0x0c
+ */
+
+#ifdef XK_HEBREW
+#define XK_hebrew_doublelowline          0x0cdf  /* U+2017 DOUBLE LOW LINE */
+#define XK_hebrew_aleph                  0x0ce0  /* U+05D0 HEBREW LETTER ALEF */
+#define XK_hebrew_bet                    0x0ce1  /* U+05D1 HEBREW LETTER BET */
+#define XK_hebrew_beth                   0x0ce1  /* deprecated */
+#define XK_hebrew_gimel                  0x0ce2  /* U+05D2 HEBREW LETTER GIMEL */
+#define XK_hebrew_gimmel                 0x0ce2  /* deprecated */
+#define XK_hebrew_dalet                  0x0ce3  /* U+05D3 HEBREW LETTER DALET */
+#define XK_hebrew_daleth                 0x0ce3  /* deprecated */
+#define XK_hebrew_he                     0x0ce4  /* U+05D4 HEBREW LETTER HE */
+#define XK_hebrew_waw                    0x0ce5  /* U+05D5 HEBREW LETTER VAV */
+#define XK_hebrew_zain                   0x0ce6  /* U+05D6 HEBREW LETTER ZAYIN */
+#define XK_hebrew_zayin                  0x0ce6  /* deprecated */
+#define XK_hebrew_chet                   0x0ce7  /* U+05D7 HEBREW LETTER HET */
+#define XK_hebrew_het                    0x0ce7  /* deprecated */
+#define XK_hebrew_tet                    0x0ce8  /* U+05D8 HEBREW LETTER TET */
+#define XK_hebrew_teth                   0x0ce8  /* deprecated */
+#define XK_hebrew_yod                    0x0ce9  /* U+05D9 HEBREW LETTER YOD */
+#define XK_hebrew_finalkaph              0x0cea  /* U+05DA HEBREW LETTER FINAL KAF */
+#define XK_hebrew_kaph                   0x0ceb  /* U+05DB HEBREW LETTER KAF */
+#define XK_hebrew_lamed                  0x0cec  /* U+05DC HEBREW LETTER LAMED */
+#define XK_hebrew_finalmem               0x0ced  /* U+05DD HEBREW LETTER FINAL MEM */
+#define XK_hebrew_mem                    0x0cee  /* U+05DE HEBREW LETTER MEM */
+#define XK_hebrew_finalnun               0x0cef  /* U+05DF HEBREW LETTER FINAL NUN */
+#define XK_hebrew_nun                    0x0cf0  /* U+05E0 HEBREW LETTER NUN */
+#define XK_hebrew_samech                 0x0cf1  /* U+05E1 HEBREW LETTER SAMEKH */
+#define XK_hebrew_samekh                 0x0cf1  /* deprecated */
+#define XK_hebrew_ayin                   0x0cf2  /* U+05E2 HEBREW LETTER AYIN */
+#define XK_hebrew_finalpe                0x0cf3  /* U+05E3 HEBREW LETTER FINAL PE */
+#define XK_hebrew_pe                     0x0cf4  /* U+05E4 HEBREW LETTER PE */
+#define XK_hebrew_finalzade              0x0cf5  /* U+05E5 HEBREW LETTER FINAL TSADI */
+#define XK_hebrew_finalzadi              0x0cf5  /* deprecated */
+#define XK_hebrew_zade                   0x0cf6  /* U+05E6 HEBREW LETTER TSADI */
+#define XK_hebrew_zadi                   0x0cf6  /* deprecated */
+#define XK_hebrew_qoph                   0x0cf7  /* U+05E7 HEBREW LETTER QOF */
+#define XK_hebrew_kuf                    0x0cf7  /* deprecated */
+#define XK_hebrew_resh                   0x0cf8  /* U+05E8 HEBREW LETTER RESH */
+#define XK_hebrew_shin                   0x0cf9  /* U+05E9 HEBREW LETTER SHIN */
+#define XK_hebrew_taw                    0x0cfa  /* U+05EA HEBREW LETTER TAV */
+#define XK_hebrew_taf                    0x0cfa  /* deprecated */
+#define XK_Hebrew_switch                 0xff7e  /* Alias for mode_switch */
+#endif /* XK_HEBREW */
+
+/*
+ * Thai
+ * Byte 3 = 0x0d
+ */
+
+#ifdef XK_THAI
+#define XK_Thai_kokai                    0x0da1  /* U+0E01 THAI CHARACTER KO KAI */
+#define XK_Thai_khokhai                  0x0da2  /* U+0E02 THAI CHARACTER KHO KHAI */
+#define XK_Thai_khokhuat                 0x0da3  /* U+0E03 THAI CHARACTER KHO KHUAT */
+#define XK_Thai_khokhwai                 0x0da4  /* U+0E04 THAI CHARACTER KHO KHWAI */
+#define XK_Thai_khokhon                  0x0da5  /* U+0E05 THAI CHARACTER KHO KHON */
+#define XK_Thai_khorakhang               0x0da6  /* U+0E06 THAI CHARACTER KHO RAKHANG */
+#define XK_Thai_ngongu                   0x0da7  /* U+0E07 THAI CHARACTER NGO NGU */
+#define XK_Thai_chochan                  0x0da8  /* U+0E08 THAI CHARACTER CHO CHAN */
+#define XK_Thai_choching                 0x0da9  /* U+0E09 THAI CHARACTER CHO CHING */
+#define XK_Thai_chochang                 0x0daa  /* U+0E0A THAI CHARACTER CHO CHANG */
+#define XK_Thai_soso                     0x0dab  /* U+0E0B THAI CHARACTER SO SO */
+#define XK_Thai_chochoe                  0x0dac  /* U+0E0C THAI CHARACTER CHO CHOE */
+#define XK_Thai_yoying                   0x0dad  /* U+0E0D THAI CHARACTER YO YING */
+#define XK_Thai_dochada                  0x0dae  /* U+0E0E THAI CHARACTER DO CHADA */
+#define XK_Thai_topatak                  0x0daf  /* U+0E0F THAI CHARACTER TO PATAK */
+#define XK_Thai_thothan                  0x0db0  /* U+0E10 THAI CHARACTER THO THAN */
+#define XK_Thai_thonangmontho            0x0db1  /* U+0E11 THAI CHARACTER THO NANGMONTHO */
+#define XK_Thai_thophuthao               0x0db2  /* U+0E12 THAI CHARACTER THO PHUTHAO */
+#define XK_Thai_nonen                    0x0db3  /* U+0E13 THAI CHARACTER NO NEN */
+#define XK_Thai_dodek                    0x0db4  /* U+0E14 THAI CHARACTER DO DEK */
+#define XK_Thai_totao                    0x0db5  /* U+0E15 THAI CHARACTER TO TAO */
+#define XK_Thai_thothung                 0x0db6  /* U+0E16 THAI CHARACTER THO THUNG */
+#define XK_Thai_thothahan                0x0db7  /* U+0E17 THAI CHARACTER THO THAHAN */
+#define XK_Thai_thothong                 0x0db8  /* U+0E18 THAI CHARACTER THO THONG */
+#define XK_Thai_nonu                     0x0db9  /* U+0E19 THAI CHARACTER NO NU */
+#define XK_Thai_bobaimai                 0x0dba  /* U+0E1A THAI CHARACTER BO BAIMAI */
+#define XK_Thai_popla                    0x0dbb  /* U+0E1B THAI CHARACTER PO PLA */
+#define XK_Thai_phophung                 0x0dbc  /* U+0E1C THAI CHARACTER PHO PHUNG */
+#define XK_Thai_fofa                     0x0dbd  /* U+0E1D THAI CHARACTER FO FA */
+#define XK_Thai_phophan                  0x0dbe  /* U+0E1E THAI CHARACTER PHO PHAN */
+#define XK_Thai_fofan                    0x0dbf  /* U+0E1F THAI CHARACTER FO FAN */
+#define XK_Thai_phosamphao               0x0dc0  /* U+0E20 THAI CHARACTER PHO SAMPHAO */
+#define XK_Thai_moma                     0x0dc1  /* U+0E21 THAI CHARACTER MO MA */
+#define XK_Thai_yoyak                    0x0dc2  /* U+0E22 THAI CHARACTER YO YAK */
+#define XK_Thai_rorua                    0x0dc3  /* U+0E23 THAI CHARACTER RO RUA */
+#define XK_Thai_ru                       0x0dc4  /* U+0E24 THAI CHARACTER RU */
+#define XK_Thai_loling                   0x0dc5  /* U+0E25 THAI CHARACTER LO LING */
+#define XK_Thai_lu                       0x0dc6  /* U+0E26 THAI CHARACTER LU */
+#define XK_Thai_wowaen                   0x0dc7  /* U+0E27 THAI CHARACTER WO WAEN */
+#define XK_Thai_sosala                   0x0dc8  /* U+0E28 THAI CHARACTER SO SALA */
+#define XK_Thai_sorusi                   0x0dc9  /* U+0E29 THAI CHARACTER SO RUSI */
+#define XK_Thai_sosua                    0x0dca  /* U+0E2A THAI CHARACTER SO SUA */
+#define XK_Thai_hohip                    0x0dcb  /* U+0E2B THAI CHARACTER HO HIP */
+#define XK_Thai_lochula                  0x0dcc  /* U+0E2C THAI CHARACTER LO CHULA */
+#define XK_Thai_oang                     0x0dcd  /* U+0E2D THAI CHARACTER O ANG */
+#define XK_Thai_honokhuk                 0x0dce  /* U+0E2E THAI CHARACTER HO NOKHUK */
+#define XK_Thai_paiyannoi                0x0dcf  /* U+0E2F THAI CHARACTER PAIYANNOI */
+#define XK_Thai_saraa                    0x0dd0  /* U+0E30 THAI CHARACTER SARA A */
+#define XK_Thai_maihanakat               0x0dd1  /* U+0E31 THAI CHARACTER MAI HAN-AKAT */
+#define XK_Thai_saraaa                   0x0dd2  /* U+0E32 THAI CHARACTER SARA AA */
+#define XK_Thai_saraam                   0x0dd3  /* U+0E33 THAI CHARACTER SARA AM */
+#define XK_Thai_sarai                    0x0dd4  /* U+0E34 THAI CHARACTER SARA I */
+#define XK_Thai_saraii                   0x0dd5  /* U+0E35 THAI CHARACTER SARA II */
+#define XK_Thai_saraue                   0x0dd6  /* U+0E36 THAI CHARACTER SARA UE */
+#define XK_Thai_sarauee                  0x0dd7  /* U+0E37 THAI CHARACTER SARA UEE */
+#define XK_Thai_sarau                    0x0dd8  /* U+0E38 THAI CHARACTER SARA U */
+#define XK_Thai_sarauu                   0x0dd9  /* U+0E39 THAI CHARACTER SARA UU */
+#define XK_Thai_phinthu                  0x0dda  /* U+0E3A THAI CHARACTER PHINTHU */
+#define XK_Thai_maihanakat_maitho        0x0dde
+#define XK_Thai_baht                     0x0ddf  /* U+0E3F THAI CURRENCY SYMBOL BAHT */
+#define XK_Thai_sarae                    0x0de0  /* U+0E40 THAI CHARACTER SARA E */
+#define XK_Thai_saraae                   0x0de1  /* U+0E41 THAI CHARACTER SARA AE */
+#define XK_Thai_sarao                    0x0de2  /* U+0E42 THAI CHARACTER SARA O */
+#define XK_Thai_saraaimaimuan            0x0de3  /* U+0E43 THAI CHARACTER SARA AI MAIMUAN */
+#define XK_Thai_saraaimaimalai           0x0de4  /* U+0E44 THAI CHARACTER SARA AI MAIMALAI */
+#define XK_Thai_lakkhangyao              0x0de5  /* U+0E45 THAI CHARACTER LAKKHANGYAO */
+#define XK_Thai_maiyamok                 0x0de6  /* U+0E46 THAI CHARACTER MAIYAMOK */
+#define XK_Thai_maitaikhu                0x0de7  /* U+0E47 THAI CHARACTER MAITAIKHU */
+#define XK_Thai_maiek                    0x0de8  /* U+0E48 THAI CHARACTER MAI EK */
+#define XK_Thai_maitho                   0x0de9  /* U+0E49 THAI CHARACTER MAI THO */
+#define XK_Thai_maitri                   0x0dea  /* U+0E4A THAI CHARACTER MAI TRI */
+#define XK_Thai_maichattawa              0x0deb  /* U+0E4B THAI CHARACTER MAI CHATTAWA */
+#define XK_Thai_thanthakhat              0x0dec  /* U+0E4C THAI CHARACTER THANTHAKHAT */
+#define XK_Thai_nikhahit                 0x0ded  /* U+0E4D THAI CHARACTER NIKHAHIT */
+#define XK_Thai_leksun                   0x0df0  /* U+0E50 THAI DIGIT ZERO */
+#define XK_Thai_leknung                  0x0df1  /* U+0E51 THAI DIGIT ONE */
+#define XK_Thai_leksong                  0x0df2  /* U+0E52 THAI DIGIT TWO */
+#define XK_Thai_leksam                   0x0df3  /* U+0E53 THAI DIGIT THREE */
+#define XK_Thai_leksi                    0x0df4  /* U+0E54 THAI DIGIT FOUR */
+#define XK_Thai_lekha                    0x0df5  /* U+0E55 THAI DIGIT FIVE */
+#define XK_Thai_lekhok                   0x0df6  /* U+0E56 THAI DIGIT SIX */
+#define XK_Thai_lekchet                  0x0df7  /* U+0E57 THAI DIGIT SEVEN */
+#define XK_Thai_lekpaet                  0x0df8  /* U+0E58 THAI DIGIT EIGHT */
+#define XK_Thai_lekkao                   0x0df9  /* U+0E59 THAI DIGIT NINE */
+#endif /* XK_THAI */
+
+/*
+ * Korean
+ * Byte 3 = 0x0e
+ */
+
+#ifdef XK_KOREAN
+
+#define XK_Hangul                        0xff31  /* Hangul start/stop(toggle) */
+#define XK_Hangul_Start                  0xff32  /* Hangul start */
+#define XK_Hangul_End                    0xff33  /* Hangul end, English start */
+#define XK_Hangul_Hanja                  0xff34  /* Start Hangul->Hanja Conversion */
+#define XK_Hangul_Jamo                   0xff35  /* Hangul Jamo mode */
+#define XK_Hangul_Romaja                 0xff36  /* Hangul Romaja mode */
+#define XK_Hangul_Codeinput              0xff37  /* Hangul code input mode */
+#define XK_Hangul_Jeonja                 0xff38  /* Jeonja mode */
+#define XK_Hangul_Banja                  0xff39  /* Banja mode */
+#define XK_Hangul_PreHanja               0xff3a  /* Pre Hanja conversion */
+#define XK_Hangul_PostHanja              0xff3b  /* Post Hanja conversion */
+#define XK_Hangul_SingleCandidate        0xff3c  /* Single candidate */
+#define XK_Hangul_MultipleCandidate      0xff3d  /* Multiple candidate */
+#define XK_Hangul_PreviousCandidate      0xff3e  /* Previous candidate */
+#define XK_Hangul_Special                0xff3f  /* Special symbols */
+#define XK_Hangul_switch                 0xff7e  /* Alias for mode_switch */
+
+/* Hangul Consonant Characters */
+#define XK_Hangul_Kiyeog                 0x0ea1
+#define XK_Hangul_SsangKiyeog            0x0ea2
+#define XK_Hangul_KiyeogSios             0x0ea3
+#define XK_Hangul_Nieun                  0x0ea4
+#define XK_Hangul_NieunJieuj             0x0ea5
+#define XK_Hangul_NieunHieuh             0x0ea6
+#define XK_Hangul_Dikeud                 0x0ea7
+#define XK_Hangul_SsangDikeud            0x0ea8
+#define XK_Hangul_Rieul                  0x0ea9
+#define XK_Hangul_RieulKiyeog            0x0eaa
+#define XK_Hangul_RieulMieum             0x0eab
+#define XK_Hangul_RieulPieub             0x0eac
+#define XK_Hangul_RieulSios              0x0ead
+#define XK_Hangul_RieulTieut             0x0eae
+#define XK_Hangul_RieulPhieuf            0x0eaf
+#define XK_Hangul_RieulHieuh             0x0eb0
+#define XK_Hangul_Mieum                  0x0eb1
+#define XK_Hangul_Pieub                  0x0eb2
+#define XK_Hangul_SsangPieub             0x0eb3
+#define XK_Hangul_PieubSios              0x0eb4
+#define XK_Hangul_Sios                   0x0eb5
+#define XK_Hangul_SsangSios              0x0eb6
+#define XK_Hangul_Ieung                  0x0eb7
+#define XK_Hangul_Jieuj                  0x0eb8
+#define XK_Hangul_SsangJieuj             0x0eb9
+#define XK_Hangul_Cieuc                  0x0eba
+#define XK_Hangul_Khieuq                 0x0ebb
+#define XK_Hangul_Tieut                  0x0ebc
+#define XK_Hangul_Phieuf                 0x0ebd
+#define XK_Hangul_Hieuh                  0x0ebe
+
+/* Hangul Vowel Characters */
+#define XK_Hangul_A                      0x0ebf
+#define XK_Hangul_AE                     0x0ec0
+#define XK_Hangul_YA                     0x0ec1
+#define XK_Hangul_YAE                    0x0ec2
+#define XK_Hangul_EO                     0x0ec3
+#define XK_Hangul_E                      0x0ec4
+#define XK_Hangul_YEO                    0x0ec5
+#define XK_Hangul_YE                     0x0ec6
+#define XK_Hangul_O                      0x0ec7
+#define XK_Hangul_WA                     0x0ec8
+#define XK_Hangul_WAE                    0x0ec9
+#define XK_Hangul_OE                     0x0eca
+#define XK_Hangul_YO                     0x0ecb
+#define XK_Hangul_U                      0x0ecc
+#define XK_Hangul_WEO                    0x0ecd
+#define XK_Hangul_WE                     0x0ece
+#define XK_Hangul_WI                     0x0ecf
+#define XK_Hangul_YU                     0x0ed0
+#define XK_Hangul_EU                     0x0ed1
+#define XK_Hangul_YI                     0x0ed2
+#define XK_Hangul_I                      0x0ed3
+
+/* Hangul syllable-final (JongSeong) Characters */
+#define XK_Hangul_J_Kiyeog               0x0ed4
+#define XK_Hangul_J_SsangKiyeog          0x0ed5
+#define XK_Hangul_J_KiyeogSios           0x0ed6
+#define XK_Hangul_J_Nieun                0x0ed7
+#define XK_Hangul_J_NieunJieuj           0x0ed8
+#define XK_Hangul_J_NieunHieuh           0x0ed9
+#define XK_Hangul_J_Dikeud               0x0eda
+#define XK_Hangul_J_Rieul                0x0edb
+#define XK_Hangul_J_RieulKiyeog          0x0edc
+#define XK_Hangul_J_RieulMieum           0x0edd
+#define XK_Hangul_J_RieulPieub           0x0ede
+#define XK_Hangul_J_RieulSios            0x0edf
+#define XK_Hangul_J_RieulTieut           0x0ee0
+#define XK_Hangul_J_RieulPhieuf          0x0ee1
+#define XK_Hangul_J_RieulHieuh           0x0ee2
+#define XK_Hangul_J_Mieum                0x0ee3
+#define XK_Hangul_J_Pieub                0x0ee4
+#define XK_Hangul_J_PieubSios            0x0ee5
+#define XK_Hangul_J_Sios                 0x0ee6
+#define XK_Hangul_J_SsangSios            0x0ee7
+#define XK_Hangul_J_Ieung                0x0ee8
+#define XK_Hangul_J_Jieuj                0x0ee9
+#define XK_Hangul_J_Cieuc                0x0eea
+#define XK_Hangul_J_Khieuq               0x0eeb
+#define XK_Hangul_J_Tieut                0x0eec
+#define XK_Hangul_J_Phieuf               0x0eed
+#define XK_Hangul_J_Hieuh                0x0eee
+
+/* Ancient Hangul Consonant Characters */
+#define XK_Hangul_RieulYeorinHieuh       0x0eef
+#define XK_Hangul_SunkyeongeumMieum      0x0ef0
+#define XK_Hangul_SunkyeongeumPieub      0x0ef1
+#define XK_Hangul_PanSios                0x0ef2
+#define XK_Hangul_KkogjiDalrinIeung      0x0ef3
+#define XK_Hangul_SunkyeongeumPhieuf     0x0ef4
+#define XK_Hangul_YeorinHieuh            0x0ef5
+
+/* Ancient Hangul Vowel Characters */
+#define XK_Hangul_AraeA                  0x0ef6
+#define XK_Hangul_AraeAE                 0x0ef7
+
+/* Ancient Hangul syllable-final (JongSeong) Characters */
+#define XK_Hangul_J_PanSios              0x0ef8
+#define XK_Hangul_J_KkogjiDalrinIeung    0x0ef9
+#define XK_Hangul_J_YeorinHieuh          0x0efa
+
+/* Korean currency symbol */
+#define XK_Korean_Won                    0x0eff  /*(U+20A9 WON SIGN)*/
+
+#endif /* XK_KOREAN */
+
+/*
+ * Armenian
+ */
+
+#ifdef XK_ARMENIAN
+#define XK_Armenian_ligature_ew       0x1000587  /* U+0587 ARMENIAN SMALL LIGATURE ECH YIWN */
+#define XK_Armenian_full_stop         0x1000589  /* U+0589 ARMENIAN FULL STOP */
+#define XK_Armenian_verjaket          0x1000589  /* U+0589 ARMENIAN FULL STOP */
+#define XK_Armenian_separation_mark   0x100055d  /* U+055D ARMENIAN COMMA */
+#define XK_Armenian_but               0x100055d  /* U+055D ARMENIAN COMMA */
+#define XK_Armenian_hyphen            0x100058a  /* U+058A ARMENIAN HYPHEN */
+#define XK_Armenian_yentamna          0x100058a  /* U+058A ARMENIAN HYPHEN */
+#define XK_Armenian_exclam            0x100055c  /* U+055C ARMENIAN EXCLAMATION MARK */
+#define XK_Armenian_amanak            0x100055c  /* U+055C ARMENIAN EXCLAMATION MARK */
+#define XK_Armenian_accent            0x100055b  /* U+055B ARMENIAN EMPHASIS MARK */
+#define XK_Armenian_shesht            0x100055b  /* U+055B ARMENIAN EMPHASIS MARK */
+#define XK_Armenian_question          0x100055e  /* U+055E ARMENIAN QUESTION MARK */
+#define XK_Armenian_paruyk            0x100055e  /* U+055E ARMENIAN QUESTION MARK */
+#define XK_Armenian_AYB               0x1000531  /* U+0531 ARMENIAN CAPITAL LETTER AYB */
+#define XK_Armenian_ayb               0x1000561  /* U+0561 ARMENIAN SMALL LETTER AYB */
+#define XK_Armenian_BEN               0x1000532  /* U+0532 ARMENIAN CAPITAL LETTER BEN */
+#define XK_Armenian_ben               0x1000562  /* U+0562 ARMENIAN SMALL LETTER BEN */
+#define XK_Armenian_GIM               0x1000533  /* U+0533 ARMENIAN CAPITAL LETTER GIM */
+#define XK_Armenian_gim               0x1000563  /* U+0563 ARMENIAN SMALL LETTER GIM */
+#define XK_Armenian_DA                0x1000534  /* U+0534 ARMENIAN CAPITAL LETTER DA */
+#define XK_Armenian_da                0x1000564  /* U+0564 ARMENIAN SMALL LETTER DA */
+#define XK_Armenian_YECH              0x1000535  /* U+0535 ARMENIAN CAPITAL LETTER ECH */
+#define XK_Armenian_yech              0x1000565  /* U+0565 ARMENIAN SMALL LETTER ECH */
+#define XK_Armenian_ZA                0x1000536  /* U+0536 ARMENIAN CAPITAL LETTER ZA */
+#define XK_Armenian_za                0x1000566  /* U+0566 ARMENIAN SMALL LETTER ZA */
+#define XK_Armenian_E                 0x1000537  /* U+0537 ARMENIAN CAPITAL LETTER EH */
+#define XK_Armenian_e                 0x1000567  /* U+0567 ARMENIAN SMALL LETTER EH */
+#define XK_Armenian_AT                0x1000538  /* U+0538 ARMENIAN CAPITAL LETTER ET */
+#define XK_Armenian_at                0x1000568  /* U+0568 ARMENIAN SMALL LETTER ET */
+#define XK_Armenian_TO                0x1000539  /* U+0539 ARMENIAN CAPITAL LETTER TO */
+#define XK_Armenian_to                0x1000569  /* U+0569 ARMENIAN SMALL LETTER TO */
+#define XK_Armenian_ZHE               0x100053a  /* U+053A ARMENIAN CAPITAL LETTER ZHE */
+#define XK_Armenian_zhe               0x100056a  /* U+056A ARMENIAN SMALL LETTER ZHE */
+#define XK_Armenian_INI               0x100053b  /* U+053B ARMENIAN CAPITAL LETTER INI */
+#define XK_Armenian_ini               0x100056b  /* U+056B ARMENIAN SMALL LETTER INI */
+#define XK_Armenian_LYUN              0x100053c  /* U+053C ARMENIAN CAPITAL LETTER LIWN */
+#define XK_Armenian_lyun              0x100056c  /* U+056C ARMENIAN SMALL LETTER LIWN */
+#define XK_Armenian_KHE               0x100053d  /* U+053D ARMENIAN CAPITAL LETTER XEH */
+#define XK_Armenian_khe               0x100056d  /* U+056D ARMENIAN SMALL LETTER XEH */
+#define XK_Armenian_TSA               0x100053e  /* U+053E ARMENIAN CAPITAL LETTER CA */
+#define XK_Armenian_tsa               0x100056e  /* U+056E ARMENIAN SMALL LETTER CA */
+#define XK_Armenian_KEN               0x100053f  /* U+053F ARMENIAN CAPITAL LETTER KEN */
+#define XK_Armenian_ken               0x100056f  /* U+056F ARMENIAN SMALL LETTER KEN */
+#define XK_Armenian_HO                0x1000540  /* U+0540 ARMENIAN CAPITAL LETTER HO */
+#define XK_Armenian_ho                0x1000570  /* U+0570 ARMENIAN SMALL LETTER HO */
+#define XK_Armenian_DZA               0x1000541  /* U+0541 ARMENIAN CAPITAL LETTER JA */
+#define XK_Armenian_dza               0x1000571  /* U+0571 ARMENIAN SMALL LETTER JA */
+#define XK_Armenian_GHAT              0x1000542  /* U+0542 ARMENIAN CAPITAL LETTER GHAD */
+#define XK_Armenian_ghat              0x1000572  /* U+0572 ARMENIAN SMALL LETTER GHAD */
+#define XK_Armenian_TCHE              0x1000543  /* U+0543 ARMENIAN CAPITAL LETTER CHEH */
+#define XK_Armenian_tche              0x1000573  /* U+0573 ARMENIAN SMALL LETTER CHEH */
+#define XK_Armenian_MEN               0x1000544  /* U+0544 ARMENIAN CAPITAL LETTER MEN */
+#define XK_Armenian_men               0x1000574  /* U+0574 ARMENIAN SMALL LETTER MEN */
+#define XK_Armenian_HI                0x1000545  /* U+0545 ARMENIAN CAPITAL LETTER YI */
+#define XK_Armenian_hi                0x1000575  /* U+0575 ARMENIAN SMALL LETTER YI */
+#define XK_Armenian_NU                0x1000546  /* U+0546 ARMENIAN CAPITAL LETTER NOW */
+#define XK_Armenian_nu                0x1000576  /* U+0576 ARMENIAN SMALL LETTER NOW */
+#define XK_Armenian_SHA               0x1000547  /* U+0547 ARMENIAN CAPITAL LETTER SHA */
+#define XK_Armenian_sha               0x1000577  /* U+0577 ARMENIAN SMALL LETTER SHA */
+#define XK_Armenian_VO                0x1000548  /* U+0548 ARMENIAN CAPITAL LETTER VO */
+#define XK_Armenian_vo                0x1000578  /* U+0578 ARMENIAN SMALL LETTER VO */
+#define XK_Armenian_CHA               0x1000549  /* U+0549 ARMENIAN CAPITAL LETTER CHA */
+#define XK_Armenian_cha               0x1000579  /* U+0579 ARMENIAN SMALL LETTER CHA */
+#define XK_Armenian_PE                0x100054a  /* U+054A ARMENIAN CAPITAL LETTER PEH */
+#define XK_Armenian_pe                0x100057a  /* U+057A ARMENIAN SMALL LETTER PEH */
+#define XK_Armenian_JE                0x100054b  /* U+054B ARMENIAN CAPITAL LETTER JHEH */
+#define XK_Armenian_je                0x100057b  /* U+057B ARMENIAN SMALL LETTER JHEH */
+#define XK_Armenian_RA                0x100054c  /* U+054C ARMENIAN CAPITAL LETTER RA */
+#define XK_Armenian_ra                0x100057c  /* U+057C ARMENIAN SMALL LETTER RA */
+#define XK_Armenian_SE                0x100054d  /* U+054D ARMENIAN CAPITAL LETTER SEH */
+#define XK_Armenian_se                0x100057d  /* U+057D ARMENIAN SMALL LETTER SEH */
+#define XK_Armenian_VEV               0x100054e  /* U+054E ARMENIAN CAPITAL LETTER VEW */
+#define XK_Armenian_vev               0x100057e  /* U+057E ARMENIAN SMALL LETTER VEW */
+#define XK_Armenian_TYUN              0x100054f  /* U+054F ARMENIAN CAPITAL LETTER TIWN */
+#define XK_Armenian_tyun              0x100057f  /* U+057F ARMENIAN SMALL LETTER TIWN */
+#define XK_Armenian_RE                0x1000550  /* U+0550 ARMENIAN CAPITAL LETTER REH */
+#define XK_Armenian_re                0x1000580  /* U+0580 ARMENIAN SMALL LETTER REH */
+#define XK_Armenian_TSO               0x1000551  /* U+0551 ARMENIAN CAPITAL LETTER CO */
+#define XK_Armenian_tso               0x1000581  /* U+0581 ARMENIAN SMALL LETTER CO */
+#define XK_Armenian_VYUN              0x1000552  /* U+0552 ARMENIAN CAPITAL LETTER YIWN */
+#define XK_Armenian_vyun              0x1000582  /* U+0582 ARMENIAN SMALL LETTER YIWN */
+#define XK_Armenian_PYUR              0x1000553  /* U+0553 ARMENIAN CAPITAL LETTER PIWR */
+#define XK_Armenian_pyur              0x1000583  /* U+0583 ARMENIAN SMALL LETTER PIWR */
+#define XK_Armenian_KE                0x1000554  /* U+0554 ARMENIAN CAPITAL LETTER KEH */
+#define XK_Armenian_ke                0x1000584  /* U+0584 ARMENIAN SMALL LETTER KEH */
+#define XK_Armenian_O                 0x1000555  /* U+0555 ARMENIAN CAPITAL LETTER OH */
+#define XK_Armenian_o                 0x1000585  /* U+0585 ARMENIAN SMALL LETTER OH */
+#define XK_Armenian_FE                0x1000556  /* U+0556 ARMENIAN CAPITAL LETTER FEH */
+#define XK_Armenian_fe                0x1000586  /* U+0586 ARMENIAN SMALL LETTER FEH */
+#define XK_Armenian_apostrophe        0x100055a  /* U+055A ARMENIAN APOSTROPHE */
+#endif /* XK_ARMENIAN */
+
+/*
+ * Georgian
+ */
+
+#ifdef XK_GEORGIAN
+#define XK_Georgian_an                0x10010d0  /* U+10D0 GEORGIAN LETTER AN */
+#define XK_Georgian_ban               0x10010d1  /* U+10D1 GEORGIAN LETTER BAN */
+#define XK_Georgian_gan               0x10010d2  /* U+10D2 GEORGIAN LETTER GAN */
+#define XK_Georgian_don               0x10010d3  /* U+10D3 GEORGIAN LETTER DON */
+#define XK_Georgian_en                0x10010d4  /* U+10D4 GEORGIAN LETTER EN */
+#define XK_Georgian_vin               0x10010d5  /* U+10D5 GEORGIAN LETTER VIN */
+#define XK_Georgian_zen               0x10010d6  /* U+10D6 GEORGIAN LETTER ZEN */
+#define XK_Georgian_tan               0x10010d7  /* U+10D7 GEORGIAN LETTER TAN */
+#define XK_Georgian_in                0x10010d8  /* U+10D8 GEORGIAN LETTER IN */
+#define XK_Georgian_kan               0x10010d9  /* U+10D9 GEORGIAN LETTER KAN */
+#define XK_Georgian_las               0x10010da  /* U+10DA GEORGIAN LETTER LAS */
+#define XK_Georgian_man               0x10010db  /* U+10DB GEORGIAN LETTER MAN */
+#define XK_Georgian_nar               0x10010dc  /* U+10DC GEORGIAN LETTER NAR */
+#define XK_Georgian_on                0x10010dd  /* U+10DD GEORGIAN LETTER ON */
+#define XK_Georgian_par               0x10010de  /* U+10DE GEORGIAN LETTER PAR */
+#define XK_Georgian_zhar              0x10010df  /* U+10DF GEORGIAN LETTER ZHAR */
+#define XK_Georgian_rae               0x10010e0  /* U+10E0 GEORGIAN LETTER RAE */
+#define XK_Georgian_san               0x10010e1  /* U+10E1 GEORGIAN LETTER SAN */
+#define XK_Georgian_tar               0x10010e2  /* U+10E2 GEORGIAN LETTER TAR */
+#define XK_Georgian_un                0x10010e3  /* U+10E3 GEORGIAN LETTER UN */
+#define XK_Georgian_phar              0x10010e4  /* U+10E4 GEORGIAN LETTER PHAR */
+#define XK_Georgian_khar              0x10010e5  /* U+10E5 GEORGIAN LETTER KHAR */
+#define XK_Georgian_ghan              0x10010e6  /* U+10E6 GEORGIAN LETTER GHAN */
+#define XK_Georgian_qar               0x10010e7  /* U+10E7 GEORGIAN LETTER QAR */
+#define XK_Georgian_shin              0x10010e8  /* U+10E8 GEORGIAN LETTER SHIN */
+#define XK_Georgian_chin              0x10010e9  /* U+10E9 GEORGIAN LETTER CHIN */
+#define XK_Georgian_can               0x10010ea  /* U+10EA GEORGIAN LETTER CAN */
+#define XK_Georgian_jil               0x10010eb  /* U+10EB GEORGIAN LETTER JIL */
+#define XK_Georgian_cil               0x10010ec  /* U+10EC GEORGIAN LETTER CIL */
+#define XK_Georgian_char              0x10010ed  /* U+10ED GEORGIAN LETTER CHAR */
+#define XK_Georgian_xan               0x10010ee  /* U+10EE GEORGIAN LETTER XAN */
+#define XK_Georgian_jhan              0x10010ef  /* U+10EF GEORGIAN LETTER JHAN */
+#define XK_Georgian_hae               0x10010f0  /* U+10F0 GEORGIAN LETTER HAE */
+#define XK_Georgian_he                0x10010f1  /* U+10F1 GEORGIAN LETTER HE */
+#define XK_Georgian_hie               0x10010f2  /* U+10F2 GEORGIAN LETTER HIE */
+#define XK_Georgian_we                0x10010f3  /* U+10F3 GEORGIAN LETTER WE */
+#define XK_Georgian_har               0x10010f4  /* U+10F4 GEORGIAN LETTER HAR */
+#define XK_Georgian_hoe               0x10010f5  /* U+10F5 GEORGIAN LETTER HOE */
+#define XK_Georgian_fi                0x10010f6  /* U+10F6 GEORGIAN LETTER FI */
+#endif /* XK_GEORGIAN */
+
+/*
+ * Azeri (and other Turkic or Caucasian languages)
+ */
+
+#ifdef XK_CAUCASUS
+/* latin */
+#define XK_Xabovedot                  0x1001e8a  /* U+1E8A LATIN CAPITAL LETTER X WITH DOT ABOVE */
+#define XK_Ibreve                     0x100012c  /* U+012C LATIN CAPITAL LETTER I WITH BREVE */
+#define XK_Zstroke                    0x10001b5  /* U+01B5 LATIN CAPITAL LETTER Z WITH STROKE */
+#define XK_Gcaron                     0x10001e6  /* U+01E6 LATIN CAPITAL LETTER G WITH CARON */
+#define XK_Ocaron                     0x10001d1  /* U+01D2 LATIN CAPITAL LETTER O WITH CARON */
+#define XK_Obarred                    0x100019f  /* U+019F LATIN CAPITAL LETTER O WITH MIDDLE TILDE */
+#define XK_xabovedot                  0x1001e8b  /* U+1E8B LATIN SMALL LETTER X WITH DOT ABOVE */
+#define XK_ibreve                     0x100012d  /* U+012D LATIN SMALL LETTER I WITH BREVE */
+#define XK_zstroke                    0x10001b6  /* U+01B6 LATIN SMALL LETTER Z WITH STROKE */
+#define XK_gcaron                     0x10001e7  /* U+01E7 LATIN SMALL LETTER G WITH CARON */
+#define XK_ocaron                     0x10001d2  /* U+01D2 LATIN SMALL LETTER O WITH CARON */
+#define XK_obarred                    0x1000275  /* U+0275 LATIN SMALL LETTER BARRED O */
+#define XK_SCHWA                      0x100018f  /* U+018F LATIN CAPITAL LETTER SCHWA */
+#define XK_schwa                      0x1000259  /* U+0259 LATIN SMALL LETTER SCHWA */
+#define XK_EZH                        0x10001b7  /* U+01B7 LATIN CAPITAL LETTER EZH */
+#define XK_ezh                        0x1000292  /* U+0292 LATIN SMALL LETTER EZH */
+/* those are not really Caucasus */
+/* For Inupiak */
+#define XK_Lbelowdot                  0x1001e36  /* U+1E36 LATIN CAPITAL LETTER L WITH DOT BELOW */
+#define XK_lbelowdot                  0x1001e37  /* U+1E37 LATIN SMALL LETTER L WITH DOT BELOW */
+#endif /* XK_CAUCASUS */
+
+/*
+ * Vietnamese
+ */
+ 
+#ifdef XK_VIETNAMESE
+#define XK_Abelowdot                  0x1001ea0  /* U+1EA0 LATIN CAPITAL LETTER A WITH DOT BELOW */
+#define XK_abelowdot                  0x1001ea1  /* U+1EA1 LATIN SMALL LETTER A WITH DOT BELOW */
+#define XK_Ahook                      0x1001ea2  /* U+1EA2 LATIN CAPITAL LETTER A WITH HOOK ABOVE */
+#define XK_ahook                      0x1001ea3  /* U+1EA3 LATIN SMALL LETTER A WITH HOOK ABOVE */
+#define XK_Acircumflexacute           0x1001ea4  /* U+1EA4 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE */
+#define XK_acircumflexacute           0x1001ea5  /* U+1EA5 LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE */
+#define XK_Acircumflexgrave           0x1001ea6  /* U+1EA6 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE */
+#define XK_acircumflexgrave           0x1001ea7  /* U+1EA7 LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE */
+#define XK_Acircumflexhook            0x1001ea8  /* U+1EA8 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */
+#define XK_acircumflexhook            0x1001ea9  /* U+1EA9 LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */
+#define XK_Acircumflextilde           0x1001eaa  /* U+1EAA LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE */
+#define XK_acircumflextilde           0x1001eab  /* U+1EAB LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE */
+#define XK_Acircumflexbelowdot        0x1001eac  /* U+1EAC LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW */
+#define XK_acircumflexbelowdot        0x1001ead  /* U+1EAD LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW */
+#define XK_Abreveacute                0x1001eae  /* U+1EAE LATIN CAPITAL LETTER A WITH BREVE AND ACUTE */
+#define XK_abreveacute                0x1001eaf  /* U+1EAF LATIN SMALL LETTER A WITH BREVE AND ACUTE */
+#define XK_Abrevegrave                0x1001eb0  /* U+1EB0 LATIN CAPITAL LETTER A WITH BREVE AND GRAVE */
+#define XK_abrevegrave                0x1001eb1  /* U+1EB1 LATIN SMALL LETTER A WITH BREVE AND GRAVE */
+#define XK_Abrevehook                 0x1001eb2  /* U+1EB2 LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE */
+#define XK_abrevehook                 0x1001eb3  /* U+1EB3 LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE */
+#define XK_Abrevetilde                0x1001eb4  /* U+1EB4 LATIN CAPITAL LETTER A WITH BREVE AND TILDE */
+#define XK_abrevetilde                0x1001eb5  /* U+1EB5 LATIN SMALL LETTER A WITH BREVE AND TILDE */
+#define XK_Abrevebelowdot             0x1001eb6  /* U+1EB6 LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW */
+#define XK_abrevebelowdot             0x1001eb7  /* U+1EB7 LATIN SMALL LETTER A WITH BREVE AND DOT BELOW */
+#define XK_Ebelowdot                  0x1001eb8  /* U+1EB8 LATIN CAPITAL LETTER E WITH DOT BELOW */
+#define XK_ebelowdot                  0x1001eb9  /* U+1EB9 LATIN SMALL LETTER E WITH DOT BELOW */
+#define XK_Ehook                      0x1001eba  /* U+1EBA LATIN CAPITAL LETTER E WITH HOOK ABOVE */
+#define XK_ehook                      0x1001ebb  /* U+1EBB LATIN SMALL LETTER E WITH HOOK ABOVE */
+#define XK_Etilde                     0x1001ebc  /* U+1EBC LATIN CAPITAL LETTER E WITH TILDE */
+#define XK_etilde                     0x1001ebd  /* U+1EBD LATIN SMALL LETTER E WITH TILDE */
+#define XK_Ecircumflexacute           0x1001ebe  /* U+1EBE LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE */
+#define XK_ecircumflexacute           0x1001ebf  /* U+1EBF LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE */
+#define XK_Ecircumflexgrave           0x1001ec0  /* U+1EC0 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE */
+#define XK_ecircumflexgrave           0x1001ec1  /* U+1EC1 LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE */
+#define XK_Ecircumflexhook            0x1001ec2  /* U+1EC2 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */
+#define XK_ecircumflexhook            0x1001ec3  /* U+1EC3 LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */
+#define XK_Ecircumflextilde           0x1001ec4  /* U+1EC4 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE */
+#define XK_ecircumflextilde           0x1001ec5  /* U+1EC5 LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE */
+#define XK_Ecircumflexbelowdot        0x1001ec6  /* U+1EC6 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW */
+#define XK_ecircumflexbelowdot        0x1001ec7  /* U+1EC7 LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW */
+#define XK_Ihook                      0x1001ec8  /* U+1EC8 LATIN CAPITAL LETTER I WITH HOOK ABOVE */
+#define XK_ihook                      0x1001ec9  /* U+1EC9 LATIN SMALL LETTER I WITH HOOK ABOVE */
+#define XK_Ibelowdot                  0x1001eca  /* U+1ECA LATIN CAPITAL LETTER I WITH DOT BELOW */
+#define XK_ibelowdot                  0x1001ecb  /* U+1ECB LATIN SMALL LETTER I WITH DOT BELOW */
+#define XK_Obelowdot                  0x1001ecc  /* U+1ECC LATIN CAPITAL LETTER O WITH DOT BELOW */
+#define XK_obelowdot                  0x1001ecd  /* U+1ECD LATIN SMALL LETTER O WITH DOT BELOW */
+#define XK_Ohook                      0x1001ece  /* U+1ECE LATIN CAPITAL LETTER O WITH HOOK ABOVE */
+#define XK_ohook                      0x1001ecf  /* U+1ECF LATIN SMALL LETTER O WITH HOOK ABOVE */
+#define XK_Ocircumflexacute           0x1001ed0  /* U+1ED0 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE */
+#define XK_ocircumflexacute           0x1001ed1  /* U+1ED1 LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE */
+#define XK_Ocircumflexgrave           0x1001ed2  /* U+1ED2 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE */
+#define XK_ocircumflexgrave           0x1001ed3  /* U+1ED3 LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE */
+#define XK_Ocircumflexhook            0x1001ed4  /* U+1ED4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */
+#define XK_ocircumflexhook            0x1001ed5  /* U+1ED5 LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */
+#define XK_Ocircumflextilde           0x1001ed6  /* U+1ED6 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE */
+#define XK_ocircumflextilde           0x1001ed7  /* U+1ED7 LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE */
+#define XK_Ocircumflexbelowdot        0x1001ed8  /* U+1ED8 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW */
+#define XK_ocircumflexbelowdot        0x1001ed9  /* U+1ED9 LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW */
+#define XK_Ohornacute                 0x1001eda  /* U+1EDA LATIN CAPITAL LETTER O WITH HORN AND ACUTE */
+#define XK_ohornacute                 0x1001edb  /* U+1EDB LATIN SMALL LETTER O WITH HORN AND ACUTE */
+#define XK_Ohorngrave                 0x1001edc  /* U+1EDC LATIN CAPITAL LETTER O WITH HORN AND GRAVE */
+#define XK_ohorngrave                 0x1001edd  /* U+1EDD LATIN SMALL LETTER O WITH HORN AND GRAVE */
+#define XK_Ohornhook                  0x1001ede  /* U+1EDE LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE */
+#define XK_ohornhook                  0x1001edf  /* U+1EDF LATIN SMALL LETTER O WITH HORN AND HOOK ABOVE */
+#define XK_Ohorntilde                 0x1001ee0  /* U+1EE0 LATIN CAPITAL LETTER O WITH HORN AND TILDE */
+#define XK_ohorntilde                 0x1001ee1  /* U+1EE1 LATIN SMALL LETTER O WITH HORN AND TILDE */
+#define XK_Ohornbelowdot              0x1001ee2  /* U+1EE2 LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW */
+#define XK_ohornbelowdot              0x1001ee3  /* U+1EE3 LATIN SMALL LETTER O WITH HORN AND DOT BELOW */
+#define XK_Ubelowdot                  0x1001ee4  /* U+1EE4 LATIN CAPITAL LETTER U WITH DOT BELOW */
+#define XK_ubelowdot                  0x1001ee5  /* U+1EE5 LATIN SMALL LETTER U WITH DOT BELOW */
+#define XK_Uhook                      0x1001ee6  /* U+1EE6 LATIN CAPITAL LETTER U WITH HOOK ABOVE */
+#define XK_uhook                      0x1001ee7  /* U+1EE7 LATIN SMALL LETTER U WITH HOOK ABOVE */
+#define XK_Uhornacute                 0x1001ee8  /* U+1EE8 LATIN CAPITAL LETTER U WITH HORN AND ACUTE */
+#define XK_uhornacute                 0x1001ee9  /* U+1EE9 LATIN SMALL LETTER U WITH HORN AND ACUTE */
+#define XK_Uhorngrave                 0x1001eea  /* U+1EEA LATIN CAPITAL LETTER U WITH HORN AND GRAVE */
+#define XK_uhorngrave                 0x1001eeb  /* U+1EEB LATIN SMALL LETTER U WITH HORN AND GRAVE */
+#define XK_Uhornhook                  0x1001eec  /* U+1EEC LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE */
+#define XK_uhornhook                  0x1001eed  /* U+1EED LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE */
+#define XK_Uhorntilde                 0x1001eee  /* U+1EEE LATIN CAPITAL LETTER U WITH HORN AND TILDE */
+#define XK_uhorntilde                 0x1001eef  /* U+1EEF LATIN SMALL LETTER U WITH HORN AND TILDE */
+#define XK_Uhornbelowdot              0x1001ef0  /* U+1EF0 LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW */
+#define XK_uhornbelowdot              0x1001ef1  /* U+1EF1 LATIN SMALL LETTER U WITH HORN AND DOT BELOW */
+#define XK_Ybelowdot                  0x1001ef4  /* U+1EF4 LATIN CAPITAL LETTER Y WITH DOT BELOW */
+#define XK_ybelowdot                  0x1001ef5  /* U+1EF5 LATIN SMALL LETTER Y WITH DOT BELOW */
+#define XK_Yhook                      0x1001ef6  /* U+1EF6 LATIN CAPITAL LETTER Y WITH HOOK ABOVE */
+#define XK_yhook                      0x1001ef7  /* U+1EF7 LATIN SMALL LETTER Y WITH HOOK ABOVE */
+#define XK_Ytilde                     0x1001ef8  /* U+1EF8 LATIN CAPITAL LETTER Y WITH TILDE */
+#define XK_ytilde                     0x1001ef9  /* U+1EF9 LATIN SMALL LETTER Y WITH TILDE */
+#define XK_Ohorn                      0x10001a0  /* U+01A0 LATIN CAPITAL LETTER O WITH HORN */
+#define XK_ohorn                      0x10001a1  /* U+01A1 LATIN SMALL LETTER O WITH HORN */
+#define XK_Uhorn                      0x10001af  /* U+01AF LATIN CAPITAL LETTER U WITH HORN */
+#define XK_uhorn                      0x10001b0  /* U+01B0 LATIN SMALL LETTER U WITH HORN */
+
+#endif /* XK_VIETNAMESE */
+
+#ifdef XK_CURRENCY
+#define XK_EcuSign                    0x10020a0  /* U+20A0 EURO-CURRENCY SIGN */
+#define XK_ColonSign                  0x10020a1  /* U+20A1 COLON SIGN */
+#define XK_CruzeiroSign               0x10020a2  /* U+20A2 CRUZEIRO SIGN */
+#define XK_FFrancSign                 0x10020a3  /* U+20A3 FRENCH FRANC SIGN */
+#define XK_LiraSign                   0x10020a4  /* U+20A4 LIRA SIGN */
+#define XK_MillSign                   0x10020a5  /* U+20A5 MILL SIGN */
+#define XK_NairaSign                  0x10020a6  /* U+20A6 NAIRA SIGN */
+#define XK_PesetaSign                 0x10020a7  /* U+20A7 PESETA SIGN */
+#define XK_RupeeSign                  0x10020a8  /* U+20A8 RUPEE SIGN */
+#define XK_WonSign                    0x10020a9  /* U+20A9 WON SIGN */
+#define XK_NewSheqelSign              0x10020aa  /* U+20AA NEW SHEQEL SIGN */
+#define XK_DongSign                   0x10020ab  /* U+20AB DONG SIGN */
+#define XK_EuroSign                      0x20ac  /* U+20AC EURO SIGN */
+#endif /* XK_CURRENCY */
+
+#ifdef XK_MATHEMATICAL
+/* one, two and three are defined above. */
+#define XK_zerosuperior               0x1002070  /* U+2070 SUPERSCRIPT ZERO */
+#define XK_foursuperior               0x1002074  /* U+2074 SUPERSCRIPT FOUR */
+#define XK_fivesuperior               0x1002075  /* U+2075 SUPERSCRIPT FIVE */
+#define XK_sixsuperior                0x1002076  /* U+2076 SUPERSCRIPT SIX */
+#define XK_sevensuperior              0x1002077  /* U+2077 SUPERSCRIPT SEVEN */
+#define XK_eightsuperior              0x1002078  /* U+2078 SUPERSCRIPT EIGHT */
+#define XK_ninesuperior               0x1002079  /* U+2079 SUPERSCRIPT NINE */
+#define XK_zerosubscript              0x1002080  /* U+2080 SUBSCRIPT ZERO */
+#define XK_onesubscript               0x1002081  /* U+2081 SUBSCRIPT ONE */
+#define XK_twosubscript               0x1002082  /* U+2082 SUBSCRIPT TWO */
+#define XK_threesubscript             0x1002083  /* U+2083 SUBSCRIPT THREE */
+#define XK_foursubscript              0x1002084  /* U+2084 SUBSCRIPT FOUR */
+#define XK_fivesubscript              0x1002085  /* U+2085 SUBSCRIPT FIVE */
+#define XK_sixsubscript               0x1002086  /* U+2086 SUBSCRIPT SIX */
+#define XK_sevensubscript             0x1002087  /* U+2087 SUBSCRIPT SEVEN */
+#define XK_eightsubscript             0x1002088  /* U+2088 SUBSCRIPT EIGHT */
+#define XK_ninesubscript              0x1002089  /* U+2089 SUBSCRIPT NINE */
+#define XK_partdifferential           0x1002202  /* U+2202 PARTIAL DIFFERENTIAL */
+#define XK_emptyset                   0x1002205  /* U+2205 NULL SET */
+#define XK_elementof                  0x1002208  /* U+2208 ELEMENT OF */
+#define XK_notelementof               0x1002209  /* U+2209 NOT AN ELEMENT OF */
+#define XK_containsas                 0x100220B  /* U+220B CONTAINS AS MEMBER */
+#define XK_squareroot                 0x100221A  /* U+221A SQUARE ROOT */
+#define XK_cuberoot                   0x100221B  /* U+221B CUBE ROOT */
+#define XK_fourthroot                 0x100221C  /* U+221C FOURTH ROOT */
+#define XK_dintegral                  0x100222C  /* U+222C DOUBLE INTEGRAL */
+#define XK_tintegral                  0x100222D  /* U+222D TRIPLE INTEGRAL */
+#define XK_because                    0x1002235  /* U+2235 BECAUSE */
+#define XK_approxeq                   0x1002248  /* U+2245 ALMOST EQUAL TO */
+#define XK_notapproxeq                0x1002247  /* U+2247 NOT ALMOST EQUAL TO */
+#define XK_notidentical               0x1002262  /* U+2262 NOT IDENTICAL TO */
+#define XK_stricteq                   0x1002263  /* U+2263 STRICTLY EQUIVALENT TO */          
+#endif /* XK_MATHEMATICAL */
+
+#ifdef XK_BRAILLE
+#define XK_braille_dot_1                 0xfff1
+#define XK_braille_dot_2                 0xfff2
+#define XK_braille_dot_3                 0xfff3
+#define XK_braille_dot_4                 0xfff4
+#define XK_braille_dot_5                 0xfff5
+#define XK_braille_dot_6                 0xfff6
+#define XK_braille_dot_7                 0xfff7
+#define XK_braille_dot_8                 0xfff8
+#define XK_braille_dot_9                 0xfff9
+#define XK_braille_dot_10                0xfffa
+#define XK_braille_blank              0x1002800  /* U+2800 BRAILLE PATTERN BLANK */
+#define XK_braille_dots_1             0x1002801  /* U+2801 BRAILLE PATTERN DOTS-1 */
+#define XK_braille_dots_2             0x1002802  /* U+2802 BRAILLE PATTERN DOTS-2 */
+#define XK_braille_dots_12            0x1002803  /* U+2803 BRAILLE PATTERN DOTS-12 */
+#define XK_braille_dots_3             0x1002804  /* U+2804 BRAILLE PATTERN DOTS-3 */
+#define XK_braille_dots_13            0x1002805  /* U+2805 BRAILLE PATTERN DOTS-13 */
+#define XK_braille_dots_23            0x1002806  /* U+2806 BRAILLE PATTERN DOTS-23 */
+#define XK_braille_dots_123           0x1002807  /* U+2807 BRAILLE PATTERN DOTS-123 */
+#define XK_braille_dots_4             0x1002808  /* U+2808 BRAILLE PATTERN DOTS-4 */
+#define XK_braille_dots_14            0x1002809  /* U+2809 BRAILLE PATTERN DOTS-14 */
+#define XK_braille_dots_24            0x100280a  /* U+280a BRAILLE PATTERN DOTS-24 */
+#define XK_braille_dots_124           0x100280b  /* U+280b BRAILLE PATTERN DOTS-124 */
+#define XK_braille_dots_34            0x100280c  /* U+280c BRAILLE PATTERN DOTS-34 */
+#define XK_braille_dots_134           0x100280d  /* U+280d BRAILLE PATTERN DOTS-134 */
+#define XK_braille_dots_234           0x100280e  /* U+280e BRAILLE PATTERN DOTS-234 */
+#define XK_braille_dots_1234          0x100280f  /* U+280f BRAILLE PATTERN DOTS-1234 */
+#define XK_braille_dots_5             0x1002810  /* U+2810 BRAILLE PATTERN DOTS-5 */
+#define XK_braille_dots_15            0x1002811  /* U+2811 BRAILLE PATTERN DOTS-15 */
+#define XK_braille_dots_25            0x1002812  /* U+2812 BRAILLE PATTERN DOTS-25 */
+#define XK_braille_dots_125           0x1002813  /* U+2813 BRAILLE PATTERN DOTS-125 */
+#define XK_braille_dots_35            0x1002814  /* U+2814 BRAILLE PATTERN DOTS-35 */
+#define XK_braille_dots_135           0x1002815  /* U+2815 BRAILLE PATTERN DOTS-135 */
+#define XK_braille_dots_235           0x1002816  /* U+2816 BRAILLE PATTERN DOTS-235 */
+#define XK_braille_dots_1235          0x1002817  /* U+2817 BRAILLE PATTERN DOTS-1235 */
+#define XK_braille_dots_45            0x1002818  /* U+2818 BRAILLE PATTERN DOTS-45 */
+#define XK_braille_dots_145           0x1002819  /* U+2819 BRAILLE PATTERN DOTS-145 */
+#define XK_braille_dots_245           0x100281a  /* U+281a BRAILLE PATTERN DOTS-245 */
+#define XK_braille_dots_1245          0x100281b  /* U+281b BRAILLE PATTERN DOTS-1245 */
+#define XK_braille_dots_345           0x100281c  /* U+281c BRAILLE PATTERN DOTS-345 */
+#define XK_braille_dots_1345          0x100281d  /* U+281d BRAILLE PATTERN DOTS-1345 */
+#define XK_braille_dots_2345          0x100281e  /* U+281e BRAILLE PATTERN DOTS-2345 */
+#define XK_braille_dots_12345         0x100281f  /* U+281f BRAILLE PATTERN DOTS-12345 */
+#define XK_braille_dots_6             0x1002820  /* U+2820 BRAILLE PATTERN DOTS-6 */
+#define XK_braille_dots_16            0x1002821  /* U+2821 BRAILLE PATTERN DOTS-16 */
+#define XK_braille_dots_26            0x1002822  /* U+2822 BRAILLE PATTERN DOTS-26 */
+#define XK_braille_dots_126           0x1002823  /* U+2823 BRAILLE PATTERN DOTS-126 */
+#define XK_braille_dots_36            0x1002824  /* U+2824 BRAILLE PATTERN DOTS-36 */
+#define XK_braille_dots_136           0x1002825  /* U+2825 BRAILLE PATTERN DOTS-136 */
+#define XK_braille_dots_236           0x1002826  /* U+2826 BRAILLE PATTERN DOTS-236 */
+#define XK_braille_dots_1236          0x1002827  /* U+2827 BRAILLE PATTERN DOTS-1236 */
+#define XK_braille_dots_46            0x1002828  /* U+2828 BRAILLE PATTERN DOTS-46 */
+#define XK_braille_dots_146           0x1002829  /* U+2829 BRAILLE PATTERN DOTS-146 */
+#define XK_braille_dots_246           0x100282a  /* U+282a BRAILLE PATTERN DOTS-246 */
+#define XK_braille_dots_1246          0x100282b  /* U+282b BRAILLE PATTERN DOTS-1246 */
+#define XK_braille_dots_346           0x100282c  /* U+282c BRAILLE PATTERN DOTS-346 */
+#define XK_braille_dots_1346          0x100282d  /* U+282d BRAILLE PATTERN DOTS-1346 */
+#define XK_braille_dots_2346          0x100282e  /* U+282e BRAILLE PATTERN DOTS-2346 */
+#define XK_braille_dots_12346         0x100282f  /* U+282f BRAILLE PATTERN DOTS-12346 */
+#define XK_braille_dots_56            0x1002830  /* U+2830 BRAILLE PATTERN DOTS-56 */
+#define XK_braille_dots_156           0x1002831  /* U+2831 BRAILLE PATTERN DOTS-156 */
+#define XK_braille_dots_256           0x1002832  /* U+2832 BRAILLE PATTERN DOTS-256 */
+#define XK_braille_dots_1256          0x1002833  /* U+2833 BRAILLE PATTERN DOTS-1256 */
+#define XK_braille_dots_356           0x1002834  /* U+2834 BRAILLE PATTERN DOTS-356 */
+#define XK_braille_dots_1356          0x1002835  /* U+2835 BRAILLE PATTERN DOTS-1356 */
+#define XK_braille_dots_2356          0x1002836  /* U+2836 BRAILLE PATTERN DOTS-2356 */
+#define XK_braille_dots_12356         0x1002837  /* U+2837 BRAILLE PATTERN DOTS-12356 */
+#define XK_braille_dots_456           0x1002838  /* U+2838 BRAILLE PATTERN DOTS-456 */
+#define XK_braille_dots_1456          0x1002839  /* U+2839 BRAILLE PATTERN DOTS-1456 */
+#define XK_braille_dots_2456          0x100283a  /* U+283a BRAILLE PATTERN DOTS-2456 */
+#define XK_braille_dots_12456         0x100283b  /* U+283b BRAILLE PATTERN DOTS-12456 */
+#define XK_braille_dots_3456          0x100283c  /* U+283c BRAILLE PATTERN DOTS-3456 */
+#define XK_braille_dots_13456         0x100283d  /* U+283d BRAILLE PATTERN DOTS-13456 */
+#define XK_braille_dots_23456         0x100283e  /* U+283e BRAILLE PATTERN DOTS-23456 */
+#define XK_braille_dots_123456        0x100283f  /* U+283f BRAILLE PATTERN DOTS-123456 */
+#define XK_braille_dots_7             0x1002840  /* U+2840 BRAILLE PATTERN DOTS-7 */
+#define XK_braille_dots_17            0x1002841  /* U+2841 BRAILLE PATTERN DOTS-17 */
+#define XK_braille_dots_27            0x1002842  /* U+2842 BRAILLE PATTERN DOTS-27 */
+#define XK_braille_dots_127           0x1002843  /* U+2843 BRAILLE PATTERN DOTS-127 */
+#define XK_braille_dots_37            0x1002844  /* U+2844 BRAILLE PATTERN DOTS-37 */
+#define XK_braille_dots_137           0x1002845  /* U+2845 BRAILLE PATTERN DOTS-137 */
+#define XK_braille_dots_237           0x1002846  /* U+2846 BRAILLE PATTERN DOTS-237 */
+#define XK_braille_dots_1237          0x1002847  /* U+2847 BRAILLE PATTERN DOTS-1237 */
+#define XK_braille_dots_47            0x1002848  /* U+2848 BRAILLE PATTERN DOTS-47 */
+#define XK_braille_dots_147           0x1002849  /* U+2849 BRAILLE PATTERN DOTS-147 */
+#define XK_braille_dots_247           0x100284a  /* U+284a BRAILLE PATTERN DOTS-247 */
+#define XK_braille_dots_1247          0x100284b  /* U+284b BRAILLE PATTERN DOTS-1247 */
+#define XK_braille_dots_347           0x100284c  /* U+284c BRAILLE PATTERN DOTS-347 */
+#define XK_braille_dots_1347          0x100284d  /* U+284d BRAILLE PATTERN DOTS-1347 */
+#define XK_braille_dots_2347          0x100284e  /* U+284e BRAILLE PATTERN DOTS-2347 */
+#define XK_braille_dots_12347         0x100284f  /* U+284f BRAILLE PATTERN DOTS-12347 */
+#define XK_braille_dots_57            0x1002850  /* U+2850 BRAILLE PATTERN DOTS-57 */
+#define XK_braille_dots_157           0x1002851  /* U+2851 BRAILLE PATTERN DOTS-157 */
+#define XK_braille_dots_257           0x1002852  /* U+2852 BRAILLE PATTERN DOTS-257 */
+#define XK_braille_dots_1257          0x1002853  /* U+2853 BRAILLE PATTERN DOTS-1257 */
+#define XK_braille_dots_357           0x1002854  /* U+2854 BRAILLE PATTERN DOTS-357 */
+#define XK_braille_dots_1357          0x1002855  /* U+2855 BRAILLE PATTERN DOTS-1357 */
+#define XK_braille_dots_2357          0x1002856  /* U+2856 BRAILLE PATTERN DOTS-2357 */
+#define XK_braille_dots_12357         0x1002857  /* U+2857 BRAILLE PATTERN DOTS-12357 */
+#define XK_braille_dots_457           0x1002858  /* U+2858 BRAILLE PATTERN DOTS-457 */
+#define XK_braille_dots_1457          0x1002859  /* U+2859 BRAILLE PATTERN DOTS-1457 */
+#define XK_braille_dots_2457          0x100285a  /* U+285a BRAILLE PATTERN DOTS-2457 */
+#define XK_braille_dots_12457         0x100285b  /* U+285b BRAILLE PATTERN DOTS-12457 */
+#define XK_braille_dots_3457          0x100285c  /* U+285c BRAILLE PATTERN DOTS-3457 */
+#define XK_braille_dots_13457         0x100285d  /* U+285d BRAILLE PATTERN DOTS-13457 */
+#define XK_braille_dots_23457         0x100285e  /* U+285e BRAILLE PATTERN DOTS-23457 */
+#define XK_braille_dots_123457        0x100285f  /* U+285f BRAILLE PATTERN DOTS-123457 */
+#define XK_braille_dots_67            0x1002860  /* U+2860 BRAILLE PATTERN DOTS-67 */
+#define XK_braille_dots_167           0x1002861  /* U+2861 BRAILLE PATTERN DOTS-167 */
+#define XK_braille_dots_267           0x1002862  /* U+2862 BRAILLE PATTERN DOTS-267 */
+#define XK_braille_dots_1267          0x1002863  /* U+2863 BRAILLE PATTERN DOTS-1267 */
+#define XK_braille_dots_367           0x1002864  /* U+2864 BRAILLE PATTERN DOTS-367 */
+#define XK_braille_dots_1367          0x1002865  /* U+2865 BRAILLE PATTERN DOTS-1367 */
+#define XK_braille_dots_2367          0x1002866  /* U+2866 BRAILLE PATTERN DOTS-2367 */
+#define XK_braille_dots_12367         0x1002867  /* U+2867 BRAILLE PATTERN DOTS-12367 */
+#define XK_braille_dots_467           0x1002868  /* U+2868 BRAILLE PATTERN DOTS-467 */
+#define XK_braille_dots_1467          0x1002869  /* U+2869 BRAILLE PATTERN DOTS-1467 */
+#define XK_braille_dots_2467          0x100286a  /* U+286a BRAILLE PATTERN DOTS-2467 */
+#define XK_braille_dots_12467         0x100286b  /* U+286b BRAILLE PATTERN DOTS-12467 */
+#define XK_braille_dots_3467          0x100286c  /* U+286c BRAILLE PATTERN DOTS-3467 */
+#define XK_braille_dots_13467         0x100286d  /* U+286d BRAILLE PATTERN DOTS-13467 */
+#define XK_braille_dots_23467         0x100286e  /* U+286e BRAILLE PATTERN DOTS-23467 */
+#define XK_braille_dots_123467        0x100286f  /* U+286f BRAILLE PATTERN DOTS-123467 */
+#define XK_braille_dots_567           0x1002870  /* U+2870 BRAILLE PATTERN DOTS-567 */
+#define XK_braille_dots_1567          0x1002871  /* U+2871 BRAILLE PATTERN DOTS-1567 */
+#define XK_braille_dots_2567          0x1002872  /* U+2872 BRAILLE PATTERN DOTS-2567 */
+#define XK_braille_dots_12567         0x1002873  /* U+2873 BRAILLE PATTERN DOTS-12567 */
+#define XK_braille_dots_3567          0x1002874  /* U+2874 BRAILLE PATTERN DOTS-3567 */
+#define XK_braille_dots_13567         0x1002875  /* U+2875 BRAILLE PATTERN DOTS-13567 */
+#define XK_braille_dots_23567         0x1002876  /* U+2876 BRAILLE PATTERN DOTS-23567 */
+#define XK_braille_dots_123567        0x1002877  /* U+2877 BRAILLE PATTERN DOTS-123567 */
+#define XK_braille_dots_4567          0x1002878  /* U+2878 BRAILLE PATTERN DOTS-4567 */
+#define XK_braille_dots_14567         0x1002879  /* U+2879 BRAILLE PATTERN DOTS-14567 */
+#define XK_braille_dots_24567         0x100287a  /* U+287a BRAILLE PATTERN DOTS-24567 */
+#define XK_braille_dots_124567        0x100287b  /* U+287b BRAILLE PATTERN DOTS-124567 */
+#define XK_braille_dots_34567         0x100287c  /* U+287c BRAILLE PATTERN DOTS-34567 */
+#define XK_braille_dots_134567        0x100287d  /* U+287d BRAILLE PATTERN DOTS-134567 */
+#define XK_braille_dots_234567        0x100287e  /* U+287e BRAILLE PATTERN DOTS-234567 */
+#define XK_braille_dots_1234567       0x100287f  /* U+287f BRAILLE PATTERN DOTS-1234567 */
+#define XK_braille_dots_8             0x1002880  /* U+2880 BRAILLE PATTERN DOTS-8 */
+#define XK_braille_dots_18            0x1002881  /* U+2881 BRAILLE PATTERN DOTS-18 */
+#define XK_braille_dots_28            0x1002882  /* U+2882 BRAILLE PATTERN DOTS-28 */
+#define XK_braille_dots_128           0x1002883  /* U+2883 BRAILLE PATTERN DOTS-128 */
+#define XK_braille_dots_38            0x1002884  /* U+2884 BRAILLE PATTERN DOTS-38 */
+#define XK_braille_dots_138           0x1002885  /* U+2885 BRAILLE PATTERN DOTS-138 */
+#define XK_braille_dots_238           0x1002886  /* U+2886 BRAILLE PATTERN DOTS-238 */
+#define XK_braille_dots_1238          0x1002887  /* U+2887 BRAILLE PATTERN DOTS-1238 */
+#define XK_braille_dots_48            0x1002888  /* U+2888 BRAILLE PATTERN DOTS-48 */
+#define XK_braille_dots_148           0x1002889  /* U+2889 BRAILLE PATTERN DOTS-148 */
+#define XK_braille_dots_248           0x100288a  /* U+288a BRAILLE PATTERN DOTS-248 */
+#define XK_braille_dots_1248          0x100288b  /* U+288b BRAILLE PATTERN DOTS-1248 */
+#define XK_braille_dots_348           0x100288c  /* U+288c BRAILLE PATTERN DOTS-348 */
+#define XK_braille_dots_1348          0x100288d  /* U+288d BRAILLE PATTERN DOTS-1348 */
+#define XK_braille_dots_2348          0x100288e  /* U+288e BRAILLE PATTERN DOTS-2348 */
+#define XK_braille_dots_12348         0x100288f  /* U+288f BRAILLE PATTERN DOTS-12348 */
+#define XK_braille_dots_58            0x1002890  /* U+2890 BRAILLE PATTERN DOTS-58 */
+#define XK_braille_dots_158           0x1002891  /* U+2891 BRAILLE PATTERN DOTS-158 */
+#define XK_braille_dots_258           0x1002892  /* U+2892 BRAILLE PATTERN DOTS-258 */
+#define XK_braille_dots_1258          0x1002893  /* U+2893 BRAILLE PATTERN DOTS-1258 */
+#define XK_braille_dots_358           0x1002894  /* U+2894 BRAILLE PATTERN DOTS-358 */
+#define XK_braille_dots_1358          0x1002895  /* U+2895 BRAILLE PATTERN DOTS-1358 */
+#define XK_braille_dots_2358          0x1002896  /* U+2896 BRAILLE PATTERN DOTS-2358 */
+#define XK_braille_dots_12358         0x1002897  /* U+2897 BRAILLE PATTERN DOTS-12358 */
+#define XK_braille_dots_458           0x1002898  /* U+2898 BRAILLE PATTERN DOTS-458 */
+#define XK_braille_dots_1458          0x1002899  /* U+2899 BRAILLE PATTERN DOTS-1458 */
+#define XK_braille_dots_2458          0x100289a  /* U+289a BRAILLE PATTERN DOTS-2458 */
+#define XK_braille_dots_12458         0x100289b  /* U+289b BRAILLE PATTERN DOTS-12458 */
+#define XK_braille_dots_3458          0x100289c  /* U+289c BRAILLE PATTERN DOTS-3458 */
+#define XK_braille_dots_13458         0x100289d  /* U+289d BRAILLE PATTERN DOTS-13458 */
+#define XK_braille_dots_23458         0x100289e  /* U+289e BRAILLE PATTERN DOTS-23458 */
+#define XK_braille_dots_123458        0x100289f  /* U+289f BRAILLE PATTERN DOTS-123458 */
+#define XK_braille_dots_68            0x10028a0  /* U+28a0 BRAILLE PATTERN DOTS-68 */
+#define XK_braille_dots_168           0x10028a1  /* U+28a1 BRAILLE PATTERN DOTS-168 */
+#define XK_braille_dots_268           0x10028a2  /* U+28a2 BRAILLE PATTERN DOTS-268 */
+#define XK_braille_dots_1268          0x10028a3  /* U+28a3 BRAILLE PATTERN DOTS-1268 */
+#define XK_braille_dots_368           0x10028a4  /* U+28a4 BRAILLE PATTERN DOTS-368 */
+#define XK_braille_dots_1368          0x10028a5  /* U+28a5 BRAILLE PATTERN DOTS-1368 */
+#define XK_braille_dots_2368          0x10028a6  /* U+28a6 BRAILLE PATTERN DOTS-2368 */
+#define XK_braille_dots_12368         0x10028a7  /* U+28a7 BRAILLE PATTERN DOTS-12368 */
+#define XK_braille_dots_468           0x10028a8  /* U+28a8 BRAILLE PATTERN DOTS-468 */
+#define XK_braille_dots_1468          0x10028a9  /* U+28a9 BRAILLE PATTERN DOTS-1468 */
+#define XK_braille_dots_2468          0x10028aa  /* U+28aa BRAILLE PATTERN DOTS-2468 */
+#define XK_braille_dots_12468         0x10028ab  /* U+28ab BRAILLE PATTERN DOTS-12468 */
+#define XK_braille_dots_3468          0x10028ac  /* U+28ac BRAILLE PATTERN DOTS-3468 */
+#define XK_braille_dots_13468         0x10028ad  /* U+28ad BRAILLE PATTERN DOTS-13468 */
+#define XK_braille_dots_23468         0x10028ae  /* U+28ae BRAILLE PATTERN DOTS-23468 */
+#define XK_braille_dots_123468        0x10028af  /* U+28af BRAILLE PATTERN DOTS-123468 */
+#define XK_braille_dots_568           0x10028b0  /* U+28b0 BRAILLE PATTERN DOTS-568 */
+#define XK_braille_dots_1568          0x10028b1  /* U+28b1 BRAILLE PATTERN DOTS-1568 */
+#define XK_braille_dots_2568          0x10028b2  /* U+28b2 BRAILLE PATTERN DOTS-2568 */
+#define XK_braille_dots_12568         0x10028b3  /* U+28b3 BRAILLE PATTERN DOTS-12568 */
+#define XK_braille_dots_3568          0x10028b4  /* U+28b4 BRAILLE PATTERN DOTS-3568 */
+#define XK_braille_dots_13568         0x10028b5  /* U+28b5 BRAILLE PATTERN DOTS-13568 */
+#define XK_braille_dots_23568         0x10028b6  /* U+28b6 BRAILLE PATTERN DOTS-23568 */
+#define XK_braille_dots_123568        0x10028b7  /* U+28b7 BRAILLE PATTERN DOTS-123568 */
+#define XK_braille_dots_4568          0x10028b8  /* U+28b8 BRAILLE PATTERN DOTS-4568 */
+#define XK_braille_dots_14568         0x10028b9  /* U+28b9 BRAILLE PATTERN DOTS-14568 */
+#define XK_braille_dots_24568         0x10028ba  /* U+28ba BRAILLE PATTERN DOTS-24568 */
+#define XK_braille_dots_124568        0x10028bb  /* U+28bb BRAILLE PATTERN DOTS-124568 */
+#define XK_braille_dots_34568         0x10028bc  /* U+28bc BRAILLE PATTERN DOTS-34568 */
+#define XK_braille_dots_134568        0x10028bd  /* U+28bd BRAILLE PATTERN DOTS-134568 */
+#define XK_braille_dots_234568        0x10028be  /* U+28be BRAILLE PATTERN DOTS-234568 */
+#define XK_braille_dots_1234568       0x10028bf  /* U+28bf BRAILLE PATTERN DOTS-1234568 */
+#define XK_braille_dots_78            0x10028c0  /* U+28c0 BRAILLE PATTERN DOTS-78 */
+#define XK_braille_dots_178           0x10028c1  /* U+28c1 BRAILLE PATTERN DOTS-178 */
+#define XK_braille_dots_278           0x10028c2  /* U+28c2 BRAILLE PATTERN DOTS-278 */
+#define XK_braille_dots_1278          0x10028c3  /* U+28c3 BRAILLE PATTERN DOTS-1278 */
+#define XK_braille_dots_378           0x10028c4  /* U+28c4 BRAILLE PATTERN DOTS-378 */
+#define XK_braille_dots_1378          0x10028c5  /* U+28c5 BRAILLE PATTERN DOTS-1378 */
+#define XK_braille_dots_2378          0x10028c6  /* U+28c6 BRAILLE PATTERN DOTS-2378 */
+#define XK_braille_dots_12378         0x10028c7  /* U+28c7 BRAILLE PATTERN DOTS-12378 */
+#define XK_braille_dots_478           0x10028c8  /* U+28c8 BRAILLE PATTERN DOTS-478 */
+#define XK_braille_dots_1478          0x10028c9  /* U+28c9 BRAILLE PATTERN DOTS-1478 */
+#define XK_braille_dots_2478          0x10028ca  /* U+28ca BRAILLE PATTERN DOTS-2478 */
+#define XK_braille_dots_12478         0x10028cb  /* U+28cb BRAILLE PATTERN DOTS-12478 */
+#define XK_braille_dots_3478          0x10028cc  /* U+28cc BRAILLE PATTERN DOTS-3478 */
+#define XK_braille_dots_13478         0x10028cd  /* U+28cd BRAILLE PATTERN DOTS-13478 */
+#define XK_braille_dots_23478         0x10028ce  /* U+28ce BRAILLE PATTERN DOTS-23478 */
+#define XK_braille_dots_123478        0x10028cf  /* U+28cf BRAILLE PATTERN DOTS-123478 */
+#define XK_braille_dots_578           0x10028d0  /* U+28d0 BRAILLE PATTERN DOTS-578 */
+#define XK_braille_dots_1578          0x10028d1  /* U+28d1 BRAILLE PATTERN DOTS-1578 */
+#define XK_braille_dots_2578          0x10028d2  /* U+28d2 BRAILLE PATTERN DOTS-2578 */
+#define XK_braille_dots_12578         0x10028d3  /* U+28d3 BRAILLE PATTERN DOTS-12578 */
+#define XK_braille_dots_3578          0x10028d4  /* U+28d4 BRAILLE PATTERN DOTS-3578 */
+#define XK_braille_dots_13578         0x10028d5  /* U+28d5 BRAILLE PATTERN DOTS-13578 */
+#define XK_braille_dots_23578         0x10028d6  /* U+28d6 BRAILLE PATTERN DOTS-23578 */
+#define XK_braille_dots_123578        0x10028d7  /* U+28d7 BRAILLE PATTERN DOTS-123578 */
+#define XK_braille_dots_4578          0x10028d8  /* U+28d8 BRAILLE PATTERN DOTS-4578 */
+#define XK_braille_dots_14578         0x10028d9  /* U+28d9 BRAILLE PATTERN DOTS-14578 */
+#define XK_braille_dots_24578         0x10028da  /* U+28da BRAILLE PATTERN DOTS-24578 */
+#define XK_braille_dots_124578        0x10028db  /* U+28db BRAILLE PATTERN DOTS-124578 */
+#define XK_braille_dots_34578         0x10028dc  /* U+28dc BRAILLE PATTERN DOTS-34578 */
+#define XK_braille_dots_134578        0x10028dd  /* U+28dd BRAILLE PATTERN DOTS-134578 */
+#define XK_braille_dots_234578        0x10028de  /* U+28de BRAILLE PATTERN DOTS-234578 */
+#define XK_braille_dots_1234578       0x10028df  /* U+28df BRAILLE PATTERN DOTS-1234578 */
+#define XK_braille_dots_678           0x10028e0  /* U+28e0 BRAILLE PATTERN DOTS-678 */
+#define XK_braille_dots_1678          0x10028e1  /* U+28e1 BRAILLE PATTERN DOTS-1678 */
+#define XK_braille_dots_2678          0x10028e2  /* U+28e2 BRAILLE PATTERN DOTS-2678 */
+#define XK_braille_dots_12678         0x10028e3  /* U+28e3 BRAILLE PATTERN DOTS-12678 */
+#define XK_braille_dots_3678          0x10028e4  /* U+28e4 BRAILLE PATTERN DOTS-3678 */
+#define XK_braille_dots_13678         0x10028e5  /* U+28e5 BRAILLE PATTERN DOTS-13678 */
+#define XK_braille_dots_23678         0x10028e6  /* U+28e6 BRAILLE PATTERN DOTS-23678 */
+#define XK_braille_dots_123678        0x10028e7  /* U+28e7 BRAILLE PATTERN DOTS-123678 */
+#define XK_braille_dots_4678          0x10028e8  /* U+28e8 BRAILLE PATTERN DOTS-4678 */
+#define XK_braille_dots_14678         0x10028e9  /* U+28e9 BRAILLE PATTERN DOTS-14678 */
+#define XK_braille_dots_24678         0x10028ea  /* U+28ea BRAILLE PATTERN DOTS-24678 */
+#define XK_braille_dots_124678        0x10028eb  /* U+28eb BRAILLE PATTERN DOTS-124678 */
+#define XK_braille_dots_34678         0x10028ec  /* U+28ec BRAILLE PATTERN DOTS-34678 */
+#define XK_braille_dots_134678        0x10028ed  /* U+28ed BRAILLE PATTERN DOTS-134678 */
+#define XK_braille_dots_234678        0x10028ee  /* U+28ee BRAILLE PATTERN DOTS-234678 */
+#define XK_braille_dots_1234678       0x10028ef  /* U+28ef BRAILLE PATTERN DOTS-1234678 */
+#define XK_braille_dots_5678          0x10028f0  /* U+28f0 BRAILLE PATTERN DOTS-5678 */
+#define XK_braille_dots_15678         0x10028f1  /* U+28f1 BRAILLE PATTERN DOTS-15678 */
+#define XK_braille_dots_25678         0x10028f2  /* U+28f2 BRAILLE PATTERN DOTS-25678 */
+#define XK_braille_dots_125678        0x10028f3  /* U+28f3 BRAILLE PATTERN DOTS-125678 */
+#define XK_braille_dots_35678         0x10028f4  /* U+28f4 BRAILLE PATTERN DOTS-35678 */
+#define XK_braille_dots_135678        0x10028f5  /* U+28f5 BRAILLE PATTERN DOTS-135678 */
+#define XK_braille_dots_235678        0x10028f6  /* U+28f6 BRAILLE PATTERN DOTS-235678 */
+#define XK_braille_dots_1235678       0x10028f7  /* U+28f7 BRAILLE PATTERN DOTS-1235678 */
+#define XK_braille_dots_45678         0x10028f8  /* U+28f8 BRAILLE PATTERN DOTS-45678 */
+#define XK_braille_dots_145678        0x10028f9  /* U+28f9 BRAILLE PATTERN DOTS-145678 */
+#define XK_braille_dots_245678        0x10028fa  /* U+28fa BRAILLE PATTERN DOTS-245678 */
+#define XK_braille_dots_1245678       0x10028fb  /* U+28fb BRAILLE PATTERN DOTS-1245678 */
+#define XK_braille_dots_345678        0x10028fc  /* U+28fc BRAILLE PATTERN DOTS-345678 */
+#define XK_braille_dots_1345678       0x10028fd  /* U+28fd BRAILLE PATTERN DOTS-1345678 */
+#define XK_braille_dots_2345678       0x10028fe  /* U+28fe BRAILLE PATTERN DOTS-2345678 */
+#define XK_braille_dots_12345678      0x10028ff  /* U+28ff BRAILLE PATTERN DOTS-12345678 */
+#endif /* XK_BRAILLE */
+
+/*
+ * Sinhala (http://unicode.org/charts/PDF/U0D80.pdf)
+ * http://www.nongnu.org/sinhala/doc/transliteration/sinhala-transliteration_6.html
+ */
+
+#ifdef XK_SINHALA
+#define XK_Sinh_ng            0x1000d82  /* U+0D82 SINHALA ANUSVARAYA */
+#define XK_Sinh_h2            0x1000d83  /* U+0D83 SINHALA VISARGAYA */
+#define XK_Sinh_a             0x1000d85  /* U+0D85 SINHALA AYANNA */
+#define XK_Sinh_aa            0x1000d86  /* U+0D86 SINHALA AAYANNA */
+#define XK_Sinh_ae            0x1000d87  /* U+0D87 SINHALA AEYANNA */
+#define XK_Sinh_aee           0x1000d88  /* U+0D88 SINHALA AEEYANNA */
+#define XK_Sinh_i             0x1000d89  /* U+0D89 SINHALA IYANNA */
+#define XK_Sinh_ii            0x1000d8a  /* U+0D8A SINHALA IIYANNA */
+#define XK_Sinh_u             0x1000d8b  /* U+0D8B SINHALA UYANNA */
+#define XK_Sinh_uu            0x1000d8c  /* U+0D8C SINHALA UUYANNA */
+#define XK_Sinh_ri            0x1000d8d  /* U+0D8D SINHALA IRUYANNA */
+#define XK_Sinh_rii           0x1000d8e  /* U+0D8E SINHALA IRUUYANNA */
+#define XK_Sinh_lu            0x1000d8f  /* U+0D8F SINHALA ILUYANNA */
+#define XK_Sinh_luu           0x1000d90  /* U+0D90 SINHALA ILUUYANNA */
+#define XK_Sinh_e             0x1000d91  /* U+0D91 SINHALA EYANNA */
+#define XK_Sinh_ee            0x1000d92  /* U+0D92 SINHALA EEYANNA */
+#define XK_Sinh_ai            0x1000d93  /* U+0D93 SINHALA AIYANNA */
+#define XK_Sinh_o             0x1000d94  /* U+0D94 SINHALA OYANNA */
+#define XK_Sinh_oo            0x1000d95  /* U+0D95 SINHALA OOYANNA */
+#define XK_Sinh_au            0x1000d96  /* U+0D96 SINHALA AUYANNA */
+#define XK_Sinh_ka            0x1000d9a  /* U+0D9A SINHALA KAYANNA */
+#define XK_Sinh_kha           0x1000d9b  /* U+0D9B SINHALA MAHA. KAYANNA */
+#define XK_Sinh_ga            0x1000d9c  /* U+0D9C SINHALA GAYANNA */
+#define XK_Sinh_gha           0x1000d9d  /* U+0D9D SINHALA MAHA. GAYANNA */
+#define XK_Sinh_ng2           0x1000d9e  /* U+0D9E SINHALA KANTAJA NAASIKYAYA */
+#define XK_Sinh_nga           0x1000d9f  /* U+0D9F SINHALA SANYAKA GAYANNA */
+#define XK_Sinh_ca            0x1000da0  /* U+0DA0 SINHALA CAYANNA */
+#define XK_Sinh_cha           0x1000da1  /* U+0DA1 SINHALA MAHA. CAYANNA */
+#define XK_Sinh_ja            0x1000da2  /* U+0DA2 SINHALA JAYANNA */
+#define XK_Sinh_jha           0x1000da3  /* U+0DA3 SINHALA MAHA. JAYANNA */
+#define XK_Sinh_nya           0x1000da4  /* U+0DA4 SINHALA TAALUJA NAASIKYAYA */
+#define XK_Sinh_jnya          0x1000da5  /* U+0DA5 SINHALA TAALUJA SANYOOGA NAASIKYAYA */
+#define XK_Sinh_nja           0x1000da6  /* U+0DA6 SINHALA SANYAKA JAYANNA */
+#define XK_Sinh_tta           0x1000da7  /* U+0DA7 SINHALA TTAYANNA */
+#define XK_Sinh_ttha          0x1000da8  /* U+0DA8 SINHALA MAHA. TTAYANNA */
+#define XK_Sinh_dda           0x1000da9  /* U+0DA9 SINHALA DDAYANNA */
+#define XK_Sinh_ddha          0x1000daa  /* U+0DAA SINHALA MAHA. DDAYANNA */
+#define XK_Sinh_nna           0x1000dab  /* U+0DAB SINHALA MUURDHAJA NAYANNA */
+#define XK_Sinh_ndda          0x1000dac  /* U+0DAC SINHALA SANYAKA DDAYANNA */
+#define XK_Sinh_tha           0x1000dad  /* U+0DAD SINHALA TAYANNA */
+#define XK_Sinh_thha          0x1000dae  /* U+0DAE SINHALA MAHA. TAYANNA */
+#define XK_Sinh_dha           0x1000daf  /* U+0DAF SINHALA DAYANNA */
+#define XK_Sinh_dhha          0x1000db0  /* U+0DB0 SINHALA MAHA. DAYANNA */
+#define XK_Sinh_na            0x1000db1  /* U+0DB1 SINHALA DANTAJA NAYANNA */
+#define XK_Sinh_ndha          0x1000db3  /* U+0DB3 SINHALA SANYAKA DAYANNA */
+#define XK_Sinh_pa            0x1000db4  /* U+0DB4 SINHALA PAYANNA */
+#define XK_Sinh_pha           0x1000db5  /* U+0DB5 SINHALA MAHA. PAYANNA */
+#define XK_Sinh_ba            0x1000db6  /* U+0DB6 SINHALA BAYANNA */
+#define XK_Sinh_bha           0x1000db7  /* U+0DB7 SINHALA MAHA. BAYANNA */
+#define XK_Sinh_ma            0x1000db8  /* U+0DB8 SINHALA MAYANNA */
+#define XK_Sinh_mba           0x1000db9  /* U+0DB9 SINHALA AMBA BAYANNA */
+#define XK_Sinh_ya            0x1000dba  /* U+0DBA SINHALA YAYANNA */
+#define XK_Sinh_ra            0x1000dbb  /* U+0DBB SINHALA RAYANNA */
+#define XK_Sinh_la            0x1000dbd  /* U+0DBD SINHALA DANTAJA LAYANNA */
+#define XK_Sinh_va            0x1000dc0  /* U+0DC0 SINHALA VAYANNA */
+#define XK_Sinh_sha           0x1000dc1  /* U+0DC1 SINHALA TAALUJA SAYANNA */
+#define XK_Sinh_ssha          0x1000dc2  /* U+0DC2 SINHALA MUURDHAJA SAYANNA */
+#define XK_Sinh_sa            0x1000dc3  /* U+0DC3 SINHALA DANTAJA SAYANNA */
+#define XK_Sinh_ha            0x1000dc4  /* U+0DC4 SINHALA HAYANNA */
+#define XK_Sinh_lla           0x1000dc5  /* U+0DC5 SINHALA MUURDHAJA LAYANNA */
+#define XK_Sinh_fa            0x1000dc6  /* U+0DC6 SINHALA FAYANNA */
+#define XK_Sinh_al            0x1000dca  /* U+0DCA SINHALA AL-LAKUNA */
+#define XK_Sinh_aa2           0x1000dcf  /* U+0DCF SINHALA AELA-PILLA */
+#define XK_Sinh_ae2           0x1000dd0  /* U+0DD0 SINHALA AEDA-PILLA */
+#define XK_Sinh_aee2          0x1000dd1  /* U+0DD1 SINHALA DIGA AEDA-PILLA */
+#define XK_Sinh_i2            0x1000dd2  /* U+0DD2 SINHALA IS-PILLA */
+#define XK_Sinh_ii2           0x1000dd3  /* U+0DD3 SINHALA DIGA IS-PILLA */
+#define XK_Sinh_u2            0x1000dd4  /* U+0DD4 SINHALA PAA-PILLA */
+#define XK_Sinh_uu2           0x1000dd6  /* U+0DD6 SINHALA DIGA PAA-PILLA */
+#define XK_Sinh_ru2           0x1000dd8  /* U+0DD8 SINHALA GAETTA-PILLA */
+#define XK_Sinh_e2            0x1000dd9  /* U+0DD9 SINHALA KOMBUVA */
+#define XK_Sinh_ee2           0x1000dda  /* U+0DDA SINHALA DIGA KOMBUVA */
+#define XK_Sinh_ai2           0x1000ddb  /* U+0DDB SINHALA KOMBU DEKA */
+#define XK_Sinh_o2            0x1000ddc  /* U+0DDC SINHALA KOMBUVA HAA AELA-PILLA*/
+#define XK_Sinh_oo2           0x1000ddd  /* U+0DDD SINHALA KOMBUVA HAA DIGA AELA-PILLA*/
+#define XK_Sinh_au2           0x1000dde  /* U+0DDE SINHALA KOMBUVA HAA GAYANUKITTA */
+#define XK_Sinh_lu2           0x1000ddf  /* U+0DDF SINHALA GAYANUKITTA */
+#define XK_Sinh_ruu2          0x1000df2  /* U+0DF2 SINHALA DIGA GAETTA-PILLA */
+#define XK_Sinh_luu2          0x1000df3  /* U+0DF3 SINHALA DIGA GAYANUKITTA */
+#define XK_Sinh_kunddaliya    0x1000df4  /* U+0DF4 SINHALA KUNDDALIYA */
+#endif /* XK_SINHALA */
diff --git a/ThirdParty/X11/Include/X11/xpm.h b/ThirdParty/X11/Include/X11/xpm.h
new file mode 100644
index 0000000000000000000000000000000000000000..f108f1f6eaf7f5d6a11815858e7609ee6edd2e54
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/xpm.h
@@ -0,0 +1,477 @@
+/*
+ * Copyright (C) 1989-95 GROUPE BULL
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * GROUPE BULL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of GROUPE BULL shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from GROUPE BULL.
+ */
+
+/*****************************************************************************\
+* xpm.h:                                                                      *
+*                                                                             *
+*  XPM library                                                                *
+*  Include file                                                               *
+*                                                                             *
+*  Developed by Arnaud Le Hors                                                *
+\*****************************************************************************/
+
+/*
+ * The code related to FOR_MSW has been added by
+ * HeDu (hedu@cul-ipn.uni-kiel.de) 4/94
+ */
+
+/*
+ * The code related to AMIGA has been added by
+ * Lorens Younes (d93-hyo@nada.kth.se) 4/96
+ */
+
+#ifndef XPM_h
+#define XPM_h
+
+/*
+ * first some identification numbers:
+ * the version and revision numbers are determined with the following rule:
+ * SO Major number = LIB minor version number.
+ * SO Minor number = LIB sub-minor version number.
+ * e.g: Xpm version 3.2f
+ *      we forget the 3 which is the format number, 2 gives 2, and f gives 6.
+ *      thus we have XpmVersion = 2 and XpmRevision = 6
+ *      which gives  SOXPMLIBREV = 2.6
+ *
+ * Then the XpmIncludeVersion number is built from these numbers.
+ */
+#define XpmFormat 3
+#define XpmVersion 4
+#define XpmRevision 11
+#define XpmIncludeVersion ((XpmFormat * 100 + XpmVersion) * 100 + XpmRevision)
+
+#ifndef XPM_NUMBERS
+
+#ifdef FOR_MSW
+# define SYSV			/* uses memcpy string.h etc. */
+# include <malloc.h>
+# include "simx.h"		/* defines some X stuff using MSW types */
+#define NEED_STRCASECMP		/* at least for MSVC++ */
+#else /* FOR_MSW */
+# ifdef AMIGA
+#  include "amigax.h"
+# else /* not AMIGA */
+#  include <X11/Xlib.h>
+#  include <X11/Xutil.h>
+# endif /* not AMIGA */
+#endif /* FOR_MSW */
+
+/* let's define Pixel if it is not done yet */
+#if ! defined(_XtIntrinsic_h) && ! defined(PIXEL_ALREADY_TYPEDEFED)
+typedef unsigned long Pixel;	/* Index into colormap */
+# define PIXEL_ALREADY_TYPEDEFED
+#endif
+
+/* Return ErrorStatus codes:
+ * null     if full success
+ * positive if partial success
+ * negative if failure
+ */
+
+#define XpmColorError    1
+#define XpmSuccess       0
+#define XpmOpenFailed   -1
+#define XpmFileInvalid  -2
+#define XpmNoMemory     -3
+#define XpmColorFailed  -4
+
+typedef struct {
+    char *name;			/* Symbolic color name */
+    char *value;		/* Color value */
+    Pixel pixel;		/* Color pixel */
+}      XpmColorSymbol;
+
+typedef struct {
+    char *name;			/* name of the extension */
+    unsigned int nlines;	/* number of lines in this extension */
+    char **lines;		/* pointer to the extension array of strings */
+}      XpmExtension;
+
+typedef struct {
+    char *string;		/* characters string */
+    char *symbolic;		/* symbolic name */
+    char *m_color;		/* monochrom default */
+    char *g4_color;		/* 4 level grayscale default */
+    char *g_color;		/* other level grayscale default */
+    char *c_color;		/* color default */
+}      XpmColor;
+
+typedef struct {
+    unsigned int width;		/* image width */
+    unsigned int height;	/* image height */
+    unsigned int cpp;		/* number of characters per pixel */
+    unsigned int ncolors;	/* number of colors */
+    XpmColor *colorTable;	/* list of related colors */
+    unsigned int *data;		/* image data */
+}      XpmImage;
+
+typedef struct {
+    unsigned long valuemask;	/* Specifies which attributes are defined */
+    char *hints_cmt;		/* Comment of the hints section */
+    char *colors_cmt;		/* Comment of the colors section */
+    char *pixels_cmt;		/* Comment of the pixels section */
+    unsigned int x_hotspot;	/* Returns the x hotspot's coordinate */
+    unsigned int y_hotspot;	/* Returns the y hotspot's coordinate */
+    unsigned int nextensions;	/* number of extensions */
+    XpmExtension *extensions;	/* pointer to array of extensions */
+}      XpmInfo;
+
+typedef int (*XpmAllocColorFunc)(
+    Display*			/* display */,
+    Colormap			/* colormap */,
+    char*			/* colorname */,
+    XColor*			/* xcolor */,
+    void*			/* closure */
+);
+
+typedef int (*XpmFreeColorsFunc)(
+    Display*			/* display */,
+    Colormap			/* colormap */,
+    Pixel*			/* pixels */,
+    int				/* npixels */,
+    void*			/* closure */
+);
+
+typedef struct {
+    unsigned long valuemask;		/* Specifies which attributes are
+					   defined */
+
+    Visual *visual;			/* Specifies the visual to use */
+    Colormap colormap;			/* Specifies the colormap to use */
+    unsigned int depth;			/* Specifies the depth */
+    unsigned int width;			/* Returns the width of the created
+					   pixmap */
+    unsigned int height;		/* Returns the height of the created
+					   pixmap */
+    unsigned int x_hotspot;		/* Returns the x hotspot's
+					   coordinate */
+    unsigned int y_hotspot;		/* Returns the y hotspot's
+					   coordinate */
+    unsigned int cpp;			/* Specifies the number of char per
+					   pixel */
+    Pixel *pixels;			/* List of used color pixels */
+    unsigned int npixels;		/* Number of used pixels */
+    XpmColorSymbol *colorsymbols;	/* List of color symbols to override */
+    unsigned int numsymbols;		/* Number of symbols */
+    char *rgb_fname;			/* RGB text file name */
+    unsigned int nextensions;		/* Number of extensions */
+    XpmExtension *extensions;		/* List of extensions */
+
+    unsigned int ncolors;               /* Number of colors */
+    XpmColor *colorTable;               /* List of colors */
+/* 3.2 backward compatibility code */
+    char *hints_cmt;                    /* Comment of the hints section */
+    char *colors_cmt;                   /* Comment of the colors section */
+    char *pixels_cmt;                   /* Comment of the pixels section */
+/* end 3.2 bc */
+    unsigned int mask_pixel;            /* Color table index of transparent
+                                           color */
+
+    /* Color Allocation Directives */
+    Bool exactColors;			/* Only use exact colors for visual */
+    unsigned int closeness;		/* Allowable RGB deviation */
+    unsigned int red_closeness;		/* Allowable red deviation */
+    unsigned int green_closeness;	/* Allowable green deviation */
+    unsigned int blue_closeness;	/* Allowable blue deviation */
+    int color_key;			/* Use colors from this color set */
+
+    Pixel *alloc_pixels;		/* Returns the list of alloc'ed color
+					   pixels */
+    int nalloc_pixels;			/* Returns the number of alloc'ed
+					   color pixels */
+
+    Bool alloc_close_colors;    	/* Specify whether close colors should
+					   be allocated using XAllocColor
+					   or not */
+    int bitmap_format;			/* Specify the format of 1bit depth
+					   images: ZPixmap or XYBitmap */
+
+    /* Color functions */
+    XpmAllocColorFunc alloc_color;	/* Application color allocator */
+    XpmFreeColorsFunc free_colors;	/* Application color de-allocator */
+    void *color_closure;		/* Application private data to pass to
+					   alloc_color and free_colors */
+
+}      XpmAttributes;
+
+/* XpmAttributes value masks bits */
+#define XpmVisual	   (1L<<0)
+#define XpmColormap	   (1L<<1)
+#define XpmDepth	   (1L<<2)
+#define XpmSize		   (1L<<3)	/* width & height */
+#define XpmHotspot	   (1L<<4)	/* x_hotspot & y_hotspot */
+#define XpmCharsPerPixel   (1L<<5)
+#define XpmColorSymbols	   (1L<<6)
+#define XpmRgbFilename	   (1L<<7)
+/* 3.2 backward compatibility code */
+#define XpmInfos	   (1L<<8)
+#define XpmReturnInfos	   XpmInfos
+/* end 3.2 bc */
+#define XpmReturnPixels	   (1L<<9)
+#define XpmExtensions      (1L<<10)
+#define XpmReturnExtensions XpmExtensions
+
+#define XpmExactColors     (1L<<11)
+#define XpmCloseness	   (1L<<12)
+#define XpmRGBCloseness	   (1L<<13)
+#define XpmColorKey	   (1L<<14)
+
+#define XpmColorTable      (1L<<15)
+#define XpmReturnColorTable XpmColorTable
+
+#define XpmReturnAllocPixels (1L<<16)
+#define XpmAllocCloseColors (1L<<17)
+#define XpmBitmapFormat    (1L<<18)
+
+#define XpmAllocColor      (1L<<19)
+#define XpmFreeColors      (1L<<20)
+#define XpmColorClosure    (1L<<21)
+
+
+/* XpmInfo value masks bits */
+#define XpmComments        XpmInfos
+#define XpmReturnComments  XpmComments
+
+/* XpmAttributes mask_pixel value when there is no mask */
+#ifndef FOR_MSW
+#define XpmUndefPixel 0x80000000
+#else
+/* int is only 16 bit for MSW */
+#define XpmUndefPixel 0x8000
+#endif
+
+/*
+ * color keys for visual type, they must fit along with the number key of
+ * each related element in xpmColorKeys[] defined in XpmI.h
+ */
+#define XPM_MONO	2
+#define XPM_GREY4	3
+#define XPM_GRAY4	3
+#define XPM_GREY 	4
+#define XPM_GRAY 	4
+#define XPM_COLOR	5
+
+
+/* macros for forward declarations of functions with prototypes */
+#define FUNC(f, t, p) extern t f p
+#define LFUNC(f, t, p) static t f p
+
+
+/*
+ * functions declarations
+ */
+
+_XFUNCPROTOBEGIN
+
+/* FOR_MSW, all ..Pixmap.. are excluded, only the ..XImage.. are used */
+/* Same for Amiga! */
+
+#if !defined(FOR_MSW) && !defined(AMIGA)
+    FUNC(XpmCreatePixmapFromData, int, (Display *display,
+					Drawable d,
+					char **data,
+					Pixmap *pixmap_return,
+					Pixmap *shapemask_return,
+					XpmAttributes *attributes));
+
+    FUNC(XpmCreateDataFromPixmap, int, (Display *display,
+					char ***data_return,
+					Pixmap pixmap,
+					Pixmap shapemask,
+					XpmAttributes *attributes));
+
+    FUNC(XpmReadFileToPixmap, int, (Display *display,
+				    Drawable d,
+				    const char *filename,
+				    Pixmap *pixmap_return,
+				    Pixmap *shapemask_return,
+				    XpmAttributes *attributes));
+
+    FUNC(XpmWriteFileFromPixmap, int, (Display *display,
+				       const char *filename,
+				       Pixmap pixmap,
+				       Pixmap shapemask,
+				       XpmAttributes *attributes));
+#endif
+
+    FUNC(XpmCreateImageFromData, int, (Display *display,
+				       char **data,
+				       XImage **image_return,
+				       XImage **shapemask_return,
+				       XpmAttributes *attributes));
+
+    FUNC(XpmCreateDataFromImage, int, (Display *display,
+				       char ***data_return,
+				       XImage *image,
+				       XImage *shapeimage,
+				       XpmAttributes *attributes));
+
+    FUNC(XpmReadFileToImage, int, (Display *display,
+				   const char *filename,
+				   XImage **image_return,
+				   XImage **shapeimage_return,
+				   XpmAttributes *attributes));
+
+    FUNC(XpmWriteFileFromImage, int, (Display *display,
+				      const char *filename,
+				      XImage *image,
+				      XImage *shapeimage,
+				      XpmAttributes *attributes));
+
+    FUNC(XpmCreateImageFromBuffer, int, (Display *display,
+					 char *buffer,
+					 XImage **image_return,
+					 XImage **shapemask_return,
+					 XpmAttributes *attributes));
+#if !defined(FOR_MSW) && !defined(AMIGA)
+    FUNC(XpmCreatePixmapFromBuffer, int, (Display *display,
+					  Drawable d,
+					  char *buffer,
+					  Pixmap *pixmap_return,
+					  Pixmap *shapemask_return,
+					  XpmAttributes *attributes));
+
+    FUNC(XpmCreateBufferFromImage, int, (Display *display,
+					 char **buffer_return,
+					 XImage *image,
+					 XImage *shapeimage,
+					 XpmAttributes *attributes));
+
+    FUNC(XpmCreateBufferFromPixmap, int, (Display *display,
+					  char **buffer_return,
+					  Pixmap pixmap,
+					  Pixmap shapemask,
+					  XpmAttributes *attributes));
+#endif
+    FUNC(XpmReadFileToBuffer, int, (const char *filename, char **buffer_return));
+    FUNC(XpmWriteFileFromBuffer, int, (const char *filename, char *buffer));
+
+    FUNC(XpmReadFileToData, int, (const char *filename, char ***data_return));
+    FUNC(XpmWriteFileFromData, int, (const char *filename, char **data));
+
+    FUNC(XpmAttributesSize, int, (void));
+    FUNC(XpmFreeAttributes, void, (XpmAttributes *attributes));
+    FUNC(XpmFreeExtensions, void, (XpmExtension *extensions,
+				   int nextensions));
+
+    FUNC(XpmFreeXpmImage, void, (XpmImage *image));
+    FUNC(XpmFreeXpmInfo, void, (XpmInfo *info));
+    FUNC(XpmGetErrorString, char *, (int errcode));
+    FUNC(XpmLibraryVersion, int, (void));
+
+    /* XpmImage functions */
+    FUNC(XpmReadFileToXpmImage, int, (const char *filename,
+				      XpmImage *image,
+				      XpmInfo *info));
+
+    FUNC(XpmWriteFileFromXpmImage, int, (const char *filename,
+					 XpmImage *image,
+					 XpmInfo *info));
+#if !defined(FOR_MSW) && !defined(AMIGA)
+    FUNC(XpmCreatePixmapFromXpmImage, int, (Display *display,
+					    Drawable d,
+					    XpmImage *image,
+					    Pixmap *pixmap_return,
+					    Pixmap *shapemask_return,
+					    XpmAttributes *attributes));
+#endif
+    FUNC(XpmCreateImageFromXpmImage, int, (Display *display,
+					   XpmImage *image,
+					   XImage **image_return,
+					   XImage **shapeimage_return,
+					   XpmAttributes *attributes));
+
+    FUNC(XpmCreateXpmImageFromImage, int, (Display *display,
+					   XImage *image,
+					   XImage *shapeimage,
+					   XpmImage *xpmimage,
+					   XpmAttributes *attributes));
+#if !defined(FOR_MSW) && !defined(AMIGA)
+    FUNC(XpmCreateXpmImageFromPixmap, int, (Display *display,
+					    Pixmap pixmap,
+					    Pixmap shapemask,
+					    XpmImage *xpmimage,
+					    XpmAttributes *attributes));
+#endif
+    FUNC(XpmCreateDataFromXpmImage, int, (char ***data_return,
+					  XpmImage *image,
+					  XpmInfo *info));
+
+    FUNC(XpmCreateXpmImageFromData, int, (char **data,
+					  XpmImage *image,
+					  XpmInfo *info));
+
+    FUNC(XpmCreateXpmImageFromBuffer, int, (char *buffer,
+					    XpmImage *image,
+					    XpmInfo *info));
+
+    FUNC(XpmCreateBufferFromXpmImage, int, (char **buffer_return,
+					    XpmImage *image,
+					    XpmInfo *info));
+
+    FUNC(XpmGetParseError, int, (char *filename,
+				 int *linenum_return,
+				 int *charnum_return));
+
+    FUNC(XpmFree, void, (void *ptr));
+
+_XFUNCPROTOEND
+
+/* backward compatibility */
+
+/* for version 3.0c */
+#define XpmPixmapColorError  XpmColorError
+#define XpmPixmapSuccess     XpmSuccess
+#define XpmPixmapOpenFailed  XpmOpenFailed
+#define XpmPixmapFileInvalid XpmFileInvalid
+#define XpmPixmapNoMemory    XpmNoMemory
+#define XpmPixmapColorFailed XpmColorFailed
+
+#define XpmReadPixmapFile(dpy, d, file, pix, mask, att) \
+    XpmReadFileToPixmap(dpy, d, file, pix, mask, att)
+#define XpmWritePixmapFile(dpy, file, pix, mask, att) \
+    XpmWriteFileFromPixmap(dpy, file, pix, mask, att)
+
+/* for version 3.0b */
+#define PixmapColorError  XpmColorError
+#define PixmapSuccess     XpmSuccess
+#define PixmapOpenFailed  XpmOpenFailed
+#define PixmapFileInvalid XpmFileInvalid
+#define PixmapNoMemory    XpmNoMemory
+#define PixmapColorFailed XpmColorFailed
+
+#define ColorSymbol XpmColorSymbol
+
+#define XReadPixmapFile(dpy, d, file, pix, mask, att) \
+    XpmReadFileToPixmap(dpy, d, file, pix, mask, att)
+#define XWritePixmapFile(dpy, file, pix, mask, att) \
+    XpmWriteFileFromPixmap(dpy, file, pix, mask, att)
+#define XCreatePixmapFromData(dpy, d, data, pix, mask, att) \
+    XpmCreatePixmapFromData(dpy, d, data, pix, mask, att)
+#define XCreateDataFromPixmap(dpy, data, pix, mask, att) \
+    XpmCreateDataFromPixmap(dpy, data, pix, mask, att)
+
+#endif /* XPM_NUMBERS */
+#endif
diff --git a/ThirdParty/X11/Include/X11/xshmfence.h b/ThirdParty/X11/Include/X11/xshmfence.h
new file mode 100644
index 0000000000000000000000000000000000000000..27d1b823c660d0233a91bf02a3620d6e72882a3e
--- /dev/null
+++ b/ThirdParty/X11/Include/X11/xshmfence.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright © 2013 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _XSHMFENCE_H_
+#define _XSHMFENCE_H_
+
+#include <X11/Xfuncproto.h>
+
+#define HAVE_STRUCT_XSHMFENCE   1
+
+struct xshmfence;
+
+_X_EXPORT int 
+xshmfence_trigger(struct xshmfence *f);
+
+_X_EXPORT int
+xshmfence_await(struct xshmfence *f);
+
+_X_EXPORT int
+xshmfence_query(struct xshmfence *f);
+
+_X_EXPORT void
+xshmfence_reset(struct xshmfence *f);
+
+_X_EXPORT int
+xshmfence_alloc_shm(void);
+
+_X_EXPORT struct xshmfence *
+xshmfence_map_shm(int fd);
+
+_X_EXPORT void
+xshmfence_unmap_shm(struct xshmfence *f);
+
+#endif /* _XSHMFENCE_H_ */
diff --git a/nDisplay.uplugin b/nDisplay.uplugin
new file mode 100644
index 0000000000000000000000000000000000000000..92f4b906e5e9d490b3572aba8f7c681e69047d71
--- /dev/null
+++ b/nDisplay.uplugin
@@ -0,0 +1,40 @@
+{
+	"FileVersion": 3,
+	"Version" : 1,
+	"VersionName" : "1.0",
+	"FriendlyName": "nDisplay",
+	"CreatedBy" : "Epic Games Inc",
+	"CreatedByURL" : "http://epicgames.com",
+	"Description": "Support for synchronized clustered rendering using multiple PCs in mono or stereo",
+	"Category": "Misc",
+	"DocsURL": "",
+	"MarketplaceURL": "",
+	"SupportURL": "",
+	"EnabledByDefault": false,
+	"CanContainContent": true,
+	"IsBetaVersion": true,
+	"Installed": false,
+	"Modules": [
+		{
+			"Name": "DisplayCluster",
+			"Type": "Runtime",
+			"LoadingPhase": "Default",
+			"WhitelistPlatforms" :
+			[
+				"Linux",
+				"Win64"
+			]
+		},
+		{
+			"Name": "DisplayClusterEditor",
+			"Type": "Editor",
+			"LoadingPhase": "Default",
+			"WhitelistPlatforms" :
+			[
+				"Linux",
+				"Win64"
+			]
+		}
+
+	]
+}