Change to the linux kernel coding style
[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)
7 {
8 WMColorPanel *panel = (WMColorPanel *) self;
10 printf("Selected Color: %s\n", WMGetColorRGBDescription(WMGetColorPanelColor(panel)));
11 }
13 int main(int argc, char **argv)
14 {
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);
24 }
26 scr = WMCreateScreen(dpy, DefaultScreen(dpy));
28 {
29 WMColorPanel *panel = WMGetColorPanel(scr);
31 WMSetColorPanelAction(panel, showSelectedColor, NULL);
33 WMShowColorPanel(panel);
34 }
36 WMScreenMainLoop(scr);
38 return 0;
39 }