Hello,

I would like to get cursor/mouse-pointer image for an application window in Linux. I have studied several libraries that support Python, but haven't found a suitable function to read Cursor or Pointer image.

PyGTK : http://www.pygtk.org/docs/pygtk/index.html  No success.
Wnck python library: http://library.gnome.org/devel/libwnck/stable/index.html No success. Xlib Python: http://python-xlib.sourceforge.net/doc/html/index.html Did not find it. Can this be right?

I've done it in c-code earlier and it works well.
The c-code is here: http://code.google.com/p/gscreendump/source/browse/trunk/src/sd_xutils.c

GdkPixbuf *get_cursor_pixbuf(Display *display, GdkWindow *gdk_win, gint *cursor_x, gint *cursor_y, gint *offset_x , gint *offset_y/*x-y hot spot */)
{
       GdkWindow *gdk_root = gdk_get_default_root_window();

       /* Cursor image */
       GdkPixbuf *cursor_pixbuf = NULL;

       /* Check if the XFIXES extension is present in the Xorg. */
       int event, error;
       if (XFixesQueryExtension(display, &event, &error))
       {
               XFixesCursorImage *cur = XFixesGetCursorImage(display);

               *cursor_x = cur->x;
               *cursor_y = cur->x;
               *offset_x = cur->xhot;
               *offset_y = cur->yhot;

/* Convert root co-ordinate (x,y) to child window co-ordinates */
               Window child_w;
XTranslateCoordinates(display, GDK_WINDOW_XWINDOW(gdk_root), GDK_WINDOW_XWINDOW(gdk_win), cur->x, cur->y, cursor_x, cursor_y, &child_w);
--------

I would like to use a Python library on Linux.
Can you help?
My system is: Ubuntu 9.04 64bit.
http:/www.futuredesktop.org (.com)

Kindly
 Osmo (moma) Antero
 Grønland
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to