File: colorpick.c

package info (click to toggle)
wmaker 0.96.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 17,416 kB
  • sloc: ansic: 99,483; sh: 7,068; perl: 3,423; makefile: 1,647; lisp: 219; python: 34
file content (40 lines) | stat: -rw-r--r-- 707 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

#include <stdlib.h>
#include <stdio.h>
#include <WINGs/WINGs.h>

void showSelectedColor(void *self, void *cdata)
{
	WMColorPanel *panel = (WMColorPanel *) self;

	(void) cdata;
	printf("Selected Color: %s\n", WMGetColorRGBDescription(WMGetColorPanelColor(panel)));
}

int main(int argc, char **argv)
{
	Display *dpy;
	WMScreen *scr;

	WMInitializeApplication("wmcolorpick", &argc, argv);

	dpy = XOpenDisplay("");
	if (!dpy) {
		printf("could not open display\n");
		exit(1);
	}

	scr = WMCreateScreen(dpy, DefaultScreen(dpy));

	{
		WMColorPanel *panel = WMGetColorPanel(scr);

		WMSetColorPanelAction(panel, showSelectedColor, NULL);

		WMShowColorPanel(panel);
	}

	WMScreenMainLoop(scr);

	return 0;
}