if (numlock_state || (ev.state & ModNumLockMask))
{
numlock_state = (ev.state & ModNumLockMask);
- PrivMode((!numlock_state), PrivMode_aplKP);
+ PrivMode ((!numlock_state), PrivMode_aplKP);
}
kbuf[0] = 0;
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);
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;
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
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;
}
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)
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)
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;
/* 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
{
#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;
/* allow shift to override */
if ((PrivateModes & PrivMode_aplKP) ? !shft : shft)
{
- STRCPY(kbuf, "\033Oj");
+ STRCPY (kbuf, "\033Oj");
kbuf[2] += (keysym - XK_KP_Multiply);
}
else
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~" */
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:
break;
}
if (newlen)
- len = STRLEN(kbuf);
+ len = STRLEN (kbuf);
}
/*
* Pass meta for all function keys, if 'meta' option set
#endif
#ifdef GREEK_SUPPORT
if (greek_mode)
- len = greek_xlat(kbuf, len);
+ len = greek_xlat (kbuf, len);
#endif
/* nil */ ;
}
{
const unsigned char ch = C0_ESC;
- tt_write(&ch, 1);
+ tt_write (&ch, 1);
}
#ifdef DEBUG_CMD
if (debug_key)
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);
/*}}} */
#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)
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--;)
nlines++;
refresh_count++;
- if (!(Options & Opt_jumpScroll)
+ if (! (Options & Opt_jumpScroll)
|| (refresh_count >= (refresh_limit * (TermWin.nrow - 1))))
{
refreshnow = true;
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.
void
rxvt_term::pointer_blank ()
{
- if (!(Options & Opt_pointerBlank))
+ if (! (Options & Opt_pointerBlank))
return;
XDefineCursor (display->display, TermWin.vt, blank_cursor);
}
#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));
#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);
}
#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)
#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;
}
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;
/*
want_refresh = 1;
#ifdef USE_XIM
if (Input_Context != NULL)
- XSetICFocus(Input_Context);
+ XSetICFocus (Input_Context);
#endif
#ifdef CURSOR_BLINK
if (Options & Opt_cursorBlink)
want_refresh = 1;
#ifdef USE_XIM
if (Input_Context != NULL)
- XUnsetICFocus(Input_Context);
+ XUnsetICFocus (Input_Context);
#endif
#ifdef CURSOR_BLINK
if (Options & Opt_cursorBlink)
{ /* 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 */
{
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
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)
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 */
(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;
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
}
}
- 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);
* 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;
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
*/
{
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);
/*
* Scrollbar window processing of button press
*/
- if (isScrollbarWindow(ev.window))
+ if (isScrollbarWindow (ev.window))
{
scrollBar.setIdle ();
/*
* 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;
}
}
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)
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;
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
{
scr_page ((ev.button == Button1 ? DN : UP),
(TermWin.nrow
- * scrollbar_position(ev.y)
- / scrollbar_size()));
+ * scrollbar_position (ev.y)
+ / scrollbar_size ()));
}
break;
}
/*
* Menubar window processing of button press
*/
- if (isMenuBarWindow(ev.window))
+ if (isMenuBarWindow (ev.window))
menubar_control (ev);
#endif
}
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);
{
#ifdef RXVT_GRAPHICS
if (ev.subwindow != None)
- rxvt_Gr_ButtonRelease(ev.x, ev.y);
+ rxvt_Gr_ButtonRelease (ev.x, ev.y);
else
#endif
}
}
#ifdef MENUBAR
- else if (isMenuBarWindow(ev.window))
+ else if (isMenuBarWindow (ev.window))
menubar_control (ev);
#endif
}
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;
}
}
/* 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
* 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)
else
{
have_pixmap = 1;
- rootpixmap = *((Pixmap *)prop);
- XFree(prop);
+ rootpixmap = * ((Pixmap *)prop);
+ XFree (prop);
}
if (have_pixmap)
{
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;
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? */
pchanged = 1;
if (TermWin.pixmap != None)
{
- XFreePixmap(display->display, TermWin.pixmap);
+ XFreePixmap (display->display, TermWin.pixmap);
TermWin.pixmap = None;
}
}
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;
/*
* 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)
{
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? */
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;
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;
}
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); */
if ((ch = cmd_getc ()) != C0_ESC)
{
- if (putc(ch, fd) == EOF)
+ if (putc (ch, fd) == EOF)
break; /* done = 1 */
}
else
}
}
for (i = 0; i < len; i++)
- if (putc(buf[i], fd) == EOF)
+ if (putc (buf[i], fd) == EOF)
{
done = 1;
break;
{
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 ();
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 */
if (cmd_getc () == '8')
scr_E ();
break;
- case '(':
+ case ' (':
scr_charset_set (0, (unsigned int)cmd_getc ());
break;
case ')':
#endif
case '=':
case '>':
- PrivMode((ch == '='), PrivMode_aplKP);
+ PrivMode ((ch == '='), PrivMode_aplKP);
break;
case C1_40:
/* 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 */
(((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* */
/* read any numerical arguments */
for (n = -1; ch < CSI_ICH; )
{
- if (isdigit(ch))
+ if (isdigit (ch))
{
if (n < 0)
n = ch - '0';
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
/*
{
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')
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 */
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 */
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 */
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:
* 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
/*----------------------------------------------------------------------*/
/*
* 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)
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;
}
*/
s = get_to_st (&eh);
if (s)
- free(s);
+ free (s);
return;
}
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 == ';')
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)
#endif
else
xterm_seq (arg, (char *)s, eh);
- free(s);
+ free (s);
}
}
}
* 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:
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);
}
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;
#endif
scr_touch (true);
}
- while ((str = STRCHR(str, ';')) != NULL)
+ while ((str = STRCHR (str, ';')) != NULL)
{
str++;
#if XPM_BACKGROUND
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;
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;
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);
scr_cursor (SAVE);
/* FALLTHROUGH */
default:
- continue; /* for(;i;) */
+ continue; /* for (;i;) */
}
/* extra handling for values with valid 0 or 1 state */
* 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 */
/* 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:
/* case 67: - backspace key */
case 1000: /* X11 mouse reporting */
if (state) /* orthogonal */
- PrivateModes &= ~(PrivMode_MouseX10);
+ PrivateModes &= ~ (PrivMode_MouseX10);
break;
#if 0
case 1001:
if (rendset != -1)
{
scr_rendition (rendset, rendstyle);
- continue; /* for(;i;) */
+ continue; /* for (;i;) */
}
switch (arg[i])
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;
}
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;
}
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:
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
#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 ':' */
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;
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];
{
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)
{
/* ------------------------------------------------------------------------- */
/*
- * Send printf() formatted output to the command.
+ * Send printf () formatted output to the command.
* Only use for small amounts of data.
*/
void
* 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 */
{
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;
menuitem_t *prev, *next;
#ifdef DEBUG_STRICT
- assert(menu != NULL);
+ assert (menu != NULL);
#endif
prev = item->prev;
{
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);
}
/*
* 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)
/* return the arrow index corresponding to NAME */
int
-rxvt_menuarrow_find(char name)
+rxvt_menuarrow_find (char name)
{
int i;
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;
*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':
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;
if (cur == &end)
{
- p = STRCHR(string, '\0');
+ p = STRCHR (string, '\0');
}
else
{
while (1)
{
- p = STRCHR(next, '<');
+ p = STRCHR (next, '<');
if (p != NULL)
{
if (p[1] && p[2] == '>')
else
{
if (beg.str == NULL) /* no end needed */
- p = STRCHR(next, '\0');
+ p = STRCHR (next, '\0');
break;
}
next = (p + 1);
#ifdef DEBUG_MENUARROWS
cur = &beg;
- fprintf(stderr, "<b>(len %d) = %.*s\n",
+ fprintf (stderr, "<b> (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, "<e>(len %d) = %.*s\n",
+ fprintf (stderr, "<e> (len %d) = %.*s\n",
cur->len, cur->len, (cur->str ? cur->str : ""));
#endif
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 = "";
/*
* 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;
}
{
case MenuAction:
case MenuTerminalAction:
- free(item->entry.action.str);
+ free (item->entry.action.str);
item->entry.action.str = NULL;
break;
}
}
}
/* 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;
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)
{
}
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))
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 == '/')
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;
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;
{
for (m = CurrentBar->tail; m != NULL; m = m->prev)
{
- if (!STRCMP(path, m->name))
+ if (!STRCMP (path, m->name))
break;
}
}
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;
if (m != NULL)
{
*menu = m;
- path += STRLEN(path);
+ path += STRLEN (path);
}
return path;
}
bar_t *CurrentBar = CurrentBar;
#ifdef DEBUG_STRICT
- assert(CurrentBar != NULL);
+ assert (CurrentBar != NULL);
#endif
/* delete the entire menu */
}
if (menu->name != NULL)
- free(menu->name);
- free(menu);
+ free (menu->name);
+ free (menu);
return parent;
}
bar_t *CurrentBar = CurrentBar;
#ifdef DEBUG_STRICT
- assert(CurrentBar != NULL);
+ assert (CurrentBar != NULL);
#endif
- if (STRCHR(path, '/') != NULL)
+ if (STRCHR (path, '/') != NULL)
{
char *p;
path++;
parent = NULL;
}
- while ((p = STRCHR(path, '/')) != NULL)
+ while ((p = STRCHR (path, '/')) != NULL)
{
p[0] = '\0';
if (path[0] == '\0')
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;
{
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;
{
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;
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
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');
}
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;
}
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;
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
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);
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);
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;
/* 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);
}
{
#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);
}
}
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
if (CurrentBar->title)
{
- free(CurrentBar->title);
+ free (CurrentBar->title);
CurrentBar->title = NULL;
}
menuarrow_free (0); /* remove all arrow functions */
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;
}
bar = NULL;
}
#ifdef DEBUG_MENUBAR_STACKING
- fprintf(stderr, "%s found!\n", (bar ? "" : " NOT"));
+ fprintf (stderr, "%s found!\n", (bar ? "" : " NOT"));
#endif
return bar;
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;
{
/* 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;
}
/* give menubar this name */
- STRNCPY(CurrentBar->name, name, MAXNAME);
+ STRNCPY (CurrentBar->name, name, MAXNAME);
CurrentBar->name[MAXNAME - 1] = '\0';
return ret;
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;
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--;
/* FALLTHROUGH */
default:
- fprintf(fp, "M-"); /* meta prefix */
+ fprintf (fp, "M-"); /* meta prefix */
str++;
len--;
break;
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)
{
{
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
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;
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++)
{
{
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);
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')
}
#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)
{
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;
}
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] == ']')
{
}
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;
* 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);
}
/*
int n, cmd;
char *path, *name, *name2;
- if (menubar_visible(r) && ActiveMenu != NULL)
+ if (menubar_visible (r) && ActiveMenu != NULL)
menubar_expose ();
else
ActiveMenu = NULL;
do
{
next++;
- if ((next = STRCHR(next, ':')) == NULL)
+ if ((next = STRCHR (next, ':')) == NULL)
return; /* parse error */
}
while (next[1] != ']');
}
else
{
- if ((next = STRCHR(next, ']')) == NULL)
+ if ((next = STRCHR (next, ']')) == NULL)
return; /* parse error */
/* remove and skip ']' */
*next = '\0';
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])
}
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])
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;
/* 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)
{
menu_readonly = 1;
}
}
- else if (!STRCMP(str, "prev"))
+ else if (!STRCMP (str, "prev"))
{
if (CurrentBar)
{
menu_readonly = 1;
}
}
- else if (!STRCMP(str, "swap"))
+ else if (!STRCMP (str, "swap"))
{
/* swap the top 2 menus */
if (CurrentBar)
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
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;
/* 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 */
*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
{
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] == '*')
menu_clear (BuildMenu);
break;
}
- else if (len >= 2 && !STRCMP((path + len - 2), "/*"))
+ else if (len >= 2 && !STRCMP ((path + len - 2), "/*"))
{
path[len - 2] = '\0';
}
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;
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] == '*')
menu_clear (menu);
break; /* done */
}
- else if (len >= 2 && !STRCMP(&path[len - 2], "/*"))
+ else if (len >= 2 && !STRCMP (&path[len - 2], "/*"))
{
/* done */
break;
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);
{
short l = item->len + item->len2;
- MAX_IT(BuildMenu->width, l);
+ MAX_IT (BuildMenu->width, l);
}
}
}
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
menu_t *menu;
int x;
- if (!menubar_visible(r) || menuBar.win == 0)
+ if (!menubar_visible (r) || menuBar.win == 0)
return;
if (menubarGC == None)
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 ();
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)
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;
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;
break; /* literal '%' */
}
if (s != NULL)
- while (*s && len < sizeof(title) - 1)
+ while (*s && len < sizeof (title) - 1)
title[len++] = *s++;
break;
{
#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);
}
}
}
{
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
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))
{
{
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;
{
int h;
- if (isSeparator(item->name))
+ if (isSeparator (item->name))
h = HEIGHT_SEPARATOR;
else if (item == ActiveMenu->item)
{
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;
x = ev->x + (ActiveMenu->parent
? ActiveMenu->x
- : Width2Pixel(ActiveMenu->x));
+ : Width2Pixel (ActiveMenu->x));
if (x >= item->entry.submenu.menu->x)
{
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;
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);
{
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
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)
break;
case MotionNotify:
- while (XCheckTypedWindowEvent(display->display, TermWin.parent[0],
+ while (XCheckTypedWindowEvent (display->display, TermWin.parent[0],
MotionNotify, (XEvent *) ev)) ;
if (ActiveMenu)
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;
/* 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);
}
/*
*/
/* 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);
}
/*
*/
/* 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;
}
*/
/* EXTPROTO */
char *
-rxvt_Str_trim(char *str)
+rxvt_Str_trim (char *str)
{
char *r, *s;
int n;
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;
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)
{
*/
/* EXTPROTO */
int
-rxvt_Str_escaped(char *str)
+rxvt_Str_escaped (char *str)
{
char ch, *s, *d;
int i, num, append = 0;
/* 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++);)
{
else if (ch == '^')
{
ch = *s++;
- ch = toupper(ch);
+ ch = toupper (ch);
ch = (ch == '?' ? 127 : (ch - '@'));
}
*d++ = ch;
*/
/* EXTPROTO */
char **
-rxvt_splitcommastring(const char *cs)
+rxvt_splitcommastring (const char *cs)
{
int l, n, p;
const char *s, *t;
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;
*/
/* 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')
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);
}
}
}
/* 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;
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;
#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;
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
#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
/*----------------------------------------------------------------------*/
/* 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 */
*/
/* EXTPROTO */
int
-rxvt_get_pty(int *fd_tty, const char **ttydev)
+rxvt_get_pty (int *fd_tty, const char **ttydev)
{
int pfd;
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
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;
{
# 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
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);
}
}
}
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);
}
}
}
#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 ();
# 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 */
# 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 */
/* ---------------------------------------- */
* 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");
/* ---------------------------------------- */
# 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__ */
#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 ();
(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)))
/*
*****************************************************************************
* | +---------+ |
* | | ......%%| |
* | | ......%%| |
- * | | ..()..%%| |
+ * | | .. ()..%%| |
* | | ......%%| |
* | | %%%%%%%%| |
* | +---------+ | <.........................
#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
if (test) \
PrivateModes |= (bit); \
else \
- PrivateModes &= ~(bit)
+ PrivateModes &= ~ (bit)
#ifdef ALLOW_132_MODE
# define PrivMode_Default \
#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)
#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)
#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 */
#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 */
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
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);
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);
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);
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);
extern char **environ;
int
-main(int argc, const char *const *argv)
+main (int argc, const char *const *argv)
{
client c;
char buf[PATH_MAX];
}
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++)
struct im_watcher : watcher, callback0<void> {
template<class O1, class O2>
- im_watcher (O1 *object, void (O2::*method)())
- : callback0<void>(object,method)
+ im_watcher (O1 *object, void (O2::*method) ())
+ : callback0<void> (object,method)
{ }
void start (rxvt_display *display)
Window window;
template<class O1, class O2>
- xevent_watcher (O1 *object, void (O2::*method)(XEvent &))
- : callback1<void, XEvent &>(object,method)
+ xevent_watcher (O1 *object, void (O2::*method) (XEvent &))
+ : callback1<void, XEvent &> (object,method)
{ }
void start (rxvt_display *display, Window window)
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);
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
}
int
-main(int argc, const char *const *argv)
+main (int argc, const char *const *argv)
{
rxvt_init_signals ();
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;
}
void erase (iterator i) { simplevec<void *>::erase ((void **)i); }
iterator begin () const { return (iterator)simplevec<void *>::begin (); }
iterator end () const { return (iterator)simplevec<void *>::end (); }
- T &operator [](int i) { return *(T *)(&((*(simplevec<void *> *)this)[i])); }
- const T &operator [](int i) const { return *(const T *)(&((*(const simplevec<void *> *)this)[i])); }
+ T &operator [] (int i) { return * (T *) (& ((* (simplevec<void *> *)this)[i])); }
+ const T &operator [] (int i) const { return * (const T *) (& ((* (const simplevec<void *> *)this)[i])); }
};
#endif
template <typename I, typename T>
-I find(I first, I last, const T& value)
+I find (I first, I last, const T& value)
{
while (first != last && *first != value)
++first;
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<T> &a)
+ auto_ptr (auto_ptr<T> &a)
{
p = a.p;
a.p = 0;
}
template<typename A>
- auto_ptr(auto_ptr<A> &a)
+ auto_ptr (auto_ptr<A> &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<typename A>
- void operator =(auto_ptr<A> &a)
+ void operator = (auto_ptr<A> &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 ()
{
{
~stringvec ()
{
- for (char **c = begin(); c != end(); c++)
+ for (char **c = begin (); c != end (); c++)
delete [] *c;
}
};
firstfree = sizeof (chain);
}
- r = (void *)((char *)firstblock + firstfree);
+ r = (void *) ((char *)firstblock + firstfree);
firstfree += size;
}
/* 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 <num> rows starting from row <row>
#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 *
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)
{
int k;
rend_t setrstyle;
- D_SCREEN((stderr, "rxvt_scr_reset()"));
+ D_SCREEN ((stderr, "rxvt_scr_reset ()"));
TermWin.view_start = 0;
num_scr = 0;
* 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++)
{
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;
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
}
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);
}
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])
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);
}
}
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;
}
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* */
}
* Free everything. That way malloc debugging can find leakage.
*/
void
-rxvt_term::scr_release()
+rxvt_term::scr_release ()
{
uint16_t total_rows;
int i;
{
if (screen.text[i])
/* then so is screen.rend[i] */
- assert(screen.rend[i]);
+ assert (screen.rend[i]);
}
#endif
void
rxvt_term::scr_poweron ()
{
- D_SCREEN((stderr, "rxvt_scr_poweron()"));
+ D_SCREEN ((stderr, "rxvt_scr_poweron ()"));
scr_release ();
prev_nrow = prev_ncol = 0;
{
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:
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
}
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;
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;
&& !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;
{
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);
}
/* ------------------------------------------------------------------------- */
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))
{
count = -count;
i = row2 - row1 + 1;
- MIN_IT(count, i);
+ MIN_IT (count, i);
if (j > 0)
{
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);
&& (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;
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);
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;
}
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;
{
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 */
}
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
* 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
}
{
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)
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)
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);
}
/* ------------------------------------------------------------------------- */
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 ())
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);
}
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
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;
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);
}
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;
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);
want_refresh = 1;
num_scr_allow = 0;
- ZERO_SCROLLBACK();
+ ZERO_SCROLLBACK ();
selection_check (3);
fs = SET_FONT (rstyle, TermWin.fontset->find_font ('E'));
{
int end;
- ZERO_SCROLLBACK();
+ ZERO_SCROLLBACK ();
#ifdef RXVT_GRAPHICS
if (Gr_Displayed ())
}
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);
}
/* ------------------------------------------------------------------------- */
int16_t *slp;
want_refresh = 1;
- ZERO_SCROLLBACK();
+ ZERO_SCROLLBACK ();
#ifdef RXVT_GRAPHICS
if (Gr_Displayed ())
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:
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;
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:
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 */
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;
if (mode)
screen.flags |= Screen_Autowrap;
else
- screen.flags &= ~(Screen_Autowrap | Screen_WrapNext);
+ screen.flags &= ~ (Screen_Autowrap | Screen_WrapNext);
}
/* ------------------------------------------------------------------------- */
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);
}
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);
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);
}
\f
/* ------------------------------------------------------------------------- *
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)
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);
}
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);
}
#endif
num_scr -= (TermWin.view_start - oldviewstart);
}
- return (int)(TermWin.view_start - oldviewstart);
+ return (int) (TermWin.view_start - oldviewstart);
}
/* ------------------------------------------------------------------------- */
# 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)
{
scr_rvideo_mode (!rvideo); /* refresh also done */
}
else
- XBell(display->display, 0);
+ XBell (display->display, 0);
#endif
}
{
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
*/
#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)
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 */
scr_reverse_selection ();
/*
- * C: set the cursor character(s)
+ * C: set the cursor character (s)
*/
{
unsigned char setoldcursor;
{
cursorwidth++;
- srp = &(screen.rend[screen.cur.row + TermWin.saveLines]
+ srp = & (screen.rend[screen.cur.row + TermWin.saveLines]
[screen.cur.col]);
if (showcursor && TermWin.focus)
ccol1 = Color_cursor;
else
#ifdef CURSOR_COLOR_IS_RENDITION_COLOR
- ccol1 = GET_FGCOLOR(rstyle);
+ ccol1 = GET_FGCOLOR (rstyle);
#else
ccol1 = Color_fg;
#endif
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
}
*/
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;
{
/* 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 (),
/*
* E2: OK, now the real pass
*/
- int ypixel = (int)Row2Pixel(row);
+ int ypixel = (int)Row2Pixel (row);
for (col = 0; col < TermWin.ncol; col++)
{
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;
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?
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)
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....) */
{
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
}
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));
}
}
* 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;
/* ------------------------------------------------------------------------- */
void
-rxvt_term::scr_clear()
+rxvt_term::scr_clear ()
{
if (!TermWin.mapped)
return;
{
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
: 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 */
}
}
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 ();
}
/* ------------------------------------------------------------------------- */
tt_write (ds, (int)n);
}
- free(ds);
+ free (ds);
}
/* ------------------------------------------------------------------------- */
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 */
{
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)
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);
}
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;
}
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;
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;
}
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 ();
}
* 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;
}
}
}
- 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);
}
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;
}
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 ();
}
/* ------------------------------------------------------------------------- */
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;
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];
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));
}
/* ------------------------------------------------------------------------- */
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,
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 */
/* 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
}
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;
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 */
{
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
/*
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;
}
}
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:
{
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;
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;
}
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)
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 */
/*
* 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)
}
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)
}
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)
{
{
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;
#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;
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 */
}
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);
}
/* ------------------------------------------------------------------------- */
#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;
}
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;
}
selectlen = 0;
}
- if (XmbTextListToTextProperty(display->display, &cl, 1, style, &ct) >= 0)
+ if (XmbTextListToTextProperty (display->display, &cl, 1, style, &ct) >= 0)
freect = 1;
else
{
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); */
}
/* ------------------------------------------------------------------------- */
* ------------------------------------------------------------------------- */
#if 0
void
-rxvt_debug_colors(void)
+rxvt_debug_colors (void)
{
int color;
const char *name[] =
"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
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++)
{
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;
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;
//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;
//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);
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);
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
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 +
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);
}
#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;
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)
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 */
/* 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 */
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;
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);
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);
* 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 */
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;
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;
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
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);
#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;
}
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
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
/* 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
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)
{
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;
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;
: _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<T> &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<T> &operator= (const simplevec<T> &v)
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;
}
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
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;
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;
}
}
template<class T>
bool operator== (const simplevec<T> &v1, const simplevec<T> &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<class T>
bool operator< (const simplevec<T> &v1, const simplevec<T> &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
/*--------------------------------*-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 <gcw@pobox.com>
#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;
}
char *
-strncpy(char *d, const char *s, size_t len)
+strncpy (char *d, const char *s, size_t len)
{
char *r = d;
}
int
-strcmp(const char *s1, const char *s2)
+strcmp (const char *s1, const char *s2)
{
for ( ; (*s1 == *s2++); )
if (*s1++ == '\0')
}
int
-strncmp(const char *s1, const char *s2, size_t len)
+strncmp (const char *s1, const char *s2, size_t len)
{
if (len)
{
}
char *
-strcat(char *s1, const char *s2)
+strcat (char *s1, const char *s2)
{
char *r = s1;
}
char *
-strncat(char *s1, const char *s2, size_t len)
+strncat (char *s1, const char *s2, size_t len)
{
char *r = s1;
}
size_t
-strlen(const char *s)
+strlen (const char *s)
{
size_t len = 0;
}
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;
}
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;
}
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 <mason@primenet.com.au>
+ * Possibly faster memmove () by Geoff Wing <mason@primenet.com.au>
*--------------------------------------------------------------------------*/
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;
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--; )
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--; )
}
/*--------------------------------------------------------------------------*
- * Possibly faster memset() by Geoff Wing <mason@primenet.com.au>
+ * Possibly faster memset () by Geoff Wing <mason@primenet.com.au>
* 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;
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--;)
#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 */
/*--------------------------------*-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 <nation@rocket.sanders.lockheed.com>
/*
* `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
{
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
/*{{{ 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 */
}
opt = argv[i];
#ifdef DEBUG_RESOURCES
- fprintf(stderr, "argv[%d] = %s: ", i, opt);
+ fprintf (stderr, "argv[%d] = %s: ", i, opt);
#endif
if (*opt == '-')
{
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;
}
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
}
if (bad_option)
- rxvt_usage(0);
+ rxvt_usage (0);
}
/*}}} */
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;
}
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;
}
/*
* 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;
}
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;
# endif /* KEYSYM_RESOURCE */
# ifndef USE_XGETDEFAULT
-/*{{{ rxvt_get_xdefaults() */
+/*{{{ rxvt_get_xdefaults () */
/*
* the matching algorithm used for memory-save fake resources
*/
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);
}
/*}}} */
/*{{{ 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
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 (/) */
}
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
/* 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;
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;
{
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);
}
}
}
*/
# 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
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:
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 */
get_xdefaults (fd, APL_CLASS);
get_xdefaults (fd, ""); /* partial match */
if (fd != NULL)
- fclose(fd);
+ fclose (fd);
# endif /* USE_XGETDEFAULT */
# if defined XAPPLOADDIR
}
/* Free the path of the possibly available localized Rxvt file */
- free(localepath);
+ free (localepath);
# endif
# endif
/* 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 */
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
/*--------------------------------*-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 <raster@zip.com.au>
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;
} /* 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)
{
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;
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;
changed++;
}
}
- free(str);
+ free (str);
return changed;
}
{
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 */
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
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)
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);
}
/*
*/
/* 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;
{
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')
{
/*
* we already have the required attributes
*/
- /* XGetWindowAttributes(display->display, TermWin.vt, &attr); */
+ /* XGetWindowAttributes (display->display, TermWin.vt, &attr); */
xpmAttr.closeness = 30000;
xpmAttr.colormap = XCMAP;
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;