-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpix.c
73 lines (60 loc) · 1.92 KB
/
pix.c
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
* (C) 1997 by Marcin Dalecki <[email protected]>
*
* This file is part of the Motif Editor.
*
* The GNU Info widget is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 1, or (at your option)
* any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*
* Pixmap handling code.
*
* Thank's to the famous game xbill we got the technology, how to
* create pixmaps behaving well on pseudo/virtual visuals :-)
*/
#include <X11/Intrinsic.h>
#include <X11/xpm.h>
#include <Xm/Xm.h>
/*#include "xpm.h" */
/*
* Setup the icon of the given application
*/
void setup_icon(Widget w, char *icon[])
{
Display *dsp;
Screen *scr;
XpmAttributes attr;
Colormap cmap;
int depth;
Pixmap shape;
Pixmap image;
Window win;
dsp = XtDisplay(w);
scr = XtScreen(w);
cmap = DefaultColormap(dsp, DefaultScreen(dsp));
depth = DefaultDepthOfScreen(scr);
win = XRootWindowOfScreen(scr);
XtVaSetValues(w, XtNcolormap, cmap, NULL);
attr.valuemask = 0L;
attr.valuemask |= XpmCloseness;
attr.valuemask |= XpmReturnPixels;
attr.valuemask |= XpmColormap;
attr.valuemask |= XpmDepth;
attr.closeness = 65535; /* accuracy isn't crucial */
attr.colormap = cmap;
attr.depth = depth;
XpmCreatePixmapFromData(dsp, win, icon, &image, &shape, &attr);
XtVaSetValues(w, XmNiconPixmap, image, XmNiconMask, shape, NULL);
}