From 22f880d38f6216541377416bf43500717467421c Mon Sep 17 00:00:00 2001
From: Matthieu Herrb <matthieu@cvs.openbsd.org>
Date: Sat, 25 Aug 2007 18:58:44 +0000
Subject: update to xterm 229. Tested on various architectures by aanriot@

---
 app/xterm/Tekproc.c | 92 ++++++++++++++++++++++++++++-------------------------
 1 file changed, 48 insertions(+), 44 deletions(-)

(limited to 'app/xterm/Tekproc.c')

diff --git a/app/xterm/Tekproc.c b/app/xterm/Tekproc.c
index f02f7e836..c01fb9960 100644
--- a/app/xterm/Tekproc.c
+++ b/app/xterm/Tekproc.c
@@ -1,4 +1,4 @@
-/* $XTermId: Tekproc.c,v 1.155 2007/03/19 23:51:52 tom Exp $ */
+/* $XTermId: Tekproc.c,v 1.157 2007/07/10 19:53:11 tom Exp $ */
 
 /*
  * Warning, there be crufty dragons here.
@@ -948,8 +948,7 @@ TekExpose(Widget w,
 	rcnt = tekRefreshList->count;
 	Tparsestate = curstate = Talptable;
 	TRACE(("TekExpose resets data to replay %d bytes\n", rcnt));
-	if (resource.wait_for_map)
-	    first_map_occurred();
+	first_map_occurred();
 	if (!tekscr->waitrefresh)
 	    TekRefresh(tw);
     }
@@ -958,20 +957,22 @@ TekExpose(Widget w,
 void
 TekRefresh(TekWidget tw)
 {
-    TekScreen *tekscr = TekScreenOf(tw);
-    TScreen *screen = TScreenOf(term);
-    static Cursor wait_cursor = None;
-
-    if (wait_cursor == None)
-	wait_cursor = make_colored_cursor(XC_watch,
-					  T_COLOR(screen, MOUSE_FG),
-					  T_COLOR(screen, MOUSE_BG));
-    XDefineCursor(XtDisplay(tw), TWindow(tekscr), wait_cursor);
-    XFlush(XtDisplay(tw));
-    if (!setjmp(Tekjump))
-	Tekparse(tw);
-    XDefineCursor(XtDisplay(tw), TWindow(tekscr),
-		  (tekscr->TekGIN && GINcursor) ? GINcursor : tekscr->arrow);
+    if (tw != 0) {
+	TekScreen *tekscr = TekScreenOf(tw);
+	TScreen *screen = TScreenOf(term);
+	static Cursor wait_cursor = None;
+
+	if (wait_cursor == None)
+	    wait_cursor = make_colored_cursor(XC_watch,
+					      T_COLOR(screen, MOUSE_FG),
+					      T_COLOR(screen, MOUSE_BG));
+	XDefineCursor(XtDisplay(tw), TWindow(tekscr), wait_cursor);
+	XFlush(XtDisplay(tw));
+	if (!setjmp(Tekjump))
+	    Tekparse(tw);
+	XDefineCursor(XtDisplay(tw), TWindow(tekscr),
+		      (tekscr->TekGIN && GINcursor) ? GINcursor : tekscr->arrow);
+    }
 }
 
 void
@@ -1845,38 +1846,41 @@ TekSimulatePageButton(TekWidget tw, Bool reset)
 void
 TekCopy(TekWidget tw)
 {
-    TekScreen *tekscr = TekScreenOf(tw);
-    TScreen *screen = TScreenOf(term);
+    if (tw != 0) {
+	TekScreen *tekscr = TekScreenOf(tw);
+	TScreen *screen = TScreenOf(term);
 
-    TekLink *Tp;
-    char buf[32];
-    char initbuf[5];
-    int tekcopyfd;
+	TekLink *Tp;
+	char buf[32];
+	char initbuf[5];
+	int tekcopyfd;
 
-    timestamp_filename(buf, "COPY");
-    if (access(buf, F_OK) >= 0
-	&& access(buf, W_OK) < 0) {
-	Bell(XkbBI_MinorError, 0);
-	return;
-    }
+	timestamp_filename(buf, "COPY");
+	if (access(buf, F_OK) >= 0
+	    && access(buf, W_OK) < 0) {
+	    Bell(XkbBI_MinorError, 0);
+	    return;
+	}
 #ifndef VMS
-    if (access(".", W_OK) < 0) {	/* can't write in directory */
-	Bell(XkbBI_MinorError, 0);
-	return;
-    }
+	if (access(".", W_OK) < 0) {	/* can't write in directory */
+	    Bell(XkbBI_MinorError, 0);
+	    return;
+	}
 #endif
 
-    if ((tekcopyfd = open_userfile(screen->uid, screen->gid, buf, False)) >= 0) {
-	sprintf(initbuf, "%c%c%c%c",
-		ANSI_ESC, (char) (tekscr->page.fontsize + '8'),
-		ANSI_ESC, (char) (tekscr->page.linetype + '`'));
-	write(tekcopyfd, initbuf, 4);
-	Tp = &Tek0;
-	do {
-	    write(tekcopyfd, Tp->data, Tp->count);
-	    Tp = Tp->next;
-	} while (Tp);
-	close(tekcopyfd);
+	tekcopyfd = open_userfile(screen->uid, screen->gid, buf, False);
+	if (tekcopyfd >= 0) {
+	    sprintf(initbuf, "%c%c%c%c",
+		    ANSI_ESC, (char) (tekscr->page.fontsize + '8'),
+		    ANSI_ESC, (char) (tekscr->page.linetype + '`'));
+	    write(tekcopyfd, initbuf, 4);
+	    Tp = &Tek0;
+	    do {
+		write(tekcopyfd, Tp->data, Tp->count);
+		Tp = Tp->next;
+	    } while (Tp);
+	    close(tekcopyfd);
+	}
     }
 }
 
-- 
cgit v1.2.3