0

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,

zeal
  • 465
  • 2
  • 11
  • 22

1 Answers1

1

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.

n. m. could be an AI
  • 112,515
  • 14
  • 128
  • 243
  • what you say is correct but my follow up question is why both prop_list(property) and prop_return are **Atom** type. Like from this [link](http://standards.freedesktop.org/wm-spec/1.3/ar01s05.html#id3076744 ) I found out that for property name **_NET_WM_ALLOWED_ACTIONS** property values are '_NET_WM_ACTION_RESIZE', '_NET_WM_ACTION_MINIMIZE' e.t.c. Then how to distinguish them since 'XInternAtom();' takes 2nd argument which is atom. Apart from this one more question:- can xwindow manager allow a window to be re-sizable if it does not have property if it is '!=_NET_WM_ACTION_RESIZE' like... – zeal Aug 30 '13 at 20:58
  • can xwindow manager allow a window to be re-sizable if it doesn't have the property specifically "_NET_WM_ACTION_RESIZE" like may be other property also allow window to be re-sizable because i am getting the a window which is resizable but it doesn't have the property value **_NET_WM_ACTION_RESIZE**. Can you through some light when is function **XChangeProperty()** called. Please, i earnestly request to take some time to clear my doubt. It would really be appreciating and encouraging. And thanks for reply. If you cant find the time to answer please give some good reference to read. – zeal Aug 30 '13 at 21:08
  • 1
    There is a property named `_NET_WM_ALLOWED_ACTIONS`. Its value type is a *list of atoms*. (Confusing, because the properties list is also a list of atoms). The atoms that may be included in that list are `_NET_WM_ACTION_RESIZE` etc. *Not all properties are like that, some are string-valued, some are pixmap-valued etc., but this one is atom-list-valued*. I don't fully understand what you mean by distinguishing these atoms. A WM *can* ignore `_NET_WM_ALLOWED_ACTIONS` (technically there's nothing that would compel a WM to honour this convention), but it's normally not done. – n. m. could be an AI Aug 30 '13 at 21:08
  • 1
    Run `xprop | grep _NET_WM_ALLOWED_ACTIONS` and click on your window. Does it print `_NET_WM_ACTION_RESIZE`? – n. m. could be an AI Aug 30 '13 at 21:10
  • thanks for answering. But, i still have some doubt to start with 'xprop | grep _NET_WM_ALLOWED_ACTIONS' didn't work any window( i checked many) so just checked 'xprop' with many window and in all of then i didn't get the poperty name ' _NET_WM_ALLOWED_ACTIONS' although i got others property name and it's value. Could you please tell me what am I doing wrong or sth is missing. [And about "distinguish" i was asking because when i use property name or value in the argument of XInternAtom(); it returns numeric vlaue.]. – zeal Aug 31 '13 at 07:19
  • And would you please tell me diff b/w **XGetWMSizeHints()** and **XGetWMNormalHints()**. Because since my last approach is not working so i am confused b/w these two functions which to use to see if window is re-sizable or not. And once please direct me to some reading material which I can use to clear my doubts. I don't want to bother you every time i get some doubt even though it would take easy for me to ask you and your answer is apt and succinct. Thanks again for all the help. – zeal Aug 31 '13 at 07:24
  • What window manager are you using? It is unusual for a modern WM to not support _NET_WM_ALLOWED_ACTIONS. – n. m. could be an AI Aug 31 '13 at 09:49
  • I wish I knew of a good tutorial. I use standards.freedesktop.org when I have to, but that's a reference, not a tutorial. – n. m. could be an AI Aug 31 '13 at 09:51
  • You may also want to check the _MOTIF_WM_HINTS property, that's the pre-freedesktop equivalent of _NET_WM_ALLOWED_ACTIONS and other properties. The value is a list of integers. It should be interpreted according to [this](http://stuff.mit.edu/afs/sipb/project/gnome/old-and-dead/src/gnome-1.0/enlightenment-0.15.0/src/mwm.c). The first number indicates which fields of `_mwmhints` are set, the subsequent ones indicate fields values. You need to find out if `functions` field is set, and if it is, which functions are allowed. – n. m. could be an AI Aug 31 '13 at 10:03
  • Normally the application uses only `XSetWMNormalHints()` and the WM only uses `XGetWMNormalHints()`. `X{Get,Set}WMSizeHints()` is for WM_HINTS stored in a non-standard property. It is best left alone. – n. m. could be an AI Aug 31 '13 at 10:36
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/36592/discussion-between-zeal-and-n-m) – zeal Aug 31 '13 at 17:43
  • thanks @zeal for that link! http://standards.freedesktop.org/wm-spec/1.3/ar01s05.html#id3076744 that was just so awesome i neede da list of `atom`s for `window`s! – Noitidart Sep 22 '14 at 03:07