wmaker: Moved variables for the XShape extension into the global namespace
[wmaker-crm.git] / WINGs / Examples / colorpick.c
blob24daa2cebc45b316b5815625e3d16c82bb212e1f
2 #include <stdlib.h>
3 #include <stdio.h>
4 #include <WINGs/WINGs.h>
6 void showSelectedColor(void *self, void *cdata)
8 WMColorPanel *panel = (WMColorPanel *) self;
10 printf("Selected Color: %s\n", WMGetColorRGBDescription(WMGetColorPanelColor(panel)));
13 int main(int argc, char **argv)
15 Display *dpy;
16 WMScreen *scr;
18 WMInitializeApplication("wmcolorpick", &argc, argv);
20 dpy = XOpenDisplay("");
21 if (!dpy) {
22 printf("could not open display\n");
23 exit(1);
26 scr = WMCreateScreen(dpy, DefaultScreen(dpy));
29 WMColorPanel *panel = WMGetColorPanel(scr);
31 WMSetColorPanelAction(panel, showSelectedColor, NULL);
33 WMShowColorPanel(panel);
36 WMScreenMainLoop(scr);
38 return 0;