~ubuntu-branches/ubuntu/quantal/xterm/quantal

« back to all changes in this revision

Viewing changes to button.c

  • Committer: Bazaar Package Importer
  • Author(s): Bhavani Shankar
  • Date: 2009-05-06 05:13:35 UTC
  • mfrom: (1.1.14 upstream) (11.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20090506051335-wq7afxwrm5ir33xr
Tags: 242-1ubuntu1
* Merge from debian unstable, remaining changes: LP: #372492
  - Enabled URL hilighting
  - rm -rf for .pc patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $XTermId: button.c,v 1.300 2009/01/22 23:47:52 tom Exp $ */
 
1
/* $XTermId: button.c,v 1.306 2009/02/13 21:09:08 tom Exp $ */
2
2
 
3
3
/*
4
4
 * Copyright 1999-2008,2009 by Thomas E. Dickey
337
337
    /* update mask to "after" state */
338
338
    state ^= 1 << button;
339
339
    /* swap Button1 & Button3 */
340
 
    state = (state & ~(4 | 1)) | ((state & 1) ? 4 : 0) | ((state & 4) ? 1 : 0);
 
340
    state = ((state & (unsigned) ~(4 | 1))
 
341
             | ((state & 1) ? 4 : 0)
 
342
             | ((state & 4) ? 1 : 0));
341
343
 
342
344
    reply.a_param[1] = (ParmType) state;
343
345
    reply.a_param[2] = (ParmType) row;
1077
1079
UTF8toLatin1(Char * s, unsigned len, unsigned long *result)
1078
1080
{
1079
1081
    static Char *buffer;
1080
 
    static size_t used;
 
1082
    static Cardinal used;
1081
1083
 
1082
1084
    Char *q;
1083
1085
 
1084
 
    if (used == 0) {
1085
 
        buffer = (Char *) XtMalloc(1 + (used = len));
1086
 
    } else if (len > used) {
1087
 
        buffer = (Char *) XtRealloc((char *) buffer, 1 + (used = len));
 
1086
    if (len > used) {
 
1087
        used = 1 + (2 * len);
 
1088
        allocXtermChars(&buffer, used);
1088
1089
    }
1089
1090
 
1090
1091
    if (buffer != 0) {
1107
1108
                    if (eqv == value)
1108
1109
                        eqv = '#';
1109
1110
                    *q++ = (Char) eqv;
1110
 
                    if (iswide((wchar_t) value))
 
1111
                    if (isWide((wchar_t) value))
1111
1112
                        *q++ = ' ';
1112
1113
                }
1113
1114
            }
2247
2248
Bool
2248
2249
iswide(int i)
2249
2250
{
2250
 
    return (i == HIDDEN_CHAR) || (my_wcwidth(i) == 2);
 
2251
    return (i == HIDDEN_CHAR) || ((i >= FIRST_WIDECHAR) && my_wcwidth(i) == 2);
2251
2252
}
2252
2253
 
2253
2254
#define isWideCell(row, col) iswide((int)XTERM_CELL(row, col))
3474
3475
            (unsigned long) (4 * XMaxRequestSize(XtDisplay((Widget) xw)) - 32);
3475
3476
            if (screen->selection_length > limit) {
3476
3477
                fprintf(stderr,
3477
 
                        "%s: selection too big (%ld bytes), not storing in CUT_BUFFER%d\n",
 
3478
                        "%s: selection too big (%lu bytes), not storing in CUT_BUFFER%d\n",
3478
3479
                        xterm_name, screen->selection_length, cutbuffer);
3479
3480
            } else {
3480
3481
                /* This used to just use the UTF-8 data, which was totally
3613
3614
        /* We want to strip out every occurrence of HIDDEN_CHAR AFTER a
3614
3615
         * wide character.
3615
3616
         */
3616
 
        if (c == HIDDEN_CHAR && iswide((int) previous)) {
 
3617
        if (c == HIDDEN_CHAR && isWide((int) previous)) {
3617
3618
            previous = c;
3618
3619
            /* Combining characters attached to double-width characters
3619
3620
               are in memory attached to the HIDDEN_CHAR */