On Tue, Nov 27, 2012 at 08:10:15AM +0100, Julien Cristau wrote: > On Mon, Nov 26, 2012 at 19:43:57 -0500, Thomas Dickey wrote: > > > On Mon, Nov 26, 2012 at 11:13:05PM +0100, Julien Cristau wrote: > > > On Mon, Nov 26, 2012 at 16:50:32 -0500, Thomas Dickey wrote: > > > > > > > That's a question for the package maintainer (who seems to be absent). > > > > > > > That, or they have limited free time. > > > > no problem (the followup helps). > > > > It still would be useful to have those 4 fixes applied (before Debian 7...). > > If you find some time, I can make a set of patches for those. > > > Yes, that shouldn't be a problem. attached > Patch #280 - 2012/06/24 > * add null-pointer checks to input-method caching added in > [313]patch #277 to fix a problem in the exposure code, when > deselecting a window (report by Kriston Rehberg). > > (the packager applied a _part_ of this - I noted in #685458 that its > change did not address the report which I received, and my followup > with a patch was ignored) xterm-278-p4.patch (this is the whole diff - some part was already applied) > Patch #279 - 2012/05/10 > * amend fix for Debian #650291 in [314]patch #277 changes to account > for different data returned by vnc4server (Debian #670638). xterm-278-p3.patch > * correct macro definition used for testing modes used in ANSI/DEC > request-mode controls introduced in [316]patch #262. xterm-278-p2.patch > * add a null-pointer check in OkPasswd macro to fix a problem in > resize with Fedora 17 and a serial console (report/patch by Daniel > Drake). xterm-278-p1.patch (I later changed this fix for a compiler warning, final version given here) -- Thomas E. Dickey <dickey@invisible-island.net> http://invisible-island.net ftp://invisible-island.net
# ftp://invisible-island.net/temp/xterm-278-p1.patch.gz
# patch by Thomas E. Dickey <dickey@invisible-island.net>
# created Tue Nov 27 10:17:11 UTC 2012
# ------------------------------------------------------------------------------
# xstrings.c | 4 ++--
# 1 file changed, 2 insertions(+), 2 deletions(-)
# ------------------------------------------------------------------------------
Index: xstrings.c
--- xterm-278+/xstrings.c 2011-09-11 20:20:12.000000000 +0000
+++ xterm-278-p1/xstrings.c 2012-11-27 10:01:42.000000000 +0000
@@ -214,7 +214,7 @@
struct passwd *ptr = getpwnam(name);
Boolean code;
- if (OkPasswd(ptr)) {
+ if (ptr != 0 && OkPasswd(ptr)) {
code = True;
alloc_pw(result, ptr);
} else {
@@ -234,7 +234,7 @@
struct passwd *ptr = getpwuid((uid_t) uid);
Boolean code;
- if (OkPasswd(ptr)) {
+ if (ptr != 0 && OkPasswd(ptr)) {
code = True;
alloc_pw(result, ptr);
} else {
# ftp://invisible-island.net/temp/xterm-278-p2.patch.gz # patch by Thomas E. Dickey <dickey@invisible-island.net> # created Tue Nov 27 10:17:13 UTC 2012 # ------------------------------------------------------------------------------ # misc.c | 2 +- # 1 file changed, 1 insertion(+), 1 deletion(-) # ------------------------------------------------------------------------------ Index: misc.c --- xterm-278+/misc.c 2012-01-07 01:57:52.000000000 +0000 +++ xterm-278-p2/misc.c 2012-11-27 10:00:55.000000000 +0000 @@ -3770,7 +3770,7 @@ }; #define MdBool(bool) ((bool) ? mdMaybeSet : mdMaybeReset) -#define MdFlag(mode,flag) MdBool(xw->keyboard.flags & MODE_KAM) +#define MdFlag(mode,flag) MdBool((mode) & (flag)) /* * Reply is the same format as the query, with pair of mode/value:
# ftp://invisible-island.net/temp/xterm-278-p3.patch.gz
# patch by Thomas E. Dickey <dickey@invisible-island.net>
# created Tue Nov 27 10:17:15 UTC 2012
# ------------------------------------------------------------------------------
# misc.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---------
# 1 file changed, 78 insertions(+), 12 deletions(-)
# ------------------------------------------------------------------------------
Index: misc.c
--- xterm-278+/misc.c 2012-01-07 01:57:52.000000000 +0000
+++ xterm-278-p3/misc.c 2012-11-27 10:10:36.000000000 +0000
@@ -2176,16 +2176,79 @@
#define ULONG_MAX (unsigned long)(~(0L))
#endif
-static unsigned short
-searchColortable(XColor * colortable, unsigned length, unsigned color)
+#define CheckColor(result, value) \
+ result = 0; \
+ if (value.red) \
+ result |= 1; \
+ if (value.green) \
+ result |= 2; \
+ if (value.blue) \
+ result |= 4
+
+#define SelectColor(state, value, result) \
+ switch (state) { \
+ default: \
+ case 1: \
+ result = value.red; \
+ break; \
+ case 2: \
+ result = value.green; \
+ break; \
+ case 4: \
+ result = value.blue; \
+ break; \
+ }
+
+/*
+ * Check if the color map consists of values in exactly one of the red, green
+ * or blue columns. If it is not, we do not know how to use it for the exact
+ * match.
+ */
+static int
+simpleColors(XColor * colortable, unsigned length)
+{
+ unsigned n;
+ int state = -1;
+ int check;
+
+ for (n = 0; n < length; ++n) {
+ if (state == -1) {
+ CheckColor(state, colortable[n]);
+ if (state == 0)
+ state = -1;
+ }
+ if (state > 0) {
+ CheckColor(check, colortable[n]);
+ if (check > 0 && check != state) {
+ state = 0;
+ break;
+ }
+ }
+ }
+ switch (state) {
+ case 1:
+ case 2:
+ case 4:
+ break;
+ default:
+ state = 0;
+ break;
+ }
+ return state;
+}
+
+static unsigned
+searchColors(XColor * colortable, unsigned length, unsigned color, int state)
{
unsigned result = 0;
unsigned n;
unsigned long best = ULONG_MAX;
unsigned long diff;
+ unsigned value;
for (n = 0; n < length; ++n) {
- diff = (color - colortable[n].blue);
+ SelectColor(state, colortable[n], value);
+ diff = (color - value);
diff *= diff;
if (diff < best) {
#if 0
@@ -2200,7 +2263,8 @@
best = diff;
}
}
- return colortable[result].blue;
+ SelectColor(state, colortable[result], value);
+ return value;
}
/*
@@ -2243,20 +2307,19 @@
if (result) {
unsigned cmap_type;
unsigned cmap_size;
+ int state;
getColormapInfo(screen->display, &cmap_type, &cmap_size);
if ((cmap_type & 1) == 0) {
XColor temp = *def;
- if (loadColorTable(xw, cmap_size)) {
- /*
- * Note: the query will return only a value in the ".blue"
- * member, leaving ".red" and ".green" as zeros.
- */
- temp.red = searchColortable(screen->cmap_data, cmap_size, save.red);
- temp.green = searchColortable(screen->cmap_data, cmap_size, save.green);
- temp.blue = searchColortable(screen->cmap_data, cmap_size, save.blue);
+ if (loadColorTable(xw, cmap_size)
+ && (state = simpleColors(screen->cmap_data, cmap_size)) > 0) {
+#define SearchColors(which) temp.which = (unsigned short) searchColors(screen->cmap_data, cmap_size, save.which, state)
+ SearchColors(red);
+ SearchColors(green);
+ SearchColors(blue);
if (XAllocColor(screen->display, cmap, &temp) != 0) {
#if OPT_TRACE
if (temp.red != save.red
@@ -2265,6 +2328,9 @@
TRACE(("...improved %x/%x/%x ->%x/%x/%x\n",
save.red, save.green, save.blue,
temp.red, temp.green, temp.blue));
+ } else {
+ TRACE(("...no improvement for %x/%x/%x\n",
+ save.red, save.green, save.blue));
}
#endif
*def = temp;
# ftp://invisible-island.net/temp/xterm-278-p4.patch.gz
# patch by Thomas E. Dickey <dickey@invisible-island.net>
# created Tue Nov 27 10:17:35 UTC 2012
# ------------------------------------------------------------------------------
# charproc.c | 8 ++++----
# input.c | 2 +-
# misc.c | 4 ++--
# 3 files changed, 7 insertions(+), 7 deletions(-)
# ------------------------------------------------------------------------------
Index: charproc.c
--- xterm-278+/charproc.c 2012-01-19 00:22:08.000000000 +0000
+++ xterm-278-p4/charproc.c 2012-11-27 10:15:42.000000000 +0000
@@ -3797,7 +3797,7 @@
XPoint spot;
XVaNestedList list;
- if (input->xic
+ if (input && input->xic
&& (ld = getLineData(screen, screen->cur_row)) != 0) {
spot.x = (short) LineCursorX(screen, ld, screen->cur_col);
spot.y = (short) (CursorY(screen, screen->cur_row) + xw->misc.xim_fs_ascent);
@@ -6952,7 +6952,7 @@
{
TInput *input = lookupTInput(xw, (Widget) xw);
- if (input->xim) {
+ if (input && input->xim) {
XCloseIM(input->xim);
input->xim = 0;
TRACE(("freed screen->xim\n"));
@@ -7506,8 +7506,8 @@
TRACE(("xim_destroy_cb im=%lx, client=%p, call=%p\n",
(long) im, client_data, call_data));
-
- input->xic = NULL;
+ if (input)
+ input->xic = NULL;
XRegisterIMInstantiateCallback(XtDisplay(xw), NULL, NULL, NULL,
xim_instantiate_cb, NULL);
}
Index: input.c
--- xterm-278+/input.c 2012-01-07 02:01:05.000000000 +0000
+++ xterm-278-p4/input.c 2012-11-27 10:15:42.000000000 +0000
@@ -832,7 +832,7 @@
{
#if OPT_I18N_SUPPORT && OPT_INPUT_METHOD
TInput *input = lookupTInput(xw, (Widget) xw);
- if (input->xic) {
+ if (input && input->xic) {
Status status_return;
#if OPT_WIDE_CHARS
if (screen->utf8_mode) {
Index: misc.c
--- xterm-278+/misc.c 2012-01-07 01:57:52.000000000 +0000
+++ xterm-278-p4/misc.c 2012-11-27 10:15:42.000000000 +0000
@@ -180,7 +180,7 @@
{
#if OPT_I18N_SUPPORT && OPT_INPUT_METHOD
TInput *input = lookupTInput(xw, (Widget) xw);
- if (input->xic)
+ if (input && input->xic)
XSetICFocus(input->xic);
#endif
@@ -218,7 +218,7 @@
{
#if OPT_I18N_SUPPORT && OPT_INPUT_METHOD
TInput *input = lookupTInput(xw, (Widget) xw);
- if (input->xic)
+ if (input && input->xic)
XUnsetICFocus(input->xic);
#endif
Attachment:
signature.asc
Description: Digital signature