Comments (2)
It's because CARD32
itself is defined as unsigned long
. The API has been around since long before the C standard had uint32_t
, and int
was only 16 bit in many implementations at the time. This crate has to do things exactly as the C libraries do for binary compatibility.
from x11-rs.
Ah I see.
I'm trying to figure out how those basic X types are defined now but it isn't simple. The type definitions depend mostly on LONG64
and _XSERVER64
being defined or not. Also they're spread over multiple files like X.h
, Xmd.h
, Xproto.h
, Xdefs.h
and maybe more.
In Xproto.h
the defintions are said to be overwritten and restored:
/* For the purpose of the structure definitions in this file,
we must redefine the following types in terms of Xmd.h's types, which may
include bit fields. All of these are #undef'd at the end of this file,
restoring the definitions in X.h. */
Then there's exceptions like this in XI.h
/*
* Make XEventClass be a CARD32 for 64 bit servers. Don't affect client
* definition of XEventClass since that would be a library interface change.
* See the top of X.h for more _XSERVER64 magic.
*
* But, don't actually use the CARD32 type. We can't get it defined here
* without polluting the namespace.
*/
#ifdef _XSERVER64
typedef unsigned int XEventClass;
#else
typedef unsigned long XEventClass;
#endif
Found this comment https://gitlab.freedesktop.org/xorg/xserver/issues/553#note_94062
For the second, it appears you've missed the _XSERVER64 definition that's required when building X server code on 64-bit systems - this is normally
defined in xorg-config.h, xorg-server.h, or dix-config.h depending on which
portion of the X server source code you're working in. The difference in types between clients & servers in 64-bit builds is a very sad mistake from the distant past we're stuck with to avoid breaking compatibility.
To me it looks like X clients use 64 bit integers for some types, but the data structures communicating with the X server (Xproto.h
) use the right (as per the X protocol specification) integer widths. Approximately, probably.
from x11-rs.
Related Issues (20)
- SHM-MIT extension
- x11 vs x11-dl? HOT 3
- undefined reference to `XOpenDisplay' HOT 1
- Debug implementation for XEvent is unsound
- XCreateIC returns null incorrectly but only if another crate (tempfile) is present HOT 1
- XshmSegmentInfo can't be created and its fields should be public
- unify x11/x11-dl crates with dlib HOT 2
- Can't run test_x11 test of my lib-crate even with xlib feature enabled HOT 6
- X11 build dependency failed. HOT 3
- Xcomposite extension HOT 1
- Xdamage extension HOT 1
- How to use the Xfixes extension? HOT 7
- MacOS Support HOT 3
- Can't load shared library on NetBSD
- Missing constant `None`? HOT 3
- Xlib::open takes up a significant amount of the binary HOT 5
- What is the difference between x11 and x11-dl? HOT 2
- Add documentation for the differences between x11 and x11-dl HOT 1
- x11-dl linker error when building musl target on Ubuntu 20.04 with rust 1.72+
- Does x11 support cross-compiling?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from x11-rs.