Use Xt memory allocation functions
Why do these even exist? I mean I guess there are some additions compared to the standard ones but like why, why not just make supplemental ones. Do these allocation functions do some wierd different shit? What?
This commit is contained in:
parent
57cbd2ca08
commit
20dca2d2e4
@ -1,37 +0,0 @@
|
|||||||
#include <Xmd/Icon.h>
|
|
||||||
|
|
||||||
Pixmap _XmdLoadBitmapIcon (Widget widget, unsigned char *bits, int width, int height) {
|
|
||||||
Pixel fg, bg;
|
|
||||||
XtVaGetValues (widget,
|
|
||||||
XmNforeground, &fg,
|
|
||||||
XmNbackground, &bg,
|
|
||||||
NULL);
|
|
||||||
return XCreatePixmapFromBitmapData (
|
|
||||||
XtDisplay (widget),
|
|
||||||
RootWindowOfScreen(XtScreen(widget)),
|
|
||||||
(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;
|
|
||||||
}
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
#ifndef _XmdBuffer_h
|
#ifndef _XmdBuffer_h
|
||||||
#define _XmdBuffer_h
|
#define _XmdBuffer_h
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <X11/Intrinsic.h>
|
||||||
|
|
||||||
/* Buffer is a struct that keeps track of a variable length array of data. It
|
/* Buffer is a struct that keeps track of a variable length array of data. It
|
||||||
is like a piggy bank, you can add stuff to it and then break it to get access
|
is like a piggy bank, you can add stuff to it and then break it to get access
|
||||||