When i click on my window i get correct x y values from another function. With those values I wan't to get the RGB color value on the window that is currently active and not the whole screen. Right now I think it's reading the whole screen. How can I edit this code to get it work? (the window itself is a Fl_Double_Window using FLTK library).
Image to explain the problem:
int getRGB(int x, int y)
Display *d = XOpenDisplay((char *) NULL);
image = XGetImage(d, RootWindow (d, DefaultScreen(d)), x, y, 1, 1, AllPlanes, XYPixmap);
c.pixel = XGetPixel (image, x, y);
XQueryColor (d, DefaultColormap(d, DefaultScreen (d)), &c);
cout << c.red/256 << " " << c.green/256 << " " << c.blue/256 << "\n" ;