How is XGetWindowProperty() and XListProperties() related for a particular window-ID

1.7k views Asked by At

A "PropertyNotify" Events is generated by xServer for a Window say with id var "win". Now i call xlib function XGetWindowProperty() and XListProperties() for same win-id as given below

    int getProp(Atom atom, Window win, unsigned long *nitems_ret, 
                unsigned char **prop_return, Atom *type_ret, int *format_ret)
    {
        Atom type;
        int format;
        unsigned long bytes_after_ret;

        if (!type_ret)
            type_ret=&type;

        if (!format_ret)
            format_ret=&format;


        XGetWindowProperty(m_display, win, atom, 0, 65536, 0, 
                           AnyPropertyType, type_ret, format_ret, 
                           nitems_ret, &bytes_after_ret, prop_return);

          // printing the content of variable "prop_return" suppose it's not empty 
                                                               -----------------(1)

       int nprops = 0;
       Atom *prorList = XListProperties(m_display, win, &nprops);

         // printing content of var "prorList"  ------------------------(2)

   };

now comparing the output of (1) and (2), so should the output of (1) be contained in (2) or not. Please give reason to validate the answer. As i understood reading from net that about XGetWindowProperty() that it returns the required property type from the property of given window-id and other supplements. Here for checking i just pass the argument AnyPropertyType.

Now i also call the function XListProperties() to list all the Atom attribute of given win-id and print them to compare with output of XGetWindowProperty() (consider the output is not NULL) but what i find that there is no match b/w them. Now my question is from where did those properties appear in XGetWindowProperty() or fault lies in my understanding. Please explain these functions and difference in their atom attributes. And also it would be really helpful if someone can recommend good xlib book or link to website for better understanding.

Thanks,

1

There are 1 answers

12
n. m. could be an AI On

XListProperties lists property names. prop_return is a property value. There's no reason it should be contained in a list of property names. atom is the name of this property and it should be found in that list.