зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1653161 - Implement Queue.writeBuffer and writeTexture in WebGPU r=jgilbert,webidl,smaug
Updates wgpu to bd50867bb8c66ac9dec50046d066c02b8f7a3fc1 Differential Revision: https://phabricator.services.mozilla.com/D83734
This commit is contained in:
Родитель
cbbcea31ff
Коммит
544f262737
|
@ -1846,7 +1846,6 @@ dependencies = [
|
|||
"raw-window-handle",
|
||||
"smallvec",
|
||||
"winapi 0.3.7",
|
||||
"x11",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -5797,16 +5796,6 @@ dependencies = [
|
|||
"winapi-build",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "x11"
|
||||
version = "2.18.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39697e3123f715483d311b5826e254b6f3cfebdd83cf7ef3358f579c3d68e235"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xfailure"
|
||||
version = "0.1.0"
|
||||
|
|
|
@ -18,56 +18,74 @@ namespace webgpu {
|
|||
GPU_IMPL_CYCLE_COLLECTION(CommandEncoder, mParent, mBridge)
|
||||
GPU_IMPL_JS_WRAP(CommandEncoder)
|
||||
|
||||
void CommandEncoder::ConvertTextureDataLayoutToFFI(
|
||||
const dom::GPUTextureDataLayout& aLayout,
|
||||
ffi::WGPUTextureDataLayout* aLayoutFFI) {
|
||||
*aLayoutFFI = {};
|
||||
aLayoutFFI->offset = aLayout.mOffset;
|
||||
aLayoutFFI->bytes_per_row = aLayout.mBytesPerRow;
|
||||
aLayoutFFI->rows_per_image = aLayout.mRowsPerImage;
|
||||
}
|
||||
|
||||
void CommandEncoder::ConvertTextureCopyViewToFFI(
|
||||
const dom::GPUTextureCopyView& aView, ffi::WGPUTextureCopyView* aViewFFI) {
|
||||
*aViewFFI = {};
|
||||
aViewFFI->texture = aView.mTexture->mId;
|
||||
aViewFFI->mip_level = aView.mMipLevel;
|
||||
if (aView.mOrigin.WasPassed()) {
|
||||
const auto& origin = aView.mOrigin.Value();
|
||||
if (origin.IsRangeEnforcedUnsignedLongSequence()) {
|
||||
const auto& seq = origin.GetAsRangeEnforcedUnsignedLongSequence();
|
||||
aViewFFI->origin.x = seq.Length() > 0 ? seq[0] : 0;
|
||||
aViewFFI->origin.y = seq.Length() > 1 ? seq[1] : 0;
|
||||
aViewFFI->origin.z = seq.Length() > 2 ? seq[2] : 0;
|
||||
} else if (origin.IsGPUOrigin3DDict()) {
|
||||
const auto& dict = origin.GetAsGPUOrigin3DDict();
|
||||
aViewFFI->origin.x = dict.mX;
|
||||
aViewFFI->origin.y = dict.mY;
|
||||
aViewFFI->origin.z = dict.mZ;
|
||||
} else {
|
||||
MOZ_CRASH("Unexpected origin type");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CommandEncoder::ConvertExtent3DToFFI(const dom::GPUExtent3D& aExtent,
|
||||
ffi::WGPUExtent3d* aExtentFFI) {
|
||||
*aExtentFFI = {};
|
||||
if (aExtent.IsRangeEnforcedUnsignedLongSequence()) {
|
||||
const auto& seq = aExtent.GetAsRangeEnforcedUnsignedLongSequence();
|
||||
aExtentFFI->width = seq.Length() > 0 ? seq[0] : 0;
|
||||
aExtentFFI->height = seq.Length() > 1 ? seq[1] : 0;
|
||||
aExtentFFI->depth = seq.Length() > 2 ? seq[2] : 0;
|
||||
} else if (aExtent.IsGPUExtent3DDict()) {
|
||||
const auto& dict = aExtent.GetAsGPUExtent3DDict();
|
||||
aExtentFFI->width = dict.mWidth;
|
||||
aExtentFFI->height = dict.mHeight;
|
||||
aExtentFFI->depth = dict.mDepth;
|
||||
} else {
|
||||
MOZ_CRASH("Unexptected extent type");
|
||||
}
|
||||
}
|
||||
|
||||
static ffi::WGPUBufferCopyView ConvertBufferCopyView(
|
||||
const dom::GPUBufferCopyView& aView) {
|
||||
ffi::WGPUBufferCopyView view = {};
|
||||
view.buffer = aView.mBuffer->mId;
|
||||
view.offset = aView.mOffset;
|
||||
view.bytes_per_row = aView.mBytesPerRow;
|
||||
view.rows_per_image = aView.mRowsPerImage;
|
||||
CommandEncoder::ConvertTextureDataLayoutToFFI(aView, &view.layout);
|
||||
return view;
|
||||
}
|
||||
|
||||
static ffi::WGPUTextureCopyView ConvertTextureCopyView(
|
||||
const dom::GPUTextureCopyView& aView) {
|
||||
ffi::WGPUTextureCopyView view = {};
|
||||
view.texture = aView.mTexture->mId;
|
||||
view.mip_level = aView.mMipLevel;
|
||||
view.array_layer = aView.mArrayLayer;
|
||||
if (aView.mOrigin.WasPassed()) {
|
||||
const auto& origin = aView.mOrigin.Value();
|
||||
if (origin.IsRangeEnforcedUnsignedLongSequence()) {
|
||||
const auto& seq = origin.GetAsRangeEnforcedUnsignedLongSequence();
|
||||
view.origin.x = seq.Length() > 0 ? seq[0] : 0;
|
||||
view.origin.y = seq.Length() > 1 ? seq[1] : 0;
|
||||
view.origin.z = seq.Length() > 2 ? seq[2] : 0;
|
||||
} else if (origin.IsGPUOrigin3DDict()) {
|
||||
const auto& dict = origin.GetAsGPUOrigin3DDict();
|
||||
view.origin.x = dict.mX;
|
||||
view.origin.y = dict.mY;
|
||||
view.origin.z = dict.mZ;
|
||||
} else {
|
||||
MOZ_CRASH("Unexpected origin type");
|
||||
}
|
||||
}
|
||||
CommandEncoder::ConvertTextureCopyViewToFFI(aView, &view);
|
||||
return view;
|
||||
}
|
||||
|
||||
static ffi::WGPUExtent3d ConvertExtent(const dom::GPUExtent3D& aExtent) {
|
||||
ffi::WGPUExtent3d extent = {};
|
||||
if (aExtent.IsRangeEnforcedUnsignedLongSequence()) {
|
||||
const auto& seq = aExtent.GetAsRangeEnforcedUnsignedLongSequence();
|
||||
extent.width = seq.Length() > 0 ? seq[0] : 0;
|
||||
extent.height = seq.Length() > 1 ? seq[1] : 0;
|
||||
extent.depth = seq.Length() > 2 ? seq[2] : 0;
|
||||
} else if (aExtent.IsGPUExtent3DDict()) {
|
||||
const auto& dict = aExtent.GetAsGPUExtent3DDict();
|
||||
extent.width = dict.mWidth;
|
||||
extent.height = dict.mHeight;
|
||||
extent.depth = dict.mDepth;
|
||||
} else {
|
||||
MOZ_CRASH("Unexptected extent type");
|
||||
}
|
||||
CommandEncoder::ConvertExtent3DToFFI(aExtent, &extent);
|
||||
return extent;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,11 @@ struct GPUTextureCopyView;
|
|||
typedef RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict GPUExtent3D;
|
||||
} // namespace dom
|
||||
namespace webgpu {
|
||||
namespace ffi {
|
||||
struct WGPUTextureDataLayout;
|
||||
struct WGPUTextureCopyView;
|
||||
struct WGPUExtent3d;
|
||||
} // namespace ffi
|
||||
|
||||
class BindGroup;
|
||||
class Buffer;
|
||||
|
@ -42,6 +47,14 @@ class CommandEncoder final : public ObjectBase, public ChildOf<Device> {
|
|||
|
||||
const RawId mId;
|
||||
|
||||
static void ConvertTextureDataLayoutToFFI(
|
||||
const dom::GPUTextureDataLayout& aLayout,
|
||||
ffi::WGPUTextureDataLayout* aLayoutFFI);
|
||||
static void ConvertTextureCopyViewToFFI(const dom::GPUTextureCopyView& aView,
|
||||
ffi::WGPUTextureCopyView* aViewFFI);
|
||||
static void ConvertExtent3DToFFI(const dom::GPUExtent3D& aExtent,
|
||||
ffi::WGPUExtent3d* aExtentFFI);
|
||||
|
||||
private:
|
||||
~CommandEncoder();
|
||||
void Cleanup();
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
#include "Queue.h"
|
||||
|
||||
#include "CommandBuffer.h"
|
||||
#include "CommandEncoder.h"
|
||||
#include "ipc/WebGPUChild.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace webgpu {
|
||||
|
@ -30,7 +32,93 @@ void Queue::Submit(
|
|||
}
|
||||
}
|
||||
|
||||
mBridge->QueueSubmit(mId, list);
|
||||
mBridge->SendQueueSubmit(mId, list);
|
||||
}
|
||||
|
||||
void Queue::WriteBuffer(const Buffer& aBuffer, uint64_t aBufferOffset,
|
||||
const dom::ArrayBuffer& aData, uint64_t aDataOffset,
|
||||
const dom::Optional<uint64_t>& aSize,
|
||||
ErrorResult& aRv) {
|
||||
aData.ComputeState();
|
||||
const auto checkedSize =
|
||||
aSize.WasPassed() ? CheckedInt<size_t>(aSize.Value())
|
||||
: CheckedInt<size_t>(aData.Length()) - aDataOffset;
|
||||
if (!checkedSize.isValid()) {
|
||||
aRv.ThrowRangeError("Mapped size is too large");
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& size = checkedSize.value();
|
||||
if (aDataOffset + size > aData.Length()) {
|
||||
aRv.ThrowAbortError(nsPrintfCString("Wrong data size %" PRIuPTR, size));
|
||||
return;
|
||||
}
|
||||
|
||||
ipc::Shmem shmem;
|
||||
if (!mBridge->AllocShmem(size, ipc::Shmem::SharedMemory::TYPE_BASIC,
|
||||
&shmem)) {
|
||||
aRv.ThrowAbortError(
|
||||
nsPrintfCString("Unable to allocate shmem of size %" PRIuPTR, size));
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(shmem.get<uint8_t>(), aData.Data() + aDataOffset, size);
|
||||
mBridge->SendQueueWriteBuffer(mId, aBuffer.mId, aBufferOffset,
|
||||
std::move(shmem));
|
||||
}
|
||||
|
||||
void Queue::WriteTexture(const dom::GPUTextureCopyView& aDestination,
|
||||
const dom::ArrayBuffer& aData,
|
||||
const dom::GPUTextureDataLayout& aDataLayout,
|
||||
const dom::GPUExtent3D& aSize, ErrorResult& aRv) {
|
||||
ffi::WGPUTextureCopyView copyView = {};
|
||||
CommandEncoder::ConvertTextureCopyViewToFFI(aDestination, ©View);
|
||||
ffi::WGPUTextureDataLayout dataLayout = {};
|
||||
CommandEncoder::ConvertTextureDataLayoutToFFI(aDataLayout, &dataLayout);
|
||||
dataLayout.offset = 0; // our Shmem has the contents starting from 0.
|
||||
ffi::WGPUExtent3d extent = {};
|
||||
CommandEncoder::ConvertExtent3DToFFI(aSize, &extent);
|
||||
|
||||
const auto bpt = aDestination.mTexture->BytesPerTexel();
|
||||
if (bpt == 0) {
|
||||
aRv.ThrowAbortError(nsPrintfCString("Invalid texture format"));
|
||||
return;
|
||||
}
|
||||
if (extent.width == 0 || extent.height == 0 || extent.depth == 0) {
|
||||
aRv.ThrowAbortError(nsPrintfCString("Invalid copy size"));
|
||||
return;
|
||||
}
|
||||
|
||||
aData.ComputeState();
|
||||
const auto fullRows =
|
||||
(CheckedInt<size_t>(extent.depth - 1) * aDataLayout.mRowsPerImage +
|
||||
extent.height - 1);
|
||||
const auto checkedSize = fullRows * aDataLayout.mBytesPerRow +
|
||||
CheckedInt<size_t>(extent.width) * bpt;
|
||||
if (!checkedSize.isValid()) {
|
||||
aRv.ThrowRangeError("Mapped size is too large");
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& size = checkedSize.value();
|
||||
auto availableSize = aData.Length();
|
||||
if (availableSize < aDataLayout.mOffset ||
|
||||
size > (availableSize - aDataLayout.mOffset)) {
|
||||
aRv.ThrowAbortError(nsPrintfCString("Wrong data size %" PRIuPTR, size));
|
||||
return;
|
||||
}
|
||||
|
||||
ipc::Shmem shmem;
|
||||
if (!mBridge->AllocShmem(size, ipc::Shmem::SharedMemory::TYPE_BASIC,
|
||||
&shmem)) {
|
||||
aRv.ThrowAbortError(
|
||||
nsPrintfCString("Unable to allocate shmem of size %" PRIuPTR, size));
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(shmem.get<uint8_t>(), aData.Data() + aDataLayout.mOffset, size);
|
||||
mBridge->SendQueueWriteTexture(mId, copyView, std::move(shmem), dataLayout,
|
||||
extent);
|
||||
}
|
||||
|
||||
} // namespace webgpu
|
||||
|
|
|
@ -8,14 +8,23 @@
|
|||
|
||||
#include "nsWrapperCache.h"
|
||||
#include "ObjectModel.h"
|
||||
#include "mozilla/dom/TypedArray.h"
|
||||
|
||||
namespace mozilla {
|
||||
class ErrorResult;
|
||||
namespace dom {
|
||||
class RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict;
|
||||
template <typename T>
|
||||
class Optional;
|
||||
template <typename T>
|
||||
class Sequence;
|
||||
}
|
||||
struct TextureCopyView;
|
||||
struct TextureDataLayout;
|
||||
typedef RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict GPUExtent3D;
|
||||
} // namespace dom
|
||||
namespace webgpu {
|
||||
|
||||
class Buffer;
|
||||
class CommandBuffer;
|
||||
class Device;
|
||||
class Fence;
|
||||
|
@ -30,6 +39,15 @@ class Queue final : public ObjectBase, public ChildOf<Device> {
|
|||
void Submit(
|
||||
const dom::Sequence<OwningNonNull<CommandBuffer>>& aCommandBuffers);
|
||||
|
||||
void WriteBuffer(const Buffer& aBuffer, uint64_t aBufferOffset,
|
||||
const dom::ArrayBuffer& adata, uint64_t aDataOffset,
|
||||
const dom::Optional<uint64_t>& aSize, ErrorResult& aRv);
|
||||
|
||||
void WriteTexture(const dom::GPUTextureCopyView& aDestination,
|
||||
const dom::ArrayBuffer& aData,
|
||||
const dom::GPUTextureDataLayout& aDataLayout,
|
||||
const dom::GPUExtent3D& aSize, ErrorResult& aRv);
|
||||
|
||||
private:
|
||||
Queue() = delete;
|
||||
virtual ~Queue();
|
||||
|
|
|
@ -158,7 +158,8 @@ void RenderPassEncoder::SetIndexBuffer(const Buffer& aBuffer, uint64_t aOffset,
|
|||
uint64_t aSize) {
|
||||
if (mValid) {
|
||||
mUsedBuffers.AppendElement(&aBuffer);
|
||||
ffi::wgpu_render_pass_set_index_buffer(&mRaw, aBuffer.mId, aOffset, aSize);
|
||||
ffi::wgpu_render_pass_set_index_buffer(&mRaw, aBuffer.mId, aOffset,
|
||||
ffi::make_buffer_size(aSize));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,7 +168,7 @@ void RenderPassEncoder::SetVertexBuffer(uint32_t aSlot, const Buffer& aBuffer,
|
|||
if (mValid) {
|
||||
mUsedBuffers.AppendElement(&aBuffer);
|
||||
ffi::wgpu_render_pass_set_vertex_buffer(&mRaw, aSlot, aBuffer.mId, aOffset,
|
||||
aSize);
|
||||
ffi::make_buffer_size(aSize));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,53 @@ void Texture::Cleanup() {
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t Texture::BytesPerTexel() const {
|
||||
switch (mDefaultViewDescriptor->format) {
|
||||
case ffi::WGPUTextureFormat_R8Unorm:
|
||||
case ffi::WGPUTextureFormat_R8Snorm:
|
||||
case ffi::WGPUTextureFormat_R8Uint:
|
||||
case ffi::WGPUTextureFormat_R8Sint:
|
||||
return 1;
|
||||
case ffi::WGPUTextureFormat_R16Uint:
|
||||
case ffi::WGPUTextureFormat_R16Sint:
|
||||
case ffi::WGPUTextureFormat_R16Float:
|
||||
case ffi::WGPUTextureFormat_Rg8Unorm:
|
||||
case ffi::WGPUTextureFormat_Rg8Snorm:
|
||||
case ffi::WGPUTextureFormat_Rg8Uint:
|
||||
case ffi::WGPUTextureFormat_Rg8Sint:
|
||||
return 2;
|
||||
case ffi::WGPUTextureFormat_R32Uint:
|
||||
case ffi::WGPUTextureFormat_R32Sint:
|
||||
case ffi::WGPUTextureFormat_R32Float:
|
||||
case ffi::WGPUTextureFormat_Rg16Uint:
|
||||
case ffi::WGPUTextureFormat_Rg16Sint:
|
||||
case ffi::WGPUTextureFormat_Rg16Float:
|
||||
case ffi::WGPUTextureFormat_Rgba8Unorm:
|
||||
case ffi::WGPUTextureFormat_Rgba8UnormSrgb:
|
||||
case ffi::WGPUTextureFormat_Rgba8Snorm:
|
||||
case ffi::WGPUTextureFormat_Rgba8Uint:
|
||||
case ffi::WGPUTextureFormat_Rgba8Sint:
|
||||
case ffi::WGPUTextureFormat_Bgra8Unorm:
|
||||
case ffi::WGPUTextureFormat_Bgra8UnormSrgb:
|
||||
case ffi::WGPUTextureFormat_Rgb10a2Unorm:
|
||||
case ffi::WGPUTextureFormat_Rg11b10Float:
|
||||
return 4;
|
||||
case ffi::WGPUTextureFormat_Rg32Uint:
|
||||
case ffi::WGPUTextureFormat_Rg32Sint:
|
||||
case ffi::WGPUTextureFormat_Rg32Float:
|
||||
return 8;
|
||||
case ffi::WGPUTextureFormat_Rgba16Uint:
|
||||
case ffi::WGPUTextureFormat_Rgba16Sint:
|
||||
case ffi::WGPUTextureFormat_Rgba16Float:
|
||||
case ffi::WGPUTextureFormat_Rgba32Uint:
|
||||
case ffi::WGPUTextureFormat_Rgba32Sint:
|
||||
case ffi::WGPUTextureFormat_Rgba32Float:
|
||||
return 16;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
already_AddRefed<TextureView> Texture::CreateView(
|
||||
const dom::GPUTextureViewDescriptor& aDesc) {
|
||||
RawId id = mParent->GetBridge()->TextureCreateView(mId, aDesc,
|
||||
|
|
|
@ -36,6 +36,8 @@ class Texture final : public ObjectBase, public ChildOf<Device> {
|
|||
|
||||
WeakPtr<dom::HTMLCanvasElement> mTargetCanvasElement;
|
||||
|
||||
uint8_t BytesPerTexel() const;
|
||||
|
||||
private:
|
||||
virtual ~Texture();
|
||||
void Cleanup();
|
||||
|
|
|
@ -24,6 +24,7 @@ using webgpu::ffi::WGPUTextureDescriptor from "mozilla/webgpu/ffi/wgpu.h";
|
|||
using webgpu::ffi::WGPUSamplerDescriptor from "mozilla/webgpu/ffi/wgpu.h";
|
||||
using webgpu::ffi::WGPUTextureViewDescriptor from "mozilla/webgpu/ffi/wgpu.h";
|
||||
using webgpu::ffi::WGPUBufferCopyView from "mozilla/webgpu/ffi/wgpu.h";
|
||||
using webgpu::ffi::WGPUTextureDataLayout from "mozilla/webgpu/ffi/wgpu.h";
|
||||
using webgpu::ffi::WGPUTextureCopyView from "mozilla/webgpu/ffi/wgpu.h";
|
||||
using webgpu::ffi::WGPUExtent3d from "mozilla/webgpu/ffi/wgpu.h";
|
||||
|
||||
|
@ -57,6 +58,7 @@ parent:
|
|||
async TextureViewDestroy(RawId selfId);
|
||||
async DeviceCreateSampler(RawId selfId, WGPUSamplerDescriptor desc, nsCString label, RawId newId);
|
||||
async SamplerDestroy(RawId selfId);
|
||||
|
||||
async DeviceCreateCommandEncoder(RawId selfId, GPUCommandEncoderDescriptor desc, RawId newId);
|
||||
async CommandEncoderCopyBufferToBuffer(RawId selfId, RawId sourceId, BufferAddress sourceOffset, RawId destinationId, BufferAddress destinationOffset, BufferAddress size);
|
||||
async CommandEncoderCopyBufferToTexture(RawId selfId, WGPUBufferCopyView source, WGPUTextureCopyView destination, WGPUExtent3d extent);
|
||||
|
@ -68,6 +70,9 @@ parent:
|
|||
async CommandEncoderDestroy(RawId selfId);
|
||||
async CommandBufferDestroy(RawId selfId);
|
||||
async QueueSubmit(RawId selfId, RawId[] commandBuffers);
|
||||
async QueueWriteBuffer(RawId selfId, RawId bufferId, BufferAddress bufferOffset, Shmem shmem);
|
||||
async QueueWriteTexture(RawId selfId, WGPUTextureCopyView destination, Shmem shmem, WGPUTextureDataLayout layout, WGPUExtent3d extent);
|
||||
|
||||
async DeviceCreateBindGroupLayout(RawId selfId, SerialBindGroupLayoutDescriptor desc, RawId newId);
|
||||
async BindGroupLayoutDestroy(RawId selfId);
|
||||
async DeviceCreatePipelineLayout(RawId selfId, SerialPipelineLayoutDescriptor desc, RawId newId);
|
||||
|
@ -83,6 +88,7 @@ parent:
|
|||
async DeviceCreateSwapChain(RawId selfId, RawId queueId, RGBDescriptor desc, RawId[] bufferIds, ExternalImageId externalId);
|
||||
async SwapChainPresent(ExternalImageId externalId, RawId textureId, RawId commandEncoderId);
|
||||
async SwapChainDestroy(ExternalImageId externalId);
|
||||
|
||||
async Shutdown();
|
||||
|
||||
child:
|
||||
|
|
|
@ -159,13 +159,13 @@ RawId WebGPUChild::TextureCreateView(
|
|||
|
||||
desc.aspect = ffi::WGPUTextureAspect(aDesc.mAspect);
|
||||
desc.base_mip_level = aDesc.mBaseMipLevel;
|
||||
desc.level_count = aDesc.mMipLevelCount
|
||||
? aDesc.mMipLevelCount
|
||||
desc.level_count = aDesc.mMipLevelCount.WasPassed()
|
||||
? aDesc.mMipLevelCount.Value()
|
||||
: aDefaultViewDesc.level_count - aDesc.mBaseMipLevel;
|
||||
desc.base_array_layer = aDesc.mBaseArrayLayer;
|
||||
desc.array_layer_count =
|
||||
aDesc.mArrayLayerCount
|
||||
? aDesc.mArrayLayerCount
|
||||
aDesc.mArrayLayerCount.WasPassed()
|
||||
? aDesc.mArrayLayerCount.Value()
|
||||
: aDefaultViewDesc.array_layer_count - aDesc.mBaseArrayLayer;
|
||||
|
||||
RawId id = ffi::wgpu_client_make_texture_view_id(mClient, aSelfId);
|
||||
|
@ -440,11 +440,6 @@ RawId WebGPUChild::DeviceCreateRenderPipeline(
|
|||
return id;
|
||||
}
|
||||
|
||||
void WebGPUChild::QueueSubmit(RawId aSelfId,
|
||||
const nsTArray<RawId>& aCommandBufferIds) {
|
||||
SendQueueSubmit(aSelfId, aCommandBufferIds);
|
||||
}
|
||||
|
||||
ipc::IPCResult WebGPUChild::RecvFreeAdapter(RawId id) {
|
||||
ffi::wgpu_client_kill_adapter_id(mClient, id);
|
||||
return IPC_OK();
|
||||
|
|
|
@ -69,8 +69,6 @@ class WebGPUChild final : public PWebGPUChild {
|
|||
RawId DeviceCreateRenderPipeline(
|
||||
RawId aSelfId, const dom::GPURenderPipelineDescriptor& aDesc);
|
||||
|
||||
void QueueSubmit(RawId aSelfId, const nsTArray<RawId>& aCommandBufferIds);
|
||||
|
||||
void DeviceCreateSwapChain(RawId aSelfId, const RGBDescriptor& aRgbDesc,
|
||||
size_t maxBufferCount,
|
||||
wr::ExternalImageId aExternalImageId);
|
||||
|
|
|
@ -325,21 +325,21 @@ ipc::IPCResult WebGPUParent::RecvCommandEncoderCopyBufferToTexture(
|
|||
RawId aSelfId, WGPUBufferCopyView aSource, WGPUTextureCopyView aDestination,
|
||||
WGPUExtent3d aCopySize) {
|
||||
ffi::wgpu_server_encoder_copy_buffer_to_texture(mContext, aSelfId, &aSource,
|
||||
&aDestination, aCopySize);
|
||||
&aDestination, &aCopySize);
|
||||
return IPC_OK();
|
||||
}
|
||||
ipc::IPCResult WebGPUParent::RecvCommandEncoderCopyTextureToBuffer(
|
||||
RawId aSelfId, WGPUTextureCopyView aSource, WGPUBufferCopyView aDestination,
|
||||
WGPUExtent3d aCopySize) {
|
||||
ffi::wgpu_server_encoder_copy_texture_to_buffer(mContext, aSelfId, &aSource,
|
||||
&aDestination, aCopySize);
|
||||
&aDestination, &aCopySize);
|
||||
return IPC_OK();
|
||||
}
|
||||
ipc::IPCResult WebGPUParent::RecvCommandEncoderCopyTextureToTexture(
|
||||
RawId aSelfId, WGPUTextureCopyView aSource,
|
||||
WGPUTextureCopyView aDestination, WGPUExtent3d aCopySize) {
|
||||
ffi::wgpu_server_encoder_copy_texture_to_texture(mContext, aSelfId, &aSource,
|
||||
&aDestination, aCopySize);
|
||||
&aDestination, &aCopySize);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
@ -384,6 +384,28 @@ ipc::IPCResult WebGPUParent::RecvQueueSubmit(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
ipc::IPCResult WebGPUParent::RecvQueueWriteBuffer(RawId aSelfId,
|
||||
RawId aBufferId,
|
||||
uint64_t aBufferOffset,
|
||||
Shmem&& aShmem) {
|
||||
ffi::wgpu_server_queue_write_buffer(mContext, aSelfId, aBufferId,
|
||||
aBufferOffset, aShmem.get<uint8_t>(),
|
||||
aShmem.Size<uint8_t>());
|
||||
DeallocShmem(aShmem);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
ipc::IPCResult WebGPUParent::RecvQueueWriteTexture(
|
||||
RawId aSelfId, const ffi::WGPUTextureCopyView& aDestination, Shmem&& aShmem,
|
||||
const ffi::WGPUTextureDataLayout& aDataLayout,
|
||||
const ffi::WGPUExtent3d& aExtent) {
|
||||
ffi::wgpu_server_queue_write_texture(
|
||||
mContext, aSelfId, &aDestination, aShmem.get<uint8_t>(),
|
||||
aShmem.Size<uint8_t>(), &aDataLayout, &aExtent);
|
||||
DeallocShmem(aShmem);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
ipc::IPCResult WebGPUParent::RecvDeviceCreateBindGroupLayout(
|
||||
RawId aSelfId, const SerialBindGroupLayoutDescriptor& aDesc, RawId aNewId) {
|
||||
ffi::WGPUBindGroupLayoutDescriptor desc = {};
|
||||
|
@ -425,7 +447,7 @@ ipc::IPCResult WebGPUParent::RecvDeviceCreateBindGroup(
|
|||
bgb.resource.tag = ffi::WGPUBindingResource_Buffer;
|
||||
bgb.resource.buffer._0.buffer = entry.mValue;
|
||||
bgb.resource.buffer._0.offset = entry.mBufferOffset;
|
||||
bgb.resource.buffer._0.size = entry.mBufferSize;
|
||||
bgb.resource.buffer._0.size = ffi::make_buffer_size(entry.mBufferSize);
|
||||
break;
|
||||
case SerialBindGroupEntryType::Texture:
|
||||
bgb.resource.tag = ffi::WGPUBindingResource_TextureView;
|
||||
|
@ -655,19 +677,22 @@ ipc::IPCResult WebGPUParent::RecvSwapChainPresent(
|
|||
const ffi::WGPUTextureCopyView texView = {
|
||||
aTextureId,
|
||||
};
|
||||
const ffi::WGPUBufferCopyView bufView = {
|
||||
bufferId,
|
||||
const ffi::WGPUTextureDataLayout bufLayout = {
|
||||
0,
|
||||
data->mSourcePitch,
|
||||
0,
|
||||
};
|
||||
const ffi::WGPUBufferCopyView bufView = {
|
||||
bufferId,
|
||||
bufLayout,
|
||||
};
|
||||
const ffi::WGPUExtent3d extent = {
|
||||
static_cast<uint32_t>(size.width),
|
||||
static_cast<uint32_t>(size.height),
|
||||
1,
|
||||
};
|
||||
ffi::wgpu_server_encoder_copy_texture_to_buffer(mContext, aCommandEncoderId,
|
||||
&texView, &bufView, extent);
|
||||
&texView, &bufView, &extent);
|
||||
ffi::WGPUCommandBufferDescriptor commandDesc = {};
|
||||
ffi::wgpu_server_encoder_finish(mContext, aCommandEncoderId, &commandDesc);
|
||||
ffi::wgpu_server_queue_submit(mContext, data->mQueueId, &aCommandEncoderId,
|
||||
|
|
|
@ -66,14 +66,21 @@ class WebGPUParent final : public PWebGPUParent {
|
|||
ipc::IPCResult RecvCommandEncoderCopyTextureToTexture(
|
||||
RawId aSelfId, WGPUTextureCopyView aSource,
|
||||
WGPUTextureCopyView aDestination, WGPUExtent3d aCopySize);
|
||||
ipc::IPCResult RecvCommandEncoderRunComputePass(RawId aSelfId, Shmem&& shmem);
|
||||
ipc::IPCResult RecvCommandEncoderRunRenderPass(RawId aSelfId, Shmem&& shmem);
|
||||
ipc::IPCResult RecvCommandEncoderRunComputePass(RawId aSelfId,
|
||||
Shmem&& aShmem);
|
||||
ipc::IPCResult RecvCommandEncoderRunRenderPass(RawId aSelfId, Shmem&& aShmem);
|
||||
ipc::IPCResult RecvCommandEncoderFinish(
|
||||
RawId aSelfId, const dom::GPUCommandBufferDescriptor& aDesc);
|
||||
ipc::IPCResult RecvCommandEncoderDestroy(RawId aSelfId);
|
||||
ipc::IPCResult RecvCommandBufferDestroy(RawId aSelfId);
|
||||
ipc::IPCResult RecvQueueSubmit(RawId aSelfId,
|
||||
const nsTArray<RawId>& aCommandBuffers);
|
||||
ipc::IPCResult RecvQueueWriteBuffer(RawId aSelfId, RawId aBufferId,
|
||||
uint64_t aBufferOffset, Shmem&& aShmem);
|
||||
ipc::IPCResult RecvQueueWriteTexture(
|
||||
RawId aSelfId, const ffi::WGPUTextureCopyView& aDestination,
|
||||
Shmem&& aShmem, const ffi::WGPUTextureDataLayout& aDataLayout,
|
||||
const ffi::WGPUExtent3d& aExtent);
|
||||
ipc::IPCResult RecvDeviceCreateBindGroupLayout(
|
||||
RawId aSelfId, const SerialBindGroupLayoutDescriptor& aDesc,
|
||||
RawId aNewId);
|
||||
|
|
|
@ -85,7 +85,7 @@ DEFINE_IPC_SERIALIZER_WITH_FIELDS(mozilla::webgpu::ffi::WGPUSamplerDescriptor,
|
|||
label, address_mode_u, address_mode_v,
|
||||
address_mode_w, mag_filter, min_filter,
|
||||
mipmap_filter, lod_min_clamp, lod_max_clamp,
|
||||
compare);
|
||||
compare, anisotropy_clamp);
|
||||
DEFINE_IPC_SERIALIZER_WITH_FIELDS(mozilla::webgpu::ffi::WGPUExtent3d, width,
|
||||
height, depth);
|
||||
DEFINE_IPC_SERIALIZER_WITH_FIELDS(mozilla::webgpu::ffi::WGPUOrigin3d, x, y, z);
|
||||
|
@ -111,11 +111,12 @@ DEFINE_IPC_SERIALIZER_WITH_FIELDS(
|
|||
mozilla::webgpu::ffi::WGPUVertexAttributeDescriptor, offset, format,
|
||||
shader_location);
|
||||
|
||||
DEFINE_IPC_SERIALIZER_WITH_FIELDS(mozilla::webgpu::ffi::WGPUTextureDataLayout,
|
||||
offset, bytes_per_row, rows_per_image);
|
||||
DEFINE_IPC_SERIALIZER_WITH_FIELDS(mozilla::webgpu::ffi::WGPUBufferCopyView,
|
||||
buffer, offset, bytes_per_row,
|
||||
rows_per_image);
|
||||
buffer, layout);
|
||||
DEFINE_IPC_SERIALIZER_WITH_FIELDS(mozilla::webgpu::ffi::WGPUTextureCopyView,
|
||||
texture, mip_level, array_layer, origin);
|
||||
texture, mip_level, origin);
|
||||
|
||||
DEFINE_IPC_SERIALIZER_WITH_FIELDS(
|
||||
mozilla::webgpu::ffi::WGPUBindGroupLayoutEntry, binding, visibility, ty,
|
||||
|
|
|
@ -9,3 +9,4 @@ run_if = nightly_build
|
|||
[test_command_buffer_creation.html]
|
||||
[test_submit_compute_empty.html]
|
||||
[test_submit_render_empty.html]
|
||||
[test_queue_write.html]
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
|
||||
ok(SpecialPowers.getBoolPref('dom.webgpu.enabled'), 'Pref should be enabled.');
|
||||
|
||||
const func = async function() {
|
||||
const adapter = await navigator.gpu.requestAdapter();
|
||||
const device = await adapter.requestDevice();
|
||||
const buffer = device.createBuffer({size:16, usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.COPY_SRC | GPUBufferUsage.VERTEX});
|
||||
const arrayBuf = new ArrayBuffer(16);
|
||||
(new Int32Array(arrayBuf)).fill(5)
|
||||
device.defaultQueue.writeBuffer(buffer, 0, arrayBuf, 0);
|
||||
const texture = device.createTexture({size: [2,2,1], dimension: "2d", format: "rgba8unorm", usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.COPY_SRC });
|
||||
device.defaultQueue.writeTexture({ texture }, arrayBuf, { bytesPerRow:8 }, [2,2,1]);
|
||||
// this isn't a process check, we need to read back the contents and verify the writes happened
|
||||
ok(device !== undefined, '');
|
||||
};
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
func().finally(() => SimpleTest.finish());
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -347,9 +347,9 @@ dictionary GPUTextureViewDescriptor : GPUObjectDescriptorBase {
|
|||
GPUTextureViewDimension dimension;
|
||||
GPUTextureAspect aspect = "all";
|
||||
GPUIntegerCoordinate baseMipLevel = 0;
|
||||
GPUIntegerCoordinate mipLevelCount = 1;
|
||||
GPUIntegerCoordinate mipLevelCount;
|
||||
GPUIntegerCoordinate baseArrayLayer = 0;
|
||||
GPUIntegerCoordinate arrayLayerCount = 1;
|
||||
GPUIntegerCoordinate arrayLayerCount;
|
||||
};
|
||||
|
||||
[Pref="dom.webgpu.enabled",
|
||||
|
@ -767,7 +767,6 @@ dictionary GPUBufferCopyView : GPUTextureDataLayout {
|
|||
dictionary GPUTextureCopyView {
|
||||
required GPUTexture texture;
|
||||
GPUIntegerCoordinate mipLevel = 0;
|
||||
GPUSize32 arrayLayer = 0;
|
||||
GPUOrigin3D origin;
|
||||
};
|
||||
|
||||
|
@ -951,6 +950,21 @@ interface GPUQueue {
|
|||
|
||||
//GPUFence createFence(optional GPUFenceDescriptor descriptor = {});
|
||||
//void signal(GPUFence fence, GPUFenceValue signalValue);
|
||||
|
||||
[Throws]
|
||||
void writeBuffer(
|
||||
GPUBuffer buffer,
|
||||
GPUSize64 bufferOffset,
|
||||
[AllowShared] ArrayBuffer data,
|
||||
optional GPUSize64 dataOffset = 0,
|
||||
optional GPUSize64 size);
|
||||
|
||||
[Throws]
|
||||
void writeTexture(
|
||||
GPUTextureCopyView destination,
|
||||
[AllowShared] ArrayBuffer data,
|
||||
GPUTextureDataLayout dataLayout,
|
||||
GPUExtent3D size);
|
||||
};
|
||||
GPUQueue includes GPUObjectBase;
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ assignees: ''
|
|||
|
||||
---
|
||||
|
||||
<! Thank you for filing this! Please read the [debugging tips](https://github.com/gfx-rs/wgpu/wiki/Debbugging-wgpu-Applications).
|
||||
That may let you investigate on your own, or provide additional information that helps us to assist.>
|
||||
<!-- Thank you for filing this! Please read the [debugging tips](https://github.com/gfx-rs/wgpu/wiki/Debbugging-wgpu-Applications).
|
||||
That may let you investigate on your own, or provide additional information that helps us to assist.-->
|
||||
|
||||
**Description**
|
||||
A clear and concise description of what the bug is.
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
**Connections**
|
||||
_Link to the issues addressed by this PR, or dependent PRs in other repositories_
|
||||
|
||||
**Description**
|
||||
_Describe what problem this is solving, and how it's solved._
|
||||
|
||||
**Testing**
|
||||
_Explain how this change is tested._
|
||||
<!--
|
||||
Non-trivial functional changes would need to be tested through:
|
||||
- [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
|
||||
- [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.
|
||||
|
||||
Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
|
||||
See https://github.com/gfx-rs/wgpu/pull/666 for an example.
|
||||
If you can add a unit/integration test here in `wgpu`, that would be best.
|
||||
-->
|
|
@ -96,7 +96,8 @@ jobs:
|
|||
name: Install latest nightly
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: nightly
|
||||
# temporary due to https://github.com/rust-lang/rust/issues/72467
|
||||
toolchain: nightly-2020-05-01
|
||||
override: true
|
||||
- if: matrix.channel == 'stable'
|
||||
run: rustup component add clippy
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Change Log
|
||||
|
||||
## v0.5 (06-04-2020)
|
||||
## v0.5 (2020-04-06)
|
||||
- Crates:
|
||||
- `wgpu-types`: common types between native and web targets
|
||||
- `wgpu-core`: internal API for the native and remote wrappers
|
||||
|
@ -20,17 +20,17 @@
|
|||
- unmapping dropped buffers
|
||||
- better error messages on misused swapchain frames
|
||||
|
||||
## v0.4.3 (20-01-2020)
|
||||
## v0.4.3 (2020-01-20)
|
||||
- improved swap chain error handling
|
||||
|
||||
## v0.4.2 (15-12-2019)
|
||||
## v0.4.2 (2019-12-15)
|
||||
- fixed render pass transitions
|
||||
|
||||
## v0.4.1 (28-11-2019)
|
||||
## v0.4.1 (2019-11-28)
|
||||
- fixed depth/stencil transitions
|
||||
- fixed dynamic offset iteration
|
||||
|
||||
## v0.4 (03-11-2019)
|
||||
## v0.4 (2019-11-03)
|
||||
- Platforms: removed OpenGL/WebGL support temporarily
|
||||
- Features:
|
||||
- based on gfx-hal-0.4 with the new swapchain model
|
||||
|
@ -40,13 +40,13 @@
|
|||
- Validation:
|
||||
- buffer and texture usage
|
||||
|
||||
## v0.3.3 (22-08-2019)
|
||||
## v0.3.3 (2019-08-22)
|
||||
- fixed instance creation on Windows
|
||||
|
||||
## v0.3.1 (21-08-2019)
|
||||
## v0.3.1 (2019-08-21)
|
||||
- fixed pipeline barriers that aren't transitions
|
||||
|
||||
## v0.3 (21-08-2019)
|
||||
## v0.3 (2019-08-21)
|
||||
- Platforms: experimental OpenGL/WebGL
|
||||
- Crates:
|
||||
- Rust API is moved out to [another repository](https://github.com/gfx-rs/wgpu-rs)
|
||||
|
@ -66,23 +66,23 @@
|
|||
- bind group buffer ranges
|
||||
- required stencil reference, blend color
|
||||
|
||||
## v0.2.6 (04-04-2019)
|
||||
## v0.2.6 (2019-04-04)
|
||||
- fixed frame acquisition GPU waits
|
||||
|
||||
## v0.2.5 (31-03-2019)
|
||||
## v0.2.5 (2019-03-31)
|
||||
- fixed submission tracking
|
||||
- added support for blend colors
|
||||
- fixed bind group compatibility at the gfx-hal level
|
||||
- validating the bind groups and blend colors
|
||||
|
||||
## v0.2.3 (20-03-2019)
|
||||
## v0.2.3 (2019-03-20)
|
||||
- fixed vertex format mapping
|
||||
- fixed building with "empty" backend on Windows
|
||||
- bumped the default descriptor pool size
|
||||
- fixed host mapping alignments
|
||||
- validating the uniform buffer offset
|
||||
|
||||
## v0.2 (06-03-2019)
|
||||
## v0.2 (2019-03-06)
|
||||
- Platforms: iOS/Metal, D3D11
|
||||
- Crates:
|
||||
- `wgpu-remote`: remoting layer for the cross-process boundary
|
||||
|
@ -101,7 +101,7 @@
|
|||
- Fixes
|
||||
- fixed resource destruction
|
||||
|
||||
## v0.1 (24-01-2019)
|
||||
## v0.1 (2019-01-24)
|
||||
- Platforms: Linux/Vulkan, Windows/Vulkan, D3D12, macOS/Metal
|
||||
- Crates:
|
||||
- `wgpu-native`: C API implementation of WebGPU, based on gfx-hal
|
||||
|
|
|
@ -908,6 +908,7 @@ name = "player"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"env_logger",
|
||||
"gfx-backend-vulkan",
|
||||
"log",
|
||||
"raw-window-handle",
|
||||
"renderdoc",
|
||||
|
|
|
@ -6,20 +6,16 @@ This is an active GitHub mirror of the WebGPU implementation in Rust, which now
|
|||
|
||||
[![Matrix](https://img.shields.io/badge/Matrix-%23wgpu%3Amatrix.org-blueviolet.svg)](https://matrix.to/#/#wgpu:matrix.org)
|
||||
[![Build Status](https://github.com/gfx-rs/wgpu/workflows/CI/badge.svg)](https://github.com/gfx-rs/wgpu/actions)
|
||||
[![Crates.io](https://img.shields.io/crates/v/wgpu-core.svg?label=wgpu-core)](https://crates.io/crates/wgpu-core)
|
||||
[![docs.rs](https://docs.rs/wgpu-core/badge.svg)](https://docs.rs/wgpu-core/)
|
||||
[![Crates.io](https://img.shields.io/crates/v/wgpu-native.svg?label=wgpu-native)](https://crates.io/crates/wgpu-native)
|
||||
[![docs.rs](https://docs.rs/wgpu-types/badge.svg)](https://docs.rs/wgpu-types/)
|
||||
|
||||
This is the core logic of an experimental [WebGPU](https://www.w3.org/community/gpu/) implementation. It's written in Rust and is based on [gfx-hal](https://github.com/gfx-rs/gfx) with help of [gfx-extras](https://github.com/gfx-rs/gfx-extras). See the upstream [WebGPU specification](https://gpuweb.github.io/gpuweb/) (work in progress).
|
||||
|
||||
The implementation consists of the following parts:
|
||||
|
||||
- `wgpu-core` - internal Rust API for WebGPU implementations to use
|
||||
- `wgpu-types` - Rust types shared between `wgpu-core`, `wgpu-native`, and `wgpu-rs`
|
||||
- `player` - application for replaying the API traces, uses `winit`
|
||||
- [![Crates.io](https://img.shields.io/crates/v/wgpu-core.svg?label=wgpu-core)](https://crates.io/crates/wgpu-core) [![docs.rs](https://docs.rs/wgpu-core/badge.svg)](https://docs.rs/wgpu-core/) - internal Rust API for WebGPU implementations to use
|
||||
- [![Crates.io](https://img.shields.io/crates/v/wgpu-types.svg?label=wgpu-types)](https://crates.io/crates/wgpu-types) [![docs.rs](https://docs.rs/wgpu-types/badge.svg)](https://docs.rs/wgpu-types/) - Rust types shared between `wgpu-core`, `wgpu-native`, and `wgpu-rs`
|
||||
- `player` - standalone application for replaying the API traces, uses `winit`
|
||||
|
||||
This repository is not meant for direct use by applications.
|
||||
This repository contains the core of `wgpu`, and is not usable directly by applications.
|
||||
If you are looking for the user-facing Rust API, you need [wgpu-rs](https://github.com/gfx-rs/wgpu-rs).
|
||||
If you are looking for the native implementation or bindings to the API in other languages, you need [wgpu-native](https://github.com/gfx-rs/wgpu-native).
|
||||
|
||||
|
|
|
@ -33,3 +33,6 @@ path = "../wgpu-core"
|
|||
package = "wgpu-core"
|
||||
version = "0.5"
|
||||
features = ["replay", "raw-window-handle"]
|
||||
|
||||
[target.'cfg(all(unix, not(target_os = "ios"), not(target_os = "macos")))'.dependencies]
|
||||
gfx-backend-vulkan = { version = "0.5", features = ["x11"] }
|
||||
|
|
|
@ -131,13 +131,13 @@ impl GlobalExt for wgc::hub::Global<IdentityPassThroughFactory> {
|
|||
encoder, src, src_offset, dst, dst_offset, size,
|
||||
),
|
||||
trace::Command::CopyBufferToTexture { src, dst, size } => {
|
||||
self.command_encoder_copy_buffer_to_texture::<B>(encoder, &src, &dst, size)
|
||||
self.command_encoder_copy_buffer_to_texture::<B>(encoder, &src, &dst, &size)
|
||||
}
|
||||
trace::Command::CopyTextureToBuffer { src, dst, size } => {
|
||||
self.command_encoder_copy_texture_to_buffer::<B>(encoder, &src, &dst, size)
|
||||
self.command_encoder_copy_texture_to_buffer::<B>(encoder, &src, &dst, &size)
|
||||
}
|
||||
trace::Command::CopyTextureToTexture { src, dst, size } => {
|
||||
self.command_encoder_copy_texture_to_texture::<B>(encoder, &src, &dst, size)
|
||||
self.command_encoder_copy_texture_to_texture::<B>(encoder, &src, &dst, &size)
|
||||
}
|
||||
trace::Command::RunComputePass {
|
||||
commands,
|
||||
|
@ -247,8 +247,11 @@ impl GlobalExt for wgc::hub::Global<IdentityPassThroughFactory> {
|
|||
self.sampler_destroy::<B>(id);
|
||||
}
|
||||
A::GetSwapChainTexture { id, parent_id } => {
|
||||
self.swap_chain_get_next_texture::<B>(parent_id, id)
|
||||
.unwrap();
|
||||
if let Some(id) = id {
|
||||
self.swap_chain_get_next_texture::<B>(parent_id, id)
|
||||
.view_id
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
A::CreateBindGroupLayout { id, label, entries } => {
|
||||
let label = Label::new(&label);
|
||||
|
@ -402,11 +405,29 @@ impl GlobalExt for wgc::hub::Global<IdentityPassThroughFactory> {
|
|||
A::DestroyRenderPipeline(id) => {
|
||||
self.render_pipeline_destroy::<B>(id);
|
||||
}
|
||||
A::WriteBuffer { id, data, range } => {
|
||||
A::WriteBuffer {
|
||||
id,
|
||||
data,
|
||||
range,
|
||||
queued,
|
||||
} => {
|
||||
let bin = std::fs::read(dir.join(data)).unwrap();
|
||||
let size = (range.end - range.start) as usize;
|
||||
self.device_wait_for_buffer::<B>(device, id);
|
||||
self.device_set_buffer_sub_data::<B>(device, id, range.start, &bin[..size]);
|
||||
if queued {
|
||||
self.queue_write_buffer::<B>(device, id, range.start, &bin);
|
||||
} else {
|
||||
self.device_wait_for_buffer::<B>(device, id);
|
||||
self.device_set_buffer_sub_data::<B>(device, id, range.start, &bin[..size]);
|
||||
}
|
||||
}
|
||||
A::WriteTexture {
|
||||
to,
|
||||
data,
|
||||
layout,
|
||||
size,
|
||||
} => {
|
||||
let bin = std::fs::read(dir.join(data)).unwrap();
|
||||
self.queue_write_texture::<B>(device, &to, &bin, &layout, &size);
|
||||
}
|
||||
A::Submit(_index, commands) => {
|
||||
let encoder = self.device_create_command_encoder::<B>(
|
||||
|
@ -446,7 +467,7 @@ fn main() {
|
|||
log::info!("Found {} actions", actions.len());
|
||||
|
||||
#[cfg(feature = "winit")]
|
||||
let mut event_loop = {
|
||||
let event_loop = {
|
||||
log::info!("Creating a window");
|
||||
EventLoop::new()
|
||||
};
|
||||
|
@ -514,7 +535,6 @@ fn main() {
|
|||
use winit::{
|
||||
event::{ElementState, Event, KeyboardInput, VirtualKeyCode, WindowEvent},
|
||||
event_loop::ControlFlow,
|
||||
platform::desktop::EventLoopExtDesktop,
|
||||
};
|
||||
|
||||
let mut frame_count = 0;
|
||||
|
|
|
@ -18,7 +18,6 @@ license = "MPL-2.0"
|
|||
default = []
|
||||
trace = ["ron", "serde", "wgt/trace"]
|
||||
replay = ["serde", "wgt/replay"]
|
||||
metal-auto-capture = ["gfx-backend-metal/auto-capture"]
|
||||
#NOTE: glutin feature is not stable, use at your own risk
|
||||
#glutin = ["gfx-backend-gl/glutin"]
|
||||
|
||||
|
@ -56,7 +55,7 @@ gfx-backend-metal = { version = "0.5.6" }
|
|||
gfx-backend-vulkan = { version = "0.5.11", optional = true }
|
||||
|
||||
[target.'cfg(all(unix, not(target_os = "ios"), not(target_os = "macos")))'.dependencies]
|
||||
gfx-backend-vulkan = { version = "0.5.11", features = ["x11"] }
|
||||
gfx-backend-vulkan = { version = "0.5.11" }
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
gfx-backend-dx12 = { version = "0.5" }
|
||||
|
|
|
@ -5,12 +5,11 @@
|
|||
use crate::{
|
||||
id::{BindGroupLayoutId, BufferId, DeviceId, SamplerId, TextureViewId},
|
||||
track::{TrackerSet, DUMMY_SELECTOR},
|
||||
FastHashMap, LifeGuard, RefCount, Stored,
|
||||
FastHashMap, LifeGuard, RefCount, Stored, MAX_BIND_GROUPS,
|
||||
};
|
||||
|
||||
use arrayvec::ArrayVec;
|
||||
use gfx_descriptor::{DescriptorCounts, DescriptorSet};
|
||||
use wgt::{BufferAddress, TextureComponentType};
|
||||
|
||||
#[cfg(feature = "replay")]
|
||||
use serde::Deserialize;
|
||||
|
@ -44,7 +43,7 @@ pub struct BindGroupLayoutEntry {
|
|||
pub multisampled: bool,
|
||||
pub has_dynamic_offset: bool,
|
||||
pub view_dimension: wgt::TextureViewDimension,
|
||||
pub texture_component_type: TextureComponentType,
|
||||
pub texture_component_type: wgt::TextureComponentType,
|
||||
pub storage_texture_format: wgt::TextureFormat,
|
||||
}
|
||||
|
||||
|
@ -78,7 +77,7 @@ pub struct PipelineLayout<B: hal::Backend> {
|
|||
pub(crate) raw: B::PipelineLayout,
|
||||
pub(crate) device_id: Stored<DeviceId>,
|
||||
pub(crate) life_guard: LifeGuard,
|
||||
pub(crate) bind_group_layout_ids: ArrayVec<[Stored<BindGroupLayoutId>; wgt::MAX_BIND_GROUPS]>,
|
||||
pub(crate) bind_group_layout_ids: ArrayVec<[Stored<BindGroupLayoutId>; MAX_BIND_GROUPS]>,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
|
@ -87,8 +86,8 @@ pub struct PipelineLayout<B: hal::Backend> {
|
|||
#[cfg_attr(feature = "replay", derive(Deserialize))]
|
||||
pub struct BufferBinding {
|
||||
pub buffer: BufferId,
|
||||
pub offset: BufferAddress,
|
||||
pub size: BufferAddress,
|
||||
pub offset: wgt::BufferAddress,
|
||||
pub size: wgt::BufferSize,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
|
||||
use super::CommandBuffer;
|
||||
use crate::{
|
||||
hub::GfxBackend, id::DeviceId, track::TrackerSet, LifeGuard, PrivateFeatures, Stored,
|
||||
hub::GfxBackend, id::DeviceId, track::TrackerSet, FastHashMap, PrivateFeatures, Stored,
|
||||
SubmissionIndex,
|
||||
};
|
||||
|
||||
use hal::{command::CommandBuffer as _, device::Device as _, pool::CommandPool as _};
|
||||
use parking_lot::Mutex;
|
||||
|
||||
use std::{collections::HashMap, sync::atomic::Ordering, thread};
|
||||
use std::thread;
|
||||
|
||||
const GROW_AMOUNT: usize = 20;
|
||||
|
||||
|
@ -20,35 +20,29 @@ struct CommandPool<B: hal::Backend> {
|
|||
raw: B::CommandPool,
|
||||
total: usize,
|
||||
available: Vec<B::CommandBuffer>,
|
||||
pending: Vec<CommandBuffer<B>>,
|
||||
pending: Vec<(B::CommandBuffer, SubmissionIndex)>,
|
||||
}
|
||||
|
||||
impl<B: hal::Backend> CommandPool<B> {
|
||||
fn maintain(&mut self, lowest_active_index: SubmissionIndex) {
|
||||
fn maintain(&mut self, last_done_index: SubmissionIndex) {
|
||||
for i in (0..self.pending.len()).rev() {
|
||||
let index = self.pending[i]
|
||||
.life_guard
|
||||
.submission_index
|
||||
.load(Ordering::Acquire);
|
||||
if index < lowest_active_index {
|
||||
let cmd_buf = self.pending.swap_remove(i);
|
||||
if self.pending[i].1 <= last_done_index {
|
||||
let (cmd_buf, index) = self.pending.swap_remove(i);
|
||||
log::trace!(
|
||||
"recycling comb submitted in {} when {} is lowest active",
|
||||
"recycling comb submitted in {} when {} is last done",
|
||||
index,
|
||||
lowest_active_index,
|
||||
last_done_index,
|
||||
);
|
||||
self.recycle(cmd_buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn recycle(&mut self, cmd_buf: CommandBuffer<B>) {
|
||||
for mut raw in cmd_buf.raw {
|
||||
unsafe {
|
||||
raw.reset(false);
|
||||
}
|
||||
self.available.push(raw);
|
||||
fn recycle(&mut self, mut raw: B::CommandBuffer) {
|
||||
unsafe {
|
||||
raw.reset(false);
|
||||
}
|
||||
self.available.push(raw);
|
||||
}
|
||||
|
||||
fn allocate(&mut self) -> B::CommandBuffer {
|
||||
|
@ -68,12 +62,13 @@ impl<B: hal::Backend> CommandPool<B> {
|
|||
|
||||
#[derive(Debug)]
|
||||
struct Inner<B: hal::Backend> {
|
||||
pools: HashMap<thread::ThreadId, CommandPool<B>>,
|
||||
pools: FastHashMap<thread::ThreadId, CommandPool<B>>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct CommandAllocator<B: hal::Backend> {
|
||||
queue_family: hal::queue::QueueFamilyId,
|
||||
internal_thread_id: thread::ThreadId,
|
||||
inner: Mutex<Inner<B>>,
|
||||
}
|
||||
|
||||
|
@ -113,7 +108,6 @@ impl<B: GfxBackend> CommandAllocator<B> {
|
|||
is_recording: true,
|
||||
recorded_thread_id: thread_id,
|
||||
device_id,
|
||||
life_guard: LifeGuard::new(),
|
||||
trackers: TrackerSet::new(B::VARIANT),
|
||||
used_swap_chain: None,
|
||||
limits,
|
||||
|
@ -129,41 +123,75 @@ impl<B: GfxBackend> CommandAllocator<B> {
|
|||
}
|
||||
|
||||
impl<B: hal::Backend> CommandAllocator<B> {
|
||||
pub fn new(queue_family: hal::queue::QueueFamilyId) -> Self {
|
||||
pub fn new(queue_family: hal::queue::QueueFamilyId, device: &B::Device) -> Self {
|
||||
let internal_thread_id = thread::current().id();
|
||||
log::info!("Starting on (internal) thread {:?}", internal_thread_id);
|
||||
let mut pools = FastHashMap::default();
|
||||
pools.insert(
|
||||
internal_thread_id,
|
||||
CommandPool {
|
||||
raw: unsafe {
|
||||
device
|
||||
.create_command_pool(
|
||||
queue_family,
|
||||
hal::pool::CommandPoolCreateFlags::RESET_INDIVIDUAL,
|
||||
)
|
||||
.unwrap()
|
||||
},
|
||||
total: 0,
|
||||
available: Vec::new(),
|
||||
pending: Vec::new(),
|
||||
},
|
||||
);
|
||||
CommandAllocator {
|
||||
queue_family,
|
||||
inner: Mutex::new(Inner {
|
||||
pools: HashMap::new(),
|
||||
}),
|
||||
internal_thread_id,
|
||||
inner: Mutex::new(Inner { pools }),
|
||||
}
|
||||
}
|
||||
|
||||
fn allocate_for_thread_id(&self, thread_id: thread::ThreadId) -> B::CommandBuffer {
|
||||
let mut inner = self.inner.lock();
|
||||
inner.pools.get_mut(&thread_id).unwrap().allocate()
|
||||
}
|
||||
|
||||
pub fn allocate_internal(&self) -> B::CommandBuffer {
|
||||
self.allocate_for_thread_id(self.internal_thread_id)
|
||||
}
|
||||
|
||||
pub fn extend(&self, cmd_buf: &CommandBuffer<B>) -> B::CommandBuffer {
|
||||
self.allocate_for_thread_id(cmd_buf.recorded_thread_id)
|
||||
}
|
||||
|
||||
pub fn discard_internal(&self, raw: B::CommandBuffer) {
|
||||
let mut inner = self.inner.lock();
|
||||
inner
|
||||
.pools
|
||||
.get_mut(&cmd_buf.recorded_thread_id)
|
||||
.get_mut(&self.internal_thread_id)
|
||||
.unwrap()
|
||||
.allocate()
|
||||
.recycle(raw);
|
||||
}
|
||||
|
||||
pub fn discard(&self, mut cmd_buf: CommandBuffer<B>) {
|
||||
cmd_buf.trackers.clear();
|
||||
let mut inner = self.inner.lock();
|
||||
inner
|
||||
.pools
|
||||
.get_mut(&cmd_buf.recorded_thread_id)
|
||||
.unwrap()
|
||||
.recycle(cmd_buf);
|
||||
let pool = inner.pools.get_mut(&cmd_buf.recorded_thread_id).unwrap();
|
||||
for raw in cmd_buf.raw {
|
||||
pool.recycle(raw);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn after_submit(&self, mut cmd_buf: CommandBuffer<B>, submit_index: SubmissionIndex) {
|
||||
cmd_buf.trackers.clear();
|
||||
cmd_buf
|
||||
.life_guard
|
||||
.submission_index
|
||||
.store(submit_index, Ordering::Release);
|
||||
pub fn after_submit_internal(&self, raw: B::CommandBuffer, submit_index: SubmissionIndex) {
|
||||
let mut inner = self.inner.lock();
|
||||
inner
|
||||
.pools
|
||||
.get_mut(&self.internal_thread_id)
|
||||
.unwrap()
|
||||
.pending
|
||||
.push((raw, submit_index));
|
||||
}
|
||||
|
||||
pub fn after_submit(&self, cmd_buf: CommandBuffer<B>, submit_index: SubmissionIndex) {
|
||||
// Record this command buffer as pending
|
||||
let mut inner = self.inner.lock();
|
||||
inner
|
||||
|
@ -171,17 +199,17 @@ impl<B: hal::Backend> CommandAllocator<B> {
|
|||
.get_mut(&cmd_buf.recorded_thread_id)
|
||||
.unwrap()
|
||||
.pending
|
||||
.push(cmd_buf);
|
||||
.extend(cmd_buf.raw.into_iter().map(|raw| (raw, submit_index)));
|
||||
}
|
||||
|
||||
pub fn maintain(&self, device: &B::Device, lowest_active_index: SubmissionIndex) {
|
||||
pub fn maintain(&self, device: &B::Device, last_done_index: SubmissionIndex) {
|
||||
let mut inner = self.inner.lock();
|
||||
let mut remove_threads = Vec::new();
|
||||
for (thread_id, pool) in inner.pools.iter_mut() {
|
||||
pool.maintain(lowest_active_index);
|
||||
if pool.total == pool.available.len() {
|
||||
for (&thread_id, pool) in inner.pools.iter_mut() {
|
||||
pool.maintain(last_done_index);
|
||||
if pool.total == pool.available.len() && thread_id != self.internal_thread_id {
|
||||
assert!(pool.pending.is_empty());
|
||||
remove_threads.push(*thread_id);
|
||||
remove_threads.push(thread_id);
|
||||
}
|
||||
}
|
||||
for thread_id in remove_threads {
|
||||
|
@ -197,8 +225,8 @@ impl<B: hal::Backend> CommandAllocator<B> {
|
|||
pub fn destroy(self, device: &B::Device) {
|
||||
let mut inner = self.inner.lock();
|
||||
for (_, mut pool) in inner.pools.drain() {
|
||||
while let Some(cmd_buf) = pool.pending.pop() {
|
||||
pool.recycle(cmd_buf);
|
||||
while let Some((raw, _)) = pool.pending.pop() {
|
||||
pool.recycle(raw);
|
||||
}
|
||||
if pool.total != pool.available.len() {
|
||||
log::error!(
|
||||
|
|
|
@ -19,7 +19,7 @@ use crate::{
|
|||
id,
|
||||
resource::{Buffer, Texture},
|
||||
track::TrackerSet,
|
||||
LifeGuard, PrivateFeatures, Stored,
|
||||
PrivateFeatures, Stored,
|
||||
};
|
||||
|
||||
use peek_poke::PeekPoke;
|
||||
|
@ -157,7 +157,6 @@ pub struct CommandBuffer<B: hal::Backend> {
|
|||
is_recording: bool,
|
||||
recorded_thread_id: ThreadId,
|
||||
pub(crate) device_id: Stored<id::DeviceId>,
|
||||
pub(crate) life_guard: LifeGuard,
|
||||
pub(crate) trackers: TrackerSet,
|
||||
pub(crate) used_swap_chain: Option<(Stored<id::SwapChainId>, B::Framebuffer)>,
|
||||
limits: wgt::Limits,
|
||||
|
|
|
@ -25,9 +25,9 @@ use hal::command::CommandBuffer as _;
|
|||
use peek_poke::{Peek, PeekPoke, Poke};
|
||||
use smallvec::SmallVec;
|
||||
use wgt::{
|
||||
BufferAddress, BufferUsage, Color, DynamicOffset, IndexFormat, InputStepMode, LoadOp,
|
||||
RenderPassColorAttachmentDescriptorBase, RenderPassDepthStencilAttachmentDescriptorBase,
|
||||
TextureUsage, BIND_BUFFER_ALIGNMENT,
|
||||
BufferAddress, BufferSize, BufferUsage, Color, DynamicOffset, IndexFormat, InputStepMode,
|
||||
LoadOp, RenderPassColorAttachmentDescriptorBase,
|
||||
RenderPassDepthStencilAttachmentDescriptorBase, TextureUsage, BIND_BUFFER_ALIGNMENT,
|
||||
};
|
||||
|
||||
use std::{borrow::Borrow, collections::hash_map::Entry, fmt, iter, mem, ops::Range, slice};
|
||||
|
@ -70,13 +70,13 @@ pub enum RenderCommand {
|
|||
SetIndexBuffer {
|
||||
buffer_id: id::BufferId,
|
||||
offset: BufferAddress,
|
||||
size: BufferAddress,
|
||||
size: BufferSize,
|
||||
},
|
||||
SetVertexBuffer {
|
||||
slot: u32,
|
||||
buffer_id: id::BufferId,
|
||||
offset: BufferAddress,
|
||||
size: BufferAddress,
|
||||
size: BufferSize,
|
||||
},
|
||||
SetBlendColor(Color),
|
||||
SetStencilReference(u32),
|
||||
|
@ -307,7 +307,6 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
let hub = B::hub(self);
|
||||
let mut token = Token::root();
|
||||
|
||||
let (adapter_guard, mut token) = hub.adapters.read(&mut token);
|
||||
let (device_guard, mut token) = hub.devices.read(&mut token);
|
||||
let (mut cmb_guard, mut token) = hub.command_buffers.write(&mut token);
|
||||
|
||||
|
@ -371,13 +370,9 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
};
|
||||
|
||||
let (context, sample_count) = {
|
||||
use hal::{adapter::PhysicalDevice as _, device::Device as _};
|
||||
use hal::device::Device as _;
|
||||
|
||||
let limits = adapter_guard[device.adapter_id.value]
|
||||
.raw
|
||||
.physical_device
|
||||
.limits();
|
||||
let samples_count_limit = limits.framebuffer_color_sample_counts;
|
||||
let samples_count_limit = device.hal_limits.framebuffer_color_sample_counts;
|
||||
let base_trackers = &cmb.trackers;
|
||||
|
||||
let mut extent = None;
|
||||
|
@ -1028,8 +1023,8 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
.unwrap();
|
||||
assert!(buffer.usage.contains(BufferUsage::INDEX), "An invalid setIndexBuffer call has been made. The buffer usage is {:?} which does not contain required usage INDEX", buffer.usage);
|
||||
|
||||
let end = if size != 0 {
|
||||
offset + size
|
||||
let end = if size != BufferSize::WHOLE {
|
||||
offset + size.0
|
||||
} else {
|
||||
buffer.size
|
||||
};
|
||||
|
@ -1065,15 +1060,19 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
.vertex
|
||||
.inputs
|
||||
.extend(iter::repeat(VertexBufferState::EMPTY).take(empty_slots));
|
||||
state.vertex.inputs[slot as usize].total_size = if size != 0 {
|
||||
size
|
||||
state.vertex.inputs[slot as usize].total_size = if size != BufferSize::WHOLE {
|
||||
size.0
|
||||
} else {
|
||||
buffer.size - offset
|
||||
};
|
||||
|
||||
let range = hal::buffer::SubRange {
|
||||
offset,
|
||||
size: if size != 0 { Some(size) } else { None },
|
||||
size: if size != BufferSize::WHOLE {
|
||||
Some(size.0)
|
||||
} else {
|
||||
None
|
||||
},
|
||||
};
|
||||
unsafe {
|
||||
raw.bind_vertex_buffers(slot, iter::once((&buffer.raw, range)));
|
||||
|
@ -1278,7 +1277,7 @@ pub mod render_ffi {
|
|||
};
|
||||
use crate::{id, RawString};
|
||||
use std::{convert::TryInto, slice};
|
||||
use wgt::{BufferAddress, Color, DynamicOffset};
|
||||
use wgt::{BufferAddress, BufferSize, Color, DynamicOffset};
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
|
@ -1316,7 +1315,7 @@ pub mod render_ffi {
|
|||
pass: &mut RawPass,
|
||||
buffer_id: id::BufferId,
|
||||
offset: BufferAddress,
|
||||
size: BufferAddress,
|
||||
size: BufferSize,
|
||||
) {
|
||||
pass.encode(&RenderCommand::SetIndexBuffer {
|
||||
buffer_id,
|
||||
|
@ -1331,7 +1330,7 @@ pub mod render_ffi {
|
|||
slot: u32,
|
||||
buffer_id: id::BufferId,
|
||||
offset: BufferAddress,
|
||||
size: BufferAddress,
|
||||
size: BufferSize,
|
||||
) {
|
||||
pass.encode(&RenderCommand::SetVertexBuffer {
|
||||
slot,
|
||||
|
|
|
@ -7,17 +7,17 @@ use crate::device::trace::Command as TraceCommand;
|
|||
use crate::{
|
||||
conv,
|
||||
device::{all_buffer_stages, all_image_stages},
|
||||
hub::{GfxBackend, Global, GlobalIdentityHandlerFactory, Token},
|
||||
hub::{GfxBackend, Global, GlobalIdentityHandlerFactory, Storage, Token},
|
||||
id::{BufferId, CommandEncoderId, TextureId},
|
||||
resource::{BufferUse, TextureUse},
|
||||
resource::{BufferUse, Texture, TextureUse},
|
||||
};
|
||||
|
||||
use hal::command::CommandBuffer as _;
|
||||
use wgt::{BufferAddress, BufferUsage, Extent3d, Origin3d, TextureUsage};
|
||||
use wgt::{BufferAddress, BufferUsage, Extent3d, Origin3d, TextureDataLayout, TextureUsage};
|
||||
|
||||
use std::iter;
|
||||
|
||||
const BITS_PER_BYTE: u32 = 8;
|
||||
pub(crate) const BITS_PER_BYTE: u32 = 8;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Debug)]
|
||||
|
@ -25,9 +25,7 @@ const BITS_PER_BYTE: u32 = 8;
|
|||
#[cfg_attr(feature = "replay", derive(serde::Deserialize))]
|
||||
pub struct BufferCopyView {
|
||||
pub buffer: BufferId,
|
||||
pub offset: BufferAddress,
|
||||
pub bytes_per_row: u32,
|
||||
pub rows_per_image: u32,
|
||||
pub layout: TextureDataLayout,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
|
@ -37,42 +35,50 @@ pub struct BufferCopyView {
|
|||
pub struct TextureCopyView {
|
||||
pub texture: TextureId,
|
||||
pub mip_level: u32,
|
||||
pub array_layer: u32,
|
||||
pub origin: Origin3d,
|
||||
}
|
||||
|
||||
impl TextureCopyView {
|
||||
//TODO: we currently access each texture twice for a transfer,
|
||||
// once only to get the aspect flags, which is unfortunate.
|
||||
fn to_selector(&self, aspects: hal::format::Aspects) -> hal::image::SubresourceRange {
|
||||
pub(crate) fn to_hal<B: hal::Backend>(
|
||||
&self,
|
||||
texture_guard: &Storage<Texture<B>, TextureId>,
|
||||
) -> (
|
||||
hal::image::SubresourceLayers,
|
||||
hal::image::SubresourceRange,
|
||||
hal::image::Offset,
|
||||
) {
|
||||
let texture = &texture_guard[self.texture];
|
||||
let aspects = texture.full_range.aspects;
|
||||
let level = self.mip_level as hal::image::Level;
|
||||
let layer = self.array_layer as hal::image::Layer;
|
||||
let (layer, z) = match texture.dimension {
|
||||
wgt::TextureDimension::D1 | wgt::TextureDimension::D2 => {
|
||||
(self.origin.z as hal::image::Layer, 0)
|
||||
}
|
||||
wgt::TextureDimension::D3 => (0, self.origin.z as i32),
|
||||
};
|
||||
|
||||
// TODO: Can't satisfy clippy here unless we modify
|
||||
// `hal::image::SubresourceRange` in gfx to use `std::ops::RangeBounds`.
|
||||
#[allow(clippy::range_plus_one)]
|
||||
{
|
||||
hal::image::SubresourceRange {
|
||||
aspects,
|
||||
levels: level..level + 1,
|
||||
layers: layer..layer + 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn to_sub_layers(&self, aspects: hal::format::Aspects) -> hal::image::SubresourceLayers {
|
||||
let layer = self.array_layer as hal::image::Layer;
|
||||
// TODO: Can't satisfy clippy here unless we modify
|
||||
// `hal::image::SubresourceLayers` in gfx to use
|
||||
// `std::ops::RangeBounds`.
|
||||
#[allow(clippy::range_plus_one)]
|
||||
{
|
||||
(
|
||||
hal::image::SubresourceLayers {
|
||||
aspects,
|
||||
level: self.mip_level as hal::image::Level,
|
||||
layers: layer..layer + 1,
|
||||
}
|
||||
}
|
||||
},
|
||||
hal::image::SubresourceRange {
|
||||
aspects,
|
||||
levels: level..level + 1,
|
||||
layers: layer..layer + 1,
|
||||
},
|
||||
hal::image::Offset {
|
||||
x: self.origin.x as i32,
|
||||
y: self.origin.y as i32,
|
||||
z,
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,7 +144,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
let cmb_raw = cmb.raw.last_mut().unwrap();
|
||||
unsafe {
|
||||
cmb_raw.pipeline_barrier(
|
||||
all_buffer_stages()..all_buffer_stages(),
|
||||
all_buffer_stages()..hal::pso::PipelineStage::TRANSFER,
|
||||
hal::memory::Dependencies::empty(),
|
||||
barriers,
|
||||
);
|
||||
|
@ -151,7 +157,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
command_encoder_id: CommandEncoderId,
|
||||
source: &BufferCopyView,
|
||||
destination: &TextureCopyView,
|
||||
copy_size: Extent3d,
|
||||
copy_size: &Extent3d,
|
||||
) {
|
||||
let hub = B::hub(self);
|
||||
let mut token = Token::root();
|
||||
|
@ -159,14 +165,14 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
let cmb = &mut cmb_guard[command_encoder_id];
|
||||
let (buffer_guard, mut token) = hub.buffers.read(&mut token);
|
||||
let (texture_guard, _) = hub.textures.read(&mut token);
|
||||
let aspects = texture_guard[destination.texture].full_range.aspects;
|
||||
let (dst_layers, dst_range, dst_offset) = destination.to_hal(&*texture_guard);
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
match cmb.commands {
|
||||
Some(ref mut list) => list.push(TraceCommand::CopyBufferToTexture {
|
||||
src: source.clone(),
|
||||
dst: destination.clone(),
|
||||
size: copy_size,
|
||||
size: *copy_size,
|
||||
}),
|
||||
None => (),
|
||||
}
|
||||
|
@ -183,7 +189,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
let (dst_texture, dst_pending) = cmb.trackers.textures.use_replace(
|
||||
&*texture_guard,
|
||||
destination.texture,
|
||||
destination.to_selector(aspects),
|
||||
dst_range,
|
||||
TextureUse::COPY_DST,
|
||||
);
|
||||
assert!(dst_texture.usage.contains(TextureUsage::COPY_DST));
|
||||
|
@ -193,27 +199,27 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
.surface_desc()
|
||||
.bits as u32
|
||||
/ BITS_PER_BYTE;
|
||||
let buffer_width = source.bytes_per_row / bytes_per_texel;
|
||||
assert_eq!(wgt::COPY_BYTES_PER_ROW_ALIGNMENT % bytes_per_texel, 0);
|
||||
assert_eq!(
|
||||
source.bytes_per_row % bytes_per_texel,
|
||||
source.layout.bytes_per_row % wgt::COPY_BYTES_PER_ROW_ALIGNMENT,
|
||||
0,
|
||||
"Source bytes per row ({}) must be a multiple of bytes per texel ({})",
|
||||
source.bytes_per_row,
|
||||
bytes_per_texel
|
||||
"Source bytes per row ({}) must be a multiple of {}",
|
||||
source.layout.bytes_per_row,
|
||||
wgt::COPY_BYTES_PER_ROW_ALIGNMENT
|
||||
);
|
||||
let buffer_width = source.layout.bytes_per_row / bytes_per_texel;
|
||||
let region = hal::command::BufferImageCopy {
|
||||
buffer_offset: source.offset,
|
||||
buffer_offset: source.layout.offset,
|
||||
buffer_width,
|
||||
buffer_height: source.rows_per_image,
|
||||
image_layers: destination.to_sub_layers(aspects),
|
||||
image_offset: conv::map_origin(destination.origin),
|
||||
image_extent: conv::map_extent(copy_size),
|
||||
buffer_height: source.layout.rows_per_image,
|
||||
image_layers: dst_layers,
|
||||
image_offset: dst_offset,
|
||||
image_extent: conv::map_extent(copy_size, dst_texture.dimension),
|
||||
};
|
||||
let cmb_raw = cmb.raw.last_mut().unwrap();
|
||||
let stages = all_buffer_stages() | all_image_stages();
|
||||
unsafe {
|
||||
cmb_raw.pipeline_barrier(
|
||||
stages..stages,
|
||||
all_buffer_stages() | all_image_stages()..hal::pso::PipelineStage::TRANSFER,
|
||||
hal::memory::Dependencies::empty(),
|
||||
src_barriers.chain(dst_barriers),
|
||||
);
|
||||
|
@ -231,7 +237,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
command_encoder_id: CommandEncoderId,
|
||||
source: &TextureCopyView,
|
||||
destination: &BufferCopyView,
|
||||
copy_size: Extent3d,
|
||||
copy_size: &Extent3d,
|
||||
) {
|
||||
let hub = B::hub(self);
|
||||
let mut token = Token::root();
|
||||
|
@ -239,14 +245,14 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
let cmb = &mut cmb_guard[command_encoder_id];
|
||||
let (buffer_guard, mut token) = hub.buffers.read(&mut token);
|
||||
let (texture_guard, _) = hub.textures.read(&mut token);
|
||||
let aspects = texture_guard[source.texture].full_range.aspects;
|
||||
let (src_layers, src_range, src_offset) = source.to_hal(&*texture_guard);
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
match cmb.commands {
|
||||
Some(ref mut list) => list.push(TraceCommand::CopyTextureToBuffer {
|
||||
src: source.clone(),
|
||||
dst: destination.clone(),
|
||||
size: copy_size,
|
||||
size: *copy_size,
|
||||
}),
|
||||
None => (),
|
||||
}
|
||||
|
@ -254,7 +260,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
let (src_texture, src_pending) = cmb.trackers.textures.use_replace(
|
||||
&*texture_guard,
|
||||
source.texture,
|
||||
source.to_selector(aspects),
|
||||
src_range,
|
||||
TextureUse::COPY_SRC,
|
||||
);
|
||||
assert!(
|
||||
|
@ -281,27 +287,27 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
.surface_desc()
|
||||
.bits as u32
|
||||
/ BITS_PER_BYTE;
|
||||
let buffer_width = destination.bytes_per_row / bytes_per_texel;
|
||||
assert_eq!(wgt::COPY_BYTES_PER_ROW_ALIGNMENT % bytes_per_texel, 0);
|
||||
assert_eq!(
|
||||
destination.bytes_per_row % bytes_per_texel,
|
||||
destination.layout.bytes_per_row % wgt::COPY_BYTES_PER_ROW_ALIGNMENT,
|
||||
0,
|
||||
"Destination bytes per row ({}) must be a multiple of bytes per texel ({})",
|
||||
destination.bytes_per_row,
|
||||
bytes_per_texel
|
||||
"Destination bytes per row ({}) must be a multiple of {}",
|
||||
destination.layout.bytes_per_row,
|
||||
wgt::COPY_BYTES_PER_ROW_ALIGNMENT
|
||||
);
|
||||
let buffer_width = destination.layout.bytes_per_row / bytes_per_texel;
|
||||
let region = hal::command::BufferImageCopy {
|
||||
buffer_offset: destination.offset,
|
||||
buffer_offset: destination.layout.offset,
|
||||
buffer_width,
|
||||
buffer_height: destination.rows_per_image,
|
||||
image_layers: source.to_sub_layers(aspects),
|
||||
image_offset: conv::map_origin(source.origin),
|
||||
image_extent: conv::map_extent(copy_size),
|
||||
buffer_height: destination.layout.rows_per_image,
|
||||
image_layers: src_layers,
|
||||
image_offset: src_offset,
|
||||
image_extent: conv::map_extent(copy_size, src_texture.dimension),
|
||||
};
|
||||
let cmb_raw = cmb.raw.last_mut().unwrap();
|
||||
let stages = all_buffer_stages() | all_image_stages();
|
||||
unsafe {
|
||||
cmb_raw.pipeline_barrier(
|
||||
stages..stages,
|
||||
all_buffer_stages() | all_image_stages()..hal::pso::PipelineStage::TRANSFER,
|
||||
hal::memory::Dependencies::empty(),
|
||||
src_barriers.chain(dst_barrier),
|
||||
);
|
||||
|
@ -319,7 +325,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
command_encoder_id: CommandEncoderId,
|
||||
source: &TextureCopyView,
|
||||
destination: &TextureCopyView,
|
||||
copy_size: Extent3d,
|
||||
copy_size: &Extent3d,
|
||||
) {
|
||||
let hub = B::hub(self);
|
||||
let mut token = Token::root();
|
||||
|
@ -331,15 +337,16 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
// we can't hold both src_pending and dst_pending in scope because they
|
||||
// borrow the buffer tracker mutably...
|
||||
let mut barriers = Vec::new();
|
||||
let aspects = texture_guard[source.texture].full_range.aspects
|
||||
& texture_guard[destination.texture].full_range.aspects;
|
||||
let (src_layers, src_range, src_offset) = source.to_hal(&*texture_guard);
|
||||
let (dst_layers, dst_range, dst_offset) = destination.to_hal(&*texture_guard);
|
||||
assert_eq!(src_layers.aspects, dst_layers.aspects);
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
match cmb.commands {
|
||||
Some(ref mut list) => list.push(TraceCommand::CopyTextureToTexture {
|
||||
src: source.clone(),
|
||||
dst: destination.clone(),
|
||||
size: copy_size,
|
||||
size: *copy_size,
|
||||
}),
|
||||
None => (),
|
||||
}
|
||||
|
@ -347,7 +354,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
let (src_texture, src_pending) = cmb.trackers.textures.use_replace(
|
||||
&*texture_guard,
|
||||
source.texture,
|
||||
source.to_selector(aspects),
|
||||
src_range,
|
||||
TextureUse::COPY_SRC,
|
||||
);
|
||||
assert!(
|
||||
|
@ -360,7 +367,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
let (dst_texture, dst_pending) = cmb.trackers.textures.use_replace(
|
||||
&*texture_guard,
|
||||
destination.texture,
|
||||
destination.to_selector(aspects),
|
||||
dst_range,
|
||||
TextureUse::COPY_DST,
|
||||
);
|
||||
assert!(
|
||||
|
@ -370,17 +377,18 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
);
|
||||
barriers.extend(dst_pending.map(|pending| pending.into_hal(dst_texture)));
|
||||
|
||||
assert_eq!(src_texture.dimension, dst_texture.dimension);
|
||||
let region = hal::command::ImageCopy {
|
||||
src_subresource: source.to_sub_layers(aspects),
|
||||
src_offset: conv::map_origin(source.origin),
|
||||
dst_subresource: destination.to_sub_layers(aspects),
|
||||
dst_offset: conv::map_origin(destination.origin),
|
||||
extent: conv::map_extent(copy_size),
|
||||
src_subresource: src_layers,
|
||||
src_offset,
|
||||
dst_subresource: dst_layers,
|
||||
dst_offset,
|
||||
extent: conv::map_extent(copy_size, src_texture.dimension),
|
||||
};
|
||||
let cmb_raw = cmb.raw.last_mut().unwrap();
|
||||
unsafe {
|
||||
cmb_raw.pipeline_barrier(
|
||||
all_image_stages()..all_image_stages(),
|
||||
all_image_stages()..hal::pso::PipelineStage::TRANSFER,
|
||||
hal::memory::Dependencies::empty(),
|
||||
barriers,
|
||||
);
|
||||
|
|
|
@ -129,19 +129,14 @@ pub fn map_shader_stage_flags(shader_stage_flags: wgt::ShaderStage) -> hal::pso:
|
|||
value
|
||||
}
|
||||
|
||||
pub fn map_origin(origin: wgt::Origin3d) -> hal::image::Offset {
|
||||
hal::image::Offset {
|
||||
x: origin.x as i32,
|
||||
y: origin.y as i32,
|
||||
z: origin.z as i32,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn map_extent(extent: wgt::Extent3d) -> hal::image::Extent {
|
||||
pub fn map_extent(extent: &wgt::Extent3d, dim: wgt::TextureDimension) -> hal::image::Extent {
|
||||
hal::image::Extent {
|
||||
width: extent.width,
|
||||
height: extent.height,
|
||||
depth: extent.depth,
|
||||
depth: match dim {
|
||||
wgt::TextureDimension::D1 | wgt::TextureDimension::D2 => 1,
|
||||
wgt::TextureDimension::D3 => extent.depth,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -434,7 +429,7 @@ fn checked_u32_as_u16(value: u32) -> u16 {
|
|||
value as u16
|
||||
}
|
||||
|
||||
fn is_power_of_two(val: u32) -> bool {
|
||||
pub fn is_power_of_two(val: u32) -> bool {
|
||||
val != 0 && (val & (val - 1)) == 0
|
||||
}
|
||||
|
||||
|
@ -515,6 +510,9 @@ pub(crate) fn map_buffer_state(usage: resource::BufferUse) -> hal::buffer::State
|
|||
if usage.contains(W::STORAGE_STORE) {
|
||||
access |= A::SHADER_WRITE;
|
||||
}
|
||||
if usage.contains(W::INDIRECT) {
|
||||
access |= A::INDIRECT_COMMAND_READ;
|
||||
}
|
||||
|
||||
access
|
||||
}
|
||||
|
|
|
@ -212,12 +212,15 @@ impl<B: hal::Backend> LifetimeTracker<B> {
|
|||
index: SubmissionIndex,
|
||||
fence: B::Fence,
|
||||
new_suspects: &SuspectedResources,
|
||||
temp_buffers: impl Iterator<Item = (B::Buffer, MemoryBlock<B>)>,
|
||||
) {
|
||||
let mut last_resources = NonReferencedResources::new();
|
||||
last_resources.buffers.extend(temp_buffers);
|
||||
self.suspected_resources.extend(new_suspects);
|
||||
self.active.alloc().init(ActiveSubmission {
|
||||
index,
|
||||
fence,
|
||||
last_resources: NonReferencedResources::new(),
|
||||
last_resources,
|
||||
mapped: Vec::new(),
|
||||
});
|
||||
}
|
||||
|
@ -231,6 +234,7 @@ impl<B: hal::Backend> LifetimeTracker<B> {
|
|||
|
||||
/// Find the pending entry with the lowest active index. If none can be found that means
|
||||
/// everything in the allocator can be cleaned up, so std::usize::MAX is correct.
|
||||
#[cfg(feature = "replay")]
|
||||
pub fn lowest_active_submission(&self) -> SubmissionIndex {
|
||||
self.active
|
||||
.iter()
|
||||
|
|
|
@ -15,15 +15,15 @@ use copyless::VecHelper as _;
|
|||
use gfx_descriptor::DescriptorAllocator;
|
||||
use gfx_memory::{Block, Heaps};
|
||||
use hal::{
|
||||
self,
|
||||
command::CommandBuffer as _,
|
||||
device::Device as _,
|
||||
queue::CommandQueue as _,
|
||||
window::{PresentationSurface as _, Surface as _},
|
||||
};
|
||||
use parking_lot::{Mutex, MutexGuard};
|
||||
use smallvec::SmallVec;
|
||||
use wgt::{BufferAddress, InputStepMode, TextureDimension, TextureFormat, BIND_BUFFER_ALIGNMENT};
|
||||
use wgt::{
|
||||
BufferAddress, BufferSize, InputStepMode, TextureDimension, TextureFormat,
|
||||
BIND_BUFFER_ALIGNMENT,
|
||||
};
|
||||
|
||||
use std::{
|
||||
collections::hash_map::Entry, ffi, iter, marker::PhantomData, ptr, slice,
|
||||
|
@ -33,8 +33,10 @@ use std::{
|
|||
use spirv_headers::ExecutionModel;
|
||||
|
||||
mod life;
|
||||
mod queue;
|
||||
#[cfg(any(feature = "trace", feature = "replay"))]
|
||||
pub mod trace;
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
use trace::{Action, Trace};
|
||||
|
||||
|
@ -53,6 +55,7 @@ fn own_label(label: &Label) -> String {
|
|||
pub const MAX_COLOR_TARGETS: usize = 4;
|
||||
pub const MAX_MIP_LEVELS: usize = 16;
|
||||
pub const MAX_VERTEX_BUFFERS: usize = 16;
|
||||
pub const MAX_ANISOTROPY: u8 = 16;
|
||||
|
||||
pub fn all_buffer_stages() -> hal::pso::PipelineStage {
|
||||
use hal::pso::PipelineStage as Ps;
|
||||
|
@ -199,9 +202,11 @@ pub struct Device<B: hal::Backend> {
|
|||
// Life tracker should be locked right after the device and before anything else.
|
||||
life_tracker: Mutex<life::LifetimeTracker<B>>,
|
||||
temp_suspected: life::SuspectedResources,
|
||||
pub(crate) hal_limits: hal::Limits,
|
||||
pub(crate) private_features: PrivateFeatures,
|
||||
limits: wgt::Limits,
|
||||
extensions: wgt::Extensions,
|
||||
pending_writes: queue::PendingWrites<B>,
|
||||
#[cfg(feature = "trace")]
|
||||
pub(crate) trace: Option<Mutex<Trace>>,
|
||||
}
|
||||
|
@ -212,7 +217,7 @@ impl<B: GfxBackend> Device<B> {
|
|||
adapter_id: Stored<id::AdapterId>,
|
||||
queue_group: hal::queue::QueueGroup<B>,
|
||||
mem_props: hal::adapter::MemoryProperties,
|
||||
non_coherent_atom_size: u64,
|
||||
hal_limits: hal::Limits,
|
||||
supports_texture_d24_s8: bool,
|
||||
desc: &wgt::DeviceDescriptor,
|
||||
trace_path: Option<&std::path::Path>,
|
||||
|
@ -221,6 +226,7 @@ impl<B: GfxBackend> Device<B> {
|
|||
let life_guard = LifeGuard::new();
|
||||
life_guard.submission_index.fetch_add(1, Ordering::Relaxed);
|
||||
|
||||
let com_allocator = command::CommandAllocator::new(queue_group.family, &raw);
|
||||
let heaps = unsafe {
|
||||
Heaps::new(
|
||||
&mem_props,
|
||||
|
@ -230,21 +236,21 @@ impl<B: GfxBackend> Device<B> {
|
|||
min_device_allocation: 0x1_0000,
|
||||
},
|
||||
gfx_memory::LinearConfig {
|
||||
linear_size: 0x10_0000,
|
||||
linear_size: 0x100_0000,
|
||||
},
|
||||
non_coherent_atom_size,
|
||||
hal_limits.non_coherent_atom_size as u64,
|
||||
)
|
||||
};
|
||||
#[cfg(not(feature = "trace"))]
|
||||
match trace_path {
|
||||
Some(_) => log::warn!("Tracing feature is not enabled"),
|
||||
Some(_) => log::error!("Feature 'trace' is not enabled"),
|
||||
None => (),
|
||||
}
|
||||
|
||||
Device {
|
||||
raw,
|
||||
adapter_id,
|
||||
com_allocator: command::CommandAllocator::new(queue_group.family),
|
||||
com_allocator,
|
||||
mem_allocator: Mutex::new(heaps),
|
||||
desc_allocator: Mutex::new(DescriptorAllocator::new()),
|
||||
queue_group,
|
||||
|
@ -264,23 +270,32 @@ impl<B: GfxBackend> Device<B> {
|
|||
Some(Mutex::new(trace))
|
||||
}
|
||||
Err(e) => {
|
||||
log::warn!("Unable to start a trace in '{:?}': {:?}", path, e);
|
||||
log::error!("Unable to start a trace in '{:?}': {:?}", path, e);
|
||||
None
|
||||
}
|
||||
}),
|
||||
hal_limits,
|
||||
private_features: PrivateFeatures {
|
||||
supports_texture_d24_s8,
|
||||
},
|
||||
limits: desc.limits.clone(),
|
||||
extensions: desc.extensions.clone(),
|
||||
pending_writes: queue::PendingWrites::new(),
|
||||
}
|
||||
}
|
||||
|
||||
fn lock_life_internal<'this, 'token: 'this>(
|
||||
tracker: &'this Mutex<life::LifetimeTracker<B>>,
|
||||
_token: &mut Token<'token, Self>,
|
||||
) -> MutexGuard<'this, life::LifetimeTracker<B>> {
|
||||
tracker.lock()
|
||||
}
|
||||
|
||||
fn lock_life<'this, 'token: 'this>(
|
||||
&'this self,
|
||||
_token: &mut Token<'token, Self>,
|
||||
token: &mut Token<'token, Self>,
|
||||
) -> MutexGuard<'this, life::LifetimeTracker<B>> {
|
||||
self.life_tracker.lock()
|
||||
Self::lock_life_internal(&self.life_tracker, token)
|
||||
}
|
||||
|
||||
fn maintain<'this, 'token: 'this, G: GlobalIdentityHandlerFactory>(
|
||||
|
@ -300,12 +315,11 @@ impl<B: GfxBackend> Device<B> {
|
|||
);
|
||||
life_tracker.triage_mapped(global, token);
|
||||
life_tracker.triage_framebuffers(global, &mut *self.framebuffers.lock(), token);
|
||||
let _last_done = life_tracker.triage_submissions(&self.raw, force_wait);
|
||||
let last_done = life_tracker.triage_submissions(&self.raw, force_wait);
|
||||
let callbacks = life_tracker.handle_mapping(global, &self.raw, &self.trackers, token);
|
||||
life_tracker.cleanup(&self.raw, &self.mem_allocator, &self.desc_allocator);
|
||||
|
||||
self.com_allocator
|
||||
.maintain(&self.raw, life_tracker.lowest_active_submission());
|
||||
self.com_allocator.maintain(&self.raw, last_done);
|
||||
callbacks
|
||||
}
|
||||
|
||||
|
@ -468,6 +482,7 @@ impl<B: GfxBackend> Device<B> {
|
|||
ref_count: self.life_guard.add_ref(),
|
||||
},
|
||||
usage: desc.usage,
|
||||
dimension: desc.dimension,
|
||||
kind,
|
||||
format: desc.format,
|
||||
full_range: hal::image::SubresourceRange {
|
||||
|
@ -510,9 +525,11 @@ impl<B: hal::Backend> Device<B> {
|
|||
}
|
||||
|
||||
pub(crate) fn dispose(self) {
|
||||
self.com_allocator.destroy(&self.raw);
|
||||
let mut desc_alloc = self.desc_allocator.into_inner();
|
||||
let mut mem_alloc = self.mem_allocator.into_inner();
|
||||
self.pending_writes
|
||||
.dispose(&self.raw, &self.com_allocator, &mut mem_alloc);
|
||||
self.com_allocator.destroy(&self.raw);
|
||||
unsafe {
|
||||
desc_alloc.clear(&self.raw);
|
||||
mem_alloc.clear(&self.raw);
|
||||
|
@ -527,6 +544,24 @@ impl<B: hal::Backend> Device<B> {
|
|||
}
|
||||
|
||||
impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
pub fn device_extensions<B: GfxBackend>(&self, device_id: id::DeviceId) -> wgt::Extensions {
|
||||
let hub = B::hub(self);
|
||||
let mut token = Token::root();
|
||||
let (device_guard, _) = hub.devices.read(&mut token);
|
||||
let device = &device_guard[device_id];
|
||||
|
||||
device.extensions.clone()
|
||||
}
|
||||
|
||||
pub fn device_limits<B: GfxBackend>(&self, device_id: id::DeviceId) -> wgt::Limits {
|
||||
let hub = B::hub(self);
|
||||
let mut token = Token::root();
|
||||
let (device_guard, _) = hub.devices.read(&mut token);
|
||||
let device = &device_guard[device_id];
|
||||
|
||||
device.limits.clone()
|
||||
}
|
||||
|
||||
pub fn device_create_buffer<B: GfxBackend>(
|
||||
&self,
|
||||
device_id: id::DeviceId,
|
||||
|
@ -687,6 +722,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
id: buffer_id,
|
||||
data: data_path,
|
||||
range: offset..offset + data.len() as BufferAddress,
|
||||
queued: false,
|
||||
});
|
||||
}
|
||||
None => (),
|
||||
|
@ -962,6 +998,19 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
let (device_guard, mut token) = hub.devices.read(&mut token);
|
||||
let device = &device_guard[device_id];
|
||||
|
||||
if desc.anisotropy_clamp > 1 {
|
||||
assert!(
|
||||
device.extensions.anisotropic_filtering,
|
||||
"Anisotropic clamp may only be used when the anisotropic filtering extension is enabled"
|
||||
);
|
||||
let valid_clamp = desc.anisotropy_clamp <= MAX_ANISOTROPY
|
||||
&& conv::is_power_of_two(desc.anisotropy_clamp as u32);
|
||||
assert!(
|
||||
valid_clamp,
|
||||
"Anisotropic clamp must be one of the values: 0, 1, 2, 4, 8, or 16"
|
||||
);
|
||||
}
|
||||
|
||||
let info = hal::image::SamplerDesc {
|
||||
min_filter: conv::map_filter(desc.min_filter),
|
||||
mag_filter: conv::map_filter(desc.mag_filter),
|
||||
|
@ -976,7 +1025,11 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
comparison: conv::map_compare_function(desc.compare),
|
||||
border: hal::image::PackedColor(0),
|
||||
normalized: true,
|
||||
anisotropy_clamp: None, //TODO
|
||||
anisotropy_clamp: if desc.anisotropy_clamp > 1 {
|
||||
Some(desc.anisotropy_clamp)
|
||||
} else {
|
||||
None
|
||||
},
|
||||
};
|
||||
|
||||
let sampler = resource::Sampler {
|
||||
|
@ -1306,6 +1359,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
panic!("Mismatched buffer binding type for {:?}. Expected a type of UniformBuffer, StorageBuffer or ReadonlyStorageBuffer", decl)
|
||||
}
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
bb.offset % alignment,
|
||||
0,
|
||||
|
@ -1313,6 +1367,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
bb.offset,
|
||||
alignment
|
||||
);
|
||||
|
||||
let buffer = used
|
||||
.buffers
|
||||
.use_extend(&*buffer_guard, bb.buffer, (), internal_use)
|
||||
|
@ -1326,17 +1381,17 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
|
||||
let sub_range = hal::buffer::SubRange {
|
||||
offset: bb.offset,
|
||||
size: if bb.size == 0 {
|
||||
size: if bb.size == BufferSize::WHOLE {
|
||||
None
|
||||
} else {
|
||||
let end = bb.offset + bb.size;
|
||||
let end = bb.offset + bb.size.0;
|
||||
assert!(
|
||||
end <= buffer.size,
|
||||
"Bound buffer range {:?} does not fit in buffer size {}",
|
||||
bb.offset..end,
|
||||
buffer.size
|
||||
);
|
||||
Some(bb.size)
|
||||
Some(bb.size.0)
|
||||
},
|
||||
};
|
||||
hal::pso::Descriptor::Buffer(&buffer.raw, sub_range)
|
||||
|
@ -1347,6 +1402,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
| binding_model::BindingType::ComparisonSampler => {}
|
||||
_ => panic!("Mismatched sampler binding type in {:?}. Expected a type of Sampler or ComparisonSampler", decl.ty),
|
||||
}
|
||||
|
||||
let sampler = used
|
||||
.samplers
|
||||
.use_extend(&*sampler_guard, id, (), ())
|
||||
|
@ -1683,179 +1739,6 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
self.command_encoder_destroy::<B>(command_buffer_id)
|
||||
}
|
||||
|
||||
pub fn queue_submit<B: GfxBackend>(
|
||||
&self,
|
||||
queue_id: id::QueueId,
|
||||
command_buffer_ids: &[id::CommandBufferId],
|
||||
) {
|
||||
let hub = B::hub(self);
|
||||
|
||||
let (submit_index, fence) = {
|
||||
let mut token = Token::root();
|
||||
let (mut device_guard, mut token) = hub.devices.write(&mut token);
|
||||
let device = &mut device_guard[queue_id];
|
||||
device.temp_suspected.clear();
|
||||
|
||||
let submit_index = 1 + device
|
||||
.life_guard
|
||||
.submission_index
|
||||
.fetch_add(1, Ordering::Relaxed);
|
||||
|
||||
let (mut swap_chain_guard, mut token) = hub.swap_chains.write(&mut token);
|
||||
let (mut command_buffer_guard, mut token) = hub.command_buffers.write(&mut token);
|
||||
let (bind_group_guard, mut token) = hub.bind_groups.read(&mut token);
|
||||
let (compute_pipe_guard, mut token) = hub.compute_pipelines.read(&mut token);
|
||||
let (render_pipe_guard, mut token) = hub.render_pipelines.read(&mut token);
|
||||
let (mut buffer_guard, mut token) = hub.buffers.write(&mut token);
|
||||
let (texture_guard, mut token) = hub.textures.read(&mut token);
|
||||
let (texture_view_guard, mut token) = hub.texture_views.read(&mut token);
|
||||
let (sampler_guard, _) = hub.samplers.read(&mut token);
|
||||
|
||||
//Note: locking the trackers has to be done after the storages
|
||||
let mut signal_swapchain_semaphores = SmallVec::<[_; 1]>::new();
|
||||
let mut trackers = device.trackers.lock();
|
||||
|
||||
//TODO: if multiple command buffers are submitted, we can re-use the last
|
||||
// native command buffer of the previous chain instead of always creating
|
||||
// a temporary one, since the chains are not finished.
|
||||
|
||||
// finish all the command buffers first
|
||||
for &cmb_id in command_buffer_ids {
|
||||
let comb = &mut command_buffer_guard[cmb_id];
|
||||
#[cfg(feature = "trace")]
|
||||
match device.trace {
|
||||
Some(ref trace) => trace
|
||||
.lock()
|
||||
.add(Action::Submit(submit_index, comb.commands.take().unwrap())),
|
||||
None => (),
|
||||
};
|
||||
|
||||
if let Some((sc_id, fbo)) = comb.used_swap_chain.take() {
|
||||
let sc = &mut swap_chain_guard[sc_id.value];
|
||||
assert!(sc.acquired_view_id.is_some(),
|
||||
"SwapChainOutput for {:?} was dropped before the respective command buffer {:?} got submitted!",
|
||||
sc_id.value, cmb_id);
|
||||
if sc.acquired_framebuffers.is_empty() {
|
||||
signal_swapchain_semaphores.push(sc_id.value);
|
||||
}
|
||||
sc.acquired_framebuffers.push(fbo);
|
||||
}
|
||||
|
||||
// optimize the tracked states
|
||||
comb.trackers.optimize();
|
||||
|
||||
// update submission IDs
|
||||
for id in comb.trackers.buffers.used() {
|
||||
if let resource::BufferMapState::Waiting(_) = buffer_guard[id].map_state {
|
||||
panic!("Buffer has a pending mapping.");
|
||||
}
|
||||
if !buffer_guard[id].life_guard.use_at(submit_index) {
|
||||
if let resource::BufferMapState::Active { .. } = buffer_guard[id].map_state
|
||||
{
|
||||
log::warn!("Dropped buffer has a pending mapping.");
|
||||
unmap_buffer(&device.raw, &mut buffer_guard[id]);
|
||||
}
|
||||
device.temp_suspected.buffers.push(id);
|
||||
}
|
||||
}
|
||||
for id in comb.trackers.textures.used() {
|
||||
if !texture_guard[id].life_guard.use_at(submit_index) {
|
||||
device.temp_suspected.textures.push(id);
|
||||
}
|
||||
}
|
||||
for id in comb.trackers.views.used() {
|
||||
if !texture_view_guard[id].life_guard.use_at(submit_index) {
|
||||
device.temp_suspected.texture_views.push(id);
|
||||
}
|
||||
}
|
||||
for id in comb.trackers.bind_groups.used() {
|
||||
if !bind_group_guard[id].life_guard.use_at(submit_index) {
|
||||
device.temp_suspected.bind_groups.push(id);
|
||||
}
|
||||
}
|
||||
for id in comb.trackers.samplers.used() {
|
||||
if !sampler_guard[id].life_guard.use_at(submit_index) {
|
||||
device.temp_suspected.samplers.push(id);
|
||||
}
|
||||
}
|
||||
for id in comb.trackers.compute_pipes.used() {
|
||||
if !compute_pipe_guard[id].life_guard.use_at(submit_index) {
|
||||
device.temp_suspected.compute_pipelines.push(id);
|
||||
}
|
||||
}
|
||||
for id in comb.trackers.render_pipes.used() {
|
||||
if !render_pipe_guard[id].life_guard.use_at(submit_index) {
|
||||
device.temp_suspected.render_pipelines.push(id);
|
||||
}
|
||||
}
|
||||
|
||||
// execute resource transitions
|
||||
let mut transit = device.com_allocator.extend(comb);
|
||||
unsafe {
|
||||
// the last buffer was open, closing now
|
||||
comb.raw.last_mut().unwrap().finish();
|
||||
transit.begin_primary(hal::command::CommandBufferFlags::ONE_TIME_SUBMIT);
|
||||
}
|
||||
log::trace!("Stitching command buffer {:?} before submission", cmb_id);
|
||||
command::CommandBuffer::insert_barriers(
|
||||
&mut transit,
|
||||
&mut *trackers,
|
||||
&comb.trackers,
|
||||
&*buffer_guard,
|
||||
&*texture_guard,
|
||||
);
|
||||
unsafe {
|
||||
transit.finish();
|
||||
}
|
||||
comb.raw.insert(0, transit);
|
||||
}
|
||||
|
||||
log::debug!("Device after submission {}: {:#?}", submit_index, trackers);
|
||||
|
||||
// now prepare the GPU submission
|
||||
let fence = device.raw.create_fence(false).unwrap();
|
||||
let submission = hal::queue::Submission {
|
||||
command_buffers: command_buffer_ids
|
||||
.iter()
|
||||
.flat_map(|&cmb_id| &command_buffer_guard[cmb_id].raw),
|
||||
wait_semaphores: Vec::new(),
|
||||
signal_semaphores: signal_swapchain_semaphores
|
||||
.into_iter()
|
||||
.map(|sc_id| &swap_chain_guard[sc_id].semaphore),
|
||||
};
|
||||
|
||||
unsafe {
|
||||
device.queue_group.queues[0].submit(submission, Some(&fence));
|
||||
}
|
||||
|
||||
(submit_index, fence)
|
||||
};
|
||||
|
||||
// No need for write access to the device from here on out
|
||||
let callbacks = {
|
||||
let mut token = Token::root();
|
||||
let (device_guard, mut token) = hub.devices.read(&mut token);
|
||||
let device = &device_guard[queue_id];
|
||||
|
||||
let callbacks = device.maintain(self, false, &mut token);
|
||||
device.lock_life(&mut token).track_submission(
|
||||
submit_index,
|
||||
fence,
|
||||
&device.temp_suspected,
|
||||
);
|
||||
|
||||
// finally, return the command buffers to the allocator
|
||||
for &cmb_id in command_buffer_ids {
|
||||
let (cmd_buf, _) = hub.command_buffers.unregister(cmb_id, &mut token);
|
||||
device.com_allocator.after_submit(cmd_buf, submit_index);
|
||||
}
|
||||
|
||||
callbacks
|
||||
};
|
||||
|
||||
fire_map_callbacks(callbacks);
|
||||
}
|
||||
|
||||
pub fn device_create_render_pipeline<B: GfxBackend>(
|
||||
&self,
|
||||
device_id: id::DeviceId,
|
||||
|
@ -2622,6 +2505,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
id: buffer_id,
|
||||
data,
|
||||
range: sub_range.offset..sub_range.offset + size,
|
||||
queued: false,
|
||||
});
|
||||
}
|
||||
None => (),
|
||||
|
|
|
@ -0,0 +1,541 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
use crate::device::trace::Action;
|
||||
use crate::{
|
||||
command::{CommandAllocator, CommandBuffer, TextureCopyView, BITS_PER_BYTE},
|
||||
conv,
|
||||
hub::{GfxBackend, Global, GlobalIdentityHandlerFactory, Token},
|
||||
id,
|
||||
resource::{BufferMapState, BufferUse, TextureUse},
|
||||
};
|
||||
|
||||
use gfx_memory::{Block, Heaps, MemoryBlock};
|
||||
use hal::{command::CommandBuffer as _, device::Device as _, queue::CommandQueue as _};
|
||||
use smallvec::SmallVec;
|
||||
use std::{iter, sync::atomic::Ordering};
|
||||
|
||||
struct StagingData<B: hal::Backend> {
|
||||
buffer: B::Buffer,
|
||||
memory: MemoryBlock<B>,
|
||||
comb: B::CommandBuffer,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub(crate) struct PendingWrites<B: hal::Backend> {
|
||||
pub command_buffer: Option<B::CommandBuffer>,
|
||||
pub temp_buffers: Vec<(B::Buffer, MemoryBlock<B>)>,
|
||||
}
|
||||
|
||||
impl<B: hal::Backend> PendingWrites<B> {
|
||||
pub fn new() -> Self {
|
||||
PendingWrites {
|
||||
command_buffer: None,
|
||||
temp_buffers: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn dispose(
|
||||
self,
|
||||
device: &B::Device,
|
||||
com_allocator: &CommandAllocator<B>,
|
||||
mem_allocator: &mut Heaps<B>,
|
||||
) {
|
||||
if let Some(raw) = self.command_buffer {
|
||||
com_allocator.discard_internal(raw);
|
||||
}
|
||||
for (buffer, memory) in self.temp_buffers {
|
||||
mem_allocator.free(device, memory);
|
||||
unsafe {
|
||||
device.destroy_buffer(buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn consume(&mut self, stage: StagingData<B>) {
|
||||
self.temp_buffers.push((stage.buffer, stage.memory));
|
||||
self.command_buffer = Some(stage.comb);
|
||||
}
|
||||
}
|
||||
|
||||
impl<B: hal::Backend> super::Device<B> {
|
||||
fn prepare_stage(&mut self, size: wgt::BufferAddress) -> StagingData<B> {
|
||||
let mut buffer = unsafe {
|
||||
self.raw
|
||||
.create_buffer(size, hal::buffer::Usage::TRANSFER_SRC)
|
||||
.unwrap()
|
||||
};
|
||||
//TODO: do we need to transition into HOST_WRITE access first?
|
||||
let requirements = unsafe { self.raw.get_buffer_requirements(&buffer) };
|
||||
|
||||
let memory = self
|
||||
.mem_allocator
|
||||
.lock()
|
||||
.allocate(
|
||||
&self.raw,
|
||||
requirements.type_mask as u32,
|
||||
gfx_memory::MemoryUsage::Staging { read_back: false },
|
||||
gfx_memory::Kind::Linear,
|
||||
requirements.size,
|
||||
requirements.alignment,
|
||||
)
|
||||
.unwrap();
|
||||
unsafe {
|
||||
self.raw.set_buffer_name(&mut buffer, "<write_buffer_temp>");
|
||||
self.raw
|
||||
.bind_buffer_memory(memory.memory(), memory.segment().offset, &mut buffer)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
let comb = match self.pending_writes.command_buffer.take() {
|
||||
Some(comb) => comb,
|
||||
None => {
|
||||
let mut comb = self.com_allocator.allocate_internal();
|
||||
unsafe {
|
||||
comb.begin_primary(hal::command::CommandBufferFlags::ONE_TIME_SUBMIT);
|
||||
}
|
||||
comb
|
||||
}
|
||||
};
|
||||
StagingData {
|
||||
buffer,
|
||||
memory,
|
||||
comb,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: move out common parts of write_xxx.
|
||||
|
||||
impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
pub fn queue_write_buffer<B: GfxBackend>(
|
||||
&self,
|
||||
queue_id: id::QueueId,
|
||||
buffer_id: id::BufferId,
|
||||
buffer_offset: wgt::BufferAddress,
|
||||
data: &[u8],
|
||||
) {
|
||||
let hub = B::hub(self);
|
||||
let mut token = Token::root();
|
||||
let (mut device_guard, mut token) = hub.devices.write(&mut token);
|
||||
let device = &mut device_guard[queue_id];
|
||||
let (buffer_guard, _) = hub.buffers.read(&mut token);
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
match device.trace {
|
||||
Some(ref trace) => {
|
||||
let mut trace = trace.lock();
|
||||
let data_path = trace.make_binary("bin", data);
|
||||
trace.add(Action::WriteBuffer {
|
||||
id: buffer_id,
|
||||
data: data_path,
|
||||
range: buffer_offset..buffer_offset + data.len() as wgt::BufferAddress,
|
||||
queued: true,
|
||||
});
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
|
||||
let mut stage = device.prepare_stage(data.len() as wgt::BufferAddress);
|
||||
{
|
||||
let mut mapped = stage
|
||||
.memory
|
||||
.map(&device.raw, hal::memory::Segment::ALL)
|
||||
.unwrap();
|
||||
unsafe { mapped.write(&device.raw, hal::memory::Segment::ALL) }
|
||||
.unwrap()
|
||||
.slice[..data.len()]
|
||||
.copy_from_slice(data);
|
||||
}
|
||||
|
||||
let mut trackers = device.trackers.lock();
|
||||
let (dst, transition) =
|
||||
trackers
|
||||
.buffers
|
||||
.use_replace(&*buffer_guard, buffer_id, (), BufferUse::COPY_DST);
|
||||
assert!(
|
||||
dst.usage.contains(wgt::BufferUsage::COPY_DST),
|
||||
"Write buffer usage {:?} must contain flag COPY_DST",
|
||||
dst.usage
|
||||
);
|
||||
let last_submit_index = device.life_guard.submission_index.load(Ordering::Relaxed);
|
||||
dst.life_guard.use_at(last_submit_index + 1);
|
||||
|
||||
let region = hal::command::BufferCopy {
|
||||
src: 0,
|
||||
dst: buffer_offset,
|
||||
size: data.len() as _,
|
||||
};
|
||||
unsafe {
|
||||
stage.comb.pipeline_barrier(
|
||||
super::all_buffer_stages()..hal::pso::PipelineStage::TRANSFER,
|
||||
hal::memory::Dependencies::empty(),
|
||||
iter::once(hal::memory::Barrier::Buffer {
|
||||
states: hal::buffer::Access::HOST_WRITE..hal::buffer::Access::TRANSFER_READ,
|
||||
target: &stage.buffer,
|
||||
range: hal::buffer::SubRange::WHOLE,
|
||||
families: None,
|
||||
})
|
||||
.chain(transition.map(|pending| pending.into_hal(dst))),
|
||||
);
|
||||
stage
|
||||
.comb
|
||||
.copy_buffer(&stage.buffer, &dst.raw, iter::once(region));
|
||||
}
|
||||
|
||||
device.pending_writes.consume(stage);
|
||||
}
|
||||
|
||||
pub fn queue_write_texture<B: GfxBackend>(
|
||||
&self,
|
||||
queue_id: id::QueueId,
|
||||
destination: &TextureCopyView,
|
||||
data: &[u8],
|
||||
data_layout: &wgt::TextureDataLayout,
|
||||
size: &wgt::Extent3d,
|
||||
) {
|
||||
let hub = B::hub(self);
|
||||
let mut token = Token::root();
|
||||
let (mut device_guard, mut token) = hub.devices.write(&mut token);
|
||||
let device = &mut device_guard[queue_id];
|
||||
let (texture_guard, _) = hub.textures.read(&mut token);
|
||||
let (image_layers, image_range, image_offset) = destination.to_hal(&*texture_guard);
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
match device.trace {
|
||||
Some(ref trace) => {
|
||||
let mut trace = trace.lock();
|
||||
let data_path = trace.make_binary("bin", data);
|
||||
trace.add(Action::WriteTexture {
|
||||
to: destination.clone(),
|
||||
data: data_path,
|
||||
layout: data_layout.clone(),
|
||||
size: *size,
|
||||
});
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
|
||||
let texture_format = texture_guard[destination.texture].format;
|
||||
let bytes_per_texel = conv::map_texture_format(texture_format, device.private_features)
|
||||
.surface_desc()
|
||||
.bits as u32
|
||||
/ BITS_PER_BYTE;
|
||||
|
||||
let bytes_per_row_alignment = get_lowest_common_denom(
|
||||
device.hal_limits.optimal_buffer_copy_pitch_alignment as u32,
|
||||
bytes_per_texel,
|
||||
);
|
||||
let stage_bytes_per_row = align_to(bytes_per_texel * size.width, bytes_per_row_alignment);
|
||||
let stage_size = stage_bytes_per_row as u64
|
||||
* ((size.depth - 1) * data_layout.rows_per_image + size.height) as u64;
|
||||
let mut stage = device.prepare_stage(stage_size);
|
||||
{
|
||||
let mut mapped = stage
|
||||
.memory
|
||||
.map(&device.raw, hal::memory::Segment::ALL)
|
||||
.unwrap();
|
||||
let mapping = unsafe { mapped.write(&device.raw, hal::memory::Segment::ALL) }.unwrap();
|
||||
if stage_bytes_per_row == data_layout.bytes_per_row {
|
||||
// Unlikely case of the data already being aligned optimally.
|
||||
mapping.slice[..stage_size as usize].copy_from_slice(data);
|
||||
} else {
|
||||
// Copy row by row into the optimal alignment.
|
||||
let copy_bytes_per_row =
|
||||
stage_bytes_per_row.min(data_layout.bytes_per_row) as usize;
|
||||
for layer in 0..size.depth {
|
||||
let rows_offset = layer * data_layout.rows_per_image;
|
||||
for row in 0..size.height {
|
||||
let data_offset =
|
||||
(rows_offset + row) as usize * data_layout.bytes_per_row as usize;
|
||||
let stage_offset =
|
||||
(rows_offset + row) as usize * stage_bytes_per_row as usize;
|
||||
mapping.slice[stage_offset..stage_offset + copy_bytes_per_row]
|
||||
.copy_from_slice(&data[data_offset..data_offset + copy_bytes_per_row]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let mut trackers = device.trackers.lock();
|
||||
let (dst, transition) = trackers.textures.use_replace(
|
||||
&*texture_guard,
|
||||
destination.texture,
|
||||
image_range,
|
||||
TextureUse::COPY_DST,
|
||||
);
|
||||
assert!(
|
||||
dst.usage.contains(wgt::TextureUsage::COPY_DST),
|
||||
"Write texture usage {:?} must contain flag COPY_DST",
|
||||
dst.usage
|
||||
);
|
||||
|
||||
let last_submit_index = device.life_guard.submission_index.load(Ordering::Relaxed);
|
||||
dst.life_guard.use_at(last_submit_index + 1);
|
||||
|
||||
let region = hal::command::BufferImageCopy {
|
||||
buffer_offset: 0,
|
||||
buffer_width: stage_bytes_per_row / bytes_per_texel,
|
||||
buffer_height: data_layout.rows_per_image,
|
||||
image_layers,
|
||||
image_offset,
|
||||
image_extent: conv::map_extent(size, dst.dimension),
|
||||
};
|
||||
unsafe {
|
||||
stage.comb.pipeline_barrier(
|
||||
super::all_image_stages() | hal::pso::PipelineStage::HOST
|
||||
..hal::pso::PipelineStage::TRANSFER,
|
||||
hal::memory::Dependencies::empty(),
|
||||
iter::once(hal::memory::Barrier::Buffer {
|
||||
states: hal::buffer::Access::HOST_WRITE..hal::buffer::Access::TRANSFER_READ,
|
||||
target: &stage.buffer,
|
||||
range: hal::buffer::SubRange::WHOLE,
|
||||
families: None,
|
||||
})
|
||||
.chain(transition.map(|pending| pending.into_hal(dst))),
|
||||
);
|
||||
stage.comb.copy_buffer_to_image(
|
||||
&stage.buffer,
|
||||
&dst.raw,
|
||||
hal::image::Layout::TransferDstOptimal,
|
||||
iter::once(region),
|
||||
);
|
||||
}
|
||||
|
||||
device.pending_writes.consume(stage);
|
||||
}
|
||||
|
||||
pub fn queue_submit<B: GfxBackend>(
|
||||
&self,
|
||||
queue_id: id::QueueId,
|
||||
command_buffer_ids: &[id::CommandBufferId],
|
||||
) {
|
||||
let hub = B::hub(self);
|
||||
|
||||
let callbacks = {
|
||||
let mut token = Token::root();
|
||||
let (mut device_guard, mut token) = hub.devices.write(&mut token);
|
||||
let device = &mut device_guard[queue_id];
|
||||
let pending_write_command_buffer =
|
||||
device
|
||||
.pending_writes
|
||||
.command_buffer
|
||||
.take()
|
||||
.map(|mut comb_raw| unsafe {
|
||||
comb_raw.finish();
|
||||
comb_raw
|
||||
});
|
||||
device.temp_suspected.clear();
|
||||
|
||||
let submit_index = 1 + device
|
||||
.life_guard
|
||||
.submission_index
|
||||
.fetch_add(1, Ordering::Relaxed);
|
||||
|
||||
let fence = {
|
||||
let mut signal_swapchain_semaphores = SmallVec::<[_; 1]>::new();
|
||||
let (mut swap_chain_guard, mut token) = hub.swap_chains.write(&mut token);
|
||||
let (mut command_buffer_guard, mut token) = hub.command_buffers.write(&mut token);
|
||||
|
||||
{
|
||||
let (bind_group_guard, mut token) = hub.bind_groups.read(&mut token);
|
||||
let (compute_pipe_guard, mut token) = hub.compute_pipelines.read(&mut token);
|
||||
let (render_pipe_guard, mut token) = hub.render_pipelines.read(&mut token);
|
||||
let (mut buffer_guard, mut token) = hub.buffers.write(&mut token);
|
||||
let (texture_guard, mut token) = hub.textures.read(&mut token);
|
||||
let (texture_view_guard, mut token) = hub.texture_views.read(&mut token);
|
||||
let (sampler_guard, _) = hub.samplers.read(&mut token);
|
||||
|
||||
//Note: locking the trackers has to be done after the storages
|
||||
let mut trackers = device.trackers.lock();
|
||||
|
||||
//TODO: if multiple command buffers are submitted, we can re-use the last
|
||||
// native command buffer of the previous chain instead of always creating
|
||||
// a temporary one, since the chains are not finished.
|
||||
|
||||
// finish all the command buffers first
|
||||
for &cmb_id in command_buffer_ids {
|
||||
let comb = &mut command_buffer_guard[cmb_id];
|
||||
#[cfg(feature = "trace")]
|
||||
match device.trace {
|
||||
Some(ref trace) => trace
|
||||
.lock()
|
||||
.add(Action::Submit(submit_index, comb.commands.take().unwrap())),
|
||||
None => (),
|
||||
};
|
||||
|
||||
if let Some((sc_id, fbo)) = comb.used_swap_chain.take() {
|
||||
let sc = &mut swap_chain_guard[sc_id.value];
|
||||
assert!(sc.acquired_view_id.is_some(),
|
||||
"SwapChainOutput for {:?} was dropped before the respective command buffer {:?} got submitted!",
|
||||
sc_id.value, cmb_id);
|
||||
if sc.acquired_framebuffers.is_empty() {
|
||||
signal_swapchain_semaphores.push(sc_id.value);
|
||||
}
|
||||
sc.acquired_framebuffers.push(fbo);
|
||||
}
|
||||
|
||||
// optimize the tracked states
|
||||
comb.trackers.optimize();
|
||||
|
||||
// update submission IDs
|
||||
for id in comb.trackers.buffers.used() {
|
||||
if let BufferMapState::Waiting(_) = buffer_guard[id].map_state {
|
||||
panic!("Buffer has a pending mapping.");
|
||||
}
|
||||
if !buffer_guard[id].life_guard.use_at(submit_index) {
|
||||
if let BufferMapState::Active { .. } = buffer_guard[id].map_state {
|
||||
log::warn!("Dropped buffer has a pending mapping.");
|
||||
super::unmap_buffer(&device.raw, &mut buffer_guard[id]);
|
||||
}
|
||||
device.temp_suspected.buffers.push(id);
|
||||
}
|
||||
}
|
||||
for id in comb.trackers.textures.used() {
|
||||
if !texture_guard[id].life_guard.use_at(submit_index) {
|
||||
device.temp_suspected.textures.push(id);
|
||||
}
|
||||
}
|
||||
for id in comb.trackers.views.used() {
|
||||
if !texture_view_guard[id].life_guard.use_at(submit_index) {
|
||||
device.temp_suspected.texture_views.push(id);
|
||||
}
|
||||
}
|
||||
for id in comb.trackers.bind_groups.used() {
|
||||
if !bind_group_guard[id].life_guard.use_at(submit_index) {
|
||||
device.temp_suspected.bind_groups.push(id);
|
||||
}
|
||||
}
|
||||
for id in comb.trackers.samplers.used() {
|
||||
if !sampler_guard[id].life_guard.use_at(submit_index) {
|
||||
device.temp_suspected.samplers.push(id);
|
||||
}
|
||||
}
|
||||
for id in comb.trackers.compute_pipes.used() {
|
||||
if !compute_pipe_guard[id].life_guard.use_at(submit_index) {
|
||||
device.temp_suspected.compute_pipelines.push(id);
|
||||
}
|
||||
}
|
||||
for id in comb.trackers.render_pipes.used() {
|
||||
if !render_pipe_guard[id].life_guard.use_at(submit_index) {
|
||||
device.temp_suspected.render_pipelines.push(id);
|
||||
}
|
||||
}
|
||||
|
||||
// execute resource transitions
|
||||
let mut transit = device.com_allocator.extend(comb);
|
||||
unsafe {
|
||||
// the last buffer was open, closing now
|
||||
comb.raw.last_mut().unwrap().finish();
|
||||
transit
|
||||
.begin_primary(hal::command::CommandBufferFlags::ONE_TIME_SUBMIT);
|
||||
}
|
||||
log::trace!("Stitching command buffer {:?} before submission", cmb_id);
|
||||
CommandBuffer::insert_barriers(
|
||||
&mut transit,
|
||||
&mut *trackers,
|
||||
&comb.trackers,
|
||||
&*buffer_guard,
|
||||
&*texture_guard,
|
||||
);
|
||||
unsafe {
|
||||
transit.finish();
|
||||
}
|
||||
comb.raw.insert(0, transit);
|
||||
}
|
||||
|
||||
log::debug!("Device after submission {}: {:#?}", submit_index, trackers);
|
||||
}
|
||||
|
||||
// now prepare the GPU submission
|
||||
let fence = device.raw.create_fence(false).unwrap();
|
||||
let submission = hal::queue::Submission {
|
||||
command_buffers: pending_write_command_buffer.as_ref().into_iter().chain(
|
||||
command_buffer_ids
|
||||
.iter()
|
||||
.flat_map(|&cmb_id| &command_buffer_guard[cmb_id].raw),
|
||||
),
|
||||
wait_semaphores: Vec::new(),
|
||||
signal_semaphores: signal_swapchain_semaphores
|
||||
.into_iter()
|
||||
.map(|sc_id| &swap_chain_guard[sc_id].semaphore),
|
||||
};
|
||||
|
||||
unsafe {
|
||||
device.queue_group.queues[0].submit(submission, Some(&fence));
|
||||
}
|
||||
fence
|
||||
};
|
||||
|
||||
if let Some(comb_raw) = pending_write_command_buffer {
|
||||
device
|
||||
.com_allocator
|
||||
.after_submit_internal(comb_raw, submit_index);
|
||||
}
|
||||
|
||||
let callbacks = device.maintain(self, false, &mut token);
|
||||
super::Device::lock_life_internal(&device.life_tracker, &mut token).track_submission(
|
||||
submit_index,
|
||||
fence,
|
||||
&device.temp_suspected,
|
||||
device.pending_writes.temp_buffers.drain(..),
|
||||
);
|
||||
|
||||
// finally, return the command buffers to the allocator
|
||||
for &cmb_id in command_buffer_ids {
|
||||
let (cmd_buf, _) = hub.command_buffers.unregister(cmb_id, &mut token);
|
||||
device.com_allocator.after_submit(cmd_buf, submit_index);
|
||||
}
|
||||
|
||||
callbacks
|
||||
};
|
||||
|
||||
super::fire_map_callbacks(callbacks);
|
||||
}
|
||||
}
|
||||
|
||||
fn get_lowest_common_denom(a: u32, b: u32) -> u32 {
|
||||
let gcd = if a >= b {
|
||||
get_greatest_common_divisor(a, b)
|
||||
} else {
|
||||
get_greatest_common_divisor(b, a)
|
||||
};
|
||||
a * b / gcd
|
||||
}
|
||||
|
||||
fn get_greatest_common_divisor(mut a: u32, mut b: u32) -> u32 {
|
||||
assert!(a >= b);
|
||||
loop {
|
||||
let c = a % b;
|
||||
if c == 0 {
|
||||
return b;
|
||||
} else {
|
||||
a = b;
|
||||
b = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn align_to(value: u32, alignment: u32) -> u32 {
|
||||
match value % alignment {
|
||||
0 => value,
|
||||
other => value - other + alignment,
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_lcd() {
|
||||
assert_eq!(get_lowest_common_denom(2, 2), 2);
|
||||
assert_eq!(get_lowest_common_denom(2, 3), 6);
|
||||
assert_eq!(get_lowest_common_denom(6, 4), 12);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_gcd() {
|
||||
assert_eq!(get_greatest_common_divisor(5, 1), 1);
|
||||
assert_eq!(get_greatest_common_divisor(4, 2), 2);
|
||||
assert_eq!(get_greatest_common_divisor(6, 4), 2);
|
||||
assert_eq!(get_greatest_common_divisor(7, 7), 7);
|
||||
}
|
|
@ -23,7 +23,7 @@ pub enum BindingResource {
|
|||
Buffer {
|
||||
id: id::BufferId,
|
||||
offset: wgt::BufferAddress,
|
||||
size: wgt::BufferAddress,
|
||||
size: wgt::BufferSize,
|
||||
},
|
||||
Sampler(id::SamplerId),
|
||||
TextureView(id::TextureViewId),
|
||||
|
@ -125,7 +125,7 @@ pub enum Action {
|
|||
desc: wgt::SwapChainDescriptor,
|
||||
},
|
||||
GetSwapChainTexture {
|
||||
id: id::TextureViewId,
|
||||
id: Option<id::TextureViewId>,
|
||||
parent_id: id::SwapChainId,
|
||||
},
|
||||
PresentSwapChain(id::SwapChainId),
|
||||
|
@ -166,6 +166,13 @@ pub enum Action {
|
|||
id: id::BufferId,
|
||||
data: FileName,
|
||||
range: Range<wgt::BufferAddress>,
|
||||
queued: bool,
|
||||
},
|
||||
WriteTexture {
|
||||
to: TextureCopyView,
|
||||
data: FileName,
|
||||
layout: wgt::TextureDataLayout,
|
||||
size: wgt::Extent3d,
|
||||
},
|
||||
Submit(crate::SubmissionIndex, Vec<Command>),
|
||||
}
|
||||
|
|
|
@ -80,6 +80,7 @@ impl IdentityManager {
|
|||
pub struct Storage<T, I: TypedId> {
|
||||
//TODO: consider concurrent hashmap?
|
||||
map: VecMap<(T, Epoch)>,
|
||||
kind: &'static str,
|
||||
_phantom: PhantomData<I>,
|
||||
}
|
||||
|
||||
|
@ -87,8 +88,15 @@ impl<T, I: TypedId> ops::Index<I> for Storage<T, I> {
|
|||
type Output = T;
|
||||
fn index(&self, id: I) -> &T {
|
||||
let (index, epoch, _) = id.unzip();
|
||||
let (ref value, storage_epoch) = self.map[index as usize];
|
||||
assert_eq!(epoch, storage_epoch);
|
||||
let (ref value, storage_epoch) = match self.map.get(index as usize) {
|
||||
Some(v) => v,
|
||||
None => panic!("{}[{}] does not exist", self.kind, index),
|
||||
};
|
||||
assert_eq!(
|
||||
epoch, *storage_epoch,
|
||||
"{}[{}] is no longer alive",
|
||||
self.kind, index
|
||||
);
|
||||
value
|
||||
}
|
||||
}
|
||||
|
@ -96,8 +104,15 @@ impl<T, I: TypedId> ops::Index<I> for Storage<T, I> {
|
|||
impl<T, I: TypedId> ops::IndexMut<I> for Storage<T, I> {
|
||||
fn index_mut(&mut self, id: I) -> &mut T {
|
||||
let (index, epoch, _) = id.unzip();
|
||||
let (ref mut value, storage_epoch) = self.map[index as usize];
|
||||
assert_eq!(epoch, storage_epoch);
|
||||
let (ref mut value, storage_epoch) = match self.map.get_mut(index as usize) {
|
||||
Some(v) => v,
|
||||
None => panic!("{}[{}] does not exist", self.kind, index),
|
||||
};
|
||||
assert_eq!(
|
||||
epoch, *storage_epoch,
|
||||
"{}[{}] is no longer alive",
|
||||
self.kind, index
|
||||
);
|
||||
value
|
||||
}
|
||||
}
|
||||
|
@ -304,22 +319,24 @@ pub struct Registry<T, I: TypedId, F: IdentityHandlerFactory<I>> {
|
|||
}
|
||||
|
||||
impl<T, I: TypedId, F: IdentityHandlerFactory<I>> Registry<T, I, F> {
|
||||
fn new(backend: Backend, factory: &F) -> Self {
|
||||
fn new(backend: Backend, factory: &F, kind: &'static str) -> Self {
|
||||
Registry {
|
||||
identity: factory.spawn(0),
|
||||
data: RwLock::new(Storage {
|
||||
map: VecMap::new(),
|
||||
kind,
|
||||
_phantom: PhantomData,
|
||||
}),
|
||||
backend,
|
||||
}
|
||||
}
|
||||
|
||||
fn without_backend(factory: &F) -> Self {
|
||||
fn without_backend(factory: &F, kind: &'static str) -> Self {
|
||||
Registry {
|
||||
identity: factory.spawn(1),
|
||||
data: RwLock::new(Storage {
|
||||
map: VecMap::new(),
|
||||
kind,
|
||||
_phantom: PhantomData,
|
||||
}),
|
||||
backend: Backend::Empty,
|
||||
|
@ -398,20 +415,20 @@ pub struct Hub<B: hal::Backend, F: GlobalIdentityHandlerFactory> {
|
|||
impl<B: GfxBackend, F: GlobalIdentityHandlerFactory> Hub<B, F> {
|
||||
fn new(factory: &F) -> Self {
|
||||
Hub {
|
||||
adapters: Registry::new(B::VARIANT, factory),
|
||||
devices: Registry::new(B::VARIANT, factory),
|
||||
swap_chains: Registry::new(B::VARIANT, factory),
|
||||
pipeline_layouts: Registry::new(B::VARIANT, factory),
|
||||
shader_modules: Registry::new(B::VARIANT, factory),
|
||||
bind_group_layouts: Registry::new(B::VARIANT, factory),
|
||||
bind_groups: Registry::new(B::VARIANT, factory),
|
||||
command_buffers: Registry::new(B::VARIANT, factory),
|
||||
render_pipelines: Registry::new(B::VARIANT, factory),
|
||||
compute_pipelines: Registry::new(B::VARIANT, factory),
|
||||
buffers: Registry::new(B::VARIANT, factory),
|
||||
textures: Registry::new(B::VARIANT, factory),
|
||||
texture_views: Registry::new(B::VARIANT, factory),
|
||||
samplers: Registry::new(B::VARIANT, factory),
|
||||
adapters: Registry::new(B::VARIANT, factory, "Adapter"),
|
||||
devices: Registry::new(B::VARIANT, factory, "Device"),
|
||||
swap_chains: Registry::new(B::VARIANT, factory, "SwapChain"),
|
||||
pipeline_layouts: Registry::new(B::VARIANT, factory, "PipelineLayout"),
|
||||
shader_modules: Registry::new(B::VARIANT, factory, "ShaderModule"),
|
||||
bind_group_layouts: Registry::new(B::VARIANT, factory, "BindGroupLayout"),
|
||||
bind_groups: Registry::new(B::VARIANT, factory, "BindGroup"),
|
||||
command_buffers: Registry::new(B::VARIANT, factory, "CommandBuffer"),
|
||||
render_pipelines: Registry::new(B::VARIANT, factory, "RenderPipeline"),
|
||||
compute_pipelines: Registry::new(B::VARIANT, factory, "ComputePipeline"),
|
||||
buffers: Registry::new(B::VARIANT, factory, "Buffer"),
|
||||
textures: Registry::new(B::VARIANT, factory, "Texture"),
|
||||
texture_views: Registry::new(B::VARIANT, factory, "TextureView"),
|
||||
samplers: Registry::new(B::VARIANT, factory, "Sampler"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -556,7 +573,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
pub fn new(name: &str, factory: G) -> Self {
|
||||
Global {
|
||||
instance: Instance::new(name, 1),
|
||||
surfaces: Registry::without_backend(&factory),
|
||||
surfaces: Registry::without_backend(&factory, "Surface"),
|
||||
hubs: Hubs::new(&factory),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::{
|
|||
device::Device,
|
||||
hub::{GfxBackend, Global, GlobalIdentityHandlerFactory, Input, Token},
|
||||
id::{AdapterId, DeviceId, SurfaceId},
|
||||
power, LifeGuard, Stored,
|
||||
power, LifeGuard, Stored, MAX_BIND_GROUPS,
|
||||
};
|
||||
|
||||
use wgt::{Backend, BackendBit, DeviceDescriptor, PowerPreference, BIND_BUFFER_ALIGNMENT};
|
||||
|
@ -18,7 +18,6 @@ use serde::Deserialize;
|
|||
use serde::Serialize;
|
||||
|
||||
use hal::{
|
||||
self,
|
||||
adapter::{AdapterInfo as HalAdapterInfo, DeviceType as HalDeviceType, PhysicalDevice as _},
|
||||
queue::QueueFamily as _,
|
||||
window::Surface as _,
|
||||
|
@ -527,6 +526,32 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
AdapterInfo::from_gfx(adapter.raw.info.clone(), adapter_id.backend())
|
||||
}
|
||||
|
||||
pub fn adapter_extensions<B: GfxBackend>(&self, adapter_id: AdapterId) -> wgt::Extensions {
|
||||
let hub = B::hub(self);
|
||||
let mut token = Token::root();
|
||||
let (adapter_guard, _) = hub.adapters.read(&mut token);
|
||||
let adapter = &adapter_guard[adapter_id];
|
||||
|
||||
let features = adapter.raw.physical_device.features();
|
||||
|
||||
wgt::Extensions {
|
||||
anisotropic_filtering: features.contains(hal::Features::SAMPLER_ANISOTROPY),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn adapter_limits<B: GfxBackend>(&self, adapter_id: AdapterId) -> wgt::Limits {
|
||||
let hub = B::hub(self);
|
||||
let mut token = Token::root();
|
||||
let (adapter_guard, _) = hub.adapters.read(&mut token);
|
||||
let adapter = &adapter_guard[adapter_id];
|
||||
|
||||
let limits = adapter.raw.physical_device.limits();
|
||||
|
||||
wgt::Limits {
|
||||
max_bind_groups: (limits.max_bound_descriptor_sets as u32).min(MAX_BIND_GROUPS as u32),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn adapter_destroy<B: GfxBackend>(&self, adapter_id: AdapterId) {
|
||||
let hub = B::hub(self);
|
||||
let mut token = Token::root();
|
||||
|
@ -560,10 +585,14 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
let (adapter_guard, _) = hub.adapters.read(&mut token);
|
||||
let adapter = &adapter_guard[adapter_id];
|
||||
let phd = &adapter.raw.physical_device;
|
||||
|
||||
let available_features = adapter.raw.physical_device.features();
|
||||
|
||||
// Check features that are always needed
|
||||
let wishful_features = hal::Features::VERTEX_STORES_AND_ATOMICS
|
||||
| hal::Features::FRAGMENT_STORES_AND_ATOMICS
|
||||
| hal::Features::NDC_Y_UP;
|
||||
let enabled_features = adapter.raw.physical_device.features() & wishful_features;
|
||||
let mut enabled_features = available_features & wishful_features;
|
||||
if enabled_features != wishful_features {
|
||||
log::warn!(
|
||||
"Missing features: {:?}",
|
||||
|
@ -571,6 +600,15 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
);
|
||||
}
|
||||
|
||||
// Check features needed by extensions
|
||||
if desc.extensions.anisotropic_filtering {
|
||||
assert!(
|
||||
available_features.contains(hal::Features::SAMPLER_ANISOTROPY),
|
||||
"Missing feature SAMPLER_ANISOTROPY for anisotropic filtering extension"
|
||||
);
|
||||
enabled_features |= hal::Features::SAMPLER_ANISOTROPY;
|
||||
}
|
||||
|
||||
let family = adapter
|
||||
.raw
|
||||
.queue_families
|
||||
|
@ -613,7 +651,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
},
|
||||
gpu.queue_groups.swap_remove(0),
|
||||
mem_props,
|
||||
limits.non_coherent_atom_size as u64,
|
||||
limits,
|
||||
supports_texture_d24_s8,
|
||||
desc,
|
||||
trace_path,
|
||||
|
|
|
@ -48,6 +48,8 @@ use atomic::{AtomicUsize, Ordering};
|
|||
|
||||
use std::{os::raw::c_char, ptr};
|
||||
|
||||
const MAX_BIND_GROUPS: usize = 4;
|
||||
|
||||
type SubmissionIndex = usize;
|
||||
type Index = u32;
|
||||
type Epoch = u32;
|
||||
|
@ -192,3 +194,9 @@ macro_rules! gfx_select {
|
|||
/// Fast hash map used internally.
|
||||
type FastHashMap<K, V> =
|
||||
std::collections::HashMap<K, V, std::hash::BuildHasherDefault<fxhash::FxHasher>>;
|
||||
|
||||
#[test]
|
||||
fn test_default_limits() {
|
||||
let limits = wgt::Limits::default();
|
||||
assert!(limits.max_bind_groups <= MAX_BIND_GROUPS as u32);
|
||||
}
|
||||
|
|
|
@ -170,6 +170,7 @@ pub struct Texture<B: hal::Backend> {
|
|||
pub(crate) raw: B::Image,
|
||||
pub(crate) device_id: Stored<DeviceId>,
|
||||
pub(crate) usage: TextureUsage,
|
||||
pub(crate) dimension: wgt::TextureDimension,
|
||||
pub(crate) kind: hal::image::Kind,
|
||||
pub(crate) format: TextureFormat,
|
||||
pub(crate) full_range: hal::image::SubresourceRange,
|
||||
|
|
|
@ -42,7 +42,7 @@ use crate::{
|
|||
};
|
||||
|
||||
use hal::{self, device::Device as _, queue::CommandQueue as _, window::PresentationSurface as _};
|
||||
use wgt::SwapChainDescriptor;
|
||||
use wgt::{SwapChainDescriptor, SwapChainStatus};
|
||||
|
||||
const FRAME_TIMEOUT_MS: u64 = 1000;
|
||||
pub const DESIRED_NUM_FRAMES: u32 = 3;
|
||||
|
@ -83,20 +83,16 @@ pub(crate) fn swap_chain_descriptor_to_hal(
|
|||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct SwapChainOutput {
|
||||
pub status: SwapChainStatus,
|
||||
pub view_id: Option<TextureViewId>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum SwapChainGetNextTextureError {
|
||||
GpuProcessingTimeout,
|
||||
}
|
||||
|
||||
impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
pub fn swap_chain_get_next_texture<B: GfxBackend>(
|
||||
&self,
|
||||
swap_chain_id: SwapChainId,
|
||||
view_id_in: Input<G, TextureViewId>,
|
||||
) -> Result<SwapChainOutput, SwapChainGetNextTextureError> {
|
||||
) -> SwapChainOutput {
|
||||
let hub = B::hub(self);
|
||||
let mut token = Token::root();
|
||||
|
||||
|
@ -105,76 +101,78 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||
let (device_guard, mut token) = hub.devices.read(&mut token);
|
||||
let (mut swap_chain_guard, mut token) = hub.swap_chains.write(&mut token);
|
||||
let sc = &mut swap_chain_guard[swap_chain_id];
|
||||
#[cfg_attr(not(feature = "trace"), allow(unused_variables))]
|
||||
let device = &device_guard[sc.device_id.value];
|
||||
|
||||
let (image, _) = {
|
||||
let suf = B::get_surface_mut(surface);
|
||||
match unsafe { suf.acquire_image(FRAME_TIMEOUT_MS * 1_000_000) } {
|
||||
Ok(surface_image) => surface_image,
|
||||
Err(hal::window::AcquireError::Timeout) => {
|
||||
return Err(SwapChainGetNextTextureError::GpuProcessingTimeout);
|
||||
}
|
||||
Err(e) => {
|
||||
log::warn!("acquire_image() failed ({:?}), reconfiguring swapchain", e);
|
||||
let desc = swap_chain_descriptor_to_hal(
|
||||
&sc.desc,
|
||||
sc.num_frames,
|
||||
device.private_features,
|
||||
);
|
||||
unsafe {
|
||||
suf.configure_swapchain(&device.raw, desc).unwrap();
|
||||
suf.acquire_image(FRAME_TIMEOUT_MS * 1_000_000).unwrap()
|
||||
}
|
||||
}
|
||||
}
|
||||
let suf = B::get_surface_mut(surface);
|
||||
let (image, status) = match unsafe { suf.acquire_image(FRAME_TIMEOUT_MS * 1_000_000) } {
|
||||
Ok((surface_image, None)) => (Some(surface_image), SwapChainStatus::Good),
|
||||
Ok((surface_image, Some(_))) => (Some(surface_image), SwapChainStatus::Suboptimal),
|
||||
Err(err) => (
|
||||
None,
|
||||
match err {
|
||||
hal::window::AcquireError::OutOfMemory(_) => SwapChainStatus::OutOfMemory,
|
||||
hal::window::AcquireError::NotReady => unreachable!(), // we always set a timeout
|
||||
hal::window::AcquireError::Timeout => SwapChainStatus::Timeout,
|
||||
hal::window::AcquireError::OutOfDate => SwapChainStatus::Outdated,
|
||||
hal::window::AcquireError::SurfaceLost(_) => SwapChainStatus::Lost,
|
||||
hal::window::AcquireError::DeviceLost(_) => SwapChainStatus::Lost,
|
||||
},
|
||||
),
|
||||
};
|
||||
|
||||
let view = resource::TextureView {
|
||||
inner: resource::TextureViewInner::SwapChain {
|
||||
image,
|
||||
source_id: Stored {
|
||||
value: swap_chain_id,
|
||||
ref_count: sc.life_guard.add_ref(),
|
||||
let view_id = image.map(|image| {
|
||||
let view = resource::TextureView {
|
||||
inner: resource::TextureViewInner::SwapChain {
|
||||
image,
|
||||
source_id: Stored {
|
||||
value: swap_chain_id,
|
||||
ref_count: sc.life_guard.add_ref(),
|
||||
},
|
||||
},
|
||||
},
|
||||
format: sc.desc.format,
|
||||
extent: hal::image::Extent {
|
||||
width: sc.desc.width,
|
||||
height: sc.desc.height,
|
||||
depth: 1,
|
||||
},
|
||||
samples: 1,
|
||||
range: hal::image::SubresourceRange {
|
||||
aspects: hal::format::Aspects::COLOR,
|
||||
layers: 0..1,
|
||||
levels: 0..1,
|
||||
},
|
||||
life_guard: LifeGuard::new(),
|
||||
};
|
||||
let ref_count = view.life_guard.add_ref();
|
||||
let id = hub
|
||||
.texture_views
|
||||
.register_identity(view_id_in, view, &mut token);
|
||||
format: sc.desc.format,
|
||||
extent: hal::image::Extent {
|
||||
width: sc.desc.width,
|
||||
height: sc.desc.height,
|
||||
depth: 1,
|
||||
},
|
||||
samples: 1,
|
||||
range: hal::image::SubresourceRange {
|
||||
aspects: hal::format::Aspects::COLOR,
|
||||
layers: 0..1,
|
||||
levels: 0..1,
|
||||
},
|
||||
life_guard: LifeGuard::new(),
|
||||
};
|
||||
|
||||
let ref_count = view.life_guard.add_ref();
|
||||
let id = hub
|
||||
.texture_views
|
||||
.register_identity(view_id_in, view, &mut token);
|
||||
|
||||
assert!(
|
||||
sc.acquired_view_id.is_none(),
|
||||
"Swap chain image is already acquired"
|
||||
);
|
||||
|
||||
sc.acquired_view_id = Some(Stored {
|
||||
value: id,
|
||||
ref_count,
|
||||
});
|
||||
|
||||
id
|
||||
});
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
match device.trace {
|
||||
Some(ref trace) => trace.lock().add(Action::GetSwapChainTexture {
|
||||
id,
|
||||
id: view_id,
|
||||
parent_id: swap_chain_id,
|
||||
}),
|
||||
None => (),
|
||||
};
|
||||
|
||||
assert!(
|
||||
sc.acquired_view_id.is_none(),
|
||||
"Swap chain image is already acquired"
|
||||
);
|
||||
sc.acquired_view_id = Some(Stored {
|
||||
value: id,
|
||||
ref_count,
|
||||
});
|
||||
|
||||
Ok(SwapChainOutput { view_id: Some(id) })
|
||||
SwapChainOutput { status, view_id }
|
||||
}
|
||||
|
||||
pub fn swap_chain_present<B: GfxBackend>(&self, swap_chain_id: SwapChainId) {
|
||||
|
|
|
@ -10,6 +10,33 @@ use serde::Deserialize;
|
|||
use serde::Serialize;
|
||||
use std::{io, ptr, slice};
|
||||
|
||||
/// Buffer-Texture copies on command encoders have to have the `bytes_per_row`
|
||||
/// aligned to this number.
|
||||
///
|
||||
/// This doesn't apply to `Queue::write_texture`.
|
||||
pub const COPY_BYTES_PER_ROW_ALIGNMENT: u32 = 256;
|
||||
/// Bound uniform/storage buffer offsets must be aligned to this number.
|
||||
pub const BIND_BUFFER_ALIGNMENT: u64 = 256;
|
||||
|
||||
#[repr(transparent)]
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
||||
#[cfg_attr(feature = "peek-poke", derive(PeekPoke))]
|
||||
#[cfg_attr(
|
||||
feature = "trace",
|
||||
derive(serde::Serialize),
|
||||
serde(into = "SerBufferSize")
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "replay",
|
||||
derive(serde::Deserialize),
|
||||
serde(from = "SerBufferSize")
|
||||
)]
|
||||
pub struct BufferSize(pub u64);
|
||||
|
||||
impl BufferSize {
|
||||
pub const WHOLE: BufferSize = BufferSize(!0u64);
|
||||
}
|
||||
|
||||
#[repr(u8)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "trace", derive(Serialize))]
|
||||
|
@ -66,6 +93,10 @@ impl From<Backend> for BackendBit {
|
|||
#[cfg_attr(feature = "trace", derive(Serialize))]
|
||||
#[cfg_attr(feature = "replay", derive(Deserialize))]
|
||||
pub struct Extensions {
|
||||
/// This is a native only extension. Support is planned to be added to webgpu,
|
||||
/// but it is not yet implemented.
|
||||
///
|
||||
/// https://github.com/gpuweb/gpuweb/issues/696
|
||||
pub anisotropic_filtering: bool,
|
||||
}
|
||||
|
||||
|
@ -77,13 +108,9 @@ pub struct Limits {
|
|||
pub max_bind_groups: u32,
|
||||
}
|
||||
|
||||
pub const MAX_BIND_GROUPS: usize = 4;
|
||||
|
||||
impl Default for Limits {
|
||||
fn default() -> Self {
|
||||
Limits {
|
||||
max_bind_groups: MAX_BIND_GROUPS as u32,
|
||||
}
|
||||
Limits { max_bind_groups: 4 }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -638,6 +665,17 @@ pub struct SwapChainDescriptor {
|
|||
pub present_mode: PresentMode,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub enum SwapChainStatus {
|
||||
Good,
|
||||
Suboptimal,
|
||||
Timeout,
|
||||
Outdated,
|
||||
Lost,
|
||||
OutOfMemory,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "trace", derive(Serialize))]
|
||||
|
@ -897,6 +935,11 @@ pub struct SamplerDescriptor<L> {
|
|||
pub lod_min_clamp: f32,
|
||||
pub lod_max_clamp: f32,
|
||||
pub compare: CompareFunction,
|
||||
/// Anisotropic filtering extension must be enabled if this value is
|
||||
/// anything other than 0 and 1.
|
||||
///
|
||||
/// Valid values are 0, 1, 2, 4, 8, and 16.
|
||||
pub anisotropy_clamp: u8,
|
||||
}
|
||||
|
||||
impl<L> SamplerDescriptor<L> {
|
||||
|
@ -912,6 +955,7 @@ impl<L> SamplerDescriptor<L> {
|
|||
lod_min_clamp: self.lod_min_clamp,
|
||||
lod_max_clamp: self.lod_max_clamp,
|
||||
compare: self.compare,
|
||||
anisotropy_clamp: self.anisotropy_clamp,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -981,5 +1025,42 @@ impl From<TextureFormat> for TextureComponentType {
|
|||
}
|
||||
}
|
||||
|
||||
/// Bound uniform/storage buffer offsets must be aligned to this number.
|
||||
pub const BIND_BUFFER_ALIGNMENT: u64 = 256;
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Debug)]
|
||||
#[cfg_attr(feature = "trace", derive(serde::Serialize))]
|
||||
#[cfg_attr(feature = "replay", derive(serde::Deserialize))]
|
||||
pub struct TextureDataLayout {
|
||||
pub offset: BufferAddress,
|
||||
pub bytes_per_row: u32,
|
||||
pub rows_per_image: u32,
|
||||
}
|
||||
|
||||
/// This type allows us to make the serialized representation of a BufferSize more human-readable
|
||||
#[allow(dead_code)]
|
||||
#[cfg_attr(feature = "trace", derive(serde::Serialize))]
|
||||
#[cfg_attr(feature = "replay", derive(serde::Deserialize))]
|
||||
enum SerBufferSize {
|
||||
Size(u64),
|
||||
Whole,
|
||||
}
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
impl From<BufferSize> for SerBufferSize {
|
||||
fn from(buffer_size: BufferSize) -> Self {
|
||||
if buffer_size == BufferSize::WHOLE {
|
||||
Self::Whole
|
||||
} else {
|
||||
Self::Size(buffer_size.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "replay")]
|
||||
impl From<SerBufferSize> for BufferSize {
|
||||
fn from(ser_buffer_size: SerBufferSize) -> Self {
|
||||
match ser_buffer_size {
|
||||
SerBufferSize::Size(size) => BufferSize(size),
|
||||
SerBufferSize::Whole => BufferSize::WHOLE,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,17 @@ use std::{ptr, slice};
|
|||
pub mod identity;
|
||||
pub mod server;
|
||||
|
||||
// In WebIDL the "whole size" semantics is zero.
|
||||
// Use this function to convert one into another.
|
||||
#[no_mangle]
|
||||
pub extern "C" fn make_buffer_size(raw_size: u64) -> wgt::BufferSize {
|
||||
if raw_size != 0 {
|
||||
wgt::BufferSize(raw_size)
|
||||
} else {
|
||||
wgt::BufferSize::WHOLE
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
struct IdentityHub {
|
||||
adapters: IdentityManager,
|
||||
|
|
|
@ -197,7 +197,7 @@ pub unsafe extern "C" fn wgpu_server_encoder_copy_texture_to_buffer(
|
|||
self_id: id::CommandEncoderId,
|
||||
source: &wgc::command::TextureCopyView,
|
||||
destination: &wgc::command::BufferCopyView,
|
||||
size: wgt::Extent3d,
|
||||
size: &wgt::Extent3d,
|
||||
) {
|
||||
gfx_select!(self_id => global.command_encoder_copy_texture_to_buffer(self_id, source, destination, size));
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ pub unsafe extern "C" fn wgpu_server_encoder_copy_buffer_to_texture(
|
|||
self_id: id::CommandEncoderId,
|
||||
source: &wgc::command::BufferCopyView,
|
||||
destination: &wgc::command::TextureCopyView,
|
||||
size: wgt::Extent3d,
|
||||
size: &wgt::Extent3d,
|
||||
) {
|
||||
gfx_select!(self_id => global.command_encoder_copy_buffer_to_texture(self_id, source, destination, size));
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ pub unsafe extern "C" fn wgpu_server_encoder_copy_texture_to_texture(
|
|||
self_id: id::CommandEncoderId,
|
||||
source: &wgc::command::TextureCopyView,
|
||||
destination: &wgc::command::TextureCopyView,
|
||||
size: wgt::Extent3d,
|
||||
size: &wgt::Extent3d,
|
||||
) {
|
||||
gfx_select!(self_id => global.command_encoder_copy_texture_to_texture(self_id, source, destination, size));
|
||||
}
|
||||
|
@ -271,6 +271,41 @@ pub unsafe extern "C" fn wgpu_server_queue_submit(
|
|||
gfx_select!(self_id => global.queue_submit(self_id, command_buffers));
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe as there is no guarantee that the given pointer is
|
||||
/// valid for `data_length` elements.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_server_queue_write_buffer(
|
||||
global: &Global,
|
||||
self_id: id::QueueId,
|
||||
buffer_id: id::BufferId,
|
||||
buffer_offset: wgt::BufferAddress,
|
||||
data: *const u8,
|
||||
data_length: usize,
|
||||
) {
|
||||
let data = slice::from_raw_parts(data, data_length);
|
||||
gfx_select!(self_id => global.queue_write_buffer(self_id, buffer_id, buffer_offset, data));
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe as there is no guarantee that the given pointer is
|
||||
/// valid for `data_length` elements.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_server_queue_write_texture(
|
||||
global: &Global,
|
||||
self_id: id::QueueId,
|
||||
destination: &wgc::command::TextureCopyView,
|
||||
data: *const u8,
|
||||
data_length: usize,
|
||||
layout: &wgt::TextureDataLayout,
|
||||
extent: &wgt::Extent3d,
|
||||
) {
|
||||
let data = slice::from_raw_parts(data, data_length);
|
||||
gfx_select!(self_id => global.queue_write_texture(self_id, destination, data, layout, extent));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_device_create_bind_group_layout(
|
||||
global: &Global,
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
{"files":{"Cargo.toml":"496e0f8ca4e0704fad12dfe9dcc0a63d4f5bf1e05024fc5c8ff2663a5773bacb","build.rs":"eb64e6325338b0e9e46cc9bdad96939ce19fb33b7a269e3a3c92b1ec0930c615","examples/hello-world.rs":"0fc60afb6ba41930e0e74fc31b835faa771b06eb70314cdd9a07e05204b1b389","examples/input.rs":"18a254cbd92871c1c27edf420ff29eb02e0dd6eb744ecbb8dbebcd590780b96a","examples/xrecord.rs":"d2458011f4ee170db613d5effa483f51ac56bceab7f25c44eee4cb22c1863207","src/dpms.rs":"77cb9237a0262350bf6553e40d6cc9e97a599bca089a457ef87c57c9b9cf6194","src/glx.rs":"b559c1e9663069f417bf70f1f86eb3e1103739c7041ee6a9103759030fac1126","src/internal.rs":"9e1f269e36e6a92325be4f5e67185d60c12e4a74b98c454759c0161325d0d1e4","src/keysym.rs":"4d65901072224729fe18fb5c815242e51e75a34c1dfc88e5ac1cea19e8a423a8","src/lib.rs":"49ad75828478d09a2f0aceb7effe61fecea9785285cd17d8622b924e88740c5a","src/link.rs":"5a6f63372091daf218d27d55e8ab5775ccf591e50c532c4c442acdf2b64136a9","src/xcursor.rs":"d4d87186c78c42bbff7318fb530851bdb61e38b431233644a3b2295bb0081841","src/xf86vmode.rs":"fa118cf4d8ed1aae60a6e97016a0f2c50b62175628700a1fb96a3d2ea0712305","src/xfixes.rs":"cc2a1681415c3d2d32331dd610567376b6eaa5f42d58b8940a1ff1d765d9cc85","src/xft.rs":"0951bc2f362c4c9722554b89c87ab67e7d60698734820fd88207f874fa84dee9","src/xinerama.rs":"c4bd4f21f044d695b2fc052a20d554aac1f2227459e38da9b66125c60b6d33b7","src/xinput.rs":"3876865629612690d0ab3b551a7e6303eaf9818ff0a56c0d803281c16c7c475a","src/xinput2.rs":"b5a0eba5b1ae5f89534b3fad30fd13f45b02b4ef6b492734fbf4b0c66a7391e1","src/xlib.rs":"65221fbbf70bf25d828692bacf288ab4ebdc073ba09917a3790b5bc0c2bbb70b","src/xlib_xcb.rs":"71ee6274e261bb8f0b82ea260afffa9273531f0f87df9541152412b88aff468f","src/xmd.rs":"149c818c19e90a14c8f60016cd18a04d0de4fd702fc5df89e5283f6ee1ce4852","src/xmu.rs":"262df634c584dac47d0d898dd75b6b2de7c4256b9b494cf89123d8279dad3020","src/xrandr.rs":"c137fadcd035142536567a4ab2591331f040a8c77306746a70ffc5df2bdf6979","src/xrecord.rs":"82e4ad59079ce6c6ad0097ef4b44935d2448b363784abe008919f89cb02ae8c4","src/xrender.rs":"d6642eb83709bc8ff913dd382677e94d5153618f005fead645962947b8ff50b4","src/xss.rs":"8322f210627a59d825a11256ff4daff42c53c6e8ba626f55b3859bf938e8a7b2","src/xt.rs":"fa2324391a91387f44eeee6742c50676329f08d941d002ff70d4eb99f36af7bc","src/xtest.rs":"dcd0eb130ffb3cf96165d1699d6b625649c28ed819036a85b5f175c2a3479918"},"package":"39697e3123f715483d311b5826e254b6f3cfebdd83cf7ef3358f579c3d68e235"}
|
|
@ -1,45 +0,0 @@
|
|||
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
||||
#
|
||||
# When uploading crates to the registry Cargo will automatically
|
||||
# "normalize" Cargo.toml files for maximal compatibility
|
||||
# with all versions of Cargo and also rewrite `path` dependencies
|
||||
# to registry (e.g. crates.io) dependencies
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
# editing this file be aware that the upstream Cargo.toml
|
||||
# will likely look very different (and much more reasonable)
|
||||
|
||||
[package]
|
||||
name = "x11"
|
||||
version = "2.18.1"
|
||||
authors = ["daggerbot <daggerbot@gmail.com>", "Erle Pereira <erle@erlepereira.com>"]
|
||||
build = "build.rs"
|
||||
description = "X11 library bindings for Rust"
|
||||
documentation = "https://docs.rs/x11"
|
||||
license = "CC0-1.0"
|
||||
repository = "https://github.com/erlepereira/x11-rs.git"
|
||||
[dependencies.libc]
|
||||
version = "0.2"
|
||||
[build-dependencies.pkg-config]
|
||||
version = "0.3.8"
|
||||
|
||||
[features]
|
||||
dox = []
|
||||
dpms = []
|
||||
glx = []
|
||||
xcursor = []
|
||||
xf86vmode = []
|
||||
xft = []
|
||||
xinerama = []
|
||||
xinput = []
|
||||
xlib = []
|
||||
xlib_xcb = []
|
||||
xmu = []
|
||||
xrandr = []
|
||||
xrecord = ["xtst"]
|
||||
xrender = []
|
||||
xss = []
|
||||
xt = []
|
||||
xtest = ["xtst"]
|
||||
xtst = []
|
|
@ -1,38 +0,0 @@
|
|||
// x11-rs: Rust bindings for X11 libraries
|
||||
// The X11 libraries are available under the MIT license.
|
||||
// These bindings are public domain.
|
||||
|
||||
extern crate pkg_config;
|
||||
|
||||
use std::env;
|
||||
|
||||
fn main () {
|
||||
if cfg!(feature = "dox") { return; }
|
||||
|
||||
let deps = [
|
||||
("gl", "1", "glx"),
|
||||
("x11", "1.4.99.1", "xlib"),
|
||||
("x11-xcb", "1.6", "xlib_xcb"),
|
||||
("xcursor", "1.1", "xcursor"),
|
||||
("xext", "1.3", "dpms"),
|
||||
("xft", "2.1", "xft"),
|
||||
("xi", "1.7", "xinput"),
|
||||
("xinerama", "1.1", "xinerama"),
|
||||
("xmu", "1.1", "xmu"),
|
||||
("xrandr", "1.5", "xrandr"),
|
||||
("xrender", "0.9.6", "xrender"),
|
||||
("xscrnsaver", "1.2", "xss"),
|
||||
("xt", "1.1", "xt"),
|
||||
("xtst", "1.2", "xtst"),
|
||||
("xxf86vm", "1.1", "xf86vmode"),
|
||||
];
|
||||
|
||||
for &(dep, version, feature) in deps.iter() {
|
||||
let var = format!(
|
||||
"CARGO_FEATURE_{}",
|
||||
feature.to_uppercase().replace('-', "_")
|
||||
);
|
||||
if env::var_os(var).is_none() { continue; }
|
||||
pkg_config::Config::new().atleast_version(version).probe(dep).unwrap();
|
||||
}
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
// x11-rs: Rust bindings for X11 libraries
|
||||
// The X11 libraries are available under the MIT license.
|
||||
// These bindings are public domain.
|
||||
|
||||
#![cfg_attr(not(feature = "xlib"), allow(dead_code))]
|
||||
#![cfg_attr(not(feature = "xlib"), allow(unused_imports))]
|
||||
|
||||
extern crate x11;
|
||||
|
||||
use std::ffi::CString;
|
||||
use std::mem;
|
||||
use std::os::raw::*;
|
||||
use std::ptr;
|
||||
|
||||
use x11::xlib;
|
||||
|
||||
#[cfg(not(feature = "xlib"))]
|
||||
fn main () {
|
||||
panic!("this example requires `--features xlib`");
|
||||
}
|
||||
|
||||
#[cfg(feature = "xlib")]
|
||||
fn main () {
|
||||
unsafe {
|
||||
// Open display connection.
|
||||
let display = xlib::XOpenDisplay(ptr::null());
|
||||
|
||||
if display.is_null() {
|
||||
panic!("XOpenDisplay failed");
|
||||
}
|
||||
|
||||
// Create window.
|
||||
let screen = xlib::XDefaultScreen(display);
|
||||
let root = xlib::XRootWindow(display, screen);
|
||||
|
||||
let mut attributes: xlib::XSetWindowAttributes = mem::uninitialized();
|
||||
attributes.background_pixel = xlib::XWhitePixel(display, screen);
|
||||
|
||||
let window = xlib::XCreateWindow(display, root,
|
||||
0, 0, 400, 300,
|
||||
0, 0,
|
||||
xlib::InputOutput as c_uint, ptr::null_mut(),
|
||||
xlib::CWBackPixel, &mut attributes);
|
||||
|
||||
// Set window title.
|
||||
let title_str = CString::new("hello-world").unwrap();
|
||||
xlib::XStoreName(display, window, title_str.as_ptr() as *mut c_char);
|
||||
|
||||
// Hook close requests.
|
||||
let wm_protocols_str = CString::new("WM_PROTOCOLS").unwrap();
|
||||
let wm_delete_window_str = CString::new("WM_DELETE_WINDOW").unwrap();
|
||||
|
||||
let wm_protocols = xlib::XInternAtom(display, wm_protocols_str.as_ptr(), xlib::False);
|
||||
let wm_delete_window = xlib::XInternAtom(display, wm_delete_window_str.as_ptr(), xlib::False);
|
||||
|
||||
let mut protocols = [wm_delete_window];
|
||||
|
||||
xlib::XSetWMProtocols(display, window, protocols.as_mut_ptr(), protocols.len() as c_int);
|
||||
|
||||
// Show window.
|
||||
xlib::XMapWindow(display, window);
|
||||
|
||||
// Main loop.
|
||||
let mut event: xlib::XEvent = mem::uninitialized();
|
||||
|
||||
loop {
|
||||
xlib::XNextEvent(display, &mut event);
|
||||
|
||||
match event.get_type() {
|
||||
xlib::ClientMessage => {
|
||||
let xclient = xlib::XClientMessageEvent::from(event);
|
||||
|
||||
if xclient.message_type == wm_protocols && xclient.format == 32 {
|
||||
let protocol = xclient.data.get_long(0) as xlib::Atom;
|
||||
|
||||
if protocol == wm_delete_window {
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_ => ()
|
||||
}
|
||||
}
|
||||
|
||||
// Shut down.
|
||||
xlib::XCloseDisplay(display);
|
||||
}
|
||||
}
|
|
@ -1,384 +0,0 @@
|
|||
// XInput2 example for x11-rs
|
||||
//
|
||||
// This is a basic example showing how to use XInput2 to read
|
||||
// keyboard, mouse and other input events in X11.
|
||||
//
|
||||
// See Pete Hutterer's "XI2 Recipes" blog series,
|
||||
// starting at http://who-t.blogspot.co.uk/2009/05/xi2-recipes-part-1.html
|
||||
// for a guide.
|
||||
|
||||
#![cfg_attr(not(feature = "xlib"), allow(dead_code))]
|
||||
#![cfg_attr(not(feature = "xlib"), allow(unused_imports))]
|
||||
|
||||
extern crate x11;
|
||||
extern crate libc;
|
||||
|
||||
use std::ffi::CString;
|
||||
use std::ptr::{
|
||||
null,
|
||||
null_mut,
|
||||
};
|
||||
use std::mem::{transmute, zeroed};
|
||||
use std::os::raw::*;
|
||||
use std::slice::{from_raw_parts};
|
||||
use x11::{xlib, xinput2};
|
||||
|
||||
/// Provides a basic framework for connecting to an X Display,
|
||||
/// creating a window, displaying it and running the event loop
|
||||
pub struct DemoWindow {
|
||||
pub display: *mut xlib::Display,
|
||||
pub window: xlib::Window,
|
||||
|
||||
wm_protocols: xlib::Atom,
|
||||
wm_delete_window: xlib::Atom
|
||||
}
|
||||
|
||||
impl DemoWindow {
|
||||
/// Create a new window with a given title and size
|
||||
pub fn new(title: &str, width: u32, height: u32) -> DemoWindow {
|
||||
unsafe {
|
||||
// Open display
|
||||
let display = xlib::XOpenDisplay(null());
|
||||
if display == null_mut() {
|
||||
panic!("can't open display");
|
||||
}
|
||||
|
||||
// Load atoms
|
||||
let wm_delete_window_str = CString::new("WM_DELETE_WINDOW").unwrap();
|
||||
let wm_protocols_str = CString::new("WM_PROTOCOLS").unwrap();
|
||||
|
||||
let wm_delete_window = xlib::XInternAtom(display, wm_delete_window_str.as_ptr(), xlib::False);
|
||||
let wm_protocols = xlib::XInternAtom(display, wm_protocols_str.as_ptr(), xlib::False);
|
||||
|
||||
if wm_delete_window == 0 || wm_protocols == 0 {
|
||||
panic!("can't load atoms");
|
||||
}
|
||||
|
||||
// Create window
|
||||
let screen_num = xlib::XDefaultScreen(display);
|
||||
let root = xlib::XRootWindow(display, screen_num);
|
||||
let white_pixel = xlib::XWhitePixel(display, screen_num);
|
||||
|
||||
let mut attributes: xlib::XSetWindowAttributes = zeroed();
|
||||
attributes.background_pixel = white_pixel;
|
||||
|
||||
let window = xlib::XCreateWindow(display, root, 0, 0, width as c_uint, height as c_uint, 0, 0,
|
||||
xlib::InputOutput as c_uint, null_mut(),
|
||||
xlib::CWBackPixel, &mut attributes);
|
||||
// Set window title
|
||||
let title_str = CString::new(title).unwrap();
|
||||
xlib::XStoreName(display, window, title_str.as_ptr() as *mut _);
|
||||
|
||||
// Subscribe to delete (close) events
|
||||
let mut protocols = [wm_delete_window];
|
||||
|
||||
if xlib::XSetWMProtocols(display, window, &mut protocols[0] as *mut xlib::Atom, 1) == xlib::False {
|
||||
panic!("can't set WM protocols");
|
||||
}
|
||||
|
||||
DemoWindow{
|
||||
display: display,
|
||||
window: window,
|
||||
wm_protocols: wm_protocols,
|
||||
wm_delete_window: wm_delete_window
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Display the window
|
||||
pub fn show(&mut self) {
|
||||
unsafe {
|
||||
xlib::XMapWindow(self.display, self.window);
|
||||
}
|
||||
}
|
||||
|
||||
/// Process events for the window. Window close events are handled automatically,
|
||||
/// other events are passed on to |event_handler|
|
||||
pub fn run_event_loop<EventHandler>(&mut self, mut event_handler: EventHandler)
|
||||
where EventHandler: FnMut(&xlib::XEvent) {
|
||||
let mut event: xlib::XEvent = unsafe{zeroed()};
|
||||
loop {
|
||||
unsafe{xlib::XNextEvent(self.display, &mut event)};
|
||||
match event.get_type() {
|
||||
xlib::ClientMessage => {
|
||||
let xclient: xlib::XClientMessageEvent = From::from(event);
|
||||
|
||||
// WM_PROTOCOLS client message
|
||||
if xclient.message_type == self.wm_protocols && xclient.format == 32 {
|
||||
let protocol = xclient.data.get_long(0) as xlib::Atom;
|
||||
|
||||
// WM_DELETE_WINDOW (close event)
|
||||
if protocol == self.wm_delete_window {
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
_ => event_handler(&event)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for DemoWindow {
|
||||
/// Destroys the window and disconnects from the display
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
xlib::XDestroyWindow(self.display, self.window);
|
||||
xlib::XCloseDisplay(self.display);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const TITLE: &'static str = "XInput Demo";
|
||||
const DEFAULT_WIDTH: c_uint = 640;
|
||||
const DEFAULT_HEIGHT: c_uint = 480;
|
||||
|
||||
#[derive(Debug)]
|
||||
enum AxisType {
|
||||
HorizontalScroll,
|
||||
VerticalScroll,
|
||||
Other
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Axis {
|
||||
id: i32,
|
||||
device_id: i32,
|
||||
axis_number: i32,
|
||||
axis_type: AxisType
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct AxisValue {
|
||||
device_id: i32,
|
||||
axis_number: i32,
|
||||
value: f64
|
||||
}
|
||||
|
||||
struct InputState {
|
||||
cursor_pos: (f64, f64),
|
||||
axis_values: Vec<AxisValue>
|
||||
}
|
||||
|
||||
fn read_input_axis_info(display: *mut xlib::Display) -> Vec<Axis> {
|
||||
let mut axis_list = Vec::new();
|
||||
let mut device_count = 0;
|
||||
|
||||
// only get events from the master devices which are 'attached'
|
||||
// to the keyboard or cursor
|
||||
let devices = unsafe{xinput2::XIQueryDevice(display, xinput2::XIAllMasterDevices, &mut device_count)};
|
||||
for i in 0..device_count {
|
||||
let device = unsafe { *(devices.offset(i as isize)) };
|
||||
for k in 0..device.num_classes {
|
||||
let class = unsafe { *(device.classes.offset(k as isize)) };
|
||||
match unsafe { (*class)._type } {
|
||||
xinput2::XIScrollClass => {
|
||||
let scroll_class: &xinput2::XIScrollClassInfo = unsafe{transmute(class)};
|
||||
axis_list.push(Axis{
|
||||
id: scroll_class.sourceid,
|
||||
device_id: device.deviceid,
|
||||
axis_number: scroll_class.number,
|
||||
axis_type: match scroll_class.scroll_type {
|
||||
xinput2::XIScrollTypeHorizontal => AxisType::HorizontalScroll,
|
||||
xinput2::XIScrollTypeVertical => AxisType::VerticalScroll,
|
||||
_ => { unreachable!() }
|
||||
}
|
||||
})
|
||||
},
|
||||
xinput2::XIValuatorClass => {
|
||||
let valuator_class: &xinput2::XIValuatorClassInfo = unsafe{transmute(class)};
|
||||
axis_list.push(Axis{
|
||||
id: valuator_class.sourceid,
|
||||
device_id: device.deviceid,
|
||||
axis_number: valuator_class.number,
|
||||
axis_type: AxisType::Other
|
||||
})
|
||||
},
|
||||
_ => { /* TODO */ }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
axis_list.sort_by(|a, b| {
|
||||
if a.device_id != b.device_id {
|
||||
a.device_id.cmp(&b.device_id)
|
||||
} else if a.id != b.id {
|
||||
a.id.cmp(&b.id)
|
||||
} else {
|
||||
a.axis_number.cmp(&b.axis_number)
|
||||
}
|
||||
});
|
||||
axis_list
|
||||
}
|
||||
|
||||
/// Given an input motion event for an axis and the previous
|
||||
/// state of the axises, return the horizontal/vertical
|
||||
/// scroll deltas
|
||||
fn calc_scroll_deltas(event: &xinput2::XIDeviceEvent,
|
||||
axis_id: i32,
|
||||
axis_value: f64,
|
||||
axis_list: &[Axis],
|
||||
prev_axis_values: &mut Vec<AxisValue>) -> (f64, f64) {
|
||||
let prev_value_pos = prev_axis_values.iter().position(|prev_axis| {
|
||||
prev_axis.device_id == event.sourceid &&
|
||||
prev_axis.axis_number == axis_id
|
||||
});
|
||||
let delta = match prev_value_pos {
|
||||
Some(idx) => axis_value - prev_axis_values[idx].value,
|
||||
None => 0.0
|
||||
};
|
||||
|
||||
let new_axis_value = AxisValue{
|
||||
device_id: event.sourceid,
|
||||
axis_number: axis_id,
|
||||
value: axis_value
|
||||
};
|
||||
|
||||
match prev_value_pos {
|
||||
Some(idx) => prev_axis_values[idx] = new_axis_value,
|
||||
None => prev_axis_values.push(new_axis_value)
|
||||
}
|
||||
|
||||
let mut scroll_delta = (0.0, 0.0);
|
||||
|
||||
for axis in axis_list.iter() {
|
||||
if axis.id == event.sourceid &&
|
||||
axis.axis_number == axis_id {
|
||||
match axis.axis_type {
|
||||
AxisType::HorizontalScroll => scroll_delta.0 = delta,
|
||||
AxisType::VerticalScroll => scroll_delta.1 = delta,
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scroll_delta
|
||||
}
|
||||
|
||||
#[cfg(not(all(feature = "xlib", feature = "xinput")))]
|
||||
fn main () {
|
||||
panic!("this example requires `--features 'xlib xinput'`");
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "xlib", feature = "xinput"))]
|
||||
fn main () {
|
||||
let mut demo_window = DemoWindow::new(TITLE, DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
||||
|
||||
// query XInput support
|
||||
let mut opcode: c_int = 0;
|
||||
let mut event: c_int = 0;
|
||||
let mut error: c_int = 0;
|
||||
let xinput_str = CString::new("XInputExtension").unwrap();
|
||||
let xinput_available = unsafe {
|
||||
xlib::XQueryExtension(demo_window.display, xinput_str.as_ptr(), &mut opcode, &mut event, &mut error)
|
||||
};
|
||||
if xinput_available == xlib::False {
|
||||
panic!("XInput not available")
|
||||
}
|
||||
|
||||
let mut xinput_major_ver = xinput2::XI_2_Major;
|
||||
let mut xinput_minor_ver = xinput2::XI_2_Minor;
|
||||
if unsafe{xinput2::XIQueryVersion(demo_window.display,
|
||||
&mut xinput_major_ver, &mut xinput_minor_ver)} != xlib::Success as c_int {
|
||||
panic!("XInput2 not available");
|
||||
}
|
||||
println!("XI version available {}.{}", xinput_major_ver, xinput_minor_ver);
|
||||
|
||||
// init XInput events
|
||||
let mut mask: [c_uchar; 1] = [0];
|
||||
let mut input_event_mask = xinput2::XIEventMask {
|
||||
deviceid: xinput2::XIAllMasterDevices,
|
||||
mask_len: mask.len() as i32,
|
||||
mask: mask.as_mut_ptr()
|
||||
};
|
||||
let events = &[
|
||||
xinput2::XI_ButtonPress,
|
||||
xinput2::XI_ButtonRelease,
|
||||
xinput2::XI_KeyPress,
|
||||
xinput2::XI_KeyRelease,
|
||||
xinput2::XI_Motion
|
||||
];
|
||||
for &event in events {
|
||||
xinput2::XISetMask(&mut mask, event);
|
||||
}
|
||||
|
||||
match unsafe{xinput2::XISelectEvents(demo_window.display,
|
||||
demo_window.window, &mut input_event_mask, 1)} {
|
||||
status if status as u8 == xlib::Success => (),
|
||||
err => panic!("Failed to select events {:?}", err)
|
||||
}
|
||||
|
||||
// Show window
|
||||
demo_window.show();
|
||||
|
||||
// Main loop
|
||||
let display = demo_window.display;
|
||||
let axis_list = read_input_axis_info(display);
|
||||
|
||||
let mut prev_state = InputState{
|
||||
cursor_pos: (0.0, 0.0),
|
||||
axis_values: Vec::new()
|
||||
};
|
||||
|
||||
demo_window.run_event_loop(|event| {
|
||||
match event.get_type() {
|
||||
xlib::GenericEvent => {
|
||||
let mut cookie: xlib::XGenericEventCookie = From::from(*event);
|
||||
if unsafe{xlib::XGetEventData(display, &mut cookie)} != xlib::True {
|
||||
println!("Failed to retrieve event data");
|
||||
return;
|
||||
}
|
||||
match cookie.evtype {
|
||||
xinput2::XI_KeyPress | xinput2::XI_KeyRelease => {
|
||||
let event_data: &xinput2::XIDeviceEvent = unsafe{transmute(cookie.data)};
|
||||
if cookie.evtype == xinput2::XI_KeyPress {
|
||||
if event_data.flags & xinput2::XIKeyRepeat == 0 {
|
||||
println!("Key {} pressed", event_data.detail);
|
||||
}
|
||||
} else {
|
||||
println!("Key {} released", event_data.detail);
|
||||
}
|
||||
},
|
||||
xinput2::XI_ButtonPress | xinput2::XI_ButtonRelease => {
|
||||
let event_data: &xinput2::XIDeviceEvent = unsafe{transmute(cookie.data)};
|
||||
if cookie.evtype == xinput2::XI_ButtonPress {
|
||||
println!("Button {} pressed", event_data.detail);
|
||||
} else {
|
||||
println!("Button {} released", event_data.detail);
|
||||
}
|
||||
},
|
||||
xinput2::XI_Motion => {
|
||||
let event_data: &xinput2::XIDeviceEvent = unsafe{transmute(cookie.data)};
|
||||
let axis_state = event_data.valuators;
|
||||
let mask = unsafe{ from_raw_parts(axis_state.mask, axis_state.mask_len as usize) };
|
||||
let mut axis_count = 0;
|
||||
|
||||
let mut scroll_delta = (0.0, 0.0);
|
||||
for axis_id in 0..axis_state.mask_len {
|
||||
if xinput2::XIMaskIsSet(&mask, axis_id) {
|
||||
let axis_value = unsafe{*axis_state.values.offset(axis_count)};
|
||||
let delta = calc_scroll_deltas(event_data, axis_id, axis_value, &axis_list, &mut prev_state.axis_values);
|
||||
scroll_delta.0 += delta.0;
|
||||
scroll_delta.1 += delta.1;
|
||||
axis_count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
if scroll_delta.0.abs() > 0.0 || scroll_delta.1.abs() > 0.0 {
|
||||
println!("Mouse wheel/trackpad scrolled by ({}, {})", scroll_delta.0, scroll_delta.1);
|
||||
}
|
||||
|
||||
let new_cursor_pos = (event_data.event_x, event_data.event_y);
|
||||
if new_cursor_pos != prev_state.cursor_pos {
|
||||
println!("Mouse moved to ({}, {})", new_cursor_pos.0, new_cursor_pos.1);
|
||||
prev_state.cursor_pos = new_cursor_pos;
|
||||
}
|
||||
},
|
||||
_ => ()
|
||||
}
|
||||
unsafe{xlib::XFreeEventData(display, &mut cookie)};
|
||||
},
|
||||
_ => ()
|
||||
}
|
||||
});
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
// Example for X Record Extension
|
||||
|
||||
#![cfg_attr(not(feature = "xlib"), allow(dead_code))]
|
||||
#![cfg_attr(not(feature = "xlib"), allow(unused_imports))]
|
||||
|
||||
extern crate libc;
|
||||
extern crate x11;
|
||||
|
||||
use std::ffi::CString;
|
||||
use std::ptr::{
|
||||
null,
|
||||
null_mut,
|
||||
};
|
||||
|
||||
use std::os::raw::{
|
||||
c_int
|
||||
};
|
||||
use x11::xlib;
|
||||
use x11::xrecord;
|
||||
|
||||
static mut EVENT_COUNT:u32 = 0;
|
||||
|
||||
#[cfg(not(all(feature = "xlib", feature = "xrecord")))]
|
||||
fn main () {
|
||||
panic!("this example requires `--features 'xlib xrecord'`");
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "xlib", feature = "xrecord"))]
|
||||
fn main () {
|
||||
unsafe {
|
||||
// Open displays
|
||||
let dpy_control = xlib::XOpenDisplay(null());
|
||||
let dpy_data = xlib::XOpenDisplay(null());
|
||||
if dpy_control == null_mut() || dpy_data == null_mut() {
|
||||
panic!("can't open display");
|
||||
}
|
||||
// Enable synchronization
|
||||
xlib::XSynchronize(dpy_control, 1);
|
||||
|
||||
let extension_name = CString::new("RECORD").unwrap();
|
||||
|
||||
let extension = xlib::XInitExtension(
|
||||
dpy_control,
|
||||
extension_name.as_ptr());
|
||||
if extension.is_null() {
|
||||
panic!("Error init X Record Extension");
|
||||
}
|
||||
|
||||
// Get version
|
||||
let mut version_major: c_int = 0;
|
||||
let mut version_minor: c_int = 0;
|
||||
xrecord::XRecordQueryVersion(
|
||||
dpy_control,
|
||||
&mut version_major,
|
||||
&mut version_minor
|
||||
);
|
||||
println!(
|
||||
"RECORD extension version {}.{}",
|
||||
version_major,
|
||||
version_minor
|
||||
);
|
||||
|
||||
// Prepare record range
|
||||
let mut record_range: xrecord::XRecordRange = *xrecord::XRecordAllocRange();
|
||||
record_range.device_events.first = xlib::KeyPress as u8;
|
||||
record_range.device_events.last = xlib::MotionNotify as u8;
|
||||
|
||||
// Create context
|
||||
let context = xrecord::XRecordCreateContext(
|
||||
dpy_control,
|
||||
0,
|
||||
&mut xrecord::XRecordAllClients,
|
||||
1,
|
||||
std::mem::transmute(&mut &mut record_range),
|
||||
1
|
||||
);
|
||||
|
||||
if context == 0 {
|
||||
panic!("Fail create Record context\n");
|
||||
}
|
||||
|
||||
// Run
|
||||
let result = xrecord::XRecordEnableContext(
|
||||
dpy_data,
|
||||
context,
|
||||
Some(record_callback),
|
||||
&mut 0
|
||||
);
|
||||
if result == 0 {
|
||||
panic!("Cound not enable the Record context!\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe extern "C" fn record_callback(_:*mut i8, raw_data: *mut xrecord::XRecordInterceptData) {
|
||||
EVENT_COUNT += 1;
|
||||
let data = &*raw_data;
|
||||
|
||||
// Skip server events
|
||||
if data.category != xrecord::XRecordFromServer {
|
||||
return;
|
||||
}
|
||||
|
||||
// Cast binary data
|
||||
let xdatum = &*(data.data as *mut XRecordDatum);
|
||||
|
||||
let event_type = match xdatum.xtype as i32 {
|
||||
xlib::KeyPress => "KeyPress",
|
||||
xlib::KeyRelease => "KeyRelease",
|
||||
xlib::ButtonPress => "ButtonPress",
|
||||
xlib::ButtonRelease => "ButtonRelease",
|
||||
xlib::MotionNotify => "MotionNotify",
|
||||
_ => "Other"
|
||||
};
|
||||
|
||||
println!("Event recieve\t{:?}\tevent.", event_type);
|
||||
|
||||
xrecord::XRecordFreeData(raw_data);
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
struct XRecordDatum {
|
||||
xtype: u8,
|
||||
code: u8,
|
||||
unknown1: u8,
|
||||
unknown2: u8
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
// x11-rs: Rust bindings for X11 libraries
|
||||
// The X11 libraries are available under the MIT license.
|
||||
// These bindings are public domain.
|
||||
|
||||
use std::os::raw::{ c_int };
|
||||
|
||||
use xlib::{ Display, Status, Bool };
|
||||
use xmd::{ CARD16, BOOL };
|
||||
|
||||
|
||||
//
|
||||
// functions
|
||||
//
|
||||
|
||||
|
||||
x11_link! { Xext, xext, ["libXext.so.6", "libXext.so"], 9,
|
||||
pub fn DPMSQueryExtension (_1: *mut Display, _2: *mut c_int, _3: *mut c_int) -> Bool,
|
||||
pub fn DPMSGetVersion (_1: *mut Display, _2: *mut c_int, _3: *mut c_int) -> Status,
|
||||
pub fn DPMSCapable (_1: *mut Display) -> Bool,
|
||||
pub fn DPMSSetTimeouts (_1: *mut Display, _2: CARD16, _3: CARD16, _4: CARD16) -> Status,
|
||||
pub fn DPMSGetTimeouts (_1: *mut Display, _2: *mut CARD16, _3: *mut CARD16, _4: *mut CARD16) -> Bool,
|
||||
pub fn DPMSEnable (_1: *mut Display) -> Status,
|
||||
pub fn DPMSDisable (_1: *mut Display) -> Status,
|
||||
pub fn DPMSForceLevel (_1: *mut Display, _2: CARD16) -> Status,
|
||||
pub fn DPMSInfo (_1: *mut Display, _2: *mut CARD16, _3: *mut BOOL) -> Status,
|
||||
variadic:
|
||||
globals:
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// constants
|
||||
//
|
||||
|
||||
|
||||
pub const DPMSMajorVersion: c_int = 1;
|
||||
pub const DPMSMinorVersion: c_int = 1;
|
||||
|
||||
pub const DPMSExtensionName: &'static str = "DPMS";
|
||||
|
||||
pub const DPMSModeOn: CARD16 = 0;
|
||||
pub const DPMSModeStandby: CARD16 = 1;
|
||||
pub const DPMSModeSuspend: CARD16 = 2;
|
||||
pub const DPMSModeOff: CARD16 = 3;
|
|
@ -1,249 +0,0 @@
|
|||
// x11-rs: Rust bindings for X11 libraries
|
||||
// The X11 libraries are available under the MIT license.
|
||||
// These bindings are public domain.
|
||||
|
||||
use std::os::raw::{
|
||||
c_char,
|
||||
c_int,
|
||||
c_uchar,
|
||||
c_uint,
|
||||
c_ulong,
|
||||
};
|
||||
|
||||
use ::xlib::{
|
||||
Display,
|
||||
XID,
|
||||
XVisualInfo,
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// functions
|
||||
//
|
||||
|
||||
|
||||
x11_link! { Glx, gl, ["libGL.so.1", "libGL.so"], 40,
|
||||
pub fn glXChooseFBConfig (_4: *mut Display, _3: c_int, _2: *const c_int, _1: *mut c_int) -> *mut GLXFBConfig,
|
||||
pub fn glXChooseVisual (_3: *mut Display, _2: c_int, _1: *mut c_int) -> *mut XVisualInfo,
|
||||
pub fn glXCopyContext (_4: *mut Display, _3: GLXContext, _2: GLXContext, _1: c_ulong) -> (),
|
||||
pub fn glXCreateContext (_4: *mut Display, _3: *mut XVisualInfo, _2: GLXContext, _1: c_int) -> GLXContext,
|
||||
pub fn glXCreateGLXPixmap (_3: *mut Display, _2: *mut XVisualInfo, _1: c_ulong) -> c_ulong,
|
||||
pub fn glXCreateNewContext (_5: *mut Display, _4: GLXFBConfig, _3: c_int, _2: GLXContext, _1: c_int) -> GLXContext,
|
||||
pub fn glXCreatePbuffer (_3: *mut Display, _2: GLXFBConfig, _1: *const c_int) -> c_ulong,
|
||||
pub fn glXCreatePixmap (_4: *mut Display, _3: GLXFBConfig, _2: c_ulong, _1: *const c_int) -> c_ulong,
|
||||
pub fn glXCreateWindow (_4: *mut Display, _3: GLXFBConfig, _2: c_ulong, _1: *const c_int) -> c_ulong,
|
||||
pub fn glXDestroyContext (_2: *mut Display, _1: GLXContext) -> (),
|
||||
pub fn glXDestroyGLXPixmap (_2: *mut Display, _1: c_ulong) -> (),
|
||||
pub fn glXDestroyPbuffer (_2: *mut Display, _1: c_ulong) -> (),
|
||||
pub fn glXDestroyPixmap (_2: *mut Display, _1: c_ulong) -> (),
|
||||
pub fn glXDestroyWindow (_2: *mut Display, _1: c_ulong) -> (),
|
||||
pub fn glXGetClientString (_2: *mut Display, _1: c_int) -> *const c_char,
|
||||
pub fn glXGetConfig (_4: *mut Display, _3: *mut XVisualInfo, _2: c_int, _1: *mut c_int) -> c_int,
|
||||
pub fn glXGetCurrentContext () -> GLXContext,
|
||||
pub fn glXGetCurrentDisplay () -> *mut Display,
|
||||
pub fn glXGetCurrentDrawable () -> c_ulong,
|
||||
pub fn glXGetCurrentReadDrawable () -> c_ulong,
|
||||
pub fn glXGetFBConfigAttrib (_4: *mut Display, _3: GLXFBConfig, _2: c_int, _1: *mut c_int) -> c_int,
|
||||
pub fn glXGetFBConfigs (_3: *mut Display, _2: c_int, _1: *mut c_int) -> *mut GLXFBConfig,
|
||||
pub fn glXGetProcAddress (_1: *const c_uchar) -> Option<unsafe extern "C" fn ()>,
|
||||
pub fn glXGetProcAddressARB (_1: *const c_uchar) -> Option<unsafe extern "C" fn ()>,
|
||||
pub fn glXGetSelectedEvent (_3: *mut Display, _2: c_ulong, _1: *mut c_ulong) -> (),
|
||||
pub fn glXGetVisualFromFBConfig (_2: *mut Display, _1: GLXFBConfig) -> *mut XVisualInfo,
|
||||
pub fn glXIsDirect (_2: *mut Display, _1: GLXContext) -> c_int,
|
||||
pub fn glXMakeContextCurrent (_4: *mut Display, _3: c_ulong, _2: c_ulong, _1: GLXContext) -> c_int,
|
||||
pub fn glXMakeCurrent (_3: *mut Display, _2: c_ulong, _1: GLXContext) -> c_int,
|
||||
pub fn glXQueryContext (_4: *mut Display, _3: GLXContext, _2: c_int, _1: *mut c_int) -> c_int,
|
||||
pub fn glXQueryDrawable (_4: *mut Display, _3: c_ulong, _2: c_int, _1: *mut c_uint) -> (),
|
||||
pub fn glXQueryExtension (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> c_int,
|
||||
pub fn glXQueryExtensionsString (_2: *mut Display, _1: c_int) -> *const c_char,
|
||||
pub fn glXQueryServerString (_3: *mut Display, _2: c_int, _1: c_int) -> *const c_char,
|
||||
pub fn glXQueryVersion (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> c_int,
|
||||
pub fn glXSelectEvent (_3: *mut Display, _2: c_ulong, _1: c_ulong) -> (),
|
||||
pub fn glXSwapBuffers (_2: *mut Display, _1: c_ulong) -> (),
|
||||
pub fn glXUseXFont (_4: c_ulong, _3: c_int, _2: c_int, _1: c_int) -> (),
|
||||
pub fn glXWaitGL () -> (),
|
||||
pub fn glXWaitX () -> (),
|
||||
variadic:
|
||||
globals:
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// types
|
||||
//
|
||||
|
||||
|
||||
// opaque structures
|
||||
#[repr(C)] pub struct __GLXcontextRec;
|
||||
#[repr(C)] pub struct __GLXFBConfigRec;
|
||||
|
||||
// types
|
||||
pub type GLXContext = *mut __GLXcontextRec;
|
||||
pub type GLXContextID = XID;
|
||||
pub type GLXDrawable = XID;
|
||||
pub type GLXFBConfig = *mut __GLXFBConfigRec;
|
||||
pub type GLXFBConfigID = XID;
|
||||
pub type GLXPbuffer = XID;
|
||||
pub type GLXPixmap = XID;
|
||||
pub type GLXWindow = XID;
|
||||
|
||||
|
||||
//
|
||||
// constants
|
||||
//
|
||||
|
||||
|
||||
// config caveats
|
||||
pub const GLX_SLOW_CONFIG: c_int = 0x8001;
|
||||
pub const GLX_NON_CONFORMANT_CONFIG: c_int = 0x800d;
|
||||
|
||||
// drawable type mask
|
||||
pub const GLX_WINDOW_BIT: c_int = 0x0001;
|
||||
pub const GLX_PIXMAP_BIT: c_int = 0x0002;
|
||||
pub const GLX_PBUFFER_BIT: c_int = 0x0004;
|
||||
|
||||
// framebuffer attributes
|
||||
pub const GLX_USE_GL: c_int = 0x0001;
|
||||
pub const GLX_BUFFER_SIZE: c_int = 0x0002;
|
||||
pub const GLX_LEVEL: c_int = 0x0003;
|
||||
pub const GLX_RGBA: c_int = 0x0004;
|
||||
pub const GLX_DOUBLEBUFFER: c_int = 0x0005;
|
||||
pub const GLX_STEREO: c_int = 0x0006;
|
||||
pub const GLX_AUX_BUFFERS: c_int = 0x0007;
|
||||
pub const GLX_RED_SIZE: c_int = 0x0008;
|
||||
pub const GLX_GREEN_SIZE: c_int = 0x0009;
|
||||
pub const GLX_BLUE_SIZE: c_int = 0x000a;
|
||||
pub const GLX_ALPHA_SIZE: c_int = 0x000b;
|
||||
pub const GLX_DEPTH_SIZE: c_int = 0x000c;
|
||||
pub const GLX_STENCIL_SIZE: c_int = 0x000d;
|
||||
pub const GLX_ACCUM_RED_SIZE: c_int = 0x000e;
|
||||
pub const GLX_ACCUM_GREEN_SIZE: c_int = 0x000f;
|
||||
pub const GLX_ACCUM_BLUE_SIZE: c_int = 0x0010;
|
||||
pub const GLX_ACCUM_ALPHA_SIZE: c_int = 0x0011;
|
||||
pub const GLX_CONFIG_CAVEAT: c_int = 0x0020;
|
||||
pub const GLX_X_VISUAL_TYPE: c_int = 0x0022;
|
||||
pub const GLX_TRANSPARENT_TYPE: c_int = 0x0023;
|
||||
pub const GLX_TRANSPARENT_INDEX_VALUE: c_int = 0x0024;
|
||||
pub const GLX_TRANSPARENT_RED_VALUE: c_int = 0x0025;
|
||||
pub const GLX_TRANSPARENT_GREEN_VALUE: c_int = 0x0026;
|
||||
pub const GLX_TRANSPARENT_BLUE_VALUE: c_int = 0x0027;
|
||||
pub const GLX_TRANSPARENT_ALPHA_VALUE: c_int = 0x0028;
|
||||
pub const GLX_VISUAL_ID: c_int = 0x800B;
|
||||
pub const GLX_SCREEN: c_int = 0x800C;
|
||||
pub const GLX_DRAWABLE_TYPE: c_int = 0x8010;
|
||||
pub const GLX_RENDER_TYPE: c_int = 0x8011;
|
||||
pub const GLX_X_RENDERABLE: c_int = 0x8012;
|
||||
pub const GLX_FBCONFIG_ID: c_int = 0x8013;
|
||||
pub const GLX_MAX_PBUFFER_WIDTH: c_int = 0x8016;
|
||||
pub const GLX_MAX_PBUFFER_HEIGHT: c_int = 0x8017;
|
||||
pub const GLX_MAX_PBUFFER_PIXELS: c_int = 0x8018;
|
||||
pub const GLX_SAMPLE_BUFFERS: c_int = 0x1_86a0;
|
||||
pub const GLX_SAMPLES: c_int = 0x1_86a1;
|
||||
|
||||
// misc
|
||||
pub const GLX_DONT_CARE: c_int = -1;
|
||||
pub const GLX_NONE: c_int = 0x8000;
|
||||
|
||||
// render type mask
|
||||
pub const GLX_RGBA_BIT: c_int = 0x0001;
|
||||
pub const GLX_COLOR_INDEX_BIT: c_int = 0x0002;
|
||||
|
||||
// transparent types
|
||||
pub const GLX_TRANSPARENT_RGB: c_int = 0x8008;
|
||||
pub const GLX_TRANSPARENT_INDEX: c_int = 0x8009;
|
||||
|
||||
// visual types
|
||||
pub const GLX_TRUE_COLOR: c_int = 0x8002;
|
||||
pub const GLX_DIRECT_COLOR: c_int = 0x8003;
|
||||
pub const GLX_PSEUDO_COLOR: c_int = 0x8004;
|
||||
pub const GLX_STATIC_COLOR: c_int = 0x8005;
|
||||
pub const GLX_GRAY_SCALE: c_int = 0x8006;
|
||||
pub const GLX_STATIC_GRAY: c_int = 0x8007;
|
||||
|
||||
// glXGetConfig errors
|
||||
pub const GLX_BAD_SCREEN: c_int = 1;
|
||||
pub const GLX_BAD_ATTRIBUTE: c_int = 2;
|
||||
pub const GLX_NO_EXTENSION: c_int = 3;
|
||||
pub const GLX_BAD_VISUAL: c_int = 4;
|
||||
pub const GLX_BAD_CONTEXT: c_int = 5;
|
||||
pub const GLX_BAD_VALUE: c_int = 6;
|
||||
pub const GLX_BAD_ENUM: c_int = 7;
|
||||
|
||||
// glXGetClientString names
|
||||
pub const GLX_VENDOR: c_int = 1;
|
||||
pub const GLX_VERSION: c_int = 2;
|
||||
pub const GLX_EXTENSIONS: c_int = 3;
|
||||
|
||||
// drawable type mask?
|
||||
pub const GLX_FRONT_LEFT_BUFFER_BIT: c_uint = 0x0001;
|
||||
pub const GLX_FRONT_RIGHT_BUFFER_BIT: c_uint = 0x0002;
|
||||
pub const GLX_BACK_LEFT_BUFFER_BIT: c_uint = 0x0004;
|
||||
pub const GLX_BACK_RIGHT_BUFFER_BIT: c_uint = 0x0008;
|
||||
pub const GLX_AUX_BUFFERS_BIT: c_uint = 0x0010;
|
||||
pub const GLX_DEPTH_BUFFER_BIT: c_uint = 0x0020;
|
||||
pub const GLX_STENCIL_BUFFER_BIT: c_uint = 0x0040;
|
||||
pub const GLX_ACCUM_BUFFER_BIT: c_uint = 0080;
|
||||
|
||||
// render type for glXCreateNewContext
|
||||
pub const GLX_RGBA_TYPE: c_int = 0x8014;
|
||||
pub const GLX_COLOR_INDEX_TYPE: c_int = 0x8015;
|
||||
|
||||
// drawable attributes
|
||||
pub const GLX_PRESERVED_CONTENTS: c_int = 0x801B;
|
||||
pub const GLX_LARGEST_PBUFFER: c_int = 0x801C;
|
||||
pub const GLX_WIDTH: c_int = 0x801D;
|
||||
pub const GLX_HEIGHT: c_int = 0x801E;
|
||||
pub const GLX_PBUFFER_HEIGHT: c_int = 0x8040;
|
||||
pub const GLX_PBUFFER_WIDTH: c_int = 0x8041;
|
||||
|
||||
// other?
|
||||
pub const GLX_EVENT_MASK: c_int = 0x801F;
|
||||
|
||||
// event mask
|
||||
pub const GLX_PBUFFER_CLOBBER_MASK: c_ulong = 0x0800_0000;
|
||||
|
||||
// event types
|
||||
pub const GLX_DAMAGED: c_int = 0x8020;
|
||||
pub const GLX_SAVED: c_int = 0x8021;
|
||||
|
||||
// drawable types
|
||||
pub const GLX_WINDOW: c_int = 0x8022;
|
||||
pub const GLX_PBUFFER: c_int = 0x8023;
|
||||
|
||||
|
||||
//
|
||||
// ARB extensions
|
||||
//
|
||||
|
||||
|
||||
pub mod arb {
|
||||
use std::os::raw::c_int;
|
||||
|
||||
// context attributes
|
||||
pub const GLX_CONTEXT_MAJOR_VERSION_ARB: c_int = 0x2091;
|
||||
pub const GLX_CONTEXT_MINOR_VERSION_ARB: c_int = 0x2092;
|
||||
pub const GLX_CONTEXT_FLAGS_ARB: c_int = 0x2094;
|
||||
pub const GLX_CONTEXT_PROFILE_MASK_ARB: c_int = 0x9126;
|
||||
|
||||
// context flags
|
||||
pub const GLX_CONTEXT_DEBUG_BIT_ARB: c_int = 0x0001;
|
||||
pub const GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB: c_int = 0x0002;
|
||||
|
||||
// context profile mask
|
||||
pub const GLX_CONTEXT_CORE_PROFILE_BIT_ARB: c_int = 0x0001;
|
||||
pub const GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB: c_int = 0x0002;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// EXT extensions
|
||||
//
|
||||
|
||||
|
||||
pub mod ext {
|
||||
use std::os::raw::c_int;
|
||||
|
||||
// drawable attributes
|
||||
pub const GLX_SWAP_INTERVAL_EXT: c_int = 0x20f1;
|
||||
pub const GLX_MAX_SWAP_INTERVAL_EXT: c_int = 0x20f2;
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
// x11-rs: Rust bindings for X11 libraries
|
||||
// The X11 libraries are available under the MIT license.
|
||||
// These bindings are public domain.
|
||||
|
||||
use std::cmp::min;
|
||||
use std::mem::{
|
||||
size_of,
|
||||
zeroed,
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// public functions
|
||||
//
|
||||
|
||||
|
||||
pub unsafe fn mem_eq<T: Sized> (a: &T, b: &T) -> bool {
|
||||
let a_addr = a as *const T as usize;
|
||||
let b_addr = b as *const T as usize;
|
||||
|
||||
for i in 0..size_of::<T>() {
|
||||
if *((a_addr + i) as *const u8) != *((b_addr + i) as *const u8) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
pub unsafe fn transmute_union<I, O> (input: &I) -> O
|
||||
where I : Sized, O : Sized
|
||||
{
|
||||
let mut output: O = zeroed();
|
||||
let copy_len = min(size_of::<I>(), size_of::<O>());
|
||||
|
||||
for i in 0..copy_len {
|
||||
*((&mut output as *mut O as usize + i) as *mut u8) = *((input as *const I as usize + i) as *const u8);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,37 +0,0 @@
|
|||
// x11-rs: Rust bindings for X11 libraries
|
||||
// The X11 libraries are available under the MIT license.
|
||||
// These bindings are public domain.
|
||||
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
#![allow(non_upper_case_globals)]
|
||||
#![allow(improper_ctypes)]
|
||||
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
mod link;
|
||||
mod internal;
|
||||
|
||||
#[macro_use]
|
||||
pub mod xlib;
|
||||
|
||||
pub mod dpms;
|
||||
pub mod glx;
|
||||
pub mod keysym;
|
||||
pub mod xcursor;
|
||||
pub mod xf86vmode;
|
||||
pub mod xfixes;
|
||||
pub mod xft;
|
||||
pub mod xinerama;
|
||||
pub mod xinput;
|
||||
pub mod xinput2;
|
||||
pub mod xmd;
|
||||
pub mod xmu;
|
||||
pub mod xrandr;
|
||||
pub mod xrecord;
|
||||
pub mod xrender;
|
||||
pub mod xss;
|
||||
pub mod xt;
|
||||
pub mod xtest;
|
||||
pub mod xlib_xcb;
|
|
@ -1,22 +0,0 @@
|
|||
// x11-rs: Rust bindings for X11 libraries
|
||||
// The X11 libraries are available under the MIT license.
|
||||
// These bindings are public domain.
|
||||
|
||||
macro_rules! x11_link {
|
||||
{ $struct_name:ident, $pkg_name:expr, [$($lib_name:expr),*], $nsyms:expr,
|
||||
$(pub fn $fn_name:ident ($($param_name:ident : $param_type:ty),*) -> $ret_type:ty,)*
|
||||
variadic:
|
||||
$(pub fn $vfn_name:ident ($($vparam_name: ident : $vparam_type:ty),+) -> $vret_type:ty,)*
|
||||
globals:
|
||||
$(pub static $var_name:ident : $var_type:ty,)*
|
||||
} => {
|
||||
extern "C" {
|
||||
$(pub fn $fn_name ($($param_name : $param_type),*) -> $ret_type;)*
|
||||
$(pub fn $vfn_name ($($vparam_name : $vparam_type),+, ...) -> $vret_type;)*
|
||||
}
|
||||
|
||||
extern {
|
||||
$(pub static $var_name : $var_type;)*
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,211 +0,0 @@
|
|||
// x11-rs: Rust bindings for X11 libraries
|
||||
// The X11 libraries are available under the MIT license.
|
||||
// These bindings are public domain.
|
||||
|
||||
use std::os::raw::{
|
||||
c_char,
|
||||
c_int,
|
||||
c_long,
|
||||
c_uchar,
|
||||
c_uint,
|
||||
c_ulong,
|
||||
c_void,
|
||||
};
|
||||
use libc::FILE;
|
||||
|
||||
use ::xlib::{
|
||||
Cursor,
|
||||
Display,
|
||||
XColor,
|
||||
XImage,
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// functions
|
||||
//
|
||||
|
||||
|
||||
x11_link! { Xcursor, xcursor, ["libXcursor.so.1", "libXcursor.so"], 59,
|
||||
pub fn XcursorAnimateCreate (_1: *mut XcursorCursors) -> *mut XcursorAnimate,
|
||||
pub fn XcursorAnimateDestroy (_1: *mut XcursorAnimate) -> (),
|
||||
pub fn XcursorAnimateNext (_1: *mut XcursorAnimate) -> c_ulong,
|
||||
pub fn XcursorCommentCreate (_2: c_uint, _1: c_int) -> *mut XcursorComment,
|
||||
pub fn XcursorCommentDestroy (_1: *mut XcursorComment) -> (),
|
||||
pub fn XcursorCommentsCreate (_1: c_int) -> *mut XcursorComments,
|
||||
pub fn XcursorCommentsDestroy (_1: *mut XcursorComments) -> (),
|
||||
pub fn XcursorCursorsCreate (_2: *mut Display, _1: c_int) -> *mut XcursorCursors,
|
||||
pub fn XcursorCursorsDestroy (_1: *mut XcursorCursors) -> (),
|
||||
pub fn XcursorFileLoad (_3: *mut FILE, _2: *mut *mut XcursorComments, _1: *mut *mut XcursorImages) -> c_int,
|
||||
pub fn XcursorFileLoadAllImages (_1: *mut FILE) -> *mut XcursorImages,
|
||||
pub fn XcursorFileLoadImage (_2: *mut FILE, _1: c_int) -> *mut XcursorImage,
|
||||
pub fn XcursorFileLoadImages (_2: *mut FILE, _1: c_int) -> *mut XcursorImages,
|
||||
pub fn XcursorFilenameLoad (_3: *const c_char, _2: *mut *mut XcursorComments, _1: *mut *mut XcursorImages) -> c_int,
|
||||
pub fn XcursorFilenameLoadAllImages (_1: *const c_char) -> *mut XcursorImages,
|
||||
pub fn XcursorFilenameLoadCursor (_2: *mut Display, _1: *const c_char) -> c_ulong,
|
||||
pub fn XcursorFilenameLoadCursors (_2: *mut Display, _1: *const c_char) -> *mut XcursorCursors,
|
||||
pub fn XcursorFilenameLoadImage (_2: *const c_char, _1: c_int) -> *mut XcursorImage,
|
||||
pub fn XcursorFilenameLoadImages (_2: *const c_char, _1: c_int) -> *mut XcursorImages,
|
||||
pub fn XcursorFilenameSave (_3: *const c_char, _2: *const XcursorComments, _1: *const XcursorImages) -> c_int,
|
||||
pub fn XcursorFilenameSaveImages (_2: *const c_char, _1: *const XcursorImages) -> c_int,
|
||||
pub fn XcursorFileSave (_3: *mut FILE, _2: *const XcursorComments, _1: *const XcursorImages) -> c_int,
|
||||
pub fn XcursorFileSaveImages (_2: *mut FILE, _1: *const XcursorImages) -> c_int,
|
||||
pub fn XcursorGetDefaultSize (_1: *mut Display) -> c_int,
|
||||
pub fn XcursorGetTheme (_1: *mut Display) -> *mut c_char,
|
||||
pub fn XcursorGetThemeCore (_1: *mut Display) -> c_int,
|
||||
pub fn XcursorImageCreate (_2: c_int, _1: c_int) -> *mut XcursorImage,
|
||||
pub fn XcursorImageDestroy (_1: *mut XcursorImage) -> (),
|
||||
pub fn XcursorImageHash (_2: *mut XImage, _1: *mut c_uchar) -> (),
|
||||
pub fn XcursorImageLoadCursor (_2: *mut Display, _1: *const XcursorImage) -> c_ulong,
|
||||
pub fn XcursorImagesCreate (_1: c_int) -> *mut XcursorImages,
|
||||
pub fn XcursorImagesDestroy (_1: *mut XcursorImages) -> (),
|
||||
pub fn XcursorImagesLoadCursor (_2: *mut Display, _1: *const XcursorImages) -> c_ulong,
|
||||
pub fn XcursorImagesLoadCursors (_2: *mut Display, _1: *const XcursorImages) -> *mut XcursorCursors,
|
||||
pub fn XcursorImagesSetName (_2: *mut XcursorImages, _1: *const c_char) -> (),
|
||||
pub fn XcursorLibraryLoadCursor (_2: *mut Display, _1: *const c_char) -> c_ulong,
|
||||
pub fn XcursorLibraryLoadCursors (_2: *mut Display, _1: *const c_char) -> *mut XcursorCursors,
|
||||
pub fn XcursorLibraryLoadImage (_3: *const c_char, _2: *const c_char, _1: c_int) -> *mut XcursorImage,
|
||||
pub fn XcursorLibraryLoadImages (_3: *const c_char, _2: *const c_char, _1: c_int) -> *mut XcursorImages,
|
||||
pub fn XcursorLibraryPath () -> *const c_char,
|
||||
pub fn XcursorLibraryShape (_1: *const c_char) -> c_int,
|
||||
pub fn XcursorNoticeCreateBitmap (_4: *mut Display, _3: c_ulong, _2: c_uint, _1: c_uint) -> (),
|
||||
pub fn XcursorNoticePutBitmap (_3: *mut Display, _2: c_ulong, _1: *mut XImage) -> (),
|
||||
pub fn XcursorSetDefaultSize (_2: *mut Display, _1: c_int) -> c_int,
|
||||
pub fn XcursorSetTheme (_2: *mut Display, _1: *const c_char) -> c_int,
|
||||
pub fn XcursorSetThemeCore (_2: *mut Display, _1: c_int) -> c_int,
|
||||
pub fn XcursorShapeLoadCursor (_2: *mut Display, _1: c_uint) -> c_ulong,
|
||||
pub fn XcursorShapeLoadCursors (_2: *mut Display, _1: c_uint) -> *mut XcursorCursors,
|
||||
pub fn XcursorShapeLoadImage (_3: c_uint, _2: *const c_char, _1: c_int) -> *mut XcursorImage,
|
||||
pub fn XcursorShapeLoadImages (_3: c_uint, _2: *const c_char, _1: c_int) -> *mut XcursorImages,
|
||||
pub fn XcursorSupportsAnim (_1: *mut Display) -> c_int,
|
||||
pub fn XcursorSupportsARGB (_1: *mut Display) -> c_int,
|
||||
pub fn XcursorTryShapeBitmapCursor (_7: *mut Display, _6: c_ulong, _5: c_ulong, _4: *mut XColor, _3: *mut XColor, _2: c_uint, _1: c_uint) -> c_ulong,
|
||||
pub fn XcursorTryShapeCursor (_7: *mut Display, _6: c_ulong, _5: c_ulong, _4: c_uint, _3: c_uint, _2: *const XColor, _1: *const XColor) -> c_ulong,
|
||||
pub fn XcursorXcFileLoad (_3: *mut XcursorFile, _2: *mut *mut XcursorComments, _1: *mut *mut XcursorImages) -> c_int,
|
||||
pub fn XcursorXcFileLoadAllImages (_1: *mut XcursorFile) -> *mut XcursorImages,
|
||||
pub fn XcursorXcFileLoadImage (_2: *mut XcursorFile, _1: c_int) -> *mut XcursorImage,
|
||||
pub fn XcursorXcFileLoadImages (_2: *mut XcursorFile, _1: c_int) -> *mut XcursorImages,
|
||||
pub fn XcursorXcFileSave (_3: *mut XcursorFile, _2: *const XcursorComments, _1: *const XcursorImages) -> c_int,
|
||||
variadic:
|
||||
globals:
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// types
|
||||
//
|
||||
|
||||
|
||||
pub type XcursorBool = c_int;
|
||||
pub type XcursorDim = XcursorUInt;
|
||||
pub type XcursorPixel = XcursorUInt;
|
||||
pub type XcursorUInt = c_uint;
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[repr(C)]
|
||||
pub struct _XcursorAnimate {
|
||||
pub cursors: *mut XcursorCursors,
|
||||
pub sequence: c_int,
|
||||
}
|
||||
pub type XcursorAnimate = _XcursorAnimate;
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[repr(C)]
|
||||
pub struct _XcursorChunkHeader {
|
||||
pub header: XcursorUInt,
|
||||
pub type_: XcursorUInt,
|
||||
pub subtype: XcursorUInt,
|
||||
pub version: XcursorUInt,
|
||||
}
|
||||
pub type XcursorChunkHeader = _XcursorChunkHeader;
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[repr(C)]
|
||||
pub struct _XcursorComment {
|
||||
pub version: XcursorUInt,
|
||||
pub comment_type: XcursorUInt,
|
||||
pub comment: *mut c_char,
|
||||
}
|
||||
pub type XcursorComment = _XcursorComment;
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[repr(C)]
|
||||
pub struct _XcursorComments {
|
||||
pub ncomment: c_int,
|
||||
pub comments: *mut *mut XcursorComment,
|
||||
}
|
||||
pub type XcursorComments = _XcursorComments;
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[repr(C)]
|
||||
pub struct _XcursorCursors {
|
||||
pub dpy: *mut Display,
|
||||
pub ref_: c_int,
|
||||
pub ncursor: c_int,
|
||||
pub cursors: *mut Cursor,
|
||||
}
|
||||
pub type XcursorCursors = _XcursorCursors;
|
||||
|
||||
#[derive(Debug, Copy)]
|
||||
#[repr(C)]
|
||||
pub struct _XcursorFile {
|
||||
pub closure: *mut c_void,
|
||||
pub read: Option<unsafe extern "C" fn (*mut XcursorFile, *mut c_uchar, c_int) -> c_int>,
|
||||
pub write: Option<unsafe extern "C" fn (*mut XcursorFile, *mut c_uchar, c_int) -> c_int>,
|
||||
pub seek: Option<unsafe extern "C" fn (*mut XcursorFile, c_long, c_int) -> c_int>,
|
||||
}
|
||||
pub type XcursorFile = _XcursorFile;
|
||||
|
||||
impl Clone for _XcursorFile {
|
||||
fn clone (&self) -> _XcursorFile {
|
||||
_XcursorFile {
|
||||
closure: self.closure,
|
||||
read: self.read,
|
||||
write: self.write,
|
||||
seek: self.seek,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[repr(C)]
|
||||
pub struct _XcursorFileHeader {
|
||||
pub magic: XcursorUInt,
|
||||
pub header: XcursorUInt,
|
||||
pub version: XcursorUInt,
|
||||
pub ntoc: XcursorUInt,
|
||||
pub tocs: *mut XcursorFileToc,
|
||||
}
|
||||
pub type XcursorFileHeader = _XcursorFileHeader;
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[repr(C)]
|
||||
pub struct _XcursorFileToc {
|
||||
pub type_: XcursorUInt,
|
||||
pub subtype: XcursorUInt,
|
||||
pub position: XcursorUInt,
|
||||
}
|
||||
pub type XcursorFileToc = _XcursorFileToc;
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[repr(C)]
|
||||
pub struct _XcursorImage {
|
||||
pub version: XcursorUInt,
|
||||
pub size: XcursorDim,
|
||||
pub width: XcursorDim,
|
||||
pub height: XcursorDim,
|
||||
pub xhot: XcursorDim,
|
||||
pub yhot: XcursorDim,
|
||||
pub delay: XcursorUInt,
|
||||
pub pixels: *mut XcursorPixel,
|
||||
}
|
||||
pub type XcursorImage = _XcursorImage;
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[repr(C)]
|
||||
pub struct _XcursorImages {
|
||||
pub nimage: c_int,
|
||||
pub images: *mut *mut XcursorImage,
|
||||
pub name: *mut c_char,
|
||||
}
|
||||
pub type XcursorImages = _XcursorImages;
|
|
@ -1,146 +0,0 @@
|
|||
// x11-rs: Rust bindings for X11 libraries
|
||||
// The X11 libraries are available under the MIT license.
|
||||
// These bindings are public domain.
|
||||
|
||||
use std::os::raw::{
|
||||
c_char,
|
||||
c_float,
|
||||
c_int,
|
||||
c_uchar,
|
||||
c_uint,
|
||||
c_ulong,
|
||||
c_ushort,
|
||||
};
|
||||
|
||||
use ::xlib::{
|
||||
Bool,
|
||||
Display,
|
||||
Time,
|
||||
Window,
|
||||
XEvent,
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// functions
|
||||
//
|
||||
|
||||
|
||||
x11_link! { Xf86vmode, xxf86vm, ["libXxf86vm.so.1", "libXxf86vm.so"], 22,
|
||||
pub fn XF86VidModeAddModeLine (_4: *mut Display, _3: c_int, _2: *mut XF86VidModeModeInfo, _1: *mut XF86VidModeModeInfo) -> c_int,
|
||||
pub fn XF86VidModeDeleteModeLine (_3: *mut Display, _2: c_int, _1: *mut XF86VidModeModeInfo) -> c_int,
|
||||
pub fn XF86VidModeGetAllModeLines (_4: *mut Display, _3: c_int, _2: *mut c_int, _1: *mut *mut *mut XF86VidModeModeInfo) -> c_int,
|
||||
pub fn XF86VidModeGetDotClocks (_6: *mut Display, _5: c_int, _4: *mut c_int, _3: *mut c_int, _2: *mut c_int, _1: *mut *mut c_int) -> c_int,
|
||||
pub fn XF86VidModeGetGamma (_3: *mut Display, _2: c_int, _1: *mut XF86VidModeGamma) -> c_int,
|
||||
pub fn XF86VidModeGetGammaRamp (_6: *mut Display, _5: c_int, _4: c_int, _3: *mut c_ushort, _2: *mut c_ushort, _1: *mut c_ushort) -> c_int,
|
||||
pub fn XF86VidModeGetGammaRampSize (_3: *mut Display, _2: c_int, _1: *mut c_int) -> c_int,
|
||||
pub fn XF86VidModeGetModeLine (_4: *mut Display, _3: c_int, _2: *mut c_int, _1: *mut XF86VidModeModeLine) -> c_int,
|
||||
pub fn XF86VidModeGetMonitor (_3: *mut Display, _2: c_int, _1: *mut XF86VidModeMonitor) -> c_int,
|
||||
pub fn XF86VidModeGetPermissions (_3: *mut Display, _2: c_int, _1: *mut c_int) -> c_int,
|
||||
pub fn XF86VidModeGetViewPort (_4: *mut Display, _3: c_int, _2: *mut c_int, _1: *mut c_int) -> c_int,
|
||||
pub fn XF86VidModeLockModeSwitch (_3: *mut Display, _2: c_int, _1: c_int) -> c_int,
|
||||
pub fn XF86VidModeModModeLine (_3: *mut Display, _2: c_int, _1: *mut XF86VidModeModeLine) -> c_int,
|
||||
pub fn XF86VidModeQueryExtension (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> c_int,
|
||||
pub fn XF86VidModeQueryVersion (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> c_int,
|
||||
pub fn XF86VidModeSetClientVersion (_1: *mut Display) -> c_int,
|
||||
pub fn XF86VidModeSetGamma (_3: *mut Display, _2: c_int, _1: *mut XF86VidModeGamma) -> c_int,
|
||||
pub fn XF86VidModeSetGammaRamp (_6: *mut Display, _5: c_int, _4: c_int, _3: *mut c_ushort, _2: *mut c_ushort, _1: *mut c_ushort) -> c_int,
|
||||
pub fn XF86VidModeSetViewPort (_4: *mut Display, _3: c_int, _2: c_int, _1: c_int) -> c_int,
|
||||
pub fn XF86VidModeSwitchMode (_3: *mut Display, _2: c_int, _1: c_int) -> c_int,
|
||||
pub fn XF86VidModeSwitchToMode (_3: *mut Display, _2: c_int, _1: *mut XF86VidModeModeInfo) -> c_int,
|
||||
pub fn XF86VidModeValidateModeLine (_3: *mut Display, _2: c_int, _1: *mut XF86VidModeModeInfo) -> c_int,
|
||||
variadic:
|
||||
globals:
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// types
|
||||
//
|
||||
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[repr(C)]
|
||||
pub struct XF86VidModeGamma {
|
||||
pub red: c_float,
|
||||
pub green: c_float,
|
||||
pub blue: c_float,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XF86VidModeModeInfo {
|
||||
pub dotclock: c_uint,
|
||||
pub hdisplay: c_ushort,
|
||||
pub hsyncstart: c_ushort,
|
||||
pub hsyncend: c_ushort,
|
||||
pub htotal: c_ushort,
|
||||
pub hskew: c_ushort,
|
||||
pub vdisplay: c_ushort,
|
||||
pub vsyncstart: c_ushort,
|
||||
pub vsyncend: c_ushort,
|
||||
pub vtotal: c_ushort,
|
||||
pub flags: c_uint,
|
||||
pub privsize: c_int,
|
||||
pub private: *mut i32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[repr(C)]
|
||||
pub struct XF86VidModeModeLine {
|
||||
pub hdisplay: c_ushort,
|
||||
pub hsyncstart: c_ushort,
|
||||
pub hsyncend: c_ushort,
|
||||
pub htotal: c_ushort,
|
||||
pub hskew: c_ushort,
|
||||
pub vdisplay: c_ushort,
|
||||
pub vsyncstart: c_ushort,
|
||||
pub vsyncend: c_ushort,
|
||||
pub vtotal: c_ushort,
|
||||
pub flags: c_uint,
|
||||
pub privsize: c_int,
|
||||
pub private: *mut i32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[repr(C)]
|
||||
pub struct XF86VidModeMonitor {
|
||||
pub vendor: *mut c_char,
|
||||
pub model: *mut c_char,
|
||||
pub EMPTY: c_float,
|
||||
pub nhsync: c_uchar,
|
||||
pub hsync: *mut XF86VidModeSyncRange,
|
||||
pub nvsync: c_uchar,
|
||||
pub vsync: *mut XF86VidModeSyncRange,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[repr(C)]
|
||||
pub struct XF86VidModeSyncRange {
|
||||
pub hi: c_float,
|
||||
pub lo: c_float,
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// event structures
|
||||
//
|
||||
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[repr(C)]
|
||||
pub struct XF86VidModeNotifyEvent {
|
||||
pub type_: c_int,
|
||||
pub serial: c_ulong,
|
||||
pub send_event: Bool,
|
||||
pub display: *mut Display,
|
||||
pub root: Window,
|
||||
pub state: c_int,
|
||||
pub kind: c_int,
|
||||
pub forced: bool,
|
||||
pub time: Time,
|
||||
}
|
||||
|
||||
event_conversions_and_tests! {
|
||||
xf86vm_notify: XF86VidModeNotifyEvent,
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
// x11-rs: Rust bindings for X11 libraries
|
||||
// The X11 libraries are available under the MIT license.
|
||||
// These bindings are public domain.
|
||||
|
||||
use ::xlib::XID;
|
||||
|
||||
|
||||
//
|
||||
// types
|
||||
//
|
||||
|
||||
|
||||
pub type PointerBarrier = XID;
|
|
@ -1,219 +0,0 @@
|
|||
// x11-rs: Rust bindings for X11 libraries
|
||||
// The X11 libraries are available under the MIT license.
|
||||
// These bindings are public domain.
|
||||
|
||||
use std::os::raw::*;
|
||||
|
||||
use xlib::{Display, Region, Visual, XRectangle};
|
||||
use xrender::{XGlyphInfo, XRenderColor};
|
||||
|
||||
|
||||
//
|
||||
// external types
|
||||
//
|
||||
|
||||
|
||||
// freetype
|
||||
pub enum FT_FaceRec {}
|
||||
pub type FT_UInt = c_uint;
|
||||
|
||||
// fontconfig
|
||||
pub type FcChar32 = c_uint;
|
||||
pub enum FcCharSet {}
|
||||
pub enum FcPattern {}
|
||||
|
||||
#[repr(C)]
|
||||
pub enum FcEndian { Big, Little }
|
||||
|
||||
#[repr(C)]
|
||||
pub enum FcResult { Match, NoMatch, TypeMismatch, NoId, OutOfMemory }
|
||||
|
||||
|
||||
//
|
||||
// functions
|
||||
//
|
||||
|
||||
|
||||
x11_link! { Xft, xft, ["libXft.so.2", "libXft.so"], 77,
|
||||
pub fn XftCharExists (_2: *mut Display, _1: *mut XftFont, _0: c_uint) -> c_int,
|
||||
pub fn XftCharFontSpecRender (_7: *mut Display, _6: c_int, _5: c_ulong, _4: c_ulong, _3: c_int, _2: c_int, _1: *const XftCharFontSpec, _0: c_int) -> (),
|
||||
pub fn XftCharIndex (_2: *mut Display, _1: *mut XftFont, _0: c_uint) -> c_uint,
|
||||
pub fn XftCharSpecRender (_8: *mut Display, _7: c_int, _6: c_ulong, _5: *mut XftFont, _4: c_ulong, _3: c_int, _2: c_int, _1: *const XftCharSpec, _0: c_int) -> (),
|
||||
pub fn XftColorAllocName (_4: *mut Display, _3: *const Visual, _2: c_ulong, _1: *const c_char, _0: *mut XftColor) -> c_int,
|
||||
pub fn XftColorAllocValue (_4: *mut Display, _3: *mut Visual, _2: c_ulong, _1: *const XRenderColor, _0: *mut XftColor) -> c_int,
|
||||
pub fn XftColorFree (_3: *mut Display, _2: *mut Visual, _1: c_ulong, _0: *mut XftColor) -> (),
|
||||
pub fn XftDefaultHasRender (_0: *mut Display) -> c_int,
|
||||
pub fn XftDefaultSet (_1: *mut Display, _0: *mut FcPattern) -> c_int,
|
||||
pub fn XftDefaultSubstitute (_2: *mut Display, _1: c_int, _0: *mut FcPattern) -> (),
|
||||
pub fn XftDrawChange (_1: *mut XftDraw, _0: c_ulong) -> (),
|
||||
pub fn XftDrawCharFontSpec (_3: *mut XftDraw, _2: *const XftColor, _1: *const XftCharFontSpec, _0: c_int) -> (),
|
||||
pub fn XftDrawCharSpec (_4: *mut XftDraw, _3: *const XftColor, _2: *mut XftFont, _1: *const XftCharSpec, _0: c_int) -> (),
|
||||
pub fn XftDrawColormap (_0: *mut XftDraw) -> c_ulong,
|
||||
pub fn XftDrawCreate (_3: *mut Display, _2: c_ulong, _1: *mut Visual, _0: c_ulong) -> *mut XftDraw,
|
||||
pub fn XftDrawCreateAlpha (_2: *mut Display, _1: c_ulong, _0: c_int) -> *mut XftDraw,
|
||||
pub fn XftDrawCreateBitmap (_1: *mut Display, _0: c_ulong) -> *mut XftDraw,
|
||||
pub fn XftDrawDestroy (_0: *mut XftDraw) -> (),
|
||||
pub fn XftDrawDisplay (_0: *mut XftDraw) -> *mut Display,
|
||||
pub fn XftDrawDrawable (_0: *mut XftDraw) -> c_ulong,
|
||||
pub fn XftDrawGlyphFontSpec (_3: *mut XftDraw, _2: *const XftColor, _1: *const XftGlyphFontSpec, _0: c_int) -> (),
|
||||
pub fn XftDrawGlyphs (_6: *mut XftDraw, _5: *const XftColor, _4: *mut XftFont, _3: c_int, _2: c_int, _1: *const c_uint, _0: c_int) -> (),
|
||||
pub fn XftDrawGlyphSpec (_4: *mut XftDraw, _3: *const XftColor, _2: *mut XftFont, _1: *const XftGlyphSpec, _0: c_int) -> (),
|
||||
pub fn XftDrawPicture (_0: *mut XftDraw) -> c_ulong,
|
||||
pub fn XftDrawRect (_5: *mut XftDraw, _4: *const XftColor, _3: c_int, _2: c_int, _1: c_uint, _0: c_uint) -> (),
|
||||
pub fn XftDrawSetClip (_1: *mut XftDraw, _0: Region) -> c_int,
|
||||
pub fn XftDrawSetClipRectangles (_4: *mut XftDraw, _3: c_int, _2: c_int, _1: *const XRectangle, _0: c_int) -> c_int,
|
||||
pub fn XftDrawSetSubwindowMode (_1: *mut XftDraw, _0: c_int) -> (),
|
||||
pub fn XftDrawSrcPicture (_1: *mut XftDraw, _0: *const XftColor) -> c_ulong,
|
||||
pub fn XftDrawString16 (_6: *mut XftDraw, _5: *const XftColor, _4: *mut XftFont, _3: c_int, _2: c_int, _1: *const c_ushort, _0: c_int) -> (),
|
||||
pub fn XftDrawString32 (_6: *mut XftDraw, _5: *const XftColor, _4: *mut XftFont, _3: c_int, _2: c_int, _1: *const c_uint, _0: c_int) -> (),
|
||||
pub fn XftDrawString8 (_6: *mut XftDraw, _5: *const XftColor, _4: *mut XftFont, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (),
|
||||
pub fn XftDrawStringUtf16 (_7: *mut XftDraw, _6: *const XftColor, _5: *mut XftFont, _4: c_int, _3: c_int, _2: *const c_uchar, _1: FcEndian, _0: c_int) -> (),
|
||||
pub fn XftDrawStringUtf8 (_6: *mut XftDraw, _5: *const XftColor, _4: *mut XftFont, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (),
|
||||
pub fn XftDrawVisual (_0: *mut XftDraw) -> *mut Visual,
|
||||
pub fn XftFontCheckGlyph (_5: *mut Display, _4: *mut XftFont, _3: c_int, _2: c_uint, _1: *mut c_uint, _0: *mut c_int) -> c_int,
|
||||
pub fn XftFontClose (_1: *mut Display, _0: *mut XftFont) -> (),
|
||||
pub fn XftFontCopy (_1: *mut Display, _0: *mut XftFont) -> *mut XftFont,
|
||||
pub fn XftFontInfoCreate (_1: *mut Display, _0: *const FcPattern) -> *mut XftFontInfo,
|
||||
pub fn XftFontInfoDestroy (_1: *mut Display, _0: *mut XftFontInfo) -> (),
|
||||
pub fn XftFontInfoEqual (_1: *const XftFontInfo, _0: *const XftFontInfo) -> c_int,
|
||||
pub fn XftFontInfoHash (_0: *const XftFontInfo) -> c_uint,
|
||||
pub fn XftFontLoadGlyphs (_4: *mut Display, _3: *mut XftFont, _2: c_int, _1: *const c_uint, _0: c_int) -> (),
|
||||
pub fn XftFontMatch (_3: *mut Display, _2: c_int, _1: *const FcPattern, _0: *mut FcResult) -> *mut FcPattern,
|
||||
pub fn XftFontOpenInfo (_2: *mut Display, _1: *mut FcPattern, _0: *mut XftFontInfo) -> *mut XftFont,
|
||||
pub fn XftFontOpenName (_2: *mut Display, _1: c_int, _0: *const c_char) -> *mut XftFont,
|
||||
pub fn XftFontOpenPattern (_1: *mut Display, _0: *mut FcPattern) -> *mut XftFont,
|
||||
pub fn XftFontOpenXlfd (_2: *mut Display, _1: c_int, _0: *const c_char) -> *mut XftFont,
|
||||
pub fn XftFontUnloadGlyphs (_3: *mut Display, _2: *mut XftFont, _1: *const c_uint, _0: c_int) -> (),
|
||||
pub fn XftGetVersion () -> c_int,
|
||||
pub fn XftGlyphExtents (_4: *mut Display, _3: *mut XftFont, _2: *const c_uint, _1: c_int, _0: *mut XGlyphInfo) -> (),
|
||||
pub fn XftGlyphFontSpecRender (_7: *mut Display, _6: c_int, _5: c_ulong, _4: c_ulong, _3: c_int, _2: c_int, _1: *const XftGlyphFontSpec, _0: c_int) -> (),
|
||||
pub fn XftGlyphRender (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uint, _0: c_int) -> (),
|
||||
pub fn XftGlyphSpecRender (_8: *mut Display, _7: c_int, _6: c_ulong, _5: *mut XftFont, _4: c_ulong, _3: c_int, _2: c_int, _1: *const XftGlyphSpec, _0: c_int) -> (),
|
||||
pub fn XftInit (_0: *const c_char) -> c_int,
|
||||
pub fn XftInitFtLibrary () -> c_int,
|
||||
pub fn XftLockFace (_0: *mut XftFont) -> *mut FT_FaceRec,
|
||||
pub fn XftNameParse (_0: *const c_char) -> *mut FcPattern,
|
||||
pub fn XftNameUnparse (_2: *mut FcPattern, _1: *mut c_char, _0: c_int) -> c_int,
|
||||
pub fn XftTextExtents16 (_4: *mut Display, _3: *mut XftFont, _2: *const c_ushort, _1: c_int, _0: *mut XGlyphInfo) -> (),
|
||||
pub fn XftTextExtents32 (_4: *mut Display, _3: *mut XftFont, _2: *const c_uint, _1: c_int, _0: *mut XGlyphInfo) -> (),
|
||||
pub fn XftTextExtents8 (_4: *mut Display, _3: *mut XftFont, _2: *const c_uchar, _1: c_int, _0: *mut XGlyphInfo) -> (),
|
||||
pub fn XftTextExtentsUtf16 (_5: *mut Display, _4: *mut XftFont, _3: *const c_uchar, _2: FcEndian, _1: c_int, _0: *mut XGlyphInfo) -> (),
|
||||
pub fn XftTextExtentsUtf8 (_4: *mut Display, _3: *mut XftFont, _2: *const c_uchar, _1: c_int, _0: *mut XGlyphInfo) -> (),
|
||||
pub fn XftTextRender16 (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_ushort, _0: c_int) -> (),
|
||||
pub fn XftTextRender16BE (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (),
|
||||
pub fn XftTextRender16LE (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (),
|
||||
pub fn XftTextRender32 (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uint, _0: c_int) -> (),
|
||||
pub fn XftTextRender32BE (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (),
|
||||
pub fn XftTextRender32LE (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (),
|
||||
pub fn XftTextRender8 (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (),
|
||||
pub fn XftTextRenderUtf16 (_11: *mut Display, _10: c_int, _9: c_ulong, _8: *mut XftFont, _7: c_ulong, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: *const c_uchar, _1: FcEndian, _0: c_int) -> (),
|
||||
pub fn XftTextRenderUtf8 (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (),
|
||||
pub fn XftUnlockFace (_0: *mut XftFont) -> (),
|
||||
pub fn XftXlfdParse (_2: *const c_char, _1: c_int, _0: c_int) -> *mut FcPattern,
|
||||
variadic:
|
||||
pub fn XftFontOpen (_1: *mut Display, _0: c_int) -> *mut XftFont,
|
||||
pub fn XftListFonts (_1: *mut Display, _0: c_int) -> *mut XftFontSet,
|
||||
globals:
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// types
|
||||
//
|
||||
|
||||
|
||||
pub enum XftFontInfo {}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XftFont {
|
||||
pub ascent: c_int,
|
||||
pub descent: c_int,
|
||||
pub height: c_int,
|
||||
pub max_advance_width: c_int,
|
||||
pub charset: *mut FcCharSet,
|
||||
pub pattern: *mut FcPattern,
|
||||
}
|
||||
|
||||
pub enum XftDraw {}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XftColor {
|
||||
pub pixel: c_ulong,
|
||||
pub color: XRenderColor,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XftCharSpec {
|
||||
pub ucs4: FcChar32,
|
||||
pub x: c_short,
|
||||
pub y: c_short,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XftCharFontSpec {
|
||||
pub font: *mut XftFont,
|
||||
pub ucs4: FcChar32,
|
||||
pub x: c_short,
|
||||
pub y: c_short,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XftFontSet {
|
||||
pub nfont: c_int,
|
||||
pub sfont: c_int,
|
||||
pub fonts: *mut *mut XftPattern,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XftGlyphSpec {
|
||||
pub glyph: FT_UInt,
|
||||
pub x: c_short,
|
||||
pub y: c_short,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XftGlyphFontSpec {
|
||||
pub font: *mut XftFont,
|
||||
pub glyph: FT_UInt,
|
||||
pub x: c_short,
|
||||
pub y: c_short,
|
||||
}
|
||||
|
||||
pub enum XftPattern {}
|
||||
|
||||
|
||||
//
|
||||
// constants
|
||||
//
|
||||
|
||||
|
||||
// font attributes
|
||||
pub const XFT_FAMILY: &'static str = "family";
|
||||
pub const XFT_STYLE: &'static str = "style";
|
||||
pub const XFT_SLANT: &'static str = "slant";
|
||||
pub const XFT_WEIGHT: &'static str = "weight";
|
||||
pub const XFT_SIZE: &'static str = "size";
|
||||
pub const XFT_PIXEL_SIZE: &'static str = "pixelsize";
|
||||
pub const XFT_SPACING: &'static str = "spacing";
|
||||
pub const XFT_FOUNDRY: &'static str = "foundry";
|
||||
pub const XFT_ANTIALIAS: &'static str = "antialias";
|
||||
|
||||
// slant values
|
||||
pub const XFT_SLANT_ROMAN: c_int = 0;
|
||||
pub const XFT_SLANT_ITALIC: c_int = 100;
|
||||
pub const XFT_SLANT_OBLIQUE: c_int = 110;
|
||||
|
||||
// attribute types
|
||||
pub const XftTypeVoid: c_int = 0;
|
||||
pub const XftTypeInteger: c_int = 1;
|
||||
pub const XftTypeDouble: c_int = 2;
|
||||
pub const XftTypeString: c_int = 3;
|
||||
pub const XftTypeBool: c_int = 4;
|
||||
pub const XftTypeMatrix: c_int = 5;
|
|
@ -1,66 +0,0 @@
|
|||
// x11-rs: Rust bindings for X11 libraries
|
||||
// The X11 libraries are available under the MIT license.
|
||||
// These bindings are public domain.
|
||||
|
||||
use std::os::raw::{
|
||||
c_int,
|
||||
c_short,
|
||||
};
|
||||
|
||||
use ::xlib::{
|
||||
Bool,
|
||||
Display,
|
||||
Drawable,
|
||||
Status,
|
||||
Window,
|
||||
XID,
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// functions
|
||||
//
|
||||
|
||||
|
||||
x11_link! { Xlib, xinerama, ["libXinerama.so.1", "libXinerama.so"], 10,
|
||||
pub fn XineramaIsActive (dpy: *mut Display) -> Bool,
|
||||
pub fn XineramaQueryExtension (dpy: *mut Display, event_base: *mut c_int, error_base: *mut c_int) -> Bool,
|
||||
pub fn XineramaQueryScreens (dpy: *mut Display, number: *mut c_int) -> *mut XineramaScreenInfo,
|
||||
pub fn XineramaQueryVersion (dpy: *mut Display, major_versionp: *mut c_int, minor_versionp: *mut c_int) -> Status,
|
||||
pub fn XPanoramiXAllocInfo () -> *mut XPanoramiXInfo,
|
||||
pub fn XPanoramiXGetScreenCount (dpy: *mut Display, drawable: Drawable, panoramiX_info: *mut XPanoramiXInfo) -> Status,
|
||||
pub fn XPanoramiXGetScreenSize (dpy: *mut Display, drawable: Drawable, screen_num: c_int, panoramiX_info: *mut XPanoramiXInfo) -> Status,
|
||||
pub fn XPanoramiXGetState (dpy: *mut Display, drawable: Drawable, panoramiX_info: *mut XPanoramiXInfo) -> Status,
|
||||
pub fn XPanoramiXQueryExtension (dpy: *mut Display, event_base_return: *mut c_int, error_base_return: *mut c_int) -> Bool,
|
||||
pub fn XPanoramiXQueryVersion (dpy: *mut Display, major_version_return: *mut c_int, minor_version_return: *mut c_int) -> Status,
|
||||
variadic:
|
||||
globals:
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// types
|
||||
//
|
||||
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XineramaScreenInfo {
|
||||
pub screen_number: c_int,
|
||||
pub x_org: c_short,
|
||||
pub y_org: c_short,
|
||||
pub width: c_short,
|
||||
pub height: c_short,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XPanoramiXInfo {
|
||||
pub window: Window,
|
||||
pub screen: c_int,
|
||||
pub State: c_int,
|
||||
pub width: c_int,
|
||||
pub height: c_int,
|
||||
pub ScreenCount: c_int,
|
||||
pub eventMask: XID,
|
||||
}
|
|
@ -1,165 +0,0 @@
|
|||
// x11-rs: Rust bindings for X11 libraries
|
||||
// The X11 libraries are available under the MIT license.
|
||||
// These bindings are public domain.
|
||||
|
||||
use std::os::raw::{
|
||||
c_char,
|
||||
c_int,
|
||||
c_long,
|
||||
c_short,
|
||||
c_uchar,
|
||||
c_uint,
|
||||
c_ulong,
|
||||
};
|
||||
|
||||
use ::xlib::{
|
||||
Atom,
|
||||
Display,
|
||||
Time,
|
||||
XEvent,
|
||||
XID,
|
||||
XModifierKeymap,
|
||||
};
|
||||
|
||||
//
|
||||
// functions
|
||||
//
|
||||
|
||||
x11_link! { XInput, xi, ["libXi.so.6", "libXi.so"], 44,
|
||||
pub fn XAllowDeviceEvents (_4: *mut Display, _3: *mut XDevice, _2: c_int, _1: c_ulong) -> c_int,
|
||||
pub fn XChangeDeviceControl (_4: *mut Display, _3: *mut XDevice, _2: c_int, _1: *mut XDeviceControl) -> c_int,
|
||||
pub fn XChangeDeviceDontPropagateList (_5: *mut Display, _4: c_ulong, _3: c_int, _2: *mut c_ulong, _1: c_int) -> c_int,
|
||||
pub fn XChangeDeviceKeyMapping (_6: *mut Display, _5: *mut XDevice, _4: c_int, _3: c_int, _2: *mut c_ulong, _1: c_int) -> c_int,
|
||||
pub fn XChangeDeviceProperty (_8: *mut Display, _7: *mut XDevice, _6: c_ulong, _5: c_ulong, _4: c_int, _3: c_int, _2: *const c_uchar, _1: c_int) -> (),
|
||||
pub fn XChangeFeedbackControl (_4: *mut Display, _3: *mut XDevice, _2: c_ulong, _1: *mut XFeedbackControl) -> c_int,
|
||||
pub fn XChangeKeyboardDevice (_2: *mut Display, _1: *mut XDevice) -> c_int,
|
||||
pub fn XChangePointerDevice (_4: *mut Display, _3: *mut XDevice, _2: c_int, _1: c_int) -> c_int,
|
||||
pub fn XCloseDevice (_2: *mut Display, _1: *mut XDevice) -> c_int,
|
||||
pub fn XDeleteDeviceProperty (_3: *mut Display, _2: *mut XDevice, _1: c_ulong) -> (),
|
||||
pub fn XDeviceBell (_5: *mut Display, _4: *mut XDevice, _3: c_ulong, _2: c_ulong, _1: c_int) -> c_int,
|
||||
pub fn XFreeDeviceControl (_1: *mut XDeviceControl) -> (),
|
||||
pub fn XFreeDeviceList (_1: *mut XDeviceInfo) -> (),
|
||||
pub fn XFreeDeviceMotionEvents (_1: *mut XDeviceTimeCoord) -> (),
|
||||
pub fn XFreeDeviceState (_1: *mut XDeviceState) -> (),
|
||||
pub fn XFreeFeedbackList (_1: *mut XFeedbackState) -> (),
|
||||
pub fn XGetDeviceButtonMapping (_4: *mut Display, _3: *mut XDevice, _2: *mut c_uchar, _1: c_uint) -> c_int,
|
||||
pub fn XGetDeviceControl (_3: *mut Display, _2: *mut XDevice, _1: c_int) -> *mut XDeviceControl,
|
||||
pub fn XGetDeviceDontPropagateList (_3: *mut Display, _2: c_ulong, _1: *mut c_int) -> *mut c_ulong,
|
||||
pub fn XGetDeviceFocus (_5: *mut Display, _4: *mut XDevice, _3: *mut c_ulong, _2: *mut c_int, _1: *mut c_ulong) -> c_int,
|
||||
pub fn XGetDeviceKeyMapping (_5: *mut Display, _4: *mut XDevice, _3: c_uchar, _2: c_int, _1: *mut c_int) -> *mut c_ulong,
|
||||
pub fn XGetDeviceModifierMapping (_2: *mut Display, _1: *mut XDevice) -> *mut XModifierKeymap,
|
||||
pub fn XGetDeviceMotionEvents (_7: *mut Display, _6: *mut XDevice, _5: c_ulong, _4: c_ulong, _3: *mut c_int, _2: *mut c_int, _1: *mut c_int) -> *mut XDeviceTimeCoord,
|
||||
pub fn XGetDeviceProperty (_12: *mut Display, _11: *mut XDevice, _10: c_ulong, _9: c_long, _8: c_long, _7: c_int, _6: c_ulong, _5: *mut c_ulong, _4: *mut c_int, _3: *mut c_ulong, _2: *mut c_ulong, _1: *mut *mut c_uchar) -> c_int,
|
||||
pub fn XGetExtensionVersion (_2: *mut Display, _1: *const c_char) -> *mut XExtensionVersion,
|
||||
pub fn XGetFeedbackControl (_3: *mut Display, _2: *mut XDevice, _1: *mut c_int) -> *mut XFeedbackState,
|
||||
pub fn XGetSelectedExtensionEvents (_6: *mut Display, _5: c_ulong, _4: *mut c_int, _3: *mut *mut c_ulong, _2: *mut c_int, _1: *mut *mut c_ulong) -> c_int,
|
||||
pub fn XGrabDevice (_9: *mut Display, _8: *mut XDevice, _7: c_ulong, _6: c_int, _5: c_int, _4: *mut c_ulong, _3: c_int, _2: c_int, _1: c_ulong) -> c_int,
|
||||
pub fn XGrabDeviceButton (_11: *mut Display, _10: *mut XDevice, _9: c_uint, _8: c_uint, _7: *mut XDevice, _6: c_ulong, _5: c_int, _4: c_uint, _3: *mut c_ulong, _2: c_int, _1: c_int) -> c_int,
|
||||
pub fn XGrabDeviceKey (_11: *mut Display, _10: *mut XDevice, _9: c_uint, _8: c_uint, _7: *mut XDevice, _6: c_ulong, _5: c_int, _4: c_uint, _3: *mut c_ulong, _2: c_int, _1: c_int) -> c_int,
|
||||
|
||||
pub fn XListDeviceProperties (_3: *mut Display, _2: *mut XDevice, _1: *mut c_int) -> *mut c_ulong,
|
||||
pub fn XListInputDevices (_2: *mut Display, _1: *mut c_int) -> *mut XDeviceInfo,
|
||||
pub fn XOpenDevice (_2: *mut Display, _1: c_ulong) -> *mut XDevice,
|
||||
pub fn XQueryDeviceState (_2: *mut Display, _1: *mut XDevice) -> *mut XDeviceState,
|
||||
pub fn XSelectExtensionEvent (_4: *mut Display, _3: c_ulong, _2: *mut c_ulong, _1: c_int) -> c_int,
|
||||
pub fn XSendExtensionEvent (_7: *mut Display, _6: *mut XDevice, _5: c_ulong, _4: c_int, _3: c_int, _2: *mut c_ulong, _1: *mut XEvent) -> c_int,
|
||||
pub fn XSetDeviceButtonMapping (_4: *mut Display, _3: *mut XDevice, _2: *mut c_uchar, _1: c_int) -> c_int,
|
||||
pub fn XSetDeviceFocus (_5: *mut Display, _4: *mut XDevice, _3: c_ulong, _2: c_int, _1: c_ulong) -> c_int,
|
||||
pub fn XSetDeviceMode (_3: *mut Display, _2: *mut XDevice, _1: c_int) -> c_int,
|
||||
pub fn XSetDeviceModifierMapping (_3: *mut Display, _2: *mut XDevice, _1: *mut XModifierKeymap) -> c_int,
|
||||
pub fn XSetDeviceValuators (_5: *mut Display, _4: *mut XDevice, _3: *mut c_int, _2: c_int, _1: c_int) -> c_int,
|
||||
pub fn XUngrabDevice (_3: *mut Display, _2: *mut XDevice, _1: c_ulong) -> c_int,
|
||||
pub fn XUngrabDeviceButton (_6: *mut Display, _5: *mut XDevice, _4: c_uint, _3: c_uint, _2: *mut XDevice, _1: c_ulong) -> c_int,
|
||||
pub fn XUngrabDeviceKey (_6: *mut Display, _5: *mut XDevice, _4: c_uint, _3: c_uint, _2: *mut XDevice, _1: c_ulong) -> c_int,
|
||||
variadic:
|
||||
globals:
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// types
|
||||
//
|
||||
|
||||
pub enum _XAnyClassinfo {}
|
||||
|
||||
pub type XAnyClassPtr = *mut _XAnyClassinfo;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XDevice {
|
||||
pub device_id: XID,
|
||||
pub num_classes: c_int,
|
||||
pub classes: *mut XInputClassInfo,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XDeviceControl {
|
||||
pub control: XID,
|
||||
pub length: c_int,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XDeviceInfo {
|
||||
pub id: XID,
|
||||
pub type_: Atom,
|
||||
pub name: *mut c_char,
|
||||
pub num_classes: c_int,
|
||||
pub use_: c_int,
|
||||
pub inputclassinfo: XAnyClassPtr,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XDeviceState {
|
||||
pub device_id: XID,
|
||||
pub num_classes: c_int,
|
||||
pub data: *mut XInputClass,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XDeviceTimeCoord {
|
||||
pub time: Time,
|
||||
pub data: *mut c_int,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XExtensionVersion {
|
||||
pub present: c_int,
|
||||
pub major_version: c_short,
|
||||
pub minor_version: c_short,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XFeedbackControl {
|
||||
pub class: XID,
|
||||
pub length: c_int,
|
||||
pub id: XID,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XFeedbackState {
|
||||
pub class: XID,
|
||||
pub length: c_int,
|
||||
pub id: XID,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XInputClass {
|
||||
pub class: c_uchar,
|
||||
pub length: c_uchar,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XInputClassInfo {
|
||||
pub input_class: c_uchar,
|
||||
pub event_type_base: c_uchar,
|
||||
}
|
||||
|
|
@ -1,758 +0,0 @@
|
|||
use xfixes::PointerBarrier;
|
||||
use xlib::{Atom, Display, Time, Window};
|
||||
use std::os::raw::{c_int, c_uint, c_long, c_double, c_ulong, c_uchar};
|
||||
|
||||
//
|
||||
// macro translations
|
||||
//
|
||||
fn mask_byte(mask_flag: i32) -> usize {
|
||||
(mask_flag >> 3) as usize
|
||||
}
|
||||
|
||||
pub fn XISetMask(mask: &mut [::std::os::raw::c_uchar], event: i32) {
|
||||
mask[mask_byte(event)] |= 1 << (event & 7);
|
||||
}
|
||||
|
||||
pub fn XIClearMask(mask: &mut [::std::os::raw::c_uchar], event: i32) {
|
||||
mask[mask_byte(event)] &= 1 << (event & 7);
|
||||
}
|
||||
|
||||
pub fn XIMaskIsSet(mask: &[::std::os::raw::c_uchar], event: i32) -> bool {
|
||||
(mask[mask_byte(event)] & (1 << (event & 7))) != 0
|
||||
}
|
||||
|
||||
//
|
||||
// functions
|
||||
//
|
||||
x11_link! { XInput2, xi, ["libXi.so.6", "libXi.so"], 34,
|
||||
pub fn XIAllowEvents (_4: *mut Display, _3: c_int, _2: c_int, _1: c_ulong) -> c_int,
|
||||
pub fn XIAllowTouchEvents (_5: *mut Display, _4: c_int, _3: c_uint, _2: c_ulong, _1: c_int) -> c_int,
|
||||
pub fn XIBarrierReleasePointer (_4: *mut Display, _3: c_int, _2: c_ulong, _1: c_uint) -> (),
|
||||
pub fn XIBarrierReleasePointers (_3: *mut Display, _2: *mut XIBarrierReleasePointerInfo, _1: c_int) -> (),
|
||||
pub fn XIChangeHierarchy (_3: *mut Display, _2: *mut XIAnyHierarchyChangeInfo, _1: c_int) -> c_int,
|
||||
pub fn XIChangeProperty (_8: *mut Display, _7: c_int, _6: c_ulong, _5: c_ulong, _4: c_int, _3: c_int, _2: *mut c_uchar, _1: c_int) -> (),
|
||||
pub fn XIDefineCursor (_4: *mut Display, _3: c_int, _2: c_ulong, _1: c_ulong) -> c_int,
|
||||
pub fn XIDeleteProperty (_3: *mut Display, _2: c_int, _1: c_ulong) -> (),
|
||||
pub fn XIFreeDeviceInfo (_1: *mut XIDeviceInfo) -> (),
|
||||
pub fn XIGetClientPointer (_3: *mut Display, _2: c_ulong, _1: *mut c_int) -> c_int,
|
||||
pub fn XIGetFocus (_3: *mut Display, _2: c_int, _1: *mut c_ulong) -> c_int,
|
||||
pub fn XIGetProperty (_12: *mut Display, _11: c_int, _10: c_ulong, _9: c_long, _8: c_long, _7: c_int, _6: c_ulong, _5: *mut c_ulong, _4: *mut c_int, _3: *mut c_ulong, _2: *mut c_ulong, _1: *mut *mut c_uchar) -> c_int,
|
||||
pub fn XIGetSelectedEvents (_3: *mut Display, _2: c_ulong, _1: *mut c_int) -> *mut XIEventMask,
|
||||
pub fn XIGrabButton (_11: *mut Display, _10: c_int, _9: c_int, _8: c_ulong, _7: c_ulong, _6: c_int, _5: c_int, _4: c_int, _3: *mut XIEventMask, _2: c_int, _1: *mut XIGrabModifiers) -> c_int,
|
||||
pub fn XIGrabDevice (_9: *mut Display, _8: c_int, _7: c_ulong, _6: c_ulong, _5: c_ulong, _4: c_int, _3: c_int, _2: c_int, _1: *mut XIEventMask) -> c_int,
|
||||
pub fn XIGrabEnter (_10: *mut Display, _9: c_int, _8: c_ulong, _7: c_ulong, _6: c_int, _5: c_int, _4: c_int, _3: *mut XIEventMask, _2: c_int, _1: *mut XIGrabModifiers) -> c_int,
|
||||
pub fn XIGrabFocusIn (_9: *mut Display, _8: c_int, _7: c_ulong, _6: c_int, _5: c_int, _4: c_int, _3: *mut XIEventMask, _2: c_int, _1: *mut XIGrabModifiers) -> c_int,
|
||||
pub fn XIGrabKeycode (_10: *mut Display, _9: c_int, _8: c_int, _7: c_ulong, _6: c_int, _5: c_int, _4: c_int, _3: *mut XIEventMask, _2: c_int, _1: *mut XIGrabModifiers) -> c_int,
|
||||
pub fn XIGrabTouchBegin (_7: *mut Display, _6: c_int, _5: c_ulong, _4: c_int, _3: *mut XIEventMask, _2: c_int, _1: *mut XIGrabModifiers) -> c_int,
|
||||
pub fn XIListProperties (_3: *mut Display, _2: c_int, _1: *mut c_int) -> *mut c_ulong,
|
||||
pub fn XIQueryDevice (_3: *mut Display, _2: c_int, _1: *mut c_int) -> *mut XIDeviceInfo,
|
||||
pub fn XIQueryPointer (_12: *mut Display, _11: c_int, _10: c_ulong, _9: *mut c_ulong, _8: *mut c_ulong, _7: *mut c_double, _6: *mut c_double, _5: *mut c_double, _4: *mut c_double, _3: *mut XIButtonState, _2: *mut XIModifierState, _1: *mut XIModifierState) -> c_int,
|
||||
pub fn XIQueryVersion (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> c_int,
|
||||
pub fn XISelectEvents (_4: *mut Display, _3: c_ulong, _2: *mut XIEventMask, _1: c_int) -> c_int,
|
||||
pub fn XISetClientPointer (_3: *mut Display, _2: c_ulong, _1: c_int) -> c_int,
|
||||
pub fn XISetFocus (_4: *mut Display, _3: c_int, _2: c_ulong, _1: c_ulong) -> c_int,
|
||||
pub fn XIUndefineCursor (_3: *mut Display, _2: c_int, _1: c_ulong) -> c_int,
|
||||
pub fn XIUngrabButton (_6: *mut Display, _5: c_int, _4: c_int, _3: c_ulong, _2: c_int, _1: *mut XIGrabModifiers) -> c_int,
|
||||
pub fn XIUngrabDevice (_3: *mut Display, _2: c_int, _1: c_ulong) -> c_int,
|
||||
pub fn XIUngrabEnter (_5: *mut Display, _4: c_int, _3: c_ulong, _2: c_int, _1: *mut XIGrabModifiers) -> c_int,
|
||||
pub fn XIUngrabFocusIn (_5: *mut Display, _4: c_int, _3: c_ulong, _2: c_int, _1: *mut XIGrabModifiers) -> c_int,
|
||||
pub fn XIUngrabKeycode (_6: *mut Display, _5: c_int, _4: c_int, _3: c_ulong, _2: c_int, _1: *mut XIGrabModifiers) -> c_int,
|
||||
pub fn XIUngrabTouchBegin (_5: *mut Display, _4: c_int, _3: c_ulong, _2: c_int, _1: *mut XIGrabModifiers) -> c_int,
|
||||
pub fn XIWarpPointer (_10: *mut Display, _9: c_int, _8: c_ulong, _7: c_ulong, _6: c_double, _5: c_double, _4: c_uint, _3: c_uint, _2: c_double, _1: c_double) -> c_int,
|
||||
variadic:
|
||||
globals:
|
||||
}
|
||||
|
||||
//
|
||||
// constants
|
||||
// (auto-generated with cmacros)
|
||||
//
|
||||
|
||||
pub const XInput_2_0: i32 = 7;
|
||||
pub const XI_2_Major: i32 = 2;
|
||||
pub const XI_2_Minor: i32 = 3;
|
||||
pub const XIPropertyDeleted: i32 = 0;
|
||||
pub const XIPropertyCreated: i32 = 1;
|
||||
pub const XIPropertyModified: i32 = 2;
|
||||
pub const XIPropModeReplace: i32 = 0;
|
||||
pub const XIPropModePrepend: i32 = 1;
|
||||
pub const XIPropModeAppend: i32 = 2;
|
||||
pub const XINotifyNormal: i32 = 0;
|
||||
pub const XINotifyGrab: i32 = 1;
|
||||
pub const XINotifyUngrab: i32 = 2;
|
||||
pub const XINotifyWhileGrabbed: i32 = 3;
|
||||
pub const XINotifyPassiveGrab: i32 = 4;
|
||||
pub const XINotifyPassiveUngrab: i32 = 5;
|
||||
pub const XINotifyAncestor: i32 = 0;
|
||||
pub const XINotifyVirtual: i32 = 1;
|
||||
pub const XINotifyInferior: i32 = 2;
|
||||
pub const XINotifyNonlinear: i32 = 3;
|
||||
pub const XINotifyNonlinearVirtual: i32 = 4;
|
||||
pub const XINotifyPointer: i32 = 5;
|
||||
pub const XINotifyPointerRoot: i32 = 6;
|
||||
pub const XINotifyDetailNone: i32 = 7;
|
||||
pub const XIGrabModeSync: i32 = 0;
|
||||
pub const XIGrabModeAsync: i32 = 1;
|
||||
pub const XIGrabModeTouch: i32 = 2;
|
||||
pub const XIGrabSuccess: i32 = 0;
|
||||
pub const XIAlreadyGrabbed: i32 = 1;
|
||||
pub const XIGrabInvalidTime: i32 = 2;
|
||||
pub const XIGrabNotViewable: i32 = 3;
|
||||
pub const XIGrabFrozen: i32 = 4;
|
||||
pub const XIGrabtypeButton: i32 = 0;
|
||||
pub const XIGrabtypeKeycode: i32 = 1;
|
||||
pub const XIGrabtypeEnter: i32 = 2;
|
||||
pub const XIGrabtypeFocusIn: i32 = 3;
|
||||
pub const XIGrabtypeTouchBegin: i32 = 4;
|
||||
pub const XIAnyButton: i32 = 0;
|
||||
pub const XIAnyKeycode: i32 = 0;
|
||||
pub const XIAsyncDevice: i32 = 0;
|
||||
pub const XISyncDevice: i32 = 1;
|
||||
pub const XIReplayDevice: i32 = 2;
|
||||
pub const XIAsyncPairedDevice: i32 = 3;
|
||||
pub const XIAsyncPair: i32 = 4;
|
||||
pub const XISyncPair: i32 = 5;
|
||||
pub const XIAcceptTouch: i32 = 6;
|
||||
pub const XIRejectTouch: i32 = 7;
|
||||
pub const XISlaveSwitch: i32 = 1;
|
||||
pub const XIDeviceChange: i32 = 2;
|
||||
pub const XIMasterAdded: i32 = (1 << 0);
|
||||
pub const XIMasterRemoved: i32 = (1 << 1);
|
||||
pub const XISlaveAdded: i32 = (1 << 2);
|
||||
pub const XISlaveRemoved: i32 = (1 << 3);
|
||||
pub const XISlaveAttached: i32 = (1 << 4);
|
||||
pub const XISlaveDetached: i32 = (1 << 5);
|
||||
pub const XIDeviceEnabled: i32 = (1 << 6);
|
||||
pub const XIDeviceDisabled: i32 = (1 << 7);
|
||||
pub const XIAddMaster: i32 = 1;
|
||||
pub const XIRemoveMaster: i32 = 2;
|
||||
pub const XIAttachSlave: i32 = 3;
|
||||
pub const XIDetachSlave: i32 = 4;
|
||||
pub const XIAttachToMaster: i32 = 1;
|
||||
pub const XIFloating: i32 = 2;
|
||||
pub const XIModeRelative: i32 = 0;
|
||||
pub const XIModeAbsolute: i32 = 1;
|
||||
pub const XIMasterPointer: i32 = 1;
|
||||
pub const XIMasterKeyboard: i32 = 2;
|
||||
pub const XISlavePointer: i32 = 3;
|
||||
pub const XISlaveKeyboard: i32 = 4;
|
||||
pub const XIFloatingSlave: i32 = 5;
|
||||
pub const XIKeyClass: i32 = 0;
|
||||
pub const XIButtonClass: i32 = 1;
|
||||
pub const XIValuatorClass: i32 = 2;
|
||||
pub const XIScrollClass: i32 = 3;
|
||||
pub const XITouchClass: i32 = 8;
|
||||
pub const XIScrollTypeVertical: i32 = 1;
|
||||
pub const XIScrollTypeHorizontal: i32 = 2;
|
||||
pub const XIScrollFlagNoEmulation: i32 = (1 << 0);
|
||||
pub const XIScrollFlagPreferred: i32 = (1 << 1);
|
||||
pub const XIKeyRepeat: i32 = (1 << 16);
|
||||
pub const XIPointerEmulated: i32 = (1 << 16);
|
||||
pub const XITouchPendingEnd: i32 = (1 << 16);
|
||||
pub const XITouchEmulatingPointer: i32 = (1 << 17);
|
||||
pub const XIBarrierPointerReleased: i32 = (1 << 0);
|
||||
pub const XIBarrierDeviceIsGrabbed: i32 = (1 << 1);
|
||||
pub const XIDirectTouch: i32 = 1;
|
||||
pub const XIDependentTouch: i32 = 2;
|
||||
pub const XIAllDevices: i32 = 0;
|
||||
pub const XIAllMasterDevices: i32 = 1;
|
||||
pub const XI_DeviceChanged: i32 = 1;
|
||||
pub const XI_KeyPress: i32 = 2;
|
||||
pub const XI_KeyRelease: i32 = 3;
|
||||
pub const XI_ButtonPress: i32 = 4;
|
||||
pub const XI_ButtonRelease: i32 = 5;
|
||||
pub const XI_Motion: i32 = 6;
|
||||
pub const XI_Enter: i32 = 7;
|
||||
pub const XI_Leave: i32 = 8;
|
||||
pub const XI_FocusIn: i32 = 9;
|
||||
pub const XI_FocusOut: i32 = 10;
|
||||
pub const XI_HierarchyChanged: i32 = 11;
|
||||
pub const XI_PropertyEvent: i32 = 12;
|
||||
pub const XI_RawKeyPress: i32 = 13;
|
||||
pub const XI_RawKeyRelease: i32 = 14;
|
||||
pub const XI_RawButtonPress: i32 = 15;
|
||||
pub const XI_RawButtonRelease: i32 = 16;
|
||||
pub const XI_RawMotion: i32 = 17;
|
||||
pub const XI_TouchBegin: i32 = 18 /* XI 2.2 */;
|
||||
pub const XI_TouchUpdate: i32 = 19;
|
||||
pub const XI_TouchEnd: i32 = 20;
|
||||
pub const XI_TouchOwnership: i32 = 21;
|
||||
pub const XI_RawTouchBegin: i32 = 22;
|
||||
pub const XI_RawTouchUpdate: i32 = 23;
|
||||
pub const XI_RawTouchEnd: i32 = 24;
|
||||
pub const XI_BarrierHit: i32 = 25 /* XI 2.3 */;
|
||||
pub const XI_BarrierLeave: i32 = 26;
|
||||
pub const XI_LASTEVENT: i32 = XI_BarrierLeave;
|
||||
pub const XI_DeviceChangedMask: i32 = (1 << XI_DeviceChanged);
|
||||
pub const XI_KeyPressMask: i32 = (1 << XI_KeyPress);
|
||||
pub const XI_KeyReleaseMask: i32 = (1 << XI_KeyRelease);
|
||||
pub const XI_ButtonPressMask: i32 = (1 << XI_ButtonPress);
|
||||
pub const XI_ButtonReleaseMask: i32 = (1 << XI_ButtonRelease);
|
||||
pub const XI_MotionMask: i32 = (1 << XI_Motion);
|
||||
pub const XI_EnterMask: i32 = (1 << XI_Enter);
|
||||
pub const XI_LeaveMask: i32 = (1 << XI_Leave);
|
||||
pub const XI_FocusInMask: i32 = (1 << XI_FocusIn);
|
||||
pub const XI_FocusOutMask: i32 = (1 << XI_FocusOut);
|
||||
pub const XI_HierarchyChangedMask: i32 = (1 << XI_HierarchyChanged);
|
||||
pub const XI_PropertyEventMask: i32 = (1 << XI_PropertyEvent);
|
||||
pub const XI_RawKeyPressMask: i32 = (1 << XI_RawKeyPress);
|
||||
pub const XI_RawKeyReleaseMask: i32 = (1 << XI_RawKeyRelease);
|
||||
pub const XI_RawButtonPressMask: i32 = (1 << XI_RawButtonPress);
|
||||
pub const XI_RawButtonReleaseMask: i32 = (1 << XI_RawButtonRelease);
|
||||
pub const XI_RawMotionMask: i32 = (1 << XI_RawMotion);
|
||||
pub const XI_TouchBeginMask: i32 = (1 << XI_TouchBegin);
|
||||
pub const XI_TouchEndMask: i32 = (1 << XI_TouchEnd);
|
||||
pub const XI_TouchOwnershipChangedMask: i32 = (1 << XI_TouchOwnership);
|
||||
pub const XI_TouchUpdateMask: i32 = (1 << XI_TouchUpdate);
|
||||
pub const XI_RawTouchBeginMask: i32 = (1 << XI_RawTouchBegin);
|
||||
pub const XI_RawTouchEndMask: i32 = (1 << XI_RawTouchEnd);
|
||||
pub const XI_RawTouchUpdateMask: i32 = (1 << XI_RawTouchUpdate);
|
||||
pub const XI_BarrierHitMask: i32 = (1 << XI_BarrierHit);
|
||||
pub const XI_BarrierLeaveMask: i32 = (1 << XI_BarrierLeave);
|
||||
|
||||
//
|
||||
// structs
|
||||
// (auto-generated with rust-bindgen)
|
||||
//
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIAddMasterInfo {
|
||||
pub _type: ::std::os::raw::c_int,
|
||||
pub name: *mut ::std::os::raw::c_char,
|
||||
pub send_core: ::std::os::raw::c_int,
|
||||
pub enable: ::std::os::raw::c_int,
|
||||
}
|
||||
impl ::std::clone::Clone for XIAddMasterInfo {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIAddMasterInfo {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIRemoveMasterInfo {
|
||||
pub _type: ::std::os::raw::c_int,
|
||||
pub deviceid: ::std::os::raw::c_int,
|
||||
pub return_mode: ::std::os::raw::c_int,
|
||||
pub return_pointer: ::std::os::raw::c_int,
|
||||
pub return_keyboard: ::std::os::raw::c_int,
|
||||
}
|
||||
impl ::std::clone::Clone for XIRemoveMasterInfo {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIRemoveMasterInfo {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIAttachSlaveInfo {
|
||||
pub _type: ::std::os::raw::c_int,
|
||||
pub deviceid: ::std::os::raw::c_int,
|
||||
pub new_master: ::std::os::raw::c_int,
|
||||
}
|
||||
impl ::std::clone::Clone for XIAttachSlaveInfo {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIAttachSlaveInfo {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIDetachSlaveInfo {
|
||||
pub _type: ::std::os::raw::c_int,
|
||||
pub deviceid: ::std::os::raw::c_int,
|
||||
}
|
||||
impl ::std::clone::Clone for XIDetachSlaveInfo {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIDetachSlaveInfo {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIAnyHierarchyChangeInfo {
|
||||
pub _bindgen_data_: [u64; 3usize],
|
||||
}
|
||||
impl XIAnyHierarchyChangeInfo {
|
||||
pub unsafe fn _type(&mut self) -> *mut ::std::os::raw::c_int {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn add(&mut self) -> *mut XIAddMasterInfo {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn remove(&mut self) -> *mut XIRemoveMasterInfo {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn attach(&mut self) -> *mut XIAttachSlaveInfo {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn detach(&mut self) -> *mut XIDetachSlaveInfo {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
}
|
||||
impl ::std::clone::Clone for XIAnyHierarchyChangeInfo {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIAnyHierarchyChangeInfo {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIModifierState {
|
||||
pub base: ::std::os::raw::c_int,
|
||||
pub latched: ::std::os::raw::c_int,
|
||||
pub locked: ::std::os::raw::c_int,
|
||||
pub effective: ::std::os::raw::c_int,
|
||||
}
|
||||
impl ::std::clone::Clone for XIModifierState {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIModifierState {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
pub type XIGroupState = XIModifierState;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIButtonState {
|
||||
pub mask_len: ::std::os::raw::c_int,
|
||||
pub mask: *mut ::std::os::raw::c_uchar,
|
||||
}
|
||||
impl ::std::clone::Clone for XIButtonState {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIButtonState {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIValuatorState {
|
||||
pub mask_len: ::std::os::raw::c_int,
|
||||
pub mask: *mut ::std::os::raw::c_uchar,
|
||||
pub values: *mut ::std::os::raw::c_double,
|
||||
}
|
||||
impl ::std::clone::Clone for XIValuatorState {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIValuatorState {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIEventMask {
|
||||
pub deviceid: ::std::os::raw::c_int,
|
||||
pub mask_len: ::std::os::raw::c_int,
|
||||
pub mask: *mut ::std::os::raw::c_uchar,
|
||||
}
|
||||
impl ::std::clone::Clone for XIEventMask {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIEventMask {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIAnyClassInfo {
|
||||
pub _type: ::std::os::raw::c_int,
|
||||
pub sourceid: ::std::os::raw::c_int,
|
||||
}
|
||||
impl ::std::clone::Clone for XIAnyClassInfo {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIAnyClassInfo {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIButtonClassInfo {
|
||||
pub _type: ::std::os::raw::c_int,
|
||||
pub sourceid: ::std::os::raw::c_int,
|
||||
pub num_buttons: ::std::os::raw::c_int,
|
||||
pub labels: *mut Atom,
|
||||
pub state: XIButtonState,
|
||||
}
|
||||
impl ::std::clone::Clone for XIButtonClassInfo {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIButtonClassInfo {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIKeyClassInfo {
|
||||
pub _type: ::std::os::raw::c_int,
|
||||
pub sourceid: ::std::os::raw::c_int,
|
||||
pub num_keycodes: ::std::os::raw::c_int,
|
||||
pub keycodes: *mut ::std::os::raw::c_int,
|
||||
}
|
||||
impl ::std::clone::Clone for XIKeyClassInfo {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIKeyClassInfo {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIValuatorClassInfo {
|
||||
pub _type: ::std::os::raw::c_int,
|
||||
pub sourceid: ::std::os::raw::c_int,
|
||||
pub number: ::std::os::raw::c_int,
|
||||
pub label: Atom,
|
||||
pub min: ::std::os::raw::c_double,
|
||||
pub max: ::std::os::raw::c_double,
|
||||
pub value: ::std::os::raw::c_double,
|
||||
pub resolution: ::std::os::raw::c_int,
|
||||
pub mode: ::std::os::raw::c_int,
|
||||
}
|
||||
impl ::std::clone::Clone for XIValuatorClassInfo {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIValuatorClassInfo {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIScrollClassInfo {
|
||||
pub _type: ::std::os::raw::c_int,
|
||||
pub sourceid: ::std::os::raw::c_int,
|
||||
pub number: ::std::os::raw::c_int,
|
||||
pub scroll_type: ::std::os::raw::c_int,
|
||||
pub increment: ::std::os::raw::c_double,
|
||||
pub flags: ::std::os::raw::c_int,
|
||||
}
|
||||
impl ::std::clone::Clone for XIScrollClassInfo {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIScrollClassInfo {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XITouchClassInfo {
|
||||
pub _type: ::std::os::raw::c_int,
|
||||
pub sourceid: ::std::os::raw::c_int,
|
||||
pub mode: ::std::os::raw::c_int,
|
||||
pub num_touches: ::std::os::raw::c_int,
|
||||
}
|
||||
impl ::std::clone::Clone for XITouchClassInfo {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XITouchClassInfo {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIDeviceInfo {
|
||||
pub deviceid: ::std::os::raw::c_int,
|
||||
pub name: *mut ::std::os::raw::c_char,
|
||||
pub _use: ::std::os::raw::c_int,
|
||||
pub attachment: ::std::os::raw::c_int,
|
||||
pub enabled: ::std::os::raw::c_int,
|
||||
pub num_classes: ::std::os::raw::c_int,
|
||||
pub classes: *mut *mut XIAnyClassInfo,
|
||||
}
|
||||
impl ::std::clone::Clone for XIDeviceInfo {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIDeviceInfo {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIGrabModifiers {
|
||||
pub modifiers: ::std::os::raw::c_int,
|
||||
pub status: ::std::os::raw::c_int,
|
||||
}
|
||||
impl ::std::clone::Clone for XIGrabModifiers {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIGrabModifiers {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
pub type BarrierEventID = ::std::os::raw::c_uint;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIBarrierReleasePointerInfo {
|
||||
pub deviceid: ::std::os::raw::c_int,
|
||||
pub barrier: PointerBarrier,
|
||||
pub eventid: BarrierEventID,
|
||||
}
|
||||
impl ::std::clone::Clone for XIBarrierReleasePointerInfo {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIBarrierReleasePointerInfo {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIEvent {
|
||||
pub _type: ::std::os::raw::c_int,
|
||||
pub serial: ::std::os::raw::c_ulong,
|
||||
pub send_event: ::std::os::raw::c_int,
|
||||
pub display: *mut Display,
|
||||
pub extension: ::std::os::raw::c_int,
|
||||
pub evtype: ::std::os::raw::c_int,
|
||||
pub time: Time,
|
||||
}
|
||||
impl ::std::clone::Clone for XIEvent {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIEvent {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIHierarchyInfo {
|
||||
pub deviceid: ::std::os::raw::c_int,
|
||||
pub attachment: ::std::os::raw::c_int,
|
||||
pub _use: ::std::os::raw::c_int,
|
||||
pub enabled: ::std::os::raw::c_int,
|
||||
pub flags: ::std::os::raw::c_int,
|
||||
}
|
||||
impl ::std::clone::Clone for XIHierarchyInfo {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIHierarchyInfo {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIHierarchyEvent {
|
||||
pub _type: ::std::os::raw::c_int,
|
||||
pub serial: ::std::os::raw::c_ulong,
|
||||
pub send_event: ::std::os::raw::c_int,
|
||||
pub display: *mut Display,
|
||||
pub extension: ::std::os::raw::c_int,
|
||||
pub evtype: ::std::os::raw::c_int,
|
||||
pub time: Time,
|
||||
pub flags: ::std::os::raw::c_int,
|
||||
pub num_info: ::std::os::raw::c_int,
|
||||
pub info: *mut XIHierarchyInfo,
|
||||
}
|
||||
impl ::std::clone::Clone for XIHierarchyEvent {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIHierarchyEvent {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIDeviceChangedEvent {
|
||||
pub _type: ::std::os::raw::c_int,
|
||||
pub serial: ::std::os::raw::c_ulong,
|
||||
pub send_event: ::std::os::raw::c_int,
|
||||
pub display: *mut Display,
|
||||
pub extension: ::std::os::raw::c_int,
|
||||
pub evtype: ::std::os::raw::c_int,
|
||||
pub time: Time,
|
||||
pub deviceid: ::std::os::raw::c_int,
|
||||
pub sourceid: ::std::os::raw::c_int,
|
||||
pub reason: ::std::os::raw::c_int,
|
||||
pub num_classes: ::std::os::raw::c_int,
|
||||
pub classes: *mut *mut XIAnyClassInfo,
|
||||
}
|
||||
impl ::std::clone::Clone for XIDeviceChangedEvent {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIDeviceChangedEvent {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIDeviceEvent {
|
||||
pub _type: ::std::os::raw::c_int,
|
||||
pub serial: ::std::os::raw::c_ulong,
|
||||
pub send_event: ::std::os::raw::c_int,
|
||||
pub display: *mut Display,
|
||||
pub extension: ::std::os::raw::c_int,
|
||||
pub evtype: ::std::os::raw::c_int,
|
||||
pub time: Time,
|
||||
pub deviceid: ::std::os::raw::c_int,
|
||||
pub sourceid: ::std::os::raw::c_int,
|
||||
pub detail: ::std::os::raw::c_int,
|
||||
pub root: Window,
|
||||
pub event: Window,
|
||||
pub child: Window,
|
||||
pub root_x: ::std::os::raw::c_double,
|
||||
pub root_y: ::std::os::raw::c_double,
|
||||
pub event_x: ::std::os::raw::c_double,
|
||||
pub event_y: ::std::os::raw::c_double,
|
||||
pub flags: ::std::os::raw::c_int,
|
||||
pub buttons: XIButtonState,
|
||||
pub valuators: XIValuatorState,
|
||||
pub mods: XIModifierState,
|
||||
pub group: XIGroupState,
|
||||
}
|
||||
impl ::std::clone::Clone for XIDeviceEvent {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIDeviceEvent {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIRawEvent {
|
||||
pub _type: ::std::os::raw::c_int,
|
||||
pub serial: ::std::os::raw::c_ulong,
|
||||
pub send_event: ::std::os::raw::c_int,
|
||||
pub display: *mut Display,
|
||||
pub extension: ::std::os::raw::c_int,
|
||||
pub evtype: ::std::os::raw::c_int,
|
||||
pub time: Time,
|
||||
pub deviceid: ::std::os::raw::c_int,
|
||||
pub sourceid: ::std::os::raw::c_int,
|
||||
pub detail: ::std::os::raw::c_int,
|
||||
pub flags: ::std::os::raw::c_int,
|
||||
pub valuators: XIValuatorState,
|
||||
pub raw_values: *mut ::std::os::raw::c_double,
|
||||
}
|
||||
impl ::std::clone::Clone for XIRawEvent {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIRawEvent {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIEnterEvent {
|
||||
pub _type: ::std::os::raw::c_int,
|
||||
pub serial: ::std::os::raw::c_ulong,
|
||||
pub send_event: ::std::os::raw::c_int,
|
||||
pub display: *mut Display,
|
||||
pub extension: ::std::os::raw::c_int,
|
||||
pub evtype: ::std::os::raw::c_int,
|
||||
pub time: Time,
|
||||
pub deviceid: ::std::os::raw::c_int,
|
||||
pub sourceid: ::std::os::raw::c_int,
|
||||
pub detail: ::std::os::raw::c_int,
|
||||
pub root: Window,
|
||||
pub event: Window,
|
||||
pub child: Window,
|
||||
pub root_x: ::std::os::raw::c_double,
|
||||
pub root_y: ::std::os::raw::c_double,
|
||||
pub event_x: ::std::os::raw::c_double,
|
||||
pub event_y: ::std::os::raw::c_double,
|
||||
pub mode: ::std::os::raw::c_int,
|
||||
pub focus: ::std::os::raw::c_int,
|
||||
pub same_screen: ::std::os::raw::c_int,
|
||||
pub buttons: XIButtonState,
|
||||
pub mods: XIModifierState,
|
||||
pub group: XIGroupState,
|
||||
}
|
||||
impl ::std::clone::Clone for XIEnterEvent {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIEnterEvent {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
pub type XILeaveEvent = XIEnterEvent;
|
||||
pub type XIFocusInEvent = XIEnterEvent;
|
||||
pub type XIFocusOutEvent = XIEnterEvent;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIPropertyEvent {
|
||||
pub _type: ::std::os::raw::c_int,
|
||||
pub serial: ::std::os::raw::c_ulong,
|
||||
pub send_event: ::std::os::raw::c_int,
|
||||
pub display: *mut Display,
|
||||
pub extension: ::std::os::raw::c_int,
|
||||
pub evtype: ::std::os::raw::c_int,
|
||||
pub time: Time,
|
||||
pub deviceid: ::std::os::raw::c_int,
|
||||
pub property: Atom,
|
||||
pub what: ::std::os::raw::c_int,
|
||||
}
|
||||
impl ::std::clone::Clone for XIPropertyEvent {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIPropertyEvent {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XITouchOwnershipEvent {
|
||||
pub _type: ::std::os::raw::c_int,
|
||||
pub serial: ::std::os::raw::c_ulong,
|
||||
pub send_event: ::std::os::raw::c_int,
|
||||
pub display: *mut Display,
|
||||
pub extension: ::std::os::raw::c_int,
|
||||
pub evtype: ::std::os::raw::c_int,
|
||||
pub time: Time,
|
||||
pub deviceid: ::std::os::raw::c_int,
|
||||
pub sourceid: ::std::os::raw::c_int,
|
||||
pub touchid: ::std::os::raw::c_uint,
|
||||
pub root: Window,
|
||||
pub event: Window,
|
||||
pub child: Window,
|
||||
pub flags: ::std::os::raw::c_int,
|
||||
}
|
||||
impl ::std::clone::Clone for XITouchOwnershipEvent {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XITouchOwnershipEvent {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct XIBarrierEvent {
|
||||
pub _type: ::std::os::raw::c_int,
|
||||
pub serial: ::std::os::raw::c_ulong,
|
||||
pub send_event: ::std::os::raw::c_int,
|
||||
pub display: *mut Display,
|
||||
pub extension: ::std::os::raw::c_int,
|
||||
pub evtype: ::std::os::raw::c_int,
|
||||
pub time: Time,
|
||||
pub deviceid: ::std::os::raw::c_int,
|
||||
pub sourceid: ::std::os::raw::c_int,
|
||||
pub event: Window,
|
||||
pub root: Window,
|
||||
pub root_x: ::std::os::raw::c_double,
|
||||
pub root_y: ::std::os::raw::c_double,
|
||||
pub dx: ::std::os::raw::c_double,
|
||||
pub dy: ::std::os::raw::c_double,
|
||||
pub dtime: ::std::os::raw::c_int,
|
||||
pub flags: ::std::os::raw::c_int,
|
||||
pub barrier: PointerBarrier,
|
||||
pub eventid: BarrierEventID,
|
||||
}
|
||||
impl ::std::clone::Clone for XIBarrierEvent {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl ::std::default::Default for XIBarrierEvent {
|
||||
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,10 +0,0 @@
|
|||
use std::os::raw::c_void;
|
||||
use ::xlib::Display;
|
||||
|
||||
x11_link! { Xlib_xcb, xlib_xcb, ["libX11-xcb.so.1", "libX11-xcb.so"], 1,
|
||||
pub fn XGetXCBConnection(_1: *mut Display) -> *mut xcb_connection_t,
|
||||
variadic:
|
||||
globals:
|
||||
}
|
||||
|
||||
pub type xcb_connection_t = c_void;
|
|
@ -1,12 +0,0 @@
|
|||
pub type INT8 = i8;
|
||||
pub type INT16 = i16;
|
||||
pub type INT32 = i32;
|
||||
pub type INT64 = i64;
|
||||
|
||||
pub type CARD8 = u8;
|
||||
pub type CARD16 = u16;
|
||||
pub type CARD32 = u32;
|
||||
pub type CARD64 = u64;
|
||||
|
||||
pub type BYTE = CARD8;
|
||||
pub type BOOL = CARD8;
|
|
@ -1,199 +0,0 @@
|
|||
// x11-rs: Rust bindings for X11 libraries
|
||||
// The X11 libraries are available under the MIT license.
|
||||
// These bindings are public domain.
|
||||
|
||||
use std::os::raw::{
|
||||
c_char,
|
||||
c_int,
|
||||
c_uchar,
|
||||
c_uint,
|
||||
c_ulong,
|
||||
c_void,
|
||||
};
|
||||
use libc::FILE;
|
||||
|
||||
use ::xlib::{
|
||||
Display,
|
||||
GC,
|
||||
Screen,
|
||||
XColor,
|
||||
XComposeStatus,
|
||||
XErrorEvent,
|
||||
XEvent,
|
||||
XKeyEvent,
|
||||
XrmValue,
|
||||
XSizeHints,
|
||||
XStandardColormap,
|
||||
XVisualInfo,
|
||||
};
|
||||
use ::xt::{
|
||||
Widget,
|
||||
XtAppContext,
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// functions
|
||||
//
|
||||
|
||||
|
||||
x11_link! { Xmu, xmu, ["libXmu.so.6", "libXmu.so"], 132,
|
||||
pub fn XmuAddCloseDisplayHook (_3: *mut Display, _2: Option<unsafe extern "C" fn (*mut Display, *mut c_char) -> c_int>, _1: *mut c_char) -> *mut c_char,
|
||||
pub fn XmuAddInitializer (_2: Option<unsafe extern "C" fn (XtAppContext, *mut c_char)>, _1: *mut c_char) -> (),
|
||||
pub fn XmuAllStandardColormaps (_1: *mut Display) -> c_int,
|
||||
pub fn XmuAppendSegment (_2: *mut XmuSegment, _1: *mut XmuSegment) -> c_int,
|
||||
pub fn XmuAreaAnd (_2: *mut XmuArea, _1: *mut XmuArea) -> *mut XmuArea,
|
||||
pub fn XmuAreaCopy (_2: *mut XmuArea, _1: *mut XmuArea) -> *mut XmuArea,
|
||||
pub fn XmuAreaDup (_1: *mut XmuArea) -> *mut XmuArea,
|
||||
pub fn XmuAreaNot (_5: *mut XmuArea, _4: c_int, _3: c_int, _2: c_int, _1: c_int) -> *mut XmuArea,
|
||||
pub fn XmuAreaOrXor (_3: *mut XmuArea, _2: *mut XmuArea, _1: c_int) -> *mut XmuArea,
|
||||
pub fn XmuCallInitializers (_1: XtAppContext) -> (),
|
||||
pub fn XmuClientWindow (_2: *mut Display, _1: c_ulong) -> c_ulong,
|
||||
pub fn XmuCompareISOLatin1 (_2: *const c_char, _1: *const c_char) -> c_int,
|
||||
pub fn XmuConvertStandardSelection (_8: Widget, _7: c_ulong, _6: *mut c_ulong, _5: *mut c_ulong, _4: *mut c_ulong, _3: *mut *mut c_char, _2: *mut c_ulong, _1: *mut c_int) -> c_char,
|
||||
pub fn XmuCopyISOLatin1Lowered (_2: *mut c_char, _1: *const c_char) -> (),
|
||||
pub fn XmuCopyISOLatin1Uppered (_2: *mut c_char, _1: *const c_char) -> (),
|
||||
pub fn XmuCreateColormap (_2: *mut Display, _1: *mut XStandardColormap) -> c_int,
|
||||
pub fn XmuCreatePixmapFromBitmap (_8: *mut Display, _7: c_ulong, _6: c_ulong, _5: c_uint, _4: c_uint, _3: c_uint, _2: c_ulong, _1: c_ulong) -> c_ulong,
|
||||
pub fn XmuCreateStippledPixmap (_4: *mut Screen, _3: c_ulong, _2: c_ulong, _1: c_uint) -> c_ulong,
|
||||
pub fn XmuCursorNameToIndex (_1: *const c_char) -> c_int,
|
||||
pub fn XmuCvtBackingStoreToString (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XmuCvtFunctionToCallback (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (),
|
||||
pub fn XmuCvtGravityToString (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XmuCvtJustifyToString (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XmuCvtLongToString (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XmuCvtOrientationToString (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XmuCvtShapeStyleToString (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XmuCvtStringToBackingStore (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (),
|
||||
pub fn XmuCvtStringToBitmap (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (),
|
||||
pub fn XmuCvtStringToColorCursor (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XmuCvtStringToCursor (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (),
|
||||
pub fn XmuCvtStringToGravity (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (),
|
||||
pub fn XmuCvtStringToJustify (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (),
|
||||
pub fn XmuCvtStringToLong (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (),
|
||||
pub fn XmuCvtStringToOrientation (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (),
|
||||
pub fn XmuCvtStringToShapeStyle (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XmuCvtStringToWidget (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (),
|
||||
pub fn XmuCvtWidgetToString (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XmuDeleteStandardColormap (_3: *mut Display, _2: c_int, _1: c_ulong) -> (),
|
||||
pub fn XmuDestroyScanlineList (_1: *mut XmuScanline) -> (),
|
||||
pub fn XmuDestroySegmentList (_1: *mut XmuSegment) -> (),
|
||||
pub fn XmuDistinguishableColors (_2: *mut XColor, _1: c_int) -> c_int,
|
||||
pub fn XmuDistinguishablePixels (_4: *mut Display, _3: c_ulong, _2: *mut c_ulong, _1: c_int) -> c_int,
|
||||
pub fn XmuDQAddDisplay (_3: *mut XmuDisplayQueue, _2: *mut Display, _1: *mut c_char) -> *mut XmuDisplayQueueEntry,
|
||||
pub fn XmuDQCreate (_3: Option<unsafe extern "C" fn (*mut XmuDisplayQueue, *mut XmuDisplayQueueEntry) -> c_int>, _2: Option<unsafe extern "C" fn (*mut XmuDisplayQueue) -> c_int>, _1: *mut c_char) -> *mut XmuDisplayQueue,
|
||||
pub fn XmuDQDestroy (_2: *mut XmuDisplayQueue, _1: c_int) -> c_int,
|
||||
pub fn XmuDQLookupDisplay (_2: *mut XmuDisplayQueue, _1: *mut Display) -> *mut XmuDisplayQueueEntry,
|
||||
pub fn XmuDQRemoveDisplay (_2: *mut XmuDisplayQueue, _1: *mut Display) -> c_int,
|
||||
pub fn XmuDrawLogo (_8: *mut Display, _7: c_ulong, _6: GC, _5: GC, _4: c_int, _3: c_int, _2: c_uint, _1: c_uint) -> (),
|
||||
pub fn XmuDrawRoundedRectangle (_9: *mut Display, _8: c_ulong, _7: GC, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: c_int) -> (),
|
||||
pub fn XmuFillRoundedRectangle (_9: *mut Display, _8: c_ulong, _7: GC, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: c_int) -> (),
|
||||
pub fn XmuGetAtomName (_2: *mut Display, _1: c_ulong) -> *mut c_char,
|
||||
pub fn XmuGetColormapAllocation (_5: *mut XVisualInfo, _4: c_ulong, _3: *mut c_ulong, _2: *mut c_ulong, _1: *mut c_ulong) -> c_int,
|
||||
pub fn XmuGetHostname (_2: *mut c_char, _1: c_int) -> c_int,
|
||||
pub fn XmuInternAtom (_2: *mut Display, _1: AtomPtr) -> c_ulong,
|
||||
pub fn XmuInternStrings (_4: *mut Display, _3: *mut *mut c_char, _2: c_uint, _1: *mut c_ulong) -> (),
|
||||
pub fn XmuLocateBitmapFile (_8: *mut Screen, _7: *const c_char, _6: *mut c_char, _5: c_int, _4: *mut c_int, _3: *mut c_int, _2: *mut c_int, _1: *mut c_int) -> c_ulong,
|
||||
pub fn XmuLocatePixmapFile (_11: *mut Screen, _10: *const c_char, _9: c_ulong, _8: c_ulong, _7: c_uint, _6: *mut c_char, _5: c_int, _4: *mut c_int, _3: *mut c_int, _2: *mut c_int, _1: *mut c_int) -> c_ulong,
|
||||
pub fn XmuLookupAPL (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int,
|
||||
pub fn XmuLookupArabic (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int,
|
||||
pub fn XmuLookupCloseDisplayHook (_4: *mut Display, _3: *mut c_char, _2: Option<unsafe extern "C" fn (*mut Display, *mut c_char) -> c_int>, _1: *mut c_char) -> c_int,
|
||||
pub fn XmuLookupCyrillic (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int,
|
||||
pub fn XmuLookupGreek (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int,
|
||||
pub fn XmuLookupHebrew (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int,
|
||||
pub fn XmuLookupJISX0201 (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int,
|
||||
pub fn XmuLookupKana (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int,
|
||||
pub fn XmuLookupLatin1 (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int,
|
||||
pub fn XmuLookupLatin2 (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int,
|
||||
pub fn XmuLookupLatin3 (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int,
|
||||
pub fn XmuLookupLatin4 (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int,
|
||||
pub fn XmuLookupStandardColormap (_7: *mut Display, _6: c_int, _5: c_ulong, _4: c_uint, _3: c_ulong, _2: c_int, _1: c_int) -> c_int,
|
||||
pub fn XmuLookupString (_6: *mut XKeyEvent, _5: *mut c_uchar, _4: c_int, _3: *mut c_ulong, _2: *mut XComposeStatus, _1: c_ulong) -> c_int,
|
||||
pub fn XmuMakeAtom (_1: *const c_char) -> AtomPtr,
|
||||
pub fn XmuNameOfAtom (_1: AtomPtr) -> *mut c_char,
|
||||
pub fn XmuNCopyISOLatin1Lowered (_3: *mut c_char, _2: *const c_char, _1: c_int) -> (),
|
||||
pub fn XmuNCopyISOLatin1Uppered (_3: *mut c_char, _2: *const c_char, _1: c_int) -> (),
|
||||
pub fn XmuNewArea (_4: c_int, _3: c_int, _2: c_int, _1: c_int) -> *mut XmuArea,
|
||||
pub fn XmuNewCvtStringToWidget (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XmuNewScanline (_3: c_int, _2: c_int, _1: c_int) -> *mut XmuScanline,
|
||||
pub fn XmuNewSegment (_2: c_int, _1: c_int) -> *mut XmuSegment,
|
||||
pub fn XmuOptimizeArea (_1: *mut XmuArea) -> *mut XmuArea,
|
||||
pub fn XmuOptimizeScanline (_1: *mut XmuScanline) -> *mut XmuScanline,
|
||||
pub fn XmuPrintDefaultErrorMessage (_3: *mut Display, _2: *mut XErrorEvent, _1: *mut FILE) -> c_int,
|
||||
pub fn XmuReadBitmapData (_6: *mut FILE, _5: *mut c_uint, _4: *mut c_uint, _3: *mut *mut c_uchar, _2: *mut c_int, _1: *mut c_int) -> c_int,
|
||||
pub fn XmuReadBitmapDataFromFile (_6: *const c_char, _5: *mut c_uint, _4: *mut c_uint, _3: *mut *mut c_uchar, _2: *mut c_int, _1: *mut c_int) -> c_int,
|
||||
pub fn XmuRegisterExternalAgent (_4: Widget, _3: *mut c_void, _2: *mut XEvent, _1: *mut c_char) -> (),
|
||||
pub fn XmuReleaseStippledPixmap (_2: *mut Screen, _1: c_ulong) -> (),
|
||||
pub fn XmuRemoveCloseDisplayHook (_4: *mut Display, _3: *mut c_char, _2: Option<unsafe extern "C" fn (*mut Display, *mut c_char) -> c_int>, _1: *mut c_char) -> c_int,
|
||||
pub fn XmuReshapeWidget (_4: Widget, _3: c_int, _2: c_int, _1: c_int) -> c_char,
|
||||
pub fn XmuScanlineAnd (_2: *mut XmuScanline, _1: *mut XmuScanline) -> *mut XmuScanline,
|
||||
pub fn XmuScanlineAndSegment (_2: *mut XmuScanline, _1: *mut XmuSegment) -> *mut XmuScanline,
|
||||
pub fn XmuScanlineCopy (_2: *mut XmuScanline, _1: *mut XmuScanline) -> *mut XmuScanline,
|
||||
pub fn XmuScanlineEqu (_2: *mut XmuScanline, _1: *mut XmuScanline) -> c_int,
|
||||
pub fn XmuScanlineNot (_3: *mut XmuScanline, _2: c_int, _1: c_int) -> *mut XmuScanline,
|
||||
pub fn XmuScanlineOr (_2: *mut XmuScanline, _1: *mut XmuScanline) -> *mut XmuScanline,
|
||||
pub fn XmuScanlineOrSegment (_2: *mut XmuScanline, _1: *mut XmuSegment) -> *mut XmuScanline,
|
||||
pub fn XmuScanlineXor (_2: *mut XmuScanline, _1: *mut XmuScanline) -> *mut XmuScanline,
|
||||
pub fn XmuScanlineXorSegment (_2: *mut XmuScanline, _1: *mut XmuSegment) -> *mut XmuScanline,
|
||||
pub fn XmuScreenOfWindow (_2: *mut Display, _1: c_ulong) -> *mut Screen,
|
||||
pub fn XmuSimpleErrorHandler (_2: *mut Display, _1: *mut XErrorEvent) -> c_int,
|
||||
pub fn XmuStandardColormap (_9: *mut Display, _8: c_int, _7: c_ulong, _6: c_uint, _5: c_ulong, _4: c_ulong, _3: c_ulong, _2: c_ulong, _1: c_ulong) -> *mut XStandardColormap,
|
||||
pub fn XmuUpdateMapHints (_3: *mut Display, _2: c_ulong, _1: *mut XSizeHints) -> c_int,
|
||||
pub fn XmuValidArea (_1: *mut XmuArea) -> c_int,
|
||||
pub fn XmuValidScanline (_1: *mut XmuScanline) -> c_int,
|
||||
pub fn XmuVisualStandardColormaps (_6: *mut Display, _5: c_int, _4: c_ulong, _3: c_uint, _2: c_int, _1: c_int) -> c_int,
|
||||
pub fn XmuWnCountOwnedResources (_3: *mut XmuWidgetNode, _2: *mut XmuWidgetNode, _1: c_int) -> c_int,
|
||||
pub fn XmuWnFetchResources (_3: *mut XmuWidgetNode, _2: Widget, _1: *mut XmuWidgetNode) -> (),
|
||||
pub fn XmuWnInitializeNodes (_2: *mut XmuWidgetNode, _1: c_int) -> (),
|
||||
pub fn XmuWnNameToNode (_3: *mut XmuWidgetNode, _2: c_int, _1: *const c_char) -> *mut XmuWidgetNode,
|
||||
variadic:
|
||||
pub fn XmuSnprintf (_3: *mut c_char, _2: c_int, _1: *const c_char) -> c_int,
|
||||
globals:
|
||||
pub static _XA_ATOM_PAIR: AtomPtr,
|
||||
pub static _XA_CHARACTER_POSITION: AtomPtr,
|
||||
pub static _XA_CLASS: AtomPtr,
|
||||
pub static _XA_CLIENT_WINDOW: AtomPtr,
|
||||
pub static _XA_CLIPBOARD: AtomPtr,
|
||||
pub static _XA_COMPOUND_TEXT: AtomPtr,
|
||||
pub static _XA_DECNET_ADDRESS: AtomPtr,
|
||||
pub static _XA_DELETE: AtomPtr,
|
||||
pub static _XA_FILENAME: AtomPtr,
|
||||
pub static _XA_HOSTNAME: AtomPtr,
|
||||
pub static _XA_IP_ADDRESS: AtomPtr,
|
||||
pub static _XA_LENGTH: AtomPtr,
|
||||
pub static _XA_LIST_LENGTH: AtomPtr,
|
||||
pub static _XA_NAME: AtomPtr,
|
||||
pub static _XA_NET_ADDRESS: AtomPtr,
|
||||
pub static _XA_NULL: AtomPtr,
|
||||
pub static _XA_OWNER_OS: AtomPtr,
|
||||
pub static _XA_SPAN: AtomPtr,
|
||||
pub static _XA_TARGETS: AtomPtr,
|
||||
pub static _XA_TEXT: AtomPtr,
|
||||
pub static _XA_TIMESTAMP: AtomPtr,
|
||||
pub static _XA_USER: AtomPtr,
|
||||
pub static _XA_UTF8_STRING: AtomPtr,
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// types
|
||||
//
|
||||
|
||||
|
||||
// TODO structs
|
||||
#[repr(C)] pub struct _AtomRec;
|
||||
#[repr(C)] pub struct _XmuArea;
|
||||
#[repr(C)] pub struct _XmuDisplayQueue;
|
||||
#[repr(C)] pub struct _XmuDisplayQueueEntry;
|
||||
#[repr(C)] pub struct _XmuScanline;
|
||||
#[repr(C)] pub struct _XmuSegment;
|
||||
#[repr(C)] pub struct _XmuWidgetNode;
|
||||
|
||||
// struct typedefs
|
||||
pub type AtomPtr = *mut _AtomRec;
|
||||
pub type XmuArea = _XmuArea;
|
||||
pub type XmuDisplayQueue = _XmuDisplayQueue;
|
||||
pub type XmuDisplayQueueEntry = _XmuDisplayQueueEntry;
|
||||
pub type XmuScanline = _XmuScanline;
|
||||
pub type XmuSegment = _XmuSegment;
|
||||
pub type XmuWidgetNode = _XmuWidgetNode;
|
|
@ -1,558 +0,0 @@
|
|||
// x11-rs: Rust bindings for X11 libraries
|
||||
// The X11 libraries are available under the MIT license.
|
||||
// These bindings are public domain.
|
||||
|
||||
use std::os::raw::{ c_char, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort };
|
||||
|
||||
use xlib::{ Atom, Bool, Display, Drawable, Status, Time, XEvent, XID, Window };
|
||||
use xrender::{ XFixed, XTransform };
|
||||
|
||||
|
||||
//
|
||||
// functions
|
||||
//
|
||||
|
||||
|
||||
x11_link! { Xrandr, xrandr, ["libXrandr.so.2", "libXrandr.so"], 70,
|
||||
pub fn XRRAddOutputMode (dpy: *mut Display, output: RROutput, mode: RRMode) -> (),
|
||||
pub fn XRRAllocGamma (size: c_int) -> *mut XRRCrtcGamma,
|
||||
pub fn XRRAllocModeInfo (name: *const c_char, nameLength: c_int) -> *mut XRRModeInfo,
|
||||
pub fn XRRAllocateMonitor (dpy: *mut Display, noutput: c_int) -> *mut XRRMonitorInfo,
|
||||
pub fn XRRChangeOutputProperty (dpy: *mut Display, output: RROutput, property: Atom, type_: Atom, format: c_int, mode: c_int, data: *const c_uchar, nelements: c_int) -> (),
|
||||
pub fn XRRChangeProviderProperty (dpy: *mut Display, provider: RRProvider, property: Atom, type_: Atom, format: c_int, mode: c_int, data: *const c_uchar, nelements: c_int) -> (),
|
||||
pub fn XRRConfigCurrentConfiguration (config: *mut XRRScreenConfiguration, rotation: *mut Rotation) -> SizeID,
|
||||
pub fn XRRConfigCurrentRate (config: *mut XRRScreenConfiguration) -> c_short,
|
||||
pub fn XRRConfigRates (config: *mut XRRScreenConfiguration, sizeID: c_int, nrates: *mut c_int) -> *mut c_short,
|
||||
pub fn XRRConfigRotations (config: *mut XRRScreenConfiguration, current_rotation: *mut Rotation) -> Rotation,
|
||||
pub fn XRRConfigSizes (config: *mut XRRScreenConfiguration, nsizes: *mut c_int) -> *mut XRRScreenSize,
|
||||
pub fn XRRConfigTimes (config: *mut XRRScreenConfiguration, config_timestamp: *mut Time) -> Time,
|
||||
pub fn XRRConfigureOutputProperty (dpy: *mut Display, output: RROutput, property: Atom, pending: Bool, range: Bool, num_values: c_int, values: *mut c_long) -> (),
|
||||
pub fn XRRConfigureProviderProperty (dpy: *mut Display, provider: RRProvider, property: Atom, pending: Bool, range: Bool, num_values: c_int, values: *mut c_long) -> (),
|
||||
pub fn XRRCreateMode (dpy: *mut Display, window: Window, modeInfo: *mut XRRModeInfo) -> RRMode,
|
||||
pub fn XRRDeleteMonitor (dpy: *mut Display, window: Window, name: Atom) -> (),
|
||||
pub fn XRRDeleteOutputMode (dpy: *mut Display, output: RROutput, mode: RRMode) -> (),
|
||||
pub fn XRRDeleteOutputProperty (dpy: *mut Display, output: RROutput, property: Atom) -> (),
|
||||
pub fn XRRDeleteProviderProperty (dpy: *mut Display, provider: RRProvider, property: Atom) -> (),
|
||||
pub fn XRRDestroyMode (dpy: *mut Display, mode: RRMode) -> (),
|
||||
pub fn XRRFreeCrtcInfo (crtcInfo: *mut XRRCrtcInfo) -> (),
|
||||
pub fn XRRFreeGamma (gamma: *mut XRRCrtcGamma) -> (),
|
||||
pub fn XRRFreeModeInfo (modeInfo: *mut XRRModeInfo) -> (),
|
||||
pub fn XRRFreeMonitors (monitors: *mut XRRMonitorInfo) -> (),
|
||||
pub fn XRRFreeOutputInfo (outputInfo: *mut XRROutputInfo) -> (),
|
||||
pub fn XRRFreePanning (panning: *mut XRRPanning) -> (),
|
||||
pub fn XRRFreeProviderInfo (provider: *mut XRRProviderInfo) -> (),
|
||||
pub fn XRRFreeProviderResources (resources: *mut XRRProviderResources) -> (),
|
||||
pub fn XRRFreeScreenConfigInfo (config: *mut XRRScreenConfiguration) -> (),
|
||||
pub fn XRRFreeScreenResources (resources: *mut XRRScreenResources) -> (),
|
||||
pub fn XRRGetCrtcGamma (dpy: *mut Display, crtc: RRCrtc) -> *mut XRRCrtcGamma,
|
||||
pub fn XRRGetCrtcGammaSize (dpy: *mut Display, crtc: RRCrtc) -> c_int,
|
||||
pub fn XRRGetCrtcInfo (dpy: *mut Display, resources: *mut XRRScreenResources, crtc: RRCrtc) -> *mut XRRCrtcInfo,
|
||||
pub fn XRRGetCrtcTransform (dpy: *mut Display, crtc: RRCrtc, attributes: *mut *mut XRRCrtcTransformAttributes) -> Status,
|
||||
pub fn XRRGetMonitors (dpy: *mut Display, window: Window, get_active: Bool, nmonitors: *mut c_int) -> *mut XRRMonitorInfo,
|
||||
pub fn XRRGetOutputInfo (dpy: *mut Display, resources: *mut XRRScreenResources, output: RROutput) -> *mut XRROutputInfo,
|
||||
pub fn XRRGetOutputPrimary (dpy: *mut Display, window: Window) -> RROutput,
|
||||
pub fn XRRGetOutputProperty (dpy: *mut Display, output: RROutput, property: Atom, offset: c_long, length: c_long, _delete: Bool, pending: Bool, req_type: Atom, actual_type: *mut Atom, actual_format: *mut c_int, nitems: *mut c_ulong, bytes_after: *mut c_ulong, prop: *mut *mut c_uchar) -> c_int,
|
||||
pub fn XRRGetPanning (dpy: *mut Display, resources: *mut XRRScreenResources, crtc: RRCrtc) -> *mut XRRPanning,
|
||||
pub fn XRRGetProviderInfo (dpy: *mut Display, resources: *mut XRRScreenResources, provider: RRProvider) -> *mut XRRProviderInfo,
|
||||
pub fn XRRGetProviderProperty (dpy: *mut Display, provider: RRProvider, property: Atom, offset: c_long, length: c_long, _delete: Bool, pending: Bool, req_type: Atom, actual_type: *mut Atom, actual_format: *mut c_int, nitems: *mut c_ulong, bytes_after: *mut c_ulong, prop: *mut *mut c_uchar) -> c_int,
|
||||
pub fn XRRGetProviderResources (dpy: *mut Display, window: Window) -> *mut XRRProviderResources,
|
||||
pub fn XRRGetScreenInfo (dpy: *mut Display, window: Window) -> *mut XRRScreenConfiguration,
|
||||
pub fn XRRGetScreenResources (dpy: *mut Display, window: Window) -> *mut XRRScreenResources,
|
||||
pub fn XRRGetScreenResourcesCurrent (dpy: *mut Display, window: Window) -> *mut XRRScreenResources,
|
||||
pub fn XRRGetScreenSizeRange (dpy: *mut Display, window: Window, minWidth: *mut c_int, minHeight: *mut c_int, maxWidth: *mut c_int, maxHeight: *mut c_int) -> Status,
|
||||
pub fn XRRListOutputProperties (dpy: *mut Display, output: RROutput, nprop: *mut c_int) -> *mut Atom,
|
||||
pub fn XRRListProviderProperties (dpy: *mut Display, provider: RRProvider, nprop: *mut c_int) -> *mut Atom,
|
||||
pub fn XRRQueryExtension (dpy: *mut Display, event_base_return: *mut c_int, error_base_return: *mut c_int) -> Bool,
|
||||
pub fn XRRQueryOutputProperty (dpy: *mut Display, output: RROutput, property: Atom) -> *mut XRRPropertyInfo,
|
||||
pub fn XRRQueryProviderProperty (dpy: *mut Display, provider: RRProvider, property: Atom) -> *mut XRRPropertyInfo,
|
||||
pub fn XRRQueryVersion (dpy: *mut Display, major_version_return: *mut c_int, minor_version_return: *mut c_int) -> Status,
|
||||
pub fn XRRRates (dpy: *mut Display, screen: c_int, sizeID: c_int, nrates: *mut c_int) -> *mut c_short,
|
||||
pub fn XRRRootToScreen (dpy: *mut Display, root: Window) -> c_int,
|
||||
pub fn XRRRotations (dpy: *mut Display, screen: c_int, current_rotation: *mut Rotation) -> Rotation,
|
||||
pub fn XRRSelectInput (dpy: *mut Display, window: Window, mask: c_int) -> (),
|
||||
pub fn XRRSetCrtcConfig (dpy: *mut Display, resources: *mut XRRScreenResources, crtc: RRCrtc, timestamp: Time, x: c_int, y: c_int, mode: RRMode, rotation: Rotation, outputs: *mut RROutput, noutputs: c_int) -> Status,
|
||||
pub fn XRRSetCrtcGamma (dpy: *mut Display, crtc: RRCrtc, gamma: *mut XRRCrtcGamma) -> (),
|
||||
pub fn XRRSetCrtcTransform (dpy: *mut Display, crtc: RRCrtc, transform: *mut XTransform, filter: *const c_char, params: *mut XFixed, nparams: c_int) -> (),
|
||||
pub fn XRRSetMonitor (dpy: *mut Display, window: Window, monitor: *mut XRRMonitorInfo) -> (),
|
||||
pub fn XRRSetOutputPrimary (dpy: *mut Display, window: Window, output: RROutput) -> (),
|
||||
pub fn XRRSetPanning (dpy: *mut Display, resources: *mut XRRScreenResources, crtc: RRCrtc, panning: *mut XRRPanning) -> Status,
|
||||
pub fn XRRSetProviderOffloadSink (dpy: *mut Display, provider: XID, sink_provider: XID) -> c_int,
|
||||
pub fn XRRSetProviderOutputSource (dpy: *mut Display, provider: XID, source_provider: XID) -> c_int,
|
||||
pub fn XRRSetScreenConfig (dpy: *mut Display, config: *mut XRRScreenConfiguration, draw: Drawable, size_index: c_int, rotation: Rotation, timestamp: Time) -> Status,
|
||||
pub fn XRRSetScreenConfigAndRate (dpy: *mut Display, config: *mut XRRScreenConfiguration, draw: Drawable, size_index: c_int, rotation: Rotation, rate: c_short, timestamp: Time) -> Status,
|
||||
pub fn XRRSetScreenSize (dpy: *mut Display, window: Window, width: c_int, height: c_int, mmWidth: c_int, mmHeight: c_int) -> (),
|
||||
pub fn XRRSizes (dpy: *mut Display, screen: c_int, nsizes: *mut c_int) -> *mut XRRScreenSize,
|
||||
pub fn XRRTimes (dpy: *mut Display, screen: c_int, config_timestamp: *mut Time) -> Time,
|
||||
pub fn XRRUpdateConfiguration (event: *mut XEvent) -> c_int,
|
||||
variadic:
|
||||
globals:
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// types
|
||||
//
|
||||
|
||||
|
||||
pub type Connection = c_ushort;
|
||||
pub type Rotation = c_ushort;
|
||||
pub type SizeID = c_ushort;
|
||||
pub type SubpixelOrder = c_ushort;
|
||||
|
||||
pub type RROutput = XID;
|
||||
pub type RRCrtc = XID;
|
||||
pub type RRMode = XID;
|
||||
pub type RRProvider = XID;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRRScreenSize {
|
||||
pub width: c_int,
|
||||
pub height: c_int,
|
||||
pub mwidth: c_int,
|
||||
pub mheight: c_int,
|
||||
}
|
||||
|
||||
#[repr(C)] pub struct XRRScreenConfiguration;
|
||||
|
||||
pub type XRRModeFlags = c_ulong;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRRModeInfo {
|
||||
pub id: RRMode,
|
||||
pub width: c_uint,
|
||||
pub height: c_uint,
|
||||
pub dotClock: c_ulong,
|
||||
pub hSyncStart: c_uint,
|
||||
pub hSyncEnd: c_uint,
|
||||
pub hTotal: c_uint,
|
||||
pub hSkew: c_uint,
|
||||
pub vSyncStart: c_uint,
|
||||
pub vSyncEnd: c_uint,
|
||||
pub vTotal: c_uint,
|
||||
pub name: *mut c_char,
|
||||
pub nameLength: c_uint,
|
||||
pub modeFlags: XRRModeFlags,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRRScreenResources {
|
||||
pub timestamp: Time,
|
||||
pub configTimestamp: Time,
|
||||
pub ncrtc: c_int,
|
||||
pub crtcs: *mut RRCrtc,
|
||||
pub noutput: c_int,
|
||||
pub outputs: *mut RROutput,
|
||||
pub nmode: c_int,
|
||||
pub modes: *mut XRRModeInfo,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRROutputInfo {
|
||||
pub timestamp: Time,
|
||||
pub crtc: RRCrtc,
|
||||
pub name: *mut c_char,
|
||||
pub nameLen: c_int,
|
||||
pub mm_width: c_ulong,
|
||||
pub mm_height: c_ulong,
|
||||
pub connection: Connection,
|
||||
pub subpixel_order: SubpixelOrder,
|
||||
pub ncrtc: c_int,
|
||||
pub crtcs: *mut RRCrtc,
|
||||
pub nclone: c_int,
|
||||
pub clones: *mut RROutput,
|
||||
pub nmode: c_int,
|
||||
pub npreferred: c_int,
|
||||
pub modes: *mut RRMode,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRRPropertyInfo {
|
||||
pub pending: Bool,
|
||||
pub range: Bool,
|
||||
pub immutable: Bool,
|
||||
pub num_values: c_int,
|
||||
pub values: *mut c_long,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRRCrtcInfo {
|
||||
pub timestamp: Time,
|
||||
pub x: c_int,
|
||||
pub y: c_int,
|
||||
pub width: c_uint,
|
||||
pub height: c_uint,
|
||||
pub mode: RRMode,
|
||||
pub rotation: Rotation,
|
||||
pub noutput: c_int,
|
||||
pub outputs: *mut RROutput,
|
||||
pub rotations: Rotation,
|
||||
pub npossible: c_int,
|
||||
pub possible: *mut RROutput,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRRCrtcGamma {
|
||||
pub size: c_int,
|
||||
pub red: *mut c_ushort,
|
||||
pub green: *mut c_ushort,
|
||||
pub blue: *mut c_ushort,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRRCrtcTransformAttributes {
|
||||
pub pendingTransform: XTransform,
|
||||
pub pendingFilter: *mut c_char,
|
||||
pub pendingNparams: c_int,
|
||||
pub pendingParams: *mut XFixed,
|
||||
pub currentTransform: XTransform,
|
||||
pub currentFilter: *mut c_char,
|
||||
pub currentNparams: c_int,
|
||||
pub currentParams: *mut XFixed,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRRPanning {
|
||||
pub timestamp: Time,
|
||||
pub left: c_uint,
|
||||
pub top: c_uint,
|
||||
pub width: c_uint,
|
||||
pub height: c_uint,
|
||||
pub track_left: c_uint,
|
||||
pub track_top: c_uint,
|
||||
pub track_width: c_uint,
|
||||
pub track_height: c_uint,
|
||||
pub border_left: c_int,
|
||||
pub border_top: c_int,
|
||||
pub border_right: c_int,
|
||||
pub border_bottom: c_int,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRRProviderResources {
|
||||
pub timestamp: Time,
|
||||
pub nproviders: c_int,
|
||||
pub providers: *mut RRProvider,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRRProviderInfo {
|
||||
pub capabilities: c_uint,
|
||||
pub ncrtcs: c_int,
|
||||
pub crtcs: *mut RRCrtc,
|
||||
pub noutputs: c_int,
|
||||
pub outputs: *mut RROutput,
|
||||
pub name: *mut c_char,
|
||||
pub nassociatedproviders: c_int,
|
||||
pub associated_providers: *mut RRProvider,
|
||||
pub associated_capability: *mut c_uint,
|
||||
pub nameLen: c_int,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRRMonitorInfo {
|
||||
pub name: Atom,
|
||||
pub primary: Bool,
|
||||
pub automatic: Bool,
|
||||
pub noutput: c_int,
|
||||
pub x: c_int,
|
||||
pub y: c_int,
|
||||
pub width: c_int,
|
||||
pub height: c_int,
|
||||
pub mwidth: c_int,
|
||||
pub mheight: c_int,
|
||||
pub outputs: *mut RROutput,
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// event structures
|
||||
//
|
||||
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRRScreenChangeNotifyEvent {
|
||||
pub type_: c_int,
|
||||
pub serial: c_ulong,
|
||||
pub send_event: Bool,
|
||||
pub display: *mut Display,
|
||||
pub window: Window,
|
||||
pub root: Window,
|
||||
pub timestamp: Time,
|
||||
pub config_timestamp: Time,
|
||||
pub size_index: SizeID,
|
||||
pub subpixel_order: SubpixelOrder,
|
||||
pub rotation: Rotation,
|
||||
pub width: c_int,
|
||||
pub height: c_int,
|
||||
pub mwidth: c_int,
|
||||
pub mheight: c_int,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRRNotifyEvent {
|
||||
pub type_: c_int,
|
||||
pub serial: c_ulong,
|
||||
pub send_event: Bool,
|
||||
pub display: *mut Display,
|
||||
pub window: Window,
|
||||
pub subtype: c_int,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRROutputChangeNotifyEvent {
|
||||
pub type_: c_int,
|
||||
pub serial: c_ulong,
|
||||
pub send_event: Bool,
|
||||
pub display: *mut Display,
|
||||
pub window: Window,
|
||||
pub subtype: c_int,
|
||||
pub output: RROutput,
|
||||
pub crtc: RRCrtc,
|
||||
pub mode: RRMode,
|
||||
pub rotation: Rotation,
|
||||
pub connection: Connection,
|
||||
pub subpixel_order: SubpixelOrder,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRRCrtcChangeNotifyEvent {
|
||||
pub type_: c_int,
|
||||
pub serial: c_ulong,
|
||||
pub send_event: Bool,
|
||||
pub display: *mut Display,
|
||||
pub window: Window,
|
||||
pub subtype: c_int,
|
||||
pub crtc: RRCrtc,
|
||||
pub mode: RRMode,
|
||||
pub rotation: Rotation,
|
||||
pub x: c_int,
|
||||
pub y: c_int,
|
||||
pub width: c_uint,
|
||||
pub height: c_uint,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRROutputPropertyNotifyEvent {
|
||||
pub type_: c_int,
|
||||
pub serial: c_ulong,
|
||||
pub send_event: Bool,
|
||||
pub display: *mut Display,
|
||||
pub window: Window,
|
||||
pub subtype: c_int,
|
||||
pub output: RROutput,
|
||||
pub property: Atom,
|
||||
pub timestamp: Time,
|
||||
pub state: c_int,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRRProviderChangeNotifyEvent {
|
||||
pub type_: c_int,
|
||||
pub serial: c_ulong,
|
||||
pub send_event: Bool,
|
||||
pub display: *mut Display,
|
||||
pub window: Window,
|
||||
pub subtype: c_int,
|
||||
pub provider: RRProvider,
|
||||
pub timestamp: Time,
|
||||
pub current_role: c_uint,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRRProviderPropertyNotifyEvent {
|
||||
pub type_: c_int,
|
||||
pub serial: c_ulong,
|
||||
pub send_event: Bool,
|
||||
pub display: *mut Display,
|
||||
pub window: Window,
|
||||
pub subtype: c_int,
|
||||
pub provider: RRProvider,
|
||||
pub property: Atom,
|
||||
pub timestamp: Time,
|
||||
pub state: c_int,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRRResourceChangeNotifyEvent {
|
||||
pub type_: c_int,
|
||||
pub serial: c_ulong,
|
||||
pub send_event: Bool,
|
||||
pub display: *mut Display,
|
||||
pub window: Window,
|
||||
pub subtype: c_int,
|
||||
pub timestamp: Time,
|
||||
}
|
||||
|
||||
event_conversions_and_tests! {
|
||||
xrr_screen_change_notify: XRRScreenChangeNotifyEvent,
|
||||
xrr_notify: XRRNotifyEvent,
|
||||
xrr_output_change_notify: XRROutputChangeNotifyEvent,
|
||||
xrr_crtc_change_notify: XRRCrtcChangeNotifyEvent,
|
||||
xrr_output_property_notify: XRROutputPropertyNotifyEvent,
|
||||
xrr_provider_change_notify: XRRProviderChangeNotifyEvent,
|
||||
xrr_provider_property_notify: XRRProviderPropertyNotifyEvent,
|
||||
xrr_resource_change_notify: XRRResourceChangeNotifyEvent,
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// constants
|
||||
//
|
||||
|
||||
|
||||
pub const RANDR_NAME: &'static str = "RANDR";
|
||||
pub const RANDR_MAJOR: c_int = 1;
|
||||
pub const RANDR_MINOR: c_int = 5;
|
||||
|
||||
pub const RRNumberErrors: c_int = 4;
|
||||
pub const RRNumberEvents: c_int = 2;
|
||||
pub const RRNumberRequests: c_int = 45;
|
||||
|
||||
pub const X_RRQueryVersion: c_int = 0;
|
||||
pub const X_RROldGetScreenInfo: c_int = 1;
|
||||
pub const X_RRSetScreenConfig: c_int = 2;
|
||||
pub const X_RROldScreenChangeSelectInput: c_int = 3;
|
||||
pub const X_RRSelectInput: c_int = 4;
|
||||
pub const X_RRGetScreenInfo: c_int = 5;
|
||||
|
||||
pub const X_RRGetScreenSizeRange: c_int = 6;
|
||||
pub const X_RRSetScreenSize: c_int = 7;
|
||||
pub const X_RRGetScreenResources: c_int = 8;
|
||||
pub const X_RRGetOutputInfo: c_int = 9;
|
||||
pub const X_RRListOutputProperties: c_int = 10;
|
||||
pub const X_RRQueryOutputProperty: c_int = 11;
|
||||
pub const X_RRConfigureOutputProperty: c_int = 12;
|
||||
pub const X_RRChangeOutputProperty: c_int = 13;
|
||||
pub const X_RRDeleteOutputProperty: c_int = 14;
|
||||
pub const X_RRGetOutputProperty: c_int = 15;
|
||||
pub const X_RRCreateMode: c_int = 16;
|
||||
pub const X_RRDestroyMode: c_int = 17;
|
||||
pub const X_RRAddOutputMode: c_int = 18;
|
||||
pub const X_RRDeleteOutputMode: c_int = 19;
|
||||
pub const X_RRGetCrtcInfo: c_int = 20;
|
||||
pub const X_RRSetCrtcConfig: c_int = 21;
|
||||
pub const X_RRGetCrtcGammaSize: c_int = 22;
|
||||
pub const X_RRGetCrtcGamma: c_int = 23;
|
||||
pub const X_RRSetCrtcGamma: c_int = 24;
|
||||
|
||||
pub const X_RRGetScreenResourcesCurrent: c_int = 25;
|
||||
pub const X_RRSetCrtcTransform: c_int = 26;
|
||||
pub const X_RRGetCrtcTransform: c_int = 27;
|
||||
pub const X_RRGetPanning: c_int = 28;
|
||||
pub const X_RRSetPanning: c_int = 29;
|
||||
pub const X_RRSetOutputPrimary: c_int = 30;
|
||||
pub const X_RRGetOutputPrimary: c_int = 31;
|
||||
|
||||
pub const X_RRGetProviders: c_int = 32;
|
||||
pub const X_RRGetProviderInfo: c_int = 33;
|
||||
pub const X_RRSetProviderOffloadSink: c_int = 34;
|
||||
pub const X_RRSetProviderOutputSource: c_int = 35;
|
||||
pub const X_RRListProviderProperties: c_int = 36;
|
||||
pub const X_RRQueryProviderProperty: c_int = 37;
|
||||
pub const X_RRConfigureProviderProperty: c_int = 38;
|
||||
pub const X_RRChangeProviderProperty: c_int = 39;
|
||||
pub const X_RRDeleteProviderProperty: c_int = 40;
|
||||
pub const X_RRGetProviderProperty: c_int = 41;
|
||||
|
||||
pub const X_RRGetMonitors: c_int = 42;
|
||||
pub const X_RRSetMonitor: c_int = 43;
|
||||
pub const X_RRDeleteMonitor: c_int = 44;
|
||||
|
||||
pub const RRTransformUnit: c_int = 1 << 0;
|
||||
pub const RRTransformScaleUp: c_int = 1 << 1;
|
||||
pub const RRTransformScaleDown: c_int = 1 << 2;
|
||||
pub const RRTransformProjective: c_int = 1 << 3;
|
||||
|
||||
pub const RRScreenChangeNotifyMask: c_int = 1 << 0;
|
||||
pub const RRCrtcChangeNotifyMask: c_int = 1 << 1;
|
||||
pub const RROutputChangeNotifyMask: c_int = 1 << 2;
|
||||
pub const RROutputPropertyNotifyMask: c_int = 1 << 3;
|
||||
pub const RRProviderChangeNotifyMask: c_int = 1 << 4;
|
||||
pub const RRProviderPropertyNotifyMask: c_int = 1 << 5;
|
||||
pub const RRResourceChangeNotifyMask: c_int = 1 << 6;
|
||||
|
||||
pub const RRScreenChangeNotify: c_int = 0;
|
||||
pub const RRNotify: c_int = 1;
|
||||
pub const RRNotify_CrtcChange: c_int = 0;
|
||||
pub const RRNotify_OutputChange: c_int = 1;
|
||||
pub const RRNotify_OutputProperty: c_int = 2;
|
||||
pub const RRNotify_ProviderChange: c_int = 3;
|
||||
pub const RRNotify_ProviderProperty: c_int = 4;
|
||||
pub const RRNotify_ResourceChange: c_int = 5;
|
||||
|
||||
pub const RR_Rotate_0: c_int = 1;
|
||||
pub const RR_Rotate_90: c_int = 2;
|
||||
pub const RR_Rotate_180: c_int = 4;
|
||||
pub const RR_Rotate_270: c_int = 8;
|
||||
|
||||
pub const RR_Reflect_X: c_int = 16;
|
||||
pub const RR_Reflect_Y: c_int = 32;
|
||||
|
||||
pub const RRSetConfigSuccess: c_int = 0;
|
||||
pub const RRSetConfigInvalidConfigTime: c_int = 1;
|
||||
pub const RRSetConfigInvalidTime: c_int = 2;
|
||||
pub const RRSetConfigFailed: c_int = 3;
|
||||
|
||||
pub const RR_HSyncPositive: c_int = 0x00000001;
|
||||
pub const RR_HSyncNegative: c_int = 0x00000002;
|
||||
pub const RR_VSyncPositive: c_int = 0x00000004;
|
||||
pub const RR_VSyncNegative: c_int = 0x00000008;
|
||||
pub const RR_Interlace: c_int = 0x00000010;
|
||||
pub const RR_DoubleScan: c_int = 0x00000020;
|
||||
pub const RR_CSync: c_int = 0x00000040;
|
||||
pub const RR_CSyncPositive: c_int = 0x00000080;
|
||||
pub const RR_CSyncNegative: c_int = 0x00000100;
|
||||
pub const RR_HSkewPresent: c_int = 0x00000200;
|
||||
pub const RR_BCast: c_int = 0x00000400;
|
||||
pub const RR_PixelMultiplex: c_int = 0x00000800;
|
||||
pub const RR_DoubleClock: c_int = 0x00001000;
|
||||
pub const RR_ClockDivideBy2: c_int = 0x00002000;
|
||||
|
||||
pub const RR_Connected: c_int = 0;
|
||||
pub const RR_Disconnected: c_int = 1;
|
||||
pub const RR_UnknownConnection: c_int = 2;
|
||||
|
||||
pub const BadRROutput: c_int = 0;
|
||||
pub const BadRRCrtc: c_int = 1;
|
||||
pub const BadRRMode: c_int = 2;
|
||||
pub const BadRRProvider: c_int = 3;
|
||||
|
||||
pub const RR_PROPERTY_BACKLIGHT: &'static str = "Backlight";
|
||||
pub const RR_PROPERTY_RANDR_EDID: &'static str = "EDID";
|
||||
pub const RR_PROPERTY_SIGNAL_FORMAT: &'static str = "SignalFormat";
|
||||
pub const RR_PROPERTY_SIGNAL_PROPERTIES: &'static str = "SignalProperties";
|
||||
pub const RR_PROPERTY_CONNECTOR_TYPE: &'static str = "ConnectorType";
|
||||
pub const RR_PROPERTY_CONNECTOR_NUMBER: &'static str = "ConnectorNumber";
|
||||
pub const RR_PROPERTY_COMPATIBILITY_LIST: &'static str = "CompatibilityList";
|
||||
pub const RR_PROPERTY_CLONE_LIST: &'static str = "CloneList";
|
||||
pub const RR_PROPERTY_BORDER: &'static str = "Border";
|
||||
pub const RR_PROPERTY_BORDER_DIMENSIONS: &'static str = "BorderDimensions";
|
||||
pub const RR_PROPERTY_GUID: &'static str = "GUID";
|
||||
pub const RR_PROPERTY_RANDR_TILE: &'static str = "TILE";
|
||||
|
||||
pub const RR_Capability_None: c_int = 0;
|
||||
pub const RR_Capability_SourceOutput: c_int = 1;
|
||||
pub const RR_Capability_SinkOutput: c_int = 2;
|
||||
pub const RR_Capability_SourceOffload: c_int = 4;
|
||||
pub const RR_Capability_SinkOffload: c_int = 8;
|
||||
|
|
@ -1,137 +0,0 @@
|
|||
// x11-rs: Rust bindings for X11 libraries
|
||||
// The X11 libraries are available under the MIT license.
|
||||
// These bindings are public domain.
|
||||
|
||||
use std::os::raw::{
|
||||
c_char,
|
||||
c_int,
|
||||
c_uchar,
|
||||
c_ulong,
|
||||
c_ushort,
|
||||
};
|
||||
|
||||
use ::xlib::{
|
||||
Bool,
|
||||
Display,
|
||||
Time,
|
||||
XID,
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// functions
|
||||
//
|
||||
|
||||
|
||||
x11_link! { Xf86vmode, xtst, ["libXtst.so.6", "libXtst.so"], 14,
|
||||
pub fn XRecordAllocRange () -> *mut XRecordRange,
|
||||
pub fn XRecordCreateContext (_6: *mut Display, _5: c_int, _4: *mut c_ulong, _3: c_int, _2: *mut *mut XRecordRange, _1: c_int) -> c_ulong,
|
||||
pub fn XRecordDisableContext (_2: *mut Display, _1: c_ulong) -> c_int,
|
||||
pub fn XRecordEnableContext (_4: *mut Display, _3: c_ulong, _2: Option<unsafe extern "C" fn (*mut c_char, *mut XRecordInterceptData)>, _1: *mut c_char) -> c_int,
|
||||
pub fn XRecordEnableContextAsync (_4: *mut Display, _3: c_ulong, _2: Option<unsafe extern "C" fn (*mut c_char, *mut XRecordInterceptData)>, _1: *mut c_char) -> c_int,
|
||||
pub fn XRecordFreeContext (_2: *mut Display, _1: c_ulong) -> c_int,
|
||||
pub fn XRecordFreeData (_1: *mut XRecordInterceptData) -> (),
|
||||
pub fn XRecordFreeState (_1: *mut XRecordState) -> (),
|
||||
pub fn XRecordGetContext (_3: *mut Display, _2: c_ulong, _1: *mut *mut XRecordState) -> c_int,
|
||||
pub fn XRecordIdBaseMask (_1: *mut Display) -> c_ulong,
|
||||
pub fn XRecordProcessReplies (_1: *mut Display) -> (),
|
||||
pub fn XRecordQueryVersion (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> c_int,
|
||||
pub fn XRecordRegisterClients (_7: *mut Display, _6: c_ulong, _5: c_int, _4: *mut c_ulong, _3: c_int, _2: *mut *mut XRecordRange, _1: c_int) -> c_int,
|
||||
pub fn XRecordUnregisterClients (_4: *mut Display, _3: c_ulong, _2: *mut c_ulong, _1: c_int) -> c_int,
|
||||
variadic:
|
||||
globals:
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// constants
|
||||
//
|
||||
|
||||
|
||||
pub const XRecordFromServerTime: c_int = 0x01;
|
||||
pub const XRecordFromClientTime: c_int = 0x02;
|
||||
pub const XRecordFromClientSequence: c_int = 0x04;
|
||||
|
||||
pub const XRecordCurrentClients: c_ulong = 1;
|
||||
pub const XRecordFutureClients: c_ulong = 2;
|
||||
pub const XRecordAllClients: c_ulong = 3;
|
||||
|
||||
pub const XRecordFromServer: c_int = 0;
|
||||
pub const XRecordFromClient: c_int = 1;
|
||||
pub const XRecordClientStarted: c_int = 2;
|
||||
pub const XRecordClientDied: c_int = 3;
|
||||
pub const XRecordStartOfData: c_int = 4;
|
||||
pub const XRecordEndOfData: c_int = 5;
|
||||
|
||||
|
||||
//
|
||||
// types
|
||||
//
|
||||
|
||||
|
||||
pub type XRecordClientSpec = c_ulong;
|
||||
pub type XRecordContext = c_ulong;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRecordClientInfo {
|
||||
pub client: XRecordClientSpec,
|
||||
pub nranges: c_ulong,
|
||||
pub ranges: *mut *mut XRecordRange,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRecordExtRange {
|
||||
pub ext_major: XRecordRange8,
|
||||
pub ext_minor: XRecordRange16,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRecordInterceptData {
|
||||
pub id_base: XID,
|
||||
pub server_time: Time,
|
||||
pub client_seq: c_ulong,
|
||||
pub category: c_int,
|
||||
pub client_swapped: Bool,
|
||||
pub data: *mut c_uchar,
|
||||
pub data_len: c_ulong,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRecordRange {
|
||||
pub core_requests: XRecordRange8,
|
||||
pub core_replies: XRecordRange8,
|
||||
pub ext_requests: XRecordExtRange,
|
||||
pub ext_replies: XRecordExtRange,
|
||||
pub delivered_events: XRecordRange8,
|
||||
pub device_events: XRecordRange8,
|
||||
pub errors: XRecordRange8,
|
||||
pub client_started: Bool,
|
||||
pub client_died: Bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRecordRange8 {
|
||||
pub first: c_uchar,
|
||||
pub last: c_uchar,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRecordRange16 {
|
||||
pub first: c_ushort,
|
||||
pub last: c_ushort,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRecordState {
|
||||
pub enabled: Bool,
|
||||
pub datum_flags: c_int,
|
||||
pub nclients: c_ulong,
|
||||
pub client_info: *mut *mut XRecordClientInfo,
|
||||
}
|
|
@ -1,463 +0,0 @@
|
|||
// x11-rs: Rust bindings for X11 libraries
|
||||
// The X11 libraries are available under the MIT license.
|
||||
// These bindings are public domain.
|
||||
|
||||
use std::os::raw::{
|
||||
c_char,
|
||||
c_double,
|
||||
c_int,
|
||||
c_short,
|
||||
c_uint,
|
||||
c_ulong,
|
||||
c_ushort,
|
||||
};
|
||||
|
||||
use ::xlib::{
|
||||
Atom,
|
||||
Bool,
|
||||
Colormap,
|
||||
Cursor,
|
||||
Display,
|
||||
Pixmap,
|
||||
Region,
|
||||
Visual,
|
||||
XID,
|
||||
XRectangle,
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// functions
|
||||
//
|
||||
|
||||
|
||||
x11_link! { Xrender, xrender, ["libXrender.so.1", "libXrender.so"], 44,
|
||||
pub fn XRenderAddGlyphs (_7: *mut Display, _6: c_ulong, _5: *const c_ulong, _4: *const XGlyphInfo, _3: c_int, _2: *const c_char, _1: c_int) -> (),
|
||||
pub fn XRenderAddTraps (_6: *mut Display, _5: c_ulong, _4: c_int, _3: c_int, _2: *const XTrap, _1: c_int) -> (),
|
||||
pub fn XRenderChangePicture (_4: *mut Display, _3: c_ulong, _2: c_ulong, _1: *const XRenderPictureAttributes) -> (),
|
||||
pub fn XRenderComposite (_13: *mut Display, _12: c_int, _11: c_ulong, _10: c_ulong, _9: c_ulong, _8: c_int, _7: c_int, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: c_uint, _1: c_uint) -> (),
|
||||
pub fn XRenderCompositeDoublePoly (_12: *mut Display, _11: c_int, _10: c_ulong, _9: c_ulong, _8: *const XRenderPictFormat, _7: c_int, _6: c_int, _5: c_int, _4: c_int, _3: *const XPointDouble, _2: c_int, _1: c_int) -> (),
|
||||
pub fn XRenderCompositeString16 (_12: *mut Display, _11: c_int, _10: c_ulong, _9: c_ulong, _8: *const XRenderPictFormat, _7: c_ulong, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: *const c_ushort, _1: c_int) -> (),
|
||||
pub fn XRenderCompositeString32 (_12: *mut Display, _11: c_int, _10: c_ulong, _9: c_ulong, _8: *const XRenderPictFormat, _7: c_ulong, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: *const c_uint, _1: c_int) -> (),
|
||||
pub fn XRenderCompositeString8 (_12: *mut Display, _11: c_int, _10: c_ulong, _9: c_ulong, _8: *const XRenderPictFormat, _7: c_ulong, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: *const c_char, _1: c_int) -> (),
|
||||
pub fn XRenderCompositeText16 (_11: *mut Display, _10: c_int, _9: c_ulong, _8: c_ulong, _7: *const XRenderPictFormat, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: *const XGlyphElt16, _1: c_int) -> (),
|
||||
pub fn XRenderCompositeText32 (_11: *mut Display, _10: c_int, _9: c_ulong, _8: c_ulong, _7: *const XRenderPictFormat, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: *const XGlyphElt32, _1: c_int) -> (),
|
||||
pub fn XRenderCompositeText8 (_11: *mut Display, _10: c_int, _9: c_ulong, _8: c_ulong, _7: *const XRenderPictFormat, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: *const XGlyphElt8, _1: c_int) -> (),
|
||||
pub fn XRenderCompositeTrapezoids (_9: *mut Display, _8: c_int, _7: c_ulong, _6: c_ulong, _5: *const XRenderPictFormat, _4: c_int, _3: c_int, _2: *const XTrapezoid, _1: c_int) -> (),
|
||||
pub fn XRenderCompositeTriangles (_9: *mut Display, _8: c_int, _7: c_ulong, _6: c_ulong, _5: *const XRenderPictFormat, _4: c_int, _3: c_int, _2: *const XTriangle, _1: c_int) -> (),
|
||||
pub fn XRenderCompositeTriFan (_9: *mut Display, _8: c_int, _7: c_ulong, _6: c_ulong, _5: *const XRenderPictFormat, _4: c_int, _3: c_int, _2: *const XPointFixed, _1: c_int) -> (),
|
||||
pub fn XRenderCompositeTriStrip (_9: *mut Display, _8: c_int, _7: c_ulong, _6: c_ulong, _5: *const XRenderPictFormat, _4: c_int, _3: c_int, _2: *const XPointFixed, _1: c_int) -> (),
|
||||
pub fn XRenderCreateAnimCursor (_3: *mut Display, _2: c_int, _1: *mut XAnimCursor) -> c_ulong,
|
||||
pub fn XRenderCreateConicalGradient (_5: *mut Display, _4: *const XConicalGradient, _3: *const c_int, _2: *const XRenderColor, _1: c_int) -> c_ulong,
|
||||
pub fn XRenderCreateCursor (_4: *mut Display, _3: c_ulong, _2: c_uint, _1: c_uint) -> c_ulong,
|
||||
pub fn XRenderCreateGlyphSet (_2: *mut Display, _1: *const XRenderPictFormat) -> c_ulong,
|
||||
pub fn XRenderCreateLinearGradient (_5: *mut Display, _4: *const XLinearGradient, _3: *const c_int, _2: *const XRenderColor, _1: c_int) -> c_ulong,
|
||||
pub fn XRenderCreatePicture (_5: *mut Display, _4: c_ulong, _3: *const XRenderPictFormat, _2: c_ulong, _1: *const XRenderPictureAttributes) -> c_ulong,
|
||||
pub fn XRenderCreateRadialGradient (_5: *mut Display, _4: *const XRadialGradient, _3: *const c_int, _2: *const XRenderColor, _1: c_int) -> c_ulong,
|
||||
pub fn XRenderCreateSolidFill (_2: *mut Display, _1: *const XRenderColor) -> c_ulong,
|
||||
pub fn XRenderFillRectangle (_8: *mut Display, _7: c_int, _6: c_ulong, _5: *const XRenderColor, _4: c_int, _3: c_int, _2: c_uint, _1: c_uint) -> (),
|
||||
pub fn XRenderFillRectangles (_6: *mut Display, _5: c_int, _4: c_ulong, _3: *const XRenderColor, _2: *const XRectangle, _1: c_int) -> (),
|
||||
pub fn XRenderFindFormat (_4: *mut Display, _3: c_ulong, _2: *const XRenderPictFormat, _1: c_int) -> *mut XRenderPictFormat,
|
||||
pub fn XRenderFindStandardFormat (_2: *mut Display, _1: c_int) -> *mut XRenderPictFormat,
|
||||
pub fn XRenderFindVisualFormat (_2: *mut Display, _1: *const Visual) -> *mut XRenderPictFormat,
|
||||
pub fn XRenderFreeGlyphs (_4: *mut Display, _3: c_ulong, _2: *const c_ulong, _1: c_int) -> (),
|
||||
pub fn XRenderFreeGlyphSet (_2: *mut Display, _1: c_ulong) -> (),
|
||||
pub fn XRenderFreePicture (_2: *mut Display, _1: c_ulong) -> (),
|
||||
pub fn XRenderParseColor (_3: *mut Display, _2: *mut c_char, _1: *mut XRenderColor) -> c_int,
|
||||
pub fn XRenderQueryExtension (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> c_int,
|
||||
pub fn XRenderQueryFilters (_2: *mut Display, _1: c_ulong) -> *mut XFilters,
|
||||
pub fn XRenderQueryFormats (_1: *mut Display) -> c_int,
|
||||
pub fn XRenderQueryPictIndexValues (_3: *mut Display, _2: *const XRenderPictFormat, _1: *mut c_int) -> *mut XIndexValue,
|
||||
pub fn XRenderQuerySubpixelOrder (_2: *mut Display, _1: c_int) -> c_int,
|
||||
pub fn XRenderQueryVersion (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> c_int,
|
||||
pub fn XRenderReferenceGlyphSet (_2: *mut Display, _1: c_ulong) -> c_ulong,
|
||||
pub fn XRenderSetPictureClipRectangles (_6: *mut Display, _5: c_ulong, _4: c_int, _3: c_int, _2: *const XRectangle, _1: c_int) -> (),
|
||||
pub fn XRenderSetPictureClipRegion (_3: *mut Display, _2: c_ulong, _1: Region) -> (),
|
||||
pub fn XRenderSetPictureFilter (_5: *mut Display, _4: c_ulong, _3: *const c_char, _2: *mut c_int, _1: c_int) -> (),
|
||||
pub fn XRenderSetPictureTransform (_3: *mut Display, _2: c_ulong, _1: *mut XTransform) -> (),
|
||||
pub fn XRenderSetSubpixelOrder (_3: *mut Display, _2: c_int, _1: c_int) -> c_int,
|
||||
variadic:
|
||||
globals:
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// types
|
||||
//
|
||||
|
||||
|
||||
pub type Glyph = XID;
|
||||
pub type GlyphSet = XID;
|
||||
pub type PictFormat = XID;
|
||||
pub type Picture = XID;
|
||||
pub type XDouble = c_double;
|
||||
pub type XFixed = c_int;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct _XAnimCursor {
|
||||
pub cursor: Cursor,
|
||||
pub delay: c_ulong,
|
||||
}
|
||||
pub type XAnimCursor = _XAnimCursor;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct _XCircle {
|
||||
pub x: XFixed,
|
||||
pub y: XFixed,
|
||||
pub radius: XFixed,
|
||||
}
|
||||
pub type XCircle = _XCircle;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct _XConicalGradient {
|
||||
pub center: XPointFixed,
|
||||
pub angle: XFixed,
|
||||
}
|
||||
pub type XConicalGradient = _XConicalGradient;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct _XFilters {
|
||||
pub nfilter: c_int,
|
||||
pub filter: *mut *mut c_char,
|
||||
pub nalias: c_int,
|
||||
pub alias: *mut c_short,
|
||||
}
|
||||
pub type XFilters = _XFilters;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct _XGlyphElt8 {
|
||||
pub glyphset: GlyphSet,
|
||||
pub chars: *mut c_char,
|
||||
pub nchars: c_int,
|
||||
pub xOff: c_int,
|
||||
pub yOff: c_int,
|
||||
}
|
||||
pub type XGlyphElt8 = _XGlyphElt8;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct _XGlyphElt16 {
|
||||
pub glyphset: GlyphSet,
|
||||
pub chars: *mut c_ushort,
|
||||
pub nchars: c_int,
|
||||
pub xOff: c_int,
|
||||
pub yOff: c_int,
|
||||
}
|
||||
pub type XGlyphElt16 = _XGlyphElt16;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct _XGlyphElt32 {
|
||||
pub glyphset: GlyphSet,
|
||||
pub chars: *mut c_uint,
|
||||
pub nchars: c_int,
|
||||
pub xOff: c_int,
|
||||
pub yOff: c_int,
|
||||
}
|
||||
pub type XGlyphElt32 = _XGlyphElt32;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct _XGlyphInfo {
|
||||
pub width: c_ushort,
|
||||
pub height: c_ushort,
|
||||
pub x: c_short,
|
||||
pub y: c_short,
|
||||
pub xOff: c_short,
|
||||
pub yOff: c_short,
|
||||
}
|
||||
pub type XGlyphInfo = _XGlyphInfo;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct _XIndexValue {
|
||||
pub pixel: c_ulong,
|
||||
pub red: c_ushort,
|
||||
pub green: c_ushort,
|
||||
pub blue: c_ushort,
|
||||
pub alpha: c_ushort,
|
||||
}
|
||||
pub type XIndexValue = _XIndexValue;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct _XLinearGradient {
|
||||
pub p1: XPointFixed,
|
||||
pub p2: XPointFixed,
|
||||
}
|
||||
pub type XLinearGradient = _XLinearGradient;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct _XLineFixed {
|
||||
pub p1: XPointFixed,
|
||||
pub p2: XPointFixed,
|
||||
}
|
||||
pub type XLineFixed = _XLineFixed;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct _XPointDouble {
|
||||
pub x: XDouble,
|
||||
pub y: XDouble,
|
||||
}
|
||||
pub type XPointDouble = _XPointDouble;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct _XPointFixed {
|
||||
pub x: XFixed,
|
||||
pub y: XFixed,
|
||||
}
|
||||
pub type XPointFixed = _XPointFixed;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct _XRadialGradient {
|
||||
pub inner: XCircle,
|
||||
pub outer: XCircle,
|
||||
}
|
||||
pub type XRadialGradient = _XRadialGradient;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRenderColor {
|
||||
pub red: c_ushort,
|
||||
pub green: c_ushort,
|
||||
pub blue: c_ushort,
|
||||
pub alpha: c_ushort,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRenderDirectFormat {
|
||||
pub red: c_short,
|
||||
pub redMask: c_short,
|
||||
pub green: c_short,
|
||||
pub greenMask: c_short,
|
||||
pub blue: c_short,
|
||||
pub blueMask: c_short,
|
||||
pub alpha: c_short,
|
||||
pub alphaMask: c_short,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XRenderPictFormat {
|
||||
pub id: PictFormat,
|
||||
pub type_: c_int,
|
||||
pub depth: c_int,
|
||||
pub direct: XRenderDirectFormat,
|
||||
pub colormap: Colormap,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct _XRenderPictureAttributes {
|
||||
pub repeat: c_int,
|
||||
pub alpha_map: Picture,
|
||||
pub alpha_x_origin: c_int,
|
||||
pub alpha_y_origin: c_int,
|
||||
pub clip_x_origin: c_int,
|
||||
pub clip_y_origin: c_int,
|
||||
pub clip_mask: Pixmap,
|
||||
pub graphics_exposures: Bool,
|
||||
pub subwindow_mode: c_int,
|
||||
pub poly_edge: c_int,
|
||||
pub poly_mode: c_int,
|
||||
pub dither: Atom,
|
||||
pub component_alpha: Bool,
|
||||
}
|
||||
pub type XRenderPictureAttributes = _XRenderPictureAttributes;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct _XSpanFix {
|
||||
pub left: XFixed,
|
||||
pub right: XFixed,
|
||||
pub y: XFixed,
|
||||
}
|
||||
pub type XSpanFix = _XSpanFix;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct _XTrap {
|
||||
pub top: XSpanFix,
|
||||
pub bottom: XSpanFix,
|
||||
}
|
||||
pub type XTrap = _XTrap;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct _XTrapezoid {
|
||||
pub top: XFixed,
|
||||
pub bottom: XFixed,
|
||||
pub left: XLineFixed,
|
||||
pub right: XLineFixed,
|
||||
}
|
||||
pub type XTrapezoid = _XTrapezoid;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct _XTriangle {
|
||||
pub p1: XPointFixed,
|
||||
pub p2: XPointFixed,
|
||||
pub p3: XPointFixed,
|
||||
}
|
||||
pub type XTriangle = _XTriangle;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct _XTransform {
|
||||
pub matrix: [[XFixed; 3]; 3],
|
||||
}
|
||||
pub type XTransform = _XTransform;
|
||||
|
||||
|
||||
//
|
||||
// constants
|
||||
//
|
||||
|
||||
|
||||
// pict format mask
|
||||
pub const PictFormatID: c_ulong = 1 << 0;
|
||||
pub const PictFormatType: c_ulong = 1 << 1;
|
||||
pub const PictFormatDepth: c_ulong = 1 << 2;
|
||||
pub const PictFormatRed: c_ulong = 1 << 3;
|
||||
pub const PictFormatRedMask: c_ulong = 1 << 4;
|
||||
pub const PictFormatGreen: c_ulong = 1 << 5;
|
||||
pub const PictFormatGreenMask: c_ulong = 1 << 6;
|
||||
pub const PictFormatBlue: c_ulong = 1 << 7;
|
||||
pub const PictFormatBlueMask: c_ulong = 1 << 8;
|
||||
pub const PictFormatAlpha: c_ulong = 1 << 9;
|
||||
pub const PictFormatAlphaMask: c_ulong = 1 << 10;
|
||||
pub const PictFormatColormap: c_ulong = 1 << 11;
|
||||
|
||||
// error codes
|
||||
pub const BadPictFormat: c_int = 0;
|
||||
pub const BadPicture: c_int = 1;
|
||||
pub const BadPictOp: c_int = 2;
|
||||
pub const BadGlyphSet: c_int = 3;
|
||||
pub const BadGlyph: c_int = 4;
|
||||
pub const RenderNumberErrors: c_int = BadGlyph + 1;
|
||||
|
||||
// pict types
|
||||
pub const PictTypeIndexed: c_int = 0;
|
||||
pub const PictTypeDirect: c_int = 1;
|
||||
|
||||
// ops
|
||||
pub const PictOpMinimum: c_int = 0;
|
||||
pub const PictOpClear: c_int = 0;
|
||||
pub const PictOpSrc: c_int = 1;
|
||||
pub const PictOpDst: c_int = 2;
|
||||
pub const PictOpOver: c_int = 3;
|
||||
pub const PictOpOverReverse: c_int = 4;
|
||||
pub const PictOpIn: c_int = 5;
|
||||
pub const PictOpInReverse: c_int = 6;
|
||||
pub const PictOpOut: c_int = 7;
|
||||
pub const PictOpOutReverse: c_int = 8;
|
||||
pub const PictOpAtop: c_int = 9;
|
||||
pub const PictOpAtopReverse: c_int = 10;
|
||||
pub const PictOpXor: c_int = 11;
|
||||
pub const PictOpAdd: c_int = 12;
|
||||
pub const PictOpSaturate: c_int = 13;
|
||||
pub const PictOpMaximum: c_int = 13;
|
||||
|
||||
pub const PictOpDisjointMinimum: c_int = 0x10;
|
||||
pub const PictOpDisjointClear: c_int = 0x10;
|
||||
pub const PictOpDisjointSrc: c_int = 0x11;
|
||||
pub const PictOpDisjointDst: c_int = 0x12;
|
||||
pub const PictOpDisjointOver: c_int = 0x13;
|
||||
pub const PictOpDisjointOverReverse: c_int = 0x14;
|
||||
pub const PictOpDisjointIn: c_int = 0x15;
|
||||
pub const PictOpDisjointInReverse: c_int = 0x16;
|
||||
pub const PictOpDisjointOut: c_int = 0x17;
|
||||
pub const PictOpDisjointOutReverse: c_int = 0x18;
|
||||
pub const PictOpDisjointAtop: c_int = 0x19;
|
||||
pub const PictOpDisjointAtopReverse: c_int = 0x1a;
|
||||
pub const PictOpDisjointXor: c_int = 0x1b;
|
||||
pub const PictOpDisjointMaximum: c_int = 0x1b;
|
||||
|
||||
pub const PictOpConjointMinimum: c_int = 0x20;
|
||||
pub const PictOpConjointClear: c_int = 0x20;
|
||||
pub const PictOpConjointSrc: c_int = 0x21;
|
||||
pub const PictOpConjointDst: c_int = 0x22;
|
||||
pub const PictOpConjointOver: c_int = 0x23;
|
||||
pub const PictOpConjointOverReverse: c_int = 0x24;
|
||||
pub const PictOpConjointIn: c_int = 0x25;
|
||||
pub const PictOpConjointInReverse: c_int = 0x26;
|
||||
pub const PictOpConjointOut: c_int = 0x27;
|
||||
pub const PictOpConjointOutReverse: c_int = 0x28;
|
||||
pub const PictOpConjointAtop: c_int = 0x29;
|
||||
pub const PictOpConjointAtopReverse: c_int = 0x2a;
|
||||
pub const PictOpConjointXor: c_int = 0x2b;
|
||||
pub const PictOpConjointMaximum: c_int = 0x2b;
|
||||
|
||||
pub const PictOpBlendMinimum: c_int = 0x30;
|
||||
pub const PictOpMultiply: c_int = 0x30;
|
||||
pub const PictOpScreen: c_int = 0x31;
|
||||
pub const PictOpOverlay: c_int = 0x32;
|
||||
pub const PictOpDarken: c_int = 0x33;
|
||||
pub const PictOpLighten: c_int = 0x34;
|
||||
pub const PictOpColorDodge: c_int = 0x35;
|
||||
pub const PictOpColorBurn: c_int = 0x36;
|
||||
pub const PictOpHardLight: c_int = 0x37;
|
||||
pub const PictOpSoftLight: c_int = 0x38;
|
||||
pub const PictOpDifference: c_int = 0x39;
|
||||
pub const PictOpExclusion: c_int = 0x3a;
|
||||
pub const PictOpHSLHue: c_int = 0x3b;
|
||||
pub const PictOpHSLSaturation: c_int = 0x3c;
|
||||
pub const PictOpHSLColor: c_int = 0x3d;
|
||||
pub const PictOpHSLLuminosity: c_int = 0x3e;
|
||||
pub const PictOpBlendMaximum: c_int = 0x3e;
|
||||
|
||||
// poly edge types
|
||||
pub const PolyEdgeSharp: c_int = 0;
|
||||
pub const PolyEdgeSmooth: c_int = 1;
|
||||
|
||||
// poly modes
|
||||
pub const PolyModePrecise: c_int = 0;
|
||||
pub const PolyModeImprecise: c_int = 1;
|
||||
|
||||
// picture attributes mask
|
||||
pub const CPRepeat: c_int = 1 << 0;
|
||||
pub const CPAlphaMap: c_int = 1 << 1;
|
||||
pub const CPAlphaXOrigin: c_int = 1 << 2;
|
||||
pub const CPAlphaYOrigin: c_int = 1 << 3;
|
||||
pub const CPClipXOrigin: c_int = 1 << 4;
|
||||
pub const CPClipYOrigin: c_int = 1 << 5;
|
||||
pub const CPClipMask: c_int = 1 << 6;
|
||||
pub const CPGraphicsExposure: c_int = 1 << 7;
|
||||
pub const CPSubwindowMode: c_int = 1 << 8;
|
||||
pub const CPPolyEdge: c_int = 1 << 9;
|
||||
pub const CPPolyMode: c_int = 1 << 10;
|
||||
pub const CPDither: c_int = 1 << 11;
|
||||
pub const CPComponentAlpha: c_int = 1 << 12;
|
||||
pub const CPLastBit: c_int = 12;
|
||||
|
||||
// filter methods
|
||||
pub const FilterNearest: &'static str = "nearest";
|
||||
pub const FilterBilinear: &'static str = "bilinear";
|
||||
pub const FilterConvolution: &'static str = "convolution";
|
||||
pub const FilterFast: &'static str = "fast";
|
||||
pub const FilterGood: &'static str = "good";
|
||||
pub const FilterBest: &'static str = "best";
|
||||
|
||||
// subpixel orders
|
||||
pub const SubPixelUnknown: c_int = 0;
|
||||
pub const SubPixelHorizontalRGB: c_int = 1;
|
||||
pub const SubPixelHorizontalBGR: c_int = 2;
|
||||
pub const SubPixelVerticalRGB: c_int = 3;
|
||||
pub const SubPixelVerticalBGR: c_int = 4;
|
||||
pub const SubPixelNone: c_int = 5;
|
||||
|
||||
// repeat attributes
|
||||
pub const RepeatNone: c_int = 0;
|
||||
pub const RepeatNormal: c_int = 1;
|
||||
pub const RepeatPad: c_int = 2;
|
||||
pub const RepeatReflect: c_int = 3;
|
|
@ -1,98 +0,0 @@
|
|||
// x11-rs: Rust bindings for X11 libraries
|
||||
// The X11 libraries are available under the MIT license.
|
||||
// These bindings are public domain.
|
||||
|
||||
use std::os::raw::{ c_int, c_uint, c_ulong };
|
||||
|
||||
use xlib::{ Atom, Bool, Display, Drawable, Status, Time, Visual, XEvent, XID, XSetWindowAttributes, Window };
|
||||
|
||||
|
||||
//
|
||||
// functions
|
||||
//
|
||||
|
||||
|
||||
x11_link! { Xss, xscrnsaver, ["libXss.so.2", "libXss.so"], 11,
|
||||
pub fn XScreenSaverQueryExtension (_1: *mut Display, _2: *mut c_int, _3: *mut c_int) -> Bool,
|
||||
pub fn XScreenSaverQueryVersion (_1: *mut Display, _2: *mut c_int, _3: *mut c_int) -> Status,
|
||||
pub fn XScreenSaverAllocInfo () -> *mut XScreenSaverInfo,
|
||||
pub fn XScreenSaverQueryInfo (_1: *mut Display, _2: Drawable, _3: *mut XScreenSaverInfo) -> Status,
|
||||
pub fn XScreenSaverSelectInput (_1: *mut Display, _2: Drawable, _3: c_ulong) -> (),
|
||||
pub fn XScreenSaverSetAttributes (_1: *mut Display, _2: Drawable, _3: c_int, _4: c_int, _5: c_uint, _6: c_uint, _7: c_uint, _8: c_int, _9: c_uint, _10: *mut Visual, _11: c_ulong, _12: *mut XSetWindowAttributes) -> (),
|
||||
pub fn XScreenSaverUnsetAttributes (_1: *mut Display, _2: Drawable) -> (),
|
||||
pub fn XScreenSaverRegister (_1: *mut Display, _2: c_int, _3: XID, _4: Atom) -> Status,
|
||||
pub fn XScreenSaverUnregister (_1: *mut Display, _2: c_int) -> Status,
|
||||
pub fn XScreenSaverGetRegistered (_1: *mut Display, _2: c_int, _3: *mut XID, _4: *mut Atom) -> Status,
|
||||
pub fn XScreenSaverSuspend (_1: *mut Display, _2: Bool) -> (),
|
||||
variadic:
|
||||
globals:
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// types
|
||||
//
|
||||
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XScreenSaverInfo {
|
||||
pub window: Window,
|
||||
pub state: c_int,
|
||||
pub kind: c_int,
|
||||
pub til_or_since: c_ulong,
|
||||
pub idle: c_ulong,
|
||||
pub eventMask: c_ulong,
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// event structures
|
||||
//
|
||||
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct XScreenSaverNotifyEvent {
|
||||
pub type_: c_int,
|
||||
pub serial: c_ulong,
|
||||
pub send_event: Bool,
|
||||
pub display: *mut Display,
|
||||
pub window: Window,
|
||||
pub root: Window,
|
||||
pub state: c_int,
|
||||
pub kind: c_int,
|
||||
pub forced: Bool,
|
||||
pub time: Time,
|
||||
}
|
||||
|
||||
event_conversions_and_tests! {
|
||||
xss_notify: XScreenSaverNotifyEvent,
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// constants
|
||||
//
|
||||
|
||||
|
||||
pub const ScreenSaverName: &'static str = "MIT-SCREEN-SAVER";
|
||||
pub const ScreenSaverPropertyName: &'static str = "_MIT_SCREEN_SAVER_ID";
|
||||
|
||||
pub const ScreenSaverNotifyMask: c_ulong = 0x00000001;
|
||||
pub const ScreenSaverCycleMask: c_ulong = 0x00000002;
|
||||
|
||||
pub const ScreenSaverMajorVersion: c_int = 1;
|
||||
pub const ScreenSaverMinorVersion: c_int = 1;
|
||||
|
||||
pub const ScreenSaverOff: c_int = 0;
|
||||
pub const ScreenSaverOn: c_int = 1;
|
||||
pub const ScreenSaverCycle: c_int = 2;
|
||||
pub const ScreenSaverDisabled: c_int = 3;
|
||||
|
||||
pub const ScreenSaverBlanked: c_int = 0;
|
||||
pub const ScreenSaverInternal: c_int = 1;
|
||||
pub const ScreenSaverExternal: c_int = 2;
|
||||
|
||||
pub const ScreenSaverNotify: c_int = 0;
|
||||
pub const ScreenSaverNumberEvents: c_int = 1;
|
|
@ -1,398 +0,0 @@
|
|||
// x11-rs: Rust bindings for X11 libraries
|
||||
// The X11 libraries are available under the MIT license.
|
||||
// These bindings are public domain.
|
||||
|
||||
use std::os::raw::{
|
||||
c_char,
|
||||
c_int,
|
||||
c_long,
|
||||
c_short,
|
||||
c_uchar,
|
||||
c_uint,
|
||||
c_ulong,
|
||||
c_ushort,
|
||||
c_void,
|
||||
};
|
||||
|
||||
use ::xlib::{
|
||||
Display,
|
||||
GC,
|
||||
Region,
|
||||
Screen,
|
||||
Visual,
|
||||
XEvent,
|
||||
XGCValues,
|
||||
_XrmHashBucketRec,
|
||||
XrmOptionDescList,
|
||||
XrmValue,
|
||||
XSelectionRequestEvent,
|
||||
XSetWindowAttributes,
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// functions
|
||||
//
|
||||
|
||||
|
||||
x11_link! { Xt, xt, ["libXt.so.6", "libXt.so"], 300,
|
||||
pub fn XtAddActions (_2: *mut XtActionsRec, _1: c_uint) -> (),
|
||||
pub fn XtAddCallback (_4: Widget, _3: *const c_char, _2: Option<unsafe extern "C" fn (Widget, *mut c_void, *mut c_void)>, _1: *mut c_void) -> (),
|
||||
pub fn XtAddCallbacks (_3: Widget, _2: *const c_char, _1: XtCallbackList) -> (),
|
||||
pub fn XtAddConverter (_5: *const c_char, _4: *const c_char, _3: Option<unsafe extern "C" fn (*mut XrmValue, *mut c_uint, *mut XrmValue, *mut XrmValue)>, _2: XtConvertArgList, _1: c_uint) -> (),
|
||||
pub fn XtAddEventHandler (_5: Widget, _4: c_ulong, _3: c_char, _2: Option<unsafe extern "C" fn (Widget, *mut c_void, *mut XEvent, *mut c_char)>, _1: *mut c_void) -> (),
|
||||
pub fn XtAddExposureToRegion (_2: *mut XEvent, _1: Region) -> (),
|
||||
pub fn XtAddGrab (_3: Widget, _2: c_char, _1: c_char) -> (),
|
||||
pub fn XtAddInput (_4: c_int, _3: *mut c_void, _2: Option<unsafe extern "C" fn (*mut c_void, *mut c_int, *mut c_ulong)>, _1: *mut c_void) -> c_ulong,
|
||||
pub fn XtAddRawEventHandler (_5: Widget, _4: c_ulong, _3: c_char, _2: Option<unsafe extern "C" fn (Widget, *mut c_void, *mut XEvent, *mut c_char)>, _1: *mut c_void) -> (),
|
||||
pub fn XtAddSignal (_2: Option<unsafe extern "C" fn (*mut c_void, *mut c_ulong)>, _1: *mut c_void) -> c_ulong,
|
||||
pub fn XtAddTimeOut (_3: c_ulong, _2: Option<unsafe extern "C" fn (*mut c_void, *mut c_ulong)>, _1: *mut c_void) -> c_ulong,
|
||||
pub fn XtAddWorkProc (_2: Option<unsafe extern "C" fn (*mut c_void) -> c_char>, _1: *mut c_void) -> c_ulong,
|
||||
pub fn XtAllocateGC (_6: Widget, _5: c_uint, _4: c_ulong, _3: *mut XGCValues, _2: c_ulong, _1: c_ulong) -> GC,
|
||||
pub fn XtAppAddActionHook (_3: XtAppContext, _2: Option<unsafe extern "C" fn (Widget, *mut c_void, *mut c_char, *mut XEvent, *mut *mut c_char, *mut c_uint)>, _1: *mut c_void) -> *mut c_void,
|
||||
pub fn XtAppAddActions (_3: XtAppContext, _2: *mut XtActionsRec, _1: c_uint) -> (),
|
||||
pub fn XtAppAddBlockHook (_3: XtAppContext, _2: Option<unsafe extern "C" fn (*mut c_void)>, _1: *mut c_void) -> c_ulong,
|
||||
pub fn XtAppAddConverter (_6: XtAppContext, _5: *const c_char, _4: *const c_char, _3: Option<unsafe extern "C" fn (*mut XrmValue, *mut c_uint, *mut XrmValue, *mut XrmValue)>, _2: XtConvertArgList, _1: c_uint) -> (),
|
||||
pub fn XtAppAddInput (_5: XtAppContext, _4: c_int, _3: *mut c_void, _2: Option<unsafe extern "C" fn (*mut c_void, *mut c_int, *mut c_ulong)>, _1: *mut c_void) -> c_ulong,
|
||||
pub fn XtAppAddSignal (_3: XtAppContext, _2: Option<unsafe extern "C" fn (*mut c_void, *mut c_ulong)>, _1: *mut c_void) -> c_ulong,
|
||||
pub fn XtAppAddTimeOut (_4: XtAppContext, _3: c_ulong, _2: Option<unsafe extern "C" fn (*mut c_void, *mut c_ulong)>, _1: *mut c_void) -> c_ulong,
|
||||
pub fn XtAppAddWorkProc (_3: XtAppContext, _2: Option<unsafe extern "C" fn (*mut c_void) -> c_char>, _1: *mut c_void) -> c_ulong,
|
||||
pub fn XtAppCreateShell (_6: *const c_char, _5: *const c_char, _4: WidgetClass, _3: *mut Display, _2: *mut Arg, _1: c_uint) -> Widget,
|
||||
pub fn XtAppError (_2: XtAppContext, _1: *const c_char) -> (),
|
||||
pub fn XtAppErrorMsg (_7: XtAppContext, _6: *const c_char, _5: *const c_char, _4: *const c_char, _3: *const c_char, _2: *mut *mut c_char, _1: *mut c_uint) -> (),
|
||||
pub fn XtAppGetErrorDatabase (_1: XtAppContext) -> *mut *mut _XrmHashBucketRec,
|
||||
pub fn XtAppGetErrorDatabaseText (_8: XtAppContext, _7: *const c_char, _6: *const c_char, _5: *const c_char, _4: *const c_char, _3: *mut c_char, _2: c_int, _1: *mut _XrmHashBucketRec) -> (),
|
||||
pub fn XtAppGetExitFlag (_1: XtAppContext) -> c_char,
|
||||
pub fn XtAppGetSelectionTimeout (_1: XtAppContext) -> c_ulong,
|
||||
pub fn XtAppInitialize (_9: *mut XtAppContext, _8: *const c_char, _7: XrmOptionDescList, _6: c_uint, _5: *mut c_int, _4: *mut *mut c_char, _3: *mut *mut c_char, _2: *mut Arg, _1: c_uint) -> Widget,
|
||||
pub fn XtAppLock (_1: XtAppContext) -> (),
|
||||
pub fn XtAppMainLoop (_1: XtAppContext) -> (),
|
||||
pub fn XtAppNextEvent (_2: XtAppContext, _1: *mut XEvent) -> (),
|
||||
pub fn XtAppPeekEvent (_2: XtAppContext, _1: *mut XEvent) -> c_char,
|
||||
pub fn XtAppPending (_1: XtAppContext) -> c_ulong,
|
||||
pub fn XtAppProcessEvent (_2: XtAppContext, _1: c_ulong) -> (),
|
||||
pub fn XtAppReleaseCacheRefs (_2: XtAppContext, _1: *mut *mut c_void) -> (),
|
||||
pub fn XtAppSetErrorHandler (_2: XtAppContext, _1: Option<unsafe extern "C" fn (*mut c_char)>) -> Option<unsafe extern "C" fn (*mut c_char)>,
|
||||
pub fn XtAppSetErrorMsgHandler (_2: XtAppContext, _1: Option<unsafe extern "C" fn (*mut c_char, *mut c_char, *mut c_char, *mut c_char, *mut *mut c_char, *mut c_uint)>) -> Option<unsafe extern "C" fn (*mut c_char, *mut c_char, *mut c_char, *mut c_char, *mut *mut c_char, *mut c_uint)>,
|
||||
pub fn XtAppSetExitFlag (_1: XtAppContext) -> (),
|
||||
pub fn XtAppSetFallbackResources (_2: XtAppContext, _1: *mut *mut c_char) -> (),
|
||||
pub fn XtAppSetSelectionTimeout (_2: XtAppContext, _1: c_ulong) -> (),
|
||||
pub fn XtAppSetTypeConverter (_8: XtAppContext, _7: *const c_char, _6: *const c_char, _5: Option<unsafe extern "C" fn (*mut Display, *mut XrmValue, *mut c_uint, *mut XrmValue, *mut XrmValue, *mut *mut c_void) -> c_char>, _4: XtConvertArgList, _3: c_uint, _2: c_int, _1: Option<unsafe extern "C" fn (XtAppContext, *mut XrmValue, *mut c_void, *mut XrmValue, *mut c_uint)>) -> (),
|
||||
pub fn XtAppSetWarningHandler (_2: XtAppContext, _1: Option<unsafe extern "C" fn (*mut c_char)>) -> Option<unsafe extern "C" fn (*mut c_char)>,
|
||||
pub fn XtAppSetWarningMsgHandler (_2: XtAppContext, _1: Option<unsafe extern "C" fn (*mut c_char, *mut c_char, *mut c_char, *mut c_char, *mut *mut c_char, *mut c_uint)>) -> Option<unsafe extern "C" fn (*mut c_char, *mut c_char, *mut c_char, *mut c_char, *mut *mut c_char, *mut c_uint)>,
|
||||
pub fn XtAppUnlock (_1: XtAppContext) -> (),
|
||||
pub fn XtAppWarning (_2: XtAppContext, _1: *const c_char) -> (),
|
||||
pub fn XtAppWarningMsg (_7: XtAppContext, _6: *const c_char, _5: *const c_char, _4: *const c_char, _3: *const c_char, _2: *mut *mut c_char, _1: *mut c_uint) -> (),
|
||||
pub fn XtAugmentTranslations (_2: Widget, _1: *mut _TranslationData) -> (),
|
||||
pub fn XtBuildEventMask (_1: Widget) -> c_ulong,
|
||||
pub fn XtCallAcceptFocus (_2: Widget, _1: *mut c_ulong) -> c_char,
|
||||
pub fn XtCallActionProc (_5: Widget, _4: *const c_char, _3: *mut XEvent, _2: *mut *mut c_char, _1: c_uint) -> (),
|
||||
pub fn XtCallbackExclusive (_3: Widget, _2: *mut c_void, _1: *mut c_void) -> (),
|
||||
pub fn XtCallbackNone (_3: Widget, _2: *mut c_void, _1: *mut c_void) -> (),
|
||||
pub fn XtCallbackNonexclusive (_3: Widget, _2: *mut c_void, _1: *mut c_void) -> (),
|
||||
pub fn XtCallbackPopdown (_3: Widget, _2: *mut c_void, _1: *mut c_void) -> (),
|
||||
pub fn XtCallbackReleaseCacheRef (_3: Widget, _2: *mut c_void, _1: *mut c_void) -> (),
|
||||
pub fn XtCallbackReleaseCacheRefList (_3: Widget, _2: *mut c_void, _1: *mut c_void) -> (),
|
||||
pub fn XtCallCallbackList (_3: Widget, _2: XtCallbackList, _1: *mut c_void) -> (),
|
||||
pub fn XtCallCallbacks (_3: Widget, _2: *const c_char, _1: *mut c_void) -> (),
|
||||
pub fn XtCallConverter (_7: *mut Display, _6: Option<unsafe extern "C" fn (*mut Display, *mut XrmValue, *mut c_uint, *mut XrmValue, *mut XrmValue, *mut *mut c_void) -> c_char>, _5: *mut XrmValue, _4: c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCalloc (_2: c_uint, _1: c_uint) -> *mut c_char,
|
||||
pub fn XtCancelSelectionRequest (_2: Widget, _1: c_ulong) -> (),
|
||||
pub fn XtChangeManagedSet (_6: *mut Widget, _5: c_uint, _4: Option<unsafe extern "C" fn (Widget, *mut Widget, *mut c_uint, *mut Widget, *mut c_uint, *mut c_void)>, _3: *mut c_void, _2: *mut Widget, _1: c_uint) -> (),
|
||||
pub fn XtClass (_1: Widget) -> WidgetClass,
|
||||
pub fn XtCloseDisplay (_1: *mut Display) -> (),
|
||||
pub fn XtConfigureWidget (_6: Widget, _5: c_short, _4: c_short, _3: c_ushort, _2: c_ushort, _1: c_ushort) -> (),
|
||||
pub fn XtConvert (_5: Widget, _4: *const c_char, _3: *mut XrmValue, _2: *const c_char, _1: *mut XrmValue) -> (),
|
||||
pub fn XtConvertAndStore (_5: Widget, _4: *const c_char, _3: *mut XrmValue, _2: *const c_char, _1: *mut XrmValue) -> c_char,
|
||||
pub fn XtConvertCase (_4: *mut Display, _3: c_ulong, _2: *mut c_ulong, _1: *mut c_ulong) -> (),
|
||||
pub fn XtCreateApplicationContext () -> XtAppContext,
|
||||
pub fn XtCreateApplicationShell (_4: *const c_char, _3: WidgetClass, _2: *mut Arg, _1: c_uint) -> Widget,
|
||||
pub fn XtCreateManagedWidget (_5: *const c_char, _4: WidgetClass, _3: Widget, _2: *mut Arg, _1: c_uint) -> Widget,
|
||||
pub fn XtCreatePopupShell (_5: *const c_char, _4: WidgetClass, _3: Widget, _2: *mut Arg, _1: c_uint) -> Widget,
|
||||
pub fn XtCreateSelectionRequest (_2: Widget, _1: c_ulong) -> (),
|
||||
pub fn XtCreateWidget (_5: *const c_char, _4: WidgetClass, _3: Widget, _2: *mut Arg, _1: c_uint) -> Widget,
|
||||
pub fn XtCreateWindow (_5: Widget, _4: c_uint, _3: *mut Visual, _2: c_ulong, _1: *mut XSetWindowAttributes) -> (),
|
||||
pub fn XtCvtColorToPixel (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtIntToBool (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtIntToBoolean (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtIntToColor (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtIntToFloat (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtIntToFont (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtIntToPixel (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtIntToPixmap (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtIntToShort (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtIntToUnsignedChar (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtStringToAcceleratorTable (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtStringToAtom (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtStringToBool (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtStringToBoolean (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtStringToCommandArgArray (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtStringToCursor (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtStringToDimension (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtStringToDirectoryString (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtStringToDisplay (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtStringToFile (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtStringToFloat (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtStringToFont (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtStringToFontSet (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtStringToFontStruct (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtStringToGravity (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtStringToInitialState (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtStringToInt (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtStringToPixel (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtStringToRestartStyle (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtStringToShort (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtStringToTranslationTable (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtStringToUnsignedChar (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtCvtStringToVisual (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char,
|
||||
pub fn XtDatabase (_1: *mut Display) -> *mut _XrmHashBucketRec,
|
||||
pub fn XtDestroyApplicationContext (_1: XtAppContext) -> (),
|
||||
pub fn XtDestroyGC (_1: GC) -> (),
|
||||
pub fn XtDestroyWidget (_1: Widget) -> (),
|
||||
pub fn XtDirectConvert (_5: Option<unsafe extern "C" fn (*mut XrmValue, *mut c_uint, *mut XrmValue, *mut XrmValue)>, _4: *mut XrmValue, _3: c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (),
|
||||
pub fn XtDisownSelection (_3: Widget, _2: c_ulong, _1: c_ulong) -> (),
|
||||
pub fn XtDispatchEvent (_1: *mut XEvent) -> c_char,
|
||||
pub fn XtDispatchEventToWidget (_2: Widget, _1: *mut XEvent) -> c_char,
|
||||
pub fn XtDisplay (_1: Widget) -> *mut Display,
|
||||
pub fn XtDisplayInitialize (_8: XtAppContext, _7: *mut Display, _6: *const c_char, _5: *const c_char, _4: XrmOptionDescList, _3: c_uint, _2: *mut c_int, _1: *mut *mut c_char) -> (),
|
||||
pub fn XtDisplayOfObject (_1: Widget) -> *mut Display,
|
||||
pub fn XtDisplayStringConversionWarning (_3: *mut Display, _2: *const c_char, _1: *const c_char) -> (),
|
||||
pub fn XtDisplayToApplicationContext (_1: *mut Display) -> XtAppContext,
|
||||
pub fn XtError (_1: *const c_char) -> (),
|
||||
pub fn XtErrorMsg (_6: *const c_char, _5: *const c_char, _4: *const c_char, _3: *const c_char, _2: *mut *mut c_char, _1: *mut c_uint) -> (),
|
||||
pub fn XtFindFile (_4: *const c_char, _3: Substitution, _2: c_uint, _1: Option<unsafe extern "C" fn (*mut c_char) -> c_char>) -> *mut c_char,
|
||||
pub fn XtFree (_1: *mut c_char) -> (),
|
||||
pub fn XtGetActionKeysym (_2: *mut XEvent, _1: *mut c_uint) -> c_ulong,
|
||||
pub fn XtGetActionList (_3: WidgetClass, _2: *mut *mut XtActionsRec, _1: *mut c_uint) -> (),
|
||||
pub fn XtGetApplicationNameAndClass (_3: *mut Display, _2: *mut *mut c_char, _1: *mut *mut c_char) -> (),
|
||||
pub fn XtGetApplicationResources (_6: Widget, _5: *mut c_void, _4: *mut XtResource, _3: c_uint, _2: *mut Arg, _1: c_uint) -> (),
|
||||
pub fn XtGetClassExtension (_5: WidgetClass, _4: c_uint, _3: c_int, _2: c_long, _1: c_uint) -> *mut c_void,
|
||||
pub fn XtGetConstraintResourceList (_3: WidgetClass, _2: *mut *mut XtResource, _1: *mut c_uint) -> (),
|
||||
pub fn XtGetDisplays (_3: XtAppContext, _2: *mut *mut *mut Display, _1: *mut c_uint) -> (),
|
||||
pub fn XtGetErrorDatabase () -> *mut *mut _XrmHashBucketRec,
|
||||
pub fn XtGetErrorDatabaseText (_6: *const c_char, _5: *const c_char, _4: *const c_char, _3: *const c_char, _2: *mut c_char, _1: c_int) -> (),
|
||||
pub fn XtGetGC (_3: Widget, _2: c_ulong, _1: *mut XGCValues) -> GC,
|
||||
pub fn XtGetKeyboardFocusWidget (_1: Widget) -> Widget,
|
||||
pub fn XtGetKeysymTable (_3: *mut Display, _2: *mut c_uchar, _1: *mut c_int) -> *mut c_ulong,
|
||||
pub fn XtGetMultiClickTime (_1: *mut Display) -> c_int,
|
||||
pub fn XtGetResourceList (_3: WidgetClass, _2: *mut *mut XtResource, _1: *mut c_uint) -> (),
|
||||
pub fn XtGetSelectionParameters (_7: Widget, _6: c_ulong, _5: *mut c_void, _4: *mut c_ulong, _3: *mut *mut c_void, _2: *mut c_ulong, _1: *mut c_int) -> (),
|
||||
pub fn XtGetSelectionRequest (_3: Widget, _2: c_ulong, _1: *mut c_void) -> *mut XSelectionRequestEvent,
|
||||
pub fn XtGetSelectionTimeout () -> c_ulong,
|
||||
pub fn XtGetSelectionValue (_6: Widget, _5: c_ulong, _4: c_ulong, _3: Option<unsafe extern "C" fn (Widget, *mut c_void, *mut c_ulong, *mut c_ulong, *mut c_void, *mut c_ulong, *mut c_int)>, _2: *mut c_void, _1: c_ulong) -> (),
|
||||
pub fn XtGetSelectionValueIncremental (_6: Widget, _5: c_ulong, _4: c_ulong, _3: Option<unsafe extern "C" fn (Widget, *mut c_void, *mut c_ulong, *mut c_ulong, *mut c_void, *mut c_ulong, *mut c_int)>, _2: *mut c_void, _1: c_ulong) -> (),
|
||||
pub fn XtGetSelectionValues (_7: Widget, _6: c_ulong, _5: *mut c_ulong, _4: c_int, _3: Option<unsafe extern "C" fn (Widget, *mut c_void, *mut c_ulong, *mut c_ulong, *mut c_void, *mut c_ulong, *mut c_int)>, _2: *mut *mut c_void, _1: c_ulong) -> (),
|
||||
pub fn XtGetSelectionValuesIncremental (_7: Widget, _6: c_ulong, _5: *mut c_ulong, _4: c_int, _3: Option<unsafe extern "C" fn (Widget, *mut c_void, *mut c_ulong, *mut c_ulong, *mut c_void, *mut c_ulong, *mut c_int)>, _2: *mut *mut c_void, _1: c_ulong) -> (),
|
||||
pub fn XtGetSubresources (_8: Widget, _7: *mut c_void, _6: *const c_char, _5: *const c_char, _4: *mut XtResource, _3: c_uint, _2: *mut Arg, _1: c_uint) -> (),
|
||||
pub fn XtGetSubvalues (_5: *mut c_void, _4: *mut XtResource, _3: c_uint, _2: *mut Arg, _1: c_uint) -> (),
|
||||
pub fn XtGetValues (_3: Widget, _2: *mut Arg, _1: c_uint) -> (),
|
||||
pub fn XtGrabButton (_9: Widget, _8: c_int, _7: c_uint, _6: c_char, _5: c_uint, _4: c_int, _3: c_int, _2: c_ulong, _1: c_ulong) -> (),
|
||||
pub fn XtGrabKey (_6: Widget, _5: c_uchar, _4: c_uint, _3: c_char, _2: c_int, _1: c_int) -> (),
|
||||
pub fn XtGrabKeyboard (_5: Widget, _4: c_char, _3: c_int, _2: c_int, _1: c_ulong) -> c_int,
|
||||
pub fn XtGrabPointer (_8: Widget, _7: c_char, _6: c_uint, _5: c_int, _4: c_int, _3: c_ulong, _2: c_ulong, _1: c_ulong) -> c_int,
|
||||
pub fn XtHasCallbacks (_2: Widget, _1: *const c_char) -> XtCallbackStatus,
|
||||
pub fn XtHooksOfDisplay (_1: *mut Display) -> Widget,
|
||||
pub fn XtInitialize (_6: *const c_char, _5: *const c_char, _4: XrmOptionDescList, _3: c_uint, _2: *mut c_int, _1: *mut *mut c_char) -> Widget,
|
||||
pub fn XtInitializeWidgetClass (_1: WidgetClass) -> (),
|
||||
pub fn XtInsertEventHandler (_6: Widget, _5: c_ulong, _4: c_char, _3: Option<unsafe extern "C" fn (Widget, *mut c_void, *mut XEvent, *mut c_char)>, _2: *mut c_void, _1: XtListPosition) -> (),
|
||||
pub fn XtInsertEventTypeHandler (_6: Widget, _5: c_int, _4: *mut c_void, _3: Option<unsafe extern "C" fn (Widget, *mut c_void, *mut XEvent, *mut c_char)>, _2: *mut c_void, _1: XtListPosition) -> (),
|
||||
pub fn XtInsertRawEventHandler (_6: Widget, _5: c_ulong, _4: c_char, _3: Option<unsafe extern "C" fn (Widget, *mut c_void, *mut XEvent, *mut c_char)>, _2: *mut c_void, _1: XtListPosition) -> (),
|
||||
pub fn XtInstallAccelerators (_2: Widget, _1: Widget) -> (),
|
||||
pub fn XtInstallAllAccelerators (_2: Widget, _1: Widget) -> (),
|
||||
pub fn XtIsApplicationShell (_1: Widget) -> c_char,
|
||||
pub fn XtIsComposite (_1: Widget) -> c_char,
|
||||
pub fn XtIsConstraint (_1: Widget) -> c_char,
|
||||
pub fn XtIsManaged (_1: Widget) -> c_char,
|
||||
pub fn XtIsObject (_1: Widget) -> c_char,
|
||||
pub fn XtIsOverrideShell (_1: Widget) -> c_char,
|
||||
pub fn XtIsRealized (_1: Widget) -> c_char,
|
||||
pub fn XtIsRectObj (_1: Widget) -> c_char,
|
||||
pub fn XtIsSensitive (_1: Widget) -> c_char,
|
||||
pub fn XtIsSessionShell (_1: Widget) -> c_char,
|
||||
pub fn XtIsShell (_1: Widget) -> c_char,
|
||||
pub fn XtIsSubclass (_2: Widget, _1: WidgetClass) -> c_char,
|
||||
pub fn XtIsTopLevelShell (_1: Widget) -> c_char,
|
||||
pub fn XtIsTransientShell (_1: Widget) -> c_char,
|
||||
pub fn XtIsVendorShell (_1: Widget) -> c_char,
|
||||
pub fn XtIsWidget (_1: Widget) -> c_char,
|
||||
pub fn XtIsWMShell (_1: Widget) -> c_char,
|
||||
pub fn XtKeysymToKeycodeList (_4: *mut Display, _3: c_ulong, _2: *mut *mut c_uchar, _1: *mut c_uint) -> (),
|
||||
pub fn XtLastEventProcessed (_1: *mut Display) -> *mut XEvent,
|
||||
pub fn XtLastTimestampProcessed (_1: *mut Display) -> c_ulong,
|
||||
pub fn XtMainLoop () -> (),
|
||||
pub fn XtMakeGeometryRequest (_3: Widget, _2: *mut XtWidgetGeometry, _1: *mut XtWidgetGeometry) -> XtGeometryResult,
|
||||
pub fn XtMakeResizeRequest (_5: Widget, _4: c_ushort, _3: c_ushort, _2: *mut c_ushort, _1: *mut c_ushort) -> XtGeometryResult,
|
||||
pub fn XtMalloc (_1: c_uint) -> *mut c_char,
|
||||
pub fn XtManageChild (_1: Widget) -> (),
|
||||
pub fn XtManageChildren (_2: *mut Widget, _1: c_uint) -> (),
|
||||
pub fn XtMapWidget (_1: Widget) -> (),
|
||||
pub fn XtMenuPopupAction (_4: Widget, _3: *mut XEvent, _2: *mut *mut c_char, _1: *mut c_uint) -> (),
|
||||
pub fn XtMergeArgLists (_4: *mut Arg, _3: c_uint, _2: *mut Arg, _1: c_uint) -> *mut Arg,
|
||||
pub fn XtMoveWidget (_3: Widget, _2: c_short, _1: c_short) -> (),
|
||||
pub fn XtName (_1: Widget) -> *mut c_char,
|
||||
pub fn XtNameToWidget (_2: Widget, _1: *const c_char) -> Widget,
|
||||
pub fn XtNewString (_1: *mut c_char) -> *mut c_char,
|
||||
pub fn XtNextEvent (_1: *mut XEvent) -> (),
|
||||
pub fn XtNoticeSignal (_1: c_ulong) -> (),
|
||||
pub fn XtOpenApplication (_10: *mut XtAppContext, _9: *const c_char, _8: XrmOptionDescList, _7: c_uint, _6: *mut c_int, _5: *mut *mut c_char, _4: *mut *mut c_char, _3: WidgetClass, _2: *mut Arg, _1: c_uint) -> Widget,
|
||||
pub fn XtOpenDisplay (_8: XtAppContext, _7: *const c_char, _6: *const c_char, _5: *const c_char, _4: XrmOptionDescList, _3: c_uint, _2: *mut c_int, _1: *mut *mut c_char) -> *mut Display,
|
||||
pub fn XtOverrideTranslations (_2: Widget, _1: *mut _TranslationData) -> (),
|
||||
pub fn XtOwnSelection (_6: Widget, _5: c_ulong, _4: c_ulong, _3: Option<unsafe extern "C" fn (Widget, *mut c_ulong, *mut c_ulong, *mut c_ulong, *mut *mut c_void, *mut c_ulong, *mut c_int) -> c_char>, _2: Option<unsafe extern "C" fn (Widget, *mut c_ulong)>, _1: Option<unsafe extern "C" fn (Widget, *mut c_ulong, *mut c_ulong)>) -> c_char,
|
||||
pub fn XtOwnSelectionIncremental (_8: Widget, _7: c_ulong, _6: c_ulong, _5: Option<unsafe extern "C" fn (Widget, *mut c_ulong, *mut c_ulong, *mut c_ulong, *mut *mut c_void, *mut c_ulong, *mut c_int, *mut c_ulong, *mut c_void, *mut *mut c_void) -> c_char>, _4: Option<unsafe extern "C" fn (Widget, *mut c_ulong, *mut c_void)>, _3: Option<unsafe extern "C" fn (Widget, *mut c_ulong, *mut c_ulong, *mut *mut c_void, *mut c_void)>, _2: Option<unsafe extern "C" fn (Widget, *mut c_ulong, *mut c_ulong, *mut *mut c_void, *mut c_void)>, _1: *mut c_void) -> c_char,
|
||||
pub fn XtParent (_1: Widget) -> Widget,
|
||||
pub fn XtParseAcceleratorTable (_1: *const c_char) -> *mut _TranslationData,
|
||||
pub fn XtParseTranslationTable (_1: *const c_char) -> *mut _TranslationData,
|
||||
pub fn XtPeekEvent (_1: *mut XEvent) -> c_char,
|
||||
pub fn XtPending () -> c_char,
|
||||
pub fn XtPopdown (_1: Widget) -> (),
|
||||
pub fn XtPopup (_2: Widget, _1: XtGrabKind) -> (),
|
||||
pub fn XtPopupSpringLoaded (_1: Widget) -> (),
|
||||
pub fn XtProcessEvent (_1: c_ulong) -> (),
|
||||
pub fn XtProcessLock () -> (),
|
||||
pub fn XtProcessUnlock () -> (),
|
||||
pub fn XtQueryGeometry (_3: Widget, _2: *mut XtWidgetGeometry, _1: *mut XtWidgetGeometry) -> XtGeometryResult,
|
||||
pub fn XtRealizeWidget (_1: Widget) -> (),
|
||||
pub fn XtRealloc (_2: *mut c_char, _1: c_uint) -> *mut c_char,
|
||||
pub fn XtRegisterCaseConverter (_4: *mut Display, _3: Option<unsafe extern "C" fn (*mut Display, c_ulong, *mut c_ulong, *mut c_ulong)>, _2: c_ulong, _1: c_ulong) -> (),
|
||||
pub fn XtRegisterDrawable (_3: *mut Display, _2: c_ulong, _1: Widget) -> (),
|
||||
pub fn XtRegisterExtensionSelector (_5: *mut Display, _4: c_int, _3: c_int, _2: Option<unsafe extern "C" fn (Widget, *mut c_int, *mut *mut c_void, c_int, *mut c_void)>, _1: *mut c_void) -> (),
|
||||
pub fn XtRegisterGrabAction (_5: Option<unsafe extern "C" fn (Widget, *mut XEvent, *mut *mut c_char, *mut c_uint)>, _4: c_char, _3: c_uint, _2: c_int, _1: c_int) -> (),
|
||||
pub fn XtReleaseGC (_2: Widget, _1: GC) -> (),
|
||||
pub fn XtReleasePropertyAtom (_2: Widget, _1: c_ulong) -> (),
|
||||
pub fn XtRemoveActionHook (_1: *mut c_void) -> (),
|
||||
pub fn XtRemoveAllCallbacks (_2: Widget, _1: *const c_char) -> (),
|
||||
pub fn XtRemoveBlockHook (_1: c_ulong) -> (),
|
||||
pub fn XtRemoveCallback (_4: Widget, _3: *const c_char, _2: Option<unsafe extern "C" fn (Widget, *mut c_void, *mut c_void)>, _1: *mut c_void) -> (),
|
||||
pub fn XtRemoveCallbacks (_3: Widget, _2: *const c_char, _1: XtCallbackList) -> (),
|
||||
pub fn XtRemoveEventHandler (_5: Widget, _4: c_ulong, _3: c_char, _2: Option<unsafe extern "C" fn (Widget, *mut c_void, *mut XEvent, *mut c_char)>, _1: *mut c_void) -> (),
|
||||
pub fn XtRemoveEventTypeHandler (_5: Widget, _4: c_int, _3: *mut c_void, _2: Option<unsafe extern "C" fn (Widget, *mut c_void, *mut XEvent, *mut c_char)>, _1: *mut c_void) -> (),
|
||||
pub fn XtRemoveGrab (_1: Widget) -> (),
|
||||
pub fn XtRemoveInput (_1: c_ulong) -> (),
|
||||
pub fn XtRemoveRawEventHandler (_5: Widget, _4: c_ulong, _3: c_char, _2: Option<unsafe extern "C" fn (Widget, *mut c_void, *mut XEvent, *mut c_char)>, _1: *mut c_void) -> (),
|
||||
pub fn XtRemoveSignal (_1: c_ulong) -> (),
|
||||
pub fn XtRemoveTimeOut (_1: c_ulong) -> (),
|
||||
pub fn XtRemoveWorkProc (_1: c_ulong) -> (),
|
||||
pub fn XtReservePropertyAtom (_1: Widget) -> c_ulong,
|
||||
pub fn XtResizeWidget (_4: Widget, _3: c_ushort, _2: c_ushort, _1: c_ushort) -> (),
|
||||
pub fn XtResizeWindow (_1: Widget) -> (),
|
||||
pub fn XtResolvePathname (_8: *mut Display, _7: *const c_char, _6: *const c_char, _5: *const c_char, _4: *const c_char, _3: Substitution, _2: c_uint, _1: Option<unsafe extern "C" fn (*mut c_char) -> c_char>) -> *mut c_char,
|
||||
pub fn XtScreen (_1: Widget) -> *mut Screen,
|
||||
pub fn XtScreenDatabase (_1: *mut Screen) -> *mut _XrmHashBucketRec,
|
||||
pub fn XtScreenOfObject (_1: Widget) -> *mut Screen,
|
||||
pub fn XtSendSelectionRequest (_3: Widget, _2: c_ulong, _1: c_ulong) -> (),
|
||||
pub fn XtSessionGetToken (_1: Widget) -> XtCheckpointToken,
|
||||
pub fn XtSessionReturnToken (_1: XtCheckpointToken) -> (),
|
||||
pub fn XtSetErrorHandler (_1: Option<unsafe extern "C" fn (*mut c_char)>) -> (),
|
||||
pub fn XtSetErrorMsgHandler (_1: Option<unsafe extern "C" fn (*mut c_char, *mut c_char, *mut c_char, *mut c_char, *mut *mut c_char, *mut c_uint)>) -> (),
|
||||
pub fn XtSetEventDispatcher (_3: *mut Display, _2: c_int, _1: Option<unsafe extern "C" fn (*mut XEvent) -> c_char>) -> Option<unsafe extern "C" fn (*mut XEvent) -> c_char>,
|
||||
pub fn XtSetKeyboardFocus (_2: Widget, _1: Widget) -> (),
|
||||
pub fn XtSetKeyTranslator (_2: *mut Display, _1: Option<unsafe extern "C" fn (*mut Display, c_uchar, c_uint, *mut c_uint, *mut c_ulong)>) -> (),
|
||||
pub fn XtSetLanguageProc (_3: XtAppContext, _2: Option<unsafe extern "C" fn (*mut Display, *mut c_char, *mut c_void) -> *mut c_char>, _1: *mut c_void) -> Option<unsafe extern "C" fn (*mut Display, *mut c_char, *mut c_void) -> *mut c_char>,
|
||||
pub fn XtSetMappedWhenManaged (_2: Widget, _1: c_char) -> (),
|
||||
pub fn XtSetMultiClickTime (_2: *mut Display, _1: c_int) -> (),
|
||||
pub fn XtSetSelectionParameters (_6: Widget, _5: c_ulong, _4: c_ulong, _3: *mut c_void, _2: c_ulong, _1: c_int) -> (),
|
||||
pub fn XtSetSelectionTimeout (_1: c_ulong) -> (),
|
||||
pub fn XtSetSensitive (_2: Widget, _1: c_char) -> (),
|
||||
pub fn XtSetSubvalues (_5: *mut c_void, _4: *mut XtResource, _3: c_uint, _2: *mut Arg, _1: c_uint) -> (),
|
||||
pub fn XtSetTypeConverter (_7: *const c_char, _6: *const c_char, _5: Option<unsafe extern "C" fn (*mut Display, *mut XrmValue, *mut c_uint, *mut XrmValue, *mut XrmValue, *mut *mut c_void) -> c_char>, _4: XtConvertArgList, _3: c_uint, _2: c_int, _1: Option<unsafe extern "C" fn (XtAppContext, *mut XrmValue, *mut c_void, *mut XrmValue, *mut c_uint)>) -> (),
|
||||
pub fn XtSetValues (_3: Widget, _2: *mut Arg, _1: c_uint) -> (),
|
||||
pub fn XtSetWarningHandler (_1: Option<unsafe extern "C" fn (*mut c_char)>) -> (),
|
||||
pub fn XtSetWarningMsgHandler (_1: Option<unsafe extern "C" fn (*mut c_char, *mut c_char, *mut c_char, *mut c_char, *mut *mut c_char, *mut c_uint)>) -> (),
|
||||
pub fn XtSetWMColormapWindows (_3: Widget, _2: *mut Widget, _1: c_uint) -> (),
|
||||
pub fn XtStringConversionWarning (_2: *const c_char, _1: *const c_char) -> (),
|
||||
pub fn XtSuperclass (_1: Widget) -> WidgetClass,
|
||||
pub fn XtToolkitInitialize () -> (),
|
||||
pub fn XtToolkitThreadInitialize () -> c_char,
|
||||
pub fn XtTranslateCoords (_5: Widget, _4: c_short, _3: c_short, _2: *mut c_short, _1: *mut c_short) -> (),
|
||||
pub fn XtTranslateKey (_5: *mut Display, _4: c_uchar, _3: c_uint, _2: *mut c_uint, _1: *mut c_ulong) -> (),
|
||||
pub fn XtTranslateKeycode (_5: *mut Display, _4: c_uchar, _3: c_uint, _2: *mut c_uint, _1: *mut c_ulong) -> (),
|
||||
pub fn XtUngrabButton (_3: Widget, _2: c_uint, _1: c_uint) -> (),
|
||||
pub fn XtUngrabKey (_3: Widget, _2: c_uchar, _1: c_uint) -> (),
|
||||
pub fn XtUngrabKeyboard (_2: Widget, _1: c_ulong) -> (),
|
||||
pub fn XtUngrabPointer (_2: Widget, _1: c_ulong) -> (),
|
||||
pub fn XtUninstallTranslations (_1: Widget) -> (),
|
||||
pub fn XtUnmanageChild (_1: Widget) -> (),
|
||||
pub fn XtUnmanageChildren (_2: *mut Widget, _1: c_uint) -> (),
|
||||
pub fn XtUnmapWidget (_1: Widget) -> (),
|
||||
pub fn XtUnrealizeWidget (_1: Widget) -> (),
|
||||
pub fn XtUnregisterDrawable (_2: *mut Display, _1: c_ulong) -> (),
|
||||
pub fn XtWarning (_1: *const c_char) -> (),
|
||||
pub fn XtWarningMsg (_6: *const c_char, _5: *const c_char, _4: *const c_char, _3: *const c_char, _2: *mut *mut c_char, _1: *mut c_uint) -> (),
|
||||
pub fn XtWidgetToApplicationContext (_1: Widget) -> XtAppContext,
|
||||
pub fn XtWindow (_1: Widget) -> c_ulong,
|
||||
pub fn XtWindowOfObject (_1: Widget) -> c_ulong,
|
||||
pub fn XtWindowToWidget (_2: *mut Display, _1: c_ulong) -> Widget,
|
||||
variadic:
|
||||
pub fn XtAsprintf (_2: *mut *mut c_char, _1: *const c_char) -> c_uint,
|
||||
pub fn XtVaAppCreateShell (_4: *const c_char, _3: *const c_char, _2: WidgetClass, _1: *mut Display) -> Widget,
|
||||
pub fn XtVaAppInitialize (_7: *mut XtAppContext, _6: *const c_char, _5: XrmOptionDescList, _4: c_uint, _3: *mut c_int, _2: *mut *mut c_char, _1: *mut *mut c_char) -> Widget,
|
||||
pub fn XtVaCreateArgsList (_1: *mut c_void) -> *mut c_void,
|
||||
pub fn XtVaCreateManagedWidget (_3: *const c_char, _2: WidgetClass, _1: Widget) -> Widget,
|
||||
pub fn XtVaCreatePopupShell (_3: *const c_char, _2: WidgetClass, _1: Widget) -> Widget,
|
||||
pub fn XtVaCreateWidget (_3: *const c_char, _2: WidgetClass, _1: Widget) -> Widget,
|
||||
pub fn XtVaGetApplicationResources (_4: Widget, _3: *mut c_void, _2: *mut XtResource, _1: c_uint) -> (),
|
||||
pub fn XtVaGetSubresources (_6: Widget, _5: *mut c_void, _4: *const c_char, _3: *const c_char, _2: *mut XtResource, _1: c_uint) -> (),
|
||||
pub fn XtVaGetSubvalues (_3: *mut c_void, _2: *mut XtResource, _1: c_uint) -> (),
|
||||
pub fn XtVaGetValues (_1: Widget) -> (),
|
||||
pub fn XtVaOpenApplication (_8: *mut XtAppContext, _7: *const c_char, _6: XrmOptionDescList, _5: c_uint, _4: *mut c_int, _3: *mut *mut c_char, _2: *mut *mut c_char, _1: WidgetClass) -> Widget,
|
||||
pub fn XtVaSetSubvalues (_3: *mut c_void, _2: *mut XtResource, _1: c_uint) -> (),
|
||||
pub fn XtVaSetValues (_1: Widget) -> (),
|
||||
globals:
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// types
|
||||
//
|
||||
|
||||
|
||||
// TODO structs
|
||||
#[repr(C)] pub struct Arg;
|
||||
#[repr(C)] pub struct SubstitutionRec;
|
||||
#[repr(C)] pub struct _TranslationData;
|
||||
#[repr(C)] pub struct _WidgetClassRec;
|
||||
#[repr(C)] pub struct _WidgetRec;
|
||||
#[repr(C)] pub struct _XtActionsRec;
|
||||
#[repr(C)] pub struct _XtAppStruct;
|
||||
#[repr(C)] pub struct _XtCallbackRec;
|
||||
#[repr(C)] pub struct _XtCheckpointTokenRec;
|
||||
#[repr(C)] pub struct XtConvertArgRec;
|
||||
#[repr(C)] pub struct _XtResource;
|
||||
#[repr(C)] pub struct XtWidgetGeometry;
|
||||
|
||||
// C enums
|
||||
pub type XtCallbackStatus = c_int;
|
||||
pub type XtGeometryResult = c_int;
|
||||
pub type XtGrabKind = c_int;
|
||||
pub type XtListPosition = c_int;
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[cfg(test)]
|
||||
#[repr(C)]
|
||||
enum TestEnum {
|
||||
Variant1,
|
||||
Variant2,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn enum_size_test () {
|
||||
assert!(::std::mem::size_of::<TestEnum>() == ::std::mem::size_of::<c_int>());
|
||||
}
|
||||
|
||||
// struct typedefs
|
||||
pub type ArgList = *mut Arg;
|
||||
pub type Substitution = *mut SubstitutionRec;
|
||||
pub type Widget = *mut _WidgetRec;
|
||||
pub type WidgetClass = *mut _WidgetClassRec;
|
||||
pub type XtAccelerators = *mut _TranslationData;
|
||||
pub type XtActionList = *mut _XtActionsRec;
|
||||
pub type XtActionsRec = _XtActionsRec;
|
||||
pub type XtAppContext = *mut _XtAppStruct;
|
||||
pub type XtCallbackList = *mut _XtCallbackRec;
|
||||
pub type XtCallbackRec = _XtCallbackRec;
|
||||
pub type XtCheckpointToken = *mut _XtCheckpointTokenRec;
|
||||
pub type XtCheckpointTokenRec = _XtCheckpointTokenRec;
|
||||
pub type XtConvertArgList = *mut XtConvertArgRec;
|
||||
pub type XtResource = _XtResource;
|
||||
pub type XtResourceList = *mut _XtResource;
|
||||
pub type XtTranslations = *mut _TranslationData;
|
|
@ -1,42 +0,0 @@
|
|||
// x11-rs: Rust bindings for X11 libraries
|
||||
// The X11 libraries are available under the MIT license.
|
||||
// These bindings are public domain.
|
||||
|
||||
use std::os::raw::{
|
||||
c_int,
|
||||
c_uint,
|
||||
c_ulong,
|
||||
};
|
||||
|
||||
use ::xinput::XDevice;
|
||||
use ::xlib::{
|
||||
Display,
|
||||
GC,
|
||||
Visual,
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// functions
|
||||
//
|
||||
|
||||
|
||||
x11_link! { Xf86vmode, xtst, ["libXtst.so.6", "libXtst.so"], 15,
|
||||
pub fn XTestCompareCurrentCursorWithWindow (_2: *mut Display, _1: c_ulong) -> c_int,
|
||||
pub fn XTestCompareCursorWithWindow (_3: *mut Display, _2: c_ulong, _1: c_ulong) -> c_int,
|
||||
pub fn XTestDiscard (_1: *mut Display) -> c_int,
|
||||
pub fn XTestFakeButtonEvent (_4: *mut Display, _3: c_uint, _2: c_int, _1: c_ulong) -> c_int,
|
||||
pub fn XTestFakeDeviceButtonEvent (_7: *mut Display, _6: *mut XDevice, _5: c_uint, _4: c_int, _3: *mut c_int, _2: c_int, _1: c_ulong) -> c_int,
|
||||
pub fn XTestFakeDeviceKeyEvent (_7: *mut Display, _6: *mut XDevice, _5: c_uint, _4: c_int, _3: *mut c_int, _2: c_int, _1: c_ulong) -> c_int,
|
||||
pub fn XTestFakeDeviceMotionEvent (_7: *mut Display, _6: *mut XDevice, _5: c_int, _4: c_int, _3: *mut c_int, _2: c_int, _1: c_ulong) -> c_int,
|
||||
pub fn XTestFakeKeyEvent (_4: *mut Display, _3: c_uint, _2: c_int, _1: c_ulong) -> c_int,
|
||||
pub fn XTestFakeMotionEvent (_5: *mut Display, _4: c_int, _3: c_int, _2: c_int, _1: c_ulong) -> c_int,
|
||||
pub fn XTestFakeProximityEvent (_6: *mut Display, _5: *mut XDevice, _4: c_int, _3: *mut c_int, _2: c_int, _1: c_ulong) -> c_int,
|
||||
pub fn XTestFakeRelativeMotionEvent (_4: *mut Display, _3: c_int, _2: c_int, _1: c_ulong) -> c_int,
|
||||
pub fn XTestGrabControl (_2: *mut Display, _1: c_int) -> c_int,
|
||||
pub fn XTestQueryExtension (_5: *mut Display, _4: *mut c_int, _3: *mut c_int, _2: *mut c_int, _1: *mut c_int) -> c_int,
|
||||
pub fn XTestSetGContextOfGC (_2: GC, _1: c_ulong) -> (),
|
||||
pub fn XTestSetVisualIDOfVisual (_2: *mut Visual, _1: c_ulong) -> (),
|
||||
variadic:
|
||||
globals:
|
||||
}
|
Загрузка…
Ссылка в новой задаче