diff --git a/libXmd/XmdIcon.c b/libXmd/XmdIcon.c index 9b8d633..0db3852 100644 --- a/libXmd/XmdIcon.c +++ b/libXmd/XmdIcon.c @@ -12,3 +12,26 @@ Pixmap _XmdLoadBitmapIcon (Widget widget, unsigned char *bits, int width, int he (char *)(bits), width, height, fg, bg, DefaultDepthOfScreen(XtScreen(widget))); } + +Pixmap XmdReadBitmapFile (Widget widget, const char *filename) { + Pixel fg, bg; + XtVaGetValues (widget, + XmNforeground, &fg, + XmNbackground, &bg, + NULL); + unsigned int width, height; + unsigned char *data; + int garbage; + XReadBitmapFileData ( + filename, + &width, &height, + &data, + &garbage, &garbage); + Pixmap result = XCreatePixmapFromBitmapData ( + XtDisplay (widget), + RootWindowOfScreen(XtScreen(widget)), + (char *)(data), width, height, + fg, bg, DefaultDepthOfScreen(XtScreen(widget))); + XFree(data); + return result; +} diff --git a/libXmd/include/Xmd/Icon.h b/libXmd/include/Xmd/Icon.h index b709e7b..46e6039 100644 --- a/libXmd/include/Xmd/Icon.h +++ b/libXmd/include/Xmd/Icon.h @@ -5,9 +5,14 @@ #include #include -/* XmdLoadBitmapIcon is a macro that loads an icon with the specified name. That Icon must - be #include'd in your code somewhere. The name parameter must be a token, not a string. */ -#define XmdLoadBitmapIcon(widget, name) _XmdLoadBitmapIcon(widget, name##_bits, name##_width, name##_height) +/* XmdLoadBitmapIcon is a macro that loads an icon with the specified name. That + Icon must be #include'd in your code somewhere. The name parameter must be a + token, not a string. */ +#define XmdLoadBitmapIcon(widget, name)\ + _XmdLoadBitmapIcon(widget, name##_bits, name##_width, name##_height) Pixmap _XmdLoadBitmapIcon (Widget widget, unsigned char *bits, int width, int height); +/* XmdReadXBM reads an XBM bitmap file, and returns a Pixmap. */ +Pixmap XmdReadBitmapFileData (Widget, widget, const char *filename); + #endif diff --git a/libXmd/include/Xmd/Launcher.h b/libXmd/include/Xmd/Launcher.h index e24ec80..5129cfa 100644 --- a/libXmd/include/Xmd/Launcher.h +++ b/libXmd/include/Xmd/Launcher.h @@ -5,9 +5,6 @@ #include #include -typedef struct { - Pixmap icon; - const char *command; -} XmdLauncher; +/* TODO */ #endif