So, I have an XImage and i was able to store it in the filesystem, but the image didn't have cursor in it. On further reserch, I found that XOrg has a fix for this, using extension Xfixes.h
The function XFixesGetCursorImage(display) returns a structure XFixesCursorImage
typedef struct {
short x, y;
unsigned short width, height;
unsigned short xhot, yhot;
unsigned long cursor_serial;
unsigned long *pixels;
#if XFIXES_MAJOR >= 2
Atom atom; /* Version >= 2 only */
const char *name; /* Version >= 2 only */
#endif
} XFixesCursorImage;
I believed that unsigned long *pixel is an array that will contain pixel by pixel information of the entire image(of the cursor and rest of the background will be valued 0).
Then using the steps given in this article, I would merge my original XImage with that of cursor(I hope, i have the right idea).
My Problem :
To effectively do the entire masking thing, the first thing is i need to have all the pixel values in XFixesCursorImage. But i believe that pixel array contain way too less values, because, my screen size is 1366 X 768 so i believe there should be 1366*768 elements in pixel array (each containng a long value of pixel in ARGB), but when i used GDB and tried to find the last element it was 21272(21273 elements in total)
Using GDB
(gdb) print cursor[0]
$22 = {x = 475, y = 381, width = 24, height = 24, xhot = 11, yhot = 11,
cursor_serial = 92, pixels = 0x807f39c, atom = 388, name = 0x807fc9c "xterm"}
(gdb) print cursor[0]
$22 = {x = 475, y = 381, width = 24, height = 24, xhot = 11, yhot = 11,
cursor_serial = 92, pixels = 0x807f39c, atom = 388, name = 0x807fc9c "xterm"}
(gdb) print cursor->pixels[21273]
Cannot access memory at address 0x8094000
Few More Data
(gdb) print cursor[0]
$5 = {x = 1028, y = 402, width = 1, height = 1, xhot = 1, yhot = 1,
cursor_serial = 120, pixels = 0x807e854, atom = 0, name = 0x807e858 ""}
(gdb) print cursor[0]->pixels[21994]
$8 = 0
(gdb) print cursor[0]->pixels[21995]
Cannot access memory at address 0x8094000
Am i missing something? Because no of elements doesn't make sense?
Which brings me to a very important question
How are data structured in both XImage->data and XFixesCursorImage->pixels?