PDA

View Full Version : XOpenDisplay != X11Info::display()



hasanen
16th April 2008, 11:26
Hi
I was trying to do some core X11 operations from Qt , but nothing works until I replaced XOpenDisplay(NULL) with X11Info::display() , then all operations worked fine.
I printed both pointers received from functions and they are not the same at all.



display=NULL;
// display=XOpenDisplay(NULL); <<-- NOT WORKING !!
display=QX11Info::display();
printf("display=%d\n",display);
if (!display) { qDebug("unable to open local display"); return;}
window=RootWindow(display,0);


How can I use XOpenDisplay under QT?

thanx.

wysota
16th April 2008, 14:25
Qt calls XOpenDisplay() behind the scene. If you open another connection to the X server, it will be different than the one Qt opened for you. You should instead use the one Qt gives you.