problem about XGetTextProperty()

falls huang falls.huang at
Tue Aug 15 20:18:04 PDT 2006


    I met a very strange problem. I wrote a simple program , if  I
executed it in Konsole/xterm , the  XGetTextProperty() return OK;  if
I executed it in gnome-terminal ,  it return error .

   what's the different between kde/gtk program ?


#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>

int main()
    XTextProperty text_prop;
    int status;
    Display *dpy=XOpenDisplay(NULL);
    Window w;
    int val;

    XGetInputFocus(dpy, &w, &val);

    status = XGetTextProperty(dpy,w,&text_prop,XA_WM_NAME);

    if (!status || !text_prop.value || !text_prop.nitems) {
      printf("XGetTextProperty error status=%d\n" , status);
      return -1;
    printf("XGetTextProperty OK\n");
    return 0;

Falls Huang

More information about the xorg mailing list