@@ -180,16 +180,17 @@ def __init__(self, display=None):
180180 self ._set_cfunctions ()
181181
182182 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 )
186184
187185 # Fix for XRRGetScreenResources and XGetImage:
188186 # expected LP_Display instance instead of LP_XWindowAttributes
189187 self .drawable = ctypes .cast (self .root , ctypes .POINTER (Display ))
190188
191189 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+ """
193194
194195 def cfactory (
195196 attr = self .xlib , func = None , argtypes = None , restype = None , errcheck = validate
@@ -216,19 +217,13 @@ def cfactory(
216217 cfactory (func = "XSetErrorHandler" , argtypes = [void ], restype = c_int )
217218 cfactory (
218219 func = "XGetErrorText" ,
219- argtypes = [pointer (Display ), void , char_p , void ],
220+ argtypes = [pointer (Display ), c_int , char_p , c_int ],
220221 restype = void ,
221222 )
222223 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- )
229224 cfactory (
230225 func = "XDefaultRootWindow" ,
231- argtypes = [pointer (Display ), void ],
226+ argtypes = [pointer (Display )],
232227 restype = pointer (XWindowAttributes ),
233228 )
234229 cfactory (
@@ -238,19 +233,19 @@ def cfactory(
238233 pointer (XWindowAttributes ),
239234 pointer (XWindowAttributes ),
240235 ],
241- restype = void ,
236+ restype = c_int ,
242237 )
243238 cfactory (
244239 func = "XGetImage" ,
245240 argtypes = [
246241 pointer (Display ),
247242 pointer (Display ),
248- void ,
249- void ,
243+ c_int ,
244+ c_int ,
250245 uint ,
251246 uint ,
252247 ulong ,
253- void ,
248+ c_int ,
254249 ],
255250 restype = pointer (XImage ),
256251 )
0 commit comments