mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
added a quick&dirty standalone colorpicker utility
This commit is contained in:
@@ -3,12 +3,13 @@
|
||||
AUTOMAKE_OPTIONS = no-dependencies
|
||||
|
||||
|
||||
noinst_PROGRAMS = connect server fontl puzzle
|
||||
noinst_PROGRAMS = connect server fontl puzzle colorpick
|
||||
|
||||
|
||||
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la \
|
||||
@XFTLIBS@ @INTLIBS@
|
||||
|
||||
colorpick_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.a
|
||||
|
||||
fontl_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.a
|
||||
|
||||
|
||||
42
WINGs/Examples/colorpick.c
Normal file
42
WINGs/Examples/colorpick.c
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <WINGs/WINGs.h>
|
||||
|
||||
|
||||
|
||||
void showSelectedColor(void *self, void *cdata)
|
||||
{
|
||||
WMColorPanel *panel= (WMColorPanel*)self;
|
||||
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user