Compare commits
No commits in common. "3ea22ef8720f419d7f9dfa3ae2c2bb007ab5f121" and "29affd173ad39afd898dd3665c1e6ac3f5ec26a1" have entirely different histories.
3ea22ef872
...
29affd173a
@ -1,52 +0,0 @@
|
||||
From 82ba55b8f994ab30ff561a347b82ea340ba7075c Mon Sep 17 00:00:00 2001
|
||||
From: "Thomas E. Dickey" <dickey@invisible-island.net>
|
||||
Date: Tue, 9 Feb 2021 23:04:41 +0000
|
||||
Subject: [PATCH] snapshot of project "xterm", label xterm-365d
|
||||
|
||||
--- a/button.c
|
||||
+++ b/button.c
|
||||
@@ -4323,6 +4323,7 @@ SaltTextAway(XtermWidget xw,
|
||||
int i;
|
||||
int eol;
|
||||
int need = 0;
|
||||
+ size_t have = 0;
|
||||
Char *line;
|
||||
Char *lp;
|
||||
CELL first = *cellc;
|
||||
@@ -4357,7 +4358,11 @@ SaltTextAway(XtermWidget xw,
|
||||
|
||||
/* UTF-8 may require more space */
|
||||
if_OPT_WIDE_CHARS(screen, {
|
||||
- need *= 4;
|
||||
+ if (need > 0) {
|
||||
+ if (screen->max_combining > 0)
|
||||
+ need += screen->max_combining;
|
||||
+ need *= 6;
|
||||
+ }
|
||||
});
|
||||
|
||||
/* now get some memory to save it in */
|
||||
@@ -4395,10 +4400,20 @@ SaltTextAway(XtermWidget xw,
|
||||
}
|
||||
*lp = '\0'; /* make sure we have end marked */
|
||||
|
||||
- TRACE(("Salted TEXT:%u:%s\n", (unsigned) (lp - line),
|
||||
- visibleChars(line, (unsigned) (lp - line))));
|
||||
+ have = (size_t) (lp - line);
|
||||
+ /*
|
||||
+ * Scanning the buffer twice is unnecessary. Discard unwanted memory if
|
||||
+ * the estimate is too-far off.
|
||||
+ */
|
||||
+ if ((have * 2) < (size_t) need) {
|
||||
+ scp->data_limit = have + 1;
|
||||
+ line = realloc(line, scp->data_limit);
|
||||
+ }
|
||||
+
|
||||
+ TRACE(("Salted TEXT:%u:%s\n", (unsigned) have,
|
||||
+ visibleChars(line, (unsigned) have)));
|
||||
|
||||
- scp->data_length = (size_t) (lp - line);
|
||||
+ scp->data_length = have;
|
||||
}
|
||||
|
||||
#if OPT_PASTE64
|
||||
@ -1,400 +0,0 @@
|
||||
From 1584fc227673264661250d3a8d673c168ac9512d Mon Sep 17 00:00:00 2001
|
||||
From: "Thomas E. Dickey" <dickey@invisible-island.net>
|
||||
Date: Sun, 30 Jan 2022 19:31:01 +0000
|
||||
Subject: [PATCH] backport-CVE-2022-14130
|
||||
|
||||
---
|
||||
COPYING | 4 +-
|
||||
MANIFEST | 2 +-
|
||||
graphics_sixel.c | 26 ++++++++----
|
||||
package/debian/copyright | 2 +-
|
||||
ptyx.h | 6 +--
|
||||
terminfo | 87 ++++++++++++++++++++++++++--------------
|
||||
xterm.appdata.xml | 2 +-
|
||||
xterm.log.html | 4 +-
|
||||
8 files changed, 86 insertions(+), 47 deletions(-)
|
||||
|
||||
diff --git a/COPYING b/COPYING
|
||||
index 0656380..20d1d62 100644
|
||||
--- a/COPYING
|
||||
+++ b/COPYING
|
||||
@@ -1,7 +1,7 @@
|
||||
---- $XTermId: COPYING,v 1.3 2020/01/12 22:53:35 tom Exp $
|
||||
+--- $XTermId: COPYING,v 1.5 2022/01/30 19:30:32 tom Exp $
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
-Copyright 1996-2019,2020 by Thomas E. Dickey
|
||||
+Copyright 1996-2021,2022 by Thomas E. Dickey
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
diff --git a/MANIFEST b/MANIFEST
|
||||
index e7a1b67..1d1996f 100644
|
||||
--- a/MANIFEST
|
||||
+++ b/MANIFEST
|
||||
@@ -1,4 +1,4 @@
|
||||
-MANIFEST for xterm-363, version xterm-363
|
||||
+MANIFEST for xterm-363, version xterm-370
|
||||
--------------------------------------------------------------------------------
|
||||
MANIFEST this file
|
||||
256colres.h resource-definitions for 256-color mode
|
||||
diff --git a/graphics_sixel.c b/graphics_sixel.c
|
||||
index 304fa8f..6a1b9c8 100644
|
||||
--- a/graphics_sixel.c
|
||||
+++ b/graphics_sixel.c
|
||||
@@ -1,8 +1,8 @@
|
||||
-/* $XTermId: graphics_sixel.c,v 1.28 2020/08/06 20:32:33 Ben.Wong Exp $ */
|
||||
+/* $XTermId: graphics_sixel.c,v 1.30 2022/01/30 19:25:32 tom Exp $ */
|
||||
|
||||
/*
|
||||
- * Copyright 2014-2016,2020 by Ross Combs
|
||||
- * Copyright 2014-2016,2020 by Thomas E. Dickey
|
||||
+ * Copyright 2014-2021,2022 by Ross Combs
|
||||
+ * Copyright 2014-2021,2022 by Thomas E. Dickey
|
||||
*
|
||||
* All Rights Reserved
|
||||
*
|
||||
@@ -149,7 +149,7 @@ init_sixel_background(Graphic *graphic, SixelContext const *context)
|
||||
graphic->color_registers_used[context->background] = 1;
|
||||
}
|
||||
|
||||
-static void
|
||||
+static Boolean
|
||||
set_sixel(Graphic *graphic, SixelContext const *context, int sixel)
|
||||
{
|
||||
const int mh = graphic->max_height;
|
||||
@@ -183,8 +183,10 @@ set_sixel(Graphic *graphic, SixelContext const *context, int sixel)
|
||||
}
|
||||
} else {
|
||||
TRACE(("sixel pixel %d out of bounds\n", pix));
|
||||
+ return False;
|
||||
}
|
||||
}
|
||||
+ return True;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -462,8 +464,12 @@ parse_sixel(XtermWidget xw, ANSI *params, char const *string)
|
||||
init_sixel_background(graphic, &context);
|
||||
graphic->valid = 1;
|
||||
}
|
||||
- if (sixel)
|
||||
- set_sixel(graphic, &context, sixel);
|
||||
+ if (sixel) {
|
||||
+ if (!set_sixel(graphic, &context, sixel)) {
|
||||
+ context.col = 0;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
context.col++;
|
||||
} else if (ch == '$') { /* DECGCR */
|
||||
/* ignore DECCRNLM in sixel mode */
|
||||
@@ -531,8 +537,12 @@ parse_sixel(XtermWidget xw, ANSI *params, char const *string)
|
||||
if (sixel) {
|
||||
int i;
|
||||
for (i = 0; i < Pcount; i++) {
|
||||
- set_sixel(graphic, &context, sixel);
|
||||
- context.col++;
|
||||
+ if (set_sixel(graphic, &context, sixel)) {
|
||||
+ context.col++;
|
||||
+ } else {
|
||||
+ context.col = 0;
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
} else {
|
||||
context.col += Pcount;
|
||||
diff --git a/package/debian/copyright b/package/debian/copyright
|
||||
index 1ea0b28..97493e0 100644
|
||||
--- a/package/debian/copyright
|
||||
+++ b/package/debian/copyright
|
||||
@@ -35,7 +35,7 @@ authorization.
|
||||
Files: * */*
|
||||
License: MIT-X11
|
||||
|
||||
-Copyright 1996-2019,2020 by Thomas E. Dickey
|
||||
+Copyright 1996-2021,2022 by Thomas E. Dickey
|
||||
|
||||
(date ranges vary, depending on when the respective files were first changed
|
||||
significantly, and run through the most recent change date).
|
||||
diff --git a/ptyx.h b/ptyx.h
|
||||
index 0d9dc0e..e682f56 100644
|
||||
--- a/ptyx.h
|
||||
+++ b/ptyx.h
|
||||
@@ -1,7 +1,7 @@
|
||||
-/* $XTermId: ptyx.h,v 1.1026 2020/12/25 15:15:37 tom Exp $ */
|
||||
+/* $XTermId: ptyx.h,v 1.1047 2022/01/30 19:29:37 tom Exp $ */
|
||||
|
||||
/*
|
||||
- * Copyright 1999-2019,2020 by Thomas E. Dickey
|
||||
+ * Copyright 1999-2021,2022 by Thomas E. Dickey
|
||||
*
|
||||
* All Rights Reserved
|
||||
*
|
||||
@@ -777,7 +777,7 @@ typedef enum {
|
||||
#endif
|
||||
|
||||
#ifndef OPT_SHIFT_FONTS
|
||||
-#define OPT_SHIFT_FONTS 1 /* true if xterm interprets fontsize-shifting */
|
||||
+#define OPT_STATUS_LINE 0 /* true if xterm supports status-line controls */
|
||||
#endif
|
||||
|
||||
#ifndef OPT_SUNPC_KBD
|
||||
diff --git a/terminfo b/terminfo
|
||||
index 268686e..2aac86b 100644
|
||||
--- a/terminfo
|
||||
+++ b/terminfo
|
||||
@@ -1,10 +1,10 @@
|
||||
-# $XTermId: terminfo,v 1.190 2020/12/11 09:23:14 tom Exp $
|
||||
+# $XTermId: terminfo,v 1.202 2022/01/30 19:29:59 tom Exp $
|
||||
#
|
||||
# Updates/notes/new entries (e.g., xterm-8bit, xterm-16color, xterm-256color)
|
||||
# - Thomas E. Dickey
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
-# Copyright 1996-2019,2020 by Thomas E. Dickey
|
||||
+# Copyright 1996-2021,2022 by Thomas E. Dickey
|
||||
#
|
||||
# All Rights Reserved
|
||||
#
|
||||
@@ -147,6 +147,7 @@ xterm-new|modern xterm terminal emulator,
|
||||
# Left/right margins are supported in xterm since patch #279 (2012/05/10)
|
||||
vt420+lrmm|VT420 left/right margins,
|
||||
mgc=\E[?69l,
|
||||
+ smglp=\E[?69h\E[%i%p1%ds,
|
||||
smglr=\E[?69h\E[%i%p1%d;%p2%ds,
|
||||
|
||||
# These "ansi+XXX" blocks were added in ncurses 5.0:
|
||||
@@ -920,7 +921,9 @@ xterm+sm+1006|xterm SGR-mouse,
|
||||
l
|
||||
%;,
|
||||
xm=\E[<%i
|
||||
- %p3%d;%p1%d;%p2%d;
|
||||
+ %p3%d;
|
||||
+ %p1%d;
|
||||
+ %p2%d;
|
||||
%?
|
||||
%p4
|
||||
%tM
|
||||
@@ -942,11 +945,13 @@ xterm+x11mouse|X11 xterm mouse protocol,
|
||||
xm=\E[M
|
||||
%?
|
||||
%p4
|
||||
- %t%p3
|
||||
+ %t
|
||||
+ %p3
|
||||
%e%{3}
|
||||
%;
|
||||
%'\s'%+%c
|
||||
- %p2%'!'%+%c%p1%'!'%+%c,
|
||||
+ %p2%'!'%+%c
|
||||
+ %p1%'!'%+%c,
|
||||
|
||||
# This chunk is used for building the VT220/Sun/PC keyboard variants.
|
||||
xterm-basic|modern xterm terminal emulator - common,
|
||||
@@ -1085,7 +1090,8 @@ xterm-basic|modern xterm terminal emulator - common,
|
||||
%t;4
|
||||
%;
|
||||
%?
|
||||
- %p1%p3%|
|
||||
+ %p1
|
||||
+ %p3%|
|
||||
%t;7
|
||||
%;
|
||||
%?
|
||||
@@ -1442,7 +1448,8 @@ xterm-bold|xterm with bold instead of underline (X Window System),
|
||||
%t;1
|
||||
%;
|
||||
%?
|
||||
- %p1%p3%|
|
||||
+ %p1
|
||||
+ %p3%|
|
||||
%t;7
|
||||
%;
|
||||
m,
|
||||
@@ -1802,7 +1809,8 @@ xterm-16color|xterm with 16 colors,
|
||||
setab=\E[
|
||||
%?
|
||||
%p1%{8}%<
|
||||
- %t%p1%{40}%+
|
||||
+ %t
|
||||
+ %p1%{40}%+
|
||||
%e
|
||||
%p1%{92}%+
|
||||
%;
|
||||
@@ -1810,13 +1818,15 @@ xterm-16color|xterm with 16 colors,
|
||||
setaf=\E[
|
||||
%?
|
||||
%p1%{8}%<
|
||||
- %t%p1%{30}%+
|
||||
+ %t
|
||||
+ %p1%{30}%+
|
||||
%e
|
||||
%p1%{82}%+
|
||||
%;
|
||||
%dm,
|
||||
setb=
|
||||
- %p1%{8}%/%{6}%*%{4}%+\E[%d%p1%{8}%m%Pa
|
||||
+ %p1%{8}%/%{6}%*%{3}%+\E[%d
|
||||
+ %p1%{8}%m%Pa
|
||||
%?%ga%{1}%=
|
||||
%t4
|
||||
%e%ga%{3}%=
|
||||
@@ -1869,15 +1879,20 @@ xterm+256color|original xterm 256-color feature,
|
||||
colors#0x100,
|
||||
pairs#0x10000,
|
||||
initc=\E]4;
|
||||
- %p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\,
|
||||
+ %p1%d;rgb:
|
||||
+ %p2%{255}%*%{1000}%/%2.2X/
|
||||
+ %p3%{255}%*%{1000}%/%2.2X/
|
||||
+ %p4%{255}%*%{1000}%/%2.2X\E\\,
|
||||
oc=\E]104\007,
|
||||
setab=\E[
|
||||
%?
|
||||
%p1%{8}%<
|
||||
- %t4%p1%d
|
||||
+ %t4
|
||||
+ %p1%d
|
||||
%e
|
||||
%p1%{16}%<
|
||||
- %t10%p1%{8}%-%d
|
||||
+ %t10
|
||||
+ %p1%{8}%-%d
|
||||
%e48;5;
|
||||
%p1%d
|
||||
%;
|
||||
@@ -1885,10 +1900,12 @@ xterm+256color|original xterm 256-color feature,
|
||||
setaf=\E[
|
||||
%?
|
||||
%p1%{8}%<
|
||||
- %t3%p1%d
|
||||
+ %t3
|
||||
+ %p1%d
|
||||
%e
|
||||
%p1%{16}%<
|
||||
- %t9%p1%{8}%-%d
|
||||
+ %t9
|
||||
+ %p1%{8}%-%d
|
||||
%e38;5;
|
||||
%p1%d
|
||||
%;
|
||||
@@ -1899,22 +1916,26 @@ xterm+256color2|xterm 256-color feature,
|
||||
setab=\E[
|
||||
%?
|
||||
%p1%{8}%<
|
||||
- %t4%p1%d
|
||||
+ %t4
|
||||
+ %p1%d
|
||||
%e
|
||||
%p1%{16}%<
|
||||
- %t10%p1%{8}%-%d
|
||||
- %e48\:5\:
|
||||
+ %t10
|
||||
+ %p1%{8}%-%d
|
||||
+ %e48:5:
|
||||
%p1%d
|
||||
%;
|
||||
m,
|
||||
setaf=\E[
|
||||
%?
|
||||
%p1%{8}%<
|
||||
- %t3%p1%d
|
||||
+ %t3
|
||||
+ %p1%d
|
||||
%e
|
||||
%p1%{16}%<
|
||||
- %t9%p1%{8}%-%d
|
||||
- %e38\:5\:
|
||||
+ %t9
|
||||
+ %p1%{8}%-%d
|
||||
+ %e38:5:
|
||||
%p1%d
|
||||
%;
|
||||
m,
|
||||
@@ -1950,17 +1971,23 @@ xterm+direct|xterm with direct-color indexing,
|
||||
setab=\E[
|
||||
%?
|
||||
%p1%{8}%<
|
||||
- %t4%p1%d
|
||||
- %e48\:2\:\:
|
||||
- %p1%{65536}%/%d\:%p1%{256}%/%{255}%&%d\:%p1%{255}%&%d
|
||||
+ %t4
|
||||
+ %p1%d
|
||||
+ %e48:2::
|
||||
+ %p1%{65536}%/%d:
|
||||
+ %p1%{256}%/%{255}%&%d:
|
||||
+ %p1%{255}%&%d
|
||||
%;
|
||||
m,
|
||||
setaf=\E[
|
||||
%?
|
||||
%p1%{8}%<
|
||||
- %t3%p1%d
|
||||
- %e38\:2\:\:
|
||||
- %p1%{65536}%/%d\:%p1%{256}%/%{255}%&%d\:%p1%{255}%&%d
|
||||
+ %t3
|
||||
+ %p1%d
|
||||
+ %e38:2::
|
||||
+ %p1%{65536}%/%d:
|
||||
+ %p1%{256}%/%{255}%&%d:
|
||||
+ %p1%{255}%&%d
|
||||
%;
|
||||
m,
|
||||
setb@,
|
||||
@@ -2143,7 +2170,8 @@ xterm-8bit|xterm terminal emulator with 8-bit controls (X Window System),
|
||||
%;
|
||||
%?
|
||||
%p1%p3%|
|
||||
- %t;7
|
||||
+ %p1
|
||||
+ %p3%|
|
||||
%;
|
||||
%?
|
||||
%p4
|
||||
@@ -2370,7 +2398,8 @@ xterm-xf86-v44|xterm terminal emulator (XFree86 4.4 Window System),
|
||||
%t;4
|
||||
%;
|
||||
%?
|
||||
- %p1%p3%|
|
||||
+ %p1
|
||||
+ %p3%|
|
||||
%t;7
|
||||
%;
|
||||
%?
|
||||
diff --git a/xterm.appdata.xml b/xterm.appdata.xml
|
||||
index cd9ab6e..f4e8fbe 100644
|
||||
--- a/xterm.appdata.xml
|
||||
+++ b/xterm.appdata.xml
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
-<!-- Copyright 2014-2019,2020 Thomas Dickey <dickey@invisible-island.net> -->
|
||||
+<!-- Copyright 2014-2021,2022 Thomas Dickey <dickey@invisible-island.net> -->
|
||||
<component type="desktop">
|
||||
<id>xterm.desktop</id>
|
||||
<metadata_license>CC-BY-3.0</metadata_license>
|
||||
diff --git a/xterm.log.html b/xterm.log.html
|
||||
index 3d5ed4c..8433c6e 100644
|
||||
--- a/xterm.log.html
|
||||
+++ b/xterm.log.html
|
||||
@@ -30,7 +30,7 @@
|
||||
* sale, use or other dealings in this Software without prior written *
|
||||
* authorization. *
|
||||
*****************************************************************************
|
||||
- $XTermId: xterm.log.html,v 1.2289 2020/12/26 15:38:13 tom Exp $
|
||||
+ $XTermId: xterm.log.html,v 1.2384 2022/01/30 19:30:18 tom Exp $
|
||||
-->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<html>
|
||||
@@ -50,7 +50,7 @@
|
||||
<body>
|
||||
<hr>
|
||||
|
||||
- <p>Copyright © 1997-2019,2020 by <a href=
|
||||
+ <p>Copyright © 1997-2021,2022 by <a href=
|
||||
"mailto:dickey@invisible-island.net">Thomas E. Dickey</a></p>
|
||||
|
||||
<hr>
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,751 +0,0 @@
|
||||
From 787636674918873a091e7a4ef5977263ba982322 Mon Sep 17 00:00:00 2001
|
||||
From: "Thomas E. Dickey" <dickey@invisible-island.net>
|
||||
Date: Sun, 23 Oct 2022 22:59:52 +0000
|
||||
Subject: [PATCH] snapshot of project "xterm", label xterm-374c
|
||||
|
||||
---
|
||||
button.c | 14 +--
|
||||
charproc.c | 9 +-
|
||||
doublechr.c | 4 +-
|
||||
fontutils.c | 264 ++++++++++++++++++++++++++++------------------------
|
||||
fontutils.h | 4 +-
|
||||
misc.c | 7 +-
|
||||
screen.c | 1 +
|
||||
xterm.h | 2 +-
|
||||
8 files changed, 155 insertions(+), 150 deletions(-)
|
||||
|
||||
diff --git a/button.c b/button.c
|
||||
index 8b21efd..c16bb55 100644
|
||||
--- a/button.c
|
||||
+++ b/button.c
|
||||
@@ -2022,13 +2022,8 @@ void
|
||||
UnmapSelections(XtermWidget xw)
|
||||
{
|
||||
TScreen *screen = TScreenOf(xw);
|
||||
- Cardinal n;
|
||||
|
||||
- if (screen->mappedSelect) {
|
||||
- for (n = 0; screen->mappedSelect[n] != 0; ++n)
|
||||
- free((void *) screen->mappedSelect[n]);
|
||||
- FreeAndNull(screen->mappedSelect);
|
||||
- }
|
||||
+ FreeAndNull(screen->mappedSelect);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2064,14 +2059,11 @@ MapSelections(XtermWidget xw, String *params, Cardinal num_params)
|
||||
if ((result = TypeMallocN(String, num_params + 1)) != 0) {
|
||||
result[num_params] = 0;
|
||||
for (j = 0; j < num_params; ++j) {
|
||||
- result[j] = x_strdup((isSELECT(params[j])
|
||||
+ result[j] = (String)(isSELECT(params[j])
|
||||
? mapTo
|
||||
- : params[j]));
|
||||
+ : params[j]);
|
||||
if (result[j] == 0) {
|
||||
UnmapSelections(xw);
|
||||
- while (j != 0) {
|
||||
- free((void *) result[--j]);
|
||||
- }
|
||||
FreeAndNull(result);
|
||||
break;
|
||||
}
|
||||
diff --git a/charproc.c b/charproc.c
|
||||
index 3b2df72..ec1068f 100644
|
||||
--- a/charproc.c
|
||||
+++ b/charproc.c
|
||||
@@ -13068,7 +13068,6 @@ DoSetSelectedFont(Widget w,
|
||||
Bell(xw, XkbBI_MinorError, 0);
|
||||
} else {
|
||||
Boolean failed = False;
|
||||
- int oldFont = TScreenOf(xw)->menu_font_number;
|
||||
char *save = TScreenOf(xw)->SelectFontName();
|
||||
char *val;
|
||||
char *test;
|
||||
@@ -13113,10 +13112,6 @@ DoSetSelectedFont(Widget w,
|
||||
failed = True;
|
||||
}
|
||||
if (failed) {
|
||||
- (void) xtermLoadFont(xw,
|
||||
- xtermFontName(TScreenOf(xw)->MenuFontName(oldFont)),
|
||||
- True,
|
||||
- oldFont);
|
||||
Bell(xw, XkbBI_MinorError, 0);
|
||||
}
|
||||
free(used);
|
||||
@@ -13125,7 +13120,7 @@ DoSetSelectedFont(Widget w,
|
||||
}
|
||||
}
|
||||
|
||||
-void
|
||||
+Bool
|
||||
FindFontSelection(XtermWidget xw, const char *atom_name, Bool justprobe)
|
||||
{
|
||||
TScreen *screen = TScreenOf(xw);
|
||||
@@ -13165,7 +13160,7 @@ FindFontSelection(XtermWidget xw, const char *atom_name, Bool justprobe)
|
||||
DoSetSelectedFont, NULL,
|
||||
XtLastTimestampProcessed(XtDisplay(xw)));
|
||||
}
|
||||
- return;
|
||||
+ return (screen->SelectFontName() != NULL) ? True : False;
|
||||
}
|
||||
|
||||
Bool
|
||||
diff --git a/doublechr.c b/doublechr.c
|
||||
index a802e32..6416849 100644
|
||||
--- a/doublechr.c
|
||||
+++ b/doublechr.c
|
||||
@@ -295,7 +295,7 @@ xterm_DoubleGC(XTermDraw * params, GC old_gc, int *inxp)
|
||||
temp.flags = (params->attr_flags & BOLD);
|
||||
temp.warn = fwResource;
|
||||
|
||||
- if (!xtermOpenFont(params->xw, name, &temp, False)) {
|
||||
+ if (!xtermOpenFont(params->xw, name, &temp, NULL, False)) {
|
||||
XTermDraw local = *params;
|
||||
char *nname;
|
||||
|
||||
@@ -304,7 +304,7 @@ xterm_DoubleGC(XTermDraw * params, GC old_gc, int *inxp)
|
||||
nname = xtermSpecialFont(&local);
|
||||
if (nname != 0) {
|
||||
found = (Boolean) xtermOpenFont(params->xw, nname, &temp,
|
||||
- False);
|
||||
+ NULL, False);
|
||||
free(nname);
|
||||
}
|
||||
} else {
|
||||
diff --git a/fontutils.c b/fontutils.c
|
||||
index 19abe4b..a4764f2 100644
|
||||
--- a/fontutils.c
|
||||
+++ b/fontutils.c
|
||||
@@ -92,9 +92,9 @@
|
||||
}
|
||||
|
||||
#define FREE_FNAME(field) \
|
||||
- if (fonts == 0 || myfonts.field != fonts->field) { \
|
||||
- FREE_STRING(myfonts.field); \
|
||||
- myfonts.field = 0; \
|
||||
+ if (fonts == 0 || new_fnames.field != fonts->field) { \
|
||||
+ FREE_STRING(new_fnames.field); \
|
||||
+ new_fnames.field = 0; \
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -571,7 +571,7 @@ open_italic_font(XtermWidget xw, int n, FontNameProperties *fp, XTermFonts * dat
|
||||
if ((name = italic_font_name(fp, slant[pass])) != 0) {
|
||||
TRACE(("open_italic_font %s %s\n",
|
||||
whichFontEnum((VTFontEnum) n), name));
|
||||
- if (xtermOpenFont(xw, name, data, False)) {
|
||||
+ if (xtermOpenFont(xw, name, data, NULL, False)) {
|
||||
result = (data->fs != 0);
|
||||
#if OPT_REPORT_FONTS
|
||||
if (resource.reportFonts) {
|
||||
@@ -1021,13 +1021,14 @@ noUsableXft(XtermWidget xw, const char *name)
|
||||
#endif
|
||||
|
||||
/*
|
||||
- * Open the given font and verify that it is non-empty. Return a null on
|
||||
+ * Open the given font and verify that it is non-empty. Return false on
|
||||
* failure.
|
||||
*/
|
||||
Bool
|
||||
xtermOpenFont(XtermWidget xw,
|
||||
const char *name,
|
||||
XTermFonts * result,
|
||||
+ XTermFonts * current,
|
||||
Bool force)
|
||||
{
|
||||
Bool code = False;
|
||||
@@ -1035,7 +1036,12 @@ xtermOpenFont(XtermWidget xw,
|
||||
|
||||
TRACE(("xtermOpenFont %d:%d '%s'\n",
|
||||
result->warn, xw->misc.fontWarnings, NonNull(name)));
|
||||
+
|
||||
if (!IsEmpty(name)) {
|
||||
+ Bool existing = (current != NULL
|
||||
+ && current->fs != NULL
|
||||
+ && current->fn != NULL);
|
||||
+
|
||||
if ((result->fs = XLoadQueryFont(screen->display, name)) != 0) {
|
||||
code = True;
|
||||
if (EmptyFont(result->fs)) {
|
||||
@@ -1054,9 +1060,13 @@ xtermOpenFont(XtermWidget xw,
|
||||
} else {
|
||||
TRACE(("xtermOpenFont: cannot load font '%s'\n", name));
|
||||
}
|
||||
- if (force) {
|
||||
+ if (existing) {
|
||||
+ TRACE(("...continue using font '%s'\n", current->fn));
|
||||
+ result->fn = x_strdup(current->fn);
|
||||
+ result->fs = current->fs;
|
||||
+ } else if (force) {
|
||||
NoFontWarning(result);
|
||||
- code = xtermOpenFont(xw, DEFFONT, result, True);
|
||||
+ code = xtermOpenFont(xw, DEFFONT, result, NULL, True);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1301,6 +1311,7 @@ static Bool
|
||||
loadNormFP(XtermWidget xw,
|
||||
char **nameOutP,
|
||||
XTermFonts * infoOut,
|
||||
+ XTermFonts * current,
|
||||
int fontnum)
|
||||
{
|
||||
Bool status = True;
|
||||
@@ -1310,7 +1321,7 @@ loadNormFP(XtermWidget xw,
|
||||
if (!xtermOpenFont(xw,
|
||||
*nameOutP,
|
||||
infoOut,
|
||||
- (fontnum == fontMenu_default))) {
|
||||
+ current, (fontnum == fontMenu_default))) {
|
||||
/*
|
||||
* If we are opening the default font, and it happens to be missing,
|
||||
* force that to the compiled-in default font, e.g., "fixed". If we
|
||||
@@ -1345,10 +1356,10 @@ loadBoldFP(XtermWidget xw,
|
||||
if (fp != 0) {
|
||||
NoFontWarning(infoOut);
|
||||
*nameOutP = bold_font_name(fp, fp->average_width);
|
||||
- if (!xtermOpenFont(xw, *nameOutP, infoOut, False)) {
|
||||
+ if (!xtermOpenFont(xw, *nameOutP, infoOut, NULL, False)) {
|
||||
free(*nameOutP);
|
||||
*nameOutP = bold_font_name(fp, -1);
|
||||
- xtermOpenFont(xw, *nameOutP, infoOut, False);
|
||||
+ xtermOpenFont(xw, *nameOutP, infoOut, NULL, False);
|
||||
}
|
||||
TRACE(("...derived bold '%s'\n", NonNull(*nameOutP)));
|
||||
}
|
||||
@@ -1366,7 +1377,7 @@ loadBoldFP(XtermWidget xw,
|
||||
TRACE(("...did not get a matching bold font\n"));
|
||||
}
|
||||
free(normal);
|
||||
- } else if (!xtermOpenFont(xw, *nameOutP, infoOut, False)) {
|
||||
+ } else if (!xtermOpenFont(xw, *nameOutP, infoOut, NULL, False)) {
|
||||
xtermCopyFontInfo(infoOut, infoRef);
|
||||
TRACE(("...cannot load bold font '%s'\n", NonNull(*nameOutP)));
|
||||
} else {
|
||||
@@ -1420,7 +1431,7 @@ loadWideFP(XtermWidget xw,
|
||||
}
|
||||
|
||||
if (check_fontname(*nameOutP)) {
|
||||
- if (xtermOpenFont(xw, *nameOutP, infoOut, False)
|
||||
+ if (xtermOpenFont(xw, *nameOutP, infoOut, NULL, False)
|
||||
&& is_derived_font_name(*nameOutP)
|
||||
&& EmptyFont(infoOut->fs)) {
|
||||
xtermCloseFont2(xw, infoOut - fWide, fWide);
|
||||
@@ -1464,7 +1475,7 @@ loadWBoldFP(XtermWidget xw,
|
||||
|
||||
if (check_fontname(*nameOutP)) {
|
||||
|
||||
- if (xtermOpenFont(xw, *nameOutP, infoOut, False)
|
||||
+ if (xtermOpenFont(xw, *nameOutP, infoOut, NULL, False)
|
||||
&& is_derived_font_name(*nameOutP)
|
||||
&& !compatibleWideCounts(wideInfoRef->fs, infoOut->fs)) {
|
||||
xtermCloseFont2(xw, infoOut - fWBold, fWBold);
|
||||
@@ -1517,6 +1528,10 @@ loadWBoldFP(XtermWidget xw,
|
||||
}
|
||||
#endif
|
||||
|
||||
+/*
|
||||
+ * Load a given bitmap font, along with the bold/wide variants.
|
||||
+ * Returns nonzero on success.
|
||||
+ */
|
||||
int
|
||||
xtermLoadFont(XtermWidget xw,
|
||||
const VTFontNames * fonts,
|
||||
@@ -1526,33 +1541,37 @@ xtermLoadFont(XtermWidget xw,
|
||||
TScreen *screen = TScreenOf(xw);
|
||||
VTwin *win = WhichVWin(screen);
|
||||
|
||||
- VTFontNames myfonts;
|
||||
- XTermFonts fnts[fMAX];
|
||||
+ VTFontNames new_fnames;
|
||||
+ XTermFonts new_fonts[fMAX];
|
||||
+ XTermFonts old_fonts[fMAX];
|
||||
char *tmpname = NULL;
|
||||
Boolean proportional = False;
|
||||
+ Boolean recovered;
|
||||
+ int code = 0;
|
||||
|
||||
- memset(&myfonts, 0, sizeof(myfonts));
|
||||
- memset(fnts, 0, sizeof(fnts));
|
||||
+ memset(&new_fnames, 0, sizeof(new_fnames));
|
||||
+ memset(new_fonts, 0, sizeof(new_fonts));
|
||||
+ memcpy(&old_fonts, screen->fnts, sizeof(old_fonts));
|
||||
|
||||
if (fonts != 0)
|
||||
- myfonts = *fonts;
|
||||
- if (!check_fontname(myfonts.f_n))
|
||||
- return 0;
|
||||
+ new_fnames = *fonts;
|
||||
+ if (!check_fontname(new_fnames.f_n))
|
||||
+ return code;
|
||||
|
||||
if (fontnum == fontMenu_fontescape
|
||||
- && myfonts.f_n != screen->MenuFontName(fontnum)) {
|
||||
- if ((tmpname = x_strdup(myfonts.f_n)) == 0)
|
||||
- return 0;
|
||||
+ && new_fnames.f_n != screen->MenuFontName(fontnum)) {
|
||||
+ if ((tmpname = x_strdup(new_fnames.f_n)) == 0)
|
||||
+ return code;
|
||||
}
|
||||
|
||||
- TRACE(("Begin Cgs - xtermLoadFont(%s)\n", myfonts.f_n));
|
||||
+ TRACE(("Begin Cgs - xtermLoadFont(%s)\n", new_fnames.f_n));
|
||||
releaseWindowGCs(xw, win);
|
||||
|
||||
#define DbgResource(name, field, index) \
|
||||
TRACE(("xtermLoadFont #%d "name" %s%s\n", \
|
||||
fontnum, \
|
||||
- (fnts[index].warn == fwResource) ? "*" : " ", \
|
||||
- NonNull(myfonts.field)))
|
||||
+ (new_fonts[index].warn == fwResource) ? "*" : " ", \
|
||||
+ NonNull(new_fnames.field)))
|
||||
DbgResource("normal", f_n, fNorm);
|
||||
DbgResource("bold ", f_b, fBold);
|
||||
#if OPT_WIDE_CHARS
|
||||
@@ -1561,16 +1580,17 @@ xtermLoadFont(XtermWidget xw,
|
||||
#endif
|
||||
|
||||
if (!loadNormFP(xw,
|
||||
- &myfonts.f_n,
|
||||
- &fnts[fNorm],
|
||||
+ &new_fnames.f_n,
|
||||
+ &new_fonts[fNorm],
|
||||
+ &old_fonts[fNorm],
|
||||
fontnum))
|
||||
goto bad;
|
||||
|
||||
if (!loadBoldFP(xw,
|
||||
- &myfonts.f_b,
|
||||
- &fnts[fBold],
|
||||
- myfonts.f_n,
|
||||
- &fnts[fNorm],
|
||||
+ &new_fnames.f_b,
|
||||
+ &new_fonts[fBold],
|
||||
+ new_fnames.f_n,
|
||||
+ &new_fonts[fNorm],
|
||||
fontnum))
|
||||
goto bad;
|
||||
|
||||
@@ -1582,20 +1602,20 @@ xtermLoadFont(XtermWidget xw,
|
||||
if_OPT_WIDE_CHARS(screen, {
|
||||
|
||||
if (!loadWideFP(xw,
|
||||
- &myfonts.f_w,
|
||||
- &fnts[fWide],
|
||||
- myfonts.f_n,
|
||||
- &fnts[fNorm],
|
||||
+ &new_fnames.f_w,
|
||||
+ &new_fonts[fWide],
|
||||
+ new_fnames.f_n,
|
||||
+ &new_fonts[fNorm],
|
||||
fontnum))
|
||||
goto bad;
|
||||
|
||||
if (!loadWBoldFP(xw,
|
||||
- &myfonts.f_wb,
|
||||
- &fnts[fWBold],
|
||||
- myfonts.f_w,
|
||||
- &fnts[fWide],
|
||||
- myfonts.f_b,
|
||||
- &fnts[fBold],
|
||||
+ &new_fnames.f_wb,
|
||||
+ &new_fonts[fWBold],
|
||||
+ new_fnames.f_w,
|
||||
+ &new_fonts[fWide],
|
||||
+ new_fnames.f_b,
|
||||
+ &new_fonts[fBold],
|
||||
fontnum))
|
||||
goto bad;
|
||||
|
||||
@@ -1605,30 +1625,30 @@ xtermLoadFont(XtermWidget xw,
|
||||
* Normal/bold fonts should be the same width. Also, the min/max
|
||||
* values should be the same.
|
||||
*/
|
||||
- if (fnts[fNorm].fs != 0
|
||||
- && fnts[fBold].fs != 0
|
||||
- && (!is_fixed_font(fnts[fNorm].fs)
|
||||
- || !is_fixed_font(fnts[fBold].fs)
|
||||
- || differing_widths(fnts[fNorm].fs, fnts[fBold].fs))) {
|
||||
+ if (new_fonts[fNorm].fs != 0
|
||||
+ && new_fonts[fBold].fs != 0
|
||||
+ && (!is_fixed_font(new_fonts[fNorm].fs)
|
||||
+ || !is_fixed_font(new_fonts[fBold].fs)
|
||||
+ || differing_widths(new_fonts[fNorm].fs, new_fonts[fBold].fs))) {
|
||||
TRACE(("Proportional font! normal %d/%d, bold %d/%d\n",
|
||||
- fnts[fNorm].fs->min_bounds.width,
|
||||
- fnts[fNorm].fs->max_bounds.width,
|
||||
- fnts[fBold].fs->min_bounds.width,
|
||||
- fnts[fBold].fs->max_bounds.width));
|
||||
+ new_fonts[fNorm].fs->min_bounds.width,
|
||||
+ new_fonts[fNorm].fs->max_bounds.width,
|
||||
+ new_fonts[fBold].fs->min_bounds.width,
|
||||
+ new_fonts[fBold].fs->max_bounds.width));
|
||||
proportional = True;
|
||||
}
|
||||
|
||||
if_OPT_WIDE_CHARS(screen, {
|
||||
- if (fnts[fWide].fs != 0
|
||||
- && fnts[fWBold].fs != 0
|
||||
- && (!is_fixed_font(fnts[fWide].fs)
|
||||
- || !is_fixed_font(fnts[fWBold].fs)
|
||||
- || differing_widths(fnts[fWide].fs, fnts[fWBold].fs))) {
|
||||
+ if (new_fonts[fWide].fs != 0
|
||||
+ && new_fonts[fWBold].fs != 0
|
||||
+ && (!is_fixed_font(new_fonts[fWide].fs)
|
||||
+ || !is_fixed_font(new_fonts[fWBold].fs)
|
||||
+ || differing_widths(new_fonts[fWide].fs, new_fonts[fWBold].fs))) {
|
||||
TRACE(("Proportional font! wide %d/%d, wide bold %d/%d\n",
|
||||
- fnts[fWide].fs->min_bounds.width,
|
||||
- fnts[fWide].fs->max_bounds.width,
|
||||
- fnts[fWBold].fs->min_bounds.width,
|
||||
- fnts[fWBold].fs->max_bounds.width));
|
||||
+ new_fonts[fWide].fs->min_bounds.width,
|
||||
+ new_fonts[fWide].fs->max_bounds.width,
|
||||
+ new_fonts[fWBold].fs->min_bounds.width,
|
||||
+ new_fonts[fWBold].fs->max_bounds.width));
|
||||
proportional = True;
|
||||
}
|
||||
});
|
||||
@@ -1647,13 +1667,13 @@ xtermLoadFont(XtermWidget xw,
|
||||
screen->ifnts_ok = False;
|
||||
#endif
|
||||
|
||||
- xtermCopyFontInfo(GetNormalFont(screen, fNorm), &fnts[fNorm]);
|
||||
- xtermCopyFontInfo(GetNormalFont(screen, fBold), &fnts[fBold]);
|
||||
+ xtermCopyFontInfo(GetNormalFont(screen, fNorm), &new_fonts[fNorm]);
|
||||
+ xtermCopyFontInfo(GetNormalFont(screen, fBold), &new_fonts[fBold]);
|
||||
#if OPT_WIDE_CHARS
|
||||
- xtermCopyFontInfo(GetNormalFont(screen, fWide), &fnts[fWide]);
|
||||
- if (fnts[fWBold].fs == NULL)
|
||||
- xtermCopyFontInfo(GetNormalFont(screen, fWide), &fnts[fWide]);
|
||||
- xtermCopyFontInfo(GetNormalFont(screen, fWBold), &fnts[fWBold]);
|
||||
+ xtermCopyFontInfo(GetNormalFont(screen, fWide), &new_fonts[fWide]);
|
||||
+ if (new_fonts[fWBold].fs == NULL)
|
||||
+ xtermCopyFontInfo(GetNormalFont(screen, fWide), &new_fonts[fWide]);
|
||||
+ xtermCopyFontInfo(GetNormalFont(screen, fWBold), &new_fonts[fWBold]);
|
||||
#endif
|
||||
|
||||
xtermUpdateFontGCs(xw, getNormalFont);
|
||||
@@ -1684,7 +1704,7 @@ xtermLoadFont(XtermWidget xw,
|
||||
unsigned ch;
|
||||
|
||||
#if OPT_TRACE
|
||||
-#define TRACE_MISS(index) show_font_misses(#index, &fnts[index])
|
||||
+#define TRACE_MISS(index) show_font_misses(#index, &new_fonts[index])
|
||||
TRACE_MISS(fNorm);
|
||||
TRACE_MISS(fBold);
|
||||
#if OPT_WIDE_CHARS
|
||||
@@ -1701,8 +1721,8 @@ xtermLoadFont(XtermWidget xw,
|
||||
if ((n != UCS_REPL)
|
||||
&& (n != ch)
|
||||
&& (screen->fnt_boxes & 2)) {
|
||||
- if (xtermMissingChar(n, &fnts[fNorm]) ||
|
||||
- xtermMissingChar(n, &fnts[fBold])) {
|
||||
+ if (xtermMissingChar(n, &new_fonts[fNorm]) ||
|
||||
+ xtermMissingChar(n, &new_fonts[fBold])) {
|
||||
UIntClr(screen->fnt_boxes, 2);
|
||||
TRACE(("missing graphics character #%d, U+%04X\n",
|
||||
ch, n));
|
||||
@@ -1714,12 +1734,12 @@ xtermLoadFont(XtermWidget xw,
|
||||
#endif
|
||||
|
||||
for (ch = 1; ch < 32; ch++) {
|
||||
- if (xtermMissingChar(ch, &fnts[fNorm])) {
|
||||
+ if (xtermMissingChar(ch, &new_fonts[fNorm])) {
|
||||
TRACE(("missing normal char #%d\n", ch));
|
||||
UIntClr(screen->fnt_boxes, 1);
|
||||
break;
|
||||
}
|
||||
- if (xtermMissingChar(ch, &fnts[fBold])) {
|
||||
+ if (xtermMissingChar(ch, &new_fonts[fBold])) {
|
||||
TRACE(("missing bold char #%d\n", ch));
|
||||
UIntClr(screen->fnt_boxes, 1);
|
||||
break;
|
||||
@@ -1736,8 +1756,8 @@ xtermLoadFont(XtermWidget xw,
|
||||
screen->enbolden = screen->bold_mode;
|
||||
} else {
|
||||
screen->enbolden = screen->bold_mode
|
||||
- && ((fnts[fNorm].fs == fnts[fBold].fs)
|
||||
- || same_font_name(myfonts.f_n, myfonts.f_b));
|
||||
+ && ((new_fonts[fNorm].fs == new_fonts[fBold].fs)
|
||||
+ || same_font_name(new_fnames.f_n, new_fnames.f_b));
|
||||
}
|
||||
TRACE(("Will %suse 1-pixel offset/overstrike to simulate bold\n",
|
||||
screen->enbolden ? "" : "not "));
|
||||
@@ -1753,7 +1773,7 @@ xtermLoadFont(XtermWidget xw,
|
||||
update_font_escape();
|
||||
}
|
||||
#if OPT_SHIFT_FONTS
|
||||
- screen->menu_font_sizes[fontnum] = FontSize(fnts[fNorm].fs);
|
||||
+ screen->menu_font_sizes[fontnum] = FontSize(new_fonts[fNorm].fs);
|
||||
#endif
|
||||
}
|
||||
set_cursor_gcs(xw);
|
||||
@@ -1768,20 +1788,21 @@ xtermLoadFont(XtermWidget xw,
|
||||
FREE_FNAME(f_w);
|
||||
FREE_FNAME(f_wb);
|
||||
#endif
|
||||
- if (fnts[fNorm].fn == fnts[fBold].fn) {
|
||||
- free(fnts[fNorm].fn);
|
||||
+ if (new_fonts[fNorm].fn == new_fonts[fBold].fn) {
|
||||
+ free(new_fonts[fNorm].fn);
|
||||
} else {
|
||||
- free(fnts[fNorm].fn);
|
||||
- free(fnts[fBold].fn);
|
||||
+ free(new_fonts[fNorm].fn);
|
||||
+ free(new_fonts[fBold].fn);
|
||||
}
|
||||
#if OPT_WIDE_CHARS
|
||||
- free(fnts[fWide].fn);
|
||||
- free(fnts[fWBold].fn);
|
||||
+ free(new_fonts[fWide].fn);
|
||||
+ free(new_fonts[fWBold].fn);
|
||||
#endif
|
||||
xtermSetWinSize(xw);
|
||||
return 1;
|
||||
|
||||
bad:
|
||||
+ recovered = False;
|
||||
free(tmpname);
|
||||
|
||||
#if OPT_RENDERFONT
|
||||
@@ -1791,15 +1812,15 @@ xtermLoadFont(XtermWidget xw,
|
||||
SetItemSensitivity(fontMenuEntries[fontnum].widget, True);
|
||||
#endif
|
||||
Bell(xw, XkbBI_MinorError, 0);
|
||||
- myfonts.f_n = screen->MenuFontName(old_fontnum);
|
||||
- return xtermLoadFont(xw, &myfonts, doresize, old_fontnum);
|
||||
- } else if (x_strcasecmp(myfonts.f_n, DEFFONT)) {
|
||||
- int code;
|
||||
-
|
||||
- myfonts.f_n = x_strdup(DEFFONT);
|
||||
- TRACE(("...recovering for TrueType fonts\n"));
|
||||
- code = xtermLoadFont(xw, &myfonts, doresize, fontnum);
|
||||
- if (code) {
|
||||
+ new_fnames.f_n = screen->MenuFontName(old_fontnum);
|
||||
+ if (xtermLoadFont(xw, &new_fnames, doresize, old_fontnum))
|
||||
+ recovered = True;
|
||||
+ } else if (x_strcasecmp(new_fnames.f_n, DEFFONT)
|
||||
+ && x_strcasecmp(new_fnames.f_n, old_fonts[fNorm].fn)) {
|
||||
+ new_fnames.f_n = x_strdup(old_fonts[fNorm].fn);
|
||||
+ TRACE(("...recovering from failed font-load\n"));
|
||||
+ if (xtermLoadFont(xw, &new_fnames, doresize, fontnum)) {
|
||||
+ recovered = True;
|
||||
if (fontnum != fontMenu_fontsel) {
|
||||
SetItemSensitivity(fontMenuEntries[fontnum].widget,
|
||||
UsingRenderFont(xw));
|
||||
@@ -1808,15 +1829,15 @@ xtermLoadFont(XtermWidget xw,
|
||||
FontHeight(screen),
|
||||
FontWidth(screen)));
|
||||
}
|
||||
- return code;
|
||||
}
|
||||
#endif
|
||||
-
|
||||
- releaseWindowGCs(xw, win);
|
||||
-
|
||||
- xtermCloseFonts(xw, fnts);
|
||||
- TRACE(("Fail Cgs - xtermLoadFont\n"));
|
||||
- return 0;
|
||||
+ if (!recovered) {
|
||||
+ releaseWindowGCs(xw, win);
|
||||
+ xtermCloseFonts(xw, new_fonts);
|
||||
+ TRACE(("Fail Cgs - xtermLoadFont\n"));
|
||||
+ code = 0;
|
||||
+ }
|
||||
+ return code;
|
||||
}
|
||||
|
||||
#if OPT_WIDE_ATTRS
|
||||
@@ -1864,7 +1885,7 @@ xtermLoadItalics(XtermWidget xw)
|
||||
} else {
|
||||
xtermOpenFont(xw,
|
||||
getNormalFont(screen, n)->fn,
|
||||
- data, False);
|
||||
+ data, NULL, False);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4420,7 +4441,7 @@ lookupOneFontSize(XtermWidget xw, int fontnum)
|
||||
|
||||
memset(&fnt, 0, sizeof(fnt));
|
||||
screen->menu_font_sizes[fontnum] = -1;
|
||||
- if (xtermOpenFont(xw, screen->MenuFontName(fontnum), &fnt, True)) {
|
||||
+ if (xtermOpenFont(xw, screen->MenuFontName(fontnum), &fnt, NULL, True)) {
|
||||
if (fontnum <= fontMenu_lastBuiltin
|
||||
|| strcmp(fnt.fn, DEFFONT)) {
|
||||
screen->menu_font_sizes[fontnum] = FontSize(fnt.fs);
|
||||
@@ -4832,13 +4853,14 @@ HandleSetFont(Widget w,
|
||||
}
|
||||
}
|
||||
|
||||
-void
|
||||
+Bool
|
||||
SetVTFont(XtermWidget xw,
|
||||
int which,
|
||||
Bool doresize,
|
||||
const VTFontNames * fonts)
|
||||
{
|
||||
TScreen *screen = TScreenOf(xw);
|
||||
+ Bool result = False;
|
||||
|
||||
TRACE(("SetVTFont(which=%d, f_n=%s, f_b=%s)\n", which,
|
||||
(fonts && fonts->f_n) ? fonts->f_n : "<null>",
|
||||
@@ -4847,34 +4869,31 @@ SetVTFont(XtermWidget xw,
|
||||
if (IsIcon(screen)) {
|
||||
Bell(xw, XkbBI_MinorError, 0);
|
||||
} else if (which >= 0 && which < NMENUFONTS) {
|
||||
- VTFontNames myfonts;
|
||||
+ VTFontNames new_fnames;
|
||||
|
||||
- memset(&myfonts, 0, sizeof(myfonts));
|
||||
+ memset(&new_fnames, 0, sizeof(new_fnames));
|
||||
if (fonts != 0)
|
||||
- myfonts = *fonts;
|
||||
+ new_fnames = *fonts;
|
||||
|
||||
if (which == fontMenu_fontsel) { /* go get the selection */
|
||||
- FindFontSelection(xw, myfonts.f_n, False);
|
||||
+ result = FindFontSelection(xw, new_fnames.f_n, False);
|
||||
} else {
|
||||
- int oldFont = screen->menu_font_number;
|
||||
-
|
||||
#define USE_CACHED(field, name) \
|
||||
- if (myfonts.field == 0) { \
|
||||
- myfonts.field = x_strdup(screen->menu_font_names[which][name]); \
|
||||
- TRACE(("set myfonts." #field " from menu_font_names[%d][" #name "] %s\n", \
|
||||
- which, NonNull(myfonts.field))); \
|
||||
+ if (new_fnames.field == NULL) { \
|
||||
+ new_fnames.field = x_strdup(screen->menu_font_names[which][name]); \
|
||||
+ TRACE(("set new_fnames." #field " from menu_font_names[%d][" #name "] %s\n", \
|
||||
+ which, NonNull(new_fnames.field))); \
|
||||
} else { \
|
||||
- TRACE(("set myfonts." #field " reused\n")); \
|
||||
+ TRACE(("set new_fnames." #field " reused\n")); \
|
||||
}
|
||||
#define SAVE_FNAME(field, name) \
|
||||
- if (myfonts.field != 0) { \
|
||||
- if (screen->menu_font_names[which][name] == 0 \
|
||||
- || strcmp(screen->menu_font_names[which][name], myfonts.field)) { \
|
||||
- TRACE(("updating menu_font_names[%d][" #name "] to \"%s\"\n", \
|
||||
- which, myfonts.field)); \
|
||||
- FREE_STRING(screen->menu_font_names[which][name]); \
|
||||
- screen->menu_font_names[which][name] = x_strdup(myfonts.field); \
|
||||
- } \
|
||||
+ if (new_fnames.field != NULL \
|
||||
+ && (screen->menu_font_names[which][name] == NULL \
|
||||
+ || strcmp(screen->menu_font_names[which][name], new_fnames.field))) { \
|
||||
+ TRACE(("updating menu_font_names[%d][" #name "] to \"%s\"\n", \
|
||||
+ which, new_fnames.field)); \
|
||||
+ FREE_STRING(screen->menu_font_names[which][name]); \
|
||||
+ screen->menu_font_names[which][name] = x_strdup(new_fnames.field); \
|
||||
}
|
||||
|
||||
USE_CACHED(f_n, fNorm);
|
||||
@@ -4884,7 +4903,7 @@ SetVTFont(XtermWidget xw,
|
||||
USE_CACHED(f_wb, fWBold);
|
||||
#endif
|
||||
if (xtermLoadFont(xw,
|
||||
- &myfonts,
|
||||
+ &new_fnames,
|
||||
doresize, which)) {
|
||||
/*
|
||||
* If successful, save the data so that a subsequent query via
|
||||
@@ -4896,10 +4915,8 @@ SetVTFont(XtermWidget xw,
|
||||
SAVE_FNAME(f_w, fWide);
|
||||
SAVE_FNAME(f_wb, fWBold);
|
||||
#endif
|
||||
+ result = True;
|
||||
} else {
|
||||
- (void) xtermLoadFont(xw,
|
||||
- xtermFontName(screen->MenuFontName(oldFont)),
|
||||
- doresize, oldFont);
|
||||
Bell(xw, XkbBI_MinorError, 0);
|
||||
}
|
||||
FREE_FNAME(f_n);
|
||||
@@ -4912,7 +4929,8 @@ SetVTFont(XtermWidget xw,
|
||||
} else {
|
||||
Bell(xw, XkbBI_MinorError, 0);
|
||||
}
|
||||
- return;
|
||||
+ TRACE(("...SetVTFont: %d\n", result));
|
||||
+ return result;
|
||||
}
|
||||
|
||||
#if OPT_RENDERFONT
|
||||
diff --git a/fontutils.h b/fontutils.h
|
||||
index 85c6ae3..8a95894 100644
|
||||
--- a/fontutils.h
|
||||
+++ b/fontutils.h
|
||||
@@ -37,7 +37,7 @@
|
||||
/* *INDENT-OFF* */
|
||||
|
||||
extern Bool xtermLoadDefaultFonts (XtermWidget /* xw */);
|
||||
-extern Bool xtermOpenFont (XtermWidget /* xw */, const char */* name */, XTermFonts * /* result */, Bool /* force */);
|
||||
+extern Bool xtermOpenFont (XtermWidget /* xw */, const char */* name */, XTermFonts * /* result */, XTermFonts * /* current */, Bool /* force */);
|
||||
extern XTermFonts * getDoubleFont (TScreen * /* screen */, int /* which */);
|
||||
extern XTermFonts * getItalicFont (TScreen * /* screen */, int /* which */);
|
||||
extern XTermFonts * getNormalFont (TScreen * /* screen */, int /* which */);
|
||||
@@ -50,7 +50,7 @@ extern int lookupRelativeFontSize (XtermWidget /* xw */, int /* old */, int /* r
|
||||
extern int xtermGetFont (const char * /* param */);
|
||||
extern int xtermLoadFont (XtermWidget /* xw */, const VTFontNames */* fonts */, Bool /* doresize */, int /* fontnum */);
|
||||
extern void HandleSetFont PROTO_XT_ACTIONS_ARGS;
|
||||
-extern void SetVTFont (XtermWidget /* xw */, int /* i */, Bool /* doresize */, const VTFontNames */* fonts */);
|
||||
+extern Bool SetVTFont (XtermWidget /* xw */, int /* i */, Bool /* doresize */, const VTFontNames */* fonts */);
|
||||
extern void allocFontList (XtermWidget /* xw */, const char * /* name */, XtermFontNames * /* target */, VTFontEnum /* which */, const char * /* source */, Bool /* ttf */);
|
||||
extern void copyFontList (char *** /* targetp */, char ** /* source */);
|
||||
extern void initFontLists (XtermWidget /* xw */);
|
||||
diff --git a/misc.c b/misc.c
|
||||
index 1c2f6be..bea54bd 100644
|
||||
--- a/misc.c
|
||||
+++ b/misc.c
|
||||
@@ -3863,9 +3863,9 @@ ChangeFontRequest(XtermWidget xw, String buf)
|
||||
{
|
||||
memset(&fonts, 0, sizeof(fonts));
|
||||
fonts.f_n = name;
|
||||
- SetVTFont(xw, num, True, &fonts);
|
||||
- if (num == screen->menu_font_number &&
|
||||
- num != fontMenu_fontescape) {
|
||||
+ if (SetVTFont(xw, num, True, &fonts)
|
||||
+ && num == screen->menu_font_number
|
||||
+ && num != fontMenu_fontescape) {
|
||||
screen->EscapeFontName() = x_strdup(name);
|
||||
}
|
||||
}
|
||||
@@ -6315,7 +6315,6 @@ xtermSetenv(const char *var, const char *value)
|
||||
|
||||
found = envindex;
|
||||
environ[found + 1] = NULL;
|
||||
- environ = environ;
|
||||
}
|
||||
|
||||
environ[found] = malloc(2 + len + strlen(value));
|
||||
diff --git a/screen.c b/screen.c
|
||||
index 6fb6b3b..4bc1ca7 100644
|
||||
--- a/screen.c
|
||||
+++ b/screen.c
|
||||
@@ -1539,6 +1539,7 @@ ScrnRefresh(XtermWidget xw,
|
||||
nrows, ncols,
|
||||
force ? " force" : ""));
|
||||
|
||||
+ (void) recurse;
|
||||
++recurse;
|
||||
|
||||
if (screen->cursorp.col >= leftcol
|
||||
diff --git a/xterm.h b/xterm.h
|
||||
index f8ec98c..9cb6ff3 100644
|
||||
--- a/xterm.h
|
||||
+++ b/xterm.h
|
||||
@@ -985,7 +985,7 @@ extern Bool CheckBufPtrs (TScreen * /* screen */);
|
||||
extern Bool set_cursor_gcs (XtermWidget /* xw */);
|
||||
extern char * vt100ResourceToString (XtermWidget /* xw */, const char * /* name */);
|
||||
extern int VTInit (XtermWidget /* xw */);
|
||||
-extern void FindFontSelection (XtermWidget /* xw */, const char * /* atom_name */, Bool /* justprobe */);
|
||||
+extern Bool FindFontSelection (XtermWidget /* xw */, const char * /* atom_name */, Bool /* justprobe */);
|
||||
extern void HideCursor (XtermWidget /* xw */);
|
||||
extern void RestartBlinking(XtermWidget /* xw */);
|
||||
extern void ShowCursor (XtermWidget /* xw */);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
29
xterm.spec
29
xterm.spec
@ -1,16 +1,12 @@
|
||||
Name: xterm
|
||||
Version: 363
|
||||
Release: 6
|
||||
Release: 1
|
||||
Summary: It is a terminal emulator for the X Window System
|
||||
License: MIT
|
||||
URL: http://invisible-island.net/xterm
|
||||
Source0: https://invisible-mirror.net/archives/xterm/xterm-%{version}.tgz
|
||||
|
||||
Patch6000: backport-CVE-2021-27135.patch
|
||||
Patch6001: backport-CVE-2022-24130.patch
|
||||
Patch6002: backport-CVE-2022-45063.patch
|
||||
|
||||
BuildRequires: gcc pkgconfig ncurses-devel libutempter-devel
|
||||
BuildRequires: gcc git pkgconfig ncurses-devel libutempter-devel
|
||||
BuildRequires: libXft-devel libXaw-devel libXext-devel desktop-file-utils
|
||||
BuildRequires: libxkbfile-devel xorg-x11-apps
|
||||
|
||||
@ -30,7 +26,7 @@ Summary: Doc files for xterm
|
||||
The xterm-help package contains doc files for xterm.
|
||||
|
||||
%prep
|
||||
%autosetup -n xterm-363 -p1
|
||||
%autosetup -n xterm-363 -p1 -S git
|
||||
|
||||
iconv -f iso8859-1 -t utf-8 < THANKS > TEMP
|
||||
touch -r THANKS TEMP; mv TEMP THANKS
|
||||
@ -66,25 +62,10 @@ install -m 644 -p xterm.appdata.xml %{buildroot}/%{_datadir}/appdata
|
||||
%{_mandir}/man1/*
|
||||
|
||||
%changelog
|
||||
* Sun Sep 29 2024 lingsheng <lingsheng1@h-partners.com> - 363-6
|
||||
- fix CVE-2022-45063
|
||||
|
||||
* Thu Apr 13 2023 penghaitao <htpengc@isoftstone.com> - 363-5
|
||||
- fix bogus date in %changelog
|
||||
|
||||
* Tue Feb 22 2022 xingxing <xingxing9@h-partners.com> - 363-4
|
||||
- fix CVE-2022-24130
|
||||
|
||||
* Fri Jul 30 2021 chenyanpanHW <chenyanpan@huawei.com> - 363-3
|
||||
- DESC: delete -S git from %autosetup, and delete BuildRequires git
|
||||
|
||||
* Wed Mar 03 2021 jinzhimin <jinzhimin2@huawei.com> - 363-2
|
||||
- fix CVE-2021-27135
|
||||
|
||||
* Thu Jan 28 2021 jinzhimin <jinzhimin2@huawei.com> - 363-1
|
||||
- Upgrade to 363
|
||||
|
||||
* Tue Sep 29 2020 hanhui <hanhui15@huawei.com> - 334-6
|
||||
* Thu Sep 29 2020 hanhui <hanhui15@huawei.com> - 334-6
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
@ -96,7 +77,7 @@ install -m 644 -p xterm.appdata.xml %{buildroot}/%{_datadir}/appdata
|
||||
- SUG:NA
|
||||
- DESC:modify source url
|
||||
|
||||
* Fri Jan 3 2020 openEuler Buildteam <buildteam@openeuler.org> - 334-4
|
||||
* Thu Jan 3 2020 openEuler Buildteam <buildteam@openeuler.org> - 334-4
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user