[fdo] Can anyone help me understand xGetImageReply in libx11?

Chuanlong Du longendu at yahoo.com
Sat Jul 31 04:36:37 UTC 2021


 What is the value of rep.length after the call XReply at line 85? Is it (height of screen * width of screen) or (the passed parameter height * the passed parameter width)? 

    On Friday, July 30, 2021, 10:31:22 AM PDT, Alan Coopersmith <alan.coopersmith at oracle.com> wrote:  
 
 Questions about X11 are better handled on the X.Org mailing lists at
https://www.x.org/wiki/XorgMailingLists/ than the generic freedesktop
list.

On 7/29/21 3:08 PM, Chuanlong Du wrote:
> I read the source code of the file GetImage.c in libX11 
> <https://gitlab.freedesktop.org/xorg/lib/libx11/-/blob/master/src/GetImage.c> but got 
> confused by line 66 
> <https://gitlab.freedesktop.org/xorg/lib/libx11/-/blob/master/src/GetImage.c#L66> (see 
> screenshot below for convenience). I couldn't find the definition of 
> xGetImageReply anywhere in the code. 

Since the xGetImageReply structure is part of the protocol between
the client and server, it's defined in the separate xorgproto package
so both libX11 and the Xserver can share the definition and ensure
it's always in sync between both sides.  You can see its definition at:

https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/blob/master/include/X11/Xproto.h#L713-724

> What is the value of rep.length after execution of line 66?

Undefined, as that just declares the variable without initializing it.
It won't be set until the XReply call at line 85 writes the reply
received from the X server into that structure.

-- 
    -Alan Coopersmith-              alan.coopersmith at oracle.com
    Oracle Solaris Engineering - https://blogs.oracle.com/alanc
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/freedesktop/attachments/20210731/409c7711/attachment.htm>


More information about the freedesktop mailing list