diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/xterm/MANIFEST | 2 | ||||
-rw-r--r-- | app/xterm/Tekproc.c | 22 | ||||
-rw-r--r-- | app/xterm/button.c | 294 | ||||
-rw-r--r-- | app/xterm/charproc.c | 134 | ||||
-rw-r--r-- | app/xterm/fontutils.c | 60 | ||||
-rw-r--r-- | app/xterm/fontutils.h | 4 | ||||
-rw-r--r-- | app/xterm/misc.c | 67 | ||||
-rw-r--r-- | app/xterm/ptyx.h | 17 | ||||
-rw-r--r-- | app/xterm/screen.c | 36 | ||||
-rw-r--r-- | app/xterm/trace.h | 47 | ||||
-rw-r--r-- | app/xterm/util.c | 14 | ||||
-rw-r--r-- | app/xterm/version.h | 4 | ||||
-rw-r--r-- | app/xterm/vms.c | 5 | ||||
-rw-r--r-- | app/xterm/vms.h | 2 | ||||
-rw-r--r-- | app/xterm/xterm.h | 11 | ||||
-rw-r--r-- | app/xterm/xterm.log.html | 54 | ||||
-rw-r--r-- | app/xterm/xterm.man | 8 | ||||
-rw-r--r-- | app/xterm/xutf8.h | 8 |
18 files changed, 538 insertions, 251 deletions
diff --git a/app/xterm/MANIFEST b/app/xterm/MANIFEST index 5667149bf..5f049085c 100644 --- a/app/xterm/MANIFEST +++ b/app/xterm/MANIFEST @@ -1,4 +1,4 @@ -MANIFEST for xterm-262, version xterm-262 +MANIFEST for xterm-264, version xterm-264 -------------------------------------------------------------------------------- MANIFEST this file 256colres.h resource-definitions for 256-color mode diff --git a/app/xterm/Tekproc.c b/app/xterm/Tekproc.c index ebfb03c58..1d9b9c01b 100644 --- a/app/xterm/Tekproc.c +++ b/app/xterm/Tekproc.c @@ -1,4 +1,4 @@ -/* $XTermId: Tekproc.c,v 1.182 2010/06/20 21:34:37 tom Exp $ */ +/* $XTermId: Tekproc.c,v 1.184 2010/10/14 08:07:03 tom Exp $ */ /* * @@ -108,6 +108,7 @@ #include <data.h> #include <error.h> #include <menu.h> +#include <xstrings.h> #define DefaultGCID XGContextFromGC(DefaultGC(XtDisplay(tw), DefaultScreen(XtDisplay(tw)))) @@ -1360,15 +1361,18 @@ static unsigned char *dashes[TEKNUMLINES] = */ static void -TekInitialize(Widget request GCC_UNUSED, - Widget wnew GCC_UNUSED, +TekInitialize(Widget wrequest, + Widget new_arg, ArgList args GCC_UNUSED, Cardinal *num_args GCC_UNUSED) { + TekWidget request = (TekWidget) wrequest; + TekWidget wnew = (TekWidget) new_arg; Widget tekparent = SHELL_OF(wnew); #ifndef NO_ACTIVE_ICON TekScreen *screen = TekScreenOf((TekWidget) wnew); #endif + int n; TRACE(("TekInitialize\n")); @@ -1381,13 +1385,23 @@ TekInitialize(Widget request GCC_UNUSED, HandleLeaveWindow, (Opaque) 0); XtAddEventHandler(tekparent, FocusChangeMask, False, HandleFocusChange, (Opaque) 0); - XtAddEventHandler(wnew, PropertyChangeMask, False, + XtAddEventHandler(new_arg, PropertyChangeMask, False, HandleBellPropertyChange, (Opaque) 0); #ifndef NO_ACTIVE_ICON screen->whichTwin = &(screen->fullTwin); #endif /* NO_ACTIVE_ICON */ + for (n = 0; n < TEKNUMFONTS; ++n) { + wnew->tek.Tfont[n] = request->tek.Tfont[n]; + } + + init_Sres(tek.initial_font); + init_Sres(tek.gin_terminator_str); +#if OPT_TOOLBAR + init_Ires(tek.tb_info.menu_height); + wnew->tek.tb_info.menu_bar = request->tek.tb_info.menu_bar; +#endif } static void diff --git a/app/xterm/button.c b/app/xterm/button.c index 8d476d094..abaa880b0 100644 --- a/app/xterm/button.c +++ b/app/xterm/button.c @@ -1,4 +1,4 @@ -/* $XTermId: button.c,v 1.381 2010/08/23 23:25:57 tom Exp $ */ +/* $XTermId: button.c,v 1.389 2010/10/13 09:37:08 tom Exp $ */ /* * Copyright 1999-2009,2010 by Thomas E. Dickey @@ -115,7 +115,10 @@ button.c Handles button events in the terminal emulator. #define AllModifiers (ShiftMask | LockMask | ControlMask | Mod1Mask | \ Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask) -#define KeyModifiers (event->xbutton.state & OurModifiers) +#define BtnModifiers(event) (event->state & OurModifiers) +#define KeyModifiers(event) (event->xbutton.state & OurModifiers) + +#define IsBtnEvent(event) ((event)->type == ButtonPress || (event)->type == ButtonRelease) #define KeyState(x) (((int) ((x) & (ShiftMask|ControlMask))) \ + (((x) & Mod1Mask) ? 2 : 0)) @@ -130,8 +133,8 @@ static const CELL zeroCELL = {0, 0}; #if OPT_DEC_LOCATOR -static Bool SendLocatorPosition(XtermWidget xw, XEvent * event); -static void CheckLocatorPosition(XtermWidget xw, XEvent * event); +static Bool SendLocatorPosition(XtermWidget xw, XButtonEvent * event); +static void CheckLocatorPosition(XtermWidget xw, XButtonEvent * event); #endif /* OPT_DEC_LOCATOR */ /* Multi-click handling */ @@ -202,65 +205,75 @@ Bool SendMousePosition(XtermWidget xw, XEvent * event) { TScreen *screen = TScreenOf(xw); + XButtonEvent *my_event = (XButtonEvent *) event; + Bool result = False; - /* If send_mouse_pos mode isn't on, we shouldn't be here */ - if (screen->send_mouse_pos == MOUSE_OFF) + switch (screen->send_mouse_pos) { + case MOUSE_OFF: + /* If send_mouse_pos mode isn't on, we shouldn't be here */ return False; -#if OPT_DEC_LOCATOR - if (screen->send_mouse_pos == DEC_LOCATOR) { - return (SendLocatorPosition(xw, event)); - } -#endif /* OPT_DEC_LOCATOR */ + case BTN_EVENT_MOUSE: + case ANY_EVENT_MOUSE: + /* xterm extension for motion reporting. June 1998 */ + /* EditorButton() will distinguish between the modes */ + switch (event->type) { + case MotionNotify: + my_event->button = 0; + /* FALLTHRU */ + case ButtonPress: + /* FALLTHRU */ + case ButtonRelease: + EditorButton(xw, my_event); + result = True; + break; + } + break; - /* Make sure the event is an appropriate type */ - if ((screen->send_mouse_pos != BTN_EVENT_MOUSE) - && (screen->send_mouse_pos != ANY_EVENT_MOUSE) - && event->type != ButtonPress - && event->type != ButtonRelease) - return False; + default: + /* Make sure the event is an appropriate type */ + if (IsBtnEvent(event)) { - switch (screen->send_mouse_pos) { - case X10_MOUSE: /* X10 compatibility sequences */ + switch (screen->send_mouse_pos) { + case X10_MOUSE: /* X10 compatibility sequences */ - if (KeyModifiers == 0) { - if (event->type == ButtonPress) - EditorButton(xw, (XButtonEvent *) event); - return True; - } - return False; + if (BtnModifiers(my_event) == 0) { + if (my_event->type == ButtonPress) + EditorButton(xw, my_event); + result = True; + } + break; - case VT200_HIGHLIGHT_MOUSE: /* DEC vt200 hilite tracking */ - if (event->type == ButtonPress && - KeyModifiers == 0 && - event->xbutton.button == Button1) { - TrackDown(xw, (XButtonEvent *) event); - return True; - } - if (KeyModifiers == 0 || KeyModifiers == ControlMask) { - EditorButton(xw, (XButtonEvent *) event); - return True; - } - return False; + case VT200_HIGHLIGHT_MOUSE: /* DEC vt200 hilite tracking */ + if (my_event->type == ButtonPress && + BtnModifiers(my_event) == 0 && + my_event->button == Button1) { + TrackDown(xw, my_event); + result = True; + } else if (BtnModifiers(my_event) == 0 + || BtnModifiers(my_event) == ControlMask) { + EditorButton(xw, my_event); + result = True; + } + break; - case VT200_MOUSE: /* DEC vt200 compatible */ + case VT200_MOUSE: /* DEC vt200 compatible */ + if (BtnModifiers(my_event) == 0 + || BtnModifiers(my_event) == ControlMask) { + EditorButton(xw, my_event); + result = True; + } + break; - /* xterm extension for motion reporting. June 1998 */ - /* EditorButton() will distinguish between the modes */ - case BTN_EVENT_MOUSE: - case ANY_EVENT_MOUSE: - if (KeyModifiers == 0 || KeyModifiers == ControlMask) { - if (event->type == MotionNotify) { - ((XButtonEvent *) event)->button = 0; +#if OPT_DEC_LOCATOR + case DEC_LOCATOR: + result = SendLocatorPosition(xw, my_event); + break; +#endif /* OPT_DEC_LOCATOR */ } - EditorButton(xw, (XButtonEvent *) event); - return True; } - return False; - - default: - return False; } + return result; } #if OPT_DEC_LOCATOR @@ -291,7 +304,7 @@ SendMousePosition(XtermWidget xw, XEvent * event) } static Bool -SendLocatorPosition(XtermWidget xw, XEvent * event) +SendLocatorPosition(XtermWidget xw, XButtonEvent * event) { ANSI reply; TScreen *screen = TScreenOf(xw); @@ -301,10 +314,10 @@ SendLocatorPosition(XtermWidget xw, XEvent * event) unsigned state; /* Make sure the event is an appropriate type */ - if ((event->type != ButtonPress && - event->type != ButtonRelease && + if ((!IsBtnEvent(event) && + !screen->loc_filter) || - (KeyModifiers != 0 && KeyModifiers != ControlMask)) + (BtnModifiers(event) != 0 && BtnModifiers(event) != ControlMask)) return (False); if ((event->type == ButtonPress && @@ -319,9 +332,9 @@ SendLocatorPosition(XtermWidget xw, XEvent * event) } /* get button # */ - button = (int) event->xbutton.button - 1; + button = (int) event->button - 1; - LocatorCoords(row, col, event->xbutton.x, event->xbutton.y, oor); + LocatorCoords(row, col, event->x, event->y, oor); /* * DECterm mouse: @@ -377,7 +390,7 @@ SendLocatorPosition(XtermWidget xw, XEvent * event) * Also, mask should be the state after the button press/release, * X provides the state not including the button press/release. */ - state = (event->xbutton.state + state = (event->state & (Button1Mask | Button2Mask | Button3Mask | Button4Mask)) >> 8; /* update mask to "after" state */ state ^= ((unsigned) (1 << button)); @@ -613,7 +626,7 @@ InitLocatorFilter(XtermWidget xw) } static void -CheckLocatorPosition(XtermWidget xw, XEvent * event) +CheckLocatorPosition(XtermWidget xw, XButtonEvent * event) { ANSI reply; TScreen *screen = TScreenOf(xw); @@ -621,7 +634,7 @@ CheckLocatorPosition(XtermWidget xw, XEvent * event) Bool oor; int state; - LocatorCoords(row, col, event->xbutton.x, event->xbutton.y, oor); + LocatorCoords(row, col, event->x, event->y, oor); /* * Send report if the pointer left the filter rectangle, if @@ -643,7 +656,7 @@ CheckLocatorPosition(XtermWidget xw, XEvent * event) reply.a_nparam = 1; reply.a_param[0] = 0; /* Event - 0 = locator unavailable */ } else { - ButtonState(state, event->xbutton.state); + ButtonState(state, event->state); reply.a_nparam = 4; reply.a_param[0] = 10; /* Event - 10 = locator outside filter */ @@ -666,13 +679,13 @@ CheckLocatorPosition(XtermWidget xw, XEvent * event) #if OPT_READLINE static int -isClick1_clean(TScreen * screen, XEvent * event) +isClick1_clean(TScreen * screen, XButtonEvent * event) { int delta; - if (!(event->type == ButtonPress || event->type == ButtonRelease) + if (!IsBtnEvent(event) /* Disable on Shift-Click-1, including the application-mouse modes */ - || (KeyModifiers & ShiftMask) + || (BtnModifiers(event) & ShiftMask) || (screen->send_mouse_pos != MOUSE_OFF) /* Kinda duplicate... */ ||ExtendingSelection) /* Was moved */ return 0; @@ -683,25 +696,25 @@ isClick1_clean(TScreen * screen, XEvent * event) if (lastButtonDownTime == (Time) 0) { /* first time or once in a blue moon */ delta = screen->multiClickTime + 1; - } else if (event->xbutton.time > lastButtonDownTime) { + } else if (event->time > lastButtonDownTime) { /* most of the time */ - delta = (int) (event->xbutton.time - lastButtonDownTime); + delta = (int) (event->time - lastButtonDownTime); } else { /* time has rolled over since lastButtonUpTime */ - delta = (int) ((((Time) ~ 0) - lastButtonDownTime) + event->xbutton.time); + delta = (int) ((((Time) ~ 0) - lastButtonDownTime) + event->time); } return delta <= screen->multiClickTime; } static int -isDoubleClick3(TScreen * screen, XEvent * event) +isDoubleClick3(TScreen * screen, XButtonEvent * event) { int delta; if (event->type != ButtonRelease - || (KeyModifiers & ShiftMask) - || event->xbutton.button != Button3) { + || (BtnModifiers(event) & ShiftMask) + || event->button != Button3) { lastButton3UpTime = 0; /* Disable the cached info */ return 0; } @@ -709,27 +722,27 @@ isDoubleClick3(TScreen * screen, XEvent * event) if (lastButton3DoubleDownTime == (Time) 0) { /* No previous click or once in a blue moon */ delta = screen->multiClickTime + 1; - } else if (event->xbutton.time > lastButton3DoubleDownTime) { + } else if (event->time > lastButton3DoubleDownTime) { /* most of the time */ - delta = (int) (event->xbutton.time - lastButton3DoubleDownTime); + delta = (int) (event->time - lastButton3DoubleDownTime); } else { /* time has rolled over since lastButton3DoubleDownTime */ - delta = (int) ((((Time) ~ 0) - lastButton3DoubleDownTime) + event->xbutton.time); + delta = (int) ((((Time) ~ 0) - lastButton3DoubleDownTime) + event->time); } if (delta <= screen->multiClickTime) { /* Double click */ CELL cell; /* Cannot check ExtendingSelection, since mouse-3 always sets it */ - PointToCELL(screen, event->xbutton.y, event->xbutton.x, &cell); + PointToCELL(screen, event->y, event->x, &cell); if (isSameCELL(&cell, &lastButton3)) { lastButton3DoubleDownTime = 0; /* Disable the third click */ return 1; } } /* Not a double click, memorize for future check. */ - lastButton3UpTime = event->xbutton.time; - PointToCELL(screen, event->xbutton.y, event->xbutton.x, &lastButton3); + lastButton3UpTime = event->time; + PointToCELL(screen, event->y, event->x, &lastButton3); return 0; } @@ -739,7 +752,7 @@ CheckSecondPress3(TScreen * screen, XEvent * event) int delta; if (event->type != ButtonPress - || (KeyModifiers & ShiftMask) + || (KeyModifiers(event) & ShiftMask) || event->xbutton.button != Button3) { lastButton3DoubleDownTime = 0; /* Disable the cached info */ return 0; @@ -848,9 +861,32 @@ ReadLineDelete(TScreen * screen, CELL * cell1, CELL * cell2) if (del <= 0) /* Just in case... */ return 0; while (del--) - v_write(screen->respond, (Char *) "\177", 1); + v_write(screen->respond, (const Char *) "\177", 1); return 1; } + +static void +readlineExtend(TScreen * screen, XEvent * event) +{ + int ldelta1, ldelta2; + + if (IsBtnEvent(event)) { + XButtonEvent *my_event = (XButtonEvent *) event; + if (isClick1_clean(screen, my_event) + && SCREEN_FLAG(screen, click1_moves) + && rowOnCurrentLine(screen, eventRow(screen, event), &ldelta1)) { + ReadLineMovePoint(screen, eventColBetween(screen, event), ldelta1); + } + if (isDoubleClick3(screen, my_event) + && SCREEN_FLAG(screen, dclick3_deletes) + && rowOnCurrentLine(screen, screen->startSel.row, &ldelta1) + && rowOnCurrentLine(screen, screen->endSel.row, &ldelta2)) { + ReadLineMovePoint(screen, screen->endSel.col, ldelta2); + ReadLineDelete(screen, &screen->startSel, &(screen->endSel)); + } + } +} + #endif /* OPT_READLINE */ /* ^XM-G<line+' '><col+' '> */ @@ -867,7 +903,7 @@ DiredButton(Widget w, Char Line[6]; unsigned line, col; - if ((event->type == ButtonPress || event->type == ButtonRelease) + if (IsBtnEvent(event) && (event->xbutton.y >= screen->border) && (event->xbutton.x >= OriginX(screen))) { line = (unsigned) ((event->xbutton.y - screen->border) @@ -898,7 +934,7 @@ ReadLineButton(Widget w, Char Line[6]; int line, col, ldelta = 0; - if (!(event->type == ButtonPress || event->type == ButtonRelease) + if (!IsBtnEvent(event) || (screen->send_mouse_pos != MOUSE_OFF) || ExtendingSelection) goto finish; if (event->type == ButtonRelease) { @@ -956,7 +992,7 @@ ViButton(Widget w, Char Line[6]; int line; - if (event->type == ButtonPress || event->type == ButtonRelease) { + if (IsBtnEvent(event)) { line = screen->cur_row - ((event->xbutton.y - screen->border) / FontHeight(screen)); @@ -1036,9 +1072,6 @@ do_select_end(XtermWidget xw, Cardinal *num_params, Bool use_cursor_loc) { -#if OPT_READLINE - int ldelta1, ldelta2; -#endif TScreen *screen = TScreenOf(xw); screen->selection_time = event->xbutton.time; @@ -1050,18 +1083,7 @@ do_select_end(XtermWidget xw, case RIGHTEXTENSION: EndExtend(xw, event, params, *num_params, use_cursor_loc); #if OPT_READLINE - if (isClick1_clean(screen, event) - && SCREEN_FLAG(screen, click1_moves) - && rowOnCurrentLine(screen, eventRow(screen, event), &ldelta1)) { - ReadLineMovePoint(screen, eventColBetween(screen, event), ldelta1); - } - if (isDoubleClick3(screen, event) - && SCREEN_FLAG(screen, dclick3_deletes) - && rowOnCurrentLine(screen, screen->startSel.row, &ldelta1) - && rowOnCurrentLine(screen, screen->endSel.row, &ldelta2)) { - ReadLineMovePoint(screen, screen->endSel.col, ldelta2); - ReadLineDelete(screen, &screen->startSel, &(screen->endSel)); - } + readlineExtend(screen, event); #endif /* OPT_READLINE */ break; } @@ -1093,6 +1115,58 @@ HandleKeyboardSelectEnd(Widget w, } } +/* + * Like "select-end" (optionally copies the selection to the given targets), + * but also sets the modes so that releasing the mouse button or moving the + * mouse does not alter the selection. + */ +static void +do_select_stop(XtermWidget xw, + XEvent * event, /* must be XButtonEvent */ + String * params, /* selections */ + Cardinal *num_params, + Bool use_cursor_loc) +{ + TScreen *screen = TScreenOf(xw); + + screen->selection_time = event->xbutton.time; + switch (screen->eventMode) { + case NORMAL: + (void) SendMousePosition(xw, event); + break; + case LEFTEXTENSION: + case RIGHTEXTENSION: + EndExtend(xw, event, params, *num_params, use_cursor_loc); + break; + } +} + +void +HandleSelectStop(Widget w, + XEvent * event, /* must be XButtonEvent */ + String * params, /* selections */ + Cardinal *num_params) +{ + XtermWidget xw; + + if ((xw = getXtermWidget(w)) != 0) { + do_select_stop(xw, event, params, num_params, False); + } +} + +void +HandleKeyboardSelectStop(Widget w, + XEvent * event, /* must be XButtonEvent */ + String * params, /* selections */ + Cardinal *num_params) +{ + XtermWidget xw; + + if ((xw = getXtermWidget(w)) != 0) { + do_select_stop(xw, event, params, num_params, True); + } +} + struct _SelectionList { String *params; Cardinal count; @@ -1136,7 +1210,7 @@ UTF8toLatin1(TScreen * screen, Char * s, unsigned long len, unsigned long *resul Cardinal offset = 0; - Char *p; + const Char *p; if (len != 0) { PtyData data; @@ -1172,7 +1246,7 @@ UTF8toLatin1(TScreen * screen, Char * s, unsigned long len, unsigned long *resul * whatever the user wants). */ if (fails) { - for (p = (Char *) screen->default_string; *p != '\0'; ++p) { + for (p = (const Char *) screen->default_string; *p != '\0'; ++p) { AddChar(&buffer, &used, offset, *p); } } @@ -1292,7 +1366,7 @@ overrideTargets(Widget w, String value, Atom ** resultp) TScreen *screen = TScreenOf(xw); if (!IsEmpty(value)) { - String copied = x_strdup(value); + char *copied = x_strdup(value); if (copied != 0) { Atom *result = 0; Cardinal count = 1; @@ -1715,7 +1789,7 @@ base64_flush(TScreen * screen) } if (screen->base64_pad & 3) tty_vwrite(screen->respond, - (Char *) "===", + (const Char *) "===", (unsigned) (4 - (screen->base64_pad & 3))); screen->base64_count = 0; screen->base64_accu = 0; @@ -1772,7 +1846,7 @@ _qWriteSelectionData(TScreen * screen, Char * lag, unsigned length) #if OPT_READLINE if (SCREEN_FLAG(screen, paste_quotes)) { while (length--) { - tty_vwrite(screen->respond, (Char *) "\026", 1); /* Control-V */ + tty_vwrite(screen->respond, (const Char *) "\026", 1); /* Control-V */ tty_vwrite(screen->respond, lag++, 1); } } else @@ -1830,11 +1904,11 @@ _WriteSelectionData(TScreen * screen, Char * line, size_t length) #if OPT_READLINE static void -_WriteKey(TScreen * screen, Char * in) +_WriteKey(TScreen * screen, const Char * in) { Char line[16]; unsigned count = 0; - size_t length = strlen((char *) in); + size_t length = strlen((const char *) in); if (screen->control_eight_bits) { line[count++] = ANSI_CSI; @@ -1950,7 +2024,7 @@ SelectionReceived(Widget w, #endif #if OPT_READLINE if (SCREEN_FLAG(screen, paste_brackets)) { - _WriteKey(screen, (Char *) "200"); + _WriteKey(screen, (const Char *) "200"); } #endif for (i = 0; i < text_list_count; i++) { @@ -1964,7 +2038,7 @@ SelectionReceived(Widget w, #endif #if OPT_READLINE if (SCREEN_FLAG(screen, paste_brackets)) { - _WriteKey(screen, (Char *) "201"); + _WriteKey(screen, (const Char *) "201"); } #endif XFreeStringList(text_list); @@ -2005,9 +2079,9 @@ HandleInsertSelection(Widget w, #if OPT_READLINE int ldelta; TScreen *screen = TScreenOf(xw); - if ((event->type == ButtonPress || event->type == ButtonRelease) + if (IsBtnEvent(event) /* Disable on Shift-mouse, including the application-mouse modes */ - && !(KeyModifiers & ShiftMask) + && !(KeyModifiers(event) & ShiftMask) && (screen->send_mouse_pos == MOUSE_OFF) && SCREEN_FLAG(screen, paste_moves) && rowOnCurrentLine(screen, eventRow(screen, event), &ldelta)) @@ -2131,7 +2205,7 @@ TrackDown(XtermWidget xw, XButtonEvent * event) StartSelect(xw, &cell); } else { screen->waitingForTrackInfo = True; - EditorButton(xw, (XButtonEvent *) event); + EditorButton(xw, event); } } @@ -2295,7 +2369,7 @@ do_start_extend(XtermWidget xw, screen->firstValidRow = 0; screen->lastValidRow = screen->max_row; #if OPT_READLINE - if ((KeyModifiers & ShiftMask) + if ((KeyModifiers(event) & ShiftMask) || event->xbutton.button != Button3 || !(SCREEN_FLAG(screen, dclick3_deletes))) #endif @@ -2311,7 +2385,7 @@ do_start_extend(XtermWidget xw, if (screen->numberOfClicks == 1 || (SCREEN_FLAG(screen, dclick3_deletes) /* Dclick special */ - &&!(KeyModifiers & ShiftMask))) { + &&!(KeyModifiers(event) & ShiftMask))) { /* Save existing selection so we can reestablish it if the guy extends past the other end of the selection */ screen->saveStartR = screen->startExt = screen->startRaw; diff --git a/app/xterm/charproc.c b/app/xterm/charproc.c index c28eaa478..fd8b57573 100644 --- a/app/xterm/charproc.c +++ b/app/xterm/charproc.c @@ -1,4 +1,4 @@ -/* $XTermId: charproc.c,v 1.1076 2010/08/29 22:51:09 tom Exp $ */ +/* $XTermId: charproc.c,v 1.1086 2010/10/13 23:04:01 tom Exp $ */ /* @@ -300,10 +300,16 @@ static XtActionsRec actionsList[] = { { "select-cursor-end", HandleKeyboardSelectEnd }, { "select-cursor-extend", HandleKeyboardSelectExtend }, { "select-cursor-start", HandleKeyboardSelectStart }, +#if 0 + { "select-cursor-stop", HandleKeyboardSelectStop }, +#endif { "select-end", HandleSelectEnd }, { "select-extend", HandleSelectExtend }, { "select-set", HandleSelectSet }, { "select-start", HandleSelectStart }, +#if 0 + { "select-stop", HandleSelectStop }, +#endif { "send-signal", HandleSendSignal }, { "set-8-bit-control", Handle8BitControl }, { "set-allow132", HandleAllow132 }, @@ -453,6 +459,7 @@ static XtResource xterm_resources[] = Bres(XtNeightBitOutput, XtCEightBitOutput, screen.output_eight_bits, True), Bres(XtNhighlightSelection, XtCHighlightSelection, screen.highlight_selection, False), + Bres(XtNshowWrapMarks, XtCShowWrapMarks, screen.show_wrap_marks, False), Bres(XtNhpLowerleftBugCompat, XtCHpLowerleftBugCompat, screen.hp_ll_bc, False), Bres(XtNi18nSelections, XtCI18nSelections, screen.i18nSelections, True), Bres(XtNfastScroll, XtCFastScroll, screen.fastscroll, False), @@ -550,7 +557,7 @@ static XtResource xterm_resources[] = #ifndef NO_ACTIVE_ICON Bres("activeIcon", "ActiveIcon", misc.active_icon, False), Ires("iconBorderWidth", XtCBorderWidth, misc.icon_border_width, 2), - Fres("iconFont", "IconFont", screen.fnt_icon.fs, XtDefaultFont), + Sres("iconFont", "IconFont", screen.icon_fontname, "nil2"), Cres("iconBorderColor", XtCBorderColor, misc.icon_border_pixel, XtDefaultBackground), #endif /* NO_ACTIVE_ICON */ @@ -3322,7 +3329,7 @@ static Char *v_bufend; /* end of physical buffer */ or generated by us in response to a query ESC sequence. */ void -v_write(int f, Char * data, unsigned len) +v_write(int f, const Char * data, unsigned len) { int riten; @@ -3338,19 +3345,19 @@ v_write(int f, Char * data, unsigned len) fprintf(stderr, "v_write called with %d bytes (%d left over)", len, v_bufptr - v_bufstr); if (len > 1 && len < 10) - fprintf(stderr, " \"%.*s\"", len, (char *) data); + fprintf(stderr, " \"%.*s\"", len, (const char *) data); fprintf(stderr, "\n"); } #endif #ifdef VMS if ((1 << f) != pty_mask) { - tt_write((char *) data, len); + tt_write((const char *) data, len); return; } #else /* VMS */ if (!FD_ISSET(f, &pty_mask)) { - IGNORE_RC(write(f, (char *) data, (size_t) len)); + IGNORE_RC(write(f, (const char *) data, (size_t) len)); return; } #endif /* VMS */ @@ -3780,6 +3787,9 @@ WrapLine(XtermWidget xw) if (ld != 0) { /* mark that we had to wrap this line */ LineSetFlag(ld, LINEWRAPPED); + if (screen->show_wrap_marks) { + ShowWrapMarks(xw, screen->cur_row, ld); + } xtermAutoPrint(xw, '\n'); xtermIndex(xw, 1); set_cur_col(screen, 0); @@ -5647,42 +5657,6 @@ VTClassInit(void) (XtConvertArgList) NULL, (Cardinal) 0); } -/* - * The whole wnew->screen struct is zeroed in VTInitialize. Use these macros - * where applicable for copying the pieces from the request widget into the - * new widget. We do not have to use them for wnew->misc, but the associated - * traces are very useful for debugging. - */ -#if OPT_TRACE -#define init_Bres(name) \ - TRACE(("init " #name " = %s\n", \ - BtoS(wnew->name = request->name))) -#define init_Dres2(name,i) \ - TRACE(("init " #name "[%d] = %f\n", i, \ - wnew->name[i] = request->name[i])) -#define init_Ires(name) \ - TRACE(("init " #name " = %d\n", \ - wnew->name = request->name)) -#define init_Sres(name) \ - TRACE(("init " #name " = \"%s\"\n", \ - (wnew->name = x_strtrim(request->name)) != NULL \ - ? wnew->name : "<null>")) -#define init_Sres2(name,i) \ - TRACE(("init " #name "[%d] = \"%s\"\n", i, \ - (wnew->name(i) = x_strtrim(request->name(i))) != NULL \ - ? wnew->name(i) : "<null>")) -#define init_Tres(offset) \ - TRACE(("init screen.Tcolors[" #offset "] = %#lx\n", \ - fill_Tres(wnew, request, offset))) -#else -#define init_Bres(name) wnew->name = request->name -#define init_Dres2(name,i) wnew->name[i] = request->name[i] -#define init_Ires(name) wnew->name = request->name -#define init_Sres(name) wnew->name = x_strtrim(request->name) -#define init_Sres2(name,i) wnew->name(i) = x_strtrim(request->name(i)) -#define init_Tres(offset) fill_Tres(wnew, request, offset) -#endif - #if OPT_COLOR_RES /* * Override the use of XtDefaultForeground/XtDefaultBackground to make some @@ -6101,7 +6075,7 @@ VTInitialize(Widget wrequest, XtermWidget wnew = (XtermWidget) new_arg; Widget my_parent = SHELL_OF(wnew); int i; - char *s; + const char *s; #if OPT_ISO_COLORS Bool color_ok; @@ -6209,6 +6183,8 @@ VTInitialize(Widget wrequest, ? keyboardIsLegacy : keyboardIsDefault; #ifdef ALLOWLOGGING + init_Bres(misc.logInhibit); + init_Bres(misc.log_on); init_Sres(screen.logfile); #endif init_Bres(screen.bellIsUrgent); @@ -6222,6 +6198,13 @@ VTInitialize(Widget wrequest, init_Bres(screen.scrollttyoutput); init_Bres(screen.scrollkey); + init_Bres(misc.autoWrap); + init_Bres(misc.login_shell); + init_Bres(misc.reverseWrap); + init_Bres(misc.scrollbar); + init_Sres(misc.geo_metry); + init_Sres(misc.T_geometry); + init_Sres(screen.term_id); for (s = TScreenOf(request)->term_id; *s; s++) { if (!isalpha(CharOf(*s))) @@ -6253,6 +6236,14 @@ VTInitialize(Widget wrequest, wnew->misc.other_mods = 0; #endif +#if OPT_INPUT_METHOD + init_Bres(misc.open_im); + init_Ires(misc.retry_im); + init_Sres(misc.f_x); + init_Sres(misc.input_method); + init_Sres(misc.preedit_type); +#endif + #if OPT_SHIFT_FONTS init_Bres(misc.shift_fonts); #endif @@ -6279,6 +6270,7 @@ VTInitialize(Widget wrequest, init_Bres(screen.cutNewline); init_Bres(screen.cutToBeginningOfLine); init_Bres(screen.highlight_selection); + init_Bres(screen.show_wrap_marks); init_Bres(screen.i18nSelections); init_Bres(screen.keepSelection); init_Bres(screen.selectToClipboard); @@ -6369,11 +6361,18 @@ VTInitialize(Widget wrequest, init_Bres(screen.quiet_grab); #ifndef NO_ACTIVE_ICON - TScreenOf(wnew)->fnt_icon.fs = TScreenOf(request)->fnt_icon.fs; + init_Sres(screen.icon_fontname); + TScreenOf(wnew)->fnt_icon.fs = XLoadQueryFont(TScreenOf(wnew)->display, + TScreenOf(wnew)->icon_fontname); + TRACE(("iconFont '%s' %sloaded successfully\n", + TScreenOf(wnew)->icon_fontname, + TScreenOf(wnew)->fnt_icon.fs ? "" : "NOT ")); init_Bres(misc.active_icon); init_Ires(misc.icon_border_width); wnew->misc.icon_border_pixel = request->misc.icon_border_pixel; #endif /* NO_ACTIVE_ICON */ + + init_Bres(misc.signalInhibit); init_Bres(misc.titeInhibit); init_Bres(misc.tiXtraScroll); init_Bres(misc.dynamicColors); @@ -6382,9 +6381,13 @@ VTInitialize(Widget wrequest, } init_Ires(misc.fontWarnings); #define DefaultFontNames TScreenOf(wnew)->menu_font_names[fontMenu_default] + init_Sres(misc.default_font.f_n); + init_Sres(misc.default_font.f_b); DefaultFontNames[fNorm] = wnew->misc.default_font.f_n; DefaultFontNames[fBold] = wnew->misc.default_font.f_b; #if OPT_WIDE_CHARS + init_Sres(misc.default_font.f_w); + init_Sres(misc.default_font.f_wb); DefaultFontNames[fWide] = wnew->misc.default_font.f_w; DefaultFontNames[fWBold] = wnew->misc.default_font.f_wb; #endif @@ -6589,6 +6592,10 @@ VTInitialize(Widget wrequest, TScreenOf(wnew)->Tcolors[TEK_CURSOR] = TScreenOf(wnew)->Tcolors[TEXT_CURSOR]; #endif +#ifdef SCROLLBAR_RIGHT + init_Bres(misc.useRight); +#endif + #if OPT_RENDERFONT for (i = 0; i <= fontMenu_lastBuiltin; ++i) { init_Dres2(misc.face_size, i); @@ -7171,14 +7178,49 @@ VTRealize(Widget w, screen->event_mask = values->event_mask; #ifndef NO_ACTIVE_ICON + /* + * Normally, the font-number for icon fonts does not correspond with any of + * the menu-selectable fonts. If we cannot load the font given for the + * iconFont resource, try with font1 aka "Unreadable". + */ + screen->icon_fontnum = -1; + if (screen->fnt_icon.fs == 0) { + screen->fnt_icon.fs = XLoadQueryFont(screen->display, + screen->MenuFontName(fontMenu_font1)); + TRACE(("%susing font1 '%s' as iconFont\n", + (screen->fnt_icon.fs + ? "" + : "NOT "), + screen->MenuFontName(fontMenu_font1))); + } +#if OPT_RENDERFONT + /* + * If we still have no result from iconFont resource (perhaps because fonts + * are missing) but are using Xft, try to use that instead. We prefer + * bitmap fonts in any case, since scaled fonts are usually less readable, + * particularly at small sizes. + */ + if (UsingRenderFont(xw) + && screen->fnt_icon.fs == 0) { + screen->icon_fontnum = fontMenu_default; + screen->fnt_icon.fs = screen->fnts[0].fs; /* need for next-if */ + TRACE(("using TrueType font as iconFont\n")); + } +#endif if (xw->misc.active_icon && screen->fnt_icon.fs) { int iconX = 0, iconY = 0; Widget shell = SHELL_OF(xw); VTwin *win = &(screen->iconVwin); + int save_fontnum = screen->menu_font_number; - TRACE(("Initializing active-icon\n")); - XtVaGetValues(shell, XtNiconX, &iconX, XtNiconY, &iconY, (XtPointer) 0); + TRACE(("Initializing active-icon %d\n", screen->icon_fontnum)); + screen->menu_font_number = screen->icon_fontnum; + XtVaGetValues(shell, + XtNiconX, &iconX, + XtNiconY, &iconY, + (XtPointer) 0); xtermComputeFontInfo(xw, &(screen->iconVwin), screen->fnt_icon.fs, 0); + screen->menu_font_number = save_fontnum; /* since only one client is permitted to select for Button * events, we have to let the window manager get 'em... diff --git a/app/xterm/fontutils.c b/app/xterm/fontutils.c index 89e231dc6..34c64984b 100644 --- a/app/xterm/fontutils.c +++ b/app/xterm/fontutils.c @@ -1,4 +1,4 @@ -/* $XTermId: fontutils.c,v 1.344 2010/06/15 08:18:58 tom Exp $ */ +/* $XTermId: fontutils.c,v 1.350 2010/10/14 09:27:25 tom Exp $ */ /************************************************************ @@ -537,7 +537,7 @@ xtermSpecialFont(TScreen * screen, unsigned atts, unsigned chrset) * to use it). */ static Bool -same_font_name(char *pattern, char *match) +same_font_name(const char *pattern, const char *match) { Bool result = False; @@ -577,7 +577,7 @@ same_font_name(char *pattern, char *match) * offset. */ static int -got_bold_font(Display * dpy, XFontStruct * fs, char *requested) +got_bold_font(Display * dpy, XFontStruct * fs, String requested) { char actual[MAX_FONTNAME]; int got; @@ -707,7 +707,7 @@ xtermFontName(const char *normal) { static VTFontNames data; if (data.f_n) - free(data.f_n); + free((void *) data.f_n); memset(&data, 0, sizeof(data)); data.f_n = x_strdup(normal); return &data; @@ -717,7 +717,7 @@ static void cache_menu_font_name(TScreen * screen, int fontnum, int which, const char *name) { if (name != 0) { - char *last = screen->menu_font_names[fontnum][which]; + char *last = (char *) screen->menu_font_names[fontnum][which]; if (last != 0) { if (strcmp(last, name)) { free(last); @@ -745,7 +745,7 @@ xtermOpenFont(XtermWidget xw, Bool code = False; TScreen *screen = TScreenOf(xw); - if (name != 0) { + if (!IsEmpty(name)) { if ((result->fs = XLoadQueryFont(screen->display, name)) != 0) { code = True; if (EmptyFont(result->fs)) { @@ -761,7 +761,7 @@ xtermOpenFont(XtermWidget xw, #endif ) { TRACE(("OOPS: cannot load font %s\n", name)); - fprintf(stderr, "%s: cannot load font %s\n", ProgramName, name); + fprintf(stderr, "%s: cannot load font '%s'\n", ProgramName, name); #if OPT_RENDERFONT /* * Do a sanity check in case someone's mixed up xterm with @@ -774,7 +774,7 @@ xtermOpenFont(XtermWidget xw, } #endif } else { - TRACE(("xtermOpenFont: cannot load font %s\n", name)); + TRACE(("xtermOpenFont: cannot load font '%s'\n", name)); } if (force) { code = xtermOpenFont(xw, DEFFONT, result, fwAlways, True); @@ -932,7 +932,7 @@ xtermLoadFont(XtermWidget xw, myfonts.f_b = bold_font_name(fp, -1); xtermOpenFont(xw, myfonts.f_b, &fnts[fBold], fwAlways, False); } - TRACE(("...derived bold %s\n", NonNull(myfonts.f_b))); + TRACE(("...derived bold '%s'\n", NonNull(myfonts.f_b))); } if (fp == 0 || fnts[fBold].fs == 0) { xtermCopyFontInfo(&fnts[fBold], &fnts[fNorm]); @@ -949,7 +949,7 @@ xtermLoadFont(XtermWidget xw, } else if (!xtermOpenFont(xw, myfonts.f_b, &fnts[fBold], warn[fBold], False)) { xtermCopyFontInfo(&fnts[fBold], &fnts[fNorm]); warn[fBold] = fwAlways; - TRACE(("...cannot load bold font %s\n", NonNull(myfonts.f_b))); + TRACE(("...cannot load bold font '%s'\n", NonNull(myfonts.f_b))); } else { cache_menu_font_name(screen, fontnum, fBold, myfonts.f_b); } @@ -1234,7 +1234,7 @@ xtermLoadFont(XtermWidget xw, */ typedef struct { VTFontNames default_font; - char *menu_font_names[fontMenu_lastBuiltin + 1][fMAX]; + String menu_font_names[fontMenu_lastBuiltin + 1][fMAX]; } SubResourceRec; #define MERGE_SUBFONT(src,dst,name) \ @@ -1421,13 +1421,16 @@ HandleLoadVTFonts(Widget w, if ((xw = getXtermWidget(w)) != 0) { TScreen *screen = TScreenOf(xw); - char buf[80]; - char *myName = (char *) ((*param_count > 0) ? params[0] : empty); - char *convert = (char *) ((*param_count > 1) ? params[1] : myName); - char *myClass = (char *) MyStackAlloc(strlen(convert), buf); + char name_buf[80]; + char class_buf[80]; + String name = (String) ((*param_count > 0) ? params[0] : empty); + char *myName = (char *) MyStackAlloc(strlen(name), name_buf); + String convert = (String) ((*param_count > 1) ? params[1] : myName); + char *myClass = (char *) MyStackAlloc(strlen(convert), class_buf); int n; TRACE(("HandleLoadVTFonts(%d)\n", *param_count)); + strcpy(myName, name); strcpy(myClass, convert); if (*param_count == 1) myClass[0] = x_toupper(myClass[0]); @@ -1449,7 +1452,8 @@ HandleLoadVTFonts(Widget w, : NULL)); } - MyStackFree(myClass, buf); + MyStackFree(myName, name_buf); + MyStackFree(myClass, class_buf); } } #endif /* OPT_LOAD_VTFONTS */ @@ -1743,15 +1747,15 @@ xtermCloseXft(TScreen * screen, XTermXftFonts * pub) * Get the faceName/faceDoublesize resource setting. Strip off "xft:", which * is not recognized by XftParseName(). */ -char * +String getFaceName(XtermWidget xw, Bool wideName GCC_UNUSED) { #if OPT_RENDERWIDE - char *result = (wideName - ? xw->misc.face_wide_name - : xw->misc.face_name); + String result = (wideName + ? xw->misc.face_wide_name + : xw->misc.face_name); #else - char *result = xw->misc.face_name; + String result = xw->misc.face_name; #endif if (!IsEmpty(result) && !strncmp(result, "xft:", (size_t) 4)) result += 4; @@ -1795,6 +1799,9 @@ xtermComputeFontInfo(XtermWidget xw, TScreen *screen = TScreenOf(xw); int i, j, width, height; +#if OPT_RENDERFONT + int fontnum = screen->menu_font_number; +#endif #if OPT_RENDERFONT /* @@ -1804,9 +1811,8 @@ xtermComputeFontInfo(XtermWidget xw, * font-loading for fixed-fonts still goes on whether or not this chunk * overrides it. */ - if (UsingRenderFont(xw)) { - char *face_name = getFaceName(xw, False); - int fontnum = screen->menu_font_number; + if (UsingRenderFont(xw) && fontnum >= 0) { + String face_name = getFaceName(xw, False); XftFont *norm = screen->renderFontNorm[fontnum].font; XftFont *bold = screen->renderFontBold[fontnum].font; XftFont *ital = screen->renderFontItal[fontnum].font; @@ -1820,8 +1826,8 @@ xtermComputeFontInfo(XtermWidget xw, XftPattern *pat; double face_size = xw->misc.face_size[fontnum]; - TRACE(("xtermComputeFontInfo norm(face %s, size %f)\n", - face_name, + TRACE(("xtermComputeFontInfo font %d: norm(face %s, size %f)\n", + fontnum, face_name, xw->misc.face_size[fontnum])); if (face_size <= 0.0) { @@ -2030,7 +2036,7 @@ xtermComputeFontInfo(XtermWidget xw, /* * Are we handling a bitmap font? */ - if (!UsingRenderFont(xw)) + else #endif /* OPT_RENDERFONT */ { if (is_double_width_font(font) && !(screen->fnt_prop)) { diff --git a/app/xterm/fontutils.h b/app/xterm/fontutils.h index 2187acc22..c9a87a5e7 100644 --- a/app/xterm/fontutils.h +++ b/app/xterm/fontutils.h @@ -1,4 +1,4 @@ -/* $XTermId: fontutils.h,v 1.81 2010/06/15 10:58:13 tom Exp $ */ +/* $XTermId: fontutils.h,v 1.82 2010/10/11 08:13:54 tom Exp $ */ /************************************************************ @@ -105,7 +105,7 @@ extern void xtermCloseXft(TScreen * /* screen */, XTermXftFonts * /* pub */); #endif #if OPT_SHIFT_FONTS -extern char *getFaceName(XtermWidget /* xw */, Bool /* wideName */); +extern String getFaceName(XtermWidget /* xw */, Bool /* wideName */); extern void HandleLargerFont PROTO_XT_ACTIONS_ARGS; extern void HandleSmallerFont PROTO_XT_ACTIONS_ARGS; extern void setFaceName(XtermWidget /* xw */, const char * /*value */); diff --git a/app/xterm/misc.c b/app/xterm/misc.c index 4645fe11c..c2a8ad37a 100644 --- a/app/xterm/misc.c +++ b/app/xterm/misc.c @@ -1,4 +1,4 @@ -/* $XTermId: misc.c,v 1.507 2010/08/30 08:26:45 tom Exp $ */ +/* $XTermId: misc.c,v 1.510 2010/10/11 08:33:33 tom Exp $ */ /* * Copyright 1999-2009,2010 by Thomas E. Dickey @@ -425,9 +425,32 @@ xevents(void) && event.xany.type == MotionNotify && event.xcrossing.window == XtWindow(xw)) { SendMousePosition(xw, &event); + xtermShowPointer(xw, True); continue; } + /* + * If the event is interesting (and not a keyboard event), turn the + * mouse pointer back on. + */ + if (screen->hide_pointer) { + switch (event.xany.type) { + case KeyPress: + case KeyRelease: + case ButtonPress: + case ButtonRelease: + /* also these... */ + case Expose: + case NoExpose: + case PropertyNotify: + case ClientMessage: + break; + default: + xtermShowPointer(xw, True); + break; + } + } + if (!event.xany.send_event || screen->allowSendEvents || ((event.xany.type != KeyPress) && @@ -435,28 +458,6 @@ xevents(void) (event.xany.type != ButtonPress) && (event.xany.type != ButtonRelease))) { - /* - * If the event is interesting (and not a keyboard event), turn the - * mouse pointer back on. - */ - if (screen->hide_pointer) { - switch (event.xany.type) { - case KeyPress: - case KeyRelease: - case ButtonPress: - case ButtonRelease: - /* also these... */ - case Expose: - case NoExpose: - case PropertyNotify: - case ClientMessage: - break; - default: - xtermShowPointer(xw, True); - break; - } - } - XtDispatchEvent(&event); } } while (XtAppPending(app_con) & XtIMXEvent); @@ -2551,7 +2552,7 @@ ResetColorsRequest(XtermWidget xw, * the corresponding menu font entry. */ static int -ParseShiftedFont(XtermWidget xw, char *source, char **target) +ParseShiftedFont(XtermWidget xw, String source, String * target) { TScreen *screen = TScreenOf(xw); int num = screen->menu_font_number; @@ -2586,13 +2587,13 @@ ParseShiftedFont(XtermWidget xw, char *source, char **target) } static void -QueryFontRequest(XtermWidget xw, char *buf, int final) +QueryFontRequest(XtermWidget xw, String buf, int final) { if (AllowFontOps(xw, efGetFont)) { TScreen *screen = TScreenOf(xw); Bool success = True; int num; - char *base = buf + 1; + String base = buf + 1; const char *name = 0; char temp[10]; @@ -2636,7 +2637,7 @@ QueryFontRequest(XtermWidget xw, char *buf, int final) } static void -ChangeFontRequest(XtermWidget xw, char *buf) +ChangeFontRequest(XtermWidget xw, String buf) { if (AllowFontOps(xw, efSetFont)) { TScreen *screen = TScreenOf(xw); @@ -3450,11 +3451,11 @@ do_rpm(XtermWidget xw, int nparams, int *params) result = MdFlag(xw->flags, LINEFEED); break; } - reply.a_param[count++] = params[0]; - reply.a_param[count++] = result; + reply.a_param[count++] = (ParmType) params[0]; + reply.a_param[count++] = (ParmType) result; } reply.a_type = ANSI_CSI; - reply.a_nparam = count; + reply.a_nparam = (ParmType) count; reply.a_inters = '$'; reply.a_final = 'y'; unparseseq(xw, &reply); @@ -3680,12 +3681,12 @@ do_decrpm(XtermWidget xw, int nparams, int *params) break; #endif /* OPT_READLINE */ } - reply.a_param[count++] = params[0]; - reply.a_param[count++] = result; + reply.a_param[count++] = (ParmType) params[0]; + reply.a_param[count++] = (ParmType) result; } reply.a_type = ANSI_CSI; reply.a_pintro = '?'; - reply.a_nparam = count; + reply.a_nparam = (ParmType) count; reply.a_inters = '$'; reply.a_final = 'y'; unparseseq(xw, &reply); diff --git a/app/xterm/ptyx.h b/app/xterm/ptyx.h index d165ccced..d59caa106 100644 --- a/app/xterm/ptyx.h +++ b/app/xterm/ptyx.h @@ -1,4 +1,4 @@ -/* $XTermId: ptyx.h,v 1.671 2010/08/19 09:30:01 Ryan.Johnson Exp $ */ +/* $XTermId: ptyx.h,v 1.675 2010/10/11 08:25:53 tom Exp $ */ /* * Copyright 1999-2009,2010 by Thomas E. Dickey @@ -1584,7 +1584,7 @@ typedef struct { long event_mask; unsigned send_mouse_pos; /* user wants mouse transition */ /* and position information */ - unsigned ext_mode_mouse; /* support large terminals */ + Boolean ext_mode_mouse; /* support large terminals */ Boolean send_focus_pos; /* user wants focus in/out info */ Boolean quiet_grab; /* true if no cursor change on focus */ #if OPT_PASTE64 @@ -1698,7 +1698,9 @@ typedef struct { XTermFonts fnts[fMAX]; /* normal/bold/etc for terminal */ Boolean free_bold_box; /* same_font_size's austerity */ #ifndef NO_ACTIVE_ICON - XTermFonts fnt_icon; /* icon font */ + XTermFonts fnt_icon; /* icon font */ + String icon_fontname; /* name of icon font */ + int icon_fontnum; /* number to use for icon font */ #endif /* NO_ACTIVE_ICON */ int enbolden; /* overstrike for bold font */ XPoint *box; /* draw unselected cursor */ @@ -1880,6 +1882,7 @@ typedef struct { Boolean cutNewline; /* whether or not line cut has \n */ Boolean cutToBeginningOfLine; /* line cuts to BOL? */ Boolean highlight_selection; /* controls appearance of selection */ + Boolean show_wrap_marks; /* show lines which are wrapped */ Boolean trim_selection; /* controls trimming of selection */ Boolean i18nSelections; Boolean brokenSelections; @@ -2129,11 +2132,11 @@ typedef struct } TKeyboard; typedef struct { - char *f_n; /* the normal font */ - char *f_b; /* the bold font */ + String f_n; /* the normal font */ + String f_b; /* the bold font */ #if OPT_WIDE_CHARS - char *f_w; /* the normal wide font */ - char *f_wb; /* the bold wide font */ + String f_w; /* the normal wide font */ + String f_wb; /* the bold wide font */ #endif } VTFontNames; diff --git a/app/xterm/screen.c b/app/xterm/screen.c index 68fd7dd32..952a584bc 100644 --- a/app/xterm/screen.c +++ b/app/xterm/screen.c @@ -1,4 +1,4 @@ -/* $XTermId: screen.c,v 1.423 2010/06/14 00:00:58 tom Exp $ */ +/* $XTermId: screen.c,v 1.426 2010/10/11 00:46:05 tom Exp $ */ /* * Copyright 1999-2009,2010 by Thomas E. Dickey @@ -1237,6 +1237,9 @@ ScrnDeleteChar(XtermWidget xw, unsigned n) } }); LineClrWrapped(ld); + if (screen->show_wrap_marks) { + ShowWrapMarks(xw, row, ld); + } } ClearCells(xw, 0, n, row, (last - (int) n)); @@ -1244,6 +1247,29 @@ ScrnDeleteChar(XtermWidget xw, unsigned n) } /* + * This is useful for debugging both xterm and applications that may manipulate + * its line-wrapping state. + */ +void +ShowWrapMarks(XtermWidget xw, int row, LineData * ld) +{ + TScreen *screen = TScreenOf(xw); + Boolean set = LineTstWrapped(ld); + CgsEnum cgsId = set ? gcVTcursFilled : gcVTcursReverse; + VTwin *currentWin = WhichVWin(screen); + int y = row * FontHeight(screen) + screen->border; + int x = LineCursorX(screen, ld, screen->max_col + 1); + + TRACE2(("ShowWrapMarks %d:%s\n", row, BtoS(set))); + + XFillRectangle(screen->display, VWindow(screen), + getCgsGC(xw, currentWin, cgsId), + x, y, + (unsigned) screen->border, + (unsigned) FontHeight(screen)); +} + +/* * Repaints the area enclosed by the parameters. * Requires: (toprow, leftcol), (toprow + nrows, leftcol + ncols) are * coordinates of characters in screen; @@ -1326,6 +1352,11 @@ ScrnRefresh(XtermWidget xw, || ld->attribs == 0) { break; } + + if (screen->show_wrap_marks) { + ShowWrapMarks(xw, lastind, ld); + } + if (maxcol >= (int) ld->lineSize) { maxcol = ld->lineSize - 1; hi_col = maxcol; @@ -1656,6 +1687,9 @@ ClearBufRows(XtermWidget xw, SetLineDblCS(ld, CSET_SWL); }); LineClrWrapped(ld); + if (screen->show_wrap_marks) { + ShowWrapMarks(xw, row, ld); + } ClearCells(xw, 0, len, row, 0); } } diff --git a/app/xterm/trace.h b/app/xterm/trace.h index 13d9f9cba..bd26dba2d 100644 --- a/app/xterm/trace.h +++ b/app/xterm/trace.h @@ -1,11 +1,11 @@ -/* $XTermId: trace.h,v 1.54 2010/06/15 22:40:51 tom Exp $ */ +/* $XTermId: trace.h,v 1.55 2010/10/13 22:26:57 tom Exp $ */ /* - * + * * Copyright 1997-2009,2010 by Thomas E. Dickey - * + * * All Rights Reserved - * + * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -29,7 +29,7 @@ * holders shall not be used in advertising or otherwise to promote the * sale, use or other dealings in this Software without prior written * authorization. - * + * */ /* @@ -120,4 +120,41 @@ extern int TraceResizeRequest(const char * /* fn */, int /* ln */, Widget /* w #endif +/* + * The whole wnew->screen struct is zeroed in VTInitialize. Use these macros + * where applicable for copying the pieces from the request widget into the + * new widget. We do not have to use them for wnew->misc, but the associated + * traces are very useful for debugging. + */ +#if OPT_TRACE +#define init_Bres(name) \ + TRACE(("init " #name " = %s\n", \ + BtoS(wnew->name = request->name))) +#define init_Dres2(name,i) \ + TRACE(("init " #name "[%d] = %f\n", i, \ + wnew->name[i] = request->name[i])) +#define init_Ires(name) \ + TRACE(("init " #name " = %d\n", \ + wnew->name = request->name)) +#define init_Sres(name) \ + TRACE(("init " #name " = \"%s\"\n", \ + (wnew->name = x_strtrim(request->name)) != NULL \ + ? wnew->name : "<null>")) +#define init_Sres2(name,i) \ + TRACE(("init " #name "[%d] = \"%s\"\n", i, \ + (wnew->name(i) = x_strtrim(request->name(i))) != NULL \ + ? wnew->name(i) : "<null>")) +#define init_Tres(offset) \ + TRACE(("init screen.Tcolors[" #offset "] = %#lx\n", \ + fill_Tres(wnew, request, offset))) +#else +#define init_Bres(name) wnew->name = request->name +#define init_Dres2(name,i) wnew->name[i] = request->name[i] +#define init_Ires(name) wnew->name = request->name +#define init_Sres(name) wnew->name = x_strtrim(request->name) +#define init_Sres2(name,i) wnew->name(i) = x_strtrim(request->name(i)) +#define init_Tres(offset) fill_Tres(wnew, request, offset) +#endif + + #endif /* included_trace_h */ diff --git a/app/xterm/util.c b/app/xterm/util.c index e22dfb2c7..e16b168c0 100644 --- a/app/xterm/util.c +++ b/app/xterm/util.c @@ -1,4 +1,4 @@ -/* $XTermId: util.c,v 1.539 2010/08/29 22:49:16 tom Exp $ */ +/* $XTermId: util.c,v 1.541 2010/10/11 00:32:28 tom Exp $ */ /* * Copyright 1999-2009,2010 by Thomas E. Dickey @@ -1343,6 +1343,9 @@ ClearRight(XtermWidget xw, int n) /* with the right part cleared, we can't be wrapping */ LineClrWrapped(ld); + if (screen->show_wrap_marks) { + ShowWrapMarks(xw, screen->cur_row, ld); + } screen->do_wrap = False; } @@ -1625,6 +1628,15 @@ vertical_copy_area(XtermWidget xw, (unsigned) Width(screen), (unsigned) (nlines * FontHeight(screen)), src_x, src_y - amount * FontHeight(screen)); + if (screen->show_wrap_marks) { + LineData *ld; + int row; + for (row = firstline; row < firstline + nlines; ++row) { + if ((ld = getLineData(screen, row)) != 0) { + ShowWrapMarks(xw, row, ld); + } + } + } } } diff --git a/app/xterm/version.h b/app/xterm/version.h index ec71093a2..e4c41821a 100644 --- a/app/xterm/version.h +++ b/app/xterm/version.h @@ -1,5 +1,5 @@ /* - * $XTermId: version.h,v 1.320 2010/07/16 00:42:31 tom Exp $ + * $XTermId: version.h,v 1.322 2010/10/14 08:33:49 tom Exp $ * ---------------------------------------------------------------------------- * this file is part of xterm * @@ -39,7 +39,7 @@ * version of X to which this version of xterm has been built. The number in * parentheses is my patch number (Thomas E. Dickey). */ -#define XTERM_PATCH 262 +#define XTERM_PATCH 264 #ifndef __vendorversion__ #define __vendorversion__ "XTerm/OpenBSD" diff --git a/app/xterm/vms.c b/app/xterm/vms.c index c47ac93b5..6f89e9e6a 100644 --- a/app/xterm/vms.c +++ b/app/xterm/vms.c @@ -1,4 +1,4 @@ -/* $XTermId: vms.c,v 1.12 2010/06/13 17:46:27 tom Exp $ */ +/* $XTermId: vms.c,v 1.13 2010/10/11 08:05:35 tom Exp $ */ /* vms.c * @@ -88,7 +88,6 @@ int tt_new_output=False; /* Cleared by flushlog(), set whenever something n goes to the screen through tt_write */ int trnlnm(char *in,int id,char *out); -int tt_write(char *tt_write_buf,int size); void spawn (void); static void tt_echo_ast(TT_BUF_STRUCT *buff_addr); @@ -391,7 +390,7 @@ static void tt_echo_ast(TT_BUF_STRUCT *buff_addr) */ -int tt_write(char *tt_write_buf, int size) +int tt_write(const char *tt_write_buf, int size) { int status; TT_BUF_STRUCT *echoBuff; diff --git a/app/xterm/vms.h b/app/xterm/vms.h index 86f338eb9..8eb206433 100644 --- a/app/xterm/vms.h +++ b/app/xterm/vms.h @@ -37,3 +37,5 @@ static struct items { int buffer; int return_addr; } itemlist[MAXITEMLIST]; + +int tt_write(const char *tt_write_buf,int size); diff --git a/app/xterm/xterm.h b/app/xterm/xterm.h index 46b16ec9b..5a9096109 100644 --- a/app/xterm/xterm.h +++ b/app/xterm/xterm.h @@ -1,4 +1,4 @@ -/* $XTermId: xterm.h,v 1.630 2010/08/29 22:42:57 tom Exp $ */ +/* $XTermId: xterm.h,v 1.635 2010/10/12 08:55:47 tom Exp $ */ /************************************************************ @@ -485,6 +485,7 @@ extern char **environ; #define XtNshiftFonts "shiftFonts" #define XtNshowBlinkAsBold "showBlinkAsBold" #define XtNshowMissingGlyphs "showMissingGlyphs" +#define XtNshowWrapMarks "showWrapMarks" #define XtNsignalInhibit "signalInhibit" #define XtNtekGeometry "tekGeometry" #define XtNtekInhibit "tekInhibit" @@ -644,6 +645,7 @@ extern char **environ; #define XtCShiftFonts "ShiftFonts" #define XtCShowBlinkAsBold "ShowBlinkAsBold" #define XtCShowMissingGlyphs "ShowMissingGlyphs" +#define XtCShowWrapMarks "ShowWrapMarks" #define XtCSignalInhibit "SignalInhibit" #define XtCTekInhibit "TekInhibit" #define XtCTekSmall "TekSmall" @@ -719,7 +721,7 @@ extern void TekSimulatePageButton (TekWidget /* tw */, Bool /* reset */); #endif /* button.c */ -#define MotionOff( s, t ) { \ +#define MotionOff( s, t ) if (!(screen->hide_pointer)) { \ (s)->event_mask |= ButtonMotionMask; \ (s)->event_mask &= ~PointerMotionMask; \ XSelectInput(XtDisplay((t)), XtWindow((t)), (long) (s)->event_mask); } @@ -737,11 +739,13 @@ extern void HandleInsertSelection PROTO_XT_ACTIONS_ARGS; extern void HandleKeyboardSelectEnd PROTO_XT_ACTIONS_ARGS; extern void HandleKeyboardSelectExtend PROTO_XT_ACTIONS_ARGS; extern void HandleKeyboardSelectStart PROTO_XT_ACTIONS_ARGS; +extern void HandleKeyboardSelectStop PROTO_XT_ACTIONS_ARGS; extern void HandleKeyboardStartExtend PROTO_XT_ACTIONS_ARGS; extern void HandleSelectEnd PROTO_XT_ACTIONS_ARGS; extern void HandleSelectExtend PROTO_XT_ACTIONS_ARGS; extern void HandleSelectSet PROTO_XT_ACTIONS_ARGS; extern void HandleSelectStart PROTO_XT_ACTIONS_ARGS; +extern void HandleSelectStop PROTO_XT_ACTIONS_ARGS; extern void HandleStartExtend PROTO_XT_ACTIONS_ARGS; extern void ResizeSelection (TScreen * /* screen */, int /* rows */, int /* cols */); extern void ScrollSelection (TScreen * /* screen */, int /* amount */, Bool /* always */); @@ -825,7 +829,7 @@ extern void unparseputc1 (XtermWidget /* xw */, int /* c */); extern void unparseputn (XtermWidget /* xw */, unsigned /* n */); extern void unparseputs (XtermWidget /* xw */, const char * /* s */); extern void unparseseq (XtermWidget /* xw */, ANSI * /* ap */); -extern void v_write (int /* f */, Char * /* d */, unsigned /* len */); +extern void v_write (int /* f */, const Char * /* d */, unsigned /* len */); extern void xtermAddInput(Widget /* w */); #if OPT_BLINK_CURS @@ -1105,6 +1109,7 @@ extern void ScrnInsertLine (XtermWidget /* xw */, ScrnBuf /* sb */, int /* last extern void ScrnRefresh (XtermWidget /* xw */, int /* toprow */, int /* leftcol */, int /* nrows */, int /* ncols */, Bool /* force */); extern void ScrnUpdate (XtermWidget /* xw */, int /* toprow */, int /* leftcol */, int /* nrows */, int /* ncols */, Bool /* force */); extern void ScrnWriteText (XtermWidget /* xw */, IChar * /* str */, unsigned /* flags */, unsigned /* cur_fg_bg */, unsigned /* length */); +extern void ShowWrapMarks (XtermWidget /* xw */, int /* row */, LineData * /* ld */); extern void setupLineData (TScreen * /* screen */, ScrnBuf /* base */, Char * /* data */, unsigned /* nrow */, unsigned /* ncol */); extern void xtermParseRect (XtermWidget /* xw */, int, int *, XTermRect *); diff --git a/app/xterm/xterm.log.html b/app/xterm/xterm.log.html index 3ed5ad1df..8f33190e8 100644 --- a/app/xterm/xterm.log.html +++ b/app/xterm/xterm.log.html @@ -31,7 +31,7 @@ * sale, use or other dealings in this Software without prior written * * authorization. * ***************************************************************************** - $XTermId: xterm.log.html,v 1.965 2010/08/30 00:19:46 tom Exp $ + $XTermId: xterm.log.html,v 1.977 2010/10/14 08:53:32 tom Exp $ --> <HTML> <HEAD> @@ -56,6 +56,8 @@ Most of these are summarized in the XFree86 CHANGELOG is the latest version of this file. <UL> +<LI><A HREF="#xterm_264">Patch #264 - 2010/10/14</A> +<LI><A HREF="#xterm_263">Patch #263 - 2010/10/13</A> <LI><A HREF="#xterm_262">Patch #262 - 2010/8/30</A> <LI><A HREF="#xterm_261">Patch #261 - 2010/6/28</A> <LI><A HREF="#xterm_260">Patch #260 - 2010/6/20</A> @@ -321,6 +323,56 @@ is the latest version of this file. <LI><A HREF="#xterm_01">Patch #1 - 1996/1/6</A> </UL> +<H1><A NAME="xterm_264">Patch #264 - 2010/10/14</A></H1> +<ul> + <li>replace a null-pointer check with check for empty string in + <code>xtermOpenFont</code>, + to eliminate a warning message from + <a href="#xterm_263">patch #263</a> changes. + + <li>build-fix for <a href="#xterm_263">patch #263</a> when toolbar + is not configured + (patch by Chris Clayton) + (reports by Robby Workman, + David Wood). +</ul> + +<H1><A NAME="xterm_263">Patch #263 - 2010/10/13</A></H1> +<ul> + <li>corrected initialization of "misc" resource values, to ensure that + xterm has allocated a copy of strings which may not have been + malloc'd by the X library (Debian #600129). + + <li>modify handling of any-event/any-button mouse protocol; it + now is active with any combination of key-modifiers. + + <li>add debugging feature <code>showWrapMarks</code>, which marks + lines which xterm knows are wrapped, showing where a double-click + will select past the end of a line. + + <li>build-fix to address change in include-guards for + <code>Xlib.h</code> + in ongoing Xorg edits (patch by Jeremy Huddleston). + + <li>improve <code>pointerMode</code> by continuing to watch for motion + events after mouse tracking is disabled if the pointer is hidden + (Debian #594856). + + <li>further extend initialization for active-icon font to check if + the font was not loaded succesfully, + to retry with <code>font1</code>, + or as even (if TrueType fonts are used) to use a TrueType font. + The retries are to help with cases as in + <a href="#xterm_241">patch #241</a> where the bitmap fonts are + not available. + + <li>fix special case of active-icon used when TrueType font is + specified for the xterm window, + from <a href="#xterm_261">patch #261</a> change. + In that case, the default font's size was used for layout of the + active icon's window (Debian #591265). +</ul> + <H1><A NAME="xterm_262">Patch #262 - 2010/8/30</A></H1> <ul> <li>fix a case where changing the cursor color via escape sequences diff --git a/app/xterm/xterm.man b/app/xterm/xterm.man index 0961f3eea..f0b8c96b3 100644 --- a/app/xterm/xterm.man +++ b/app/xterm/xterm.man @@ -1,5 +1,5 @@ '\" t -.\" $XTermId: xterm.man,v 1.466 2010/07/16 00:39:54 tom Exp $ +.\" $XTermId: xterm.man,v 1.467 2010/10/11 00:36:08 tom Exp $ .\" .\" Copyright 1996-2009,2010 by Thomas E. Dickey .\" @@ -3190,6 +3190,12 @@ Tells \fIxterm\fP whether to display a box outlining places where a character has been used that the font does not represent. The default is \*(``false.\*('' .TP 8 +.B "showWrapMarks (\fPclass\fB ShowWrapMarks)" +For debugging \fIxterm\fP and applications that may manipulate the +wrapped-line flag by writing text at the right margin, +show a mark on the right inner-border of the window. +The mark shows which lines have the flag set. +.TP 8 .B "signalInhibit (\fPclass\fB SignalInhibit)" Specifies whether or not the entries in the \*(``Main Options\*('' menu for sending signals to \fIxterm\fP should be disallowed. diff --git a/app/xterm/xutf8.h b/app/xterm/xutf8.h index f0cc561a2..45fdd90ca 100644 --- a/app/xterm/xutf8.h +++ b/app/xterm/xutf8.h @@ -1,4 +1,6 @@ -/* $XFree86: xc/programs/xterm/xutf8.h,v 1.1 2001/06/18 19:09:28 dickey Exp $ */ +/* + * $XTermId: xutf8.h,v 1.4 2010/10/10 14:10:12 Jeremy.Huddleston Exp $ + */ /* Copyright (c) 2001 by Juliusz Chroboczek @@ -21,9 +23,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef _XLIB_H_ -#error Please include <X11/Xlib.h> before "xutf8.h" -#endif +#include <X11/Xlib.h> #ifndef X_HAVE_UTF8_STRING |