I'm calling my function like this
Code:
GdkColor *color; // structure
showColor(&color);
And my function is written like this
Code:
void showColor(GdkColor *color) {
GdkWindow *rootwin;
GdkImage *image;
GdkColormap *cmap;
gint x, y;
guint32 pixel;
GdkDisplay *display = NULL;
GdkScreen *screen = NULL;
display = gdk_display_get_default ();
screen = gdk_display_get_default_screen (display);
gdk_display_get_pointer (display, NULL, &x, &y, NULL);
rootwin = gdk_screen_get_root_window(gdk_screen_get_default());
cmap = gdk_screen_get_system_colormap(gdk_screen_get_default());
image = gdk_drawable_get_image(rootwin, x, y, 1, 1);
pixel = gdk_image_get_pixel(image, 0, 0);
g_object_unref(image);
gdk_colormap_query_color(cmap, pixel, &color);
color->red = color->red / 65535.0;
color->green = color->green / 65535.0;
color->blue = color->blue / 65535.0;
}
I'm getting errors on the color pointer to the structure..