Re: Wrapper for arbitrary Drawable

Hi Alex,

Why do you have to access it through the same display though? The
drawable is just an id for the pixmap, and its the same independent on
what connection to the x server (==display) you use.
Simply because it doesn't work, it generates BadDrawable X error.
Check out the code below:
/* test.c
 * gcc test.c -o test -g -Wall `pkg-config --cflags --libs gdk-2.0`

#include <gdk/gdk.h>
#include <X11/Xlib.h>
#include <stdio.h>

int main(int argc, char** argv)
   gdk_init(&argc, &argv);

   Display* display = XOpenDisplay(NULL);
   if (!display)
       return -1;

   Drawable xid = XCreatePixmap(display, DefaultRootWindow(display),
                                20, 20, 24);

   GdkPixmap* pixmap =
gdk_pixmap_foreign_new_for_display(gdk_display_get_default(), xid);

   printf("Foreign pixmap = %p\n", pixmap);

   return 0;

gdk_pixmap_foreign_new_for_display generates BadDrawable.
This example shows what I eventually need.


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