Re: gdk_window_foreign_new returns NULL



On Fri, 2005-04-22 at 01:19 +0200, jacktm wrote:


      // Open the display
      Display *dpy = XOpenDisplay(NIL);
      assert(dpy);

      // Get some colors
      int blackColor = BlackPixel(dpy, DefaultScreen(dpy));
      int whiteColor = WhitePixel(dpy, DefaultScreen(dpy));

      // Create the window
      Window w = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, 
                                   200, 100, 0, blackColor, blackColor);
      gdk_win = gdk_window_foreign_new((guint32)w);

If you used the GTK+ display, rather than opening a new one, this code
would work.

But here, the problem is that the command to create 'w' is still queued
up in the buffers for the 'dpy' display, and has not been sent to the
server or processed. 

So, either use GDK_DISPLAY() rather than dpy, or call XSync (dpy,
False); after calling XCreateSimpleWindow()

Regards,
                                                Owen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]