Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Most xlib functions always return 1 and you should <a href="http://tronche.com/gui/x/xlib/event-handling/protocol-errors/default-handlers.html" rel="nofollow">use error handlers</a> to check for errors. See <a href="https://gist.github.com/3057356" rel="nofollow">XChangeProperty implementation</a> - note <code>return 1</code> at the end.</p> <p>Your code works just fine:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;X11/Xlib.h&gt; #include &lt;X11/Xutil.h&gt; #include &lt;X11/Xos.h&gt; #include &lt;X11/Xatom.h&gt; #include &lt;X11/keysym.h&gt; static void change_prop(Display *display, Window window) { unsigned char some_text[40] = "hello world!"; int retval; Atom my_atom; my_atom = XInternAtom(display, "PERSONAL_PROPERTY", False); if (my_atom == None) { printf("### failed to create atom with name PERSONAL_PROPERTY\n"); return; } retval = XChangeProperty(display, /* connection to x server */ window, /* window whose property we want to change */ my_atom, /* property name */ XA_STRING, /* type of property */ 8, /* format of prop; can be 8, 16, 32 */ PropModeReplace, some_text, /* actual data */ 10 /* number of elements */ ); printf("###### XChangeProperty() reted %d\n", retval); } int main() { Display *dis; Window win; dis = XOpenDisplay(NULL); win = XCreateSimpleWindow(dis, RootWindow(dis, 0), 1, 1, 500, 500, \ 0, BlackPixel (dis, 0), BlackPixel(dis, 0)); XMapWindow(dis, win); printf("window %i\n", (int)win); change_prop(dis, win); XFlush(dis); sleep(50); return(0); } </code></pre> <p>result:</p> <pre><code>09:48 tmp $ g++ prop.cpp /usr/X11/lib/libX11.dylib 09:48 tmp $ ./a.out window 6291457 ###### XChangeProperty() reted 1 </code></pre> <p><a href="http://www.xfree86.org/current/xprop.1.html" rel="nofollow">xprop</a> result:</p> <pre><code>09:48 tmp $ xprop -id 6291457 WM_STATE(WM_STATE): window state: Normal icon window: 0x0 _NET_WM_STATE(ATOM) = _NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_CLOSE PERSONAL_PROPERTY(STRING) = "hello worl" </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload