File: screen.c

package info (click to toggle)
xtrojka 123-12
  • links: PTS
  • area: non-free
  • in suites: slink
  • size: 492 kB
  • ctags: 443
  • sloc: ansic: 3,087; makefile: 135; sh: 19
file content (87 lines) | stat: -rw-r--r-- 1,270 bytes parent folder | download | duplicates (4)
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
 *	xtrojka (c) 1994,1995,1996 Maarten Los
 *
 *	#include "COPYRIGHT"	
 *
 *	created:	26.xi.1995
 *	modified:
 *
 *	Do some basic drawing functions
 */

#include <stdio.h>

#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Shell.h>
#include <X11/Xlib.h>
#include "screen.h"

#include "debug.h"
#include "tr_core.h"
#include "screen.h"
#include "xtrojka.h"
/*
#include "window.h"
#include "pictures.h"
*/

extern flag is_color;

/*
 *	implementation
 */
void set_color(w, fg, bg)
Widget w;
int fg, bg;
{
	DEBUG("screen.c", "set_color")

	if(is_color) {

		if(fg < 0)
			return;

		XSetForeground(XtDisplay(w),
			DefaultGCOfScreen(XtScreen(w)), app_data.color[fg]);

		if(bg < 0)
			return;

		XSetBackground(XtDisplay(w),
			DefaultGCOfScreen(XtScreen(w)), app_data.color[bg]);
	}

}


void paint_widget(w, fg, bg)
Widget w;
int fg,bg;
{
	DEBUG("screen.c", "paint_widget")

	set_color(w, fg, bg);
	XFillRectangle(	XtDisplay(w),
			XtWindow(w),
			DefaultGCOfScreen(XtScreen(w)), 0,0,
			WidthOfScreen(XtScreen(w)),
			HeightOfScreen(XtScreen(w))
	);
}


void draw_string(w, x,y,s)
Widget w;
int x,y;
char *s;
{
	DEBUG("screen.c", "draw_string")

	XDrawString(XtDisplay(w),
		XtWindow(w),
		DefaultGCOfScreen(XtScreen(w)),
		x,y, s, strlen(s)
	);
}