2323class MSSXCBBase (MSSBase ):
2424 """Base class for XCB-based screenshot implementations.
2525
26- This class provides common XCB initialization and monitor detection logic
27- that can be shared across different XCB screenshot methods (XGetImage,
28- XShmGetImage, XComposite, etc.).
26+ Provides common XCB initialization and monitor detection logic that can be
27+ shared across different XCB screenshot methods (`` XGetImage`` ,
28+ `` XShmGetImage``, `` XComposite`` , etc.).
2929 """
3030
3131 def __init__ (self , / , ** kwargs : Any ) -> None : # noqa: PLR0912
3232 """Initialize an XCB connection and validate the display configuration.
3333
34- Args:
35- **kwargs: Keyword arguments, including optional 'display' for X11 display string.
36-
37- Raises:
38- ScreenShotError: If the display configuration is not supported.
34+ :param kwargs: Optional keyword arguments. Recognized key ``display``
35+ specifies an X11 display string (bytes) to connect to.
3936 """
4037 super ().__init__ (** kwargs )
4138
@@ -127,7 +124,12 @@ def _close_impl(self) -> None:
127124 self .conn = None
128125
129126 def _monitors_impl (self ) -> None :
130- """Get positions of monitors. It will populate self._monitors."""
127+ """Populate monitor geometry information.
128+
129+ Detects and appends monitor rectangles to ``self._monitors``. The first
130+ entry represents the entire X11 root screen; subsequent entries, when
131+ available, represent individual monitors reported by XRandR.
132+ """
131133 if self .conn is None :
132134 msg = "Cannot identify monitors while the connection is closed"
133135 raise ScreenShotError (msg )
@@ -187,6 +189,11 @@ def _monitors_impl(self) -> None:
187189 # style is.
188190
189191 def _cursor_impl_check_xfixes (self ) -> bool :
192+ """Check XFixes availability and version.
193+
194+ :returns: ``True`` if the server provides XFixes with a compatible
195+ version, otherwise ``False``.
196+ """
190197 if self .conn is None :
191198 msg = "Cannot take screenshot while the connection is closed"
192199 raise ScreenShotError (msg )
@@ -201,7 +208,12 @@ def _cursor_impl_check_xfixes(self) -> bool:
201208 return (reply .major_version , reply .minor_version ) >= (2 , 0 )
202209
203210 def _cursor_impl (self ) -> ScreenShot :
204- """Retrieve all cursor data. Pixels have to be RGBx."""
211+ """Capture the current cursor image.
212+
213+ Pixels are returned in BGRA ordering.
214+
215+ :returns: A screenshot object containing the cursor image and region.
216+ """
205217
206218 if self .conn is None :
207219 msg = "Cannot take screenshot while the connection is closed"
@@ -229,10 +241,14 @@ def _cursor_impl(self) -> ScreenShot:
229241 return self .cls_image (data , region )
230242
231243 def _grab_impl_xgetimage (self , monitor : Monitor , / ) -> ScreenShot :
232- """Retrieve all pixels from a monitor using GetImage.
244+ """Retrieve pixels from a monitor using ``GetImage``.
245+
246+ Used by the XGetImage backend and by the XShmGetImage backend in
247+ fallback mode.
233248
234- This is used by the XGetImage backend, and also the XShmGetImage
235- backend in fallback mode.
249+ :param monitor: Monitor rectangle specifying ``left``, ``top``,
250+ ``width``, and ``height`` to capture.
251+ :returns: A screenshot object containing the captured region.
236252 """
237253
238254 if self .conn is None :
0 commit comments