File: patches

package info (click to toggle)
xtrs 4.9c-3.4
  • links: PTS
  • area: contrib
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 2,240 kB
  • ctags: 1,430
  • sloc: ansic: 19,941; makefile: 243; csh: 132; sh: 129
file content (236 lines) | stat: -rw-r--r-- 7,721 bytes parent folder | download | duplicates (3)
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
--- cassette.man~
+++ cassette.man
@@ -15,13 +15,6 @@
 This manual page also describes the image formats that the emulator
 supports and their limitations.
 
-In this release, two cassette programs are supplied.  The original
-\fBcassette\fP is a C-shell script; it should work with most versions
-of /bin/csh.  If you do not have /bin/csh installed, you can use
-\fBcassette.sh\fP, which is a Bourne shell script.  It requires a 
-modern version of the Bourne shell that supports user-defined functions,
-so it may not work on older Unix systems.
-
 .SH Commands
 .B pos
 generates a status message including the filename being used as the
--- trs_keyboard.c~	Thu Jun 14 12:02:00 2001
+++ trs_keyboard.c	Sat Jul 14 00:39:08 2001
@@ -673,8 +673,8 @@
 /* 0xffe6   XK_Shift_Lock  */    { TK_NULL, TK_Neutral },
 /* 0xffe7   XK_Meta_L      */    { TK_Clear, TK_Neutral },
 /* 0xffe8   XK_Meta_R      */    { TK_Down, TK_ForceShiftPersistent },
-/* 0xffe9   XK_Alt_L       */    { TK_Clear, TK_Neutral },
-/* 0xffea   XK_Alt_R       */    { TK_Down, TK_ForceShiftPersistent },
+/* 0xffe9   XK_Alt_L       */    { TK_NULL, TK_Neutral },
+/* 0xffea   XK_Alt_R       */    { TK_NULL, TK_Neutral },
 /* 0xffeb   XK_Super_L     */    { TK_NULL, TK_Neutral },
 /* 0xffec   XK_Super_R     */    { TK_NULL, TK_Neutral },
 /* 0xffed   XK_Hyper_L     */    { TK_NULL, TK_Neutral },
Index: trs_xinterface.c
===================================================================
--- trs_xinterface.c	(revision 69)
+++ trs_xinterface.c	(working copy)
@@ -916,6 +916,23 @@
   char buf[10];
   XComposeStatus status;
 
+  /*
+   * Of Enter and Leave events, track which kind we saw last.  X clients
+   * like "unclutter" will sythesize an Enter event on their own.
+   *
+   * Historically, xtrs assumed that every Enter would be preceded by a
+   * Leave.  When this was not the case, xtrs would clobber the global
+   * autorepeat state to off; it wrongly stored the off state because the
+   * xtrs window already had focus.
+   *
+   * This enum is tri-valued with the zero value being UNDEF because we
+   * don't want to fake a Leave event the first time we Enter; that would
+   * cause restore_repeat() to read from repeat_state before it has been
+   * initialized, possibly storing a bogus global autorepeat state.
+   */
+  enum enter_leave_t { UNDEF, ENTER, LEAVE };
+  static enum enter_leave_t enter_leave;
+
   if (trs_model > 1) {
     (void)trs_uart_check_avail();
   }
@@ -949,6 +966,17 @@
 #if XDEBUG
       debug("EnterNotify\n");
 #endif
+      if (enter_leave == ENTER) {
+	/*
+	 * The last Enter/Leave event we saw was an Enter; pretend we saw a
+	 * Leave event first.
+	 */
+/*#if XDEBUG*/
+	debug("faking a LeaveNotify event first\n");
+/*#endif*/
+	restore_repeat();
+      }
+      enter_leave = ENTER;
       save_repeat();
       trs_xlate_keysym(0x10000); /* all keys up */
       break;
@@ -957,6 +985,7 @@
 #if XDEBUG
       debug("LeaveNotify\n");
 #endif
+      enter_leave = LEAVE;
       restore_repeat();
       trs_xlate_keysym(0x10000); /* all keys up */
       break;
Index: trs_xinterface.c
===================================================================
--- trs_xinterface.c	(revision 104)
+++ trs_xinterface.c	(revision 106)
@@ -82,6 +82,7 @@
 static Display *display;
 static int screen;
 static Window window;
+static Window help_window;
 static GC gc;
 static GC gc_inv;
 static GC gc_xor;
@@ -625,6 +626,98 @@
 #endif
 }
 
+/*
+ * show help
+ */
+
+void trs_show_help()
+{
+  XWindowAttributes parent_attrs;
+  unsigned int help_width = 495;
+  unsigned int help_height = 365;
+  unsigned int help_xpos, help_ypos;
+  unsigned long foreground, background;
+  GC help_gc;
+  XGCValues values;
+  char *help_font_name = "9x15";
+  XFontStruct *help_font_info;
+  int font_height;
+  int text_line;
+  int i;
+  static char *helpitems[] = {
+    "F1: Model 4/4P F1 key",
+    "F2: Model 4/4P F2 key",
+    "F3: Model 4/4P F3 key",
+    "F4: Model 4/4P caps lock key",
+    "F5: TRS-80 @ key",
+    "F6: TRS-80 0 key",
+    "F7: signal disk change in emulated floppy drive",
+    "F8: exit emulator",
+    "F9: enter zbx debugger",
+    "F10: TRS-80 reset button",
+    "",
+    "LeftArrow, Backspace, Delete: TRS-80 left arrow key",
+    "RightArrow, Tab: TRS-80 right arrow key",
+    "UpArrow: TRS-80 up arrow key",
+    "DownArrow, Linefeed: TRS-80 down arrow key",
+    "",
+    "Esc, Break: TRS-80 break key",
+    "Home, Clear, LeftAlt: TRS-80 clear key",
+    "Control: Model 4/4P control key",
+    "RightAlt: shifted TRS-80 down arrow key",
+    "",
+    "F11 (Shift+F1 on some systems) toggles this help.",
+    "See the xtrs(1) manual page for more information.",
+    NULL
+  };
+
+  foreground = BlackPixel(display, screen);
+  background = WhitePixel(display, screen);
+  (void) XGetWindowAttributes(display, window, &parent_attrs);
+  if ((parent_attrs.width < help_width)
+      || (parent_attrs.height < help_height)) {
+      (void) fprintf(stderr, "%s: cannot display help window; parent window"
+		     " dimensions not large enough to contain it\n",
+		     program_name);
+    return;
+  }
+
+  help_xpos = (parent_attrs.width - help_width) / 2;
+  help_ypos = (parent_attrs.height - help_height) / 2;
+  help_window = XCreateSimpleWindow(display, window, help_xpos, help_ypos,
+				    help_width, help_height, 1, foreground,
+				    background);
+  help_font_info = XLoadQueryFont(display, help_font_name);
+  if (NULL == help_font_info) {
+      (void) fprintf(stderr, "%s: cannot display help window; cannot open"
+		     " \"%s\" font\n", program_name, help_font_name);
+    return;
+  }
+  help_gc = XCreateGC(display, help_window, 0, &values);
+  XSetFont(display, help_gc, help_font_info->fid);
+  XSetBackground(display, help_gc, WhitePixel(display,screen));
+  XSetForeground(display, help_gc, BlackPixel(display,screen));
+
+  font_height = help_font_info->ascent + help_font_info->descent;
+  text_line = font_height;
+
+  XMapWindow(display, help_window);
+
+  for (i = 0; NULL != helpitems[i]; i++) {
+    size_t len;
+    int text_width;
+
+    len = strlen(helpitems[i]);
+    text_width = XTextWidth(help_font_info, helpitems[i], len);
+
+    XDrawString(display, help_window, help_gc, 10, text_line, helpitems[i],
+		len);
+    text_line += font_height;
+  }
+
+  return;
+}
+
 /* exits if something really bad happens */
 void trs_screen_init()
 {
@@ -998,6 +1091,14 @@
 #endif
       switch (key) {
 	/* Trap some function keys here */
+      case XK_F11:
+	if (!help_window) {
+	  trs_show_help();
+	} else {
+	  XUnmapWindow(display, help_window);
+	  help_window = 0;
+	}
+	break;
       case XK_F10:
 	trs_reset(0);
 	key = 0;
Index: xtrs.man
===================================================================
--- xtrs.man	(revision 104)
+++ xtrs.man	(working copy)
@@ -68,6 +68,9 @@
 signals a disk change in the emulated floppy drives (see below).  F8
 exits the program.  F9 enters the debugger (zbx).  F10 is the reset button.
 
+F11 (or Shift+F1 on some systems) toggles an overlay window which
+summarizes the above information.
+
 In Model III, 4, and 4P modes, the left and right shift keys are
 distinct; in Model I mode, they are the same.  The PageUp and PageDown
 keys always activate the positions that correspond to the Model
Index: Makefile.local
===================================================================
--- Makefile.local	(revision 104)
+++ Makefile.local	(working copy)
@@ -50,7 +50,7 @@
 # these lines.  As of xtrs 2.7, it is now OK to use this feature again.
 
 READLINE = -DREADLINE
-READLINELIBS = -lreadline -lncurses
+READLINELIBS = -lreadline
 
 # If you want to debug the emulator, use the -g flag instead: