Skip to content

Commit e2c5136

Browse files
committed
doc: more details on the Linux API
1 parent c20d95d commit e2c5136

File tree

2 files changed

+65
-50
lines changed

2 files changed

+65
-50
lines changed

docs/source/api.rst

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,33 @@ GNU/Linux
4343

4444
.. class:: Display
4545

46+
Structure that serves as the connection to the X server, and that contains all the information about that X server.
47+
4648
.. class:: Event
4749

50+
XErrorEvent to debug eventual errors.
51+
4852
.. class:: XFixesCursorImage
4953

50-
.. class:: XWindowAttributes
54+
Cursor structure
5155

5256
.. class:: XImage
5357

58+
Description of an image as it exists in the client's memory.
59+
60+
.. class:: XRRCrtcInfo
61+
62+
Structure that contains CRTC information.
63+
5464
.. class:: XRRModeInfo
5565

5666
.. class:: XRRScreenResources
5767

58-
.. class:: XRRCrtcInfo
68+
Structure that contains arrays of XIDs that point to the available outputs and associated CRTCs.
69+
70+
.. class:: XWindowAttributes
71+
72+
Attributes for the specified window.
5973

6074
.. class:: MSS
6175

mss/linux.py

Lines changed: 49 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ class Event(Structure):
6666

6767
class XFixesCursorImage(Structure):
6868
"""
69-
XFixes is an X Window System extension.
70-
See /usr/include/X11/extensions/Xfixes.h
69+
Cursor structure.
70+
/usr/include/X11/extensions/Xfixes.h
71+
https://github.com/freedesktop/xorg-libXfixes/blob/libXfixes-6.0.0/include/X11/extensions/Xfixes.h#L96
7172
"""
7273

7374
_fields_ = [
@@ -84,36 +85,6 @@ class XFixesCursorImage(Structure):
8485
]
8586

8687

87-
class XWindowAttributes(Structure):
88-
"""Attributes for the specified window."""
89-
90-
_fields_ = [
91-
("x", c_int32),
92-
("y", c_int32),
93-
("width", c_int32),
94-
("height", c_int32),
95-
("border_width", c_int32),
96-
("depth", c_int32),
97-
("visual", c_ulong),
98-
("root", c_ulong),
99-
("class", c_int32),
100-
("bit_gravity", c_int32),
101-
("win_gravity", c_int32),
102-
("backing_store", c_int32),
103-
("backing_planes", c_ulong),
104-
("backing_pixel", c_ulong),
105-
("save_under", c_int32),
106-
("colourmap", c_ulong),
107-
("mapinstalled", c_uint32),
108-
("map_state", c_uint32),
109-
("all_event_masks", c_ulong),
110-
("your_event_mask", c_ulong),
111-
("do_not_propagate_mask", c_ulong),
112-
("override_redirect", c_int32),
113-
("screen", c_ulong),
114-
]
115-
116-
11788
class XImage(Structure):
11889
"""
11990
Description of an image as it exists in the client's memory.
@@ -139,6 +110,25 @@ class XImage(Structure):
139110
]
140111

141112

113+
class XRRCrtcInfo(Structure):
114+
"""Structure that contains CRTC information."""
115+
116+
_fields_ = [
117+
("timestamp", c_ulong),
118+
("x", c_int),
119+
("y", c_int),
120+
("width", c_int),
121+
("height", c_int),
122+
("mode", c_long),
123+
("rotation", c_int),
124+
("noutput", c_int),
125+
("outputs", POINTER(c_long)),
126+
("rotations", c_ushort),
127+
("npossible", c_int),
128+
("possible", POINTER(c_long)),
129+
]
130+
131+
142132
class XRRModeInfo(Structure):
143133
"""Voilà, voilà."""
144134

@@ -161,22 +151,33 @@ class XRRScreenResources(Structure):
161151
]
162152

163153

164-
class XRRCrtcInfo(Structure):
165-
"""Structure that contains CRTC information."""
154+
class XWindowAttributes(Structure):
155+
"""Attributes for the specified window."""
166156

167157
_fields_ = [
168-
("timestamp", c_ulong),
169-
("x", c_int),
170-
("y", c_int),
171-
("width", c_int),
172-
("height", c_int),
173-
("mode", c_long),
174-
("rotation", c_int),
175-
("noutput", c_int),
176-
("outputs", POINTER(c_long)),
177-
("rotations", c_ushort),
178-
("npossible", c_int),
179-
("possible", POINTER(c_long)),
158+
("x", c_int32),
159+
("y", c_int32),
160+
("width", c_int32),
161+
("height", c_int32),
162+
("border_width", c_int32),
163+
("depth", c_int32),
164+
("visual", c_ulong),
165+
("root", c_ulong),
166+
("class", c_int32),
167+
("bit_gravity", c_int32),
168+
("win_gravity", c_int32),
169+
("backing_store", c_int32),
170+
("backing_planes", c_ulong),
171+
("backing_pixel", c_ulong),
172+
("save_under", c_int32),
173+
("colourmap", c_ulong),
174+
("mapinstalled", c_uint32),
175+
("map_state", c_uint32),
176+
("all_event_masks", c_ulong),
177+
("your_event_mask", c_ulong),
178+
("do_not_propagate_mask", c_ulong),
179+
("override_redirect", c_int32),
180+
("screen", c_ulong),
180181
]
181182

182183

@@ -226,7 +227,7 @@ def _validate(retval: int, func: Any, args: Tuple[Any, Any]) -> Tuple[Any, Any]:
226227
# This is a dict:
227228
# cfunction: (attr, argtypes, restype)
228229
#
229-
# Available attr: xlib, xrandr.
230+
# Available attr: xfixes, xlib, xrandr.
230231
#
231232
# Note: keep it sorted by cfunction.
232233
CFUNCTIONS: CFunctions = {
@@ -292,7 +293,7 @@ class MSS(MSSBase):
292293
It uses intensively the Xlib and its Xrandr extension.
293294
"""
294295

295-
__slots__ = {"xlib", "xrandr", "xfixes", "_handles"}
296+
__slots__ = {"xfixes", "xlib", "xrandr", "_handles"}
296297

297298
def __init__(self, **kwargs: Any) -> None:
298299
"""GNU/Linux initialisations."""

0 commit comments

Comments
 (0)