~ubuntu-branches/ubuntu/precise/xterm/precise-updates

« back to all changes in this revision

Viewing changes to charproc.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2011-06-17 10:40:36 UTC
  • mfrom: (1.4.12 upstream) (11.1.26 sid)
  • Revision ID: james.westby@ubuntu.com-20110617104036-id4ml81yetasewp9
Tags: 270-1ubuntu1
* Merge from debian unstable.  Remaining changes:
  - debian/patches/950_ubuntu_charclass_highlight.diff: Enabled URL
    highlighting
  - debian/patches/Add 951_uxterm_utf8_title.diff: Set utf8Titles to true by
    default when using uxterm, so that it displays utf8 directories in titles
    properly.  May cause issues with apps that use control sequences for
    updating the xterm titlebar - users should use xterm or set utf8Title
    to false in this case.
  - debian/gbp.conf: Use "Ubuntu" in "debian-branch" directly

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $XTermId: charproc.c,v 1.1100 2011/02/09 10:15:36 tom Exp $ */
 
1
/* $XTermId: charproc.c,v 1.1121 2011/04/24 22:57:13 tom Exp $ */
2
2
 
3
3
/*
4
4
 * Copyright 1999-2010,2011 by Thomas E. Dickey
5
 
 * 
 
5
 *
6
6
 *                         All Rights Reserved
7
 
 * 
 
7
 *
8
8
 * Permission is hereby granted, free of charge, to any person obtaining a
9
9
 * copy of this software and associated documentation files (the
10
10
 * "Software"), to deal in the Software without restriction, including
12
12
 * distribute, sublicense, and/or sell copies of the Software, and to
13
13
 * permit persons to whom the Software is furnished to do so, subject to
14
14
 * the following conditions:
15
 
 * 
 
15
 *
16
16
 * The above copyright notice and this permission notice shall be included
17
17
 * in all copies or substantial portions of the Software.
18
 
 * 
 
18
 *
19
19
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20
20
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
21
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23
23
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24
24
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25
25
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
 
 * 
 
26
 *
27
27
 * Except as contained in this notice, the name(s) of the above copyright
28
28
 * holders shall not be used in advertising or otherwise to promote the
29
29
 * sale, use or other dealings in this Software without prior written
30
30
 * authorization.
31
 
 * 
32
 
 * 
 
31
 *
 
32
 *
33
33
 * Copyright 1988  The Open Group
34
 
 * 
 
34
 *
35
35
 * Permission to use, copy, modify, distribute, and sell this software and its
36
36
 * documentation for any purpose is hereby granted without fee, provided that
37
37
 * the above copyright notice appear in all copies and that both that
38
38
 * copyright notice and this permission notice appear in supporting
39
39
 * documentation.
40
 
 * 
 
40
 *
41
41
 * The above copyright notice and this permission notice shall be included in
42
42
 * all copies or substantial portions of the Software.
43
 
 * 
 
43
 *
44
44
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
45
45
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
46
46
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
47
47
 * OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
48
48
 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
49
49
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
50
 
 * 
 
50
 *
51
51
 * Except as contained in this notice, the name of The Open Group shall not be
52
52
 * used in advertising or otherwise to promote the sale, use or other dealings
53
53
 * in this Software without prior written authorization from The Open Group.
54
 
 * 
 
54
 *
55
55
 */
56
56
/*
57
57
 * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
132
132
#include <charclass.h>
133
133
#include <xstrings.h>
134
134
 
135
 
typedef struct {
136
 
    const char *name;
137
 
    int code;
138
 
} FlagList;
139
 
 
140
135
typedef void (*BitFunc) (unsigned * /* p */ ,
141
136
                         unsigned /* mask */ );
142
137
 
218
213
 
219
214
static String _Font_Selected_ = "yes";  /* string is arbitrary */
220
215
 
221
 
static char defaultTranslations[] =
222
 
"\
223
 
          Shift <KeyPress> Prior:scroll-back(1,halfpage) \n\
224
 
           Shift <KeyPress> Next:scroll-forw(1,halfpage) \n\
225
 
         Shift <KeyPress> Select:select-cursor-start() select-cursor-end(SELECT, CUT_BUFFER0) \n\
226
 
         Shift <KeyPress> Insert:insert-selection(SELECT, CUT_BUFFER0) \n\
227
 
"
228
 
#if OPT_MAXIMIZE
229
 
"\
230
 
                 Alt <Key>Return:fullscreen() \n\
231
 
"
232
 
#endif
233
 
#if OPT_SCROLL_LOCK
234
 
"\
235
 
        <KeyRelease> Scroll_Lock:scroll-lock() \n\
236
 
"
237
 
#endif
238
 
#if OPT_SHIFT_FONTS
239
 
"\
240
 
    Shift~Ctrl <KeyPress> KP_Add:larger-vt-font() \n\
241
 
    Shift Ctrl <KeyPress> KP_Add:smaller-vt-font() \n\
242
 
    Shift <KeyPress> KP_Subtract:smaller-vt-font() \n\
243
 
"
244
 
#endif
245
 
"\
246
 
                ~Meta <KeyPress>:insert-seven-bit() \n\
247
 
                 Meta <KeyPress>:insert-eight-bit() \n\
248
 
                !Ctrl <Btn1Down>:popup-menu(mainMenu) \n\
249
 
           !Lock Ctrl <Btn1Down>:popup-menu(mainMenu) \n\
250
 
 !Lock Ctrl @Num_Lock <Btn1Down>:popup-menu(mainMenu) \n\
251
 
     ! @Num_Lock Ctrl <Btn1Down>:popup-menu(mainMenu) \n\
252
 
                ~Meta <Btn1Down>:select-start() \n\
253
 
              ~Meta <Btn1Motion>:select-extend() \n\
254
 
                !Ctrl <Btn2Down>:popup-menu(vtMenu) \n\
255
 
           !Lock Ctrl <Btn2Down>:popup-menu(vtMenu) \n\
256
 
 !Lock Ctrl @Num_Lock <Btn2Down>:popup-menu(vtMenu) \n\
257
 
     ! @Num_Lock Ctrl <Btn2Down>:popup-menu(vtMenu) \n\
258
 
          ~Ctrl ~Meta <Btn2Down>:ignore() \n\
259
 
                 Meta <Btn2Down>:clear-saved-lines() \n\
260
 
            ~Ctrl ~Meta <Btn2Up>:insert-selection(SELECT, CUT_BUFFER0) \n\
261
 
                !Ctrl <Btn3Down>:popup-menu(fontMenu) \n\
262
 
           !Lock Ctrl <Btn3Down>:popup-menu(fontMenu) \n\
263
 
 !Lock Ctrl @Num_Lock <Btn3Down>:popup-menu(fontMenu) \n\
264
 
     ! @Num_Lock Ctrl <Btn3Down>:popup-menu(fontMenu) \n\
265
 
          ~Ctrl ~Meta <Btn3Down>:start-extend() \n\
266
 
              ~Meta <Btn3Motion>:select-extend() \n\
267
 
                 Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\
268
 
            Lock Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\
269
 
  Lock @Num_Lock Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\
270
 
       @Num_Lock Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\
271
 
                      <Btn4Down>:scroll-back(5,line,m)     \n\
272
 
                 Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\
273
 
            Lock Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\
274
 
  Lock @Num_Lock Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\
275
 
       @Num_Lock Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\
276
 
                      <Btn5Down>:scroll-forw(5,line,m)     \n\
277
 
                         <BtnUp>:select-end(SELECT, CUT_BUFFER0) \n\
278
 
                       <BtnDown>:ignore() \
279
 
";                              /* PROCURA added "Meta <Btn2Down>:clear-saved-lines()" */
 
216
static const char *defaultTranslations;
280
217
/* *INDENT-OFF* */
281
218
static XtActionsRec actionsList[] = {
282
219
    { "allow-send-events",      HandleAllowSends },
421
358
#endif
422
359
#if OPT_WIDE_CHARS
423
360
    { "set-utf8-mode",          HandleUTF8Mode },
 
361
    { "set-utf8-fonts",         HandleUTF8Fonts },
424
362
    { "set-utf8-title",         HandleUTF8Title },
425
363
#endif
426
364
};
436
374
    Bres(XtNallowWindowOps, XtCAllowWindowOps, screen.allowWindowOp0, DEF_ALLOW_WINDOW),
437
375
    Bres(XtNaltIsNotMeta, XtCAltIsNotMeta, screen.alt_is_not_meta, False),
438
376
    Bres(XtNaltSendsEscape, XtCAltSendsEscape, screen.alt_sends_esc, False),
 
377
    Bres(XtNallowBoldFonts, XtCAllowBoldFonts, screen.allowBoldFonts, True),
439
378
    Bres(XtNalwaysBoldMode, XtCAlwaysBoldMode, screen.always_bold_mode, False),
440
379
    Bres(XtNalwaysHighlight, XtCAlwaysHighlight, screen.always_highlight, False),
441
380
    Bres(XtNappcursorDefault, XtCAppcursorDefault, misc.appcursorDefault, False),
719
658
    Ires(XtNcombiningChars, XtCCombiningChars, screen.max_combining, 2),
720
659
    Ires(XtNmkSamplePass, XtCMkSamplePass, misc.mk_samplepass, 256),
721
660
    Ires(XtNmkSampleSize, XtCMkSampleSize, misc.mk_samplesize, 1024),
722
 
    Ires(XtNutf8, XtCUtf8, screen.utf8_mode, uDefault),
 
661
    Sres(XtNutf8, XtCUtf8, screen.utf8_mode_s, "default"),
 
662
    Sres(XtNutf8Fonts, XtCUtf8Fonts, screen.utf8_fonts_s, "default"),
723
663
    Sres(XtNwideBoldFont, XtCWideBoldFont, misc.default_font.f_wb, DEFWIDEBOLDFONT),
724
664
    Sres(XtNwideFont, XtCWideFont, misc.default_font.f_w, DEFWIDEFONT),
725
665
    Sres(XtNutf8SelectTypes, XtCUtf8SelectTypes, screen.utf8_select_types, NULL),
819
759
        NULL,                   /* accept_focus                 */
820
760
        XtVersion,              /* version                      */
821
761
        NULL,                   /* callback_offsets             */
822
 
        defaultTranslations,    /* tm_table                     */
 
762
        0,                      /* tm_table                     */
823
763
        XtInheritQueryGeometry, /* query_geometry               */
824
764
        XtInheritDisplayAccelerator,    /* display_accelerator  */
825
765
        NULL                    /* extension                    */
1342
1282
}
1343
1283
 
1344
1284
static int
 
1285
minus_if_default(int which)
 
1286
{
 
1287
    int result = (nparam > which) ? param[which] : -1;
 
1288
    if (result <= 0)
 
1289
        result = -1;
 
1290
    return result;
 
1291
}
 
1292
 
 
1293
static int
1345
1294
zero_if_default(int which)
1346
1295
{
1347
1296
    int result = (nparam > which) ? param[which] : 0;
3409
3358
                } else {
3410
3359
                    /* no memory: ignore entire write request */
3411
3360
                    fprintf(stderr, "%s: cannot allocate buffer space\n",
3412
 
                            xterm_name);
 
3361
                            ProgramName);
3413
3362
                    v_buffer = v_bufstr;        /* restore clobbered pointer */
3414
3363
                }
3415
3364
            }
3898
3847
    }
3899
3848
#else /* ! OPT_WIDE_CHARS */
3900
3849
 
3901
 
    for (offset = 0; offset < len; offset += this_col) {
 
3850
    for (offset = 0; offset < len; offset += (Cardinal) this_col) {
3902
3851
#if OPT_DEC_CHRSET
3903
3852
        LineData *ld = getLineData(screen, screen->cur_row);
3904
3853
#endif
3914
3863
            }
3915
3864
            this_col = 1;
3916
3865
        }
3917
 
        if (offset + this_col > len) {
3918
 
            this_col = len - offset;
 
3866
        if (offset + (Cardinal) this_col > len) {
 
3867
            this_col = (int) (len - offset);
3919
3868
        }
3920
3869
        next_col = screen->cur_col + this_col;
3921
3870
 
3926
3875
         * If screen->cur_col is less than next_col, we must have
3927
3876
         * hit the right margin - so set the do_wrap flag.
3928
3877
         */
3929
 
        screen->do_wrap = (screen->cur_col < next_col);
 
3878
        screen->do_wrap = (Boolean) (screen->cur_col < next_col);
3930
3879
    }
3931
3880
 
3932
3881
#endif /* OPT_WIDE_CHARS */
4951
4900
 
4952
4901
    case ewSetWinSizePixels:    /* Resize the window to given size in pixels */
4953
4902
        if (AllowWindowOps(xw, ewSetWinSizePixels)) {
4954
 
            RequestResize(xw, zero_if_default(1), zero_if_default(2), False);
 
4903
            RequestResize(xw, minus_if_default(1), minus_if_default(2), False);
4955
4904
        }
4956
4905
        break;
4957
4906
 
4978
4927
 
4979
4928
    case ewSetWinSizeChars:     /* Resize the text-area, in characters */
4980
4929
        if (AllowWindowOps(xw, ewSetWinSizeChars)) {
4981
 
            RequestResize(xw, zero_if_default(1), zero_if_default(2), True);
 
4930
            RequestResize(xw, minus_if_default(1), minus_if_default(2), True);
4982
4931
        }
4983
4932
        break;
4984
4933
 
4988
4937
            RequestMaximize(xw, zero_if_default(1));
4989
4938
        }
4990
4939
        break;
 
4940
    case ewFullscreenWin:       /* Fullscreen or restore */
 
4941
        if (AllowWindowOps(xw, ewFullscreenWin)) {
 
4942
            FullScreen(xw, zero_if_default(1));
 
4943
        }
 
4944
        break;
4991
4945
#endif
4992
4946
 
4993
4947
    case ewGetWinState: /* Report the window's state */
5452
5406
    }
5453
5407
#endif
5454
5408
    screen->is_running = True;
 
5409
#if OPT_MAXIMIZE
 
5410
    if (resource.fullscreen == esTrue || resource.fullscreen == esAlways)
 
5411
        FullScreen(term, True);
 
5412
#endif
5455
5413
    if (!setjmp(VTend))
5456
5414
        VTparse(xw);
5457
5415
    StopBlinking(screen);
5716
5674
 
5717
5675
    TRACE(("VTInitialize_locale\n"));
5718
5676
    TRACE(("... request screen.utf8_mode = %d\n", screen->utf8_mode));
 
5677
    TRACE(("... request screen.utf8_fonts = %d\n", screen->utf8_fonts));
5719
5678
 
5720
5679
    if (screen->utf8_mode < 0)
5721
5680
        screen->utf8_mode = uFalse;
5824
5783
    }
5825
5784
#endif /* OPT_LUIT_PROG */
5826
5785
 
 
5786
    if (screen->utf8_fonts == uDefault) {
 
5787
        switch (screen->utf8_mode) {
 
5788
        case uFalse:
 
5789
        case uTrue:
 
5790
            screen->utf8_fonts = screen->utf8_mode;
 
5791
            break;
 
5792
        case uDefault:
 
5793
            /* should not happen */
 
5794
            screen->utf8_fonts = uTrue;
 
5795
            break;
 
5796
        case uAlways:
 
5797
            /* use this to disable menu entry */
 
5798
            break;
 
5799
        }
 
5800
    }
 
5801
 
5827
5802
    screen->utf8_inparse = (Boolean) (screen->utf8_mode != uFalse);
5828
5803
 
5829
5804
    TRACE(("... updated screen.utf8_mode = %d\n", screen->utf8_mode));
 
5805
    TRACE(("... updated screen.utf8_fonts = %d\n", screen->utf8_fonts));
5830
5806
    TRACE(("...VTInitialize_locale done\n"));
5831
5807
}
5832
5808
#endif
5954
5930
    }
5955
5931
}
5956
5932
 
5957
 
/*
5958
 
 * Extend a (normally) boolean resource value by checking for additional values
5959
 
 * which will be mapped into true/false.
5960
 
 */
5961
 
#if OPT_RENDERFONT
5962
 
static int
5963
 
extendedBoolean(const char *value, FlagList * table, Cardinal limit)
5964
 
{
5965
 
    int result = -1;
5966
 
    long check;
5967
 
    char *next;
5968
 
    Cardinal n;
5969
 
 
5970
 
    if ((x_strcasecmp(value, "true") == 0)
5971
 
        || (x_strcasecmp(value, "yes") == 0)
5972
 
        || (x_strcasecmp(value, "on") == 0)) {
5973
 
        result = True;
5974
 
    } else if ((x_strcasecmp(value, "false") == 0)
5975
 
               || (x_strcasecmp(value, "no") == 0)
5976
 
               || (x_strcasecmp(value, "off") == 0)) {
5977
 
        result = False;
5978
 
    } else if ((check = strtol(value, &next, 0)) >= 0 && *next == '\0') {
5979
 
        if (check >= (long) limit)
5980
 
            check = True;
5981
 
        result = (int) check;
5982
 
    } else {
5983
 
        for (n = 0; n < limit; ++n) {
5984
 
            if (x_strcasecmp(value, table[n].name) == 0) {
5985
 
                result = table[n].code;
5986
 
                break;
5987
 
            }
5988
 
        }
5989
 
    }
5990
 
 
5991
 
    if (result < 0) {
5992
 
        fprintf(stderr, "Unrecognized keyword: %s\n", value);
5993
 
        result = False;
5994
 
    }
5995
 
 
5996
 
    return result;
5997
 
}
5998
 
#endif /* OPT_RENDERFONT */
5999
 
 
6000
5933
/* ARGSUSED */
6001
5934
static void
6002
5935
VTInitialize(Widget wrequest,
6048
5981
        ,DATA(SetWinSizeChars)
6049
5982
#if OPT_MAXIMIZE
6050
5983
        ,DATA(MaximizeWin)
 
5984
        ,DATA(FullscreenWin)
6051
5985
#endif
6052
5986
        ,DATA(GetWinState)
6053
5987
        ,DATA(GetWinPosition)
6076
6010
#undef DATA
6077
6011
#endif
6078
6012
 
 
6013
#if OPT_WIDE_CHARS
 
6014
#define DATA(name) { #name, u##name }
 
6015
    static FlagList tblUtf8Mode[] =
 
6016
    {
 
6017
        DATA(Always)
 
6018
        ,DATA(Default)
 
6019
    };
 
6020
#undef DATA
 
6021
#endif
 
6022
 
6079
6023
    XtermWidget request = (XtermWidget) wrequest;
6080
6024
    XtermWidget wnew = (XtermWidget) new_arg;
6081
6025
    Widget my_parent = SHELL_OF(wnew);
6159
6103
    init_Bres(screen.force_all_chars);
6160
6104
#endif
6161
6105
    init_Bres(screen.free_bold_box);
 
6106
    init_Bres(screen.allowBoldFonts);
6162
6107
 
6163
6108
    init_Bres(screen.c132);
6164
6109
    init_Bres(screen.curses);
6635
6580
#endif
6636
6581
 
6637
6582
#if OPT_WIDE_CHARS
 
6583
    /* setup data for next call */
 
6584
    request->screen.utf8_mode =
 
6585
        extendedBoolean(request->screen.utf8_mode_s, tblUtf8Mode, uLast);
 
6586
    request->screen.utf8_fonts =
 
6587
        extendedBoolean(request->screen.utf8_fonts_s, tblUtf8Mode, uLast);
 
6588
 
6638
6589
    VTInitialize_locale(request);
6639
6590
    init_Bres(screen.utf8_latin1);
6640
6591
    init_Bres(screen.utf8_title);
6648
6599
 
6649
6600
    init_Ires(screen.utf8_inparse);
6650
6601
    init_Ires(screen.utf8_mode);
 
6602
    init_Ires(screen.utf8_fonts);
6651
6603
    init_Ires(screen.max_combining);
6652
6604
 
6653
6605
    if (TScreenOf(wnew)->max_combining < 0) {
6696
6648
#endif
6697
6649
 
6698
6650
    decode_wcwidth(wnew);
 
6651
    xtermSaveVTFonts(wnew);
6699
6652
#endif /* OPT_WIDE_CHARS */
6700
6653
 
6701
6654
    init_Bres(screen.always_bold_mode);
7029
6982
            char *use_font = x_strdup(DEFFONT);
7030
6983
            fprintf(stderr,
7031
6984
                    "%s:  unable to open font \"%s\", trying \"%s\"....\n",
7032
 
                    xterm_name, myfont->f_n, use_font);
 
6985
                    ProgramName, myfont->f_n, use_font);
7033
6986
            (void) xtermLoadFont(xw,
7034
6987
                                 xtermFontName(use_font),
7035
6988
                                 False,
7041
6994
    /* really screwed if we couldn't open default font */
7042
6995
    if (!screen->fnts[fNorm].fs) {
7043
6996
        fprintf(stderr, "%s:  unable to locate a suitable font\n",
7044
 
                xterm_name);
 
6997
                ProgramName);
7045
6998
        Exit(1);
7046
6999
    }
7047
7000
#if OPT_WIDE_CHARS
7048
 
    if (TScreenOf(xw)->utf8_mode) {
 
7001
    if (screen->utf8_mode) {
7049
7002
        TRACE(("check if this is a wide font, if not try again\n"));
7050
 
        if (xtermLoadWideFonts(xw, False))
 
7003
        if (xtermLoadWideFonts(xw, False)) {
7051
7004
            SetVTFont(xw, screen->menu_font_number, True, NULL);
 
7005
            /* we will not be able to switch to ISO-8859-1 */
 
7006
            if (!screen->mergedVTFonts) {
 
7007
                screen->utf8_fonts = uAlways;
 
7008
                update_font_utf8_fonts();
 
7009
            }
 
7010
        }
7052
7011
    }
7053
7012
#endif
7054
7013
 
7184
7143
    values->bit_gravity = (GravityIsNorthWest(xw)
7185
7144
                           ? NorthWestGravity
7186
7145
                           : ForgetGravity);
7187
 
    TScreenOf(xw)->fullVwin.window = XtWindow(xw) =
 
7146
    screen->fullVwin.window = XtWindow(xw) =
7188
7147
        XCreateWindow(XtDisplay(xw), XtWindow(XtParent(xw)),
7189
7148
                      xw->core.x, xw->core.y,
7190
7149
                      xw->core.width, xw->core.height, BorderWidth(xw),
7289
7248
#if OPT_I18N_SUPPORT && OPT_INPUT_METHOD
7290
7249
    VTInitI18N(xw);
7291
7250
#else
7292
 
    TScreenOf(xw)->xic = NULL;
 
7251
    screen->xic = NULL;
7293
7252
#endif
7294
7253
#if OPT_NUM_LOCK
7295
7254
    VTInitModifiers(xw);
7347
7306
        screen->fullVwin.sb_info.width = 0;
7348
7307
        ScrollBarOn(xw, False);
7349
7308
    }
 
7309
 
7350
7310
    return;
7351
7311
}
7352
7312
 
7626
7586
 
7627
7587
static void
7628
7588
set_cursor_outline_gc(XtermWidget xw,
7629
 
                      Boolean filled,
 
7589
                      Bool filled,
7630
7590
                      Pixel fg,
7631
7591
                      Pixel bg,
7632
7592
                      Pixel cc)
8829
8789
    return changed;
8830
8790
}
8831
8791
 
 
8792
/*
 
8793
 * Build up the default translations string, allowing the user to suppress
 
8794
 * some of the features.
 
8795
 */
 
8796
void
 
8797
VTInitTranslations(void)
 
8798
{
 
8799
    /* *INDENT-OFF* */
 
8800
    static struct {
 
8801
        Boolean wanted;
 
8802
        const char *name;
 
8803
        const char *value;
 
8804
    } table[] = {
 
8805
        {
 
8806
            False,
 
8807
            "default",
 
8808
"\
 
8809
          Shift <KeyPress> Prior:scroll-back(1,halfpage) \n\
 
8810
           Shift <KeyPress> Next:scroll-forw(1,halfpage) \n\
 
8811
         Shift <KeyPress> Select:select-cursor-start() select-cursor-end(SELECT, CUT_BUFFER0) \n\
 
8812
         Shift <KeyPress> Insert:insert-selection(SELECT, CUT_BUFFER0) \n\
 
8813
"
 
8814
        },
 
8815
#if OPT_MAXIMIZE
 
8816
        {
 
8817
            False,
 
8818
            "fullscreen",
 
8819
"\
 
8820
                 Alt <Key>Return:fullscreen() \n\
 
8821
"
 
8822
        },
 
8823
#endif
 
8824
#if OPT_SCROLL_LOCK
 
8825
        {
 
8826
            False,
 
8827
            "scroll-lock",
 
8828
"\
 
8829
        <KeyRelease> Scroll_Lock:scroll-lock() \n\
 
8830
"
 
8831
        },
 
8832
#endif
 
8833
#if OPT_SHIFT_FONTS
 
8834
        {
 
8835
            False,
 
8836
            "shift-fonts",
 
8837
"\
 
8838
    Shift~Ctrl <KeyPress> KP_Add:larger-vt-font() \n\
 
8839
    Shift Ctrl <KeyPress> KP_Add:smaller-vt-font() \n\
 
8840
    Shift <KeyPress> KP_Subtract:smaller-vt-font() \n\
 
8841
"
 
8842
        },
 
8843
#endif
 
8844
        /* PROCURA added "Meta <Btn2Down>:clear-saved-lines()" */
 
8845
        {
 
8846
            False,
 
8847
            "default",
 
8848
"\
 
8849
                ~Meta <KeyPress>:insert-seven-bit() \n\
 
8850
                 Meta <KeyPress>:insert-eight-bit() \n\
 
8851
                !Ctrl <Btn1Down>:popup-menu(mainMenu) \n\
 
8852
           !Lock Ctrl <Btn1Down>:popup-menu(mainMenu) \n\
 
8853
 !Lock Ctrl @Num_Lock <Btn1Down>:popup-menu(mainMenu) \n\
 
8854
     ! @Num_Lock Ctrl <Btn1Down>:popup-menu(mainMenu) \n\
 
8855
                ~Meta <Btn1Down>:select-start() \n\
 
8856
              ~Meta <Btn1Motion>:select-extend() \n\
 
8857
                !Ctrl <Btn2Down>:popup-menu(vtMenu) \n\
 
8858
           !Lock Ctrl <Btn2Down>:popup-menu(vtMenu) \n\
 
8859
 !Lock Ctrl @Num_Lock <Btn2Down>:popup-menu(vtMenu) \n\
 
8860
     ! @Num_Lock Ctrl <Btn2Down>:popup-menu(vtMenu) \n\
 
8861
          ~Ctrl ~Meta <Btn2Down>:ignore() \n\
 
8862
                 Meta <Btn2Down>:clear-saved-lines() \n\
 
8863
            ~Ctrl ~Meta <Btn2Up>:insert-selection(SELECT, CUT_BUFFER0) \n\
 
8864
                !Ctrl <Btn3Down>:popup-menu(fontMenu) \n\
 
8865
           !Lock Ctrl <Btn3Down>:popup-menu(fontMenu) \n\
 
8866
 !Lock Ctrl @Num_Lock <Btn3Down>:popup-menu(fontMenu) \n\
 
8867
     ! @Num_Lock Ctrl <Btn3Down>:popup-menu(fontMenu) \n\
 
8868
          ~Ctrl ~Meta <Btn3Down>:start-extend() \n\
 
8869
              ~Meta <Btn3Motion>:select-extend() \n\
 
8870
"
 
8871
        },
 
8872
        {
 
8873
            False,
 
8874
            "wheel-mouse",
 
8875
"\
 
8876
                 Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\
 
8877
            Lock Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\
 
8878
  Lock @Num_Lock Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\
 
8879
       @Num_Lock Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\
 
8880
                      <Btn4Down>:scroll-back(5,line,m)     \n\
 
8881
                 Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\
 
8882
            Lock Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\
 
8883
  Lock @Num_Lock Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\
 
8884
       @Num_Lock Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\
 
8885
                      <Btn5Down>:scroll-forw(5,line,m)     \n\
 
8886
"
 
8887
        },
 
8888
        {
 
8889
            False,
 
8890
            "default",
 
8891
"\
 
8892
                         <BtnUp>:select-end(SELECT, CUT_BUFFER0) \n\
 
8893
                       <BtnDown>:ignore() \
 
8894
"
 
8895
        }
 
8896
    };
 
8897
    /* *INDENT-ON* */
 
8898
 
 
8899
    size_t needed = 0;
 
8900
    char *result = 0;
 
8901
 
 
8902
    int pass;
 
8903
    Cardinal item;
 
8904
 
 
8905
    TRACE(("VTInitTranslations\n"));
 
8906
    for (item = 0; item < XtNumber(table); ++item) {
 
8907
        table[item].wanted = True;
 
8908
    }
 
8909
#if OPT_MAXIMIZE
 
8910
    /*
 
8911
     * As a special case, allow for disabling the alt-enter translation if
 
8912
     * the resource settings prevent fullscreen from being used.  We would
 
8913
     * do the same for scroll-lock and shift-fonts if they were application
 
8914
     * resources too, rather than in the widget.
 
8915
     */
 
8916
    if (resource.fullscreen == esNever) {
 
8917
        for (item = 0; item < XtNumber(table); ++item) {
 
8918
            if (!strcmp(table[item].name, "fullscreen")) {
 
8919
                table[item].wanted = False;
 
8920
                TRACE(("omit(%s):\n%s\n", table[item].name, table[item].value));
 
8921
            }
 
8922
        }
 
8923
    }
 
8924
#endif
 
8925
    if (!IsEmpty(resource.omitTranslation)) {
 
8926
        char *value;
 
8927
        const char *source = resource.omitTranslation;
 
8928
 
 
8929
        while (*source != '\0' && (value = ParseList(&source)) != 0) {
 
8930
            size_t len = strlen(value);
 
8931
 
 
8932
            TRACE(("parsed:%s\n", value));
 
8933
            for (item = 0; item < XtNumber(table); ++item) {
 
8934
                if (strlen(table[item].name) >= len
 
8935
                    && x_strncasecmp(table[item].name,
 
8936
                                     value,
 
8937
                                     (unsigned) len) == 0) {
 
8938
                    table[item].wanted = False;
 
8939
                    TRACE(("omit(%s):\n%s\n", table[item].name, table[item].value));
 
8940
                    break;
 
8941
                }
 
8942
            }
 
8943
            free(value);
 
8944
        }
 
8945
    }
 
8946
 
 
8947
    for (pass = 0; pass < 2; ++pass) {
 
8948
        needed = 0;
 
8949
        for (item = 0; item < XtNumber(table); ++item) {
 
8950
            if (table[item].wanted) {
 
8951
                if (pass) {
 
8952
                    strcat(result, table[item].value);
 
8953
                } else {
 
8954
                    needed += strlen(table[item].value) + 1;
 
8955
                }
 
8956
            }
 
8957
        }
 
8958
        if (!pass) {
 
8959
            result = XtMalloc((Cardinal) needed);
 
8960
            *result = '\0';
 
8961
        }
 
8962
    }
 
8963
 
 
8964
    TRACE(("result:\n%s\n", result));
 
8965
 
 
8966
    defaultTranslations = result;
 
8967
    xtermClassRec.core_class.tm_table = result;
 
8968
}
 
8969
 
8832
8970
#ifdef NO_LEAKS
8833
8971
void
8834
8972
noleaks_charproc(void)