@@ -180,16 +180,17 @@ def __init__(self, display=None):
180
180
self ._set_cfunctions ()
181
181
182
182
self .display = self .xlib .XOpenDisplay (display )
183
- self .root = self .xlib .XDefaultRootWindow (
184
- self .display , self .xlib .XDefaultScreen (self .display )
185
- )
183
+ self .root = self .xlib .XDefaultRootWindow (self .display )
186
184
187
185
# Fix for XRRGetScreenResources and XGetImage:
188
186
# expected LP_Display instance instead of LP_XWindowAttributes
189
187
self .drawable = ctypes .cast (self .root , ctypes .POINTER (Display ))
190
188
191
189
def _set_cfunctions (self ):
192
- """ Set all ctypes functions and attach them to attributes. """
190
+ """
191
+ Set all ctypes functions and attach them to attributes.
192
+ See https://tronche.com/gui/x/xlib/function-index.html for details.
193
+ """
193
194
194
195
def cfactory (
195
196
attr = self .xlib , func = None , argtypes = None , restype = None , errcheck = validate
@@ -216,19 +217,13 @@ def cfactory(
216
217
cfactory (func = "XSetErrorHandler" , argtypes = [void ], restype = c_int )
217
218
cfactory (
218
219
func = "XGetErrorText" ,
219
- argtypes = [pointer (Display ), void , char_p , void ],
220
+ argtypes = [pointer (Display ), c_int , char_p , c_int ],
220
221
restype = void ,
221
222
)
222
223
cfactory (func = "XOpenDisplay" , argtypes = [char_p ], restype = pointer (Display ))
223
- cfactory (
224
- errcheck = None ,
225
- func = "XDefaultScreen" ,
226
- argtypes = [pointer (Display )],
227
- restype = void ,
228
- )
229
224
cfactory (
230
225
func = "XDefaultRootWindow" ,
231
- argtypes = [pointer (Display ), void ],
226
+ argtypes = [pointer (Display )],
232
227
restype = pointer (XWindowAttributes ),
233
228
)
234
229
cfactory (
@@ -238,19 +233,19 @@ def cfactory(
238
233
pointer (XWindowAttributes ),
239
234
pointer (XWindowAttributes ),
240
235
],
241
- restype = void ,
236
+ restype = c_int ,
242
237
)
243
238
cfactory (
244
239
func = "XGetImage" ,
245
240
argtypes = [
246
241
pointer (Display ),
247
242
pointer (Display ),
248
- void ,
249
- void ,
243
+ c_int ,
244
+ c_int ,
250
245
uint ,
251
246
uint ,
252
247
ulong ,
253
- void ,
248
+ c_int ,
254
249
],
255
250
restype = pointer (XImage ),
256
251
)
0 commit comments