Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xlib's Window changed to u64, conforming to X.h #245

Merged
merged 1 commit into from
Nov 11, 2023

Conversation

radgeRayden
Copy link
Contributor

As per gfx-rs/wgpu-native#304. The type definition for the X Window handles can be found at https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/blob/master/include/X11/X.h?ref_type=heads#L96. Window is of type XID = u64.

@kainino0x kainino0x added the presentation Presenting images to surfaces like windows and canvases label Nov 10, 2023
@kainino0x
Copy link
Collaborator

kainino0x commented Nov 10, 2023

I found that this changed in this PR, and also was reported as a problem there:
#30 (comment)

Window is of type XID = u64.

AFAICT it can also be u32:

#ifndef _XSERVER64
#  ifndef _XTYPEDEF_XID
#    define _XTYPEDEF_XID
typedef unsigned long XID;
// ...
#else
#  include <X11/Xmd.h>
#  ifndef _XTYPEDEF_XID
#    define _XTYPEDEF_XID
typedef CARD32 XID;

where I'm pretty sure CARD32 is always uint32_t:

# ifdef LONG64
typedef unsigned long CARD64;
typedef unsigned int CARD32;
# else
typedef unsigned long long CARD64;
typedef unsigned long CARD32;
# endif

Anyway, this is a mess. I don't think we can match the type, because it requires knowing whether X was built with _XSERVER64 enabled.

The conclusion is the same, though - we need to make this a uint64_t, I think, so we can represent the handle in either case.

@kainino0x kainino0x requested a review from Kangz November 10, 2023 01:32
@kainino0x kainino0x added the has resolution Issue is resolved, just needs to be done label Nov 11, 2023
@kainino0x kainino0x merged commit f868252 into webgpu-native:main Nov 11, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has resolution Issue is resolved, just needs to be done presentation Presenting images to surfaces like windows and canvases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants