File: initwmattr.c

package info (click to toggle)
pgplot5 5.2.2-14
  • links: PTS
  • area: non-free
  • in suites: lenny
  • size: 6,912 kB
  • ctags: 6,400
  • sloc: fortran: 38,637; ansic: 22,549; objc: 1,534; sh: 1,304; makefile: 366; perl: 234; pascal: 233; tcl: 190; awk: 51; csh: 25
file content (59 lines) | stat: -rw-r--r-- 1,865 bytes parent folder | download | duplicates (15)
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
/* The initwmattr routine notifies the window manager of the approprate */
/* attributes for the given window. */

/* Sam Southard, Jr. */
/* Created: 9-Oct-1991 (from initbmwin) */
/* Modification History: */
/* 14-Apr-1992	SNS/CIT	Now compiles under VMS */

/* The program include files */
#include "commands.h"
#include "figdisp.h"
#include "globals.h"

/* The system include files */
#include <stdio.h>

void initwmattr(wininf,wname,iname,geom)
struct wininfo wininf;	/* the information about this window */
char *wname;	/* The name for the window */
char *iname;	/* the name for the icon */
struct geometry *geom;	/* The windows geometry.  May be NULL */
{
	char winnamebuf[80];	/* a buffer for the window name */
	char *strptr= &winnamebuf[0];	/* pointer to buffer */
	XSizeHints sizehints;		/* the size  & position */
	XWMHints wm_hints;		/* hints to the window manager */

	/* set up the geometry if necessary */
	if (geom != NULL)
	{
		sizehints.x=geom->x;
		sizehints.y=geom->y;
		sizehints.width=geom->w;
		sizehints.height=geom->h;
		sizehints.flags=USSize;
		if (sizehints.x >= 0 && sizehints.y >= 0)
			sizehints.flags |= USPosition;
		XSetWMNormalHints(display, wininf.win, &sizehints);
	}
	
#ifndef _AIX
	/* set up the window and icon names */
	(void)sprintf(&winnamebuf[0], "%s/%s", NAME_PROG, wname);
	if (XStringListToTextProperty(&strptr, 1, &wininf.winname))
		XSetWMName(display, wininf.win, &wininf.winname);
	(void)sprintf(&winnamebuf[0],"%s", iname);
	if (XStringListToTextProperty(&strptr, 1, &wininf.iconname))
		XSetWMIconName(display, wininf.win, &wininf.iconname);
#endif
	
	/* Set up the hints the window manager needs */
	wm_hints.input = True;
	wm_hints.icon_pixmap=wininf.icon;
	wm_hints.initial_state=NormalState;
	wm_hints.flags = InputHint | IconPixmapHint | StateHint;
	XSetWMHints(display, wininf.win, &wm_hints);

	return;
}