File: reverse-video.dpatch

package info (click to toggle)
xvt 2.1-14
  • links: PTS
  • area: main
  • in suites: woody
  • size: 348 kB
  • ctags: 430
  • sloc: ansic: 5,107; perl: 1,329; makefile: 31; sh: 29
file content (88 lines) | stat: -rw-r--r-- 3,262 bytes parent folder | download | duplicates (2)
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
88
#PATCHOPTIONS: -p1

--- xvt-2.1.orig/xsetup.c
+++ xvt-2.1/xsetup.c
@@ -110,6 +110,7 @@
 unsigned long	foreground;		/* foreground pixel value */
 unsigned long	background;		/* background pixel value */
 int		reverse_wrap = 0;	/* enable reverse wrapround */
+int		reverse_video = 0;	/* select reverse video */
 int		debugging = 0;		/* enable debugging output */
 int		messages = 0;		/* flag to enable messages */
 
@@ -157,6 +158,7 @@
 	{"-cr",		"*cursorColor",	XrmoptionSepArg,	(caddr_t)NULL},
 	{"-sb",		"*scrollBar",	XrmoptionNoArg,		"on"},
 	{"-rw",		"*reverseWrap",	XrmoptionNoArg,		"on"},
+	{"-rv",		"*reverseVideo",XrmoptionNoArg,		"on"},
 	{"-msg",	"*messages",	XrmoptionNoArg,		"on"},
 	{"-iconic",	"*iconic",	XrmoptionNoArg,		"on"},
 	{"-8",		"*eightBitInput",XrmoptionNoArg,	"on"},
@@ -188,6 +190,7 @@
 "-cr <colour>		text cursor colour",
 "-sb			provide an initial scrollbar",
 "-rw			enable reverse wrap",
+"-rv			run in reverse video",
 "-msg			allow messages",
 "-iconic			start up already iconized",
 "-8			process eight-bit characters",
@@ -426,21 +429,28 @@
 
 	/*  Get colormap entries and create the graphics contexts.
 	 */
-	if (cursorclr == 0 || DefaultDepth(display,screen) == 1) {
+	if (foreground == 0)
+		XParseColor(display,colormap,"black",&foreground_color);
+	if (background == 0)
+		XParseColor(display,colormap,"white",&background_color);
+	if (reverse_video == 1 && foreground == 0 && background == 0) {
+		XColor temp_color;
+		temp_color = background_color;
+		background_color = foreground_color;
+		foreground_color = temp_color;
+	}
+	if (cursorclr == 0 || visual->class == StaticGray
+	    || visual->class == StaticColor || visual->class == TrueColor) {
 
 		/*  We are not using a colored text cursor so we can use
 		 *  read only shared colormap entries for foreground and background.
 		 */
-		if (foreground == 0)
-			XParseColor(display,colormap,"black",&foreground_color);
 		if (XAllocColor(display,colormap,&foreground_color) != 0)
 			foreground = foreground_color.pixel;
 		else {
 			error("can't allocate foreground color %s - using black",s);
 			foreground = BlackPixel(display,screen);
 		}
-		if (background == 0)
-			XParseColor(display,colormap,"white",&background_color);
 		if (XAllocColor(display,colormap,&background_color) != 0)
 			background = background_color.pixel;
 		else {
@@ -469,13 +479,9 @@
 			background = background_color.pixel;
 			cursorclr = foreground;
 		} else {
-			if (foreground == 0)
-				XParseColor(display,colormap,"black",&foreground_color);
 			foreground_color.pixel = foreground = pixels[0];
 			foreground_color.flags = DoRed | DoBlue | DoGreen;
 			XStoreColor(display,colormap,&foreground_color);
-			if (background == 0)
-				XParseColor(display,colormap,"white",&background_color);
 			background_color.pixel = background = pixels[0] | plane_masks[0];
 			background_color.flags = DoRed | DoBlue | DoGreen;
 			XStoreColor(display,colormap,&background_color);
@@ -709,6 +715,11 @@
 	 */
 	if ((s = get_resource("reverseWrap","ReverseWrap")) != NULL)
 		reverse_wrap = affirmative(s);
+
+	/*  Get the reverse video flag.
+	 */
+	if ((s = get_resource("reverseVideo","ReverseVideo")) != NULL)
+		reverse_video = affirmative(s);
 
 	/*  Get the eight bit flag.
 	 */