From: pcg Date: Fri, 13 Feb 2004 12:16:21 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=94aaf2cca20f9c406d4637fd0bf031ac6d4f6e38;p=dana%2Furxvt.git *** empty log message *** --- diff --git a/src/command.C b/src/command.C index 1149fff2..8c13ee9f 100644 --- a/src/command.C +++ b/src/command.C @@ -79,7 +79,7 @@ rxvt_term::lookup_key (XKeyEvent &ev) if (numlock_state || (ev.state & ModNumLockMask)) { numlock_state = (ev.state & ModNumLockMask); - PrivMode((!numlock_state), PrivMode_aplKP); + PrivMode ((!numlock_state), PrivMode_aplKP); } kbuf[0] = 0; @@ -255,9 +255,9 @@ rxvt_term::lookup_key (XKeyEvent &ev) if (greek_mode) { xterm_seq (XTerm_title, - (greek_getmode() == GREEK_ELOT928 + (greek_getmode () == GREEK_ELOT928 ? "[Greek: iso]" : "[Greek: ibm]"), CHAR_ST); - greek_reset(); + greek_reset (); } else xterm_seq (XTerm_title, APL_NAME "-" VERSION, CHAR_ST); @@ -268,7 +268,7 @@ rxvt_term::lookup_key (XKeyEvent &ev) if (keysym >= 0xFF00 && keysym <= 0xFFFF) { #ifdef KEYSYM_RESOURCE - if (!(shft | ctrl) && Keysym_map[keysym & 0xFF] != NULL) + if (! (shft | ctrl) && Keysym_map[keysym & 0xFF] != NULL) { unsigned int l; const unsigned char *kbuf0; @@ -297,46 +297,46 @@ rxvt_term::lookup_key (XKeyEvent &ev) case XK_BackSpace: if (PrivateModes & PrivMode_HaveBackSpace) { - kbuf[0] = (!!(PrivateModes & PrivMode_BackSpace) + kbuf[0] = (!! (PrivateModes & PrivMode_BackSpace) ^ !!ctrl) ? '\b' : '\177'; kbuf[1] = '\0'; } else - STRCPY(kbuf, key_backspace); + STRCPY (kbuf, key_backspace); # ifdef MULTICHAR_SET if ((Options & Opt_mc_hack) && screen.cur.col > 0) { int col, row; - newlen = STRLEN(kbuf); + newlen = STRLEN (kbuf); col = screen.cur.col - 1; row = screen.cur.row + TermWin.saveLines; - if (IS_MULTI2(screen.rend[row][col])) - MEMMOVE(kbuf + newlen, kbuf, newlen + 1); + if (IS_MULTI2 (screen.rend[row][col])) + MEMMOVE (kbuf + newlen, kbuf, newlen + 1); } # endif break; #endif #ifndef NO_DELETE_KEY case XK_Delete: - STRCPY(kbuf, key_delete); + STRCPY (kbuf, key_delete); # ifdef MULTICHAR_SET if (Options & Opt_mc_hack) { int col, row; - newlen = STRLEN(kbuf); + newlen = STRLEN (kbuf); col = screen.cur.col; row = screen.cur.row + TermWin.saveLines; - if (IS_MULTI1(screen.rend[row][col])) - MEMMOVE(kbuf + newlen, kbuf, newlen + 1); + if (IS_MULTI1 (screen.rend[row][col])) + MEMMOVE (kbuf + newlen, kbuf, newlen + 1); } # endif break; #endif case XK_Tab: if (shft) - STRCPY(kbuf, "\033[Z"); + STRCPY (kbuf, "\033[Z"); else { #ifdef CTRL_TAB_MAKES_META @@ -359,7 +359,7 @@ rxvt_term::lookup_key (XKeyEvent &ev) case XK_KP_Left: /* \033Ot or standard */ if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) { - STRCPY(kbuf, "\033OZ"); + STRCPY (kbuf, "\033OZ"); kbuf[2] = ("txvr"[keysym - XK_KP_Left]); break; } @@ -372,7 +372,7 @@ rxvt_term::lookup_key (XKeyEvent &ev) case XK_Down: /* "\033[B" */ case XK_Right: /* "\033[C" */ case XK_Left: /* "\033[D" */ - STRCPY(kbuf, "\033[Z"); + STRCPY (kbuf, "\033[Z"); kbuf[2] = ("DACB"[keysym - XK_Left]); /* do Shift first */ if (shft) @@ -394,13 +394,13 @@ rxvt_term::lookup_key (XKeyEvent &ev) row = screen.cur.row + TermWin.saveLines; m = 0; if (keysym == XK_Right - && IS_MULTI1(screen.rend[row][col])) + && IS_MULTI1 (screen.rend[row][col])) m = 1; else if (keysym == XK_Left) { if (col > 0) { - if (IS_MULTI2(screen.rend[row][col - 1])) + if (IS_MULTI2 (screen.rend[row][col - 1])) m = 1; } else if (screen.cur.row > 0) @@ -411,12 +411,12 @@ rxvt_term::lookup_key (XKeyEvent &ev) else col--; if (col > 0 - && IS_MULTI2(screen.rend[row][col])) + && IS_MULTI2 (screen.rend[row][col])) m = 1; } } if (m) - MEMMOVE(kbuf + 3, kbuf, 3 + 1); + MEMMOVE (kbuf + 3, kbuf, 3 + 1); } #endif break; @@ -427,33 +427,33 @@ rxvt_term::lookup_key (XKeyEvent &ev) /* allow shift to override */ if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) { - STRCPY(kbuf, "\033Oy"); + STRCPY (kbuf, "\033Oy"); break; } /* FALLTHROUGH */ # endif case XK_Prior: - STRCPY(kbuf, "\033[5~"); + STRCPY (kbuf, "\033[5~"); break; # ifdef XK_KP_Next case XK_KP_Next: /* allow shift to override */ if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) { - STRCPY(kbuf, "\033Os"); + STRCPY (kbuf, "\033Os"); break; } /* FALLTHROUGH */ # endif case XK_Next: - STRCPY(kbuf, "\033[6~"); + STRCPY (kbuf, "\033[6~"); break; #endif case XK_KP_Enter: /* allow shift to override */ if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) { - STRCPY(kbuf, "\033OM"); + STRCPY (kbuf, "\033OM"); } else { @@ -464,22 +464,22 @@ rxvt_term::lookup_key (XKeyEvent &ev) #ifdef XK_KP_Begin case XK_KP_Begin: - STRCPY(kbuf, "\033Ou"); + STRCPY (kbuf, "\033Ou"); break; case XK_KP_Insert: - STRCPY(kbuf, "\033Op"); + STRCPY (kbuf, "\033Op"); break; case XK_KP_Delete: - STRCPY(kbuf, "\033On"); + STRCPY (kbuf, "\033On"); break; #endif case XK_KP_F1: /* "\033OP" */ case XK_KP_F2: /* "\033OQ" */ case XK_KP_F3: /* "\033OR" */ case XK_KP_F4: /* "\033OS" */ - STRCPY(kbuf, "\033OP"); + STRCPY (kbuf, "\033OP"); kbuf[2] += (keysym - XK_KP_F1); break; @@ -502,7 +502,7 @@ rxvt_term::lookup_key (XKeyEvent &ev) /* allow shift to override */ if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) { - STRCPY(kbuf, "\033Oj"); + STRCPY (kbuf, "\033Oj"); kbuf[2] += (keysym - XK_KP_Multiply); } else @@ -513,80 +513,80 @@ rxvt_term::lookup_key (XKeyEvent &ev) break; case XK_Find: - STRCPY(kbuf, "\033[1~"); + STRCPY (kbuf, "\033[1~"); break; case XK_Insert: - STRCPY(kbuf, "\033[2~"); + STRCPY (kbuf, "\033[2~"); break; #ifdef DXK_Remove /* support for DEC remove like key */ case DXK_Remove: /* FALLTHROUGH */ #endif case XK_Execute: - STRCPY(kbuf, "\033[3~"); + STRCPY (kbuf, "\033[3~"); break; case XK_Select: - STRCPY(kbuf, "\033[4~"); + STRCPY (kbuf, "\033[4~"); break; #ifdef XK_KP_End case XK_KP_End: /* allow shift to override */ if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) { - STRCPY(kbuf, "\033Oq"); + STRCPY (kbuf, "\033Oq"); break; } /* FALLTHROUGH */ #endif case XK_End: - STRCPY(kbuf, KS_END); + STRCPY (kbuf, KS_END); break; #ifdef XK_KP_Home case XK_KP_Home: /* allow shift to override */ if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) { - STRCPY(kbuf, "\033Ow"); + STRCPY (kbuf, "\033Ow"); break; } /* FALLTHROUGH */ #endif case XK_Home: - STRCPY(kbuf, KS_HOME); + STRCPY (kbuf, KS_HOME); break; #define FKEY(n, fkey) \ - sprintf((char *)kbuf,"\033[%2d~", (int)((n) + (keysym - fkey))) + sprintf ((char *)kbuf,"\033[%2d~", (int) ((n) + (keysym - fkey))) case XK_F1: /* "\033[11~" */ case XK_F2: /* "\033[12~" */ case XK_F3: /* "\033[13~" */ case XK_F4: /* "\033[14~" */ case XK_F5: /* "\033[15~" */ - FKEY(11, XK_F1); + FKEY (11, XK_F1); break; case XK_F6: /* "\033[17~" */ case XK_F7: /* "\033[18~" */ case XK_F8: /* "\033[19~" */ case XK_F9: /* "\033[20~" */ case XK_F10: /* "\033[21~" */ - FKEY(17, XK_F6); + FKEY (17, XK_F6); break; case XK_F11: /* "\033[23~" */ case XK_F12: /* "\033[24~" */ case XK_F13: /* "\033[25~" */ case XK_F14: /* "\033[26~" */ - FKEY(23, XK_F11); + FKEY (23, XK_F11); break; case XK_F15: /* "\033[28~" */ case XK_F16: /* "\033[29~" */ - FKEY(28, XK_F15); + FKEY (28, XK_F15); break; case XK_Help: /* "\033[28~" */ - FKEY(28, XK_Help); + FKEY (28, XK_Help); break; case XK_Menu: /* "\033[29~" */ - FKEY(29, XK_Menu); + FKEY (29, XK_Menu); break; case XK_F17: /* "\033[31~" */ case XK_F18: /* "\033[32~" */ @@ -607,7 +607,7 @@ rxvt_term::lookup_key (XKeyEvent &ev) case XK_F33: /* "\033[47~" */ case XK_F34: /* "\033[48~" */ case XK_F35: /* "\033[49~" */ - FKEY(31, XK_F17); + FKEY (31, XK_F17); break; #undef FKEY default: @@ -615,7 +615,7 @@ rxvt_term::lookup_key (XKeyEvent &ev) break; } if (newlen) - len = STRLEN(kbuf); + len = STRLEN (kbuf); } /* * Pass meta for all function keys, if 'meta' option set @@ -646,7 +646,7 @@ rxvt_term::lookup_key (XKeyEvent &ev) #endif #ifdef GREEK_SUPPORT if (greek_mode) - len = greek_xlat(kbuf, len); + len = greek_xlat (kbuf, len); #endif /* nil */ ; } @@ -685,7 +685,7 @@ rxvt_term::lookup_key (XKeyEvent &ev) { const unsigned char ch = C0_ESC; - tt_write(&ch, 1); + tt_write (&ch, 1); } #ifdef DEBUG_CMD if (debug_key) @@ -693,10 +693,10 @@ rxvt_term::lookup_key (XKeyEvent &ev) char *p; int i; - fprintf(stderr, "key 0x%04X [%d]: `", (unsigned int)keysym, len); + fprintf (stderr, "key 0x%04X [%d]: `", (unsigned int)keysym, len); for (i = 0, p = kbuf; i < len; i++, p++) - fprintf(stderr, (*p >= ' ' && *p < '\177' ? "%c" : "\\%03o"), *p); - fprintf(stderr, "'\n"); + fprintf (stderr, (*p >= ' ' && *p < '\177' ? "%c" : "\\%03o"), *p); + fprintf (stderr, "'\n"); } #endif /* DEBUG_CMD */ tt_write (kbuf, (unsigned int)len); @@ -704,7 +704,7 @@ rxvt_term::lookup_key (XKeyEvent &ev) /*}}} */ #if (MENUBAR_MAX) -/*{{{ rxvt_cmd_write(), rxvt_cmd_getc() */ +/*{{{ rxvt_cmd_write (), rxvt_cmd_getc () */ /* attempt to `write' count to the input buffer */ unsigned int rxvt_term::cmd_write (const unsigned char *str, unsigned int count) @@ -715,15 +715,15 @@ rxvt_term::cmd_write (const unsigned char *str, unsigned int count) s = cmdbuf_base + BUFSIZ - 1 - cmdbuf_endp; if (n > 0 && s < count) { - MEMMOVE(cmdbuf_base, cmdbuf_ptr, - (unsigned int)(cmdbuf_endp - cmdbuf_ptr)); + MEMMOVE (cmdbuf_base, cmdbuf_ptr, + (unsigned int) (cmdbuf_endp - cmdbuf_ptr)); cmdbuf_ptr = cmdbuf_base; cmdbuf_endp -= n; s += n; } if (count > s) { - rxvt_print_error("data loss: cmd_write too large"); + rxvt_print_error ("data loss: cmd_write too large"); count = s; } for (; count--;) @@ -871,7 +871,7 @@ rxvt_term::pty_cb (io_watcher &w, short revents) nlines++; refresh_count++; - if (!(Options & Opt_jumpScroll) + if (! (Options & Opt_jumpScroll) || (refresh_count >= (refresh_limit * (TermWin.nrow - 1)))) { refreshnow = true; @@ -965,7 +965,7 @@ rxvt_term::next_char () return NOCHAR; } -/* rxvt_cmd_getc() - Return next input character */ +/* rxvt_cmd_getc () - Return next input character */ /* * Return the next input character after first passing any keyboard input * to the command. @@ -1003,7 +1003,7 @@ rxvt_term::pointer_unblank () void rxvt_term::pointer_blank () { - if (!(Options & Opt_pointerBlank)) + if (! (Options & Opt_pointerBlank)) return; XDefineCursor (display->display, TermWin.vt, blank_cursor); @@ -1073,21 +1073,21 @@ rxvt_term::mouse_report (const XButtonEvent &ev) } #ifdef DEBUG_MOUSEREPORT - fprintf(stderr, "Mouse ["); + fprintf (stderr, "Mouse ["); if (key_state & 16) - fputc('C', stderr); + fputc ('C', stderr); if (key_state & 4) - fputc('S', stderr); + fputc ('S', stderr); if (key_state & 8) - fputc('A', stderr); + fputc ('A', stderr); if (key_state & 32) - fputc('2', stderr); - fprintf(stderr, "]: <%d>, %d/%d\n", + fputc ('2', stderr); + fprintf (stderr, "]: <%d>, %d/%d\n", button_number, x + 1, y + 1); #else - tt_printf("\033[M%c%c%c", + tt_printf ("\033[M%c%c%c", (32 + button_number + key_state), (32 + x + 1), (32 + y + 1)); @@ -1096,9 +1096,9 @@ rxvt_term::mouse_report (const XButtonEvent &ev) #ifdef USING_W11LIB void -rxvt_W11_process_x_event(XEvent *ev) +rxvt_W11_process_x_event (XEvent *ev) { - rxvt_t *r = rxvt_get_r(); + rxvt_t *r = rxvt_get_r (); x_cb (*ev); } @@ -1191,9 +1191,9 @@ rxvt_term::x_cb (XEvent &ev) #ifdef DEBUG_X struct timeval tp; struct tm *ltt; - (void)gettimeofday(&tp, NULL); - ltt = localtime(&(tp.tv_sec)); - D_X((stderr, "Event: %-16s %-7s %08lx (%4d-%02d-%02d %02d:%02d:%02d.%.6ld) %s %lu", eventnames[ev.type], (ev.xany.window == TermWin.parent[0] ? "parent" : (ev.xany.window == TermWin.vt ? "vt" : (ev.xany.window == scrollBar.win ? "scroll" : (ev.xany.window == menuBar.win ? "menubar" : "UNKNOWN")))), (ev.xany.window == TermWin.parent[0] ? TermWin.parent[0] : (ev.xany.window == TermWin.vt ? TermWin.vt : (ev.xany.window == scrollBar.win ? scrollBar.win : (ev.xany.window == menuBar.win ? menuBar.win : 0)))), ltt->tm_year + 1900, ltt->tm_mon + 1, ltt->tm_mday, ltt->tm_hour, ltt->tm_min, ltt->tm_sec, tp.tv_usec, ev.xany.send_event ? "S" : " ", ev.xany.serial)); + (void)gettimeofday (&tp, NULL); + ltt = localtime (& (tp.tv_sec)); + D_X ((stderr, "Event: %-16s %-7s %08lx (%4d-%02d-%02d %02d:%02d:%02d.%.6ld) %s %lu", eventnames[ev.type], (ev.xany.window == TermWin.parent[0] ? "parent" : (ev.xany.window == TermWin.vt ? "vt" : (ev.xany.window == scrollBar.win ? "scroll" : (ev.xany.window == menuBar.win ? "menubar" : "UNKNOWN")))), (ev.xany.window == TermWin.parent[0] ? TermWin.parent[0] : (ev.xany.window == TermWin.vt ? TermWin.vt : (ev.xany.window == scrollBar.win ? scrollBar.win : (ev.xany.window == menuBar.win ? menuBar.win : 0)))), ltt->tm_year + 1900, ltt->tm_mon + 1, ltt->tm_mday, ltt->tm_hour, ltt->tm_min, ltt->tm_sec, tp.tv_usec, ev.xany.send_event ? "S" : " ", ev.xany.serial)); #endif switch (ev.type) @@ -1205,13 +1205,13 @@ rxvt_term::x_cb (XEvent &ev) #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) case KeyRelease: { - if (!(ev.xkey.state & ControlMask)) + if (! (ev.xkey.state & ControlMask)) mouse_slip_wheel_speed = 0; else { KeySym ks; - ks = XKeycodeToKeysym(display->display, ev.xkey.keycode, 0); + ks = XKeycodeToKeysym (display->display, ev.xkey.keycode, 0); if (ks == XK_Control_L || ks == XK_Control_R) mouse_slip_wheel_speed = 0; } @@ -1244,25 +1244,25 @@ rxvt_term::x_cb (XEvent &ev) unsigned char *data; unsigned long Size, RemainingBytes; - XGetWindowProperty(display->display, display->root, + XGetWindowProperty (display->display, display->root, xa[XA_DNDSELECTION], 0L, 1000000L, False, AnyPropertyType, &ActualType, &ActualFormat, &Size, &RemainingBytes, &data); - XChangeProperty(display->display, display->root, + XChangeProperty (display->display, display->root, XA_CUT_BUFFER0, XA_STRING, 8, PropModeReplace, - data, STRLEN(data)); + data, STRLEN (data)); selection_paste (display->root, XA_CUT_BUFFER0, True); - XSetInputFocus(display->display, display->root, RevertToNone, CurrentTime); + XSetInputFocus (display->display, display->root, RevertToNone, CurrentTime); } #endif /* OFFIX_DND */ break; case MappingNotify: - XRefreshKeyboardMapping(&(ev.xmapping)); + XRefreshKeyboardMapping (& (ev.xmapping)); break; /* @@ -1297,7 +1297,7 @@ rxvt_term::x_cb (XEvent &ev) want_refresh = 1; #ifdef USE_XIM if (Input_Context != NULL) - XSetICFocus(Input_Context); + XSetICFocus (Input_Context); #endif #ifdef CURSOR_BLINK if (Options & Opt_cursorBlink) @@ -1314,7 +1314,7 @@ rxvt_term::x_cb (XEvent &ev) want_refresh = 1; #ifdef USE_XIM if (Input_Context != NULL) - XUnsetICFocus(Input_Context); + XUnsetICFocus (Input_Context); #endif #ifdef CURSOR_BLINK if (Options & Opt_cursorBlink) @@ -1334,19 +1334,19 @@ rxvt_term::x_cb (XEvent &ev) { /* Wrap lots of configures into one */ width = ev.xconfigure.width; height = ev.xconfigure.height; - D_SIZE((stderr, "Size: ConfigureNotify: %4d x %4d", width, height)); + D_SIZE ((stderr, "Size: ConfigureNotify: %4d x %4d", width, height)); } - while (XCheckTypedWindowEvent(display->display, ev.xconfigure.window, ConfigureNotify, &ev)); + while (XCheckTypedWindowEvent (display->display, ev.xconfigure.window, ConfigureNotify, &ev)); if (szHint.width != width || szHint.height != height) { - D_SIZE((stderr, "Size: Resizing from: %4d x %4d", szHint.width, szHint.height)); + D_SIZE ((stderr, "Size: Resizing from: %4d x %4d", szHint.width, szHint.height)); resize_all_windows (width, height, 1); } #ifdef DEBUG_SIZE else { - D_SIZE((stderr, "Size: Not resizing")); + D_SIZE ((stderr, "Size: Not resizing")); } #endif #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ @@ -1415,19 +1415,19 @@ rxvt_term::x_cb (XEvent &ev) { XEvent unused_event; - while (XCheckTypedWindowEvent(display->display, ev.xany.window, + while (XCheckTypedWindowEvent (display->display, ev.xany.window, Expose, &unused_event)) ; - while (XCheckTypedWindowEvent(display->display, ev.xany.window, + while (XCheckTypedWindowEvent (display->display, ev.xany.window, GraphicsExpose, &unused_event)) ; - if (isScrollbarWindow(ev.xany.window)) + if (isScrollbarWindow (ev.xany.window)) { - scrollBar.setIdle(); + scrollBar.setIdle (); scrollbar_show (0); } #ifdef MENUBAR - if (menubar_visible () && isMenuBarWindow(ev.xany.window)) + if (menubar_visible () && isMenuBarWindow (ev.xany.window)) menubar_expose (); #endif #ifdef RXVT_GRAPHICS @@ -1443,13 +1443,13 @@ rxvt_term::x_cb (XEvent &ev) pointer_unblank (); #endif #if MENUBAR - if (isMenuBarWindow(ev.xany.window)) + if (isMenuBarWindow (ev.xany.window)) { - menubar_control (&(ev.xbutton)); + menubar_control (& (ev.xbutton)); break; } #endif - if ((PrivateModes & PrivMode_mouse_report) && !(bypass_keystate)) + if ((PrivateModes & PrivMode_mouse_report) && ! (bypass_keystate)) break; if (ev.xany.window == TermWin.vt) @@ -1459,10 +1459,10 @@ rxvt_term::x_cb (XEvent &ev) while (XCheckTypedWindowEvent (display->display, TermWin.vt, MotionNotify, &ev)) ; - XQueryPointer(display->display, TermWin.vt, + XQueryPointer (display->display, TermWin.vt, &unused_root, &unused_child, &unused_root_x, &unused_root_y, - &(ev.xbutton.x), &(ev.xbutton.y), + & (ev.xbutton.x), & (ev.xbutton.y), &unused_mask); #ifdef MOUSE_THRESHOLD /* deal with a `jumpy' mouse */ @@ -1473,7 +1473,7 @@ rxvt_term::x_cb (XEvent &ev) (ev.xbutton.state & Button3Mask) ? 2 : 0); #ifdef SELECTION_SCROLLING if (ev.xbutton.y < TermWin.int_bwidth - || Pixel2Row(ev.xbutton.y) > (TermWin.nrow-1)) + || Pixel2Row (ev.xbutton.y) > (TermWin.nrow-1)) { int dist; @@ -1505,9 +1505,9 @@ rxvt_term::x_cb (XEvent &ev) dist = ev.xbutton.y - (TermWin.int_bwidth + TermWin.height); } - scroll_selection_lines=(Pixel2Height(dist)/ + scroll_selection_lines= (Pixel2Height (dist)/ SELECTION_SCROLL_LINE_SPEEDUP)+1; - MIN_IT(scroll_selection_lines, + MIN_IT (scroll_selection_lines, SELECTION_SCROLL_MAX_LINES); } else @@ -1525,17 +1525,17 @@ rxvt_term::x_cb (XEvent &ev) } } - else if (isScrollbarWindow(ev.xany.window) && scrollbar_isMotion()) + else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) { - while (XCheckTypedWindowEvent(display->display, scrollBar.win, + while (XCheckTypedWindowEvent (display->display, scrollBar.win, MotionNotify, &ev)) ; - XQueryPointer(display->display, scrollBar.win, + XQueryPointer (display->display, scrollBar.win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, - &(ev.xbutton.x), &(ev.xbutton.y), + & (ev.xbutton.x), & (ev.xbutton.y), &unused_mask); - scr_move_to (scrollbar_position(ev.xbutton.y) - csrO, - scrollbar_size()); + scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, + scrollbar_size ()); scr_refresh (refresh_type); refresh_limit = 0; scrollbar_show (1); @@ -1567,7 +1567,7 @@ rxvt_term::rootwin_cb (XEvent &ev) * use the property to determine the pixmap. We use it later on. */ if (xa[XA_XROOTPMAPID] == 0) - xa[XA_XROOTPMAPID] = XInternAtom(display->display, "_XROOTPMAP_ID", False); + xa[XA_XROOTPMAPID] = XInternAtom (display->display, "_XROOTPMAP_ID", False); if (ev.xproperty.atom != xa[XA_XROOTPMAPID]) return; @@ -1590,7 +1590,7 @@ rxvt_term::button_press (const XButtonEvent &ev) bypass_keystate = ev.state & (ModMetaMask | ShiftMask); if (!bypass_keystate) - reportmode = !!(PrivateModes & PrivMode_mouse_report); + reportmode = !! (PrivateModes & PrivMode_mouse_report); /* * VT window processing of button press */ @@ -1646,7 +1646,7 @@ rxvt_term::button_press (const XButtonEvent &ev) { case Button1: /* allow shift+left click to extend selection */ - if (ev.state & ShiftMask && !(PrivateModes & PrivMode_mouse_report)) + if (ev.state & ShiftMask && ! (PrivateModes & PrivMode_mouse_report)) { if (MEvent.button == Button1 && clickintime) selection_rotate (ev.x, ev.y); @@ -1683,7 +1683,7 @@ rxvt_term::button_press (const XButtonEvent &ev) /* * Scrollbar window processing of button press */ - if (isScrollbarWindow(ev.window)) + if (isScrollbarWindow (ev.window)) { scrollBar.setIdle (); /* @@ -1705,26 +1705,26 @@ rxvt_term::button_press (const XButtonEvent &ev) * click on scrollbar - send pageup/down */ if ((scrollBar.style == R_SB_NEXT - && scrollbarnext_upButton(ev.y)) + && scrollbarnext_upButton (ev.y)) || (scrollBar.style == R_SB_RXVT - && scrollbarrxvt_upButton(ev.y))) - tt_printf("\033[A"); + && scrollbarrxvt_upButton (ev.y))) + tt_printf ("\033[A"); else if ((scrollBar.style == R_SB_NEXT - && scrollbarnext_dnButton(ev.y)) + && scrollbarnext_dnButton (ev.y)) || (scrollBar.style == R_SB_RXVT - && scrollbarrxvt_dnButton(ev.y))) - tt_printf("\033[B"); + && scrollbarrxvt_dnButton (ev.y))) + tt_printf ("\033[B"); else switch (ev.button) { case Button2: - tt_printf("\014"); + tt_printf ("\014"); break; case Button1: - tt_printf("\033[6~"); + tt_printf ("\033[6~"); break; case Button3: - tt_printf("\033[5~"); + tt_printf ("\033[5~"); break; } } @@ -1736,16 +1736,16 @@ rxvt_term::button_press (const XButtonEvent &ev) if (scrollBar.style == R_SB_NEXT) { - if (scrollbarnext_upButton(ev.y)) + if (scrollbarnext_upButton (ev.y)) upordown = -1; /* up */ - else if (scrollbarnext_dnButton(ev.y)) + else if (scrollbarnext_dnButton (ev.y)) upordown = 1; /* down */ } else if (scrollBar.style == R_SB_RXVT) { - if (scrollbarrxvt_upButton(ev.y)) + if (scrollbarrxvt_upButton (ev.y)) upordown = -1; /* up */ - else if (scrollbarrxvt_dnButton(ev.y)) + else if (scrollbarrxvt_dnButton (ev.y)) upordown = 1; /* down */ } if (upordown) @@ -1778,10 +1778,10 @@ rxvt_term::button_press (const XButtonEvent &ev) break; } if (scrollBar.style == R_SB_XTERM - || scrollbar_above_slider(ev.y) - || scrollbar_below_slider(ev.y)) - scr_move_to ( scrollbar_position(ev.y) - csrO, - scrollbar_size()); + || scrollbar_above_slider (ev.y) + || scrollbar_below_slider (ev.y)) + scr_move_to ( scrollbar_position (ev.y) - csrO, + scrollbar_size ()); scrollBar.setMotion (); break; @@ -1793,13 +1793,13 @@ rxvt_term::button_press (const XButtonEvent &ev) case Button3: if (scrollBar.style != R_SB_XTERM) { - if (scrollbar_above_slider(ev.y)) + if (scrollbar_above_slider (ev.y)) # ifdef RXVT_SCROLL_FULL scr_page (UP, TermWin.nrow - 1); # else scr_page (UP, TermWin.nrow / 4); # endif - else if (scrollbar_below_slider(ev.y)) + else if (scrollbar_below_slider (ev.y)) # ifdef RXVT_SCROLL_FULL scr_page (DN, TermWin.nrow - 1); # else @@ -1812,8 +1812,8 @@ rxvt_term::button_press (const XButtonEvent &ev) { scr_page ((ev.button == Button1 ? DN : UP), (TermWin.nrow - * scrollbar_position(ev.y) - / scrollbar_size())); + * scrollbar_position (ev.y) + / scrollbar_size ())); } break; } @@ -1824,7 +1824,7 @@ rxvt_term::button_press (const XButtonEvent &ev) /* * Menubar window processing of button press */ - if (isMenuBarWindow(ev.window)) + if (isMenuBarWindow (ev.window)) menubar_control (ev); #endif } @@ -1836,9 +1836,9 @@ rxvt_term::button_release (const XButtonEvent &ev) csrO = 0; /* reset csr Offset */ if (!bypass_keystate) - reportmode = !!(PrivateModes & PrivMode_mouse_report); + reportmode = !! (PrivateModes & PrivMode_mouse_report); - if (scrollbar_isUpDn()) + if (scrollbar_isUpDn ()) { scrollBar.setIdle (); scrollbar_show (0); @@ -1854,7 +1854,7 @@ rxvt_term::button_release (const XButtonEvent &ev) { #ifdef RXVT_GRAPHICS if (ev.subwindow != None) - rxvt_Gr_ButtonRelease(ev.x, ev.y); + rxvt_Gr_ButtonRelease (ev.x, ev.y); else #endif @@ -1942,7 +1942,7 @@ rxvt_term::button_release (const XButtonEvent &ev) } } #ifdef MENUBAR - else if (isMenuBarWindow(ev.window)) + else if (isMenuBarWindow (ev.window)) menubar_control (ev); #endif } @@ -1966,19 +1966,19 @@ rxvt_term::check_our_parents () pchanged = 0; - if (!(Options & Opt_transparent)) + if (! (Options & Opt_transparent)) return pchanged; /* Don't try any more */ - XGetWindowAttributes(display->display, display->root, &wrootattr); + XGetWindowAttributes (display->display, display->root, &wrootattr); rootdepth = wrootattr.depth; - XGetWindowAttributes(display->display, TermWin.parent[0], &wattr); + XGetWindowAttributes (display->display, TermWin.parent[0], &wattr); if (rootdepth != wattr.depth) { if (am_transparent) { pchanged = 1; - XSetWindowBackground(display->display, TermWin.vt, + XSetWindowBackground (display->display, TermWin.vt, PixColors[Color_bg]); am_transparent = am_pixmap_trans = 0; } @@ -1986,7 +1986,7 @@ rxvt_term::check_our_parents () } /* Get all X ops out of the queue so that our information is up-to-date. */ - XSync(display->display, False); + XSync (display->display, False); /* * Make the frame window set by the window manager have @@ -1994,7 +1994,7 @@ rxvt_term::check_our_parents () * windows for each client, so we have to take care about that. */ i = (xa[XA_XROOTPMAPID] != 0 - && (XGetWindowProperty(display->display, display->root, xa[XA_XROOTPMAPID], + && (XGetWindowProperty (display->display, display->root, xa[XA_XROOTPMAPID], 0L, 1L, False, XA_PIXMAP, &atype, &aformat, &nitems, &bytes_after, &prop) == Success)); if (!i || prop == NULL) @@ -2002,8 +2002,8 @@ rxvt_term::check_our_parents () else { have_pixmap = 1; - rootpixmap = *((Pixmap *)prop); - XFree(prop); + rootpixmap = * ((Pixmap *)prop); + XFree (prop); } if (have_pixmap) { @@ -2017,7 +2017,7 @@ rxvt_term::check_our_parents () GC gc; XGCValues gcvalue; - XTranslateCoordinates(display->display, TermWin.parent[0], display->root, + XTranslateCoordinates (display->display, TermWin.parent[0], display->root, 0, 0, &sx, &sy, &cr); nw = (unsigned int)szHint.width; nh = (unsigned int)szHint.height; @@ -2034,10 +2034,10 @@ rxvt_term::check_our_parents () ny = -sy; sy = 0; } - MIN_IT(nw, (unsigned int)(wrootattr.width - sx)); - MIN_IT(nh, (unsigned int)(wrootattr.height - sy)); + MIN_IT (nw, (unsigned int) (wrootattr.width - sx)); + MIN_IT (nh, (unsigned int) (wrootattr.height - sy)); allowedxerror = -1; - image = XGetImage(display->display, rootpixmap, sx, sy, nw, nh, AllPlanes, + image = XGetImage (display->display, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); /* XXX: handle BadMatch - usually because we're outside the pixmap */ /* XXX: may need a delay here? */ @@ -2049,7 +2049,7 @@ rxvt_term::check_our_parents () pchanged = 1; if (TermWin.pixmap != None) { - XFreePixmap(display->display, TermWin.pixmap); + XFreePixmap (display->display, TermWin.pixmap); TermWin.pixmap = None; } } @@ -2058,18 +2058,18 @@ rxvt_term::check_our_parents () else { if (TermWin.pixmap != None) - XFreePixmap(display->display, TermWin.pixmap); - TermWin.pixmap = XCreatePixmap(display->display, TermWin.vt, + XFreePixmap (display->display, TermWin.pixmap); + TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt, (unsigned int)szHint.width, (unsigned int)szHint.height, (unsigned int)image->depth); - gc = XCreateGC(display->display, TermWin.vt, 0UL, &gcvalue); - XPutImage(display->display, TermWin.pixmap, gc, image, 0, 0, + gc = XCreateGC (display->display, TermWin.vt, 0UL, &gcvalue); + XPutImage (display->display, TermWin.pixmap, gc, image, 0, 0, nx, ny, (unsigned int)image->width, (unsigned int)image->height); - XFreeGC(display->display, gc); - XDestroyImage(image); - XSetWindowBackgroundPixmap(display->display, TermWin.vt, + XFreeGC (display->display, gc); + XDestroyImage (image); + XSetWindowBackgroundPixmap (display->display, TermWin.vt, TermWin.pixmap); if (!am_transparent || !am_pixmap_trans) pchanged = 1; @@ -2082,15 +2082,15 @@ rxvt_term::check_our_parents () /* * InheritPixmap transparency */ - D_X((stderr, "InheritPixmap Seeking to %08lx", display->root)); - for (i = 1; i < (int)(sizeof(TermWin.parent) / sizeof(Window)); + D_X ((stderr, "InheritPixmap Seeking to %08lx", display->root)); + for (i = 1; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++) { oldp = TermWin.parent[i]; - XQueryTree(display->display, TermWin.parent[i - 1], &root, + XQueryTree (display->display, TermWin.parent[i - 1], &root, &TermWin.parent[i], &list, &n); - XFree(list); - D_X((stderr, "InheritPixmap Parent[%d] = %08lx", i, TermWin.parent[i])); + XFree (list); + D_X ((stderr, "InheritPixmap Parent[%d] = %08lx", i, TermWin.parent[i])); if (TermWin.parent[i] == display->root) { if (oldp != None) @@ -2105,22 +2105,22 @@ rxvt_term::check_our_parents () { for (; n < (unsigned int)i; n++) { - XGetWindowAttributes(display->display, TermWin.parent[n], &wattr); - D_X((stderr, "InheritPixmap Checking Parent[%d]: %s", n, (wattr.depth == rootdepth && wattr.class != InputOnly) ? "OK" : "FAIL")); + XGetWindowAttributes (display->display, TermWin.parent[n], &wattr); + D_X ((stderr, "InheritPixmap Checking Parent[%d]: %s", n, (wattr.depth == rootdepth && wattr.class != InputOnly) ? "OK" : "FAIL")); if (wattr.depth != rootdepth || wattr.c_class == InputOnly) { - n = (int)(sizeof(TermWin.parent) / sizeof(Window)) + 1; + n = (int) (sizeof (TermWin.parent) / sizeof (Window)) + 1; break; } } } - if (n > (int)(sizeof(TermWin.parent) - / sizeof(TermWin.parent[0]))) + if (n > (int) (sizeof (TermWin.parent) + / sizeof (TermWin.parent[0]))) { - D_X((stderr, "InheritPixmap Turning off")); - XSetWindowBackground(display->display, TermWin.parent[0], + D_X ((stderr, "InheritPixmap Turning off")); + XSetWindowBackground (display->display, TermWin.parent[0], PixColors[Color_fg]); - XSetWindowBackground(display->display, TermWin.vt, + XSetWindowBackground (display->display, TermWin.vt, PixColors[Color_bg]); am_transparent = 0; /* XXX: also turn off Opt_transparent? */ @@ -2134,19 +2134,19 @@ rxvt_term::check_our_parents () rqt.tv_sec = 1; rqt.tv_nsec = 0; - nanosleep(&rqt, NULL); + nanosleep (&rqt, NULL); # else - sleep(1); + sleep (1); # endif - D_X((stderr, "InheritPixmap Turning on (%d parents)", i - 1)); + D_X ((stderr, "InheritPixmap Turning on (%d parents)", i - 1)); for (n = 0; n < (unsigned int)i; n++) - XSetWindowBackgroundPixmap(display->display, TermWin.parent[n], + XSetWindowBackgroundPixmap (display->display, TermWin.parent[n], ParentRelative); - XSetWindowBackgroundPixmap(display->display, TermWin.vt, + XSetWindowBackgroundPixmap (display->display, TermWin.vt, ParentRelative); am_transparent = 1; } - for (; i < (int)(sizeof(TermWin.parent) / sizeof(Window)); i++) + for (; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++) TermWin.parent[i] = None; } return pchanged; @@ -2161,10 +2161,10 @@ rxvt_term::check_our_parents () FILE * rxvt_term::popen_printer () { - FILE *stream = popen(rs[Rs_print_pipe], "w"); + FILE *stream = popen (rs[Rs_print_pipe], "w"); if (stream == NULL) - rxvt_print_error("can't open printer pipe"); + rxvt_print_error ("can't open printer pipe"); return stream; } @@ -2172,7 +2172,7 @@ int rxvt_term::pclose_printer (FILE *stream) { fflush (stream); - /* pclose() reported not to work on SunOS 4.1.3 */ + /* pclose () reported not to work on SunOS 4.1.3 */ # if defined (__sun__) /* TODO: RESOLVE THIS */ /* pclose works provided SIGCHLD handler uses waitpid */ return pclose (stream); /* return fclose (stream); */ @@ -2205,7 +2205,7 @@ rxvt_term::process_print_pipe () if ((ch = cmd_getc ()) != C0_ESC) { - if (putc(ch, fd) == EOF) + if (putc (ch, fd) == EOF) break; /* done = 1 */ } else @@ -2227,7 +2227,7 @@ rxvt_term::process_print_pipe () } } for (i = 0; i < len; i++) - if (putc(buf[i], fd) == EOF) + if (putc (buf[i], fd) == EOF) { done = 1; break; @@ -2257,12 +2257,12 @@ rxvt_term::process_nonprinting (unsigned char ch) { case C0_ENQ: /* terminal Status */ if (rs[Rs_answerbackstring]) - tt_write( + tt_write ( (const unsigned char *)rs[Rs_answerbackstring], - (unsigned int)STRLEN(rs[Rs_answerbackstring])); + (unsigned int)STRLEN (rs[Rs_answerbackstring])); else - tt_write((unsigned char *)VT100_ANS, - (unsigned int)STRLEN(VT100_ANS)); + tt_write ((unsigned char *)VT100_ANS, + (unsigned int)STRLEN (VT100_ANS)); break; case C0_BEL: /* bell */ scr_bell (); @@ -2334,10 +2334,10 @@ rxvt_term::process_escape_vt52 (unsigned char ch) scr_gotorc (row, col, 0); break; case 'Z': /* identify the terminal type */ - tt_printf("\033/Z"); /* I am a VT100 emulating a VT52 */ + tt_printf ("\033/Z"); /* I am a VT100 emulating a VT52 */ break; case '<': /* turn off VT52 mode */ - PrivMode(0, PrivMode_vt52); + PrivMode (0, PrivMode_vt52); break; case 'F': /* use special graphics character set */ case 'G': /* use regular character set */ @@ -2371,7 +2371,7 @@ rxvt_term::process_escape_seq () if (cmd_getc () == '8') scr_E (); break; - case '(': + case ' (': scr_charset_set (0, (unsigned int)cmd_getc ()); break; case ')': @@ -2406,7 +2406,7 @@ rxvt_term::process_escape_seq () #endif case '=': case '>': - PrivMode((ch == '='), PrivMode_aplKP); + PrivMode ((ch == '='), PrivMode_aplKP); break; case C1_40: @@ -2452,8 +2452,8 @@ rxvt_term::process_escape_seq () /* 8.3.110: SINGLE CHARACTER INTRODUCER */ case C1_SCI: /* ESC Z */ - tt_write((const unsigned char *)ESCZ_ANSWER, - (unsigned int)(sizeof(ESCZ_ANSWER) - 1)); + tt_write ((const unsigned char *)ESCZ_ANSWER, + (unsigned int) (sizeof (ESCZ_ANSWER) - 1)); break; /* steal obsolete ESC [ c */ /* 8.3.16: CONTROL SEQUENCE INTRODUCER */ @@ -2503,18 +2503,18 @@ enum { (((b7) << 7) | ((b6) << 6) | ((b5) << 5) | ((b4) << 4) \ | ((b3) << 3) | ((b2) << 2) | ((b1) << 1) | (b0)) #define get_byte_array_bit(array, bit) \ - (!!((array)[(bit) / 8] & (128 >> ((bit) & 7)))) + (!! ((array)[ (bit) / 8] & (128 >> ((bit) & 7)))) const unsigned char csi_defaults[] = { - make_byte(1,1,1,1,1,1,1,1), /* @, A, B, C, D, E, F, G, */ - make_byte(1,1,0,0,1,1,0,0), /* H, I, J, K, L, M, N, O, */ - make_byte(1,0,1,1,1,1,1,0), /* P, Q, R, S, T, U, V, W, */ - make_byte(1,1,1,0,0,0,1,0), /* X, Y, Z, [, \, ], ^, _, */ - make_byte(1,1,1,0,1,1,1,0), /* `, a, b, c, d, e, f, g, */ - make_byte(0,0,1,1,0,0,0,0), /* h, i, j, k, l, m, n, o, */ - make_byte(0,0,0,0,0,0,0,0), /* p, q, r, s, t, u, v, w, */ - make_byte(0,0,0,0,0,0,0,0) /* x, y, z, {, |, }, ~, */ + make_byte (1,1,1,1,1,1,1,1), /* @, A, B, C, D, E, F, G, */ + make_byte (1,1,0,0,1,1,0,0), /* H, I, J, K, L, M, N, O, */ + make_byte (1,0,1,1,1,1,1,0), /* P, Q, R, S, T, U, V, W, */ + make_byte (1,1,1,0,0,0,1,0), /* X, Y, Z, [, \, ], ^, _, */ + make_byte (1,1,1,0,1,1,1,0), /* `, a, b, c, d, e, f, g, */ + make_byte (0,0,1,1,0,0,0,0), /* h, i, j, k, l, m, n, o, */ + make_byte (0,0,0,0,0,0,0,0), /* p, q, r, s, t, u, v, w, */ + make_byte (0,0,0,0,0,0,0,0) /* x, y, z, {, |, }, ~, */ }; /* *INDENT-ON* */ @@ -2539,7 +2539,7 @@ rxvt_term::process_csi_seq () /* read any numerical arguments */ for (n = -1; ch < CSI_ICH; ) { - if (isdigit(ch)) + if (isdigit (ch)) { if (n < 0) n = ch - '0'; @@ -2575,16 +2575,16 @@ rxvt_term::process_csi_seq () arg[nargs++] = n; i = ch - CSI_ICH; - ndef = get_byte_array_bit(csi_defaults, i); + ndef = get_byte_array_bit (csi_defaults, i); for (p = 0; p < nargs; p++) if (arg[p] == -1) arg[p] = ndef; #ifdef DEBUG_CMD - fprintf(stderr, "CSI "); + fprintf (stderr, "CSI "); for (p = 0; p < nargs; p++) - fprintf(stderr, "%d%s", arg[p], p < nargs - 1 ? ";" : ""); - fprintf(stderr, "%c\n", ch); + fprintf (stderr, "%d%s", arg[p], p < nargs - 1 ? ";" : ""); + fprintf (stderr, "%c\n", ch); #endif /* @@ -2596,7 +2596,7 @@ rxvt_term::process_csi_seq () { case '>': if (ch == CSI_DA) /* secondary device attributes */ - tt_printf("\033[>%d;%-.8s;0c", 'R', VSTRING); + tt_printf ("\033[>%d;%-.8s;0c", 'R', VSTRING); break; case '?': if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') @@ -2609,7 +2609,7 @@ rxvt_term::process_csi_seq () switch (ch) { /* - * ISO/IEC 6429:1992(E) CSI sequences (defaults in parentheses) + * ISO/IEC 6429:1992 (E) CSI sequences (defaults in parentheses) */ #ifdef PRINTPIPE case CSI_MC: /* 8.3.83: (0) MEDIA COPY */ @@ -2715,8 +2715,8 @@ rxvt_term::process_csi_seq () break; case CSI_DA: /* 8.3.24: (0) DEVICE ATTRIBUTES */ - tt_write((const unsigned char *)VT100_ANS, - (unsigned int)(sizeof(VT100_ANS) - 1)); + tt_write ((const unsigned char *)VT100_ANS, + (unsigned int) (sizeof (VT100_ANS) - 1)); break; case CSI_SGR: /* 8.3.118: (0) SELECT GRAPHIC RENDITION */ @@ -2727,14 +2727,14 @@ rxvt_term::process_csi_seq () switch (arg[0]) { case 5: /* DSR requested */ - tt_printf("\033[0n"); + tt_printf ("\033[0n"); break; case 6: /* CPR requested */ scr_report_position (); break; #if defined (ENABLE_DISPLAY_ANSWER) case 7: /* unofficial extension */ - tt_printf("%-.250s\n", rs[Rs_display_name]); + tt_printf ("%-.250s\n", rs[Rs_display_name]); break; #endif case 8: /* unofficial extension */ @@ -2815,7 +2815,7 @@ rxvt_term::process_csi_seq () case CSI_78: /* DECREQTPARM */ if (arg[0] == 0 || arg[0] == 1) - tt_printf("\033[%d;1;1;128;128;1;0x", arg[0] + 2); + tt_printf ("\033[%d;1;1;128;128;1;0x", arg[0] + 2); /* FALLTHROUGH */ default: @@ -2844,65 +2844,65 @@ rxvt_term::process_window_ops (const int *args, unsigned int nargs) * commands */ case 1: /* deiconify window */ - XMapWindow(display->display, TermWin.parent[0]); + XMapWindow (display->display, TermWin.parent[0]); break; case 2: /* iconify window */ - XIconifyWindow(display->display, TermWin.parent[0], - DefaultScreen(display->display)); + XIconifyWindow (display->display, TermWin.parent[0], + DefaultScreen (display->display)); break; case 3: /* set position (pixels) */ - XMoveWindow(display->display, TermWin.parent[0], args[1], args[2]); + XMoveWindow (display->display, TermWin.parent[0], args[1], args[2]); break; case 4: /* set size (pixels) */ set_widthheight ((unsigned int)args[2], (unsigned int)args[1]); break; case 5: /* raise window */ - XRaiseWindow(display->display, TermWin.parent[0]); + XRaiseWindow (display->display, TermWin.parent[0]); break; case 6: /* lower window */ - XLowerWindow(display->display, TermWin.parent[0]); + XLowerWindow (display->display, TermWin.parent[0]); break; case 7: /* refresh window */ scr_touch (true); break; case 8: /* set size (chars) */ - set_widthheight ((unsigned int)(args[2] * TermWin.fwidth), - (unsigned int)(args[1] * TermWin.fheight)); + set_widthheight ((unsigned int) (args[2] * TermWin.fwidth), + (unsigned int) (args[1] * TermWin.fheight)); break; default: if (args[0] >= 24) /* set height (chars) */ set_widthheight ((unsigned int)TermWin.width, - (unsigned int)(args[1] * TermWin.fheight)); + (unsigned int) (args[1] * TermWin.fheight)); break; /* * reports - some output format copied from XTerm */ case 11: /* report window state */ - XGetWindowAttributes(display->display, TermWin.parent[0], &wattr); - tt_printf("\033[%dt", wattr.map_state == IsViewable ? 1 : 2); + XGetWindowAttributes (display->display, TermWin.parent[0], &wattr); + tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2); break; case 13: /* report window position */ - XGetWindowAttributes(display->display, TermWin.parent[0], &wattr); - XTranslateCoordinates(display->display, TermWin.parent[0], wattr.root, + XGetWindowAttributes (display->display, TermWin.parent[0], &wattr); + XTranslateCoordinates (display->display, TermWin.parent[0], wattr.root, -wattr.border_width, -wattr.border_width, &x, &y, &wdummy); - tt_printf("\033[3;%d;%dt", x, y); + tt_printf ("\033[3;%d;%dt", x, y); break; case 14: /* report window size (pixels) */ - XGetWindowAttributes(display->display, TermWin.parent[0], &wattr); - tt_printf("\033[4;%d;%dt", wattr.height, wattr.width); + XGetWindowAttributes (display->display, TermWin.parent[0], &wattr); + tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width); break; case 18: /* report window size (chars) */ - tt_printf("\033[8;%d;%dt", TermWin.nrow, TermWin.ncol); + tt_printf ("\033[8;%d;%dt", TermWin.nrow, TermWin.ncol); break; #if 0 /* XXX: currently disabled due to security concerns */ case 20: /* report icon label */ - XGetIconName(display->display, TermWin.parent[0], &s); - tt_printf("\033]L%-.200s\234", s ? s : ""); /* 8bit ST */ + XGetIconName (display->display, TermWin.parent[0], &s); + tt_printf ("\033]L%-.200s\234", s ? s : ""); /* 8bit ST */ break; case 21: /* report window title */ - XFetchName(display->display, TermWin.parent[0], &s); - tt_printf("\033]l%-.200s\234", s ? s : ""); /* 8bit ST */ + XFetchName (display->display, TermWin.parent[0], &s); + tt_printf ("\033]l%-.200s\234", s ? s : ""); /* 8bit ST */ break; #endif @@ -2913,7 +2913,7 @@ rxvt_term::process_window_ops (const int *args, unsigned int nargs) /*----------------------------------------------------------------------*/ /* * get input up until STRING TERMINATOR (or BEL) - * ends_how is terminator used. returned input must be free()d + * ends_how is terminator used. returned input must be free ()d */ unsigned char * rxvt_term::get_to_st (unsigned char *ends_how) @@ -2938,15 +2938,15 @@ rxvt_term::get_to_st (unsigned char *ends_how) ch = ' '; /* translate '\t' to space */ else if (ch < 0x08 || (ch > 0x0d && ch < 0x20)) return NULL; /* other control character - exit */ - if (n < sizeof(string) - 1) + if (n < sizeof (string) - 1) string[n++] = ch; seen_esc = 0; } string[n++] = '\0'; - if ((s = (unsigned char *)rxvt_malloc(n)) == NULL) + if ((s = (unsigned char *)rxvt_malloc (n)) == NULL) return NULL; *ends_how = (ch == 0x5c ? C0_ESC : ch); - STRNCPY(s, string, n); + STRNCPY (s, string, n); return s; } @@ -2963,7 +2963,7 @@ rxvt_term::process_dcs_seq () */ s = get_to_st (&eh); if (s) - free(s); + free (s); return; } @@ -2978,7 +2978,7 @@ rxvt_term::process_osc_seq () int arg; ch = cmd_getc (); - for (arg = 0; isdigit(ch); ch = cmd_getc ()) + for (arg = 0; isdigit (ch); ch = cmd_getc ()) arg = arg * 10 + (ch - '0'); if (ch == ';') @@ -2987,7 +2987,7 @@ rxvt_term::process_osc_seq () if (s) { /* - * rxvt_menubar_dispatch() violates the constness of the string, + * rxvt_menubar_dispatch () violates the constness of the string, * so do it here */ if (arg == XTerm_Menu) @@ -2998,7 +2998,7 @@ rxvt_term::process_osc_seq () #endif else xterm_seq (arg, (char *)s, eh); - free(s); + free (s); } } } @@ -3024,13 +3024,13 @@ rxvt_term::process_osc_seq () * 55 = dump scrollback buffer and all of screen */ void -rxvt_term::xterm_seq (int op, const char *str, unsigned char resp __attribute__((unused))) +rxvt_term::xterm_seq (int op, const char *str, unsigned char resp __attribute__ ((unused))) { int changed = 0; int color; char *buf, *name; - assert(str != NULL); + assert (str != NULL); switch (op) { case XTerm_name: @@ -3045,13 +3045,13 @@ rxvt_term::xterm_seq (int op, const char *str, unsigned char resp __attribute__( case XTerm_Color: for (buf = (char *)str; buf && *buf;) { - if ((name = STRCHR(buf, ';')) == NULL) + if ((name = STRCHR (buf, ';')) == NULL) break; *name++ = '\0'; - color = atoi(buf); + color = atoi (buf); if (color < 0 || color >= TOTAL_COLORS) break; - if ((buf = STRCHR(name, ';')) != NULL) + if ((buf = STRCHR (name, ';')) != NULL) *buf++ = '\0'; set_window_color (color + minCOLOR, name); } @@ -3078,7 +3078,7 @@ rxvt_term::xterm_seq (int op, const char *str, unsigned char resp __attribute__( case XTerm_Menu: /* - * rxvt_menubar_dispatch() violates the constness of the string, + * rxvt_menubar_dispatch () violates the constness of the string, * so DON'T do it here */ break; @@ -3091,7 +3091,7 @@ rxvt_term::xterm_seq (int op, const char *str, unsigned char resp __attribute__( #endif scr_touch (true); } - while ((str = STRCHR(str, ';')) != NULL) + while ((str = STRCHR (str, ';')) != NULL) { str++; #if XPM_BACKGROUND @@ -3123,10 +3123,10 @@ rxvt_term::xterm_seq (int op, const char *str, unsigned char resp __attribute__( case XTerm_dumpscreen: /* no error notices */ { int fd; - if ((fd = open(str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) + if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) { scr_dump (fd); - close(fd); + close (fd); } } break; @@ -3161,15 +3161,15 @@ rxvt_term::privcases (int mode, unsigned long bit) if (mode == 'r') state = (SavedModes & bit) ? 1 : 0; /* no overlapping */ else - state = (mode == 't') ? !(PrivateModes & bit) : mode; - PrivMode(state, bit); + state = (mode == 't') ? ! (PrivateModes & bit) : mode; + PrivMode (state, bit); } return state; } /* we're not using priv _yet_ */ void -rxvt_term::process_terminal_mode (int mode, int priv __attribute__((unused)), unsigned int nargs, const int *arg) +rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), unsigned int nargs, const int *arg) { unsigned int i, j; int state; @@ -3222,7 +3222,7 @@ rxvt_term::process_terminal_mode (int mode, int priv __attribute__((unused)), un state = -1; /* basic handling */ - for (j = 0; j < (sizeof(argtopriv)/sizeof(argtopriv[0])); j++) + for (j = 0; j < (sizeof (argtopriv)/sizeof (argtopriv[0])); j++) if (argtopriv[j].argval == arg[i]) { state = privcases (mode, argtopriv[j].bit); @@ -3240,7 +3240,7 @@ rxvt_term::process_terminal_mode (int mode, int priv __attribute__((unused)), un scr_cursor (SAVE); /* FALLTHROUGH */ default: - continue; /* for(;i;) */ + continue; /* for (;i;) */ } /* extra handling for values with valid 0 or 1 state */ @@ -3252,11 +3252,11 @@ rxvt_term::process_terminal_mode (int mode, int priv __attribute__((unused)), un * parameter. Return from VT52 mode with an ESC < from * within VT52 mode */ - PrivMode(1, PrivMode_vt52); + PrivMode (1, PrivMode_vt52); break; case 3: /* 80/132 */ if (PrivateModes & PrivMode_132OK) - set_widthheight ( (unsigned int)((state ? 132 : 80) * TermWin.fwidth), + set_widthheight ( (unsigned int) ((state ? 132 : 80) * TermWin.fwidth), (unsigned int)TermWin.height); break; case 4: /* smooth scrolling */ @@ -3277,7 +3277,7 @@ rxvt_term::process_terminal_mode (int mode, int priv __attribute__((unused)), un /* case 8: - auto repeat, can't do on a per window basis */ case 9: /* X10 mouse reporting */ if (state) /* orthogonal */ - PrivateModes &= ~(PrivMode_MouseX11); + PrivateModes &= ~ (PrivMode_MouseX11); break; #ifdef menuBar_esc case menuBar_esc: @@ -3307,7 +3307,7 @@ rxvt_term::process_terminal_mode (int mode, int priv __attribute__((unused)), un /* case 67: - backspace key */ case 1000: /* X11 mouse reporting */ if (state) /* orthogonal */ - PrivateModes &= ~(PrivMode_MouseX10); + PrivateModes &= ~ (PrivMode_MouseX10); break; #if 0 case 1001: @@ -3387,7 +3387,7 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg) if (rendset != -1) { scr_rendition (rendset, rendstyle); - continue; /* for(;i;) */ + continue; /* for (;i;) */ } switch (arg[i]) @@ -3400,14 +3400,14 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg) case 35: case 36: case 37: - scr_color ((unsigned int)(minCOLOR + (arg[i] - 30)), + scr_color ((unsigned int) (minCOLOR + (arg[i] - 30)), Color_fg); break; #ifdef TTY_256COLOR case 38: if (nargs > i + 2 && arg[i + 1] == 5) { - scr_color ((unsigned int)(minCOLOR + arg[i + 2]), + scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_fg); i += 2; } @@ -3425,14 +3425,14 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg) case 45: case 46: case 47: - scr_color ((unsigned int)(minCOLOR + (arg[i] - 40)), + scr_color ((unsigned int) (minCOLOR + (arg[i] - 40)), Color_bg); break; #ifdef TTY_256COLOR case 48: if (nargs > i + 2 && arg[i + 1] == 5) { - scr_color ((unsigned int)(minCOLOR + arg[i + 2]), + scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_bg); i += 2; } @@ -3451,7 +3451,7 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg) case 95: case 96: case 97: - scr_color ((unsigned int)(minBrightCOLOR + (arg[i] - 90)), + scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 90)), Color_fg); break; case 100: @@ -3462,7 +3462,7 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg) case 105: case 106: case 107: - scr_color ((unsigned int)(minBrightCOLOR + (arg[i] - 100)), + scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg); break; #endif @@ -3481,7 +3481,7 @@ rxvt_term::process_graphics () #ifndef RXVT_GRAPHICS if (cmd == 'Q') { /* query graphics */ - tt_printf("\033G0\n"); /* no graphics */ + tt_printf ("\033G0\n"); /* no graphics */ return; } /* swallow other graphics sequences until terminating ':' */ @@ -3495,10 +3495,10 @@ rxvt_term::process_graphics () if (cmd == 'Q') { /* query graphics */ - tt_printf("\033G1\n"); /* yes, graphics (color) */ + tt_printf ("\033G1\n"); /* yes, graphics (color) */ return; } - for (nargs = 0; nargs < (sizeof(args) / sizeof(args[0])) - 1;) + for (nargs = 0; nargs < (sizeof (args) / sizeof (args[0])) - 1;) { int neg; @@ -3507,7 +3507,7 @@ rxvt_term::process_graphics () if (neg || ch == '+') ch = cmd_getc (); - for (args[nargs] = 0; isdigit(ch); ch = cmd_getc ()) + for (args[nargs] = 0; isdigit (ch); ch = cmd_getc ()) args[nargs] = args[nargs] * 10 + (ch - '0'); if (neg) args[nargs] = -args[nargs]; @@ -3522,7 +3522,7 @@ rxvt_term::process_graphics () { int i, len = args[4]; - text = (unsigned char *)rxvt_malloc((len + 1) * sizeof(char)); + text = (unsigned char *)rxvt_malloc ((len + 1) * sizeof (char)); if (text != NULL) { @@ -3539,7 +3539,7 @@ rxvt_term::process_graphics () /* ------------------------------------------------------------------------- */ /* - * Send printf() formatted output to the command. + * Send printf () formatted output to the command. * Only use for small amounts of data. */ void diff --git a/src/menubar.C b/src/menubar.C index efdffc48..0ddcdfa8 100644 --- a/src/menubar.C +++ b/src/menubar.C @@ -50,13 +50,13 @@ Arrows[NARROWS] = { * find an item called NAME in MENU */ menuitem_t * -rxvt_menuitem_find(const menu_t *menu, const char *name) +rxvt_menuitem_find (const menu_t *menu, const char *name) { menuitem_t *item; #ifdef DEBUG_STRICT - assert(name != NULL); - assert(menu != NULL); + assert (name != NULL); + assert (menu != NULL); #endif /* find the last item in the menu, this is good for separators */ @@ -64,11 +64,11 @@ rxvt_menuitem_find(const menu_t *menu, const char *name) { if (item->entry.type == MenuSubMenu) { - if (!STRCMP(name, (item->entry.submenu.menu)->name)) + if (!STRCMP (name, (item->entry.submenu.menu)->name)) break; } - else if ((isSeparator(name) && isSeparator(item->name)) - || !STRCMP(name, item->name)) + else if ((isSeparator (name) && isSeparator (item->name)) + || !STRCMP (name, item->name)) break; } return item; @@ -84,7 +84,7 @@ rxvt_term::menuitem_free (menu_t *menu, menuitem_t *item) menuitem_t *prev, *next; #ifdef DEBUG_STRICT - assert(menu != NULL); + assert (menu != NULL); #endif prev = item->prev; @@ -104,17 +104,17 @@ rxvt_term::menuitem_free (menu_t *menu, menuitem_t *item) { case MenuAction: case MenuTerminalAction: - free(item->entry.action.str); + free (item->entry.action.str); break; case MenuSubMenu: menu_delete (item->entry.submenu.menu); break; } if (item->name != NULL) - free(item->name); + free (item->name); if (item->name2 != NULL) - free(item->name2); - free(item); + free (item->name2); + free (item); } /* @@ -122,15 +122,15 @@ rxvt_term::menuitem_free (menu_t *menu, menuitem_t *item) * remove the first character of STR if it's '\0' */ int -rxvt_action_type(action_t *action, unsigned char *str) +rxvt_action_type (action_t *action, unsigned char *str) { unsigned int len; #if defined (DEBUG_MENU) || defined (DEBUG_MENUARROWS) - len = STRLEN(str); - fprintf(stderr, "(len %d) = %s\n", len, str); + len = STRLEN (str); + fprintf (stderr, " (len %d) = %s\n", len, str); #else - len = rxvt_Str_escaped((char *)str); + len = rxvt_Str_escaped ((char *)str); #endif if (!len) @@ -180,7 +180,7 @@ rxvt_term::action_dispatch (action_t *action) /* return the arrow index corresponding to NAME */ int -rxvt_menuarrow_find(char name) +rxvt_menuarrow_find (char name) { int i; @@ -198,16 +198,16 @@ rxvt_term::menuarrow_free (char name) if (name) { - i = rxvt_menuarrow_find(name); + i = rxvt_menuarrow_find (name); if (i >= 0) { - action_t *act = &(CurrentBar->arrows[i]); + action_t *act = & (CurrentBar->arrows[i]); switch (act->type) { case MenuAction: case MenuTerminalAction: - free(act->str); + free (act->str); act->str = NULL; act->len = 0; break; @@ -238,13 +238,13 @@ rxvt_term::menuarrow_add (char *string) *cur, parse[NARROWS]; - MEMSET(parse, 0, sizeof(parse)); + MEMSET (parse, 0, sizeof (parse)); - /* fprintf(stderr, "add arrows = `%s'\n", string); */ + /* fprintf (stderr, "add arrows = `%s'\n", string); */ for (p = string; p != NULL && *p; string = p) { p = (string + 3); - /* fprintf(stderr, "parsing at %s\n", string); */ + /* fprintf (stderr, "parsing at %s\n", string); */ switch (string[1]) { case 'b': @@ -255,9 +255,9 @@ rxvt_term::menuarrow_add (char *string) break; default: - i = rxvt_menuarrow_find(string[1]); + i = rxvt_menuarrow_find (string[1]); if (i >= 0) - cur = &(parse[i]); + cur = & (parse[i]); else continue; /* not found */ break; @@ -269,7 +269,7 @@ rxvt_term::menuarrow_add (char *string) if (cur == &end) { - p = STRCHR(string, '\0'); + p = STRCHR (string, '\0'); } else { @@ -277,7 +277,7 @@ rxvt_term::menuarrow_add (char *string) while (1) { - p = STRCHR(next, '<'); + p = STRCHR (next, '<'); if (p != NULL) { if (p[1] && p[2] == '>') @@ -287,7 +287,7 @@ rxvt_term::menuarrow_add (char *string) else { if (beg.str == NULL) /* no end needed */ - p = STRCHR(next, '\0'); + p = STRCHR (next, '\0'); break; } next = (p + 1); @@ -301,17 +301,17 @@ rxvt_term::menuarrow_add (char *string) #ifdef DEBUG_MENUARROWS cur = &beg; - fprintf(stderr, "(len %d) = %.*s\n", + fprintf (stderr, " (len %d) = %.*s\n", cur->len, cur->len, (cur->str ? cur->str : "")); for (i = 0; i < NARROWS; i++) { - cur = &(parse[i]); - fprintf(stderr, "<%c>(len %d) = %.*s\n", + cur = & (parse[i]); + fprintf (stderr, "<%c> (len %d) = %.*s\n", Arrows[i].name, cur->len, cur->len, (cur->str ? cur->str : "")); } cur = &end; - fprintf(stderr, "(len %d) = %.*s\n", + fprintf (stderr, " (len %d) = %.*s\n", cur->len, cur->len, (cur->str ? cur->str : "")); #endif @@ -330,47 +330,47 @@ rxvt_term::menuarrow_add (char *string) if (!parse[i].len) continue; - str = rxvt_malloc(parse[i].len + xtra_len + 1); + str = rxvt_malloc (parse[i].len + xtra_len + 1); len = 0; if (beg.len) { - STRNCPY(str + len, beg.str, beg.len); + STRNCPY (str + len, beg.str, beg.len); len += beg.len; } - STRNCPY(str + len, parse[i].str, parse[i].len); + STRNCPY (str + len, parse[i].str, parse[i].len); len += parse[i].len; if (end.len) { - STRNCPY(str + len, end.str, end.len); + STRNCPY (str + len, end.str, end.len); len += end.len; } str[len] = '\0'; #ifdef DEBUG_MENUARROWS - fprintf(stderr, "<%c>(len %d) = %s\n", Arrows[i].name, len, str); + fprintf (stderr, "<%c> (len %d) = %s\n", Arrows[i].name, len, str); #endif - if (rxvt_action_type(&(CurrentBar->arrows[i]), str) < 0) - free(str); + if (rxvt_action_type (& (CurrentBar->arrows[i]), str) < 0) + free (str); } } menuitem_t * -rxvt_menuitem_add(menu_t *menu, const char *name, const char *name2, const char *action) +rxvt_menuitem_add (menu_t *menu, const char *name, const char *name2, const char *action) { menuitem_t *item; unsigned int len; #ifdef DEBUG_STRICT - assert(name != NULL); - assert(action != NULL); + assert (name != NULL); + assert (action != NULL); #endif if (menu == NULL) return NULL; - if (isSeparator(name)) + if (isSeparator (name)) { /* add separator, no action */ name = ""; @@ -381,12 +381,12 @@ rxvt_menuitem_add(menu_t *menu, const char *name, const char *name2, const char /* * add/replace existing menu item */ - item = rxvt_menuitem_find(menu, name); + item = rxvt_menuitem_find (menu, name); if (item != NULL) { if (item->name2 != NULL && name2 != NULL) { - free(item->name2); + free (item->name2); item->len2 = 0; item->name2 = NULL; } @@ -394,7 +394,7 @@ rxvt_menuitem_add(menu_t *menu, const char *name, const char *name2, const char { case MenuAction: case MenuTerminalAction: - free(item->entry.action.str); + free (item->entry.action.str); item->entry.action.str = NULL; break; } @@ -402,14 +402,14 @@ rxvt_menuitem_add(menu_t *menu, const char *name, const char *name2, const char } } /* allocate a new itemect */ - item = (menuitem_t *) rxvt_malloc(sizeof(menuitem_t)); + item = (menuitem_t *) rxvt_malloc (sizeof (menuitem_t)); item->len2 = 0; item->name2 = NULL; - len = STRLEN(name); - item->name = rxvt_malloc(len + 1); - STRCPY(item->name, name); + len = STRLEN (name); + item->name = rxvt_malloc (len + 1); + STRCPY (item->name, name); if (name[0] == '.' && name[1] != '.') len = 0; /* hidden menu name */ item->len = len; @@ -431,18 +431,18 @@ rxvt_menuitem_add(menu_t *menu, const char *name, const char *name2, const char Item_Found: if (name2 != NULL && item->name2 == NULL) { - len = STRLEN(name2); + len = STRLEN (name2); if (len == 0) item->name2 = NULL; else { - item->name2 = rxvt_malloc(len + 1); - STRCPY(item->name2, name2); + item->name2 = rxvt_malloc (len + 1); + STRCPY (item->name2, name2); } item->len2 = len; } item->entry.type = MenuLabel; - len = STRLEN(action); + len = STRLEN (action); if (len == 0 && item->name2 != NULL) { @@ -451,12 +451,12 @@ Item_Found: } if (len) { - unsigned char *str = rxvt_malloc(len + 1); + unsigned char *str = rxvt_malloc (len + 1); - STRCPY(str, action); + STRCPY (str, action); - if (rxvt_action_type(&(item->entry.action), str) < 0) - free(str); + if (rxvt_action_type (& (item->entry.action), str) < 0) + free (str); } /* new item and a possible increase in width */ if (menu->width < (item->len + item->len2)) @@ -476,18 +476,18 @@ rxvt_term::menu_find_base (menu_t **menu, char *path) menuitem_t *item; #ifdef DEBUG_STRICT - assert(menu != NULL); - assert(CurrentBar != NULL); + assert (menu != NULL); + assert (CurrentBar != NULL); #endif if (path[0] == '\0') return path; - if (STRCHR(path, '/') != NULL) + if (STRCHR (path, '/') != NULL) { char *p = path; - while ((p = STRCHR(p, '/')) != NULL) + while ((p = STRCHR (p, '/')) != NULL) { p++; if (*p == '/') @@ -498,16 +498,16 @@ rxvt_term::menu_find_base (menu_t **menu, char *path) path++; *menu = NULL; } - while ((p = STRCHR(path, '/')) != NULL) + while ((p = STRCHR (path, '/')) != NULL) { p[0] = '\0'; if (path[0] == '\0') return NULL; - if (!STRCMP(path, DOT)) + if (!STRCMP (path, DOT)) { /* nothing to do */ } - else if (!STRCMP(path, DOTS)) + else if (!STRCMP (path, DOTS)) { if (*menu != NULL) *menu = (*menu)->parent; @@ -525,9 +525,9 @@ rxvt_term::menu_find_base (menu_t **menu, char *path) path = (p + 1); } } - if (!STRCMP(path, DOTS)) + if (!STRCMP (path, DOTS)) { - path += STRLEN(DOTS); + path += STRLEN (DOTS); if (*menu != NULL) *menu = (*menu)->parent; return path; @@ -537,7 +537,7 @@ rxvt_term::menu_find_base (menu_t **menu, char *path) { for (m = CurrentBar->tail; m != NULL; m = m->prev) { - if (!STRCMP(path, m->name)) + if (!STRCMP (path, m->name)) break; } } @@ -547,7 +547,7 @@ rxvt_term::menu_find_base (menu_t **menu, char *path) for (item = (*menu)->tail; item != NULL; item = item->prev) { if (item->entry.type == MenuSubMenu - && !STRCMP(path, (item->entry.submenu.menu)->name)) + && !STRCMP (path, (item->entry.submenu.menu)->name)) { m = (item->entry.submenu.menu); break; @@ -557,7 +557,7 @@ rxvt_term::menu_find_base (menu_t **menu, char *path) if (m != NULL) { *menu = m; - path += STRLEN(path); + path += STRLEN (path); } return path; } @@ -573,7 +573,7 @@ rxvt_term::menu_delete (menu_t *menu) bar_t *CurrentBar = CurrentBar; #ifdef DEBUG_STRICT - assert(CurrentBar != NULL); + assert (CurrentBar != NULL); #endif /* delete the entire menu */ @@ -627,8 +627,8 @@ rxvt_term::menu_delete (menu_t *menu) } if (menu->name != NULL) - free(menu->name); - free(menu); + free (menu->name); + free (menu); return parent; } @@ -640,10 +640,10 @@ rxvt_term::menu_add (menu_t *parent, char *path) bar_t *CurrentBar = CurrentBar; #ifdef DEBUG_STRICT - assert(CurrentBar != NULL); + assert (CurrentBar != NULL); #endif - if (STRCHR(path, '/') != NULL) + if (STRCHR (path, '/') != NULL) { char *p; @@ -653,7 +653,7 @@ rxvt_term::menu_add (menu_t *parent, char *path) path++; parent = NULL; } - while ((p = STRCHR(path, '/')) != NULL) + while ((p = STRCHR (path, '/')) != NULL) { p[0] = '\0'; if (path[0] == '\0') @@ -663,20 +663,20 @@ rxvt_term::menu_add (menu_t *parent, char *path) path = (p + 1); } } - if (!STRCMP(path, DOTS)) + if (!STRCMP (path, DOTS)) return (parent != NULL ? parent->parent : parent); - if (!STRCMP(path, DOT) || path[0] == '\0') + if (!STRCMP (path, DOT) || path[0] == '\0') return parent; /* allocate a new menu */ - menu = (menu_t *) rxvt_malloc(sizeof(menu_t)); + menu = (menu_t *) rxvt_malloc (sizeof (menu_t)); menu->width = 0; menu->parent = parent; - menu->len = STRLEN(path); - menu->name = rxvt_malloc((menu->len + 1)); - STRCPY(menu->name, path); + menu->len = STRLEN (path); + menu->name = rxvt_malloc ((menu->len + 1)); + STRCPY (menu->name, path); /* initialize head/tail */ menu->head = menu->tail = NULL; @@ -702,14 +702,14 @@ rxvt_term::menu_add (menu_t *parent, char *path) { menuitem_t *item; - item = rxvt_menuitem_add(parent, path, "", ""); + item = rxvt_menuitem_add (parent, path, "", ""); if (item == NULL) { - free(menu); + free (menu); return parent; } #ifdef DEBUG_STRICT - assert(item->entry.type == MenuLabel); + assert (item->entry.type == MenuLabel); #endif item->entry.type = MenuSubMenu; item->entry.submenu.menu = menu; @@ -723,12 +723,12 @@ rxvt_term::drawbox_menubar (int x, int len, int state) { GC top, bot; - x = Width2Pixel(x); - len = Width2Pixel(len + HSPACE); + x = Width2Pixel (x); + len = Width2Pixel (len + HSPACE); if (x >= TermWin.width) return; else if (x + len >= TermWin.width) - len = (TermWin_TotalWidth() - x); + len = (TermWin_TotalWidth () - x); #ifdef MENUBAR_SHADOW_IN state = -state; @@ -748,8 +748,8 @@ rxvt_term::drawbox_menubar (int x, int len, int state) break; /* neutral */ } - rxvt_Draw_Shadow(display->display, menuBar.win, top, bot, - x, 0, len, menuBar_TotalHeight()); + rxvt_Draw_Shadow (display->display, menuBar.win, top, bot, + x, 0, len, menuBar_TotalHeight ()); } void @@ -776,12 +776,12 @@ rxvt_term::drawtriangle (int x, int y, int state) break; /* neutral */ } - w = Height2Pixel(1) - 2 * SHADOW; + w = Height2Pixel (1) - 2 * SHADOW; x -= SHADOW + (3 * w / 2); y += SHADOW * 3; - rxvt_Draw_Triangle(display->display, ActiveMenu->win, top, bot, x, y, w, + rxvt_Draw_Triangle (display->display, ActiveMenu->win, top, bot, x, y, w, 'r'); } @@ -808,23 +808,23 @@ rxvt_term::drawbox_menuitem (int y, int state) break; /* neutral */ } - rxvt_Draw_Shadow(display->display, ActiveMenu->win, top, bot, + rxvt_Draw_Shadow (display->display, ActiveMenu->win, top, bot, SHADOW + 0, SHADOW + y, ActiveMenu->w - 2 * (SHADOW), HEIGHT_TEXT + 2 * SHADOW); - XFlush(display->display); + XFlush (display->display); } #ifdef DEBUG_MENU_LAYOUT void -rxvt_print_menu_ancestors(menu_t *menu) +rxvt_print_menu_ancestors (menu_t *menu) { if (menu == NULL) { - fprintf(stderr, "Top Level menu\n"); + fprintf (stderr, "Top Level menu\n"); return; } - fprintf(stderr, "menu %s ", menu->name); + fprintf (stderr, "menu %s ", menu->name); if (menu->parent != NULL) { menuitem_t *item; @@ -839,16 +839,16 @@ rxvt_print_menu_ancestors(menu_t *menu) } if (item == NULL) { - fprintf(stderr, "is an orphan!\n"); + fprintf (stderr, "is an orphan!\n"); return; } } - fprintf(stderr, "\n"); - rxvt_print_menu_ancestors(menu->parent); + fprintf (stderr, "\n"); + rxvt_print_menu_ancestors (menu->parent); } void -rxvt_print_menu_descendants(menu_t *menu) +rxvt_print_menu_descendants (menu_t *menu) { menuitem_t *item; menu_t *parent; @@ -863,31 +863,31 @@ rxvt_print_menu_descendants(menu_t *menu) while (parent != NULL); for (i = 0; i < level; i++) - fprintf(stderr, ">"); - fprintf(stderr, "%s\n", menu->name); + fprintf (stderr, ">"); + fprintf (stderr, "%s\n", menu->name); for (item = menu->head; item != NULL; item = item->next) { if (item->entry.type == MenuSubMenu) { if (item->entry.submenu.menu == NULL) - fprintf(stderr, "> %s == NULL\n", item->name); + fprintf (stderr, "> %s == NULL\n", item->name); else - rxvt_print_menu_descendants(item->entry.submenu.menu); + rxvt_print_menu_descendants (item->entry.submenu.menu); } else { for (i = 0; i < level; i++) - fprintf(stderr, "+"); + fprintf (stderr, "+"); if (item->entry.type == MenuLabel) - fprintf(stderr, "label: "); - fprintf(stderr, "%s\n", item->name); + fprintf (stderr, "label: "); + fprintf (stderr, "%s\n", item->name); } } for (i = 0; i < level; i++) - fprintf(stderr, "<"); - fprintf(stderr, "\n"); + fprintf (stderr, "<"); + fprintf (stderr, "\n"); } #endif @@ -908,31 +908,31 @@ rxvt_term::menu_show () register int h; drawbox_menubar (x, ActiveMenu->len, -1); - x = Width2Pixel(x); + x = Width2Pixel (x); ActiveMenu->y = 1; - ActiveMenu->w = Menu_PixelWidth(ActiveMenu); + ActiveMenu->w = Menu_PixelWidth (ActiveMenu); if ((x + ActiveMenu->w) >= TermWin.width) - x = (TermWin_TotalWidth() - ActiveMenu->w); + x = (TermWin_TotalWidth () - ActiveMenu->w); /* find the height */ for (h = 0, item = ActiveMenu->head; item != NULL; item = item->next) - h += isSeparator(item->name) ? HEIGHT_SEPARATOR + h += isSeparator (item->name) ? HEIGHT_SEPARATOR : HEIGHT_TEXT + 2 * SHADOW; ActiveMenu->h = h + 2 * SHADOW; } if (ActiveMenu->win == None) { - ActiveMenu->win = XCreateSimpleWindow(display->display, TermWin.vt, + ActiveMenu->win = XCreateSimpleWindow (display->display, TermWin.vt, x, ActiveMenu->y, ActiveMenu->w, ActiveMenu->h, 0, PixColors[Color_fg], PixColors[Color_scroll]); - XMapWindow(display->display, ActiveMenu->win); + XMapWindow (display->display, ActiveMenu->win); } - rxvt_Draw_Shadow(display->display, ActiveMenu->win, + rxvt_Draw_Shadow (display->display, ActiveMenu->win, topShadowGC, botShadowGC, 0, 0, ActiveMenu->w, ActiveMenu->h); @@ -943,13 +943,13 @@ rxvt_term::menu_show () for (y = 0, item = ActiveMenu->head; item != NULL; item = item->next) { - const int xoff = (SHADOW + Width2Pixel(HSPACE) / 2); + const int xoff = (SHADOW + Width2Pixel (HSPACE) / 2); register int h; GC gc = menubarGC; - if (isSeparator(item->name)) + if (isSeparator (item->name)) { - rxvt_Draw_Shadow(display->display, ActiveMenu->win, + rxvt_Draw_Shadow (display->display, ActiveMenu->win, topShadowGC, botShadowGC, SHADOW, y + SHADOW + 1, ActiveMenu->w - 2 * SHADOW, 0); @@ -977,7 +977,7 @@ rxvt_term::menu_show () y1 = ActiveMenu->y + y; - menu->w = Menu_PixelWidth(menu); + menu->w = Menu_PixelWidth (menu); /* place sub-menu at midpoint of parent menu */ x1 = ActiveMenu->w / 2; @@ -987,35 +987,35 @@ rxvt_term::menu_show () /* find the height of this submenu */ for (h = 0, it = menu->head; it != NULL; it = it->next) - h += isSeparator(it->name) ? HEIGHT_SEPARATOR + h += isSeparator (it->name) ? HEIGHT_SEPARATOR : HEIGHT_TEXT + 2 * SHADOW; menu->h = h + 2 * SHADOW; /* ensure menu is in window limits */ if ((x1 + menu->w) >= TermWin.width) - x1 = (TermWin_TotalWidth() - menu->w); + x1 = (TermWin_TotalWidth () - menu->w); if ((y1 + menu->h) >= TermWin.height) - y1 = (TermWin_TotalHeight() - menu->h); + y1 = (TermWin_TotalHeight () - menu->h); menu->x = (x1 < 0 ? 0 : x1); menu->y = (y1 < 0 ? 0 : y1); } - else if (item->name2 && !STRCMP(name, item->name2)) + else if (item->name2 && !STRCMP (name, item->name2)) name = NULL; if (len && name) { #ifdef USE_XIM if (TermWin.fontset) - XmbDrawString(display->display, + XmbDrawString (display->display, ActiveMenu->win, TermWin.fontset, gc, xoff, 2 * SHADOW + y + TermWin.font->ascent + 1, name, len); else #endif - XDrawString(display->display, ActiveMenu->win, gc, xoff, + XDrawString (display->display, ActiveMenu->win, gc, xoff, 2 * SHADOW + y + TermWin.font->ascent + 1, name, len); } @@ -1026,16 +1026,16 @@ rxvt_term::menu_show () { #ifdef USE_XIM if (TermWin.fontset) - XmbDrawString(display->display, + XmbDrawString (display->display, ActiveMenu->win, TermWin.fontset, gc, - ActiveMenu->w - (xoff + Width2Pixel(xright)), + ActiveMenu->w - (xoff + Width2Pixel (xright)), 2 * SHADOW + y + TermWin.font->ascent + 1, name, len); else #endif - XDrawString(display->display, ActiveMenu->win, gc, - ActiveMenu->w - (xoff + Width2Pixel(xright)), + XDrawString (display->display, ActiveMenu->win, gc, + ActiveMenu->w - (xoff + Width2Pixel (xright)), 2 * SHADOW + y + TermWin.font->ascent + 1, name, len); } @@ -1046,21 +1046,21 @@ rxvt_term::menu_show () } void -rxvt_term::menu_display (void (*update)(rxvt_t *)) +rxvt_term::menu_display (void (*update) (rxvt_t *)) { menu_t *ActiveMenu = ActiveMenu; if (ActiveMenu == NULL) return; if (ActiveMenu->win != None) - XDestroyWindow(display->display, ActiveMenu->win); + XDestroyWindow (display->display, ActiveMenu->win); ActiveMenu->win = None; ActiveMenu->item = NULL; if (ActiveMenu->parent == NULL) drawbox_menubar (ActiveMenu->x, ActiveMenu->len, +1); ActiveMenu = ActiveMenu->parent; - update(r); + update (r); } void @@ -1114,7 +1114,7 @@ rxvt_term::menubar_clear () if (CurrentBar->title) { - free(CurrentBar->title); + free (CurrentBar->title); CurrentBar->title = NULL; } menuarrow_free (0); /* remove all arrow functions */ @@ -1130,19 +1130,19 @@ rxvt_term::menubar_find (const char *name) bar_t *bar = CurrentBar; #ifdef DEBUG_MENUBAR_STACKING - fprintf(stderr, "looking for [menu:%s] ...", name ? name : "(nil)"); + fprintf (stderr, "looking for [menu:%s] ...", name ? name : " (nil)"); #endif if (bar == NULL || name == NULL) return NULL; - if (STRLEN(name) && STRCMP(name, "*")) + if (STRLEN (name) && STRCMP (name, "*")) { do { - if (!STRCMP(bar->name, name)) + if (!STRCMP (bar->name, name)) { #ifdef DEBUG_MENUBAR_STACKING - fprintf(stderr, " found!\n"); + fprintf (stderr, " found!\n"); #endif return bar; } @@ -1152,7 +1152,7 @@ rxvt_term::menubar_find (const char *name) bar = NULL; } #ifdef DEBUG_MENUBAR_STACKING - fprintf(stderr, "%s found!\n", (bar ? "" : " NOT")); + fprintf (stderr, "%s found!\n", (bar ? "" : " NOT")); #endif return bar; @@ -1167,9 +1167,9 @@ rxvt_term::menubar_push (const char *name) if (CurrentBar == NULL) { /* allocate first one */ - bar = (bar_t *) rxvt_malloc(sizeof(bar_t)); + bar = (bar_t *) rxvt_malloc (sizeof (bar_t)); - MEMSET(bar, 0, sizeof(bar_t)); + MEMSET (bar, 0, sizeof (bar_t)); /* circular linked-list */ bar->next = bar->prev = bar; bar->head = bar->tail = NULL; @@ -1195,7 +1195,7 @@ rxvt_term::menubar_push (const char *name) { /* need to malloc another one */ if (Nbars < MENUBAR_MAX) - bar = (bar_t *) rxvt_malloc(sizeof(bar_t)); + bar = (bar_t *) rxvt_malloc (sizeof (bar_t)); else bar = NULL; @@ -1225,7 +1225,7 @@ rxvt_term::menubar_push (const char *name) } /* give menubar this name */ - STRNCPY(CurrentBar->name, name, MAXNAME); + STRNCPY (CurrentBar->name, name, MAXNAME); CurrentBar->name[MAXNAME - 1] = '\0'; return ret; @@ -1264,15 +1264,15 @@ rxvt_term::menubar_remove (const char *name) Nbars--; } - free(CurrentBar); + free (CurrentBar); CurrentBar = prev; } } - while (CurrentBar && !STRCMP(name, "*")); + while (CurrentBar && !STRCMP (name, "*")); } void -rxvt_action_decode(FILE *fp, action_t *act) +rxvt_action_decode (FILE *fp, action_t *act) { unsigned char *str; short len; @@ -1282,7 +1282,7 @@ rxvt_action_decode(FILE *fp, action_t *act) if (act->type == MenuTerminalAction) { - fprintf(fp, "^@"); + fprintf (fp, "^@"); /* can strip trailing ^G from XTerm sequence */ if (str[0] == C0_ESC && str[1] == ']' && str[len - 1] == C0_BEL) len--; @@ -1302,7 +1302,7 @@ rxvt_action_decode(FILE *fp, action_t *act) /* FALLTHROUGH */ default: - fprintf(fp, "M-"); /* meta prefix */ + fprintf (fp, "M-"); /* meta prefix */ str++; len--; break; @@ -1321,40 +1321,40 @@ rxvt_action_decode(FILE *fp, action_t *act) switch (ch) { case C0_ESC: - fprintf(fp, "\\E"); + fprintf (fp, "\\E"); break; /* escape */ case '\r': - fprintf(fp, "\\r"); + fprintf (fp, "\\r"); break; /* carriage-return */ case '\\': - fprintf(fp, "\\\\"); + fprintf (fp, "\\\\"); break; /* backslash */ case '^': - fprintf(fp, "\\^"); + fprintf (fp, "\\^"); break; /* caret */ case 127: - fprintf(fp, "^?"); + fprintf (fp, "^?"); default: if (ch <= 31) - fprintf(fp, "^%c", ('@' + ch)); + fprintf (fp, "^%c", ('@' + ch)); else if (ch > 127) - fprintf(fp, "\\%o", ch); + fprintf (fp, "\\%o", ch); else - fprintf(fp, "%c", ch); + fprintf (fp, "%c", ch); break; } len--; } - fprintf(fp, "\n"); + fprintf (fp, "\n"); } void -rxvt_menu_dump(FILE *fp, menu_t *menu) +rxvt_menu_dump (FILE *fp, menu_t *menu) { menuitem_t *item; /* create a new menu and clear it */ - fprintf(fp, (menu->parent ? "./%s/*\n" : "/%s/*\n"), menu->name); + fprintf (fp, (menu->parent ? "./%s/*\n" : "/%s/*\n"), menu->name); for (item = menu->head; item != NULL; item = item->next) { @@ -1362,27 +1362,27 @@ rxvt_menu_dump(FILE *fp, menu_t *menu) { case MenuSubMenu: if (item->entry.submenu.menu == NULL) - fprintf(fp, "> %s == NULL\n", item->name); + fprintf (fp, "> %s == NULL\n", item->name); else - rxvt_menu_dump(fp, item->entry.submenu.menu); + rxvt_menu_dump (fp, item->entry.submenu.menu); break; case MenuLabel: - fprintf(fp, "{%s}\n", (STRLEN(item->name) ? item->name : "-")); + fprintf (fp, "{%s}\n", (STRLEN (item->name) ? item->name : "-")); break; case MenuTerminalAction: case MenuAction: - fprintf(fp, "{%s}", item->name); - if (item->name2 != NULL && STRLEN(item->name2)) - fprintf(fp, "{%s}", item->name2); - fprintf(fp, "\t"); - rxvt_action_decode(fp, &(item->entry.action)); + fprintf (fp, "{%s}", item->name); + if (item->name2 != NULL && STRLEN (item->name2)) + fprintf (fp, "{%s}", item->name2); + fprintf (fp, "\t"); + rxvt_action_decode (fp, & (item->entry.action)); break; } } - fprintf(fp, (menu->parent ? "../\n" : "/\n\n")); + fprintf (fp, (menu->parent ? "../\n" : "/\n\n")); } void @@ -1393,11 +1393,11 @@ rxvt_term::menubar_dump (FILE *fp) if (bar == NULL || fp == NULL) return; - time(&t); + time (&t); - fprintf(fp, + fprintf (fp, "# " APL_SUBCLASS " (%s) Pid: %u\n# Date: %s\n\n", - rs[Rs_name], (unsigned int)getpid(), ctime(&t)); + rs[Rs_name], (unsigned int)getpid (), ctime (&t)); /* dump in reverse order */ bar = CurrentBar->prev; @@ -1406,10 +1406,10 @@ rxvt_term::menubar_dump (FILE *fp) menu_t *menu; int i; - fprintf(fp, "[menu:%s]\n", bar->name); + fprintf (fp, "[menu:%s]\n", bar->name); if (bar->title != NULL) - fprintf(fp, "[title:%s]\n", bar->title); + fprintf (fp, "[title:%s]\n", bar->title); for (i = 0; i < NARROWS; i++) { @@ -1417,17 +1417,17 @@ rxvt_term::menubar_dump (FILE *fp) { case MenuTerminalAction: case MenuAction: - fprintf(fp, "<%c>", Arrows[i].name); - rxvt_action_decode(fp, &(bar->arrows[i])); + fprintf (fp, "<%c>", Arrows[i].name); + rxvt_action_decode (fp, & (bar->arrows[i])); break; } } - fprintf(fp, "\n"); + fprintf (fp, "\n"); for (menu = bar->head; menu != NULL; menu = menu->next) - rxvt_menu_dump(fp, menu); + rxvt_menu_dump (fp, menu); - fprintf(fp, "\n[done:%s]\n\n", bar->name); + fprintf (fp, "\n[done:%s]\n\n", bar->name); bar = bar->prev; } while (bar != CurrentBar->prev); @@ -1457,17 +1457,17 @@ rxvt_term::menubar_read (const char *filename) char buffer[256]; char *p, *file, *tag = NULL; - file = (char *)rxvt_File_find(filename, ".menu", rs[Rs_path]); + file = (char *)rxvt_File_find (filename, ".menu", rs[Rs_path]); if (file == NULL) return; - fp = fopen(file, "rb"); - free(file); + fp = fopen (file, "rb"); + free (file); if (fp == NULL) return; #if (MENUBAR_MAX > 1) /* semi-colon delimited */ - if ((tag = STRCHR(filename, ';')) != NULL) + if ((tag = STRCHR (filename, ';')) != NULL) { tag++; if (*tag == '\0') @@ -1475,16 +1475,16 @@ rxvt_term::menubar_read (const char *filename) } #endif /* (MENUBAR_MAX > 1) */ #ifdef DEBUG_MENU - fprintf(stderr, "[read:%s]\n", p); + fprintf (stderr, "[read:%s]\n", p); if (tag) - fprintf(stderr, "looking for [menu:%s]\n", tag); + fprintf (stderr, "looking for [menu:%s]\n", tag); #endif - while ((p = fgets(buffer, sizeof(buffer), fp)) != NULL) + while ((p = fgets (buffer, sizeof (buffer), fp)) != NULL) { int n; - if ((n = rxvt_Str_match(p, "[menu")) != 0) + if ((n = rxvt_Str_match (p, "[menu")) != 0) { if (tag) { @@ -1492,11 +1492,11 @@ rxvt_term::menubar_read (const char *filename) if (p[n] == ':' && p[n + 1] != ']') { n++; - n += rxvt_Str_match(p + n, tag); + n += rxvt_Str_match (p + n, tag); if (p[n] == ']') { #ifdef DEBUG_MENU - fprintf(stderr, "[menu:%s]\n", tag); + fprintf (stderr, "[menu:%s]\n", tag); #endif break; } @@ -1513,11 +1513,11 @@ rxvt_term::menubar_read (const char *filename) int n; #ifdef DEBUG_MENU - fprintf(stderr, "read line = %s\n", p); + fprintf (stderr, "read line = %s\n", p); #endif /* looking for [done:tag] or [done:] */ - if ((n = rxvt_Str_match(p, "[done")) != 0) + if ((n = rxvt_Str_match (p, "[done")) != 0) { if (p[n] == ']') { @@ -1534,11 +1534,11 @@ rxvt_term::menubar_read (const char *filename) } else if (tag) { - n += rxvt_Str_match(p + n, tag); + n += rxvt_Str_match (p + n, tag); if (p[n] == ']') { #ifdef DEBUG_MENU - fprintf(stderr, "[done:%s]\n", tag); + fprintf (stderr, "[done:%s]\n", tag); #endif menu_readonly = 1; break; @@ -1556,17 +1556,17 @@ rxvt_term::menubar_read (const char *filename) * and strip-off leading/trailing quotes * skip blank or comment lines */ - rxvt_Str_trim(p); + rxvt_Str_trim (p); if (*p && *p != '#') { menu_readonly = 0; /* if case we read another file */ menubar_dispatch (p); } /* get another line */ - p = fgets(buffer, sizeof(buffer), fp); + p = fgets (buffer, sizeof (buffer), fp); } - fclose(fp); + fclose (fp); } /* @@ -1578,7 +1578,7 @@ rxvt_term::menubar_dispatch (char *str) int n, cmd; char *path, *name, *name2; - if (menubar_visible(r) && ActiveMenu != NULL) + if (menubar_visible (r) && ActiveMenu != NULL) menubar_expose (); else ActiveMenu = NULL; @@ -1617,7 +1617,7 @@ rxvt_term::menubar_dispatch (char *str) do { next++; - if ((next = STRCHR(next, ':')) == NULL) + if ((next = STRCHR (next, ':')) == NULL) return; /* parse error */ } while (next[1] != ']'); @@ -1627,7 +1627,7 @@ rxvt_term::menubar_dispatch (char *str) } else { - if ((next = STRCHR(next, ']')) == NULL) + if ((next = STRCHR (next, ']')) == NULL) return; /* parse error */ /* remove and skip ']' */ *next = '\0'; @@ -1645,60 +1645,60 @@ rxvt_term::menubar_dispatch (char *str) menu_readonly = saved; } /* these ones don't require menu stacking */ - else if (!STRCMP(str, "clear")) + else if (!STRCMP (str, "clear")) { menubar_clear (); } - else if (!STRCMP(str, "done") || rxvt_Str_match(str, "done:")) + else if (!STRCMP (str, "done") || rxvt_Str_match (str, "done:")) { menu_readonly = 1; } - else if (!STRCMP(str, "show")) + else if (!STRCMP (str, "show")) { map_menuBar (1); menu_readonly = 1; } - else if (!STRCMP(str, "hide")) + else if (!STRCMP (str, "hide")) { map_menuBar (0); menu_readonly = 1; } - else if ((n = rxvt_Str_match(str, "read:")) != 0) + else if ((n = rxvt_Str_match (str, "read:")) != 0) { /* read in a menu from a file */ str += n; menubar_read (str); } - else if ((n = rxvt_Str_match(str, "title:")) != 0) + else if ((n = rxvt_Str_match (str, "title:")) != 0) { str += n; if (CurrentBar != NULL && !menu_readonly) { if (*str) { - name = rxvt_realloc(CurrentBar->title, - STRLEN(str) + 1); + name = rxvt_realloc (CurrentBar->title, + STRLEN (str) + 1); if (name != NULL) { - STRCPY(name, str); + STRCPY (name, str); CurrentBar->title = name; } menubar_expose (); } else { - free(CurrentBar->title); + free (CurrentBar->title); CurrentBar->title = NULL; } } } - else if ((n = rxvt_Str_match(str, "pixmap:")) != 0) + else if ((n = rxvt_Str_match (str, "pixmap:")) != 0) { str += n; xterm_seq (XTerm_Pixmap, str, CHAR_ST); } #if (MENUBAR_MAX > 1) - else if ((n = rxvt_Str_match(str, "rm")) != 0) + else if ((n = rxvt_Str_match (str, "rm")) != 0) { str += n; switch (str[0]) @@ -1714,7 +1714,7 @@ rxvt_term::menubar_dispatch (char *str) } menu_readonly = 1; } - else if ((n = rxvt_Str_match(str, "menu")) != 0) + else if ((n = rxvt_Str_match (str, "menu")) != 0) { str += n; switch (str[0]) @@ -1735,7 +1735,7 @@ rxvt_term::menubar_dispatch (char *str) if (CurrentBar != NULL) menu_readonly = 0; /* allow menu build commands */ } - else if (!STRCMP(str, "dump")) + else if (!STRCMP (str, "dump")) { /* dump current menubars to a file */ FILE *fp; @@ -1743,17 +1743,17 @@ rxvt_term::menubar_dispatch (char *str) /* enough space to hold the results */ char buffer[32]; - sprintf(buffer, "/tmp/" APL_SUBCLASS "-%u", - (unsigned int)getpid()); + sprintf (buffer, "/tmp/" APL_SUBCLASS "-%u", + (unsigned int)getpid ()); - if ((fp = fopen(buffer, "wb")) != NULL) + if ((fp = fopen (buffer, "wb")) != NULL) { xterm_seq (XTerm_title, buffer, CHAR_ST); menubar_dump (fp); - fclose(fp); + fclose (fp); } } - else if (!STRCMP(str, "next")) + else if (!STRCMP (str, "next")) { if (CurrentBar) { @@ -1761,7 +1761,7 @@ rxvt_term::menubar_dispatch (char *str) menu_readonly = 1; } } - else if (!STRCMP(str, "prev")) + else if (!STRCMP (str, "prev")) { if (CurrentBar) { @@ -1769,7 +1769,7 @@ rxvt_term::menubar_dispatch (char *str) menu_readonly = 1; } } - else if (!STRCMP(str, "swap")) + else if (!STRCMP (str, "swap")) { /* swap the top 2 menus */ if (CurrentBar) @@ -1796,7 +1796,7 @@ rxvt_term::menubar_dispatch (char *str) BuildMenu = ActiveMenu = NULL; menubar_expose (); #ifdef DEBUG_MENUBAR_STACKING - fprintf(stderr, "menus are read%s\n", + fprintf (stderr, "menus are read%s\n", menu_readonly ? "only" : "/write"); #endif @@ -1811,7 +1811,7 @@ rxvt_term::menubar_dispatch (char *str) if (menu_readonly) { #ifdef DEBUG_MENUBAR_STACKING - fprintf(stderr, "menus are read%s\n", + fprintf (stderr, "menus are read%s\n", menu_readonly ? "only" : "/write"); #endif return; @@ -1828,24 +1828,24 @@ rxvt_term::menubar_dispatch (char *str) /* parse STR, allow spaces inside (name) */ if (path[0] != '\0') { - name = STRCHR(path, MENUITEM_BEG); - str = STRCHR(path, MENUITEM_END); + name = STRCHR (path, MENUITEM_BEG); + str = STRCHR (path, MENUITEM_END); if (name != NULL || str != NULL) { if (name == NULL || str == NULL || str <= (name + 1) || (name > path && name[-1] != '/')) { - rxvt_print_error("menu error <%s>\n", path); + rxvt_print_error ("menu error <%s>\n", path); break; } if (str[1] == MENUITEM_BEG) { name2 = (str + 2); - str = STRCHR(name2, MENUITEM_END); + str = STRCHR (name2, MENUITEM_END); if (str == NULL) { - rxvt_print_error("menu error <%s>\n", path); + rxvt_print_error ("menu error <%s>\n", path); break; } name2[-2] = '\0'; /* remove prev MENUITEM_END */ @@ -1856,14 +1856,14 @@ rxvt_term::menubar_dispatch (char *str) *name++ = '\0'; /* delimit */ *str++ = '\0'; /* delimit */ - while (isspace(*str)) + while (isspace (*str)) str++; /* skip space */ } #ifdef DEBUG_MENU - fprintf(stderr, + fprintf (stderr, "`%c' path = <%s>, name = <%s>, name2 = <%s>, action = <%s>\n", - cmd, (path ? path : "(nil)"), (name ? name : "(nil)"), - (name2 ? name2 : "(nil)"), (str ? str : "(nil)") + cmd, (path ? path : " (nil)"), (name ? name : " (nil)"), + (name2 ? name2 : " (nil)"), (str ? str : " (nil)") ); #endif @@ -1876,8 +1876,8 @@ rxvt_term::menubar_dispatch (char *str) { int len; - path = menu_find_base (&(BuildMenu), path); - len = STRLEN(path); + path = menu_find_base (& (BuildMenu), path); + len = STRLEN (path); /* don't allow menus called `*' */ if (path[0] == '*') @@ -1885,7 +1885,7 @@ rxvt_term::menubar_dispatch (char *str) menu_clear (BuildMenu); break; } - else if (len >= 2 && !STRCMP((path + len - 2), "/*")) + else if (len >= 2 && !STRCMP ((path + len - 2), "/*")) { path[len - 2] = '\0'; } @@ -1893,13 +1893,13 @@ rxvt_term::menubar_dispatch (char *str) BuildMenu = menu_add (BuildMenu, path); } if (name != NULL && name[0] != '\0') - rxvt_menuitem_add(BuildMenu, - (STRCMP(name, SEPARATOR_NAME) ? name : ""), + rxvt_menuitem_add (BuildMenu, + (STRCMP (name, SEPARATOR_NAME) ? name : ""), name2, str); break; case '-': /* delete menu entry */ - if (!STRCMP(path, "/*") && (name == NULL || name[0] == '\0')) + if (!STRCMP (path, "/*") && (name == NULL || name[0] == '\0')) { menubar_clear (); BuildMenu = NULL; @@ -1912,7 +1912,7 @@ rxvt_term::menubar_dispatch (char *str) menu_t *menu = BuildMenu; path = menu_find_base (&menu, path); - len = STRLEN(path); + len = STRLEN (path); /* submenu called `*' clears all menu items */ if (path[0] == '*') @@ -1920,7 +1920,7 @@ rxvt_term::menubar_dispatch (char *str) menu_clear (menu); break; /* done */ } - else if (len >= 2 && !STRCMP(&path[len - 2], "/*")) + else if (len >= 2 && !STRCMP (&path[len - 2], "/*")) { /* done */ break; @@ -1943,8 +1943,8 @@ rxvt_term::menubar_dispatch (char *str) menuitem_t *item; menu_t *BuildMenu = BuildMenu; - n1 = STRCMP(name, SEPARATOR_NAME) ? name : ""; - item = rxvt_menuitem_find(BuildMenu, n1); + n1 = STRCMP (name, SEPARATOR_NAME) ? name : ""; + item = rxvt_menuitem_find (BuildMenu, n1); if (item != NULL && item->entry.type != MenuSubMenu) { menuitem_free (BuildMenu, item); @@ -1956,7 +1956,7 @@ rxvt_term::menubar_dispatch (char *str) { short l = item->len + item->len2; - MAX_IT(BuildMenu->width, l); + MAX_IT (BuildMenu->width, l); } } } @@ -1998,15 +1998,15 @@ rxvt_term::draw_Arrows (int name, int state) for (i = 0; i < NARROWS; i++) { - const int w = Width2Pixel(1); - const int y = (menuBar_TotalHeight() - w) / 2; - int x = Arrows_x + (5 * Width2Pixel(i)) / 4; + const int w = Width2Pixel (1); + const int y = (menuBar_TotalHeight () - w) / 2; + int x = Arrows_x + (5 * Width2Pixel (i)) / 4; if (!name || name == Arrows[i].name) - rxvt_Draw_Triangle(display->display, menuBar.win, top, bot, x, y, w, + rxvt_Draw_Triangle (display->display, menuBar.win, top, bot, x, y, w, Arrows[i].name); } - XFlush(display->display); + XFlush (display->display); } void @@ -2015,7 +2015,7 @@ rxvt_term::menubar_expose () menu_t *menu; int x; - if (!menubar_visible(r) || menuBar.win == 0) + if (!menubar_visible (r) || menuBar.win == 0) return; if (menubarGC == None) @@ -2027,14 +2027,14 @@ rxvt_term::menubar_expose () gcvalue.foreground = (XDEPTH <= 2 ? PixColors[Color_fg] : PixColors[Color_Black]); - menubarGC = XCreateGC(display->display, menuBar.win, + menubarGC = XCreateGC (display->display, menuBar.win, GCForeground | GCFont, &gcvalue); } /* make sure the font is correct */ - XSetFont(display->display, menubarGC, TermWin.font->fid); - XSetFont(display->display, botShadowGC, TermWin.font->fid); - XClearWindow(display->display, menuBar.win); + XSetFont (display->display, menubarGC, TermWin.font->fid); + XSetFont (display->display, botShadowGC, TermWin.font->fid); + XClearWindow (display->display, menuBar.win); menu_hide_all (); @@ -2048,7 +2048,7 @@ rxvt_term::menubar_expose () x = (menu->x + menu->len + HSPACE); #ifdef DEBUG_MENU_LAYOUT - rxvt_print_menu_descendants(menu); + rxvt_print_menu_descendants (menu); #endif if (x >= TermWin.ncol) @@ -2057,16 +2057,16 @@ rxvt_term::menubar_expose () drawbox_menubar (menu->x, len, +1); #ifdef USE_XIM if (TermWin.fontset) - XmbDrawString(display->display, + XmbDrawString (display->display, menuBar.win, TermWin.fontset, menubarGC, - (Width2Pixel(menu->x) + Width2Pixel(HSPACE) / 2), - menuBar_height() - SHADOW, menu->name, len); + (Width2Pixel (menu->x) + Width2Pixel (HSPACE) / 2), + menuBar_height () - SHADOW, menu->name, len); else #endif - XDrawString(display->display, menuBar.win, menubarGC, - (Width2Pixel(menu->x) + Width2Pixel(HSPACE) / 2), - menuBar_height() - SHADOW, menu->name, len); + XDrawString (display->display, menuBar.win, menubarGC, + (Width2Pixel (menu->x) + Width2Pixel (HSPACE) / 2), + menuBar_height () - SHADOW, menu->name, len); if (x >= TermWin.ncol) break; @@ -2087,13 +2087,13 @@ rxvt_term::menubar_expose () if (x < (ncol - (NARROWS + 1))) { ncol -= (NARROWS + 1); - Arrows_x = Width2Pixel(ncol); + Arrows_x = Width2Pixel (ncol); } draw_Arrows (0, +1); str = (CurrentBar && CurrentBar->title) ? CurrentBar->title : "%n-%v"; - for (len = 0; str[0] && len < sizeof(title) - 1; str++) + for (len = 0; str[0] && len < sizeof (title) - 1; str++) { const char *s = NULL; @@ -2114,7 +2114,7 @@ rxvt_term::menubar_expose () break; /* literal '%' */ } if (s != NULL) - while (*s && len < sizeof(title) - 1) + while (*s && len < sizeof (title) - 1) title[len++] = *s++; break; @@ -2130,16 +2130,16 @@ rxvt_term::menubar_expose () { #ifdef USE_XIM if (TermWin.fontset) - XmbDrawString(display->display, + XmbDrawString (display->display, menuBar.win, TermWin.fontset, menubarGC, - Width2Pixel(x) + Width2Pixel(ncol + HSPACE) / 2, - menuBar_height() - SHADOW, title, len); + Width2Pixel (x) + Width2Pixel (ncol + HSPACE) / 2, + menuBar_height () - SHADOW, title, len); else #endif - XDrawString(display->display, menuBar.win, menubarGC, - Width2Pixel(x) + Width2Pixel(ncol + HSPACE) / 2, - menuBar_height() - SHADOW, title, len); + XDrawString (display->display, menuBar.win, menubarGC, + Width2Pixel (x) + Width2Pixel (ncol + HSPACE) / 2, + menuBar_height () - SHADOW, title, len); } } } @@ -2149,19 +2149,19 @@ rxvt_term::menubar_mapping (int map) { int change = 0; - if (map && !menubar_visible(r)) + if (map && !menubar_visible (r)) { menuBar.state = 1; if (menuBar.win == 0) return 0; - XMapWindow(display->display, menuBar.win); + XMapWindow (display->display, menuBar.win); change = 1; } - else if (!map && menubar_visible(r)) + else if (!map && menubar_visible (r)) { menubar_expose (); menuBar.state = 0; - XUnmapWindow(display->display, menuBar.win); + XUnmapWindow (display->display, menuBar.win); change = 1; } else @@ -2184,10 +2184,10 @@ rxvt_term::menu_select (XButtonEvent *ev) if (ActiveMenu == NULL) return 0; - XQueryPointer(display->display, ActiveMenu->win, + XQueryPointer (display->display, ActiveMenu->win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, - &(ev->x), &(ev->y), &unused_mask); + & (ev->x), & (ev->y), &unused_mask); if (ActiveMenu->parent != NULL && (ev->x < 0 || ev->y < 0)) { @@ -2202,7 +2202,7 @@ rxvt_term::menu_select (XButtonEvent *ev) { int h = HEIGHT_TEXT + 2 * SHADOW; - if (isSeparator(item->name)) + if (isSeparator (item->name)) h = HEIGHT_SEPARATOR; else if (ev->y >= y && ev->y < (y + h)) break; @@ -2227,7 +2227,7 @@ rxvt_term::menu_select (XButtonEvent *ev) { int h; - if (isSeparator(item->name)) + if (isSeparator (item->name)) h = HEIGHT_SEPARATOR; else if (item == ActiveMenu->item) { @@ -2263,23 +2263,23 @@ rxvt_term::menu_select (XButtonEvent *ev) rqt.tv_sec = 0; rqt.tv_nsec = MENU_DELAY_USEC * 1000; - nanosleep(&rqt, NULL); + nanosleep (&rqt, NULL); #else /* use select for timing */ struct timeval tv; tv.tv_sec = 0; tv.tv_usec = MENU_DELAY_USEC; - select(0, NULL, NULL, NULL, &tv); + select (0, NULL, NULL, NULL, &tv); #endif } /* remove menu before sending keys to the application */ menu_hide_all (); #ifndef DEBUG_MENU - action_dispatch (&(item->entry.action)); + action_dispatch (& (item->entry.action)); #else /* DEBUG_MENU */ - fprintf(stderr, "%s: %s\n", item->name, + fprintf (stderr, "%s: %s\n", item->name, item->entry.action.str); #endif /* DEBUG_MENU */ break; @@ -2310,7 +2310,7 @@ DoMenu: x = ev->x + (ActiveMenu->parent ? ActiveMenu->x - : Width2Pixel(ActiveMenu->x)); + : Width2Pixel (ActiveMenu->x)); if (x >= item->entry.submenu.menu->x) { @@ -2329,12 +2329,12 @@ rxvt_term::menubar_select (XButtonEvent *ev) menu_t *menu = NULL; /* determine the pulldown menu corresponding to the X index */ - if (ev->y >= 0 && ev->y <= menuBar_height() && CurrentBar != NULL) + if (ev->y >= 0 && ev->y <= menuBar_height () && CurrentBar != NULL) { for (menu = CurrentBar->head; menu != NULL; menu = menu->next) { - int x = Width2Pixel(menu->x); - int w = Width2Pixel(menu->len + HSPACE); + int x = Width2Pixel (menu->x); + int w = Width2Pixel (menu->len + HSPACE); if ((ev->x >= x && ev->x < x + w)) break; @@ -2353,9 +2353,9 @@ rxvt_term::menubar_select (XButtonEvent *ev) for (i = 0; i < NARROWS; i++) { - if (ev->x >= (Arrows_x + (Width2Pixel(4 * i + i)) / 4) + if (ev->x >= (Arrows_x + (Width2Pixel (4 * i + i)) / 4) && ev->x < (Arrows_x - + (Width2Pixel(4 * i + i + 4)) / 4)) + + (Width2Pixel (4 * i + i + 4)) / 4)) { draw_Arrows (Arrows[i].name, -1); { @@ -2364,20 +2364,20 @@ rxvt_term::menubar_select (XButtonEvent *ev) rqt.tv_sec = 0; rqt.tv_nsec = MENU_DELAY_USEC * 1000; - nanosleep(&rqt, NULL); + nanosleep (&rqt, NULL); #else /* use select for timing */ struct timeval tv; tv.tv_sec = 0; tv.tv_usec = MENU_DELAY_USEC; - select(0, NULL, NULL, NULL, &tv); + select (0, NULL, NULL, NULL, &tv); #endif } draw_Arrows (Arrows[i].name, +1); #ifdef DEBUG_MENUARROWS - fprintf(stderr, "'%c': ", Arrows[i].name); + fprintf (stderr, "'%c': ", Arrows[i].name); if (CurrentBar == NULL || (CurrentBar->arrows[i].type != MenuAction @@ -2385,18 +2385,18 @@ rxvt_term::menubar_select (XButtonEvent *ev) MenuTerminalAction)) { if (Arrows[i].str != NULL && Arrows[i].str[0]) - fprintf(stderr, "(default) \\033%s\n", - &(Arrows[i].str[2])); + fprintf (stderr, " (default) \\033%s\n", + & (Arrows[i].str[2])); } else { - fprintf(stderr, "%s\n", + fprintf (stderr, "%s\n", CurrentBar->arrows[i].str); } #else /* DEBUG_MENUARROWS */ if (CurrentBar == NULL - || rxvt_action_dispatch(r, - &(CurrentBar->arrows[i])) + || rxvt_action_dispatch (r, + & (CurrentBar->arrows[i])) ) { if (Arrows[i].str != NULL && Arrows[i].str[0] != 0) @@ -2444,7 +2444,7 @@ rxvt_term::menubar_control (XButtonEvent *ev) break; case MotionNotify: - while (XCheckTypedWindowEvent(display->display, TermWin.parent[0], + while (XCheckTypedWindowEvent (display->display, TermWin.parent[0], MotionNotify, (XEvent *) ev)) ; if (ActiveMenu) @@ -2457,10 +2457,10 @@ rxvt_term::menubar_control (XButtonEvent *ev) int unused_root_x, unused_root_y; unsigned int unused_mask; - XQueryPointer(display->display, menuBar.win, + XQueryPointer (display->display, menuBar.win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, - &(ev->x), &(ev->y), &unused_mask); + & (ev->x), & (ev->y), &unused_mask); menubar_select (ev); } break; diff --git a/src/misc.C b/src/misc.C index 39c78d6c..b930acd6 100644 --- a/src/misc.C +++ b/src/misc.C @@ -35,11 +35,11 @@ rxvt_strdup (const char *str) /* EXTPROTO */ char * -rxvt_r_basename(const char *str) +rxvt_r_basename (const char *str) { - char *base = STRRCHR(str, '/'); + char *base = STRRCHR (str, '/'); - return (char *)(base ? base + 1 : str); + return (char *) (base ? base + 1 : str); } /* @@ -47,15 +47,15 @@ rxvt_r_basename(const char *str) */ /* EXTPROTO */ void -rxvt_print_error(const char *fmt,...) +rxvt_print_error (const char *fmt,...) { va_list arg_ptr; - va_start(arg_ptr, fmt); - fprintf(stderr, APL_NAME ": "); - vfprintf(stderr, fmt, arg_ptr); - fprintf(stderr, "\n"); - va_end(arg_ptr); + va_start (arg_ptr, fmt); + fprintf (stderr, APL_NAME ": "); + vfprintf (stderr, fmt, arg_ptr); + fprintf (stderr, "\n"); + va_end (arg_ptr); } /* @@ -68,19 +68,19 @@ rxvt_print_error(const char *fmt,...) */ /* EXTPROTO */ int -rxvt_Str_match(const char *s1, const char *s2) +rxvt_Str_match (const char *s1, const char *s2) { - int n = STRLEN(s2); + int n = STRLEN (s2); - return ((STRNCMP(s1, s2, n) == 0) ? n : 0); + return ((STRNCMP (s1, s2, n) == 0) ? n : 0); } /* EXTPROTO */ const char * -rxvt_Str_skip_space(const char *str) +rxvt_Str_skip_space (const char *str) { if (str) - while (*str && isspace(*str)) + while (*str && isspace (*str)) str++; return str; } @@ -91,7 +91,7 @@ rxvt_Str_skip_space(const char *str) */ /* EXTPROTO */ char * -rxvt_Str_trim(char *str) +rxvt_Str_trim (char *str) { char *r, *s; int n; @@ -100,7 +100,7 @@ rxvt_Str_trim(char *str) return str; /* skip leading spaces */ - for (s = str; *s && isspace(*s); s++) ; + for (s = str; *s && isspace (*s); s++) ; /* goto end of string */ for (n = 0, r = s; *r++; n++) ; r -= 2; @@ -108,7 +108,7 @@ rxvt_Str_trim(char *str) if (n > 0 && *r == '\n') n--, r--; /* backtrack along trailing spaces */ - for (; n > 0 && isspace(*r); r--, n--) ; + for (; n > 0 && isspace (*r); r--, n--) ; /* skip matching leading/trailing quotes */ if (*s == '"' && *r == '"' && n > 1) { @@ -139,7 +139,7 @@ rxvt_Str_trim(char *str) */ /* EXTPROTO */ int -rxvt_Str_escaped(char *str) +rxvt_Str_escaped (char *str) { char ch, *s, *d; int i, num, append = 0; @@ -154,9 +154,9 @@ rxvt_Str_escaped(char *str) /* Emacs convenience, replace leading `M-..' with `\E..' */ *d++ = C0_ESC; s += 2; - if (toupper(*s) == 'X') + if (toupper (*s) == 'X') /* append carriage-return for `M-xcommand' */ - for (*d++ = 'x', append = '\r', s++; isspace(*s); s++) ; + for (*d++ = 'x', append = '\r', s++; isspace (*s); s++) ; } for (; (ch = *s++);) { @@ -191,7 +191,7 @@ rxvt_Str_escaped(char *str) else if (ch == '^') { ch = *s++; - ch = toupper(ch); + ch = toupper (ch); ch = (ch == '?' ? 127 : (ch - '@')); } *d++ = ch; @@ -217,7 +217,7 @@ rxvt_Str_escaped(char *str) */ /* EXTPROTO */ char ** -rxvt_splitcommastring(const char *cs) +rxvt_splitcommastring (const char *cs) { int l, n, p; const char *s, *t; @@ -229,17 +229,17 @@ rxvt_splitcommastring(const char *cs) for (n = 1, t = s; *t; t++) if (*t == ',') n++; - ret = (char **)malloc((n + 1) * sizeof(char *)); + ret = (char **)malloc ((n + 1) * sizeof (char *)); ret[n] = NULL; for (l = 0, t = s; l < n; l++) { for ( ; *t && *t != ','; t++) ; p = t - s; - ret[l] = (char *)malloc(p + 1); - strncpy(ret[l], s, p); + ret[l] = (char *)malloc (p + 1); + strncpy (ret[l], s, p); ret[l][p] = '\0'; - rxvt_Str_trim(ret[l]); + rxvt_Str_trim (ret[l]); s = ++t; } return ret; @@ -260,51 +260,51 @@ rxvt_splitcommastring(const char *cs) */ /* INTPROTO */ char * -rxvt_File_search_path(const char *pathlist, const char *file, const char *ext) +rxvt_File_search_path (const char *pathlist, const char *file, const char *ext) { int maxpath, len; const char *p, *path; char name[256]; - if (!access(file, R_OK)) /* found (plain name) in current directory */ - return STRDUP(file); + if (!access (file, R_OK)) /* found (plain name) in current directory */ + return STRDUP (file); /* semi-colon delimited */ - if ((p = STRCHR(file, ';'))) + if ((p = STRCHR (file, ';'))) len = (p - file); else - len = STRLEN(file); + len = STRLEN (file); #ifdef DEBUG_SEARCH_PATH - getcwd(name, sizeof(name)); - fprintf(stderr, "pwd: \"%s\"\n", name); - fprintf(stderr, "find: \"%.*s\"\n", len, file); + getcwd (name, sizeof (name)); + fprintf (stderr, "pwd: \"%s\"\n", name); + fprintf (stderr, "find: \"%.*s\"\n", len, file); #endif /* leave room for an extra '/' and trailing '\0' */ - maxpath = sizeof(name) - (len + (ext ? STRLEN(ext) : 0) + 2); + maxpath = sizeof (name) - (len + (ext ? STRLEN (ext) : 0) + 2); if (maxpath <= 0) return NULL; /* check if we can find it now */ - STRNCPY(name, file, len); + STRNCPY (name, file, len); name[len] = '\0'; - if (!access(name, R_OK)) - return STRDUP(name); + if (!access (name, R_OK)) + return STRDUP (name); if (ext) { - STRCAT(name, ext); - if (!access(name, R_OK)) - return STRDUP(name); + STRCAT (name, ext); + if (!access (name, R_OK)) + return STRDUP (name); } for (path = pathlist; path != NULL && *path != '\0'; path = p) { int n; /* colon delimited */ - if ((p = STRCHR(path, ':')) == NULL) - p = STRCHR(path, '\0'); + if ((p = STRCHR (path, ':')) == NULL) + p = STRCHR (path, '\0'); n = (p - path); if (*p != '\0') @@ -312,19 +312,19 @@ rxvt_File_search_path(const char *pathlist, const char *file, const char *ext) if (n > 0 && n <= maxpath) { - STRNCPY(name, path, n); + STRNCPY (name, path, n); if (name[n - 1] != '/') name[n++] = '/'; name[n] = '\0'; - STRNCAT(name, file, len); + STRNCAT (name, file, len); - if (!access(name, R_OK)) - return STRDUP(name); + if (!access (name, R_OK)) + return STRDUP (name); if (ext) { - STRCAT(name, ext); - if (!access(name, R_OK)) - return STRDUP(name); + STRCAT (name, ext); + if (!access (name, R_OK)) + return STRDUP (name); } } } @@ -333,7 +333,7 @@ rxvt_File_search_path(const char *pathlist, const char *file, const char *ext) /* EXTPROTO */ char * -rxvt_File_find(const char *file, const char *ext, const char *path) +rxvt_File_find (const char *file, const char *ext, const char *path) { char *f; @@ -341,15 +341,15 @@ rxvt_File_find(const char *file, const char *ext, const char *path) return NULL; /* search environment variables here too */ - if ((f = rxvt_File_search_path(path, file, ext)) == NULL) + if ((f = rxvt_File_search_path (path, file, ext)) == NULL) #ifdef PATH_ENV - if ((f = rxvt_File_search_path(getenv(PATH_ENV), file, ext)) == NULL) + if ((f = rxvt_File_search_path (getenv (PATH_ENV), file, ext)) == NULL) #endif - f = rxvt_File_search_path(getenv("PATH"), file, ext); + f = rxvt_File_search_path (getenv ("PATH"), file, ext); #ifdef DEBUG_SEARCH_PATH if (f) - fprintf(stderr, "found: \"%s\"\n", f); + fprintf (stderr, "found: \"%s\"\n", f); #endif return f; @@ -366,7 +366,7 @@ rxvt_File_find(const char *file, const char *ext, const char *path) #if defined(RXVT_SCROLLBAR) || defined(MENUBAR) /* EXTPROTO */ void -rxvt_Draw_Shadow(Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int h) +rxvt_Draw_Shadow (Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int h) { int shadow; @@ -375,10 +375,10 @@ rxvt_Draw_Shadow(Display *display, Window win, GC topShadow, GC botShadow, int x h += y - 1; for (; shadow-- > 0; x++, y++, w--, h--) { - XDrawLine(display, win, topShadow, x, y, w, y); - XDrawLine(display, win, topShadow, x, y, x, h); - XDrawLine(display, win, botShadow, w, h, w, y + 1); - XDrawLine(display, win, botShadow, w, h, x + 1, h); + XDrawLine (display, win, topShadow, x, y, w, y); + XDrawLine (display, win, topShadow, x, y, x, h); + XDrawLine (display, win, botShadow, w, h, w, y + 1); + XDrawLine (display, win, botShadow, w, h, x + 1, h); } } #endif @@ -387,39 +387,39 @@ rxvt_Draw_Shadow(Display *display, Window win, GC topShadow, GC botShadow, int x #ifdef MENUBAR /* EXTPROTO */ void -rxvt_Draw_Triangle(Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int type) +rxvt_Draw_Triangle (Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int type) { switch (type) { case 'r': /* right triangle */ - XDrawLine(display, win, topShadow, x, y, x, y + w); - XDrawLine(display, win, topShadow, x, y, x + w, y + w / 2); - XDrawLine(display, win, botShadow, x, y + w, x + w, y + w / 2); + XDrawLine (display, win, topShadow, x, y, x, y + w); + XDrawLine (display, win, topShadow, x, y, x + w, y + w / 2); + XDrawLine (display, win, botShadow, x, y + w, x + w, y + w / 2); break; case 'l': /* left triangle */ - XDrawLine(display, win, botShadow, x + w, y + w, x + w, y); - XDrawLine(display, win, botShadow, x + w, y + w, x, y + w / 2); - XDrawLine(display, win, topShadow, x, y + w / 2, x + w, y); + XDrawLine (display, win, botShadow, x + w, y + w, x + w, y); + XDrawLine (display, win, botShadow, x + w, y + w, x, y + w / 2); + XDrawLine (display, win, topShadow, x, y + w / 2, x + w, y); break; case 'd': /* down triangle */ - XDrawLine(display, win, topShadow, x, y, x + w / 2, y + w); - XDrawLine(display, win, topShadow, x, y, x + w, y); - XDrawLine(display, win, botShadow, x + w, y, x + w / 2, y + w); + XDrawLine (display, win, topShadow, x, y, x + w / 2, y + w); + XDrawLine (display, win, topShadow, x, y, x + w, y); + XDrawLine (display, win, botShadow, x + w, y, x + w / 2, y + w); break; case 'u': /* up triangle */ - XDrawLine(display, win, botShadow, x + w, y + w, x + w / 2, y); - XDrawLine(display, win, botShadow, x + w, y + w, x, y + w); - XDrawLine(display, win, topShadow, x, y + w, x + w / 2, y); + XDrawLine (display, win, botShadow, x + w, y + w, x + w / 2, y); + XDrawLine (display, win, botShadow, x + w, y + w, x, y + w); + XDrawLine (display, win, topShadow, x, y + w, x + w / 2, y); break; #if 0 case 's': /* square */ - XDrawLine(display, win, topShadow, x + w, y, x, y); - XDrawLine(display, win, topShadow, x, y, x, y + w); - XDrawLine(display, win, botShadow, x, y + w, x + w, y + w); - XDrawLine(display, win, botShadow, x + w, y + w, x + w, y); + XDrawLine (display, win, topShadow, x + w, y, x, y); + XDrawLine (display, win, topShadow, x, y, x, y + w); + XDrawLine (display, win, botShadow, x, y + w, x + w, y + w); + XDrawLine (display, win, botShadow, x + w, y + w, x + w, y); break; #endif diff --git a/src/netdisp.C b/src/netdisp.C index 627b90a6..ec29850d 100644 --- a/src/netdisp.C +++ b/src/netdisp.C @@ -40,67 +40,67 @@ /*----------------------------------------------------------------------*/ /* return NULL a pointer to buffer which may be freed */ char * -rxvt_network_display(const char *display) +rxvt_network_display (const char *display) { char buffer[1024], *rval = NULL; struct ifconf ifc; struct ifreq *ifr; int i, skfd; - if (display[0] != ':' && STRNCMP(display, "unix:", 5)) + if (display[0] != ':' && STRNCMP (display, "unix:", 5)) return (char *) display; /* nothing to do */ - ifc.ifc_len = sizeof(buffer); /* Get names of all ifaces */ + ifc.ifc_len = sizeof (buffer); /* Get names of all ifaces */ ifc.ifc_buf = buffer; - if ((skfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) + if ((skfd = socket (AF_INET, SOCK_DGRAM, 0)) < 0) { - perror("socket"); + perror ("socket"); return NULL; } - if (ioctl(skfd, SIOCGIFCONF, &ifc) < 0) + if (ioctl (skfd, SIOCGIFCONF, &ifc) < 0) { - perror("SIOCGIFCONF"); - close(skfd); + perror ("SIOCGIFCONF"); + close (skfd); return NULL; } for (i = 0, ifr = ifc.ifc_req; - i < (ifc.ifc_len / sizeof(struct ifreq)); + i < (ifc.ifc_len / sizeof (struct ifreq)); i++, ifr++) { struct ifreq ifr2; - STRCPY(ifr2.ifr_name, ifr->ifr_name); - if (ioctl(skfd, SIOCGIFADDR, &ifr2) >= 0) + STRCPY (ifr2.ifr_name, ifr->ifr_name); + if (ioctl (skfd, SIOCGIFADDR, &ifr2) >= 0) { unsigned long addr; struct sockaddr_in *p_addr; - p_addr = (struct sockaddr_in *)&(ifr2.ifr_addr); - addr = htonl((unsigned long)p_addr->sin_addr.s_addr); + p_addr = (struct sockaddr_in *)& (ifr2.ifr_addr); + addr = htonl ((unsigned long)p_addr->sin_addr.s_addr); /* * not "0.0.0.0" or "127.0.0.1" - so format the address */ if (addr && addr != 0x7F000001) { - char *colon = STRCHR(display, ':'); + char *colon = STRCHR (display, ':'); if (colon == NULL) colon = ":0.0"; - rval = rxvt_malloc(STRLEN(colon) + 16); - sprintf(rval, "%d.%d.%d.%d%s", - (int)((addr >> 030) & 0xFF), - (int)((addr >> 020) & 0xFF), - (int)((addr >> 010) & 0xFF), - (int)(addr & 0xFF), colon); + rval = rxvt_malloc (STRLEN (colon) + 16); + sprintf (rval, "%d.%d.%d.%d%s", + (int) ((addr >> 030) & 0xFF), + (int) ((addr >> 020) & 0xFF), + (int) ((addr >> 010) & 0xFF), + (int) (addr & 0xFF), colon); break; } } } - close(skfd); + close (skfd); return rval; } #endif /* DISPLAY_IS_IP */ diff --git a/src/ptytty.C b/src/ptytty.C index ece94419..5208df5a 100644 --- a/src/ptytty.C +++ b/src/ptytty.C @@ -65,7 +65,7 @@ */ /* EXTPROTO */ int -rxvt_get_pty(int *fd_tty, const char **ttydev) +rxvt_get_pty (int *fd_tty, const char **ttydev) { int pfd; @@ -73,15 +73,15 @@ rxvt_get_pty(int *fd_tty, const char **ttydev) char tty_name[sizeof "/dev/pts/????\0"]; - if (openpty(&pfd, fd_tty, tty_name, NULL, NULL) != -1) + if (openpty (&pfd, fd_tty, tty_name, NULL, NULL) != -1) { - *ttydev = strdup(tty_name); + *ttydev = strdup (tty_name); return pfd; } #endif #ifdef PTYS_ARE__GETPTY - *ttydev = _getpty(&pfd, O_RDWR | O_NONBLOCK | O_NOCTTY, 0622, 0); + *ttydev = _getpty (&pfd, O_RDWR | O_NONBLOCK | O_NOCTTY, 0622, 0); if (*ttydev != NULL) return pfd; #endif @@ -90,8 +90,8 @@ rxvt_get_pty(int *fd_tty, const char **ttydev) char *ptydev; - while ((ptydev = getpty()) != NULL) - if ((pfd = open(ptydev, O_RDWR | O_NOCTTY, 0)) >= 0) + while ((ptydev = getpty ()) != NULL) + if ((pfd = open (ptydev, O_RDWR | O_NOCTTY, 0)) >= 0) { *ttydev = ptydev; return pfd; @@ -103,38 +103,38 @@ rxvt_get_pty(int *fd_tty, const char **ttydev) { # ifdef PTYS_ARE_GETPT - pfd = getpt(); + pfd = getpt (); # else - pfd = open("/dev/ptmx", O_RDWR | O_NOCTTY, 0); + pfd = open ("/dev/ptmx", O_RDWR | O_NOCTTY, 0); # endif if (pfd >= 0) { - if (grantpt(pfd) == 0 /* change slave permissions */ - && unlockpt(pfd) == 0) + if (grantpt (pfd) == 0 /* change slave permissions */ + && unlockpt (pfd) == 0) { /* slave now unlocked */ - *ttydev = ptsname(pfd); /* get slave's name */ + *ttydev = ptsname (pfd); /* get slave's name */ return pfd; } - close(pfd); + close (pfd); } } # endif #endif #ifdef PTYS_ARE_PTC - if ((pfd = open("/dev/ptc", O_RDWR | O_NOCTTY, 0)) >= 0) + if ((pfd = open ("/dev/ptc", O_RDWR | O_NOCTTY, 0)) >= 0) { - *ttydev = ttyname(pfd); + *ttydev = ttyname (pfd); return pfd; } #endif #ifdef PTYS_ARE_CLONE - if ((pfd = open("/dev/ptym/clone", O_RDWR | O_NOCTTY, 0)) >= 0) + if ((pfd = open ("/dev/ptym/clone", O_RDWR | O_NOCTTY, 0)) >= 0) { - *ttydev = ptsname(pfd); + *ttydev = ptsname (pfd); return pfd; } #endif @@ -146,25 +146,25 @@ rxvt_get_pty(int *fd_tty, const char **ttydev) char pty_name[] = "/dev/ptyp???"; char tty_name[] = "/dev/ttyp???"; - c1 = &(pty_name[sizeof(pty_name) - 4]); - c2 = &(tty_name[sizeof(tty_name) - 4]); + c1 = & (pty_name[sizeof (pty_name) - 4]); + c2 = & (tty_name[sizeof (tty_name) - 4]); for (idx = 0; idx < 256; idx++) { - sprintf(c1, "%d", idx); - sprintf(c2, "%d", idx); - if (access(tty_name, F_OK) < 0) + sprintf (c1, "%d", idx); + sprintf (c2, "%d", idx); + if (access (tty_name, F_OK) < 0) { idx = 256; break; } - if ((pfd = open(pty_name, O_RDWR | O_NOCTTY, 0)) >= 0) + if ((pfd = open (pty_name, O_RDWR | O_NOCTTY, 0)) >= 0) { - if (access(tty_name, R_OK | W_OK) == 0) + if (access (tty_name, R_OK | W_OK) == 0) { - *ttydev = strdup(tty_name); + *ttydev = strdup (tty_name); return pfd; } - close(pfd); + close (pfd); } } } @@ -184,20 +184,20 @@ rxvt_get_pty(int *fd_tty, const char **ttydev) for (c1 = PTYCHAR1; *c1; c1++) { - pty_name[(sizeof(pty_name) - 3)] = - tty_name[(sizeof(pty_name) - 3)] = *c1; + pty_name[ (sizeof (pty_name) - 3)] = + tty_name[ (sizeof (pty_name) - 3)] = *c1; for (c2 = PTYCHAR2; *c2; c2++) { - pty_name[(sizeof(pty_name) - 2)] = - tty_name[(sizeof(pty_name) - 2)] = *c2; - if ((pfd = open(pty_name, O_RDWR | O_NOCTTY, 0)) >= 0) + pty_name[ (sizeof (pty_name) - 2)] = + tty_name[ (sizeof (pty_name) - 2)] = *c2; + if ((pfd = open (pty_name, O_RDWR | O_NOCTTY, 0)) >= 0) { - if (access(tty_name, R_OK | W_OK) == 0) + if (access (tty_name, R_OK | W_OK) == 0) { - *ttydev = strdup(tty_name); + *ttydev = strdup (tty_name); return pfd; } - close(pfd); + close (pfd); } } } @@ -228,7 +228,7 @@ rxvt_control_tty (int fd_tty, const char *ttydev) #ifndef __QNX__ int fd; - D_TTY ((stderr, "rxvt_control_tty(): pid: %d, tty fd: %d, dev: %s", getpid(), fd_tty, ttydev)); + D_TTY ((stderr, "rxvt_control_tty (): pid: %d, tty fd: %d, dev: %s", getpid (), fd_tty, ttydev)); /* ---------------------------------------- */ # ifdef HAVE_SETSID setsid (); @@ -242,7 +242,7 @@ rxvt_control_tty (int fd_tty, const char *ttydev) # ifdef TIOCNOTTY fd = open ("/dev/tty", O_RDWR | O_NOCTTY); - D_TTY ((stderr, "rxvt_control_tty(): Voiding tty associations: previous=%s", fd < 0 ? "no" : "yes")); + D_TTY ((stderr, "rxvt_control_tty (): Voiding tty associations: previous=%s", fd < 0 ? "no" : "yes")); if (fd >= 0) { ioctl (fd, TIOCNOTTY, NULL); /* void tty associations */ @@ -251,7 +251,7 @@ rxvt_control_tty (int fd_tty, const char *ttydev) # endif /* ---------------------------------------- */ fd = open ("/dev/tty", O_RDWR | O_NOCTTY); - D_TTY ((stderr, "rxvt_control_tty(): /dev/tty has controlling tty? %s", fd < 0 ? "no (good)" : "yes (bad)")); + D_TTY ((stderr, "rxvt_control_tty (): /dev/tty has controlling tty? %s", fd < 0 ? "no (good)" : "yes (bad)")); if (fd >= 0) close (fd); /* ouch: still have controlling tty */ /* ---------------------------------------- */ @@ -262,22 +262,22 @@ rxvt_control_tty (int fd_tty, const char *ttydev) * ldterm: standard terminal line discipline. * ttcompat: V7, 4BSD and XENIX STREAMS compatibility module. * - * After we push the STREAMS modules, the first open() on the slave side + * After we push the STREAMS modules, the first open () on the slave side * (i.e. the next section between the dashes giving us "tty opened OK") * should make the "ptem" (or "ldterm" depending upon either which OS * version or which set of manual pages you have) module give us a - * controlling terminal. We must already have close()d the master side + * controlling terminal. We must already have close ()d the master side * fd in this child process before we push STREAMS modules on because the - * documentation is really unclear about whether it is any close() on - * the master side or the last close() - i.e. a proper STREAMS dismantling - * close() - on the master side which causes a hang up to be sent + * documentation is really unclear about whether it is any close () on + * the master side or the last close () - i.e. a proper STREAMS dismantling + * close () - on the master side which causes a hang up to be sent * through - Geoff Wing */ # ifdef HAVE_ISASTREAM if (isastream (fd_tty) == 1) # endif { - D_TTY ((stderr, "rxvt_control_tty(): Pushing STREAMS modules")); + D_TTY ((stderr, "rxvt_control_tty (): Pushing STREAMS modules")); ioctl (fd_tty, I_PUSH, "ptem"); ioctl (fd_tty, I_PUSH, "ldterm"); ioctl (fd_tty, I_PUSH, "ttcompat"); @@ -286,24 +286,24 @@ rxvt_control_tty (int fd_tty, const char *ttydev) /* ---------------------------------------- */ # if defined(TIOCSCTTY) fd = ioctl (fd_tty, TIOCSCTTY, NULL); - D_TTY ((stderr, "rxvt_control_tty(): ioctl(..,TIOCSCTTY): %d", fd)); + D_TTY ((stderr, "rxvt_control_tty (): ioctl (..,TIOCSCTTY): %d", fd)); # elif defined(TIOCSETCTTY) fd = ioctl (fd_tty, TIOCSETCTTY, NULL); - D_TTY ((stderr, "rxvt_control_tty(): ioctl(..,TIOCSETCTTY): %d", fd)); + D_TTY ((stderr, "rxvt_control_tty (): ioctl (..,TIOCSETCTTY): %d", fd)); # else fd = open (ttydev, O_RDWR); - D_TTY ((stderr, "rxvt_control_tty(): tty open%s", fd < 0 ? " failure" : "ed OK")); + D_TTY ((stderr, "rxvt_control_tty (): tty open%s", fd < 0 ? " failure" : "ed OK")); if (fd >= 0) - close(fd); + close (fd); # endif /* ---------------------------------------- */ fd = open ("/dev/tty", O_WRONLY); - D_TTY ((stderr, "rxvt_control_tty(): do we have controlling tty now: %s", fd < 0 ? "no (fatal)" : "yes (good)")); + D_TTY ((stderr, "rxvt_control_tty (): do we have controlling tty now: %s", fd < 0 ? "no (fatal)" : "yes (good)")); if (fd < 0) return -1; /* fatal */ close (fd); /* ---------------------------------------- */ - D_TTY ((stderr, "rxvt_control_tty(): tcgetpgrp(): %d getpgrp(): %d", tcgetpgrp(fd_tty), getpgrp())); + D_TTY ((stderr, "rxvt_control_tty (): tcgetpgrp (): %d getpgrp (): %d", tcgetpgrp (fd_tty), getpgrp ())); /* ---------------------------------------- */ #endif /* ! __QNX__ */ diff --git a/src/rxvt.C b/src/rxvt.C index c74cb1d0..cc5c4dff 100644 --- a/src/rxvt.C +++ b/src/rxvt.C @@ -2,13 +2,13 @@ #include "iom.h" /*----------------------------------------------------------------------*/ -/* main() */ +/* main () */ int -main(int argc, const char *const *argv) +main (int argc, const char *const *argv) { rxvt_init_signals (); - if (!rxvt_init(argc, argv)) + if (!rxvt_init (argc, argv)) return EXIT_FAILURE; iom.loop (); diff --git a/src/rxvt.h b/src/rxvt.h index 151032d1..4d8b39c1 100644 --- a/src/rxvt.h +++ b/src/rxvt.h @@ -132,9 +132,9 @@ struct mouse_event { (swapittmp) = (one); (one) = (two); (two) = (swapittmp); \ } while (/* CONSTCOND */ 0) #define BOUND_POSITIVE_INT16(val) \ - (int16_t)((val) <= 0 \ + (int16_t) ((val) <= 0 \ ? 0 \ - : min((val), (((uint16_t)-1)>>1))) + : min ((val), (((uint16_t)-1)>>1))) /* ***************************************************************************** @@ -243,7 +243,7 @@ struct mouse_event { * | +---------+ | * | | ......%%| | * | | ......%%| | - * | | ..()..%%| | + * | | .. ()..%%| | * | | ......%%| | * | | %%%%%%%%| | * | +---------+ | <......................... @@ -295,24 +295,24 @@ struct mouse_event { #define FONT_DN "#-" #define FONT_UP "#+" -/* flags for rxvt_scr_gotorc() */ +/* flags for rxvt_scr_gotorc () */ #define C_RELATIVE 1 /* col movement is relative */ #define R_RELATIVE 2 /* row movement is relative */ #define RELATIVE (R_RELATIVE|C_RELATIVE) -/* modes for rxvt_scr_insdel_chars(), rxvt_scr_insdel_lines() */ +/* modes for rxvt_scr_insdel_chars (), rxvt_scr_insdel_lines () */ #define INSERT -1 /* don't change these values */ #define DELETE +1 #define ERASE +2 -/* modes for rxvt_scr_page() - scroll page. used by scrollbar window */ +/* modes for rxvt_scr_page () - scroll page. used by scrollbar window */ enum page_dirn { UP, DN, NO_DIR }; -/* arguments for rxvt_scr_change_screen() */ +/* arguments for rxvt_scr_change_screen () */ enum { PRIMARY = 0, SECONDARY @@ -598,7 +598,7 @@ enum { if (test) \ PrivateModes |= (bit); \ else \ - PrivateModes &= ~(bit) + PrivateModes &= ~ (bit) #ifdef ALLOW_132_MODE # define PrivMode_Default \ @@ -658,16 +658,16 @@ enum { #ifndef NO_BRIGHTCOLOR # define GET_FGCOLOR(x) \ ((((x) & RS_Bold) == 0 \ - || GET_BASEFG(x) < minCOLOR \ - || GET_BASEFG(x) >= minBrightCOLOR) \ - ? GET_BASEFG(x) \ - : (GET_BASEFG(x) + (minBrightCOLOR - minCOLOR))) + || GET_BASEFG (x) < minCOLOR \ + || GET_BASEFG (x) >= minBrightCOLOR) \ + ? GET_BASEFG (x) \ + : (GET_BASEFG (x) + (minBrightCOLOR - minCOLOR))) # define GET_BGCOLOR(x) \ ((((x) & RS_Blink) == 0 \ - || GET_BASEBG(x) < minCOLOR \ - || GET_BASEBG(x) >= minBrightCOLOR) \ - ? GET_BASEBG(x) \ - : (GET_BASEBG(x) + (minBrightCOLOR - minCOLOR))) + || GET_BASEBG (x) < minCOLOR \ + || GET_BASEBG (x) >= minBrightCOLOR) \ + ? GET_BASEBG (x) \ + : (GET_BASEBG (x) + (minBrightCOLOR - minCOLOR))) #else # define GET_FGCOLOR(x) GET_BASEFG(x) # define GET_BGCOLOR(x) GET_BASEBG(x) @@ -701,7 +701,7 @@ enum { #define scrollbarnext_dnval() (scrollBar.end + (scrollBar.width + 1)) #define scrollbarnext_upButton(y) ((y) > scrollBar.end \ - && (y) <= scrollbarnext_dnval()) + && (y) <= scrollbarnext_dnval ()) #define scrollbarnext_dnButton(y) ((y) > scrollbarnext_dnval()) #define SCROLLNEXT_MINHEIGHT SB_THUMB_MIN_HEIGHT #define scrollbarrxvt_upButton(y) ((y) < scrollBar.beg) @@ -716,7 +716,7 @@ enum { #define scrollbar_below_slider(y) ((y) > scrollBar.bot) #define scrollbar_position(y) ((y) - scrollBar.beg) #define scrollbar_size() (scrollBar.end - scrollBar.beg \ - - scrollbar_minheight()) + - scrollbar_minheight ()) #if (MENUBAR_MAX > 1) /* rendition style flags */ @@ -1025,7 +1025,7 @@ struct rxvt_term : rxvt_vars { #endif #ifdef MULTICHAR_SET int oldcursormulti; - void (*multichar_decode)(unsigned char *str, int len); + void (*multichar_decode) (unsigned char *str, int len); #endif #ifndef RESET_TTY_TO_COMMON_DEFAULTS struct stat ttyfd_stat; /* original status of our tty */ @@ -1034,7 +1034,7 @@ struct rxvt_term : rxvt_vars { menu_t *ActiveMenu, /* currently active menu */ *BuildMenu; /* the menu currently being built */ bar_t *CurrentBar; -# if !(MENUBAR_MAX > 1) +# if ! (MENUBAR_MAX > 1) bar_t BarList; # endif /* (MENUBAR_MAX > 1) */ #endif @@ -1135,7 +1135,7 @@ struct rxvt_term : rxvt_vars { int run_command (const char *const *argv); int run_child (const char *const *argv); - void color_aliases(int idx); + void color_aliases (int idx); void recolour_cursor (); void create_windows (int argc, const char *const *argv); void resize_all_windows (unsigned int width, unsigned int height, int ignoreparent); @@ -1163,7 +1163,7 @@ struct rxvt_term : rxvt_vars { void selection_extend (int x, int y, int flag); void selection_rotate (int x, int y); - /* screen(!) */ + /* screen (!) */ void scr_blank_line (text_t *et, rend_t *er, unsigned int width, rend_t efs); void scr_blank_screen_mem (text_t **tp, rend_t **rp, unsigned int row, rend_t efs); int scr_scroll_text (int row1, int row2, int count, int spec); @@ -1200,7 +1200,7 @@ struct rxvt_term : rxvt_vars { unsigned char * get_to_st (unsigned char *ends_how); void process_dcs_seq (); void process_osc_seq (); - void xterm_seq (int op, const char *str, unsigned char resp __attribute__((unused))); + void xterm_seq (int op, const char *str, unsigned char resp __attribute__ ((unused))); int privcases (int mode, unsigned long bit); void process_terminal_mode (int mode, int priv, unsigned int nargs, const int *arg); void process_sgr_mode (unsigned int nargs, const int *arg); @@ -1237,7 +1237,7 @@ struct rxvt_term : rxvt_vars { void drawtriangle (int x, int y, int state); void drawbox_menuitem (int y, int state); void menu_show (); - void menu_display (void (*update)(rxvt_t *)); + void menu_display (void (*update) (rxvt_t *)); void menu_hide_all (); void menu_hide (); void menu_clear (menu_t *menu); diff --git a/src/rxvtc.C b/src/rxvtc.C index 23c9114a..00b9ef2d 100644 --- a/src/rxvtc.C +++ b/src/rxvtc.C @@ -36,7 +36,7 @@ client::client () extern char **environ; int -main(int argc, const char *const *argv) +main (int argc, const char *const *argv) { client c; char buf[PATH_MAX]; @@ -50,7 +50,7 @@ main(int argc, const char *const *argv) } c.send ("NEW"); - // instead of getcwd we could opendir(".") and pass the fd for fchdir *g* + // instead of getcwd we could opendir (".") and pass the fd for fchdir *g* c.send ("CWD"), c.send (getcwd (buf, sizeof (buf))); for (char **var = environ; *environ; environ++) diff --git a/src/rxvtcolor.h b/src/rxvtcolor.h index d811a27a..8a6f0a72 100644 --- a/src/rxvtcolor.h +++ b/src/rxvtcolor.h @@ -90,8 +90,8 @@ struct rxvt_display : refcounted { struct im_watcher : watcher, callback0 { template - im_watcher (O1 *object, void (O2::*method)()) - : callback0(object,method) + im_watcher (O1 *object, void (O2::*method) ()) + : callback0 (object,method) { } void start (rxvt_display *display) @@ -108,8 +108,8 @@ struct xevent_watcher : watcher, callback1 { Window window; template - xevent_watcher (O1 *object, void (O2::*method)(XEvent &)) - : callback1(object,method) + xevent_watcher (O1 *object, void (O2::*method) (XEvent &)) + : callback1 (object,method) { } void start (rxvt_display *display, Window window) @@ -132,14 +132,14 @@ typedef unsigned long Pixel; struct rxvt_color { #if XFT XftColor c; - operator Pixel() const { return c.pixel; } + operator Pixel () const { return c.pixel; } #else Pixel p; - operator Pixel() const { return p; } + operator Pixel () const { return p; } #endif - bool operator == (const rxvt_color &b) const { return Pixel(*this) == Pixel(b); } - bool operator != (const rxvt_color &b) const { return Pixel(*this) != Pixel(b); } + bool operator == (const rxvt_color &b) const { return Pixel (*this) == Pixel (b); } + bool operator != (const rxvt_color &b) const { return Pixel (*this) != Pixel (b); } void get (rxvt_display *display, unsigned short &cr, unsigned short &cg, unsigned short &cb); diff --git a/src/rxvtd.C b/src/rxvtd.C index dd7af946..66a14ae8 100644 --- a/src/rxvtd.C +++ b/src/rxvtd.C @@ -140,7 +140,7 @@ void server::read_cb (io_watcher &w, short revents) rxvt_init (argv.size (), argv.begin ()); environ = old_environ; - envv.clear (); // can't yet save the env 'cause rxvt modifies it :( + envv.clear (); // can't yet save the env 'cause rxvt modifies it : ( } } else @@ -151,7 +151,7 @@ void server::read_cb (io_watcher &w, short revents) } int -main(int argc, const char *const *argv) +main (int argc, const char *const *argv) { rxvt_init_signals (); @@ -163,11 +163,11 @@ main(int argc, const char *const *argv) iom.loop (); #if 0 - if (rxvt_init(argc, argv) == NULL) + if (rxvt_init (argc, argv) == NULL) return EXIT_FAILURE; dR; - rxvt_main_loop(aR); /* main processing loop */ + rxvt_main_loop (aR); /* main processing loop */ #endif return EXIT_SUCCESS; } diff --git a/src/rxvtstl.h b/src/rxvtstl.h index d1ecc72d..d1a80572 100644 --- a/src/rxvtstl.h +++ b/src/rxvtstl.h @@ -21,13 +21,13 @@ struct rxvt_vec : simplevec { void erase (iterator i) { simplevec::erase ((void **)i); } iterator begin () const { return (iterator)simplevec::begin (); } iterator end () const { return (iterator)simplevec::end (); } - T &operator [](int i) { return *(T *)(&((*(simplevec *)this)[i])); } - const T &operator [](int i) const { return *(const T *)(&((*(const simplevec *)this)[i])); } + T &operator [] (int i) { return * (T *) (& ((* (simplevec *)this)[i])); } + const T &operator [] (int i) const { return * (const T *) (& ((* (const simplevec *)this)[i])); } }; #endif template -I find(I first, I last, const T& value) +I find (I first, I last, const T& value) { while (first != last && *first != value) ++first; @@ -39,51 +39,51 @@ template struct auto_ptr { T *p; - auto_ptr() : p(0) { } - auto_ptr(T *a) : p(a) { } + auto_ptr () : p (0) { } + auto_ptr (T *a) : p (a) { } - auto_ptr(auto_ptr &a) + auto_ptr (auto_ptr &a) { p = a.p; a.p = 0; } template - auto_ptr(auto_ptr &a) + auto_ptr (auto_ptr &a) { p = a.p; a.p = 0; } - ~auto_ptr() + ~auto_ptr () { delete p; } // void because it makes sense in our context - void operator =(T *a) + void operator = (T *a) { delete p; p = a; } - void operator =(auto_ptr &a) + void operator = (auto_ptr &a) { *this = a.p; a.p = 0; } template - void operator =(auto_ptr &a) + void operator = (auto_ptr &a) { *this = a.p; a.p = 0; } - operator T *() const { return p; } + operator T * () const { return p; } - T *operator ->() const { return p; } - T &operator *() const { return *p; } + T *operator -> () const { return p; } + T &operator * () const { return *p; } T *get () { @@ -99,7 +99,7 @@ struct stringvec : simplevec { ~stringvec () { - for (char **c = begin(); c != end(); c++) + for (char **c = begin (); c != end (); c++) delete [] *c; } }; diff --git a/src/salloc.C b/src/salloc.C index eb132602..c9708222 100644 --- a/src/salloc.C +++ b/src/salloc.C @@ -40,7 +40,7 @@ rxvt_salloc::alloc () firstfree = sizeof (chain); } - r = (void *)((char *)firstblock + firstfree); + r = (void *) ((char *)firstblock + firstfree); firstfree += size; } diff --git a/src/screen.C b/src/screen.C index 16f75aa3..f0d23f86 100644 --- a/src/screen.C +++ b/src/screen.C @@ -73,17 +73,17 @@ inline void fill_text (text_t *start, text_t value, int len) /* these must be row_col_t */ #define ROWCOL_IS_AFTER(X, Y) \ - ROW_AND_COL_IS_AFTER((X).row, (X).col, (Y).row, (Y).col) + ROW_AND_COL_IS_AFTER ((X).row, (X).col, (Y).row, (Y).col) #define ROWCOL_IS_BEFORE(X, Y) \ - ROW_AND_COL_IS_BEFORE((X).row, (X).col, (Y).row, (Y).col) + ROW_AND_COL_IS_BEFORE ((X).row, (X).col, (Y).row, (Y).col) #define ROWCOL_IN_ROW_AFTER(X, Y) \ - ROW_AND_COL_IN_ROW_AFTER((X).row, (X).col, (Y).row, (Y).col) + ROW_AND_COL_IN_ROW_AFTER ((X).row, (X).col, (Y).row, (Y).col) #define ROWCOL_IN_ROW_BEFORE(X, Y) \ - ROW_AND_COL_IN_ROW_BEFORE((X).row, (X).col, (Y).row, (Y).col) + ROW_AND_COL_IN_ROW_BEFORE ((X).row, (X).col, (Y).row, (Y).col) #define ROWCOL_IN_ROW_AT_OR_AFTER(X, Y) \ - ROW_AND_COL_IN_ROW_AT_OR_AFTER((X).row, (X).col, (Y).row, (Y).col) + ROW_AND_COL_IN_ROW_AT_OR_AFTER ((X).row, (X).col, (Y).row, (Y).col) #define ROWCOL_IN_ROW_AT_OR_BEFORE(X, Y) \ - ROW_AND_COL_IN_ROW_AT_OR_BEFORE((X).row, (X).col, (Y).row, (Y).col) + ROW_AND_COL_IN_ROW_AT_OR_BEFORE ((X).row, (X).col, (Y).row, (Y).col) /* * CLEAR_ROWS : clear rows starting from row @@ -95,20 +95,20 @@ inline void fill_text (text_t *start, text_t value, int len) #define CLEAR_ROWS(row, num) \ if (TermWin.mapped) \ XClearArea (display->display, drawBuffer, TermWin.int_bwidth, \ - Row2Pixel(row), (unsigned int)TermWin.width, \ - (unsigned int)Height2Pixel(num), False) + Row2Pixel (row), (unsigned int)TermWin.width, \ + (unsigned int)Height2Pixel (num), False) #define CLEAR_CHARS(x, y, num) \ if (TermWin.mapped) \ XClearArea (display->display, drawBuffer, x, y, \ - (unsigned int)Width2Pixel(num), \ - (unsigned int)Height2Pixel(1), False) + (unsigned int)Width2Pixel (num), \ + (unsigned int)Height2Pixel (1), False) #define ERASE_ROWS(row, num) \ XFillRectangle (display->display, drawBuffer, TermWin.gc, \ - TermWin.int_bwidth, Row2Pixel(row), \ + TermWin.int_bwidth, Row2Pixel (row), \ (unsigned int)TermWin.width, \ - (unsigned int)Height2Pixel(num)) + (unsigned int)Height2Pixel (num)) /* ------------------------------------------------------------------------- * * SCREEN `COMMON' ROUTINES * @@ -133,7 +133,7 @@ void rxvt_term::scr_blank_screen_mem (text_t **tp, rend_t **rp, unsigned int row, rend_t efs) { #ifdef DEBUG_STRICT - assert((tp[row] && rp[row]) || (tp[row] == NULL && rp[row] == NULL)); + assert ((tp[row] && rp[row]) || (tp[row] == NULL && rp[row] == NULL)); #endif if (tp[row] == NULL) { @@ -155,7 +155,7 @@ rxvt_term::scr_reset () int k; rend_t setrstyle; - D_SCREEN((stderr, "rxvt_scr_reset()")); + D_SCREEN ((stderr, "rxvt_scr_reset ()")); TermWin.view_start = 0; num_scr = 0; @@ -192,18 +192,18 @@ rxvt_term::scr_reset () * first time called so just malloc everything : don't rely on realloc * Note: this is still needed so that all the scrollback lines are NULL */ - screen.text = (text_t **)rxvt_calloc(total_rows, sizeof(text_t *)); - buf_text = (text_t **)rxvt_calloc(total_rows, sizeof(text_t *)); - drawn_text = (text_t **)rxvt_calloc(nrow, sizeof(text_t *)); - swap.text = (text_t **)rxvt_calloc(nrow, sizeof(text_t *)); + screen.text = (text_t **)rxvt_calloc (total_rows, sizeof (text_t *)); + buf_text = (text_t **)rxvt_calloc (total_rows, sizeof (text_t *)); + drawn_text = (text_t **)rxvt_calloc (nrow, sizeof (text_t *)); + swap.text = (text_t **)rxvt_calloc (nrow, sizeof (text_t *)); - screen.tlen = (int16_t *)rxvt_calloc(total_rows, sizeof(int16_t)); - swap.tlen = (int16_t *)rxvt_calloc(nrow, sizeof(int16_t)); + screen.tlen = (int16_t *)rxvt_calloc (total_rows, sizeof (int16_t)); + swap.tlen = (int16_t *)rxvt_calloc (nrow, sizeof (int16_t)); - screen.rend = (rend_t **)rxvt_calloc(total_rows, sizeof(rend_t *)); - buf_rend = (rend_t **)rxvt_calloc(total_rows, sizeof(rend_t *)); - drawn_rend = (rend_t **)rxvt_calloc(nrow, sizeof(rend_t *)); - swap.rend = (rend_t **)rxvt_calloc(nrow, sizeof(rend_t *)); + screen.rend = (rend_t **)rxvt_calloc (total_rows, sizeof (rend_t *)); + buf_rend = (rend_t **)rxvt_calloc (total_rows, sizeof (rend_t *)); + drawn_rend = (rend_t **)rxvt_calloc (nrow, sizeof (rend_t *)); + swap.rend = (rend_t **)rxvt_calloc (nrow, sizeof (rend_t *)); for (p = 0; p < nrow; p++) { @@ -214,7 +214,7 @@ rxvt_term::scr_reset () scr_blank_screen_mem (drawn_text, drawn_rend, p, DEFAULT_RSTYLE); } - MEMSET(charsets, 'B', sizeof(charsets)); + MEMSET (charsets, 'B', sizeof (charsets)); TermWin.nscrolled = 0; /* no saved lines */ rstyle = DEFAULT_RSTYLE; screen.flags = Screen_DefaultFlags; @@ -323,12 +323,12 @@ rxvt_term::scr_reset () TermWin.nscrolled -= k; } #ifdef DEBUG_STRICT - assert(screen.cur.row < TermWin.nrow); - assert(swap.cur.row < TermWin.nrow); + assert (screen.cur.row < TermWin.nrow); + assert (swap.cur.row < TermWin.nrow); #else /* drive with your eyes closed */ - MIN_IT(screen.cur.row, nrow - 1); - MIN_IT(swap.cur.row, nrow - 1); + MIN_IT (screen.cur.row, nrow - 1); + MIN_IT (swap.cur.row, nrow - 1); #endif TermWin.ncol = ncol; // save b/c scr_blank_screen_mem uses this } @@ -347,11 +347,11 @@ rxvt_term::scr_reset () text_t *t = (text_t *)ta->alloc (); memcpy (t, screen.text[p], common * sizeof (text_t)); screen.text[p] = t; rend_t *r = (rend_t *)ra->alloc (); memcpy (r, screen.rend[p], common * sizeof (rend_t)); screen.rend[p] = r; - MIN_IT(screen.tlen[p], (int16_t)ncol); + MIN_IT (screen.tlen[p], (int16_t)ncol); if (ncol > prev_ncol) - scr_blank_line (&(screen.text[p][prev_ncol]), - &(screen.rend[p][prev_ncol]), + scr_blank_line (& (screen.text[p][prev_ncol]), + & (screen.rend[p][prev_ncol]), ncol - prev_ncol, setrstyle); } @@ -363,8 +363,8 @@ rxvt_term::scr_reset () rend_t *r = (rend_t *)ra->alloc (); memcpy (r, drawn_rend[p], common * sizeof (rend_t)); drawn_rend[p] = r; if (ncol > prev_ncol) - scr_blank_line (&(drawn_text[p][prev_ncol]), - &(drawn_rend[p][prev_ncol]), + scr_blank_line (& (drawn_text[p][prev_ncol]), + & (drawn_rend[p][prev_ncol]), ncol - prev_ncol, setrstyle); if (swap.text[p]) @@ -372,11 +372,11 @@ rxvt_term::scr_reset () text_t *t = (text_t *)ta->alloc (); memcpy (t, swap.text[p], common * sizeof (text_t)); swap.text[p] = t; rend_t *r = (rend_t *)ra->alloc (); memcpy (r, swap.rend[p], common * sizeof (rend_t)); swap.rend[p] = r; - MIN_IT(swap.tlen[p], (int16_t)ncol); + MIN_IT (swap.tlen[p], (int16_t)ncol); if (ncol > prev_ncol) - scr_blank_line (&(swap.text[p][prev_ncol]), - &(swap.rend[p][prev_ncol]), + scr_blank_line (& (swap.text[p][prev_ncol]), + & (swap.rend[p][prev_ncol]), ncol - prev_ncol, setrstyle); } @@ -390,13 +390,13 @@ rxvt_term::scr_reset () } if (tabs) - free(tabs); + free (tabs); } prev_nrow = nrow; prev_ncol = ncol; - tabs = (char *)rxvt_malloc (ncol * sizeof(char)); + tabs = (char *)rxvt_malloc (ncol * sizeof (char)); for (p = 0; p < ncol; p++) tabs[p] = (p % TABSIZE == 0) ? 1 : 0; @@ -405,25 +405,25 @@ rxvt_term::scr_reset () } void -rxvt_term::scr_reset_realloc() +rxvt_term::scr_reset_realloc () { uint16_t total_rows, nrow; nrow = TermWin.nrow; total_rows = nrow + TermWin.saveLines; /* *INDENT-OFF* */ - screen.text = (text_t **)rxvt_realloc(screen.text, total_rows * sizeof(text_t *)); - buf_text = (text_t **)rxvt_realloc(buf_text , total_rows * sizeof(text_t *)); - drawn_text = (text_t **)rxvt_realloc(drawn_text , nrow * sizeof(text_t *)); - swap.text = (text_t **)rxvt_realloc(swap.text , nrow * sizeof(text_t *)); - - screen.tlen = (int16_t *)rxvt_realloc(screen.tlen, total_rows * sizeof(int16_t)); - swap.tlen = (int16_t *)rxvt_realloc(swap.tlen , total_rows * sizeof(int16_t)); - - screen.rend = (rend_t **)rxvt_realloc(screen.rend, total_rows * sizeof(rend_t *)); - buf_rend = (rend_t **)rxvt_realloc(buf_rend , total_rows * sizeof(rend_t *)); - drawn_rend = (rend_t **)rxvt_realloc(drawn_rend , nrow * sizeof(rend_t *)); - swap.rend = (rend_t **)rxvt_realloc(swap.rend , nrow * sizeof(rend_t *)); + screen.text = (text_t **)rxvt_realloc (screen.text, total_rows * sizeof (text_t *)); + buf_text = (text_t **)rxvt_realloc (buf_text , total_rows * sizeof (text_t *)); + drawn_text = (text_t **)rxvt_realloc (drawn_text , nrow * sizeof (text_t *)); + swap.text = (text_t **)rxvt_realloc (swap.text , nrow * sizeof (text_t *)); + + screen.tlen = (int16_t *)rxvt_realloc (screen.tlen, total_rows * sizeof (int16_t)); + swap.tlen = (int16_t *)rxvt_realloc (swap.tlen , total_rows * sizeof (int16_t)); + + screen.rend = (rend_t **)rxvt_realloc (screen.rend, total_rows * sizeof (rend_t *)); + buf_rend = (rend_t **)rxvt_realloc (buf_rend , total_rows * sizeof (rend_t *)); + drawn_rend = (rend_t **)rxvt_realloc (drawn_rend , nrow * sizeof (rend_t *)); + swap.rend = (rend_t **)rxvt_realloc (swap.rend , nrow * sizeof (rend_t *)); /* *INDENT-ON* */ } @@ -432,7 +432,7 @@ rxvt_term::scr_reset_realloc() * Free everything. That way malloc debugging can find leakage. */ void -rxvt_term::scr_release() +rxvt_term::scr_release () { uint16_t total_rows; int i; @@ -444,7 +444,7 @@ rxvt_term::scr_release() { if (screen.text[i]) /* then so is screen.rend[i] */ - assert(screen.rend[i]); + assert (screen.rend[i]); } #endif @@ -479,7 +479,7 @@ rxvt_term::scr_release() void rxvt_term::scr_poweron () { - D_SCREEN((stderr, "rxvt_scr_poweron()")); + D_SCREEN ((stderr, "rxvt_scr_poweron ()")); scr_release (); prev_nrow = prev_ncol = 0; @@ -505,14 +505,14 @@ rxvt_term::scr_cursor (int mode) { screen_t *s; - D_SCREEN((stderr, "rxvt_scr_cursor(%c)", mode)); + D_SCREEN ((stderr, "rxvt_scr_cursor (%c)", mode)); #if NSCREENS && !defined(NO_SECONDARY_SCREEN_CURSOR) if (current_screen == SECONDARY) - s = &(swap); + s = & (swap); else #endif - s = &(screen); + s = & (screen); switch (mode) { case SAVE: @@ -534,14 +534,14 @@ rxvt_term::scr_cursor (int mode) break; } /* boundary check in case screen size changed between SAVE and RESTORE */ - MIN_IT(s->cur.row, TermWin.nrow - 1); - MIN_IT(s->cur.col, TermWin.ncol - 1); + MIN_IT (s->cur.row, TermWin.nrow - 1); + MIN_IT (s->cur.col, TermWin.ncol - 1); #ifdef DEBUG_STRICT - assert(s->cur.row >= 0); - assert(s->cur.col >= 0); + assert (s->cur.row >= 0); + assert (s->cur.col >= 0); #else /* drive with your eyes closed */ - MAX_IT(s->cur.row, 0); - MAX_IT(s->cur.col, 0); + MAX_IT (s->cur.row, 0); + MAX_IT (s->cur.col, 0); #endif } @@ -561,7 +561,7 @@ rxvt_term::scr_change_screen (int scrn) want_refresh = 1; - D_SCREEN((stderr, "rxvt_scr_change_screen(%d)", scrn)); + D_SCREEN ((stderr, "rxvt_scr_change_screen (%d)", scrn)); TermWin.view_start = 0; @@ -570,29 +570,29 @@ rxvt_term::scr_change_screen (int scrn) selection_check (2); /* check for boundary cross */ - SWAP_IT(current_screen, scrn, int); + SWAP_IT (current_screen, scrn, int); #if NSCREENS num_scr = 0; offset = TermWin.saveLines; for (i = prev_nrow; i--;) { - SWAP_IT(screen.text[i + offset], swap.text[i], text_t *); - SWAP_IT(screen.tlen[i + offset], swap.tlen[i], int16_t); - SWAP_IT(screen.rend[i + offset], swap.rend[i], rend_t *); + SWAP_IT (screen.text[i + offset], swap.text[i], text_t *); + SWAP_IT (screen.tlen[i + offset], swap.tlen[i], int16_t); + SWAP_IT (screen.rend[i + offset], swap.rend[i], rend_t *); } - SWAP_IT(screen.cur.row, swap.cur.row, int16_t); - SWAP_IT(screen.cur.col, swap.cur.col, int16_t); + SWAP_IT (screen.cur.row, swap.cur.row, int16_t); + SWAP_IT (screen.cur.col, swap.cur.col, int16_t); # ifdef DEBUG_STRICT - assert((screen.cur.row >= 0) && (screen.cur.row < prev_nrow)); - assert((screen.cur.col >= 0) && (screen.cur.col < prev_ncol)); + assert ((screen.cur.row >= 0) && (screen.cur.row < prev_nrow)); + assert ((screen.cur.col >= 0) && (screen.cur.col < prev_ncol)); # else /* drive with your eyes closed */ - MAX_IT(screen.cur.row, 0); - MIN_IT(screen.cur.row, (int32_t)prev_nrow - 1); - MAX_IT(screen.cur.col, 0); - MIN_IT(screen.cur.col, (int32_t)prev_ncol - 1); + MAX_IT (screen.cur.row, 0); + MIN_IT (screen.cur.row, (int32_t)prev_nrow - 1); + MAX_IT (screen.cur.col, 0); + MIN_IT (screen.cur.col, (int32_t)prev_ncol - 1); # endif - SWAP_IT(screen.charset, swap.charset, int16_t); - SWAP_IT(screen.flags, swap.flags, int); + SWAP_IT (screen.charset, swap.charset, int16_t); + SWAP_IT (screen.flags, swap.flags, int); screen.flags |= Screen_VisibleCursor; swap.flags |= Screen_VisibleCursor; @@ -615,7 +615,7 @@ rxvt_term::scr_change_screen (int scrn) && !Gr_Displayed () # endif ) - scr_scroll_text(0, (prev_nrow - 1), prev_nrow, 0); + scr_scroll_text (0, (prev_nrow - 1), prev_nrow, 0); # endif #endif return scrn; @@ -630,9 +630,9 @@ rxvt_term::scr_color (unsigned int color, int fgbg) { color &= RS_fgMask; if (fgbg == Color_fg) - rstyle = SET_FGCOLOR(rstyle, color); + rstyle = SET_FGCOLOR (rstyle, color); else - rstyle = SET_BGCOLOR(rstyle, color); + rstyle = SET_BGCOLOR (rstyle, color); } /* ------------------------------------------------------------------------- */ @@ -667,7 +667,7 @@ rxvt_term::scr_scroll_text (int row1, int row2, int count, int spec) return 0; want_refresh = 1; - D_SCREEN((stderr, "rxvt_scroll_text(%d,%d,%d,%d): %s", row1, row2, count, spec, (current_screen == PRIMARY) ? "Primary" : "Secondary")); + D_SCREEN ((stderr, "rxvt_scroll_text (%d,%d,%d,%d): %s", row1, row2, count, spec, (current_screen == PRIMARY) ? "Primary" : "Secondary")); if ((count > 0) && (row1 == 0) && (current_screen == PRIMARY)) { @@ -720,7 +720,7 @@ rxvt_term::scr_scroll_text (int row1, int row2, int count, int spec) count = -count; i = row2 - row1 + 1; - MIN_IT(count, i); + MIN_IT (count, i); if (j > 0) { @@ -801,8 +801,8 @@ rxvt_term::scr_add_lines (const uint32_t *str, int nlines, int len) want_refresh = 1; last_col = TermWin.ncol; - D_SCREEN((stderr, "rxvt_scr_add_lines(%d,%d)", nlines, len)); - ZERO_SCROLLBACK(); + D_SCREEN ((stderr, "rxvt_scr_add_lines (%d,%d)", nlines, len)); + ZERO_SCROLLBACK (); if (nlines > 0) { nlines += (screen.cur.row - screen.bscroll); @@ -811,18 +811,18 @@ rxvt_term::scr_add_lines (const uint32_t *str, int nlines, int len) && (screen.bscroll == (TermWin.nrow - 1))) { /* _at least_ this many lines need to be scrolled */ - scr_scroll_text(screen.tscroll, screen.bscroll, nlines, 0); + scr_scroll_text (screen.tscroll, screen.bscroll, nlines, 0); screen.cur.row -= nlines; } } #ifdef DEBUG_STRICT - assert(screen.cur.col < last_col); - assert((screen.cur.row < TermWin.nrow) - && (screen.cur.row >= -(int32_t)TermWin.nscrolled)); + assert (screen.cur.col < last_col); + assert ((screen.cur.row < TermWin.nrow) + && (screen.cur.row >= - (int32_t)TermWin.nscrolled)); #else /* drive with your eyes closed */ - MIN_IT(screen.cur.col, last_col - 1); - MIN_IT(screen.cur.row, (int32_t)TermWin.nrow - 1); - MAX_IT(screen.cur.row, -(int32_t)TermWin.nscrolled); + MIN_IT (screen.cur.col, last_col - 1); + MIN_IT (screen.cur.row, (int32_t)TermWin.nrow - 1); + MAX_IT (screen.cur.row, - (int32_t)TermWin.nscrolled); #endif row = screen.cur.row + TermWin.saveLines; @@ -843,7 +843,7 @@ rxvt_term::scr_add_lines (const uint32_t *str, int nlines, int len) continue; case '\n': if (screen.tlen[row] != -1) /* XXX: think about this */ - MAX_IT(screen.tlen[row], screen.cur.col); + MAX_IT (screen.tlen[row], screen.cur.col); screen.flags &= ~Screen_WrapNext; if (screen.cur.row == screen.bscroll) scr_scroll_text (screen.tscroll, screen.bscroll, 1, 0); @@ -854,7 +854,7 @@ rxvt_term::scr_add_lines (const uint32_t *str, int nlines, int len) continue; case '\r': if (screen.tlen[row] != -1) /* XXX: think about this */ - MAX_IT(screen.tlen[row], screen.cur.col); + MAX_IT (screen.tlen[row], screen.cur.col); screen.flags &= ~Screen_WrapNext; screen.cur.col = 0; continue; @@ -865,8 +865,8 @@ rxvt_term::scr_add_lines (const uint32_t *str, int nlines, int len) } if (checksel /* see if we're writing within selection */ - && !ROWCOL_IS_BEFORE(screen.cur, selection.beg) - && ROWCOL_IS_BEFORE(screen.cur, selection.end)) + && !ROWCOL_IS_BEFORE (screen.cur, selection.beg) + && ROWCOL_IS_BEFORE (screen.cur, selection.end)) { checksel = 0; clearsel = 1; @@ -875,7 +875,7 @@ rxvt_term::scr_add_lines (const uint32_t *str, int nlines, int len) { screen.tlen[row] = -1; if (screen.cur.row == screen.bscroll) - scr_scroll_text(screen.tscroll, screen.bscroll, 1, 0); + scr_scroll_text (screen.tscroll, screen.bscroll, 1, 0); else if (screen.cur.row < (TermWin.nrow - 1)) row = (++screen.cur.row) + TermWin.saveLines; stp = screen.text[row]; /* _must_ refresh */ @@ -931,7 +931,7 @@ rxvt_term::scr_add_lines (const uint32_t *str, int nlines, int len) } if (screen.tlen[row] != -1) /* XXX: think about this */ - MAX_IT(screen.tlen[row], screen.cur.col); + MAX_IT (screen.tlen[row], screen.cur.col); /* * If we wrote anywhere in the selected area, kill the selection @@ -939,12 +939,12 @@ rxvt_term::scr_add_lines (const uint32_t *str, int nlines, int len) * should be a similar check. */ if (clearsel) - CLEAR_SELECTION(); + CLEAR_SELECTION (); #ifdef DEBUG_STRICT - assert(screen.cur.row >= 0); + assert (screen.cur.row >= 0); #else /* drive with your eyes closed */ - MAX_IT(screen.cur.row, 0); + MAX_IT (screen.cur.row, 0); #endif } @@ -985,7 +985,7 @@ rxvt_term::scr_tab (int count) { int i, x; - D_SCREEN((stderr, "rxvt_scr_tab(%d)", count)); + D_SCREEN ((stderr, "rxvt_scr_tab (%d)", count)); want_refresh = 1; i = x = screen.cur.col; if (count == 0) @@ -1076,18 +1076,18 @@ void rxvt_term::scr_gotorc (int row, int col, int relative) { want_refresh = 1; - ZERO_SCROLLBACK(); + ZERO_SCROLLBACK (); #ifdef RXVT_GRAPHICS if (Gr_Displayed ()) Gr_scroll (0); #endif - D_SCREEN((stderr, "rxvt_scr_gotorc(r:%s%d,c:%s%d): from (r:%d,c:%d)", (relative & R_RELATIVE ? "+" : ""), row, (relative & C_RELATIVE ? "+" : ""), col, screen.cur.row, screen.cur.col)); + D_SCREEN ((stderr, "rxvt_scr_gotorc (r:%s%d,c:%s%d): from (r:%d,c:%d)", (relative & R_RELATIVE ? "+" : ""), row, (relative & C_RELATIVE ? "+" : ""), col, screen.cur.row, screen.cur.col)); screen.cur.col = ((relative & C_RELATIVE) ? (screen.cur.col + col) : col); - MAX_IT(screen.cur.col, 0); - MIN_IT(screen.cur.col, (int32_t)TermWin.ncol - 1); + MAX_IT (screen.cur.col, 0); + MIN_IT (screen.cur.col, (int32_t)TermWin.ncol - 1); screen.flags &= ~Screen_WrapNext; if (relative & R_RELATIVE) @@ -1114,13 +1114,13 @@ rxvt_term::scr_gotorc (int row, int col, int relative) if (screen.flags & Screen_Relative) { /* relative origin mode */ screen.cur.row = row + screen.tscroll; - MIN_IT(screen.cur.row, screen.bscroll); + MIN_IT (screen.cur.row, screen.bscroll); } else screen.cur.row = row; } - MAX_IT(screen.cur.row, 0); - MIN_IT(screen.cur.row, (int32_t)TermWin.nrow - 1); + MAX_IT (screen.cur.row, 0); + MIN_IT (screen.cur.row, (int32_t)TermWin.nrow - 1); } /* ------------------------------------------------------------------------- */ @@ -1134,9 +1134,9 @@ rxvt_term::scr_index (enum page_dirn direction) want_refresh = 1; dirn = ((direction == UP) ? 1 : -1); - D_SCREEN((stderr, "rxvt_scr_index(%d)", dirn)); + D_SCREEN ((stderr, "rxvt_scr_index (%d)", dirn)); - ZERO_SCROLLBACK(); + ZERO_SCROLLBACK (); #ifdef RXVT_GRAPHICS if (Gr_Displayed ()) @@ -1146,11 +1146,11 @@ rxvt_term::scr_index (enum page_dirn direction) screen.flags &= ~Screen_WrapNext; if ((screen.cur.row == screen.bscroll && direction == UP) || (screen.cur.row == screen.tscroll && direction == DN)) - scr_scroll_text(screen.tscroll, screen.bscroll, dirn, 0); + scr_scroll_text (screen.tscroll, screen.bscroll, dirn, 0); else screen.cur.row += dirn; - MAX_IT(screen.cur.row, 0); - MIN_IT(screen.cur.row, (int32_t)TermWin.nrow - 1); + MAX_IT (screen.cur.row, 0); + MIN_IT (screen.cur.row, (int32_t)TermWin.nrow - 1); selection_check (0); } @@ -1167,7 +1167,7 @@ rxvt_term::scr_erase_line (int mode) unsigned int row, col, num; want_refresh = 1; - D_SCREEN((stderr, "rxvt_scr_erase_line(%d) at screen row: %d", mode, screen.cur.row)); + D_SCREEN ((stderr, "rxvt_scr_erase_line (%d) at screen row: %d", mode, screen.cur.row)); ZERO_SCROLLBACK (); #ifdef RXVT_GRAPHICS @@ -1185,17 +1185,17 @@ rxvt_term::scr_erase_line (int mode) case 0: /* erase to end of line */ col = screen.cur.col; num = TermWin.ncol - col; - MIN_IT(screen.tlen[row], (int16_t)col); - if (ROWCOL_IN_ROW_AT_OR_AFTER(selection.beg, screen.cur) - || ROWCOL_IN_ROW_AT_OR_AFTER(selection.end, screen.cur)) - CLEAR_SELECTION(); + MIN_IT (screen.tlen[row], (int16_t)col); + if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) + || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) + CLEAR_SELECTION (); break; case 1: /* erase to beginning of line */ col = 0; num = screen.cur.col + 1; - if (ROWCOL_IN_ROW_AT_OR_BEFORE(selection.beg, screen.cur) - || ROWCOL_IN_ROW_AT_OR_BEFORE(selection.end, screen.cur)) - CLEAR_SELECTION(); + if (ROWCOL_IN_ROW_AT_OR_BEFORE (selection.beg, screen.cur) + || ROWCOL_IN_ROW_AT_OR_BEFORE (selection.end, screen.cur)) + CLEAR_SELECTION (); break; case 2: /* erase whole line */ col = 0; @@ -1203,15 +1203,15 @@ rxvt_term::scr_erase_line (int mode) screen.tlen[row] = 0; if (selection.beg.row <= screen.cur.row && selection.end.row >= screen.cur.row) - CLEAR_SELECTION(); + CLEAR_SELECTION (); break; default: return; } if (screen.text[row]) - scr_blank_line (&(screen.text[row][col]), - &(screen.rend[row][col]), num, rstyle); + scr_blank_line (& (screen.text[row][col]), + & (screen.rend[row][col]), num, rstyle); else scr_blank_screen_mem (screen.text, screen.rend, row, rstyle); } @@ -1232,7 +1232,7 @@ rxvt_term::scr_erase_screen (int mode) XGCValues gcvalue; want_refresh = 1; - D_SCREEN((stderr, "rxvt_scr_erase_screen(%d) at screen row: %d", mode, screen.cur.row)); + D_SCREEN ((stderr, "rxvt_scr_erase_screen (%d) at screen row: %d", mode, screen.cur.row)); ZERO_SCROLLBACK (); row_offset = (int32_t)TermWin.saveLines; @@ -1269,27 +1269,27 @@ rxvt_term::scr_erase_screen (int mode) CLEAR_SELECTION (); if (row >= TermWin.nrow) /* Out Of Bounds */ return; - MIN_IT(num, (TermWin.nrow - row)); + MIN_IT (num, (TermWin.nrow - row)); if (rstyle & (RS_RVid | RS_Uline)) ren = (rend_t) ~RS_None; - else if (GET_BASEBG(rstyle) == Color_bg) + else if (GET_BASEBG (rstyle) == Color_bg) { ren = DEFAULT_RSTYLE; - CLEAR_ROWS(row, num); + CLEAR_ROWS (row, num); } else { ren = (rstyle & (RS_fgMask | RS_bgMask)); - gcvalue.foreground = PixColors[GET_BGCOLOR(rstyle)]; - XChangeGC(display->display, TermWin.gc, GCForeground, &gcvalue); - ERASE_ROWS(row, num); + gcvalue.foreground = PixColors[GET_BGCOLOR (rstyle)]; + XChangeGC (display->display, TermWin.gc, GCForeground, &gcvalue); + ERASE_ROWS (row, num); gcvalue.foreground = PixColors[Color_fg]; - XChangeGC(display->display, TermWin.gc, GCForeground, &gcvalue); + XChangeGC (display->display, TermWin.gc, GCForeground, &gcvalue); } for (; num--; row++) { scr_blank_screen_mem (screen.text, screen.rend, - (unsigned int)(row + row_offset), rstyle); + (unsigned int) (row + row_offset), rstyle); screen.tlen[row + row_offset] = 0; scr_blank_line (drawn_text[row], drawn_rend[row], (unsigned int)TermWin.ncol, ren); @@ -1309,7 +1309,7 @@ rxvt_term::scr_E () want_refresh = 1; num_scr_allow = 0; - ZERO_SCROLLBACK(); + ZERO_SCROLLBACK (); selection_check (3); fs = SET_FONT (rstyle, TermWin.fontset->find_font ('E')); @@ -1331,7 +1331,7 @@ rxvt_term::scr_insdel_lines (int count, int insdel) { int end; - ZERO_SCROLLBACK(); + ZERO_SCROLLBACK (); #ifdef RXVT_GRAPHICS if (Gr_Displayed ()) @@ -1353,7 +1353,7 @@ rxvt_term::scr_insdel_lines (int count, int insdel) } screen.flags &= ~Screen_WrapNext; - scr_scroll_text(screen.cur.row, screen.bscroll, insdel * count, 0); + scr_scroll_text (screen.cur.row, screen.bscroll, insdel * count, 0); } /* ------------------------------------------------------------------------- */ @@ -1370,7 +1370,7 @@ rxvt_term::scr_insdel_chars (int count, int insdel) int16_t *slp; want_refresh = 1; - ZERO_SCROLLBACK(); + ZERO_SCROLLBACK (); #ifdef RXVT_GRAPHICS if (Gr_Displayed ()) @@ -1381,14 +1381,14 @@ rxvt_term::scr_insdel_chars (int count, int insdel) return; selection_check (1); - MIN_IT(count, (TermWin.ncol - screen.cur.col)); + MIN_IT (count, (TermWin.ncol - screen.cur.col)); row = screen.cur.row + TermWin.saveLines; screen.flags &= ~Screen_WrapNext; stp = screen.text[row]; srp = screen.rend[row]; - slp = &(screen.tlen[row]); + slp = & (screen.tlen[row]); switch (insdel) { case INSERT: @@ -1401,14 +1401,14 @@ rxvt_term::scr_insdel_chars (int count, int insdel) if (*slp != -1) { *slp += count; - MIN_IT(*slp, TermWin.ncol); + MIN_IT (*slp, TermWin.ncol); } if (selection.op && current_screen == selection.screen - && ROWCOL_IN_ROW_AT_OR_AFTER(selection.beg, screen.cur)) + && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) { if (selection.end.row != screen.cur.row || (selection.end.col + count >= TermWin.ncol)) - CLEAR_SELECTION(); + CLEAR_SELECTION (); else { /* shift selection */ selection.beg.col += count; @@ -1416,14 +1416,14 @@ rxvt_term::scr_insdel_chars (int count, int insdel) selection.end.col += count; } } - scr_blank_line (&(stp[screen.cur.col]), &(srp[screen.cur.col]), + scr_blank_line (& (stp[screen.cur.col]), & (srp[screen.cur.col]), (unsigned int)count, rstyle); break; case ERASE: screen.cur.col += count; /* don't worry if > TermWin.ncol */ selection_check (1); screen.cur.col -= count; - scr_blank_line (&(stp[screen.cur.col]), &(srp[screen.cur.col]), + scr_blank_line (& (stp[screen.cur.col]), & (srp[screen.cur.col]), (unsigned int)count, rstyle); break; case DELETE: @@ -1434,20 +1434,20 @@ rxvt_term::scr_insdel_chars (int count, int insdel) stp[col] = stp[col + count]; srp[col] = srp[col + count]; } - scr_blank_line (&(stp[TermWin.ncol - count]), - &(srp[TermWin.ncol - count]), + scr_blank_line (& (stp[TermWin.ncol - count]), + & (srp[TermWin.ncol - count]), (unsigned int)count, tr); if (*slp == -1) /* break line continuation */ *slp = TermWin.ncol; *slp -= count; - MAX_IT(*slp, 0); + MAX_IT (*slp, 0); if (selection.op && current_screen == selection.screen - && ROWCOL_IN_ROW_AT_OR_AFTER(selection.beg, screen.cur)) + && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) { if (selection.end.row != screen.cur.row || (screen.cur.col >= selection.beg.col - count) || selection.end.col >= TermWin.ncol) - CLEAR_SELECTION(); + CLEAR_SELECTION (); else { /* shift selection */ @@ -1468,8 +1468,8 @@ rxvt_term::scr_insdel_chars (int count, int insdel) void rxvt_term::scr_scroll_region (int top, int bot) { - MAX_IT(top, 0); - MIN_IT(bot, (int)TermWin.nrow - 1); + MAX_IT (top, 0); + MIN_IT (bot, (int)TermWin.nrow - 1); if (top > bot) return; screen.tscroll = top; @@ -1505,7 +1505,7 @@ rxvt_term::scr_autowrap (int mode) if (mode) screen.flags |= Screen_Autowrap; else - screen.flags &= ~(Screen_Autowrap | Screen_WrapNext); + screen.flags &= ~ (Screen_Autowrap | Screen_WrapNext); } /* ------------------------------------------------------------------------- */ @@ -1554,7 +1554,7 @@ void rxvt_term::scr_set_tab (int mode) { if (mode < 0) - MEMSET(tabs, 0, TermWin.ncol * sizeof(char)); + MEMSET (tabs, 0, TermWin.ncol * sizeof (char)); else if (screen.cur.col < TermWin.ncol) tabs[screen.cur.col] = (mode ? 1 : 0); } @@ -1573,19 +1573,19 @@ rxvt_term::scr_rvideo_mode (int mode) if (rvideo != mode) { rvideo = mode; - SWAP_IT(PixColors[Color_fg], PixColors[Color_bg], rxvt_color); + SWAP_IT (PixColors[Color_fg], PixColors[Color_bg], rxvt_color); #if defined(XPM_BACKGROUND) if (bgPixmap.pixmap == None) #endif #if defined(TRANSPARENT) - if (!(Options & Opt_transparent) || am_transparent == 0) + if (! (Options & Opt_transparent) || am_transparent == 0) #endif - XSetWindowBackground(display->display, TermWin.vt, + XSetWindowBackground (display->display, TermWin.vt, PixColors[Color_bg]); gcvalue.foreground = PixColors[Color_fg]; gcvalue.background = PixColors[Color_bg]; - XChangeGC(display->display, TermWin.gc, GCBackground | GCForeground, + XChangeGC (display->display, TermWin.gc, GCBackground | GCForeground, &gcvalue); scr_clear (); scr_touch (true); @@ -1600,7 +1600,7 @@ rxvt_term::scr_rvideo_mode (int mode) void rxvt_term::scr_report_position () { - tt_printf("\033[%d;%dR", screen.cur.row + 1, screen.cur.col + 1); + tt_printf ("\033[%d;%dR", screen.cur.row + 1, screen.cur.col + 1); } /* ------------------------------------------------------------------------- * @@ -1711,30 +1711,30 @@ rxvt_term::scr_expose (int x, int y, int width, int height, bool refresh) return; #ifdef DEBUG_STRICT - x = max(x, (int)TermWin.int_bwidth); - x = min(x, (int)TermWin.width); - y = max(y, (int)TermWin.int_bwidth); - y = min(y, (int)TermWin.height); + x = max (x, (int)TermWin.int_bwidth); + x = min (x, (int)TermWin.width); + y = max (y, (int)TermWin.int_bwidth); + y = min (y, (int)TermWin.height); #endif /* round down */ - rc[PART_BEG].col = Pixel2Col(x); - rc[PART_BEG].row = Pixel2Row(y); + rc[PART_BEG].col = Pixel2Col (x); + rc[PART_BEG].row = Pixel2Row (y); /* round up */ - rc[PART_END].col = Pixel2Width(x + width + TermWin.fwidth - 1); - rc[PART_END].row = Pixel2Row(y + height + TermWin.fheight - 1); + rc[PART_END].col = Pixel2Width (x + width + TermWin.fwidth - 1); + rc[PART_END].row = Pixel2Row (y + height + TermWin.fheight - 1); /* sanity checks */ for (i = PART_BEG; i < RC_COUNT; i++) { - MIN_IT(rc[i].col, TermWin.ncol - 1); - MIN_IT(rc[i].row, TermWin.nrow - 1); + MIN_IT (rc[i].col, TermWin.ncol - 1); + MIN_IT (rc[i].row, TermWin.nrow - 1); } - D_SCREEN((stderr, "rxvt_scr_expose(x:%d, y:%d, w:%d, h:%d) area (c:%d,r:%d)-(c:%d,r:%d)", x, y, width, height, rc[PART_BEG].col, rc[PART_BEG].row, rc[PART_END].col, rc[PART_END].row)); + D_SCREEN ((stderr, "rxvt_scr_expose (x:%d, y:%d, w:%d, h:%d) area (c:%d,r:%d)- (c:%d,r:%d)", x, y, width, height, rc[PART_BEG].col, rc[PART_BEG].row, rc[PART_END].col, rc[PART_END].row)); for (i = rc[PART_BEG].row; i <= rc[PART_END].row; i++) - fill_text (&(drawn_text[i][rc[PART_BEG].col]), 0, + fill_text (& (drawn_text[i][rc[PART_BEG].col]), 0, (rc[PART_END].col - rc[PART_BEG].col + 1)); if (refresh) @@ -1766,11 +1766,11 @@ rxvt_term::scr_move_to (int y, int len) if (y < len) { p = (TermWin.nrow + TermWin.nscrolled) * (len - y) / len; - p -= (long)(TermWin.nrow - 1); - p = max(p, 0); + p -= (long) (TermWin.nrow - 1); + p = max (p, 0); } - TermWin.view_start = (uint16_t)min(p, TermWin.nscrolled); - D_SCREEN((stderr, "rxvt_scr_move_to(%d, %d) view_start:%d", y, len, TermWin.view_start)); + TermWin.view_start = (uint16_t)min (p, TermWin.nscrolled); + D_SCREEN ((stderr, "rxvt_scr_move_to (%d, %d) view_start:%d", y, len, TermWin.view_start)); return scr_changeview (oldviewstart); } @@ -1786,20 +1786,20 @@ rxvt_term::scr_page (enum page_dirn direction, int nlines) int n; uint16_t oldviewstart; - D_SCREEN((stderr, "rxvt_scr_page(%s, %d) view_start:%d", ((direction == UP) ? "UP" : "DN"), nlines, TermWin.view_start)); + D_SCREEN ((stderr, "rxvt_scr_page (%s, %d) view_start:%d", ((direction == UP) ? "UP" : "DN"), nlines, TermWin.view_start)); #ifdef DEBUG_STRICT - assert((nlines >= 0) && (nlines <= TermWin.nrow)); + assert ((nlines >= 0) && (nlines <= TermWin.nrow)); #endif oldviewstart = TermWin.view_start; if (direction == UP) { n = TermWin.view_start + nlines; - TermWin.view_start = min(n, TermWin.nscrolled); + TermWin.view_start = min (n, TermWin.nscrolled); } else { n = TermWin.view_start - nlines; - TermWin.view_start = max(n, 0); + TermWin.view_start = max (n, 0); } return scr_changeview (oldviewstart); } @@ -1816,7 +1816,7 @@ rxvt_term::scr_changeview (uint16_t oldviewstart) #endif num_scr -= (TermWin.view_start - oldviewstart); } - return (int)(TermWin.view_start - oldviewstart); + return (int) (TermWin.view_start - oldviewstart); } /* ------------------------------------------------------------------------- */ @@ -1828,7 +1828,7 @@ rxvt_term::scr_bell () # ifdef MAPALERT_OPTION if (Options & Opt_mapAlert) # endif - XMapWindow(display->display, TermWin.parent[0]); + XMapWindow (display->display, TermWin.parent[0]); # endif if (Options & Opt_visualBell) { @@ -1836,7 +1836,7 @@ rxvt_term::scr_bell () scr_rvideo_mode (!rvideo); /* refresh also done */ } else - XBell(display->display, 0); + XBell (display->display, 0); #endif } @@ -1866,9 +1866,9 @@ rxvt_term::scr_printscreen (int fullhist) { t = screen.text[r1 + row_offset]; for (i = TermWin.ncol - 1; i >= 0; i--) - if (!isspace(t[i])) + if (!isspace (t[i])) break; - fprintf(fd, "%.*s\n", (i + 1), t); + fprintf (fd, "%.*s\n", (i + 1), t); } pclose_printer (fd); #endif @@ -1882,11 +1882,11 @@ rxvt_term::scr_printscreen (int fullhist) */ #define FONT_WIDTH(X, Y) \ - (X)->per_char[(Y) - (X)->min_char_or_byte2].width + (X)->per_char[ (Y) - (X)->min_char_or_byte2].width #define FONT_RBEAR(X, Y) \ - (X)->per_char[(Y) - (X)->min_char_or_byte2].rbearing + (X)->per_char[ (Y) - (X)->min_char_or_byte2].rbearing #define FONT_LBEAR(X, Y) \ - (X)->per_char[(Y) - (X)->min_char_or_byte2].lbearing + (X)->per_char[ (Y) - (X)->min_char_or_byte2].lbearing #define IS_FONT_CHAR(X, Y) \ ((Y) >= (X)->min_char_or_byte2 && (Y) <= (X)->max_char_or_byte2) @@ -1904,7 +1904,7 @@ rxvt_term::scr_refresh (unsigned char refresh_type) int i, /* tmp */ row_offset; /* basic offset in screen structure */ #ifndef NO_CURSORCOLOR - rend_t cc1; /* store colours at cursor position(s) */ + rend_t cc1; /* store colours at cursor position (s) */ #endif rend_t *drp, *srp; /* drawn-rend-pointer, screen-rend-pointer */ text_t *dtp, *stp; /* drawn-text-pointer, screen-text-pointer */ @@ -1941,7 +1941,7 @@ rxvt_term::scr_refresh (unsigned char refresh_type) scr_reverse_selection (); /* - * C: set the cursor character(s) + * C: set the cursor character (s) */ { unsigned char setoldcursor; @@ -1961,7 +1961,7 @@ rxvt_term::scr_refresh (unsigned char refresh_type) { cursorwidth++; - srp = &(screen.rend[screen.cur.row + TermWin.saveLines] + srp = & (screen.rend[screen.cur.row + TermWin.saveLines] [screen.cur.col]); if (showcursor && TermWin.focus) @@ -1973,7 +1973,7 @@ rxvt_term::scr_refresh (unsigned char refresh_type) ccol1 = Color_cursor; else #ifdef CURSOR_COLOR_IS_RENDITION_COLOR - ccol1 = GET_FGCOLOR(rstyle); + ccol1 = GET_FGCOLOR (rstyle); #else ccol1 = Color_fg; #endif @@ -1981,12 +1981,12 @@ rxvt_term::scr_refresh (unsigned char refresh_type) ccol2 = Color_cursor2; else #ifdef CURSOR_COLOR_IS_RENDITION_COLOR - ccol2 = GET_BGCOLOR(rstyle); + ccol2 = GET_BGCOLOR (rstyle); #else ccol2 = Color_bg; #endif - *srp = SET_FGCOLOR(*srp, ccol1); - *srp = SET_BGCOLOR(*srp, ccol2); + *srp = SET_FGCOLOR (*srp, ccol1); + *srp = SET_BGCOLOR (*srp, ccol2); #endif } @@ -2031,7 +2031,7 @@ rxvt_term::scr_refresh (unsigned char refresh_type) */ i = num_scr; if (refresh_type == FAST_REFRESH && num_scr_allow && i - && abs(i) < TermWin.nrow && !must_clear) + && abs (i) < TermWin.nrow && !must_clear) { int16_t nits; int j; @@ -2079,9 +2079,9 @@ rxvt_term::scr_refresh (unsigned char refresh_type) { /* also comes here at end if needed because of >= above */ if (wlen < len) - SWAP_IT(wlen, len, int); + SWAP_IT (wlen, len, int); - D_SCREEN((stderr, "rxvt_scr_refresh(): XCopyArea: %d -> %d (height: %d)", len + i, len, wlen - len + 1)); + D_SCREEN ((stderr, "rxvt_scr_refresh (): XCopyArea: %d -> %d (height: %d)", len + i, len, wlen - len + 1)); XCopyArea (display->display, TermWin.vt, TermWin.vt, TermWin.gc, 0, Row2Pixel (len + i), (unsigned int)TermWin_TotalWidth (), @@ -2106,7 +2106,7 @@ rxvt_term::scr_refresh (unsigned char refresh_type) /* * E2: OK, now the real pass */ - int ypixel = (int)Row2Pixel(row); + int ypixel = (int)Row2Pixel (row); for (col = 0; col < TermWin.ncol; col++) { @@ -2116,7 +2116,7 @@ rxvt_term::scr_refresh (unsigned char refresh_type) if (stp[col] == dtp[col] /* Must match characters to skip. */ && (rend == drp[col] /* Either rendition the same or */ || (stp[col] == ' ' /* space w/ no background change */ - && GET_BGATTR(rend) == GET_BGATTR(drp[col])))) + && GET_BGATTR (rend) == GET_BGATTR (drp[col])))) continue; text_t *text = stp + col; @@ -2130,7 +2130,7 @@ rxvt_term::scr_refresh (unsigned char refresh_type) if (*text == NOCHAR) // never start redrawing at invisible characters. */ continue; - int xpixel = Col2Pixel(col); + int xpixel = Col2Pixel (col); // this loop looks very messy, it can probably be optimized // and cleaned a bit by you? @@ -2179,10 +2179,10 @@ rxvt_term::scr_refresh (unsigned char refresh_type) rend = GET_ATTR (rend); - rvid = !!(rend & RS_RVid); + rvid = !! (rend & RS_RVid); if (rvid) { - SWAP_IT(fore, back, int); + SWAP_IT (fore, back, int); #ifndef NO_BOLD_UNDERLINE_REVERSE if (ISSET_PIXCOLOR (Color_RV) @@ -2250,9 +2250,9 @@ rxvt_term::scr_refresh (unsigned char refresh_type) font->draw (xpixel, ypixel, text, count, fore, back); if ((rend & RS_Uline) && (font->descent > 1)) - XDrawLine(display->display, drawBuffer, TermWin.gc, + XDrawLine (display->display, drawBuffer, TermWin.gc, xpixel, ypixel + font->ascent + 1, - xpixel + Width2Pixel(count) - 1, ypixel + font->ascent + 1); + xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); } /* for (col....) */ } /* for (row....) */ @@ -2263,11 +2263,11 @@ rxvt_term::scr_refresh (unsigned char refresh_type) { if (TermWin.focus) { - srp = &(screen.rend[screen.cur.row + TermWin.saveLines] + srp = & (screen.rend[screen.cur.row + TermWin.saveLines] [screen.cur.col]); *srp ^= RS_RVid; #ifndef NO_CURSORCOLOR - *srp = (*srp & ~(RS_fgMask | RS_bgMask)) | cc1; + *srp = (*srp & ~ (RS_fgMask | RS_bgMask)) | cc1; #endif } @@ -2277,11 +2277,11 @@ rxvt_term::scr_refresh (unsigned char refresh_type) if (ISSET_PIXCOLOR (Color_cursor)) XSetForeground (display->display, TermWin.gc, PixColors[Color_cursor]); #endif - XDrawRectangle(display->display, drawBuffer, TermWin.gc, - Col2Pixel(oldcursor.col), - Row2Pixel(oldcursor.row), - (unsigned int)(Width2Pixel(cursorwidth) - 1), - (unsigned int)(Height2Pixel(1) - TermWin.lineSpace - 1)); + XDrawRectangle (display->display, drawBuffer, TermWin.gc, + Col2Pixel (oldcursor.col), + Row2Pixel (oldcursor.row), + (unsigned int) (Width2Pixel (cursorwidth) - 1), + (unsigned int) (Height2Pixel (1) - TermWin.lineSpace - 1)); } } @@ -2298,20 +2298,20 @@ rxvt_term::scr_refresh (unsigned char refresh_type) * clear the whole screen height, note that width == 0 is treated * specially by XClearArea */ - XClearArea(display->display, TermWin.vt, 0, 0, + XClearArea (display->display, TermWin.vt, 0, 0, (unsigned int)TermWin.int_bwidth, - (unsigned int)TermWin_TotalHeight(), False); + (unsigned int)TermWin_TotalHeight (), False); if (clearlast && TermWin.int_bwidth) /* * clear the whole screen height, note that width == 0 is treated * specially by XClearArea */ - XClearArea(display->display, TermWin.vt, + XClearArea (display->display, TermWin.vt, TermWin.width + TermWin.int_bwidth, 0, (unsigned int)TermWin.int_bwidth, - (unsigned int)TermWin_TotalHeight(), False); + (unsigned int)TermWin_TotalHeight (), False); if (refresh_type & SMOOTH_REFRESH) - XSync(display->display, False); + XSync (display->display, False); num_scr = 0; num_scr_allow = 1; @@ -2320,7 +2320,7 @@ rxvt_term::scr_refresh (unsigned char refresh_type) /* ------------------------------------------------------------------------- */ void -rxvt_term::scr_clear() +rxvt_term::scr_clear () { if (!TermWin.mapped) return; @@ -2332,14 +2332,14 @@ rxvt_term::scr_clear() { int i; - if (!(Options & Opt_transparent_all)) + if (! (Options & Opt_transparent_all)) i = 0; else - i = (int)(sizeof(TermWin.parent) / sizeof(Window)); + i = (int) (sizeof (TermWin.parent) / sizeof (Window)); while (i--) if (TermWin.parent[i] != None) - XClearWindow(display->display, TermWin.parent[i]); + XClearWindow (display->display, TermWin.parent[i]); } #endif @@ -2395,13 +2395,13 @@ rxvt_term::scr_dump (int fd) : TermWin.ncol; for (towrite = width; towrite; towrite -= wrote) { - wrote = write(fd, &(screen.text[row][width - towrite]), + wrote = write (fd, & (screen.text[row][width - towrite]), towrite); if (wrote < 0) return; /* XXX: death, no report */ } if (screen.tlen[row] >= 0) - if (write(fd, r1, 1) <= 0) + if (write (fd, r1, 1) <= 0) return; /* XXX: death, no report */ } } @@ -2423,25 +2423,25 @@ rxvt_term::selection_check (int check_more) return; pos.row = pos.col = 0; - if ((selection.beg.row < -(int32_t)TermWin.nscrolled) + if ((selection.beg.row < - (int32_t)TermWin.nscrolled) || (selection.beg.row >= TermWin.nrow) - || (selection.mark.row < -(int32_t)TermWin.nscrolled) + || (selection.mark.row < - (int32_t)TermWin.nscrolled) || (selection.mark.row >= TermWin.nrow) - || (selection.end.row < -(int32_t)TermWin.nscrolled) + || (selection.end.row < - (int32_t)TermWin.nscrolled) || (selection.end.row >= TermWin.nrow) || (check_more == 1 && current_screen == selection.screen - && !ROWCOL_IS_BEFORE(screen.cur, selection.beg) - && ROWCOL_IS_BEFORE(screen.cur, selection.end)) + && !ROWCOL_IS_BEFORE (screen.cur, selection.beg) + && ROWCOL_IS_BEFORE (screen.cur, selection.end)) || (check_more == 2 - && ROWCOL_IS_BEFORE(selection.beg, pos) - && ROWCOL_IS_AFTER(selection.end, pos)) + && ROWCOL_IS_BEFORE (selection.beg, pos) + && ROWCOL_IS_AFTER (selection.end, pos)) || (check_more == 3 - && ROWCOL_IS_AFTER(selection.end, pos)) + && ROWCOL_IS_AFTER (selection.end, pos)) || (check_more == 4 /* screen width change */ && (selection.beg.row != selection.end.row || selection.end.col > TermWin.ncol))) - CLEAR_SELECTION(); + CLEAR_SELECTION (); } /* ------------------------------------------------------------------------- */ @@ -2472,7 +2472,7 @@ rxvt_term::paste (const unsigned char *data, unsigned int len) tt_write (ds, (int)n); } - free(ds); + free (ds); } /* ------------------------------------------------------------------------- */ @@ -2487,7 +2487,7 @@ rxvt_term::selection_paste (Window win, Atom prop, bool delete_prop) unsigned long bytes_after; XTextProperty ct; - D_SELECT((stderr, "rxvt_selection_paste(%08lx, %lu, %d), wait=%2x", win, (unsigned long)prop, (int)delete_prop, selection_wait)); + D_SELECT ((stderr, "rxvt_selection_paste (%08lx, %lu, %d), wait=%2x", win, (unsigned long)prop, (int)delete_prop, selection_wait)); if (prop == None) /* check for failed XConvertSelection */ { @@ -2516,8 +2516,8 @@ rxvt_term::selection_paste (Window win, Atom prop, bool delete_prop) for (;;) { - if (XGetWindowProperty(display->display, win, prop, (long)(nread / 4), - (long)(PROP_SIZE / 4), delete_prop, + if (XGetWindowProperty (display->display, win, prop, (long) (nread / 4), + (long) (PROP_SIZE / 4), delete_prop, AnyPropertyType, &ct.encoding, &ct.format, &ct.nitems, &bytes_after, &ct.value) != Success) @@ -2525,26 +2525,26 @@ rxvt_term::selection_paste (Window win, Atom prop, bool delete_prop) if (ct.encoding == 0) { - D_SELECT((stderr, "rxvt_selection_paste: property didn't exist!")); + D_SELECT ((stderr, "rxvt_selection_paste: property didn't exist!")); break; } if (ct.value == NULL) { - D_SELECT((stderr, "rxvt_selection_paste: property shooting blanks!")); + D_SELECT ((stderr, "rxvt_selection_paste: property shooting blanks!")); continue; } if (ct.nitems == 0) { - D_SELECT((stderr, "rxvt_selection_paste: property empty - also INCR end")); + D_SELECT ((stderr, "rxvt_selection_paste: property empty - also INCR end")); if (selection_wait == Sel_normal && nread == 0) { /* * pass through again trying CUT_BUFFER0 if we've come from - * XConvertSelection() but nothing was presented + * XConvertSelection () but nothing was presented */ - D_SELECT((stderr, "rxvt_selection_request: pasting CUT_BUFFER0")); + D_SELECT ((stderr, "rxvt_selection_request: pasting CUT_BUFFER0")); selection_paste (display->root, XA_CUT_BUFFER0, False); } @@ -2579,7 +2579,7 @@ rxvt_term::selection_paste (Window win, Atom prop, bool delete_prop) if (selection_wait == Sel_normal) selection_wait = Sel_none; - D_SELECT((stderr, "rxvt_selection_paste: bytes written: %ld", nread)); + D_SELECT ((stderr, "rxvt_selection_paste: bytes written: %ld", nread)); return (int)nread; } @@ -2601,7 +2601,7 @@ rxvt_term::selection_property (Window win, Atom prop) if (prop == None) return; - D_SELECT((stderr, "rxvt_selection_property(%08lx, %lu)", win, (unsigned long)prop)); + D_SELECT ((stderr, "rxvt_selection_property (%08lx, %lu)", win, (unsigned long)prop)); if (selection_wait == Sel_normal) { int a, afmt; @@ -2609,19 +2609,19 @@ rxvt_term::selection_property (Window win, Atom prop) unsigned long bytes_after, nitems; unsigned char *s = NULL; - a = XGetWindowProperty(display->display, win, prop, 0L, 1L, False, + a = XGetWindowProperty (display->display, win, prop, 0L, 1L, False, xa[XA_INCR], &atype, &afmt, &nitems, &bytes_after, &s); if (s) - XFree(s); + XFree (s); if (a != Success) return; #ifndef __CYGWIN32__ if (atype == xa[XA_INCR]) { /* start an INCR transfer */ - D_SELECT((stderr, "rxvt_selection_property: INCR: starting transfer")); - XDeleteProperty(display->display, win, prop); - XFlush(display->display); + D_SELECT ((stderr, "rxvt_selection_property: INCR: starting transfer")); + XDeleteProperty (display->display, win, prop); + XFlush (display->display); reget_time = 1; selection_wait = Sel_incr; } @@ -2633,7 +2633,7 @@ rxvt_term::selection_property (Window win, Atom prop) reget_time = 1; if (selection_paste (win, prop, True) == -1) { - D_SELECT((stderr, "rxvt_selection_property: INCR: clean end")); + D_SELECT ((stderr, "rxvt_selection_property: INCR: clean end")); selection_wait = Sel_none; incr_ev.stop (); } @@ -2647,20 +2647,20 @@ rxvt_term::selection_property (Window win, Atom prop) * Order: > internal selection if available * > PRIMARY, SECONDARY, CLIPBOARD if ownership is claimed (+) * > CUT_BUFFER0 - * (+) if ownership is claimed but property is empty, rxvt_selection_paste() + * (+) if ownership is claimed but property is empty, rxvt_selection_paste () * will auto fallback to CUT_BUFFER0 * EXT: button 2 release */ void rxvt_term::selection_request (Time tm, int x, int y) { - D_SELECT((stderr, "rxvt_selection_request(%lu, %d, %d)", tm, x, y)); + D_SELECT ((stderr, "rxvt_selection_request (%lu, %d, %d)", tm, x, y)); if (x < 0 || x >= TermWin.width || y < 0 || y >= TermWin.height) return; /* outside window */ if (selection.text != NULL) { /* internal selection */ - D_SELECT((stderr, "rxvt_selection_request: pasting internal")); + D_SELECT ((stderr, "rxvt_selection_request: pasting internal")); paste (selection.text, selection.len); return; } @@ -2684,8 +2684,8 @@ rxvt_term::selection_request (Time tm, int x, int y) } } - selection_wait = Sel_none; /* don't loop in rxvt_selection_paste() */ - D_SELECT((stderr, "rxvt_selection_request: pasting CUT_BUFFER0")); + selection_wait = Sel_none; /* don't loop in rxvt_selection_paste () */ + D_SELECT ((stderr, "rxvt_selection_request: pasting CUT_BUFFER0")); selection_paste (display->root, XA_CUT_BUFFER0, False); } @@ -2704,10 +2704,10 @@ rxvt_term::selection_request_other (Atom target, int selnum) sel = XA_SECONDARY; else sel = xa[XA_CLIPBOARD]; - if (XGetSelectionOwner(display->display, sel) != None) + if (XGetSelectionOwner (display->display, sel) != None) { - D_SELECT((stderr, "rxvt_selection_request_other: pasting %s", debug_xa_names[selnum])); - XConvertSelection(display->display, sel, target, xa[XA_VT_SELECTION], + D_SELECT ((stderr, "rxvt_selection_request_other: pasting %s", debug_xa_names[selnum])); + XConvertSelection (display->display, sel, target, xa[XA_VT_SELECTION], TermWin.vt, selection_request_time); return 1; } @@ -2722,14 +2722,14 @@ rxvt_term::selection_request_other (Atom target, int selnum) void rxvt_term::selection_clear () { - D_SELECT((stderr, "rxvt_selection_clear()")); + D_SELECT ((stderr, "rxvt_selection_clear ()")); want_refresh = 1; if (selection.text) - free(selection.text); + free (selection.text); selection.text = NULL; selection.len = 0; - CLEAR_SELECTION(); + CLEAR_SELECTION (); } /* ------------------------------------------------------------------------- */ @@ -2748,13 +2748,13 @@ rxvt_term::selection_make (Time tm) rend_t *re; #endif - D_SELECT((stderr, "rxvt_selection_make(): selection.op=%d, selection.clicks=%d", selection.op, selection.clicks)); + D_SELECT ((stderr, "rxvt_selection_make (): selection.op=%d, selection.clicks=%d", selection.op, selection.clicks)); switch (selection.op) { case SELECTION_CONT: break; case SELECTION_INIT: - CLEAR_SELECTION(); + CLEAR_SELECTION (); /* FALLTHROUGH */ case SELECTION_BEGIN: selection.op = SELECTION_DONE; @@ -2768,18 +2768,18 @@ rxvt_term::selection_make (Time tm) return; /* nothing selected, go away */ i = (selection.end.row - selection.beg.row + 1) * (TermWin.ncol + 1) + 1; - str = (char *)rxvt_malloc(i * MB_CUR_MAX + 1); + str = (char *)rxvt_malloc (i * MB_CUR_MAX + 1); new_selection_text = (unsigned char *)str; col = selection.beg.col; - MAX_IT(col, 0); + MAX_IT (col, 0); row = selection.beg.row + TermWin.saveLines; end_row = selection.end.row + TermWin.saveLines; for (; row <= end_row; row++, col = 0) { - t = &(screen.text[row][col]); + t = & (screen.text[row][col]); end_col = screen.tlen[row]; @@ -2837,25 +2837,25 @@ rxvt_term::selection_make (Time tm) if (XGetSelectionOwner (display->display, XA_PRIMARY) == TermWin.vt) display->set_selection_owner (this); else - rxvt_print_error("can't get primary selection"); + rxvt_print_error ("can't get primary selection"); { XTextProperty ct; char *cl = (char *)selection.text; - if (XmbTextListToTextProperty(display->display, &cl, 1, XStringStyle, &ct) >= 0) + if (XmbTextListToTextProperty (display->display, &cl, 1, XStringStyle, &ct) >= 0) { - XChangeProperty(display->display, display->root, XA_CUT_BUFFER0, XA_STRING, 8, + XChangeProperty (display->display, display->root, XA_CUT_BUFFER0, XA_STRING, 8, PropModeReplace, ct.value, ct.nitems); XFree (ct.value); } else - XChangeProperty(display->display, display->root, XA_CUT_BUFFER0, XA_STRING, 8, + XChangeProperty (display->display, display->root, XA_CUT_BUFFER0, XA_STRING, 8, PropModeReplace, selection.text, (int)selection.len); } selection_time = tm; - D_SELECT((stderr, "rxvt_selection_make(): selection.len=%d", selection.len)); + D_SELECT ((stderr, "rxvt_selection_make (): selection.len=%d", selection.len)); } /* ------------------------------------------------------------------------- */ @@ -2866,12 +2866,12 @@ rxvt_term::selection_make (Time tm) void rxvt_term::selection_click (int clicks, int x, int y) { - D_SELECT((stderr, "rxvt_selection_click(%d, %d, %d)", clicks, x, y)); + D_SELECT ((stderr, "rxvt_selection_click (%d, %d, %d)", clicks, x, y)); clicks = ((clicks - 1) % 3) + 1; selection.clicks = clicks; /* save clicks so extend will work */ - selection_start_colrow (Pixel2Col(x), Pixel2Row(y)); + selection_start_colrow (Pixel2Col (x), Pixel2Row (y)); if (clicks == 2 || clicks == 3) selection_extend_colrow (selection.mark.col, @@ -2891,10 +2891,10 @@ rxvt_term::selection_start_colrow (int col, int row) want_refresh = 1; selection.mark.col = col; selection.mark.row = row - TermWin.view_start; - MAX_IT(selection.mark.row, -(int32_t)TermWin.nscrolled); - MIN_IT(selection.mark.row, (int32_t)TermWin.nrow - 1); - MAX_IT(selection.mark.col, 0); - MIN_IT(selection.mark.col, (int32_t)TermWin.ncol - 1); + MAX_IT (selection.mark.row, - (int32_t)TermWin.nscrolled); + MIN_IT (selection.mark.row, (int32_t)TermWin.nrow - 1); + MAX_IT (selection.mark.col, 0); + MIN_IT (selection.mark.col, (int32_t)TermWin.ncol - 1); if (selection.op) { /* clear the old selection */ @@ -2913,7 +2913,7 @@ rxvt_term::selection_start_colrow (int col, int row) /* what do we want: spaces/tabs are delimiters or cutchars or non-cutchars */ #define DELIMIT_TEXT(x) \ - (((x) == ' ' || (x) == '\t') ? 2 : (STRCHR(rs[Rs_cutchars], (x)) != NULL)) + (((x) == ' ' || (x) == '\t') ? 2 : (STRCHR (rs[Rs_cutchars], (x)) != NULL)) #define DELIMIT_REND(x) 1 void @@ -2938,47 +2938,47 @@ rxvt_term::selection_delimit_word (enum page_dirn dirn, const row_col_t *mark, r } row = mark->row + TermWin.saveLines; col = mark->col; - MAX_IT(col, 0); + MAX_IT (col, 0); /* find the edge of a word */ - stp = &(screen.text[row][col]); - w1 = DELIMIT_TEXT(*stp); + stp = & (screen.text[row][col]); + w1 = DELIMIT_TEXT (*stp); if (selection_style != NEW_SELECT) { if (w1 == 1) { stp += dirnadd; - if (DELIMIT_TEXT(*stp) == 1) + if (DELIMIT_TEXT (*stp) == 1) goto Old_Word_Selection_You_Die; col += dirnadd; } w1 = 0; } srp = (&screen.rend[row][col]); - w2 = DELIMIT_REND(*srp); + w2 = DELIMIT_REND (*srp); for (;;) { for (; col != bound.col; col += dirnadd) { stp += dirnadd; - if (DELIMIT_TEXT(*stp) != w1) + if (DELIMIT_TEXT (*stp) != w1) break; srp += dirnadd; - if (DELIMIT_REND(*srp) != w2) + if (DELIMIT_REND (*srp) != w2) break; } if ((col == bound.col) && (row != bound.row)) { - if (screen.tlen[(row - (dirn == UP ? 1 : 0))] == -1) + if (screen.tlen[ (row - (dirn == UP ? 1 : 0))] == -1) { trow = row + dirnadd; tcol = dirn == UP ? TermWin.ncol - 1 : 0; if (screen.text[trow] == NULL) break; - stp = &(screen.text[trow][tcol]); - srp = &(screen.rend[trow][tcol]); - if (DELIMIT_TEXT(*stp) != w1 || DELIMIT_REND(*srp) != w2) + stp = & (screen.text[trow][tcol]); + srp = & (screen.rend[trow][tcol]); + if (DELIMIT_TEXT (*stp) != w1 || DELIMIT_REND (*srp) != w2) break; row = trow; col = tcol; @@ -2988,7 +2988,7 @@ rxvt_term::selection_delimit_word (enum page_dirn dirn, const row_col_t *mark, r break; } Old_Word_Selection_You_Die: - D_SELECT((stderr, "rxvt_selection_delimit_word(%s,...) @ (r:%3d, c:%3d) has boundary (r:%3d, c:%3d)", (dirn == UP ? "up " : "down"), mark->row, mark->col, row - TermWin.saveLines, col)); + D_SELECT ((stderr, "rxvt_selection_delimit_word (%s,...) @ (r:%3d, c:%3d) has boundary (r:%3d, c:%3d)", (dirn == UP ? "up " : "down"), mark->row, mark->col, row - TermWin.saveLines, col)); if (dirn == DN) col++; /* put us on one past the end */ @@ -3011,12 +3011,12 @@ rxvt_term::selection_extend (int x, int y, int flag) { int col, row; - col = Pixel2Col(x); - row = Pixel2Row(y); - MAX_IT(row, 0); - MIN_IT(row, (int)TermWin.nrow - 1); - MAX_IT(col, 0); - MIN_IT(col, (int)TermWin.ncol); + col = Pixel2Col (x); + row = Pixel2Row (y); + MAX_IT (row, 0); + MIN_IT (row, (int)TermWin.nrow - 1); + MAX_IT (col, 0); + MIN_IT (col, (int)TermWin.ncol); #ifndef NO_NEW_SELECTION /* @@ -3036,7 +3036,7 @@ rxvt_term::selection_extend (int x, int y, int flag) selection.beg.col = selection.end.col = 0; selection.clicks = 4; want_refresh = 1; - D_SELECT((stderr, "rxvt_selection_extend() selection.clicks = 4")); + D_SELECT ((stderr, "rxvt_selection_extend () selection.clicks = 4")); return; } } @@ -3063,14 +3063,14 @@ rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int b LEFT, RIGHT } closeto = RIGHT; - D_SELECT((stderr, "rxvt_selection_extend_colrow(c:%d, r:%d, %d, %d) clicks:%d, op:%d", col, row, button3, buttonpress, selection.clicks, selection.op)); - D_SELECT((stderr, "rxvt_selection_extend_colrow() ENT b:(r:%d,c:%d) m:(r:%d,c:%d), e:(r:%d,c:%d)", selection.beg.row, selection.beg.col, selection.mark.row, selection.mark.col, selection.end.row, selection.end.col)); + D_SELECT ((stderr, "rxvt_selection_extend_colrow (c:%d, r:%d, %d, %d) clicks:%d, op:%d", col, row, button3, buttonpress, selection.clicks, selection.op)); + D_SELECT ((stderr, "rxvt_selection_extend_colrow () ENT b: (r:%d,c:%d) m: (r:%d,c:%d), e: (r:%d,c:%d)", selection.beg.row, selection.beg.col, selection.mark.row, selection.mark.col, selection.end.row, selection.end.col)); want_refresh = 1; switch (selection.op) { case SELECTION_INIT: - CLEAR_SELECTION(); + CLEAR_SELECTION (); selection.op = SELECTION_BEGIN; /* FALLTHROUGH */ case SELECTION_BEGIN: @@ -3096,7 +3096,7 @@ rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int b { selection.beg.col = selection.end.col = selection.mark.col; selection.beg.row = selection.end.row = selection.mark.row; - D_SELECT((stderr, "rxvt_selection_extend_colrow() ENT2 b:(r:%d,c:%d) m:(r:%d,c:%d), e:(r:%d,c:%d)", selection.beg.row, selection.beg.col, selection.mark.row, selection.mark.col, selection.end.row, selection.end.col)); + D_SELECT ((stderr, "rxvt_selection_extend_colrow () ENT2 b: (r:%d,c:%d) m: (r:%d,c:%d), e: (r:%d,c:%d)", selection.beg.row, selection.beg.col, selection.mark.row, selection.mark.col, selection.end.row, selection.end.col)); } pos.col = col; @@ -3129,7 +3129,7 @@ rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int b selection.mark.col = selection.beg.col; } } - if (ROWCOL_IS_BEFORE(pos, selection.mark)) + if (ROWCOL_IS_BEFORE (pos, selection.mark)) { selection.end.row = selection.mark.row; selection.end.col = selection.mark.col + 1; @@ -3146,10 +3146,10 @@ rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int b } else if (selection.clicks == 2) { - selection_delimit_word (UP, &(selection.mark), - &(selection.beg)); - selection_delimit_word (DN, &(selection.mark), - &(selection.end)); + selection_delimit_word (UP, & (selection.mark), + & (selection.beg)); + selection_delimit_word (DN, & (selection.mark), + & (selection.end)); hate_those_clicks = 1; } else if (selection.clicks == 3) @@ -3159,7 +3159,7 @@ rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int b selection.end.col = ncol; hate_those_clicks = 1; } - D_SELECT((stderr, "rxvt_selection_extend_colrow() EXIT b:(r:%d,c:%d) m:(r:%d,c:%d), e:(r:%d,c:%d)", selection.beg.row, selection.beg.col, selection.mark.row, selection.mark.col, selection.end.row, selection.end.col)); + D_SELECT ((stderr, "rxvt_selection_extend_colrow () EXIT b: (r:%d,c:%d) m: (r:%d,c:%d), e: (r:%d,c:%d)", selection.beg.row, selection.beg.col, selection.mark.row, selection.mark.col, selection.end.row, selection.end.col)); return; } #endif /* ! NO_OLD_SELECTION */ @@ -3183,8 +3183,8 @@ rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int b /* * first determine which edge of the selection we are closest to */ - if (ROWCOL_IS_BEFORE(pos, selection.beg) - || (!ROWCOL_IS_AFTER(pos, selection.end) + if (ROWCOL_IS_BEFORE (pos, selection.beg) + || (!ROWCOL_IS_AFTER (pos, selection.end) && (((pos.col - selection.beg.col) + ((pos.row - selection.beg.row) * ncol)) < ((selection.end.col - pos.col) @@ -3208,7 +3208,7 @@ rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int b } else { /* button1 drag or button3 drag */ - if (ROWCOL_IS_AFTER(selection.mark, pos)) + if (ROWCOL_IS_AFTER (selection.mark, pos)) { if ((selection.mark.row == selection.end.row) && (selection.mark.col == selection.end.col) @@ -3251,12 +3251,12 @@ rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int b } else if (selection.clicks == 2) { - if (ROWCOL_IS_AFTER(selection.end, selection.beg)) + if (ROWCOL_IS_AFTER (selection.end, selection.beg)) selection.end.col--; - selection_delimit_word (UP, &(selection.beg), - &(selection.beg)); - selection_delimit_word (DN, &(selection.end), - &(selection.end)); + selection_delimit_word (UP, & (selection.beg), + & (selection.beg)); + selection_delimit_word (DN, & (selection.end), + & (selection.end)); } else if (selection.clicks == 3) { @@ -3265,8 +3265,8 @@ rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int b { int end_row; - selection_delimit_word (UP, &(selection.beg), - &(selection.beg)); + selection_delimit_word (UP, & (selection.beg), + & (selection.beg)); end_row = screen.tlen[selection.mark.row + TermWin.saveLines]; for (end_row = selection.mark.row; end_row < TermWin.nrow; @@ -3286,7 +3286,7 @@ rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int b #endif { - if (ROWCOL_IS_AFTER(selection.mark, selection.beg)) + if (ROWCOL_IS_AFTER (selection.mark, selection.beg)) selection.mark.col++; selection.beg.col = 0; selection.end.col = ncol; @@ -3306,7 +3306,7 @@ rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int b selection.mark.col = selection.beg.col; } } - D_SELECT((stderr, "rxvt_selection_extend_colrow() EXIT b:(r:%d,c:%d) m:(r:%d,c:%d), e:(r:%d,c:%d)", selection.beg.row, selection.beg.col, selection.mark.row, selection.mark.col, selection.end.row, selection.end.col)); + D_SELECT ((stderr, "rxvt_selection_extend_colrow () EXIT b: (r:%d,c:%d) m: (r:%d,c:%d), e: (r:%d,c:%d)", selection.beg.row, selection.beg.col, selection.mark.row, selection.mark.col, selection.end.row, selection.end.col)); #endif /* ! NO_NEW_SELECTION */ } @@ -3357,7 +3357,7 @@ void rxvt_term::selection_rotate (int x, int y) { selection.clicks = selection.clicks % 3 + 1; - selection_extend_colrow (Pixel2Col(x), Pixel2Row(y), 1, 0, 1); + selection_extend_colrow (Pixel2Col (x), Pixel2Row (y), 1, 0, 1); } /* ------------------------------------------------------------------------- */ @@ -3401,8 +3401,8 @@ rxvt_term::selection_send (const XSelectionRequestEvent &rq) #if X_HAVE_UTF8_STRING *target++ = (Atom32) xa[XA_UTF8_STRING]; #endif - XChangeProperty(display->display, rq.requestor, rq.property, XA_ATOM, - (8 * sizeof(target_list[0])), PropModeReplace, + XChangeProperty (display->display, rq.requestor, rq.property, XA_ATOM, + (8 * sizeof (target_list[0])), PropModeReplace, (unsigned char *)target_list, target - target_list); ev.property = rq.property; @@ -3413,8 +3413,8 @@ rxvt_term::selection_send (const XSelectionRequestEvent &rq) } else if (rq.target == xa[XA_TIMESTAMP] && selection.text) { - XChangeProperty(display->display, rq.requestor, rq.property, XA_INTEGER, - (8 * sizeof(Time)), PropModeReplace, + XChangeProperty (display->display, rq.requestor, rq.property, XA_INTEGER, + (8 * sizeof (Time)), PropModeReplace, (unsigned char *)&selection_time, 1); ev.property = rq.property; } @@ -3459,7 +3459,7 @@ rxvt_term::selection_send (const XSelectionRequestEvent &rq) selectlen = 0; } - if (XmbTextListToTextProperty(display->display, &cl, 1, style, &ct) >= 0) + if (XmbTextListToTextProperty (display->display, &cl, 1, style, &ct) >= 0) freect = 1; else { @@ -3489,10 +3489,10 @@ rxvt_term::selection_send (const XSelectionRequestEvent &rq) void rxvt_term::pixel_position (int *x, int *y) { - *x = Pixel2Col(*x); - /* MAX_IT(*x, 0); MIN_IT(*x, (int)TermWin.ncol - 1); */ - *y = Pixel2Row(*y); - /* MAX_IT(*y, 0); MIN_IT(*y, (int)TermWin.nrow - 1); */ + *x = Pixel2Col (*x); + /* MAX_IT (*x, 0); MIN_IT (*x, (int)TermWin.ncol - 1); */ + *y = Pixel2Row (*y); + /* MAX_IT (*y, 0); MIN_IT (*y, (int)TermWin.nrow - 1); */ } /* ------------------------------------------------------------------------- */ @@ -3515,7 +3515,7 @@ rxvt_term::im_set_position (XPoint *pos) * ------------------------------------------------------------------------- */ #if 0 void -rxvt_debug_colors(void) +rxvt_debug_colors (void) { int color; const char *name[] = @@ -3524,35 +3524,35 @@ rxvt_debug_colors(void) "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white" }; - fprintf(stderr, "Color ( "); + fprintf (stderr, "Color ( "); if (rstyle & RS_RVid) - fprintf(stderr, "rvid "); + fprintf (stderr, "rvid "); if (rstyle & RS_Bold) - fprintf(stderr, "bold "); + fprintf (stderr, "bold "); if (rstyle & RS_Blink) - fprintf(stderr, "blink "); + fprintf (stderr, "blink "); if (rstyle & RS_Uline) - fprintf(stderr, "uline "); - fprintf(stderr, "): "); + fprintf (stderr, "uline "); + fprintf (stderr, "): "); - color = GET_FGCOLOR(rstyle); + color = GET_FGCOLOR (rstyle); #ifndef NO_BRIGHTCOLOR if (color >= minBrightCOLOR && color <= maxBrightCOLOR) { color -= (minBrightCOLOR - minCOLOR); - fprintf(stderr, "bright "); + fprintf (stderr, "bright "); } #endif - fprintf(stderr, "%s on ", name[color]); + fprintf (stderr, "%s on ", name[color]); - color = GET_BGCOLOR(rstyle); + color = GET_BGCOLOR (rstyle); #ifndef NO_BRIGHTCOLOR if (color >= minBrightCOLOR && color <= maxBrightCOLOR) { color -= (minBrightCOLOR - minCOLOR); - fprintf(stderr, "bright "); + fprintf (stderr, "bright "); } #endif - fprintf(stderr, "%s\n", name[color]); + fprintf (stderr, "%s\n", name[color]); } #endif diff --git a/src/scrollbar-next.C b/src/scrollbar-next.C index d9c4041a..212ce1df 100644 --- a/src/scrollbar-next.C +++ b/src/scrollbar-next.C @@ -123,7 +123,7 @@ rxvt_term::renderPixmap (const char *const *data, int width, int height) Pixmap d; GC pointcolour; - d = XCreatePixmap(display->display, scrollBar.win, width, height, XDEPTH); + d = XCreatePixmap (display->display, scrollBar.win, width, height, XDEPTH); for (y = 0; y < height; y++) { @@ -137,7 +137,7 @@ rxvt_term::renderPixmap (const char *const *data, int width, int height) pointcolour = darkGC; else /* if (a == '#' || a == 'b' || a) */ pointcolour = blackGC; - XDrawPoint(display->display, d, pointcolour, x, y); + XDrawPoint (display->display, d, pointcolour, x, y); } } return d; @@ -154,11 +154,11 @@ rxvt_term::init_scrollbar_stuff () gcvalue.graphics_exposures = False; gcvalue.foreground = PixColors[Color_Black]; - blackGC = XCreateGC(display->display, scrollBar.win, + blackGC = XCreateGC (display->display, scrollBar.win, GCForeground | GCGraphicsExposures, &gcvalue); gcvalue.foreground = PixColors[Color_White]; - whiteGC = XCreateGC(display->display, scrollBar.win, + whiteGC = XCreateGC (display->display, scrollBar.win, GCForeground | GCGraphicsExposures, &gcvalue); xcol.red = 0xaeba; @@ -167,7 +167,7 @@ rxvt_term::init_scrollbar_stuff () //if (!rXAllocColor (&xcol, "light gray"))//TODO//D// xcol.pixel = PixColors[Color_AntiqueWhite]; light = gcvalue.foreground = xcol.pixel; - grayGC = XCreateGC(display->display, scrollBar.win, + grayGC = XCreateGC (display->display, scrollBar.win, GCForeground | GCGraphicsExposures, &gcvalue); xcol.red = 0x51aa; @@ -176,10 +176,10 @@ rxvt_term::init_scrollbar_stuff () //if (!rXAllocColor (&xcol, "dark gray"))//TODO//D// xcol.pixel = PixColors[Color_Grey25]; dark = gcvalue.foreground = xcol.pixel; - darkGC = XCreateGC(display->display, scrollBar.win, + darkGC = XCreateGC (display->display, scrollBar.win, GCForeground | GCGraphicsExposures, &gcvalue); - stipple = XCreateBitmapFromData(display->display, scrollBar.win, + stipple = XCreateBitmapFromData (display->display, scrollBar.win, (char *)n_stp_bits, n_stp_width, n_stp_height); @@ -188,9 +188,9 @@ rxvt_term::init_scrollbar_stuff () gcvalue.fill_style = FillOpaqueStippled; gcvalue.stipple = stipple; - /* XSetWindowBackground(display->display, scrollBar.win, PixColors[Color_Red]); */ + /* XSetWindowBackground (display->display, scrollBar.win, PixColors[Color_Red]); */ - stippleGC = XCreateGC(display->display, scrollBar.win, + stippleGC = XCreateGC (display->display, scrollBar.win, GCForeground | GCBackground | GCStipple | GCFillStyle | GCGraphicsExposures, &gcvalue); @@ -216,15 +216,15 @@ rxvt_term::drawBevel (Drawable d, int x1, int y1, int w, int h) x2 = x1 + w - 1; /* right point */ y2 = y1 + h - 1; /* bottom point */ /* white top and left */ - XDrawLine(display->display, d, whiteGC, x1, y1, x2, y1); - XDrawLine(display->display, d, whiteGC, x1, y1, x1, y2); + XDrawLine (display->display, d, whiteGC, x1, y1, x2, y1); + XDrawLine (display->display, d, whiteGC, x1, y1, x1, y2); /* black bottom and right */ - XDrawLine(display->display, d, blackGC, x1, y2, x2, y2); - XDrawLine(display->display, d, blackGC, x2, y1, x2, y2); + XDrawLine (display->display, d, blackGC, x1, y2, x2, y2); + XDrawLine (display->display, d, blackGC, x2, y1, x2, y2); /* dark inside bottom and right */ x1++, y1++, x2--, y2--; /* move in one point */ - XDrawLine(display->display, d, darkGC, x1, y2, x2, y2); - XDrawLine(display->display, d, darkGC, x2, y1, x2, y2); + XDrawLine (display->display, d, darkGC, x1, y2, x2, y2); + XDrawLine (display->display, d, darkGC, x2, y1, x2, y2); } int @@ -241,28 +241,28 @@ rxvt_term::scrollbar_show_next (int update, int last_top, int last_bot, int scro if (TermWin.nscrolled == 0 || !update) { - XFillRectangle(display->display, scrollBar.win, grayGC, 0, 0, + XFillRectangle (display->display, scrollBar.win, grayGC, 0, 0, SB_WIDTH_NEXT + 1, height); - XDrawRectangle(display->display, scrollBar.win, blackGC, 0, + XDrawRectangle (display->display, scrollBar.win, blackGC, 0, -SB_BORDER_WIDTH, SB_WIDTH_NEXT, height + SB_BORDER_WIDTH); - XFillRectangle(display->display, scrollBar.win, stippleGC, + XFillRectangle (display->display, scrollBar.win, stippleGC, SB_LEFT_PADDING, 0, SB_BUTTON_WIDTH, height); } if (TermWin.nscrolled) { if (last_top < scrollBar.top || !update) - XFillRectangle(display->display, scrollBar.win, stippleGC, + XFillRectangle (display->display, scrollBar.win, stippleGC, SB_LEFT_PADDING, SB_PADDING + last_top, SB_BUTTON_WIDTH, scrollBar.top - last_top); if (scrollBar.bot < last_bot || !update) - XFillRectangle(display->display, scrollBar.win, stippleGC, + XFillRectangle (display->display, scrollBar.win, stippleGC, SB_LEFT_PADDING, scrollBar.bot + SB_PADDING, SB_BUTTON_WIDTH, (last_bot - scrollBar.bot)); - XFillRectangle(display->display, scrollBar.win, grayGC, + XFillRectangle (display->display, scrollBar.win, grayGC, SB_LEFT_PADDING, scrollBar.top + SB_PADDING, SB_BUTTON_WIDTH, scrollbar_len); - XCopyArea(display->display, dimple, scrollBar.win, whiteGC, 0, 0, + XCopyArea (display->display, dimple, scrollBar.win, whiteGC, 0, 0, SCROLLER_DIMPLE_WIDTH, SCROLLER_DIMPLE_HEIGHT, (SB_WIDTH_NEXT - SCROLLER_DIMPLE_WIDTH) / 2, scrollBar.top + SB_BEVEL_WIDTH_UPPER_LEFT + @@ -278,13 +278,13 @@ rxvt_term::scrollbar_show_next (int update, int last_top, int last_bot, int scro height - SB_BUTTON_SINGLE_HEIGHT, SB_BUTTON_WIDTH, SB_BUTTON_HEIGHT); - s = (scrollbar_isUp()) ? upArrowHi : upArrow; - XCopyArea(display->display, s, scrollBar.win, whiteGC, 0, 0, + s = (scrollbar_isUp ()) ? upArrowHi : upArrow; + XCopyArea (display->display, s, scrollBar.win, whiteGC, 0, 0, ARROW_WIDTH, ARROW_HEIGHT, SB_BUTTON_FACE_X, height - SB_BUTTON_BOTH_HEIGHT + SB_BEVEL_WIDTH_UPPER_LEFT); - s = (scrollbar_isDn()) ? downArrowHi : downArrow; - XCopyArea(display->display, s, scrollBar.win, whiteGC, 0, 0, + s = (scrollbar_isDn ()) ? downArrowHi : downArrow; + XCopyArea (display->display, s, scrollBar.win, whiteGC, 0, 0, ARROW_WIDTH, ARROW_HEIGHT, SB_BUTTON_FACE_X, height - SB_BUTTON_SINGLE_HEIGHT + SB_BEVEL_WIDTH_UPPER_LEFT); } diff --git a/src/scrollbar-plain.C b/src/scrollbar-plain.C index d4fad2bb..ed92fb59 100644 --- a/src/scrollbar-plain.C +++ b/src/scrollbar-plain.C @@ -28,7 +28,7 @@ #if defined(PLAIN_SCROLLBAR) int -rxvt_term::scrollbar_show_plain (int update __attribute__((unused)), int last_top, int last_bot, int scrollbar_len) +rxvt_term::scrollbar_show_plain (int update __attribute__ ((unused)), int last_top, int last_bot, int scrollbar_len) { int xsb = 0; int sbwidth = scrollBar.width - 1; diff --git a/src/scrollbar-rxvt.C b/src/scrollbar-rxvt.C index 48675415..a37890fd 100644 --- a/src/scrollbar-rxvt.C +++ b/src/scrollbar-rxvt.C @@ -66,17 +66,17 @@ rxvt_term::Draw_button (int x, int y, int state, int dirn) pt[0].y = pt[1].y = y; pt[2].y = y + sz - 1; } - XFillPolygon(display->display, scrollBar.win, scrollbarGC, + XFillPolygon (display->display, scrollBar.win, scrollbarGC, pt, 3, Convex, CoordModeOrigin); /* draw base */ - XDrawLine(display->display, scrollBar.win, (dirn == UP ? bot : top), + XDrawLine (display->display, scrollBar.win, (dirn == UP ? bot : top), pt[0].x, pt[0].y, pt[1].x, pt[1].y); /* draw shadow on left */ pt[1].x = x + sz2 - 1; pt[1].y = y + (dirn == UP ? 0 : sz - 1); - XDrawLine(display->display, scrollBar.win, top, + XDrawLine (display->display, scrollBar.win, top, pt[0].x, pt[0].y, pt[1].x, pt[1].y); #if (SHADOW > 1) @@ -92,7 +92,7 @@ rxvt_term::Draw_button (int x, int y, int state, int dirn) pt[0].y++; pt[1].y--; } - XDrawLine(display->display, scrollBar.win, top, + XDrawLine (display->display, scrollBar.win, top, pt[0].x, pt[0].y, pt[1].x, pt[1].y); #endif /* draw shadow on right */ @@ -100,7 +100,7 @@ rxvt_term::Draw_button (int x, int y, int state, int dirn) /* pt[2].x = x + sz2; */ pt[1].y = y + (dirn == UP ? sz - 1 : 0); pt[2].y = y + (dirn == UP ? 0 : sz - 1); - XDrawLine(display->display, scrollBar.win, bot, + XDrawLine (display->display, scrollBar.win, bot, pt[2].x, pt[2].y, pt[1].x, pt[1].y); #if (SHADOW > 1) /* doubled */ @@ -115,13 +115,13 @@ rxvt_term::Draw_button (int x, int y, int state, int dirn) pt[2].y--; pt[1].y++; } - XDrawLine(display->display, scrollBar.win, bot, + XDrawLine (display->display, scrollBar.win, bot, pt[2].x, pt[2].y, pt[1].x, pt[1].y); #endif } int -rxvt_term::scrollbar_show_rxvt (int update __attribute__((unused)), int last_top, int last_bot, int scrollbar_len) +rxvt_term::scrollbar_show_rxvt (int update __attribute__ ((unused)), int last_top, int last_bot, int scrollbar_len) { int sbshadow = sb_shadow; int sbwidth = (int)scrollBar.width; @@ -134,22 +134,22 @@ rxvt_term::scrollbar_show_rxvt (int update __attribute__((unused)), int last_top gcvalue.foreground = PixColors[Color_trough]; if (sbshadow) { - XSetWindowBackground(display->display, scrollBar.win, + XSetWindowBackground (display->display, scrollBar.win, gcvalue.foreground); - XClearWindow(display->display, scrollBar.win); + XClearWindow (display->display, scrollBar.win); } } else { /* instead of XClearWindow (display->display, scrollBar.win); */ if (last_top < scrollBar.top) - XClearArea(display->display, scrollBar.win, + XClearArea (display->display, scrollBar.win, sbshadow, last_top, sbwidth, (scrollBar.top - last_top), False); if (scrollBar.bot < last_bot) - XClearArea(display->display, scrollBar.win, + XClearArea (display->display, scrollBar.win, sbshadow, scrollBar.bot, sbwidth, (last_bot - scrollBar.bot), False); @@ -165,23 +165,23 @@ rxvt_term::scrollbar_show_rxvt (int update __attribute__((unused)), int last_top else xofs = sbshadow ? sbwidth : sbwidth - 1; - XDrawLine(display->display, scrollBar.win, botShadowGC, + XDrawLine (display->display, scrollBar.win, botShadowGC, xofs, 0, xofs, scrollBar.end + sbwidth); } #endif - XFillRectangle(display->display, scrollBar.win, scrollbarGC, + XFillRectangle (display->display, scrollBar.win, scrollbarGC, sbshadow, scrollBar.top, sbwidth, scrollbar_len); if (sbshadow) /* trough shadow */ - rxvt_Draw_Shadow(display->display, scrollBar.win, + rxvt_Draw_Shadow (display->display, scrollBar.win, botShadowGC, topShadowGC, 0, 0, - sbwidth + 2 * sbshadow, /* scrollbar_TotalWidth() */ + sbwidth + 2 * sbshadow, /* scrollbar_TotalWidth () */ scrollBar.end + (sbwidth + 1) + sbshadow); /* shadow for scrollbar slider */ - rxvt_Draw_Shadow(display->display, scrollBar.win, + rxvt_Draw_Shadow (display->display, scrollBar.win, topShadowGC, botShadowGC, sbshadow, scrollBar.top, sbwidth, scrollbar_len); @@ -190,9 +190,9 @@ rxvt_term::scrollbar_show_rxvt (int update __attribute__((unused)), int last_top * Redraw scrollbar arrows */ Draw_button (sbshadow, sbshadow, - (scrollbar_isUp() ? -1 : +1), UP); + (scrollbar_isUp () ? -1 : +1), UP); Draw_button (sbshadow, (scrollBar.end + 1), - (scrollbar_isDn() ? -1 : +1), DN); + (scrollbar_isDn () ? -1 : +1), DN); return 1; } #endif /* RXVT_SCROLLBAR */ diff --git a/src/scrollbar-xterm.C b/src/scrollbar-xterm.C index c48ec2fb..9c490ce9 100644 --- a/src/scrollbar-xterm.C +++ b/src/scrollbar-xterm.C @@ -32,7 +32,7 @@ const unsigned char x_stp_bits[] = { 0xaa, 0x55 }; int -rxvt_term::scrollbar_show_xterm (int update __attribute__((unused)), int last_top, int last_bot, int scrollbar_len) +rxvt_term::scrollbar_show_xterm (int update __attribute__ ((unused)), int last_top, int last_bot, int scrollbar_len) { int xsb = 0; int sbwidth = scrollBar.width - 1; @@ -42,41 +42,41 @@ rxvt_term::scrollbar_show_xterm (int update __attribute__((unused)), int last_to XGCValues gcvalue; scrollBar.init |= R_SB_XTERM; - gcvalue.stipple = XCreateBitmapFromData(display->display, scrollBar.win, + gcvalue.stipple = XCreateBitmapFromData (display->display, scrollBar.win, (char *)x_stp_bits, x_stp_width, x_stp_height); if (!gcvalue.stipple) { - rxvt_print_error("can't create bitmap"); - exit(EXIT_FAILURE); + rxvt_print_error ("can't create bitmap"); + exit (EXIT_FAILURE); } gcvalue.fill_style = FillOpaqueStippled; gcvalue.foreground = PixColors[Color_fg]; gcvalue.background = PixColors[Color_bg]; - xscrollbarGC = XCreateGC(display->display, scrollBar.win, + xscrollbarGC = XCreateGC (display->display, scrollBar.win, GCForeground | GCBackground | GCFillStyle | GCStipple, &gcvalue); gcvalue.foreground = PixColors[Color_border]; - ShadowGC = XCreateGC(display->display, scrollBar.win, GCForeground, &gcvalue); + ShadowGC = XCreateGC (display->display, scrollBar.win, GCForeground, &gcvalue); } /* instead of XClearWindow (display->display, scrollBar.win); */ xsb = (Options & Opt_scrollBar_right) ? 1 : 0; if (last_top < scrollBar.top) - XClearArea(display->display, scrollBar.win, + XClearArea (display->display, scrollBar.win, sb_shadow + xsb, last_top, sbwidth, (scrollBar.top - last_top), False); if (scrollBar.bot < last_bot) - XClearArea(display->display, scrollBar.win, + XClearArea (display->display, scrollBar.win, sb_shadow + xsb, scrollBar.bot, sbwidth, (last_bot - scrollBar.bot), False); /* scrollbar slider */ - XFillRectangle(display->display, scrollBar.win, xscrollbarGC, + XFillRectangle (display->display, scrollBar.win, xscrollbarGC, xsb + 1, scrollBar.top, sbwidth - 2, scrollbar_len); - XDrawLine(display->display, scrollBar.win, ShadowGC, + XDrawLine (display->display, scrollBar.win, ShadowGC, xsb ? 0 : sbwidth, scrollBar.beg, xsb ? 0 : sbwidth, scrollBar.end); return 1; diff --git a/src/scrollbar.C b/src/scrollbar.C index 641da58d..8b5757e2 100644 --- a/src/scrollbar.C +++ b/src/scrollbar.C @@ -37,21 +37,21 @@ rxvt_term::scrollbar_mapping (int map) int change = 0; #ifdef HAVE_SCROLLBARS - if (map && !scrollbar_visible()) + if (map && !scrollbar_visible ()) { scrollBar.setIdle (); if (!scrollBar.win) resize_scrollbar (); if (scrollBar.win) { - XMapWindow(display->display, scrollBar.win); + XMapWindow (display->display, scrollBar.win); change = 1; } } - else if (!map && scrollbar_visible()) + else if (!map && scrollbar_visible ()) { scrollBar.state = 0; - XUnmapWindow(display->display, scrollBar.win); + XUnmapWindow (display->display, scrollBar.win); change = 1; } #endif @@ -109,20 +109,20 @@ rxvt_term::resize_scrollbar () if (!scrollBar.win) { /* create the scrollbar window */ - scrollBar.win = XCreateSimpleWindow(display->display, + scrollBar.win = XCreateSimpleWindow (display->display, TermWin.parent[0], window_sb_x, 0, - scrollbar_TotalWidth(), + scrollbar_TotalWidth (), szHint.height, 0, PixColors[Color_fg], PixColors[Color_bg]); #ifdef DEBUG_X - XStoreName(display->display, scrollBar.win, "scrollbar"); + XStoreName (display->display, scrollBar.win, "scrollbar"); #endif - XDefineCursor(display->display, scrollBar.win, leftptr_cursor); + XDefineCursor (display->display, scrollBar.win, leftptr_cursor); - XSelectInput(display->display, scrollBar.win, + XSelectInput (display->display, scrollBar.win, ExposureMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask | Button2MotionMask | Button3MotionMask); @@ -148,24 +148,24 @@ rxvt_term::scrollbar_show (int update) #ifdef HAVE_SCROLLBARS int top, bot, len, adj; - if (!scrollbar_visible()) + if (!scrollbar_visible ()) return 0; if (update) { top = (TermWin.nscrolled - TermWin.view_start); bot = top + (TermWin.nrow - 1); - len = max((TermWin.nscrolled + (TermWin.nrow - 1)), 1); - adj = (((bot - top) * scrollbar_size()) % len) > 0 ? 1 : 0; + len = max ((TermWin.nscrolled + (TermWin.nrow - 1)), 1); + adj = (((bot - top) * scrollbar_size ()) % len) > 0 ? 1 : 0; - scrollBar.top = (scrollBar.beg + (top * scrollbar_size()) / len); - scrollbar_len = ((bot - top) * scrollbar_size()) / len + - scrollbar_minheight() + adj; + scrollBar.top = (scrollBar.beg + (top * scrollbar_size ()) / len); + scrollbar_len = ((bot - top) * scrollbar_size ()) / len + + scrollbar_minheight () + adj; scrollBar.bot = (scrollBar.top + scrollbar_len); /* no change */ if (scrollBar.top == last_top && scrollBar.bot == last_bot - && (scrollBar.state == last_state || !scrollbar_isUpDn())) + && (scrollBar.state == last_state || !scrollbar_isUpDn ())) return 0; } @@ -202,15 +202,15 @@ rxvt_term::setup_scrollbar (const char *scrollalign, const char *scrollstyle, co if (scrollstyle) { # ifdef NEXT_SCROLLBAR - if (STRNCASECMP(scrollstyle, "next", 4) == 0) + if (STRNCASECMP (scrollstyle, "next", 4) == 0) style = R_SB_NEXT; # endif # ifdef XTERM_SCROLLBAR - if (STRNCASECMP(scrollstyle, "xterm", 5) == 0) + if (STRNCASECMP (scrollstyle, "xterm", 5) == 0) style = R_SB_XTERM; # endif # ifdef PLAIN_SCROLLBAR - if (STRNCASECMP(scrollstyle, "plain", 5) == 0) + if (STRNCASECMP (scrollstyle, "plain", 5) == 0) style = R_SB_PLAIN; # endif @@ -226,11 +226,11 @@ rxvt_term::setup_scrollbar (const char *scrollalign, const char *scrollstyle, co width = SB_WIDTH_RXVT; if (style != R_SB_NEXT) /* dishonour request - for now */ - if (thickness && (i = atoi(thickness)) >= SB_WIDTH_MINIMUM) - width = min(i, SB_WIDTH_MAXIMUM); + if (thickness && (i = atoi (thickness)) >= SB_WIDTH_MINIMUM) + width = min (i, SB_WIDTH_MAXIMUM); # if defined(RXVT_SCROLLBAR) - if (!(Options & Opt_scrollBar_floating) && style == R_SB_RXVT) + if (! (Options & Opt_scrollBar_floating) && style == R_SB_RXVT) sb_shadow = SHADOW; # endif @@ -240,9 +240,9 @@ rxvt_term::setup_scrollbar (const char *scrollalign, const char *scrollstyle, co /* scrollbar_align = R_SB_ALIGN_CENTRE; */ if (scrollalign) { - if (STRNCASECMP(scrollalign, "top", 3) == 0) + if (STRNCASECMP (scrollalign, "top", 3) == 0) scrollbar_align = R_SB_ALIGN_TOP; - else if (STRNCASECMP(scrollalign, "bottom", 6) == 0) + else if (STRNCASECMP (scrollalign, "bottom", 6) == 0) scrollbar_align = R_SB_ALIGN_BOTTOM; } #endif diff --git a/src/simplevec.h b/src/simplevec.h index edf5b833..4230b237 100644 --- a/src/simplevec.h +++ b/src/simplevec.h @@ -65,7 +65,7 @@ public: private: static T *alloc (size_type n) { - return (T *)::operator new ((size_t)(n * sizeof (T))); + return (T *)::operator new ((size_t) (n * sizeof (T))); } static void dealloc (T *buf) { @@ -76,15 +76,15 @@ private: void reserve (iterator where, size_type n) { if (_last + n <= _size) { - memmove (where+n, where, (end()-where)*sizeof(T)); + memmove (where+n, where, (end ()-where)*sizeof (T)); } else { size_type sz = _last+n; - sz = (_size == 0) ? max(sz, 5) : max(sz, 2*_size); + sz = (_size == 0) ? max (sz, 5) : max (sz, 2*_size); T *nbuf = alloc (sz); if (_buf) { - memcpy (nbuf, begin(), (where-begin())*sizeof(T)); - memcpy (nbuf + (where-begin()) + n, where, - (end()-where)*sizeof(T)); + memcpy (nbuf, begin (), (where-begin ())*sizeof (T)); + memcpy (nbuf + (where-begin ()) + n, where, + (end ()-where)*sizeof (T)); dealloc (_buf); } _buf = nbuf; @@ -95,10 +95,10 @@ public: void reserve (size_type sz) { if (_size < sz) { - sz = (_size == 0) ? max(sz, 5) : max(sz, 2*_size); + sz = (_size == 0) ? max (sz, 5) : max (sz, 2*_size); T *nbuf = alloc (sz); if (_buf) { - memcpy (nbuf, begin(), size()*sizeof(T)); + memcpy (nbuf, begin (), size ()*sizeof (T)); dealloc (_buf); } _buf = nbuf; @@ -109,21 +109,21 @@ public: : _last (0), _size (0), _buf (0) { } - simplevec (size_type n, const T& t = T()) + simplevec (size_type n, const T& t = T ()) : _last (0), _size (0), _buf (0) { - insert (begin(), n, t); + insert (begin (), n, t); } simplevec (const_iterator first, const_iterator last) : _last (0), _size (0), _buf (0) { - insert (begin(), first, last); + insert (begin (), first, last); } simplevec (const simplevec &v) : _last (0), _size (0), _buf (0) { reserve (v._last); - memcpy (_buf, v.begin(), v.size()*sizeof(T)); + memcpy (_buf, v.begin (), v.size ()*sizeof (T)); _last = v._last; } simplevec &operator= (const simplevec &v) @@ -131,7 +131,7 @@ public: if (this != &v) { _last = 0; reserve (v._last); - memcpy (_buf, v.begin(), v.size()*sizeof(T)); + memcpy (_buf, v.begin (), v.size ()*sizeof (T)); _last = v._last; } return *this; @@ -142,22 +142,22 @@ public: } const T &front () const { - //ministl_assert (size() > 0); + //ministl_assert (size () > 0); return _buf[0]; } T &front () { - //ministl_assert (size() > 0); + //ministl_assert (size () > 0); return _buf[0]; } const T &back () const { - //ministl_assert (size() > 0); + //ministl_assert (size () > 0); return _buf[_last-1]; } T &back () { - //ministl_assert (size() > 0); + //ministl_assert (size () > 0); return _buf[_last-1]; } bool empty () const @@ -171,60 +171,60 @@ public: void push_back (const T &t) { reserve (_last+1); - *end() = t; + *end () = t; ++_last; } void push_back (T &t) { reserve (_last+1); - *end() = t; + *end () = t; ++_last; } void pop_back () { - //ministl_assert (size() > 0); + //ministl_assert (size () > 0); --_last; } const T &operator[] (size_type idx) const { - //ministl_assert (idx < size()); + //ministl_assert (idx < size ()); return _buf[idx]; } T &operator[] (size_type idx) { - //ministl_assert (idx < size()); + //ministl_assert (idx < size ()); return _buf[idx]; } iterator insert (iterator pos, const T &t) { - //ministl_assert (pos <= end()); - long at = pos - begin(); + //ministl_assert (pos <= end ()); + long at = pos - begin (); reserve (pos, 1); - pos = begin()+at; + pos = begin ()+at; *pos = t; ++_last; return pos; } iterator insert (iterator pos, const_iterator first, const_iterator last) { - //ministl_assert (pos <= end()); + //ministl_assert (pos <= end ()); long n = last - first; - long at = pos - begin(); + long at = pos - begin (); if (n > 0) { reserve (pos, n); - pos = begin()+at; - memcpy (pos, first, (last-first)*sizeof(T)); + pos = begin ()+at; + memcpy (pos, first, (last-first)*sizeof (T)); _last += n; } return pos; } iterator insert (iterator pos, size_type n, const T &t) { - //ministl_assert (pos <= end()); - long at = pos - begin(); + //ministl_assert (pos <= end ()); + long at = pos - begin (); if (n > 0) { reserve (pos, n); - pos = begin()+at; + pos = begin ()+at; for (int i = 0; i < n; ++i) pos[i] = t; _last += n; @@ -234,14 +234,14 @@ public: void erase (iterator first, iterator last) { if (last != first) { - memmove (first, last, (end()-last)*sizeof(T)); + memmove (first, last, (end ()-last)*sizeof (T)); _last -= last - first; } } void erase (iterator pos) { - if (pos != end()) { - memmove (pos, pos+1, (end()-(pos+1))*sizeof(T)); + if (pos != end ()) { + memmove (pos, pos+1, (end ()- (pos+1))*sizeof (T)); --_last; } } @@ -250,22 +250,22 @@ public: template bool operator== (const simplevec &v1, const simplevec &v2) { - if (v1.size() != v2.size()) + if (v1.size () != v2.size ()) return false; - return !v1.size() || !memcmp (&v1[0], &v2[0], v1.size()*sizeof(T)); + return !v1.size () || !memcmp (&v1[0], &v2[0], v1.size ()*sizeof (T)); } template bool operator< (const simplevec &v1, const simplevec &v2) { - unsigned long minlast = min (v1.size(), v2.size()); + unsigned long minlast = min (v1.size (), v2.size ()); for (unsigned long i = 0; i < minlast; ++i) { if (v1[i] < v2[i]) return true; if (v2[i] < v1[i]) return false; } - return v1.size() < v2.size(); + return v1.size () < v2.size (); } #endif diff --git a/src/strings.C b/src/strings.C index 400fd3ac..a1442446 100644 --- a/src/strings.C +++ b/src/strings.C @@ -1,7 +1,7 @@ /*--------------------------------*-C-*---------------------------------* * File: strings.c *----------------------------------------------------------------------* - * $Id: strings.C,v 1.4 2004-02-01 01:34:41 pcg Exp $ + * $Id: strings.C,v 1.5 2004-02-13 12:16:21 pcg Exp $ * * All portions of code are copyright by their respective author/s. * Copyright (c) 1997-2001 Geoff Wing @@ -28,31 +28,31 @@ #ifndef NO_STRINGS /*----------------------------------------------------------------------*/ /* - * a replacement for strcasecmp() to avoid linking an entire library. + * a replacement for strcasecmp () to avoid linking an entire library. * Mark Olesen added this in 2.15 but for which OS & library? - Geoff Wing */ int -strcasecmp(const char *s1, const char *s2) +strcasecmp (const char *s1, const char *s2) { - for ( ; tolower(*s1) == tolower(*s2); s1++, s2++) + for ( ; tolower (*s1) == tolower (*s2); s1++, s2++) if (!*s1) return 0; - return (int)(tolower(*s1) - tolower(*s2)); + return (int) (tolower (*s1) - tolower (*s2)); } int -strncasecmp(const char *s1, const char *s2, size_t n) +strncasecmp (const char *s1, const char *s2, size_t n) { - for ( ; n-- && (tolower(*s1) == tolower(*s2)); s1++, s2++) + for ( ; n-- && (tolower (*s1) == tolower (*s2)); s1++, s2++) if (!*s1) return 0; if (n == 0) return 0; - return (int)(tolower(*s1) - tolower(*s2)); + return (int) (tolower (*s1) - tolower (*s2)); } char * -strcpy(char *d, const char *s) +strcpy (char *d, const char *s) { char *r = d; @@ -61,7 +61,7 @@ strcpy(char *d, const char *s) } char * -strncpy(char *d, const char *s, size_t len) +strncpy (char *d, const char *s, size_t len) { char *r = d; @@ -77,7 +77,7 @@ strncpy(char *d, const char *s, size_t len) } int -strcmp(const char *s1, const char *s2) +strcmp (const char *s1, const char *s2) { for ( ; (*s1 == *s2++); ) if (*s1++ == '\0') @@ -86,7 +86,7 @@ strcmp(const char *s1, const char *s2) } int -strncmp(const char *s1, const char *s2, size_t len) +strncmp (const char *s1, const char *s2, size_t len) { if (len) { @@ -98,7 +98,7 @@ strncmp(const char *s1, const char *s2, size_t len) } char * -strcat(char *s1, const char *s2) +strcat (char *s1, const char *s2) { char *r = s1; @@ -110,7 +110,7 @@ strcat(char *s1, const char *s2) } char * -strncat(char *s1, const char *s2, size_t len) +strncat (char *s1, const char *s2, size_t len) { char *r = s1; @@ -123,7 +123,7 @@ strncat(char *s1, const char *s2, size_t len) } size_t -strlen(const char *s) +strlen (const char *s) { size_t len = 0; @@ -132,24 +132,24 @@ strlen(const char *s) } char * -strdup(const char *s) +strdup (const char *s) { - size_t len = STRLEN(s) + 1; + size_t len = STRLEN (s) + 1; char *c; - if ((c = malloc(len)) != NULL) - MEMCPY(c, s, len); + if ((c = malloc (len)) != NULL) + MEMCPY (c, s, len); return c; } char * -index(const char *s, int c) +index (const char *s, int c) { - return STRCHR(s, c); + return STRCHR (s, c); } char * -strchr(const char *s, int c) +strchr (const char *s, int c) { char *p = NULL; @@ -168,13 +168,13 @@ strchr(const char *s, int c) } char * -rindex(const char *s, int c) +rindex (const char *s, int c) { - return STRRCHR(s, c); + return STRRCHR (s, c); } char * -strrchr(const char *s, int c) +strrchr (const char *s, int c) { char *p = NULL; @@ -189,17 +189,17 @@ strrchr(const char *s, int c) } void * -memcpy(void *s1, const void *s2, size_t len) +memcpy (void *s1, const void *s2, size_t len) { /* has extra stack and time but less code space */ - return MEMMOVE(s1, s2, len); + return MEMMOVE (s1, s2, len); } /*--------------------------------------------------------------------------* - * Possibly faster memmove() by Geoff Wing + * Possibly faster memmove () by Geoff Wing *--------------------------------------------------------------------------*/ void * -memmove(void *d, const void *s, size_t len) +memmove (void *d, const void *s, size_t len) { u_intp_t i; unsigned char *dst = (unsigned char *)d; @@ -210,15 +210,15 @@ memmove(void *d, const void *s, size_t len) if ((u_intp_t)d < (u_intp_t)s) { /* forwards */ - i = (-(u_intp_t)dst) & (SIZEOF_INT_P - 1); - if (len >= 16 && i == ((-(u_intp_t)src) & (SIZEOF_INT_P - 1))) + i = (- (u_intp_t)dst) & (SIZEOF_INT_P - 1); + if (len >= 16 && i == ((- (u_intp_t)src) & (SIZEOF_INT_P - 1))) { /* speed up since src & dst are offset correctly */ len -= (size_t)i; for ( ; i--; ) *dst++ = *src++; - for (i = (u_intp_t)(len / SIZEOF_INT_P); i--; ) - *((u_intp_t *)dst)++ = *((const u_intp_t *)src)++; + for (i = (u_intp_t) (len / SIZEOF_INT_P); i--; ) + * ((u_intp_t *)dst)++ = * ((const u_intp_t *)src)++; len &= (SIZEOF_INT_P - 1); } for ( ; len--; ) @@ -236,8 +236,8 @@ memmove(void *d, const void *s, size_t len) len -= (size_t)i; for ( ; i--; ) *--dst = *--src; - for (i = (u_intp_t)(len / SIZEOF_INT_P); i--; ) - *--((u_intp_t *)dst) = *--((const u_intp_t *)src); + for (i = (u_intp_t) (len / SIZEOF_INT_P); i--; ) + *-- ((u_intp_t *)dst) = *-- ((const u_intp_t *)src); len &= (SIZEOF_INT_P - 1); } for ( ; len--; ) @@ -248,20 +248,20 @@ memmove(void *d, const void *s, size_t len) } /*--------------------------------------------------------------------------* - * Possibly faster memset() by Geoff Wing + * Possibly faster memset () by Geoff Wing * presumptions: * 1) intp_t write the best * 2) SIZEOF_INT_P == power of 2 *--------------------------------------------------------------------------*/ void -bzero(void *b, size_t len) +bzero (void *b, size_t len) { - MEMSET(b, 0, len); + MEMSET (b, 0, len); } void * -memset(void *p, int c1, size_t len) +memset (void *p, int c1, size_t len) { u_intp_t i, val; unsigned char c = (unsigned char) c1; @@ -272,7 +272,7 @@ memset(void *p, int c1, size_t len) if (len >= 16) { /* < 16 probably not worth all the calculations */ /* write out preceding characters so we align on an integer boundary */ - if ((i = ((-(u_intp_t)p) & (SIZEOF_INT_P - 1)))) + if ((i = ((- (u_intp_t)p) & (SIZEOF_INT_P - 1)))) { len -= (size_t)i; for (; i--;) @@ -290,8 +290,8 @@ memset(void *p, int c1, size_t len) #if SIZEOF_INT_P == 16 val |= (val << 64); #endif - for (i = (u_intp_t)(len / SIZEOF_INT_P); i--;) - *((u_intp_t *)lp)++ = val; + for (i = (u_intp_t) (len / SIZEOF_INT_P); i--;) + * ((u_intp_t *)lp)++ = val; len &= (SIZEOF_INT_P - 1); } /* write trailing characters */ diff --git a/src/xdefaults.C b/src/xdefaults.C index 30fb883a..aa5746b4 100644 --- a/src/xdefaults.C +++ b/src/xdefaults.C @@ -1,7 +1,7 @@ /*--------------------------------*-C-*---------------------------------* * File: xdefaults.c *----------------------------------------------------------------------* - * $Id: xdefaults.C,v 1.10 2004-02-13 12:11:05 pcg Exp $ + * $Id: xdefaults.C,v 1.11 2004-02-13 12:16:21 pcg Exp $ * * All portions of code are copyright by their respective author/s. * Copyright (c) 1994 Robert Nation @@ -40,38 +40,38 @@ static const char *const xnames[2] = { ".Xdefaults", ".Xresources" }; /* * `string' options MUST have a usage argument * `switch' and `boolean' options have no argument - * if there's no desc(ription), it won't appear in rxvt_usage() + * if there's no desc (ription), it won't appear in rxvt_usage () */ -/* INFO() - descriptive information only */ +/* INFO () - descriptive information only */ #define INFO(opt, arg, desc) \ {0, -1, NULL, (opt), (arg), (desc)} -/* STRG() - command-line option, with/without resource */ +/* STRG () - command-line option, with/without resource */ #define STRG(rsp, kw, opt, arg, desc) \ {0, (rsp), (kw), (opt), (arg), (desc)} -/* RSTRG() - resource/long-option */ +/* RSTRG () - resource/long-option */ #define RSTRG(rsp, kw, arg) \ {0, (rsp), (kw), NULL, (arg), NULL} -/* BOOL() - regular boolean `-/+' flag */ +/* BOOL () - regular boolean `-/+' flag */ #define BOOL(rsp, kw, opt, flag, desc) \ - {(Opt_Boolean|(flag)), (rsp), (kw), (opt), NULL, (desc)} + { (Opt_Boolean| (flag)), (rsp), (kw), (opt), NULL, (desc)} -/* SWCH() - `-' flag */ +/* SWCH () - `-' flag */ #define SWCH(opt, flag, desc) \ - {(flag), -1, NULL, (opt), NULL, (desc)} + { (flag), -1, NULL, (opt), NULL, (desc)} /* convenient macros */ #define optList_strlen(i) \ - (optList[i].flag ? 0 : (optList[i].arg ? STRLEN(optList[i].arg) : 1)) + (optList[i].flag ? 0 : (optList[i].arg ? STRLEN (optList[i].arg) : 1)) #define optList_isBool(i) \ (optList[i].flag & Opt_Boolean) #define optList_isReverse(i) \ (optList[i].flag & Opt_Reverse) #define optList_size() \ - (sizeof(optList) / sizeof(optList[0])) + (sizeof (optList) / sizeof (optList[0])) static const struct { @@ -83,189 +83,189 @@ static const struct const char *desc; /* description */ } optList[] = { - STRG(Rs_display_name, NULL, "d", NULL, NULL), /* short form */ - STRG(Rs_display_name, NULL, "display", "string", "X server to contact"), - STRG(Rs_term_name, "termName", "tn", "string", + STRG (Rs_display_name, NULL, "d", NULL, NULL), /* short form */ + STRG (Rs_display_name, NULL, "display", "string", "X server to contact"), + STRG (Rs_term_name, "termName", "tn", "string", "value of the TERM environment variable"), - STRG(Rs_geometry, NULL, "g", NULL, NULL), /* short form */ - STRG(Rs_geometry, "geometry", "geometry", "geometry", + STRG (Rs_geometry, NULL, "g", NULL, NULL), /* short form */ + STRG (Rs_geometry, "geometry", "geometry", "geometry", "size (in characters) and position"), - SWCH("C", Opt_console, "intercept console messages"), - SWCH("iconic", Opt_iconic, "start iconic"), - SWCH("ic", Opt_iconic, NULL), /* short form */ - BOOL(Rs_reverseVideo, "reverseVideo", "rv", Opt_reverseVideo, + SWCH ("C", Opt_console, "intercept console messages"), + SWCH ("iconic", Opt_iconic, "start iconic"), + SWCH ("ic", Opt_iconic, NULL), /* short form */ + BOOL (Rs_reverseVideo, "reverseVideo", "rv", Opt_reverseVideo, "reverse video"), - BOOL(Rs_loginShell, "loginShell", "ls", Opt_loginShell, "login shell"), - BOOL(Rs_jumpScroll, "jumpScroll", "j", Opt_jumpScroll, "jump scrolling"), + BOOL (Rs_loginShell, "loginShell", "ls", Opt_loginShell, "login shell"), + BOOL (Rs_jumpScroll, "jumpScroll", "j", Opt_jumpScroll, "jump scrolling"), #ifdef HAVE_SCROLLBARS - BOOL(Rs_scrollBar, "scrollBar", "sb", Opt_scrollBar, "scrollbar"), - BOOL(Rs_scrollBar_right, "scrollBar_right", "sr", Opt_scrollBar_right, + BOOL (Rs_scrollBar, "scrollBar", "sb", Opt_scrollBar, "scrollbar"), + BOOL (Rs_scrollBar_right, "scrollBar_right", "sr", Opt_scrollBar_right, "scrollbar right"), - BOOL(Rs_scrollBar_floating, "scrollBar_floating", "st", + BOOL (Rs_scrollBar_floating, "scrollBar_floating", "st", Opt_scrollBar_floating, "scrollbar without a trough"), #endif - BOOL(Rs_scrollTtyOutput, "scrollTtyOutput", NULL, Opt_scrollTtyOutput, + BOOL (Rs_scrollTtyOutput, "scrollTtyOutput", NULL, Opt_scrollTtyOutput, NULL), - BOOL(Rs_scrollTtyOutput, NULL, "si", Opt_Reverse | Opt_scrollTtyOutput, + BOOL (Rs_scrollTtyOutput, NULL, "si", Opt_Reverse | Opt_scrollTtyOutput, "scroll-on-tty-output inhibit"), - BOOL(Rs_scrollTtyKeypress, "scrollTtyKeypress", "sk", Opt_scrollTtyKeypress, + BOOL (Rs_scrollTtyKeypress, "scrollTtyKeypress", "sk", Opt_scrollTtyKeypress, "scroll-on-keypress"), - BOOL(Rs_scrollWithBuffer, "scrollWithBuffer", "sw", Opt_scrollWithBuffer, + BOOL (Rs_scrollWithBuffer, "scrollWithBuffer", "sw", Opt_scrollWithBuffer, "scroll-with-buffer"), #ifdef TRANSPARENT - BOOL(Rs_transparent, "inheritPixmap", "ip", Opt_transparent, + BOOL (Rs_transparent, "inheritPixmap", "ip", Opt_transparent, "inherit parent pixmap"), - BOOL(Rs_transparent_all, "inheritPixmapforce", "ipf", Opt_transparent_all, + BOOL (Rs_transparent_all, "inheritPixmapforce", "ipf", Opt_transparent_all, "forcefully inherit root pixmap"), - SWCH("tr", Opt_transparent, NULL), + SWCH ("tr", Opt_transparent, NULL), #endif - BOOL(Rs_utmpInhibit, "utmpInhibit", "ut", Opt_utmpInhibit, "utmp inhibit"), + BOOL (Rs_utmpInhibit, "utmpInhibit", "ut", Opt_utmpInhibit, "utmp inhibit"), #ifndef NO_BELL - BOOL(Rs_visualBell, "visualBell", "vb", Opt_visualBell, "visual bell"), + BOOL (Rs_visualBell, "visualBell", "vb", Opt_visualBell, "visual bell"), # if ! defined(NO_MAPALERT) && defined(MAPALERT_OPTION) - BOOL(Rs_mapAlert, "mapAlert", NULL, Opt_mapAlert, NULL), + BOOL (Rs_mapAlert, "mapAlert", NULL, Opt_mapAlert, NULL), # endif #endif #ifdef META8_OPTION - BOOL(Rs_meta8, "meta8", NULL, Opt_meta8, NULL), + BOOL (Rs_meta8, "meta8", NULL, Opt_meta8, NULL), #endif #ifdef MOUSE_WHEEL - BOOL(Rs_mouseWheelScrollPage, "mouseWheelScrollPage", NULL, Opt_mouseWheelScrollPage, + BOOL (Rs_mouseWheelScrollPage, "mouseWheelScrollPage", NULL, Opt_mouseWheelScrollPage, NULL), #endif #ifdef MULTICHAR_SET - BOOL(Rs_mc_hack, "multibyte_cursor", "mcc", Opt_mc_hack, + BOOL (Rs_mc_hack, "multibyte_cursor", "mcc", Opt_mc_hack, "Multibyte character cursor movement"), #endif #ifndef NO_FRILLS - BOOL(Rs_tripleclickwords, "tripleclickwords", "tcw", Opt_tripleclickwords, + BOOL (Rs_tripleclickwords, "tripleclickwords", "tcw", Opt_tripleclickwords, "triple click word selection"), #endif #ifdef CURSOR_BLINK - BOOL(Rs_cursorBlink, "cursorBlink", "bc", Opt_cursorBlink, "blinking cursor"), + BOOL (Rs_cursorBlink, "cursorBlink", "bc", Opt_cursorBlink, "blinking cursor"), #endif #ifdef POINTER_BLANK - BOOL(Rs_pointerBlank, "pointerBlank", "pb", Opt_pointerBlank, "switch off pointer after delay"), + BOOL (Rs_pointerBlank, "pointerBlank", "pb", Opt_pointerBlank, "switch off pointer after delay"), #endif - STRG(Rs_color + Color_bg, "background", "bg", "color", "background color"), - STRG(Rs_color + Color_fg, "foreground", "fg", "color", "foreground color"), - RSTRG(Rs_color + minCOLOR + 0, "color0", "color"), - RSTRG(Rs_color + minCOLOR + 1, "color1", "color"), - RSTRG(Rs_color + minCOLOR + 2, "color2", "color"), - RSTRG(Rs_color + minCOLOR + 3, "color3", "color"), - RSTRG(Rs_color + minCOLOR + 4, "color4", "color"), - RSTRG(Rs_color + minCOLOR + 5, "color5", "color"), - RSTRG(Rs_color + minCOLOR + 6, "color6", "color"), - RSTRG(Rs_color + minCOLOR + 7, "color7", "color"), + STRG (Rs_color + Color_bg, "background", "bg", "color", "background color"), + STRG (Rs_color + Color_fg, "foreground", "fg", "color", "foreground color"), + RSTRG (Rs_color + minCOLOR + 0, "color0", "color"), + RSTRG (Rs_color + minCOLOR + 1, "color1", "color"), + RSTRG (Rs_color + minCOLOR + 2, "color2", "color"), + RSTRG (Rs_color + minCOLOR + 3, "color3", "color"), + RSTRG (Rs_color + minCOLOR + 4, "color4", "color"), + RSTRG (Rs_color + minCOLOR + 5, "color5", "color"), + RSTRG (Rs_color + minCOLOR + 6, "color6", "color"), + RSTRG (Rs_color + minCOLOR + 7, "color7", "color"), #ifndef NO_BRIGHTCOLOR - RSTRG(Rs_color + minBrightCOLOR + 0, "color8", "color"), - RSTRG(Rs_color + minBrightCOLOR + 1, "color9", "color"), - RSTRG(Rs_color + minBrightCOLOR + 2, "color10", "color"), - RSTRG(Rs_color + minBrightCOLOR + 3, "color11", "color"), - RSTRG(Rs_color + minBrightCOLOR + 4, "color12", "color"), - RSTRG(Rs_color + minBrightCOLOR + 5, "color13", "color"), - RSTRG(Rs_color + minBrightCOLOR + 6, "color14", "color"), - RSTRG(Rs_color + minBrightCOLOR + 7, "color15", "color"), + RSTRG (Rs_color + minBrightCOLOR + 0, "color8", "color"), + RSTRG (Rs_color + minBrightCOLOR + 1, "color9", "color"), + RSTRG (Rs_color + minBrightCOLOR + 2, "color10", "color"), + RSTRG (Rs_color + minBrightCOLOR + 3, "color11", "color"), + RSTRG (Rs_color + minBrightCOLOR + 4, "color12", "color"), + RSTRG (Rs_color + minBrightCOLOR + 5, "color13", "color"), + RSTRG (Rs_color + minBrightCOLOR + 6, "color14", "color"), + RSTRG (Rs_color + minBrightCOLOR + 7, "color15", "color"), #endif /* NO_BRIGHTCOLOR */ #ifndef NO_BOLD_UNDERLINE_REVERSE - RSTRG(Rs_color + Color_BD, "colorBD", "color"), - RSTRG(Rs_color + Color_UL, "colorUL", "color"), - RSTRG(Rs_color + Color_RV, "colorRV", "color"), + RSTRG (Rs_color + Color_BD, "colorBD", "color"), + RSTRG (Rs_color + Color_UL, "colorUL", "color"), + RSTRG (Rs_color + Color_RV, "colorRV", "color"), #endif /* ! NO_BOLD_UNDERLINE_REVERSE */ #ifdef KEEP_SCROLLCOLOR - RSTRG(Rs_color + Color_scroll, "scrollColor", "color"), - RSTRG(Rs_color + Color_trough, "troughColor", "color"), + RSTRG (Rs_color + Color_scroll, "scrollColor", "color"), + RSTRG (Rs_color + Color_trough, "troughColor", "color"), #endif /* KEEP_SCROLLCOLOR */ #ifdef OPTION_HC - STRG(Rs_color + Color_HC, "highlightColor", "hc", "color", "highlight color"), + STRG (Rs_color + Color_HC, "highlightColor", "hc", "color", "highlight color"), #endif #if defined (XPM_BACKGROUND) || (MENUBAR_MAX) - RSTRG(Rs_path, "path", "search path"), + RSTRG (Rs_path, "path", "search path"), #endif /* defined (XPM_BACKGROUND) || (MENUBAR_MAX) */ #ifdef XPM_BACKGROUND - STRG(Rs_backgroundPixmap, "backgroundPixmap", "pixmap", "file[;geom]", + STRG (Rs_backgroundPixmap, "backgroundPixmap", "pixmap", "file[;geom]", "background pixmap"), #endif /* XPM_BACKGROUND */ #if (MENUBAR_MAX) - RSTRG(Rs_menu, "menu", "name[;tag]"), + RSTRG (Rs_menu, "menu", "name[;tag]"), #endif - STRG(Rs_font, "font", "fn", "fontname", "normal text font"), + STRG (Rs_font, "font", "fn", "fontname", "normal text font"), /* fonts: command-line option = resource name */ #ifdef USE_XIM - STRG(Rs_inputMethod, "inputMethod", "im", "name", "name of input method"), - STRG(Rs_preeditType, "preeditType", "pt", "style", + STRG (Rs_inputMethod, "inputMethod", "im", "name", "name of input method"), + STRG (Rs_preeditType, "preeditType", "pt", "style", "input style: style = OverTheSpot|OffTheSpot|Root"), #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) - STRG(Rs_imLocale, "imLocale", "imlocale", "string", "locale to use for input method"), + STRG (Rs_imLocale, "imLocale", "imlocale", "string", "locale to use for input method"), #endif #endif /* USE_XIM */ #ifdef GREEK_SUPPORT - STRG(Rs_greek_keyboard, "greek_keyboard", "grk", "mode", + STRG (Rs_greek_keyboard, "greek_keyboard", "grk", "mode", "greek keyboard mapping; mode = iso | ibm"), - RSTRG(Rs_greektoggle_key, "greektoggle_key", "keysym"), + RSTRG (Rs_greektoggle_key, "greektoggle_key", "keysym"), #endif - STRG(Rs_name, NULL, "name", "string", + STRG (Rs_name, NULL, "name", "string", "client instance, icon, and title strings"), - STRG(Rs_title, "title", "title", "string", "title name for window"), - STRG(Rs_title, NULL, "T", NULL, NULL), /* short form */ - STRG(Rs_iconName, "iconName", "n", "string", "icon name for window"), + STRG (Rs_title, "title", "title", "string", "title name for window"), + STRG (Rs_title, NULL, "T", NULL, NULL), /* short form */ + STRG (Rs_iconName, "iconName", "n", "string", "icon name for window"), #ifndef NO_CURSORCOLOR - STRG(Rs_color + Color_cursor, "cursorColor", "cr", "color", "cursor color"), + STRG (Rs_color + Color_cursor, "cursorColor", "cr", "color", "cursor color"), /* command-line option = resource name */ - RSTRG(Rs_color + Color_cursor2, "cursorColor2", "color"), + RSTRG (Rs_color + Color_cursor2, "cursorColor2", "color"), #endif /* NO_CURSORCOLOR */ - STRG(Rs_color + Color_pointer, "pointerColor", "pr", "color", + STRG (Rs_color + Color_pointer, "pointerColor", "pr", "color", "pointer color"), - STRG(Rs_color + Color_border, "borderColor", "bd", "color", + STRG (Rs_color + Color_border, "borderColor", "bd", "color", "border color"), - STRG(Rs_saveLines, "saveLines", "sl", "number", + STRG (Rs_saveLines, "saveLines", "sl", "number", "number of scrolled lines to save"), #ifndef NO_FRILLS - STRG(Rs_ext_bwidth, "externalBorder", "w", "number", + STRG (Rs_ext_bwidth, "externalBorder", "w", "number", "external border in pixels"), - STRG(Rs_ext_bwidth, NULL, "bw", NULL, NULL), - STRG(Rs_ext_bwidth, NULL, "borderwidth", NULL, NULL), - STRG(Rs_int_bwidth, "internalBorder", "b", "number", + STRG (Rs_ext_bwidth, NULL, "bw", NULL, NULL), + STRG (Rs_ext_bwidth, NULL, "borderwidth", NULL, NULL), + STRG (Rs_int_bwidth, "internalBorder", "b", "number", "internal border in pixels"), #endif #ifndef NO_LINESPACE - STRG(Rs_lineSpace, "lineSpace", "lsp", "number", + STRG (Rs_lineSpace, "lineSpace", "lsp", "number", "number of extra pixels between rows"), #endif - STRG(Rs_scrollBar_thickness, "thickness", "sbt", "number", + STRG (Rs_scrollBar_thickness, "thickness", "sbt", "number", "scrollbar thickness/width in pixels"), #ifdef POINTER_BLANK - RSTRG(Rs_pointerBlankDelay, "pointerBlankDelay", "number"), + RSTRG (Rs_pointerBlankDelay, "pointerBlankDelay", "number"), #endif #ifndef NO_BACKSPACE_KEY - RSTRG(Rs_backspace_key, "backspacekey", "string"), + RSTRG (Rs_backspace_key, "backspacekey", "string"), #endif #ifndef NO_DELETE_KEY - RSTRG(Rs_delete_key, "deletekey", "string"), + RSTRG (Rs_delete_key, "deletekey", "string"), #endif - RSTRG(Rs_selectstyle, "selectstyle", "mode"), - RSTRG(Rs_scrollstyle, "scrollstyle", "mode"), + RSTRG (Rs_selectstyle, "selectstyle", "mode"), + RSTRG (Rs_scrollstyle, "scrollstyle", "mode"), #ifdef HAVE_SCROLLBARS - RSTRG(Rs_scrollBar_align, "scrollBar_align", "mode"), + RSTRG (Rs_scrollBar_align, "scrollBar_align", "mode"), #endif #ifdef PRINTPIPE - RSTRG(Rs_print_pipe, "print-pipe", "string"), + RSTRG (Rs_print_pipe, "print-pipe", "string"), #endif #if defined (HOTKEY_CTRL) || defined (HOTKEY_META) - RSTRG(Rs_bigfont_key, "bigfont_key", "keysym"), - RSTRG(Rs_smallfont_key, "smallfont_key", "keysym"), + RSTRG (Rs_bigfont_key, "bigfont_key", "keysym"), + RSTRG (Rs_smallfont_key, "smallfont_key", "keysym"), #endif - STRG(Rs_modifier, "modifier", "mod", "modifier", + STRG (Rs_modifier, "modifier", "mod", "modifier", "meta modifier = alt|meta|hyper|super|mod1|...|mod5"), - INFO("xrm", "string", "X resource"), + INFO ("xrm", "string", "X resource"), #ifdef CUTCHAR_RESOURCE - RSTRG(Rs_cutchars, "cutchars", "string"), + RSTRG (Rs_cutchars, "cutchars", "string"), #endif /* CUTCHAR_RESOURCE */ #ifdef ACS_ASCII - RSTRG(Rs_acs_chars, "acsChars", "string"), + RSTRG (Rs_acs_chars, "acsChars", "string"), #endif /* ACS_ASCII */ - RSTRG(Rs_answerbackstring, "answerbackString", "string"), - INFO("e", "command arg ...", "command to execute") + RSTRG (Rs_answerbackstring, "answerbackString", "string"), + INFO ("e", "command arg ...", "command to execute") }; #undef INFO @@ -359,89 +359,89 @@ static const char optionsstring[] = "Options: " /*{{{ usage: */ /*----------------------------------------------------------------------*/ static void -rxvt_usage(int type) +rxvt_usage (int type) { unsigned int i, col; - write(STDERR_FILENO, releasestring, sizeof(releasestring) - 1); - write(STDERR_FILENO, optionsstring, sizeof(optionsstring) - 1); - write(STDERR_FILENO, APL_NAME, sizeof(APL_NAME) - 1); + write (STDERR_FILENO, releasestring, sizeof (releasestring) - 1); + write (STDERR_FILENO, optionsstring, sizeof (optionsstring) - 1); + write (STDERR_FILENO, APL_NAME, sizeof (APL_NAME) - 1); switch (type) { case 0: /* brief listing */ - fprintf(stderr, " [-help] [--help]\n"); - for (col = 1, i = 0; i < optList_size(); i++) + fprintf (stderr, " [-help] [--help]\n"); + for (col = 1, i = 0; i < optList_size (); i++) if (optList[i].desc != NULL) { int len = 0; - if (!optList_isBool(i)) + if (!optList_isBool (i)) { - len = optList_strlen(i); + len = optList_strlen (i); if (len > 0) len++; /* account for space */ } #ifdef DEBUG_STRICT - assert(optList[i].opt != NULL); + assert (optList[i].opt != NULL); #endif - len += 4 + STRLEN(optList[i].opt) + (optList_isBool(i) ? 2: 0); + len += 4 + STRLEN (optList[i].opt) + (optList_isBool (i) ? 2: 0); col += len; if (col > 79) { /* assume regular width */ - putc('\n', stderr); + putc ('\n', stderr); col = 1 + len; } - fprintf(stderr, " [-%s%s", (optList_isBool(i) ? "/+" : ""), + fprintf (stderr, " [-%s%s", (optList_isBool (i) ? "/+" : ""), optList[i].opt); - if (optList_strlen(i)) - fprintf(stderr, " %s]", optList[i].arg); + if (optList_strlen (i)) + fprintf (stderr, " %s]", optList[i].arg); else - fprintf(stderr, "]"); + fprintf (stderr, "]"); } break; case 1: /* full command-line listing */ - fprintf(stderr, " [options] [-e command args]\n\n" + fprintf (stderr, " [options] [-e command args]\n\n" "where options include:\n"); - for (i = 0; i < optList_size(); i++) + for (i = 0; i < optList_size (); i++) if (optList[i].desc != NULL) { #ifdef DEBUG_STRICT - assert(optList[i].opt != NULL); + assert (optList[i].opt != NULL); #endif - fprintf(stderr, " %s%s %-*s%s%s\n", - (optList_isBool(i) ? "-/+" : "-"), optList[i].opt, - (INDENT - STRLEN(optList[i].opt) - + (optList_isBool(i) ? 0 : 2)), + fprintf (stderr, " %s%s %-*s%s%s\n", + (optList_isBool (i) ? "-/+" : "-"), optList[i].opt, + (INDENT - STRLEN (optList[i].opt) + + (optList_isBool (i) ? 0 : 2)), (optList[i].arg ? optList[i].arg : ""), - (optList_isBool(i) ? "turn on/off " : ""), + (optList_isBool (i) ? "turn on/off " : ""), optList[i].desc); } - fprintf(stderr, "\n --help to list long-options"); + fprintf (stderr, "\n --help to list long-options"); break; case 2: /* full resource listing */ - fprintf(stderr, + fprintf (stderr, " [options] [-e command args]\n\n" "where resources (long-options) include:\n"); - for (i = 0; i < optList_size(); i++) + for (i = 0; i < optList_size (); i++) if (optList[i].kw != NULL) - fprintf(stderr, " %s: %*s%s\n", + fprintf (stderr, " %s: %*s%s\n", optList[i].kw, - (INDENT - STRLEN(optList[i].kw)), "", /* XXX */ - (optList_isBool(i) ? "boolean" : optList[i].arg)); + (INDENT - STRLEN (optList[i].kw)), "", /* XXX */ + (optList_isBool (i) ? "boolean" : optList[i].arg)); #ifdef KEYSYM_RESOURCE - fprintf(stderr, " " "keysym.sym" ": %*s%s\n", - (INDENT - sizeof("keysym.sym") + 1), "", /* XXX */ + fprintf (stderr, " " "keysym.sym" ": %*s%s\n", + (INDENT - sizeof ("keysym.sym") + 1), "", /* XXX */ "keysym"); #endif - fprintf(stderr, "\n -help to list options"); + fprintf (stderr, "\n -help to list options"); break; } - fprintf(stderr, "\n\n"); - exit(EXIT_FAILURE); + fprintf (stderr, "\n\n"); + exit (EXIT_FAILURE); /* NOTREACHED */ } @@ -461,7 +461,7 @@ rxvt_term::get_options (int argc, const char *const *argv) opt = argv[i]; #ifdef DEBUG_RESOURCES - fprintf(stderr, "argv[%d] = %s: ", i, opt); + fprintf (stderr, "argv[%d] = %s: ", i, opt); #endif if (*opt == '-') { @@ -478,63 +478,63 @@ rxvt_term::get_options (int argc, const char *const *argv) else { bad_option = 1; - rxvt_print_error("bad option \"%s\"", opt); + rxvt_print_error ("bad option \"%s\"", opt); continue; } - if (!STRCMP(opt, "help")) - rxvt_usage(longopt ? 2 : 1); - if (!STRCMP(opt, "h")) - rxvt_usage(0); + if (!STRCMP (opt, "help")) + rxvt_usage (longopt ? 2 : 1); + if (!STRCMP (opt, "h")) + rxvt_usage (0); /* feature: always try to match long-options */ - for (entry = 0; entry < optList_size(); entry++) - if ((optList[entry].kw && !STRCMP(opt, optList[entry].kw)) + for (entry = 0; entry < optList_size (); entry++) + if ((optList[entry].kw && !STRCMP (opt, optList[entry].kw)) || (!longopt - && optList[entry].opt && !STRCMP(opt, optList[entry].opt))) + && optList[entry].opt && !STRCMP (opt, optList[entry].opt))) break; - if (entry < optList_size()) + if (entry < optList_size ()) { - if (optList_isReverse(entry)) + if (optList_isReverse (entry)) flag = flag == On ? Off : On; - if (optList_strlen(entry)) + if (optList_strlen (entry)) { /* string value */ const char *str = argv[++i]; #ifdef DEBUG_RESOURCES - fprintf(stderr, "string (%s,%s) = ", + fprintf (stderr, "string (%s,%s) = ", optList[entry].opt ? optList[entry].opt : "nil", optList[entry].kw ? optList[entry].kw : "nil"); #endif if (flag == On && str && (optList[entry].doff != -1)) { #ifdef DEBUG_RESOURCES - fprintf(stderr, "\"%s\"\n", str); + fprintf (stderr, "\"%s\"\n", str); #endif rs[optList[entry].doff] = str; /* - * special cases are handled in main.c:main() to allow + * special cases are handled in main.c:main () to allow * X resources to set these values before we settle for * default values */ } #ifdef DEBUG_RESOURCES else - fprintf(stderr, "???\n"); + fprintf (stderr, "???\n"); #endif } else { /* boolean value */ #ifdef DEBUG_RESOURCES - fprintf(stderr, "boolean (%s,%s) = %s\n", + fprintf (stderr, "boolean (%s,%s) = %s\n", optList[entry].opt, optList[entry].kw, flag); #endif if (flag == On) Options |= (optList[entry].flag); else - Options &= ~(optList[entry].flag); + Options &= ~ (optList[entry].flag); if (optList[entry].doff != -1) rs[optList[entry].doff] = flag; @@ -542,13 +542,13 @@ rxvt_term::get_options (int argc, const char *const *argv) } else #ifdef KEYSYM_RESOURCE - /* if (!STRNCMP(opt, "keysym.", sizeof("keysym.") - 1)) */ - if (rxvt_Str_match(opt, "keysym.")) + /* if (!STRNCMP (opt, "keysym.", sizeof ("keysym.") - 1)) */ + if (rxvt_Str_match (opt, "keysym.")) { const char *str = argv[++i]; if (str != NULL) - parse_keysym (opt + sizeof("keysym.") - 1, str); + parse_keysym (opt + sizeof ("keysym.") - 1, str); } else #endif @@ -556,7 +556,7 @@ rxvt_term::get_options (int argc, const char *const *argv) } if (bad_option) - rxvt_usage(0); + rxvt_usage (0); } /*}}} */ @@ -580,7 +580,7 @@ rxvt_define_key(XrmDatabase *database __attribute__((unused)), XrmBindingList bi for (last = 0; quarks[last] != NULLQUARK; last++) /* look for last quark in list */ ; last--; - GET_R->parse_keysym (XrmQuarkToString(quarks[last]), (char *)value->addr);//D//TODO + GET_R->parse_keysym (XrmQuarkToString (quarks[last]), (char *)value->addr);//D//TODO return False; } @@ -602,27 +602,27 @@ rxvt_term::parse_keysym (const char *str, const char *arg) if (arg == NULL) { - if ((n = rxvt_Str_match(str, "keysym.")) == 0) + if ((n = rxvt_Str_match (str, "keysym.")) == 0) return 0; str += n; /* skip `keysym.' */ } - /* some scanf() have trouble with a 0x prefix */ - if (isdigit(str[0])) + /* some scanf () have trouble with a 0x prefix */ + if (isdigit (str[0])) { - if (str[0] == '0' && toupper(str[1]) == 'X') + if (str[0] == '0' && toupper (str[1]) == 'X') str += 2; if (arg) { - if (sscanf(str, (STRCHR(str, ':') ? "%x:" : "%x"), &sym) != 1) + if (sscanf (str, (STRCHR (str, ':') ? "%x:" : "%x"), &sym) != 1) return -1; } else { - if (sscanf(str, "%x:", &sym) != 1) + if (sscanf (str, "%x:", &sym) != 1) return -1; - /* cue to ':', it's there since sscanf() worked */ - STRNCPY(newargstr, STRCHR(str, ':') + 1, NEWARGLIM - 1); + /* cue to ':', it's there since sscanf () worked */ + STRNCPY (newargstr, STRCHR (str, ':') + 1, NEWARGLIM - 1); newargstr[NEWARGLIM - 1] = '\0'; newarg = newargstr; } @@ -632,15 +632,15 @@ rxvt_term::parse_keysym (const char *str, const char *arg) /* * convert keysym name to keysym number */ - STRNCPY(newargstr, str, NEWARGLIM - 1); + STRNCPY (newargstr, str, NEWARGLIM - 1); newargstr[NEWARGLIM - 1] = '\0'; if (arg == NULL) { - if ((newarg = STRCHR(newargstr, ':')) == NULL) + if ((newarg = STRCHR (newargstr, ':')) == NULL) return -1; *newarg++ = '\0'; /* terminate keysym name */ } - if ((sym = XStringToKeysym(newargstr)) == None) + if ((sym = XStringToKeysym (newargstr)) == None) return -1; } @@ -652,18 +652,18 @@ rxvt_term::parse_keysym (const char *str, const char *arg) if (newarg == NULL) { - STRNCPY(newargstr, arg, NEWARGLIM - 1); + STRNCPY (newargstr, arg, NEWARGLIM - 1); newargstr[NEWARGLIM - 1] = '\0'; newarg = newargstr; } - rxvt_Str_trim(newarg); - if (*newarg == '\0' || (n = rxvt_Str_escaped(newarg)) == 0) + rxvt_Str_trim (newarg); + if (*newarg == '\0' || (n = rxvt_Str_escaped (newarg)) == 0) return -1; - MIN_IT(n, 255); - key_string = (char *)rxvt_malloc((n + 1) * sizeof(char)); + MIN_IT (n, 255); + key_string = (char *)rxvt_malloc ((n + 1) * sizeof (char)); key_string[0] = n; - STRNCPY(key_string + 1, newarg, n); + STRNCPY (key_string + 1, newarg, n); Keysym_map[sym] = (unsigned char *)key_string; return 1; @@ -672,7 +672,7 @@ rxvt_term::parse_keysym (const char *str, const char *arg) # endif /* KEYSYM_RESOURCE */ # ifndef USE_XGETDEFAULT -/*{{{ rxvt_get_xdefaults() */ +/*{{{ rxvt_get_xdefaults () */ /* * the matching algorithm used for memory-save fake resources */ @@ -684,62 +684,62 @@ rxvt_term::get_xdefaults (FILE *stream, const char *name) if (stream == NULL) return; - len = STRLEN(name); - while ((str = fgets(buffer, sizeof(buffer), stream)) != NULL) + len = STRLEN (name); + while ((str = fgets (buffer, sizeof (buffer), stream)) != NULL) { unsigned int entry, n; - while (*str && isspace(*str)) + while (*str && isspace (*str)) str++; /* leading whitespace */ if ((str[len] != '*' && str[len] != '.') - || (len && STRNCMP(str, name, len))) + || (len && STRNCMP (str, name, len))) continue; str += (len + 1); /* skip `name*' or `name.' */ # ifdef KEYSYM_RESOURCE if (!parse_keysym (str, NULL)) # endif /* KEYSYM_RESOURCE */ - for (entry = 0; entry < optList_size(); entry++) + for (entry = 0; entry < optList_size (); entry++) { const char *kw = optList[entry].kw; if (kw == NULL) continue; n = STRLEN (kw); - if (str[n] == ':' && rxvt_Str_match(str, kw)) + if (str[n] == ':' && rxvt_Str_match (str, kw)) { /* skip `keyword:' */ str += (n + 1); - rxvt_Str_trim(str); - n = STRLEN(str); + rxvt_Str_trim (str); + n = STRLEN (str); if (n && rs[optList[entry].doff] == NULL) { /* not already set */ int s; - char *p = (char *)rxvt_malloc((n + 1) * sizeof(char)); + char *p = (char *)rxvt_malloc ((n + 1) * sizeof (char)); - STRCPY(p, str); + STRCPY (p, str); rs[optList[entry].doff] = p; - if (optList_isBool(entry)) + if (optList_isBool (entry)) { - s = STRCASECMP(str, "TRUE") == 0 - || STRCASECMP(str, "YES") == 0 - || STRCASECMP(str, "ON") == 0 - || STRCASECMP(str, "1") == 0; - if (optList_isReverse(entry)) + s = STRCASECMP (str, "TRUE") == 0 + || STRCASECMP (str, "YES") == 0 + || STRCASECMP (str, "ON") == 0 + || STRCASECMP (str, "1") == 0; + if (optList_isReverse (entry)) s = !s; if (s) Options |= (optList[entry].flag); else - Options &= ~(optList[entry].flag); + Options &= ~ (optList[entry].flag); } } break; } } } - rewind(stream); + rewind (stream); } /*}}} */ @@ -748,11 +748,11 @@ rxvt_term::get_xdefaults (FILE *stream, const char *name) /*{{{ read the resources files */ /* - * using XGetDefault() or the hand-rolled replacement + * using XGetDefault () or the hand-rolled replacement */ /* ARGSUSED */ void -rxvt_term::extract_resources (Display *display __attribute__((unused)), const char *name) +rxvt_term::extract_resources (Display *display __attribute__ ((unused)), const char *name) { #ifndef NO_RESOURCES @@ -763,9 +763,9 @@ rxvt_term::extract_resources (Display *display __attribute__((unused)), const ch if (locale != NULL) { /* XXX: must limit length of string */ - localepath = (char *)rxvt_malloc(256); - sprintf(localepath, XAPPLOADDIRLOCALE "/" APL_SUBCLASS, - (int)(258 - sizeof(XAPPLOADDIRLOCALE) - sizeof(APL_SUBCLASS)), + localepath = (char *)rxvt_malloc (256); + sprintf (localepath, XAPPLOADDIRLOCALE "/" APL_SUBCLASS, + (int) (258 - sizeof (XAPPLOADDIRLOCALE) - sizeof (APL_SUBCLASS)), locale); /* 258 = 255 + 4 (-.*s) - 1 (/) */ } @@ -787,30 +787,30 @@ rxvt_term::extract_resources (Display *display __attribute__((unused)), const ch XrmDatabase database, rdb1; char fname[1024]; - XrmInitialize(); + XrmInitialize (); database = NULL; /* Get any Xserver defaults */ - displayResource = XResourceManagerString(display); + displayResource = XResourceManagerString (display); if (displayResource != NULL) - database = XrmGetStringDatabase(displayResource); + database = XrmGetStringDatabase (displayResource); # ifdef HAVE_EXTRA_XRESOURCE_FILES /* Add in ~/.Xdefaults or ~/.Xresources */ { char *ptr; - if ((ptr = (char *)getenv("HOME")) == NULL) + if ((ptr = (char *)getenv ("HOME")) == NULL) ptr = "."; - for (i = 0; i < (sizeof(xnames) / sizeof(xnames[0])); i++) + for (i = 0; i < (sizeof (xnames) / sizeof (xnames[0])); i++) { - sprintf(fname, "%-.*s/%s", sizeof(fname) - STRLEN(xnames[i]) - 2, + sprintf (fname, "%-.*s/%s", sizeof (fname) - STRLEN (xnames[i]) - 2, ptr, xnames[i]); - if ((rdb1 = XrmGetFileDatabase(fname)) != NULL) + if ((rdb1 = XrmGetFileDatabase (fname)) != NULL) { - XrmMergeDatabases(rdb1, &database); + XrmMergeDatabases (rdb1, &database); # ifndef HAVE_BOTH_XRESOURCE_FILES break; # endif @@ -822,34 +822,34 @@ rxvt_term::extract_resources (Display *display __attribute__((unused)), const ch /* Add in XENVIRONMENT file */ - if ((xe = (char *)getenv("XENVIRONMENT")) != NULL - && (rdb1 = XrmGetFileDatabase(xe)) != NULL) - XrmMergeDatabases(rdb1, &database); + if ((xe = (char *)getenv ("XENVIRONMENT")) != NULL + && (rdb1 = XrmGetFileDatabase (xe)) != NULL) + XrmMergeDatabases (rdb1, &database); /* Add in Rxvt file */ # if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) - if (localepath == NULL || (rdb1 = XrmGetFileDatabase(localepath)) == NULL) + if (localepath == NULL || (rdb1 = XrmGetFileDatabase (localepath)) == NULL) # endif - rdb1 = XrmGetFileDatabase(XAPPLOADDIR "/" APL_SUBCLASS); + rdb1 = XrmGetFileDatabase (XAPPLOADDIR "/" APL_SUBCLASS); if (rdb1 != NULL) - XrmMergeDatabases(rdb1, &database); + XrmMergeDatabases (rdb1, &database); /* Add in $XAPPLRESDIR/Rxvt only; not bothering with XUSERFILESEARCHPATH */ - if ((xe = (char *)getenv("XAPPLRESDIR")) != NULL) + if ((xe = (char *)getenv ("XAPPLRESDIR")) != NULL) { - sprintf(fname, "%-.*s/" APL_SUBCLASS, sizeof(fname) - - sizeof(APL_SUBCLASS) - 2, xe); - if ((rdb1 = XrmGetFileDatabase(fname)) != NULL) - XrmMergeDatabases(rdb1, &database); + sprintf (fname, "%-.*s/" APL_SUBCLASS, sizeof (fname) + - sizeof (APL_SUBCLASS) - 2, xe); + if ((rdb1 = XrmGetFileDatabase (fname)) != NULL) + XrmMergeDatabases (rdb1, &database); } - XrmSetDatabase(display, database); + XrmSetDatabase (display, database); # endif /* * Query resources for options that affect us */ - for (entry = 0; entry < optList_size(); entry++) + for (entry = 0; entry < optList_size (); entry++) { int s; char *p, *p0; @@ -858,13 +858,13 @@ rxvt_term::extract_resources (Display *display __attribute__((unused)), const ch if (kw == NULL || rs[optList[entry].doff] != NULL) continue; /* previously set */ - p = XGetDefault(display, name, kw); - p0 = XGetDefault(display, "!INVALIDPROGRAMMENAMEDONTMATCH!", kw); - if (p == NULL || (p0 && STRCMP(p, p0) == 0)) + p = XGetDefault (display, name, kw); + p0 = XGetDefault (display, "!INVALIDPROGRAMMENAMEDONTMATCH!", kw); + if (p == NULL || (p0 && STRCMP (p, p0) == 0)) { - p = XGetDefault(display, APL_SUBCLASS, kw); - if (p == NULL || (p0 && STRCMP(p, p0) == 0)) - p = XGetDefault(display, APL_CLASS, kw); + p = XGetDefault (display, APL_SUBCLASS, kw); + if (p == NULL || (p0 && STRCMP (p, p0) == 0)) + p = XGetDefault (display, APL_CLASS, kw); } if (p == NULL && p0) p = p0; @@ -872,18 +872,18 @@ rxvt_term::extract_resources (Display *display __attribute__((unused)), const ch { rs[optList[entry].doff] = p; - if (optList_isBool(entry)) + if (optList_isBool (entry)) { - s = STRCASECMP(p, "TRUE") == 0 - || STRCASECMP(p, "YES") == 0 - || STRCASECMP(p, "ON") == 0 - || STRCASECMP(p, "1") == 0; - if (optList_isReverse(entry)) + s = STRCASECMP (p, "TRUE") == 0 + || STRCASECMP (p, "YES") == 0 + || STRCASECMP (p, "ON") == 0 + || STRCASECMP (p, "1") == 0; + if (optList_isReverse (entry)) s = !s; if (s) Options |= (optList[entry].flag); else - Options &= ~(optList[entry].flag); + Options &= ~ (optList[entry].flag); } } } @@ -893,21 +893,21 @@ rxvt_term::extract_resources (Display *display __attribute__((unused)), const ch */ # ifdef XrmEnumOneLevel # ifdef KEYSYM_RESOURCE - name_prefix[0] = XrmStringToName(name); - name_prefix[1] = XrmStringToName("keysym"); + name_prefix[0] = XrmStringToName (name); + name_prefix[1] = XrmStringToName ("keysym"); name_prefix[2] = NULLQUARK; - class_prefix[0] = XrmStringToName(APL_SUBCLASS); - class_prefix[1] = XrmStringToName("Keysym"); + class_prefix[0] = XrmStringToName (APL_SUBCLASS); + class_prefix[1] = XrmStringToName ("Keysym"); class_prefix[2] = NULLQUARK; - /* XXX: Need to check sizeof(rxvt_t) == sizeof(XPointer) */ - XrmEnumerateDatabase(XrmGetDatabase(display), name_prefix, class_prefix, + /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */ + XrmEnumerateDatabase (XrmGetDatabase (display), name_prefix, class_prefix, XrmEnumOneLevel, rxvt_define_key, NULL); - name_prefix[0] = XrmStringToName(APL_CLASS); - name_prefix[1] = XrmStringToName("keysym"); - class_prefix[0] = XrmStringToName(APL_CLASS); - class_prefix[1] = XrmStringToName("Keysym"); - /* XXX: Need to check sizeof(rxvt_t) == sizeof(XPointer) */ - XrmEnumerateDatabase(XrmGetDatabase(display), name_prefix, class_prefix, + name_prefix[0] = XrmStringToName (APL_CLASS); + name_prefix[1] = XrmStringToName ("keysym"); + class_prefix[0] = XrmStringToName (APL_CLASS); + class_prefix[1] = XrmStringToName ("Keysym"); + /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */ + XrmEnumerateDatabase (XrmGetDatabase (display), name_prefix, class_prefix, XrmEnumOneLevel, rxvt_define_key, NULL); # endif # endif @@ -917,21 +917,21 @@ rxvt_term::extract_resources (Display *display __attribute__((unused)), const ch FILE *fd = NULL; char *home; - if ((home = getenv("HOME")) != NULL) + if ((home = getenv ("HOME")) != NULL) { - unsigned int i, len = STRLEN(home) + 2; + unsigned int i, len = STRLEN (home) + 2; char *f = NULL; - for (i = 0; i < (sizeof(xnames) / sizeof(xnames[0])); i++) + for (i = 0; i < (sizeof (xnames) / sizeof (xnames[0])); i++) { - f = (char *)rxvt_realloc(f, (len + STRLEN(xnames[i])) * sizeof(char)); + f = (char *)rxvt_realloc (f, (len + STRLEN (xnames[i])) * sizeof (char)); - sprintf(f, "%s/%s", home, xnames[i]); + sprintf (f, "%s/%s", home, xnames[i]); - if ((fd = fopen(f, "r")) != NULL) + if ((fd = fopen (f, "r")) != NULL) break; } - free(f); + free (f); } /* * The normal order to match resources is the following: @@ -964,14 +964,14 @@ rxvt_term::extract_resources (Display *display __attribute__((unused)), const ch FILE *ad = NULL; # if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) - if (localepath == NULL || (ad = fopen(localepath, "r")) == NULL) + if (localepath == NULL || (ad = fopen (localepath, "r")) == NULL) # endif - ad = fopen(XAPPLOADDIR "/" APL_SUBCLASS, "r"); + ad = fopen (XAPPLOADDIR "/" APL_SUBCLASS, "r"); if (ad != NULL) { get_xdefaults (ad, APL_SUBCLASS); get_xdefaults (ad, ""); - fclose(ad); + fclose (ad); } } # endif /* XAPPLOADDIR */ @@ -979,7 +979,7 @@ rxvt_term::extract_resources (Display *display __attribute__((unused)), const ch get_xdefaults (fd, APL_CLASS); get_xdefaults (fd, ""); /* partial match */ if (fd != NULL) - fclose(fd); + fclose (fd); # endif /* USE_XGETDEFAULT */ # if defined XAPPLOADDIR @@ -988,7 +988,7 @@ rxvt_term::extract_resources (Display *display __attribute__((unused)), const ch } /* Free the path of the possibly available localized Rxvt file */ - free(localepath); + free (localepath); # endif # endif @@ -1006,16 +1006,16 @@ rxvt_term::extract_resources (Display *display __attribute__((unused)), const ch /* void set_greek_keyboard (const char * str); */ if (rs[Rs_greek_keyboard]) { - if (!STRCMP(rs[Rs_greek_keyboard], "iso")) - greek_setmode(GREEK_ELOT928); /* former -grk9 */ - else if (!STRCMP(rs[Rs_greek_keyboard], "ibm")) - greek_setmode(GREEK_IBM437); /* former -grk4 */ + if (!STRCMP (rs[Rs_greek_keyboard], "iso")) + greek_setmode (GREEK_ELOT928); /* former -grk9 */ + else if (!STRCMP (rs[Rs_greek_keyboard], "ibm")) + greek_setmode (GREEK_IBM437); /* former -grk4 */ } { KeySym sym; if (rs[Rs_greektoggle_key] - && ((sym = XStringToKeysym(rs[Rs_greektoggle_key])) != 0)) + && ((sym = XStringToKeysym (rs[Rs_greektoggle_key])) != 0)) ks_greekmodeswith = sym; } #endif /* GREEK_SUPPORT */ @@ -1026,10 +1026,10 @@ rxvt_term::extract_resources (Display *display __attribute__((unused)), const ch KeySym sym; if (rs[Rs_bigfont_key] - && ((sym = XStringToKeysym(rs[Rs_bigfont_key])) != 0)) + && ((sym = XStringToKeysym (rs[Rs_bigfont_key])) != 0)) ks_bigfont = sym; if (rs[Rs_smallfont_key] - && ((sym = XStringToKeysym(rs[Rs_smallfont_key])) != 0)) + && ((sym = XStringToKeysym (rs[Rs_smallfont_key])) != 0)) ks_smallfont = sym; } #endif diff --git a/src/xpm.C b/src/xpm.C index 772b9ea5..5f2f436e 100644 --- a/src/xpm.C +++ b/src/xpm.C @@ -1,7 +1,7 @@ /*--------------------------------*-C-*---------------------------------* * File: xpm.c *----------------------------------------------------------------------* - * $Id: xpm.C,v 1.8 2004-02-09 07:11:49 pcg Exp $ + * $Id: xpm.C,v 1.9 2004-02-13 12:16:21 pcg Exp $ * * All portions of code are copyright by their respective author/s. * Copyright (c) 1997 Carsten Haitzler @@ -57,32 +57,32 @@ rxvt_term::scale_pixmap (const char *geom) unsigned int w = 0, h = 0; unsigned int n; char *p, *str; - bgPixmap_t *bgpixmap = &(bgPixmap); + bgPixmap_t *bgpixmap = & (bgPixmap); #define MAXLEN_GEOM sizeof("[1000x1000+1000+1000]") if (geom == NULL) return 0; str = (char *)rxvt_malloc (MAXLEN_GEOM + 1); - if (!STRCMP(geom, "?")) + if (!STRCMP (geom, "?")) { - sprintf(str, "[%dx%d+%d+%d]", /* can't presume snprintf() ! */ - min(bgpixmap->w, 9999), min(bgpixmap->h, 9999), - min(bgpixmap->x, 9999), min(bgpixmap->y, 9999)); + sprintf (str, "[%dx%d+%d+%d]", /* can't presume snprintf () ! */ + min (bgpixmap->w, 9999), min (bgpixmap->h, 9999), + min (bgpixmap->x, 9999), min (bgpixmap->y, 9999)); xterm_seq (XTerm_title, str, CHAR_ST); - free(str); + free (str); return 0; } - if ((p = STRCHR(geom, ';')) == NULL) - p = STRCHR(geom, '\0'); + if ((p = STRCHR (geom, ';')) == NULL) + p = STRCHR (geom, '\0'); n = (p - geom); if (n <= MAXLEN_GEOM) { - STRNCPY(str, geom, n); + STRNCPY (str, geom, n); str[n] = '\0'; - flags = XParseGeometry(str, &x, &y, &w, &h); + flags = XParseGeometry (str, &x, &y, &w, &h); if (!flags) { flags |= WidthValue; @@ -90,9 +90,9 @@ rxvt_term::scale_pixmap (const char *geom) } /* default is tile */ if (flags & WidthValue) { - if (!(flags & XValue)) + if (! (flags & XValue)) x = 50; - if (!(flags & HeightValue)) + if (! (flags & HeightValue)) h = w; if (w && !h) { @@ -119,14 +119,14 @@ rxvt_term::scale_pixmap (const char *geom) changed++; } } - if (!(flags & YValue)) + if (! (flags & YValue)) { if (flags & XNegative) flags |= YNegative; y = x; } - if (!(flags & WidthValue) && geom[0] != '=') + if (! (flags & WidthValue) && geom[0] != '=') { x += bgpixmap->x; y += bgpixmap->y; @@ -138,10 +138,10 @@ rxvt_term::scale_pixmap (const char *geom) if (flags & YNegative) y += 100; } - MIN_IT(x, 100); - MIN_IT(y, 100); - MAX_IT(x, 0); - MAX_IT(y, 0); + MIN_IT (x, 100); + MIN_IT (y, 100); + MAX_IT (x, 0); + MAX_IT (y, 0); if (bgpixmap->x != x) { bgpixmap->x = x; @@ -153,7 +153,7 @@ rxvt_term::scale_pixmap (const char *geom) changed++; } } - free(str); + free (str); return changed; } @@ -162,23 +162,23 @@ rxvt_term::resize_pixmap () { XGCValues gcvalue; GC gc; - unsigned int width = TermWin_TotalWidth(); - unsigned int height = TermWin_TotalHeight(); + unsigned int width = TermWin_TotalWidth (); + unsigned int height = TermWin_TotalHeight (); if (TermWin.pixmap != None) - XFreePixmap(display->display, TermWin.pixmap); + XFreePixmap (display->display, TermWin.pixmap); if (bgPixmap.pixmap == None) { /* So be it: I'm not using pixmaps */ TermWin.pixmap = None; - if (!(Options & Opt_transparent) || am_transparent == 0) - XSetWindowBackground(display->display, TermWin.vt, + if (! (Options & Opt_transparent) || am_transparent == 0) + XSetWindowBackground (display->display, TermWin.vt, PixColors[Color_bg]); return; } gcvalue.foreground = PixColors[Color_bg]; - gc = XCreateGC(display->display, TermWin.vt, GCForeground, &gcvalue); + gc = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); if (bgPixmap.pixmap != None) { /* we have a specified pixmap */ @@ -199,10 +199,10 @@ rxvt_term::resize_pixmap () if (w == 0) { /* basic X tiling - let the X server do it */ - TermWin.pixmap = XCreatePixmap(display->display, TermWin.vt, + TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt, xpmw, xpmh, (unsigned int)XDEPTH); - XCopyArea(display->display, bgPixmap.pixmap, TermWin.pixmap, gc, + XCopyArea (display->display, bgPixmap.pixmap, TermWin.pixmap, gc, 0, 0, xpmw, xpmh, 0, 0); } else @@ -210,17 +210,17 @@ rxvt_term::resize_pixmap () float incr, p; Pixmap tmp; - TermWin.pixmap = XCreatePixmap(display->display, TermWin.vt, + TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt, width, height, (unsigned int)XDEPTH); /* * horizontal scaling */ - rxvt_pixmap_incr(&w, &x, &incr, &p, width, xpmw); + rxvt_pixmap_incr (&w, &x, &incr, &p, width, xpmw); - tmp = XCreatePixmap(display->display, TermWin.vt, + tmp = XCreatePixmap (display->display, TermWin.vt, width, xpmh, (unsigned int)XDEPTH); - XFillRectangle(display->display, tmp, gc, 0, 0, width, + XFillRectangle (display->display, tmp, gc, 0, 0, width, xpmh); for ( /*nil */ ; x < w; x++, p += incr) @@ -228,39 +228,39 @@ rxvt_term::resize_pixmap () if (p >= xpmw) p = 0; /* copy one column from the original pixmap to the tmp pixmap */ - XCopyArea(display->display, bgPixmap.pixmap, tmp, gc, + XCopyArea (display->display, bgPixmap.pixmap, tmp, gc, (int)p, 0, 1, xpmh, (int)x, 0); } /* * vertical scaling */ - rxvt_pixmap_incr(&h, &y, &incr, &p, height, xpmh); + rxvt_pixmap_incr (&h, &y, &incr, &p, height, xpmh); if (y > 0) - XFillRectangle(display->display, TermWin.pixmap, gc, 0, 0, width, + XFillRectangle (display->display, TermWin.pixmap, gc, 0, 0, width, y); if (h < height) - XFillRectangle(display->display, TermWin.pixmap, gc, 0, (int)h, + XFillRectangle (display->display, TermWin.pixmap, gc, 0, (int)h, width, height - h + 1); for ( /*nil */ ; y < h; y++, p += incr) { if (p >= xpmh) p = 0; /* copy one row from the tmp pixmap to the main pixmap */ - XCopyArea(display->display, tmp, TermWin.pixmap, gc, + XCopyArea (display->display, tmp, TermWin.pixmap, gc, 0, (int)p, width, 1, 0, (int)y); } - XFreePixmap(display->display, tmp); + XFreePixmap (display->display, tmp); } } - XSetWindowBackgroundPixmap(display->display, TermWin.vt, TermWin.pixmap); - XFreeGC(display->display, gc); + XSetWindowBackgroundPixmap (display->display, TermWin.vt, TermWin.pixmap); + XFreeGC (display->display, gc); am_transparent = 0; - XClearWindow(display->display, TermWin.vt); + XClearWindow (display->display, TermWin.vt); - XSync(display->display, False); + XSync (display->display, False); } /* @@ -269,7 +269,7 @@ rxvt_term::resize_pixmap () */ /* INTPROTO */ static void -rxvt_pixmap_incr(unsigned int *wh, unsigned int *xy, float *incr, float *p, unsigned int widthheight, unsigned int xpmwidthheight) +rxvt_pixmap_incr (unsigned int *wh, unsigned int *xy, float *incr, float *p, unsigned int widthheight, unsigned int xpmwidthheight) { unsigned int cwh, cxy; float cincr, cp; @@ -345,14 +345,14 @@ rxvt_term::set_bgPixmap (const char *file) { char *f; - assert(file != NULL); + assert (file != NULL); if (bgPixmap.pixmap != None) { - XFreePixmap(display->display, bgPixmap.pixmap); + XFreePixmap (display->display, bgPixmap.pixmap); bgPixmap.pixmap = None; } - XSetWindowBackground(display->display, TermWin.vt, PixColors[Color_bg]); + XSetWindowBackground (display->display, TermWin.vt, PixColors[Color_bg]); if (*file != '\0') { @@ -361,7 +361,7 @@ rxvt_term::set_bgPixmap (const char *file) /* * we already have the required attributes */ - /* XGetWindowAttributes(display->display, TermWin.vt, &attr); */ + /* XGetWindowAttributes (display->display, TermWin.vt, &attr); */ xpmAttr.closeness = 30000; xpmAttr.colormap = XCMAP; @@ -371,22 +371,22 @@ rxvt_term::set_bgPixmap (const char *file) XpmDepth | XpmSize | XpmReturnPixels); /* search environment variables here too */ - f = (char *)rxvt_File_find(file, ".xpm", rs[Rs_path]); + f = (char *)rxvt_File_find (file, ".xpm", rs[Rs_path]); if (f == NULL - || XpmReadFileToPixmap(display->display, display->root, f, + || XpmReadFileToPixmap (display->display, display->root, f, &bgPixmap.pixmap, NULL, &xpmAttr)) { char *p; /* semi-colon delimited */ - if ((p = STRCHR(file, ';')) == NULL) - p = STRCHR(file, '\0'); + if ((p = STRCHR (file, ';')) == NULL) + p = STRCHR (file, '\0'); - rxvt_print_error("couldn't load XPM file \"%.*s\"", (p - file), + rxvt_print_error ("couldn't load XPM file \"%.*s\"", (p - file), file); } - free(f); + free (f); } resize_pixmap (); return bgPixmap.pixmap;